diff --git a/dist-web/wp.data b/dist-web/wp.data index e325d46061..419d46ff65 100644 --- a/dist-web/wp.data +++ b/dist-web/wp.data @@ -1,4 +1,4 @@ - '1' ) ); } function trackback_response( $error = 0, $error_message = '' ) { header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); if ( $error ) { echo '\n"; echo "\n"; echo "1\n"; echo "$error_message\n"; echo ''; die(); } else { echo '\n"; echo "\n"; echo "0\n"; echo ''; } } $request_array = 'HTTP_POST_VARS'; if ( ! isset( $_GET['tb_id'] ) || ! $_GET['tb_id'] ) { $tb_id = explode( '/', $_SERVER['REQUEST_URI'] ); $tb_id = (int) $tb_id[ count( $tb_id ) - 1 ]; } $tb_url = isset( $_POST['url'] ) ? $_POST['url'] : ''; $charset = isset( $_POST['charset'] ) ? $_POST['charset'] : ''; $title = isset( $_POST['title'] ) ? wp_unslash( $_POST['title'] ) : ''; $excerpt = isset( $_POST['excerpt'] ) ? wp_unslash( $_POST['excerpt'] ) : ''; $blog_name = isset( $_POST['blog_name'] ) ? wp_unslash( $_POST['blog_name'] ) : ''; if ( $charset ) { $charset = str_replace( array( ',', ' ' ), '', strtoupper( trim( $charset ) ) ); } else { $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS'; } if ( false !== strpos( $charset, 'UTF-7' ) ) { die; } if ( function_exists( 'mb_convert_encoding' ) ) { $title = mb_convert_encoding( $title, get_option( 'blog_charset' ), $charset ); $excerpt = mb_convert_encoding( $excerpt, get_option( 'blog_charset' ), $charset ); $blog_name = mb_convert_encoding( $blog_name, get_option( 'blog_charset' ), $charset ); } $title = wp_slash( $title ); $excerpt = wp_slash( $excerpt ); $blog_name = wp_slash( $blog_name ); if ( is_single() || is_page() ) { $tb_id = $posts[0]->ID; } if ( ! isset( $tb_id ) || ! (int) $tb_id ) { trackback_response( 1, __( 'I really need an ID for this to work.' ) ); } if ( empty( $title ) && empty( $tb_url ) && empty( $blog_name ) ) { wp_redirect( get_permalink( $tb_id ) ); exit; } if ( ! empty( $tb_url ) && ! empty( $title ) ) { do_action( 'pre_trackback_post', $tb_id, $tb_url, $charset, $title, $excerpt, $blog_name ); header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); if ( ! pings_open( $tb_id ) ) { trackback_response( 1, __( 'Sorry, trackbacks are closed for this item.' ) ); } $title = wp_html_excerpt( $title, 250, '…' ); $excerpt = wp_html_excerpt( $excerpt, 252, '…' ); $comment_post_ID = (int) $tb_id; $comment_author = $blog_name; $comment_author_email = ''; $comment_author_url = $tb_url; $comment_content = "$title\n\n$excerpt"; $comment_type = 'trackback'; $dupe = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $comment_post_ID, $comment_author_url ) ); if ( $dupe ) { trackback_response( 1, __( 'There is already a ping from that URL for this post.' ) ); } $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type' ); $result = wp_new_comment( $commentdata ); if ( is_wp_error( $result ) ) { trackback_response( 1, $result->get_error_message() ); } $trackback_id = $wpdb->insert_id; do_action( 'trackback_post', $trackback_id ); trackback_response( 0 ); } =' ) ) { if ( ! headers_sent() ) { header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); } fastcgi_finish_request(); } if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) { die(); } define( 'DOING_CRON', true ); if ( ! defined( 'ABSPATH' ) ) { require_once __DIR__ . '/wp-load.php'; } function _get_cron_lock() { global $wpdb; $value = 0; if ( wp_using_ext_object_cache() ) { $value = wp_cache_get( 'doing_cron', 'transient', true ); } else { $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); if ( is_object( $row ) ) { $value = $row->option_value; } } return $value; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { die(); } $gmt_time = microtime( true ); $doing_cron_transient = get_transient( 'doing_cron' ); if ( empty( $doing_wp_cron ) ) { if ( empty( $_GET['doing_wp_cron'] ) ) { if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) { return; } $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); $doing_cron_transient = $doing_wp_cron; set_transient( 'doing_cron', $doing_wp_cron ); } else { $doing_wp_cron = $_GET['doing_wp_cron']; } } if ( $doing_cron_transient !== $doing_wp_cron ) { return; } foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } foreach ( $cronhooks as $hook => $keys ) { foreach ( $keys as $k => $v ) { $schedule = $v['schedule']; if ( $schedule ) { wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] ); } wp_unschedule_event( $timestamp, $hook, $v['args'] ); do_action_ref_array( $hook, $v['args'] ); if ( _get_cron_lock() !== $doing_wp_cron ) { return; } } } } if ( _get_cron_lock() === $doing_wp_cron ) { delete_transient( 'doing_cron' ); } die(); - + WordPress › Installation - - - - - + + + + + -

Already Installed

You appear to have already installed WordPress. To reinstall please clear your old database tables first.

Log In

Success! + +

WordPress has been installed. Thank you, and enjoy!

+ + + + + + + + + + +
Usernameadmin
Password +

Your chosen password.

+
+ +

Log In

+ + + + + + + + + + + + + + + + + + + + + +'; ?> @@ -986,7 +1048,7 @@ var ajaxurl = ' + if ( current_user_can( 'customize' ) ) { wp_customize_support_script(); } ?>
@@ -1095,7 +1157,7 @@ wp_comment_reply( '-1', true, 'detail' ); wp_comment_trashnotice(); require_once

$pop_data ) { if ( isset( $importers[ $pop_importer ] ) ) { continue; } if ( isset( $importers[ $pop_data['importer-id'] ] ) ) { continue; } $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'], ); } if ( empty( $importers ) ) { echo '

' . __( 'No importers are available.' ) . '

'; } else { uasort( $importers, '_usort_by_first_member' ); ?> + $importers = get_importers(); foreach ( $popular_importers as $pop_importer => $pop_data ) { if ( isset( $importers[ $pop_importer ] ) ) { continue; } if ( isset( $importers[ $pop_data['importer-id'] ] ) ) { continue; } $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'], ); } if ( empty( $importers ) ) { echo '

' . __( 'No importers are available.' ) . '

'; } else { uasort( $importers, '_usort_by_first_member' ); ?>

true ) ); if ( ! is_multisite() && $broken_themes ) { ?> + $broken_themes = wp_get_themes( array( 'errors' => true ) ); if ( ! is_multisite() && $broken_themes ) { ?>

@@ -3408,7 +3470,7 @@ endif;
'true' ), $redirect ); } elseif ( 'disable-auto-update' === $action ) { $auto_updates = array_diff( $auto_updates, array( $plugin ) ); $redirect = add_query_arg( array( 'disabled-auto-update' => 'true' ), $redirect ); } else { $plugins = (array) wp_unslash( $_POST['checked'] ); if ( 'enable-auto-update-selected' === $action ) { $new_auto_updates = array_merge( $auto_updates, $plugins ); $new_auto_updates = array_unique( $new_auto_updates ); $query_args = array( 'enabled-auto-update-multi' => 'true' ); } else { $new_auto_updates = array_diff( $auto_updates, $plugins ); $query_args = array( 'disabled-auto-update-multi' => 'true' ); } if ( $new_auto_updates == $auto_updates ) { wp_redirect( $redirect ); exit; } $auto_updates = $new_auto_updates; $redirect = add_query_arg( $query_args, $redirect ); } $all_items = apply_filters( 'all_plugins', get_plugins() ); $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); update_site_option( 'auto_update_plugins', $auto_updates ); wp_redirect( $redirect ); exit; default: if ( isset( $_POST['checked'] ) ) { check_admin_referer( 'bulk-plugins' ); $screen = get_current_screen()->id; $sendback = wp_get_referer(); $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $action, $plugins ); wp_safe_redirect( $sendback ); exit; } break; } } $wp_list_table->prepare_items(); wp_enqueue_script( 'plugin-install' ); add_thickbox(); add_screen_option( 'per_page', array( 'default' => 999 ) ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '

' . '

' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '

' . '

' . sprintf( __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), __( 'https://wordpress.org/plugins/' ) ) . '

', ) ); get_current_screen()->add_help_tab( array( 'id' => 'compatibility-problems', 'title' => __( 'Troubleshooting' ), 'content' => '

' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '

' . '

' . sprintf( __( 'If something goes wrong with a plugin and you cannot use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), '' . WP_PLUGIN_DIR . '' ) . '

', ) ); $help_sidebar_autoupdates = ''; if ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) { get_current_screen()->add_help_tab( array( 'id' => 'plugins-themes-auto-updates', 'title' => __( 'Auto-updates' ), 'content' => '

' . __( 'Auto-updates can be enabled or disabled for each individual plugin. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '

' . '

' . __( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '

' . '

' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '

', ) ); $help_sidebar_autoupdates = '

' . __( 'Learn more: Auto-updates documentation' ) . '

'; } get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Managing Plugins' ) . '

' . $help_sidebar_autoupdates . '

' . __( 'Support' ) . '

' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter plugins list' ), 'heading_pagination' => __( 'Plugins list navigation' ), 'heading_list' => __( 'Plugins list' ), ) ); $title = __( 'Plugins' ); $parent_file = 'plugins.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; $invalid = validate_active_plugins(); if ( ! empty( $invalid ) ) { foreach ( $invalid as $plugin_file => $error ) { echo '

'; printf( __( 'The plugin %1$s has been deactivated due to an error: %2$s' ), '' . esc_html( $plugin_file ) . '', $error->get_error_message() ); echo '

'; } } if ( isset( $_GET['error'] ) ) : if ( isset( $_GET['main'] ) ) { $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); } elseif ( isset( $_GET['charsout'] ) ) { $errmsg = sprintf( _n( 'The plugin generated %d character of unexpected output during activation.', 'The plugin generated %d characters of unexpected output during activation.', $_GET['charsout'] ), $_GET['charsout'] ); $errmsg .= ' ' . __( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ); } elseif ( 'resuming' === $_GET['error'] ) { $errmsg = __( 'Plugin could not be resumed because it triggered a fatal error.' ); } else { $errmsg = __( 'Plugin could not be activated because it triggered a fatal error.' ); } ?> + require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } else { $plugins_to_delete = count( $plugins ); } $delete_result = delete_plugins( $plugins ); set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); exit; case 'clear-recent-list': if ( ! is_network_admin() ) { update_option( 'recently_activated', array() ); } else { update_site_option( 'recently_activated', array() ); } break; case 'resume': if ( is_multisite() ) { return; } if ( ! current_user_can( 'resume_plugin', $plugin ) ) { wp_die( __( 'Sorry, you are not allowed to resume this plugin.' ) ); } check_admin_referer( 'resume-plugin_' . $plugin ); $result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$s" ) ); if ( is_wp_error( $result ) ) { wp_die( $result ); } wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$s" ) ); exit; case 'enable-auto-update': case 'disable-auto-update': case 'enable-auto-update-selected': case 'disable-auto-update-selected': if ( ! current_user_can( 'update_plugins' ) || ! wp_is_auto_update_enabled_for_type( 'plugin' ) ) { wp_die( __( 'Sorry, you are not allowed to manage plugins automatic updates.' ) ); } if ( is_multisite() && ! is_network_admin() ) { wp_die( __( 'Please connect to your network admin to manage plugins automatic updates.' ) ); } $redirect = self_admin_url( "plugins.php?plugin_status={$status}&paged={$page}&s={$s}" ); if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) { if ( empty( $plugin ) ) { wp_redirect( $redirect ); exit; } check_admin_referer( 'updates' ); } else { if ( empty( $_POST['checked'] ) ) { wp_redirect( $redirect ); exit; } check_admin_referer( 'bulk-plugins' ); } $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); if ( 'enable-auto-update' === $action ) { $auto_updates[] = $plugin; $auto_updates = array_unique( $auto_updates ); $redirect = add_query_arg( array( 'enabled-auto-update' => 'true' ), $redirect ); } elseif ( 'disable-auto-update' === $action ) { $auto_updates = array_diff( $auto_updates, array( $plugin ) ); $redirect = add_query_arg( array( 'disabled-auto-update' => 'true' ), $redirect ); } else { $plugins = (array) wp_unslash( $_POST['checked'] ); if ( 'enable-auto-update-selected' === $action ) { $new_auto_updates = array_merge( $auto_updates, $plugins ); $new_auto_updates = array_unique( $new_auto_updates ); $query_args = array( 'enabled-auto-update-multi' => 'true' ); } else { $new_auto_updates = array_diff( $auto_updates, $plugins ); $query_args = array( 'disabled-auto-update-multi' => 'true' ); } if ( $new_auto_updates == $auto_updates ) { wp_redirect( $redirect ); exit; } $auto_updates = $new_auto_updates; $redirect = add_query_arg( $query_args, $redirect ); } $all_items = apply_filters( 'all_plugins', get_plugins() ); $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); update_site_option( 'auto_update_plugins', $auto_updates ); wp_redirect( $redirect ); exit; default: if ( isset( $_POST['checked'] ) ) { check_admin_referer( 'bulk-plugins' ); $screen = get_current_screen()->id; $sendback = wp_get_referer(); $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $action, $plugins ); wp_safe_redirect( $sendback ); exit; } break; } } $wp_list_table->prepare_items(); wp_enqueue_script( 'plugin-install' ); add_thickbox(); add_screen_option( 'per_page', array( 'default' => 999 ) ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '

' . '

' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '

' . '

' . sprintf( __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), __( 'https://wordpress.org/plugins/' ) ) . '

', ) ); get_current_screen()->add_help_tab( array( 'id' => 'compatibility-problems', 'title' => __( 'Troubleshooting' ), 'content' => '

' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '

' . '

' . sprintf( __( 'If something goes wrong with a plugin and you cannot use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), '' . WP_PLUGIN_DIR . '' ) . '

', ) ); $help_sidebar_autoupdates = ''; if ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) { get_current_screen()->add_help_tab( array( 'id' => 'plugins-themes-auto-updates', 'title' => __( 'Auto-updates' ), 'content' => '

' . __( 'Auto-updates can be enabled or disabled for each individual plugin. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '

' . '

' . __( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '

' . '

' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '

', ) ); $help_sidebar_autoupdates = '

' . __( 'Learn more: Auto-updates documentation' ) . '

'; } get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Managing Plugins' ) . '

' . $help_sidebar_autoupdates . '

' . __( 'Support' ) . '

' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter plugins list' ), 'heading_pagination' => __( 'Plugins list navigation' ), 'heading_list' => __( 'Plugins list' ), ) ); $title = __( 'Plugins' ); $parent_file = 'plugins.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; $invalid = validate_active_plugins(); if ( ! empty( $invalid ) ) { foreach ( $invalid as $plugin_file => $error ) { echo '

'; printf( __( 'The plugin %1$s has been deactivated due to an error: %2$s' ), '' . esc_html( $plugin_file ) . '', esc_html( $error->get_error_message() ) ); echo '

'; } } if ( isset( $_GET['error'] ) ) : if ( isset( $_GET['main'] ) ) { $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); } elseif ( isset( $_GET['charsout'] ) ) { $errmsg = sprintf( _n( 'The plugin generated %d character of unexpected output during activation.', 'The plugin generated %d characters of unexpected output during activation.', $_GET['charsout'] ), $_GET['charsout'] ); $errmsg .= ' ' . __( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ); } elseif ( 'resuming' === $_GET['error'] ) { $errmsg = __( 'Plugin could not be resumed because it triggered a fatal error.' ); } else { $errmsg = __( 'Plugin could not be activated because it triggered a fatal error.' ); } ?>

'error_scrape', 'plugin' => urlencode( $plugin ), '_wpnonce' => urlencode( $_GET['_error_nonce'] ), ), admin_url( 'plugins.php' ) ); ?> @@ -3421,7 +3483,7 @@ elseif ( isset( $_GET['deleted'] ) ) : $delete_result = get_transient( 'plugins_

get_error_message() ); ?> + printf( __( 'Plugin could not be deleted due to an error: %s' ), esc_html( $delete_result->get_error_message() ) ); ?>

@@ -5429,7 +5491,7 @@ wp_original_referer_field( true, 'previous' ); wp_nonce_field( 'update-tag_' . $ if ( 'category' === $taxonomy ) { do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); } elseif ( 'link_category' === $taxonomy ) { do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); } else { do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' ); } do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); ?>
+ if ( 'category' === $taxonomy ) { do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); } elseif ( 'link_category' === $taxonomy ) { do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' ); } else { do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' ); } do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); ?>
@@ -5465,7 +5527,7 @@ if ( current_user_can( $post_type_object->cap->create_posts ) ) { echo ' $count ) { if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) { $messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) ); } elseif ( isset( $bulk_messages['post'][ $message ] ) ) { $messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) ); } if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) { $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] ); $messages[] = '' . __( 'Undo' ) . ''; } if ( 'untrashed' === $message && isset( $_REQUEST['ids'] ) ) { $ids = explode( ',', $_REQUEST['ids'] ); if ( 1 === count( $ids ) && current_user_can( 'edit_post', $ids[0] ) ) { $messages[] = sprintf( '%2$s', esc_url( get_edit_post_link( $ids[0] ) ), esc_html( get_post_type_object( get_post_type( $ids[0] ) )->labels->edit_item ) ); } } } if ( $messages ) { echo '

' . implode( ' ', $messages ) . '

'; } unset( $messages ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] ); ?> + $messages = array(); foreach ( $bulk_counts as $message => $count ) { if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) { $messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) ); } elseif ( isset( $bulk_messages['post'][ $message ] ) ) { $messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) ); } if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) { $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] ); $messages[] = '' . __( 'Undo' ) . ''; } if ( 'untrashed' === $message && isset( $_REQUEST['ids'] ) ) { $ids = explode( ',', $_REQUEST['ids'] ); if ( 1 === count( $ids ) && current_user_can( 'edit_post', $ids[0] ) ) { $messages[] = sprintf( '%2$s', esc_url( get_edit_post_link( $ids[0] ) ), esc_html( get_post_type_object( get_post_type( $ids[0] ) )->labels->edit_item ) ); } } } if ( $messages ) { echo '

' . implode( ' ', $messages ) . '

'; } unset( $messages ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] ); ?> views(); ?> @@ -5994,6 +6056,12 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) { do_action( 'site_healt

Version %1$s addressed some security issues and fixed %2$s bug.', 'Version %1$s addressed some security issues and fixed %2$s bugs.', 17 ), '6.0.2', number_format_i18n( 17 ) ); ?> + the release notes.' ), sprintf( esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), sanitize_title( '6.0.2' ) ) ); ?> +

+

+ Version %1$s addressed %2$s bug.', 'Version %1$s addressed %2$s bugs.', 31 ), '6.0.1', number_format_i18n( 31 ) ); ?> the release notes.' ), sprintf( esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), sanitize_title( '6.0.1' ) ) ); ?> @@ -6160,10 +6228,10 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) { do_action( 'site_healt

- - - - + + + + @@ -6885,714954 +6953,15654 @@ if ( isset( $_REQUEST['deleted'] ) ) { echo '
li{float:right;margin-left:25px;font-size:13px;line-height:1.8;cursor:default;max-width:100%;overflow:hidden;text-overflow:ellipsis}.tagchecklist .ntdelbutton{position:absolute;width:24px;height:24px;border:none;margin:0 -19px 0 0;padding:0;background:0 0;cursor:pointer;text-indent:0}#poststuff .stuffbox>h3,#poststuff h2,#poststuff h3.hndle{font-size:14px;padding:8px 12px;margin:0;line-height:1.4}#poststuff .stuffbox h2{padding:8px 10px}#poststuff .stuffbox>h2{border-bottom:1px solid #f0f0f1}#poststuff .inside{margin:6px 0 0}.link-add-php #poststuff .inside,.link-php #poststuff .inside{margin-top:12px}#poststuff .stuffbox .inside{margin:0}#poststuff .inside #page_template,#poststuff .inside #parent_id{max-width:100%}.post-attributes-label-wrapper{margin-bottom:.5em}.post-attributes-label{vertical-align:baseline;font-weight:600}#comment-status-radio,#post-visibility-select{line-height:1.5;margin-top:3px}#linksubmitdiv .inside,#poststuff #submitdiv .inside{margin:0;padding:0}#post-body-content,.edit-form-section{margin-bottom:20px}.wp_attachment_details .attachment-content-description{margin-top:.5385em;display:inline-block;min-height:1.6923em}.privacy-settings #wpcontent,.privacy-settings.auto-fold #wpcontent,.site-health #wpcontent,.site-health.auto-fold #wpcontent{padding-right:0}.health-check-header h1,.privacy-settings-header h1{display:inline-block;font-weight:600;margin:0 .8rem 1rem;font-size:23px;padding:9px 0 4px;line-height:1.3}.health-check-header,.privacy-settings-header{text-align:center;margin:0 0 1rem;background:#fff;border-bottom:1px solid #dcdcde}.health-check-title-section,.privacy-settings-title-section{display:flex;align-items:center;justify-content:center;clear:both;padding-top:8px}.privacy-settings-tabs-wrapper{display:-ms-inline-grid;-ms-grid-columns:1fr 1fr;vertical-align:top;display:inline-grid;grid-template-columns:1fr 1fr}.privacy-settings-tab{display:block;text-decoration:none;color:inherit;padding:.5rem 1rem 1rem;margin:0 1rem;transition:box-shadow .5s ease-in-out}.health-check-tab:nth-child(1),.privacy-settings-tab:nth-child(1){-ms-grid-column:1}.health-check-tab:nth-child(2),.privacy-settings-tab:nth-child(2){-ms-grid-column:2}.health-check-tab:focus,.privacy-settings-tab:focus{color:#1d2327;outline:1px solid #787c82;box-shadow:none}.health-check-tab.active,.privacy-settings-tab.active{box-shadow:inset 0 -3px #3582c4;font-weight:600}.health-check-body,.privacy-settings-body{max-width:800px;margin:0 auto}.tools-privacy-policy-page th{min-width:230px}.hr-separator{margin-top:20px;margin-bottom:15px}.health-check-accordion,.privacy-settings-accordion{border:1px solid #c3c4c7}.health-check-accordion-heading,.privacy-settings-accordion-heading{margin:0;border-top:1px solid #c3c4c7;font-size:inherit;line-height:inherit;font-weight:600;color:inherit}.health-check-accordion-heading:first-child,.privacy-settings-accordion-heading:first-child{border-top:none}.health-check-accordion-trigger,.privacy-settings-accordion-trigger{background:#fff;border:0;color:#2c3338;cursor:pointer;display:flex;font-weight:400;margin:0;padding:1em 1.5em 1em 3.5em;min-height:46px;position:relative;text-align:right;width:100%;align-items:center;justify-content:space-between;-webkit-user-select:auto;user-select:auto}.health-check-accordion-trigger:active,.health-check-accordion-trigger:hover,.privacy-settings-accordion-trigger:active,.privacy-settings-accordion-trigger:hover{background:#f6f7f7}.health-check-accordion-trigger:focus,.privacy-settings-accordion-trigger:focus{color:#1d2327;border:none;box-shadow:none;outline-offset:-1px;outline:2px solid #2271b1;background-color:#f6f7f7}.health-check-accordion-trigger .title,.privacy-settings-accordion-trigger .title{pointer-events:none;font-weight:600;flex-grow:1}.health-check-accordion-trigger .icon,.privacy-settings-accordion-trigger .icon,.privacy-settings-view-read .icon,.site-health-view-passed .icon{border:solid #50575e;border-width:0 0 2px 2px;height:.5rem;pointer-events:none;position:absolute;left:1.5em;top:50%;transform:translateY(-70%) rotate(-45deg);width:.5rem}.health-check-accordion-trigger .badge,.privacy-settings-accordion-trigger .badge{padding:.1rem .5rem .15rem;color:#2c3338;font-weight:600}.privacy-settings-accordion-trigger .badge{margin-right:.5rem}.health-check-accordion-trigger .badge.blue,.privacy-settings-accordion-trigger .badge.blue{border:1px solid #72aee6}.health-check-accordion-trigger .badge.orange,.privacy-settings-accordion-trigger .badge.orange{border:1px solid #dba617}.health-check-accordion-trigger .badge.red,.privacy-settings-accordion-trigger .badge.red{border:1px solid #e65054}.health-check-accordion-trigger .badge.green,.privacy-settings-accordion-trigger .badge.green{border:1px solid #00ba37}.health-check-accordion-trigger .badge.purple,.privacy-settings-accordion-trigger .badge.purple{border:1px solid #2271b1}.health-check-accordion-trigger .badge.gray,.privacy-settings-accordion-trigger .badge.gray{border:1px solid #c3c4c7}.health-check-accordion-trigger[aria-expanded=true] .icon,.privacy-settings-accordion-trigger[aria-expanded=true] .icon,.privacy-settings-view-passed[aria-expanded=true] .icon,.site-health-view-passed[aria-expanded=true] .icon{transform:translateY(-30%) rotate(135deg)}.health-check-accordion-panel,.privacy-settings-accordion-panel{margin:0;padding:1em 1.5em;background:#fff}.health-check-accordion-panel[hidden],.privacy-settings-accordion-panel[hidden]{display:none}.health-check-accordion-panel a .dashicons,.privacy-settings-accordion-panel a .dashicons{text-decoration:none}.privacy-settings-accordion-actions{text-align:left;display:block}.privacy-settings-accordion-actions .success{display:none;color:#008a20;padding-left:1em;padding-top:6px}.privacy-settings-accordion-actions .success.visible{display:inline-block}.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .privacy-policy-tutorial,.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .privacy-text-copy,.privacy-settings-accordion-panel.hide-privacy-policy-tutorial .wp-policy-help{display:none}.privacy-settings-accordion-panel strong.privacy-policy-tutorial,.privacy-settings-accordion-panel strong.wp-policy-help{display:block;margin:0 0 1em}.privacy-text-copy span{pointer-events:none}.privacy-settings-accordion-panel .wp-suggested-text div>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success):not(.noticep),.privacy-settings-accordion-panel .wp-suggested-text>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success):not(.noticep),.privacy-settings-accordion-panel div>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success):not(.noticep),.privacy-settings-accordion-panel>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(div):not(.privacy-policy-tutorial):not(.wp-policy-help):not(.privacy-text-copy):not(span.success):not(.noticep){margin:0;padding:1em;border-right:2px solid #787c82}@media screen and (max-width:782px){.health-check-body,.privacy-settings-body{margin:0 12px;width:auto}.privacy-settings .notice,.site-health .notice{margin:5px 10px 15px}.privacy-settings .update-nag,.site-health .update-nag{margin-left:10px;margin-right:10px}input#create-page{margin-top:10px}.wp-core-ui button.privacy-text-copy{white-space:normal;line-height:1.8}}@media only screen and (max-width:1004px){.health-check-body,.privacy-settings-body{margin:0 22px;width:auto}}#postcustomstuff thead th{padding:5px 8px 8px;background-color:#f0f0f1}#postcustom #postcustomstuff .submit{border:0 none;float:none;padding:0 8px 8px}#side-sortables #postcustom #postcustomstuff .submit{margin:0;padding:0}#side-sortables #postcustom #postcustomstuff #the-list textarea{height:85px}#side-sortables #postcustom #postcustomstuff td.left input,#side-sortables #postcustom #postcustomstuff td.left select,#side-sortables #postcustomstuff #newmetaleft a{margin:3px 3px 0}#postcustomstuff table{margin:0;width:100%;border:1px solid #dcdcde;border-spacing:0;background-color:#f6f7f7}#postcustomstuff tr{vertical-align:top}#postcustomstuff table input,#postcustomstuff table select,#postcustomstuff table textarea{width:96%;margin:8px}#side-sortables #postcustomstuff table input,#side-sortables #postcustomstuff table select,#side-sortables #postcustomstuff table textarea{margin:3px}#postcustomstuff td.left,#postcustomstuff th.left{width:38%}#postcustomstuff .submit input{margin:0;width:auto}#postcustomstuff #newmetaleft a{display:inline-block;margin:0 8px 8px;text-decoration:none}.no-js #postcustomstuff #enternew{display:none}#post-body-content .compat-attachment-fields{margin-bottom:20px}.compat-attachment-fields th{padding-top:5px;padding-left:10px}#select-featured-image{padding:4px 0;overflow:hidden}#select-featured-image img{max-width:100%;height:auto;margin-bottom:10px}#select-featured-image a{float:right;clear:both}#select-featured-image .remove{display:none;margin-top:10px}.js #select-featured-image.has-featured-image .remove{display:inline-block}.no-js #select-featured-image .choose{display:none}.post-format-icon::before{display:inline-block;vertical-align:middle;height:20px;width:20px;margin-top:-4px;margin-left:7px;color:#dcdcde;font:normal 20px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a.post-format-icon:hover:before{color:#135e96}#post-formats-select{line-height:2}#post-formats-select .post-format-icon::before{top:5px}input.post-format{margin-top:1px}label.post-format-icon{margin-right:0;padding:2px 0}.post-format-icon.post-format-standard::before{content:"\f109"}.post-format-icon.post-format-image::before{content:"\f128"}.post-format-icon.post-format-gallery::before{content:"\f161"}.post-format-icon.post-format-audio::before{content:"\f127"}.post-format-icon.post-format-video::before{content:"\f126"}.post-format-icon.post-format-chat::before{content:"\f125"}.post-format-icon.post-format-status::before{content:"\f130"}.post-format-icon.post-format-aside::before{content:"\f123"}.post-format-icon.post-format-quote::before{content:"\f122"}.post-format-icon.post-format-link::before{content:"\f103"}.category-adder{margin-right:120px;padding:4px 0}.category-adder h4{margin:0 0 8px}#side-sortables .category-adder{margin:0}.categorydiv div.tabs-panel,.customlinkdiv div.tabs-panel,.posttypediv div.tabs-panel,.taxonomydiv div.tabs-panel,.wp-tab-panel{min-height:42px;max-height:200px;overflow:auto;padding:0 .9em;border:solid 1px #dcdcde;background-color:#fff}div.tabs-panel-active{display:block}div.tabs-panel-inactive{display:none}div.tabs-panel-active:focus{box-shadow:inset 0 0 0 1px #4f94d4,inset 0 0 2px 1px rgba(79,148,212,.8);outline:0 none}#front-page-warning,#front-static-pages ul,.categorydiv ul.categorychecklist ul,.customlinkdiv ul.categorychecklist ul,.inline-editor ul.cat-checklist ul,.posttypediv ul.categorychecklist ul,.taxonomydiv ul.categorychecklist ul,ul.export-filters{margin-right:18px}ul.categorychecklist li{margin:0;padding:0;line-height:1.69230769;word-wrap:break-word}.categorydiv .tabs-panel,.customlinkdiv .tabs-panel,.posttypediv .tabs-panel,.taxonomydiv .tabs-panel{border-width:3px;border-style:solid}.form-wrap label{display:block;padding:2px 0}.form-field input[type=email],.form-field input[type=number],.form-field input[type=password],.form-field input[type=search],.form-field input[type=tel],.form-field input[type=text],.form-field input[type=url],.form-field textarea{border-style:solid;border-width:1px;width:95%}.form-field p,.form-field select{max-width:95%}.form-wrap p,p.description{margin:2px 0 5px;color:#646970}.form-wrap p,p.description,p.help,span.description{font-size:13px}p.description code{font-style:normal}.form-wrap .form-field{margin:1em 0;padding:0}.col-wrap h2{margin:12px 0;font-size:1.1em}.col-wrap p.submit{margin-top:-10px}.edit-term-notes{margin-top:2em}#poststuff .tagsdiv .ajaxtag{margin-top:1em}#poststuff .tagsdiv .howto{margin:1em 0 6px}.ajaxtag .newtag{position:relative}.tagsdiv .newtag{width:180px}.tagsdiv .the-tags{display:block;height:60px;margin:0 auto;overflow:auto;width:260px}#post-body-content .tagsdiv .the-tags{margin:0 5px}p.popular-tags{border:none;line-height:2em;padding:8px 12px 12px;text-align:justify}p.popular-tags a{padding:0 3px}.tagcloud{width:97%;margin:0 0 40px;text-align:justify}.tagcloud h2{margin:2px 0 12px}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border:1px solid #dcdcde;line-height:1.2;word-spacing:3px}.the-tagcloud ul{margin:0}.the-tagcloud ul li{display:inline-block}.ac_results{display:none;margin:-1px 0 0;padding:0;list-style:none;position:absolute;z-index:10000;border:1px solid #4f94d4;background-color:#fff}.wp-customizer .ac_results{z-index:500000}.ac_results li{margin:0;padding:5px 10px;white-space:nowrap;text-align:right}.ac_over .ac_match,.ac_results .ac_over{background-color:#2271b1;color:#fff;cursor:pointer}.ac_match{text-decoration:underline}#addtag .spinner{float:none;vertical-align:top}#edittag{max-width:800px}.edit-tag-actions{margin-top:20px}.comment-php .wp-editor-area{height:200px}.comment-ays td,.comment-ays th{padding:10px 15px}.comment-ays .comment-content ul{list-style:initial;margin-right:2em}.comment-ays .comment-content a[href]:after{content:"(" attr(href) ")";display:inline-block;padding:0 4px;color:#646970;font-size:13px;word-break:break-all}.comment-ays .comment-content p.edit-comment{margin-top:10px}.comment-ays .comment-content p.edit-comment a[href]:after{content:"";padding:0}.comment-ays-submit .button-cancel{margin-right:1em}.spam-undo-inside,.trash-undo-inside{margin:1px 0 1px 8px;line-height:1.23076923}.spam-undo-inside .avatar,.trash-undo-inside .avatar{height:20px;width:20px;margin-left:8px;vertical-align:middle}.stuffbox .editcomment{clear:none;margin-top:0}#namediv.stuffbox .editcomment input{width:100%}#namediv.stuffbox .editcomment.form-table td{padding:10px}#comment-status-radio p{margin:3px 0 5px}#comment-status-radio input{margin:2px 0 5px 3px;vertical-align:middle}#comment-status-radio label{padding:5px 0}table.links-table{width:100%;border-spacing:0}.links-table th{font-weight:400;text-align:right;vertical-align:top;min-width:80px;width:20%;word-wrap:break-word}.links-table td,.links-table th{padding:5px 0}.links-table td label{margin-left:8px}.links-table td input[type=text],.links-table td textarea{width:100%}.links-table #link_rel{max-width:280px}#qt_content_dfw{display:none}.wp-editor-expand #qt_content_dfw{display:inline-block}.focus-on #screen-meta,.focus-on #screen-meta-links,.focus-on #wp-toolbar,.focus-on #wpfooter,.focus-on .page-title-action,.focus-on .postbox-container>*,.focus-on .update-nag,.focus-on .wrap>h1,.focus-on div.error,.focus-on div.notice,.focus-on div.updated{opacity:0;transition-duration:.6s;transition-property:opacity;transition-timing-function:ease-in-out}.focus-on #wp-toolbar{opacity:.3}.focus-off #screen-meta,.focus-off #screen-meta-links,.focus-off #wp-toolbar,.focus-off #wpfooter,.focus-off .page-title-action,.focus-off .postbox-container>*,.focus-off .update-nag,.focus-off .wrap>h1,.focus-off div.error,.focus-off div.notice,.focus-off div.updated{opacity:1;transition-duration:.2s;transition-property:opacity;transition-timing-function:ease-in-out}.focus-off #wp-toolbar{-webkit-transform:translate(0,0)}.focus-on #adminmenuback,.focus-on #adminmenuwrap{transition-duration:.6s;transition-property:transform;transition-timing-function:ease-in-out}.focus-on #adminmenuback,.focus-on #adminmenuwrap{transform:translateX(100%)}.focus-off #adminmenuback,.focus-off #adminmenuwrap{transform:translateX(0);transition-duration:.2s;transition-property:transform;transition-timing-function:ease-in-out}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){#content-resize-handle,#post-body .wp_themeSkin .mceStatusbar a.mceResize{background:transparent url(../images/resize-2x.gif) no-repeat scroll left bottom;background-size:11px 11px}.rtl #content-resize-handle,.rtl #post-body .wp_themeSkin .mceStatusbar a.mceResize{background-image:url(../images/resize-rtl-2x.gif);background-position:left bottom}}@media only screen and (max-width:1200px){.post-type-attachment #poststuff{min-width:0}.post-type-attachment #wpbody-content #poststuff #post-body{margin:0}.post-type-attachment #wpbody-content #post-body.columns-2 #postbox-container-1{margin-left:0;width:100%}.post-type-attachment #poststuff #postbox-container-1 #side-sortables:empty,.post-type-attachment #poststuff #postbox-container-1 .empty-container{outline:0;height:0;min-height:0}.post-type-attachment #poststuff #post-body.columns-2 #side-sortables{min-height:0;width:auto}.is-dragging-metaboxes.post-type-attachment #post-body .meta-box-sortables{outline:0;min-height:0;margin-bottom:0}.post-type-attachment .columns-prefs,.post-type-attachment .screen-layout{display:none}}@media only screen and (max-width:850px){#poststuff{min-width:0}#wpbody-content #poststuff #post-body{margin:0}#wpbody-content #post-body.columns-2 #postbox-container-1{margin-left:0;width:100%}#poststuff #postbox-container-1 #side-sortables:empty,#poststuff #postbox-container-1 .empty-container{height:0;min-height:0}#poststuff #post-body.columns-2 #side-sortables{min-height:0;width:auto}.is-dragging-metaboxes #poststuff #post-body.columns-2 #side-sortables,.is-dragging-metaboxes #poststuff #post-body.columns-2 .meta-box-sortables,.is-dragging-metaboxes #poststuff #postbox-container-1 #side-sortables:empty,.is-dragging-metaboxes #poststuff #postbox-container-1 .empty-container{height:auto;min-height:60px}.columns-prefs,.screen-layout{display:none}}@media screen and (max-width:782px){.wp-core-ui .edit-tag-actions .button-primary{margin-bottom:0}#post-body-content{min-width:0}#titlediv #title-prompt-text{padding:10px}#poststuff .stuffbox .inside{padding:0 0 4px 2px}#poststuff .stuffbox>h3,#poststuff h2,#poststuff h3.hndle{padding:12px}#namediv.stuffbox .editcomment.form-table td{padding:5px 10px}.post-format-options{padding-left:0}.post-format-options a{margin-left:5px;margin-bottom:5px;min-width:52px}.post-format-options .post-format-title{font-size:11px}.post-format-options a div{height:28px;width:28px}.post-format-options a div:before{font-size:26px!important}#post-visibility-select{line-height:280%}.wp-core-ui .save-post-visibility,.wp-core-ui .save-timestamp{vertical-align:middle;margin-left:15px}.timestamp-wrap select#mm{display:block;width:100%;margin-bottom:10px}.timestamp-wrap #aa,.timestamp-wrap #hh,.timestamp-wrap #jj,.timestamp-wrap #mn{padding:12px 3px;font-size:14px;margin-bottom:5px;width:auto;text-align:center}ul.category-tabs{margin:30px 0 15px}ul.category-tabs li.tabs{padding:15px}ul.categorychecklist li{margin-bottom:15px}ul.categorychecklist ul{margin-top:15px}.category-add input[type=text],.category-add select{max-width:none;margin-bottom:15px}.tagsdiv .newtag{width:100%;height:auto;margin-bottom:15px}.tagchecklist{margin:25px 10px}.tagchecklist>li{font-size:16px;line-height:1.4}#commentstatusdiv p{line-height:2.8}.mceToolbar *{white-space:normal!important}.mceToolbar td,.mceToolbar tr{float:right!important}.wp_themeSkin a.mceButton{width:30px;height:30px}.wp_themeSkin .mceButton .mceIcon{margin-top:5px;margin-right:5px}.wp_themeSkin .mceSplitButton{margin-top:1px}.wp_themeSkin .mceSplitButton td a.mceAction{padding:6px 6px 6px 3px}.wp_themeSkin .mceSplitButton td a.mceOpen,.wp_themeSkin .mceSplitButtonEnabled:hover td a.mceOpen{padding-top:6px;padding-bottom:6px;background-position:1px 6px}.wp_themeSkin table.mceListBox{margin:5px}div.quicktags-toolbar input{padding:10px 20px}button.wp-switch-editor{font-size:16px;line-height:1;margin:7px 7px 0 0;padding:8px 12px}#wp-content-media-buttons a{font-size:14px;padding:6px 10px}.wp-media-buttons span.jetpack-contact-form-icon,.wp-media-buttons span.wp-media-buttons-icon{width:22px!important;margin-right:-2px!important}.wp-media-buttons #insert-jetpack-contact-form span.jetpack-contact-form-icon:before,.wp-media-buttons .add_media span.wp-media-buttons-icon:before{font-size:20px!important}#content_wp_fullscreen{display:none}.misc-pub-section{padding:20px 10px}#delete-action,#publishing-action{line-height:3.61538461}#publishing-action .spinner{float:none;margin-top:-2px}.comment-ays td,.comment-ays th{padding-bottom:0}.comment-ays td{padding-top:6px}.links-table #link_rel{max-width:none}.links-table td,.links-table th{padding:10px 0}.edit-term-notes{display:none}.privacy-text-box{width:auto}.privacy-text-box-toc{float:none;width:auto;height:100%;display:flex;flex-direction:column}.privacy-text-section .return-to-top{margin:2em 0 0}}body { - overflow: hidden; - -webkit-text-size-adjust: 100%; -} - -.customize-controls-close, -.widget-control-actions a { - text-decoration: none; -} - -#customize-controls h3 { - font-size: 14px; -} - -#customize-controls img { - max-width: 100%; -} - -#customize-controls .submit { - text-align: center; -} - -#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked { - background-color: rgba(0, 0, 0, 0.7); - padding: 25px; -} - -#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message { - margin-left: auto; - margin-right: auto; - max-width: 366px; - min-height: 64px; - width: auto; - padding: 25px 25px 25px 109px; - position: relative; - background: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - line-height: 1.5; - overflow-y: auto; - text-align: left; - top: calc( 50% - 100px ); -} - -#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing { - margin-top: 0; -} -#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .action-buttons { - margin-bottom: 0; -} - -.customize-changeset-locked-avatar { - width: 64px; - position: absolute; - left: 25px; - top: 25px; -} - -.wp-core-ui.wp-customizer .customize-changeset-locked-message a.button { - margin-right: 10px; - margin-top: 0; -} - -#customize-controls .description { - color: #50575e; -} - -#customize-save-button-wrapper { - float: right; - margin-top: 9px; -} - -body:not(.ready) #customize-save-button-wrapper .save { - visibility: hidden; -} -#customize-save-button-wrapper .save { - float: left; - border-radius: 3px; - box-shadow: none; /* @todo Adjust box shadow based on the disable states of paired button. */ - margin-top: 0; -} - -#customize-save-button-wrapper .save:focus, #publish-settings:focus { - box-shadow: 0 1px 0 #2271b1, 0 0 2px 1px #72aee6; /* This is default box shadow for focus */ -} - -#customize-save-button-wrapper .save.has-next-sibling { - border-radius: 3px 0 0 3px; -} - -#customize-sidebar-outer-content { - position: absolute; - top: 0; - bottom: 0; - left: 0; - visibility: hidden; - overflow-x: hidden; - overflow-y: auto; - width: 100%; - margin: 0; - z-index: -1; - background: #f0f0f1; - transition: left .18s; - border-right: 1px solid #dcdcde; - border-left: 1px solid #dcdcde; - height: 100%; -} +require_once ABSPATH . 'wp-admin/admin-footer.php'; get_pagenum(); $title = __( 'Sites' ); $parent_file = 'sites.php'; add_screen_option( 'per_page' ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.' ) . '

' . '

' . __( 'This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.' ) . '

' . '

' . __( 'Hovering over each site reveals seven options (three for the primary site):' ) . '

' . '
  • ' . __( 'An Edit link to a separate Edit Site screen.' ) . '
  • ' . '
  • ' . __( 'Dashboard leads to the Dashboard for that site.' ) . '
  • ' . '
  • ' . __( 'Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '
  • ' . '
  • ' . __( 'Delete which is a permanent action after the confirmation screens.' ) . '
  • ' . '
  • ' . __( 'Visit to go to the front-end site live.' ) . '
' . '

' . __( 'The site ID is used internally, and is not shown on the front end of the site or to users/viewers.' ) . '

' . '

' . __( 'Clicking on bold headings can re-sort this table.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Site Management' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); get_current_screen()->set_screen_reader_content( array( 'heading_pagination' => __( 'Sites list navigation' ), 'heading_list' => __( 'Sites list' ), ) ); $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( isset( $_GET['action'] ) ) { do_action( 'wpmuadminedit' ); $manage_actions = array( 'activateblog' => __( 'You are about to activate the site %s.' ), 'deactivateblog' => __( 'You are about to deactivate the site %s.' ), 'unarchiveblog' => __( 'You are about to unarchive the site %s.' ), 'archiveblog' => __( 'You are about to archive the site %s.' ), 'unspamblog' => __( 'You are about to unspam the site %s.' ), 'spamblog' => __( 'You are about to mark the site %s as spam.' ), 'deleteblog' => __( 'You are about to delete the site %s.' ), 'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), 'matureblog' => __( 'You are about to mark the site %s as not mature.' ), ); if ( 'confirm' === $_GET['action'] ) { $site_action = $_GET['action2']; if ( ! array_key_exists( $site_action, $manage_actions ) ) { wp_die( __( 'The requested action is not valid.' ) ); } if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { check_admin_referer( 'confirm' ); } else { check_admin_referer( $site_action . '_' . $id ); } if ( ! headers_sent() ) { nocache_headers(); header( 'Content-Type: text/html; charset=utf-8' ); } if ( get_network()->site_id == $id ) { wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); } $site_details = get_site( $id ); $site_address = untrailingslashit( $site_details->domain . $site_details->path ); require_once ABSPATH . 'wp-admin/admin-header.php'; ?> +
+

+
+ + + + +

+ +
+
+ 403 ) ); } $updated_action = 'not_deleted'; if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) { wpmu_delete_blog( $id, true ); $updated_action = 'delete'; } break; case 'delete_sites': check_admin_referer( 'ms-delete-sites' ); foreach ( (array) $_POST['site_ids'] as $site_id ) { $site_id = (int) $site_id; if ( get_network()->site_id == $site_id ) { continue; } if ( ! current_user_can( 'delete_site', $site_id ) ) { $site = get_site( $site_id ); $site_address = untrailingslashit( $site->domain . $site->path ); wp_die( sprintf( __( 'Sorry, you are not allowed to delete the site %s.' ), $site_address ), 403 ); } $updated_action = 'all_delete'; wpmu_delete_blog( $site_id, true ); } break; case 'allblogs': if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) { $doaction = $_POST['action']; foreach ( (array) $_POST['allblogs'] as $key => $val ) { if ( '0' != $val && get_network()->site_id != $val ) { switch ( $doaction ) { case 'delete': require_once ABSPATH . 'wp-admin/admin-header.php'; ?> +
+

+
+ + + +

+
    + domain . $site->path ); ?> +
  • + + +
  • + +
+ +
+
+ id, $redirect_to, $doaction, $blogs, $id ); wp_safe_redirect( $redirect_to ); exit; } } else { $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), add_query_arg( $_POST, network_admin_url( 'sites.php' ) ) ); wp_redirect( $location ); exit; } break; case 'archiveblog': case 'unarchiveblog': update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); break; case 'activateblog': update_blog_status( $id, 'deleted', '0' ); do_action( 'activate_blog', $id ); break; case 'deactivateblog': do_action( 'deactivate_blog', $id ); update_blog_status( $id, 'deleted', '1' ); break; case 'unspamblog': case 'spamblog': update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); break; case 'unmatureblog': case 'matureblog': update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); break; } if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { $updated_action = $_GET['action']; } if ( ! empty( $updated_action ) ) { wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); exit; } } $msg = ''; if ( isset( $_GET['updated'] ) ) { $action = $_GET['updated']; switch ( $action ) { case 'all_notspam': $msg = __( 'Sites removed from spam.' ); break; case 'all_spam': $msg = __( 'Sites marked as spam.' ); break; case 'all_delete': $msg = __( 'Sites deleted.' ); break; case 'delete': $msg = __( 'Site deleted.' ); break; case 'not_deleted': $msg = __( 'Sorry, you are not allowed to delete that site.' ); break; case 'archiveblog': $msg = __( 'Site archived.' ); break; case 'unarchiveblog': $msg = __( 'Site unarchived.' ); break; case 'activateblog': $msg = __( 'Site activated.' ); break; case 'deactivateblog': $msg = __( 'Site deactivated.' ); break; case 'unspamblog': $msg = __( 'Site removed from spam.' ); break; case 'spamblog': $msg = __( 'Site marked as spam.' ); break; default: $msg = apply_filters( "network_sites_updated_message_{$action}", __( 'Settings saved.' ) ); break; } if ( ! empty( $msg ) ) { $msg = '

' . $msg . '

'; } } $wp_list_table->prepare_items(); require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -@media (prefers-reduced-motion: reduce) { - #customize-sidebar-outer-content { - transition: none; - } -} +
+

-#customize-theme-controls .control-section-outer { - display: none !important; -} + + + -#customize-outer-theme-controls .accordion-section-content { - padding: 12px; -} +'; printf( __( 'Search results for: %s' ), '' . esc_html( $s ) . '' ); echo ''; } ?> -#customize-outer-theme-controls .accordion-section-content.open { - display: block; -} +
-.outer-section-open .wp-full-overlay.expanded #customize-sidebar-outer-content { - visibility: visible; - left: 100%; - transition: left .18s; -} +views(); ?> -@media (prefers-reduced-motion: reduce) { - .outer-section-open .wp-full-overlay.expanded #customize-sidebar-outer-content { - transition: none; - } -} + -.customize-outer-pane-parent { - margin: 0; -} + -.outer-section-open .wp-full-overlay.expanded .wp-full-overlay-main { - left: 300px; - opacity: 0.4; -} +
+ display(); ?> +
+
+ +add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.' ) . '

' . '

' . __( 'Operational settings has fields for the network’s name and admin email.' ) . '

' . '

' . __( 'Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.' ) . '

' . '

' . __( 'New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.' ) . '

' . '

' . __( 'Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).' ) . '

' . '

' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '

' . '

' . __( 'Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.' ) . '

' . '

' . __( 'Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Network Settings' ) . '

' . '

' . __( 'Support' ) . '

' ); if ( $_POST ) { do_action( 'wpmuadminedit' ); check_admin_referer( 'siteoptions' ); $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0, ); foreach ( $checked_options as $option_name => $option_unchecked_value ) { if ( ! isset( $_POST[ $option_name ] ) ) { $_POST[ $option_name ] = $option_unchecked_value; } } $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled', 'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'new_admin_email', 'first_comment_email', ); if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) { $language = wp_download_language_pack( $_POST['WPLANG'] ); if ( $language ) { $_POST['WPLANG'] = $language; } } foreach ( $options as $option_name ) { if ( ! isset( $_POST[ $option_name ] ) ) { continue; } $value = wp_unslash( $_POST[ $option_name ] ); update_site_option( $option_name, $value ); } do_action( 'update_wpmu_options' ); wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) ); exit; } require_once ABSPATH . 'wp-admin/admin-header.php'; if ( isset( $_GET['updated'] ) ) { ?>

+ -.outer-section-open .wp-full-overlay.expanded.preview-tablet .wp-full-overlay-main, -.outer-section-open .wp-full-overlay.expanded.preview-mobile .wp-full-overlay-main, -.adding-menu-items .wp-full-overlay.expanded.preview-tablet .wp-full-overlay-main, -.adding-menu-items .wp-full-overlay.expanded.preview-mobile .wp-full-overlay-main, -.adding-widget .wp-full-overlay.expanded.preview-tablet .wp-full-overlay-main, -.adding-widget .wp-full-overlay.expanded.preview-mobile .wp-full-overlay-main { - left: 64%; -} +
+

+
+ +

+ + + + + -#customize-outer-theme-controls li.notice { - padding-top: 8px; - padding-bottom: 8px; - margin-left: 0; - margin-bottom: 10px; -} + + + + + +

+ + + + + + -#publish-settings { - text-indent: 0; - border-radius: 0 3px 3px 0; - padding-left: 0; - padding-right: 0; - box-shadow: none; /* @todo Adjust box shadow based on the disable states of paired button. */ - font-size: 14px; - width: 30px; - float: left; - transform: none; - margin-top: 0; - line-height: 2; -} + + + + + -body:not(.ready) #publish-settings, -body.trashing #customize-save-button-wrapper .save, -body.trashing #publish-settings { - display: none; -} + + + + -#customize-header-actions .spinner { - margin-top: 13px; - margin-right: 4px; -} + + + + -.saving #customize-header-actions .spinner, -.trashing #customize-header-actions .spinner { - visibility: visible; -} + + + + -#customize-header-actions { - border-bottom: 1px solid #dcdcde; -} + + + + -#customize-controls .wp-full-overlay-sidebar-content { - overflow-y: auto; - overflow-x: hidden; -} + +

+ -.outer-section-open #customize-controls .wp-full-overlay-sidebar-content { - background: #f0f0f1; -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + -#customize-controls .customize-info { - border: none; - border-bottom: 1px solid #dcdcde; - margin-bottom: 15px; -} + + + + -#customize-control-changeset_status .customize-inside-control-row, -#customize-control-changeset_preview_link input { - background-color: #fff; - border-bottom: 1px solid #dcdcde; - box-sizing: content-box; - width: 100%; - margin-left: -12px; - padding-left: 12px; - padding-right: 12px; -} + + + + + -#customize-control-trash_changeset { - margin-top: 20px; -} -#customize-control-trash_changeset .button-link { - position: relative; - padding-left: 24px; - display: inline-block; -} -#customize-control-trash_changeset .button-link:before { - content: "\f182"; - font: normal 22px dashicons; - text-decoration: none; - position: absolute; - left: 0; - top: -2px; -} + +

+ + + + + + + -#customize-controls .date-input:invalid { - border-color: #d63638; -} + __( 'Plugins' ) ) ); if ( $menu_items ) : ?> +

+ + + + + + + -#customize-control-changeset_status .customize-inside-control-row { - padding-top: 10px; - padding-bottom: 10px; - font-weight: 500; -} + + +
+
-#customize-control-changeset_status .customize-inside-control-row:first-of-type { - border-top: 1px solid #dcdcde; -} + +' . __( 'Welcome to your Network Admin. This area of the Administration Screens is used for managing all aspects of your Multisite Network.' ) . '

'; $overview .= '

' . __( 'From here you can:' ) . '

'; $overview .= '
  • ' . __( 'Add and manage sites or users' ) . '
  • '; $overview .= '
  • ' . __( 'Install and activate themes or plugins' ) . '
  • '; $overview .= '
  • ' . __( 'Update your network' ) . '
  • '; $overview .= '
  • ' . __( 'Modify global network settings' ) . '
'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $overview, ) ); $quick_tasks = '

' . __( 'The Right Now widget on this screen provides current user and site counts on your network.' ) . '

'; $quick_tasks .= '
  • ' . __( 'To add a new user, click Create a New User.' ) . '
  • '; $quick_tasks .= '
  • ' . __( 'To add a new site, click Create a New Site.' ) . '
'; $quick_tasks .= '

' . __( 'To search for a user or site, use the search boxes.' ) . '

'; $quick_tasks .= '
  • ' . __( 'To search for a user, enter an email address or username. Use a wildcard to search for a partial username, such as user*.' ) . '
  • '; $quick_tasks .= '
  • ' . __( 'To search for a site, enter the path or domain.' ) . '
'; get_current_screen()->add_help_tab( array( 'id' => 'quick-tasks', 'title' => __( 'Quick Tasks' ), 'content' => $quick_tasks, ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on the Network Admin' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); wp_dashboard_setup(); wp_enqueue_script( 'dashboard' ); wp_enqueue_script( 'plugin-install' ); add_thickbox(); require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-control-changeset_status .customize-control-title { - margin-bottom: 6px; -} +
+

-#customize-control-changeset_status input { - margin-left: 0; -} +
-#customize-control-changeset_preview_link { - position: relative; - display: block; -} + -.preview-link-wrapper .customize-copy-preview-link.preview-control-element.button { - margin: 0; - position: absolute; - bottom: 9px; - right: 0; -} +
+
-.preview-link-wrapper { - position: relative; -} +
-.customize-copy-preview-link:before, -.customize-copy-preview-link:after { - content: ""; - height: 28px; - position: absolute; - background: #fff; - top: -1px; -} +get_pagenum(); $action = $wp_list_table->current_action(); $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; $temp_args = array( 'enabled', 'disabled', 'deleted', 'error', 'enabled-auto-update', 'disabled-auto-update', ); $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( $temp_args, wp_get_referer() ); if ( $action ) { switch ( $action ) { case 'enable': check_admin_referer( 'enable-theme_' . $_GET['theme'] ); WP_Theme::network_enable_theme( $_GET['theme'] ); if ( false === strpos( $referer, '/network/themes.php' ) ) { wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); } else { wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); } exit; case 'disable': check_admin_referer( 'disable-theme_' . $_GET['theme'] ); WP_Theme::network_disable_theme( $_GET['theme'] ); wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); exit; case 'enable-selected': check_admin_referer( 'bulk-themes' ); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty( $themes ) ) { wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } WP_Theme::network_enable_theme( (array) $themes ); wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); exit; case 'disable-selected': check_admin_referer( 'bulk-themes' ); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty( $themes ) ) { wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } WP_Theme::network_disable_theme( (array) $themes ); wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); exit; case 'update-selected': check_admin_referer( 'bulk-themes' ); if ( isset( $_GET['themes'] ) ) { $themes = explode( ',', $_GET['themes'] ); } elseif ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; } else { $themes = array(); } $title = __( 'Update Themes' ); $parent_file = 'themes.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
'; echo '

' . esc_html( $title ) . '

'; $url = self_admin_url( 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) ) ); $url = wp_nonce_url( $url, 'bulk-update-themes' ); echo ""; echo '
'; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; case 'delete-selected': if ( ! current_user_can( 'delete_themes' ) ) { wp_die( __( 'Sorry, you are not allowed to delete themes for this site.' ) ); } check_admin_referer( 'bulk-themes' ); $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); if ( empty( $themes ) ) { wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } $themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) ); if ( empty( $themes ) ) { wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) ); exit; } $theme_info = array(); foreach ( $themes as $key => $theme ) { $theme_info[ $theme ] = wp_get_theme( $theme ); } require ABSPATH . 'wp-admin/update.php'; $parent_file = 'themes.php'; if ( ! isset( $_REQUEST['verify-delete'] ) ) { wp_enqueue_script( 'jquery' ); require_once ABSPATH . 'wp-admin/admin-header.php'; $themes_to_delete = count( $themes ); ?> +
+ +

+

+

+ +

+

+

+ +
    + ' . sprintf( _x( '%1$s by %2$s', 'theme' ), '' . $theme->display( 'Name' ) . '', '' . $theme->display( 'Author' ) . '' ) . ''; } ?> +
+ +

+ +

+ +
+ + + '; } wp_nonce_field( 'bulk-themes' ); if ( 1 === $themes_to_delete ) { submit_button( __( 'Yes, delete this theme' ), '', 'submit', false ); } else { submit_button( __( 'Yes, delete these themes' ), '', 'submit', false ); } ?> +
+ +
+ +
+
+ 1, 'action' => 'delete-selected', 'checked' => $_REQUEST['checked'], '_wpnonce' => $_REQUEST['_wpnonce'], ), network_admin_url( 'themes.php' ) ) ) ); } $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1; wp_redirect( add_query_arg( array( 'deleted' => count( $themes ), 'paged' => $paged, 's' => $s, ), network_admin_url( 'themes.php' ) ) ); exit; case 'enable-auto-update': case 'disable-auto-update': case 'enable-auto-update-selected': case 'disable-auto-update-selected': if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) { wp_die( __( 'Sorry, you are not allowed to change themes automatic update settings.' ) ); } if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) { check_admin_referer( 'updates' ); } else { if ( empty( $_POST['checked'] ) ) { wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } check_admin_referer( 'bulk-themes' ); } $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); if ( 'enable-auto-update' === $action ) { $auto_updates[] = $_GET['theme']; $auto_updates = array_unique( $auto_updates ); $referer = add_query_arg( 'enabled-auto-update', 1, $referer ); } elseif ( 'disable-auto-update' === $action ) { $auto_updates = array_diff( $auto_updates, array( $_GET['theme'] ) ); $referer = add_query_arg( 'disabled-auto-update', 1, $referer ); } else { $themes = (array) wp_unslash( $_POST['checked'] ); if ( 'enable-auto-update-selected' === $action ) { $auto_updates = array_merge( $auto_updates, $themes ); $auto_updates = array_unique( $auto_updates ); $referer = add_query_arg( 'enabled-auto-update', count( $themes ), $referer ); } else { $auto_updates = array_diff( $auto_updates, $themes ); $referer = add_query_arg( 'disabled-auto-update', count( $themes ), $referer ); } } $all_items = wp_get_themes(); $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); update_site_option( 'auto_update_themes', $auto_updates ); wp_safe_redirect( $referer ); exit; default: $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty( $themes ) ) { wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); exit; } check_admin_referer( 'bulk-themes' ); $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes ); wp_safe_redirect( $referer ); exit; } } $wp_list_table->prepare_items(); add_thickbox(); add_screen_option( 'per_page' ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.' ) . '

' . '

' . __( 'If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.' ) . '

' . '

' . __( 'Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.' ) . '

', ) ); $help_sidebar_autoupdates = ''; if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) { get_current_screen()->add_help_tab( array( 'id' => 'plugins-themes-auto-updates', 'title' => __( 'Auto-updates' ), 'content' => '

' . __( 'Auto-updates can be enabled or disabled for each individual theme. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '

' . '

' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '

', ) ); $help_sidebar_autoupdates = '

' . __( 'Learn more: Auto-updates documentation' ) . '

'; } get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Network Themes' ) . '

' . $help_sidebar_autoupdates . '

' . __( 'Support' ) . '

' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter themes list' ), 'heading_pagination' => __( 'Themes list navigation' ), 'heading_list' => __( 'Themes list' ), ) ); $title = __( 'Themes' ); $parent_file = 'themes.php'; wp_enqueue_script( 'updates' ); wp_enqueue_script( 'theme-preview' ); require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -.customize-copy-preview-link:before { - left: -10px; - width: 9px; - opacity: 0.75; -} +
+

-.customize-copy-preview-link:after { - left: -5px; - width: 4px; - opacity: 0.8; -} + + + -#customize-control-changeset_preview_link input { - line-height: 2.85714286; /* 40px */ - border-top: 1px solid #dcdcde; - border-left: none; - border-right: none; - text-indent: -999px; - color: #fff; - /* Only necessary for IE11 */ - min-height: 40px; -} +'; printf( __( 'Search results for: %s' ), '' . esc_html( $s ) . '' ); echo ''; } ?> -#customize-control-changeset_preview_link label { - position: relative; - display: block; -} +
-#customize-control-changeset_preview_link a { - display: inline-block; - position: absolute; - white-space: nowrap; - overflow: hidden; - width: 90%; - bottom: 14px; - font-size: 14px; - text-decoration: none; -} +

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled'] ) ) { $disabled = absint( $_GET['disabled'] ); if ( 1 === $disabled ) { $message = __( 'Theme disabled.' ); } else { $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); } echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['deleted'] ) ) { $deleted = absint( $_GET['deleted'] ); if ( 1 === $deleted ) { $message = __( 'Theme deleted.' ); } else { $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); } echo '

' . sprintf( $message, number_format_i18n( $deleted ) ) . '

'; } elseif ( isset( $_GET['enabled-auto-update'] ) ) { $enabled = absint( $_GET['enabled-auto-update'] ); if ( 1 === $enabled ) { $message = __( 'Theme will be auto-updated.' ); } else { $message = _n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled ); } echo '

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled-auto-update'] ) ) { $disabled = absint( $_GET['disabled-auto-update'] ); if ( 1 === $disabled ) { $message = __( 'Theme will no longer be auto-updated.' ); } else { $message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled ); } echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { echo '

' . __( 'No theme selected.' ) . '

'; } elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) { echo '

' . __( 'You cannot delete a theme while it is active on the main site.' ) . '

'; } ?> -#customize-control-changeset_preview_link a.disabled, -#customize-control-changeset_preview_link a.disabled:active, -#customize-control-changeset_preview_link a.disabled:focus, -#customize-control-changeset_preview_link a.disabled:visited { - color: #000; - opacity: 0.4; - cursor: default; - outline: none; - box-shadow: none; -} +
+search_box( __( 'Search Installed Themes' ), 'theme' ); ?> +
-#sub-accordion-section-publish_settings .customize-section-description-container { - display: none; -} +views(); if ( 'broken' === $status ) { echo '

' . __( 'The following themes are installed but incomplete.' ) . '

'; } ?> -#customize-controls .customize-info.section-meta { - margin-bottom: 15px; -} +
+ + -.customize-control-date_time .customize-control-description + .date-time-fields.includes-time { - margin-top: 10px; -} +display(); ?> +
-.customize-control.customize-control-date_time .date-time-fields .date-input.day { - margin-right: 0; -} +
-.date-time-fields .date-input.month { - width: auto; - margin: 0; -} +add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.' ) . '

' . '

' . __( 'If the admin email for the new site does not exist in the database, a new user will also be created.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Site Management' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); if ( isset( $_REQUEST['action'] ) && 'add-site' === $_REQUEST['action'] ) { check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); if ( ! is_array( $_POST['blog'] ) ) { wp_die( __( 'Cannot create an empty site.' ) ); } $blog = $_POST['blog']; $domain = ''; $blog['domain'] = trim( $blog['domain'] ); if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) { $domain = strtolower( $blog['domain'] ); } if ( ! is_subdomain_install() ) { $subdirectory_reserved_names = get_subdirectory_reserved_names(); if ( in_array( $domain, $subdirectory_reserved_names, true ) ) { wp_die( sprintf( __( 'The following words are reserved for use by WordPress functions and cannot be used as site names: %s' ), '' . implode( ', ', $subdirectory_reserved_names ) . '' ) ); } } $title = $blog['title']; $meta = array( 'public' => 1, ); if ( isset( $_POST['WPLANG'] ) ) { if ( '' === $_POST['WPLANG'] ) { $meta['WPLANG'] = ''; } elseif ( in_array( $_POST['WPLANG'], get_available_languages(), true ) ) { $meta['WPLANG'] = $_POST['WPLANG']; } elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) { $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); if ( $language ) { $meta['WPLANG'] = $language; } } } if ( empty( $domain ) ) { wp_die( __( 'Missing or invalid site address.' ) ); } if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { wp_die( __( 'Missing email address.' ) ); } $email = sanitize_email( $blog['email'] ); if ( ! is_email( $email ) ) { wp_die( __( 'Invalid email address.' ) ); } if ( is_subdomain_install() ) { $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', get_network()->domain ); $path = get_network()->path; } else { $newdomain = get_network()->domain; $path = get_network()->path . $domain . '/'; } $password = 'N/A'; $user_id = email_exists( $email ); if ( ! $user_id ) { do_action( 'pre_network_site_new_created_user', $email ); $user_id = username_exists( $domain ); if ( $user_id ) { wp_die( __( 'The domain or path entered conflicts with an existing username.' ) ); } $password = wp_generate_password( 12, false ); $user_id = wpmu_create_user( $domain, $password, $email ); if ( false === $user_id ) { wp_die( __( 'There was an error creating the user.' ) ); } do_action( 'network_site_new_created_user', $user_id ); } $wpdb->hide_errors(); $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, get_current_network_id() ); $wpdb->show_errors(); if ( ! is_wp_error( $id ) ) { if ( ! is_super_admin( $user_id ) && ! get_user_option( 'primary_blog', $user_id ) ) { update_user_option( $user_id, 'primary_blog', $id, true ); } wpmu_new_site_admin_notification( $id, $user_id ); wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id, ), 'site-new.php' ) ); exit; } else { wp_die( $id->get_error_message() ); } } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'added' === $_GET['update'] ) { $messages[] = sprintf( __( 'Site added. Visit Dashboard or Edit Site' ), esc_url( get_admin_url( absint( $_GET['id'] ) ) ), network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) ); } } $title = __( 'Add New Site' ); $parent_file = 'sites.php'; wp_enqueue_script( 'user-suggest' ); require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -.date-time-fields .date-input.day, -.date-time-fields .date-input.hour, -.date-time-fields .date-input.minute { - width: 46px; -} - -.date-time-fields .date-input.year { - width: 65px; -} - -.date-time-fields .date-input.meridian { - width: auto; - margin: 0; -} - -.date-time-fields .time-row { - margin-top: 12px; -} - -#customize-control-changeset_preview_link { - margin-top: 6px; -} - -#customize-control-changeset_status { - margin-bottom: 0; - padding-bottom: 0; -} +
+

+

' . $msg . '

'; } } ?> +

+*' ); ?> +

+
+ + + + + + + + + + + + + + + + + + + + + + + + -#customize-control-changeset_scheduled_date { - box-sizing: content-box; - width: 100%; - margin-left: -12px; - padding: 12px; - background: #fff; - border-bottom: 1px solid #dcdcde; - margin-bottom: 0; -} + +
+
+add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.' ) . '

' . '

' . __( 'If a version update to core has not happened, clicking this button will not affect anything.' ) . '

' . '

' . __( 'If this process fails for any reason, users logging in to their sites will force the same update.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Upgrade Network' ) . '

' . '

' . __( 'Support' ) . '

' ); require_once ABSPATH . 'wp-admin/admin-header.php'; if ( ! current_user_can( 'upgrade_network' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } echo '
'; echo '

' . __( 'Upgrade Network' ) . '

'; $action = isset( $_GET['action'] ) ? $_GET['action'] : 'show'; switch ( $action ) { case 'upgrade': $n = ( isset( $_GET['n'] ) ) ? (int) $_GET['n'] : 0; if ( $n < 5 ) { global $wp_db_version; update_site_option( 'wpmu_upgrade_site', $wp_db_version ); } $site_ids = get_sites( array( 'spam' => 0, 'deleted' => 0, 'archived' => 0, 'network_id' => get_current_network_id(), 'number' => 5, 'offset' => $n, 'fields' => 'ids', 'order' => 'DESC', 'orderby' => 'id', 'update_site_meta_cache' => false, ) ); if ( empty( $site_ids ) ) { echo '

' . __( 'All done!' ) . '

'; break; } echo '
    '; foreach ( (array) $site_ids as $site_id ) { switch_to_blog( $site_id ); $siteurl = site_url(); $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); restore_current_blog(); echo "
  • $siteurl
  • "; $response = wp_remote_get( $upgrade_url, array( 'timeout' => 120, 'httpversion' => '1.1', 'sslverify' => false, ) ); if ( is_wp_error( $response ) ) { wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), $siteurl, '' . $response->get_error_message() . '' ) ); } do_action( 'after_mu_upgrade', $response ); do_action( 'wpmu_upgrade_site', $site_id ); } echo '
'; ?>

+ + +

+

+ -#customize-control-changeset_scheduled_date .customize-control-description { - font-style: normal; -} +

+

+ +
-#customize-controls .customize-info.is-in-view, -#customize-controls .customize-section-title.is-in-view { - position: absolute; - z-index: 9; - width: 100%; - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); -} + + 1 ) { $_POST['allusers'] = array( $id ); $title = __( 'Users' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
'; confirm_delete_users( $_POST['allusers'] ); echo '
'; require_once ABSPATH . 'wp-admin/admin-footer.php'; } else { wp_redirect( network_admin_url( 'users.php' ) ); } exit; case 'allusers': if ( ! current_user_can( 'manage_network_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( isset( $_POST['action'] ) && isset( $_POST['allusers'] ) ) { check_admin_referer( 'bulk-users-network' ); $doaction = $_POST['action']; $userfunction = ''; foreach ( (array) $_POST['allusers'] as $user_id ) { if ( ! empty( $user_id ) ) { switch ( $doaction ) { case 'delete': if ( ! current_user_can( 'delete_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $title = __( 'Users' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
'; confirm_delete_users( $_POST['allusers'] ); echo '
'; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; case 'spam': $user = get_userdata( $user_id ); if ( is_super_admin( $user->ID ) ) { wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); } $userfunction = 'all_spam'; $blogs = get_blogs_of_user( $user_id, true ); foreach ( (array) $blogs as $details ) { if ( get_network()->site_id != $details->userblog_id ) { update_blog_status( $details->userblog_id, 'spam', '1' ); } } $user_data = $user->to_array(); $user_data['spam'] = '1'; wp_update_user( $user_data ); break; case 'notspam': $user = get_userdata( $user_id ); $userfunction = 'all_notspam'; $blogs = get_blogs_of_user( $user_id, true ); foreach ( (array) $blogs as $details ) { update_blog_status( $details->userblog_id, 'spam', '0' ); } $user_data = $user->to_array(); $user_data['spam'] = '0'; wp_update_user( $user_data ); break; } } } if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) { $sendback = wp_get_referer(); $user_ids = (array) $_POST['allusers']; $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids ); wp_safe_redirect( $sendback ); exit; } wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction, ), wp_get_referer() ) ); } else { $location = network_admin_url( 'users.php' ); if ( ! empty( $_REQUEST['paged'] ) ) { $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); } wp_redirect( $location ); } exit; case 'dodelete': check_admin_referer( 'ms-users-delete' ); if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { foreach ( $_POST['blog'] as $id => $users ) { foreach ( $users as $blogid => $user_id ) { if ( ! current_user_can( 'delete_user', $id ) ) { continue; } if ( ! empty( $_POST['delete'] ) && 'reassign' === $_POST['delete'][ $blogid ][ $id ] ) { remove_user_from_blog( $id, $blogid, (int) $user_id ); } else { remove_user_from_blog( $id, $blogid ); } } } } $i = 0; if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) { foreach ( $_POST['user'] as $id ) { if ( ! current_user_can( 'delete_user', $id ) ) { continue; } wpmu_delete_user( $id ); $i++; } } if ( 1 === $i ) { $deletefunction = 'delete'; } else { $deletefunction = 'all_delete'; } wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction, ), network_admin_url( 'users.php' ) ) ); exit; } } $wp_list_table = _get_list_table( 'WP_MS_Users_List_Table' ); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->prepare_items(); $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); if ( $pagenum > $total_pages && $total_pages > 0 ) { wp_redirect( add_query_arg( 'paged', $total_pages ) ); exit; } $title = __( 'Users' ); $parent_file = 'users.php'; add_screen_option( 'per_page' ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'This table shows all users across the network and the sites to which they are assigned.' ) . '

' . '

' . __( 'Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.' ) . '

' . '

' . __( 'You can also go to the user’s profile page by clicking on the individual username.' ) . '

' . '

' . __( 'You can sort the table by clicking on any of the table headings and switch between list and excerpt views by using the icons above the users list.' ) . '

' . '

' . __( 'The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.' ) . '

' . '

' . __( 'You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Network Users' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter users list' ), 'heading_pagination' => __( 'Users list navigation' ), 'heading_list' => __( 'Users list' ), ) ); require_once ABSPATH . 'wp-admin/admin-header.php'; if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) { ?> +

+ +

+ +
+

-#customize-controls .customize-section-title.is-in-view { - margin-top: 0; -} + + + '; printf( __( 'Search results for: %s' ), '' . esc_html( $usersearch ) . '' ); echo ''; } ?> -#customize-controls .customize-info.is-in-view + .accordion-section { - margin-top: 15px; -} +
-#customize-controls .customize-info.is-sticky, -#customize-controls .customize-section-title.is-sticky { - position: fixed; - top: 46px; -} + views(); ?> -#customize-controls .customize-info .accordion-section-title { - background: #fff; - color: #50575e; - border-left: none; - border-right: none; - border-bottom: none; - cursor: default; -} +
+ search_box( __( 'Search Users' ), 'all-user' ); ?> +
-#customize-controls .customize-info.open .accordion-section-title:after, -#customize-controls .customize-info .accordion-section-title:hover:after, -#customize-controls .customize-info .accordion-section-title:focus:after { - color: #2c3338; -} +
+ display(); ?> +
+
-#customize-controls .customize-info .accordion-section-title:after { - display: none; -} + +%s', $update_data['counts']['total'], number_format_i18n( $update_data['counts']['total'] ) ) ), $cap, 'update-core.php', ); } else { $submenu['index.php'][10] = array( __( 'Updates' ), $cap, 'update-core.php' ); } unset( $cap ); $submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' ); $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); $menu[5] = array( __( 'Sites' ), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'dashicons-admin-multisite' ); $submenu['sites.php'][5] = array( __( 'All Sites' ), 'manage_sites', 'sites.php' ); $submenu['sites.php'][10] = array( _x( 'Add New', 'site' ), 'create_sites', 'site-new.php' ); $menu[10] = array( __( 'Users' ), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' ); $submenu['users.php'][5] = array( __( 'All Users' ), 'manage_network_users', 'users.php' ); $submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'create_users', 'user-new.php' ); if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) { $menu[15] = array( sprintf( __( 'Themes %s' ), sprintf( '%s', $update_data['counts']['themes'], number_format_i18n( $update_data['counts']['themes'] ) ) ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance', ); } else { $menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); } $submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' ); $submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' ); $submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) { $menu[20] = array( sprintf( __( 'Plugins %s' ), sprintf( '%s', $update_data['counts']['plugins'], number_format_i18n( $update_data['counts']['plugins'] ) ) ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins', ); } else { $menu[20] = array( __( 'Plugins' ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); } $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' ); $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); $menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) { $submenu['settings.php'][5] = array( __( 'Network Settings' ), 'manage_network_options', 'settings.php' ); $submenu['settings.php'][10] = array( __( 'Network Setup' ), 'setup_network', 'setup.php' ); } unset( $update_data ); $menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' ); require_once ABSPATH . 'wp-admin/includes/menu.php'; add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] && is_array( $_POST['option'] ) ) { check_admin_referer( 'edit-site' ); switch_to_blog( $id ); $skip_options = array( 'allowedthemes' ); foreach ( (array) $_POST['option'] as $key => $val ) { $key = wp_unslash( $key ); $val = wp_unslash( $val ); if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) { continue; } update_option( $key, $val ); } do_action( 'wpmu_update_blog_options', $id ); restore_current_blog(); wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id, ), 'site-settings.php' ) ); exit; } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'updated' === $_GET['update'] ) { $messages[] = __( 'Site options updated.' ); } } $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-controls .customize-info .preview-notice { - font-size: 13px; - line-height: 1.9; -} +
+

+

|

-#customize-controls .customize-pane-child .customize-section-title h3, -#customize-controls .customize-pane-child h3.customize-section-title, -#customize-outer-theme-controls .customize-pane-child .customize-section-title h3, -#customize-outer-theme-controls .customize-pane-child h3.customize-section-title, -#customize-controls .customize-info .panel-title { - font-size: 20px; - font-weight: 200; - line-height: 26px; - display: block; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} + $id, 'selected' => 'site-settings', ) ); if ( ! empty( $messages ) ) { foreach ( $messages as $msg ) { echo '

' . $msg . '

'; } } ?> +
+ + + + get_blog_prefix( $id ); $sql = "SELECT * FROM {$blog_prefix}options + WHERE option_name NOT LIKE %s + AND option_name NOT LIKE %s"; $query = $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', '%' . $wpdb->esc_like( 'user_roles' ) ); $options = $wpdb->get_results( $query ); foreach ( $options as $option ) { if ( 'default_role' === $option->option_name ) { $editblog_default_role = $option->option_value; } $disabled = false; $class = 'all-options'; if ( is_serialized( $option->option_value ) ) { if ( is_serialized_string( $option->option_value ) ) { $option->option_value = esc_html( maybe_unserialize( $option->option_value ) ); } else { $option->option_value = 'SERIALIZED DATA'; $disabled = true; $class = 'all-options disabled'; } } if ( strpos( $option->option_value, "\n" ) !== false ) { ?> + + + + + + + + option_name, array( 'siteurl', 'home' ), true ) ) { ?> + + + + + + + + +
-#customize-controls .customize-section-title span.customize-action { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} +
+add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'Add User will set up a new user account on the network and send that person an email with username and password.' ) . '

' . '

' . __( 'Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Network Users' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); if ( isset( $_REQUEST['action'] ) && 'add-user' === $_REQUEST['action'] ) { check_admin_referer( 'add-user', '_wpnonce_add-user' ); if ( ! current_user_can( 'manage_network_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( ! is_array( $_POST['user'] ) ) { wp_die( __( 'Cannot create an empty user.' ) ); } $user = wp_unslash( $_POST['user'] ); $user_details = wpmu_validate_user_signup( $user['username'], $user['email'] ); if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) { $add_user_errors = $user_details['errors']; } else { $password = wp_generate_password( 12, false ); $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, sanitize_email( $user['email'] ) ); if ( ! $user_id ) { $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); } else { do_action( 'network_user_new_created_user', $user_id ); wp_redirect( add_query_arg( array( 'update' => 'added', 'user_id' => $user_id, ), 'user-new.php' ) ); exit; } } } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'added' === $_GET['update'] ) { $edit_link = ''; if ( isset( $_GET['user_id'] ) ) { $user_id_new = absint( $_GET['user_id'] ); if ( $user_id_new ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); } } $message = __( 'User added.' ); if ( $edit_link ) { $message .= sprintf( ' %s', $edit_link, __( 'Edit user' ) ); } $messages[] = $message; } } $title = __( 'Add New User' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-controls .customize-info .customize-help-toggle { - position: absolute; - top: 4px; - right: 1px; - padding: 20px 20px 10px 10px; - width: 20px; - height: 20px; - cursor: pointer; - box-shadow: none; - -webkit-appearance: none; - background: transparent; - color: #50575e; - border: none; -} +
+

+

' . $msg . '

'; } } if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> +
+ get_error_messages() as $message ) { echo "

$message

"; } ?> +
+ +
+ + + + + + + + + + + + + + +
+
+add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME ); $is_main_site = is_main_site( $id ); if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] ) { check_admin_referer( 'edit-site' ); switch_to_blog( $id ); delete_option( 'rewrite_rules' ); $blog_data = wp_unslash( $_POST['blog'] ); $blog_data['scheme'] = $parsed_scheme; if ( $is_main_site ) { $blog_data['domain'] = $details->domain; $blog_data['path'] = $details->path; } else { $new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME ); if ( ! $new_url_scheme ) { $blog_data['url'] = esc_url( $parsed_scheme . '://' . $blog_data['url'] ); } $update_parsed_url = parse_url( $blog_data['url'] ); if ( ! isset( $update_parsed_url['path'] ) ) { $update_parsed_url['path'] = '/'; } $blog_data['scheme'] = $update_parsed_url['scheme']; $blog_data['domain'] = $update_parsed_url['host']; $blog_data['path'] = $update_parsed_url['path']; } $existing_details = get_site( $id ); $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); foreach ( $blog_data_checkboxes as $c ) { if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) { $blog_data[ $c ] = $existing_details->$c; } else { $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; } } update_blog_details( $id, $blog_data ); $new_details = get_site( $id ); $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); $old_home_parsed = parse_url( $old_home_url ); if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); update_option( 'home', $new_home_url ); } $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); $old_site_parsed = parse_url( $old_site_url ); if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); update_option( 'siteurl', $new_site_url ); } restore_current_blog(); wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id, ), 'site-info.php' ) ); exit; } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'updated' === $_GET['update'] ) { $messages[] = __( 'Site info updated.' ); } } $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-controls .customize-info .customize-help-toggle:before { - position: absolute; - top: 5px; - left: 6px; -} +
+

+

|

+ $id, 'selected' => 'site-info', ) ); if ( ! empty( $messages ) ) { foreach ( $messages as $msg ) { echo '

' . $msg . '

'; } } ?> +
+ + + + + + + + + + + + + + -#customize-controls .customize-info.open .customize-help-toggle, -#customize-controls .customize-info .customize-help-toggle:focus, -#customize-controls .customize-info .customize-help-toggle:hover { - color: #2271b1; -} + + + + + + + + + _x( 'Public', 'site' ) ); if ( ! $is_main_site ) { $attribute_fields['archived'] = __( 'Archived' ); $attribute_fields['spam'] = _x( 'Spam', 'site' ); $attribute_fields['deleted'] = __( 'Deleted' ); } $attribute_fields['mature'] = __( 'Mature' ); ?> + + + + + -#customize-controls .customize-info .customize-panel-description, -#customize-controls .customize-info .customize-section-description, -#customize-outer-theme-controls .customize-info .customize-section-description, -#customize-controls .no-widget-areas-rendered-notice { - color: #50575e; - display: none; - background: #fff; - padding: 12px 15px; - border-top: 1px solid #dcdcde; -} + +
-#customize-controls .customize-info .customize-panel-description.open + .no-widget-areas-rendered-notice { - border-top: none; -} -.no-widget-areas-rendered-notice { - font-style: italic; -} -.no-widget-areas-rendered-notice p:first-child { - margin-top: 0; -} -.no-widget-areas-rendered-notice p:last-child { - margin-bottom: 0; -} +
+add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter site themes list' ), 'heading_pagination' => __( 'Site themes list navigation' ), 'heading_list' => __( 'Site themes list' ), ) ); $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); $action = $wp_list_table->current_action(); $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; $temp_args = array( 'enabled', 'disabled', 'error' ); $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( $temp_args, wp_get_referer() ); if ( ! empty( $_REQUEST['paged'] ) ) { $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); } $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $wp_list_table->prepare_items(); $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); if ( $action ) { switch_to_blog( $id ); $allowed_themes = get_option( 'allowedthemes' ); switch ( $action ) { case 'enable': check_admin_referer( 'enable-theme_' . $_GET['theme'] ); $theme = $_GET['theme']; $action = 'enabled'; $n = 1; if ( ! $allowed_themes ) { $allowed_themes = array( $theme => true ); } else { $allowed_themes[ $theme ] = true; } break; case 'disable': check_admin_referer( 'disable-theme_' . $_GET['theme'] ); $theme = $_GET['theme']; $action = 'disabled'; $n = 1; if ( ! $allowed_themes ) { $allowed_themes = array(); } else { unset( $allowed_themes[ $theme ] ); } break; case 'enable-selected': check_admin_referer( 'bulk-themes' ); if ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; $action = 'enabled'; $n = count( $themes ); foreach ( (array) $themes as $theme ) { $allowed_themes[ $theme ] = true; } } else { $action = 'error'; $n = 'none'; } break; case 'disable-selected': check_admin_referer( 'bulk-themes' ); if ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; $action = 'disabled'; $n = count( $themes ); foreach ( (array) $themes as $theme ) { unset( $allowed_themes[ $theme ] ); } } else { $action = 'error'; $n = 'none'; } break; default: if ( isset( $_POST['checked'] ) ) { check_admin_referer( 'bulk-themes' ); $themes = (array) $_POST['checked']; $n = count( $themes ); $screen = get_current_screen()->id; $referer = apply_filters( "handle_network_bulk_actions-{$screen}", $referer, $action, $themes, $id ); } else { $action = 'error'; $n = 'none'; } } update_option( 'allowedthemes', $allowed_themes ); restore_current_blog(); wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n, ), $referer ) ); exit; } if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) { wp_safe_redirect( $referer ); exit; } add_thickbox(); add_screen_option( 'per_page' ); $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-controls .customize-info .customize-section-description { - margin-bottom: 15px; -} +
+

+

|

+ $id, 'selected' => 'site-themes', ) ); if ( isset( $_GET['enabled'] ) ) { $enabled = absint( $_GET['enabled'] ); if ( 1 === $enabled ) { $message = __( 'Theme enabled.' ); } else { $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); } echo '

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled'] ) ) { $disabled = absint( $_GET['disabled'] ); if ( 1 === $disabled ) { $message = __( 'Theme disabled.' ); } else { $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); } echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { echo '

' . __( 'No theme selected.' ) . '

'; } ?> -#customize-controls .customize-info .customize-panel-description p:first-child, -#customize-controls .customize-info .customize-section-description p:first-child { - margin-top: 0; -} +

-#customize-controls .customize-info .customize-panel-description p:last-child, -#customize-controls .customize-info .customize-section-description p:last-child { - margin-bottom: 0; -} +
+search_box( __( 'Search Installed Themes' ), 'theme' ); ?> + +
-#customize-controls .current-panel .control-section > h3.accordion-section-title { - padding-right: 30px; -} +views(); ?> -#customize-theme-controls .control-section, -#customize-outer-theme-controls .control-section { - border: none; -} +
+ -#customize-theme-controls .accordion-section-title, -#customize-outer-theme-controls .accordion-section-title { - color: #50575e; - background-color: #fff; - border-bottom: 1px solid #dcdcde; - border-left: 4px solid #fff; - transition: - .15s color ease-in-out, - .15s background-color ease-in-out, - .15s border-color ease-in-out; -} +display(); ?> -@media (prefers-reduced-motion: reduce) { - #customize-theme-controls .accordion-section-title, - #customize-outer-theme-controls .accordion-section-title { - transition: none; - } -} +
-#customize-controls #customize-theme-controls .customize-themes-panel .accordion-section-title { - color: #50575e; - background-color: #fff; - border-left: 4px solid #fff; -} +
+ +prepare_items(); get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter site users list' ), 'heading_pagination' => __( 'Site users list navigation' ), 'heading_list' => __( 'Site users list' ), ) ); $_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( 'update', wp_get_referer() ); if ( ! empty( $_REQUEST['paged'] ) ) { $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); } $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); switch_to_blog( $id ); $action = $wp_list_table->current_action(); if ( $action ) { switch ( $action ) { case 'newuser': check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); $user = $_POST['user']; if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { $update = 'err_new'; } else { $password = wp_generate_password( 12, false ); $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); if ( false === $user_id ) { $update = 'err_new_dup'; } else { $result = add_user_to_blog( $id, $user_id, $_POST['new_role'] ); if ( is_wp_error( $result ) ) { $update = 'err_add_fail'; } else { $update = 'newuser'; do_action( 'network_site_users_created_user', $user_id ); } } } break; case 'adduser': check_admin_referer( 'add-user', '_wpnonce_add-user' ); if ( ! empty( $_POST['newuser'] ) ) { $update = 'adduser'; $newuser = $_POST['newuser']; $user = get_user_by( 'login', $newuser ); if ( $user && $user->exists() ) { if ( ! is_user_member_of_blog( $user->ID, $id ) ) { $result = add_user_to_blog( $id, $user->ID, $_POST['new_role'] ); if ( is_wp_error( $result ) ) { $update = 'err_add_fail'; } } else { $update = 'err_add_member'; } } else { $update = 'err_add_notfound'; } } else { $update = 'err_add_notfound'; } break; case 'remove': if ( ! current_user_can( 'remove_users' ) ) { wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 ); } check_admin_referer( 'bulk-users' ); $update = 'remove'; if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; remove_user_from_blog( $user_id, $id ); } } elseif ( isset( $_GET['user'] ) ) { remove_user_from_blog( $_GET['user'] ); } else { $update = 'err_remove'; } break; case 'promote': check_admin_referer( 'bulk-users' ); $editable_roles = get_editable_roles(); $role = $_REQUEST['new_role']; if ( empty( $editable_roles[ $role ] ) ) { wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); } if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; $update = 'promote'; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; if ( ! is_user_member_of_blog( $user_id ) ) { wp_die( '

' . __( 'Something went wrong.' ) . '

' . '

' . __( 'One of the selected users is not a member of this site.' ) . '

', 403 ); } $user = get_userdata( $user_id ); $user->set_role( $role ); } } else { $update = 'err_promote'; } break; default: if ( ! isset( $_REQUEST['users'] ) ) { break; } check_admin_referer( 'bulk-users' ); $userids = $_REQUEST['users']; $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $userids, $id ); $update = $action; break; } wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); exit; } restore_current_blog(); if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) { wp_safe_redirect( $referer ); exit; } add_screen_option( 'per_page' ); $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) { wp_enqueue_script( 'user-suggest' ); } require_once ABSPATH . 'wp-admin/admin-header.php'; ?> -#customize-theme-controls .accordion-section-title:after, -#customize-outer-theme-controls .accordion-section-title:after { - content: "\f345"; - color: #a7aaad; -} + -#customize-theme-controls .accordion-section-content, -#customize-outer-theme-controls .accordion-section-content { - color: #50575e; - background: transparent; -} -#customize-controls .control-section:hover > .accordion-section-title, -#customize-controls .control-section .accordion-section-title:hover, -#customize-controls .control-section.open .accordion-section-title, -#customize-controls .control-section .accordion-section-title:focus { - color: #2271b1; - background: #f6f7f7; - border-left-color: #2271b1; -} +
+

+

|

+ $id, 'selected' => 'site-users', ) ); if ( isset( $_GET['update'] ) ) : switch ( $_GET['update'] ) { case 'adduser': echo '

' . __( 'User added.' ) . '

'; break; case 'err_add_member': echo '

' . __( 'User is already a member of this site.' ) . '

'; break; case 'err_add_fail': echo '

' . __( 'User could not be added to this site.' ) . '

'; break; case 'err_add_notfound': echo '

' . __( 'Enter the username of an existing user.' ) . '

'; break; case 'promote': echo '

' . __( 'Changed roles.' ) . '

'; break; case 'err_promote': echo '

' . __( 'Select a user to change role.' ) . '

'; break; case 'remove': echo '

' . __( 'User removed from this site.' ) . '

'; break; case 'err_remove': echo '

' . __( 'Select a user to remove.' ) . '

'; break; case 'newuser': echo '

' . __( 'User created.' ) . '

'; break; case 'err_new': echo '

' . __( 'Enter the username and email.' ) . '

'; break; case 'err_new_dup': echo '

' . __( 'Duplicated username or email address.' ) . '

'; break; } endif; ?> -#accordion-section-themes + .control-section { - border-top: 1px solid #dcdcde; -} +
+search_box( __( 'Search Users' ), 'user' ); ?> + +
-.js .control-section:hover .accordion-section-title, -.js .control-section .accordion-section-title:hover, -.js .control-section.open .accordion-section-title, -.js .control-section .accordion-section-title:focus { - background: #f6f7f7; -} +views(); ?> -#customize-theme-controls .control-section:hover > .accordion-section-title:after, -#customize-theme-controls .control-section .accordion-section-title:hover:after, -#customize-theme-controls .control-section.open .accordion-section-title:after, -#customize-theme-controls .control-section .accordion-section-title:focus:after, -#customize-outer-theme-controls .control-section:hover > .accordion-section-title:after, -#customize-outer-theme-controls .control-section .accordion-section-title:hover:after, -#customize-outer-theme-controls .control-section.open .accordion-section-title:after, -#customize-outer-theme-controls .control-section .accordion-section-title:focus:after { - color: #2271b1; -} +
+ -#customize-theme-controls .control-section.open { - border-bottom: 1px solid #f0f0f1; -} +display(); ?> -#customize-theme-controls .control-section.open .accordion-section-title, -#customize-outer-theme-controls .control-section.open .accordion-section-title { - border-bottom-color: #f0f0f1 !important; -} +
-#customize-theme-controls .control-section:last-of-type.open, -#customize-theme-controls .control-section:last-of-type > .accordion-section-title { - border-bottom-color: #dcdcde; -} + +

+
+ + + + + + + + + + + + + 'submit-add-existing-user' ) ); ?> +
+ -#customize-theme-controls .control-panel-content:not(.control-panel-nav_menus) .control-section:nth-child(2), -#customize-theme-controls .control-panel-nav_menus .control-section-nav_menu, -#customize-theme-controls .control-section-nav_menu_locations .accordion-section-title { - border-top: 1px solid #dcdcde; -} + +

+
+ + + + + + + + + + + + + + + + + + + + 'submit-add-user' ) ); ?> +
+ +
+domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) ); $redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request ); if ( $redirect_network_admin_request ) { wp_redirect( network_admin_url() ); exit; } unset( $redirect_network_admin_request ); __( 'Author' ), 'comment' => _x( 'Comment', 'column name' ), ), array(), array(), 'comment', ); } protected function get_table_classes() { $classes = parent::get_table_classes(); $classes[] = 'wp-list-table'; $classes[] = 'comments-box'; return $classes; } public function display( $output_empty = false ) { $singular = $this->_args['singular']; wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); ?> + + + > + display_rows_or_placeholder(); } ?> + + + status; $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); $download_data_markup = ''; $download_data_markup .= '' . '' . '' . ''; $download_data_markup .= ''; $row_actions['download-data'] = $download_data_markup; if ( 'request-completed' !== $status ) { $complete_request_markup = ''; $complete_request_markup .= sprintf( '%s', esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'complete', 'request_id' => array( $request_id ), ), admin_url( 'export-personal-data.php' ) ), 'bulk-privacy_requests' ) ), esc_attr( sprintf( __( 'Mark export request for “%s” as completed.' ), $item->email ) ), __( 'Complete request' ) ); $complete_request_markup .= ''; } if ( ! empty( $complete_request_markup ) ) { $row_actions['complete-request'] = $complete_request_markup; } return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) ); } public function column_next_steps( $item ) { $status = $item->status; switch ( $status ) { case 'request-pending': esc_html_e( 'Waiting for confirmation' ); break; case 'request-confirmed': $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $exporters_count = count( $exporters ); $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); echo '
'; ?> + + + + + '; break; case 'request-failed': echo ''; break; case 'request-completed': echo '' . esc_html__( 'Remove request' ) . ''; break; } } } '', 'email' => __( 'Requester' ), 'status' => __( 'Status' ), 'created_timestamp' => __( 'Requested' ), 'next_steps' => __( 'Next steps' ), ); return $columns; } protected function get_admin_url() { $pagenow = str_replace( '_', '-', $this->request_type ); if ( 'remove-personal-data' === $pagenow ) { $pagenow = 'erase-personal-data'; } return admin_url( $pagenow . '.php' ); } protected function get_sortable_columns() { $desc_first = isset( $_GET['orderby'] ); return array( 'email' => 'requester', 'created_timestamp' => array( 'requested', $desc_first ), ); } protected function get_default_primary_column_name() { return 'email'; } protected function get_request_counts() { global $wpdb; $cache_key = $this->post_type . '-' . $this->request_type; $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { return $counts; } $query = " + SELECT post_status, COUNT( * ) AS num_posts + FROM {$wpdb->posts} + WHERE post_type = %s + AND post_name = %s + GROUP BY post_status"; $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A ); $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; } $counts = (object) $counts; wp_cache_set( $cache_key, $counts, 'counts' ); return $counts; } protected function get_views() { $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : ''; $statuses = _wp_privacy_statuses(); $views = array(); $counts = $this->get_request_counts(); $total_requests = absint( array_sum( (array) $counts ) ); $admin_url = $this->get_admin_url(); $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : ''; $status_label = sprintf( _nx( 'All (%s)', 'All (%s)', $total_requests, 'requests' ), number_format_i18n( $total_requests ) ); $views['all'] = sprintf( '%s', esc_url( $admin_url ), $current_link_attributes, $status_label ); foreach ( $statuses as $status => $label ) { $post_status = get_post_status_object( $status ); if ( ! $post_status ) { continue; } $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : ''; $total_status_requests = absint( $counts->{$status} ); if ( ! $total_status_requests ) { continue; } $status_label = sprintf( translate_nooped_plural( $post_status->label_count, $total_status_requests ), number_format_i18n( $total_status_requests ) ); $status_link = add_query_arg( 'filter-status', $status, $admin_url ); $views[ $status ] = sprintf( '%s', esc_url( $status_link ), $current_link_attributes, $status_label ); } return $views; } protected function get_bulk_actions() { return array( 'resend' => __( 'Resend confirmation requests' ), 'complete' => __( 'Mark requests as completed' ), 'delete' => __( 'Delete requests' ), ); } public function process_bulk_action() { $action = $this->current_action(); $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); if ( empty( $request_ids ) ) { return; } $count = 0; $failures = 0; check_admin_referer( 'bulk-privacy_requests' ); switch ( $action ) { case 'resend': foreach ( $request_ids as $request_id ) { $resend = _wp_privacy_resend_request( $request_id ); if ( $resend && ! is_wp_error( $resend ) ) { $count++; } else { $failures++; } } if ( $failures ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d confirmation request failed to resend.', '%d confirmation requests failed to resend.', $failures ), $failures ), 'error' ); } if ( $count ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d confirmation request re-sent successfully.', '%d confirmation requests re-sent successfully.', $count ), $count ), 'success' ); } break; case 'complete': foreach ( $request_ids as $request_id ) { $result = _wp_privacy_completed_request( $request_id ); if ( $result && ! is_wp_error( $result ) ) { $count++; } } add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request marked as complete.', '%d requests marked as complete.', $count ), $count ), 'success' ); break; case 'delete': foreach ( $request_ids as $request_id ) { if ( wp_delete_post( $request_id, true ) ) { $count++; } else { $failures++; } } if ( $failures ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request failed to delete.', '%d requests failed to delete.', $failures ), $failures ), 'error' ); } if ( $count ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request deleted successfully.', '%d requests deleted successfully.', $count ), $count ), 'success' ); } break; } } public function prepare_items() { $this->items = array(); $posts_per_page = $this->get_items_per_page( $this->request_type . '_requests_per_page' ); $args = array( 'post_type' => $this->post_type, 'post_name__in' => array( $this->request_type ), 'posts_per_page' => $posts_per_page, 'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0, 'post_status' => 'any', 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', ); $orderby_mapping = array( 'requester' => 'post_title', 'requested' => 'post_date', ); if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) { $args['orderby'] = $orderby_mapping[ $_REQUEST['orderby'] ]; } if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['order'] ), array( 'ASC', 'DESC' ), true ) ) { $args['order'] = strtoupper( $_REQUEST['order'] ); } if ( ! empty( $_REQUEST['filter-status'] ) ) { $filter_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : ''; $args['post_status'] = $filter_status; } $requests_query = new WP_Query( $args ); $requests = $requests_query->posts; foreach ( $requests as $request ) { $this->items[] = wp_get_user_request( $request->ID ); } $this->items = array_filter( $this->items ); $this->set_pagination_args( array( 'total_items' => $requests_query->found_posts, 'per_page' => $posts_per_page, ) ); } public function column_cb( $item ) { return sprintf( '', esc_attr( $item->ID ) ); } public function column_status( $item ) { $status = get_post_status( $item->ID ); $status_object = get_post_status_object( $status ); if ( ! $status_object || empty( $status_object->label ) ) { return '-'; } $timestamp = false; switch ( $status ) { case 'request-confirmed': $timestamp = $item->confirmed_timestamp; break; case 'request-completed': $timestamp = $item->completed_timestamp; break; } echo ''; echo esc_html( $status_object->label ); if ( $timestamp ) { echo ' (' . $this->get_timestamp_as_date( $timestamp ) . ')'; } echo ''; } protected function get_timestamp_as_date( $timestamp ) { if ( empty( $timestamp ) ) { return ''; } $time_diff = time() - $timestamp; if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) ); } return date_i18n( get_option( 'date_format' ), $timestamp ); } public function column_default( $item, $column_name ) { do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); } public function column_created_timestamp( $item ) { return $this->get_timestamp_as_date( $item->created_timestamp ); } public function column_email( $item ) { return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( array() ) ); } public function column_next_steps( $item ) {} public function single_row( $item ) { $status = $item->status; echo ''; $this->single_row_columns( $item ); echo ''; } public function embed_scripts() {} } 'tags', 'singular' => 'tag', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $action = $this->screen->action; $post_type = $this->screen->post_type; $taxonomy = $this->screen->taxonomy; if ( empty( $taxonomy ) ) { $taxonomy = 'post_tag'; } if ( ! taxonomy_exists( $taxonomy ) ) { wp_die( __( 'Invalid taxonomy.' ) ); } $tax = get_taxonomy( $taxonomy ); if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) { $post_type = 'post'; } } public function ajax_user_can() { return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms ); } public function prepare_items() { $taxonomy = $this->screen->taxonomy; $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" ); if ( 'post_tag' === $taxonomy ) { $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' ); } elseif ( 'category' === $taxonomy ) { $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); } $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'taxonomy' => $taxonomy, 'search' => $search, 'page' => $this->get_pagenum(), 'number' => $tags_per_page, 'hide_empty' => 0, ); if ( ! empty( $_REQUEST['orderby'] ) ) { $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); } if ( ! empty( $_REQUEST['order'] ) ) { $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); } $args['offset'] = ( $args['page'] - 1 ) * $args['number']; $this->callback_args = $args; if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { $args['number'] = 0; $args['offset'] = $args['number']; } $this->items = get_terms( $args ); $this->set_pagination_args( array( 'total_items' => wp_count_terms( array( 'taxonomy' => $taxonomy, 'search' => $search, ) ), 'per_page' => $tags_per_page, ) ); } public function no_items() { echo get_taxonomy( $this->screen->taxonomy )->labels->not_found; } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) { $actions['delete'] = __( 'Delete' ); } return $actions; } public function current_action() { if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) { return 'bulk-delete'; } return parent::current_action(); } public function get_columns() { $columns = array( 'cb' => '', 'name' => _x( 'Name', 'term name' ), 'description' => __( 'Description' ), 'slug' => __( 'Slug' ), ); if ( 'link_category' === $this->screen->taxonomy ) { $columns['links'] = __( 'Links' ); } else { $columns['posts'] = _x( 'Count', 'Number/count of items' ); } return $columns; } protected function get_sortable_columns() { return array( 'name' => 'name', 'description' => 'description', 'slug' => 'slug', 'posts' => 'count', 'links' => 'count', ); } public function display_rows_or_placeholder() { $taxonomy = $this->screen->taxonomy; $number = $this->callback_args['number']; $offset = $this->callback_args['offset']; $count = 0; if ( empty( $this->items ) || ! is_array( $this->items ) ) { echo ''; $this->no_items(); echo ''; return; } if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) { if ( ! empty( $this->callback_args['search'] ) ) { $children = array(); } else { $children = _get_term_hierarchy( $taxonomy ); } $this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count ); } else { foreach ( $this->items as $term ) { $this->single_row( $term ); } } } private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) { $end = $start + $per_page; foreach ( $terms as $key => $term ) { if ( $count >= $end ) { break; } if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) { continue; } if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { $my_parents = array(); $parent_ids = array(); $p = $term->parent; while ( $p ) { $my_parent = get_term( $p, $taxonomy ); $my_parents[] = $my_parent; $p = $my_parent->parent; if ( in_array( $p, $parent_ids, true ) ) { break; } $parent_ids[] = $p; } unset( $parent_ids ); $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { echo "\t"; $this->single_row( $my_parent, $level - $num_parents ); $num_parents--; } } if ( $count >= $start ) { echo "\t"; $this->single_row( $term, $level ); } ++$count; unset( $terms[ $key ] ); if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) { $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); } } } public function single_row( $tag, $level = 0 ) { global $taxonomy; $tag = sanitize_term( $tag, $taxonomy ); $this->level = $level; if ( $tag->parent ) { $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); $level = 'level-' . $count; } else { $level = 'level-0'; } echo ''; $this->single_row_columns( $tag ); echo ''; } public function column_cb( $item ) { $tag = $item; if ( current_user_can( 'delete_term', $tag->term_id ) ) { return sprintf( '' . '', $tag->term_id, sprintf( __( 'Select %s' ), $tag->name ) ); } return ' '; } public function column_name( $tag ) { $taxonomy = $this->screen->taxonomy; $pad = str_repeat( '— ', max( 0, $this->level ) ); $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); if ( $edit_link ) { $edit_link = add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), $edit_link ); $name = sprintf( '%s', esc_url( $edit_link ), esc_attr( sprintf( __( '“%s” (Edit)' ), $tag->name ) ), $name ); } $out = sprintf( '%s
', $name ); $out .= ''; return $out; } protected function get_default_primary_column_name() { return 'name'; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $tag = $item; $taxonomy = $this->screen->taxonomy; $tax = get_taxonomy( $taxonomy ); $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; $edit_link = add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) ); $actions = array(); if ( current_user_can( 'edit_term', $tag->term_id ) ) { $actions['edit'] = sprintf( '%s', esc_url( $edit_link ), esc_attr( sprintf( __( 'Edit “%s”' ), $tag->name ) ), __( 'Edit' ) ); $actions['inline hide-if-no-js'] = sprintf( '', esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), __( 'Quick Edit' ) ); } if ( current_user_can( 'delete_term', $tag->term_id ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), __( 'Delete' ) ); } if ( is_taxonomy_viewable( $tax ) ) { $actions['view'] = sprintf( '%s', get_term_link( $tag ), esc_attr( sprintf( __( 'View “%s” archive' ), $tag->name ) ), __( 'View' ) ); } $actions = apply_filters( 'tag_row_actions', $actions, $tag ); $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); return $this->row_actions( $actions ); } public function column_description( $tag ) { if ( $tag->description ) { return $tag->description; } else { return '' . __( 'No description' ) . ''; } } public function column_slug( $tag ) { return apply_filters( 'editable_slug', $tag->slug, $tag ); } public function column_posts( $tag ) { $count = number_format_i18n( $tag->count ); $tax = get_taxonomy( $this->screen->taxonomy ); $ptype_object = get_post_type_object( $this->screen->post_type ); if ( ! $ptype_object->show_ui ) { return $count; } if ( $tax->query_var ) { $args = array( $tax->query_var => $tag->slug ); } else { $args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug, ); } if ( 'post' !== $this->screen->post_type ) { $args['post_type'] = $this->screen->post_type; } if ( 'attachment' === $this->screen->post_type ) { return "$count"; } return "$count"; } public function column_links( $tag ) { $count = number_format_i18n( $tag->count ); if ( $count ) { $count = "$count"; } return $count; } public function column_default( $item, $column_name ) { return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id ); } public function inline_edit() { $tax = get_taxonomy( $this->screen->taxonomy ); if ( ! current_user_can( $tax->cap->edit_terms ) ) { return; } ?> -#customize-theme-controls .control-panel-nav_menus .control-section-nav_menu + .control-section-nav_menu { - border-top: none; -} +
+ -#customize-theme-controls > ul { - margin: 0; -} + + -.section-open #customize-theme-controls .customize-pane-parent, -.in-sub-panel #customize-theme-controls .customize-pane-parent, -.section-open #customize-info, -.in-sub-panel #customize-info, -.in-sub-panel.section-open #customize-theme-controls .customize-pane-child.current-panel { - visibility: hidden; - height: 0; - overflow: hidden; - transform: translateX(-100%); -} +
+
+ 'user', 'plural' => 'users', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $this->is_site_users = 'site-users-network' === $this->screen->id; if ( $this->is_site_users ) { $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; } } public function ajax_user_can() { if ( $this->is_site_users ) { return current_user_can( 'manage_sites' ); } else { return current_user_can( 'list_users' ); } } public function prepare_items() { global $role, $usersearch; $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; $users_per_page = $this->get_items_per_page( $per_page ); $paged = $this->get_pagenum(); if ( 'none' === $role ) { $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'include' => wp_get_users_with_no_role( $this->site_id ), 'search' => $usersearch, 'fields' => 'all_with_meta', ); } else { $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'role' => $role, 'search' => $usersearch, 'fields' => 'all_with_meta', ); } if ( '' !== $args['search'] ) { $args['search'] = '*' . $args['search'] . '*'; } if ( $this->is_site_users ) { $args['blog_id'] = $this->site_id; } if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } $args = apply_filters( 'users_list_table_query_args', $args ); $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); $this->set_pagination_args( array( 'total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page, ) ); } public function no_items() { _e( 'No users found.' ); } protected function get_views() { global $role; $wp_roles = wp_roles(); $count_users = ! wp_is_large_user_count(); if ( $this->is_site_users ) { $url = 'site-users.php?id=' . $this->site_id; } else { $url = 'users.php'; } $role_links = array(); $avail_roles = array(); $all_text = __( 'All' ); $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; if ( $count_users ) { if ( $this->is_site_users ) { switch_to_blog( $this->site_id ); $users_of_blog = count_users( 'time', $this->site_id ); restore_current_blog(); } else { $users_of_blog = count_users(); } $total_users = $users_of_blog['total_users']; $avail_roles =& $users_of_blog['avail_roles']; unset( $users_of_blog ); $all_text = sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ); } $role_links['all'] = sprintf( '%s', $url, $current_link_attributes, $all_text ); foreach ( $wp_roles->get_names() as $this_role => $name ) { if ( $count_users && ! isset( $avail_roles[ $this_role ] ) ) { continue; } $current_link_attributes = ''; if ( $this_role === $role ) { $current_link_attributes = ' class="current" aria-current="page"'; } $name = translate_user_role( $name ); if ( $count_users ) { $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles[ $this_role ] ) ); } $role_links[ $this_role ] = "$name"; } if ( ! empty( $avail_roles['none'] ) ) { $current_link_attributes = ''; if ( 'none' === $role ) { $current_link_attributes = ' class="current" aria-current="page"'; } $name = __( 'No role' ); $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles['none'] ) ); $role_links['none'] = "$name"; } return $role_links; } protected function get_bulk_actions() { $actions = array(); if ( is_multisite() ) { if ( current_user_can( 'remove_users' ) ) { $actions['remove'] = __( 'Remove' ); } } else { if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); } } if ( current_user_can( 'edit_users' ) ) { $actions['resetpassword'] = __( 'Send password reset' ); } return $actions; } protected function extra_tablenav( $which ) { $id = 'bottom' === $which ? 'new_role2' : 'new_role'; $button_id = 'bottom' === $which ? 'changeit2' : 'changeit'; ?> +
+ has_items() ) : ?> + + + +
+ '', 'username' => __( 'Username' ), 'name' => __( 'Name' ), 'email' => __( 'Email' ), 'role' => __( 'Role' ), 'posts' => _x( 'Posts', 'post type general name' ), ); if ( $this->is_site_users ) { unset( $c['posts'] ); } return $c; } protected function get_sortable_columns() { $c = array( 'username' => 'login', 'email' => 'email', ); return $c; } public function display_rows() { if ( ! $this->is_site_users ) { $post_counts = count_many_users_posts( array_keys( $this->items ) ); } foreach ( $this->items as $userid => $user_object ) { echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); } } public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { if ( ! ( $user_object instanceof WP_User ) ) { $user_object = get_userdata( (int) $user_object ); } $user_object->filter = 'display'; $email = $user_object->user_email; if ( $this->is_site_users ) { $url = "site-users.php?id={$this->site_id}&"; } else { $url = 'users.php?'; } $user_roles = $this->get_role_list( $user_object ); $actions = array(); $checkbox = ''; $super_admin = ''; if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { if ( in_array( $user_object->user_login, get_super_admins(), true ) ) { $super_admin = ' — ' . __( 'Super Admin' ); } } if ( current_user_can( 'list_users' ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); if ( current_user_can( 'edit_user', $user_object->ID ) ) { $edit = "{$user_object->user_login}{$super_admin}
"; $actions['edit'] = '' . __( 'Edit' ) . ''; } else { $edit = "{$user_object->user_login}{$super_admin}
"; } if ( ! is_multisite() && get_current_user_id() !== $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) { $actions['delete'] = "" . __( 'Delete' ) . ''; } if ( is_multisite() && current_user_can( 'remove_user', $user_object->ID ) ) { $actions['remove'] = "" . __( 'Remove' ) . ''; } $author_posts_url = get_author_posts_url( $user_object->ID ); if ( $author_posts_url ) { $actions['view'] = sprintf( '%s', esc_url( $author_posts_url ), esc_attr( sprintf( __( 'View posts by %s' ), $user_object->display_name ) ), __( 'View' ) ); } if ( get_current_user_id() !== $user_object->ID && current_user_can( 'edit_user', $user_object->ID ) ) { $actions['resetpassword'] = "" . __( 'Send password reset' ) . ''; } $actions = apply_filters( 'user_row_actions', $actions, $user_object ); $role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) ); $checkbox = sprintf( '' . '', $user_object->ID, sprintf( __( 'Select %s' ), $user_object->user_login ), $role_classes ); } else { $edit = "{$user_object->user_login}{$super_admin}"; } $avatar = get_avatar( $user_object->ID, 32 ); $roles_list = implode( ', ', $user_roles ); $r = ""; list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $classes = "$column_name column-$column_name"; if ( $primary === $column_name ) { $classes .= ' has-row-actions column-primary'; } if ( 'posts' === $column_name ) { $classes .= ' num'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"'; $attributes = "class='$classes' $data"; if ( 'cb' === $column_name ) { $r .= "$checkbox"; } else { $r .= ""; switch ( $column_name ) { case 'username': $r .= "$avatar $edit"; break; case 'name': if ( $user_object->first_name && $user_object->last_name ) { $r .= "$user_object->first_name $user_object->last_name"; } elseif ( $user_object->first_name ) { $r .= $user_object->first_name; } elseif ( $user_object->last_name ) { $r .= $user_object->last_name; } else { $r .= sprintf( '%s', _x( 'Unknown', 'name' ) ); } break; case 'email': $r .= "$email"; break; case 'role': $r .= esc_html( $roles_list ); break; case 'posts': if ( $numposts > 0 ) { $r .= sprintf( '%s', "edit.php?author={$user_object->ID}", $numposts, sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) ); } else { $r .= 0; } break; default: $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); } if ( $primary === $column_name ) { $r .= $this->row_actions( $actions ); } $r .= ''; } } $r .= ''; return $r; } protected function get_default_primary_column_name() { return 'username'; } protected function get_role_list( $user_object ) { $wp_roles = wp_roles(); $role_list = array(); foreach ( $user_object->roles as $role ) { if ( isset( $wp_roles->role_names[ $role ] ) ) { $role_list[ $role ] = translate_user_role( $wp_roles->role_names[ $role ] ); } } if ( empty( $role_list ) ) { $role_list['none'] = _x( 'None', 'no user roles' ); } return apply_filters( 'get_role_list', $role_list, $user_object ); } } $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', ); if ( isset( $wp_registered_widget_controls[ $widget['id'] ]['id_base'] ) && isset( $widget['params'][0]['number'] ) ) { $id_base = $wp_registered_widget_controls[ $widget['id'] ]['id_base']; $args['_temp_id'] = "$id_base-__i__"; $args['_multi_num'] = next_widget_id_number( $id_base ); $args['_add'] = 'multi'; } else { $args['_add'] = 'single'; if ( $sidebar ) { $args['_hide'] = '1'; } } $control_args = array( 0 => $args, 1 => $widget['params'][0], ); $sidebar_args = wp_list_widget_controls_dynamic_sidebar( $control_args ); wp_widget_control( ...$sidebar_args ); } } function _sort_name_callback( $a, $b ) { return strnatcasecmp( $a['name'], $b['name'] ); } function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) { add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); $description = wp_sidebar_description( $sidebar ); echo '
'; if ( $sidebar_name ) { $add_to = sprintf( __( 'Add to: %s' ), $sidebar_name ); ?> + + + + '; } function wp_list_widget_controls_dynamic_sidebar( $params ) { global $wp_registered_widgets; static $i = 0; $i++; $widget_id = $params[0]['widget_id']; $id = isset( $params[0]['_temp_id'] ) ? $params[0]['_temp_id'] : $widget_id; $hidden = isset( $params[0]['_hide'] ) ? ' style="display:none;"' : ''; $params[0]['before_widget'] = "
"; $params[0]['after_widget'] = '
'; $params[0]['before_title'] = '%BEG_OF_TITLE%'; $params[0]['after_title'] = '%END_OF_TITLE%'; if ( is_callable( $wp_registered_widgets[ $widget_id ]['callback'] ) ) { $wp_registered_widgets[ $widget_id ]['_callback'] = $wp_registered_widgets[ $widget_id ]['callback']; $wp_registered_widgets[ $widget_id ]['callback'] = 'wp_widget_control'; } return $params; } function next_widget_id_number( $id_base ) { global $wp_registered_widgets; $number = 1; foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( preg_match( '/' . preg_quote( $id_base, '/' ) . '-([0-9]+)$/', $widget_id, $matches ) ) { $number = max( $number, $matches[1] ); } } $number++; return $number; } function wp_widget_control( $sidebar_args ) { global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets; $widget_id = $sidebar_args['widget_id']; $sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false; $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ], true ) : '-1'; $control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array(); $widget = $wp_registered_widgets[ $widget_id ]; $id_format = $widget['id']; $widget_number = isset( $control['params'][0]['number'] ) ? $control['params'][0]['number'] : ''; $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $widget_id; $width = isset( $control['width'] ) ? $control['width'] : ''; $height = isset( $control['height'] ) ? $control['height'] : ''; $multi_number = isset( $sidebar_args['_multi_num'] ) ? $sidebar_args['_multi_num'] : ''; $add_new = isset( $sidebar_args['_add'] ) ? $sidebar_args['_add'] : ''; $before_form = isset( $sidebar_args['before_form'] ) ? $sidebar_args['before_form'] : '
'; $after_form = isset( $sidebar_args['after_form'] ) ? $sidebar_args['after_form'] : '
'; $before_widget_content = isset( $sidebar_args['before_widget_content'] ) ? $sidebar_args['before_widget_content'] : '
'; $after_widget_content = isset( $sidebar_args['after_widget_content'] ) ? $sidebar_args['after_widget_content'] : '
'; $query_arg = array( 'editwidget' => $widget['id'] ); if ( $add_new ) { $query_arg['addnew'] = 1; if ( $multi_number ) { $query_arg['num'] = $multi_number; $query_arg['base'] = $id_base; } } else { $query_arg['sidebar'] = $sidebar_id; $query_arg['key'] = $key; } if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) { $control['params'][0]['number'] = -1; if ( isset( $control['id_base'] ) ) { $id_format = $control['id_base'] . '-__i__'; } } $wp_registered_widgets[ $widget_id ]['callback'] = $wp_registered_widgets[ $widget_id ]['_callback']; unset( $wp_registered_widgets[ $widget_id ]['_callback'] ); $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); $has_form = 'noform'; echo $sidebar_args['before_widget']; ?> +
+
+ + + + + + +
+

+
-.section-open #customize-theme-controls .customize-pane-parent.busy, -.in-sub-panel #customize-theme-controls .customize-pane-parent.busy, -.section-open #customize-info.busy, -.in-sub-panel #customize-info.busy, -.busy.section-open.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel, -#customize-theme-controls .customize-pane-child.open, -#customize-theme-controls .customize-pane-child.current-panel, -#customize-theme-controls .customize-pane-child.busy { - visibility: visible; - height: auto; - overflow: auto; -} - -#customize-theme-controls .customize-pane-child.accordion-section-content, -#customize-theme-controls .customize-pane-child.accordion-sub-container { - display: block; - overflow-x: hidden; -} - -#customize-theme-controls .customize-pane-child.accordion-section-content { - padding: 12px; -} - -#customize-theme-controls .customize-pane-child.menu li { - position: static; -} - -.customize-section-description-container, -.control-section-nav_menu .customize-section-description-container, -.control-section-new_menu .customize-section-description-container { - margin-bottom: 15px; -} - -.control-section-nav_menu .customize-control, -.control-section-new_menu .customize-control { - /* Override default `margin-bottom` for `.customize-control` */ - margin-bottom: 0; -} - -.customize-section-title { - margin: -12px -12px 0; - border-bottom: 1px solid #dcdcde; - background: #fff; -} - -div.customize-section-description { - margin-top: 22px; -} - -.customize-info div.customize-section-description { - margin-top: 0; -} +
+ + + " . __( 'There are no options for this widget.' ) . "

\n"; } $noform_class = ''; if ( 'noform' === $has_form ) { $noform_class = ' widget-control-noform'; } ?> + + + + + + + + -div.customize-section-description p:first-child { - margin-top: 0; -} +
+
+ + + | + +
+
+ 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?> + +
+
+
+ +
-div.customize-section-description p:last-child { - margin-bottom: 0; -} +
+ +
+ 0 ) { return $file; } if ( defined( 'WP_IMPORTING' ) ) { return $file; } $space_left = get_upload_space_available(); $file_size = filesize( $file['tmp_name'] ); if ( $space_left < $file_size ) { $file['error'] = sprintf( __( 'Not enough space to upload. %s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) ); } if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) { $file['error'] = sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) ); } if ( upload_is_user_over_quota( false ) ) { $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); } if ( $file['error'] > 0 && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); } return $file; } function wpmu_delete_blog( $blog_id, $drop = false ) { global $wpdb; $blog_id = (int) $blog_id; $switch = false; if ( get_current_blog_id() !== $blog_id ) { $switch = true; switch_to_blog( $blog_id ); } $blog = get_site( $blog_id ); $current_network = get_network(); if ( $drop && ! $blog ) { $drop = false; } if ( $drop && ( 1 === $blog_id || is_main_site( $blog_id ) || ( $blog->path === $current_network->path && $blog->domain === $current_network->domain ) ) ) { $drop = false; } $upload_path = trim( get_option( 'upload_path' ) ); if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) { $drop = false; } if ( $drop ) { wp_delete_site( $blog_id ); } else { do_action_deprecated( 'delete_blog', array( $blog_id, false ), '5.1.0' ); $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids', ) ); if ( ! empty( $users ) ) { foreach ( $users as $user_id ) { remove_user_from_blog( $user_id, $blog_id ); } } update_blog_status( $blog_id, 'deleted', 1 ); do_action_deprecated( 'deleted_blog', array( $blog_id, false ), '5.1.0' ); } if ( $switch ) { restore_current_blog(); } } function wpmu_delete_user( $id ) { global $wpdb; if ( ! is_numeric( $id ) ) { return false; } $id = (int) $id; $user = new WP_User( $id ); if ( ! $user->exists() ) { return false; } $_super_admins = get_super_admins(); if ( in_array( $user->user_login, $_super_admins, true ) ) { return false; } do_action( 'wpmu_delete_user', $id, $user ); $blogs = get_blogs_of_user( $id ); if ( ! empty( $blogs ) ) { foreach ( $blogs as $blog ) { switch_to_blog( $blog->userblog_id ); remove_user_from_blog( $id, $blog->userblog_id ); $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); foreach ( (array) $post_ids as $post_id ) { wp_delete_post( $post_id ); } $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); if ( $link_ids ) { foreach ( $link_ids as $link_id ) { wp_delete_link( $link_id ); } } restore_current_blog(); } } $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); foreach ( $meta as $mid ) { delete_metadata_by_mid( 'user', $mid ); } $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); clean_user_cache( $user ); do_action( 'deleted_user', $id, null, $user ); return true; } function upload_is_user_over_quota( $display_message = true ) { if ( get_site_option( 'upload_space_check_disabled' ) ) { return false; } $space_allowed = get_space_allowed(); if ( ! is_numeric( $space_allowed ) ) { $space_allowed = 10; } $space_used = get_space_used(); if ( ( $space_allowed - $space_used ) < 0 ) { if ( $display_message ) { printf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( $space_allowed * MB_IN_BYTES ) ); } return true; } else { return false; } } function display_space_usage() { $space_allowed = get_space_allowed(); $space_used = get_space_used(); $percent_used = ( $space_used / $space_allowed ) * 100; $space = size_format( $space_allowed * MB_IN_BYTES ); ?> + + + + + + + + + + + + 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu', ); $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); return strtr( $code, $lang_codes ); } function sync_category_tag_slugs( $term, $taxonomy ) { if ( global_terms_enabled() && ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) ) { if ( is_object( $term ) ) { $term->slug = sanitize_title( $term->name ); } else { $term['slug'] = sanitize_title( $term['name'] ); } } return $term; } function _access_denied_splash() { if ( ! is_user_logged_in() || is_network_admin() ) { return; } $blogs = get_blogs_of_user( get_current_user_id() ); if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) { return; } $blog_name = get_bloginfo( 'name' ); if ( empty( $blogs ) ) { wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 ); } $output = '

' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '

'; $output .= '

' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '

'; $output .= '

' . __( 'Your Sites' ) . '

'; $output .= ''; foreach ( $blogs as $blog ) { $output .= ''; $output .= ""; $output .= ''; $output .= ''; } $output .= '
{$blog->blogname}' . __( 'Visit Dashboard' ) . ' | ' . '' . __( 'View Site' ) . '
'; wp_die( $output, 403 ); } function check_import_new_users( $permission ) { if ( ! current_user_can( 'manage_network_users' ) ) { return false; } return true; } function mu_dropdown_languages( $lang_files = array(), $current = '' ) { $flag = false; $output = array(); foreach ( (array) $lang_files as $val ) { $code_lang = basename( $val, '.mo' ); if ( 'en_US' === $code_lang ) { $flag = true; $ae = __( 'American English' ); $output[ $ae ] = ''; } elseif ( 'en_GB' === $code_lang ) { $flag = true; $be = __( 'British English' ); $output[ $be ] = ''; } else { $translated = format_code_lang( $code_lang ); $output[ $translated ] = ''; } } if ( false === $flag ) { $output[] = ''; } uksort( $output, 'strnatcasecmp' ); $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current ); echo implode( "\n\t", $output ); } function site_admin_notice() { global $wp_db_version, $pagenow; if ( ! current_user_can( 'upgrade_network' ) ) { return false; } if ( 'upgrade.php' === $pagenow ) { return; } if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) { echo "
" . sprintf( __( 'Thank you for Updating! Please visit the Upgrade Network page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . '
'; } } function avoid_blog_page_permalink_collision( $data, $postarr ) { if ( is_subdomain_install() ) { return $data; } if ( 'page' !== $data['post_type'] ) { return $data; } if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) { return $data; } if ( ! is_main_site() ) { return $data; } if ( isset( $data['post_parent'] ) && $data['post_parent'] ) { return $data; } $post_name = $data['post_name']; $c = 0; while ( $c < 10 && get_id_from_blogname( $post_name ) ) { $post_name .= mt_rand( 1, 10 ); $c++; } if ( $post_name !== $data['post_name'] ) { $data['post_name'] = $post_name; } return $data; } function choose_primary_blog() { ?> + + + + + + + + + + +

-#customize-theme-controls .customize-themes-panel h3.customize-section-title:first-child { - border-bottom: 1px solid #dcdcde; - padding: 12px; -} + +

+ +

+ -.ios #customize-theme-controls .customize-themes-panel h3.customize-section-title:first-child { - padding: 12px 12px 13px; -} +
+ + ID ) . '">' . $current_user->user_login . ''; ?> + + ID ) ) { wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) ); } if ( in_array( $delete_user->user_login, $site_admins, true ) ) { wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '' . $delete_user->user_login . '' ) ); } ?> + + + + '; } else { ?> + + + + + + +

+ +

+ +
+ + + array( 'label' => __( 'Info' ), 'url' => 'site-info.php', 'cap' => 'manage_sites', ), 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php', 'cap' => 'manage_sites', ), 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php', 'cap' => 'manage_sites', ), 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites', ), ) ); $parsed_args = wp_parse_args( $args, array( 'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info', ) ); $screen_links = array(); foreach ( $parsed_args['links'] as $link_id => $link ) { if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) { continue; } $classes = array( 'nav-tab' ); $aria_current = ''; if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) { $classes[] = 'nav-tab-active'; $aria_current = ' aria-current="page"'; } $esc_classes = implode( ' ', $classes ); $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) ); $screen_links[ $link_id ] = '' . esc_html( $link['label'] ) . ''; } echo ''; } function get_site_screen_help_tab_args() { return array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '

' . '

' . __( 'Info — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '

' . '

' . __( 'Users — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '

' . '

' . sprintf( __( 'Themes — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

' . '

' . __( 'Settings — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '

', ); } function get_site_screen_help_sidebar_content() { return '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Site Management' ) . '

' . '

' . __( 'Support Forums' ) . '

'; } post_parent !== $post->ID && $compare_from->ID !== $post->ID ) { return false; } if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) { return false; } if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) { $temp = $compare_from; $compare_from = $compare_to; $compare_to = $temp; } if ( $compare_from && empty( $compare_from->post_title ) ) { $compare_from->post_title = __( '(no title)' ); } if ( empty( $compare_to->post_title ) ) { $compare_to->post_title = __( '(no title)' ); } $return = array(); foreach ( _wp_post_revision_fields( $post ) as $field => $name ) { $content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : ''; $content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' ); $args = array( 'show_split_view' => true, 'title_left' => __( 'Removed' ), 'title_right' => __( 'Added' ), ); $args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to ); $diff = wp_text_diff( $content_from, $content_to, $args ); if ( ! $diff && 'post_title' === $field ) { $diff = ''; if ( true === $args['show_split_view'] ) { $diff .= ''; } else { $diff .= ''; if ( $compare_from->post_title !== $compare_to->post_title ) { $diff .= ''; } } $diff .= ''; $diff .= '
' . esc_html( $compare_from->post_title ) . '' . esc_html( $compare_to->post_title ) . '' . esc_html( $compare_from->post_title ) . '
' . esc_html( $compare_to->post_title ) . '
'; } if ( $diff ) { $return[] = array( 'id' => $field, 'name' => $name, 'diff' => $diff, ); } } return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to ); } function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) { $post = get_post( $post ); $authors = array(); $now_gmt = time(); $revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false, ) ); if ( ! wp_revisions_enabled( $post ) ) { foreach ( $revisions as $revision_id => $revision ) { if ( ! wp_is_post_autosave( $revision ) ) { unset( $revisions[ $revision_id ] ); } } $revisions = array( $post->ID => $post ) + $revisions; } $show_avatars = get_option( 'show_avatars' ); cache_users( wp_list_pluck( $revisions, 'post_author' ) ); $can_restore = current_user_can( 'edit_post', $post->ID ); $current_id = false; foreach ( $revisions as $revision ) { $modified = strtotime( $revision->post_modified ); $modified_gmt = strtotime( $revision->post_modified_gmt . ' +0000' ); if ( $can_restore ) { $restore_link = str_replace( '&', '&', wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore', ), admin_url( 'revision.php' ) ), "restore-post_{$revision->ID}" ) ); } if ( ! isset( $authors[ $revision->post_author ] ) ) { $authors[ $revision->post_author ] = array( 'id' => (int) $revision->post_author, 'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '', 'name' => get_the_author_meta( 'display_name', $revision->post_author ), ); } $autosave = (bool) wp_is_post_autosave( $revision ); $current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt; if ( $current && ! empty( $current_id ) ) { if ( $current_id < $revision->ID ) { $revisions[ $current_id ]['current'] = false; $current_id = $revision->ID; } else { $current = false; } } elseif ( $current ) { $current_id = $revision->ID; } $revisions_data = array( 'id' => $revision->ID, 'title' => get_the_title( $post->ID ), 'author' => $authors[ $revision->post_author ], 'date' => date_i18n( __( 'M j, Y @ H:i' ), $modified ), 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ), 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ), 'autosave' => $autosave, 'current' => $current, 'restoreUrl' => $can_restore ? $restore_link : false, ); $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post ); } if ( 1 === count( $revisions ) ) { $revisions[ $post->ID ] = array( 'id' => $post->ID, 'title' => get_the_title( $post->ID ), 'author' => $authors[ $revision->post_author ], 'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ), 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ), 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ), 'autosave' => false, 'current' => true, 'restoreUrl' => false, ); $current_id = $post->ID; } if ( empty( $current_id ) ) { if ( $revisions[ $revision->ID ]['autosave'] ) { $revision = end( $revisions ); while ( $revision['autosave'] ) { $revision = prev( $revisions ); } $current_id = $revision['id']; } else { $current_id = $revision->ID; } $revisions[ $current_id ]['current'] = true; } $compare_two_mode = is_numeric( $from ); if ( ! $compare_two_mode ) { $found = array_search( $selected_revision_id, array_keys( $revisions ), true ); if ( $found ) { $from = array_keys( array_slice( $revisions, $found - 1, 1, true ) ); $from = reset( $from ); } else { $from = 0; } } $from = absint( $from ); $diffs = array( array( 'id' => $from . ':' . $selected_revision_id, 'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ), ), ); return array( 'postId' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), 'revisionData' => array_values( $revisions ), 'to' => $selected_revision_id, 'from' => $from, 'diffData' => $diffs, 'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ), 'compareTwoMode' => absint( $compare_two_mode ), 'revisionIds' => array_keys( $revisions ), ); } function wp_print_revision_templates() { global $post; ?> -.customize-section-title h3, -h3.customize-section-title { - padding: 10px 10px 12px 14px; - margin: 0; - line-height: 21px; - color: #50575e; -} + -.accordion-sub-container.control-panel-content.busy { - display: block; -} + -.current-panel .accordion-sub-container.control-panel-content { - width: 100%; -} + -.customize-controls-close { - display: block; - position: absolute; - top: 0; - left: 0; - width: 45px; - height: 41px; - padding: 0 2px 0 0; - background: #f0f0f1; - border: none; - border-top: 4px solid #f0f0f1; - border-right: 1px solid #dcdcde; - color: #3c434a; - text-align: left; - cursor: pointer; - transition: - color .15s ease-in-out, - border-color .15s ease-in-out, - background .15s ease-in-out; - box-sizing: content-box; -} + + $cat_name, 'category_parent' => $category_parent, ) ); } function wp_create_categories( $categories, $post_id = '' ) { $cat_ids = array(); foreach ( $categories as $category ) { $id = category_exists( $category ); if ( $id ) { $cat_ids[] = $id; } else { $id = wp_create_category( $category ); if ( $id ) { $cat_ids[] = $id; } } } if ( $post_id ) { wp_set_post_categories( $post_id, $cat_ids ); } return $cat_ids; } function wp_insert_category( $catarr, $wp_error = false ) { $cat_defaults = array( 'cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '', ); $catarr = wp_parse_args( $catarr, $cat_defaults ); if ( '' === trim( $catarr['cat_name'] ) ) { if ( ! $wp_error ) { return 0; } else { return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) ); } } $catarr['cat_ID'] = (int) $catarr['cat_ID']; $update = ! empty( $catarr['cat_ID'] ); $name = $catarr['cat_name']; $description = $catarr['category_description']; $slug = $catarr['category_nicename']; $parent = (int) $catarr['category_parent']; if ( $parent < 0 ) { $parent = 0; } if ( empty( $parent ) || ! term_exists( $parent, $catarr['taxonomy'] ) || ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) { $parent = 0; } $args = compact( 'name', 'slug', 'parent', 'description' ); if ( $update ) { $catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args ); } else { $catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args ); } if ( is_wp_error( $catarr['cat_ID'] ) ) { if ( $wp_error ) { return $catarr['cat_ID']; } else { return 0; } } return $catarr['cat_ID']['term_id']; } function wp_update_category( $catarr ) { $cat_ID = (int) $catarr['cat_ID']; if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) { return false; } $category = get_term( $cat_ID, 'category', ARRAY_A ); _make_cat_compat( $category ); $category = wp_slash( $category ); $catarr = array_merge( $category, $catarr ); return wp_insert_category( $catarr ); } function tag_exists( $tag_name ) { return term_exists( $tag_name, 'post_tag' ); } function wp_create_tag( $tag_name ) { return wp_create_term( $tag_name, 'post_tag' ); } function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { return get_terms_to_edit( $post_id, $taxonomy ); } function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { $post_id = (int) $post_id; if ( ! $post_id ) { return false; } $terms = get_object_term_cache( $post_id, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post_id, $taxonomy ); wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' ); } if ( ! $terms ) { return false; } if ( is_wp_error( $terms ) ) { return $terms; } $term_names = array(); foreach ( $terms as $term ) { $term_names[] = $term->name; } $terms_to_edit = esc_attr( implode( ',', $term_names ) ); $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); return $terms_to_edit; } function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) { $id = term_exists( $tag_name, $taxonomy ); if ( $id ) { return $id; } return wp_insert_term( $tag_name, $taxonomy ); } strings['up_to_date'] = __( 'The plugin is at the latest version.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['remove_old'] = __( 'Removing the old version of the plugin…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old plugin.' ); $this->strings['process_failed'] = __( 'Plugin update failed.' ); $this->strings['process_success'] = __( 'Plugin updated successfully.' ); $this->strings['process_bulk_success'] = __( 'Plugins updated successfully.' ); } public function install_strings() { $this->strings['no_package'] = __( 'Installation package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the package…' ); $this->strings['installing_package'] = __( 'Installing the plugin…' ); $this->strings['remove_old'] = __( 'Removing the current plugin…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the current plugin.' ); $this->strings['no_files'] = __( 'The plugin contains no files.' ); $this->strings['process_failed'] = __( 'Plugin installation failed.' ); $this->strings['process_success'] = __( 'Plugin installed successfully.' ); $this->strings['process_success_specific'] = __( 'Successfully installed the plugin %1$s %2$s.' ); if ( ! empty( $this->skin->overwrite ) ) { if ( 'update-plugin' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Updating the plugin…' ); $this->strings['process_failed'] = __( 'Plugin update failed.' ); $this->strings['process_success'] = __( 'Plugin updated successfully.' ); } if ( 'downgrade-plugin' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Downgrading the plugin…' ); $this->strings['process_failed'] = __( 'Plugin downgrade failed.' ); $this->strings['process_success'] = __( 'Plugin downgraded successfully.' ); } } } public function install( $package, $args = array() ) { $defaults = array( 'clear_update_cache' => true, 'overwrite_package' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->install_strings(); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); } $this->run( array( 'package' => $package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => $parsed_args['overwrite_package'], 'clear_working' => true, 'hook_extra' => array( 'type' => 'plugin', 'action' => 'install', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 ); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); if ( $parsed_args['overwrite_package'] ) { do_action( 'upgrader_overwrote_package', $package, $this->new_plugin_data, 'plugin' ); } return true; } public function upgrade( $plugin, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); $current = get_site_transient( 'update_plugins' ); if ( ! isset( $current->response[ $plugin ] ) ) { $this->skin->before(); $this->skin->set_result( false ); $this->skin->error( 'up_to_date' ); $this->skin->after(); return false; } $r = $current->response[ $plugin ]; add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 ); add_filter( 'upgrader_pre_install', array( $this, 'active_before' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); add_filter( 'upgrader_post_install', array( $this, 'active_after' ), 10, 2 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); } $this->run( array( 'package' => $r->package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array( 'plugin' => $plugin, 'type' => 'plugin', 'action' => 'update', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 ); remove_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ) ); remove_filter( 'upgrader_pre_install', array( $this, 'active_before' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) ); remove_filter( 'upgrader_post_install', array( $this, 'active_after' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $plugin ] ) ) { unset( $past_failure_emails[ $plugin ] ); update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; } public function bulk_upgrade( $plugins, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_plugins' ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); $maintenance = ( is_multisite() && ! empty( $plugins ) ); foreach ( $plugins as $plugin ) { $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin ] ) ); } if ( $maintenance ) { $this->maintenance_mode( true ); } $results = array(); $this->update_count = count( $plugins ); $this->update_current = 0; foreach ( $plugins as $plugin ) { $this->update_current++; $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true ); if ( ! isset( $current->response[ $plugin ] ) ) { $this->skin->set_result( 'up_to_date' ); $this->skin->before(); $this->skin->feedback( 'up_to_date' ); $this->skin->after(); $results[ $plugin ] = true; continue; } $r = $current->response[ $plugin ]; $this->skin->plugin_active = is_plugin_active( $plugin ); $result = $this->run( array( 'package' => $r->package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'plugin' => $plugin, ), ) ); $results[ $plugin ] = $result; if ( false === $result ) { break; } } $this->maintenance_mode( false ); wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true, 'plugins' => $plugins, ) ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $plugin => $result ) { if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $plugin ] ) ) { continue; } unset( $past_failure_emails[ $plugin ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } public function check_package( $source ) { global $wp_filesystem, $wp_version; $this->new_plugin_data = array(); if ( is_wp_error( $source ) ) { return $source; } $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { return $source; } $files = glob( $working_directory . '*.php' ); if ( $files ) { foreach ( $files as $file ) { $info = get_plugin_data( $file, false, false ); if ( ! empty( $info['Name'] ) ) { $this->new_plugin_data = $info; break; } } } if ( empty( $this->new_plugin_data ) ) { return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) ); } $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), phpversion(), $requires_php ); return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), $wp_version, $requires_wp ); return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); } return $source; } public function plugin_info() { if ( ! is_array( $this->result ) ) { return false; } if ( empty( $this->result['destination_name'] ) ) { return false; } $plugin = get_plugins( '/' . $this->result['destination_name'] ); if ( empty( $plugin ) ) { return false; } $pluginfiles = array_keys( $plugin ); return $this->result['destination_name'] . '/' . $pluginfiles[0]; } public function deactivate_plugin_before_upgrade( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( empty( $plugin ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } if ( is_plugin_active( $plugin ) ) { deactivate_plugins( $plugin, true ); } return $response; } public function active_before( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( ! wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( ! is_plugin_active( $plugin ) ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( true ); } return $response; } public function active_after( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( ! wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( ! is_plugin_active( $plugin ) ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( false ); } return $response; } public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) { global $wp_filesystem; if ( is_wp_error( $removed ) ) { return $removed; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( empty( $plugin ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } $plugins_dir = $wp_filesystem->wp_plugins_dir(); $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin ) ); if ( ! $wp_filesystem->exists( $this_plugin_dir ) ) { return $removed; } if ( strpos( $plugin, '/' ) && $this_plugin_dir !== $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { $deleted = $wp_filesystem->delete( $plugins_dir . $plugin ); } if ( ! $deleted ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } return true; } } $plugin_name, 'policy_text' => $policy_text, ); if ( ! in_array( $data, self::$policy_content, true ) ) { self::$policy_content[] = $data; } } public static function text_change_check() { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( empty( $policy_page_id ) ) { return false; } if ( ! current_user_can( 'edit_post', $policy_page_id ) ) { return false; } $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); if ( empty( $old ) ) { return false; } $cached = get_option( '_wp_suggested_policy_text_has_changed' ); if ( ! did_action( 'admin_init' ) ) { return 'changed' === $cached; } $new = self::$policy_content; foreach ( $old as $key => $data ) { if ( ! is_array( $data ) || ! empty( $data['removed'] ) ) { unset( $old[ $key ] ); continue; } $old[ $key ] = array( 'plugin_name' => $data['plugin_name'], 'policy_text' => $data['policy_text'], ); } sort( $old ); sort( $new ); if ( $new != $old ) { add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) ); $state = 'changed'; } else { $state = 'not-changed'; } if ( $cached !== $state ) { update_option( '_wp_suggested_policy_text_has_changed', $state ); } return 'changed' === $state; } public static function policy_text_changed_notice() { global $post; $screen = get_current_screen()->id; if ( 'privacy' !== $screen ) { return; } ?> +
+

+ review the guide and update your privacy policy.' ), esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) ) ); ?> +

+
+ $old_data ) { if ( ! empty( $old_data['removed'] ) ) { $update_cache = true; continue; } if ( ! empty( $old_data['updated'] ) ) { $done[] = array( 'plugin_name' => $old_data['plugin_name'], 'policy_text' => $old_data['policy_text'], 'added' => $old_data['updated'], ); $update_cache = true; } else { $done[] = $old_data; } } if ( $update_cache ) { delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); foreach ( $done as $data ) { add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data ); } } } public static function get_suggested_policy_text() { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); $checked = array(); $time = time(); $update_cache = false; $new = self::$policy_content; $old = array(); if ( $policy_page_id ) { $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); } foreach ( $new as $new_key => $new_data ) { foreach ( $old as $old_key => $old_data ) { $found = false; if ( $new_data['policy_text'] === $old_data['policy_text'] ) { if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) { $old_data['plugin_name'] = $new_data['plugin_name']; $update_cache = true; } if ( ! empty( $old_data['removed'] ) ) { unset( $old_data['removed'] ); $old_data['added'] = $time; $update_cache = true; } $checked[] = $old_data; $found = true; } elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) { $checked[] = array( 'plugin_name' => $new_data['plugin_name'], 'policy_text' => $new_data['policy_text'], 'updated' => $time, ); $found = true; $update_cache = true; } if ( $found ) { unset( $new[ $new_key ], $old[ $old_key ] ); continue 2; } } } if ( ! empty( $new ) ) { foreach ( $new as $new_data ) { if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) { $new_data['added'] = $time; $checked[] = $new_data; } } $update_cache = true; } if ( ! empty( $old ) ) { foreach ( $old as $old_data ) { if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) { $data = array( 'plugin_name' => $old_data['plugin_name'], 'policy_text' => $old_data['policy_text'], 'removed' => $time, ); $checked[] = $data; } } $update_cache = true; } if ( $update_cache && $policy_page_id ) { delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); foreach ( $checked as $data ) { add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data ); } } return $checked; } public static function notice( $post = null ) { if ( is_null( $post ) ) { global $post; } else { $post = get_post( $post ); } if ( ! ( $post instanceof WP_Post ) ) { return; } if ( ! current_user_can( 'manage_privacy_options' ) ) { return; } $current_screen = get_current_screen(); $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) { return; } $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' ); $url = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); $label = __( 'View Privacy Policy Guide.' ); if ( get_current_screen()->is_block_editor() ) { wp_enqueue_script( 'wp-notices' ); $action = array( 'url' => $url, 'label' => $label, ); wp_add_inline_script( 'wp-notices', sprintf( 'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )', $message, wp_json_encode( $action ) ), 'after' ); } else { ?> +
+

+ %s %s', $url, $label, __( '(opens in a new tab)' ) ); ?> +

+
+

' . sprintf( $removed, $date ) . '

'; } elseif ( ! empty( $section['updated'] ) ) { $badge_class = ' blue'; $date = date_i18n( $date_format, $section['updated'] ); $badge_title = sprintf( __( 'Updated %s.' ), $date ); } $plugin_name = esc_html( $section['plugin_name'] ); $sanitized_policy_name = sanitize_title_with_dashes( $plugin_name ); ?> +

+ +

+ + ' . __( 'Suggested text:' ) . ' '; $content = ''; $strings = array(); if ( $description ) { $strings[] = '
'; } $strings[] = '

' . __( 'Who we are' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '

'; $strings[] = '

' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '

'; } else { $strings[] = '

' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'What personal data we collect and why we collect it' ) . '

'; $strings[] = '

' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '

'; $strings[] = '

' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '

'; $strings[] = '

' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '

'; $strings[] = '

' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '

'; $strings[] = '

' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '

'; } $strings[] = '

' . __( 'Comments' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '

'; $strings[] = '

' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '

'; } $strings[] = '

' . __( 'Media' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'Contact forms' ) . '

'; $strings[] = '

' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '

'; } $strings[] = '

' . __( 'Cookies' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '

'; $strings[] = '

' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '

'; $strings[] = '

' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '

'; $strings[] = '

' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '

'; } if ( ! $description ) { $strings[] = '

' . __( 'Embedded content from other websites' ) . '

'; $strings[] = '

' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '

'; $strings[] = '

' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'Analytics' ) . '

'; $strings[] = '

' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider’s privacy policy, if any.' ) . '

'; $strings[] = '

' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '

'; } $strings[] = '

' . __( 'Who we share your data with' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '

'; $strings[] = '

' . __( 'By default WordPress does not share any personal data with anyone.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '

'; } $strings[] = '

' . __( 'How long we retain your data' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '

'; $strings[] = '

' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '

'; } $strings[] = '

' . __( 'What rights you have over your data' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '

'; } $strings[] = '

' . __( 'Where your data is sent' ) . '

'; if ( $description ) { $strings[] = '

' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '

'; $strings[] = '

' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '

'; } else { $strings[] = '

' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'Contact information' ) . '

'; $strings[] = '

' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'Additional information' ) . '

'; $strings[] = '

' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'How we protect your data' ) . '

'; $strings[] = '

' . __( 'In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'What data breach procedures we have in place' ) . '

'; $strings[] = '

' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'What third parties we receive data from' ) . '

'; $strings[] = '

' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'What automated decision making and/or profiling we do with user data' ) . '

'; $strings[] = '

' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '

'; } if ( $description ) { $strings[] = '

' . __( 'Industry regulatory disclosure requirements' ) . '

'; $strings[] = '

' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '

'; $strings[] = '
'; } if ( $blocks ) { foreach ( $strings as $key => $string ) { if ( 0 === strpos( $string, '

' ) ) { $strings[ $key ] = '' . $string . ''; } if ( 0 === strpos( $string, '

' ) ) { $strings[ $key ] = '' . $string . ''; } } } $content = implode( '', $strings ); return apply_filters_deprecated( 'wp_get_default_privacy_policy_content', array( $content, $strings, $description, $blocks ), '5.7.0', 'wp_add_privacy_policy_content()' ); } public static function add_suggested_content() { $content = self::get_default_content( false, false ); wp_add_privacy_policy_content( __( 'WordPress' ), $content ); } } upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' ); } public function before( $title = '' ) { parent::before( $this->plugin_info['Title'] ); } public function after( $title = '' ) { parent::after( $this->plugin_info['Title'] ); $this->decrement_update_count( 'plugin' ); } public function bulk_footer() { parent::bulk_footer(); $update_actions = array( 'plugins_page' => sprintf( '%s', self_admin_url( 'plugins.php' ), __( 'Go to Plugins page' ) ), 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), __( 'Go to WordPress Updates page' ) ), ); if ( ! current_user_can( 'activate_plugins' ) ) { unset( $update_actions['plugins_page'] ); } $update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } 'latest' ); } return $updates[0]; } function get_core_updates( $options = array() ) { $options = array_merge( array( 'available' => true, 'dismissed' => false, ), $options ); $dismissed = get_site_option( 'dismissed_update_core' ); if ( ! is_array( $dismissed ) ) { $dismissed = array(); } $from_api = get_site_transient( 'update_core' ); if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { return false; } $updates = $from_api->updates; $result = array(); foreach ( $updates as $update ) { if ( 'autoupdate' === $update->response ) { continue; } if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) { if ( $options['dismissed'] ) { $update->dismissed = true; $result[] = $update; } } else { if ( $options['available'] ) { $update->dismissed = false; $result[] = $update; } } } return $result; } function find_core_auto_update() { $updates = get_site_transient( 'update_core' ); if ( ! $updates || empty( $updates->updates ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $auto_update = false; $upgrader = new WP_Automatic_Updater; foreach ( $updates->updates as $update ) { if ( 'autoupdate' !== $update->response ) { continue; } if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) { continue; } if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) { $auto_update = $update; } } return $auto_update; } function get_core_checksums( $version, $locale ) { $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' ); $url = $http_url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $options = array( 'timeout' => wp_doing_cron() ? 30 : 3, ); $response = wp_remote_get( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $response = wp_remote_get( $http_url, $options ); } if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { return false; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) { return false; } return $body['checksums']; } function dismiss_core_update( $update ) { $dismissed = get_site_option( 'dismissed_update_core' ); $dismissed[ $update->current . '|' . $update->locale ] = true; return update_site_option( 'dismissed_update_core', $dismissed ); } function undismiss_core_update( $version, $locale ) { $dismissed = get_site_option( 'dismissed_update_core' ); $key = $version . '|' . $locale; if ( ! isset( $dismissed[ $key ] ) ) { return false; } unset( $dismissed[ $key ] ); return update_site_option( 'dismissed_update_core', $dismissed ); } function find_core_update( $version, $locale ) { $from_api = get_site_transient( 'update_core' ); if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { return false; } $updates = $from_api->updates; foreach ( $updates as $update ) { if ( $update->current == $version && $update->locale == $locale ) { return $update; } } return false; } function core_update_footer( $msg = '' ) { if ( ! current_user_can( 'update_core' ) ) { return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); } $cur = get_preferred_from_update_core(); if ( ! is_object( $cur ) ) { $cur = new stdClass; } if ( ! isset( $cur->current ) ) { $cur->current = ''; } if ( ! isset( $cur->response ) ) { $cur->response = ''; } require ABSPATH . WPINC . '/version.php'; $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); if ( $is_development_version ) { return sprintf( __( 'You are using a development version (%1$s). Cool! Please stay updated.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) ); } switch ( $cur->response ) { case 'upgrade': return sprintf( '%s', network_admin_url( 'update-core.php' ), sprintf( __( 'Get Version %s' ), $cur->current ) ); case 'latest': default: return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); } } function update_nag() { global $pagenow; if ( is_multisite() && ! current_user_can( 'update_core' ) ) { return false; } if ( 'update-core.php' === $pagenow ) { return; } $cur = get_preferred_from_update_core(); if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) { return false; } $version_url = sprintf( esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), sanitize_title( $cur->current ) ); if ( current_user_can( 'update_core' ) ) { $msg = sprintf( __( 'WordPress %2$s is available! Please update now.' ), $version_url, $cur->current, network_admin_url( 'update-core.php' ), esc_attr__( 'Please update WordPress now' ) ); } else { $msg = sprintf( __( 'WordPress %2$s is available! Please notify the site administrator.' ), $version_url, $cur->current ); } echo "
$msg
"; } function update_right_now_message() { $theme_name = wp_get_theme(); if ( current_user_can( 'switch_themes' ) ) { $theme_name = sprintf( '%1$s', $theme_name ); } $msg = ''; if ( current_user_can( 'update_core' ) ) { $cur = get_preferred_from_update_core(); if ( isset( $cur->response ) && 'upgrade' === $cur->response ) { $msg .= sprintf( '%s ', network_admin_url( 'update-core.php' ), sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) ); } } $content = __( 'WordPress %1$s running %2$s theme.' ); $content = apply_filters( 'update_right_now_text', $content ); $msg .= sprintf( '' . $content . '', get_bloginfo( 'version', 'display' ), $theme_name ); echo "

$msg

"; } function get_plugin_updates() { $all_plugins = get_plugins(); $upgrade_plugins = array(); $current = get_site_transient( 'update_plugins' ); foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) { if ( isset( $current->response[ $plugin_file ] ) ) { $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; } } return $upgrade_plugins; } function wp_plugin_update_rows() { if ( ! current_user_can( 'update_plugins' ) ) { return; } $plugins = get_site_transient( 'update_plugins' ); if ( isset( $plugins->response ) && is_array( $plugins->response ) ) { $plugins = array_keys( $plugins->response ); foreach ( $plugins as $plugin_file ) { add_action( "after_plugin_row_{$plugin_file}", 'wp_plugin_update_row', 10, 2 ); } } } function wp_plugin_update_row( $file, $plugin_data ) { $current = get_site_transient( 'update_plugins' ); if ( ! isset( $current->response[ $file ] ) ) { return false; } $response = $current->response[ $file ]; $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'em' => array(), 'strong' => array(), ); $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags ); $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id; if ( isset( $response->slug ) ) { $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '§ion=changelog' ); } elseif ( isset( $response->url ) ) { $details_url = $response->url; } else { $details_url = $plugin_data['PluginURI']; } $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 600, 'height' => 800, ), $details_url ); $wp_list_table = _get_list_table( 'WP_Plugins_List_Table', array( 'screen' => get_current_screen(), ) ); if ( is_network_admin() || ! is_multisite() ) { if ( is_network_admin() ) { $active_class = is_plugin_active_for_network( $file ) ? ' active' : ''; } else { $active_class = is_plugin_active( $file ) ? ' active' : ''; } $requires_php = isset( $response->requires_php ) ? $response->requires_php : null; $compatible_php = is_php_version_compatible( $requires_php ); $notice_type = $compatible_php ? 'notice-warning' : 'notice-error'; printf( '' . '' . '

', $active_class, esc_attr( $plugin_slug . '-update' ), esc_attr( $plugin_slug ), esc_attr( $file ), esc_attr( $wp_list_table->get_column_count() ), $notice_type ); if ( ! current_user_can( 'update_plugins' ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ) ); } elseif ( empty( $response->package ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ) ); } else { if ( $compatible_php ) { printf( __( 'There is a new version of %1$s available. View version %4$s details or update now.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ), wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ), sprintf( 'class="update-link" aria-label="%s"', esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) ) ) ); } else { printf( __( 'There is a new version of %1$s available, but it does not work with your version of PHP. View version %4$s details or learn more about updating PHP.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '
', '' ); } } do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); echo '

'; } } function get_theme_updates() { $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response ) ) { return array(); } $update_themes = array(); foreach ( $current->response as $stylesheet => $data ) { $update_themes[ $stylesheet ] = wp_get_theme( $stylesheet ); $update_themes[ $stylesheet ]->update = $data; } return $update_themes; } function wp_theme_update_rows() { if ( ! current_user_can( 'update_themes' ) ) { return; } $themes = get_site_transient( 'update_themes' ); if ( isset( $themes->response ) && is_array( $themes->response ) ) { $themes = array_keys( $themes->response ); foreach ( $themes as $theme ) { add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 ); } } } function wp_theme_update_row( $theme_key, $theme ) { $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme_key ] ) ) { return false; } $response = $current->response[ $theme_key ]; $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $current->response[ $theme_key ]['url'] ); $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); $active = $theme->is_allowed( 'network' ) ? ' active' : ''; $requires_wp = isset( $response['requires'] ) ? $response['requires'] : null; $requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null; $compatible_wp = is_wp_version_compatible( $requires_wp ); $compatible_php = is_php_version_compatible( $requires_php ); printf( '' . '' . '

', $active, esc_attr( $theme->get_stylesheet() . '-update' ), esc_attr( $theme->get_stylesheet() ), $wp_list_table->get_column_count() ); if ( $compatible_wp && $compatible_php ) { if ( ! current_user_can( 'update_themes' ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } elseif ( empty( $response['package'] ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } else { printf( __( 'There is a new version of %1$s available. View version %4$s details or update now.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'], wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ), sprintf( 'class="update-link" aria-label="%s"', esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) ) ) ); } } else { if ( ! $compatible_wp && ! $compatible_php ) { printf( __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), $theme['Name'] ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

', '' ); } } elseif ( ! $compatible_wp ) { printf( __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), $theme['Name'] ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { printf( __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), $theme['Name'] ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

', '' ); } } } do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); echo '

'; } function maintenance_nag() { require ABSPATH . WPINC . '/version.php'; global $upgrading; $nag = isset( $upgrading ); if ( ! $nag ) { $failed = get_site_option( 'auto_core_update_failed' ); $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) { $nag = true; } } if ( ! $nag ) { return false; } if ( current_user_can( 'update_core' ) ) { $msg = sprintf( __( 'An automated WordPress update has failed to complete - please attempt the update again now.' ), 'update-core.php' ); } else { $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' ); } echo "
$msg
"; } function wp_print_admin_notice_templates() { ?> + + + + + + +
+

+ Exit Recovery Mode' ), esc_url( $url ) ); ?> +

+
+ is_disabled(); switch ( $type ) { case 'plugin': return apply_filters( 'plugins_auto_update_enabled', $enabled ); case 'theme': return apply_filters( 'themes_auto_update_enabled', $enabled ); } return false; } function wp_is_auto_update_forced_for_item( $type, $update, $item ) { return apply_filters( "auto_update_{$type}", $update, $item ); } function wp_get_auto_update_message() { $next_update_time = wp_next_scheduled( 'wp_version_check' ); if ( false === $next_update_time ) { $message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' ); } else { $time_to_next_update = human_time_diff( (int) $next_update_time ); $overdue = ( time() - $next_update_time ) > 0; if ( $overdue ) { $message = sprintf( __( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ), $time_to_next_update ); } else { $message = sprintf( __( 'Automatic update scheduled in %s.' ), $time_to_next_update ); } } return $message; } features = $_REQUEST['features']; } $paged = $this->get_pagenum(); $per_page = 36; $tabs = array(); $tabs['dashboard'] = __( 'Search' ); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } $tabs['upload'] = __( 'Upload' ); $tabs['featured'] = _x( 'Featured', 'themes' ); $tabs['new'] = _x( 'Latest', 'themes' ); $tabs['updated'] = _x( 'Recently Updated', 'themes' ); $nonmenu_tabs = array( 'theme-information' ); $tabs = apply_filters( 'install_themes_tabs', $tabs ); $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults, ); switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; switch ( $type ) { case 'tag': $args['tag'] = array_map( 'sanitize_key', $search_terms ); break; case 'term': $args['search'] = $search_string; break; case 'author': $args['author'] = $search_string; break; } if ( ! empty( $this->features ) ) { $args['tag'] = $this->features; $_REQUEST['s'] = implode( ',', $this->features ); $_REQUEST['type'] = 'tag'; } add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); break; case 'featured': case 'new': case 'updated': $args['browse'] = $tab; break; default: $args = false; break; } $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); if ( ! $args ) { return; } $api = themes_api( 'query_themes', $args ); if ( is_wp_error( $api ) ) { wp_die( '

' . $api->get_error_message() . '

' . __( 'Try Again' ) . '

' ); } $this->items = $api->themes; $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $args['per_page'], 'infinite_scroll' => true, ) ); } public function no_items() { _e( 'No themes match your request.' ); } protected function get_views() { global $tabs, $tab; $display_tabs = array(); foreach ( (array) $tabs as $action => $text ) { $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; $href = self_admin_url( 'theme-install.php?tab=' . $action ); $display_tabs[ 'theme-install-' . $action ] = "$text"; } return $display_tabs; } public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); ?> +
+
+ +
+ pagination( 'top' ); ?> +
+
-.customize-panel-back, -.customize-section-back { - display: block; - float: left; - width: 48px; - height: 71px; - padding: 0 24px 0 0; - margin: 0; - background: #fff; - border: none; - border-right: 1px solid #dcdcde; - border-left: 4px solid #fff; - box-shadow: none; - cursor: pointer; - transition: - color .15s ease-in-out, - border-color .15s ease-in-out, - background .15s ease-in-out; -} +
+ display_rows_or_placeholder(); ?> +
-.customize-section-back { - height: 74px; -} + tablenav( 'bottom' ); } public function display_rows() { $themes = $this->items; foreach ( $themes as $theme ) { ?> +
+ single_row( $theme ); ?> +
+ theme_installer(); } public function single_row( $theme ) { global $themes_allowedtags; if ( empty( $theme ) ) { return; } $name = wp_kses( $theme->name, $themes_allowedtags ); $author = wp_kses( $theme->author, $themes_allowedtags ); $preview_title = sprintf( __( 'Preview “%s”' ), $name ); $preview_url = add_query_arg( array( 'tab' => 'theme-information', 'theme' => $theme->slug, ), self_admin_url( 'theme-install.php' ) ); $actions = array(); $install_url = add_query_arg( array( 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $update_url = add_query_arg( array( 'action' => 'upgrade-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $status = $this->_get_theme_status( $theme ); switch ( $status ) { case 'update_available': $actions[] = sprintf( '%s', esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), __( 'Update' ) ); break; case 'newer_installed': case 'latest_installed': $actions[] = sprintf( '%s', esc_attr__( 'This theme is already installed and is up to date' ), _x( 'Installed', 'theme' ) ); break; case 'install': default: $actions[] = sprintf( '%s', esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), __( 'Install Now' ) ); break; } $actions[] = sprintf( '%s', esc_url( $preview_url ), esc_attr( sprintf( __( 'Preview %s' ), $name ) ), __( 'Preview' ) ); $actions = apply_filters( 'theme_install_actions', $actions, $theme ); ?> + + + -.ios .customize-panel-back { - display: none; -} +

+
+ +
-.ios .expanded.in-sub-panel .customize-panel-back { - display: block; -} + -#customize-controls .panel-meta.customize-info .accordion-section-title { - margin-left: 48px; - border-left: none; -} + install_theme_info( $theme ); } public function theme_installer() { ?> +
+
+
+ + +
+
+
+
+ +
+
+
+ +
+
+ install_theme_info( $theme ); ?> +
+
+ +
+
+ name, $themes_allowedtags ); $author = wp_kses( $theme->author, $themes_allowedtags ); $install_url = add_query_arg( array( 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $update_url = add_query_arg( array( 'action' => 'upgrade-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $status = $this->_get_theme_status( $theme ); ?> +
+ %s', esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), __( 'Update' ) ); break; case 'newer_installed': case 'latest_installed': printf( '%s', esc_attr__( 'This theme is already installed and is up to date' ), _x( 'Installed', 'theme' ) ); break; case 'install': default: printf( '%s', esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), __( 'Install' ) ); break; } ?> +

+ + + + screenshot_url ) ) : ?> + + +
+ $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, ) ); ?> +
+ + version, $themes_allowedtags ); ?> +
+
+ description, $themes_allowedtags ); ?> +
+
+ +
+ slug ); if ( $installed_theme->exists() ) { if ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '=' ) ) { $status = 'latest_installed'; } elseif ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '>' ) ) { $status = 'newer_installed'; } else { $status = 'update_available'; } } return $status; } } cap->create_posts ) ) { $quick_draft_title = sprintf( '%1$s %2$s', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) ); wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); } wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); if ( is_network_admin() ) { do_action( 'wp_network_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); } elseif ( is_user_admin() ) { do_action( 'wp_user_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() ); } else { do_action( 'wp_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); } foreach ( $dashboard_widgets as $widget_id ) { $name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " " . __( 'View all' ) . ''; wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] ); } if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) { check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); ob_start(); wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); ob_end_clean(); wp_redirect( remove_query_arg( 'edit' ) ); exit; } do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); do_action( 'do_meta_boxes', $screen->id, 'side', '' ); } function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) { global $wp_dashboard_control_callbacks; $screen = get_current_screen(); $private_callback_args = array( '__widget_basename' => $widget_name ); if ( is_null( $callback_args ) ) { $callback_args = $private_callback_args; } elseif ( is_array( $callback_args ) ) { $callback_args = array_merge( $callback_args, $private_callback_args ); } if ( $control_callback && is_callable( $control_callback ) && current_user_can( 'edit_dashboard' ) ) { $wp_dashboard_control_callbacks[ $widget_id ] = $control_callback; if ( isset( $_GET['edit'] ) && $widget_id === $_GET['edit'] ) { list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); $widget_name .= ' ' . __( 'Cancel' ) . ''; $callback = '_wp_dashboard_control_callback'; } else { list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); $widget_name .= ' ' . __( 'Configure' ) . ''; } } $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); if ( in_array( $widget_id, $side_widgets, true ) ) { $context = 'side'; } $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' ); if ( in_array( $widget_id, $high_priority_widgets, true ) ) { $priority = 'high'; } if ( empty( $context ) ) { $context = 'normal'; } if ( empty( $priority ) ) { $priority = 'core'; } add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args ); } function _wp_dashboard_control_callback( $dashboard, $meta_box ) { echo '
'; wp_dashboard_trigger_widget_control( $meta_box['id'] ); wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); echo ''; submit_button( __( 'Save Changes' ) ); echo '
'; } function wp_dashboard() { $screen = get_current_screen(); $columns = absint( $screen->get_columns() ); $columns_css = ''; if ( $columns ) { $columns_css = " columns-$columns"; } ?> +
+
+ id, 'normal', '' ); ?> +
+
+ id, 'side', '' ); ?> +
+
+ id, 'column3', '' ); ?> +
+
+ id, 'column4', '' ); ?> +
+
-#customize-controls .panel-meta.customize-info .accordion-section-title:hover, -#customize-controls .cannot-expand:hover .accordion-section-title { - background: #fff; - color: #50575e; - border-left-color: #fff; -} - -.customize-controls-close:focus, -.customize-controls-close:hover, -.customize-controls-preview-toggle:focus, -.customize-controls-preview-toggle:hover { - background: #fff; - color: #2271b1; - border-top-color: #2271b1; - box-shadow: none; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -#customize-theme-controls .accordion-section-title:focus .customize-action { - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; - outline-offset: 1px; -} - -.customize-panel-back:hover, -.customize-panel-back:focus, -.customize-section-back:hover, -.customize-section-back:focus { - color: #2271b1; - background: #f6f7f7; - border-left-color: #2271b1; - box-shadow: none; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -.customize-controls-close:before { - font: normal 22px/45px dashicons; - content: "\f335"; - position: relative; - top: -3px; - left: 13px; -} - -.customize-panel-back:before, -.customize-section-back:before { - font: normal 20px/72px dashicons; - content: "\f341"; - position: relative; - left: 9px; -} - -.wp-full-overlay-sidebar .wp-full-overlay-header { - background-color: #f0f0f1; - transition: padding ease-in-out .18s; -} + +
+
    + publish ) { if ( 'post' === $post_type ) { $text = _n( '%s Post', '%s Posts', $num_posts->publish ); } else { $text = _n( '%s Page', '%s Pages', $num_posts->publish ); } $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { printf( '
  • %2$s
  • ', $post_type, $text ); } else { printf( '
  • %2$s
  • ', $post_type, $text ); } } } $num_comm = wp_count_comments(); if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); ?> +
  • + +
  • + moderated ); $text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n ); ?> +
  • + +
  • + ' . implode( "\n
  • ", $elements ) . "
  • \n"; } ?> +
+ $content

"; } ?> +
+ +
+ +
+ ' . __( 'Create a New Site' ) . ''; } if ( current_user_can( 'create_users' ) ) { $actions['create-user'] = '' . __( 'Create a New User' ) . ''; } $c_users = get_user_count(); $c_blogs = get_blog_count(); $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); if ( $actions ) { echo '
    '; foreach ( $actions as $class => $action ) { $actions[ $class ] = "\t
  • $action"; } echo implode( " |
  • \n", $actions ) . "\n"; echo '
'; } ?> +
-.in-sub-panel .wp-full-overlay-sidebar .wp-full-overlay-header { - padding-left: 62px; -} +

-p.customize-section-description { - font-style: normal; - margin-top: 22px; - margin-bottom: 0; -} -.customize-section-description ul { - margin-left: 1em; -} + -.customize-section-description ul > li { - list-style: disc; -} +
+

+ + + 'submit_users' ) ); ?> +

+
-.section-description-buttons { - text-align: right; -} +
+

+ + + 'submit_sites' ) ); ?> +

+
+ post_status ) { $post = get_default_post_to_edit( 'post', true ); update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); } else { $post->post_title = ''; } } else { $post = get_default_post_to_edit( 'post', true ); $user_id = get_current_user_id(); if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) { update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); } } $post_ID = (int) $post->ID; ?> -.customize-control { - width: 100%; - float: left; - clear: both; - margin-bottom: 12px; -} +
-.customize-control input[type="text"], -.customize-control input[type="password"], -.customize-control input[type="email"], -.customize-control input[type="number"], -.customize-control input[type="search"], -.customize-control input[type="tel"], -.customize-control input[type="url"], -.customize-control input[type="range"] { - width: 100%; - margin: 0; -} + +
+ -.customize-control-hidden { - margin: 0; -} +
+ + +
-.customize-control-textarea textarea { - width: 100%; - resize: vertical; -} +
+ + +
-.customize-control select { - width: 100%; -} +

+ + + + + 'save-post' ) ); ?> +
+

-.customize-control select[multiple] { - height: auto; -} +
+ 'post', 'post_status' => 'draft', 'author' => get_current_user_id(), 'posts_per_page' => 4, 'orderby' => 'modified', 'order' => 'DESC', ); $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); $drafts = get_posts( $query_args ); if ( ! $drafts ) { return; } } echo '
'; if ( count( $drafts ) > 3 ) { printf( '

%s

' . "\n", esc_url( admin_url( 'edit.php?post_status=draft' ) ), __( 'View all drafts' ) ); } echo '

' . __( 'Your Recent Drafts' ) . "

\n"; echo '
    '; $draft_length = (int) _x( '10', 'draft_length' ); $drafts = array_slice( $drafts, 0, 3 ); foreach ( $drafts as $draft ) { $url = get_edit_post_link( $draft->ID ); $title = _draft_or_post_title( $draft->ID ); echo "
  • \n"; printf( '
    %s
    ', esc_url( $url ), esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), esc_html( $title ), get_the_time( 'c', $draft ), get_the_time( __( 'F j, Y' ), $draft ) ); $the_content = wp_trim_words( $draft->post_content, $draft_length ); if ( $the_content ) { echo '

    ' . $the_content . '

    '; } echo "
  • \n"; } echo "
\n"; echo '
'; } function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $GLOBALS['comment'] = clone $comment; if ( $comment->comment_post_ID > 0 ) { $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = '' . $comment_post_title . ''; } else { $comment_post_link = ''; } $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'edit' => '', 'spam' => '', 'trash' => '', 'delete' => '', 'view' => '', ); $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $actions['approve'] = sprintf( '%s', $approve_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '%s', $unapprove_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); $actions['edit'] = sprintf( '%s', "comment.php?action=editcomment&c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $actions['reply'] = sprintf( '', $comment->comment_ID, $comment->comment_post_ID, esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); $actions['spam'] = sprintf( '%s', $spam_url, "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), _x( 'Spam', 'verb' ) ); if ( ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', $delete_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Delete this comment permanently' ), __( 'Delete Permanently' ) ); } else { $actions['trash'] = sprintf( '%s', $trash_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Move this comment to the Trash' ), _x( 'Trash', 'verb' ) ); } $actions['view'] = sprintf( '%s', esc_url( get_comment_link( $comment ) ), esc_attr__( 'View this comment' ), __( 'View' ) ); $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { $sep = ''; } else { $sep = ' | '; } if ( 'reply' === $action || 'quickedit' === $action ) { $action .= ' hide-if-no-js'; } if ( 'view' === $action && '1' !== $comment->comment_approved ) { $action .= ' hidden'; } $actions_string .= "$sep$link"; } } ?> -.customize-control-title { - display: block; - font-size: 14px; - line-height: 1.75; - font-weight: 600; - margin-bottom: 4px; -} +
  • > -.customize-control-description { - display: block; - font-style: italic; - line-height: 1.4; - margin-top: 0; - margin-bottom: 5px; -} + -.customize-section-description a.external-link:after { - font: 16px/11px dashicons; - content: "\f504"; - top: 3px; - position: relative; - padding-left: 3px; - display: inline-block; - text-decoration: none; -} + comment_type || 'comment' === $comment->comment_type ) : ?> -.customize-control-color .color-picker, -.customize-control-upload div { - line-height: 28px; -} +
    +

    + ' . get_comment_author_link( $comment ) . '', $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( __( 'From %1$s %2$s' ), '' . get_comment_author_link( $comment ) . '', '' . __( '[Pending]' ) . '' ); } ?> +

    -.customize-control .customize-inside-control-row { - line-height: 1.6; - display: block; - margin-left: 24px; - padding-top: 6px; - padding-bottom: 6px; -} + comment_type ) { case 'pingback': $type = __( 'Pingback' ); break; case 'trackback': $type = __( 'Trackback' ); break; default: $type = ucwords( $comment->comment_type ); } $type = esc_html( $type ); ?> +
    +

    + $type", $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( _x( '%1$s %2$s', 'dashboard' ), "$type", '' . __( '[Pending]' ) . '' ); } ?> +

    +

    -.customize-control-radio input, -.customize-control-checkbox input, -.customize-control-nav_menu_auto_add input { - margin-right: 4px; - margin-left: -24px; -} + +

    + +

    + +
    +
  • + '; $future_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'future', 'order' => 'ASC', 'title' => __( 'Publishing Soon' ), 'id' => 'future-posts', ) ); $recent_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'publish', 'order' => 'DESC', 'title' => __( 'Recently Published' ), 'id' => 'published-posts', ) ); $recent_comments = wp_dashboard_recent_comments(); if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) { echo '
    '; echo '

    ' . __( 'No activity yet!' ) . '

    '; echo '
    '; } echo '
    '; } function wp_dashboard_recent_posts( $args ) { $query_args = array( 'post_type' => 'post', 'post_status' => $args['status'], 'orderby' => 'date', 'order' => $args['order'], 'posts_per_page' => (int) $args['max'], 'no_found_rows' => true, 'cache_results' => false, 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable', ); $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args ); $posts = new WP_Query( $query_args ); if ( $posts->have_posts() ) { echo '
    '; echo '

    ' . $args['title'] . '

    '; echo '
      '; $today = current_time( 'Y-m-d' ); $tomorrow = current_datetime()->modify( '+1 day' )->format( 'Y-m-d' ); $year = current_time( 'Y' ); while ( $posts->have_posts() ) { $posts->the_post(); $time = get_the_time( 'U' ); if ( gmdate( 'Y-m-d', $time ) === $today ) { $relative = __( 'Today' ); } elseif ( gmdate( 'Y-m-d', $time ) === $tomorrow ) { $relative = __( 'Tomorrow' ); } elseif ( gmdate( 'Y', $time ) !== $year ) { $relative = date_i18n( __( 'M jS Y' ), $time ); } else { $relative = date_i18n( __( 'M jS' ), $time ); } $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink(); $draft_or_post_title = _draft_or_post_title(); printf( '
    • %1$s %4$s
    • ', sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ), $recent_post_link, esc_attr( sprintf( __( 'Edit “%s”' ), $draft_or_post_title ) ), $draft_or_post_title ); } echo '
    '; echo '
    '; } else { return false; } wp_reset_postdata(); return true; } function wp_dashboard_recent_comments( $total_items = 5 ) { $comments = array(); $comments_query = array( 'number' => $total_items * 5, 'offset' => 0, ); if ( ! current_user_can( 'edit_posts' ) ) { $comments_query['status'] = 'approve'; } while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { if ( ! is_array( $possible ) ) { break; } foreach ( $possible as $comment ) { if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) { continue; } $comments[] = $comment; if ( count( $comments ) === $total_items ) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; } if ( $comments ) { echo '
    '; echo '

    ' . __( 'Recent Comments' ) . '

    '; echo '
      '; foreach ( $comments as $comment ) { _wp_dashboard_recent_comments_row( $comment ); } echo '
    '; if ( current_user_can( 'edit_posts' ) ) { echo '

    ' . __( 'View more comments' ) . '

    '; _get_list_table( 'WP_Comments_List_Table' )->views(); } wp_comment_reply( -1, false, 'dashboard', false ); wp_comment_trashnotice(); echo '
    '; } else { return false; } return true; } function wp_dashboard_rss_output( $widget_id ) { $widgets = get_option( 'dashboard_widget_options' ); echo '
    '; wp_widget_rss_output( $widgets[ $widget_id ] ); echo '
    '; } function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) { $loading = '

    ' . __( 'Loading…' ) . '

    ' . __( 'This widget requires JavaScript.' ) . '

    '; $doing_ajax = wp_doing_ajax(); if ( empty( $check_urls ) ) { $widgets = get_option( 'dashboard_widget_options' ); if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) { echo $loading; return false; } $check_urls = array( $widgets[ $widget_id ]['url'] ); } $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); $output = get_transient( $cache_key ); if ( false !== $output ) { echo $output; return true; } if ( ! $doing_ajax ) { echo $loading; return false; } if ( $callback && is_callable( $callback ) ) { array_unshift( $args, $widget_id, $check_urls ); ob_start(); call_user_func_array( $callback, $args ); set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); } return true; } function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { global $wp_dashboard_control_callbacks; if ( is_scalar( $widget_control_id ) && $widget_control_id && isset( $wp_dashboard_control_callbacks[ $widget_control_id ] ) && is_callable( $wp_dashboard_control_callbacks[ $widget_control_id ] ) ) { call_user_func( $wp_dashboard_control_callbacks[ $widget_control_id ], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[ $widget_control_id ], ) ); } } function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { $widget_options = get_option( 'dashboard_widget_options' ); if ( ! $widget_options ) { $widget_options = array(); } if ( ! isset( $widget_options[ $widget_id ] ) ) { $widget_options[ $widget_id ] = array(); } $number = 1; $widget_options[ $widget_id ]['number'] = $number; if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) { $_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] ); $widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] ); $widget_options[ $widget_id ]['number'] = $number; if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) { $rss = fetch_feed( $widget_options[ $widget_id ]['url'] ); if ( is_wp_error( $rss ) ) { $widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) ); } else { $widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) ); $rss->__destruct(); unset( $rss ); } } update_option( 'dashboard_widget_options', $widget_options ); $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); delete_transient( $cache_key ); } wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs ); } function wp_dashboard_events_news() { wp_print_community_events_markup(); ?> -.customize-control-radio { - padding: 5px 0 10px; -} +
    + +
    -.customize-control-radio .customize-control-title { - margin-bottom: 0; - line-height: 1.6; -} + -.customize-control .attachment-meta { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - margin: 0; - padding: 0 10px; -} + -.customize-control .attachment-meta-title { - padding-top: 7px; -} +
    +

    + +

    -/* Remove descender space. */ -.customize-control .thumbnail-image, -.customize-control-header .current, -.customize-control .wp-media-wrapper.wp-video { - line-height: 0; -} + -/* Remove descender space. */ -.customize-control-site_icon .favicon-preview .browser-preview { - vertical-align: top; -} + +
    -.customize-control .thumbnail-image img { - cursor: pointer; -} +
    + +
    -#customize-controls .thumbnail-audio .thumbnail { - max-width: 64px; - max-height: 64px; - margin: 10px; - float: left; -} + + -#customize-preview iframe { - width: 100%; - height: 100%; - position: absolute; -} -#customize-preview iframe + iframe { - visibility: hidden; -} + -.wp-full-overlay-sidebar { - background: #f0f0f1; - border-right: 1px solid #dcdcde; -} + + -/** - * Notifications - */ + -.customize-control-notifications-container li.notice:last-child { - margin-bottom: 0; -} + + array( 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), 'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ), 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), 'items' => 2, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, ), 'planet' => array( 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), 'items' => apply_filters( 'dashboard_secondary_items', 3 ), 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, ), ); wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); } function wp_dashboard_primary_output( $widget_id, $feeds ) { foreach ( $feeds as $type => $args ) { $args['type'] = $type; echo '
    '; wp_widget_rss_output( $args['url'], $args ); echo '
    '; } } function wp_dashboard_quota() { if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { return true; } $quota = get_space_allowed(); $used = get_space_used(); if ( $used > $quota ) { $percentused = '100'; } else { $percentused = ( $used / $quota ) * 100; } $used_class = ( $percentused >= 70 ) ? ' warning' : ''; $used = round( $used, 2 ); $percentused = number_format( $percentused ); ?> +

    +
    +
      +
    • + %2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), $text, __( 'Manage Uploads' ) ); ?> +
    • + %2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), $text, __( 'Manage Uploads' ) ); ?> +
    • +
    +
    + %s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } else { $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), sprintf( '%s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } $browser_nag_class = ''; if ( ! empty( $response['img_src'] ) ) { $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src']; $notice .= '
    '; $browser_nag_class = ' has-browser-icon'; } $notice .= "

    {$msg}

    "; $browsehappy = 'https://browsehappy.com/'; $locale = get_user_locale(); if ( 'en_US' !== $locale ) { $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); } if ( $is_IE ) { $msg_browsehappy = sprintf( __( 'Learn how to browse happy' ), esc_url( $browsehappy ) ); } else { $msg_browsehappy = sprintf( __( 'Update %2$s or learn how to browse happy' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ); } $notice .= '

    ' . $msg_browsehappy . '

    '; $notice .= '

    ' . __( 'Dismiss' ) . '

    '; $notice .= '
    '; } echo apply_filters( 'browse-happy-notice', $notice, $response ); } function dashboard_browser_nag_class( $classes ) { $response = wp_check_browser_version(); if ( $response && $response['insecure'] ) { $classes[] = 'browser-insecure'; } return $classes; } function wp_check_browser_version() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } $key = md5( $_SERVER['HTTP_USER_AGENT'] ); $response = get_site_transient( 'browser_' . $key ); if ( false === $response ) { require ABSPATH . WPINC . '/version.php'; $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; $options = array( 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_post( $url, $options ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $response = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $response ) ) { return false; } set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); } return $response; } function wp_dashboard_php_nag() { $response = wp_check_php_version(); if ( ! $response ) { return; } if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) { $msg = sprintf( __( 'Your site is running an insecure version of PHP (%s), which should be updated.' ), PHP_VERSION ); } else { $msg = sprintf( __( 'Your site is running an outdated version of PHP (%s), which should be updated.' ), PHP_VERSION ); } ?> +

    -#customize-controls .customize-control-widget_form .customize-control-notifications-container { - margin-top: 8px; -} +

    +

    + +

    -.customize-control-text.has-error input { - outline: 2px solid #d63638; -} +

    + %2$s %3$s', esc_url( wp_get_update_php_url() ), __( 'Learn more about updating PHP' ), __( '(opens in a new tab)' ) ); ?> +

    + 0, 'recommended' => 0, 'critical' => 0, ); } $issues_total = $issue_counts['recommended'] + $issue_counts['critical']; ?> +
    +
    +
    + +
    +
    + + + + + +
    +
    -#customize-controls #customize-notifications-area { - position: absolute; - top: 46px; - width: 100%; - border-bottom: 1px solid #dcdcde; - display: block; - padding: 0; - margin: 0; -} +
    + +

    + visit the Site Health screen to gather information about your site now.' ), esc_url( admin_url( 'site-health.php' ) ) ); ?> +

    + +

    + + + + + 1 ) : ?> + + + + + + +

    + -.wp-full-overlay.collapsed #customize-controls #customize-notifications-area { - display: none !important; -} + 0 && false !== $get_issues ) : ?> +

    + %1$d item on the Site Health screen.', 'Take a look at the %1$d items on the Site Health screen.', $issues_total ), $issues_total, esc_url( admin_url( 'site-health.php' ) ) ); ?> +

    + +
    +
    -#customize-controls #customize-notifications-area:not(.has-overlay-notifications), -#customize-controls .customize-section-title > .customize-control-notifications-container:not(.has-overlay-notifications), -#customize-controls .panel-meta > .customize-control-notifications-container:not(.has-overlay-notifications) { - max-height: 210px; - overflow-x: hidden; - overflow-y: auto; -} + +
    +
    +
    + +
    +

    +

    + + + +

    +
    +
    +
    +
    +
    +

    +

    + +
    +
    +
    +
    +
    + +

    +

    + + +

    +

    + + + + +
    +
    +
    +
    +
    + +

    +

    + + +

    +

    + + +
    +
    +
    +
    + sprintf( __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), 'php.ini', 'post_max_size', 'upload_max_filesize' ), ); } $overrides = array( 'test_form' => false, 'test_type' => false, ); $_FILES['import']['name'] .= '.txt'; $upload = wp_handle_upload( $_FILES['import'], $overrides ); if ( isset( $upload['error'] ) ) { return $upload; } $attachment = array( 'post_title' => wp_basename( $upload['file'] ), 'post_content' => $upload['url'], 'post_mime_type' => $upload['type'], 'guid' => $upload['url'], 'context' => 'import', 'post_status' => 'private', ); $id = wp_insert_attachment( $attachment, $upload['file'] ); wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); return array( 'file' => $upload['file'], 'id' => $id, ); } function wp_get_popular_importers() { require ABSPATH . WPINC . '/version.php'; $locale = get_user_locale(); $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); $popular_importers = get_site_transient( $cache_key ); if ( ! $popular_importers ) { $url = add_query_arg( array( 'locale' => $locale, 'version' => $wp_version, ), 'http://api.wordpress.org/core/importers/1.1/' ); $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_get( $url, $options ); $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); if ( is_array( $popular_importers ) ) { set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); } else { $popular_importers = false; } } if ( is_array( $popular_importers ) ) { if ( $popular_importers['translated'] ) { return $popular_importers['importers']; } foreach ( $popular_importers['importers'] as &$importer ) { $importer['description'] = translate( $importer['description'] ); if ( 'WordPress' !== $importer['name'] ) { $importer['name'] = translate( $importer['name'] ); } } return $popular_importers['importers']; } return array( 'blogger' => array( 'name' => __( 'Blogger' ), 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), 'plugin-slug' => 'blogger-importer', 'importer-id' => 'blogger', ), 'wpcat2tag' => array( 'name' => __( 'Categories and Tags Converter' ), 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), 'plugin-slug' => 'wpcat2tag-importer', 'importer-id' => 'wp-cat2tag', ), 'livejournal' => array( 'name' => __( 'LiveJournal' ), 'description' => __( 'Import posts from LiveJournal using their API.' ), 'plugin-slug' => 'livejournal-importer', 'importer-id' => 'livejournal', ), 'movabletype' => array( 'name' => __( 'Movable Type and TypePad' ), 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), 'plugin-slug' => 'movabletype-importer', 'importer-id' => 'mt', ), 'rss' => array( 'name' => __( 'RSS' ), 'description' => __( 'Import posts from an RSS feed.' ), 'plugin-slug' => 'rss-importer', 'importer-id' => 'rss', ), 'tumblr' => array( 'name' => __( 'Tumblr' ), 'description' => __( 'Import posts & media from Tumblr using their API.' ), 'plugin-slug' => 'tumblr-importer', 'importer-id' => 'tumblr', ), 'wordpress' => array( 'name' => 'WordPress', 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), 'plugin-slug' => 'wordpress-importer', 'importer-id' => 'wordpress', ), ); } method = 'ssh2'; $this->errors = new WP_Error(); if ( ! extension_loaded( 'ssh2' ) ) { $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) ); return; } if ( empty( $opt['port'] ) ) { $this->options['port'] = 22; } else { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'SSH2 hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( ! empty( $opt['public_key'] ) && ! empty( $opt['private_key'] ) ) { $this->options['public_key'] = $opt['public_key']; $this->options['private_key'] = $opt['private_key']; $this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa,ssh-ed25519' ); $this->keys = true; } elseif ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'SSH2 username is required' ) ); } if ( ! empty( $opt['username'] ) ) { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { if ( ! $this->keys ) { $this->errors->add( 'empty_password', __( 'SSH2 password is required' ) ); } } else { $this->options['password'] = $opt['password']; } } public function connect() { if ( ! $this->keys ) { $this->link = @ssh2_connect( $this->options['hostname'], $this->options['port'] ); } else { $this->link = @ssh2_connect( $this->options['hostname'], $this->options['port'], $this->options['hostkey'] ); } if ( ! $this->link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to SSH2 Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->keys ) { if ( ! @ssh2_auth_password( $this->link, $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } } else { if ( ! @ssh2_auth_pubkey_file( $this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Public and Private keys incorrect for %s' ), $this->options['username'] ) ); return false; } } $this->sftp_link = ssh2_sftp( $this->link ); if ( ! $this->sftp_link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to initialize a SFTP subsystem session with the SSH2 Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } return true; } public function sftp_path( $path ) { if ( '/' === $path ) { $path = '/./'; } return 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $path, '/' ); } public function run_command( $command, $returnbool = false ) { if ( ! $this->link ) { return false; } $stream = ssh2_exec( $this->link, $command ); if ( ! $stream ) { $this->errors->add( 'command', sprintf( __( 'Unable to perform command: %s' ), $command ) ); } else { stream_set_blocking( $stream, true ); stream_set_timeout( $stream, FS_TIMEOUT ); $data = stream_get_contents( $stream ); fclose( $stream ); if ( $returnbool ) { return ( false === $data ) ? false : '' !== trim( $data ); } else { return $data; } } return false; } public function get_contents( $file ) { return file_get_contents( $this->sftp_path( $file ) ); } public function get_contents_array( $file ) { return file( $this->sftp_path( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $ret = file_put_contents( $this->sftp_path( $file ), $contents ); if ( strlen( $contents ) !== $ret ) { return false; } $this->chmod( $file, $mode ); return true; } public function cwd() { $cwd = ssh2_sftp_realpath( $this->sftp_link, '.' ); if ( $cwd ) { $cwd = trailingslashit( trim( $cwd ) ); } return $cwd; } public function chdir( $dir ) { return $this->run_command( 'cd ' . $dir, true ); } public function chgrp( $file, $group, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chgrp %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chgrp -R %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chmod %o %s', $mode, escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chmod -R %o %s', $mode, escapeshellarg( $file ) ), true ); } public function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chown %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chown -R %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true ); } public function owner( $file ) { $owneruid = @fileowner( $this->sftp_path( $file ) ); if ( ! $owneruid ) { return false; } if ( ! function_exists( 'posix_getpwuid' ) ) { return $owneruid; } $ownerarray = posix_getpwuid( $owneruid ); if ( ! $ownerarray ) { return false; } return $ownerarray['name']; } public function getchmod( $file ) { return substr( decoct( @fileperms( $this->sftp_path( $file ) ) ), -3 ); } public function group( $file ) { $gid = @filegroup( $this->sftp_path( $file ) ); if ( ! $gid ) { return false; } if ( ! function_exists( 'posix_getgrgid' ) ) { return $gid; } $grouparray = posix_getgrgid( $gid ); if ( ! $grouparray ) { return false; } return $grouparray['name']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { if ( $this->exists( $destination ) ) { if ( $overwrite ) { $this->delete( $destination, false, 'f' ); } else { return false; } } return ssh2_sftp_rename( $this->sftp_link, $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( 'f' === $type || $this->is_file( $file ) ) { return ssh2_sftp_unlink( $this->sftp_link, $file ); } if ( ! $recursive ) { return ssh2_sftp_rmdir( $this->sftp_link, $file ); } $filelist = $this->dirlist( $file ); if ( is_array( $filelist ) ) { foreach ( $filelist as $filename => $fileinfo ) { $this->delete( $file . '/' . $filename, $recursive, $fileinfo['type'] ); } } return ssh2_sftp_rmdir( $this->sftp_link, $file ); } public function exists( $file ) { return file_exists( $this->sftp_path( $file ) ); } public function is_file( $file ) { return is_file( $this->sftp_path( $file ) ); } public function is_dir( $path ) { return is_dir( $this->sftp_path( $path ) ); } public function is_readable( $file ) { return is_readable( $this->sftp_path( $file ) ); } public function is_writable( $file ) { return true; } public function atime( $file ) { return fileatime( $this->sftp_path( $file ) ); } public function mtime( $file ) { return filemtime( $this->sftp_path( $file ) ); } public function size( $file ) { return filesize( $this->sftp_path( $file ) ); } public function touch( $file, $time = 0, $atime = 0 ) { } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } if ( ! ssh2_sftp_mkdir( $this->sftp_link, $path, $chmod, true ) ) { return false; } ssh2_sftp_chmod( $this->sftp_link, $path, $chmod ); if ( $chown ) { $this->chown( $path, $chown ); } if ( $chgrp ) { $this->chgrp( $path, $chgrp ); } return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path, $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ); } else { $limit_file = false; } if ( ! $this->is_dir( $path ) || ! $this->is_readable( $path ) ) { return false; } $ret = array(); $dir = dir( $this->sftp_path( $path ) ); if ( ! $dir ) { return false; } while ( false !== ( $entry = $dir->read() ) ) { $struc = array(); $struc['name'] = $entry; if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } $struc['perms'] = $this->gethchmod( $path . '/' . $entry ); $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $struc['number'] = false; $struc['owner'] = $this->owner( $path . '/' . $entry ); $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset( $dir ); return $ret; } } user_id = absint( $user_id ); $this->user_location = $user_location; } public function get_events( $location_search = '', $timezone = '' ) { $cached_events = $this->get_cached_events(); if ( ! $location_search && $cached_events ) { return $cached_events; } require ABSPATH . WPINC . '/version.php'; $api_url = 'http://api.wordpress.org/events/1.0/'; $request_args = $this->get_request_args( $location_search, $timezone ); $request_args['user-agent'] = 'WordPress/' . $wp_version . '; ' . home_url( '/' ); if ( wp_http_supports( array( 'ssl' ) ) ) { $api_url = set_url_scheme( $api_url, 'https' ); } $response = wp_remote_get( $api_url, $request_args ); $response_code = wp_remote_retrieve_response_code( $response ); $response_body = json_decode( wp_remote_retrieve_body( $response ), true ); $response_error = null; if ( is_wp_error( $response ) ) { $response_error = $response; } elseif ( 200 !== $response_code ) { $response_error = new WP_Error( 'api-error', sprintf( __( 'Invalid API response code (%d).' ), $response_code ) ); } elseif ( ! isset( $response_body['location'], $response_body['events'] ) ) { $response_error = new WP_Error( 'api-invalid-response', isset( $response_body['error'] ) ? $response_body['error'] : __( 'Unknown API error.' ) ); } if ( is_wp_error( $response_error ) ) { return $response_error; } else { $expiration = false; if ( isset( $response_body['ttl'] ) ) { $expiration = $response_body['ttl']; unset( $response_body['ttl'] ); } if ( ! empty( $response_body['location']['ip'] ) ) { $response_body['location']['ip'] = $request_args['body']['ip']; } if ( $this->coordinates_match( $request_args['body'], $response_body['location'] ) && empty( $response_body['location']['description'] ) ) { $response_body['location']['description'] = $this->user_location['description']; } $this->cache_events( $response_body, $expiration ); $response_body['events'] = $this->trim_events( $response_body['events'] ); return $response_body; } } protected function get_request_args( $search = '', $timezone = '' ) { $args = array( 'number' => 5, 'ip' => self::get_unsafe_client_ip(), ); if ( empty( $search ) && isset( $this->user_location['latitude'], $this->user_location['longitude'] ) ) { $args['latitude'] = $this->user_location['latitude']; $args['longitude'] = $this->user_location['longitude']; } else { $args['locale'] = get_user_locale( $this->user_id ); if ( $timezone ) { $args['timezone'] = $timezone; } if ( $search ) { $args['location'] = $search; } } return array( 'body' => $args, ); } public static function get_unsafe_client_ip() { $client_ip = false; $address_headers = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR', ); foreach ( $address_headers as $header ) { if ( array_key_exists( $header, $_SERVER ) ) { $address_chain = explode( ',', $_SERVER[ $header ] ); $client_ip = trim( $address_chain[0] ); break; } } if ( ! $client_ip ) { return false; } $anon_ip = wp_privacy_anonymize_ip( $client_ip, true ); if ( '0.0.0.0' === $anon_ip || '::' === $anon_ip ) { return false; } return $anon_ip; } protected function coordinates_match( $a, $b ) { if ( ! isset( $a['latitude'], $a['longitude'], $b['latitude'], $b['longitude'] ) ) { return false; } return $a['latitude'] === $b['latitude'] && $a['longitude'] === $b['longitude']; } protected function get_events_transient_key( $location ) { $key = false; if ( isset( $location['ip'] ) ) { $key = 'community-events-' . md5( $location['ip'] ); } elseif ( isset( $location['latitude'], $location['longitude'] ) ) { $key = 'community-events-' . md5( $location['latitude'] . $location['longitude'] ); } return $key; } protected function cache_events( $events, $expiration = false ) { $set = false; $transient_key = $this->get_events_transient_key( $events['location'] ); $cache_expiration = $expiration ? absint( $expiration ) : HOUR_IN_SECONDS * 12; if ( $transient_key ) { $set = set_site_transient( $transient_key, $events, $cache_expiration ); } return $set; } public function get_cached_events() { $cached_response = get_site_transient( $this->get_events_transient_key( $this->user_location ) ); if ( isset( $cached_response['events'] ) ) { $cached_response['events'] = $this->trim_events( $cached_response['events'] ); } return $cached_response; } protected function format_event_data_time( $response_body ) { _deprecated_function( __METHOD__, '5.5.2', 'This is no longer used by core, and only kept for backward compatibility.' ); if ( isset( $response_body['events'] ) ) { foreach ( $response_body['events'] as $key => $event ) { $timestamp = strtotime( $event['date'] ); $formatted_date = date_i18n( __( 'l, M j, Y' ), $timestamp ); $formatted_time = date_i18n( get_option( 'time_format' ), $timestamp ); if ( isset( $event['end_date'] ) ) { $end_timestamp = strtotime( $event['end_date'] ); $formatted_end_date = date_i18n( __( 'l, M j, Y' ), $end_timestamp ); if ( 'meetup' !== $event['type'] && $formatted_end_date !== $formatted_date ) { $start_month = date_i18n( _x( 'F', 'upcoming events month format' ), $timestamp ); $end_month = date_i18n( _x( 'F', 'upcoming events month format' ), $end_timestamp ); if ( $start_month === $end_month ) { $formatted_date = sprintf( __( '%1$s %2$d–%3$d, %4$d' ), $start_month, date_i18n( _x( 'j', 'upcoming events day format' ), $timestamp ), date_i18n( _x( 'j', 'upcoming events day format' ), $end_timestamp ), date_i18n( _x( 'Y', 'upcoming events year format' ), $timestamp ) ); } else { $formatted_date = sprintf( __( '%1$s %2$d – %3$s %4$d, %5$d' ), $start_month, date_i18n( _x( 'j', 'upcoming events day format' ), $timestamp ), $end_month, date_i18n( _x( 'j', 'upcoming events day format' ), $end_timestamp ), date_i18n( _x( 'Y', 'upcoming events year format' ), $timestamp ) ); } $formatted_date = wp_maybe_decline_date( $formatted_date, 'F j, Y' ); } } $response_body['events'][ $key ]['formatted_date'] = $formatted_date; $response_body['events'][ $key ]['formatted_time'] = $formatted_time; } } return $response_body; } protected function trim_events( array $events ) { $future_events = array(); foreach ( $events as $event ) { $end_time = (int) $event['end_unix_timestamp']; if ( time() < $end_time ) { $event['title'] = html_entity_decode( $event['title'], ENT_QUOTES, 'UTF-8' ); array_push( $future_events, $event ); } } $future_wordcamps = array_filter( $future_events, static function( $wordcamp ) { return 'wordcamp' === $wordcamp['type']; } ); $future_wordcamps = array_values( $future_wordcamps ); $trimmed_events = array_slice( $future_events, 0, 3 ); $trimmed_event_types = wp_list_pluck( $trimmed_events, 'type' ); if ( $future_wordcamps && ! in_array( 'wordcamp', $trimmed_event_types, true ) ) { array_pop( $trimmed_events ); array_push( $trimmed_events, $future_wordcamps[0] ); } return $trimmed_events; } protected function maybe_log_events_response( $message, $details ) { _deprecated_function( __METHOD__, '4.9.0' ); if ( ! WP_DEBUG_LOG ) { return; } error_log( sprintf( '%s: %s. Details: %s', __METHOD__, trim( $message, '.' ), wp_json_encode( $details ) ) ); } } false, 'test_type' => false, ); $file = wp_handle_upload( $_FILES[ $form ], $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'] ); } $this->filename = $_FILES[ $form ]['name']; $this->package = $file['file']; $attachment = array( 'post_title' => $this->filename, 'post_content' => $file['url'], 'post_mime_type' => $file['type'], 'guid' => $file['url'], 'context' => 'upgrader', 'post_status' => 'private', ); $this->id = wp_insert_attachment( $attachment, $file['file'] ); wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) ); } elseif ( is_numeric( $_GET[ $urlholder ] ) ) { $this->id = (int) $_GET[ $urlholder ]; $attachment = get_post( $this->id ); if ( empty( $attachment ) ) { wp_die( __( 'Please select a file' ) ); } $this->filename = $attachment->post_title; $this->package = get_attached_file( $attachment->ID ); } else { $uploads = wp_upload_dir(); if ( ! ( $uploads && false === $uploads['error'] ) ) { wp_die( $uploads['error'] ); } $this->filename = sanitize_file_name( $_GET[ $urlholder ] ); $this->package = $uploads['basedir'] . '/' . $this->filename; if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) { wp_die( __( 'Please select a file' ) ); } } } public function cleanup() { if ( $this->id ) { wp_delete_attachment( $this->id ); } elseif ( file_exists( $this->package ) ) { return @unlink( $this->package ); } return true; } } cap->create_posts ) ) { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) ); } } if ( isset( $post_data['content'] ) ) { $post_data['post_content'] = $post_data['content']; } if ( isset( $post_data['excerpt'] ) ) { $post_data['post_excerpt'] = $post_data['excerpt']; } if ( isset( $post_data['parent_id'] ) ) { $post_data['post_parent'] = (int) $post_data['parent_id']; } if ( isset( $post_data['trackback_url'] ) ) { $post_data['to_ping'] = $post_data['trackback_url']; } $post_data['user_ID'] = get_current_user_id(); if ( ! empty( $post_data['post_author_override'] ) ) { $post_data['post_author'] = (int) $post_data['post_author_override']; } else { if ( ! empty( $post_data['post_author'] ) ) { $post_data['post_author'] = (int) $post_data['post_author']; } else { $post_data['post_author'] = (int) $post_data['user_ID']; } } if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] ) && ! current_user_can( $ptype->cap->edit_others_posts ) ) { if ( $update ) { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) ); } } else { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) ); } } } if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'auto-draft' === $post_data['post_status'] ) { $post_data['post_status'] = 'draft'; } if ( ! get_post_status_object( $post_data['post_status'] ) ) { unset( $post_data['post_status'] ); } } if ( isset( $post_data['saveasdraft'] ) && '' !== $post_data['saveasdraft'] ) { $post_data['post_status'] = 'draft'; } if ( isset( $post_data['saveasprivate'] ) && '' !== $post_data['saveasprivate'] ) { $post_data['post_status'] = 'private'; } if ( isset( $post_data['publish'] ) && ( '' !== $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] ) ) { $post_data['post_status'] = 'publish'; } if ( isset( $post_data['advanced'] ) && '' !== $post_data['advanced'] ) { $post_data['post_status'] = 'draft'; } if ( isset( $post_data['pending'] ) && '' !== $post_data['pending'] ) { $post_data['post_status'] = 'pending'; } if ( isset( $post_data['ID'] ) ) { $post_id = $post_data['ID']; } else { $post_id = false; } $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false; if ( isset( $post_data['post_status'] ) && 'private' === $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) { $post_data['post_status'] = $previous_status ? $previous_status : 'pending'; } $published_statuses = array( 'publish', 'future' ); if ( isset( $post_data['post_status'] ) && ( in_array( $post_data['post_status'], $published_statuses, true ) && ! current_user_can( $ptype->cap->publish_posts ) ) ) { if ( ! in_array( $previous_status, $published_statuses, true ) || ! current_user_can( 'edit_post', $post_id ) ) { $post_data['post_status'] = 'pending'; } } if ( ! isset( $post_data['post_status'] ) ) { $post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status; } if ( isset( $post_data['post_password'] ) && ! current_user_can( $ptype->cap->publish_posts ) ) { unset( $post_data['post_password'] ); } if ( ! isset( $post_data['comment_status'] ) ) { $post_data['comment_status'] = 'closed'; } if ( ! isset( $post_data['ping_status'] ) ) { $post_data['ping_status'] = 'closed'; } foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] != $post_data[ $timeunit ] ) { $post_data['edit_date'] = '1'; break; } } if ( ! empty( $post_data['edit_date'] ) ) { $aa = $post_data['aa']; $mm = $post_data['mm']; $jj = $post_data['jj']; $hh = $post_data['hh']; $mn = $post_data['mn']; $ss = $post_data['ss']; $aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa; $mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm; $jj = ( $jj > 31 ) ? 31 : $jj; $jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj; $hh = ( $hh > 23 ) ? $hh - 24 : $hh; $mn = ( $mn > 59 ) ? $mn - 60 : $mn; $ss = ( $ss > 59 ) ? $ss - 60 : $ss; $post_data['post_date'] = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $aa, $mm, $jj, $hh, $mn, $ss ); $valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] ); if ( ! $valid_date ) { return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); } $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); } if ( isset( $post_data['post_category'] ) ) { $category_object = get_taxonomy( 'category' ); if ( ! current_user_can( $category_object->cap->assign_terms ) ) { unset( $post_data['post_category'] ); } } return $post_data; } function _wp_get_allowed_postdata( $post_data = null ) { if ( empty( $post_data ) ) { $post_data = $_POST; } if ( is_wp_error( $post_data ) ) { return $post_data; } return array_diff_key( $post_data, array_flip( array( 'meta_input', 'file', 'guid' ) ) ); } function edit_post( $post_data = null ) { global $wpdb; if ( empty( $post_data ) ) { $post_data = &$_POST; } unset( $post_data['filter'] ); $post_ID = (int) $post_data['post_ID']; $post = get_post( $post_ID ); $post_data['post_type'] = $post->post_type; $post_data['post_mime_type'] = $post->post_mime_type; if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'inherit' === $post_data['post_status'] ) { unset( $post_data['post_status'] ); } } $ptype = get_post_type_object( $post_data['post_type'] ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { if ( 'page' === $post_data['post_type'] ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } else { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } } if ( post_type_supports( $ptype->name, 'revisions' ) ) { $revisions = wp_get_post_revisions( $post_ID, array( 'order' => 'ASC', 'posts_per_page' => 1, ) ); $revision = current( $revisions ); if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 ) { _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) ); } } if ( isset( $post_data['visibility'] ) ) { switch ( $post_data['visibility'] ) { case 'public': $post_data['post_password'] = ''; break; case 'password': unset( $post_data['sticky'] ); break; case 'private': $post_data['post_status'] = 'private'; $post_data['post_password'] = ''; unset( $post_data['sticky'] ); break; } } $post_data = _wp_translate_postdata( true, $post_data ); if ( is_wp_error( $post_data ) ) { wp_die( $post_data->get_error_message() ); } $translated = _wp_get_allowed_postdata( $post_data ); if ( isset( $post_data['post_format'] ) ) { set_post_format( $post_ID, $post_data['post_format'] ); } $format_meta_urls = array( 'url', 'link_url', 'quote_source_url' ); foreach ( $format_meta_urls as $format_meta_url ) { $keyed = '_format_' . $format_meta_url; if ( isset( $post_data[ $keyed ] ) ) { update_post_meta( $post_ID, $keyed, wp_slash( esc_url_raw( wp_unslash( $post_data[ $keyed ] ) ) ) ); } } $format_keys = array( 'quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed' ); foreach ( $format_keys as $key ) { $keyed = '_format_' . $key; if ( isset( $post_data[ $keyed ] ) ) { if ( current_user_can( 'unfiltered_html' ) ) { update_post_meta( $post_ID, $keyed, $post_data[ $keyed ] ); } else { update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) ); } } } if ( 'attachment' === $post_data['post_type'] && preg_match( '#^(audio|video)/#', $post_data['post_mime_type'] ) ) { $id3data = wp_get_attachment_metadata( $post_ID ); if ( ! is_array( $id3data ) ) { $id3data = array(); } foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) { if ( isset( $post_data[ 'id3_' . $key ] ) ) { $id3data[ $key ] = sanitize_text_field( wp_unslash( $post_data[ 'id3_' . $key ] ) ); } } wp_update_attachment_metadata( $post_ID, $id3data ); } if ( isset( $post_data['meta'] ) && $post_data['meta'] ) { foreach ( $post_data['meta'] as $key => $value ) { $meta = get_post_meta_by_id( $key ); if ( ! $meta ) { continue; } if ( $meta->post_id != $post_ID ) { continue; } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $meta->meta_key ) ) { continue; } if ( is_protected_meta( $value['key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $value['key'] ) ) { continue; } update_meta( $key, $value['key'], $value['value'] ); } } if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) { foreach ( $post_data['deletemeta'] as $key => $value ) { $meta = get_post_meta_by_id( $key ); if ( ! $meta ) { continue; } if ( $meta->post_id != $post_ID ) { continue; } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $post_ID, $meta->meta_key ) ) { continue; } delete_meta( $key ); } } if ( 'attachment' === $post_data['post_type'] ) { if ( isset( $post_data['_wp_attachment_image_alt'] ) ) { $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); if ( get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); } } $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array(); $translated = apply_filters( 'attachment_fields_to_save', $translated, $attachment_data ); } if ( isset( $post_data['tax_input'] ) ) { foreach ( (array) $post_data['tax_input'] as $taxonomy => $terms ) { $tax_object = get_taxonomy( $taxonomy ); if ( $tax_object && isset( $tax_object->meta_box_sanitize_cb ) ) { $translated['tax_input'][ $taxonomy ] = call_user_func_array( $tax_object->meta_box_sanitize_cb, array( $taxonomy, $terms ) ); } } } add_meta( $post_ID ); update_post_meta( $post_ID, '_edit_last', get_current_user_id() ); $success = wp_update_post( $translated ); if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) { $fields = array( 'post_title', 'post_content', 'post_excerpt' ); foreach ( $fields as $field ) { if ( isset( $translated[ $field ] ) ) { $translated[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $translated[ $field ] ); } } wp_update_post( $translated ); } _fix_attachment_links( $post_ID ); wp_set_post_lock( $post_ID ); if ( current_user_can( $ptype->cap->edit_others_posts ) && current_user_can( $ptype->cap->publish_posts ) ) { if ( ! empty( $post_data['sticky'] ) ) { stick_post( $post_ID ); } else { unstick_post( $post_ID ); } } return $post_ID; } function bulk_edit_posts( $post_data = null ) { global $wpdb; if ( empty( $post_data ) ) { $post_data = &$_POST; } if ( isset( $post_data['post_type'] ) ) { $ptype = get_post_type_object( $post_data['post_type'] ); } else { $ptype = get_post_type_object( 'post' ); } if ( ! current_user_can( $ptype->cap->edit_posts ) ) { if ( 'page' === $ptype->name ) { wp_die( __( 'Sorry, you are not allowed to edit pages.' ) ); } else { wp_die( __( 'Sorry, you are not allowed to edit posts.' ) ); } } if ( -1 == $post_data['_status'] ) { $post_data['post_status'] = null; unset( $post_data['post_status'] ); } else { $post_data['post_status'] = $post_data['_status']; } unset( $post_data['_status'] ); if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'inherit' === $post_data['post_status'] ) { unset( $post_data['post_status'] ); } } $post_IDs = array_map( 'intval', (array) $post_data['post'] ); $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky', 'post_format', ); foreach ( $reset as $field ) { if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) { unset( $post_data[ $field ] ); } } if ( isset( $post_data['post_category'] ) ) { if ( is_array( $post_data['post_category'] ) && ! empty( $post_data['post_category'] ) ) { $new_cats = array_map( 'absint', $post_data['post_category'] ); } else { unset( $post_data['post_category'] ); } } $tax_input = array(); if ( isset( $post_data['tax_input'] ) ) { foreach ( $post_data['tax_input'] as $tax_name => $terms ) { if ( empty( $terms ) ) { continue; } if ( is_taxonomy_hierarchical( $tax_name ) ) { $tax_input[ $tax_name ] = array_map( 'absint', $terms ); } else { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $tax_input[ $tax_name ] = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } } } if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) { $parent = (int) $post_data['post_parent']; $pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" ); $children = array(); for ( $i = 0; $i < 50 && $parent > 0; $i++ ) { $children[] = $parent; foreach ( $pages as $page ) { if ( (int) $page->ID === $parent ) { $parent = (int) $page->post_parent; break; } } } } $updated = array(); $skipped = array(); $locked = array(); $shared_post_data = $post_data; foreach ( $post_IDs as $post_ID ) { $post_data = $shared_post_data; $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); if ( ! isset( $post_type_object ) || ( isset( $children ) && in_array( $post_ID, $children, true ) ) || ! current_user_can( 'edit_post', $post_ID ) ) { $skipped[] = $post_ID; continue; } if ( wp_check_post_lock( $post_ID ) ) { $locked[] = $post_ID; continue; } $post = get_post( $post_ID ); $tax_names = get_object_taxonomies( $post ); foreach ( $tax_names as $tax_name ) { $taxonomy_obj = get_taxonomy( $tax_name ); if ( isset( $tax_input[ $tax_name ] ) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) { $new_terms = $tax_input[ $tax_name ]; } else { $new_terms = array(); } if ( $taxonomy_obj->hierarchical ) { $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array( 'fields' => 'ids' ) ); } else { $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array( 'fields' => 'names' ) ); } $post_data['tax_input'][ $tax_name ] = array_merge( $current_terms, $new_terms ); } if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) { $cats = (array) wp_get_post_categories( $post_ID ); $post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) ); unset( $post_data['tax_input']['category'] ); } $post_data['post_ID'] = $post_ID; $post_data['post_type'] = $post->post_type; $post_data['post_mime_type'] = $post->post_mime_type; foreach ( array( 'comment_status', 'ping_status', 'post_author' ) as $field ) { if ( ! isset( $post_data[ $field ] ) ) { $post_data[ $field ] = $post->$field; } } $post_data = _wp_translate_postdata( true, $post_data ); if ( is_wp_error( $post_data ) ) { $skipped[] = $post_ID; continue; } $post_data = _wp_get_allowed_postdata( $post_data ); if ( isset( $shared_post_data['post_format'] ) ) { set_post_format( $post_ID, $shared_post_data['post_format'] ); } unset( $post_data['tax_input']['post_format'] ); $post_id = wp_update_post( $post_data ); update_post_meta( $post_id, '_edit_last', get_current_user_id() ); $updated[] = $post_id; if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { if ( 'sticky' === $post_data['sticky'] ) { stick_post( $post_ID ); } else { unstick_post( $post_ID ); } } } return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked, ); } function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) { $post_title = ''; if ( ! empty( $_REQUEST['post_title'] ) ) { $post_title = esc_html( wp_unslash( $_REQUEST['post_title'] ) ); } $post_content = ''; if ( ! empty( $_REQUEST['content'] ) ) { $post_content = esc_html( wp_unslash( $_REQUEST['content'] ) ); } $post_excerpt = ''; if ( ! empty( $_REQUEST['excerpt'] ) ) { $post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] ) ); } if ( $create_in_db ) { $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft', ), false, false ); $post = get_post( $post_id ); if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) { set_post_format( $post, get_option( 'default_post_format' ) ); } wp_after_insert_post( $post, false, null ); if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); } } else { $post = new stdClass; $post->ID = 0; $post->post_author = ''; $post->post_date = ''; $post->post_date_gmt = ''; $post->post_password = ''; $post->post_name = ''; $post->post_type = $post_type; $post->post_status = 'draft'; $post->to_ping = ''; $post->pinged = ''; $post->comment_status = get_default_comment_status( $post_type ); $post->ping_status = get_default_comment_status( $post_type, 'pingback' ); $post->post_pingback = get_option( 'default_pingback_flag' ); $post->post_category = get_option( 'default_category' ); $post->page_template = 'default'; $post->post_parent = 0; $post->menu_order = 0; $post = new WP_Post( $post ); } $post->post_content = (string) apply_filters( 'default_content', $post_content, $post ); $post->post_title = (string) apply_filters( 'default_title', $post_title, $post ); $post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post ); return $post; } function post_exists( $title, $content = '', $date = '', $type = '', $status = '' ) { global $wpdb; $post_title = wp_unslash( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); $post_content = wp_unslash( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); $post_date = wp_unslash( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); $post_type = wp_unslash( sanitize_post_field( 'post_type', $type, 0, 'db' ) ); $post_status = wp_unslash( sanitize_post_field( 'post_status', $status, 0, 'db' ) ); $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; $args = array(); if ( ! empty( $date ) ) { $query .= ' AND post_date = %s'; $args[] = $post_date; } if ( ! empty( $title ) ) { $query .= ' AND post_title = %s'; $args[] = $post_title; } if ( ! empty( $content ) ) { $query .= ' AND post_content = %s'; $args[] = $post_content; } if ( ! empty( $type ) ) { $query .= ' AND post_type = %s'; $args[] = $post_type; } if ( ! empty( $status ) ) { $query .= ' AND post_status = %s'; $args[] = $post_status; } if ( ! empty( $args ) ) { return (int) $wpdb->get_var( $wpdb->prepare( $query, $args ) ); } return 0; } function wp_write_post() { if ( isset( $_POST['post_type'] ) ) { $ptype = get_post_type_object( $_POST['post_type'] ); } else { $ptype = get_post_type_object( 'post' ); } if ( ! current_user_can( $ptype->cap->edit_posts ) ) { if ( 'page' === $ptype->name ) { return new WP_Error( 'edit_pages', __( 'Sorry, you are not allowed to create pages on this site.' ) ); } else { return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to create posts or drafts on this site.' ) ); } } $_POST['post_mime_type'] = ''; unset( $_POST['filter'] ); if ( isset( $_POST['post_ID'] ) ) { return edit_post(); } if ( isset( $_POST['visibility'] ) ) { switch ( $_POST['visibility'] ) { case 'public': $_POST['post_password'] = ''; break; case 'password': unset( $_POST['sticky'] ); break; case 'private': $_POST['post_status'] = 'private'; $_POST['post_password'] = ''; unset( $_POST['sticky'] ); break; } } $translated = _wp_translate_postdata( false ); if ( is_wp_error( $translated ) ) { return $translated; } $translated = _wp_get_allowed_postdata( $translated ); $post_ID = wp_insert_post( $translated ); if ( is_wp_error( $post_ID ) ) { return $post_ID; } if ( empty( $post_ID ) ) { return 0; } add_meta( $post_ID ); add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); _fix_attachment_links( $post_ID ); wp_set_post_lock( $post_ID ); return $post_ID; } function write_post() { $result = wp_write_post(); if ( is_wp_error( $result ) ) { wp_die( $result->get_error_message() ); } else { return $result; } } function add_meta( $post_ID ) { $post_ID = (int) $post_ID; $metakeyselect = isset( $_POST['metakeyselect'] ) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : ''; $metakeyinput = isset( $_POST['metakeyinput'] ) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : ''; $metavalue = isset( $_POST['metavalue'] ) ? $_POST['metavalue'] : ''; if ( is_string( $metavalue ) ) { $metavalue = trim( $metavalue ); } if ( ( ( '#NONE#' !== $metakeyselect ) && ! empty( $metakeyselect ) ) || ! empty( $metakeyinput ) ) { if ( '#NONE#' !== $metakeyselect ) { $metakey = $metakeyselect; } if ( $metakeyinput ) { $metakey = $metakeyinput; } if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) ) { return false; } $metakey = wp_slash( $metakey ); return add_post_meta( $post_ID, $metakey, $metavalue ); } return false; } function delete_meta( $mid ) { return delete_metadata_by_mid( 'post', $mid ); } function get_meta_keys() { global $wpdb; $keys = $wpdb->get_col( " + SELECT meta_key + FROM $wpdb->postmeta + GROUP BY meta_key + ORDER BY meta_key" ); return $keys; } function get_post_meta_by_id( $mid ) { return get_metadata_by_mid( 'post', $mid ); } function has_meta( $postid ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, post_id + FROM $wpdb->postmeta WHERE post_id = %d + ORDER BY meta_key,meta_id", $postid ), ARRAY_A ); } function update_meta( $meta_id, $meta_key, $meta_value ) { $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key ); } function _fix_attachment_links( $post ) { $post = get_post( $post, ARRAY_A ); $content = $post['post_content']; if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ), true ) ) { return; } if ( ! strpos( $content, '?attachment_id=' ) || ! preg_match_all( '/]+)>[\s\S]+?<\/a>/', $content, $link_matches ) ) { return; } $site_url = get_bloginfo( 'url' ); $site_url = substr( $site_url, (int) strpos( $site_url, '://' ) ); $replace = ''; foreach ( $link_matches[1] as $key => $value ) { if ( ! strpos( $value, '?attachment_id=' ) || ! strpos( $value, 'wp-att-' ) || ! preg_match( '/href=(["\'])[^"\']*\?attachment_id=(\d+)[^"\']*\\1/', $value, $url_match ) || ! preg_match( '/rel=["\'][^"\']*wp-att-(\d+)/', $value, $rel_match ) ) { continue; } $quote = $url_match[1]; $url_id = (int) $url_match[2]; $rel_id = (int) $rel_match[1]; if ( ! $url_id || ! $rel_id || $url_id != $rel_id || strpos( $url_match[0], $site_url ) === false ) { continue; } $link = $link_matches[0][ $key ]; $replace = str_replace( $url_match[0], 'href=' . $quote . get_attachment_link( $url_id ) . $quote, $link ); $content = str_replace( $link, $replace, $content ); } if ( $replace ) { $post['post_content'] = $content; $post = add_magic_quotes( $post ); return wp_update_post( $post ); } } function get_available_post_statuses( $type = 'post' ) { $stati = wp_count_posts( $type ); return array_keys( get_object_vars( $stati ) ); } function wp_edit_posts_query( $q = false ) { if ( false === $q ) { $q = $_GET; } $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; $post_stati = get_post_stati(); if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) { $post_type = $q['post_type']; } else { $post_type = 'post'; } $avail_post_stati = get_available_post_statuses( $post_type ); $post_status = ''; $perm = ''; if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) { $post_status = $q['post_status']; $perm = 'readable'; } $orderby = ''; if ( isset( $q['orderby'] ) ) { $orderby = $q['orderby']; } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ), true ) ) { $orderby = 'modified'; } $order = ''; if ( isset( $q['order'] ) ) { $order = $q['order']; } elseif ( isset( $q['post_status'] ) && 'pending' === $q['post_status'] ) { $order = 'ASC'; } $per_page = "edit_{$post_type}_per_page"; $posts_per_page = (int) get_user_option( $per_page ); if ( empty( $posts_per_page ) || $posts_per_page < 1 ) { $posts_per_page = 20; } $posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page ); $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type ); $query = compact( 'post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page' ); if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) { $query['orderby'] = 'menu_order title'; $query['order'] = 'asc'; $query['posts_per_page'] = -1; $query['posts_per_archive_page'] = -1; $query['fields'] = 'id=>parent'; } if ( ! empty( $q['show_sticky'] ) ) { $query['post__in'] = (array) get_option( 'sticky_posts' ); } wp( $query ); return $avail_post_stati; } function wp_edit_attachments_query_vars( $q = false ) { if ( false === $q ) { $q = $_GET; } $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; $q['post_type'] = 'attachment'; $post_type = get_post_type_object( 'attachment' ); $states = 'inherit'; if ( current_user_can( $post_type->cap->read_private_posts ) ) { $states .= ',private'; } $q['post_status'] = isset( $q['status'] ) && 'trash' === $q['status'] ? 'trash' : $states; $q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' === $q['attachment-filter'] ? 'trash' : $states; $media_per_page = (int) get_user_option( 'upload_per_page' ); if ( empty( $media_per_page ) || $media_per_page < 1 ) { $media_per_page = 20; } $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page ); $post_mime_types = get_post_mime_types(); if ( isset( $q['post_mime_type'] ) && ! array_intersect( (array) $q['post_mime_type'], array_keys( $post_mime_types ) ) ) { unset( $q['post_mime_type'] ); } foreach ( array_keys( $post_mime_types ) as $type ) { if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" === $q['attachment-filter'] ) { $q['post_mime_type'] = $type; break; } } if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' === $q['attachment-filter'] ) ) { $q['post_parent'] = 0; } if ( isset( $q['mine'] ) || ( isset( $q['attachment-filter'] ) && 'mine' === $q['attachment-filter'] ) ) { $q['author'] = get_current_user_id(); } if ( isset( $q['s'] ) ) { add_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); } return $q; } function wp_edit_attachments_query( $q = false ) { wp( wp_edit_attachments_query_vars( $q ) ); $post_mime_types = get_post_mime_types(); $avail_post_mime_types = get_available_post_mime_types( 'attachment' ); return array( $post_mime_types, $avail_post_mime_types ); } function postbox_classes( $box_id, $screen_id ) { if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) { $classes = array( '' ); } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) { $closed = get_user_option( 'closedpostboxes_' . $screen_id ); if ( ! is_array( $closed ) ) { $classes = array( '' ); } else { $classes = in_array( $box_id, $closed, true ) ? array( 'closed' ) : array( '' ); } } else { $classes = array( '' ); } $classes = apply_filters( "postbox_classes_{$screen_id}_{$box_id}", $classes ); return implode( ' ', $classes ); } function get_sample_permalink( $id, $title = null, $name = null ) { $post = get_post( $id ); if ( ! $post ) { return array( '', '' ); } $ptype = get_post_type_object( $post->post_type ); $original_status = $post->post_status; $original_date = $post->post_date; $original_name = $post->post_name; if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) { $post->post_status = 'publish'; $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID ); } if ( ! is_null( $name ) ) { $post->post_name = sanitize_title( $name ? $name : $title, $post->ID ); } $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent ); $post->filter = 'sample'; $permalink = get_permalink( $post, true ); $permalink = str_replace( "%$post->post_type%", '%pagename%', $permalink ); if ( $ptype->hierarchical ) { $uri = get_page_uri( $post ); if ( $uri ) { $uri = untrailingslashit( $uri ); $uri = strrev( stristr( strrev( $uri ), '/' ) ); $uri = untrailingslashit( $uri ); } $uri = apply_filters( 'editable_slug', $uri, $post ); if ( ! empty( $uri ) ) { $uri .= '/'; } $permalink = str_replace( '%pagename%', "{$uri}%pagename%", $permalink ); } $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) ); $post->post_status = $original_status; $post->post_date = $original_date; $post->post_name = $original_name; unset( $post->filter ); return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post ); } function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { $post = get_post( $id ); if ( ! $post ) { return ''; } list($permalink, $post_name) = get_sample_permalink( $post->ID, $new_title, $new_slug ); $view_link = false; $preview_target = ''; if ( current_user_can( 'read_post', $post->ID ) ) { if ( 'draft' === $post->post_status || empty( $post->post_name ) ) { $view_link = get_preview_post_link( $post ); $preview_target = " target='wp-preview-{$post->ID}'"; } else { if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) { $view_link = get_permalink( $post ); } else { $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink ); } } } if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { $return = '' . __( 'Permalink:' ) . "\n"; if ( false !== $view_link ) { $display_link = urldecode( $view_link ); $return .= '' . esc_html( $display_link ) . "\n"; } else { $return .= '' . $permalink . "\n"; } if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id ) ) { $return .= '' . __( 'Change Permalink Structure' ) . "\n"; } } else { if ( mb_strlen( $post_name ) > 34 ) { $post_name_abridged = mb_substr( $post_name, 0, 16 ) . '…' . mb_substr( $post_name, -16 ); } else { $post_name_abridged = $post_name; } $post_name_html = '' . esc_html( $post_name_abridged ) . ''; $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( urldecode( $permalink ) ) ); $return = '' . __( 'Permalink:' ) . "\n"; $return .= '' . $display_link . "\n"; $return .= '‎'; $return .= '\n"; $return .= '' . esc_html( $post_name ) . "\n"; } $return = apply_filters( 'get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post ); return $return; } function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $post = get_post( $post ); $post_type_object = get_post_type_object( $post->post_type ); $set_thumbnail_link = '

    %s

    '; $upload_iframe_src = get_upload_iframe_src( 'image', $post->ID ); $content = sprintf( $set_thumbnail_link, esc_url( $upload_iframe_src ), '', esc_html( $post_type_object->labels->set_featured_image ) ); if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( 266, 266 ); $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post ); $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size ); if ( ! empty( $thumbnail_html ) ) { $content = sprintf( $set_thumbnail_link, esc_url( $upload_iframe_src ), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html ); $content .= '

    ' . __( 'Click the image to edit or update' ) . '

    '; $content .= '

    ' . esc_html( $post_type_object->labels->remove_featured_image ) . '

    '; } } $content .= ''; return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id ); } function wp_check_post_lock( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $lock = get_post_meta( $post->ID, '_edit_lock', true ); if ( ! $lock ) { return false; } $lock = explode( ':', $lock ); $time = $lock[0]; $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); if ( ! get_userdata( $user ) ) { return false; } $time_window = apply_filters( 'wp_check_post_lock_window', 150 ); if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) { return $user; } return false; } function wp_set_post_lock( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $user_id = get_current_user_id(); if ( 0 == $user_id ) { return false; } $now = time(); $lock = "$now:$user_id"; update_post_meta( $post->ID, '_edit_lock', $lock ); return array( $now, $user_id ); } function _admin_notice_post_locked() { $post = get_post(); if ( ! $post ) { return; } $user = null; $user_id = wp_check_post_lock( $post->ID ); if ( $user_id ) { $user = get_userdata( $user_id ); } if ( $user ) { if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) ) { return; } $locked = true; } else { $locked = false; } $sendback = wp_get_referer(); if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { $sendback_text = __( 'Go back' ); } else { $sendback = admin_url( 'edit.php' ); if ( 'post' !== $post->post_type ) { $sendback = add_query_arg( 'post_type', $post->post_type, $sendback ); } $sendback_text = get_post_type_object( $post->post_type )->labels->all_items; } $hidden = $locked ? '' : ' hidden'; ?> +
    +
    +
    + post_type )->public ) { if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) { $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); $query_args['preview_id'] = $post->ID; $query_args['preview_nonce'] = $nonce; } } $preview_link = get_preview_post_link( $post->ID, $query_args ); $override = apply_filters( 'override_post_lock', true, $post, $user ); $tab_last = $override ? '' : ' wp-tab-last'; ?> +
    +
    ID, 64 ); ?>
    +

    + display_name ) ); } else { printf( __( '%s is currently editing this post.' ), esc_html( $user->display_name ) ); } ?> +

    + +

    + + + + + + +

    +
    + +
    +
    +

    +
    + + +

    + +

    +
    + +
    +
    + ID; $new_autosave['post_author'] = $post_author; $post = get_post( $post_id ); $autosave_is_different = false; foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) { $autosave_is_different = true; break; } } if ( ! $autosave_is_different ) { wp_delete_post_revision( $old_autosave->ID ); return 0; } do_action( 'wp_creating_autosave', $new_autosave ); return wp_update_post( $new_autosave ); } $post_data = wp_unslash( $post_data ); return _wp_put_post_revision( $post_data, true ); } function post_preview() { $post_ID = (int) $_POST['post_ID']; $_POST['ID'] = $post_ID; $post = get_post( $post_ID ); if ( ! $post ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! current_user_can( 'edit_post', $post->ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } $is_autosave = false; if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) ) { $saved_post_id = edit_post(); } else { $is_autosave = true; if ( isset( $_POST['post_status'] ) && 'auto-draft' === $_POST['post_status'] ) { $_POST['post_status'] = 'draft'; } $saved_post_id = wp_create_post_autosave( $post->ID ); } if ( is_wp_error( $saved_post_id ) ) { wp_die( $saved_post_id->get_error_message() ); } $query_args = array(); if ( $is_autosave && $saved_post_id ) { $query_args['preview_id'] = $post->ID; $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID ); if ( isset( $_POST['post_format'] ) ) { $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] ); } if ( isset( $_POST['_thumbnail_id'] ) ) { $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; } } return get_preview_post_link( $post, $query_args ); } function wp_autosave( $post_data ) { if ( ! defined( 'DOING_AUTOSAVE' ) ) { define( 'DOING_AUTOSAVE', true ); } $post_id = (int) $post_data['post_id']; $post_data['ID'] = $post_id; $post_data['post_ID'] = $post_id; if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) { return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) ); } $post = get_post( $post_id ); if ( ! current_user_can( 'edit_post', $post->ID ) ) { return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) ); } if ( 'auto-draft' === $post->post_status ) { $post_data['post_status'] = 'draft'; } if ( 'page' !== $post_data['post_type'] && ! empty( $post_data['catslist'] ) ) { $post_data['post_category'] = explode( ',', $post_data['catslist'] ); } if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status ) ) { return edit_post( wp_slash( $post_data ) ); } else { return wp_create_post_autosave( wp_slash( $post_data ) ); } } function redirect_post( $post_id = '' ) { if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) { $status = get_post_status( $post_id ); if ( isset( $_POST['publish'] ) ) { switch ( $status ) { case 'pending': $message = 8; break; case 'future': $message = 9; break; default: $message = 6; } } else { $message = 'draft' === $status ? 10 : 1; } $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) ); } elseif ( isset( $_POST['addmeta'] ) && $_POST['addmeta'] ) { $location = add_query_arg( 'message', 2, wp_get_referer() ); $location = explode( '#', $location ); $location = $location[0] . '#postcustom'; } elseif ( isset( $_POST['deletemeta'] ) && $_POST['deletemeta'] ) { $location = add_query_arg( 'message', 3, wp_get_referer() ); $location = explode( '#', $location ); $location = $location[0] . '#postcustom'; } else { $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) ); } wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ); exit; } function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) { return array_map( 'intval', $terms ); } function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { if ( ! is_array( $terms ) ) { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $terms = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } $clean_terms = array(); foreach ( $terms as $term ) { if ( empty( $term ) ) { continue; } $_term = get_terms( array( 'taxonomy' => $taxonomy, 'name' => $term, 'fields' => 'ids', 'hide_empty' => false, ) ); if ( ! empty( $_term ) ) { $clean_terms[] = (int) $_term[0]; } else { $clean_terms[] = $term; } } return $clean_terms; } function use_block_editor_for_post( $post ) { $post = get_post( $post ); if ( ! $post ) { return false; } if ( isset( $_GET['meta-box-loader'] ) ) { check_admin_referer( 'meta-box-loader', 'meta-box-loader-nonce' ); return false; } $use_block_editor = use_block_editor_for_post_type( $post->post_type ); return apply_filters( 'use_block_editor_for_post', $use_block_editor, $post ); } function use_block_editor_for_post_type( $post_type ) { if ( ! post_type_exists( $post_type ) ) { return false; } if ( ! post_type_supports( $post_type, 'editor' ) ) { return false; } $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object && ! $post_type_object->show_in_rest ) { return false; } return apply_filters( 'use_block_editor_for_post_type', true, $post_type ); } function get_block_editor_server_block_settings() { $block_registry = WP_Block_Type_Registry::get_instance(); $blocks = array(); $fields_to_pick = array( 'api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations', ); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { foreach ( $fields_to_pick as $field => $key ) { if ( ! isset( $block_type->{ $field } ) ) { continue; } if ( ! isset( $blocks[ $block_name ] ) ) { $blocks[ $block_name ] = array(); } $blocks[ $block_name ][ $key ] = $block_type->{ $field }; } } return $blocks; } function the_block_editor_meta_boxes() { global $post, $current_screen, $wp_meta_boxes; $_original_meta_boxes = $wp_meta_boxes; $wp_meta_boxes = apply_filters( 'filter_block_editor_meta_boxes', $wp_meta_boxes ); $locations = array( 'side', 'normal', 'advanced' ); $priorities = array( 'high', 'sorted', 'core', 'default', 'low' ); ?> +
    + +
    +
    + + +
    + +
    + +
    + + id ][ $location ] ) ) { continue; } foreach ( $priorities as $priority ) { if ( ! isset( $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ] ) ) { continue; } $meta_boxes = (array) $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ]; foreach ( $meta_boxes as $meta_box ) { if ( false == $meta_box || ! $meta_box['title'] ) { continue; } if ( isset( $meta_box['args']['__back_compat_meta_box'] ) && $meta_box['args']['__back_compat_meta_box'] ) { continue; } $meta_boxes_per_location[ $location ][] = array( 'id' => $meta_box['id'], 'title' => $meta_box['title'], ); } } } $script = 'window._wpLoadBlockEditor.then( function() { + wp.data.dispatch( \'core/edit-post\' ).setAvailableMetaBoxesPerLocation( ' . wp_json_encode( $meta_boxes_per_location ) . ' ); + } );'; wp_add_inline_script( 'wp-edit-post', $script ); if ( wp_script_is( 'wp-edit-post', 'done' ) ) { printf( "\n", trim( $script ) ); } $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ); if ( $enable_custom_fields ) { $script = "( function( $ ) { + if ( $('#postcustom').length ) { + $( '#the-list' ).wpList( { + addBefore: function( s ) { + s.data += '&post_id=$post->ID'; + return s; + }, + addAfter: function() { + $('table#list-table').show(); + } + }); + } + } )( jQuery );"; wp_enqueue_script( 'wp-lists' ); wp_add_inline_script( 'wp-lists', $script ); } $wp_meta_boxes = $_original_meta_boxes; } function the_block_editor_meta_box_post_form_hidden_fields( $post ) { $form_extra = ''; if ( 'auto-draft' === $post->post_status ) { $form_extra .= ""; } $form_action = 'editpost'; $nonce_action = 'update-post_' . $post->ID; $form_extra .= ""; $referer = wp_get_referer(); $current_user = wp_get_current_user(); $user_id = $current_user->ID; wp_nonce_field( $nonce_action ); ob_start(); do_action( 'edit_form_after_title', $post ); do_action( 'edit_form_advanced', $post ); $classic_output = ob_get_clean(); $classic_elements = wp_html_split( $classic_output ); $hidden_inputs = ''; foreach ( $classic_elements as $element ) { if ( 0 !== strpos( $element, ' + + + + + + -#customize-controls #customize-notifications-area > ul, -#customize-controls #customize-notifications-area .notice, -#customize-controls .panel-meta > .customize-control-notifications-container, -#customize-controls .panel-meta > .customize-control-notifications-container .notice, -#customize-controls .customize-section-title > .customize-control-notifications-container, -#customize-controls .customize-section-title > .customize-control-notifications-container .notice { - margin: 0; -} -#customize-controls .panel-meta > .customize-control-notifications-container, -#customize-controls .customize-section-title > .customize-control-notifications-container { - border-top: 1px solid #dcdcde; -} -#customize-controls #customize-notifications-area .notice, -#customize-controls .panel-meta > .customize-control-notifications-container .notice, -#customize-controls .customize-section-title > .customize-control-notifications-container .notice { - padding: 9px 14px; -} -#customize-controls #customize-notifications-area .notice.is-dismissible, -#customize-controls .panel-meta > .customize-control-notifications-container .notice.is-dismissible, -#customize-controls .customize-section-title > .customize-control-notifications-container .notice.is-dismissible { - padding-right: 38px; -} -#customize-controls #customize-notifications-area .notice + .notice, -#customize-controls .panel-meta > .customize-control-notifications-container .notice + .notice, -#customize-controls .customize-section-title > .customize-control-notifications-container .notice + .notice { - margin-top: 1px; -} - -@keyframes customize-fade-in { - 0% { opacity: 0; } - 100% { opacity: 1; } -} - -#customize-controls .notice.notification-overlay, -#customize-controls #customize-notifications-area .notice.notification-overlay { - margin: 0; - border-left: 0; /* @todo Appropriate styles could be added for notice-error, notice-warning, notice-success, etc */ -} - -#customize-controls .customize-control-notifications-container.has-overlay-notifications { - animation: customize-fade-in 0.5s; - z-index: 30; -} - -/* Note: Styles for this are also defined in themes.css */ -#customize-controls #customize-notifications-area .notice.notification-overlay .notification-message { - clear: both; - color: #1d2327; - font-size: 18px; - font-style: normal; - margin: 0; - padding: 2em 0; - text-align: center; - width: 100%; - display: block; - top: 50%; - position: relative; -} - -/* Style for custom settings */ - -/** - * Static front page - */ - -#customize-control-show_on_front.has-error { - margin-bottom: 0; -} -#customize-control-show_on_front.has-error .customize-control-notifications-container { - margin-top: 12px; -} - -/** - * Dropdowns - */ - -.accordion-section .dropdown { - float: left; - display: block; - position: relative; - cursor: pointer; -} - -.accordion-section .dropdown-content { - overflow: hidden; - float: left; - min-width: 30px; - height: 16px; - line-height: 16px; - margin-right: 16px; - padding: 4px 5px; - border: 2px solid #f0f0f1; - -webkit-user-select: none; - user-select: none; -} + '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false, ); $args = wp_parse_args( $args, $defaults ); if ( $args['skip_header_footer'] ) { $this->done_header = true; $this->done_footer = true; $this->display_footer_actions = false; } parent::__construct( $args ); } public function before() { $name = $this->upgrader->get_name_for_update( $this->language_update ); echo '
    '; printf( '

    ' . __( 'Updating translations for %1$s (%2$s)…' ) . '

    ', $name, $this->language_update->language ); } public function error( $errors ) { echo '
    '; parent::error( $errors ); echo '
    '; } public function after() { echo '
    '; } public function bulk_footer() { $this->decrement_update_count( 'translation' ); $update_actions = array( 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), __( 'Go to WordPress Updates page' ) ), ); $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); if ( $update_actions && $this->display_footer_actions ) { $this->feedback( implode( ' | ', $update_actions ) ); } } } is_vcs_checkout( WP_CONTENT_DIR ) ) { return; } foreach ( $language_updates as $key => $language_update ) { $update = ! empty( $language_update->autoupdate ); $update = apply_filters( 'async_update_translation', $update, $language_update ); if ( ! $update ) { unset( $language_updates[ $key ] ); } } if ( empty( $language_updates ) ) { return; } if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) { $skin = $upgrader->skin; } else { $skin = new Language_Pack_Upgrader_Skin( array( 'skip_header_footer' => true, ) ); } $lp_upgrader = new Language_Pack_Upgrader( $skin ); $lp_upgrader->bulk_upgrade( $language_updates ); } public function upgrade_strings() { $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while they are updated as well.' ); $this->strings['up_to_date'] = __( 'Your translations are all up to date.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['process_failed'] = __( 'Translation update failed.' ); $this->strings['process_success'] = __( 'Translation updated successfully.' ); $this->strings['remove_old'] = __( 'Removing the old version of the translation…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old translation.' ); } public function upgrade( $update = false, $args = array() ) { if ( $update ) { $update = array( $update ); } $results = $this->bulk_upgrade( $update, $args ); if ( ! is_array( $results ) ) { return $results; } return $results[0]; } public function bulk_upgrade( $language_updates = array(), $args = array() ) { global $wp_filesystem; $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); if ( ! $language_updates ) { $language_updates = wp_get_translation_updates(); } if ( empty( $language_updates ) ) { $this->skin->header(); $this->skin->set_result( true ); $this->skin->feedback( 'up_to_date' ); $this->skin->bulk_footer(); $this->skin->footer(); return true; } if ( 'upgrader_process_complete' === current_filter() ) { $this->skin->feedback( 'starting_upgrade' ); } remove_all_filters( 'upgrader_pre_install' ); remove_all_filters( 'upgrader_clear_destination' ); remove_all_filters( 'upgrader_post_install' ); remove_all_filters( 'upgrader_source_selection' ); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $results = array(); $this->update_count = count( $language_updates ); $this->update_current = 0; $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR ); if ( ! $wp_filesystem->exists( $remote_destination ) ) { if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination ); } } $language_updates_results = array(); foreach ( $language_updates as $language_update ) { $this->skin->language_update = $language_update; $destination = WP_LANG_DIR; if ( 'plugin' === $language_update->type ) { $destination .= '/plugins'; } elseif ( 'theme' === $language_update->type ) { $destination .= '/themes'; } $this->update_current++; $options = array( 'package' => $language_update->package, 'destination' => $destination, 'clear_destination' => true, 'abort_if_destination_exists' => false, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'language_update_type' => $language_update->type, 'language_update' => $language_update, ), ); $result = $this->run( $options ); $results[] = $this->result; if ( false === $result ) { break; } $language_updates_results[] = array( 'language' => $language_update->language, 'type' => $language_update->type, 'slug' => isset( $language_update->slug ) ? $language_update->slug : 'default', 'version' => $language_update->version, ); } remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); remove_action( 'upgrader_process_complete', 'wp_version_check' ); remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); remove_action( 'upgrader_process_complete', 'wp_update_themes' ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'translation', 'bulk' => true, 'translations' => $language_updates_results, ) ); add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( $parsed_args['clear_update_cache'] ) { wp_clean_update_cache(); } return $results; } public function check_package( $source, $remote_source ) { global $wp_filesystem; if ( is_wp_error( $source ) ) { return $source; } $files = $wp_filesystem->dirlist( $remote_source ); $po = false; $mo = false; foreach ( (array) $files as $file => $filedata ) { if ( '.po' === substr( $file, -3 ) ) { $po = true; } elseif ( '.mo' === substr( $file, -3 ) ) { $mo = true; } } if ( ! $mo || ! $po ) { return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'], sprintf( __( 'The language pack is missing either the %1$s or %2$s files.' ), '.po', '.mo' ) ); } return $source; } public function get_name_for_update( $update ) { switch ( $update->type ) { case 'core': return 'WordPress'; case 'theme': $theme = wp_get_theme( $update->slug ); if ( $theme->exists() ) { return $theme->Get( 'Name' ); } break; case 'plugin': $plugin_data = get_plugins( '/' . $update->slug ); $plugin_data = reset( $plugin_data ); if ( $plugin_data ) { return $plugin_data['Name']; } break; } return ''; } public function clear_destination( $remote_destination ) { global $wp_filesystem; $language_update = $this->skin->language_update; $language_directory = WP_LANG_DIR . '/'; if ( 'core' === $language_update->type ) { $files = array( $remote_destination . $language_update->language . '.po', $remote_destination . $language_update->language . '.mo', $remote_destination . 'admin-' . $language_update->language . '.po', $remote_destination . 'admin-' . $language_update->language . '.mo', $remote_destination . 'admin-network-' . $language_update->language . '.po', $remote_destination . 'admin-network-' . $language_update->language . '.mo', $remote_destination . 'continents-cities-' . $language_update->language . '.po', $remote_destination . 'continents-cities-' . $language_update->language . '.mo', ); $json_translation_files = glob( $language_directory . $language_update->language . '-*.json' ); if ( $json_translation_files ) { foreach ( $json_translation_files as $json_translation_file ) { $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); } } } else { $files = array( $remote_destination . $language_update->slug . '-' . $language_update->language . '.po', $remote_destination . $language_update->slug . '-' . $language_update->language . '.mo', ); $language_directory = $language_directory . $language_update->type . 's/'; $json_translation_files = glob( $language_directory . $language_update->slug . '-' . $language_update->language . '-*.json' ); if ( $json_translation_files ) { foreach ( $json_translation_files as $json_translation_file ) { $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); } } } $files = array_filter( $files, array( $wp_filesystem, 'exists' ) ); if ( ! $files ) { return true; } $unwritable_files = array(); foreach ( $files as $file ) { if ( ! $wp_filesystem->is_writable( $file ) ) { $wp_filesystem->chmod( $file, FS_CHMOD_FILE ); if ( ! $wp_filesystem->is_writable( $file ) ) { $unwritable_files[] = $file; } } } if ( ! empty( $unwritable_files ) ) { return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) ); } foreach ( $files as $file ) { if ( ! $wp_filesystem->delete( $file ) ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } } return true; } } 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '', 'overwrite' => '', ); $args = wp_parse_args( $args, $defaults ); $this->type = $args['type']; $this->url = $args['url']; $this->api = isset( $args['api'] ) ? $args['api'] : array(); $this->overwrite = $args['overwrite']; parent::__construct( $args ); } public function before() { if ( ! empty( $this->api ) ) { $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version ); } } public function hide_process_failed( $wp_error ) { if ( 'upload' === $this->type && '' === $this->overwrite && $wp_error->get_error_code() === 'folder_exists' ) { return true; } return false; } public function after() { if ( $this->do_overwrite() ) { return; } $plugin_file = $this->upgrader->plugin_info(); $install_actions = array(); $from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins'; if ( 'import' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin & Run Importer' ) ); } elseif ( 'press-this' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin & Go to Press This' ) ); } else { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin' ) ); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $install_actions['network_activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&networkwide=1&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Network Activate' ) ); unset( $install_actions['activate_plugin'] ); } if ( 'import' === $from ) { $install_actions['importers_page'] = sprintf( '%s', admin_url( 'import.php' ), __( 'Go to Importers' ) ); } elseif ( 'web' === $this->type ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), __( 'Go to Plugin Installer' ) ); } elseif ( 'upload' === $this->type && 'plugins' === $from ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), __( 'Go to Plugin Installer' ) ); } else { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugins.php' ), __( 'Go to Plugins page' ) ); } if ( ! $this->result || is_wp_error( $this->result ) ) { unset( $install_actions['activate_plugin'], $install_actions['network_activate'] ); } elseif ( ! current_user_can( 'activate_plugin', $plugin_file ) || is_plugin_active( $plugin_file ) ) { unset( $install_actions['activate_plugin'] ); } $install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file ); if ( ! empty( $install_actions ) ) { $this->feedback( implode( ' ', (array) $install_actions ) ); } } private function do_overwrite() { if ( 'upload' !== $this->type || ! is_wp_error( $this->result ) || 'folder_exists' !== $this->result->get_error_code() ) { return false; } $folder = $this->result->get_error_data( 'folder_exists' ); $folder = ltrim( substr( $folder, strlen( WP_PLUGIN_DIR ) ), '/' ); $current_plugin_data = false; $all_plugins = get_plugins(); foreach ( $all_plugins as $plugin => $plugin_data ) { if ( strrpos( $plugin, $folder ) !== 0 ) { continue; } $current_plugin_data = $plugin_data; } $new_plugin_data = $this->upgrader->new_plugin_data; if ( ! $current_plugin_data || ! $new_plugin_data ) { return false; } echo '

    ' . esc_html__( 'This plugin is already installed.' ) . '

    '; $this->is_downgrading = version_compare( $current_plugin_data['Version'], $new_plugin_data['Version'], '>' ); $rows = array( 'Name' => __( 'Plugin name' ), 'Version' => __( 'Version' ), 'Author' => __( 'Author' ), 'RequiresWP' => __( 'Required WordPress version' ), 'RequiresPHP' => __( 'Required PHP version' ), ); $table = ''; $table .= ''; $table .= ''; $is_same_plugin = true; foreach ( $rows as $field => $label ) { $old_value = ! empty( $current_plugin_data[ $field ] ) ? (string) $current_plugin_data[ $field ] : '-'; $new_value = ! empty( $new_plugin_data[ $field ] ) ? (string) $new_plugin_data[ $field ] : '-'; $is_same_plugin = $is_same_plugin && ( $old_value === $new_value ); $diff_field = ( 'Version' !== $field && $new_value !== $old_value ); $diff_version = ( 'Version' === $field && $this->is_downgrading ); $table .= ''; $table .= ( $diff_field || $diff_version ) ? ''; } $table .= '
    ' . esc_html_x( 'Current', 'plugin' ) . '' . esc_html_x( 'Uploaded', 'plugin' ) . '
    ' . $label . '' . wp_strip_all_tags( $old_value ) . '' : ''; $table .= wp_strip_all_tags( $new_value ) . '
    '; echo apply_filters( 'install_plugin_overwrite_comparison', $table, $current_plugin_data, $new_plugin_data ); $install_actions = array(); $can_update = true; $blocked_message = '

    ' . esc_html__( 'The plugin cannot be updated due to the following:' ) . '

    '; $blocked_message .= '
      '; $requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null; $requires_wp = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), phpversion(), $requires_php ); $blocked_message .= '
    • ' . esc_html( $error ) . '
    • '; $can_update = false; } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), get_bloginfo( 'version' ), $requires_wp ); $blocked_message .= '
    • ' . esc_html( $error ) . '
    • '; $can_update = false; } $blocked_message .= '
    '; if ( $can_update ) { if ( $this->is_downgrading ) { $warning = sprintf( __( 'You are uploading an older version of a current plugin. You can continue to install the older version, but be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } else { $warning = sprintf( __( 'You are updating a plugin. Be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } echo '

    ' . $warning . '

    '; $overwrite = $this->is_downgrading ? 'downgrade-plugin' : 'update-plugin'; $install_actions['overwrite_plugin'] = sprintf( '%s', wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'plugin-upload' ), _x( 'Replace current with uploaded', 'plugin' ) ); } else { echo $blocked_message; } $cancel_url = add_query_arg( 'action', 'upload-plugin-cancel-overwrite', $this->url ); $install_actions['plugins_page'] = sprintf( '%s', wp_nonce_url( $cancel_url, 'plugin-upload-cancel-overwrite' ), __( 'Cancel and go back' ) ); $install_actions = apply_filters( 'install_plugin_overwrite_actions', $install_actions, $this->api, $new_plugin_data ); if ( ! empty( $install_actions ) ) { printf( '', __( 'The uploaded file has expired. Please go back and upload it again.' ) ); echo '

    ' . implode( ' ', (array) $install_actions ) . '

    '; } return true; } } zipname = $p_zipname; $this->zip_fd = 0; $this->magic_quotes_status = -1; return; } public function PclZip($p_zipname) { self::__construct($p_zipname); } function create($p_filelist) { $v_result=1; $this->privErrorReset(); $v_options = array(); $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_size = func_num_args(); if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_ADD => 'optional', PCLZIP_CB_POST_ADD => 'optional', PCLZIP_OPT_NO_COMPRESSION => 'optional', PCLZIP_OPT_COMMENT => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } } else { $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; if ($v_size == 2) { $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $v_string_list = array(); $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); if (is_array($p_filelist)) { if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } else { $v_string_list = $p_filelist; } } else if (is_string($p_filelist)) { $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); return 0; } if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { if ($v_string != '') { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } else { } } } $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); if ($v_result != 1) { return 0; } } $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); if ($v_result != 1) { return 0; } $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); if ($v_result != 1) { return 0; } return $p_result_list; } function add($p_filelist) { $v_result=1; $this->privErrorReset(); $v_options = array(); $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_size = func_num_args(); if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_ADD => 'optional', PCLZIP_CB_POST_ADD => 'optional', PCLZIP_OPT_NO_COMPRESSION => 'optional', PCLZIP_OPT_COMMENT => 'optional', PCLZIP_OPT_ADD_COMMENT => 'optional', PCLZIP_OPT_PREPEND_COMMENT => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } } else { $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; if ($v_size == 2) { $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $v_string_list = array(); $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); if (is_array($p_filelist)) { if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } else { $v_string_list = $p_filelist; } } else if (is_string($p_filelist)) { $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); return 0; } if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } } $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); if ($v_result != 1) { return 0; } } $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); if ($v_result != 1) { return 0; } $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); if ($v_result != 1) { return 0; } return $p_result_list; } function listContent() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $p_list = array(); if (($v_result = $this->privList($p_list)) != 1) { unset($p_list); return(0); } return $p_list; } function extract() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_path = ''; $v_remove_path = ""; $v_remove_all_path = false; $v_size = func_num_args(); $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; if ($v_size > 0) { $v_arg_list = func_get_args(); if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_PATH => 'optional', PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_EXTRACT => 'optional', PCLZIP_CB_POST_EXTRACT => 'optional', PCLZIP_OPT_SET_CHMOD => 'optional', PCLZIP_OPT_BY_NAME => 'optional', PCLZIP_OPT_BY_EREG => 'optional', PCLZIP_OPT_BY_PREG => 'optional', PCLZIP_OPT_BY_INDEX => 'optional', PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', PCLZIP_OPT_REPLACE_NEWER => 'optional' ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } if (isset($v_options[PCLZIP_OPT_PATH])) { $v_path = $v_options[PCLZIP_OPT_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { $v_path .= '/'; } $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; } } else { $v_path = $v_arg_list[0]; if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $p_list = array(); $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options); if ($v_result < 1) { unset($p_list); return(0); } return $p_list; } function extractByIndex($p_index) { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_path = ''; $v_remove_path = ""; $v_remove_all_path = false; $v_size = func_num_args(); $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_PATH => 'optional', PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_EXTRACT => 'optional', PCLZIP_CB_POST_EXTRACT => 'optional', PCLZIP_OPT_SET_CHMOD => 'optional', PCLZIP_OPT_REPLACE_NEWER => 'optional' ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } if (isset($v_options[PCLZIP_OPT_PATH])) { $v_path = $v_options[PCLZIP_OPT_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { $v_path .= '/'; } $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; } if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; } else { } } else { $v_path = $v_arg_list[0]; if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); $v_options_trick = array(); $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional' )); if ($v_result != 1) { return 0; } $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; $this->privOptionDefaultThreshold($v_options); if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { return(0); } return $p_list; } function delete() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_size = func_num_args(); if ($v_size > 0) { $v_arg_list = func_get_args(); $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_BY_NAME => 'optional', PCLZIP_OPT_BY_EREG => 'optional', PCLZIP_OPT_BY_PREG => 'optional', PCLZIP_OPT_BY_INDEX => 'optional' )); if ($v_result != 1) { return 0; } } $this->privDisableMagicQuotes(); $v_list = array(); if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { $this->privSwapBackMagicQuotes(); unset($v_list); return(0); } $this->privSwapBackMagicQuotes(); return $v_list; } function deleteByIndex($p_index) { $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); return $p_list; } function properties() { $this->privErrorReset(); $this->privDisableMagicQuotes(); if (!$this->privCheckFormat()) { $this->privSwapBackMagicQuotes(); return(0); } $v_prop = array(); $v_prop['comment'] = ''; $v_prop['nb'] = 0; $v_prop['status'] = 'not_exist'; if (@is_file($this->zipname)) { if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); return 0; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privSwapBackMagicQuotes(); return 0; } $this->privCloseFd(); $v_prop['comment'] = $v_central_dir['comment']; $v_prop['nb'] = $v_central_dir['entries']; $v_prop['status'] = 'ok'; } $this->privSwapBackMagicQuotes(); return $v_prop; } function duplicate($p_archive) { $v_result = 1; $this->privErrorReset(); if (is_object($p_archive) && $p_archive instanceof pclzip) { $v_result = $this->privDuplicate($p_archive->zipname); } else if (is_string($p_archive)) { if (!is_file($p_archive)) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); $v_result = PCLZIP_ERR_MISSING_FILE; } else { $v_result = $this->privDuplicate($p_archive); } } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); $v_result = PCLZIP_ERR_INVALID_PARAMETER; } return $v_result; } function merge($p_archive_to_add) { $v_result = 1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip) { $v_result = $this->privMerge($p_archive_to_add); } else if (is_string($p_archive_to_add)) { $v_object_archive = new PclZip($p_archive_to_add); $v_result = $this->privMerge($v_object_archive); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); $v_result = PCLZIP_ERR_INVALID_PARAMETER; } return $v_result; } function errorCode() { if (PCLZIP_ERROR_EXTERNAL == 1) { return(PclErrorCode()); } else { return($this->error_code); } } function errorName($p_with_code=false) { $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE' ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' ); if (isset($v_name[$this->error_code])) { $v_value = $v_name[$this->error_code]; } else { $v_value = 'NoName'; } if ($p_with_code) { return($v_value.' ('.$this->error_code.')'); } else { return($v_value); } } function errorInfo($p_full=false) { if (PCLZIP_ERROR_EXTERNAL == 1) { return(PclErrorString()); } else { if ($p_full) { return($this->errorName(true)." : ".$this->error_string); } else { return($this->error_string." [code ".$this->error_code."]"); } } } function privCheckFormat($p_level=0) { $v_result = true; clearstatcache(); $this->privErrorReset(); if (!is_file($this->zipname)) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); return(false); } if (!is_readable($this->zipname)) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); return(false); } return $v_result; } function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) { $v_result=1; $i=0; while ($i<$p_size) { if (!isset($v_requested_options[$p_options_list[$i]])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); return PclZip::errorCode(); } switch ($p_options_list[$i]) { case PCLZIP_OPT_PATH : case PCLZIP_OPT_REMOVE_PATH : case PCLZIP_OPT_ADD_PATH : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); $i++; break; case PCLZIP_OPT_TEMP_FILE_THRESHOLD : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } $v_value = $p_options_list[$i+1]; if ((!is_integer($v_value)) || ($v_value<0)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $v_value*1048576; $i++; break; case PCLZIP_OPT_TEMP_FILE_ON : if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = true; break; case PCLZIP_OPT_TEMP_FILE_OFF : if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); return PclZip::errorCode(); } if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = true; break; case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if ( is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) { $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); $i++; } else { } break; case PCLZIP_OPT_BY_NAME : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; } else if (is_array($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_BY_EREG : $p_options_list[$i] = PCLZIP_OPT_BY_PREG; case PCLZIP_OPT_BY_PREG : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_COMMENT : case PCLZIP_OPT_ADD_COMMENT : case PCLZIP_OPT_PREPEND_COMMENT : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_BY_INDEX : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_work_list = array(); if (is_string($p_options_list[$i+1])) { $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); $v_work_list = explode(",", $p_options_list[$i+1]); } else if (is_integer($p_options_list[$i+1])) { $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; } else if (is_array($p_options_list[$i+1])) { $v_work_list = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_sort_flag=false; $v_sort_value=0; for ($j=0; $j= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; $i++; break; case PCLZIP_CB_PRE_EXTRACT : case PCLZIP_CB_POST_EXTRACT : case PCLZIP_CB_PRE_ADD : case PCLZIP_CB_POST_ADD : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_function_name = $p_options_list[$i+1]; if (!function_exists($v_function_name)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $v_function_name; $i++; break; default : PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" .$p_options_list[$i]."'"); return PclZip::errorCode(); } $i++; } if ($v_requested_options !== false) { for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { if ($v_requested_options[$key] == 'mandatory') { if (!isset($v_result_list[$key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); return PclZip::errorCode(); } } } } if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { } return $v_result; } function privOptionDefaultThreshold(&$p_options) { $v_result=1; if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { return $v_result; } $v_memory_limit = ini_get('memory_limit'); $v_memory_limit = trim($v_memory_limit); $v_memory_limit_int = (int) $v_memory_limit; $last = strtolower(substr($v_memory_limit, -1)); if($last == 'g') $v_memory_limit_int = $v_memory_limit_int*1073741824; if($last == 'm') $v_memory_limit_int = $v_memory_limit_int*1048576; if($last == 'k') $v_memory_limit_int = $v_memory_limit_int*1024; $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO); if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); } return $v_result; } function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) { $v_result=1; foreach ($p_file_list as $v_key => $v_value) { if (!isset($v_requested_options[$v_key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); return PclZip::errorCode(); } switch ($v_key) { case PCLZIP_ATT_FILE_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['filename'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_NEW_SHORT_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['new_short_name'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_NEW_FULL_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['new_full_name'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_COMMENT : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['comment'] = $v_value; break; case PCLZIP_ATT_FILE_MTIME : if (!is_integer($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['mtime'] = $v_value; break; case PCLZIP_ATT_FILE_CONTENT : $p_filedescr['content'] = $v_value; break; default : PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'"); return PclZip::errorCode(); } if ($v_requested_options !== false) { for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { if ($v_requested_options[$key] == 'mandatory') { if (!isset($p_file_list[$key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); return PclZip::errorCode(); } } } } } return $v_result; } function privFileDescrExpand(&$p_filedescr_list, &$p_options) { $v_result=1; $v_result_list = array(); for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options); $v_result_list[sizeof($v_result_list)] = $v_descr; if ($v_descr['type'] == 'folder') { $v_dirlist_descr = array(); $v_dirlist_nb = 0; if ($v_folder_handler = @opendir($v_descr['filename'])) { while (($v_item_handler = @readdir($v_folder_handler)) !== false) { if (($v_item_handler == '.') || ($v_item_handler == '..')) { continue; } $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; if (($v_descr['stored_filename'] != $v_descr['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { if ($v_descr['stored_filename'] != '') { $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; } else { $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; } } $v_dirlist_nb++; } @closedir($v_folder_handler); } else { } if ($v_dirlist_nb != 0) { if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { return $v_result; } $v_result_list = array_merge($v_result_list, $v_dirlist_descr); } else { } unset($v_dirlist_descr); } } $p_filedescr_list = $v_result_list; return $v_result; } function privCreate($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); $this->privDisableMagicQuotes(); if (($v_result = $this->privOpenFd('wb')) != 1) { return $v_result; } $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privAdd($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); return $v_result; } $this->privDisableMagicQuotes(); if (($v_result=$this->privOpenFd('rb')) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } @rewind($this->zip_fd); $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = $v_central_dir['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $v_header_list = array(); if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { fclose($v_zip_temp_fd); $this->privCloseFd(); @unlink($v_zip_temp_name); $this->privSwapBackMagicQuotes(); return $v_result; } $v_offset = @ftell($this->zip_fd); $v_size = $v_central_dir['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_zip_temp_fd, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { fclose($v_zip_temp_fd); $this->privCloseFd(); @unlink($v_zip_temp_name); $this->privSwapBackMagicQuotes(); return $v_result; } $v_count++; } $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = $v_central_dir['comment']; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; } if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; } $v_size = @ftell($this->zip_fd)-$v_offset; if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); $this->privSwapBackMagicQuotes(); return $v_result; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $this->privCloseFd(); @fclose($v_zip_temp_fd); $this->privSwapBackMagicQuotes(); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); return $v_result; } function privOpenFd($p_mode) { $v_result=1; if ($this->zip_fd != 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); return PclZip::errorCode(); } if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); return PclZip::errorCode(); } return $v_result; } function privCloseFd() { $v_result=1; if ($this->zip_fd != 0) @fclose($this->zip_fd); $this->zip_fd = 0; return $v_result; } function privAddList($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_header_list = array(); if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { return $v_result; } $v_offset = @ftell($this->zip_fd); for ($i=0,$v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { return $v_result; } $v_count++; } $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = ''; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } $v_size = @ftell($this->zip_fd)-$v_offset; if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); return $v_result; } return $v_result; } function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_header = array(); $v_nb = sizeof($p_result_list); for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, $p_options); if ($v_result != 1) { return $v_result; } $p_result_list[$v_nb++] = $v_header; } } return $v_result; } function privAddFile($p_filedescr, &$p_header, &$p_options) { $v_result=1; $p_filename = $p_filedescr['filename']; if ($p_filename == "") { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); return PclZip::errorCode(); } clearstatcache(); $p_header['version'] = 20; $p_header['version_extracted'] = 10; $p_header['flag'] = 0; $p_header['compression'] = 0; $p_header['crc'] = 0; $p_header['compressed_size'] = 0; $p_header['filename_len'] = strlen($p_filename); $p_header['extra_len'] = 0; $p_header['disk'] = 0; $p_header['internal'] = 0; $p_header['offset'] = 0; $p_header['filename'] = $p_filename; $p_header['stored_filename'] = $p_filedescr['stored_filename']; $p_header['extra'] = ''; $p_header['status'] = 'ok'; $p_header['index'] = -1; if ($p_filedescr['type']=='file') { $p_header['external'] = 0x00000000; $p_header['size'] = filesize($p_filename); } else if ($p_filedescr['type']=='folder') { $p_header['external'] = 0x00000010; $p_header['mtime'] = filemtime($p_filename); $p_header['size'] = filesize($p_filename); } else if ($p_filedescr['type'] == 'virtual_file') { $p_header['external'] = 0x00000000; $p_header['size'] = strlen($p_filedescr['content']); } if (isset($p_filedescr['mtime'])) { $p_header['mtime'] = $p_filedescr['mtime']; } else if ($p_filedescr['type'] == 'virtual_file') { $p_header['mtime'] = time(); } else { $p_header['mtime'] = filemtime($p_filename); } if (isset($p_filedescr['comment'])) { $p_header['comment_len'] = strlen($p_filedescr['comment']); $p_header['comment'] = $p_filedescr['comment']; } else { $p_header['comment_len'] = 0; $p_header['comment'] = ''; } if (isset($p_options[PCLZIP_CB_PRE_ADD])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_header, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); if ($v_result == 0) { $p_header['status'] = "skipped"; $v_result = 1; } if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); } } if ($p_header['stored_filename'] == "") { $p_header['status'] = "filtered"; } if (strlen($p_header['stored_filename']) > 0xFF) { $p_header['status'] = 'filename_too_long'; } if ($p_header['status'] == 'ok') { if ($p_filedescr['type'] == 'file') { if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); if ($v_result < PCLZIP_ERR_NO_ERROR) { return $v_result; } } else { if (($v_file = @fopen($p_filename, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); return PclZip::errorCode(); } if ($p_header['size'] > 0) { $v_content = @fread($v_file, $p_header['size']); } else { $v_content = ''; } @fclose($v_file); $p_header['crc'] = @crc32($v_content); if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } else { $v_content = @gzdeflate($v_content); $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); return $v_result; } @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); } } else if ($p_filedescr['type'] == 'virtual_file') { $v_content = $p_filedescr['content']; $p_header['crc'] = @crc32($v_content); if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } else { $v_content = @gzdeflate($v_content); $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); return $v_result; } @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); } else if ($p_filedescr['type'] == 'folder') { if (@substr($p_header['stored_filename'], -1) != '/') { $p_header['stored_filename'] .= '/'; } $p_header['size'] = 0; $p_header['external'] = 0x00000010; if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { return $v_result; } } } if (isset($p_options[PCLZIP_CB_POST_ADD])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_header, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); if ($v_result == 0) { $v_result = 1; } } return $v_result; } function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) { $v_result=PCLZIP_ERR_NO_ERROR; $p_filename = $p_filedescr['filename']; if (($v_file = @fopen($p_filename, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); return PclZip::errorCode(); } $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { fclose($v_file); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = filesize($p_filename); while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_file, $v_read_size); @gzputs($v_file_compressed, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_file); @gzclose($v_file_compressed); if (filesize($v_gzip_temp_name) < 18) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); return PclZip::errorCode(); } if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } $v_binary_data = @fread($v_file_compressed, 10); $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); $v_data_header['os'] = bin2hex($v_data_header['os']); @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); $v_binary_data = @fread($v_file_compressed, 8); $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); $p_header['compression'] = ord($v_data_header['cm']); $p_header['crc'] = $v_data_footer['crc']; $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; @fclose($v_file_compressed); if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { return $v_result; } if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } fseek($v_file_compressed, 10); $v_size = $p_header['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_file_compressed, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_file_compressed); @unlink($v_gzip_temp_name); return $v_result; } function privCalculateStoredFilename(&$p_filedescr, &$p_options) { $v_result=1; $p_filename = $p_filedescr['filename']; if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; } else { $p_add_dir = ''; } if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; } else { $p_remove_dir = ''; } if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } else { $p_remove_all_dir = 0; } if (isset($p_filedescr['new_full_name'])) { $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); } else { if (isset($p_filedescr['new_short_name'])) { $v_path_info = pathinfo($p_filename); $v_dir = ''; if ($v_path_info['dirname'] != '') { $v_dir = $v_path_info['dirname'].'/'; } $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; } else { $v_stored_filename = $p_filename; } if ($p_remove_all_dir) { $v_stored_filename = basename($p_filename); } else if ($p_remove_dir != "") { if (substr($p_remove_dir, -1) != '/') $p_remove_dir .= "/"; if ( (substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { if ( (substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { $p_remove_dir = "./".$p_remove_dir; } if ( (substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { $p_remove_dir = substr($p_remove_dir, 2); } } $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename); if ($v_compare > 0) { if ($v_compare == 2) { $v_stored_filename = ""; } else { $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir)); } } } $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); if ($p_add_dir != "") { if (substr($p_add_dir, -1) == "/") $v_stored_filename = $p_add_dir.$v_stored_filename; else $v_stored_filename = $p_add_dir."/".$v_stored_filename; } } $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); $p_filedescr['stored_filename'] = $v_stored_filename; return $v_result; } function privWriteFileHeader(&$p_header) { $v_result=1; $p_header['offset'] = ftell($this->zip_fd); $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); fputs($this->zip_fd, $v_binary_data, 30); if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } return $v_result; } function privWriteCentralFileHeader(&$p_header) { $v_result=1; $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); fputs($this->zip_fd, $v_binary_data, 46); if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } if ($p_header['comment_len'] != 0) { fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); } return $v_result; } function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) { $v_result=1; $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); fputs($this->zip_fd, $v_binary_data, 22); if (strlen($p_comment) != 0) { fputs($this->zip_fd, $p_comment, strlen($p_comment)); } return $v_result; } function privList(&$p_list) { $v_result=1; $this->privDisableMagicQuotes(); if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); return PclZip::errorCode(); } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_central_dir['offset'])) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } for ($i=0; $i<$v_central_dir['entries']; $i++) { if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_header['index'] = $i; $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); unset($v_header); } $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privConvertHeader2FileInfo($p_header, &$p_info) { $v_result=1; $v_temp_path = PclZipUtilPathReduction($p_header['filename']); $p_info['filename'] = $v_temp_path; $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); $p_info['stored_filename'] = $v_temp_path; $p_info['size'] = $p_header['size']; $p_info['compressed_size'] = $p_header['compressed_size']; $p_info['mtime'] = $p_header['mtime']; $p_info['comment'] = $p_header['comment']; $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); $p_info['index'] = $p_header['index']; $p_info['status'] = $p_header['status']; $p_info['crc'] = $p_header['crc']; return $v_result; } function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) { $v_result=1; $this->privDisableMagicQuotes(); if ( ($p_path == "") || ( (substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path,1,2)!=":/"))) $p_path = "./".$p_path; if (($p_path != "./") && ($p_path != "/")) { while (substr($p_path, -1) == "/") { $p_path = substr($p_path, 0, strlen($p_path)-1); } } if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { $p_remove_path .= '/'; } $p_remove_path_size = strlen($p_remove_path); if (($v_result = $this->privOpenFd('rb')) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_pos_entry = $v_central_dir['offset']; $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_pos_entry)) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_header = array(); if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_header['index'] = $i; $v_pos_entry = ftell($this->zip_fd); $v_extract = false; if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_extract = true; } } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { $v_extract = true; } } } else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { $v_extract = true; } } else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_extract = true; } if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { $j_start = $j+1; } if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { break; } } } else { $v_extract = true; } if ( ($v_extract) && ( ($v_header['compression'] != 8) && ($v_header['compression'] != 0))) { $v_header['status'] = 'unsupported_compression'; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is " ."compressed by an unsupported compression " ."method (".$v_header['compression'].") "); return PclZip::errorCode(); } } if (($v_extract) && (($v_header['flag'] & 1) == 1)) { $v_header['status'] = 'unsupported_encryption'; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for " ." filename '".$v_header['stored_filename'] ."'"); return PclZip::errorCode(); } } if (($v_extract) && ($v_header['status'] != 'ok')) { $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]); if ($v_result != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_extract = false; } if ($v_extract) { @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_header['offset'])) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { $v_string = ''; $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $p_file_list[$v_nb_extracted]['content'] = $v_string; $v_nb_extracted++; if ($v_result1 == 2) { break; } } elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } if ($v_result1 == 2) { break; } } else { $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } if ($v_result1 == 2) { break; } } } } $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) { $v_result=1; if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if ($p_remove_all_path == true) { if (($p_entry['external']&0x00000010)==0x00000010) { $p_entry['status'] = "filtered"; return $v_result; } $p_entry['filename'] = basename($p_entry['filename']); } else if ($p_remove_path != "") { if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { $p_entry['status'] = "filtered"; return $v_result; } $p_remove_path_size = strlen($p_remove_path); if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) { $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); } } if ($p_path != '') { $p_entry['filename'] = $p_path."/".$p_entry['filename']; } if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); if ($v_inclusion == 0) { PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is " ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); return PclZip::errorCode(); } } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (file_exists($p_entry['filename'])) { if (is_dir($p_entry['filename'])) { $p_entry['status'] = "already_a_directory"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is " ."already used by an existing directory"); return PclZip::errorCode(); } } else if (!is_writeable($p_entry['filename'])) { $p_entry['status'] = "write_protected"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists " ."and is write protected"); return PclZip::errorCode(); } } else if (filemtime($p_entry['filename']) > $p_entry['mtime']) { if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { } else { $p_entry['status'] = "newer_exist"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists " ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); return PclZip::errorCode(); } } } else { } } else { if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) $v_dir_to_check = $p_entry['filename']; else if (!strstr($p_entry['filename'], "/")) $v_dir_to_check = ""; else $v_dir_to_check = dirname($p_entry['filename']); if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { $p_entry['status'] = "path_creation_fail"; $v_result = 1; } } } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compression'] == 0) { if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } $v_size = $p_entry['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } fclose($v_dest_file); touch($p_entry['filename'], $p_entry['mtime']); } else { if (($p_entry['flag'] & 1) == 1) { PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); return PclZip::errorCode(); } if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); if ($v_result < PCLZIP_ERR_NO_ERROR) { return $v_result; } } else { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } $v_file_content = @gzinflate($v_buffer); unset($v_buffer); if ($v_file_content === FALSE) { $p_entry['status'] = "error"; return $v_result; } if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } @fwrite($v_dest_file, $v_file_content, $p_entry['size']); unset($v_file_content); @fclose($v_dest_file); } @touch($p_entry['filename'], $p_entry['mtime']); } if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); } } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privExtractFileUsingTempFile(&$p_entry, &$p_options) { $v_result=1; $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { fclose($v_file); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); @fwrite($v_dest_file, $v_binary_data, 10); $v_size = $p_entry['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); @fwrite($v_dest_file, $v_binary_data, 8); @fclose($v_dest_file); if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { @fclose($v_dest_file); $p_entry['status'] = "read_error"; PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } $v_size = $p_entry['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($v_src_file, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_dest_file); @gzclose($v_src_file); @unlink($v_gzip_temp_name); return $v_result; } function privExtractFileInOutput(&$p_entry, &$p_options) { $v_result=1; if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compressed_size'] == $p_entry['size']) { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } echo $v_buffer; unset($v_buffer); } else { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } $v_file_content = gzinflate($v_buffer); unset($v_buffer); echo $v_file_content; unset($v_file_content); } } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) { $v_result=1; $v_header = array(); if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compression'] == 0) { if ($p_entry['compressed_size'] > 0) { $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $p_string = ''; } } else { if ($p_entry['compressed_size'] > 0) { $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_data = ''; } if (($p_string = @gzinflate($v_data)) === FALSE) { } } } else { } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_local_header['content'] = $p_string; $p_string = ''; $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); $p_string = $v_local_header['content']; unset($v_local_header['content']); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privReadFileHeader(&$p_header) { $v_result=1; $v_binary_data = @fread($this->zip_fd, 4); $v_data = unpack('Vid', $v_binary_data); if ($v_data['id'] != 0x04034b50) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); return PclZip::errorCode(); } $v_binary_data = fread($this->zip_fd, 26); if (strlen($v_binary_data) != 26) { $p_header['filename'] = ""; $p_header['status'] = "invalid_header"; PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); if ($v_data['extra_len'] != 0) { $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); } else { $p_header['extra'] = ''; } $p_header['version_extracted'] = $v_data['version']; $p_header['compression'] = $v_data['compression']; $p_header['size'] = $v_data['size']; $p_header['compressed_size'] = $v_data['compressed_size']; $p_header['crc'] = $v_data['crc']; $p_header['flag'] = $v_data['flag']; $p_header['filename_len'] = $v_data['filename_len']; $p_header['mdate'] = $v_data['mdate']; $p_header['mtime'] = $v_data['mtime']; if ($p_header['mdate'] && $p_header['mtime']) { $v_hour = ($p_header['mtime'] & 0xF800) >> 11; $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; $v_seconde = ($p_header['mtime'] & 0x001F)*2; $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; $v_month = ($p_header['mdate'] & 0x01E0) >> 5; $v_day = $p_header['mdate'] & 0x001F; $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); } else { $p_header['mtime'] = time(); } $p_header['stored_filename'] = $p_header['filename']; $p_header['status'] = "ok"; return $v_result; } function privReadCentralFileHeader(&$p_header) { $v_result=1; $v_binary_data = @fread($this->zip_fd, 4); $v_data = unpack('Vid', $v_binary_data); if ($v_data['id'] != 0x02014b50) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); return PclZip::errorCode(); } $v_binary_data = fread($this->zip_fd, 42); if (strlen($v_binary_data) != 42) { $p_header['filename'] = ""; $p_header['status'] = "invalid_header"; PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); if ($p_header['filename_len'] != 0) $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); else $p_header['filename'] = ''; if ($p_header['extra_len'] != 0) $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); else $p_header['extra'] = ''; if ($p_header['comment_len'] != 0) $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); else $p_header['comment'] = ''; if (1) { $v_hour = ($p_header['mtime'] & 0xF800) >> 11; $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; $v_seconde = ($p_header['mtime'] & 0x001F)*2; $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; $v_month = ($p_header['mdate'] & 0x01E0) >> 5; $v_day = $p_header['mdate'] & 0x001F; $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); } else { $p_header['mtime'] = time(); } $p_header['stored_filename'] = $p_header['filename']; $p_header['status'] = 'ok'; if (substr($p_header['filename'], -1) == '/') { $p_header['external'] = 0x00000010; } return $v_result; } function privCheckFileHeaders(&$p_local_header, &$p_central_header) { $v_result=1; if ($p_local_header['filename'] != $p_central_header['filename']) { } if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { } if ($p_local_header['flag'] != $p_central_header['flag']) { } if ($p_local_header['compression'] != $p_central_header['compression']) { } if ($p_local_header['mtime'] != $p_central_header['mtime']) { } if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { } if (($p_local_header['flag'] & 8) == 8) { $p_local_header['size'] = $p_central_header['size']; $p_local_header['compressed_size'] = $p_central_header['compressed_size']; $p_local_header['crc'] = $p_central_header['crc']; } return $v_result; } function privReadEndCentralDir(&$p_central_dir) { $v_result=1; $v_size = filesize($this->zipname); @fseek($this->zip_fd, $v_size); if (@ftell($this->zip_fd) != $v_size) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_found = 0; if ($v_size > 26) { @fseek($this->zip_fd, $v_size-22); if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_binary_data = @fread($this->zip_fd, 4); $v_data = @unpack('Vid', $v_binary_data); if ($v_data['id'] == 0x06054b50) { $v_found = 1; } $v_pos = ftell($this->zip_fd); } if (!$v_found) { $v_maximum_size = 65557; if ($v_maximum_size > $v_size) $v_maximum_size = $v_size; @fseek($this->zip_fd, $v_size-$v_maximum_size); if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_pos = ftell($this->zip_fd); $v_bytes = 0x00000000; while ($v_pos < $v_size) { $v_byte = @fread($this->zip_fd, 1); $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); if ($v_bytes == 0x504b0506) { $v_pos++; break; } $v_pos++; } if ($v_pos == $v_size) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); return PclZip::errorCode(); } } $v_binary_data = fread($this->zip_fd, 18); if (strlen($v_binary_data) != 18) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { if (0) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive.' .' Some trailing bytes exists after the archive.'); return PclZip::errorCode(); } } if ($v_data['comment_size'] != 0) { $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); } else $p_central_dir['comment'] = ''; $p_central_dir['entries'] = $v_data['entries']; $p_central_dir['disk_entries'] = $v_data['disk_entries']; $p_central_dir['offset'] = $v_data['offset']; $p_central_dir['size'] = $v_data['size']; $p_central_dir['disk'] = $v_data['disk']; $p_central_dir['disk_start'] = $v_data['disk_start']; return $v_result; } function privDeleteByRule(&$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); if (($v_result=$this->privOpenFd('rb')) != 1) { return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); return $v_result; } @rewind($this->zip_fd); $v_pos_entry = $v_central_dir['offset']; @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_pos_entry)) { $this->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_header_list = array(); $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { $v_header_list[$v_nb_extracted] = array(); if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { $this->privCloseFd(); return $v_result; } $v_header_list[$v_nb_extracted]['index'] = $i; $v_found = false; if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; } elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; } } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { $v_found = true; } } } else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { $v_found = true; } } else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_found = true; } if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { $j_start = $j+1; } if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { break; } } } else { $v_found = true; } if ($v_found) { unset($v_header_list[$v_nb_extracted]); } else { $v_nb_extracted++; } } if ($v_nb_extracted > 0) { $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; $v_temp_zip = new PclZip($v_zip_temp_name); if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { $this->privCloseFd(); return $v_result; } for ($i=0; $izip_fd); if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_local_header = array(); if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { } unset($v_local_header); if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } } $v_offset = @ftell($v_temp_zip->zip_fd); for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = ''; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); unset($v_temp_zip); } else if ($v_central_dir['entries'] != 0) { $this->privCloseFd(); if (($v_result = $this->privOpenFd('wb')) != 1) { return $v_result; } if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { return $v_result; } $this->privCloseFd(); } return $v_result; } function privDirCheck($p_dir, $p_is_dir=false) { $v_result = 1; if (($p_is_dir) && (substr($p_dir, -1)=='/')) { $p_dir = substr($p_dir, 0, strlen($p_dir)-1); } if ((is_dir($p_dir)) || ($p_dir == "")) { return 1; } $p_parent_dir = dirname($p_dir); if ($p_parent_dir != $p_dir) { if ($p_parent_dir != "") { if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) { return $v_result; } } } if (!@mkdir($p_dir, 0777)) { PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); return PclZip::errorCode(); } return $v_result; } function privMerge(&$p_archive_to_add) { $v_result=1; if (!is_file($p_archive_to_add->zipname)) { $v_result = 1; return $v_result; } if (!is_file($this->zipname)) { $v_result = $this->privDuplicate($p_archive_to_add->zipname); return $v_result; } if (($v_result=$this->privOpenFd('rb')) != 1) { return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); return $v_result; } @rewind($this->zip_fd); if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) { $this->privCloseFd(); return $v_result; } $v_central_dir_to_add = array(); if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); return $v_result; } @rewind($p_archive_to_add->zip_fd); $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = $v_central_dir['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_size = $v_central_dir_to_add['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_offset = @ftell($v_zip_temp_fd); $v_size = $v_central_dir['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_size = $v_central_dir_to_add['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; $v_size = @ftell($v_zip_temp_fd)-$v_offset; $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); @fclose($v_zip_temp_fd); $this->zip_fd = null; unset($v_header_list); return $v_result; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $this->privCloseFd(); $p_archive_to_add->privCloseFd(); @fclose($v_zip_temp_fd); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); return $v_result; } function privDuplicate($p_archive_filename) { $v_result=1; if (!is_file($p_archive_filename)) { $v_result = 1; return $v_result; } if (($v_result=$this->privOpenFd('wb')) != 1) { return $v_result; } if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { $this->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = filesize($p_archive_filename); while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($v_zip_temp_fd, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $this->privCloseFd(); @fclose($v_zip_temp_fd); return $v_result; } function privErrorLog($p_error_code=0, $p_error_string='') { if (PCLZIP_ERROR_EXTERNAL == 1) { PclError($p_error_code, $p_error_string); } else { $this->error_code = $p_error_code; $this->error_string = $p_error_string; } } function privErrorReset() { if (PCLZIP_ERROR_EXTERNAL == 1) { PclErrorReset(); } else { $this->error_code = 0; $this->error_string = ''; } } function privDisableMagicQuotes() { $v_result=1; return $v_result; } function privSwapBackMagicQuotes() { $v_result=1; return $v_result; } } function PclZipUtilPathReduction($p_dir) { $v_result = ""; if ($p_dir != "") { $v_list = explode("/", $p_dir); $v_skip = 0; for ($i=sizeof($v_list)-1; $i>=0; $i--) { if ($v_list[$i] == ".") { } else if ($v_list[$i] == "..") { $v_skip++; } else if ($v_list[$i] == "") { if ($i == 0) { $v_result = "/".$v_result; if ($v_skip > 0) { $v_result = $p_dir; $v_skip = 0; } } else if ($i == (sizeof($v_list)-1)) { $v_result = $v_list[$i]; } else { } } else { if ($v_skip > 0) { $v_skip--; } else { $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); } } } if ($v_skip > 0) { while ($v_skip > 0) { $v_result = '../'.$v_result; $v_skip--; } } } return $v_result; } function PclZipUtilPathInclusion($p_dir, $p_path) { $v_result = 1; if ( ($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); } if ( ($p_path == '.') || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); } $v_list_dir = explode("/", $p_dir); $v_list_dir_size = sizeof($v_list_dir); $v_list_path = explode("/", $p_path); $v_list_path_size = sizeof($v_list_path); $i = 0; $j = 0; while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { if ($v_list_dir[$i] == '') { $i++; continue; } if ($v_list_path[$j] == '') { $j++; continue; } if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { $v_result = 0; } $i++; $j++; } if ($v_result) { while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { $v_result = 2; } else if ($i < $v_list_dir_size) { $v_result = 0; } } return $v_result; } function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) { $v_result = 1; if ($p_mode==0) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==1) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==2) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==3) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } return $v_result; } function PclZipUtilRename($p_src, $p_dest) { $v_result = 1; if (!@rename($p_src, $p_dest)) { if (!@copy($p_src, $p_dest)) { $v_result = 0; } else if (!@unlink($p_src)) { $v_result = 0; } } return $v_result; } function PclZipUtilOptionText($p_option) { $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { $v_prefix = substr($v_key, 0, 10); if (( ($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) { return $v_key; } } $v_result = 'Unknown'; return $v_result; } function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) { if (stristr(php_uname(), 'windows')) { if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { $p_path = substr($p_path, $v_position+1); } if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { $p_path = strtr($p_path, '\\', '/'); } } return $p_path; } ?> +errors = new WP_Error(); } public function get_errors() { return $this->errors; } public function get_error_messages() { $messages = array(); foreach ( $this->errors->get_error_codes() as $error_code ) { $error_data = $this->errors->get_error_data( $error_code ); if ( $error_data && is_string( $error_data ) ) { $messages[] = $this->errors->get_error_message( $error_code ) . ' ' . esc_html( strip_tags( $error_data ) ); } else { $messages[] = $this->errors->get_error_message( $error_code ); } } return implode( ', ', $messages ); } public function error( $errors, ...$args ) { if ( is_string( $errors ) ) { $string = $errors; if ( ! empty( $this->upgrader->strings[ $string ] ) ) { $string = $this->upgrader->strings[ $string ]; } if ( false !== strpos( $string, '%' ) ) { if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } $errors_count = count( $this->errors->get_error_codes() ); $this->errors->add( 'unknown_upgrade_error_' . ( $errors_count + 1 ), $string ); } elseif ( is_wp_error( $errors ) ) { foreach ( $errors->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $errors->get_error_message( $error_code ), $errors->get_error_data( $error_code ) ); } } parent::error( $errors, ...$args ); } public function feedback( $feedback, ...$args ) { if ( is_wp_error( $feedback ) ) { foreach ( $feedback->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $feedback->get_error_message( $error_code ), $feedback->get_error_data( $error_code ) ); } } parent::feedback( $feedback, ...$args ); } } __( 'Theme Functions' ), 'header.php' => __( 'Theme Header' ), 'footer.php' => __( 'Theme Footer' ), 'sidebar.php' => __( 'Sidebar' ), 'comments.php' => __( 'Comments' ), 'searchform.php' => __( 'Search Form' ), '404.php' => __( '404 Template' ), 'link.php' => __( 'Links Template' ), 'index.php' => __( 'Main Index Template' ), 'archive.php' => __( 'Archives' ), 'author.php' => __( 'Author Template' ), 'taxonomy.php' => __( 'Taxonomy Template' ), 'category.php' => __( 'Category Template' ), 'tag.php' => __( 'Tag Template' ), 'home.php' => __( 'Posts Page' ), 'search.php' => __( 'Search Results' ), 'date.php' => __( 'Date Template' ), 'singular.php' => __( 'Singular Template' ), 'single.php' => __( 'Single Post' ), 'page.php' => __( 'Single Page' ), 'front-page.php' => __( 'Homepage' ), 'privacy-policy.php' => __( 'Privacy Policy Page' ), 'attachment.php' => __( 'Attachment Template' ), 'image.php' => __( 'Image Attachment Template' ), 'video.php' => __( 'Video Attachment Template' ), 'audio.php' => __( 'Audio Attachment Template' ), 'application.php' => __( 'Application Attachment Template' ), 'embed.php' => __( 'Embed Template' ), 'embed-404.php' => __( 'Embed 404 Template' ), 'embed-content.php' => __( 'Embed Content Template' ), 'header-embed.php' => __( 'Embed Header Template' ), 'footer-embed.php' => __( 'Embed Footer Template' ), 'style.css' => __( 'Stylesheet' ), 'editor-style.css' => __( 'Visual Editor Stylesheet' ), 'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ), 'rtl.css' => __( 'RTL Stylesheet' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ), 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ), 'comments-popup.php' => __( 'Popup Comments' ), ); function get_file_description( $file ) { global $wp_file_descriptions, $allowed_files; $dirname = pathinfo( $file, PATHINFO_DIRNAME ); $file_path = $allowed_files[ $file ]; if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) { return $wp_file_descriptions[ basename( $file ) ]; } elseif ( file_exists( $file_path ) && is_file( $file_path ) ) { $template_data = implode( '', file( $file_path ) ); if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) { return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) ); } } return trim( basename( $file ) ); } function get_home_path() { $home = set_url_scheme( get_option( 'home' ), 'http' ); $siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' ); if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) { $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) ); $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos ); $home_path = trailingslashit( $home_path ); } else { $home_path = ABSPATH; } return str_replace( '\\', '/', $home_path ); } function list_files( $folder = '', $levels = 100, $exclusions = array() ) { if ( empty( $folder ) ) { return false; } $folder = trailingslashit( $folder ); if ( ! $levels ) { return false; } $files = array(); $dir = @opendir( $folder ); if ( $dir ) { while ( ( $file = readdir( $dir ) ) !== false ) { if ( in_array( $file, array( '.', '..' ), true ) ) { continue; } if ( '.' === $file[0] || in_array( $file, $exclusions, true ) ) { continue; } if ( is_dir( $folder . $file ) ) { $files2 = list_files( $folder . $file, $levels - 1 ); if ( $files2 ) { $files = array_merge( $files, $files2 ); } else { $files[] = $folder . $file . '/'; } } else { $files[] = $folder . $file; } } closedir( $dir ); } return $files; } function wp_get_plugin_file_editable_extensions( $plugin ) { $default_types = array( 'bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', 'json', 'jsx', 'less', 'md', 'patch', 'php', 'php3', 'php4', 'php5', 'php7', 'phps', 'phtml', 'sass', 'scss', 'sh', 'sql', 'svg', 'text', 'txt', 'xml', 'yaml', 'yml', ); $file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin ); return $file_types; } function wp_get_theme_file_editable_extensions( $theme ) { $default_types = array( 'bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', 'json', 'jsx', 'less', 'md', 'patch', 'php', 'php3', 'php4', 'php5', 'php7', 'phps', 'phtml', 'sass', 'scss', 'sh', 'sql', 'svg', 'text', 'txt', 'xml', 'yaml', 'yml', ); $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme ); return array_unique( array_merge( $file_types, $default_types ) ); } function wp_print_file_editor_templates() { ?> + + exists() ) { return new WP_Error( 'non_existent_theme', __( 'The requested theme does not exist.' ) ); } if ( ! wp_verify_nonce( $args['nonce'], 'edit-theme_' . $stylesheet . '_' . $file ) ) { return new WP_Error( 'nonce_failure' ); } if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) { return new WP_Error( 'theme_no_stylesheet', __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() ); } $editable_extensions = wp_get_theme_file_editable_extensions( $theme ); $allowed_files = array(); foreach ( $editable_extensions as $type ) { switch ( $type ) { case 'php': $allowed_files = array_merge( $allowed_files, $theme->get_files( 'php', -1 ) ); break; case 'css': $style_files = $theme->get_files( 'css', -1 ); $allowed_files['style.css'] = $style_files['style.css']; $allowed_files = array_merge( $allowed_files, $style_files ); break; default: $allowed_files = array_merge( $allowed_files, $theme->get_files( $type, -1 ) ); break; } } if ( 0 !== validate_file( $file, array_keys( $allowed_files ) ) ) { return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) ); } $real_file = $theme->get_stylesheet_directory() . '/' . $file; $is_active = ( get_stylesheet() === $stylesheet || get_template() === $stylesheet ); } else { return new WP_Error( 'missing_theme_or_plugin' ); } if ( ! is_file( $real_file ) ) { return new WP_Error( 'file_does_not_exist', __( 'File does not exist! Please double check the name and try again.' ) ); } $extension = null; if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) { $extension = strtolower( $matches[1] ); if ( ! in_array( $extension, $editable_extensions, true ) ) { return new WP_Error( 'illegal_file_type', __( 'Files of this type are not editable.' ) ); } } $previous_content = file_get_contents( $real_file ); if ( ! is_writable( $real_file ) ) { return new WP_Error( 'file_not_writable' ); } $f = fopen( $real_file, 'w+' ); if ( false === $f ) { return new WP_Error( 'file_not_writable' ); } $written = fwrite( $f, $content ); fclose( $f ); if ( false === $written ) { return new WP_Error( 'unable_to_write', __( 'Unable to write to file.' ) ); } wp_opcache_invalidate( $real_file, true ); if ( $is_active && 'php' === $extension ) { $scrape_key = md5( rand() ); $transient = 'scrape_key_' . $scrape_key; $scrape_nonce = (string) rand(); set_transient( $transient, $scrape_nonce, 60 ); $cookies = wp_unslash( $_COOKIE ); $scrape_params = array( 'wp_scrape_key' => $scrape_key, 'wp_scrape_nonce' => $scrape_nonce, ); $headers = array( 'Cache-Control' => 'no-cache', ); $sslverify = apply_filters( 'https_local_ssl_verify', false ); if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); } set_time_limit( 300 ); $timeout = 100; $needle_start = "###### wp_scraping_result_start:$scrape_key ######"; $needle_end = "###### wp_scraping_result_end:$scrape_key ######"; if ( $plugin ) { $url = add_query_arg( compact( 'plugin', 'file' ), admin_url( 'plugin-editor.php' ) ); } elseif ( isset( $stylesheet ) ) { $url = add_query_arg( array( 'theme' => $stylesheet, 'file' => $file, ), admin_url( 'theme-editor.php' ) ); } else { $url = admin_url(); } if ( function_exists( 'session_status' ) && PHP_SESSION_ACTIVE === session_status() ) { session_write_close(); } $url = add_query_arg( $scrape_params, $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); $body = wp_remote_retrieve_body( $r ); $scrape_result_position = strpos( $body, $needle_start ); $loopback_request_failure = array( 'code' => 'loopback_request_failed', 'message' => __( 'Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.' ), ); $json_parse_failure = array( 'code' => 'json_parse_error', ); $result = null; if ( false === $scrape_result_position ) { $result = $loopback_request_failure; } else { $error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) ); $error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) ); $result = json_decode( trim( $error_output ), true ); if ( empty( $result ) ) { $result = $json_parse_failure; } } if ( true === $result ) { $url = home_url( '/' ); $url = add_query_arg( $scrape_params, $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); $body = wp_remote_retrieve_body( $r ); $scrape_result_position = strpos( $body, $needle_start ); if ( false === $scrape_result_position ) { $result = $loopback_request_failure; } else { $error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) ); $error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) ); $result = json_decode( trim( $error_output ), true ); if ( empty( $result ) ) { $result = $json_parse_failure; } } } delete_transient( $transient ); if ( true !== $result ) { file_put_contents( $real_file, $previous_content ); wp_opcache_invalidate( $real_file, true ); if ( ! isset( $result['message'] ) ) { $message = __( 'Something went wrong.' ); } else { $message = $result['message']; unset( $result['message'] ); } return new WP_Error( 'php_error', $message, $result ); } } if ( $theme instanceof WP_Theme ) { $theme->cache_delete(); } return true; } function wp_tempnam( $filename = '', $dir = '' ) { if ( empty( $dir ) ) { $dir = get_temp_dir(); } if ( empty( $filename ) || in_array( $filename, array( '.', '/', '\\' ), true ) ) { $filename = uniqid(); } $temp_filename = basename( $filename ); $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename ); if ( ! $temp_filename ) { return wp_tempnam( dirname( $filename ), $dir ); } $temp_filename .= '-' . wp_generate_password( 6, false ); $temp_filename .= '.tmp'; $temp_filename = $dir . wp_unique_filename( $dir, $temp_filename ); $fp = @fopen( $temp_filename, 'x' ); if ( ! $fp && is_writable( $dir ) && file_exists( $temp_filename ) ) { return wp_tempnam( $filename, $dir ); } if ( $fp ) { fclose( $fp ); } return $temp_filename; } function validate_file_to_edit( $file, $allowed_files = array() ) { $code = validate_file( $file, $allowed_files ); if ( ! $code ) { return $file; } switch ( $code ) { case 1: wp_die( __( 'Sorry, that file cannot be edited.' ) ); case 3: wp_die( __( 'Sorry, that file cannot be edited.' ) ); } } function _wp_handle_upload( &$file, $overrides, $time, $action ) { if ( ! function_exists( 'wp_handle_upload_error' ) ) { function wp_handle_upload_error( &$file, $message ) { return array( 'error' => $message ); } } $file = apply_filters( "{$action}_prefilter", $file ); $overrides = apply_filters( "{$action}_overrides", $overrides, $file ); $upload_error_handler = 'wp_handle_upload_error'; if ( isset( $overrides['upload_error_handler'] ) ) { $upload_error_handler = $overrides['upload_error_handler']; } if ( isset( $file['error'] ) && ! is_numeric( $file['error'] ) && $file['error'] ) { return call_user_func_array( $upload_error_handler, array( &$file, $file['error'] ) ); } $unique_filename_callback = null; if ( isset( $overrides['unique_filename_callback'] ) ) { $unique_filename_callback = $overrides['unique_filename_callback']; } if ( isset( $overrides['upload_error_strings'] ) ) { $upload_error_strings = $overrides['upload_error_strings']; } else { $upload_error_strings = array( false, sprintf( __( 'The uploaded file exceeds the %1$s directive in %2$s.' ), 'upload_max_filesize', 'php.ini' ), sprintf( __( 'The uploaded file exceeds the %s directive that was specified in the HTML form.' ), 'MAX_FILE_SIZE' ), __( 'The uploaded file was only partially uploaded.' ), __( 'No file was uploaded.' ), '', __( 'Missing a temporary folder.' ), __( 'Failed to write file to disk.' ), __( 'File upload stopped by extension.' ), ); } $test_form = isset( $overrides['test_form'] ) ? $overrides['test_form'] : true; $test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true; $test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true; $mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false; if ( $test_form && ( ! isset( $_POST['action'] ) || $_POST['action'] !== $action ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Invalid form submission.' ) ) ); } if ( isset( $file['error'] ) && $file['error'] > 0 ) { return call_user_func_array( $upload_error_handler, array( &$file, $upload_error_strings[ $file['error'] ] ) ); } $test_uploaded_file = 'wp_handle_upload' === $action ? is_uploaded_file( $file['tmp_name'] ) : @is_readable( $file['tmp_name'] ); if ( ! $test_uploaded_file ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) ); } $test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] ); if ( $test_size && ! ( $test_file_size > 0 ) ) { if ( is_multisite() ) { $error_msg = __( 'File is empty. Please upload something more substantial.' ); } else { $error_msg = sprintf( __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), 'php.ini', 'post_max_size', 'upload_max_filesize' ); } return call_user_func_array( $upload_error_handler, array( &$file, $error_msg ) ); } if ( $test_type ) { $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); $ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext']; $type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type']; $proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename']; if ( $proper_filename ) { $file['name'] = $proper_filename; } if ( ( ! $type || ! $ext ) && ! current_user_can( 'unfiltered_upload' ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Sorry, you are not allowed to upload this file type.' ) ) ); } if ( ! $type ) { $type = $file['type']; } } else { $type = ''; } $uploads = wp_upload_dir( $time ); if ( ! ( $uploads && false === $uploads['error'] ) ) { return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) ); } $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); $new_file = $uploads['path'] . "/$filename"; $move_new_file = apply_filters( 'pre_move_uploaded_file', null, $file, $new_file, $type ); if ( null === $move_new_file ) { if ( 'wp_handle_upload' === $action ) { $move_new_file = @move_uploaded_file( $file['tmp_name'], $new_file ); } else { $move_new_file = @copy( $file['tmp_name'], $new_file ); unlink( $file['tmp_name'] ); } if ( false === $move_new_file ) { if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; } else { $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; } return $upload_error_handler( $file, sprintf( __( 'The uploaded file could not be moved to %s.' ), $error_path ) ); } } $stat = stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0000666; chmod( $new_file, $perms ); $url = $uploads['url'] . "/$filename"; if ( is_multisite() ) { clean_dirsize_cache( $new_file ); } return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type, ), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' ); } function wp_handle_upload( &$file, $overrides = false, $time = null ) { $action = 'wp_handle_upload'; if ( isset( $overrides['action'] ) ) { $action = $overrides['action']; } return _wp_handle_upload( $file, $overrides, $time, $action ); } function wp_handle_sideload( &$file, $overrides = false, $time = null ) { $action = 'wp_handle_sideload'; if ( isset( $overrides['action'] ) ) { $action = $overrides['action']; } return _wp_handle_upload( $file, $overrides, $time, $action ); } function download_url( $url, $timeout = 300, $signature_verification = false ) { if ( ! $url ) { return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) ); } $url_path = parse_url( $url, PHP_URL_PATH ); $url_filename = ''; if ( is_string( $url_path ) && '' !== $url_path ) { $url_filename = basename( $url_path ); } $tmpfname = wp_tempnam( $url_filename ); if ( ! $tmpfname ) { return new WP_Error( 'http_no_file', __( 'Could not create temporary file.' ) ); } $response = wp_safe_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname, ) ); if ( is_wp_error( $response ) ) { unlink( $tmpfname ); return $response; } $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $response_code ) { $data = array( 'code' => $response_code, ); $tmpf = fopen( $tmpfname, 'rb' ); if ( $tmpf ) { $response_size = apply_filters( 'download_url_error_max_body_size', KB_IN_BYTES ); $data['body'] = fread( $tmpf, $response_size ); fclose( $tmpf ); } unlink( $tmpfname ); return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data ); } $content_disposition = wp_remote_retrieve_header( $response, 'content-disposition' ); if ( $content_disposition ) { $content_disposition = strtolower( $content_disposition ); if ( 0 === strpos( $content_disposition, 'attachment; filename=' ) ) { $tmpfname_disposition = sanitize_file_name( substr( $content_disposition, 21 ) ); } else { $tmpfname_disposition = ''; } if ( $tmpfname_disposition && is_string( $tmpfname_disposition ) && ( 0 === validate_file( $tmpfname_disposition ) ) ) { $tmpfname_disposition = dirname( $tmpfname ) . '/' . $tmpfname_disposition; if ( rename( $tmpfname, $tmpfname_disposition ) ) { $tmpfname = $tmpfname_disposition; } if ( ( $tmpfname !== $tmpfname_disposition ) && file_exists( $tmpfname_disposition ) ) { unlink( $tmpfname_disposition ); } } } $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); if ( $content_md5 ) { $md5_check = verify_file_md5( $tmpfname, $content_md5 ); if ( is_wp_error( $md5_check ) ) { unlink( $tmpfname ); return $md5_check; } } if ( $signature_verification ) { $signed_hostnames = apply_filters( 'wp_signature_hosts', array( 'wordpress.org', 'downloads.wordpress.org', 's.w.org' ) ); $signature_verification = in_array( parse_url( $url, PHP_URL_HOST ), $signed_hostnames, true ); } if ( $signature_verification ) { $signature = wp_remote_retrieve_header( $response, 'x-content-signature' ); if ( ! $signature ) { $signature_url = false; if ( is_string( $url_path ) && ( '.zip' === substr( $url_path, -4 ) || '.tar.gz' === substr( $url_path, -7 ) ) ) { $signature_url = str_replace( $url_path, $url_path . '.sig', $url ); } $signature_url = apply_filters( 'wp_signature_url', $signature_url, $url ); if ( $signature_url ) { $signature_request = wp_safe_remote_get( $signature_url, array( 'limit_response_size' => 10 * KB_IN_BYTES, ) ); if ( ! is_wp_error( $signature_request ) && 200 === wp_remote_retrieve_response_code( $signature_request ) ) { $signature = explode( "\n", wp_remote_retrieve_body( $signature_request ) ); } } } $signature_verification = verify_file_signature( $tmpfname, $signature, $url_filename ); } if ( is_wp_error( $signature_verification ) ) { if ( apply_filters( 'wp_signature_softfail', true, $url ) ) { $signature_verification->add_data( $tmpfname, 'softfail-filename' ); } else { unlink( $tmpfname ); } return $signature_verification; } return $tmpfname; } function verify_file_md5( $filename, $expected_md5 ) { if ( 32 === strlen( $expected_md5 ) ) { $expected_raw_md5 = pack( 'H*', $expected_md5 ); } elseif ( 24 === strlen( $expected_md5 ) ) { $expected_raw_md5 = base64_decode( $expected_md5 ); } else { return false; } $file_md5 = md5_file( $filename, true ); if ( $file_md5 === $expected_raw_md5 ) { return true; } return new WP_Error( 'md5_mismatch', sprintf( __( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ), bin2hex( $file_md5 ), bin2hex( $expected_raw_md5 ) ) ); } function verify_file_signature( $filename, $signatures, $filename_for_errors = false ) { if ( ! $filename_for_errors ) { $filename_for_errors = wp_basename( $filename ); } if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ), true ) ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) ? 'sodium_crypto_sign_verify_detached' : 'sha384' ) ); } if ( ! extension_loaded( 'sodium' ) && in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) && extension_loaded( 'opcache' ) ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), ) ); } if ( ! extension_loaded( 'sodium' ) && ! ParagonIE_Sodium_Compat::polyfill_is_fast() ) { $sodium_compat_is_fast = false; if ( method_exists( 'ParagonIE_Sodium_Compat', 'runtime_speed_test' ) ) { $old_fastMult = ParagonIE_Sodium_Compat::$fastMult; ParagonIE_Sodium_Compat::$fastMult = true; $sodium_compat_is_fast = ParagonIE_Sodium_Compat::runtime_speed_test( 100, 10 ); ParagonIE_Sodium_Compat::$fastMult = $old_fastMult; } if ( ! $sodium_compat_is_fast ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), 'polyfill_is_fast' => false, 'max_execution_time' => ini_get( 'max_execution_time' ), ) ); } } if ( ! $signatures ) { return new WP_Error( 'signature_verification_no_signature', sprintf( __( 'The authenticity of %s could not be verified as no signature was found.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'filename' => $filename_for_errors, ) ); } $trusted_keys = wp_trusted_keys(); $file_hash = hash_file( 'sha384', $filename, true ); mbstring_binary_safe_encoding(); $skipped_key = 0; $skipped_signature = 0; foreach ( (array) $signatures as $signature ) { $signature_raw = base64_decode( $signature ); if ( SODIUM_CRYPTO_SIGN_BYTES !== strlen( $signature_raw ) ) { $skipped_signature++; continue; } foreach ( (array) $trusted_keys as $key ) { $key_raw = base64_decode( $key ); if ( SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES !== strlen( $key_raw ) ) { $skipped_key++; continue; } if ( sodium_crypto_sign_verify_detached( $signature_raw, $file_hash, $key_raw ) ) { reset_mbstring_encoding(); return true; } } } reset_mbstring_encoding(); return new WP_Error( 'signature_verification_failed', sprintf( __( 'The authenticity of %s could not be verified.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'filename' => $filename_for_errors, 'keys' => $trusted_keys, 'signatures' => $signatures, 'hash' => bin2hex( $file_hash ), 'skipped_key' => $skipped_key, 'skipped_sig' => $skipped_signature, 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), ) ); } function wp_trusted_keys() { $trusted_keys = array(); if ( time() < 1617235200 ) { $trusted_keys[] = 'fRPyrxb/MvVLbdsYi+OOEv4xc+Eqpsj+kkAS6gNOkI0='; } return apply_filters( 'wp_trusted_keys', $trusted_keys ); } function unzip_file( $file, $to ) { global $wp_filesystem; if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } wp_raise_memory_limit( 'admin' ); $needed_dirs = array(); $to = trailingslashit( $to ); if ( ! $wp_filesystem->is_dir( $to ) ) { $path = preg_split( '![/\\\]!', untrailingslashit( $to ) ); for ( $i = count( $path ); $i >= 0; $i-- ) { if ( empty( $path[ $i ] ) ) { continue; } $dir = implode( '/', array_slice( $path, 0, $i + 1 ) ); if ( preg_match( '!^[a-z]:$!i', $dir ) ) { continue; } if ( ! $wp_filesystem->is_dir( $dir ) ) { $needed_dirs[] = $dir; } else { break; } } } if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { $result = _unzip_file_ziparchive( $file, $to, $needed_dirs ); if ( true === $result ) { return $result; } elseif ( is_wp_error( $result ) ) { if ( 'incompatible_archive' !== $result->get_error_code() ) { return $result; } } } return _unzip_file_pclzip( $file, $to, $needed_dirs ); } function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) { global $wp_filesystem; $z = new ZipArchive(); $zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS ); if ( true !== $zopen ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) ); } $uncompressed_size = 0; for ( $i = 0; $i < $z->numFiles; $i++ ) { $info = $z->statIndex( $i ); if ( ! $info ) { return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); } if ( '__MACOSX/' === substr( $info['name'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $info['name'] ) ) { continue; } $uncompressed_size += $info['size']; $dirname = dirname( $info['name'] ); if ( '/' === substr( $info['name'], -1 ) ) { $needed_dirs[] = $to . untrailingslashit( $info['name'] ); } elseif ( '.' !== $dirname ) { $needed_dirs[] = $to . untrailingslashit( $dirname ); } } if ( wp_doing_cron() ) { $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false; if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) { return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) ); } } $needed_dirs = array_unique( $needed_dirs ); foreach ( $needed_dirs as $dir ) { if ( untrailingslashit( $to ) === $dir ) { continue; } if ( strpos( $dir, $to ) === false ) { continue; } $parent_folder = dirname( $dir ); while ( ! empty( $parent_folder ) && untrailingslashit( $to ) !== $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } } asort( $needed_dirs ); foreach ( $needed_dirs as $_dir ) { if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) { return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) ); } } unset( $needed_dirs ); for ( $i = 0; $i < $z->numFiles; $i++ ) { $info = $z->statIndex( $i ); if ( ! $info ) { return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); } if ( '/' === substr( $info['name'], -1 ) ) { continue; } if ( '__MACOSX/' === substr( $info['name'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $info['name'] ) ) { continue; } $contents = $z->getFromIndex( $i ); if ( false === $contents ) { return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] ); } if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] ); } } $z->close(); return true; } function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { global $wp_filesystem; mbstring_binary_safe_encoding(); require_once ABSPATH . 'wp-admin/includes/class-pclzip.php'; $archive = new PclZip( $file ); $archive_files = $archive->extract( PCLZIP_OPT_EXTRACT_AS_STRING ); reset_mbstring_encoding(); if ( ! is_array( $archive_files ) ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), $archive->errorInfo( true ) ); } if ( 0 === count( $archive_files ) ) { return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) ); } $uncompressed_size = 0; foreach ( $archive_files as $file ) { if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { continue; } $uncompressed_size += $file['size']; $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) ); } if ( wp_doing_cron() ) { $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false; if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) { return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) ); } } $needed_dirs = array_unique( $needed_dirs ); foreach ( $needed_dirs as $dir ) { if ( untrailingslashit( $to ) === $dir ) { continue; } if ( strpos( $dir, $to ) === false ) { continue; } $parent_folder = dirname( $dir ); while ( ! empty( $parent_folder ) && untrailingslashit( $to ) !== $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } } asort( $needed_dirs ); foreach ( $needed_dirs as $_dir ) { if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) { return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) ); } } unset( $needed_dirs ); foreach ( $archive_files as $file ) { if ( $file['folder'] ) { continue; } if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $file['filename'] ) ) { continue; } if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] ); } } return true; } function copy_dir( $from, $to, $skip_list = array() ) { global $wp_filesystem; $dirlist = $wp_filesystem->dirlist( $from ); if ( false === $dirlist ) { return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $to ) ); } $from = trailingslashit( $from ); $to = trailingslashit( $to ); foreach ( (array) $dirlist as $filename => $fileinfo ) { if ( in_array( $filename, $skip_list, true ) ) { continue; } if ( 'f' === $fileinfo['type'] ) { if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { $wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE ); if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename ); } } wp_opcache_invalidate( $to . $filename ); } elseif ( 'd' === $fileinfo['type'] ) { if ( ! $wp_filesystem->is_dir( $to . $filename ) ) { if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename ); } } $sub_skip_list = array(); foreach ( $skip_list as $skip_item ) { if ( 0 === strpos( $skip_item, $filename . '/' ) ) { $sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item ); } } $result = copy_dir( $from . $filename, $to . $filename, $sub_skip_list ); if ( is_wp_error( $result ) ) { return $result; } } } return true; } function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) { global $wp_filesystem; require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'; $method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership ); if ( ! $method ) { return false; } if ( ! class_exists( "WP_Filesystem_$method" ) ) { $abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); if ( ! file_exists( $abstraction_file ) ) { return; } require_once $abstraction_file; } $method = "WP_Filesystem_$method"; $wp_filesystem = new $method( $args ); if ( ! defined( 'FS_CONNECT_TIMEOUT' ) ) { define( 'FS_CONNECT_TIMEOUT', 30 ); } if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 30 ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return false; } if ( ! $wp_filesystem->connect() ) { return false; } if ( ! defined( 'FS_CHMOD_DIR' ) ) { define( 'FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) ); } if ( ! defined( 'FS_CHMOD_FILE' ) ) { define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); } return true; } function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_file_ownership = false ) { $method = defined( 'FS_METHOD' ) ? FS_METHOD : false; if ( ! $context ) { $context = WP_CONTENT_DIR; } if ( WP_LANG_DIR === $context && ! is_dir( $context ) ) { $context = dirname( $context ); } $context = trailingslashit( $context ); if ( ! $method ) { $temp_file_name = $context . 'temp-write-test-' . str_replace( '.', '-', uniqid( '', true ) ); $temp_handle = @fopen( $temp_file_name, 'w' ); if ( $temp_handle ) { $wp_file_owner = false; $temp_file_owner = false; if ( function_exists( 'fileowner' ) ) { $wp_file_owner = @fileowner( __FILE__ ); $temp_file_owner = @fileowner( $temp_file_name ); } if ( false !== $wp_file_owner && $wp_file_owner === $temp_file_owner ) { $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'file_owner'; } elseif ( $allow_relaxed_file_ownership ) { $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership'; } fclose( $temp_handle ); @unlink( $temp_file_name ); } } if ( ! $method && isset( $args['connection_type'] ) && 'ssh' === $args['connection_type'] && extension_loaded( 'ssh2' ) ) { $method = 'ssh2'; } if ( ! $method && extension_loaded( 'ftp' ) ) { $method = 'ftpext'; } if ( ! $method && ( extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) ) { $method = 'ftpsockets'; } return apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership ); } function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = '', $extra_fields = null, $allow_relaxed_file_ownership = false ) { global $pagenow; $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership ); if ( '' !== $req_cred ) { return $req_cred; } if ( empty( $type ) ) { $type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership ); } if ( 'direct' === $type ) { return true; } if ( is_null( $extra_fields ) ) { $extra_fields = array( 'version', 'locale' ); } $credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '', ) ); $submitted_form = wp_unslash( $_POST ); if ( ! isset( $_POST['_fs_nonce'] ) || ! wp_verify_nonce( $_POST['_fs_nonce'], 'filesystem-credentials' ) ) { unset( $submitted_form['hostname'], $submitted_form['username'], $submitted_form['password'], $submitted_form['public_key'], $submitted_form['private_key'], $submitted_form['connection_type'] ); } $ftp_constants = array( 'hostname' => 'FTP_HOST', 'username' => 'FTP_USER', 'password' => 'FTP_PASS', 'public_key' => 'FTP_PUBKEY', 'private_key' => 'FTP_PRIKEY', ); foreach ( $ftp_constants as $key => $constant ) { if ( defined( $constant ) ) { $credentials[ $key ] = constant( $constant ); } elseif ( ! empty( $submitted_form[ $key ] ) ) { $credentials[ $key ] = $submitted_form[ $key ]; } elseif ( ! isset( $credentials[ $key ] ) ) { $credentials[ $key ] = ''; } } $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); if ( strpos( $credentials['hostname'], ':' ) ) { list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); if ( ! is_numeric( $credentials['port'] ) ) { unset( $credentials['port'] ); } } else { unset( $credentials['port'] ); } if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' === FS_METHOD ) ) { $credentials['connection_type'] = 'ssh'; } elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $type ) { $credentials['connection_type'] = 'ftps'; } elseif ( ! empty( $submitted_form['connection_type'] ) ) { $credentials['connection_type'] = $submitted_form['connection_type']; } elseif ( ! isset( $credentials['connection_type'] ) ) { $credentials['connection_type'] = 'ftp'; } if ( ! $error && ( ! empty( $credentials['hostname'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['password'] ) || 'ssh' === $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) ) ) { $stored_credentials = $credentials; if ( ! empty( $stored_credentials['port'] ) ) { $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; } unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] ); if ( ! wp_installing() ) { update_option( 'ftp_credentials', $stored_credentials ); } return $credentials; } $hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : ''; $username = isset( $credentials['username'] ) ? $credentials['username'] : ''; $public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : ''; $private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : ''; $port = isset( $credentials['port'] ) ? $credentials['port'] : ''; $connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : ''; if ( $error ) { $error_string = __( 'Error: Could not connect to the server. Please verify the settings are correct.' ); if ( is_wp_error( $error ) ) { $error_string = esc_html( $error->get_error_message() ); } echo '

    ' . $error_string . '

    '; } $types = array(); if ( extension_loaded( 'ftp' ) || extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) { $types['ftp'] = __( 'FTP' ); } if ( extension_loaded( 'ftp' ) ) { $types['ftps'] = __( 'FTPS (SSL)' ); } if ( extension_loaded( 'ssh2' ) ) { $types['ssh'] = __( 'SSH2' ); } $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); ?> +
    +
    + " . __( 'Connection Information' ) . ""; ?> +

    + +

    + +
    + +
    +
    + +
    +
    + + $text ) : ?> + + +
    + +
    > + + + +

    +
    + '; } } if ( ! function_exists( 'submit_button' ) ) { require_once ABSPATH . '/wp-admin/includes/template.php'; } ?> +

    + + + +

    +
    +
    + +
    +
    + +
    + true, 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'switch_themes' ); } public function prepare_items() { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! empty( $_REQUEST['s'] ) ) { $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) ); } if ( ! empty( $_REQUEST['features'] ) ) { $this->features = $_REQUEST['features']; } if ( $this->search_terms || $this->features ) { foreach ( $themes as $key => $theme ) { if ( ! $this->search_theme( $theme ) ) { unset( $themes[ $key ] ); } } } unset( $themes[ get_option( 'stylesheet' ) ] ); WP_Theme::sort_by_name( $themes ); $per_page = 36; $page = $this->get_pagenum(); $start = ( $page - 1 ) * $per_page; $this->items = array_slice( $themes, $start, $per_page, true ); $this->set_pagination_args( array( 'total_items' => count( $themes ), 'per_page' => $per_page, 'infinite_scroll' => true, ) ); } public function no_items() { if ( $this->search_terms || $this->features ) { _e( 'No items found.' ); return; } $blog_id = get_current_blog_id(); if ( is_multisite() ) { if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) { printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) ); return; } elseif ( current_user_can( 'manage_network_themes' ) ) { printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) ); return; } } else { if ( current_user_can( 'install_themes' ) ) { printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the Install Themes tab above.' ), admin_url( 'theme-install.php' ) ); return; } } printf( __( 'Only the active theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) ); } public function tablenav( $which = 'top' ) { if ( $this->get_pagination_arg( 'total_pages' ) <= 1 ) { return; } ?> +
    + pagination( $which ); ?> + +
    +
    + + tablenav( 'top' ); ?> -.customize-control .dropdown-arrow:after { - content: "\f140"; - font: normal 20px/1 dashicons; - speak: never; - display: block; - padding: 0; - text-indent: 0; - text-align: center; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none !important; - color: #2c3338; -} +
    + display_rows_or_placeholder(); ?> +
    -.customize-control .dropdown-status { - color: #2c3338; - background: #f0f0f1; - display: none; - max-width: 112px; -} + tablenav( 'bottom' ); ?> + has_items() ) { $this->display_rows(); } else { echo '
    '; $this->no_items(); echo '
    '; } } public function display_rows() { $themes = $this->items; foreach ( $themes as $theme ) : ?> +
    + get_template(); $stylesheet = $theme->get_stylesheet(); $title = $theme->display( 'Name' ); $version = $theme->display( 'Version' ); $author = $theme->display( 'Author' ); $activate_link = wp_nonce_url( 'themes.php?action=activate&template=' . urlencode( $template ) . '&stylesheet=' . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet ); $actions = array(); $actions['activate'] = sprintf( '%s', $activate_link, esc_attr( sprintf( _x( 'Activate “%s”', 'theme' ), $title ) ), __( 'Activate' ) ); if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $actions['preview'] .= sprintf( '%s', wp_customize_url( $stylesheet ), __( 'Live Preview' ) ); } if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ), esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ), __( 'Delete' ) ); } $actions = apply_filters( 'theme_action_links', $actions, $theme, 'all' ); $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, 'all' ); $delete_action = isset( $actions['delete'] ) ? '
    ' . $actions['delete'] . '
    ' : ''; unset( $actions['delete'] ); $screenshot = $theme->get_screenshot(); ?> -.customize-control-color .dropdown { - margin-right: 5px; - margin-bottom: 5px; -} + + + + + + + + + + -.customize-control-color .dropdown .dropdown-content { - background-color: #50575e; - border: 1px solid rgba(0, 0, 0, 0.15); -} +

    +
    + +
    + -/** - * iOS can't scroll iframes, - * instead it expands the iframe size to match the size of the content - */ +
    +

    +

    display( 'Description' ); ?>

    + parent() ) { printf( '

    ' . __( 'This child theme requires its parent theme, %2$s.' ) . '

    ', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), $theme->parent()->display( 'Name' ) ); } ?> +
    -.ios .wp-full-overlay { - position: relative; -} +
    + features as $word ) { if ( ! in_array( $word, $theme->get( 'Tags' ), true ) ) { return false; } } foreach ( $this->search_terms as $word ) { if ( in_array( $word, $theme->get( 'Tags' ), true ) ) { continue; } foreach ( array( 'Name', 'Description', 'Author', 'AuthorURI' ) as $header ) { if ( false !== stripos( strip_tags( $theme->display( $header, false, true ) ), $word ) ) { continue 2; } } if ( false !== stripos( $theme->get_stylesheet(), $word ) ) { continue; } if ( false !== stripos( $theme->get_template(), $word ) ) { continue; } return false; } return true; } public function _js_vars( $extra_args = array() ) { $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'search' => $search_string, 'features' => $this->features, 'paged' => $this->get_pagenum(), 'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1, ); if ( is_array( $extra_args ) ) { $args = array_merge( $args, $extra_args ); } printf( "\n", wp_json_encode( $args ) ); parent::_js_vars(); } } db_fields = $fields; } } public function start_lvl( &$output, $depth = 0, $args = null ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent
      \n"; } public function end_lvl( &$output, $depth = 0, $args = null ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent
    "; } public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { global $_nav_menu_placeholder, $nav_menu_selected_id; $menu_item = $data_object; $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; $possible_object_id = isset( $menu_item->post_type ) && 'nav_menu_item' === $menu_item->post_type ? $menu_item->object_id : $_nav_menu_placeholder; $possible_db_id = ( ! empty( $menu_item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $menu_item->ID : 0; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $output .= $indent . '
  • '; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } } status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ), ); parent::__construct( array( 'plural' => 'sites', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'manage_sites' ); } public function prepare_items() { global $mode, $s, $wpdb; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'sites_list_mode', $mode ); } else { $mode = get_user_setting( 'sites_list_mode', 'list' ); } $per_page = $this->get_items_per_page( 'sites_network_per_page' ); $pagenum = $this->get_pagenum(); $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; $wild = ''; if ( false !== strpos( $s, '*' ) ) { $wild = '*'; $s = trim( $s, '*' ); } if ( ! $s && wp_is_large_network() ) { if ( ! isset( $_REQUEST['orderby'] ) ) { $_GET['orderby'] = ''; $_REQUEST['orderby'] = ''; } if ( ! isset( $_REQUEST['order'] ) ) { $_GET['order'] = 'DESC'; $_REQUEST['order'] = 'DESC'; } } $args = array( 'number' => (int) $per_page, 'offset' => (int) ( ( $pagenum - 1 ) * $per_page ), 'network_id' => get_current_network_id(), ); if ( empty( $s ) ) { } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) || preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); $reg_blog_ids = $wpdb->get_col( $sql ); if ( $reg_blog_ids ) { $args['site__in'] = $reg_blog_ids; } } elseif ( is_numeric( $s ) && empty( $wild ) ) { $args['ID'] = $s; } else { $args['search'] = $s; if ( ! is_subdomain_install() ) { $args['search_columns'] = array( 'path' ); } } $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; if ( 'registered' === $order_by ) { } elseif ( 'lastupdated' === $order_by ) { $order_by = 'last_updated'; } elseif ( 'blogname' === $order_by ) { if ( is_subdomain_install() ) { $order_by = 'domain'; } else { $order_by = 'path'; } } elseif ( 'blog_id' === $order_by ) { $order_by = 'id'; } elseif ( ! $order_by ) { $order_by = false; } $args['orderby'] = $order_by; if ( $order_by ) { $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; } if ( wp_is_large_network() ) { $args['no_found_rows'] = true; } else { $args['no_found_rows'] = false; } $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) { $args[ $status ] = 1; } $args = apply_filters( 'ms_sites_list_table_query_args', $args ); $_sites = get_sites( $args ); if ( is_array( $_sites ) ) { update_site_cache( $_sites ); $this->items = array_slice( $_sites, 0, $per_page ); } $total_sites = get_sites( array_merge( $args, array( 'count' => true, 'offset' => 0, 'number' => 0, ) ) ); $this->set_pagination_args( array( 'total_items' => $total_sites, 'per_page' => $per_page, ) ); } public function no_items() { _e( 'No sites found.' ); } protected function get_views() { $counts = wp_count_sites(); $statuses = array( 'all' => _nx_noop( 'All (%s)', 'All (%s)', 'sites' ), 'public' => _n_noop( 'Public (%s)', 'Public (%s)' ), 'archived' => _n_noop( 'Archived (%s)', 'Archived (%s)' ), 'mature' => _n_noop( 'Mature (%s)', 'Mature (%s)' ), 'spam' => _nx_noop( 'Spam (%s)', 'Spam (%s)', 'sites' ), 'deleted' => _n_noop( 'Deleted (%s)', 'Deleted (%s)' ), ); $view_links = array(); $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; $url = 'sites.php'; foreach ( $statuses as $status => $label_count ) { $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status ) ? ' class="current" aria-current="page"' : ''; if ( (int) $counts[ $status ] > 0 ) { $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); $view_links[ $status ] = sprintf( '%3$s', esc_url( $full_url ), $current_link_attributes, $label ); } } return $view_links; } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( 'delete_sites' ) ) { $actions['delete'] = __( 'Delete' ); } $actions['spam'] = _x( 'Mark as spam', 'site' ); $actions['notspam'] = _x( 'Not spam', 'site' ); return $actions; } protected function pagination( $which ) { global $mode; parent::pagination( $which ); if ( 'top' === $which ) { $this->view_switcher( $mode ); } } protected function extra_tablenav( $which ) { ?> +
    + 'site-query-submit' ) ); } } ?> +
    + '', 'blogname' => __( 'URL' ), 'lastupdated' => __( 'Last Updated' ), 'registered' => _x( 'Registered', 'site' ), 'users' => __( 'Users' ), ); if ( has_filter( 'wpmublogsaction' ) ) { $sites_columns['plugins'] = __( 'Actions' ); } return apply_filters( 'wpmu_blogs_columns', $sites_columns ); } protected function get_sortable_columns() { return array( 'blogname' => 'blogname', 'lastupdated' => 'lastupdated', 'registered' => 'blog_id', ); } public function column_cb( $item ) { $blog = $item; if ( ! is_main_site( $blog['blog_id'] ) ) : $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); ?> + + + + + + site_states( $blog ); ?> + + '; printf( __( '%1$s – %2$s' ), get_option( 'blogname' ), '' . get_option( 'blogdescription' ) . '' ); echo '

    '; restore_current_blog(); } } public function column_lastupdated( $blog ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); } public function column_registered( $blog ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } if ( '0000-00-00 00:00:00' === $blog['registered'] ) { echo '—'; } else { echo mysql2date( $date, $blog['registered'] ); } } public function column_users( $blog ) { $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); if ( ! $user_count ) { $blog_users = new WP_User_Query( array( 'blog_id' => $blog['blog_id'], 'fields' => 'ID', 'number' => 1, 'count_total' => true, ) ); $user_count = $blog_users->get_total(); wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS ); } printf( '%s', esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), number_format_i18n( $user_count ) ); } public function column_plugins( $blog ) { if ( has_filter( 'wpmublogsaction' ) ) { do_action( 'wpmublogsaction', $blog['blog_id'] ); } } public function column_default( $item, $column_name ) { do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] ); } public function display_rows() { foreach ( $this->items as $blog ) { $blog = $blog->to_array(); $class = ''; reset( $this->status_list ); foreach ( $this->status_list as $status => $col ) { if ( 1 == $blog[ $status ] ) { $class = " class='{$col[0]}'"; } } echo ""; $this->single_row_columns( $blog ); echo ''; } } protected function site_states( $site ) { $site_states = array(); $_site = WP_Site::get_instance( $site['blog_id'] ); if ( is_main_site( $_site->id ) ) { $site_states['main'] = __( 'Main' ); } reset( $this->status_list ); $site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; foreach ( $this->status_list as $status => $col ) { if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) { $site_states[ $col[0] ] = $col[1]; } } $site_states = apply_filters( 'display_site_states', $site_states, $_site ); if ( ! empty( $site_states ) ) { $state_count = count( $site_states ); $i = 0; echo ' — '; foreach ( $site_states as $state ) { ++$i; $sep = ( $i < $state_count ) ? ', ' : ''; echo "{$state}{$sep}"; } } } protected function get_default_primary_column_name() { return 'blogname'; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $blog = $item; $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); $actions = array( 'edit' => '', 'backend' => '', 'activate' => '', 'deactivate' => '', 'archive' => '', 'unarchive' => '', 'spam' => '', 'unspam' => '', 'delete' => '', 'visit' => '', ); $actions['edit'] = '' . __( 'Edit' ) . ''; $actions['backend'] = "" . __( 'Dashboard' ) . ''; if ( get_network()->site_id != $blog['blog_id'] ) { if ( '1' == $blog['deleted'] ) { $actions['activate'] = '' . __( 'Activate' ) . ''; } else { $actions['deactivate'] = '' . __( 'Deactivate' ) . ''; } if ( '1' == $blog['archived'] ) { $actions['unarchive'] = '' . __( 'Unarchive' ) . ''; } else { $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . ''; } if ( '1' == $blog['spam'] ) { $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . ''; } else { $actions['spam'] = '' . _x( 'Spam', 'site' ) . ''; } if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { $actions['delete'] = '' . __( 'Delete' ) . ''; } } $actions['visit'] = "" . __( 'Visit' ) . ''; $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); return $this->row_actions( $actions ); } } 'all', 'author' => false, 'category' => false, 'start_date' => false, 'end_date' => false, 'status' => false, ); $args = wp_parse_args( $args, $defaults ); do_action( 'export_wp', $args ); $sitename = sanitize_key( get_bloginfo( 'name' ) ); if ( ! empty( $sitename ) ) { $sitename .= '.'; } $date = gmdate( 'Y-m-d' ); $wp_filename = $sitename . 'WordPress.' . $date . '.xml'; $filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date ); header( 'Content-Description: File Transfer' ); header( 'Content-Disposition: attachment; filename=' . $filename ); header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) { $ptype = get_post_type_object( $args['content'] ); if ( ! $ptype->can_export ) { $args['content'] = 'post'; } $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); } else { $post_types = get_post_types( array( 'can_export' => true ) ); $esses = array_fill( 0, count( $post_types ), '%s' ); $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ); } if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); } else { $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; } $join = ''; if ( $args['category'] && 'post' === $args['content'] ) { $term = term_exists( $args['category'], 'category' ); if ( $term ) { $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)"; $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] ); } } if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) { if ( $args['author'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); } if ( $args['start_date'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) ); } if ( $args['end_date'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) ); } } $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ); $cats = array(); $tags = array(); $terms = array(); if ( isset( $term ) && $term ) { $cat = get_term( $term['term_id'], 'category' ); $cats = array( $cat->term_id => $cat ); unset( $term, $cat ); } elseif ( 'all' === $args['content'] ) { $categories = (array) get_categories( array( 'get' => 'all' ) ); $tags = (array) get_tags( array( 'get' => 'all' ) ); $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) ); $custom_terms = (array) get_terms( array( 'taxonomy' => $custom_taxonomies, 'get' => 'all', ) ); while ( $cat = array_shift( $categories ) ) { if ( ! $cat->parent || isset( $cats[ $cat->parent ] ) ) { $cats[ $cat->term_id ] = $cat; } else { $categories[] = $cat; } } while ( $t = array_shift( $custom_terms ) ) { if ( ! $t->parent || isset( $terms[ $t->parent ] ) ) { $terms[ $t->term_id ] = $t; } else { $custom_terms[] = $t; } } unset( $categories, $custom_taxonomies, $custom_terms ); } function wxr_cdata( $str ) { if ( ! seems_utf8( $str ) ) { $str = utf8_encode( $str ); } $str = '', ']]]]>', $str ) . ']]>'; return $str; } function wxr_site_url() { if ( is_multisite() ) { return network_home_url(); } else { return get_bloginfo_rss( 'url' ); } } function wxr_cat_name( $category ) { if ( empty( $category->name ) ) { return; } echo '' . wxr_cdata( $category->name ) . "\n"; } function wxr_category_description( $category ) { if ( empty( $category->description ) ) { return; } echo '' . wxr_cdata( $category->description ) . "\n"; } function wxr_tag_name( $tag ) { if ( empty( $tag->name ) ) { return; } echo '' . wxr_cdata( $tag->name ) . "\n"; } function wxr_tag_description( $tag ) { if ( empty( $tag->description ) ) { return; } echo '' . wxr_cdata( $tag->description ) . "\n"; } function wxr_term_name( $term ) { if ( empty( $term->name ) ) { return; } echo '' . wxr_cdata( $term->name ) . "\n"; } function wxr_term_description( $term ) { if ( empty( $term->description ) ) { return; } echo "\t\t" . wxr_cdata( $term->description ) . "\n"; } function wxr_term_meta( $term ) { global $wpdb; $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); foreach ( $termmeta as $meta ) { if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { printf( "\t\t\n\t\t\t%s\n\t\t\t%s\n\t\t\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); } } } function wxr_authors_list( array $post_ids = null ) { global $wpdb; if ( ! empty( $post_ids ) ) { $post_ids = array_map( 'absint', $post_ids ); $and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')'; } else { $and = ''; } $authors = array(); $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" ); foreach ( (array) $results as $result ) { $authors[] = get_userdata( $result->post_author ); } $authors = array_filter( $authors ); foreach ( $authors as $author ) { echo "\t"; echo '' . (int) $author->ID . ''; echo '' . wxr_cdata( $author->user_login ) . ''; echo '' . wxr_cdata( $author->user_email ) . ''; echo '' . wxr_cdata( $author->display_name ) . ''; echo '' . wxr_cdata( $author->first_name ) . ''; echo '' . wxr_cdata( $author->last_name ) . ''; echo "\n"; } } function wxr_nav_menu_terms() { $nav_menus = wp_get_nav_menus(); if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) { return; } foreach ( $nav_menus as $menu ) { echo "\t"; echo '' . (int) $menu->term_id . ''; echo 'nav_menu'; echo '' . wxr_cdata( $menu->slug ) . ''; wxr_term_name( $menu ); echo "\n"; } } function wxr_post_taxonomy() { $post = get_post(); $taxonomies = get_object_taxonomies( $post->post_type ); if ( empty( $taxonomies ) ) { return; } $terms = wp_get_object_terms( $post->ID, $taxonomies ); foreach ( (array) $terms as $term ) { echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "\n"; } } function wxr_filter_postmeta( $return_me, $meta_key ) { if ( '_edit_lock' === $meta_key ) { $return_me = true; } return $return_me; } add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 ); echo '\n"; ?> + + + + -.ios #customize-controls .wp-full-overlay-sidebar-content { - -webkit-overflow-scrolling: touch; -} + + + + + + + + + + + -/* Media controls */ + + -.customize-control .actions .button { - margin-top: 12px; -} + + <?php bloginfo_rss( 'name' ); ?> + + + + + + + -.customize-control-header .actions, -.customize-control-header .uploaded { - margin-bottom: 18px; -} + -.customize-control-header .uploaded button:not(.random), -.customize-control-header .default button:not(.random) { - width: 100%; - padding: 0; - margin: 0; - background: none; - border: none; - color: inherit; - cursor: pointer; -} + + + term_id; ?> + slug ); ?> + parent ? $cats[ $c->parent ]->slug : '' ); ?> + + + + + + term_id; ?> + slug ); ?> + + + + + + term_id; ?> + taxonomy ); ?> + slug ); ?> + parent ? $terms[ $t->parent ]->slug : '' ); ?> + + + + -.customize-control-header button img { - display: block; -} + -.customize-control .attachment-media-view .remove-button, -.customize-control .attachment-media-view .default-button, -.customize-control .attachment-media-view .upload-button, -.customize-control-header button.new, -.customize-control-header button.remove { - width: auto; - height: auto; - white-space: normal; -} + in_the_loop = true; while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { $where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')'; $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); foreach ( $posts as $post ) { setup_postdata( $post ); $title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) ); $content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); $excerpt = wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); $is_sticky = is_sticky( $post->ID ) ? 1 : 0; ?> + + <?php echo $title; ?> + + + + + + + + ID; ?> + post_date ); ?> + post_date_gmt ); ?> + post_modified ); ?> + post_modified_gmt ); ?> + comment_status ); ?> + ping_status ); ?> + post_name ); ?> + post_status ); ?> + post_parent; ?> + menu_order; ?> + post_type ); ?> + post_password ); ?> + + post_type ) : ?> + ID ) ); ?> + + + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); foreach ( $postmeta as $meta ) : if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { continue; } ?> + + meta_key ); ?> + meta_value ); ?> + + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); $comments = array_map( 'get_comment', $_comments ); foreach ( $comments as $c ) : ?> + + comment_ID; ?> + comment_author ); ?> + comment_author_email ); ?> + comment_author_url ); ?> + comment_author_IP ); ?> + comment_date ); ?> + comment_date_gmt ); ?> + comment_content ); ?> + comment_approved ); ?> + comment_type ); ?> + comment_parent; ?> + user_id; ?> + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); foreach ( $c_meta as $meta ) : if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) { continue; } ?> + + meta_key ); ?> + meta_value ); ?> + + + + + + + + + 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', 'UpdateURI' => 'Update URI', '_sitewide' => 'Site Wide Only', ); $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' ); if ( ! $plugin_data['Network'] && $plugin_data['_sitewide'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), 'Site Wide Only: true', 'Network: true' ) ); $plugin_data['Network'] = $plugin_data['_sitewide']; } $plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) ); unset( $plugin_data['_sitewide'] ); if ( ! $plugin_data['TextDomain'] ) { $plugin_slug = dirname( plugin_basename( $plugin_file ) ); if ( '.' !== $plugin_slug && false === strpos( $plugin_slug, '/' ) ) { $plugin_data['TextDomain'] = $plugin_slug; } } if ( $markup || $translate ) { $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate ); } else { $plugin_data['Title'] = $plugin_data['Name']; $plugin_data['AuthorName'] = $plugin_data['Author']; } return $plugin_data; } function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) { $plugin_file = plugin_basename( $plugin_file ); if ( $translate ) { $textdomain = $plugin_data['TextDomain']; if ( $textdomain ) { if ( ! is_textdomain_loaded( $textdomain ) ) { if ( $plugin_data['DomainPath'] ) { load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] ); } else { load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); } } } elseif ( 'hello.php' === basename( $plugin_file ) ) { $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { if ( ! empty( $plugin_data[ $field ] ) ) { $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain ); } } } } $allowed_tags_in_links = array( 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $allowed_tags = $allowed_tags_in_links; $allowed_tags['a'] = array( 'href' => true, 'title' => true, ); $plugin_data['Name'] = wp_kses( $plugin_data['Name'], $allowed_tags_in_links ); $plugin_data['Author'] = wp_kses( $plugin_data['Author'], $allowed_tags ); $plugin_data['Description'] = wp_kses( $plugin_data['Description'], $allowed_tags ); $plugin_data['Version'] = wp_kses( $plugin_data['Version'], $allowed_tags ); $plugin_data['PluginURI'] = esc_url( $plugin_data['PluginURI'] ); $plugin_data['AuthorURI'] = esc_url( $plugin_data['AuthorURI'] ); $plugin_data['Title'] = $plugin_data['Name']; $plugin_data['AuthorName'] = $plugin_data['Author']; if ( $markup ) { if ( $plugin_data['PluginURI'] && $plugin_data['Name'] ) { $plugin_data['Title'] = '' . $plugin_data['Name'] . ''; } if ( $plugin_data['AuthorURI'] && $plugin_data['Author'] ) { $plugin_data['Author'] = '' . $plugin_data['Author'] . ''; } $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); if ( $plugin_data['Author'] ) { $plugin_data['Description'] .= sprintf( ' ' . __( 'By %s.' ) . '', $plugin_data['Author'] ); } } return $plugin_data; } function get_plugin_files( $plugin ) { $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; $dir = dirname( $plugin_file ); $plugin_files = array( plugin_basename( $plugin_file ) ); if ( is_dir( $dir ) && WP_PLUGIN_DIR !== $dir ) { $exclusions = (array) apply_filters( 'plugin_files_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) ); $list_files = list_files( $dir, 100, $exclusions ); $list_files = array_map( 'plugin_basename', $list_files ); $plugin_files = array_merge( $plugin_files, $list_files ); $plugin_files = array_values( array_unique( $plugin_files ) ); } return $plugin_files; } function get_plugins( $plugin_folder = '' ) { $cache_plugins = wp_cache_get( 'plugins', 'plugins' ); if ( ! $cache_plugins ) { $cache_plugins = array(); } if ( isset( $cache_plugins[ $plugin_folder ] ) ) { return $cache_plugins[ $plugin_folder ]; } $wp_plugins = array(); $plugin_root = WP_PLUGIN_DIR; if ( ! empty( $plugin_folder ) ) { $plugin_root .= $plugin_folder; } $plugins_dir = @opendir( $plugin_root ); $plugin_files = array(); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( '.' === substr( $file, 0, 1 ) ) { continue; } if ( is_dir( $plugin_root . '/' . $file ) ) { $plugins_subdir = @opendir( $plugin_root . '/' . $file ); if ( $plugins_subdir ) { while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) { if ( '.' === substr( $subfile, 0, 1 ) ) { continue; } if ( '.php' === substr( $subfile, -4 ) ) { $plugin_files[] = "$file/$subfile"; } } closedir( $plugins_subdir ); } } else { if ( '.php' === substr( $file, -4 ) ) { $plugin_files[] = $file; } } } closedir( $plugins_dir ); } if ( empty( $plugin_files ) ) { return $wp_plugins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( "$plugin_root/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { continue; } $wp_plugins[ plugin_basename( $plugin_file ) ] = $plugin_data; } uasort( $wp_plugins, '_sort_uname_callback' ); $cache_plugins[ $plugin_folder ] = $wp_plugins; wp_cache_set( 'plugins', $cache_plugins, 'plugins' ); return $wp_plugins; } function get_mu_plugins() { $wp_plugins = array(); $plugin_files = array(); if ( ! is_dir( WPMU_PLUGIN_DIR ) ) { return $wp_plugins; } $plugins_dir = @opendir( WPMU_PLUGIN_DIR ); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( '.php' === substr( $file, -4 ) ) { $plugin_files[] = $file; } } } else { return $wp_plugins; } closedir( $plugins_dir ); if ( empty( $plugin_files ) ) { return $wp_plugins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { $plugin_data['Name'] = $plugin_file; } $wp_plugins[ $plugin_file ] = $plugin_data; } if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) { unset( $wp_plugins['index.php'] ); } uasort( $wp_plugins, '_sort_uname_callback' ); return $wp_plugins; } function _sort_uname_callback( $a, $b ) { return strnatcasecmp( $a['Name'], $b['Name'] ); } function get_dropins() { $dropins = array(); $plugin_files = array(); $_dropins = _get_dropins(); $plugins_dir = @opendir( WP_CONTENT_DIR ); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( isset( $_dropins[ $file ] ) ) { $plugin_files[] = $file; } } } else { return $dropins; } closedir( $plugins_dir ); if ( empty( $plugin_files ) ) { return $dropins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { $plugin_data['Name'] = $plugin_file; } $dropins[ $plugin_file ] = $plugin_data; } uksort( $dropins, 'strnatcasecmp' ); return $dropins; } function _get_dropins() { $dropins = array( 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), 'db.php' => array( __( 'Custom database class.' ), true ), 'db-error.php' => array( __( 'Custom database error message.' ), true ), 'install.php' => array( __( 'Custom installation script.' ), true ), 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), 'object-cache.php' => array( __( 'External object cache.' ), true ), 'php-error.php' => array( __( 'Custom PHP error message.' ), true ), 'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), ); if ( is_multisite() ) { $dropins['sunrise.php'] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); $dropins['blog-deleted.php'] = array( __( 'Custom site deleted message.' ), true ); $dropins['blog-inactive.php'] = array( __( 'Custom site inactive message.' ), true ); $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); } return $dropins; } function is_plugin_active( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin ); } function is_plugin_inactive( $plugin ) { return ! is_plugin_active( $plugin ); } function is_plugin_active_for_network( $plugin ) { if ( ! is_multisite() ) { return false; } $plugins = get_site_option( 'active_sitewide_plugins' ); if ( isset( $plugins[ $plugin ] ) ) { return true; } return false; } function is_network_only_plugin( $plugin ) { $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); if ( $plugin_data ) { return $plugin_data['Network']; } return false; } function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { $plugin = plugin_basename( trim( $plugin ) ); if ( is_multisite() && ( $network_wide || is_network_only_plugin( $plugin ) ) ) { $network_wide = true; $current = get_site_option( 'active_sitewide_plugins', array() ); $_GET['networkwide'] = 1; } else { $current = get_option( 'active_plugins', array() ); } $valid = validate_plugin( $plugin ); if ( is_wp_error( $valid ) ) { return $valid; } $requirements = validate_plugin_requirements( $plugin ); if ( is_wp_error( $requirements ) ) { return $requirements; } if ( $network_wide && ! isset( $current[ $plugin ] ) || ! $network_wide && ! in_array( $plugin, $current, true ) ) { if ( ! empty( $redirect ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); } ob_start(); plugin_sandbox_scrape( $plugin ); if ( ! $silent ) { do_action( 'activate_plugin', $plugin, $network_wide ); do_action( "activate_{$plugin}", $network_wide ); } if ( $network_wide ) { $current = get_site_option( 'active_sitewide_plugins', array() ); $current[ $plugin ] = time(); update_site_option( 'active_sitewide_plugins', $current ); } else { $current = get_option( 'active_plugins', array() ); $current[] = $plugin; sort( $current ); update_option( 'active_plugins', $current ); } if ( ! $silent ) { do_action( 'activated_plugin', $plugin, $network_wide ); } if ( ob_get_length() > 0 ) { $output = ob_get_clean(); return new WP_Error( 'unexpected_output', __( 'The plugin generated unexpected output.' ), $output ); } ob_end_clean(); } return null; } function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { if ( is_multisite() ) { $network_current = get_site_option( 'active_sitewide_plugins', array() ); } $current = get_option( 'active_plugins', array() ); $do_blog = false; $do_network = false; foreach ( (array) $plugins as $plugin ) { $plugin = plugin_basename( trim( $plugin ) ); if ( ! is_plugin_active( $plugin ) ) { continue; } $network_deactivating = ( false !== $network_wide ) && is_plugin_active_for_network( $plugin ); if ( ! $silent ) { do_action( 'deactivate_plugin', $plugin, $network_deactivating ); } if ( false !== $network_wide ) { if ( is_plugin_active_for_network( $plugin ) ) { $do_network = true; unset( $network_current[ $plugin ] ); } elseif ( $network_wide ) { continue; } } if ( true !== $network_wide ) { $key = array_search( $plugin, $current, true ); if ( false !== $key ) { $do_blog = true; unset( $current[ $key ] ); } } if ( $do_blog && wp_is_recovery_mode() ) { list( $extension ) = explode( '/', $plugin ); wp_paused_plugins()->delete( $extension ); } if ( ! $silent ) { do_action( "deactivate_{$plugin}", $network_deactivating ); do_action( 'deactivated_plugin', $plugin, $network_deactivating ); } } if ( $do_blog ) { update_option( 'active_plugins', $current ); } if ( $do_network ) { update_site_option( 'active_sitewide_plugins', $network_current ); } } function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) { if ( ! is_array( $plugins ) ) { $plugins = array( $plugins ); } $errors = array(); foreach ( $plugins as $plugin ) { if ( ! empty( $redirect ) ) { $redirect = add_query_arg( 'plugin', $plugin, $redirect ); } $result = activate_plugin( $plugin, $redirect, $network_wide, $silent ); if ( is_wp_error( $result ) ) { $errors[ $plugin ] = $result; } } if ( ! empty( $errors ) ) { return new WP_Error( 'plugins_invalid', __( 'One of the plugins is invalid.' ), $errors ); } return true; } function delete_plugins( $plugins, $deprecated = '' ) { global $wp_filesystem; if ( empty( $plugins ) ) { return false; } $checked = array(); foreach ( $plugins as $plugin ) { $checked[] = 'checked[]=' . $plugin; } $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&' . implode( '&', $checked ), 'bulk-plugins' ); ob_start(); $credentials = request_filesystem_credentials( $url ); $data = ob_get_clean(); if ( false === $credentials ) { if ( ! empty( $data ) ) { require_once ABSPATH . 'wp-admin/admin-header.php'; echo $data; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } return; } if ( ! WP_Filesystem( $credentials ) ) { ob_start(); request_filesystem_credentials( $url, '', true ); $data = ob_get_clean(); if ( ! empty( $data ) ) { require_once ABSPATH . 'wp-admin/admin-header.php'; echo $data; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } return; } if ( ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); } $plugins_dir = $wp_filesystem->wp_plugins_dir(); if ( empty( $plugins_dir ) ) { return new WP_Error( 'fs_no_plugins_dir', __( 'Unable to locate WordPress plugin directory.' ) ); } $plugins_dir = trailingslashit( $plugins_dir ); $plugin_translations = wp_get_installed_translations( 'plugins' ); $errors = array(); foreach ( $plugins as $plugin_file ) { if ( is_uninstallable_plugin( $plugin_file ) ) { uninstall_plugin( $plugin_file ); } do_action( 'delete_plugin', $plugin_file ); $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) ); if ( strpos( $plugin_file, '/' ) && $this_plugin_dir !== $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { $deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file ); } do_action( 'deleted_plugin', $plugin_file, $deleted ); if ( ! $deleted ) { $errors[] = $plugin_file; continue; } $plugin_slug = dirname( $plugin_file ); if ( 'hello.php' === $plugin_file ) { $plugin_slug = 'hello-dolly'; } if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { $translations = $plugin_translations[ $plugin_slug ]; foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' ); $json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' ); if ( $json_translation_files ) { array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); } } } } $current = get_site_transient( 'update_plugins' ); if ( $current ) { $deleted = array_diff( $plugins, $errors ); foreach ( $deleted as $plugin_file ) { unset( $current->response[ $plugin_file ] ); } set_site_transient( 'update_plugins', $current ); } if ( ! empty( $errors ) ) { if ( 1 === count( $errors ) ) { $message = __( 'Could not fully remove the plugin %s.' ); } else { $message = __( 'Could not fully remove the plugins %s.' ); } return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) ); } return true; } function validate_active_plugins() { $plugins = get_option( 'active_plugins', array() ); if ( ! is_array( $plugins ) ) { update_option( 'active_plugins', array() ); $plugins = array(); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); $plugins = array_merge( $plugins, array_keys( $network_plugins ) ); } if ( empty( $plugins ) ) { return array(); } $invalid = array(); foreach ( $plugins as $plugin ) { $result = validate_plugin( $plugin ); if ( is_wp_error( $result ) ) { $invalid[ $plugin ] = $result; deactivate_plugins( $plugin, true ); } } return $invalid; } function validate_plugin( $plugin ) { if ( validate_file( $plugin ) ) { return new WP_Error( 'plugin_invalid', __( 'Invalid plugin path.' ) ); } if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin ) ) { return new WP_Error( 'plugin_not_found', __( 'Plugin file does not exist.' ) ); } $installed_plugins = get_plugins(); if ( ! isset( $installed_plugins[ $plugin ] ) ) { return new WP_Error( 'no_plugin_header', __( 'The plugin does not have a valid header.' ) ); } return 0; } function validate_plugin_requirements( $plugin ) { $plugin_headers = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $requirements = array( 'requires' => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '', 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '', ); $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); $php_update_message = '

    ' . sprintf( __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $php_update_message .= '

    ' . $annotation . ''; } if ( ! $compatible_wp && ! $compatible_php ) { return new WP_Error( 'plugin_wp_php_incompatible', '

    ' . sprintf( _x( 'Error: Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ), get_bloginfo( 'version' ), phpversion(), $plugin_headers['Name'], $requirements['requires'], $requirements['requires_php'] ) . $php_update_message . '

    ' ); } elseif ( ! $compatible_php ) { return new WP_Error( 'plugin_php_incompatible', '

    ' . sprintf( _x( 'Error: Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ), phpversion(), $plugin_headers['Name'], $requirements['requires_php'] ) . $php_update_message . '

    ' ); } elseif ( ! $compatible_wp ) { return new WP_Error( 'plugin_wp_incompatible', '

    ' . sprintf( _x( 'Error: Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ), get_bloginfo( 'version' ), $plugin_headers['Name'], $requirements['requires'] ) . '

    ' ); } return true; } function is_uninstallable_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); if ( isset( $uninstallable_plugins[ $file ] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { return true; } return false; } function uninstall_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); do_action( 'pre_uninstall_plugin', $plugin, $uninstallable_plugins ); if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { unset( $uninstallable_plugins[ $file ] ); update_option( 'uninstall_plugins', $uninstallable_plugins ); } unset( $uninstallable_plugins ); define( 'WP_UNINSTALL_PLUGIN', $file ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); include_once WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php'; return true; } if ( isset( $uninstallable_plugins[ $file ] ) ) { $callable = $uninstallable_plugins[ $file ]; unset( $uninstallable_plugins[ $file ] ); update_option( 'uninstall_plugins', $uninstallable_plugins ); unset( $uninstallable_plugins ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); include_once WP_PLUGIN_DIR . '/' . $file; add_action( "uninstall_{$file}", $callable ); do_action( "uninstall_{$file}" ); } } function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null ) { global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages; $menu_slug = plugin_basename( $menu_slug ); $admin_page_hooks[ $menu_slug ] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $menu_slug, '' ); if ( ! empty( $callback ) && ! empty( $hookname ) && current_user_can( $capability ) ) { add_action( $hookname, $callback ); } if ( empty( $icon_url ) ) { $icon_url = 'dashicons-admin-generic'; $icon_class = 'menu-icon-generic '; } else { $icon_url = set_url_scheme( $icon_url ); $icon_class = ''; } $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url ); if ( null !== $position && ! is_numeric( $position ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The seventh parameter passed to %s should be numeric representing menu position.' ), 'add_menu_page()' ), '6.0.0' ); $position = null; } if ( null === $position || ! is_numeric( $position ) ) { $menu[] = $new_menu; } elseif ( isset( $menu[ (string) $position ] ) ) { $collision_avoider = base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001; $position = (string) ( $position + $collision_avoider ); $menu[ $position ] = $new_menu; } else { $position = (string) $position; $menu[ $position ] = $new_menu; } $_registered_pages[ $hookname ] = true; $_parent_pages[ $menu_slug ] = false; return $hookname; } function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv, $_registered_pages, $_parent_pages; $menu_slug = plugin_basename( $menu_slug ); $parent_slug = plugin_basename( $parent_slug ); if ( isset( $_wp_real_parent_file[ $parent_slug ] ) ) { $parent_slug = $_wp_real_parent_file[ $parent_slug ]; } if ( ! current_user_can( $capability ) ) { $_wp_submenu_nopriv[ $parent_slug ][ $menu_slug ] = true; return false; } if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) { foreach ( (array) $menu as $parent_menu ) { if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) { $submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 ); } } } $new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title ); if ( null !== $position && ! is_numeric( $position ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The seventh parameter passed to %s should be numeric representing menu position.' ), 'add_submenu_page()' ), '5.3.0' ); $position = null; } if ( null === $position || ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) ) { $submenu[ $parent_slug ][] = $new_sub_menu; } else { $position = max( $position, 0 ); if ( 0 === $position ) { array_unshift( $submenu[ $parent_slug ], $new_sub_menu ); } else { $before_items = array_slice( $submenu[ $parent_slug ], 0, $position, true ); $after_items = array_slice( $submenu[ $parent_slug ], $position, null, true ); $before_items[] = $new_sub_menu; $submenu[ $parent_slug ] = array_merge( $before_items, $after_items ); } } ksort( $submenu[ $parent_slug ] ); $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug ); if ( ! empty( $callback ) && ! empty( $hookname ) ) { add_action( $hookname, $callback ); } $_registered_pages[ $hookname ] = true; if ( 'tools.php' === $parent_slug ) { $_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true; } $_parent_pages[ $menu_slug ] = $parent_slug; return $hookname; } function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { if ( current_user_can( 'edit_users' ) ) { $parent = 'users.php'; } else { $parent = 'profile.php'; } return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function remove_menu_page( $menu_slug ) { global $menu; foreach ( $menu as $i => $item ) { if ( $menu_slug === $item[2] ) { unset( $menu[ $i ] ); return $item; } } return false; } function remove_submenu_page( $menu_slug, $submenu_slug ) { global $submenu; if ( ! isset( $submenu[ $menu_slug ] ) ) { return false; } foreach ( $submenu[ $menu_slug ] as $i => $item ) { if ( $submenu_slug === $item[2] ) { unset( $submenu[ $menu_slug ][ $i ] ); return $item; } } return false; } function menu_page_url( $menu_slug, $display = true ) { global $_parent_pages; if ( isset( $_parent_pages[ $menu_slug ] ) ) { $parent_slug = $_parent_pages[ $menu_slug ]; if ( $parent_slug && ! isset( $_parent_pages[ $parent_slug ] ) ) { $url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) ); } else { $url = admin_url( 'admin.php?page=' . $menu_slug ); } } else { $url = ''; } $url = esc_url( $url ); if ( $display ) { echo $url; } return $url; } function get_admin_page_parent( $parent_page = '' ) { global $parent_file, $menu, $submenu, $pagenow, $typenow, $plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv; if ( ! empty( $parent_page ) && 'admin.php' !== $parent_page ) { if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) { $parent_page = $_wp_real_parent_file[ $parent_page ]; } return $parent_page; } if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) { foreach ( (array) $menu as $parent_menu ) { if ( $parent_menu[2] === $plugin_page ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } } if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) { $parent_file = $pagenow; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } foreach ( array_keys( (array) $submenu ) as $parent_page ) { foreach ( $submenu[ $parent_page ] as $submenu_array ) { if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) { $parent_page = $_wp_real_parent_file[ $parent_page ]; } if ( ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $submenu_array[2] ) { $parent_file = $parent_page; return $parent_page; } elseif ( empty( $typenow ) && $pagenow === $submenu_array[2] && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) ) { $parent_file = $parent_page; return $parent_page; } elseif ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] ) { $parent_file = $parent_page; return $parent_page; } } } if ( empty( $parent_file ) ) { $parent_file = ''; } return ''; } function get_admin_page_title() { global $title, $menu, $submenu, $pagenow, $typenow, $plugin_page; if ( ! empty( $title ) ) { return $title; } $hook = get_plugin_page_hook( $plugin_page, $pagenow ); $parent = get_admin_page_parent(); $parent1 = $parent; if ( empty( $parent ) ) { foreach ( (array) $menu as $menu_array ) { if ( isset( $menu_array[3] ) ) { if ( $menu_array[2] === $pagenow ) { $title = $menu_array[3]; return $menu_array[3]; } elseif ( isset( $plugin_page ) && $plugin_page === $menu_array[2] && $hook === $menu_array[5] ) { $title = $menu_array[3]; return $menu_array[3]; } } else { $title = $menu_array[0]; return $title; } } } else { foreach ( array_keys( $submenu ) as $parent ) { foreach ( $submenu[ $parent ] as $submenu_array ) { if ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] && ( $pagenow === $parent || $plugin_page === $parent || $plugin_page === $hook || 'admin.php' === $pagenow && $parent1 !== $submenu_array[2] || ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $parent ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } if ( $submenu_array[2] !== $pagenow || isset( $_GET['page'] ) ) { continue; } if ( isset( $submenu_array[3] ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } else { $title = $submenu_array[0]; return $title; } } } if ( empty( $title ) ) { foreach ( $menu as $menu_array ) { if ( isset( $plugin_page ) && $plugin_page === $menu_array[2] && 'admin.php' === $pagenow && $parent1 === $menu_array[2] ) { $title = $menu_array[3]; return $menu_array[3]; } } } } return $title; } function get_plugin_page_hook( $plugin_page, $parent_page ) { $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); if ( has_action( $hook ) ) { return $hook; } else { return null; } } function get_plugin_page_hookname( $plugin_page, $parent_page ) { global $admin_page_hooks; $parent = get_admin_page_parent( $parent_page ); $page_type = 'admin'; if ( empty( $parent_page ) || 'admin.php' === $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) { if ( isset( $admin_page_hooks[ $plugin_page ] ) ) { $page_type = 'toplevel'; } elseif ( isset( $admin_page_hooks[ $parent ] ) ) { $page_type = $admin_page_hooks[ $parent ]; } } elseif ( isset( $admin_page_hooks[ $parent ] ) ) { $page_type = $admin_page_hooks[ $parent ]; } $plugin_name = preg_replace( '!\.php!', '', $plugin_page ); return $page_type . '_page_' . $plugin_name; } function user_can_access_admin_page() { global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv, $plugin_page, $_registered_pages; $parent = get_admin_page_parent(); if ( ! isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $parent ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) ) { if ( isset( $_wp_submenu_nopriv[ $parent ][ $plugin_page ] ) ) { return false; } $hookname = get_plugin_page_hookname( $plugin_page, $parent ); if ( ! isset( $_registered_pages[ $hookname ] ) ) { return false; } } if ( empty( $parent ) ) { if ( isset( $_wp_menu_nopriv[ $pagenow ] ) ) { return false; } if ( isset( $_wp_submenu_nopriv[ $pagenow ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } foreach ( array_keys( $_wp_submenu_nopriv ) as $key ) { if ( isset( $_wp_submenu_nopriv[ $key ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $key ][ $plugin_page ] ) ) { return false; } } return true; } if ( isset( $plugin_page ) && $plugin_page === $parent && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } if ( isset( $submenu[ $parent ] ) ) { foreach ( $submenu[ $parent ] as $submenu_array ) { if ( isset( $plugin_page ) && $submenu_array[2] === $plugin_page ) { return current_user_can( $submenu_array[1] ); } elseif ( $submenu_array[2] === $pagenow ) { return current_user_can( $submenu_array[1] ); } } } foreach ( $menu as $menu_array ) { if ( $menu_array[2] === $parent ) { return current_user_can( $menu_array[1] ); } } return true; } function option_update_filter( $options ) { global $new_allowed_options; if ( is_array( $new_allowed_options ) ) { $options = add_allowed_options( $new_allowed_options, $options ); } return $options; } function add_allowed_options( $new_options, $options = '' ) { if ( '' === $options ) { global $allowed_options; } else { $allowed_options = $options; } foreach ( $new_options as $page => $keys ) { foreach ( $keys as $key ) { if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) { $allowed_options[ $page ] = array(); $allowed_options[ $page ][] = $key; } else { $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false === $pos ) { $allowed_options[ $page ][] = $key; } } } } return $allowed_options; } function remove_allowed_options( $del_options, $options = '' ) { if ( '' === $options ) { global $allowed_options; } else { $allowed_options = $options; } foreach ( $del_options as $page => $keys ) { foreach ( $keys as $key ) { if ( isset( $allowed_options[ $page ] ) && is_array( $allowed_options[ $page ] ) ) { $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false !== $pos ) { unset( $allowed_options[ $page ][ $pos ] ); } } } } return $allowed_options; } function settings_fields( $option_group ) { echo ""; echo ''; wp_nonce_field( "$option_group-options" ); } function wp_clean_plugins_cache( $clear_update_cache = true ) { if ( $clear_update_cache ) { delete_site_transient( 'update_plugins' ); } wp_cache_delete( 'plugins', 'plugins' ); } function plugin_sandbox_scrape( $plugin ) { if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); include_once WP_PLUGIN_DIR . '/' . $plugin; } function wp_add_privacy_policy_content( $plugin_name, $policy_text ) { if ( ! is_admin() ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ), 'admin_init' ), '4.9.7' ); return; } elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ), 'admin_init' ), '4.9.7' ); return; } if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } WP_Privacy_Policy_Content::add( $plugin_name, $policy_text ); } function is_plugin_paused( $plugin ) { if ( ! isset( $GLOBALS['_paused_plugins'] ) ) { return false; } if ( ! is_plugin_active( $plugin ) ) { return false; } list( $plugin ) = explode( '/', $plugin ); return array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ); } function wp_get_plugin_error( $plugin ) { if ( ! isset( $GLOBALS['_paused_plugins'] ) ) { return false; } list( $plugin ) = explode( '/', $plugin ); if ( ! array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ) ) { return false; } return $GLOBALS['_paused_plugins'][ $plugin ]; } function resume_plugin( $plugin, $redirect = '' ) { if ( ! empty( $redirect ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-resume-error_' . $plugin ), $redirect ) ); ob_start(); plugin_sandbox_scrape( $plugin ); ob_clean(); } list( $extension ) = explode( '/', $plugin ); $result = wp_paused_plugins()->delete( $extension ); if ( ! $result ) { return new WP_Error( 'could_not_resume_plugin', __( 'Could not resume the plugin.' ) ); } return true; } function paused_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'resume_plugins' ) ) { return; } if ( ! isset( $GLOBALS['_paused_plugins'] ) || empty( $GLOBALS['_paused_plugins'] ) ) { return; } printf( '

    %s
    %s

    %s

    ', __( 'One or more plugins failed to load properly.' ), __( 'You can find more details and make changes on the Plugins screen.' ), esc_url( admin_url( 'plugins.php?plugin_status=paused' ) ), __( 'Go to the Plugins screen' ) ); } function deactivated_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'activate_plugins' ) ) { return; } $blog_deactivated_plugins = get_option( 'wp_force_deactivated_plugins' ); $site_deactivated_plugins = array(); if ( false === $blog_deactivated_plugins ) { update_option( 'wp_force_deactivated_plugins', array() ); } if ( is_multisite() ) { $site_deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins' ); if ( false === $site_deactivated_plugins ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } } if ( empty( $blog_deactivated_plugins ) && empty( $site_deactivated_plugins ) ) { return; } $deactivated_plugins = array_merge( $blog_deactivated_plugins, $site_deactivated_plugins ); foreach ( $deactivated_plugins as $plugin ) { if ( ! empty( $plugin['version_compatible'] ) && ! empty( $plugin['version_deactivated'] ) ) { $explanation = sprintf( __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s, please upgrade to %1$s %4$s or later.' ), $plugin['plugin_name'], $plugin['version_deactivated'], $GLOBALS['wp_version'], $plugin['version_compatible'] ); } else { $explanation = sprintf( __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s.' ), $plugin['plugin_name'], ! empty( $plugin['version_deactivated'] ) ? $plugin['version_deactivated'] : '', $GLOBALS['wp_version'], $plugin['version_compatible'] ); } printf( '

    %s
    %s

    %s

    ', sprintf( __( '%s plugin deactivated during WordPress upgrade.' ), $plugin['plugin_name'] ), $explanation, esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ), __( 'Go to the Plugins screen' ) ); } update_option( 'wp_force_deactivated_plugins', array() ); if ( is_multisite() ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } } __( 'Name' ), 'created' => __( 'Created' ), 'last_used' => __( 'Last Used' ), 'last_ip' => __( 'Last IP' ), 'revoke' => __( 'Revoke' ), ); } public function prepare_items() { global $user_id; $this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) ); } public function column_name( $item ) { echo esc_html( $item['name'] ); } public function column_created( $item ) { if ( empty( $item['created'] ) ) { echo '—'; } else { echo date_i18n( __( 'F j, Y' ), $item['created'] ); } } public function column_last_used( $item ) { if ( empty( $item['last_used'] ) ) { echo '—'; } else { echo date_i18n( __( 'F j, Y' ), $item['last_used'] ); } } public function column_last_ip( $item ) { if ( empty( $item['last_ip'] ) ) { echo '—'; } else { echo $item['last_ip']; } } public function column_revoke( $item ) { $name = 'revoke-application-password-' . $item['uuid']; printf( '', esc_attr( $name ), esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ), __( 'Revoke' ) ); } protected function column_default( $item, $column_name ) { do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); } protected function display_tablenav( $which ) { ?> +
    + +
    + +
    + +
    + bulk_actions( $which ); ?> +
    + extra_tablenav( $which ); $this->pagination( $which ); ?> +
    +
    + '; $this->single_row_columns( $item ); echo ''; } protected function get_default_primary_column_name() { return 'name'; } public function print_js_template_row() { list( $columns, $hidden, , $primary ) = $this->get_column_info(); echo ''; foreach ( $columns as $column_name => $display_name ) { $is_primary = $primary === $column_name; $classes = "{$column_name} column-{$column_name}"; if ( $is_primary ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } printf( '', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) ); switch ( $column_name ) { case 'name': echo '{{ data.name }}'; break; case 'created': echo '<# print( wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ', data.created ) ) #>'; break; case 'last_used': echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>"; break; case 'last_ip': echo "{{ data.last_ip || '—' }}"; break; case 'revoke': printf( '', esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ), esc_html__( 'Revoke' ) ); break; default: do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name ); break; } if ( $is_primary ) { echo ''; } echo ''; } echo ''; } } errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); } $themes_dir = $wp_filesystem->wp_themes_dir(); if ( empty( $themes_dir ) ) { return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) ); } do_action( 'delete_theme', $stylesheet ); $themes_dir = trailingslashit( $themes_dir ); $theme_dir = trailingslashit( $themes_dir . $stylesheet ); $deleted = $wp_filesystem->delete( $theme_dir, true ); do_action( 'deleted_theme', $stylesheet, $deleted ); if ( ! $deleted ) { return new WP_Error( 'could_not_remove_theme', sprintf( __( 'Could not fully remove the theme %s.' ), $stylesheet ) ); } $theme_translations = wp_get_installed_translations( 'themes' ); if ( ! empty( $theme_translations[ $stylesheet ] ) ) { $translations = $theme_translations[ $stylesheet ]; foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' ); if ( $json_translation_files ) { array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); } } } if ( is_multisite() ) { WP_Theme::network_disable_theme( $stylesheet ); } delete_site_transient( 'update_themes' ); return true; } function get_page_templates( $post = null, $post_type = 'page' ) { return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) ); } function _get_template_edit_filename( $fullpath, $containingfolder ) { return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath ); } function theme_update_available( $theme ) { echo get_theme_update_available( $theme ); } function get_theme_update_available( $theme ) { static $themes_update = null; if ( ! current_user_can( 'update_themes' ) ) { return false; } if ( ! isset( $themes_update ) ) { $themes_update = get_site_transient( 'update_themes' ); } if ( ! ( $theme instanceof WP_Theme ) ) { return false; } $stylesheet = $theme->get_stylesheet(); $html = ''; if ( isset( $themes_update->response[ $stylesheet ] ) ) { $update = $themes_update->response[ $stylesheet ]; $theme_name = $theme->display( 'Name' ); $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $update['url'] ); $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); if ( ! is_multisite() ) { if ( ! current_user_can( 'update_themes' ) ) { $html = sprintf( '

    ' . __( 'There is a new version of %1$s available. View version %4$s details.' ) . '

    ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } elseif ( empty( $update['package'] ) ) { $html = sprintf( '

    ' . __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.' ) . '

    ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } else { $html = sprintf( '

    ' . __( 'There is a new version of %1$s available. View version %4$s details or update now.' ) . '

    ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'], $update_url, sprintf( 'aria-label="%s" id="update-theme" data-slug="%s"', esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme_name ) ), $stylesheet ) ); } } } return $html; } function get_theme_feature_list( $api = true ) { $features = array( __( 'Subject' ) => array( 'blog' => __( 'Blog' ), 'e-commerce' => __( 'E-Commerce' ), 'education' => __( 'Education' ), 'entertainment' => __( 'Entertainment' ), 'food-and-drink' => __( 'Food & Drink' ), 'holiday' => __( 'Holiday' ), 'news' => __( 'News' ), 'photography' => __( 'Photography' ), 'portfolio' => __( 'Portfolio' ), ), __( 'Features' ) => array( 'accessibility-ready' => __( 'Accessibility Ready' ), 'block-patterns' => __( 'Block Editor Patterns' ), 'block-styles' => __( 'Block Editor Styles' ), 'custom-background' => __( 'Custom Background' ), 'custom-colors' => __( 'Custom Colors' ), 'custom-header' => __( 'Custom Header' ), 'custom-logo' => __( 'Custom Logo' ), 'editor-style' => __( 'Editor Style' ), 'featured-image-header' => __( 'Featured Image Header' ), 'featured-images' => __( 'Featured Images' ), 'footer-widgets' => __( 'Footer Widgets' ), 'full-site-editing' => __( 'Full Site Editing' ), 'full-width-template' => __( 'Full Width Template' ), 'post-formats' => __( 'Post Formats' ), 'sticky-post' => __( 'Sticky Post' ), 'template-editing' => __( 'Template Editing' ), 'theme-options' => __( 'Theme Options' ), ), __( 'Layout' ) => array( 'grid-layout' => __( 'Grid Layout' ), 'one-column' => __( 'One Column' ), 'two-columns' => __( 'Two Columns' ), 'three-columns' => __( 'Three Columns' ), 'four-columns' => __( 'Four Columns' ), 'left-sidebar' => __( 'Left Sidebar' ), 'right-sidebar' => __( 'Right Sidebar' ), 'wide-blocks' => __( 'Wide Blocks' ), ), ); if ( ! $api || ! current_user_can( 'install_themes' ) ) { return $features; } $feature_list = get_site_transient( 'wporg_theme_feature_list' ); if ( ! $feature_list ) { set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); } if ( ! $feature_list ) { $feature_list = themes_api( 'feature_list', array() ); if ( is_wp_error( $feature_list ) ) { return $features; } } if ( ! $feature_list ) { return $features; } set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); $category_translations = array( 'Layout' => __( 'Layout' ), 'Features' => __( 'Features' ), 'Subject' => __( 'Subject' ), ); $wporg_features = array(); foreach ( (array) $feature_list as $feature_category => $feature_items ) { if ( isset( $category_translations[ $feature_category ] ) ) { $feature_category = $category_translations[ $feature_category ]; } $wporg_features[ $feature_category ] = array(); foreach ( $feature_items as $feature ) { if ( isset( $features[ $feature_category ][ $feature ] ) ) { $wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ]; } else { $wporg_features[ $feature_category ][ $feature ] = $feature; } } } return $wporg_features; } function themes_api( $action, $args = array() ) { require ABSPATH . WPINC . '/version.php'; if ( is_array( $args ) ) { $args = (object) $args; } if ( 'query_themes' === $action ) { if ( ! isset( $args->per_page ) ) { $args->per_page = 24; } } if ( ! isset( $args->locale ) ) { $args->locale = get_user_locale(); } if ( ! isset( $args->wp_version ) ) { $args->wp_version = substr( $wp_version, 0, 3 ); } $args = apply_filters( 'themes_api_args', $args, $action ); $res = apply_filters( 'themes_api', false, $action, $args ); if ( ! $res ) { $url = 'http://api.wordpress.org/themes/info/1.2/'; $url = add_query_arg( array( 'action' => $action, 'request' => $args, ), $url ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $http_args = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); $request = wp_remote_get( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { if ( ! wp_doing_ajax() ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); } $request = wp_remote_get( $http_url, $http_args ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'themes_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( is_array( $res ) ) { $res = (object) $res; } elseif ( null === $res ) { $res = new WP_Error( 'themes_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } if ( isset( $res->error ) ) { $res = new WP_Error( 'themes_api_failed', $res->error ); } } if ( ! is_wp_error( $res ) ) { if ( 'query_themes' === $action ) { foreach ( $res->themes as $i => $theme ) { $res->themes[ $i ] = (object) $theme; } } if ( 'feature_list' === $action ) { $res = (array) $res; } } } return apply_filters( 'themes_api_result', $res, $action, $args ); } function wp_prepare_themes_for_js( $themes = null ) { $current_theme = get_stylesheet(); $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme ); if ( ! empty( $prepared_themes ) ) { return $prepared_themes; } $prepared_themes[ $current_theme ] = array(); if ( null === $themes ) { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! isset( $themes[ $current_theme ] ) ) { $themes[ $current_theme ] = wp_get_theme(); } } $updates = array(); $no_updates = array(); if ( ! is_multisite() && current_user_can( 'update_themes' ) ) { $updates_transient = get_site_transient( 'update_themes' ); if ( isset( $updates_transient->response ) ) { $updates = $updates_transient->response; } if ( isset( $updates_transient->no_update ) ) { $no_updates = $updates_transient->no_update; } } WP_Theme::sort_by_name( $themes ); $parents = array(); $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); foreach ( $themes as $theme ) { $slug = $theme->get_stylesheet(); $encoded_slug = urlencode( $slug ); $parent = false; if ( $theme->parent() ) { $parent = $theme->parent(); $parents[ $slug ] = $parent->get_stylesheet(); $parent = $parent->display( 'Name' ); } $customize_action = null; $can_edit_theme_options = current_user_can( 'edit_theme_options' ); $can_customize = current_user_can( 'customize' ); $is_block_theme = $theme->is_block_theme(); if ( $is_block_theme && $can_edit_theme_options ) { $customize_action = esc_url( admin_url( 'site-editor.php' ) ); } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { $customize_action = esc_url( add_query_arg( array( 'return' => urlencode( esc_url_raw( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), ), wp_customize_url( $slug ) ) ); } $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; $auto_update = in_array( $slug, $auto_updates, true ); $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; if ( isset( $updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $updates[ $slug ]; } elseif ( isset( $no_updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $no_updates[ $slug ]; } else { $auto_update_supported = false; $auto_update_filter_payload = (object) array( 'theme' => $slug, 'new_version' => $theme->get( 'Version' ), 'url' => '', 'package' => '', 'requires' => $theme->get( 'RequiresWP' ), 'requires_php' => $theme->get( 'RequiresPHP' ), ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $auto_update_filter_payload ); $prepared_themes[ $slug ] = array( 'id' => $slug, 'name' => $theme->display( 'Name' ), 'screenshot' => array( $theme->get_screenshot() ), 'description' => $theme->display( 'Description' ), 'author' => $theme->display( 'Author', false, true ), 'authorAndUri' => $theme->display( 'Author' ), 'tags' => $theme->display( 'Tags' ), 'version' => $theme->get( 'Version' ), 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), 'updateResponse' => array( 'compatibleWP' => is_wp_version_compatible( $update_requires_wp ), 'compatiblePHP' => is_php_version_compatible( $update_requires_php ), ), 'parent' => $parent, 'active' => $slug === $current_theme, 'hasUpdate' => isset( $updates[ $slug ] ), 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 'update' => get_theme_update_available( $theme ), 'autoupdate' => array( 'enabled' => $auto_update || $auto_update_forced, 'supported' => $auto_update_supported, 'forced' => $auto_update_forced, ), 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 'customize' => $customize_action, 'delete' => ( ! is_multisite() && current_user_can( 'delete_themes' ) ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, 'autoupdate' => wp_is_auto_update_enabled_for_type( 'theme' ) && ! is_multisite() && current_user_can( 'update_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=' . $auto_update_action . '&stylesheet=' . $encoded_slug ), 'updates' ) : null, ), 'blockTheme' => $theme->is_block_theme(), ); } if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); } $prepared_themes = apply_filters( 'wp_prepare_themes_for_js', $prepared_themes ); $prepared_themes = array_values( $prepared_themes ); return array_filter( $prepared_themes ); } function customize_themes_print_templates() { ?> + + delete( $extension ); if ( ! $result ) { return new WP_Error( 'could_not_resume_theme', __( 'Could not resume the theme.' ) ); } return true; } function paused_themes_notice() { if ( 'themes.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'resume_themes' ) ) { return; } if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) { return; } printf( '

    %s
    %s

    %s

    ', __( 'One or more themes failed to load properly.' ), __( 'You can find more details and make changes on the Themes screen.' ), esc_url( admin_url( 'themes.php' ) ), __( 'Go to the Themes screen' ) ); } $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; ob_start(); $item_id = esc_attr( $menu_item->ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = false; if ( 'taxonomy' === $menu_item->type ) { $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); if ( $original_object && ! is_wp_error( $original_object ) ) { $original_title = $original_object->name; } } elseif ( 'post_type' === $menu_item->type ) { $original_object = get_post( $menu_item->object_id ); if ( $original_object ) { $original_title = get_the_title( $original_object->ID ); } } elseif ( 'post_type_archive' === $menu_item->type ) { $original_object = get_post_type_object( $menu_item->object ); if ( $original_object ) { $original_title = $original_object->labels->archives; } } $classes = array( 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $menu_item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), ); $title = $menu_item->title; if ( ! empty( $menu_item->_invalid ) ) { $classes[] = 'menu-item-invalid'; $title = sprintf( __( '%s (Invalid)' ), $menu_item->title ); } elseif ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { $classes[] = 'pending'; $title = sprintf( __( '%s (Pending)' ), $menu_item->title ); } $title = ( ! isset( $menu_item->label ) || '' === $menu_item->label ) ? $title : $menu_item->label; $submenu_text = ''; if ( 0 === $depth ) { $submenu_text = 'style="display: none;"'; } ?> +
  • '; ?> + + find_folder( trailingslashit( dirname( $file ) ) ); if ( empty( $gen_dir ) ) { continue; } $remote_file = $gen_dir . basename( $file ); if ( ! $wp_filesystem->exists( $remote_file ) ) { continue; } if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) { $wp_filesystem->put_contents( $remote_file, '' ); } } } function _upgrade_422_find_genericons_files_in_folder( $directory ) { $directory = trailingslashit( $directory ); $files = array(); if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), 'Genericons' ) ) { $files[] = "{$directory}example.html"; } $dirs = glob( $directory . '*', GLOB_ONLYDIR ); $dirs = array_filter( $dirs, static function( $dir ) { return false === strpos( $dir, 'node_modules' ); } ); if ( $dirs ) { foreach ( $dirs as $dir ) { $files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) ); } } return $files; } function _upgrade_440_force_deactivate_incompatible_plugins() { if ( defined( 'REST_API_VERSION' ) && version_compare( REST_API_VERSION, '2.0-beta4', '<=' ) ) { deactivate_plugins( array( 'rest-api/plugin.php' ), true ); } } function _upgrade_590_force_deactivate_incompatible_plugins() { if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.9', '<' ) ) { $deactivated_gutenberg['gutenberg'] = array( 'plugin_name' => 'Gutenberg', 'version_deactivated' => GUTENBERG_VERSION, 'version_compatible' => '11.9', ); if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) { $deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() ); $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg ); update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins ); } else { $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() ); $deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg ); update_option( 'wp_force_deactivated_plugins', $deactivated_plugins ); } deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true ); } } is_disabled() ) { return false; } $allow_relaxed_file_ownership = false; if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { $allow_relaxed_file_ownership = true; } if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) { if ( 'core' === $type ) { $this->send_core_update_notification_email( $item ); } return false; } if ( 'core' === $type ) { $update = Core_Upgrader::should_update_to_version( $item->current ); } elseif ( 'plugin' === $type || 'theme' === $type ) { $update = ! empty( $item->autoupdate ); if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) { $auto_updates = (array) get_site_option( "auto_update_{$type}s", array() ); $update = in_array( $item->{$type}, $auto_updates, true ); } } else { $update = ! empty( $item->autoupdate ); } if ( ! empty( $item->disable_autoupdate ) ) { $update = $item->disable_autoupdate; } $update = apply_filters( "auto_update_{$type}", $update, $item ); if ( ! $update ) { if ( 'core' === $type ) { $this->send_core_update_notification_email( $item ); } return false; } if ( 'core' === $type ) { global $wpdb; $php_compat = version_compare( phpversion(), $item->php_version, '>=' ); if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { $mysql_compat = true; } else { $mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' ); } if ( ! $php_compat || ! $mysql_compat ) { return false; } } if ( in_array( $type, array( 'plugin', 'theme' ), true ) ) { if ( ! empty( $item->requires_php ) && version_compare( phpversion(), $item->requires_php, '<' ) ) { return false; } } return true; } protected function send_core_update_notification_email( $item ) { $notified = get_site_option( 'auto_core_update_notified' ); if ( $notified && get_site_option( 'admin_email' ) === $notified['email'] && $notified['version'] === $item->current ) { return false; } $notify = ! empty( $item->notify_email ); if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) { return false; } $this->send_email( 'manual', $item ); return true; } public function update( $type, $item ) { $skin = new Automatic_Upgrader_Skin; switch ( $type ) { case 'core': add_filter( 'update_feedback', array( $skin, 'feedback' ) ); $upgrader = new Core_Upgrader( $skin ); $context = ABSPATH; break; case 'plugin': $upgrader = new Plugin_Upgrader( $skin ); $context = WP_PLUGIN_DIR; break; case 'theme': $upgrader = new Theme_Upgrader( $skin ); $context = get_theme_root( $item->theme ); break; case 'translation': $upgrader = new Language_Pack_Upgrader( $skin ); $context = WP_CONTENT_DIR; break; } if ( ! $this->should_update( $type, $item, $context ) ) { return false; } do_action( 'pre_auto_update', $type, $item, $context ); $upgrader_item = $item; switch ( $type ) { case 'core': $skin->feedback( __( 'Updating to WordPress %s' ), $item->version ); $item_name = sprintf( __( 'WordPress %s' ), $item->version ); break; case 'theme': $upgrader_item = $item->theme; $theme = wp_get_theme( $upgrader_item ); $item_name = $theme->Get( 'Name' ); $item->current_version = $theme->get( 'Version' ); if ( empty( $item->current_version ) ) { $item->current_version = false; } $skin->feedback( __( 'Updating theme: %s' ), $item_name ); break; case 'plugin': $upgrader_item = $item->plugin; $plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); $item_name = $plugin_data['Name']; $item->current_version = $plugin_data['Version']; if ( empty( $item->current_version ) ) { $item->current_version = false; } $skin->feedback( __( 'Updating plugin: %s' ), $item_name ); break; case 'translation': $language_item_name = $upgrader->get_name_for_update( $item ); $item_name = sprintf( __( 'Translations for %s' ), $language_item_name ); $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)…' ), $language_item_name, $item->language ) ); break; } $allow_relaxed_file_ownership = false; if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { $allow_relaxed_file_ownership = true; } $upgrade_result = $upgrader->upgrade( $upgrader_item, array( 'clear_update_cache' => false, 'pre_check_md5' => false, 'attempt_rollback' => true, 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, ) ); if ( false === $upgrade_result ) { $upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } if ( 'core' === $type ) { if ( is_wp_error( $upgrade_result ) && ( 'up_to_date' === $upgrade_result->get_error_code() || 'locked' === $upgrade_result->get_error_code() ) ) { return false; } if ( is_wp_error( $upgrade_result ) ) { $upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) ); $skin->error( $upgrade_result ); } else { $skin->feedback( __( 'WordPress updated successfully.' ) ); } } $this->update_results[ $type ][] = (object) array( 'item' => $item, 'result' => $upgrade_result, 'name' => $item_name, 'messages' => $skin->get_upgrade_messages(), ); return $upgrade_result; } public function run() { if ( $this->is_disabled() ) { return; } if ( ! is_main_network() || ! is_main_site() ) { return; } if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) { return; } remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); remove_action( 'upgrader_process_complete', 'wp_version_check' ); remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); remove_action( 'upgrader_process_complete', 'wp_update_themes' ); wp_update_plugins(); $plugin_updates = get_site_transient( 'update_plugins' ); if ( $plugin_updates && ! empty( $plugin_updates->response ) ) { foreach ( $plugin_updates->response as $plugin ) { $this->update( 'plugin', $plugin ); } wp_clean_plugins_cache(); } wp_update_themes(); $theme_updates = get_site_transient( 'update_themes' ); if ( $theme_updates && ! empty( $theme_updates->response ) ) { foreach ( $theme_updates->response as $theme ) { $this->update( 'theme', (object) $theme ); } wp_clean_themes_cache(); } wp_version_check(); $core_update = find_core_auto_update(); if ( $core_update ) { $this->update( 'core', $core_update ); } $theme_stats = array(); if ( isset( $this->update_results['theme'] ) ) { foreach ( $this->update_results['theme'] as $upgrade ) { $theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result ); } } wp_update_themes( $theme_stats ); $plugin_stats = array(); if ( isset( $this->update_results['plugin'] ) ) { foreach ( $this->update_results['plugin'] as $upgrade ) { $plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result ); } } wp_update_plugins( $plugin_stats ); $language_updates = wp_get_translation_updates(); if ( $language_updates ) { foreach ( $language_updates as $update ) { $this->update( 'translation', $update ); } wp_clean_update_cache(); wp_version_check(); wp_update_themes(); wp_update_plugins(); } if ( ! empty( $this->update_results ) ) { $development_version = false !== strpos( get_bloginfo( 'version' ), '-' ); if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) { $this->send_debug_email(); } if ( ! empty( $this->update_results['core'] ) ) { $this->after_core_update( $this->update_results['core'][0] ); } elseif ( ! empty( $this->update_results['plugin'] ) || ! empty( $this->update_results['theme'] ) ) { $this->after_plugin_theme_update( $this->update_results ); } do_action( 'automatic_updates_complete', $this->update_results ); } WP_Upgrader::release_lock( 'auto_updater' ); } protected function after_core_update( $update_result ) { $wp_version = get_bloginfo( 'version' ); $core_update = $update_result->item; $result = $update_result->result; if ( ! is_wp_error( $result ) ) { $this->send_email( 'success', $core_update ); return; } $error_code = $result->get_error_code(); $critical = false; if ( 'disk_full' === $error_code || false !== strpos( $error_code, '__copy_dir' ) ) { $critical = true; } elseif ( 'rollback_was_required' === $error_code && is_wp_error( $result->get_error_data()->rollback ) ) { $critical = true; $rollback_result = $result->get_error_data()->rollback; } elseif ( false !== strpos( $error_code, 'do_rollback' ) ) { $critical = true; } if ( $critical ) { $critical_data = array( 'attempted' => $core_update->current, 'current' => $wp_version, 'error_code' => $error_code, 'error_data' => $result->get_error_data(), 'timestamp' => time(), 'critical' => true, ); if ( isset( $rollback_result ) ) { $critical_data['rollback_code'] = $rollback_result->get_error_code(); $critical_data['rollback_data'] = $rollback_result->get_error_data(); } update_site_option( 'auto_core_update_failed', $critical_data ); $this->send_email( 'critical', $core_update, $result ); return; } $send = true; $transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' ); if ( in_array( $error_code, $transient_failures, true ) && ! get_site_option( 'auto_core_update_failed' ) ) { wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' ); $send = false; } $notified = get_site_option( 'auto_core_update_notified' ); if ( $notified && 'fail' === $notified['type'] && get_site_option( 'admin_email' ) === $notified['email'] && $notified['version'] === $core_update->current ) { $send = false; } update_site_option( 'auto_core_update_failed', array( 'attempted' => $core_update->current, 'current' => $wp_version, 'error_code' => $error_code, 'error_data' => $result->get_error_data(), 'timestamp' => time(), 'retry' => in_array( $error_code, $transient_failures, true ), ) ); if ( $send ) { $this->send_email( 'fail', $core_update, $result ); } } protected function send_email( $type, $core_update, $result = null ) { update_site_option( 'auto_core_update_notified', array( 'type' => $type, 'email' => get_site_option( 'admin_email' ), 'version' => $core_update->current, 'timestamp' => time(), ) ); $next_user_core_update = get_preferred_from_update_core(); if ( ! $next_user_core_update ) { $next_user_core_update = $core_update; } if ( 'upgrade' === $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) ) { $newer_version_available = true; } else { $newer_version_available = false; } if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) { return; } switch ( $type ) { case 'success': $subject = __( '[%1$s] Your site has updated to WordPress %2$s' ); break; case 'fail': case 'manual': $subject = __( '[%1$s] WordPress %2$s is available. Please update!' ); break; case 'critical': $subject = __( '[%1$s] URGENT: Your site may be down due to a failed update' ); break; default: return; } $version = 'success' === $type ? $core_update->current : $next_user_core_update->current; $subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $version ); $body = ''; switch ( $type ) { case 'success': $body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current ); $body .= "\n\n"; if ( ! $newer_version_available ) { $body .= __( 'No further action is needed on your part.' ) . ' '; } list( $about_version ) = explode( '-', $core_update->current, 2 ); $body .= sprintf( __( 'For more on version %s, see the About WordPress screen:' ), $about_version ); $body .= "\n" . admin_url( 'about.php' ); if ( $newer_version_available ) { $body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' '; $body .= __( 'Updating is easy and only takes a few moments:' ); $body .= "\n" . network_admin_url( 'update-core.php' ); } break; case 'fail': case 'manual': $body .= sprintf( __( 'Please update your site at %1$s to WordPress %2$s.' ), home_url(), $next_user_core_update->current ); $body .= "\n\n"; if ( 'fail' === $type && ! $newer_version_available ) { $body .= __( 'An attempt was made, but your site could not be updated automatically.' ) . ' '; } $body .= __( 'Updating is easy and only takes a few moments:' ); $body .= "\n" . network_admin_url( 'update-core.php' ); break; case 'critical': if ( $newer_version_available ) { $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current ); } else { $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current ); } $body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." ); $body .= "\n\n" . __( "Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:" ); $body .= "\n" . network_admin_url( 'update-core.php' ); break; } $critical_support = 'critical' === $type && ! empty( $core_update->support_email ); if ( $critical_support ) { $body .= "\n\n" . sprintf( __( 'The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working.' ), $core_update->support_email ); } else { $body .= "\n\n" . __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' ); $body .= "\n" . __( 'https://wordpress.org/support/forums/' ); } if ( 'success' !== $type || $newer_version_available ) { $body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ); } if ( $critical_support ) { $body .= ' ' . __( "If you reach out to us, we'll also ensure you'll never have this problem again." ); } if ( 'success' === $type && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) { $body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' ); $body .= "\n" . network_admin_url(); } $body .= "\n\n" . __( 'The WordPress Team' ) . "\n"; if ( 'critical' === $type && is_wp_error( $result ) ) { $body .= "\n***\n\n"; $body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) ); $body .= ' ' . __( 'Some data that describes the error your site encountered has been put together.' ); $body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' ); if ( 'rollback_was_required' === $result->get_error_code() ) { $errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback ); } else { $errors = array( $result ); } foreach ( $errors as $error ) { if ( ! is_wp_error( $error ) ) { continue; } $error_code = $error->get_error_code(); $body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code ); if ( 'rollback_was_required' === $error_code ) { continue; } if ( $error->get_error_message() ) { $body .= "\n" . $error->get_error_message(); } $error_data = $error->get_error_data(); if ( $error_data ) { $body .= "\n" . implode( ', ', (array) $error_data ); } } $body .= "\n"; } $to = get_site_option( 'admin_email' ); $headers = ''; $email = compact( 'to', 'subject', 'body', 'headers' ); $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result ); wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); } protected function after_plugin_theme_update( $update_results ) { $successful_updates = array(); $failed_updates = array(); if ( ! empty( $update_results['plugin'] ) ) { $notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] ); if ( $notifications_enabled ) { foreach ( $update_results['plugin'] as $update_result ) { if ( true === $update_result->result ) { $successful_updates['plugin'][] = $update_result; } else { $failed_updates['plugin'][] = $update_result; } } } } if ( ! empty( $update_results['theme'] ) ) { $notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] ); if ( $notifications_enabled ) { foreach ( $update_results['theme'] as $update_result ) { if ( true === $update_result->result ) { $successful_updates['theme'][] = $update_result; } else { $failed_updates['theme'][] = $update_result; } } } } if ( empty( $successful_updates ) && empty( $failed_updates ) ) { return; } if ( empty( $failed_updates ) ) { $this->send_plugin_theme_email( 'success', $successful_updates, $failed_updates ); } elseif ( empty( $successful_updates ) ) { $this->send_plugin_theme_email( 'fail', $successful_updates, $failed_updates ); } else { $this->send_plugin_theme_email( 'mixed', $successful_updates, $failed_updates ); } } protected function send_plugin_theme_email( $type, $successful_updates, $failed_updates ) { if ( empty( $successful_updates ) && empty( $failed_updates ) ) { return; } $unique_failures = false; $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( 'fail' === $type ) { foreach ( $failed_updates as $update_type => $failures ) { foreach ( $failures as $failed_update ) { if ( ! isset( $past_failure_emails[ $failed_update->item->{$update_type} ] ) ) { $unique_failures = true; continue; } if ( version_compare( $past_failure_emails[ $failed_update->item->{$update_type} ], $failed_update->item->new_version, '<' ) ) { $unique_failures = true; } } } if ( ! $unique_failures ) { return; } } $body = array(); $successful_plugins = ( ! empty( $successful_updates['plugin'] ) ); $successful_themes = ( ! empty( $successful_updates['theme'] ) ); $failed_plugins = ( ! empty( $failed_updates['plugin'] ) ); $failed_themes = ( ! empty( $failed_updates['theme'] ) ); switch ( $type ) { case 'success': if ( $successful_plugins && $successful_themes ) { $subject = __( '[%s] Some plugins and themes have automatically updated' ); $body[] = sprintf( __( 'Howdy! Some plugins and themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), home_url() ); } elseif ( $successful_plugins ) { $subject = __( '[%s] Some plugins were automatically updated' ); $body[] = sprintf( __( 'Howdy! Some plugins have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), home_url() ); } else { $subject = __( '[%s] Some themes were automatically updated' ); $body[] = sprintf( __( 'Howdy! Some themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), home_url() ); } break; case 'fail': case 'mixed': if ( $failed_plugins && $failed_themes ) { $subject = __( '[%s] Some plugins and themes have failed to update' ); $body[] = sprintf( __( 'Howdy! Plugins and themes failed to update on your site at %s.' ), home_url() ); } elseif ( $failed_plugins ) { $subject = __( '[%s] Some plugins have failed to update' ); $body[] = sprintf( __( 'Howdy! Plugins failed to update on your site at %s.' ), home_url() ); } else { $subject = __( '[%s] Some themes have failed to update' ); $body[] = sprintf( __( 'Howdy! Themes failed to update on your site at %s.' ), home_url() ); } break; } if ( in_array( $type, array( 'fail', 'mixed' ), true ) ) { $body[] = "\n"; $body[] = __( 'Please check your site now. It’s possible that everything is working. If there are updates available, you should update.' ); $body[] = "\n"; if ( ! empty( $failed_updates['plugin'] ) ) { $body[] = __( 'These plugins failed to update:' ); foreach ( $failed_updates['plugin'] as $item ) { if ( $item->item->current_version ) { $body[] = sprintf( __( '- %1$s (from version %2$s to %3$s)' ), $item->name, $item->item->current_version, $item->item->new_version ); } else { $body[] = sprintf( __( '- %1$s version %2$s' ), $item->name, $item->item->new_version ); } $past_failure_emails[ $item->item->plugin ] = $item->item->new_version; } $body[] = "\n"; } if ( ! empty( $failed_updates['theme'] ) ) { $body[] = __( 'These themes failed to update:' ); foreach ( $failed_updates['theme'] as $item ) { if ( $item->item->current_version ) { $body[] = sprintf( __( '- %1$s (from version %2$s to %3$s)' ), $item->name, $item->item->current_version, $item->item->new_version ); } else { $body[] = sprintf( __( '- %1$s version %2$s' ), $item->name, $item->item->new_version ); } $past_failure_emails[ $item->item->theme ] = $item->item->new_version; } $body[] = "\n"; } } if ( in_array( $type, array( 'success', 'mixed' ), true ) ) { $body[] = "\n"; if ( ! empty( $successful_updates['plugin'] ) ) { $body[] = __( 'These plugins are now up to date:' ); foreach ( $successful_updates['plugin'] as $item ) { if ( $item->item->current_version ) { $body[] = sprintf( __( '- %1$s (from version %2$s to %3$s)' ), $item->name, $item->item->current_version, $item->item->new_version ); } else { $body[] = sprintf( __( '- %1$s version %2$s' ), $item->name, $item->item->new_version ); } unset( $past_failure_emails[ $item->item->plugin ] ); } $body[] = "\n"; } if ( ! empty( $successful_updates['theme'] ) ) { $body[] = __( 'These themes are now up to date:' ); foreach ( $successful_updates['theme'] as $item ) { if ( $item->item->current_version ) { $body[] = sprintf( __( '- %1$s (from version %2$s to %3$s)' ), $item->name, $item->item->current_version, $item->item->new_version ); } else { $body[] = sprintf( __( '- %1$s version %2$s' ), $item->name, $item->item->new_version ); } unset( $past_failure_emails[ $item->item->theme ] ); } $body[] = "\n"; } } if ( $failed_plugins ) { $body[] = sprintf( __( 'To manage plugins on your site, visit the Plugins page: %s' ), admin_url( 'plugins.php' ) ); $body[] = "\n"; } if ( $failed_themes ) { $body[] = sprintf( __( 'To manage themes on your site, visit the Themes page: %s' ), admin_url( 'themes.php' ) ); $body[] = "\n"; } $body[] = __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' ); $body[] = __( 'https://wordpress.org/support/forums/' ); $body[] = "\n" . __( 'The WordPress Team' ); if ( '' !== get_option( 'blogname' ) ) { $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); } $body = implode( "\n", $body ); $to = get_site_option( 'admin_email' ); $subject = sprintf( $subject, $site_title ); $headers = ''; $email = compact( 'to', 'subject', 'body', 'headers' ); $email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates ); $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); if ( $result ) { update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } } protected function send_debug_email() { $update_count = 0; foreach ( $this->update_results as $type => $updates ) { $update_count += count( $updates ); } $body = array(); $failures = 0; $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); if ( isset( $this->update_results['core'] ) ) { $result = $this->update_results['core'][0]; if ( $result->result && ! is_wp_error( $result->result ) ) { $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name ); } else { $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name ); $failures++; } $body[] = ''; } foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { if ( ! isset( $this->update_results[ $type ] ) ) { continue; } $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) ); if ( $success_items ) { $messages = array( 'plugin' => __( 'The following plugins were successfully updated:' ), 'theme' => __( 'The following themes were successfully updated:' ), 'translation' => __( 'The following translations were successfully updated:' ), ); $body[] = $messages[ $type ]; foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) { $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name ); } } if ( $success_items !== $this->update_results[ $type ] ) { $messages = array( 'plugin' => __( 'The following plugins failed to update:' ), 'theme' => __( 'The following themes failed to update:' ), 'translation' => __( 'The following translations failed to update:' ), ); $body[] = $messages[ $type ]; foreach ( $this->update_results[ $type ] as $item ) { if ( ! $item->result || is_wp_error( $item->result ) ) { $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name ); $failures++; } } } $body[] = ''; } if ( '' !== get_bloginfo( 'name' ) ) { $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); } if ( $failures ) { $body[] = trim( __( "BETA TESTING? +============= -.customize-control-header .header-view .close:focus { - outline: 1px solid #4f94d4; -} +This debugging email is sent when you are using a development version of WordPress. -/* Header control: randomiz(s)er */ +If you think these failures might be due to a bug in WordPress, could you report it? + * Open a thread in the support forums: https://wordpress.org/support/forum/alphabeta + * Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/ -.customize-control-header .random.placeholder { - cursor: pointer; - border-radius: 2px; - height: 40px; -} +Thanks! -- The WordPress Team" ) ); $body[] = ''; $subject = sprintf( __( '[%s] Background Update Failed' ), $site_title ); } else { $subject = sprintf( __( '[%s] Background Update Finished' ), $site_title ); } $body[] = trim( __( 'UPDATE LOG +==========' ) ); $body[] = ''; foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) { if ( ! isset( $this->update_results[ $type ] ) ) { continue; } foreach ( $this->update_results[ $type ] as $update ) { $body[] = $update->name; $body[] = str_repeat( '-', strlen( $update->name ) ); foreach ( $update->messages as $message ) { $body[] = ' ' . html_entity_decode( str_replace( '…', '...', $message ) ); } if ( is_wp_error( $update->result ) ) { $results = array( 'update' => $update->result ); if ( 'rollback_was_required' === $update->result->get_error_code() ) { $results = (array) $update->result->get_error_data(); } foreach ( $results as $result_type => $result ) { if ( ! is_wp_error( $result ) ) { continue; } if ( 'rollback' === $result_type ) { $body[] = ' ' . sprintf( __( 'Rollback Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() ); } else { $body[] = ' ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() ); } if ( $result->get_error_data() ) { $body[] = ' ' . implode( ', ', (array) $result->get_error_data() ); } } } $body[] = ''; } } $email = array( 'to' => get_site_option( 'admin_email' ), 'subject' => $subject, 'body' => implode( "\n", $body ), 'headers' => '', ); $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results ); wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); } } '', 'plugin' => '', 'nonce' => '', 'title' => __( 'Update Plugin' ), ); $args = wp_parse_args( $args, $defaults ); $this->plugin = $args['plugin']; $this->plugin_active = is_plugin_active( $this->plugin ); $this->plugin_network_active = is_plugin_active_for_network( $this->plugin ); parent::__construct( $args ); } public function after() { $this->plugin = $this->upgrader->plugin_info(); if ( ! empty( $this->plugin ) && ! is_wp_error( $this->result ) && $this->plugin_active ) { printf( '', esc_attr__( 'Update progress' ), wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) ); } $this->decrement_update_count( 'plugin' ); $update_actions = array( 'activate_plugin' => sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ), __( 'Activate Plugin' ) ), 'plugins_page' => sprintf( '%s', self_admin_url( 'plugins.php' ), __( 'Go to Plugins page' ) ), ); if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugin', $this->plugin ) ) { unset( $update_actions['activate_plugin'] ); } $update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } maybe_create_scheduled_event(); $this->php_memory_limit = ini_get( 'memory_limit' ); $this->timeout_late_cron = 0; $this->timeout_missed_cron = - 5 * MINUTE_IN_SECONDS; if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { $this->timeout_late_cron = - 15 * MINUTE_IN_SECONDS; $this->timeout_missed_cron = - 1 * HOUR_IN_SECONDS; } add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'wp_site_health_scheduled_check', array( $this, 'wp_cron_scheduled_check' ) ); add_action( 'site_health_tab_content', array( $this, 'show_site_health_tab' ) ); } public function show_site_health_tab( $tab ) { if ( 'debug' === $tab ) { require_once ABSPATH . '/wp-admin/site-health-info.php'; } } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new WP_Site_Health(); } return self::$instance; } public function enqueue_scripts() { $screen = get_current_screen(); if ( 'site-health' !== $screen->id && 'dashboard' !== $screen->id ) { return; } $health_check_js_variables = array( 'screen' => $screen->id, 'nonce' => array( 'site_status' => wp_create_nonce( 'health-check-site-status' ), 'site_status_result' => wp_create_nonce( 'health-check-site-status-result' ), ), 'site_status' => array( 'direct' => array(), 'async' => array(), 'issues' => array( 'good' => 0, 'recommended' => 0, 'critical' => 0, ), ), ); $issue_counts = get_transient( 'health-check-site-status-result' ); if ( false !== $issue_counts ) { $issue_counts = json_decode( $issue_counts ); $health_check_js_variables['site_status']['issues'] = $issue_counts; } if ( 'site-health' === $screen->id && ( ! isset( $_GET['tab'] ) || empty( $_GET['tab'] ) ) ) { $tests = WP_Site_Health::get_tests(); if ( $this->is_development_environment() ) { unset( $tests['async']['https_status'] ); } foreach ( $tests['direct'] as $test ) { if ( is_string( $test['test'] ) ) { $test_function = sprintf( 'get_test_%s', $test['test'] ); if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) { $health_check_js_variables['site_status']['direct'][] = $this->perform_test( array( $this, $test_function ) ); continue; } } if ( is_callable( $test['test'] ) ) { $health_check_js_variables['site_status']['direct'][] = $this->perform_test( $test['test'] ); } } foreach ( $tests['async'] as $test ) { if ( is_string( $test['test'] ) ) { $health_check_js_variables['site_status']['async'][] = array( 'test' => $test['test'], 'has_rest' => ( isset( $test['has_rest'] ) ? $test['has_rest'] : false ), 'completed' => false, 'headers' => isset( $test['headers'] ) ? $test['headers'] : array(), ); } } } wp_localize_script( 'site-health', 'SiteHealth', $health_check_js_variables ); } private function perform_test( $callback ) { return apply_filters( 'site_status_test_result', call_user_func( $callback ) ); } private function prepare_sql_data() { global $wpdb; if ( $wpdb->use_mysqli ) { $mysql_server_type = mysqli_get_server_info( $wpdb->dbh ); } else { $mysql_server_type = mysql_get_server_info( $wpdb->dbh ); } $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' ); $this->health_check_mysql_rec_version = '5.6'; if ( stristr( $mysql_server_type, 'mariadb' ) ) { $this->is_mariadb = true; $this->health_check_mysql_rec_version = '10.0'; } $this->mysql_min_version_check = version_compare( '5.5', $this->mysql_server_version, '<=' ); $this->mysql_rec_version_check = version_compare( $this->health_check_mysql_rec_version, $this->mysql_server_version, '<=' ); } public function check_wp_version_check_exists() { if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can( 'update_core' ) || ! isset( $_GET['health-check-test-wp_version_check'] ) ) { return; } echo ( has_filter( 'wp_version_check', 'wp_version_check' ) ? 'yes' : 'no' ); die(); } public function get_test_wordpress_version() { $result = array( 'label' => '', 'status' => '', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => '', 'actions' => '', 'test' => 'wordpress_version', ); $core_current_version = get_bloginfo( 'version' ); $core_updates = get_core_updates(); if ( ! is_array( $core_updates ) ) { $result['status'] = 'recommended'; $result['label'] = sprintf( __( 'WordPress version %s' ), $core_current_version ); $result['description'] = sprintf( '

    %s

    ', __( 'Unable to check if any new versions of WordPress are available.' ) ); $result['actions'] = sprintf( '%s', esc_url( admin_url( 'update-core.php?force-check=1' ) ), __( 'Check for updates manually' ) ); } else { foreach ( $core_updates as $core => $update ) { if ( 'upgrade' === $update->response ) { $current_version = explode( '.', $core_current_version ); $new_version = explode( '.', $update->version ); $current_major = $current_version[0] . '.' . $current_version[1]; $new_major = $new_version[0] . '.' . $new_version[1]; $result['label'] = sprintf( __( 'WordPress update available (%s)' ), $update->version ); $result['actions'] = sprintf( '%s', esc_url( admin_url( 'update-core.php' ) ), __( 'Install the latest version of WordPress' ) ); if ( $current_major !== $new_major ) { $result['status'] = 'recommended'; $result['description'] = sprintf( '

    %s

    ', __( 'A new version of WordPress is available.' ) ); } else { $result['status'] = 'critical'; $result['badge']['label'] = __( 'Security' ); $result['description'] = sprintf( '

    %s

    ', __( 'A new minor update is available for your site. Because minor updates often address security, it’s important to install them.' ) ); } } else { $result['status'] = 'good'; $result['label'] = sprintf( __( 'Your version of WordPress (%s) is up to date' ), $core_current_version ); $result['description'] = sprintf( '

    %s

    ', __( 'You are currently running the latest version of WordPress available, keep it up!' ) ); } } } return $result; } public function get_test_plugin_version() { $result = array( 'label' => __( 'Your plugins are all up to date' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Plugins extend your site’s functionality with things like contact forms, ecommerce and much more. That means they have deep access to your site, so it’s vital to keep them up to date.' ) ), 'actions' => sprintf( '

    %s

    ', esc_url( admin_url( 'plugins.php' ) ), __( 'Manage your plugins' ) ), 'test' => 'plugin_version', ); $plugins = get_plugins(); $plugin_updates = get_plugin_updates(); $plugins_have_updates = false; $plugins_active = 0; $plugins_total = 0; $plugins_need_update = 0; foreach ( $plugins as $plugin_path => $plugin ) { $plugins_total++; if ( is_plugin_active( $plugin_path ) ) { $plugins_active++; } $plugin_version = $plugin['Version']; if ( array_key_exists( $plugin_path, $plugin_updates ) ) { $plugins_need_update++; $plugins_have_updates = true; } } if ( $plugins_need_update > 0 ) { $result['status'] = 'critical'; $result['label'] = __( 'You have plugins waiting to be updated' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( _n( 'Your site has %d plugin waiting to be updated.', 'Your site has %d plugins waiting to be updated.', $plugins_need_update ), $plugins_need_update ) ); $result['actions'] .= sprintf( '

    %s

    ', esc_url( network_admin_url( 'plugins.php?plugin_status=upgrade' ) ), __( 'Update your plugins' ) ); } else { if ( 1 === $plugins_active ) { $result['description'] .= sprintf( '

    %s

    ', __( 'Your site has 1 active plugin, and it is up to date.' ) ); } else { $result['description'] .= sprintf( '

    %s

    ', sprintf( _n( 'Your site has %d active plugin, and it is up to date.', 'Your site has %d active plugins, and they are all up to date.', $plugins_active ), $plugins_active ) ); } } if ( $plugins_total > $plugins_active && ! is_multisite() ) { $unused_plugins = $plugins_total - $plugins_active; $result['status'] = 'recommended'; $result['label'] = __( 'You should remove inactive plugins' ); $result['description'] .= sprintf( '

    %s %s

    ', sprintf( _n( 'Your site has %d inactive plugin.', 'Your site has %d inactive plugins.', $unused_plugins ), $unused_plugins ), __( 'Inactive plugins are tempting targets for attackers. If you are not going to use a plugin, you should consider removing it.' ) ); $result['actions'] .= sprintf( '

    %s

    ', esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ), __( 'Manage inactive plugins' ) ); } return $result; } public function get_test_theme_version() { $result = array( 'label' => __( 'Your themes are all up to date' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Themes add your site’s look and feel. It’s important to keep them up to date, to stay consistent with your brand and keep your site secure.' ) ), 'actions' => sprintf( '

    %s

    ', esc_url( admin_url( 'themes.php' ) ), __( 'Manage your themes' ) ), 'test' => 'theme_version', ); $theme_updates = get_theme_updates(); $themes_total = 0; $themes_need_updates = 0; $themes_inactive = 0; $allowed_theme_count = 1; $has_default_theme = false; $has_unused_themes = false; $show_unused_themes = true; $using_default_theme = false; $all_themes = wp_get_themes(); $active_theme = wp_get_theme(); $default_theme = wp_get_theme( WP_DEFAULT_THEME ); if ( ! $default_theme->exists() ) { $default_theme = WP_Theme::get_core_default_theme(); } if ( $default_theme ) { $has_default_theme = true; if ( $active_theme->get_stylesheet() === $default_theme->get_stylesheet() || is_child_theme() && $active_theme->get_template() === $default_theme->get_template() ) { $using_default_theme = true; } } foreach ( $all_themes as $theme_slug => $theme ) { $themes_total++; if ( array_key_exists( $theme_slug, $theme_updates ) ) { $themes_need_updates++; } } if ( is_child_theme() ) { $allowed_theme_count++; } if ( $has_default_theme && ! $using_default_theme ) { $allowed_theme_count++; } if ( $themes_total > $allowed_theme_count ) { $has_unused_themes = true; $themes_inactive = ( $themes_total - $allowed_theme_count ); } if ( $themes_need_updates > 0 ) { $result['status'] = 'critical'; $result['label'] = __( 'You have themes waiting to be updated' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( _n( 'Your site has %d theme waiting to be updated.', 'Your site has %d themes waiting to be updated.', $themes_need_updates ), $themes_need_updates ) ); } else { if ( 1 === $themes_total ) { $result['description'] .= sprintf( '

    %s

    ', __( 'Your site has 1 installed theme, and it is up to date.' ) ); } else { $result['description'] .= sprintf( '

    %s

    ', sprintf( _n( 'Your site has %d installed theme, and it is up to date.', 'Your site has %d installed themes, and they are all up to date.', $themes_total ), $themes_total ) ); } } if ( $has_unused_themes && $show_unused_themes && ! is_multisite() ) { if ( $active_theme->parent() ) { $result['status'] = 'recommended'; $result['label'] = __( 'You should remove inactive themes' ); if ( $using_default_theme ) { $result['description'] .= sprintf( '

    %s %s

    ', sprintf( _n( 'Your site has %d inactive theme.', 'Your site has %d inactive themes.', $themes_inactive ), $themes_inactive ), sprintf( __( 'To enhance your site’s security, you should consider removing any themes you are not using. You should keep your active theme, %1$s, and %2$s, its parent theme.' ), $active_theme->name, $active_theme->parent()->name ) ); } else { $result['description'] .= sprintf( '

    %s %s

    ', sprintf( _n( 'Your site has %d inactive theme.', 'Your site has %d inactive themes.', $themes_inactive ), $themes_inactive ), sprintf( __( 'To enhance your site’s security, you should consider removing any themes you are not using. You should keep %1$s, the default WordPress theme, %2$s, your active theme, and %3$s, its parent theme.' ), $default_theme ? $default_theme->name : WP_DEFAULT_THEME, $active_theme->name, $active_theme->parent()->name ) ); } } else { $result['status'] = 'recommended'; $result['label'] = __( 'You should remove inactive themes' ); if ( $using_default_theme ) { $result['description'] .= sprintf( '

    %s %s

    ', sprintf( _n( 'Your site has %1$d inactive theme, other than %2$s, your active theme.', 'Your site has %1$d inactive themes, other than %2$s, your active theme.', $themes_inactive ), $themes_inactive, $active_theme->name ), __( 'You should consider removing any unused themes to enhance your site’s security.' ) ); } else { $result['description'] .= sprintf( '

    %s %s

    ', sprintf( _n( 'Your site has %1$d inactive theme, other than %2$s, the default WordPress theme, and %3$s, your active theme.', 'Your site has %1$d inactive themes, other than %2$s, the default WordPress theme, and %3$s, your active theme.', $themes_inactive ), $themes_inactive, $default_theme ? $default_theme->name : WP_DEFAULT_THEME, $active_theme->name ), __( 'You should consider removing any unused themes to enhance your site’s security.' ) ); } } } if ( ! $has_default_theme ) { $result['status'] = 'recommended'; $result['label'] = __( 'Have a default theme available' ); $result['description'] .= sprintf( '

    %s

    ', __( 'Your site does not have any default theme. Default themes are used by WordPress automatically if anything is wrong with your chosen theme.' ) ); } return $result; } public function get_test_php_version() { $response = wp_check_php_version(); $result = array( 'label' => sprintf( __( 'Your site is running the current version of PHP (%s)' ), PHP_VERSION ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', sprintf( __( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site’s performance. The minimum recommended version of PHP is %s.' ), $response ? $response['recommended_version'] : '' ) ), 'actions' => sprintf( '

    %s %s

    ', esc_url( wp_get_update_php_url() ), __( 'Learn more about updating PHP' ), __( '(opens in a new tab)' ) ), 'test' => 'php_version', ); if ( ! $response || version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) { return $result; } if ( $response['is_supported'] ) { $result['label'] = sprintf( __( 'Your site is running an older version of PHP (%s)' ), PHP_VERSION ); $result['status'] = 'recommended'; return $result; } if ( $response['is_secure'] ) { $result['label'] = sprintf( __( 'Your site is running an older version of PHP (%s), which should be updated' ), PHP_VERSION ); $result['status'] = 'recommended'; return $result; } $result['label'] = sprintf( __( 'Your site is running an outdated version of PHP (%s), which requires an update' ), PHP_VERSION ); $result['status'] = 'critical'; $result['badge']['label'] = __( 'Security' ); return $result; } private function test_php_extension_availability( $extension_name = null, $function_name = null, $constant_name = null, $class_name = null ) { if ( ! $extension_name && ! $function_name && ! $constant_name && ! $class_name ) { return false; } if ( $extension_name && ! extension_loaded( $extension_name ) ) { return false; } if ( $function_name && ! function_exists( $function_name ) ) { return false; } if ( $constant_name && ! defined( $constant_name ) ) { return false; } if ( $class_name && ! class_exists( $class_name ) ) { return false; } return true; } public function get_test_php_extensions() { $result = array( 'label' => __( 'Required and recommended modules are installed' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    %s

    ', __( 'PHP modules perform most of the tasks on the server that make your site run. Any changes to these must be made by your server administrator.' ), sprintf( __( 'The WordPress Hosting Team maintains a list of those modules, both recommended and required, in the team handbook%3$s.' ), esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ), 'target="_blank" rel="noopener"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ) ), 'actions' => '', 'test' => 'php_extensions', ); $modules = array( 'curl' => array( 'function' => 'curl_version', 'required' => false, ), 'dom' => array( 'class' => 'DOMNode', 'required' => false, ), 'exif' => array( 'function' => 'exif_read_data', 'required' => false, ), 'fileinfo' => array( 'function' => 'finfo_file', 'required' => false, ), 'hash' => array( 'function' => 'hash', 'required' => false, ), 'imagick' => array( 'extension' => 'imagick', 'required' => false, ), 'json' => array( 'function' => 'json_last_error', 'required' => true, ), 'mbstring' => array( 'function' => 'mb_check_encoding', 'required' => false, ), 'mysqli' => array( 'function' => 'mysqli_connect', 'required' => false, ), 'libsodium' => array( 'constant' => 'SODIUM_LIBRARY_VERSION', 'required' => false, 'php_bundled_version' => '7.2.0', ), 'openssl' => array( 'function' => 'openssl_encrypt', 'required' => false, ), 'pcre' => array( 'function' => 'preg_match', 'required' => false, ), 'mod_xml' => array( 'extension' => 'libxml', 'required' => false, ), 'zip' => array( 'class' => 'ZipArchive', 'required' => false, ), 'filter' => array( 'function' => 'filter_list', 'required' => false, ), 'gd' => array( 'extension' => 'gd', 'required' => false, 'fallback_for' => 'imagick', ), 'iconv' => array( 'function' => 'iconv', 'required' => false, ), 'intl' => array( 'extension' => 'intl', 'required' => false, ), 'mcrypt' => array( 'extension' => 'mcrypt', 'required' => false, 'fallback_for' => 'libsodium', ), 'simplexml' => array( 'extension' => 'simplexml', 'required' => false, 'fallback_for' => 'mod_xml', ), 'xmlreader' => array( 'extension' => 'xmlreader', 'required' => false, 'fallback_for' => 'mod_xml', ), 'zlib' => array( 'extension' => 'zlib', 'required' => false, 'fallback_for' => 'zip', ), ); $modules = apply_filters( 'site_status_test_php_modules', $modules ); $failures = array(); foreach ( $modules as $library => $module ) { $extension_name = ( isset( $module['extension'] ) ? $module['extension'] : null ); $function_name = ( isset( $module['function'] ) ? $module['function'] : null ); $constant_name = ( isset( $module['constant'] ) ? $module['constant'] : null ); $class_name = ( isset( $module['class'] ) ? $module['class'] : null ); if ( isset( $module['fallback_for'] ) ) { if ( isset( $failures[ $module['fallback_for'] ] ) ) { $module['required'] = true; } else { continue; } } if ( ! $this->test_php_extension_availability( $extension_name, $function_name, $constant_name, $class_name ) && ( ! isset( $module['php_bundled_version'] ) || version_compare( PHP_VERSION, $module['php_bundled_version'], '<' ) ) ) { if ( $module['required'] ) { $result['status'] = 'critical'; $class = 'error'; $screen_reader = __( 'Error' ); $message = sprintf( __( 'The required module, %s, is not installed, or has been disabled.' ), $library ); } else { $class = 'warning'; $screen_reader = __( 'Warning' ); $message = sprintf( __( 'The optional module, %s, is not installed, or has been disabled.' ), $library ); } if ( ! $module['required'] && 'good' === $result['status'] ) { $result['status'] = 'recommended'; } $failures[ $library ] = "$screen_reader $message"; } } if ( ! empty( $failures ) ) { $output = ''; } if ( 'good' !== $result['status'] ) { if ( 'recommended' === $result['status'] ) { $result['label'] = __( 'One or more recommended modules are missing' ); } if ( 'critical' === $result['status'] ) { $result['label'] = __( 'One or more required modules are missing' ); } $result['description'] .= $output; } return $result; } public function get_test_php_default_timezone() { $result = array( 'label' => __( 'PHP default timezone is valid' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'PHP default timezone was configured by WordPress on loading. This is necessary for correct calculations of dates and times.' ) ), 'actions' => '', 'test' => 'php_default_timezone', ); if ( 'UTC' !== date_default_timezone_get() ) { $result['status'] = 'critical'; $result['label'] = __( 'PHP default timezone is invalid' ); $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'PHP default timezone was changed after WordPress loading by a %s function call. This interferes with correct calculations of dates and times.' ), 'date_default_timezone_set()' ) ); } return $result; } public function get_test_php_sessions() { $result = array( 'label' => __( 'No PHP sessions detected' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', sprintf( __( 'PHP sessions created by a %1$s function call may interfere with REST API and loopback requests. An active session should be closed by %2$s before making any HTTP requests.' ), 'session_start()', 'session_write_close()' ) ), 'test' => 'php_sessions', ); if ( function_exists( 'session_status' ) && PHP_SESSION_ACTIVE === session_status() ) { $result['status'] = 'critical'; $result['label'] = __( 'An active PHP session was detected' ); $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'A PHP session was created by a %1$s function call. This interferes with REST API and loopback requests. The session should be closed by %2$s before making any HTTP requests.' ), 'session_start()', 'session_write_close()' ) ); } return $result; } public function get_test_sql_server() { if ( ! $this->mysql_server_version ) { $this->prepare_sql_data(); } $result = array( 'label' => __( 'SQL server is up to date' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'The SQL server is a required piece of software for the database WordPress uses to store all your site’s content and settings.' ) ), 'actions' => sprintf( '

    %s %s

    ', esc_url( __( 'https://wordpress.org/about/requirements/' ) ), __( 'Learn more about what WordPress requires to run.' ), __( '(opens in a new tab)' ) ), 'test' => 'sql_server', ); $db_dropin = file_exists( WP_CONTENT_DIR . '/db.php' ); if ( ! $this->mysql_rec_version_check ) { $result['status'] = 'recommended'; $result['label'] = __( 'Outdated SQL server' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'For optimal performance and security reasons, you should consider running %1$s version %2$s or higher. Contact your web hosting company to correct this.' ), ( $this->is_mariadb ? 'MariaDB' : 'MySQL' ), $this->health_check_mysql_rec_version ) ); } if ( ! $this->mysql_min_version_check ) { $result['status'] = 'critical'; $result['label'] = __( 'Severely outdated SQL server' ); $result['badge']['label'] = __( 'Security' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ), ( $this->is_mariadb ? 'MariaDB' : 'MySQL' ), $this->health_check_mysql_required_version ) ); } if ( $db_dropin ) { $result['description'] .= sprintf( '

    %s

    ', wp_kses( sprintf( __( 'You are using a %1$s drop-in which might mean that a %2$s database is not being used.' ), 'wp-content/db.php', ( $this->is_mariadb ? 'MariaDB' : 'MySQL' ) ), array( 'code' => true, ) ) ); } return $result; } public function get_test_utf8mb4_support() { global $wpdb; if ( ! $this->mysql_server_version ) { $this->prepare_sql_data(); } $result = array( 'label' => __( 'UTF8MB4 is supported' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'UTF8MB4 is the character set WordPress prefers for database storage because it safely supports the widest set of characters and encodings, including Emoji, enabling better support for non-English languages.' ) ), 'actions' => '', 'test' => 'utf8mb4_support', ); if ( ! $this->is_mariadb ) { if ( version_compare( $this->mysql_server_version, '5.5.3', '<' ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'utf8mb4 requires a MySQL update' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'WordPress’ utf8mb4 support requires MySQL version %s or greater. Please contact your server administrator.' ), '5.5.3' ) ); } else { $result['description'] .= sprintf( '

    %s

    ', __( 'Your MySQL version supports utf8mb4.' ) ); } } else { if ( version_compare( $this->mysql_server_version, '5.5.0', '<' ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'utf8mb4 requires a MariaDB update' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'WordPress’ utf8mb4 support requires MariaDB version %s or greater. Please contact your server administrator.' ), '5.5.0' ) ); } else { $result['description'] .= sprintf( '

    %s

    ', __( 'Your MariaDB version supports utf8mb4.' ) ); } } if ( $wpdb->use_mysqli ) { $mysql_client_version = mysqli_get_client_info(); } else { $mysql_client_version = mysql_get_client_info(); } if ( false !== strpos( $mysql_client_version, 'mysqlnd' ) ) { $mysql_client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $mysql_client_version ); if ( version_compare( $mysql_client_version, '5.0.9', '<' ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'utf8mb4 requires a newer client library' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ), 'mysqlnd', '5.0.9' ) ); } } else { if ( version_compare( $mysql_client_version, '5.5.3', '<' ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'utf8mb4 requires a newer client library' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer. Please contact your server administrator.' ), 'libmysql', '5.5.3' ) ); } } return $result; } public function get_test_dotorg_communication() { $result = array( 'label' => __( 'Can communicate with WordPress.org' ), 'status' => '', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Communicating with the WordPress servers is used to check for new versions, and to both install and update WordPress core, themes or plugins.' ) ), 'actions' => '', 'test' => 'dotorg_communication', ); $wp_dotorg = wp_remote_get( 'https://api.wordpress.org', array( 'timeout' => 10, ) ); if ( ! is_wp_error( $wp_dotorg ) ) { $result['status'] = 'good'; } else { $result['status'] = 'critical'; $result['label'] = __( 'Could not reach WordPress.org' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( '%s %s', __( 'Error' ), sprintf( __( 'Your site is unable to reach WordPress.org at %1$s, and returned the error: %2$s' ), gethostbyname( 'api.wordpress.org' ), $wp_dotorg->get_error_message() ) ) ); $result['actions'] = sprintf( '

    %s %s

    ', esc_url( __( 'https://wordpress.org/support' ) ), __( 'Get help resolving this issue.' ), __( '(opens in a new tab)' ) ); } return $result; } public function get_test_is_in_debug_mode() { $result = array( 'label' => __( 'Your site is not set to output debug information' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.' ) ), 'actions' => sprintf( '

    %s %s

    ', esc_url( __( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ), __( 'Learn more about debugging in WordPress.' ), __( '(opens in a new tab)' ) ), 'test' => 'is_in_debug_mode', ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { $result['label'] = __( 'Your site is set to log errors to a potentially public file' ); $result['status'] = ( 0 === strpos( ini_get( 'error_log' ), ABSPATH ) ) ? 'critical' : 'recommended'; $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'The value, %s, has been added to this website’s configuration file. This means any errors on the site will be written to a file which is potentially available to all users.' ), 'WP_DEBUG_LOG' ) ); } if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) { $result['label'] = __( 'Your site is set to display errors to site visitors' ); $result['status'] = 'critical'; if ( $this->is_development_environment() ) { $result['status'] = 'recommended'; } $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'The value, %1$s, has either been enabled by %2$s or added to your configuration file. This will make errors display on the front end of your site.' ), 'WP_DEBUG_DISPLAY', 'WP_DEBUG' ) ); } } return $result; } public function get_test_https_status() { wp_update_https_detection_errors(); $default_update_url = wp_get_default_update_https_url(); $result = array( 'label' => __( 'Your website is using an active HTTPS connection' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'An HTTPS connection is a more secure way of browsing the web. Many services now have HTTPS as a requirement. HTTPS allows you to take advantage of new features that can increase site speed, improve search rankings, and gain the trust of your visitors by helping to protect their online privacy.' ) ), 'actions' => sprintf( '

    %s %s

    ', esc_url( $default_update_url ), __( 'Learn more about why you should use HTTPS' ), __( '(opens in a new tab)' ) ), 'test' => 'https_status', ); if ( ! wp_is_using_https() ) { $result['status'] = 'recommended'; $result['label'] = __( 'Your website does not use HTTPS' ); if ( wp_is_site_url_using_https() ) { if ( is_ssl() ) { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'You are accessing this website using HTTPS, but your Site Address is not set up to use HTTPS by default.' ), esc_url( admin_url( 'options-general.php' ) . '#home' ) ) ); } else { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'Your Site Address is not set up to use HTTPS.' ), esc_url( admin_url( 'options-general.php' ) . '#home' ) ) ); } } else { if ( is_ssl() ) { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'You are accessing this website using HTTPS, but your WordPress Address and Site Address are not set up to use HTTPS by default.' ), esc_url( admin_url( 'options-general.php' ) . '#siteurl' ), esc_url( admin_url( 'options-general.php' ) . '#home' ) ) ); } else { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'Your WordPress Address and Site Address are not set up to use HTTPS.' ), esc_url( admin_url( 'options-general.php' ) . '#siteurl' ), esc_url( admin_url( 'options-general.php' ) . '#home' ) ) ); } } if ( wp_is_https_supported() ) { $result['description'] .= sprintf( '

    %s

    ', __( 'HTTPS is already supported for your website.' ) ); if ( defined( 'WP_HOME' ) || defined( 'WP_SITEURL' ) ) { $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'However, your WordPress Address is currently controlled by a PHP constant and therefore cannot be updated. You need to edit your %1$s and remove or update the definitions of %2$s and %3$s.' ), 'wp-config.php', 'WP_HOME', 'WP_SITEURL' ) ); } elseif ( current_user_can( 'update_https' ) ) { $default_direct_update_url = add_query_arg( 'action', 'update_https', wp_nonce_url( admin_url( 'site-health.php' ), 'wp_update_https' ) ); $direct_update_url = wp_get_direct_update_https_url(); if ( ! empty( $direct_update_url ) ) { $result['actions'] = sprintf( '

    %2$s %3$s

    ', esc_url( $direct_update_url ), __( 'Update your site to use HTTPS' ), __( '(opens in a new tab)' ) ); } else { $result['actions'] = sprintf( '

    %2$s

    ', esc_url( $default_direct_update_url ), __( 'Update your site to use HTTPS' ) ); } } } else { $update_url = wp_get_update_https_url(); if ( $update_url !== $default_update_url ) { $result['description'] .= sprintf( '

    %s %s

    ', esc_url( $update_url ), __( 'Talk to your web host about supporting HTTPS for your website.' ), __( '(opens in a new tab)' ) ); } else { $result['description'] .= sprintf( '

    %s

    ', __( 'Talk to your web host about supporting HTTPS for your website.' ) ); } } } return $result; } public function get_test_ssl_support() { $result = array( 'label' => '', 'status' => '', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Securely communicating between servers are needed for transactions such as fetching files, conducting sales on store sites, and much more.' ) ), 'actions' => '', 'test' => 'ssl_support', ); $supports_https = wp_http_supports( array( 'ssl' ) ); if ( $supports_https ) { $result['status'] = 'good'; $result['label'] = __( 'Your site can communicate securely with other services' ); } else { $result['status'] = 'critical'; $result['label'] = __( 'Your site is unable to communicate securely with other services' ); $result['description'] .= sprintf( '

    %s

    ', __( 'Talk to your web host about OpenSSL support for PHP.' ) ); } return $result; } public function get_test_scheduled_events() { $result = array( 'label' => __( 'Scheduled events are running' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Scheduled events are what periodically looks for updates to plugins, themes and WordPress itself. It is also what makes sure scheduled posts are published on time. It may also be used by various plugins to make sure that planned actions are executed.' ) ), 'actions' => '', 'test' => 'scheduled_events', ); $this->wp_schedule_test_init(); if ( is_wp_error( $this->has_missed_cron() ) ) { $result['status'] = 'critical'; $result['label'] = __( 'It was not possible to check your scheduled events' ); $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'While trying to test your site’s scheduled events, the following error was returned: %s' ), $this->has_missed_cron()->get_error_message() ) ); } elseif ( $this->has_missed_cron() ) { $result['status'] = 'recommended'; $result['label'] = __( 'A scheduled event has failed' ); $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'The scheduled event, %s, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ), $this->last_missed_cron ) ); } elseif ( $this->has_late_cron() ) { $result['status'] = 'recommended'; $result['label'] = __( 'A scheduled event is late' ); $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'The scheduled event, %s, is late to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ), $this->last_late_cron ) ); } return $result; } public function get_test_background_updates() { $result = array( 'label' => __( 'Background updates are working' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Background updates ensure that WordPress can auto-update if a security update is released for the version you are currently using.' ) ), 'actions' => '', 'test' => 'background_updates', ); if ( ! class_exists( 'WP_Site_Health_Auto_Updates' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health-auto-updates.php'; } $automatic_updates = new WP_Site_Health_Auto_Updates(); $tests = $automatic_updates->run_tests(); $output = ''; if ( 'good' !== $result['status'] ) { $result['description'] .= $output; } return $result; } public function get_test_plugin_theme_auto_updates() { $result = array( 'label' => __( 'Plugin and theme auto-updates appear to be configured correctly' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Plugin and theme auto-updates ensure that the latest versions are always installed.' ) ), 'actions' => '', 'test' => 'plugin_theme_auto_updates', ); $check_plugin_theme_updates = $this->detect_plugin_theme_auto_update_issues(); $result['status'] = $check_plugin_theme_updates->status; if ( 'good' !== $result['status'] ) { $result['label'] = __( 'Your site may have problems auto-updating plugins and themes' ); $result['description'] .= sprintf( '

    %s

    ', $check_plugin_theme_updates->message ); } return $result; } public function get_test_loopback_requests() { $result = array( 'label' => __( 'Your site can perform loopback requests' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.' ) ), 'actions' => '', 'test' => 'loopback_requests', ); $check_loopback = $this->can_perform_loopback(); $result['status'] = $check_loopback->status; if ( 'good' !== $result['status'] ) { $result['label'] = __( 'Your site could not complete a loopback request' ); $result['description'] .= sprintf( '

    %s

    ', $check_loopback->message ); } return $result; } public function get_test_http_requests() { $result = array( 'label' => __( 'HTTP requests seem to be working as expected' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'It is possible for site maintainers to block all, or some, communication to other sites and services. If set up incorrectly, this may prevent plugins and themes from working as intended.' ) ), 'actions' => '', 'test' => 'http_requests', ); $blocked = false; $hosts = array(); if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { $blocked = true; } if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { $hosts = explode( ',', WP_ACCESSIBLE_HOSTS ); } if ( $blocked && 0 === count( $hosts ) ) { $result['status'] = 'critical'; $result['label'] = __( 'HTTP requests are blocked' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'HTTP requests have been blocked by the %s constant, with no allowed hosts.' ), 'WP_HTTP_BLOCK_EXTERNAL' ) ); } if ( $blocked && 0 < count( $hosts ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'HTTP requests are partially blocked' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'HTTP requests have been blocked by the %1$s constant, with some allowed hosts: %2$s.' ), 'WP_HTTP_BLOCK_EXTERNAL', implode( ',', $hosts ) ) ); } return $result; } public function get_test_rest_availability() { $result = array( 'label' => __( 'The REST API is available' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' ) ), 'actions' => '', 'test' => 'rest_availability', ); $cookies = wp_unslash( $_COOKIE ); $timeout = 10; $headers = array( 'Cache-Control' => 'no-cache', 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), ); $sslverify = apply_filters( 'https_local_ssl_verify', false ); if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); } $url = rest_url( 'wp/v2/types/post' ); $url = add_query_arg( array( 'context' => 'edit', ), $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); if ( is_wp_error( $r ) ) { $result['status'] = 'critical'; $result['label'] = __( 'The REST API encountered an error' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( '%s
    %s', __( 'The REST API request failed due to an error.' ), sprintf( __( 'Error: %1$s (%2$s)' ), $r->get_error_message(), $r->get_error_code() ) ) ); } elseif ( 200 !== wp_remote_retrieve_response_code( $r ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'The REST API encountered an unexpected result' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ), wp_remote_retrieve_response_code( $r ), esc_html( wp_remote_retrieve_body( $r ) ) ) ); } else { $json = json_decode( wp_remote_retrieve_body( $r ), true ); if ( false !== $json && ! isset( $json['capabilities'] ) ) { $result['status'] = 'recommended'; $result['label'] = __( 'The REST API did not behave correctly' ); $result['description'] .= sprintf( '

    %s

    ', sprintf( __( 'The REST API did not process the %s query parameter correctly.' ), 'context' ) ); } } return $result; } public function get_test_file_uploads() { $result = array( 'label' => __( 'Files can be uploaded' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Performance' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', sprintf( __( 'The %1$s directive in %2$s determines if uploading files is allowed on your site.' ), 'file_uploads', 'php.ini' ) ), 'actions' => '', 'test' => 'file_uploads', ); if ( ! function_exists( 'ini_get' ) ) { $result['status'] = 'critical'; $result['description'] .= sprintf( __( 'The %s function has been disabled, some media settings are unavailable because of this.' ), 'ini_get()' ); return $result; } if ( empty( ini_get( 'file_uploads' ) ) ) { $result['status'] = 'critical'; $result['description'] .= sprintf( '

    %s

    ', sprintf( __( '%1$s is set to %2$s. You won\'t be able to upload files on your site.' ), 'file_uploads', '0' ) ); return $result; } $post_max_size = ini_get( 'post_max_size' ); $upload_max_filesize = ini_get( 'upload_max_filesize' ); if ( wp_convert_hr_to_bytes( $post_max_size ) < wp_convert_hr_to_bytes( $upload_max_filesize ) ) { $result['label'] = sprintf( __( 'The "%1$s" value is smaller than "%2$s"' ), 'post_max_size', 'upload_max_filesize' ); $result['status'] = 'recommended'; if ( 0 === wp_convert_hr_to_bytes( $post_max_size ) ) { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'The setting for %1$s is currently configured as 0, this could cause some problems when trying to upload files through plugin or theme features that rely on various upload methods. It is recommended to configure this setting to a fixed value, ideally matching the value of %2$s, as some upload methods read the value 0 as either unlimited, or disabled.' ), 'post_max_size', 'upload_max_filesize' ) ); } else { $result['description'] = sprintf( '

    %s

    ', sprintf( __( 'The setting for %1$s is smaller than %2$s, this could cause some problems when trying to upload files.' ), 'post_max_size', 'upload_max_filesize' ) ); } return $result; } return $result; } public function get_test_authorization_header() { $result = array( 'label' => __( 'The Authorization header is working as expected' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security' ), 'color' => 'blue', ), 'description' => sprintf( '

    %s

    ', __( 'The Authorization header comes from the third-party applications you approve. Without it, those apps cannot connect to your site.' ) ), 'actions' => '', 'test' => 'authorization_header', ); if ( ! isset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { $result['label'] = __( 'The authorization header is missing' ); } elseif ( 'user' !== $_SERVER['PHP_AUTH_USER'] || 'pwd' !== $_SERVER['PHP_AUTH_PW'] ) { $result['label'] = __( 'The authorization header is invalid' ); } else { return $result; } $result['status'] = 'recommended'; if ( ! function_exists( 'got_mod_rewrite' ) ) { require_once ABSPATH . 'wp-admin/includes/misc.php'; } if ( got_mod_rewrite() ) { $result['actions'] .= sprintf( '

    %s

    ', esc_url( admin_url( 'options-permalink.php' ) ), __( 'Flush permalinks' ) ); } else { $result['actions'] .= sprintf( '

    %s %s

    ', __( 'https://developer.wordpress.org/rest-api/frequently-asked-questions/#why-is-authentication-not-working' ), __( 'Learn how to configure the Authorization header.' ), __( '(opens in a new tab)' ) ); } return $result; } public static function get_tests() { $tests = array( 'direct' => array( 'wordpress_version' => array( 'label' => __( 'WordPress Version' ), 'test' => 'wordpress_version', ), 'plugin_version' => array( 'label' => __( 'Plugin Versions' ), 'test' => 'plugin_version', ), 'theme_version' => array( 'label' => __( 'Theme Versions' ), 'test' => 'theme_version', ), 'php_version' => array( 'label' => __( 'PHP Version' ), 'test' => 'php_version', ), 'php_extensions' => array( 'label' => __( 'PHP Extensions' ), 'test' => 'php_extensions', ), 'php_default_timezone' => array( 'label' => __( 'PHP Default Timezone' ), 'test' => 'php_default_timezone', ), 'php_sessions' => array( 'label' => __( 'PHP Sessions' ), 'test' => 'php_sessions', ), 'sql_server' => array( 'label' => __( 'Database Server version' ), 'test' => 'sql_server', ), 'utf8mb4_support' => array( 'label' => __( 'MySQL utf8mb4 support' ), 'test' => 'utf8mb4_support', ), 'ssl_support' => array( 'label' => __( 'Secure communication' ), 'test' => 'ssl_support', ), 'scheduled_events' => array( 'label' => __( 'Scheduled events' ), 'test' => 'scheduled_events', ), 'http_requests' => array( 'label' => __( 'HTTP Requests' ), 'test' => 'http_requests', ), 'rest_availability' => array( 'label' => __( 'REST API availability' ), 'test' => 'rest_availability', 'skip_cron' => true, ), 'debug_enabled' => array( 'label' => __( 'Debugging enabled' ), 'test' => 'is_in_debug_mode', ), 'file_uploads' => array( 'label' => __( 'File uploads' ), 'test' => 'file_uploads', ), 'plugin_theme_auto_updates' => array( 'label' => __( 'Plugin and theme auto-updates' ), 'test' => 'plugin_theme_auto_updates', ), ), 'async' => array( 'dotorg_communication' => array( 'label' => __( 'Communication with WordPress.org' ), 'test' => rest_url( 'wp-site-health/v1/tests/dotorg-communication' ), 'has_rest' => true, 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_dotorg_communication' ), ), 'background_updates' => array( 'label' => __( 'Background updates' ), 'test' => rest_url( 'wp-site-health/v1/tests/background-updates' ), 'has_rest' => true, 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_background_updates' ), ), 'loopback_requests' => array( 'label' => __( 'Loopback request' ), 'test' => rest_url( 'wp-site-health/v1/tests/loopback-requests' ), 'has_rest' => true, 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_loopback_requests' ), ), 'https_status' => array( 'label' => __( 'HTTPS status' ), 'test' => rest_url( 'wp-site-health/v1/tests/https-status' ), 'has_rest' => true, 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_https_status' ), ), ), ); if ( ! wp_is_site_protected_by_basic_auth() ) { $tests['async']['authorization_header'] = array( 'label' => __( 'Authorization header' ), 'test' => rest_url( 'wp-site-health/v1/tests/authorization-header' ), 'has_rest' => true, 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( 'user:pwd' ) ), 'skip_cron' => true, ); } $tests = apply_filters( 'site_status_tests', $tests ); $tests = array_merge( array( 'direct' => array(), 'async' => array(), ), $tests ); return $tests; } public function admin_body_class( $body_class ) { $screen = get_current_screen(); if ( 'site-health' !== $screen->id ) { return $body_class; } $body_class .= ' site-health'; return $body_class; } private function wp_schedule_test_init() { $this->schedules = wp_get_schedules(); $this->get_cron_tasks(); } private function get_cron_tasks() { $cron_tasks = _get_cron_array(); if ( empty( $cron_tasks ) ) { $this->crons = new WP_Error( 'no_tasks', __( 'No scheduled events exist on this site.' ) ); return; } $this->crons = array(); foreach ( $cron_tasks as $time => $cron ) { foreach ( $cron as $hook => $dings ) { foreach ( $dings as $sig => $data ) { $this->crons[ "$hook-$sig-$time" ] = (object) array( 'hook' => $hook, 'time' => $time, 'sig' => $sig, 'args' => $data['args'], 'schedule' => $data['schedule'], 'interval' => isset( $data['interval'] ) ? $data['interval'] : null, ); } } } } public function has_missed_cron() { if ( is_wp_error( $this->crons ) ) { return $this->crons; } foreach ( $this->crons as $id => $cron ) { if ( ( $cron->time - time() ) < $this->timeout_missed_cron ) { $this->last_missed_cron = $cron->hook; return true; } } return false; } public function has_late_cron() { if ( is_wp_error( $this->crons ) ) { return $this->crons; } foreach ( $this->crons as $id => $cron ) { $cron_offset = $cron->time - time(); if ( $cron_offset >= $this->timeout_missed_cron && $cron_offset < $this->timeout_late_cron ) { $this->last_late_cron = $cron->hook; return true; } } return false; } public function detect_plugin_theme_auto_update_issues() { $mock_plugin = (object) array( 'id' => 'w.org/plugins/a-fake-plugin', 'slug' => 'a-fake-plugin', 'plugin' => 'a-fake-plugin/a-fake-plugin.php', 'new_version' => '9.9', 'url' => 'https://wordpress.org/plugins/a-fake-plugin/', 'package' => 'https://downloads.wordpress.org/plugin/a-fake-plugin.9.9.zip', 'icons' => array( '2x' => 'https://ps.w.org/a-fake-plugin/assets/icon-256x256.png', '1x' => 'https://ps.w.org/a-fake-plugin/assets/icon-128x128.png', ), 'banners' => array( '2x' => 'https://ps.w.org/a-fake-plugin/assets/banner-1544x500.png', '1x' => 'https://ps.w.org/a-fake-plugin/assets/banner-772x250.png', ), 'banners_rtl' => array(), 'tested' => '5.5.0', 'requires_php' => '5.6.20', 'compatibility' => new stdClass(), ); $mock_theme = (object) array( 'theme' => 'a-fake-theme', 'new_version' => '9.9', 'url' => 'https://wordpress.org/themes/a-fake-theme/', 'package' => 'https://downloads.wordpress.org/theme/a-fake-theme.9.9.zip', 'requires' => '5.0.0', 'requires_php' => '5.6.20', ); $test_plugins_enabled = wp_is_auto_update_forced_for_item( 'plugin', true, $mock_plugin ); $test_themes_enabled = wp_is_auto_update_forced_for_item( 'theme', true, $mock_theme ); $ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type( 'plugin' ); $ui_enabled_for_themes = wp_is_auto_update_enabled_for_type( 'theme' ); $plugin_filter_present = has_filter( 'auto_update_plugin' ); $theme_filter_present = has_filter( 'auto_update_theme' ); if ( ( ! $test_plugins_enabled && $ui_enabled_for_plugins ) || ( ! $test_themes_enabled && $ui_enabled_for_themes ) ) { return (object) array( 'status' => 'critical', 'message' => __( 'Auto-updates for plugins and/or themes appear to be disabled, but settings are still set to be displayed. This could cause auto-updates to not work as expected.' ), ); } if ( ( ! $test_plugins_enabled && $plugin_filter_present ) && ( ! $test_themes_enabled && $theme_filter_present ) ) { return (object) array( 'status' => 'recommended', 'message' => __( 'Auto-updates for plugins and themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ), ); } elseif ( ! $test_plugins_enabled && $plugin_filter_present ) { return (object) array( 'status' => 'recommended', 'message' => __( 'Auto-updates for plugins appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ), ); } elseif ( ! $test_themes_enabled && $theme_filter_present ) { return (object) array( 'status' => 'recommended', 'message' => __( 'Auto-updates for themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ), ); } return (object) array( 'status' => 'good', 'message' => __( 'There appear to be no issues with plugin and theme auto-updates.' ), ); } public function can_perform_loopback() { $body = array( 'site-health' => 'loopback-test' ); $cookies = wp_unslash( $_COOKIE ); $timeout = 10; $headers = array( 'Cache-Control' => 'no-cache', ); $sslverify = apply_filters( 'https_local_ssl_verify', false ); if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); } $url = site_url( 'wp-cron.php' ); $r = wp_remote_post( $url, compact( 'body', 'cookies', 'headers', 'timeout', 'sslverify' ) ); if ( is_wp_error( $r ) ) { return (object) array( 'status' => 'critical', 'message' => sprintf( '%s
    %s', __( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ), sprintf( __( 'Error: %1$s (%2$s)' ), $r->get_error_message(), $r->get_error_code() ) ), ); } if ( 200 !== wp_remote_retrieve_response_code( $r ) ) { return (object) array( 'status' => 'recommended', 'message' => sprintf( __( 'The loopback request returned an unexpected http status code, %d, it was not possible to determine if this will prevent features from working as expected.' ), wp_remote_retrieve_response_code( $r ) ), ); } return (object) array( 'status' => 'good', 'message' => __( 'The loopback request to your site completed successfully.' ), ); } public function maybe_create_scheduled_event() { if ( ! wp_next_scheduled( 'wp_site_health_scheduled_check' ) && ! wp_installing() ) { wp_schedule_event( time() + DAY_IN_SECONDS, 'weekly', 'wp_site_health_scheduled_check' ); } } public function wp_cron_scheduled_check() { require_once trailingslashit( ABSPATH ) . 'wp-admin/includes/admin.php'; $tests = WP_Site_Health::get_tests(); $results = array(); $site_status = array( 'good' => 0, 'recommended' => 0, 'critical' => 0, ); if ( $this->is_development_environment() ) { unset( $tests['async']['https_status'] ); } foreach ( $tests['direct'] as $test ) { if ( ! empty( $test['skip_cron'] ) ) { continue; } if ( is_string( $test['test'] ) ) { $test_function = sprintf( 'get_test_%s', $test['test'] ); if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) { $results[] = $this->perform_test( array( $this, $test_function ) ); continue; } } if ( is_callable( $test['test'] ) ) { $results[] = $this->perform_test( $test['test'] ); } } foreach ( $tests['async'] as $test ) { if ( ! empty( $test['skip_cron'] ) ) { continue; } if ( ! empty( $test['async_direct_test'] ) && is_callable( $test['async_direct_test'] ) ) { $results[] = $this->perform_test( $test['async_direct_test'] ); continue; } if ( is_string( $test['test'] ) ) { if ( isset( $test['has_rest'] ) && $test['has_rest'] ) { $result_fetch = wp_remote_get( $test['test'], array( 'body' => array( '_wpnonce' => wp_create_nonce( 'wp_rest' ), ), ) ); } else { $result_fetch = wp_remote_post( admin_url( 'admin-ajax.php' ), array( 'body' => array( 'action' => $test['test'], '_wpnonce' => wp_create_nonce( 'health-check-site-status' ), ), ) ); } if ( ! is_wp_error( $result_fetch ) && 200 === wp_remote_retrieve_response_code( $result_fetch ) ) { $result = json_decode( wp_remote_retrieve_body( $result_fetch ), true ); } else { $result = false; } if ( is_array( $result ) ) { $results[] = $result; } else { $results[] = array( 'status' => 'recommended', 'label' => __( 'A test is unavailable' ), ); } } } foreach ( $results as $result ) { if ( 'critical' === $result['status'] ) { $site_status['critical']++; } elseif ( 'recommended' === $result['status'] ) { $site_status['recommended']++; } else { $site_status['good']++; } } set_transient( 'health-check-site-status-result', wp_json_encode( $site_status ) ); } public function is_development_environment() { return in_array( wp_get_environment_type(), array( 'development', 'local' ), true ); } } + + 'posts', 'WP_Media_List_Table' => 'media', 'WP_Terms_List_Table' => 'terms', 'WP_Users_List_Table' => 'users', 'WP_Comments_List_Table' => 'comments', 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), 'WP_Links_List_Table' => 'links', 'WP_Plugin_Install_List_Table' => 'plugin-install', 'WP_Themes_List_Table' => 'themes', 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), 'WP_Plugins_List_Table' => 'plugins', 'WP_Application_Passwords_List_Table' => 'application-passwords', 'WP_MS_Sites_List_Table' => 'ms-sites', 'WP_MS_Users_List_Table' => 'ms-users', 'WP_MS_Themes_List_Table' => 'ms-themes', 'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests', 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', ); if ( isset( $core_classes[ $class_name ] ) ) { foreach ( (array) $core_classes[ $class_name ] as $required ) { require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; } if ( isset( $args['screen'] ) ) { $args['screen'] = convert_to_screen( $args['screen'] ); } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { $args['screen'] = get_current_screen(); } else { $args['screen'] = null; } return new $class_name( $args ); } return false; } function register_column_headers( $screen, $columns ) { new _WP_List_Table_Compat( $screen, $columns ); } function print_column_headers( $screen, $with_id = true ) { $wp_list_table = new _WP_List_Table_Compat( $screen ); $wp_list_table->print_column_headers( $with_id ); } upgrader->strings['skin_before_update_header'] = __( 'Updating Theme %1$s (%2$d/%3$d)' ); } public function before( $title = '' ) { parent::before( $this->theme_info->display( 'Name' ) ); } public function after( $title = '' ) { parent::after( $this->theme_info->display( 'Name' ) ); $this->decrement_update_count( 'theme' ); } public function bulk_footer() { parent::bulk_footer(); $update_actions = array( 'themes_page' => sprintf( '%s', self_admin_url( 'themes.php' ), __( 'Go to Themes page' ) ), 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), __( 'Go to WordPress Updates page' ) ), ); if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { unset( $update_actions['themes_page'] ); } $update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '', 'overwrite' => '', ); $args = wp_parse_args( $args, $defaults ); $this->type = $args['type']; $this->url = $args['url']; $this->api = isset( $args['api'] ) ? $args['api'] : array(); $this->overwrite = $args['overwrite']; parent::__construct( $args ); } public function before() { if ( ! empty( $this->api ) ) { $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version ); } } public function hide_process_failed( $wp_error ) { if ( 'upload' === $this->type && '' === $this->overwrite && $wp_error->get_error_code() === 'folder_exists' ) { return true; } return false; } public function after() { if ( $this->do_overwrite() ) { return; } if ( empty( $this->upgrader->result['destination_name'] ) ) { return; } $theme_info = $this->upgrader->theme_info(); if ( empty( $theme_info ) ) { return; } $name = $theme_info->display( 'Name' ); $stylesheet = $this->upgrader->result['destination_name']; $template = $theme_info->get_template(); $activate_link = add_query_arg( array( 'action' => 'activate', 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), ), admin_url( 'themes.php' ) ); $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); $install_actions = array(); if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) { $customize_url = add_query_arg( array( 'theme' => urlencode( $stylesheet ), 'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ), ), admin_url( 'customize.php' ) ); $install_actions['preview'] = sprintf( '' . '%s', esc_url( $customize_url ), __( 'Live Preview' ), sprintf( __( 'Live Preview “%s”' ), $name ) ); } $install_actions['activate'] = sprintf( '' . '%s', esc_url( $activate_link ), __( 'Activate' ), sprintf( _x( 'Activate “%s”', 'theme' ), $name ) ); if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) { $install_actions['network_enable'] = sprintf( '%s', esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ), __( 'Network Enable' ) ); } if ( 'web' === $this->type ) { $install_actions['themes_page'] = sprintf( '%s', self_admin_url( 'theme-install.php' ), __( 'Go to Theme Installer' ) ); } elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) { $install_actions['themes_page'] = sprintf( '%s', self_admin_url( 'themes.php' ), __( 'Go to Themes page' ) ); } if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() || ! current_user_can( 'switch_themes' ) ) { unset( $install_actions['activate'], $install_actions['preview'] ); } elseif ( get_option( 'template' ) === $stylesheet ) { unset( $install_actions['activate'] ); } $install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info ); if ( ! empty( $install_actions ) ) { $this->feedback( implode( ' | ', (array) $install_actions ) ); } } private function do_overwrite() { if ( 'upload' !== $this->type || ! is_wp_error( $this->result ) || 'folder_exists' !== $this->result->get_error_code() ) { return false; } $folder = $this->result->get_error_data( 'folder_exists' ); $folder = rtrim( $folder, '/' ); $current_theme_data = false; $all_themes = wp_get_themes( array( 'errors' => null ) ); foreach ( $all_themes as $theme ) { $stylesheet_dir = wp_normalize_path( $theme->get_stylesheet_directory() ); if ( rtrim( $stylesheet_dir, '/' ) !== $folder ) { continue; } $current_theme_data = $theme; } $new_theme_data = $this->upgrader->new_theme_data; if ( ! $current_theme_data || ! $new_theme_data ) { return false; } echo '

    ' . esc_html__( 'This theme is already installed.' ) . '

    '; if ( is_wp_error( $current_theme_data->errors() ) ) { $this->feedback( 'current_theme_has_errors', $current_theme_data->errors()->get_error_message() ); } $this->is_downgrading = version_compare( $current_theme_data['Version'], $new_theme_data['Version'], '>' ); $is_invalid_parent = false; if ( ! empty( $new_theme_data['Template'] ) ) { $is_invalid_parent = ! in_array( $new_theme_data['Template'], array_keys( $all_themes ), true ); } $rows = array( 'Name' => __( 'Theme name' ), 'Version' => __( 'Version' ), 'Author' => __( 'Author' ), 'RequiresWP' => __( 'Required WordPress version' ), 'RequiresPHP' => __( 'Required PHP version' ), 'Template' => __( 'Parent theme' ), ); $table = ''; $table .= ''; $is_same_theme = true; foreach ( $rows as $field => $label ) { $old_value = $current_theme_data->display( $field, false ); $old_value = $old_value ? (string) $old_value : '-'; $new_value = ! empty( $new_theme_data[ $field ] ) ? (string) $new_theme_data[ $field ] : '-'; if ( $old_value === $new_value && '-' === $new_value && 'Template' === $field ) { continue; } $is_same_theme = $is_same_theme && ( $old_value === $new_value ); $diff_field = ( 'Version' !== $field && $new_value !== $old_value ); $diff_version = ( 'Version' === $field && $this->is_downgrading ); $invalid_parent = false; if ( 'Template' === $field && $is_invalid_parent ) { $invalid_parent = true; $new_value .= ' ' . __( '(not found)' ); } $table .= ''; $table .= ( $diff_field || $diff_version || $invalid_parent ) ? ''; } $table .= '
    ' . esc_html_x( 'Active', 'theme' ) . '' . esc_html_x( 'Uploaded', 'theme' ) . '
    ' . $label . '' . wp_strip_all_tags( $old_value ) . '' : ''; $table .= wp_strip_all_tags( $new_value ) . '
    '; echo apply_filters( 'install_theme_overwrite_comparison', $table, $current_theme_data, $new_theme_data ); $install_actions = array(); $can_update = true; $blocked_message = '

    ' . esc_html__( 'The theme cannot be updated due to the following:' ) . '

    '; $blocked_message .= ''; if ( $can_update ) { if ( $this->is_downgrading ) { $warning = sprintf( __( 'You are uploading an older version of the active theme. You can continue to install the older version, but be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } else { $warning = sprintf( __( 'You are updating a theme. Be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } echo '

    ' . $warning . '

    '; $overwrite = $this->is_downgrading ? 'downgrade-theme' : 'update-theme'; $install_actions['overwrite_theme'] = sprintf( '%s', wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'theme-upload' ), _x( 'Replace active with uploaded', 'theme' ) ); } else { echo $blocked_message; } $cancel_url = add_query_arg( 'action', 'upload-theme-cancel-overwrite', $this->url ); $install_actions['themes_page'] = sprintf( '%s', wp_nonce_url( $cancel_url, 'theme-upload-cancel-overwrite' ), __( 'Cancel and go back' ) ); $install_actions = apply_filters( 'install_theme_overwrite_actions', $install_actions, $this->api, $new_theme_data ); if ( ! empty( $install_actions ) ) { printf( '', __( 'The uploaded file has expired. Please go back and upload it again.' ) ); echo '

    ' . implode( ' ', (array) $install_actions ) . '

    '; } return true; } } 'parent', 'id' => 'term_id', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( "\t", $depth ); $output .= "$indent\n"; } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $category = $data_object; if ( empty( $args['taxonomy'] ) ) { $taxonomy = 'category'; } else { $taxonomy = $args['taxonomy']; } if ( 'category' === $taxonomy ) { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; } $args['popular_cats'] = ! empty( $args['popular_cats'] ) ? array_map( 'intval', $args['popular_cats'] ) : array(); $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : ''; $args['selected_cats'] = ! empty( $args['selected_cats'] ) ? array_map( 'intval', $args['selected_cats'] ) : array(); if ( ! empty( $args['list_only'] ) ) { $aria_checked = 'false'; $inner_class = 'category'; if ( in_array( $category->term_id, $args['selected_cats'], true ) ) { $inner_class .= ' selected'; $aria_checked = 'true'; } $output .= "\n" . '' . ''; } else { $is_selected = in_array( $category->term_id, $args['selected_cats'], true ); $is_disabled = ! empty( $args['disabled'] ); $output .= "\n
  • " . ''; } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { $output .= "
  • \n"; } } post_type ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } $result = wp_send_user_request( $request_id ); if ( is_wp_error( $result ) ) { return $result; } elseif ( ! $result ) { return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation for personal data request.' ) ); } return true; } function _wp_privacy_completed_request( $request_id ) { $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); if ( ! $request ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); $result = wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-completed', ) ); return $result; } function _wp_personal_data_handle_actions() { if ( isset( $_POST['privacy_action_email_retry'] ) ) { check_admin_referer( 'bulk-privacy_requests' ); $request_id = absint( current( array_keys( (array) wp_unslash( $_POST['privacy_action_email_retry'] ) ) ) ); $result = _wp_privacy_resend_request( $request_id ); if ( is_wp_error( $result ) ) { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', $result->get_error_message(), 'error' ); } else { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', __( 'Confirmation request sent again successfully.' ), 'success' ); } } elseif ( isset( $_POST['action'] ) ) { $action = ! empty( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; switch ( $action ) { case 'add_export_personal_data_request': case 'add_remove_personal_data_request': check_admin_referer( 'personal-data-request' ); if ( ! isset( $_POST['type_of_action'], $_POST['username_or_email_for_privacy_request'] ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); $email_address = ''; $status = 'pending'; if ( ! isset( $_POST['send_confirmation_email'] ) ) { $status = 'confirmed'; } if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } if ( ! is_email( $username_or_email_address ) ) { $user = get_user_by( 'login', $username_or_email_address ); if ( ! $user instanceof WP_User ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', __( 'Unable to add this request. A valid email address or username must be supplied.' ), 'error' ); } else { $email_address = $user->user_email; } } else { $email_address = $username_or_email_address; } if ( empty( $email_address ) ) { break; } $request_id = wp_create_user_request( $email_address, $action_type, array(), $status ); $message = ''; if ( is_wp_error( $request_id ) ) { $message = $request_id->get_error_message(); } elseif ( ! $request_id ) { $message = __( 'Unable to initiate confirmation request.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'error' ); break; } if ( 'pending' === $status ) { wp_send_user_request( $request_id ); $message = __( 'Confirmation request initiated successfully.' ); } elseif ( 'confirmed' === $status ) { $message = __( 'Request added successfully.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'success' ); break; } } } } function _wp_personal_data_cleanup_requests() { $expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS ); $requests_query = new WP_Query( array( 'post_type' => 'user_request', 'posts_per_page' => -1, 'post_status' => 'request-pending', 'fields' => 'ids', 'date_query' => array( array( 'column' => 'post_modified_gmt', 'before' => $expires . ' seconds ago', ), ), ) ); $request_ids = $requests_query->posts; foreach ( $request_ids as $request_id ) { wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-failed', 'post_password' => '', ) ); } } function wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id = '', $groups_count = 1 ) { $group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id ); $group_html = '

    '; $group_html .= esc_html( $group_data['group_label'] ); $items_count = count( (array) $group_data['items'] ); if ( $items_count > 1 ) { $group_html .= sprintf( ' (%d)', $items_count ); } $group_html .= '

    '; if ( ! empty( $group_data['group_description'] ) ) { $group_html .= '

    ' . esc_html( $group_data['group_description'] ) . '

    '; } $group_html .= '
    '; foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) { $group_html .= ''; $group_html .= ''; foreach ( (array) $group_item_data as $group_item_datum ) { $value = $group_item_datum['value']; if ( false === strpos( $value, ' ' ) && ( 0 === strpos( $value, 'http://' ) || 0 === strpos( $value, 'https://' ) ) ) { $value = '' . esc_html( $value ) . ''; } $group_html .= ''; $group_html .= ''; $group_html .= ''; $group_html .= ''; } $group_html .= ''; $group_html .= '
    ' . esc_html( $group_item_datum['name'] ) . '' . wp_kses( $value, 'personal_data_export' ) . '
    '; } if ( $groups_count > 1 ) { $group_html .= '
    '; $group_html .= ' ' . esc_html__( 'Go to top' ) . ''; $group_html .= '
    '; } $group_html .= '
    '; return $group_html; } function wp_privacy_generate_personal_data_export_file( $request_id ) { if ( ! class_exists( 'ZipArchive' ) ) { wp_send_json_error( __( 'Unable to generate personal data export file. ZipArchive not available.' ) ); } $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when generating personal data export file.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'Invalid email address when generating personal data export file.' ) ); } $exports_dir = wp_privacy_exports_dir(); $exports_url = wp_privacy_exports_url(); if ( ! wp_mkdir_p( $exports_dir ) ) { wp_send_json_error( __( 'Unable to create personal data export folder.' ) ); } $index_pathname = $exports_dir . 'index.php'; if ( ! file_exists( $index_pathname ) ) { $file = fopen( $index_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to protect personal data export folder from browsing.' ) ); } fwrite( $file, " _x( 'About', 'personal data group label' ), 'group_description' => _x( 'Overview of export report.', 'personal data group description' ), 'items' => array( 'about-1' => array( array( 'name' => _x( 'Report generated for', 'email address' ), 'value' => $email_address, ), array( 'name' => _x( 'For site', 'website name' ), 'value' => get_bloginfo( 'name' ), ), array( 'name' => _x( 'At URL', 'website URL' ), 'value' => get_bloginfo( 'url' ), ), array( 'name' => _x( 'On', 'date/time' ), 'value' => current_time( 'mysql' ), ), ), ), ); $groups = get_post_meta( $request_id, '_export_data_grouped', true ); if ( is_array( $groups ) ) { $groups = array_merge( array( 'about' => $about_group ), $groups ); $groups_count = count( $groups ); } else { if ( false !== $groups ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s post meta must be an array.' ), '_export_data_grouped' ), '5.8.0' ); } $groups = null; $groups_count = 0; } $groups_json = wp_json_encode( $groups ); if ( false === $groups_json ) { $error_message = sprintf( __( 'Unable to encode the personal data for export. Error: %s' ), json_last_error_msg() ); wp_send_json_error( $error_message ); } $file = fopen( $json_report_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to open personal data export file (JSON report) for writing.' ) ); } fwrite( $file, '{' ); fwrite( $file, '"' . $title . '":' ); fwrite( $file, $groups_json ); fwrite( $file, '}' ); fclose( $file ); $file = fopen( $html_report_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to open personal data export (HTML report) for writing.' ) ); } fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "' ); fwrite( $file, '' ); fwrite( $file, esc_html( $title ) ); fwrite( $file, '' ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, '

    ' . esc_html__( 'Personal Data Export' ) . '

    ' ); if ( $groups_count > 1 ) { fwrite( $file, '
    ' ); fwrite( $file, '

    ' . esc_html__( 'Table of Contents' ) . '

    ' ); fwrite( $file, '
      ' ); foreach ( (array) $groups as $group_id => $group_data ) { $group_label = esc_html( $group_data['group_label'] ); $group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id ); $group_items_count = count( (array) $group_data['items'] ); if ( $group_items_count > 1 ) { $group_label .= sprintf( ' (%d)', $group_items_count ); } fwrite( $file, '
    • ' ); fwrite( $file, '' . $group_label . '' ); fwrite( $file, '
    • ' ); } fwrite( $file, '
    ' ); fwrite( $file, '
    ' ); } foreach ( (array) $groups as $group_id => $group_data ) { fwrite( $file, wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id, $groups_count ) ); } fwrite( $file, "\n" ); fwrite( $file, "\n" ); fclose( $file ); $error = false; $archive_filename = get_post_meta( $request_id, '_export_file_name', true ); $archive_pathname = get_post_meta( $request_id, '_export_file_path', true ); if ( ! empty( $archive_filename ) ) { $archive_pathname = $exports_dir . $archive_filename; } elseif ( ! empty( $archive_pathname ) ) { $archive_filename = basename( $archive_pathname ); update_post_meta( $request_id, '_export_file_name', $archive_filename ); delete_post_meta( $request_id, '_export_file_url' ); delete_post_meta( $request_id, '_export_file_path' ); } else { $archive_filename = $file_basename . '.zip'; $archive_pathname = $exports_dir . $archive_filename; update_post_meta( $request_id, '_export_file_name', $archive_filename ); } $archive_url = $exports_url . $archive_filename; if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) { wp_delete_file( $archive_pathname ); } $zip = new ZipArchive; if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) { $error = __( 'Unable to archive the personal data export file (JSON format).' ); } if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) { $error = __( 'Unable to archive the personal data export file (HTML format).' ); } $zip->close(); if ( ! $error ) { do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id, $json_report_pathname ); } } else { $error = __( 'Unable to open personal data export file (archive) for writing.' ); } unlink( $json_report_pathname ); unlink( $html_report_pathname ); if ( $error ) { wp_send_json_error( $error ); } } function wp_privacy_send_personal_data_export_email( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) ); } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); $exports_url = wp_privacy_exports_url(); $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); $export_file_url = $exports_url . $export_file_name; $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $site_url = home_url(); $request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request ); $email_data = array( 'request' => $request, 'expiration' => $expiration, 'expiration_date' => $expiration_date, 'message_recipient' => $request_email, 'export_file_url' => $export_file_url, 'sitename' => $site_name, 'siteurl' => $site_url, ); $subject = sprintf( __( '[%s] Personal Data Export' ), $site_name ); $subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data ); $email_text = __( 'Howdy, - 40%, 43% { - animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); - transform: translate3d(0, -12px, 0); - } +Your request for an export of personal data has been completed. You may +download your personal data by clicking on the link below. For privacy +and security, we will automatically delete the file on ###EXPIRATION###, +so please download it before then. - 70% { - animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); - transform: translate3d(0, -6px, 0); - } +###LINK### - 90% { - transform: translate3d(0,-1px,0); - } -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data ); $content = str_replace( '###EXPIRATION###', $expiration_date, $content ); $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content ); $content = str_replace( '###EMAIL###', $request_email, $content ); $content = str_replace( '###SITENAME###', $site_name, $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $site_url ), $content ); $headers = ''; $headers = apply_filters( 'wp_privacy_personal_data_email_headers', $headers, $subject, $content, $request_id, $email_data ); $mail_success = wp_mail( $request_email, $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( ! $mail_success ) { return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) ); } return true; } function wp_privacy_process_personal_data_export_page( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'data', $response ) ) { return $response; } if ( ! is_array( $response['data'] ) ) { return $response; } $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when merging personal data to export.' ) ); } $export_data = array(); if ( 1 === $exporter_index && 1 === $page ) { update_post_meta( $request_id, '_export_data_raw', $export_data ); } else { $accumulated_data = get_post_meta( $request_id, '_export_data_raw', true ); if ( $accumulated_data ) { $export_data = $accumulated_data; } } $export_data = array_merge( $export_data, $response['data'] ); update_post_meta( $request_id, '_export_data_raw', $export_data ); $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $is_last_exporter = count( $exporters ) === $exporter_index; $exporter_done = $response['done']; if ( ! $is_last_exporter || ! $exporter_done ) { return $response; } $groups = array(); foreach ( (array) $export_data as $export_datum ) { $group_id = $export_datum['group_id']; $group_label = $export_datum['group_label']; $group_description = ''; if ( ! empty( $export_datum['group_description'] ) ) { $group_description = $export_datum['group_description']; } if ( ! array_key_exists( $group_id, $groups ) ) { $groups[ $group_id ] = array( 'group_label' => $group_label, 'group_description' => $group_description, 'items' => array(), ); } $item_id = $export_datum['item_id']; if ( ! array_key_exists( $item_id, $groups[ $group_id ]['items'] ) ) { $groups[ $group_id ]['items'][ $item_id ] = array(); } $old_item_data = $groups[ $group_id ]['items'][ $item_id ]; $merged_item_data = array_merge( $export_datum['data'], $old_item_data ); $groups[ $group_id ]['items'][ $item_id ] = $merged_item_data; } delete_post_meta( $request_id, '_export_data_raw' ); update_post_meta( $request_id, '_export_data_grouped', $groups ); do_action( 'wp_privacy_personal_data_export_file', $request_id ); delete_post_meta( $request_id, '_export_data_grouped' ); if ( $send_as_email ) { $mail_success = wp_privacy_send_personal_data_export_email( $request_id ); if ( is_wp_error( $mail_success ) ) { wp_send_json_error( $mail_success->get_error_message() ); } _wp_privacy_completed_request( $request_id ); } else { $exports_url = wp_privacy_exports_url(); $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); $export_file_url = $exports_url . $export_file_name; if ( ! empty( $export_file_url ) ) { $response['url'] = $export_file_url; } } return $response; } function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) { if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'items_removed', $response ) ) { return $response; } if ( ! array_key_exists( 'items_retained', $response ) ) { return $response; } if ( ! array_key_exists( 'messages', $response ) ) { return $response; } $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) ); } $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $is_last_eraser = count( $erasers ) === $eraser_index; $eraser_done = $response['done']; if ( ! $is_last_eraser || ! $eraser_done ) { return $response; } _wp_privacy_completed_request( $request_id ); do_action( 'wp_privacy_personal_data_erased', $request_id ); return $response; } skin = new WP_Upgrader_Skin(); } else { $this->skin = $skin; } } public function init() { $this->skin->set_upgrader( $this ); $this->generic_strings(); } public function generic_strings() { $this->strings['bad_request'] = __( 'Invalid data provided.' ); $this->strings['fs_unavailable'] = __( 'Could not access filesystem.' ); $this->strings['fs_error'] = __( 'Filesystem error.' ); $this->strings['fs_no_root_dir'] = __( 'Unable to locate WordPress root directory.' ); $this->strings['fs_no_content_dir'] = __( 'Unable to locate WordPress content directory (wp-content).' ); $this->strings['fs_no_plugins_dir'] = __( 'Unable to locate WordPress plugin directory.' ); $this->strings['fs_no_themes_dir'] = __( 'Unable to locate WordPress theme directory.' ); $this->strings['fs_no_folder'] = __( 'Unable to locate needed folder (%s).' ); $this->strings['download_failed'] = __( 'Download failed.' ); $this->strings['installing_package'] = __( 'Installing the latest version…' ); $this->strings['no_files'] = __( 'The package contains no files.' ); $this->strings['folder_exists'] = __( 'Destination folder already exists.' ); $this->strings['mkdir_failed'] = __( 'Could not create directory.' ); $this->strings['incompatible_archive'] = __( 'The package could not be installed.' ); $this->strings['files_not_writable'] = __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ); $this->strings['maintenance_start'] = __( 'Enabling Maintenance mode…' ); $this->strings['maintenance_end'] = __( 'Disabling Maintenance mode…' ); } public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) { global $wp_filesystem; $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ); if ( false === $credentials ) { return false; } if ( ! WP_Filesystem( $credentials, $directories[0], $allow_relaxed_file_ownership ) ) { $error = true; if ( is_object( $wp_filesystem ) && $wp_filesystem->errors->has_errors() ) { $error = $wp_filesystem->errors; } $this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership ); return false; } if ( ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', $this->strings['fs_unavailable'] ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', $this->strings['fs_error'], $wp_filesystem->errors ); } foreach ( (array) $directories as $dir ) { switch ( $dir ) { case ABSPATH: if ( ! $wp_filesystem->abspath() ) { return new WP_Error( 'fs_no_root_dir', $this->strings['fs_no_root_dir'] ); } break; case WP_CONTENT_DIR: if ( ! $wp_filesystem->wp_content_dir() ) { return new WP_Error( 'fs_no_content_dir', $this->strings['fs_no_content_dir'] ); } break; case WP_PLUGIN_DIR: if ( ! $wp_filesystem->wp_plugins_dir() ) { return new WP_Error( 'fs_no_plugins_dir', $this->strings['fs_no_plugins_dir'] ); } break; case get_theme_root(): if ( ! $wp_filesystem->wp_themes_dir() ) { return new WP_Error( 'fs_no_themes_dir', $this->strings['fs_no_themes_dir'] ); } break; default: if ( ! $wp_filesystem->find_folder( $dir ) ) { return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], esc_html( basename( $dir ) ) ) ); } break; } } return true; } public function download_package( $package, $check_signatures = false, $hook_extra = array() ) { $reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra ); if ( false !== $reply ) { return $reply; } if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { return $package; } if ( empty( $package ) ) { return new WP_Error( 'no_package', $this->strings['no_package'] ); } $this->skin->feedback( 'downloading_package', $package ); $download_file = download_url( $package, 300, $check_signatures ); if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) { return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() ); } return $download_file; } public function unpack_package( $package, $delete_package = true ) { global $wp_filesystem; $this->skin->feedback( 'unpack_package' ); $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; $upgrade_files = $wp_filesystem->dirlist( $upgrade_folder ); if ( ! empty( $upgrade_files ) ) { foreach ( $upgrade_files as $file ) { $wp_filesystem->delete( $upgrade_folder . $file['name'], true ); } } $working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' ); if ( $wp_filesystem->is_dir( $working_dir ) ) { $wp_filesystem->delete( $working_dir, true ); } $result = unzip_file( $package, $working_dir ); if ( $delete_package ) { unlink( $package ); } if ( is_wp_error( $result ) ) { $wp_filesystem->delete( $working_dir, true ); if ( 'incompatible_archive' === $result->get_error_code() ) { return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() ); } return $result; } return $working_dir; } protected function flatten_dirlist( $nested_files, $path = '' ) { $files = array(); foreach ( $nested_files as $name => $details ) { $files[ $path . $name ] = $details; if ( ! empty( $details['files'] ) ) { $children = $this->flatten_dirlist( $details['files'], $path . $name . '/' ); $files = $files + $children; } } return $files; } public function clear_destination( $remote_destination ) { global $wp_filesystem; $files = $wp_filesystem->dirlist( $remote_destination, true, true ); if ( false === $files ) { return true; } $files = $this->flatten_dirlist( $files ); $unwritable_files = array(); foreach ( $files as $filename => $file_details ) { if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) { $wp_filesystem->chmod( $remote_destination . $filename, ( 'd' === $file_details['type'] ? FS_CHMOD_DIR : FS_CHMOD_FILE ) ); if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) { $unwritable_files[] = $filename; } } } if ( ! empty( $unwritable_files ) ) { return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) ); } if ( ! $wp_filesystem->delete( $remote_destination, true ) ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } return true; } public function install_package( $args = array() ) { global $wp_filesystem, $wp_theme_directories; $defaults = array( 'source' => '', 'destination' => '', 'clear_destination' => false, 'clear_working' => false, 'abort_if_destination_exists' => true, 'hook_extra' => array(), ); $args = wp_parse_args( $args, $defaults ); $source = $args['source']; $destination = $args['destination']; $clear_destination = $args['clear_destination']; set_time_limit( 300 ); if ( empty( $source ) || empty( $destination ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } $this->skin->feedback( 'installing_package' ); $res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] ); if ( is_wp_error( $res ) ) { return $res; } $remote_source = $args['source']; $local_destination = $destination; $source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) ); $remote_destination = $wp_filesystem->find_folder( $local_destination ); if ( 1 === count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); } elseif ( 0 === count( $source_files ) ) { return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); } else { $source = trailingslashit( $args['source'] ); } $source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] ); if ( is_wp_error( $source ) ) { return $source; } if ( $source !== $remote_source ) { $source_files = array_keys( $wp_filesystem->dirlist( $source ) ); } $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' ); if ( is_array( $wp_theme_directories ) ) { $protected_directories = array_merge( $protected_directories, $wp_theme_directories ); } if ( in_array( $destination, $protected_directories, true ) ) { $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) ); $destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) ); } if ( $clear_destination ) { $this->skin->feedback( 'remove_old' ); $removed = $this->clear_destination( $remote_destination ); $removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] ); if ( is_wp_error( $removed ) ) { return $removed; } } elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) { $_files = $wp_filesystem->dirlist( $remote_destination ); if ( ! empty( $_files ) ) { $wp_filesystem->delete( $remote_source, true ); return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination ); } } if ( ! $wp_filesystem->exists( $remote_destination ) ) { if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination ); } } $result = copy_dir( $source, $remote_destination ); if ( is_wp_error( $result ) ) { if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } return $result; } if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } $destination_name = basename( str_replace( $local_destination, '', $destination ) ); if ( '.' === $destination_name ) { $destination_name = ''; } $this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' ); $res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result ); if ( is_wp_error( $res ) ) { $this->result = $res; return $res; } return $this->result; } public function run( $options ) { $defaults = array( 'package' => '', 'destination' => '', 'clear_destination' => false, 'clear_working' => true, 'abort_if_destination_exists' => true, 'is_multi' => false, 'hook_extra' => array(), ); $options = wp_parse_args( $options, $defaults ); $options = apply_filters( 'upgrader_package_options', $options ); if ( ! $options['is_multi'] ) { $this->skin->header(); } $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) ); if ( ! $res ) { if ( ! $options['is_multi'] ) { $this->skin->footer(); } return false; } $this->skin->before(); if ( is_wp_error( $res ) ) { $this->skin->error( $res ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $res; } $download = $this->download_package( $options['package'], true, $options['hook_extra'] ); if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { if ( 'signature_verification_no_signature' !== $download->get_error_code() || WP_DEBUG ) { $this->skin->feedback( $download->get_error_message() ); wp_version_check( array( 'signature_failure_code' => $download->get_error_code(), 'signature_failure_data' => $download->get_error_data(), ) ); } $download = $download->get_error_data( 'softfail-filename' ); } if ( is_wp_error( $download ) ) { $this->skin->error( $download ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $download; } $delete_package = ( $download !== $options['package'] ); $working_dir = $this->unpack_package( $download, $delete_package ); if ( is_wp_error( $working_dir ) ) { $this->skin->error( $working_dir ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $working_dir; } $result = $this->install_package( array( 'source' => $working_dir, 'destination' => $options['destination'], 'clear_destination' => $options['clear_destination'], 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 'clear_working' => $options['clear_working'], 'hook_extra' => $options['hook_extra'], ) ); $result = apply_filters( 'upgrader_install_package_result', $result, $options['hook_extra'] ); $this->skin->set_result( $result ); if ( is_wp_error( $result ) ) { $this->skin->error( $result ); if ( ! method_exists( $this->skin, 'hide_process_failed' ) || ! $this->skin->hide_process_failed( $result ) ) { $this->skin->feedback( 'process_failed' ); } } else { $this->skin->feedback( 'process_success' ); } $this->skin->after(); if ( ! $options['is_multi'] ) { do_action( 'upgrader_process_complete', $this, $options['hook_extra'] ); $this->skin->footer(); } return $result; } public function maintenance_mode( $enable = false ) { global $wp_filesystem; $file = $wp_filesystem->abspath() . '.maintenance'; if ( $enable ) { $this->skin->feedback( 'maintenance_start' ); $maintenance_string = ''; $wp_filesystem->delete( $file ); $wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE ); } elseif ( ! $enable && $wp_filesystem->exists( $file ) ) { $this->skin->feedback( 'maintenance_end' ); $wp_filesystem->delete( $file ); } } public static function create_lock( $lock_name, $release_timeout = null ) { global $wpdb; if ( ! $release_timeout ) { $release_timeout = HOUR_IN_SECONDS; } $lock_option = $lock_name . '.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_option ); if ( ! $lock_result ) { return false; } if ( $lock_result > ( time() - $release_timeout ) ) { return false; } WP_Upgrader::release_lock( $lock_name ); return WP_Upgrader::create_lock( $lock_name, $release_timeout ); } update_option( $lock_option, time() ); return true; } public static function release_lock( $lock_name ) { return delete_option( $lock_name . '.lock' ); } } require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-theme-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-language-pack-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-core-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-file-upload-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; ID; $post_type = $post->post_type; $post_type_object = get_post_type_object( $post_type ); $can_publish = current_user_can( $post_type_object->cap->publish_posts ); ?> +
    -.customize-control-header .choice { - position: relative; - display: block; - margin-bottom: 9px; -} +
    -.customize-control-header .choice:focus { - outline: none; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 3px 1px rgba(79, 148, 212, 0.8); -} + +
    + +
    -.customize-control-header .uploaded div:last-child > .choice { - margin-bottom: 0; -} +
    +
    + post_status, array( 'publish', 'future', 'pending' ), true ) ) { $private_style = ''; if ( 'private' === $post->post_status ) { $private_style = 'style="display:none"'; } ?> + type="submit" name="save" id="save-post" value="" class="button" /> + + post_status && $can_publish ) { ?> + + + +
    -.customize-control .attachment-media-view .thumbnail-image img, -.customize-control-header img { - max-width: 100%; -} + +
    + post_status ) { $preview_button_text = __( 'Preview Changes' ); } else { $preview_button_text = __( 'Preview' ); } $preview_button = sprintf( '%1$s %2$s', $preview_button_text, __( '(opens in a new tab)' ) ); ?> + + +
    + +
    +
    -.customize-control .attachment-media-view .remove-button, -.customize-control .attachment-media-view .default-button, -.customize-control-header .remove { - margin-right: 8px; -} +
    +
    + + + post_status ) { case 'private': _e( 'Privately Published' ); break; case 'publish': _e( 'Published' ); break; case 'future': _e( 'Scheduled' ); break; case 'pending': _e( 'Pending Review' ); break; case 'draft': case 'auto-draft': _e( 'Draft' ); break; } ?> + -/* Background position control */ -.customize-control-background_position .background-position-control .button-group { - display: block; -} + post_status || 'private' === $post->post_status || $can_publish ) { $private_style = ''; if ( 'private' === $post->post_status ) { $private_style = 'style="display:none"'; } ?> + class="edit-post-status hide-if-no-js" role="button"> -/** - * Code Editor Control and Custom CSS Section - * - * Modifications to the Section Container to make the textarea full-width and - * full-height, if the control is the only control in the section. - */ +
    + + + + + +
    + +
    -.customize-control-code_editor textarea { - width: 100%; - font-family: Consolas, Monaco, monospace; - font-size: 12px; - padding: 6px 8px; - -o-tab-size: 2; - tab-size: 2; -} -.customize-control-code_editor textarea, -.customize-control-code_editor .CodeMirror { - height: 14em; -} +
    + + + post_status ) { $post->post_password = ''; $visibility = 'private'; $visibility_trans = __( 'Private' ); } elseif ( ! empty( $post->post_password ) ) { $visibility = 'password'; $visibility_trans = __( 'Password protected' ); } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) { $visibility = 'public'; $visibility_trans = __( 'Public, Sticky' ); } else { $visibility = 'public'; $visibility_trans = __( 'Public' ); } echo esc_html( $visibility_trans ); ?> + -#customize-controls .customize-section-description-container.section-meta.customize-info { - border-bottom: none; -} + + -#sub-accordion-section-custom_css .customize-control-notifications-container { - margin-bottom: 15px; -} +
    + + + /> + -#customize-control-custom_css textarea { - display: block; - height: 500px; -} + + />
    -.customize-section-description-container + #customize-control-custom_css .customize-control-title { - margin-left: 12px; -} + + />
    + -.customize-section-description-container + #customize-control-custom_css:last-child textarea { - border-right: 0; - border-left: 0; - height: calc( 100vh - 185px ); - resize: none; -} + />
    +
    -.customize-section-description-container + #customize-control-custom_css:last-child { - margin-left: -12px; - width: 299px; - width: calc( 100% + 24px ); - margin-bottom: -12px; -} + />
    -.customize-section-description-container + #customize-control-custom_css:last-child .CodeMirror { - height: calc( 100vh - 185px ); -} +

    + + +

    +
    + +
    -.CodeMirror-lint-tooltip, -.CodeMirror-hints { - z-index: 500000 !important; -} + post_status ) { $stamp = __( 'Scheduled for: %s' ); } elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { $stamp = __( 'Published on: %s' ); } elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { $stamp = __( 'Publish immediately' ); } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { $stamp = __( 'Schedule for: %s' ); } else { $stamp = __( 'Publish on: %s' ); } $date = sprintf( $date_string, date_i18n( $date_format, strtotime( $post->post_date ) ), date_i18n( $time_format, strtotime( $post->post_date ) ) ); } else { $stamp = __( 'Publish immediately' ); $date = sprintf( $date_string, date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ), date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) ) ); } if ( ! empty( $args['args']['revisions_count'] ) ) : ?> +
    + ' . number_format_i18n( $args['args']['revisions_count'] ) . '' ); ?> + +
    + +
    + + ' . $date . '' ); ?> + + + + + +
    + + +
    +
    + post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) : ?> +
    +

    + unpublished customization changes. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ), esc_url( add_query_arg( 'changeset_uuid', rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ), admin_url( 'customize.php' ) ) ) ); ?> +

    +
    + +
    +
    +
    -.customize-section-description-container + #customize-control-custom_css:last-child .customize-control-notifications-container { - margin-left: 12px; - margin-right: 12px; -} +
    + +
    + + + +
    -.theme-browser .theme.active .theme-actions, -.wp-customizer .theme-browser .theme .theme-actions { - padding: 9px 15px; - box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1); -} +
    + + post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) { if ( $can_publish ) : if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> + + + + + + + + + + + 'publish' ) ); ?> + +
    +
    +
    -@media screen and (max-width: 640px) { - .customize-section-description-container + #customize-control-custom_css:last-child { - margin-right: 0; - } +
    + +
    - .customize-section-description-container + #customize-control-custom_css:last-child textarea { - height: calc( 100vh - 140px ); - } -} +
    -/** - * Themes - */ + +
    + +
    -#customize-theme-controls .control-panel-themes { - border-bottom: none; -} -#customize-theme-controls .control-panel-themes > .accordion-section-title:hover, /* Not a focusable element. */ -#customize-theme-controls .control-panel-themes > .accordion-section-title { - cursor: default; - background: #fff; - color: #50575e; - border-top: 1px solid #dcdcde; - border-bottom: 1px solid #dcdcde; - border-left: none; - border-right: none; - margin: 0 0 15px; - padding-right: 100px; /* Space for the button */ -} +
    +
    + + post_date ) ), date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) ); printf( __( 'Uploaded on: %s' ), '' . $uploaded_on . '' ); ?> + +
    -#customize-theme-controls .control-section-themes .customize-themes-panel .accordion-section-title:first-child:hover, /* Not a focusable element. */ -#customize-theme-controls .control-section-themes .customize-themes-panel .accordion-section-title:first-child { - border-top: 0; -} + +
    +
    +
    -#customize-theme-controls .control-section-themes > .accordion-section-title:hover, /* Not a focusable element. */ -#customize-theme-controls .control-section-themes > .accordion-section-title { - margin: 0 0 15px; -} +
    +
    + ID ) ) { if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { echo "" . __( 'Move to Trash' ) . ''; } else { $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; echo "" . __( 'Delete permanently' ) . ''; } } ?> +
    -#customize-controls .customize-themes-panel .accordion-section-title:hover, -#customize-controls .customize-themes-panel .accordion-section-title { - margin: 15px -8px; -} +
    + + + +
    +
    +
    -#customize-controls .control-section-themes .accordion-section-title, -#customize-controls .customize-themes-panel .accordion-section-title { - padding-right: 100px; /* Space for the button */ -} +
    -.control-panel-themes .accordion-section-title span.customize-action, -#customize-controls .customize-section-title span.customize-action, -#customize-controls .control-section-themes .accordion-section-title span.customize-action, -#customize-controls .customize-section-title span.customize-action { - font-size: 13px; - display: block; - font-weight: 400; -} + post_type, 'post-formats' ) ) : $post_formats = get_theme_support( 'post-formats' ); if ( is_array( $post_formats[0] ) ) : $post_format = get_post_format( $post->ID ); if ( ! $post_format ) { $post_format = '0'; } if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) { $post_formats[0][] = $post_format; } ?> +
    +
    + + /> + +
    /> + +
    +
    + 'post_tag' ); if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); } else { $args = $box['args']; } $parsed_args = wp_parse_args( $args, $defaults ); $tax_name = esc_attr( $parsed_args['taxonomy'] ); $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); $comma = _x( ',', 'tag delimiter' ); $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); if ( ! is_string( $terms_to_edit ) ) { $terms_to_edit = ''; } ?> +
    +
    +
    + +

    +
    + +
    + + + +
    +

    labels->separate_items_with_commas; ?>

    + +

    labels->no_terms; ?>

    + +
    +
      +
      + +

      + + 'category' ); if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); } else { $args = $box['args']; } $parsed_args = wp_parse_args( $args, $defaults ); $tax_name = esc_attr( $parsed_args['taxonomy'] ); $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); ?> +
      + -#customize-theme-controls .control-panel-themes .accordion-section-title .change-theme { - position: absolute; - right: 10px; - top: 50%; - margin-top: -14px; - font-weight: 400; -} - -#customize-notifications-area .notification-message button.switch-to-editor { - display: block; - margin-top: 6px; - font-weight: 400; -} - -#customize-theme-controls .control-panel-themes > .accordion-section-title:after { - display: none; -} - -.control-panel-themes .customize-themes-full-container { - position: fixed; - top: 0; - left: 0; - transition: .18s left ease-in-out; - margin: 0 0 0 300px; - padding: 71px 0 25px; - overflow-y: scroll; - width: calc(100% - 300px); - height: calc(100% - 96px); - background: #f0f0f1; - z-index: 20; -} - -@media (prefers-reduced-motion: reduce) { - .control-panel-themes .customize-themes-full-container { - transition: none; - } -} - -@media screen and (min-width: 1670px) { - .control-panel-themes .customize-themes-full-container { - width: 82%; - right: 0; - left: initial; - } -} - -.modal-open .control-panel-themes .customize-themes-full-container { - overflow-y: visible; -} - -/* Animations for opening the themes panel */ -#customize-save-button-wrapper, -#customize-header-actions .spinner, -#customize-header-actions .customize-controls-preview-toggle { - transition: .18s margin ease-in-out; -} - -#customize-footer-actions, -#customize-footer-actions .collapse-sidebar { - bottom: 0; - transition: .18s bottom ease-in-out; -} - -.in-themes-panel:not(.animating) #customize-header-actions .spinner, -.in-themes-panel:not(.animating) #customize-header-actions .customize-controls-preview-toggle, -.in-themes-panel:not(.animating) #customize-preview, -.in-themes-panel:not(.animating) #customize-footer-actions { - visibility: hidden; -} - -.wp-full-overlay.in-themes-panel { - background: #f0f0f1; /* Prevents a black flash when fading in the panel */ -} - -.in-themes-panel #customize-save-button-wrapper, -.in-themes-panel #customize-header-actions .spinner, -.in-themes-panel #customize-header-actions .customize-controls-preview-toggle { - margin-top: -46px; /* Height of header actions bar */ -} - -.in-themes-panel #customize-footer-actions, -.in-themes-panel #customize-footer-actions .collapse-sidebar { - bottom: -45px; -} - -/* Don't show the theme count while the panel opens, as it's in the wrong place during the animation */ -.in-themes-panel.animating .control-panel-themes .filter-themes-count { - display: none; -} - -.in-themes-panel.wp-full-overlay .wp-full-overlay-sidebar-content { - bottom: 0; -} - -.themes-filter-bar .feature-filter-toggle { - float: right; - margin: 3px 0 3px 25px; -} - -.themes-filter-bar .feature-filter-toggle:before { - content: "\f111"; - margin: 0 5px 0 0; - font: normal 16px/1 dashicons; - vertical-align: text-bottom; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.themes-filter-bar .feature-filter-toggle.open { - background: #f0f0f1; - border-color: #8c8f94; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); -} - -.themes-filter-bar .feature-filter-toggle .filter-count-filters { - display: none; -} - -.filter-drawer { - box-sizing: border-box; - width: 100%; - position: absolute; - top: 46px; - left: 0; - padding: 25px 0 25px 25px; - border-top: 0; - margin: 0; - background: #f0f0f1; - border-bottom: 1px solid #dcdcde; -} - -.filter-drawer .filter-group { - margin: 0 25px 0 0; - width: calc( (100% - 75px) / 3); - min-width: 200px; - max-width: 320px; -} - -/* Adds a delay before fading in to avoid it "jumping" */ -@keyframes themes-fade-in { - 0% { - opacity: 0; - } - 50% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -.control-panel-themes .customize-themes-full-container.animate { - animation: .6s themes-fade-in 1; -} - -.in-themes-panel:not(.animating) .control-panel-themes .filter-themes-count { - animation: .6s themes-fade-in 1; -} - -.control-panel-themes .filter-themes-count { - position: relative; - float: right; - line-height: 2.6; -} - -.control-panel-themes .filter-themes-count .themes-displayed { - font-weight: 600; - color: #50575e; -} - -.customize-themes-notifications { - margin: 0; -} - -.control-panel-themes .customize-themes-notifications .notice { - margin: 0 0 25px; -} - -.customize-themes-full-container .customize-themes-section { - display: none !important; /* There is unknown JS that perpetually tries to show all theme sections when more items are added. */ - overflow: hidden; -} - -.customize-themes-full-container .customize-themes-section.current-section { - display: list-item !important; /* There is unknown JS that perpetually tries to show all theme sections when more items are added. */ -} - -.control-section .customize-section-text-before { - padding: 0 0 8px 15px; - margin: 15px 0 0; - line-height: 16px; - border-bottom: 1px solid #dcdcde; - color: #50575e; -} - -.control-panel-themes .customize-themes-section-title { - width: 100%; - background: #fff; - box-shadow: none; - outline: none; - border-top: none; - border-bottom: 1px solid #dcdcde; - border-left: 4px solid #fff; - border-right: none; - cursor: pointer; - padding: 10px 15px; - position: relative; - text-align: left; - font-size: 14px; - font-weight: 600; - color: #50575e; - text-shadow: none; -} - -.control-panel-themes #accordion-section-installed_themes { - border-top: 1px solid #dcdcde; -} - -.control-panel-themes .theme-section { - margin: 0; - position: relative; -} - -.control-panel-themes .customize-themes-section-title:focus, -.control-panel-themes .customize-themes-section-title:hover { - border-left-color: #2271b1; - color: #2271b1; - background: #f6f7f7; -} - -.customize-themes-section-title:not(.selected):after { - content: ""; - display: block; - position: absolute; - top: 9px; - right: 15px; - width: 18px; - height: 18px; - border-radius: 100%; - border: 1px solid #c3c4c7; - background: #fff; -} + -.control-panel-themes .theme-section .customize-themes-section-title.selected:after { - content: "\f147"; - font: 16px/1 dashicons; - box-sizing: border-box; - width: 20px; - height: 20px; - padding: 3px 3px 1px 1px; /* Re-align the icon to the smaller grid */ - border-radius: 100%; - position: absolute; - top: 9px; - right: 15px; - background: #2271b1; - color: #fff; -} +
      + "; ?> +
        + ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids, ) ); ?> +
      +
      + cap->edit_terms ) ) : ?> +
      + + labels->add_new_item ); ?> + +

      + + + + $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', ); $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); wp_dropdown_categories( $parent_dropdown_args ); ?> + + + +

      +
      + +
      + + +

      + Learn more about manual excerpts.' ), __( 'https://wordpress.org/support/article/excerpt/' ) ); ?> +

      + to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; if ( '' !== $post->pinged ) { $pings = '

      ' . __( 'Already pinged:' ) . '

        '; $already_pinged = explode( "\n", trim( $post->pinged ) ); foreach ( $already_pinged as $pinged_url ) { $pings .= "\n\t
      • " . esc_html( $pinged_url ) . '
      • '; } $pings .= '
      '; } ?> +

      + + +

      +

      +

      + pingbacks, no other action necessary.' ), __( 'https://wordpress.org/support/article/introduction-to-blogging/#comments' ) ); ?> +

      + +
      +
      + ID ); foreach ( $metadata as $key => $value ) { if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) { unset( $metadata[ $key ] ); } } list_meta( $metadata ); meta_form( $post ); ?> +
      +

      + use in your theme.' ), __( 'https://wordpress.org/support/article/custom-fields/' ) ); ?> +

      + + +

      +
      + + +

      + +

      + $post->ID, 'number' => 1, 'count' => true, ) ); $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); $wp_list_table->display( true ); if ( 1 > $total ) { echo '

      ' . __( 'No comments yet.' ) . '

      '; } else { $hidden = get_hidden_meta_boxes( get_current_screen() ); if ( ! in_array( 'commentsdiv', $hidden, true ) ) { ?> + + +

      + post_name, $post ); ?> + + post_type ); ?> + + array( $post_type_object->cap->edit_posts ), 'name' => 'post_author_override', 'selected' => empty( $post->ID ) ? $user_ID : $post->post_author, 'include_selected' => true, 'show' => 'display_name_with_login', ) ); } function post_revisions_meta_box( $post ) { wp_list_post_revisions( $post ); } function page_attributes_meta_box( $post ) { if ( is_post_type_hierarchical( $post->post_type ) ) : $dropdown_args = array( 'post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __( '(no parent)' ), 'sort_column' => 'menu_order, post_title', 'echo' => 0, ); $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); $pages = wp_dropdown_pages( $dropdown_args ); if ( ! empty( $pages ) ) : ?> +

      + + 0 && get_option( 'page_for_posts' ) != $post->ID ) : $template = ! empty( $post->page_template ) ? $post->page_template : false; ?> +

      + +

      + + + post_type, 'page-attributes' ) ) : ?> +

      + + + post_type && get_current_screen()->get_help_tabs() ) : ?> +

      + + + +
      +
        +
      • +
      • +
      -.customize-control.customize-control-theme { /* override most properties on .customize-control */ - box-sizing: border-box; - width: 25%; - max-width: 600px; /* Max. screenshot size / 2 */ - margin: 0 25px 25px 0; - padding: 0; - clear: none; -} +
      +
        + link_id ) ) { wp_link_category_checklist( $link->link_id ); } else { wp_link_category_checklist(); } ?> +
      +
      -/* 5 columns above 2100px */ -@media screen and (min-width: 2101px) { - .customize-control.customize-control-theme { - width: calc( ( 100% - 125px ) / 5 - 1px ); /* 1px offset accounts for browser rounding, typical all grids */ - } -} + -/* 4 columns up to 2100px */ -@media screen and (min-width: 1601px) and (max-width: 2100px) { - .customize-control.customize-control-theme { - width: calc( ( 100% - 100px ) / 4 - 1px ); - } -} +
      + + +
      +
      + +
      +

      +

      +

      +
      +

      + link_rel ) ? $link->link_rel : ''; $link_rels = preg_split( '/\s+/', $link_rel ); if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) { echo ' checked="checked"'; } if ( '' === $xfn_value ) { if ( 'family' === $xfn_relationship && ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) ) ) { echo ' checked="checked"'; } if ( 'friendship' === $xfn_relationship && ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) ) ) { echo ' checked="checked"'; } if ( 'geographical' === $xfn_relationship && ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) ) ) { echo ' checked="checked"'; } if ( 'identity' === $xfn_relationship && in_array( 'me', $link_rels, true ) ) { echo ' checked="checked"'; } } } function link_xfn_meta_box( $link ) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -/* 3 columns up to 1600px */ -@media screen and (min-width: 1201px) and (max-width: 1600px) { - .customize-control.customize-control-theme { - width: calc( ( 100% - 75px ) / 3 - 1px ); - } -} + +

      XFN.' ); ?>

      + + + + + + + + + + + + + + + + + + + + ID, '_thumbnail_id', true ); echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); } function attachment_id3_data_meta_box( $post ) { $meta = array(); if ( ! empty( $post->ID ) ) { $meta = wp_get_attachment_metadata( $post->ID ); } foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : $value = ''; if ( ! empty( $meta[ $key ] ) ) { $value = $meta[ $key ]; } ?> +

      +
      + +

      + post_type; $post_type_object = get_post_type_object( $post_type ); $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { if ( wp_attachment_is( 'audio', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } $publish_callback_args = array( '__back_compat_meta_box' => true ); if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) { $revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) ); if ( count( $revisions ) > 1 ) { $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => reset( $revisions ), '__back_compat_meta_box' => true, ); add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } if ( 'attachment' === $post_type ) { wp_enqueue_script( 'image-edit' ); wp_enqueue_style( 'imgareaselect' ); add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); add_action( 'edit_form_after_title', 'edit_form_image_editor' ); if ( wp_attachment_is( 'audio', $post ) ) { add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } else { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); } if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); } foreach ( get_object_taxonomies( $post ) as $tax_name ) { $taxonomy = get_taxonomy( $tax_name ); if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { continue; } $label = $taxonomy->labels->name; if ( ! is_taxonomy_hierarchical( $tax_name ) ) { $tax_meta_box_id = 'tagsdiv-' . $tax_name; } else { $tax_meta_box_id = $tax_name . 'div'; } add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name, '__back_compat_meta_box' => true, ) ); } if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); } if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'excerpt' ) ) { add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'trackbacks' ) ) { add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'custom-fields' ) ) { add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), '__block_editor_compatible_meta_box' => true, ) ); } do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' ); if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } $stati = get_post_stati( array( 'public' => true ) ); if ( empty( $stati ) ) { $stati = array( 'publish' ); } $stati[] = 'private'; if ( in_array( get_post_status( $post ), $stati, true ) ) { if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } if ( ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } do_action( 'add_meta_boxes', $post_type, $post ); do_action( "add_meta_boxes_{$post_type}", $post ); do_action( 'do_meta_boxes', $post_type, 'normal', $post ); do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); do_action( 'do_meta_boxes', $post_type, 'side', $post ); } Note that password carefully! It is a random password that was generated just for you.' ); $user_id = wp_create_user( $user_name, $user_password, $user_email ); update_user_meta( $user_id, 'default_password_nag', true ); $email_password = true; $user_created = true; } elseif ( ! $user_id ) { $message = '' . __( 'Your chosen password.' ) . ''; $user_id = wp_create_user( $user_name, $user_password, $user_email ); $user_created = true; } else { $message = __( 'User already exists. Password inherited.' ); } $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); if ( $user_created ) { $user->user_url = $guessurl; wp_update_user( $user ); } wp_install_defaults( $user_id ); wp_install_maybe_enable_pretty_permalinks(); flush_rewrite_rules(); wp_new_blog_notification( $blog_title, $guessurl, $user_id, ( $email_password ? $user_password : __( 'The password you chose during installation.' ) ) ); wp_cache_flush(); do_action( 'wp_install', $user ); return array( 'url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message, ); } endif; if ( ! function_exists( 'wp_install_defaults' ) ) : function wp_install_defaults( $user_id ) { global $wpdb, $wp_rewrite, $table_prefix; $cat_name = __( 'Uncategorized' ); $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); if ( global_terms_enabled() ) { $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); if ( null == $cat_id ) { $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ), ) ); $cat_id = $wpdb->insert_id; } update_option( 'default_category', $cat_id ); } else { $cat_id = 1; } $wpdb->insert( $wpdb->terms, array( 'term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0, ) ); $wpdb->insert( $wpdb->term_taxonomy, array( 'term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1, ) ); $cat_tt_id = $wpdb->insert_id; $now = current_time( 'mysql' ); $now_gmt = current_time( 'mysql', 1 ); $first_post_guid = get_option( 'home' ) . '/?p=1'; if ( is_multisite() ) { $first_post = get_site_option( 'first_post' ); if ( ! $first_post ) { $first_post = "\n

      " . __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) . "

      \n"; } $first_post = sprintf( $first_post, sprintf( '%s', esc_url( network_home_url() ), get_network()->site_name ) ); $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post ); $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post ); } else { $first_post = "\n

      " . __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) . "

      \n"; } $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __( 'Hello world!' ), 'post_name' => sanitize_title( _x( 'hello-world', 'Default post slug' ) ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); if ( is_multisite() ) { update_posts_count(); } $wpdb->insert( $wpdb->term_relationships, array( 'term_taxonomy_id' => $cat_tt_id, 'object_id' => 1, ) ); if ( is_multisite() ) { $first_comment_author = get_site_option( 'first_comment_author' ); $first_comment_email = get_site_option( 'first_comment_email' ); $first_comment_url = get_site_option( 'first_comment_url', network_home_url() ); $first_comment = get_site_option( 'first_comment' ); } $first_comment_author = ! empty( $first_comment_author ) ? $first_comment_author : __( 'A WordPress Commenter' ); $first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : 'wapuu@wordpress.example'; $first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : esc_url( __( 'https://wordpress.org/' ) ); $first_comment = ! empty( $first_comment ) ? $first_comment : sprintf( __( 'Hi, this is a comment. +To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard. +Commenter avatars come from Gravatar.' ), esc_url( __( 'https://en.gravatar.com/' ) ) ); $wpdb->insert( $wpdb->comments, array( 'comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => $first_comment_email, 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment, 'comment_type' => 'comment', ) ); if ( is_multisite() ) { $first_page = get_site_option( 'first_page' ); } if ( empty( $first_page ) ) { $first_page = "\n

      "; $first_page .= __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:" ); $first_page .= "

      \n\n\n"; $first_page .= "\n

      "; $first_page .= __( "Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)" ); $first_page .= "

      \n\n\n"; $first_page .= "\n

      "; $first_page .= __( '...or something like this:' ); $first_page .= "

      \n\n\n"; $first_page .= "\n

      "; $first_page .= __( 'The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.' ); $first_page .= "

      \n\n\n"; $first_page .= "\n

      "; $first_page .= sprintf( __( 'As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!' ), admin_url() ); $first_page .= "

      \n"; } $first_post_guid = get_option( 'home' ) . '/?page_id=2'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Sample Page' ), 'post_name' => __( 'sample-page' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); if ( is_multisite() ) { $privacy_policy_content = get_site_option( 'default_privacy_policy_content' ); } else { if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { include_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } $privacy_policy_content = WP_Privacy_Policy_Content::get_default_content(); } if ( ! empty( $privacy_policy_content ) ) { $privacy_policy_guid = get_option( 'home' ) . '/?page_id=3'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $privacy_policy_content, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Privacy Policy' ), 'post_name' => __( 'privacy-policy' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $privacy_policy_guid, 'post_type' => 'page', 'post_status' => 'draft', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 3, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); update_option( 'wp_page_for_privacy_policy', 3 ); } update_option( 'widget_block', array( 2 => array( 'content' => '' ), 3 => array( 'content' => '

      ' . __( 'Recent Posts' ) . '

      ' ), 4 => array( 'content' => '

      ' . __( 'Recent Comments' ) . '

      ' ), 5 => array( 'content' => '

      ' . __( 'Archives' ) . '

      ' ), 6 => array( 'content' => '

      ' . __( 'Categories' ) . '

      ' ), '_multiwidget' => 1, ) ); update_option( 'sidebars_widgets', array( 'wp_inactive_widgets' => array(), 'sidebar-1' => array( 0 => 'block-2', 1 => 'block-3', 2 => 'block-4', ), 'sidebar-2' => array( 0 => 'block-5', 1 => 'block-6', ), 'array_version' => 3, ) ); if ( ! is_multisite() ) { update_user_meta( $user_id, 'show_welcome_panel', 1 ); } elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) ) { update_user_meta( $user_id, 'show_welcome_panel', 2 ); } if ( is_multisite() ) { $wp_rewrite->init(); $wp_rewrite->flush_rules(); $user = new WP_User( $user_id ); $wpdb->update( $wpdb->options, array( 'option_value' => $user->user_email ), array( 'option_name' => 'admin_email' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) ); if ( ! is_super_admin( $user_id ) && 1 != $user_id ) { $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id, 'meta_key' => $wpdb->base_prefix . '1_capabilities', ) ); } } } endif; function wp_install_maybe_enable_pretty_permalinks() { global $wp_rewrite; if ( get_option( 'permalink_structure' ) ) { return true; } $permalink_structures = array( '/%year%/%monthnum%/%day%/%postname%/', '/index.php/%year%/%monthnum%/%day%/%postname%/', ); foreach ( (array) $permalink_structures as $permalink_structure ) { $wp_rewrite->set_permalink_structure( $permalink_structure ); $wp_rewrite->flush_rules( true ); $test_url = ''; $first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' ); if ( $first_post ) { $test_url = get_permalink( $first_post->ID ); } $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; if ( $pretty_permalinks ) { return true; } } $wp_rewrite->set_permalink_structure( '' ); $wp_rewrite->flush_rules( true ); return false; } if ( ! function_exists( 'wp_new_blog_notification' ) ) : function wp_new_blog_notification( $blog_title, $blog_url, $user_id, $password ) { $user = new WP_User( $user_id ); $email = $user->user_email; $name = $user->user_login; $login_url = wp_login_url(); $message = sprintf( __( 'Your new WordPress site has been successfully set up at: -/* 2 columns up to 1200px */ -@media screen and (min-width: 851px) and (max-width: 1200px) { - .customize-control.customize-control-theme { - width: calc( ( 100% - 50px ) / 2 - 1px ); +%1$s - } -} +You can log in to the administrator account with the following information: -/* 1 column up to 850 px */ -@media screen and (max-width: 850px) { - .customize-control.customize-control-theme { - width: 100%; - } -} +Username: %2$s +Password: %3$s +Log in here: %4$s -.wp-customizer .theme-browser .themes { - padding: 0 0 25px 25px; - transition: .18s margin-top linear; -} +We hope you enjoy your new site. Thanks! -.wp-customizer .theme-browser .theme .theme-actions { - opacity: 1; -} +--The WordPress Team +https://wordpress.org/ +' ), $blog_url, $name, $password, $login_url ); $installed_email = array( 'to' => $email, 'subject' => __( 'New WordPress Site' ), 'message' => $message, 'headers' => '', ); $installed_email = apply_filters( 'wp_installed_email', $installed_email, $user, $blog_title, $blog_url, $password ); wp_mail( $installed_email['to'], $installed_email['subject'], $installed_email['message'], $installed_email['headers'] ); } endif; if ( ! function_exists( 'wp_upgrade' ) ) : function wp_upgrade() { global $wp_current_db_version, $wp_db_version, $wpdb; $wp_current_db_version = __get_option( 'db_version' ); if ( $wp_db_version == $wp_current_db_version ) { return; } if ( ! is_blog_installed() ) { return; } wp_check_mysql_version(); wp_cache_flush(); pre_schema_upgrade(); make_db_current_silent(); upgrade_all(); if ( is_multisite() && is_main_site() ) { upgrade_network(); } wp_cache_flush(); if ( is_multisite() ) { update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version ); update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() ); } do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version ); } endif; function upgrade_all() { global $wp_current_db_version, $wp_db_version; $wp_current_db_version = __get_option( 'db_version' ); if ( $wp_db_version == $wp_current_db_version ) { return; } if ( empty( $wp_current_db_version ) ) { $wp_current_db_version = 0; $template = __get_option( 'template' ); if ( ! empty( $template ) ) { $wp_current_db_version = 2541; } } if ( $wp_current_db_version < 6039 ) { upgrade_230_options_table(); } populate_options(); if ( $wp_current_db_version < 2541 ) { upgrade_100(); upgrade_101(); upgrade_110(); upgrade_130(); } if ( $wp_current_db_version < 3308 ) { upgrade_160(); } if ( $wp_current_db_version < 4772 ) { upgrade_210(); } if ( $wp_current_db_version < 4351 ) { upgrade_old_slugs(); } if ( $wp_current_db_version < 5539 ) { upgrade_230(); } if ( $wp_current_db_version < 6124 ) { upgrade_230_old_tables(); } if ( $wp_current_db_version < 7499 ) { upgrade_250(); } if ( $wp_current_db_version < 7935 ) { upgrade_252(); } if ( $wp_current_db_version < 8201 ) { upgrade_260(); } if ( $wp_current_db_version < 8989 ) { upgrade_270(); } if ( $wp_current_db_version < 10360 ) { upgrade_280(); } if ( $wp_current_db_version < 11958 ) { upgrade_290(); } if ( $wp_current_db_version < 15260 ) { upgrade_300(); } if ( $wp_current_db_version < 19389 ) { upgrade_330(); } if ( $wp_current_db_version < 20080 ) { upgrade_340(); } if ( $wp_current_db_version < 22422 ) { upgrade_350(); } if ( $wp_current_db_version < 25824 ) { upgrade_370(); } if ( $wp_current_db_version < 26148 ) { upgrade_372(); } if ( $wp_current_db_version < 26691 ) { upgrade_380(); } if ( $wp_current_db_version < 29630 ) { upgrade_400(); } if ( $wp_current_db_version < 33055 ) { upgrade_430(); } if ( $wp_current_db_version < 33056 ) { upgrade_431(); } if ( $wp_current_db_version < 35700 ) { upgrade_440(); } if ( $wp_current_db_version < 36686 ) { upgrade_450(); } if ( $wp_current_db_version < 37965 ) { upgrade_460(); } if ( $wp_current_db_version < 44719 ) { upgrade_510(); } if ( $wp_current_db_version < 45744 ) { upgrade_530(); } if ( $wp_current_db_version < 48575 ) { upgrade_550(); } if ( $wp_current_db_version < 49752 ) { upgrade_560(); } if ( $wp_current_db_version < 51917 ) { upgrade_590(); } if ( $wp_current_db_version < 53011 ) { upgrade_600(); } maybe_disable_link_manager(); maybe_disable_automattic_widgets(); update_option( 'db_version', $wp_db_version ); update_option( 'db_upgraded', true ); } function upgrade_100() { global $wpdb; $posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" ); if ( $posts ) { foreach ( $posts as $post ) { if ( '' === $post->post_name ) { $newtitle = sanitize_title( $post->post_title ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID ) ); } } } $categories = $wpdb->get_results( "SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories" ); foreach ( $categories as $category ) { if ( '' === $category->category_nicename ) { $newtitle = sanitize_title( $category->cat_name ); $wpdb->update( $wpdb->categories, array( 'category_nicename' => $newtitle ), array( 'cat_ID' => $category->cat_ID ) ); } } $sql = "UPDATE $wpdb->options + SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/') + WHERE option_name LIKE %s + AND option_value LIKE %s"; $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( 'links_rating_image' ) . '%', $wpdb->esc_like( 'wp-links/links-images/' ) . '%' ) ); $done_ids = $wpdb->get_results( "SELECT DISTINCT post_id FROM $wpdb->post2cat" ); if ( $done_ids ) : $done_posts = array(); foreach ( $done_ids as $done_id ) : $done_posts[] = $done_id->post_id; endforeach; $catwhere = ' AND ID NOT IN (' . implode( ',', $done_posts ) . ')'; else : $catwhere = ''; endif; $allposts = $wpdb->get_results( "SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere" ); if ( $allposts ) : foreach ( $allposts as $post ) { $cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) ); if ( ! $cat && 0 != $post->post_category ) { $wpdb->insert( $wpdb->post2cat, array( 'post_id' => $post->ID, 'category_id' => $post->post_category, ) ); } } endif; } function upgrade_101() { global $wpdb; add_clean_index( $wpdb->posts, 'post_name' ); add_clean_index( $wpdb->posts, 'post_status' ); add_clean_index( $wpdb->categories, 'category_nicename' ); add_clean_index( $wpdb->comments, 'comment_approved' ); add_clean_index( $wpdb->comments, 'comment_post_ID' ); add_clean_index( $wpdb->links, 'link_category' ); add_clean_index( $wpdb->links, 'link_visible' ); } function upgrade_110() { global $wpdb; $users = $wpdb->get_results( "SELECT ID, user_nickname, user_nicename FROM $wpdb->users" ); foreach ( $users as $user ) { if ( '' === $user->user_nicename ) { $newname = sanitize_title( $user->user_nickname ); $wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) ); } } $users = $wpdb->get_results( "SELECT ID, user_pass from $wpdb->users" ); foreach ( $users as $row ) { if ( ! preg_match( '/^[A-Fa-f0-9]{32}$/', $row->user_pass ) ) { $wpdb->update( $wpdb->users, array( 'user_pass' => md5( $row->user_pass ) ), array( 'ID' => $row->ID ) ); } } $all_options = get_alloptions_110(); $time_difference = $all_options->time_difference; $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_option( 'gmt_offset', $gmt_offset ); $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_hours = (int) $diff_gmt_weblogger; $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) ); $wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); $wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" ); $wpdb->query( "UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'" ); $wpdb->query( "UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); $wpdb->query( "UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); } } function upgrade_130() { global $wpdb; $posts = $wpdb->get_results( "SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts" ); if ( $posts ) { foreach ( $posts as $post ) { $post_content = addslashes( deslash( $post->post_content ) ); $post_title = addslashes( deslash( $post->post_title ) ); $post_excerpt = addslashes( deslash( $post->post_excerpt ) ); if ( empty( $post->guid ) ) { $guid = get_permalink( $post->ID ); } else { $guid = $post->guid; } $wpdb->update( $wpdb->posts, compact( 'post_title', 'post_content', 'post_excerpt', 'guid' ), array( 'ID' => $post->ID ) ); } } $comments = $wpdb->get_results( "SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments" ); if ( $comments ) { foreach ( $comments as $comment ) { $comment_content = deslash( $comment->comment_content ); $comment_author = deslash( $comment->comment_author ); $wpdb->update( $wpdb->comments, compact( 'comment_content', 'comment_author' ), array( 'comment_ID' => $comment->comment_ID ) ); } } $links = $wpdb->get_results( "SELECT link_id, link_name, link_description FROM $wpdb->links" ); if ( $links ) { foreach ( $links as $link ) { $link_name = deslash( $link->link_name ); $link_description = deslash( $link->link_description ); $wpdb->update( $wpdb->links, compact( 'link_name', 'link_description' ), array( 'link_id' => $link->link_id ) ); } } $active_plugins = __get_option( 'active_plugins' ); if ( ! is_array( $active_plugins ) ) { $active_plugins = explode( "\n", trim( $active_plugins ) ); update_option( 'active_plugins', $active_plugins ); } $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options' ); $wpdb->query( "UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'" ); $wpdb->query( "UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'" ); $options = $wpdb->get_results( "SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name" ); foreach ( $options as $option ) { if ( 1 != $option->dupes ) { $limit = $option->dupes - 1; $dupe_ids = $wpdb->get_col( $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit ) ); if ( $dupe_ids ) { $dupe_ids = implode( ',', $dupe_ids ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)" ); } } } make_site_theme(); } function upgrade_160() { global $wpdb, $wp_current_db_version; populate_roles_160(); $users = $wpdb->get_results( "SELECT * FROM $wpdb->users" ); foreach ( $users as $user ) : if ( ! empty( $user->user_firstname ) ) { update_user_meta( $user->ID, 'first_name', wp_slash( $user->user_firstname ) ); } if ( ! empty( $user->user_lastname ) ) { update_user_meta( $user->ID, 'last_name', wp_slash( $user->user_lastname ) ); } if ( ! empty( $user->user_nickname ) ) { update_user_meta( $user->ID, 'nickname', wp_slash( $user->user_nickname ) ); } if ( ! empty( $user->user_level ) ) { update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level ); } if ( ! empty( $user->user_icq ) ) { update_user_meta( $user->ID, 'icq', wp_slash( $user->user_icq ) ); } if ( ! empty( $user->user_aim ) ) { update_user_meta( $user->ID, 'aim', wp_slash( $user->user_aim ) ); } if ( ! empty( $user->user_msn ) ) { update_user_meta( $user->ID, 'msn', wp_slash( $user->user_msn ) ); } if ( ! empty( $user->user_yim ) ) { update_user_meta( $user->ID, 'yim', wp_slash( $user->user_icq ) ); } if ( ! empty( $user->user_description ) ) { update_user_meta( $user->ID, 'description', wp_slash( $user->user_description ) ); } if ( isset( $user->user_idmode ) ) : $idmode = $user->user_idmode; if ( 'nickname' === $idmode ) { $id = $user->user_nickname; } if ( 'login' === $idmode ) { $id = $user->user_login; } if ( 'firstname' === $idmode ) { $id = $user->user_firstname; } if ( 'lastname' === $idmode ) { $id = $user->user_lastname; } if ( 'namefl' === $idmode ) { $id = $user->user_firstname . ' ' . $user->user_lastname; } if ( 'namelf' === $idmode ) { $id = $user->user_lastname . ' ' . $user->user_firstname; } if ( ! $idmode ) { $id = $user->user_nickname; } $wpdb->update( $wpdb->users, array( 'display_name' => $id ), array( 'ID' => $user->ID ) ); endif; $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities' ); if ( empty( $caps ) || defined( 'RESET_CAPS' ) ) { $level = get_user_meta( $user->ID, $wpdb->prefix . 'user_level', true ); $role = translate_level_to_role( $level ); update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array( $role => true ) ); } endforeach; $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' ); $wpdb->hide_errors(); foreach ( $old_user_fields as $old ) { $wpdb->query( "ALTER TABLE $wpdb->users DROP $old" ); } $wpdb->show_errors(); $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" ); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { $wpdb->update( $wpdb->posts, array( 'comment_count' => $comment->c ), array( 'ID' => $comment->comment_post_ID ) ); } } if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) { $objects = $wpdb->get_results( "SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'" ); foreach ( $objects as $object ) { $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', 'post_mime_type' => $object->post_type, 'post_type' => '', ), array( 'ID' => $object->ID ) ); $meta = get_post_meta( $object->ID, 'imagedata', true ); if ( ! empty( $meta['file'] ) ) { update_attached_file( $object->ID, $meta['file'] ); } } } } function upgrade_210() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 3506 ) { $posts = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts" ); if ( ! empty( $posts ) ) { foreach ( $posts as $post ) { $status = $post->post_status; $type = 'post'; if ( 'static' === $status ) { $status = 'publish'; $type = 'page'; } elseif ( 'attachment' === $status ) { $status = 'inherit'; $type = 'attachment'; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID ) ); } } } if ( $wp_current_db_version < 3845 ) { populate_roles_210(); } if ( $wp_current_db_version < 3531 ) { $now = gmdate( 'Y-m-d H:i:59' ); $wpdb->query( "UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'" ); $posts = $wpdb->get_results( "SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'" ); if ( ! empty( $posts ) ) { foreach ( $posts as $post ) { wp_schedule_single_event( mysql2date( 'U', $post->post_date, false ), 'publish_future_post', array( $post->ID ) ); } } } } function upgrade_230() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 5200 ) { populate_roles_230(); } $tt_ids = array(); $have_tags = false; $categories = $wpdb->get_results( "SELECT * FROM $wpdb->categories ORDER BY cat_ID" ); foreach ( $categories as $category ) { $term_id = (int) $category->cat_ID; $name = $category->cat_name; $description = $category->category_description; $slug = $category->category_nicename; $parent = $category->category_parent; $term_group = 0; $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); if ( $exists ) { $term_group = $exists[0]->term_group; $id = $exists[0]->term_id; $num = 2; do { $alt_slug = $slug . "-$num"; $num++; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); $slug = $alt_slug; if ( empty( $term_group ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group" ) + 1; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id ) ); } } $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES + (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group ) ); $count = 0; if ( ! empty( $category->category_count ) ) { $count = (int) $category->category_count; $taxonomy = 'category'; $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( ! empty( $category->link_count ) ) { $count = (int) $category->link_count; $taxonomy = 'link_category'; $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( ! empty( $category->tag_count ) ) { $have_tags = true; $count = (int) $category->tag_count; $taxonomy = 'post_tag'; $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent', 'count' ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( empty( $count ) ) { $count = 0; $taxonomy = 'category'; $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent', 'count' ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } } $select = 'post_id, category_id'; if ( $have_tags ) { $select .= ', rel_type'; } $posts = $wpdb->get_results( "SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id" ); foreach ( $posts as $post ) { $post_id = (int) $post->post_id; $term_id = (int) $post->category_id; $taxonomy = 'category'; if ( ! empty( $post->rel_type ) && 'tag' === $post->rel_type ) { $taxonomy = 'tag'; } $tt_id = $tt_ids[ $term_id ][ $taxonomy ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $post_id, 'term_taxonomy_id' => $tt_id, ) ); } if ( $wp_current_db_version < 3570 ) { $link_cat_id_map = array(); $default_link_cat = 0; $tt_ids = array(); $link_cats = $wpdb->get_results( 'SELECT cat_id, cat_name FROM ' . $wpdb->prefix . 'linkcategories' ); foreach ( $link_cats as $category ) { $cat_id = (int) $category->cat_id; $term_id = 0; $name = wp_slash( $category->cat_name ); $slug = sanitize_title( $name ); $term_group = 0; $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); if ( $exists ) { $term_group = $exists[0]->term_group; $term_id = $exists[0]->term_id; } if ( empty( $term_id ) ) { $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ); $term_id = (int) $wpdb->insert_id; } $link_cat_id_map[ $cat_id ] = $term_id; $default_link_cat = $term_id; $wpdb->insert( $wpdb->term_taxonomy, array( 'term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0, ) ); $tt_ids[ $term_id ] = (int) $wpdb->insert_id; } $links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" ); if ( ! empty( $links ) ) { foreach ( $links as $link ) { if ( 0 == $link->link_category ) { continue; } if ( ! isset( $link_cat_id_map[ $link->link_category ] ) ) { continue; } $term_id = $link_cat_id_map[ $link->link_category ]; $tt_id = $tt_ids[ $term_id ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id, ) ); } } update_option( 'default_link_category', $default_link_cat ); } else { $links = $wpdb->get_results( "SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id" ); foreach ( $links as $link ) { $link_id = (int) $link->link_id; $term_id = (int) $link->category_id; $taxonomy = 'link_category'; $tt_id = $tt_ids[ $term_id ][ $taxonomy ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $link_id, 'term_taxonomy_id' => $tt_id, ) ); } } if ( $wp_current_db_version < 4772 ) { $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories' ); } $terms = $wpdb->get_results( "SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy" ); foreach ( (array) $terms as $term ) { if ( 'post_tag' === $term->taxonomy || 'category' === $term->taxonomy ) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id ) ); } else { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ) ); } $wpdb->update( $wpdb->term_taxonomy, array( 'count' => $count ), array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); } } function upgrade_230_options_table() { global $wpdb; $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' ); $wpdb->hide_errors(); foreach ( $old_options_fields as $old ) { $wpdb->query( "ALTER TABLE $wpdb->options DROP $old" ); } $wpdb->show_errors(); } function upgrade_230_old_tables() { global $wpdb; $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat' ); } function upgrade_old_slugs() { global $wpdb; $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'" ); } function upgrade_250() { global $wp_current_db_version; if ( $wp_current_db_version < 6689 ) { populate_roles_250(); } } function upgrade_252() { global $wpdb; $wpdb->query( "UPDATE $wpdb->users SET user_activation_key = ''" ); } function upgrade_260() { global $wp_current_db_version; if ( $wp_current_db_version < 8000 ) { populate_roles_260(); } } function upgrade_270() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 8980 ) { populate_roles_270(); } if ( $wp_current_db_version < 8921 ) { $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" ); } } function upgrade_280() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 10360 ) { populate_roles_280(); } if ( is_multisite() ) { $start = 0; while ( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) { foreach ( $rows as $row ) { $value = maybe_unserialize( $row->option_value ); if ( $value === $row->option_value ) { $value = stripslashes( $value ); } if ( $value !== $row->option_value ) { update_option( $row->option_name, $value ); } } $start += 20; } clean_blog_cache( get_current_blog_id() ); } } function upgrade_290() { global $wp_current_db_version; if ( $wp_current_db_version < 11958 ) { if ( get_option( 'thread_comments_depth' ) == '1' ) { update_option( 'thread_comments_depth', 2 ); update_option( 'thread_comments', 0 ); } } } function upgrade_300() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 15093 ) { populate_roles_300(); } if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false ) { add_site_option( 'siteurl', '' ); } if ( wp_should_upgrade_global_tables() ) { $sql = "DELETE FROM $wpdb->usermeta + WHERE meta_key LIKE %s + OR meta_key LIKE %s + OR meta_key LIKE %s + OR meta_key LIKE %s + OR meta_key LIKE %s + OR meta_key LIKE %s + OR meta_key = 'manageedittagscolumnshidden' + OR meta_key = 'managecategoriescolumnshidden' + OR meta_key = 'manageedit-tagscolumnshidden' + OR meta_key = 'manageeditcolumnshidden' + OR meta_key = 'categories_per_page' + OR meta_key = 'edit_tags_per_page'"; $prefix = $wpdb->esc_like( $wpdb->base_prefix ); $wpdb->query( $wpdb->prepare( $sql, $prefix . '%' . $wpdb->esc_like( 'meta-box-hidden' ) . '%', $prefix . '%' . $wpdb->esc_like( 'closedpostboxes' ) . '%', $prefix . '%' . $wpdb->esc_like( 'manage-' ) . '%' . $wpdb->esc_like( '-columns-hidden' ) . '%', $prefix . '%' . $wpdb->esc_like( 'meta-box-order' ) . '%', $prefix . '%' . $wpdb->esc_like( 'metaboxorder' ) . '%', $prefix . '%' . $wpdb->esc_like( 'screen_layout' ) . '%' ) ); } } function upgrade_330() { global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets; if ( $wp_current_db_version < 19061 && wp_should_upgrade_global_tables() ) { $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" ); } if ( $wp_current_db_version >= 11548 ) { return; } $sidebars_widgets = get_option( 'sidebars_widgets', array() ); $_sidebars_widgets = array(); if ( isset( $sidebars_widgets['wp_inactive_widgets'] ) || empty( $sidebars_widgets ) ) { $sidebars_widgets['array_version'] = 3; } elseif ( ! isset( $sidebars_widgets['array_version'] ) ) { $sidebars_widgets['array_version'] = 1; } switch ( $sidebars_widgets['array_version'] ) { case 1: foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( (array) $sidebar as $i => $name ) { $id = strtolower( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; continue; } $id = sanitize_title( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; continue; } $found = false; foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( strtolower( $widget['name'] ) == strtolower( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; $found = true; break; } elseif ( sanitize_title( $widget['name'] ) == sanitize_title( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; $found = true; break; } } if ( $found ) { continue; } unset( $_sidebars_widgets[ $index ][ $i ] ); } } } $_sidebars_widgets['array_version'] = 2; $sidebars_widgets = $_sidebars_widgets; unset( $_sidebars_widgets ); case 2: $sidebars_widgets = retrieve_widgets(); $sidebars_widgets['array_version'] = 3; update_option( 'sidebars_widgets', $sidebars_widgets ); } } function upgrade_340() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 19798 ) { $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" ); $wpdb->show_errors(); } if ( $wp_current_db_version < 19799 ) { $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE $wpdb->comments DROP INDEX comment_approved" ); $wpdb->show_errors(); } if ( $wp_current_db_version < 20022 && wp_should_upgrade_global_tables() ) { $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" ); } if ( $wp_current_db_version < 20080 ) { if ( 'yes' === $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) { $uninstall_plugins = get_option( 'uninstall_plugins' ); delete_option( 'uninstall_plugins' ); add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' ); } } } function upgrade_350() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { update_option( 'link_manager_enabled', 1 ); } if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) { $meta_keys = array(); foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) { if ( false !== strpos( $name, '-' ) ) { $meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page'; } } if ( $meta_keys ) { $meta_keys = implode( "', '", $meta_keys ); $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')" ); } } if ( $wp_current_db_version < 22422 ) { $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ); if ( $term ) { wp_delete_term( $term->term_id, 'post_format' ); } } } function upgrade_370() { global $wp_current_db_version; if ( $wp_current_db_version < 25824 ) { wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' ); } } function upgrade_372() { global $wp_current_db_version; if ( $wp_current_db_version < 26148 ) { wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); } } function upgrade_380() { global $wp_current_db_version; if ( $wp_current_db_version < 26691 ) { deactivate_plugins( array( 'mp6/mp6.php' ), true ); } } function upgrade_400() { global $wp_current_db_version; if ( $wp_current_db_version < 29630 ) { if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) { if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) { update_option( 'WPLANG', WPLANG ); } else { update_option( 'WPLANG', '' ); } } } } function upgrade_420() {} function upgrade_430() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 32364 ) { upgrade_430_fix_comments(); } if ( $wp_current_db_version < 32814 ) { update_option( 'finished_splitting_shared_terms', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); } if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) { if ( is_multisite() ) { $tables = $wpdb->tables( 'blog' ); } else { $tables = $wpdb->tables( 'all' ); if ( ! wp_should_upgrade_global_tables() ) { $global_tables = $wpdb->tables( 'global' ); $tables = array_diff_assoc( $tables, $global_tables ); } } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } function upgrade_430_fix_comments() { global $wpdb; $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' ); if ( is_wp_error( $content_length ) ) { return; } if ( false === $content_length ) { $content_length = array( 'type' => 'byte', 'length' => 65535, ); } elseif ( ! is_array( $content_length ) ) { $length = (int) $content_length > 0 ? (int) $content_length : 65535; $content_length = array( 'type' => 'byte', 'length' => $length, ); } if ( 'byte' !== $content_length['type'] || 0 === $content_length['length'] ) { return; } $allowed_length = (int) $content_length['length'] - 10; $comments = $wpdb->get_results( "SELECT `comment_ID` FROM `{$wpdb->comments}` + WHERE `comment_date_gmt` > '2015-04-26' + AND LENGTH( `comment_content` ) >= {$allowed_length} + AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )" ); foreach ( $comments as $comment ) { wp_delete_comment( $comment->comment_ID, true ); } } function upgrade_431() { $cron_array = _get_cron_array(); if ( isset( $cron_array['wp_batch_split_terms'] ) ) { unset( $cron_array['wp_batch_split_terms'] ); _set_cron_array( $cron_array ); } } function upgrade_440() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 34030 ) { $wpdb->query( "ALTER TABLE {$wpdb->options} MODIFY option_name VARCHAR(191)" ); } $roles = wp_roles(); foreach ( $roles->role_objects as $role ) { if ( $role->has_cap( 'add_users' ) ) { $role->remove_cap( 'add_users' ); } } } function upgrade_450() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 36180 ) { wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); } if ( $wp_current_db_version < 36679 && is_multisite() ) { $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^[0-9]+_new_email$'" ); } delete_user_setting( 'wplink' ); } function upgrade_460() { global $wp_current_db_version; if ( $wp_current_db_version < 37854 ) { delete_post_meta_by_key( '_post_restored_from' ); } if ( $wp_current_db_version < 37965 ) { $uninstall_plugins = get_option( 'uninstall_plugins', array() ); if ( ! empty( $uninstall_plugins ) ) { foreach ( $uninstall_plugins as $basename => $callback ) { if ( is_array( $callback ) && is_object( $callback[0] ) ) { unset( $uninstall_plugins[ $basename ] ); } } update_option( 'uninstall_plugins', $uninstall_plugins ); } } } function upgrade_500() { } function upgrade_510() { delete_site_option( 'upgrade_500_was_gutenberg_active' ); } function upgrade_530() { if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) { update_option( 'admin_email_lifespan', 0 ); } } function upgrade_550() { global $wp_current_db_version; if ( $wp_current_db_version < 48121 ) { $comment_previously_approved = get_option( 'comment_whitelist', '' ); update_option( 'comment_previously_approved', $comment_previously_approved ); delete_option( 'comment_whitelist' ); } if ( $wp_current_db_version < 48575 ) { $disallowed_list = get_option( 'blacklist_keys' ); if ( false === $disallowed_list ) { $disallowed_list = get_option( 'blocklist_keys' ); } update_option( 'disallowed_keys', $disallowed_list ); delete_option( 'blacklist_keys' ); delete_option( 'blocklist_keys' ); } if ( $wp_current_db_version < 48748 ) { update_option( 'finished_updating_comment_type', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); } } function upgrade_560() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 49572 ) { $post_category_exists = $wpdb->get_var( "SHOW COLUMNS FROM $wpdb->posts LIKE 'post_category'" ); if ( ! is_null( $post_category_exists ) ) { $wpdb->query( "ALTER TABLE $wpdb->posts DROP COLUMN `post_category`" ); } update_option( 'auto_update_core_major', 'unset' ); } if ( $wp_current_db_version < 49632 ) { save_mod_rewrite_rules(); } if ( $wp_current_db_version < 49735 ) { delete_transient( 'dirsize_cache' ); } if ( $wp_current_db_version < 49752 ) { $results = $wpdb->get_results( $wpdb->prepare( "SELECT 1 FROM {$wpdb->usermeta} WHERE meta_key = %s LIMIT 1", WP_Application_Passwords::USERMETA_KEY_APPLICATION_PASSWORDS ) ); if ( ! empty( $results ) ) { $network_id = get_main_network_id(); update_network_option( $network_id, WP_Application_Passwords::OPTION_KEY_IN_USE, 1 ); } } } function upgrade_590() { global $wp_current_db_version; if ( $wp_current_db_version < 51917 ) { $crons = _get_cron_array(); if ( $crons && is_array( $crons ) ) { $crons = array_filter( $crons ); _set_cron_array( $crons ); } } } function upgrade_600() { global $wp_current_db_version; if ( $wp_current_db_version < 53011 ) { wp_update_user_counts(); } } function upgrade_network() { global $wp_current_db_version, $wpdb; delete_expired_transients( true ); if ( $wp_current_db_version < 11549 ) { $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' ); $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' ); if ( $wpmu_sitewide_plugins ) { if ( ! $active_sitewide_plugins ) { $sitewide_plugins = (array) $wpmu_sitewide_plugins; } else { $sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins ); } update_site_option( 'active_sitewide_plugins', $sitewide_plugins ); } delete_site_option( 'wpmu_sitewide_plugins' ); delete_site_option( 'deactivated_sitewide_plugins' ); $start = 0; while ( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) { foreach ( $rows as $row ) { $value = $row->meta_value; if ( ! @unserialize( $value ) ) { $value = stripslashes( $value ); } if ( $value !== $row->meta_value ) { update_site_option( $row->meta_key, $value ); } } $start += 20; } } if ( $wp_current_db_version < 13576 ) { update_site_option( 'global_terms_enabled', '1' ); } if ( $wp_current_db_version < 19390 ) { update_site_option( 'initial_db_version', $wp_current_db_version ); } if ( $wp_current_db_version < 19470 ) { if ( false === get_site_option( 'active_sitewide_plugins' ) ) { update_site_option( 'active_sitewide_plugins', array() ); } } if ( $wp_current_db_version < 20148 ) { $allowedthemes = get_site_option( 'allowedthemes' ); $allowed_themes = get_site_option( 'allowed_themes' ); if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) { $converted = array(); $themes = wp_get_themes(); foreach ( $themes as $stylesheet => $theme_data ) { if ( isset( $allowed_themes[ $theme_data->get( 'Name' ) ] ) ) { $converted[ $stylesheet ] = true; } } update_site_option( 'allowedthemes', $converted ); delete_site_option( 'allowed_themes' ); } } if ( $wp_current_db_version < 21823 ) { update_site_option( 'ms_files_rewriting', '1' ); } if ( $wp_current_db_version < 24448 ) { $illegal_names = get_site_option( 'illegal_names' ); if ( is_array( $illegal_names ) && count( $illegal_names ) === 1 ) { $illegal_name = reset( $illegal_names ); $illegal_names = explode( ' ', $illegal_name ); update_site_option( 'illegal_names', $illegal_names ); } } if ( $wp_current_db_version < 31351 && 'utf8mb4' === $wpdb->charset ) { if ( wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" ); $wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" ); $tables = $wpdb->tables( 'global' ); if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) { unset( $tables['sitecategories'] ); } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) { if ( wp_should_upgrade_global_tables() ) { $upgrade = false; $indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" ); foreach ( $indexes as $index ) { if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) { $upgrade = true; break; } } if ( $upgrade ) { $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" ); } $tables = $wpdb->tables( 'global' ); if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) { unset( $tables['sitecategories'] ); } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } if ( $wp_current_db_version < 44467 ) { $network_id = get_main_network_id(); delete_network_option( $network_id, 'site_meta_supported' ); is_site_meta_supported(); } } function maybe_create_table( $table_name, $create_ddl ) { global $wpdb; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ); if ( $wpdb->get_var( $query ) === $table_name ) { return true; } $wpdb->query( $create_ddl ); if ( $wpdb->get_var( $query ) === $table_name ) { return true; } return false; } function drop_index( $table, $index ) { global $wpdb; $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" ); for ( $i = 0; $i < 25; $i++ ) { $wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" ); } $wpdb->show_errors(); return true; } function add_clean_index( $table, $index ) { global $wpdb; drop_index( $table, $index ); $wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" ); return true; } function maybe_add_column( $table_name, $column_name, $create_ddl ) { global $wpdb; foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } $wpdb->query( $create_ddl ); foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } return false; } function maybe_convert_table_to_utf8mb4( $table ) { global $wpdb; $results = $wpdb->get_results( "SHOW FULL COLUMNS FROM `$table`" ); if ( ! $results ) { return false; } foreach ( $results as $column ) { if ( $column->Collation ) { list( $charset ) = explode( '_', $column->Collation ); $charset = strtolower( $charset ); if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) { return false; } } } $table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" ); if ( ! $table_details ) { return false; } list( $table_charset ) = explode( '_', $table_details->Collation ); $table_charset = strtolower( $table_charset ); if ( 'utf8mb4' === $table_charset ) { return true; } return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" ); } function get_alloptions_110() { global $wpdb; $all_options = new stdClass; $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); if ( $options ) { foreach ( $options as $option ) { if ( 'siteurl' === $option->option_name || 'home' === $option->option_name || 'category_base' === $option->option_name ) { $option->option_value = untrailingslashit( $option->option_value ); } $all_options->{$option->option_name} = stripslashes( $option->option_value ); } } return $all_options; } function __get_option( $setting ) { global $wpdb; if ( 'home' === $setting && defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) { return untrailingslashit( WP_SITEURL ); } $option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) ); if ( 'home' === $setting && ! $option ) { return __get_option( 'siteurl' ); } if ( in_array( $setting, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) { $option = untrailingslashit( $option ); } return maybe_unserialize( $option ); } function deslash( $content ) { $content = preg_replace( "/\\\+'/", "'", $content ); $content = preg_replace( '/\\\+"/', '"', $content ); $content = preg_replace( '/\\\+/', '\\', $content ); return $content; } function dbDelta( $queries = '', $execute = true ) { global $wpdb; if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) ) { $queries = wp_get_db_schema( $queries ); } if ( ! is_array( $queries ) ) { $queries = explode( ';', $queries ); $queries = array_filter( $queries ); } $queries = apply_filters( 'dbdelta_queries', $queries ); $cqueries = array(); $iqueries = array(); $for_update = array(); foreach ( $queries as $qry ) { if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { $cqueries[ trim( $matches[1], '`' ) ] = $qry; $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; } elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { array_unshift( $cqueries, $qry ); } elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; } elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; } else { } } $cqueries = apply_filters( 'dbdelta_create_queries', $cqueries ); $iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries ); $text_fields = array( 'tinytext', 'text', 'mediumtext', 'longtext' ); $blob_fields = array( 'tinyblob', 'blob', 'mediumblob', 'longblob' ); $global_tables = $wpdb->tables( 'global' ); foreach ( $cqueries as $table => $qry ) { if ( in_array( $table, $global_tables, true ) && ! wp_should_upgrade_global_tables() ) { unset( $cqueries[ $table ], $for_update[ $table ] ); continue; } $suppress = $wpdb->suppress_errors(); $tablefields = $wpdb->get_results( "DESCRIBE {$table};" ); $wpdb->suppress_errors( $suppress ); if ( ! $tablefields ) { continue; } $cfields = array(); $indices = array(); $indices_without_subparts = array(); preg_match( '|\((.*)\)|ms', $qry, $match2 ); $qryline = trim( $match2[1] ); $flds = explode( "\n", $qryline ); foreach ( $flds as $fld ) { $fld = trim( $fld, " \t\n\r\0\x0B," ); preg_match( '|^([^ ]*)|', $fld, $fvals ); $fieldname = trim( $fvals[1], '`' ); $fieldname_lowercased = strtolower( $fieldname ); $validfield = true; switch ( $fieldname_lowercased ) { case '': case 'primary': case 'index': case 'fulltext': case 'unique': case 'key': case 'spatial': $validfield = false; preg_match( '/^' . '(?P' . 'PRIMARY\s+KEY|(?:UNIQUE|FULLTEXT|SPATIAL)\s+(?:KEY|INDEX)|KEY|INDEX' . ')' . '\s+' . '(?:' . '`?' . '(?P' . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' . ')' . '`?' . '\s+' . ')*' . '\(' . '(?P' . '.+?' . ')' . '\)' . '$/im', $fld, $index_matches ); $index_type = strtoupper( preg_replace( '/\s+/', ' ', trim( $index_matches['index_type'] ) ) ); $index_type = str_replace( 'INDEX', 'KEY', $index_type ); $index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`'; $index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) ); $index_columns_without_subparts = $index_columns; foreach ( $index_columns as $id => &$index_column ) { preg_match( '/' . '`?' . '(?P' . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' . ')' . '`?' . '(?:' . '\s*' . '\(' . '\s*' . '(?P' . '\d+' . ')' . '\s*' . '\)' . ')?' . '/', $index_column, $index_column_matches ); $index_column = '`' . $index_column_matches['column_name'] . '`'; $index_columns_without_subparts[ $id ] = $index_column; if ( isset( $index_column_matches['sub_part'] ) ) { $index_column .= '(' . $index_column_matches['sub_part'] . ')'; } } $indices[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns ) . ')'; $indices_without_subparts[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns_without_subparts ) . ')'; unset( $index_column, $index_column_matches, $index_matches, $index_type, $index_name, $index_columns, $index_columns_without_subparts ); break; } if ( $validfield ) { $cfields[ $fieldname_lowercased ] = $fld; } } foreach ( $tablefields as $tablefield ) { $tablefield_field_lowercased = strtolower( $tablefield->Field ); $tablefield_type_lowercased = strtolower( $tablefield->Type ); if ( array_key_exists( $tablefield_field_lowercased, $cfields ) ) { preg_match( '|`?' . $tablefield->Field . '`? ([^ ]*( unsigned)?)|i', $cfields[ $tablefield_field_lowercased ], $matches ); $fieldtype = $matches[1]; $fieldtype_lowercased = strtolower( $fieldtype ); if ( $tablefield->Type != $fieldtype ) { $do_change = true; if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) { $do_change = false; } } if ( in_array( $fieldtype_lowercased, $blob_fields, true ) && in_array( $tablefield_type_lowercased, $blob_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $blob_fields, true ) < array_search( $tablefield_type_lowercased, $blob_fields, true ) ) { $do_change = false; } } if ( $do_change ) { $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN `{$tablefield->Field}` " . $cfields[ $tablefield_field_lowercased ]; $for_update[ $table . '.' . $tablefield->Field ] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; } } if ( preg_match( "| DEFAULT '(.*?)'|i", $cfields[ $tablefield_field_lowercased ], $matches ) ) { $default_value = $matches[1]; if ( $tablefield->Default != $default_value ) { $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN `{$tablefield->Field}` SET DEFAULT '{$default_value}'"; $for_update[ $table . '.' . $tablefield->Field ] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}"; } } unset( $cfields[ $tablefield_field_lowercased ] ); } else { } } foreach ( $cfields as $fieldname => $fielddef ) { $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; $for_update[ $table . '.' . $fieldname ] = 'Added column ' . $table . '.' . $fieldname; } $tableindices = $wpdb->get_results( "SHOW INDEX FROM {$table};" ); if ( $tableindices ) { $index_ary = array(); foreach ( $tableindices as $tableindex ) { $keyname = strtolower( $tableindex->Key_name ); $index_ary[ $keyname ]['columns'][] = array( 'fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part, ); $index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false; $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type; } foreach ( $index_ary as $index_name => $index_data ) { $index_string = ''; if ( 'primary' === $index_name ) { $index_string .= 'PRIMARY '; } elseif ( $index_data['unique'] ) { $index_string .= 'UNIQUE '; } if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'FULLTEXT '; } if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'SPATIAL '; } $index_string .= 'KEY '; if ( 'primary' !== $index_name ) { $index_string .= '`' . $index_name . '`'; } $index_columns = ''; foreach ( $index_data['columns'] as $column_data ) { if ( '' !== $index_columns ) { $index_columns .= ','; } $index_columns .= '`' . $column_data['fieldname'] . '`'; } $index_string .= " ($index_columns)"; $aindex = array_search( $index_string, $indices_without_subparts, true ); if ( false !== $aindex ) { unset( $indices_without_subparts[ $aindex ] ); unset( $indices[ $aindex ] ); } } } foreach ( (array) $indices as $index ) { $cqueries[] = "ALTER TABLE {$table} ADD $index"; $for_update[] = 'Added index ' . $table . ' ' . $index; } unset( $cqueries[ $table ], $for_update[ $table ] ); } $allqueries = array_merge( $cqueries, $iqueries ); if ( $execute ) { foreach ( $allqueries as $query ) { $wpdb->query( $query ); } } return $for_update; } function make_db_current( $tables = 'all' ) { $alterations = dbDelta( $tables ); echo "
        \n"; foreach ( $alterations as $alteration ) { echo "
      1. $alteration
      2. \n"; } echo "
      \n"; } function make_db_current_silent( $tables = 'all' ) { dbDelta( $tables ); } function make_site_theme_from_oldschool( $theme_name, $template ) { $home_path = get_home_path(); $site_dir = WP_CONTENT_DIR . "/themes/$template"; if ( ! file_exists( "$home_path/index.php" ) ) { return false; } $files = array( 'index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php', ); foreach ( $files as $oldfile => $newfile ) { if ( 'index.php' === $oldfile ) { $oldpath = $home_path; } else { $oldpath = ABSPATH; } if ( 'index.php' === $oldfile ) { $index = implode( '', file( "$oldpath/$oldfile" ) ); if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) { return false; } continue; } } if ( ! copy( "$oldpath/$oldfile", "$site_dir/$newfile" ) ) { return false; } chmod( "$site_dir/$newfile", 0777 ); $lines = explode( "\n", implode( '', file( "$site_dir/$newfile" ) ) ); if ( $lines ) { $f = fopen( "$site_dir/$newfile", 'w' ); foreach ( $lines as $line ) { if ( preg_match( '/require.*wp-blog-header/', $line ) ) { $line = '//' . $line; } $line = str_replace( "/wp-layout.css", "", $line ); $line = str_replace( "", '', $line ); fwrite( $f, "{$line}\n" ); } fclose( $f ); } } $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option( 'siteurl' ) . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n"; $stylelines = file_get_contents( "$site_dir/style.css" ); if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); fwrite( $f, $header ); fwrite( $f, $stylelines ); fclose( $f ); } return true; } function make_site_theme_from_default( $theme_name, $template ) { $site_dir = WP_CONTENT_DIR . "/themes/$template"; $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; $theme_dir = @opendir( $default_dir ); if ( $theme_dir ) { while ( ( $theme_file = readdir( $theme_dir ) ) !== false ) { if ( is_dir( "$default_dir/$theme_file" ) ) { continue; } if ( ! copy( "$default_dir/$theme_file", "$site_dir/$theme_file" ) ) { return; } chmod( "$site_dir/$theme_file", 0777 ); } closedir( $theme_dir ); } $stylelines = explode( "\n", implode( '', file( "$site_dir/style.css" ) ) ); if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); foreach ( $stylelines as $line ) { if ( strpos( $line, 'Theme Name:' ) !== false ) { $line = 'Theme Name: ' . $theme_name; } elseif ( strpos( $line, 'Theme URI:' ) !== false ) { $line = 'Theme URI: ' . __get_option( 'url' ); } elseif ( strpos( $line, 'Description:' ) !== false ) { $line = 'Description: Your theme.'; } elseif ( strpos( $line, 'Version:' ) !== false ) { $line = 'Version: 1'; } elseif ( strpos( $line, 'Author:' ) !== false ) { $line = 'Author: You'; } fwrite( $f, $line . "\n" ); } fclose( $f ); } umask( 0 ); if ( ! mkdir( "$site_dir/images", 0777 ) ) { return false; } $images_dir = @opendir( "$default_dir/images" ); if ( $images_dir ) { while ( ( $image = readdir( $images_dir ) ) !== false ) { if ( is_dir( "$default_dir/images/$image" ) ) { continue; } if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) { return; } chmod( "$site_dir/images/$image", 0777 ); } closedir( $images_dir ); } } function make_site_theme() { $theme_name = __get_option( 'blogname' ); $template = sanitize_title( $theme_name ); $site_dir = WP_CONTENT_DIR . "/themes/$template"; if ( is_dir( $site_dir ) ) { return false; } if ( ! is_writable( WP_CONTENT_DIR . '/themes' ) ) { return false; } umask( 0 ); if ( ! mkdir( $site_dir, 0777 ) ) { return false; } if ( file_exists( ABSPATH . 'wp-layout.css' ) ) { if ( ! make_site_theme_from_oldschool( $theme_name, $template ) ) { return false; } } else { if ( ! make_site_theme_from_default( $theme_name, $template ) ) { return false; } } $current_template = __get_option( 'template' ); if ( WP_DEFAULT_THEME == $current_template ) { update_option( 'template', $template ); update_option( 'stylesheet', $template ); } return $template; } function translate_level_to_role( $level ) { switch ( $level ) { case 10: case 9: case 8: return 'administrator'; case 7: case 6: case 5: return 'editor'; case 4: case 3: case 2: return 'author'; case 1: return 'contributor'; case 0: default: return 'subscriber'; } } function wp_check_mysql_version() { global $wpdb; $result = $wpdb->check_database_version(); if ( is_wp_error( $result ) ) { wp_die( $result ); } } function maybe_disable_automattic_widgets() { $plugins = __get_option( 'active_plugins' ); foreach ( (array) $plugins as $plugin ) { if ( 'widgets.php' === basename( $plugin ) ) { array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 ); update_option( 'active_plugins', $plugins ); break; } } } function maybe_disable_link_manager() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { update_option( 'link_manager_enabled', 0 ); } } function pre_schema_upgrade() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 11557 ) { $wpdb->query( "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id" ); $wpdb->query( "ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)" ); $wpdb->query( "ALTER TABLE $wpdb->options DROP INDEX option_name" ); } if ( $wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables() ) { if ( $wp_current_db_version < 25179 ) { $wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" ); $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" ); } if ( $wp_current_db_version < 25448 ) { $wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'" ); $wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0" ); } } if ( $wp_current_db_version < 31351 ) { if ( ! is_multisite() && wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); } $wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" ); $wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX name, ADD INDEX name(name(191))" ); $wpdb->query( "ALTER TABLE $wpdb->commentmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))" ); } if ( $wp_current_db_version < 34978 ) { if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->termmeta}'" ) && $wpdb->get_results( "SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'" ) ) { $wpdb->query( "ALTER TABLE $wpdb->termmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); maybe_convert_table_to_utf8mb4( $wpdb->termmeta ); } } } if ( ! function_exists( 'install_global_terms' ) ) : function install_global_terms() { global $wpdb, $charset_collate; $ms_queries = " +CREATE TABLE $wpdb->sitecategories ( + cat_ID bigint(20) NOT NULL auto_increment, + cat_name varchar(55) NOT NULL default '', + category_nicename varchar(200) NOT NULL default '', + last_updated timestamp NOT NULL, + PRIMARY KEY (cat_ID), + KEY category_nicename (category_nicename), + KEY last_updated (last_updated) +) $charset_collate; +"; dbDelta( $ms_queries ); } endif; function wp_should_upgrade_global_tables() { if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { return false; } $should_upgrade = true; if ( ! is_main_network() ) { $should_upgrade = false; } if ( ! is_main_site() ) { $should_upgrade = false; } return apply_filters( 'wp_should_upgrade_global_tables', $should_upgrade ); } $this->_timeout, "usec"=>0))) { $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } return true; } function _connect($host, $port) { $this->SendMSG("Creating socket"); if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); return FALSE; } if(!$this->_settimeout($sock)) return FALSE; $this->SendMSG("Connecting to \"".$host.":".$port."\""); if (!($res = @socket_connect($sock, $host, $port))) { $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction,'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); } else { $this->_message.=$tmp; $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; $this->SendMSG("Creating data socket"); $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->_ftp_data_sock < 0) { $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock))); return FALSE; } if(!$this->_settimeout($this->_ftp_data_sock)) { $this->_data_close(); return FALSE; } if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } else $this->_ftp_temp_sock=$this->_ftp_data_sock; } else { if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { $this->PushError("_data_prepare","cannot get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); $this->_data_close(); return FALSE; } if(!@socket_bind($this->_ftp_data_sock,$addr)){ $this->PushError("_data_prepare","cannot bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!@socket_listen($this->_ftp_data_sock)) { $this->PushError("_data_prepare","cannot listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { $this->PushError("_data_prepare","cannot get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { $NewLine=$this->_eol_code[$this->OS_local]; if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); if($this->_ftp_temp_sock===FALSE) { $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return FALSE; } } while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) { if($block==="") break; if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { $NewLine=$this->_eol_code[$this->OS_local]; if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); if($this->_ftp_temp_sock===FALSE) { $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return false; } } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return true; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) { $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @socket_close($this->_ftp_temp_sock); @socket_close($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit() { if($this->_connected) { @socket_close($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?> +id ] ) ) { $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); } return $column_headers[ $screen->id ]; } function get_hidden_columns( $screen ) { if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $hidden = get_user_option( 'manage' . $screen->id . 'columnshidden' ); $use_defaults = ! is_array( $hidden ); if ( $use_defaults ) { $hidden = array(); $hidden = apply_filters( 'default_hidden_columns', $hidden, $screen ); } return apply_filters( 'hidden_columns', $hidden, $screen, $use_defaults ); } function meta_box_prefs( $screen ) { global $wp_meta_boxes; if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } if ( empty( $wp_meta_boxes[ $screen->id ] ) ) { return; } $hidden = get_hidden_meta_boxes( $screen ); foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { continue; } foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { if ( false === $box || ! $box['title'] ) { continue; } if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) { continue; } $widget_title = $box['title']; if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { $widget_title = $box['args']['__widget_basename']; } $is_hidden = in_array( $box['id'], $hidden, true ); printf( '', esc_attr( $box['id'] ), checked( $is_hidden, false, false ), $widget_title ); } } } } function get_hidden_meta_boxes( $screen ) { if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); $use_defaults = ! is_array( $hidden ); if ( $use_defaults ) { $hidden = array(); if ( 'post' === $screen->base ) { if ( in_array( $screen->post_type, array( 'post', 'page', 'attachment' ), true ) ) { $hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' ); } else { $hidden = array( 'slugdiv' ); } } $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen ); } return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); } function add_screen_option( $option, $args = array() ) { $current_screen = get_current_screen(); if ( ! $current_screen ) { return; } $current_screen->add_option( $option, $args ); } function get_current_screen() { global $current_screen; if ( ! isset( $current_screen ) ) { return null; } return $current_screen; } function set_current_screen( $hook_name = '' ) { WP_Screen::get( $hook_name )->set_current_screen(); } find_folder( ABSPATH ); if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { $folder = '/'; } return $folder; } public function wp_content_dir() { return $this->find_folder( WP_CONTENT_DIR ); } public function wp_plugins_dir() { return $this->find_folder( WP_PLUGIN_DIR ); } public function wp_themes_dir( $theme = false ) { $theme_root = get_theme_root( $theme ); if ( '/themes' === $theme_root || ! is_dir( $theme_root ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } return $this->find_folder( $theme_root ); } public function wp_lang_dir() { return $this->find_folder( WP_LANG_DIR ); } public function find_base_dir( $base = '.', $verbose = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' ); $this->verbose = $verbose; return $this->abspath(); } public function get_base_dir( $base = '.', $verbose = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' ); $this->verbose = $verbose; return $this->abspath(); } public function find_folder( $folder ) { if ( isset( $this->cache[ $folder ] ) ) { return $this->cache[ $folder ]; } if ( stripos( $this->method, 'ftp' ) !== false ) { $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR, 'FTP_LANG_DIR' => WP_LANG_DIR, ); foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; } if ( $folder === $dir ) { return trailingslashit( constant( $constant ) ); } } foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; } if ( 0 === stripos( $folder, $dir ) ) { $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); $potential_folder = trailingslashit( $potential_folder ); if ( $this->is_dir( $potential_folder ) ) { $this->cache[ $folder ] = $potential_folder; return $potential_folder; } } } } elseif ( 'direct' === $this->method ) { $folder = str_replace( '\\', '/', $folder ); return trailingslashit( $folder ); } $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); $folder = str_replace( '\\', '/', $folder ); if ( isset( $this->cache[ $folder ] ) ) { return $this->cache[ $folder ]; } if ( $this->exists( $folder ) ) { $folder = trailingslashit( $folder ); $this->cache[ $folder ] = $folder; return $folder; } $return = $this->search_for_folder( $folder ); if ( $return ) { $this->cache[ $folder ] = $return; } return $return; } public function search_for_folder( $folder, $base = '.', $loop = false ) { if ( empty( $base ) || '.' === $base ) { $base = trailingslashit( $this->cwd() ); } $folder = untrailingslashit( $folder ); if ( $this->verbose ) { printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "
      \n", $folder, $base ); } $folder_parts = explode( '/', $folder ); $folder_part_keys = array_keys( $folder_parts ); $last_index = array_pop( $folder_part_keys ); $last_path = $folder_parts[ $last_index ]; $files = $this->dirlist( $base ); foreach ( $folder_parts as $index => $key ) { if ( $index === $last_index ) { continue; } if ( isset( $files[ $key ] ) ) { $newdir = trailingslashit( path_join( $base, $key ) ); if ( $this->verbose ) { printf( "\n" . __( 'Changing to %s' ) . "
      \n", $newdir ); } $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); $ret = $this->search_for_folder( $newfolder, $newdir, $loop ); if ( $ret ) { return $ret; } } } if ( isset( $files[ $last_path ] ) ) { if ( $this->verbose ) { printf( "\n" . __( 'Found %s' ) . "
      \n", $base . $last_path ); } return trailingslashit( $base . $last_path ); } if ( $loop || '/' === $base ) { return false; } return $this->search_for_folder( $folder, '/', true ); } public function gethchmod( $file ) { $perms = intval( $this->getchmod( $file ), 8 ); if ( ( $perms & 0xC000 ) === 0xC000 ) { $info = 's'; } elseif ( ( $perms & 0xA000 ) === 0xA000 ) { $info = 'l'; } elseif ( ( $perms & 0x8000 ) === 0x8000 ) { $info = '-'; } elseif ( ( $perms & 0x6000 ) === 0x6000 ) { $info = 'b'; } elseif ( ( $perms & 0x4000 ) === 0x4000 ) { $info = 'd'; } elseif ( ( $perms & 0x2000 ) === 0x2000 ) { $info = 'c'; } elseif ( ( $perms & 0x1000 ) === 0x1000 ) { $info = 'p'; } else { $info = 'u'; } $info .= ( ( $perms & 0x0100 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0080 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0040 ) ? ( ( $perms & 0x0800 ) ? 's' : 'x' ) : ( ( $perms & 0x0800 ) ? 'S' : '-' ) ); $info .= ( ( $perms & 0x0020 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0010 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0008 ) ? ( ( $perms & 0x0400 ) ? 's' : 'x' ) : ( ( $perms & 0x0400 ) ? 'S' : '-' ) ); $info .= ( ( $perms & 0x0004 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0002 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0001 ) ? ( ( $perms & 0x0200 ) ? 't' : 'x' ) : ( ( $perms & 0x0200 ) ? 'T' : '-' ) ); return $info; } public function getchmod( $file ) { return '777'; } public function getnumchmodfromh( $mode ) { $realmode = ''; $legal = array( '', 'w', 'r', 'x', '-' ); $attarray = preg_split( '//', $mode ); for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { $key = array_search( $attarray[ $i ], $legal, true ); if ( $key ) { $realmode .= $legal[ $key ]; } } $mode = str_pad( $realmode, 10, '-', STR_PAD_LEFT ); $trans = array( '-' => '0', 'r' => '4', 'w' => '2', 'x' => '1', ); $mode = strtr( $mode, $trans ); $newmode = $mode[0]; $newmode .= $mode[1] + $mode[2] + $mode[3]; $newmode .= $mode[4] + $mode[5] + $mode[6]; $newmode .= $mode[7] + $mode[8] + $mode[9]; return $newmode; } public function is_binary( $text ) { return (bool) preg_match( '|[^\x20-\x7E]|', $text ); } public function chown( $file, $owner, $recursive = false ) { return false; } public function connect() { return true; } public function get_contents( $file ) { return false; } public function get_contents_array( $file ) { return false; } public function put_contents( $file, $contents, $mode = false ) { return false; } public function cwd() { return false; } public function chdir( $dir ) { return false; } public function chgrp( $file, $group, $recursive = false ) { return false; } public function chmod( $file, $mode = false, $recursive = false ) { return false; } public function owner( $file ) { return false; } public function group( $file ) { return false; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { return false; } public function move( $source, $destination, $overwrite = false ) { return false; } public function delete( $file, $recursive = false, $type = false ) { return false; } public function exists( $file ) { return false; } public function is_file( $file ) { return false; } public function is_dir( $path ) { return false; } public function is_readable( $file ) { return false; } public function is_writable( $file ) { return false; } public function atime( $file ) { return false; } public function mtime( $file ) { return false; } public function size( $file ) { return false; } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { return false; } public function rmdir( $path, $recursive = false ) { return false; } public function dirlist( $path, $include_hidden = true, $recursive = false ) { return false; } } no_update ) ) { foreach ( $plugin_info->no_update as $plugin ) { if ( isset( $plugin->slug ) ) { $plugin->upgrade = false; $plugins[ $plugin->slug ] = $plugin; } } } if ( isset( $plugin_info->response ) ) { foreach ( $plugin_info->response as $plugin ) { if ( isset( $plugin->slug ) ) { $plugin->upgrade = true; $plugins[ $plugin->slug ] = $plugin; } } } return $plugins; } protected function get_installed_plugin_slugs() { return array_keys( $this->get_installed_plugins() ); } public function prepare_items() { include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; global $tabs, $tab, $paged, $type, $term; wp_reset_vars( array( 'tab' ) ); $paged = $this->get_pagenum(); $per_page = 36; $tabs = array(); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); } $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); if ( current_user_can( 'upload_plugins' ) ) { $tabs['upload'] = __( 'Upload Plugin' ); } $nonmenu_tabs = array( 'plugin-information' ); $tabs = apply_filters( 'install_plugins_tabs', $tabs ); $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } $installed_plugins = $this->get_installed_plugins(); $args = array( 'page' => $paged, 'per_page' => $per_page, 'locale' => get_user_locale(), ); switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; switch ( $type ) { case 'tag': $args['tag'] = sanitize_title_with_dashes( $term ); break; case 'term': $args['search'] = $term; break; case 'author': $args['author'] = $term; break; } break; case 'featured': case 'popular': case 'new': case 'beta': $args['browse'] = $tab; break; case 'recommended': $args['browse'] = $tab; $args['installed_plugins'] = array_keys( $installed_plugins ); break; case 'favorites': $action = 'save_wporg_username_' . get_current_user_id(); if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); if ( ! isset( $_GET['save'] ) || $_GET['save'] ) { update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); } } else { $user = get_user_option( 'wporg_favorites' ); } if ( $user ) { $args['user'] = $user; } else { $args = false; } add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 ); break; default: $args = false; break; } $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args ); if ( ! $args ) { return; } $api = plugins_api( 'query_plugins', $args ); if ( is_wp_error( $api ) ) { $this->error = $api; return; } $this->items = $api->plugins; if ( $this->orderby ) { uasort( $this->items, array( $this, 'order_callback' ) ); } $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $args['per_page'], ) ); if ( isset( $api->info['groups'] ) ) { $this->groups = $api->info['groups']; } if ( $installed_plugins ) { $js_plugins = array_fill_keys( array( 'all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins' ), array() ); $js_plugins['all'] = array_values( wp_list_pluck( $installed_plugins, 'plugin' ) ); $upgrade_plugins = wp_filter_object_list( $installed_plugins, array( 'upgrade' => true ), 'and', 'plugin' ); if ( $upgrade_plugins ) { $js_plugins['upgrade'] = array_values( $upgrade_plugins ); } wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'plugins' => $js_plugins, 'totals' => wp_get_update_data(), ) ); } } public function no_items() { if ( isset( $this->error ) ) { ?> +

      error->get_error_message(); ?>

      +

      +
      + +
      + $text ) { $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; $href = self_admin_url( 'plugin-install.php?tab=' . $action ); $display_tabs[ 'plugin-install-' . $action ] = "$text"; } unset( $display_tabs['plugin-install-upload'] ); return $display_tabs; } public function views() { $views = $this->get_views(); $views = apply_filters( "views_{$this->screen->id}", $views ); $this->screen->render_screen_reader_content( 'heading_views' ); ?> +
      + -#customize-controls h3.theme-name { - font-size: 15px; -} - -#customize-controls .theme-overlay .theme-name { - font-size: 32px; -} - -.customize-preview-header.themes-filter-bar { - position: fixed; - top: 0; - left: 300px; - width: calc(100% - 300px); - height: 46px; - background: #f0f0f1; - z-index: 10; - padding: 6px 25px; - box-sizing: border-box; - border-bottom: 1px solid #dcdcde; -} + +
      + _args['singular']; $data_attr = ''; if ( $singular ) { $data_attr = " data-wp-lists='list:$singular'"; } $this->display_tablenav( 'top' ); ?> +
      + screen->render_screen_reader_content( 'heading_list' ); ?> +
      > + display_rows_or_placeholder(); ?> +
      +
      + display_tablenav( 'bottom' ); } protected function display_tablenav( $which ) { if ( 'featured' === $GLOBALS['tab'] ) { return; } if ( 'top' === $which ) { wp_referer_field(); ?> +
      +
      + +
      + pagination( $which ); ?> +
      +
      + +
      + pagination( $which ); ?> +
      +
      + _args['plural'] ); } public function get_columns() { return array(); } private function order_callback( $plugin_a, $plugin_b ) { $orderby = $this->orderby; if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) { return 0; } $a = $plugin_a->$orderby; $b = $plugin_b->$orderby; if ( $a === $b ) { return 0; } if ( 'DESC' === $this->order ) { return ( $a < $b ) ? 1 : -1; } else { return ( $a < $b ) ? -1 : 1; } } public function display_rows() { $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array(), ); $plugins_group_titles = array( 'Performance' => _x( 'Performance', 'Plugin installer group title' ), 'Social' => _x( 'Social', 'Plugin installer group title' ), 'Tools' => _x( 'Tools', 'Plugin installer group title' ), ); $group = null; foreach ( (array) $this->items as $plugin ) { if ( is_object( $plugin ) ) { $plugin = (array) $plugin; } if ( isset( $plugin['group'] ) && $plugin['group'] !== $group ) { if ( isset( $this->groups[ $plugin['group'] ] ) ) { $group_name = $this->groups[ $plugin['group'] ]; if ( isset( $plugins_group_titles[ $group_name ] ) ) { $group_name = $plugins_group_titles[ $group_name ]; } } else { $group_name = $plugin['group']; } if ( ! empty( $group ) ) { echo ''; } echo '

      ' . esc_html( $group_name ) . '

      '; echo '
      '; $group = $plugin['group']; } $title = wp_kses( $plugin['name'], $plugins_allowedtags ); $description = strip_tags( $plugin['short_description'] ); $description = apply_filters( 'plugin_install_description', $description, $plugin ); $version = wp_kses( $plugin['version'], $plugins_allowedtags ); $name = strip_tags( $title . ' ' . $version ); $author = wp_kses( $plugin['author'], $plugins_allowedtags ); if ( ! empty( $author ) ) { $author = ' ' . sprintf( __( 'By %s' ), $author ) . ''; } $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); $action_links = array(); if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { $status = install_plugin_install_status( $plugin ); switch ( $status['status'] ) { case 'install': if ( $status['url'] ) { if ( $compatible_php && $compatible_wp ) { $action_links[] = sprintf( '%s', esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Install Now' ) ); } else { $action_links[] = sprintf( '', _x( 'Cannot Install', 'plugin' ) ); } } break; case 'update_available': if ( $status['url'] ) { if ( $compatible_php && $compatible_wp ) { $action_links[] = sprintf( '%s', esc_attr( $status['file'] ), esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Update Now' ) ); } else { $action_links[] = sprintf( '', _x( 'Cannot Update', 'plugin' ) ); } } break; case 'latest_installed': case 'newer_installed': if ( is_plugin_active( $status['file'] ) ) { $action_links[] = sprintf( '', _x( 'Active', 'plugin' ) ); } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { if ( $compatible_php && $compatible_wp ) { $button_text = __( 'Activate' ); $button_label = _x( 'Activate %s', 'plugin' ); $activate_url = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 'action' => 'activate', 'plugin' => $status['file'], ), network_admin_url( 'plugins.php' ) ); if ( is_network_admin() ) { $button_text = __( 'Network Activate' ); $button_label = _x( 'Network Activate %s', 'plugin' ); $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); } $action_links[] = sprintf( '%3$s', esc_url( $activate_url ), esc_attr( sprintf( $button_label, $plugin['name'] ) ), $button_text ); } else { $action_links[] = sprintf( '', _x( 'Cannot Activate', 'plugin' ) ); } } else { $action_links[] = sprintf( '', _x( 'Installed', 'plugin' ) ); } break; } } $details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550' ); $action_links[] = sprintf( '%s', esc_url( $details_link ), esc_attr( sprintf( __( 'More information about %s' ), $name ) ), esc_attr( $name ), __( 'More Details' ) ); if ( ! empty( $plugin['icons']['svg'] ) ) { $plugin_icon_url = $plugin['icons']['svg']; } elseif ( ! empty( $plugin['icons']['2x'] ) ) { $plugin_icon_url = $plugin['icons']['2x']; } elseif ( ! empty( $plugin['icons']['1x'] ) ) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); $last_updated_timestamp = strtotime( $plugin['last_updated'] ); ?> +
      +

      '; if ( ! $compatible_php && ! $compatible_wp ) { _e( 'This plugin does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } } elseif ( ! $compatible_wp ) { _e( 'This plugin does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { _e( 'This plugin does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } } echo '

      '; } ?> +
      +
      +

      + + + + +

      +
      + +
      +

      +

      +
      +
      +
      +
      + $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'], ) ); ?> + +
      +
      + + +
      +
      + = 1000000 ) { $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); $active_installs_text = sprintf( _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), number_format_i18n( $active_installs_millions ) ); } elseif ( 0 === $plugin['active_installs'] ) { $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' ); } else { $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; } printf( __( '%s Active Installations' ), $active_installs_text ); ?> +
      +
      + ' . __( 'Untested with your version of WordPress' ) . ''; } elseif ( ! $compatible_wp ) { echo '' . __( 'Incompatible with your version of WordPress' ) . ''; } else { echo '' . __( 'Compatible with your version of WordPress' ) . ''; } ?> +
      +
      +
      +
      '; } } } $sub ) { foreach ( $sub as $index => $data ) { if ( ! current_user_can( $data[1] ) ) { unset( $submenu[ $parent ][ $index ] ); $_wp_submenu_nopriv[ $parent ][ $data[2] ] = true; } } unset( $index, $data ); if ( empty( $submenu[ $parent ] ) ) { unset( $submenu[ $parent ] ); } } unset( $sub, $parent ); foreach ( $menu as $id => $data ) { if ( empty( $submenu[ $data[2] ] ) ) { continue; } $subs = $submenu[ $data[2] ]; $first_sub = reset( $subs ); $old_parent = $data[2]; $new_parent = $first_sub[2]; if ( $new_parent != $old_parent ) { $_wp_real_parent_file[ $old_parent ] = $new_parent; $menu[ $id ][2] = $new_parent; foreach ( $submenu[ $old_parent ] as $index => $data ) { $submenu[ $new_parent ][ $index ] = $submenu[ $old_parent ][ $index ]; unset( $submenu[ $old_parent ][ $index ] ); } unset( $submenu[ $old_parent ], $index ); if ( isset( $_wp_submenu_nopriv[ $old_parent ] ) ) { $_wp_submenu_nopriv[ $new_parent ] = $_wp_submenu_nopriv[ $old_parent ]; } } } unset( $id, $data, $subs, $first_sub, $old_parent, $new_parent ); if ( is_network_admin() ) { do_action( 'network_admin_menu', '' ); } elseif ( is_user_admin() ) { do_action( 'user_admin_menu', '' ); } else { do_action( 'admin_menu', '' ); } foreach ( $menu as $id => $data ) { if ( ! current_user_can( $data[1] ) ) { $_wp_menu_nopriv[ $data[2] ] = true; } if ( ! empty( $submenu[ $data[2] ] ) && 1 === count( $submenu[ $data[2] ] ) ) { $subs = $submenu[ $data[2] ]; $first_sub = reset( $subs ); if ( $data[2] == $first_sub[2] ) { unset( $submenu[ $data[2] ] ); } } if ( empty( $submenu[ $data[2] ] ) ) { if ( isset( $_wp_menu_nopriv[ $data[2] ] ) ) { unset( $menu[ $id ] ); } } } unset( $id, $data, $subs, $first_sub ); function add_cssclass( $class_to_add, $classes ) { if ( empty( $classes ) ) { return $class_to_add; } return $classes . ' ' . $class_to_add; } function add_menu_classes( $menu ) { $first_item = false; $last_order = false; $items_count = count( $menu ); $i = 0; foreach ( $menu as $order => $top ) { $i++; if ( 0 == $order ) { $menu[0][4] = add_cssclass( 'menu-top-first', $top[4] ); $last_order = 0; continue; } if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { $first_item = true; $classes = $menu[ $last_order ][4]; $menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes ); continue; } if ( $first_item ) { $classes = $menu[ $order ][4]; $menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes ); $first_item = false; } if ( $i == $items_count ) { $classes = $menu[ $order ][4]; $menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes ); } $last_order = $order; } return apply_filters( 'add_menu_classes', $menu ); } uksort( $menu, 'strnatcasecmp' ); if ( apply_filters( 'custom_menu_order', false ) ) { $menu_order = array(); foreach ( $menu as $menu_item ) { $menu_order[] = $menu_item[2]; } unset( $menu_item ); $default_menu_order = $menu_order; $menu_order = apply_filters( 'menu_order', $menu_order ); $menu_order = array_flip( $menu_order ); $default_menu_order = array_flip( $default_menu_order ); function sort_menu( $a, $b ) { global $menu_order, $default_menu_order; $a = $a[2]; $b = $b[2]; if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) { return -1; } elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { return 1; } elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { if ( $menu_order[ $a ] == $menu_order[ $b ] ) { return 0; } return ( $menu_order[ $a ] < $menu_order[ $b ] ) ? -1 : 1; } else { return ( $default_menu_order[ $a ] <= $default_menu_order[ $b ] ) ? -1 : 1; } } usort( $menu, 'sort_menu' ); unset( $menu_order, $default_menu_order ); } $prev_menu_was_separator = false; foreach ( $menu as $id => $data ) { if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { $prev_menu_was_separator = false; } else { if ( true === $prev_menu_was_separator ) { unset( $menu[ $id ] ); } $prev_menu_was_separator = true; } } unset( $id, $data, $prev_menu_was_separator ); $last_menu_key = array_keys( $menu ); $last_menu_key = array_pop( $last_menu_key ); if ( ! empty( $menu ) && 'wp-menu-separator' === $menu[ $last_menu_key ][4] ) { unset( $menu[ $last_menu_key ] ); } unset( $last_menu_key ); if ( ! user_can_access_admin_page() ) { do_action( 'admin_page_access_denied' ); wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $menu = add_menu_classes( $menu ); $_GET['list_args']['screen']['id'] ) ); if ( ! $wp_list_table ) { wp_die( 0 ); } if ( ! $wp_list_table->ajax_user_can() ) { wp_die( -1 ); } $wp_list_table->ajax_response(); wp_die( 0 ); } function wp_ajax_ajax_tag_search() { if ( ! isset( $_GET['tax'] ) ) { wp_die( 0 ); } $taxonomy = sanitize_key( $_GET['tax'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! current_user_can( $tax->cap->assign_terms ) ) { wp_die( -1 ); } $s = wp_unslash( $_GET['q'] ); $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $s = str_replace( $comma, ',', $s ); } if ( false !== strpos( $s, ',' ) ) { $s = explode( ',', $s ); $s = $s[ count( $s ) - 1 ]; } $s = trim( $s ); $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s ); if ( ( 0 == $term_search_min_chars ) || ( strlen( $s ) < $term_search_min_chars ) ) { wp_die(); } $results = get_terms( array( 'taxonomy' => $taxonomy, 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false, 'number' => isset( $_GET['number'] ) ? (int) $_GET['number'] : 0, ) ); echo implode( "\n", $results ); wp_die(); } function wp_ajax_wp_compression_test() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( -1 ); } if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) { update_site_option( 'can_compress_scripts', 0 ); wp_die( 0 ); } if ( isset( $_GET['test'] ) ) { header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); header( 'Content-Type: application/javascript; charset=UTF-8' ); $force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ); $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; if ( 1 == $_GET['test'] ) { echo $test_str; wp_die(); } elseif ( 2 == $_GET['test'] ) { if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { wp_die( -1 ); } if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) { header( 'Content-Encoding: deflate' ); $out = gzdeflate( $test_str, 1 ); } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) { header( 'Content-Encoding: gzip' ); $out = gzencode( $test_str, 1 ); } else { wp_die( -1 ); } echo $out; wp_die(); } elseif ( 'no' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 0 ); } elseif ( 'yes' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 1 ); } } wp_die( 0 ); } function wp_ajax_imgedit_preview() { $post_id = (int) $_GET['postid']; if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$post_id" ); include_once ABSPATH . 'wp-admin/includes/image-edit.php'; if ( ! stream_preview_image( $post_id ) ) { wp_die( -1 ); } wp_die(); } function wp_ajax_oembed_cache() { $GLOBALS['wp_embed']->cache_oembed( $_GET['post'] ); wp_die( 0 ); } function wp_ajax_autocomplete_user() { if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) ) { wp_die( -1 ); } if ( ! current_user_can( 'manage_network_users' ) && ! apply_filters( 'autocomplete_users_for_site_admins', false ) ) { wp_die( -1 ); } $return = array(); if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) { $type = $_REQUEST['autocomplete_type']; } else { $type = 'add'; } if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) { $field = $_REQUEST['autocomplete_field']; } else { $field = 'user_login'; } if ( isset( $_REQUEST['site_id'] ) ) { $id = absint( $_REQUEST['site_id'] ); } else { $id = get_current_blog_id(); } $include_blog_users = ( 'search' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', ) ) : array() ); $exclude_blog_users = ( 'add' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', ) ) : array() ); $users = get_users( array( 'blog_id' => false, 'search' => '*' . $_REQUEST['term'] . '*', 'include' => $include_blog_users, 'exclude' => $exclude_blog_users, 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), ) ); foreach ( $users as $user ) { $return[] = array( 'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result' ), $user->user_login, $user->user_email ), 'value' => $user->$field, ); } wp_die( wp_json_encode( $return ) ); } function wp_ajax_get_community_events() { require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php'; check_ajax_referer( 'community_events' ); $search = isset( $_POST['location'] ) ? wp_unslash( $_POST['location'] ) : ''; $timezone = isset( $_POST['timezone'] ) ? wp_unslash( $_POST['timezone'] ) : ''; $user_id = get_current_user_id(); $saved_location = get_user_option( 'community-events-location', $user_id ); $events_client = new WP_Community_Events( $user_id, $saved_location ); $events = $events_client->get_events( $search, $timezone ); $ip_changed = false; if ( is_wp_error( $events ) ) { wp_send_json_error( array( 'error' => $events->get_error_message(), ) ); } else { if ( empty( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) ) { $ip_changed = true; } elseif ( isset( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) && $saved_location['ip'] !== $events['location']['ip'] ) { $ip_changed = true; } if ( $ip_changed || $search ) { update_user_meta( $user_id, 'community-events-location', $events['location'] ); } wp_send_json_success( $events ); } } function wp_ajax_dashboard_widgets() { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; $pagenow = $_GET['pagenow']; if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) { set_current_screen( $pagenow ); } switch ( $_GET['widget'] ) { case 'dashboard_primary': wp_dashboard_primary(); break; } wp_die(); } function wp_ajax_logged_in() { wp_die( 1 ); } function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { $total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0; $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0; $page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0; $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; if ( ! $total || ! $per_page || ! $page || ! $url ) { $time = time(); $comment = get_comment( $comment_id ); $comment_status = ''; $comment_link = ''; if ( $comment ) { $comment_status = $comment->comment_approved; } if ( 1 === (int) $comment_status ) { $comment_link = get_comment_link( $comment ); } $counts = wp_count_comments(); $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $comment_id, 'supplemental' => array( 'status' => $comment_status, 'postId' => $comment ? $comment->comment_post_ID : '', 'time' => $time, 'in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf( _n( '%s Comment', '%s Comments', $counts->approved ), number_format_i18n( $counts->approved ) ), 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), 'comment_link' => $comment_link, ), ) ); $x->send(); } $total += $delta; if ( $total < 0 ) { $total = 0; } if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { $post_id = 0; $status = 'all'; $parsed = parse_url( $url ); if ( isset( $parsed['query'] ) ) { parse_str( $parsed['query'], $query_vars ); if ( ! empty( $query_vars['comment_status'] ) ) { $status = $query_vars['comment_status']; } if ( ! empty( $query_vars['p'] ) ) { $post_id = (int) $query_vars['p']; } if ( ! empty( $query_vars['comment_type'] ) ) { $type = $query_vars['comment_type']; } } if ( empty( $type ) ) { $comment_count = wp_count_comments( $post_id ); if ( isset( $comment_count->$status ) ) { $total = $comment_count->$status; } } } $time = time(); $comment = get_comment( $comment_id ); $counts = wp_count_comments(); $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $comment_id, 'supplemental' => array( 'status' => $comment ? $comment->comment_approved : '', 'postId' => $comment ? $comment->comment_post_ID : '', 'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ), 'total_pages' => ceil( $total / $per_page ), 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), 'total' => $total, 'time' => $time, 'in_moderation' => $counts->moderated, 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), ), ) ); $x->send(); } function _wp_ajax_add_hierarchical_term() { $action = $_POST['action']; $taxonomy = get_taxonomy( substr( $action, 4 ) ); check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name ); if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) { wp_die( -1 ); } $names = explode( ',', $_POST[ 'new' . $taxonomy->name ] ); $parent = isset( $_POST[ 'new' . $taxonomy->name . '_parent' ] ) ? (int) $_POST[ 'new' . $taxonomy->name . '_parent' ] : 0; if ( 0 > $parent ) { $parent = 0; } if ( 'category' === $taxonomy->name ) { $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array(); } else { $post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array(); } $checked_categories = array_map( 'absint', (array) $post_category ); $popular_ids = wp_popular_terms_checklist( $taxonomy->name, 0, 10, false ); foreach ( $names as $cat_name ) { $cat_name = trim( $cat_name ); $category_nicename = sanitize_title( $cat_name ); if ( '' === $category_nicename ) { continue; } $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); if ( ! $cat_id || is_wp_error( $cat_id ) ) { continue; } else { $cat_id = $cat_id['term_id']; } $checked_categories[] = $cat_id; if ( $parent ) { continue; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $cat_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } if ( $parent ) { $parent = get_term( $parent, $taxonomy->name ); $term_id = $parent->term_id; while ( $parent->parent ) { $parent = get_term( $parent->parent, $taxonomy->name ); if ( is_wp_error( $parent ) ) { break; } $term_id = $parent->term_id; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $term_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } ob_start(); wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', ) ); $sup = ob_get_clean(); $add['supplemental'] = array( 'newcat_parent' => $sup ); $x = new WP_Ajax_Response( $add ); $x->send(); } function wp_ajax_delete_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; $comment = get_comment( $id ); if ( ! $comment ) { wp_die( time() ); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { wp_die( -1 ); } check_ajax_referer( "delete-comment_$id" ); $status = wp_get_comment_status( $comment ); $delta = -1; if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) { if ( 'trash' === $status ) { wp_die( time() ); } $r = wp_trash_comment( $comment ); } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) { if ( 'trash' !== $status ) { wp_die( time() ); } $r = wp_untrash_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { if ( 'spam' === $status ) { wp_die( time() ); } $r = wp_spam_comment( $comment ); } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) { if ( 'spam' !== $status ) { wp_die( time() ); } $r = wp_unspam_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { $r = wp_delete_comment( $comment ); } else { wp_die( -1 ); } if ( $r ) { _wp_ajax_delete_comment_response( $comment->comment_ID, $delta ); } wp_die( 0 ); } function wp_ajax_delete_tag() { $tag_id = (int) $_POST['tag_ID']; check_ajax_referer( "delete-tag_$tag_id" ); if ( ! current_user_can( 'delete_term', $tag_id ) ) { wp_die( -1 ); } $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag'; $tag = get_term( $tag_id, $taxonomy ); if ( ! $tag || is_wp_error( $tag ) ) { wp_die( 1 ); } if ( wp_delete_term( $tag_id, $taxonomy ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_delete_link() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "delete-bookmark_$id" ); if ( ! current_user_can( 'manage_links' ) ) { wp_die( -1 ); } $link = get_bookmark( $id ); if ( ! $link || is_wp_error( $link ) ) { wp_die( 1 ); } if ( wp_delete_link( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_delete_meta() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "delete-meta_$id" ); $meta = get_metadata_by_mid( 'post', $id ); if ( ! $meta ) { wp_die( 1 ); } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $meta->post_id, $meta->meta_key ) ) { wp_die( -1 ); } if ( delete_meta( $meta->meta_id ) ) { wp_die( 1 ); } wp_die( 0 ); } function wp_ajax_delete_post( $action ) { if ( empty( $action ) ) { $action = 'delete-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( wp_delete_post( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_trash_post( $action ) { if ( empty( $action ) ) { $action = 'trash-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( 'trash-post' === $action ) { $done = wp_trash_post( $id ); } else { $done = wp_untrash_post( $id ); } if ( $done ) { wp_die( 1 ); } wp_die( 0 ); } function wp_ajax_untrash_post( $action ) { if ( empty( $action ) ) { $action = 'untrash-post'; } wp_ajax_trash_post( $action ); } function wp_ajax_delete_page( $action ) { if ( empty( $action ) ) { $action = 'delete-page'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_page', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( wp_delete_post( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_dim_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; $comment = get_comment( $id ); if ( ! $comment ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => new WP_Error( 'invalid_comment', sprintf( __( 'Comment %d does not exist' ), $id ) ), ) ); $x->send(); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) ) { wp_die( -1 ); } $current = wp_get_comment_status( $comment ); if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) { wp_die( time() ); } check_ajax_referer( "approve-comment_$id" ); if ( in_array( $current, array( 'unapproved', 'spam' ), true ) ) { $result = wp_set_comment_status( $comment, 'approve', true ); } else { $result = wp_set_comment_status( $comment, 'hold', true ); } if ( is_wp_error( $result ) ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $result, ) ); $x->send(); } _wp_ajax_delete_comment_response( $comment->comment_ID ); wp_die( 0 ); } function wp_ajax_add_link_category( $action ) { if ( empty( $action ) ) { $action = 'add-link-category'; } check_ajax_referer( $action ); $tax = get_taxonomy( 'link_category' ); if ( ! current_user_can( $tax->cap->manage_terms ) ) { wp_die( -1 ); } $names = explode( ',', wp_unslash( $_POST['newcat'] ) ); $x = new WP_Ajax_Response(); foreach ( $names as $cat_name ) { $cat_name = trim( $cat_name ); $slug = sanitize_title( $cat_name ); if ( '' === $slug ) { continue; } $cat_id = wp_insert_term( $cat_name, 'link_category' ); if ( ! $cat_id || is_wp_error( $cat_id ) ) { continue; } else { $cat_id = $cat_id['term_id']; } $cat_name = esc_html( $cat_name ); $x->add( array( 'what' => 'link-category', 'id' => $cat_id, 'data' => "", 'position' => -1, ) ); } $x->send(); } function wp_ajax_add_tag() { check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag'; $tax = get_taxonomy( $taxonomy ); if ( ! current_user_can( $tax->cap->edit_terms ) ) { wp_die( -1 ); } $x = new WP_Ajax_Response(); $tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); if ( $tag && ! is_wp_error( $tag ) ) { $tag = get_term( $tag['term_id'], $taxonomy ); } if ( ! $tag || is_wp_error( $tag ) ) { $message = __( 'An error has occurred. Please reload the page and try again.' ); $error_code = 'error'; if ( is_wp_error( $tag ) && $tag->get_error_message() ) { $message = $tag->get_error_message(); } if ( is_wp_error( $tag ) && $tag->get_error_code() ) { $error_code = $tag->get_error_code(); } $x->add( array( 'what' => 'taxonomy', 'data' => new WP_Error( $error_code, $message ), ) ); $x->send(); } $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) ); $level = 0; $noparents = ''; if ( is_taxonomy_hierarchical( $taxonomy ) ) { $level = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); ob_start(); $wp_list_table->single_row( $tag, $level ); $noparents = ob_get_clean(); } ob_start(); $wp_list_table->single_row( $tag ); $parents = ob_get_clean(); require ABSPATH . 'wp-admin/includes/edit-tag-messages.php'; $message = ''; if ( isset( $messages[ $tax->name ][1] ) ) { $message = $messages[ $tax->name ][1]; } elseif ( isset( $messages['_item'][1] ) ) { $message = $messages['_item'][1]; } $x->add( array( 'what' => 'taxonomy', 'data' => $message, 'supplemental' => array( 'parents' => $parents, 'noparents' => $noparents, 'notice' => $message, ), ) ); $x->add( array( 'what' => 'term', 'position' => $level, 'supplemental' => (array) $tag, ) ); $x->send(); } function wp_ajax_get_tagcloud() { if ( ! isset( $_POST['tax'] ) ) { wp_die( 0 ); } $taxonomy = sanitize_key( $_POST['tax'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! current_user_can( $tax->cap->assign_terms ) ) { wp_die( -1 ); } $tags = get_terms( array( 'taxonomy' => $taxonomy, 'number' => 45, 'orderby' => 'count', 'order' => 'DESC', ) ); if ( empty( $tags ) ) { wp_die( $tax->labels->not_found ); } if ( is_wp_error( $tags ) ) { wp_die( $tags->get_error_message() ); } foreach ( $tags as $key => $tag ) { $tags[ $key ]->link = '#'; $tags[ $key ]->id = $tag->term_id; } $return = wp_generate_tag_cloud( $tags, array( 'filter' => 0, 'format' => 'list', ) ); if ( empty( $return ) ) { wp_die( 0 ); } echo $return; wp_die(); } function wp_ajax_get_comments( $action ) { global $post_id; if ( empty( $action ) ) { $action = 'get-comments'; } check_ajax_referer( $action ); if ( empty( $post_id ) && ! empty( $_REQUEST['p'] ) ) { $id = absint( $_REQUEST['p'] ); if ( ! empty( $id ) ) { $post_id = $id; } } if ( empty( $post_id ) ) { wp_die( -1 ); } $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } $wp_list_table->prepare_items(); if ( ! $wp_list_table->has_items() ) { wp_die( 1 ); } $x = new WP_Ajax_Response(); ob_start(); foreach ( $wp_list_table->items as $comment ) { if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && 0 === $comment->comment_approved ) { continue; } get_comment( $comment ); $wp_list_table->single_row( $comment ); } $comment_list_item = ob_get_clean(); $x->add( array( 'what' => 'comments', 'data' => $comment_list_item, ) ); $x->send(); } function wp_ajax_replyto_comment( $action ) { if ( empty( $action ) ) { $action = 'replyto-comment'; } check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); $comment_post_ID = (int) $_POST['comment_post_ID']; $post = get_post( $comment_post_ID ); if ( ! $post ) { wp_die( -1 ); } if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) { wp_die( -1 ); } if ( empty( $post->post_status ) ) { wp_die( 1 ); } elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) { wp_die( __( 'You cannot reply to a comment on a draft post.' ) ); } $user = wp_get_current_user(); if ( $user->exists() ) { $user_ID = $user->ID; $comment_author = wp_slash( $user->display_name ); $comment_author_email = wp_slash( $user->user_email ); $comment_author_url = wp_slash( $user->user_url ); $comment_content = trim( $_POST['content'] ); $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment'; if ( current_user_can( 'unfiltered_html' ) ) { if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) { $_POST['_wp_unfiltered_html_comment'] = ''; } if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); kses_init_filters(); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); add_filter( 'pre_comment_content', 'wp_filter_kses' ); } } } else { wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) ); } if ( '' === $comment_content ) { wp_die( __( 'Please type your comment text.' ) ); } $comment_parent = 0; if ( isset( $_POST['comment_ID'] ) ) { $comment_parent = absint( $_POST['comment_ID'] ); } $comment_auto_approved = false; $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); if ( ! empty( $_POST['approve_parent'] ) ) { $parent = get_comment( $comment_parent ); if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_ID ) { if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { wp_die( -1 ); } if ( wp_set_comment_status( $parent, 'approve' ) ) { $comment_auto_approved = true; } } } $comment_id = wp_new_comment( $commentdata ); if ( is_wp_error( $comment_id ) ) { wp_die( $comment_id->get_error_message() ); } $comment = get_comment( $comment_id ); if ( ! $comment ) { wp_die( 1 ); } $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; ob_start(); if ( isset( $_REQUEST['mode'] ) && 'dashboard' === $_REQUEST['mode'] ) { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; _wp_dashboard_recent_comments_row( $comment ); } else { if ( isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); } $wp_list_table->single_row( $comment ); } $comment_list_item = ob_get_clean(); $response = array( 'what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position, ); $counts = wp_count_comments(); $response['supplemental'] = array( 'in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf( _n( '%s Comment', '%s Comments', $counts->approved ), number_format_i18n( $counts->approved ) ), 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), ); if ( $comment_auto_approved ) { $response['supplemental']['parent_approved'] = $parent->comment_ID; $response['supplemental']['parent_post_id'] = $parent->comment_post_ID; } $x = new WP_Ajax_Response(); $x->add( $response ); $x->send(); } function wp_ajax_edit_comment() { check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); $comment_id = (int) $_POST['comment_ID']; if ( ! current_user_can( 'edit_comment', $comment_id ) ) { wp_die( -1 ); } if ( '' === $_POST['content'] ) { wp_die( __( 'Please type your comment text.' ) ); } if ( isset( $_POST['status'] ) ) { $_POST['comment_status'] = $_POST['status']; } $updated = edit_comment(); if ( is_wp_error( $updated ) ) { wp_die( $updated->get_error_message() ); } $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0; $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); $comment = get_comment( $comment_id ); if ( empty( $comment->comment_ID ) ) { wp_die( -1 ); } ob_start(); $wp_list_table->single_row( $comment ); $comment_list_item = ob_get_clean(); $x = new WP_Ajax_Response(); $x->add( array( 'what' => 'edit_comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position, ) ); $x->send(); } function wp_ajax_add_menu_item() { check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; $menu_items_data = array(); foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { if ( ! empty( $menu_item_data['menu-item-type'] ) && 'custom' !== $menu_item_data['menu-item-type'] && ! empty( $menu_item_data['menu-item-object-id'] ) ) { switch ( $menu_item_data['menu-item-type'] ) { case 'post_type': $_object = get_post( $menu_item_data['menu-item-object-id'] ); break; case 'post_type_archive': $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); break; case 'taxonomy': $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); break; } $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); $_menu_item = reset( $_menu_items ); $menu_item_data['menu-item-description'] = $_menu_item->description; } $menu_items_data[] = $menu_item_data; } $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); if ( is_wp_error( $item_ids ) ) { wp_die( 0 ); } $menu_items = array(); foreach ( (array) $item_ids as $menu_item_id ) { $menu_obj = get_post( $menu_item_id ); if ( ! empty( $menu_obj->ID ) ) { $menu_obj = wp_setup_nav_menu_item( $menu_obj ); $menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title; $menu_obj->label = $menu_obj->title; $menu_items[] = $menu_obj; } } $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] ); if ( ! class_exists( $walker_class_name ) ) { wp_die( 0 ); } if ( ! empty( $menu_items ) ) { $args = array( 'after' => '', 'before' => '', 'link_after' => '', 'link_before' => '', 'walker' => new $walker_class_name, ); echo walk_nav_menu_tree( $menu_items, 0, (object) $args ); } wp_die(); } function wp_ajax_add_meta() { check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' ); $c = 0; $pid = (int) $_POST['post_id']; $post = get_post( $pid ); if ( isset( $_POST['metakeyselect'] ) || isset( $_POST['metakeyinput'] ) ) { if ( ! current_user_can( 'edit_post', $pid ) ) { wp_die( -1 ); } if ( isset( $_POST['metakeyselect'] ) && '#NONE#' === $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) { wp_die( 1 ); } if ( 'auto-draft' === $post->post_status ) { $post_data = array(); $post_data['action'] = 'draft'; $post_data['post_ID'] = $pid; $post_data['post_type'] = $post->post_type; $post_data['post_status'] = 'draft'; $now = time(); $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) ); $pid = edit_post( $post_data ); if ( $pid ) { if ( is_wp_error( $pid ) ) { $x = new WP_Ajax_Response( array( 'what' => 'meta', 'data' => $pid, ) ); $x->send(); } $mid = add_meta( $pid ); if ( ! $mid ) { wp_die( __( 'Please provide a custom field value.' ) ); } } else { wp_die( 0 ); } } else { $mid = add_meta( $pid ); if ( ! $mid ) { wp_die( __( 'Please provide a custom field value.' ) ); } } $meta = get_metadata_by_mid( 'post', $mid ); $pid = (int) $meta->post_id; $meta = get_object_vars( $meta ); $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'data' => _list_meta_row( $meta, $c ), 'position' => 1, 'supplemental' => array( 'postid' => $pid ), ) ); } else { $mid = (int) key( $_POST['meta'] ); $key = wp_unslash( $_POST['meta'][ $mid ]['key'] ); $value = wp_unslash( $_POST['meta'][ $mid ]['value'] ); if ( '' === trim( $key ) ) { wp_die( __( 'Please provide a custom field name.' ) ); } $meta = get_metadata_by_mid( 'post', $mid ); if ( ! $meta ) { wp_die( 0 ); } if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) || ! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) || ! current_user_can( 'edit_post_meta', $meta->post_id, $key ) ) { wp_die( -1 ); } if ( $meta->meta_value != $value || $meta->meta_key != $key ) { $u = update_metadata_by_mid( 'post', $mid, $value, $key ); if ( ! $u ) { wp_die( 0 ); } } $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'old_id' => $mid, 'data' => _list_meta_row( array( 'meta_key' => $key, 'meta_value' => $value, 'meta_id' => $mid, ), $c ), 'position' => 0, 'supplemental' => array( 'postid' => $meta->post_id ), ) ); } $x->send(); } function wp_ajax_add_user( $action ) { if ( empty( $action ) ) { $action = 'add-user'; } check_ajax_referer( $action ); if ( ! current_user_can( 'create_users' ) ) { wp_die( -1 ); } $user_id = edit_user(); if ( ! $user_id ) { wp_die( 0 ); } elseif ( is_wp_error( $user_id ) ) { $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, ) ); $x->send(); } $user_object = get_userdata( $user_id ); $wp_list_table = _get_list_table( 'WP_Users_List_Table' ); $role = current( $user_object->roles ); $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, 'data' => $wp_list_table->single_row( $user_object, '', $role ), 'supplemental' => array( 'show-link' => sprintf( __( 'User %s added' ), '' . $user_object->user_login . '' ), 'role' => $role, ), ) ); $x->send(); } function wp_ajax_closed_postboxes() { check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); $closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed'] ) : array(); $closed = array_filter( $closed ); $hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array(); $hidden = array_filter( $hidden ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } if ( is_array( $closed ) ) { update_user_meta( $user->ID, "closedpostboxes_$page", $closed ); } if ( is_array( $hidden ) ) { $hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) ); update_user_meta( $user->ID, "metaboxhidden_$page", $hidden ); } wp_die( 1 ); } function wp_ajax_hidden_columns() { check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } $hidden = ! empty( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array(); update_user_meta( $user->ID, "manage{$page}columnshidden", $hidden ); wp_die( 1 ); } function wp_ajax_update_welcome_panel() { check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 ); wp_die( 1 ); } function wp_ajax_menu_get_metabox() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; if ( isset( $_POST['item-type'] ) && 'post_type' === $_POST['item-type'] ) { $type = 'posttype'; $callback = 'wp_nav_menu_item_post_type_meta_box'; $items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' === $_POST['item-type'] ) { $type = 'taxonomy'; $callback = 'wp_nav_menu_item_taxonomy_meta_box'; $items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' ); } if ( ! empty( $_POST['item-object'] ) && isset( $items[ $_POST['item-object'] ] ) ) { $menus_meta_box_object = $items[ $_POST['item-object'] ]; $item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_object ); $box_args = array( 'id' => 'add-' . $item->name, 'title' => $item->labels->name, 'callback' => $callback, 'args' => $item, ); ob_start(); $callback( null, $box_args ); $markup = ob_get_clean(); echo wp_json_encode( array( 'replace-id' => $type . '-' . $item->name, 'markup' => $markup, ) ); } wp_die(); } function wp_ajax_wp_link_ajax() { check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' ); $args = array(); if ( isset( $_POST['search'] ) ) { $args['s'] = wp_unslash( $_POST['search'] ); } if ( isset( $_POST['term'] ) ) { $args['s'] = wp_unslash( $_POST['term'] ); } $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } $results = _WP_Editors::wp_link_query( $args ); if ( ! isset( $results ) ) { wp_die( 0 ); } echo wp_json_encode( $results ); echo "\n"; wp_die(); } function wp_ajax_menu_locations_save() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( ! isset( $_POST['menu-locations'] ) ) { wp_die( 0 ); } set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) ); wp_die( 1 ); } function wp_ajax_meta_box_order() { check_ajax_referer( 'meta-box-order' ); $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; if ( 'auto' !== $page_columns ) { $page_columns = (int) $page_columns; } $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } if ( $order ) { update_user_meta( $user->ID, "meta-box-order_$page", $order ); } if ( $page_columns ) { update_user_meta( $user->ID, "screen_layout_$page", $page_columns ); } wp_send_json_success(); } function wp_ajax_menu_quick_search() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; _wp_ajax_menu_quick_search( $_POST ); wp_die(); } function wp_ajax_get_permalink() { check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; wp_die( get_preview_post_link( $post_id ) ); } function wp_ajax_sample_permalink() { check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; $title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : ''; $slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null; wp_die( get_sample_permalink_html( $post_id, $title, $slug ) ); } function wp_ajax_inline_save() { global $mode; check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) { wp_die(); } $post_ID = (int) $_POST['post_ID']; if ( 'page' === $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } } else { if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } } $last = wp_check_post_lock( $post_ID ); if ( $last ) { $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); $msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); if ( 'page' === $_POST['post_type'] ) { $msg_template = __( 'Saving is disabled: %s is currently editing this page.' ); } printf( $msg_template, esc_html( $last_user_name ) ); wp_die(); } $data = &$_POST; $post = get_post( $post_ID, ARRAY_A ); $post = wp_slash( $post ); $data['content'] = $post['post_content']; $data['excerpt'] = $post['post_excerpt']; $data['user_ID'] = get_current_user_id(); if ( isset( $data['post_parent'] ) ) { $data['parent_id'] = $data['post_parent']; } if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) { $data['visibility'] = 'private'; $data['post_status'] = 'private'; } else { $data['post_status'] = $data['_status']; } if ( empty( $data['comment_status'] ) ) { $data['comment_status'] = 'closed'; } if ( empty( $data['ping_status'] ) ) { $data['ping_status'] = 'closed'; } if ( ! empty( $data['tax_input'] ) ) { foreach ( $data['tax_input'] as $taxonomy => $terms ) { $tax_object = get_taxonomy( $taxonomy ); if ( ! apply_filters( 'quick_edit_show_taxonomy', $tax_object->show_in_quick_edit, $taxonomy, $post['post_type'] ) ) { unset( $data['tax_input'][ $taxonomy ] ); } } } if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) { $post['post_status'] = 'publish'; $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] ); } edit_post(); $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) ); $mode = 'excerpt' === $_POST['post_view'] ? 'excerpt' : 'list'; $level = 0; if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) { $request_post = array( get_post( $_POST['post_ID'] ) ); $parent = $request_post[0]->post_parent; while ( $parent > 0 ) { $parent_post = get_post( $parent ); $parent = $parent_post->post_parent; $level++; } } $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level ); wp_die(); } function wp_ajax_inline_save_tax() { check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); $taxonomy = sanitize_key( $_POST['taxonomy'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) { wp_die( -1 ); } $id = (int) $_POST['tax_ID']; if ( ! current_user_can( 'edit_term', $id ) ) { wp_die( -1 ); } $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) ); $tag = get_term( $id, $taxonomy ); $_POST['description'] = $tag->description; $updated = wp_update_term( $id, $taxonomy, $_POST ); if ( $updated && ! is_wp_error( $updated ) ) { $tag = get_term( $updated['term_id'], $taxonomy ); if ( ! $tag || is_wp_error( $tag ) ) { if ( is_wp_error( $tag ) && $tag->get_error_message() ) { wp_die( $tag->get_error_message() ); } wp_die( __( 'Item not updated.' ) ); } } else { if ( is_wp_error( $updated ) && $updated->get_error_message() ) { wp_die( $updated->get_error_message() ); } wp_die( __( 'Item not updated.' ) ); } $level = 0; $parent = $tag->parent; while ( $parent > 0 ) { $parent_tag = get_term( $parent, $taxonomy ); $parent = $parent_tag->parent; $level++; } $wp_list_table->single_row( $tag, $level ); wp_die(); } function wp_ajax_find_posts() { check_ajax_referer( 'find-posts' ); $post_types = get_post_types( array( 'public' => true ), 'objects' ); unset( $post_types['attachment'] ); $s = wp_unslash( $_POST['ps'] ); $args = array( 'post_type' => array_keys( $post_types ), 'post_status' => 'any', 'posts_per_page' => 50, ); if ( '' !== $s ) { $args['s'] = $s; } $posts = get_posts( $args ); if ( ! $posts ) { wp_send_json_error( __( 'No items found.' ) ); } $html = ''; $alt = ''; foreach ( $posts as $post ) { $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' ); $alt = ( 'alternate' === $alt ) ? '' : 'alternate'; switch ( $post->post_status ) { case 'publish': case 'private': $stat = __( 'Published' ); break; case 'future': $stat = __( 'Scheduled' ); break; case 'pending': $stat = __( 'Pending Review' ); break; case 'draft': $stat = __( 'Draft' ); break; } if ( '0000-00-00 00:00:00' === $post->post_date ) { $time = ''; } else { $time = mysql2date( __( 'Y/m/d' ), $post->post_date ); } $html .= ''; $html .= '' . "\n\n"; } $html .= '

      ' . __( 'Title' ) . '' . __( 'Type' ) . '' . __( 'Date' ) . '' . __( 'Status' ) . '
      ' . esc_html( $post_types[ $post->post_type ]->labels->singular_name ) . '' . esc_html( $time ) . '' . esc_html( $stat ) . '
      '; wp_send_json_success( $html ); } function wp_ajax_widgets_order() { check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } unset( $_POST['savewidgets'], $_POST['action'] ); if ( is_array( $_POST['sidebars'] ) ) { $sidebars = array(); foreach ( wp_unslash( $_POST['sidebars'] ) as $key => $val ) { $sb = array(); if ( ! empty( $val ) ) { $val = explode( ',', $val ); foreach ( $val as $k => $v ) { if ( strpos( $v, 'widget-' ) === false ) { continue; } $sb[ $k ] = substr( $v, strpos( $v, '_' ) + 1 ); } } $sidebars[ $key ] = $sb; } wp_set_sidebars_widgets( $sidebars ); wp_die( 1 ); } wp_die( -1 ); } function wp_ajax_save_widget() { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['id_base'] ) ) { wp_die( -1 ); } unset( $_POST['savewidgets'], $_POST['action'] ); do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); $id_base = wp_unslash( $_POST['id_base'] ); $widget_id = wp_unslash( $_POST['widget-id'] ); $sidebar_id = $_POST['sidebar']; $multi_number = ! empty( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : 0; $settings = isset( $_POST[ 'widget-' . $id_base ] ) && is_array( $_POST[ 'widget-' . $id_base ] ) ? $_POST[ 'widget-' . $id_base ] : false; $error = '

      ' . __( 'An error has occurred. Please reload the page and try again.' ) . '

      '; $sidebars = wp_get_sidebars_widgets(); $sidebar = isset( $sidebars[ $sidebar_id ] ) ? $sidebars[ $sidebar_id ] : array(); if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { wp_die( $error ); } $sidebar = array_diff( $sidebar, array( $widget_id ) ); $_POST = array( 'sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1', ); do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base ); } elseif ( $settings && preg_match( '/__i__|%i%/', key( $settings ) ) ) { if ( ! $multi_number ) { wp_die( $error ); } $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) ); $widget_id = $id_base . '-' . $multi_number; $sidebar[] = $widget_id; } $_POST['widget-id'] = $sidebar; foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name == $id_base ) { if ( ! is_callable( $control['callback'] ) ) { continue; } ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { $sidebars[ $sidebar_id ] = $sidebar; wp_set_sidebars_widgets( $sidebars ); echo "deleted:$widget_id"; wp_die(); } if ( ! empty( $_POST['add_new'] ) ) { wp_die(); } $form = $wp_registered_widget_controls[ $widget_id ]; if ( $form ) { call_user_func_array( $form['callback'], $form['params'] ); } wp_die(); } function wp_ajax_update_widget() { global $wp_customize; $wp_customize->widgets->wp_ajax_update_widget(); } function wp_ajax_delete_inactive_widgets() { check_ajax_referer( 'remove-inactive-widgets', 'removeinactivewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } unset( $_POST['removeinactivewidgets'], $_POST['action'] ); do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); $sidebars_widgets = wp_get_sidebars_widgets(); foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) { $pieces = explode( '-', $widget_id ); $multi_number = array_pop( $pieces ); $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); update_option( 'widget_' . $id_base, $widget ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } wp_set_sidebars_widgets( $sidebars_widgets ); wp_die(); } function wp_ajax_media_create_image_subsizes() { check_ajax_referer( 'media-form' ); if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error( array( 'message' => __( 'Sorry, you are not allowed to upload files.' ) ) ); } if ( empty( $_POST['attachment_id'] ) ) { wp_send_json_error( array( 'message' => __( 'Upload failed. Please reload and try again.' ) ) ); } $attachment_id = (int) $_POST['attachment_id']; if ( ! empty( $_POST['_wp_upload_failed_cleanup'] ) ) { if ( wp_attachment_is_image( $attachment_id ) && current_user_can( 'delete_post', $attachment_id ) ) { $attachment = get_post( $attachment_id ); if ( $attachment && ( time() - strtotime( $attachment->post_date_gmt ) < 600 ) ) { wp_delete_attachment( $attachment_id, true ); wp_send_json_success(); } } } if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } wp_update_image_subsizes( $attachment_id ); if ( ! empty( $_POST['_legacy_support'] ) ) { $response = array( 'id' => $attachment_id ); } else { $response = wp_prepare_attachment_for_js( $attachment_id ); if ( ! $response ) { wp_send_json_error( array( 'message' => __( 'Upload failed.' ) ) ); } } wp_send_json_success( $response ); } function wp_ajax_upload_attachment() { check_ajax_referer( 'media-form' ); if ( ! current_user_can( 'upload_files' ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'Sorry, you are not allowed to upload files.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } if ( isset( $_REQUEST['post_id'] ) ) { $post_id = $_REQUEST['post_id']; if ( ! current_user_can( 'edit_post', $post_id ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'Sorry, you are not allowed to attach files to this post.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } } else { $post_id = null; } $post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array(); if ( is_wp_error( $post_data ) ) { wp_die( $post_data->get_error_message() ); } if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) { $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'The uploaded file is not a valid image. Please try again.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } } $attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data ); if ( is_wp_error( $attachment_id ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => $attachment_id->get_error_message(), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) { if ( 'custom-background' === $post_data['context'] ) { update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] ); } if ( 'custom-header' === $post_data['context'] ) { update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] ); } } $attachment = wp_prepare_attachment_for_js( $attachment_id ); if ( ! $attachment ) { wp_die(); } echo wp_json_encode( array( 'success' => true, 'data' => $attachment, ) ); wp_die(); } function wp_ajax_image_editor() { $attachment_id = (int) $_POST['postid']; if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$attachment_id" ); include_once ABSPATH . 'wp-admin/includes/image-edit.php'; $msg = false; switch ( $_POST['do'] ) { case 'save': $msg = wp_save_image( $attachment_id ); if ( ! empty( $msg->error ) ) { wp_send_json_error( $msg ); } wp_send_json_success( $msg ); break; case 'scale': $msg = wp_save_image( $attachment_id ); break; case 'restore': $msg = wp_restore_image( $attachment_id ); break; } ob_start(); wp_image_editor( $attachment_id, $msg ); $html = ob_get_clean(); if ( ! empty( $msg->error ) ) { wp_send_json_error( array( 'message' => $msg, 'html' => $html, ) ); } wp_send_json_success( array( 'message' => $msg, 'html' => $html, ) ); } function wp_ajax_set_post_thumbnail() { $json = ! empty( $_REQUEST['json'] ); $post_ID = (int) $_POST['post_id']; if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( -1 ); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( $json ) { check_ajax_referer( "update-post_$post_ID" ); } else { check_ajax_referer( "set_post_thumbnail-$post_ID" ); } if ( '-1' == $thumbnail_id ) { if ( delete_post_thumbnail( $post_ID ) ) { $return = _wp_post_thumbnail_html( null, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); } else { wp_die( 0 ); } } if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) { $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); } wp_die( 0 ); } function wp_ajax_get_post_thumbnail_html() { $post_ID = (int) $_POST['post_id']; check_ajax_referer( "update-post_$post_ID" ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( -1 ); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( -1 === $thumbnail_id ) { $thumbnail_id = null; } $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID ); wp_send_json_success( $return ); } function wp_ajax_set_attachment_thumbnail() { if ( empty( $_POST['urls'] ) || ! is_array( $_POST['urls'] ) ) { wp_send_json_error(); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( empty( $thumbnail_id ) ) { wp_send_json_error(); } $post_ids = array(); foreach ( $_POST['urls'] as $url ) { $post_id = attachment_url_to_postid( $url ); if ( ! empty( $post_id ) ) { $post_ids[] = $post_id; } } if ( empty( $post_ids ) ) { wp_send_json_error(); } $success = 0; foreach ( $post_ids as $post_id ) { if ( ! current_user_can( 'edit_post', $post_id ) ) { continue; } if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) { $success++; } } if ( 0 === $success ) { wp_send_json_error(); } else { wp_send_json_success(); } wp_send_json_error(); } function wp_ajax_date_format() { wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) ); } function wp_ajax_time_format() { wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) ); } function wp_ajax_wp_fullscreen_save_post() { $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; $post = null; if ( $post_id ) { $post = get_post( $post_id ); } check_ajax_referer( 'update-post_' . $post_id, '_wpnonce' ); $post_id = edit_post(); if ( is_wp_error( $post_id ) ) { wp_send_json_error(); } if ( $post ) { $last_date = mysql2date( __( 'F j, Y' ), $post->post_modified ); $last_time = mysql2date( __( 'g:i a' ), $post->post_modified ); } else { $last_date = date_i18n( __( 'F j, Y' ) ); $last_time = date_i18n( __( 'g:i a' ) ); } $last_id = get_post_meta( $post_id, '_edit_last', true ); if ( $last_id ) { $last_user = get_userdata( $last_id ); $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time ); } else { $last_edited = sprintf( __( 'Last edited on %1$s at %2$s' ), $last_date, $last_time ); } wp_send_json_success( array( 'last_edited' => $last_edited ) ); } function wp_ajax_wp_remove_post_lock() { if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) ) { wp_die( 0 ); } $post_id = (int) $_POST['post_ID']; $post = get_post( $post_id ); if ( ! $post ) { wp_die( 0 ); } check_ajax_referer( 'update-post_' . $post_id ); if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) ); if ( get_current_user_id() != $active_lock[1] ) { wp_die( 0 ); } $new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1]; update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) ); wp_die( 1 ); } function wp_ajax_dismiss_wp_pointer() { $pointer = $_POST['pointer']; if ( sanitize_key( $pointer ) != $pointer ) { wp_die( 0 ); } $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); if ( in_array( $pointer, $dismissed, true ) ) { wp_die( 0 ); } $dismissed[] = $pointer; $dismissed = implode( ',', $dismissed ); update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); wp_die( 1 ); } function wp_ajax_get_attachment() { if ( ! isset( $_REQUEST['id'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } $post = get_post( $id ); if ( ! $post ) { wp_send_json_error(); } if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error(); } $attachment = wp_prepare_attachment_for_js( $id ); if ( ! $attachment ) { wp_send_json_error(); } wp_send_json_success( $attachment ); } function wp_ajax_query_attachments() { if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error(); } $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); $keys = array( 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type', 'post_parent', 'author', 'post__in', 'post__not_in', 'year', 'monthnum', ); foreach ( get_taxonomies_for_attachments( 'objects' ) as $t ) { if ( $t->query_var && isset( $query[ $t->query_var ] ) ) { $keys[] = $t->query_var; } } $query = array_intersect_key( $query, array_flip( $keys ) ); $query['post_type'] = 'attachment'; if ( MEDIA_TRASH && ! empty( $_REQUEST['query']['post_status'] ) && 'trash' === $_REQUEST['query']['post_status'] ) { $query['post_status'] = 'trash'; } else { $query['post_status'] = 'inherit'; } if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) ) { $query['post_status'] .= ',private'; } if ( isset( $query['s'] ) ) { add_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); } $query = apply_filters( 'ajax_query_attachments_args', $query ); $attachments_query = new WP_Query( $query ); $posts = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts ); $posts = array_filter( $posts ); $total_posts = $attachments_query->found_posts; if ( $total_posts < 1 ) { unset( $query['paged'] ); $count_query = new WP_Query(); $count_query->query( $query ); $total_posts = $count_query->found_posts; } $posts_per_page = (int) $attachments_query->get( 'posts_per_page' ); $max_pages = $posts_per_page ? ceil( $total_posts / $posts_per_page ) : 0; header( 'X-WP-Total: ' . (int) $total_posts ); header( 'X-WP-TotalPages: ' . (int) $max_pages ); wp_send_json_success( $posts ); } function wp_ajax_save_attachment() { if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } check_ajax_referer( 'update-post_' . $id, 'nonce' ); if ( ! current_user_can( 'edit_post', $id ) ) { wp_send_json_error(); } $changes = $_REQUEST['changes']; $post = get_post( $id, ARRAY_A ); if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } if ( isset( $changes['parent'] ) ) { $post['post_parent'] = $changes['parent']; } if ( isset( $changes['title'] ) ) { $post['post_title'] = $changes['title']; } if ( isset( $changes['caption'] ) ) { $post['post_excerpt'] = $changes['caption']; } if ( isset( $changes['description'] ) ) { $post['post_content'] = $changes['description']; } if ( MEDIA_TRASH && isset( $changes['status'] ) ) { $post['post_status'] = $changes['status']; } if ( isset( $changes['alt'] ) ) { $alt = wp_unslash( $changes['alt'] ); if ( get_post_meta( $id, '_wp_attachment_image_alt', true ) !== $alt ) { $alt = wp_strip_all_tags( $alt, true ); update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); } } if ( wp_attachment_is( 'audio', $post['ID'] ) ) { $changed = false; $id3data = wp_get_attachment_metadata( $post['ID'] ); if ( ! is_array( $id3data ) ) { $changed = true; $id3data = array(); } foreach ( wp_get_attachment_id3_keys( (object) $post, 'edit' ) as $key => $label ) { if ( isset( $changes[ $key ] ) ) { $changed = true; $id3data[ $key ] = sanitize_text_field( wp_unslash( $changes[ $key ] ) ); } } if ( $changed ) { wp_update_attachment_metadata( $id, $id3data ); } } if ( MEDIA_TRASH && isset( $changes['status'] ) && 'trash' === $changes['status'] ) { wp_delete_post( $id ); } else { wp_update_post( $post ); } wp_send_json_success(); } function wp_ajax_save_attachment_compat() { if ( ! isset( $_REQUEST['id'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) ) { wp_send_json_error(); } $attachment_data = $_REQUEST['attachments'][ $id ]; check_ajax_referer( 'update-post_' . $id, 'nonce' ); if ( ! current_user_can( 'edit_post', $id ) ) { wp_send_json_error(); } $post = get_post( $id, ARRAY_A ); if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data ); if ( isset( $post['errors'] ) ) { $errors = $post['errors']; unset( $post['errors'] ); } wp_update_post( $post ); foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { if ( isset( $attachment_data[ $taxonomy ] ) ) { wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false ); } } $attachment = wp_prepare_attachment_for_js( $id ); if ( ! $attachment ) { wp_send_json_error(); } wp_send_json_success( $attachment ); } function wp_ajax_save_attachment_order() { if ( ! isset( $_REQUEST['post_id'] ) ) { wp_send_json_error(); } $post_id = absint( $_REQUEST['post_id'] ); if ( ! $post_id ) { wp_send_json_error(); } if ( empty( $_REQUEST['attachments'] ) ) { wp_send_json_error(); } check_ajax_referer( 'update-post_' . $post_id, 'nonce' ); $attachments = $_REQUEST['attachments']; if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_send_json_error(); } foreach ( $attachments as $attachment_id => $menu_order ) { if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } $attachment = get_post( $attachment_id ); if ( ! $attachment ) { continue; } if ( 'attachment' !== $attachment->post_type ) { continue; } wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order, ) ); } wp_send_json_success(); } function wp_ajax_send_attachment_to_editor() { check_ajax_referer( 'media-send-to-editor', 'nonce' ); $attachment = wp_unslash( $_POST['attachment'] ); $id = (int) $attachment['id']; $post = get_post( $id ); if ( ! $post ) { wp_send_json_error(); } if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } if ( current_user_can( 'edit_post', $id ) ) { $insert_into_post_id = (int) $_POST['post_id']; if ( 0 == $post->post_parent && $insert_into_post_id ) { wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id, ) ); } } $url = empty( $attachment['url'] ) ? '' : $attachment['url']; $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) == $url ); remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : ''; if ( '' === trim( $caption ) ) { $caption = ''; } $title = ''; $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt ); } elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) { $html = stripslashes_deep( $_POST['html'] ); } else { $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; $rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; if ( ! empty( $url ) ) { $html = '' . $html . ''; } } $html = apply_filters( 'media_send_to_editor', $html, $id, $attachment ); wp_send_json_success( $html ); } function wp_ajax_send_link_to_editor() { global $post, $wp_embed; check_ajax_referer( 'media-send-to-editor', 'nonce' ); $src = wp_unslash( $_POST['src'] ); if ( ! $src ) { wp_send_json_error(); } if ( ! strpos( $src, '://' ) ) { $src = 'http://' . $src; } $src = esc_url_raw( $src ); if ( ! $src ) { wp_send_json_error(); } $link_text = trim( wp_unslash( $_POST['link_text'] ) ); if ( ! $link_text ) { $link_text = wp_basename( $src ); } $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 ); $check_embed = $wp_embed->run_shortcode( '[embed]' . $src . '[/embed]' ); $fallback = $wp_embed->maybe_make_link( $src ); if ( $check_embed !== $fallback ) { $html = '[embed]' . $src . '[/embed]'; } elseif ( $link_text ) { $html = '' . $link_text . ''; } else { $html = ''; } $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } $html = apply_filters( "{$type}_send_to_editor_url", $html, $src, $link_text ); wp_send_json_success( $html ); } function wp_ajax_heartbeat() { if ( empty( $_POST['_nonce'] ) ) { wp_send_json_error(); } $response = array(); $data = array(); $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); if ( ! empty( $_POST['screen_id'] ) ) { $screen_id = sanitize_key( $_POST['screen_id'] ); } else { $screen_id = 'front'; } if ( ! empty( $_POST['data'] ) ) { $data = wp_unslash( (array) $_POST['data'] ); } if ( 1 !== $nonce_state ) { $response = apply_filters( 'wp_refresh_nonces', $response, $data, $screen_id ); if ( false === $nonce_state ) { $response['nonces_expired'] = true; wp_send_json( $response ); } } if ( ! empty( $data ) ) { $response = apply_filters( 'heartbeat_received', $response, $data, $screen_id ); } $response = apply_filters( 'heartbeat_send', $response, $screen_id ); do_action( 'heartbeat_tick', $response, $screen_id ); $response['server_time'] = time(); wp_send_json( $response ); } function wp_ajax_get_revision_diffs() { require ABSPATH . 'wp-admin/includes/revision.php'; $post = get_post( (int) $_REQUEST['post_id'] ); if ( ! $post ) { wp_send_json_error(); } if ( ! current_user_can( 'edit_post', $post->ID ) ) { wp_send_json_error(); } $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ); if ( ! $revisions ) { wp_send_json_error(); } $return = array(); set_time_limit( 0 ); foreach ( $_REQUEST['compare'] as $compare_key ) { list( $compare_from, $compare_to ) = explode( ':', $compare_key ); $return[] = array( 'id' => $compare_key, 'fields' => wp_get_revision_ui_diff( $post, $compare_from, $compare_to ), ); } wp_send_json_success( $return ); } function wp_ajax_save_user_color_scheme() { global $_wp_admin_css_colors; check_ajax_referer( 'save-color-scheme', 'nonce' ); $color_scheme = sanitize_key( $_POST['color_scheme'] ); if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) { wp_send_json_error(); } $previous_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true ); update_user_meta( get_current_user_id(), 'admin_color', $color_scheme ); wp_send_json_success( array( 'previousScheme' => 'admin-color-' . $previous_color_scheme, 'currentScheme' => 'admin-color-' . $color_scheme, ) ); } function wp_ajax_query_themes() { global $themes_allowedtags, $theme_field_defaults; if ( ! current_user_can( 'install_themes' ) ) { wp_send_json_error(); } $args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array( 'per_page' => 20, 'fields' => array_merge( (array) $theme_field_defaults, array( 'reviews_url' => true, ) ), ) ); if ( isset( $args['browse'] ) && 'favorites' === $args['browse'] && ! isset( $args['user'] ) ) { $user = get_user_option( 'wporg_favorites' ); if ( $user ) { $args['user'] = $user; } } $old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search'; $args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args ); $api = themes_api( 'query_themes', $args ); if ( is_wp_error( $api ) ) { wp_send_json_error(); } $update_php = network_admin_url( 'update.php?action=install-theme' ); $installed_themes = search_theme_directories(); if ( false === $installed_themes ) { $installed_themes = array(); } foreach ( $installed_themes as $theme_slug => $theme_data ) { if ( str_contains( $theme_slug, '/' ) ) { unset( $installed_themes[ $theme_slug ] ); } } foreach ( $api->themes as &$theme ) { $theme->install_url = add_query_arg( array( 'theme' => $theme->slug, '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), ), $update_php ); if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $theme->activate_url = add_query_arg( array( 'action' => 'enable', '_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ), 'theme' => $theme->slug, ), network_admin_url( 'themes.php' ) ); } else { $theme->activate_url = add_query_arg( array( 'action' => 'activate', '_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ), 'stylesheet' => $theme->slug, ), admin_url( 'themes.php' ) ); } } $is_theme_installed = array_key_exists( $theme->slug, $installed_themes ); $theme->block_theme = $is_theme_installed && wp_get_theme( $theme->slug )->is_block_theme(); if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $customize_url = $theme->block_theme ? admin_url( 'site-editor.php' ) : wp_customize_url( $theme->slug ); $theme->customize_url = add_query_arg( array( 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ), ), $customize_url ); } $theme->name = wp_kses( $theme->name, $themes_allowedtags ); $theme->author = wp_kses( $theme->author['display_name'], $themes_allowedtags ); $theme->version = wp_kses( $theme->version, $themes_allowedtags ); $theme->description = wp_kses( $theme->description, $themes_allowedtags ); $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false, ) ); $theme->num_ratings = number_format_i18n( $theme->num_ratings ); $theme->preview_url = set_url_scheme( $theme->preview_url ); $theme->compatible_wp = is_wp_version_compatible( $theme->requires ); $theme->compatible_php = is_php_version_compatible( $theme->requires_php ); } wp_send_json_success( $api ); } function wp_ajax_parse_embed() { global $post, $wp_embed, $content_width; if ( empty( $_POST['shortcode'] ) ) { wp_send_json_error(); } $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { wp_send_json_error(); } setup_postdata( $post ); } elseif ( ! current_user_can( 'edit_posts' ) ) { wp_send_json_error(); } $shortcode = wp_unslash( $_POST['shortcode'] ); preg_match( '/' . get_shortcode_regex() . '/s', $shortcode, $matches ); $atts = shortcode_parse_atts( $matches[3] ); if ( ! empty( $matches[5] ) ) { $url = $matches[5]; } elseif ( ! empty( $atts['src'] ) ) { $url = $atts['src']; } else { $url = ''; } $parsed = false; $wp_embed->return_false_on_fail = true; if ( 0 === $post_id ) { $wp_embed->usecache = false; } if ( is_ssl() && 0 === strpos( $url, 'http://' ) ) { $ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode ); $parsed = $wp_embed->run_shortcode( $ssl_shortcode ); if ( ! $parsed ) { $no_ssl_support = true; } } if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { if ( ! isset( $content_width ) ) { $content_width = (int) $_POST['maxwidth']; } else { $content_width = min( $content_width, (int) $_POST['maxwidth'] ); } } if ( $url && ! $parsed ) { $parsed = $wp_embed->run_shortcode( $shortcode ); } if ( ! $parsed ) { wp_send_json_error( array( 'type' => 'not-embeddable', 'message' => sprintf( __( '%s failed to embed.' ), '' . esc_html( $url ) . '' ), ) ); } if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) { $styles = ''; $mce_styles = wpview_media_sandbox_styles(); foreach ( $mce_styles as $style ) { $styles .= sprintf( '', $style ); } $html = do_shortcode( $parsed ); global $wp_scripts; if ( ! empty( $wp_scripts ) ) { $wp_scripts->done = array(); } ob_start(); wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) ); $scripts = ob_get_clean(); $parsed = $styles . $html . $scripts; } if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) || preg_match( '%]*href="http://%', $parsed ) ) ) ) { wp_send_json_error( array( 'type' => 'not-ssl', 'message' => __( 'This preview is unavailable in the editor.' ), ) ); } $return = array( 'body' => $parsed, 'attr' => $wp_embed->last_attr, ); if ( strpos( $parsed, 'class="wp-embedded-content' ) ) { if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { $script_src = includes_url( 'js/wp-embed.js' ); } else { $script_src = includes_url( 'js/wp-embed.min.js' ); } $return['head'] = ''; $return['sandbox'] = true; } wp_send_json_success( $return ); } function wp_ajax_parse_media_shortcode() { global $post, $wp_scripts; if ( empty( $_POST['shortcode'] ) ) { wp_send_json_error(); } $shortcode = wp_unslash( $_POST['shortcode'] ); if ( ! empty( $_POST['post_ID'] ) ) { $post = get_post( (int) $_POST['post_ID'] ); } if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { if ( 'embed' === $shortcode ) { wp_send_json_error(); } } else { setup_postdata( $post ); } $parsed = do_shortcode( $shortcode ); if ( empty( $parsed ) ) { wp_send_json_error( array( 'type' => 'no-items', 'message' => __( 'No items found.' ), ) ); } $head = ''; $styles = wpview_media_sandbox_styles(); foreach ( $styles as $style ) { $head .= ''; } if ( ! empty( $wp_scripts ) ) { $wp_scripts->done = array(); } ob_start(); echo $parsed; if ( 'playlist' === $_REQUEST['type'] ) { wp_underscore_playlist_templates(); wp_print_scripts( 'wp-playlist' ); } else { wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) ); } wp_send_json_success( array( 'head' => $head, 'body' => ob_get_clean(), ) ); } function wp_ajax_destroy_sessions() { $user = get_userdata( (int) $_POST['user_id'] ); if ( $user ) { if ( ! current_user_can( 'edit_user', $user->ID ) ) { $user = false; } elseif ( ! wp_verify_nonce( $_POST['nonce'], 'update-user_' . $user->ID ) ) { $user = false; } } if ( ! $user ) { wp_send_json_error( array( 'message' => __( 'Could not log out user sessions. Please try again.' ), ) ); } $sessions = WP_Session_Tokens::get_instance( $user->ID ); if ( get_current_user_id() === $user->ID ) { $sessions->destroy_others( wp_get_session_token() ); $message = __( 'You are now logged out everywhere else.' ); } else { $sessions->destroy_all(); $message = sprintf( __( '%s has been logged out.' ), $user->display_name ); } wp_send_json_success( array( 'message' => $message ) ); } function wp_ajax_crop_image() { $attachment_id = absint( $_POST['id'] ); check_ajax_referer( 'image_editor-' . $attachment_id, 'nonce' ); if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_send_json_error(); } $context = str_replace( '_', '-', $_POST['context'] ); $data = array_map( 'absint', $_POST['cropDetails'] ); $cropped = wp_crop_image( $attachment_id, $data['x1'], $data['y1'], $data['width'], $data['height'], $data['dst_width'], $data['dst_height'] ); if ( ! $cropped || is_wp_error( $cropped ) ) { wp_send_json_error( array( 'message' => __( 'Image could not be processed.' ) ) ); } switch ( $context ) { case 'site-icon': require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'; $wp_site_icon = new WP_Site_Icon(); if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) { wp_delete_file( $cropped ); add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); break; } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); unset( $attachment['ID'] ); add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); $attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped ); remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); break; default: do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $parent_url = wp_get_attachment_url( $attachment_id ); $parent_basename = wp_basename( $parent_url ); $url = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $original_attachment = get_post( $attachment_id ); $sanitized_post_title = sanitize_file_name( $original_attachment->post_title ); $use_original_title = ( ( '' !== trim( $original_attachment->post_title ) ) && ( $parent_basename !== $sanitized_post_title ) && ( pathinfo( $parent_basename, PATHINFO_FILENAME ) !== $sanitized_post_title ) ); $use_original_description = ( '' !== trim( $original_attachment->post_content ) ); $attachment = array( 'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ), 'post_content' => $use_original_description ? $original_attachment->post_content : $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => $context, ); if ( '' !== trim( $original_attachment->post_excerpt ) ) { $attachment['post_excerpt'] = $original_attachment->post_excerpt; } if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) { $attachment['meta_input'] = array( '_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ), ); } $attachment_id = wp_insert_attachment( $attachment, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); $metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context ); } wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) ); } function wp_ajax_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } function wp_ajax_nopriv_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } function wp_ajax_save_wporg_username() { if ( ! current_user_can( 'install_themes' ) && ! current_user_can( 'install_plugins' ) ) { wp_send_json_error(); } check_ajax_referer( 'save_wporg_username_' . get_current_user_id() ); $username = isset( $_REQUEST['username'] ) ? wp_unslash( $_REQUEST['username'] ) : false; if ( ! $username ) { wp_send_json_error(); } wp_send_json_success( update_user_meta( get_current_user_id(), 'wporg_favorites', $username ) ); } function wp_ajax_install_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $slug = sanitize_key( wp_unslash( $_POST['slug'] ) ); $status = array( 'install' => 'theme', 'slug' => $slug, ); if ( ! current_user_can( 'install_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to install themes on this site.' ); wp_send_json_error( $status ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/theme.php'; $api = themes_api( 'theme_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ), ) ); if ( is_wp_error( $api ) ) { $status['errorMessage'] = $api->get_error_message(); wp_send_json_error( $status ); } $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Theme_Upgrader( $skin ); $result = $upgrader->install( $api->download_link ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $result ) ) { $status['errorCode'] = $result->get_error_code(); $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_null( $result ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['themeName'] = wp_get_theme( $slug )->get( 'Name' ); if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $status['activateUrl'] = add_query_arg( array( 'action' => 'enable', '_wpnonce' => wp_create_nonce( 'enable-theme_' . $slug ), 'theme' => $slug, ), network_admin_url( 'themes.php' ) ); } else { $status['activateUrl'] = add_query_arg( array( 'action' => 'activate', '_wpnonce' => wp_create_nonce( 'switch-theme_' . $slug ), 'stylesheet' => $slug, ), admin_url( 'themes.php' ) ); } } $theme = wp_get_theme( $slug ); $status['blockTheme'] = $theme->is_block_theme(); if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $status['customizeUrl'] = add_query_arg( array( 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ), ), wp_customize_url( $slug ) ); } wp_send_json_success( $status ); } function wp_ajax_update_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) ); $status = array( 'update' => 'theme', 'slug' => $stylesheet, 'oldVersion' => '', 'newVersion' => '', ); if ( ! current_user_can( 'update_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to update themes for this site.' ); wp_send_json_error( $status ); } $theme = wp_get_theme( $stylesheet ); if ( $theme->exists() ) { $status['oldVersion'] = $theme->get( 'Version' ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $current = get_site_transient( 'update_themes' ); if ( empty( $current ) ) { wp_update_themes(); } $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Theme_Upgrader( $skin ); $result = $upgrader->bulk_upgrade( array( $stylesheet ) ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_array( $result ) && ! empty( $result[ $stylesheet ] ) ) { if ( true === $result[ $stylesheet ] ) { $status['errorMessage'] = $upgrader->strings['up_to_date']; wp_send_json_error( $status ); } $theme = wp_get_theme( $stylesheet ); if ( $theme->exists() ) { $status['newVersion'] = $theme->get( 'Version' ); } wp_send_json_success( $status ); } elseif ( false === $result ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['errorMessage'] = __( 'Theme update failed.' ); wp_send_json_error( $status ); } function wp_ajax_delete_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) ); $status = array( 'delete' => 'theme', 'slug' => $stylesheet, ); if ( ! current_user_can( 'delete_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to delete themes on this site.' ); wp_send_json_error( $status ); } if ( ! wp_get_theme( $stylesheet )->exists() ) { $status['errorMessage'] = __( 'The requested theme does not exist.' ); wp_send_json_error( $status ); } $url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ); ob_start(); $credentials = request_filesystem_credentials( $url ); ob_end_clean(); if ( false === $credentials || ! WP_Filesystem( $credentials ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } include_once ABSPATH . 'wp-admin/includes/theme.php'; $result = delete_theme( $stylesheet ); if ( is_wp_error( $result ) ) { $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( false === $result ) { $status['errorMessage'] = __( 'Theme could not be deleted.' ); wp_send_json_error( $status ); } wp_send_json_success( $status ); } function wp_ajax_install_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $status = array( 'install' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), ); if ( ! current_user_can( 'install_plugins' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.' ); wp_send_json_error( $status ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $api = plugins_api( 'plugin_information', array( 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 'fields' => array( 'sections' => false, ), ) ); if ( is_wp_error( $api ) ) { $status['errorMessage'] = $api->get_error_message(); wp_send_json_error( $status ); } $status['pluginName'] = $api->name; $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader( $skin ); $result = $upgrader->install( $api->download_link ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $result ) ) { $status['errorCode'] = $result->get_error_code(); $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_null( $result ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $install_status = install_plugin_install_status( $api ); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; $plugins_url = ( 'import' === $pagenow ) ? admin_url( 'plugins.php' ) : network_admin_url( 'plugins.php' ); if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) { $status['activateUrl'] = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $install_status['file'] ), 'action' => 'activate', 'plugin' => $install_status['file'], ), $plugins_url ); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) && 'import' !== $pagenow ) { $status['activateUrl'] = add_query_arg( array( 'networkwide' => 1 ), $status['activateUrl'] ); } wp_send_json_success( $status ); } function wp_ajax_update_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['plugin'] ) || empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); $status = array( 'update' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 'oldVersion' => '', 'newVersion' => '', ); if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' ); wp_send_json_error( $status ); } $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $status['plugin'] = $plugin; $status['pluginName'] = $plugin_data['Name']; if ( $plugin_data['Version'] ) { $status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; wp_update_plugins(); $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader( $skin ); $result = $upgrader->bulk_upgrade( array( $plugin ) ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_array( $result ) && ! empty( $result[ $plugin ] ) ) { if ( true === $result[ $plugin ] ) { $status['errorMessage'] = $upgrader->strings['up_to_date']; wp_send_json_error( $status ); } $plugin_data = get_plugins( '/' . $result[ $plugin ]['destination_name'] ); $plugin_data = reset( $plugin_data ); if ( $plugin_data['Version'] ) { $status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } wp_send_json_success( $status ); } elseif ( false === $result ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['errorMessage'] = __( 'Plugin update failed.' ); wp_send_json_error( $status ); } function wp_ajax_delete_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) || empty( $_POST['plugin'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); $status = array( 'delete' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), ); if ( ! current_user_can( 'delete_plugins' ) || 0 !== validate_file( $plugin ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to delete plugins for this site.' ); wp_send_json_error( $status ); } $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $status['plugin'] = $plugin; $status['pluginName'] = $plugin_data['Name']; if ( is_plugin_active( $plugin ) ) { $status['errorMessage'] = __( 'You cannot delete a plugin while it is active on the main site.' ); wp_send_json_error( $status ); } $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $plugin, 'bulk-plugins' ); ob_start(); $credentials = request_filesystem_credentials( $url ); ob_end_clean(); if ( false === $credentials || ! WP_Filesystem( $credentials ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $result = delete_plugins( array( $plugin ) ); if ( is_wp_error( $result ) ) { $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( false === $result ) { $status['errorMessage'] = __( 'Plugin could not be deleted.' ); wp_send_json_error( $status ); } wp_send_json_success( $status ); } function wp_ajax_search_plugins() { check_ajax_referer( 'updates' ); wp_plugin_update_rows(); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; if ( 'plugins-network' === $pagenow || 'plugins' === $pagenow ) { set_current_screen( $pagenow ); } $wp_list_table = _get_list_table( 'WP_Plugins_List_Table', array( 'screen' => get_current_screen(), ) ); $status = array(); if ( ! $wp_list_table->ajax_user_can() ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); wp_send_json_error( $status ); } $_SERVER['REQUEST_URI'] = add_query_arg( array_diff_key( $_POST, array( '_ajax_nonce' => null, 'action' => null, ) ), network_admin_url( 'plugins.php', 'relative' ) ); $GLOBALS['s'] = wp_unslash( $_POST['s'] ); $wp_list_table->prepare_items(); ob_start(); $wp_list_table->display(); $status['count'] = count( $wp_list_table->items ); $status['items'] = ob_get_clean(); wp_send_json_success( $status ); } function wp_ajax_search_install_plugins() { check_ajax_referer( 'updates' ); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; if ( 'plugin-install-network' === $pagenow || 'plugin-install' === $pagenow ) { set_current_screen( $pagenow ); } $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table', array( 'screen' => get_current_screen(), ) ); $status = array(); if ( ! $wp_list_table->ajax_user_can() ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); wp_send_json_error( $status ); } $_SERVER['REQUEST_URI'] = add_query_arg( array_diff_key( $_POST, array( '_ajax_nonce' => null, 'action' => null, ) ), network_admin_url( 'plugin-install.php', 'relative' ) ); $wp_list_table->prepare_items(); ob_start(); $wp_list_table->display(); $status['count'] = (int) $wp_list_table->get_pagination_arg( 'total_items' ); $status['items'] = ob_get_clean(); wp_send_json_success( $status ); } function wp_ajax_edit_theme_plugin_file() { $r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) ); if ( is_wp_error( $r ) ) { wp_send_json_error( array_merge( array( 'code' => $r->get_error_code(), 'message' => $r->get_error_message(), ), (array) $r->get_error_data() ) ); } else { wp_send_json_success( array( 'message' => __( 'File edited successfully.' ), ) ); } } function wp_ajax_wp_privacy_export_personal_data() { if ( empty( $_POST['id'] ) ) { wp_send_json_error( __( 'Missing request ID.' ) ); } $request_id = (int) $_POST['id']; if ( $request_id < 1 ) { wp_send_json_error( __( 'Invalid request ID.' ) ); } if ( ! current_user_can( 'export_others_personal_data' ) ) { wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) ); } check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' ); $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request type.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'A valid email address must be given.' ) ); } if ( ! isset( $_POST['exporter'] ) ) { wp_send_json_error( __( 'Missing exporter index.' ) ); } $exporter_index = (int) $_POST['exporter']; if ( ! isset( $_POST['page'] ) ) { wp_send_json_error( __( 'Missing page index.' ) ); } $page = (int) $_POST['page']; $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false; $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); if ( ! is_array( $exporters ) ) { wp_send_json_error( __( 'An exporter has improperly used the registration filter.' ) ); } if ( 0 < count( $exporters ) ) { if ( $exporter_index < 1 ) { wp_send_json_error( __( 'Exporter index cannot be negative.' ) ); } if ( $exporter_index > count( $exporters ) ) { wp_send_json_error( __( 'Exporter index is out of range.' ) ); } if ( $page < 1 ) { wp_send_json_error( __( 'Page index cannot be less than one.' ) ); } $exporter_keys = array_keys( $exporters ); $exporter_key = $exporter_keys[ $exporter_index - 1 ]; $exporter = $exporters[ $exporter_key ]; if ( ! is_array( $exporter ) ) { wp_send_json_error( sprintf( __( 'Expected an array describing the exporter at index %s.' ), $exporter_key ) ); } if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) { wp_send_json_error( sprintf( __( 'Exporter array at index %s does not include a friendly name.' ), $exporter_key ) ); } $exporter_friendly_name = $exporter['exporter_friendly_name']; if ( ! array_key_exists( 'callback', $exporter ) ) { wp_send_json_error( sprintf( __( 'Exporter does not include a callback: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! is_callable( $exporter['callback'] ) ) { wp_send_json_error( sprintf( __( 'Exporter callback is not a valid callback: %s.' ), esc_html( $exporter_friendly_name ) ) ); } $callback = $exporter['callback']; $response = call_user_func( $callback, $email_address, $page ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } if ( ! is_array( $response ) ) { wp_send_json_error( sprintf( __( 'Expected response as an array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! array_key_exists( 'data', $response ) ) { wp_send_json_error( sprintf( __( 'Expected data in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! is_array( $response['data'] ) ) { wp_send_json_error( sprintf( __( 'Expected data array in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! array_key_exists( 'done', $response ) ) { wp_send_json_error( sprintf( __( 'Expected done (boolean) in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } } else { $exporter_key = ''; $response = array( 'data' => array(), 'done' => true, ); } $response = apply_filters( 'wp_privacy_personal_data_export_page', $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } wp_send_json_success( $response ); } function wp_ajax_wp_privacy_erase_personal_data() { if ( empty( $_POST['id'] ) ) { wp_send_json_error( __( 'Missing request ID.' ) ); } $request_id = (int) $_POST['id']; if ( $request_id < 1 ) { wp_send_json_error( __( 'Invalid request ID.' ) ); } if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) { wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) ); } check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' ); $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request type.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'Invalid email address in request.' ) ); } if ( ! isset( $_POST['eraser'] ) ) { wp_send_json_error( __( 'Missing eraser index.' ) ); } $eraser_index = (int) $_POST['eraser']; if ( ! isset( $_POST['page'] ) ) { wp_send_json_error( __( 'Missing page index.' ) ); } $page = (int) $_POST['page']; $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); if ( 0 < count( $erasers ) ) { if ( $eraser_index < 1 ) { wp_send_json_error( __( 'Eraser index cannot be less than one.' ) ); } if ( $eraser_index > count( $erasers ) ) { wp_send_json_error( __( 'Eraser index is out of range.' ) ); } if ( $page < 1 ) { wp_send_json_error( __( 'Page index cannot be less than one.' ) ); } $eraser_keys = array_keys( $erasers ); $eraser_key = $eraser_keys[ $eraser_index - 1 ]; $eraser = $erasers[ $eraser_key ]; if ( ! is_array( $eraser ) ) { wp_send_json_error( sprintf( __( 'Expected an array describing the eraser at index %d.' ), $eraser_index ) ); } if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) { wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a friendly name.' ), $eraser_index ) ); } $eraser_friendly_name = $eraser['eraser_friendly_name']; if ( ! array_key_exists( 'callback', $eraser ) ) { wp_send_json_error( sprintf( __( 'Eraser does not include a callback: %s.' ), esc_html( $eraser_friendly_name ) ) ); } if ( ! is_callable( $eraser['callback'] ) ) { wp_send_json_error( sprintf( __( 'Eraser callback is not valid: %s.' ), esc_html( $eraser_friendly_name ) ) ); } $callback = $eraser['callback']; $response = call_user_func( $callback, $email_address, $page ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } if ( ! is_array( $response ) ) { wp_send_json_error( sprintf( __( 'Did not receive array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'items_removed', $response ) ) { wp_send_json_error( sprintf( __( 'Expected items_removed key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'items_retained', $response ) ) { wp_send_json_error( sprintf( __( 'Expected items_retained key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'messages', $response ) ) { wp_send_json_error( sprintf( __( 'Expected messages key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! is_array( $response['messages'] ) ) { wp_send_json_error( sprintf( __( 'Expected messages key to reference an array in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'done', $response ) ) { wp_send_json_error( sprintf( __( 'Expected done flag in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } } else { $eraser_key = ''; $response = array( 'items_removed' => false, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } $response = apply_filters( 'wp_privacy_personal_data_erasure_page', $response, $eraser_index, $email_address, $page, $request_id, $eraser_key ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } wp_send_json_success( $response ); } function wp_ajax_health_check_dotorg_communication() { _doing_it_wrong( 'wp_ajax_health_check_dotorg_communication', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_dotorg_communication', 'WP_REST_Site_Health_Controller::test_dotorg_communication' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_dotorg_communication() ); } function wp_ajax_health_check_background_updates() { _doing_it_wrong( 'wp_ajax_health_check_background_updates', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_background_updates', 'WP_REST_Site_Health_Controller::test_background_updates' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_background_updates() ); } function wp_ajax_health_check_loopback_requests() { _doing_it_wrong( 'wp_ajax_health_check_loopback_requests', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_loopback_requests', 'WP_REST_Site_Health_Controller::test_loopback_requests' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_loopback_requests() ); } function wp_ajax_health_check_site_status_result() { check_ajax_referer( 'health-check-site-status-result' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) ); wp_send_json_success(); } function wp_ajax_health_check_get_sizes() { _doing_it_wrong( 'wp_ajax_health_check_get_sizes', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_get_sizes', 'WP_REST_Site_Health_Controller::get_directory_sizes' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status-result' ); if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Debug_Data' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php'; } $sizes_data = WP_Debug_Data::get_sizes(); $all_sizes = array( 'raw' => 0 ); foreach ( $sizes_data as $name => $value ) { $name = sanitize_text_field( $name ); $data = array(); if ( isset( $value['size'] ) ) { if ( is_string( $value['size'] ) ) { $data['size'] = sanitize_text_field( $value['size'] ); } else { $data['size'] = (int) $value['size']; } } if ( isset( $value['debug'] ) ) { if ( is_string( $value['debug'] ) ) { $data['debug'] = sanitize_text_field( $value['debug'] ); } else { $data['debug'] = (int) $value['debug']; } } if ( ! empty( $value['raw'] ) ) { $data['raw'] = (int) $value['raw']; } $all_sizes[ $name ] = $data; } if ( isset( $all_sizes['total_size']['debug'] ) && 'not available' === $all_sizes['total_size']['debug'] ) { wp_send_json_error( $all_sizes ); } wp_send_json_success( $all_sizes ); } function wp_ajax_rest_nonce() { exit( wp_create_nonce( 'wp_rest' ) ); } function wp_ajax_toggle_auto_updates() { check_ajax_referer( 'updates' ); if ( empty( $_POST['type'] ) || empty( $_POST['asset'] ) || empty( $_POST['state'] ) ) { wp_send_json_error( array( 'error' => __( 'Invalid data. No selected item.' ) ) ); } $asset = sanitize_text_field( urldecode( $_POST['asset'] ) ); if ( 'enable' !== $_POST['state'] && 'disable' !== $_POST['state'] ) { wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown state.' ) ) ); } $state = $_POST['state']; if ( 'plugin' !== $_POST['type'] && 'theme' !== $_POST['type'] ) { wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) ); } $type = $_POST['type']; switch ( $type ) { case 'plugin': if ( ! current_user_can( 'update_plugins' ) ) { $error_message = __( 'Sorry, you are not allowed to modify plugins.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $option = 'auto_update_plugins'; $all_items = apply_filters( 'all_plugins', get_plugins() ); break; case 'theme': if ( ! current_user_can( 'update_themes' ) ) { $error_message = __( 'Sorry, you are not allowed to modify themes.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $option = 'auto_update_themes'; $all_items = wp_get_themes(); break; default: wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) ); } if ( ! array_key_exists( $asset, $all_items ) ) { $error_message = __( 'Invalid data. The item does not exist.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $auto_updates = (array) get_site_option( $option, array() ); if ( 'disable' === $state ) { $auto_updates = array_diff( $auto_updates, array( $asset ) ); } else { $auto_updates[] = $asset; $auto_updates = array_unique( $auto_updates ); } $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); update_site_option( $option, $auto_updates ); wp_send_json_success(); } function wp_ajax_send_password_reset() { $user_id = isset( $_POST['user_id'] ) ? (int) $_POST['user_id'] : 0; check_ajax_referer( 'reset-password-for-' . $user_id, 'nonce' ); if ( ! current_user_can( 'edit_user', $user_id ) ) { wp_send_json_error( __( 'Cannot send password reset, permission denied.' ) ); } $user = get_userdata( $user_id ); $results = retrieve_password( $user->user_login ); if ( true === $results ) { wp_send_json_success( sprintf( __( 'A password reset link was emailed to %s.' ), $user->display_name ) ); } else { wp_send_json_error( $results->get_error_message() ); } } ' . __( 'You need a higher level of permission.' ) . '' . '

      ' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '

      ', 403 ); } $_POST['link_url'] = esc_html( $_POST['link_url'] ); $_POST['link_url'] = esc_url( $_POST['link_url'] ); $_POST['link_name'] = esc_html( $_POST['link_name'] ); $_POST['link_image'] = esc_html( $_POST['link_image'] ); $_POST['link_rss'] = esc_url( $_POST['link_rss'] ); if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) { $_POST['link_visible'] = 'Y'; } if ( ! empty( $link_id ) ) { $_POST['link_id'] = $link_id; return wp_update_link( $_POST ); } else { return wp_insert_link( $_POST ); } } function get_default_link_to_edit() { $link = new stdClass; if ( isset( $_GET['linkurl'] ) ) { $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) ); } else { $link->link_url = ''; } if ( isset( $_GET['name'] ) ) { $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) ); } else { $link->link_name = ''; } $link->link_visible = 'Y'; return $link; } function wp_delete_link( $link_id ) { global $wpdb; do_action( 'delete_link', $link_id ); wp_delete_object_term_relationships( $link_id, 'link_category' ); $wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) ); do_action( 'deleted_link', $link_id ); clean_bookmark_cache( $link_id ); return true; } function wp_get_link_cats( $link_id = 0 ) { $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) ); return array_unique( $cats ); } function get_link_to_edit( $link ) { return get_bookmark( $link, OBJECT, 'edit' ); } function wp_insert_link( $linkdata, $wp_error = false ) { global $wpdb; $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0, ); $parsed_args = wp_parse_args( $linkdata, $defaults ); $parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) ); $link_id = $parsed_args['link_id']; $link_name = $parsed_args['link_name']; $link_url = $parsed_args['link_url']; $update = false; if ( ! empty( $link_id ) ) { $update = true; } if ( '' === trim( $link_name ) ) { if ( '' !== trim( $link_url ) ) { $link_name = $link_url; } else { return 0; } } if ( '' === trim( $link_url ) ) { return 0; } $link_rating = ( ! empty( $parsed_args['link_rating'] ) ) ? $parsed_args['link_rating'] : 0; $link_image = ( ! empty( $parsed_args['link_image'] ) ) ? $parsed_args['link_image'] : ''; $link_target = ( ! empty( $parsed_args['link_target'] ) ) ? $parsed_args['link_target'] : ''; $link_visible = ( ! empty( $parsed_args['link_visible'] ) ) ? $parsed_args['link_visible'] : 'Y'; $link_owner = ( ! empty( $parsed_args['link_owner'] ) ) ? $parsed_args['link_owner'] : get_current_user_id(); $link_notes = ( ! empty( $parsed_args['link_notes'] ) ) ? $parsed_args['link_notes'] : ''; $link_description = ( ! empty( $parsed_args['link_description'] ) ) ? $parsed_args['link_description'] : ''; $link_rss = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : ''; $link_rel = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : ''; $link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array(); if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) { $link_category = array( get_option( 'default_link_category' ) ); } if ( $update ) { if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ), compact( 'link_id' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error ); } else { return 0; } } } else { if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error ); } else { return 0; } } $link_id = (int) $wpdb->insert_id; } wp_set_link_cats( $link_id, $link_category ); if ( $update ) { do_action( 'edit_link', $link_id ); } else { do_action( 'add_link', $link_id ); } clean_bookmark_cache( $link_id ); return $link_id; } function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { if ( ! is_array( $link_categories ) || 0 === count( $link_categories ) ) { $link_categories = array( get_option( 'default_link_category' ) ); } $link_categories = array_map( 'intval', $link_categories ); $link_categories = array_unique( $link_categories ); wp_set_object_terms( $link_id, $link_categories, 'link_category' ); clean_bookmark_cache( $link_id ); } function wp_update_link( $linkdata ) { $link_id = (int) $linkdata['link_id']; $link = get_bookmark( $link_id, ARRAY_A ); $link = wp_slash( $link ); if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && count( $linkdata['link_category'] ) > 0 ) { $link_cats = $linkdata['link_category']; } else { $link_cats = $link['link_category']; } $linkdata = array_merge( $link, $linkdata ); $linkdata['link_category'] = $link_cats; return wp_insert_link( $linkdata ); } function wp_link_manager_disabled_message() { global $pagenow; if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) { return; } add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); $really_can_manage_links = current_user_can( 'manage_links' ); remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); if ( $really_can_manage_links ) { $plugins = get_plugins(); if ( empty( $plugins['link-manager/link-manager.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ), 'install-plugin_link-manager' ); wp_die( sprintf( __( 'If you are looking to use the link manager, please install the Link Manager plugin.' ), esc_url( $install_url ) ) ); } } elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ), 'activate-plugin_link-manager/link-manager.php' ); wp_die( sprintf( __( 'Please activate the Link Manager plugin to use the link manager.' ), esc_url( $activate_url ) ) ); } } } wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); } strings['up_to_date'] = __( 'WordPress is at the latest version.' ); $this->strings['locked'] = __( 'Another update is currently in progress.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['copy_failed'] = __( 'Could not copy files.' ); $this->strings['copy_failed_space'] = __( 'Could not copy files. You may have run out of disk space.' ); $this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' ); $this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' ); } public function upgrade( $current, $args = array() ) { global $wp_filesystem; require ABSPATH . WPINC . '/version.php'; $start_time = time(); $defaults = array( 'pre_check_md5' => true, 'attempt_rollback' => false, 'do_rollback' => false, 'allow_relaxed_file_ownership' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); if ( ! isset( $current->response ) || 'latest' === $current->response ) { return new WP_Error( 'up_to_date', $this->strings['up_to_date'] ); } $res = $this->fs_connect( array( ABSPATH, WP_CONTENT_DIR ), $parsed_args['allow_relaxed_file_ownership'] ); if ( ! $res || is_wp_error( $res ) ) { return $res; } $wp_dir = trailingslashit( $wp_filesystem->abspath() ); $partial = true; if ( $parsed_args['do_rollback'] ) { $partial = false; } elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() ) { $partial = false; } if ( $parsed_args['do_rollback'] && $current->packages->rollback ) { $to_download = 'rollback'; } elseif ( $current->packages->partial && 'reinstall' !== $current->response && $wp_version === $current->partial_version && $partial ) { $to_download = 'partial'; } elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { $to_download = 'new_bundled'; } elseif ( $current->packages->no_content ) { $to_download = 'no_content'; } else { $to_download = 'full'; } $lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS ); if ( ! $lock ) { return new WP_Error( 'locked', $this->strings['locked'] ); } $download = $this->download_package( $current->packages->$to_download, true ); if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { apply_filters( 'update_feedback', $download->get_error_message() ); wp_version_check( array( 'signature_failure_code' => $download->get_error_code(), 'signature_failure_data' => $download->get_error_data(), ) ); $download = $download->get_error_data( 'softfail-filename' ); } if ( is_wp_error( $download ) ) { WP_Upgrader::release_lock( 'core_updater' ); return $download; } $working_dir = $this->unpack_package( $download ); if ( is_wp_error( $working_dir ) ) { WP_Upgrader::release_lock( 'core_updater' ); return $working_dir; } if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) { $wp_filesystem->delete( $working_dir, true ); WP_Upgrader::release_lock( 'core_updater' ); return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' ); } $wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE ); wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' ); require_once ABSPATH . 'wp-admin/includes/update-core.php'; if ( ! function_exists( 'update_core' ) ) { WP_Upgrader::release_lock( 'core_updater' ); return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] ); } $result = update_core( $working_dir, $wp_dir ); if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) { $try_rollback = false; if ( is_wp_error( $result ) ) { $error_code = $result->get_error_code(); if ( false !== strpos( $error_code, 'do_rollback' ) ) { $try_rollback = true; } elseif ( false !== strpos( $error_code, '__copy_dir' ) ) { $try_rollback = true; } elseif ( 'disk_full' === $error_code ) { $try_rollback = true; } } if ( $try_rollback ) { apply_filters( 'update_feedback', $result ); apply_filters( 'update_feedback', $this->strings['start_rollback'] ); $rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) ); $original_result = $result; $result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], (object) array( 'update' => $original_result, 'rollback' => $rollback_result, ) ); } } do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core', ) ); delete_site_transient( 'update_core' ); if ( ! $parsed_args['do_rollback'] ) { $stats = array( 'update_type' => $current->response, 'success' => true, 'fs_method' => $wp_filesystem->method, 'fs_method_forced' => defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' ), 'fs_method_direct' => ! empty( $GLOBALS['_wp_filesystem_direct_method'] ) ? $GLOBALS['_wp_filesystem_direct_method'] : '', 'time_taken' => time() - $start_time, 'reported' => $wp_version, 'attempted' => $current->version, ); if ( is_wp_error( $result ) ) { $stats['success'] = false; if ( ! empty( $try_rollback ) ) { $stats['error_code'] = $original_result->get_error_code(); $stats['error_data'] = $original_result->get_error_data(); $stats['rollback'] = ! is_wp_error( $rollback_result ); if ( is_wp_error( $rollback_result ) ) { $stats['rollback_code'] = $rollback_result->get_error_code(); $stats['rollback_data'] = $rollback_result->get_error_data(); } } else { $stats['error_code'] = $result->get_error_code(); $stats['error_data'] = $result->get_error_data(); } } wp_version_check( $stats ); } WP_Upgrader::release_lock( 'core_updater' ); return $result; } public static function should_update_to_version( $offered_ver ) { require ABSPATH . WPINC . '/version.php'; $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); $current_is_development_version = (bool) strpos( $wp_version, '-' ); $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { $upgrade_dev = true; $upgrade_minor = true; $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { $upgrade_dev = false; $upgrade_minor = true; $upgrade_major = false; } } if ( $offered_ver === $wp_version ) { return false; } if ( version_compare( $wp_version, $offered_ver, '>' ) ) { return false; } $failure_data = get_site_option( 'auto_core_update_failed' ); if ( $failure_data ) { if ( ! empty( $failure_data['critical'] ) ) { return false; } if ( $wp_version === $failure_data['current'] && false !== strpos( $offered_ver, '.1.next.minor' ) ) { return false; } if ( empty( $failure_data['retry'] ) && $wp_version === $failure_data['current'] && $offered_ver === $failure_data['attempted'] ) { return false; } } if ( $current_is_development_version ) { if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) ) { return false; } } if ( $current_branch === $new_branch ) { return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); } if ( version_compare( $new_branch, $current_branch, '>' ) ) { return apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); } return false; } public function check_files() { global $wp_version, $wp_local_package; $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); if ( ! is_array( $checksums ) ) { return false; } foreach ( $checksums as $file => $checksum ) { if ( 'wp-content' === substr( $file, 0, 10 ) ) { continue; } if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) { return false; } } return true; } } method = 'direct'; $this->errors = new WP_Error(); } public function get_contents( $file ) { return @file_get_contents( $file ); } public function get_contents_array( $file ) { return @file( $file ); } public function put_contents( $file, $contents, $mode = false ) { $fp = @fopen( $file, 'wb' ); if ( ! $fp ) { return false; } mbstring_binary_safe_encoding(); $data_length = strlen( $contents ); $bytes_written = fwrite( $fp, $contents ); reset_mbstring_encoding(); fclose( $fp ); if ( $data_length !== $bytes_written ) { return false; } $this->chmod( $file, $mode ); return true; } public function cwd() { return getcwd(); } public function chdir( $dir ) { return @chdir( $dir ); } public function chgrp( $file, $group, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive ) { return chgrp( $file, $group ); } if ( ! $this->is_dir( $file ) ) { return chgrp( $file, $group ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chgrp( $file . $filename, $group, $recursive ); } return true; } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( ! $recursive || ! $this->is_dir( $file ) ) { return chmod( $file, $mode ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . $filename, $mode, $recursive ); } return true; } public function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive ) { return chown( $file, $owner ); } if ( ! $this->is_dir( $file ) ) { return chown( $file, $owner ); } $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chown( $file . '/' . $filename, $owner, $recursive ); } return true; } public function owner( $file ) { $owneruid = @fileowner( $file ); if ( ! $owneruid ) { return false; } if ( ! function_exists( 'posix_getpwuid' ) ) { return $owneruid; } $ownerarray = posix_getpwuid( $owneruid ); if ( ! $ownerarray ) { return false; } return $ownerarray['name']; } public function getchmod( $file ) { return substr( decoct( @fileperms( $file ) ), -3 ); } public function group( $file ) { $gid = @filegroup( $file ); if ( ! $gid ) { return false; } if ( ! function_exists( 'posix_getgrgid' ) ) { return $gid; } $grouparray = posix_getgrgid( $gid ); if ( ! $grouparray ) { return false; } return $grouparray['name']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $rtval = copy( $source, $destination ); if ( $mode ) { $this->chmod( $destination, $mode ); } return $rtval; } public function move( $source, $destination, $overwrite = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } if ( @rename( $source, $destination ) ) { return true; } if ( $this->copy( $source, $destination, $overwrite ) && $this->exists( $destination ) ) { $this->delete( $source ); return true; } else { return false; } } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } $file = str_replace( '\\', '/', $file ); if ( 'f' === $type || $this->is_file( $file ) ) { return @unlink( $file ); } if ( ! $recursive && $this->is_dir( $file ) ) { return @rmdir( $file ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file, true ); $retval = true; if ( is_array( $filelist ) ) { foreach ( $filelist as $filename => $fileinfo ) { if ( ! $this->delete( $file . $filename, $recursive, $fileinfo['type'] ) ) { $retval = false; } } } if ( file_exists( $file ) && ! @rmdir( $file ) ) { $retval = false; } return $retval; } public function exists( $file ) { return @file_exists( $file ); } public function is_file( $file ) { return @is_file( $file ); } public function is_dir( $path ) { return @is_dir( $path ); } public function is_readable( $file ) { return @is_readable( $file ); } public function is_writable( $file ) { return @is_writable( $file ); } public function atime( $file ) { return @fileatime( $file ); } public function mtime( $file ) { return @filemtime( $file ); } public function size( $file ) { return @filesize( $file ); } public function touch( $file, $time = 0, $atime = 0 ) { if ( 0 === $time ) { $time = time(); } if ( 0 === $atime ) { $atime = time(); } return touch( $file, $time, $atime ); } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } if ( ! @mkdir( $path ) ) { return false; } $this->chmod( $path, $chmod ); if ( $chown ) { $this->chown( $path, $chown ); } if ( $chgrp ) { $this->chgrp( $path, $chgrp ); } return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path, $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ); } else { $limit_file = false; } if ( ! $this->is_dir( $path ) || ! $this->is_readable( $path ) ) { return false; } $dir = dir( $path ); if ( ! $dir ) { return false; } $ret = array(); while ( false !== ( $entry = $dir->read() ) ) { $struc = array(); $struc['name'] = $entry; if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } $struc['perms'] = $this->gethchmod( $path . '/' . $entry ); $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $struc['number'] = false; $struc['owner'] = $this->owner( $path . '/' . $entry ); $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset( $dir ); return $ret; } } method = 'ftpsockets'; $this->errors = new WP_Error(); if ( ! include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) { return; } $this->ftp = new ftp(); if ( empty( $opt['port'] ) ) { $this->options['port'] = 21; } else { $this->options['port'] = (int) $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); } else { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { $this->errors->add( 'empty_password', __( 'FTP password is required' ) ); } else { $this->options['password'] = $opt['password']; } } public function connect() { if ( ! $this->ftp ) { return false; } $this->ftp->setTimeout( FS_CONNECT_TIMEOUT ); if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->ftp->connect() ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->ftp->login( $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } $this->ftp->SetType( FTP_BINARY ); $this->ftp->Passive( true ); $this->ftp->setTimeout( FS_TIMEOUT ); return true; } public function get_contents( $file ) { if ( ! $this->exists( $file ) ) { return false; } $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); if ( ! $this->ftp->fget( $temphandle, $file ) ) { fclose( $temphandle ); unlink( $tempfile ); reset_mbstring_encoding(); return ''; } reset_mbstring_encoding(); fseek( $temphandle, 0 ); $contents = ''; while ( ! feof( $temphandle ) ) { $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); } fclose( $temphandle ); unlink( $tempfile ); return $contents; } public function get_contents_array( $file ) { return explode( "\n", $this->get_contents( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $tempfile = wp_tempnam( $file ); $temphandle = @fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); $bytes_written = fwrite( $temphandle, $contents ); if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) { fclose( $temphandle ); unlink( $tempfile ); reset_mbstring_encoding(); return false; } fseek( $temphandle, 0 ); $ret = $this->ftp->fput( $file, $temphandle ); reset_mbstring_encoding(); fclose( $temphandle ); unlink( $tempfile ); $this->chmod( $file, $mode ); return $ret; } public function cwd() { $cwd = $this->ftp->pwd(); if ( $cwd ) { $cwd = trailingslashit( $cwd ); } return $cwd; } public function chdir( $dir ) { return $this->ftp->chdir( $dir ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( $recursive && $this->is_dir( $file ) ) { $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . '/' . $filename, $mode, $recursive ); } } return $this->ftp->chmod( $file, $mode ); } public function owner( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['owner']; } public function getchmod( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['permsn']; } public function group( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['group']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { return $this->ftp->rename( $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } if ( 'f' === $type || $this->is_file( $file ) ) { return $this->ftp->delete( $file ); } if ( ! $recursive ) { return $this->ftp->rmdir( $file ); } return $this->ftp->mdel( $file ); } public function exists( $file ) { $list = $this->ftp->nlist( $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; } return ! empty( $list ); } public function is_file( $file ) { if ( $this->is_dir( $file ) ) { return false; } if ( $this->exists( $file ) ) { return true; } return false; } public function is_dir( $path ) { $cwd = $this->cwd(); if ( $this->chdir( $path ) ) { $this->chdir( $cwd ); return true; } return false; } public function is_readable( $file ) { return true; } public function is_writable( $file ) { return true; } public function atime( $file ) { return false; } public function mtime( $file ) { return $this->ftp->mdtm( $file ); } public function size( $file ) { return $this->ftp->filesize( $file ); } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $this->ftp->mkdir( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } $this->chmod( $path, $chmod ); return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ) . '/'; } else { $limit_file = false; } mbstring_binary_safe_encoding(); $list = $this->ftp->dirlist( $path ); if ( empty( $list ) && ! $this->exists( $path ) ) { reset_mbstring_encoding(); return false; } $ret = array(); foreach ( $list as $struc ) { if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } if ( $struc['islink'] ) { $struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] ); } $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $ret[ $struc['name'] ] = $struc; } reset_mbstring_encoding(); return $ret; } public function __destruct() { $this->ftp->quit(); } } strings['up_to_date'] = __( 'The theme is at the latest version.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); $this->strings['process_failed'] = __( 'Theme update failed.' ); $this->strings['process_success'] = __( 'Theme updated successfully.' ); } public function install_strings() { $this->strings['no_package'] = __( 'Installation package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the package…' ); $this->strings['installing_package'] = __( 'Installing the theme…' ); $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); $this->strings['no_files'] = __( 'The theme contains no files.' ); $this->strings['process_failed'] = __( 'Theme installation failed.' ); $this->strings['process_success'] = __( 'Theme installed successfully.' ); $this->strings['process_success_specific'] = __( 'Successfully installed the theme %1$s %2$s.' ); $this->strings['parent_theme_search'] = __( 'This theme requires a parent theme. Checking if it is installed…' ); $this->strings['parent_theme_prepare_install'] = __( 'Preparing to install %1$s %2$s…' ); $this->strings['parent_theme_currently_installed'] = __( 'The parent theme, %1$s %2$s, is currently installed.' ); $this->strings['parent_theme_install_success'] = __( 'Successfully installed the parent theme, %1$s %2$s.' ); $this->strings['parent_theme_not_found'] = sprintf( __( 'The parent theme could not be found. You will need to install the parent theme, %s, before you can use this child theme.' ), '%s' ); $this->strings['current_theme_has_errors'] = __( 'The active theme has the following error: "%s".' ); if ( ! empty( $this->skin->overwrite ) ) { if ( 'update-theme' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Updating the theme…' ); $this->strings['process_failed'] = __( 'Theme update failed.' ); $this->strings['process_success'] = __( 'Theme updated successfully.' ); } if ( 'downgrade-theme' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Downgrading the theme…' ); $this->strings['process_failed'] = __( 'Theme downgrade failed.' ); $this->strings['process_success'] = __( 'Theme downgraded successfully.' ); } } } public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { $theme_info = $this->theme_info(); if ( ! $theme_info->parent() ) { return $install_result; } $this->skin->feedback( 'parent_theme_search' ); if ( ! $theme_info->parent()->errors() ) { $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display( 'Name' ), $theme_info->parent()->display( 'Version' ) ); return $install_result; } $api = themes_api( 'theme_information', array( 'slug' => $theme_info->get( 'Template' ), 'fields' => array( 'sections' => false, 'tags' => false, ), ) ); if ( ! $api || is_wp_error( $api ) ) { $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); return $install_result; } $child_api = $this->skin->api; $child_success_message = $this->strings['process_success']; $this->skin->api = $api; $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); add_filter( 'install_theme_complete_actions', '__return_false', 999 ); $parent_result = $this->run( array( 'package' => $api->download_link, 'destination' => get_theme_root(), 'clear_destination' => false, 'clear_working' => true, ) ); if ( is_wp_error( $parent_result ) ) { add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); } remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); $this->result = $child_result; $this->skin->api = $child_api; $this->strings['process_success'] = $child_success_message; return $install_result; } public function hide_activate_preview_actions( $actions ) { unset( $actions['activate'], $actions['preview'] ); return $actions; } public function install( $package, $args = array() ) { $defaults = array( 'clear_update_cache' => true, 'overwrite_package' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->install_strings(); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); add_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ), 10, 3 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $package, 'destination' => get_theme_root(), 'clear_destination' => $parsed_args['overwrite_package'], 'clear_working' => true, 'hook_extra' => array( 'type' => 'theme', 'action' => 'install', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); remove_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); if ( $parsed_args['overwrite_package'] ) { do_action( 'upgrader_overwrote_package', $package, $this->new_theme_data, 'theme' ); } return true; } public function upgrade( $theme, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->before(); $this->skin->set_result( false ); $this->skin->error( 'up_to_date' ); $this->skin->after(); return false; } $r = $current->response[ $theme ]; add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array( 'theme' => $theme, 'type' => 'theme', 'action' => 'update', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $theme ] ) ) { unset( $past_failure_emails[ $theme ] ); update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; } public function bulk_upgrade( $themes, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_themes' ); add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); $maintenance = ( is_multisite() && ! empty( $themes ) ); foreach ( $themes as $theme ) { $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme; } if ( $maintenance ) { $this->maintenance_mode( true ); } $results = array(); $this->update_count = count( $themes ); $this->update_current = 0; foreach ( $themes as $theme ) { $this->update_current++; $this->skin->theme_info = $this->theme_info( $theme ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->set_result( true ); $this->skin->before(); $this->skin->feedback( 'up_to_date' ); $this->skin->after(); $results[ $theme ] = true; continue; } $r = $current->response[ $theme ]; $result = $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'theme' => $theme, ), ) ); $results[ $theme ] = $result; if ( false === $result ) { break; } } $this->maintenance_mode( false ); wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true, 'themes' => $themes, ) ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $theme => $result ) { if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) { continue; } unset( $past_failure_emails[ $theme ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } public function check_package( $source ) { global $wp_filesystem, $wp_version; $this->new_theme_data = array(); if ( is_wp_error( $source ) ) { return $source; } $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { return $source; } if ( ! file_exists( $working_directory . 'style.css' ) ) { return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], sprintf( __( 'The theme is missing the %s stylesheet.' ), 'style.css' ) ); } $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Version' => 'Version', 'Author' => 'Author', 'Template' => 'Template', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', ) ); if ( empty( $info['Name'] ) ) { return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], sprintf( __( 'The %s stylesheet does not contain a valid theme header.' ), 'style.css' ) ); } if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) && ! file_exists( $working_directory . 'templates/index.html' ) && ! file_exists( $working_directory . 'block-templates/index.html' ) ) { return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], sprintf( __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. Child themes need to have a %4$s header in the %5$s stylesheet.' ), 'templates/index.html', 'index.php', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), 'Template', 'style.css' ) ); } $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ), phpversion(), $requires_php ); return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ), $wp_version, $requires_wp ); return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); } $this->new_theme_data = $info; return $source; } public function current_before( $response, $theme ) { if ( is_wp_error( $response ) ) { return $response; } $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; if ( get_stylesheet() !== $theme ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( true ); } return $response; } public function current_after( $response, $theme ) { if ( is_wp_error( $response ) ) { return $response; } $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; if ( get_stylesheet() !== $theme ) { return $response; } if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) { wp_clean_themes_cache(); $stylesheet = $this->result['destination_name']; switch_theme( $stylesheet ); } if ( ! $this->bulk ) { $this->maintenance_mode( false ); } return $response; } public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) { global $wp_filesystem; if ( is_wp_error( $removed ) ) { return $removed; } if ( ! isset( $theme['theme'] ) ) { return $removed; } $theme = $theme['theme']; $themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) ); if ( $wp_filesystem->exists( $themes_dir . $theme ) ) { if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) { return false; } } return true; } public function theme_info( $theme = null ) { if ( empty( $theme ) ) { if ( ! empty( $this->result['destination_name'] ) ) { $theme = $this->result['destination_name']; } else { return false; } } $theme = wp_get_theme( $theme ); $theme->cache_delete(); return $theme; } } array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array(), ), ); $theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true, 'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true, 'tags' => true, 'num_ratings' => true, ); function install_themes_feature_list() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' ); $cache = get_transient( 'wporg_theme_feature_list' ); if ( ! $cache ) { set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); } if ( $cache ) { return $cache; } $feature_list = themes_api( 'feature_list', array() ); if ( is_wp_error( $feature_list ) ) { return array(); } set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); return $feature_list; } function install_theme_search_form( $type_selector = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; if ( ! $type_selector ) { echo '

      ' . __( 'Search for themes by keyword.' ) . '

      '; } ?> +
      + + + + + + + + + + +
      + +

      +

      -@media screen and (min-width: 1670px) { - .customize-preview-header.themes-filter-bar { - width: 82%; - right: 0; - left: initial; - } -} +
      + + '; foreach ( (array) $feature_list as $feature_name => $features ) { $feature_name = esc_html( $feature_name ); echo '
      ' . $feature_name . '
      '; echo '
        '; foreach ( $features as $feature => $feature_name ) { $feature_name = esc_html( $feature_name ); $feature = esc_attr( $feature ); ?> -.themes-filter-bar .themes-filter-container { - margin: 0; - padding: 0; -} +
      1. + + +
      2. -.themes-filter-bar .wp-filter-search { - line-height: 1.8; - padding: 6px 10px 6px 30px; - max-width: 100%; - width: 40%; - min-width: 300px; - position: absolute; - top: 6px; - left: 25px; - height: 32px; - margin: 1px 0; -} + +
      +
      + -/* Unstick the filter bar on short windows/screens. This breakpoint is based on the - current length of .org feature filters assuming translations do not wrap lines. */ -@media screen and (max-height: 540px), screen and (max-width: 1018px) { - .customize-preview-header.themes-filter-bar { - position: relative; - left: 0; - width: 100%; - margin: 0 0 25px; - } - .filter-drawer { - top: 46px; - } - .wp-customizer .theme-browser .themes { - padding: 0 0 25px 25px; - overflow: hidden; - } + +
      + +
      + +

      +
      + + + + +
      + prepare_items(); $wp_list_table->single_row( $theme ); } function display_themes() { global $wp_list_table; if ( ! isset( $wp_list_table ) ) { $wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' ); } $wp_list_table->prepare_items(); $wp_list_table->display(); } function install_theme_information() { global $wp_list_table; $theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) ); if ( is_wp_error( $theme ) ) { wp_die( $theme ); } iframe_header( __( 'Theme Installation' ) ); if ( ! isset( $wp_list_table ) ) { $wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' ); } $wp_list_table->theme_installer_single( $theme ); iframe_footer(); exit; } 'bookmarks', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'manage_links' ); } public function prepare_items() { global $cat_id, $s, $orderby, $order; wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) ); $args = array( 'hide_invisible' => 0, 'hide_empty' => 0, ); if ( 'all' !== $cat_id ) { $args['category'] = $cat_id; } if ( ! empty( $s ) ) { $args['search'] = $s; } if ( ! empty( $orderby ) ) { $args['orderby'] = $orderby; } if ( ! empty( $order ) ) { $args['order'] = $order; } $this->items = get_bookmarks( $args ); } public function no_items() { _e( 'No links found.' ); } protected function get_bulk_actions() { $actions = array(); $actions['delete'] = __( 'Delete' ); return $actions; } protected function extra_tablenav( $which ) { global $cat_id; if ( 'top' !== $which ) { return; } ?> +
      + $cat_id, 'name' => 'cat_id', 'taxonomy' => 'link_category', 'show_option_all' => get_taxonomy( 'link_category' )->labels->all_items, 'hide_empty' => true, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', ); echo ''; wp_dropdown_categories( $dropdown_options ); submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); ?> +
      + '', 'name' => _x( 'Name', 'link name' ), 'url' => __( 'URL' ), 'categories' => __( 'Categories' ), 'rel' => __( 'Relationship' ), 'visible' => __( 'Visible' ), 'rating' => __( 'Rating' ), ); } protected function get_sortable_columns() { return array( 'name' => 'name', 'url' => 'url', 'visible' => 'visible', 'rating' => 'rating', ); } protected function get_default_primary_column_name() { return 'name'; } public function column_cb( $item ) { $link = $item; ?> + + + %s', $edit_link, esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ), $link->link_name ); } public function column_url( $link ) { $short_url = url_shorten( $link->link_url ); echo "$short_url"; } public function column_categories( $link ) { global $cat_id; $cat_names = array(); foreach ( $link->link_category as $category ) { $cat = get_term( $category, 'link_category', OBJECT, 'display' ); if ( is_wp_error( $cat ) ) { echo $cat->get_error_message(); } $cat_name = $cat->name; if ( (int) $cat_id !== $category ) { $cat_name = "$cat_name"; } $cat_names[] = $cat_name; } echo implode( ', ', $cat_names ); } public function column_rel( $link ) { echo empty( $link->link_rel ) ? '
      ' : $link->link_rel; } public function column_visible( $link ) { if ( 'Y' === $link->link_visible ) { _e( 'Yes' ); } else { _e( 'No' ); } } public function column_rating( $link ) { echo $link->link_rating; } public function column_default( $item, $column_name ) { do_action( 'manage_link_custom_column', $column_name, $item->link_id ); } public function display_rows() { foreach ( $this->items as $link ) { $link = sanitize_bookmark( $link ); $link->link_name = esc_attr( $link->link_name ); $link->link_category = wp_get_link_cats( $link->link_id ); ?> + + single_row_columns( $link ); ?> + + ' . __( 'Edit' ) . ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ), esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ), __( 'Delete' ) ); return $this->row_actions( $actions ); } } '', 'nonce' => '', 'title' => '', 'context' => false, ); $this->options = wp_parse_args( $args, $defaults ); } public function set_upgrader( &$upgrader ) { if ( is_object( $upgrader ) ) { $this->upgrader =& $upgrader; } $this->add_strings(); } public function add_strings() { } public function set_result( $result ) { $this->result = $result; } public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) { $url = $this->options['url']; if ( ! $context ) { $context = $this->options['context']; } if ( ! empty( $this->options['nonce'] ) ) { $url = wp_nonce_url( $url, $this->options['nonce'] ); } $extra_fields = array(); return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership ); } public function header() { if ( $this->done_header ) { return; } $this->done_header = true; echo '
      '; echo '

      ' . $this->options['title'] . '

      '; } public function footer() { if ( $this->done_footer ) { return; } $this->done_footer = true; echo '
      '; } public function error( $errors ) { if ( ! $this->done_header ) { $this->header(); } if ( is_string( $errors ) ) { $this->feedback( $errors ); } elseif ( is_wp_error( $errors ) && $errors->has_errors() ) { foreach ( $errors->get_error_messages() as $message ) { if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { $this->feedback( $message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); } else { $this->feedback( $message ); } } } } public function feedback( $feedback, ...$args ) { if ( isset( $this->upgrader->strings[ $feedback ] ) ) { $feedback = $this->upgrader->strings[ $feedback ]; } if ( strpos( $feedback, '%' ) !== false ) { if ( $args ) { $args = array_map( 'strip_tags', $args ); $args = array_map( 'esc_html', $args ); $feedback = vsprintf( $feedback, $args ); } } if ( empty( $feedback ) ) { return; } show_message( $feedback ); } public function before() {} public function after() {} protected function decrement_update_count( $type ) { if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { echo ''; } else { echo ''; } } public function bulk_header() {} public function bulk_footer() {} public function hide_process_failed( $wp_error ) { return false; } } per_page ) ) { $args->per_page = 24; } } if ( ! isset( $args->locale ) ) { $args->locale = get_user_locale(); } if ( ! isset( $args->wp_version ) ) { $args->wp_version = substr( $wp_version, 0, 3 ); } $args = apply_filters( 'plugins_api_args', $args, $action ); $res = apply_filters( 'plugins_api', false, $action, $args ); if ( false === $res ) { $url = 'http://api.wordpress.org/plugins/info/1.2/'; $url = add_query_arg( array( 'action' => $action, 'request' => $args, ), $url ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $http_args = array( 'timeout' => 15, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); $request = wp_remote_get( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { if ( ! wp_is_json_request() ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); } $request = wp_remote_get( $http_url, $http_args ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'plugins_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( is_array( $res ) ) { $res = (object) $res; } elseif ( null === $res ) { $res = new WP_Error( 'plugins_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } if ( isset( $res->error ) ) { $res = new WP_Error( 'plugins_api_failed', $res->error ); } } } elseif ( ! is_wp_error( $res ) ) { $res->external = true; } return apply_filters( 'plugins_api_result', $res, $action, $args ); } function install_popular_tags( $args = array() ) { $key = md5( serialize( $args ) ); $tags = get_site_transient( 'poptags_' . $key ); if ( false !== $tags ) { return $tags; } $tags = plugins_api( 'hot_tags', $args ); if ( is_wp_error( $tags ) ) { return $tags; } set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS ); return $tags; } function install_dashboard() { display_plugins_table(); ?> - .control-panel-themes .customize-themes-full-container { - margin-top: 0; - padding: 0; - height: 100%; - width: calc(100% - 300px); - } -} + '; } function install_search_form( $deprecated = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; ?> +
      + + + + + + 'search-submit' ) ); ?> +
      + +
      +

      +
      + + + + +
      +
      + +

      +
      + +

      + + + + +

      +
      + ' . __( 'You are using a development version of WordPress. These feature plugins are also under development. Learn more.' ) . '

      ', 'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/' ); break; case 'install_plugins_featured': printf( '

      ' . __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the WordPress Plugin Directory or upload a plugin in .zip format by clicking the button at the top of this page.' ) . '

      ', __( 'https://wordpress.org/plugins/' ) ); break; case 'install_plugins_recommended': echo '

      ' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '

      '; break; case 'install_plugins_favorites': if ( empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) { return; } break; } ?> +
      + display(); ?> +
      + response ) ) { foreach ( (array) $update_plugins->response as $file => $plugin ) { if ( $plugin->slug === $api->slug ) { $status = 'update_available'; $update_file = $file; $version = $plugin->new_version; if ( current_user_can( 'update_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $update_file ), 'upgrade-plugin_' . $update_file ); } break; } } } if ( 'install' === $status ) { if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) { $installed_plugin = get_plugins( '/' . $api->slug ); if ( empty( $installed_plugin ) ) { if ( current_user_can( 'install_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug ); } } else { $key = array_keys( $installed_plugin ); $key = reset( $key ); $update_file = $api->slug . '/' . $key; if ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '=' ) ) { $status = 'latest_installed'; } elseif ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '<' ) ) { $status = 'newer_installed'; $version = $installed_plugin[ $key ]['Version']; } else { if ( ! $loop ) { delete_site_transient( 'update_plugins' ); wp_update_plugins(); return install_plugin_install_status( $api, true ); } } } } else { if ( current_user_can( 'install_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug ); } } } if ( isset( $_GET['from'] ) ) { $url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) ); } $file = $update_file; return compact( 'status', 'url', 'version', 'file' ); } function install_plugin_information() { global $tab; if ( empty( $_REQUEST['plugin'] ) ) { return; } $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), ) ); if ( is_wp_error( $api ) ) { wp_die( $api ); } $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 'p' => array(), 'br' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array(), ), 'blockquote' => array( 'cite' => true ), ); $plugins_section_titles = array( 'description' => _x( 'Description', 'Plugin installer section title' ), 'installation' => _x( 'Installation', 'Plugin installer section title' ), 'faq' => _x( 'FAQ', 'Plugin installer section title' ), 'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ), 'changelog' => _x( 'Changelog', 'Plugin installer section title' ), 'reviews' => _x( 'Reviews', 'Plugin installer section title' ), 'other_notes' => _x( 'Other Notes', 'Plugin installer section title' ), ); foreach ( (array) $api->sections as $section_name => $content ) { $api->sections[ $section_name ] = wp_kses( $content, $plugins_allowedtags ); } foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) { if ( isset( $api->$key ) ) { $api->$key = wp_kses( $api->$key, $plugins_allowedtags ); } } $_tab = esc_attr( $tab ); $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) { $section_titles = array_keys( (array) $api->sections ); $section = reset( $section_titles ); } iframe_header( __( 'Plugin Installation' ) ); $_with_banner = ''; if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) { $_with_banner = 'with-banner'; $low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low']; $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high']; ?> + + '; echo "

      {$api->name}

      "; echo "
      \n"; foreach ( (array) $api->sections as $section_name => $content ) { if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) { continue; } if ( isset( $plugins_section_titles[ $section_name ] ) ) { $title = $plugins_section_titles[ $section_name ]; } else { $title = ucwords( str_replace( '_', ' ', $section_name ) ); } $class = ( $section_name === $section ) ? ' class="current"' : ''; $href = add_query_arg( array( 'tab' => $tab, 'section' => $section_name, ) ); $href = esc_url( $href ); $san_section = esc_attr( $section_name ); echo "\t$title\n"; } echo "
      \n"; ?> +
      +
      +
        + version ) ) { ?> +
      • version; ?>
      • + author ) ) { ?> +
      • author, '_blank' ); ?>
      • + last_updated ) ) { ?> +
      • + last_updated ) ) ); ?> +
      • + requires ) ) { ?> +
      • + + requires ); ?> +
      • + tested ) ) { ?> +
      • tested; ?>
      • + requires_php ) ) { ?> +
      • + + requires_php ); ?> +
      • + active_installs ) ) { ?> +
      • + active_installs >= 1000000 ) { $active_installs_millions = floor( $api->active_installs / 1000000 ); printf( _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), number_format_i18n( $active_installs_millions ) ); } elseif ( $api->active_installs < 10 ) { _ex( 'Less Than 10', 'Active plugin installations' ); } else { echo number_format_i18n( $api->active_installs ) . '+'; } ?> +
      • + slug ) && empty( $api->external ) ) { ?> +
      • + homepage ) ) { ?> +
      • + donate_link ) && empty( $api->contributors ) ) { ?> +
      • + +
      + rating ) ) { ?> +

      + $api->rating, 'type' => 'percent', 'number' => $api->num_ratings, ) ); ?> + + ratings ) && array_sum( (array) $api->ratings ) > 0 ) { ?> +

      +

      + ratings as $key => $ratecount ) { $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0; $aria_label = esc_attr( sprintf( _n( 'Reviews with %1$d star: %2$s. Opens in a new tab.', 'Reviews with %1$d stars: %2$s. Opens in a new tab.', $key ), $key, number_format_i18n( $ratecount ) ) ); ?> +
      + + %s', "https://wordpress.org/support/plugin/{$api->slug}/reviews/?filter={$key}", $aria_label, sprintf( _n( '%d star', '%d stars', $key ), $key ) ); ?> + + + + + +
      + contributors ) ) { ?> +

      +
        + contributors as $contrib_username => $contrib_details ) { $contrib_name = $contrib_details['display_name']; if ( ! $contrib_name ) { $contrib_name = $contrib_username; } $contrib_name = esc_html( $contrib_name ); $contrib_profile = esc_url( $contrib_details['profile'] ); $contrib_avatar = esc_url( add_query_arg( 's', '36', $contrib_details['avatar'] ) ); echo "
      • {$contrib_name}
      • "; } ?> +
      + donate_link ) ) { ?> + + + +
      +
      + requires_php ) ? $api->requires_php : null; $requires_wp = isset( $api->requires ) ? $api->requires : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); $tested_wp = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) ); if ( ! $compatible_php ) { echo '

      '; _e( 'Error: This plugin requires a newer version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Click here to learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } else { echo '

      '; } echo '
      '; } if ( ! $tested_wp ) { echo '

      '; _e( 'Warning: This plugin has not been tested with your current version of WordPress.' ); echo '

      '; } elseif ( ! $compatible_wp ) { echo '

      '; _e( 'Error: This plugin requires a newer version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Click here to update WordPress.' ), self_admin_url( 'update-core.php' ) ); } echo '

      '; } foreach ( (array) $api->sections as $section_name => $content ) { $content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' ); $content = links_add_target( $content, '_blank' ); $san_section = esc_attr( $section_name ); $display = ( $section_name === $section ) ? 'block' : 'none'; echo "\t
      \n"; echo $content; echo "\t
      \n"; } echo "
      \n"; echo "
      \n"; echo "\n"; echo "\n"; iframe_footer(); exit; } get_items_per_page( 'users_network_per_page' ); $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; $paged = $this->get_pagenum(); $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta', ); if ( wp_is_large_network( 'users' ) ) { $args['search'] = ltrim( $args['search'], '*' ); } elseif ( '' !== $args['search'] ) { $args['search'] = trim( $args['search'], '*' ); $args['search'] = '*' . $args['search'] . '*'; } if ( 'super' === $role ) { $args['login__in'] = get_super_admins(); } if ( ! $usersearch && wp_is_large_network( 'users' ) ) { if ( ! isset( $_REQUEST['orderby'] ) ) { $_GET['orderby'] = 'id'; $_REQUEST['orderby'] = 'id'; } if ( ! isset( $_REQUEST['order'] ) ) { $_GET['order'] = 'DESC'; $_REQUEST['order'] = 'DESC'; } $args['count_total'] = false; } if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } $args = apply_filters( 'users_list_table_query_args', $args ); $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); $this->set_pagination_args( array( 'total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page, ) ); } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); } $actions['spam'] = _x( 'Mark as spam', 'user' ); $actions['notspam'] = _x( 'Not spam', 'user' ); return $actions; } public function no_items() { _e( 'No users found.' ); } protected function get_views() { global $role; $total_users = get_user_count(); $super_admins = get_super_admins(); $total_admins = count( $super_admins ); $current_link_attributes = 'super' !== $role ? ' class="current" aria-current="page"' : ''; $role_links = array(); $role_links['all'] = sprintf( '%s', network_admin_url( 'users.php' ), $current_link_attributes, sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) ); $current_link_attributes = 'super' === $role ? ' class="current" aria-current="page"' : ''; $role_links['super'] = sprintf( '%s', network_admin_url( 'users.php?role=super' ), $current_link_attributes, sprintf( _n( 'Super Admin (%s)', 'Super Admins (%s)', $total_admins ), number_format_i18n( $total_admins ) ) ); return $role_links; } protected function pagination( $which ) { global $mode; parent::pagination( $which ); if ( 'top' === $which ) { $this->view_switcher( $mode ); } } public function get_columns() { $users_columns = array( 'cb' => '', 'username' => __( 'Username' ), 'name' => __( 'Name' ), 'email' => __( 'Email' ), 'registered' => _x( 'Registered', 'user' ), 'blogs' => __( 'Sites' ), ); return apply_filters( 'wpmu_users_columns', $users_columns ); } protected function get_sortable_columns() { return array( 'username' => 'login', 'name' => 'name', 'email' => 'email', 'registered' => 'id', ); } public function column_cb( $item ) { $user = $item; if ( is_super_admin( $user->ID ) ) { return; } ?> + + + ID; } public function column_username( $user ) { $super_admins = get_super_admins(); $avatar = get_avatar( $user->user_email, 32 ); echo $avatar; if ( current_user_can( 'edit_user', $user->ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $edit = "{$user->user_login}"; } else { $edit = $user->user_login; } ?> + + user_login, $super_admins, true ) ) { echo ' — ' . __( 'Super Admin' ); } ?> + + first_name && $user->last_name ) { echo "$user->first_name $user->last_name"; } elseif ( $user->first_name ) { echo $user->first_name; } elseif ( $user->last_name ) { echo $user->last_name; } else { echo '' . _x( 'Unknown', 'name' ) . ''; } } public function column_email( $user ) { echo "$user->user_email"; } public function column_registered( $user ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } echo mysql2date( $date, $user->user_registered ); } protected function _column_blogs( $user, $classes, $data, $primary ) { echo ''; echo $this->column_blogs( $user ); echo $this->handle_row_actions( $user, 'blogs', $primary ); echo ''; } public function column_blogs( $user ) { $blogs = get_blogs_of_user( $user->ID, true ); if ( ! is_array( $blogs ) ) { return; } foreach ( $blogs as $site ) { if ( ! can_edit_network( $site->site_id ) ) { continue; } $path = ( '/' === $site->path ) ? '' : $site->path; $site_classes = array( 'site-' . $site->site_id ); $site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $site->userblog_id, $site->site_id, $user ); if ( is_array( $site_classes ) && ! empty( $site_classes ) ) { $site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) ); echo ''; } else { echo ''; } echo '' . str_replace( '.' . get_network()->domain, '', $site->domain . $path ) . ''; echo ' '; $actions = array(); $actions['edit'] = '' . __( 'Edit' ) . ''; $class = ''; if ( 1 === (int) $site->spam ) { $class .= 'site-spammed '; } if ( 1 === (int) $site->mature ) { $class .= 'site-mature '; } if ( 1 === (int) $site->deleted ) { $class .= 'site-deleted '; } if ( 1 === (int) $site->archived ) { $class .= 'site-archived '; } $actions['view'] = '' . __( 'View' ) . ''; $actions = apply_filters( 'ms_user_list_site_actions', $actions, $site->userblog_id ); $action_count = count( $actions ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; $sep = ( $i < $action_count ) ? ' | ' : ''; echo "$link$sep"; } echo '
      '; } } public function column_default( $item, $column_name ) { echo apply_filters( 'manage_users_custom_column', '', $column_name, $item->ID ); } public function display_rows() { foreach ( $this->items as $user ) { $class = ''; $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted', ); foreach ( $status_list as $status => $col ) { if ( $user->$status ) { $class .= " $col"; } } ?> + + single_row_columns( $user ); ?> + + ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $actions['edit'] = '' . __( 'Edit' ) . ''; } if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) { $actions['delete'] = '' . __( 'Delete' ) . ''; } $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); return $this->row_actions( $actions ); } } get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments + WHERE comment_author = %s AND $date_field = %s", stripslashes( $comment_author ), stripslashes( $comment_date ) ) ); } function edit_comment() { if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) { wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); } if ( isset( $_POST['newcomment_author'] ) ) { $_POST['comment_author'] = $_POST['newcomment_author']; } if ( isset( $_POST['newcomment_author_email'] ) ) { $_POST['comment_author_email'] = $_POST['newcomment_author_email']; } if ( isset( $_POST['newcomment_author_url'] ) ) { $_POST['comment_author_url'] = $_POST['newcomment_author_url']; } if ( isset( $_POST['comment_status'] ) ) { $_POST['comment_approved'] = $_POST['comment_status']; } if ( isset( $_POST['content'] ) ) { $_POST['comment_content'] = $_POST['content']; } if ( isset( $_POST['comment_ID'] ) ) { $_POST['comment_ID'] = (int) $_POST['comment_ID']; } foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) { $_POST['edit_date'] = '1'; break; } } if ( ! empty( $_POST['edit_date'] ) ) { $aa = $_POST['aa']; $mm = $_POST['mm']; $jj = $_POST['jj']; $hh = $_POST['hh']; $mn = $_POST['mn']; $ss = $_POST['ss']; $jj = ( $jj > 31 ) ? 31 : $jj; $hh = ( $hh > 23 ) ? $hh - 24 : $hh; $mn = ( $mn > 59 ) ? $mn - 60 : $mn; $ss = ( $ss > 59 ) ? $ss - 60 : $ss; $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; } return wp_update_comment( $_POST, true ); } function get_comment_to_edit( $id ) { $comment = get_comment( $id ); if ( ! $comment ) { return false; } $comment->comment_ID = (int) $comment->comment_ID; $comment->comment_post_ID = (int) $comment->comment_post_ID; $comment->comment_content = format_to_edit( $comment->comment_content ); $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); $comment->comment_author = format_to_edit( $comment->comment_author ); $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); $comment->comment_author_url = esc_url( $comment->comment_author_url ); return $comment; } function get_pending_comments_num( $post_id ) { global $wpdb; $single = false; if ( ! is_array( $post_id ) ) { $post_id_array = (array) $post_id; $single = true; } else { $post_id_array = $post_id; } $post_id_array = array_map( 'intval', $post_id_array ); $post_id_in = "'" . implode( "', '", $post_id_array ) . "'"; $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); if ( $single ) { if ( empty( $pending ) ) { return 0; } else { return absint( $pending[0]['num_comments'] ); } } $pending_keyed = array(); foreach ( $post_id_array as $id ) { $pending_keyed[ $id ] = 0; } if ( ! empty( $pending ) ) { foreach ( $pending as $pend ) { $pending_keyed[ $pend['comment_post_ID'] ] = absint( $pend['num_comments'] ); } } return $pending_keyed; } function floated_admin_avatar( $name ) { $avatar = get_avatar( get_comment(), 32, 'mystery' ); return "$avatar $name"; } function enqueue_comment_hotkeys_js() { if ( 'true' === get_user_option( 'comment_shortcuts' ) ) { wp_enqueue_script( 'jquery-table-hotkeys' ); } } function comment_footer_die( $msg ) { echo "

      $msg

      "; require_once ABSPATH . 'wp-admin/admin-footer.php'; die; } $object_id, 'post_title' => get_the_title( $object_id ), 'post_type' => get_post_type( $object_id ), ) ); echo "\n"; } } } elseif ( taxonomy_exists( $object_type ) ) { if ( isset( $request['ID'] ) ) { $object_id = (int) $request['ID']; if ( 'markup' === $response_format ) { echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { $post_obj = get_term( $object_id, $object_type ); echo wp_json_encode( array( 'ID' => $object_id, 'post_title' => $post_obj->name, 'post_type' => $object_type, ) ); echo "\n"; } } } } elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) { if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) { $post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) ); $args = array_merge( $args, array( 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'posts_per_page' => 10, 'post_type' => $matches[2], 's' => $query, ) ); if ( isset( $post_type_obj->_default_query ) ) { $args = array_merge( $args, (array) $post_type_obj->_default_query ); } $search_results_query = new WP_Query( $args ); if ( ! $search_results_query->have_posts() ) { return; } while ( $search_results_query->have_posts() ) { $post = $search_results_query->next_post(); if ( 'markup' === $response_format ) { $var_by_ref = $post->ID; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { echo wp_json_encode( array( 'ID' => $post->ID, 'post_title' => get_the_title( $post->ID ), 'post_type' => $matches[2], ) ); echo "\n"; } } } elseif ( 'taxonomy' === $matches[1] ) { $terms = get_terms( array( 'taxonomy' => $matches[2], 'name__like' => $query, 'number' => 10, 'hide_empty' => false, ) ); if ( empty( $terms ) || is_wp_error( $terms ) ) { return; } foreach ( (array) $terms as $term ) { if ( 'markup' === $response_format ) { echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { echo wp_json_encode( array( 'ID' => $term->term_id, 'post_title' => $term->name, 'post_type' => $matches[2], ) ); echo "\n"; } } } } } function wp_nav_menu_setup() { wp_nav_menu_post_type_meta_boxes(); add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); wp_nav_menu_taxonomy_meta_boxes(); add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { $user = wp_get_current_user(); update_user_meta( $user->ID, 'managenav-menuscolumnshidden', array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', 4 => 'title-attribute', ) ); } } function wp_initial_nav_menu_meta_boxes() { global $wp_meta_boxes; if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array( $wp_meta_boxes ) ) { return; } $initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' ); $hidden_meta_boxes = array(); foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) { foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) { foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) { if ( in_array( $box['id'], $initial_meta_boxes, true ) ) { unset( $box['id'] ); } else { $hidden_meta_boxes[] = $box['id']; } } } } $user = wp_get_current_user(); update_user_meta( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes ); } function wp_nav_menu_post_type_meta_boxes() { $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); if ( ! $post_types ) { return; } foreach ( $post_types as $post_type ) { $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); if ( $post_type ) { $id = $post_type->name; $priority = ( 'page' === $post_type->name ? 'core' : 'default' ); add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type ); } } } function wp_nav_menu_taxonomy_meta_boxes() { $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' ); if ( ! $taxonomies ) { return; } foreach ( $taxonomies as $tax ) { $tax = apply_filters( 'nav_menu_meta_box_object', $tax ); if ( $tax ) { $id = $tax->name; add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax ); } } } function wp_nav_menu_disabled_check( $nav_menu_selected_id, $display = true ) { global $one_theme_location_no_menus; if ( $one_theme_location_no_menus ) { return false; } return disabled( $nav_menu_selected_id, 0, $display ); } function wp_nav_menu_item_link_meta_box() { global $_nav_menu_placeholder, $nav_menu_selected_id; $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1; ?> +
      + + -@media screen and (max-width: 1018px) { - .filter-drawer .filter-group { - width: calc( (100% - 50px) / 2); - } -} + -@media screen and (max-width: 900px) { - .customize-preview-header.themes-filter-bar { - height: 86px; - padding-top: 46px; - } +

      + + class="button submit-add-to-menu right" value="" name="add-custom-menu-item" id="submit-customlinkdiv" /> + + +

      - .themes-filter-bar .wp-filter-search { - width: calc(100% - 50px); - margin: 0; - min-width: 200px; - } +
      + name; $post_type = get_post_type_object( $post_type_name ); $tab_name = $post_type_name . '-tab'; $per_page = 50; $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'title', 'posts_per_page' => $per_page, 'post_type' => $post_type_name, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, ); if ( isset( $box['args']->_default_query ) ) { $args = array_merge( $args, (array) $box['args']->_default_query ); } $important_pages = array(); if ( 'page' === $post_type_name ) { $suppress_page_ids = array(); $front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0; $front_page_obj = null; if ( ! empty( $front_page ) ) { $front_page_obj = get_post( $front_page ); $front_page_obj->front_or_home = true; $important_pages[] = $front_page_obj; $suppress_page_ids[] = $front_page_obj->ID; } else { $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; $front_page_obj = (object) array( 'front_or_home' => true, 'ID' => 0, 'object_id' => $_nav_menu_placeholder, 'post_content' => '', 'post_excerpt' => '', 'post_parent' => '', 'post_title' => _x( 'Home', 'nav menu home label' ), 'post_type' => 'nav_menu_item', 'type' => 'custom', 'url' => home_url( '/' ), ); $important_pages[] = $front_page_obj; } $posts_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0; if ( ! empty( $posts_page ) ) { $posts_page_obj = get_post( $posts_page ); $posts_page_obj->posts_page = true; $important_pages[] = $posts_page_obj; $suppress_page_ids[] = $posts_page_obj->ID; } $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! empty( $privacy_policy_page_id ) ) { $privacy_policy_page = get_post( $privacy_policy_page_id ); if ( $privacy_policy_page instanceof WP_Post && 'publish' === $privacy_policy_page->post_status ) { $privacy_policy_page->privacy_policy_page = true; $important_pages[] = $privacy_policy_page; $suppress_page_ids[] = $privacy_policy_page->ID; } } if ( ! empty( $suppress_page_ids ) ) { $args['post__not_in'] = $suppress_page_ids; } } $get_posts = new WP_Query; $posts = $get_posts->query( $args ); if ( ! $get_posts->post_count ) { if ( ! empty( $suppress_page_ids ) ) { unset( $args['post__not_in'] ); $get_posts = new WP_Query; $posts = $get_posts->query( $args ); } else { echo '

      ' . __( 'No items.' ) . '

      '; return; } } elseif ( ! empty( $important_pages ) ) { $posts = array_merge( $important_pages, $posts ); } $num_pages = $get_posts->max_num_pages; $page_links = paginate_links( array( 'base' => add_query_arg( array( $tab_name => 'all', 'paged' => '%#%', 'item-type' => 'post_type', 'item-object' => $post_type_name, ) ), 'format' => '', 'prev_text' => '' . __( '«' ) . '', 'next_text' => '' . __( '»' ) . '', 'before_page_number' => '' . __( 'Page' ) . ' ', 'total' => $num_pages, 'current' => $pagenum, ) ); $db_fields = false; if ( is_post_type_hierarchical( $post_type_name ) ) { $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID', ); } $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-recent'; if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'search' ), true ) ) { $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $most_recent_url = ''; $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { $most_recent_url = esc_url( add_query_arg( $tab_name, 'most-recent', remove_query_arg( $removed_args ) ) ); $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?> +
      + - .filter-drawer { - top: 86px; - } +
      +
        + 'post_date', 'order' => 'DESC', 'posts_per_page' => 15, ) ); $most_recent = $get_posts->query( $recent_args ); $args['walker'] = $walker; $most_recent = apply_filters( "nav_menu_items_{$post_type_name}_recent", $most_recent, $args, $box, $recent_args ); echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $most_recent ), 0, (object) $args ); ?> +
      +
      - .control-panel-themes .filter-themes-count { - float: left; - } -} + -.control-panel-themes .customize-themes-mobile-back { - display: none; -} +
      + + + +
        + has_archive ) { $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; array_unshift( $posts, (object) array( 'ID' => 0, 'object_id' => $_nav_menu_placeholder, 'object' => $post_type_name, 'post_content' => '', 'post_excerpt' => '', 'post_title' => $post_type->labels->archives, 'post_type' => 'nav_menu_item', 'type' => 'post_type_archive', 'url' => get_post_type_archive_link( $post_type_name ), ) ); } $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type ); $checkbox_items = walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $posts ), 0, (object) $args ); echo $checkbox_items; ?> +
      + + + +
      -/* Mobile - toggle between themes and filters */ -@media screen and (max-width: 600px) { +

      + + id="" class="select-all" /> + + - .filter-drawer { - top: 132px; - } + + class="button submit-add-to-menu right" value="" name="add-post-type-menu-item" id="" /> + + +

      - .wp-full-overlay.showing-themes .control-panel-themes .filter-themes-count .filter-themes { - display: block; - float: right; - } +
      + name; $taxonomy = get_taxonomy( $taxonomy_name ); $tab_name = $taxonomy_name . '-tab'; $per_page = 50; $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'taxonomy' => $taxonomy_name, 'child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'number' => $per_page, 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'name', 'pad_counts' => false, ); $terms = get_terms( $args ); if ( ! $terms || is_wp_error( $terms ) ) { echo '

      ' . __( 'No items.' ) . '

      '; return; } $num_pages = ceil( wp_count_terms( array_merge( $args, array( 'number' => '', 'offset' => '', ) ) ) / $per_page ); $page_links = paginate_links( array( 'base' => add_query_arg( array( $tab_name => 'all', 'paged' => '%#%', 'item-type' => 'taxonomy', 'item-object' => $taxonomy_name, ) ), 'format' => '', 'prev_text' => '' . __( '«' ) . '', 'next_text' => '' . __( '»' ) . '', 'before_page_number' => '' . __( 'Page' ) . ' ', 'total' => $num_pages, 'current' => $pagenum, ) ); $db_fields = false; if ( is_taxonomy_hierarchical( $taxonomy_name ) ) { $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', ); } $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-used'; if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'most-used', 'search' ), true ) ) { $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $most_used_url = ''; $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { $most_used_url = esc_url( add_query_arg( $tab_name, 'most-used', remove_query_arg( $removed_args ) ) ); $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?> +
      + - .control-panel-themes .customize-themes-full-container { - width: 100%; - margin: 0; - padding-top: 46px; - height: calc(100% - 46px); - z-index: 1; - display: none; - } +
      +
        + $taxonomy_name, 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false, ) ); $args['walker'] = $walker; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $popular_terms ), 0, (object) $args ); ?> +
      +
      - .showing-themes .control-panel-themes .customize-themes-full-container { - display: block; - } +
      + + + +
        + +
      + + + +
      - .wp-customizer .showing-themes .control-panel-themes .customize-themes-mobile-back { - display: block; - position: fixed; - top: 0; - left: 0; - background: #f0f0f1; - color: #3c434a; - border-radius: 0; - box-shadow: none; - border: none; - height: 46px; - width: 100%; - z-index: 10; - text-align: left; - text-shadow: none; - border-bottom: 1px solid #dcdcde; - border-left: 4px solid transparent; - margin: 0; - padding: 0; - font-size: 0; - overflow: hidden; - } +
      + $taxonomy_name, 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false, ) ); } else { $searched = ''; $search_results = array(); } ?> +

      + + + + 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> +

      - .wp-customizer .showing-themes .control-panel-themes .customize-themes-mobile-back:before { - left: 0; - top: 0; - height: 46px; - width: 26px; - display: block; - line-height: 2.3; - padding: 0 8px; - border-right: 1px solid #dcdcde; - } +
        + + + +
      • get_error_message(); ?>
      • + +
      • + +
      +
      - .wp-customizer .showing-themes .control-panel-themes .customize-themes-mobile-back:hover, - .wp-customizer .showing-themes .control-panel-themes .customize-themes-mobile-back:focus { - color: #2271b1; - background: #f6f7f7; - border-left-color: #2271b1; - box-shadow: none; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; - } - - .showing-themes #customize-header-actions { - display: none; - } - - #customize-controls { - width: 100%; - } -} - -/* Details View */ -.wp-customizer .theme-overlay { - display: none; -} - -.wp-customizer.modal-open .theme-overlay { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; - z-index: 109; -} - -/* Avoid a z-index war by resetting elements that should be under the overlay. - This is likely required because of the way that sections and panels are positioned. */ -.wp-customizer.modal-open #customize-header-actions, -.wp-customizer.modal-open .control-panel-themes .filter-themes-count, -.wp-customizer.modal-open .control-panel-themes .customize-themes-section-title.selected:after { - z-index: -1; -} +

      + + id="" class="select-all" /> + + -.wp-full-overlay.in-themes-panel.themes-panel-expanded #customize-controls .wp-full-overlay-sidebar-content { - overflow: visible; -} + + class="button submit-add-to-menu right" value="" name="add-taxonomy-menu-item" id="" /> + + +

      -.wp-customizer .theme-overlay .theme-backdrop { - background: rgba(240, 240, 241, 0.75); - position: fixed; - z-index: 110; -} +
      + $_item_object_data ) { if ( empty( $_item_object_data['menu-item-object-id'] ) && ( ! isset( $_item_object_data['menu-item-type'] ) || in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) || ! ( 'custom' === $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || ! empty( $_item_object_data['menu-item-db-id'] ) ) ) { continue; } if ( empty( $_item_object_data['menu-item-db-id'] ) || ( 0 > $_possible_db_id ) || $_possible_db_id != $_item_object_data['menu-item-db-id'] ) { $_actual_db_id = 0; } else { $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; } $args = array( 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ), 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ), 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ), 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ), 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ), 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ), 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ), 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ), 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ), 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ), 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ), 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ), ); $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args ); } } return $items_saved; } function _wp_nav_menu_meta_box_object( $data_object = null ) { if ( isset( $data_object->name ) ) { if ( 'page' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'menu_order title', 'post_status' => 'publish', ); } elseif ( 'post' === $data_object->name ) { $data_object->_default_query = array( 'post_status' => 'publish', ); } elseif ( 'category' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'id', 'order' => 'DESC', ); } else { $data_object->_default_query = array( 'post_status' => 'publish', ); } } return $data_object; } function wp_get_nav_menu_to_edit( $menu_id = 0 ) { $menu = wp_get_nav_menu_object( $menu_id ); if ( is_nav_menu( $menu ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'post_status' => 'any' ) ); $result = '
      ' : '">'; $result .= '

      ' . __( 'Add menu items from the column on the left.' ) . '

      '; $result .= '
      '; if ( empty( $menu_items ) ) { return $result . ' '; } $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); if ( class_exists( $walker_class_name ) ) { $walker = new $walker_class_name; } else { return new WP_Error( 'menu_walker_not_exist', sprintf( __( 'The Walker class named %s does not exist.' ), '' . $walker_class_name . '' ) ); } $some_pending_menu_items = false; $some_invalid_menu_items = false; foreach ( (array) $menu_items as $menu_item ) { if ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { $some_pending_menu_items = true; } if ( ! empty( $menu_item->_invalid ) ) { $some_invalid_menu_items = true; } } if ( $some_pending_menu_items ) { $result .= '

      ' . __( 'Click Save Menu to make pending menu items public.' ) . '

      '; } if ( $some_invalid_menu_items ) { $result .= '

      ' . __( 'There are some invalid menu items. Please check or delete them.' ) . '

      '; } $result .= ' '; return $result; } elseif ( is_wp_error( $menu ) ) { return $menu; } } function wp_nav_menu_manage_columns() { return array( '_title' => __( 'Show advanced menu properties' ), 'cb' => '', 'link-target' => __( 'Link Target' ), 'title-attribute' => __( 'Title Attribute' ), 'css-classes' => __( 'CSS Classes' ), 'xfn' => __( 'Link Relationship (XFN)' ), 'description' => __( 'Description' ), ); } function _wp_delete_orphaned_draft_menu_items() { global $wpdb; $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); $menu_items_to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < %d", $delete_timestamp ) ); foreach ( (array) $menu_items_to_delete as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) { $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish', ) ); $messages = array(); $menu_items = array(); foreach ( $unsorted_menu_items as $_item ) { $menu_items[ $_item->db_id ] = $_item; } $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn', ); wp_defer_term_counting( true ); if ( ! empty( $_POST['menu-item-db-id'] ) ) { foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) { if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) { continue; } $args = array(); foreach ( $post_fields as $field ) { $args[ $field ] = isset( $_POST[ $field ][ $_key ] ) ? $_POST[ $field ][ $_key ] : ''; } $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][ $_key ] != $_key ? 0 : $_key ), $args ); if ( is_wp_error( $menu_item_db_id ) ) { $messages[] = '

      ' . $menu_item_db_id->get_error_message() . '

      '; } else { unset( $menu_items[ $menu_item_db_id ] ); } } } if ( ! empty( $menu_items ) ) { foreach ( array_keys( $menu_items ) as $menu_item_id ) { if ( is_nav_menu_item( $menu_item_id ) ) { wp_delete_post( $menu_item_id ); } } } $auto_add = ! empty( $_POST['auto-add-pages'] ); $nav_menu_option = (array) get_option( 'nav_menu_options' ); if ( ! isset( $nav_menu_option['auto_add'] ) ) { $nav_menu_option['auto_add'] = array(); } if ( $auto_add ) { if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) { $nav_menu_option['auto_add'][] = $nav_menu_selected_id; } } else { $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ); if ( false !== $key ) { unset( $nav_menu_option['auto_add'][ $key ] ); } } $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); update_option( 'nav_menu_options', $nav_menu_option ); wp_defer_term_counting( false ); do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); $messages[] = '

      ' . sprintf( __( '%s has been updated.' ), '' . $nav_menu_selected_title . '' ) . '

      '; unset( $menu_items, $unsorted_menu_items ); return $messages; } function _wp_expand_nav_menu_post_data() { if ( ! isset( $_POST['nav-menu-data'] ) ) { return; } $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) ); if ( ! is_null( $data ) && $data ) { foreach ( $data as $post_input_data ) { preg_match( '#([^\[]*)(\[(.+)\])?#', $post_input_data->name, $matches ); $array_bits = array( $matches[1] ); if ( isset( $matches[3] ) ) { $array_bits = array_merge( $array_bits, explode( '][', $matches[3] ) ); } $new_post_data = array(); for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) { if ( count( $array_bits ) - 1 == $i ) { $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value ); } else { $new_post_data = array( $array_bits[ $i ] => $new_post_data ); } } $_POST = array_replace_recursive( $_POST, $new_post_data ); } } } + + + + + + '; echo '

      ' . __( 'The character encoding of your site (UTF-8 is recommended)' ) . '

      '; } 3, 'body' => array( 'wp_version' => $wp_version, 'locale' => get_locale(), 'version' => $args['version'], ), ); if ( 'core' !== $type ) { $options['body']['slug'] = $args['slug']; } $request = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $request ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $request = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'translations_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! is_object( $res ) && ! is_array( $res ) ) { $res = new WP_Error( 'translations_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } } } return apply_filters( 'translations_api_result', $res, $type, $args ); } function wp_get_available_translations() { if ( ! wp_installing() ) { $translations = get_site_transient( 'available_translations' ); if ( false !== $translations ) { return $translations; } } require ABSPATH . WPINC . '/version.php'; $api = translations_api( 'core', array( 'version' => $wp_version ) ); if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { return array(); } $translations = array(); foreach ( $api['translations'] as $translation ) { $translations[ $translation['language'] ] = $translation; } if ( ! defined( 'WP_INSTALLING' ) ) { set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS ); } return $translations; } function wp_install_language_form( $languages ) { global $wp_local_package; $installed_languages = get_available_languages(); echo "\n"; echo "\n"; echo '

      '; } function wp_download_language_pack( $download ) { if ( in_array( $download, get_available_languages(), true ) ) { return $download; } if ( ! wp_is_file_mod_allowed( 'download_language_pack' ) ) { return false; } $translations = wp_get_available_translations(); if ( ! $translations ) { return false; } foreach ( $translations as $translation ) { if ( $translation['language'] === $download ) { $translation_to_load = true; break; } } if ( empty( $translation_to_load ) ) { return false; } $translation = (object) $translation; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); $translation->type = 'core'; $result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) ); if ( ! $result || is_wp_error( $result ) ) { return false; } return $translation->language; } function wp_can_install_language_pack() { if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); $upgrader->init(); $check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); if ( ! $check || is_wp_error( $check ) ) { return false; } return true; } admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'customize_save_after', array( $this, 'customize_set_last_used' ) ); add_action( 'wp_ajax_custom-header-crop', array( $this, 'ajax_header_crop' ) ); add_action( 'wp_ajax_custom-header-add', array( $this, 'ajax_header_add' ) ); add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove' ) ); } public function init() { $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) ); if ( ! $page ) { return; } add_action( "admin_print_scripts-{$page}", array( $this, 'js_includes' ) ); add_action( "admin_print_styles-{$page}", array( $this, 'css_includes' ) ); add_action( "admin_head-{$page}", array( $this, 'help' ) ); add_action( "admin_head-{$page}", array( $this, 'take_action' ), 50 ); add_action( "admin_head-{$page}", array( $this, 'js' ), 50 ); if ( $this->admin_header_callback ) { add_action( "admin_head-{$page}", $this->admin_header_callback, 51 ); } } public function help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

      ' . __( 'This screen is used to customize the header section of your theme.' ) . '

      ' . '

      ' . __( 'You can choose from the theme’s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.' ) . '

      ', ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-image', 'title' => __( 'Header Image' ), 'content' => '

      ' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the “Choose Image” button.' ) . '

      ' . '

      ' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you would like and click the “Save Changes” button.' ) . '

      ' . '

      ' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the “Random” radio button next to the Uploaded Images or Default Images section to enable this feature.' ) . '

      ' . '

      ' . __( 'If you do not want a header image to be displayed on your site at all, click the “Remove Header Image” button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click “Save Changes”.' ) . '

      ', ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-text', 'title' => __( 'Header Text' ), 'content' => '

      ' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the General Settings section.' ), admin_url( 'options-general.php' ) ) . '

      ' . '

      ' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '

      ' . '

      ' . __( 'Do not forget to click “Save Changes” when you are done!' ) . '

      ', ) ); get_current_screen()->set_help_sidebar( '

      ' . __( 'For more information:' ) . '

      ' . '

      ' . __( 'Documentation on Custom Header' ) . '

      ' . '

      ' . __( 'Support' ) . '

      ' ); } public function step() { if ( ! isset( $_GET['step'] ) ) { return 1; } $step = (int) $_GET['step']; if ( $step < 1 || 3 < $step || ( 2 === $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) || ( 3 === $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) ) ) { return 1; } return $step; } public function js_includes() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) ) { wp_enqueue_media(); wp_enqueue_script( 'custom-header' ); if ( current_theme_supports( 'custom-header', 'header-text' ) ) { wp_enqueue_script( 'wp-color-picker' ); } } elseif ( 2 === $step ) { wp_enqueue_script( 'imgareaselect' ); } } public function css_includes() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { wp_enqueue_style( 'wp-color-picker' ); } elseif ( 2 === $step ) { wp_enqueue_style( 'imgareaselect' ); } } public function take_action() { if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( empty( $_POST ) ) { return; } $this->updated = true; if ( isset( $_POST['resetheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->reset_header_image(); return; } if ( isset( $_POST['removeheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->remove_header_image(); return; } if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); set_theme_mod( 'header_textcolor', 'blank' ); } elseif ( isset( $_POST['text-color'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['text-color'] ); if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) { set_theme_mod( 'header_textcolor', $color ); } elseif ( ! $color ) { set_theme_mod( 'header_textcolor', 'blank' ); } } if ( isset( $_POST['default-header'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->set_header_image( $_POST['default-header'] ); return; } } public function process_default_headers() { global $_wp_default_headers; if ( ! isset( $_wp_default_headers ) ) { return; } if ( ! empty( $this->default_headers ) ) { return; } $this->default_headers = $_wp_default_headers; $template_directory_uri = get_template_directory_uri(); $stylesheet_directory_uri = get_stylesheet_directory_uri(); foreach ( array_keys( $this->default_headers ) as $header ) { $this->default_headers[ $header ]['url'] = sprintf( $this->default_headers[ $header ]['url'], $template_directory_uri, $stylesheet_directory_uri ); $this->default_headers[ $header ]['thumbnail_url'] = sprintf( $this->default_headers[ $header ]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri ); } } public function show_header_selector( $type = 'default' ) { if ( 'default' === $type ) { $headers = $this->default_headers; } else { $headers = get_uploaded_header_images(); $type = 'uploaded'; } if ( 1 < count( $headers ) ) { echo '
      '; echo ''; echo '
      '; } echo '
      '; foreach ( $headers as $header_key => $header ) { $header_thumbnail = $header['thumbnail_url']; $header_url = $header['url']; $header_alt_text = empty( $header['alt_text'] ) ? '' : $header['alt_text']; echo '
      '; echo ''; echo '
      '; } echo '
      '; } public function js() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { $this->js_1(); } elseif ( 2 === $step ) { $this->js_2(); } } public function js_1() { $default_color = ''; if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) { $default_color = get_theme_support( 'custom-header', 'default-text-color' ); if ( $default_color && false === strpos( $default_color, '#' ) ) { $default_color = '#' . $default_color; } } ?> + + + + process_default_headers(); ?> -/** - * Widgets and Menus common styles - */ +
      +

      -/* higher specificity than .wp-core-ui .button */ -#customize-theme-controls .add-new-widget, -#customize-theme-controls .add-new-menu-item { - cursor: pointer; - float: right; - margin: 0 0 0 10px; - transition: all 0.2s; - -webkit-user-select: none; - user-select: none; - outline: none; -} + +
      +

      + Customizer.' ), admin_url( 'customize.php?autofocus[control]=header_image' ) ); ?> +

      +
      + -.reordering .add-new-widget, -.reordering .add-new-menu-item { - opacity: 0.2; - pointer-events: none; - cursor: not-allowed; /* doesn't work in conjunction with pointer-events */ -} + updated ) ) { ?> +
      +

      + Visit your site to see how it looks.' ), home_url( '/' ) ); ?> +

      +
      + -.add-new-widget:before, -.add-new-menu-item:before, -#available-menu-items .new-content-item .add-content:before { - content: "\f132"; - display: inline-block; - position: relative; - left: -2px; - top: 0; - font: normal 20px/1 dashicons; - vertical-align: middle; - transition: all 0.2s; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} +

      -/* Reordering */ -.reorder-toggle { - float: right; - padding: 5px 8px; - text-decoration: none; - cursor: pointer; - outline: none; -} + + -.reorder, -.reordering .reorder-done { - display: block; - padding: 5px 8px; -} + + + + + + -.reorder-done, -.reordering .reorder { - display: none; -} + + + + + + + + -.widget-reorder-nav span, -.menu-item-reorder-nav button { - position: relative; - overflow: hidden; - float: left; - display: block; - width: 33px; /* was 42px for mobile */ - height: 43px; - color: #8c8f94; - text-indent: -9999px; - cursor: pointer; - outline: none; -} +
      + + + + + + + + + default_headers ) ) : ?> + + + + + + + + + + + + + + + + + -.menu-item-reorder-nav button { - width: 30px; - height: 40px; - background: transparent; - border: none; - box-shadow: none; -} + -.widget-reorder-nav span:before, -.menu-item-reorder-nav button:before { - display: inline-block; - position: absolute; - top: 0; - right: 0; - width: 100%; - height: 100%; - font: normal 20px/43px dashicons; - text-align: center; - text-indent: 0; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} +

      -.widget-reorder-nav span:hover, -.widget-reorder-nav span:focus, -.menu-item-reorder-nav button:hover, -.menu-item-reorder-nav button:focus { - color: #1d2327; - background: #f0f0f1; -} + + + + + + -.move-widget-down:before, -.menus-move-down:before { - content: "\f347"; -} + + + + + + + -.move-widget-up:before, -.menus-move-up:before { - content: "\f343"; -} + +
      +
      -#customize-theme-controls .first-widget .move-widget-up, -#customize-theme-controls .last-widget .move-widget-down, -.move-up-disabled .menus-move-up, -.move-down-disabled .menus-move-down, -.move-right-disabled .menus-move-right, -.move-left-disabled .menus-move-left { - color: #dcdcde; - background-color: #fff; - cursor: default; - pointer-events: none; -} + ' . __( 'Something went wrong.' ) . '' . '

      ' . __( 'The active theme does not support uploading a custom header image.' ) . '

      ', 403 ); } if ( empty( $_POST ) && isset( $_GET['file'] ) ) { $attachment_id = absint( $_GET['file'] ); $file = get_attached_file( $attachment_id, true ); $url = wp_get_attachment_image_src( $attachment_id, 'full' ); $url = $url[0]; } elseif ( isset( $_POST ) ) { $data = $this->step_2_manage_upload(); $attachment_id = $data['attachment_id']; $file = $data['file']; $url = $data['url']; } if ( file_exists( $file ) ) { list( $width, $height, $type, $attr ) = wp_getimagesize( $file ); } else { $data = wp_get_attachment_metadata( $attachment_id ); $height = isset( $data['height'] ) ? (int) $data['height'] : 0; $width = isset( $data['width'] ) ? (int) $data['width'] : 0; unset( $data ); } $max_width = 0; if ( current_theme_supports( 'custom-header', 'flex-width' ) ) { $max_width = 1500; } if ( current_theme_supports( 'custom-header', 'max-width' ) ) { $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); } $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) && (int) get_theme_support( 'custom-header', 'width' ) === $width && (int) get_theme_support( 'custom-header', 'height' ) === $height ) { if ( file_exists( $file ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); return $this->finished(); } elseif ( $width > $max_width ) { $oitar = $width / $max_width; $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) ); if ( ! $image || is_wp_error( $image ) ) { wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); } $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); $width = $width / $oitar; $height = $height / $oitar; } else { $oitar = 1; } ?> -/** - * New widget and Add-menu-items modes and panels - */ +
      +

      -.wp-full-overlay-main { - right: auto; /* this overrides a right: 0; which causes the preview to resize, I'd rather have it go off screen at the normal size. */ - width: 100%; -} +
      +

      +

      -body.adding-widget .add-new-widget, -body.adding-widget .add-new-widget:hover, -.adding-menu-items .add-new-menu-item, -.adding-menu-items .add-new-menu-item:hover, -.add-menu-toggle.open, -.add-menu-toggle.open:hover { - background: #f0f0f1; - border-color: #8c8f94; - color: #2c3338; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); -} +
      + +
      -body.adding-widget .add-new-widget:before, -.adding-menu-items .add-new-menu-item:before, -#accordion-section-add_menu .add-new-menu-item.open:before { - transform: rotate(45deg); -} + + + + + + + + + + -#available-widgets, -#available-menu-items { - position: absolute; - top: 0; - bottom: 0; - left: -301px; - visibility: hidden; - overflow-x: hidden; - overflow-y: auto; - width: 300px; - margin: 0; - z-index: 4; - background: #f0f0f1; - transition: left .18s; - border-right: 1px solid #dcdcde; -} +

      + + +

      +
      +
      + false ); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); } $file = wp_handle_upload( $uploaded_file, $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'], __( 'Image Upload Error' ) ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = wp_basename( $file ); $attachment = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-header', ); $attachment_id = wp_insert_attachment( $attachment, $file ); return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); } public function step_3() { check_admin_referer( 'custom-header-crop-image' ); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { wp_die( '

      ' . __( 'Something went wrong.' ) . '

      ' . '

      ' . __( 'The active theme does not support uploading a custom header image.' ) . '

      ', 403 ); } if ( ! empty( $_POST['skip-cropping'] ) && ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { wp_die( '

      ' . __( 'Something went wrong.' ) . '

      ' . '

      ' . __( 'The active theme does not support a flexible sized header image.' ) . '

      ', 403 ); } if ( $_POST['oitar'] > 1 ) { $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; $_POST['y1'] = $_POST['y1'] * $_POST['oitar']; $_POST['width'] = $_POST['width'] * $_POST['oitar']; $_POST['height'] = $_POST['height'] * $_POST['oitar']; } $attachment_id = absint( $_POST['attachment_id'] ); $original = get_attached_file( $attachment_id ); $dimensions = $this->get_header_dimensions( array( 'height' => $_POST['height'], 'width' => $_POST['width'], ) ); $height = $dimensions['dst_height']; $width = $dimensions['dst_width']; if ( empty( $_POST['skip-cropping'] ) ) { $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height ); } elseif ( ! empty( $_POST['create-new-attachment'] ) ) { $cropped = _copy_image_file( $attachment_id ); } else { $cropped = get_attached_file( $attachment_id ); } if ( ! $cropped || is_wp_error( $cropped ) ) { wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $this->create_attachment_object( $cropped, $attachment_id ); if ( ! empty( $_POST['create-new-attachment'] ) ) { unset( $attachment['ID'] ); } $attachment_id = $this->insert_attachment( $attachment, $cropped ); $url = wp_get_attachment_url( $attachment_id ); $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); $medium = str_replace( wp_basename( $original ), 'midsize-' . wp_basename( $original ), $original ); if ( file_exists( $medium ) ) { wp_delete_file( $medium ); } if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) { wp_delete_file( $original ); } return $this->finished(); } public function finished() { $this->updated = true; $this->step_1(); } public function admin_page() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( __( 'Sorry, you are not allowed to customize headers.' ) ); } $step = $this->step(); if ( 2 === $step ) { $this->step_2(); } elseif ( 3 === $step ) { $this->step_3(); } else { $this->step_1(); } } public function attachment_fields_to_edit( $form_fields ) { return $form_fields; } public function filter_upload_tabs( $tabs ) { return $tabs; } final public function set_header_image( $choice ) { if ( is_array( $choice ) || is_object( $choice ) ) { $choice = (array) $choice; if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) { return; } $choice['url'] = esc_url_raw( $choice['url'] ); $header_image_data = (object) array( 'attachment_id' => $choice['attachment_id'], 'url' => $choice['url'], 'thumbnail_url' => $choice['url'], 'height' => $choice['height'], 'width' => $choice['width'], ); update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() ); set_theme_mod( 'header_image', $choice['url'] ); set_theme_mod( 'header_image_data', $header_image_data ); return; } if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ), true ) ) { set_theme_mod( 'header_image', $choice ); remove_theme_mod( 'header_image_data' ); return; } $uploaded = get_uploaded_header_images(); if ( $uploaded && isset( $uploaded[ $choice ] ) ) { $header_image_data = $uploaded[ $choice ]; } else { $this->process_default_headers(); if ( isset( $this->default_headers[ $choice ] ) ) { $header_image_data = $this->default_headers[ $choice ]; } else { return; } } set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); set_theme_mod( 'header_image_data', $header_image_data ); } final public function remove_header_image() { $this->set_header_image( 'remove-header' ); } final public function reset_header_image() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) { $this->remove_header_image(); return; } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $default_data = array(); foreach ( $this->default_headers as $header => $details ) { if ( $details['url'] === $default ) { $default_data = $details; break; } } set_theme_mod( 'header_image', $default ); set_theme_mod( 'header_image_data', (object) $default_data ); } final public function get_header_dimensions( $dimensions ) { $max_width = 0; $width = absint( $dimensions['width'] ); $height = absint( $dimensions['height'] ); $theme_height = get_theme_support( 'custom-header', 'height' ); $theme_width = get_theme_support( 'custom-header', 'width' ); $has_flex_width = current_theme_supports( 'custom-header', 'flex-width' ); $has_flex_height = current_theme_supports( 'custom-header', 'flex-height' ); $has_max_width = current_theme_supports( 'custom-header', 'max-width' ); $dst = array( 'dst_height' => null, 'dst_width' => null, ); if ( $has_flex_width ) { $max_width = 1500; } if ( $has_max_width ) { $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); } $max_width = max( $max_width, $theme_width ); if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) { $dst['dst_height'] = absint( $height * ( $max_width / $width ) ); } elseif ( $has_flex_height && $has_flex_width ) { $dst['dst_height'] = $height; } else { $dst['dst_height'] = $theme_height; } if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) { $dst['dst_width'] = absint( $width * ( $max_width / $width ) ); } elseif ( $has_flex_width && $has_flex_height ) { $dst['dst_width'] = $width; } else { $dst['dst_width'] = $theme_width; } return $dst; } final public function create_attachment_object( $cropped, $parent_attachment_id ) { $parent = get_post( $parent_attachment_id ); $parent_url = wp_get_attachment_url( $parent->ID ); $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $attachment = array( 'ID' => $parent_attachment_id, 'post_title' => wp_basename( $cropped ), 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'custom-header', 'post_parent' => $parent_attachment_id, ); return $attachment; } final public function insert_attachment( $attachment, $cropped ) { $parent_id = isset( $attachment['post_parent'] ) ? $attachment['post_parent'] : null; unset( $attachment['post_parent'] ); $attachment_id = wp_insert_attachment( $attachment, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); if ( $parent_id ) { $metadata['attachment_parent'] = $parent_id; } $metadata = apply_filters( 'wp_header_image_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); return $attachment_id; } public function ajax_header_crop() { check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { wp_send_json_error(); } $crop_details = $_POST['cropDetails']; $dimensions = $this->get_header_dimensions( array( 'height' => $crop_details['height'], 'width' => $crop_details['width'], ) ); $attachment_id = absint( $_POST['id'] ); $cropped = wp_crop_image( $attachment_id, (int) $crop_details['x1'], (int) $crop_details['y1'], (int) $crop_details['width'], (int) $crop_details['height'], (int) $dimensions['dst_width'], (int) $dimensions['dst_height'] ); if ( ! $cropped || is_wp_error( $cropped ) ) { wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $this->create_attachment_object( $cropped, $attachment_id ); $previous = $this->get_previous_crop( $attachment ); if ( $previous ) { $attachment['ID'] = $previous; } else { unset( $attachment['ID'] ); } $new_attachment_id = $this->insert_attachment( $attachment, $cropped ); $attachment['attachment_id'] = $new_attachment_id; $attachment['url'] = wp_get_attachment_url( $new_attachment_id ); $attachment['width'] = $dimensions['dst_width']; $attachment['height'] = $dimensions['dst_height']; wp_send_json_success( $attachment ); } public function ajax_header_add() { check_ajax_referer( 'header-add', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } public function ajax_header_remove() { check_ajax_referer( 'header-remove', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); delete_post_meta( $attachment_id, $key ); delete_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } public function customize_set_last_used( $wp_customize ) { $header_image_data_setting = $wp_customize->get_setting( 'header_image_data' ); if ( ! $header_image_data_setting ) { return; } $data = $header_image_data_setting->post_value(); if ( ! isset( $data['attachment_id'] ) ) { return; } $attachment_id = $data['attachment_id']; $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); } public function get_default_header_images() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) { return $this->default_headers; } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $already_has_default = false; foreach ( $this->default_headers as $k => $h ) { if ( $h['url'] === $default ) { $already_has_default = true; break; } } if ( $already_has_default ) { return $this->default_headers; } $header_images = array(); $header_images['default'] = array( 'url' => $default, 'thumbnail_url' => $default, 'description' => 'Default', ); return array_merge( $header_images, $this->default_headers ); } public function get_uploaded_header_images() { $header_images = get_uploaded_header_images(); $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); $alt_text_key = '_wp_attachment_image_alt'; foreach ( $header_images as &$header_image ) { $header_meta = get_post_meta( $header_image['attachment_id'] ); $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; } return $header_images; } public function get_previous_crop( $attachment ) { $header_images = $this->get_uploaded_header_images(); if ( empty( $header_images ) ) { return false; } $previous = false; foreach ( $header_images as $image ) { if ( $image['attachment_parent'] === $attachment['post_parent'] ) { $previous = $image['attachment_id']; break; } } return $previous; } } prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d", $meta_key, $offset, $limit ); $results = $wpdb->get_results( $sql ); $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { $hashtable[ $r->meta_value ] = (int) $r->post_id; } } } while ( count( $results ) == $limit ); return $hashtable; } public function count_imported_posts( $importer_name, $blog_id ) { global $wpdb; $count = 0; $meta_key = $importer_name . '_' . $blog_id . '_permalink'; $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ); $result = $wpdb->get_results( $sql ); if ( ! empty( $result ) ) { $count = (int) $result[0]->cnt; } return $count; } public function get_imported_comments( $blog_id ) { global $wpdb; $hashtable = array(); $limit = 100; $offset = 0; do { $sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit ); $results = $wpdb->get_results( $sql ); $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { list ( $comment_agent_blog_id, $source_comment_id ) = explode( '-', $r->comment_agent ); $source_comment_id = (int) $source_comment_id; if ( $blog_id == $comment_agent_blog_id ) { $hashtable[ $source_comment_id ] = (int) $r->comment_ID; } } } } while ( count( $results ) == $limit ); return $hashtable; } public function set_blog( $blog_id ) { if ( is_numeric( $blog_id ) ) { $blog_id = (int) $blog_id; } else { $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); $parsed = parse_url( $blog ); if ( ! $parsed || empty( $parsed['host'] ) ) { fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" ); exit; } if ( empty( $parsed['path'] ) ) { $parsed['path'] = '/'; } $blogs = get_sites( array( 'domain' => $parsed['host'], 'number' => 1, 'path' => $parsed['path'], ) ); if ( ! $blogs ) { fwrite( STDERR, "Error: Could not find blog\n" ); exit; } $blog = array_shift( $blogs ); $blog_id = (int) $blog->blog_id; } if ( function_exists( 'is_multisite' ) ) { if ( is_multisite() ) { switch_to_blog( $blog_id ); } } return $blog_id; } public function set_user( $user_id ) { if ( is_numeric( $user_id ) ) { $user_id = (int) $user_id; } else { $user_id = (int) username_exists( $user_id ); } if ( ! $user_id || ! wp_set_current_user( $user_id ) ) { fwrite( STDERR, "Error: can not find user\n" ); exit; } return $user_id; } public function cmpr_strlen( $a, $b ) { return strlen( $b ) - strlen( $a ); } public function get_page( $url, $username = '', $password = '', $head = false ) { add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); $headers = array(); $args = array(); if ( true === $head ) { $args['method'] = 'HEAD'; } if ( ! empty( $username ) && ! empty( $password ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" ); } $args['headers'] = $headers; return wp_safe_remote_request( $url, $args ); } public function bump_request_timeout( $val ) { return 60; } public function is_user_over_quota() { if ( function_exists( 'upload_is_user_over_quota' ) ) { if ( upload_is_user_over_quota() ) { return true; } } return false; } public function min_whitespace( $text ) { return preg_replace( '|[\r\n\t ]+|', ' ', $text ); } public function stop_the_insanity() { global $wpdb, $wp_actions; $wpdb->queries = array(); $wp_actions = array(); } } function get_cli_args( $param, $required = false ) { $args = $_SERVER['argv']; if ( ! is_array( $args ) ) { $args = array(); } $out = array(); $last_arg = null; $return = null; $il = count( $args ); for ( $i = 1, $il; $i < $il; $i++ ) { if ( (bool) preg_match( '/^--(.+)/', $args[ $i ], $match ) ) { $parts = explode( '=', $match[1] ); $key = preg_replace( '/[^a-z0-9]+/', '', $parts[0] ); if ( isset( $parts[1] ) ) { $out[ $key ] = $parts[1]; } else { $out[ $key ] = true; } $last_arg = $key; } elseif ( (bool) preg_match( '/^-([a-zA-Z0-9]+)/', $args[ $i ], $match ) ) { for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) { $key = $match[1][ $j ]; $out[ $key ] = true; } $last_arg = $key; } elseif ( null !== $last_arg ) { $out[ $last_arg ] = $args[ $i ]; } } if ( isset( $out[ $param ] ) ) { $return = $out[ $param ]; } if ( ! isset( $out[ $param ] ) && $required ) { echo "\"$param\" parameter is required but was not specified\n"; exit; } return $return; } 'posts', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $post_type = $this->screen->post_type; $post_type_object = get_post_type_object( $post_type ); $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false, ) ); $this->user_posts_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) + FROM $wpdb->posts + WHERE post_type = %s + AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) + AND post_author = %d", $post_type, get_current_user_id() ) ); if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) { $_GET['author'] = get_current_user_id(); } $sticky_posts = get_option( 'sticky_posts' ); if ( 'post' === $post_type && $sticky_posts ) { $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); $this->sticky_posts_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) + FROM $wpdb->posts + WHERE post_type = %s + AND post_status NOT IN ('trash', 'auto-draft') + AND ID IN ($sticky_posts)", $post_type ) ); } } public function set_hierarchical_display( $display ) { $this->hierarchical_display = $display; } public function ajax_user_can() { return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); } public function prepare_items() { global $mode, $avail_post_stati, $wp_query, $per_page; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'posts_list_mode', $mode ); } else { $mode = get_user_setting( 'posts_list_mode', 'list' ); } $avail_post_stati = wp_edit_posts_query(); $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); $post_type = $this->screen->post_type; $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); if ( $this->hierarchical_display ) { $total_items = $wp_query->post_count; } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { $total_items = $wp_query->found_posts; } else { $post_counts = (array) wp_count_posts( $post_type, 'readable' ); if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) { $total_items = $post_counts[ $_REQUEST['post_status'] ]; } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { $total_items = $this->sticky_posts_count; } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) { $total_items = $this->user_posts_count; } else { $total_items = array_sum( $post_counts ); foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { $total_items -= $post_counts[ $state ]; } } } $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => $per_page, ) ); } public function has_items() { return have_posts(); } public function no_items() { if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; } else { echo get_post_type_object( $this->screen->post_type )->labels->not_found; } } protected function is_base_request() { $vars = $_GET; unset( $vars['paged'] ); if ( empty( $vars ) ) { return true; } elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) { return $this->screen->post_type === $vars['post_type']; } return 1 === count( $vars ) && ! empty( $vars['mode'] ); } protected function get_edit_link( $args, $link_text, $css_class = '' ) { $url = add_query_arg( $args, 'edit.php' ); $class_html = ''; $aria_current = ''; if ( ! empty( $css_class ) ) { $class_html = sprintf( ' class="%s"', esc_attr( $css_class ) ); if ( 'current' === $css_class ) { $aria_current = ' aria-current="page"'; } } return sprintf( '%s', esc_url( $url ), $class_html, $aria_current, $link_text ); } protected function get_views() { global $locked_post_status, $avail_post_stati; $post_type = $this->screen->post_type; if ( ! empty( $locked_post_status ) ) { return array(); } $status_links = array(); $num_posts = wp_count_posts( $post_type, 'readable' ); $total_posts = array_sum( (array) $num_posts ); $class = ''; $current_user_id = get_current_user_id(); $all_args = array( 'post_type' => $post_type ); $mine = ''; foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { $total_posts -= $num_posts->$state; } if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) { if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) { $class = 'current'; } $mine_args = array( 'post_type' => $post_type, 'author' => $current_user_id, ); $mine_inner_html = sprintf( _nx( 'Mine (%s)', 'Mine (%s)', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ); $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); $all_args['all_posts'] = 1; $class = ''; } if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { $class = 'current'; } $all_inner_html = sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ); $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); if ( $mine ) { $status_links['mine'] = $mine; } foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { $class = ''; $status_name = $status->name; if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) { continue; } if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { $class = 'current'; } $status_args = array( 'post_status' => $status_name, 'post_type' => $post_type, ); $status_label = sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ); $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); } if ( ! empty( $this->sticky_posts_count ) ) { $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; $sticky_args = array( 'post_type' => $post_type, 'show_sticky' => 1, ); $sticky_inner_html = sprintf( _nx( 'Sticky (%s)', 'Sticky (%s)', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ); $sticky_link = array( 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), ); $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); } return $status_links; } protected function get_bulk_actions() { $actions = array(); $post_type_obj = get_post_type_object( $this->screen->post_type ); if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { if ( $this->is_trash ) { $actions['untrash'] = __( 'Restore' ); } else { $actions['edit'] = __( 'Edit' ); } } if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } } return $actions; } protected function categories_dropdown( $post_type ) { global $cat; if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) { return; } if ( is_object_in_taxonomy( $post_type, 'category' ) ) { $dropdown_options = array( 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat, ); echo ''; wp_dropdown_categories( $dropdown_options ); } } protected function formats_dropdown( $post_type ) { if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) { return; } if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) { return; } $used_post_formats = get_terms( array( 'taxonomy' => 'post_format', 'hide_empty' => true, ) ); if ( ! $used_post_formats ) { return; } $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; ?> + + + +
      + months_dropdown( $this->screen->post_type ); $this->categories_dropdown( $this->screen->post_type ); $this->formats_dropdown( $this->screen->post_type ); do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); $output = ob_get_clean(); if ( ! empty( $output ) ) { echo $output; submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } } if ( $this->is_trash && $this->has_items() && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> +
      + screen->post_type ) ? 'pages' : 'posts', ); } public function get_columns() { $post_type = $this->screen->post_type; $posts_columns = array(); $posts_columns['cb'] = ''; $posts_columns['title'] = _x( 'Title', 'column name' ); if ( post_type_supports( $post_type, 'author' ) ) { $posts_columns['author'] = __( 'Author' ); } $taxonomies = get_object_taxonomies( $post_type, 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); foreach ( $taxonomies as $taxonomy ) { if ( 'category' === $taxonomy ) { $column_key = 'categories'; } elseif ( 'post_tag' === $taxonomy ) { $column_key = 'tags'; } else { $column_key = 'taxonomy-' . $taxonomy; } $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; } $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) { $posts_columns['comments'] = sprintf( '%2$s', esc_attr__( 'Comments' ), __( 'Comments' ) ); } $posts_columns['date'] = __( 'Date' ); if ( 'page' === $post_type ) { $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); } else { $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); } return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); } protected function get_sortable_columns() { return array( 'title' => 'title', 'parent' => 'parent', 'comments' => 'comment_count', 'date' => array( 'date', true ), ); } public function display_rows( $posts = array(), $level = 0 ) { global $wp_query, $per_page; if ( empty( $posts ) ) { $posts = $wp_query->posts; } add_filter( 'the_title', 'esc_html' ); if ( $this->hierarchical_display ) { $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); } else { $this->_display_rows( $posts, $level ); } } private function _display_rows( $posts, $level = 0 ) { $post_type = $this->screen->post_type; $post_ids = array(); foreach ( $posts as $a_post ) { $post_ids[] = $a_post->ID; } if ( post_type_supports( $post_type, 'comments' ) ) { $this->comment_pending_count = get_pending_comments_num( $post_ids ); } foreach ( $posts as $post ) { $this->single_row( $post, $level ); } } private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) { global $wpdb; $level = 0; if ( ! $pages ) { $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); if ( ! $pages ) { return; } } if ( empty( $_REQUEST['s'] ) ) { $top_level_pages = array(); $children_pages = array(); foreach ( $pages as $page ) { if ( $page->post_parent === $page->ID ) { $page->post_parent = 0; $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); clean_post_cache( $page ); } if ( $page->post_parent > 0 ) { $children_pages[ $page->post_parent ][] = $page; } else { $top_level_pages[] = $page; } } $pages = &$top_level_pages; } $count = 0; $start = ( $pagenum - 1 ) * $per_page; $end = $start + $per_page; $to_display = array(); foreach ( $pages as $page ) { if ( $count >= $end ) { break; } if ( $count >= $start ) { $to_display[ $page->ID ] = $level; } $count++; if ( isset( $children_pages ) ) { $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); } } if ( isset( $children_pages ) && $count < $end ) { foreach ( $children_pages as $orphans ) { foreach ( $orphans as $op ) { if ( $count >= $end ) { break; } if ( $count >= $start ) { $to_display[ $op->ID ] = 0; } $count++; } } } $ids = array_keys( $to_display ); _prime_post_caches( $ids ); if ( ! isset( $GLOBALS['post'] ) ) { $GLOBALS['post'] = reset( $ids ); } foreach ( $to_display as $page_id => $level ) { echo "\t"; $this->single_row( $page_id, $level ); } } private function _page_rows( &$children_pages, &$count, $parent_page, $level, $pagenum, $per_page, &$to_display ) { if ( ! isset( $children_pages[ $parent_page ] ) ) { return; } $start = ( $pagenum - 1 ) * $per_page; $end = $start + $per_page; foreach ( $children_pages[ $parent_page ] as $page ) { if ( $count >= $end ) { break; } if ( $count === $start && $page->post_parent > 0 ) { $my_parents = array(); $my_parent = $page->post_parent; while ( $my_parent ) { $parent_id = $my_parent; if ( is_object( $my_parent ) ) { $parent_id = $my_parent->ID; } $my_parent = get_post( $parent_id ); $my_parents[] = $my_parent; if ( ! $my_parent->post_parent ) { break; } $my_parent = $my_parent->post_parent; } $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { $to_display[ $my_parent->ID ] = $level - $num_parents; $num_parents--; } } if ( $count >= $start ) { $to_display[ $page->ID ] = $level; } $count++; $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); } unset( $children_pages[ $parent_page ] ); } public function column_cb( $item ) { $post = $item; $show = current_user_can( 'edit_post', $post->ID ); if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) : ?> + + +
      + + + + +
      + '; echo $this->column_title( $post ); echo $this->handle_row_actions( $post, 'title', $primary ); echo ''; } public function column_title( $post ) { global $mode; if ( $this->hierarchical_display ) { if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) { $find_main_page = (int) $post->post_parent; while ( $find_main_page > 0 ) { $parent = get_post( $find_main_page ); if ( is_null( $parent ) ) { break; } $this->current_level++; $find_main_page = (int) $parent->post_parent; if ( ! isset( $parent_name ) ) { $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); } } } } $can_edit_post = current_user_can( 'edit_post', $post->ID ); if ( $can_edit_post && 'trash' !== $post->post_status ) { $lock_holder = wp_check_post_lock( $post->ID ); if ( $lock_holder ) { $lock_holder = get_userdata( $lock_holder ); $locked_avatar = get_avatar( $lock_holder->ID, 18 ); $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); } else { $locked_avatar = ''; $locked_text = ''; } echo '
      ' . $locked_avatar . ' ' . $locked_text . "
      \n"; } $pad = str_repeat( '— ', $this->current_level ); echo ''; $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' !== $post->post_status ) { printf( '%s%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), $pad, $title ); } else { printf( '%s%s', $pad, $title ); } _post_states( $post ); if ( isset( $parent_name ) ) { $post_type_object = get_post_type_object( $post->post_type ); echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); } echo "\n"; if ( 'excerpt' === $mode && ! is_post_type_hierarchical( $this->screen->post_type ) && current_user_can( 'read_post', $post->ID ) ) { if ( post_password_required( $post ) ) { echo '' . esc_html( get_the_excerpt() ) . ''; } else { echo esc_html( get_the_excerpt() ); } } get_inline_data( $post ); } public function column_date( $post ) { global $mode; if ( '0000-00-00 00:00:00' === $post->post_date ) { $t_time = __( 'Unpublished' ); $time_diff = 0; } else { $t_time = sprintf( __( '%1$s at %2$s' ), get_the_time( __( 'Y/m/d' ), $post ), get_the_time( __( 'g:i a' ), $post ) ); $time = get_post_timestamp( $post ); $time_diff = time() - $time; } if ( 'publish' === $post->post_status ) { $status = __( 'Published' ); } elseif ( 'future' === $post->post_status ) { if ( $time_diff > 0 ) { $status = '' . __( 'Missed schedule' ) . ''; } else { $status = __( 'Scheduled' ); } } else { $status = __( 'Last Modified' ); } $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); if ( $status ) { echo $status . '
      '; } echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); } public function column_comments( $post ) { ?> +
      + comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0; $this->comments_bubble( $post->ID, $pending_comments ); ?> +
      + $post->post_type, 'author' => get_the_author_meta( 'ID' ), ); echo $this->get_edit_link( $args, get_the_author() ); } public function column_default( $item, $column_name ) { $post = $item; if ( 'categories' === $column_name ) { $taxonomy = 'category'; } elseif ( 'tags' === $column_name ) { $taxonomy = 'post_tag'; } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { $taxonomy = substr( $column_name, 9 ); } else { $taxonomy = false; } if ( $taxonomy ) { $taxonomy_object = get_taxonomy( $taxonomy ); $terms = get_the_terms( $post->ID, $taxonomy ); if ( is_array( $terms ) ) { $term_links = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); if ( 'post' !== $post->post_type ) { $posts_in_term_qv['post_type'] = $post->post_type; } if ( $taxonomy_object->query_var ) { $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; } else { $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; } $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); } $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); echo implode( wp_get_list_item_separator(), $term_links ); } else { echo '' . $taxonomy_object->labels->no_terms . ''; } return; } if ( is_post_type_hierarchical( $post->post_type ) ) { do_action( 'manage_pages_custom_column', $column_name, $post->ID ); } else { do_action( 'manage_posts_custom_column', $column_name, $post->ID ); } do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); } public function single_row( $post, $level = 0 ) { $global_post = get_post(); $post = get_post( $post ); $this->current_level = $level; $GLOBALS['post'] = $post; setup_postdata( $post ); $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' ); $lock_holder = wp_check_post_lock( $post->ID ); if ( $lock_holder ) { $classes .= ' wp-locked'; } if ( $post->post_parent ) { $count = count( get_post_ancestors( $post->ID ) ); $classes .= ' level-' . $count; } else { $classes .= ' level-0'; } ?> + + single_row_columns( $post ); ?> + + post_type ); $can_edit_post = current_user_can( 'edit_post', $post->ID ); $actions = array(); $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' !== $post->post_status ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), __( 'Edit' ) ); if ( 'wp_block' !== $post->post_type ) { $actions['inline hide-if-no-js'] = sprintf( '', esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), __( 'Quick Edit' ) ); } } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( 'trash' === $post->post_status ) { $actions['untrash'] = sprintf( '%s', wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), __( 'Restore' ) ); } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = sprintf( '%s', get_delete_post_link( $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), _x( 'Trash', 'verb' ) ); } if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', get_delete_post_link( $post->ID, '', true ), esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ), __( 'Delete Permanently' ) ); } } if ( is_post_type_viewable( $post_type_object ) ) { if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) { if ( $can_edit_post ) { $preview_link = get_preview_post_link( $post ); $actions['view'] = sprintf( '%s', esc_url( $preview_link ), esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), __( 'Preview' ) ); } } elseif ( 'trash' !== $post->post_status ) { $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $title ) ), __( 'View' ) ); } } if ( 'wp_block' === $post->post_type ) { $actions['export'] = sprintf( '', $post->ID, esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), __( 'Export as JSON' ) ); } if ( is_post_type_hierarchical( $post->post_type ) ) { $actions = apply_filters( 'page_row_actions', $actions, $post ); } else { $actions = apply_filters( 'post_row_actions', $actions, $post ); } return $this->row_actions( $actions ); } public function inline_edit() { global $mode; $screen = $this->screen; $post = get_default_post_to_edit( $screen->post_type ); $post_type_object = get_post_type_object( $screen->post_type ); $taxonomy_names = get_object_taxonomies( $screen->post_type ); $hierarchical_taxonomies = array(); $flat_taxonomies = array(); foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); $show_in_quick_edit = $taxonomy->show_in_quick_edit; if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { continue; } if ( $taxonomy->hierarchical ) { $hierarchical_taxonomies[] = $taxonomy; } else { $flat_taxonomies[] = $taxonomy; } } $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; $can_publish = current_user_can( $post_type_object->cap->publish_posts ); $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true, ); ?> -#available-widgets .customize-section-title, -#available-menu-items .customize-section-title { - display: none; -} +
      + + post_type}"; $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; $bulk = 0; while ( $bulk < 2 ) : $classes = $inline_edit_classes . ' '; $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes; ?> + + -/* Hide Widget Settings by Default */ -.widget-inside, -.widget-description { - display: none; -} - -.widget-inside { - background: #fff; -} - -.widget-inside select { - max-width: 100%; -} + +
      +
      + get_charset_collate(); function wp_get_db_schema( $scope = 'all', $blog_id = null ) { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); if ( $blog_id && $blog_id != $wpdb->blogid ) { $old_blog_id = $wpdb->set_blog_id( $blog_id ); } $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); $max_index_length = 191; $blog_tables = "CREATE TABLE $wpdb->termmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + term_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY term_id (term_id), + KEY meta_key (meta_key($max_index_length)) +) $charset_collate; +CREATE TABLE $wpdb->terms ( + term_id bigint(20) unsigned NOT NULL auto_increment, + name varchar(200) NOT NULL default '', + slug varchar(200) NOT NULL default '', + term_group bigint(10) NOT NULL default 0, + PRIMARY KEY (term_id), + KEY slug (slug($max_index_length)), + KEY name (name($max_index_length)) +) $charset_collate; +CREATE TABLE $wpdb->term_taxonomy ( + term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, + term_id bigint(20) unsigned NOT NULL default 0, + taxonomy varchar(32) NOT NULL default '', + description longtext NOT NULL, + parent bigint(20) unsigned NOT NULL default 0, + count bigint(20) NOT NULL default 0, + PRIMARY KEY (term_taxonomy_id), + UNIQUE KEY term_id_taxonomy (term_id,taxonomy), + KEY taxonomy (taxonomy) +) $charset_collate; +CREATE TABLE $wpdb->term_relationships ( + object_id bigint(20) unsigned NOT NULL default 0, + term_taxonomy_id bigint(20) unsigned NOT NULL default 0, + term_order int(11) NOT NULL default 0, + PRIMARY KEY (object_id,term_taxonomy_id), + KEY term_taxonomy_id (term_taxonomy_id) +) $charset_collate; +CREATE TABLE $wpdb->commentmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + comment_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY comment_id (comment_id), + KEY meta_key (meta_key($max_index_length)) +) $charset_collate; +CREATE TABLE $wpdb->comments ( + comment_ID bigint(20) unsigned NOT NULL auto_increment, + comment_post_ID bigint(20) unsigned NOT NULL default '0', + comment_author tinytext NOT NULL, + comment_author_email varchar(100) NOT NULL default '', + comment_author_url varchar(200) NOT NULL default '', + comment_author_IP varchar(100) NOT NULL default '', + comment_date datetime NOT NULL default '0000-00-00 00:00:00', + comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + comment_content text NOT NULL, + comment_karma int(11) NOT NULL default '0', + comment_approved varchar(20) NOT NULL default '1', + comment_agent varchar(255) NOT NULL default '', + comment_type varchar(20) NOT NULL default 'comment', + comment_parent bigint(20) unsigned NOT NULL default '0', + user_id bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (comment_ID), + KEY comment_post_ID (comment_post_ID), + KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), + KEY comment_date_gmt (comment_date_gmt), + KEY comment_parent (comment_parent), + KEY comment_author_email (comment_author_email(10)) +) $charset_collate; +CREATE TABLE $wpdb->links ( + link_id bigint(20) unsigned NOT NULL auto_increment, + link_url varchar(255) NOT NULL default '', + link_name varchar(255) NOT NULL default '', + link_image varchar(255) NOT NULL default '', + link_target varchar(25) NOT NULL default '', + link_description varchar(255) NOT NULL default '', + link_visible varchar(20) NOT NULL default 'Y', + link_owner bigint(20) unsigned NOT NULL default '1', + link_rating int(11) NOT NULL default '0', + link_updated datetime NOT NULL default '0000-00-00 00:00:00', + link_rel varchar(255) NOT NULL default '', + link_notes mediumtext NOT NULL, + link_rss varchar(255) NOT NULL default '', + PRIMARY KEY (link_id), + KEY link_visible (link_visible) +) $charset_collate; +CREATE TABLE $wpdb->options ( + option_id bigint(20) unsigned NOT NULL auto_increment, + option_name varchar(191) NOT NULL default '', + option_value longtext NOT NULL, + autoload varchar(20) NOT NULL default 'yes', + PRIMARY KEY (option_id), + UNIQUE KEY option_name (option_name), + KEY autoload (autoload) +) $charset_collate; +CREATE TABLE $wpdb->postmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + post_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY post_id (post_id), + KEY meta_key (meta_key($max_index_length)) +) $charset_collate; +CREATE TABLE $wpdb->posts ( + ID bigint(20) unsigned NOT NULL auto_increment, + post_author bigint(20) unsigned NOT NULL default '0', + post_date datetime NOT NULL default '0000-00-00 00:00:00', + post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content longtext NOT NULL, + post_title text NOT NULL, + post_excerpt text NOT NULL, + post_status varchar(20) NOT NULL default 'publish', + comment_status varchar(20) NOT NULL default 'open', + ping_status varchar(20) NOT NULL default 'open', + post_password varchar(255) NOT NULL default '', + post_name varchar(200) NOT NULL default '', + to_ping text NOT NULL, + pinged text NOT NULL, + post_modified datetime NOT NULL default '0000-00-00 00:00:00', + post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content_filtered longtext NOT NULL, + post_parent bigint(20) unsigned NOT NULL default '0', + guid varchar(255) NOT NULL default '', + menu_order int(11) NOT NULL default '0', + post_type varchar(20) NOT NULL default 'post', + post_mime_type varchar(100) NOT NULL default '', + comment_count bigint(20) NOT NULL default '0', + PRIMARY KEY (ID), + KEY post_name (post_name($max_index_length)), + KEY type_status_date (post_type,post_status,post_date,ID), + KEY post_parent (post_parent), + KEY post_author (post_author) +) $charset_collate;\n"; $users_single_table = "CREATE TABLE $wpdb->users ( + ID bigint(20) unsigned NOT NULL auto_increment, + user_login varchar(60) NOT NULL default '', + user_pass varchar(255) NOT NULL default '', + user_nicename varchar(50) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + user_url varchar(100) NOT NULL default '', + user_registered datetime NOT NULL default '0000-00-00 00:00:00', + user_activation_key varchar(255) NOT NULL default '', + user_status int(11) NOT NULL default '0', + display_name varchar(250) NOT NULL default '', + PRIMARY KEY (ID), + KEY user_login_key (user_login), + KEY user_nicename (user_nicename), + KEY user_email (user_email) +) $charset_collate;\n"; $users_multi_table = "CREATE TABLE $wpdb->users ( + ID bigint(20) unsigned NOT NULL auto_increment, + user_login varchar(60) NOT NULL default '', + user_pass varchar(255) NOT NULL default '', + user_nicename varchar(50) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + user_url varchar(100) NOT NULL default '', + user_registered datetime NOT NULL default '0000-00-00 00:00:00', + user_activation_key varchar(255) NOT NULL default '', + user_status int(11) NOT NULL default '0', + display_name varchar(250) NOT NULL default '', + spam tinyint(2) NOT NULL default '0', + deleted tinyint(2) NOT NULL default '0', + PRIMARY KEY (ID), + KEY user_login_key (user_login), + KEY user_nicename (user_nicename), + KEY user_email (user_email) +) $charset_collate;\n"; $usermeta_table = "CREATE TABLE $wpdb->usermeta ( + umeta_id bigint(20) unsigned NOT NULL auto_increment, + user_id bigint(20) unsigned NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (umeta_id), + KEY user_id (user_id), + KEY meta_key (meta_key($max_index_length)) +) $charset_collate;\n"; if ( $is_multisite ) { $global_tables = $users_multi_table . $usermeta_table; } else { $global_tables = $users_single_table . $usermeta_table; } $ms_global_tables = "CREATE TABLE $wpdb->blogs ( + blog_id bigint(20) NOT NULL auto_increment, + site_id bigint(20) NOT NULL default '0', + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + registered datetime NOT NULL default '0000-00-00 00:00:00', + last_updated datetime NOT NULL default '0000-00-00 00:00:00', + public tinyint(2) NOT NULL default '1', + archived tinyint(2) NOT NULL default '0', + mature tinyint(2) NOT NULL default '0', + spam tinyint(2) NOT NULL default '0', + deleted tinyint(2) NOT NULL default '0', + lang_id int(11) NOT NULL default '0', + PRIMARY KEY (blog_id), + KEY domain (domain(50),path(5)), + KEY lang_id (lang_id) +) $charset_collate; +CREATE TABLE $wpdb->blogmeta ( + meta_id bigint(20) unsigned NOT NULL auto_increment, + blog_id bigint(20) NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY meta_key (meta_key($max_index_length)), + KEY blog_id (blog_id) +) $charset_collate; +CREATE TABLE $wpdb->registration_log ( + ID bigint(20) NOT NULL auto_increment, + email varchar(255) NOT NULL default '', + IP varchar(30) NOT NULL default '', + blog_id bigint(20) NOT NULL default '0', + date_registered datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (ID), + KEY IP (IP) +) $charset_collate; +CREATE TABLE $wpdb->site ( + id bigint(20) NOT NULL auto_increment, + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + PRIMARY KEY (id), + KEY domain (domain(140),path(51)) +) $charset_collate; +CREATE TABLE $wpdb->sitemeta ( + meta_id bigint(20) NOT NULL auto_increment, + site_id bigint(20) NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value longtext, + PRIMARY KEY (meta_id), + KEY meta_key (meta_key($max_index_length)), + KEY site_id (site_id) +) $charset_collate; +CREATE TABLE $wpdb->signups ( + signup_id bigint(20) NOT NULL auto_increment, + domain varchar(200) NOT NULL default '', + path varchar(100) NOT NULL default '', + title longtext NOT NULL, + user_login varchar(60) NOT NULL default '', + user_email varchar(100) NOT NULL default '', + registered datetime NOT NULL default '0000-00-00 00:00:00', + activated datetime NOT NULL default '0000-00-00 00:00:00', + active tinyint(1) NOT NULL default '0', + activation_key varchar(50) NOT NULL default '', + meta longtext, + PRIMARY KEY (signup_id), + KEY activation_key (activation_key), + KEY user_email (user_email), + KEY user_login_email (user_login,user_email), + KEY domain_path (domain(140),path(51)) +) $charset_collate;"; switch ( $scope ) { case 'blog': $queries = $blog_tables; break; case 'global': $queries = $global_tables; if ( $is_multisite ) { $queries .= $ms_global_tables; } break; case 'ms_global': $queries = $ms_global_tables; break; case 'all': default: $queries = $global_tables . $blog_tables; if ( $is_multisite ) { $queries .= $ms_global_tables; } break; } if ( isset( $old_blog_id ) ) { $wpdb->set_blog_id( $old_blog_id ); } return $queries; } $wp_queries = wp_get_db_schema( 'all' ); function populate_options( array $options = array() ) { global $wpdb, $wp_db_version, $wp_current_db_version; $guessurl = wp_guess_url(); do_action( 'populate_options' ); $stylesheet = WP_DEFAULT_THEME; $template = WP_DEFAULT_THEME; $theme = wp_get_theme( WP_DEFAULT_THEME ); if ( ! $theme->exists() ) { $theme = WP_Theme::get_core_default_theme(); } if ( $theme ) { $stylesheet = $theme->get_stylesheet(); $template = $theme->get_template(); } $timezone_string = ''; $gmt_offset = 0; $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); if ( is_numeric( $offset_or_tz ) ) { $gmt_offset = $offset_or_tz; } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { $timezone_string = $offset_or_tz; } $defaults = array( 'siteurl' => $guessurl, 'home' => $guessurl, 'blogname' => __( 'My Site' ), 'blogdescription' => __( 'Just another WordPress site' ), 'users_can_register' => 0, 'admin_email' => 'you@example.com', 'start_of_week' => _x( '1', 'start of week' ), 'use_balanceTags' => 0, 'use_smilies' => 1, 'require_name_email' => 1, 'comments_notify' => 1, 'posts_per_rss' => 10, 'rss_use_excerpt' => 0, 'mailserver_url' => 'mail.example.com', 'mailserver_login' => 'login@example.com', 'mailserver_pass' => 'password', 'mailserver_port' => 110, 'default_category' => 1, 'default_comment_status' => 'open', 'default_ping_status' => 'open', 'default_pingback_flag' => 1, 'posts_per_page' => 10, 'date_format' => __( 'F j, Y' ), 'time_format' => __( 'g:i a' ), 'links_updated_date_format' => __( 'F j, Y g:i a' ), 'comment_moderation' => 0, 'moderation_notify' => 1, 'permalink_structure' => '', 'rewrite_rules' => '', 'hack_file' => 0, 'blog_charset' => 'UTF-8', 'moderation_keys' => '', 'active_plugins' => array(), 'category_base' => '', 'ping_sites' => 'http://rpc.pingomatic.com/', 'comment_max_links' => 2, 'gmt_offset' => $gmt_offset, 'default_email_category' => 1, 'recently_edited' => '', 'template' => $template, 'stylesheet' => $stylesheet, 'comment_registration' => 0, 'html_type' => 'text/html', 'use_trackback' => 0, 'default_role' => 'subscriber', 'db_version' => $wp_db_version, 'uploads_use_yearmonth_folders' => 1, 'upload_path' => '', 'blog_public' => '1', 'default_link_category' => 2, 'show_on_front' => 'posts', 'tag_base' => '', 'show_avatars' => '1', 'avatar_rating' => 'G', 'upload_url_path' => '', 'thumbnail_size_w' => 150, 'thumbnail_size_h' => 150, 'thumbnail_crop' => 1, 'medium_size_w' => 300, 'medium_size_h' => 300, 'avatar_default' => 'mystery', 'large_size_w' => 1024, 'large_size_h' => 1024, 'image_default_link_type' => 'none', 'image_default_size' => '', 'image_default_align' => '', 'close_comments_for_old_posts' => 0, 'close_comments_days_old' => 14, 'thread_comments' => 1, 'thread_comments_depth' => 5, 'page_comments' => 0, 'comments_per_page' => 50, 'default_comments_page' => 'newest', 'comment_order' => 'asc', 'sticky_posts' => array(), 'widget_categories' => array(), 'widget_text' => array(), 'widget_rss' => array(), 'uninstall_plugins' => array(), 'timezone_string' => $timezone_string, 'page_for_posts' => 0, 'page_on_front' => 0, 'default_post_format' => 0, 'link_manager_enabled' => 0, 'finished_splitting_shared_terms' => 1, 'site_icon' => 0, 'medium_large_size_w' => 768, 'medium_large_size_h' => 0, 'wp_page_for_privacy_policy' => 0, 'show_comments_cookies_opt_in' => 1, 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), 'disallowed_keys' => '', 'comment_previously_approved' => 1, 'auto_plugin_theme_update_emails' => array(), 'auto_update_core_dev' => 'enabled', 'auto_update_core_minor' => 'enabled', 'auto_update_core_major' => 'enabled', 'wp_force_deactivated_plugins' => array(), ); if ( ! is_multisite() ) { $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version ? $wp_current_db_version : $wp_db_version; } if ( is_multisite() ) { $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; } $options = wp_parse_args( $options, $defaults ); $fat_options = array( 'moderation_keys', 'recently_edited', 'disallowed_keys', 'uninstall_plugins', 'auto_plugin_theme_update_emails', ); $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); $insert = ''; foreach ( $options as $option => $value ) { if ( in_array( $option, $existing_options, true ) ) { continue; } if ( in_array( $option, $fat_options, true ) ) { $autoload = 'no'; } else { $autoload = 'yes'; } if ( is_array( $value ) ) { $value = serialize( $value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); } if ( ! empty( $insert ) ) { $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); } if ( ! __get_option( 'home' ) ) { update_option( 'home', $guessurl ); } $unusedoptions = array( 'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit', ); foreach ( $unusedoptions as $option ) { delete_option( $option ); } $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); delete_expired_transients( true ); } function populate_roles() { populate_roles_160(); populate_roles_210(); populate_roles_230(); populate_roles_250(); populate_roles_260(); populate_roles_270(); populate_roles_280(); populate_roles_300(); } function populate_roles_160() { add_role( 'administrator', 'Administrator' ); add_role( 'editor', 'Editor' ); add_role( 'author', 'Author' ); add_role( 'contributor', 'Contributor' ); add_role( 'subscriber', 'Subscriber' ); $role = get_role( 'administrator' ); $role->add_cap( 'switch_themes' ); $role->add_cap( 'edit_themes' ); $role->add_cap( 'activate_plugins' ); $role->add_cap( 'edit_plugins' ); $role->add_cap( 'edit_users' ); $role->add_cap( 'edit_files' ); $role->add_cap( 'manage_options' ); $role->add_cap( 'moderate_comments' ); $role->add_cap( 'manage_categories' ); $role->add_cap( 'manage_links' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'import' ); $role->add_cap( 'unfiltered_html' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_others_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'edit_pages' ); $role->add_cap( 'read' ); $role->add_cap( 'level_10' ); $role->add_cap( 'level_9' ); $role->add_cap( 'level_8' ); $role->add_cap( 'level_7' ); $role->add_cap( 'level_6' ); $role->add_cap( 'level_5' ); $role->add_cap( 'level_4' ); $role->add_cap( 'level_3' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'editor' ); $role->add_cap( 'moderate_comments' ); $role->add_cap( 'manage_categories' ); $role->add_cap( 'manage_links' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'unfiltered_html' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_others_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'edit_pages' ); $role->add_cap( 'read' ); $role->add_cap( 'level_7' ); $role->add_cap( 'level_6' ); $role->add_cap( 'level_5' ); $role->add_cap( 'level_4' ); $role->add_cap( 'level_3' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'author' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'read' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'contributor' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'read' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'subscriber' ); $role->add_cap( 'read' ); $role->add_cap( 'level_0' ); } function populate_roles_210() { $roles = array( 'administrator', 'editor' ); foreach ( $roles as $role ) { $role = get_role( $role ); if ( empty( $role ) ) { continue; } $role->add_cap( 'edit_others_pages' ); $role->add_cap( 'edit_published_pages' ); $role->add_cap( 'publish_pages' ); $role->add_cap( 'delete_pages' ); $role->add_cap( 'delete_others_pages' ); $role->add_cap( 'delete_published_pages' ); $role->add_cap( 'delete_posts' ); $role->add_cap( 'delete_others_posts' ); $role->add_cap( 'delete_published_posts' ); $role->add_cap( 'delete_private_posts' ); $role->add_cap( 'edit_private_posts' ); $role->add_cap( 'read_private_posts' ); $role->add_cap( 'delete_private_pages' ); $role->add_cap( 'edit_private_pages' ); $role->add_cap( 'read_private_pages' ); } $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_users' ); $role->add_cap( 'create_users' ); } $role = get_role( 'author' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_posts' ); $role->add_cap( 'delete_published_posts' ); } $role = get_role( 'contributor' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_posts' ); } } function populate_roles_230() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'unfiltered_upload' ); } } function populate_roles_250() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'edit_dashboard' ); } } function populate_roles_260() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'update_plugins' ); $role->add_cap( 'delete_plugins' ); } } function populate_roles_270() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'install_plugins' ); $role->add_cap( 'update_themes' ); } } function populate_roles_280() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'install_themes' ); } } function populate_roles_300() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'update_core' ); $role->add_cap( 'list_users' ); $role->add_cap( 'remove_users' ); $role->add_cap( 'promote_users' ); $role->add_cap( 'edit_theme_options' ); $role->add_cap( 'delete_themes' ); $role->add_cap( 'export' ); } } if ( ! function_exists( 'install_network' ) ) : function install_network() { if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { define( 'WP_INSTALLING_NETWORK', true ); } dbDelta( wp_get_db_schema( 'global' ) ); } endif; function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { global $wpdb, $current_site, $wp_rewrite; $errors = new WP_Error(); if ( '' === $domain ) { $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); } if ( '' === $site_name ) { $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); } $network_exists = false; if ( is_multisite() ) { if ( get_network( (int) $network_id ) ) { $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); } } else { if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); } } if ( ! is_email( $email ) ) { $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); } if ( $errors->has_errors() ) { return $errors; } if ( 1 == $network_id ) { $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, ) ); $network_id = $wpdb->insert_id; } else { $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id, ) ); } populate_network_meta( $network_id, array( 'admin_email' => $email, 'site_name' => $site_name, 'subdomain_install' => $subdomain_install, ) ); $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) ); if ( ! is_multisite() ) { $current_site = new stdClass; $current_site->domain = $domain; $current_site->path = $path; $current_site->site_name = ucfirst( $domain ); $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ), ) ); $current_site->blog_id = $wpdb->insert_id; update_user_meta( $site_user->ID, 'source_domain', $domain ); update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id ); if ( $subdomain_install ) { $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); } else { $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); } flush_rewrite_rules(); if ( ! $subdomain_install ) { return true; } $vhost_ok = false; $errstr = ''; $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1', ) ); if ( is_wp_error( $page ) ) { $errstr = $page->get_error_message(); } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { $vhost_ok = true; } if ( ! $vhost_ok ) { $msg = '

      ' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '

      '; $msg .= '

      ' . sprintf( __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), '' . $hostname . '' ); if ( ! empty( $errstr ) ) { $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '' . $errstr . '' ); } $msg .= '

      '; $msg .= '

      ' . sprintf( __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), '*' ) . '

      '; $msg .= '

      ' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '

      '; return new WP_Error( 'no_wildcard_dns', $msg ); } } return true; } function populate_network_meta( $network_id, array $meta = array() ) { global $wpdb, $wp_db_version; $network_id = (int) $network_id; $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : ''; $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0; $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false; if ( false === $site_user ) { $site_user = wp_get_current_user(); } if ( empty( $email ) ) { $email = $site_user->user_email; } $template = get_option( 'template' ); $stylesheet = get_option( 'stylesheet' ); $allowed_themes = array( $stylesheet => true ); if ( $template != $stylesheet ) { $allowed_themes[ $template ] = true; } if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { $allowed_themes[ WP_DEFAULT_THEME ] = true; } if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { $core_default = WP_Theme::get_core_default_theme(); if ( $core_default ) { $allowed_themes[ $core_default->get_stylesheet() ] = true; } } if ( function_exists( 'clean_network_cache' ) ) { clean_network_cache( $network_id ); } else { wp_cache_delete( $network_id, 'networks' ); } if ( ! is_multisite() ) { $site_admins = array( $site_user->user_login ); $users = get_users( array( 'fields' => array( 'user_login' ), 'role' => 'administrator', ) ); if ( $users ) { foreach ( $users as $user ) { $site_admins[] = $user->user_login; } $site_admins = array_unique( $site_admins ); } } else { $site_admins = get_site_option( 'site_admins' ); } $welcome_email = __( 'Howdy USERNAME, -/* Dragging widgets over the available widget area show's a "Deactivate" message */ -#removing-widget { - display: none; - font-weight: 400; - padding-right: 15px; - font-size: 12px; - line-height: 1; - color: #000; -} +Your new SITE_NAME site has been successfully set up at: +BLOG_URL -.js #removing-widget { - color: #72aee6; -} +You can log in to the administrator account with the following information: -.widget-control-noform, -#access-off, -.widgets_access .widget-action, -.widgets_access .handlediv, -.widgets_access #access-on, -.widgets_access .widget-holder .description, -.no-js .widget-holder .description { - display: none; -} +Username: USERNAME +Password: PASSWORD +Log in here: BLOG_URLwp-login.php -.widgets_access .widget-holder, -.widgets_access #widget-list { - padding-top: 10px; -} +We hope you enjoy your new site. Thanks! -.widgets_access #access-off { - display: inline; -} +--The Team @ SITE_NAME' ); $misc_exts = array( 'jpg', 'jpeg', 'png', 'gif', 'webp', 'mov', 'avi', 'mpg', '3gp', '3g2', 'midi', 'mid', 'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key', ); $audio_exts = wp_get_audio_extensions(); $video_exts = wp_get_video_extensions(); $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); $sitemeta = array( 'site_name' => __( 'My Network' ), 'admin_email' => $email, 'admin_user_id' => $site_user->ID, 'registration' => 'none', 'upload_filetypes' => implode( ' ', $upload_filetypes ), 'blog_upload_space' => 100, 'fileupload_maxk' => 1500, 'site_admins' => $site_admins, 'allowedthemes' => $allowed_themes, 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), 'wpmu_upgrade_site' => $wp_db_version, 'welcome_email' => $welcome_email, 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ), 'siteurl' => get_option( 'siteurl' ) . '/', 'add_new_users' => '0', 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', 'subdomain_install' => $subdomain_install, 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', 'user_count' => get_site_option( 'user_count' ), 'initial_db_version' => get_option( 'initial_db_version' ), 'active_sitewide_plugins' => array(), 'WPLANG' => get_locale(), ); if ( ! $subdomain_install ) { $sitemeta['illegal_names'][] = 'blog'; } $sitemeta = wp_parse_args( $meta, $sitemeta ); $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); $insert = ''; foreach ( $sitemeta as $meta_key => $meta_value ) { if ( is_array( $meta_value ) ) { $meta_value = serialize( $meta_value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); } $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); } function populate_site_meta( $site_id, array $meta = array() ) { global $wpdb; $site_id = (int) $site_id; if ( ! is_site_meta_supported() ) { return; } if ( empty( $meta ) ) { return; } $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id ); $insert = ''; foreach ( $site_meta as $meta_key => $meta_value ) { if ( is_array( $meta_value ) ) { $meta_value = serialize( $meta_value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value ); } $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); wp_cache_delete( $site_id, 'blog_meta' ); wp_cache_set_sites_last_changed(); } '', 1 => __( 'Item added.' ), 2 => __( 'Item deleted.' ), 3 => __( 'Item updated.' ), 4 => __( 'Item not added.' ), 5 => __( 'Item not updated.' ), 6 => __( 'Items deleted.' ), ); $messages['category'] = array( 0 => '', 1 => __( 'Category added.' ), 2 => __( 'Category deleted.' ), 3 => __( 'Category updated.' ), 4 => __( 'Category not added.' ), 5 => __( 'Category not updated.' ), 6 => __( 'Categories deleted.' ), ); $messages['post_tag'] = array( 0 => '', 1 => __( 'Tag added.' ), 2 => __( 'Tag deleted.' ), 3 => __( 'Tag updated.' ), 4 => __( 'Tag not added.' ), 5 => __( 'Tag not updated.' ), 6 => __( 'Tags deleted.' ), ); $messages = apply_filters( 'term_updated_messages', $messages ); $message = false; if ( isset( $_REQUEST['message'] ) && (int) $_REQUEST['message'] ) { $msg = (int) $_REQUEST['message']; if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { $message = $messages[ $taxonomy ][ $msg ]; } elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) { $message = $messages['_item'][ $msg ]; } } status; $request_id = $item->ID; $row_actions = array(); if ( 'request-confirmed' !== $status ) { $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $erasers_count = count( $erasers ); $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); $remove_data_markup = ''; $remove_data_markup .= '' . '' . '' . ''; $remove_data_markup .= ''; $row_actions['remove-data'] = $remove_data_markup; } if ( 'request-completed' !== $status ) { $complete_request_markup = ''; $complete_request_markup .= sprintf( '%s', esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'complete', 'request_id' => array( $request_id ), ), admin_url( 'erase-personal-data.php' ) ), 'bulk-privacy_requests' ) ), esc_attr( sprintf( __( 'Mark export request for “%s” as completed.' ), $item->email ) ), __( 'Complete request' ) ); $complete_request_markup .= ''; } if ( ! empty( $complete_request_markup ) ) { $row_actions['complete-request'] = $complete_request_markup; } return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) ); } public function column_next_steps( $item ) { $status = $item->status; switch ( $status ) { case 'request-pending': esc_html_e( 'Waiting for confirmation' ); break; case 'request-confirmed': $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $erasers_count = count( $erasers ); $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); echo '
      '; ?> + + + + + '; break; case 'request-failed': echo ''; break; case 'request-completed': echo '' . esc_html__( 'Remove request' ) . ''; break; } } } _screen = $screen; if ( ! empty( $columns ) ) { $this->_columns = $columns; add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); } } protected function get_column_info() { $columns = get_column_headers( $this->_screen ); $hidden = get_hidden_columns( $this->_screen ); $sortable = array(); $primary = $this->get_default_primary_column_name(); return array( $columns, $hidden, $sortable, $primary ); } public function get_columns() { return $this->_columns; } } 'WordPress/' . $version . '; ' . home_url( '/' ) ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_get( $url, $options ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $results = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $results ) ) { return false; } set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); } return $results; } function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { $display_name = '' . esc_html( $display_name ) . ''; } function _wp_credits_build_object_link( &$data ) { $data = '' . esc_html( $data[0] ) . ''; } function wp_credits_section_title( $group_data = array() ) { if ( ! count( $group_data ) ) { return; } if ( $group_data['name'] ) { if ( 'Translators' === $group_data['name'] ) { $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); } elseif ( isset( $group_data['placeholders'] ) ) { $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); } else { $title = translate( $group_data['name'] ); } echo '

      ' . esc_html( $title ) . "

      \n"; } } function wp_credits_section_list( $credits = array(), $slug = '' ) { $group_data = isset( $credits['groups'][ $slug ] ) ? $credits['groups'][ $slug ] : array(); $credits_data = $credits['data']; if ( ! count( $group_data ) ) { return; } if ( ! empty( $group_data['shuffle'] ) ) { shuffle( $group_data['data'] ); } switch ( $group_data['type'] ) { case 'list': array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits_data['profiles'] ); echo '

      ' . wp_sprintf( '%l.', $group_data['data'] ) . "

      \n\n"; break; case 'libraries': array_walk( $group_data['data'], '_wp_credits_build_object_link' ); echo '

      ' . wp_sprintf( '%l.', $group_data['data'] ) . "

      \n\n"; break; default: $compact = 'compact' === $group_data['type']; $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); echo '\n"; break; } } prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); if ( $wpdb->get_var( $sql ) ) { return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); } return false; } function allow_subdomain_install() { $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { return false; } return true; } function allow_subdirectory_install() { global $wpdb; if ( apply_filters( 'allow_subdirectory_install', false ) ) { return true; } if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) { return true; } $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); if ( empty( $post ) ) { return true; } return false; } function get_clean_basedomain() { $existing_domain = network_domain_check(); if ( $existing_domain ) { return $existing_domain; } $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); $slash = strpos( $domain, '/' ); if ( $slash ) { $domain = substr( $domain, 0, $slash ); } return $domain; } function network_step1( $errors = false ) { global $is_apache; if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { echo '

      ' . __( 'Error:' ) . ' ' . sprintf( __( 'The constant %s cannot be defined when creating a network.' ), 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) . '

      '; echo '
      '; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $active_plugins = get_option( 'active_plugins' ); if ( ! empty( $active_plugins ) ) { echo '

      ' . __( 'Warning:' ) . ' ' . sprintf( __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '

      '; echo '

      ' . __( 'Once the network is created, you may reactivate your plugins.' ) . '

      '; echo ''; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $hostname = get_clean_basedomain(); $has_ports = strstr( $hostname, ':' ); if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { echo '

      ' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '

      '; echo '

      ' . sprintf( __( 'You cannot use port numbers such as %s.' ), '' . $has_ports . '' ) . '

      '; echo '' . __( 'Go to Dashboard' ) . ''; echo ''; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } echo '
      '; wp_nonce_field( 'install-network-1' ); $error_codes = array(); if ( is_wp_error( $errors ) ) { echo '

      ' . __( 'Error: The network could not be created.' ) . '

      '; foreach ( $errors->get_error_messages() as $error ) { echo "

      $error

      "; } echo '
      '; $error_codes = $errors->get_error_codes(); } if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) { $site_name = $_POST['sitename']; } else { $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); } if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) { $admin_email = $_POST['email']; } else { $admin_email = get_option( 'admin_email' ); } ?> +

      +

      +

      ' . __( 'Note:' ) . ' '; printf( __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), 'mod_rewrite' ); echo '

      '; } elseif ( $is_apache ) { echo '

      ' . __( 'Warning:' ) . ' '; printf( __( 'It looks like the Apache %s module is not installed.' ), 'mod_rewrite' ); echo '

      '; } if ( $got_mod_rewrite || $is_apache ) { echo '

      '; printf( __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ), 'mod_rewrite', 'https://httpd.apache.org/docs/mod/mod_rewrite.html', 'https://www.google.com/search?q=apache+mod_rewrite' ); echo '

      '; } } if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> +

      +

      +

      +

      + + + + + + + + + + + -.widgets_access .sidebar-name, -.widgets_access .widget .widget-top { - cursor: default; -} +

      ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

      '; } $is_www = ( 0 === strpos( $hostname, 'www.' ) ); if ( $is_www ) : ?> +

      +

      + ' . substr( $hostname, 4 ) . '', '' . $hostname . '', 'www' ); ?> +

      + + + + + + + +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + ' . $errors->get_error_message() . ''; } if ( $_POST ) { if ( allow_subdomain_install() ) { $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; } else { $subdomain_install = false; } } else { if ( is_multisite() ) { $subdomain_install = is_subdomain_install(); ?> +

      + get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); ?> +

      +

      + +

      +

      +

      + ' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %1$s and %2$s files.' ), 'wp-config.php', '.htaccess' ); } elseif ( file_exists( $home_path . 'web.config' ) ) { echo '' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %1$s and %2$s files.' ), 'wp-config.php', 'web.config' ); } else { echo '' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %s file.' ), 'wp-config.php' ); } ?> +

      + +
        +
      1. + above the line reading %3$s:' ), 'wp-config.php', '' . $location_of_wp_config . '', '/* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */' ); ?> +

        + + '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '', ); foreach ( $keys_salts as $c => $v ) { if ( defined( $c ) ) { unset( $keys_salts[ $c ] ); } } if ( ! empty( $keys_salts ) ) { $keys_salts_str = ''; $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); if ( is_wp_error( $from_api ) ) { foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; } } else { $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; } } $num_keys_salts = count( $keys_salts ); ?> +

        + wp-config.php' ); } else { printf( __( 'These unique authentication keys are also missing from your %s file.' ), 'wp-config.php' ); } ?> + +

        + + +
      2. + + + + + + + + + '; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $web_config_file .= ' + + + + '; } $web_config_file .= ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'; echo '
      3. '; printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), 'web.config', '' . $home_path . '' ); echo '

        '; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '

        ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

        '; } ?> + +
      4. +
      -/* Widgets Area Chooser */ -.widget-liquid-left #widgets-left.chooser #available-widgets .widget, -.widget-liquid-left #widgets-left.chooser .inactive-sidebar { - transition: opacity 0.1s linear; -} +

      '; printf( __( 'It seems your network is running with Nginx web server. Learn more about further configuration.' ), __( 'https://wordpress.org/support/article/nginx/' ) ); echo '

      '; else : $ms_files_rewriting = ''; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; } $htaccess_file = <<

      '; printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), '.htaccess', '' . $home_path . '' ); echo '

      '; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '

      ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

      '; } ?> + + + -.widgets-chooser ul, -#widgets-left .widget-in-question .widget-top, -#available-widgets .widget-top:hover, -div#widgets-right .widget-top:hover, -#widgets-left .widget-top:hover { - border-color: #8c8f94; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); -} + +

      + 400 ? 400 / $big : 1; $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $can_restore = false; if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) { $can_restore = wp_basename( $meta['file'] ) !== $backup_sizes['full-orig']['file']; } if ( $msg ) { if ( isset( $msg->error ) ) { $note = ""; } elseif ( isset( $msg->msg ) ) { $note = ""; } } $edit_custom_sizes = false; $edit_custom_sizes = apply_filters( 'edit_custom_thumbnail_sizes', $edit_custom_sizes ); ?> +
      +
      -.widgets-chooser ul.widgets-chooser-sidebars { - margin: 0; - list-style-type: none; - max-height: 300px; - overflow: auto; -} +
      + +
      + + get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ), ) ) ) { $note_no_rotate = ''; ?> + + + ' . __( 'Image rotation is not supported by your web host.' ) . '

      '; ?> + + + -.widgets-chooser { - display: none; -} + + -.widgets-chooser ul { - border: 1px solid #c3c4c7; -} - -.widgets-chooser li { - border-bottom: 1px solid #c3c4c7; - background: #fff; - margin: 0; - position: relative; -} +
      + + + +
      -.widgets-chooser .widgets-chooser-button { - width: 100%; - padding: 10px 35px 10px 15px; - background: transparent; - border: 0; - box-sizing: border-box; - text-align: right; - cursor: pointer; - transition: background 0.2s ease-in-out; -} + + + + + + -/* @todo looks like these hover/focus states are overridden by .widgets-chooser-selected */ -.widgets-chooser .widgets-chooser-button:hover, -.widgets-chooser .widgets-chooser-button:focus { - outline: none; - text-decoration: underline; -} +
      + +
      -.widgets-chooser li:last-child { - border: none; -} +
      + + )" disabled="disabled" class="button button-primary imgedit-submit-btn" value="" /> +
      +
      -.widgets-chooser .widgets-chooser-selected .widgets-chooser-button { - background: #2271b1; - color: #fff; -} +
      +
      +
      +

      + +
      +

      +
      + +

      + ' . $meta['width'] . ' × ' . $meta['height'] . '' ); ?> +

      + +
      -.widgets-chooser .widgets-chooser-selected:before { - content: "\f147"; - display: block; - -webkit-font-smoothing: antialiased; - font: normal 26px/1 dashicons; - color: #fff; - position: absolute; - top: 7px; - right: 5px; -} +
      + +
      + + + + + + ! +
      , 'scale')" class="button button-primary" value="" />
      +
      +
      -.widgets-chooser .widgets-chooser-actions { - padding: 10px 0 12px; - text-align: center; -} +
      +
      +
      -#available-widgets .widget .widget-top { - cursor: pointer; -} + -#available-widgets .widget.ui-draggable-dragging .widget-top { - cursor: move; -} +
      +
      +

      +
      +

      + +

      +
      + , 'restore')" class="button button-primary" value="" /> +
      +
      +
      +
      -/* =Specific widget styling --------------------------------------------------------------- */ -.text-widget-fields { - position: relative; -} -.text-widget-fields [hidden] { - display: none; -} -.text-widget-fields .wp-pointer.wp-pointer-top { - position: absolute; - z-index: 3; - top: 100px; - left: 10px; - right: 10px; -} -.text-widget-fields .wp-pointer .wp-pointer-arrow { - right: auto; - left: 15px; -} -.text-widget-fields .wp-pointer .wp-pointer-buttons { - line-height: 1.4; -} + -.custom-html-widget-fields > p > .CodeMirror { - border: 1px solid #dcdcde; -} -.custom-html-widget-fields code { - padding-top: 1px; - padding-bottom: 1px; -} -ul.CodeMirror-hints { - z-index: 101; /* Due to z-index 100 set on .widget.open */ -} -.widget-control-actions .custom-html-widget-save-button.button.validation-blocked { - cursor: not-allowed; -} +
      +
      +

      + -/* =Media Queries --------------------------------------------------------------- */ +
      +

      -@media screen and (max-width: 782px) { - .widgets-holder-wrap .widget-inside input[type="checkbox"], - .widgets-holder-wrap .widget-inside input[type="radio"], - .editwidget .widget-inside input[type="checkbox"], /* Selectors for the "accessibility mode" page. */ - .editwidget .widget-inside input[type="radio"] { - margin: 0.25rem 0 0.25rem 0.25rem; - } -} +


      +

      -@media screen and (max-width: 480px) { - div.widget-liquid-left { - width: 100%; - float: none; - border-left: none; - padding-left: 0; - } +


      +

      +
      +
      - #widgets-left .sidebar-name { - margin-left: 0; - } +
      + +
      + + + + + +
      +
      - #widgets-left #available-widgets .widget-top { - margin-left: 0; - } +
      + +
      + + + + + +
      +
      - #widgets-left .inactive-sidebar .widgets-sortables { - margin-left: 0; - } +
      - div.widget-liquid-right { - width: 100%; - float: none; - } + - div.widget { - max-width: 480px; - } +
      +
      +

      + +
      +

      +
      +
      - .widget-access-link { - float: none; - margin: 15px 0 0; - } -} +
      + +
      +
      -@media screen and (max-width: 320px) { - div.widget { - max-width: 320px; - } -} +
      +
      + -@media only screen and (min-width: 1250px) { - #widgets-left #available-widgets .widget { - width: 49%; - float: right; - } + + + + - .widget.ui-draggable-dragging { - min-width: 49%; - } + + + + - #widgets-left #available-widgets .widget:nth-child(even) { - float: left; - } + + + + + $size ) { if ( array_key_exists( $size, $meta['sizes'] ) ) { if ( 'thumbnail' === $size ) { continue; } ?> + + + + + +
      +
      +
      - #widgets-right .sidebars-column-1, - #widgets-right .sidebars-column-2 { - float: right; - width: 49%; - } + - #widgets-right .sidebars-column-1 { - margin-left: 2%; - } +
      - #widgets-right.single-sidebar .sidebars-column-1, - #widgets-right.single-sidebar .sidebars-column-2 { - float: none; - width: 100%; - margin: 0; - } -} -/*! This file is auto-generated */ -#adminmenu,#adminmenu .wp-submenu,#adminmenuback,#adminmenuwrap{width:160px;background-color:#1d2327}#adminmenuback{position:fixed;top:0;bottom:-120px;z-index:1}.php-error #adminmenuback{position:absolute}.php-error #adminmenuback,.php-error #adminmenuwrap{margin-top:2em}#adminmenu{clear:right;margin:12px 0;padding:0;list-style:none}.folded #adminmenu,.folded #adminmenu li.menu-top,.folded #adminmenuback,.folded #adminmenuwrap{width:36px}.icon16{height:18px;width:18px;padding:6px;margin:-6px -8px 0 0;float:right}.icon16:before{color:#8c8f94;font:normal 20px/1 dashicons;speak:never;padding:6px 0;height:34px;width:20px;display:inline-block;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transition:all .1s ease-in-out}.icon16.icon-dashboard:before{content:"\f226"}.icon16.icon-post:before{content:"\f109"}.icon16.icon-media:before{content:"\f104"}.icon16.icon-links:before{content:"\f103"}.icon16.icon-page:before{content:"\f105"}.icon16.icon-comments:before{content:"\f101";margin-top:1px}.icon16.icon-appearance:before{content:"\f100"}.icon16.icon-plugins:before{content:"\f106"}.icon16.icon-users:before{content:"\f110"}.icon16.icon-tools:before{content:"\f107"}.icon16.icon-settings:before{content:"\f108"}.icon16.icon-site:before{content:"\f541"}.icon16.icon-generic:before{content:"\f111"}.icon16.icon-appearance,.icon16.icon-comments,.icon16.icon-dashboard,.icon16.icon-generic,.icon16.icon-links,.icon16.icon-media,.icon16.icon-page,.icon16.icon-plugins,.icon16.icon-post,.icon16.icon-settings,.icon16.icon-site,.icon16.icon-tools,.icon16.icon-users,.menu-icon-appearance div.wp-menu-image,.menu-icon-comments div.wp-menu-image,.menu-icon-dashboard div.wp-menu-image,.menu-icon-generic div.wp-menu-image,.menu-icon-links div.wp-menu-image,.menu-icon-media div.wp-menu-image,.menu-icon-page div.wp-menu-image,.menu-icon-plugins div.wp-menu-image,.menu-icon-post div.wp-menu-image,.menu-icon-settings div.wp-menu-image,.menu-icon-site div.wp-menu-image,.menu-icon-tools div.wp-menu-image,.menu-icon-users div.wp-menu-image{background-image:none!important}#adminmenuwrap{position:relative;float:right;z-index:9990}#adminmenu *{-webkit-user-select:none;user-select:none}#adminmenu li{margin:0;padding:0}#adminmenu a{display:block;line-height:1.3;padding:2px 5px;color:#f0f0f1}#adminmenu .wp-submenu a{color:#c3c4c7;color:rgba(240,246,252,.7);font-size:13px;line-height:1.4;margin:0;padding:5px 0}#adminmenu .wp-submenu a:focus,#adminmenu .wp-submenu a:hover{background:0 0}#adminmenu .wp-submenu a:focus,#adminmenu .wp-submenu a:hover,#adminmenu a:hover,#adminmenu li.menu-top>a:focus{color:#72aee6}#adminmenu a:focus,#adminmenu a:hover,.folded #adminmenu .wp-submenu-head:hover{box-shadow:inset -4px 0 0 0 currentColor;transition:box-shadow .1s linear}#adminmenu li.menu-top{border:none;min-height:34px;position:relative}#adminmenu .wp-submenu{list-style:none;position:absolute;top:-1000em;right:160px;overflow:visible;word-wrap:break-word;padding:7px 0 8px;z-index:9999;background-color:#2c3338;box-shadow:0 3px 5px rgba(0,0,0,.2)}#adminmenu a.menu-top:focus+.wp-submenu,.js #adminmenu .opensub .wp-submenu,.js #adminmenu .sub-open,.no-js li.wp-has-submenu:hover .wp-submenu{top:-1px}#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{top:0}#adminmenu .wp-has-current-submenu .wp-submenu,#adminmenu .wp-has-current-submenu .wp-submenu.sub-open,#adminmenu .wp-has-current-submenu.opensub .wp-submenu,.no-js li.wp-has-current-submenu:hover .wp-submenu{position:relative;z-index:3;top:auto;right:auto;left:auto;bottom:auto;border:0 none;margin-top:0;box-shadow:none}.folded #adminmenu .wp-has-current-submenu .wp-submenu{box-shadow:0 3px 5px rgba(0,0,0,.2)}#adminmenu li.menu-top:hover,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus{position:relative;background-color:#1d2327;color:#72aee6}.folded #adminmenu li.menu-top:hover,.folded #adminmenu li.opensub>a.menu-top,.folded #adminmenu li>a.menu-top:focus{z-index:10000}#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head,#adminmenu .wp-menu-arrow,#adminmenu .wp-menu-arrow div,#adminmenu li.current a.menu-top,#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{background:#2271b1;color:#fff}.folded #adminmenu .opensub .wp-submenu,.folded #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,.folded #adminmenu .wp-has-current-submenu a.menu-top:focus+.wp-submenu,.folded #adminmenu .wp-has-current-submenu.opensub .wp-submenu,.folded #adminmenu .wp-submenu.sub-open,.folded #adminmenu a.menu-top:focus+.wp-submenu,.no-js.folded #adminmenu .wp-has-submenu:hover .wp-submenu{top:0;right:36px}.folded #adminmenu .wp-has-current-submenu .wp-submenu,.folded #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{position:absolute;top:-1000em}#adminmenu .wp-not-current-submenu .wp-submenu,.folded #adminmenu .wp-has-current-submenu .wp-submenu{min-width:160px;width:auto;border-right:5px solid transparent}#adminmenu .opensub .wp-submenu li.current a,#adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:focus,#adminmenu .wp-submenu li.current a:hover,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu li.current a{color:#fff}#adminmenu .wp-not-current-submenu li>a,.folded #adminmenu .wp-has-current-submenu li>a{padding-left:16px;padding-right:14px;transition:all .1s ease-in-out,outline 0s}#adminmenu .wp-has-current-submenu ul>li>a,.folded #adminmenu li.menu-top .wp-submenu>li>a{padding:5px 12px}#adminmenu .wp-submenu-head,#adminmenu a.menu-top{font-size:14px;font-weight:400;line-height:1.3;padding:0}#adminmenu .wp-submenu-head{display:none}.folded #adminmenu .wp-menu-name{position:absolute;right:-999px}.folded #adminmenu .wp-submenu-head{display:block}#adminmenu .wp-submenu li{padding:0;margin:0}#adminmenu .wp-menu-image img{padding:9px 0 0;opacity:.6}#adminmenu div.wp-menu-name{padding:8px 36px 8px 8px;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}#adminmenu div.wp-menu-image{float:right;width:36px;height:34px;margin:0;text-align:center}#adminmenu div.wp-menu-image.svg{background-repeat:no-repeat;background-position:center;background-size:20px auto}div.wp-menu-image:before{color:#a7aaad;color:rgba(240,246,252,.6);padding:7px 0;transition:all .1s ease-in-out}#adminmenu div.wp-menu-image:before{color:#a7aaad;color:rgba(240,246,252,.6)}#adminmenu .current div.wp-menu-image:before,#adminmenu .wp-has-current-submenu div.wp-menu-image:before,#adminmenu a.current:hover div.wp-menu-image:before,#adminmenu a.wp-has-current-submenu:hover div.wp-menu-image:before,#adminmenu li.wp-has-current-submenu a:focus div.wp-menu-image:before,#adminmenu li.wp-has-current-submenu.opensub div.wp-menu-image:before,#adminmenu li.wp-has-current-submenu:hover div.wp-menu-image:before{color:#fff}#adminmenu li a:focus div.wp-menu-image:before,#adminmenu li.opensub div.wp-menu-image:before,#adminmenu li:hover div.wp-menu-image:before{color:#72aee6}.folded #adminmenu div.wp-menu-image{width:35px;height:30px;position:absolute;z-index:25}.folded #adminmenu a.menu-top{height:34px}.sticky-menu #adminmenuwrap{position:fixed}.wp-menu-arrow{display:none!important}ul#adminmenu a.wp-has-current-submenu{position:relative}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{left:0;border:solid 8px transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-left-color:#f0f0f1;top:50%;margin-top:-8px}.folded ul#adminmenu li.wp-has-current-submenu:focus-within a.wp-has-current-submenu:after,.folded ul#adminmenu li:hover a.wp-has-current-submenu:after{display:none}.folded ul#adminmenu a.wp-has-current-submenu:after,.folded ul#adminmenu>li a.current:after{border-width:4px;margin-top:-4px}#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after{left:0;border:8px solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;top:10px;z-index:10000}.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after,.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after{border-width:4px;margin-top:-4px;top:18px}#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after{border-left-color:#2c3338}#adminmenu li.menu-top:hover .wp-menu-image img,#adminmenu li.wp-has-current-submenu .wp-menu-image img{opacity:1}#adminmenu li.wp-menu-separator{height:5px;padding:0;margin:0 0 6px;cursor:inherit}#adminmenu div.separator{height:2px;padding:0}#adminmenu .wp-submenu .wp-submenu-head{color:#fff;font-weight:400;font-size:14px;padding:5px 11px 5px 4px;margin:-7px -5px 4px 0;border-width:3px 5px 3px 0;border-style:solid;border-color:transparent}#adminmenu li.current,.folded #adminmenu li.wp-menu-open{border:0 none}#adminmenu .awaiting-mod,#adminmenu .update-plugins{display:inline-block;vertical-align:top;box-sizing:border-box;margin:1px 2px -1px 0;padding:0 5px;min-width:18px;height:18px;border-radius:9px;background-color:#d63638;color:#fff;font-size:11px;line-height:1.6;text-align:center;z-index:26}#adminmenu li a.wp-has-current-submenu .update-plugins,#adminmenu li.current a .awaiting-mod{background-color:#d63638;color:#fff}#adminmenu li span.count-0{display:none}#collapse-button{display:block;width:100%;height:34px;margin:0;border:none;padding:0;position:relative;overflow:visible;background:0 0;color:#a7aaad;cursor:pointer}#collapse-button:hover{color:#72aee6}#collapse-button:focus{color:#72aee6;outline:1px solid transparent;outline-offset:-1px}#collapse-button .collapse-button-icon,#collapse-button .collapse-button-label{display:block;position:absolute;top:0;right:0}#collapse-button .collapse-button-label{top:8px}#collapse-button .collapse-button-icon{width:36px;height:34px}#collapse-button .collapse-button-label{padding:0 36px 0 0}.folded #collapse-button .collapse-button-label{display:none}#collapse-button .collapse-button-icon:after{content:"\f148";display:block;position:relative;top:7px;text-align:center;font:normal 20px/1 dashicons!important;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.folded #collapse-button .collapse-button-icon:after,.rtl #collapse-button .collapse-button-icon:after{transform:rotate(180deg)}.rtl.folded #collapse-button .collapse-button-icon:after{transform:none}#collapse-button .collapse-button-icon:after,#collapse-button .collapse-button-label{transition:all .1s ease-in-out}li#wp-admin-bar-menu-toggle{display:none}.customize-support #menu-appearance a[href="themes.php?page=custom-background"],.customize-support #menu-appearance a[href="themes.php?page=custom-header"]{display:none}@media only screen and (max-width:960px){.auto-fold #wpcontent,.auto-fold #wpfooter{margin-right:36px}.auto-fold #adminmenu,.auto-fold #adminmenu li.menu-top,.auto-fold #adminmenuback,.auto-fold #adminmenuwrap{width:36px}.auto-fold #adminmenu .opensub .wp-submenu,.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus+.wp-submenu,.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,.auto-fold #adminmenu .wp-submenu.sub-open,.auto-fold #adminmenu a.menu-top:focus+.wp-submenu{top:0;right:36px}.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu,.auto-fold #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{position:absolute;top:-1000em;margin-left:-1px;padding:7px 0 8px;z-index:9999}.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu{min-width:150px;width:auto}.auto-fold #adminmenu .wp-has-current-submenu li>a{padding-left:16px;padding-right:14px}.auto-fold #adminmenu li.menu-top .wp-submenu>li>a{padding-right:12px}.auto-fold #adminmenu .wp-menu-name{position:absolute;right:-999px}.auto-fold #adminmenu .wp-submenu-head{display:block}.auto-fold #adminmenu div.wp-menu-image{height:30px;width:34px;position:absolute;z-index:25}.auto-fold #adminmenu a.menu-top{min-height:34px}.auto-fold #adminmenu li.wp-menu-open{border:0 none}.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last{margin-bottom:0}.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after,.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after{display:none}.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after,.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after{border-width:4px;margin-top:-4px;top:16px}.auto-fold ul#adminmenu a.wp-has-current-submenu:after,.auto-fold ul#adminmenu>li a.current:after{border-width:4px;margin-top:-4px}.auto-fold #adminmenu li.menu-top:hover,.auto-fold #adminmenu li.opensub>a.menu-top,.auto-fold #adminmenu li>a.menu-top:focus{z-index:10000}.auto-fold #collapse-menu .collapse-button-label{display:none}.auto-fold #collapse-button .collapse-button-icon:after{transform:rotate(180deg)}.rtl.auto-fold #collapse-button .collapse-button-icon:after{transform:none}}@media screen and (max-width:782px){.auto-fold #wpcontent{position:relative;margin-right:0;padding-right:10px}.sticky-menu #adminmenuwrap{position:relative;z-index:auto;top:0}.auto-fold #adminmenu,.auto-fold #adminmenuback,.auto-fold #adminmenuwrap{position:absolute;width:190px;z-index:100}.auto-fold #adminmenuback{position:fixed}.auto-fold #adminmenuback,.auto-fold #adminmenuwrap{display:none}.auto-fold .wp-responsive-open #adminmenuback,.auto-fold .wp-responsive-open #adminmenuwrap{display:block}.auto-fold #adminmenu li.menu-top{width:100%}.auto-fold #adminmenu li a{font-size:16px;padding:5px}.auto-fold #adminmenu li.menu-top .wp-submenu>li>a{padding:10px 20px 10px 10px}.auto-fold #adminmenu .wp-menu-name{position:static}.auto-fold ul#adminmenu a.wp-has-current-submenu:after,.auto-fold ul#adminmenu>li.current>a.current:after{border-width:8px;margin-top:-8px}.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:focus-within:after,.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after{display:none}#adminmenu .wp-submenu{position:relative;display:none}.auto-fold #adminmenu .selected .wp-submenu,.auto-fold #adminmenu .wp-menu-open .wp-submenu{position:relative;display:block;top:0;right:-1px;box-shadow:none}.auto-fold #adminmenu .selected .wp-submenu:after,.auto-fold #adminmenu .wp-menu-open .wp-submenu:after{display:none}.auto-fold #adminmenu .opensub .wp-submenu{display:none}.auto-fold #adminmenu .selected .wp-submenu{display:block}.auto-fold ul#adminmenu li:focus-within a.wp-has-current-submenu:after,.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after{display:block}.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus+.wp-submenu,.auto-fold #adminmenu a.menu-top:focus+.wp-submenu{position:relative;right:-1px;left:0;top:0}#adminmenu .wp-not-current-submenu .wp-submenu,.folded #adminmenu .wp-has-current-submenu .wp-submenu{border-right:none}#adminmenu .wp-submenu .wp-submenu-head{display:none}#wp-responsive-toggle{position:fixed;top:5px;right:4px;padding-left:10px;z-index:99999;border:none;box-sizing:border-box}#wpadminbar #wp-admin-bar-menu-toggle a{display:block;padding:0;overflow:hidden;outline:0;text-decoration:none;border:1px solid transparent;background:0 0;height:44px;margin-right:-1px}.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a{background:#2c3338}li#wp-admin-bar-menu-toggle{display:block}#wpadminbar #wp-admin-bar-menu-toggle a:hover{border:1px solid transparent}#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before{content:"\f228";display:inline-block;float:right;font:normal 40px/45px dashicons;vertical-align:middle;outline:0;margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;height:44px;width:50px;padding:0;border:none;text-align:center;text-decoration:none;box-sizing:border-box}.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before{color:#72aee6}}@media screen and (max-width:600px){#adminmenuback,#adminmenuwrap{display:none}.wp-responsive-open #adminmenuback,.wp-responsive-open #adminmenuwrap{display:block}.auto-fold #adminmenu{top:46px}}/*! This file is auto-generated */ -.farbtastic{position:relative}.farbtastic *{position:absolute;cursor:crosshair}.farbtastic,.farbtastic .wheel{width:195px;height:195px}.farbtastic .color,.farbtastic .overlay{top:47px;right:47px;width:101px;height:101px}.farbtastic .wheel{background:url(../images/wheel.png) no-repeat;width:195px;height:195px}.farbtastic .overlay{background:url(../images/mask.png) no-repeat}.farbtastic .marker{width:17px;height:17px;margin:-8px -8px 0 0;overflow:hidden;background:url(../images/marker.png) no-repeat}/*! This file is auto-generated */ -button,input,select,textarea{box-sizing:border-box;font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea{font-size:14px}textarea{overflow:auto;padding:2px 6px;line-height:1.42857143;resize:vertical}label{cursor:pointer}input,select{margin:0 1px}textarea.code{padding:4px 6px 1px}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select,textarea{box-shadow:0 0 0 transparent;border-radius:4px;border:1px solid #8c8f94;background-color:#fff;color:#2c3338}input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week]{padding:0 8px;line-height:2;min-height:30px}::-webkit-datetime-edit{line-height:1.85714286}input[type=checkbox]:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=radio]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,select:focus,textarea:focus{border-color:#2271b1;box-shadow:0 0 0 1px #2271b1;outline:2px solid transparent}input[type=email],input[type=url]{direction:ltr}input[type=checkbox],input[type=radio]{border:1px solid #8c8f94;border-radius:4px;background:#fff;color:#50575e;clear:none;cursor:pointer;display:inline-block;line-height:0;height:1rem;margin:-.25rem .25rem 0 0;outline:0;padding:0!important;text-align:center;vertical-align:middle;width:1rem;min-width:1rem;-webkit-appearance:none;box-shadow:inset 0 1px 2px rgba(0,0,0,.1);transition:.05s border-color ease-in-out}input[type=radio]:checked+label:before{color:#8c8f94}.wp-core-ui input[type=reset]:active,.wp-core-ui input[type=reset]:hover{color:#135e96}.wp-admin p input[type=checkbox],.wp-admin p input[type=radio],td>input[type=checkbox]{margin-top:0}.wp-admin p label input[type=checkbox]{margin-top:-4px}.wp-admin p label input[type=radio]{margin-top:-2px}input[type=radio]{border-radius:50%;margin-right:.25rem;line-height:.71428571}input[type=checkbox]:checked::before,input[type=radio]:checked::before{float:left;display:inline-block;vertical-align:middle;width:1rem;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}input[type=checkbox]:checked::before{content:url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%233582c4%27%2F%3E%3C%2Fsvg%3E");margin:-.1875rem 0 0 -.25rem;height:1.3125rem;width:1.3125rem}input[type=radio]:checked::before{content:"";border-radius:50%;width:.5rem;height:.5rem;margin:.1875rem;background-color:#3582c4;line-height:1.14285714}@-moz-document url-prefix(){.form-table input.tog,input[type=checkbox],input[type=radio]{margin-bottom:-1px}}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-decoration{display:none}.wp-admin input[type=file]{padding:3px 0;cursor:pointer}input.readonly,input[readonly],textarea.readonly,textarea[readonly]{background-color:#f0f0f1}::-webkit-input-placeholder{color:#646970}::-moz-placeholder{color:#646970;opacity:1}:-ms-input-placeholder{color:#646970}.form-invalid .form-required,.form-invalid .form-required:focus,.form-invalid.form-required input,.form-invalid.form-required input:focus,.form-invalid.form-required select,.form-invalid.form-required select:focus{border-color:#d63638!important;box-shadow:0 0 2px rgba(214,54,56,.8)}.form-table .form-required.form-invalid td:after{content:"\f534";font:normal 20px/1 dashicons;color:#d63638;margin-left:-25px;vertical-align:middle}.form-table .form-required.user-pass1-wrap.form-invalid td:after{content:""}.form-table .form-required.user-pass1-wrap.form-invalid .password-input-wrapper:after{content:"\f534";font:normal 20px/1 dashicons;color:#d63638;margin:0 6px 0 -29px;vertical-align:middle}.form-input-tip{color:#646970}input.disabled,input:disabled,select.disabled,select:disabled,textarea.disabled,textarea:disabled{background:rgba(255,255,255,.5);border-color:rgba(220,220,222,.75);box-shadow:inset 0 1px 2px rgba(0,0,0,.04);color:rgba(44,51,56,.5)}input[type=file].disabled,input[type=file]:disabled,input[type=range].disabled,input[type=range]:disabled{background:0 0;box-shadow:none;cursor:default}input[type=checkbox].disabled,input[type=checkbox].disabled:checked:before,input[type=checkbox]:disabled,input[type=checkbox]:disabled:checked:before,input[type=radio].disabled,input[type=radio].disabled:checked:before,input[type=radio]:disabled,input[type=radio]:disabled:checked:before{opacity:.7}.wp-core-ui select{font-size:14px;line-height:2;color:#2c3338;border-color:#8c8f94;box-shadow:none;border-radius:3px;padding:0 24px 0 8px;min-height:30px;max-width:25rem;-webkit-appearance:none;background:#fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E') no-repeat right 5px top 55%;background-size:16px 16px;cursor:pointer;vertical-align:middle}.wp-core-ui select:hover{color:#2271b1}.wp-core-ui select:focus{border-color:#2271b1;color:#0a4b78;box-shadow:0 0 0 1px #2271b1}.wp-core-ui select:active{border-color:#8c8f94;box-shadow:none}.wp-core-ui select.disabled,.wp-core-ui select:disabled{color:#a7aaad;border-color:#dcdcde;background-color:#f6f7f7;background-image:url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23a0a5aa%22%2F%3E%3C%2Fsvg%3E');box-shadow:none;text-shadow:0 1px 0 #fff;cursor:default;transform:none}.wp-core-ui select:-moz-focusring{color:transparent;text-shadow:0 0 0 #0a4b78}.wp-core-ui select::-ms-value{background:0 0;color:#50575e}.wp-core-ui select:hover::-ms-value{color:#2271b1}.wp-core-ui select:focus::-ms-value{color:#0a4b78}.wp-core-ui select.disabled::-ms-value,.wp-core-ui select:disabled::-ms-value{color:#a7aaad}.wp-core-ui select::-ms-expand{display:none}.wp-admin .button-cancel{display:inline-block;min-height:28px;padding:0 5px;line-height:2}.meta-box-sortables select{max-width:100%}.meta-box-sortables input{vertical-align:middle}.misc-pub-post-status select{margin-top:0}.wp-core-ui select[multiple]{height:auto;padding-right:8px;background:#fff}.submit{padding:1.5em 0;margin:5px 0;border-bottom-left-radius:3px;border-bottom-right-radius:3px;border:none}form p.submit a.cancel:hover{text-decoration:none}p.submit{text-align:left;max-width:100%;margin-top:20px;padding-top:10px}.textright p.submit{border:none;text-align:right}table.form-table+input+input+p.submit,table.form-table+input+p.submit,table.form-table+p.submit{border-top:none;padding-top:0}#major-publishing-actions input,#minor-publishing-actions .preview,#minor-publishing-actions input{text-align:center}input.all-options,textarea.all-options{width:250px}input.large-text,textarea.large-text{width:99%}.regular-text{width:25em}input.small-text{width:50px;padding:0 6px}label input.small-text{margin-top:-4px}input[type=number].small-text{width:65px;padding-right:0}input.tiny-text{width:35px}input[type=number].tiny-text{width:45px;padding-right:0}#doaction,#doaction2,#post-query-submit{margin:0 8px 0 0}.no-js input#changeit2,.no-js input#doaction2,.no-js label[for=bulk-action-selector-bottom],.no-js label[for=new_role2],.no-js select#bulk-action-selector-bottom,.no-js select#new_role2{display:none}.tablenav .actions select{float:left;margin-right:6px;max-width:12.5rem}#timezone_string option{margin-left:1em}.wp-cancel-pw>.dashicons,.wp-hide-pw>.dashicons{position:relative;top:3px;width:1.25rem;height:1.25rem;top:.25rem;font-size:20px}.wp-cancel-pw .dashicons-no{display:none}#your-profile label+a,label{vertical-align:middle}#your-profile label+a,fieldset label{vertical-align:middle}.options-media-php [for*="_size_"]{min-width:10em;vertical-align:baseline}.options-media-php .small-text[name*="_size_"]{margin:0 0 1em}.wp-generate-pw{margin-top:1em}.wp-pwd{margin-top:1em}#misc-publishing-actions label{vertical-align:baseline}#pass-strength-result{background-color:#f0f0f1;border:1px solid #dcdcde;color:#1d2327;margin:-1px 1px 5px;padding:3px 5px;text-align:center;width:25em;box-sizing:border-box;opacity:0}#pass-strength-result.short{background-color:#ffabaf;border-color:#e65054;opacity:1}#pass-strength-result.bad{background-color:#facfd2;border-color:#f86368;opacity:1}#pass-strength-result.good{background-color:#f5e6ab;border-color:#f0c33c;opacity:1}#pass-strength-result.strong{background-color:#b8e6bf;border-color:#68de7c;opacity:1}.password-input-wrapper input{font-family:Consolas,Monaco,monospace}#pass1-text.short,#pass1.short{border-color:#e65054}#pass1-text.bad,#pass1.bad{border-color:#f86368}#pass1-text.good,#pass1.good{border-color:#f0c33c}#pass1-text.strong,#pass1.strong{border-color:#68de7c}.pw-weak{display:none}.indicator-hint{padding-top:8px}.wp-pwd [type=password],.wp-pwd [type=text]{margin-bottom:0;min-height:30px}.wp-pwd input::-ms-reveal{display:none}#pass1-text,.show-password #pass1{display:none}#pass1-text::-ms-clear{display:none}.show-password #pass1-text{display:inline-block}p.search-box{float:right;margin:0}.network-admin.themes-php p.search-box{clear:left}.search-box input[name="s"],.tablenav .search-plugins input[name="s"],.tagsdiv .newtag{float:left;margin:0 4px 0 0}.js.plugins-php .search-box .wp-filter-search{margin:0;width:280px}input[type=email].ui-autocomplete-loading,input[type=text].ui-autocomplete-loading{background-image:url(../images/loading.gif);background-repeat:no-repeat;background-position:right center;visibility:visible}input.ui-autocomplete-input.open{border-bottom-color:transparent}ul#add-to-blog-users{margin:0 0 0 14px}.ui-autocomplete{padding:0;margin:0;list-style:none;position:absolute;z-index:10000;border:1px solid #4f94d4;box-shadow:0 1px 2px rgba(79,148,212,.8);background-color:#fff}.ui-autocomplete li{margin-bottom:0;padding:4px 10px;white-space:nowrap;text-align:left;cursor:pointer}.ui-autocomplete .ui-state-focus{background-color:#dcdcde}.wp-tags-autocomplete .ui-state-focus,.wp-tags-autocomplete [aria-selected=true]{background-color:#2271b1;color:#fff;outline:2px solid transparent}.form-table{border-collapse:collapse;margin-top:.5em;width:100%;clear:both}.form-table,.form-table td,.form-table td p,.form-table th{font-size:14px}.form-table td{margin-bottom:9px;padding:15px 10px;line-height:1.3;vertical-align:middle}.form-table th,.form-wrap label{color:#1d2327;font-weight:400;text-shadow:none;vertical-align:baseline}.form-table th{vertical-align:top;text-align:left;padding:20px 10px 20px 0;width:200px;line-height:1.3;font-weight:600}.form-table .td-full,.form-table th.th-full{width:auto;padding:20px 10px 20px 0;font-weight:400}.form-table td p{margin-top:4px;margin-bottom:0}.form-table .date-time-doc{margin-top:1em}.form-table p.timezone-info{margin:1em 0}.form-table td fieldset label{margin:.35em 0 .5em!important;display:inline-block}.form-table td fieldset p label{margin-top:0!important}.form-table td fieldset label,.form-table td fieldset li,.form-table td fieldset p{line-height:1.4}.form-table input.tog,.form-table input[type=radio]{margin-top:-4px;margin-right:4px;float:none}.form-table .pre{padding:8px;margin:0}table.form-table td .updated{font-size:13px}table.form-table td .updated p{font-size:13px;margin:.3em 0}#profile-page .form-table textarea{width:500px;margin-bottom:6px}#profile-page .form-table #rich_editing{margin-right:5px}#your-profile legend{font-size:22px}#display_name{width:15em}#adduser .form-field input,#createuser .form-field input{width:25em}.color-option{display:inline-block;width:24%;padding:5px 15px 15px;box-sizing:border-box;margin-bottom:3px}.color-option.selected,.color-option:hover{background:#dcdcde}.color-palette{width:100%;border-spacing:0;border-collapse:collapse}.color-palette td{height:20px;padding:0;border:none}.color-option{cursor:pointer}.create-application-password .form-field{max-width:25em}.create-application-password label{font-weight:600}.create-application-password p.submit{margin-bottom:0;padding-bottom:0;display:block}#application-passwords-section .notice{margin-top:20px;margin-bottom:0}.application-password-display input.code{width:19em}.auth-app-card.card{max-width:768px}.authorize-application-php .form-wrap p{display:block}.tool-box .title{margin:8px 0;font-size:18px;font-weight:400;line-height:24px}.label-responsive{vertical-align:middle}#export-filters p{margin:0 0 1em}#export-filters p.submit{margin:7px 0 5px}.card{position:relative;margin-top:20px;padding:.7em 2em 1em;min-width:255px;max-width:520px;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;box-sizing:border-box}.pressthis h4{margin:2em 0 1em}.pressthis textarea{width:100%;font-size:1em}#pressthis-code-wrap{overflow:auto}.pressthis-bookmarklet-wrapper{margin:20px 0 8px;vertical-align:top;position:relative;z-index:1}.pressthis-bookmarklet,.pressthis-bookmarklet:active,.pressthis-bookmarklet:focus,.pressthis-bookmarklet:hover{display:inline-block;position:relative;cursor:move;color:#2c3338;background:#dcdcde;border-radius:5px;border:1px solid #c3c4c7;font-style:normal;line-height:16px;font-size:14px;text-decoration:none}.pressthis-bookmarklet:active{outline:0}.pressthis-bookmarklet:after{content:"";width:70%;height:55%;z-index:-1;position:absolute;right:10px;bottom:9px;background:0 0;transform:skew(20deg) rotate(6deg);box-shadow:0 10px 8px rgba(0,0,0,.6)}.pressthis-bookmarklet:hover:after{transform:skew(20deg) rotate(9deg);box-shadow:0 10px 8px rgba(0,0,0,.7)}.pressthis-bookmarklet span{display:inline-block;margin:0;padding:0 12px 8px 9px}.pressthis-bookmarklet span:before{color:#787c82;font:normal 20px/1 dashicons;content:"\f157";position:relative;display:inline-block;top:4px;margin-right:4px}.pressthis-js-toggle{margin-left:10px;padding:0;height:auto;vertical-align:top}.pressthis-js-toggle.button.button{margin-left:10px;padding:0;height:auto;vertical-align:top}.pressthis-js-toggle .dashicons{margin:5px 8px 6px 7px;color:#50575e}.timezone-info code{white-space:nowrap}.defaultavatarpicker .avatar{margin:2px 0;vertical-align:middle}.options-general-php .date-time-text{display:inline-block;min-width:10em}.options-general-php input.small-text{width:56px;margin:-2px 0}.options-general-php .spinner{float:none;margin:-3px 3px 0}.options-general-php .language-install-spinner,.settings-php .language-install-spinner{display:inline-block;float:none;margin:-3px 5px 0;vertical-align:middle}.form-table.permalink-structure .available-structure-tags li{float:left;margin-right:5px}.setup-php textarea{max-width:100%}.form-field #site-address{max-width:25em}.form-field #domain{max-width:22em}.form-field #admin-email,.form-field #blog_last_updated,.form-field #blog_registered,.form-field #path,.form-field #site-title{max-width:25em}.form-field #path{margin-bottom:5px}#search-sites,#search-users{max-width:60%}.request-filesystem-credentials-dialog{display:none;visibility:visible}.request-filesystem-credentials-dialog .notification-dialog{top:10%;max-height:85%}.request-filesystem-credentials-dialog-content{margin:25px}#request-filesystem-credentials-title{font-size:1.3em;margin:1em 0}.request-filesystem-credentials-form legend{font-size:1em;padding:1.33em 0;font-weight:600}.request-filesystem-credentials-form input[type=password],.request-filesystem-credentials-form input[type=text]{display:block}.request-filesystem-credentials-dialog input[type=password],.request-filesystem-credentials-dialog input[type=text]{width:100%}.request-filesystem-credentials-form .field-title{font-weight:600}.request-filesystem-credentials-dialog label[for=hostname],.request-filesystem-credentials-dialog label[for=private_key],.request-filesystem-credentials-dialog label[for=public_key]{display:block;margin-bottom:1em}.request-filesystem-credentials-dialog .ftp-password,.request-filesystem-credentials-dialog .ftp-username{float:left;width:48%}.request-filesystem-credentials-dialog .ftp-password{margin-left:4%}.request-filesystem-credentials-dialog .request-filesystem-credentials-action-buttons{text-align:right}.request-filesystem-credentials-dialog label[for=ftp]{margin-right:10px}.request-filesystem-credentials-dialog #auth-keys-desc{margin-bottom:0}#request-filesystem-credentials-dialog .button:not(:last-child){margin-right:10px}#request-filesystem-credentials-form .cancel-button{display:none}#request-filesystem-credentials-dialog .cancel-button{display:inline}.request-filesystem-credentials-dialog .ftp-password,.request-filesystem-credentials-dialog .ftp-username{float:none;width:auto}.request-filesystem-credentials-dialog .ftp-username{margin-bottom:1em}.request-filesystem-credentials-dialog .ftp-password{margin:0}.request-filesystem-credentials-dialog .ftp-password em{color:#8c8f94}.request-filesystem-credentials-dialog label{display:block;line-height:1.5;margin-bottom:1em}.request-filesystem-credentials-form legend{padding-bottom:0}.request-filesystem-credentials-form #ssh-keys legend{font-size:1.3em}.request-filesystem-credentials-form .notice{margin:0 0 20px;clear:both}.tools-privacy-policy-page form{margin-bottom:1.3em}.tools-privacy-policy-page input.button{margin:0 1px 0 6px}.tools-privacy-policy-page select{margin:0 1px .5em 6px}.tools-privacy-edit{margin:1.5em 0}.tools-privacy-policy-page span{line-height:2}.privacy_requests .column-email{width:40%}.privacy_requests .column-type{text-align:center}.privacy_requests tfoot td:first-child,.privacy_requests thead td:first-child{border-left:4px solid #fff}.privacy_requests tbody th{border-left:4px solid #fff;background:#fff;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.privacy_requests .row-actions{color:#787c82}.privacy_requests .row-actions.processing{position:static}.privacy_requests tbody .has-request-results th{box-shadow:none}.privacy_requests tbody .request-results th .notice{margin:0 0 5px}.privacy_requests tbody td{background:#fff;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.privacy_requests tbody .has-request-results td{box-shadow:none}.privacy_requests .next_steps .button{word-wrap:break-word;white-space:normal}.privacy_requests .status-request-confirmed td,.privacy_requests .status-request-confirmed th{background-color:#fff;border-left-color:#72aee6}.privacy_requests .status-request-failed td,.privacy_requests .status-request-failed th{background-color:#f6f7f7;border-left-color:#d63638}.privacy_requests .export_personal_data_failed a{vertical-align:baseline}.status-label{font-weight:600}.status-label.status-request-pending{font-weight:400;font-style:italic;color:#646970}.status-label.status-request-failed{color:#d63638;font-weight:600}.wp-privacy-request-form{clear:both}.wp-privacy-request-form-field{margin:1.5em 0}.wp-privacy-request-form input{margin:0}.email-personal-data::before{display:inline-block;font:normal 20px/1 dashicons;margin:3px 5px 0 -2px;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}.email-personal-data--sending::before{color:#d63638;content:"\f463";animation:rotation 2s infinite linear}.email-personal-data--sent::before{color:#68de7c;content:"\f147"}@media screen and (max-width:782px){textarea{-webkit-appearance:none}input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week]{-webkit-appearance:none;padding:3px 10px;min-height:40px}::-webkit-datetime-edit{line-height:1.875}.widefat tfoot td input[type=checkbox],.widefat th input[type=checkbox],.widefat thead td input[type=checkbox],input[type=checkbox]{-webkit-appearance:none}.widefat tfoot td input[type=checkbox],.widefat th input[type=checkbox],.widefat thead td input[type=checkbox]{margin-bottom:8px}.widefat tfoot td input[type=checkbox]:before,.widefat th input[type=checkbox]:before,.widefat thead td input[type=checkbox]:before,input[type=checkbox]:checked:before{width:1.875rem;height:1.875rem;margin:-.1875rem -.3125rem}input[type=checkbox],input[type=radio]{height:1.5625rem;width:1.5625rem}.wp-admin p input[type=checkbox],.wp-admin p input[type=radio]{margin-top:-.1875rem}input[type=radio]:checked:before{vertical-align:middle;width:.5625rem;height:.5625rem;margin:.4375rem;line-height:.76190476}.wp-upload-form input[type=submit]{margin-top:10px}.wp-admin .form-table select,.wp-core-ui select{min-height:40px;font-size:16px;line-height:1.625;padding:5px 24px 5px 8px}.wp-admin .button-cancel{margin-bottom:0;padding:2px 0;font-size:14px;vertical-align:middle}#adduser .form-field input,#createuser .form-field input{width:100%}.form-table{box-sizing:border-box}.form-table td,.form-table th,.label-responsive{display:block;width:auto;vertical-align:middle}.label-responsive{margin:.5em 0}.export-filters li{margin-bottom:0}.form-table .color-palette td{display:table-cell;width:15px}.form-table table.color-palette{margin-right:10px}input,textarea{font-size:16px}#profile-page .form-table textarea,.form-table span.description,.form-table td input[type=email],.form-table td input[type=password],.form-table td input[type=text],.form-table td select,.form-table td textarea{width:100%;display:block;max-width:none;box-sizing:border-box}.form-table .form-required.form-invalid td:after{float:right;margin:-30px 3px 0 0}.form-table input[type=text].small-text,input[type=number].small-text,input[type=password].small-text,input[type=search].small-text,input[type=text].small-text{width:auto;max-width:4.375em;display:inline;padding:3px 6px;margin:0 3px}.form-table .regular-text~input[type=text].small-text{margin-top:5px}#pass-strength-result{width:100%;box-sizing:border-box;padding:8px}p.search-box{float:none;position:absolute;bottom:0;width:98%;height:90px;margin-bottom:20px}p.search-box input[name="s"]{float:none;width:100%;margin-bottom:10px;vertical-align:middle}p.search-box input[type=submit]{margin-bottom:10px}.form-table span.description{display:inline;padding:4px 0 0;line-height:1.4;font-size:14px}.form-table th{padding:10px 0 0;border-bottom:0}.form-table td{margin-bottom:0;padding:4px 0 6px}.form-table.permalink-structure td code{margin-left:32px;display:inline-block}.form-table.permalink-structure td input[type=text]{margin-left:32px;margin-top:4px;width:96%}.form-table input.regular-text{width:100%}.form-table label{font-size:14px}.background-position-control .button-group>label{font-size:0}.form-table fieldset label{display:block}#local-time,#utc-time{display:block;float:none;margin-top:.5em}.form-field #domain{max-width:none}.wp-pwd{position:relative}#profile-page .form-table #pass1{padding-right:90px}.wp-pwd button.button{background:0 0;border:1px solid transparent;box-shadow:none;line-height:2;margin:0;padding:5px 9px;position:absolute;right:0;top:0;width:2.375rem;height:2.375rem;min-width:40px;min-height:40px}.wp-pwd button.wp-hide-pw{right:2.5rem}.wp-pwd button.button:focus,.wp-pwd button.button:hover{background:0 0}.wp-pwd button.button:active{background:0 0;box-shadow:none;transform:none}.wp-pwd .button .text{display:none}.wp-pwd [type=password],.wp-pwd [type=text]{line-height:2;padding-right:5rem}.wp-cancel-pw .dashicons-no{display:inline-block}.options-general-php input[type=text].small-text{max-width:6.25em;margin:0}.tools-privacy-policy-page form.wp-create-privacy-page{margin-bottom:1em}.tools-privacy-policy-page input#set-page,.tools-privacy-policy-page select{margin:10px 0 0}.tools-privacy-policy-page .wp-create-privacy-page span{display:block;margin-bottom:1em}.tools-privacy-policy-page .wp-create-privacy-page .button{margin-left:0}.wp-list-table.privacy_requests tr:not(.inline-edit-row):not(.no-items) td.column-primary:not(.check-column){display:table-cell}.wp-list-table.privacy_requests.widefat th input,.wp-list-table.privacy_requests.widefat thead td input{margin-left:5px}.wp-privacy-request-form-field input[type=text]{width:100%;margin-bottom:10px;vertical-align:middle}.regular-text{max-width:100%}}@media only screen and (max-width:768px){.form-field input[type=email],.form-field input[type=password],.form-field input[type=text],.form-field select,.form-field textarea{width:99%}.form-wrap .form-field{padding:0}}@media only screen and (max-height:480px),screen and (max-width:450px){.file-editor-warning .notification-dialog,.request-filesystem-credentials-dialog .notification-dialog{width:100%;height:100%;max-height:100%;position:fixed;top:0;margin:0;left:0}}@media screen and (max-width:600px){.color-option{width:49%}}@media only screen and (max-width:320px){.options-general-php .date-time-text.date-time-custom-text{min-width:0;margin-right:.5em}}@keyframes rotation{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}/*! This file is auto-generated */ -#wpwrap{height:auto;min-height:100%;width:100%;position:relative;-webkit-font-smoothing:subpixel-antialiased}#wpcontent{height:100%;padding-right:20px}#wpcontent,#wpfooter{margin-right:160px}.folded #wpcontent,.folded #wpfooter{margin-right:36px}#wpbody-content{padding-bottom:65px;float:right;width:100%;overflow:visible}.inner-sidebar{float:left;clear:left;display:none;width:281px;position:relative}.columns-2 .inner-sidebar{margin-left:auto;width:286px;display:block}.columns-2 .inner-sidebar #side-sortables,.inner-sidebar #side-sortables{min-height:300px;width:280px;padding:0}.has-right-sidebar .inner-sidebar{display:block}.has-right-sidebar #post-body{float:right;clear:right;width:100%;margin-left:-2000px}.has-right-sidebar #post-body-content{margin-left:300px;float:none;width:auto}#col-left{float:right;width:35%}#col-right{float:left;width:65%}#col-left .col-wrap{padding:0 0 0 6px}#col-right .col-wrap{padding:0 6px 0 0}.alignleft{float:right}.alignright{float:left}.textleft{text-align:right}.textright{text-align:left}.clear{clear:both}.wp-clearfix:after{content:"";display:table;clear:both}.screen-reader-text,.screen-reader-text span,.ui-helper-hidden-accessible{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.button .screen-reader-text{height:auto}.screen-reader-shortcut{position:absolute;top:-1000em}.screen-reader-shortcut:focus{right:6px;top:-25px;height:auto;width:auto;display:block;font-size:14px;font-weight:600;padding:15px 23px 14px;background:#f0f0f1;color:#2271b1;z-index:100000;line-height:normal;box-shadow:0 0 2px 2px rgba(0,0,0,.6);text-decoration:none;outline:2px solid transparent;outline-offset:-2px}.hidden,.js .closed .inside,.js .hide-if-js,.js .wp-core-ui .hide-if-js,.js.wp-core-ui .hide-if-js,.no-js .hide-if-no-js,.no-js .wp-core-ui .hide-if-no-js,.no-js.wp-core-ui .hide-if-no-js{display:none}#menu-management .menu-edit,#menu-settings-column .accordion-container,.comment-ays,.feature-filter,.imgedit-group,.manage-menus,.menu-item-handle,.popular-tags,.stuffbox,.widget-inside,.widget-top,.widgets-holder-wrap,.wp-editor-container,p.popular-tags,table.widefat{border:1px solid #c3c4c7;box-shadow:0 1px 1px rgba(0,0,0,.04)}.comment-ays,.feature-filter,.imgedit-group,.popular-tags,.stuffbox,.widgets-holder-wrap,.wp-editor-container,p.popular-tags,table.widefat{background:#fff}body,html{height:100%;margin:0;padding:0}body{background:#f0f0f1;color:#3c434a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px;line-height:1.4em;min-width:600px}body.iframe{min-width:0;padding-top:1px}body.modal-open{overflow:hidden}body.mobile.modal-open #wpwrap{overflow:hidden;position:fixed;height:100%}iframe,img{border:0}td{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}a{color:#2271b1;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}a,div{outline:0}a:active,a:hover{color:#135e96}.wp-person a:focus .gravatar,a:focus,a:focus .media-icon img,a:focus .plugin-icon{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:1px solid transparent}#adminmenu a:focus{box-shadow:none;outline:1px solid transparent;outline-offset:-1px}.screen-reader-text:focus{box-shadow:none;outline:0}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}.wp-die-message,p{font-size:13px;line-height:1.5;margin:1em 0}blockquote{margin:1em}dd,li{margin-bottom:6px}h1,h2,h3,h4,h5,h6{display:block;font-weight:600}h1{color:#1d2327;font-size:2em;margin:.67em 0}h2,h3{color:#1d2327;font-size:1.3em;margin:1em 0}.update-core-php h2{margin-top:4em}.update-messages h2,.update-php h2,h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}ol,ul{padding:0}ul{list-style:none}ol{list-style-type:decimal;margin-right:2em}ul.ul-disc{list-style:disc outside}ul.ul-square{list-style:square outside}ol.ol-decimal{list-style:decimal outside}ol.ol-decimal,ul.ul-disc,ul.ul-square{margin-right:1.8em}ol.ol-decimal>li,ul.ul-disc>li,ul.ul-square>li{margin:0 0 .5em}.ltr{direction:ltr}.code,code{font-family:Consolas,Monaco,monospace;direction:ltr;unicode-bidi:embed}code,kbd{padding:3px 5px 2px;margin:0 1px;background:#f0f0f1;background:rgba(0,0,0,.07);font-size:13px}.subsubsub{list-style:none;margin:8px 0 0;padding:0;font-size:13px;float:right;color:#646970}.subsubsub a{line-height:2;padding:.2em;text-decoration:none}.subsubsub a .count,.subsubsub a.current .count{color:#50575e;font-weight:400}.subsubsub a.current{font-weight:600;border:none}.subsubsub li{display:inline-block;margin:0;padding:0;white-space:nowrap}.widefat{border-spacing:0;width:100%;clear:both;margin:0}.widefat *{word-wrap:break-word}.widefat a,.widefat button.button-link{text-decoration:none}.widefat td,.widefat th{padding:8px 10px}.widefat thead td,.widefat thead th{border-bottom:1px solid #c3c4c7}.widefat tfoot td,.widefat tfoot th{border-top:1px solid #c3c4c7;border-bottom:none}.widefat .no-items td{border-bottom-width:0}.widefat td{vertical-align:top}.widefat td,.widefat td ol,.widefat td p,.widefat td ul{font-size:13px;line-height:1.5em}.widefat tfoot td,.widefat th,.widefat thead td{text-align:right;line-height:1.3em;font-size:14px}.updates-table td input,.widefat tfoot td input,.widefat th input,.widefat thead td input{margin:0 8px 0 0;padding:0;vertical-align:text-top}.widefat .check-column{width:2.2em;padding:6px 0 25px;vertical-align:top}.widefat tbody th.check-column{padding:9px 0 22px}.updates-table tbody td.check-column,.widefat tbody th.check-column,.widefat tfoot td.check-column,.widefat thead td.check-column{padding:11px 3px 0 0}.widefat tfoot td.check-column,.widefat thead td.check-column{padding-top:4px;vertical-align:middle}.update-php div.error,.update-php div.updated{margin-right:0}.no-js .widefat tfoot .check-column input,.no-js .widefat thead .check-column input{display:none}.column-comments,.column-links,.column-posts,.widefat .num{text-align:center}.widefat th#comments{vertical-align:middle}.wrap{margin:10px 2px 0 20px}.wrap.block-editor-no-js{padding-right:20px}.postbox .inside h2,.wrap [class$=icon32]+h2,.wrap h1,.wrap>h2:first-child{font-size:23px;font-weight:400;margin:0;padding:9px 0 4px;line-height:1.3}.wrap h1.wp-heading-inline{display:inline-block;margin-left:5px}.wp-header-end{visibility:hidden;margin:-2px 0 0}.subtitle{margin:0;padding-right:25px;color:#50575e;font-size:14px;font-weight:400;line-height:1}.subtitle strong{word-break:break-all}.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{margin-right:4px;padding:4px 8px;position:relative;top:-3px;text-decoration:none;border:1px solid #2271b1;border-radius:2px;text-shadow:none;font-weight:600;font-size:13px;line-height:normal;color:#2271b1;background:#f6f7f7;cursor:pointer}.wrap .wp-heading-inline+.page-title-action{margin-right:0}.wrap .add-new-h2:hover,.wrap .page-title-action:hover{background:#f0f0f1;border-color:#0a4b78;color:#0a4b78}.page-title-action:focus{color:#0a4b78}.form-table th label[for=WPLANG] .dashicons,.form-table th label[for=locale] .dashicons{margin-right:5px}.wrap .page-title-action:focus{border-color:#3582c4;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent}.wrap h1.long-header{padding-left:0}.wp-dialog{background-color:#fff}#available-widgets .widget-top:hover,#widgets-left .widget-in-question .widget-top,#widgets-left .widget-top:hover,.widgets-chooser ul,div#widgets-right .widget-top:hover{border-color:#8c8f94;box-shadow:0 1px 2px rgba(0,0,0,.1)}.sorthelper{background-color:#c5d9ed}.ac_match,.subsubsub a.current{color:#000}.alternate,.striped>tbody>:nth-child(odd),ul.striped>:nth-child(odd){background-color:#f6f7f7}.bar{background-color:#f0f0f1;border-left-color:#4f94d4}.highlight{background-color:#f0f6fc;color:#3c434a}.wp-ui-primary{color:#fff;background-color:#2c3338}.wp-ui-text-primary{color:#2c3338}.wp-ui-highlight{color:#fff;background-color:#2271b1}.wp-ui-text-highlight{color:#2271b1}.wp-ui-notification{color:#fff;background-color:#d63638}.wp-ui-text-notification{color:#d63638}.wp-ui-text-icon{color:#8c8f94}img.emoji{display:inline!important;border:none!important;height:1em!important;width:1em!important;margin:0 .07em!important;vertical-align:-.1em!important;background:0 0!important;padding:0!important;box-shadow:none!important}#nav-menu-footer,#nav-menu-header,#your-profile #rich_editing,.checkbox,.control-section .accordion-section-title,.menu-item-handle,.postbox .hndle,.side-info,.sidebar-name,.stuffbox .hndle,.widefat tfoot td,.widefat tfoot th,.widefat thead td,.widefat thead th,.widget .widget-top{line-height:1.4em}.menu-item-handle,.widget .widget-top{background:#f6f7f7;color:#1d2327}.stuffbox .hndle{border-bottom:1px solid #c3c4c7}.quicktags{background-color:#c3c4c7;color:#000;font-size:12px}.icon32{display:none}#bulk-titles .ntdelbutton:before,.notice-dismiss:before,.tagchecklist .ntdelbutton .remove-tag-icon:before,.welcome-panel .welcome-panel-close:before{background:0 0;color:#787c82;content:"\f153";display:block;font:normal 16px/20px dashicons;speak:never;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.welcome-panel .welcome-panel-close:before{margin:0}.tagchecklist .ntdelbutton .remove-tag-icon:before{margin-right:2px;border-radius:50%;color:#2271b1;line-height:1.28}.tagchecklist .ntdelbutton:focus{outline:0}#bulk-titles .ntdelbutton:focus:before,#bulk-titles .ntdelbutton:hover:before,.tagchecklist .ntdelbutton:focus .remove-tag-icon:before,.tagchecklist .ntdelbutton:hover .remove-tag-icon:before{color:#d63638}.tagchecklist .ntdelbutton:focus .remove-tag-icon:before{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.key-labels label{line-height:24px}b,strong{font-weight:600}.pre{white-space:pre-wrap;word-wrap:break-word}.howto{color:#646970;display:block}p.install-help{margin:8px 0;font-style:italic}.no-break{white-space:nowrap}hr{border:0;border-top:1px solid #dcdcde;border-bottom:1px solid #f6f7f7}#all-plugins-table .plugins a.delete,#delete-link a.delete,#media-items a.delete,#media-items a.delete-permanently,#nav-menu-footer .menu-delete,#search-plugins-table .plugins a.delete,.plugins a.delete,.privacy_requests .remove-personal-data .remove-personal-data-handle,.row-actions span.delete a,.row-actions span.spam a,.row-actions span.trash a,.submitbox .submitdelete,a#remove-post-thumbnail{color:#b32d2e}#all-plugins-table .plugins a.delete:hover,#delete-link a.delete:hover,#media-items a.delete-permanently:hover,#media-items a.delete:hover,#nav-menu-footer .menu-delete:hover,#search-plugins-table .plugins a.delete:hover,.file-error,.plugins a.delete:hover,.privacy_requests .remove-personal-data .remove-personal-data-handle:hover,.row-actions .delete a:hover,.row-actions .spam a:hover,.row-actions .trash a:hover,.submitbox .submitdelete:hover,a#remove-post-thumbnail:hover,abbr.required,span.required{color:#b32d2e;border:none}#major-publishing-actions{padding:10px;clear:both;border-top:1px solid #dcdcde;background:#f6f7f7}#delete-action{float:right;line-height:2.30769231}#delete-link{line-height:2.30769231;vertical-align:middle;text-align:right;margin-right:8px}#delete-link a{text-decoration:none}#publishing-action{text-align:left;float:left;line-height:1.9}#publishing-action .spinner{float:none;margin-top:5px}#misc-publishing-actions{padding:6px 0 0}.misc-pub-section{padding:6px 10px 8px}.misc-pub-filename{word-wrap:break-word}#minor-publishing-actions{padding:10px 10px 0;text-align:left}#save-post{float:right}.preview{float:left}#sticky-span{margin-right:18px}.approve,.unapproved .unapprove{display:none}.spam .approve,.trash .approve,.unapproved .approve{display:inline}td.action-links,th.action-links{text-align:left}#misc-publishing-actions .notice{margin-right:10px;margin-left:10px}.wp-filter{display:inline-block;position:relative;box-sizing:border-box;margin:12px 0 25px;padding:0 10px;width:100%;box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #c3c4c7;background:#fff;color:#50575e;font-size:13px}.wp-filter a{text-decoration:none}.filter-count{display:inline-block;vertical-align:middle;min-width:4em}.filter-count .count,.title-count{display:inline-block;position:relative;top:-1px;padding:4px 10px;border-radius:30px;background:#646970;color:#fff;font-size:14px;font-weight:600}.title-count{display:inline;top:-3px;margin-right:5px;margin-left:20px}.filter-items{float:right}.filter-links{display:inline-block;margin:0}.filter-links li{display:inline-block;margin:0}.filter-links li>a{display:inline-block;margin:0 10px;padding:15px 0;border-bottom:4px solid #fff;color:#646970;cursor:pointer}.filter-links .current{box-shadow:none;border-bottom:4px solid #646970;color:#1d2327}.filter-links li>a:focus,.filter-links li>a:hover,.show-filters .filter-links a.current:focus,.show-filters .filter-links a.current:hover{color:#135e96}.wp-filter .search-form{float:left;margin:10px 0}.wp-filter .search-form input[type=search]{margin:1px 0;width:280px;max-width:100%}.wp-filter .search-form select{margin:0}.plugin-install-php .wp-filter{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center}.wp-filter .search-form.search-plugins{margin-top:0}.wp-filter .search-form.search-plugins .wp-filter-search,.wp-filter .search-form.search-plugins select{display:inline-block;margin-top:10px;vertical-align:top}.wp-filter .button.drawer-toggle{margin:10px 9px 0;padding:0 6px 0 10px;border-color:transparent;background-color:transparent;color:#646970;vertical-align:baseline;box-shadow:none}.wp-filter .drawer-toggle:before{content:"\f111";margin:0 0 0 5px;color:#646970;font:normal 16px/1 dashicons;vertical-align:text-bottom;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-filter .button.drawer-toggle:focus,.wp-filter .button.drawer-toggle:hover,.wp-filter .drawer-toggle:focus:before,.wp-filter .drawer-toggle:hover:before{background-color:transparent;color:#135e96}.wp-filter .button.drawer-toggle:focus:active,.wp-filter .button.drawer-toggle:hover{border-color:transparent}.wp-filter .button.drawer-toggle:focus{border-color:#4f94d4}.wp-filter .button.drawer-toggle:active{background:0 0;box-shadow:none;transform:none}.wp-filter .drawer-toggle.current:before{color:#fff}.filter-drawer,.wp-filter .favorites-form{display:none;margin:0 -20px 0 -10px;padding:20px;border-top:1px solid #f0f0f1;background:#f6f7f7;overflow:hidden}.show-favorites-form .favorites-form,.show-filters .filter-drawer{display:block}.show-filters .filter-links a.current{border-bottom:none}.show-filters .wp-filter .button.drawer-toggle{border-radius:2px;background:#646970;color:#fff}.show-filters .wp-filter .drawer-toggle:focus,.show-filters .wp-filter .drawer-toggle:hover{background:#2271b1}.show-filters .wp-filter .drawer-toggle:before{color:#fff}.filter-group{box-sizing:border-box;position:relative;float:right;margin:0 0 0 1%;padding:20px 10px 10px;width:24%;background:#fff;border:1px solid #dcdcde;box-shadow:0 1px 1px rgba(0,0,0,.04)}.filter-group legend{position:absolute;top:10px;display:block;margin:0;padding:0;font-size:1em;font-weight:600}.filter-drawer .filter-group-feature{margin:28px 0 0;list-style-type:none;font-size:12px}.filter-drawer .filter-group-feature input,.filter-drawer .filter-group-feature label{line-height:1.4}.filter-drawer .filter-group-feature input{position:absolute;margin:0}.filter-group .filter-group-feature label{display:block;margin:14px 23px 14px 0}.filter-drawer .buttons{clear:both;margin-bottom:20px}.filter-drawer .filter-group+.buttons{margin-bottom:0;padding-top:20px}.filter-drawer .buttons .button span{display:inline-block;opacity:.8;font-size:12px;text-indent:10px}.wp-filter .button.clear-filters{display:none;margin-right:10px}.wp-filter .button-link.edit-filters{padding:0 5px;line-height:2.2}.filtered-by{display:none;margin:0}.filtered-by>span{font-weight:600}.filtered-by a{margin-right:10px}.filtered-by .tags{display:inline}.filtered-by .tag{margin:0 5px;padding:4px 8px;border:1px solid #dcdcde;box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff;font-size:11px}.filters-applied .filter-drawer .buttons,.filters-applied .filter-drawer br,.filters-applied .filter-group{display:none}.filters-applied .filtered-by{display:block}.filters-applied .filter-drawer{padding:20px}.error .content-filterable,.loading-content .content-filterable,.show-filters .content-filterable,.show-filters .favorites-form,.show-filters.filters-applied.loading-content .content-filterable{display:none}.show-filters.filters-applied .content-filterable{display:block}.loading-content .spinner{display:block;margin:40px auto 0;float:none}@media only screen and (max-width:1120px){.filter-drawer{border-bottom:1px solid #f0f0f1}.filter-group{margin-bottom:0;margin-top:5px;width:100%}.filter-group li{margin:10px 0}}@media only screen and (max-width:1000px){.filter-items{float:none}.wp-filter .media-toolbar-primary,.wp-filter .media-toolbar-secondary,.wp-filter .search-form{float:none;position:relative;max-width:100%}}@media only screen and (max-width:782px){.filter-group li{padding:0;width:50%}}@media only screen and (max-width:320px){.filter-count{display:none}.wp-filter .drawer-toggle{margin:10px 0}.filter-group li,.wp-filter .search-form input[type=search]{width:100%}}.notice,div.error,div.updated{background:#fff;border:1px solid #c3c4c7;border-right-width:4px;box-shadow:0 1px 1px rgba(0,0,0,.04);margin:5px 15px 2px;padding:1px 12px}div[class=update-message]{padding:.5em 0 .5em 12px}.form-table td .notice p,.notice p,.notice-title,div.error p,div.updated p{margin:.5em 0;padding:2px}.error a{text-decoration:underline}.updated a{padding-bottom:2px}.notice-alt{box-shadow:none}.notice-large{padding:10px 20px}.notice-title{display:inline-block;color:#1d2327;font-size:18px}.wp-core-ui .notice.is-dismissible{padding-left:38px;position:relative}.notice-dismiss{position:absolute;top:0;left:1px;border:none;margin:0;padding:9px;background:0 0;color:#787c82;cursor:pointer}.notice-dismiss:active:before,.notice-dismiss:focus:before,.notice-dismiss:hover:before{color:#d63638}.notice-dismiss:focus{outline:0;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.notice-success,div.updated{border-right-color:#00a32a}.notice-success.notice-alt{background-color:#edfaef}.notice-warning{border-right-color:#dba617}.notice-warning.notice-alt{background-color:#fcf9e8}.notice-error,div.error{border-right-color:#d63638}.notice-error.notice-alt{background-color:#fcf0f1}.notice-info{border-right-color:#72aee6}.notice-info.notice-alt{background-color:#f0f6fc}.button.installed:before,.button.installing:before,.button.updated-message:before,.button.updating-message:before,.import-php .updating-message:before,.update-message p:before,.updated-message p:before,.updating-message p:before{display:inline-block;font:normal 20px/1 dashicons;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}.media-upload-form .notice,.media-upload-form div.error,.wrap .notice,.wrap div.error,.wrap div.updated{margin:5px 0 15px}.wrap #templateside .notice{display:block;margin:0;padding:5px 8px;font-weight:600;text-decoration:none}.wrap #templateside span.notice{margin-right:-12px}#templateside li.notice a{padding:0}.button.installing:before,.button.updating-message:before,.import-php .updating-message:before,.update-message p:before,.updating-message p:before{color:#d63638;content:"\f463"}.button.installing:before,.button.updating-message:before,.import-php .updating-message:before,.plugins .column-auto-updates .dashicons-update.spin,.theme-overlay .theme-autoupdate .dashicons-update.spin,.updating-message p:before{animation:rotation 2s infinite linear}@media (prefers-reduced-motion:reduce){.button.installing:before,.button.updating-message:before,.import-php .updating-message:before,.plugins .column-auto-updates .dashicons-update.spin,.theme-overlay .theme-autoupdate .dashicons-update.spin,.updating-message p:before{animation:none}}.theme-overlay .theme-autoupdate .dashicons-update.spin{margin-left:3px}.button.updated-message:before,.installed p:before,.updated-message p:before{color:#68de7c;content:"\f147"}.update-message.notice-error p:before{color:#d63638;content:"\f534"}.import-php .updating-message:before,.wrap .notice p:before{margin-left:6px;vertical-align:bottom}#update-nag,.update-nag{display:inline-block;line-height:1.4;padding:11px 15px;font-size:14px;margin:25px 2px 0 20px}ul#dismissed-updates{display:none}#dismissed-updates li>p{margin-top:0}#dismiss,#undismiss{margin-right:.5em}form.upgrade{margin-top:8px}form.upgrade .hint{font-style:italic;font-size:85%;margin:-.5em 0 2em}.update-php .spinner{float:none;margin:-4px 0}h2.wp-current-version{margin-bottom:.3em}p.update-last-checked{margin-top:0}p.auto-update-status{margin-top:2em;line-height:1.8}#ajax-loading,.ajax-feedback,.ajax-loading,.imgedit-wait-spin,.list-ajax-loading{visibility:hidden}#ajax-response.alignleft{margin-right:2em}.button.installed:before,.button.installing:before,.button.updated-message:before,.button.updating-message:before{margin:3px -2px 0 5px}.button-primary.updating-message:before{color:#fff}.button-primary.updated-message:before{color:#9ec2e6}.button.updated-message{transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}@media aural{.button.installed:before,.button.installing:before,.update-message p:before,.wrap .notice p:before{speak:never}}#adminmenu a,#catlist a,#taglist a{text-decoration:none}#contextual-help-wrap,#screen-options-wrap{margin:0;padding:8px 20px 12px;position:relative}#contextual-help-wrap{overflow:auto;margin-right:0}#screen-meta-links{float:left;margin:0 0 0 20px}#screen-meta{display:none;margin:0 0 -1px 20px;position:relative;background-color:#fff;border:1px solid #c3c4c7;border-top:none;box-shadow:0 0 0 transparent}#contextual-help-link-wrap,#screen-options-link-wrap{float:right;margin:0 6px 0 0}#screen-meta-links .screen-meta-toggle{position:relative;top:0}#screen-meta-links .show-settings{border:1px solid #c3c4c7;border-top:none;height:auto;margin-bottom:0;padding:3px 16px 3px 6px;background:#fff;border-radius:0 0 4px 4px;color:#646970;line-height:1.7;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear}#screen-meta-links .show-settings:active,#screen-meta-links .show-settings:focus,#screen-meta-links .show-settings:hover{color:#2c3338}#screen-meta-links .show-settings:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}#screen-meta-links .show-settings:active{transform:none}#screen-meta-links .show-settings:after{left:0;content:"\f140";font:normal 20px/1 dashicons;speak:never;display:inline-block;padding:0 0 0 5px;bottom:2px;position:relative;vertical-align:bottom;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none}#screen-meta-links .screen-meta-active:after{content:"\f142"}.toggle-arrow{background-repeat:no-repeat;background-position:top right;background-color:transparent;height:22px;line-height:22px;display:block}.toggle-arrow-active{background-position:bottom right}#contextual-help-wrap h5,#screen-options-wrap h5,#screen-options-wrap legend{margin:0;padding:8px 0;font-size:13px;font-weight:600}.metabox-prefs label{display:inline-block;padding-left:15px;line-height:2.35}#number-of-columns{display:inline-block;vertical-align:middle;line-height:30px}.metabox-prefs input[type=checkbox]{margin-top:0;margin-left:6px}.metabox-prefs label input,.metabox-prefs label input[type=checkbox]{margin:-4px 0 0 5px}.metabox-prefs .columns-prefs label input{margin:-1px 0 0 2px}.metabox-prefs label a{display:none}.metabox-prefs .screen-options input,.metabox-prefs .screen-options label{margin-top:0;margin-bottom:0;vertical-align:middle}.metabox-prefs .screen-options .screen-per-page{margin-left:15px;padding-left:0}.metabox-prefs .screen-options label{line-height:2.2;padding-left:0}.screen-options+.screen-options{margin-top:10px}.metabox-prefs .submit{margin-top:1em;padding:0}#contextual-help-wrap{padding:0}#contextual-help-columns{position:relative}#contextual-help-back{position:absolute;top:0;bottom:0;right:150px;left:170px;border:1px solid #c3c4c7;border-top:none;border-bottom:none;background:#f0f6fc}#contextual-help-wrap.no-sidebar #contextual-help-back{left:0;border-left-width:0;border-bottom-left-radius:2px}.contextual-help-tabs{float:right;width:150px;margin:0}.contextual-help-tabs ul{margin:1em 0}.contextual-help-tabs li{margin-bottom:0;list-style-type:none;border-style:solid;border-width:0 2px 0 0;border-color:transparent}.contextual-help-tabs a{display:block;padding:5px 12px 5px 5px;line-height:1.4;text-decoration:none;border:1px solid transparent;border-left:none;border-right:none}.contextual-help-tabs a:hover{color:#2c3338}.contextual-help-tabs .active{padding:0;margin:0 0 0 -1px;border-right:2px solid #72aee6;background:#f0f6fc;box-shadow:0 2px 0 rgba(0,0,0,.02),0 1px 0 rgba(0,0,0,.02)}.contextual-help-tabs .active a{border-color:#c3c4c7;color:#2c3338}.contextual-help-tabs-wrap{padding:0 20px;overflow:auto}.help-tab-content{display:none;margin:0 0 12px 22px;line-height:1.6}.help-tab-content.active{display:block}.help-tab-content ul li{list-style-type:disc;margin-right:18px}.contextual-help-sidebar{width:150px;float:left;padding:0 12px 0 8px;overflow:auto}html.wp-toolbar{padding-top:32px;box-sizing:border-box;-ms-overflow-style:scrollbar}.widefat td,.widefat th{color:#50575e}.widefat tfoot td,.widefat th,.widefat thead td{font-weight:400}.widefat tfoot tr td,.widefat tfoot tr th,.widefat thead tr td,.widefat thead tr th{color:#2c3338}.widefat td p{margin:2px 0 .8em}.widefat ol,.widefat p,.widefat ul{color:#2c3338}.widefat .column-comment p{margin:.6em 0}.widefat .column-comment ul{list-style:initial;margin-right:2em}.postbox-container{float:right}.postbox-container .meta-box-sortables{box-sizing:border-box}#wpbody-content .metabox-holder{padding-top:10px}.metabox-holder .postbox-container .meta-box-sortables{min-height:1px;position:relative}#post-body-content{width:100%;min-width:463px;float:right}#post-body.columns-2 #postbox-container-1{float:left;margin-left:-300px;width:280px}#post-body.columns-2 #side-sortables{min-height:250px}@media only screen and (max-width:799px){#wpbody-content .metabox-holder .postbox-container .empty-container{outline:0;height:0;min-height:0}}.js .postbox .hndle,.js .widget .widget-top{cursor:move}.js .postbox .hndle.is-non-sortable,.js .widget .widget-top.is-non-sortable{cursor:auto}.hndle a{font-size:12px;font-weight:400}.postbox-header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #c3c4c7}.postbox-header .hndle{flex-grow:1;display:flex;justify-content:space-between;align-items:center}.postbox-header .handle-actions{flex-shrink:0}.postbox .handle-order-higher,.postbox .handle-order-lower,.postbox .handlediv{width:36px;height:36px;margin:0;padding:0;border:0;background:0 0;cursor:pointer}.postbox .handle-order-higher,.postbox .handle-order-lower{color:#787c82;width:1.62rem}.edit-post-meta-boxes-area .postbox .handle-order-higher,.edit-post-meta-boxes-area .postbox .handle-order-lower{width:44px;height:44px;color:#1d2327}.postbox .handle-order-higher[aria-disabled=true],.postbox .handle-order-lower[aria-disabled=true]{cursor:default;color:#a7aaad}.sortable-placeholder{border:1px dashed #c3c4c7;margin-bottom:20px}.postbox,.stuffbox{margin-bottom:20px;padding:0;line-height:1}.postbox.closed{border-bottom:0}.postbox .hndle,.stuffbox .hndle{-webkit-user-select:none;user-select:none}.postbox .inside{padding:0 12px 12px;line-height:1.4;font-size:13px}.stuffbox .inside{padding:0;line-height:1.4;font-size:13px;margin-top:0}.postbox .inside{margin:11px 0;position:relative}.postbox .inside>p:last-child,.rss-widget ul li:last-child{margin-bottom:1px!important}.postbox.closed h3{border:none;box-shadow:none}.postbox table.form-table{margin-bottom:0}.postbox table.widefat{box-shadow:none}.temp-border{border:1px dotted #c3c4c7}.columns-prefs label{padding:0 0 0 10px}#adminmenu .wp-submenu li.current,#adminmenu .wp-submenu li.current a,#adminmenu .wp-submenu li.current a:hover,#comment-status-display,#dashboard_right_now .versions .b,#ed_reply_toolbar #ed_reply_strong,#pass-strength-result.short,#pass-strength-result.strong,#post-status-display,#post-visibility-display,.feature-filter .feature-name,.item-controls .item-order a,.media-item .percent,.plugins .name{font-weight:600}#wpfooter{position:absolute;bottom:0;right:0;left:0;padding:10px 20px;color:#50575e}#wpfooter p{font-size:13px;margin:0;line-height:1.55}#footer-thankyou{font-style:italic}.nav-tab{float:right;border:1px solid #c3c4c7;border-bottom:none;margin-right:.5em;padding:5px 10px;font-size:14px;line-height:1.71428571;font-weight:600;background:#dcdcde;color:#50575e;text-decoration:none;white-space:nowrap}.nav-tab-small .nav-tab,h3 .nav-tab{padding:5px 14px;font-size:12px;line-height:1.33}.nav-tab:focus,.nav-tab:hover{background-color:#fff;color:#3c434a}.nav-tab-active,.nav-tab:focus:active{box-shadow:none}.nav-tab-active{margin-bottom:-1px;color:#3c434a}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{border-bottom:1px solid #f0f0f1;background:#f0f0f1;color:#000}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper,h1.nav-tab-wrapper{border-bottom:1px solid #c3c4c7;margin:0;padding-top:9px;padding-bottom:0;line-height:inherit}.nav-tab-wrapper:not(.wp-clearfix):after{content:"";display:table;clear:both}.spinner{background:url(../images/spinner.gif) no-repeat;background-size:20px 20px;display:inline-block;visibility:hidden;float:left;vertical-align:middle;opacity:.7;width:20px;height:20px;margin:4px 10px 0}.loading-content .spinner,.spinner.is-active{visibility:visible}#template>div{margin-left:16em}#template .notice{margin-top:1em;margin-left:3%}#template .notice p{width:auto}#template .submit .spinner{float:none}.metabox-holder .postbox>h3,.metabox-holder .stuffbox>h3,.metabox-holder h2.hndle,.metabox-holder h3.hndle{font-size:14px;padding:8px 12px;margin:0;line-height:1.4}.nav-menus-php .metabox-holder h3{padding:10px 14px 11px 10px;line-height:1.5}#templateside ul li a{text-decoration:none}.plugin-install #description,.plugin-install-network #description{width:60%}table .column-rating,table .column-visible,table .vers{text-align:right}.attention,.error-message{color:#d63638;font-weight:600}body.iframe{height:98%}.lp-show-latest p{display:none}.lp-show-latest .lp-error p,.lp-show-latest p:last-child{display:block}.media-icon{width:62px;text-align:center}.media-icon img{border:1px solid #dcdcde;border:1px solid rgba(0,0,0,.07)}#howto{font-size:11px;margin:0 5px;display:block}.importers{font-size:16px;width:auto}.importers td{padding-left:14px;line-height:1.4}.importers .import-system{max-width:250px}.importers td.desc{max-width:500px}.importer-action,.importer-desc,.importer-title{display:block}.importer-title{color:#000;font-size:14px;font-weight:400;margin-bottom:.2em}.importer-action{line-height:1.55;color:#50575e;margin-bottom:1em}#post-body #post-body-content #namediv h2,#post-body #post-body-content #namediv h3{margin-top:0}.edit-comment-author{color:#1d2327;border-bottom:1px solid #f0f0f1}#namediv h2 label,#namediv h3 label{vertical-align:baseline}#namediv table{width:100%}#namediv td.first{width:10px;white-space:nowrap}#namediv input{width:100%}#namediv p{margin:10px 0}.zerosize{height:0;width:0;margin:0;border:0;padding:0;overflow:hidden;position:absolute}br.clear{height:2px;line-height:.15}.checkbox{border:none;margin:0;padding:0}fieldset{border:0;padding:0;margin:0}.post-categories{display:inline;margin:0;padding:0}.post-categories li{display:inline}div.star-holder{position:relative;height:17px;width:100px;background:url(../images/stars.png?ver=20121108) repeat-x bottom right}div.star-holder .star-rating{background:url(../images/stars.png?ver=20121108) repeat-x top right;height:17px;float:right}.star-rating{white-space:nowrap}.star-rating .star{display:inline-block;width:20px;height:20px;-webkit-font-smoothing:antialiased;font-size:20px;line-height:1;font-family:dashicons;text-decoration:inherit;font-weight:400;font-style:normal;vertical-align:top;transition:color .1s ease-in;text-align:center;color:#dba617}.star-rating .star-full:before{content:"\f155"}.star-rating .star-half:before{content:"\f459"}.rtl .star-rating .star-half{transform:rotateY(-180deg)}.star-rating .star-empty:before{content:"\f154"}div.action-links{font-weight:400;margin:6px 0 0}#plugin-information{background:#fff;position:fixed;top:0;left:0;bottom:0;right:0;height:100%;padding:0}#plugin-information-scrollable{overflow:auto;-webkit-overflow-scrolling:touch;height:100%}#plugin-information-title{padding:0 26px;background:#f6f7f7;font-size:22px;font-weight:600;line-height:2.4;position:relative;height:56px}#plugin-information-title.with-banner{margin-left:0;height:250px;background-size:cover}#plugin-information-title h2{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h2{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:30px;line-height:1.68;box-sizing:border-box;max-width:100%;padding:0 15px;margin-top:174px;color:#fff;background:rgba(29,35,39,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}#plugin-information-title div.vignette{display:none}#plugin-information-title.with-banner div.vignette{position:absolute;display:block;top:0;right:0;height:250px;width:100%;background:0 0;box-shadow:inset 0 0 50px 4px rgba(0,0,0,.2),inset 0 -1px 0 rgba(0,0,0,.1)}#plugin-information-tabs{padding:0 16px;position:relative;left:0;right:0;min-height:36px;font-size:0;z-index:1;border-bottom:1px solid #dcdcde;background:#f6f7f7}#plugin-information-tabs a{position:relative;display:inline-block;padding:9px 10px;margin:0;height:18px;line-height:1.3;font-size:14px;text-decoration:none;transition:none}#plugin-information-tabs a.current{margin:0 -1px -1px;background:#fff;border:1px solid #dcdcde;border-bottom-color:#fff;padding-top:8px;color:#2c3338}#plugin-information-tabs.with-banner a.current{border-top:none;padding-top:9px}#plugin-information-tabs a:active,#plugin-information-tabs a:focus{outline:0}#plugin-information-content{overflow:hidden;background:#fff;position:relative;top:0;left:0;right:0;min-height:100%;min-height:calc(100% - 152px)}#plugin-information-content.with-banner{min-height:calc(100% - 346px)}#section-holder{position:relative;top:0;left:250px;bottom:0;right:0;margin-top:10px;margin-left:250px;padding:10px 26px 99999px;margin-bottom:-99932px}#section-holder .notice{margin:5px 0 15px}#section-holder .updated{margin:16px 0}#plugin-information .fyi{float:left;position:relative;top:0;left:0;padding:16px 16px 99999px;margin-bottom:-99932px;width:217px;border-right:1px solid #dcdcde;background:#f6f7f7;color:#646970}#plugin-information .fyi strong{color:#3c434a}#plugin-information .fyi h3{font-weight:600;text-transform:uppercase;font-size:12px;color:#646970;margin:24px 0 8px}#plugin-information .fyi h2{font-size:.9em;margin-bottom:0;margin-left:0}#plugin-information .fyi ul{padding:0;margin:0;list-style:none}#plugin-information .fyi li{margin:0 0 10px}#plugin-information .fyi-description{margin-top:0}#plugin-information .counter-container{margin:3px 0}#plugin-information .counter-label{float:right;margin-left:5px;min-width:55px}#plugin-information .counter-back{height:17px;width:92px;background-color:#dcdcde;float:right}#plugin-information .counter-bar{height:17px;background-color:#f0c33c;float:right}#plugin-information .counter-count{margin-right:5px}#plugin-information .fyi ul.contributors{margin-top:10px}#plugin-information .fyi ul.contributors li{display:inline-block;margin-left:8px;vertical-align:middle}#plugin-information .fyi ul.contributors li{display:inline-block;margin-left:8px;vertical-align:middle}#plugin-information .fyi ul.contributors li img{vertical-align:middle;margin-left:4px}#plugin-information-footer{padding:13px 16px;position:absolute;left:0;bottom:0;right:0;height:40px;border-top:1px solid #dcdcde;background:#f6f7f7}#plugin-information .section{direction:ltr}#plugin-information .section ol,#plugin-information .section ul{list-style-type:disc;margin-left:24px}#plugin-information .section,#plugin-information .section p{font-size:14px;line-height:1.7}#plugin-information #section-screenshots ol{list-style:none;margin:0}#plugin-information #section-screenshots li img{vertical-align:text-top;margin-top:16px;max-width:100%;width:auto;height:auto;box-shadow:0 1px 2px rgba(0,0,0,.3)}#plugin-information #section-screenshots li p{font-style:italic;padding-left:20px}#plugin-information pre{padding:7px;overflow:auto;border:1px solid #c3c4c7}#plugin-information blockquote{border-right:2px solid #dcdcde;color:#646970;font-style:italic;margin:1em 0;padding:0 1em 0 0}#plugin-information .review{overflow:hidden;width:100%;margin-bottom:20px;border-bottom:1px solid #dcdcde}#plugin-information .review-title-section{overflow:hidden}#plugin-information .review-title-section h4{display:inline-block;float:left;margin:0 6px 0 0}#plugin-information .reviewer-info p{clear:both;margin:0;padding-top:2px}#plugin-information .reviewer-info .avatar{float:left;margin:4px 6px 0 0}#plugin-information .reviewer-info .star-rating{float:left}#plugin-information .review-meta{float:left;margin-left:.75em}#plugin-information .review-body{float:left;width:100%}.plugin-version-author-uri{font-size:13px}.update-php .button.button-primary{margin-left:1em}@media screen and (max-width:771px){#plugin-information-title.with-banner{height:100px}#plugin-information-title.with-banner h2{margin-top:30px;font-size:20px;line-height:2;max-width:85%}#plugin-information-title.with-banner div.vignette{height:100px}#plugin-information-tabs{overflow:hidden;padding:0;height:auto}#plugin-information-tabs a.current{margin-bottom:0;border-bottom:none}#plugin-information .fyi{float:none;border:1px solid #dcdcde;position:static;width:auto;margin:26px 26px 0;padding-bottom:0}#section-holder{position:static;margin:0;padding-bottom:70px}#plugin-information .fyi h3,#plugin-information .fyi small{display:none}#plugin-information-footer{padding:12px 16px 0;height:46px}}#TB_window.plugin-details-modal{background:#fff}#TB_window.plugin-details-modal.thickbox-loading:before{content:"";display:block;width:20px;height:20px;position:absolute;right:50%;top:50%;z-index:-1;margin:-10px -10px 0 0;background:#fff url(../images/spinner.gif) no-repeat center;background-size:20px 20px;transform:translateZ(0)}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){#TB_window.plugin-details-modal.thickbox-loading:before{background-image:url(../images/spinner-2x.gif)}}.plugin-details-modal #TB_title{float:right;height:1px}.plugin-details-modal #TB_ajaxWindowTitle{display:none}.plugin-details-modal #TB_closeWindowButton{right:auto;left:-30px;color:#f0f0f1}.plugin-details-modal #TB_closeWindowButton:focus,.plugin-details-modal #TB_closeWindowButton:hover{color:#135e96;outline:0;box-shadow:none}.plugin-details-modal .tb-close-icon{display:none}.plugin-details-modal #TB_closeWindowButton:after{content:"\f335";font:normal 32px/29px dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (max-width:830px){.plugin-details-modal #TB_closeWindowButton{left:0;top:-30px}}img{border:none}.bulk-action-notice .toggle-indicator::before,.meta-box-sortables .postbox .order-higher-indicator::before,.meta-box-sortables .postbox .order-lower-indicator::before,.meta-box-sortables .postbox .toggle-indicator::before,.privacy-text-box .toggle-indicator::before,.sidebar-name .toggle-indicator::before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none}.bulk-action-notice .bulk-action-errors-collapsed .toggle-indicator::before,.js .widgets-holder-wrap.closed .toggle-indicator::before,.meta-box-sortables .postbox.closed .handlediv .toggle-indicator::before,.privacy-text-box.closed .toggle-indicator::before{content:"\f140"}.postbox .handle-order-higher .order-higher-indicator::before{content:"\f343";color:inherit}.postbox .handle-order-lower .order-lower-indicator::before{content:"\f347";color:inherit}.postbox .handle-order-higher .order-higher-indicator::before,.postbox .handle-order-lower .order-lower-indicator::before{position:relative;top:.11rem;width:20px;height:20px}.postbox .handlediv .toggle-indicator::before{width:20px;border-radius:50%}.postbox .handlediv .toggle-indicator::before{position:relative;top:.05rem;text-indent:-1px}.rtl .postbox .handlediv .toggle-indicator::before{text-indent:1px}.bulk-action-notice .toggle-indicator::before{line-height:16px;vertical-align:top;color:#787c82}.postbox .handle-order-higher:focus,.postbox .handle-order-lower:focus,.postbox .handlediv:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:1px solid transparent}.postbox .handle-order-higher:focus .order-higher-indicator::before,.postbox .handle-order-lower:focus .order-lower-indicator::before,.postbox .handlediv:focus .toggle-indicator::before{box-shadow:none;outline:1px solid transparent}#photo-add-url-div input[type=text]{width:300px}.alignleft h2{margin:0}#template textarea{font-family:Consolas,Monaco,monospace;font-size:13px;background:#f6f7f7;-o-tab-size:4;tab-size:4}#template .CodeMirror,#template textarea{width:100%;min-height:60vh;height:calc(100vh - 295px);border:1px solid #dcdcde;box-sizing:border-box}#templateside>h2{padding-top:6px;padding-bottom:7px;margin:0}#templateside ol,#templateside ul{margin:0;padding:0}#templateside>ul{box-sizing:border-box;margin-top:0;overflow:auto;padding:0;min-height:60vh;height:calc(100vh - 295px);background-color:#f6f7f7;border:1px solid #dcdcde;border-right:none}#templateside ul ul{padding-right:12px}#templateside>ul>li>ul[role=group]{padding-right:0}[role=treeitem][aria-expanded=false]>ul{display:none}[role=treeitem] span[aria-hidden]{display:inline;font-family:dashicons;font-size:20px;position:absolute;pointer-events:none}[role=treeitem][aria-expanded=false]>.folder-label .icon:after{content:"\f141"}[role=treeitem][aria-expanded=true]>.folder-label .icon:after{content:"\f140"}[role=treeitem] .folder-label{display:block;padding:3px 12px 3px 3px;cursor:pointer}[role=treeitem]{outline:0}[role=treeitem] .folder-label.focus{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}[role=treeitem] .folder-label.hover,[role=treeitem].hover{background-color:#f0f0f1}.tree-folder{margin:0;position:relative}[role=treeitem] li{position:relative}.tree-folder .tree-folder::after{content:"";display:block;position:absolute;right:2px;border-right:1px solid #c3c4c7;top:-13px;bottom:10px}.tree-folder>li::before{content:"";position:absolute;display:block;border-right:1px solid #c3c4c7;right:2px;top:-5px;height:18px;width:7px;border-bottom:1px solid #c3c4c7}.tree-folder>li::after{content:"";position:absolute;display:block;border-right:1px solid #c3c4c7;right:2px;bottom:-7px;top:0}#templateside .current-file{margin:-4px 0 -2px}.tree-folder>.current-file::before{right:4px;height:15px;width:0;border-right:none;top:3px}.tree-folder>.current-file::after{bottom:-4px;height:7px;right:2px;top:auto}.tree-folder li:last-child>.tree-folder::after,.tree-folder>li:last-child::after{display:none}#documentation label,#theme-plugin-editor-label,#theme-plugin-editor-selector{font-weight:600}#theme-plugin-editor-label{display:inline-block;margin-bottom:1em}#docs-list,#template textarea{direction:ltr}.fileedit-sub #plugin,.fileedit-sub #theme{max-width:40%}.fileedit-sub .alignright{text-align:left}#template p{width:97%}#file-editor-linting-error{margin-top:1em;margin-bottom:1em}#file-editor-linting-error>.notice{margin:0;display:inline-block}#file-editor-linting-error>.notice>p{width:auto}#template .submit{margin-top:1em;padding:0}#template .submit input[type=submit][disabled]{cursor:not-allowed}#templateside{float:left;width:16em;word-wrap:break-word}#postcustomstuff p.submit{margin:0}#templateside h4{margin:1em 0 0}#templateside li{margin:4px 0}#templateside li:not(.howto) a,.theme-editor-php .highlight{display:block;padding:3px 12px 3px 0;text-decoration:none}#templateside li:not(.howto)>a:first-of-type{padding-top:0}#templateside li.howto{padding:6px 12px 12px}.theme-editor-php .highlight{margin:-3px -12px -3px 3px}#templateside .highlight{border:none;font-weight:600}.nonessential{color:#646970;font-size:11px;font-style:italic;padding-right:12px}#documentation{margin-top:10px}#documentation label{line-height:1.8;vertical-align:baseline}.fileedit-sub{padding:10px 0 8px;line-height:180%}#file-editor-warning .file-editor-warning-content{margin:25px}.accordion-section-title:after,.control-section .accordion-section-title:after,.nav-menus-php .item-edit:before,.widget-top .widget-action .toggle-indicator:before{content:"\f140";font:normal 20px/1 dashicons;speak:never;display:block;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none}.widget-top .widget-action .toggle-indicator:before{padding:1px 0 1px 2px;border-radius:50%}.accordion-section-title:after,.handlediv,.item-edit,.postbox .handlediv.button-link,.toggle-indicator{color:#787c82}.widget-action{color:#50575e}.accordion-section-title:hover:after,.handlediv:focus,.handlediv:hover,.item-edit:focus,.item-edit:hover,.postbox .handlediv.button-link:focus,.postbox .handlediv.button-link:hover,.sidebar-name:hover .toggle-indicator,.widget-action:focus,.widget-top:hover .widget-action{color:#1d2327;outline:1px solid transparent}.widget-top .widget-action:focus .toggle-indicator:before{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.accordion-section-title:after,.control-section .accordion-section-title:after{float:left;left:20px;top:-2px}#customize-info.open .accordion-section-title:after,.control-section.open .accordion-section-title:after,.nav-menus-php .menu-item-edit-active .item-edit:before,.widget.open .widget-top .widget-action .toggle-indicator:before,.widget.widget-in-question .widget-top .widget-action .toggle-indicator:before{content:"\f142"}/*! - * jQuery UI Draggable/Sortable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */.ui-draggable-handle,.ui-sortable-handle{touch-action:none}.accordion-section{border-bottom:1px solid #dcdcde;margin:0}.accordion-section.open .accordion-section-content,.no-js .accordion-section .accordion-section-content{display:block}.accordion-section.open:hover{border-bottom-color:#dcdcde}.accordion-section-content{display:none;padding:10px 20px 15px;overflow:hidden;background:#fff}.accordion-section-title{margin:0;padding:12px 15px 15px;position:relative;border-right:1px solid #dcdcde;border-left:1px solid #dcdcde;-webkit-user-select:none;user-select:none}.js .accordion-section-title{cursor:pointer}.js .accordion-section-title:after{position:absolute;top:12px;left:10px;z-index:1}.accordion-section-title:focus{outline:1px solid transparent}.accordion-section-title:focus:after,.accordion-section-title:hover:after{border-color:#a7aaad transparent;outline:1px solid transparent}.cannot-expand .accordion-section-title{cursor:auto}.cannot-expand .accordion-section-title:after{display:none}.control-section .accordion-section-title,.customize-pane-child .accordion-section-title{border-right:none;border-left:none;padding:10px 14px 11px 10px;line-height:1.55;background:#fff}.control-section .accordion-section-title:after,.customize-pane-child .accordion-section-title:after{top:calc(50% - 10px)}.js .control-section .accordion-section-title:focus,.js .control-section .accordion-section-title:hover,.js .control-section.open .accordion-section-title,.js .control-section:hover .accordion-section-title{color:#1d2327;background:#f6f7f7}.control-section.open .accordion-section-title{border-bottom:1px solid #dcdcde}.network-admin .edit-site-actions{margin-top:0}.my-sites{display:block;overflow:auto;zoom:1}.my-sites li{display:block;padding:8px 3%;min-height:130px;margin:0}@media only screen and (max-width:599px){.my-sites li{min-height:0}}@media only screen and (min-width:600px){.my-sites.striped li{background-color:#fff;position:relative}.my-sites.striped li:after{content:"";width:1px;height:100%;position:absolute;top:0;left:0;background:#c3c4c7}}@media only screen and (min-width:600px) and (max-width:699px){.my-sites li{float:right;width:44%}.my-sites.striped li{background-color:#fff}.my-sites.striped li:nth-of-type(2n+1){clear:right}.my-sites.striped li:nth-of-type(2n+2):after{content:none}.my-sites li:nth-of-type(4n+1),.my-sites li:nth-of-type(4n+2){background-color:#f6f7f7}}@media only screen and (min-width:700px) and (max-width:1199px){.my-sites li{float:right;width:27.333333%;background-color:#fff}.my-sites.striped li:nth-of-type(3n+3):after{content:none}.my-sites li:nth-of-type(6n+1),.my-sites li:nth-of-type(6n+2),.my-sites li:nth-of-type(6n+3){background-color:#f6f7f7}}@media only screen and (min-width:1200px) and (max-width:1399px){.my-sites li{float:right;width:21%;padding:8px 2%;background-color:#fff}.my-sites.striped li:nth-of-type(4n+1){clear:right}.my-sites.striped li:nth-of-type(4n+4):after{content:none}.my-sites li:nth-of-type(8n+1),.my-sites li:nth-of-type(8n+2),.my-sites li:nth-of-type(8n+3),.my-sites li:nth-of-type(8n+4){background-color:#f6f7f7}}@media only screen and (min-width:1400px) and (max-width:1599px){.my-sites li{float:right;width:16%;padding:8px 2%;background-color:#fff}.my-sites.striped li:nth-of-type(5n+1){clear:right}.my-sites.striped li:nth-of-type(5n+5):after{content:none}.my-sites li:nth-of-type(10n+1),.my-sites li:nth-of-type(10n+2),.my-sites li:nth-of-type(10n+3),.my-sites li:nth-of-type(10n+4),.my-sites li:nth-of-type(10n+5){background-color:#f6f7f7}}@media only screen and (min-width:1600px){.my-sites li{float:right;width:12.666666%;padding:8px 2%;background-color:#fff}.my-sites.striped li:nth-of-type(6n+1){clear:right}.my-sites.striped li:nth-of-type(6n+6):after{content:none}.my-sites li:nth-of-type(12n+1),.my-sites li:nth-of-type(12n+2),.my-sites li:nth-of-type(12n+3),.my-sites li:nth-of-type(12n+4),.my-sites li:nth-of-type(12n+5),.my-sites li:nth-of-type(12n+6){background-color:#f6f7f7}}.my-sites li a{text-decoration:none}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){div.star-holder,div.star-holder .star-rating{background:url(../images/stars-2x.png?ver=20121108) repeat-x bottom right;background-size:21px 37px}.spinner{background-image:url(../images/spinner-2x.gif)}}@media screen and (max-width:782px){html.wp-toolbar{padding-top:46px}.screen-reader-shortcut:focus{top:-39px}body{min-width:240px;overflow-x:hidden}body *{-webkit-tap-highlight-color:transparent!important}#wpcontent{position:relative;margin-right:0;padding-right:10px}#wpbody-content{padding-bottom:100px}.wrap{clear:both;margin-left:12px;margin-right:0}#col-left,#col-right{float:none;width:auto}#col-left .col-wrap,#col-right .col-wrap{padding:0}#collapse-menu,.post-format-select{display:none!important}.wrap h1.wp-heading-inline{margin-bottom:.5em}.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{padding:10px 15px;font-size:14px;white-space:nowrap}.media-upload-form div.error,.notice,.wrap div.error,.wrap div.updated{margin:20px 0 10px;padding:5px 10px;font-size:14px;line-height:175%}.wp-core-ui .notice.is-dismissible{padding-left:46px}.notice-dismiss{padding:13px}.wrap .icon32+h2{margin-top:-2px}.wp-responsive-open #wpbody{left:-16em}code{word-wrap:break-word;word-wrap:anywhere;word-break:break-word}.postbox{font-size:14px}.metabox-holder .postbox>h3,.metabox-holder .stuffbox>h3,.metabox-holder h2,.metabox-holder h3.hndle{padding:12px}.postbox .handlediv{margin-top:3px}.subsubsub{font-size:16px;text-align:center;margin-bottom:15px}#template .CodeMirror,#template textarea{box-sizing:border-box}#templateside{float:none;width:auto}#templateside>ul{border-right:1px solid #dcdcde}#templateside li{margin:0}#templateside li:not(.howto) a{display:block;padding:5px}#templateside li.howto{padding:12px}#templateside .highlight{padding:5px;margin-right:-5px;margin-top:-5px}#template .notice,#template>div{float:none;margin:1em 0;width:auto}#template .CodeMirror,#template textarea{width:100%}#templateside ul ul{padding-right:1.5em}[role=treeitem] .folder-label{display:block;padding:5px}.tree-folder .tree-folder::after,.tree-folder>li::after,.tree-folder>li::before{right:-8px}.tree-folder>li::before{top:0;height:13px}.tree-folder>.current-file::before{right:-5px;top:7px;width:4px}.tree-folder>.current-file::after{height:9px;right:-8px}.wrap #templateside span.notice{margin-right:-5px;width:100%}.fileedit-sub .alignright{float:right;margin-top:15px;width:100%;text-align:right}.fileedit-sub .alignright label{display:block}.fileedit-sub #plugin,.fileedit-sub #theme{margin-right:0;max-width:70%}.fileedit-sub input[type=submit]{margin-bottom:0}#documentation label[for=docs-list]{display:block}#documentation select[name=docs-list]{margin-right:0;max-width:60%}#documentation input[type=button]{margin-bottom:0}#wpfooter{display:none}#comments-form .checkforspam{display:none}.edit-comment-author{margin:2px 0 0}.filter-drawer .filter-group-feature input,.filter-drawer .filter-group-feature label{line-height:2.1}.filter-drawer .filter-group-feature label{margin-right:32px}.wp-filter .button.drawer-toggle{font-size:13px;line-height:2;height:28px}#screen-meta #contextual-help-wrap{overflow:visible}#screen-meta #contextual-help-back,#screen-meta .contextual-help-sidebar{display:none}#screen-meta .contextual-help-tabs{clear:both;width:100%;float:none}#screen-meta .contextual-help-tabs ul{margin:0 0 1em;padding:1em 0 0}#screen-meta .contextual-help-tabs .active{margin:0}#screen-meta .contextual-help-tabs-wrap{clear:both;max-width:100%;float:none}#screen-meta,#screen-meta-links{margin-left:10px}#screen-meta-links{margin-bottom:20px}.wp-filter .search-form input[type=search]{font-size:1rem}.wp-filter .search-form.search-plugins{min-width:100%}}@media screen and (max-width:600px){#wpwrap.wp-responsive-open{overflow-x:hidden}html.wp-toolbar{padding-top:0}.screen-reader-shortcut:focus{top:7px}#wpbody{padding-top:46px}div#post-body.metabox-holder.columns-1{overflow-x:hidden}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper,h1.nav-tab-wrapper{border-bottom:0}h1 .nav-tab,h2 .nav-tab,h3 .nav-tab,nav .nav-tab{margin:10px 0 0 10px;border-bottom:1px solid #c3c4c7}.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{border-bottom:1px solid #c3c4c7}.wp-filter .search-form input[type=search]{width:100%}}@media screen and (max-width:320px){#network_dashboard_right_now .subsubsub{font-size:14px;text-align:right}}/* nav-menu */ +
      +
      + +
      + stream( $mime_type ) ) ) { return false; } return true; } else { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); $image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' ); switch ( $mime_type ) { case 'image/jpeg': header( 'Content-Type: image/jpeg' ); return imagejpeg( $image, null, 90 ); case 'image/png': header( 'Content-Type: image/png' ); return imagepng( $image ); case 'image/gif': header( 'Content-Type: image/gif' ); return imagegif( $image ); case 'image/webp': if ( function_exists( 'imagewebp' ) ) { header( 'Content-Type: image/webp' ); return imagewebp( $image, null, 90 ); } return false; default: return false; } } } function wp_save_image_file( $filename, $image, $mime_type, $post_id ) { if ( $image instanceof WP_Image_Editor ) { $image = apply_filters( 'image_editor_save_pre', $image, $post_id ); $saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id ); if ( null !== $saved ) { return $saved; } return $image->save( $filename, $mime_type ); } else { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); $image = apply_filters_deprecated( 'image_save_pre', array( $image, $post_id ), '3.5.0', 'image_editor_save_pre' ); $saved = apply_filters_deprecated( 'wp_save_image_file', array( null, $filename, $image, $mime_type, $post_id ), '3.5.0', 'wp_save_image_editor_file' ); if ( null !== $saved ) { return $saved; } switch ( $mime_type ) { case 'image/jpeg': return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) ); case 'image/png': return imagepng( $image, $filename ); case 'image/gif': return imagegif( $image, $filename ); case 'image/webp': if ( function_exists( 'imagewebp' ) ) { return imagewebp( $image, $filename ); } return false; default: return false; } } } function _image_get_preview_ratio( $w, $h ) { $max = max( $w, $h ); return $max > 400 ? ( 400 / $max ) : 1; } function _rotate_image_resource( $img, $angle ) { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' ); if ( function_exists( 'imagerotate' ) ) { $rotated = imagerotate( $img, $angle, 0 ); if ( is_gd_image( $rotated ) ) { imagedestroy( $img ); $img = $rotated; } } return $img; } function _flip_image_resource( $img, $horz, $vert ) { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' ); $w = imagesx( $img ); $h = imagesy( $img ); $dst = wp_imagecreatetruecolor( $w, $h ); if ( is_gd_image( $dst ) ) { $sx = $vert ? ( $w - 1 ) : 0; $sy = $horz ? ( $h - 1 ) : 0; $sw = $vert ? -$w : $w; $sh = $horz ? -$h : $h; if ( imagecopyresampled( $dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh ) ) { imagedestroy( $img ); $img = $dst; } } return $img; } function _crop_image_resource( $img, $x, $y, $w, $h ) { $dst = wp_imagecreatetruecolor( $w, $h ); if ( is_gd_image( $dst ) ) { if ( imagecopy( $dst, $img, 0, 0, $x, $y, $w, $h ) ) { imagedestroy( $img ); $img = $dst; } } return $img; } function image_edit_apply_changes( $image, $changes ) { if ( is_gd_image( $image ) ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); } if ( ! is_array( $changes ) ) { return $image; } foreach ( $changes as $key => $obj ) { if ( isset( $obj->r ) ) { $obj->type = 'rotate'; $obj->angle = $obj->r; unset( $obj->r ); } elseif ( isset( $obj->f ) ) { $obj->type = 'flip'; $obj->axis = $obj->f; unset( $obj->f ); } elseif ( isset( $obj->c ) ) { $obj->type = 'crop'; $obj->sel = $obj->c; unset( $obj->c ); } $changes[ $key ] = $obj; } if ( count( $changes ) > 1 ) { $filtered = array( $changes[0] ); for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) { $combined = false; if ( $filtered[ $i ]->type == $changes[ $j ]->type ) { switch ( $filtered[ $i ]->type ) { case 'rotate': $filtered[ $i ]->angle += $changes[ $j ]->angle; $combined = true; break; case 'flip': $filtered[ $i ]->axis ^= $changes[ $j ]->axis; $combined = true; break; } } if ( ! $combined ) { $filtered[ ++$i ] = $changes[ $j ]; } } $changes = $filtered; unset( $filtered ); } if ( $image instanceof WP_Image_Editor ) { $image = apply_filters( 'wp_image_editor_before_change', $image, $changes ); } elseif ( is_gd_image( $image ) ) { $image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' ); } foreach ( $changes as $operation ) { switch ( $operation->type ) { case 'rotate': if ( 0 != $operation->angle ) { if ( $image instanceof WP_Image_Editor ) { $image->rotate( $operation->angle ); } else { $image = _rotate_image_resource( $image, $operation->angle ); } } break; case 'flip': if ( 0 != $operation->axis ) { if ( $image instanceof WP_Image_Editor ) { $image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } else { $image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } } break; case 'crop': $sel = $operation->sel; if ( $image instanceof WP_Image_Editor ) { $size = $image->get_size(); $w = $size['width']; $h = $size['height']; $scale = 1 / _image_get_preview_ratio( $w, $h ); $image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } else { $scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); $image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } break; } } return $image; } function stream_preview_image( $post_id ) { $post = get_post( $post_id ); wp_raise_memory_limit( 'admin' ); $img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) ); if ( is_wp_error( $img ) ) { return false; } $changes = ! empty( $_REQUEST['history'] ) ? json_decode( wp_unslash( $_REQUEST['history'] ) ) : null; if ( $changes ) { $img = image_edit_apply_changes( $img, $changes ); } $size = $img->get_size(); $w = $size['width']; $h = $size['height']; $ratio = _image_get_preview_ratio( $w, $h ); $w2 = max( 1, $w * $ratio ); $h2 = max( 1, $h * $ratio ); if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) { return false; } return wp_stream_image( $img, $post->post_mime_type, $post_id ); } function wp_restore_image( $post_id ) { $meta = wp_get_attachment_metadata( $post_id ); $file = get_attached_file( $post_id ); $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $old_backup_sizes = $backup_sizes; $restored = false; $msg = new stdClass; if ( ! is_array( $backup_sizes ) ) { $msg->error = __( 'Cannot load image metadata.' ); return $msg; } $parts = pathinfo( $file ); $suffix = time() . rand( 100, 999 ); $default_sizes = get_intermediate_image_sizes(); if ( isset( $backup_sizes['full-orig'] ) && is_array( $backup_sizes['full-orig'] ) ) { $data = $backup_sizes['full-orig']; if ( $parts['basename'] != $data['file'] ) { if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) { if ( preg_match( '/-e[0-9]{13}\./', $parts['basename'] ) ) { wp_delete_file( $file ); } } elseif ( isset( $meta['width'], $meta['height'] ) ) { $backup_sizes[ "full-$suffix" ] = array( 'width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename'], ); } } $restored_file = path_join( $parts['dirname'], $data['file'] ); $restored = update_attached_file( $post_id, $restored_file ); $meta['file'] = _wp_relative_upload_path( $restored_file ); $meta['width'] = $data['width']; $meta['height'] = $data['height']; } foreach ( $default_sizes as $default_size ) { if ( isset( $backup_sizes[ "$default_size-orig" ] ) ) { $data = $backup_sizes[ "$default_size-orig" ]; if ( isset( $meta['sizes'][ $default_size ] ) && $meta['sizes'][ $default_size ]['file'] != $data['file'] ) { if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) { if ( preg_match( '/-e[0-9]{13}-/', $meta['sizes'][ $default_size ]['file'] ) ) { $delete_file = path_join( $parts['dirname'], $meta['sizes'][ $default_size ]['file'] ); wp_delete_file( $delete_file ); } } else { $backup_sizes[ "$default_size-{$suffix}" ] = $meta['sizes'][ $default_size ]; } } $meta['sizes'][ $default_size ] = $data; } else { unset( $meta['sizes'][ $default_size ] ); } } if ( ! wp_update_attachment_metadata( $post_id, $meta ) || ( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) { $msg->error = __( 'Cannot save image metadata.' ); return $msg; } if ( ! $restored ) { $msg->error = __( 'Image metadata is inconsistent.' ); } else { $msg->msg = __( 'Image restored successfully.' ); } return $msg; } function wp_save_image( $post_id ) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $return = new stdClass; $success = false; $delete = false; $scaled = false; $nocrop = false; $post = get_post( $post_id ); $img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) ); if ( is_wp_error( $img ) ) { $return->error = esc_js( __( 'Unable to create new image.' ) ); return $return; } $fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0; $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0; $target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : ''; $scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do']; if ( $scale && $fwidth > 0 && $fheight > 0 ) { $size = $img->get_size(); $sX = $size['width']; $sY = $size['height']; $diff = round( $sX / $sY, 2 ) - round( $fwidth / $fheight, 2 ); if ( -0.1 < $diff && $diff < 0.1 ) { if ( $img->resize( $fwidth, $fheight ) ) { $scaled = true; } } if ( ! $scaled ) { $return->error = esc_js( __( 'Error while saving the scaled image. Please reload the page and try again.' ) ); return $return; } } elseif ( ! empty( $_REQUEST['history'] ) ) { $changes = json_decode( wp_unslash( $_REQUEST['history'] ) ); if ( $changes ) { $img = image_edit_apply_changes( $img, $changes ); } } else { $return->error = esc_js( __( 'Nothing to save, the image has not changed.' ) ); return $return; } $meta = wp_get_attachment_metadata( $post_id ); $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); if ( ! is_array( $meta ) ) { $return->error = esc_js( __( 'Image data does not exist. Please re-upload the image.' ) ); return $return; } if ( ! is_array( $backup_sizes ) ) { $backup_sizes = array(); } $path = get_attached_file( $post_id ); $basename = pathinfo( $path, PATHINFO_BASENAME ); $dirname = pathinfo( $path, PATHINFO_DIRNAME ); $ext = pathinfo( $path, PATHINFO_EXTENSION ); $filename = pathinfo( $path, PATHINFO_FILENAME ); $suffix = time() . rand( 100, 999 ); if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && isset( $backup_sizes['full-orig'] ) && $backup_sizes['full-orig']['file'] != $basename ) { if ( 'thumbnail' === $target ) { $new_path = "{$dirname}/{$filename}-temp.{$ext}"; } else { $new_path = $path; } } else { while ( true ) { $filename = preg_replace( '/-e([0-9]+)$/', '', $filename ); $filename .= "-e{$suffix}"; $new_filename = "{$filename}.{$ext}"; $new_path = "{$dirname}/$new_filename"; if ( file_exists( $new_path ) ) { $suffix++; } else { break; } } } if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) { $return->error = esc_js( __( 'Unable to save the image.' ) ); return $return; } if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) { $tag = false; if ( isset( $backup_sizes['full-orig'] ) ) { if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] !== $basename ) { $tag = "full-$suffix"; } } else { $tag = 'full-orig'; } if ( $tag ) { $backup_sizes[ $tag ] = array( 'width' => $meta['width'], 'height' => $meta['height'], 'file' => $basename, ); } $success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path ); $meta['file'] = _wp_relative_upload_path( $new_path ); $size = $img->get_size(); $meta['width'] = $size['width']; $meta['height'] = $size['height']; if ( $success ) { $sizes = get_intermediate_image_sizes(); if ( 'nothumb' === $target || 'all' === $target ) { if ( 'nothumb' === $target ) { $sizes = array_diff( $sizes, array( 'thumbnail' ) ); } } elseif ( 'thumbnail' !== $target ) { $sizes = array_diff( $sizes, array( $target ) ); } } $return->fw = $meta['width']; $return->fh = $meta['height']; } elseif ( 'thumbnail' === $target ) { $sizes = array( 'thumbnail' ); $success = true; $delete = true; $nocrop = true; } else { $sizes = array( $target ); $success = true; $delete = true; $nocrop = $_wp_additional_image_sizes[ $size ]['crop']; } if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && ! empty( $meta['sizes'] ) ) { foreach ( $meta['sizes'] as $size ) { if ( ! empty( $size['file'] ) && preg_match( '/-e[0-9]{13}-/', $size['file'] ) ) { $delete_file = path_join( $dirname, $size['file'] ); wp_delete_file( $delete_file ); } } } if ( isset( $sizes ) ) { $_sizes = array(); foreach ( $sizes as $size ) { $tag = false; if ( isset( $meta['sizes'][ $size ] ) ) { if ( isset( $backup_sizes[ "$size-orig" ] ) ) { if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes[ "$size-orig" ]['file'] != $meta['sizes'][ $size ]['file'] ) { $tag = "$size-$suffix"; } } else { $tag = "$size-orig"; } if ( $tag ) { $backup_sizes[ $tag ] = $meta['sizes'][ $size ]; } } if ( isset( $_wp_additional_image_sizes[ $size ] ) ) { $width = (int) $_wp_additional_image_sizes[ $size ]['width']; $height = (int) $_wp_additional_image_sizes[ $size ]['height']; $crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop']; } else { $height = get_option( "{$size}_size_h" ); $width = get_option( "{$size}_size_w" ); $crop = ( $nocrop ) ? false : get_option( "{$size}_crop" ); } $_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop, ); } $meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) ); } unset( $img ); if ( $success ) { wp_update_attachment_metadata( $post_id, $meta ); update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ); if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) { if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' === $_REQUEST['context'] ) { $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true ); $return->thumbnail = $thumb_url[0]; } else { $file_url = wp_get_attachment_url( $post_id ); if ( ! empty( $meta['sizes']['thumbnail'] ) ) { $thumb = $meta['sizes']['thumbnail']; $return->thumbnail = path_join( dirname( $file_url ), $thumb['file'] ); } else { $return->thumbnail = "$file_url?w=128&h=128"; } } } } else { $delete = true; } if ( $delete ) { wp_delete_file( $new_path ); } $return->msg = esc_js( __( 'Image saved' ) ); return $return; } 'category', 'descendants_and_self' => $descendants_and_self, 'selected_cats' => $selected_cats, 'popular_cats' => $popular_cats, 'walker' => $walker, 'checked_ontop' => $checked_ontop, ) ); } function wp_terms_checklist( $post_id = 0, $args = array() ) { $defaults = array( 'descendants_and_self' => 0, 'selected_cats' => false, 'popular_cats' => false, 'walker' => null, 'taxonomy' => 'category', 'checked_ontop' => true, 'echo' => true, ); $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); $parsed_args = wp_parse_args( $params, $defaults ); if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) { $walker = new Walker_Category_Checklist; } else { $walker = $parsed_args['walker']; } $taxonomy = $parsed_args['taxonomy']; $descendants_and_self = (int) $parsed_args['descendants_and_self']; $args = array( 'taxonomy' => $taxonomy ); $tax = get_taxonomy( $taxonomy ); $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); $args['list_only'] = ! empty( $parsed_args['list_only'] ); if ( is_array( $parsed_args['selected_cats'] ) ) { $args['selected_cats'] = array_map( 'intval', $parsed_args['selected_cats'] ); } elseif ( $post_id ) { $args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) ); } else { $args['selected_cats'] = array(); } if ( is_array( $parsed_args['popular_cats'] ) ) { $args['popular_cats'] = array_map( 'intval', $parsed_args['popular_cats'] ); } else { $args['popular_cats'] = get_terms( array( 'taxonomy' => $taxonomy, 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false, ) ); } if ( $descendants_and_self ) { $categories = (array) get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0, ) ); $self = get_term( $descendants_and_self, $taxonomy ); array_unshift( $categories, $self ); } else { $categories = (array) get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', ) ); } $output = ''; if ( $parsed_args['checked_ontop'] ) { $checked_categories = array(); $keys = array_keys( $categories ); foreach ( $keys as $k ) { if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) { $checked_categories[] = $categories[ $k ]; unset( $categories[ $k ] ); } } $output .= $walker->walk( $checked_categories, 0, $args ); } $output .= $walker->walk( $categories, 0, $args ); if ( $parsed_args['echo'] ) { echo $output; } return $output; } function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { $post = get_post(); if ( $post && $post->ID ) { $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); } else { $checked_terms = array(); } $terms = get_terms( array( 'taxonomy' => $taxonomy, 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false, ) ); $tax = get_taxonomy( $taxonomy ); $popular_ids = array(); foreach ( (array) $terms as $term ) { $popular_ids[] = $term->term_id; if ( ! $display ) { continue; } $id = "popular-$taxonomy-$term->term_id"; $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; ?> -/* @todo: determine if this is truly for nav menus only */ -.no-js #message { - display: block; -} + -ul.add-menu-item-tabs li { - padding: 3px 5px 4px 8px; -} + 'link_category', 'orderby' => 'name', 'hide_empty' => 0, ) ); if ( empty( $categories ) ) { return; } foreach ( $categories as $category ) { $cat_id = $category->term_id; $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) ); $checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : ''; echo ''; } } function get_inline_data( $post ) { $post_type_object = get_post_type_object( $post->post_type ); if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } $title = esc_textarea( trim( $post->post_title ) ); echo ' +'; } function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) { global $wp_list_table; $content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode, ) ); if ( ! empty( $content ) ) { echo $content; return; } if ( ! $wp_list_table ) { if ( 'single' === $mode ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); } } ?> +
      + +
      + + + +
      + + + + + + + ' . _x( 'Name', 'meta name' ) . ' + ' . __( 'Value' ) . ' + + + + + +'; return; } $count = 0; ?> + + + + + + + + + + +
      + "; $r .= "\n\t\t"; $r .= "\n\t\t
      "; $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) ); $r .= "\n\t\t"; $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) ); $r .= '
      '; $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); $r .= ''; $r .= "\n\t\t\n\t"; return $r; } function meta_form( $post = null ) { global $wpdb; $post = get_post( $post ); $keys = apply_filters( 'postmeta_form_keys', null, $post ); if ( null === $keys ) { $limit = apply_filters( 'postmeta_form_limit', 30 ); $keys = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT meta_key + FROM $wpdb->postmeta + WHERE meta_key NOT BETWEEN '_' AND '_z' + HAVING meta_key NOT LIKE %s + ORDER BY meta_key + LIMIT %d", $wpdb->esc_like( '_' ) . '%', $limit ) ); } if ( $keys ) { natcasesort( $keys ); $meta_key_input_id = 'metakeyselect'; } else { $meta_key_input_id = 'metakeyinput'; } ?> +

      + + + + + + + -#wpbody-content #menu-settings-column { - display: inline; - width: 281px; - margin-left: -300px; - clear: both; - float: left; - padding-top: 0; -} + + + + + -#menu-settings-column .inside { - clear: both; - margin: 10px 0 0; -} + + +
      + + + + + + + + + +
      +
      + 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta', ) ); ?> +
      + +
      + post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' === $post->post_date_gmt ) ); } $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) { $tab_index_attribute = " tabindex=\"$tab_index\""; } $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date; $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' ); $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' ); $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : current_time( 'Y' ); $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : current_time( 'H' ); $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : current_time( 'i' ); $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : current_time( 's' ); $cur_jj = current_time( 'd' ); $cur_mm = current_time( 'm' ); $cur_aa = current_time( 'Y' ); $cur_hh = current_time( 'H' ); $cur_mn = current_time( 'i' ); $month = ''; $day = ''; $year = ''; $hour = ''; $minute = ''; echo '
      '; printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute ); echo '
      '; if ( $multi ) { return; } echo "\n\n"; $map = array( 'mm' => array( $mm, $cur_mm ), 'jj' => array( $jj, $cur_jj ), 'aa' => array( $aa, $cur_aa ), 'hh' => array( $hh, $cur_hh ), 'mn' => array( $mn, $cur_mn ), ); foreach ( $map as $timeunit => $value ) { list( $unit, $curr ) = $value; echo '' . "\n"; $cur_timeunit = 'cur_' . $timeunit; echo '' . "\n"; } ?> -.metabox-holder-disabled .postbox, -.metabox-holder-disabled .accordion-section-content, -.metabox-holder-disabled .accordion-section-title { - opacity: 0.5; - filter: alpha(opacity=50); -} +

      + + +

      + " . esc_html( $template ) . ''; } } function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { global $wpdb; $post = get_post( $post ); $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); if ( $items ) { foreach ( $items as $item ) { if ( $post && $post->ID && (int) $item->ID === $post->ID ) { continue; } $pad = str_repeat( ' ', $level * 3 ); $selected = selected( $default_page, $item->ID, false ); echo "\n\t'; parent_dropdown( $default_page, $item->ID, $level + 1 ); } } else { return false; } } function wp_dropdown_roles( $selected = '' ) { $r = ''; $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role( $details['name'] ); if ( $selected === $role ) { $r .= "\n\t"; } else { $r .= "\n\t"; } } echo $r; } function wp_import_upload_form( $action ) { $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = size_format( $bytes ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?> +

      +

      + +
      +

      + %s (%s)', __( 'Choose a file from your computer:' ), sprintf( __( 'Maximum size: %s' ), $size ) ); ?> + + + +

      + +
      + id ) ) { return; } $page = $screen->id; if ( ! isset( $wp_meta_boxes ) ) { $wp_meta_boxes = array(); } if ( ! isset( $wp_meta_boxes[ $page ] ) ) { $wp_meta_boxes[ $page ] = array(); } if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { $wp_meta_boxes[ $page ][ $context ] = array(); } foreach ( array_keys( $wp_meta_boxes[ $page ] ) as $a_context ) { foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) { if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) { continue; } if ( ( 'core' === $priority || 'sorted' === $priority ) && false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) { return; } if ( 'core' === $priority ) { if ( 'default' === $a_priority ) { $wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ]; unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] ); } return; } if ( empty( $priority ) ) { $priority = $a_priority; } elseif ( 'sorted' === $priority ) { $title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title']; $callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback']; $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args']; } if ( $priority !== $a_priority || $context !== $a_context ) { unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ); } } } if ( empty( $priority ) ) { $priority = 'low'; } if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { $wp_meta_boxes[ $page ][ $context ][ $priority ] = array(); } $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = array( 'id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args, ); } function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '

      '; if ( $plugin ) { printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "{$plugin['Name']}" ); } else { _e( 'This meta box is not compatible with the block editor.' ); } echo '

      '; if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ); echo '

      '; printf( __( 'Please install the Classic Editor plugin to use this meta box.' ), esc_url( $install_url ) ); echo '

      '; } } elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' ); echo '

      '; printf( __( 'Please activate the Classic Editor plugin to use this meta box.' ), esc_url( $activate_url ) ); echo '

      '; } } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), get_edit_post_link( $data_object ) ); echo '

      '; printf( __( 'Please open the classic editor to use this meta box.' ), esc_url( $edit_url ) ); echo '

      '; } } function _get_plugin_from_callback( $callback ) { try { if ( is_array( $callback ) ) { $reflection = new ReflectionMethod( $callback[0], $callback[1] ); } elseif ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) { $reflection = new ReflectionMethod( $callback ); } else { $reflection = new ReflectionFunction( $callback ); } } catch ( ReflectionException $exception ) { return null; } if ( ! $reflection->isInternal() ) { $filename = wp_normalize_path( $reflection->getFileName() ); $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); if ( strpos( $filename, $plugin_dir ) === 0 ) { $filename = str_replace( $plugin_dir, '', $filename ); $filename = preg_replace( '|^/([^/]*/).*$|', '\\1', $filename ); $plugins = get_plugins(); foreach ( $plugins as $name => $plugin ) { if ( strpos( $name, $filename ) === 0 ) { return $plugin; } } } } return null; } function do_meta_boxes( $screen, $context, $data_object ) { global $wp_meta_boxes; static $already_sorted = false; if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $page = $screen->id; $hidden = get_hidden_meta_boxes( $screen ); printf( '
      ', esc_attr( $context ) ); $sorted = get_user_option( "meta-box-order_$page" ); if ( ! $already_sorted && $sorted ) { foreach ( $sorted as $box_context => $ids ) { foreach ( explode( ',', $ids ) as $id ) { if ( $id && 'dashboard_browser_nag' !== $id ) { add_meta_box( $id, null, null, $screen, $box_context, 'sorted' ); } } } } $already_sorted = true; $i = 0; if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { if ( false === $box || ! $box['title'] ) { continue; } $block_compatible = true; if ( is_array( $box['args'] ) ) { if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { continue; } if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) { $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box']; unset( $box['args']['__block_editor_compatible_meta_box'] ); } if ( ! $block_compatible && $screen->is_block_editor() ) { $box['old_callback'] = $box['callback']; $box['callback'] = 'do_block_editor_incompatible_meta_box'; } if ( isset( $box['args']['__back_compat_meta_box'] ) ) { $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box']; unset( $box['args']['__back_compat_meta_box'] ); } } $i++; $hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : ''; echo '
      ' . "\n"; echo '
      '; echo '

      '; if ( 'dashboard_php_nag' === $box['id'] ) { echo ''; echo '' . __( 'Warning:' ) . ' '; } echo $box['title']; echo "

      \n"; if ( 'dashboard_browser_nag' !== $box['id'] ) { $widget_title = $box['title']; if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { $widget_title = $box['args']['__widget_basename']; unset( $box['args']['__widget_basename'] ); } echo '
      '; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
      '; } echo '
      '; echo '
      ' . "\n"; if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { $plugin = _get_plugin_from_callback( $box['callback'] ); if ( $plugin ) { ?> +
      +

      + {$plugin['Name']}" ); ?> +

      +
      + \n"; echo "
      \n"; } } } } echo '
      '; return $i; } function remove_meta_box( $id, $screen, $context ) { global $wp_meta_boxes; if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } elseif ( is_array( $screen ) ) { foreach ( $screen as $single_screen ) { remove_meta_box( $id, $single_screen, $context ); } } if ( ! isset( $screen->id ) ) { return; } $page = $screen->id; if ( ! isset( $wp_meta_boxes ) ) { $wp_meta_boxes = array(); } if ( ! isset( $wp_meta_boxes[ $page ] ) ) { $wp_meta_boxes[ $page ] = array(); } if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { $wp_meta_boxes[ $page ][ $context ] = array(); } foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false; } } function do_accordion_sections( $screen, $context, $data_object ) { global $wp_meta_boxes; wp_enqueue_script( 'accordion' ); if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $page = $screen->id; $hidden = get_hidden_meta_boxes( $screen ); ?> +
      +
        + +
      • +

        + + +

        +
        +
        + +
        +
        +
      • + +
      +
      + $id, 'title' => $title, 'callback' => $callback, ); } function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) { global $wp_settings_fields; if ( 'misc' === $page ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $page = 'general'; } if ( 'privacy' === $page ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $page = 'reading'; } $wp_settings_fields[ $page ][ $section ][ $id ] = array( 'id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args, ); } function do_settings_sections( $page ) { global $wp_settings_sections, $wp_settings_fields; if ( ! isset( $wp_settings_sections[ $page ] ) ) { return; } foreach ( (array) $wp_settings_sections[ $page ] as $section ) { if ( $section['title'] ) { echo "

      {$section['title']}

      \n"; } if ( $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } echo ''; do_settings_fields( $page, $section['id'] ); echo ''; } } function do_settings_fields( $page, $section ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $class = ''; if ( ! empty( $field['args']['class'] ) ) { $class = ' class="' . esc_attr( $field['args']['class'] ) . '"'; } echo ""; if ( ! empty( $field['args']['label_for'] ) ) { echo ''; } else { echo '' . $field['title'] . ''; } echo ''; call_user_func( $field['callback'], $field['args'] ); echo ''; echo ''; } } function add_settings_error( $setting, $code, $message, $type = 'error' ) { global $wp_settings_errors; $wp_settings_errors[] = array( 'setting' => $setting, 'code' => $code, 'message' => $message, 'type' => $type, ); } function get_settings_errors( $setting = '', $sanitize = false ) { global $wp_settings_errors; if ( $sanitize ) { sanitize_option( $setting, get_option( $setting ) ); } if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) { $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) ); delete_transient( 'settings_errors' ); } if ( empty( $wp_settings_errors ) ) { return array(); } if ( $setting ) { $setting_errors = array(); foreach ( (array) $wp_settings_errors as $key => $details ) { if ( $setting === $details['setting'] ) { $setting_errors[] = $wp_settings_errors[ $key ]; } } return $setting_errors; } return $wp_settings_errors; } function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) { return; } $settings_errors = get_settings_errors( $setting, $sanitize ); if ( empty( $settings_errors ) ) { return; } $output = ''; foreach ( $settings_errors as $key => $details ) { if ( 'updated' === $details['type'] ) { $details['type'] = 'success'; } if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ), true ) ) { $details['type'] = 'notice-' . $details['type']; } $css_id = sprintf( 'setting-error-%s', esc_attr( $details['code'] ) ); $css_class = sprintf( 'notice %s settings-error is-dismissible', esc_attr( $details['type'] ) ); $output .= "
      \n"; $output .= "

      {$details['message']}

      "; $output .= "
      \n"; } echo $output; } function find_posts_div( $found_action = '' ) { ?> + + post_password ) ) { echo esc_attr( $post->post_password ); } } function _draft_or_post_title( $post = 0 ) { $title = get_the_title( $post ); if ( empty( $title ) ) { $title = __( '(no title)' ); } return esc_html( $title ); } function _admin_search_query() { echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; } function iframe_header( $title = '', $deprecated = false ) { show_admin_bar( false ); global $hook_suffix, $admin_body_class, $wp_locale; $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); $current_screen = get_current_screen(); header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); _wp_admin_html_begin(); ?> +<?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?> + + + + + +class="wp-admin wp-core-ui no-js iframe "> + + + + + + + $state$sep"; } } if ( $display ) { echo $post_states_string; } return $post_states_string; } function get_post_states( $post ) { $post_states = array(); if ( isset( $_REQUEST['post_status'] ) ) { $post_status = $_REQUEST['post_status']; } else { $post_status = ''; } if ( ! empty( $post->post_password ) ) { $post_states['protected'] = _x( 'Password protected', 'post status' ); } if ( 'private' === $post->post_status && 'private' !== $post_status ) { $post_states['private'] = _x( 'Private', 'post status' ); } if ( 'draft' === $post->post_status ) { if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { $post_states[] = __( 'Customization Draft' ); } elseif ( 'draft' !== $post_status ) { $post_states['draft'] = _x( 'Draft', 'post status' ); } } elseif ( 'trash' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { $post_states[] = _x( 'Customization Draft', 'post status' ); } if ( 'pending' === $post->post_status && 'pending' !== $post_status ) { $post_states['pending'] = _x( 'Pending', 'post status' ); } if ( is_sticky( $post->ID ) ) { $post_states['sticky'] = _x( 'Sticky', 'post status' ); } if ( 'future' === $post->post_status ) { $post_states['scheduled'] = _x( 'Scheduled', 'post status' ); } if ( 'page' === get_option( 'show_on_front' ) ) { if ( (int) get_option( 'page_on_front' ) === $post->ID ) { $post_states['page_on_front'] = _x( 'Front Page', 'page label' ); } if ( (int) get_option( 'page_for_posts' ) === $post->ID ) { $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' ); } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' ); } return apply_filters( 'display_post_states', $post_states, $post ); } function _media_states( $post, $display = true ) { $media_states = get_media_states( $post ); $media_states_string = ''; if ( ! empty( $media_states ) ) { $state_count = count( $media_states ); $i = 0; $media_states_string .= ' — '; foreach ( $media_states as $state ) { ++$i; $sep = ( $i < $state_count ) ? ', ' : ''; $media_states_string .= "$state$sep"; } } if ( $display ) { echo $media_states_string; } return $media_states_string; } function get_media_states( $post ) { static $header_images; $media_states = array(); $stylesheet = get_option( 'stylesheet' ); if ( current_theme_supports( 'custom-header' ) ) { $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true ); if ( is_random_header_image() ) { if ( ! isset( $header_images ) ) { $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' ); } if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) { $media_states[] = __( 'Header Image' ); } } else { $header_image = get_header_image(); if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) { $media_states[] = __( 'Header Image' ); } if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) { $media_states[] = __( 'Current Header Image' ); } } if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) { $mods = get_theme_mods(); if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) { $media_states[] = __( 'Current Header Video' ); } } } if ( current_theme_supports( 'custom-background' ) ) { $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true ); if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) { $media_states[] = __( 'Background Image' ); $background_image = get_background_image(); if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) { $media_states[] = __( 'Current Background Image' ); } } } if ( (int) get_option( 'site_icon' ) === $post->ID ) { $media_states[] = __( 'Site Icon' ); } if ( (int) get_theme_mod( 'custom_logo' ) === $post->ID ) { $media_states[] = __( 'Logo' ); } return apply_filters( 'display_media_states', $media_states, $post ); } function compression_test() { ?> + + $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; } } elseif ( ! empty( $other_attributes ) ) { $attributes = $other_attributes; } $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $button = ''; if ( $wrap ) { $button = '

      ' . $button . '

      '; } return $button; } function _wp_admin_html_begin() { global $is_IE; $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : ''; if ( $is_IE ) { header( 'X-UA-Compatible: IE=edge' ); } ?> + + +> + + + wp-admin/includes/template.php', 'add_meta_box()', 'add_meta_boxes' ), '3.3.0' ); return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us', ); } return WP_Screen::get( $hook_name ); } function _local_storage_notice() { ?> + + 0, 'type' => 'rating', 'number' => 0, 'echo' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $rating = (float) str_replace( ',', '.', $parsed_args['rating'] ); if ( 'percent' === $parsed_args['type'] ) { $rating = round( $rating / 10, 0 ) / 2; } $full_stars = floor( $rating ); $half_stars = ceil( $rating - $full_stars ); $empty_stars = 5 - $full_stars - $half_stars; if ( $parsed_args['number'] ) { $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] ); $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) ); } else { $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) ); } $output = '
      '; $output .= '' . $title . ''; $output .= str_repeat( '', $full_stars ); $output .= str_repeat( '', $half_stars ); $output .= str_repeat( '', $empty_stars ); $output .= '
      '; if ( $parsed_args['echo'] ) { echo $output; } return $output; } function _wp_posts_page_notice() { printf( '

      %s

      ', __( 'You are currently editing the page that shows your latest posts.' ) ); } function _wp_block_editor_posts_page_notice() { wp_add_inline_script( 'wp-notices', sprintf( 'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { isDismissible: false } )', __( 'You are currently editing the page that shows your latest posts.' ) ), 'after' ); } _timeout)) { $this->PushError('_settimeout','socket set send timeout'); $this->_quit(); return FALSE; } return TRUE; } function _connect($host, $port) { $this->SendMSG("Creating socket"); $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); if (!$sock) { $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction, 'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@fgets($this->_ftp_control_sock, 512); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed'); } else { $this->_message.=$tmp; if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed'); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); if(!$this->_ftp_data_sock) { $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); $this->_data_close(); return FALSE; } else $this->_ftp_data_sock; } else { $this->SendMSG("Only passive connections available!"); return FALSE; } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } while (!feof($this->_ftp_data_sock)) { $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return TRUE; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { $this->PushError("_data_write","Can't write to socket"); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @fclose($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit($force=FALSE) { if($this->_connected or $force) { @fclose($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?> + '', 'nonce' => '', ); $args = wp_parse_args( $args, $defaults ); parent::__construct( $args ); } public function add_strings() { $this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' ); $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while updating %1$s: %2$s' ); $this->upgrader->strings['skin_update_failed'] = __( 'The update of %s failed.' ); $this->upgrader->strings['skin_update_successful'] = __( '%s updated successfully.' ); $this->upgrader->strings['skin_upgrade_end'] = __( 'All updates have been completed.' ); } public function feedback( $feedback, ...$args ) { if ( isset( $this->upgrader->strings[ $feedback ] ) ) { $feedback = $this->upgrader->strings[ $feedback ]; } if ( strpos( $feedback, '%' ) !== false ) { if ( $args ) { $args = array_map( 'strip_tags', $args ); $args = array_map( 'esc_html', $args ); $feedback = vsprintf( $feedback, $args ); } } if ( empty( $feedback ) ) { return; } if ( $this->in_loop ) { echo "$feedback
      \n"; } else { echo "

      $feedback

      \n"; } } public function header() { } public function footer() { } public function error( $errors ) { if ( is_string( $errors ) && isset( $this->upgrader->strings[ $errors ] ) ) { $this->error = $this->upgrader->strings[ $errors ]; } if ( is_wp_error( $errors ) ) { $messages = array(); foreach ( $errors->get_error_messages() as $emessage ) { if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { $messages[] = $emessage . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ); } else { $messages[] = $emessage; } } $this->error = implode( ', ', $messages ); } echo ''; } public function bulk_header() { $this->feedback( 'skin_upgrade_start' ); } public function bulk_footer() { $this->feedback( 'skin_upgrade_end' ); } public function before( $title = '' ) { $this->in_loop = true; printf( '

      ' . $this->upgrader->strings['skin_before_update_header'] . '

      ', $title, $this->upgrader->update_current, $this->upgrader->update_count ); echo ''; echo '

      '; $this->flush_output(); } public function after( $title = '' ) { echo '

      '; if ( $this->error || ! $this->result ) { if ( $this->error ) { echo '

      ' . sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '' . $this->error . '' ) . '

      '; } else { echo '

      ' . sprintf( $this->upgrader->strings['skin_update_failed'], $title ) . '

      '; } echo ''; } if ( $this->result && ! is_wp_error( $this->result ) ) { if ( ! $this->error ) { echo '
      ' . '

      ' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) . ' ' . '

      '; } echo ''; } $this->reset(); $this->flush_output(); } public function reset() { $this->in_loop = false; $this->error = false; } public function flush_output() { wp_ob_end_flush_all(); flush(); } } 'comments', 'singular' => 'comment', 'ajax' => true, 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function floated_admin_avatar( $name, $comment_id ) { $comment = get_comment( $comment_id ); $avatar = get_avatar( $comment, 32, 'mystery' ); return "$avatar $name"; } public function ajax_user_can() { return current_user_can( 'edit_posts' ); } public function prepare_items() { global $mode, $post_id, $comment_status, $comment_type, $search; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'posts_list_mode', $mode ); } else { $mode = get_user_setting( 'posts_list_mode', 'list' ); } $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) { $comment_status = 'all'; } $comment_type = ! empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : ''; $post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : ''; $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : ''; $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : ''; $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : ''; $comments_per_page = $this->get_per_page( $comment_status ); $doing_ajax = wp_doing_ajax(); if ( isset( $_REQUEST['number'] ) ) { $number = (int) $_REQUEST['number']; } else { $number = $comments_per_page + min( 8, $comments_per_page ); } $page = $this->get_pagenum(); if ( isset( $_REQUEST['start'] ) ) { $start = $_REQUEST['start']; } else { $start = ( $page - 1 ) * $comments_per_page; } if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) { $start += $_REQUEST['offset']; } $status_map = array( 'mine' => '', 'moderated' => 'hold', 'approved' => 'approve', 'all' => '', ); $args = array( 'status' => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status, 'search' => $search, 'user_id' => $user_id, 'offset' => $start, 'number' => $number, 'post_id' => $post_id, 'type' => $comment_type, 'orderby' => $orderby, 'order' => $order, 'post_type' => $post_type, ); $args = apply_filters( 'comments_list_table_query_args', $args ); $_comments = get_comments( $args ); if ( is_array( $_comments ) ) { update_comment_cache( $_comments ); $this->items = array_slice( $_comments, 0, $comments_per_page ); $this->extra_items = array_slice( $_comments, $comments_per_page ); $_comment_post_ids = array_unique( wp_list_pluck( $_comments, 'comment_post_ID' ) ); $this->pending_count = get_pending_comments_num( $_comment_post_ids ); } $total_comments = get_comments( array_merge( $args, array( 'count' => true, 'offset' => 0, 'number' => 0, ) ) ); $this->set_pagination_args( array( 'total_items' => $total_comments, 'per_page' => $comments_per_page, ) ); } public function get_per_page( $comment_status = 'all' ) { $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); return apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); } public function no_items() { global $comment_status; if ( 'moderated' === $comment_status ) { _e( 'No comments awaiting moderation.' ); } elseif ( 'trash' === $comment_status ) { _e( 'No comments found in Trash.' ); } else { _e( 'No comments found.' ); } } protected function get_views() { global $post_id, $comment_status, $comment_type; $status_links = array(); $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); $stati = array( 'all' => _nx_noop( 'All (%s)', 'All (%s)', 'comments' ), 'mine' => _nx_noop( 'Mine (%s)', 'Mine (%s)', 'comments' ), 'moderated' => _nx_noop( 'Pending (%s)', 'Pending (%s)', 'comments' ), 'approved' => _nx_noop( 'Approved (%s)', 'Approved (%s)', 'comments' ), 'spam' => _nx_noop( 'Spam (%s)', 'Spam (%s)', 'comments' ), 'trash' => _nx_noop( 'Trash (%s)', 'Trash (%s)', 'comments' ), ); if ( ! EMPTY_TRASH_DAYS ) { unset( $stati['trash'] ); } $link = admin_url( 'edit-comments.php' ); if ( ! empty( $comment_type ) && 'all' !== $comment_type ) { $link = add_query_arg( 'comment_type', $comment_type, $link ); } foreach ( $stati as $status => $label ) { $current_link_attributes = ''; if ( $status === $comment_status ) { $current_link_attributes = ' class="current" aria-current="page"'; } if ( 'mine' === $status ) { $current_user_id = get_current_user_id(); $num_comments->mine = get_comments( array( 'post_id' => $post_id ? $post_id : 0, 'user_id' => $current_user_id, 'count' => true, ) ); $link = add_query_arg( 'user_id', $current_user_id, $link ); } else { $link = remove_query_arg( 'user_id', $link ); } if ( ! isset( $num_comments->$status ) ) { $num_comments->$status = 10; } $link = add_query_arg( 'comment_status', $status, $link ); if ( $post_id ) { $link = add_query_arg( 'p', absint( $post_id ), $link ); } $status_links[ $status ] = "" . sprintf( translate_nooped_plural( $label, $num_comments->$status ), sprintf( '%s', ( 'moderated' === $status ) ? 'pending' : $status, number_format_i18n( $num_comments->$status ) ) ) . ''; } return apply_filters( 'comment_status_links', $status_links ); } protected function get_bulk_actions() { global $comment_status; $actions = array(); if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) { $actions['unapprove'] = __( 'Unapprove' ); } if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) { $actions['approve'] = __( 'Approve' ); } if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) { $actions['spam'] = _x( 'Mark as spam', 'comment' ); } if ( 'trash' === $comment_status ) { $actions['untrash'] = __( 'Restore' ); } elseif ( 'spam' === $comment_status ) { $actions['unspam'] = _x( 'Not spam', 'comment' ); } if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } return $actions; } protected function extra_tablenav( $which ) { global $comment_status, $comment_type; static $has_items; if ( ! isset( $has_items ) ) { $has_items = $this->has_items(); } echo '
      '; if ( 'top' === $which ) { ob_start(); $this->comment_type_dropdown( $comment_type ); do_action( 'restrict_manage_comments' ); $output = ob_get_clean(); if ( ! empty( $output ) && $this->has_items() ) { echo $output; submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } } if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items && current_user_can( 'moderate_comments' ) ) { wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); submit_button( $title, 'apply', 'delete_all', false ); } do_action( 'manage_comments_nav', $comment_status, $which ); echo '
      '; } public function current_action() { if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { return 'delete_all'; } return parent::current_action(); } public function get_columns() { global $post_id; $columns = array(); if ( $this->checkbox ) { $columns['cb'] = ''; } $columns['author'] = __( 'Author' ); $columns['comment'] = _x( 'Comment', 'column name' ); if ( ! $post_id ) { $columns['response'] = __( 'In response to' ); } $columns['date'] = _x( 'Submitted on', 'column name' ); return $columns; } protected function comment_type_dropdown( $comment_type ) { $comment_types = apply_filters( 'admin_comment_types_dropdown', array( 'comment' => __( 'Comments' ), 'pings' => __( 'Pings' ), ) ); if ( $comment_types && is_array( $comment_types ) ) { printf( '', __( 'Filter by comment type' ) ); echo ''; } } protected function get_sortable_columns() { return array( 'author' => 'comment_author', 'response' => 'comment_post_ID', 'date' => 'comment_date', ); } protected function get_default_primary_column_name() { return 'comment'; } public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); static $has_items; if ( ! isset( $has_items ) ) { $has_items = $this->has_items(); if ( $has_items ) { $this->display_tablenav( 'top' ); } } $this->screen->render_screen_reader_content( 'heading_list' ); ?> + + + + print_column_headers(); ?> + + -.menu-edit #post-body-content h3 { - margin: 1em 0 10px; -} + + display_rows_or_placeholder(); ?> + -#nav-menu-bulk-actions-top { - margin: 1em 0; -} + + items; $this->items = $this->extra_items; $this->display_rows_or_placeholder(); $this->items = $items; ?> + -#nav-menu-bulk-actions-bottom { - margin: 1em 0; - margin: calc( 1em + 9px ) 0 ; -} + + + print_column_headers( false ); ?> + + -.bulk-actions input.button { - margin-right: 12px; -} +
      + display_tablenav( 'bottom' ); } public function single_row( $item ) { global $post, $comment; $comment = $item; $the_comment_class = wp_get_comment_status( $comment ); if ( ! $the_comment_class ) { $the_comment_class = ''; } $the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) ); if ( $comment->comment_post_ID > 0 ) { $post = get_post( $comment->comment_post_ID ); } $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); echo ""; $this->single_row_columns( $comment ); echo "\n"; unset( $GLOBALS['post'], $GLOBALS['comment'] ); } protected function handle_row_actions( $item, $column_name, $primary ) { global $comment_status; if ( $primary !== $column_name ) { return ''; } if ( ! $this->user_can ) { return ''; } $comment = $item; $the_comment_status = wp_get_comment_status( $comment ); $out = ''; $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); $url = "comment.php?c=$comment->comment_ID"; $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'quickedit' => '', 'edit' => '', 'spam' => '', 'unspam' => '', 'trash' => '', 'untrash' => '', 'delete' => '', ); if ( $comment_status && 'all' !== $comment_status ) { if ( 'approved' === $the_comment_status ) { $actions['unapprove'] = sprintf( '%s', $unapprove_url, "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); } elseif ( 'unapproved' === $the_comment_status ) { $actions['approve'] = sprintf( '%s', $approve_url, "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); } } else { $actions['approve'] = sprintf( '%s', $approve_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '%s', $unapprove_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); } if ( 'spam' !== $the_comment_status ) { $actions['spam'] = sprintf( '%s', $spam_url, "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), _x( 'Spam', 'verb' ) ); } elseif ( 'spam' === $the_comment_status ) { $actions['unspam'] = sprintf( '%s', $unspam_url, "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1", esc_attr__( 'Restore this comment from the spam' ), _x( 'Not Spam', 'comment' ) ); } if ( 'trash' === $the_comment_status ) { $actions['untrash'] = sprintf( '%s', $untrash_url, "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1", esc_attr__( 'Restore this comment from the Trash' ), __( 'Restore' ) ); } if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', $delete_url, "delete:the-comment-list:comment-{$comment->comment_ID}::delete=1", esc_attr__( 'Delete this comment permanently' ), __( 'Delete Permanently' ) ); } else { $actions['trash'] = sprintf( '%s', $trash_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Move this comment to the Trash' ), _x( 'Trash', 'verb' ) ); } if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) { $actions['edit'] = sprintf( '%s', "comment.php?action=editcomment&c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $format = ''; $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick edit this comment inline' ), __( 'Quick Edit' ) ); $actions['reply'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); } $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $always_visible = false; $mode = get_user_setting( 'posts_list_mode', 'list' ); if ( 'excerpt' === $mode ) { $always_visible = true; } $out .= '
      '; $i = 0; foreach ( $actions as $action => $link ) { ++$i; if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { $sep = ''; } else { $sep = ' | '; } if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { $action .= ' hide-if-no-js'; } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) || ( 'unspam' === $action && 'spam' === $the_comment_status ) ) { if ( '1' === get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { $action .= ' approve'; } else { $action .= ' unapprove'; } } $out .= "$sep$link"; } $out .= '
      '; $out .= ''; return $out; } public function column_cb( $item ) { $comment = $item; if ( $this->user_can ) { ?> + + + '; $this->column_author( $comment ); echo '
      '; if ( $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); if ( $parent ) { $parent_link = esc_url( get_comment_link( $parent ) ); $name = get_comment_author( $parent ); printf( __( 'In reply to %s.' ), '' . $name . '' ); } } comment_text( $comment ); if ( $this->user_can ) { $comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); ?> + + 50 ) { $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); } echo ''; comment_author( $comment ); echo '
      '; if ( ! empty( $author_url_display ) ) { printf( '%s
      ', esc_url( $author_url ), esc_html( $author_url_display ) ); } if ( $this->user_can ) { if ( ! empty( $comment->comment_author_email ) ) { $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ! empty( $email ) && '@' !== $email ) { printf( '%2$s
      ', esc_url( 'mailto:' . $email ), esc_html( $email ) ); } } $author_ip = get_comment_author_IP( $comment ); if ( $author_ip ) { $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail', ), admin_url( 'edit-comments.php' ) ); if ( 'spam' === $comment_status ) { $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); } printf( '%2$s', esc_url( $author_ip_url ), esc_html( $author_ip ) ); } } } public function column_date( $comment ) { $submitted = sprintf( __( '%1$s at %2$s' ), get_comment_date( __( 'Y/m/d' ), $comment ), get_comment_date( __( 'g:i a' ), $comment ) ); echo ''; } public function column_response( $comment ) { $post = get_post(); if ( ! $post ) { return; } if ( isset( $this->pending_count[ $post->ID ] ) ) { $pending_comments = $this->pending_count[ $post->ID ]; } else { $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); $pending_comments = $_pending_count_temp[ $post->ID ]; $this->pending_count[ $post->ID ] = $pending_comments; } if ( current_user_can( 'edit_post', $post->ID ) ) { $post_link = ""; $post_link .= esc_html( get_the_title( $post->ID ) ) . ''; } else { $post_link = esc_html( get_the_title( $post->ID ) ); } echo ''; } public function column_default( $item, $column_name ) { do_action( 'manage_comments_custom_column', $column_name, $item->comment_ID ); } } 'themes', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken', 'auto-update-enabled', 'auto-update-disabled' ), true ) ) { $status = 'all'; } $page = $this->get_pagenum(); $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false; if ( $this->is_site_themes ) { $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; } $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) && ! $this->is_site_themes && current_user_can( 'update_themes' ); } protected function get_table_classes() { return array( 'widefat', 'plugins' ); } public function ajax_user_can() { if ( $this->is_site_themes ) { return current_user_can( 'manage_sites' ); } else { return current_user_can( 'manage_network_themes' ); } } public function prepare_items() { global $status, $totals, $page, $orderby, $order, $s; wp_reset_vars( array( 'orderby', 'order', 's' ) ); $themes = array( 'all' => apply_filters( 'all_themes', wp_get_themes() ), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ), ); if ( $this->show_autoupdates ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); $themes['auto-update-enabled'] = array(); $themes['auto-update-disabled'] = array(); } if ( $this->is_site_themes ) { $themes_per_page = $this->get_items_per_page( 'site_themes_network_per_page' ); $allowed_where = 'site'; } else { $themes_per_page = $this->get_items_per_page( 'themes_network_per_page' ); $allowed_where = 'network'; } $current = get_site_transient( 'update_themes' ); $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current; foreach ( (array) $themes['all'] as $key => $theme ) { if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) { unset( $themes['all'][ $key ] ); continue; } if ( $maybe_update && isset( $current->response[ $key ] ) ) { $themes['all'][ $key ]->update = true; $themes['upgrade'][ $key ] = $themes['all'][ $key ]; } $filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled'; $themes[ $filter ][ $key ] = $themes['all'][ $key ]; $theme_data = array( 'update_supported' => isset( $theme->update_supported ) ? $theme->update_supported : true, ); if ( isset( $current->response[ $key ] ) ) { $theme_data = array_merge( (array) $current->response[ $key ], $theme_data ); } elseif ( isset( $current->no_update[ $key ] ) ) { $theme_data = array_merge( (array) $current->no_update[ $key ], $theme_data ); } else { $theme_data['update_supported'] = false; } $theme->update_supported = $theme_data['update_supported']; $filter_payload = array( 'theme' => $key, 'new_version' => '', 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); $filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $theme_data, $filter_payload ) ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $filter_payload ); if ( ! is_null( $auto_update_forced ) ) { $theme->auto_update_forced = $auto_update_forced; } if ( $this->show_autoupdates ) { $enabled = in_array( $key, $auto_updates, true ) && $theme->update_supported; if ( isset( $theme->auto_update_forced ) ) { $enabled = (bool) $theme->auto_update_forced; } if ( $enabled ) { $themes['auto-update-enabled'][ $key ] = $theme; } else { $themes['auto-update-disabled'][ $key ] = $theme; } } } if ( $s ) { $status = 'search'; $themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) ); } $totals = array(); $js_themes = array(); foreach ( $themes as $type => $list ) { $totals[ $type ] = count( $list ); $js_themes[ $type ] = array_keys( $list ); } if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } $this->items = $themes[ $status ]; WP_Theme::sort_by_name( $this->items ); $this->has_items = ! empty( $themes['all'] ); $total_this_page = $totals[ $status ]; wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'themes' => $js_themes, 'totals' => wp_get_update_data(), ) ); if ( $orderby ) { $orderby = ucfirst( $orderby ); $order = strtoupper( $order ); if ( 'Name' === $orderby ) { if ( 'ASC' === $order ) { $this->items = array_reverse( $this->items ); } } else { uasort( $this->items, array( $this, '_order_callback' ) ); } } $start = ( $page - 1 ) * $themes_per_page; if ( $total_this_page > $themes_per_page ) { $this->items = array_slice( $this->items, $start, $themes_per_page, true ); } $this->set_pagination_args( array( 'total_items' => $total_this_page, 'per_page' => $themes_per_page, ) ); } public function _search_callback( $theme ) { static $term = null; if ( is_null( $term ) ) { $term = wp_unslash( $_REQUEST['s'] ); } foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) { if ( false !== stripos( $theme->display( $field, false, true ), $term ) ) { return true; } } if ( false !== stripos( $theme->get_stylesheet(), $term ) ) { return true; } if ( false !== stripos( $theme->get_template(), $term ) ) { return true; } return false; } public function _order_callback( $theme_a, $theme_b ) { global $orderby, $order; $a = $theme_a[ $orderby ]; $b = $theme_b[ $orderby ]; if ( $a === $b ) { return 0; } if ( 'DESC' === $order ) { return ( $a < $b ) ? 1 : -1; } else { return ( $a < $b ) ? -1 : 1; } } public function no_items() { if ( $this->has_items ) { _e( 'No themes found.' ); } else { _e( 'No themes are currently available.' ); } } public function get_columns() { $columns = array( 'cb' => '', 'name' => __( 'Theme' ), 'description' => __( 'Description' ), ); if ( $this->show_autoupdates ) { $columns['auto-updates'] = __( 'Automatic Updates' ); } return $columns; } protected function get_sortable_columns() { return array( 'name' => 'name', ); } protected function get_primary_column_name() { return 'name'; } protected function get_views() { global $totals, $status; $status_links = array(); foreach ( $totals as $type => $count ) { if ( ! $count ) { continue; } switch ( $type ) { case 'all': $text = _nx( 'All (%s)', 'All (%s)', $count, 'themes' ); break; case 'enabled': $text = _nx( 'Enabled (%s)', 'Enabled (%s)', $count, 'themes' ); break; case 'disabled': $text = _nx( 'Disabled (%s)', 'Disabled (%s)', $count, 'themes' ); break; case 'upgrade': $text = _nx( 'Update Available (%s)', 'Update Available (%s)', $count, 'themes' ); break; case 'broken': $text = _nx( 'Broken (%s)', 'Broken (%s)', $count, 'themes' ); break; case 'auto-update-enabled': $text = _n( 'Auto-updates Enabled (%s)', 'Auto-updates Enabled (%s)', $count ); break; case 'auto-update-disabled': $text = _n( 'Auto-updates Disabled (%s)', 'Auto-updates Disabled (%s)', $count ); break; } if ( $this->is_site_themes ) { $url = 'site-themes.php?id=' . $this->site_id; } else { $url = 'themes.php'; } if ( 'search' !== $type ) { $status_links[ $type ] = sprintf( "%s", esc_url( add_query_arg( 'theme_status', $type, $url ) ), ( $type === $status ) ? ' class="current" aria-current="page"' : '', sprintf( $text, number_format_i18n( $count ) ) ); } } return $status_links; } protected function get_bulk_actions() { global $status; $actions = array(); if ( 'enabled' !== $status ) { $actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ); } if ( 'disabled' !== $status ) { $actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ); } if ( ! $this->is_site_themes ) { if ( current_user_can( 'update_themes' ) ) { $actions['update-selected'] = __( 'Update' ); } if ( current_user_can( 'delete_themes' ) ) { $actions['delete-selected'] = __( 'Delete' ); } } if ( $this->show_autoupdates ) { if ( 'auto-update-enabled' !== $status ) { $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' ); } if ( 'auto-update-disabled' !== $status ) { $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' ); } } return $actions; } public function display_rows() { foreach ( $this->items as $theme ) { $this->single_row( $theme ); } } public function column_cb( $item ) { $theme = $item; $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); ?> + + + is_site_themes ) { $url = "site-themes.php?id={$this->site_id}&"; $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $url = 'themes.php?'; $allowed = $theme->is_allowed( 'network' ); } $actions = array( 'enable' => '', 'disable' => '', 'delete' => '', ); $stylesheet = $theme->get_stylesheet(); $theme_key = urlencode( $stylesheet ); if ( ! $allowed ) { if ( ! $theme->errors() ) { $url = add_query_arg( array( 'action' => 'enable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { $aria_label = sprintf( __( 'Enable %s' ), $theme->display( 'Name' ) ); } else { $aria_label = sprintf( __( 'Network Enable %s' ), $theme->display( 'Name' ) ); } $actions['enable'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'enable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) ); } } else { $url = add_query_arg( array( 'action' => 'disable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { $aria_label = sprintf( __( 'Disable %s' ), $theme->display( 'Name' ) ); } else { $aria_label = sprintf( __( 'Network Disable %s' ), $theme->display( 'Name' ) ); } $actions['disable'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'disable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) ); } if ( ! $allowed && ! $this->is_site_themes && current_user_can( 'delete_themes' ) && get_option( 'stylesheet' ) !== $stylesheet && get_option( 'template' ) !== $stylesheet ) { $url = add_query_arg( array( 'action' => 'delete-selected', 'checked[]' => $theme_key, 'theme_status' => $context, 'paged' => $page, 's' => $s, ), 'themes.php' ); $aria_label = sprintf( _x( 'Delete %s', 'theme' ), $theme->display( 'Name' ) ); $actions['delete'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'bulk-themes' ) ), esc_attr( $aria_label ), __( 'Delete' ) ); } $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme, $context ); $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, $context ); echo $this->row_actions( $actions, true ); } public function column_description( $theme ) { global $status, $totals; if ( $theme->errors() ) { $pre = 'broken' === $status ? __( 'Broken Theme:' ) . ' ' : ''; echo '

      ' . $pre . $theme->errors()->get_error_message() . '

      '; } if ( $this->is_site_themes ) { $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $allowed = $theme->is_allowed( 'network' ); } $class = ! $allowed ? 'inactive' : 'active'; if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) { $class .= ' update'; } echo "

      " . $theme->display( 'Description' ) . "

      +
      "; $stylesheet = $theme->get_stylesheet(); $theme_meta = array(); if ( $theme->get( 'Version' ) ) { $theme_meta[] = sprintf( __( 'Version %s' ), $theme->display( 'Version' ) ); } $theme_meta[] = sprintf( __( 'By %s' ), $theme->display( 'Author' ) ); if ( $theme->get( 'ThemeURI' ) ) { $aria_label = sprintf( __( 'Visit theme site for %s' ), $theme->display( 'Name' ) ); $theme_meta[] = sprintf( '%s', $theme->display( 'ThemeURI' ), esc_attr( $aria_label ), __( 'Visit Theme Site' ) ); } if ( $theme->parent() ) { $theme_meta[] = sprintf( __( 'Child theme of %s' ), '' . $theme->parent()->display( 'Name' ) . '' ); } $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); echo implode( ' | ', $theme_meta ); echo '
      '; } public function column_autoupdates( $theme ) { global $status, $page; static $auto_updates, $available_updates; if ( ! $auto_updates ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } if ( ! $available_updates ) { $available_updates = get_site_transient( 'update_themes' ); } $stylesheet = $theme->get_stylesheet(); if ( isset( $theme->auto_update_forced ) ) { if ( $theme->auto_update_forced ) { $text = __( 'Auto-updates enabled' ); } else { $text = __( 'Auto-updates disabled' ); } $action = 'unavailable'; $time_class = ' hidden'; } elseif ( empty( $theme->update_supported ) ) { $text = ''; $action = 'unavailable'; $time_class = ' hidden'; } elseif ( in_array( $stylesheet, $auto_updates, true ) ) { $text = __( 'Disable auto-updates' ); $action = 'disable'; $time_class = ''; } else { $text = __( 'Enable auto-updates' ); $action = 'enable'; $time_class = ' hidden'; } $query_args = array( 'action' => "{$action}-auto-update", 'theme' => $stylesheet, 'paged' => $page, 'theme_status' => $status, ); $url = add_query_arg( $query_args, 'themes.php' ); if ( 'unavailable' === $action ) { $html[] = '' . $text . ''; } else { $html[] = sprintf( '', wp_nonce_url( $url, 'updates' ), $action ); $html[] = ''; $html[] = '' . $text . ''; $html[] = ''; } if ( isset( $available_updates->response[ $stylesheet ] ) ) { $html[] = sprintf( '
      %s
      ', $time_class, wp_get_auto_update_message() ); } $html = implode( '', $html ); echo apply_filters( 'theme_auto_update_setting_html', $html, $stylesheet, $theme ); echo ''; } public function column_default( $item, $column_name ) { do_action( 'manage_themes_custom_column', $column_name, $item->get_stylesheet(), $item ); } public function single_row_columns( $item ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; if ( in_array( $column_name, $hidden, true ) ) { $extra_classes .= ' hidden'; } switch ( $column_name ) { case 'cb': echo ''; $this->column_cb( $item ); echo ''; break; case 'name': $active_theme_label = ''; if ( ! empty( $this->site_id ) ) { $stylesheet = get_blog_option( $this->site_id, 'stylesheet' ); $template = get_blog_option( $this->site_id, 'template' ); if ( $item->get_template() === $template ) { $active_theme_label = ' — ' . __( 'Active Theme' ); } if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet ) { $active_theme_label = ' — ' . __( 'Active Child Theme' ); } } echo "" . $item->display( 'Name' ) . $active_theme_label . ''; $this->column_name( $item ); echo ''; break; case 'description': echo ""; $this->column_description( $item ); echo ''; break; case 'auto-updates': echo ""; $this->column_autoupdates( $item ); echo ''; break; default: echo ""; $this->column_default( $item, $column_name ); echo ''; break; } } } public function single_row( $theme ) { global $status, $totals; if ( $this->is_site_themes ) { $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $allowed = $theme->is_allowed( 'network' ); } $stylesheet = $theme->get_stylesheet(); $class = ! $allowed ? 'inactive' : 'active'; if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) { $class .= ' update'; } printf( '', esc_attr( $class ), esc_attr( $stylesheet ) ); $this->single_row_columns( $theme ); echo ''; if ( $this->is_site_themes ) { remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' ); } do_action( 'after_theme_row', $stylesheet, $theme, $status ); do_action( "after_theme_row_{$stylesheet}", $stylesheet, $theme, $status ); } } __( 'From Computer' ), 'type_url' => __( 'From URL' ), 'gallery' => __( 'Gallery' ), 'library' => __( 'Media Library' ), ); return apply_filters( 'media_upload_tabs', $_default_tabs ); } function update_gallery_tab( $tabs ) { global $wpdb; if ( ! isset( $_REQUEST['post_id'] ) ) { unset( $tabs['gallery'] ); return $tabs; } $post_id = (int) $_REQUEST['post_id']; if ( $post_id ) { $attachments = (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ); } if ( empty( $attachments ) ) { unset( $tabs['gallery'] ); return $tabs; } $tabs['gallery'] = sprintf( __( 'Gallery (%s)' ), "$attachments" ); return $tabs; } function the_media_upload_tabs() { global $redir_tab; $tabs = media_upload_tabs(); $default = 'type'; if ( ! empty( $tabs ) ) { echo "
        \n"; if ( isset( $redir_tab ) && array_key_exists( $redir_tab, $tabs ) ) { $current = $redir_tab; } elseif ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) { $current = $_GET['tab']; } else { $current = apply_filters( 'media_upload_default_tab', $default ); } foreach ( $tabs as $callback => $text ) { $class = ''; if ( $current == $callback ) { $class = " class='current'"; } $href = add_query_arg( array( 'tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false, ) ); $link = "$text"; echo "\t
      • $link
      • \n"; } echo "
      \n"; } } function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' ) { $html = get_image_tag( $id, $alt, '', $align, $size ); if ( $rel ) { if ( is_string( $rel ) ) { $rel = ' rel="' . esc_attr( $rel ) . '"'; } else { $rel = ' rel="attachment wp-att-' . (int) $id . '"'; } } else { $rel = ''; } if ( $url ) { $html = '' . $html . ''; } $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt, $rel ); return $html; } function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { $caption = apply_filters( 'image_add_caption_text', $caption, $id ); if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) { return $html; } $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) { return $html; } $width = $matches[1]; $caption = str_replace( array( "\r\n", "\r" ), "\n", $caption ); $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '
      ', $caption ); $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html ); if ( empty( $align ) ) { $align = 'none'; } $shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]'; return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); } function _cleanup_image_add_caption( $matches ) { return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] ); } function media_send_to_editor( $html ) { ?> + + false ) ) { $time = current_time( 'mysql' ); $post = get_post( $post_id ); if ( $post ) { if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) { $time = $post->post_date; } } $file = wp_handle_upload( $_FILES[ $file_id ], $overrides, $time ); if ( isset( $file['error'] ) ) { return new WP_Error( 'upload_error', $file['error'] ); } $name = $_FILES[ $file_id ]['name']; $ext = pathinfo( $name, PATHINFO_EXTENSION ); $name = wp_basename( $name, ".$ext" ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = sanitize_text_field( $name ); $content = ''; $excerpt = ''; if ( preg_match( '#^audio#', $type ) ) { $meta = wp_read_audio_metadata( $file ); if ( ! empty( $meta['title'] ) ) { $title = $meta['title']; } if ( ! empty( $title ) ) { if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] ); } elseif ( ! empty( $meta['album'] ) ) { $content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] ); } elseif ( ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] ); } else { $content .= sprintf( __( '"%s".' ), $title ); } } elseif ( ! empty( $meta['album'] ) ) { if ( ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '%1$s by %2$s.' ), $meta['album'], $meta['artist'] ); } else { $content .= $meta['album'] . '.'; } } elseif ( ! empty( $meta['artist'] ) ) { $content .= $meta['artist'] . '.'; } if ( ! empty( $meta['year'] ) ) { $content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] ); } if ( ! empty( $meta['track_number'] ) ) { $track_number = explode( '/', $meta['track_number'] ); if ( is_numeric( $track_number[0] ) ) { if ( isset( $track_number[1] ) && is_numeric( $track_number[1] ) ) { $content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) ); } else { $content .= ' ' . sprintf( __( 'Track %s.' ), number_format_i18n( $track_number[0] ) ); } } } if ( ! empty( $meta['genre'] ) ) { $content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] ); } } elseif ( 0 === strpos( $type, 'image/' ) ) { $image_meta = wp_read_image_metadata( $file ); if ( $image_meta ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { $title = $image_meta['title']; } if ( trim( $image_meta['caption'] ) ) { $excerpt = $image_meta['caption']; } } } $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, 'post_excerpt' => $excerpt, ), $post_data ); unset( $attachment['ID'] ); $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $attachment_id ) ) { if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } return $attachment_id; } function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { $overrides = array( 'test_form' => false ); if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) { $time = $post_data['post_date']; } else { $post = get_post( $post_id ); if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) { $time = $post->post_date; } else { $time = current_time( 'mysql' ); } } $file = wp_handle_sideload( $file_array, $overrides, $time ); if ( isset( $file['error'] ) ) { return new WP_Error( 'upload_error', $file['error'] ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) ); $content = ''; $image_meta = wp_read_image_metadata( $file ); if ( $image_meta ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { $title = $image_meta['title']; } if ( trim( $image_meta['caption'] ) ) { $content = $image_meta['caption']; } } if ( isset( $desc ) ) { $title = $desc; } $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, ), $post_data ); unset( $attachment['ID'] ); $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $attachment_id ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } return $attachment_id; } function wp_iframe( $content_func, ...$args ) { _wp_admin_html_begin(); ?> + <?php bloginfo( 'name' ); ?> › <?php _e( 'Uploads' ); ?> — <?php _e( 'WordPress' ); ?> + + + + + class="wp-core-ui no-js"> + + + + + + $post ) ); $img = ' '; $id_attribute = 1 === $instance ? ' id="insert-media-button"' : ''; printf( '', $id_attribute, esc_attr( $editor_id ), $img . __( 'Add Media' ) ); $legacy_filter = apply_filters_deprecated( 'media_buttons_context', array( '' ), '3.5.0', 'media_buttons' ); if ( $legacy_filter ) { if ( 0 === stripos( trim( $legacy_filter ), '' ) ) { $legacy_filter .= ''; } echo $legacy_filter; } } function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) { global $post_ID; if ( empty( $post_id ) ) { $post_id = $post_ID; } $upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) ); if ( $type && 'media' !== $type ) { $upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src ); } if ( ! empty( $tab ) ) { $upload_iframe_src = add_query_arg( 'tab', $tab, $upload_iframe_src ); } $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src ); return add_query_arg( 'TB_iframe', true, $upload_iframe_src ); } function media_upload_form_handler() { check_admin_referer( 'media-form' ); $errors = null; if ( isset( $_POST['send'] ) ) { $keys = array_keys( $_POST['send'] ); $send_id = (int) reset( $keys ); } if ( ! empty( $_POST['attachments'] ) ) { foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { $post = get_post( $attachment_id, ARRAY_A ); $_post = $post; if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } if ( isset( $attachment['post_content'] ) ) { $post['post_content'] = $attachment['post_content']; } if ( isset( $attachment['post_title'] ) ) { $post['post_title'] = $attachment['post_title']; } if ( isset( $attachment['post_excerpt'] ) ) { $post['post_excerpt'] = $attachment['post_excerpt']; } if ( isset( $attachment['menu_order'] ) ) { $post['menu_order'] = $attachment['menu_order']; } if ( isset( $send_id ) && $attachment_id == $send_id ) { if ( isset( $attachment['post_parent'] ) ) { $post['post_parent'] = $attachment['post_parent']; } } $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); if ( isset( $attachment['image_alt'] ) ) { $image_alt = wp_unslash( $attachment['image_alt'] ); if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); } } if ( isset( $post['errors'] ) ) { $errors[ $attachment_id ] = $post['errors']; unset( $post['errors'] ); } if ( $post != $_post ) { wp_update_post( $post ); } foreach ( get_attachment_taxonomies( $post ) as $t ) { if ( isset( $attachment[ $t ] ) ) { wp_set_object_terms( $attachment_id, array_map( 'trim', preg_split( '/,+/', $attachment[ $t ] ) ), $t, false ); } } } } if ( isset( $_POST['insert-gallery'] ) || isset( $_POST['update-gallery'] ) ) { ?> + + $html"; } $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment ); return media_send_to_editor( $html ); } return $errors; } function wp_media_upload_handler() { $errors = array(); $id = 0; if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) { check_admin_referer( 'media-form' ); $id = media_handle_upload( 'async-upload', $_REQUEST['post_id'] ); unset( $_FILES ); if ( is_wp_error( $id ) ) { $errors['upload_error'] = $id; $id = false; } } if ( ! empty( $_POST['insertonlybutton'] ) ) { $src = $_POST['src']; if ( ! empty( $src ) && ! strpos( $src, '://' ) ) { $src = "http://$src"; } if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) { $title = esc_html( wp_unslash( $_POST['title'] ) ); if ( empty( $title ) ) { $title = esc_html( wp_basename( $src ) ); } if ( $title && $src ) { $html = "$title"; } $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } $html = apply_filters( "{$type}_send_to_editor_url", $html, esc_url_raw( $src ), $title ); } else { $align = ''; $alt = esc_attr( wp_unslash( $_POST['alt'] ) ); if ( isset( $_POST['align'] ) ) { $align = esc_attr( wp_unslash( $_POST['align'] ) ); $class = " class='align$align'"; } if ( ! empty( $src ) ) { $html = "$alt"; } $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align ); } return media_send_to_editor( $html ); } if ( isset( $_POST['save'] ) ) { $errors['upload_notice'] = __( 'Saved.' ); wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } elseif ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { $type = 'image'; if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ), true ) ) { $type = $_GET['type']; } return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id ); } return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } function media_sideload_image( $file, $post_id = 0, $desc = null, $return_type = 'html' ) { if ( ! empty( $file ) ) { $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' ); $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file ); $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches ); if ( ! $matches ) { return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) ); } $file_array = array(); $file_array['name'] = wp_basename( $matches[0] ); $file_array['tmp_name'] = download_url( $file ); if ( is_wp_error( $file_array['tmp_name'] ) ) { return $file_array['tmp_name']; } $id = media_handle_sideload( $file_array, $post_id, $desc ); if ( is_wp_error( $id ) ) { @unlink( $file_array['tmp_name'] ); return $id; } add_post_meta( $id, '_source_url', $file ); if ( 'id' === $return_type ) { return $id; } $src = wp_get_attachment_url( $id ); } if ( ! empty( $src ) ) { if ( 'src' === $return_type ) { return $src; } $alt = isset( $desc ) ? esc_attr( $desc ) : ''; $html = "$alt"; return $html; } else { return new WP_Error( 'image_sideload_failed' ); } } function media_upload_gallery() { $errors = array(); if ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } function media_upload_library() { $errors = array(); if ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } return wp_iframe( 'media_upload_library_form', $errors ); } function image_align_input_fields( $post, $checked = '' ) { if ( empty( $checked ) ) { $checked = get_user_setting( 'align', 'none' ); } $alignments = array( 'none' => __( 'None' ), 'left' => __( 'Left' ), 'center' => __( 'Center' ), 'right' => __( 'Right' ), ); if ( ! array_key_exists( (string) $checked, $alignments ) ) { $checked = 'none'; } $out = array(); foreach ( $alignments as $name => $label ) { $name = esc_attr( $name ); $out[] = ""; } return implode( "\n", $out ); } function image_size_input_fields( $post, $check = '' ) { $size_names = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); if ( empty( $check ) ) { $check = get_user_setting( 'imgsize', 'medium' ); } $out = array(); foreach ( $size_names as $size => $label ) { $downsize = image_downsize( $post->ID, $size ); $checked = ''; $enabled = ( $downsize[3] || 'full' === $size ); $css_id = "image-size-{$size}-{$post->ID}"; if ( $size == $check ) { if ( $enabled ) { $checked = " checked='checked'"; } else { $check = ''; } } elseif ( ! $check && $enabled && 'thumbnail' !== $size ) { $check = $size; $checked = " checked='checked'"; } $html = "
      "; $html .= ""; if ( $enabled ) { $html .= " '; } $html .= '
      '; $out[] = $html; } return array( 'label' => __( 'Size' ), 'input' => 'html', 'html' => implode( "\n", $out ), ); } function image_link_input_fields( $post, $url_type = '' ) { $file = wp_get_attachment_url( $post->ID ); $link = get_attachment_link( $post->ID ); if ( empty( $url_type ) ) { $url_type = get_user_setting( 'urlbutton', 'post' ); } $url = ''; if ( 'file' === $url_type ) { $url = $file; } elseif ( 'post' === $url_type ) { $url = $link; } return " +
      + + + +'; } function wp_caption_input_textarea( $edit_post ) { $name = "attachments[{$edit_post->ID}][post_excerpt]"; return ''; } function image_attachment_fields_to_edit( $form_fields, $post ) { return $form_fields; } function media_single_attachment_fields_to_edit( $form_fields, $post ) { unset( $form_fields['url'], $form_fields['align'], $form_fields['image-size'] ); return $form_fields; } function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { unset( $form_fields['image_url'] ); return $form_fields; } function image_media_send_to_editor( $html, $attachment_id, $attachment ) { $post = get_post( $attachment_id ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $url = $attachment['url']; $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url ); return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt ); } return $html; } function get_attachment_fields_to_edit( $post, $errors = null ) { if ( is_int( $post ) ) { $post = get_post( $post ); } if ( is_array( $post ) ) { $post = new WP_Post( (object) $post ); } $image_url = wp_get_attachment_url( $post->ID ); $edit_post = sanitize_post( $post, 'edit' ); $form_fields = array( 'post_title' => array( 'label' => __( 'Title' ), 'value' => $edit_post->post_title, ), 'image_alt' => array(), 'post_excerpt' => array( 'label' => __( 'Caption' ), 'input' => 'html', 'html' => wp_caption_input_textarea( $edit_post ), ), 'post_content' => array( 'label' => __( 'Description' ), 'value' => $edit_post->post_content, 'input' => 'textarea', ), 'url' => array( 'label' => __( 'Link URL' ), 'input' => 'html', 'html' => image_link_input_fields( $post, get_option( 'image_default_link_type' ) ), 'helps' => __( 'Enter a link URL or click above for presets.' ), ), 'menu_order' => array( 'label' => __( 'Order' ), 'value' => $edit_post->menu_order, ), 'image_url' => array( 'label' => __( 'File URL' ), 'input' => 'html', 'html' => "
      ", 'value' => wp_get_attachment_url( $post->ID ), 'helps' => __( 'Location of the uploaded file.' ), ), ); foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( ! $t['public'] || ! $t['show_ui'] ) { continue; } if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $values = array(); foreach ( $terms as $term ) { $values[] = $term->slug; } $t['value'] = implode( ', ', $values ); $form_fields[ $taxonomy ] = $t; } $form_fields = array_merge_recursive( $form_fields, (array) $errors ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); if ( empty( $alt ) ) { $alt = ''; } $form_fields['post_title']['required'] = true; $form_fields['image_alt'] = array( 'value' => $alt, 'label' => __( 'Alternative Text' ), 'helps' => __( 'Alt text for the image, e.g. “The Mona Lisa”' ), ); $form_fields['align'] = array( 'label' => __( 'Alignment' ), 'input' => 'html', 'html' => image_align_input_fields( $post, get_option( 'image_default_align' ) ), ); $form_fields['image-size'] = image_size_input_fields( $post, get_option( 'image_default_size', 'medium' ) ); } else { unset( $form_fields['image_alt'] ); } $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); return $form_fields; } function get_media_items( $post_id, $errors ) { $attachments = array(); if ( $post_id ) { $post = get_post( $post_id ); if ( $post && 'attachment' === $post->post_type ) { $attachments = array( $post->ID => $post ); } else { $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC', ) ); } } else { if ( is_array( $GLOBALS['wp_the_query']->posts ) ) { foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) { $attachments[ $attachment->ID ] = $attachment; } } } $output = ''; foreach ( (array) $attachments as $id => $attachment ) { if ( 'trash' === $attachment->post_status ) { continue; } $item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) ); if ( $item ) { $output .= "\n
      $item\n
      "; } } return $output; } function get_media_item( $attachment_id, $args = null ) { global $redir_tab; $thumb_url = false; $attachment_id = (int) $attachment_id; if ( $attachment_id ) { $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ); if ( $thumb_url ) { $thumb_url = $thumb_url[0]; } } $post = get_post( $attachment_id ); $current_post_id = ! empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0; $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true, ); $parsed_args = wp_parse_args( $args, $default_args ); $parsed_args = apply_filters( 'get_media_item_args', $parsed_args ); $toggle_on = __( 'Show' ); $toggle_off = __( 'Hide' ); $file = get_attached_file( $post->ID ); $filename = esc_html( wp_basename( $file ) ); $title = esc_attr( $post->post_title ); $post_mime_types = get_post_mime_types(); $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) ); $type = reset( $keys ); $type_html = ""; $form_fields = get_attachment_fields_to_edit( $post, $parsed_args['errors'] ); if ( $parsed_args['toggle'] ) { $class = empty( $parsed_args['errors'] ) ? 'startclosed' : 'startopen'; $toggle_links = " + $toggle_on + $toggle_off"; } else { $class = ''; $toggle_links = ''; } $display_title = ( ! empty( $title ) ) ? $title : $filename; $display_title = $parsed_args['show_title'] ? "
      " . wp_html_excerpt( $display_title, 60, '…' ) . '
      ' : ''; $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) ); $order = ''; foreach ( $form_fields as $key => $val ) { if ( 'menu_order' === $key ) { if ( $gallery ) { $order = ""; } else { $order = ""; } unset( $form_fields['menu_order'] ); break; } } $media_dims = ''; $meta = wp_get_attachment_metadata( $post->ID ); if ( isset( $meta['width'], $meta['height'] ) ) { $media_dims .= "{$meta['width']} × {$meta['height']} "; } $media_dims = apply_filters( 'media_meta', $media_dims, $post ); $image_edit_button = ''; if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { $nonce = wp_create_nonce( "image_editor-$post->ID" ); $image_edit_button = " "; } $attachment_url = get_permalink( $attachment_id ); $item = " + $type_html + $toggle_links + $order + $display_title + + + + + \n"; $item .= " + + + \n + \n + \n"; $defaults = array( 'input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), ); if ( $parsed_args['send'] ) { $parsed_args['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false ); } $delete = empty( $parsed_args['delete'] ) ? '' : $parsed_args['delete']; if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { if ( ! EMPTY_TRASH_DAYS ) { $delete = "" . __( 'Delete Permanently' ) . ''; } elseif ( ! MEDIA_TRASH ) { $delete = "" . __( 'Delete' ) . " + '; } else { $delete = "" . __( 'Move to Trash' ) . " + '; } } else { $delete = ''; } $thumbnail = ''; $calling_post_id = 0; if ( isset( $_GET['post_id'] ) ) { $calling_post_id = absint( $_GET['post_id'] ); } elseif ( isset( $_POST ) && count( $_POST ) ) { $calling_post_id = $post->post_parent; } if ( 'image' === $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { $calling_post = get_post( $calling_post_id ); $calling_post_type_object = get_post_type_object( $calling_post->post_type ); $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); $thumbnail = "" . esc_html( $calling_post_type_object->labels->use_featured_image ) . ''; } if ( ( $parsed_args['send'] || $thumbnail || $delete ) && ! isset( $form_fields['buttons'] ) ) { $form_fields['buttons'] = array( 'tr' => "\t\t\n" ); } $hidden_fields = array(); foreach ( $form_fields as $id => $field ) { if ( '_' === $id[0] ) { continue; } if ( ! empty( $field['tr'] ) ) { $item .= $field['tr']; continue; } $field = array_merge( $defaults, $field ); $name = "attachments[$attachment_id][$id]"; if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } $required = $field['required'] ? '*' : ''; $required_attr = $field['required'] ? ' required' : ''; $class = $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; $extra_rows = array(); if ( ! empty( $field['errors'] ) ) { foreach ( array_unique( (array) $field['errors'] ) as $error ) { $extra_rows['error'][] = $error; } } if ( ! empty( $field['extra_rows'] ) ) { foreach ( $field['extra_rows'] as $class => $rows ) { foreach ( (array) $rows as $html ) { $extra_rows[ $class ][] = $html; } } } foreach ( $extra_rows as $class => $rows ) { foreach ( $rows as $html ) { $item .= "\t\t\n"; } } } if ( ! empty( $form_fields['_final'] ) ) { $item .= "\t\t\n"; } $item .= "\t\n"; $item .= "\t
      +

      +

      $image_edit_button

      +
      +

      " . __( 'File name:' ) . " $filename

      +

      " . __( 'File type:' ) . " $post->post_mime_type

      +

      " . __( 'Upload date:' ) . ' ' . mysql2date( __( 'F j, Y' ), $post->post_date ) . '

      '; if ( ! empty( $media_dims ) ) { $item .= '

      ' . __( 'Dimensions:' ) . " $media_dims

      \n"; } $item .= "

      " . sprintf( __( 'Required fields are marked %s' ), '*' ) . "

      " . $parsed_args['send'] . " $thumbnail $delete
      "; if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' === $id && user_can_richedit() ) { $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); } $item .= "'; } else { $item .= ""; } if ( ! empty( $field['helps'] ) ) { $item .= "

      " . implode( "

      \n

      ", array_unique( (array) $field['helps'] ) ) . '

      '; } $item .= "
      $html
      {$form_fields['_final']}
      \n"; foreach ( $hidden_fields as $name => $value ) { $item .= "\t\n"; } if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) { $parent = (int) $_REQUEST['post_id']; $parent_name = "attachments[$attachment_id][post_parent]"; $item .= "\t\n"; } return $item; } function get_compat_media_markup( $attachment_id, $args = null ) { $post = get_post( $attachment_id ); $default_args = array( 'errors' => null, 'in_modal' => false, ); $user_can_edit = current_user_can( 'edit_post', $attachment_id ); $args = wp_parse_args( $args, $default_args ); $args = apply_filters( 'get_media_item_args', $args ); $form_fields = array(); if ( $args['in_modal'] ) { foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( ! $t['public'] || ! $t['show_ui'] ) { continue; } if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $values = array(); foreach ( $terms as $term ) { $values[] = $term->slug; } $t['value'] = implode( ', ', $values ); $t['taxonomy'] = true; $form_fields[ $taxonomy ] = $t; } } $form_fields = array_merge_recursive( $form_fields, (array) $args['errors'] ); $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); $media_meta = apply_filters( 'media_meta', '', $post ); $defaults = array( 'input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), 'show_in_edit' => true, 'show_in_modal' => true, ); $hidden_fields = array(); $item = ''; foreach ( $form_fields as $id => $field ) { if ( '_' === $id[0] ) { continue; } $name = "attachments[$attachment_id][$id]"; $id_attr = "attachments-$attachment_id-$id"; if ( ! empty( $field['tr'] ) ) { $item .= $field['tr']; continue; } $field = array_merge( $defaults, $field ); if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) { continue; } if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } $readonly = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : ''; $required = $field['required'] ? '*' : ''; $required_attr = $field['required'] ? ' required' : ''; $class = 'compat-field-' . $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t"; $item .= "\t\t\t"; $item .= "\n\t\t\t"; if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' === $id && user_can_richedit() ) { $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); } $item .= "'; } else { $item .= ""; } if ( ! empty( $field['helps'] ) ) { $item .= "

      " . implode( "

      \n

      ", array_unique( (array) $field['helps'] ) ) . '

      '; } $item .= "\n\t\t\n"; $extra_rows = array(); if ( ! empty( $field['errors'] ) ) { foreach ( array_unique( (array) $field['errors'] ) as $error ) { $extra_rows['error'][] = $error; } } if ( ! empty( $field['extra_rows'] ) ) { foreach ( $field['extra_rows'] as $class => $rows ) { foreach ( (array) $rows as $html ) { $extra_rows[ $class ][] = $html; } } } foreach ( $extra_rows as $class => $rows ) { foreach ( $rows as $html ) { $item .= "\t\t$html\n"; } } } if ( ! empty( $form_fields['_final'] ) ) { $item .= "\t\t{$form_fields['_final']}\n"; } if ( $item ) { $item = '

      ' . sprintf( __( 'Required fields are marked %s' ), '*' ) . '

      ' . '' . $item . '
      '; } foreach ( $hidden_fields as $hidden_field => $value ) { $item .= '' . "\n"; } if ( $item ) { $item = '' . $item; } return array( 'item' => $item, 'meta' => $media_meta, ); } function media_upload_header() { $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; echo ''; if ( empty( $_GET['chromeless'] ) ) { echo '
      '; the_media_upload_tabs(); echo '
      '; } } function media_upload_form( $errors = null ) { global $type, $tab, $is_IE, $is_opera; if ( ! _device_can_upload() ) { echo '

      ' . sprintf( __( 'The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.' ), 'https://apps.wordpress.org/' ) . '

      '; return; } $upload_action_url = admin_url( 'async-upload.php' ); $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $_type = isset( $type ) ? $type : ''; $_tab = isset( $tab ) ? $tab : ''; $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } ?> +
      + +
      +
      + get_error_message(); } ?> +
      + $post_id, '_wpnonce' => wp_create_nonce( 'media-form' ), 'type' => $_type, 'tab' => $_tab, 'short' => '1', ); $post_params = apply_filters( 'upload_post_params', $post_params ); $plupload_init = array( 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'url' => $upload_action_url, 'filters' => array( 'max_file_size' => $max_upload_size . 'b' ), 'multipart_params' => $post_params, ); if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) { $plupload_init['multi_selection'] = false; } if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { $plupload_init['webp_upload_error'] = true; } $plupload_init = apply_filters( 'plupload_init', $plupload_init ); ?> + -.bulk-select-button { - position: relative; - display: inline-block; - padding: 0 10px; - font-size: 13px; - line-height: 2.15384615; - height: auto; - min-height: 30px; - background: #f6f7f7; - vertical-align: top; - border: 1px solid #dcdcde; - margin: 0; - cursor: pointer; - border-radius: 3px; - white-space: nowrap; - box-sizing: border-box; -} +
      + +
      +
      +

      +

      +

      +
      +
      + +
      -.bulk-selection .bulk-select-button { - color: #2271b1; - border-color: #2271b1; - background: #f6f7f7; - vertical-align: top; -} +
      + +

      + + + + +

      +
      + +
      -#pending-menu-items-to-delete { - display: none; -} +

      + +

      + +
      + + + -.bulk-selection #pending-menu-items-to-delete { - display: block; - margin-top: 1em; -} +

      -#pending-menu-items-to-delete p { - margin-bottom: 0; -} + -#pending-menu-items-to-delete ul { - margin-top: 0; - list-style: none; -} + +
      + ' . esc_html( $id->get_error_message() ) . '
      '; exit; } } ?> + -#pending-menu-items-to-delete ul li { - display: inline; -} +

      + +

      +
      + +
      + + -input.bulk-select-switcher + .bulk-select-button-label { - vertical-align: inherit; -} +

      -label.bulk-select-button:hover, -label.bulk-select-button:active, -label.bulk-select-button:focus-within { - background: #f0f0f1; - border-color: #0a4b78; - color: #0a4b78; -} + -#nav-menu-header .menu-name-label { - display: inline-block; - vertical-align: middle; - margin-right: 7px; -} +
      +
      + +
      +
      +
      + + +
      + + + + + + + | + | + +
      + + +
      + + + + + -.menu-location-title label { - font-weight: 600; -} + -.menu-location-menus select { - float: left; -} +
        + $reals ) { foreach ( $reals as $real ) { if ( isset( $num_posts[ $_type ] ) ) { $num_posts[ $_type ] += $_num_posts[ $real ]; } else { $num_posts[ $_type ] = $_num_posts[ $real ]; } } } if ( empty( $_GET['post_mime_type'] ) && ! empty( $num_posts[ $type ] ) ) { $_GET['post_mime_type'] = $type; list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); } if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) { $class = ' class="current"'; } else { $class = ''; } $type_links[] = '
      • ' . __( 'All Types' ) . ''; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; } if ( isset( $_GET['post_mime_type'] ) && wp_match_mime_types( $mime_type, $_GET['post_mime_type'] ) ) { $class = ' class="current"'; } $type_links[] = '
      • ' . sprintf( translate_nooped_plural( $label[2], $num_posts[ $mime_type ] ), '' . number_format_i18n( $num_posts[ $mime_type ] ) . '' ) . ''; } echo implode( ' |
      • ', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . ''; unset( $type_links ); ?> +
      -#locations-nav-menu-wrapper { - padding: 5px 0; -} +
      -.locations-nav-menu-select select { - float: left; - width: 160px; - margin-right: 5px; -} + add_query_arg( 'paged', '%#%' ), 'format' => '', 'prev_text' => __( '«' ), 'next_text' => __( '»' ), 'total' => ceil( $wp_query->found_posts / 10 ), 'current' => $q['paged'], ) ); if ( $page_links ) { echo "
      $page_links
      "; } ?> -.locations-row-links { - float: left; - margin: 6px 0 0 6px; -} +
      + posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; $arc_result = $wpdb->get_results( $arc_query ); $month_count = count( $arc_result ); $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> + + -.locations-edit-menu-link, -.locations-add-menu-link { - margin: 0 3px; -} + -.locations-edit-menu-link { - padding-right: 3px; - border-right: 1px solid #c3c4c7; -} +
      -#menu-management .inside { - padding: 0 10px; -} +
      +
      +
      -/* Add Menu Item Boxes */ -.postbox .howto input, -.customlinkdiv .menu-item-textbox { - width: 180px; - float: right; -} +
      + -.accordion-container .outer-border { - margin: 0; -} + -.customlinkdiv p { - margin-top: 0 -} +
      + + +
      +

      + + +

      +
      + + + + + + '; } else { $caption = ''; } $default_align = get_option( 'image_default_align' ); if ( empty( $default_align ) ) { $default_align = 'none'; } if ( 'image' === $default_view ) { $view = 'image-only'; $table_class = ''; } else { $view = 'not-image'; $table_class = $view; } return ' +

         

      +

      ' . sprintf( __( 'Required fields are marked %s' ), '*' ) . '

      + + + + + -#nav-menu-theme-locations .howto select { - width: 100%; -} + + + + -#nav-menu-theme-locations .button-controls { - text-align: right; -} + -.add-menu-item-view-all { - height: 400px; -} + + + + + ' . $caption . ' + + + + -/* Button Primary Actions */ -#menu-container .submit { - margin: 0 0 10px; - padding: 0; -} + + + + + + + + + + + + +
      + + +
      + +

      ' . __( 'Link text, e.g. “Ransom Demands (PDF)”' ) . '

      + + +

      ' . __( 'Alt text for the image, e.g. “The Mona Lisa”' ) . '

      + + + + + + + + +
      + +
      -/* @todo: is this actually used? */ -#cancel-save { - text-decoration: underline; - font-size: 12px; - margin-left: 20px; - margin-top: 5px; -} + + +

      ' . __( 'Enter a link URL or click above for presets.' ) . '

      + +
      + ' . get_submit_button( __( 'Insert into Post' ), '', 'insertonlybutton', false ) . ' +
      '; } function media_upload_flash_bypass() { $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); $post = get_post(); if ( $post ) { $browser_uploader .= '&post_id=' . (int) $post->ID; } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID']; } ?> +

      + browser uploader instead.' ), $browser_uploader, 'target="_blank"' ); ?> +

      + +

      + Switch to the multi-file uploader.' ); ?> +

      + '; $end = ''; } ?> +

      + ' . sprintf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( get_space_allowed() * MB_IN_BYTES ) ) . '

      '; } function edit_form_image_editor( $post ) { $open = isset( $_GET['image-editor'] ); if ( $open ) { require_once ABSPATH . 'wp-admin/includes/image-edit.php'; } $thumb_url = false; $attachment_id = (int) $post->ID; if ( $attachment_id ) { $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); } $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); $att_url = wp_get_attachment_url( $post->ID ); ?> +
      + ID ) ) : $image_edit_button = ''; if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { $nonce = wp_create_nonce( "image_editor-$post->ID" ); $image_edit_button = " "; } $open_style = ''; $not_open_style = ''; if ( $open ) { $open_style = ' style="display:none"'; } else { $not_open_style = ' style="display:none"'; } ?> +
      -.button.right, .button-secondary.right, .button-primary.right { - float: right; -} + class="wp_attachment_image wp-clearfix" id="media-head-"> +

      +

      +
      + class="image-editor" id="image-editor-"> + + + $att_url ) ); elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ) : wp_maybe_generate_attachment_metadata( $post ); $meta = wp_get_attachment_metadata( $attachment_id ); $w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0; $h = ! empty( $meta['height'] ) ? $meta['height'] : 0; if ( $h && $w < $meta['width'] ) { $h = round( ( $meta['height'] * $w ) / $meta['width'] ); } $attr = array( 'src' => $att_url ); if ( ! empty( $w ) && ! empty( $h ) ) { $attr['width'] = $w; $attr['height'] = $h; } $thumb_id = get_post_thumbnail_id( $attachment_id ); if ( ! empty( $thumb_id ) ) { $attr['poster'] = wp_get_attachment_url( $thumb_id ); } echo wp_video_shortcode( $attr ); elseif ( isset( $thumb_url[0] ) ) : ?> +
      +

      + +

      +
      + + +
      + post_mime_type, 0, 5 ) ) : ?> +

      +
      + +

      +

      + Learn how to describe the purpose of the image%3$s. Leave empty if the image is purely decorative.' ), esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), 'target="_blank" rel="noopener"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); ?> +

      + -/* Button Secondary Actions */ -.list-controls { - float: left; - margin-top: 5px; -} +

      +
      + +

      -.add-to-menu { - float: right; -} + 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); $editor_args = array( 'textarea_name' => 'content', 'textarea_rows' => 5, 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings, ); ?> -.button-controls { - clear: both; - margin: 10px 0; -} + + post_content ), 'attachment_content', $editor_args ); ?> -.show-all, -.hide-all { - cursor: pointer; -} +
      + ID ); echo $extras['item']; echo '' . "\n"; } function attachment_submitbox_metadata() { $post = get_post(); $attachment_id = $post->ID; $file = get_attached_file( $attachment_id ); $filename = esc_html( wp_basename( $file ) ); $media_dims = ''; $meta = wp_get_attachment_metadata( $attachment_id ); if ( isset( $meta['width'], $meta['height'] ) ) { $media_dims .= "{$meta['width']} × {$meta['height']} "; } $media_dims = apply_filters( 'media_meta', $media_dims, $post ); $att_url = wp_get_attachment_url( $attachment_id ); $author = new WP_User( $post->post_author ); $uploaded_by_name = __( '(no author)' ); $uploaded_by_link = ''; if ( $author->exists() ) { $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname; $uploaded_by_link = get_edit_user_link( $author->ID ); } ?> +
      + + + + + +
      -.hide-all { - display: none; -} + post_parent ) { $post_parent = get_post( $post->post_parent ); if ( $post_parent ) { $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); $uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' ); ?> +
      + + + + + +
      + -/* Create Menu */ -#menu-name { - width: 270px; - vertical-align: middle; -} +
      + + + + + + +
      +
      + +
      +
      + + + ID ), $matches ) ) { echo esc_html( strtoupper( $matches[1] ) ); list( $mime_type ) = explode( '/', $post->post_mime_type ); if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) { if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) { echo ' (' . $meta['mime_type'] . ')'; } } } else { echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) ); } ?> + +
      -#manage-menu .inside { - padding: 0; -} + +
      + +
      + post_mime_type ) ) { $fields = array( 'length_formatted' => __( 'Length:' ), 'bitrate' => __( 'Bitrate:' ), ); $fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post ); foreach ( $fields as $key => $label ) { if ( empty( $meta[ $key ] ) ) { continue; } ?> +
      + + + + +
      + __( 'Audio Format:' ), 'codec' => __( 'Audio Codec:' ), ); $audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post ); foreach ( $audio_fields as $key => $label ) { if ( empty( $meta['audio'][ $key ] ) ) { continue; } ?> +
      + +
      + +
      + +
      + +
      + + + + +
      + $list ) { if ( 'length' !== $key && ! empty( $list ) ) { $metadata[ $key ] = wp_kses_post( reset( $list ) ); if ( 'terms_of_use' === $key && 0 === strpos( $metadata[ $key ], 'yright notice.' ) ) { $metadata[ $key ] = 'Cop' . $metadata[ $key ]; } } } break; } } if ( ! empty( $data['id3v2']['APIC'] ) ) { $image = reset( $data['id3v2']['APIC'] ); if ( ! empty( $image['data'] ) ) { $metadata['image'] = array( 'data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height'], ); } } elseif ( ! empty( $data['comments']['picture'] ) ) { $image = reset( $data['comments']['picture'] ); if ( ! empty( $image['data'] ) ) { $metadata['image'] = array( 'data' => $image['data'], 'mime' => $image['image_mime'], ); } } } function wp_read_video_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } $metadata = array(); if ( ! defined( 'GETID3_TEMP_DIR' ) ) { define( 'GETID3_TEMP_DIR', get_temp_dir() ); } if ( ! class_exists( 'getID3', false ) ) { require ABSPATH . WPINC . '/ID3/getid3.php'; } $id3 = new getID3(); $id3->options_audiovideo_quicktime_ReturnAtomData = true; $data = $id3->analyze( $file ); if ( isset( $data['video']['lossless'] ) ) { $metadata['lossless'] = $data['video']['lossless']; } if ( ! empty( $data['video']['bitrate'] ) ) { $metadata['bitrate'] = (int) $data['video']['bitrate']; } if ( ! empty( $data['video']['bitrate_mode'] ) ) { $metadata['bitrate_mode'] = $data['video']['bitrate_mode']; } if ( ! empty( $data['filesize'] ) ) { $metadata['filesize'] = (int) $data['filesize']; } if ( ! empty( $data['mime_type'] ) ) { $metadata['mime_type'] = $data['mime_type']; } if ( ! empty( $data['playtime_seconds'] ) ) { $metadata['length'] = (int) round( $data['playtime_seconds'] ); } if ( ! empty( $data['playtime_string'] ) ) { $metadata['length_formatted'] = $data['playtime_string']; } if ( ! empty( $data['video']['resolution_x'] ) ) { $metadata['width'] = (int) $data['video']['resolution_x']; } if ( ! empty( $data['video']['resolution_y'] ) ) { $metadata['height'] = (int) $data['video']['resolution_y']; } if ( ! empty( $data['fileformat'] ) ) { $metadata['fileformat'] = $data['fileformat']; } if ( ! empty( $data['video']['dataformat'] ) ) { $metadata['dataformat'] = $data['video']['dataformat']; } if ( ! empty( $data['video']['encoder'] ) ) { $metadata['encoder'] = $data['video']['encoder']; } if ( ! empty( $data['video']['codec'] ) ) { $metadata['codec'] = $data['video']['codec']; } if ( ! empty( $data['audio'] ) ) { unset( $data['audio']['streams'] ); $metadata['audio'] = $data['audio']; } if ( empty( $metadata['created_timestamp'] ) ) { $created_timestamp = wp_get_media_creation_timestamp( $data ); if ( false !== $created_timestamp ) { $metadata['created_timestamp'] = $created_timestamp; } } wp_add_id3_tag_data( $metadata, $data ); $file_format = isset( $metadata['fileformat'] ) ? $metadata['fileformat'] : null; return apply_filters( 'wp_read_video_metadata', $metadata, $file, $file_format, $data ); } function wp_read_audio_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } $metadata = array(); if ( ! defined( 'GETID3_TEMP_DIR' ) ) { define( 'GETID3_TEMP_DIR', get_temp_dir() ); } if ( ! class_exists( 'getID3', false ) ) { require ABSPATH . WPINC . '/ID3/getid3.php'; } $id3 = new getID3(); $id3->options_audiovideo_quicktime_ReturnAtomData = true; $data = $id3->analyze( $file ); if ( ! empty( $data['audio'] ) ) { unset( $data['audio']['streams'] ); $metadata = $data['audio']; } if ( ! empty( $data['fileformat'] ) ) { $metadata['fileformat'] = $data['fileformat']; } if ( ! empty( $data['filesize'] ) ) { $metadata['filesize'] = (int) $data['filesize']; } if ( ! empty( $data['mime_type'] ) ) { $metadata['mime_type'] = $data['mime_type']; } if ( ! empty( $data['playtime_seconds'] ) ) { $metadata['length'] = (int) round( $data['playtime_seconds'] ); } if ( ! empty( $data['playtime_string'] ) ) { $metadata['length_formatted'] = $data['playtime_string']; } if ( empty( $metadata['created_timestamp'] ) ) { $created_timestamp = wp_get_media_creation_timestamp( $data ); if ( false !== $created_timestamp ) { $metadata['created_timestamp'] = $created_timestamp; } } wp_add_id3_tag_data( $metadata, $data ); return $metadata; } function wp_get_media_creation_timestamp( $metadata ) { $creation_date = false; if ( empty( $metadata['fileformat'] ) ) { return $creation_date; } switch ( $metadata['fileformat'] ) { case 'asf': if ( isset( $metadata['asf']['file_properties_object']['creation_date_unix'] ) ) { $creation_date = (int) $metadata['asf']['file_properties_object']['creation_date_unix']; } break; case 'matroska': case 'webm': if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) { $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] ); } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) { $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix']; } break; case 'quicktime': case 'mp4': if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) { $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix']; } break; } return $creation_date; } function wp_media_attach_action( $parent_id, $action = 'attach' ) { global $wpdb; if ( ! $parent_id ) { return; } if ( ! current_user_can( 'edit_post', $parent_id ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } $ids = array(); foreach ( (array) $_REQUEST['media'] as $attachment_id ) { $attachment_id = (int) $attachment_id; if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } $ids[] = $attachment_id; } if ( ! empty( $ids ) ) { $ids_string = implode( ',', $ids ); if ( 'attach' === $action ) { $result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $ids_string )", $parent_id ) ); } else { $result = $wpdb->query( "UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )" ); } } if ( isset( $result ) ) { foreach ( $ids as $attachment_id ) { do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id ); clean_attachment_cache( $attachment_id ); } $location = 'upload.php'; $referer = wp_get_referer(); if ( $referer ) { if ( false !== strpos( $referer, 'upload.php' ) ) { $location = remove_query_arg( array( 'attached', 'detach' ), $referer ); } } $key = 'attach' === $action ? 'attached' : 'detach'; $location = add_query_arg( array( $key => $result ), $location ); wp_redirect( $location ); exit; } } test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ), $this->test_wp_version_check_attached(), $this->test_filters_automatic_updater_disabled(), $this->test_wp_automatic_updates_disabled(), $this->test_if_failed_update(), $this->test_vcs_abspath(), $this->test_check_wp_filesystem_method(), $this->test_all_files_writable(), $this->test_accepts_dev_updates(), $this->test_accepts_minor_updates(), ); $tests = array_filter( $tests ); $tests = array_map( static function( $test ) { $test = (object) $test; if ( empty( $test->severity ) ) { $test->severity = 'warning'; } return $test; }, $tests ); return $tests; } public function test_constants( $constant, $value ) { $acceptable_values = (array) $value; if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) { return array( 'description' => sprintf( __( 'The %s constant is defined and enabled.' ), "$constant" ), 'severity' => 'fail', ); } } public function test_wp_version_check_attached() { if ( ( ! is_multisite() || is_main_site() && is_network_admin() ) && ! has_filter( 'wp_version_check', 'wp_version_check' ) ) { return array( 'description' => sprintf( __( 'A plugin has prevented updates by disabling %s.' ), 'wp_version_check()' ), 'severity' => 'fail', ); } } public function test_filters_automatic_updater_disabled() { if ( apply_filters( 'automatic_updater_disabled', false ) ) { return array( 'description' => sprintf( __( 'The %s filter is enabled.' ), 'automatic_updater_disabled' ), 'severity' => 'fail', ); } } public function test_wp_automatic_updates_disabled() { if ( ! class_exists( 'WP_Automatic_Updater' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; } $auto_updates = new WP_Automatic_Updater(); if ( ! $auto_updates->is_disabled() ) { return false; } return array( 'description' => __( 'All automatic updates are disabled.' ), 'severity' => 'fail', ); } public function test_if_failed_update() { $failed = get_site_option( 'auto_core_update_failed' ); if ( ! $failed ) { return false; } if ( ! empty( $failed['critical'] ) ) { $description = __( 'A previous automatic background update ended with a critical failure, so updates are now disabled.' ); $description .= ' ' . __( 'You would have received an email because of this.' ); $description .= ' ' . __( "When you've been able to update using the \"Update now\" button on Dashboard > Updates, we'll clear this error for future update attempts." ); $description .= ' ' . sprintf( __( 'The error code was %s.' ), '' . $failed['error_code'] . '' ); return array( 'description' => $description, 'severity' => 'warning', ); } $description = __( 'A previous automatic background update could not occur.' ); if ( empty( $failed['retry'] ) ) { $description .= ' ' . __( 'You would have received an email because of this.' ); } $description .= ' ' . __( "We'll try again with the next release." ); $description .= ' ' . sprintf( __( 'The error code was %s.' ), '' . $failed['error_code'] . '' ); return array( 'description' => $description, 'severity' => 'warning', ); } public function test_vcs_abspath() { $context_dirs = array( ABSPATH ); $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' ); $check_dirs = array(); foreach ( $context_dirs as $context_dir ) { do { $check_dirs[] = $context_dir; if ( dirname( $context_dir ) === $context_dir ) { break; } } while ( $context_dir = dirname( $context_dir ) ); } $check_dirs = array_unique( $check_dirs ); foreach ( $vcs_dirs as $vcs_dir ) { foreach ( $check_dirs as $check_dir ) { if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) { break 2; } } } if ( $checkout && ! apply_filters( 'automatic_updates_is_vcs_checkout', true, ABSPATH ) ) { return array( 'description' => sprintf( __( 'The folder %1$s was detected as being under version control (%2$s), but the %3$s filter is allowing updates.' ), '' . $check_dir . '', "$vcs_dir", 'automatic_updates_is_vcs_checkout' ), 'severity' => 'info', ); } if ( $checkout ) { return array( 'description' => sprintf( __( 'The folder %1$s was detected as being under version control (%2$s).' ), '' . $check_dir . '', "$vcs_dir" ), 'severity' => 'warning', ); } return array( 'description' => __( 'No version control systems were detected.' ), 'severity' => 'pass', ); } public function test_check_wp_filesystem_method() { if ( ! function_exists( 'request_filesystem_credentials' ) ) { require_once ABSPATH . '/wp-admin/includes/file.php'; } $skin = new Automatic_Upgrader_Skin; $success = $skin->request_filesystem_credentials( false, ABSPATH ); if ( ! $success ) { $description = __( 'Your installation of WordPress prompts for FTP credentials to perform updates.' ); $description .= ' ' . __( '(Your site is performing updates over FTP due to file ownership. Talk to your hosting company.)' ); return array( 'description' => $description, 'severity' => 'fail', ); } return array( 'description' => __( 'Your installation of WordPress does not require FTP credentials to perform updates.' ), 'severity' => 'pass', ); } public function test_all_files_writable() { global $wp_filesystem; require ABSPATH . WPINC . '/version.php'; $skin = new Automatic_Upgrader_Skin; $success = $skin->request_filesystem_credentials( false, ABSPATH ); if ( ! $success ) { return false; } WP_Filesystem(); if ( 'direct' !== $wp_filesystem->method ) { return false; } if ( ! function_exists( 'get_core_checksums' ) ) { require_once ABSPATH . '/wp-admin/includes/update.php'; } $checksums = get_core_checksums( $wp_version, 'en_US' ); $dev = ( false !== strpos( $wp_version, '-' ) ); if ( ! $checksums && $dev ) { $checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' ); } if ( ! $checksums && $dev ) { return false; } if ( ! $checksums ) { $description = sprintf( __( "Couldn't retrieve a list of the checksums for WordPress %s." ), $wp_version ); $description .= ' ' . __( 'This could mean that connections are failing to WordPress.org.' ); return array( 'description' => $description, 'severity' => 'warning', ); } $unwritable_files = array(); foreach ( array_keys( $checksums ) as $file ) { if ( 'wp-content' === substr( $file, 0, 10 ) ) { continue; } if ( ! file_exists( ABSPATH . $file ) ) { continue; } if ( ! is_writable( ABSPATH . $file ) ) { $unwritable_files[] = $file; } } if ( $unwritable_files ) { if ( count( $unwritable_files ) > 20 ) { $unwritable_files = array_slice( $unwritable_files, 0, 20 ); $unwritable_files[] = '...'; } return array( 'description' => __( 'Some files are not writable by WordPress:' ) . '
      • ' . implode( '
      • ', $unwritable_files ) . '
      ', 'severity' => 'fail', ); } else { return array( 'description' => __( 'All of your WordPress files are writable.' ), 'severity' => 'pass', ); } } public function test_accepts_dev_updates() { require ABSPATH . WPINC . '/version.php'; if ( false === strpos( $wp_version, '-' ) ) { return false; } if ( defined( 'WP_AUTO_UPDATE_CORE' ) && ( 'minor' === WP_AUTO_UPDATE_CORE || false === WP_AUTO_UPDATE_CORE ) ) { return array( 'description' => sprintf( __( 'WordPress development updates are blocked by the %s constant.' ), 'WP_AUTO_UPDATE_CORE' ), 'severity' => 'fail', ); } if ( ! apply_filters( 'allow_dev_auto_core_updates', $wp_version ) ) { return array( 'description' => sprintf( __( 'WordPress development updates are blocked by the %s filter.' ), 'allow_dev_auto_core_updates' ), 'severity' => 'fail', ); } } public function test_accepts_minor_updates() { if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) { return array( 'description' => sprintf( __( 'WordPress security and maintenance releases are blocked by %s.' ), "define( 'WP_AUTO_UPDATE_CORE', false );" ), 'severity' => 'fail', ); } if ( ! apply_filters( 'allow_minor_auto_core_updates', true ) ) { return array( 'description' => sprintf( __( 'WordPress security and maintenance releases are blocked by the %s filter.' ), 'allow_minor_auto_core_updates' ), 'severity' => 'fail', ); } } } '', 'singular' => '', 'ajax' => false, 'screen' => null, ) ); $this->screen = convert_to_screen( $args['screen'] ); add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 ); if ( ! $args['plural'] ) { $args['plural'] = $this->screen->base; } $args['plural'] = sanitize_key( $args['plural'] ); $args['singular'] = sanitize_key( $args['singular'] ); $this->_args = $args; if ( $args['ajax'] ) { add_action( 'admin_footer', array( $this, '_js_vars' ) ); } if ( empty( $this->modes ) ) { $this->modes = array( 'list' => __( 'Compact view' ), 'excerpt' => __( 'Extended view' ), ); } } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } return false; } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; } public function ajax_user_can() { die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' ); } public function prepare_items() { die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' ); } protected function set_pagination_args( $args ) { $args = wp_parse_args( $args, array( 'total_items' => 0, 'total_pages' => 0, 'per_page' => 0, ) ); if ( ! $args['total_pages'] && $args['per_page'] > 0 ) { $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] ); } if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); exit; } $this->_pagination_args = $args; } public function get_pagination_arg( $key ) { if ( 'page' === $key ) { return $this->get_pagenum(); } if ( isset( $this->_pagination_args[ $key ] ) ) { return $this->_pagination_args[ $key ]; } return 0; } public function has_items() { return ! empty( $this->items ); } public function no_items() { _e( 'No items found.' ); } public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { return; } $input_id = $input_id . '-search-input'; if ( ! empty( $_REQUEST['orderby'] ) ) { echo ''; } if ( ! empty( $_REQUEST['order'] ) ) { echo ''; } if ( ! empty( $_REQUEST['post_mime_type'] ) ) { echo ''; } if ( ! empty( $_REQUEST['detached'] ) ) { echo ''; } ?> + + get_views(); $views = apply_filters( "views_{$this->screen->id}", $views ); if ( empty( $views ) ) { return; } $this->screen->render_screen_reader_content( 'heading_views' ); echo "
        \n"; foreach ( $views as $class => $view ) { $views[ $class ] = "\t
      • $view"; } echo implode( " |
      • \n", $views ) . "\n"; echo '
      '; } protected function get_bulk_actions() { return array(); } protected function bulk_actions( $which = '' ) { if ( is_null( $this->_actions ) ) { $this->_actions = $this->get_bulk_actions(); $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); $two = ''; } else { $two = '2'; } if ( empty( $this->_actions ) ) { return; } echo ''; echo '\n"; submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) ); echo "\n"; } public function current_action() { if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) { return false; } if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) { return $_REQUEST['action']; } return false; } protected function row_actions( $actions, $always_visible = false ) { $action_count = count( $actions ); if ( ! $action_count ) { return ''; } $mode = get_user_setting( 'posts_list_mode', 'list' ); if ( 'excerpt' === $mode ) { $always_visible = true; } $out = '
      '; $i = 0; foreach ( $actions as $action => $link ) { ++$i; $sep = ( $i < $action_count ) ? ' | ' : ''; $out .= "$link$sep"; } $out .= '
      '; $out .= ''; return $out; } protected function months_dropdown( $post_type ) { global $wpdb, $wp_locale; if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) { return; } $months = apply_filters( 'pre_months_dropdown_query', false, $post_type ); if ( ! is_array( $months ) ) { $extra_checks = "AND post_status != 'auto-draft'"; if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) { $extra_checks .= " AND post_status != 'trash'"; } elseif ( isset( $_GET['post_status'] ) ) { $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] ); } $months = $wpdb->get_results( $wpdb->prepare( " + SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month + FROM $wpdb->posts + WHERE post_type = %s + $extra_checks + ORDER BY post_date DESC + ", $post_type ) ); } $months = apply_filters( 'months_dropdown_results', $months, $post_type ); $month_count = count( $months ); if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) { return; } $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; ?> + + + + +
      + modes as $mode => $title ) { $classes = array( 'view-' . $mode ); $aria_current = ''; if ( $current_mode === $mode ) { $classes[] = 'current'; $aria_current = ' aria-current="page"'; } printf( "%s\n", esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ), implode( ' ', $classes ), $title ); } ?> +
      +
      %s', __( 'No comments' ) ); } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) { printf( '%s', $approved_comments_number, $pending_comments ? $approved_phrase : $approved_only_phrase ); } elseif ( $approved_comments ) { printf( '%s', esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'approved', ), admin_url( 'edit-comments.php' ) ) ), $approved_comments_number, $pending_comments ? $approved_phrase : $approved_only_phrase ); } else { printf( '%s', $approved_comments_number, $pending_comments ? __( 'No approved comments' ) : __( 'No comments' ) ); } if ( $pending_comments ) { printf( '%s', esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'moderated', ), admin_url( 'edit-comments.php' ) ) ), $pending_comments_number, $pending_phrase ); } else { printf( '%s', $pending_comments_number, $approved_comments ? __( 'No pending comments' ) : __( 'No comments' ) ); } } public function get_pagenum() { $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) { $pagenum = $this->_pagination_args['total_pages']; } return max( 1, $pagenum ); } protected function get_items_per_page( $option, $default_value = 20 ) { $per_page = (int) get_user_option( $option ); if ( empty( $per_page ) || $per_page < 1 ) { $per_page = $default_value; } return (int) apply_filters( "{$option}", $per_page ); } protected function pagination( $which ) { if ( empty( $this->_pagination_args ) ) { return; } $total_items = $this->_pagination_args['total_items']; $total_pages = $this->_pagination_args['total_pages']; $infinite_scroll = false; if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { $infinite_scroll = $this->_pagination_args['infinite_scroll']; } if ( 'top' === $which && $total_pages > 1 ) { $this->screen->render_screen_reader_content( 'heading_pagination' ); } $output = '' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . ''; $current = $this->get_pagenum(); $removable_query_args = wp_removable_query_args(); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = remove_query_arg( $removable_query_args, $current_url ); $page_links = array(); $total_pages_before = ''; $total_pages_after = ''; $disable_first = false; $disable_last = false; $disable_prev = false; $disable_next = false; if ( 1 == $current ) { $disable_first = true; $disable_prev = true; } if ( $total_pages == $current ) { $disable_last = true; $disable_next = true; } if ( $disable_first ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( remove_query_arg( 'paged', $current_url ) ), __( 'First page' ), '«' ); } if ( $disable_prev ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ), __( 'Previous page' ), '‹' ); } if ( 'bottom' === $which ) { $html_current_page = $current; $total_pages_before = '' . __( 'Current Page' ) . ''; } else { $html_current_page = sprintf( "%s", '', $current, strlen( $total_pages ) ); } $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after; if ( $disable_next ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ), __( 'Next page' ), '›' ); } if ( $disable_last ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), __( 'Last page' ), '»' ); } $pagination_links_class = 'pagination-links'; if ( ! empty( $infinite_scroll ) ) { $pagination_links_class .= ' hide-if-js'; } $output .= "\n" . implode( "\n", $page_links ) . ''; if ( $total_pages ) { $page_class = $total_pages < 2 ? ' one-page' : ''; } else { $page_class = ' no-pages'; } $this->_pagination = "
      $output
      "; echo $this->_pagination; } public function get_columns() { die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' ); } protected function get_sortable_columns() { return array(); } protected function get_default_primary_column_name() { $columns = $this->get_columns(); $column = ''; if ( empty( $columns ) ) { return $column; } foreach ( $columns as $col => $column_name ) { if ( 'cb' === $col ) { continue; } $column = $col; break; } return $column; } public function get_primary_column() { return $this->get_primary_column_name(); } protected function get_primary_column_name() { $columns = get_column_headers( $this->screen ); $default = $this->get_default_primary_column_name(); if ( ! isset( $columns[ $default ] ) ) { $default = self::get_default_primary_column_name(); } $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { $column = $default; } return $column; } protected function get_column_info() { if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) { $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); foreach ( $this->_column_headers as $key => $value ) { $column_headers[ $key ] = $value; } return $column_headers; } $columns = get_column_headers( $this->screen ); $hidden = get_hidden_columns( $this->screen ); $sortable_columns = $this->get_sortable_columns(); $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns ); $sortable = array(); foreach ( $_sortable as $id => $data ) { if ( empty( $data ) ) { continue; } $data = (array) $data; if ( ! isset( $data[1] ) ) { $data[1] = false; } $sortable[ $id ] = $data; } $primary = $this->get_primary_column_name(); $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); return $this->_column_headers; } public function get_column_count() { list ( $columns, $hidden ) = $this->get_column_info(); $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); return count( $columns ) - count( $hidden ); } public function print_column_headers( $with_id = true ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = remove_query_arg( 'paged', $current_url ); if ( isset( $_GET['orderby'] ) ) { $current_orderby = $_GET['orderby']; } else { $current_orderby = ''; } if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { $current_order = 'desc'; } else { $current_order = 'asc'; } if ( ! empty( $columns['cb'] ) ) { static $cb_counter = 1; $columns['cb'] = '' . ''; $cb_counter++; } foreach ( $columns as $column_key => $column_display_name ) { $class = array( 'manage-column', "column-$column_key" ); if ( in_array( $column_key, $hidden, true ) ) { $class[] = 'hidden'; } if ( 'cb' === $column_key ) { $class[] = 'check-column'; } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) { $class[] = 'num'; } if ( $column_key === $primary ) { $class[] = 'column-primary'; } if ( isset( $sortable[ $column_key ] ) ) { list( $orderby, $desc_first ) = $sortable[ $column_key ]; if ( $current_orderby === $orderby ) { $order = 'asc' === $current_order ? 'desc' : 'asc'; $class[] = 'sorted'; $class[] = $current_order; } else { $order = strtolower( $desc_first ); if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) { $order = $desc_first ? 'desc' : 'asc'; } $class[] = 'sortable'; $class[] = 'desc' === $order ? 'asc' : 'desc'; } $column_display_name = sprintf( '%s', esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ), $column_display_name ); } $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; $id = $with_id ? "id='$column_key'" : ''; if ( ! empty( $class ) ) { $class = "class='" . implode( ' ', $class ) . "'"; } echo "<$tag $scope $id $class>$column_display_name"; } } public function display() { $singular = $this->_args['singular']; $this->display_tablenav( 'top' ); $this->screen->render_screen_reader_content( 'heading_list' ); ?> + + + + print_column_headers(); ?> + + -/* Custom Links */ -#available-links dt { - display: block; -} + + > + display_rows_or_placeholder(); ?> + -#add-custom-link .howto { - font-size: 12px; -} + + + print_column_headers( false ); ?> + + -#add-custom-link label span { - display: block; - float: left; - margin-top: 5px; - padding-right: 5px; -} +
      + display_tablenav( 'bottom' ); } protected function get_table_classes() { $mode = get_user_setting( 'posts_list_mode', 'list' ); $mode_class = esc_attr( 'table-view-' . $mode ); return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] ); } protected function display_tablenav( $which ) { if ( 'top' === $which ) { wp_nonce_field( 'bulk-' . $this->_args['plural'] ); } ?> +
      -.menu-item-textbox { - width: 180px; -} + has_items() ) : ?> +
      + bulk_actions( $which ); ?> +
      + extra_tablenav( $which ); $this->pagination( $which ); ?> -.customlinkdiv label, -.nav-menus-php .howto span { - float: left; - margin-top: 6px; -} +
      +
      + has_items() ) { $this->display_rows(); } else { echo ''; $this->no_items(); echo ''; } } public function display_rows() { foreach ( $this->items as $item ) { $this->single_row( $item ); } } public function single_row( $item ) { echo ''; $this->single_row_columns( $item ); echo ''; } protected function column_default( $item, $column_name ) {} protected function column_cb( $item ) {} protected function single_row_columns( $item ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $classes = "$column_name column-$column_name"; if ( $primary === $column_name ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"'; $attributes = "class='$classes' $data"; if ( 'cb' === $column_name ) { echo ''; echo $this->column_cb( $item ); echo ''; } elseif ( method_exists( $this, '_column_' . $column_name ) ) { echo call_user_func( array( $this, '_column_' . $column_name ), $item, $classes, $data, $primary ); } elseif ( method_exists( $this, 'column_' . $column_name ) ) { echo ""; echo call_user_func( array( $this, 'column_' . $column_name ), $item ); echo $this->handle_row_actions( $item, $column_name, $primary ); echo ''; } else { echo ""; echo $this->column_default( $item, $column_name ); echo $this->handle_row_actions( $item, $column_name, $primary ); echo ''; } } } protected function handle_row_actions( $item, $column_name, $primary ) { return $column_name === $primary ? '' : ''; } public function ajax_response() { $this->prepare_items(); ob_start(); if ( ! empty( $_REQUEST['no_placeholder'] ) ) { $this->display_rows(); } else { $this->display_rows_or_placeholder(); } $rows = ob_get_clean(); $response = array( 'rows' => $rows ); if ( isset( $this->_pagination_args['total_items'] ) ) { $response['total_items_i18n'] = sprintf( _n( '%s item', '%s items', $this->_pagination_args['total_items'] ), number_format_i18n( $this->_pagination_args['total_items'] ) ); } if ( isset( $this->_pagination_args['total_pages'] ) ) { $response['total_pages'] = $this->_pagination_args['total_pages']; $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] ); } die( wp_json_encode( $response ) ); } public function _js_vars() { $args = array( 'class' => get_class( $this ), 'screen' => array( 'id' => $this->screen->id, 'base' => $this->screen->base, ), ); printf( "\n", wp_json_encode( $args ) ); } } $text ) { $instructions[ $line ] = '# ' . $text; } $instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker ); if ( $switched_locale ) { restore_previous_locale(); } $insertion = array_merge( $instructions, $insertion ); $start_marker = "# BEGIN {$marker}"; $end_marker = "# END {$marker}"; $fp = fopen( $filename, 'r+' ); if ( ! $fp ) { return false; } flock( $fp, LOCK_EX ); $lines = array(); while ( ! feof( $fp ) ) { $lines[] = rtrim( fgets( $fp ), "\r\n" ); } $pre_lines = array(); $post_lines = array(); $existing_lines = array(); $found_marker = false; $found_end_marker = false; foreach ( $lines as $line ) { if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) { $found_marker = true; continue; } elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) { $found_end_marker = true; continue; } if ( ! $found_marker ) { $pre_lines[] = $line; } elseif ( $found_marker && $found_end_marker ) { $post_lines[] = $line; } else { $existing_lines[] = $line; } } if ( $existing_lines === $insertion ) { flock( $fp, LOCK_UN ); fclose( $fp ); return true; } $new_file_data = implode( "\n", array_merge( $pre_lines, array( $start_marker ), $insertion, array( $end_marker ), $post_lines ) ); fseek( $fp, 0 ); $bytes = fwrite( $fp, $new_file_data ); if ( $bytes ) { ftruncate( $fp, ftell( $fp ) ); } fflush( $fp ); flock( $fp, LOCK_UN ); fclose( $fp ); return (bool) $bytes; } function save_mod_rewrite_rules() { global $wp_rewrite; if ( is_multisite() ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $home_path = get_home_path(); $htaccess_file = $home_path . '.htaccess'; if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable( $htaccess_file ) ) { if ( got_mod_rewrite() ) { $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); return insert_with_markers( $htaccess_file, 'WordPress', $rules ); } } return false; } function iis7_save_url_rewrite_rules() { global $wp_rewrite; if ( is_multisite() ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $home_path = get_home_path(); $web_config_file = $home_path . 'web.config'; if ( iis7_supports_permalinks() && ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || win_is_writable( $web_config_file ) ) ) { $rule = $wp_rewrite->iis7_url_rewrite_rules( false ); if ( ! empty( $rule ) ) { return iis7_add_rewrite_rule( $web_config_file, $rule ); } else { return iis7_delete_rewrite_rule( $web_config_file ); } } return false; } function update_recently_edited( $file ) { $oldfiles = (array) get_option( 'recently_edited' ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $oldfiles = array_reverse( $oldfiles ); $oldfiles = array_unique( $oldfiles ); if ( 5 < count( $oldfiles ) ) { array_pop( $oldfiles ); } } else { $oldfiles[] = $file; } update_option( 'recently_edited', $oldfiles ); } function wp_make_theme_file_tree( $allowed_files ) { $tree_list = array(); foreach ( $allowed_files as $file_name => $absolute_filename ) { $list = explode( '/', $file_name ); $last_dir = &$tree_list; foreach ( $list as $dir ) { $last_dir =& $last_dir[ $dir ]; } $last_dir = $file_name; } return $tree_list; } function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) { global $relative_file, $stylesheet; if ( is_array( $tree ) ) { $index = 0; $size = count( $tree ); foreach ( $tree as $label => $theme_file ) : $index++; if ( ! is_array( $theme_file ) ) { wp_print_theme_file_tree( $theme_file, $level, $index, $size ); continue; } ?> +
    • + +
      +
    • + rawurlencode( $tree ), 'theme' => rawurlencode( $stylesheet ), ), self_admin_url( 'theme-editor.php' ) ); ?> +
    • + + (' . esc_html( $filename ) . ')'; } if ( $relative_file === $filename ) { echo '' . $file_description . ''; } else { echo $file_description; } ?> + +
    • + $plugin_file ) : $index++; if ( ! is_array( $plugin_file ) ) { wp_print_plugin_file_tree( $plugin_file, $label, $level, $index, $size ); continue; } ?> +
    • + +
      +
    • + rawurlencode( $tree ), 'plugin' => rawurlencode( $plugin ), ), self_admin_url( 'plugin-editor.php' ) ); ?> +
    • + + ' . esc_html( $label ) . ''; } else { echo esc_html( $label ); } ?> + +
    • + get_error_data() && is_string( $message->get_error_data() ) ) { $message = $message->get_error_message() . ': ' . $message->get_error_data(); } else { $message = $message->get_error_message(); } } echo "

      $message

      \n"; wp_ob_end_flush_all(); flush(); } function wp_doc_link_parse( $content ) { if ( ! is_string( $content ) || empty( $content ) ) { return array(); } if ( ! function_exists( 'token_get_all' ) ) { return array(); } $tokens = token_get_all( $content ); $count = count( $tokens ); $functions = array(); $ignore_functions = array(); for ( $t = 0; $t < $count - 2; $t++ ) { if ( ! is_array( $tokens[ $t ] ) ) { continue; } if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) { if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR === $tokens[ $t - 1 ][0] ) ) { $ignore_functions[] = $tokens[ $t ][1]; } $functions[] = $tokens[ $t ][1]; } } $functions = array_unique( $functions ); sort( $functions ); $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); $ignore_functions = array_unique( $ignore_functions ); $out = array(); foreach ( $functions as $function ) { if ( in_array( $function, $ignore_functions, true ) ) { continue; } $out[] = $function; } return $out; } function set_screen_options() { if ( ! isset( $_POST['wp_screen_options'] ) || ! is_array( $_POST['wp_screen_options'] ) ) { return; } check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); $user = wp_get_current_user(); if ( ! $user ) { return; } $option = $_POST['wp_screen_options']['option']; $value = $_POST['wp_screen_options']['value']; if ( sanitize_key( $option ) !== $option ) { return; } $map_option = $option; $type = str_replace( 'edit_', '', $map_option ); $type = str_replace( '_per_page', '', $type ); if ( in_array( $type, get_taxonomies(), true ) ) { $map_option = 'edit_tags_per_page'; } elseif ( in_array( $type, get_post_types(), true ) ) { $map_option = 'edit_per_page'; } else { $option = str_replace( '-', '_', $option ); } switch ( $map_option ) { case 'edit_per_page': case 'users_per_page': case 'edit_comments_per_page': case 'upload_per_page': case 'edit_tags_per_page': case 'plugins_per_page': case 'export_personal_data_requests_per_page': case 'remove_personal_data_requests_per_page': case 'sites_network_per_page': case 'users_network_per_page': case 'site_users_network_per_page': case 'plugins_network_per_page': case 'themes_network_per_page': case 'site_themes_network_per_page': $value = (int) $value; if ( $value < 1 || $value > 999 ) { return; } break; default: $screen_option = false; if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) { $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); } $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value ); if ( false === $value ) { return; } break; } update_user_meta( $user->ID, $option, $value ); $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() ); if ( isset( $_POST['mode'] ) ) { $url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url ); } wp_safe_redirect( $url ); exit; } function iis7_rewrite_rule_exists( $filename ) { if ( ! file_exists( $filename ) ) { return false; } if ( ! class_exists( 'DOMDocument', false ) ) { return false; } $doc = new DOMDocument(); if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( 0 === $rules->length ) { return false; } return true; } function iis7_delete_rewrite_rule( $filename ) { if ( ! file_exists( $filename ) ) { return true; } if ( ! class_exists( 'DOMDocument', false ) ) { return false; } $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( $rules->length > 0 ) { $child = $rules->item( 0 ); $parent = $child->parentNode; $parent->removeChild( $child ); $doc->formatOutput = true; saveDomDocument( $doc, $filename ); } return true; } function iis7_add_rewrite_rule( $filename, $rewrite_rule ) { if ( ! class_exists( 'DOMDocument', false ) ) { return false; } if ( ! file_exists( $filename ) ) { $fp = fopen( $filename, 'w' ); fwrite( $fp, '' ); fclose( $fp ); } $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( $wordpress_rules->length > 0 ) { return true; } $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' ); if ( $xml_nodes->length > 0 ) { $rules_node = $xml_nodes->item( 0 ); } else { $rules_node = $doc->createElement( 'rules' ); $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' ); if ( $xml_nodes->length > 0 ) { $rewrite_node = $xml_nodes->item( 0 ); $rewrite_node->appendChild( $rules_node ); } else { $rewrite_node = $doc->createElement( 'rewrite' ); $rewrite_node->appendChild( $rules_node ); $xml_nodes = $xpath->query( '/configuration/system.webServer' ); if ( $xml_nodes->length > 0 ) { $system_web_server_node = $xml_nodes->item( 0 ); $system_web_server_node->appendChild( $rewrite_node ); } else { $system_web_server_node = $doc->createElement( 'system.webServer' ); $system_web_server_node->appendChild( $rewrite_node ); $xml_nodes = $xpath->query( '/configuration' ); if ( $xml_nodes->length > 0 ) { $config_node = $xml_nodes->item( 0 ); $config_node->appendChild( $system_web_server_node ); } else { $config_node = $doc->createElement( 'configuration' ); $doc->appendChild( $config_node ); $config_node->appendChild( $system_web_server_node ); } } } } $rule_fragment = $doc->createDocumentFragment(); $rule_fragment->appendXML( $rewrite_rule ); $rules_node->appendChild( $rule_fragment ); $doc->encoding = 'UTF-8'; $doc->formatOutput = true; saveDomDocument( $doc, $filename ); return true; } function saveDomDocument( $doc, $filename ) { $config = $doc->saveXML(); $config = preg_replace( "/([^\r])\n/", "$1\r\n", $config ); $fp = fopen( $filename, 'w' ); fwrite( $fp, $config ); fclose( $fp ); } function admin_color_scheme_picker( $user_id ) { global $_wp_admin_css_colors; ksort( $_wp_admin_css_colors ); if ( isset( $_wp_admin_css_colors['fresh'] ) ) { $_wp_admin_css_colors = array_filter( array_merge( array( 'fresh' => '', 'light' => '', 'modern' => '', ), $_wp_admin_css_colors ) ); } $current_color = get_user_option( 'admin_color', $user_id ); if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) { $current_color = 'fresh'; } ?> +
      + + $color_info ) : ?> +
      + /> + + + + + + colors as $html_color ) { ?> + + + +
       
      +
      + +
      + icon_colors ) ) { $icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors; } elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) { $icon_colors = $_wp_admin_css_colors['fresh']->icon_colors; } else { $icon_colors = array( 'base' => '#a7aaad', 'focus' => '#72aee6', 'current' => '#fff', ); } echo '\n"; } function wp_admin_viewport_meta() { $viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' ); if ( empty( $viewport_meta ) ) { return; } echo ''; } function _customizer_mobile_viewport_meta( $viewport_meta ) { return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2'; } function wp_check_locked_posts( $response, $data, $screen_id ) { $checked = array(); if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { foreach ( $data['wp-check-locked-posts'] as $key ) { $post_id = absint( substr( $key, 5 ) ); if ( ! $post_id ) { continue; } $user_id = wp_check_post_lock( $post_id ); if ( $user_id ) { $user = get_userdata( $user_id ); if ( $user && current_user_can( 'edit_post', $post_id ) ) { $send = array( 'name' => $user->display_name, 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ), ); if ( get_option( 'show_avatars' ) ) { $send['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 18 ) ); $send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) ); } $checked[ $key ] = $send; } } } } if ( ! empty( $checked ) ) { $response['wp-check-locked-posts'] = $checked; } return $response; } function wp_refresh_post_lock( $response, $data, $screen_id ) { if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) { $received = $data['wp-refresh-post-lock']; $send = array(); $post_id = absint( $received['post_id'] ); if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $user_id = wp_check_post_lock( $post_id ); $user = get_userdata( $user_id ); if ( $user ) { $error = array( 'name' => $user->display_name, 'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ), ); if ( get_option( 'show_avatars' ) ) { $error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) ); $error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) ); } $send['lock_error'] = $error; } else { $new_lock = wp_set_post_lock( $post_id ); if ( $new_lock ) { $send['new_lock'] = implode( ':', $new_lock ); } } $response['wp-refresh-post-lock'] = $send; } return $response; } function wp_refresh_post_nonces( $response, $data, $screen_id ) { if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) { $received = $data['wp-refresh-post-nonces']; $response['wp-refresh-post-nonces'] = array( 'check' => 1 ); $post_id = absint( $received['post_id'] ); if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $response['wp-refresh-post-nonces'] = array( 'replace' => array( 'getpermalinknonce' => wp_create_nonce( 'getpermalink' ), 'samplepermalinknonce' => wp_create_nonce( 'samplepermalink' ), 'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ), '_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ), '_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ), ), ); } return $response; } function wp_refresh_heartbeat_nonces( $response ) { $response['rest_nonce'] = wp_create_nonce( 'wp_rest' ); $response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' ); return $response; } function wp_heartbeat_set_suspension( $settings ) { global $pagenow; if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) { $settings['suspension'] = 'disable'; } return $settings; } function heartbeat_autosave( $response, $data ) { if ( ! empty( $data['wp_autosave'] ) ) { $saved = wp_autosave( $data['wp_autosave'] ); if ( is_wp_error( $saved ) ) { $response['wp_autosave'] = array( 'success' => false, 'message' => $saved->get_error_message(), ); } elseif ( empty( $saved ) ) { $response['wp_autosave'] = array( 'success' => false, 'message' => __( 'Error while saving.' ), ); } else { $draft_saved_date_format = __( 'g:i:s a' ); $response['wp_autosave'] = array( 'success' => true, 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ), ); } } return $response; } function wp_admin_canonical_url() { $removable_query_args = wp_removable_query_args(); if ( empty( $removable_query_args ) ) { return; } $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $filtered_url = remove_query_arg( $removable_query_args, $current_url ); ?> + + + + + $hash, 'newemail' => $value, ); update_option( 'adminhash', $new_admin_email ); $switched_locale = switch_to_locale( get_user_locale() ); $email_text = __( 'Howdy ###USERNAME###, -/* Menu item types */ -.quick-search { - width: 190px; -} +Someone with administrator capabilities recently requested to have the +administration email address changed on this site: +###SITEURL### -.quick-search-wrap .spinner { - float: none; - margin: -3px -10px 0 0; -} +To confirm this change, please click on the following link: +###ADMIN_URL### -.nav-menus-php .list-wrap { - display: none; - clear: both; - margin-bottom: 10px; -} +You can safely ignore and delete this email if you do not want to +take this action. -.nav-menus-php .postbox p.submit { - margin-bottom: 0; -} +This email has been sent to ###EMAIL### -/* Listings */ -.nav-menus-php .list li { - display: none; - margin: 0 0 5px; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); $current_user = wp_get_current_user(); $content = str_replace( '###USERNAME###', $current_user->user_login, $content ); $content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content ); $content = str_replace( '###EMAIL###', $value, $content ); $content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content ); $content = str_replace( '###SITEURL###', home_url(), $content ); if ( '' !== get_option( 'blogname' ) ) { $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); } wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), $site_title ), $content ); if ( $switched_locale ) { restore_previous_locale(); } } function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) { if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) { $title = sprintf( __( '%s (Draft)' ), $title ); } return $title; } function wp_check_php_version() { $version = phpversion(); $key = md5( $version ); $response = get_site_transient( 'php_check_' . $key ); if ( false === $response ) { $url = 'http://api.wordpress.org/core/serve-happy/1.0/'; if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $url = add_query_arg( 'php_version', $version, $url ); $response = wp_remote_get( $url ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $response = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $response ) ) { return false; } set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS ); } if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) { $response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version ); } return $response; } options['context'] = $context; } ob_start(); $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership ); ob_end_clean(); return $result; } public function get_upgrade_messages() { return $this->messages; } public function feedback( $feedback, ...$args ) { if ( is_wp_error( $feedback ) ) { $string = $feedback->get_error_message(); } elseif ( is_array( $feedback ) ) { return; } else { $string = $feedback; } if ( ! empty( $this->upgrader->strings[ $string ] ) ) { $string = $this->upgrader->strings[ $string ]; } if ( strpos( $string, '%' ) !== false ) { if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } $string = trim( $string ); $string = wp_kses( $string, array( 'a' => array( 'href' => true, ), 'br' => true, 'em' => true, 'strong' => true, ) ); if ( empty( $string ) ) { return; } $this->messages[] = $string; } public function header() { ob_start(); } public function footer() { $output = ob_get_clean(); if ( ! empty( $output ) ) { $this->feedback( $output ); } } } method = 'ftpext'; $this->errors = new WP_Error(); if ( ! extension_loaded( 'ftp' ) ) { $this->errors->add( 'no_ftp_ext', __( 'The ftp PHP extension is not available' ) ); return; } if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 240 ); } if ( empty( $opt['port'] ) ) { $this->options['port'] = 21; } else { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); } else { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { $this->errors->add( 'empty_password', __( 'FTP password is required' ) ); } else { $this->options['password'] = $opt['password']; } $this->options['ssl'] = false; if ( isset( $opt['connection_type'] ) && 'ftps' === $opt['connection_type'] ) { $this->options['ssl'] = true; } } public function connect() { if ( isset( $this->options['ssl'] ) && $this->options['ssl'] && function_exists( 'ftp_ssl_connect' ) ) { $this->link = @ftp_ssl_connect( $this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT ); } else { $this->link = @ftp_connect( $this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT ); } if ( ! $this->link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! @ftp_login( $this->link, $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } ftp_pasv( $this->link, true ); if ( @ftp_get_option( $this->link, FTP_TIMEOUT_SEC ) < FS_TIMEOUT ) { @ftp_set_option( $this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT ); } return true; } public function get_contents( $file ) { $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } if ( ! ftp_fget( $this->link, $temphandle, $file, FTP_BINARY ) ) { fclose( $temphandle ); unlink( $tempfile ); return false; } fseek( $temphandle, 0 ); $contents = ''; while ( ! feof( $temphandle ) ) { $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); } fclose( $temphandle ); unlink( $tempfile ); return $contents; } public function get_contents_array( $file ) { return explode( "\n", $this->get_contents( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'wb+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); $data_length = strlen( $contents ); $bytes_written = fwrite( $temphandle, $contents ); reset_mbstring_encoding(); if ( $data_length !== $bytes_written ) { fclose( $temphandle ); unlink( $tempfile ); return false; } fseek( $temphandle, 0 ); $ret = ftp_fput( $this->link, $file, $temphandle, FTP_BINARY ); fclose( $temphandle ); unlink( $tempfile ); $this->chmod( $file, $mode ); return $ret; } public function cwd() { $cwd = ftp_pwd( $this->link ); if ( $cwd ) { $cwd = trailingslashit( $cwd ); } return $cwd; } public function chdir( $dir ) { return @ftp_chdir( $this->link, $dir ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( $recursive && $this->is_dir( $file ) ) { $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . '/' . $filename, $mode, $recursive ); } } if ( ! function_exists( 'ftp_chmod' ) ) { return (bool) ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) ); } return (bool) ftp_chmod( $this->link, $mode, $file ); } public function owner( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['owner']; } public function getchmod( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['permsn']; } public function group( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['group']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { return ftp_rename( $this->link, $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } if ( 'f' === $type || $this->is_file( $file ) ) { return ftp_delete( $this->link, $file ); } if ( ! $recursive ) { return ftp_rmdir( $this->link, $file ); } $filelist = $this->dirlist( trailingslashit( $file ) ); if ( ! empty( $filelist ) ) { foreach ( $filelist as $delete_file ) { $this->delete( trailingslashit( $file ) . $delete_file['name'], $recursive, $delete_file['type'] ); } } return ftp_rmdir( $this->link, $file ); } public function exists( $file ) { $list = ftp_nlist( $this->link, $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; } return ! empty( $list ); } public function is_file( $file ) { return $this->exists( $file ) && ! $this->is_dir( $file ); } public function is_dir( $path ) { $cwd = $this->cwd(); $result = @ftp_chdir( $this->link, trailingslashit( $path ) ); if ( $result && $path === $this->cwd() || $this->cwd() !== $cwd ) { @ftp_chdir( $this->link, $cwd ); return true; } return false; } public function is_readable( $file ) { return true; } public function is_writable( $file ) { return true; } public function atime( $file ) { return false; } public function mtime( $file ) { return ftp_mdtm( $this->link, $file ); } public function size( $file ) { return ftp_size( $this->link, $file ); } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! ftp_mkdir( $this->link, $path ) ) { return false; } $this->chmod( $path, $chmod ); return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function parselisting( $line ) { static $is_windows = null; if ( is_null( $is_windows ) ) { $is_windows = stripos( ftp_systype( $this->link ), 'win' ) !== false; } if ( $is_windows && preg_match( '/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/', $line, $lucifer ) ) { $b = array(); if ( $lucifer[3] < 70 ) { $lucifer[3] += 2000; } else { $lucifer[3] += 1900; } $b['isdir'] = ( '' === $lucifer[7] ); if ( $b['isdir'] ) { $b['type'] = 'd'; } else { $b['type'] = 'f'; } $b['size'] = $lucifer[7]; $b['month'] = $lucifer[1]; $b['day'] = $lucifer[2]; $b['year'] = $lucifer[3]; $b['hour'] = $lucifer[4]; $b['minute'] = $lucifer[5]; $b['time'] = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) === 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] ); $b['am/pm'] = $lucifer[6]; $b['name'] = $lucifer[8]; } elseif ( ! $is_windows ) { $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ); if ( $lucifer ) { $lcount = count( $lucifer ); if ( $lcount < 8 ) { return ''; } $b = array(); $b['isdir'] = 'd' === $lucifer[0][0]; $b['islink'] = 'l' === $lucifer[0][0]; if ( $b['isdir'] ) { $b['type'] = 'd'; } elseif ( $b['islink'] ) { $b['type'] = 'l'; } else { $b['type'] = 'f'; } $b['perms'] = $lucifer[0]; $b['permsn'] = $this->getnumchmodfromh( $b['perms'] ); $b['number'] = $lucifer[1]; $b['owner'] = $lucifer[2]; $b['group'] = $lucifer[3]; $b['size'] = $lucifer[4]; if ( 8 === $lcount ) { sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); $b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); $b['name'] = $lucifer[7]; } else { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) { $b['year'] = gmdate( 'Y' ); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { $b['year'] = $lucifer[7]; $b['hour'] = 0; $b['minute'] = 0; } $b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) ); $b['name'] = $lucifer[8]; } } } if ( isset( $b['islink'] ) && $b['islink'] ) { $b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] ); } return $b; } public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ) . '/'; } else { $limit_file = false; } $pwd = ftp_pwd( $this->link ); if ( ! @ftp_chdir( $this->link, $path ) ) { return false; } $list = ftp_rawlist( $this->link, '-a', false ); @ftp_chdir( $this->link, $pwd ); if ( empty( $list ) ) { return false; } $dirlist = array(); foreach ( $list as $k => $v ) { $entry = $this->parselisting( $v ); if ( empty( $entry ) ) { continue; } if ( '.' === $entry['name'] || '..' === $entry['name'] ) { continue; } if ( ! $include_hidden && '.' === $entry['name'][0] ) { continue; } if ( $limit_file && $entry['name'] !== $limit_file ) { continue; } $dirlist[ $entry['name'] ] = $entry; } $ret = array(); foreach ( (array) $dirlist as $struc ) { if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } return $ret; } public function __destruct() { if ( $this->link ) { ftp_close( $this->link ); } } } 'plugins', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' ); $status = 'all'; if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) { $status = $_REQUEST['plugin_status']; } if ( isset( $_REQUEST['s'] ) ) { $_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) ); } $page = $this->get_pagenum(); $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'plugin' ) && current_user_can( 'update_plugins' ) && ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) && ! in_array( $status, array( 'mustuse', 'dropins' ), true ); } protected function get_table_classes() { return array( 'widefat', $this->_args['plural'] ); } public function ajax_user_can() { return current_user_can( 'activate_plugins' ); } public function prepare_items() { global $status, $plugins, $totals, $page, $orderby, $order, $s; wp_reset_vars( array( 'orderby', 'order' ) ); $all_plugins = apply_filters( 'all_plugins', get_plugins() ); $plugins = array( 'all' => $all_plugins, 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array(), 'paused' => array(), ); if ( $this->show_autoupdates ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $plugins['auto-update-enabled'] = array(); $plugins['auto-update-disabled'] = array(); } $screen = $this->screen; if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { $plugins['mustuse'] = get_mu_plugins(); } if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { $plugins['dropins'] = get_dropins(); } if ( current_user_can( 'update_plugins' ) ) { $current = get_site_transient( 'update_plugins' ); foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { if ( isset( $current->response[ $plugin_file ] ) ) { $plugins['all'][ $plugin_file ]['update'] = true; $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; } } } } if ( ! $screen->in_admin( 'network' ) ) { $show = current_user_can( 'manage_network_plugins' ); $show_network_active = apply_filters( 'show_network_active_plugins', $show ); } if ( $screen->in_admin( 'network' ) ) { $recently_activated = get_site_option( 'recently_activated', array() ); } else { $recently_activated = get_option( 'recently_activated', array() ); } foreach ( $recently_activated as $key => $time ) { if ( $time + WEEK_IN_SECONDS < time() ) { unset( $recently_activated[ $key ] ); } } if ( $screen->in_admin( 'network' ) ) { update_site_option( 'recently_activated', $recently_activated ); } else { update_option( 'recently_activated', $recently_activated ); } $plugin_info = get_site_transient( 'update_plugins' ); foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { if ( isset( $plugin_info->response[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); } elseif ( empty( $plugin_data['update-supported'] ) ) { $plugin_data['update-supported'] = false; } $filter_payload = array( 'id' => $plugin_file, 'slug' => '', 'plugin' => $plugin_file, 'new_version' => '', 'url' => '', 'package' => '', 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'requires_php' => '', 'compatibility' => new stdClass(), ); $filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload ); if ( ! is_null( $auto_update_forced ) ) { $plugin_data['auto-update-forced'] = $auto_update_forced; } $plugins['all'][ $plugin_file ] = $plugin_data; if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { $plugins['upgrade'][ $plugin_file ] = $plugin_data; } if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { if ( $show_network_active ) { $plugins['inactive'][ $plugin_file ] = $plugin_data; } else { unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { if ( $show_network_active ) { $plugins['active'][ $plugin_file ] = $plugin_data; } else { unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { $plugins['active'][ $plugin_file ] = $plugin_data; if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) { $plugins['paused'][ $plugin_file ] = $plugin_data; } } else { if ( isset( $recently_activated[ $plugin_file ] ) ) { $plugins['recently_activated'][ $plugin_file ] = $plugin_data; } $plugins['inactive'][ $plugin_file ] = $plugin_data; } if ( $this->show_autoupdates ) { $enabled = in_array( $plugin_file, $auto_updates, true ) && $plugin_data['update-supported']; if ( isset( $plugin_data['auto-update-forced'] ) ) { $enabled = (bool) $plugin_data['auto-update-forced']; } if ( $enabled ) { $plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data; } else { $plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data; } } } if ( strlen( $s ) ) { $status = 'search'; $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); } $totals = array(); foreach ( $plugins as $type => $list ) { $totals[ $type ] = count( $list ); } if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } $this->items = array(); foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { $this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); } $total_this_page = $totals[ $status ]; $js_plugins = array(); foreach ( $plugins as $key => $list ) { $js_plugins[ $key ] = array_keys( $list ); } wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'plugins' => $js_plugins, 'totals' => wp_get_update_data(), ) ); if ( ! $orderby ) { $orderby = 'Name'; } else { $orderby = ucfirst( $orderby ); } $order = strtoupper( $order ); uasort( $this->items, array( $this, '_order_callback' ) ); $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); $start = ( $page - 1 ) * $plugins_per_page; if ( $total_this_page > $plugins_per_page ) { $this->items = array_slice( $this->items, $start, $plugins_per_page ); } $this->set_pagination_args( array( 'total_items' => $total_this_page, 'per_page' => $plugins_per_page, ) ); } public function _search_callback( $plugin ) { global $s; foreach ( $plugin as $value ) { if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { return true; } } return false; } public function _order_callback( $plugin_a, $plugin_b ) { global $orderby, $order; $a = $plugin_a[ $orderby ]; $b = $plugin_b[ $orderby ]; if ( $a === $b ) { return 0; } if ( 'DESC' === $order ) { return strcasecmp( $b, $a ); } else { return strcasecmp( $a, $b ); } } public function no_items() { global $plugins; if ( ! empty( $_REQUEST['s'] ) ) { $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); printf( __( 'No plugins found for: %s.' ), '' . $s . '' ); if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { echo ' ' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . ''; } } elseif ( ! empty( $plugins['all'] ) ) { _e( 'No plugins found.' ); } else { _e( 'No plugins are currently available.' ); } } public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { return; } $input_id = $input_id . '-search-input'; if ( ! empty( $_REQUEST['orderby'] ) ) { echo ''; } if ( ! empty( $_REQUEST['order'] ) ) { echo ''; } ?> + + ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '' : '', 'name' => __( 'Plugin' ), 'description' => __( 'Description' ), ); if ( $this->show_autoupdates ) { $columns['auto-updates'] = __( 'Automatic Updates' ); } return $columns; } protected function get_sortable_columns() { return array(); } protected function get_views() { global $totals, $status; $status_links = array(); foreach ( $totals as $type => $count ) { if ( ! $count ) { continue; } switch ( $type ) { case 'all': $text = _nx( 'All (%s)', 'All (%s)', $count, 'plugins' ); break; case 'active': $text = _n( 'Active (%s)', 'Active (%s)', $count ); break; case 'recently_activated': $text = _n( 'Recently Active (%s)', 'Recently Active (%s)', $count ); break; case 'inactive': $text = _n( 'Inactive (%s)', 'Inactive (%s)', $count ); break; case 'mustuse': $text = _n( 'Must-Use (%s)', 'Must-Use (%s)', $count ); break; case 'dropins': $text = _n( 'Drop-in (%s)', 'Drop-ins (%s)', $count ); break; case 'paused': $text = _n( 'Paused (%s)', 'Paused (%s)', $count ); break; case 'upgrade': $text = _n( 'Update Available (%s)', 'Update Available (%s)', $count ); break; case 'auto-update-enabled': $text = _n( 'Auto-updates Enabled (%s)', 'Auto-updates Enabled (%s)', $count ); break; case 'auto-update-disabled': $text = _n( 'Auto-updates Disabled (%s)', 'Auto-updates Disabled (%s)', $count ); break; } if ( 'search' !== $type ) { $status_links[ $type ] = sprintf( "%s", add_query_arg( 'plugin_status', $type, 'plugins.php' ), ( $type === $status ) ? ' class="current" aria-current="page"' : '', sprintf( $text, number_format_i18n( $count ) ) ); } } return $status_links; } protected function get_bulk_actions() { global $status; $actions = array(); if ( 'active' !== $status ) { $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); } if ( 'inactive' !== $status && 'recent' !== $status ) { $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); } if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) { if ( current_user_can( 'update_plugins' ) ) { $actions['update-selected'] = __( 'Update' ); } if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) { $actions['delete-selected'] = __( 'Delete' ); } if ( $this->show_autoupdates ) { if ( 'auto-update-enabled' !== $status ) { $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' ); } if ( 'auto-update-disabled' !== $status ) { $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' ); } } } return $actions; } public function bulk_actions( $which = '' ) { global $status; if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } parent::bulk_actions( $which ); } protected function extra_tablenav( $which ) { global $status; if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) { return; } echo '
      '; if ( 'recently_activated' === $status ) { submit_button( __( 'Clear List' ), '', 'clear-recent-list', false ); } elseif ( 'top' === $which && 'mustuse' === $status ) { echo '

      ' . sprintf( __( 'Files in the %s directory are executed automatically.' ), '' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '' ) . '

      '; } elseif ( 'top' === $which && 'dropins' === $status ) { echo '

      ' . sprintf( __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), '' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '' ) . '

      '; } echo '
      '; } public function current_action() { if ( isset( $_POST['clear-recent-list'] ) ) { return 'clear-recent-list'; } return parent::current_action(); } public function display_rows() { global $status; if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } foreach ( $this->items as $plugin_file => $plugin_data ) { $this->single_row( array( $plugin_file, $plugin_data ) ); } } public function single_row( $item ) { global $status, $page, $s, $totals; static $plugin_id_attrs = array(); list( $plugin_file, $plugin_data ) = $item; $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] ); $plugin_id_attr = $plugin_slug; $suffix = 2; while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) { $plugin_id_attr = "$plugin_slug-$suffix"; $suffix++; } $plugin_id_attrs[] = $plugin_id_attr; $context = $status; $screen = $this->screen; $actions = array( 'deactivate' => '', 'activate' => '', 'details' => '', 'delete' => '', ); $restrict_network_active = false; $restrict_network_only = false; $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null; $requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); if ( 'mustuse' === $context ) { $is_active = true; } elseif ( 'dropins' === $context ) { $dropins = _get_dropins(); $plugin_name = $plugin_file; if ( $plugin_file !== $plugin_data['Name'] ) { $plugin_name .= '
      ' . $plugin_data['Name']; } if ( true === ( $dropins[ $plugin_file ][1] ) ) { $is_active = true; $description = '

      ' . $dropins[ $plugin_file ][0] . '

      '; } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { $is_active = true; $description = '

      ' . $dropins[ $plugin_file ][0] . '

      '; } else { $is_active = false; $description = '

      ' . $dropins[ $plugin_file ][0] . ' ' . __( 'Inactive:' ) . ' ' . sprintf( __( 'Requires %1$s in %2$s file.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);", 'wp-config.php' ) . '

      '; } if ( $plugin_data['Description'] ) { $description .= '

      ' . $plugin_data['Description'] . '

      '; } } else { if ( $screen->in_admin( 'network' ) ) { $is_active = is_plugin_active_for_network( $plugin_file ); } else { $is_active = is_plugin_active( $plugin_file ); $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); } if ( $screen->in_admin( 'network' ) ) { if ( $is_active ) { if ( current_user_can( 'manage_network_plugins' ) ) { $actions['deactivate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Network Deactivate' ) ); } } else { if ( current_user_can( 'manage_network_plugins' ) ) { if ( $compatible_php && $compatible_wp ) { $actions['activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Network Activate' ) ); } else { $actions['activate'] = sprintf( '%s', _x( 'Cannot Activate', 'plugin' ) ); } } if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Delete' ) ); } } } else { if ( $restrict_network_active ) { $actions = array( 'network_active' => __( 'Network Active' ), ); } elseif ( $restrict_network_only ) { $actions = array( 'network_only' => __( 'Network Only' ), ); } elseif ( $is_active ) { if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { $actions['deactivate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Deactivate' ) ); } if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) { $actions['resume'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Resume' ) ); } } else { if ( current_user_can( 'activate_plugin', $plugin_file ) ) { if ( $compatible_php && $compatible_wp ) { $actions['activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Activate' ) ); } else { $actions['activate'] = sprintf( '%s', _x( 'Cannot Activate', 'plugin' ) ); } } if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Delete' ) ); } } } } $actions = array_filter( $actions ); if ( $screen->in_admin( 'network' ) ) { $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); } else { $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); } $class = $is_active ? 'active' : 'inactive'; $checkbox_id = 'checkbox_' . md5( $plugin_file ); if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { $checkbox = ''; } else { $checkbox = sprintf( '' . '', $checkbox_id, sprintf( __( 'Select %s' ), $plugin_data['Name'] ), esc_attr( $plugin_file ) ); } if ( 'dropins' !== $context ) { $description = '

      ' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '

      '; $plugin_name = $plugin_data['Name']; } if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) || ! $compatible_php || ! $compatible_wp ) { $class .= ' update'; } $paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ); if ( $paused ) { $class .= ' paused'; } if ( is_uninstallable_plugin( $plugin_file ) ) { $class .= ' is-uninstallable'; } printf( '', esc_attr( $class ), esc_attr( $plugin_slug ), esc_attr( $plugin_file ) ); list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $available_updates = get_site_transient( 'update_plugins' ); foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; if ( in_array( $column_name, $hidden, true ) ) { $extra_classes = ' hidden'; } switch ( $column_name ) { case 'cb': echo "$checkbox"; break; case 'name': echo "$plugin_name"; echo $this->row_actions( $actions, true ); echo ''; break; case 'description': $classes = 'column-description desc'; echo " +
      $description
      +
      "; $plugin_meta = array(); if ( ! empty( $plugin_data['Version'] ) ) { $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } if ( ! empty( $plugin_data['Author'] ) ) { $author = $plugin_data['Author']; if ( ! empty( $plugin_data['AuthorURI'] ) ) { $author = '' . $plugin_data['Author'] . ''; } $plugin_meta[] = sprintf( __( 'By %s' ), $author ); } if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { $plugin_meta[] = sprintf( '%s', esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550' ) ), esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), esc_attr( $plugin_name ), __( 'View details' ) ); } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { $aria_label = sprintf( __( 'Visit plugin site for %s' ), $plugin_name ); $plugin_meta[] = sprintf( '%s', esc_url( $plugin_data['PluginURI'] ), esc_attr( $aria_label ), __( 'Visit plugin site' ) ); } $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); echo implode( ' | ', $plugin_meta ); echo '
      '; if ( $paused ) { $notice_text = __( 'This plugin failed to load properly and is paused during recovery mode.' ); printf( '

      %s

      ', $notice_text ); $error = wp_get_plugin_error( $plugin_file ); if ( false !== $error ) { printf( '

      %s

      ', wp_get_extension_error_description( $error ) ); } } echo ''; break; case 'auto-updates': if ( ! $this->show_autoupdates ) { break; } echo ""; $html = array(); if ( isset( $plugin_data['auto-update-forced'] ) ) { if ( $plugin_data['auto-update-forced'] ) { $text = __( 'Auto-updates enabled' ); } else { $text = __( 'Auto-updates disabled' ); } $action = 'unavailable'; $time_class = ' hidden'; } elseif ( empty( $plugin_data['update-supported'] ) ) { $text = ''; $action = 'unavailable'; $time_class = ' hidden'; } elseif ( in_array( $plugin_file, $auto_updates, true ) ) { $text = __( 'Disable auto-updates' ); $action = 'disable'; $time_class = ''; } else { $text = __( 'Enable auto-updates' ); $action = 'enable'; $time_class = ' hidden'; } $query_args = array( 'action' => "{$action}-auto-update", 'plugin' => $plugin_file, 'paged' => $page, 'plugin_status' => $status, ); $url = add_query_arg( $query_args, 'plugins.php' ); if ( 'unavailable' === $action ) { $html[] = '' . $text . ''; } else { $html[] = sprintf( '', wp_nonce_url( $url, 'updates' ), $action ); $html[] = ''; $html[] = '' . $text . ''; $html[] = ''; } if ( ! empty( $plugin_data['update'] ) ) { $html[] = sprintf( '
      %s
      ', $time_class, wp_get_auto_update_message() ); } $html = implode( '', $html ); echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data ); echo ''; echo ''; break; default: $classes = "$column_name column-$column_name $class"; echo ""; do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); echo ''; } } echo ''; if ( ! $compatible_php || ! $compatible_wp ) { printf( '' . '' . '

      ', esc_attr( $this->get_column_count() ) ); if ( ! $compatible_php && ! $compatible_wp ) { _e( 'This plugin does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } } elseif ( ! $compatible_wp ) { _e( 'This plugin does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { _e( 'This plugin does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

      ', '' ); } } echo '

      '; } do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); } protected function get_primary_column_name() { return 'name'; } } detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); $this->modes = array( 'list' => __( 'List view' ), 'grid' => __( 'Grid view' ), ); parent::__construct( array( 'plural' => 'media', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'upload_files' ); } public function prepare_items() { global $mode, $wp_query, $post_mime_types, $avail_post_mime_types; $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; $not_in = array(); $crons = _get_cron_array(); if ( is_array( $crons ) ) { foreach ( $crons as $cron ) { if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { $details = reset( $cron['upgrader_scheduled_cleanup'] ); if ( ! empty( $details['args'][0] ) ) { $not_in[] = (int) $details['args'][0]; } } } } if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { $not_in = array_merge( array_values( $_REQUEST['post__not_in'] ), $not_in ); } if ( ! empty( $not_in ) ) { $_REQUEST['post__not_in'] = $not_in; } list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter']; $this->set_pagination_args( array( 'total_items' => $wp_query->found_posts, 'total_pages' => $wp_query->max_num_pages, 'per_page' => $wp_query->query_vars['posts_per_page'], ) ); } protected function get_views() { global $post_mime_types, $avail_post_mime_types; $type_links = array(); $filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter']; $type_links['all'] = sprintf( '', selected( $filter, true, false ), __( 'All media items' ) ); foreach ( $post_mime_types as $mime_type => $label ) { if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; } $selected = selected( $filter && 0 === strpos( $filter, 'post_mime_type:' ) && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), true, false ); $type_links[ $mime_type ] = sprintf( '', esc_attr( $mime_type ), $selected, $label[0] ); } $type_links['detached'] = ''; $type_links['mine'] = sprintf( '', selected( 'mine' === $filter, true, false ), _x( 'Mine', 'media items' ) ); if ( $this->is_trash || ( defined( 'MEDIA_TRASH' ) && MEDIA_TRASH ) ) { $type_links['trash'] = sprintf( '', selected( 'trash' === $filter, true, false ), _x( 'Trash', 'attachment filter' ) ); } return $type_links; } protected function get_bulk_actions() { $actions = array(); if ( MEDIA_TRASH ) { if ( $this->is_trash ) { $actions['untrash'] = __( 'Restore' ); $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } } else { $actions['delete'] = __( 'Delete permanently' ); } if ( $this->detached ) { $actions['attach'] = __( 'Attach' ); } return $actions; } protected function extra_tablenav( $which ) { if ( 'bar' !== $which ) { return; } ?> +
      + is_trash ) { $this->months_dropdown( 'attachment' ); } do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); if ( $this->is_trash && $this->has_items() && current_user_can( 'edit_others_posts' ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> +
      + is_trash ) { _e( 'No media files found in Trash.' ); } else { _e( 'No media files found.' ); } } public function views() { global $mode; $views = $this->get_views(); $this->screen->render_screen_reader_content( 'heading_views' ); ?> +
      +
      + view_switcher( $mode ); ?> -.nav-menus-php .list li .menu-item-title { - cursor: pointer; - display: block; -} + + -.nav-menus-php .list li .menu-item-title input { - margin-right: 3px; - margin-top: -3px; -} + extra_tablenav( 'bar' ); $views = apply_filters( "views_{$this->screen->id}", array() ); if ( ! empty( $views ) ) { echo ''; } ?> +
      -.menu-item-title input[type=checkbox] { - display: inline-block; - margin-top: -4px; -} +
      + + +
      +
      + '; $posts_columns['title'] = _x( 'File', 'column name' ); $posts_columns['author'] = __( 'Author' ); $taxonomies = get_taxonomies_for_attachments( 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); foreach ( $taxonomies as $taxonomy ) { if ( 'category' === $taxonomy ) { $column_key = 'categories'; } elseif ( 'post_tag' === $taxonomy ) { $column_key = 'tags'; } else { $column_key = 'taxonomy-' . $taxonomy; } $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; } if ( ! $this->detached ) { $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); if ( post_type_supports( 'attachment', 'comments' ) ) { $posts_columns['comments'] = '' . __( 'Comments' ) . ''; } } $posts_columns['date'] = _x( 'Date', 'column name' ); return apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); } protected function get_sortable_columns() { return array( 'title' => 'title', 'author' => 'author', 'parent' => 'parent', 'comments' => 'comment_count', 'date' => array( 'date', true ), ); } public function column_cb( $item ) { $post = $item; if ( current_user_can( 'edit_post', $post->ID ) ) { ?> + + + post_mime_type ); $title = _draft_or_post_title(); $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); $link_start = ''; $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { $link_start = sprintf( '', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) ); $link_end = ''; } $class = $thumb ? ' class="has-media-icon"' : ''; ?> + > + + + + +

      + + ID ); echo esc_html( wp_basename( $file ) ); ?> +

      + %s', esc_url( add_query_arg( array( 'author' => get_the_author_meta( 'ID' ) ), 'upload.php' ) ), get_the_author() ); } public function column_desc( $post ) { echo has_excerpt() ? $post->post_excerpt : ''; } public function column_date( $post ) { if ( '0000-00-00 00:00:00' === $post->post_date ) { $h_time = __( 'Unpublished' ); } else { $time = get_post_timestamp( $post ); $time_diff = time() - $time; if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); } else { $h_time = get_the_time( __( 'Y/m/d' ), $post ); } } echo apply_filters( 'media_date_column_time', $h_time, $post, 'date' ); } public function column_parent( $post ) { $user_can_edit = current_user_can( 'edit_post', $post->ID ); if ( $post->post_parent > 0 ) { $parent = get_post( $post->post_parent ); } else { $parent = false; } if ( $parent ) { $title = _draft_or_post_title( $post->post_parent ); $parent_type = get_post_type_object( $parent->post_type ); if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { printf( '%s', get_edit_post_link( $post->post_parent ), $title ); } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) { printf( '%s', $title ); } else { _e( '(Private post)' ); } if ( $user_can_edit ) : $detach_url = add_query_arg( array( 'parent_post_id' => $post->post_parent, 'media[]' => $post->ID, '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ), ), 'upload.php' ); printf( '
      %s', $detach_url, esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ), __( 'Detach' ) ); endif; } else { _e( '(Unattached)' ); ?> + post_parent ); printf( '
      %s', $post->ID, esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ), __( 'Attach' ) ); } } } public function column_comments( $post ) { echo '
      '; if ( isset( $this->comment_pending_count[ $post->ID ] ) ) { $pending_comments = $this->comment_pending_count[ $post->ID ]; } else { $pending_comments = get_pending_comments_num( $post->ID ); } $this->comments_bubble( $post->ID, $pending_comments ); echo '
      '; } public function column_default( $item, $column_name ) { $post = $item; if ( 'categories' === $column_name ) { $taxonomy = 'category'; } elseif ( 'tags' === $column_name ) { $taxonomy = 'post_tag'; } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { $taxonomy = substr( $column_name, 9 ); } else { $taxonomy = false; } if ( $taxonomy ) { $terms = get_the_terms( $post->ID, $taxonomy ); if ( is_array( $terms ) ) { $out = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; $out[] = sprintf( '%s', esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) ); } echo implode( wp_get_list_item_separator(), $out ); } else { echo '' . get_taxonomy( $taxonomy )->labels->no_terms . ''; } return; } do_action( 'manage_media_custom_column', $column_name, $post->ID ); } public function display_rows() { global $post, $wp_query; $post_ids = wp_list_pluck( $wp_query->posts, 'ID' ); reset( $wp_query->posts ); $this->comment_pending_count = get_pending_comments_num( $post_ids ); add_filter( 'the_title', 'esc_html' ); while ( have_posts() ) : the_post(); if ( $this->is_trash && 'trash' !== $post->post_status || ! $this->is_trash && 'trash' === $post->post_status ) { continue; } $post_owner = ( get_current_user_id() === (int) $post->post_author ) ? 'self' : 'other'; ?> + + single_row_columns( $post ); ?> + + detached ) { if ( current_user_can( 'edit_post', $post->ID ) ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), __( 'Edit' ) ); } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { $actions['trash'] = sprintf( '%s', wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), _x( 'Trash', 'verb' ) ); } else { $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), $delete_ays, esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), __( 'Delete Permanently' ) ); } } $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), __( 'View' ) ); if ( current_user_can( 'edit_post', $post->ID ) ) { $actions['attach'] = sprintf( '%s', $post->ID, esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ), __( 'Attach' ) ); } } else { if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), __( 'Edit' ) ); } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( $this->is_trash ) { $actions['untrash'] = sprintf( '%s', wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ), esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ), __( 'Restore' ) ); } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { $actions['trash'] = sprintf( '%s', wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), _x( 'Trash', 'verb' ) ); } if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) { $delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), $delete_ays, esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), __( 'Delete Permanently' ) ); } } if ( ! $this->is_trash ) { $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), __( 'View' ) ); $actions['copy'] = sprintf( '', esc_url( wp_get_attachment_url( $post->ID ) ), esc_attr( sprintf( __( 'Copy “%s” URL to clipboard' ), $att_title ) ), __( 'Copy URL to clipboard' ), __( 'Copied!' ) ); } } return apply_filters( 'media_row_actions', $actions, $post, $this->detached ); } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $att_title = _draft_or_post_title(); $actions = $this->_get_row_actions( $item, $att_title ); return $this->row_actions( $actions ); } } ID ); $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $attachment = array( 'ID' => $parent_attachment_id, 'post_title' => wp_basename( $cropped ), 'post_content' => $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'site-icon', ); return $attachment; } public function insert_attachment( $attachment, $file ) { $attachment_id = wp_insert_attachment( $attachment, $file ); $metadata = wp_generate_attachment_metadata( $attachment_id, $file ); $metadata = apply_filters( 'site_icon_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); return $attachment_id; } public function additional_sizes( $sizes = array() ) { $only_crop_sizes = array(); $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes ); natsort( $this->site_icon_sizes ); $this->site_icon_sizes = array_reverse( $this->site_icon_sizes ); foreach ( $sizes as $name => $size_array ) { if ( isset( $size_array['crop'] ) ) { $only_crop_sizes[ $name ] = $size_array; } } foreach ( $this->site_icon_sizes as $size ) { if ( $size < $this->min_size ) { $only_crop_sizes[ 'site_icon-' . $size ] = array( 'width ' => $size, 'height' => $size, 'crop' => true, ); } } return $only_crop_sizes; } public function intermediate_image_sizes( $sizes = array() ) { $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes ); foreach ( $this->site_icon_sizes as $size ) { $sizes[] = 'site_icon-' . $size; } return $sizes; } public function delete_attachment_data( $post_id ) { $site_icon_id = get_option( 'site_icon' ); if ( $site_icon_id && $post_id == $site_icon_id ) { delete_option( 'site_icon' ); } } public function get_post_metadata( $value, $post_id, $meta_key, $single ) { if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) { $site_icon_id = get_option( 'site_icon' ); if ( $post_id == $site_icon_id ) { add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) ); } } return $value; } } '', 'theme' => '', 'nonce' => '', 'title' => __( 'Update Theme' ), ); $args = wp_parse_args( $args, $defaults ); $this->theme = $args['theme']; parent::__construct( $args ); } public function after() { $this->decrement_update_count( 'theme' ); $update_actions = array(); $theme_info = $this->upgrader->theme_info(); if ( $theme_info ) { $name = $theme_info->display( 'Name' ); $stylesheet = $this->upgrader->result['destination_name']; $template = $theme_info->get_template(); $activate_link = add_query_arg( array( 'action' => 'activate', 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), ), admin_url( 'themes.php' ) ); $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); $customize_url = add_query_arg( array( 'theme' => urlencode( $stylesheet ), 'return' => urlencode( admin_url( 'themes.php' ) ), ), admin_url( 'customize.php' ) ); if ( get_stylesheet() === $stylesheet ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $update_actions['preview'] = sprintf( '' . '%s', esc_url( $customize_url ), __( 'Customize' ), sprintf( __( 'Customize “%s”' ), $name ) ); } } elseif ( current_user_can( 'switch_themes' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $update_actions['preview'] = sprintf( '' . '%s', esc_url( $customize_url ), __( 'Live Preview' ), sprintf( __( 'Live Preview “%s”' ), $name ) ); } $update_actions['activate'] = sprintf( '' . '%s', esc_url( $activate_link ), __( 'Activate' ), sprintf( _x( 'Activate “%s”', 'theme' ), $name ) ); } if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) { unset( $update_actions['preview'], $update_actions['activate'] ); } } $update_actions['themes_page'] = sprintf( '%s', self_admin_url( 'themes.php' ), __( 'Go to Themes page' ) ); $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs ); if ( is_wp_error( $src ) ) { return $src; } if ( ! $dst_file ) { $dst_file = str_replace( wp_basename( $src_file ), 'cropped-' . wp_basename( $src_file ), $src_file ); } wp_mkdir_p( dirname( $dst_file ) ); $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) ); $result = $editor->save( $dst_file ); if ( is_wp_error( $result ) ) { return $result; } if ( ! empty( $result['path'] ) ) { return $result['path']; } return $dst_file; } function wp_get_missing_image_subsizes( $attachment_id ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return array(); } $registered_sizes = wp_get_registered_image_subsizes(); $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $image_meta ) ) { return $registered_sizes; } if ( ! empty( $image_meta['original_image'] ) ) { $image_file = wp_get_original_image_path( $attachment_id ); $imagesize = wp_getimagesize( $image_file ); } if ( ! empty( $imagesize ) ) { $full_width = $imagesize[0]; $full_height = $imagesize[1]; } else { $full_width = (int) $image_meta['width']; $full_height = (int) $image_meta['height']; } $possible_sizes = array(); foreach ( $registered_sizes as $size_name => $size_data ) { if ( image_resize_dimensions( $full_width, $full_height, $size_data['width'], $size_data['height'], $size_data['crop'] ) ) { $possible_sizes[ $size_name ] = $size_data; } } if ( empty( $image_meta['sizes'] ) ) { $image_meta['sizes'] = array(); } $missing_sizes = array_diff_key( $possible_sizes, $image_meta['sizes'] ); return apply_filters( 'wp_get_missing_image_subsizes', $missing_sizes, $image_meta, $attachment_id ); } function wp_update_image_subsizes( $attachment_id ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); $image_file = wp_get_original_image_path( $attachment_id ); if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { if ( ! empty( $image_file ) ) { $image_meta = wp_create_image_subsizes( $image_file, $attachment_id ); } else { return new WP_Error( 'invalid_attachment', __( 'The attached file cannot be found.' ) ); } } else { $missing_sizes = wp_get_missing_image_subsizes( $attachment_id ); if ( empty( $missing_sizes ) ) { return $image_meta; } $image_meta = _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id ); } $image_meta = apply_filters( 'wp_generate_attachment_metadata', $image_meta, $attachment_id, 'update' ); wp_update_attachment_metadata( $attachment_id, $image_meta ); return $image_meta; } function _wp_image_meta_replace_original( $saved_data, $original_file, $image_meta, $attachment_id ) { $new_file = $saved_data['path']; update_attached_file( $attachment_id, $new_file ); $image_meta['width'] = $saved_data['width']; $image_meta['height'] = $saved_data['height']; $image_meta['file'] = _wp_relative_upload_path( $new_file ); $image_meta['original_image'] = wp_basename( $original_file ); $image_meta['filesize'] = wp_filesize( $new_file ); return $image_meta; } function wp_create_image_subsizes( $file, $attachment_id ) { $imagesize = wp_getimagesize( $file ); if ( empty( $imagesize ) ) { return array(); } $image_meta = array( 'width' => $imagesize[0], 'height' => $imagesize[1], 'file' => _wp_relative_upload_path( $file ), 'filesize' => wp_filesize( $file ), 'sizes' => array(), ); $exif_meta = wp_read_image_metadata( $file ); if ( $exif_meta ) { $image_meta['image_meta'] = $exif_meta; } if ( 'image/png' !== $imagesize['mime'] ) { $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id ); if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } $resized = $editor->resize( $threshold, $threshold ); $rotated = null; if ( ! is_wp_error( $resized ) && is_array( $exif_meta ) ) { $resized = $editor->maybe_exif_rotate(); $rotated = $resized; } if ( ! is_wp_error( $resized ) ) { $saved = $editor->save( $editor->generate_filename( 'scaled' ) ); if ( ! is_wp_error( $saved ) ) { $image_meta = _wp_image_meta_replace_original( $saved, $file, $image_meta, $attachment_id ); if ( true === $rotated && ! empty( $image_meta['image_meta']['orientation'] ) ) { $image_meta['image_meta']['orientation'] = 1; } } else { } } else { } } elseif ( ! empty( $exif_meta['orientation'] ) && 1 !== (int) $exif_meta['orientation'] ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } $rotated = $editor->maybe_exif_rotate(); if ( true === $rotated ) { $saved = $editor->save( $editor->generate_filename( 'rotated' ) ); if ( ! is_wp_error( $saved ) ) { $image_meta = _wp_image_meta_replace_original( $saved, $file, $image_meta, $attachment_id ); if ( ! empty( $image_meta['image_meta']['orientation'] ) ) { $image_meta['image_meta']['orientation'] = 1; } } else { } } } } wp_update_attachment_metadata( $attachment_id, $image_meta ); $new_sizes = wp_get_registered_image_subsizes(); $new_sizes = apply_filters( 'intermediate_image_sizes_advanced', $new_sizes, $image_meta, $attachment_id ); return _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ); } function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) { if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { return array(); } if ( isset( $image_meta['sizes'] ) && is_array( $image_meta['sizes'] ) ) { foreach ( $image_meta['sizes'] as $size_name => $size_meta ) { if ( array_key_exists( $size_name, $new_sizes ) ) { unset( $new_sizes[ $size_name ] ); } } } else { $image_meta['sizes'] = array(); } if ( empty( $new_sizes ) ) { return $image_meta; } $priority = array( 'medium' => null, 'large' => null, 'thumbnail' => null, 'medium_large' => null, ); $new_sizes = array_filter( array_merge( $priority, $new_sizes ) ); $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } if ( ! empty( $image_meta['image_meta'] ) ) { $rotated = $editor->maybe_exif_rotate(); if ( is_wp_error( $rotated ) ) { } } if ( method_exists( $editor, 'make_subsize' ) ) { foreach ( $new_sizes as $new_size_name => $new_size_data ) { $new_size_meta = $editor->make_subsize( $new_size_data ); if ( is_wp_error( $new_size_meta ) ) { } else { $image_meta['sizes'][ $new_size_name ] = $new_size_meta; wp_update_attachment_metadata( $attachment_id, $image_meta ); } } } else { $created_sizes = $editor->multi_resize( $new_sizes ); if ( ! empty( $created_sizes ) ) { $image_meta['sizes'] = array_merge( $image_meta['sizes'], $created_sizes ); wp_update_attachment_metadata( $attachment_id, $image_meta ); } } return $image_meta; } function wp_generate_attachment_metadata( $attachment_id, $file ) { $attachment = get_post( $attachment_id ); $metadata = array(); $support = false; $mime_type = get_post_mime_type( $attachment ); if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) { $metadata = wp_create_image_subsizes( $file, $attachment_id ); } elseif ( wp_attachment_is( 'video', $attachment ) ) { $metadata = wp_read_video_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' ); } elseif ( wp_attachment_is( 'audio', $attachment ) ) { $metadata = wp_read_audio_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' ); } if ( ! is_array( $metadata ) ) { $metadata = array(); } if ( $support && ! empty( $metadata['image']['data'] ) ) { $hash = md5( $metadata['image']['data'] ); $posts = get_posts( array( 'fields' => 'ids', 'post_type' => 'attachment', 'post_mime_type' => $metadata['image']['mime'], 'post_status' => 'inherit', 'posts_per_page' => 1, 'meta_key' => '_cover_hash', 'meta_value' => $hash, ) ); $exists = reset( $posts ); if ( ! empty( $exists ) ) { update_post_meta( $attachment_id, '_thumbnail_id', $exists ); } else { $ext = '.jpg'; switch ( $metadata['image']['mime'] ) { case 'image/gif': $ext = '.gif'; break; case 'image/png': $ext = '.png'; break; case 'image/webp': $ext = '.webp'; break; } $basename = str_replace( '.', '-', wp_basename( $file ) ) . '-image' . $ext; $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); if ( false === $uploaded['error'] ) { $image_attachment = array( 'post_mime_type' => $metadata['image']['mime'], 'post_type' => 'attachment', 'post_content' => '', ); $image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded ); $sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] ); add_post_meta( $sub_attachment_id, '_cover_hash', $hash ); $attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] ); wp_update_attachment_metadata( $sub_attachment_id, $attach_data ); update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id ); } } } elseif ( 'application/pdf' === $mime_type ) { $fallback_sizes = array( 'thumbnail', 'medium', 'large', ); $fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata ); $registered_sizes = wp_get_registered_image_subsizes(); $merged_sizes = array_intersect_key( $registered_sizes, array_flip( $fallback_sizes ) ); if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) { $merged_sizes['thumbnail']['crop'] = false; } if ( ! empty( $merged_sizes ) ) { $editor = wp_get_image_editor( $file ); if ( ! is_wp_error( $editor ) ) { $dirname = dirname( $file ) . '/'; $ext = '.' . pathinfo( $file, PATHINFO_EXTENSION ); $preview_file = $dirname . wp_unique_filename( $dirname, wp_basename( $file, $ext ) . '-pdf.jpg' ); $uploaded = $editor->save( $preview_file, 'image/jpeg' ); unset( $editor ); if ( ! is_wp_error( $uploaded ) ) { $image_file = $uploaded['path']; unset( $uploaded['path'] ); $metadata['sizes'] = array( 'full' => $uploaded, ); wp_update_attachment_metadata( $attachment_id, $metadata ); $metadata = _wp_make_subsizes( $merged_sizes, $image_file, $metadata, $attachment_id ); } } } } unset( $metadata['image']['data'] ); if ( ! isset( $metadata['filesize'] ) && file_exists( $file ) ) { $metadata['filesize'] = wp_filesize( $file ); } return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id, 'create' ); } function wp_exif_frac2dec( $str ) { if ( ! is_scalar( $str ) || is_bool( $str ) ) { return 0; } if ( ! is_string( $str ) ) { return $str; } if ( substr_count( $str, '/' ) !== 1 ) { if ( is_numeric( $str ) ) { return (float) $str; } return 0; } list( $numerator, $denominator ) = explode( '/', $str ); if ( ! is_numeric( $numerator ) || ! is_numeric( $denominator ) ) { return 0; } if ( 0 == $denominator ) { return 0; } return $numerator / $denominator; } function wp_exif_date2ts( $str ) { list( $date, $time ) = explode( ' ', trim( $str ) ); list( $y, $m, $d ) = explode( ':', $date ); return strtotime( "{$y}-{$m}-{$d} {$time}" ); } function wp_read_image_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } list( , , $image_type ) = wp_getimagesize( $file ); $meta = array( 'aperture' => 0, 'credit' => '', 'camera' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'focal_length' => 0, 'iso' => 0, 'shutter_speed' => 0, 'title' => '', 'orientation' => 0, 'keywords' => array(), ); $iptc = array(); $info = array(); if ( is_callable( 'iptcparse' ) ) { wp_getimagesize( $file, $info ); if ( ! empty( $info['APP13'] ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $iptc = iptcparse( $info['APP13'] ); } else { $iptc = @iptcparse( $info['APP13'] ); } if ( ! is_array( $iptc ) ) { $iptc = array(); } if ( ! empty( $iptc['2#105'][0] ) ) { $meta['title'] = trim( $iptc['2#105'][0] ); } elseif ( ! empty( $iptc['2#005'][0] ) ) { $meta['title'] = trim( $iptc['2#005'][0] ); } if ( ! empty( $iptc['2#120'][0] ) ) { $caption = trim( $iptc['2#120'][0] ); mbstring_binary_safe_encoding(); $caption_length = strlen( $caption ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $caption_length < 80 ) { $meta['title'] = $caption; } $meta['caption'] = $caption; } if ( ! empty( $iptc['2#110'][0] ) ) { $meta['credit'] = trim( $iptc['2#110'][0] ); } elseif ( ! empty( $iptc['2#080'][0] ) ) { $meta['credit'] = trim( $iptc['2#080'][0] ); } if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) { $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); } if ( ! empty( $iptc['2#116'][0] ) ) { $meta['copyright'] = trim( $iptc['2#116'][0] ); } if ( ! empty( $iptc['2#025'][0] ) ) { $meta['keywords'] = array_values( $iptc['2#025'] ); } } } $exif = array(); $exif_image_types = apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ); if ( is_callable( 'exif_read_data' ) && in_array( $image_type, $exif_image_types, true ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $exif = exif_read_data( $file ); } else { $exif = @exif_read_data( $file ); } if ( ! is_array( $exif ) ) { $exif = array(); } if ( ! empty( $exif['ImageDescription'] ) ) { mbstring_binary_safe_encoding(); $description_length = strlen( $exif['ImageDescription'] ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $description_length < 80 ) { $meta['title'] = trim( $exif['ImageDescription'] ); } if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) { $meta['caption'] = trim( $exif['COMPUTED']['UserComment'] ); } if ( empty( $meta['caption'] ) ) { $meta['caption'] = trim( $exif['ImageDescription'] ); } } elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) { $meta['caption'] = trim( $exif['Comments'] ); } if ( empty( $meta['credit'] ) ) { if ( ! empty( $exif['Artist'] ) ) { $meta['credit'] = trim( $exif['Artist'] ); } elseif ( ! empty( $exif['Author'] ) ) { $meta['credit'] = trim( $exif['Author'] ); } } if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) { $meta['copyright'] = trim( $exif['Copyright'] ); } if ( ! empty( $exif['FNumber'] ) && is_scalar( $exif['FNumber'] ) ) { $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); } if ( ! empty( $exif['Model'] ) ) { $meta['camera'] = trim( $exif['Model'] ); } if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) { $meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] ); } if ( ! empty( $exif['FocalLength'] ) ) { $meta['focal_length'] = (string) $exif['FocalLength']; if ( is_scalar( $exif['FocalLength'] ) ) { $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] ); } } if ( ! empty( $exif['ISOSpeedRatings'] ) ) { $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; $meta['iso'] = trim( $meta['iso'] ); } if ( ! empty( $exif['ExposureTime'] ) ) { $meta['shutter_speed'] = (string) $exif['ExposureTime']; if ( is_scalar( $exif['ExposureTime'] ) ) { $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] ); } } if ( ! empty( $exif['Orientation'] ) ) { $meta['orientation'] = $exif['Orientation']; } } foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) { $meta[ $key ] = utf8_encode( $meta[ $key ] ); } } foreach ( $meta['keywords'] as $key => $keyword ) { if ( ! seems_utf8( $keyword ) ) { $meta['keywords'][ $key ] = utf8_encode( $keyword ); } } $meta = wp_kses_post_deep( $meta ); return apply_filters( 'wp_read_image_metadata', $meta, $file, $image_type, $iptc, $exif ); } function file_is_valid_image( $path ) { $size = wp_getimagesize( $path ); return ! empty( $size ); } function file_is_displayable_image( $path ) { $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_ICO, IMAGETYPE_WEBP ); $info = wp_getimagesize( $path ); if ( empty( $info ) ) { $result = false; } elseif ( ! in_array( $info[2], $displayable_image_types, true ) ) { $result = false; } else { $result = true; } return apply_filters( 'file_is_displayable_image', $result, $path ); } function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) { $filepath = _load_image_to_edit_path( $attachment_id, $size ); if ( empty( $filepath ) ) { return false; } switch ( $mime_type ) { case 'image/jpeg': $image = imagecreatefromjpeg( $filepath ); break; case 'image/png': $image = imagecreatefrompng( $filepath ); break; case 'image/gif': $image = imagecreatefromgif( $filepath ); break; case 'image/webp': $image = false; if ( function_exists( 'imagecreatefromwebp' ) ) { $image = imagecreatefromwebp( $filepath ); } break; default: $image = false; break; } if ( is_gd_image( $image ) ) { $image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size ); if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) { imagealphablending( $image, false ); imagesavealpha( $image, true ); } } return $image; } function _load_image_to_edit_path( $attachment_id, $size = 'full' ) { $filepath = get_attached_file( $attachment_id ); if ( $filepath && file_exists( $filepath ) ) { if ( 'full' !== $size ) { $data = image_get_intermediate_size( $attachment_id, $size ); if ( $data ) { $filepath = path_join( dirname( $filepath ), $data['file'] ); $filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size ); } } } elseif ( function_exists( 'fopen' ) && ini_get( 'allow_url_fopen' ) ) { $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size ); } return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size ); } function _copy_image_file( $attachment_id ) { $dst_file = get_attached_file( $attachment_id ); $src_file = $dst_file; if ( ! file_exists( $src_file ) ) { $src_file = _load_image_to_edit_path( $attachment_id ); } if ( $src_file ) { $dst_file = str_replace( wp_basename( $dst_file ), 'copy-' . wp_basename( $dst_file ), $dst_file ); $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) ); wp_mkdir_p( dirname( $dst_file ) ); if ( ! copy( $src_file, $dst_file ) ) { $dst_file = false; } } else { $dst_file = false; } return $dst_file; } post_type; $replace_editor = apply_filters( 'replace_editor', false, $post ); if ( ! $replace_editor ) { $is_block_editor = use_block_editor_for_post( $post ); } } } break; case 'edit-tags': case 'term': if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) { $post_type = 'post'; } break; case 'upload': $post_type = 'attachment'; break; } } switch ( $base ) { case 'post': if ( null === $post_type ) { $post_type = 'post'; } if ( empty( $post_id ) ) { $is_block_editor = use_block_editor_for_post_type( $post_type ); } $id = $post_type; break; case 'edit': if ( null === $post_type ) { $post_type = 'post'; } $id .= '-' . $post_type; break; case 'edit-tags': case 'term': if ( null === $taxonomy ) { $taxonomy = 'post_tag'; } if ( null === $post_type ) { $post_type = 'post'; if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { $post_type = $_REQUEST['post_type']; } } $id = 'edit-' . $taxonomy; break; } if ( 'network' === $in_admin ) { $id .= '-network'; $base .= '-network'; } elseif ( 'user' === $in_admin ) { $id .= '-user'; $base .= '-user'; } if ( isset( self::$_registry[ $id ] ) ) { $screen = self::$_registry[ $id ]; if ( get_current_screen() === $screen ) { return $screen; } } else { $screen = new self(); $screen->id = $id; } $screen->base = $base; $screen->action = $action; $screen->post_type = (string) $post_type; $screen->taxonomy = (string) $taxonomy; $screen->is_user = ( 'user' === $in_admin ); $screen->is_network = ( 'network' === $in_admin ); $screen->in_admin = $in_admin; $screen->is_block_editor = $is_block_editor; self::$_registry[ $id ] = $screen; return $screen; } public function set_current_screen() { global $current_screen, $taxnow, $typenow; $current_screen = $this; $typenow = $this->post_type; $taxnow = $this->taxonomy; do_action( 'current_screen', $current_screen ); } private function __construct() {} public function in_admin( $admin = null ) { if ( empty( $admin ) ) { return (bool) $this->in_admin; } return ( $admin === $this->in_admin ); } public function is_block_editor( $set = null ) { if ( null !== $set ) { $this->is_block_editor = (bool) $set; } return $this->is_block_editor; } public static function add_old_compat_help( $screen, $help ) { self::$_old_compat_help[ $screen->id ] = $help; } public function set_parentage( $parent_file ) { $this->parent_file = $parent_file; list( $this->parent_base ) = explode( '?', $parent_file ); $this->parent_base = str_replace( '.php', '', $this->parent_base ); } public function add_option( $option, $args = array() ) { $this->_options[ $option ] = $args; } public function remove_option( $option ) { unset( $this->_options[ $option ] ); } public function remove_options() { $this->_options = array(); } public function get_options() { return $this->_options; } public function get_option( $option, $key = false ) { if ( ! isset( $this->_options[ $option ] ) ) { return null; } if ( $key ) { if ( isset( $this->_options[ $option ][ $key ] ) ) { return $this->_options[ $option ][ $key ]; } return null; } return $this->_options[ $option ]; } public function get_help_tabs() { $help_tabs = $this->_help_tabs; $priorities = array(); foreach ( $help_tabs as $help_tab ) { if ( isset( $priorities[ $help_tab['priority'] ] ) ) { $priorities[ $help_tab['priority'] ][] = $help_tab; } else { $priorities[ $help_tab['priority'] ] = array( $help_tab ); } } ksort( $priorities ); $sorted = array(); foreach ( $priorities as $list ) { foreach ( $list as $tab ) { $sorted[ $tab['id'] ] = $tab; } } return $sorted; } public function get_help_tab( $id ) { if ( ! isset( $this->_help_tabs[ $id ] ) ) { return null; } return $this->_help_tabs[ $id ]; } public function add_help_tab( $args ) { $defaults = array( 'title' => false, 'id' => false, 'content' => '', 'callback' => false, 'priority' => 10, ); $args = wp_parse_args( $args, $defaults ); $args['id'] = sanitize_html_class( $args['id'] ); if ( ! $args['id'] || ! $args['title'] ) { return; } $this->_help_tabs[ $args['id'] ] = $args; } public function remove_help_tab( $id ) { unset( $this->_help_tabs[ $id ] ); } public function remove_help_tabs() { $this->_help_tabs = array(); } public function get_help_sidebar() { return $this->_help_sidebar; } public function set_help_sidebar( $content ) { $this->_help_sidebar = $content; } public function get_columns() { return $this->columns; } public function get_screen_reader_content() { return $this->_screen_reader_content; } public function get_screen_reader_text( $key ) { if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { return null; } return $this->_screen_reader_content[ $key ]; } public function set_screen_reader_content( $content = array() ) { $defaults = array( 'heading_views' => __( 'Filter items list' ), 'heading_pagination' => __( 'Items list navigation' ), 'heading_list' => __( 'Items list' ), ); $content = wp_parse_args( $content, $defaults ); $this->_screen_reader_content = $content; } public function remove_screen_reader_content() { $this->_screen_reader_content = array(); } public function render_screen_meta() { self::$_old_compat_help = apply_filters_deprecated( 'contextual_help_list', array( self::$_old_compat_help, $this ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; $old_help = apply_filters_deprecated( 'contextual_help', array( $old_help, $this->id, $this ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); if ( empty( $old_help ) && ! $this->get_help_tabs() ) { $default_help = apply_filters_deprecated( 'default_contextual_help', array( '' ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); if ( $default_help ) { $old_help = '

      ' . $default_help . '

      '; } } if ( $old_help ) { $this->add_help_tab( array( 'id' => 'old-contextual-help', 'title' => __( 'Overview' ), 'content' => $old_help, ) ); } $help_sidebar = $this->get_help_sidebar(); $help_class = 'hidden'; if ( ! $help_sidebar ) { $help_class .= ' no-sidebar'; } ?> +
      -.menu-item-title .post-state { - font-weight: 600; -} +
      +
      +
      +
      +
        + get_help_tabs() as $tab ) : $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; ?> -/* Nav Menu */ -#menu-container .inside { - padding-bottom: 10px; -} + + +
      +
      -.menu { - padding-top: 1em; -} + +
      + +
      + -#menu-to-edit { - margin: 0; - padding: 0.1em 0; -} +
      + get_help_tabs() as $tab ) : $panel_id = "tab-panel-{$tab['id']}"; ?> -.menu ul { - width: 100%; -} +
      + +
      + +
      +
      +
      + 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; if ( $this->show_screen_options() ) { $this->render_screen_options(); } ?> +
      + get_help_tabs() && ! $this->show_screen_options() ) { return; } ?> + + _show_screen_options ) ) { return $this->_show_screen_options; } $columns = get_column_headers( $this ); $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); $this->_screen_settings = ''; if ( 'post' === $this->base ) { $expand = ''; $this->_screen_settings = $expand; } $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); if ( $this->_screen_settings || $this->_options ) { $show_screen = true; } $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); return $this->_show_screen_options; } public function render_screen_options( $options = array() ) { $options = wp_parse_args( $options, array( 'wrap' => true, ) ); $wrapper_start = ''; $wrapper_end = ''; $form_start = ''; $form_end = ''; if ( $options['wrap'] ) { $wrapper_start = ''; } if ( 'widgets' !== $this->base ) { $form_start = "\n
      \n"; $form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n
      \n"; } echo $wrapper_start . $form_start; $this->render_meta_boxes_preferences(); $this->render_list_table_columns_preferences(); $this->render_screen_layout(); $this->render_per_page_options(); $this->render_view_mode(); echo $this->_screen_settings; $show_button = apply_filters( 'screen_options_show_submit', false, $this ); if ( $show_button ) { submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true ); } echo $form_end . $wrapper_end; } public function render_meta_boxes_preferences() { global $wp_meta_boxes; if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { return; } ?> +
      + +

      + + +

      + id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { if ( isset( $_GET['welcome'] ) ) { $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); } else { $welcome_checked = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); if ( 2 === $welcome_checked && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) { $welcome_checked = false; } } echo '\n"; } ?> +
      + +
      + + $title ) { if ( in_array( $column, $special, true ) ) { continue; } if ( empty( $title ) ) { continue; } $title = wp_strip_all_tags( $title ); $id = "$column-hide"; echo '\n"; } ?> +
      + get_option( 'layout_columns' ) ) { return; } $screen_layout_columns = $this->get_columns(); $num = $this->get_option( 'layout_columns', 'max' ); ?> +
      + + + + +
      + get_option( 'per_page' ) ) { return; } $per_page_label = $this->get_option( 'per_page', 'label' ); if ( null === $per_page_label ) { $per_page_label = __( 'Number of items per page:' ); } $option = $this->get_option( 'per_page', 'option' ); if ( ! $option ) { $option = str_replace( '-', '_', "{$this->id}_per_page" ); } $per_page = (int) get_user_option( $option ); if ( empty( $per_page ) || $per_page < 1 ) { $per_page = $this->get_option( 'per_page', 'default' ); if ( ! $per_page ) { $per_page = 20; } } if ( 'edit_comments_per_page' === $option ) { $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); } elseif ( 'categories_per_page' === $option ) { $per_page = apply_filters( 'edit_categories_per_page', $per_page ); } else { $per_page = apply_filters( "{$option}", $per_page ); } if ( isset( $this->post_type ) ) { $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); } add_filter( 'screen_options_show_submit', '__return_true' ); ?> +
      + + + + + + +
      + base && 'edit-comments' !== $screen->base ) { return; } $view_mode_post_types = get_post_types( array( 'show_ui' => true ) ); $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) { return; } if ( ! isset( $mode ) ) { $mode = get_user_setting( 'posts_list_mode', 'list' ); } add_filter( 'screen_options_show_submit', '__return_true' ); ?> +
      + + + +
      + _screen_reader_content[ $key ] ) ) { return; } echo "<$tag class='screen-reader-text'>" . $this->_screen_reader_content[ $key ] . ""; } } LocalEcho=$le; $this->Verbose=$verb; $this->_lastaction=NULL; $this->_error_array=array(); $this->_eol_code=array(FTP_OS_Unix=>"\n", FTP_OS_Mac=>"\r", FTP_OS_Windows=>"\r\n"); $this->AuthorizedTransferMode=array(FTP_AUTOASCII, FTP_ASCII, FTP_BINARY); $this->OS_FullName=array(FTP_OS_Unix => 'UNIX', FTP_OS_Windows => 'WINDOWS', FTP_OS_Mac => 'MACOS'); $this->AutoAsciiExt=array("ASP","BAT","C","CPP","CSS","CSV","JS","H","HTM","HTML","SHTML","INI","LOG","PHP3","PHTML","PL","PERL","SH","SQL","TXT"); $this->_port_available=($port_mode==TRUE); $this->SendMSG("Staring FTP client class".($this->_port_available?"":" without PORT mode support")); $this->_connected=FALSE; $this->_ready=FALSE; $this->_can_restore=FALSE; $this->_code=0; $this->_message=""; $this->_ftp_buff_size=4096; $this->_curtype=NULL; $this->SetUmask(0022); $this->SetType(FTP_AUTOASCII); $this->SetTimeout(30); $this->Passive(!$this->_port_available); $this->_login="anonymous"; $this->_password="anon@ftp.com"; $this->_features=array(); $this->OS_local=FTP_OS_Unix; $this->OS_remote=FTP_OS_Unix; $this->features=array(); if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows; elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac; } function ftp_base($port_mode=FALSE) { $this->__construct($port_mode); } function parselisting($line) { $is_windows = ($this->OS_remote == FTP_OS_Windows); if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/",$line,$lucifer)) { $b = array(); if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } $b['isdir'] = ($lucifer[7]==""); if ( $b['isdir'] ) $b['type'] = 'd'; else $b['type'] = 'f'; $b['size'] = $lucifer[7]; $b['month'] = $lucifer[1]; $b['day'] = $lucifer[2]; $b['year'] = $lucifer[3]; $b['hour'] = $lucifer[4]; $b['minute'] = $lucifer[5]; $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]); $b['am/pm'] = $lucifer[6]; $b['name'] = $lucifer[8]; } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) { $lcount=count($lucifer); if ($lcount<8) return ''; $b = array(); $b['isdir'] = $lucifer[0][0] === "d"; $b['islink'] = $lucifer[0][0] === "l"; if ( $b['isdir'] ) $b['type'] = 'd'; elseif ( $b['islink'] ) $b['type'] = 'l'; else $b['type'] = 'f'; $b['perms'] = $lucifer[0]; $b['number'] = $lucifer[1]; $b['owner'] = $lucifer[2]; $b['group'] = $lucifer[3]; $b['size'] = $lucifer[4]; if ($lcount==8) { sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']); sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']); $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']); $b['name'] = $lucifer[7]; } else { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) { $b['year'] = gmdate("Y"); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { $b['year'] = $lucifer[7]; $b['hour'] = 0; $b['minute'] = 0; } $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute'])); $b['name'] = $lucifer[8]; } } return $b; } function SendMSG($message = "", $crlf=true) { if ($this->Verbose) { echo $message.($crlf?CRLF:""); flush(); } return TRUE; } function SetType($mode=FTP_AUTOASCII) { if(!in_array($mode, $this->AuthorizedTransferMode)) { $this->SendMSG("Wrong type"); return FALSE; } $this->_type=$mode; $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) ); return TRUE; } function _settype($mode=FTP_ASCII) { if($this->_ready) { if($mode==FTP_BINARY) { if($this->_curtype!=FTP_BINARY) { if(!$this->_exec("TYPE I", "SetType")) return FALSE; $this->_curtype=FTP_BINARY; } } elseif($this->_curtype!=FTP_ASCII) { if(!$this->_exec("TYPE A", "SetType")) return FALSE; $this->_curtype=FTP_ASCII; } } else return FALSE; return TRUE; } function Passive($pasv=NULL) { if(is_null($pasv)) $this->_passive=!$this->_passive; else $this->_passive=$pasv; if(!$this->_port_available and !$this->_passive) { $this->SendMSG("Only passive connections available!"); $this->_passive=TRUE; return FALSE; } $this->SendMSG("Passive mode ".($this->_passive?"on":"off")); return TRUE; } function SetServer($host, $port=21, $reconnect=true) { if(!is_long($port)) { $this->verbose=true; $this->SendMSG("Incorrect port syntax"); return FALSE; } else { $ip=@gethostbyname($host); $dns=@gethostbyaddr($host); if(!$ip) $ip=$host; if(!$dns) $dns=$host; $ipaslong = ip2long($ip); if ( ($ipaslong == false) || ($ipaslong === -1) ) { $this->SendMSG("Wrong host name/address \"".$host."\""); return FALSE; } $this->_host=$ip; $this->_fullhost=$dns; $this->_port=$port; $this->_dataport=$port-1; } $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\""); if($reconnect){ if($this->_connected) { $this->SendMSG("Reconnecting"); if(!$this->quit(FTP_FORCE)) return FALSE; if(!$this->connect()) return FALSE; } } return TRUE; } function SetUmask($umask=0022) { $this->_umask=$umask; umask($this->_umask); $this->SendMSG("UMASK 0".decoct($this->_umask)); return TRUE; } function SetTimeout($timeout=30) { $this->_timeout=$timeout; $this->SendMSG("Timeout ".$this->_timeout); if($this->_connected) if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE; return TRUE; } function connect($server=NULL) { if(!empty($server)) { if(!$this->SetServer($server)) return false; } if($this->_ready) return true; $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]); if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) { $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\""); return FALSE; } $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting."); do { if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; $this->_lastaction=time(); } while($this->_code<200); $this->_ready=true; $syst=$this->systype(); if(!$syst) $this->SendMSG("Cannot detect remote OS"); else { if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows; elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac; elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix; else $this->OS_remote=FTP_OS_Mac; $this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]); } if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled"); else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); return TRUE; } function quit($force=false) { if($this->_ready) { if(!$this->_exec("QUIT") and !$force) return FALSE; if(!$this->_checkCode() and !$force) return FALSE; $this->_ready=false; $this->SendMSG("Session finished"); } $this->_quit(); return TRUE; } function login($user=NULL, $pass=NULL) { if(!is_null($user)) $this->_login=$user; else $this->_login="anonymous"; if(!is_null($pass)) $this->_password=$pass; else $this->_password="anon@anon.com"; if(!$this->_exec("USER ".$this->_login, "login")) return FALSE; if(!$this->_checkCode()) return FALSE; if($this->_code!=230) { if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE; if(!$this->_checkCode()) return FALSE; } $this->SendMSG("Authentication succeeded"); if(empty($this->_features)) { if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled"); else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); } return TRUE; } function pwd() { if(!$this->_exec("PWD", "pwd")) return FALSE; if(!$this->_checkCode()) return FALSE; return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message); } function cdup() { if(!$this->_exec("CDUP", "cdup")) return FALSE; if(!$this->_checkCode()) return FALSE; return true; } function chdir($pathname) { if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function rmdir($pathname) { if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function mkdir($pathname) { if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function rename($from, $to) { if(!$this->_exec("RNFR ".$from, "rename")) return FALSE; if(!$this->_checkCode()) return FALSE; if($this->_code==350) { if(!$this->_exec("RNTO ".$to, "rename")) return FALSE; if(!$this->_checkCode()) return FALSE; } else return FALSE; return TRUE; } function filesize($pathname) { if(!isset($this->_features["SIZE"])) { $this->PushError("filesize", "not supported by server"); return FALSE; } if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE; if(!$this->_checkCode()) return FALSE; return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); } function abort() { if(!$this->_exec("ABOR", "abort")) return FALSE; if(!$this->_checkCode()) { if($this->_code!=426) return FALSE; if(!$this->_readmsg("abort")) return FALSE; if(!$this->_checkCode()) return FALSE; } return true; } function mdtm($pathname) { if(!isset($this->_features["MDTM"])) { $this->PushError("mdtm", "not supported by server"); return FALSE; } if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE; if(!$this->_checkCode()) return FALSE; $mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); return $timestamp; } function systype() { if(!$this->_exec("SYST", "systype")) return FALSE; if(!$this->_checkCode()) return FALSE; $DATA = explode(" ", $this->_message); return array($DATA[1], $DATA[3]); } function delete($pathname) { if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function site($command, $fnction="site") { if(!$this->_exec("SITE ".$command, $fnction)) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function chmod($pathname, $mode) { if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE; return TRUE; } function restore($from) { if(!isset($this->_features["REST"])) { $this->PushError("restore", "not supported by server"); return FALSE; } if($this->_curtype!=FTP_BINARY) { $this->PushError("restore", "cannot restore in ASCII mode"); return FALSE; } if(!$this->_exec("REST ".$from, "resore")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function features() { if(!$this->_exec("FEAT", "features")) return FALSE; if(!$this->_checkCode()) return FALSE; $f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY); $this->_features=array(); foreach($f as $k=>$v) { $v=explode(" ", trim($v)); $this->_features[array_shift($v)]=$v; } return true; } function rawlist($pathname="", $arg="") { return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist"); } function nlist($pathname="", $arg="") { return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist"); } function is_exists($pathname) { return $this->file_exists($pathname); } function file_exists($pathname) { $exists=true; if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE; else { if(!$this->_checkCode()) $exists=FALSE; $this->abort(); } if($exists) $this->SendMSG("Remote file ".$pathname." exists"); else $this->SendMSG("Remote file ".$pathname." does not exist"); return $exists; } function fget($fp, $remotefile, $rest=0) { if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("RETR ".$remotefile, "get")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $out=$this->_data_read($mode, $fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $out; } function get($remotefile, $localfile=NULL, $rest=0) { if(is_null($localfile)) $localfile=$remotefile; if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten"); $fp = @fopen($localfile, "w"); if (!$fp) { $this->PushError("get","cannot open local file", "Cannot create \"".$localfile."\""); return FALSE; } if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { fclose($fp); return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("RETR ".$remotefile, "get")) { $this->_data_close(); fclose($fp); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); fclose($fp); return FALSE; } $out=$this->_data_read($mode, $fp); fclose($fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $out; } function fput($remotefile, $fp, $rest=0) { if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("STOR ".$remotefile, "put")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ret=$this->_data_write($mode, $fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $ret; } function put($localfile, $remotefile=NULL, $rest=0) { if(is_null($remotefile)) $remotefile=$localfile; if (!file_exists($localfile)) { $this->PushError("put","cannot open local file", "No such file or directory \"".$localfile."\""); return FALSE; } $fp = @fopen($localfile, "r"); if (!$fp) { $this->PushError("put","cannot open local file", "Cannot read file \"".$localfile."\""); return FALSE; } if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($localfile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { fclose($fp); return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("STOR ".$remotefile, "put")) { $this->_data_close(); fclose($fp); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); fclose($fp); return FALSE; } $ret=$this->_data_write($mode, $fp); fclose($fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $ret; } function mput($local=".", $remote=NULL, $continious=false) { $local=realpath($local); if(!@file_exists($local)) { $this->PushError("mput","cannot open local folder", "Cannot stat folder \"".$local."\""); return FALSE; } if(!is_dir($local)) return $this->put($local, $remote); if(empty($remote)) $remote="."; elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE; if($handle = opendir($local)) { $list=array(); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") $list[]=$file; } closedir($handle); } else { $this->PushError("mput","cannot open local folder", "Cannot read folder \"".$local."\""); return FALSE; } if(empty($list)) return TRUE; $ret=true; foreach($list as $el) { if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el); else $t=$this->put($local."/".$el, $remote."/".$el); if(!$t) { $ret=FALSE; if(!$continious) break; } } return $ret; } function mget($remote, $local=".", $continious=false) { $list=$this->rawlist($remote, "-lA"); if($list===false) { $this->PushError("mget","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return FALSE; } if(empty($list)) return true; if(!@file_exists($local)) { if(!@mkdir($local)) { $this->PushError("mget","cannot create local folder", "Cannot create folder \"".$local."\""); return FALSE; } } foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; foreach($list as $el) { if($el["type"]=="d") { if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) { $this->PushError("mget", "cannot copy folder", "Cannot copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } else { if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) { $this->PushError("mget", "cannot copy file", "Cannot copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } @chmod($local."/".$el["name"], $el["perms"]); $t=strtotime($el["date"]); if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t); } return $ret; } function mdel($remote, $continious=false) { $list=$this->rawlist($remote, "-la"); if($list===false) { $this->PushError("mdel","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return false; } foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; foreach($list as $el) { if ( empty($el) ) continue; if($el["type"]=="d") { if(!$this->mdel($remote."/".$el["name"], $continious)) { $ret=false; if(!$continious) break; } } else { if (!$this->delete($remote."/".$el["name"])) { $this->PushError("mdel", "cannot delete file", "Cannot delete remote file \"".$remote."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } } if(!$this->rmdir($remote)) { $this->PushError("mdel", "cannot delete folder", "Cannot delete remote folder \"".$remote."/".$el["name"]."\""); $ret=false; } return $ret; } function mmkdir($dir, $mode = 0777) { if(empty($dir)) return FALSE; if($this->is_exists($dir) or $dir == "/" ) return TRUE; if(!$this->mmkdir(dirname($dir), $mode)) return false; $r=$this->mkdir($dir, $mode); $this->chmod($dir,$mode); return $r; } function glob($pattern, $handle=NULL) { $path=$output=null; if(PHP_OS=='WIN32') $slash='\\'; else $slash='/'; $lastpos=strrpos($pattern,$slash); if(!($lastpos===false)) { $path=substr($pattern,0,-$lastpos-1); $pattern=substr($pattern,$lastpos); } else $path=getcwd(); if(is_array($handle) and !empty($handle)) { foreach($handle as $dir) { if($this->glob_pattern_match($pattern,$dir)) $output[]=$dir; } } else { $handle=@opendir($path); if($handle===false) return false; while($dir=readdir($handle)) { if($this->glob_pattern_match($pattern,$dir)) $output[]=$dir; } closedir($handle); } if(is_array($output)) return $output; return false; } function glob_pattern_match($pattern,$subject) { $out=null; $chunks=explode(';',$pattern); foreach($chunks as $pattern) { $escape=array('$','^','.','{','}','(',')','[',']','|'); while(strpos($pattern,'**')!==false) $pattern=str_replace('**','*',$pattern); foreach($escape as $probe) $pattern=str_replace($probe,"\\$probe",$pattern); $pattern=str_replace('?*','*', str_replace('*?','*', str_replace('*',".*", str_replace('?','.{1,1}',$pattern)))); $out[]=$pattern; } if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject)); else { foreach($out as $tester) if($this->my_regexp("^$tester$",$subject)) return true; } return false; } function glob_regexp($pattern,$subject) { $sensitive=(PHP_OS!='WIN32'); return ($sensitive? preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $subject ) : preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $subject ) ); } function dirlist($remote) { $list=$this->rawlist($remote, "-la"); if($list===false) { $this->PushError("dirlist","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return false; } $dirlist = array(); foreach($list as $k=>$v) { $entry=$this->parselisting($v); if ( empty($entry) ) continue; if($entry["name"]=="." or $entry["name"]=="..") continue; $dirlist[$entry['name']] = $entry; } return $dirlist; } function _checkCode() { return ($this->_code<400 and $this->_code>0); } function _list($arg="", $cmd="LIST", $fnction="_list") { if(!$this->_data_prepare()) return false; if(!$this->_exec($cmd.$arg, $fnction)) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $out=""; if($this->_code<200) { $out=$this->_data_read(); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; if($out === FALSE ) return FALSE; $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY); } return $out; } function PushError($fctname,$msg,$desc=false){ $error=array(); $error['time']=time(); $error['fctname']=$fctname; $error['msg']=$msg; $error['desc']=$desc; if($desc) $tmp=' ('.$desc.')'; else $tmp=''; $this->SendMSG($fctname.': '.$msg.$tmp); return(array_push($this->_error_array,$error)); } function PopError(){ if(count($this->_error_array)) return(array_pop($this->_error_array)); else return(false); } } $mod_sockets = extension_loaded( 'sockets' ); if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) { $prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : ''; @dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX ); $mod_sockets = extension_loaded( 'sockets' ); } require_once __DIR__ . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php"; if ( $mod_sockets ) { class ftp extends ftp_sockets {} } else { class ftp extends ftp_pure {} } $update ) { if ( 'upgrade' === $update->response ) { $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version ); } else { $core_update_needed = ''; } } } $info = array(); $info['wp-core'] = array( 'label' => __( 'WordPress' ), 'fields' => array( 'version' => array( 'label' => __( 'Version' ), 'value' => $core_version . $core_update_needed, 'debug' => $core_version, ), 'site_language' => array( 'label' => __( 'Site Language' ), 'value' => get_locale(), ), 'user_language' => array( 'label' => __( 'User Language' ), 'value' => get_user_locale(), ), 'timezone' => array( 'label' => __( 'Timezone' ), 'value' => wp_timezone_string(), ), 'home_url' => array( 'label' => __( 'Home URL' ), 'value' => get_bloginfo( 'url' ), 'private' => true, ), 'site_url' => array( 'label' => __( 'Site URL' ), 'value' => get_bloginfo( 'wpurl' ), 'private' => true, ), 'permalink' => array( 'label' => __( 'Permalink structure' ), 'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ), 'debug' => $permalink_structure, ), 'https_status' => array( 'label' => __( 'Is this site using HTTPS?' ), 'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ), 'debug' => $is_ssl, ), 'multisite' => array( 'label' => __( 'Is this a multisite?' ), 'value' => $is_multisite ? __( 'Yes' ) : __( 'No' ), 'debug' => $is_multisite, ), 'user_registration' => array( 'label' => __( 'Can anyone register on this site?' ), 'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ), 'debug' => $users_can_register, ), 'blog_public' => array( 'label' => __( 'Is this site discouraging search engines?' ), 'value' => $blog_public ? __( 'No' ) : __( 'Yes' ), 'debug' => $blog_public, ), 'default_comment_status' => array( 'label' => __( 'Default comment status' ), 'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ), 'debug' => $default_comment_status, ), 'environment_type' => array( 'label' => __( 'Environment type' ), 'value' => $environment_type, 'debug' => $environment_type, ), ), ); if ( ! $is_multisite ) { $info['wp-paths-sizes'] = array( 'label' => __( 'Directories and Sizes' ), 'fields' => array(), ); } $info['wp-dropins'] = array( 'label' => __( 'Drop-ins' ), 'show_count' => true, 'description' => sprintf( __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), '' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '' ), 'fields' => array(), ); $info['wp-active-theme'] = array( 'label' => __( 'Active Theme' ), 'fields' => array(), ); $info['wp-parent-theme'] = array( 'label' => __( 'Parent Theme' ), 'fields' => array(), ); $info['wp-themes-inactive'] = array( 'label' => __( 'Inactive Themes' ), 'show_count' => true, 'fields' => array(), ); $info['wp-mu-plugins'] = array( 'label' => __( 'Must Use Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-plugins-active'] = array( 'label' => __( 'Active Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-plugins-inactive'] = array( 'label' => __( 'Inactive Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-media'] = array( 'label' => __( 'Media Handling' ), 'fields' => array(), ); $info['wp-server'] = array( 'label' => __( 'Server' ), 'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.' ), 'fields' => array(), ); $info['wp-database'] = array( 'label' => __( 'Database' ), 'fields' => array(), ); $wp_debug_log_value = __( 'Disabled' ); if ( is_string( WP_DEBUG_LOG ) ) { $wp_debug_log_value = WP_DEBUG_LOG; } elseif ( WP_DEBUG_LOG ) { $wp_debug_log_value = __( 'Enabled' ); } if ( defined( 'CONCATENATE_SCRIPTS' ) ) { $concatenate_scripts = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); $concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false'; } else { $concatenate_scripts = __( 'Undefined' ); $concatenate_scripts_debug = 'undefined'; } if ( defined( 'COMPRESS_SCRIPTS' ) ) { $compress_scripts = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); $compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false'; } else { $compress_scripts = __( 'Undefined' ); $compress_scripts_debug = 'undefined'; } if ( defined( 'COMPRESS_CSS' ) ) { $compress_css = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' ); $compress_css_debug = COMPRESS_CSS ? 'true' : 'false'; } else { $compress_css = __( 'Undefined' ); $compress_css_debug = 'undefined'; } if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) { $wp_environment_type = WP_ENVIRONMENT_TYPE; } else { $wp_environment_type = __( 'Undefined' ); } $info['wp-constants'] = array( 'label' => __( 'WordPress Constants' ), 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ), 'fields' => array( 'ABSPATH' => array( 'label' => 'ABSPATH', 'value' => ABSPATH, 'private' => true, ), 'WP_HOME' => array( 'label' => 'WP_HOME', 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ), 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ), ), 'WP_SITEURL' => array( 'label' => 'WP_SITEURL', 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ), 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ), ), 'WP_CONTENT_DIR' => array( 'label' => 'WP_CONTENT_DIR', 'value' => WP_CONTENT_DIR, ), 'WP_PLUGIN_DIR' => array( 'label' => 'WP_PLUGIN_DIR', 'value' => WP_PLUGIN_DIR, ), 'WP_MEMORY_LIMIT' => array( 'label' => 'WP_MEMORY_LIMIT', 'value' => WP_MEMORY_LIMIT, ), 'WP_MAX_MEMORY_LIMIT' => array( 'label' => 'WP_MAX_MEMORY_LIMIT', 'value' => WP_MAX_MEMORY_LIMIT, ), 'WP_DEBUG' => array( 'label' => 'WP_DEBUG', 'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_DEBUG, ), 'WP_DEBUG_DISPLAY' => array( 'label' => 'WP_DEBUG_DISPLAY', 'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_DEBUG_DISPLAY, ), 'WP_DEBUG_LOG' => array( 'label' => 'WP_DEBUG_LOG', 'value' => $wp_debug_log_value, 'debug' => WP_DEBUG_LOG, ), 'SCRIPT_DEBUG' => array( 'label' => 'SCRIPT_DEBUG', 'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => SCRIPT_DEBUG, ), 'WP_CACHE' => array( 'label' => 'WP_CACHE', 'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_CACHE, ), 'CONCATENATE_SCRIPTS' => array( 'label' => 'CONCATENATE_SCRIPTS', 'value' => $concatenate_scripts, 'debug' => $concatenate_scripts_debug, ), 'COMPRESS_SCRIPTS' => array( 'label' => 'COMPRESS_SCRIPTS', 'value' => $compress_scripts, 'debug' => $compress_scripts_debug, ), 'COMPRESS_CSS' => array( 'label' => 'COMPRESS_CSS', 'value' => $compress_css, 'debug' => $compress_css_debug, ), 'WP_ENVIRONMENT_TYPE' => array( 'label' => 'WP_ENVIRONMENT_TYPE', 'value' => $wp_environment_type, 'debug' => $wp_environment_type, ), 'DB_CHARSET' => array( 'label' => 'DB_CHARSET', 'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ), 'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ), ), 'DB_COLLATE' => array( 'label' => 'DB_COLLATE', 'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ), 'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ), ), ), ); $is_writable_abspath = wp_is_writable( ABSPATH ); $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); $info['wp-filesystem'] = array( 'label' => __( 'Filesystem Permissions' ), 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ), 'fields' => array( 'wordpress' => array( 'label' => __( 'The main WordPress directory' ), 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ), ), 'wp-content' => array( 'label' => __( 'The wp-content directory' ), 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ), ), 'uploads' => array( 'label' => __( 'The uploads directory' ), 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ), ), 'plugins' => array( 'label' => __( 'The plugins directory' ), 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ), ), 'themes' => array( 'label' => __( 'The themes directory' ), 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ), ), ), ); if ( is_multisite() ) { $network_query = new WP_Network_Query(); $network_ids = $network_query->query( array( 'fields' => 'ids', 'number' => 100, 'no_found_rows' => false, ) ); $site_count = 0; foreach ( $network_ids as $network_id ) { $site_count += get_blog_count( $network_id ); } $info['wp-core']['fields']['site_count'] = array( 'label' => __( 'Site count' ), 'value' => $site_count, ); $info['wp-core']['fields']['network_count'] = array( 'label' => __( 'Network count' ), 'value' => $network_query->found_networks, ); } $info['wp-core']['fields']['user_count'] = array( 'label' => __( 'User count' ), 'value' => get_user_count(), ); $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) ); if ( ! is_wp_error( $wp_dotorg ) ) { $info['wp-core']['fields']['dotorg_communication'] = array( 'label' => __( 'Communication with WordPress.org' ), 'value' => __( 'WordPress.org is reachable' ), 'debug' => 'true', ); } else { $info['wp-core']['fields']['dotorg_communication'] = array( 'label' => __( 'Communication with WordPress.org' ), 'value' => sprintf( __( 'Unable to reach WordPress.org at %1$s: %2$s' ), gethostbyname( 'wordpress.org' ), $wp_dotorg->get_error_message() ), 'debug' => $wp_dotorg->get_error_message(), ); } if ( ! $is_multisite ) { $loading = __( 'Loading…' ); $info['wp-paths-sizes']['fields'] = array( 'wordpress_path' => array( 'label' => __( 'WordPress directory location' ), 'value' => untrailingslashit( ABSPATH ), ), 'wordpress_size' => array( 'label' => __( 'WordPress directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'uploads_path' => array( 'label' => __( 'Uploads directory location' ), 'value' => $upload_dir['basedir'], ), 'uploads_size' => array( 'label' => __( 'Uploads directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'themes_path' => array( 'label' => __( 'Themes directory location' ), 'value' => get_theme_root(), ), 'themes_size' => array( 'label' => __( 'Themes directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'plugins_path' => array( 'label' => __( 'Plugins directory location' ), 'value' => WP_PLUGIN_DIR, ), 'plugins_size' => array( 'label' => __( 'Plugins directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'database_size' => array( 'label' => __( 'Database size' ), 'value' => $loading, 'debug' => 'loading...', ), 'total_size' => array( 'label' => __( 'Total installation size' ), 'value' => $loading, 'debug' => 'loading...', ), ); } $dropins = get_dropins(); $dropin_descriptions = _get_dropins(); $not_available = __( 'Not available' ); foreach ( $dropins as $dropin_key => $dropin ) { $info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array( 'label' => $dropin_key, 'value' => $dropin_descriptions[ $dropin_key ][0], 'debug' => 'true', ); } $info['wp-media']['fields']['image_editor'] = array( 'label' => __( 'Active editor' ), 'value' => _wp_image_editor_choose(), ); if ( class_exists( 'Imagick' ) ) { $imagick = new Imagick(); $imagemagick_version = $imagick->getVersion(); } else { $imagemagick_version = __( 'Not available' ); } $info['wp-media']['fields']['imagick_module_version'] = array( 'label' => __( 'ImageMagick version number' ), 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ), ); $info['wp-media']['fields']['imagemagick_version'] = array( 'label' => __( 'ImageMagick version string' ), 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ), ); $imagick_version = phpversion( 'imagick' ); $info['wp-media']['fields']['imagick_version'] = array( 'label' => __( 'Imagick version' ), 'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ), ); if ( ! function_exists( 'ini_get' ) ) { $info['wp-media']['fields']['ini_get'] = array( 'label' => __( 'File upload settings' ), 'value' => sprintf( __( 'Unable to determine some settings, as the %s function has been disabled.' ), 'ini_get()' ), 'debug' => 'ini_get() is disabled', ); } else { $post_max_size = ini_get( 'post_max_size' ); $upload_max_filesize = ini_get( 'upload_max_filesize' ); $max_file_uploads = ini_get( 'max_file_uploads' ); $effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) ); $info['wp-media']['fields']['file_uploads'] = array( 'label' => __( 'File uploads' ), 'value' => empty( ini_get( 'file_uploads' ) ) ? __( 'Disabled' ) : __( 'Enabled' ), 'debug' => 'File uploads is turned off', ); $info['wp-media']['fields']['post_max_size'] = array( 'label' => __( 'Max size of post data allowed' ), 'value' => $post_max_size, ); $info['wp-media']['fields']['upload_max_filesize'] = array( 'label' => __( 'Max size of an uploaded file' ), 'value' => $upload_max_filesize, ); $info['wp-media']['fields']['max_effective_size'] = array( 'label' => __( 'Max effective file size' ), 'value' => size_format( $effective ), ); $info['wp-media']['fields']['max_file_uploads'] = array( 'label' => __( 'Max number of files allowed' ), 'value' => number_format( $max_file_uploads ), ); } if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) { $limits = array( 'area' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : $not_available ), 'disk' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : $not_available ), 'file' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : $not_available ), 'map' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : $not_available ), 'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : $not_available ), 'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : $not_available ), ); $limits_debug = array( 'imagick::RESOURCETYPE_AREA' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : 'not available' ), 'imagick::RESOURCETYPE_DISK' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : 'not available' ), 'imagick::RESOURCETYPE_FILE' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : 'not available' ), 'imagick::RESOURCETYPE_MAP' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : 'not available' ), 'imagick::RESOURCETYPE_MEMORY' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : 'not available' ), 'imagick::RESOURCETYPE_THREAD' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : 'not available' ), ); $info['wp-media']['fields']['imagick_limits'] = array( 'label' => __( 'Imagick Resource Limits' ), 'value' => $limits, 'debug' => $limits_debug, ); try { $formats = Imagick::queryFormats( '*' ); } catch ( Exception $e ) { $formats = array(); } $info['wp-media']['fields']['imagemagick_file_formats'] = array( 'label' => __( 'ImageMagick supported file formats' ), 'value' => ( empty( $formats ) ) ? __( 'Unable to determine' ) : implode( ', ', $formats ), 'debug' => ( empty( $formats ) ) ? 'Unable to determine' : implode( ', ', $formats ), ); } if ( function_exists( 'gd_info' ) ) { $gd = gd_info(); } else { $gd = false; } $info['wp-media']['fields']['gd_version'] = array( 'label' => __( 'GD version' ), 'value' => ( is_array( $gd ) ? $gd['GD Version'] : $not_available ), 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ), ); $gd_image_formats = array(); $gd_supported_formats = array( 'GIF Create' => 'GIF', 'JPEG' => 'JPEG', 'PNG' => 'PNG', 'WebP' => 'WebP', 'BMP' => 'BMP', 'AVIF' => 'AVIF', 'HEIF' => 'HEIF', 'TIFF' => 'TIFF', 'XPM' => 'XPM', ); foreach ( $gd_supported_formats as $format_key => $format ) { $index = $format_key . ' Support'; if ( isset( $gd[ $index ] ) && $gd[ $index ] ) { array_push( $gd_image_formats, $format ); } } if ( ! empty( $gd_image_formats ) ) { $info['wp-media']['fields']['gd_formats'] = array( 'label' => __( 'GD supported file formats' ), 'value' => implode( ', ', $gd_image_formats ), ); } if ( function_exists( 'exec' ) ) { $gs = exec( 'gs --version' ); if ( empty( $gs ) ) { $gs = $not_available; $gs_debug = 'not available'; } else { $gs_debug = $gs; } } else { $gs = __( 'Unable to determine if Ghostscript is installed' ); $gs_debug = 'unknown'; } $info['wp-media']['fields']['ghostscript_version'] = array( 'label' => __( 'Ghostscript version' ), 'value' => $gs, 'debug' => $gs_debug, ); if ( function_exists( 'php_uname' ) ) { $server_architecture = sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) ); } else { $server_architecture = 'unknown'; } if ( function_exists( 'phpversion' ) ) { $php_version_debug = phpversion(); $php64bit = ( PHP_INT_SIZE * 8 === 64 ); $php_version = sprintf( '%s %s', $php_version_debug, ( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) ) ); if ( $php64bit ) { $php_version_debug .= ' 64bit'; } } else { $php_version = __( 'Unable to determine PHP version' ); $php_version_debug = 'unknown'; } if ( function_exists( 'php_sapi_name' ) ) { $php_sapi = php_sapi_name(); } else { $php_sapi = 'unknown'; } $info['wp-server']['fields']['server_architecture'] = array( 'label' => __( 'Server architecture' ), 'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ), 'debug' => $server_architecture, ); $info['wp-server']['fields']['httpd_software'] = array( 'label' => __( 'Web server' ), 'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ), 'debug' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown' ), ); $info['wp-server']['fields']['php_version'] = array( 'label' => __( 'PHP version' ), 'value' => $php_version, 'debug' => $php_version_debug, ); $info['wp-server']['fields']['php_sapi'] = array( 'label' => __( 'PHP SAPI' ), 'value' => ( 'unknown' !== $php_sapi ? $php_sapi : __( 'Unable to determine PHP SAPI' ) ), 'debug' => $php_sapi, ); if ( ! function_exists( 'ini_get' ) ) { $info['wp-server']['fields']['ini_get'] = array( 'label' => __( 'Server settings' ), 'value' => sprintf( __( 'Unable to determine some settings, as the %s function has been disabled.' ), 'ini_get()' ), 'debug' => 'ini_get() is disabled', ); } else { $info['wp-server']['fields']['max_input_variables'] = array( 'label' => __( 'PHP max input variables' ), 'value' => ini_get( 'max_input_vars' ), ); $info['wp-server']['fields']['time_limit'] = array( 'label' => __( 'PHP time limit' ), 'value' => ini_get( 'max_execution_time' ), ); if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) { $info['wp-server']['fields']['memory_limit'] = array( 'label' => __( 'PHP memory limit' ), 'value' => WP_Site_Health::get_instance()->php_memory_limit, ); $info['wp-server']['fields']['admin_memory_limit'] = array( 'label' => __( 'PHP memory limit (only for admin screens)' ), 'value' => ini_get( 'memory_limit' ), ); } else { $info['wp-server']['fields']['memory_limit'] = array( 'label' => __( 'PHP memory limit' ), 'value' => ini_get( 'memory_limit' ), ); } $info['wp-server']['fields']['max_input_time'] = array( 'label' => __( 'Max input time' ), 'value' => ini_get( 'max_input_time' ), ); $info['wp-server']['fields']['upload_max_filesize'] = array( 'label' => __( 'Upload max filesize' ), 'value' => ini_get( 'upload_max_filesize' ), ); $info['wp-server']['fields']['php_post_max_size'] = array( 'label' => __( 'PHP post max size' ), 'value' => ini_get( 'post_max_size' ), ); } if ( function_exists( 'curl_version' ) ) { $curl = curl_version(); $info['wp-server']['fields']['curl_version'] = array( 'label' => __( 'cURL version' ), 'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ), ); } else { $info['wp-server']['fields']['curl_version'] = array( 'label' => __( 'cURL version' ), 'value' => $not_available, 'debug' => 'not available', ); } $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ); $info['wp-server']['fields']['suhosin'] = array( 'label' => __( 'Is SUHOSIN installed?' ), 'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $suhosin_loaded, ); $imagick_loaded = extension_loaded( 'imagick' ); $info['wp-server']['fields']['imagick_availability'] = array( 'label' => __( 'Is the Imagick library available?' ), 'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $imagick_loaded, ); $pretty_permalinks_supported = got_url_rewrite(); $info['wp-server']['fields']['pretty_permalinks'] = array( 'label' => __( 'Are pretty permalinks supported?' ), 'value' => ( $pretty_permalinks_supported ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $pretty_permalinks_supported, ); if ( is_file( ABSPATH . '.htaccess' ) ) { $htaccess_content = file_get_contents( ABSPATH . '.htaccess' ); $filtered_htaccess_content = trim( preg_replace( '/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content ) ); $filtered_htaccess_content = ! empty( $filtered_htaccess_content ); if ( $filtered_htaccess_content ) { $htaccess_rules_string = sprintf( __( 'Custom rules have been added to your %s file.' ), '.htaccess' ); } else { $htaccess_rules_string = sprintf( __( 'Your %s file contains only core WordPress features.' ), '.htaccess' ); } $info['wp-server']['fields']['htaccess_extra_rules'] = array( 'label' => __( '.htaccess rules' ), 'value' => $htaccess_rules_string, 'debug' => $filtered_htaccess_content, ); } if ( is_resource( $wpdb->dbh ) ) { $extension = 'mysql'; } elseif ( is_object( $wpdb->dbh ) ) { $extension = get_class( $wpdb->dbh ); } else { $extension = null; } $server = $wpdb->get_var( 'SELECT VERSION()' ); if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { $client_version = $wpdb->dbh->client_info; } else { if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) { $client_version = $matches[0]; } else { $client_version = null; } } $info['wp-database']['fields']['extension'] = array( 'label' => __( 'Extension' ), 'value' => $extension, ); $info['wp-database']['fields']['server_version'] = array( 'label' => __( 'Server version' ), 'value' => $server, ); $info['wp-database']['fields']['client_version'] = array( 'label' => __( 'Client version' ), 'value' => $client_version, ); $info['wp-database']['fields']['database_user'] = array( 'label' => __( 'Database username' ), 'value' => $wpdb->dbuser, 'private' => true, ); $info['wp-database']['fields']['database_host'] = array( 'label' => __( 'Database host' ), 'value' => $wpdb->dbhost, 'private' => true, ); $info['wp-database']['fields']['database_name'] = array( 'label' => __( 'Database name' ), 'value' => $wpdb->dbname, 'private' => true, ); $info['wp-database']['fields']['database_prefix'] = array( 'label' => __( 'Table prefix' ), 'value' => $wpdb->prefix, 'private' => true, ); $info['wp-database']['fields']['database_charset'] = array( 'label' => __( 'Database charset' ), 'value' => $wpdb->charset, 'private' => true, ); $info['wp-database']['fields']['database_collate'] = array( 'label' => __( 'Database collation' ), 'value' => $wpdb->collate, 'private' => true, ); $info['wp-database']['fields']['max_allowed_packet'] = array( 'label' => __( 'Max allowed packet size' ), 'value' => self::get_mysql_var( 'max_allowed_packet' ), ); $info['wp-database']['fields']['max_connections'] = array( 'label' => __( 'Max connections number' ), 'value' => self::get_mysql_var( 'max_connections' ), ); $mu_plugins = get_mu_plugins(); foreach ( $mu_plugins as $plugin_path => $plugin ) { $plugin_version = $plugin['Version']; $plugin_author = $plugin['Author']; $plugin_version_string = __( 'No version or author information is available.' ); $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); } else { if ( ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); } if ( ! empty( $plugin_version ) ) { $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); } } $info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( 'label' => $plugin['Name'], 'value' => $plugin_version_string, 'debug' => $plugin_version_string_debug, ); } $plugins = get_plugins(); $plugin_updates = get_plugin_updates(); $transient = get_site_transient( 'update_plugins' ); $auto_updates = array(); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); } foreach ( $plugins as $plugin_path => $plugin ) { $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive'; $plugin_version = $plugin['Version']; $plugin_author = $plugin['Author']; $plugin_version_string = __( 'No version or author information is available.' ); $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); } else { if ( ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); } if ( ! empty( $plugin_version ) ) { $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); } } if ( array_key_exists( $plugin_path, $plugin_updates ) ) { $plugin_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version ); $plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $plugin_path ] ) ) { $item = $transient->response[ $plugin_path ]; } elseif ( isset( $transient->no_update[ $plugin_path ] ) ) { $item = $transient->no_update[ $plugin_path ]; } else { $item = array( 'id' => $plugin_path, 'slug' => '', 'plugin' => $plugin_path, 'new_version' => '', 'url' => '', 'package' => '', 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'requires_php' => '', 'compatibility' => new stdClass(), ); $item = wp_parse_args( $plugin, $item ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $plugin_path, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Auto-updates enabled' ); } else { $auto_updates_string = __( 'Auto-updates disabled' ); } $auto_updates_string = apply_filters( 'plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled ); $plugin_version_string .= ' | ' . $auto_updates_string; $plugin_version_string_debug .= ', ' . $auto_updates_string; } $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( 'label' => $plugin['Name'], 'value' => $plugin_version_string, 'debug' => $plugin_version_string_debug, ); } global $_wp_theme_features; $theme_features = array(); if ( ! empty( $_wp_theme_features ) ) { foreach ( $_wp_theme_features as $feature => $options ) { $theme_features[] = $feature; } } $active_theme = wp_get_theme(); $theme_updates = get_theme_updates(); $transient = get_site_transient( 'update_themes' ); $active_theme_version = $active_theme->version; $active_theme_version_debug = $active_theme_version; $auto_updates = array(); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) { $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version']; $active_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version ); $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version ); } $active_theme_author_uri = $active_theme->display( 'AuthorURI' ); if ( $active_theme->parent_theme ) { $active_theme_parent_theme = sprintf( __( '%1$s (%2$s)' ), $active_theme->parent_theme, $active_theme->template ); $active_theme_parent_theme_debug = sprintf( '%s (%s)', $active_theme->parent_theme, $active_theme->template ); } else { $active_theme_parent_theme = __( 'None' ); $active_theme_parent_theme_debug = 'none'; } $info['wp-active-theme']['fields'] = array( 'name' => array( 'label' => __( 'Name' ), 'value' => sprintf( __( '%1$s (%2$s)' ), $active_theme->name, $active_theme->stylesheet ), ), 'version' => array( 'label' => __( 'Version' ), 'value' => $active_theme_version, 'debug' => $active_theme_version_debug, ), 'author' => array( 'label' => __( 'Author' ), 'value' => wp_kses( $active_theme->author, array() ), ), 'author_website' => array( 'label' => __( 'Author website' ), 'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ), 'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ), ), 'parent_theme' => array( 'label' => __( 'Parent theme' ), 'value' => $active_theme_parent_theme, 'debug' => $active_theme_parent_theme_debug, ), 'theme_features' => array( 'label' => __( 'Theme features' ), 'value' => implode( ', ', $theme_features ), ), 'theme_path' => array( 'label' => __( 'Theme directory location' ), 'value' => get_stylesheet_directory(), ), ); if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $active_theme->stylesheet ] ) ) { $item = $transient->response[ $active_theme->stylesheet ]; } elseif ( isset( $transient->no_update[ $active_theme->stylesheet ] ) ) { $item = $transient->no_update[ $active_theme->stylesheet ]; } else { $item = array( 'theme' => $active_theme->stylesheet, 'new_version' => $active_theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $active_theme->stylesheet, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Enabled' ); } else { $auto_updates_string = __( 'Disabled' ); } $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled ); $info['wp-active-theme']['fields']['auto_update'] = array( 'label' => __( 'Auto-updates' ), 'value' => $auto_updates_string, 'debug' => $auto_updates_string, ); } $parent_theme = $active_theme->parent(); if ( $parent_theme ) { $parent_theme_version = $parent_theme->version; $parent_theme_version_debug = $parent_theme_version; if ( array_key_exists( $parent_theme->stylesheet, $theme_updates ) ) { $parent_theme_update_new_version = $theme_updates[ $parent_theme->stylesheet ]->update['new_version']; $parent_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $parent_theme_update_new_version ); $parent_theme_version_debug .= sprintf( ' (latest version: %s)', $parent_theme_update_new_version ); } $parent_theme_author_uri = $parent_theme->display( 'AuthorURI' ); $info['wp-parent-theme']['fields'] = array( 'name' => array( 'label' => __( 'Name' ), 'value' => sprintf( __( '%1$s (%2$s)' ), $parent_theme->name, $parent_theme->stylesheet ), ), 'version' => array( 'label' => __( 'Version' ), 'value' => $parent_theme_version, 'debug' => $parent_theme_version_debug, ), 'author' => array( 'label' => __( 'Author' ), 'value' => wp_kses( $parent_theme->author, array() ), ), 'author_website' => array( 'label' => __( 'Author website' ), 'value' => ( $parent_theme_author_uri ? $parent_theme_author_uri : __( 'Undefined' ) ), 'debug' => ( $parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)' ), ), 'theme_path' => array( 'label' => __( 'Theme directory location' ), 'value' => get_template_directory(), ), ); if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) { $item = $transient->response[ $parent_theme->stylesheet ]; } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) { $item = $transient->no_update[ $parent_theme->stylesheet ]; } else { $item = array( 'theme' => $parent_theme->stylesheet, 'new_version' => $parent_theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true ); } if ( $enabled ) { $parent_theme_auto_update_string = __( 'Enabled' ); } else { $parent_theme_auto_update_string = __( 'Disabled' ); } $parent_theme_auto_update_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $parent_theme, $enabled ); $info['wp-parent-theme']['fields']['auto_update'] = array( 'label' => __( 'Auto-update' ), 'value' => $parent_theme_auto_update_string, 'debug' => $parent_theme_auto_update_string, ); } } $all_themes = wp_get_themes(); foreach ( $all_themes as $theme_slug => $theme ) { if ( $active_theme->stylesheet === $theme_slug ) { continue; } if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) { continue; } $theme_version = $theme->version; $theme_author = $theme->author; $theme_author = wp_kses( $theme_author, array() ); $theme_version_string = __( 'No version or author information is available.' ); $theme_version_string_debug = 'undefined'; if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) { $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author ); $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author ); } else { if ( ! empty( $theme_author ) ) { $theme_version_string = sprintf( __( 'By %s' ), $theme_author ); $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author ); } if ( ! empty( $theme_version ) ) { $theme_version_string = sprintf( __( 'Version %s' ), $theme_version ); $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version ); } } if ( array_key_exists( $theme_slug, $theme_updates ) ) { $theme_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] ); $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $theme_slug ] ) ) { $item = $transient->response[ $theme_slug ]; } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) { $item = $transient->no_update[ $theme_slug ]; } else { $item = array( 'theme' => $theme_slug, 'new_version' => $theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $theme_slug, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Auto-updates enabled' ); } else { $auto_updates_string = __( 'Auto-updates disabled' ); } $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled ); $theme_version_string .= ' | ' . $auto_updates_string; $theme_version_string_debug .= ', ' . $auto_updates_string; } $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array( 'label' => sprintf( __( '%1$s (%2$s)' ), $theme->name, $theme_slug ), 'value' => $theme_version_string, 'debug' => $theme_version_string_debug, ); } if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); $info['wp-filesystem']['fields']['mu-plugins'] = array( 'label' => __( 'The must use plugins directory' ), 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ), ); } $info = apply_filters( 'debug_information', $info ); return $info; } public static function get_mysql_var( $mysql_var ) { global $wpdb; $result = $wpdb->get_row( $wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ), ARRAY_A ); if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) { return $result['Value']; } return null; } public static function format( $info_array, $data_type ) { $return = "`\n"; foreach ( $info_array as $section => $details ) { if ( empty( $details['fields'] ) || ( isset( $details['private'] ) && $details['private'] ) ) { continue; } $section_label = 'debug' === $data_type ? $section : $details['label']; $return .= sprintf( "### %s%s ###\n\n", $section_label, ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' ) ); foreach ( $details['fields'] as $field_name => $field ) { if ( isset( $field['private'] ) && true === $field['private'] ) { continue; } if ( 'debug' === $data_type && isset( $field['debug'] ) ) { $debug_data = $field['debug']; } else { $debug_data = $field['value']; } if ( is_array( $debug_data ) ) { $value = ''; foreach ( $debug_data as $sub_field_name => $sub_field_value ) { $value .= sprintf( "\n\t%s: %s", $sub_field_name, $sub_field_value ); } } elseif ( is_bool( $debug_data ) ) { $value = $debug_data ? 'true' : 'false'; } elseif ( empty( $debug_data ) && '0' !== $debug_data ) { $value = 'undefined'; } else { $value = $debug_data; } if ( 'debug' === $data_type ) { $label = $field_name; } else { $label = $field['label']; } $return .= sprintf( "%s: %s\n", $label, $value ); } $return .= "\n"; } $return .= '`'; return $return; } public static function get_database_size() { global $wpdb; $size = 0; $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A ); if ( $wpdb->num_rows > 0 ) { foreach ( $rows as $row ) { $size += $row['Data_length'] + $row['Index_length']; } } return (int) $size; } public static function get_sizes() { $size_db = self::get_database_size(); $upload_dir = wp_get_upload_dir(); if ( function_exists( 'ini_get' ) ) { $max_execution_time = ini_get( 'max_execution_time' ); } if ( empty( $max_execution_time ) ) { $max_execution_time = 30; } if ( $max_execution_time > 20 ) { $max_execution_time -= 2; } $paths = array( 'wordpress_size' => untrailingslashit( ABSPATH ), 'themes_size' => get_theme_root(), 'plugins_size' => WP_PLUGIN_DIR, 'uploads_size' => $upload_dir['basedir'], ); $exclude = $paths; unset( $exclude['wordpress_size'] ); $exclude = array_values( $exclude ); $size_total = 0; $all_sizes = array(); foreach ( $paths as $name => $path ) { $dir_size = null; $results = array( 'path' => $path, 'raw' => 0, ); if ( microtime( true ) - WP_START_TIMESTAMP < $max_execution_time ) { if ( 'wordpress_size' === $name ) { $dir_size = recurse_dirsize( $path, $exclude, $max_execution_time ); } else { $dir_size = recurse_dirsize( $path, null, $max_execution_time ); } } if ( false === $dir_size ) { $results['size'] = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' ); $results['debug'] = 'not accessible'; $size_total = null; } elseif ( null === $dir_size ) { $results['size'] = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' ); $results['debug'] = 'timeout while calculating size'; $size_total = null; } else { if ( null !== $size_total ) { $size_total += $dir_size; } $results['raw'] = $dir_size; $results['size'] = size_format( $dir_size, 2 ); $results['debug'] = $results['size'] . " ({$dir_size} bytes)"; } $all_sizes[ $name ] = $results; } if ( $size_db > 0 ) { $database_size = size_format( $size_db, 2 ); $all_sizes['database_size'] = array( 'raw' => $size_db, 'size' => $database_size, 'debug' => $database_size . " ({$size_db} bytes)", ); } else { $all_sizes['database_size'] = array( 'size' => __( 'Not available' ), 'debug' => 'not available', ); } if ( null !== $size_total && $size_db > 0 ) { $total_size = $size_total + $size_db; $total_size_mb = size_format( $total_size, 2 ); $all_sizes['total_size'] = array( 'raw' => $total_size, 'size' => $total_size_mb, 'debug' => $total_size_mb . " ({$total_size} bytes)", ); } else { $all_sizes['total_size'] = array( 'size' => __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ), 'debug' => 'not available', ); } return $all_sizes; } } 0) ); if ( $categories ) { foreach ( $categories as $category ) { if ( $current_cat != $category->term_id && $category_parent == $category->parent) { $pad = str_repeat( '– ', $level ); $category->name = esc_html( $category->name ); echo "\n\t"; wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories ); } } } else { return false; } } function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' ); register_setting( $option_group, $option_name, $sanitize_callback ); } function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' ); unregister_setting( $option_group, $option_name, $sanitize_callback ); } function codepress_get_lang( $filename ) { _deprecated_function( __FUNCTION__, '3.0.0' ); } function codepress_footer_js() { _deprecated_function( __FUNCTION__, '3.0.0' ); } function use_codepress() { _deprecated_function( __FUNCTION__, '3.0.0' ); } function get_author_user_ids() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); } function get_editable_authors( $user_id ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( !$editable ) { return false; } else { $editable = join(',', $editable); $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); } return apply_filters('get_editable_authors', $authors); } function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( ! $user = get_userdata( $user_id ) ) return array(); $post_type_obj = get_post_type_object($post_type); if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) return array($user->ID); else return array(); } if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); if ( $exclude_zeros ) $query .= " AND meta_value != '0'"; return $wpdb->get_col( $query ); } function get_nonauthor_user_ids() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); } if ( ! class_exists( 'WP_User_Search', false ) ) : class WP_User_Search { var $results; var $search_term; var $page; var $role; var $raw_page; var $users_per_page = 50; var $first_user; var $last_user; var $query_limit; var $query_orderby; var $query_from; var $query_where; var $total_users_for_query = 0; var $too_many_total_users = false; var $search_errors; var $paging_text; function __construct( $search_term = '', $page = '', $role = '' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' ); $this->search_term = wp_unslash( $search_term ); $this->raw_page = ( '' == $page ) ? false : (int) $page; $this->page = ( '' == $page ) ? 1 : (int) $page; $this->role = $role; $this->prepare_query(); $this->query(); $this->do_paging(); } public function WP_User_Search( $search_term = '', $page = '', $role = '' ) { self::__construct( $search_term, $page, $role ); } public function prepare_query() { global $wpdb; $this->first_user = ($this->page - 1) * $this->users_per_page; $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page); $this->query_orderby = ' ORDER BY user_login'; $search_sql = ''; if ( $this->search_term ) { $searches = array(); $search_sql = 'AND ('; foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); $search_sql .= implode(' OR ', $searches); $search_sql .= ')'; } $this->query_from = " FROM $wpdb->users"; $this->query_where = " WHERE 1=1 $search_sql"; if ( $this->role ) { $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); } elseif ( is_multisite() ) { $level_key = $wpdb->prefix . 'capabilities'; $this->query_from .= ", $wpdb->usermeta"; $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; } do_action_ref_array( 'pre_user_search', array( &$this ) ); } public function query() { global $wpdb; $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); if ( $this->results ) $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); else $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); } function prepare_vars_for_template_usage() {} public function do_paging() { if ( $this->total_users_for_query > $this->users_per_page ) { $args = array(); if ( ! empty($this->search_term) ) $args['usersearch'] = urlencode($this->search_term); if ( ! empty($this->role) ) $args['role'] = urlencode($this->role); $this->paging_text = paginate_links( array( 'total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => $args ) ); if ( $this->paging_text ) { $this->paging_text = sprintf( '' . __( 'Displaying %1$s–%2$s of %3$s' ) . '%s', number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), number_format_i18n( $this->total_users_for_query ), $this->paging_text ); } } } public function get_results() { return (array) $this->results; } function page_links() { echo $this->paging_text; } function results_are_paged() { if ( $this->paging_text ) return true; return false; } function is_search() { if ( $this->search_term ) return true; return false; } } endif; function get_others_unpublished_posts( $user_id, $type = 'any' ) { _deprecated_function( __FUNCTION__, '3.1.0' ); global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( in_array($type, array('draft', 'pending')) ) $type_sql = " post_status = '$type' "; else $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; if ( !$editable ) { $other_unpubs = ''; } else { $editable = join(',', $editable); $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); } return apply_filters('get_others_drafts', $other_unpubs); } function get_others_drafts($user_id) { _deprecated_function( __FUNCTION__, '3.1.0' ); return get_others_unpublished_posts($user_id, 'draft'); } function get_others_pending($user_id) { _deprecated_function( __FUNCTION__, '3.1.0' ); return get_others_unpublished_posts($user_id, 'pending'); } function wp_dashboard_quick_press_output() { _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' ); wp_dashboard_quick_press(); } function wp_tiny_mce( $teeny = false, $settings = false ) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); static $num = 1; if ( ! class_exists( '_WP_Editors', false ) ) require_once ABSPATH . WPINC . '/class-wp-editor.php'; $editor_id = 'content' . $num++; $set = array( 'teeny' => $teeny, 'tinymce' => $settings ? $settings : true, 'quicktags' => false ); $set = _WP_Editors::parse_settings($editor_id, $set); _WP_Editors::editor_settings($editor_id, $set); } function wp_preload_dialogs() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function wp_print_editor_js() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function wp_quicktags() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function screen_layout( $screen ) { _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' ); $current_screen = get_current_screen(); if ( ! $current_screen ) return ''; ob_start(); $current_screen->render_screen_layout(); return ob_get_clean(); } function screen_options( $screen ) { _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' ); $current_screen = get_current_screen(); if ( ! $current_screen ) return ''; ob_start(); $current_screen->render_per_page_options(); return ob_get_clean(); } function screen_meta( $screen ) { $current_screen = get_current_screen(); $current_screen->render_screen_meta(); } function favorite_actions() { _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' ); } function media_upload_image() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_audio() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_video() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_file() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function type_url_form_image() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" ); return wp_media_insert_url_form( 'image' ); } function type_url_form_audio() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" ); return wp_media_insert_url_form( 'audio' ); } function type_url_form_video() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" ); return wp_media_insert_url_form( 'video' ); } function type_url_form_file() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" ); return wp_media_insert_url_form( 'file' ); } function add_contextual_help( $screen, $help ) { _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' ); if ( is_string( $screen ) ) $screen = convert_to_screen( $screen ); WP_Screen::add_old_compat_help( $screen, $help ); } function get_allowed_themes() { _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" ); $themes = wp_get_themes( array( 'allowed' => true ) ); $wp_themes = array(); foreach ( $themes as $theme ) { $wp_themes[ $theme->get('Name') ] = $theme; } return $wp_themes; } function get_broken_themes() { _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" ); $themes = wp_get_themes( array( 'errors' => true ) ); $broken = array(); foreach ( $themes as $theme ) { $name = $theme->get('Name'); $broken[ $name ] = array( 'Name' => $name, 'Title' => $name, 'Description' => $theme->errors()->get_error_message(), ); } return $broken; } function current_theme_info() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); return wp_get_theme(); } function _insert_into_post_button( $type ) { _deprecated_function( __FUNCTION__, '3.5.0' ); } function _media_button($title, $icon, $type, $id) { _deprecated_function( __FUNCTION__, '3.5.0' ); } function get_post_to_edit( $id ) { _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); return get_post( $id, OBJECT, 'edit' ); } function get_default_page_to_edit() { _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" ); $page = get_default_post_to_edit(); $page->post_type = 'page'; return $page; } function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' ); return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) ); } function wp_nav_menu_locations_meta_box() { _deprecated_function( __FUNCTION__, '3.6.0' ); } function wp_update_core($current, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Core_Upgrader(); return $upgrader->upgrade($current); } function wp_update_plugin($plugin, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Plugin_Upgrader(); return $upgrader->upgrade($plugin); } function wp_update_theme($theme, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Theme_Upgrader(); return $upgrader->upgrade($theme); } function the_attachment_links( $id = false ) { _deprecated_function( __FUNCTION__, '3.7.0' ); } function screen_icon() { _deprecated_function( __FUNCTION__, '3.8.0' ); echo get_screen_icon(); } function get_screen_icon() { _deprecated_function( __FUNCTION__, '3.8.0' ); return ''; } function wp_dashboard_incoming_links_output() {} function wp_dashboard_secondary_output() {} function wp_dashboard_incoming_links() {} function wp_dashboard_incoming_links_control() {} function wp_dashboard_plugins() {} function wp_dashboard_primary_control() {} function wp_dashboard_recent_comments_control() {} function wp_dashboard_secondary() {} function wp_dashboard_secondary_control() {} function wp_dashboard_plugins_output( $rss, $args = array() ) { _deprecated_function( __FUNCTION__, '4.8.0' ); $popular = fetch_feed( $args['url']['popular'] ); if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { $plugin_slugs = array_keys( get_plugins() ); set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); } echo '
        '; foreach ( array( $popular ) as $feed ) { if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) continue; $items = $feed->get_items(0, 5); while ( true ) { if ( 0 === count($items) ) continue 2; $item_key = array_rand($items); $item = $items[$item_key]; list($link, $frag) = explode( '#', $item->get_link() ); $link = esc_url($link); if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) $slug = $matches[1]; else { unset( $items[$item_key] ); continue; } reset( $plugin_slugs ); foreach ( $plugin_slugs as $plugin_slug ) { if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { unset( $items[$item_key] ); continue 2; } } break; } while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) unset($items[$item_key]); if ( !isset($items[$item_key]) ) continue; $raw_title = $item->get_title(); $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; echo '
      • ' . __( 'Popular Plugin' ) . ': ' . esc_html( $raw_title ) . ' (' . __( 'Install' ) . ')
      • '; $feed->__destruct(); unset( $feed ); } echo '
      '; } function _relocate_children( $old_ID, $new_ID ) { _deprecated_function( __FUNCTION__, '3.9.0' ); } function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); global $_wp_last_object_menu; $_wp_last_object_menu++; return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu); } function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); global $_wp_last_utility_menu; $_wp_last_utility_menu++; return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu); } function post_form_autocomplete_off() { global $is_safari, $is_chrome; _deprecated_function( __FUNCTION__, '4.6.0' ); if ( $is_safari || $is_chrome ) { echo ' autocomplete="off"'; } } function options_permalink_add_js() { ?> + + admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) ); add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) ); } public function init() { $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) ); if ( ! $page ) { return; } add_action( "load-{$page}", array( $this, 'admin_load' ) ); add_action( "load-{$page}", array( $this, 'take_action' ), 49 ); add_action( "load-{$page}", array( $this, 'handle_upload' ), 49 ); if ( $this->admin_header_callback ) { add_action( "admin_head-{$page}", $this->admin_header_callback, 51 ); } } public function admin_load() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

      ' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '

      ' . '

      ' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '

      ' . '

      ' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '

      ' . '

      ' . __( 'Do not forget to click on the Save Changes button when you are finished.' ) . '

      ', ) ); get_current_screen()->set_help_sidebar( '

      ' . __( 'For more information:' ) . '

      ' . '

      ' . __( 'Documentation on Custom Background' ) . '

      ' . '

      ' . __( 'Support' ) . '

      ' ); wp_enqueue_media(); wp_enqueue_script( 'custom-background' ); wp_enqueue_style( 'wp-color-picker' ); } public function take_action() { if ( empty( $_POST ) ) { return; } if ( isset( $_POST['reset-background'] ) ) { check_admin_referer( 'custom-background-reset', '_wpnonce-custom-background-reset' ); remove_theme_mod( 'background_image' ); remove_theme_mod( 'background_image_thumb' ); $this->updated = true; return; } if ( isset( $_POST['remove-background'] ) ) { check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' ); set_theme_mod( 'background_image', '' ); set_theme_mod( 'background_image_thumb', '' ); $this->updated = true; wp_safe_redirect( $_POST['_wp_http_referer'] ); return; } if ( isset( $_POST['background-preset'] ) ) { check_admin_referer( 'custom-background' ); if ( in_array( $_POST['background-preset'], array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) { $preset = $_POST['background-preset']; } else { $preset = 'default'; } set_theme_mod( 'background_preset', $preset ); } if ( isset( $_POST['background-position'] ) ) { check_admin_referer( 'custom-background' ); $position = explode( ' ', $_POST['background-position'] ); if ( in_array( $position[0], array( 'left', 'center', 'right' ), true ) ) { $position_x = $position[0]; } else { $position_x = 'left'; } if ( in_array( $position[1], array( 'top', 'center', 'bottom' ), true ) ) { $position_y = $position[1]; } else { $position_y = 'top'; } set_theme_mod( 'background_position_x', $position_x ); set_theme_mod( 'background_position_y', $position_y ); } if ( isset( $_POST['background-size'] ) ) { check_admin_referer( 'custom-background' ); if ( in_array( $_POST['background-size'], array( 'auto', 'contain', 'cover' ), true ) ) { $size = $_POST['background-size']; } else { $size = 'auto'; } set_theme_mod( 'background_size', $size ); } if ( isset( $_POST['background-repeat'] ) ) { check_admin_referer( 'custom-background' ); $repeat = $_POST['background-repeat']; if ( 'no-repeat' !== $repeat ) { $repeat = 'repeat'; } set_theme_mod( 'background_repeat', $repeat ); } if ( isset( $_POST['background-attachment'] ) ) { check_admin_referer( 'custom-background' ); $attachment = $_POST['background-attachment']; if ( 'fixed' !== $attachment ) { $attachment = 'scroll'; } set_theme_mod( 'background_attachment', $attachment ); } if ( isset( $_POST['background-color'] ) ) { check_admin_referer( 'custom-background' ); $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['background-color'] ); if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) { set_theme_mod( 'background_color', $color ); } else { set_theme_mod( 'background_color', '' ); } } $this->updated = true; } public function admin_page() { ?> +
      +

      -.menu li { - margin-bottom: 0; - position: relative; -} + +
      +

      + Customizer.' ), admin_url( 'customize.php?autofocus[control]=background_image' ) ); ?> +

      +
      + -.menu-item-bar { - clear: both; - line-height: 1.5; - position: relative; - margin: 9px 0 0; -} + updated ) ) { ?> +
      +

      + Visit your site to see how it looks.' ), home_url( '/' ) ); ?> +

      +
      + -.menu-item-bar .menu-item-handle { - border: 1px solid #dcdcde; - position: relative; - padding: 10px 15px; - height: auto; - min-height: 20px; - max-width: 382px; - line-height: 2.30769230; - overflow: hidden; - word-wrap: break-word; -} +

      -.menu-item-bar .menu-item-handle:hover { - border-color: #8c8f94; -} + + + + + + -#menu-to-edit .menu-item-invalid .menu-item-handle { - background: #fcf0f1; - border-color: #d63638; -} + + + + + + -.no-js .menu-item-edit-active .item-edit { - display: none; -} + + + + + + + -.js .menu-item-handle { - cursor: move; -} + + + + + + + + -.menu li.deleting .menu-item-handle { - background-image: none; - background-color: #f86368; -} +

      +
      + + + + -.menu-item-handle .item-title { - font-size: 13px; - font-weight: 600; - line-height: 1.53846153; - display: block; - /* @todo: responsive view. */ - margin-right: 13em; -} + array( 'label' => __( 'Top Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center top' => array( 'label' => __( 'Top' ), 'icon' => 'dashicons dashicons-arrow-up-alt', ), 'right top' => array( 'label' => __( 'Top Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), array( 'left center' => array( 'label' => __( 'Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center center' => array( 'label' => __( 'Center' ), 'icon' => 'background-position-center-icon', ), 'right center' => array( 'label' => __( 'Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), array( 'left bottom' => array( 'label' => __( 'Bottom Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center bottom' => array( 'label' => __( 'Bottom' ), 'icon' => 'dashicons dashicons-arrow-down-alt', ), 'right bottom' => array( 'label' => __( 'Bottom Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), ); ?> + + + + -.menu-item-handle .menu-item-checkbox { - display: none; -} + + + + -.bulk-selection .menu-item-handle .menu-item-checkbox { - display: inline-block; - margin-right: 6px; -} + + + + -.menu-item-handle .menu-item-title.no-title { - color: #646970; -} + + + + + + + + + + + -/* Sortables */ -li.menu-item.ui-sortable-helper .menu-item-bar { - margin-top: 0; -} + + +
      -li.menu-item.ui-sortable-helper .menu-item-transport .menu-item-bar { - margin-top: 9px; /* Must use the same value used by the dragged item .menu-item-bar */ -} +
      + false ); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); } $file = wp_handle_upload( $uploaded_file, $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'] ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = wp_basename( $file ); $attachment = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-background', ); $id = wp_insert_attachment( $attachment, $file ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); set_theme_mod( 'background_image', esc_url_raw( $url ) ); $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); do_action( 'wp_create_file_in_uploads', $file, $id ); $this->updated = true; } public function ajax_background_add() { check_ajax_referer( 'background-add', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() ); wp_send_json_success(); } public function attachment_fields_to_edit( $form_fields ) { return $form_fields; } public function filter_upload_tabs( $tabs ) { return $tabs; } public function wp_set_background_image() { check_ajax_referer( 'custom-background' ); if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) { exit; } $attachment_id = absint( $_POST['attachment_id'] ); $sizes = array_keys( apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ) ); $size = 'thumbnail'; if ( in_array( $_POST['size'], $sizes, true ) ) { $size = esc_attr( $_POST['size'] ); } update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); $url = wp_get_attachment_image_src( $attachment_id, $size ); $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); exit; } } domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) ); $redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request ); if ( $redirect_user_admin_request ) { wp_redirect( user_admin_url() ); exit; } unset( $redirect_user_admin_request ); + +> + + + + + <?php _e( 'WordPress › Database Repair' ); ?> + + + + -.menu .sortable-placeholder { - height: 35px; - width: 410px; - margin-top: 9px; /* Must use the same value used by the dragged item .menu-item-bar */ -} +' . __( 'Allow automatic database repair' ) . ''; echo '

      '; printf( __( 'To allow use of this page to automatically repair database problems, please add the following line to your %s file. Once this line is added to your config, reload this page.' ), 'wp-config.php' ); echo "

      define('WP_ALLOW_REPAIR', true);

      "; $default_key = 'put your unique phrase here'; $missing_key = false; $duplicated_keys = array(); foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) { if ( defined( $key ) ) { $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] ); } else { $missing_key = true; } } if ( isset( $duplicated_keys[ $default_key ] ) ) { $duplicated_keys[ $default_key ] = true; } $duplicated_keys = array_filter( $duplicated_keys ); if ( $duplicated_keys || $missing_key ) { echo '

      ' . __( 'Check secret keys' ) . '

      '; echo '

      ' . sprintf( __( 'While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the WordPress.org secret key service.' ), 'wp-config.php', 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '

      '; } } elseif ( isset( $_GET['repair'] ) ) { echo '

      ' . __( 'Database repair results' ) . '

      '; $optimize = 2 == $_GET['repair']; $okay = true; $problems = array(); $tables = $wpdb->tables(); $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->sitecategories ) ); if ( is_multisite() && ! $wpdb->get_var( $query ) ) { unset( $tables['sitecategories'] ); } $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); foreach ( $tables as $table ) { $check = $wpdb->get_row( "CHECK TABLE $table" ); echo '

      '; if ( 'OK' === $check->Msg_text ) { printf( __( 'The %s table is okay.' ), "$table" ); } else { printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table…' ), "$table", "$check->Msg_text" ); $repair = $wpdb->get_row( "REPAIR TABLE $table" ); echo '
          '; if ( 'OK' === $repair->Msg_text ) { printf( __( 'Successfully repaired the %s table.' ), "$table" ); } else { printf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "$table", "$repair->Msg_text" ) . '
      '; $problems[ $table ] = $repair->Msg_text; $okay = false; } } if ( $okay && $optimize ) { $analyze = $wpdb->get_row( "ANALYZE TABLE $table" ); echo '
          '; if ( 'Table is already up to date' === $analyze->Msg_text ) { printf( __( 'The %s table is already optimized.' ), "$table" ); } else { $optimize = $wpdb->get_row( "OPTIMIZE TABLE $table" ); echo '
          '; if ( 'OK' === $optimize->Msg_text || 'Table is already up to date' === $optimize->Msg_text ) { printf( __( 'Successfully optimized the %s table.' ), "$table" ); } else { printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "$table", "$optimize->Msg_text" ); } } } echo '

      '; } if ( $problems ) { printf( '

      ' . __( 'Some database problems could not be repaired. Please copy-and-paste the following list of errors to the WordPress support forums to get additional assistance.' ) . '

      ', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); $problem_output = ''; foreach ( $problems as $table => $problem ) { $problem_output .= "$table: $problem\n"; } echo '

      '; } else { echo '

      ' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "

      define('WP_ALLOW_REPAIR', true);

      "; } } else { echo '

      ' . __( 'WordPress database repair' ) . '

      '; if ( isset( $_GET['referrer'] ) && 'is_blog_installed' === $_GET['referrer'] ) { echo '

      ' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '

      '; } else { echo '

      ' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '

      '; } ?> +

      +

      +

      + + + +getTimestamp() + $datetime->getOffset(); } if ( $translate ) { return wp_date( $format, $datetime->getTimestamp() ); } return $datetime->format( $format ); } function current_time( $type, $gmt = 0 ) { if ( 'timestamp' === $type || 'U' === $type ) { return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); } if ( 'mysql' === $type ) { $type = 'Y-m-d H:i:s'; } $timezone = $gmt ? new DateTimeZone( 'UTC' ) : wp_timezone(); $datetime = new DateTime( 'now', $timezone ); return $datetime->format( $type ); } function current_datetime() { return new DateTimeImmutable( 'now', wp_timezone() ); } function wp_timezone_string() { $timezone_string = get_option( 'timezone_string' ); if ( $timezone_string ) { return $timezone_string; } $offset = (float) get_option( 'gmt_offset' ); $hours = (int) $offset; $minutes = ( $offset - $hours ); $sign = ( $offset < 0 ) ? '-' : '+'; $abs_hour = abs( $hours ); $abs_mins = abs( $minutes * 60 ); $tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins ); return $tz_offset; } function wp_timezone() { return new DateTimeZone( wp_timezone_string() ); } function date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) { $timestamp = $timestamp_with_offset; if ( ! is_numeric( $timestamp ) ) { $timestamp = current_time( 'timestamp', $gmt ); } if ( 'U' === $format ) { $date = $timestamp; } elseif ( $gmt && false === $timestamp_with_offset ) { $date = wp_date( $format, null, new DateTimeZone( 'UTC' ) ); } elseif ( false === $timestamp_with_offset ) { $date = wp_date( $format ); } else { $local_time = gmdate( 'Y-m-d H:i:s', $timestamp ); $timezone = wp_timezone(); $datetime = date_create( $local_time, $timezone ); $date = wp_date( $format, $datetime->getTimestamp(), $timezone ); } $date = apply_filters( 'date_i18n', $date, $format, $timestamp, $gmt ); return $date; } function wp_date( $format, $timestamp = null, $timezone = null ) { global $wp_locale; if ( null === $timestamp ) { $timestamp = time(); } elseif ( ! is_numeric( $timestamp ) ) { return false; } if ( ! $timezone ) { $timezone = wp_timezone(); } $datetime = date_create( '@' . $timestamp ); $datetime->setTimezone( $timezone ); if ( empty( $wp_locale->month ) || empty( $wp_locale->weekday ) ) { $date = $datetime->format( $format ); } else { $format = preg_replace( '/(?get_month( $datetime->format( 'm' ) ); $weekday = $wp_locale->get_weekday( $datetime->format( 'w' ) ); for ( $i = 0; $i < $format_length; $i ++ ) { switch ( $format[ $i ] ) { case 'D': $new_format .= addcslashes( $wp_locale->get_weekday_abbrev( $weekday ), '\\A..Za..z' ); break; case 'F': $new_format .= addcslashes( $month, '\\A..Za..z' ); break; case 'l': $new_format .= addcslashes( $weekday, '\\A..Za..z' ); break; case 'M': $new_format .= addcslashes( $wp_locale->get_month_abbrev( $month ), '\\A..Za..z' ); break; case 'a': $new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'a' ) ), '\\A..Za..z' ); break; case 'A': $new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'A' ) ), '\\A..Za..z' ); break; case '\\': $new_format .= $format[ $i ]; if ( $i < $format_length ) { $new_format .= $format[ ++$i ]; } break; default: $new_format .= $format[ $i ]; break; } } $date = $datetime->format( $new_format ); $date = wp_maybe_decline_date( $date, $format ); } $date = apply_filters( 'wp_date', $date, $format, $timestamp, $timezone ); return $date; } function wp_maybe_decline_date( $date, $format = '' ) { global $wp_locale; if ( ! function_exists( '_x' ) ) { return $date; } if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) { $months = $wp_locale->month; $months_genitive = $wp_locale->month_genitive; if ( $format ) { $decline = preg_match( '#[dj]\.? F#', $format ); } else { $decline = preg_match( '#\b\d{1,2}\.? [^\d ]+\b#u', $date ); } if ( $decline ) { foreach ( $months as $key => $month ) { $months[ $key ] = '# ' . preg_quote( $month, '#' ) . '\b#u'; } foreach ( $months_genitive as $key => $month ) { $months_genitive[ $key ] = ' ' . $month; } $date = preg_replace( $months, $months_genitive, $date ); } if ( $format ) { $decline = preg_match( '#F [dj]#', $format ); } else { $decline = preg_match( '#\b[^\d ]+ \d{1,2}(st|nd|rd|th)?\b#u', trim( $date ) ); } if ( $decline ) { foreach ( $months as $key => $month ) { $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?([-–]\d{1,2})?(st|nd|rd|th)?\b#u'; } foreach ( $months_genitive as $key => $month ) { $months_genitive[ $key ] = '$1$3 ' . $month; } $date = preg_replace( $months, $months_genitive, $date ); } } $locale = get_locale(); if ( 'ca' === $locale ) { $date = preg_replace( '# de ([ao])#i', " d'\\1", $date ); } return $date; } function number_format_i18n( $number, $decimals = 0 ) { global $wp_locale; if ( isset( $wp_locale ) ) { $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); } else { $formatted = number_format( $number, absint( $decimals ) ); } return apply_filters( 'number_format_i18n', $formatted, $number, $decimals ); } function size_format( $bytes, $decimals = 0 ) { $quant = array( _x( 'YB', 'unit symbol' ) => YB_IN_BYTES, _x( 'ZB', 'unit symbol' ) => ZB_IN_BYTES, _x( 'EB', 'unit symbol' ) => EB_IN_BYTES, _x( 'PB', 'unit symbol' ) => PB_IN_BYTES, _x( 'TB', 'unit symbol' ) => TB_IN_BYTES, _x( 'GB', 'unit symbol' ) => GB_IN_BYTES, _x( 'MB', 'unit symbol' ) => MB_IN_BYTES, _x( 'KB', 'unit symbol' ) => KB_IN_BYTES, _x( 'B', 'unit symbol' ) => 1, ); if ( 0 === $bytes ) { return number_format_i18n( 0, $decimals ) . ' ' . _x( 'B', 'unit symbol' ); } foreach ( $quant as $unit => $mag ) { if ( (float) $bytes >= $mag ) { return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; } } return false; } function human_readable_duration( $duration = '' ) { if ( ( empty( $duration ) || ! is_string( $duration ) ) ) { return false; } $duration = trim( $duration ); if ( '-' === substr( $duration, 0, 1 ) ) { $duration = substr( $duration, 1 ); } $duration_parts = array_reverse( explode( ':', $duration ) ); $duration_count = count( $duration_parts ); $hour = null; $minute = null; $second = null; if ( 3 === $duration_count ) { if ( ! ( (bool) preg_match( '/^([0-9]+):([0-5]?[0-9]):([0-5]?[0-9])$/', $duration ) ) ) { return false; } list( $second, $minute, $hour ) = $duration_parts; } elseif ( 2 === $duration_count ) { if ( ! ( (bool) preg_match( '/^([0-5]?[0-9]):([0-5]?[0-9])$/', $duration ) ) ) { return false; } list( $second, $minute ) = $duration_parts; } else { return false; } $human_readable_duration = array(); if ( is_numeric( $hour ) ) { $human_readable_duration[] = sprintf( _n( '%s hour', '%s hours', $hour ), (int) $hour ); } if ( is_numeric( $minute ) ) { $human_readable_duration[] = sprintf( _n( '%s minute', '%s minutes', $minute ), (int) $minute ); } if ( is_numeric( $second ) ) { $human_readable_duration[] = sprintf( _n( '%s second', '%s seconds', $second ), (int) $second ); } return implode( ', ', $human_readable_duration ); } function get_weekstartend( $mysqlstring, $start_of_week = '' ) { $my = substr( $mysqlstring, 0, 4 ); $mm = substr( $mysqlstring, 8, 2 ); $md = substr( $mysqlstring, 5, 2 ); $day = mktime( 0, 0, 0, $md, $mm, $my ); $weekday = gmdate( 'w', $day ); if ( ! is_numeric( $start_of_week ) ) { $start_of_week = get_option( 'start_of_week' ); } if ( $weekday < $start_of_week ) { $weekday += 7; } $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); $end = $start + WEEK_IN_SECONDS - 1; return compact( 'start', 'end' ); } function maybe_serialize( $data ) { if ( is_array( $data ) || is_object( $data ) ) { return serialize( $data ); } if ( is_serialized( $data, false ) ) { return serialize( $data ); } return $data; } function maybe_unserialize( $data ) { if ( is_serialized( $data ) ) { return @unserialize( trim( $data ) ); } return $data; } function is_serialized( $data, $strict = true ) { if ( ! is_string( $data ) ) { return false; } $data = trim( $data ); if ( 'N;' === $data ) { return true; } if ( strlen( $data ) < 4 ) { return false; } if ( ':' !== $data[1] ) { return false; } if ( $strict ) { $lastc = substr( $data, -1 ); if ( ';' !== $lastc && '}' !== $lastc ) { return false; } } else { $semicolon = strpos( $data, ';' ); $brace = strpos( $data, '}' ); if ( false === $semicolon && false === $brace ) { return false; } if ( false !== $semicolon && $semicolon < 3 ) { return false; } if ( false !== $brace && $brace < 4 ) { return false; } } $token = $data[0]; switch ( $token ) { case 's': if ( $strict ) { if ( '"' !== substr( $data, -2, 1 ) ) { return false; } } elseif ( false === strpos( $data, '"' ) ) { return false; } case 'a': case 'O': return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); case 'b': case 'i': case 'd': $end = $strict ? '$' : ''; return (bool) preg_match( "/^{$token}:[0-9.E+-]+;$end/", $data ); } return false; } function is_serialized_string( $data ) { if ( ! is_string( $data ) ) { return false; } $data = trim( $data ); if ( strlen( $data ) < 4 ) { return false; } elseif ( ':' !== $data[1] ) { return false; } elseif ( ';' !== substr( $data, -1 ) ) { return false; } elseif ( 's' !== $data[0] ) { return false; } elseif ( '"' !== substr( $data, -2, 1 ) ) { return false; } else { return true; } } function xmlrpc_getposttitle( $content ) { global $post_default_title; if ( preg_match( '/(.+?)<\/title>/is', $content, $matchtitle ) ) { $post_title = $matchtitle[1]; } else { $post_title = $post_default_title; } return $post_title; } function xmlrpc_getpostcategory( $content ) { global $post_default_category; if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) { $post_category = trim( $matchcat[1], ',' ); $post_category = explode( ',', $post_category ); } else { $post_category = $post_default_category; } return $post_category; } function xmlrpc_removepostdata( $content ) { $content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content ); $content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content ); $content = trim( $content ); return $content; } function wp_extract_urls( $content ) { preg_match_all( "#([\"']?)(" . '(?:([\w-]+:)?//?)' . '[^\s()<>]+' . '[.]' . '(?:' . '\([\w\d]+\)|' . '(?:' . "[^`!()\[\]{}:'\".,<>«»“”‘’\s]|" . '(?:[:]\d+)?/?' . ')+' . ')' . ")\\1#", $content, $post_links ); $post_links = array_unique( array_map( static function( $link ) { $link = html_entity_decode( $link ); return str_replace( ';', '', $link ); }, $post_links[2] ) ); return array_values( $post_links ); } function do_enclose( $content, $post ) { global $wpdb; include_once ABSPATH . WPINC . '/class-IXR.php'; $post = get_post( $post ); if ( ! $post ) { return false; } if ( null === $content ) { $content = $post->post_content; } $post_links = array(); $pung = get_enclosed( $post->ID ); $post_links_temp = wp_extract_urls( $content ); foreach ( $pung as $link_test ) { if ( ! in_array( $link_test, $post_links_temp, true ) ) { $mids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $link_test ) . '%' ) ); foreach ( $mids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } } } foreach ( (array) $post_links_temp as $link_test ) { if ( ! in_array( $link_test, $pung, true ) ) { $test = parse_url( $link_test ); if ( false === $test ) { continue; } if ( isset( $test['query'] ) ) { $post_links[] = $link_test; } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) { $post_links[] = $link_test; } } } $post_links = apply_filters( 'enclosure_links', $post_links, $post->ID ); foreach ( (array) $post_links as $url ) { $url = strip_fragment_from_url( $url ); if ( '' !== $url && ! $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $url ) . '%' ) ) ) { $headers = wp_get_http_headers( $url ); if ( $headers ) { $len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0; $type = isset( $headers['content-type'] ) ? $headers['content-type'] : ''; $allowed_types = array( 'video', 'audio' ); $url_parts = parse_url( $url ); if ( false !== $url_parts && ! empty( $url_parts['path'] ) ) { $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION ); if ( ! empty( $extension ) ) { foreach ( wp_get_mime_types() as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $type = $mime; break; } } } } if ( in_array( substr( $type, 0, strpos( $type, '/' ) ), $allowed_types, true ) ) { add_post_meta( $post->ID, 'enclosure', "$url\n$len\n$mime\n" ); } } } } } function wp_get_http_headers( $url, $deprecated = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); } $response = wp_safe_remote_head( $url ); if ( is_wp_error( $response ) ) { return false; } return wp_remote_retrieve_headers( $response ); } function is_new_day() { global $currentday, $previousday; if ( $currentday !== $previousday ) { return 1; } else { return 0; } } function build_query( $data ) { return _http_build_query( $data, null, '&', '', false ); } function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) { $ret = array(); foreach ( (array) $data as $k => $v ) { if ( $urlencode ) { $k = urlencode( $k ); } if ( is_int( $k ) && null != $prefix ) { $k = $prefix . $k; } if ( ! empty( $key ) ) { $k = $key . '%5B' . $k . '%5D'; } if ( null === $v ) { continue; } elseif ( false === $v ) { $v = '0'; } if ( is_array( $v ) || is_object( $v ) ) { array_push( $ret, _http_build_query( $v, '', $sep, $k, $urlencode ) ); } elseif ( $urlencode ) { array_push( $ret, $k . '=' . urlencode( $v ) ); } else { array_push( $ret, $k . '=' . $v ); } } if ( null === $sep ) { $sep = ini_get( 'arg_separator.output' ); } return implode( $sep, $ret ); } function add_query_arg( ...$args ) { if ( is_array( $args[0] ) ) { if ( count( $args ) < 2 || false === $args[1] ) { $uri = $_SERVER['REQUEST_URI']; } else { $uri = $args[1]; } } else { if ( count( $args ) < 3 || false === $args[2] ) { $uri = $_SERVER['REQUEST_URI']; } else { $uri = $args[2]; } } $frag = strstr( $uri, '#' ); if ( $frag ) { $uri = substr( $uri, 0, -strlen( $frag ) ); } else { $frag = ''; } if ( 0 === stripos( $uri, 'http://' ) ) { $protocol = 'http://'; $uri = substr( $uri, 7 ); } elseif ( 0 === stripos( $uri, 'https://' ) ) { $protocol = 'https://'; $uri = substr( $uri, 8 ); } else { $protocol = ''; } if ( strpos( $uri, '?' ) !== false ) { list( $base, $query ) = explode( '?', $uri, 2 ); $base .= '?'; } elseif ( $protocol || strpos( $uri, '=' ) === false ) { $base = $uri . '?'; $query = ''; } else { $base = ''; $query = $uri; } wp_parse_str( $query, $qs ); $qs = urlencode_deep( $qs ); if ( is_array( $args[0] ) ) { foreach ( $args[0] as $k => $v ) { $qs[ $k ] = $v; } } else { $qs[ $args[0] ] = $args[1]; } foreach ( $qs as $k => $v ) { if ( false === $v ) { unset( $qs[ $k ] ); } } $ret = build_query( $qs ); $ret = trim( $ret, '?' ); $ret = preg_replace( '#=(&|$)#', '$1', $ret ); $ret = $protocol . $base . $ret . $frag; $ret = rtrim( $ret, '?' ); $ret = str_replace( '?#', '#', $ret ); return $ret; } function remove_query_arg( $key, $query = false ) { if ( is_array( $key ) ) { foreach ( $key as $k ) { $query = add_query_arg( $k, false, $query ); } return $query; } return add_query_arg( $key, false, $query ); } function wp_removable_query_args() { $removable_query_args = array( 'activate', 'activated', 'admin_email_remind_later', 'approved', 'core-major-auto-updates-saved', 'deactivate', 'delete_count', 'deleted', 'disabled', 'doing_wp_cron', 'enabled', 'error', 'hotkeys_highlight_first', 'hotkeys_highlight_last', 'ids', 'locked', 'message', 'same', 'saved', 'settings-updated', 'skipped', 'spammed', 'trashed', 'unspammed', 'untrashed', 'update', 'updated', 'wp-post-new-reload', ); return apply_filters( 'removable_query_args', $removable_query_args ); } function add_magic_quotes( $array ) { foreach ( (array) $array as $k => $v ) { if ( is_array( $v ) ) { $array[ $k ] = add_magic_quotes( $v ); } elseif ( is_string( $v ) ) { $array[ $k ] = addslashes( $v ); } else { continue; } } return $array; } function wp_remote_fopen( $uri ) { $parsed_url = parse_url( $uri ); if ( ! $parsed_url || ! is_array( $parsed_url ) ) { return false; } $options = array(); $options['timeout'] = 10; $response = wp_safe_remote_get( $uri, $options ); if ( is_wp_error( $response ) ) { return false; } return wp_remote_retrieve_body( $response ); } function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; $wp->main( $query_vars ); if ( ! isset( $wp_the_query ) ) { $wp_the_query = $wp_query; } } function get_status_header_desc( $code ) { global $wp_header_to_desc; $code = absint( $code ); if ( ! isset( $wp_header_to_desc ) ) { $wp_header_to_desc = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 510 => 'Not Extended', 511 => 'Network Authentication Required', ); } if ( isset( $wp_header_to_desc[ $code ] ) ) { return $wp_header_to_desc[ $code ]; } else { return ''; } } function status_header( $code, $description = '' ) { if ( ! $description ) { $description = get_status_header_desc( $code ); } if ( empty( $description ) ) { return; } $protocol = wp_get_server_protocol(); $status_header = "$protocol $code $description"; if ( function_exists( 'apply_filters' ) ) { $status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol ); } if ( ! headers_sent() ) { header( $status_header, true, $code ); } } function wp_get_nocache_headers() { $headers = array( 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', ); if ( function_exists( 'apply_filters' ) ) { $headers = (array) apply_filters( 'nocache_headers', $headers ); } $headers['Last-Modified'] = false; return $headers; } function nocache_headers() { if ( headers_sent() ) { return; } $headers = wp_get_nocache_headers(); unset( $headers['Last-Modified'] ); header_remove( 'Last-Modified' ); foreach ( $headers as $name => $field_value ) { header( "{$name}: {$field_value}" ); } } function cache_javascript_headers() { $expiresOffset = 10 * DAY_IN_SECONDS; header( 'Content-Type: text/javascript; charset=' . get_bloginfo( 'charset' ) ); header( 'Vary: Accept-Encoding' ); header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiresOffset ) . ' GMT' ); } function get_num_queries() { global $wpdb; return $wpdb->num_queries; } function bool_from_yn( $yn ) { return ( 'y' === strtolower( $yn ) ); } function do_feed() { global $wp_query; $feed = get_query_var( 'feed' ); $feed = preg_replace( '/^_+/', '', $feed ); if ( '' === $feed || 'feed' === $feed ) { $feed = get_default_feed(); } if ( ! has_action( "do_feed_{$feed}" ) ) { wp_die( __( '<strong>Error</strong>: This is not a valid feed template.' ), '', array( 'response' => 404 ) ); } do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed ); } function do_feed_rdf() { load_template( ABSPATH . WPINC . '/feed-rdf.php' ); } function do_feed_rss() { load_template( ABSPATH . WPINC . '/feed-rss.php' ); } function do_feed_rss2( $for_comments ) { if ( $for_comments ) { load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' ); } else { load_template( ABSPATH . WPINC . '/feed-rss2.php' ); } } function do_feed_atom( $for_comments ) { if ( $for_comments ) { load_template( ABSPATH . WPINC . '/feed-atom-comments.php' ); } else { load_template( ABSPATH . WPINC . '/feed-atom.php' ); } } function do_robots() { header( 'Content-Type: text/plain; charset=utf-8' ); do_action( 'do_robotstxt' ); $output = "User-agent: *\n"; $public = get_option( 'blog_public' ); $site_url = parse_url( site_url() ); $path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : ''; $output .= "Disallow: $path/wp-admin/\n"; $output .= "Allow: $path/wp-admin/admin-ajax.php\n"; echo apply_filters( 'robots_txt', $output, $public ); } function do_favicon() { do_action( 'do_faviconico' ); wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-blue-white-bg.png' ) ) ); exit; } function is_blog_installed() { global $wpdb; if ( wp_cache_get( 'is_blog_installed' ) ) { return true; } $suppress = $wpdb->suppress_errors(); if ( ! wp_installing() ) { $alloptions = wp_load_alloptions(); } if ( ! isset( $alloptions['siteurl'] ) ) { $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); } else { $installed = $alloptions['siteurl']; } $wpdb->suppress_errors( $suppress ); $installed = ! empty( $installed ); wp_cache_set( 'is_blog_installed', $installed ); if ( $installed ) { return true; } if ( defined( 'WP_REPAIRING' ) ) { return true; } $suppress = $wpdb->suppress_errors(); $wp_tables = $wpdb->tables(); foreach ( $wp_tables as $table ) { if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) { continue; } if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) { continue; } $described_table = $wpdb->get_results( "DESCRIBE $table;" ); if ( ( ! $described_table && empty( $wpdb->last_error ) ) || ( is_array( $described_table ) && 0 === count( $described_table ) ) ) { continue; } wp_load_translations_early(); $wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' ); dead_db(); } $wpdb->suppress_errors( $suppress ); wp_cache_set( 'is_blog_installed', false ); return false; } function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) { $actionurl = str_replace( '&', '&', $actionurl ); return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) ); } function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) { $name = esc_attr( $name ); $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; if ( $referer ) { $nonce_field .= wp_referer_field( false ); } if ( $echo ) { echo $nonce_field; } return $nonce_field; } function wp_referer_field( $echo = true ) { $referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; if ( $echo ) { echo $referer_field; } return $referer_field; } function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { $ref = wp_get_original_referer(); if ( ! $ref ) { $ref = ( 'previous' === $jump_back_to ) ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] ); } $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />'; if ( $echo ) { echo $orig_referer_field; } return $orig_referer_field; } function wp_get_referer() { if ( ! function_exists( 'wp_validate_redirect' ) ) { return false; } $ref = wp_get_raw_referer(); if ( $ref && wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref && home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref ) { return wp_validate_redirect( $ref, false ); } return false; } function wp_get_raw_referer() { if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { return wp_unslash( $_REQUEST['_wp_http_referer'] ); } elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { return wp_unslash( $_SERVER['HTTP_REFERER'] ); } return false; } function wp_get_original_referer() { if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) { return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false ); } return false; } function wp_mkdir_p( $target ) { $wrapper = null; if ( wp_is_stream( $target ) ) { list( $wrapper, $target ) = explode( '://', $target, 2 ); } $target = str_replace( '//', '/', $target ); if ( null !== $wrapper ) { $target = $wrapper . '://' . $target; } $target = rtrim( $target, '/' ); if ( empty( $target ) ) { $target = '/'; } if ( file_exists( $target ) ) { return @is_dir( $target ); } if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) { return false; } $target_parent = dirname( $target ); while ( '.' !== $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { $target_parent = dirname( $target_parent ); } $stat = @stat( $target_parent ); if ( $stat ) { $dir_perms = $stat['mode'] & 0007777; } else { $dir_perms = 0777; } if ( @mkdir( $target, $dir_perms, true ) ) { if ( ( $dir_perms & ~umask() ) != $dir_perms ) { $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) ); for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) { chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms ); } } return true; } return false; } function path_is_absolute( $path ) { if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file( $path ) ) ) { return true; } if ( realpath( $path ) == $path ) { return true; } if ( strlen( $path ) == 0 || '.' === $path[0] ) { return false; } if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) { return true; } return ( '/' === $path[0] || '\\' === $path[0] ); } function path_join( $base, $path ) { if ( path_is_absolute( $path ) ) { return $path; } return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' ); } function wp_normalize_path( $path ) { $wrapper = ''; if ( wp_is_stream( $path ) ) { list( $wrapper, $path ) = explode( '://', $path, 2 ); $wrapper .= '://'; } $path = str_replace( '\\', '/', $path ); $path = preg_replace( '|(?<=.)/+|', '/', $path ); if ( ':' === substr( $path, 1, 1 ) ) { $path = ucfirst( $path ); } return $wrapper . $path; } function get_temp_dir() { static $temp = ''; if ( defined( 'WP_TEMP_DIR' ) ) { return trailingslashit( WP_TEMP_DIR ); } if ( $temp ) { return trailingslashit( $temp ); } if ( function_exists( 'sys_get_temp_dir' ) ) { $temp = sys_get_temp_dir(); if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) { return trailingslashit( $temp ); } } $temp = ini_get( 'upload_tmp_dir' ); if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) { return trailingslashit( $temp ); } $temp = WP_CONTENT_DIR . '/'; if ( is_dir( $temp ) && wp_is_writable( $temp ) ) { return $temp; } return '/tmp/'; } function wp_is_writable( $path ) { if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { return win_is_writable( $path ); } else { return @is_writable( $path ); } } function win_is_writable( $path ) { if ( '/' === $path[ strlen( $path ) - 1 ] ) { return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' ); } elseif ( is_dir( $path ) ) { return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' ); } $should_delete_tmp_file = ! file_exists( $path ); $f = @fopen( $path, 'a' ); if ( false === $f ) { return false; } fclose( $f ); if ( $should_delete_tmp_file ) { unlink( $path ); } return true; } function wp_get_upload_dir() { return wp_upload_dir( null, false ); } function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) { static $cache = array(), $tested_paths = array(); $key = sprintf( '%d-%s', get_current_blog_id(), (string) $time ); if ( $refresh_cache || empty( $cache[ $key ] ) ) { $cache[ $key ] = _wp_upload_dir( $time ); } $uploads = apply_filters( 'upload_dir', $cache[ $key ] ); if ( $create_dir ) { $path = $uploads['path']; if ( array_key_exists( $path, $tested_paths ) ) { $uploads['error'] = $tested_paths[ $path ]; } else { if ( ! wp_mkdir_p( $path ) ) { if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; } else { $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir']; } $uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) ); } $tested_paths[ $path ] = $uploads['error']; } } return $uploads; } function _wp_upload_dir( $time = null ) { $siteurl = get_option( 'siteurl' ); $upload_path = trim( get_option( 'upload_path' ) ); if ( empty( $upload_path ) || 'wp-content/uploads' === $upload_path ) { $dir = WP_CONTENT_DIR . '/uploads'; } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { $dir = path_join( ABSPATH, $upload_path ); } else { $dir = $upload_path; } $url = get_option( 'upload_url_path' ); if ( ! $url ) { if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path == $dir ) ) { $url = WP_CONTENT_URL . '/uploads'; } else { $url = trailingslashit( $siteurl ) . $upload_path; } } if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS; } if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) { if ( ! get_site_option( 'ms_files_rewriting' ) ) { if ( defined( 'MULTISITE' ) ) { $ms_dir = '/sites/' . get_current_blog_id(); } else { $ms_dir = '/' . get_current_blog_id(); } $dir .= $ms_dir; $url .= $ms_dir; } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) { if ( defined( 'BLOGUPLOADDIR' ) ) { $dir = untrailingslashit( BLOGUPLOADDIR ); } else { $dir = ABSPATH . UPLOADS; } $url = trailingslashit( $siteurl ) . 'files'; } } $basedir = $dir; $baseurl = $url; $subdir = ''; if ( get_option( 'uploads_use_yearmonth_folders' ) ) { if ( ! $time ) { $time = current_time( 'mysql' ); } $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $subdir = "/$y/$m"; } $dir .= $subdir; $url .= $subdir; return array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $basedir, 'baseurl' => $baseurl, 'error' => false, ); } function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { $filename = sanitize_file_name( $filename ); $ext2 = null; $number = ''; $alt_filenames = array(); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); $name = pathinfo( $filename, PATHINFO_BASENAME ); if ( $ext ) { $ext = '.' . $ext; } if ( $name === $ext ) { $name = ''; } if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) { $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext ); } else { $fname = pathinfo( $filename, PATHINFO_FILENAME ); if ( $fname && preg_match( '/-(?:\d+x\d+|scaled|rotated)$/', $fname ) ) { $number = 1; $filename = str_replace( "{$fname}{$ext}", "{$fname}-{$number}{$ext}", $filename ); } $file_type = wp_check_filetype( $filename ); $mime_type = $file_type['type']; $is_image = ( ! empty( $mime_type ) && 0 === strpos( $mime_type, 'image/' ) ); $upload_dir = wp_get_upload_dir(); $lc_filename = null; $lc_ext = strtolower( $ext ); $_dir = trailingslashit( $dir ); if ( $ext && $lc_ext !== $ext ) { $lc_filename = preg_replace( '|' . preg_quote( $ext ) . '$|', $lc_ext, $filename ); } while ( file_exists( $_dir . $filename ) || ( $lc_filename && file_exists( $_dir . $lc_filename ) ) ) { $new_number = (int) $number + 1; if ( $lc_filename ) { $lc_filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $lc_filename ); } if ( '' === "{$number}{$ext}" ) { $filename = "{$filename}-{$new_number}"; } else { $filename = str_replace( array( "-{$number}{$ext}", "{$number}{$ext}" ), "-{$new_number}{$ext}", $filename ); } $number = $new_number; } if ( $lc_filename ) { $filename = $lc_filename; } $files = array(); $count = 10000; if ( $name && $ext && @is_dir( $dir ) && false !== strpos( $dir, $upload_dir['basedir'] ) ) { $files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename ); if ( null === $files ) { $files = @scandir( $dir ); } if ( ! empty( $files ) ) { $files = array_diff( $files, array( '.', '..' ) ); } if ( ! empty( $files ) ) { $count = count( $files ); $i = 0; while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) { $new_number = (int) $number + 1; $filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $filename ); $number = $new_number; $i++; } } } if ( $is_image ) { $output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type ); $alt_types = array(); if ( ! empty( $output_formats[ $mime_type ] ) ) { $alt_mime_type = $output_formats[ $mime_type ]; $alt_types = array_keys( array_intersect( $output_formats, array( $mime_type, $alt_mime_type ) ) ); $alt_types[] = $alt_mime_type; } elseif ( ! empty( $output_formats ) ) { $alt_types = array_keys( array_intersect( $output_formats, array( $mime_type ) ) ); } $alt_types = array_unique( array_diff( $alt_types, array( $mime_type ) ) ); foreach ( $alt_types as $alt_type ) { $alt_ext = wp_get_default_extension_for_mime_type( $alt_type ); if ( ! $alt_ext ) { continue; } $alt_ext = ".{$alt_ext}"; $alt_filename = preg_replace( '|' . preg_quote( $lc_ext ) . '$|', $alt_ext, $filename ); $alt_filenames[ $alt_ext ] = $alt_filename; } if ( ! empty( $alt_filenames ) ) { $alt_filenames[ $lc_ext ] = $filename; $i = 0; while ( $i <= $count && _wp_check_alternate_file_names( $alt_filenames, $_dir, $files ) ) { $new_number = (int) $number + 1; foreach ( $alt_filenames as $alt_ext => $alt_filename ) { $alt_filenames[ $alt_ext ] = str_replace( array( "-{$number}{$alt_ext}", "{$number}{$alt_ext}" ), "-{$new_number}{$alt_ext}", $alt_filename ); } $filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $filename ); $number = $new_number; $i++; } } } } return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback, $alt_filenames, $number ); } function _wp_check_alternate_file_names( $filenames, $dir, $files ) { foreach ( $filenames as $filename ) { if ( file_exists( $dir . $filename ) ) { return true; } if ( ! empty( $files ) && _wp_check_existing_file_names( $filename, $files ) ) { return true; } } return false; } function _wp_check_existing_file_names( $filename, $files ) { $fname = pathinfo( $filename, PATHINFO_FILENAME ); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); if ( empty( $fname ) ) { return false; } if ( $ext ) { $ext = ".$ext"; } $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/i'; foreach ( $files as $file ) { if ( preg_match( $regex, $file ) ) { return true; } } return false; } function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.0.0' ); } if ( empty( $name ) ) { return array( 'error' => __( 'Empty filename' ) ); } $wp_filetype = wp_check_filetype( $name ); if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) { return array( 'error' => __( 'Sorry, you are not allowed to upload this file type.' ) ); } $upload = wp_upload_dir( $time ); if ( false !== $upload['error'] ) { return $upload; } $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time, ) ); if ( ! is_array( $upload_bits_error ) ) { $upload['error'] = $upload_bits_error; return $upload; } $filename = wp_unique_filename( $upload['path'], $name ); $new_file = $upload['path'] . "/$filename"; if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir']; } else { $error_path = wp_basename( $upload['basedir'] ) . $upload['subdir']; } $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path ); return array( 'error' => $message ); } $ifp = @fopen( $new_file, 'wb' ); if ( ! $ifp ) { return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ), ); } fwrite( $ifp, $bits ); fclose( $ifp ); clearstatcache(); $stat = @ stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0007777; $perms = $perms & 0000666; chmod( $new_file, $perms ); clearstatcache(); $url = $upload['url'] . "/$filename"; if ( is_multisite() ) { clean_dirsize_cache( $new_file ); } return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false, ), 'sideload' ); } function wp_ext2type( $ext ) { $ext = strtolower( $ext ); $ext2type = wp_get_ext_types(); foreach ( $ext2type as $type => $exts ) { if ( in_array( $ext, $exts, true ) ) { return $type; } } } function wp_get_default_extension_for_mime_type( $mime_type ) { $extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) ); if ( empty( $extensions[0] ) ) { return false; } return $extensions[0]; } function wp_check_filetype( $filename, $mimes = null ) { if ( empty( $mimes ) ) { $mimes = get_allowed_mime_types(); } $type = false; $ext = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!\.(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $filename, $ext_matches ) ) { $type = $mime_match; $ext = $ext_matches[1]; break; } } return compact( 'ext', 'type' ); } function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { $proper_filename = false; $wp_filetype = wp_check_filetype( $filename, $mimes ); $ext = $wp_filetype['ext']; $type = $wp_filetype['type']; if ( ! file_exists( $file ) ) { return compact( 'ext', 'type', 'proper_filename' ); } $real_mime = false; if ( $type && 0 === strpos( $type, 'image/' ) ) { $real_mime = wp_get_image_mime( $file ); if ( $real_mime && $real_mime != $type ) { $mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array( 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/tiff' => 'tif', 'image/webp' => 'webp', ) ); if ( ! empty( $mime_to_ext[ $real_mime ] ) ) { $filename_parts = explode( '.', $filename ); array_pop( $filename_parts ); $filename_parts[] = $mime_to_ext[ $real_mime ]; $new_filename = implode( '.', $filename_parts ); if ( $new_filename != $filename ) { $proper_filename = $new_filename; } $wp_filetype = wp_check_filetype( $new_filename, $mimes ); $ext = $wp_filetype['ext']; $type = $wp_filetype['type']; } else { $real_mime = false; } } } if ( $type && ! $real_mime && extension_loaded( 'fileinfo' ) ) { $finfo = finfo_open( FILEINFO_MIME_TYPE ); $real_mime = finfo_file( $finfo, $file ); finfo_close( $finfo ); $nonspecific_types = array( 'application/octet-stream', 'application/encrypted', 'application/CDFV2-encrypted', 'application/zip', ); if ( in_array( $real_mime, $nonspecific_types, true ) ) { if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ), true ) ) { $type = false; $ext = false; } } elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) { if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) { $type = false; $ext = false; } } elseif ( 'text/plain' === $real_mime ) { if ( ! in_array( $type, array( 'text/plain', 'text/csv', 'application/csv', 'text/richtext', 'text/tsv', 'text/vtt', ), true ) ) { $type = false; $ext = false; } } elseif ( 'application/csv' === $real_mime ) { if ( ! in_array( $type, array( 'text/csv', 'text/plain', 'application/csv', ), true ) ) { $type = false; $ext = false; } } elseif ( 'text/rtf' === $real_mime ) { if ( ! in_array( $type, array( 'text/rtf', 'text/plain', 'application/rtf', ), true ) ) { $type = false; $ext = false; } } else { if ( $type !== $real_mime ) { $type = false; $ext = false; } } } if ( $type ) { $allowed = get_allowed_mime_types(); if ( ! in_array( $type, $allowed, true ) ) { $type = false; $ext = false; } } return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime ); } function wp_get_image_mime( $file ) { try { if ( is_callable( 'exif_imagetype' ) ) { $imagetype = exif_imagetype( $file ); $mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false; } elseif ( function_exists( 'getimagesize' ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $imagesize = getimagesize( $file ); } else { $imagesize = @getimagesize( $file ); } $mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false; } else { $mime = false; } if ( false !== $mime ) { return $mime; } $magic = file_get_contents( $file, false, null, 0, 12 ); if ( false === $magic ) { return false; } $magic = bin2hex( $magic ); if ( ( 0 === strpos( $magic, '52494646' ) ) && ( 16 === strpos( $magic, '57454250' ) ) ) { $mime = 'image/webp'; } } catch ( Exception $e ) { $mime = false; } return $mime; } function wp_get_mime_types() { return apply_filters( 'mime_types', array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tiff|tif' => 'image/tiff', 'webp' => 'image/webp', 'ico' => 'image/x-icon', 'heic' => 'image/heic', 'asf|asx' => 'video/x-ms-asf', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wm' => 'video/x-ms-wm', 'avi' => 'video/avi', 'divx' => 'video/divx', 'flv' => 'video/x-flv', 'mov|qt' => 'video/quicktime', 'mpeg|mpg|mpe' => 'video/mpeg', 'mp4|m4v' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'mkv' => 'video/x-matroska', '3gp|3gpp' => 'video/3gpp', '3g2|3gp2' => 'video/3gpp2', 'txt|asc|c|cc|h|srt' => 'text/plain', 'csv' => 'text/csv', 'tsv' => 'text/tab-separated-values', 'ics' => 'text/calendar', 'rtx' => 'text/richtext', 'css' => 'text/css', 'htm|html' => 'text/html', 'vtt' => 'text/vtt', 'dfxp' => 'application/ttaf+xml', 'mp3|m4a|m4b' => 'audio/mpeg', 'aac' => 'audio/aac', 'ra|ram' => 'audio/x-realaudio', 'wav' => 'audio/wav', 'ogg|oga' => 'audio/ogg', 'flac' => 'audio/flac', 'mid|midi' => 'audio/midi', 'wma' => 'audio/x-ms-wma', 'wax' => 'audio/x-ms-wax', 'mka' => 'audio/x-matroska', 'rtf' => 'application/rtf', 'js' => 'application/javascript', 'pdf' => 'application/pdf', 'swf' => 'application/x-shockwave-flash', 'class' => 'application/java', 'tar' => 'application/x-tar', 'zip' => 'application/zip', 'gz|gzip' => 'application/x-gzip', 'rar' => 'application/rar', '7z' => 'application/x-7z-compressed', 'exe' => 'application/x-msdownload', 'psd' => 'application/octet-stream', 'xcf' => 'application/octet-stream', 'doc' => 'application/msword', 'pot|pps|ppt' => 'application/vnd.ms-powerpoint', 'wri' => 'application/vnd.ms-write', 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel', 'mdb' => 'application/vnd.ms-access', 'mpp' => 'application/vnd.ms-project', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', 'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12', 'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote', 'oxps' => 'application/oxps', 'xps' => 'application/vnd.ms-xpsdocument', 'odt' => 'application/vnd.oasis.opendocument.text', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odb' => 'application/vnd.oasis.opendocument.database', 'odf' => 'application/vnd.oasis.opendocument.formula', 'wp|wpd' => 'application/wordperfect', 'key' => 'application/vnd.apple.keynote', 'numbers' => 'application/vnd.apple.numbers', 'pages' => 'application/vnd.apple.pages', ) ); } function wp_get_ext_types() { return apply_filters( 'ext2type', array( 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'webp' ), 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ), 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ), 'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ), 'text' => array( 'asc', 'csv', 'tsv', 'txt' ), 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ), 'code' => array( 'css', 'htm', 'html', 'php', 'js' ), ) ); } function wp_filesize( $path ) { $size = apply_filters( 'pre_wp_filesize', null, $path ); if ( is_int( $size ) ) { return $size; } $size = file_exists( $path ) ? (int) filesize( $path ) : 0; return (int) apply_filters( 'wp_filesize', $size, $path ); } function get_allowed_mime_types( $user = null ) { $t = wp_get_mime_types(); unset( $t['swf'], $t['exe'] ); if ( function_exists( 'current_user_can' ) ) { $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); } if ( empty( $unfiltered ) ) { unset( $t['htm|html'], $t['js'] ); } return apply_filters( 'upload_mimes', $t, $user ); } function wp_nonce_ays( $action ) { $title = __( 'Something went wrong.' ); $response_code = 403; if ( 'log-out' === $action ) { $title = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ); $html = $title; $html .= '</p><p>'; $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; $html .= sprintf( __( 'Do you really want to <a href="%s">log out</a>?' ), wp_logout_url( $redirect_to ) ); } else { $html = __( 'The link you followed has expired.' ); if ( wp_get_referer() ) { $html .= '</p><p>'; $html .= sprintf( '<a href="%s">%s</a>', esc_url( remove_query_arg( 'updated', wp_get_referer() ) ), __( 'Please try again.' ) ); } } wp_die( $html, $title, $response_code ); } function wp_die( $message = '', $title = '', $args = array() ) { global $wp_query; if ( is_int( $args ) ) { $args = array( 'response' => $args ); } elseif ( is_int( $title ) ) { $args = array( 'response' => $title ); $title = ''; } if ( wp_doing_ajax() ) { $callback = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); } elseif ( wp_is_json_request() ) { $callback = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) { $callback = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' ); } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { $callback = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); } elseif ( wp_is_xml_request() || isset( $wp_query ) && ( function_exists( 'is_feed' ) && is_feed() || function_exists( 'is_comment_feed' ) && is_comment_feed() || function_exists( 'is_trackback' ) && is_trackback() ) ) { $callback = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' ); } else { $callback = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); } call_user_func( $callback, $message, $title, $args ); } function _default_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( is_string( $message ) ) { if ( ! empty( $parsed_args['additional_errors'] ) ) { $message = array_merge( array( $message ), wp_list_pluck( $parsed_args['additional_errors'], 'message' ) ); $message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>"; } $message = sprintf( '<div class="wp-die-message">%s</div>', $message ); } $have_gettext = function_exists( '__' ); if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) { $link_url = $parsed_args['link_url']; if ( function_exists( 'esc_url' ) ) { $link_url = esc_url( $link_url ); } $link_text = $parsed_args['link_text']; $message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>"; } if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) { $back_text = $have_gettext ? __( '« Back' ) : '« Back'; $message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>"; } if ( ! did_action( 'admin_head' ) ) : if ( ! headers_sent() ) { header( "Content-Type: text/html; charset={$parsed_args['charset']}" ); status_header( $parsed_args['response'] ); nocache_headers(); } $text_direction = $parsed_args['text_direction']; $dir_attr = "dir='$text_direction'"; if ( empty( $args['text_direction'] ) && function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) { $dir_attr = get_language_attributes(); } ?> +<!DOCTYPE html> +<html <?php echo $dir_attr; ?>> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $parsed_args['charset']; ?>" /> + <meta name="viewport" content="width=device-width"> + <?php + if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) { add_filter( 'wp_robots', 'wp_robots_no_robots' ); wp_robots(); } ?> + <title><?php echo $title; ?> + + + + + + + + 200 ) ); list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( ! headers_sent() ) { if ( null !== $args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } if ( is_scalar( $message ) ) { $message = (string) $message; } else { $message = '0'; } if ( $parsed_args['exit'] ) { die( $message ); } echo $message; } function _json_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $data = array( 'code' => $parsed_args['code'], 'message' => $message, 'data' => array( 'status' => $parsed_args['response'], ), 'additional_errors' => $parsed_args['additional_errors'], ); if ( ! headers_sent() ) { header( "Content-Type: application/json; charset={$parsed_args['charset']}" ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } echo wp_json_encode( $data ); if ( $parsed_args['exit'] ) { die(); } } function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $data = array( 'code' => $parsed_args['code'], 'message' => $message, 'data' => array( 'status' => $parsed_args['response'], ), 'additional_errors' => $parsed_args['additional_errors'], ); if ( ! headers_sent() ) { header( "Content-Type: application/javascript; charset={$parsed_args['charset']}" ); header( 'X-Content-Type-Options: nosniff' ); header( 'X-Robots-Tag: noindex' ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } $result = wp_json_encode( $data ); $jsonp_callback = $_GET['_jsonp']; echo '/**/' . $jsonp_callback . '(' . $result . ')'; if ( $parsed_args['exit'] ) { die(); } } function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { global $wp_xmlrpc_server; list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( ! headers_sent() ) { nocache_headers(); } if ( $wp_xmlrpc_server ) { $error = new IXR_Error( $parsed_args['response'], $message ); $wp_xmlrpc_server->output( $error->getXml() ); } if ( $parsed_args['exit'] ) { die(); } } function _xml_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $message = htmlspecialchars( $message ); $title = htmlspecialchars( $title ); $xml = << + {$parsed_args['code']} + <![CDATA[{$title}]]> + + + {$parsed_args['response']} + + -.nav-menus-php .item-edit { - position: absolute; - right: -20px; - top: 0; - display: block; - width: 30px; - height: 40px; - outline: none; -} +EOD; +if ( ! headers_sent() ) { header( "Content-Type: text/xml; charset={$parsed_args['charset']}" ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } echo $xml; if ( $parsed_args['exit'] ) { die(); } } function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( $parsed_args['exit'] ) { if ( is_scalar( $message ) ) { die( (string) $message ); } die(); } if ( is_scalar( $message ) ) { echo (string) $message; } } function _wp_die_process_input( $message, $title = '', $args = array() ) { $defaults = array( 'response' => 0, 'code' => '', 'exit' => true, 'back_link' => false, 'link_url' => '', 'link_text' => '', 'text_direction' => '', 'charset' => 'utf-8', 'additional_errors' => array(), ); $args = wp_parse_args( $args, $defaults ); if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) { if ( ! empty( $message->errors ) ) { $errors = array(); foreach ( (array) $message->errors as $error_code => $error_messages ) { foreach ( (array) $error_messages as $error_message ) { $errors[] = array( 'code' => $error_code, 'message' => $error_message, 'data' => $message->get_error_data( $error_code ), ); } } $message = $errors[0]['message']; if ( empty( $args['code'] ) ) { $args['code'] = $errors[0]['code']; } if ( empty( $args['response'] ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['status'] ) ) { $args['response'] = $errors[0]['data']['status']; } if ( empty( $title ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['title'] ) ) { $title = $errors[0]['data']['title']; } unset( $errors[0] ); $args['additional_errors'] = array_values( $errors ); } else { $message = ''; } } $have_gettext = function_exists( '__' ); if ( empty( $args['code'] ) ) { $args['code'] = 'wp_die'; } if ( empty( $args['response'] ) ) { $args['response'] = 500; } if ( empty( $title ) ) { $title = $have_gettext ? __( 'WordPress › Error' ) : 'WordPress › Error'; } if ( empty( $args['text_direction'] ) || ! in_array( $args['text_direction'], array( 'ltr', 'rtl' ), true ) ) { $args['text_direction'] = 'ltr'; if ( function_exists( 'is_rtl' ) && is_rtl() ) { $args['text_direction'] = 'rtl'; } } if ( ! empty( $args['charset'] ) ) { $args['charset'] = _canonical_charset( $args['charset'] ); } return array( $message, $title, $args ); } function wp_json_encode( $data, $options = 0, $depth = 512 ) { $json = json_encode( $data, $options, $depth ); if ( false !== $json ) { return $json; } try { $data = _wp_json_sanity_check( $data, $depth ); } catch ( Exception $e ) { return false; } return json_encode( $data, $options, $depth ); } function _wp_json_sanity_check( $data, $depth ) { if ( $depth < 0 ) { throw new Exception( 'Reached depth limit' ); } if ( is_array( $data ) ) { $output = array(); foreach ( $data as $id => $el ) { if ( is_string( $id ) ) { $clean_id = _wp_json_convert_string( $id ); } else { $clean_id = $id; } if ( is_array( $el ) || is_object( $el ) ) { $output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 ); } elseif ( is_string( $el ) ) { $output[ $clean_id ] = _wp_json_convert_string( $el ); } else { $output[ $clean_id ] = $el; } } } elseif ( is_object( $data ) ) { $output = new stdClass; foreach ( $data as $id => $el ) { if ( is_string( $id ) ) { $clean_id = _wp_json_convert_string( $id ); } else { $clean_id = $id; } if ( is_array( $el ) || is_object( $el ) ) { $output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 ); } elseif ( is_string( $el ) ) { $output->$clean_id = _wp_json_convert_string( $el ); } else { $output->$clean_id = $el; } } } elseif ( is_string( $data ) ) { return _wp_json_convert_string( $data ); } else { return $data; } return $output; } function _wp_json_convert_string( $string ) { static $use_mb = null; if ( is_null( $use_mb ) ) { $use_mb = function_exists( 'mb_convert_encoding' ); } if ( $use_mb ) { $encoding = mb_detect_encoding( $string, mb_detect_order(), true ); if ( $encoding ) { return mb_convert_encoding( $string, 'UTF-8', $encoding ); } else { return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' ); } } else { return wp_check_invalid_utf8( $string, true ); } } function _wp_json_prepare_data( $data ) { _deprecated_function( __FUNCTION__, '5.3.0' ); return $data; } function wp_send_json( $response, $status_code = null, $options = 0 ) { if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Return a %1$s or %2$s object from your callback when using the REST API.' ), 'WP_REST_Response', 'WP_Error' ), '5.5.0' ); } if ( ! headers_sent() ) { header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); if ( null !== $status_code ) { status_header( $status_code ); } } echo wp_json_encode( $response, $options ); if ( wp_doing_ajax() ) { wp_die( '', '', array( 'response' => null, ) ); } else { die; } } function wp_send_json_success( $data = null, $status_code = null, $options = 0 ) { $response = array( 'success' => true ); if ( isset( $data ) ) { $response['data'] = $data; } wp_send_json( $response, $status_code, $options ); } function wp_send_json_error( $data = null, $status_code = null, $options = 0 ) { $response = array( 'success' => false ); if ( isset( $data ) ) { if ( is_wp_error( $data ) ) { $result = array(); foreach ( $data->errors as $code => $messages ) { foreach ( $messages as $message ) { $result[] = array( 'code' => $code, 'message' => $message, ); } } $response['data'] = $result; } else { $response['data'] = $data; } } wp_send_json( $response, $status_code, $options ); } function wp_check_jsonp_callback( $callback ) { if ( ! is_string( $callback ) ) { return false; } preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count ); return 0 === $illegal_char_count; } function wp_json_file_decode( $filename, $options = array() ) { $result = null; $filename = wp_normalize_path( realpath( $filename ) ); if ( ! file_exists( $filename ) ) { trigger_error( sprintf( __( "File %s doesn't exist!" ), $filename ) ); return $result; } $options = wp_parse_args( $options, array( 'associative' => false ) ); $decoded_file = json_decode( file_get_contents( $filename ), $options['associative'] ); if ( JSON_ERROR_NONE !== json_last_error() ) { trigger_error( sprintf( __( 'Error when decoding a JSON file at path %1$s: %2$s' ), $filename, json_last_error_msg() ) ); return $result; } return $decoded_file; } function _config_wp_home( $url = '' ) { if ( defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } return $url; } function _config_wp_siteurl( $url = '' ) { if ( defined( 'WP_SITEURL' ) ) { return untrailingslashit( WP_SITEURL ); } return $url; } function _delete_option_fresh_site() { update_option( 'fresh_site', '0' ); } function _mce_set_direction( $mce_init ) { if ( is_rtl() ) { $mce_init['directionality'] = 'rtl'; $mce_init['rtl_ui'] = true; if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) { $mce_init['plugins'] .= ',directionality'; } if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) { $mce_init['toolbar1'] .= ',ltr'; } } return $mce_init; } function smilies_init() { global $wpsmiliestrans, $wp_smiliessearch; if ( ! get_option( 'use_smilies' ) ) { return; } if ( ! isset( $wpsmiliestrans ) ) { $wpsmiliestrans = array( ':mrgreen:' => 'mrgreen.png', ':neutral:' => "\xf0\x9f\x98\x90", ':twisted:' => "\xf0\x9f\x98\x88", ':arrow:' => "\xe2\x9e\xa1", ':shock:' => "\xf0\x9f\x98\xaf", ':smile:' => "\xf0\x9f\x99\x82", ':???:' => "\xf0\x9f\x98\x95", ':cool:' => "\xf0\x9f\x98\x8e", ':evil:' => "\xf0\x9f\x91\xbf", ':grin:' => "\xf0\x9f\x98\x80", ':idea:' => "\xf0\x9f\x92\xa1", ':oops:' => "\xf0\x9f\x98\xb3", ':razz:' => "\xf0\x9f\x98\x9b", ':roll:' => "\xf0\x9f\x99\x84", ':wink:' => "\xf0\x9f\x98\x89", ':cry:' => "\xf0\x9f\x98\xa5", ':eek:' => "\xf0\x9f\x98\xae", ':lol:' => "\xf0\x9f\x98\x86", ':mad:' => "\xf0\x9f\x98\xa1", ':sad:' => "\xf0\x9f\x99\x81", '8-)' => "\xf0\x9f\x98\x8e", '8-O' => "\xf0\x9f\x98\xaf", ':-(' => "\xf0\x9f\x99\x81", ':-)' => "\xf0\x9f\x99\x82", ':-?' => "\xf0\x9f\x98\x95", ':-D' => "\xf0\x9f\x98\x80", ':-P' => "\xf0\x9f\x98\x9b", ':-o' => "\xf0\x9f\x98\xae", ':-x' => "\xf0\x9f\x98\xa1", ':-|' => "\xf0\x9f\x98\x90", ';-)' => "\xf0\x9f\x98\x89", '8O' => "\xf0\x9f\x98\xaf", ':(' => "\xf0\x9f\x99\x81", ':)' => "\xf0\x9f\x99\x82", ':?' => "\xf0\x9f\x98\x95", ':D' => "\xf0\x9f\x98\x80", ':P' => "\xf0\x9f\x98\x9b", ':o' => "\xf0\x9f\x98\xae", ':x' => "\xf0\x9f\x98\xa1", ':|' => "\xf0\x9f\x98\x90", ';)' => "\xf0\x9f\x98\x89", ':!:' => "\xe2\x9d\x97", ':?:' => "\xe2\x9d\x93", ); } $wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans ); if ( count( $wpsmiliestrans ) == 0 ) { return; } krsort( $wpsmiliestrans ); $spaces = wp_spaces_regexp(); $wp_smiliessearch = '/(?<=' . $spaces . '|^)'; $subchar = ''; foreach ( (array) $wpsmiliestrans as $smiley => $img ) { $firstchar = substr( $smiley, 0, 1 ); $rest = substr( $smiley, 1 ); if ( $firstchar != $subchar ) { if ( '' !== $subchar ) { $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; } $subchar = $firstchar; $wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:'; } else { $wp_smiliessearch .= '|'; } $wp_smiliessearch .= preg_quote( $rest, '/' ); } $wp_smiliessearch .= ')(?=' . $spaces . '|$)/m'; } function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { $parsed_args =& $args; } else { wp_parse_str( $args, $parsed_args ); } if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; } function wp_parse_list( $list ) { if ( ! is_array( $list ) ) { return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY ); } return $list; } function wp_parse_id_list( $list ) { $list = wp_parse_list( $list ); return array_unique( array_map( 'absint', $list ) ); } function wp_parse_slug_list( $list ) { $list = wp_parse_list( $list ); return array_unique( array_map( 'sanitize_title', $list ) ); } function wp_array_slice_assoc( $array, $keys ) { $slice = array(); foreach ( $keys as $key ) { if ( isset( $array[ $key ] ) ) { $slice[ $key ] = $array[ $key ]; } } return $slice; } function _wp_array_get( $array, $path, $default = null ) { if ( ! is_array( $path ) || 0 === count( $path ) ) { return $default; } foreach ( $path as $path_element ) { if ( ! is_array( $array ) || ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) || ! array_key_exists( $path_element, $array ) ) { return $default; } $array = $array[ $path_element ]; } return $array; } function _wp_array_set( &$array, $path, $value = null ) { if ( ! is_array( $array ) ) { return; } if ( ! is_array( $path ) ) { return; } $path_length = count( $path ); if ( 0 === $path_length ) { return; } foreach ( $path as $path_element ) { if ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) { return; } } for ( $i = 0; $i < $path_length - 1; ++$i ) { $path_element = $path[ $i ]; if ( ! array_key_exists( $path_element, $array ) || ! is_array( $array[ $path_element ] ) ) { $array[ $path_element ] = array(); } $array = &$array[ $path_element ]; } $array[ $path[ $i ] ] = $value; } function _wp_to_kebab_case( $string ) { $rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff'; $rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf'; $rsPunctuationRange = '\\x{2000}-\\x{206f}'; $rsSpaceRange = ' \\t\\x0b\\f\\xa0\\x{feff}\\n\\r\\x{2028}\\x{2029}\\x{1680}\\x{180e}\\x{2000}\\x{2001}\\x{2002}\\x{2003}\\x{2004}\\x{2005}\\x{2006}\\x{2007}\\x{2008}\\x{2009}\\x{200a}\\x{202f}\\x{205f}\\x{3000}'; $rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde'; $rsBreakRange = $rsNonCharRange . $rsPunctuationRange . $rsSpaceRange; $rsBreak = '[' . $rsBreakRange . ']'; $rsDigits = '\\d+'; $rsLower = '[' . $rsLowerRange . ']'; $rsMisc = '[^' . $rsBreakRange . $rsDigits . $rsLowerRange . $rsUpperRange . ']'; $rsUpper = '[' . $rsUpperRange . ']'; $rsMiscLower = '(?:' . $rsLower . '|' . $rsMisc . ')'; $rsMiscUpper = '(?:' . $rsUpper . '|' . $rsMisc . ')'; $rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])'; $rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])'; $regexp = '/' . implode( '|', array( $rsUpper . '?' . $rsLower . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper, '$' ) ) . ')', $rsMiscUpper . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper . $rsMiscLower, '$' ) ) . ')', $rsUpper . '?' . $rsMiscLower . '+', $rsUpper . '+', $rsOrdUpper, $rsOrdLower, $rsDigits, ) ) . '/u'; preg_match_all( $regexp, str_replace( "'", '', $string ), $matches ); return strtolower( implode( '-', $matches[0] ) ); } function wp_is_numeric_array( $data ) { if ( ! is_array( $data ) ) { return false; } $keys = array_keys( $data ); $string_keys = array_filter( $keys, 'is_string' ); return count( $string_keys ) === 0; } function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); $util->filter( $args, $operator ); if ( $field ) { $util->pluck( $field ); } return $util->get_output(); } function wp_list_filter( $list, $args = array(), $operator = 'AND' ) { return wp_filter_object_list( $list, $args, $operator ); } function wp_list_pluck( $list, $field, $index_key = null ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); return $util->pluck( $field, $index_key ); } function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); return $util->sort( $orderby, $order, $preserve_keys ); } function wp_maybe_load_widgets() { if ( ! apply_filters( 'load_default_widgets', true ) ) { return; } require_once ABSPATH . WPINC . '/default-widgets.php'; add_action( '_admin_menu', 'wp_widgets_add_menu' ); } function wp_widgets_add_menu() { global $submenu; if ( ! current_theme_supports( 'widgets' ) ) { return; } $menu_name = __( 'Widgets' ); if ( wp_is_block_theme() ) { $submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' ); } else { $submenu['themes.php'][7] = array( $menu_name, 'edit_theme_options', 'widgets.php' ); } ksort( $submenu['themes.php'], SORT_NUMERIC ); } function wp_ob_end_flush_all() { $levels = ob_get_level(); for ( $i = 0; $i < $levels; $i++ ) { ob_end_flush(); } } function dead_db() { global $wpdb; wp_load_translations_early(); if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) { require_once WP_CONTENT_DIR . '/db-error.php'; die(); } if ( wp_installing() || defined( 'WP_ADMIN' ) ) { wp_die( $wpdb->error ); } wp_die( '

      ' . __( 'Error establishing a database connection' ) . '

      ', __( 'Database Error' ) ); } function absint( $maybeint ) { return abs( (int) $maybeint ); } function _deprecated_function( $function, $version, $replacement = '' ) { do_action( 'deprecated_function_run', $function, $replacement, $version ); if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $replacement ) { trigger_error( sprintf( __( 'Function %1$s is deprecated since version %2$s! Use %3$s instead.' ), $function, $version, $replacement ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Function %1$s is deprecated since version %2$s with no alternative available.' ), $function, $version ), E_USER_DEPRECATED ); } } else { if ( $replacement ) { trigger_error( sprintf( 'Function %1$s is deprecated since version %2$s! Use %3$s instead.', $function, $version, $replacement ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'Function %1$s is deprecated since version %2$s with no alternative available.', $function, $version ), E_USER_DEPRECATED ); } } } } function _deprecated_constructor( $class, $version, $parent_class = '' ) { do_action( 'deprecated_constructor_run', $class, $version, $parent_class ); if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $parent_class ) { trigger_error( sprintf( __( 'The called constructor method for %1$s class in %2$s is deprecated since version %3$s! Use %4$s instead.' ), $class, $parent_class, $version, '__construct()' ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'The called constructor method for %1$s class is deprecated since version %2$s! Use %3$s instead.' ), $class, $version, '__construct()' ), E_USER_DEPRECATED ); } } else { if ( $parent_class ) { trigger_error( sprintf( 'The called constructor method for %1$s class in %2$s is deprecated since version %3$s! Use %4$s instead.', $class, $parent_class, $version, '__construct()' ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'The called constructor method for %1$s class is deprecated since version %2$s! Use %3$s instead.', $class, $version, '__construct()' ), E_USER_DEPRECATED ); } } } } function _deprecated_file( $file, $version, $replacement = '', $message = '' ) { do_action( 'deprecated_file_included', $file, $replacement, $version, $message ); if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) { $message = empty( $message ) ? '' : ' ' . $message; if ( function_exists( '__' ) ) { if ( $replacement ) { trigger_error( sprintf( __( 'File %1$s is deprecated since version %2$s! Use %3$s instead.' ), $file, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'File %1$s is deprecated since version %2$s with no alternative available.' ), $file, $version ) . $message, E_USER_DEPRECATED ); } } else { if ( $replacement ) { trigger_error( sprintf( 'File %1$s is deprecated since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'File %1$s is deprecated since version %2$s with no alternative available.', $file, $version ) . $message, E_USER_DEPRECATED ); } } } } function _deprecated_argument( $function, $version, $message = '' ) { do_action( 'deprecated_argument_run', $function, $message, $version ); if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $message ) { trigger_error( sprintf( __( 'Function %1$s was called with an argument that is deprecated since version %2$s! %3$s' ), $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Function %1$s was called with an argument that is deprecated since version %2$s with no alternative available.' ), $function, $version ), E_USER_DEPRECATED ); } } else { if ( $message ) { trigger_error( sprintf( 'Function %1$s was called with an argument that is deprecated since version %2$s! %3$s', $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'Function %1$s was called with an argument that is deprecated since version %2$s with no alternative available.', $function, $version ), E_USER_DEPRECATED ); } } } } function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) { do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message ); if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) { $message = empty( $message ) ? '' : ' ' . $message; if ( $replacement ) { trigger_error( sprintf( __( 'Hook %1$s is deprecated since version %2$s! Use %3$s instead.' ), $hook, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Hook %1$s is deprecated since version %2$s with no alternative available.' ), $hook, $version ) . $message, E_USER_DEPRECATED ); } } } function _doing_it_wrong( $function, $message, $version ) { do_action( 'doing_it_wrong_run', $function, $message, $version ); if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) { if ( function_exists( '__' ) ) { if ( $version ) { $version = sprintf( __( '(This message was added in version %s.)' ), $version ); } $message .= ' ' . sprintf( __( 'Please see Debugging in WordPress for more information.' ), __( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ); trigger_error( sprintf( __( 'Function %1$s was called incorrectly. %2$s %3$s' ), $function, $message, $version ), E_USER_NOTICE ); } else { if ( $version ) { $version = sprintf( '(This message was added in version %s.)', $version ); } $message .= sprintf( ' Please see Debugging in WordPress for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/' ); trigger_error( sprintf( 'Function %1$s was called incorrectly. %2$s %3$s', $function, $message, $version ), E_USER_NOTICE ); } } } function is_lighttpd_before_150() { $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' ); $server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : ''; return ( 'lighttpd' === $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ) ); } function apache_mod_loaded( $mod, $default = false ) { global $is_apache; if ( ! $is_apache ) { return false; } if ( function_exists( 'apache_get_modules' ) ) { $mods = apache_get_modules(); if ( in_array( $mod, $mods, true ) ) { return true; } } elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) { ob_start(); phpinfo( 8 ); $phpinfo = ob_get_clean(); if ( false !== strpos( $phpinfo, $mod ) ) { return true; } } return $default; } function iis7_supports_permalinks() { global $is_iis7; $supports_permalinks = false; if ( $is_iis7 ) { $supports_permalinks = class_exists( 'DOMDocument', false ) && isset( $_SERVER['IIS_UrlRewriteModule'] ) && ( 'cgi-fcgi' === PHP_SAPI ); } return apply_filters( 'iis7_supports_permalinks', $supports_permalinks ); } function validate_file( $file, $allowed_files = array() ) { if ( ! is_scalar( $file ) || '' === $file ) { return 0; } if ( '../' === $file ) { return 1; } if ( preg_match_all( '#\.\./#', $file, $matches, PREG_SET_ORDER ) && ( count( $matches ) > 1 ) ) { return 1; } if ( false !== strpos( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) { return 1; } if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files, true ) ) { return 3; } if ( ':' === substr( $file, 1, 1 ) ) { return 2; } return 0; } function force_ssl_admin( $force = null ) { static $forced = false; if ( ! is_null( $force ) ) { $old_forced = $forced; $forced = $force; return $old_forced; } return $forced; } function wp_guess_url() { if ( defined( 'WP_SITEURL' ) && '' !== WP_SITEURL ) { $url = WP_SITEURL; } else { $abspath_fix = str_replace( '\\', '/', ABSPATH ); $script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] ); if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) { $path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] ); } elseif ( $script_filename_dir . '/' === $abspath_fix ) { $path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] ); } else { if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) { $directory = str_replace( ABSPATH, '', $script_filename_dir ); $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ); } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) { $subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) ); $path = preg_replace( '#/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ) . $subdirectory; } else { $path = $_SERVER['REQUEST_URI']; } } $schema = is_ssl() ? 'https://' : 'http://'; $url = $schema . $_SERVER['HTTP_HOST'] . $path; } return rtrim( $url, '/' ); } function wp_suspend_cache_addition( $suspend = null ) { static $_suspend = false; if ( is_bool( $suspend ) ) { $_suspend = $suspend; } return $_suspend; } function wp_suspend_cache_invalidation( $suspend = true ) { global $_wp_suspend_cache_invalidation; $current_suspend = $_wp_suspend_cache_invalidation; $_wp_suspend_cache_invalidation = $suspend; return $current_suspend; } function is_main_site( $site_id = null, $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( ! $site_id ) { $site_id = get_current_blog_id(); } $site_id = (int) $site_id; return get_main_site_id( $network_id ) === $site_id; } function get_main_site_id( $network_id = null ) { if ( ! is_multisite() ) { return get_current_blog_id(); } $network = get_network( $network_id ); if ( ! $network ) { return 0; } return $network->site_id; } function is_main_network( $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( null === $network_id ) { $network_id = get_current_network_id(); } $network_id = (int) $network_id; return ( get_main_network_id() === $network_id ); } function get_main_network_id() { if ( ! is_multisite() ) { return 1; } $current_network = get_network(); if ( defined( 'PRIMARY_NETWORK_ID' ) ) { $main_network_id = PRIMARY_NETWORK_ID; } elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) { $main_network_id = 1; } else { $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1, ) ); $main_network_id = array_shift( $_networks ); } return (int) apply_filters( 'get_main_network_id', $main_network_id ); } function global_terms_enabled() { if ( ! is_multisite() ) { return false; } static $global_terms = null; if ( is_null( $global_terms ) ) { $filter = apply_filters( 'global_terms_enabled', null ); if ( ! is_null( $filter ) ) { $global_terms = (bool) $filter; } else { $global_terms = (bool) get_site_option( 'global_terms_enabled', false ); } } return $global_terms; } function is_site_meta_supported() { global $wpdb; if ( ! is_multisite() ) { return false; } $network_id = get_main_network_id(); $supported = get_network_option( $network_id, 'site_meta_supported', false ); if ( false === $supported ) { $supported = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->blogmeta}'" ) ? 1 : 0; update_network_option( $network_id, 'site_meta_supported', $supported ); } return (bool) $supported; } function wp_timezone_override_offset() { $timezone_string = get_option( 'timezone_string' ); if ( ! $timezone_string ) { return false; } $timezone_object = timezone_open( $timezone_string ); $datetime_object = date_create(); if ( false === $timezone_object || false === $datetime_object ) { return false; } return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); } function _wp_timezone_choice_usort_callback( $a, $b ) { if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) { if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) { return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) ); } if ( 'UTC' === $a['city'] ) { if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) { return 1; } return -1; } if ( 'UTC' === $b['city'] ) { if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) { return -1; } return 1; } return strnatcasecmp( $a['city'], $b['city'] ); } if ( $a['t_continent'] == $b['t_continent'] ) { if ( $a['t_city'] == $b['t_city'] ) { return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] ); } return strnatcasecmp( $a['t_city'], $b['t_city'] ); } else { if ( 'Etc' === $a['continent'] ) { return 1; } if ( 'Etc' === $b['continent'] ) { return -1; } return strnatcasecmp( $a['t_continent'], $b['t_continent'] ); } } function wp_timezone_choice( $selected_zone, $locale = null ) { static $mo_loaded = false, $locale_loaded = null; $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' ); if ( ! $mo_loaded || $locale !== $locale_loaded ) { $locale_loaded = $locale ? $locale : get_locale(); $mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo'; unload_textdomain( 'continents-cities' ); load_textdomain( 'continents-cities', $mofile ); $mo_loaded = true; } $zonen = array(); foreach ( timezone_identifiers_list() as $zone ) { $zone = explode( '/', $zone ); if ( ! in_array( $zone[0], $continents, true ) ) { continue; } $exists = array( 0 => ( isset( $zone[0] ) && $zone[0] ), 1 => ( isset( $zone[1] ) && $zone[1] ), 2 => ( isset( $zone[2] ) && $zone[2] ), ); $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ); $exists[4] = ( $exists[1] && $exists[3] ); $exists[5] = ( $exists[2] && $exists[3] ); $zonen[] = array( 'continent' => ( $exists[0] ? $zone[0] : '' ), 'city' => ( $exists[1] ? $zone[1] : '' ), 'subcity' => ( $exists[2] ? $zone[2] : '' ), 't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ), 't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), 't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ), ); } usort( $zonen, '_wp_timezone_choice_usort_callback' ); $structure = array(); if ( empty( $selected_zone ) ) { $structure[] = ''; } foreach ( $zonen as $key => $zone ) { $value = array( $zone['continent'] ); if ( empty( $zone['city'] ) ) { $display = $zone['t_continent']; } else { if ( ! isset( $zonen[ $key - 1 ] ) || $zonen[ $key - 1 ]['continent'] !== $zone['continent'] ) { $label = $zone['t_continent']; $structure[] = ''; } $value[] = $zone['city']; $display = $zone['t_city']; if ( ! empty( $zone['subcity'] ) ) { $value[] = $zone['subcity']; $display .= ' - ' . $zone['t_subcity']; } } $value = implode( '/', $value ); $selected = ''; if ( $value === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; if ( ! empty( $zone['city'] ) && ( ! isset( $zonen[ $key + 1 ] ) || ( isset( $zonen[ $key + 1 ] ) && $zonen[ $key + 1 ]['continent'] !== $zone['continent'] ) ) ) { $structure[] = ''; } } $structure[] = ''; $selected = ''; if ( 'UTC' === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; $structure[] = ''; $structure[] = ''; $offset_range = array( -12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14, ); foreach ( $offset_range as $offset ) { if ( 0 <= $offset ) { $offset_name = '+' . $offset; } else { $offset_name = (string) $offset; } $offset_value = $offset_name; $offset_name = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $offset_name ); $offset_name = 'UTC' . $offset_name; $offset_value = 'UTC' . $offset_value; $selected = ''; if ( $offset_value === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; } $structure[] = ''; return implode( "\n", $structure ); } function _cleanup_header_comment( $str ) { return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $str ) ); } function wp_scheduled_delete() { global $wpdb; $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); $posts_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A ); foreach ( (array) $posts_to_delete as $post ) { $post_id = (int) $post['post_id']; if ( ! $post_id ) { continue; } $del_post = get_post( $post_id ); if ( ! $del_post || 'trash' !== $del_post->post_status ) { delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); } else { wp_delete_post( $post_id ); } } $comments_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A ); foreach ( (array) $comments_to_delete as $comment ) { $comment_id = (int) $comment['comment_id']; if ( ! $comment_id ) { continue; } $del_comment = get_comment( $comment_id ); if ( ! $del_comment || 'trash' !== $del_comment->comment_approved ) { delete_comment_meta( $comment_id, '_wp_trash_meta_time' ); delete_comment_meta( $comment_id, '_wp_trash_meta_status' ); } else { wp_delete_comment( $del_comment ); } } } function get_file_data( $file, $default_headers, $context = '' ) { $file_data = file_get_contents( $file, false, null, 0, 8 * KB_IN_BYTES ); if ( false === $file_data ) { $file_data = ''; } $file_data = str_replace( "\r", "\n", $file_data ); $extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array(); if ( $extra_headers ) { $extra_headers = array_combine( $extra_headers, $extra_headers ); $all_headers = array_merge( $extra_headers, (array) $default_headers ); } else { $all_headers = $default_headers; } foreach ( $all_headers as $field => $regex ) { if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) { $all_headers[ $field ] = _cleanup_header_comment( $match[1] ); } else { $all_headers[ $field ] = ''; } } return $all_headers; } function __return_true() { return true; } function __return_false() { return false; } function __return_zero() { return 0; } function __return_empty_array() { return array(); } function __return_null() { return null; } function __return_empty_string() { return ''; } function send_nosniff_header() { header( 'X-Content-Type-Options: nosniff' ); } function _wp_mysql_week( $column ) { $start_of_week = (int) get_option( 'start_of_week' ); switch ( $start_of_week ) { case 1: return "WEEK( $column, 1 )"; case 2: case 3: case 4: case 5: case 6: return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )"; case 0: default: return "WEEK( $column, 0 )"; } } function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { $override = is_null( $start_parent ) ? array() : array( $start => $start_parent ); $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ); if ( ! $arbitrary_loop_member ) { return array(); } return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true ); } function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { $tortoise = $start; $hare = $start; $evanescent_hare = $start; $return = array(); while ( $tortoise && ( $evanescent_hare = isset( $override[ $hare ] ) ? $override[ $hare ] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) ) && ( $hare = isset( $override[ $evanescent_hare ] ) ? $override[ $evanescent_hare ] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) ) ) { if ( $_return_loop ) { $return[ $tortoise ] = true; $return[ $evanescent_hare ] = true; $return[ $hare ] = true; } if ( $tortoise == $evanescent_hare || $tortoise == $hare ) { return $_return_loop ? $return : $tortoise; } $tortoise = isset( $override[ $tortoise ] ) ? $override[ $tortoise ] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) ); } return false; } function send_frame_options_header() { header( 'X-Frame-Options: SAMEORIGIN' ); } function wp_allowed_protocols() { static $protocols = array(); if ( empty( $protocols ) ) { $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); } if ( ! did_action( 'wp_loaded' ) ) { $protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) ); } return $protocols; } function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { static $truncate_paths; $trace = debug_backtrace( false ); $caller = array(); $check_class = ! is_null( $ignore_class ); $skip_frames++; if ( ! isset( $truncate_paths ) ) { $truncate_paths = array( wp_normalize_path( WP_CONTENT_DIR ), wp_normalize_path( ABSPATH ), ); } foreach ( $trace as $call ) { if ( $skip_frames > 0 ) { $skip_frames--; } elseif ( isset( $call['class'] ) ) { if ( $check_class && $ignore_class == $call['class'] ) { continue; } $caller[] = "{$call['class']}{$call['type']}{$call['function']}"; } else { if ( in_array( $call['function'], array( 'do_action', 'apply_filters', 'do_action_ref_array', 'apply_filters_ref_array' ), true ) ) { $caller[] = "{$call['function']}('{$call['args'][0]}')"; } elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ), true ) ) { $filename = isset( $call['args'][0] ) ? $call['args'][0] : ''; $caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $filename ) ) . "')"; } else { $caller[] = $call['function']; } } } if ( $pretty ) { return implode( ', ', array_reverse( $caller ) ); } else { return $caller; } } function _get_non_cached_ids( $object_ids, $cache_key ) { $non_cached_ids = array(); $cache_values = wp_cache_get_multiple( $object_ids, $cache_key ); foreach ( $cache_values as $id => $value ) { if ( ! $value ) { $non_cached_ids[] = (int) $id; } } return $non_cached_ids; } function _device_can_upload() { if ( ! wp_is_mobile() ) { return true; } $ua = $_SERVER['HTTP_USER_AGENT']; if ( strpos( $ua, 'iPhone' ) !== false || strpos( $ua, 'iPad' ) !== false || strpos( $ua, 'iPod' ) !== false ) { return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' ); } return true; } function wp_is_stream( $path ) { $scheme_separator = strpos( $path, '://' ); if ( false === $scheme_separator ) { return false; } $stream = substr( $path, 0, $scheme_separator ); return in_array( $stream, stream_get_wrappers(), true ); } function wp_checkdate( $month, $day, $year, $source_date ) { return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date ); } function wp_auth_check_load() { if ( ! is_admin() && ! is_user_logged_in() ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { return; } $screen = get_current_screen(); $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); $show = ! in_array( $screen->id, $hidden, true ); if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { wp_enqueue_style( 'wp-auth-check' ); wp_enqueue_script( 'wp-auth-check' ); add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); } } function wp_auth_check_html() { $login_url = wp_login_url(); $current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; $same_domain = ( strpos( $login_url, $current_domain ) === 0 ); $same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain ); $wrap_class = $same_domain ? 'hidden' : 'hidden fallback'; ?> +
      +
      +
      + + '1', 'wp_lang' => get_user_locale(), ), $login_url ); ?> +
      + +
      +

      +

      +

      +
      +
      +
      + [\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) ); } function _canonical_charset( $charset ) { if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) { return 'UTF-8'; } if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) { return 'ISO-8859-1'; } return $charset; } function mbstring_binary_safe_encoding( $reset = false ) { static $encodings = array(); static $overloaded = null; if ( is_null( $overloaded ) ) { if ( function_exists( 'mb_internal_encoding' ) && ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) ) { $overloaded = true; } else { $overloaded = false; } } if ( false === $overloaded ) { return; } if ( ! $reset ) { $encoding = mb_internal_encoding(); array_push( $encodings, $encoding ); mb_internal_encoding( 'ISO-8859-1' ); } if ( $reset && $encodings ) { $encoding = array_pop( $encodings ); mb_internal_encoding( $encoding ); } } function reset_mbstring_encoding() { mbstring_binary_safe_encoding( true ); } function wp_validate_boolean( $var ) { if ( is_bool( $var ) ) { return $var; } if ( is_string( $var ) && 'false' === strtolower( $var ) ) { return false; } return (bool) $var; } function wp_delete_file( $file ) { $delete = apply_filters( 'wp_delete_file', $file ); if ( ! empty( $delete ) ) { @unlink( $delete ); } } function wp_delete_file_from_directory( $file, $directory ) { if ( wp_is_stream( $file ) ) { $real_file = $file; $real_directory = $directory; } else { $real_file = realpath( wp_normalize_path( $file ) ); $real_directory = realpath( wp_normalize_path( $directory ) ); } if ( false !== $real_file ) { $real_file = wp_normalize_path( $real_file ); } if ( false !== $real_directory ) { $real_directory = wp_normalize_path( $real_directory ); } if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) { return false; } wp_delete_file( $file ); return true; } function wp_post_preview_js() { global $post; if ( ! is_preview() || empty( $post ) ) { return; } $name = 'wp-preview-' . (int) $post->ID; ?> + + $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { if ( false !== ini_set( 'memory_limit', $filtered_limit ) ) { return $filtered_limit; } else { return false; } } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { if ( false !== ini_set( 'memory_limit', $wp_max_limit ) ) { return $wp_max_limit; } else { return false; } } return false; } function wp_generate_uuid4() { return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0x0fff ) | 0x4000, mt_rand( 0, 0x3fff ) | 0x8000, mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); } function wp_is_uuid( $uuid, $version = null ) { if ( ! is_string( $uuid ) ) { return false; } if ( is_numeric( $version ) ) { if ( 4 !== (int) $version ) { _doing_it_wrong( __FUNCTION__, __( 'Only UUID V4 is supported at this time.' ), '4.9.0' ); return false; } $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/'; } else { $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/'; } return (bool) preg_match( $regex, $uuid ); } function wp_unique_id( $prefix = '' ) { static $id_counter = 0; return $prefix . (string) ++$id_counter; } function wp_cache_get_last_changed( $group ) { $last_changed = wp_cache_get( 'last_changed', $group ); if ( ! $last_changed ) { $last_changed = microtime(); wp_cache_set( 'last_changed', $last_changed, $group ); } return $last_changed; } function wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) { $send = true; if ( 'you@example.com' === $old_email ) { $send = false; } $send = apply_filters( 'send_site_admin_email_change_email', $send, $old_email, $new_email ); if ( ! $send ) { return; } $email_change_text = __( 'Hi, -.nav-menus-php .item-edit:before { - margin-top: 10px; - margin-left: 4px; - width: 20px; - border-radius: 50%; - text-indent: -1px; /* account for the dashicon alignment */ -} +This notice confirms that the admin email address was changed on ###SITENAME###. -.no-js.nav-menus-php .item-edit:before { - display: none; -} +The new admin email address is ###NEW_EMAIL###. -.rtl .nav-menus-php .item-edit:before { - text-indent: 1px; /* account for the dashicon alignment */ -} - -.js.nav-menus-php .item-edit:focus { - box-shadow: none; -} - -.nav-menus-php .item-edit:focus:before { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -/* Menu editing */ -.menu-instructions-inactive { - display: none; -} - -.menu-item-settings { - display: block; - max-width: 392px; - padding: 10px; - position: relative; - z-index: 10; /* Keep .item-title's shadow from appearing on top of .menu-item-settings */ - border: 1px solid #c3c4c7; - border-top: none; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); -} - -.menu-item-settings .field-move { - margin: 3px 0 5px; - line-height: 1.5; -} - -.field-move-visual-label { - float: left; - margin-right: 4px; -} - -.menu-item-settings .field-move .button-link { - display: none; - margin: 0 2px; -} - -.menu-item-edit-active .menu-item-settings { - display: block; -} - -.menu-item-edit-inactive .menu-item-settings { - display: none; -} - -.add-menu-item-pagelinks { - margin: .5em -10px; - text-align: center; -} - -.add-menu-item-pagelinks .page-numbers { - display: inline-block; - min-width: 20px; -} - -.add-menu-item-pagelinks .page-numbers.dots { - min-width: 0; -} - -.link-to-original { - display: block; - margin: 0 0 15px; - padding: 3px 5px 5px; - border: 1px solid #dcdcde; - color: #646970; - font-size: 12px; -} - -.link-to-original a { - padding-left: 4px; - font-style: normal; -} - -.hidden-field { - display: none; -} - -.menu-item-settings .description-thin, -.menu-item-settings .description-wide { - margin-right: 10px; - float: left; -} - -.description-thin { - width: calc(50% - 5px); -} - -.menu-item-settings .description-thin + .description-thin { - margin-right: 0; -} - -.description-wide { - width: 100%; -} - -.menu-item-actions { - padding-top: 15px; - padding-bottom: 7px; -} - -#cancel-save { - cursor: pointer; -} - -/* Major/minor publishing actions (classes) */ -.nav-menus-php .major-publishing-actions { - clear: both; - padding: 10px 0; - line-height: 2.15384615; -} - -.nav-menus-php .major-publishing-actions .publishing-action { - text-align: right; - float: right; -} - -/* Same as the Publish Meta Box #delete-action */ -.nav-menus-php .delete-action { - float: left; - line-height: 2.1; -} - -.nav-menus-php .major-publishing-actions .form-invalid { - padding-left: 4px; - margin-left: -4px; -} - -#nav-menus-frame, -.button-controls, -#menu-item-url-wrap, -#menu-item-name-wrap { - display: block; -} - -/* =Media Queries --------------------------------------------------------------- */ - -@media only screen and (min-width: 769px) and (max-width: 1000px) { - body.menu-max-depth-0 { - min-width: 0 !important; - } - - #menu-management-liquid { - width: 100%; - } - - .nav-menus-php #post-body-content { - min-width: 0; - } -} - -@media screen and (max-width: 782px) { - body.nav-menus-php, - body.wp-customizer { - min-width: 0 !important; - } - - #nav-menus-frame { - margin-left: 0; - float: none; - width: 100%; - } - - #wpbody-content #menu-settings-column { - display: block; - width: 100%; - float: none; - margin-left: 0; - } - - #side-sortables .add-menu-item-tabs { - margin: 15px 0 14px; - } - - ul.add-menu-item-tabs li.tabs { - padding: 13px 15px 14px; - } - - .nav-menus-php .customlinkdiv .howto input { - width: 65%; - } - - .nav-menus-php .quick-search { - width: 85%; - } - - #menu-management-liquid { - margin-top: 25px; - } - - .nav-menus-php .menu-name-label.howto span { - margin-top: 13px - } - - #menu-name { - width: 100%; - } - - .nav-menus-php #nav-menu-header .major-publishing-actions .publishing-action { - padding-top: 1em; - } - - .nav-menus-php .delete-action { - font-size: 14px; - line-height: 2.14285714; - } - - .menu-item-bar .menu-item-handle, - .menu-item-settings, - .description-wide { - width: auto; - } - - .menu-item-settings { - padding: 10px; - } - - .menu-item-settings .description-thin, - .menu-item-settings .description-wide { - width: 100%; - } - - .menu-item-settings input { - width: 100%; - } - - .menu-item-settings input[type="checkbox"], - .menu-item-settings input[type="radio"] { - width: 25px; - } - - .menu-settings-group { - padding-left: 0; - overflow: visible; - } - - .menu-settings-group-name { - float: none; - width: auto; - margin-left: 0; - margin-bottom: 15px; - } - - .menu-settings-input { - float: none; - margin-bottom: 15px; - } - - .menu-edit .checkbox-input { - margin-top: 0; - } - - .manage-menus select { - margin: 0.5em 0; - } - - .wp-core-ui .manage-menus .button { - margin-bottom: 0; - } - - .widefat .menu-locations .menu-location-title { - padding-top: 16px; - } -} +This email has been sent to ###OLD_EMAIL### -@media only screen and (min-width: 783px) { - @supports (position: sticky) and (scroll-margin-bottom: 130px) { - - #nav-menu-footer { - position: sticky; - bottom: 0; - z-index: 10; - box-shadow: 0 -1px 0 0 #ddd; - } - - #save_menu_header { - display: none; - } - } -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $email_change_email = array( 'to' => $old_email, 'subject' => __( '[%s] Admin Email Changed' ), 'message' => $email_change_text, 'headers' => '', ); $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $email_change_email = apply_filters( 'site_admin_email_change_email', $email_change_email, $old_email, $new_email ); $email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITENAME###', $site_name, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $site_name ), $email_change_email['message'], $email_change_email['headers'] ); } function wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) { if ( empty( $ip_addr ) ) { return '0.0.0.0'; } $ip_prefix = ''; $is_ipv6 = substr_count( $ip_addr, ':' ) > 1; $is_ipv4 = ( 3 === substr_count( $ip_addr, '.' ) ); if ( $is_ipv6 && $is_ipv4 ) { $ip_prefix = '::ffff:'; $ip_addr = preg_replace( '/^\[?[0-9a-f:]*:/i', '', $ip_addr ); $ip_addr = str_replace( ']', '', $ip_addr ); $is_ipv6 = false; } if ( $is_ipv6 ) { $left_bracket = strpos( $ip_addr, '[' ); $right_bracket = strpos( $ip_addr, ']' ); $percent = strpos( $ip_addr, '%' ); $netmask = 'ffff:ffff:ffff:ffff:0000:0000:0000:0000'; if ( false !== $left_bracket && false !== $right_bracket ) { $ip_addr = substr( $ip_addr, $left_bracket + 1, $right_bracket - $left_bracket - 1 ); } elseif ( false !== $left_bracket || false !== $right_bracket ) { return '::'; } if ( false !== $percent ) { $ip_addr = substr( $ip_addr, 0, $percent ); } if ( preg_match( '/[^0-9a-f:]/i', $ip_addr ) ) { return '::'; } if ( function_exists( 'inet_pton' ) && function_exists( 'inet_ntop' ) ) { $ip_addr = inet_ntop( inet_pton( $ip_addr ) & inet_pton( $netmask ) ); if ( false === $ip_addr ) { return '::'; } } elseif ( ! $ipv6_fallback ) { return '::'; } } elseif ( $is_ipv4 ) { $last_octet_position = strrpos( $ip_addr, '.' ); $ip_addr = substr( $ip_addr, 0, $last_octet_position ) . '.0'; } else { return '0.0.0.0'; } return $ip_prefix . $ip_addr; } function wp_privacy_anonymize_data( $type, $data = '' ) { switch ( $type ) { case 'email': $anonymous = 'deleted@site.invalid'; break; case 'url': $anonymous = 'https://site.invalid'; break; case 'ip': $anonymous = wp_privacy_anonymize_ip( $data ); break; case 'date': $anonymous = '0000-00-00 00:00:00'; break; case 'text': $anonymous = __( '[deleted]' ); break; case 'longtext': $anonymous = __( 'This content was deleted by the author.' ); break; default: $anonymous = ''; break; } return apply_filters( 'wp_privacy_anonymize_data', $anonymous, $type, $data ); } function wp_privacy_exports_dir() { $upload_dir = wp_upload_dir(); $exports_dir = trailingslashit( $upload_dir['basedir'] ) . 'wp-personal-data-exports/'; return apply_filters( 'wp_privacy_exports_dir', $exports_dir ); } function wp_privacy_exports_url() { $upload_dir = wp_upload_dir(); $exports_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-personal-data-exports/'; return apply_filters( 'wp_privacy_exports_url', $exports_url ); } function wp_schedule_delete_old_privacy_export_files() { if ( wp_installing() ) { return; } if ( ! wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) ) { wp_schedule_event( time(), 'hourly', 'wp_privacy_delete_old_export_files' ); } } function wp_privacy_delete_old_export_files() { $exports_dir = wp_privacy_exports_dir(); if ( ! is_dir( $exports_dir ) ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $export_files = list_files( $exports_dir, 100, array( 'index.php' ) ); $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); foreach ( (array) $export_files as $export_file ) { $file_age_in_seconds = time() - filemtime( $export_file ); if ( $expiration < $file_age_in_seconds ) { unlink( $export_file ); } } } function wp_get_update_php_url() { $default_url = wp_get_default_update_php_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) { $update_url = getenv( 'WP_UPDATE_PHP_URL' ); } $update_url = apply_filters( 'wp_update_php_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } function wp_get_default_update_php_url() { return _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' ); } function wp_update_php_annotation( $before = '

      ', $after = '

      ' ) { $annotation = wp_get_update_php_annotation(); if ( $annotation ) { echo $before . $annotation . $after; } } function wp_get_update_php_annotation() { $update_url = wp_get_update_php_url(); $default_url = wp_get_default_update_php_url(); if ( $update_url === $default_url ) { return ''; } $annotation = sprintf( __( 'This resource is provided by your web host, and is specific to your site. For more information, see the official WordPress documentation.' ), esc_url( $default_url ) ); return $annotation; } function wp_get_direct_php_update_url() { $direct_update_url = ''; if ( false !== getenv( 'WP_DIRECT_UPDATE_PHP_URL' ) ) { $direct_update_url = getenv( 'WP_DIRECT_UPDATE_PHP_URL' ); } $direct_update_url = apply_filters( 'wp_direct_php_update_url', $direct_update_url ); return $direct_update_url; } function wp_direct_php_update_button() { $direct_update_url = wp_get_direct_php_update_url(); if ( empty( $direct_update_url ) ) { return; } echo '

      '; printf( '%2$s %3$s', esc_url( $direct_update_url ), __( 'Update PHP' ), __( '(opens in a new tab)' ) ); echo '

      '; } function wp_get_update_https_url() { $default_url = wp_get_default_update_https_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) { $update_url = getenv( 'WP_UPDATE_HTTPS_URL' ); } $update_url = apply_filters( 'wp_update_https_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } function wp_get_default_update_https_url() { return __( 'https://wordpress.org/support/article/why-should-i-use-https/' ); } function wp_get_direct_update_https_url() { $direct_update_url = ''; if ( false !== getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' ) ) { $direct_update_url = getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' ); } $direct_update_url = apply_filters( 'wp_direct_update_https_url', $direct_update_url ); return $direct_update_url; } function get_dirsize( $directory, $max_execution_time = null ) { if ( is_multisite() && is_main_site() ) { $size = recurse_dirsize( $directory, $directory . '/sites', $max_execution_time ); } else { $size = recurse_dirsize( $directory, null, $max_execution_time ); } return $size; } function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) { $directory = untrailingslashit( $directory ); $save_cache = false; if ( ! isset( $directory_cache ) ) { $directory_cache = get_transient( 'dirsize_cache' ); $save_cache = true; } if ( isset( $directory_cache[ $directory ] ) && is_int( $directory_cache[ $directory ] ) ) { return $directory_cache[ $directory ]; } if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) ) { return false; } if ( ( is_string( $exclude ) && $directory === $exclude ) || ( is_array( $exclude ) && in_array( $directory, $exclude, true ) ) ) { return false; } if ( null === $max_execution_time ) { if ( function_exists( 'ini_get' ) ) { $max_execution_time = ini_get( 'max_execution_time' ); } else { $max_execution_time = 0; } if ( $max_execution_time > 10 ) { $max_execution_time -= 1; } } $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache ); if ( false === $size ) { $size = 0; $handle = opendir( $directory ); if ( $handle ) { while ( ( $file = readdir( $handle ) ) !== false ) { $path = $directory . '/' . $file; if ( '.' !== $file && '..' !== $file ) { if ( is_file( $path ) ) { $size += filesize( $path ); } elseif ( is_dir( $path ) ) { $handlesize = recurse_dirsize( $path, $exclude, $max_execution_time, $directory_cache ); if ( $handlesize > 0 ) { $size += $handlesize; } } if ( $max_execution_time > 0 && ( microtime( true ) - WP_START_TIMESTAMP ) > $max_execution_time ) { $size = null; break; } } } closedir( $handle ); } } if ( ! is_array( $directory_cache ) ) { $directory_cache = array(); } $directory_cache[ $directory ] = $size; if ( $save_cache ) { set_transient( 'dirsize_cache', $directory_cache ); } return $size; } function clean_dirsize_cache( $path ) { if ( ! is_string( $path ) || empty( $path ) ) { trigger_error( sprintf( __( '%1$s only accepts a non-empty path string, received %2$s.' ), 'clean_dirsize_cache()', '' . gettype( $path ) . '' ) ); return; } $directory_cache = get_transient( 'dirsize_cache' ); if ( empty( $directory_cache ) ) { return; } if ( strpos( $path, '/' ) === false && strpos( $path, '\\' ) === false ) { unset( $directory_cache[ $path ] ); set_transient( 'dirsize_cache', $directory_cache ); return; } $last_path = null; $path = untrailingslashit( $path ); unset( $directory_cache[ $path ] ); while ( $last_path !== $path && DIRECTORY_SEPARATOR !== $path && '.' !== $path && '..' !== $path ) { $last_path = $path; $path = dirname( $path ); unset( $directory_cache[ $path ] ); } set_transient( 'dirsize_cache', $directory_cache ); } function is_wp_version_compatible( $required ) { global $wp_version; list( $version ) = explode( '-', $wp_version ); return empty( $required ) || version_compare( $version, $required, '>=' ); } function is_php_version_compatible( $required ) { return empty( $required ) || version_compare( phpversion(), $required, '>=' ); } function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) { return abs( (float) $expected - (float) $actual ) <= $precision; } function wp_recursive_ksort( &$array ) { foreach ( $array as &$value ) { if ( is_array( $value ) ) { wp_recursive_ksort( $value ); } } ksort( $array ); } parser = $parser; xml_set_object( $this->parser, $this ); xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' ); $status = xml_parse( $this->parser, $source ); if (! $status ) { $errorcode = xml_get_error_code( $this->parser ); if ( $errorcode != XML_ERROR_NONE ) { $xml_error = xml_error_string( $errorcode ); $error_line = xml_get_current_line_number($this->parser); $error_col = xml_get_current_column_number($this->parser); $errormsg = "$xml_error at line $error_line, column $error_col"; $this->error( $errormsg ); } } xml_parser_free( $this->parser ); unset( $this->parser ); $this->normalize(); } public function MagpieRSS( $source ) { self::__construct( $source ); } function feed_start_element($p, $element, &$attrs) { $el = $element = strtolower($element); $attrs = array_change_key_case($attrs, CASE_LOWER); $ns = false; if ( strpos( $element, ':' ) ) { list($ns, $el) = explode( ':', $element, 2); } if ( $ns and $ns != 'rdf' ) { $this->current_namespace = $ns; } if (!isset($this->feed_type) ) { if ( $el == 'rdf' ) { $this->feed_type = RSS; $this->feed_version = '1.0'; } elseif ( $el == 'rss' ) { $this->feed_type = RSS; $this->feed_version = $attrs['version']; } elseif ( $el == 'feed' ) { $this->feed_type = ATOM; $this->feed_version = $attrs['version']; $this->inchannel = true; } return; } if ( $el == 'channel' ) { $this->inchannel = true; } elseif ($el == 'item' or $el == 'entry' ) { $this->initem = true; if ( isset($attrs['rdf:about']) ) { $this->current_item['about'] = $attrs['rdf:about']; } } elseif ( $this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) { $this->intextinput = true; } elseif ( $this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) { $this->inimage = true; } elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { if ($el == 'content' ) { $el = 'atom_content'; } $this->incontent = $el; } elseif ($this->feed_type == ATOM and $this->incontent ) { $attrs_str = join(' ', array_map(array('MagpieRSS', 'map_attrs'), array_keys($attrs), array_values($attrs) ) ); $this->append_content( "<$element $attrs_str>" ); array_unshift( $this->stack, $el ); } elseif ($this->feed_type == ATOM and $el == 'link' ) { if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) { $link_el = 'link'; } else { $link_el = 'link_' . $attrs['rel']; } $this->append($link_el, $attrs['href']); } else { array_unshift($this->stack, $el); } } function feed_cdata ($p, $text) { if ($this->feed_type == ATOM and $this->incontent) { $this->append_content( $text ); } else { $current_el = join('_', array_reverse($this->stack)); $this->append($current_el, $text); } } function feed_end_element ($p, $el) { $el = strtolower($el); if ( $el == 'item' or $el == 'entry' ) { $this->items[] = $this->current_item; $this->current_item = array(); $this->initem = false; } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) { $this->intextinput = false; } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) { $this->inimage = false; } elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { $this->incontent = false; } elseif ($el == 'channel' or $el == 'feed' ) { $this->inchannel = false; } elseif ($this->feed_type == ATOM and $this->incontent ) { if ( $this->stack[0] == $el ) { $this->append_content(""); } else { $this->append_content("<$el />"); } array_shift( $this->stack ); } else { array_shift( $this->stack ); } $this->current_namespace = false; } function concat (&$str1, $str2="") { if (!isset($str1) ) { $str1=""; } $str1 .= $str2; } function append_content($text) { if ( $this->initem ) { $this->concat( $this->current_item[ $this->incontent ], $text ); } elseif ( $this->inchannel ) { $this->concat( $this->channel[ $this->incontent ], $text ); } } function append($el, $text) { if (!$el) { return; } if ( $this->current_namespace ) { if ( $this->initem ) { $this->concat( $this->current_item[ $this->current_namespace ][ $el ], $text); } elseif ($this->inchannel) { $this->concat( $this->channel[ $this->current_namespace][ $el ], $text ); } elseif ($this->intextinput) { $this->concat( $this->textinput[ $this->current_namespace][ $el ], $text ); } elseif ($this->inimage) { $this->concat( $this->image[ $this->current_namespace ][ $el ], $text ); } } else { if ( $this->initem ) { $this->concat( $this->current_item[ $el ], $text); } elseif ($this->intextinput) { $this->concat( $this->textinput[ $el ], $text ); } elseif ($this->inimage) { $this->concat( $this->image[ $el ], $text ); } elseif ($this->inchannel) { $this->concat( $this->channel[ $el ], $text ); } } } function normalize () { if ( $this->is_atom() ) { $this->channel['descripton'] = $this->channel['tagline']; for ( $i = 0; $i < count($this->items); $i++) { $item = $this->items[$i]; if ( isset($item['summary']) ) $item['description'] = $item['summary']; if ( isset($item['atom_content'])) $item['content']['encoded'] = $item['atom_content']; $this->items[$i] = $item; } } elseif ( $this->is_rss() ) { $this->channel['tagline'] = $this->channel['description']; for ( $i = 0; $i < count($this->items); $i++) { $item = $this->items[$i]; if ( isset($item['description'])) $item['summary'] = $item['description']; if ( isset($item['content']['encoded'] ) ) $item['atom_content'] = $item['content']['encoded']; $this->items[$i] = $item; } } } function is_rss () { if ( $this->feed_type == RSS ) { return $this->feed_version; } else { return false; } } function is_atom() { if ( $this->feed_type == ATOM ) { return $this->feed_version; } else { return false; } } function map_attrs($k, $v) { return "$k=\"$v\""; } function error( $errormsg, $lvl = E_USER_WARNING ) { if ( MAGPIE_DEBUG ) { trigger_error( $errormsg, $lvl); } else { error_log( $errormsg, 0); } } } if ( !function_exists('fetch_rss') ) : function fetch_rss ($url) { init(); if ( !isset($url) ) { return false; } if ( !MAGPIE_CACHE_ON ) { $resp = _fetch_remote_file( $url ); if ( is_success( $resp->status ) ) { return _response_to_rss( $resp ); } else { return false; } } else { $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); if (MAGPIE_DEBUG and $cache->ERROR) { debug($cache->ERROR, E_USER_WARNING); } $cache_status = 0; $request_headers = array(); $rss = 0; $errormsg = 0; if (!$cache->ERROR) { $cache_status = $cache->check_cache( $url ); } if ( $cache_status == 'HIT' ) { $rss = $cache->get( $url ); if ( isset($rss) and $rss ) { $rss->from_cache = 1; if ( MAGPIE_DEBUG > 1) { debug("MagpieRSS: Cache HIT", E_USER_NOTICE); } return $rss; } } if ( $cache_status == 'STALE' ) { $rss = $cache->get( $url ); if ( isset($rss->etag) and $rss->last_modified ) { $request_headers['If-None-Match'] = $rss->etag; $request_headers['If-Last-Modified'] = $rss->last_modified; } } $resp = _fetch_remote_file( $url, $request_headers ); if (isset($resp) and $resp) { if ($resp->status == '304' ) { if ( MAGPIE_DEBUG > 1) { debug("Got 304 for $url"); } $cache->set($url, $rss); return $rss; } elseif ( is_success( $resp->status ) ) { $rss = _response_to_rss( $resp ); if ( $rss ) { if (MAGPIE_DEBUG > 1) { debug("Fetch successful"); } $cache->set( $url, $rss ); return $rss; } } else { $errormsg = "Failed to fetch $url. "; if ( $resp->error ) { $http_error = substr($resp->error, 0, -2); $errormsg .= "(HTTP Error: $http_error)"; } else { $errormsg .= "(HTTP Response: " . $resp->response_code .')'; } } } else { $errormsg = "Unable to retrieve RSS file for unknown reasons."; } if ($rss) { if ( MAGPIE_DEBUG ) { debug("Returning STALE object for $url"); } return $rss; } return false; } } endif; function _fetch_remote_file($url, $headers = "" ) { $resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) ); if ( is_wp_error($resp) ) { $error = array_shift($resp->errors); $resp = new stdClass; $resp->status = 500; $resp->response_code = 500; $resp->error = $error[0] . "\n"; return $resp; } $return_headers = array(); foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { if ( !is_array($value) ) { $return_headers[] = "$key: $value"; } else { foreach ( $value as $v ) $return_headers[] = "$key: $v"; } } $response = new stdClass; $response->status = wp_remote_retrieve_response_code( $resp ); $response->response_code = wp_remote_retrieve_response_code( $resp ); $response->headers = $return_headers; $response->results = wp_remote_retrieve_body( $resp ); return $response; } function _response_to_rss ($resp) { $rss = new MagpieRSS( $resp->results ); if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) { foreach ( (array) $resp->headers as $h) { if (strpos($h, ": ")) { list($field, $val) = explode(": ", $h, 2); } else { $field = $h; $val = ""; } if ( $field == 'etag' ) { $rss->etag = $val; } if ( $field == 'last-modified' ) { $rss->last_modified = $val; } } return $rss; } else { $errormsg = "Failed to parse RSS file."; if ($rss) { $errormsg .= " (" . $rss->ERROR . ")"; } return false; } } function init () { if ( defined('MAGPIE_INITALIZED') ) { return; } else { define('MAGPIE_INITALIZED', 1); } if ( !defined('MAGPIE_CACHE_ON') ) { define('MAGPIE_CACHE_ON', 1); } if ( !defined('MAGPIE_CACHE_DIR') ) { define('MAGPIE_CACHE_DIR', './cache'); } if ( !defined('MAGPIE_CACHE_AGE') ) { define('MAGPIE_CACHE_AGE', 60*60); } if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { define('MAGPIE_CACHE_FRESH_ONLY', 0); } if ( !defined('MAGPIE_DEBUG') ) { define('MAGPIE_DEBUG', 0); } if ( !defined('MAGPIE_USER_AGENT') ) { $ua = 'WordPress/' . $GLOBALS['wp_version']; if ( MAGPIE_CACHE_ON ) { $ua = $ua . ')'; } else { $ua = $ua . '; No cache)'; } define('MAGPIE_USER_AGENT', $ua); } if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { define('MAGPIE_FETCH_TIME_OUT', 2); } if ( !defined('MAGPIE_USE_GZIP') ) { define('MAGPIE_USE_GZIP', true); } } function is_info ($sc) { return $sc >= 100 && $sc < 200; } function is_success ($sc) { return $sc >= 200 && $sc < 300; } function is_redirect ($sc) { return $sc >= 300 && $sc < 400; } function is_error ($sc) { return $sc >= 400 && $sc < 600; } function is_client_error ($sc) { return $sc >= 400 && $sc < 500; } function is_server_error ($sc) { return $sc >= 500 && $sc < 600; } class RSSCache { var $BASE_CACHE; var $MAX_AGE = 43200; var $ERROR = ''; function __construct( $base = '', $age = '' ) { $this->BASE_CACHE = WP_CONTENT_DIR . '/cache'; if ( $base ) { $this->BASE_CACHE = $base; } if ( $age ) { $this->MAX_AGE = $age; } } public function RSSCache( $base = '', $age = '' ) { self::__construct( $base, $age ); } function set ($url, $rss) { $cache_option = 'rss_' . $this->file_name( $url ); set_transient($cache_option, $rss, $this->MAX_AGE); return $cache_option; } function get ($url) { $this->ERROR = ""; $cache_option = 'rss_' . $this->file_name( $url ); if ( ! $rss = get_transient( $cache_option ) ) { $this->debug( "Cache does not contain: $url (cache option: $cache_option)" ); return 0; } return $rss; } function check_cache ( $url ) { $this->ERROR = ""; $cache_option = 'rss_' . $this->file_name( $url ); if ( get_transient($cache_option) ) { return 'HIT'; } else { return 'MISS'; } } function serialize ( $rss ) { return serialize( $rss ); } function unserialize ( $data ) { return unserialize( $data ); } function file_name ($url) { return md5( $url ); } function error ($errormsg, $lvl=E_USER_WARNING) { $this->ERROR = $errormsg; if ( MAGPIE_DEBUG ) { trigger_error( $errormsg, $lvl); } else { error_log( $errormsg, 0); } } function debug ($debugmsg, $lvl=E_USER_NOTICE) { if ( MAGPIE_DEBUG ) { $this->error("MagpieRSS [debug] $debugmsg", $lvl); } } } if ( !function_exists('parse_w3cdtf') ) : function parse_w3cdtf ( $date_str ) { $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; if ( preg_match( $pat, $date_str, $match ) ) { list( $year, $month, $day, $hours, $minutes, $seconds) = array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); $offset = 0; if ( $match[11] == 'Z' ) { } else { list( $tz_mod, $tz_hour, $tz_min ) = array( $match[8], $match[9], $match[10]); if ( ! $tz_hour ) { $tz_hour = 0; } if ( ! $tz_min ) { $tz_min = 0; } $offset_secs = (($tz_hour*60)+$tz_min)*60; if ( $tz_mod == '+' ) { $offset_secs = $offset_secs * -1; } $offset = $offset_secs; } $epoch = $epoch + $offset; return $epoch; } else { return -1; } } endif; if ( !function_exists('wp_rss') ) : function wp_rss( $url, $num_items = -1 ) { if ( $rss = fetch_rss( $url ) ) { echo '
        '; if ( $num_items !== -1 ) { $rss->items = array_slice( $rss->items, 0, $num_items ); } foreach ( (array) $rss->items as $item ) { printf( '
      • %3$s
      • ', esc_url( $item['link'] ), esc_attr( strip_tags( $item['description'] ) ), esc_html( $item['title'] ) ); } echo '
      '; } else { _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); } } endif; if ( !function_exists('get_rss') ) : function get_rss ($url, $num_items = 5) { $rss = fetch_rss($url); if ( $rss ) { $rss->items = array_slice($rss->items, 0, $num_items); foreach ( (array) $rss->items as $item ) { echo "
    • \n"; echo ""; echo esc_html($item['title']); echo "
      \n"; echo "
    • \n"; } } else { return false; } } endif; &/\[\]\x00-\x20=]@', $tag ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' ), '4.4.0' ); return; } $shortcode_tags[ $tag ] = $callback; } function remove_shortcode( $tag ) { global $shortcode_tags; unset( $shortcode_tags[ $tag ] ); } function remove_all_shortcodes() { global $shortcode_tags; $shortcode_tags = array(); } function shortcode_exists( $tag ) { global $shortcode_tags; return array_key_exists( $tag, $shortcode_tags ); } function has_shortcode( $content, $tag ) { if ( false === strpos( $content, '[' ) ) { return false; } if ( shortcode_exists( $tag ) ) { preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); if ( empty( $matches ) ) { return false; } foreach ( $matches as $shortcode ) { if ( $tag === $shortcode[2] ) { return true; } elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) { return true; } } } return false; } function apply_shortcodes( $content, $ignore_html = false ) { return do_shortcode( $content, $ignore_html ); } function do_shortcode( $content, $ignore_html = false ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $content; } preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { return $content; } $content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); $content = unescape_invalid_shortcodes( $content ); return $content; } function get_shortcode_regex( $tagnames = null ) { global $shortcode_tags; if ( empty( $tagnames ) ) { $tagnames = array_keys( $shortcode_tags ); } $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); return '\\[' . '(\\[?)' . "($tagregexp)" . '(?![\\w-])' . '(' . '[^\\]\\/]*' . '(?:' . '\\/(?!\\])' . '[^\\]\\/]*' . ')*?' . ')' . '(?:' . '(\\/)' . '\\]' . '|' . '\\]' . '(?:' . '(' . '[^\\[]*+' . '(?:' . '\\[(?!\\/\\2\\])' . '[^\\[]*+' . ')*+' . ')' . '\\[\\/\\2\\]' . ')?' . ')' . '(\\]?)'; } function do_shortcode_tag( $m ) { global $shortcode_tags; if ( '[' === $m[1] && ']' === $m[6] ) { return substr( $m[0], 1, -1 ); } $tag = $m[2]; $attr = shortcode_parse_atts( $m[3] ); if ( ! is_callable( $shortcode_tags[ $tag ] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ), '4.3.0' ); return $m[0]; } $return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m ); if ( false !== $return ) { return $return; } $content = isset( $m[5] ) ? $m[5] : null; $output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6]; return apply_filters( 'do_shortcode_tag', $output, $tag, $attr, $m ); } function do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ) { $trans = array( '[' => '[', ']' => ']', ); $content = strtr( $content, $trans ); $trans = array( '[' => '[', ']' => ']', ); $pattern = get_shortcode_regex( $tagnames ); $textarr = wp_html_split( $content ); foreach ( $textarr as &$element ) { if ( '' === $element || '<' !== $element[0] ) { continue; } $noopen = false === strpos( $element, '[' ); $noclose = false === strpos( $element, ']' ); if ( $noopen || $noclose ) { if ( $noopen xor $noclose ) { $element = strtr( $element, $trans ); } continue; } if ( $ignore_html || '', $serialized_block_name, $serialized_attributes ); } return sprintf( '%s', $serialized_block_name, $serialized_attributes, $block_content, $serialized_block_name ); } function serialize_block( $block ) { $block_content = ''; $index = 0; foreach ( $block['innerContent'] as $chunk ) { $block_content .= is_string( $chunk ) ? $chunk : serialize_block( $block['innerBlocks'][ $index++ ] ); } if ( ! is_array( $block['attrs'] ) ) { $block['attrs'] = array(); } return get_comment_delimited_block_content( $block['blockName'], $block['attrs'], $block_content ); } function serialize_blocks( $blocks ) { return implode( '', array_map( 'serialize_block', $blocks ) ); } function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols = array() ) { $result = ''; $blocks = parse_blocks( $text ); foreach ( $blocks as $block ) { $block = filter_block_kses( $block, $allowed_html, $allowed_protocols ); $result .= serialize_block( $block ); } return $result; } function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() ) { $block['attrs'] = filter_block_kses_value( $block['attrs'], $allowed_html, $allowed_protocols ); if ( is_array( $block['innerBlocks'] ) ) { foreach ( $block['innerBlocks'] as $i => $inner_block ) { $block['innerBlocks'][ $i ] = filter_block_kses( $inner_block, $allowed_html, $allowed_protocols ); } } return $block; } function filter_block_kses_value( $value, $allowed_html, $allowed_protocols = array() ) { if ( is_array( $value ) ) { foreach ( $value as $key => $inner_value ) { $filtered_key = filter_block_kses_value( $key, $allowed_html, $allowed_protocols ); $filtered_value = filter_block_kses_value( $inner_value, $allowed_html, $allowed_protocols ); if ( $filtered_key !== $key ) { unset( $value[ $key ] ); } $value[ $filtered_key ] = $filtered_value; } } elseif ( is_string( $value ) ) { return wp_kses( $value, $allowed_html, $allowed_protocols ); } return $value; } function excerpt_remove_blocks( $content ) { $allowed_inner_blocks = array( null, 'core/freeform', 'core/heading', 'core/html', 'core/list', 'core/media-text', 'core/paragraph', 'core/preformatted', 'core/pullquote', 'core/quote', 'core/table', 'core/verse', ); $allowed_wrapper_blocks = array( 'core/columns', 'core/column', 'core/group', ); $allowed_wrapper_blocks = apply_filters( 'excerpt_allowed_wrapper_blocks', $allowed_wrapper_blocks ); $allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks ); $allowed_blocks = apply_filters( 'excerpt_allowed_blocks', $allowed_blocks ); $blocks = parse_blocks( $content ); $output = ''; foreach ( $blocks as $block ) { if ( in_array( $block['blockName'], $allowed_blocks, true ) ) { if ( ! empty( $block['innerBlocks'] ) ) { if ( in_array( $block['blockName'], $allowed_wrapper_blocks, true ) ) { $output .= _excerpt_render_inner_blocks( $block, $allowed_blocks ); continue; } foreach ( $block['innerBlocks'] as $inner_block ) { if ( ! in_array( $inner_block['blockName'], $allowed_inner_blocks, true ) || ! empty( $inner_block['innerBlocks'] ) ) { continue 2; } } } $output .= render_block( $block ); } } return $output; } function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) { $output = ''; foreach ( $parsed_block['innerBlocks'] as $inner_block ) { if ( ! in_array( $inner_block['blockName'], $allowed_blocks, true ) ) { continue; } if ( empty( $inner_block['innerBlocks'] ) ) { $output .= render_block( $inner_block ); } else { $output .= _excerpt_render_inner_blocks( $inner_block, $allowed_blocks ); } } return $output; } function render_block( $parsed_block ) { global $post; $parent_block = null; $pre_render = apply_filters( 'pre_render_block', null, $parsed_block, $parent_block ); if ( ! is_null( $pre_render ) ) { return $pre_render; } $source_block = $parsed_block; $parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block ); $context = array(); if ( $post instanceof WP_Post ) { $context['postId'] = $post->ID; $context['postType'] = $post->post_type; } $context = apply_filters( 'render_block_context', $context, $parsed_block, $parent_block ); $block = new WP_Block( $parsed_block, $context ); return $block->render(); } function parse_blocks( $content ) { $parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' ); $parser = new $parser_class(); return $parser->parse( $content ); } function do_blocks( $content ) { $blocks = parse_blocks( $content ); $output = ''; foreach ( $blocks as $block ) { $output .= render_block( $block ); } $priority = has_filter( 'the_content', 'wpautop' ); if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) { remove_filter( 'the_content', 'wpautop', $priority ); add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 ); } return $output; } function _restore_wpautop_hook( $content ) { $current_priority = has_filter( 'the_content', '_restore_wpautop_hook' ); add_filter( 'the_content', 'wpautop', $current_priority - 1 ); remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority ); return $content; } function block_version( $content ) { return has_blocks( $content ) ? 1 : 0; } function register_block_style( $block_name, $style_properties ) { return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties ); } function unregister_block_style( $block_name, $block_style_name ) { return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name ); } function block_has_support( $block_type, $feature, $default = false ) { $block_support = $default; if ( $block_type && property_exists( $block_type, 'supports' ) ) { $block_support = _wp_array_get( $block_type->supports, $feature, $default ); } return true === $block_support || is_array( $block_support ); } function wp_migrate_old_typography_shape( $metadata ) { if ( ! isset( $metadata['supports'] ) ) { return $metadata; } $typography_keys = array( '__experimentalFontFamily', '__experimentalFontStyle', '__experimentalFontWeight', '__experimentalLetterSpacing', '__experimentalTextDecoration', '__experimentalTextTransform', 'fontSize', 'lineHeight', ); foreach ( $typography_keys as $typography_key ) { $support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null ); if ( null !== $support_for_key ) { _doing_it_wrong( 'register_block_type_from_metadata()', sprintf( __( 'Block "%1$s" is declaring %2$s support in %3$s file under %4$s. %2$s support is now declared under %5$s.' ), $metadata['name'], "$typography_key", 'block.json', "supports.$typography_key", "supports.typography.$typography_key" ), '5.8.0' ); _wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key ); unset( $metadata['supports'][ $typography_key ] ); } } return $metadata; } function build_query_vars_from_query_block( $block, $page ) { $query = array( 'post_type' => 'post', 'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array(), ); if ( isset( $block->context['query'] ) ) { if ( ! empty( $block->context['query']['postType'] ) ) { $post_type_param = $block->context['query']['postType']; if ( is_post_type_viewable( $post_type_param ) ) { $query['post_type'] = $post_type_param; } } if ( isset( $block->context['query']['sticky'] ) && ! empty( $block->context['query']['sticky'] ) ) { $sticky = get_option( 'sticky_posts' ); if ( 'only' === $block->context['query']['sticky'] ) { $query['post__in'] = $sticky; } else { $query['post__not_in'] = array_merge( $query['post__not_in'], $sticky ); } } if ( ! empty( $block->context['query']['exclude'] ) ) { $excluded_post_ids = array_map( 'intval', $block->context['query']['exclude'] ); $excluded_post_ids = array_filter( $excluded_post_ids ); $query['post__not_in'] = array_merge( $query['post__not_in'], $excluded_post_ids ); } if ( isset( $block->context['query']['perPage'] ) && is_numeric( $block->context['query']['perPage'] ) ) { $per_page = absint( $block->context['query']['perPage'] ); $offset = 0; if ( isset( $block->context['query']['offset'] ) && is_numeric( $block->context['query']['offset'] ) ) { $offset = absint( $block->context['query']['offset'] ); } $query['offset'] = ( $per_page * ( $page - 1 ) ) + $offset; $query['posts_per_page'] = $per_page; } if ( ! empty( $block->context['query']['categoryIds'] ) || ! empty( $block->context['query']['tagIds'] ) ) { $tax_query = array(); if ( ! empty( $block->context['query']['categoryIds'] ) ) { $tax_query[] = array( 'taxonomy' => 'category', 'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ), 'include_children' => false, ); } if ( ! empty( $block->context['query']['tagIds'] ) ) { $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ), 'include_children' => false, ); } $query['tax_query'] = $tax_query; } if ( ! empty( $block->context['query']['taxQuery'] ) ) { $query['tax_query'] = array(); foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) { if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) { $query['tax_query'][] = array( 'taxonomy' => $taxonomy, 'terms' => array_filter( array_map( 'intval', $terms ) ), 'include_children' => false, ); } } } if ( isset( $block->context['query']['order'] ) && in_array( strtoupper( $block->context['query']['order'] ), array( 'ASC', 'DESC' ), true ) ) { $query['order'] = strtoupper( $block->context['query']['order'] ); } if ( isset( $block->context['query']['orderBy'] ) ) { $query['orderby'] = $block->context['query']['orderBy']; } if ( isset( $block->context['query']['author'] ) && (int) $block->context['query']['author'] > 0 ) { $query['author'] = (int) $block->context['query']['author']; } if ( ! empty( $block->context['query']['search'] ) ) { $query['s'] = $block->context['query']['search']; } } return $query; } function get_query_pagination_arrow( $block, $is_next ) { $arrow_map = array( 'none' => '', 'arrow' => array( 'next' => '→', 'previous' => '←', ), 'chevron' => array( 'next' => '»', 'previous' => '«', ), ); if ( ! empty( $block->context['paginationArrow'] ) && array_key_exists( $block->context['paginationArrow'], $arrow_map ) && ! empty( $arrow_map[ $block->context['paginationArrow'] ] ) ) { $pagination_type = $is_next ? 'next' : 'previous'; $arrow_attribute = $block->context['paginationArrow']; $arrow = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ]; $arrow_classes = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute"; return "$arrow"; } return null; } function _wp_multiple_block_styles( $metadata ) { foreach ( array( 'style', 'editorStyle' ) as $key ) { if ( ! empty( $metadata[ $key ] ) && is_array( $metadata[ $key ] ) ) { $default_style = array_shift( $metadata[ $key ] ); foreach ( $metadata[ $key ] as $handle ) { $args = array( 'handle' => $handle ); if ( 0 === strpos( $handle, 'file:' ) && isset( $metadata['file'] ) ) { $style_path = remove_block_asset_path_prefix( $handle ); $theme_path_norm = wp_normalize_path( get_theme_file_path() ); $style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) ); $is_theme_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $theme_path_norm ); $style_uri = plugins_url( $style_path, $metadata['file'] ); if ( $is_theme_block ) { $style_uri = get_theme_file_uri( str_replace( $theme_path_norm, '', $style_path_norm ) ); } $args = array( 'handle' => sanitize_key( "{$metadata['name']}-{$style_path}" ), 'src' => $style_uri, ); } wp_enqueue_block_style( $metadata['name'], $args ); } $metadata[ $key ] = $default_style; } } return $metadata; } add_filter( 'block_type_metadata', '_wp_multiple_block_styles' ); function build_comment_query_vars_from_block( $block ) { $comment_args = array( 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', 'no_found_rows' => false, ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } if ( ! empty( $block->context['postId'] ) ) { $comment_args['post_id'] = (int) $block->context['postId']; } if ( get_option( 'thread_comments' ) ) { $comment_args['hierarchical'] = 'threaded'; } else { $comment_args['hierarchical'] = false; } if ( get_option( 'page_comments' ) === '1' || get_option( 'page_comments' ) === true ) { $per_page = get_option( 'comments_per_page' ); $default_page = get_option( 'default_comments_page' ); if ( $per_page > 0 ) { $comment_args['number'] = $per_page; $page = (int) get_query_var( 'cpage' ); if ( $page ) { $comment_args['paged'] = $page; } elseif ( 'oldest' === $default_page ) { $comment_args['paged'] = 1; } elseif ( 'newest' === $default_page ) { $max_num_pages = (int) ( new WP_Comment_Query( $comment_args ) )->max_num_pages; if ( 0 !== $max_num_pages ) { $comment_args['paged'] = $max_num_pages; } } if ( 0 === $page && isset( $comment_args['paged'] ) && $comment_args['paged'] > 0 ) { set_query_var( 'cpage', $comment_args['paged'] ); } } } return $comment_args; } function get_comments_pagination_arrow( $block, $pagination_type = 'next' ) { $arrow_map = array( 'none' => '', 'arrow' => array( 'next' => '→', 'previous' => '←', ), 'chevron' => array( 'next' => '»', 'previous' => '«', ), ); if ( ! empty( $block->context['comments/paginationArrow'] ) && ! empty( $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ] ) ) { $arrow_attribute = $block->context['comments/paginationArrow']; $arrow = $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ]; $arrow_classes = "wp-block-comments-pagination-$pagination_type-arrow is-arrow-$arrow_attribute"; return "$arrow"; } return null; } get_settings(); return _wp_array_get( $settings, $path, $settings ); } function wp_get_global_styles( $path = array(), $context = array() ) { if ( ! empty( $context['block_name'] ) ) { $path = array_merge( array( 'blocks', $context['block_name'] ), $path ); } $origin = 'custom'; if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) { $origin = 'theme'; } $styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles']; return _wp_array_get( $styles, $path, $styles ); } function wp_get_global_stylesheet( $types = array() ) { $can_use_cached = ( ( empty( $types ) ) && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && ! is_admin() ); $transient_name = 'global_styles_' . get_stylesheet(); if ( $can_use_cached ) { $cached = get_transient( $transient_name ); if ( $cached ) { return $cached; } } $tree = WP_Theme_JSON_Resolver::get_merged_data(); $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); if ( empty( $types ) && ! $supports_theme_json ) { $types = array( 'variables', 'presets' ); } elseif ( empty( $types ) ) { $types = array( 'variables', 'styles', 'presets' ); } $styles_variables = ''; if ( in_array( 'variables', $types, true ) ) { $styles_variables = $tree->get_stylesheet( array( 'variables' ) ); $types = array_diff( $types, array( 'variables' ) ); } $styles_rest = ''; if ( ! empty( $types ) ) { $origins = array( 'default', 'theme', 'custom' ); if ( ! $supports_theme_json ) { $origins = array( 'default' ); } $styles_rest = $tree->get_stylesheet( $types, $origins ); } $stylesheet = $styles_variables . $styles_rest; if ( $can_use_cached ) { set_transient( $transient_name, $stylesheet, MINUTE_IN_SECONDS ); } return $stylesheet; } function wp_get_global_styles_svg_filters() { $can_use_cached = ( ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && ! is_admin() ); $transient_name = 'global_styles_svg_filters_' . get_stylesheet(); if ( $can_use_cached ) { $cached = get_transient( $transient_name ); if ( $cached ) { return $cached; } } $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); $origins = array( 'default', 'theme', 'custom' ); if ( ! $supports_theme_json ) { $origins = array( 'default' ); } $tree = WP_Theme_JSON_Resolver::get_merged_data(); $svgs = $tree->get_svg_filters( $origins ); if ( $can_use_cached ) { set_transient( $transient_name, $svgs, MINUTE_IN_SECONDS ); } return $svgs; } register( $widget ); } function unregister_widget( $widget ) { global $wp_widget_factory; $wp_widget_factory->unregister( $widget ); } function register_sidebars( $number = 1, $args = array() ) { global $wp_registered_sidebars; $number = (int) $number; if ( is_string( $args ) ) { parse_str( $args, $args ); } for ( $i = 1; $i <= $number; $i++ ) { $_args = $args; if ( $number > 1 ) { if ( isset( $args['name'] ) ) { $_args['name'] = sprintf( $args['name'], $i ); } else { $_args['name'] = sprintf( __( 'Sidebar %d' ), $i ); } } else { $_args['name'] = isset( $args['name'] ) ? $args['name'] : __( 'Sidebar' ); } if ( isset( $args['id'] ) ) { $_args['id'] = $args['id']; $n = 2; while ( is_registered_sidebar( $_args['id'] ) ) { $_args['id'] = $args['id'] . '-' . $n++; } } else { $n = count( $wp_registered_sidebars ); do { $_args['id'] = 'sidebar-' . ++$n; } while ( is_registered_sidebar( $_args['id'] ) ); } register_sidebar( $_args ); } } function register_sidebar( $args = array() ) { global $wp_registered_sidebars; $i = count( $wp_registered_sidebars ) + 1; $id_is_empty = empty( $args['id'] ); $defaults = array( 'name' => sprintf( __( 'Sidebar %d' ), $i ), 'id' => "sidebar-$i", 'description' => '', 'class' => '', 'before_widget' => '
    • ', 'after_widget' => "
    • \n", 'before_title' => '

      ', 'after_title' => "

      \n", 'before_sidebar' => '', 'after_sidebar' => '', 'show_in_rest' => false, ); $sidebar = wp_parse_args( $args, apply_filters( 'register_sidebar_defaults', $defaults ) ); if ( $id_is_empty ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ), 'id', $sidebar['name'], $sidebar['id'] ), '4.2.0' ); } $wp_registered_sidebars[ $sidebar['id'] ] = $sidebar; add_theme_support( 'widgets' ); do_action( 'register_sidebar', $sidebar ); return $sidebar['id']; } function unregister_sidebar( $sidebar_id ) { global $wp_registered_sidebars; unset( $wp_registered_sidebars[ $sidebar_id ] ); } function is_registered_sidebar( $sidebar_id ) { global $wp_registered_sidebars; return isset( $wp_registered_sidebars[ $sidebar_id ] ); } function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array(), ...$params ) { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks; $id = strtolower( $id ); if ( empty( $output_callback ) ) { unset( $wp_registered_widgets[ $id ] ); return; } $id_base = _get_widget_id_base( $id ); if ( in_array( $output_callback, $_wp_deprecated_widgets_callbacks, true ) && ! is_callable( $output_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); unset( $wp_registered_widget_updates[ $id_base ] ); return; } $defaults = array( 'classname' => $output_callback ); $options = wp_parse_args( $options, $defaults ); $widget = array( 'name' => $name, 'id' => $id, 'callback' => $output_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); if ( is_callable( $output_callback ) && ( ! isset( $wp_registered_widgets[ $id ] ) || did_action( 'widgets_init' ) ) ) { do_action( 'wp_register_sidebar_widget', $widget ); $wp_registered_widgets[ $id ] = $widget; } } function wp_widget_description( $id ) { if ( ! is_scalar( $id ) ) { return; } global $wp_registered_widgets; if ( isset( $wp_registered_widgets[ $id ]['description'] ) ) { return esc_html( $wp_registered_widgets[ $id ]['description'] ); } } function wp_sidebar_description( $id ) { if ( ! is_scalar( $id ) ) { return; } global $wp_registered_sidebars; if ( isset( $wp_registered_sidebars[ $id ]['description'] ) ) { return wp_kses( $wp_registered_sidebars[ $id ]['description'], 'sidebar_description' ); } } function wp_unregister_sidebar_widget( $id ) { do_action( 'wp_unregister_sidebar_widget', $id ); wp_register_sidebar_widget( $id, '', '' ); wp_unregister_widget_control( $id ); } function wp_register_widget_control( $id, $name, $control_callback, $options = array(), ...$params ) { global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks; $id = strtolower( $id ); $id_base = _get_widget_id_base( $id ); if ( empty( $control_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); unset( $wp_registered_widget_updates[ $id_base ] ); return; } if ( in_array( $control_callback, $_wp_deprecated_widgets_callbacks, true ) && ! is_callable( $control_callback ) ) { unset( $wp_registered_widgets[ $id ] ); return; } if ( isset( $wp_registered_widget_controls[ $id ] ) && ! did_action( 'widgets_init' ) ) { return; } $defaults = array( 'width' => 250, 'height' => 200, ); $options = wp_parse_args( $options, $defaults ); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $control_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_controls[ $id ] = $widget; if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) { return; } if ( isset( $widget['params'][0]['number'] ) ) { $widget['params'][0]['number'] = -1; } unset( $widget['width'], $widget['height'], $widget['name'], $widget['id'] ); $wp_registered_widget_updates[ $id_base ] = $widget; } function _register_widget_update_callback( $id_base, $update_callback, $options = array(), ...$params ) { global $wp_registered_widget_updates; if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) { if ( empty( $update_callback ) ) { unset( $wp_registered_widget_updates[ $id_base ] ); } return; } $widget = array( 'callback' => $update_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_updates[ $id_base ] = $widget; } function _register_widget_form_callback( $id, $name, $form_callback, $options = array(), ...$params ) { global $wp_registered_widget_controls; $id = strtolower( $id ); if ( empty( $form_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); return; } if ( isset( $wp_registered_widget_controls[ $id ] ) && ! did_action( 'widgets_init' ) ) { return; } $defaults = array( 'width' => 250, 'height' => 200, ); $options = wp_parse_args( $options, $defaults ); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $form_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_controls[ $id ] = $widget; } function wp_unregister_widget_control( $id ) { wp_register_widget_control( $id, '', '' ); } function dynamic_sidebar( $index = 1 ) { global $wp_registered_sidebars, $wp_registered_widgets; if ( is_int( $index ) ) { $index = "sidebar-$index"; } else { $index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { if ( sanitize_title( $value['name'] ) === $index ) { $index = $key; break; } } } $sidebars_widgets = wp_get_sidebars_widgets(); if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { do_action( 'dynamic_sidebar_before', $index, false ); do_action( 'dynamic_sidebar_after', $index, false ); return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); } $sidebar = $wp_registered_sidebars[ $index ]; $sidebar['before_sidebar'] = sprintf( $sidebar['before_sidebar'], $sidebar['id'], $sidebar['class'] ); do_action( 'dynamic_sidebar_before', $index, true ); if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) { echo $sidebar['before_sidebar']; } $did_one = false; foreach ( (array) $sidebars_widgets[ $index ] as $id ) { if ( ! isset( $wp_registered_widgets[ $id ] ) ) { continue; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $id, 'widget_name' => $wp_registered_widgets[ $id ]['name'], ) ), ), (array) $wp_registered_widgets[ $id ]['params'] ); $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], str_replace( '\\', '_', $id ), $classname_ ); $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $id ]['callback']; do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); $did_one = true; } } if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) { echo $sidebar['after_sidebar']; } do_action( 'dynamic_sidebar_after', $index, true ); return apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index ); } function is_active_widget( $callback = false, $widget_id = false, $id_base = false, $skip_inactive = true ) { global $wp_registered_widgets; $sidebars_widgets = wp_get_sidebars_widgets(); if ( is_array( $sidebars_widgets ) ) { foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( $skip_inactive && ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) ) { continue; } if ( is_array( $widgets ) ) { foreach ( $widgets as $widget ) { if ( ( $callback && isset( $wp_registered_widgets[ $widget ]['callback'] ) && $wp_registered_widgets[ $widget ]['callback'] === $callback ) || ( $id_base && _get_widget_id_base( $widget ) === $id_base ) ) { if ( ! $widget_id || $widget_id === $wp_registered_widgets[ $widget ]['id'] ) { return $sidebar; } } } } } } return false; } function is_dynamic_sidebar() { global $wp_registered_widgets, $wp_registered_sidebars; $sidebars_widgets = get_option( 'sidebars_widgets' ); foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { if ( ! empty( $sidebars_widgets[ $index ] ) ) { foreach ( (array) $sidebars_widgets[ $index ] as $widget ) { if ( array_key_exists( $widget, $wp_registered_widgets ) ) { return true; } } } } return false; } function is_active_sidebar( $index ) { $index = ( is_int( $index ) ) ? "sidebar-$index" : sanitize_title( $index ); $sidebars_widgets = wp_get_sidebars_widgets(); $is_active_sidebar = ! empty( $sidebars_widgets[ $index ] ); return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index ); } function wp_get_sidebars_widgets( $deprecated = true ) { if ( true !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); } global $_wp_sidebars_widgets, $sidebars_widgets; if ( ! is_admin() ) { if ( empty( $_wp_sidebars_widgets ) ) { $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() ); } $sidebars_widgets = $_wp_sidebars_widgets; } else { $sidebars_widgets = get_option( 'sidebars_widgets', array() ); } if ( is_array( $sidebars_widgets ) && isset( $sidebars_widgets['array_version'] ) ) { unset( $sidebars_widgets['array_version'] ); } return apply_filters( 'sidebars_widgets', $sidebars_widgets ); } function wp_get_sidebar( $id ) { global $wp_registered_sidebars; foreach ( (array) $wp_registered_sidebars as $sidebar ) { if ( $sidebar['id'] === $id ) { return $sidebar; } } if ( 'wp_inactive_widgets' === $id ) { return array( 'id' => 'wp_inactive_widgets', 'name' => __( 'Inactive widgets' ), ); } return null; } function wp_set_sidebars_widgets( $sidebars_widgets ) { global $_wp_sidebars_widgets; $_wp_sidebars_widgets = null; if ( ! isset( $sidebars_widgets['array_version'] ) ) { $sidebars_widgets['array_version'] = 3; } update_option( 'sidebars_widgets', $sidebars_widgets ); } function wp_get_widget_defaults() { global $wp_registered_sidebars; $defaults = array(); foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { $defaults[ $index ] = array(); } return $defaults; } function wp_convert_widget_settings( $base_name, $option_name, $settings ) { $single = false; $changed = false; if ( empty( $settings ) ) { $single = true; } else { foreach ( array_keys( $settings ) as $number ) { if ( 'number' === $number ) { continue; } if ( ! is_numeric( $number ) ) { $single = true; break; } } } if ( $single ) { $settings = array( 2 => $settings ); if ( is_admin() ) { $sidebars_widgets = get_option( 'sidebars_widgets' ); } else { if ( empty( $GLOBALS['_wp_sidebars_widgets'] ) ) { $GLOBALS['_wp_sidebars_widgets'] = get_option( 'sidebars_widgets', array() ); } $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets']; } foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( $sidebar as $i => $name ) { if ( $base_name === $name ) { $sidebars_widgets[ $index ][ $i ] = "$name-2"; $changed = true; break 2; } } } } if ( is_admin() && $changed ) { update_option( 'sidebars_widgets', $sidebars_widgets ); } } $settings['_multiwidget'] = 1; if ( is_admin() ) { update_option( $option_name, $settings ); } return $settings; } function the_widget( $widget, $instance = array(), $args = array() ) { global $wp_widget_factory; if ( ! isset( $wp_widget_factory->widgets[ $widget ] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Widgets need to be registered using %s, before they can be displayed.' ), 'register_widget()' ), '4.9.0' ); return; } $widget_obj = $wp_widget_factory->widgets[ $widget ]; if ( ! ( $widget_obj instanceof WP_Widget ) ) { return; } $default_args = array( 'before_widget' => '
      ', 'after_widget' => '
      ', 'before_title' => '

      ', 'after_title' => '

      ', ); $args = wp_parse_args( $args, $default_args ); $args['before_widget'] = sprintf( $args['before_widget'], $widget_obj->widget_options['classname'] ); $instance = wp_parse_args( $instance ); $instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args ); if ( false === $instance ) { return; } do_action( 'the_widget', $widget, $instance, $args ); $widget_obj->_set( -1 ); $widget_obj->widget( $args, $instance ); } function _get_widget_id_base( $id ) { return preg_replace( '/-[0-9]+$/', '', $id ); } function _wp_sidebars_changed() { global $sidebars_widgets; if ( ! is_array( $sidebars_widgets ) ) { $sidebars_widgets = wp_get_sidebars_widgets(); } retrieve_widgets( true ); } function retrieve_widgets( $theme_changed = false ) { global $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; $registered_sidebars_keys = array_keys( $wp_registered_sidebars ); $registered_widgets_ids = array_keys( $wp_registered_widgets ); if ( ! is_array( get_theme_mod( 'sidebars_widgets' ) ) ) { if ( empty( $sidebars_widgets ) ) { return array(); } unset( $sidebars_widgets['array_version'] ); $sidebars_widgets_keys = array_keys( $sidebars_widgets ); sort( $sidebars_widgets_keys ); sort( $registered_sidebars_keys ); if ( $sidebars_widgets_keys === $registered_sidebars_keys ) { $sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids ); return $sidebars_widgets; } } $sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids ); $sidebars_widgets = wp_map_sidebars_widgets( $sidebars_widgets ); $shown_widgets = array_merge( ...array_values( $sidebars_widgets ) ); $lost_widgets = array_diff( $registered_widgets_ids, $shown_widgets ); foreach ( $lost_widgets as $key => $widget_id ) { $number = preg_replace( '/.+?-([0-9]+)$/', '$1', $widget_id ); if ( is_numeric( $number ) && (int) $number < 2 ) { unset( $lost_widgets[ $key ] ); } } $sidebars_widgets['wp_inactive_widgets'] = array_merge( $lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets'] ); if ( 'customize' !== $theme_changed ) { wp_set_sidebars_widgets( $sidebars_widgets ); } return $sidebars_widgets; } function wp_map_sidebars_widgets( $existing_sidebars_widgets ) { global $wp_registered_sidebars; $new_sidebars_widgets = array( 'wp_inactive_widgets' => array(), ); if ( ! is_array( $existing_sidebars_widgets ) || empty( $existing_sidebars_widgets ) ) { return $new_sidebars_widgets; } foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], (array) $widgets ); unset( $existing_sidebars_widgets[ $sidebar ] ); } } if ( 1 === count( $existing_sidebars_widgets ) && 1 === count( $wp_registered_sidebars ) ) { $new_sidebars_widgets[ key( $wp_registered_sidebars ) ] = array_pop( $existing_sidebars_widgets ); return $new_sidebars_widgets; } $existing_sidebars = array_keys( $existing_sidebars_widgets ); foreach ( $wp_registered_sidebars as $sidebar => $name ) { if ( in_array( $sidebar, $existing_sidebars, true ) ) { $new_sidebars_widgets[ $sidebar ] = $existing_sidebars_widgets[ $sidebar ]; unset( $existing_sidebars_widgets[ $sidebar ] ); } elseif ( ! array_key_exists( $sidebar, $new_sidebars_widgets ) ) { $new_sidebars_widgets[ $sidebar ] = array(); } } if ( ! empty( $existing_sidebars_widgets ) ) { $common_slug_groups = array( array( 'sidebar', 'primary', 'main', 'right' ), array( 'second', 'left' ), array( 'sidebar-2', 'footer', 'bottom' ), array( 'header', 'top' ), ); foreach ( $common_slug_groups as $slug_group ) { foreach ( $slug_group as $slug ) { foreach ( $wp_registered_sidebars as $new_sidebar => $args ) { if ( false === stripos( $new_sidebar, $slug ) && false === stripos( $slug, $new_sidebar ) ) { continue; } foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { foreach ( $slug_group as $slug ) { if ( false === stripos( $sidebar, $slug ) && false === stripos( $slug, $sidebar ) ) { continue; } if ( ! empty( $existing_sidebars_widgets[ $sidebar ] ) ) { $new_sidebars_widgets[ $new_sidebar ] = array_merge( $new_sidebars_widgets[ $new_sidebar ], $existing_sidebars_widgets[ $sidebar ] ); unset( $existing_sidebars_widgets[ $sidebar ] ); continue 3; } } } } } } } foreach ( $existing_sidebars_widgets as $widgets ) { if ( is_array( $widgets ) && ! empty( $widgets ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], $widgets ); } } $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); $old_sidebars_widgets = isset( $old_sidebars_widgets['data'] ) ? $old_sidebars_widgets['data'] : false; if ( is_array( $old_sidebars_widgets ) ) { $old_sidebars_widgets = array_filter( $old_sidebars_widgets ); foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) { unset( $old_sidebars_widgets[ $new_sidebar ] ); } } foreach ( $old_sidebars_widgets as $sidebar => $widgets ) { if ( 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { unset( $old_sidebars_widgets[ $sidebar ] ); } } $old_sidebars_widgets = _wp_remove_unregistered_widgets( $old_sidebars_widgets ); if ( ! empty( $old_sidebars_widgets ) ) { foreach ( $old_sidebars_widgets as $old_sidebar => $old_widgets ) { foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { foreach ( $old_widgets as $key => $widget_id ) { $active_key = array_search( $widget_id, $new_widgets, true ); if ( false !== $active_key ) { if ( 'wp_inactive_widgets' === $new_sidebar ) { unset( $new_sidebars_widgets['wp_inactive_widgets'][ $active_key ] ); } else { unset( $old_sidebars_widgets[ $old_sidebar ][ $key ] ); } } } } } } $new_sidebars_widgets = array_merge( $new_sidebars_widgets, $old_sidebars_widgets ); } return $new_sidebars_widgets; } function _wp_remove_unregistered_widgets( $sidebars_widgets, $allowed_widget_ids = array() ) { if ( empty( $allowed_widget_ids ) ) { $allowed_widget_ids = array_keys( $GLOBALS['wp_registered_widgets'] ); } foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( is_array( $widgets ) ) { $sidebars_widgets[ $sidebar ] = array_intersect( $widgets, $allowed_widget_ids ); } } return $sidebars_widgets; } function wp_widget_rss_output( $rss, $args = array() ) { if ( is_string( $rss ) ) { $rss = fetch_feed( $rss ); } elseif ( is_array( $rss ) && isset( $rss['url'] ) ) { $args = $rss; $rss = fetch_feed( $rss['url'] ); } elseif ( ! is_object( $rss ) ) { return; } if ( is_wp_error( $rss ) ) { if ( is_admin() || current_user_can( 'manage_options' ) ) { echo '

      ' . __( 'RSS Error:' ) . ' ' . $rss->get_error_message() . '

      '; } return; } $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0, ); $args = wp_parse_args( $args, $default_args ); $items = (int) $args['items']; if ( $items < 1 || 20 < $items ) { $items = 10; } $show_summary = (int) $args['show_summary']; $show_author = (int) $args['show_author']; $show_date = (int) $args['show_date']; if ( ! $rss->get_item_quantity() ) { echo '
      • ' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '
      '; $rss->__destruct(); unset( $rss ); return; } echo '
        '; foreach ( $rss->get_items( 0, $items ) as $item ) { $link = $item->get_link(); while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) { $link = substr( $link, 1 ); } $link = esc_url( strip_tags( $link ) ); $title = esc_html( trim( strip_tags( $item->get_title() ) ) ); if ( empty( $title ) ) { $title = __( 'Untitled' ); } $desc = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ); $desc = esc_attr( wp_trim_words( $desc, 55, ' […]' ) ); $summary = ''; if ( $show_summary ) { $summary = $desc; if ( '[...]' === substr( $summary, -5 ) ) { $summary = substr( $summary, 0, -5 ) . '[…]'; } $summary = '
        ' . esc_html( $summary ) . '
        '; } $date = ''; if ( $show_date ) { $date = $item->get_date( 'U' ); if ( $date ) { $date = ' ' . date_i18n( get_option( 'date_format' ), $date ) . ''; } } $author = ''; if ( $show_author ) { $author = $item->get_author(); if ( is_object( $author ) ) { $author = $author->get_name(); $author = ' ' . esc_html( strip_tags( $author ) ) . ''; } } if ( '' === $link ) { echo "
      • $title{$date}{$summary}{$author}
      • "; } elseif ( $show_summary ) { echo "
      • $title{$date}{$summary}{$author}
      • "; } else { echo "
      • $title{$date}{$author}
      • "; } } echo '
      '; $rss->__destruct(); unset( $rss ); } function wp_widget_rss_form( $args, $inputs = null ) { $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true, ); $inputs = wp_parse_args( $inputs, $default_inputs ); $args['title'] = isset( $args['title'] ) ? $args['title'] : ''; $args['url'] = isset( $args['url'] ) ? $args['url'] : ''; $args['items'] = isset( $args['items'] ) ? (int) $args['items'] : 0; if ( $args['items'] < 1 || 20 < $args['items'] ) { $args['items'] = 10; } $args['show_summary'] = isset( $args['show_summary'] ) ? (int) $args['show_summary'] : (int) $inputs['show_summary']; $args['show_author'] = isset( $args['show_author'] ) ? (int) $args['show_author'] : (int) $inputs['show_author']; $args['show_date'] = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date']; if ( ! empty( $args['error'] ) ) { echo '

      ' . __( 'RSS Error:' ) . ' ' . $args['error'] . '

      '; } $esc_number = esc_attr( $args['number'] ); if ( $inputs['url'] ) : ?> +

      +

      + +

      +

      + +

      +

      + +

      + + /> +
      + + /> +
      + + /> +
      + +

      + + + get_error_message(); } else { $link = esc_url( strip_tags( $rss->get_permalink() ) ); while ( stristr( $link, 'http' ) !== $link ) { $link = substr( $link, 1 ); } $rss->__destruct(); unset( $rss ); } } return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' ); } function wp_widgets_init() { if ( ! is_blog_installed() ) { return; } register_widget( 'WP_Widget_Pages' ); register_widget( 'WP_Widget_Calendar' ); register_widget( 'WP_Widget_Archives' ); if ( get_option( 'link_manager_enabled' ) ) { register_widget( 'WP_Widget_Links' ); } register_widget( 'WP_Widget_Media_Audio' ); register_widget( 'WP_Widget_Media_Image' ); register_widget( 'WP_Widget_Media_Gallery' ); register_widget( 'WP_Widget_Media_Video' ); register_widget( 'WP_Widget_Meta' ); register_widget( 'WP_Widget_Search' ); register_widget( 'WP_Widget_Text' ); register_widget( 'WP_Widget_Categories' ); register_widget( 'WP_Widget_Recent_Posts' ); register_widget( 'WP_Widget_Recent_Comments' ); register_widget( 'WP_Widget_RSS' ); register_widget( 'WP_Widget_Tag_Cloud' ); register_widget( 'WP_Nav_Menu_Widget' ); register_widget( 'WP_Widget_Custom_HTML' ); register_widget( 'WP_Widget_Block' ); do_action( 'widgets_init' ); } function wp_setup_widgets_block_editor() { add_theme_support( 'widgets-block-editor' ); } function wp_use_widgets_block_editor() { return apply_filters( 'use_widgets_block_editor', get_theme_support( 'widgets-block-editor' ) ); } function wp_parse_widget_id( $id ) { $parsed = array(); if ( preg_match( '/^(.+)-(\d+)$/', $id, $matches ) ) { $parsed['id_base'] = $matches[1]; $parsed['number'] = (int) $matches[2]; } else { $parsed['id_base'] = $id; } return $parsed; } function wp_find_widgets_sidebar( $widget_id ) { foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { foreach ( $widget_ids as $maybe_widget_id ) { if ( $maybe_widget_id === $widget_id ) { return (string) $sidebar_id; } } } return null; } function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) { $sidebars = wp_get_sidebars_widgets(); foreach ( $sidebars as $maybe_sidebar_id => $widgets ) { foreach ( $widgets as $i => $maybe_widget_id ) { if ( $widget_id === $maybe_widget_id && $sidebar_id !== $maybe_sidebar_id ) { unset( $sidebars[ $maybe_sidebar_id ][ $i ] ); continue 2; } } } if ( $sidebar_id ) { $sidebars[ $sidebar_id ][] = $widget_id; } wp_set_sidebars_widgets( $sidebars ); } function wp_render_widget( $widget_id, $sidebar_id ) { global $wp_registered_widgets, $wp_registered_sidebars; if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { return ''; } if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { $sidebar = $wp_registered_sidebars[ $sidebar_id ]; } elseif ( 'wp_inactive_widgets' === $sidebar_id ) { $sidebar = array(); } else { return ''; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $widget_id, 'widget_name' => $wp_registered_widgets[ $widget_id ]['name'], ) ), ), (array) $wp_registered_widgets[ $widget_id ]['params'] ); $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $widget_id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $widget_id, $classname_ ); $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $widget_id ]['callback']; ob_start(); do_action( 'dynamic_sidebar', $wp_registered_widgets[ $widget_id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); } function wp_render_widget_control( $id ) { global $wp_registered_widget_controls; if ( ! isset( $wp_registered_widget_controls[ $id ]['callback'] ) ) { return null; } $callback = $wp_registered_widget_controls[ $id ]['callback']; $params = $wp_registered_widget_controls[ $id ]['params']; ob_start(); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); } function wp_check_widget_editor_deps() { global $wp_scripts, $wp_styles; if ( $wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) || $wp_scripts->query( 'wp-customize-widgets', 'enqueued' ) ) { if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) { _doing_it_wrong( 'wp_enqueue_script()', sprintf( __( '"%1$s" script should not be enqueued together with the new widgets editor (%2$s or %3$s).' ), 'wp-editor', 'wp-edit-widgets', 'wp-customize-widgets' ), '5.8.0' ); } if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) { _doing_it_wrong( 'wp_enqueue_style()', sprintf( __( '"%1$s" style should not be enqueued together with the new widgets editor (%2$s or %3$s).' ), 'wp-edit-post', 'wp-edit-widgets', 'wp-customize-widgets' ), '5.8.0' ); } } } comment_ID ) ? $comment->comment_ID : $comment_ID; if ( empty( $comment->comment_author ) ) { $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; if ( $user ) { $author = $user->display_name; } else { $author = __( 'Anonymous' ); } } else { $author = $comment->comment_author; } return apply_filters( 'get_comment_author', $author, $comment_ID, $comment ); } function comment_author( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author = get_comment_author( $comment ); echo apply_filters( 'comment_author', $author, $comment->comment_ID ); } function get_comment_author_email( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment ); } function comment_author_email( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author_email = get_comment_author_email( $comment ); echo apply_filters( 'author_email', $author_email, $comment->comment_ID ); } function comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) { $link = get_comment_author_email_link( $linktext, $before, $after, $comment ); if ( $link ) { echo $link; } } function get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) { $comment = get_comment( $comment ); $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) { $display = ( '' !== $linktext ) ? $linktext : $email; $return = $before; $return .= sprintf( '%2$s', esc_url( 'mailto:' . $email ), esc_html( $display ) ); $return .= $after; return $return; } else { return ''; } } function get_comment_author_link( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $url = get_comment_author_url( $comment ); $author = get_comment_author( $comment ); if ( empty( $url ) || 'http://' === $url ) { $return = $author; } else { $return = "$author"; } return apply_filters( 'get_comment_author_link', $return, $author, $comment->comment_ID ); } function comment_author_link( $comment_ID = 0 ) { echo get_comment_author_link( $comment_ID ); } function get_comment_author_IP( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); } function comment_author_IP( $comment_ID = 0 ) { echo esc_html( get_comment_author_IP( $comment_ID ) ); } function get_comment_author_url( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $url = ''; $id = 0; if ( ! empty( $comment ) ) { $author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url; $url = esc_url( $author_url, array( 'http', 'https' ) ); $id = $comment->comment_ID; } return apply_filters( 'get_comment_author_url', $url, $id, $comment ); } function comment_author_url( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author_url = get_comment_author_url( $comment ); echo apply_filters( 'comment_url', $author_url, $comment->comment_ID ); } function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { $url = get_comment_author_url( $comment ); $display = ( '' !== $linktext ) ? $linktext : $url; $display = str_replace( 'http://www.', '', $display ); $display = str_replace( 'http://', '', $display ); if ( '/' === substr( $display, -1 ) ) { $display = substr( $display, 0, -1 ); } $return = "$before$display$after"; return apply_filters( 'get_comment_author_url_link', $return ); } function comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { echo get_comment_author_url_link( $linktext, $before, $after, $comment ); } function comment_class( $css_class = '', $comment = null, $post_id = null, $display = true ) { $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post_id ) ) . '"'; if ( $display ) { echo $css_class; } else { return $css_class; } } function get_comment_class( $css_class = '', $comment_id = null, $post_id = null ) { global $comment_alt, $comment_depth, $comment_thread_alt; $classes = array(); $comment = get_comment( $comment_id ); if ( ! $comment ) { return $classes; } $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type; $user = $comment->user_id ? get_userdata( $comment->user_id ) : false; if ( $user ) { $classes[] = 'byuser'; $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id ); $post = get_post( $post_id ); if ( $post ) { if ( $comment->user_id === $post->post_author ) { $classes[] = 'bypostauthor'; } } } if ( empty( $comment_alt ) ) { $comment_alt = 0; } if ( empty( $comment_depth ) ) { $comment_depth = 1; } if ( empty( $comment_thread_alt ) ) { $comment_thread_alt = 0; } if ( $comment_alt % 2 ) { $classes[] = 'odd'; $classes[] = 'alt'; } else { $classes[] = 'even'; } $comment_alt++; if ( 1 == $comment_depth ) { if ( $comment_thread_alt % 2 ) { $classes[] = 'thread-odd'; $classes[] = 'thread-alt'; } else { $classes[] = 'thread-even'; } $comment_thread_alt++; } $classes[] = "depth-$comment_depth"; if ( ! empty( $css_class ) ) { if ( ! is_array( $css_class ) ) { $css_class = preg_split( '#\s+#', $css_class ); } $classes = array_merge( $classes, $css_class ); } $classes = array_map( 'esc_attr', $classes ); return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post_id ); } function get_comment_date( $format = '', $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); $date = mysql2date( $_format, $comment->comment_date ); return apply_filters( 'get_comment_date', $date, $format, $comment ); } function comment_date( $format = '', $comment_ID = 0 ) { echo get_comment_date( $format, $comment_ID ); } function get_comment_excerpt( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); if ( ! post_password_required( $comment->comment_post_ID ) ) { $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) ); } else { $comment_text = __( 'Password protected' ); } $comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' ); $comment_excerpt_length = apply_filters( 'comment_excerpt_length', $comment_excerpt_length ); $excerpt = wp_trim_words( $comment_text, $comment_excerpt_length, '…' ); return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment ); } function comment_excerpt( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $comment_excerpt = get_comment_excerpt( $comment ); echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID ); } function get_comment_ID() { $comment = get_comment(); $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; return apply_filters( 'get_comment_ID', $comment_ID, $comment ); } function comment_ID() { echo get_comment_ID(); } function get_comment_link( $comment = null, $args = array() ) { global $wp_rewrite, $in_comment_loop; $comment = get_comment( $comment ); if ( ! is_array( $args ) ) { $args = array( 'page' => $args ); } $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', 'cpage' => null, ); $args = wp_parse_args( $args, $defaults ); $link = get_permalink( $comment->comment_post_ID ); if ( ! is_null( $args['cpage'] ) ) { $cpage = $args['cpage']; } else { if ( '' === $args['per_page'] && get_option( 'page_comments' ) ) { $args['per_page'] = get_option( 'comments_per_page' ); } if ( empty( $args['per_page'] ) ) { $args['per_page'] = 0; $args['page'] = 0; } $cpage = $args['page']; if ( '' == $cpage ) { if ( ! empty( $in_comment_loop ) ) { $cpage = get_query_var( 'cpage' ); } else { $cpage = get_page_of_comment( $comment->comment_ID, $args ); } } if ( 'oldest' === get_option( 'default_comments_page' ) && 1 === $cpage ) { $cpage = ''; } } if ( $cpage && get_option( 'page_comments' ) ) { if ( $wp_rewrite->using_permalinks() ) { if ( $cpage ) { $link = trailingslashit( $link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage; } $link = user_trailingslashit( $link, 'comment' ); } elseif ( $cpage ) { $link = add_query_arg( 'cpage', $cpage, $link ); } } if ( $wp_rewrite->using_permalinks() ) { $link = user_trailingslashit( $link, 'comment' ); } $link = $link . '#comment-' . $comment->comment_ID; return apply_filters( 'get_comment_link', $link, $comment, $args, $cpage ); } function get_comments_link( $post_id = 0 ) { $hash = get_comments_number( $post_id ) ? '#comments' : '#respond'; $comments_link = get_permalink( $post_id ) . $hash; return apply_filters( 'get_comments_link', $comments_link, $post_id ); } function comments_link( $deprecated = '', $deprecated_2 = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '0.72' ); } if ( ! empty( $deprecated_2 ) ) { _deprecated_argument( __FUNCTION__, '1.3.0' ); } echo esc_url( get_comments_link() ); } function get_comments_number( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post ) { $count = 0; } else { $count = $post->comment_count; $post_id = $post->ID; } return apply_filters( 'get_comments_number', $count, $post_id ); } function comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) { echo get_comments_number_text( $zero, $one, $more, $post_id ); } function get_comments_number_text( $zero = false, $one = false, $more = false, $post_id = 0 ) { $number = get_comments_number( $post_id ); if ( $number > 1 ) { if ( false === $more ) { $output = sprintf( _n( '%s Comment', '%s Comments', $number ), number_format_i18n( $number ) ); } else { if ( 'on' === _x( 'off', 'Comment number declension: on or off' ) ) { $text = preg_replace( '#.+?#', '', $more ); $text = preg_replace( '/&.+?;/', '', $text ); $text = trim( strip_tags( $text ), '% ' ); if ( $text && ! preg_match( '/[0-9]+/', $text ) && false !== strpos( $more, '%' ) ) { $new_text = _n( '%s Comment', '%s Comments', $number ); $new_text = trim( sprintf( $new_text, '' ) ); $more = str_replace( $text, $new_text, $more ); if ( false === strpos( $more, '%' ) ) { $more = '% ' . $more; } } } $output = str_replace( '%', number_format_i18n( $number ), $more ); } } elseif ( 0 == $number ) { $output = ( false === $zero ) ? __( 'No Comments' ) : $zero; } else { $output = ( false === $one ) ? __( '1 Comment' ) : $one; } return apply_filters( 'comments_number', $output, $number ); } function get_comment_text( $comment_ID = 0, $args = array() ) { $comment = get_comment( $comment_ID ); $comment_content = $comment->comment_content; if ( is_comment_feed() && $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); if ( $parent ) { $parent_link = esc_url( get_comment_link( $parent ) ); $name = get_comment_author( $parent ); $comment_content = sprintf( ent2ncr( __( 'In reply to %s.' ) ), '' . $name . '' ) . "\n\n" . $comment_content; } } return apply_filters( 'get_comment_text', $comment_content, $comment, $args ); } function comment_text( $comment_ID = 0, $args = array() ) { $comment = get_comment( $comment_ID ); $comment_text = get_comment_text( $comment, $args ); echo apply_filters( 'comment_text', $comment_text, $comment, $args ); } function get_comment_time( $format = '', $gmt = false, $translate = true ) { $comment = get_comment(); $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); $date = mysql2date( $_format, $comment_date, $translate ); return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment ); } function comment_time( $format = '' ) { echo get_comment_time( $format ); } function get_comment_type( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); if ( '' === $comment->comment_type ) { $comment->comment_type = 'comment'; } return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment ); } function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) { if ( false === $commenttxt ) { $commenttxt = _x( 'Comment', 'noun' ); } if ( false === $trackbacktxt ) { $trackbacktxt = __( 'Trackback' ); } if ( false === $pingbacktxt ) { $pingbacktxt = __( 'Pingback' ); } $type = get_comment_type(); switch ( $type ) { case 'trackback': echo $trackbacktxt; break; case 'pingback': echo $pingbacktxt; break; default: echo $commenttxt; } } function get_trackback_url() { if ( get_option( 'permalink_structure' ) ) { $tb_url = trailingslashit( get_permalink() ) . user_trailingslashit( 'trackback', 'single_trackback' ); } else { $tb_url = get_option( 'siteurl' ) . '/wp-trackback.php?p=' . get_the_ID(); } return apply_filters( 'trackback_url', $tb_url ); } function trackback_url( $deprecated_echo = true ) { if ( true !== $deprecated_echo ) { _deprecated_argument( __FUNCTION__, '2.5.0', sprintf( __( 'Use %s instead if you do not want the value echoed.' ), 'get_trackback_url()' ) ); } if ( $deprecated_echo ) { echo get_trackback_url(); } else { return get_trackback_url(); } } function trackback_rdf( $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.5.0' ); } if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) { return; } echo ' + \n"; echo ''; } function comments_open( $post_id = null ) { $_post = get_post( $post_id ); $post_id = $_post ? $_post->ID : 0; $open = ( $_post && ( 'open' === $_post->comment_status ) ); return apply_filters( 'comments_open', $open, $post_id ); } function pings_open( $post_id = null ) { $_post = get_post( $post_id ); $post_id = $_post ? $_post->ID : 0; $open = ( $_post && ( 'open' === $_post->ping_status ) ); return apply_filters( 'pings_open', $open, $post_id ); } function wp_comment_form_unfiltered_html_nonce() { $post = get_post(); $post_id = $post ? $post->ID : 0; if ( current_user_can( 'unfiltered_html' ) ) { wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false ); echo "\n"; } } function comments_template( $file = '/comments.php', $separate_comments = false ) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage; if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) { return; } if ( empty( $file ) ) { $file = '/comments.php'; } $req = get_option( 'require_name_email' ); $commenter = wp_get_current_commenter(); $comment_author = $commenter['comment_author']; $comment_author_email = $commenter['comment_author_email']; $comment_author_url = esc_url( $commenter['comment_author_url'] ); $comment_args = array( 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', 'post_id' => $post->ID, 'no_found_rows' => false, 'update_comment_meta_cache' => false, ); if ( get_option( 'thread_comments' ) ) { $comment_args['hierarchical'] = 'threaded'; } else { $comment_args['hierarchical'] = false; } if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $per_page = 0; if ( get_option( 'page_comments' ) ) { $per_page = (int) get_query_var( 'comments_per_page' ); if ( 0 === $per_page ) { $per_page = (int) get_option( 'comments_per_page' ); } $comment_args['number'] = $per_page; $page = (int) get_query_var( 'cpage' ); if ( $page ) { $comment_args['offset'] = ( $page - 1 ) * $per_page; } elseif ( 'oldest' === get_option( 'default_comments_page' ) ) { $comment_args['offset'] = 0; } else { $top_level_query = new WP_Comment_Query(); $top_level_args = array( 'count' => true, 'orderby' => false, 'post_id' => $post->ID, 'status' => 'approve', ); if ( $comment_args['hierarchical'] ) { $top_level_args['parent'] = 0; } if ( isset( $comment_args['include_unapproved'] ) ) { $top_level_args['include_unapproved'] = $comment_args['include_unapproved']; } $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args ); $top_level_count = $top_level_query->query( $top_level_args ); $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page; } } $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); $comment_query = new WP_Comment_Query( $comment_args ); $_comments = $comment_query->comments; if ( $comment_args['hierarchical'] ) { $comments_flat = array(); foreach ( $_comments as $_comment ) { $comments_flat[] = $_comment; $comment_children = $_comment->get_children( array( 'format' => 'flat', 'status' => $comment_args['status'], 'orderby' => $comment_args['orderby'], ) ); foreach ( $comment_children as $comment_child ) { $comments_flat[] = $comment_child; } } } else { $comments_flat = $_comments; } $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID ); $comments = &$wp_query->comments; $wp_query->comment_count = count( $wp_query->comments ); $wp_query->max_num_comment_pages = $comment_query->max_num_pages; if ( $separate_comments ) { $wp_query->comments_by_type = separate_comments( $comments ); $comments_by_type = &$wp_query->comments_by_type; } else { $wp_query->comments_by_type = array(); } $overridden_cpage = false; if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) { set_query_var( 'cpage', 'newest' === get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 ); $overridden_cpage = true; } if ( ! defined( 'COMMENTS_TEMPLATE' ) ) { define( 'COMMENTS_TEMPLATE', true ); } $theme_template = STYLESHEETPATH . $file; $include = apply_filters( 'comments_template', $theme_template ); if ( file_exists( $include ) ) { require $include; } elseif ( file_exists( TEMPLATEPATH . $file ) ) { require TEMPLATEPATH . $file; } else { require ABSPATH . WPINC . '/theme-compat/comments.php'; } } function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { $post_id = get_the_ID(); $post_title = get_the_title(); $number = get_comments_number( $post_id ); if ( false === $zero ) { $zero = sprintf( __( 'No Comments on %s' ), $post_title ); } if ( false === $one ) { $one = sprintf( __( '1 Comment on %s' ), $post_title ); } if ( false === $more ) { $more = _n( '%1$s Comment on %2$s', '%1$s Comments on %2$s', $number ); $more = sprintf( $more, number_format_i18n( $number ), $post_title ); } if ( false === $none ) { $none = sprintf( __( 'Comments Off on %s' ), $post_title ); } if ( 0 == $number && ! comments_open() && ! pings_open() ) { echo '' . $none . ''; return; } if ( post_password_required() ) { _e( 'Enter your password to view comments.' ); return; } echo ''; comments_number( $zero, $one, $more ); echo ''; } function get_comment_reply_link( $args = array(), $comment = null, $post = null ) { $defaults = array( 'add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __( 'Reply' ), 'reply_to_text' => __( 'Reply to %s' ), 'login_text' => __( 'Log in to Reply' ), 'max_depth' => 0, 'depth' => 0, 'before' => '', 'after' => '', ); $args = wp_parse_args( $args, $defaults ); if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) { return; } $comment = get_comment( $comment ); if ( empty( $comment ) ) { return; } if ( empty( $post ) ) { $post = $comment->comment_post_ID; } $post = get_post( $post ); if ( ! comments_open( $post->ID ) ) { return false; } if ( get_option( 'page_comments' ) ) { $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) ); } else { $permalink = get_permalink( $post->ID ); } $args = apply_filters( 'comment_reply_link_args', $args, $comment, $post ); if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = sprintf( '', esc_url( wp_login_url( get_permalink() ) ), $args['login_text'] ); } else { $data_attributes = array( 'commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf( $args['reply_to_text'], get_comment_author( $comment ) ), ); $data_attribute_string = ''; foreach ( $data_attributes as $name => $value ) { $data_attribute_string .= " data-${name}=\"" . esc_attr( $value ) . '"'; } $data_attribute_string = trim( $data_attribute_string ); $link = sprintf( "%s", esc_url( add_query_arg( array( 'replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false, ), $permalink ) ) . '#' . $args['respond_id'], $data_attribute_string, esc_attr( sprintf( $args['reply_to_text'], get_comment_author( $comment ) ) ), $args['reply_text'] ); } return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post ); } function comment_reply_link( $args = array(), $comment = null, $post = null ) { echo get_comment_reply_link( $args, $comment, $post ); } function get_post_reply_link( $args = array(), $post = null ) { $defaults = array( 'add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __( 'Leave a Comment' ), 'login_text' => __( 'Log in to leave a Comment' ), 'before' => '', 'after' => '', ); $args = wp_parse_args( $args, $defaults ); $post = get_post( $post ); if ( ! comments_open( $post->ID ) ) { return false; } if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = sprintf( '', wp_login_url( get_permalink() ), $args['login_text'] ); } else { $onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )', $args['add_below'], $post->ID, $args['respond_id'] ); $link = sprintf( "%s", get_permalink( $post->ID ) . '#' . $args['respond_id'], $onclick, $args['reply_text'] ); } $formatted_link = $args['before'] . $link . $args['after']; return apply_filters( 'post_comments_link', $formatted_link, $post ); } function post_reply_link( $args = array(), $post = null ) { echo get_post_reply_link( $args, $post ); } function get_cancel_comment_reply_link( $text = '' ) { if ( empty( $text ) ) { $text = __( 'Click here to cancel reply.' ); } $style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"'; $link = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond'; $formatted_link = '' . $text . ''; return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text ); } function cancel_comment_reply_link( $text = '' ) { echo get_cancel_comment_reply_link( $text ); } function get_comment_id_fields( $post_id = 0 ) { if ( empty( $post_id ) ) { $post_id = get_the_ID(); } $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0; $result = "\n"; $result .= "\n"; return apply_filters( 'comment_id_fields', $result, $post_id, $reply_to_id ); } function comment_id_fields( $post_id = 0 ) { echo get_comment_id_fields( $post_id ); } function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) { global $comment; if ( false === $no_reply_text ) { $no_reply_text = __( 'Leave a Reply' ); } if ( false === $reply_text ) { $reply_text = __( 'Leave a Reply to %s' ); } $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0; if ( 0 == $reply_to_id ) { echo $no_reply_text; } else { $comment = get_comment( $reply_to_id ); if ( $link_to_parent ) { $author = '' . get_comment_author( $comment ) . ''; } else { $author = get_comment_author( $comment ); } printf( $reply_text, $author ); } } function wp_list_comments( $args = array(), $comments = null ) { global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop; $in_comment_loop = true; $comment_alt = 0; $comment_thread_alt = 0; $comment_depth = 1; $defaults = array( 'walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml', 'short_ping' => false, 'echo' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args ); if ( null !== $comments ) { $comments = (array) $comments; if ( empty( $comments ) ) { return; } if ( 'all' !== $parsed_args['type'] ) { $comments_by_type = separate_comments( $comments ); if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $comments; } } else { if ( $parsed_args['page'] || $parsed_args['per_page'] ) { $current_cpage = get_query_var( 'cpage' ); if ( ! $current_cpage ) { $current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages; } $current_per_page = get_query_var( 'comments_per_page' ); if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) { $comment_args = array( 'post_id' => get_the_ID(), 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $comments = get_comments( $comment_args ); if ( 'all' !== $parsed_args['type'] ) { $comments_by_type = separate_comments( $comments ); if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $comments; } } } else { if ( empty( $wp_query->comments ) ) { return; } if ( 'all' !== $parsed_args['type'] ) { if ( empty( $wp_query->comments_by_type ) ) { $wp_query->comments_by_type = separate_comments( $wp_query->comments ); } if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $wp_query->comments; } if ( $wp_query->max_num_comment_pages ) { $default_comments_page = get_option( 'default_comments_page' ); $cpage = get_query_var( 'cpage' ); if ( 'newest' === $default_comments_page ) { $parsed_args['cpage'] = $cpage; } elseif ( 1 == $cpage ) { $parsed_args['cpage'] = ''; } else { $parsed_args['cpage'] = $cpage; } $parsed_args['page'] = 0; $parsed_args['per_page'] = 0; } } } if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) { $parsed_args['per_page'] = get_query_var( 'comments_per_page' ); } if ( empty( $parsed_args['per_page'] ) ) { $parsed_args['per_page'] = 0; $parsed_args['page'] = 0; } if ( '' === $parsed_args['max_depth'] ) { if ( get_option( 'thread_comments' ) ) { $parsed_args['max_depth'] = get_option( 'thread_comments_depth' ); } else { $parsed_args['max_depth'] = -1; } } if ( '' === $parsed_args['page'] ) { if ( empty( $overridden_cpage ) ) { $parsed_args['page'] = get_query_var( 'cpage' ); } else { $threaded = ( -1 != $parsed_args['max_depth'] ); $parsed_args['page'] = ( 'newest' === get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1; set_query_var( 'cpage', $parsed_args['page'] ); } } $parsed_args['page'] = (int) $parsed_args['page']; if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) { $parsed_args['page'] = 1; } if ( null === $parsed_args['reverse_top_level'] ) { $parsed_args['reverse_top_level'] = ( 'desc' === get_option( 'comment_order' ) ); } wp_queue_comments_for_comment_meta_lazyload( $_comments ); if ( empty( $parsed_args['walker'] ) ) { $walker = new Walker_Comment; } else { $walker = $parsed_args['walker']; } $output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args ); $in_comment_loop = false; if ( $parsed_args['echo'] ) { echo $output; } else { return $output; } } function comment_form( $args = array(), $post_id = null ) { if ( null === $post_id ) { $post_id = get_the_ID(); } if ( ! comments_open( $post_id ) ) { do_action( 'comment_form_comments_closed' ); return; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) { $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; } $req = get_option( 'require_name_email' ); $html5 = 'html5' === $args['format']; $required_attribute = ( $html5 ? ' required' : ' required="required"' ); $checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' ); $required_indicator = ' '; $fields = array( 'author' => sprintf( '

      %s %s

      ', sprintf( '', __( 'Name' ), ( $req ? $required_indicator : '' ) ), sprintf( '', esc_attr( $commenter['comment_author'] ), ( $req ? $required_attribute : '' ) ) ), 'email' => sprintf( '', sprintf( '', __( 'Email' ), ( $req ? $required_indicator : '' ) ), sprintf( '', ( $html5 ? 'type="email"' : 'type="text"' ), esc_attr( $commenter['comment_author_email'] ), ( $req ? $required_attribute : '' ) ) ), 'url' => sprintf( '

      %s %s

      ', sprintf( '', __( 'Website' ) ), sprintf( '', ( $html5 ? 'type="url"' : 'type="text"' ), esc_attr( $commenter['comment_author_url'] ) ) ), ); if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { $consent = empty( $commenter['comment_author_email'] ) ? '' : $checked_attribute; $fields['cookies'] = sprintf( '', sprintf( '', $consent ), sprintf( '', __( 'Save my name, email, and website in this browser for the next time I comment.' ) ) ); if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { $args['fields']['cookies'] = $fields['cookies']; } } $required_text = sprintf( ' ', trim( $required_indicator ) ); $fields = apply_filters( 'comment_form_default_fields', $fields ); $defaults = array( 'fields' => $fields, 'comment_field' => sprintf( '

      %s %s

      ', sprintf( '', _x( 'Comment', 'noun' ), $required_indicator ), '' ), 'must_log_in' => sprintf( '', sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) ), 'logged_in_as' => sprintf( '

      %s%s

      ', sprintf( __( 'Logged in as %3$s. Log out?' ), get_edit_user_link(), esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ), $required_text ), 'comment_notes_before' => sprintf( '

      %s%s

      ', sprintf( '%s', __( 'Your email address will not be published.' ) ), $required_text ), 'comment_notes_after' => '', 'action' => site_url( '/wp-comments-post.php' ), 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_container' => 'comment-respond', 'class_form' => 'comment-form', 'class_submit' => 'submit', 'name_submit' => 'submit', 'title_reply' => __( 'Leave a Reply' ), 'title_reply_to' => __( 'Leave a Reply to %s' ), 'title_reply_before' => '

      ', 'title_reply_after' => '

      ', 'cancel_reply_before' => ' ', 'cancel_reply_after' => '', 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'submit_button' => '', 'submit_field' => '

      %1$s %2$s

      ', 'format' => 'xhtml', ); $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); $args = array_merge( $defaults, $args ); if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { $args['fields']['email'] = str_replace( ' aria-describedby="email-notes"', '', $args['fields']['email'] ); } do_action( 'comment_form_before' ); ?> +
      + ', esc_url( $args['action'] ), esc_attr( $args['id_form'] ), esc_attr( $args['class_form'] ), ( $html5 ? ' novalidate' : '' ) ); do_action( 'comment_form_top' ); if ( is_user_logged_in() ) : echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); else : echo $args['comment_notes_before']; endif; $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); $first_field = reset( $comment_field_keys ); $last_field = end( $comment_field_keys ); foreach ( $comment_fields as $name => $field ) { if ( 'comment' === $name ) { echo apply_filters( 'comment_form_field_comment', $field ); echo $args['comment_notes_after']; } elseif ( ! is_user_logged_in() ) { if ( $first_field === $name ) { do_action( 'comment_form_before_fields' ); } echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; if ( $last_field === $name ) { do_action( 'comment_form_after_fields' ); } } } $submit_button = sprintf( $args['submit_button'], esc_attr( $args['name_submit'] ), esc_attr( $args['id_submit'] ), esc_attr( $args['class_submit'] ), esc_attr( $args['label_submit'] ) ); $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); $submit_field = sprintf( $args['submit_field'], $submit_button, get_comment_id_fields( $post_id ) ); echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); do_action( 'comment_form', $post_id ); echo ''; endif; ?> +
      + __( 'Title' ), 'post_content' => __( 'Content' ), 'post_excerpt' => __( 'Excerpt' ), ); } $fields = apply_filters( '_wp_post_revision_fields', $fields, $post ); foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) { unset( $fields[ $protect ] ); } return $fields; } function _wp_post_revision_data( $post = array(), $autosave = false ) { if ( ! is_array( $post ) ) { $post = get_post( $post, ARRAY_A ); } $fields = _wp_post_revision_fields( $post ); $revision_data = array(); foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) { $revision_data[ $field ] = $post[ $field ]; } $revision_data['post_parent'] = $post['ID']; $revision_data['post_status'] = 'inherit'; $revision_data['post_type'] = 'revision'; $revision_data['post_name'] = $autosave ? "$post[ID]-autosave-v1" : "$post[ID]-revision-v1"; $revision_data['post_date'] = isset( $post['post_modified'] ) ? $post['post_modified'] : ''; $revision_data['post_date_gmt'] = isset( $post['post_modified_gmt'] ) ? $post['post_modified_gmt'] : ''; return $revision_data; } function wp_save_post_revision( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } $post = get_post( $post_id ); if ( ! $post ) { return; } if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { return; } if ( 'auto-draft' === $post->post_status ) { return; } if ( ! wp_revisions_enabled( $post ) ) { return; } $revisions = wp_get_post_revisions( $post_id ); if ( $revisions ) { foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) { $last_revision = $revision; break; } } if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) { $post_has_changed = false; foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) { $post_has_changed = true; break; } } $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post ); if ( ! $post_has_changed ) { return; } } } $return = _wp_put_post_revision( $post ); $revisions_to_keep = wp_revisions_to_keep( $post ); if ( $revisions_to_keep < 0 ) { return $return; } $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); $delete = count( $revisions ) - $revisions_to_keep; if ( $delete < 1 ) { return $return; } $revisions = array_slice( $revisions, 0, $delete ); for ( $i = 0; isset( $revisions[ $i ] ); $i++ ) { if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) { continue; } wp_delete_post_revision( $revisions[ $i ]->ID ); } return $return; } function wp_get_post_autosave( $post_id, $user_id = 0 ) { global $wpdb; $autosave_name = $post_id . '-autosave-v1'; $user_id_query = ( 0 !== $user_id ) ? "AND post_author = $user_id" : null; $autosave_query = " + SELECT * + FROM $wpdb->posts + WHERE post_parent = %d + AND post_type = 'revision' + AND post_status = 'inherit' + AND post_name = %s " . $user_id_query . ' + ORDER BY post_date DESC + LIMIT 1'; $autosave = $wpdb->get_results( $wpdb->prepare( $autosave_query, $post_id, $autosave_name ) ); if ( ! $autosave ) { return false; } return get_post( $autosave[0] ); } function wp_is_post_revision( $post ) { $post = wp_get_post_revision( $post ); if ( ! $post ) { return false; } return (int) $post->post_parent; } function wp_is_post_autosave( $post ) { $post = wp_get_post_revision( $post ); if ( ! $post ) { return false; } if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) { return (int) $post->post_parent; } return false; } function _wp_put_post_revision( $post = null, $autosave = false ) { if ( is_object( $post ) ) { $post = get_object_vars( $post ); } elseif ( ! is_array( $post ) ) { $post = get_post( $post, ARRAY_A ); } if ( ! $post || empty( $post['ID'] ) ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } if ( isset( $post['post_type'] ) && 'revision' === $post['post_type'] ) { return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); } $post = _wp_post_revision_data( $post, $autosave ); $post = wp_slash( $post ); $revision_id = wp_insert_post( $post, true ); if ( is_wp_error( $revision_id ) ) { return $revision_id; } if ( $revision_id ) { do_action( '_wp_put_post_revision', $revision_id ); } return $revision_id; } function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) { $revision = get_post( $post, OBJECT, $filter ); if ( ! $revision ) { return $revision; } if ( 'revision' !== $revision->post_type ) { return null; } if ( OBJECT === $output ) { return $revision; } elseif ( ARRAY_A === $output ) { $_revision = get_object_vars( $revision ); return $_revision; } elseif ( ARRAY_N === $output ) { $_revision = array_values( get_object_vars( $revision ) ); return $_revision; } return $revision; } function wp_restore_post_revision( $revision_id, $fields = null ) { $revision = wp_get_post_revision( $revision_id, ARRAY_A ); if ( ! $revision ) { return $revision; } if ( ! is_array( $fields ) ) { $fields = array_keys( _wp_post_revision_fields( $revision ) ); } $update = array(); foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) { $update[ $field ] = $revision[ $field ]; } if ( ! $update ) { return false; } $update['ID'] = $revision['post_parent']; $update = wp_slash( $update ); $post_id = wp_update_post( $update ); if ( ! $post_id || is_wp_error( $post_id ) ) { return $post_id; } update_post_meta( $post_id, '_edit_last', get_current_user_id() ); do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); return $post_id; } function wp_delete_post_revision( $revision_id ) { $revision = wp_get_post_revision( $revision_id ); if ( ! $revision ) { return $revision; } $delete = wp_delete_post( $revision->ID ); if ( $delete ) { do_action( 'wp_delete_post_revision', $revision->ID, $revision ); } return $delete; } function wp_get_post_revisions( $post_id = 0, $args = null ) { $post = get_post( $post_id ); if ( ! $post || empty( $post->ID ) ) { return array(); } $defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true, ); $args = wp_parse_args( $args, $defaults ); if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) { return array(); } $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit', ) ); $revisions = get_children( $args ); if ( ! $revisions ) { return array(); } return $revisions; } function wp_get_post_revisions_url( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post instanceof WP_Post ) { return null; } if ( 'revision' === $post->post_type ) { return get_edit_post_link( $post ); } if ( ! wp_revisions_enabled( $post ) ) { return null; } $revisions = wp_get_post_revisions( $post->ID, array( 'posts_per_page' => 1 ) ); if ( 0 === count( $revisions ) ) { return null; } $revision = reset( $revisions ); return get_edit_post_link( $revision ); } function wp_revisions_enabled( $post ) { return wp_revisions_to_keep( $post ) !== 0; } function wp_revisions_to_keep( $post ) { $num = WP_POST_REVISIONS; if ( true === $num ) { $num = -1; } else { $num = (int) $num; } if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { $num = 0; } $num = apply_filters( 'wp_revisions_to_keep', $num, $post ); $num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post ); return (int) $num; } function _set_preview( $post ) { if ( ! is_object( $post ) ) { return $post; } $preview = wp_get_post_autosave( $post->ID ); if ( is_object( $preview ) ) { $preview = sanitize_post( $preview ); $post->post_content = $preview->post_content; $post->post_title = $preview->post_title; $post->post_excerpt = $preview->post_excerpt; } add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 ); add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 ); return $post; } function _show_post_preview() { if ( isset( $_GET['preview_id'] ) && isset( $_GET['preview_nonce'] ) ) { $id = (int) $_GET['preview_id']; if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) { wp_die( __( 'Sorry, you are not allowed to preview drafts.' ), 403 ); } add_filter( 'the_preview', '_set_preview' ); } } function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { $post = get_post(); if ( ! $post ) { return $terms; } if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' !== $taxonomy || 'revision' === $post->post_type ) { return $terms; } if ( 'standard' === $_REQUEST['post_format'] ) { $terms = array(); } else { $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ); if ( $term ) { $terms = array( $term ); } } return $terms; } function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { $post = get_post(); if ( ! $post ) { return $value; } if ( empty( $_REQUEST['_thumbnail_id'] ) || empty( $_REQUEST['preview_id'] ) || $post->ID != $post_id || '_thumbnail_id' !== $meta_key || 'revision' === $post->post_type || $post_id != $_REQUEST['preview_id'] ) { return $value; } $thumbnail_id = (int) $_REQUEST['_thumbnail_id']; if ( $thumbnail_id <= 0 ) { return ''; } return (string) $thumbnail_id; } function _wp_get_post_revision_version( $revision ) { if ( is_object( $revision ) ) { $revision = get_object_vars( $revision ); } elseif ( ! is_array( $revision ) ) { return false; } if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) { return (int) $matches[1]; } return 0; } function _wp_upgrade_revisions_of_post( $post, $revisions ) { global $wpdb; $lock = "revision-upgrade-{$post->ID}"; $now = time(); $result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) ); if ( ! $result ) { $locked = get_option( $lock ); if ( ! $locked ) { return false; } if ( $locked > $now - 3600 ) { return false; } } update_option( $lock, $now ); reset( $revisions ); $add_last = true; do { $this_revision = current( $revisions ); $prev_revision = next( $revisions ); $this_revision_version = _wp_get_post_revision_version( $this_revision ); if ( false === $this_revision_version ) { continue; } if ( 0 < $this_revision_version ) { $add_last = false; continue; } $update = array( 'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ), ); if ( $prev_revision ) { $prev_revision_version = _wp_get_post_revision_version( $prev_revision ); if ( $prev_revision_version < 1 ) { $update['post_author'] = $prev_revision->post_author; } } $result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) ); if ( $result ) { wp_cache_delete( $this_revision->ID, 'posts' ); } } while ( $prev_revision ); delete_option( $lock ); if ( $add_last ) { wp_save_post_revision( $post->ID ); } return true; } false, 'post_tag' => false, 'post_format' => false, ); } else { $post_format_base = apply_filters( 'post_format_rewrite_base', 'type' ); $rewrite = array( 'category' => array( 'hierarchical' => true, 'slug' => get_option( 'category_base' ) ? get_option( 'category_base' ) : 'category', 'with_front' => ! get_option( 'category_base' ) || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_CATEGORIES, ), 'post_tag' => array( 'hierarchical' => false, 'slug' => get_option( 'tag_base' ) ? get_option( 'tag_base' ) : 'tag', 'with_front' => ! get_option( 'tag_base' ) || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_TAGS, ), 'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false, ); } register_taxonomy( 'category', 'post', array( 'hierarchical' => true, 'query_var' => 'category_name', 'rewrite' => $rewrite['category'], 'public' => true, 'show_ui' => true, 'show_admin_column' => true, '_builtin' => true, 'capabilities' => array( 'manage_terms' => 'manage_categories', 'edit_terms' => 'edit_categories', 'delete_terms' => 'delete_categories', 'assign_terms' => 'assign_categories', ), 'show_in_rest' => true, 'rest_base' => 'categories', 'rest_controller_class' => 'WP_REST_Terms_Controller', ) ); register_taxonomy( 'post_tag', 'post', array( 'hierarchical' => false, 'query_var' => 'tag', 'rewrite' => $rewrite['post_tag'], 'public' => true, 'show_ui' => true, 'show_admin_column' => true, '_builtin' => true, 'capabilities' => array( 'manage_terms' => 'manage_post_tags', 'edit_terms' => 'edit_post_tags', 'delete_terms' => 'delete_post_tags', 'assign_terms' => 'assign_post_tags', ), 'show_in_rest' => true, 'rest_base' => 'tags', 'rest_controller_class' => 'WP_REST_Terms_Controller', ) ); register_taxonomy( 'nav_menu', 'nav_menu_item', array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Navigation Menus' ), 'singular_name' => __( 'Navigation Menu' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'capabilities' => array( 'manage_terms' => 'edit_theme_options', 'edit_terms' => 'edit_theme_options', 'delete_terms' => 'edit_theme_options', 'assign_terms' => 'edit_theme_options', ), 'show_in_rest' => true, 'rest_base' => 'menus', 'rest_controller_class' => 'WP_REST_Menus_Controller', ) ); register_taxonomy( 'link_category', 'link', array( 'hierarchical' => false, 'labels' => array( 'name' => __( 'Link Categories' ), 'singular_name' => __( 'Link Category' ), 'search_items' => __( 'Search Link Categories' ), 'popular_items' => null, 'all_items' => __( 'All Link Categories' ), 'edit_item' => __( 'Edit Link Category' ), 'update_item' => __( 'Update Link Category' ), 'add_new_item' => __( 'Add New Link Category' ), 'new_item_name' => __( 'New Link Category Name' ), 'separate_items_with_commas' => null, 'add_or_remove_items' => null, 'choose_from_most_used' => null, 'back_to_items' => __( '← Go to Link Categories' ), ), 'capabilities' => array( 'manage_terms' => 'manage_links', 'edit_terms' => 'manage_links', 'delete_terms' => 'manage_links', 'assign_terms' => 'manage_links', ), 'query_var' => false, 'rewrite' => false, 'public' => false, 'show_ui' => true, '_builtin' => true, ) ); register_taxonomy( 'post_format', 'post', array( 'public' => true, 'hierarchical' => false, 'labels' => array( 'name' => _x( 'Formats', 'post format' ), 'singular_name' => _x( 'Format', 'post format' ), ), 'query_var' => true, 'rewrite' => $rewrite['post_format'], 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => current_theme_supports( 'post-formats' ), ) ); register_taxonomy( 'wp_theme', array( 'wp_template', 'wp_template_part', 'wp_global_styles' ), array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Themes' ), 'singular_name' => __( 'Theme' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'show_in_rest' => false, ) ); register_taxonomy( 'wp_template_part_area', array( 'wp_template_part' ), array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Template Part Areas' ), 'singular_name' => __( 'Template Part Area' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'show_in_rest' => false, ) ); } function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_taxonomies; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field ); } function get_object_taxonomies( $object, $output = 'names' ) { global $wp_taxonomies; if ( is_object( $object ) ) { if ( 'attachment' === $object->post_type ) { return get_attachment_taxonomies( $object, $output ); } $object = $object->post_type; } $object = (array) $object; $taxonomies = array(); foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) { if ( array_intersect( $object, (array) $tax_obj->object_type ) ) { if ( 'names' === $output ) { $taxonomies[] = $tax_name; } else { $taxonomies[ $tax_name ] = $tax_obj; } } } return $taxonomies; } function get_taxonomy( $taxonomy ) { global $wp_taxonomies; if ( ! taxonomy_exists( $taxonomy ) ) { return false; } return $wp_taxonomies[ $taxonomy ]; } function taxonomy_exists( $taxonomy ) { global $wp_taxonomies; return isset( $wp_taxonomies[ $taxonomy ] ); } function is_taxonomy_hierarchical( $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return false; } $taxonomy = get_taxonomy( $taxonomy ); return $taxonomy->hierarchical; } function register_taxonomy( $taxonomy, $object_type, $args = array() ) { global $wp_taxonomies; if ( ! is_array( $wp_taxonomies ) ) { $wp_taxonomies = array(); } $args = wp_parse_args( $args ); if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { _doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2.0' ); return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) ); } $taxonomy_object = new WP_Taxonomy( $taxonomy, $object_type, $args ); $taxonomy_object->add_rewrite_rules(); $wp_taxonomies[ $taxonomy ] = $taxonomy_object; $taxonomy_object->add_hooks(); if ( ! empty( $taxonomy_object->default_term ) ) { $term = term_exists( $taxonomy_object->default_term['name'], $taxonomy ); if ( $term ) { update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); } else { $term = wp_insert_term( $taxonomy_object->default_term['name'], $taxonomy, array( 'slug' => sanitize_title( $taxonomy_object->default_term['slug'] ), 'description' => $taxonomy_object->default_term['description'], ) ); if ( ! is_wp_error( $term ) ) { update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); } } } do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object ); do_action( "registered_taxonomy_{$taxonomy}", $taxonomy, $object_type, (array) $taxonomy_object ); return $taxonomy_object; } function unregister_taxonomy( $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $taxonomy_object = get_taxonomy( $taxonomy ); if ( $taxonomy_object->_builtin ) { return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) ); } global $wp_taxonomies; $taxonomy_object->remove_rewrite_rules(); $taxonomy_object->remove_hooks(); if ( ! empty( $taxonomy_object->default_term ) ) { delete_option( 'default_term_' . $taxonomy_object->name ); } unset( $wp_taxonomies[ $taxonomy ] ); do_action( 'unregistered_taxonomy', $taxonomy ); return true; } function get_taxonomy_labels( $tax ) { $tax->labels = (array) $tax->labels; if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) ) { $tax->labels['separate_items_with_commas'] = $tax->helps; } if ( isset( $tax->no_tagcloud ) && empty( $tax->labels['not_found'] ) ) { $tax->labels['not_found'] = $tax->no_tagcloud; } $nohier_vs_hier_defaults = WP_Taxonomy::get_default_labels(); $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); $taxonomy = $tax->name; $default_labels = clone $labels; $labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels ); $labels = (object) array_merge( (array) $default_labels, (array) $labels ); return $labels; } function register_taxonomy_for_object_type( $taxonomy, $object_type ) { global $wp_taxonomies; if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) { return false; } if ( ! get_post_type_object( $object_type ) ) { return false; } if ( ! in_array( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ) ) { $wp_taxonomies[ $taxonomy ]->object_type[] = $object_type; } $wp_taxonomies[ $taxonomy ]->object_type = array_filter( $wp_taxonomies[ $taxonomy ]->object_type ); do_action( 'registered_taxonomy_for_object_type', $taxonomy, $object_type ); return true; } function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) { global $wp_taxonomies; if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) { return false; } if ( ! get_post_type_object( $object_type ) ) { return false; } $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ); if ( false === $key ) { return false; } unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] ); do_action( 'unregistered_taxonomy_for_object_type', $taxonomy, $object_type ); return true; } function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) { global $wpdb; if ( ! is_array( $term_ids ) ) { $term_ids = array( $term_ids ); } if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( (array) $taxonomies as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } $defaults = array( 'order' => 'ASC' ); $args = wp_parse_args( $args, $defaults ); $order = ( 'desc' === strtolower( $args['order'] ) ) ? 'DESC' : 'ASC'; $term_ids = array_map( 'intval', $term_ids ); $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'"; $term_ids = "'" . implode( "', '", $term_ids ) . "'"; $sql = "SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order"; $last_changed = wp_cache_get_last_changed( 'terms' ); $cache_key = 'get_objects_in_term:' . md5( $sql ) . ":$last_changed"; $cache = wp_cache_get( $cache_key, 'terms' ); if ( false === $cache ) { $object_ids = $wpdb->get_col( $sql ); wp_cache_set( $cache_key, $object_ids, 'terms' ); } else { $object_ids = (array) $cache; } if ( ! $object_ids ) { return array(); } return $object_ids; } function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) { $tax_query_obj = new WP_Tax_Query( $tax_query ); return $tax_query_obj->get_sql( $primary_table, $primary_id_column ); } function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { if ( empty( $term ) ) { return new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( $term instanceof WP_Term ) { $_term = $term; } elseif ( is_object( $term ) ) { if ( empty( $term->filter ) || 'raw' === $term->filter ) { $_term = sanitize_term( $term, $taxonomy, 'raw' ); $_term = new WP_Term( $_term ); } else { $_term = WP_Term::get_instance( $term->term_id ); } } else { $_term = WP_Term::get_instance( $term, $taxonomy ); } if ( is_wp_error( $_term ) ) { return $_term; } elseif ( ! $_term ) { return null; } $taxonomy = $_term->taxonomy; $_term = apply_filters( 'get_term', $_term, $taxonomy ); $_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy ); if ( ! ( $_term instanceof WP_Term ) ) { return $_term; } $_term->filter( $filter ); if ( ARRAY_A === $output ) { return $_term->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_term->to_array() ); } return $_term; } function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { if ( 'term_taxonomy_id' !== $field && ! taxonomy_exists( $taxonomy ) ) { return false; } if ( 'slug' === $field || 'name' === $field ) { $value = (string) $value; if ( 0 === strlen( $value ) ) { return false; } } if ( 'id' === $field || 'ID' === $field || 'term_id' === $field ) { $term = get_term( (int) $value, $taxonomy, $output, $filter ); if ( is_wp_error( $term ) || null === $term ) { $term = false; } return $term; } $args = array( 'get' => 'all', 'number' => 1, 'taxonomy' => $taxonomy, 'update_term_meta_cache' => false, 'orderby' => 'none', 'suppress_filter' => true, ); switch ( $field ) { case 'slug': $args['slug'] = $value; break; case 'name': $args['name'] = $value; break; case 'term_taxonomy_id': $args['term_taxonomy_id'] = $value; unset( $args['taxonomy'] ); break; default: return false; } $terms = get_terms( $args ); if ( is_wp_error( $terms ) || empty( $terms ) ) { return false; } $term = array_shift( $terms ); if ( 'term_taxonomy_id' === $field ) { $taxonomy = $term->taxonomy; } return get_term( $term, $taxonomy, $output, $filter ); } function get_term_children( $term_id, $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id; $terms = _get_term_hierarchy( $taxonomy ); if ( ! isset( $terms[ $term_id ] ) ) { return array(); } $children = $terms[ $term_id ]; foreach ( (array) $terms[ $term_id ] as $child ) { if ( $term_id === $child ) { continue; } if ( isset( $terms[ $child ] ) ) { $children = array_merge( $children, get_term_children( $child, $taxonomy ) ); } } return $children; } function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) { $term = get_term( $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! is_object( $term ) ) { return ''; } if ( ! isset( $term->$field ) ) { return ''; } return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context ); } function get_term_to_edit( $id, $taxonomy ) { $term = get_term( $id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! is_object( $term ) ) { return ''; } return sanitize_term( $term, $taxonomy, 'edit' ); } function get_terms( $args = array(), $deprecated = '' ) { $term_query = new WP_Term_Query(); $defaults = array( 'suppress_filter' => false, ); $_args = wp_parse_args( $args ); $key_intersect = array_intersect_key( $term_query->query_var_defaults, (array) $_args ); $do_legacy_args = $deprecated || empty( $key_intersect ); if ( $do_legacy_args ) { $taxonomies = (array) $args; $args = wp_parse_args( $deprecated, $defaults ); $args['taxonomy'] = $taxonomies; } else { $args = wp_parse_args( $args, $defaults ); if ( isset( $args['taxonomy'] ) && null !== $args['taxonomy'] ) { $args['taxonomy'] = (array) $args['taxonomy']; } } if ( ! empty( $args['taxonomy'] ) ) { foreach ( $args['taxonomy'] as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } } $suppress_filter = $args['suppress_filter']; unset( $args['suppress_filter'] ); $terms = $term_query->query( $args ); if ( ! is_array( $terms ) ) { return $terms; } if ( $suppress_filter ) { return $terms; } return apply_filters( 'get_terms', $terms, $term_query->query_vars['taxonomy'], $term_query->query_vars, $term_query ); } function add_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) { if ( wp_term_is_shared( $term_id ) ) { return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' ), $term_id ); } return add_metadata( 'term', $term_id, $meta_key, $meta_value, $unique ); } function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'term', $term_id, $meta_key, $meta_value ); } function get_term_meta( $term_id, $key = '', $single = false ) { return get_metadata( 'term', $term_id, $key, $single ); } function update_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) { if ( wp_term_is_shared( $term_id ) ) { return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' ), $term_id ); } return update_metadata( 'term', $term_id, $meta_key, $meta_value, $prev_value ); } function update_termmeta_cache( $term_ids ) { return update_meta_cache( 'term', $term_ids ); } function has_term_meta( $term_id ) { $check = wp_check_term_meta_support_prefilter( null ); if ( null !== $check ) { return $check; } global $wpdb; return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, term_id FROM $wpdb->termmeta WHERE term_id = %d ORDER BY meta_key,meta_id", $term_id ), ARRAY_A ); } function register_term_meta( $taxonomy, $meta_key, array $args ) { $args['object_subtype'] = $taxonomy; return register_meta( 'term', $meta_key, $args ); } function unregister_term_meta( $taxonomy, $meta_key ) { return unregister_meta_key( 'term', $meta_key, $taxonomy ); } function term_exists( $term, $taxonomy = '', $parent = null ) { global $_wp_suspend_cache_invalidation; if ( null === $term ) { return null; } $defaults = array( 'get' => 'all', 'fields' => 'ids', 'number' => 1, 'update_term_meta_cache' => false, 'order' => 'ASC', 'orderby' => 'term_id', 'suppress_filter' => true, ); if ( ! empty( $_wp_suspend_cache_invalidation ) ) { $defaults['cache_domain'] = microtime(); } if ( ! empty( $taxonomy ) ) { $defaults['taxonomy'] = $taxonomy; $defaults['fields'] = 'all'; } $defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent ); if ( is_int( $term ) ) { if ( 0 === $term ) { return 0; } $args = wp_parse_args( array( 'include' => array( $term ) ), $defaults ); $terms = get_terms( $args ); } else { $term = trim( wp_unslash( $term ) ); if ( '' === $term ) { return null; } if ( ! empty( $taxonomy ) && is_numeric( $parent ) ) { $defaults['parent'] = (int) $parent; } $args = wp_parse_args( array( 'slug' => sanitize_title( $term ) ), $defaults ); $terms = get_terms( $args ); if ( empty( $terms ) || is_wp_error( $terms ) ) { $args = wp_parse_args( array( 'name' => $term ), $defaults ); $terms = get_terms( $args ); } } if ( empty( $terms ) || is_wp_error( $terms ) ) { return null; } $_term = array_shift( $terms ); if ( ! empty( $taxonomy ) ) { return array( 'term_id' => (string) $_term->term_id, 'term_taxonomy_id' => (string) $_term->term_taxonomy_id, ); } return (string) $_term; } function term_is_ancestor_of( $term1, $term2, $taxonomy ) { if ( ! isset( $term1->term_id ) ) { $term1 = get_term( $term1, $taxonomy ); } if ( ! isset( $term2->parent ) ) { $term2 = get_term( $term2, $taxonomy ); } if ( empty( $term1->term_id ) || empty( $term2->parent ) ) { return false; } if ( $term2->parent === $term1->term_id ) { return true; } return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy ); } function sanitize_term( $term, $taxonomy, $context = 'display' ) { $fields = array( 'term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group', 'term_taxonomy_id', 'object_id' ); $do_object = is_object( $term ); $term_id = $do_object ? $term->term_id : ( isset( $term['term_id'] ) ? $term['term_id'] : 0 ); foreach ( (array) $fields as $field ) { if ( $do_object ) { if ( isset( $term->$field ) ) { $term->$field = sanitize_term_field( $field, $term->$field, $term_id, $taxonomy, $context ); } } else { if ( isset( $term[ $field ] ) ) { $term[ $field ] = sanitize_term_field( $field, $term[ $field ], $term_id, $taxonomy, $context ); } } } if ( $do_object ) { $term->filter = $context; } else { $term['filter'] = $context; } return $term; } function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) { $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; if ( $value < 0 ) { $value = 0; } } $context = strtolower( $context ); if ( 'raw' === $context ) { return $value; } if ( 'edit' === $context ) { $value = apply_filters( "edit_term_{$field}", $value, $term_id, $taxonomy ); $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_id ); if ( 'description' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { $value = apply_filters( "pre_term_{$field}", $value, $taxonomy ); $value = apply_filters( "pre_{$taxonomy}_{$field}", $value ); if ( 'slug' === $field ) { $value = apply_filters( 'pre_category_nicename', $value ); } } elseif ( 'rss' === $context ) { $value = apply_filters( "term_{$field}_rss", $value, $taxonomy ); $value = apply_filters( "{$taxonomy}_{$field}_rss", $value ); } else { $value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context ); $value = apply_filters( "{$taxonomy}_{$field}", $value, $term_id, $context ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function wp_count_terms( $args = array(), $deprecated = '' ) { $use_legacy_args = false; if ( $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) ) ) { $use_legacy_args = true; } $defaults = array( 'hide_empty' => false ); if ( $use_legacy_args ) { $defaults['taxonomy'] = $args; $args = $deprecated; } $args = wp_parse_args( $args, $defaults ); if ( isset( $args['ignore_empty'] ) ) { $args['hide_empty'] = $args['ignore_empty']; unset( $args['ignore_empty'] ); } $args['fields'] = 'count'; return get_terms( $args ); } function wp_delete_object_term_relationships( $object_id, $taxonomies ) { $object_id = (int) $object_id; if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( (array) $taxonomies as $taxonomy ) { $term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) ); $term_ids = array_map( 'intval', $term_ids ); wp_remove_object_terms( $object_id, $term_ids, $taxonomy ); } } function wp_delete_term( $term, $taxonomy, $args = array() ) { global $wpdb; $term = (int) $term; $ids = term_exists( $term, $taxonomy ); if ( ! $ids ) { return false; } if ( is_wp_error( $ids ) ) { return $ids; } $tt_id = $ids['term_taxonomy_id']; $defaults = array(); if ( 'category' === $taxonomy ) { $defaults['default'] = (int) get_option( 'default_category' ); if ( $defaults['default'] === $term ) { return 0; } } $taxonomy_object = get_taxonomy( $taxonomy ); if ( ! empty( $taxonomy_object->default_term ) ) { $defaults['default'] = (int) get_option( 'default_term_' . $taxonomy ); if ( $defaults['default'] === $term ) { return 0; } } $args = wp_parse_args( $args, $defaults ); if ( isset( $args['default'] ) ) { $default = (int) $args['default']; if ( ! term_exists( $default, $taxonomy ) ) { unset( $default ); } } if ( isset( $args['force_default'] ) ) { $force_default = $args['force_default']; } do_action( 'pre_delete_term', $term, $taxonomy ); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $term_obj = get_term( $term, $taxonomy ); if ( is_wp_error( $term_obj ) ) { return $term_obj; } $parent = $term_obj->parent; $edit_ids = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM $wpdb->term_taxonomy WHERE `parent` = " . (int) $term_obj->term_id ); $edit_tt_ids = wp_list_pluck( $edit_ids, 'term_taxonomy_id' ); do_action( 'edit_term_taxonomies', $edit_tt_ids ); $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id ) + compact( 'taxonomy' ) ); $edit_term_ids = wp_list_pluck( $edit_ids, 'term_id' ); clean_term_cache( $edit_term_ids, $taxonomy ); do_action( 'edited_term_taxonomies', $edit_tt_ids ); } $deleted_term = get_term( $term, $taxonomy ); $object_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) ); foreach ( $object_ids as $object_id ) { if ( ! isset( $default ) ) { wp_remove_object_terms( $object_id, $term, $taxonomy ); continue; } $terms = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids', 'orderby' => 'none', ) ); if ( 1 === count( $terms ) && isset( $default ) ) { $terms = array( $default ); } else { $terms = array_diff( $terms, array( $term ) ); if ( isset( $default ) && isset( $force_default ) && $force_default ) { $terms = array_merge( $terms, array( $default ) ); } } $terms = array_map( 'intval', $terms ); wp_set_object_terms( $object_id, $terms, $taxonomy ); } $tax_object = get_taxonomy( $taxonomy ); foreach ( $tax_object->object_type as $object_type ) { clean_object_term_cache( $object_ids, $object_type ); } $term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) ); foreach ( $term_meta_ids as $mid ) { delete_metadata_by_mid( 'term', $mid ); } do_action( 'delete_term_taxonomy', $tt_id ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); do_action( 'deleted_term_taxonomy', $tt_id ); if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term ) ) ) { $wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) ); } clean_term_cache( $term, $taxonomy ); do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids ); do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids ); return true; } function wp_delete_category( $cat_ID ) { return wp_delete_term( $cat_ID, 'category' ); } function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { if ( empty( $object_ids ) || empty( $taxonomies ) ) { return array(); } if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( $taxonomies as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } if ( ! is_array( $object_ids ) ) { $object_ids = array( $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $args = wp_parse_args( $args ); $args = apply_filters( 'wp_get_object_terms_args', $args, $object_ids, $taxonomies ); $terms = array(); if ( count( $taxonomies ) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy( $taxonomy ); if ( isset( $t->args ) && is_array( $t->args ) && array_merge( $args, $t->args ) != $args ) { unset( $taxonomies[ $index ] ); $terms = array_merge( $terms, wp_get_object_terms( $object_ids, $taxonomy, array_merge( $args, $t->args ) ) ); } } } else { $t = get_taxonomy( $taxonomies[0] ); if ( isset( $t->args ) && is_array( $t->args ) ) { $args = array_merge( $args, $t->args ); } } $args['taxonomy'] = $taxonomies; $args['object_ids'] = $object_ids; if ( ! empty( $taxonomies ) ) { $terms_from_remaining_taxonomies = get_terms( $args ); if ( ! empty( $args['fields'] ) && 0 === strpos( $args['fields'], 'id=>' ) ) { $terms = $terms + $terms_from_remaining_taxonomies; } else { $terms = array_merge( $terms, $terms_from_remaining_taxonomies ); } } $terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args ); $object_ids = implode( ',', $object_ids ); $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'"; return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args ); } function wp_insert_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term = apply_filters( 'pre_insert_term', $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( is_int( $term ) && 0 === $term ) { return new WP_Error( 'invalid_term_id', __( 'Invalid term ID.' ) ); } if ( '' === trim( $term ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); if ( (int) $args['parent'] > 0 && ! term_exists( (int) $args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $args['name'] = $term; $args['taxonomy'] = $taxonomy; $args['description'] = (string) $args['description']; $args = sanitize_term( $args, $taxonomy, 'db' ); $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parent = (int) $args['parent']; $slug_provided = ! empty( $args['slug'] ); if ( ! $slug_provided ) { $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $term_group = 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } } $name_matches = get_terms( array( 'taxonomy' => $taxonomy, 'name' => $name, 'hide_empty' => false, 'parent' => $args['parent'], 'update_term_meta_cache' => false, ) ); $name_match = null; if ( $name_matches ) { foreach ( $name_matches as $_match ) { if ( strtolower( $name ) === strtolower( $_match->name ) ) { $name_match = $_match; break; } } } if ( $name_match ) { $slug_match = get_term_by( 'slug', $slug, $taxonomy ); if ( ! $slug_provided || $name_match->slug === $slug || $slug_match ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { $siblings = get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', 'parent' => $parent, 'update_term_meta_cache' => false, ) ); $existing_term = null; $sibling_names = wp_list_pluck( $siblings, 'name' ); $sibling_slugs = wp_list_pluck( $siblings, 'slug' ); if ( ( ! $slug_provided || $name_match->slug === $slug ) && in_array( $name, $sibling_names, true ) ) { $existing_term = $name_match; } elseif ( $slug_match && in_array( $slug, $sibling_slugs, true ) ) { $existing_term = $slug_match; } if ( $existing_term ) { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists with this parent.' ), $existing_term->term_id ); } } else { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists in this taxonomy.' ), $name_match->term_id ); } } } $slug = wp_unique_term_slug( $slug, (object) $args ); $data = compact( 'name', 'slug', 'term_group' ); $data = apply_filters( 'wp_insert_term_data', $data, $taxonomy, $args ); if ( false === $wpdb->insert( $wpdb->terms, $data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database.' ), $wpdb->last_error ); } $term_id = (int) $wpdb->insert_id; if ( empty( $slug ) ) { $slug = sanitize_title( $slug, $term_id ); do_action( 'edit_terms', $term_id, $taxonomy ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); do_action( 'edited_terms', $term_id, $taxonomy ); } $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); if ( ! empty( $tt_id ) ) { return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } if ( false === $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ) + array( 'count' => 0 ) ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term taxonomy into the database.' ), $wpdb->last_error ); } $tt_id = (int) $wpdb->insert_id; $duplicate_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.slug, tt.term_taxonomy_id, tt.taxonomy FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON ( tt.term_id = t.term_id ) WHERE t.slug = %s AND tt.parent = %d AND tt.taxonomy = %s AND t.term_id < %d AND tt.term_taxonomy_id != %d", $slug, $parent, $taxonomy, $term_id, $tt_id ) ); $duplicate_term = apply_filters( 'wp_insert_term_duplicate_term_check', $duplicate_term, $term, $taxonomy, $args, $tt_id ); if ( $duplicate_term ) { $wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); $term_id = (int) $duplicate_term->term_id; $tt_id = (int) $duplicate_term->term_taxonomy_id; clean_term_cache( $term_id, $taxonomy ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } do_action( 'create_term', $term_id, $tt_id, $taxonomy ); do_action( "create_{$taxonomy}", $term_id, $tt_id ); $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); clean_term_cache( $term_id, $taxonomy ); do_action( 'created_term', $term_id, $tt_id, $taxonomy ); do_action( "created_{$taxonomy}", $term_id, $tt_id ); do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false ); do_action( "saved_{$taxonomy}", $term_id, $tt_id, false ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) { global $wpdb; $object_id = (int) $object_id; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } if ( ! $append ) { $old_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids', 'orderby' => 'none', 'update_term_meta_cache' => false, ) ); } else { $old_tt_ids = array(); } $tt_ids = array(); $term_ids = array(); $new_tt_ids = array(); foreach ( (array) $terms as $term ) { if ( '' === trim( $term ) ) { continue; } $term_info = term_exists( $term, $taxonomy ); if ( ! $term_info ) { if ( is_int( $term ) ) { continue; } $term_info = wp_insert_term( $term, $taxonomy ); } if ( is_wp_error( $term_info ) ) { return $term_info; } $term_ids[] = $term_info['term_id']; $tt_id = $term_info['term_taxonomy_id']; $tt_ids[] = $tt_id; if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) ) { continue; } do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy ); $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id, ) ); do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy ); $new_tt_ids[] = $tt_id; } if ( $new_tt_ids ) { wp_update_term_count( $new_tt_ids, $taxonomy ); } if ( ! $append ) { $delete_tt_ids = array_diff( $old_tt_ids, $tt_ids ); if ( $delete_tt_ids ) { $in_delete_tt_ids = "'" . implode( "', '", $delete_tt_ids ) . "'"; $delete_term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT tt.term_id FROM $wpdb->term_taxonomy AS tt WHERE tt.taxonomy = %s AND tt.term_taxonomy_id IN ($in_delete_tt_ids)", $taxonomy ) ); $delete_term_ids = array_map( 'intval', $delete_term_ids ); $remove = wp_remove_object_terms( $object_id, $delete_term_ids, $taxonomy ); if ( is_wp_error( $remove ) ) { return $remove; } } } $t = get_taxonomy( $taxonomy ); if ( ! $append && isset( $t->sort ) && $t->sort ) { $values = array(); $term_order = 0; $final_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids', 'update_term_meta_cache' => false, ) ); foreach ( $tt_ids as $tt_id ) { if ( in_array( (int) $tt_id, $final_tt_ids, true ) ) { $values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order ); } } if ( $values ) { if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . implode( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error ); } } } wp_cache_delete( $object_id, $taxonomy . '_relationships' ); wp_cache_delete( 'last_changed', 'terms' ); do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ); return $tt_ids; } function wp_add_object_terms( $object_id, $terms, $taxonomy ) { return wp_set_object_terms( $object_id, $terms, $taxonomy, true ); } function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { global $wpdb; $object_id = (int) $object_id; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } $tt_ids = array(); foreach ( (array) $terms as $term ) { if ( '' === trim( $term ) ) { continue; } $term_info = term_exists( $term, $taxonomy ); if ( ! $term_info ) { if ( is_int( $term ) ) { continue; } } if ( is_wp_error( $term_info ) ) { return $term_info; } $tt_ids[] = $term_info['term_taxonomy_id']; } if ( $tt_ids ) { $in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'"; do_action( 'delete_term_relationships', $object_id, $tt_ids, $taxonomy ); $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) ); wp_cache_delete( $object_id, $taxonomy . '_relationships' ); wp_cache_delete( 'last_changed', 'terms' ); do_action( 'deleted_term_relationships', $object_id, $tt_ids, $taxonomy ); wp_update_term_count( $tt_ids, $taxonomy ); return (bool) $deleted; } return false; } function wp_unique_term_slug( $slug, $term ) { global $wpdb; $needs_suffix = true; $original_slug = $slug; if ( ! term_exists( $slug ) || get_option( 'db_version' ) >= 30133 && ! get_term_by( 'slug', $slug, $term->taxonomy ) ) { $needs_suffix = false; } $parent_suffix = ''; if ( $needs_suffix && is_taxonomy_hierarchical( $term->taxonomy ) && ! empty( $term->parent ) ) { $the_parent = $term->parent; while ( ! empty( $the_parent ) ) { $parent_term = get_term( $the_parent, $term->taxonomy ); if ( is_wp_error( $parent_term ) || empty( $parent_term ) ) { break; } $parent_suffix .= '-' . $parent_term->slug; if ( ! term_exists( $slug . $parent_suffix ) ) { break; } if ( empty( $parent_term->parent ) ) { break; } $the_parent = $parent_term->parent; } } if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) { if ( $parent_suffix ) { $slug .= $parent_suffix; } if ( ! empty( $term->term_id ) ) { $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id ); } else { $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); } if ( $wpdb->get_var( $query ) ) { $num = 2; do { $alt_slug = $slug . "-$num"; $num++; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); $slug = $alt_slug; } } return apply_filters( 'wp_unique_term_slug', $slug, $term, $original_slug ); } function wp_update_term( $term_id, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id; $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! $term ) { return new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } $term = (array) $term->data; $term = wp_slash( $term ); $args = array_merge( $term, $args ); $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); $args = sanitize_term( $args, $taxonomy, 'db' ); $parsed_args = $args; $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parsed_args['name'] = $name; $parsed_args['description'] = $description; if ( '' === trim( $name ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } if ( (int) $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $empty_slug = false; if ( empty( $args['slug'] ) ) { $empty_slug = true; $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $parsed_args['slug'] = $slug; $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } $parsed_args['term_group'] = $term_group; } $parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args ); $duplicate = get_term_by( 'slug', $slug, $taxonomy ); if ( $duplicate && $duplicate->term_id !== $term_id ) { if ( $empty_slug || ( $parent !== (int) $term['parent'] ) ) { $slug = wp_unique_term_slug( $slug, (object) $args ); } else { return new WP_Error( 'duplicate_term_slug', sprintf( __( 'The slug “%s” is already in use by another term.' ), $slug ) ); } } $tt_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); $_term_id = _split_shared_term( $term_id, $tt_id ); if ( ! is_wp_error( $_term_id ) ) { $term_id = $_term_id; } do_action( 'edit_terms', $term_id, $taxonomy ); $data = compact( 'name', 'slug', 'term_group' ); $data = apply_filters( 'wp_update_term_data', $data, $term_id, $taxonomy, $args ); $wpdb->update( $wpdb->terms, $data, compact( 'term_id' ) ); if ( empty( $slug ) ) { $slug = sanitize_title( $name, $term_id ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); } do_action( 'edited_terms', $term_id, $taxonomy ); do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); do_action( 'edit_term', $term_id, $tt_id, $taxonomy ); do_action( "edit_{$taxonomy}", $term_id, $tt_id ); $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); clean_term_cache( $term_id, $taxonomy ); do_action( 'edited_term', $term_id, $tt_id, $taxonomy ); do_action( "edited_{$taxonomy}", $term_id, $tt_id ); do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true ); do_action( "saved_{$taxonomy}", $term_id, $tt_id, true ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } function wp_defer_term_counting( $defer = null ) { static $_defer = false; if ( is_bool( $defer ) ) { $_defer = $defer; if ( ! $defer ) { wp_update_term_count( null, null, true ); } } return $_defer; } function wp_update_term_count( $terms, $taxonomy, $do_deferred = false ) { static $_deferred = array(); if ( $do_deferred ) { foreach ( (array) array_keys( $_deferred ) as $tax ) { wp_update_term_count_now( $_deferred[ $tax ], $tax ); unset( $_deferred[ $tax ] ); } } if ( empty( $terms ) ) { return false; } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } if ( wp_defer_term_counting() ) { if ( ! isset( $_deferred[ $taxonomy ] ) ) { $_deferred[ $taxonomy ] = array(); } $_deferred[ $taxonomy ] = array_unique( array_merge( $_deferred[ $taxonomy ], $terms ) ); return true; } return wp_update_term_count_now( $terms, $taxonomy ); } function wp_update_term_count_now( $terms, $taxonomy ) { $terms = array_map( 'intval', $terms ); $taxonomy = get_taxonomy( $taxonomy ); if ( ! empty( $taxonomy->update_count_callback ) ) { call_user_func( $taxonomy->update_count_callback, $terms, $taxonomy ); } else { $object_types = (array) $taxonomy->object_type; foreach ( $object_types as &$object_type ) { if ( 0 === strpos( $object_type, 'attachment:' ) ) { list( $object_type ) = explode( ':', $object_type ); } } if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) { _update_post_term_count( $terms, $taxonomy ); } else { _update_generic_term_count( $terms, $taxonomy ); } } clean_term_cache( $terms, '', false ); return true; } function clean_object_term_cache( $object_ids, $object_type ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( ! is_array( $object_ids ) ) { $object_ids = array( $object_ids ); } $taxonomies = get_object_taxonomies( $object_type ); foreach ( $taxonomies as $taxonomy ) { wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" ); } wp_cache_delete( 'last_changed', 'terms' ); do_action( 'clean_object_term_cache', $object_ids, $object_type ); } function clean_term_cache( $ids, $taxonomy = '', $clean_taxonomy = true ) { global $wpdb, $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( ! is_array( $ids ) ) { $ids = array( $ids ); } $taxonomies = array(); if ( empty( $taxonomy ) ) { $tt_ids = array_map( 'intval', $ids ); $tt_ids = implode( ', ', $tt_ids ); $terms = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)" ); $ids = array(); foreach ( (array) $terms as $term ) { $taxonomies[] = $term->taxonomy; $ids[] = $term->term_id; } wp_cache_delete_multiple( $ids, 'terms' ); $taxonomies = array_unique( $taxonomies ); } else { wp_cache_delete_multiple( $ids, 'terms' ); $taxonomies = array( $taxonomy ); } foreach ( $taxonomies as $taxonomy ) { if ( $clean_taxonomy ) { clean_taxonomy_cache( $taxonomy ); } do_action( 'clean_term_cache', $ids, $taxonomy, $clean_taxonomy ); } wp_cache_set( 'last_changed', microtime(), 'terms' ); } function clean_taxonomy_cache( $taxonomy ) { wp_cache_delete( 'all_ids', $taxonomy ); wp_cache_delete( 'get', $taxonomy ); wp_cache_delete( 'last_changed', 'terms' ); delete_option( "{$taxonomy}_children" ); _get_term_hierarchy( $taxonomy ); do_action( 'clean_taxonomy_cache', $taxonomy ); } function get_object_term_cache( $id, $taxonomy ) { $_term_ids = wp_cache_get( $id, "{$taxonomy}_relationships" ); if ( false === $_term_ids ) { return false; } $term_ids = array(); foreach ( $_term_ids as $term_id ) { if ( is_numeric( $term_id ) ) { $term_ids[] = (int) $term_id; } elseif ( isset( $term_id->term_id ) ) { $term_ids[] = (int) $term_id->term_id; } } _prime_term_caches( $term_ids ); $terms = array(); foreach ( $term_ids as $term_id ) { $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } $terms[] = $term; } return $terms; } function update_object_term_cache( $object_ids, $object_type ) { if ( empty( $object_ids ) ) { return; } if ( ! is_array( $object_ids ) ) { $object_ids = explode( ',', $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $non_cached_ids = array(); $taxonomies = get_object_taxonomies( $object_type ); foreach ( $taxonomies as $taxonomy ) { $cache_values = wp_cache_get_multiple( (array) $object_ids, "{$taxonomy}_relationships" ); foreach ( $cache_values as $id => $value ) { if ( false === $value ) { $non_cached_ids[] = $id; } } } if ( empty( $non_cached_ids ) ) { return false; } $non_cached_ids = array_unique( $non_cached_ids ); $terms = wp_get_object_terms( $non_cached_ids, $taxonomies, array( 'fields' => 'all_with_object_id', 'orderby' => 'name', 'update_term_meta_cache' => false, ) ); $object_terms = array(); foreach ( (array) $terms as $term ) { $object_terms[ $term->object_id ][ $term->taxonomy ][] = $term->term_id; } foreach ( $non_cached_ids as $id ) { foreach ( $taxonomies as $taxonomy ) { if ( ! isset( $object_terms[ $id ][ $taxonomy ] ) ) { if ( ! isset( $object_terms[ $id ] ) ) { $object_terms[ $id ] = array(); } $object_terms[ $id ][ $taxonomy ] = array(); } } } $cache_values = array(); foreach ( $object_terms as $id => $value ) { foreach ( $value as $taxonomy => $terms ) { $cache_values[ $taxonomy ][ $id ] = $terms; } } foreach ( $cache_values as $taxonomy => $data ) { wp_cache_add_multiple( $data, "{$taxonomy}_relationships" ); } } function update_term_cache( $terms, $taxonomy = '' ) { $data = array(); foreach ( (array) $terms as $term ) { $_term = clone $term; unset( $_term->object_id ); $data[ $term->term_id ] = $_term; } wp_cache_add_multiple( $data, 'terms' ); } function _get_term_hierarchy( $taxonomy ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { return array(); } $children = get_option( "{$taxonomy}_children" ); if ( is_array( $children ) ) { return $children; } $children = array(); $terms = get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent', 'update_term_meta_cache' => false, ) ); foreach ( $terms as $term_id => $parent ) { if ( $parent > 0 ) { $children[ $parent ][] = $term_id; } } update_option( "{$taxonomy}_children", $children ); return $children; } function _get_term_children( $term_id, $terms, $taxonomy, &$ancestors = array() ) { $empty_array = array(); if ( empty( $terms ) ) { return $empty_array; } $term_id = (int) $term_id; $term_list = array(); $has_children = _get_term_hierarchy( $taxonomy ); if ( $term_id && ! isset( $has_children[ $term_id ] ) ) { return $empty_array; } if ( empty( $ancestors ) ) { $ancestors[ $term_id ] = 1; } foreach ( (array) $terms as $term ) { $use_id = false; if ( ! is_object( $term ) ) { $term = get_term( $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } $use_id = true; } if ( isset( $ancestors[ $term->term_id ] ) ) { continue; } if ( (int) $term->parent === $term_id ) { if ( $use_id ) { $term_list[] = $term->term_id; } else { $term_list[] = $term; } if ( ! isset( $has_children[ $term->term_id ] ) ) { continue; } $ancestors[ $term->term_id ] = 1; $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors ); if ( $children ) { $term_list = array_merge( $term_list, $children ); } } } return $term_list; } function _pad_term_counts( &$terms, $taxonomy ) { global $wpdb; if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { return; } $term_hier = _get_term_hierarchy( $taxonomy ); if ( empty( $term_hier ) ) { return; } $term_items = array(); $terms_by_id = array(); $term_ids = array(); foreach ( (array) $terms as $key => $term ) { $terms_by_id[ $term->term_id ] = & $terms[ $key ]; $term_ids[ $term->term_taxonomy_id ] = $term->term_id; } $tax_obj = get_taxonomy( $taxonomy ); $object_types = esc_sql( $tax_obj->object_type ); $results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys( $term_ids ) ) . ") AND post_type IN ('" . implode( "', '", $object_types ) . "') AND post_status = 'publish'" ); foreach ( $results as $row ) { $id = $term_ids[ $row->term_taxonomy_id ]; $term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1; } foreach ( $term_ids as $term_id ) { $child = $term_id; $ancestors = array(); while ( ! empty( $terms_by_id[ $child ] ) && $parent = $terms_by_id[ $child ]->parent ) { $ancestors[] = $child; if ( ! empty( $term_items[ $term_id ] ) ) { foreach ( $term_items[ $term_id ] as $item_id => $touches ) { $term_items[ $parent ][ $item_id ] = isset( $term_items[ $parent ][ $item_id ] ) ? ++$term_items[ $parent ][ $item_id ] : 1; } } $child = $parent; if ( in_array( $parent, $ancestors, true ) ) { break; } } } foreach ( (array) $term_items as $id => $items ) { if ( isset( $terms_by_id[ $id ] ) ) { $terms_by_id[ $id ]->count = count( $items ); } } } function _prime_term_caches( $term_ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' ); if ( ! empty( $non_cached_ids ) ) { $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_term_cache( $fresh_terms ); if ( $update_meta_cache ) { update_termmeta_cache( $non_cached_ids ); } } } function _update_post_term_count( $terms, $taxonomy ) { global $wpdb; $object_types = (array) $taxonomy->object_type; foreach ( $object_types as &$object_type ) { list( $object_type ) = explode( ':', $object_type ); } $object_types = array_unique( $object_types ); $check_attachments = array_search( 'attachment', $object_types, true ); if ( false !== $check_attachments ) { unset( $object_types[ $check_attachments ] ); $check_attachments = true; } if ( $object_types ) { $object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) ); } $post_statuses = array( 'publish' ); $post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) ); foreach ( (array) $terms as $term ) { $count = 0; if ( $check_attachments ) { $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status IN ('" . implode( "', '", $post_statuses ) . "') OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) IN ('" . implode( "', '", $post_statuses ) . "') ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) ); } if ( $object_types ) { $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status IN ('" . implode( "', '", $post_statuses ) . "') AND post_type IN ('" . implode( "', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) ); } do_action( 'edit_term_taxonomy', $term, $taxonomy->name ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); do_action( 'edited_term_taxonomy', $term, $taxonomy->name ); } } function _update_generic_term_count( $terms, $taxonomy ) { global $wpdb; foreach ( (array) $terms as $term ) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) ); do_action( 'edit_term_taxonomy', $term, $taxonomy->name ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); do_action( 'edited_term_taxonomy', $term, $taxonomy->name ); } } function _split_shared_term( $term_id, $term_taxonomy_id, $record = true ) { global $wpdb; if ( is_object( $term_id ) ) { $shared_term = $term_id; $term_id = (int) $shared_term->term_id; } if ( is_object( $term_taxonomy_id ) ) { $term_taxonomy = $term_taxonomy_id; $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id; } $shared_tt_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy tt WHERE tt.term_id = %d AND tt.term_taxonomy_id != %d", $term_id, $term_taxonomy_id ) ); if ( ! $shared_tt_count ) { return $term_id; } $check_term_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) ); if ( $check_term_id !== $term_id ) { return $check_term_id; } if ( empty( $shared_term ) ) { $shared_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.* FROM $wpdb->terms t WHERE t.term_id = %d", $term_id ) ); } $new_term_data = array( 'name' => $shared_term->name, 'slug' => $shared_term->slug, 'term_group' => $shared_term->term_group, ); if ( false === $wpdb->insert( $wpdb->terms, $new_term_data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not split shared term.' ), $wpdb->last_error ); } $new_term_id = (int) $wpdb->insert_id; $wpdb->update( $wpdb->term_taxonomy, array( 'term_id' => $new_term_id ), array( 'term_taxonomy_id' => $term_taxonomy_id ) ); if ( empty( $term_taxonomy ) ) { $term_taxonomy = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) ); } $children_tt_ids = $wpdb->get_col( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE parent = %d AND taxonomy = %s", $term_id, $term_taxonomy->taxonomy ) ); if ( ! empty( $children_tt_ids ) ) { foreach ( $children_tt_ids as $child_tt_id ) { $wpdb->update( $wpdb->term_taxonomy, array( 'parent' => $new_term_id ), array( 'term_taxonomy_id' => $child_tt_id ) ); clean_term_cache( (int) $child_tt_id, '', false ); } } else { clean_term_cache( $new_term_id, $term_taxonomy->taxonomy, false ); } clean_term_cache( $term_id, $term_taxonomy->taxonomy, false ); $taxonomies_to_clean = array( $term_taxonomy->taxonomy ); $shared_term_taxonomies = $wpdb->get_col( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) ); $taxonomies_to_clean = array_merge( $taxonomies_to_clean, $shared_term_taxonomies ); foreach ( $taxonomies_to_clean as $taxonomy_to_clean ) { clean_taxonomy_cache( $taxonomy_to_clean ); } if ( $record ) { $split_term_data = get_option( '_split_terms', array() ); if ( ! isset( $split_term_data[ $term_id ] ) ) { $split_term_data[ $term_id ] = array(); } $split_term_data[ $term_id ][ $term_taxonomy->taxonomy ] = $new_term_id; update_option( '_split_terms', $split_term_data ); } $shared_terms_exist = $wpdb->get_results( "SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt + LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id + GROUP BY t.term_id + HAVING term_tt_count > 1 + LIMIT 1" ); if ( ! $shared_terms_exist ) { update_option( 'finished_splitting_shared_terms', true ); } do_action( 'split_shared_term', $term_id, $new_term_id, $term_taxonomy_id, $term_taxonomy->taxonomy ); return $new_term_id; } function _wp_batch_split_terms() { global $wpdb; $lock_name = 'term_split.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_name ); if ( ! $lock_result || ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) ) { wp_schedule_single_event( time() + ( 5 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); return; } } update_option( $lock_name, time() ); $shared_terms = $wpdb->get_results( "SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt + LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id + GROUP BY t.term_id + HAVING term_tt_count > 1 + LIMIT 10" ); if ( ! $shared_terms ) { update_option( 'finished_splitting_shared_terms', true ); delete_option( $lock_name ); return; } wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); $_shared_terms = array(); foreach ( $shared_terms as $shared_term ) { $term_id = (int) $shared_term->term_id; $_shared_terms[ $term_id ] = $shared_term; } $shared_terms = $_shared_terms; $shared_term_ids = implode( ',', array_keys( $shared_terms ) ); $shared_tts = $wpdb->get_results( "SELECT * FROM {$wpdb->term_taxonomy} WHERE `term_id` IN ({$shared_term_ids})" ); $split_term_data = get_option( '_split_terms', array() ); $skipped_first_term = array(); $taxonomies = array(); foreach ( $shared_tts as $shared_tt ) { $term_id = (int) $shared_tt->term_id; if ( ! isset( $skipped_first_term[ $term_id ] ) ) { $skipped_first_term[ $term_id ] = 1; continue; } if ( ! isset( $split_term_data[ $term_id ] ) ) { $split_term_data[ $term_id ] = array(); } if ( ! isset( $taxonomies[ $shared_tt->taxonomy ] ) ) { $taxonomies[ $shared_tt->taxonomy ] = 1; } $split_term_data[ $term_id ][ $shared_tt->taxonomy ] = _split_shared_term( $shared_terms[ $term_id ], $shared_tt, false ); } foreach ( array_keys( $taxonomies ) as $tax ) { delete_option( "{$tax}_children" ); _get_term_hierarchy( $tax ); } update_option( '_split_terms', $split_term_data ); delete_option( $lock_name ); } function _wp_check_for_scheduled_split_terms() { if ( ! get_option( 'finished_splitting_shared_terms' ) && ! wp_next_scheduled( 'wp_split_shared_term_batch' ) ) { wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_split_shared_term_batch' ); } } function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { if ( 'category' !== $taxonomy ) { return; } foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) { if ( (int) get_option( $option, -1 ) === $term_id ) { update_option( $option, $new_term_id ); } } } function _wp_check_split_terms_in_menus( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { global $wpdb; $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT m1.post_id + FROM {$wpdb->postmeta} AS m1 + INNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id ) + INNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id ) + WHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' ) + AND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = %s ) + AND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id ) ); if ( $post_ids ) { foreach ( $post_ids as $post_id ) { update_post_meta( $post_id, '_menu_item_object_id', $new_term_id, $term_id ); } } } function _wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { if ( 'nav_menu' !== $taxonomy ) { return; } $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { if ( $term_id === $menu_id ) { $locations[ $location ] = $new_term_id; } } set_theme_mod( 'nav_menu_locations', $locations ); } function wp_get_split_terms( $old_term_id ) { $split_terms = get_option( '_split_terms', array() ); $terms = array(); if ( isset( $split_terms[ $old_term_id ] ) ) { $terms = $split_terms[ $old_term_id ]; } return $terms; } function wp_get_split_term( $old_term_id, $taxonomy ) { $split_terms = wp_get_split_terms( $old_term_id ); $term_id = false; if ( isset( $split_terms[ $taxonomy ] ) ) { $term_id = (int) $split_terms[ $taxonomy ]; } return $term_id; } function wp_term_is_shared( $term_id ) { global $wpdb; if ( get_option( 'finished_splitting_shared_terms' ) ) { return false; } $tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) ); return $tt_count > 1; } function get_term_link( $term, $taxonomy = '' ) { global $wp_rewrite; if ( ! is_object( $term ) ) { if ( is_int( $term ) ) { $term = get_term( $term, $taxonomy ); } else { $term = get_term_by( 'slug', $term, $taxonomy ); } } if ( ! is_object( $term ) ) { $term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } if ( is_wp_error( $term ) ) { return $term; } $taxonomy = $term->taxonomy; $termlink = $wp_rewrite->get_extra_permastruct( $taxonomy ); $termlink = apply_filters( 'pre_term_link', $termlink, $term ); $slug = $term->slug; $t = get_taxonomy( $taxonomy ); if ( empty( $termlink ) ) { if ( 'category' === $taxonomy ) { $termlink = '?cat=' . $term->term_id; } elseif ( $t->query_var ) { $termlink = "?$t->query_var=$slug"; } else { $termlink = "?taxonomy=$taxonomy&term=$slug"; } $termlink = home_url( $termlink ); } else { if ( ! empty( $t->rewrite['hierarchical'] ) ) { $hierarchical_slugs = array(); $ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' ); foreach ( (array) $ancestors as $ancestor ) { $ancestor_term = get_term( $ancestor, $taxonomy ); $hierarchical_slugs[] = $ancestor_term->slug; } $hierarchical_slugs = array_reverse( $hierarchical_slugs ); $hierarchical_slugs[] = $slug; $termlink = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs ), $termlink ); } else { $termlink = str_replace( "%$taxonomy%", $slug, $termlink ); } $termlink = home_url( user_trailingslashit( $termlink, 'category' ) ); } if ( 'post_tag' === $taxonomy ) { $termlink = apply_filters( 'tag_link', $termlink, $term->term_id ); } elseif ( 'category' === $taxonomy ) { $termlink = apply_filters( 'category_link', $termlink, $term->term_id ); } return apply_filters( 'term_link', $termlink, $term, $taxonomy ); } function the_taxonomies( $args = array() ) { $defaults = array( 'post' => 0, 'before' => '', 'sep' => ' ', 'after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); echo $parsed_args['before'] . implode( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after']; } function get_the_taxonomies( $post = 0, $args = array() ) { $post = get_post( $post ); $args = wp_parse_args( $args, array( 'template' => __( '%s: %l.' ), 'term_template' => '%2$s', ) ); $taxonomies = array(); if ( ! $post ) { return $taxonomies; } foreach ( get_object_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } if ( empty( $t['template'] ) ) { $t['template'] = $args['template']; } if ( empty( $t['term_template'] ) ) { $t['term_template'] = $args['term_template']; } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $links = array(); foreach ( $terms as $term ) { $links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link( $term ) ), $term->name ); } if ( $links ) { $taxonomies[ $taxonomy ] = wp_sprintf( $t['template'], $t['label'], $links, $terms ); } } return $taxonomies; } function get_post_taxonomies( $post = 0 ) { $post = get_post( $post ); return get_object_taxonomies( $post ); } function is_object_in_term( $object_id, $taxonomy, $terms = null ) { $object_id = (int) $object_id; if ( ! $object_id ) { return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) ); } $object_terms = get_object_term_cache( $object_id, $taxonomy ); if ( false === $object_terms ) { $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) ); if ( is_wp_error( $object_terms ) ) { return $object_terms; } wp_cache_set( $object_id, wp_list_pluck( $object_terms, 'term_id' ), "{$taxonomy}_relationships" ); } if ( is_wp_error( $object_terms ) ) { return $object_terms; } if ( empty( $object_terms ) ) { return false; } if ( empty( $terms ) ) { return ( ! empty( $object_terms ) ); } $terms = (array) $terms; $ints = array_filter( $terms, 'is_int' ); if ( $ints ) { $strs = array_diff( $terms, $ints ); } else { $strs =& $terms; } foreach ( $object_terms as $object_term ) { if ( $ints && in_array( $object_term->term_id, $ints, true ) ) { return true; } if ( $strs ) { $numeric_strs = array_map( 'intval', array_filter( $strs, 'is_numeric' ) ); if ( in_array( $object_term->term_id, $numeric_strs, true ) ) { return true; } if ( in_array( $object_term->name, $strs, true ) ) { return true; } if ( in_array( $object_term->slug, $strs, true ) ) { return true; } } } return false; } function is_object_in_taxonomy( $object_type, $taxonomy ) { $taxonomies = get_object_taxonomies( $object_type ); if ( empty( $taxonomies ) ) { return false; } return in_array( $taxonomy, $taxonomies, true ); } function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) { $object_id = (int) $object_id; $ancestors = array(); if ( empty( $object_id ) ) { return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); } if ( ! $resource_type ) { if ( is_taxonomy_hierarchical( $object_type ) ) { $resource_type = 'taxonomy'; } elseif ( post_type_exists( $object_type ) ) { $resource_type = 'post_type'; } } if ( 'taxonomy' === $resource_type ) { $term = get_term( $object_id, $object_type ); while ( ! is_wp_error( $term ) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors, true ) ) { $ancestors[] = (int) $term->parent; $term = get_term( $term->parent, $object_type ); } } elseif ( 'post_type' === $resource_type ) { $ancestors = get_post_ancestors( $object_id ); } return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); } function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) { $term = get_term( $term_id, $taxonomy ); if ( ! $term || is_wp_error( $term ) ) { return false; } return (int) $term->parent; } function wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) { if ( ! $parent ) { return 0; } if ( $parent === $term_id ) { return 0; } $loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ); if ( ! $loop ) { return $parent; } if ( isset( $loop[ $term_id ] ) ) { return 0; } foreach ( array_keys( $loop ) as $loop_member ) { wp_update_term( $loop_member, $taxonomy, array( 'parent' => 0 ) ); } return $parent; } function is_taxonomy_viewable( $taxonomy ) { if ( is_scalar( $taxonomy ) ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return false; } } return $taxonomy->publicly_queryable; } function wp_cache_set_terms_last_changed() { wp_cache_set( 'last_changed', microtime(), 'terms' ); } function wp_check_term_meta_support_prefilter( $check ) { if ( get_option( 'db_version' ) < 34370 ) { return false; } return $check; } 'category' ); $args = wp_parse_args( $args, $defaults ); $args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args ); if ( isset( $args['type'] ) && 'link' === $args['type'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'type => link', 'taxonomy => link_category' ) ); $args['taxonomy'] = 'link_category'; } $categories = get_terms( $args ); if ( is_wp_error( $categories ) ) { $categories = array(); } else { $categories = (array) $categories; foreach ( array_keys( $categories ) as $k ) { _make_cat_compat( $categories[ $k ] ); } } return $categories; } function get_category( $category, $output = OBJECT, $filter = 'raw' ) { $category = get_term( $category, 'category', $output, $filter ); if ( is_wp_error( $category ) ) { return $category; } _make_cat_compat( $category ); return $category; } function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) { $category_path = rawurlencode( urldecode( $category_path ) ); $category_path = str_replace( '%2F', '/', $category_path ); $category_path = str_replace( '%20', ' ', $category_path ); $category_paths = '/' . trim( $category_path, '/' ); $leaf_path = sanitize_title( basename( $category_paths ) ); $category_paths = explode( '/', $category_paths ); $full_path = ''; foreach ( (array) $category_paths as $pathdir ) { $full_path .= ( '' !== $pathdir ? '/' : '' ) . sanitize_title( $pathdir ); } $categories = get_terms( array( 'taxonomy' => 'category', 'get' => 'all', 'slug' => $leaf_path, ) ); if ( empty( $categories ) ) { return; } foreach ( $categories as $category ) { $path = '/' . $leaf_path; $curcategory = $category; while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) { $curcategory = get_term( $curcategory->parent, 'category' ); if ( is_wp_error( $curcategory ) ) { return $curcategory; } $path = '/' . $curcategory->slug . $path; } if ( $path == $full_path ) { $category = get_term( $category->term_id, 'category', $output ); _make_cat_compat( $category ); return $category; } } if ( ! $full_match ) { $category = get_term( reset( $categories )->term_id, 'category', $output ); _make_cat_compat( $category ); return $category; } } function get_category_by_slug( $slug ) { $category = get_term_by( 'slug', $slug, 'category' ); if ( $category ) { _make_cat_compat( $category ); } return $category; } function get_cat_ID( $cat_name ) { $cat = get_term_by( 'name', $cat_name, 'category' ); if ( $cat ) { return $cat->term_id; } return 0; } function get_cat_name( $cat_id ) { $cat_id = (int) $cat_id; $category = get_term( $cat_id, 'category' ); if ( ! $category || is_wp_error( $category ) ) { return ''; } return $category->name; } function cat_is_ancestor_of( $cat1, $cat2 ) { return term_is_ancestor_of( $cat1, $cat2, 'category' ); } function sanitize_category( $category, $context = 'display' ) { return sanitize_term( $category, 'category', $context ); } function sanitize_category_field( $field, $value, $cat_id, $context ) { return sanitize_term_field( $field, $value, $cat_id, 'category', $context ); } function get_tags( $args = '' ) { $defaults = array( 'taxonomy' => 'post_tag' ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( $args ); if ( empty( $tags ) ) { $tags = array(); } else { $tags = apply_filters( 'get_tags', $tags, $args ); } return $tags; } function get_tag( $tag, $output = OBJECT, $filter = 'raw' ) { return get_term( $tag, 'post_tag', $output, $filter ); } function clean_category_cache( $id ) { clean_term_cache( $id, 'category' ); } function _make_cat_compat( &$category ) { if ( is_object( $category ) && ! is_wp_error( $category ) ) { $category->cat_ID = $category->term_id; $category->category_count = $category->count; $category->category_description = $category->description; $category->cat_name = $category->name; $category->category_nicename = $category->slug; $category->category_parent = $category->parent; } elseif ( is_array( $category ) && isset( $category['term_id'] ) ) { $category['cat_ID'] = &$category['term_id']; $category['category_count'] = &$category['count']; $category['category_description'] = &$category['description']; $category['cat_name'] = &$category['name']; $category['category_nicename'] = &$category['slug']; $category['category_parent'] = &$category['parent']; } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); protected $filtered_where_clause; public $date_query = false; public $query_vars; public $query_var_defaults; public $comments; public $found_comments = 0; public $max_num_pages = 0; public function __call( $name, $arguments ) { if ( 'get_search_sql' === $name ) { return $this->get_search_sql( ...$arguments ); } return false; } public function __construct( $query = '' ) { $this->query_var_defaults = array( 'author_email' => '', 'author_url' => '', 'author__in' => '', 'author__not_in' => '', 'include_unapproved' => '', 'fields' => '', 'ID' => '', 'comment__in' => '', 'comment__not_in' => '', 'karma' => '', 'number' => '', 'offset' => '', 'no_found_rows' => true, 'orderby' => '', 'order' => 'DESC', 'paged' => 1, 'parent' => '', 'parent__in' => '', 'parent__not_in' => '', 'post_author__in' => '', 'post_author__not_in' => '', 'post_ID' => '', 'post_id' => 0, 'post__in' => '', 'post__not_in' => '', 'post_author' => '', 'post_name' => '', 'post_parent' => '', 'post_status' => '', 'post_type' => '', 'status' => 'all', 'type' => '', 'type__in' => '', 'type__not_in' => '', 'user_id' => '', 'search' => '', 'count' => false, 'meta_key' => '', 'meta_value' => '', 'meta_query' => '', 'date_query' => null, 'hierarchical' => false, 'cache_domain' => 'core', 'update_comment_meta_cache' => true, 'update_comment_post_cache' => false, ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_comment_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_comments(); } public function get_comments() { global $wpdb; $this->parse_query(); $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $this->query_vars ); do_action_ref_array( 'pre_get_comments', array( &$this ) ); $this->meta_query->parse_query_vars( $this->query_vars ); if ( ! empty( $this->meta_query->queries ) ) { $this->meta_query_clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this ); } $comment_data = null; $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) ); if ( null !== $comment_data ) { if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) { $this->comments = $comment_data; } return $comment_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_comment_meta_cache'], $_args['update_comment_post_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'comment' ); $cache_key = "get_comments:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'comment' ); if ( false === $cache_value ) { $comment_ids = $this->get_comment_ids(); if ( $comment_ids ) { $this->set_found_comments(); } $cache_value = array( 'comment_ids' => $comment_ids, 'found_comments' => $this->found_comments, ); wp_cache_add( $cache_key, $cache_value, 'comment' ); } else { $comment_ids = $cache_value['comment_ids']; $this->found_comments = $cache_value['found_comments']; } if ( $this->found_comments && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_comments / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $comment_ids; } $comment_ids = array_map( 'intval', $comment_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->comments = $comment_ids; return $this->comments; } _prime_comment_caches( $comment_ids, $this->query_vars['update_comment_meta_cache'] ); $_comments = array(); foreach ( $comment_ids as $comment_id ) { $_comment = get_comment( $comment_id ); if ( $_comment ) { $_comments[] = $_comment; } } if ( $this->query_vars['update_comment_post_cache'] ) { $comment_post_ids = array(); foreach ( $_comments as $_comment ) { $comment_post_ids[] = $_comment->comment_post_ID; } _prime_post_caches( $comment_post_ids, false, false ); } $_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) ); $comments = array_map( 'get_comment', $_comments ); if ( $this->query_vars['hierarchical'] ) { $comments = $this->fill_descendants( $comments ); } $this->comments = $comments; return $this->comments; } protected function get_comment_ids() { global $wpdb; $approved_clauses = array(); $status_clauses = array(); $statuses = wp_parse_list( $this->query_vars['status'] ); if ( empty( $statuses ) ) { $statuses = array( 'all' ); } if ( ! in_array( 'any', $statuses, true ) ) { foreach ( $statuses as $status ) { switch ( $status ) { case 'hold': $status_clauses[] = "comment_approved = '0'"; break; case 'approve': $status_clauses[] = "comment_approved = '1'"; break; case 'all': case '': $status_clauses[] = "( comment_approved = '0' OR comment_approved = '1' )"; break; default: $status_clauses[] = $wpdb->prepare( 'comment_approved = %s', $status ); break; } } if ( ! empty( $status_clauses ) ) { $approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )'; } } if ( ! empty( $this->query_vars['include_unapproved'] ) ) { $include_unapproved = wp_parse_list( $this->query_vars['include_unapproved'] ); $unapproved_ids = array(); $unapproved_emails = array(); foreach ( $include_unapproved as $unapproved_identifier ) { if ( is_numeric( $unapproved_identifier ) ) { $approved_clauses[] = $wpdb->prepare( "( user_id = %d AND comment_approved = '0' )", $unapproved_identifier ); } else { if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' AND {$wpdb->comments}.comment_ID = %d )", $unapproved_identifier, (int) $_GET['unapproved'] ); } else { $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' )", $unapproved_identifier ); } } } } if ( ! empty( $approved_clauses ) ) { if ( 1 === count( $approved_clauses ) ) { $this->sql_clauses['where']['approved'] = $approved_clauses[0]; } else { $this->sql_clauses['where']['approved'] = '( ' . implode( ' OR ', $approved_clauses ) . ' )'; } } $order = ( 'ASC' === strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC'; if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); $found_orderby_comment_id = false; foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ), true ) ) { $found_orderby_comment_id = true; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'comment__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } if ( empty( $orderby_array ) ) { $orderby_array[] = "$wpdb->comments.comment_date_gmt $order"; } if ( ! $found_orderby_comment_id ) { $comment_id_order = ''; foreach ( $orderby_array as $orderby_clause ) { if ( preg_match( '/comment_date(?:_gmt)*\ (ASC|DESC)/', $orderby_clause, $match ) ) { $comment_id_order = $match[1]; break; } } if ( ! $comment_id_order ) { foreach ( $orderby_array as $orderby_clause ) { if ( false !== strpos( 'ASC', $orderby_clause ) ) { $comment_id_order = 'ASC'; } else { $comment_id_order = 'DESC'; } break; } } if ( ! $comment_id_order ) { $comment_id_order = 'DESC'; } $orderby_array[] = "$wpdb->comments.comment_ID $comment_id_order"; } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "$wpdb->comments.comment_date_gmt $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $paged = absint( $this->query_vars['paged'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . ( $number * ( $paged - 1 ) ) . ',' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "$wpdb->comments.comment_ID"; } $post_id = absint( $this->query_vars['post_id'] ); if ( ! empty( $post_id ) ) { $this->sql_clauses['where']['post_id'] = $wpdb->prepare( 'comment_post_ID = %d', $post_id ); } if ( ! empty( $this->query_vars['comment__in'] ) ) { $this->sql_clauses['where']['comment__in'] = "$wpdb->comments.comment_ID IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['comment__not_in'] ) ) { $this->sql_clauses['where']['comment__not_in'] = "$wpdb->comments.comment_ID NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['parent__in'] ) ) { $this->sql_clauses['where']['parent__in'] = 'comment_parent IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['parent__not_in'] ) ) { $this->sql_clauses['where']['parent__not_in'] = 'comment_parent NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post__in'] ) ) { $this->sql_clauses['where']['post__in'] = 'comment_post_ID IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post__not_in'] ) ) { $this->sql_clauses['where']['post__not_in'] = 'comment_post_ID NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__not_in'] ) ) . ' )'; } if ( '' !== $this->query_vars['author_email'] ) { $this->sql_clauses['where']['author_email'] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] ); } if ( '' !== $this->query_vars['author_url'] ) { $this->sql_clauses['where']['author_url'] = $wpdb->prepare( 'comment_author_url = %s', $this->query_vars['author_url'] ); } if ( '' !== $this->query_vars['karma'] ) { $this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] ); } $raw_types = array( 'IN' => array_merge( (array) $this->query_vars['type'], (array) $this->query_vars['type__in'] ), 'NOT IN' => (array) $this->query_vars['type__not_in'], ); $comment_types = array(); foreach ( $raw_types as $operator => $_raw_types ) { $_raw_types = array_unique( $_raw_types ); foreach ( $_raw_types as $type ) { switch ( $type ) { case '': case 'all': break; case 'comment': case 'comments': $comment_types[ $operator ][] = "''"; $comment_types[ $operator ][] = "'comment'"; break; case 'pings': $comment_types[ $operator ][] = "'pingback'"; $comment_types[ $operator ][] = "'trackback'"; break; default: $comment_types[ $operator ][] = $wpdb->prepare( '%s', $type ); break; } } if ( ! empty( $comment_types[ $operator ] ) ) { $types_sql = implode( ', ', $comment_types[ $operator ] ); $this->sql_clauses['where'][ 'comment_type__' . strtolower( str_replace( ' ', '_', $operator ) ) ] = "comment_type $operator ($types_sql)"; } } $parent = $this->query_vars['parent']; if ( $this->query_vars['hierarchical'] && ! $parent ) { $parent = 0; } if ( '' !== $parent ) { $this->sql_clauses['where']['parent'] = $wpdb->prepare( 'comment_parent = %d', $parent ); } if ( is_array( $this->query_vars['user_id'] ) ) { $this->sql_clauses['where']['user_id'] = 'user_id IN (' . implode( ',', array_map( 'absint', $this->query_vars['user_id'] ) ) . ')'; } elseif ( '' !== $this->query_vars['user_id'] ) { $this->sql_clauses['where']['user_id'] = $wpdb->prepare( 'user_id = %d', $this->query_vars['user_id'] ); } if ( isset( $this->query_vars['search'] ) && strlen( $this->query_vars['search'] ) ) { $search_sql = $this->get_search_sql( $this->query_vars['search'], array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); $this->sql_clauses['where']['search'] = preg_replace( '/^\s*AND\s*/', '', $search_sql ); } $join_posts_table = false; $plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent' ) ); $post_fields = array_filter( $plucked ); if ( ! empty( $post_fields ) ) { $join_posts_table = true; foreach ( $post_fields as $field_name => $field_value ) { $esses = array_fill( 0, count( (array) $field_value ), '%s' ); $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $field_value ); } } foreach ( array( 'post_status', 'post_type' ) as $field_name ) { $q_values = array(); if ( ! empty( $this->query_vars[ $field_name ] ) ) { $q_values = $this->query_vars[ $field_name ]; if ( ! is_array( $q_values ) ) { $q_values = explode( ',', $q_values ); } if ( in_array( 'any', $q_values, true ) || empty( $q_values ) ) { continue; } $join_posts_table = true; $esses = array_fill( 0, count( $q_values ), '%s' ); $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $q_values ); } } if ( ! empty( $this->query_vars['author__in'] ) ) { $this->sql_clauses['where']['author__in'] = 'user_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['author__not_in'] ) ) { $this->sql_clauses['where']['author__not_in'] = 'user_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post_author__in'] ) ) { $join_posts_table = true; $this->sql_clauses['where']['post_author__in'] = 'post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post_author__not_in'] ) ) { $join_posts_table = true; $this->sql_clauses['where']['post_author__not_in'] = 'post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )'; } $join = ''; $groupby = ''; if ( $join_posts_table ) { $join .= "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID"; } if ( ! empty( $this->meta_query_clauses ) ) { $join .= $this->meta_query_clauses['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $this->meta_query_clauses['where'] ); if ( ! $this->query_vars['count'] ) { $groupby = "{$wpdb->comments}.comment_ID"; } } if ( ! empty( $this->query_vars['date_query'] ) && is_array( $this->query_vars['date_query'] ) ) { $this->date_query = new WP_Date_Query( $this->query_vars['date_query'], 'comment_date' ); $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $this->filtered_where_clause = $where; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->comments $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " + {$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']} + "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } else { $comment_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $comment_ids ); } } private function set_found_comments() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_comments_query = apply_filters( 'found_comments_query', 'SELECT FOUND_ROWS()', $this ); $this->found_comments = (int) $wpdb->get_var( $found_comments_query ); } } protected function fill_descendants( $comments ) { global $wpdb; $levels = array( 0 => wp_list_pluck( $comments, 'comment_ID' ), ); $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) ); $last_changed = wp_cache_get_last_changed( 'comment' ); $level = 0; $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' ); do { $child_ids = array(); $uncached_parent_ids = array(); $_parent_ids = $levels[ $level ]; foreach ( $_parent_ids as $parent_id ) { $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; $parent_child_ids = wp_cache_get( $cache_key, 'comment' ); if ( false !== $parent_child_ids ) { $child_ids = array_merge( $child_ids, $parent_child_ids ); } else { $uncached_parent_ids[] = $parent_id; } } if ( $uncached_parent_ids ) { $parent_query_args = $this->query_vars; foreach ( $exclude_keys as $exclude_key ) { $parent_query_args[ $exclude_key ] = ''; } $parent_query_args['parent__in'] = $uncached_parent_ids; $parent_query_args['no_found_rows'] = true; $parent_query_args['hierarchical'] = false; $parent_query_args['offset'] = 0; $parent_query_args['number'] = 0; $level_comments = get_comments( $parent_query_args ); $parent_map = array_fill_keys( $uncached_parent_ids, array() ); foreach ( $level_comments as $level_comment ) { $parent_map[ $level_comment->comment_parent ][] = $level_comment->comment_ID; $child_ids[] = $level_comment->comment_ID; } $data = array(); foreach ( $parent_map as $parent_id => $children ) { $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; $data[ $cache_key ] = $children; } wp_cache_set_multiple( $data, 'comment' ); } $level++; $levels[ $level ] = $child_ids; } while ( $child_ids ); $descendant_ids = array(); for ( $i = 1, $c = count( $levels ); $i < $c; $i++ ) { $descendant_ids = array_merge( $descendant_ids, $levels[ $i ] ); } _prime_comment_caches( $descendant_ids, $this->query_vars['update_comment_meta_cache'] ); $all_comments = $comments; foreach ( $descendant_ids as $descendant_id ) { $all_comments[] = get_comment( $descendant_id ); } if ( 'threaded' === $this->query_vars['hierarchical'] ) { $threaded_comments = array(); $ref = array(); foreach ( $all_comments as $k => $c ) { $_c = get_comment( $c->comment_ID ); if ( ! isset( $ref[ $c->comment_parent ] ) ) { $threaded_comments[ $_c->comment_ID ] = $_c; $ref[ $_c->comment_ID ] = $threaded_comments[ $_c->comment_ID ]; } else { $ref[ $_c->comment_parent ]->add_child( $_c ); $ref[ $_c->comment_ID ] = $ref[ $_c->comment_parent ]->get_child( $_c->comment_ID ); } } foreach ( $ref as $_ref ) { $_ref->populated_children( true ); } $comments = $threaded_comments; } else { $comments = $all_comments; } return $comments; } protected function get_search_sql( $search, $columns ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return ' AND (' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'comment_agent', 'comment_approved', 'comment_author', 'comment_author_email', 'comment_author_IP', 'comment_author_url', 'comment_content', 'comment_date', 'comment_date_gmt', 'comment_ID', 'comment_karma', 'comment_parent', 'comment_post_ID', 'comment_type', 'user_id', ); if ( ! empty( $this->query_vars['meta_key'] ) ) { $allowed_keys[] = $this->query_vars['meta_key']; $allowed_keys[] = 'meta_value'; $allowed_keys[] = 'meta_value_num'; } $meta_query_clauses = $this->meta_query->get_clauses(); if ( $meta_query_clauses ) { $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_query_clauses ) ); } $parsed = false; if ( $this->query_vars['meta_key'] === $orderby || 'meta_value' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value"; } elseif ( 'meta_value_num' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value+0"; } elseif ( 'comment__in' === $orderby ) { $comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) ); $parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )"; } elseif ( in_array( $orderby, $allowed_keys, true ) ) { if ( isset( $meta_query_clauses[ $orderby ] ) ) { $meta_clause = $meta_query_clauses[ $orderby ]; $parsed = sprintf( 'CAST(%s.meta_value AS %s)', esc_sql( $meta_clause['alias'] ), esc_sql( $meta_clause['cast'] ) ); } else { $parsed = "$wpdb->comments.$orderby"; } } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } document_title_separator' ) ); } return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated ); } function wp_title_rss( $deprecated = '–' ) { if ( '–' !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), 'document_title_separator' ) ); } echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated ); } function get_the_title_rss() { $title = get_the_title(); return apply_filters( 'the_title_rss', $title ); } function the_title_rss() { echo get_the_title_rss(); } function get_the_content_feed( $feed_type = null ) { if ( ! $feed_type ) { $feed_type = get_default_feed(); } $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); return apply_filters( 'the_content_feed', $content, $feed_type ); } function the_content_feed( $feed_type = null ) { echo get_the_content_feed( $feed_type ); } function the_excerpt_rss() { $output = get_the_excerpt(); echo apply_filters( 'the_excerpt_rss', $output ); } function the_permalink_rss() { echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); } function comments_link_feed() { echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) ); } function comment_guid( $comment_id = null ) { echo esc_url( get_comment_guid( $comment_id ) ); } function get_comment_guid( $comment_id = null ) { $comment = get_comment( $comment_id ); if ( ! is_object( $comment ) ) { return false; } return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; } function comment_link( $comment = null ) { echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) ); } function get_comment_author_rss() { return apply_filters( 'comment_author_rss', get_comment_author() ); } function comment_author_rss() { echo get_comment_author_rss(); } function comment_text_rss() { $comment_text = get_comment_text(); $comment_text = apply_filters( 'comment_text_rss', $comment_text ); echo $comment_text; } function get_the_category_rss( $type = null ) { if ( empty( $type ) ) { $type = get_default_feed(); } $categories = get_the_category(); $tags = get_the_tags(); $the_list = ''; $cat_names = array(); $filter = 'rss'; if ( 'atom' === $type ) { $filter = 'raw'; } if ( ! empty( $categories ) ) { foreach ( (array) $categories as $category ) { $cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter ); } } if ( ! empty( $tags ) ) { foreach ( (array) $tags as $tag ) { $cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter ); } } $cat_names = array_unique( $cat_names ); foreach ( $cat_names as $cat_name ) { if ( 'rdf' === $type ) { $the_list .= "\t\t\n"; } elseif ( 'atom' === $type ) { $the_list .= sprintf( '', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); } else { $the_list .= "\t\t\n"; } } return apply_filters( 'the_category_rss', $the_list, $type ); } function the_category_rss( $type = null ) { echo get_the_category_rss( $type ); } function html_type_rss() { $type = get_bloginfo( 'html_type' ); if ( strpos( $type, 'xhtml' ) !== false ) { $type = 'xhtml'; } else { $type = 'html'; } echo $type; } function rss_enclosure() { if ( post_password_required() ) { return; } foreach ( (array) get_post_custom() as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); $t = preg_split( '/[ \t]/', trim( $enclosure[2] ) ); $type = $t[0]; echo apply_filters( 'rss_enclosure', '' . "\n" ); } } } } function atom_enclosure() { if ( post_password_required() ) { return; } foreach ( (array) get_post_custom() as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); $url = ''; $type = ''; $length = 0; $mimes = get_allowed_mime_types(); if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) { $url = trim( $enclosure[0] ); } for ( $i = 1; $i <= 2; $i++ ) { if ( isset( $enclosure[ $i ] ) ) { if ( is_numeric( $enclosure[ $i ] ) ) { $length = trim( $enclosure[ $i ] ); } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) { $type = trim( $enclosure[ $i ] ); } } } $html_link_tag = sprintf( "\n", esc_url( $url ), esc_attr( $length ), esc_attr( $type ) ); echo apply_filters( 'atom_enclosure', $html_link_tag ); } } } } function prep_atom_text_construct( $data ) { if ( strpos( $data, '<' ) === false && strpos( $data, '&' ) === false ) { return array( 'text', $data ); } if ( ! function_exists( 'xml_parser_create' ) ) { trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); return array( 'html', "" ); } $parser = xml_parser_create(); xml_parse( $parser, '
      ' . $data . '
      ', true ); $code = xml_get_error_code( $parser ); xml_parser_free( $parser ); unset( $parser ); if ( ! $code ) { if ( strpos( $data, '<' ) === false ) { return array( 'text', $data ); } else { $data = "
      $data
      "; return array( 'xhtml', $data ); } } if ( strpos( $data, ']]>' ) === false ) { return array( 'html', "" ); } else { return array( 'html', htmlspecialchars( $data ) ); } } function atom_site_icon() { $url = get_site_icon_url( 32 ); if ( $url ) { echo '' . convert_chars( $url ) . "\n"; } } function rss2_site_icon() { $rss_title = get_wp_title_rss(); if ( empty( $rss_title ) ) { $rss_title = get_bloginfo_rss( 'name' ); } $url = get_site_icon_url( 32 ); if ( $url ) { echo ' + + ' . convert_chars( $url ) . ' + ' . $rss_title . ' + ' . get_bloginfo_rss( 'url' ) . ' + 32 + 32 + ' . "\n"; } } function get_self_link() { $host = parse_url( home_url() ); return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ); } function self_link() { echo esc_url( apply_filters( 'self_link', get_self_link() ) ); } function get_feed_build_date( $format ) { global $wp_query; $datetime = false; $max_modified_time = false; $utc = new DateTimeZone( 'UTC' ); if ( ! empty( $wp_query ) && $wp_query->have_posts() ) { $modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' ); if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) { $comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' ); $modified_times = array_merge( $modified_times, $comment_times ); } $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', max( $modified_times ), $utc ); } if ( false === $datetime ) { $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', get_lastpostmodified( 'GMT' ), $utc ); } if ( false !== $datetime ) { $max_modified_time = $datetime->format( $format ); } return apply_filters( 'get_feed_build_date', $max_modified_time, $format ); } function feed_content_type( $type = '' ) { if ( empty( $type ) ) { $type = get_default_feed(); } $types = array( 'rss' => 'application/rss+xml', 'rss2' => 'application/rss+xml', 'rss-http' => 'text/xml', 'atom' => 'application/atom+xml', 'rdf' => 'application/rdf+xml', ); $content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream'; return apply_filters( 'feed_content_type', $content_type, $type ); } function fetch_feed( $url ) { if ( ! class_exists( 'SimplePie', false ) ) { require_once ABSPATH . WPINC . '/class-simplepie.php'; } require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php'; require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php'; require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php'; $feed = new SimplePie(); $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); if ( method_exists( 'SimplePie_Cache', 'register' ) ) { SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' ); $feed->set_cache_location( 'wp_transient' ); } else { require_once ABSPATH . WPINC . '/class-wp-feed-cache.php'; $feed->set_cache_class( 'WP_Feed_Cache' ); } $feed->set_file_class( 'WP_SimplePie_File' ); $feed->set_feed_url( $url ); $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); $feed->init(); $feed->set_output_encoding( get_option( 'blog_charset' ) ); if ( $feed->error() ) { return new WP_Error( 'simplepie-error', $feed->error() ); } return $feed; } 'parent', 'id' => 'term_id', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $indent = str_repeat( "\t", $depth ); $output .= "$indent
        \n"; } public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $indent = str_repeat( "\t", $depth ); $output .= "$indent
      \n"; } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $category = $data_object; $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category ); if ( '' === $cat_name ) { return; } $atts = array(); $atts['href'] = get_term_link( $category ); if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) { $atts['title'] = strip_tags( apply_filters( 'category_description', $category->description, $category ) ); } $atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $link = sprintf( '%s', $attributes, $cat_name ); if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { $link .= ' '; if ( empty( $args['feed_image'] ) ) { $link .= '('; } $link .= ''; } $link .= ''; if ( empty( $args['feed_image'] ) ) { $link .= ')'; } } if ( ! empty( $args['show_count'] ) ) { $link .= ' (' . number_format_i18n( $category->count ) . ')'; } if ( 'list' === $args['style'] ) { $output .= "\tterm_id, ); if ( ! empty( $args['current_category'] ) ) { $_current_terms = get_terms( array( 'taxonomy' => $category->taxonomy, 'include' => $args['current_category'], 'hide_empty' => false, ) ); foreach ( $_current_terms as $_current_term ) { if ( $category->term_id == $_current_term->term_id ) { $css_classes[] = 'current-cat'; $link = str_replace( 'term_id == $_current_term->parent ) { $css_classes[] = 'current-cat-parent'; } while ( $_current_term->parent ) { if ( $category->term_id == $_current_term->parent ) { $css_classes[] = 'current-cat-ancestor'; break; } $_current_term = get_term( $_current_term->parent, $category->taxonomy ); } } } $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) ); $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; $output .= $css_classes; $output .= ">$link\n"; } elseif ( isset( $args['separator'] ) ) { $output .= "\t$link" . $args['separator'] . "\n"; } else { $output .= "\t$link
      \n"; } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $output .= "\n"; } } relation = 'OR'; } else { $this->relation = 'AND'; } if ( ! isset( $date_query[0] ) ) { $date_query = array( $date_query ); } if ( ! empty( $date_query['column'] ) ) { $date_query['column'] = esc_sql( $date_query['column'] ); } else { $date_query['column'] = esc_sql( $default_column ); } $this->column = $this->validate_column( $this->column ); $this->compare = $this->get_compare( $date_query ); $this->queries = $this->sanitize_query( $date_query ); } public function sanitize_query( $queries, $parent_query = null ) { $cleaned_query = array(); $defaults = array( 'column' => 'post_date', 'compare' => '=', 'relation' => 'AND', ); foreach ( $queries as $qkey => $qvalue ) { if ( is_numeric( $qkey ) && ! is_array( $qvalue ) ) { unset( $queries[ $qkey ] ); } } foreach ( $defaults as $dkey => $dvalue ) { if ( isset( $queries[ $dkey ] ) ) { continue; } if ( isset( $parent_query[ $dkey ] ) ) { $queries[ $dkey ] = $parent_query[ $dkey ]; } else { $queries[ $dkey ] = $dvalue; } } if ( $this->is_first_order_clause( $queries ) ) { $this->validate_date_values( $queries ); } foreach ( $queries as $key => $q ) { if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) { $cleaned_query[ $key ] = $q; } else { $cleaned_query[] = $this->sanitize_query( $q, $queries ); } } return $cleaned_query; } protected function is_first_order_clause( $query ) { $time_keys = array_intersect( $this->time_keys, array_keys( $query ) ); return ! empty( $time_keys ); } public function get_compare( $query ) { if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { return strtoupper( $query['compare'] ); } return $this->compare; } public function validate_date_values( $date_query = array() ) { if ( empty( $date_query ) ) { return false; } $valid = true; if ( array_key_exists( 'before', $date_query ) && is_array( $date_query['before'] ) ) { $valid = $this->validate_date_values( $date_query['before'] ); } if ( array_key_exists( 'after', $date_query ) && is_array( $date_query['after'] ) ) { $valid = $this->validate_date_values( $date_query['after'] ); } $min_max_checks = array(); if ( array_key_exists( 'year', $date_query ) ) { if ( is_array( $date_query['year'] ) ) { $_year = reset( $date_query['year'] ); } else { $_year = $date_query['year']; } $max_days_of_year = gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1; } else { $max_days_of_year = 366; } $min_max_checks['dayofyear'] = array( 'min' => 1, 'max' => $max_days_of_year, ); $min_max_checks['dayofweek'] = array( 'min' => 1, 'max' => 7, ); $min_max_checks['dayofweek_iso'] = array( 'min' => 1, 'max' => 7, ); $min_max_checks['month'] = array( 'min' => 1, 'max' => 12, ); if ( isset( $_year ) ) { $week_count = gmdate( 'W', mktime( 0, 0, 0, 12, 28, $_year ) ); } else { $week_count = 53; } $min_max_checks['week'] = array( 'min' => 1, 'max' => $week_count, ); $min_max_checks['day'] = array( 'min' => 1, 'max' => 31, ); $min_max_checks['hour'] = array( 'min' => 0, 'max' => 23, ); $min_max_checks['minute'] = array( 'min' => 0, 'max' => 59, ); $min_max_checks['second'] = array( 'min' => 0, 'max' => 59, ); foreach ( $min_max_checks as $key => $check ) { if ( ! array_key_exists( $key, $date_query ) ) { continue; } foreach ( (array) $date_query[ $key ] as $_value ) { $is_between = $_value >= $check['min'] && $_value <= $check['max']; if ( ! is_numeric( $_value ) || ! $is_between ) { $error = sprintf( __( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ), '' . esc_html( $_value ) . '', '' . esc_html( $key ) . '', '' . esc_html( $check['min'] ) . '', '' . esc_html( $check['max'] ) . '' ); _doing_it_wrong( __CLASS__, $error, '4.1.0' ); $valid = false; } } } if ( ! $valid ) { return $valid; } $day_month_year_error_msg = ''; $day_exists = array_key_exists( 'day', $date_query ) && is_numeric( $date_query['day'] ); $month_exists = array_key_exists( 'month', $date_query ) && is_numeric( $date_query['month'] ); $year_exists = array_key_exists( 'year', $date_query ) && is_numeric( $date_query['year'] ); if ( $day_exists && $month_exists && $year_exists ) { if ( ! wp_checkdate( $date_query['month'], $date_query['day'], $date_query['year'], sprintf( '%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day'] ) ) ) { $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.' ), '' . esc_html( $date_query['year'] ) . '', '' . esc_html( $date_query['month'] ) . '', '' . esc_html( $date_query['day'] ) . '' ); $valid = false; } } elseif ( $day_exists && $month_exists ) { if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) { $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: month %1$s, day %2$s.' ), '' . esc_html( $date_query['month'] ) . '', '' . esc_html( $date_query['day'] ) . '' ); $valid = false; } } if ( ! empty( $day_month_year_error_msg ) ) { _doing_it_wrong( __CLASS__, $day_month_year_error_msg, '4.1.0' ); } return $valid; } public function validate_column( $column ) { global $wpdb; $valid_columns = array( 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt', 'user_registered', 'registered', 'last_updated', ); if ( false === strpos( $column, '.' ) ) { if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ), true ) ) { $column = 'post_date'; } $known_columns = array( $wpdb->posts => array( 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt', ), $wpdb->comments => array( 'comment_date', 'comment_date_gmt', ), $wpdb->users => array( 'user_registered', ), $wpdb->blogs => array( 'registered', 'last_updated', ), ); foreach ( $known_columns as $table_name => $table_columns ) { if ( in_array( $column, $table_columns, true ) ) { $column = $table_name . '.' . $column; break; } } } return preg_replace( '/[^a-zA-Z0-9_$\.]/', '', $column ); } public function get_sql() { $sql = $this->get_sql_clauses(); $where = $sql['where']; return apply_filters( 'get_date_sql', $where, $this ); } protected function get_sql_clauses() { $sql = $this->get_sql_for_query( $this->queries ); if ( ! empty( $sql['where'] ) ) { $sql['where'] = ' AND ' . $sql['where']; } return $sql; } protected function get_sql_for_query( $query, $depth = 0 ) { $sql_chunks = array( 'join' => array(), 'where' => array(), ); $sql = array( 'join' => '', 'where' => '', ); $indent = ''; for ( $i = 0; $i < $depth; $i++ ) { $indent .= ' '; } foreach ( $query as $key => $clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; } elseif ( is_array( $clause ) ) { if ( $this->is_first_order_clause( $clause ) ) { $clause_sql = $this->get_sql_for_clause( $clause, $query ); $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; } $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); } else { $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); $sql_chunks['where'][] = $clause_sql['where']; $sql_chunks['join'][] = $clause_sql['join']; } } } $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); if ( empty( $relation ) ) { $relation = 'AND'; } if ( ! empty( $sql_chunks['join'] ) ) { $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); } if ( ! empty( $sql_chunks['where'] ) ) { $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; } return $sql; } protected function get_sql_for_subquery( $query ) { return $this->get_sql_for_clause( $query, '' ); } protected function get_sql_for_clause( $query, $parent_query ) { global $wpdb; $where_parts = array(); $column = ( ! empty( $query['column'] ) ) ? esc_sql( $query['column'] ) : $this->column; $column = $this->validate_column( $column ); $compare = $this->get_compare( $query ); $inclusive = ! empty( $query['inclusive'] ); $lt = '<'; $gt = '>'; if ( $inclusive ) { $lt .= '='; $gt .= '='; } if ( ! empty( $query['after'] ) ) { $where_parts[] = $wpdb->prepare( "$column $gt %s", $this->build_mysql_datetime( $query['after'], ! $inclusive ) ); } if ( ! empty( $query['before'] ) ) { $where_parts[] = $wpdb->prepare( "$column $lt %s", $this->build_mysql_datetime( $query['before'], $inclusive ) ); } $date_units = array( 'YEAR' => array( 'year' ), 'MONTH' => array( 'month', 'monthnum' ), '_wp_mysql_week' => array( 'week', 'w' ), 'DAYOFYEAR' => array( 'dayofyear' ), 'DAYOFMONTH' => array( 'day' ), 'DAYOFWEEK' => array( 'dayofweek' ), 'WEEKDAY' => array( 'dayofweek_iso' ), ); foreach ( $date_units as $sql_part => $query_parts ) { foreach ( $query_parts as $query_part ) { if ( isset( $query[ $query_part ] ) ) { $value = $this->build_value( $compare, $query[ $query_part ] ); if ( $value ) { switch ( $sql_part ) { case '_wp_mysql_week': $where_parts[] = _wp_mysql_week( $column ) . " $compare $value"; break; case 'WEEKDAY': $where_parts[] = "$sql_part( $column ) + 1 $compare $value"; break; default: $where_parts[] = "$sql_part( $column ) $compare $value"; } break; } } } } if ( isset( $query['hour'] ) || isset( $query['minute'] ) || isset( $query['second'] ) ) { foreach ( array( 'hour', 'minute', 'second' ) as $unit ) { if ( ! isset( $query[ $unit ] ) ) { $query[ $unit ] = null; } } $time_query = $this->build_time_query( $column, $compare, $query['hour'], $query['minute'], $query['second'] ); if ( $time_query ) { $where_parts[] = $time_query; } } return array( 'where' => $where_parts, 'join' => array(), ); } public function build_value( $compare, $value ) { if ( ! isset( $value ) ) { return false; } switch ( $compare ) { case 'IN': case 'NOT IN': $value = (array) $value; $value = array_filter( $value, 'is_numeric' ); if ( empty( $value ) ) { return false; } return '(' . implode( ',', array_map( 'intval', $value ) ) . ')'; case 'BETWEEN': case 'NOT BETWEEN': if ( ! is_array( $value ) || 2 !== count( $value ) ) { $value = array( $value, $value ); } else { $value = array_values( $value ); } foreach ( $value as $v ) { if ( ! is_numeric( $v ) ) { return false; } } $value = array_map( 'intval', $value ); return $value[0] . ' AND ' . $value[1]; default: if ( ! is_numeric( $value ) ) { return false; } return (int) $value; } } public function build_mysql_datetime( $datetime, $default_to_max = false ) { if ( ! is_array( $datetime ) ) { if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], 'day' => (int) $matches[3], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], 'day' => (int) $matches[3], 'hour' => (int) $matches[4], 'minute' => (int) $matches[5], ); } if ( ! is_array( $datetime ) ) { $wp_timezone = wp_timezone(); $dt = date_create( $datetime, $wp_timezone ); if ( false === $dt ) { return gmdate( 'Y-m-d H:i:s', false ); } return $dt->setTimezone( $wp_timezone )->format( 'Y-m-d H:i:s' ); } } $datetime = array_map( 'absint', $datetime ); if ( ! isset( $datetime['year'] ) ) { $datetime['year'] = current_time( 'Y' ); } if ( ! isset( $datetime['month'] ) ) { $datetime['month'] = ( $default_to_max ) ? 12 : 1; } if ( ! isset( $datetime['day'] ) ) { $datetime['day'] = ( $default_to_max ) ? (int) gmdate( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1; } if ( ! isset( $datetime['hour'] ) ) { $datetime['hour'] = ( $default_to_max ) ? 23 : 0; } if ( ! isset( $datetime['minute'] ) ) { $datetime['minute'] = ( $default_to_max ) ? 59 : 0; } if ( ! isset( $datetime['second'] ) ) { $datetime['second'] = ( $default_to_max ) ? 59 : 0; } return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second'] ); } public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) { global $wpdb; if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) ) { return false; } if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { $return = array(); $value = $this->build_value( $compare, $hour ); if ( false !== $value ) { $return[] = "HOUR( $column ) $compare $value"; } $value = $this->build_value( $compare, $minute ); if ( false !== $value ) { $return[] = "MINUTE( $column ) $compare $value"; } $value = $this->build_value( $compare, $second ); if ( false !== $value ) { $return[] = "SECOND( $column ) $compare $value"; } return implode( ' AND ', $return ); } if ( isset( $hour ) && ! isset( $minute ) && ! isset( $second ) ) { $value = $this->build_value( $compare, $hour ); if ( false !== $value ) { return "HOUR( $column ) $compare $value"; } } elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) ) { $value = $this->build_value( $compare, $minute ); if ( false !== $value ) { return "MINUTE( $column ) $compare $value"; } } elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) ) { $value = $this->build_value( $compare, $second ); if ( false !== $value ) { return "SECOND( $column ) $compare $value"; } } if ( ! isset( $minute ) ) { return false; } $format = ''; $time = ''; if ( null !== $hour ) { $format .= '%H.'; $time .= sprintf( '%02d', $hour ) . '.'; } else { $format .= '0.'; $time .= '0.'; } $format .= '%i'; $time .= sprintf( '%02d', $minute ); if ( isset( $second ) ) { $format .= '%s'; $time .= sprintf( '%02d', $second ); } return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); } } $value ) { $values[ $key ] = wp_cache_add( $key, $value, $group, $expire ); } return $values; } endif; if ( ! function_exists( 'wp_cache_set_multiple' ) ) : function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = wp_cache_set( $key, $value, $group, $expire ); } return $values; } endif; if ( ! function_exists( 'wp_cache_get_multiple' ) ) : function wp_cache_get_multiple( $keys, $group = '', $force = false ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = wp_cache_get( $key, $group, $force ); } return $values; } endif; if ( ! function_exists( 'wp_cache_delete_multiple' ) ) : function wp_cache_delete_multiple( array $keys, $group = '' ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = wp_cache_delete( $key, $group ); } return $values; } endif; if ( ! function_exists( 'wp_cache_flush_runtime' ) ) : function wp_cache_flush_runtime() { return wp_using_ext_object_cache() ? false : wp_cache_flush(); } endif; version_checked ) { $current = false; } if ( ! is_object( $current ) ) { $current = new stdClass; $current->updates = array(); $current->version_checked = $wp_version; } if ( ! empty( $extra_stats ) ) { $force_check = true; } $timeout = MINUTE_IN_SECONDS; $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( ! $force_check && $time_not_changed ) { return; } $locale = apply_filters( 'core_version_check_locale', get_locale() ); $current->last_checked = time(); set_site_transient( 'update_core', $current ); if ( method_exists( $wpdb, 'db_version' ) ) { $mysql_version = preg_replace( '/[^0-9.].*/', '', $wpdb->db_version() ); } else { $mysql_version = 'N/A'; } if ( is_multisite() ) { $num_blogs = get_blog_count(); $wp_install = network_site_url(); $multisite_enabled = 1; } else { $multisite_enabled = 0; $num_blogs = 1; $wp_install = home_url( '/' ); } $query = array( 'version' => $wp_version, 'php' => $php_version, 'locale' => $locale, 'mysql' => $mysql_version, 'local_package' => isset( $wp_local_package ) ? $wp_local_package : '', 'blogs' => $num_blogs, 'users' => get_user_count(), 'multisite_enabled' => $multisite_enabled, 'initial_db_version' => get_site_option( 'initial_db_version' ), ); $query = apply_filters( 'core_version_check_query_args', $query ); $post_body = array( 'translations' => wp_json_encode( $translations ), ); if ( is_array( $extra_stats ) ) { $post_body = array_merge( $post_body, $extra_stats ); } if ( defined( 'WP_AUTO_UPDATE_CORE' ) && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { $query['channel'] = WP_AUTO_UPDATE_CORE; } $url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, '', '&' ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $doing_cron = wp_doing_cron(); $options = array( 'timeout' => $doing_cron ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 'headers' => array( 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ), ), 'body' => $post_body, ); $response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['offers'] ) ) { return; } $offers = $body['offers']; foreach ( $offers as &$offer ) { foreach ( $offer as $offer_key => $value ) { if ( 'packages' === $offer_key ) { $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) ); } elseif ( 'download' === $offer_key ) { $offer['download'] = esc_url( $value ); } else { $offer[ $offer_key ] = esc_html( $value ); } } $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files', ), '' ) ); } $updates = new stdClass(); $updates->updates = $offers; $updates->last_checked = time(); $updates->version_checked = $wp_version; if ( isset( $body['translations'] ) ) { $updates->translations = $body['translations']; } set_site_transient( 'update_core', $updates ); if ( ! empty( $body['ttl'] ) ) { $ttl = (int) $body['ttl']; if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); } } if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) { do_action( 'wp_maybe_auto_update' ); } } function wp_update_plugins( $extra_stats = array() ) { if ( wp_installing() ) { return; } require ABSPATH . WPINC . '/version.php'; if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); $translations = wp_get_installed_translations( 'plugins' ); $active = get_option( 'active_plugins', array() ); $current = get_site_transient( 'update_plugins' ); if ( ! is_object( $current ) ) { $current = new stdClass; } $updates = new stdClass; $updates->last_checked = time(); $updates->response = array(); $updates->translations = array(); $updates->no_update = array(); $doing_cron = wp_doing_cron(); switch ( current_filter() ) { case 'upgrader_process_complete': $timeout = 0; break; case 'load-update-core.php': $timeout = MINUTE_IN_SECONDS; break; case 'load-plugins.php': case 'load-update.php': $timeout = HOUR_IN_SECONDS; break; default: if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $plugin_changed = false; foreach ( $plugins as $file => $p ) { $updates->checked[ $file ] = $p['Version']; if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) { $plugin_changed = true; } } if ( isset( $current->response ) && is_array( $current->response ) ) { foreach ( $current->response as $plugin_file => $update_details ) { if ( ! isset( $plugins[ $plugin_file ] ) ) { $plugin_changed = true; break; } } } if ( ! $plugin_changed ) { return; } } $current->last_checked = time(); set_site_transient( 'update_plugins', $current ); $to_send = compact( 'plugins', 'active' ); $locales = array_values( get_available_languages() ); $locales = apply_filters( 'plugins_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { $timeout = 3 + (int) ( count( $plugins ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'plugins' => wp_json_encode( $to_send ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), 'all' => wp_json_encode( true ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = 'http://api.wordpress.org/plugins/update-check/1.1/'; $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) { return; } $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); if ( $response && is_array( $response ) ) { $updates->response = $response['plugins']; $updates->translations = $response['translations']; $updates->no_update = $response['no_update']; } foreach ( $plugins as $plugin_file => $plugin_data ) { if ( ! $plugin_data['UpdateURI'] || isset( $updates->response[ $plugin_file ] ) ) { continue; } $hostname = wp_parse_url( esc_url_raw( $plugin_data['UpdateURI'] ), PHP_URL_HOST ); $update = apply_filters( "update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales ); if ( ! $update ) { continue; } $update = (object) $update; if ( ! isset( $update->version ) ) { continue; } $update->id = $plugin_data['UpdateURI']; $update->plugin = $plugin_file; if ( ! isset( $update->new_version ) ) { $update->new_version = $update->version; } if ( ! empty( $update->translations ) ) { foreach ( $update->translations as $translation ) { if ( isset( $translation['language'], $translation['package'] ) ) { $translation['type'] = 'plugin'; $translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id; $updates->translations[] = $translation; } } } unset( $updates->no_update[ $plugin_file ], $updates->response[ $plugin_file ] ); if ( version_compare( $update->new_version, $plugin_data['Version'], '>' ) ) { $updates->response[ $plugin_file ] = $update; } else { $updates->no_update[ $plugin_file ] = $update; } } $sanitize_plugin_update_payload = static function( &$item ) { $item = (object) $item; unset( $item->translations, $item->compatibility ); return $item; }; array_walk( $updates->response, $sanitize_plugin_update_payload ); array_walk( $updates->no_update, $sanitize_plugin_update_payload ); set_site_transient( 'update_plugins', $updates ); } function wp_update_themes( $extra_stats = array() ) { if ( wp_installing() ) { return; } require ABSPATH . WPINC . '/version.php'; $installed_themes = wp_get_themes(); $translations = wp_get_installed_translations( 'themes' ); $last_update = get_site_transient( 'update_themes' ); if ( ! is_object( $last_update ) ) { $last_update = new stdClass; } $themes = array(); $checked = array(); $request = array(); $request['active'] = get_option( 'stylesheet' ); foreach ( $installed_themes as $theme ) { $checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' ); $themes[ $theme->get_stylesheet() ] = array( 'Name' => $theme->get( 'Name' ), 'Title' => $theme->get( 'Name' ), 'Version' => $theme->get( 'Version' ), 'Author' => $theme->get( 'Author' ), 'Author URI' => $theme->get( 'AuthorURI' ), 'Template' => $theme->get_template(), 'Stylesheet' => $theme->get_stylesheet(), ); } $doing_cron = wp_doing_cron(); switch ( current_filter() ) { case 'upgrader_process_complete': $timeout = 0; break; case 'load-update-core.php': $timeout = MINUTE_IN_SECONDS; break; case 'load-themes.php': case 'load-update.php': $timeout = HOUR_IN_SECONDS; break; default: if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $theme_changed = false; foreach ( $checked as $slug => $v ) { if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) { $theme_changed = true; } } if ( isset( $last_update->response ) && is_array( $last_update->response ) ) { foreach ( $last_update->response as $slug => $update_details ) { if ( ! isset( $checked[ $slug ] ) ) { $theme_changed = true; break; } } } if ( ! $theme_changed ) { return; } } $last_update->last_checked = time(); set_site_transient( 'update_themes', $last_update ); $request['themes'] = $themes; $locales = array_values( get_available_languages() ); $locales = apply_filters( 'themes_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { $timeout = 3 + (int) ( count( $themes ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'themes' => wp_json_encode( $request ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = 'http://api.wordpress.org/themes/update-check/1.1/'; $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) { return; } $new_update = new stdClass; $new_update->last_checked = time(); $new_update->checked = $checked; $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); if ( is_array( $response ) ) { $new_update->response = $response['themes']; $new_update->no_update = $response['no_update']; $new_update->translations = $response['translations']; } set_site_transient( 'update_themes', $new_update ); } function wp_maybe_auto_update() { include_once ABSPATH . 'wp-admin/includes/admin.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new WP_Automatic_Updater; $upgrader->run(); } function wp_get_translation_updates() { $updates = array(); $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme', ); foreach ( $transients as $transient => $type ) { $transient = get_site_transient( $transient ); if ( empty( $transient->translations ) ) { continue; } foreach ( $transient->translations as $translation ) { $updates[] = (object) $translation; } } return $updates; } function wp_get_update_data() { $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0, ); $plugins = current_user_can( 'update_plugins' ); if ( $plugins ) { $update_plugins = get_site_transient( 'update_plugins' ); if ( ! empty( $update_plugins->response ) ) { $counts['plugins'] = count( $update_plugins->response ); } } $themes = current_user_can( 'update_themes' ); if ( $themes ) { $update_themes = get_site_transient( 'update_themes' ); if ( ! empty( $update_themes->response ) ) { $counts['themes'] = count( $update_themes->response ); } } $core = current_user_can( 'update_core' ); if ( $core && function_exists( 'get_core_updates' ) ) { $update_wordpress = get_core_updates( array( 'dismissed' => false ) ); if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ), true ) && current_user_can( 'update_core' ) ) { $counts['wordpress'] = 1; } } if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) { $counts['translations'] = 1; } $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations']; $titles = array(); if ( $counts['wordpress'] ) { $titles['wordpress'] = sprintf( __( '%d WordPress Update' ), $counts['wordpress'] ); } if ( $counts['plugins'] ) { $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] ); } if ( $counts['themes'] ) { $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); } if ( $counts['translations'] ) { $titles['translations'] = __( 'Translation Updates' ); } $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : ''; $update_data = array( 'counts' => $counts, 'title' => $update_title, ); return apply_filters( 'wp_get_update_data', $update_data, $titles ); } function _maybe_update_core() { require ABSPATH . WPINC . '/version.php'; $current = get_site_transient( 'update_core' ); if ( isset( $current->last_checked, $current->version_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) && $current->version_checked === $wp_version ) { return; } wp_version_check(); } function _maybe_update_plugins() { $current = get_site_transient( 'update_plugins' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) { return; } wp_update_plugins(); } function _maybe_update_themes() { $current = get_site_transient( 'update_themes' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) { return; } wp_update_themes(); } function wp_schedule_update_checks() { if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_version_check' ); } if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_plugins' ); } if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_themes' ); } } function wp_clean_update_cache() { if ( function_exists( 'wp_clean_plugins_cache' ) ) { wp_clean_plugins_cache(); } else { delete_site_transient( 'update_plugins' ); } wp_clean_themes_cache(); delete_site_transient( 'update_core' ); } if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) { return; } add_action( 'admin_init', '_maybe_update_core' ); add_action( 'wp_version_check', 'wp_version_check' ); add_action( 'load-plugins.php', 'wp_update_plugins' ); add_action( 'load-update.php', 'wp_update_plugins' ); add_action( 'load-update-core.php', 'wp_update_plugins' ); add_action( 'admin_init', '_maybe_update_plugins' ); add_action( 'wp_update_plugins', 'wp_update_plugins' ); add_action( 'load-themes.php', 'wp_update_themes' ); add_action( 'load-update.php', 'wp_update_themes' ); add_action( 'load-update-core.php', 'wp_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' ); add_action( 'update_option_WPLANG', 'wp_clean_update_cache', 10, 0 ); add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' ); add_action( 'init', 'wp_schedule_update_checks' ); '', 'REQUEST_URI' => '', ); $_SERVER = array_merge( $default_server_values, $_SERVER ); if ( empty( $_SERVER['REQUEST_URI'] ) || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } else { if ( ! isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) ) { $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; } if ( isset( $_SERVER['PATH_INFO'] ) ) { if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) { $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; } else { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; } } if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } } if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) { $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; } if ( isset( $_SERVER['SCRIPT_NAME'] ) && ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) ) { unset( $_SERVER['PATH_INFO'] ); } $PHP_SELF = $_SERVER['PHP_SELF']; if ( empty( $PHP_SELF ) ) { $_SERVER['PHP_SELF'] = preg_replace( '/(\?.*)?$/', '', $_SERVER['REQUEST_URI'] ); $PHP_SELF = $_SERVER['PHP_SELF']; } wp_populate_basic_auth_from_authorization_header(); } function wp_populate_basic_auth_from_authorization_header() { if ( ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) && ! isset( $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] ) ) { return; } if ( isset( $_SERVER['PHP_AUTH_USER'] ) || isset( $_SERVER['PHP_AUTH_PW'] ) ) { return; } $header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; if ( ! preg_match( '%^Basic [a-z\d/+]*={0,2}$%i', $header ) ) { return; } $token = substr( $header, 6 ); $userpass = base64_decode( $token ); list( $user, $pass ) = explode( ':', $userpass ); $_SERVER['PHP_AUTH_USER'] = $user; $_SERVER['PHP_AUTH_PW'] = $pass; } function wp_check_php_mysql_versions() { global $required_php_version, $wp_version; $php_version = phpversion(); if ( version_compare( $required_php_version, $php_version, '>' ) ) { $protocol = wp_get_server_protocol(); header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); header( 'Content-Type: text/html; charset=utf-8' ); printf( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version ); exit( 1 ); } if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) || ! file_exists( ABSPATH . 'wp-content/db.php' ) ) ) { require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early(); $args = array( 'exit' => false, 'code' => 'mysql_not_found', ); wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ), __( 'Requirements Not Met' ), $args ); exit( 1 ); } } function wp_get_environment_type() { static $current_env = ''; if ( ! defined( 'WP_RUN_CORE_TESTS' ) && $current_env ) { return $current_env; } $wp_environments = array( 'local', 'development', 'staging', 'production', ); if ( defined( 'WP_ENVIRONMENT_TYPES' ) && function_exists( '_deprecated_argument' ) ) { if ( function_exists( '__' ) ) { $message = sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' ); } else { $message = sprintf( 'The %s constant is no longer supported.', 'WP_ENVIRONMENT_TYPES' ); } _deprecated_argument( 'define()', '5.5.1', $message ); } if ( function_exists( 'getenv' ) ) { $has_env = getenv( 'WP_ENVIRONMENT_TYPE' ); if ( false !== $has_env ) { $current_env = $has_env; } } if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) { $current_env = WP_ENVIRONMENT_TYPE; } if ( ! in_array( $current_env, $wp_environments, true ) ) { $current_env = 'production'; } return $current_env; } function wp_favicon_request() { if ( '/favicon.ico' === $_SERVER['REQUEST_URI'] ) { header( 'Content-Type: image/vnd.microsoft.icon' ); exit; } } function wp_maintenance() { if ( ! wp_is_maintenance_mode() ) { return; } if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { require_once WP_CONTENT_DIR . '/maintenance.php'; die(); } require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early(); header( 'Retry-After: 600' ); wp_die( __( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ), __( 'Maintenance' ), 503 ); } function wp_is_maintenance_mode() { global $upgrading; if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) { return false; } require ABSPATH . '.maintenance'; if ( ( time() - $upgrading ) >= 10 * MINUTE_IN_SECONDS ) { return false; } if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) { return false; } return true; } function timer_float() { return microtime( true ) - $_SERVER['REQUEST_TIME_FLOAT']; } function timer_start() { global $timestart; $timestart = microtime( true ); return true; } function timer_stop( $display = 0, $precision = 3 ) { global $timestart, $timeend; $timeend = microtime( true ); $timetotal = $timeend - $timestart; $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); if ( $display ) { echo $r; } return $r; } function wp_debug_mode() { if ( ! apply_filters( 'enable_wp_debug_mode_checks', true ) ) { return; } if ( WP_DEBUG ) { error_reporting( E_ALL ); if ( WP_DEBUG_DISPLAY ) { ini_set( 'display_errors', 1 ); } elseif ( null !== WP_DEBUG_DISPLAY ) { ini_set( 'display_errors', 0 ); } if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) { $log_path = WP_CONTENT_DIR . '/debug.log'; } elseif ( is_string( WP_DEBUG_LOG ) ) { $log_path = WP_DEBUG_LOG; } else { $log_path = false; } if ( $log_path ) { ini_set( 'log_errors', 1 ); ini_set( 'error_log', $log_path ); } } else { error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); } if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() || wp_is_json_request() ) { ini_set( 'display_errors', 0 ); } } function wp_set_lang_dir() { if ( ! defined( 'WP_LANG_DIR' ) ) { if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || ! @is_dir( ABSPATH . WPINC . '/languages' ) ) { define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); if ( ! defined( 'LANGDIR' ) ) { define( 'LANGDIR', 'wp-content/languages' ); } } else { define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); if ( ! defined( 'LANGDIR' ) ) { define( 'LANGDIR', WPINC . '/languages' ); } } } } function require_wp_db() { global $wpdb; require_once ABSPATH . WPINC . '/wp-db.php'; if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) { require_once WP_CONTENT_DIR . '/db.php'; } if ( isset( $wpdb ) ) { return; } $dbuser = defined( 'DB_USER' ) ? DB_USER : ''; $dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : ''; $dbname = defined( 'DB_NAME' ) ? DB_NAME : ''; $dbhost = defined( 'DB_HOST' ) ? DB_HOST : ''; $wpdb = new wpdb( $dbuser, $dbpassword, $dbname, $dbhost ); } function wp_set_wpdb_vars() { global $wpdb, $table_prefix; if ( ! empty( $wpdb->error ) ) { dead_db(); } $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 'parent' => '%d', 'count' => '%d', 'object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', ); $prefix = $wpdb->set_prefix( $table_prefix ); if ( is_wp_error( $prefix ) ) { wp_load_translations_early(); wp_die( sprintf( __( 'Error: %1$s in %2$s can only contain numbers, letters, and underscores.' ), '$table_prefix', 'wp-config.php' ) ); } } function wp_using_ext_object_cache( $using = null ) { global $_wp_using_ext_object_cache; $current_using = $_wp_using_ext_object_cache; if ( null !== $using ) { $_wp_using_ext_object_cache = $using; } return $current_using; } function wp_start_object_cache() { global $wp_filter; static $first_init = true; if ( $first_init && apply_filters( 'enable_loading_object_cache_dropin', true ) ) { if ( ! function_exists( 'wp_cache_init' ) ) { if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { require_once WP_CONTENT_DIR . '/object-cache.php'; if ( function_exists( 'wp_cache_init' ) ) { wp_using_ext_object_cache( true ); } if ( $wp_filter ) { $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter ); } } } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { wp_using_ext_object_cache( true ); } } if ( ! wp_using_ext_object_cache() ) { require_once ABSPATH . WPINC . '/cache.php'; } require_once ABSPATH . WPINC . '/cache-compat.php'; if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( get_current_blog_id() ); } elseif ( function_exists( 'wp_cache_init' ) ) { wp_cache_init(); } if ( function_exists( 'wp_cache_add_global_groups' ) ) { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta' ) ); wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } $first_init = false; } function wp_not_installed() { if ( is_multisite() ) { if ( ! is_blog_installed() && ! wp_installing() ) { nocache_headers(); wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); } } elseif ( ! is_blog_installed() && ! wp_installing() ) { nocache_headers(); require ABSPATH . WPINC . '/kses.php'; require ABSPATH . WPINC . '/pluggable.php'; $link = wp_guess_url() . '/wp-admin/install.php'; wp_redirect( $link ); die(); } } function wp_get_mu_plugins() { $mu_plugins = array(); if ( ! is_dir( WPMU_PLUGIN_DIR ) ) { return $mu_plugins; } $dh = opendir( WPMU_PLUGIN_DIR ); if ( ! $dh ) { return $mu_plugins; } while ( ( $plugin = readdir( $dh ) ) !== false ) { if ( '.php' === substr( $plugin, -4 ) ) { $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; } } closedir( $dh ); sort( $mu_plugins ); return $mu_plugins; } function wp_get_active_and_valid_plugins() { $plugins = array(); $active_plugins = (array) get_option( 'active_plugins', array() ); if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { _deprecated_file( 'my-hacks.php', '1.5.0' ); array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); } if ( empty( $active_plugins ) || wp_installing() ) { return $plugins; } $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; foreach ( $active_plugins as $plugin ) { if ( ! validate_file( $plugin ) && '.php' === substr( $plugin, -4 ) && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins, true ) ) ) { $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } } if ( wp_is_recovery_mode() ) { $plugins = wp_skip_paused_plugins( $plugins ); } return $plugins; } function wp_skip_paused_plugins( array $plugins ) { $paused_plugins = wp_paused_plugins()->get_all(); if ( empty( $paused_plugins ) ) { return $plugins; } foreach ( $plugins as $index => $plugin ) { list( $plugin ) = explode( '/', plugin_basename( $plugin ) ); if ( array_key_exists( $plugin, $paused_plugins ) ) { unset( $plugins[ $index ] ); $GLOBALS['_paused_plugins'][ $plugin ] = $paused_plugins[ $plugin ]; } } return $plugins; } function wp_get_active_and_valid_themes() { global $pagenow; $themes = array(); if ( wp_installing() && 'wp-activate.php' !== $pagenow ) { return $themes; } if ( TEMPLATEPATH !== STYLESHEETPATH ) { $themes[] = STYLESHEETPATH; } $themes[] = TEMPLATEPATH; if ( wp_is_recovery_mode() ) { $themes = wp_skip_paused_themes( $themes ); if ( empty( $themes ) ) { add_filter( 'wp_using_themes', '__return_false' ); } } return $themes; } function wp_skip_paused_themes( array $themes ) { $paused_themes = wp_paused_themes()->get_all(); if ( empty( $paused_themes ) ) { return $themes; } foreach ( $themes as $index => $theme ) { $theme = basename( $theme ); if ( array_key_exists( $theme, $paused_themes ) ) { unset( $themes[ $index ] ); $GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ]; } } return $themes; } function wp_is_recovery_mode() { return wp_recovery_mode()->is_active(); } function is_protected_endpoint() { if ( isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { return true; } if ( is_admin() && ! wp_doing_ajax() ) { return true; } if ( is_protected_ajax_action() ) { return true; } return (bool) apply_filters( 'is_protected_endpoint', false ); } function is_protected_ajax_action() { if ( ! wp_doing_ajax() ) { return false; } if ( ! isset( $_REQUEST['action'] ) ) { return false; } $actions_to_protect = array( 'edit-theme-plugin-file', 'heartbeat', 'install-plugin', 'install-theme', 'search-plugins', 'search-install-plugins', 'update-plugin', 'update-theme', ); $actions_to_protect = (array) apply_filters( 'wp_protected_ajax_actions', $actions_to_protect ); if ( ! in_array( $_REQUEST['action'], $actions_to_protect, true ) ) { return false; } return true; } function wp_set_internal_encoding() { if ( function_exists( 'mb_internal_encoding' ) ) { $charset = get_option( 'blog_charset' ); if ( ! $charset || ! @mb_internal_encoding( $charset ) ) { mb_internal_encoding( 'UTF-8' ); } } } function wp_magic_quotes() { $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER ); $_REQUEST = array_merge( $_GET, $_POST ); } function shutdown_action_hook() { do_action( 'shutdown' ); wp_cache_close(); } function wp_clone( $object ) { return clone( $object ); } function is_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin(); } elseif ( defined( 'WP_ADMIN' ) ) { return WP_ADMIN; } return false; } function is_blog_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'site' ); } elseif ( defined( 'WP_BLOG_ADMIN' ) ) { return WP_BLOG_ADMIN; } return false; } function is_network_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'network' ); } elseif ( defined( 'WP_NETWORK_ADMIN' ) ) { return WP_NETWORK_ADMIN; } return false; } function is_user_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'user' ); } elseif ( defined( 'WP_USER_ADMIN' ) ) { return WP_USER_ADMIN; } return false; } function is_multisite() { if ( defined( 'MULTISITE' ) ) { return MULTISITE; } if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) { return true; } return false; } function get_current_blog_id() { global $blog_id; return absint( $blog_id ); } function get_current_network_id() { if ( ! is_multisite() ) { return 1; } $current_network = get_network(); if ( ! isset( $current_network->id ) ) { return get_main_network_id(); } return absint( $current_network->id ); } function wp_load_translations_early() { global $wp_locale; static $loaded = false; if ( $loaded ) { return; } $loaded = true; if ( function_exists( 'did_action' ) && did_action( 'init' ) ) { return; } require ABSPATH . WPINC . '/version.php'; require_once ABSPATH . WPINC . '/pomo/mo.php'; require_once ABSPATH . WPINC . '/l10n.php'; require_once ABSPATH . WPINC . '/class-wp-locale.php'; require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php'; require_once ABSPATH . WPINC . '/plugin.php'; $locales = array(); $locations = array(); while ( true ) { if ( defined( 'WPLANG' ) ) { if ( '' === WPLANG ) { break; } $locales[] = WPLANG; } if ( isset( $wp_local_package ) ) { $locales[] = $wp_local_package; } if ( ! $locales ) { break; } if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) ) { $locations[] = WP_LANG_DIR; } if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) { $locations[] = WP_CONTENT_DIR . '/languages'; } if ( @is_dir( ABSPATH . 'wp-content/languages' ) ) { $locations[] = ABSPATH . 'wp-content/languages'; } if ( @is_dir( ABSPATH . WPINC . '/languages' ) ) { $locations[] = ABSPATH . WPINC . '/languages'; } if ( ! $locations ) { break; } $locations = array_unique( $locations ); foreach ( $locales as $locale ) { foreach ( $locations as $location ) { if ( file_exists( $location . '/' . $locale . '.mo' ) ) { load_textdomain( 'default', $location . '/' . $locale . '.mo' ); if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) { load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' ); } break 2; } } } break; } $wp_locale = new WP_Locale(); } function wp_installing( $is_installing = null ) { static $installing = null; if ( is_null( $installing ) ) { $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING; } if ( ! is_null( $is_installing ) ) { $old_installing = $installing; $installing = $is_installing; return (bool) $old_installing; } return (bool) $installing; } function is_ssl() { if ( isset( $_SERVER['HTTPS'] ) ) { if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) { return true; } if ( '1' == $_SERVER['HTTPS'] ) { return true; } } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { return true; } return false; } function wp_convert_hr_to_bytes( $value ) { $value = strtolower( trim( $value ) ); $bytes = (int) $value; if ( false !== strpos( $value, 'g' ) ) { $bytes *= GB_IN_BYTES; } elseif ( false !== strpos( $value, 'm' ) ) { $bytes *= MB_IN_BYTES; } elseif ( false !== strpos( $value, 'k' ) ) { $bytes *= KB_IN_BYTES; } return min( $bytes, PHP_INT_MAX ); } function wp_is_ini_value_changeable( $setting ) { static $ini_all; if ( ! isset( $ini_all ) ) { $ini_all = false; if ( function_exists( 'ini_get_all' ) ) { $ini_all = ini_get_all(); } } if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) { return true; } if ( ! is_array( $ini_all ) ) { return true; } return false; } function wp_doing_ajax() { return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ); } function wp_using_themes() { return apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ); } function wp_doing_cron() { return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON ); } function is_wp_error( $thing ) { $is_wp_error = ( $thing instanceof WP_Error ); if ( $is_wp_error ) { do_action( 'is_wp_error_instance', $thing ); } return $is_wp_error; } function wp_is_file_mod_allowed( $context ) { return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context ); } function wp_start_scraping_edited_file_errors() { if ( ! isset( $_REQUEST['wp_scrape_key'] ) || ! isset( $_REQUEST['wp_scrape_nonce'] ) ) { return; } $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) { echo "###### wp_scraping_result_start:$key ######"; echo wp_json_encode( array( 'code' => 'scrape_nonce_failure', 'message' => __( 'Scrape key check failed. Please try again.' ), ) ); echo "###### wp_scraping_result_end:$key ######"; die(); } if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); } function wp_finalize_scraping_edited_file_errors( $scrape_key ) { $error = error_get_last(); echo "\n###### wp_scraping_result_start:$scrape_key ######\n"; if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) { $error = str_replace( ABSPATH, '', $error ); echo wp_json_encode( $error ); } else { echo wp_json_encode( true ); } echo "\n###### wp_scraping_result_end:$scrape_key ######\n"; } function wp_is_json_request() { if ( isset( $_SERVER['HTTP_ACCEPT'] ) && wp_is_json_media_type( $_SERVER['HTTP_ACCEPT'] ) ) { return true; } if ( isset( $_SERVER['CONTENT_TYPE'] ) && wp_is_json_media_type( $_SERVER['CONTENT_TYPE'] ) ) { return true; } return false; } function wp_is_jsonp_request() { if ( ! isset( $_GET['_jsonp'] ) ) { return false; } if ( ! function_exists( 'wp_check_jsonp_callback' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } $jsonp_callback = $_GET['_jsonp']; if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) { return false; } $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true ); return $jsonp_enabled; } function wp_is_json_media_type( $media_type ) { static $cache = array(); if ( ! isset( $cache[ $media_type ] ) ) { $cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type ); } return $cache[ $media_type ]; } function wp_is_xml_request() { $accepted = array( 'text/xml', 'application/rss+xml', 'application/atom+xml', 'application/rdf+xml', 'text/xml+oembed', 'application/xml+oembed', ); if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) { foreach ( $accepted as $type ) { if ( false !== strpos( $_SERVER['HTTP_ACCEPT'], $type ) ) { return true; } } } if ( isset( $_SERVER['CONTENT_TYPE'] ) && in_array( $_SERVER['CONTENT_TYPE'], $accepted, true ) ) { return true; } return false; } function wp_is_site_protected_by_basic_auth( $context = '' ) { global $pagenow; if ( ! $context ) { if ( 'wp-login.php' === $pagenow ) { $context = 'login'; } elseif ( is_admin() ) { $context = 'admin'; } else { $context = 'front'; } } $is_protected = ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW'] ); return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context ); } generate_cookie(); $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); $expire = time() + $length; setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); if ( COOKIEPATH !== SITECOOKIEPATH ) { setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); } } public function clear_cookie() { setcookie( RECOVERY_MODE_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( RECOVERY_MODE_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); } public function validate_cookie( $cookie = '' ) { if ( ! $cookie ) { if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) { return new WP_Error( 'no_cookie', __( 'No cookie present.' ) ); } $cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ]; } $parts = $this->parse_cookie( $cookie ); if ( is_wp_error( $parts ) ) { return $parts; } list( , $created_at, $random, $signature ) = $parts; if ( ! ctype_digit( $created_at ) ) { return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) ); } $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); if ( time() > $created_at + $length ) { return new WP_Error( 'expired', __( 'Cookie expired.' ) ); } $to_sign = sprintf( 'recovery_mode|%s|%s', $created_at, $random ); $hashed = $this->recovery_mode_hash( $to_sign ); if ( ! hash_equals( $signature, $hashed ) ) { return new WP_Error( 'signature_mismatch', __( 'Invalid cookie.' ) ); } return true; } public function get_session_id_from_cookie( $cookie = '' ) { if ( ! $cookie ) { if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) { return new WP_Error( 'no_cookie', __( 'No cookie present.' ) ); } $cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ]; } $parts = $this->parse_cookie( $cookie ); if ( is_wp_error( $parts ) ) { return $parts; } list( , , $random ) = $parts; return sha1( $random ); } private function parse_cookie( $cookie ) { $cookie = base64_decode( $cookie ); $parts = explode( '|', $cookie ); if ( 4 !== count( $parts ) ) { return new WP_Error( 'invalid_format', __( 'Invalid cookie format.' ) ); } return $parts; } private function generate_cookie() { $to_sign = sprintf( 'recovery_mode|%s|%s', time(), wp_generate_password( 20, false ) ); $signed = $this->recovery_mode_hash( $to_sign ); return base64_encode( sprintf( '%s|%s', $to_sign, $signed ) ); } private function recovery_mode_hash( $data ) { if ( ! defined( 'AUTH_KEY' ) || AUTH_KEY === 'put your unique phrase here' ) { $auth_key = get_site_option( 'recovery_mode_auth_key' ); if ( ! $auth_key ) { if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $auth_key = wp_generate_password( 64, true, true ); update_site_option( 'recovery_mode_auth_key', $auth_key ); } } else { $auth_key = AUTH_KEY; } if ( ! defined( 'AUTH_SALT' ) || AUTH_SALT === 'put your unique phrase here' || AUTH_SALT === $auth_key ) { $auth_salt = get_site_option( 'recovery_mode_auth_salt' ); if ( ! $auth_salt ) { if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $auth_salt = wp_generate_password( 64, true, true ); update_site_option( 'recovery_mode_auth_salt', $auth_salt ); } } else { $auth_salt = AUTH_SALT; } $secret = $auth_key . $auth_salt; return hash_hmac( 'sha1', $data, $secret ); } } ! has_blocks(), 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, '_content_editor_dfw' => false, 'tinymce' => true, 'quicktags' => true, ) ); self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() ); if ( self::$this_tinymce ) { if ( false !== strpos( $editor_id, '[' ) ) { self::$this_tinymce = false; _deprecated_argument( 'wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.' ); } } self::$this_quicktags = (bool) $set['quicktags']; if ( self::$this_tinymce ) { self::$has_tinymce = true; } if ( self::$this_quicktags ) { self::$has_quicktags = true; } if ( empty( $set['editor_height'] ) ) { return $set; } if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) { $cookie = (int) get_user_setting( 'ed_size' ); if ( $cookie ) { $set['editor_height'] = $cookie; } } if ( $set['editor_height'] < 50 ) { $set['editor_height'] = 50; } elseif ( $set['editor_height'] > 5000 ) { $set['editor_height'] = 5000; } return $set; } public static function editor( $content, $editor_id, $settings = array() ) { $set = self::parse_settings( $editor_id, $settings ); $editor_class = ' class="' . trim( esc_attr( $set['editor_class'] ) . ' wp-editor-area' ) . '"'; $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; $default_editor = 'html'; $buttons = ''; $autocomplete = ''; $editor_id_attr = esc_attr( $editor_id ); if ( $set['drag_drop_upload'] ) { self::$drag_drop_upload = true; } if ( ! empty( $set['editor_height'] ) ) { $height = ' style="height: ' . (int) $set['editor_height'] . 'px"'; } else { $height = ' rows="' . (int) $set['textarea_rows'] . '"'; } if ( ! current_user_can( 'upload_files' ) ) { $set['media_buttons'] = false; } if ( self::$this_tinymce ) { $autocomplete = ' autocomplete="off"'; if ( self::$this_quicktags ) { $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor(); if ( 'html' !== $default_editor ) { $default_editor = 'tinymce'; } $buttons .= '\n"; $buttons .= '\n"; } else { $default_editor = 'tinymce'; } } $switch_class = 'html' === $default_editor ? 'html-active' : 'tmce-active'; $wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class; if ( $set['_content_editor_dfw'] ) { $wrap_class .= ' has-dfw'; } echo '
      '; if ( self::$editor_buttons_css ) { wp_print_styles( 'editor-buttons' ); self::$editor_buttons_css = false; } if ( ! empty( $set['editor_css'] ) ) { echo $set['editor_css'] . "\n"; } if ( ! empty( $buttons ) || $set['media_buttons'] ) { echo '
      '; if ( $set['media_buttons'] ) { self::$has_medialib = true; if ( ! function_exists( 'media_buttons' ) ) { require ABSPATH . 'wp-admin/includes/media.php'; } echo '
      '; do_action( 'media_buttons', $editor_id ); echo "
      \n"; } echo '
      ' . $buttons . "
      \n"; echo "
      \n"; } $quicktags_toolbar = ''; if ( self::$this_quicktags ) { if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && 'post' === $GLOBALS['current_screen']->base ) { $toolbar_id = 'ed_toolbar'; } else { $toolbar_id = 'qt_' . $editor_id_attr . '_toolbar'; } $quicktags_toolbar = '
      '; } $the_editor = apply_filters( 'the_editor', '
      ' . $quicktags_toolbar . '%s
      ' ); if ( self::$this_tinymce ) { add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); } $content = apply_filters( 'the_editor_content', $content, $default_editor ); if ( self::$this_tinymce ) { remove_filter( 'the_editor_content', 'format_for_editor' ); } if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) { $content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' ); } elseif ( 'tinymce' === $default_editor && has_filter( 'richedit_pre' ) ) { $content = apply_filters_deprecated( 'richedit_pre', array( $content ), '4.3.0', 'format_for_editor' ); } if ( false !== stripos( $content, 'textarea' ) ) { $content = preg_replace( '%\n\n"; self::editor_settings( $editor_id, $set ); } public static function editor_settings( $editor_id, $set ) { if ( empty( self::$first_init ) ) { if ( is_admin() ) { add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); } else { add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); } } if ( self::$this_quicktags ) { $qtInit = array( 'id' => $editor_id, 'buttons' => '', ); if ( is_array( $set['quicktags'] ) ) { $qtInit = array_merge( $qtInit, $set['quicktags'] ); } if ( empty( $qtInit['buttons'] ) ) { $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close'; } if ( $set['_content_editor_dfw'] ) { $qtInit['buttons'] .= ',dfw'; } $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id ); self::$qt_settings[ $editor_id ] = $qtInit; self::$qt_buttons = array_merge( self::$qt_buttons, explode( ',', $qtInit['buttons'] ) ); } if ( self::$this_tinymce ) { if ( empty( self::$first_init ) ) { $baseurl = self::get_baseurl(); $mce_locale = self::get_mce_locale(); $ext_plugins = ''; if ( $set['teeny'] ) { $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink', ), $editor_id ); } else { $mce_external_plugins = apply_filters( 'mce_external_plugins', array(), $editor_id ); $plugins = array( 'charmap', 'colorpicker', 'hr', 'lists', 'media', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wpdialogs', 'wptextpattern', 'wpview', ); if ( ! self::$has_medialib ) { $plugins[] = 'image'; } $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins, $editor_id ) ); $key = array_search( 'spellchecker', $plugins, true ); if ( false !== $key ) { unset( $plugins[ $key ] ); } if ( ! empty( $mce_external_plugins ) ) { $mce_external_languages = apply_filters( 'mce_external_languages', array(), $editor_id ); $loaded_langs = array(); $strings = ''; if ( ! empty( $mce_external_languages ) ) { foreach ( $mce_external_languages as $name => $path ) { if ( @is_file( $path ) && @is_readable( $path ) ) { include_once $path; $ext_plugins .= $strings . "\n"; $loaded_langs[] = $name; } } } foreach ( $mce_external_plugins as $name => $url ) { if ( in_array( $name, $plugins, true ) ) { unset( $mce_external_plugins[ $name ] ); continue; } $url = set_url_scheme( $url ); $mce_external_plugins[ $name ] = $url; $plugurl = dirname( $url ); $strings = ''; if ( ! in_array( $name, $loaded_langs, true ) ) { $path = str_replace( content_url(), '', $plugurl ); $path = WP_CONTENT_DIR . $path . '/langs/'; $path = trailingslashit( realpath( $path ) ); if ( @is_file( $path . $mce_locale . '.js' ) ) { $strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n"; } if ( @is_file( $path . $mce_locale . '_dlg.js' ) ) { $strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n"; } if ( 'en' !== $mce_locale && empty( $strings ) ) { if ( @is_file( $path . 'en.js' ) ) { $str1 = @file_get_contents( $path . 'en.js' ); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n"; } if ( @is_file( $path . 'en_dlg.js' ) ) { $str2 = @file_get_contents( $path . 'en_dlg.js' ); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n"; } } if ( ! empty( $strings ) ) { $ext_plugins .= "\n" . $strings . "\n"; } } $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; } } } self::$plugins = $plugins; self::$ext_plugins = $ext_plugins; $settings = self::default_settings(); $settings['plugins'] = implode( ',', $plugins ); if ( ! empty( $mce_external_plugins ) ) { $settings['external_plugins'] = wp_json_encode( $mce_external_plugins ); } if ( apply_filters( 'disable_captions', '' ) ) { $settings['wpeditimage_disable_captions'] = true; } $mce_css = $settings['content_css']; if ( is_admin() ) { $editor_styles = get_editor_stylesheets(); if ( ! empty( $editor_styles ) ) { foreach ( $editor_styles as $key => $url ) { if ( strpos( $url, ',' ) !== false ) { $editor_styles[ $key ] = str_replace( ',', '%2C', $url ); } } $mce_css .= ',' . implode( ',', $editor_styles ); } } $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); if ( ! empty( $mce_css ) ) { $settings['content_css'] = $mce_css; } else { unset( $settings['content_css'] ); } self::$first_init = $settings; } if ( $set['teeny'] ) { $mce_buttons = array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen', ); $mce_buttons = apply_filters( 'teeny_mce_buttons', $mce_buttons, $editor_id ); $mce_buttons_2 = array(); $mce_buttons_3 = array(); $mce_buttons_4 = array(); } else { $mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker', ); if ( ! wp_is_mobile() ) { if ( $set['_content_editor_dfw'] ) { $mce_buttons[] = 'wp_adv'; $mce_buttons[] = 'dfw'; } else { $mce_buttons[] = 'fullscreen'; $mce_buttons[] = 'wp_adv'; } } else { $mce_buttons[] = 'wp_adv'; } $mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id ); $mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', ); if ( ! wp_is_mobile() ) { $mce_buttons_2[] = 'wp_help'; } $mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id ); $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id ); $mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id ); } $body_class = $editor_id; $post = get_post(); if ( $post ) { $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status ); if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post ); if ( $post_format && ! is_wp_error( $post_format ) ) { $body_class .= ' post-format-' . sanitize_html_class( $post_format ); } else { $body_class .= ' post-format-standard'; } } $page_template = get_page_template_slug( $post ); if ( false !== $page_template ) { $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) ); $body_class .= ' page-template-' . sanitize_html_class( $page_template ); } } $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); if ( ! empty( $set['tinymce']['body_class'] ) ) { $body_class .= ' ' . $set['tinymce']['body_class']; unset( $set['tinymce']['body_class'] ); } $mceInit = array( 'selector' => "#$editor_id", 'wpautop' => (bool) $set['wpautop'], 'indent' => ! $set['wpautop'], 'toolbar1' => implode( ',', $mce_buttons ), 'toolbar2' => implode( ',', $mce_buttons_2 ), 'toolbar3' => implode( ',', $mce_buttons_3 ), 'toolbar4' => implode( ',', $mce_buttons_4 ), 'tabfocus_elements' => $set['tabfocus_elements'], 'body_class' => $body_class, ); $mceInit = array_merge( self::$first_init, $mceInit ); if ( is_array( $set['tinymce'] ) ) { $mceInit = array_merge( $mceInit, $set['tinymce'] ); } if ( $set['teeny'] ) { $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id ); } else { $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id ); } if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) { $mceInit['toolbar3'] = $mceInit['toolbar4']; $mceInit['toolbar4'] = ''; } self::$mce_settings[ $editor_id ] = $mceInit; } } private static function _parse_init( $init ) { $options = ''; foreach ( $init as $key => $value ) { if ( is_bool( $value ) ) { $val = $value ? 'true' : 'false'; $options .= $key . ':' . $val . ','; continue; } elseif ( ! empty( $value ) && is_string( $value ) && ( ( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) || ( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) || preg_match( '/^\(?function ?\(/', $value ) ) ) { $options .= $key . ':' . $value . ','; continue; } $options .= $key . ':"' . $value . '",'; } return '{' . trim( $options, ' ,' ) . '}'; } public static function enqueue_scripts( $default_scripts = false ) { if ( $default_scripts || self::$has_tinymce ) { wp_enqueue_script( 'editor' ); } if ( $default_scripts || self::$has_quicktags ) { wp_enqueue_script( 'quicktags' ); wp_enqueue_style( 'buttons' ); } if ( $default_scripts || in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) { wp_enqueue_script( 'wplink' ); wp_enqueue_script( 'jquery-ui-autocomplete' ); } if ( self::$has_medialib ) { add_thickbox(); wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'wp-embed' ); } elseif ( $default_scripts ) { wp_enqueue_script( 'media-upload' ); } do_action( 'wp_enqueue_editor', array( 'tinymce' => ( $default_scripts || self::$has_tinymce ), 'quicktags' => ( $default_scripts || self::$has_quicktags ), ) ); } public static function enqueue_default_editor() { if ( did_action( 'wp_enqueue_editor' ) ) { return; } self::enqueue_scripts( true ); wp_enqueue_style( 'editor-buttons' ); if ( is_admin() ) { add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); } else { add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); } } public static function print_default_editor_scripts() { $user_can_richedit = user_can_richedit(); if ( $user_can_richedit ) { $settings = self::default_settings(); $settings['toolbar1'] = 'bold,italic,bullist,numlist,link'; $settings['wpautop'] = false; $settings['indent'] = true; $settings['elementpath'] = false; if ( is_rtl() ) { $settings['directionality'] = 'rtl'; } $settings['plugins'] = implode( ',', array( 'charmap', 'colorpicker', 'hr', 'lists', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wptextpattern', ) ); $settings = self::_parse_init( $settings ); } else { $settings = '{}'; } ?> + + $value ) { if ( is_array( $value ) ) { $shortcut_labels[ $name ] = $value[1]; } } $settings = array( 'theme' => 'modern', 'skin' => 'lightgray', 'language' => self::get_mce_locale(), 'formats' => '{' . 'alignleft: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},' . '{selector: "img,table,dl.wp-caption", classes: "alignleft"}' . '],' . 'aligncenter: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},' . '{selector: "img,table,dl.wp-caption", classes: "aligncenter"}' . '],' . 'alignright: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},' . '{selector: "img,table,dl.wp-caption", classes: "alignright"}' . '],' . 'strikethrough: {inline: "del"}' . '}', 'relative_urls' => false, 'remove_script_host' => false, 'convert_urls' => false, 'browser_spellcheck' => true, 'fix_list_elements' => true, 'entities' => '38,amp,60,lt,62,gt', 'entity_encoding' => 'raw', 'keep_styles' => false, 'cache_suffix' => 'wp-mce-' . $tinymce_version, 'resize' => 'vertical', 'menubar' => false, 'branding' => false, 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform', 'end_container_on_empty_block' => true, 'wpeditimage_html5_captions' => true, 'wp_lang_attr' => get_bloginfo( 'language' ), 'wp_keep_scroll_position' => false, 'wp_shortcut_labels' => wp_json_encode( $shortcut_labels ), ); $suffix = SCRIPT_DEBUG ? '' : '.min'; $version = 'ver=' . get_bloginfo( 'version' ); $settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' . includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" ); return $settings; } private static function get_translation() { if ( empty( self::$translation ) ) { self::$translation = array( 'New document' => __( 'New document' ), 'Formats' => _x( 'Formats', 'TinyMCE' ), 'Headings' => _x( 'Headings', 'TinyMCE' ), 'Heading 1' => array( __( 'Heading 1' ), 'access1' ), 'Heading 2' => array( __( 'Heading 2' ), 'access2' ), 'Heading 3' => array( __( 'Heading 3' ), 'access3' ), 'Heading 4' => array( __( 'Heading 4' ), 'access4' ), 'Heading 5' => array( __( 'Heading 5' ), 'access5' ), 'Heading 6' => array( __( 'Heading 6' ), 'access6' ), 'Blocks' => _x( 'Blocks', 'TinyMCE' ), 'Paragraph' => array( __( 'Paragraph' ), 'access7' ), 'Blockquote' => array( __( 'Blockquote' ), 'accessQ' ), 'Div' => _x( 'Div', 'HTML tag' ), 'Pre' => _x( 'Pre', 'HTML tag' ), 'Preformatted' => _x( 'Preformatted', 'HTML tag' ), 'Address' => _x( 'Address', 'HTML tag' ), 'Inline' => _x( 'Inline', 'HTML elements' ), 'Underline' => array( __( 'Underline' ), 'metaU' ), 'Strikethrough' => array( __( 'Strikethrough' ), 'accessD' ), 'Subscript' => __( 'Subscript' ), 'Superscript' => __( 'Superscript' ), 'Clear formatting' => __( 'Clear formatting' ), 'Bold' => array( __( 'Bold' ), 'metaB' ), 'Italic' => array( __( 'Italic' ), 'metaI' ), 'Code' => array( __( 'Code' ), 'accessX' ), 'Source code' => __( 'Source code' ), 'Font Family' => __( 'Font Family' ), 'Font Sizes' => __( 'Font Sizes' ), 'Align center' => array( __( 'Align center' ), 'accessC' ), 'Align right' => array( __( 'Align right' ), 'accessR' ), 'Align left' => array( __( 'Align left' ), 'accessL' ), 'Justify' => array( __( 'Justify' ), 'accessJ' ), 'Increase indent' => __( 'Increase indent' ), 'Decrease indent' => __( 'Decrease indent' ), 'Cut' => array( __( 'Cut' ), 'metaX' ), 'Copy' => array( __( 'Copy' ), 'metaC' ), 'Paste' => array( __( 'Paste' ), 'metaV' ), 'Select all' => array( __( 'Select all' ), 'metaA' ), 'Undo' => array( __( 'Undo' ), 'metaZ' ), 'Redo' => array( __( 'Redo' ), 'metaY' ), 'Ok' => __( 'OK' ), 'Cancel' => __( 'Cancel' ), 'Close' => __( 'Close' ), 'Visual aids' => __( 'Visual aids' ), 'Bullet list' => array( __( 'Bulleted list' ), 'accessU' ), 'Numbered list' => array( __( 'Numbered list' ), 'accessO' ), 'Square' => _x( 'Square', 'list style' ), 'Default' => _x( 'Default', 'list style' ), 'Circle' => _x( 'Circle', 'list style' ), 'Disc' => _x( 'Disc', 'list style' ), 'Lower Greek' => _x( 'Lower Greek', 'list style' ), 'Lower Alpha' => _x( 'Lower Alpha', 'list style' ), 'Upper Alpha' => _x( 'Upper Alpha', 'list style' ), 'Upper Roman' => _x( 'Upper Roman', 'list style' ), 'Lower Roman' => _x( 'Lower Roman', 'list style' ), 'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ), 'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ), 'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ), 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' => __( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' ), 'Id' => _x( 'Id', 'Id for link anchor (TinyMCE)' ), 'Document properties' => __( 'Document properties' ), 'Robots' => __( 'Robots' ), 'Title' => __( 'Title' ), 'Keywords' => __( 'Keywords' ), 'Encoding' => __( 'Encoding' ), 'Description' => __( 'Description' ), 'Author' => __( 'Author' ), 'Image' => __( 'Image' ), 'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ), 'General' => __( 'General' ), 'Advanced' => __( 'Advanced' ), 'Source' => __( 'Source' ), 'Border' => __( 'Border' ), 'Constrain proportions' => __( 'Constrain proportions' ), 'Vertical space' => __( 'Vertical space' ), 'Image description' => __( 'Image description' ), 'Style' => __( 'Style' ), 'Dimensions' => __( 'Dimensions' ), 'Insert image' => __( 'Insert image' ), 'Date/time' => __( 'Date/time' ), 'Insert date/time' => __( 'Insert date/time' ), 'Table of Contents' => __( 'Table of Contents' ), 'Insert/Edit code sample' => __( 'Insert/edit code sample' ), 'Language' => __( 'Language' ), 'Media' => __( 'Media' ), 'Insert/edit media' => __( 'Insert/edit media' ), 'Poster' => __( 'Poster' ), 'Alternative source' => __( 'Alternative source' ), 'Paste your embed code below:' => __( 'Paste your embed code below:' ), 'Insert video' => __( 'Insert video' ), 'Embed' => __( 'Embed' ), 'Special character' => __( 'Special character' ), 'Right to left' => _x( 'Right to left', 'editor button' ), 'Left to right' => _x( 'Left to right', 'editor button' ), 'Emoticons' => __( 'Emoticons' ), 'Nonbreaking space' => __( 'Nonbreaking space' ), 'Page break' => __( 'Page break' ), 'Paste as text' => __( 'Paste as text' ), 'Preview' => __( 'Preview' ), 'Print' => __( 'Print' ), 'Save' => __( 'Save' ), 'Fullscreen' => __( 'Fullscreen' ), 'Horizontal line' => __( 'Horizontal line' ), 'Horizontal space' => __( 'Horizontal space' ), 'Restore last draft' => __( 'Restore last draft' ), 'Insert/edit link' => array( __( 'Insert/edit link' ), 'metaK' ), 'Remove link' => array( __( 'Remove link' ), 'accessS' ), 'Link' => __( 'Link' ), 'Insert link' => __( 'Insert link' ), 'Target' => __( 'Target' ), 'New window' => __( 'New window' ), 'Text to display' => __( 'Text to display' ), 'Url' => __( 'URL' ), 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?' => __( 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?' ), 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?' => __( 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?' ), 'Color' => __( 'Color' ), 'Custom color' => __( 'Custom color' ), 'Custom...' => _x( 'Custom...', 'label for custom color' ), 'No color' => __( 'No color' ), 'R' => _x( 'R', 'Short for red in RGB' ), 'G' => _x( 'G', 'Short for green in RGB' ), 'B' => _x( 'B', 'Short for blue in RGB' ), 'Could not find the specified string.' => __( 'Could not find the specified string.' ), 'Replace' => _x( 'Replace', 'find/replace' ), 'Next' => _x( 'Next', 'find/replace' ), 'Prev' => _x( 'Prev', 'find/replace' ), 'Whole words' => _x( 'Whole words', 'find/replace' ), 'Find and replace' => __( 'Find and replace' ), 'Replace with' => _x( 'Replace with', 'find/replace' ), 'Find' => _x( 'Find', 'find/replace' ), 'Replace all' => _x( 'Replace all', 'find/replace' ), 'Match case' => __( 'Match case' ), 'Spellcheck' => __( 'Check Spelling' ), 'Finish' => _x( 'Finish', 'spellcheck' ), 'Ignore all' => _x( 'Ignore all', 'spellcheck' ), 'Ignore' => _x( 'Ignore', 'spellcheck' ), 'Add to Dictionary' => __( 'Add to Dictionary' ), 'Insert table' => __( 'Insert table' ), 'Delete table' => __( 'Delete table' ), 'Table properties' => __( 'Table properties' ), 'Row properties' => __( 'Table row properties' ), 'Cell properties' => __( 'Table cell properties' ), 'Border color' => __( 'Border color' ), 'Row' => __( 'Row' ), 'Rows' => __( 'Rows' ), 'Column' => __( 'Column' ), 'Cols' => __( 'Columns' ), 'Cell' => _x( 'Cell', 'table cell' ), 'Header cell' => __( 'Header cell' ), 'Header' => _x( 'Header', 'table header' ), 'Body' => _x( 'Body', 'table body' ), 'Footer' => _x( 'Footer', 'table footer' ), 'Insert row before' => __( 'Insert row before' ), 'Insert row after' => __( 'Insert row after' ), 'Insert column before' => __( 'Insert column before' ), 'Insert column after' => __( 'Insert column after' ), 'Paste row before' => __( 'Paste table row before' ), 'Paste row after' => __( 'Paste table row after' ), 'Delete row' => __( 'Delete row' ), 'Delete column' => __( 'Delete column' ), 'Cut row' => __( 'Cut table row' ), 'Copy row' => __( 'Copy table row' ), 'Merge cells' => __( 'Merge table cells' ), 'Split cell' => __( 'Split table cell' ), 'Height' => __( 'Height' ), 'Width' => __( 'Width' ), 'Caption' => __( 'Caption' ), 'Alignment' => __( 'Alignment' ), 'H Align' => _x( 'H Align', 'horizontal table cell alignment' ), 'Left' => __( 'Left' ), 'Center' => __( 'Center' ), 'Right' => __( 'Right' ), 'None' => _x( 'None', 'table cell alignment attribute' ), 'V Align' => _x( 'V Align', 'vertical table cell alignment' ), 'Top' => __( 'Top' ), 'Middle' => __( 'Middle' ), 'Bottom' => __( 'Bottom' ), 'Row group' => __( 'Row group' ), 'Column group' => __( 'Column group' ), 'Row type' => __( 'Row type' ), 'Cell type' => __( 'Cell type' ), 'Cell padding' => __( 'Cell padding' ), 'Cell spacing' => __( 'Cell spacing' ), 'Scope' => _x( 'Scope', 'table cell scope attribute' ), 'Insert template' => _x( 'Insert template', 'TinyMCE' ), 'Templates' => _x( 'Templates', 'TinyMCE' ), 'Background color' => __( 'Background color' ), 'Text color' => __( 'Text color' ), 'Show blocks' => _x( 'Show blocks', 'editor button' ), 'Show invisible characters' => __( 'Show invisible characters' ), 'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ), 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __( 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) . "\n\n" . __( 'If you are looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ), 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help.' ), 'Rich Text Area. Press Control-Option-H for help.' => __( 'Rich Text Area. Press Control-Option-H for help.' ), 'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ), 'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser’s edit menu instead.' ), 'Insert' => _x( 'Insert', 'TinyMCE menu' ), 'File' => _x( 'File', 'TinyMCE menu' ), 'Edit' => _x( 'Edit', 'TinyMCE menu' ), 'Tools' => _x( 'Tools', 'TinyMCE menu' ), 'View' => _x( 'View', 'TinyMCE menu' ), 'Table' => _x( 'Table', 'TinyMCE menu' ), 'Format' => _x( 'Format', 'TinyMCE menu' ), 'Toolbar Toggle' => array( __( 'Toolbar Toggle' ), 'accessZ' ), 'Insert Read More tag' => array( __( 'Insert Read More tag' ), 'accessT' ), 'Insert Page Break tag' => array( __( 'Insert Page Break tag' ), 'accessP' ), 'Read more...' => __( 'Read more...' ), 'Distraction-free writing mode' => array( __( 'Distraction-free writing mode' ), 'accessW' ), 'No alignment' => __( 'No alignment' ), 'Remove' => __( 'Remove' ), 'Edit|button' => __( 'Edit' ), 'Paste URL or type to search' => __( 'Paste URL or type to search' ), 'Apply' => __( 'Apply' ), 'Link options' => __( 'Link options' ), 'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), 'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), 'Add Media' => array( __( 'Add Media' ), 'accessM' ), 'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ), 'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts' ), 'Default shortcuts,' => __( 'Default shortcuts,' ), 'Additional shortcuts,' => __( 'Additional shortcuts,' ), 'Focus shortcuts:' => __( 'Focus shortcuts:' ), 'Inline toolbar (when an image, link or preview is selected)' => __( 'Inline toolbar (when an image, link or preview is selected)' ), 'Editor menu (when enabled)' => __( 'Editor menu (when enabled)' ), 'Editor toolbar' => __( 'Editor toolbar' ), 'Elements path' => __( 'Elements path' ), 'Ctrl + Alt + letter:' => __( 'Ctrl + Alt + letter:' ), 'Shift + Alt + letter:' => __( 'Shift + Alt + letter:' ), 'Cmd + letter:' => __( 'Cmd + letter:' ), 'Ctrl + letter:' => __( 'Ctrl + letter:' ), 'Letter' => __( 'Letter' ), 'Action' => __( 'Action' ), 'Warning: the link has been inserted but may have errors. Please test it.' => __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' => __( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ), 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' => __( 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ), 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' => __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ), 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' => __( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ), ); } return self::$translation; } public static function wp_mce_translation( $mce_locale = '', $json_only = false ) { if ( ! $mce_locale ) { $mce_locale = self::get_mce_locale(); } $mce_translation = self::get_translation(); foreach ( $mce_translation as $name => $value ) { if ( is_array( $value ) ) { $mce_translation[ $name ] = $value[0]; } } $mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale ); foreach ( $mce_translation as $key => $value ) { if ( $key === $value ) { unset( $mce_translation[ $key ] ); continue; } if ( false !== strpos( $value, '&' ) ) { $mce_translation[ $key ] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' ); } } if ( is_rtl() ) { $mce_translation['_dir'] = 'rtl'; } if ( $json_only ) { return wp_json_encode( $mce_translation ); } $baseurl = self::get_baseurl(); return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" . "tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n"; } public static function force_uncompressed_tinymce() { $has_custom_theme = false; foreach ( self::$mce_settings as $init ) { if ( ! empty( $init['theme_url'] ) ) { $has_custom_theme = true; break; } } if ( ! $has_custom_theme ) { return; } $wp_scripts = wp_scripts(); $wp_scripts->remove( 'wp-tinymce' ); wp_register_tinymce_scripts( $wp_scripts, true ); } public static function print_tinymce_scripts() { global $concatenate_scripts; if ( self::$tinymce_scripts_printed ) { return; } self::$tinymce_scripts_printed = true; if ( ! isset( $concatenate_scripts ) ) { script_concat_settings(); } wp_print_scripts( array( 'wp-tinymce' ) ); echo "\n"; } public static function editor_js() { global $tinymce_version; $tmce_on = ! empty( self::$mce_settings ); $mceInit = ''; $qtInit = ''; if ( $tmce_on ) { foreach ( self::$mce_settings as $editor_id => $init ) { $options = self::_parse_init( $init ); $mceInit .= "'$editor_id':{$options},"; } $mceInit = '{' . trim( $mceInit, ',' ) . '}'; } else { $mceInit = '{}'; } if ( ! empty( self::$qt_settings ) ) { foreach ( self::$qt_settings as $editor_id => $init ) { $options = self::_parse_init( $init ); $qtInit .= "'$editor_id':{$options},"; } $qtInit = '{' . trim( $qtInit, ',' ) . '}'; } else { $qtInit = '{}'; } $ref = array( 'plugins' => implode( ',', self::$plugins ), 'theme' => 'modern', 'language' => self::$mce_locale, ); $suffix = SCRIPT_DEBUG ? '' : '.min'; $baseurl = self::get_baseurl(); $version = 'ver=' . $tinymce_version; do_action( 'before_wp_tiny_mce', self::$mce_settings ); ?> - .bulk-select-button { - padding: 5px 10px; - } -} -/*! This file is auto-generated */ -/* Include margin and padding in the width calculation of input and textarea. */ -input, -select, -textarea, -button { - box-sizing: border-box; - font-family: inherit; - font-size: inherit; - font-weight: inherit; -} + + \n"; } } do_action( 'wp_tiny_mce_init', self::$mce_settings ); ?> + + true ), 'objects' ); $pt_names = array_keys( $pts ); $query = array( 'post_type' => $pt_names, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'posts_per_page' => 20, ); $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1; if ( isset( $args['s'] ) ) { $query['s'] = $args['s']; } $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0; $query = apply_filters( 'wp_link_query_args', $query ); $get_posts = new WP_Query; $posts = $get_posts->query( $query ); $results = array(); foreach ( $posts as $post ) { if ( 'post' === $post->post_type ) { $info = mysql2date( __( 'Y/m/d' ), $post->post_date ); } else { $info = $pts[ $post->post_type ]->labels->singular_name; } $results[] = array( 'ID' => $post->ID, 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ), 'permalink' => get_permalink( $post->ID ), 'info' => $info, ); } $results = apply_filters( 'wp_link_query', $results, $query ); return ! empty( $results ) ? $results : false; } public static function wp_link_dialog() { if ( self::$link_dialog_printed ) { return; } self::$link_dialog_printed = true; ?> + + + init(); add_action( 'init', array( $this, 'init' ), 0 ); } public function init() { if ( function_exists( 'is_admin' ) && ! is_admin() && function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'script' ) ) { $this->type_attr = " type='text/javascript'"; } do_action_ref_array( 'wp_default_scripts', array( &$this ) ); } public function print_scripts( $handles = false, $group = false ) { return $this->do_items( $handles, $group ); } public function print_scripts_l10n( $handle, $display = true ) { _deprecated_function( __FUNCTION__, '3.3.0', 'WP_Scripts::print_extra_script()' ); return $this->print_extra_script( $handle, $display ); } public function print_extra_script( $handle, $display = true ) { $output = $this->get_data( $handle, 'data' ); if ( ! $output ) { return; } if ( ! $display ) { return $output; } printf( "\n", $this->type_attr, esc_attr( $handle ) ); if ( $this->type_attr ) { echo "/* type_attr ) { echo "/* ]]> */\n"; } echo "\n"; return true; } public function do_item( $handle, $group = false ) { if ( ! parent::do_item( $handle ) ) { return false; } if ( 0 === $group && $this->groups[ $handle ] > 0 ) { $this->in_footer[] = $handle; return false; } if ( false === $group && in_array( $handle, $this->in_footer, true ) ) { $this->in_footer = array_diff( $this->in_footer, (array) $handle ); } $obj = $this->registered[ $handle ]; if ( null === $obj->ver ) { $ver = ''; } else { $ver = $obj->ver ? $obj->ver : $this->default_version; } if ( isset( $this->args[ $handle ] ) ) { $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ]; } $src = $obj->src; $cond_before = ''; $cond_after = ''; $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; if ( $conditional ) { $cond_before = "\n"; } $before_handle = $this->print_inline_script( $handle, 'before', false ); $after_handle = $this->print_inline_script( $handle, 'after', false ); if ( $before_handle ) { $before_handle = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $before_handle ); } if ( $after_handle ) { $after_handle = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $after_handle ); } if ( $before_handle || $after_handle ) { $inline_script_tag = $cond_before . $before_handle . $after_handle . $cond_after; } else { $inline_script_tag = ''; } $translations_stop_concat = ! empty( $obj->textdomain ); $translations = $this->print_translations( $handle, false ); if ( $translations ) { $translations = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $translations ); } if ( $this->do_concat ) { $srce = apply_filters( 'script_loader_src', $src, $handle ); if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) { $this->do_concat = false; _print_scripts(); $this->reset(); } elseif ( $this->in_default_dir( $srce ) && ! $conditional ) { $this->print_code .= $this->print_extra_script( $handle, false ); $this->concat .= "$handle,"; $this->concat_version .= "$handle$ver"; return true; } else { $this->ext_handles .= "$handle,"; $this->ext_version .= "$handle$ver"; } } $has_conditional_data = $conditional && $this->get_data( $handle, 'data' ); if ( $has_conditional_data ) { echo $cond_before; } $this->print_extra_script( $handle ); if ( $has_conditional_data ) { echo $cond_after; } if ( ! $src ) { if ( $inline_script_tag ) { if ( $this->do_concat ) { $this->print_html .= $inline_script_tag; } else { echo $inline_script_tag; } } return true; } if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) { $src = $this->base_url . $src; } if ( ! empty( $ver ) ) { $src = add_query_arg( 'ver', $ver, $src ); } $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); if ( ! $src ) { return true; } $tag = $translations . $cond_before . $before_handle; $tag .= sprintf( "\n", $this->type_attr, $src, esc_attr( $handle ) ); $tag .= $after_handle . $cond_after; $tag = apply_filters( 'script_loader_tag', $tag, $handle, $src ); if ( $this->do_concat ) { $this->print_html .= $tag; } else { echo $tag; } return true; } public function add_inline_script( $handle, $data, $position = 'after' ) { if ( ! $data ) { return false; } if ( 'after' !== $position ) { $position = 'before'; } $script = (array) $this->get_data( $handle, $position ); $script[] = $data; return $this->add_data( $handle, $position, $script ); } public function print_inline_script( $handle, $position = 'after', $display = true ) { $output = $this->get_data( $handle, $position ); if ( empty( $output ) ) { return false; } $output = trim( implode( "\n", $output ), "\n" ); if ( $display ) { printf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), esc_attr( $position ), $output ); } return $output; } public function localize( $handle, $object_name, $l10n ) { if ( 'jquery' === $handle ) { $handle = 'jquery-core'; } if ( is_array( $l10n ) && isset( $l10n['l10n_print_after'] ) ) { $after = $l10n['l10n_print_after']; unset( $l10n['l10n_print_after'] ); } if ( ! is_array( $l10n ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'The %1$s parameter must be an array. To pass arbitrary data to scripts, use the %2$s function instead.' ), '$l10n', 'wp_add_inline_script()' ), '5.7.0' ); } if ( is_string( $l10n ) ) { $l10n = html_entity_decode( $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; if ( ! empty( $after ) ) { $script .= "\n$after;"; } $data = $this->get_data( $handle, 'data' ); if ( ! empty( $data ) ) { $script = "$data\n$script"; } return $this->add_data( $handle, 'data', $script ); } public function set_group( $handle, $recursion, $group = false ) { if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) { $grp = 1; } else { $grp = (int) $this->get_data( $handle, 'group' ); } if ( false !== $group && $grp > $group ) { $grp = $group; } return parent::set_group( $handle, $recursion, $grp ); } public function set_translations( $handle, $domain = 'default', $path = null ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } $obj = $this->registered[ $handle ]; if ( ! in_array( 'wp-i18n', $obj->deps, true ) ) { $obj->deps[] = 'wp-i18n'; } return $obj->set_translations( $domain, $path ); } public function print_translations( $handle, $display = true ) { if ( ! isset( $this->registered[ $handle ] ) || empty( $this->registered[ $handle ]->textdomain ) ) { return false; } $domain = $this->registered[ $handle ]->textdomain; $path = $this->registered[ $handle ]->translations_path; $json_translations = load_script_textdomain( $handle, $domain, $path ); if ( ! $json_translations ) { return false; } $output = <<\n%s\n\n", $this->type_attr, esc_attr( $handle ), $output ); } return $output; } public function all_deps( $handles, $recursion = false, $group = false ) { $r = parent::all_deps( $handles, $recursion, $group ); if ( ! $recursion ) { $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); } return $r; } public function do_head_items() { $this->do_items( false, 0 ); return $this->done; } public function do_footer_items() { $this->do_items( false, 1 ); return $this->done; } public function in_default_dir( $src ) { if ( ! $this->default_dirs ) { return true; } if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) { return false; } foreach ( (array) $this->default_dirs as $test ) { if ( 0 === strpos( $src, $test ) ) { return true; } } return false; } public function reset() { $this->do_concat = false; $this->print_code = ''; $this->concat = ''; $this->concat_version = ''; $this->print_html = ''; $this->ext_version = ''; $this->ext_handles = ''; } } user_id = $user_id; } final public static function get_instance( $user_id ) { $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); return new $manager( $user_id ); } private function hash_token( $token ) { if ( function_exists( 'hash' ) ) { return hash( 'sha256', $token ); } else { return sha1( $token ); } } final public function get( $token ) { $verifier = $this->hash_token( $token ); return $this->get_session( $verifier ); } final public function verify( $token ) { $verifier = $this->hash_token( $token ); return (bool) $this->get_session( $verifier ); } final public function create( $expiration ) { $session = apply_filters( 'attach_session_information', array(), $this->user_id ); $session['expiration'] = $expiration; if ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { $session['ip'] = $_SERVER['REMOTE_ADDR']; } if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $session['ua'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); } $session['login'] = time(); $token = wp_generate_password( 43, false, false ); $this->update( $token, $session ); return $token; } final public function update( $token, $session ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, $session ); } final public function destroy( $token ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, null ); } final public function destroy_others( $token_to_keep ) { $verifier = $this->hash_token( $token_to_keep ); $session = $this->get_session( $verifier ); if ( $session ) { $this->destroy_other_sessions( $verifier ); } else { $this->destroy_all_sessions(); } } final protected function is_still_valid( $session ) { return $session['expiration'] >= time(); } final public function destroy_all() { $this->destroy_all_sessions(); } final public static function destroy_all_for_all_users() { $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); call_user_func( array( $manager, 'drop_sessions' ) ); } final public function get_all() { return array_values( $this->get_sessions() ); } abstract protected function get_sessions(); abstract protected function get_session( $verifier ); abstract protected function update_session( $verifier, $session = null ); abstract protected function destroy_other_sessions( $verifier ); abstract protected function destroy_all_sessions(); public static function drop_sessions() {} } 'border.radius', 'spacing.customMargin' => 'spacing.margin', 'spacing.customPadding' => 'spacing.padding', 'typography.customLineHeight' => 'typography.lineHeight', ); public static function migrate( $theme_json ) { if ( ! isset( $theme_json['version'] ) ) { $theme_json = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, ); } if ( 1 === $theme_json['version'] ) { $theme_json = self::migrate_v1_to_v2( $theme_json ); } return $theme_json; } private static function migrate_v1_to_v2( $old ) { $new = $old; if ( isset( $old['settings'] ) ) { $new['settings'] = self::rename_paths( $old['settings'], self::V1_TO_V2_RENAMED_PATHS ); } $new['version'] = 2; return $new; } private static function rename_paths( $settings, $paths_to_rename ) { $new_settings = $settings; self::rename_settings( $new_settings, $paths_to_rename ); if ( isset( $new_settings['blocks'] ) && is_array( $new_settings['blocks'] ) ) { foreach ( $new_settings['blocks'] as &$block_settings ) { self::rename_settings( $block_settings, $paths_to_rename ); } } return $new_settings; } private static function rename_settings( &$settings, $paths_to_rename ) { foreach ( $paths_to_rename as $original => $renamed ) { $original_path = explode( '.', $original ); $renamed_path = explode( '.', $renamed ); $current_value = _wp_array_get( $settings, $original_path, null ); if ( null !== $current_value ) { _wp_array_set( $settings, $renamed_path, $current_value ); self::unset_setting_by_path( $settings, $original_path ); } } } private static function unset_setting_by_path( &$settings, $path ) { $tmp_settings = &$settings; $last_key = array_pop( $path ); foreach ( $path as $key ) { $tmp_settings = &$tmp_settings[ $key ]; } unset( $tmp_settings[ $last_key ] ); } } ', $open_sq_flag = '', $apos_flag = ''; if ( empty( $text ) || false === $run_texturize ) { return $text; } if ( $reset || ! isset( $static_characters ) ) { $run_texturize = apply_filters( 'run_wptexturize', $run_texturize ); if ( false === $run_texturize ) { return $text; } $opening_quote = _x( '“', 'opening curly double quote' ); $closing_quote = _x( '”', 'closing curly double quote' ); $apos = _x( '’', 'apostrophe' ); $prime = _x( '′', 'prime' ); $double_prime = _x( '″', 'double prime' ); $opening_single_quote = _x( '‘', 'opening curly single quote' ); $closing_single_quote = _x( '’', 'closing curly single quote' ); $en_dash = _x( '–', 'en dash' ); $em_dash = _x( '—', 'em dash' ); $default_no_texturize_tags = array( 'pre', 'code', 'kbd', 'style', 'script', 'tt' ); $default_no_texturize_shortcodes = array( 'code' ); if ( isset( $wp_cockneyreplace ) ) { $cockney = array_keys( $wp_cockneyreplace ); $cockneyreplace = array_values( $wp_cockneyreplace ); } else { $cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em", 'Comma-separated list of words to texturize in your language' ) ); $cockneyreplace = explode( ',', _x( '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em', 'Comma-separated list of replacement words in your language' ) ); } $static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney ); $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); $dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array(), ); $dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array(), ); $dynamic = array(); $spaces = wp_spaces_regexp(); if ( "'" !== $apos || "'" !== $closing_single_quote ) { $dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote; } if ( "'" !== $apos || '"' !== $closing_quote ) { $dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote; } if ( "'" !== $apos ) { $dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag; } if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) { $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote; } if ( "'" !== $opening_single_quote ) { $dynamic[ '/(?<=\A|[([{"\-]|<|' . $spaces . ')\'/' ] = $open_sq_flag; } if ( "'" !== $apos ) { $dynamic[ '/(?&/\[\]\x00-\x20=]++)@', $text, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); $found_shortcodes = ! empty( $tagnames ); $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : ''; $regex = _get_wptexturize_split_regex( $shortcode_regex ); $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); foreach ( $textarr as &$curl ) { $first = $curl[0]; if ( '<' === $first ) { if ( ''; $quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|>|" . $spaces . ')/'; $prime_pattern = "/(?<=\\d)$needle/"; $flag_after_digit = "/(?<=\\d)$flag/"; $flag_no_digit = "/(? &$sentence ) { if ( false === strpos( $sentence, $needle ) ) { continue; } elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) { $sentence = preg_replace( $quote_pattern, $flag, $sentence, -1, $count ); if ( $count > 1 ) { $sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, -1, $count2 ); if ( 0 === $count2 ) { $count2 = substr_count( $sentence, "$flag." ); if ( $count2 > 0 ) { $pos = strrpos( $sentence, "$flag." ); } else { $pos = strrpos( $sentence, $flag ); } $sentence = substr_replace( $sentence, $close_quote, $pos, strlen( $flag ) ); } $sentence = preg_replace( $prime_pattern, $prime, $sentence ); $sentence = preg_replace( $flag_after_digit, $prime, $sentence ); $sentence = str_replace( $flag, $close_quote, $sentence ); } elseif ( 1 == $count ) { $sentence = str_replace( $flag, $close_quote, $sentence ); $sentence = preg_replace( $prime_pattern, $prime, $sentence ); } else { $sentence = preg_replace( $prime_pattern, $prime, $sentence ); } } else { $sentence = preg_replace( $prime_pattern, $prime, $sentence ); $sentence = preg_replace( $quote_pattern, $close_quote, $sentence ); } if ( '"' === $needle && false !== strpos( $sentence, '"' ) ) { $sentence = str_replace( '"', $close_quote, $sentence ); } } return implode( $open_quote, $sentences ); } function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) { if ( isset( $text[1] ) && '/' !== $text[1] ) { $opening_tag = true; $name_offset = 1; } elseif ( 0 === count( $stack ) ) { return; } else { $opening_tag = false; $name_offset = 2; } $space = strpos( $text, ' ' ); if ( false === $space ) { $space = -1; } else { $space -= $name_offset; } $tag = substr( $text, $name_offset, $space ); if ( in_array( $tag, $disabled_elements, true ) ) { if ( $opening_tag ) { array_push( $stack, $tag ); } elseif ( end( $stack ) == $tag ) { array_pop( $stack ); } } } function wpautop( $text, $br = true ) { $pre_tags = array(); if ( trim( $text ) === '' ) { return ''; } $text = $text . "\n"; if ( strpos( $text, '', $text ); $last_part = array_pop( $text_parts ); $text = ''; $i = 0; foreach ( $text_parts as $text_part ) { $start = strpos( $text_part, ''; $text .= substr( $text_part, 0, $start ) . $name; $i++; } $text .= $last_part; } $text = preg_replace( '|\s*|', "\n\n", $text ); $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; $text = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $text ); $text = preg_replace( '!()!', "$1\n\n", $text ); $text = preg_replace( '!()!', "$1\n\n", $text ); $text = str_replace( array( "\r\n", "\r" ), "\n", $text ); $text = wp_replace_in_html_tags( $text, array( "\n" => ' ' ) ); if ( strpos( $text, '\s*|', '', $text ); } if ( strpos( $text, '' ) !== false ) { $text = preg_replace( '|(]*>)\s*|', '$1', $text ); $text = preg_replace( '|\s*|', '', $text ); $text = preg_replace( '%\s*(]*>)\s*%', '$1', $text ); } if ( strpos( $text, '\]]*[>\]])\s*%', '$1', $text ); $text = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $text ); $text = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $text ); } if ( strpos( $text, ']*>)|', '$1', $text ); $text = preg_replace( '|\s*|', '', $text ); } $text = preg_replace( "/\n\n+/", "\n\n", $text ); $paragraphs = preg_split( '/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY ); $text = ''; foreach ( $paragraphs as $paragraph ) { $text .= '

      ' . trim( $paragraph, "\n" ) . "

      \n"; } $text = preg_replace( '|

      \s*

      |', '', $text ); $text = preg_replace( '!

      ([^<]+)!', '

      $1

      ', $text ); $text = preg_replace( '!

      \s*(]*>)\s*

      !', '$1', $text ); $text = preg_replace( '|

      (|', '$1', $text ); $text = preg_replace( '|

      ]*)>|i', '

      ', $text ); $text = str_replace( '

      ', '

      ', $text ); $text = preg_replace( '!

      \s*(]*>)!', '$1', $text ); $text = preg_replace( '!(]*>)\s*

      !', '$1', $text ); if ( $br ) { $text = preg_replace_callback( '/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $text ); $text = str_replace( array( '
      ', '
      ' ), '
      ', $text ); $text = preg_replace( '|(?)\s*\n|', "
      \n", $text ); $text = str_replace( '', "\n", $text ); } $text = preg_replace( '!(]*>)\s*
      !', '$1', $text ); $text = preg_replace( '!
      (\s*]*>)!', '$1', $text ); $text = preg_replace( "|\n

      $|", '

      ', $text ); if ( ! empty( $pre_tags ) ) { $text = str_replace( array_keys( $pre_tags ), array_values( $pre_tags ), $text ); } if ( false !== strpos( $text, '' ) ) { $text = str_replace( array( ' ', '' ), "\n", $text ); } return $text; } function wp_html_split( $input ) { return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE ); } function get_html_split_regex() { static $regex; if ( ! isset( $regex ) ) { $comments = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?'; $cdata = '!\[CDATA\[' . '[^\]]*+' . '(?:' . '](?!]>)' . '[^\]]*+' . ')*+' . '(?:]]>)?'; $escaped = '(?=' . '!--' . '|' . '!\[CDATA\[' . ')' . '(?(?=!-)' . $comments . '|' . $cdata . ')'; $regex = '/(' . '<' . '(?' . $escaped . '|' . '[^>]*>?' . ')' . ')/'; } return $regex; } function _get_wptexturize_split_regex( $shortcode_regex = '' ) { static $html_regex; if ( ! isset( $html_regex ) ) { $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?'; $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')'; } if ( empty( $shortcode_regex ) ) { $regex = '/(' . $html_regex . ')/'; } else { $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/'; } return $regex; } function _get_wptexturize_shortcode_regex( $tagnames ) { $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); $tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; $regex = '\[' . '[\/\[]?' . $tagregexp . '(?:' . '[^\[\]<>]+' . '|' . '<[^\[\]>]*>' . ')*+' . '\]' . '\]?'; return $regex; } function wp_replace_in_html_tags( $haystack, $replace_pairs ) { $textarr = wp_html_split( $haystack ); $changed = false; if ( 1 === count( $replace_pairs ) ) { foreach ( $replace_pairs as $needle => $replace ) { } for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { if ( false !== strpos( $textarr[ $i ], $needle ) ) { $textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] ); $changed = true; } } } else { $needles = array_keys( $replace_pairs ); for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { foreach ( $needles as $needle ) { if ( false !== strpos( $textarr[ $i ], $needle ) ) { $textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs ); $changed = true; break; } } } } if ( $changed ) { $haystack = implode( $textarr ); } return $haystack; } function _autop_newline_preservation_helper( $matches ) { return str_replace( "\n", '', $matches[0] ); } function shortcode_unautop( $text ) { global $shortcode_tags; if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $text; } $tagregexp = implode( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); $spaces = wp_spaces_regexp(); $pattern = '/' . '

      ' . '(?:' . $spaces . ')*+' . '(' . '\\[' . "($tagregexp)" . '(?![\\w-])' . '[^\\]\\/]*' . '(?:' . '\\/(?!\\])' . '[^\\]\\/]*' . ')*?' . '(?:' . '\\/\\]' . '|' . '\\]' . '(?:' . '[^\\[]*+' . '(?:' . '\\[(?!\\/\\2\\])' . '[^\\[]*+' . ')*+' . '\\[\\/\\2\\]' . ')?' . ')' . ')' . '(?:' . $spaces . ')*+' . '<\\/p>' . '/'; return preg_replace( $pattern, '$1', $text ); } function seems_utf8( $str ) { mbstring_binary_safe_encoding(); $length = strlen( $str ); reset_mbstring_encoding(); for ( $i = 0; $i < $length; $i++ ) { $c = ord( $str[ $i ] ); if ( $c < 0x80 ) { $n = 0; } elseif ( ( $c & 0xE0 ) == 0xC0 ) { $n = 1; } elseif ( ( $c & 0xF0 ) == 0xE0 ) { $n = 2; } elseif ( ( $c & 0xF8 ) == 0xF0 ) { $n = 3; } elseif ( ( $c & 0xFC ) == 0xF8 ) { $n = 4; } elseif ( ( $c & 0xFE ) == 0xFC ) { $n = 5; } else { return false; } for ( $j = 0; $j < $n; $j++ ) { if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) { return false; } } } return true; } function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } if ( ! preg_match( '/[&<>"\']/', $string ) ) { return $string; } if ( empty( $quote_style ) ) { $quote_style = ENT_NOQUOTES; } elseif ( ENT_XML1 === $quote_style ) { $quote_style = ENT_QUOTES | ENT_XML1; } elseif ( ! in_array( $quote_style, array( ENT_NOQUOTES, ENT_COMPAT, ENT_QUOTES, 'single', 'double' ), true ) ) { $quote_style = ENT_QUOTES; } if ( ! $charset ) { static $_charset = null; if ( ! isset( $_charset ) ) { $alloptions = wp_load_alloptions(); $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : ''; } $charset = $_charset; } if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ), true ) ) { $charset = 'UTF-8'; } $_quote_style = $quote_style; if ( 'double' === $quote_style ) { $quote_style = ENT_COMPAT; $_quote_style = ENT_COMPAT; } elseif ( 'single' === $quote_style ) { $quote_style = ENT_NOQUOTES; } if ( ! $double_encode ) { $string = wp_kses_normalize_entities( $string, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' ); } $string = htmlspecialchars( $string, $quote_style, $charset, $double_encode ); if ( 'single' === $_quote_style ) { $string = str_replace( "'", ''', $string ); } return $string; } function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } if ( strpos( $string, '&' ) === false ) { return $string; } if ( empty( $quote_style ) ) { $quote_style = ENT_NOQUOTES; } elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { $quote_style = ENT_QUOTES; } $single = array( ''' => '\'', ''' => '\'', ); $single_preg = array( '/�*39;/' => ''', '/�*27;/i' => ''', ); $double = array( '"' => '"', '"' => '"', '"' => '"', ); $double_preg = array( '/�*34;/' => '"', '/�*22;/i' => '"', ); $others = array( '<' => '<', '<' => '<', '>' => '>', '>' => '>', '&' => '&', '&' => '&', '&' => '&', ); $others_preg = array( '/�*60;/' => '<', '/�*62;/' => '>', '/�*38;/' => '&', '/�*26;/i' => '&', ); if ( ENT_QUOTES === $quote_style ) { $translation = array_merge( $single, $double, $others ); $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); } elseif ( ENT_COMPAT === $quote_style || 'double' === $quote_style ) { $translation = array_merge( $double, $others ); $translation_preg = array_merge( $double_preg, $others_preg ); } elseif ( 'single' === $quote_style ) { $translation = array_merge( $single, $others ); $translation_preg = array_merge( $single_preg, $others_preg ); } elseif ( ENT_NOQUOTES === $quote_style ) { $translation = $others; $translation_preg = $others_preg; } $string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string ); return strtr( $string, $translation ); } function wp_check_invalid_utf8( $string, $strip = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } static $is_utf8 = null; if ( ! isset( $is_utf8 ) ) { $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ); } if ( ! $is_utf8 ) { return $string; } static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { $utf8_pcre = @preg_match( '/^./u', 'a' ); } if ( ! $utf8_pcre ) { return $string; } if ( 1 === @preg_match( '/^./us', $string ) ) { return $string; } if ( $strip && function_exists( 'iconv' ) ) { return iconv( 'utf-8', 'utf-8', $string ); } return ''; } function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters = false ) { $unicode = ''; $values = array(); $num_octets = 1; $unicode_length = 0; mbstring_binary_safe_encoding(); $string_length = strlen( $utf8_string ); reset_mbstring_encoding(); for ( $i = 0; $i < $string_length; $i++ ) { $value = ord( $utf8_string[ $i ] ); if ( $value < 128 ) { $char = chr( $value ); $encoded_char = $encode_ascii_characters ? rawurlencode( $char ) : $char; $encoded_char_length = strlen( $encoded_char ); if ( $length && ( $unicode_length + $encoded_char_length ) > $length ) { break; } $unicode .= $encoded_char; $unicode_length += $encoded_char_length; } else { if ( count( $values ) == 0 ) { if ( $value < 224 ) { $num_octets = 2; } elseif ( $value < 240 ) { $num_octets = 3; } else { $num_octets = 4; } } $values[] = $value; if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) { break; } if ( count( $values ) == $num_octets ) { for ( $j = 0; $j < $num_octets; $j++ ) { $unicode .= '%' . dechex( $values[ $j ] ); } $unicode_length += $num_octets * 3; $values = array(); $num_octets = 1; } } } return $unicode; } function remove_accents( $string, $locale = '' ) { if ( ! preg_match( '/[\x80-\xff]/', $string ) ) { return $string; } if ( seems_utf8( $string ) ) { $chars = array( 'ª' => 'a', 'º' => 'o', 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y', 'Þ' => 'TH', 'ß' => 's', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ý' => 'y', 'þ' => 'th', 'ÿ' => 'y', 'Ø' => 'O', 'Ā' => 'A', 'ā' => 'a', 'Ă' => 'A', 'ă' => 'a', 'Ą' => 'A', 'ą' => 'a', 'Ć' => 'C', 'ć' => 'c', 'Ĉ' => 'C', 'ĉ' => 'c', 'Ċ' => 'C', 'ċ' => 'c', 'Č' => 'C', 'č' => 'c', 'Ď' => 'D', 'ď' => 'd', 'Đ' => 'D', 'đ' => 'd', 'Ē' => 'E', 'ē' => 'e', 'Ĕ' => 'E', 'ĕ' => 'e', 'Ė' => 'E', 'ė' => 'e', 'Ę' => 'E', 'ę' => 'e', 'Ě' => 'E', 'ě' => 'e', 'Ĝ' => 'G', 'ĝ' => 'g', 'Ğ' => 'G', 'ğ' => 'g', 'Ġ' => 'G', 'ġ' => 'g', 'Ģ' => 'G', 'ģ' => 'g', 'Ĥ' => 'H', 'ĥ' => 'h', 'Ħ' => 'H', 'ħ' => 'h', 'Ĩ' => 'I', 'ĩ' => 'i', 'Ī' => 'I', 'ī' => 'i', 'Ĭ' => 'I', 'ĭ' => 'i', 'Į' => 'I', 'į' => 'i', 'İ' => 'I', 'ı' => 'i', 'IJ' => 'IJ', 'ij' => 'ij', 'Ĵ' => 'J', 'ĵ' => 'j', 'Ķ' => 'K', 'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'L', 'ĺ' => 'l', 'Ļ' => 'L', 'ļ' => 'l', 'Ľ' => 'L', 'ľ' => 'l', 'Ŀ' => 'L', 'ŀ' => 'l', 'Ł' => 'L', 'ł' => 'l', 'Ń' => 'N', 'ń' => 'n', 'Ņ' => 'N', 'ņ' => 'n', 'Ň' => 'N', 'ň' => 'n', 'ʼn' => 'n', 'Ŋ' => 'N', 'ŋ' => 'n', 'Ō' => 'O', 'ō' => 'o', 'Ŏ' => 'O', 'ŏ' => 'o', 'Ő' => 'O', 'ő' => 'o', 'Œ' => 'OE', 'œ' => 'oe', 'Ŕ' => 'R', 'ŕ' => 'r', 'Ŗ' => 'R', 'ŗ' => 'r', 'Ř' => 'R', 'ř' => 'r', 'Ś' => 'S', 'ś' => 's', 'Ŝ' => 'S', 'ŝ' => 's', 'Ş' => 'S', 'ş' => 's', 'Š' => 'S', 'š' => 's', 'Ţ' => 'T', 'ţ' => 't', 'Ť' => 'T', 'ť' => 't', 'Ŧ' => 'T', 'ŧ' => 't', 'Ũ' => 'U', 'ũ' => 'u', 'Ū' => 'U', 'ū' => 'u', 'Ŭ' => 'U', 'ŭ' => 'u', 'Ů' => 'U', 'ů' => 'u', 'Ű' => 'U', 'ű' => 'u', 'Ų' => 'U', 'ų' => 'u', 'Ŵ' => 'W', 'ŵ' => 'w', 'Ŷ' => 'Y', 'ŷ' => 'y', 'Ÿ' => 'Y', 'Ź' => 'Z', 'ź' => 'z', 'Ż' => 'Z', 'ż' => 'z', 'Ž' => 'Z', 'ž' => 'z', 'ſ' => 's', 'Ș' => 'S', 'ș' => 's', 'Ț' => 'T', 'ț' => 't', '€' => 'E', '£' => '', 'Ơ' => 'O', 'ơ' => 'o', 'Ư' => 'U', 'ư' => 'u', 'Ầ' => 'A', 'ầ' => 'a', 'Ằ' => 'A', 'ằ' => 'a', 'Ề' => 'E', 'ề' => 'e', 'Ồ' => 'O', 'ồ' => 'o', 'Ờ' => 'O', 'ờ' => 'o', 'Ừ' => 'U', 'ừ' => 'u', 'Ỳ' => 'Y', 'ỳ' => 'y', 'Ả' => 'A', 'ả' => 'a', 'Ẩ' => 'A', 'ẩ' => 'a', 'Ẳ' => 'A', 'ẳ' => 'a', 'Ẻ' => 'E', 'ẻ' => 'e', 'Ể' => 'E', 'ể' => 'e', 'Ỉ' => 'I', 'ỉ' => 'i', 'Ỏ' => 'O', 'ỏ' => 'o', 'Ổ' => 'O', 'ổ' => 'o', 'Ở' => 'O', 'ở' => 'o', 'Ủ' => 'U', 'ủ' => 'u', 'Ử' => 'U', 'ử' => 'u', 'Ỷ' => 'Y', 'ỷ' => 'y', 'Ẫ' => 'A', 'ẫ' => 'a', 'Ẵ' => 'A', 'ẵ' => 'a', 'Ẽ' => 'E', 'ẽ' => 'e', 'Ễ' => 'E', 'ễ' => 'e', 'Ỗ' => 'O', 'ỗ' => 'o', 'Ỡ' => 'O', 'ỡ' => 'o', 'Ữ' => 'U', 'ữ' => 'u', 'Ỹ' => 'Y', 'ỹ' => 'y', 'Ấ' => 'A', 'ấ' => 'a', 'Ắ' => 'A', 'ắ' => 'a', 'Ế' => 'E', 'ế' => 'e', 'Ố' => 'O', 'ố' => 'o', 'Ớ' => 'O', 'ớ' => 'o', 'Ứ' => 'U', 'ứ' => 'u', 'Ạ' => 'A', 'ạ' => 'a', 'Ậ' => 'A', 'ậ' => 'a', 'Ặ' => 'A', 'ặ' => 'a', 'Ẹ' => 'E', 'ẹ' => 'e', 'Ệ' => 'E', 'ệ' => 'e', 'Ị' => 'I', 'ị' => 'i', 'Ọ' => 'O', 'ọ' => 'o', 'Ộ' => 'O', 'ộ' => 'o', 'Ợ' => 'O', 'ợ' => 'o', 'Ụ' => 'U', 'ụ' => 'u', 'Ự' => 'U', 'ự' => 'u', 'Ỵ' => 'Y', 'ỵ' => 'y', 'ɑ' => 'a', 'Ǖ' => 'U', 'ǖ' => 'u', 'Ǘ' => 'U', 'ǘ' => 'u', 'Ǎ' => 'A', 'ǎ' => 'a', 'Ǐ' => 'I', 'ǐ' => 'i', 'Ǒ' => 'O', 'ǒ' => 'o', 'Ǔ' => 'U', 'ǔ' => 'u', 'Ǚ' => 'U', 'ǚ' => 'u', 'Ǜ' => 'U', 'ǜ' => 'u', ); if ( empty( $locale ) ) { $locale = get_locale(); } if ( str_starts_with( $locale, 'de' ) ) { $chars['Ä'] = 'Ae'; $chars['ä'] = 'ae'; $chars['Ö'] = 'Oe'; $chars['ö'] = 'oe'; $chars['Ü'] = 'Ue'; $chars['ü'] = 'ue'; $chars['ß'] = 'ss'; } elseif ( 'da_DK' === $locale ) { $chars['Æ'] = 'Ae'; $chars['æ'] = 'ae'; $chars['Ø'] = 'Oe'; $chars['ø'] = 'oe'; $chars['Å'] = 'Aa'; $chars['å'] = 'aa'; } elseif ( 'ca' === $locale ) { $chars['l·l'] = 'll'; } elseif ( 'sr_RS' === $locale || 'bs_BA' === $locale ) { $chars['Đ'] = 'DJ'; $chars['đ'] = 'dj'; } $string = strtr( $string, $chars ); } else { $chars = array(); $chars['in'] = "\x80\x83\x8a\x8e\x9a\x9e" . "\x9f\xa2\xa5\xb5\xc0\xc1\xc2" . "\xc3\xc4\xc5\xc7\xc8\xc9\xca" . "\xcb\xcc\xcd\xce\xcf\xd1\xd2" . "\xd3\xd4\xd5\xd6\xd8\xd9\xda" . "\xdb\xdc\xdd\xe0\xe1\xe2\xe3" . "\xe4\xe5\xe7\xe8\xe9\xea\xeb" . "\xec\xed\xee\xef\xf1\xf2\xf3" . "\xf4\xf5\xf6\xf8\xf9\xfa\xfb" . "\xfc\xfd\xff"; $chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; $string = strtr( $string, $chars['in'], $chars['out'] ); $double_chars = array(); $double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" ); $double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' ); $string = str_replace( $double_chars['in'], $double_chars['out'], $string ); } return $string; } function sanitize_file_name( $filename ) { $filename_raw = $filename; $filename = remove_accents( $filename ); $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) ); static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { $utf8_pcre = @preg_match( '/^./u', 'a' ); } if ( ! seems_utf8( $filename ) ) { $_ext = pathinfo( $filename, PATHINFO_EXTENSION ); $_name = pathinfo( $filename, PATHINFO_FILENAME ); $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext; } if ( $utf8_pcre ) { $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); } $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); $filename = str_replace( $special_chars, '', $filename ); $filename = str_replace( array( '%20', '+' ), '-', $filename ); $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); $filename = trim( $filename, '.-_' ); if ( false === strpos( $filename, '.' ) ) { $mime_types = wp_get_mime_types(); $filetype = wp_check_filetype( 'test.' . $filename, $mime_types ); if ( $filetype['ext'] === $filename ) { $filename = 'unnamed-file.' . $filetype['ext']; } } $parts = explode( '.', $filename ); if ( count( $parts ) <= 2 ) { return apply_filters( 'sanitize_file_name', $filename, $filename_raw ); } $filename = array_shift( $parts ); $extension = array_pop( $parts ); $mimes = get_allowed_mime_types(); foreach ( (array) $parts as $part ) { $filename .= '.' . $part; if ( preg_match( '/^[a-zA-Z]{2,5}\d?$/', $part ) ) { $allowed = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!^(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $part ) ) { $allowed = true; break; } } if ( ! $allowed ) { $filename .= '_'; } } } $filename .= '.' . $extension; return apply_filters( 'sanitize_file_name', $filename, $filename_raw ); } function sanitize_user( $username, $strict = false ) { $raw_username = $username; $username = wp_strip_all_tags( $username ); $username = remove_accents( $username ); $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); $username = preg_replace( '/&.+?;/', '', $username ); if ( $strict ) { $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); } $username = trim( $username ); $username = preg_replace( '|\s+|', ' ', $username ); return apply_filters( 'sanitize_user', $username, $raw_username, $strict ); } function sanitize_key( $key ) { $sanitized_key = ''; if ( is_scalar( $key ) ) { $sanitized_key = strtolower( $key ); $sanitized_key = preg_replace( '/[^a-z0-9_\-]/', '', $sanitized_key ); } return apply_filters( 'sanitize_key', $sanitized_key, $key ); } function sanitize_title( $title, $fallback_title = '', $context = 'save' ) { $raw_title = $title; if ( 'save' === $context ) { $title = remove_accents( $title ); } $title = apply_filters( 'sanitize_title', $title, $raw_title, $context ); if ( '' === $title || false === $title ) { $title = $fallback_title; } return $title; } function sanitize_title_for_query( $title ) { return sanitize_title( $title, '', 'query' ); } function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { $title = strip_tags( $title ); $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); $title = str_replace( '%', '', $title ); $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); if ( seems_utf8( $title ) ) { if ( function_exists( 'mb_strtolower' ) ) { $title = mb_strtolower( $title, 'UTF-8' ); } $title = utf8_uri_encode( $title, 200 ); } $title = strtolower( $title ); if ( 'save' === $context ) { $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title ); $title = str_replace( '/', '-', $title ); $title = str_replace( array( '%c2%ad', '%c2%a1', '%c2%bf', '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba', '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d', '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f', '%e2%80%a2', '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2', '%c2%b4', '%cb%8a', '%cc%81', '%cd%81', '%cc%80', '%cc%84', '%cc%8c', '%e2%80%8b', '%e2%80%8c', '%e2%80%8d', '%e2%80%8e', '%e2%80%8f', '%e2%80%aa', '%e2%80%ab', '%e2%80%ac', '%e2%80%ad', '%e2%80%ae', '%ef%bb%bf', ), '', $title ); $title = str_replace( array( '%e2%80%80', '%e2%80%81', '%e2%80%82', '%e2%80%83', '%e2%80%84', '%e2%80%85', '%e2%80%86', '%e2%80%87', '%e2%80%88', '%e2%80%89', '%e2%80%8a', '%e2%80%a8', '%e2%80%a9', '%e2%80%af', ), '-', $title ); $title = str_replace( '%c3%97', 'x', $title ); } $title = preg_replace( '/&.+?;/', '', $title ); $title = str_replace( '.', '-', $title ); $title = preg_replace( '/[^%a-z0-9 _-]/', '', $title ); $title = preg_replace( '/\s+/', '-', $title ); $title = preg_replace( '|-+|', '-', $title ); $title = trim( $title, '-' ); return $title; } function sanitize_sql_orderby( $orderby ) { if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) { return $orderby; } return false; } function sanitize_html_class( $class, $fallback = '' ) { $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class ); $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized ); if ( '' === $sanitized && $fallback ) { return sanitize_html_class( $fallback ); } return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback ); } function convert_chars( $content, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '0.71' ); } if ( strpos( $content, '&' ) !== false ) { $content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content ); } return $content; } function convert_invalid_entities( $content ) { $wp_htmltranswinuni = array( '€' => '€', '' => '', '‚' => '‚', 'ƒ' => 'ƒ', '„' => '„', '…' => '…', '†' => '†', '‡' => '‡', 'ˆ' => 'ˆ', '‰' => '‰', 'Š' => 'Š', '‹' => '‹', 'Œ' => 'Œ', '' => '', 'Ž' => 'Ž', '' => '', '' => '', '‘' => '‘', '’' => '’', '“' => '“', '”' => '”', '•' => '•', '–' => '–', '—' => '—', '˜' => '˜', '™' => '™', 'š' => 'š', '›' => '›', 'œ' => 'œ', '' => '', 'ž' => 'ž', 'Ÿ' => 'Ÿ', ); if ( strpos( $content, '' ) !== false ) { $content = strtr( $content, $wp_htmltranswinuni ); } return $content; } function balanceTags( $text, $force = false ) { if ( $force || (int) get_option( 'use_balanceTags' ) === 1 ) { return force_balance_tags( $text ); } else { return $text; } } function force_balance_tags( $text ) { $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track', 'wbr' ); $nestable_tags = array( 'article', 'aside', 'blockquote', 'details', 'div', 'figure', 'object', 'q', 'section', 'span' ); $text = str_replace( '< !--', '< !--', $text ); $text = preg_replace( '#<([0-9]{1})#', '<$1', $text ); $tag_pattern = ( '#<' . '(/?)' . '(' . '(?:[a-z](?:[a-z0-9._]*)-(?:[a-z0-9._-]+)+)' . '|' . '(?:[\w:]+)' . ')' . '(?:' . '\s*' . '(/?)' . '|' . '(\s+)' . '([^>]*)' . ')' . '>#' ); while ( preg_match( $tag_pattern, $text, $regex ) ) { $full_match = $regex[0]; $has_leading_slash = ! empty( $regex[1] ); $tag_name = $regex[2]; $tag = strtolower( $tag_name ); $is_single_tag = in_array( $tag, $single_tags, true ); $pre_attribute_ws = isset( $regex[4] ) ? $regex[4] : ''; $attributes = trim( isset( $regex[5] ) ? $regex[5] : $regex[3] ); $has_self_closer = '/' === substr( $attributes, -1 ); $newtext .= $tagqueue; $i = strpos( $text, $full_match ); $l = strlen( $full_match ); $tagqueue = ''; if ( $has_leading_slash ) { if ( $stacksize <= 0 ) { $tag = ''; } elseif ( $tagstack[ $stacksize - 1 ] === $tag ) { $tag = ''; array_pop( $tagstack ); $stacksize--; } else { for ( $j = $stacksize - 1; $j >= 0; $j-- ) { if ( $tagstack[ $j ] === $tag ) { for ( $k = $stacksize - 1; $k >= $j; $k-- ) { $tagqueue .= ''; $stacksize--; } break; } } $tag = ''; } } else { if ( $has_self_closer ) { if ( ! $is_single_tag ) { $attributes = trim( substr( $attributes, 0, -1 ) ) . "> 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) { $tagqueue = ''; $stacksize--; } $stacksize = array_push( $tagstack, $tag ); } if ( $has_self_closer && $is_single_tag ) { $pre_attribute_ws = ' '; } $tag = '<' . $tag . $pre_attribute_ws . $attributes . '>'; if ( ! empty( $tagqueue ) ) { $tagqueue .= $tag; $tag = ''; } } $newtext .= substr( $text, 0, $i ) . $tag; $text = substr( $text, $i + $l ); } $newtext .= $tagqueue; $newtext .= $text; while ( $x = array_pop( $tagstack ) ) { $newtext .= ''; } $newtext = str_replace( '< !--', ' + +

      + +
      + + + cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?> +
      + + + +
      + + +
        +
        +
        + +
        + +
        + + + +

        + + + + +

        +
        +
        + 'nav_menu_instance', 'render_callback' => array( $this, 'render_nav_menu_partial' ), 'container_inclusive' => true, 'settings' => array(), 'capability' => 'edit_theme_options', ) ); } return $partial_args; } public function customize_preview_init() { add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) ); add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 ); add_filter( 'wp_nav_menu', array( $this, 'filter_wp_nav_menu' ), 10, 2 ); add_filter( 'wp_footer', array( $this, 'export_preview_data' ), 1 ); add_filter( 'customize_render_partials_response', array( $this, 'export_partial_rendered_nav_menu_instances' ) ); } public function make_auto_draft_status_previewable() { global $wp_post_statuses; $wp_post_statuses['auto-draft']->protected = true; } public function sanitize_nav_menus_created_posts( $value ) { $post_ids = array(); foreach ( wp_parse_id_list( $value ) as $post_id ) { if ( empty( $post_id ) ) { continue; } $post = get_post( $post_id ); if ( 'auto-draft' !== $post->post_status && 'draft' !== $post->post_status ) { continue; } $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj ) { continue; } if ( ! current_user_can( $post_type_obj->cap->publish_posts ) || ! current_user_can( 'edit_post', $post_id ) ) { continue; } $post_ids[] = $post->ID; } return $post_ids; } public function save_nav_menus_created_posts( $setting ) { $post_ids = $setting->post_value(); if ( ! empty( $post_ids ) ) { foreach ( $post_ids as $post_id ) { $current_status = get_post_status( $post_id ); if ( 'auto-draft' !== $current_status && 'draft' !== $current_status ) { continue; } $target_status = 'attachment' === get_post_type( $post_id ) ? 'inherit' : 'publish'; $args = array( 'ID' => $post_id, 'post_status' => $target_status, ); $post_name = get_post_meta( $post_id, '_customize_draft_post_name', true ); if ( $post_name ) { $args['post_name'] = $post_name; } wp_update_post( wp_slash( $args ) ); delete_post_meta( $post_id, '_customize_draft_post_name' ); } } } public function filter_wp_nav_menu_args( $args ) { $can_partial_refresh = ( ! empty( $args['echo'] ) && ( empty( $args['fallback_cb'] ) || is_string( $args['fallback_cb'] ) ) && ( empty( $args['walker'] ) || is_string( $args['walker'] ) ) && ( ! empty( $args['theme_location'] ) || ( ! empty( $args['menu'] ) && ( is_numeric( $args['menu'] ) || is_object( $args['menu'] ) ) ) ) && ( ! empty( $args['container'] ) || ( isset( $args['items_wrap'] ) && '<' === substr( $args['items_wrap'], 0, 1 ) ) ) ); $args['can_partial_refresh'] = $can_partial_refresh; $exported_args = $args; if ( ! $can_partial_refresh ) { $exported_args['fallback_cb'] = ''; $exported_args['walker'] = ''; } if ( ! empty( $exported_args['menu'] ) && is_object( $exported_args['menu'] ) ) { $exported_args['menu'] = $exported_args['menu']->term_id; } ksort( $exported_args ); $exported_args['args_hmac'] = $this->hash_nav_menu_args( $exported_args ); $args['customize_preview_nav_menus_args'] = $exported_args; $this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args; return $args; } public function filter_wp_nav_menu( $nav_menu_content, $args ) { if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) { $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) ); $attributes .= ' data-customize-partial-type="nav_menu_instance"'; $attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) ); $nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . str_replace( '\\', '\\\\', $attributes ), $nav_menu_content, 1 ); } return $nav_menu_content; } public function hash_nav_menu_args( $args ) { return wp_hash( serialize( $args ) ); } public function customize_preview_enqueue_deps() { wp_enqueue_script( 'customize-preview-nav-menus' ); } public function export_preview_data() { $exports = array( 'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args, ); printf( '', wp_json_encode( $exports ) ); } public function export_partial_rendered_nav_menu_instances( $response ) { $response['nav_menu_instance_args'] = $this->preview_nav_menu_instance_args; return $response; } public function render_nav_menu_partial( $partial, $nav_menu_args ) { unset( $partial ); if ( ! isset( $nav_menu_args['args_hmac'] ) ) { return false; } $nav_menu_args_hmac = $nav_menu_args['args_hmac']; unset( $nav_menu_args['args_hmac'] ); ksort( $nav_menu_args ); if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) { return false; } ob_start(); wp_nav_menu( $nav_menu_args ); $content = ob_get_clean(); return $content; } } public_query_vars, true ) ) { $this->public_query_vars[] = $qv; } } public function remove_query_var( $name ) { $this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) ); } public function set_query_var( $key, $value ) { $this->query_vars[ $key ] = $value; } public function parse_request( $extra_query_vars = '' ) { global $wp_rewrite; if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) { return false; } $this->query_vars = array(); $post_type_query_vars = array(); if ( is_array( $extra_query_vars ) ) { $this->extra_query_vars = & $extra_query_vars; } elseif ( ! empty( $extra_query_vars ) ) { parse_str( $extra_query_vars, $this->extra_query_vars ); } $rewrite = $wp_rewrite->wp_rewrite_rules(); if ( ! empty( $rewrite ) ) { $error = '404'; $this->did_permalink = true; $pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : ''; list( $pathinfo ) = explode( '?', $pathinfo ); $pathinfo = str_replace( '%', '%25', $pathinfo ); list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] ); $self = $_SERVER['PHP_SELF']; $home_path = parse_url( home_url(), PHP_URL_PATH ); $home_path_regex = ''; if ( is_string( $home_path ) && '' !== $home_path ) { $home_path = trim( $home_path, '/' ); $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); } $req_uri = str_replace( $pathinfo, '', $req_uri ); $req_uri = trim( $req_uri, '/' ); $pathinfo = trim( $pathinfo, '/' ); $self = trim( $self, '/' ); if ( ! empty( $home_path_regex ) ) { $req_uri = preg_replace( $home_path_regex, '', $req_uri ); $req_uri = trim( $req_uri, '/' ); $pathinfo = preg_replace( $home_path_regex, '', $pathinfo ); $pathinfo = trim( $pathinfo, '/' ); $self = preg_replace( $home_path_regex, '', $self ); $self = trim( $self, '/' ); } if ( ! empty( $pathinfo ) && ! preg_match( '|^.*' . $wp_rewrite->index . '$|', $pathinfo ) ) { $requested_path = $pathinfo; } else { if ( $req_uri == $wp_rewrite->index ) { $req_uri = ''; } $requested_path = $req_uri; } $requested_file = $req_uri; $this->request = $requested_path; $request_match = $requested_path; if ( empty( $request_match ) ) { if ( isset( $rewrite['$'] ) ) { $this->matched_rule = '$'; $query = $rewrite['$']; $matches = array( '' ); } } else { foreach ( (array) $rewrite as $match => $query ) { if ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) { $request_match = $requested_file . '/' . $requested_path; } if ( preg_match( "#^$match#", $request_match, $matches ) || preg_match( "#^$match#", urldecode( $request_match ), $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } $this->matched_rule = $match; break; } } } if ( ! empty( $this->matched_rule ) ) { $query = preg_replace( '!^.+\?!', '', $query ); $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); $this->matched_query = $query; parse_str( $query, $perma_query_vars ); if ( '404' == $error ) { unset( $error, $_GET['error'] ); } } if ( empty( $requested_path ) || $requested_file == $self || strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { unset( $error, $_GET['error'] ); if ( isset( $perma_query_vars ) && strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { unset( $perma_query_vars ); } $this->did_permalink = false; } } $this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars ); foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { if ( is_post_type_viewable( $t ) && $t->query_var ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } foreach ( $this->public_query_vars as $wpvar ) { if ( isset( $this->extra_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $this->extra_query_vars[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_POST[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_POST[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_GET[ $wpvar ]; } elseif ( isset( $perma_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $perma_query_vars[ $wpvar ]; } if ( ! empty( $this->query_vars[ $wpvar ] ) ) { if ( ! is_array( $this->query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = (string) $this->query_vars[ $wpvar ]; } else { foreach ( $this->query_vars[ $wpvar ] as $vkey => $v ) { if ( is_scalar( $v ) ) { $this->query_vars[ $wpvar ][ $vkey ] = (string) $v; } } } if ( isset( $post_type_query_vars[ $wpvar ] ) ) { $this->query_vars['post_type'] = $post_type_query_vars[ $wpvar ]; $this->query_vars['name'] = $this->query_vars[ $wpvar ]; } } } foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) { if ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) { $this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] ); } } if ( ! is_admin() ) { foreach ( get_taxonomies( array( 'publicly_queryable' => false ), 'objects' ) as $taxonomy => $t ) { if ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) { unset( $this->query_vars['taxonomy'], $this->query_vars['term'] ); } } } if ( isset( $this->query_vars['post_type'] ) ) { $queryable_post_types = get_post_types( array( 'publicly_queryable' => true ) ); if ( ! is_array( $this->query_vars['post_type'] ) ) { if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types, true ) ) { unset( $this->query_vars['post_type'] ); } } else { $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types ); } } $this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars ); foreach ( (array) $this->private_query_vars as $var ) { if ( isset( $this->extra_query_vars[ $var ] ) ) { $this->query_vars[ $var ] = $this->extra_query_vars[ $var ]; } } if ( isset( $error ) ) { $this->query_vars['error'] = $error; } $this->query_vars = apply_filters( 'request', $this->query_vars ); do_action_ref_array( 'parse_request', array( &$this ) ); return true; } public function send_headers() { $headers = array(); $status = null; $exit_required = false; $date_format = 'D, d M Y H:i:s'; if ( is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } elseif ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $expires = 10 * MINUTE_IN_SECONDS; $headers['Expires'] = gmdate( $date_format, time() + $expires ); $headers['Cache-Control'] = sprintf( 'max-age=%d, must-revalidate', $expires ); } if ( ! empty( $this->query_vars['error'] ) ) { $status = (int) $this->query_vars['error']; if ( 404 === $status ) { if ( ! is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } $headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ); } elseif ( in_array( $status, array( 403, 500, 502, 503 ), true ) ) { $exit_required = true; } } elseif ( empty( $this->query_vars['feed'] ) ) { $headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ); } else { $type = $this->query_vars['feed']; if ( 'feed' === $this->query_vars['feed'] ) { $type = get_default_feed(); } $headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' ); if ( ! empty( $this->query_vars['withcomments'] ) || false !== strpos( $this->query_vars['feed'], 'comments-' ) || ( empty( $this->query_vars['withoutcomments'] ) && ( ! empty( $this->query_vars['p'] ) || ! empty( $this->query_vars['name'] ) || ! empty( $this->query_vars['page_id'] ) || ! empty( $this->query_vars['pagename'] ) || ! empty( $this->query_vars['attachment'] ) || ! empty( $this->query_vars['attachment_id'] ) ) ) ) { $wp_last_modified_post = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false ); $wp_last_modified_comment = mysql2date( $date_format, get_lastcommentmodified( 'GMT' ), false ); if ( strtotime( $wp_last_modified_post ) > strtotime( $wp_last_modified_comment ) ) { $wp_last_modified = $wp_last_modified_post; } else { $wp_last_modified = $wp_last_modified_comment; } } else { $wp_last_modified = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false ); } if ( ! $wp_last_modified ) { $wp_last_modified = gmdate( $date_format ); } $wp_last_modified .= ' GMT'; $wp_etag = '"' . md5( $wp_last_modified ) . '"'; $headers['Last-Modified'] = $wp_last_modified; $headers['ETag'] = $wp_etag; if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) { $client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] ); } else { $client_etag = false; } $client_last_modified = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; $wp_modified_timestamp = strtotime( $wp_last_modified ); if ( ( $client_last_modified && $client_etag ) ? ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag == $wp_etag ) ) : ( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag == $wp_etag ) ) ) { $status = 304; $exit_required = true; } } $headers = apply_filters( 'wp_headers', $headers, $this ); if ( ! empty( $status ) ) { status_header( $status ); } if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) { unset( $headers['Last-Modified'] ); if ( ! headers_sent() ) { header_remove( 'Last-Modified' ); } } if ( ! headers_sent() ) { foreach ( (array) $headers as $name => $field_value ) { header( "{$name}: {$field_value}" ); } } if ( $exit_required ) { exit; } do_action_ref_array( 'send_headers', array( &$this ) ); } public function build_query_string() { $this->query_string = ''; foreach ( (array) array_keys( $this->query_vars ) as $wpvar ) { if ( '' != $this->query_vars[ $wpvar ] ) { $this->query_string .= ( strlen( $this->query_string ) < 1 ) ? '' : '&'; if ( ! is_scalar( $this->query_vars[ $wpvar ] ) ) { continue; } $this->query_string .= $wpvar . '=' . rawurlencode( $this->query_vars[ $wpvar ] ); } } if ( has_filter( 'query_string' ) ) { $this->query_string = apply_filters_deprecated( 'query_string', array( $this->query_string ), '2.1.0', 'query_vars, request' ); parse_str( $this->query_string, $this->query_vars ); } } public function register_globals() { global $wp_query; foreach ( (array) $wp_query->query_vars as $key => $value ) { $GLOBALS[ $key ] = $value; } $GLOBALS['query_string'] = $this->query_string; $GLOBALS['posts'] = & $wp_query->posts; $GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null; $GLOBALS['request'] = $wp_query->request; if ( $wp_query->is_single() || $wp_query->is_page() ) { $GLOBALS['more'] = 1; $GLOBALS['single'] = 1; } if ( $wp_query->is_author() ) { $GLOBALS['authordata'] = get_userdata( get_queried_object_id() ); } } public function init() { wp_get_current_user(); } public function query_posts() { global $wp_the_query; $this->build_query_string(); $wp_the_query->query( $this->query_vars ); } public function handle_404() { global $wp_query; if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) { return; } if ( is_404() ) { return; } $set_404 = true; if ( is_admin() || is_robots() || is_favicon() ) { $set_404 = false; } elseif ( $wp_query->posts ) { $content_found = true; if ( is_singular() ) { $post = isset( $wp_query->post ) ? $wp_query->post : null; if ( $post && pings_open( $post ) && ! headers_sent() ) { header( 'X-Pingback: ' . get_bloginfo( 'pingback_url', 'display' ) ); } $next = ''; if ( $post && ! empty( $this->query_vars['page'] ) ) { if ( false !== strpos( $post->post_content, $next ) ) { $page = trim( $this->query_vars['page'], '/' ); $content_found = (int) $page <= ( substr_count( $post->post_content, $next ) + 1 ); } else { $content_found = false; } } } if ( $wp_query->is_posts_page && ! empty( $this->query_vars['page'] ) ) { $content_found = false; } if ( $content_found ) { $set_404 = false; } } elseif ( ! is_paged() ) { $author = get_query_var( 'author' ); if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) || ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() || is_home() || is_search() || is_feed() ) { $set_404 = false; } } if ( $set_404 ) { $wp_query->set_404(); status_header( 404 ); nocache_headers(); } else { status_header( 200 ); } } public function main( $query_args = '' ) { $this->init(); $parsed = $this->parse_request( $query_args ); $this->send_headers(); if ( $parsed ) { $this->query_posts(); $this->handle_404(); $this->register_globals(); } do_action_ref_array( 'wp', array( &$this ) ); } } 'parent', 'id' => 'term_id', ); public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $category = $data_object; $pad = str_repeat( ' ', $depth * 3 ); $cat_name = apply_filters( 'list_cats', $category->name, $category ); if ( isset( $args['value_field'] ) && isset( $category->{$args['value_field']} ) ) { $value_field = $args['value_field']; } else { $value_field = 'term_id'; } $output .= "\t\n"; } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); public $meta_query = false; protected $meta_query_clauses; public $date_query = false; public $query_vars; public $query_var_defaults; public $sites; public $found_sites = 0; public $max_num_pages = 0; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'fields' => '', 'ID' => '', 'site__in' => '', 'site__not_in' => '', 'number' => 100, 'offset' => '', 'no_found_rows' => true, 'orderby' => 'id', 'order' => 'ASC', 'network_id' => 0, 'network__in' => '', 'network__not_in' => '', 'domain' => '', 'domain__in' => '', 'domain__not_in' => '', 'path' => '', 'path__in' => '', 'path__not_in' => '', 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'lang_id' => null, 'lang__in' => '', 'lang__not_in' => '', 'search' => '', 'search_columns' => array(), 'count' => false, 'date_query' => null, 'update_site_cache' => true, 'update_site_meta_cache' => true, 'meta_query' => '', 'meta_key' => '', 'meta_value' => '', 'meta_type' => '', 'meta_compare' => '', ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_site_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_sites(); } public function get_sites() { global $wpdb; $this->parse_query(); $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $this->query_vars ); do_action_ref_array( 'pre_get_sites', array( &$this ) ); $this->meta_query->parse_query_vars( $this->query_vars ); if ( ! empty( $this->meta_query->queries ) ) { $this->meta_query_clauses = $this->meta_query->get_sql( 'blog', $wpdb->blogs, 'blog_id', $this ); } $site_data = null; $site_data = apply_filters_ref_array( 'sites_pre_query', array( $site_data, &$this ) ); if ( null !== $site_data ) { if ( is_array( $site_data ) && ! $this->query_vars['count'] ) { $this->sites = $site_data; } return $site_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_site_cache'], $_args['update_site_meta_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'sites' ); $cache_key = "get_sites:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'sites' ); if ( false === $cache_value ) { $site_ids = $this->get_site_ids(); if ( $site_ids ) { $this->set_found_sites(); } $cache_value = array( 'site_ids' => $site_ids, 'found_sites' => $this->found_sites, ); wp_cache_add( $cache_key, $cache_value, 'sites' ); } else { $site_ids = $cache_value['site_ids']; $this->found_sites = $cache_value['found_sites']; } if ( $this->found_sites && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $site_ids; } $site_ids = array_map( 'intval', $site_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->sites = $site_ids; return $this->sites; } if ( $this->query_vars['update_site_cache'] ) { _prime_site_caches( $site_ids, $this->query_vars['update_site_meta_cache'] ); } $_sites = array(); foreach ( $site_ids as $site_id ) { $_site = get_site( $site_id ); if ( $_site ) { $_sites[] = $_site; } } $_sites = apply_filters_ref_array( 'the_sites', array( $_sites, &$this ) ); $this->sites = array_map( 'get_site', $_sites ); return $this->sites; } protected function get_site_ids() { global $wpdb; $order = $this->parse_order( $this->query_vars['order'] ); if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'site__in' === $_orderby || 'network__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "{$wpdb->blogs}.blog_id $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "{$wpdb->blogs}.blog_id"; } $site_id = absint( $this->query_vars['ID'] ); if ( ! empty( $site_id ) ) { $this->sql_clauses['where']['ID'] = $wpdb->prepare( "{$wpdb->blogs}.blog_id = %d", $site_id ); } if ( ! empty( $this->query_vars['site__in'] ) ) { $this->sql_clauses['where']['site__in'] = "{$wpdb->blogs}.blog_id IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['site__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['site__not_in'] ) ) { $this->sql_clauses['where']['site__not_in'] = "{$wpdb->blogs}.blog_id NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['site__not_in'] ) ) . ' )'; } $network_id = absint( $this->query_vars['network_id'] ); if ( ! empty( $network_id ) ) { $this->sql_clauses['where']['network_id'] = $wpdb->prepare( 'site_id = %d', $network_id ); } if ( ! empty( $this->query_vars['network__in'] ) ) { $this->sql_clauses['where']['network__in'] = 'site_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['network__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['network__not_in'] ) ) { $this->sql_clauses['where']['network__not_in'] = 'site_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['network__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['domain'] ) ) { $this->sql_clauses['where']['domain'] = $wpdb->prepare( 'domain = %s', $this->query_vars['domain'] ); } if ( is_array( $this->query_vars['domain__in'] ) ) { $this->sql_clauses['where']['domain__in'] = "domain IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['domain__not_in'] ) ) { $this->sql_clauses['where']['domain__not_in'] = "domain NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__not_in'] ) ) . "' )"; } if ( ! empty( $this->query_vars['path'] ) ) { $this->sql_clauses['where']['path'] = $wpdb->prepare( 'path = %s', $this->query_vars['path'] ); } if ( is_array( $this->query_vars['path__in'] ) ) { $this->sql_clauses['where']['path__in'] = "path IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['path__not_in'] ) ) { $this->sql_clauses['where']['path__not_in'] = "path NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__not_in'] ) ) . "' )"; } if ( is_numeric( $this->query_vars['archived'] ) ) { $archived = absint( $this->query_vars['archived'] ); $this->sql_clauses['where']['archived'] = $wpdb->prepare( 'archived = %s ', absint( $archived ) ); } if ( is_numeric( $this->query_vars['mature'] ) ) { $mature = absint( $this->query_vars['mature'] ); $this->sql_clauses['where']['mature'] = $wpdb->prepare( 'mature = %d ', $mature ); } if ( is_numeric( $this->query_vars['spam'] ) ) { $spam = absint( $this->query_vars['spam'] ); $this->sql_clauses['where']['spam'] = $wpdb->prepare( 'spam = %d ', $spam ); } if ( is_numeric( $this->query_vars['deleted'] ) ) { $deleted = absint( $this->query_vars['deleted'] ); $this->sql_clauses['where']['deleted'] = $wpdb->prepare( 'deleted = %d ', $deleted ); } if ( is_numeric( $this->query_vars['public'] ) ) { $public = absint( $this->query_vars['public'] ); $this->sql_clauses['where']['public'] = $wpdb->prepare( 'public = %d ', $public ); } if ( is_numeric( $this->query_vars['lang_id'] ) ) { $lang_id = absint( $this->query_vars['lang_id'] ); $this->sql_clauses['where']['lang_id'] = $wpdb->prepare( 'lang_id = %d ', $lang_id ); } if ( ! empty( $this->query_vars['lang__in'] ) ) { $this->sql_clauses['where']['lang__in'] = 'lang_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['lang__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['lang__not_in'] ) ) { $this->sql_clauses['where']['lang__not_in'] = 'lang_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['lang__not_in'] ) ) . ' )'; } if ( strlen( $this->query_vars['search'] ) ) { $search_columns = array(); if ( $this->query_vars['search_columns'] ) { $search_columns = array_intersect( $this->query_vars['search_columns'], array( 'domain', 'path' ) ); } if ( ! $search_columns ) { $search_columns = array( 'domain', 'path' ); } $search_columns = apply_filters( 'site_search_columns', $search_columns, $this->query_vars['search'], $this ); $this->sql_clauses['where']['search'] = $this->get_search_sql( $this->query_vars['search'], $search_columns ); } $date_query = $this->query_vars['date_query']; if ( ! empty( $date_query ) && is_array( $date_query ) ) { $this->date_query = new WP_Date_Query( $date_query, 'registered' ); $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } $join = ''; $groupby = ''; if ( ! empty( $this->meta_query_clauses ) ) { $join .= $this->meta_query_clauses['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $this->meta_query_clauses['where'] ); if ( ! $this->query_vars['count'] ) { $groupby = "{$wpdb->blogs}.blog_id"; } } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->blogs $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " + {$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']} + "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } $site_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $site_ids ); } private function set_found_sites() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_sites_query = apply_filters( 'found_sites_query', 'SELECT FOUND_ROWS()', $this ); $this->found_sites = (int) $wpdb->get_var( $found_sites_query ); } } protected function get_search_sql( $search, $columns ) { global $wpdb; if ( false !== strpos( $search, '*' ) ) { $like = '%' . implode( '%', array_map( array( $wpdb, 'esc_like' ), explode( '*', $search ) ) ) . '%'; } else { $like = '%' . $wpdb->esc_like( $search ) . '%'; } $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return '(' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $parsed = false; switch ( $orderby ) { case 'site__in': $site__in = implode( ',', array_map( 'absint', $this->query_vars['site__in'] ) ); $parsed = "FIELD( {$wpdb->blogs}.blog_id, $site__in )"; break; case 'network__in': $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->blogs}.site_id, $network__in )"; break; case 'domain': case 'last_updated': case 'path': case 'registered': case 'deleted': case 'spam': case 'mature': case 'archived': case 'public': $parsed = $orderby; break; case 'network_id': $parsed = 'site_id'; break; case 'domain_length': $parsed = 'CHAR_LENGTH(domain)'; break; case 'path_length': $parsed = 'CHAR_LENGTH(path)'; break; case 'id': $parsed = "{$wpdb->blogs}.blog_id"; break; } if ( ! empty( $parsed ) || empty( $this->meta_query_clauses ) ) { return $parsed; } $meta_clauses = $this->meta_query->get_clauses(); if ( empty( $meta_clauses ) ) { return $parsed; } $primary_meta_query = reset( $meta_clauses ); if ( ! empty( $primary_meta_query['key'] ) && $primary_meta_query['key'] === $orderby ) { $orderby = 'meta_value'; } switch ( $orderby ) { case 'meta_value': if ( ! empty( $primary_meta_query['type'] ) ) { $parsed = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})"; } else { $parsed = "{$primary_meta_query['alias']}.meta_value"; } break; case 'meta_value_num': $parsed = "{$primary_meta_query['alias']}.meta_value+0"; break; default: if ( isset( $meta_clauses[ $orderby ] ) ) { $meta_clause = $meta_clauses[ $orderby ]; $parsed = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})"; } } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'ASC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->sections = array(); } final public function active() { $panel = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_panel_active', $active, $panel ); return $active; } public function active_callback() { return true; } public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type' ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; $array['autoExpandSoleSection'] = $this->auto_expand_sole_section; return $array; } public function check_capabilities() { if ( $this->capability && ! current_user_can( $this->capability ) ) { return false; } if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_panel', $this ); do_action( "customize_render_panel_{$this->id}" ); $this->render(); } protected function render() {} protected function render_content() {} public function print_template() { ?> + + + +
      • +

        + {{ data.title }} + +

        +
          +
        • + +
        • + +
          + + {{ data.title }}' ); ?> + + <# if ( data.description ) { #> + + <# } #> +
          + <# if ( data.description ) { #> +
          + {{{ data.description }}} +
          + <# } #> -.create-application-password label { - font-weight: 600; -} +
          +
        • + array(), 'a' => array( 'href' => true, 'rel' => true, 'rev' => true, 'name' => true, 'target' => true, 'download' => array( 'valueless' => 'y', ), ), 'abbr' => array(), 'acronym' => array(), 'area' => array( 'alt' => true, 'coords' => true, 'href' => true, 'nohref' => true, 'shape' => true, 'target' => true, ), 'article' => array( 'align' => true, ), 'aside' => array( 'align' => true, ), 'audio' => array( 'autoplay' => true, 'controls' => true, 'loop' => true, 'muted' => true, 'preload' => true, 'src' => true, ), 'b' => array(), 'bdo' => array(), 'big' => array(), 'blockquote' => array( 'cite' => true, ), 'br' => array(), 'button' => array( 'disabled' => true, 'name' => true, 'type' => true, 'value' => true, ), 'caption' => array( 'align' => true, ), 'cite' => array(), 'code' => array(), 'col' => array( 'align' => true, 'char' => true, 'charoff' => true, 'span' => true, 'valign' => true, 'width' => true, ), 'colgroup' => array( 'align' => true, 'char' => true, 'charoff' => true, 'span' => true, 'valign' => true, 'width' => true, ), 'del' => array( 'datetime' => true, ), 'dd' => array(), 'dfn' => array(), 'details' => array( 'align' => true, 'open' => true, ), 'div' => array( 'align' => true, ), 'dl' => array(), 'dt' => array(), 'em' => array(), 'fieldset' => array(), 'figure' => array( 'align' => true, ), 'figcaption' => array( 'align' => true, ), 'font' => array( 'color' => true, 'face' => true, 'size' => true, ), 'footer' => array( 'align' => true, ), 'h1' => array( 'align' => true, ), 'h2' => array( 'align' => true, ), 'h3' => array( 'align' => true, ), 'h4' => array( 'align' => true, ), 'h5' => array( 'align' => true, ), 'h6' => array( 'align' => true, ), 'header' => array( 'align' => true, ), 'hgroup' => array( 'align' => true, ), 'hr' => array( 'align' => true, 'noshade' => true, 'size' => true, 'width' => true, ), 'i' => array(), 'img' => array( 'alt' => true, 'align' => true, 'border' => true, 'height' => true, 'hspace' => true, 'loading' => true, 'longdesc' => true, 'vspace' => true, 'src' => true, 'usemap' => true, 'width' => true, ), 'ins' => array( 'datetime' => true, 'cite' => true, ), 'kbd' => array(), 'label' => array( 'for' => true, ), 'legend' => array( 'align' => true, ), 'li' => array( 'align' => true, 'value' => true, ), 'main' => array( 'align' => true, ), 'map' => array( 'name' => true, ), 'mark' => array(), 'menu' => array( 'type' => true, ), 'nav' => array( 'align' => true, ), 'object' => array( 'data' => array( 'required' => true, 'value_callback' => '_wp_kses_allow_pdf_objects', ), 'type' => array( 'required' => true, 'values' => array( 'application/pdf' ), ), ), 'p' => array( 'align' => true, ), 'pre' => array( 'width' => true, ), 'q' => array( 'cite' => true, ), 'rb' => array(), 'rp' => array(), 'rt' => array(), 'rtc' => array(), 'ruby' => array(), 's' => array(), 'samp' => array(), 'span' => array( 'align' => true, ), 'section' => array( 'align' => true, ), 'small' => array(), 'strike' => array(), 'strong' => array(), 'sub' => array(), 'summary' => array( 'align' => true, ), 'sup' => array(), 'table' => array( 'align' => true, 'bgcolor' => true, 'border' => true, 'cellpadding' => true, 'cellspacing' => true, 'rules' => true, 'summary' => true, 'width' => true, ), 'tbody' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'td' => array( 'abbr' => true, 'align' => true, 'axis' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'colspan' => true, 'headers' => true, 'height' => true, 'nowrap' => true, 'rowspan' => true, 'scope' => true, 'valign' => true, 'width' => true, ), 'textarea' => array( 'cols' => true, 'rows' => true, 'disabled' => true, 'name' => true, 'readonly' => true, ), 'tfoot' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'th' => array( 'abbr' => true, 'align' => true, 'axis' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'colspan' => true, 'headers' => true, 'height' => true, 'nowrap' => true, 'rowspan' => true, 'scope' => true, 'valign' => true, 'width' => true, ), 'thead' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'title' => array(), 'tr' => array( 'align' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'track' => array( 'default' => true, 'kind' => true, 'label' => true, 'src' => true, 'srclang' => true, ), 'tt' => array(), 'u' => array(), 'ul' => array( 'type' => true, ), 'ol' => array( 'start' => true, 'type' => true, 'reversed' => true, ), 'var' => array(), 'video' => array( 'autoplay' => true, 'controls' => true, 'height' => true, 'loop' => true, 'muted' => true, 'playsinline' => true, 'poster' => true, 'preload' => true, 'src' => true, 'width' => true, ), ); $allowedtags = array( 'a' => array( 'href' => true, 'title' => true, ), 'abbr' => array( 'title' => true, ), 'acronym' => array( 'title' => true, ), 'b' => array(), 'blockquote' => array( 'cite' => true, ), 'cite' => array(), 'code' => array(), 'del' => array( 'datetime' => true, ), 'em' => array(), 'i' => array(), 'q' => array( 'cite' => true, ), 's' => array(), 'strike' => array(), 'strong' => array(), ); $allowedentitynames = array( 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', 'sup1', 'sup2', 'sup3', 'frac14', 'frac12', 'frac34', 'there4', ); $allowedxmlentitynames = array( 'amp', 'lt', 'gt', 'apos', 'quot', ); $allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags ); } else { $allowedtags = wp_kses_array_lc( $allowedtags ); $allowedposttags = wp_kses_array_lc( $allowedposttags ); } function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) { if ( empty( $allowed_protocols ) ) { $allowed_protocols = wp_allowed_protocols(); } $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) ); $string = wp_kses_normalize_entities( $string ); $string = wp_kses_hook( $string, $allowed_html, $allowed_protocols ); return wp_kses_split( $string, $allowed_html, $allowed_protocols ); } function wp_kses_one_attr( $string, $element ) { $uris = wp_kses_uri_attributes(); $allowed_html = wp_kses_allowed_html( 'post' ); $allowed_protocols = wp_allowed_protocols(); $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) ); $matches = array(); preg_match( '/^\s*/', $string, $matches ); $lead = $matches[0]; preg_match( '/\s*$/', $string, $matches ); $trail = $matches[0]; if ( empty( $trail ) ) { $string = substr( $string, strlen( $lead ) ); } else { $string = substr( $string, strlen( $lead ), -strlen( $trail ) ); } $split = preg_split( '/\s*=\s*/', $string, 2 ); $name = $split[0]; if ( count( $split ) == 2 ) { $value = $split[1]; if ( '' === $value ) { $quote = ''; } else { $quote = $value[0]; } if ( '"' === $quote || "'" === $quote ) { if ( substr( $value, -1 ) != $quote ) { return ''; } $value = substr( $value, 1, -1 ); } else { $quote = '"'; } $value = esc_attr( $value ); if ( in_array( strtolower( $name ), $uris, true ) ) { $value = wp_kses_bad_protocol( $value, $allowed_protocols ); } $string = "$name=$quote$value$quote"; $vless = 'n'; } else { $value = ''; $vless = 'y'; } wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html ); return $lead . $string . $trail; } function wp_kses_allowed_html( $context = '' ) { global $allowedposttags, $allowedtags, $allowedentitynames; if ( is_array( $context ) ) { $html = $context; $context = 'explicit'; return apply_filters( 'wp_kses_allowed_html', $html, $context ); } switch ( $context ) { case 'post': $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context ); if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) { $tags = $allowedposttags; $tags['form'] = array( 'action' => true, 'accept' => true, 'accept-charset' => true, 'enctype' => true, 'method' => true, 'name' => true, 'target' => true, ); $tags = apply_filters( 'wp_kses_allowed_html', $tags, $context ); } return $tags; case 'user_description': case 'pre_user_description': $tags = $allowedtags; $tags['a']['rel'] = true; return apply_filters( 'wp_kses_allowed_html', $tags, $context ); case 'strip': return apply_filters( 'wp_kses_allowed_html', array(), $context ); case 'entities': return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context ); case 'data': default: return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context ); } } function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) { return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols ); } function wp_kses_version() { return '0.2.2'; } function wp_kses_split( $string, $allowed_html, $allowed_protocols ) { global $pass_allowed_html, $pass_allowed_protocols; $pass_allowed_html = $allowed_html; $pass_allowed_protocols = $allowed_protocols; return preg_replace_callback( '%(|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string ); } function wp_kses_uri_attributes() { $uri_attributes = array( 'action', 'archive', 'background', 'cite', 'classid', 'codebase', 'data', 'formaction', 'href', 'icon', 'longdesc', 'manifest', 'poster', 'profile', 'src', 'usemap', 'xmlns', ); $uri_attributes = apply_filters( 'wp_kses_uri_attributes', $uri_attributes ); return $uri_attributes; } function _wp_kses_split_callback( $match ) { global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2( $match[0], $pass_allowed_html, $pass_allowed_protocols ); } function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) { $string = wp_kses_stripslashes( $string ); if ( '<' !== substr( $string, 0, 1 ) ) { return '>'; } if ( '' ), '', $string ); while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) { $string = $newstring; } if ( '' === $string ) { return ''; } $string = preg_replace( '/--+/', '-', $string ); $string = preg_replace( '/-$/', '', $string ); return ""; } if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $string, $matches ) ) { return ''; } $slash = trim( $matches[1] ); $elem = $matches[2]; $attrlist = $matches[3]; if ( ! is_array( $allowed_html ) ) { $allowed_html = wp_kses_allowed_html( $allowed_html ); } if ( ! isset( $allowed_html[ strtolower( $elem ) ] ) ) { return ''; } if ( '' !== $slash ) { return ""; } return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols ); } function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) { if ( ! is_array( $allowed_html ) ) { $allowed_html = wp_kses_allowed_html( $allowed_html ); } $xhtml_slash = ''; if ( preg_match( '%\s*/\s*$%', $attr ) ) { $xhtml_slash = ' /'; } $element_low = strtolower( $element ); if ( empty( $allowed_html[ $element_low ] ) || true === $allowed_html[ $element_low ] ) { return "<$element$xhtml_slash>"; } $attrarr = wp_kses_hair( $attr, $allowed_protocols ); $required_attrs = array_filter( $allowed_html[ $element_low ], function( $required_attr_limits ) { return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required']; } ); $stripped_tag = ''; if ( empty( $xhtml_slash ) ) { $stripped_tag = "<$element>"; } $attr2 = ''; foreach ( $attrarr as $arreach ) { $required = isset( $required_attrs[ strtolower( $arreach['name'] ) ] ); if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) { $attr2 .= ' ' . $arreach['whole']; if ( $required ) { unset( $required_attrs[ strtolower( $arreach['name'] ) ] ); } } elseif ( $required ) { return $stripped_tag; } } if ( ! empty( $required_attrs ) ) { return $stripped_tag; } $attr2 = preg_replace( '/[<>]/', '', $attr2 ); return "<$element$attr2$xhtml_slash>"; } function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) { $name_low = strtolower( $name ); $element_low = strtolower( $element ); if ( ! isset( $allowed_html[ $element_low ] ) ) { $name = ''; $value = ''; $whole = ''; return false; } $allowed_attr = $allowed_html[ $element_low ]; if ( ! isset( $allowed_attr[ $name_low ] ) || '' === $allowed_attr[ $name_low ] ) { if ( strpos( $name_low, 'data-' ) === 0 && ! empty( $allowed_attr['data-*'] ) && preg_match( '/^data(?:-[a-z0-9_]+)+$/', $name_low, $match ) ) { $allowed_attr[ $match[0] ] = $allowed_attr['data-*']; } else { $name = ''; $value = ''; $whole = ''; return false; } } if ( 'style' === $name_low ) { $new_value = safecss_filter_attr( $value ); if ( empty( $new_value ) ) { $name = ''; $value = ''; $whole = ''; return false; } $whole = str_replace( $value, $new_value, $whole ); $value = $new_value; } if ( is_array( $allowed_attr[ $name_low ] ) ) { foreach ( $allowed_attr[ $name_low ] as $currkey => $currval ) { if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) { $name = ''; $value = ''; $whole = ''; return false; } } } return true; } function wp_kses_hair( $attr, $allowed_protocols ) { $attrarr = array(); $mode = 0; $attrname = ''; $uris = wp_kses_uri_attributes(); while ( strlen( $attr ) != 0 ) { $working = 0; switch ( $mode ) { case 0: if ( preg_match( '/^([_a-zA-Z][-_a-zA-Z0-9:.]*)/', $attr, $match ) ) { $attrname = $match[1]; $working = 1; $mode = 1; $attr = preg_replace( '/^[_a-zA-Z][-_a-zA-Z0-9:.]*/', '', $attr ); } break; case 1: if ( preg_match( '/^\s*=\s*/', $attr ) ) { $working = 1; $mode = 2; $attr = preg_replace( '/^\s*=\s*/', '', $attr ); break; } if ( preg_match( '/^\s+/', $attr ) ) { $working = 1; $mode = 0; if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } $attr = preg_replace( '/^\s+/', '', $attr ); } break; case 2: if ( preg_match( '%^"([^"]*)"(\s+|/?$)%', $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( '/^"[^"]*"(\s+|$)/', '', $attr ); break; } if ( preg_match( "%^'([^']*)'(\s+|/?$)%", $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( "/^'[^']*'(\s+|$)/", '', $attr ); break; } if ( preg_match( "%^([^\s\"']+)(\s+|/?$)%", $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( "%^[^\s\"']+(\s+|$)%", '', $attr ); } break; } if ( 0 == $working ) { $attr = wp_kses_html_error( $attr ); $mode = 0; } } if ( 1 == $mode && false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } return $attrarr; } function wp_kses_attr_parse( $element ) { $valid = preg_match( '%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches ); if ( 1 !== $valid ) { return false; } $begin = $matches[1]; $slash = $matches[2]; $elname = $matches[3]; $attr = $matches[4]; $end = $matches[5]; if ( '' !== $slash ) { return false; } if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) { $xhtml_slash = $matches[0]; $attr = substr( $attr, 0, -strlen( $xhtml_slash ) ); } else { $xhtml_slash = ''; } $attrarr = wp_kses_hair_parse( $attr ); if ( false === $attrarr ) { return false; } array_unshift( $attrarr, $begin . $slash . $elname ); array_push( $attrarr, $xhtml_slash . $end ); return $attrarr; } function wp_kses_hair_parse( $attr ) { if ( '' === $attr ) { return array(); } $regex = '(?:' . '[_a-zA-Z][-_a-zA-Z0-9:.]*' . '|' . '\[\[?[^\[\]]+\]\]?' . ')' . '(?:' . '\s*=\s*' . '(?:' . '"[^"]*"' . '|' . "'[^']*'" . '|' . '[^\s"\']+' . '(?:\s|$)' . ')' . '|' . '(?:\s|$)' . ')' . '\s*'; $validation = "%^($regex)+$%"; $extraction = "%$regex%"; if ( 1 === preg_match( $validation, $attr ) ) { preg_match_all( $extraction, $attr, $attrarr ); return $attrarr[0]; } else { return false; } } function wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) { $ok = true; switch ( strtolower( $checkname ) ) { case 'maxlen': if ( strlen( $value ) > $checkvalue ) { $ok = false; } break; case 'minlen': if ( strlen( $value ) < $checkvalue ) { $ok = false; } break; case 'maxval': if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) { $ok = false; } if ( $value > $checkvalue ) { $ok = false; } break; case 'minval': if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) { $ok = false; } if ( $value < $checkvalue ) { $ok = false; } break; case 'valueless': if ( strtolower( $checkvalue ) != $vless ) { $ok = false; } break; case 'values': if ( false === array_search( strtolower( $value ), $checkvalue, true ) ) { $ok = false; } break; case 'value_callback': if ( ! call_user_func( $checkvalue, $value ) ) { $ok = false; } break; } return $ok; } function wp_kses_bad_protocol( $string, $allowed_protocols ) { $string = wp_kses_no_null( $string ); $iterations = 0; do { $original_string = $string; $string = wp_kses_bad_protocol_once( $string, $allowed_protocols ); } while ( $original_string != $string && ++$iterations < 6 ); if ( $original_string != $string ) { return ''; } return $string; } function wp_kses_no_null( $string, $options = null ) { if ( ! isset( $options['slash_zero'] ) ) { $options = array( 'slash_zero' => 'remove' ); } $string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string ); if ( 'remove' === $options['slash_zero'] ) { $string = preg_replace( '/\\\\+0+/', '', $string ); } return $string; } function wp_kses_stripslashes( $string ) { return preg_replace( '%\\\\"%', '"', $string ); } function wp_kses_array_lc( $inarray ) { $outarray = array(); foreach ( (array) $inarray as $inkey => $inval ) { $outkey = strtolower( $inkey ); $outarray[ $outkey ] = array(); foreach ( (array) $inval as $inkey2 => $inval2 ) { $outkey2 = strtolower( $inkey2 ); $outarray[ $outkey ][ $outkey2 ] = $inval2; } } return $outarray; } function wp_kses_html_error( $string ) { return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string ); } function wp_kses_bad_protocol_once( $string, $allowed_protocols, $count = 1 ) { $string = preg_replace( '/(�*58(?![;0-9])|�*3a(?![;a-f0-9]))/i', '$1;', $string ); $string2 = preg_split( '/:|�*58;|�*3a;|:/i', $string, 2 ); if ( isset( $string2[1] ) && ! preg_match( '%/\?%', $string2[0] ) ) { $string = trim( $string2[1] ); $protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ); if ( 'feed:' === $protocol ) { if ( $count > 2 ) { return ''; } $string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count ); if ( empty( $string ) ) { return $string; } } $string = $protocol . $string; } return $string; } function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) { $string2 = wp_kses_decode_entities( $string ); $string2 = preg_replace( '/\s/', '', $string2 ); $string2 = wp_kses_no_null( $string2 ); $string2 = strtolower( $string2 ); $allowed = false; foreach ( (array) $allowed_protocols as $one_protocol ) { if ( strtolower( $one_protocol ) == $string2 ) { $allowed = true; break; } } if ( $allowed ) { return "$string2:"; } else { return ''; } } function wp_kses_normalize_entities( $string, $context = 'html' ) { $string = str_replace( '&', '&', $string ); if ( 'xml' === $context ) { $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $string ); } else { $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string ); } $string = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string ); $string = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string ); return $string; } function wp_kses_named_entities( $matches ) { global $allowedentitynames; if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; return ( ! in_array( $i, $allowedentitynames, true ) ) ? "&$i;" : "&$i;"; } function wp_kses_xml_named_entities( $matches ) { global $allowedentitynames, $allowedxmlentitynames; if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; if ( in_array( $i, $allowedxmlentitynames, true ) ) { return "&$i;"; } elseif ( in_array( $i, $allowedentitynames, true ) ) { return html_entity_decode( "&$i;", ENT_HTML5 ); } return "&$i;"; } function wp_kses_normalize_entities2( $matches ) { if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; if ( valid_unicode( $i ) ) { $i = str_pad( ltrim( $i, '0' ), 3, '0', STR_PAD_LEFT ); $i = "&#$i;"; } else { $i = "&#$i;"; } return $i; } function wp_kses_normalize_entities3( $matches ) { if ( empty( $matches[1] ) ) { return ''; } $hexchars = $matches[1]; return ( ! valid_unicode( hexdec( $hexchars ) ) ) ? "&#x$hexchars;" : '&#x' . ltrim( $hexchars, '0' ) . ';'; } function valid_unicode( $i ) { return ( 0x9 == $i || 0xa == $i || 0xd == $i || ( 0x20 <= $i && $i <= 0xd7ff ) || ( 0xe000 <= $i && $i <= 0xfffd ) || ( 0x10000 <= $i && $i <= 0x10ffff ) ); } function wp_kses_decode_entities( $string ) { $string = preg_replace_callback( '/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string ); $string = preg_replace_callback( '/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string ); return $string; } function _wp_kses_decode_entities_chr( $match ) { return chr( $match[1] ); } function _wp_kses_decode_entities_chr_hexdec( $match ) { return chr( hexdec( $match[1] ) ); } function wp_filter_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), current_filter() ) ); } function wp_kses_data( $data ) { return wp_kses( $data, current_filter() ); } function wp_filter_post_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'post' ) ); } function wp_filter_global_styles_post( $data ) { $decoded_data = json_decode( wp_unslash( $data ), true ); $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE === $json_decoding_error && is_array( $decoded_data ) && isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) && $decoded_data['isGlobalStylesUserThemeJSON'] ) { unset( $decoded_data['isGlobalStylesUserThemeJSON'] ); $data_to_encode = WP_Theme_JSON::remove_insecure_properties( $decoded_data ); $data_to_encode['isGlobalStylesUserThemeJSON'] = true; return wp_slash( wp_json_encode( $data_to_encode ) ); } return $data; } function wp_kses_post( $data ) { return wp_kses( $data, 'post' ); } function wp_kses_post_deep( $data ) { return map_deep( $data, 'wp_kses_post' ); } function wp_filter_nohtml_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'strip' ) ); } function kses_init_filters() { add_filter( 'title_save_pre', 'wp_filter_kses' ); if ( current_user_can( 'unfiltered_html' ) ) { add_filter( 'pre_comment_content', 'wp_filter_post_kses' ); } else { add_filter( 'pre_comment_content', 'wp_filter_kses' ); } add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 ); add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 ); add_filter( 'content_save_pre', 'wp_filter_post_kses' ); add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' ); add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' ); } function kses_remove_filters() { remove_filter( 'title_save_pre', 'wp_filter_kses' ); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); remove_filter( 'pre_comment_content', 'wp_filter_kses' ); remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 ); remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 ); remove_filter( 'content_save_pre', 'wp_filter_post_kses' ); remove_filter( 'excerpt_save_pre', 'wp_filter_post_kses' ); remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' ); } function kses_init() { kses_remove_filters(); if ( ! current_user_can( 'unfiltered_html' ) ) { kses_init_filters(); } } function safecss_filter_attr( $css, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); } $css = wp_kses_no_null( $css ); $css = str_replace( array( "\n", "\r", "\t" ), '', $css ); $allowed_protocols = wp_allowed_protocols(); $css_array = explode( ';', trim( $css ) ); $allowed_attr = apply_filters( 'safe_style_css', array( 'background', 'background-color', 'background-image', 'background-position', 'background-size', 'background-attachment', 'background-blend-mode', 'border', 'border-radius', 'border-width', 'border-color', 'border-style', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-top-left-radius', 'border-top-right-radius', 'border-spacing', 'border-collapse', 'caption-side', 'columns', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-span', 'column-width', 'color', 'filter', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-align', 'text-decoration', 'text-indent', 'text-transform', 'height', 'min-height', 'max-height', 'width', 'min-width', 'max-width', 'margin', 'margin-right', 'margin-bottom', 'margin-left', 'margin-top', 'padding', 'padding-right', 'padding-bottom', 'padding-left', 'padding-top', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'grid-template-columns', 'grid-auto-columns', 'grid-column-start', 'grid-column-end', 'grid-column-gap', 'grid-template-rows', 'grid-auto-rows', 'grid-row-start', 'grid-row-end', 'grid-row-gap', 'grid-gap', 'justify-content', 'justify-items', 'justify-self', 'align-content', 'align-items', 'align-self', 'clear', 'cursor', 'direction', 'float', 'list-style-type', 'object-position', 'overflow', 'vertical-align', ) ); $css_url_data_types = array( 'background', 'background-image', 'cursor', 'list-style', 'list-style-image', ); $css_gradient_data_types = array( 'background', 'background-image', ); if ( empty( $allowed_attr ) ) { return $css; } $css = ''; foreach ( $css_array as $css_item ) { if ( '' === $css_item ) { continue; } $css_item = trim( $css_item ); $css_test_string = $css_item; $found = false; $url_attr = false; $gradient_attr = false; if ( strpos( $css_item, ':' ) === false ) { $found = true; } else { $parts = explode( ':', $css_item, 2 ); $css_selector = trim( $parts[0] ); if ( in_array( $css_selector, $allowed_attr, true ) ) { $found = true; $url_attr = in_array( $css_selector, $css_url_data_types, true ); $gradient_attr = in_array( $css_selector, $css_gradient_data_types, true ); } } if ( $found && $url_attr ) { preg_match_all( '/url\([^)]+\)/', $parts[1], $url_matches ); foreach ( $url_matches[0] as $url_match ) { preg_match( '/^url\(\s*([\'\"]?)(.*)(\g1)\s*\)$/', $url_match, $url_pieces ); if ( empty( $url_pieces[2] ) ) { $found = false; break; } $url = trim( $url_pieces[2] ); if ( empty( $url ) || wp_kses_bad_protocol( $url, $allowed_protocols ) !== $url ) { $found = false; break; } else { $css_test_string = str_replace( $url_match, '', $css_test_string ); } } } if ( $found && $gradient_attr ) { $css_value = trim( $parts[1] ); if ( preg_match( '/^(repeating-)?(linear|radial|conic)-gradient\(([^()]|rgb[a]?\([^()]*\))*\)$/', $css_value ) ) { $css_test_string = str_replace( $css_value, '', $css_test_string ); } } if ( $found ) { $css_test_string = preg_replace( '/calc\(((?:\([^()]*\)?|[^()])*)\)/', '', $css_test_string ); $css_test_string = preg_replace( '/\(?var\(--[a-zA-Z0-9_-]*\)/', '', $css_test_string ); $allow_css = ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ); $allow_css = apply_filters( 'safecss_filter_attr_allow_css', $allow_css, $css_test_string ); if ( $allow_css ) { if ( '' !== $css ) { $css .= ';'; } $css .= $css_item; } } } return $css; } function _wp_add_global_attributes( $value ) { $global_attributes = array( 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'data-*' => true, 'dir' => true, 'id' => true, 'lang' => true, 'style' => true, 'title' => true, 'role' => true, 'xml:lang' => true, ); if ( true === $value ) { $value = array(); } if ( is_array( $value ) ) { return array_merge( $value, $global_attributes ); } return $value; } function _wp_kses_allow_pdf_objects( $url ) { if ( str_contains( $url, '?' ) || str_contains( $url, '#' ) ) { return false; } if ( ! str_ends_with( $url, '.pdf' ) ) { return false; } $upload_info = wp_upload_dir( null, false ); $parsed_url = wp_parse_url( $upload_info['url'] ); $upload_host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; $upload_port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; if ( str_starts_with( $url, "http://$upload_host$upload_port/" ) || str_starts_with( $url, "https://$upload_host$upload_port/" ) ) { return true; } return false; } array( 'name_admin_bar' => _x( 'Post', 'add new from admin bar' ), ), 'public' => true, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'map_meta_cap' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-admin-post', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ), 'show_in_rest' => true, 'rest_base' => 'posts', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'page', array( 'labels' => array( 'name_admin_bar' => _x( 'Page', 'add new from admin bar' ), ), 'public' => true, 'publicly_queryable' => false, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'page', 'map_meta_cap' => true, 'menu_position' => 20, 'menu_icon' => 'dashicons-admin-page', 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), 'show_in_rest' => true, 'rest_base' => 'pages', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'attachment', array( 'labels' => array( 'name' => _x( 'Media', 'post type general name' ), 'name_admin_bar' => _x( 'Media', 'add new from admin bar' ), 'add_new' => _x( 'Add New', 'add new media' ), 'edit_item' => __( 'Edit Media' ), 'view_item' => __( 'View Attachment Page' ), 'attributes' => __( 'Attachment Attributes' ), ), 'public' => true, 'show_ui' => true, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'capabilities' => array( 'create_posts' => 'upload_files', ), 'map_meta_cap' => true, 'menu_icon' => 'dashicons-admin-media', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'show_in_nav_menus' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'author', 'comments' ), 'show_in_rest' => true, 'rest_base' => 'media', 'rest_controller_class' => 'WP_REST_Attachments_Controller', ) ); add_post_type_support( 'attachment:audio', 'thumbnail' ); add_post_type_support( 'attachment:video', 'thumbnail' ); register_post_type( 'revision', array( 'labels' => array( 'name' => __( 'Revisions' ), 'singular_name' => __( 'Revision' ), ), 'public' => false, '_builtin' => true, '_edit_link' => 'revision.php?revision=%d', 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => true, 'supports' => array( 'author' ), ) ); register_post_type( 'nav_menu_item', array( 'labels' => array( 'name' => __( 'Navigation Menu Items' ), 'singular_name' => __( 'Navigation Menu Item' ), ), 'public' => false, '_builtin' => true, 'hierarchical' => false, 'rewrite' => false, 'delete_with_user' => false, 'query_var' => false, 'map_meta_cap' => true, 'capability_type' => array( 'edit_theme_options', 'edit_theme_options' ), 'capabilities' => array( 'edit_post' => 'edit_post', 'read_post' => 'read_post', 'delete_post' => 'delete_post', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'read' => 'read', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', ), 'show_in_rest' => true, 'rest_base' => 'menu-items', 'rest_controller_class' => 'WP_REST_Menu_Items_Controller', ) ); register_post_type( 'custom_css', array( 'labels' => array( 'name' => __( 'Custom CSS' ), 'singular_name' => __( 'Custom CSS' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => true, '_builtin' => true, 'supports' => array( 'title', 'revisions' ), 'capabilities' => array( 'delete_posts' => 'edit_theme_options', 'delete_post' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_post' => 'edit_css', 'edit_posts' => 'edit_css', 'edit_others_posts' => 'edit_css', 'edit_published_posts' => 'edit_css', 'read_post' => 'read', 'read_private_posts' => 'read', 'publish_posts' => 'edit_theme_options', ), ) ); register_post_type( 'customize_changeset', array( 'labels' => array( 'name' => _x( 'Changesets', 'post type general name' ), 'singular_name' => _x( 'Changeset', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Customize Changeset' ), 'add_new_item' => __( 'Add New Changeset' ), 'new_item' => __( 'New Changeset' ), 'edit_item' => __( 'Edit Changeset' ), 'view_item' => __( 'View Changeset' ), 'all_items' => __( 'All Changesets' ), 'search_items' => __( 'Search Changesets' ), 'not_found' => __( 'No changesets found.' ), 'not_found_in_trash' => __( 'No changesets found in Trash.' ), ), 'public' => false, '_builtin' => true, 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array( 'title', 'author' ), 'capability_type' => 'customize_changeset', 'capabilities' => array( 'create_posts' => 'customize', 'delete_others_posts' => 'customize', 'delete_post' => 'customize', 'delete_posts' => 'customize', 'delete_private_posts' => 'customize', 'delete_published_posts' => 'customize', 'edit_others_posts' => 'customize', 'edit_post' => 'customize', 'edit_posts' => 'customize', 'edit_private_posts' => 'customize', 'edit_published_posts' => 'do_not_allow', 'publish_posts' => 'customize', 'read' => 'read', 'read_post' => 'customize', 'read_private_posts' => 'customize', ), ) ); register_post_type( 'oembed_cache', array( 'labels' => array( 'name' => __( 'oEmbed Responses' ), 'singular_name' => __( 'oEmbed Response' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => false, '_builtin' => true, 'supports' => array(), ) ); register_post_type( 'user_request', array( 'labels' => array( 'name' => __( 'User Requests' ), 'singular_name' => __( 'User Request' ), ), 'public' => false, '_builtin' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array(), ) ); register_post_type( 'wp_block', array( 'labels' => array( 'name' => _x( 'Reusable blocks', 'post type general name' ), 'singular_name' => _x( 'Reusable block', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Reusable block' ), 'add_new_item' => __( 'Add new Reusable block' ), 'new_item' => __( 'New Reusable block' ), 'edit_item' => __( 'Edit Reusable block' ), 'view_item' => __( 'View Reusable block' ), 'all_items' => __( 'All Reusable blocks' ), 'search_items' => __( 'Search Reusable blocks' ), 'not_found' => __( 'No reusable blocks found.' ), 'not_found_in_trash' => __( 'No reusable blocks found in Trash.' ), 'filter_items_list' => __( 'Filter reusable blocks list' ), 'items_list_navigation' => __( 'Reusable blocks list navigation' ), 'items_list' => __( 'Reusable blocks list' ), 'item_published' => __( 'Reusable block published.' ), 'item_published_privately' => __( 'Reusable block published privately.' ), 'item_reverted_to_draft' => __( 'Reusable block reverted to draft.' ), 'item_scheduled' => __( 'Reusable block scheduled.' ), 'item_updated' => __( 'Reusable block updated.' ), ), 'public' => false, '_builtin' => true, 'show_ui' => true, 'show_in_menu' => false, 'rewrite' => false, 'show_in_rest' => true, 'rest_base' => 'blocks', 'rest_controller_class' => 'WP_REST_Blocks_Controller', 'capability_type' => 'block', 'capabilities' => array( 'read' => 'edit_posts', 'create_posts' => 'publish_posts', 'edit_posts' => 'edit_posts', 'edit_published_posts' => 'edit_published_posts', 'delete_published_posts' => 'delete_published_posts', 'edit_others_posts' => 'edit_others_posts', 'delete_others_posts' => 'delete_others_posts', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_template', array( 'labels' => array( 'name' => _x( 'Templates', 'post type general name' ), 'singular_name' => _x( 'Template', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template' ), 'add_new_item' => __( 'Add New Template' ), 'new_item' => __( 'New Template' ), 'edit_item' => __( 'Edit Template' ), 'view_item' => __( 'View Template' ), 'all_items' => __( 'Templates' ), 'search_items' => __( 'Search Templates' ), 'parent_item_colon' => __( 'Parent Template:' ), 'not_found' => __( 'No templates found.' ), 'not_found_in_trash' => __( 'No templates found in Trash.' ), 'archives' => __( 'Template archives' ), 'insert_into_item' => __( 'Insert into template' ), 'uploaded_to_this_item' => __( 'Uploaded to this template' ), 'filter_items_list' => __( 'Filter templates list' ), 'items_list_navigation' => __( 'Templates list navigation' ), 'items_list' => __( 'Templates list' ), ), 'description' => __( 'Templates to include in your theme.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'templates', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'capability_type' => array( 'template', 'templates' ), 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_template_part', array( 'labels' => array( 'name' => _x( 'Template Parts', 'post type general name' ), 'singular_name' => _x( 'Template Part', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template Part' ), 'add_new_item' => __( 'Add New Template Part' ), 'new_item' => __( 'New Template Part' ), 'edit_item' => __( 'Edit Template Part' ), 'view_item' => __( 'View Template Part' ), 'all_items' => __( 'Template Parts' ), 'search_items' => __( 'Search Template Parts' ), 'parent_item_colon' => __( 'Parent Template Part:' ), 'not_found' => __( 'No template parts found.' ), 'not_found_in_trash' => __( 'No template parts found in Trash.' ), 'archives' => __( 'Template part archives' ), 'insert_into_item' => __( 'Insert into template part' ), 'uploaded_to_this_item' => __( 'Uploaded to this template part' ), 'filter_items_list' => __( 'Filter template parts list' ), 'items_list_navigation' => __( 'Template parts list navigation' ), 'items_list' => __( 'Template parts list' ), ), 'description' => __( 'Template parts to include in your templates.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'template-parts', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'map_meta_cap' => true, 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_global_styles', array( 'label' => _x( 'Global Styles', 'post type general name' ), 'description' => __( 'Global styles to include in themes.' ), 'public' => false, '_builtin' => true, 'show_ui' => false, 'show_in_rest' => false, 'rewrite' => false, 'capabilities' => array( 'read' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_navigation', array( 'labels' => array( 'name' => _x( 'Navigation Menus', 'post type general name' ), 'singular_name' => _x( 'Navigation Menu', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Navigation Menu' ), 'add_new_item' => __( 'Add New Navigation Menu' ), 'new_item' => __( 'New Navigation Menu' ), 'edit_item' => __( 'Edit Navigation Menu' ), 'view_item' => __( 'View Navigation Menu' ), 'all_items' => __( 'Navigation Menus' ), 'search_items' => __( 'Search Navigation Menus' ), 'parent_item_colon' => __( 'Parent Navigation Menu:' ), 'not_found' => __( 'No Navigation Menu found.' ), 'not_found_in_trash' => __( 'No Navigation Menu found in Trash.' ), 'archives' => __( 'Navigation Menu archives' ), 'insert_into_item' => __( 'Insert into Navigation Menu' ), 'uploaded_to_this_item' => __( 'Uploaded to this Navigation Menu' ), 'filter_items_list' => __( 'Filter Navigation Menu list' ), 'items_list_navigation' => __( 'Navigation Menus list navigation' ), 'items_list' => __( 'Navigation Menus list' ), ), 'description' => __( 'Navigation menus that can be inserted into your site.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => true, 'show_in_menu' => false, 'show_in_admin_bar' => false, 'show_in_rest' => true, 'rewrite' => false, 'map_meta_cap' => true, 'capabilities' => array( 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', ), 'rest_base' => 'navigation', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_status( 'publish', array( 'label' => _x( 'Published', 'post status' ), 'public' => true, '_builtin' => true, 'label_count' => _n_noop( 'Published (%s)', 'Published (%s)' ), ) ); register_post_status( 'future', array( 'label' => _x( 'Scheduled', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Scheduled (%s)', 'Scheduled (%s)' ), ) ); register_post_status( 'draft', array( 'label' => _x( 'Draft', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Draft (%s)', 'Drafts (%s)' ), 'date_floating' => true, ) ); register_post_status( 'pending', array( 'label' => _x( 'Pending', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)' ), 'date_floating' => true, ) ); register_post_status( 'private', array( 'label' => _x( 'Private', 'post status' ), 'private' => true, '_builtin' => true, 'label_count' => _n_noop( 'Private (%s)', 'Private (%s)' ), ) ); register_post_status( 'trash', array( 'label' => _x( 'Trash', 'post status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Trash (%s)', 'Trash (%s)' ), 'show_in_admin_status_list' => true, ) ); register_post_status( 'auto-draft', array( 'label' => 'auto-draft', 'internal' => true, '_builtin' => true, 'date_floating' => true, ) ); register_post_status( 'inherit', array( 'label' => 'inherit', 'internal' => true, '_builtin' => true, 'exclude_from_search' => false, ) ); register_post_status( 'request-pending', array( 'label' => _x( 'Pending', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-confirmed', array( 'label' => _x( 'Confirmed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Confirmed (%s)', 'Confirmed (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-failed', array( 'label' => _x( 'Failed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Failed (%s)', 'Failed (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-completed', array( 'label' => _x( 'Completed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Completed (%s)', 'Completed (%s)' ), 'exclude_from_search' => false, ) ); } function get_attached_file( $attachment_id, $unfiltered = false ) { $file = get_post_meta( $attachment_id, '_wp_attached_file', true ); if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) ) { $uploads = wp_get_upload_dir(); if ( false === $uploads['error'] ) { $file = $uploads['basedir'] . "/$file"; } } if ( $unfiltered ) { return $file; } return apply_filters( 'get_attached_file', $file, $attachment_id ); } function update_attached_file( $attachment_id, $file ) { if ( ! get_post( $attachment_id ) ) { return false; } $file = apply_filters( 'update_attached_file', $file, $attachment_id ); $file = _wp_relative_upload_path( $file ); if ( $file ) { return update_post_meta( $attachment_id, '_wp_attached_file', $file ); } else { return delete_post_meta( $attachment_id, '_wp_attached_file' ); } } function _wp_relative_upload_path( $path ) { $new_path = $path; $uploads = wp_get_upload_dir(); if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) { $new_path = str_replace( $uploads['basedir'], '', $new_path ); $new_path = ltrim( $new_path, '/' ); } return apply_filters( '_wp_relative_upload_path', $new_path, $path ); } function get_children( $args = '', $output = OBJECT ) { $kids = array(); if ( empty( $args ) ) { if ( isset( $GLOBALS['post'] ) ) { $args = array( 'post_parent' => (int) $GLOBALS['post']->post_parent ); } else { return $kids; } } elseif ( is_object( $args ) ) { $args = array( 'post_parent' => (int) $args->post_parent ); } elseif ( is_numeric( $args ) ) { $args = array( 'post_parent' => (int) $args ); } $defaults = array( 'numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'post_parent' => 0, ); $parsed_args = wp_parse_args( $args, $defaults ); $children = get_posts( $parsed_args ); if ( ! $children ) { return $kids; } if ( ! empty( $parsed_args['fields'] ) ) { return $children; } update_post_cache( $children ); foreach ( $children as $key => $child ) { $kids[ $child->ID ] = $children[ $key ]; } if ( OBJECT === $output ) { return $kids; } elseif ( ARRAY_A === $output ) { $weeuns = array(); foreach ( (array) $kids as $kid ) { $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); } return $weeuns; } elseif ( ARRAY_N === $output ) { $babes = array(); foreach ( (array) $kids as $kid ) { $babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); } return $babes; } else { return $kids; } } function get_extended( $post ) { if ( preg_match( '//', $post, $matches ) ) { list($main, $extended) = explode( $matches[0], $post, 2 ); $more_text = $matches[1]; } else { $main = $post; $extended = ''; $more_text = ''; } $main = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $main ); $extended = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $extended ); $more_text = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $more_text ); return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text, ); } function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { if ( empty( $post ) && isset( $GLOBALS['post'] ) ) { $post = $GLOBALS['post']; } if ( $post instanceof WP_Post ) { $_post = $post; } elseif ( is_object( $post ) ) { if ( empty( $post->filter ) ) { $_post = sanitize_post( $post, 'raw' ); $_post = new WP_Post( $_post ); } elseif ( 'raw' === $post->filter ) { $_post = new WP_Post( $post ); } else { $_post = WP_Post::get_instance( $post->ID ); } } else { $_post = WP_Post::get_instance( $post ); } if ( ! $_post ) { return null; } $_post = $_post->filter( $filter ); if ( ARRAY_A === $output ) { return $_post->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_post->to_array() ); } return $_post; } function get_post_ancestors( $post ) { $post = get_post( $post ); if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) { return array(); } $ancestors = array(); $id = $post->post_parent; $ancestors[] = $id; while ( $ancestor = get_post( $id ) ) { if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors, true ) ) { break; } $id = $ancestor->post_parent; $ancestors[] = $id; } return $ancestors; } function get_post_field( $field, $post = null, $context = 'display' ) { $post = get_post( $post ); if ( ! $post ) { return ''; } if ( ! isset( $post->$field ) ) { return ''; } return sanitize_post_field( $field, $post->$field, $post->ID, $context ); } function get_post_mime_type( $post = null ) { $post = get_post( $post ); if ( is_object( $post ) ) { return $post->post_mime_type; } return false; } function get_post_status( $post = null ) { $post = get_post( $post ); if ( ! is_object( $post ) ) { return false; } $post_status = $post->post_status; if ( 'attachment' === $post->post_type && 'inherit' === $post_status ) { if ( 0 === $post->post_parent || ! get_post( $post->post_parent ) || $post->ID === $post->post_parent ) { $post_status = 'publish'; } elseif ( 'trash' === get_post_status( $post->post_parent ) ) { $post_status = get_post_meta( $post->post_parent, '_wp_trash_meta_status', true ); if ( ! $post_status ) { $post_status = 'publish'; } } else { $post_status = get_post_status( $post->post_parent ); } } elseif ( 'attachment' === $post->post_type && ! in_array( $post_status, array( 'private', 'trash', 'auto-draft' ), true ) ) { $post_status = 'publish'; } return apply_filters( 'get_post_status', $post_status, $post ); } function get_post_statuses() { $status = array( 'draft' => __( 'Draft' ), 'pending' => __( 'Pending Review' ), 'private' => __( 'Private' ), 'publish' => __( 'Published' ), ); return $status; } function get_page_statuses() { $status = array( 'draft' => __( 'Draft' ), 'private' => __( 'Private' ), 'publish' => __( 'Published' ), ); return $status; } function _wp_privacy_statuses() { return array( 'request-pending' => _x( 'Pending', 'request status' ), 'request-confirmed' => _x( 'Confirmed', 'request status' ), 'request-failed' => _x( 'Failed', 'request status' ), 'request-completed' => _x( 'Completed', 'request status' ), ); } function register_post_status( $post_status, $args = array() ) { global $wp_post_statuses; if ( ! is_array( $wp_post_statuses ) ) { $wp_post_statuses = array(); } $defaults = array( 'label' => false, 'label_count' => false, 'exclude_from_search' => null, '_builtin' => false, 'public' => null, 'internal' => null, 'protected' => null, 'private' => null, 'publicly_queryable' => null, 'show_in_admin_status_list' => null, 'show_in_admin_all_list' => null, 'date_floating' => null, ); $args = wp_parse_args( $args, $defaults ); $args = (object) $args; $post_status = sanitize_key( $post_status ); $args->name = $post_status; if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) { $args->internal = true; } if ( null === $args->public ) { $args->public = false; } if ( null === $args->private ) { $args->private = false; } if ( null === $args->protected ) { $args->protected = false; } if ( null === $args->internal ) { $args->internal = false; } if ( null === $args->publicly_queryable ) { $args->publicly_queryable = $args->public; } if ( null === $args->exclude_from_search ) { $args->exclude_from_search = $args->internal; } if ( null === $args->show_in_admin_all_list ) { $args->show_in_admin_all_list = ! $args->internal; } if ( null === $args->show_in_admin_status_list ) { $args->show_in_admin_status_list = ! $args->internal; } if ( null === $args->date_floating ) { $args->date_floating = false; } if ( false === $args->label ) { $args->label = $post_status; } if ( false === $args->label_count ) { $args->label_count = _n_noop( $args->label, $args->label ); } $wp_post_statuses[ $post_status ] = $args; return $args; } function get_post_status_object( $post_status ) { global $wp_post_statuses; if ( empty( $wp_post_statuses[ $post_status ] ) ) { return null; } return $wp_post_statuses[ $post_status ]; } function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_statuses; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_post_statuses, $args, $operator, $field ); } function is_post_type_hierarchical( $post_type ) { if ( ! post_type_exists( $post_type ) ) { return false; } $post_type = get_post_type_object( $post_type ); return $post_type->hierarchical; } function post_type_exists( $post_type ) { return (bool) get_post_type_object( $post_type ); } function get_post_type( $post = null ) { $post = get_post( $post ); if ( $post ) { return $post->post_type; } return false; } function get_post_type_object( $post_type ) { global $wp_post_types; if ( ! is_scalar( $post_type ) || empty( $wp_post_types[ $post_type ] ) ) { return null; } return $wp_post_types[ $post_type ]; } function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_types; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_post_types, $args, $operator, $field ); } function register_post_type( $post_type, $args = array() ) { global $wp_post_types; if ( ! is_array( $wp_post_types ) ) { $wp_post_types = array(); } $post_type = sanitize_key( $post_type ); if ( empty( $post_type ) || strlen( $post_type ) > 20 ) { _doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2.0' ); return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) ); } $post_type_object = new WP_Post_Type( $post_type, $args ); $post_type_object->add_supports(); $post_type_object->add_rewrite_rules(); $post_type_object->register_meta_boxes(); $wp_post_types[ $post_type ] = $post_type_object; $post_type_object->add_hooks(); $post_type_object->register_taxonomies(); do_action( 'registered_post_type', $post_type, $post_type_object ); do_action( "registered_post_type_{$post_type}", $post_type, $post_type_object ); return $post_type_object; } function unregister_post_type( $post_type ) { global $wp_post_types; if ( ! post_type_exists( $post_type ) ) { return new WP_Error( 'invalid_post_type', __( 'Invalid post type.' ) ); } $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object->_builtin ) { return new WP_Error( 'invalid_post_type', __( 'Unregistering a built-in post type is not allowed' ) ); } $post_type_object->remove_supports(); $post_type_object->remove_rewrite_rules(); $post_type_object->unregister_meta_boxes(); $post_type_object->remove_hooks(); $post_type_object->unregister_taxonomies(); unset( $wp_post_types[ $post_type ] ); do_action( 'unregistered_post_type', $post_type ); return true; } function get_post_type_capabilities( $args ) { if ( ! is_array( $args->capability_type ) ) { $args->capability_type = array( $args->capability_type, $args->capability_type . 's' ); } list( $singular_base, $plural_base ) = $args->capability_type; $default_capabilities = array( 'edit_post' => 'edit_' . $singular_base, 'read_post' => 'read_' . $singular_base, 'delete_post' => 'delete_' . $singular_base, 'edit_posts' => 'edit_' . $plural_base, 'edit_others_posts' => 'edit_others_' . $plural_base, 'delete_posts' => 'delete_' . $plural_base, 'publish_posts' => 'publish_' . $plural_base, 'read_private_posts' => 'read_private_' . $plural_base, ); if ( $args->map_meta_cap ) { $default_capabilities_for_mapping = array( 'read' => 'read', 'delete_private_posts' => 'delete_private_' . $plural_base, 'delete_published_posts' => 'delete_published_' . $plural_base, 'delete_others_posts' => 'delete_others_' . $plural_base, 'edit_private_posts' => 'edit_private_' . $plural_base, 'edit_published_posts' => 'edit_published_' . $plural_base, ); $default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping ); } $capabilities = array_merge( $default_capabilities, $args->capabilities ); if ( ! isset( $capabilities['create_posts'] ) ) { $capabilities['create_posts'] = $capabilities['edit_posts']; } if ( $args->map_meta_cap ) { _post_type_meta_capabilities( $capabilities ); } return (object) $capabilities; } function _post_type_meta_capabilities( $capabilities = null ) { global $post_type_meta_caps; foreach ( $capabilities as $core => $custom ) { if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ), true ) ) { $post_type_meta_caps[ $custom ] = $core; } } } function get_post_type_labels( $post_type_object ) { $nohier_vs_hier_defaults = WP_Post_Type::get_default_labels(); $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); $post_type = $post_type_object->name; $default_labels = clone $labels; $labels = apply_filters( "post_type_labels_{$post_type}", $labels ); $labels = (object) array_merge( (array) $default_labels, (array) $labels ); return $labels; } function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { $object->labels = (array) $object->labels; if ( isset( $object->label ) && empty( $object->labels['name'] ) ) { $object->labels['name'] = $object->label; } if ( ! isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) { $object->labels['singular_name'] = $object->labels['name']; } if ( ! isset( $object->labels['name_admin_bar'] ) ) { $object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name; } if ( ! isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) { $object->labels['menu_name'] = $object->labels['name']; } if ( ! isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) { $object->labels['all_items'] = $object->labels['menu_name']; } if ( ! isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) { $object->labels['archives'] = $object->labels['all_items']; } $defaults = array(); foreach ( $nohier_vs_hier_defaults as $key => $value ) { $defaults[ $key ] = $object->hierarchical ? $value[1] : $value[0]; } $labels = array_merge( $defaults, $object->labels ); $object->labels = (object) $object->labels; return (object) $labels; } function _add_post_type_submenus() { foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { $ptype_obj = get_post_type_object( $ptype ); if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) { continue; } add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" ); } } function add_post_type_support( $post_type, $feature, ...$args ) { global $_wp_post_type_features; $features = (array) $feature; foreach ( $features as $feature ) { if ( $args ) { $_wp_post_type_features[ $post_type ][ $feature ] = $args; } else { $_wp_post_type_features[ $post_type ][ $feature ] = true; } } } function remove_post_type_support( $post_type, $feature ) { global $_wp_post_type_features; unset( $_wp_post_type_features[ $post_type ][ $feature ] ); } function get_all_post_type_supports( $post_type ) { global $_wp_post_type_features; if ( isset( $_wp_post_type_features[ $post_type ] ) ) { return $_wp_post_type_features[ $post_type ]; } return array(); } function post_type_supports( $post_type, $feature ) { global $_wp_post_type_features; return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ); } function get_post_types_by_support( $feature, $operator = 'and' ) { global $_wp_post_type_features; $features = array_fill_keys( (array) $feature, true ); return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) ); } function set_post_type( $post_id = 0, $post_type = 'post' ) { global $wpdb; $post_type = sanitize_post_field( 'post_type', $post_type, $post_id, 'db' ); $return = $wpdb->update( $wpdb->posts, array( 'post_type' => $post_type ), array( 'ID' => $post_id ) ); clean_post_cache( $post_id ); return $return; } function is_post_type_viewable( $post_type ) { if ( is_scalar( $post_type ) ) { $post_type = get_post_type_object( $post_type ); if ( ! $post_type ) { return false; } } if ( ! is_object( $post_type ) ) { return false; } $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); } function is_post_status_viewable( $post_status ) { if ( is_scalar( $post_status ) ) { $post_status = get_post_status_object( $post_status ); if ( ! $post_status ) { return false; } } if ( ! is_object( $post_status ) || $post_status->internal || $post_status->protected ) { return false; } $is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status ); } function is_post_publicly_viewable( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $post_type = get_post_type( $post ); $post_status = get_post_status( $post ); return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status ); } function get_posts( $args = null ) { $defaults = array( 'numberposts' => 5, 'category' => 0, 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), 'exclude' => array(), 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'suppress_filters' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); if ( empty( $parsed_args['post_status'] ) ) { $parsed_args['post_status'] = ( 'attachment' === $parsed_args['post_type'] ) ? 'inherit' : 'publish'; } if ( ! empty( $parsed_args['numberposts'] ) && empty( $parsed_args['posts_per_page'] ) ) { $parsed_args['posts_per_page'] = $parsed_args['numberposts']; } if ( ! empty( $parsed_args['category'] ) ) { $parsed_args['cat'] = $parsed_args['category']; } if ( ! empty( $parsed_args['include'] ) ) { $incposts = wp_parse_id_list( $parsed_args['include'] ); $parsed_args['posts_per_page'] = count( $incposts ); $parsed_args['post__in'] = $incposts; } elseif ( ! empty( $parsed_args['exclude'] ) ) { $parsed_args['post__not_in'] = wp_parse_id_list( $parsed_args['exclude'] ); } $parsed_args['ignore_sticky_posts'] = true; $parsed_args['no_found_rows'] = true; $get_posts = new WP_Query; return $get_posts->query( $parsed_args ); } function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); } function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return delete_metadata( 'post', $post_id, $meta_key, $meta_value ); } function get_post_meta( $post_id, $key = '', $single = false ) { return get_metadata( 'post', $post_id, $key, $single ); } function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); } function delete_post_meta_by_key( $post_meta_key ) { return delete_metadata( 'post', null, $post_meta_key, '', true ); } function register_post_meta( $post_type, $meta_key, array $args ) { $args['object_subtype'] = $post_type; return register_meta( 'post', $meta_key, $args ); } function unregister_post_meta( $post_type, $meta_key ) { return unregister_meta_key( 'post', $meta_key, $post_type ); } function get_post_custom( $post_id = 0 ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } return get_post_meta( $post_id ); } function get_post_custom_keys( $post_id = 0 ) { $custom = get_post_custom( $post_id ); if ( ! is_array( $custom ) ) { return; } $keys = array_keys( $custom ); if ( $keys ) { return $keys; } } function get_post_custom_values( $key = '', $post_id = 0 ) { if ( ! $key ) { return null; } $custom = get_post_custom( $post_id ); return isset( $custom[ $key ] ) ? $custom[ $key ] : null; } function is_sticky( $post_id = 0 ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } $stickies = get_option( 'sticky_posts' ); if ( is_array( $stickies ) ) { $stickies = array_map( 'intval', $stickies ); $is_sticky = in_array( $post_id, $stickies, true ); } else { $is_sticky = false; } return apply_filters( 'is_sticky', $is_sticky, $post_id ); } function sanitize_post( $post, $context = 'display' ) { if ( is_object( $post ) ) { if ( isset( $post->filter ) && $context == $post->filter ) { return $post; } if ( ! isset( $post->ID ) ) { $post->ID = 0; } foreach ( array_keys( get_object_vars( $post ) ) as $field ) { $post->$field = sanitize_post_field( $field, $post->$field, $post->ID, $context ); } $post->filter = $context; } elseif ( is_array( $post ) ) { if ( isset( $post['filter'] ) && $context == $post['filter'] ) { return $post; } if ( ! isset( $post['ID'] ) ) { $post['ID'] = 0; } foreach ( array_keys( $post ) as $field ) { $post[ $field ] = sanitize_post_field( $field, $post[ $field ], $post['ID'], $context ); } $post['filter'] = $context; } return $post; } function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { $int_fields = array( 'ID', 'post_parent', 'menu_order' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } $array_int_fields = array( 'ancestors' ); if ( in_array( $field, $array_int_fields, true ) ) { $value = array_map( 'absint', $value ); return $value; } if ( 'raw' === $context ) { return $value; } $prefixed = false; if ( false !== strpos( $field, 'post_' ) ) { $prefixed = true; $field_no_prefix = str_replace( 'post_', '', $field ); } if ( 'edit' === $context ) { $format_to_edit = array( 'post_content', 'post_excerpt', 'post_title', 'post_password' ); if ( $prefixed ) { $value = apply_filters( "edit_{$field}", $value, $post_id ); $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id ); } else { $value = apply_filters( "edit_post_{$field}", $value, $post_id ); } if ( in_array( $field, $format_to_edit, true ) ) { if ( 'post_content' === $field ) { $value = format_to_edit( $value, user_can_richedit() ); } else { $value = format_to_edit( $value ); } } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { if ( $prefixed ) { $value = apply_filters( "pre_{$field}", $value ); $value = apply_filters( "{$field_no_prefix}_save_pre", $value ); } else { $value = apply_filters( "pre_post_{$field}", $value ); $value = apply_filters( "{$field}_pre", $value ); } } else { if ( $prefixed ) { $value = apply_filters( "{$field}", $value, $post_id, $context ); } else { $value = apply_filters( "post_{$field}", $value, $post_id, $context ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function stick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); $updated = false; if ( ! is_array( $stickies ) ) { $stickies = array(); } else { $stickies = array_unique( array_map( 'intval', $stickies ) ); } if ( ! in_array( $post_id, $stickies, true ) ) { $stickies[] = $post_id; $updated = update_option( 'sticky_posts', array_values( $stickies ) ); } if ( $updated ) { do_action( 'post_stuck', $post_id ); } } function unstick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); if ( ! is_array( $stickies ) ) { return; } $stickies = array_values( array_unique( array_map( 'intval', $stickies ) ) ); if ( ! in_array( $post_id, $stickies, true ) ) { return; } $offset = array_search( $post_id, $stickies, true ); if ( false === $offset ) { return; } array_splice( $stickies, $offset, 1 ); $updated = update_option( 'sticky_posts', $stickies ); if ( $updated ) { do_action( 'post_unstuck', $post_id ); } } function _count_posts_cache_key( $type = 'post', $perm = '' ) { $cache_key = 'posts-' . $type; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $cache_key .= '_' . $perm . '_' . get_current_user_id(); } } return $cache_key; } function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; if ( ! post_type_exists( $type ) ) { return new stdClass; } $cache_key = _count_posts_cache_key( $type, $perm ); $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { foreach ( get_post_stati() as $status ) { if ( ! isset( $counts->{$status} ) ) { $counts->{$status} = 0; } } return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id() ); } } $query .= ' GROUP BY post_status'; $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; } $counts = (object) $counts; wp_cache_set( $cache_key, $counts, 'counts' ); return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } function wp_count_attachments( $mime_type = '' ) { global $wpdb; $and = wp_post_mime_type_where( $mime_type ); $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A ); $counts = array(); foreach ( (array) $count as $row ) { $counts[ $row['post_mime_type'] ] = $row['num_posts']; } $counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and" ); return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type ); } function get_post_mime_types() { $post_mime_types = array( 'image' => array( __( 'Images' ), __( 'Manage Images' ), _n_noop( 'Image (%s)', 'Images (%s)' ), ), 'audio' => array( _x( 'Audio', 'file type group' ), __( 'Manage Audio' ), _n_noop( 'Audio (%s)', 'Audio (%s)' ), ), 'video' => array( _x( 'Video', 'file type group' ), __( 'Manage Video' ), _n_noop( 'Video (%s)', 'Video (%s)' ), ), 'document' => array( __( 'Documents' ), __( 'Manage Documents' ), _n_noop( 'Document (%s)', 'Documents (%s)' ), ), 'spreadsheet' => array( __( 'Spreadsheets' ), __( 'Manage Spreadsheets' ), _n_noop( 'Spreadsheet (%s)', 'Spreadsheets (%s)' ), ), 'archive' => array( _x( 'Archives', 'file type group' ), __( 'Manage Archives' ), _n_noop( 'Archive (%s)', 'Archives (%s)' ), ), ); $ext_types = wp_get_ext_types(); $mime_types = wp_get_mime_types(); foreach ( $post_mime_types as $group => $labels ) { if ( in_array( $group, array( 'image', 'audio', 'video' ), true ) ) { continue; } if ( ! isset( $ext_types[ $group ] ) ) { unset( $post_mime_types[ $group ] ); continue; } $group_mime_types = array(); foreach ( $ext_types[ $group ] as $extension ) { foreach ( $mime_types as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $group_mime_types[] = $mime; break; } } } $group_mime_types = implode( ',', array_unique( $group_mime_types ) ); $post_mime_types[ $group_mime_types ] = $labels; unset( $post_mime_types[ $group ] ); } return apply_filters( 'post_mime_types', $post_mime_types ); } function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) { $matches = array(); if ( is_string( $wildcard_mime_types ) ) { $wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) ); } if ( is_string( $real_mime_types ) ) { $real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) ); } $patternses = array(); $wild = '[-._a-z0-9]*'; foreach ( (array) $wildcard_mime_types as $type ) { $mimes = array_map( 'trim', explode( ',', $type ) ); foreach ( $mimes as $mime ) { $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) ); $patternses[][ $type ] = "^$regex$"; if ( false === strpos( $mime, '/' ) ) { $patternses[][ $type ] = "^$regex/"; $patternses[][ $type ] = $regex; } } } asort( $patternses ); foreach ( $patternses as $patterns ) { foreach ( $patterns as $type => $pattern ) { foreach ( (array) $real_mime_types as $real ) { if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ], true ) ) ) { $matches[ $type ][] = $real; } } } } return $matches; } function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) { $where = ''; $wildcards = array( '', '%', '%/%' ); if ( is_string( $post_mime_types ) ) { $post_mime_types = array_map( 'trim', explode( ',', $post_mime_types ) ); } $wheres = array(); foreach ( (array) $post_mime_types as $mime_type ) { $mime_type = preg_replace( '/\s/', '', $mime_type ); $slashpos = strpos( $mime_type, '/' ); if ( false !== $slashpos ) { $mime_group = preg_replace( '/[^-*.a-zA-Z0-9]/', '', substr( $mime_type, 0, $slashpos ) ); $mime_subgroup = preg_replace( '/[^-*.+a-zA-Z0-9]/', '', substr( $mime_type, $slashpos + 1 ) ); if ( empty( $mime_subgroup ) ) { $mime_subgroup = '*'; } else { $mime_subgroup = str_replace( '/', '', $mime_subgroup ); } $mime_pattern = "$mime_group/$mime_subgroup"; } else { $mime_pattern = preg_replace( '/[^-*.a-zA-Z0-9]/', '', $mime_type ); if ( false === strpos( $mime_pattern, '*' ) ) { $mime_pattern .= '/*'; } } $mime_pattern = preg_replace( '/\*+/', '%', $mime_pattern ); if ( in_array( $mime_type, $wildcards, true ) ) { return ''; } if ( false !== strpos( $mime_pattern, '%' ) ) { $wheres[] = empty( $table_alias ) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; } else { $wheres[] = empty( $table_alias ) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; } } if ( ! empty( $wheres ) ) { $where = ' AND (' . implode( ' OR ', $wheres ) . ') '; } return $where; } function wp_delete_post( $postid = 0, $force_delete = false ) { global $wpdb; $post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $postid ) ); if ( ! $post ) { return $post; } $post = get_post( $post ); if ( ! $force_delete && ( 'post' === $post->post_type || 'page' === $post->post_type ) && 'trash' !== get_post_status( $postid ) && EMPTY_TRASH_DAYS ) { return wp_trash_post( $postid ); } if ( 'attachment' === $post->post_type ) { return wp_delete_attachment( $postid, $force_delete ); } $check = apply_filters( 'pre_delete_post', null, $post, $force_delete ); if ( null !== $check ) { return $check; } do_action( 'before_delete_post', $postid, $post ); delete_post_meta( $postid, '_wp_trash_meta_status' ); delete_post_meta( $postid, '_wp_trash_meta_time' ); wp_delete_object_term_relationships( $postid, get_object_taxonomies( $post->post_type ) ); $parent_data = array( 'post_parent' => $post->post_parent ); $parent_where = array( 'post_parent' => $postid ); if ( is_post_type_hierarchical( $post->post_type ) ) { $children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type ); $children = $wpdb->get_results( $children_query ); if ( $children ) { $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); } } $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) ); foreach ( $revision_ids as $revision_id ) { wp_delete_post_revision( $revision_id ); } $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); wp_defer_comment_counting( true ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $postid ) ); foreach ( $comment_ids as $comment_id ) { wp_delete_comment( $comment_id, true ); } wp_defer_comment_counting( false ); $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ) ); foreach ( $post_meta_ids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } do_action( 'delete_post', $postid, $post ); $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) ); if ( ! $result ) { return false; } do_action( 'deleted_post', $postid, $post ); clean_post_cache( $post ); if ( is_post_type_hierarchical( $post->post_type ) && $children ) { foreach ( $children as $child ) { clean_post_cache( $child ); } } wp_clear_scheduled_hook( 'publish_future_post', array( $postid ) ); do_action( 'after_delete_post', $postid, $post ); return $post; } function _reset_front_page_settings_for_post( $post_id ) { $post = get_post( $post_id ); if ( 'page' === $post->post_type ) { if ( get_option( 'page_on_front' ) == $post->ID ) { update_option( 'show_on_front', 'posts' ); update_option( 'page_on_front', 0 ); } if ( get_option( 'page_for_posts' ) == $post->ID ) { update_option( 'page_for_posts', 0 ); } } unstick_post( $post->ID ); } function wp_trash_post( $post_id = 0 ) { if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_post( $post_id, true ); } $post = get_post( $post_id ); if ( ! $post ) { return $post; } if ( 'trash' === $post->post_status ) { return false; } $check = apply_filters( 'pre_trash_post', null, $post ); if ( null !== $check ) { return $check; } do_action( 'wp_trash_post', $post_id ); add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status ); add_post_meta( $post_id, '_wp_trash_meta_time', time() ); $post_updated = wp_update_post( array( 'ID' => $post_id, 'post_status' => 'trash', ) ); if ( ! $post_updated ) { return false; } wp_trash_post_comments( $post_id ); do_action( 'trashed_post', $post_id ); return $post; } function wp_untrash_post( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post ) { return $post; } $post_id = $post->ID; if ( 'trash' !== $post->post_status ) { return false; } $previous_status = get_post_meta( $post_id, '_wp_trash_meta_status', true ); $check = apply_filters( 'pre_untrash_post', null, $post, $previous_status ); if ( null !== $check ) { return $check; } do_action( 'untrash_post', $post_id, $previous_status ); $new_status = ( 'attachment' === $post->post_type ) ? 'inherit' : 'draft'; $post_status = apply_filters( 'wp_untrash_post_status', $new_status, $post_id, $previous_status ); delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); $post_updated = wp_update_post( array( 'ID' => $post_id, 'post_status' => $post_status, ) ); if ( ! $post_updated ) { return false; } wp_untrash_post_comments( $post_id ); do_action( 'untrashed_post', $post_id, $previous_status ); return $post; } function wp_trash_post_comments( $post = null ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; do_action( 'trash_post_comments', $post_id ); $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ) ); if ( ! $comments ) { return; } $statuses = array(); foreach ( $comments as $comment ) { $statuses[ $comment->comment_ID ] = $comment->comment_approved; } add_post_meta( $post_id, '_wp_trash_meta_comments_status', $statuses ); $result = $wpdb->update( $wpdb->comments, array( 'comment_approved' => 'post-trashed' ), array( 'comment_post_ID' => $post_id ) ); clean_comment_cache( array_keys( $statuses ) ); do_action( 'trashed_post_comments', $post_id, $statuses ); return $result; } function wp_untrash_post_comments( $post = null ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; $statuses = get_post_meta( $post_id, '_wp_trash_meta_comments_status', true ); if ( ! $statuses ) { return true; } do_action( 'untrash_post_comments', $post_id ); $group_by_status = array(); foreach ( $statuses as $comment_id => $comment_status ) { $group_by_status[ $comment_status ][] = $comment_id; } foreach ( $group_by_status as $status => $comments ) { if ( 'post-trashed' === $status ) { $status = '0'; } $comments_in = implode( ', ', array_map( 'intval', $comments ) ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) ); } clean_comment_cache( array_keys( $statuses ) ); delete_post_meta( $post_id, '_wp_trash_meta_comments_status' ); do_action( 'untrashed_post_comments', $post_id ); } function wp_get_post_categories( $post_id = 0, $args = array() ) { $post_id = (int) $post_id; $defaults = array( 'fields' => 'ids' ); $args = wp_parse_args( $args, $defaults ); $cats = wp_get_object_terms( $post_id, 'category', $args ); return $cats; } function wp_get_post_tags( $post_id = 0, $args = array() ) { return wp_get_post_terms( $post_id, 'post_tag', $args ); } function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) { $post_id = (int) $post_id; $defaults = array( 'fields' => 'all' ); $args = wp_parse_args( $args, $defaults ); $tags = wp_get_object_terms( $post_id, $taxonomy, $args ); return $tags; } function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) { if ( is_numeric( $args ) ) { _deprecated_argument( __FUNCTION__, '3.1.0', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) ); $args = array( 'numberposts' => absint( $args ) ); } $defaults = array( 'numberposts' => 10, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $results = get_posts( $parsed_args ); if ( ARRAY_A === $output ) { foreach ( $results as $key => $result ) { $results[ $key ] = get_object_vars( $result ); } return $results ? $results : array(); } return $results ? $results : false; } function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) { global $wpdb; $unsanitized_postarr = $postarr; $user_id = get_current_user_id(); $defaults = array( 'post_author' => $user_id, 'post_content' => '', 'post_content_filtered' => '', 'post_title' => '', 'post_excerpt' => '', 'post_status' => 'draft', 'post_type' => 'post', 'comment_status' => '', 'ping_status' => '', 'post_password' => '', 'to_ping' => '', 'pinged' => '', 'post_parent' => 0, 'menu_order' => 0, 'guid' => '', 'import_id' => 0, 'context' => '', 'post_date' => '', 'post_date_gmt' => '', ); $postarr = wp_parse_args( $postarr, $defaults ); unset( $postarr['filter'] ); $postarr = sanitize_post( $postarr, 'db' ); $post_ID = 0; $update = false; $guid = $postarr['guid']; if ( ! empty( $postarr['ID'] ) ) { $update = true; $post_ID = $postarr['ID']; $post_before = get_post( $post_ID ); if ( is_null( $post_before ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } return 0; } $guid = get_post_field( 'guid', $post_ID ); $previous_status = get_post_field( 'post_status', $post_ID ); } else { $previous_status = 'new'; $post_before = null; } $post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type']; $post_title = $postarr['post_title']; $post_content = $postarr['post_content']; $post_excerpt = $postarr['post_excerpt']; if ( isset( $postarr['post_name'] ) ) { $post_name = $postarr['post_name']; } elseif ( $update ) { $post_name = $post_before->post_name; } $maybe_empty = 'attachment' !== $post_type && ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { if ( $wp_error ) { return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); } else { return 0; } } $post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status']; if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) { $post_status = 'inherit'; } if ( ! empty( $postarr['post_category'] ) ) { $post_category = array_filter( $postarr['post_category'] ); } if ( empty( $post_category ) || 0 === count( $post_category ) || ! is_array( $post_category ) ) { if ( 'post' === $post_type && 'auto-draft' !== $post_status ) { $post_category = array( get_option( 'default_category' ) ); } else { $post_category = array(); } } $post_type_object = get_post_type_object( $post_type ); if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) { $post_name = ''; } elseif ( $update && 'pending' === $post_status && ! current_user_can( 'publish_post', $post_ID ) ) { $post_name = ''; } if ( empty( $post_name ) ) { if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) { $post_name = sanitize_title( $post_title ); } else { $post_name = ''; } } else { $check_name = sanitize_title( $post_name, '', 'old-save' ); if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) { $post_name = $check_name; } else { $post_name = sanitize_title( $post_name ); } } $post_date = wp_resolve_post_date( $postarr['post_date'], $postarr['post_date_gmt'] ); if ( ! $post_date ) { if ( $wp_error ) { return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); } else { return 0; } } if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_date_gmt'] ) { if ( ! in_array( $post_status, get_post_stati( array( 'date_floating' => true ) ), true ) ) { $post_date_gmt = get_gmt_from_date( $post_date ); } else { $post_date_gmt = '0000-00-00 00:00:00'; } } else { $post_date_gmt = $postarr['post_date_gmt']; } if ( $update || '0000-00-00 00:00:00' === $post_date ) { $post_modified = current_time( 'mysql' ); $post_modified_gmt = current_time( 'mysql', 1 ); } else { $post_modified = $post_date; $post_modified_gmt = $post_date_gmt; } if ( 'attachment' !== $post_type ) { $now = gmdate( 'Y-m-d H:i:s' ); if ( 'publish' === $post_status ) { if ( strtotime( $post_date_gmt ) - strtotime( $now ) >= MINUTE_IN_SECONDS ) { $post_status = 'future'; } } elseif ( 'future' === $post_status ) { if ( strtotime( $post_date_gmt ) - strtotime( $now ) < MINUTE_IN_SECONDS ) { $post_status = 'publish'; } } } if ( empty( $postarr['comment_status'] ) ) { if ( $update ) { $comment_status = 'closed'; } else { $comment_status = get_default_comment_status( $post_type ); } } else { $comment_status = $postarr['comment_status']; } $post_content_filtered = $postarr['post_content_filtered']; $post_author = isset( $postarr['post_author'] ) ? $postarr['post_author'] : $user_id; $ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status']; $to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : ''; $pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : ''; $import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0; if ( isset( $postarr['menu_order'] ) ) { $menu_order = (int) $postarr['menu_order']; } else { $menu_order = 0; } $post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : ''; if ( 'private' === $post_status ) { $post_password = ''; } if ( isset( $postarr['post_parent'] ) ) { $post_parent = (int) $postarr['post_parent']; } else { $post_parent = 0; } $new_postarr = array_merge( array( 'ID' => $post_ID, ), compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) ) ); $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr ); if ( 'trash' === $previous_status && 'trash' !== $post_status ) { $desired_post_slug = get_post_meta( $post_ID, '_wp_desired_post_slug', true ); if ( $desired_post_slug ) { delete_post_meta( $post_ID, '_wp_desired_post_slug' ); $post_name = $desired_post_slug; } } if ( 'trash' !== $post_status && $post_name ) { $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID ); if ( $add_trashed_suffix ) { wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID ); } } if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) { $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ID ); } $post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent ); $post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : ''; $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ); $emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' ); foreach ( $emoji_fields as $emoji_field ) { if ( isset( $data[ $emoji_field ] ) ) { $charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field ); if ( 'utf8' === $charset ) { $data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] ); } } } if ( 'attachment' === $post_type ) { $data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr, $update ); } else { $data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr, $update ); } $data = wp_unslash( $data ); $where = array( 'ID' => $post_ID ); if ( $update ) { do_action( 'pre_post_update', $post_ID, $data ); if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { if ( $wp_error ) { if ( 'attachment' === $post_type ) { $message = __( 'Could not update attachment in the database.' ); } else { $message = __( 'Could not update post in the database.' ); } return new WP_Error( 'db_update_error', $message, $wpdb->last_error ); } else { return 0; } } } else { if ( ! empty( $import_id ) ) { $import_id = (int) $import_id; if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id ) ) ) { $data['ID'] = $import_id; } } if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { if ( $wp_error ) { if ( 'attachment' === $post_type ) { $message = __( 'Could not insert attachment into the database.' ); } else { $message = __( 'Could not insert post into the database.' ); } return new WP_Error( 'db_insert_error', $message, $wpdb->last_error ); } else { return 0; } } $post_ID = (int) $wpdb->insert_id; $where = array( 'ID' => $post_ID ); } if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) { $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent ); $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); clean_post_cache( $post_ID ); } if ( is_object_in_taxonomy( $post_type, 'category' ) ) { wp_set_post_categories( $post_ID, $post_category ); } if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) { wp_set_post_tags( $post_ID, $postarr['tags_input'] ); } if ( 'auto-draft' !== $post_status ) { foreach ( get_object_taxonomies( $post_type, 'object' ) as $taxonomy => $tax_object ) { if ( ! empty( $tax_object->default_term ) ) { if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) { $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] ); } $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { $postarr['tax_input'][ $taxonomy ] = $terms; } if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) { $default_term_id = get_option( 'default_term_' . $taxonomy ); if ( ! empty( $default_term_id ) ) { $postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id ); } } } } } if ( ! empty( $postarr['tax_input'] ) ) { foreach ( $postarr['tax_input'] as $taxonomy => $tags ) { $taxonomy_obj = get_taxonomy( $taxonomy ); if ( ! $taxonomy_obj ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid taxonomy: %s.' ), $taxonomy ), '4.4.0' ); continue; } if ( is_array( $tags ) ) { $tags = array_filter( $tags ); } if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) { wp_set_post_terms( $post_ID, $tags, $taxonomy ); } } } if ( ! empty( $postarr['meta_input'] ) ) { foreach ( $postarr['meta_input'] as $field => $value ) { update_post_meta( $post_ID, $field, $value ); } } $current_guid = get_post_field( 'guid', $post_ID ); if ( ! $update && '' === $current_guid ) { $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); } if ( 'attachment' === $postarr['post_type'] ) { if ( ! empty( $postarr['file'] ) ) { update_attached_file( $post_ID, $postarr['file'] ); } if ( ! empty( $postarr['context'] ) ) { add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true ); } } if ( isset( $postarr['_thumbnail_id'] ) ) { $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type; if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { if ( wp_attachment_is( 'audio', $post_ID ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post_ID ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } if ( $thumbnail_support ) { $thumbnail_id = (int) $postarr['_thumbnail_id']; if ( -1 === $thumbnail_id ) { delete_post_thumbnail( $post_ID ); } else { set_post_thumbnail( $post_ID, $thumbnail_id ); } } } clean_post_cache( $post_ID ); $post = get_post( $post_ID ); if ( ! empty( $postarr['page_template'] ) ) { $post->page_template = $postarr['page_template']; $page_templates = wp_get_theme()->get_page_templates( $post ); if ( 'default' !== $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_page_template', __( 'Invalid page template.' ) ); } update_post_meta( $post_ID, '_wp_page_template', 'default' ); } else { update_post_meta( $post_ID, '_wp_page_template', $postarr['page_template'] ); } } if ( 'attachment' !== $postarr['post_type'] ) { wp_transition_post_status( $data['post_status'], $previous_status, $post ); } else { if ( $update ) { do_action( 'edit_attachment', $post_ID ); $post_after = get_post( $post_ID ); do_action( 'attachment_updated', $post_ID, $post_after, $post_before ); } else { do_action( 'add_attachment', $post_ID ); } return $post_ID; } if ( $update ) { do_action( "edit_post_{$post->post_type}", $post_ID, $post ); do_action( 'edit_post', $post_ID, $post ); $post_after = get_post( $post_ID ); do_action( 'post_updated', $post_ID, $post_after, $post_before ); } do_action( "save_post_{$post->post_type}", $post_ID, $post, $update ); do_action( 'save_post', $post_ID, $post, $update ); do_action( 'wp_insert_post', $post_ID, $post, $update ); if ( $fire_after_hooks ) { wp_after_insert_post( $post, $update, $post_before ); } return $post_ID; } function wp_update_post( $postarr = array(), $wp_error = false, $fire_after_hooks = true ) { if ( is_object( $postarr ) ) { $postarr = get_object_vars( $postarr ); $postarr = wp_slash( $postarr ); } $post = get_post( $postarr['ID'], ARRAY_A ); if ( is_null( $post ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } return 0; } $post = wp_slash( $post ); if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] ) && count( $postarr['post_category'] ) > 0 ) { $post_cats = $postarr['post_category']; } else { $post_cats = $post['post_category']; } if ( isset( $post['post_status'] ) && in_array( $post['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) && empty( $postarr['edit_date'] ) && ( '0000-00-00 00:00:00' === $post['post_date_gmt'] ) ) { $clear_date = true; } else { $clear_date = false; } $postarr = array_merge( $post, $postarr ); $postarr['post_category'] = $post_cats; if ( $clear_date ) { $postarr['post_date'] = current_time( 'mysql' ); $postarr['post_date_gmt'] = ''; } if ( 'attachment' === $postarr['post_type'] ) { return wp_insert_attachment( $postarr, false, 0, $wp_error ); } if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $postarr['post_type'], 'post_tag' ) ) { $tags = get_the_terms( $postarr['ID'], 'post_tag' ); $tag_names = array(); if ( $tags && ! is_wp_error( $tags ) ) { $tag_names = wp_list_pluck( $tags, 'name' ); } if ( $postarr['tags_input'] === $tag_names ) { unset( $postarr['tags_input'] ); } } return wp_insert_post( $postarr, $wp_error, $fire_after_hooks ); } function wp_publish_post( $post ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } if ( 'publish' === $post->post_status ) { return; } $post_before = get_post( $post->ID ); foreach ( get_object_taxonomies( $post->post_type, 'object' ) as $taxonomy => $tax_object ) { if ( 'category' !== $taxonomy && empty( $tax_object->default_term ) ) { continue; } if ( ! empty( get_the_terms( $post, $taxonomy ) ) ) { continue; } if ( 'category' === $taxonomy ) { $default_term_id = (int) get_option( 'default_category', 0 ); } else { $default_term_id = (int) get_option( 'default_term_' . $taxonomy, 0 ); } if ( ! $default_term_id ) { continue; } wp_set_post_terms( $post->ID, array( $default_term_id ), $taxonomy ); } $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); $old_status = $post->post_status; $post->post_status = 'publish'; wp_transition_post_status( 'publish', $old_status, $post ); do_action( "edit_post_{$post->post_type}", $post->ID, $post ); do_action( 'edit_post', $post->ID, $post ); do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); do_action( 'save_post', $post->ID, $post, true ); do_action( 'wp_insert_post', $post->ID, $post, true ); wp_after_insert_post( $post, true, $post_before ); } function check_and_publish_future_post( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return; } if ( 'future' !== $post->post_status ) { return; } $time = strtotime( $post->post_date_gmt . ' GMT' ); if ( $time > time() ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); return; } wp_publish_post( $post_id ); } function wp_resolve_post_date( $post_date = '', $post_date_gmt = '' ) { if ( empty( $post_date ) || '0000-00-00 00:00:00' === $post_date ) { if ( empty( $post_date_gmt ) || '0000-00-00 00:00:00' === $post_date_gmt ) { $post_date = current_time( 'mysql' ); } else { $post_date = get_date_from_gmt( $post_date_gmt ); } } $month = substr( $post_date, 5, 2 ); $day = substr( $post_date, 8, 2 ); $year = substr( $post_date, 0, 4 ); $valid_date = wp_checkdate( $month, $day, $year, $post_date ); if ( ! $valid_date ) { return false; } return $post_date; } function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) || ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type ) { return $slug; } $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent ); if ( null !== $override_slug ) { return $override_slug; } global $wpdb, $wp_rewrite; $original_slug = $slug; $feeds = $wp_rewrite->feeds; if ( ! is_array( $feeds ) ) { $feeds = array(); } if ( 'attachment' === $post_type ) { $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); $is_bad_attachment_slug = apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || $is_bad_attachment_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } elseif ( is_post_type_hierarchical( $post_type ) ) { if ( 'nav_menu_item' === $post_type ) { return $slug; } $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) ); $is_bad_hierarchical_slug = apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || $is_bad_hierarchical_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } else { $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); $post = get_post( $post_ID ); $conflicts_with_date_archive = false; if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) { $slug_num = (int) $slug; if ( $slug_num ) { $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs, true ); if ( 0 === $postname_index || ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && 13 > $slug_num ) || ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && 32 > $slug_num ) ) { $conflicts_with_date_archive = true; } } } $is_bad_flat_slug = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || $conflicts_with_date_archive || $is_bad_flat_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ); } function _truncate_post_slug( $slug, $length = 200 ) { if ( strlen( $slug ) > $length ) { $decoded_slug = urldecode( $slug ); if ( $decoded_slug === $slug ) { $slug = substr( $slug, 0, $length ); } else { $slug = utf8_uri_encode( $decoded_slug, $length, true ); } } return rtrim( $slug, '-' ); } function wp_add_post_tags( $post_id = 0, $tags = '' ) { return wp_set_post_tags( $post_id, $tags, true ); } function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { return wp_set_post_terms( $post_id, $tags, 'post_tag', $append ); } function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { $post_id = (int) $post_id; if ( ! $post_id ) { return false; } if ( empty( $tags ) ) { $tags = array(); } if ( ! is_array( $tags ) ) { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $tags = str_replace( $comma, ',', $tags ); } $tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) ); } if ( is_taxonomy_hierarchical( $taxonomy ) ) { $tags = array_unique( array_map( 'intval', $tags ) ); } return wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); } function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) { $post_ID = (int) $post_ID; $post_type = get_post_type( $post_ID ); $post_status = get_post_status( $post_ID ); $post_categories = (array) $post_categories; if ( empty( $post_categories ) ) { $default_category_post_types = apply_filters( 'default_category_post_types', array() ); $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); if ( in_array( $post_type, $default_category_post_types, true ) && is_object_in_taxonomy( $post_type, 'category' ) && 'auto-draft' !== $post_status ) { $post_categories = array( get_option( 'default_category' ) ); $append = false; } else { $post_categories = array(); } } elseif ( 1 === count( $post_categories ) && '' === reset( $post_categories ) ) { return true; } return wp_set_post_terms( $post_ID, $post_categories, 'category', $append ); } function wp_transition_post_status( $new_status, $old_status, $post ) { do_action( 'transition_post_status', $new_status, $old_status, $post ); do_action( "{$old_status}_to_{$new_status}", $post ); do_action( "{$new_status}_{$post->post_type}", $post->ID, $post, $old_status ); } function wp_after_insert_post( $post, $update, $post_before ) { $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before ); } function add_ping( $post_id, $uri ) { global $wpdb; $post = get_post( $post_id ); if ( ! $post ) { return false; } $pung = trim( $post->pinged ); $pung = preg_split( '/\s/', $pung ); if ( is_array( $uri ) ) { $pung = array_merge( $pung, $uri ); } else { $pung[] = $uri; } $new = implode( "\n", $pung ); $new = apply_filters( 'add_ping', $new ); $return = $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $return; } function get_enclosed( $post_id ) { $custom_fields = get_post_custom( $post_id ); $pung = array(); if ( ! is_array( $custom_fields ) ) { return $pung; } foreach ( $custom_fields as $key => $val ) { if ( 'enclosure' !== $key || ! is_array( $val ) ) { continue; } foreach ( $val as $enc ) { $enclosure = explode( "\n", $enc ); $pung[] = trim( $enclosure[0] ); } } return apply_filters( 'get_enclosed', $pung, $post_id ); } function get_pung( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $pung = trim( $post->pinged ); $pung = preg_split( '/\s/', $pung ); return apply_filters( 'get_pung', $pung ); } function get_to_ping( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $to_ping = sanitize_trackback_urls( $post->to_ping ); $to_ping = preg_split( '/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY ); return apply_filters( 'get_to_ping', $to_ping ); } function trackback_url_list( $tb_list, $post_id ) { if ( ! empty( $tb_list ) ) { $postdata = get_post( $post_id, ARRAY_A ); $excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] ); if ( strlen( $excerpt ) > 255 ) { $excerpt = substr( $excerpt, 0, 252 ) . '…'; } $trackback_urls = explode( ',', $tb_list ); foreach ( (array) $trackback_urls as $tb_url ) { $tb_url = trim( $tb_url ); trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id ); } } } function get_all_page_ids() { global $wpdb; $page_ids = wp_cache_get( 'all_page_ids', 'posts' ); if ( ! is_array( $page_ids ) ) { $page_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = 'page'" ); wp_cache_add( 'all_page_ids', $page_ids, 'posts' ); } return $page_ids; } function get_page( $page, $output = OBJECT, $filter = 'raw' ) { return get_post( $page, $output, $filter ); } function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { global $wpdb; $last_changed = wp_cache_get_last_changed( 'posts' ); $hash = md5( $page_path . serialize( $post_type ) ); $cache_key = "get_page_by_path:$hash:$last_changed"; $cached = wp_cache_get( $cache_key, 'posts' ); if ( false !== $cached ) { if ( '0' === $cached || 0 === $cached ) { return; } else { return get_post( $cached, $output ); } } $page_path = rawurlencode( urldecode( $page_path ) ); $page_path = str_replace( '%2F', '/', $page_path ); $page_path = str_replace( '%20', ' ', $page_path ); $parts = explode( '/', trim( $page_path, '/' ) ); $parts = array_map( 'sanitize_title_for_query', $parts ); $escaped_parts = esc_sql( $parts ); $in_string = "'" . implode( "','", $escaped_parts ) . "'"; if ( is_array( $post_type ) ) { $post_types = $post_type; } else { $post_types = array( $post_type, 'attachment' ); } $post_types = esc_sql( $post_types ); $post_type_in_string = "'" . implode( "','", $post_types ) . "'"; $sql = " + SELECT ID, post_name, post_parent, post_type + FROM $wpdb->posts + WHERE post_name IN ($in_string) + AND post_type IN ($post_type_in_string) + "; $pages = $wpdb->get_results( $sql, OBJECT_K ); $revparts = array_reverse( $parts ); $foundid = 0; foreach ( (array) $pages as $page ) { if ( $page->post_name == $revparts[0] ) { $count = 0; $p = $page; while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) { $count++; $parent = $pages[ $p->post_parent ]; if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) { break; } $p = $parent; } if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) { $foundid = $page->ID; if ( $page->post_type == $post_type ) { break; } } } } wp_cache_set( $cache_key, $foundid, 'posts' ); if ( $foundid ) { return get_post( $foundid, $output ); } return null; } function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { global $wpdb; if ( is_array( $post_type ) ) { $post_type = esc_sql( $post_type ); $post_type_in_string = "'" . implode( "','", $post_type ) . "'"; $sql = $wpdb->prepare( " + SELECT ID + FROM $wpdb->posts + WHERE post_title = %s + AND post_type IN ($post_type_in_string) + ", $page_title ); } else { $sql = $wpdb->prepare( " + SELECT ID + FROM $wpdb->posts + WHERE post_title = %s + AND post_type = %s + ", $page_title, $post_type ); } $page = $wpdb->get_var( $sql ); if ( $page ) { return get_post( $page, $output ); } return null; } function get_page_children( $page_id, $pages ) { $children = array(); foreach ( (array) $pages as $page ) { $children[ (int) $page->post_parent ][] = $page; } $page_list = array(); if ( isset( $children[ $page_id ] ) ) { $to_look = array_reverse( $children[ $page_id ] ); while ( $to_look ) { $p = array_pop( $to_look ); $page_list[] = $p; if ( isset( $children[ $p->ID ] ) ) { foreach ( array_reverse( $children[ $p->ID ] ) as $child ) { $to_look[] = $child; } } } } return $page_list; } function get_page_hierarchy( &$pages, $page_id = 0 ) { if ( empty( $pages ) ) { return array(); } $children = array(); foreach ( (array) $pages as $p ) { $parent_id = (int) $p->post_parent; $children[ $parent_id ][] = $p; } $result = array(); _page_traverse_name( $page_id, $children, $result ); return $result; } function _page_traverse_name( $page_id, &$children, &$result ) { if ( isset( $children[ $page_id ] ) ) { foreach ( (array) $children[ $page_id ] as $child ) { $result[ $child->ID ] = $child->post_name; _page_traverse_name( $child->ID, $children, $result ); } } } function get_page_uri( $page = 0 ) { if ( ! $page instanceof WP_Post ) { $page = get_post( $page ); } if ( ! $page ) { return false; } $uri = $page->post_name; foreach ( $page->ancestors as $parent ) { $parent = get_post( $parent ); if ( $parent && $parent->post_name ) { $uri = $parent->post_name . '/' . $uri; } } return apply_filters( 'get_page_uri', $uri, $page ); } function get_pages( $args = array() ) { global $wpdb; $defaults = array( 'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => array(), 'include' => array(), 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'parent' => -1, 'exclude_tree' => array(), 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish', ); $parsed_args = wp_parse_args( $args, $defaults ); $number = (int) $parsed_args['number']; $offset = (int) $parsed_args['offset']; $child_of = (int) $parsed_args['child_of']; $hierarchical = $parsed_args['hierarchical']; $exclude = $parsed_args['exclude']; $meta_key = $parsed_args['meta_key']; $meta_value = $parsed_args['meta_value']; $parent = $parsed_args['parent']; $post_status = $parsed_args['post_status']; $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); if ( ! in_array( $parsed_args['post_type'], $hierarchical_post_types, true ) ) { return false; } if ( $parent > 0 && ! $child_of ) { $hierarchical = false; } if ( ! is_array( $post_status ) ) { $post_status = explode( ',', $post_status ); } if ( array_diff( $post_status, get_post_stati() ) ) { return false; } $key = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) ); $last_changed = wp_cache_get_last_changed( 'posts' ); $cache_key = "get_pages:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'posts' ); if ( false !== $cache ) { _prime_post_caches( $cache, false, false ); $pages = array_map( 'get_post', $cache ); $pages = apply_filters( 'get_pages', $pages, $parsed_args ); return $pages; } $inclusions = ''; if ( ! empty( $parsed_args['include'] ) ) { $child_of = 0; $parent = -1; $exclude = ''; $meta_key = ''; $meta_value = ''; $hierarchical = false; $incpages = wp_parse_id_list( $parsed_args['include'] ); if ( ! empty( $incpages ) ) { $inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')'; } } $exclusions = ''; if ( ! empty( $exclude ) ) { $expages = wp_parse_id_list( $exclude ); if ( ! empty( $expages ) ) { $exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) . ')'; } } $author_query = ''; if ( ! empty( $parsed_args['authors'] ) ) { $post_authors = wp_parse_list( $parsed_args['authors'] ); if ( ! empty( $post_authors ) ) { foreach ( $post_authors as $post_author ) { if ( 0 == (int) $post_author ) { $post_author = get_user_by( 'login', $post_author ); if ( empty( $post_author ) ) { continue; } if ( empty( $post_author->ID ) ) { continue; } $post_author = $post_author->ID; } if ( '' === $author_query ) { $author_query = $wpdb->prepare( ' post_author = %d ', $post_author ); } else { $author_query .= $wpdb->prepare( ' OR post_author = %d ', $post_author ); } } if ( '' !== $author_query ) { $author_query = " AND ($author_query)"; } } } $join = ''; $where = "$exclusions $inclusions "; if ( '' !== $meta_key || '' !== $meta_value ) { $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); if ( '' !== $meta_key ) { $where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_key = %s", $meta_key ); } if ( '' !== $meta_value ) { $where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_value = %s", $meta_value ); } } if ( is_array( $parent ) ) { $post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) ); if ( ! empty( $post_parent__in ) ) { $where .= " AND post_parent IN ($post_parent__in)"; } } elseif ( $parent >= 0 ) { $where .= $wpdb->prepare( ' AND post_parent = %d ', $parent ); } if ( 1 === count( $post_status ) ) { $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $parsed_args['post_type'], reset( $post_status ) ); } else { $post_status = implode( "', '", $post_status ); $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $parsed_args['post_type'] ); } $orderby_array = array(); $allowed_keys = array( 'author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified', 'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent', 'ID', 'rand', 'comment_count', ); foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) { $orderby = trim( $orderby ); if ( ! in_array( $orderby, $allowed_keys, true ) ) { continue; } switch ( $orderby ) { case 'menu_order': break; case 'ID': $orderby = "$wpdb->posts.ID"; break; case 'rand': $orderby = 'RAND()'; break; case 'comment_count': $orderby = "$wpdb->posts.comment_count"; break; default: if ( 0 === strpos( $orderby, 'post_' ) ) { $orderby = "$wpdb->posts." . $orderby; } else { $orderby = "$wpdb->posts.post_" . $orderby; } } $orderby_array[] = $orderby; } $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title"; $sort_order = strtoupper( $parsed_args['sort_order'] ); if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ), true ) ) { $sort_order = 'ASC'; } $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; $query .= $author_query; $query .= ' ORDER BY ' . $sort_column . ' ' . $sort_order; if ( ! empty( $number ) ) { $query .= ' LIMIT ' . $offset . ',' . $number; } $pages = $wpdb->get_results( $query ); if ( empty( $pages ) ) { wp_cache_set( $cache_key, array(), 'posts' ); $pages = apply_filters( 'get_pages', array(), $parsed_args ); return $pages; } $num_pages = count( $pages ); for ( $i = 0; $i < $num_pages; $i++ ) { $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); } update_post_cache( $pages ); if ( $child_of || $hierarchical ) { $pages = get_page_children( $child_of, $pages ); } if ( ! empty( $parsed_args['exclude_tree'] ) ) { $exclude = wp_parse_id_list( $parsed_args['exclude_tree'] ); foreach ( $exclude as $id ) { $children = get_page_children( $id, $pages ); foreach ( $children as $child ) { $exclude[] = $child->ID; } } $num_pages = count( $pages ); for ( $i = 0; $i < $num_pages; $i++ ) { if ( in_array( $pages[ $i ]->ID, $exclude, true ) ) { unset( $pages[ $i ] ); } } } $page_structure = array(); foreach ( $pages as $page ) { $page_structure[] = $page->ID; } wp_cache_set( $cache_key, $page_structure, 'posts' ); $pages = array_map( 'get_post', $pages ); return apply_filters( 'get_pages', $pages, $parsed_args ); } function is_local_attachment( $url ) { if ( strpos( $url, home_url() ) === false ) { return false; } if ( strpos( $url, home_url( '/?attachment_id=' ) ) !== false ) { return true; } $id = url_to_postid( $url ); if ( $id ) { $post = get_post( $id ); if ( 'attachment' === $post->post_type ) { return true; } } return false; } function wp_insert_attachment( $args, $file = false, $parent = 0, $wp_error = false, $fire_after_hooks = true ) { $defaults = array( 'file' => $file, 'post_parent' => 0, ); $data = wp_parse_args( $args, $defaults ); if ( ! empty( $parent ) ) { $data['post_parent'] = $parent; } $data['post_type'] = 'attachment'; return wp_insert_post( $data, $wp_error, $fire_after_hooks ); } function wp_delete_attachment( $post_id, $force_delete = false ) { global $wpdb; $post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id ) ); if ( ! $post ) { return $post; } $post = get_post( $post ); if ( 'attachment' !== $post->post_type ) { return false; } if ( ! $force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' !== $post->post_status ) { return wp_trash_post( $post_id ); } $check = apply_filters( 'pre_delete_attachment', null, $post, $force_delete ); if ( null !== $check ) { return $check; } delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); $meta = wp_get_attachment_metadata( $post_id ); $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); $file = get_attached_file( $post_id ); if ( is_multisite() && is_string( $file ) && ! empty( $file ) ) { clean_dirsize_cache( $file ); } do_action( 'delete_attachment', $post_id, $post ); wp_delete_object_term_relationships( $post_id, array( 'category', 'post_tag' ) ); wp_delete_object_term_relationships( $post_id, get_object_taxonomies( $post->post_type ) ); delete_metadata( 'post', null, '_thumbnail_id', $post_id, true ); wp_defer_comment_counting( true ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $post_id ) ); foreach ( $comment_ids as $comment_id ) { wp_delete_comment( $comment_id, true ); } wp_defer_comment_counting( false ); $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ) ); foreach ( $post_meta_ids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } do_action( 'delete_post', $post_id, $post ); $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) ); if ( ! $result ) { return false; } do_action( 'deleted_post', $post_id, $post ); wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ); clean_post_cache( $post ); return $post; } function wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ) { global $wpdb; $uploadpath = wp_get_upload_dir(); $deleted = true; if ( ! empty( $meta['thumb'] ) ) { if ( ! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id ) ) ) { $thumbfile = str_replace( wp_basename( $file ), $meta['thumb'], $file ); if ( ! empty( $thumbfile ) ) { $thumbfile = path_join( $uploadpath['basedir'], $thumbfile ); $thumbdir = path_join( $uploadpath['basedir'], dirname( $file ) ); if ( ! wp_delete_file_from_directory( $thumbfile, $thumbdir ) ) { $deleted = false; } } } } if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) { $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) ); foreach ( $meta['sizes'] as $size => $sizeinfo ) { $intermediate_file = str_replace( wp_basename( $file ), $sizeinfo['file'], $file ); if ( ! empty( $intermediate_file ) ) { $intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file ); if ( ! wp_delete_file_from_directory( $intermediate_file, $intermediate_dir ) ) { $deleted = false; } } } } if ( ! empty( $meta['original_image'] ) ) { if ( empty( $intermediate_dir ) ) { $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) ); } $original_image = str_replace( wp_basename( $file ), $meta['original_image'], $file ); if ( ! empty( $original_image ) ) { $original_image = path_join( $uploadpath['basedir'], $original_image ); if ( ! wp_delete_file_from_directory( $original_image, $intermediate_dir ) ) { $deleted = false; } } } if ( is_array( $backup_sizes ) ) { $del_dir = path_join( $uploadpath['basedir'], dirname( $meta['file'] ) ); foreach ( $backup_sizes as $size ) { $del_file = path_join( dirname( $meta['file'] ), $size['file'] ); if ( ! empty( $del_file ) ) { $del_file = path_join( $uploadpath['basedir'], $del_file ); if ( ! wp_delete_file_from_directory( $del_file, $del_dir ) ) { $deleted = false; } } } } if ( ! wp_delete_file_from_directory( $file, $uploadpath['basedir'] ) ) { $deleted = false; } return $deleted; } function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { $attachment_id = (int) $attachment_id; if ( ! $attachment_id ) { $post = get_post(); if ( ! $post ) { return false; } $attachment_id = $post->ID; } $data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); if ( ! $data ) { return false; } if ( $unfiltered ) { return $data; } return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); } function wp_update_attachment_metadata( $attachment_id, $data ) { $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); if ( ! $post ) { return false; } $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); if ( $data ) { return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); } else { return delete_post_meta( $post->ID, '_wp_attachment_metadata' ); } } function wp_get_attachment_url( $attachment_id = 0 ) { global $pagenow; $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); if ( ! $post ) { return false; } if ( 'attachment' !== $post->post_type ) { return false; } $url = ''; $file = get_post_meta( $post->ID, '_wp_attached_file', true ); if ( $file ) { $uploads = wp_get_upload_dir(); if ( $uploads && false === $uploads['error'] ) { if ( 0 === strpos( $file, $uploads['basedir'] ) ) { $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $file ); } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) { $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . wp_basename( $file ); } else { $url = $uploads['baseurl'] . "/$file"; } } } if ( ! $url ) { $url = get_the_guid( $post->ID ); } if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) { $url = set_url_scheme( $url ); } $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); if ( ! $url ) { return false; } return $url; } function wp_get_attachment_caption( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } if ( 'attachment' !== $post->post_type ) { return false; } $caption = $post->post_excerpt; return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID ); } function wp_get_attachment_thumb_file( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } $imagedata = wp_get_attachment_metadata( $post->ID ); if ( ! is_array( $imagedata ) ) { return false; } $file = get_attached_file( $post->ID ); if ( ! empty( $imagedata['thumb'] ) ) { $thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file ); if ( file_exists( $thumbfile ) ) { return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); } } return false; } function wp_get_attachment_thumb_url( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } $url = wp_get_attachment_url( $post->ID ); if ( ! $url ) { return false; } $sized = image_downsize( $post_id, 'thumbnail' ); if ( $sized ) { return $sized[0]; } $thumb = wp_get_attachment_thumb_file( $post->ID ); if ( ! $thumb ) { return false; } $url = str_replace( wp_basename( $url ), wp_basename( $thumb ), $url ); return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); } function wp_attachment_is( $type, $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $file = get_attached_file( $post->ID ); if ( ! $file ) { return false; } if ( 0 === strpos( $post->post_mime_type, $type . '/' ) ) { return true; } $check = wp_check_filetype( $file ); if ( empty( $check['ext'] ) ) { return false; } $ext = $check['ext']; if ( 'import' !== $post->post_mime_type ) { return $type === $ext; } switch ( $type ) { case 'image': $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ); return in_array( $ext, $image_exts, true ); case 'audio': return in_array( $ext, wp_get_audio_extensions(), true ); case 'video': return in_array( $ext, wp_get_video_extensions(), true ); default: return $type === $ext; } } function wp_attachment_is_image( $post = null ) { return wp_attachment_is( 'image', $post ); } function wp_mime_type_icon( $mime = 0 ) { if ( ! is_numeric( $mime ) ) { $icon = wp_cache_get( "mime_type_icon_$mime" ); } $post_id = 0; if ( empty( $icon ) ) { $post_mimes = array(); if ( is_numeric( $mime ) ) { $mime = (int) $mime; $post = get_post( $mime ); if ( $post ) { $post_id = (int) $post->ID; $file = get_attached_file( $post_id ); $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $file ); if ( ! empty( $ext ) ) { $post_mimes[] = $ext; $ext_type = wp_ext2type( $ext ); if ( $ext_type ) { $post_mimes[] = $ext_type; } } $mime = $post->post_mime_type; } else { $mime = 0; } } else { $post_mimes[] = $mime; } $icon_files = wp_cache_get( 'icon_files' ); if ( ! is_array( $icon_files ) ) { $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' ); $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) ); $dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) ); $icon_files = array(); while ( $dirs ) { $keys = array_keys( $dirs ); $dir = array_shift( $keys ); $uri = array_shift( $dirs ); $dh = opendir( $dir ); if ( $dh ) { while ( false !== $file = readdir( $dh ) ) { $file = wp_basename( $file ); if ( '.' === substr( $file, 0, 1 ) ) { continue; } $ext = strtolower( substr( $file, -4 ) ); if ( ! in_array( $ext, array( '.png', '.gif', '.jpg' ), true ) ) { if ( is_dir( "$dir/$file" ) ) { $dirs[ "$dir/$file" ] = "$uri/$file"; } continue; } $icon_files[ "$dir/$file" ] = "$uri/$file"; } closedir( $dh ); } } wp_cache_add( 'icon_files', $icon_files, 'default', 600 ); } $types = array(); foreach ( $icon_files as $file => $uri ) { $types[ preg_replace( '/^([^.]*).*$/', '$1', wp_basename( $file ) ) ] =& $icon_files[ $file ]; } if ( ! empty( $mime ) ) { $post_mimes[] = substr( $mime, 0, strpos( $mime, '/' ) ); $post_mimes[] = substr( $mime, strpos( $mime, '/' ) + 1 ); $post_mimes[] = str_replace( '/', '_', $mime ); } $matches = wp_match_mime_types( array_keys( $types ), $post_mimes ); $matches['default'] = array( 'default' ); foreach ( $matches as $match => $wilds ) { foreach ( $wilds as $wild ) { if ( ! isset( $types[ $wild ] ) ) { continue; } $icon = $types[ $wild ]; if ( ! is_numeric( $mime ) ) { wp_cache_add( "mime_type_icon_$mime", $icon ); } break 2; } } } return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); } function wp_check_for_changed_slugs( $post_id, $post, $post_before ) { if ( $post->post_name == $post_before->post_name ) { return; } if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { return; } $old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' ); if ( ! empty( $post_before->post_name ) && ! in_array( $post_before->post_name, $old_slugs, true ) ) { add_post_meta( $post_id, '_wp_old_slug', $post_before->post_name ); } if ( in_array( $post->post_name, $old_slugs, true ) ) { delete_post_meta( $post_id, '_wp_old_slug', $post->post_name ); } } function wp_check_for_changed_dates( $post_id, $post, $post_before ) { $previous_date = gmdate( 'Y-m-d', strtotime( $post_before->post_date ) ); $new_date = gmdate( 'Y-m-d', strtotime( $post->post_date ) ); if ( $new_date == $previous_date ) { return; } if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { return; } $old_dates = (array) get_post_meta( $post_id, '_wp_old_date' ); if ( ! empty( $previous_date ) && ! in_array( $previous_date, $old_dates, true ) ) { add_post_meta( $post_id, '_wp_old_date', $previous_date ); } if ( in_array( $new_date, $old_dates, true ) ) { delete_post_meta( $post_id, '_wp_old_date', $new_date ); } } function get_private_posts_cap_sql( $post_type ) { return get_posts_by_author_sql( $post_type, false ); } function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) { global $wpdb; if ( is_array( $post_type ) ) { $post_types = $post_type; } else { $post_types = array( $post_type ); } $post_type_clauses = array(); foreach ( $post_types as $post_type ) { $post_type_obj = get_post_type_object( $post_type ); if ( ! $post_type_obj ) { continue; } $cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' ); if ( ! $cap ) { $cap = current_user_can( $post_type_obj->cap->read_private_posts ); } $post_status_sql = "post_status = 'publish'"; if ( false === $public_only ) { if ( $cap ) { $post_status_sql .= " OR post_status = 'private'"; } elseif ( is_user_logged_in() ) { $id = get_current_user_id(); if ( null === $post_author || ! $full ) { $post_status_sql .= " OR post_status = 'private' AND post_author = $id"; } elseif ( $id == (int) $post_author ) { $post_status_sql .= " OR post_status = 'private'"; } } } $post_type_clauses[] = "( post_type = '" . $post_type . "' AND ( $post_status_sql ) )"; } if ( empty( $post_type_clauses ) ) { return $full ? 'WHERE 1 = 0' : '1 = 0'; } $sql = '( ' . implode( ' OR ', $post_type_clauses ) . ' )'; if ( null !== $post_author ) { $sql .= $wpdb->prepare( ' AND post_author = %d', $post_author ); } if ( $full ) { $sql = 'WHERE ' . $sql; } return $sql; } function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { $lastpostdate = _get_last_post_time( $timezone, 'date', $post_type ); return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone, $post_type ); } function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { $lastpostmodified = apply_filters( 'pre_get_lastpostmodified', false, $timezone, $post_type ); if ( false !== $lastpostmodified ) { return $lastpostmodified; } $lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type ); $lastpostdate = get_lastpostdate( $timezone, $post_type ); if ( $lastpostdate > $lastpostmodified ) { $lastpostmodified = $lastpostdate; } return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone, $post_type ); } function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { global $wpdb; if ( ! in_array( $field, array( 'date', 'modified' ), true ) ) { return false; } $timezone = strtolower( $timezone ); $key = "lastpost{$field}:$timezone"; if ( 'any' !== $post_type ) { $key .= ':' . sanitize_key( $post_type ); } $date = wp_cache_get( $key, 'timeinfo' ); if ( false !== $date ) { return $date; } if ( 'any' === $post_type ) { $post_types = get_post_types( array( 'public' => true ) ); array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) ); $post_types = "'" . implode( "', '", $post_types ) . "'"; } else { $post_types = "'" . sanitize_key( $post_type ) . "'"; } switch ( $timezone ) { case 'gmt': $date = $wpdb->get_var( "SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'blog': $date = $wpdb->get_var( "SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'server': $add_seconds_server = gmdate( 'Z' ); $date = $wpdb->get_var( "SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; } if ( $date ) { wp_cache_set( $key, $date, 'timeinfo' ); return $date; } return false; } function update_post_cache( &$posts ) { if ( ! $posts ) { return; } $data = array(); foreach ( $posts as $post ) { if ( empty( $post->filter ) || 'raw' !== $post->filter ) { $post = sanitize_post( $post, 'raw' ); } $data[ $post->ID ] = $post; } wp_cache_add_multiple( $data, 'posts' ); } function clean_post_cache( $post ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $post = get_post( $post ); if ( ! $post ) { return; } wp_cache_delete( $post->ID, 'posts' ); wp_cache_delete( $post->ID, 'post_meta' ); clean_object_term_cache( $post->ID, $post->post_type ); wp_cache_delete( 'wp_get_archives', 'general' ); do_action( 'clean_post_cache', $post->ID, $post ); if ( 'page' === $post->post_type ) { wp_cache_delete( 'all_page_ids', 'posts' ); do_action( 'clean_page_cache', $post->ID ); } wp_cache_set( 'last_changed', microtime(), 'posts' ); } function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) { if ( ! $posts ) { return; } update_post_cache( $posts ); $post_ids = array(); foreach ( $posts as $post ) { $post_ids[] = $post->ID; } if ( ! $post_type ) { $post_type = 'any'; } if ( $update_term_cache ) { if ( is_array( $post_type ) ) { $ptypes = $post_type; } elseif ( 'any' === $post_type ) { $ptypes = array(); foreach ( $posts as $post ) { $ptypes[] = $post->post_type; } $ptypes = array_unique( $ptypes ); } else { $ptypes = array( $post_type ); } if ( ! empty( $ptypes ) ) { update_object_term_cache( $post_ids, $ptypes ); } } if ( $update_meta_cache ) { update_postmeta_cache( $post_ids ); } } function update_postmeta_cache( $post_ids ) { return update_meta_cache( 'post', $post_ids ); } function clean_attachment_cache( $id, $clean_terms = false ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $id = (int) $id; wp_cache_delete( $id, 'posts' ); wp_cache_delete( $id, 'post_meta' ); if ( $clean_terms ) { clean_object_term_cache( $id, 'attachment' ); } do_action( 'clean_attachment_cache', $id ); } function _transition_post_status( $new_status, $old_status, $post ) { global $wpdb; if ( 'publish' !== $old_status && 'publish' === $new_status ) { if ( '' === get_the_guid( $post->ID ) ) { $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); } do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' ); } if ( 'publish' === $new_status || 'publish' === $old_status ) { foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' ); wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' ); wp_cache_delete( "lastpostdate:$timezone:{$post->post_type}", 'timeinfo' ); } } if ( $new_status !== $old_status ) { wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' ); wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' ); } wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); } function _future_post_hook( $deprecated, $post ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT' ), 'publish_future_post', array( $post->ID ) ); } function _publish_post_hook( $post_id ) { if ( defined( 'XMLRPC_REQUEST' ) ) { do_action( 'xmlrpc_publish_post', $post_id ); } if ( defined( 'WP_IMPORTING' ) ) { return; } if ( get_option( 'default_pingback_flag' ) ) { add_post_meta( $post_id, '_pingme', '1', true ); } add_post_meta( $post_id, '_encloseme', '1', true ); $to_ping = get_to_ping( $post_id ); if ( ! empty( $to_ping ) ) { add_post_meta( $post_id, '_trackbackme', '1' ); } if ( ! wp_next_scheduled( 'do_pings' ) ) { wp_schedule_single_event( time(), 'do_pings' ); } } function wp_get_post_parent_id( $post = null ) { $post = get_post( $post ); if ( ! $post || is_wp_error( $post ) ) { return false; } return (int) $post->post_parent; } function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) { if ( ! $post_parent ) { return 0; } if ( ! $post_ID ) { return $post_parent; } if ( $post_parent == $post_ID ) { return 0; } $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ); if ( ! $loop ) { return $post_parent; } if ( isset( $loop[ $post_ID ] ) ) { return 0; } foreach ( array_keys( $loop ) as $loop_member ) { wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0, ) ); } return $post_parent; } function set_post_thumbnail( $post, $thumbnail_id ) { $post = get_post( $post ); $thumbnail_id = absint( $thumbnail_id ); if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) { if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) { return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id ); } else { return delete_post_meta( $post->ID, '_thumbnail_id' ); } } return false; } function delete_post_thumbnail( $post ) { $post = get_post( $post ); if ( $post ) { return delete_post_meta( $post->ID, '_thumbnail_id' ); } return false; } function wp_delete_auto_drafts() { global $wpdb; $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" ); foreach ( (array) $old_posts as $delete ) { wp_delete_post( $delete, true ); } } function wp_queue_posts_for_term_meta_lazyload( $posts ) { $post_type_taxonomies = array(); $term_ids = array(); foreach ( $posts as $post ) { if ( ! ( $post instanceof WP_Post ) ) { continue; } if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) { $post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type ); } foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) { $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false !== $terms ) { foreach ( $terms as $term ) { if ( ! in_array( $term->term_id, $term_ids, true ) ) { $term_ids[] = $term->term_id; } } } } } if ( $term_ids ) { $lazyloader = wp_metadata_lazyloader(); $lazyloader->queue_objects( 'term', $term_ids ); } } function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) { foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) { $tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) ); wp_update_term_count( $tt_ids, $taxonomy ); } } function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $ids, 'posts' ); if ( ! empty( $non_cached_ids ) ) { $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) ); update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache ); } } function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) { $trashed_posts_with_desired_slug = get_posts( array( 'name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array( $post_ID ), ) ); if ( ! empty( $trashed_posts_with_desired_slug ) ) { foreach ( $trashed_posts_with_desired_slug as $_post ) { wp_add_trashed_suffix_to_post_name_for_post( $_post ); } } } function wp_add_trashed_suffix_to_post_name_for_post( $post ) { global $wpdb; $post = get_post( $post ); if ( '__trashed' === substr( $post->post_name, -9 ) ) { return $post->post_name; } add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name ); $post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed'; $wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $post_name; } function _filter_query_attachment_filenames( $clauses ) { global $wpdb; remove_filter( 'posts_clauses', __FUNCTION__ ); $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )"; $clauses['groupby'] = "{$wpdb->posts}.ID"; $clauses['where'] = preg_replace( "/\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\'[^']+\')\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where'] ); return $clauses; } function wp_cache_set_posts_last_changed() { wp_cache_set( 'last_changed', microtime(), 'posts' ); } function get_available_post_mime_types( $type = 'attachment' ) { global $wpdb; $types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) ); return $types; } function wp_get_original_image_path( $attachment_id, $unfiltered = false ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return false; } $image_meta = wp_get_attachment_metadata( $attachment_id ); $image_file = get_attached_file( $attachment_id, $unfiltered ); if ( empty( $image_meta['original_image'] ) ) { $original_image = $image_file; } else { $original_image = path_join( dirname( $image_file ), $image_meta['original_image'] ); } return apply_filters( 'wp_get_original_image_path', $original_image, $attachment_id ); } function wp_get_original_image_url( $attachment_id ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return false; } $image_url = wp_get_attachment_url( $attachment_id ); if ( ! $image_url ) { return false; } $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $image_meta['original_image'] ) ) { $original_image_url = $image_url; } else { $original_image_url = path_join( dirname( $image_url ), $image_meta['original_image'] ); } return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id ); } function wp_untrash_post_set_previous_status( $new_status, $post_id, $previous_status ) { return $previous_status; } use = $use; $this->_mb_strlen = function_exists('mb_strlen'); $this->_mb_convert_encoding = function_exists('mb_convert_encoding'); $this->_mb_substr = function_exists('mb_substr'); } public function Services_JSON( $use = 0 ) { _deprecated_constructor( 'Services_JSON', '5.3.0', get_class( $this ) ); self::__construct( $use ); } var $_mb_strlen = false; var $_mb_substr = false; var $_mb_convert_encoding = false; function utf162utf8($utf16) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if($this->_mb_convert_encoding) { return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); } $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch(true) { case ((0x7F & $bytes) == $bytes): return chr(0x7F & $bytes); case (0x07FF & $bytes) == $bytes: return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); } return ''; } function utf82utf16($utf8) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if($this->_mb_convert_encoding) { return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); } switch($this->strlen8($utf8)) { case 1: return $utf8; case 2: return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1]))); case 3: return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2]))); } return ''; } function encode($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); header('Content-type: application/json'); return $this->encodeUnsafe($var); } function encodeUnsafe($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $lc = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, 'C'); $ret = $this->_encode($var); setlocale(LC_NUMERIC, $lc); return $ret; } function _encode($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); switch (gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; case 'NULL': return 'null'; case 'integer': return (int) $var; case 'double': case 'float': return (float) $var; case 'string': $ascii = ''; $strlen_var = $this->strlen8($var); for ($c = 0; $c < $strlen_var; ++$c) { $ord_var_c = ord($var[$c]); switch (true) { case $ord_var_c == 0x08: $ascii .= '\b'; break; case $ord_var_c == 0x09: $ascii .= '\t'; break; case $ord_var_c == 0x0A: $ascii .= '\n'; break; case $ord_var_c == 0x0C: $ascii .= '\f'; break; case $ord_var_c == 0x0D: $ascii .= '\r'; break; case $ord_var_c == 0x22: case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: $ascii .= '\\'.$var[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): $ascii .= $var[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): if ($c+1 >= $strlen_var) { $c += 1; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1])); $c += 1; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF0) == 0xE0): if ($c+2 >= $strlen_var) { $c += 2; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, @ord($var[$c + 1]), @ord($var[$c + 2])); $c += 2; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF8) == 0xF0): if ($c+3 >= $strlen_var) { $c += 3; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3])); $c += 3; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFC) == 0xF8): if ($c+4 >= $strlen_var) { $c += 4; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4])); $c += 4; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFE) == 0xFC): if ($c+5 >= $strlen_var) { $c += 5; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4]), ord($var[$c + 5])); $c += 5; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; } } return '"'.$ascii.'"'; case 'array': if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { $properties = array_map(array($this, 'name_value'), array_keys($var), array_values($var)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; } $elements = array_map(array($this, '_encode'), $var); foreach($elements as $element) { if(Services_JSON::isError($element)) { return $element; } } return '[' . join(',', $elements) . ']'; case 'object': if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) { $recode = $var->toJSON(); if (method_exists($recode, 'toJSON')) { return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new Services_JSON_Error(get_class($var). " toJSON returned an object with a toJSON method."); } return $this->_encode( $recode ); } $vars = get_object_vars($var); $properties = array_map(array($this, 'name_value'), array_keys($vars), array_values($vars)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; default: return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); } } function name_value($name, $value) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $encoded_value = $this->_encode($value); if(Services_JSON::isError($encoded_value)) { return $encoded_value; } return $this->_encode((string) $name) . ':' . $encoded_value; } function reduce_string($str) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $str = preg_replace(array( '#^\s*//(.+)$#m', '#^\s*/\*(.+)\*/#Us', '#/\*(.+)\*/\s*$#Us' ), '', $str); return trim($str); } function decode($str) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $str = $this->reduce_string($str); switch (strtolower($str)) { case 'true': return true; case 'false': return false; case 'null': return null; default: $m = array(); if (is_numeric($str)) { return ((float)$str == (integer)$str) ? (integer)$str : (float)$str; } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { $delim = $this->substr8($str, 0, 1); $chrs = $this->substr8($str, 1, -1); $utf8 = ''; $strlen_chrs = $this->strlen8($chrs); for ($c = 0; $c < $strlen_chrs; ++$c) { $substr_chrs_c_2 = $this->substr8($chrs, $c, 2); $ord_chrs_c = ord($chrs[$c]); switch (true) { case $substr_chrs_c_2 == '\b': $utf8 .= chr(0x08); ++$c; break; case $substr_chrs_c_2 == '\t': $utf8 .= chr(0x09); ++$c; break; case $substr_chrs_c_2 == '\n': $utf8 .= chr(0x0A); ++$c; break; case $substr_chrs_c_2 == '\f': $utf8 .= chr(0x0C); ++$c; break; case $substr_chrs_c_2 == '\r': $utf8 .= chr(0x0D); ++$c; break; case $substr_chrs_c_2 == '\\"': case $substr_chrs_c_2 == '\\\'': case $substr_chrs_c_2 == '\\\\': case $substr_chrs_c_2 == '\\/': if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || ($delim == "'" && $substr_chrs_c_2 != '\\"')) { $utf8 .= $chrs[++$c]; } break; case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)): $utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2))) . chr(hexdec($this->substr8($chrs, ($c + 4), 2))); $utf8 .= $this->utf162utf8($utf16); $c += 5; break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): $utf8 .= $chrs[$c]; break; case ($ord_chrs_c & 0xE0) == 0xC0: $utf8 .= $this->substr8($chrs, $c, 2); ++$c; break; case ($ord_chrs_c & 0xF0) == 0xE0: $utf8 .= $this->substr8($chrs, $c, 3); $c += 2; break; case ($ord_chrs_c & 0xF8) == 0xF0: $utf8 .= $this->substr8($chrs, $c, 4); $c += 3; break; case ($ord_chrs_c & 0xFC) == 0xF8: $utf8 .= $this->substr8($chrs, $c, 5); $c += 4; break; case ($ord_chrs_c & 0xFE) == 0xFC: $utf8 .= $this->substr8($chrs, $c, 6); $c += 5; break; } } return $utf8; } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { if ($str[0] == '[') { $stk = array(SERVICES_JSON_IN_ARR); $arr = array(); } else { if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $stk = array(SERVICES_JSON_IN_OBJ); $obj = array(); } else { $stk = array(SERVICES_JSON_IN_OBJ); $obj = new stdClass(); } } array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => 0, 'delim' => false)); $chrs = $this->substr8($str, 1, -1); $chrs = $this->reduce_string($chrs); if ($chrs == '') { if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } else { return $obj; } } $strlen_chrs = $this->strlen8($chrs); for ($c = 0; $c <= $strlen_chrs; ++$c) { $top = end($stk); $substr_chrs_c_2 = $this->substr8($chrs, $c, 2); if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { $slice = $this->substr8($chrs, $top['where'], ($c - $top['where'])); array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); if (reset($stk) == SERVICES_JSON_IN_ARR) { array_push($arr, $this->decode($slice)); } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { $parts = array(); if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) { $key = $this->decode($parts[1]); $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B")); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) { $key = $parts[1]; $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B")); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } } } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c])); } elseif (($chrs[$c] == $top['delim']) && ($top['what'] == SERVICES_JSON_IN_STR) && (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) { array_pop($stk); } elseif (($chrs[$c] == '[') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { array_pop($stk); } elseif (($chrs[$c] == '{') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { array_pop($stk); } elseif (($substr_chrs_c_2 == '/*') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); $c++; } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { array_pop($stk); $c++; for ($i = $top['where']; $i <= $c; ++$i) $chrs = substr_replace($chrs, ' ', $i, 1); } } if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { return $obj; } } } } function isError($data, $code = null) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if (class_exists('pear')) { return PEAR::isError($data, $code); } elseif (is_object($data) && ($data instanceof services_json_error || is_subclass_of($data, 'services_json_error'))) { return true; } return false; } function strlen8( $str ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if ( $this->_mb_strlen ) { return mb_strlen( $str, "8bit" ); } return strlen( $str ); } function substr8( $string, $start, $length=false ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if ( $length === false ) { $length = $this->strlen8( $string ) - $start; } if ( $this->_mb_substr ) { return mb_substr( $string, $start, $length, "8bit" ); } return substr( $string, $start, $length ); } } if (class_exists('PEAR_Error')) { class Services_JSON_Error extends PEAR_Error { function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); parent::PEAR_Error($message, $code, $mode, $options, $userinfo); } public function Services_JSON_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { _deprecated_constructor( 'Services_JSON_Error', '5.3.0', get_class( $this ) ); self::__construct($message, $code, $mode, $options, $userinfo); } } } else { class Services_JSON_Error { function __construct( $message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); } public function Services_JSON_Error( $message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null ) { _deprecated_constructor( 'Services_JSON_Error', '5.3.0', get_class( $this ) ); self::__construct( $message, $code, $mode, $options, $userinfo ); } } } endif; ' . SIMPLEPIE_NAME . ''); define('SIMPLEPIE_LOCATOR_NONE', 0); define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1); define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2); define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4); define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8); define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16); define('SIMPLEPIE_LOCATOR_ALL', 31); define('SIMPLEPIE_TYPE_NONE', 0); define('SIMPLEPIE_TYPE_RSS_090', 1); define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2); define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4); define('SIMPLEPIE_TYPE_RSS_091', 6); define('SIMPLEPIE_TYPE_RSS_092', 8); define('SIMPLEPIE_TYPE_RSS_093', 16); define('SIMPLEPIE_TYPE_RSS_094', 32); define('SIMPLEPIE_TYPE_RSS_10', 64); define('SIMPLEPIE_TYPE_RSS_20', 128); define('SIMPLEPIE_TYPE_RSS_RDF', 65); define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190); define('SIMPLEPIE_TYPE_RSS_ALL', 255); define('SIMPLEPIE_TYPE_ATOM_03', 256); define('SIMPLEPIE_TYPE_ATOM_10', 512); define('SIMPLEPIE_TYPE_ATOM_ALL', 768); define('SIMPLEPIE_TYPE_ALL', 1023); define('SIMPLEPIE_CONSTRUCT_NONE', 0); define('SIMPLEPIE_CONSTRUCT_TEXT', 1); define('SIMPLEPIE_CONSTRUCT_HTML', 2); define('SIMPLEPIE_CONSTRUCT_XHTML', 4); define('SIMPLEPIE_CONSTRUCT_BASE64', 8); define('SIMPLEPIE_CONSTRUCT_IRI', 16); define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32); define('SIMPLEPIE_CONSTRUCT_ALL', 63); define('SIMPLEPIE_SAME_CASE', 1); define('SIMPLEPIE_LOWERCASE', 2); define('SIMPLEPIE_UPPERCASE', 4); define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'); define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace'); define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom'); define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#'); define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/'); define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/'); define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/'); define('SIMPLEPIE_NAMESPACE_RSS_20', ''); define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/'); define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/'); define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#'); define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/'); define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml'); define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/'); define('SIMPLEPIE_FILE_SOURCE_NONE', 0); define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1); define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2); define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4); define('SIMPLEPIE_FILE_SOURCE_CURL', 8); define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16); class SimplePie { public $data = array(); public $error; public $status_code; public $sanitize; public $useragent = SIMPLEPIE_USERAGENT; public $feed_url; public $permanent_url = null; public $file; public $raw_data; public $timeout = 10; public $curl_options = array(); public $force_fsockopen = false; public $force_feed = false; public $cache = true; public $force_cache_fallback = false; public $cache_duration = 3600; public $autodiscovery_cache_duration = 604800; public $cache_location = './cache'; public $cache_name_function = 'md5'; public $order_by_date = true; public $input_encoding = false; public $autodiscovery = SIMPLEPIE_LOCATOR_ALL; public $registry; public $max_checked_feeds = 10; public $all_discovered_feeds = array(); public $image_handler = ''; public $multifeed_url = array(); public $multifeed_objects = array(); public $config_settings = null; public $item_limit = 0; public $check_modified = false; public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); public $enable_exceptions = false; public function __construct() { if (version_compare(PHP_VERSION, '5.6', '<')) { trigger_error('Please upgrade to PHP 5.6 or newer.'); die(); } $this->sanitize = new SimplePie_Sanitize(); $this->registry = new SimplePie_Registry(); if (func_num_args() > 0) { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', $level); $args = func_get_args(); switch (count($args)) { case 3: $this->set_cache_duration($args[2]); case 2: $this->set_cache_location($args[1]); case 1: $this->set_feed_url($args[0]); $this->init(); } } } public function __toString() { return md5(serialize($this->data)); } public function __destruct() { if (!gc_enabled()) { if (!empty($this->data['items'])) { foreach ($this->data['items'] as $item) { $item->__destruct(); } unset($item, $this->data['items']); } if (!empty($this->data['ordered_items'])) { foreach ($this->data['ordered_items'] as $item) { $item->__destruct(); } unset($item, $this->data['ordered_items']); } } } public function force_feed($enable = false) { $this->force_feed = (bool) $enable; } public function set_feed_url($url) { $this->multifeed_url = array(); if (is_array($url)) { foreach ($url as $value) { $this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1)); } } else { $this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1)); $this->permanent_url = $this->feed_url; } } public function set_file(&$file) { if ($file instanceof SimplePie_File) { $this->feed_url = $file->url; $this->permanent_url = $this->feed_url; $this->file =& $file; return true; } return false; } public function set_raw_data($data) { $this->raw_data = $data; } public function set_timeout($timeout = 10) { $this->timeout = (int) $timeout; } public function set_curl_options(array $curl_options = array()) { $this->curl_options = $curl_options; } public function force_fsockopen($enable = false) { $this->force_fsockopen = (bool) $enable; } public function enable_cache($enable = true) { $this->cache = (bool) $enable; } public function force_cache_fallback($enable = false) { $this->force_cache_fallback= (bool) $enable; } public function set_cache_duration($seconds = 3600) { $this->cache_duration = (int) $seconds; } public function set_autodiscovery_cache_duration($seconds = 604800) { $this->autodiscovery_cache_duration = (int) $seconds; } public function set_cache_location($location = './cache') { $this->cache_location = (string) $location; } public function get_cache_filename($url) { $url .= $this->force_feed ? '#force_feed' : ''; $options = array(); if ($this->timeout != 10) { $options[CURLOPT_TIMEOUT] = $this->timeout; } if ($this->useragent !== SIMPLEPIE_USERAGENT) { $options[CURLOPT_USERAGENT] = $this->useragent; } if (!empty($this->curl_options)) { foreach ($this->curl_options as $k => $v) { $options[$k] = $v; } } if (!empty($options)) { ksort($options); $url .= '#' . urlencode(var_export($options, true)); } return call_user_func($this->cache_name_function, $url); } public function enable_order_by_date($enable = true) { $this->order_by_date = (bool) $enable; } public function set_input_encoding($encoding = false) { if ($encoding) { $this->input_encoding = (string) $encoding; } else { $this->input_encoding = false; } } public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) { $this->autodiscovery = (int) $level; } public function &get_registry() { return $this->registry; } public function set_cache_class($class = 'SimplePie_Cache') { return $this->registry->register('Cache', $class, true); } public function set_locator_class($class = 'SimplePie_Locator') { return $this->registry->register('Locator', $class, true); } public function set_parser_class($class = 'SimplePie_Parser') { return $this->registry->register('Parser', $class, true); } public function set_file_class($class = 'SimplePie_File') { return $this->registry->register('File', $class, true); } public function set_sanitize_class($class = 'SimplePie_Sanitize') { return $this->registry->register('Sanitize', $class, true); } public function set_item_class($class = 'SimplePie_Item') { return $this->registry->register('Item', $class, true); } public function set_author_class($class = 'SimplePie_Author') { return $this->registry->register('Author', $class, true); } public function set_category_class($class = 'SimplePie_Category') { return $this->registry->register('Category', $class, true); } public function set_enclosure_class($class = 'SimplePie_Enclosure') { return $this->registry->register('Enclosure', $class, true); } public function set_caption_class($class = 'SimplePie_Caption') { return $this->registry->register('Caption', $class, true); } public function set_copyright_class($class = 'SimplePie_Copyright') { return $this->registry->register('Copyright', $class, true); } public function set_credit_class($class = 'SimplePie_Credit') { return $this->registry->register('Credit', $class, true); } public function set_rating_class($class = 'SimplePie_Rating') { return $this->registry->register('Rating', $class, true); } public function set_restriction_class($class = 'SimplePie_Restriction') { return $this->registry->register('Restriction', $class, true); } public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') { return $this->registry->register('Content_Type_Sniffer', $class, true); } public function set_source_class($class = 'SimplePie_Source') { return $this->registry->register('Source', $class, true); } public function set_useragent($ua = SIMPLEPIE_USERAGENT) { $this->useragent = (string) $ua; } public function set_cache_name_function($function = 'md5') { if (is_callable($function)) { $this->cache_name_function = $function; } } public function set_stupidly_fast($set = false) { if ($set) { $this->enable_order_by_date(false); $this->remove_div(false); $this->strip_comments(false); $this->strip_htmltags(false); $this->strip_attributes(false); $this->add_attributes(false); $this->set_image_handler(false); $this->set_https_domains(array()); } } public function set_max_checked_feeds($max = 10) { $this->max_checked_feeds = (int) $max; } public function remove_div($enable = true) { $this->sanitize->remove_div($enable); } public function strip_htmltags($tags = '', $encode = null) { if ($tags === '') { $tags = $this->strip_htmltags; } $this->sanitize->strip_htmltags($tags); if ($encode !== null) { $this->sanitize->encode_instead_of_strip($tags); } } public function encode_instead_of_strip($enable = true) { $this->sanitize->encode_instead_of_strip($enable); } public function strip_attributes($attribs = '') { if ($attribs === '') { $attribs = $this->strip_attributes; } $this->sanitize->strip_attributes($attribs); } public function add_attributes($attribs = '') { if ($attribs === '') { $attribs = $this->add_attributes; } $this->sanitize->add_attributes($attribs); } public function set_output_encoding($encoding = 'UTF-8') { $this->sanitize->set_output_encoding($encoding); } public function strip_comments($strip = false) { $this->sanitize->strip_comments($strip); } public function set_url_replacements($element_attribute = null) { $this->sanitize->set_url_replacements($element_attribute); } public function set_https_domains($domains = array()) { if (is_array($domains)) { $this->sanitize->set_https_domains($domains); } } public function set_image_handler($page = false, $qs = 'i') { if ($page !== false) { $this->sanitize->set_image_handler($page . '?' . $qs . '='); } else { $this->image_handler = ''; } } public function set_item_limit($limit = 0) { $this->item_limit = (int) $limit; } public function enable_exceptions($enable = true) { $this->enable_exceptions = $enable; } public function init() { if (!extension_loaded('xml') || !extension_loaded('pcre')) { $this->error = 'XML or PCRE extensions not loaded!'; return false; } elseif (!extension_loaded('xmlreader')) { static $xml_is_sane = null; if ($xml_is_sane === null) { $parser_check = xml_parser_create(); xml_parse_into_struct($parser_check, '&', $values); xml_parser_free($parser_check); $xml_is_sane = isset($values[0]['value']); } if (!$xml_is_sane) { return false; } } if ($this->registry->get_class('Sanitize') !== 'SimplePie_Sanitize') { $this->sanitize = $this->registry->create('Sanitize'); } if (method_exists($this->sanitize, 'set_registry')) { $this->sanitize->set_registry($this->registry); } $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache')); $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); if (!empty($this->multifeed_url)) { $i = 0; $success = 0; $this->multifeed_objects = array(); $this->error = array(); foreach ($this->multifeed_url as $url) { $this->multifeed_objects[$i] = clone $this; $this->multifeed_objects[$i]->set_feed_url($url); $single_success = $this->multifeed_objects[$i]->init(); $success |= $single_success; if (!$single_success) { $this->error[$i] = $this->multifeed_objects[$i]->error(); } $i++; } return (bool) $success; } elseif ($this->feed_url === null && $this->raw_data === null) { return false; } $this->error = null; $this->data = array(); $this->check_modified = false; $this->multifeed_objects = array(); $cache = false; if ($this->feed_url !== null) { $parsed_feed_url = $this->registry->call('Misc', 'parse_url', array($this->feed_url)); if ($this->cache && $parsed_feed_url['scheme'] !== '') { $filename = $this->get_cache_filename($this->feed_url); $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $filename, 'spc')); } if (($fetched = $this->fetch_data($cache)) === true) { return true; } elseif ($fetched === false) { return false; } list($headers, $sniffed) = $fetched; } if(empty($this->raw_data)){ $this->error = "A feed could not be found at `$this->feed_url`. Empty body."; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } $encodings = array(); if ($this->input_encoding !== false) { $encodings[] = strtoupper($this->input_encoding); } $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); $text_types = array('text/xml', 'text/xml-external-parsed-entity'); if (isset($sniffed)) { if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { $encodings[] = strtoupper($charset[1]); } $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); $encodings[] = 'UTF-8'; } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { $encodings[] = strtoupper($charset[1]); } $encodings[] = 'US-ASCII'; } elseif (substr($sniffed, 0, 5) === 'text/') { $encodings[] = 'UTF-8'; } } $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); $encodings[] = 'UTF-8'; $encodings[] = 'ISO-8859-1'; $encodings = array_unique($encodings); foreach ($encodings as $encoding) { if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) { $parser = $this->registry->create('Parser'); if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url)) { $this->data = $parser->get_data(); if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE)) { $this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed."; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } if (isset($headers)) { $this->data['headers'] = $headers; } $this->data['build'] = SIMPLEPIE_BUILD; if ($cache && !$cache->save($this)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } return true; } } } if (isset($parser)) { $this->error = $this->feed_url; $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); } else { $this->error = 'The data could not be converted to UTF-8.'; if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) { $this->error .= ' You MUST have either the iconv, mbstring or intl (PHP 5.5+) extension installed and enabled.'; } else { $missingExtensions = array(); if (!extension_loaded('iconv')) { $missingExtensions[] = 'iconv'; } if (!extension_loaded('mbstring')) { $missingExtensions[] = 'mbstring'; } if (!class_exists('\UConverter')) { $missingExtensions[] = 'intl (PHP 5.5+)'; } $this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.'; } } $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } protected function fetch_data(&$cache) { if ($cache) { $this->data = $cache->load(); if (!empty($this->data)) { if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) { $cache->unlink(); $this->data = array(); } elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) { $cache = false; $this->data = array(); } elseif (isset($this->data['feed_url'])) { if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) { if ($this->data['feed_url'] !== $this->data['url']) { $this->set_feed_url($this->data['feed_url']); return $this->init(); } $cache->unlink(); $this->data = array(); } } elseif ($cache->mtime() + $this->cache_duration < time()) { $this->check_modified = true; if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) { $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); if (isset($this->data['headers']['last-modified'])) { $headers['if-modified-since'] = $this->data['headers']['last-modified']; } if (isset($this->data['headers']['etag'])) { $headers['if-none-match'] = $this->data['headers']['etag']; } $file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); $this->status_code = $file->status_code; if ($file->success) { if ($file->status_code === 304) { $this->raw_data = false; $cache->touch(); return true; } } else { $this->check_modified = false; if($this->force_cache_fallback) { $cache->touch(); return true; } unset($file); } } } else { $this->raw_data = false; return true; } } else { $cache->unlink(); $this->data = array(); } } if (!isset($file)) { if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url) { $file =& $this->file; } else { $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); } } $this->status_code = $file->status_code; if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { $this->error = $file->error; return !empty($this->data); } if (!$this->force_feed) { $locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options)); if (!$locate->is_feed($file)) { $copyStatusCode = $file->status_code; $copyContentType = $file->headers['content-type']; try { $microformats = false; if (class_exists('DOMXpath') && function_exists('Mf2\parse')) { $doc = new DOMDocument(); @$doc->loadHTML($file->body); $xpath = new DOMXpath($doc); $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '. 'contains(concat(" ", @class, " "), " h-entry ")]'; $result = $xpath->query($query); $microformats = $result->length !== 0; } $discovered = $locate->find($this->autodiscovery, $this->all_discovered_feeds); if ($microformats) { if ($hub = $locate->get_rel_link('hub')) { $self = $locate->get_rel_link('self'); $this->store_links($file, $hub, $self); } if (isset($this->all_discovered_feeds)) { $this->all_discovered_feeds[] = $file; } } else { if ($discovered) { $file = $discovered; } else { unset($file); $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } } } catch (SimplePie_Exception $e) { unset($file); $this->error = $e->getMessage(); $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine())); return false; } if ($cache) { $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); if (!$cache->save($this)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); } } $this->feed_url = $file->url; $locate = null; } $this->raw_data = $file->body; $this->permanent_url = $file->permanent_url; $headers = $file->headers; $sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file)); $sniffed = $sniffer->get_type(); return array($headers, $sniffed); } public function error() { return $this->error; } public function status_code() { return $this->status_code; } public function get_raw_data() { return $this->raw_data; } public function get_encoding() { return $this->sanitize->output_encoding; } public function handle_content_type($mime = 'text/html') { if (!headers_sent()) { $header = "Content-type: $mime;"; if ($this->get_encoding()) { $header .= ' charset=' . $this->get_encoding(); } else { $header .= ' charset=UTF-8'; } header($header); } } public function get_type() { if (!isset($this->data['type'])) { $this->data['type'] = SIMPLEPIE_TYPE_ALL; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) { $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) { $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10; } if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; } } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { case '0.91': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { case '0': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; break; case '24': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND; break; } } break; case '0.92': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092; break; case '0.93': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093; break; case '0.94': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094; break; case '2.0': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20; break; } } } else { $this->data['type'] = SIMPLEPIE_TYPE_NONE; } } return $this->data['type']; } public function subscribe_url($permanent = false) { if ($permanent) { if ($this->permanent_url !== null) { return str_replace('&', '&', $this->sanitize($this->permanent_url, SIMPLEPIE_CONSTRUCT_IRI)); } } else { if ($this->feed_url !== null) { return str_replace('&', '&', $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI)); } } return null; } public function get_feed_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_10) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_ATOM_03) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_RSS_RDF) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; } } return null; } public function get_channel_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_ALL) { if ($return = $this->get_feed_tags($namespace, $tag)) { return $return; } } if ($type & SIMPLEPIE_TYPE_RSS_10) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_090) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } return null; } public function get_image_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_RSS_10) { if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_090) { if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } return null; } public function get_base($element = array()) { if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) { return $element['xml_base']; } elseif ($this->get_link() !== null) { return $this->get_link(); } return $this->subscribe_url(); } public function sanitize($data, $type, $base = '') { try { return $this->sanitize->sanitize($data, $type, $base); } catch (SimplePie_Exception $e) { if (!$this->enable_exceptions) { $this->error = $e->getMessage(); $this->registry->call('Misc', 'error', array($this->error, E_USER_WARNING, $e->getFile(), $e->getLine())); return ''; } throw $e; } } public function get_title() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) { return $categories[$key]; } return null; } public function get_categories() { $categories = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { $term = null; $scheme = null; $label = null; if (isset($category['attribs']['']['term'])) { $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['scheme'])) { $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); if (isset($category['attribs']['']['domain'])) { $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); } else { $scheme = null; } $categories[] = $this->registry->create('Category', array($term, $scheme, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($categories)) { return array_unique($categories); } return null; } public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) { return $authors[$key]; } return null; } public function get_authors() { $authors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { $name = null; $uri = null; $email = null; if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $authors[] = $this->registry->create('Author', array($name, $uri, $email)); } } if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { $name = null; $url = null; $email = null; if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $authors[] = $this->registry->create('Author', array($name, $url, $email)); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($authors)) { return array_unique($authors); } return null; } public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) { return $contributors[$key]; } return null; } public function get_contributors() { $contributors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { $name = null; $uri = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { $name = null; $url = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $contributors[] = $this->registry->create('Author', array($name, $url, $email)); } } if (!empty($contributors)) { return array_unique($contributors); } return null; } public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if (isset($links[$key])) { return $links[$key]; } return null; } public function get_permalink() { return $this->get_link(0); } public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { $this->data['links'] = array(); if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } $keys = array_keys($this->data['links']); foreach ($keys as $key) { if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) { if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; } else { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; } } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; } $this->data['links'][$key] = array_unique($this->data['links'][$key]); } } if (isset($this->data['headers']['link'])) { $link_headers = $this->data['headers']['link']; if (is_string($link_headers)) { $link_headers = array($link_headers); } $matches = preg_filter('/<([^>]+)>; rel='.preg_quote($rel).'/', '$1', $link_headers); if (!empty($matches)) { return $matches; } } if (isset($this->data['links'][$rel])) { return $this->data['links'][$rel]; } return null; } public function get_all_discovered_feeds() { return $this->all_discovered_feeds; } public function get_description() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } return null; } public function get_copyright() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_language() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['headers']['content-language'])) { return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_latitude() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } return null; } public function get_longitude() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { return (float) $return[0]['data']; } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { return (float) $return[0]['data']; } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } return null; } public function get_image_title() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_image_url() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } return null; } public function get_image_link() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } return null; } public function get_image_width() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) { return round($return[0]['data']); } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return 88.0; } return null; } public function get_image_height() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) { return round($return[0]['data']); } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return 31.0; } return null; } public function get_item_quantity($max = 0) { $max = (int) $max; $qty = count($this->get_items()); if ($max === 0) { return $qty; } return ($qty > $max) ? $max : $qty; } public function get_item($key = 0) { $items = $this->get_items(); if (isset($items[$key])) { return $items[$key]; } return null; } public function get_items($start = 0, $end = 0) { if (!isset($this->data['items'])) { if (!empty($this->multifeed_objects)) { $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); if (empty($this->data['items'])) { return array(); } return $this->data['items']; } $this->data['items'] = array(); if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } } if (empty($this->data['items'])) { return array(); } if ($this->order_by_date) { if (!isset($this->data['ordered_items'])) { $this->data['ordered_items'] = $this->data['items']; usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); } $items = $this->data['ordered_items']; } else { $items = $this->data['items']; } if ($end === 0) { return array_slice($items, $start); } return array_slice($items, $start, $end); } public function set_favicon_handler($page = false, $qs = 'i') { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Favicon handling has been removed, please use your own handling', $level); return false; } public function get_favicon() { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Favicon handling has been removed, please use your own handling', $level); if (($url = $this->get_link()) !== null) { return 'https://www.google.com/s2/favicons?domain=' . urlencode($url); } return false; } public function __call($method, $args) { if (strpos($method, 'subscribe_') === 0) { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level); return ''; } if ($method === 'enable_xml_dump') { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level); return false; } $class = get_class($this); $trace = debug_backtrace(); $file = $trace[0]['file']; $line = $trace[0]['line']; trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR); } public static function sort_items($a, $b) { $a_date = $a->get_date('U'); $b_date = $b->get_date('U'); if ($a_date && $b_date) { return $a_date > $b_date ? -1 : 1; } if ($a_date) { return 1; } if ($b_date) { return -1; } return 0; } public static function merge_items($urls, $start = 0, $end = 0, $limit = 0) { if (is_array($urls) && sizeof($urls) > 0) { $items = array(); foreach ($urls as $arg) { if ($arg instanceof SimplePie) { $items = array_merge($items, $arg->get_items(0, $limit)); } else { trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); } } usort($items, array(get_class($urls[0]), 'sort_items')); if ($end === 0) { return array_slice($items, $start); } return array_slice($items, $start, $end); } trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); return array(); } private function store_links(&$file, $hub, $self) { if (isset($file->headers['link']['hub']) || (isset($file->headers['link']) && preg_match('/rel=hub/', $file->headers['link']))) { return; } if ($hub) { if (isset($file->headers['link'])) { if ($file->headers['link'] !== '') { $file->headers['link'] = ', '; } } else { $file->headers['link'] = ''; } $file->headers['link'] .= '<'.$hub.'>; rel=hub'; if ($self) { $file->headers['link'] .= ', <'.$self.'>; rel=self'; } } } } endif; '', 'from' => '', 'where' => array(), 'orderby' => '', 'limits' => '', ); public $query_vars; public $query_var_defaults; public $terms; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'taxonomy' => null, 'object_ids' => null, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'include' => array(), 'exclude' => array(), 'exclude_tree' => array(), 'number' => '', 'offset' => '', 'fields' => 'all', 'count' => false, 'name' => '', 'slug' => '', 'term_taxonomy_id' => '', 'hierarchical' => true, 'search' => '', 'name__like' => '', 'description__like' => '', 'pad_counts' => false, 'get' => '', 'child_of' => 0, 'parent' => '', 'childless' => false, 'cache_domain' => 'core', 'update_term_meta_cache' => true, 'meta_query' => '', 'meta_key' => '', 'meta_value' => '', 'meta_type' => '', 'meta_compare' => '', ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $taxonomies = isset( $query['taxonomy'] ) ? (array) $query['taxonomy'] : null; $this->query_var_defaults = apply_filters( 'get_terms_defaults', $this->query_var_defaults, $taxonomies ); $query = wp_parse_args( $query, $this->query_var_defaults ); $query['number'] = absint( $query['number'] ); $query['offset'] = absint( $query['offset'] ); if ( 0 < (int) $query['parent'] ) { $query['child_of'] = false; } if ( 'all' === $query['get'] ) { $query['childless'] = false; $query['child_of'] = 0; $query['hide_empty'] = 0; $query['hierarchical'] = false; $query['pad_counts'] = false; } $query['taxonomy'] = $taxonomies; $this->query_vars = $query; do_action( 'parse_term_query', $this ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_terms(); } public function get_terms() { global $wpdb; $this->parse_query( $this->query_vars ); $args = &$this->query_vars; $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $args ); do_action_ref_array( 'pre_get_terms', array( &$this ) ); $taxonomies = (array) $args['taxonomy']; $has_hierarchical_tax = false; if ( $taxonomies ) { foreach ( $taxonomies as $_tax ) { if ( is_taxonomy_hierarchical( $_tax ) ) { $has_hierarchical_tax = true; } } } else { $has_hierarchical_tax = true; } if ( ! $has_hierarchical_tax ) { $args['hierarchical'] = false; $args['pad_counts'] = false; } if ( 0 < (int) $args['parent'] ) { $args['child_of'] = false; } if ( 'all' === $args['get'] ) { $args['childless'] = false; $args['child_of'] = 0; $args['hide_empty'] = 0; $args['hierarchical'] = false; $args['pad_counts'] = false; } $args = apply_filters( 'get_terms_args', $args, $taxonomies ); $child_of = $args['child_of']; $parent = $args['parent']; if ( $child_of ) { $_parent = $child_of; } elseif ( $parent ) { $_parent = $parent; } else { $_parent = false; } if ( $_parent ) { $in_hierarchy = false; foreach ( $taxonomies as $_tax ) { $hierarchy = _get_term_hierarchy( $_tax ); if ( isset( $hierarchy[ $_parent ] ) ) { $in_hierarchy = true; } } if ( ! $in_hierarchy ) { if ( 'count' === $args['fields'] ) { return 0; } else { $this->terms = array(); return $this->terms; } } } $_orderby = $this->query_vars['orderby']; if ( 'term_order' === $_orderby && empty( $this->query_vars['object_ids'] ) ) { $_orderby = 'term_id'; } $orderby = $this->parse_orderby( $_orderby ); if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $order = $this->parse_order( $this->query_vars['order'] ); if ( $taxonomies ) { $this->sql_clauses['where']['taxonomy'] = "tt.taxonomy IN ('" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "')"; } if ( empty( $args['exclude'] ) ) { $args['exclude'] = array(); } if ( empty( $args['include'] ) ) { $args['include'] = array(); } $exclude = $args['exclude']; $exclude_tree = $args['exclude_tree']; $include = $args['include']; $inclusions = ''; if ( ! empty( $include ) ) { $exclude = ''; $exclude_tree = ''; $inclusions = implode( ',', wp_parse_id_list( $include ) ); } if ( ! empty( $inclusions ) ) { $this->sql_clauses['where']['inclusions'] = 't.term_id IN ( ' . $inclusions . ' )'; } $exclusions = array(); if ( ! empty( $exclude_tree ) ) { $exclude_tree = wp_parse_id_list( $exclude_tree ); $excluded_children = $exclude_tree; foreach ( $exclude_tree as $extrunk ) { $excluded_children = array_merge( $excluded_children, (array) get_terms( array( 'taxonomy' => reset( $taxonomies ), 'child_of' => (int) $extrunk, 'fields' => 'ids', 'hide_empty' => 0, ) ) ); } $exclusions = array_merge( $excluded_children, $exclusions ); } if ( ! empty( $exclude ) ) { $exclusions = array_merge( wp_parse_id_list( $exclude ), $exclusions ); } $childless = (bool) $args['childless']; if ( $childless ) { foreach ( $taxonomies as $_tax ) { $term_hierarchy = _get_term_hierarchy( $_tax ); $exclusions = array_merge( array_keys( $term_hierarchy ), $exclusions ); } } if ( ! empty( $exclusions ) ) { $exclusions = 't.term_id NOT IN (' . implode( ',', array_map( 'intval', $exclusions ) ) . ')'; } else { $exclusions = ''; } $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies ); if ( ! empty( $exclusions ) ) { $this->sql_clauses['where']['exclusions'] = preg_replace( '/^\s*AND\s*/', '', $exclusions ); } if ( '' === $args['name'] ) { $args['name'] = array(); } else { $args['name'] = (array) $args['name']; } if ( ! empty( $args['name'] ) ) { $names = $args['name']; foreach ( $names as &$_name ) { $_name = stripslashes( sanitize_term_field( 'name', $_name, 0, reset( $taxonomies ), 'db' ) ); } $this->sql_clauses['where']['name'] = "t.name IN ('" . implode( "', '", array_map( 'esc_sql', $names ) ) . "')"; } if ( '' === $args['slug'] ) { $args['slug'] = array(); } else { $args['slug'] = array_map( 'sanitize_title', (array) $args['slug'] ); } if ( ! empty( $args['slug'] ) ) { $slug = implode( "', '", $args['slug'] ); $this->sql_clauses['where']['slug'] = "t.slug IN ('" . $slug . "')"; } if ( '' === $args['term_taxonomy_id'] ) { $args['term_taxonomy_id'] = array(); } else { $args['term_taxonomy_id'] = array_map( 'intval', (array) $args['term_taxonomy_id'] ); } if ( ! empty( $args['term_taxonomy_id'] ) ) { $tt_ids = implode( ',', $args['term_taxonomy_id'] ); $this->sql_clauses['where']['term_taxonomy_id'] = "tt.term_taxonomy_id IN ({$tt_ids})"; } if ( ! empty( $args['name__like'] ) ) { $this->sql_clauses['where']['name__like'] = $wpdb->prepare( 't.name LIKE %s', '%' . $wpdb->esc_like( $args['name__like'] ) . '%' ); } if ( ! empty( $args['description__like'] ) ) { $this->sql_clauses['where']['description__like'] = $wpdb->prepare( 'tt.description LIKE %s', '%' . $wpdb->esc_like( $args['description__like'] ) . '%' ); } if ( '' === $args['object_ids'] ) { $args['object_ids'] = array(); } else { $args['object_ids'] = array_map( 'intval', (array) $args['object_ids'] ); } if ( ! empty( $args['object_ids'] ) ) { $object_ids = implode( ', ', $args['object_ids'] ); $this->sql_clauses['where']['object_ids'] = "tr.object_id IN ($object_ids)"; } if ( ! empty( $args['object_ids'] ) ) { $args['hide_empty'] = false; } if ( '' !== $parent ) { $parent = (int) $parent; $this->sql_clauses['where']['parent'] = "tt.parent = '$parent'"; } $hierarchical = $args['hierarchical']; if ( 'count' === $args['fields'] ) { $hierarchical = false; } if ( $args['hide_empty'] && ! $hierarchical ) { $this->sql_clauses['where']['count'] = 'tt.count > 0'; } $number = $args['number']; $offset = $args['offset']; if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } else { $limits = ''; } if ( ! empty( $args['search'] ) ) { $this->sql_clauses['where']['search'] = $this->get_search_sql( $args['search'] ); } $join = ''; $distinct = ''; $this->meta_query->parse_query_vars( $this->query_vars ); $mq_sql = $this->meta_query->get_sql( 'term', 't', 'term_id' ); $meta_clauses = $this->meta_query->get_clauses(); if ( ! empty( $meta_clauses ) ) { $join .= $mq_sql['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $mq_sql['where'] ); $distinct .= 'DISTINCT'; } $selects = array(); switch ( $args['fields'] ) { case 'count': $orderby = ''; $order = ''; $selects = array( 'COUNT(*)' ); break; default: $selects = array( 't.term_id' ); if ( 'all_with_object_id' === $args['fields'] && ! empty( $args['object_ids'] ) ) { $selects[] = 'tr.object_id'; } break; } $_fields = $args['fields']; $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) ); $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; if ( ! empty( $this->query_vars['object_ids'] ) ) { $join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $distinct = 'DISTINCT'; } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); $clauses = apply_filters( 'terms_clauses', compact( $clauses ), $taxonomies, $args ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $order = isset( $clauses['order'] ) ? $clauses['order'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; if ( $where ) { $where = "WHERE $where"; } $this->sql_clauses['select'] = "SELECT $distinct $fields"; $this->sql_clauses['from'] = "FROM $wpdb->terms AS t $join"; $this->sql_clauses['orderby'] = $orderby ? "$orderby $order" : ''; $this->sql_clauses['limits'] = $limits; $this->request = " + {$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']} + "; $this->terms = null; $this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) ); if ( null !== $this->terms ) { return $this->terms; } $cache_args = wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ); unset( $cache_args['update_term_meta_cache'] ); if ( 'count' !== $_fields && 'all_with_object_id' !== $_fields ) { $cache_args['fields'] = 'all'; } $key = md5( serialize( $cache_args ) . serialize( $taxonomies ) . $this->request ); $last_changed = wp_cache_get_last_changed( 'terms' ); $cache_key = "get_terms:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'terms' ); if ( false !== $cache ) { if ( 'ids' === $_fields ) { $cache = array_map( 'intval', $cache ); } elseif ( 'count' !== $_fields ) { if ( ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) || ( 'all' === $_fields && $args['pad_counts'] ) ) { $term_ids = wp_list_pluck( $cache, 'term_id' ); } else { $term_ids = array_map( 'intval', $cache ); } _prime_term_caches( $term_ids, $args['update_term_meta_cache'] ); $term_objects = $this->populate_terms( $cache ); $cache = $this->format_terms( $term_objects, $_fields ); } $this->terms = $cache; return $this->terms; } if ( 'count' === $_fields ) { $count = $wpdb->get_var( $this->request ); wp_cache_set( $cache_key, $count, 'terms' ); return $count; } $terms = $wpdb->get_results( $this->request ); if ( empty( $terms ) ) { wp_cache_add( $cache_key, array(), 'terms' ); return array(); } $term_ids = wp_list_pluck( $terms, 'term_id' ); _prime_term_caches( $term_ids, false ); $term_objects = $this->populate_terms( $terms ); if ( $child_of ) { foreach ( $taxonomies as $_tax ) { $children = _get_term_hierarchy( $_tax ); if ( ! empty( $children ) ) { $term_objects = _get_term_children( $child_of, $term_objects, $_tax ); } } } if ( $args['pad_counts'] && 'all' === $_fields ) { foreach ( $taxonomies as $_tax ) { _pad_term_counts( $term_objects, $_tax ); } } if ( $hierarchical && $args['hide_empty'] && is_array( $term_objects ) ) { foreach ( $term_objects as $k => $term ) { if ( ! $term->count ) { $children = get_term_children( $term->term_id, $term->taxonomy ); if ( is_array( $children ) ) { foreach ( $children as $child_id ) { $child = get_term( $child_id, $term->taxonomy ); if ( $child->count ) { continue 2; } } } unset( $term_objects[ $k ] ); } } } if ( $hierarchical && $number && is_array( $term_objects ) ) { if ( $offset >= count( $term_objects ) ) { $term_objects = array(); } else { $term_objects = array_slice( $term_objects, $offset, $number, true ); } } if ( $args['update_term_meta_cache'] ) { $term_ids = wp_list_pluck( $term_objects, 'term_id' ); update_termmeta_cache( $term_ids ); } if ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) { $term_cache = array(); foreach ( $term_objects as $term ) { $object = new stdClass(); $object->term_id = $term->term_id; $object->object_id = $term->object_id; $term_cache[] = $object; } } elseif ( 'all' === $_fields && $args['pad_counts'] ) { $term_cache = array(); foreach ( $term_objects as $term ) { $object = new stdClass(); $object->term_id = $term->term_id; $object->count = $term->count; $term_cache[] = $object; } } else { $term_cache = wp_list_pluck( $term_objects, 'term_id' ); } wp_cache_add( $cache_key, $term_cache, 'terms' ); $this->terms = $this->format_terms( $term_objects, $_fields ); return $this->terms; } protected function parse_orderby( $orderby_raw ) { $_orderby = strtolower( $orderby_raw ); $maybe_orderby_meta = false; if ( in_array( $_orderby, array( 'term_id', 'name', 'slug', 'term_group' ), true ) ) { $orderby = "t.$_orderby"; } elseif ( in_array( $_orderby, array( 'count', 'parent', 'taxonomy', 'term_taxonomy_id', 'description' ), true ) ) { $orderby = "tt.$_orderby"; } elseif ( 'term_order' === $_orderby ) { $orderby = 'tr.term_order'; } elseif ( 'include' === $_orderby && ! empty( $this->query_vars['include'] ) ) { $include = implode( ',', wp_parse_id_list( $this->query_vars['include'] ) ); $orderby = "FIELD( t.term_id, $include )"; } elseif ( 'slug__in' === $_orderby && ! empty( $this->query_vars['slug'] ) && is_array( $this->query_vars['slug'] ) ) { $slugs = implode( "', '", array_map( 'sanitize_title_for_query', $this->query_vars['slug'] ) ); $orderby = "FIELD( t.slug, '" . $slugs . "')"; } elseif ( 'none' === $_orderby ) { $orderby = ''; } elseif ( empty( $_orderby ) || 'id' === $_orderby || 'term_id' === $_orderby ) { $orderby = 't.term_id'; } else { $orderby = 't.name'; $maybe_orderby_meta = true; } $orderby = apply_filters( 'get_terms_orderby', $orderby, $this->query_vars, $this->query_vars['taxonomy'] ); if ( $maybe_orderby_meta ) { $maybe_orderby_meta = $this->parse_orderby_meta( $_orderby ); if ( $maybe_orderby_meta ) { $orderby = $maybe_orderby_meta; } } return $orderby; } protected function format_terms( $term_objects, $_fields ) { $_terms = array(); if ( 'id=>parent' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->parent; } } elseif ( 'ids' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = (int) $term->term_id; } } elseif ( 'tt_ids' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = (int) $term->term_taxonomy_id; } } elseif ( 'names' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = $term->name; } } elseif ( 'slugs' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = $term->slug; } } elseif ( 'id=>name' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->name; } } elseif ( 'id=>slug' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->slug; } } elseif ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { $_terms = $term_objects; } return $_terms; } protected function parse_orderby_meta( $orderby_raw ) { $orderby = ''; $this->meta_query->get_sql( 'term', 't', 'term_id' ); $meta_clauses = $this->meta_query->get_clauses(); if ( ! $meta_clauses || ! $orderby_raw ) { return $orderby; } $allowed_keys = array(); $primary_meta_key = null; $primary_meta_query = reset( $meta_clauses ); if ( ! empty( $primary_meta_query['key'] ) ) { $primary_meta_key = $primary_meta_query['key']; $allowed_keys[] = $primary_meta_key; } $allowed_keys[] = 'meta_value'; $allowed_keys[] = 'meta_value_num'; $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_clauses ) ); if ( ! in_array( $orderby_raw, $allowed_keys, true ) ) { return $orderby; } switch ( $orderby_raw ) { case $primary_meta_key: case 'meta_value': if ( ! empty( $primary_meta_query['type'] ) ) { $orderby = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})"; } else { $orderby = "{$primary_meta_query['alias']}.meta_value"; } break; case 'meta_value_num': $orderby = "{$primary_meta_query['alias']}.meta_value+0"; break; default: if ( array_key_exists( $orderby_raw, $meta_clauses ) ) { $meta_clause = $meta_clauses[ $orderby_raw ]; $orderby = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})"; } break; } return $orderby; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } protected function get_search_sql( $search ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; return $wpdb->prepare( '((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like ); } protected function populate_terms( $terms ) { $term_objects = array(); if ( ! is_array( $terms ) ) { return $term_objects; } foreach ( $terms as $key => $term_data ) { if ( is_object( $term_data ) && property_exists( $term_data, 'term_id' ) ) { $term = get_term( $term_data->term_id ); if ( property_exists( $term_data, 'object_id' ) ) { $term->object_id = (int) $term_data->object_id; } if ( property_exists( $term_data, 'count' ) ) { $term->count = (int) $term_data->count; } } else { $term = get_term( $term_data ); } if ( $term instanceof WP_Term ) { $term_objects[ $key ] = $term; } } return $term_objects; } } original_locale = determine_locale(); $this->available_languages = array_merge( array( 'en_US' ), get_available_languages() ); } public function init() { add_filter( 'locale', array( $this, 'filter_locale' ) ); } public function switch_to_locale( $locale ) { $current_locale = determine_locale(); if ( $current_locale === $locale ) { return false; } if ( ! in_array( $locale, $this->available_languages, true ) ) { return false; } $this->locales[] = $locale; $this->change_locale( $locale ); do_action( 'switch_locale', $locale ); return true; } public function restore_previous_locale() { $previous_locale = array_pop( $this->locales ); if ( null === $previous_locale ) { return false; } $locale = end( $this->locales ); if ( ! $locale ) { $locale = $this->original_locale; } $this->change_locale( $locale ); do_action( 'restore_previous_locale', $locale, $previous_locale ); return $locale; } public function restore_current_locale() { if ( empty( $this->locales ) ) { return false; } $this->locales = array( $this->original_locale ); return $this->restore_previous_locale(); } public function is_switched() { return ! empty( $this->locales ); } public function filter_locale( $locale ) { $switched_locale = end( $this->locales ); if ( $switched_locale ) { return $switched_locale; } return $locale; } private function load_translations( $locale ) { global $l10n; $domains = $l10n ? array_keys( $l10n ) : array(); load_default_textdomain( $locale ); foreach ( $domains as $domain ) { if ( 'default' === $domain ) { continue; } unload_textdomain( $domain ); get_translations_for_domain( $domain ); } } private function change_locale( $locale ) { _get_path_to_translation( null, true ); $this->load_translations( $locale ); $GLOBALS['wp_locale'] = new WP_Locale(); do_action( 'change_locale', $locale ); } } 'comment_parent', 'id' => 'comment_ID', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { case 'div': break; case 'ol': $output .= '
            ' . "\n"; break; case 'ul': default: $output .= '
              ' . "\n"; break; } } public function end_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { case 'div': break; case 'ol': $output .= "
          \n"; break; case 'ul': default: $output .= "\n"; break; } } public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( ! $element ) { return; } $id_field = $this->db_fields['id']; $id = $element->$id_field; parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); if ( $max_depth <= $depth + 1 && isset( $children_elements[ $id ] ) ) { foreach ( $children_elements[ $id ] as $child ) { $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); } unset( $children_elements[ $id ] ); } } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $comment = $data_object; $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; if ( ! empty( $args['callback'] ) ) { ob_start(); call_user_func( $args['callback'], $comment, $args, $depth ); $output .= ob_get_clean(); return; } if ( 'comment' === $comment->comment_type ) { add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); } if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) { ob_start(); $this->ping( $comment, $depth, $args ); $output .= ob_get_clean(); } elseif ( 'html5' === $args['format'] ) { ob_start(); $this->html5_comment( $comment, $depth, $args ); $output .= ob_get_clean(); } else { ob_start(); $this->comment( $comment, $depth, $args ); $output .= ob_get_clean(); } if ( 'comment' === $comment->comment_type ) { remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 ); } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( ! empty( $args['end-callback'] ) ) { ob_start(); call_user_func( $args['end-callback'], $data_object, $args, $depth ); $output .= ob_get_clean(); return; } if ( 'div' === $args['style'] ) { $output .= "
          \n"; } else { $output .= "\n"; } } protected function ping( $comment, $depth, $args ) { $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; ?> + < id="comment-" > +
          + ', '' ); ?> +
          + comment_approved && ! $show_pending_links ) { $comment_text = wp_kses( $comment_text, array() ); } return $comment_text; } protected function comment( $comment, $depth, $args ) { if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } $commenter = wp_get_current_commenter(); $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; if ( $commenter['comment_author_email'] ) { $moderation_note = __( 'Your comment is awaiting moderation.' ); } else { $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' ); } ?> + < has_children ? 'parent' : '', $comment ); ?> id="comment-"> + +
          + +
          + + comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } printf( __( '%s says:' ), sprintf( '%s', $comment_author ) ); ?> +
          + comment_approved ) : ?> + +
          + -.create-application-password p.submit { - margin-bottom: 0; - padding-bottom: 0; - display: block; -} + -#application-passwords-section .notice { - margin-top: 20px; - margin-bottom: 0; -} + $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'], ) ) ); ?> -.application-password-display input.code { - width: 19em; -} + $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
          ', 'after' => '
          ', ) ) ); ?> -.auth-app-card.card { - max-width: 768px; -} + +
          + + + < id="comment-" has_children ? 'parent' : '', $comment ); ?>> +
          +
          +
          + + comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } printf( __( '%s says:' ), sprintf( '%s', $comment_author ) ); ?> +
          -.authorize-application-php .form-wrap p { - display: block; -} + -/*------------------------------------------------------------------------------ - 19.0 - Tools -------------------------------------------------------------------------------*/ + comment_approved ) : ?> + + +
          -.tool-box .title { - margin: 8px 0; - font-size: 18px; - font-weight: 400; - line-height: 24px; -} +
          + +
          -.label-responsive { - vertical-align: middle; -} + comment_approved || $show_pending_links ) { comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
          ', 'after' => '
          ', ) ) ); } ?> +
          + rest_api_init' ), '5.1.0' ); } if ( isset( $args['args'] ) ) { $common_args = $args['args']; unset( $args['args'] ); } else { $common_args = array(); } if ( isset( $args['callback'] ) ) { $args = array( $args ); } $defaults = array( 'methods' => 'GET', 'callback' => null, 'args' => array(), ); foreach ( $args as $key => &$arg_group ) { if ( ! is_numeric( $key ) ) { continue; } $arg_group = array_merge( $defaults, $arg_group ); $arg_group['args'] = array_merge( $common_args, $arg_group['args'] ); if ( ! isset( $arg_group['permission_callback'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The REST API route definition for %1$s is missing the required %2$s argument. For REST API routes that are intended to be public, use %3$s as the permission callback.' ), '' . $clean_namespace . '/' . trim( $route, '/' ) . '', 'permission_callback', '__return_true' ), '5.5.0' ); } } $full_route = '/' . $clean_namespace . '/' . trim( $route, '/' ); rest_get_server()->register_route( $clean_namespace, $full_route, $args, $override ); return true; } function register_rest_field( $object_type, $attribute, $args = array() ) { global $wp_rest_additional_fields; $defaults = array( 'get_callback' => null, 'update_callback' => null, 'schema' => null, ); $args = wp_parse_args( $args, $defaults ); $object_types = (array) $object_type; foreach ( $object_types as $object_type ) { $wp_rest_additional_fields[ $object_type ][ $attribute ] = $args; } } function rest_api_init() { rest_api_register_rewrites(); global $wp; $wp->add_query_var( 'rest_route' ); } function rest_api_register_rewrites() { global $wp_rewrite; add_rewrite_rule( '^' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); } function rest_api_default_filters() { if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 ); add_filter( 'deprecated_function_trigger_error', '__return_false' ); add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 ); add_filter( 'deprecated_argument_trigger_error', '__return_false' ); add_action( 'doing_it_wrong_run', 'rest_handle_doing_it_wrong', 10, 3 ); add_filter( 'doing_it_wrong_trigger_error', '__return_false' ); } add_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 ); add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 ); add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3 ); add_filter( 'rest_index', 'rest_add_application_passwords_to_index' ); } function create_initial_rest_routes() { foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) { $controller = $post_type->get_rest_controller(); if ( ! $controller ) { continue; } $controller->register_routes(); if ( post_type_supports( $post_type->name, 'revisions' ) ) { $revisions_controller = new WP_REST_Revisions_Controller( $post_type->name ); $revisions_controller->register_routes(); } if ( 'attachment' !== $post_type->name ) { $autosaves_controller = new WP_REST_Autosaves_Controller( $post_type->name ); $autosaves_controller->register_routes(); } } $controller = new WP_REST_Post_Types_Controller; $controller->register_routes(); $controller = new WP_REST_Post_Statuses_Controller; $controller->register_routes(); $controller = new WP_REST_Taxonomies_Controller; $controller->register_routes(); foreach ( get_taxonomies( array( 'show_in_rest' => true ), 'object' ) as $taxonomy ) { $controller = $taxonomy->get_rest_controller(); if ( ! $controller ) { continue; } $controller->register_routes(); } $controller = new WP_REST_Users_Controller; $controller->register_routes(); $controller = new WP_REST_Application_Passwords_Controller(); $controller->register_routes(); $controller = new WP_REST_Comments_Controller; $controller->register_routes(); $search_handlers = array( new WP_REST_Post_Search_Handler(), new WP_REST_Term_Search_Handler(), new WP_REST_Post_Format_Search_Handler(), ); $search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers ); $controller = new WP_REST_Search_Controller( $search_handlers ); $controller->register_routes(); $controller = new WP_REST_Block_Renderer_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Types_Controller(); $controller->register_routes(); $controller = new WP_REST_Global_Styles_Controller; $controller->register_routes(); $controller = new WP_REST_Settings_Controller; $controller->register_routes(); $controller = new WP_REST_Themes_Controller; $controller->register_routes(); $controller = new WP_REST_Plugins_Controller(); $controller->register_routes(); $controller = new WP_REST_Sidebars_Controller(); $controller->register_routes(); $controller = new WP_REST_Widget_Types_Controller(); $controller->register_routes(); $controller = new WP_REST_Widgets_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Directory_Controller(); $controller->register_routes(); $controller = new WP_REST_Pattern_Directory_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Patterns_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Pattern_Categories_Controller(); $controller->register_routes(); $site_health = WP_Site_Health::get_instance(); $controller = new WP_REST_Site_Health_Controller( $site_health ); $controller->register_routes(); $controller = new WP_REST_URL_Details_Controller(); $controller->register_routes(); $controller = new WP_REST_Menu_Locations_Controller(); $controller->register_routes(); $controller = new WP_REST_Edit_Site_Export_Controller(); $controller->register_routes(); } function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { return; } define( 'REST_REQUEST', true ); $server = rest_get_server(); $route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ); if ( empty( $route ) ) { $route = '/'; } $server->serve_request( $route ); die(); } function rest_get_url_prefix() { return apply_filters( 'rest_url_prefix', 'wp-json' ); } function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { if ( empty( $path ) ) { $path = '/'; } $path = '/' . ltrim( $path, '/' ); if ( is_multisite() && get_blog_option( $blog_id, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) { global $wp_rewrite; if ( $wp_rewrite->using_index_permalinks() ) { $url = get_home_url( $blog_id, $wp_rewrite->index . '/' . rest_get_url_prefix(), $scheme ); } else { $url = get_home_url( $blog_id, rest_get_url_prefix(), $scheme ); } $url .= $path; } else { $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) ); if ( 'index.php' !== substr( $url, 9 ) ) { $url .= 'index.php'; } $url = add_query_arg( 'rest_route', $path, $url ); } if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) { if ( parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) === $_SERVER['SERVER_NAME'] ) { $url = set_url_scheme( $url, 'https' ); } } if ( is_admin() && force_ssl_admin() ) { $url = set_url_scheme( $url, 'https' ); } return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme ); } function rest_url( $path = '', $scheme = 'rest' ) { return get_rest_url( null, $path, $scheme ); } function rest_do_request( $request ) { $request = rest_ensure_request( $request ); return rest_get_server()->dispatch( $request ); } function rest_get_server() { global $wp_rest_server; if ( empty( $wp_rest_server ) ) { $wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' ); $wp_rest_server = new $wp_rest_server_class; do_action( 'rest_api_init', $wp_rest_server ); } return $wp_rest_server; } function rest_ensure_request( $request ) { if ( $request instanceof WP_REST_Request ) { return $request; } if ( is_string( $request ) ) { return new WP_REST_Request( 'GET', $request ); } return new WP_REST_Request( 'GET', '', $request ); } function rest_ensure_response( $response ) { if ( is_wp_error( $response ) ) { return $response; } if ( $response instanceof WP_REST_Response ) { return $response; } if ( $response instanceof WP_HTTP_Response ) { return new WP_REST_Response( $response->get_data(), $response->get_status(), $response->get_headers() ); } return new WP_REST_Response( $response ); } function rest_handle_deprecated_function( $function, $replacement, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( ! empty( $replacement ) ) { $string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement ); } else { $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version ); } header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) ); } function rest_handle_deprecated_argument( $function, $message, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( $message ) { $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message ); } else { $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version ); } header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) ); } function rest_handle_doing_it_wrong( $function, $message, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( $version ) { $string = __( '%1$s (since %2$s; %3$s)' ); $string = sprintf( $string, $function, $version, $message ); } else { $string = __( '%1$s (%2$s)' ); $string = sprintf( $string, $function, $message ); } header( sprintf( 'X-WP-DoingItWrong: %s', $string ) ); } function rest_send_cors_headers( $value ) { $origin = get_http_origin(); if ( $origin ) { if ( 'null' !== $origin ) { $origin = esc_url_raw( $origin ); } header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin', false ); } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { header( 'Vary: Origin', false ); } return $value; } function rest_handle_options_request( $response, $handler, $request ) { if ( ! empty( $response ) || $request->get_method() !== 'OPTIONS' ) { return $response; } $response = new WP_REST_Response(); $data = array(); foreach ( $handler->get_routes() as $route => $endpoints ) { $match = preg_match( '@^' . $route . '$@i', $request->get_route(), $matches ); if ( ! $match ) { continue; } $args = array(); foreach ( $matches as $param => $value ) { if ( ! is_int( $param ) ) { $args[ $param ] = $value; } } foreach ( $endpoints as $endpoint ) { unset( $args[0] ); $request->set_url_params( $args ); $request->set_attributes( $endpoint ); } $data = $handler->get_data_for_route( $route, $endpoints, 'help' ); $response->set_matched_route( $route ); break; } $response->set_data( $data ); return $response; } function rest_send_allow_header( $response, $server, $request ) { $matched_route = $response->get_matched_route(); if ( ! $matched_route ) { return $response; } $routes = $server->get_routes(); $allowed_methods = array(); foreach ( $routes[ $matched_route ] as $_handler ) { foreach ( $_handler['methods'] as $handler_method => $value ) { if ( ! empty( $_handler['permission_callback'] ) ) { $permission = call_user_func( $_handler['permission_callback'], $request ); $allowed_methods[ $handler_method ] = true === $permission; } else { $allowed_methods[ $handler_method ] = true; } } } $allowed_methods = array_filter( $allowed_methods ); if ( $allowed_methods ) { $response->header( 'Allow', implode( ', ', array_map( 'strtoupper', array_keys( $allowed_methods ) ) ) ); } return $response; } function _rest_array_intersect_key_recursive( $array1, $array2 ) { $array1 = array_intersect_key( $array1, $array2 ); foreach ( $array1 as $key => $value ) { if ( is_array( $value ) && is_array( $array2[ $key ] ) ) { $array1[ $key ] = _rest_array_intersect_key_recursive( $value, $array2[ $key ] ); } } return $array1; } function rest_filter_response_fields( $response, $server, $request ) { if ( ! isset( $request['_fields'] ) || $response->is_error() ) { return $response; } $data = $response->get_data(); $fields = wp_parse_list( $request['_fields'] ); if ( 0 === count( $fields ) ) { return $response; } $fields = array_map( 'trim', $fields ); $fields_as_keyed = array(); foreach ( $fields as $field ) { $parts = explode( '.', $field ); $ref = &$fields_as_keyed; while ( count( $parts ) > 1 ) { $next = array_shift( $parts ); if ( isset( $ref[ $next ] ) && true === $ref[ $next ] ) { break 2; } $ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] : array(); $ref = &$ref[ $next ]; } $last = array_shift( $parts ); $ref[ $last ] = true; } if ( wp_is_numeric_array( $data ) ) { $new_data = array(); foreach ( $data as $item ) { $new_data[] = _rest_array_intersect_key_recursive( $item, $fields_as_keyed ); } } else { $new_data = _rest_array_intersect_key_recursive( $data, $fields_as_keyed ); } $response->set_data( $new_data ); return $response; } function rest_is_field_included( $field, $fields ) { if ( in_array( $field, $fields, true ) ) { return true; } foreach ( $fields as $accepted_field ) { if ( strpos( $accepted_field, "$field." ) === 0 ) { return true; } if ( strpos( $field, "$accepted_field." ) === 0 ) { return true; } } return false; } function rest_output_rsd() { $api_root = get_rest_url(); if ( empty( $api_root ) ) { return; } ?> + + ', esc_url( $api_root ) ); $resource = rest_get_queried_resource_route(); if ( $resource ) { printf( '', esc_url( rest_url( $resource ) ) ); } } function rest_output_link_header() { if ( headers_sent() ) { return; } $api_root = get_rest_url(); if ( empty( $api_root ) ) { return; } header( sprintf( 'Link: <%s>; rel="https://api.w.org/"', esc_url_raw( $api_root ) ), false ); $resource = rest_get_queried_resource_route(); if ( $resource ) { header( sprintf( 'Link: <%s>; rel="alternate"; type="application/json"', esc_url_raw( rest_url( $resource ) ) ), false ); } } function rest_cookie_check_errors( $result ) { if ( ! empty( $result ) ) { return $result; } global $wp_rest_auth_cookie; if ( true !== $wp_rest_auth_cookie && is_user_logged_in() ) { return $result; } $nonce = null; if ( isset( $_REQUEST['_wpnonce'] ) ) { $nonce = $_REQUEST['_wpnonce']; } elseif ( isset( $_SERVER['HTTP_X_WP_NONCE'] ) ) { $nonce = $_SERVER['HTTP_X_WP_NONCE']; } if ( null === $nonce ) { wp_set_current_user( 0 ); return true; } $result = wp_verify_nonce( $nonce, 'wp_rest' ); if ( ! $result ) { return new WP_Error( 'rest_cookie_invalid_nonce', __( 'Cookie check failed' ), array( 'status' => 403 ) ); } rest_get_server()->send_header( 'X-WP-Nonce', wp_create_nonce( 'wp_rest' ) ); return true; } function rest_cookie_collect_status() { global $wp_rest_auth_cookie; $status_type = current_action(); if ( 'auth_cookie_valid' !== $status_type ) { $wp_rest_auth_cookie = substr( $status_type, 12 ); return; } $wp_rest_auth_cookie = true; } function rest_application_password_collect_status( $user_or_error, $app_password = array() ) { global $wp_rest_application_password_status, $wp_rest_application_password_uuid; $wp_rest_application_password_status = $user_or_error; if ( empty( $app_password['uuid'] ) ) { $wp_rest_application_password_uuid = null; } else { $wp_rest_application_password_uuid = $app_password['uuid']; } } function rest_get_authenticated_app_password() { global $wp_rest_application_password_uuid; return $wp_rest_application_password_uuid; } function rest_application_password_check_errors( $result ) { global $wp_rest_application_password_status; if ( ! empty( $result ) ) { return $result; } if ( is_wp_error( $wp_rest_application_password_status ) ) { $data = $wp_rest_application_password_status->get_error_data(); if ( ! isset( $data['status'] ) ) { $data['status'] = 401; } $wp_rest_application_password_status->add_data( $data ); return $wp_rest_application_password_status; } if ( $wp_rest_application_password_status instanceof WP_User ) { return true; } return $result; } function rest_add_application_passwords_to_index( $response ) { if ( ! wp_is_application_passwords_available() ) { return $response; } $response->data['authentication']['application-passwords'] = array( 'endpoints' => array( 'authorization' => admin_url( 'authorize-application.php' ), ), ); return $response; } function rest_get_avatar_urls( $id_or_email ) { $avatar_sizes = rest_get_avatar_sizes(); $urls = array(); foreach ( $avatar_sizes as $size ) { $urls[ $size ] = get_avatar_url( $id_or_email, array( 'size' => $size ) ); } return $urls; } function rest_get_avatar_sizes() { return apply_filters( 'rest_avatar_sizes', array( 24, 48, 96 ) ); } function rest_parse_date( $date, $force_utc = false ) { if ( $force_utc ) { $date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date ); } $regex = '#^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}(?::\d{2})?)?$#'; if ( ! preg_match( $regex, $date, $matches ) ) { return false; } return strtotime( $date ); } function rest_parse_hex_color( $color ) { $regex = '|^#([A-Fa-f0-9]{3}){1,2}$|'; if ( ! preg_match( $regex, $color, $matches ) ) { return false; } return $color; } function rest_get_date_with_gmt( $date, $is_utc = false ) { $has_timezone = preg_match( '#(Z|[+-]\d{2}(:\d{2})?)$#', $date ); $date = rest_parse_date( $date ); if ( empty( $date ) ) { return null; } if ( ! $is_utc && ! $has_timezone ) { $local = gmdate( 'Y-m-d H:i:s', $date ); $utc = get_gmt_from_date( $local ); } else { $utc = gmdate( 'Y-m-d H:i:s', $date ); $local = get_date_from_gmt( $utc ); } return array( $local, $utc ); } function rest_authorization_required_code() { return is_user_logged_in() ? 403 : 401; } function rest_validate_request_arg( $value, $request, $param ) { $attributes = $request->get_attributes(); if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) { return true; } $args = $attributes['args'][ $param ]; return rest_validate_value_from_schema( $value, $args, $param ); } function rest_sanitize_request_arg( $value, $request, $param ) { $attributes = $request->get_attributes(); if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) { return $value; } $args = $attributes['args'][ $param ]; return rest_sanitize_value_from_schema( $value, $args, $param ); } function rest_parse_request_arg( $value, $request, $param ) { $is_valid = rest_validate_request_arg( $value, $request, $param ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } $value = rest_sanitize_request_arg( $value, $request, $param ); return $value; } function rest_is_ip_address( $ip ) { $ipv4_pattern = '/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/'; if ( ! preg_match( $ipv4_pattern, $ip ) && ! Requests_IPv6::check_ipv6( $ip ) ) { return false; } return $ip; } function rest_sanitize_boolean( $value ) { if ( is_string( $value ) ) { $value = strtolower( $value ); if ( in_array( $value, array( 'false', '0' ), true ) ) { $value = false; } } return (bool) $value; } function rest_is_boolean( $maybe_bool ) { if ( is_bool( $maybe_bool ) ) { return true; } if ( is_string( $maybe_bool ) ) { $maybe_bool = strtolower( $maybe_bool ); $valid_boolean_values = array( 'false', 'true', '0', '1', ); return in_array( $maybe_bool, $valid_boolean_values, true ); } if ( is_int( $maybe_bool ) ) { return in_array( $maybe_bool, array( 0, 1 ), true ); } return false; } function rest_is_integer( $maybe_integer ) { return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer; } function rest_is_array( $maybe_array ) { if ( is_scalar( $maybe_array ) ) { $maybe_array = wp_parse_list( $maybe_array ); } return wp_is_numeric_array( $maybe_array ); } function rest_sanitize_array( $maybe_array ) { if ( is_scalar( $maybe_array ) ) { return wp_parse_list( $maybe_array ); } if ( ! is_array( $maybe_array ) ) { return array(); } return array_values( $maybe_array ); } function rest_is_object( $maybe_object ) { if ( '' === $maybe_object ) { return true; } if ( $maybe_object instanceof stdClass ) { return true; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } return is_array( $maybe_object ); } function rest_sanitize_object( $maybe_object ) { if ( '' === $maybe_object ) { return array(); } if ( $maybe_object instanceof stdClass ) { return (array) $maybe_object; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } if ( ! is_array( $maybe_object ) ) { return array(); } return $maybe_object; } function rest_get_best_type_for_value( $value, $types ) { static $checks = array( 'array' => 'rest_is_array', 'object' => 'rest_is_object', 'integer' => 'rest_is_integer', 'number' => 'is_numeric', 'boolean' => 'rest_is_boolean', 'string' => 'is_string', 'null' => 'is_null', ); if ( '' === $value && in_array( 'string', $types, true ) ) { return 'string'; } foreach ( $types as $type ) { if ( isset( $checks[ $type ] ) && $checks[ $type ]( $value ) ) { return $type; } } return ''; } function rest_handle_multi_type_schema( $value, $args, $param = '' ) { $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); $invalid_types = array_diff( $args['type'], $allowed_types ); if ( $invalid_types ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only contain the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } $best_type = rest_get_best_type_for_value( $value, $args['type'] ); if ( ! $best_type ) { if ( ! $invalid_types ) { return ''; } $best_type = reset( $invalid_types ); } return $best_type; } function rest_validate_array_contains_unique_items( $array ) { $seen = array(); foreach ( $array as $item ) { $stabilized = rest_stabilize_value( $item ); $key = serialize( $stabilized ); if ( ! isset( $seen[ $key ] ) ) { $seen[ $key ] = true; continue; } return false; } return true; } function rest_stabilize_value( $value ) { if ( is_scalar( $value ) || is_null( $value ) ) { return $value; } if ( is_object( $value ) ) { _doing_it_wrong( __FUNCTION__, __( 'Cannot stabilize objects. Convert the object to an array first.' ), '5.5.0' ); return $value; } ksort( $value ); foreach ( $value as $k => $v ) { $value[ $k ] = rest_stabilize_value( $v ); } return $value; } function rest_validate_json_schema_pattern( $pattern, $value ) { $escaped_pattern = str_replace( '#', '\\#', $pattern ); return 1 === preg_match( '#' . $escaped_pattern . '#u', $value ); } function rest_find_matching_pattern_property_schema( $property, $args ) { if ( isset( $args['patternProperties'] ) ) { foreach ( $args['patternProperties'] as $pattern => $child_schema ) { if ( rest_validate_json_schema_pattern( $pattern, $property ) ) { return $child_schema; } } } return null; } function rest_format_combining_operation_error( $param, $error ) { $position = $error['index']; $reason = $error['error_object']->get_error_message(); if ( isset( $error['schema']['title'] ) ) { $title = $error['schema']['title']; return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%1$s is not a valid %2$s. Reason: %3$s' ), $param, $title, $reason ), array( 'position' => $position ) ); } return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%1$s does not match the expected format. Reason: %2$s' ), $param, $reason ), array( 'position' => $position ) ); } function rest_get_combining_operation_error( $value, $param, $errors ) { if ( 1 === count( $errors ) ) { return rest_format_combining_operation_error( $param, $errors[0] ); } $filtered_errors = array(); foreach ( $errors as $error ) { $error_code = $error['error_object']->get_error_code(); $error_data = $error['error_object']->get_error_data(); if ( 'rest_invalid_type' !== $error_code || ( isset( $error_data['param'] ) && $param !== $error_data['param'] ) ) { $filtered_errors[] = $error; } } if ( 1 === count( $filtered_errors ) ) { return rest_format_combining_operation_error( $param, $filtered_errors[0] ); } if ( count( $filtered_errors ) > 1 && 'object' === $filtered_errors[0]['schema']['type'] ) { $result = null; $number = 0; foreach ( $filtered_errors as $error ) { if ( isset( $error['schema']['properties'] ) ) { $n = count( array_intersect_key( $error['schema']['properties'], $value ) ); if ( $n > $number ) { $result = $error; $number = $n; } } } if ( null !== $result ) { return rest_format_combining_operation_error( $param, $result ); } } $schema_titles = array(); foreach ( $errors as $error ) { if ( isset( $error['schema']['title'] ) ) { $schema_titles[] = $error['schema']['title']; } } if ( count( $schema_titles ) === count( $errors ) ) { return new WP_Error( 'rest_no_matching_schema', wp_sprintf( __( '%1$s is not a valid %2$l.' ), $param, $schema_titles ) ); } return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%s does not match any of the expected formats.' ), $param ) ); } function rest_find_any_matching_schema( $value, $args, $param ) { $errors = array(); foreach ( $args['anyOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { return $schema; } $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } return rest_get_combining_operation_error( $value, $param, $errors ); } function rest_find_one_matching_schema( $value, $args, $param, $stop_after_first_match = false ) { $matching_schemas = array(); $errors = array(); foreach ( $args['oneOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { if ( $stop_after_first_match ) { return $schema; } $matching_schemas[] = array( 'schema_object' => $schema, 'index' => $index, ); } else { $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } } if ( ! $matching_schemas ) { return rest_get_combining_operation_error( $value, $param, $errors ); } if ( count( $matching_schemas ) > 1 ) { $schema_positions = array(); $schema_titles = array(); foreach ( $matching_schemas as $schema ) { $schema_positions[] = $schema['index']; if ( isset( $schema['schema_object']['title'] ) ) { $schema_titles[] = $schema['schema_object']['title']; } } if ( count( $schema_titles ) === count( $matching_schemas ) ) { return new WP_Error( 'rest_one_of_multiple_matches', wp_sprintf( __( '%1$s matches %2$l, but should match only one.' ), $param, $schema_titles ), array( 'positions' => $schema_positions ) ); } return new WP_Error( 'rest_one_of_multiple_matches', sprintf( __( '%s matches more than one of the expected formats.' ), $param ), array( 'positions' => $schema_positions ) ); } return $matching_schemas[0]['schema_object']; } function rest_are_values_equal( $value1, $value2 ) { if ( is_array( $value1 ) && is_array( $value2 ) ) { if ( count( $value1 ) !== count( $value2 ) ) { return false; } foreach ( $value1 as $index => $value ) { if ( ! array_key_exists( $index, $value2 ) || ! rest_are_values_equal( $value, $value2[ $index ] ) ) { return false; } } return true; } if ( is_int( $value1 ) && is_float( $value2 ) || is_float( $value1 ) && is_int( $value2 ) ) { return (float) $value1 === (float) $value2; } return $value1 === $value2; } function rest_validate_enum( $value, $args, $param ) { $sanitized_value = rest_sanitize_value_from_schema( $value, $args, $param ); if ( is_wp_error( $sanitized_value ) ) { return $sanitized_value; } foreach ( $args['enum'] as $enum_value ) { if ( rest_are_values_equal( $sanitized_value, $enum_value ) ) { return true; } } $encoded_enum_values = array(); foreach ( $args['enum'] as $enum_value ) { $encoded_enum_values[] = is_scalar( $enum_value ) ? $enum_value : wp_json_encode( $enum_value ); } if ( count( $encoded_enum_values ) === 1 ) { return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not %2$s.' ), $param, $encoded_enum_values[0] ) ); } return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not one of %2$l.' ), $param, $encoded_enum_values ) ); } function rest_get_allowed_schema_keywords() { return array( 'title', 'description', 'default', 'type', 'format', 'enum', 'items', 'properties', 'additionalProperties', 'patternProperties', 'minProperties', 'maxProperties', 'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf', 'minLength', 'maxLength', 'pattern', 'minItems', 'maxItems', 'uniqueItems', 'anyOf', 'oneOf', ); } function rest_validate_value_from_schema( $value, $args, $param = '' ) { if ( isset( $args['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) { $args['type'] = $matching_schema['type']; } } if ( isset( $args['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) { $args['type'] = $matching_schema['type']; } } $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); if ( ! isset( $args['type'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type" schema keyword for %s is required.' ), $param ), '5.5.0' ); } if ( is_array( $args['type'] ) ) { $best_type = rest_handle_multi_type_schema( $value, $args, $param ); if ( ! $best_type ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, implode( ',', $args['type'] ) ), array( 'param' => $param ) ); } $args['type'] = $best_type; } if ( ! in_array( $args['type'], $allowed_types, true ) ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } switch ( $args['type'] ) { case 'null': $is_valid = rest_validate_null_value_from_schema( $value, $param ); break; case 'boolean': $is_valid = rest_validate_boolean_value_from_schema( $value, $param ); break; case 'object': $is_valid = rest_validate_object_value_from_schema( $value, $args, $param ); break; case 'array': $is_valid = rest_validate_array_value_from_schema( $value, $args, $param ); break; case 'number': $is_valid = rest_validate_number_value_from_schema( $value, $args, $param ); break; case 'string': $is_valid = rest_validate_string_value_from_schema( $value, $args, $param ); break; case 'integer': $is_valid = rest_validate_integer_value_from_schema( $value, $args, $param ); break; default: $is_valid = true; break; } if ( is_wp_error( $is_valid ) ) { return $is_valid; } if ( ! empty( $args['enum'] ) ) { $enum_contains_value = rest_validate_enum( $value, $args, $param ); if ( is_wp_error( $enum_contains_value ) ) { return $enum_contains_value; } } if ( isset( $args['format'] ) && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) ) ) { switch ( $args['format'] ) { case 'hex-color': if ( ! rest_parse_hex_color( $value ) ) { return new WP_Error( 'rest_invalid_hex_color', __( 'Invalid hex color.' ) ); } break; case 'date-time': if ( ! rest_parse_date( $value ) ) { return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) ); } break; case 'email': if ( ! is_email( $value ) ) { return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) ); } break; case 'ip': if ( ! rest_is_ip_address( $value ) ) { return new WP_Error( 'rest_invalid_ip', sprintf( __( '%s is not a valid IP address.' ), $param ) ); } break; case 'uuid': if ( ! wp_is_uuid( $value ) ) { return new WP_Error( 'rest_invalid_uuid', sprintf( __( '%s is not a valid UUID.' ), $param ) ); } break; } } return true; } function rest_validate_null_value_from_schema( $value, $param ) { if ( null !== $value ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'null' ), array( 'param' => $param ) ); } return true; } function rest_validate_boolean_value_from_schema( $value, $param ) { if ( ! rest_is_boolean( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'boolean' ), array( 'param' => $param ) ); } return true; } function rest_validate_object_value_from_schema( $value, $args, $param ) { if ( ! rest_is_object( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'object' ), array( 'param' => $param ) ); } $value = rest_sanitize_object( $value ); if ( isset( $args['required'] ) && is_array( $args['required'] ) ) { foreach ( $args['required'] as $name ) { if ( ! array_key_exists( $name, $value ) ) { return new WP_Error( 'rest_property_required', sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param ) ); } } } elseif ( isset( $args['properties'] ) ) { foreach ( $args['properties'] as $name => $property ) { if ( isset( $property['required'] ) && true === $property['required'] && ! array_key_exists( $name, $value ) ) { return new WP_Error( 'rest_property_required', sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param ) ); } } } foreach ( $value as $property => $v ) { if ( isset( $args['properties'][ $property ] ) ) { $is_valid = rest_validate_value_from_schema( $v, $args['properties'][ $property ], $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } continue; } $pattern_property_schema = rest_find_matching_pattern_property_schema( $property, $args ); if ( null !== $pattern_property_schema ) { $is_valid = rest_validate_value_from_schema( $v, $pattern_property_schema, $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } continue; } if ( isset( $args['additionalProperties'] ) ) { if ( false === $args['additionalProperties'] ) { return new WP_Error( 'rest_additional_properties_forbidden', sprintf( __( '%1$s is not a valid property of Object.' ), $property ) ); } if ( is_array( $args['additionalProperties'] ) ) { $is_valid = rest_validate_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } } } } if ( isset( $args['minProperties'] ) && count( $value ) < $args['minProperties'] ) { return new WP_Error( 'rest_too_few_properties', sprintf( _n( '%1$s must contain at least %2$s property.', '%1$s must contain at least %2$s properties.', $args['minProperties'] ), $param, number_format_i18n( $args['minProperties'] ) ) ); } if ( isset( $args['maxProperties'] ) && count( $value ) > $args['maxProperties'] ) { return new WP_Error( 'rest_too_many_properties', sprintf( _n( '%1$s must contain at most %2$s property.', '%1$s must contain at most %2$s properties.', $args['maxProperties'] ), $param, number_format_i18n( $args['maxProperties'] ) ) ); } return true; } function rest_validate_array_value_from_schema( $value, $args, $param ) { if ( ! rest_is_array( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'array' ), array( 'param' => $param ) ); } $value = rest_sanitize_array( $value ); if ( isset( $args['items'] ) ) { foreach ( $value as $index => $v ) { $is_valid = rest_validate_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } } } if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) { return new WP_Error( 'rest_too_few_items', sprintf( _n( '%1$s must contain at least %2$s item.', '%1$s must contain at least %2$s items.', $args['minItems'] ), $param, number_format_i18n( $args['minItems'] ) ) ); } if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) { return new WP_Error( 'rest_too_many_items', sprintf( _n( '%1$s must contain at most %2$s item.', '%1$s must contain at most %2$s items.', $args['maxItems'] ), $param, number_format_i18n( $args['maxItems'] ) ) ); } if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) { return new WP_Error( 'rest_duplicate_items', sprintf( __( '%s has duplicate items.' ), $param ) ); } return true; } function rest_validate_number_value_from_schema( $value, $args, $param ) { if ( ! is_numeric( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ), array( 'param' => $param ) ); } if ( isset( $args['multipleOf'] ) && fmod( $value, $args['multipleOf'] ) !== 0.0 ) { return new WP_Error( 'rest_invalid_multiple', sprintf( __( '%1$s must be a multiple of %2$s.' ), $param, $args['multipleOf'] ) ); } if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) { if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) ); } if ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) ); } } if ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) { if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) ); } if ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) ); } } if ( isset( $args['minimum'], $args['maximum'] ) ) { if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) { if ( $value >= $args['maximum'] || $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( ! empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) { if ( $value > $args['maximum'] || $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( ! empty( $args['exclusiveMaximum'] ) && empty( $args['exclusiveMinimum'] ) ) { if ( $value >= $args['maximum'] || $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) { if ( $value > $args['maximum'] || $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } } return true; } function rest_validate_string_value_from_schema( $value, $args, $param ) { if ( ! is_string( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ), array( 'param' => $param ) ); } if ( isset( $args['minLength'] ) && mb_strlen( $value ) < $args['minLength'] ) { return new WP_Error( 'rest_too_short', sprintf( _n( '%1$s must be at least %2$s character long.', '%1$s must be at least %2$s characters long.', $args['minLength'] ), $param, number_format_i18n( $args['minLength'] ) ) ); } if ( isset( $args['maxLength'] ) && mb_strlen( $value ) > $args['maxLength'] ) { return new WP_Error( 'rest_too_long', sprintf( _n( '%1$s must be at most %2$s character long.', '%1$s must be at most %2$s characters long.', $args['maxLength'] ), $param, number_format_i18n( $args['maxLength'] ) ) ); } if ( isset( $args['pattern'] ) && ! rest_validate_json_schema_pattern( $args['pattern'], $value ) ) { return new WP_Error( 'rest_invalid_pattern', sprintf( __( '%1$s does not match pattern %2$s.' ), $param, $args['pattern'] ) ); } return true; } function rest_validate_integer_value_from_schema( $value, $args, $param ) { $is_valid_number = rest_validate_number_value_from_schema( $value, $args, $param ); if ( is_wp_error( $is_valid_number ) ) { return $is_valid_number; } if ( ! rest_is_integer( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ), array( 'param' => $param ) ); } return true; } function rest_sanitize_value_from_schema( $value, $args, $param = '' ) { if ( isset( $args['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) ) { $args['type'] = $matching_schema['type']; } $value = rest_sanitize_value_from_schema( $value, $matching_schema, $param ); } if ( isset( $args['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) ) { $args['type'] = $matching_schema['type']; } $value = rest_sanitize_value_from_schema( $value, $matching_schema, $param ); } $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); if ( ! isset( $args['type'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type" schema keyword for %s is required.' ), $param ), '5.5.0' ); } if ( is_array( $args['type'] ) ) { $best_type = rest_handle_multi_type_schema( $value, $args, $param ); if ( ! $best_type ) { return null; } $args['type'] = $best_type; } if ( ! in_array( $args['type'], $allowed_types, true ) ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } if ( 'array' === $args['type'] ) { $value = rest_sanitize_array( $value ); if ( ! empty( $args['items'] ) ) { foreach ( $value as $index => $v ) { $value[ $index ] = rest_sanitize_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' ); } } if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) { return new WP_Error( 'rest_duplicate_items', sprintf( __( '%s has duplicate items.' ), $param ) ); } return $value; } if ( 'object' === $args['type'] ) { $value = rest_sanitize_object( $value ); foreach ( $value as $property => $v ) { if ( isset( $args['properties'][ $property ] ) ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['properties'][ $property ], $param . '[' . $property . ']' ); continue; } $pattern_property_schema = rest_find_matching_pattern_property_schema( $property, $args ); if ( null !== $pattern_property_schema ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $pattern_property_schema, $param . '[' . $property . ']' ); continue; } if ( isset( $args['additionalProperties'] ) ) { if ( false === $args['additionalProperties'] ) { unset( $value[ $property ] ); } elseif ( is_array( $args['additionalProperties'] ) ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' ); } } } return $value; } if ( 'null' === $args['type'] ) { return null; } if ( 'integer' === $args['type'] ) { return (int) $value; } if ( 'number' === $args['type'] ) { return (float) $value; } if ( 'boolean' === $args['type'] ) { return rest_sanitize_boolean( $value ); } if ( isset( $args['format'] ) && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) ) ) { switch ( $args['format'] ) { case 'hex-color': return (string) sanitize_hex_color( $value ); case 'date-time': return sanitize_text_field( $value ); case 'email': return sanitize_text_field( $value ); case 'uri': return esc_url_raw( $value ); case 'ip': return sanitize_text_field( $value ); case 'uuid': return sanitize_text_field( $value ); case 'text-field': return sanitize_text_field( $value ); case 'textarea-field': return sanitize_textarea_field( $value ); } } if ( 'string' === $args['type'] ) { return (string) $value; } return $value; } function rest_preload_api_request( $memo, $path ) { if ( ! is_array( $memo ) ) { $memo = array(); } if ( empty( $path ) ) { return $memo; } $method = 'GET'; if ( is_array( $path ) && 2 === count( $path ) ) { $method = end( $path ); $path = reset( $path ); if ( ! in_array( $method, array( 'GET', 'OPTIONS' ), true ) ) { $method = 'GET'; } } $path = untrailingslashit( $path ); if ( empty( $path ) ) { $path = '/'; } $path_parts = parse_url( $path ); if ( false === $path_parts ) { return $memo; } $request = new WP_REST_Request( $method, $path_parts['path'] ); if ( ! empty( $path_parts['query'] ) ) { parse_str( $path_parts['query'], $query_params ); $request->set_query_params( $query_params ); } $response = rest_do_request( $request ); if ( 200 === $response->status ) { $server = rest_get_server(); $response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request ); $embed = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false; $data = (array) $server->response_to_data( $response, $embed ); if ( 'OPTIONS' === $method ) { $memo[ $method ][ $path ] = array( 'body' => $data, 'headers' => $response->headers, ); } else { $memo[ $path ] = array( 'body' => $data, 'headers' => $response->headers, ); } } return $memo; } function rest_parse_embed_param( $embed ) { if ( ! $embed || 'true' === $embed || '1' === $embed ) { return true; } $rels = wp_parse_list( $embed ); if ( ! $rels ) { return true; } return $rels; } function rest_filter_response_by_context( $data, $schema, $context ) { if ( isset( $schema['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $data, $schema, '' ); if ( ! is_wp_error( $matching_schema ) ) { if ( ! isset( $schema['type'] ) ) { $schema['type'] = $matching_schema['type']; } $data = rest_filter_response_by_context( $data, $matching_schema, $context ); } } if ( isset( $schema['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $data, $schema, '', true ); if ( ! is_wp_error( $matching_schema ) ) { if ( ! isset( $schema['type'] ) ) { $schema['type'] = $matching_schema['type']; } $data = rest_filter_response_by_context( $data, $matching_schema, $context ); } } if ( ! is_array( $data ) && ! is_object( $data ) ) { return $data; } if ( isset( $schema['type'] ) ) { $type = $schema['type']; } elseif ( isset( $schema['properties'] ) ) { $type = 'object'; } else { return $data; } $is_array_type = 'array' === $type || ( is_array( $type ) && in_array( 'array', $type, true ) ); $is_object_type = 'object' === $type || ( is_array( $type ) && in_array( 'object', $type, true ) ); if ( $is_array_type && $is_object_type ) { if ( rest_is_array( $data ) ) { $is_object_type = false; } else { $is_array_type = false; } } $has_additional_properties = $is_object_type && isset( $schema['additionalProperties'] ) && is_array( $schema['additionalProperties'] ); foreach ( $data as $key => $value ) { $check = array(); if ( $is_array_type ) { $check = isset( $schema['items'] ) ? $schema['items'] : array(); } elseif ( $is_object_type ) { if ( isset( $schema['properties'][ $key ] ) ) { $check = $schema['properties'][ $key ]; } else { $pattern_property_schema = rest_find_matching_pattern_property_schema( $key, $schema ); if ( null !== $pattern_property_schema ) { $check = $pattern_property_schema; } elseif ( $has_additional_properties ) { $check = $schema['additionalProperties']; } } } if ( ! isset( $check['context'] ) ) { continue; } if ( ! in_array( $context, $check['context'], true ) ) { if ( $is_array_type ) { $data = array(); break; } if ( is_object( $data ) ) { unset( $data->$key ); } else { unset( $data[ $key ] ); } } elseif ( is_array( $value ) || is_object( $value ) ) { $new_value = rest_filter_response_by_context( $value, $check, $context ); if ( is_object( $data ) ) { $data->$key = $new_value; } else { $data[ $key ] = $new_value; } } } return $data; } function rest_default_additional_properties_to_false( $schema ) { $type = (array) $schema['type']; if ( in_array( 'object', $type, true ) ) { if ( isset( $schema['properties'] ) ) { foreach ( $schema['properties'] as $key => $child_schema ) { $schema['properties'][ $key ] = rest_default_additional_properties_to_false( $child_schema ); } } if ( isset( $schema['patternProperties'] ) ) { foreach ( $schema['patternProperties'] as $key => $child_schema ) { $schema['patternProperties'][ $key ] = rest_default_additional_properties_to_false( $child_schema ); } } if ( ! isset( $schema['additionalProperties'] ) ) { $schema['additionalProperties'] = false; } } if ( in_array( 'array', $type, true ) ) { if ( isset( $schema['items'] ) ) { $schema['items'] = rest_default_additional_properties_to_false( $schema['items'] ); } } return $schema; } function rest_get_route_for_post( $post ) { $post = get_post( $post ); if ( ! $post instanceof WP_Post ) { return ''; } $post_type_route = rest_get_route_for_post_type_items( $post->post_type ); if ( ! $post_type_route ) { return ''; } $route = sprintf( '%s/%d', $post_type_route, $post->ID ); return apply_filters( 'rest_route_for_post', $route, $post ); } function rest_get_route_for_post_type_items( $post_type ) { $post_type = get_post_type_object( $post_type ); if ( ! $post_type ) { return ''; } if ( ! $post_type->show_in_rest ) { return ''; } $namespace = ! empty( $post_type->rest_namespace ) ? $post_type->rest_namespace : 'wp/v2'; $rest_base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); return apply_filters( 'rest_route_for_post_type_items', $route, $post_type ); } function rest_get_route_for_term( $term ) { $term = get_term( $term ); if ( ! $term instanceof WP_Term ) { return ''; } $taxonomy_route = rest_get_route_for_taxonomy_items( $term->taxonomy ); if ( ! $taxonomy_route ) { return ''; } $route = sprintf( '%s/%d', $taxonomy_route, $term->term_id ); return apply_filters( 'rest_route_for_term', $route, $term ); } function rest_get_route_for_taxonomy_items( $taxonomy ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return ''; } if ( ! $taxonomy->show_in_rest ) { return ''; } $namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2'; $rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy ); } function rest_get_queried_resource_route() { if ( is_singular() ) { $route = rest_get_route_for_post( get_queried_object() ); } elseif ( is_category() || is_tag() || is_tax() ) { $route = rest_get_route_for_term( get_queried_object() ); } elseif ( is_author() ) { $route = '/wp/v2/users/' . get_queried_object_id(); } else { $route = ''; } return apply_filters( 'rest_queried_resource_route', $route ); } function rest_get_endpoint_args_for_schema( $schema, $method = WP_REST_Server::CREATABLE ) { $schema_properties = ! empty( $schema['properties'] ) ? $schema['properties'] : array(); $endpoint_args = array(); $valid_schema_properties = rest_get_allowed_schema_keywords(); $valid_schema_properties = array_diff( $valid_schema_properties, array( 'default', 'required' ) ); foreach ( $schema_properties as $field_id => $params ) { if ( ! empty( $params['readonly'] ) ) { continue; } $endpoint_args[ $field_id ] = array( 'validate_callback' => 'rest_validate_request_arg', 'sanitize_callback' => 'rest_sanitize_request_arg', ); if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) { $endpoint_args[ $field_id ]['default'] = $params['default']; } if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) { $endpoint_args[ $field_id ]['required'] = true; } foreach ( $valid_schema_properties as $schema_prop ) { if ( isset( $params[ $schema_prop ] ) ) { $endpoint_args[ $field_id ][ $schema_prop ] = $params[ $schema_prop ]; } } if ( isset( $params['arg_options'] ) ) { if ( WP_REST_Server::CREATABLE !== $method ) { $params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '', ) ); } $endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] ); } } return $endpoint_args; } function rest_convert_error_to_response( $error ) { $status = array_reduce( $error->get_all_error_data(), static function ( $status, $error_data ) { return is_array( $error_data ) && isset( $error_data['status'] ) ? $error_data['status'] : $status; }, 500 ); $errors = array(); foreach ( (array) $error->errors as $code => $messages ) { $all_data = $error->get_all_error_data( $code ); $last_data = array_pop( $all_data ); foreach ( (array) $messages as $message ) { $formatted = array( 'code' => $code, 'message' => $message, 'data' => $last_data, ); if ( $all_data ) { $formatted['additional_data'] = $all_data; } $errors[] = $formatted; } } $data = $errors[0]; if ( count( $errors ) > 1 ) { array_shift( $errors ); $data['additional_errors'] = $errors; } return new WP_REST_Response( $data, $status ); } domain = $parsed_url['host']; } $this->path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '/'; if ( '/' !== substr( $this->path, -1 ) ) { $this->path = dirname( $this->path ) . '/'; } if ( is_string( $data ) ) { $pairs = explode( ';', $data ); $name = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) ); $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 ); $this->name = $name; $this->value = urldecode( $value ); array_shift( $pairs ); foreach ( $pairs as $pair ) { $pair = rtrim( $pair ); if ( empty( $pair ) ) { continue; } list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); $key = strtolower( trim( $key ) ); if ( 'expires' === $key ) { $val = strtotime( $val ); } $this->$key = $val; } } else { if ( ! isset( $data['name'] ) ) { return; } foreach ( array( 'name', 'value', 'path', 'domain', 'port', 'host_only' ) as $field ) { if ( isset( $data[ $field ] ) ) { $this->$field = $data[ $field ]; } } if ( isset( $data['expires'] ) ) { $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); } else { $this->expires = null; } } } public function test( $url ) { if ( is_null( $this->name ) ) { return false; } if ( isset( $this->expires ) && time() > $this->expires ) { return false; } $url = parse_url( $url ); $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' === $url['scheme'] ? 443 : 80 ); $url['path'] = isset( $url['path'] ) ? $url['path'] : '/'; $path = isset( $this->path ) ? $this->path : '/'; $port = isset( $this->port ) ? $this->port : null; $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); if ( false === stripos( $domain, '.' ) ) { $domain .= '.local'; } $domain = ( '.' === substr( $domain, 0, 1 ) ) ? substr( $domain, 1 ) : $domain; if ( substr( $url['host'], -strlen( $domain ) ) !== $domain ) { return false; } if ( ! empty( $port ) && ! in_array( $url['port'], array_map( 'intval', explode( ',', $port ) ), true ) ) { return false; } if ( substr( $url['path'], 0, strlen( $path ) ) !== $path ) { return false; } return true; } public function getHeaderValue() { if ( ! isset( $this->name ) || ! isset( $this->value ) ) { return ''; } return $this->name . '=' . apply_filters( 'wp_http_cookie_value', $this->value, $this->name ); } public function getFullHeader() { return 'Cookie: ' . $this->getHeaderValue(); } public function get_attributes() { return array( 'expires' => $this->expires, 'path' => $this->path, 'domain' => $this->domain, ); } } permalink_structure ); } public function using_index_permalinks() { if ( empty( $this->permalink_structure ) ) { return false; } return preg_match( '#^/*' . $this->index . '#', $this->permalink_structure ); } public function using_mod_rewrite_permalinks() { return $this->using_permalinks() && ! $this->using_index_permalinks(); } public function preg_index( $number ) { $match_prefix = '$'; $match_suffix = ''; if ( ! empty( $this->matches ) ) { $match_prefix = '$' . $this->matches . '['; $match_suffix = ']'; } return "$match_prefix$number$match_suffix"; } public function page_uri_index() { global $wpdb; $pages = $wpdb->get_results( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'" ); $posts = get_page_hierarchy( $pages ); if ( ! $posts ) { return array( array(), array() ); } $posts = array_reverse( $posts, true ); $page_uris = array(); $page_attachment_uris = array(); foreach ( $posts as $id => $post ) { $uri = get_page_uri( $id ); $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ) ); if ( ! empty( $attachments ) ) { foreach ( $attachments as $attachment ) { $attach_uri = get_page_uri( $attachment->ID ); $page_attachment_uris[ $attach_uri ] = $attachment->ID; } } $page_uris[ $uri ] = $id; } return array( $page_uris, $page_attachment_uris ); } public function page_rewrite_rules() { $this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' ); return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES, true, true, false, false ); } public function get_date_permastruct() { if ( isset( $this->date_structure ) ) { return $this->date_structure; } if ( empty( $this->permalink_structure ) ) { $this->date_structure = ''; return false; } $endians = array( '%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%' ); $this->date_structure = ''; $date_endian = ''; foreach ( $endians as $endian ) { if ( false !== strpos( $this->permalink_structure, $endian ) ) { $date_endian = $endian; break; } } if ( empty( $date_endian ) ) { $date_endian = '%year%/%monthnum%/%day%'; } $front = $this->front; preg_match_all( '/%.+?%/', $this->permalink_structure, $tokens ); $tok_index = 1; foreach ( (array) $tokens[0] as $token ) { if ( '%post_id%' === $token && ( $tok_index <= 3 ) ) { $front = $front . 'date/'; break; } $tok_index++; } $this->date_structure = $front . $date_endian; return $this->date_structure; } public function get_year_permastruct() { $structure = $this->get_date_permastruct(); if ( empty( $structure ) ) { return false; } $structure = str_replace( '%monthnum%', '', $structure ); $structure = str_replace( '%day%', '', $structure ); $structure = preg_replace( '#/+#', '/', $structure ); return $structure; } public function get_month_permastruct() { $structure = $this->get_date_permastruct(); if ( empty( $structure ) ) { return false; } $structure = str_replace( '%day%', '', $structure ); $structure = preg_replace( '#/+#', '/', $structure ); return $structure; } public function get_day_permastruct() { return $this->get_date_permastruct(); } public function get_category_permastruct() { return $this->get_extra_permastruct( 'category' ); } public function get_tag_permastruct() { return $this->get_extra_permastruct( 'post_tag' ); } public function get_extra_permastruct( $name ) { if ( empty( $this->permalink_structure ) ) { return false; } if ( isset( $this->extra_permastructs[ $name ] ) ) { return $this->extra_permastructs[ $name ]['struct']; } return false; } public function get_author_permastruct() { if ( isset( $this->author_structure ) ) { return $this->author_structure; } if ( empty( $this->permalink_structure ) ) { $this->author_structure = ''; return false; } $this->author_structure = $this->front . $this->author_base . '/%author%'; return $this->author_structure; } public function get_search_permastruct() { if ( isset( $this->search_structure ) ) { return $this->search_structure; } if ( empty( $this->permalink_structure ) ) { $this->search_structure = ''; return false; } $this->search_structure = $this->root . $this->search_base . '/%search%'; return $this->search_structure; } public function get_page_permastruct() { if ( isset( $this->page_structure ) ) { return $this->page_structure; } if ( empty( $this->permalink_structure ) ) { $this->page_structure = ''; return false; } $this->page_structure = $this->root . '%pagename%'; return $this->page_structure; } public function get_feed_permastruct() { if ( isset( $this->feed_structure ) ) { return $this->feed_structure; } if ( empty( $this->permalink_structure ) ) { $this->feed_structure = ''; return false; } $this->feed_structure = $this->root . $this->feed_base . '/%feed%'; return $this->feed_structure; } public function get_comment_feed_permastruct() { if ( isset( $this->comment_feed_structure ) ) { return $this->comment_feed_structure; } if ( empty( $this->permalink_structure ) ) { $this->comment_feed_structure = ''; return false; } $this->comment_feed_structure = $this->root . $this->comments_base . '/' . $this->feed_base . '/%feed%'; return $this->comment_feed_structure; } public function add_rewrite_tag( $tag, $regex, $query ) { $position = array_search( $tag, $this->rewritecode, true ); if ( false !== $position && null !== $position ) { $this->rewritereplace[ $position ] = $regex; $this->queryreplace[ $position ] = $query; } else { $this->rewritecode[] = $tag; $this->rewritereplace[] = $regex; $this->queryreplace[] = $query; } } public function remove_rewrite_tag( $tag ) { $position = array_search( $tag, $this->rewritecode, true ); if ( false !== $position && null !== $position ) { unset( $this->rewritecode[ $position ] ); unset( $this->rewritereplace[ $position ] ); unset( $this->queryreplace[ $position ] ); } } public function generate_rewrite_rules( $permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true ) { $feedregex2 = ''; foreach ( (array) $this->feeds as $feed_name ) { $feedregex2 .= $feed_name . '|'; } $feedregex2 = '(' . trim( $feedregex2, '|' ) . ')/?$'; $feedregex = $this->feed_base . '/' . $feedregex2; $trackbackregex = 'trackback/?$'; $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$'; $commentregex = $this->comments_pagination_base . '-([0-9]{1,})/?$'; $embedregex = 'embed/?$'; if ( $endpoints ) { $ep_query_append = array(); foreach ( (array) $this->endpoints as $endpoint ) { $epmatch = $endpoint[1] . '(/(.*))?/?$'; $epquery = '&' . $endpoint[2] . '='; $ep_query_append[ $epmatch ] = array( $endpoint[0], $epquery ); } } $front = substr( $permalink_structure, 0, strpos( $permalink_structure, '%' ) ); preg_match_all( '/%.+?%/', $permalink_structure, $tokens ); $num_tokens = count( $tokens[0] ); $index = $this->index; $feedindex = $index; $trackbackindex = $index; $embedindex = $index; $queries = array(); for ( $i = 0; $i < $num_tokens; ++$i ) { if ( 0 < $i ) { $queries[ $i ] = $queries[ $i - 1 ] . '&'; } else { $queries[ $i ] = ''; } $query_token = str_replace( $this->rewritecode, $this->queryreplace, $tokens[0][ $i ] ) . $this->preg_index( $i + 1 ); $queries[ $i ] .= $query_token; } $structure = $permalink_structure; if ( '/' !== $front ) { $structure = str_replace( $front, '', $structure ); } $structure = trim( $structure, '/' ); $dirs = $walk_dirs ? explode( '/', $structure ) : array( $structure ); $num_dirs = count( $dirs ); $front = preg_replace( '|^/+|', '', $front ); $post_rewrite = array(); $struct = $front; for ( $j = 0; $j < $num_dirs; ++$j ) { $struct .= $dirs[ $j ] . '/'; $struct = ltrim( $struct, '/' ); $match = str_replace( $this->rewritecode, $this->rewritereplace, $struct ); $num_toks = preg_match_all( '/%.+?%/', $struct, $toks ); $query = ( ! empty( $num_toks ) && isset( $queries[ $num_toks - 1 ] ) ) ? $queries[ $num_toks - 1 ] : ''; switch ( $dirs[ $j ] ) { case '%year%': $ep_mask_specific = EP_YEAR; break; case '%monthnum%': $ep_mask_specific = EP_MONTH; break; case '%day%': $ep_mask_specific = EP_DAY; break; default: $ep_mask_specific = EP_NONE; } $pagematch = $match . $pageregex; $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index( $num_toks + 1 ); $commentmatch = $match . $commentregex; $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index( $num_toks + 1 ); if ( get_option( 'page_on_front' ) ) { $rootcommentmatch = $match . $commentregex; $rootcommentquery = $index . '?' . $query . '&page_id=' . get_option( 'page_on_front' ) . '&cpage=' . $this->preg_index( $num_toks + 1 ); } $feedmatch = $match . $feedregex; $feedquery = $feedindex . '?' . $query . '&feed=' . $this->preg_index( $num_toks + 1 ); $feedmatch2 = $match . $feedregex2; $feedquery2 = $feedindex . '?' . $query . '&feed=' . $this->preg_index( $num_toks + 1 ); $embedmatch = $match . $embedregex; $embedquery = $embedindex . '?' . $query . '&embed=true'; if ( $forcomments ) { $feedquery .= '&withcomments=1'; $feedquery2 .= '&withcomments=1'; } $rewrite = array(); if ( $feed ) { $rewrite = array( $feedmatch => $feedquery, $feedmatch2 => $feedquery2, $embedmatch => $embedquery, ); } if ( $paged ) { $rewrite = array_merge( $rewrite, array( $pagematch => $pagequery ) ); } if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) { $rewrite = array_merge( $rewrite, array( $commentmatch => $commentquery ) ); } elseif ( EP_ROOT & $ep_mask && get_option( 'page_on_front' ) ) { $rewrite = array_merge( $rewrite, array( $rootcommentmatch => $rootcommentquery ) ); } if ( $endpoints ) { foreach ( (array) $ep_query_append as $regex => $ep ) { if ( $ep[0] & $ep_mask || $ep[0] & $ep_mask_specific ) { $rewrite[ $match . $regex ] = $index . '?' . $query . $ep[1] . $this->preg_index( $num_toks + 2 ); } } } if ( $num_toks ) { $post = false; $page = false; if ( strpos( $struct, '%postname%' ) !== false || strpos( $struct, '%post_id%' ) !== false || strpos( $struct, '%pagename%' ) !== false || ( strpos( $struct, '%year%' ) !== false && strpos( $struct, '%monthnum%' ) !== false && strpos( $struct, '%day%' ) !== false && strpos( $struct, '%hour%' ) !== false && strpos( $struct, '%minute%' ) !== false && strpos( $struct, '%second%' ) !== false ) ) { $post = true; if ( strpos( $struct, '%pagename%' ) !== false ) { $page = true; } } if ( ! $post ) { foreach ( get_post_types( array( '_builtin' => false ) ) as $ptype ) { if ( strpos( $struct, "%$ptype%" ) !== false ) { $post = true; $page = is_post_type_hierarchical( $ptype ); break; } } } if ( $post ) { $trackbackmatch = $match . $trackbackregex; $trackbackquery = $trackbackindex . '?' . $query . '&tb=1'; $embedmatch = $match . $embedregex; $embedquery = $embedindex . '?' . $query . '&embed=true'; $match = rtrim( $match, '/' ); $submatchbase = str_replace( array( '(', ')' ), '', $match ); $sub1 = $submatchbase . '/([^/]+)/'; $sub1tb = $sub1 . $trackbackregex; $sub1feed = $sub1 . $feedregex; $sub1feed2 = $sub1 . $feedregex2; $sub1comment = $sub1 . $commentregex; $sub1embed = $sub1 . $embedregex; $sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2tb = $sub2 . $trackbackregex; $sub2feed = $sub2 . $feedregex; $sub2feed2 = $sub2 . $feedregex2; $sub2comment = $sub2 . $commentregex; $sub2embed = $sub2 . $embedregex; $subquery = $index . '?attachment=' . $this->preg_index( 1 ); $subtbquery = $subquery . '&tb=1'; $subfeedquery = $subquery . '&feed=' . $this->preg_index( 2 ); $subcommentquery = $subquery . '&cpage=' . $this->preg_index( 2 ); $subembedquery = $subquery . '&embed=true'; if ( ! empty( $endpoints ) ) { foreach ( (array) $ep_query_append as $regex => $ep ) { if ( $ep[0] & EP_ATTACHMENT ) { $rewrite[ $sub1 . $regex ] = $subquery . $ep[1] . $this->preg_index( 3 ); $rewrite[ $sub2 . $regex ] = $subquery . $ep[1] . $this->preg_index( 3 ); } } } $sub1 .= '?$'; $sub2 .= '?$'; $match = $match . '(?:/([0-9]+))?/?$'; $query = $index . '?' . $query . '&page=' . $this->preg_index( $num_toks + 1 ); } else { $match .= '?$'; $query = $index . '?' . $query; } $rewrite = array_merge( $rewrite, array( $match => $query ) ); if ( $post ) { $rewrite = array_merge( array( $trackbackmatch => $trackbackquery ), $rewrite ); $rewrite = array_merge( array( $embedmatch => $embedquery ), $rewrite ); if ( ! $page ) { $rewrite = array_merge( $rewrite, array( $sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery, $sub1comment => $subcommentquery, $sub1embed => $subembedquery, ) ); } $rewrite = array_merge( array( $sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery, $sub2comment => $subcommentquery, $sub2embed => $subembedquery, ), $rewrite ); } } $post_rewrite = array_merge( $rewrite, $post_rewrite ); } return $post_rewrite; } public function generate_rewrite_rule( $permalink_structure, $walk_dirs = false ) { return $this->generate_rewrite_rules( $permalink_structure, EP_NONE, false, false, false, $walk_dirs ); } public function rewrite_rules() { $rewrite = array(); if ( empty( $this->permalink_structure ) ) { return $rewrite; } $home_path = parse_url( home_url() ); $robots_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); $favicon_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array(); $deprecated_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old', '.*wp-app\.php(/.*)?$' => $this->index . '?error=403', ); $registration_pages = array(); if ( is_multisite() && is_main_site() ) { $registration_pages['.*wp-signup.php$'] = $this->index . '?signup=true'; $registration_pages['.*wp-activate.php$'] = $this->index . '?activate=true'; } $registration_pages['.*wp-register.php$'] = $this->index . '?register=true'; $post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK ); $post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite ); $date_rewrite = $this->generate_rewrite_rules( $this->get_date_permastruct(), EP_DATE ); $date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite ); $root_rewrite = $this->generate_rewrite_rules( $this->root . '/', EP_ROOT ); $root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite ); $comments_rewrite = $this->generate_rewrite_rules( $this->root . $this->comments_base, EP_COMMENTS, false, true, true, false ); $comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite ); $search_structure = $this->get_search_permastruct(); $search_rewrite = $this->generate_rewrite_rules( $search_structure, EP_SEARCH ); $search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite ); $author_rewrite = $this->generate_rewrite_rules( $this->get_author_permastruct(), EP_AUTHORS ); $author_rewrite = apply_filters( 'author_rewrite_rules', $author_rewrite ); $page_rewrite = $this->page_rewrite_rules(); $page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite ); foreach ( $this->extra_permastructs as $permastructname => $struct ) { if ( is_array( $struct ) ) { if ( count( $struct ) == 2 ) { $rules = $this->generate_rewrite_rules( $struct[0], $struct[1] ); } else { $rules = $this->generate_rewrite_rules( $struct['struct'], $struct['ep_mask'], $struct['paged'], $struct['feed'], $struct['forcomments'], $struct['walk_dirs'], $struct['endpoints'] ); } } else { $rules = $this->generate_rewrite_rules( $struct ); } $rules = apply_filters( "{$permastructname}_rewrite_rules", $rules ); if ( 'post_tag' === $permastructname ) { $rules = apply_filters_deprecated( 'tag_rewrite_rules', array( $rules ), '3.1.0', 'post_tag_rewrite_rules' ); } $this->extra_rules_top = array_merge( $this->extra_rules_top, $rules ); } if ( $this->use_verbose_page_rules ) { $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules ); } else { $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules ); } do_action_ref_array( 'generate_rewrite_rules', array( &$this ) ); $this->rules = apply_filters( 'rewrite_rules_array', $this->rules ); return $this->rules; } public function wp_rewrite_rules() { $this->rules = get_option( 'rewrite_rules' ); if ( empty( $this->rules ) ) { $this->matches = 'matches'; $this->rewrite_rules(); if ( ! did_action( 'wp_loaded' ) ) { add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); return $this->rules; } update_option( 'rewrite_rules', $this->rules ); } return $this->rules; } public function mod_rewrite_rules() { if ( ! $this->using_permalinks() ) { return ''; } $site_root = parse_url( site_url() ); if ( isset( $site_root['path'] ) ) { $site_root = trailingslashit( $site_root['path'] ); } $home_root = parse_url( home_url() ); if ( isset( $home_root['path'] ) ) { $home_root = trailingslashit( $home_root['path'] ); } else { $home_root = '/'; } $rules = "\n"; $rules .= "RewriteEngine On\n"; $rules .= "RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n"; $rules .= "RewriteBase $home_root\n"; $rules .= "RewriteRule ^index\.php$ - [L]\n"; foreach ( (array) $this->non_wp_rules as $match => $query ) { $match = str_replace( '.+?', '.+', $match ); $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } if ( $this->use_verbose_rules ) { $this->matches = ''; $rewrite = $this->rewrite_rules(); $num_rules = count( $rewrite ); $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . "RewriteCond %{REQUEST_FILENAME} -d\n" . "RewriteRule ^.*$ - [S=$num_rules]\n"; foreach ( (array) $rewrite as $match => $query ) { $match = str_replace( '.+?', '.+', $match ); if ( strpos( $query, $this->index ) !== false ) { $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } else { $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n"; } } } else { $rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" . "RewriteCond %{REQUEST_FILENAME} !-d\n" . "RewriteRule . {$home_root}{$this->index} [L]\n"; } $rules .= "\n"; $rules = apply_filters( 'mod_rewrite_rules', $rules ); return apply_filters_deprecated( 'rewrite_rules', array( $rules ), '1.5.0', 'mod_rewrite_rules' ); } public function iis7_url_rewrite_rules( $add_parent_tags = false ) { if ( ! $this->using_permalinks() ) { return ''; } $rules = ''; if ( $add_parent_tags ) { $rules .= ' + + + '; } $rules .= ' + + + + + + + + '; if ( $add_parent_tags ) { $rules .= ' + + + +'; } return apply_filters( 'iis7_url_rewrite_rules', $rules ); } public function add_rule( $regex, $query, $after = 'bottom' ) { if ( is_array( $query ) ) { $external = false; $query = add_query_arg( $query, 'index.php' ); } else { $index = false === strpos( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' ); $front = substr( $query, 0, $index ); $external = $front != $this->index; } if ( $external ) { $this->add_external_rule( $regex, $query ); } else { if ( 'bottom' === $after ) { $this->extra_rules = array_merge( $this->extra_rules, array( $regex => $query ) ); } else { $this->extra_rules_top = array_merge( $this->extra_rules_top, array( $regex => $query ) ); } } } public function add_external_rule( $regex, $query ) { $this->non_wp_rules[ $regex ] = $query; } public function add_endpoint( $name, $places, $query_var = true ) { global $wp; if ( true === $query_var || null === $query_var ) { $query_var = $name; } $this->endpoints[] = array( $places, $name, $query_var ); if ( $query_var ) { $wp->add_query_var( $query_var ); } } public function add_permastruct( $name, $struct, $args = array() ) { if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } if ( func_num_args() == 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } $defaults = array( 'with_front' => true, 'ep_mask' => EP_NONE, 'paged' => true, 'feed' => true, 'forcomments' => false, 'walk_dirs' => true, 'endpoints' => true, ); $args = array_intersect_key( $args, $defaults ); $args = wp_parse_args( $args, $defaults ); if ( $args['with_front'] ) { $struct = $this->front . $struct; } else { $struct = $this->root . $struct; } $args['struct'] = $struct; $this->extra_permastructs[ $name ] = $args; } public function remove_permastruct( $name ) { unset( $this->extra_permastructs[ $name ] ); } public function flush_rules( $hard = true ) { static $do_hard_later = null; if ( ! did_action( 'wp_loaded' ) ) { add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); $do_hard_later = ( isset( $do_hard_later ) ) ? $do_hard_later || $hard : $hard; return; } if ( isset( $do_hard_later ) ) { $hard = $do_hard_later; unset( $do_hard_later ); } update_option( 'rewrite_rules', '' ); $this->wp_rewrite_rules(); if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) { return; } if ( function_exists( 'save_mod_rewrite_rules' ) ) { save_mod_rewrite_rules(); } if ( function_exists( 'iis7_save_url_rewrite_rules' ) ) { iis7_save_url_rewrite_rules(); } } public function init() { $this->extra_rules = array(); $this->non_wp_rules = array(); $this->endpoints = array(); $this->permalink_structure = get_option( 'permalink_structure' ); $this->front = substr( $this->permalink_structure, 0, strpos( $this->permalink_structure, '%' ) ); $this->root = ''; if ( $this->using_index_permalinks() ) { $this->root = $this->index . '/'; } unset( $this->author_structure ); unset( $this->date_structure ); unset( $this->page_structure ); unset( $this->search_structure ); unset( $this->feed_structure ); unset( $this->comment_feed_structure ); $this->use_trailing_slashes = ( '/' === substr( $this->permalink_structure, -1, 1 ) ); if ( preg_match( '/^[^%]*%(?:postname|category|tag|author)%/', $this->permalink_structure ) ) { $this->use_verbose_page_rules = true; } else { $this->use_verbose_page_rules = false; } } public function set_permalink_structure( $permalink_structure ) { if ( $permalink_structure != $this->permalink_structure ) { $old_permalink_structure = $this->permalink_structure; update_option( 'permalink_structure', $permalink_structure ); $this->init(); do_action( 'permalink_structure_changed', $old_permalink_structure, $permalink_structure ); } } public function set_category_base( $category_base ) { if ( get_option( 'category_base' ) !== $category_base ) { update_option( 'category_base', $category_base ); $this->init(); } } public function set_tag_base( $tag_base ) { if ( get_option( 'tag_base' ) !== $tag_base ) { update_option( 'tag_base', $tag_base ); $this->init(); } } public function __construct() { $this->init(); } } username() . ':' . $this->password(); } public function authentication_header() { return 'Proxy-Authorization: Basic ' . base64_encode( $this->authentication() ); } public function send_through_proxy( $uri ) { $check = parse_url( $uri ); if ( false === $check ) { return true; } $home = parse_url( get_option( 'siteurl' ) ); $result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home ); if ( ! is_null( $result ) ) { return $result; } if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] === $check['host'] ) ) { return false; } if ( ! defined( 'WP_PROXY_BYPASS_HOSTS' ) ) { return true; } static $bypass_hosts = null; static $wildcard_regex = array(); if ( null === $bypass_hosts ) { $bypass_hosts = preg_split( '|,\s*|', WP_PROXY_BYPASS_HOSTS ); if ( false !== strpos( WP_PROXY_BYPASS_HOSTS, '*' ) ) { $wildcard_regex = array(); foreach ( $bypass_hosts as $host ) { $wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) ); } $wildcard_regex = '/^(' . implode( '|', $wildcard_regex ) . ')$/i'; } } if ( ! empty( $wildcard_regex ) ) { return ! preg_match( $wildcard_regex, $check['host'] ); } else { return ! in_array( $check['host'], $bypass_hosts, true ); } } } is_preview = false; } } if ( is_admin() || is_search() || is_preview() || is_trackback() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) { return; } if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) { $requested_url = is_ssl() ? 'https://' : 'http://'; $requested_url .= $_SERVER['HTTP_HOST']; $requested_url .= $_SERVER['REQUEST_URI']; } $original = parse_url( $requested_url ); if ( false === $original ) { return; } $redirect = $original; $redirect_url = false; $redirect_obj = false; if ( ! isset( $redirect['path'] ) ) { $redirect['path'] = ''; } if ( ! isset( $redirect['query'] ) ) { $redirect['query'] = ''; } $redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] ); if ( get_query_var( 'preview' ) ) { $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] ); } $post_id = get_query_var( 'p' ); if ( is_feed() && $post_id ) { $redirect_url = get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); $redirect_obj = get_post( $post_id ); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ), $redirect_url ); $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH ); } } if ( is_singular() && $wp_query->post_count < 1 && $post_id ) { $vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $post_id ) ); if ( ! empty( $vars[0] ) ) { $vars = $vars[0]; if ( 'revision' === $vars->post_type && $vars->post_parent > 0 ) { $post_id = $vars->post_parent; } $redirect_url = get_permalink( $post_id ); $redirect_obj = get_post( $post_id ); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } } if ( is_404() ) { $post_id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) ); $redirect_post = $post_id ? get_post( $post_id ) : false; if ( $redirect_post ) { $post_type_obj = get_post_type_object( $redirect_post->post_type ); if ( $post_type_obj && $post_type_obj->public && 'auto-draft' !== $redirect_post->post_status ) { $redirect_url = get_permalink( $redirect_post ); $redirect_obj = get_post( $redirect_post ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } $year = get_query_var( 'year' ); $month = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); if ( $year && $month && $day ) { $date = sprintf( '%04d-%02d-%02d', $year, $month, $day ); if ( ! wp_checkdate( $month, $day, $year, $date ) ) { $redirect_url = get_month_link( $year, $month ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url ); } } elseif ( $year && $month && $month > 12 ) { $redirect_url = get_year_link( $year ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url ); } if ( get_query_var( 'page' ) ) { $post_id = 0; if ( $wp_query->queried_object instanceof WP_Post ) { $post_id = $wp_query->queried_object->ID; } elseif ( $wp_query->post ) { $post_id = $wp_query->post->ID; } if ( $post_id ) { $redirect_url = get_permalink( $post_id ); $redirect_obj = get_post( $post_id ); $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); } } if ( ! $redirect_url ) { $redirect_url = redirect_guess_404_permalink(); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } } elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) { if ( is_attachment() && ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) && ! $redirect_url ) { if ( ! empty( $_GET['attachment_id'] ) ) { $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) ); $redirect_obj = get_post( get_query_var( 'attachment_id' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] ); } } else { $redirect_url = get_attachment_link(); $redirect_obj = get_post(); } } elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) { $redirect_url = get_permalink( get_query_var( 'p' ) ); $redirect_obj = get_post( get_query_var( 'p' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] ); } } elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) { $redirect_url = get_permalink( $wp_query->get_queried_object_id() ); $redirect_obj = get_post( $wp_query->get_queried_object_id() ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'name', $redirect['query'] ); } } elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) { $redirect_url = get_permalink( get_query_var( 'page_id' ) ); $redirect_obj = get_post( get_query_var( 'page_id' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] ); } } elseif ( is_page() && ! is_feed() && ! $redirect_url && 'page' === get_option( 'show_on_front' ) && get_queried_object_id() === (int) get_option( 'page_on_front' ) ) { $redirect_url = home_url( '/' ); } elseif ( is_home() && ! empty( $_GET['page_id'] ) && ! $redirect_url && 'page' === get_option( 'show_on_front' ) && get_query_var( 'page_id' ) === (int) get_option( 'page_for_posts' ) ) { $redirect_url = get_permalink( get_option( 'page_for_posts' ) ); $redirect_obj = get_post( get_option( 'page_for_posts' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] ); } } elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) { $m = get_query_var( 'm' ); switch ( strlen( $m ) ) { case 4: $redirect_url = get_year_link( $m ); break; case 6: $redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) ); break; case 8: $redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) ); break; } if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'm', $redirect['query'] ); } } elseif ( is_date() ) { $year = get_query_var( 'year' ); $month = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); if ( is_day() && $year && $month && ! empty( $_GET['day'] ) ) { $redirect_url = get_day_link( $year, $month, $day ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] ); } } elseif ( is_month() && $year && ! empty( $_GET['monthnum'] ) ) { $redirect_url = get_month_link( $year, $month ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] ); } } elseif ( is_year() && ! empty( $_GET['year'] ) ) { $redirect_url = get_year_link( $year ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'year', $redirect['query'] ); } } } elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { $author = get_userdata( get_query_var( 'author' ) ); if ( false !== $author && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) { $redirect_url = get_author_posts_url( $author->ID, $author->user_nicename ); $redirect_obj = $author; if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'author', $redirect['query'] ); } } } elseif ( is_category() || is_tag() || is_tax() ) { $term_count = 0; foreach ( $wp_query->tax_query->queried_terms as $tax_query ) { $term_count += count( $tax_query['terms'] ); } $obj = $wp_query->get_queried_object(); if ( $term_count <= 1 && ! empty( $obj->term_id ) ) { $tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy ); if ( $tax_url && ! is_wp_error( $tax_url ) ) { if ( ! empty( $redirect['query'] ) ) { $qv_remove = array( 'term', 'taxonomy' ); if ( is_category() ) { $qv_remove[] = 'category_name'; $qv_remove[] = 'cat'; } elseif ( is_tag() ) { $qv_remove[] = 'tag'; $qv_remove[] = 'tag_id'; } else { $tax_obj = get_taxonomy( $obj->taxonomy ); if ( false !== $tax_obj->query_var ) { $qv_remove[] = $tax_obj->query_var; } } $rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) ); if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) { $redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] ); $tax_url = parse_url( $tax_url ); if ( ! empty( $tax_url['query'] ) ) { parse_str( $tax_url['query'], $query_vars ); $redirect['query'] = add_query_arg( $query_vars, $redirect['query'] ); } else { $redirect['path'] = $tax_url['path']; } } else { foreach ( $qv_remove as $_qv ) { if ( isset( $rewrite_vars[ $_qv ] ) ) { $redirect['query'] = remove_query_arg( $_qv, $redirect['query'] ); } } } } } } } elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) { $category_name = get_query_var( 'category_name' ); if ( $category_name ) { $category = get_category_by_path( $category_name ); if ( ! $category || is_wp_error( $category ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) { $redirect_url = get_permalink( $wp_query->get_queried_object_id() ); $redirect_obj = get_post( $wp_query->get_queried_object_id() ); } } } if ( is_singular() && get_query_var( 'page' ) ) { $page = get_query_var( 'page' ); if ( ! $redirect_url ) { $redirect_url = get_permalink( get_queried_object_id() ); $redirect_obj = get_post( get_queried_object_id() ); } if ( $page > 1 ) { $redirect_url = trailingslashit( $redirect_url ); if ( is_front_page() ) { $redirect_url .= user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' ); } else { $redirect_url .= user_trailingslashit( $page, 'single_paged' ); } } $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); } if ( get_query_var( 'sitemap' ) ) { $redirect_url = get_sitemap_url( get_query_var( 'sitemap' ), get_query_var( 'sitemap-subtype' ), get_query_var( 'paged' ) ); $redirect['query'] = remove_query_arg( array( 'sitemap', 'sitemap-subtype', 'paged' ), $redirect['query'] ); } elseif ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) { $paged = get_query_var( 'paged' ); $feed = get_query_var( 'feed' ); $cpage = get_query_var( 'cpage' ); while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) { $redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] ); $redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] ); $redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] ); } $addl_path = ''; $default_feed = get_default_feed(); if ( is_feed() && in_array( $feed, $wp_rewrite->feeds, true ) ) { $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : ''; if ( ! is_singular() && get_query_var( 'withcomments' ) ) { $addl_path .= 'comments/'; } if ( ( 'rss' === $default_feed && 'feed' === $feed ) || 'rss' === $feed ) { $format = ( 'rss2' === $default_feed ) ? '' : 'rss2'; } else { $format = ( $default_feed === $feed || 'feed' === $feed ) ? '' : $feed; } $addl_path .= user_trailingslashit( 'feed/' . $format, 'feed' ); $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); } elseif ( is_feed() && 'old' === $feed ) { $old_feed_files = array( 'wp-atom.php' => 'atom', 'wp-commentsrss2.php' => 'comments_rss2', 'wp-feed.php' => $default_feed, 'wp-rdf.php' => 'rdf', 'wp-rss.php' => 'rss2', 'wp-rss2.php' => 'rss2', ); if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) { $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] ); wp_redirect( $redirect_url, 301 ); die(); } } if ( $paged > 0 ) { $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] ); if ( ! is_feed() ) { if ( ! is_single() ) { $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : ''; if ( $paged > 1 ) { $addl_path .= user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' ); } } } elseif ( $paged > 1 ) { $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] ); } } $default_comments_page = get_option( 'default_comments_page' ); if ( get_option( 'page_comments' ) && ( 'newest' === $default_comments_page && $cpage > 0 || 'newest' !== $default_comments_page && $cpage > 1 ) ) { $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ); $addl_path .= user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' ); $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); } $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] ); $redirect['path'] = user_trailingslashit( $redirect['path'] ); if ( ! empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false ) { $redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/'; } if ( ! empty( $addl_path ) ) { $redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path; } $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; } if ( 'wp-register.php' === basename( $redirect['path'] ) ) { if ( is_multisite() ) { $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); } else { $redirect_url = wp_registration_url(); } wp_redirect( $redirect_url, 301 ); die(); } } $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); if ( $redirect_url && ! empty( $redirect['query'] ) ) { parse_str( $redirect['query'], $_parsed_query ); $redirect = parse_url( $redirect_url ); if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) { parse_str( $redirect['query'], $_parsed_redirect_query ); if ( empty( $_parsed_redirect_query['name'] ) ) { unset( $_parsed_query['name'] ); } } $_parsed_query = array_combine( rawurlencode_deep( array_keys( $_parsed_query ) ), rawurlencode_deep( array_values( $_parsed_query ) ) ); $redirect_url = add_query_arg( $_parsed_query, $redirect_url ); } if ( $redirect_url ) { $redirect = parse_url( $redirect_url ); } $user_home = parse_url( home_url() ); if ( ! empty( $user_home['host'] ) ) { $redirect['host'] = $user_home['host']; } if ( empty( $user_home['path'] ) ) { $user_home['path'] = '/'; } if ( ! empty( $user_home['port'] ) ) { $redirect['port'] = $user_home['port']; } else { unset( $redirect['port'] ); } $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] ); $punctuation_pattern = implode( '|', array_map( 'preg_quote', array( ' ', '%20', '!', '%21', '"', '%22', "'", '%27', '(', '%28', ')', '%29', ',', '%2C', '.', '%2E', ';', '%3B', '{', '%7B', '}', '%7D', '%E2%80%9C', '%E2%80%9D', ) ) ); $redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] ); if ( ! empty( $redirect['query'] ) ) { $redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] ); $redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' ); $redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] ); $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); } if ( ! $wp_rewrite->using_index_permalinks() ) { $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] ); } if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() && ! is_404() && ( ! is_front_page() || is_front_page() && get_query_var( 'paged' ) > 1 ) ) { $user_ts_type = ''; if ( get_query_var( 'paged' ) > 0 ) { $user_ts_type = 'paged'; } else { foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) { $func = 'is_' . $type; if ( call_user_func( $func ) ) { $user_ts_type = $type; break; } } } $redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type ); } elseif ( is_front_page() ) { $redirect['path'] = trailingslashit( $redirect['path'] ); } if ( is_robots() || ! empty( get_query_var( 'sitemap' ) ) || ! empty( get_query_var( 'sitemap-stylesheet' ) ) ) { $redirect['path'] = untrailingslashit( $redirect['path'] ); } if ( strpos( $redirect['path'], '//' ) > -1 ) { $redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] ); } if ( trailingslashit( $redirect['path'] ) === trailingslashit( $user_home['path'] ) ) { $redirect['path'] = trailingslashit( $redirect['path'] ); } $original_host_low = strtolower( $original['host'] ); $redirect_host_low = strtolower( $redirect['host'] ); if ( $original_host_low === $redirect_host_low || ( 'www.' . $original_host_low !== $redirect_host_low && 'www.' . $redirect_host_low !== $original_host_low ) ) { $redirect['host'] = $original['host']; } $compare_original = array( $original['host'], $original['path'] ); if ( ! empty( $original['port'] ) ) { $compare_original[] = $original['port']; } if ( ! empty( $original['query'] ) ) { $compare_original[] = $original['query']; } $compare_redirect = array( $redirect['host'], $redirect['path'] ); if ( ! empty( $redirect['port'] ) ) { $compare_redirect[] = $redirect['port']; } if ( ! empty( $redirect['query'] ) ) { $compare_redirect[] = $redirect['query']; } if ( $compare_original !== $compare_redirect ) { $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; if ( ! empty( $redirect['port'] ) ) { $redirect_url .= ':' . $redirect['port']; } $redirect_url .= $redirect['path']; if ( ! empty( $redirect['query'] ) ) { $redirect_url .= '?' . $redirect['query']; } } if ( ! $redirect_url || $redirect_url === $requested_url ) { return; } if ( false !== strpos( $requested_url, '%' ) ) { if ( ! function_exists( 'lowercase_octets' ) ) { function lowercase_octets( $matches ) { return strtolower( $matches[0] ); } } $requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url ); } if ( $redirect_obj instanceof WP_Post ) { $post_status_obj = get_post_status_object( get_post_status( $redirect_obj ) ); if ( ! ( $post_status_obj->private && current_user_can( 'read_post', $redirect_obj->ID ) ) && ! is_post_publicly_viewable( $redirect_obj ) ) { $redirect_obj = false; $redirect_url = false; } } $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url ); if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) === strip_fragment_from_url( $requested_url ) ) { return; } if ( $do_redirect ) { if ( ! redirect_canonical( $redirect_url, false ) ) { wp_redirect( $redirect_url, 301 ); exit; } else { return; } } else { return $redirect_url; } } function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) { $parsed_url = parse_url( $url ); if ( ! empty( $parsed_url['query'] ) ) { parse_str( $parsed_url['query'], $parsed_query ); foreach ( $args_to_check as $qv ) { if ( ! isset( $parsed_query[ $qv ] ) ) { $query_string = remove_query_arg( $qv, $query_string ); } } } else { $query_string = remove_query_arg( $args_to_check, $query_string ); } return $query_string; } function strip_fragment_from_url( $url ) { $parsed_url = wp_parse_url( $url ); if ( ! empty( $parsed_url['host'] ) ) { $url = ''; if ( ! empty( $parsed_url['scheme'] ) ) { $url = $parsed_url['scheme'] . ':'; } $url .= '//' . $parsed_url['host']; if ( ! empty( $parsed_url['port'] ) ) { $url .= ':' . $parsed_url['port']; } if ( ! empty( $parsed_url['path'] ) ) { $url .= $parsed_url['path']; } if ( ! empty( $parsed_url['query'] ) ) { $url .= '?' . $parsed_url['query']; } } return $url; } function redirect_guess_404_permalink() { global $wpdb; if ( false === apply_filters( 'do_redirect_guess_404_permalink', true ) ) { return false; } $pre = apply_filters( 'pre_redirect_guess_404_permalink', null ); if ( null !== $pre ) { return $pre; } if ( get_query_var( 'name' ) ) { $strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false ); if ( $strict_guess ) { $where = $wpdb->prepare( 'post_name = %s', get_query_var( 'name' ) ); } else { $where = $wpdb->prepare( 'post_name LIKE %s', $wpdb->esc_like( get_query_var( 'name' ) ) . '%' ); } if ( get_query_var( 'post_type' ) ) { if ( is_array( get_query_var( 'post_type' ) ) ) { $where .= " AND post_type IN ('" . join( "', '", esc_sql( get_query_var( 'post_type' ) ) ) . "')"; } else { $where .= $wpdb->prepare( ' AND post_type = %s', get_query_var( 'post_type' ) ); } } else { $where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')"; } if ( get_query_var( 'year' ) ) { $where .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) ); } if ( get_query_var( 'monthnum' ) ) { $where .= $wpdb->prepare( ' AND MONTH(post_date) = %d', get_query_var( 'monthnum' ) ); } if ( get_query_var( 'day' ) ) { $where .= $wpdb->prepare( ' AND DAYOFMONTH(post_date) = %d', get_query_var( 'day' ) ); } $publicly_viewable_statuses = array_filter( get_post_stati(), 'is_post_status_viewable' ); $post_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE $where AND post_status IN ('" . implode( "', '", esc_sql( $publicly_viewable_statuses ) ) . "')" ); if ( ! $post_id ) { return false; } if ( get_query_var( 'feed' ) ) { return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); } elseif ( get_query_var( 'page' ) > 1 ) { return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); } else { return get_permalink( $post_id ); } } return false; } function wp_redirect_admin_locations() { global $wp_rewrite; if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) ) { return; } $admins = array( home_url( 'wp-admin', 'relative' ), home_url( 'dashboard', 'relative' ), home_url( 'admin', 'relative' ), site_url( 'dashboard', 'relative' ), site_url( 'admin', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true ) ) { wp_redirect( admin_url() ); exit; } $logins = array( home_url( 'wp-login.php', 'relative' ), home_url( 'login', 'relative' ), site_url( 'login', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins, true ) ) { wp_redirect( wp_login_url() ); exit; } } url = $url; $this->timeout = $timeout; $this->redirects = $redirects; $this->headers = $headers; $this->useragent = $useragent; $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE; if ( preg_match( '/^http(s)?:\/\//i', $url ) ) { $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects, ); if ( ! empty( $this->headers ) ) { $args['headers'] = $this->headers; } if ( SIMPLEPIE_USERAGENT != $this->useragent ) { $args['user-agent'] = $this->useragent; } $res = wp_safe_remote_request( $url, $args ); if ( is_wp_error( $res ) ) { $this->error = 'WP HTTP Error: ' . $res->get_error_message(); $this->success = false; } else { $this->headers = wp_remote_retrieve_headers( $res ); foreach ( $this->headers as $name => $value ) { if ( ! is_array( $value ) ) { continue; } if ( 'content-type' === $name ) { $this->headers[ $name ] = array_pop( $value ); } else { $this->headers[ $name ] = implode( ', ', $value ); } } $this->body = wp_remote_retrieve_body( $res ); $this->status_code = wp_remote_retrieve_response_code( $res ); } } else { $this->error = ''; $this->success = false; } } } add( $key, $data, $group, (int) $expire ); } function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->add_multiple( $data, $group, $expire ); } function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->replace( $key, $data, $group, (int) $expire ); } function wp_cache_set( $key, $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->set( $key, $data, $group, (int) $expire ); } function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->set_multiple( $data, $group, $expire ); } function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { global $wp_object_cache; return $wp_object_cache->get( $key, $group, $force, $found ); } function wp_cache_get_multiple( $keys, $group = '', $force = false ) { global $wp_object_cache; return $wp_object_cache->get_multiple( $keys, $group, $force ); } function wp_cache_delete( $key, $group = '' ) { global $wp_object_cache; return $wp_object_cache->delete( $key, $group ); } function wp_cache_delete_multiple( array $keys, $group = '' ) { global $wp_object_cache; return $wp_object_cache->delete_multiple( $keys, $group ); } function wp_cache_incr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->incr( $key, $offset, $group ); } function wp_cache_decr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->decr( $key, $offset, $group ); } function wp_cache_flush() { global $wp_object_cache; return $wp_object_cache->flush(); } function wp_cache_flush_runtime() { return wp_cache_flush(); } function wp_cache_close() { return true; } function wp_cache_add_global_groups( $groups ) { global $wp_object_cache; $wp_object_cache->add_global_groups( $groups ); } function wp_cache_add_non_persistent_groups( $groups ) { } function wp_cache_switch_to_blog( $blog_id ) { global $wp_object_cache; $wp_object_cache->switch_to_blog( $blog_id ); } function wp_cache_reset() { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_cache_switch_to_blog()' ); global $wp_object_cache; $wp_object_cache->reset(); } multisite = is_multisite(); $this->blog_prefix = $this->multisite ? get_current_blog_id() . ':' : ''; } public function __get( $name ) { return $this->$name; } public function __set( $name, $value ) { return $this->$name = $value; } public function __isset( $name ) { return isset( $this->$name ); } public function __unset( $name ) { unset( $this->$name ); } protected function _exists( $key, $group ) { return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) ); } public function add( $key, $data, $group = 'default', $expire = 0 ) { if ( wp_suspend_cache_addition() ) { return false; } if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } public function add_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->add( $key, $value, $group, $expire ); } return $values; } public function replace( $key, $data, $group = 'default', $expire = 0 ) { if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( ! $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } public function set( $key, $data, $group = 'default', $expire = 0 ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( is_object( $data ) ) { $data = clone $data; } $this->cache[ $group ][ $key ] = $data; return true; } public function set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->set( $key, $value, $group, $expire ); } return $values; } public function get( $key, $group = 'default', $force = false, &$found = null ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( $this->_exists( $key, $group ) ) { $found = true; $this->cache_hits += 1; if ( is_object( $this->cache[ $group ][ $key ] ) ) { return clone $this->cache[ $group ][ $key ]; } else { return $this->cache[ $group ][ $key ]; } } $found = false; $this->cache_misses += 1; return false; } public function get_multiple( $keys, $group = 'default', $force = false ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->get( $key, $group, $force ); } return $values; } public function delete( $key, $group = 'default', $deprecated = false ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } unset( $this->cache[ $group ][ $key ] ); return true; } public function delete_multiple( array $keys, $group = '' ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->delete( $key, $group ); } return $values; } public function incr( $key, $offset = 1, $group = 'default' ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] += $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } public function decr( $key, $offset = 1, $group = 'default' ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] -= $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } public function flush() { $this->cache = array(); return true; } public function add_global_groups( $groups ) { $groups = (array) $groups; $groups = array_fill_keys( $groups, true ); $this->global_groups = array_merge( $this->global_groups, $groups ); } public function switch_to_blog( $blog_id ) { $blog_id = (int) $blog_id; $this->blog_prefix = $this->multisite ? $blog_id . ':' : ''; } public function reset() { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Object_Cache::switch_to_blog()' ); foreach ( array_keys( $this->cache ) as $group ) { if ( ! isset( $this->global_groups[ $group ] ) ) { unset( $this->cache[ $group ] ); } } } public function stats() { echo '

          '; echo "Cache Hits: {$this->cache_hits}
          "; echo "Cache Misses: {$this->cache_misses}
          "; echo '

          '; echo '
            '; foreach ( $this->cache as $group => $cache ) { echo '
          • Group: ' . esc_html( $group ) . ' - ( ' . number_format( strlen( serialize( $cache ) ) / KB_IN_BYTES, 2 ) . 'k )
          • '; } echo '
          '; } } ID : false; } function the_title( $before = '', $after = '', $echo = true ) { $title = get_the_title(); if ( strlen( $title ) == 0 ) { return; } $title = $before . $title . $after; if ( $echo ) { echo $title; } else { return $title; } } function the_title_attribute( $args = '' ) { $defaults = array( 'before' => '', 'after' => '', 'echo' => true, 'post' => get_post(), ); $parsed_args = wp_parse_args( $args, $defaults ); $title = get_the_title( $parsed_args['post'] ); if ( strlen( $title ) == 0 ) { return; } $title = $parsed_args['before'] . $title . $parsed_args['after']; $title = esc_attr( strip_tags( $title ) ); if ( $parsed_args['echo'] ) { echo $title; } else { return $title; } } function get_the_title( $post = 0 ) { $post = get_post( $post ); $title = isset( $post->post_title ) ? $post->post_title : ''; $id = isset( $post->ID ) ? $post->ID : 0; if ( ! is_admin() ) { if ( ! empty( $post->post_password ) ) { $prepend = __( 'Protected: %s' ); $protected_title_format = apply_filters( 'protected_title_format', $prepend, $post ); $title = sprintf( $protected_title_format, $title ); } elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) { $prepend = __( 'Private: %s' ); $private_title_format = apply_filters( 'private_title_format', $prepend, $post ); $title = sprintf( $private_title_format, $title ); } } return apply_filters( 'the_title', $title, $id ); } function the_guid( $post = 0 ) { $post = get_post( $post ); $guid = isset( $post->guid ) ? get_the_guid( $post ) : ''; $id = isset( $post->ID ) ? $post->ID : 0; echo apply_filters( 'the_guid', $guid, $id ); } function get_the_guid( $post = 0 ) { $post = get_post( $post ); $guid = isset( $post->guid ) ? $post->guid : ''; $id = isset( $post->ID ) ? $post->ID : 0; return apply_filters( 'get_the_guid', $guid, $id ); } function the_content( $more_link_text = null, $strip_teaser = false ) { $content = get_the_content( $more_link_text, $strip_teaser ); $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); echo $content; } function get_the_content( $more_link_text = null, $strip_teaser = false, $post = null ) { global $page, $more, $preview, $pages, $multipage; $_post = get_post( $post ); if ( ! ( $_post instanceof WP_Post ) ) { return ''; } if ( null === $post && did_action( 'the_post' ) ) { $elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' ); } else { $elements = generate_postdata( $_post ); } if ( null === $more_link_text ) { $more_link_text = sprintf( '%2$s', sprintf( __( 'Continue reading %s' ), the_title_attribute( array( 'echo' => false, 'post' => $_post, ) ) ), __( '(more…)' ) ); } $output = ''; $has_teaser = false; if ( post_password_required( $_post ) ) { return get_the_password_form( $_post ); } if ( $elements['page'] > count( $elements['pages'] ) ) { $elements['page'] = count( $elements['pages'] ); } $page_no = $elements['page']; $content = $elements['pages'][ $page_no - 1 ]; if ( preg_match( '//', $content, $matches ) ) { if ( has_block( 'more', $content ) ) { $content = preg_replace( '//', '', $content ); } $content = explode( $matches[0], $content, 2 ); if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) { $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); } $has_teaser = true; } else { $content = array( $content ); } if ( false !== strpos( $_post->post_content, '' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) { $strip_teaser = true; } $teaser = $content[0]; if ( $elements['more'] && $strip_teaser && $has_teaser ) { $teaser = ''; } $output .= $teaser; if ( count( $content ) > 1 ) { if ( $elements['more'] ) { $output .= '' . $content[1]; } else { if ( ! empty( $more_link_text ) ) { $output .= apply_filters( 'the_content_more_link', ' ID}\" class=\"more-link\">$more_link_text", $more_link_text ); } $output = force_balance_tags( $output ); } } return $output; } function the_excerpt() { echo apply_filters( 'the_excerpt', get_the_excerpt() ); } function get_the_excerpt( $post = null ) { if ( is_bool( $post ) ) { _deprecated_argument( __FUNCTION__, '2.3.0' ); } $post = get_post( $post ); if ( empty( $post ) ) { return ''; } if ( post_password_required( $post ) ) { return __( 'There is no excerpt because this is a protected post.' ); } return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); } function has_excerpt( $post = 0 ) { $post = get_post( $post ); return ( ! empty( $post->post_excerpt ) ); } function post_class( $class = '', $post_id = null ) { echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post_id ) ) ) . '"'; } function get_post_class( $class = '', $post_id = null ) { $post = get_post( $post_id ); $classes = array(); if ( $class ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_map( 'esc_attr', $class ); } else { $class = array(); } if ( ! $post ) { return $classes; } $classes[] = 'post-' . $post->ID; if ( ! is_admin() ) { $classes[] = $post->post_type; } $classes[] = 'type-' . $post->post_type; $classes[] = 'status-' . $post->post_status; if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post->ID ); if ( $post_format && ! is_wp_error( $post_format ) ) { $classes[] = 'format-' . sanitize_html_class( $post_format ); } else { $classes[] = 'format-standard'; } } $post_password_required = post_password_required( $post->ID ); if ( $post_password_required ) { $classes[] = 'post-password-required'; } elseif ( ! empty( $post->post_password ) ) { $classes[] = 'post-password-protected'; } if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) { $classes[] = 'has-post-thumbnail'; } if ( is_sticky( $post->ID ) ) { if ( is_home() && ! is_paged() ) { $classes[] = 'sticky'; } elseif ( is_admin() ) { $classes[] = 'status-sticky'; } } $classes[] = 'hentry'; $taxonomies = get_taxonomies( array( 'public' => true ) ); foreach ( (array) $taxonomies as $taxonomy ) { if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) { if ( empty( $term->slug ) ) { continue; } $term_class = sanitize_html_class( $term->slug, $term->term_id ); if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { $term_class = $term->term_id; } if ( 'post_tag' === $taxonomy ) { $classes[] = 'tag-' . $term_class; } else { $classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id ); } } } } $classes = array_map( 'esc_attr', $classes ); $classes = apply_filters( 'post_class', $classes, $class, $post->ID ); return array_unique( $classes ); } function body_class( $class = '' ) { echo 'class="' . esc_attr( implode( ' ', get_body_class( $class ) ) ) . '"'; } function get_body_class( $class = '' ) { global $wp_query; $classes = array(); if ( is_rtl() ) { $classes[] = 'rtl'; } if ( is_front_page() ) { $classes[] = 'home'; } if ( is_home() ) { $classes[] = 'blog'; } if ( is_privacy_policy() ) { $classes[] = 'privacy-policy'; } if ( is_archive() ) { $classes[] = 'archive'; } if ( is_date() ) { $classes[] = 'date'; } if ( is_search() ) { $classes[] = 'search'; $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results'; } if ( is_paged() ) { $classes[] = 'paged'; } if ( is_attachment() ) { $classes[] = 'attachment'; } if ( is_404() ) { $classes[] = 'error404'; } if ( is_singular() ) { $post_id = $wp_query->get_queried_object_id(); $post = $wp_query->get_queried_object(); $post_type = $post->post_type; if ( is_page_template() ) { $classes[] = "{$post_type}-template"; $template_slug = get_page_template_slug( $post_id ); $template_parts = explode( '/', $template_slug ); foreach ( $template_parts as $part ) { $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) ); } $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) ); } else { $classes[] = "{$post_type}-template-default"; } if ( is_single() ) { $classes[] = 'single'; if ( isset( $post->post_type ) ) { $classes[] = 'single-' . sanitize_html_class( $post->post_type, $post_id ); $classes[] = 'postid-' . $post_id; if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post->ID ); if ( $post_format && ! is_wp_error( $post_format ) ) { $classes[] = 'single-format-' . sanitize_html_class( $post_format ); } else { $classes[] = 'single-format-standard'; } } } } if ( is_attachment() ) { $mime_type = get_post_mime_type( $post_id ); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); $classes[] = 'attachmentid-' . $post_id; $classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type ); } elseif ( is_page() ) { $classes[] = 'page'; $page_id = $wp_query->get_queried_object_id(); $post = get_post( $page_id ); $classes[] = 'page-id-' . $page_id; if ( get_pages( array( 'parent' => $page_id, 'number' => 1, ) ) ) { $classes[] = 'page-parent'; } if ( $post->post_parent ) { $classes[] = 'page-child'; $classes[] = 'parent-pageid-' . $post->post_parent; } } } elseif ( is_archive() ) { if ( is_post_type_archive() ) { $classes[] = 'post-type-archive'; $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); } elseif ( is_author() ) { $author = $wp_query->get_queried_object(); $classes[] = 'author'; if ( isset( $author->user_nicename ) ) { $classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID ); $classes[] = 'author-' . $author->ID; } } elseif ( is_category() ) { $cat = $wp_query->get_queried_object(); $classes[] = 'category'; if ( isset( $cat->term_id ) ) { $cat_class = sanitize_html_class( $cat->slug, $cat->term_id ); if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) { $cat_class = $cat->term_id; } $classes[] = 'category-' . $cat_class; $classes[] = 'category-' . $cat->term_id; } } elseif ( is_tag() ) { $tag = $wp_query->get_queried_object(); $classes[] = 'tag'; if ( isset( $tag->term_id ) ) { $tag_class = sanitize_html_class( $tag->slug, $tag->term_id ); if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) { $tag_class = $tag->term_id; } $classes[] = 'tag-' . $tag_class; $classes[] = 'tag-' . $tag->term_id; } } elseif ( is_tax() ) { $term = $wp_query->get_queried_object(); if ( isset( $term->term_id ) ) { $term_class = sanitize_html_class( $term->slug, $term->term_id ); if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { $term_class = $term->term_id; } $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); $classes[] = 'term-' . $term_class; $classes[] = 'term-' . $term->term_id; } } } if ( is_user_logged_in() ) { $classes[] = 'logged-in'; } if ( is_admin_bar_showing() ) { $classes[] = 'admin-bar'; $classes[] = 'no-customize-support'; } if ( current_theme_supports( 'custom-background' ) && ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) ) { $classes[] = 'custom-background'; } if ( has_custom_logo() ) { $classes[] = 'wp-custom-logo'; } if ( current_theme_supports( 'responsive-embeds' ) ) { $classes[] = 'wp-embed-responsive'; } $page = $wp_query->get( 'page' ); if ( ! $page || $page < 2 ) { $page = $wp_query->get( 'paged' ); } if ( $page && $page > 1 && ! is_404() ) { $classes[] = 'paged-' . $page; if ( is_single() ) { $classes[] = 'single-paged-' . $page; } elseif ( is_page() ) { $classes[] = 'page-paged-' . $page; } elseif ( is_category() ) { $classes[] = 'category-paged-' . $page; } elseif ( is_tag() ) { $classes[] = 'tag-paged-' . $page; } elseif ( is_date() ) { $classes[] = 'date-paged-' . $page; } elseif ( is_author() ) { $classes[] = 'author-paged-' . $page; } elseif ( is_search() ) { $classes[] = 'search-paged-' . $page; } elseif ( is_post_type_archive() ) { $classes[] = 'post-type-paged-' . $page; } } if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { $class = array(); } $classes = array_map( 'esc_attr', $classes ); $classes = apply_filters( 'body_class', $classes, $class ); return array_unique( $classes ); } function post_password_required( $post = null ) { $post = get_post( $post ); if ( empty( $post->post_password ) ) { return apply_filters( 'post_password_required', false, $post ); } if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) { return apply_filters( 'post_password_required', true, $post ); } require_once ABSPATH . WPINC . '/class-phpass.php'; $hasher = new PasswordHash( 8, true ); $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ); if ( 0 !== strpos( $hash, '$P$B' ) ) { $required = true; } else { $required = ! $hasher->CheckPassword( $post->post_password, $hash ); } return apply_filters( 'post_password_required', $required, $post ); } function wp_link_pages( $args = '' ) { global $page, $numpages, $multipage, $more; $defaults = array( 'before' => '

          ' . __( 'Pages:' ), 'after' => '

          ', 'link_before' => '', 'link_after' => '', 'aria_current' => 'page', 'next_or_number' => 'number', 'separator' => ' ', 'nextpagelink' => __( 'Next page' ), 'previouspagelink' => __( 'Previous page' ), 'pagelink' => '%', 'echo' => 1, ); $parsed_args = wp_parse_args( $args, $defaults ); $parsed_args = apply_filters( 'wp_link_pages_args', $parsed_args ); $output = ''; if ( $multipage ) { if ( 'number' === $parsed_args['next_or_number'] ) { $output .= $parsed_args['before']; for ( $i = 1; $i <= $numpages; $i++ ) { $link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after']; if ( $i != $page || ! $more && 1 == $page ) { $link = _wp_link_page( $i ) . $link . ''; } elseif ( $i === $page ) { $link = '' . $link . ''; } $link = apply_filters( 'wp_link_pages_link', $link, $i ); $output .= ( 1 === $i ) ? ' ' : $parsed_args['separator']; $output .= $link; } $output .= $parsed_args['after']; } elseif ( $more ) { $output .= $parsed_args['before']; $prev = $page - 1; if ( $prev > 0 ) { $link = _wp_link_page( $prev ) . $parsed_args['link_before'] . $parsed_args['previouspagelink'] . $parsed_args['link_after'] . ''; $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); } $next = $page + 1; if ( $next <= $numpages ) { if ( $prev ) { $output .= $parsed_args['separator']; } $link = _wp_link_page( $next ) . $parsed_args['link_before'] . $parsed_args['nextpagelink'] . $parsed_args['link_after'] . ''; $output .= apply_filters( 'wp_link_pages_link', $link, $next ); } $output .= $parsed_args['after']; } } $html = apply_filters( 'wp_link_pages', $output, $args ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function _wp_link_page( $i ) { global $wp_rewrite; $post = get_post(); $query_args = array(); if ( 1 == $i ) { $url = get_permalink(); } else { if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) { $url = add_query_arg( 'page', $i, get_permalink() ); } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' ); } else { $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' ); } } if ( is_preview() ) { if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) { $query_args['preview_id'] = wp_unslash( $_GET['preview_id'] ); $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] ); } $url = get_preview_post_link( $post, $query_args, $url ); } return ''; } function post_custom( $key = '' ) { $custom = get_post_custom(); if ( ! isset( $custom[ $key ] ) ) { return false; } elseif ( 1 === count( $custom[ $key ] ) ) { return $custom[ $key ][0]; } else { return $custom[ $key ]; } } function the_meta() { _deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' ); $keys = get_post_custom_keys(); if ( $keys ) { $li_html = ''; foreach ( (array) $keys as $key ) { $keyt = trim( $key ); if ( is_protected_meta( $keyt, 'post' ) ) { continue; } $values = array_map( 'trim', get_post_custom_values( $key ) ); $value = implode( ', ', $values ); $html = sprintf( "
        • %s
        • \n", esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $key ) ), esc_html( $value ) ); $li_html .= apply_filters( 'the_meta_key', $html, $key, $value ); } if ( $li_html ) { echo "\n"; } } } function wp_dropdown_pages( $args = '' ) { $defaults = array( 'depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', 'value_field' => 'ID', ); $parsed_args = wp_parse_args( $args, $defaults ); $pages = get_pages( $parsed_args ); $output = ''; if ( empty( $parsed_args['id'] ) ) { $parsed_args['id'] = $parsed_args['name']; } if ( ! empty( $pages ) ) { $class = ''; if ( ! empty( $parsed_args['class'] ) ) { $class = " class='" . esc_attr( $parsed_args['class'] ) . "'"; } $output = "\n"; } $html = apply_filters( 'wp_dropdown_pages', $output, $parsed_args, $pages ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function wp_list_pages( $args = '' ) { $defaults = array( 'depth' => 0, 'show_date' => '', 'date_format' => get_option( 'date_format' ), 'child_of' => 0, 'exclude' => '', 'title_li' => __( 'Pages' ), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '', 'item_spacing' => 'preserve', 'walker' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); if ( ! in_array( $parsed_args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $parsed_args['item_spacing'] = $defaults['item_spacing']; } $output = ''; $current_page = 0; $parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] ); $exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array(); $parsed_args['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) ); $parsed_args['hierarchical'] = 0; $pages = get_pages( $parsed_args ); if ( ! empty( $pages ) ) { if ( $parsed_args['title_li'] ) { $output .= ''; } } $html = apply_filters( 'wp_list_pages', $output, $parsed_args, $pages ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } function wp_page_menu( $args = array() ) { $defaults = array( 'sort_column' => 'menu_order, post_title', 'menu_id' => '', 'menu_class' => 'menu', 'container' => 'div', 'echo' => true, 'link_before' => '', 'link_after' => '', 'before' => '
            ', 'after' => '
          ', 'item_spacing' => 'discard', 'walker' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $args['item_spacing'] = $defaults['item_spacing']; } if ( 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $args = apply_filters( 'wp_page_menu_args', $args ); $menu = ''; $list_args = $args; if ( ! empty( $args['show_home'] ) ) { if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) { $text = __( 'Home' ); } else { $text = $args['show_home']; } $class = ''; if ( is_front_page() && ! is_paged() ) { $class = 'class="current_page_item"'; } $menu .= '
        • ' . $args['link_before'] . $text . $args['link_after'] . '
        • '; if ( 'page' === get_option( 'show_on_front' ) ) { if ( ! empty( $list_args['exclude'] ) ) { $list_args['exclude'] .= ','; } else { $list_args['exclude'] = ''; } $list_args['exclude'] .= get_option( 'page_on_front' ); } } $list_args['echo'] = false; $list_args['title_li'] = ''; $menu .= wp_list_pages( $list_args ); $container = sanitize_text_field( $args['container'] ); if ( empty( $container ) ) { $container = 'div'; } if ( $menu ) { if ( isset( $args['fallback_cb'] ) && 'wp_page_menu' === $args['fallback_cb'] && 'ul' !== $container ) { $args['before'] = "
            {$n}"; $args['after'] = '
          '; } $menu = $args['before'] . $menu . $args['after']; } $attrs = ''; if ( ! empty( $args['menu_id'] ) ) { $attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"'; } if ( ! empty( $args['menu_class'] ) ) { $attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"'; } $menu = "<{$container}{$attrs}>" . $menu . "{$n}"; $menu = apply_filters( 'wp_page_menu', $menu, $args ); if ( $args['echo'] ) { echo $menu; } else { return $menu; } } function walk_page_tree( $pages, $depth, $current_page, $args ) { if ( empty( $args['walker'] ) ) { $walker = new Walker_Page; } else { $walker = $args['walker']; } foreach ( (array) $pages as $page ) { if ( $page->post_parent ) { $args['pages_with_children'][ $page->post_parent ] = true; } } return $walker->walk( $pages, $depth, $args, $current_page ); } function walk_page_dropdown_tree( ...$args ) { if ( empty( $args[2]['walker'] ) ) { $walker = new Walker_PageDropdown; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.5.0' ); } if ( $fullsize ) { echo wp_get_attachment_link( $id, 'full', $permalink ); } else { echo wp_get_attachment_link( $id, 'thumbnail', $permalink ); } } function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { $_post = get_post( $id ); if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { return __( 'Missing Attachment' ); } $url = wp_get_attachment_url( $_post->ID ); if ( $permalink ) { $url = get_attachment_link( $_post->ID ); } if ( $text ) { $link_text = $text; } elseif ( $size && 'none' !== $size ) { $link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); } else { $link_text = ''; } if ( '' === trim( $link_text ) ) { $link_text = $_post->post_title; } if ( '' === trim( $link_text ) ) { $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) ); } return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text, $attr ); } function prepend_attachment( $content ) { $post = get_post(); if ( empty( $post->post_type ) || 'attachment' !== $post->post_type ) { return $content; } if ( wp_attachment_is( 'video', $post ) ) { $meta = wp_get_attachment_metadata( get_the_ID() ); $atts = array( 'src' => wp_get_attachment_url() ); if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { $atts['width'] = (int) $meta['width']; $atts['height'] = (int) $meta['height']; } if ( has_post_thumbnail() ) { $atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() ); } $p = wp_video_shortcode( $atts ); } elseif ( wp_attachment_is( 'audio', $post ) ) { $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) ); } else { $p = '

          '; $p .= wp_get_attachment_link( 0, 'medium', false ); $p .= '

          '; } $p = apply_filters( 'prepend_attachment', $p ); return "$p\n$content"; } function get_the_password_form( $post = 0 ) { $post = get_post( $post ); $label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID ); $output = '
          +

          ' . __( 'This content is password protected. To view it please enter your password below:' ) . '

          +

          + '; return apply_filters( 'the_password_form', $output, $post ); } function is_page_template( $template = '' ) { if ( ! is_singular() ) { return false; } $page_template = get_page_template_slug( get_queried_object_id() ); if ( empty( $template ) ) { return (bool) $page_template; } if ( $template == $page_template ) { return true; } if ( is_array( $template ) ) { if ( ( in_array( 'default', $template, true ) && ! $page_template ) || in_array( $page_template, $template, true ) ) { return true; } } return ( 'default' === $template && ! $page_template ); } function get_page_template_slug( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( ! $template || 'default' === $template ) { return ''; } return $template; } function wp_post_revision_title( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); $autosavef = __( '%s [Autosave]' ); $currentf = __( '%s [Current Revision]' ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); $edit_link = get_edit_post_link( $revision->ID ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) { $date = "$date"; } if ( ! wp_is_post_revision( $revision ) ) { $date = sprintf( $currentf, $date ); } elseif ( wp_is_post_autosave( $revision ) ) { $date = sprintf( $autosavef, $date ); } return $date; } function wp_post_revision_title_expanded( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } $author = get_the_author_meta( 'display_name', $revision->post_author ); $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); $gravatar = get_avatar( $revision->post_author, 24 ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); $edit_link = get_edit_post_link( $revision->ID ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) { $date = "$date"; } $revision_date_author = sprintf( __( '%1$s %2$s, %3$s ago (%4$s)' ), $gravatar, $author, human_time_diff( strtotime( $revision->post_modified_gmt ) ), $date ); $autosavef = __( '%s [Autosave]' ); $currentf = __( '%s [Current Revision]' ); if ( ! wp_is_post_revision( $revision ) ) { $revision_date_author = sprintf( $currentf, $revision_date_author ); } elseif ( wp_is_post_autosave( $revision ) ) { $revision_date_author = sprintf( $autosavef, $revision_date_author ); } return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link ); } function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { $post = get_post( $post_id ); if ( ! $post ) { return; } if ( is_array( $type ) ) { $type = ! empty( $type['type'] ) ? $type['type'] : $type; _deprecated_argument( __FUNCTION__, '3.6.0' ); } $revisions = wp_get_post_revisions( $post->ID ); if ( ! $revisions ) { return; } $rows = ''; foreach ( $revisions as $revision ) { if ( ! current_user_can( 'read_post', $revision->ID ) ) { continue; } $is_autosave = wp_is_post_autosave( $revision ); if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) { continue; } $rows .= "\t
        • " . wp_post_revision_title_expanded( $revision ) . "
        • \n"; } echo "

          " . __( 'JavaScript must be enabled to use this feature.' ) . "

          \n"; echo "
            \n"; echo $rows; echo '
          '; } function get_post_parent( $post = null ) { $wp_post = get_post( $post ); return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null; } function has_post_parent( $post = null ) { return (bool) get_post_parent( $post ); } original_stylesheet = get_stylesheet(); $this->theme = wp_get_theme( 0 === validate_file( $args['theme'] ) ? $args['theme'] : null ); $this->messenger_channel = $args['messenger_channel']; $this->_changeset_uuid = $args['changeset_uuid']; foreach ( array( 'settings_previewed', 'autosaved', 'branching' ) as $key ) { if ( isset( $args[ $key ] ) ) { $this->$key = (bool) $args[ $key ]; } } require_once ABSPATH . WPINC . '/class-wp-customize-setting.php'; require_once ABSPATH . WPINC . '/class-wp-customize-panel.php'; require_once ABSPATH . WPINC . '/class-wp-customize-section.php'; require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-code-editor-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-themes-panel.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php'; $components = apply_filters( 'customize_loaded_components', $this->components, $this ); require_once ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php'; $this->selective_refresh = new WP_Customize_Selective_Refresh( $this ); if ( in_array( 'widgets', $components, true ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-widgets.php'; $this->widgets = new WP_Customize_Widgets( $this ); } if ( in_array( 'nav_menus', $components, true ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-nav-menus.php'; $this->nav_menus = new WP_Customize_Nav_Menus( $this ); } add_action( 'setup_theme', array( $this, 'setup_theme' ) ); add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); remove_action( 'init', 'wp_cron' ); remove_action( 'admin_init', '_maybe_update_core' ); remove_action( 'admin_init', '_maybe_update_plugins' ); remove_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_ajax_customize_save', array( $this, 'save' ) ); add_action( 'wp_ajax_customize_trash', array( $this, 'handle_changeset_trash_request' ) ); add_action( 'wp_ajax_customize_refresh_nonces', array( $this, 'refresh_nonces' ) ); add_action( 'wp_ajax_customize_load_themes', array( $this, 'handle_load_themes_request' ) ); add_filter( 'heartbeat_settings', array( $this, 'add_customize_screen_to_heartbeat_settings' ) ); add_filter( 'heartbeat_received', array( $this, 'check_changeset_lock_with_heartbeat' ), 10, 3 ); add_action( 'wp_ajax_customize_override_changeset_lock', array( $this, 'handle_override_changeset_lock_request' ) ); add_action( 'wp_ajax_customize_dismiss_autosave_or_lock', array( $this, 'handle_dismiss_autosave_or_lock_request' ) ); add_action( 'customize_register', array( $this, 'register_controls' ) ); add_action( 'customize_register', array( $this, 'register_dynamic_settings' ), 11 ); add_action( 'customize_controls_init', array( $this, 'prepare_controls' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_panel_templates' ), 1 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_section_templates' ), 1 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_control_templates' ), 1 ); add_filter( 'customize_render_partials_response', array( $this, 'export_header_video_settings' ), 10, 3 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 ); if ( current_user_can( 'install_themes' ) || current_user_can( 'update_themes' ) ) { require_once ABSPATH . 'wp-admin/includes/update.php'; add_action( 'customize_controls_print_footer_scripts', 'wp_print_admin_notice_templates' ); } } public function doing_ajax( $action = null ) { if ( ! wp_doing_ajax() ) { return false; } if ( ! $action ) { return true; } else { return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action; } } protected function wp_die( $ajax_message, $message = null ) { if ( $this->doing_ajax() ) { wp_die( $ajax_message ); } if ( ! $message ) { $message = __( 'Something went wrong.' ); } if ( $this->messenger_channel ) { ob_start(); wp_enqueue_scripts(); wp_print_scripts( array( 'customize-base' ) ); $settings = array( 'messengerArgs' => array( 'channel' => $this->messenger_channel, 'url' => wp_customize_url(), ), 'error' => $ajax_message, ); ?> + + doing_ajax() || isset( $_POST['customized'] ) ) { return '_ajax_wp_die_handler'; } return '_default_wp_die_handler'; } public function setup_theme() { global $pagenow; if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) { if ( ! is_user_logged_in() ) { auth_redirect(); } else { wp_die( '

          ' . __( 'You need a higher level of permission.' ) . '

          ' . '

          ' . __( 'Sorry, you are not allowed to customize this site.' ) . '

          ', 403 ); } return; } if ( isset( $this->_changeset_uuid ) && false !== $this->_changeset_uuid && ! wp_is_uuid( $this->_changeset_uuid ) ) { $this->wp_die( -1, __( 'Invalid changeset UUID' ) ); } $has_post_data_nonce = ( check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false ) || check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce', false ) || check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'customize_preview_nonce', false ) ); if ( ! current_user_can( 'customize' ) || ! $has_post_data_nonce ) { unset( $_POST['customized'] ); unset( $_REQUEST['customized'] ); } if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) { $this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) ); } if ( ! headers_sent() ) { send_origin_headers(); } if ( $this->messenger_channel ) { show_admin_bar( false ); } if ( $this->is_theme_active() ) { add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) ); } else { if ( ! current_user_can( 'switch_themes' ) ) { $this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) ); } if ( $this->theme()->errors() ) { $this->wp_die( -1, $this->theme()->errors()->get_error_message() ); } if ( ! $this->theme()->is_allowed() ) { $this->wp_die( -1, __( 'The requested theme does not exist.' ) ); } } add_action( 'after_setup_theme', array( $this, 'establish_loaded_changeset' ), 5 ); if ( get_option( 'fresh_site' ) && 'customize.php' === $pagenow ) { add_action( 'after_setup_theme', array( $this, 'import_theme_starter_content' ), 100 ); } $this->start_previewing_theme(); } public function establish_loaded_changeset() { global $pagenow; if ( empty( $this->_changeset_uuid ) ) { $changeset_uuid = null; if ( ! $this->branching() && $this->is_theme_active() ) { $unpublished_changeset_posts = $this->get_changeset_posts( array( 'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ), 'exclude_restore_dismissed' => false, 'author' => 'any', 'posts_per_page' => 1, 'order' => 'DESC', 'orderby' => 'date', ) ); $unpublished_changeset_post = array_shift( $unpublished_changeset_posts ); if ( ! empty( $unpublished_changeset_post ) && wp_is_uuid( $unpublished_changeset_post->post_name ) ) { $changeset_uuid = $unpublished_changeset_post->post_name; } } if ( empty( $changeset_uuid ) ) { $changeset_uuid = wp_generate_uuid4(); } $this->_changeset_uuid = $changeset_uuid; } if ( is_admin() && 'customize.php' === $pagenow ) { $this->set_changeset_lock( $this->changeset_post_id() ); } } public function after_setup_theme() { $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) ); if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) { wp_redirect( 'themes.php?broken=true' ); exit; } } public function start_previewing_theme() { if ( $this->is_preview() ) { return; } $this->previewing = true; if ( ! $this->is_theme_active() ) { add_filter( 'template', array( $this, 'get_template' ) ); add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) ); add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) ); add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) ); add_filter( 'pre_option_template', array( $this, 'get_template' ) ); add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) ); add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) ); } do_action( 'start_previewing_theme', $this ); } public function stop_previewing_theme() { if ( ! $this->is_preview() ) { return; } $this->previewing = false; if ( ! $this->is_theme_active() ) { remove_filter( 'template', array( $this, 'get_template' ) ); remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) ); remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) ); remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) ); remove_filter( 'pre_option_template', array( $this, 'get_template' ) ); remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) ); remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) ); } do_action( 'stop_previewing_theme', $this ); } public function settings_previewed() { return $this->settings_previewed; } public function autosaved() { return $this->autosaved; } public function branching() { $this->branching = apply_filters( 'customize_changeset_branching', $this->branching, $this ); return $this->branching; } public function changeset_uuid() { if ( empty( $this->_changeset_uuid ) ) { $this->establish_loaded_changeset(); } return $this->_changeset_uuid; } public function theme() { if ( ! $this->theme ) { $this->theme = wp_get_theme(); } return $this->theme; } public function settings() { return $this->settings; } public function controls() { return $this->controls; } public function containers() { return $this->containers; } public function sections() { return $this->sections; } public function panels() { return $this->panels; } public function is_theme_active() { return $this->get_stylesheet() === $this->original_stylesheet; } public function wp_loaded() { $this->register_panel_type( 'WP_Customize_Panel' ); $this->register_panel_type( 'WP_Customize_Themes_Panel' ); $this->register_section_type( 'WP_Customize_Section' ); $this->register_section_type( 'WP_Customize_Sidebar_Section' ); $this->register_section_type( 'WP_Customize_Themes_Section' ); $this->register_control_type( 'WP_Customize_Color_Control' ); $this->register_control_type( 'WP_Customize_Media_Control' ); $this->register_control_type( 'WP_Customize_Upload_Control' ); $this->register_control_type( 'WP_Customize_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Position_Control' ); $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); $this->register_control_type( 'WP_Customize_Theme_Control' ); $this->register_control_type( 'WP_Customize_Code_Editor_Control' ); $this->register_control_type( 'WP_Customize_Date_Time_Control' ); do_action( 'customize_register', $this ); if ( $this->settings_previewed() ) { foreach ( $this->settings as $setting ) { $setting->preview(); } } if ( $this->is_preview() && ! is_admin() ) { $this->customize_preview_init(); } } public function wp_redirect_status( $status ) { _deprecated_function( __FUNCTION__, '4.7.0' ); if ( $this->is_preview() && ! is_admin() ) { return 200; } return $status; } public function find_changeset_post_id( $uuid ) { $cache_group = 'customize_changeset_post'; $changeset_post_id = wp_cache_get( $uuid, $cache_group ); if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) { return $changeset_post_id; } $changeset_post_query = new WP_Query( array( 'post_type' => 'customize_changeset', 'post_status' => get_post_stati(), 'name' => $uuid, 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ) ); if ( ! empty( $changeset_post_query->posts ) ) { $changeset_post_id = $changeset_post_query->posts[0]->ID; wp_cache_set( $uuid, $changeset_post_id, $cache_group ); return $changeset_post_id; } return null; } protected function get_changeset_posts( $args = array() ) { $default_args = array( 'exclude_restore_dismissed' => true, 'posts_per_page' => -1, 'post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'order' => 'DESC', 'orderby' => 'date', 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ); if ( get_current_user_id() ) { $default_args['author'] = get_current_user_id(); } $args = array_merge( $default_args, $args ); if ( ! empty( $args['exclude_restore_dismissed'] ) ) { unset( $args['exclude_restore_dismissed'] ); $args['meta_query'] = array( array( 'key' => '_customize_restore_dismissed', 'compare' => 'NOT EXISTS', ), ); } return get_posts( $args ); } protected function dismiss_user_auto_draft_changesets() { $changeset_autodraft_posts = $this->get_changeset_posts( array( 'post_status' => 'auto-draft', 'exclude_restore_dismissed' => true, 'posts_per_page' => -1, ) ); $dismissed = 0; foreach ( $changeset_autodraft_posts as $autosave_autodraft_post ) { if ( $autosave_autodraft_post->ID === $this->changeset_post_id() ) { continue; } if ( update_post_meta( $autosave_autodraft_post->ID, '_customize_restore_dismissed', true ) ) { $dismissed++; } } return $dismissed; } public function changeset_post_id() { if ( ! isset( $this->_changeset_post_id ) ) { $post_id = $this->find_changeset_post_id( $this->changeset_uuid() ); if ( ! $post_id ) { $post_id = false; } $this->_changeset_post_id = $post_id; } if ( false === $this->_changeset_post_id ) { return null; } return $this->_changeset_post_id; } protected function get_changeset_post_data( $post_id ) { if ( ! $post_id ) { return new WP_Error( 'empty_post_id' ); } $changeset_post = get_post( $post_id ); if ( ! $changeset_post ) { return new WP_Error( 'missing_post' ); } if ( 'revision' === $changeset_post->post_type ) { if ( 'customize_changeset' !== get_post_type( $changeset_post->post_parent ) ) { return new WP_Error( 'wrong_post_type' ); } } elseif ( 'customize_changeset' !== $changeset_post->post_type ) { return new WP_Error( 'wrong_post_type' ); } $changeset_data = json_decode( $changeset_post->post_content, true ); $last_error = json_last_error(); if ( $last_error ) { return new WP_Error( 'json_parse_error', '', $last_error ); } if ( ! is_array( $changeset_data ) ) { return new WP_Error( 'expected_array' ); } return $changeset_data; } public function changeset_data() { if ( isset( $this->_changeset_data ) ) { return $this->_changeset_data; } $changeset_post_id = $this->changeset_post_id(); if ( ! $changeset_post_id ) { $this->_changeset_data = array(); } else { if ( $this->autosaved() && is_user_logged_in() ) { $autosave_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); if ( $autosave_post ) { $data = $this->get_changeset_post_data( $autosave_post->ID ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } } } if ( ! isset( $this->_changeset_data ) ) { $data = $this->get_changeset_post_data( $changeset_post_id ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } else { $this->_changeset_data = array(); } } } return $this->_changeset_data; } protected $pending_starter_content_settings_ids = array(); public function import_theme_starter_content( $starter_content = array() ) { if ( empty( $starter_content ) ) { $starter_content = get_theme_starter_content(); } $changeset_data = array(); if ( $this->changeset_post_id() ) { if ( 'auto-draft' !== get_post_status( $this->changeset_post_id() ) ) { return; } $changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() ); } $sidebars_widgets = isset( $starter_content['widgets'] ) && ! empty( $this->widgets ) ? $starter_content['widgets'] : array(); $attachments = isset( $starter_content['attachments'] ) && ! empty( $this->nav_menus ) ? $starter_content['attachments'] : array(); $posts = isset( $starter_content['posts'] ) && ! empty( $this->nav_menus ) ? $starter_content['posts'] : array(); $options = isset( $starter_content['options'] ) ? $starter_content['options'] : array(); $nav_menus = isset( $starter_content['nav_menus'] ) && ! empty( $this->nav_menus ) ? $starter_content['nav_menus'] : array(); $theme_mods = isset( $starter_content['theme_mods'] ) ? $starter_content['theme_mods'] : array(); $max_widget_numbers = array(); foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { $sidebar_widget_ids = array(); foreach ( $widgets as $widget ) { list( $id_base, $instance ) = $widget; if ( ! isset( $max_widget_numbers[ $id_base ] ) ) { $settings = get_option( "widget_{$id_base}", array() ); if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) { $settings = $settings->getArrayCopy(); } unset( $settings['_multiwidget'] ); $widget_numbers = array_keys( $settings ); if ( count( $widget_numbers ) > 0 ) { $widget_numbers[] = 1; $max_widget_numbers[ $id_base ] = max( ...$widget_numbers ); } else { $max_widget_numbers[ $id_base ] = 1; } } $max_widget_numbers[ $id_base ] += 1; $widget_id = sprintf( '%s-%d', $id_base, $max_widget_numbers[ $id_base ] ); $setting_id = sprintf( 'widget_%s[%d]', $id_base, $max_widget_numbers[ $id_base ] ); $setting_value = $this->widgets->sanitize_widget_js_instance( $instance ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $setting_value ); $this->pending_starter_content_settings_ids[] = $setting_id; } $sidebar_widget_ids[] = $widget_id; } $setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $sidebar_widget_ids ); $this->pending_starter_content_settings_ids[] = $setting_id; } } $starter_content_auto_draft_post_ids = array(); if ( ! empty( $changeset_data['nav_menus_created_posts']['value'] ) ) { $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value'] ); } $needed_posts = array(); $attachments = $this->prepare_starter_content_attachments( $attachments ); foreach ( $attachments as $attachment ) { $key = 'attachment:' . $attachment['post_name']; $needed_posts[ $key ] = true; } foreach ( array_keys( $posts ) as $post_symbol ) { if ( empty( $posts[ $post_symbol ]['post_name'] ) && empty( $posts[ $post_symbol ]['post_title'] ) ) { unset( $posts[ $post_symbol ] ); continue; } if ( empty( $posts[ $post_symbol ]['post_name'] ) ) { $posts[ $post_symbol ]['post_name'] = sanitize_title( $posts[ $post_symbol ]['post_title'] ); } if ( empty( $posts[ $post_symbol ]['post_type'] ) ) { $posts[ $post_symbol ]['post_type'] = 'post'; } $needed_posts[ $posts[ $post_symbol ]['post_type'] . ':' . $posts[ $post_symbol ]['post_name'] ] = true; } $all_post_slugs = array_merge( wp_list_pluck( $attachments, 'post_name' ), wp_list_pluck( $posts, 'post_name' ) ); $post_types = array_filter( array_merge( array( 'attachment' ), wp_list_pluck( $posts, 'post_type' ) ) ); $existing_starter_content_posts = array(); if ( ! empty( $starter_content_auto_draft_post_ids ) ) { $existing_posts_query = new WP_Query( array( 'post__in' => $starter_content_auto_draft_post_ids, 'post_status' => 'auto-draft', 'post_type' => $post_types, 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $post_name = $existing_post->post_name; if ( empty( $post_name ) ) { $post_name = get_post_meta( $existing_post->ID, '_customize_draft_post_name', true ); } $existing_starter_content_posts[ $existing_post->post_type . ':' . $post_name ] = $existing_post; } } if ( ! empty( $all_post_slugs ) ) { $existing_posts_query = new WP_Query( array( 'post_name__in' => $all_post_slugs, 'post_status' => array_diff( get_post_stati(), array( 'auto-draft' ) ), 'post_type' => 'any', 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $key = $existing_post->post_type . ':' . $existing_post->post_name; if ( isset( $needed_posts[ $key ] ) && ! isset( $existing_starter_content_posts[ $key ] ) ) { $existing_starter_content_posts[ $key ] = $existing_post; } } } if ( ! empty( $attachments ) ) { $attachment_ids = array(); foreach ( $attachments as $symbol => $attachment ) { $file_array = array( 'name' => $attachment['file_name'], ); $file_path = $attachment['file_path']; $attachment_id = null; $attached_file = null; if ( isset( $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ] ) ) { $attachment_post = $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ]; $attachment_id = $attachment_post->ID; $attached_file = get_attached_file( $attachment_id ); if ( empty( $attached_file ) || ! file_exists( $attached_file ) ) { $attachment_id = null; $attached_file = null; } elseif ( $this->get_stylesheet() !== get_post_meta( $attachment_post->ID, '_starter_content_theme', true ) ) { $metadata = wp_generate_attachment_metadata( $attachment_post->ID, $attached_file ); wp_update_attachment_metadata( $attachment_id, $metadata ); update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() ); } } if ( ! $attachment_id ) { $temp_file_name = wp_tempnam( wp_basename( $file_path ) ); if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) { $file_array['tmp_name'] = $temp_file_name; } if ( empty( $file_array['tmp_name'] ) ) { continue; } $attachment_post_data = array_merge( wp_array_slice_assoc( $attachment, array( 'post_title', 'post_content', 'post_excerpt' ) ), array( 'post_status' => 'auto-draft', ) ); $attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data ); if ( is_wp_error( $attachment_id ) ) { continue; } update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() ); update_post_meta( $attachment_id, '_customize_draft_post_name', $attachment['post_name'] ); } $attachment_ids[ $symbol ] = $attachment_id; } $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, array_values( $attachment_ids ) ); } if ( ! empty( $posts ) ) { foreach ( array_keys( $posts ) as $post_symbol ) { if ( empty( $posts[ $post_symbol ]['post_type'] ) || empty( $posts[ $post_symbol ]['post_name'] ) ) { continue; } $post_type = $posts[ $post_symbol ]['post_type']; if ( ! empty( $posts[ $post_symbol ]['post_name'] ) ) { $post_name = $posts[ $post_symbol ]['post_name']; } elseif ( ! empty( $posts[ $post_symbol ]['post_title'] ) ) { $post_name = sanitize_title( $posts[ $post_symbol ]['post_title'] ); } else { continue; } if ( isset( $existing_starter_content_posts[ $post_type . ':' . $post_name ] ) ) { $posts[ $post_symbol ]['ID'] = $existing_starter_content_posts[ $post_type . ':' . $post_name ]->ID; continue; } if ( ! empty( $posts[ $post_symbol ]['thumbnail'] ) && preg_match( '/^{{(?P.+)}}$/', $posts[ $post_symbol ]['thumbnail'], $matches ) && isset( $attachment_ids[ $matches['symbol'] ] ) ) { $posts[ $post_symbol ]['meta_input']['_thumbnail_id'] = $attachment_ids[ $matches['symbol'] ]; } if ( ! empty( $posts[ $post_symbol ]['template'] ) ) { $posts[ $post_symbol ]['meta_input']['_wp_page_template'] = $posts[ $post_symbol ]['template']; } $r = $this->nav_menus->insert_auto_draft_post( $posts[ $post_symbol ] ); if ( $r instanceof WP_Post ) { $posts[ $post_symbol ]['ID'] = $r->ID; } } $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, wp_list_pluck( $posts, 'ID' ) ); } if ( ! empty( $this->nav_menus ) && ! empty( $starter_content_auto_draft_post_ids ) ) { $setting_id = 'nav_menus_created_posts'; $this->set_post_value( $setting_id, array_unique( array_values( $starter_content_auto_draft_post_ids ) ) ); $this->pending_starter_content_settings_ids[] = $setting_id; } $placeholder_id = -1; $reused_nav_menu_setting_ids = array(); foreach ( $nav_menus as $nav_menu_location => $nav_menu ) { $nav_menu_term_id = null; $nav_menu_setting_id = null; $matches = array(); foreach ( $changeset_data as $setting_id => $setting_params ) { $can_reuse = ( ! empty( $setting_params['starter_content'] ) && ! in_array( $setting_id, $reused_nav_menu_setting_ids, true ) && preg_match( '#^nav_menu\[(?P-?\d+)\]$#', $setting_id, $matches ) ); if ( $can_reuse ) { $nav_menu_term_id = (int) $matches['nav_menu_id']; $nav_menu_setting_id = $setting_id; $reused_nav_menu_setting_ids[] = $setting_id; break; } } if ( ! $nav_menu_term_id ) { while ( isset( $changeset_data[ sprintf( 'nav_menu[%d]', $placeholder_id ) ] ) ) { $placeholder_id--; } $nav_menu_term_id = $placeholder_id; $nav_menu_setting_id = sprintf( 'nav_menu[%d]', $placeholder_id ); } $this->set_post_value( $nav_menu_setting_id, array( 'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location, ) ); $this->pending_starter_content_settings_ids[] = $nav_menu_setting_id; $position = 0; foreach ( $nav_menu['items'] as $nav_menu_item ) { $nav_menu_item_setting_id = sprintf( 'nav_menu_item[%d]', $placeholder_id-- ); if ( ! isset( $nav_menu_item['position'] ) ) { $nav_menu_item['position'] = $position++; } $nav_menu_item['nav_menu_term_id'] = $nav_menu_term_id; if ( isset( $nav_menu_item['object_id'] ) ) { if ( 'post_type' === $nav_menu_item['type'] && preg_match( '/^{{(?P.+)}}$/', $nav_menu_item['object_id'], $matches ) && isset( $posts[ $matches['symbol'] ] ) ) { $nav_menu_item['object_id'] = $posts[ $matches['symbol'] ]['ID']; if ( empty( $nav_menu_item['title'] ) ) { $original_object = get_post( $nav_menu_item['object_id'] ); $nav_menu_item['title'] = $original_object->post_title; } } else { continue; } } else { $nav_menu_item['object_id'] = 0; } if ( empty( $changeset_data[ $nav_menu_item_setting_id ] ) || ! empty( $changeset_data[ $nav_menu_item_setting_id ]['starter_content'] ) ) { $this->set_post_value( $nav_menu_item_setting_id, $nav_menu_item ); $this->pending_starter_content_settings_ids[] = $nav_menu_item_setting_id; } } $setting_id = sprintf( 'nav_menu_locations[%s]', $nav_menu_location ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $nav_menu_term_id ); $this->pending_starter_content_settings_ids[] = $setting_id; } } foreach ( $options as $name => $value ) { $value = maybe_serialize( $value ); if ( is_serialized( $value ) ) { if ( preg_match( '/s:\d+:"{{(?P.+)}}"/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $symbol_match = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $symbol_match = $attachment_ids[ $matches['symbol'] ]; } if ( isset( $symbol_match ) ) { $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); } else { continue; } } } elseif ( preg_match( '/^{{(?P.+)}}$/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $value = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $value = $attachment_ids[ $matches['symbol'] ]; } else { continue; } } $value = maybe_unserialize( $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; } } foreach ( $theme_mods as $name => $value ) { $value = maybe_serialize( $value ); if ( is_serialized( $value ) ) { if ( preg_match( '/s:\d+:"{{(?P.+)}}"/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $symbol_match = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $symbol_match = $attachment_ids[ $matches['symbol'] ]; } if ( isset( $symbol_match ) ) { $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); } else { continue; } } } elseif ( preg_match( '/^{{(?P.+)}}$/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $value = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $value = $attachment_ids[ $matches['symbol'] ]; } else { continue; } } $value = maybe_unserialize( $value ); if ( 'header_image' === $name ) { $name = 'header_image_data'; $metadata = wp_get_attachment_metadata( $value ); if ( empty( $metadata ) ) { continue; } $value = array( 'attachment_id' => $value, 'url' => wp_get_attachment_url( $value ), 'height' => $metadata['height'], 'width' => $metadata['width'], ); } 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 ); } } } protected function prepare_starter_content_attachments( $attachments ) { $prepared_attachments = array(); if ( empty( $attachments ) ) { return $prepared_attachments; } require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; foreach ( $attachments as $symbol => $attachment ) { if ( empty( $attachment['file'] ) || preg_match( '#^https?://$#', $attachment['file'] ) ) { continue; } $file_path = null; if ( file_exists( $attachment['file'] ) ) { $file_path = $attachment['file']; } elseif ( is_child_theme() && file_exists( get_stylesheet_directory() . '/' . $attachment['file'] ) ) { $file_path = get_stylesheet_directory() . '/' . $attachment['file']; } elseif ( file_exists( get_template_directory() . '/' . $attachment['file'] ) ) { $file_path = get_template_directory() . '/' . $attachment['file']; } else { continue; } $file_name = wp_basename( $attachment['file'] ); $checked_filetype = wp_check_filetype( $file_name ); if ( empty( $checked_filetype['type'] ) ) { continue; } if ( empty( $attachment['post_name'] ) ) { if ( ! empty( $attachment['post_title'] ) ) { $attachment['post_name'] = sanitize_title( $attachment['post_title'] ); } else { $attachment['post_name'] = sanitize_title( preg_replace( '/\.\w+$/', '', $file_name ) ); } } $attachment['file_name'] = $file_name; $attachment['file_path'] = $file_path; $prepared_attachments[ $symbol ] = $attachment; } return $prepared_attachments; } public function _save_starter_content_changeset() { if ( empty( $this->pending_starter_content_settings_ids ) ) { return; } $this->save_changeset_post( array( 'data' => array_fill_keys( $this->pending_starter_content_settings_ids, array( 'starter_content' => true ) ), 'starter_content' => true, ) ); $this->saved_starter_content_changeset = true; $this->pending_starter_content_settings_ids = array(); } public function unsanitized_post_values( $args = array() ) { $args = array_merge( array( 'exclude_changeset' => false, 'exclude_post_data' => ! current_user_can( 'customize' ), ), $args ); $values = array(); if ( ! $this->is_theme_active() ) { $stashed_theme_mods = get_option( 'customize_stashed_theme_mods' ); $stylesheet = $this->get_stylesheet(); if ( isset( $stashed_theme_mods[ $stylesheet ] ) ) { $values = array_merge( $values, wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' ) ); } } if ( ! $args['exclude_changeset'] ) { foreach ( $this->changeset_data() as $setting_id => $setting_params ) { if ( ! array_key_exists( 'value', $setting_params ) ) { continue; } if ( isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] ) { $namespace_pattern = '/^(?P.+?)::(?P.+)$/'; if ( preg_match( $namespace_pattern, $setting_id, $matches ) && $this->get_stylesheet() === $matches['stylesheet'] ) { $values[ $matches['setting_id'] ] = $setting_params['value']; } } else { $values[ $setting_id ] = $setting_params['value']; } } } if ( ! $args['exclude_post_data'] ) { if ( ! isset( $this->_post_values ) ) { if ( isset( $_POST['customized'] ) ) { $post_values = json_decode( wp_unslash( $_POST['customized'] ), true ); } else { $post_values = array(); } if ( is_array( $post_values ) ) { $this->_post_values = $post_values; } else { $this->_post_values = array(); } } $values = array_merge( $values, $this->_post_values ); } return $values; } public function post_value( $setting, $default_value = null ) { $post_values = $this->unsanitized_post_values(); if ( ! array_key_exists( $setting->id, $post_values ) ) { return $default_value; } $value = $post_values[ $setting->id ]; $valid = $setting->validate( $value ); if ( is_wp_error( $valid ) ) { return $default_value; } $value = $setting->sanitize( $value ); if ( is_null( $value ) || is_wp_error( $value ) ) { return $default_value; } return $value; } public function set_post_value( $setting_id, $value ) { $this->unsanitized_post_values(); $this->_post_values[ $setting_id ] = $value; do_action( "customize_post_value_set_{$setting_id}", $value, $this ); do_action( 'customize_post_value_set', $setting_id, $value, $this ); } public function customize_preview_init() { if ( ! headers_sent() ) { nocache_headers(); header( 'X-Robots: noindex, nofollow, noarchive' ); } add_filter( 'wp_robots', 'wp_robots_no_robots' ); add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' ) ); if ( $this->messenger_channel && ! current_user_can( 'customize' ) ) { $this->wp_die( -1, sprintf( __( 'Unauthorized. You may remove the %s param to preview as frontend.' ), 'customize_messenger_channel' ) ); return; } $this->prepare_controls(); add_filter( 'wp_redirect', array( $this, 'add_state_query_params' ) ); wp_enqueue_script( 'customize-preview' ); wp_enqueue_style( 'customize-preview' ); add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) ); add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) ); add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); add_filter( 'get_edit_post_link', '__return_empty_string' ); do_action( 'customize_preview_init', $this ); } public function filter_iframe_security_headers( $headers ) { $headers['X-Frame-Options'] = 'SAMEORIGIN'; $headers['Content-Security-Policy'] = "frame-ancestors 'self'"; return $headers; } public function add_state_query_params( $url ) { $parsed_original_url = wp_parse_url( $url ); $is_allowed = false; foreach ( $this->get_allowed_urls() as $allowed_url ) { $parsed_allowed_url = wp_parse_url( $allowed_url ); $is_allowed = ( $parsed_allowed_url['scheme'] === $parsed_original_url['scheme'] && $parsed_allowed_url['host'] === $parsed_original_url['host'] && 0 === strpos( $parsed_original_url['path'], $parsed_allowed_url['path'] ) ); if ( $is_allowed ) { break; } } if ( $is_allowed ) { $query_params = array( 'customize_changeset_uuid' => $this->changeset_uuid(), ); if ( ! $this->is_theme_active() ) { $query_params['customize_theme'] = $this->get_stylesheet(); } if ( $this->messenger_channel ) { $query_params['customize_messenger_channel'] = $this->messenger_channel; } $url = add_query_arg( $query_params, $url ); } return $url; } public function customize_preview_override_404_status() { _deprecated_function( __METHOD__, '4.7.0' ); } public function customize_preview_base() { _deprecated_function( __METHOD__, '4.7.0' ); } public function customize_preview_html5() { _deprecated_function( __FUNCTION__, '4.7.0' ); } public function customize_preview_loading_style() { ?> + + messenger_channel ) { return; } ?> + + unsanitized_post_values( array( 'exclude_changeset' => true ) ); $setting_validities = $this->validate_setting_values( $post_values ); $exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities ); $self_url = empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); $state_query_params = array( 'customize_theme', 'customize_changeset_uuid', 'customize_messenger_channel', ); $self_url = remove_query_arg( $state_query_params, $self_url ); $allowed_urls = $this->get_allowed_urls(); $allowed_hosts = array(); foreach ( $allowed_urls as $allowed_url ) { $parsed = wp_parse_url( $allowed_url ); if ( empty( $parsed['host'] ) ) { continue; } $host = $parsed['host']; if ( ! empty( $parsed['port'] ) ) { $host .= ':' . $parsed['port']; } $allowed_hosts[] = $host; } $switched_locale = switch_to_locale( get_user_locale() ); $l10n = array( 'shiftClickToEdit' => __( 'Shift-click to edit this element.' ), 'linkUnpreviewable' => __( 'This link is not live-previewable.' ), 'formUnpreviewable' => __( 'This form is not live-previewable.' ), ); if ( $switched_locale ) { restore_previous_locale(); } $settings = array( 'changeset' => array( 'uuid' => $this->changeset_uuid(), 'autosaved' => $this->autosaved(), ), 'timeouts' => array( 'selectiveRefresh' => 250, 'keepAliveSend' => 1000, ), 'theme' => array( 'stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active(), ), 'url' => array( 'self' => $self_url, 'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ), 'allowedHosts' => array_unique( $allowed_hosts ), 'isCrossDomain' => $this->is_cross_domain(), ), 'channel' => $this->messenger_channel, 'activePanels' => array(), 'activeSections' => array(), 'activeControls' => array(), 'settingValidities' => $exported_setting_validities, 'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(), 'l10n' => $l10n, '_dirty' => array_keys( $post_values ), ); foreach ( $this->panels as $panel_id => $panel ) { if ( $panel->check_capabilities() ) { $settings['activePanels'][ $panel_id ] = $panel->active(); foreach ( $panel->sections as $section_id => $section ) { if ( $section->check_capabilities() ) { $settings['activeSections'][ $section_id ] = $section->active(); } } } } foreach ( $this->sections as $id => $section ) { if ( $section->check_capabilities() ) { $settings['activeSections'][ $id ] = $section->active(); } } foreach ( $this->controls as $id => $control ) { if ( $control->check_capabilities() ) { $settings['activeControls'][ $id ] = $control->active(); } } ?> + + previewing; } public function get_template() { return $this->theme()->get_template(); } public function get_stylesheet() { return $this->theme()->get_stylesheet(); } public function get_template_root() { return get_raw_theme_root( $this->get_template(), true ); } public function get_stylesheet_root() { return get_raw_theme_root( $this->get_stylesheet(), true ); } public function current_theme( $current_theme ) { return $this->theme()->display( 'Name' ); } public function validate_setting_values( $setting_values, $options = array() ) { $options = wp_parse_args( $options, array( 'validate_capability' => false, 'validate_existence' => false, ) ); $validities = array(); foreach ( $setting_values as $setting_id => $unsanitized_value ) { $setting = $this->get_setting( $setting_id ); if ( ! $setting ) { if ( $options['validate_existence'] ) { $validities[ $setting_id ] = new WP_Error( 'unrecognized', __( 'Setting does not exist or is unrecognized.' ) ); } continue; } if ( $options['validate_capability'] && ! current_user_can( $setting->capability ) ) { $validity = new WP_Error( 'unauthorized', __( 'Unauthorized to modify setting due to capability.' ) ); } else { if ( is_null( $unsanitized_value ) ) { continue; } $validity = $setting->validate( $unsanitized_value ); } if ( ! is_wp_error( $validity ) ) { $late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting ); if ( is_wp_error( $late_validity ) && $late_validity->has_errors() ) { $validity = $late_validity; } } if ( ! is_wp_error( $validity ) ) { $value = $setting->sanitize( $unsanitized_value ); if ( is_null( $value ) ) { $validity = false; } elseif ( is_wp_error( $value ) ) { $validity = $value; } } if ( false === $validity ) { $validity = new WP_Error( 'invalid_value', __( 'Invalid value.' ) ); } $validities[ $setting_id ] = $validity; } return $validities; } public function prepare_setting_validity_for_js( $validity ) { if ( is_wp_error( $validity ) ) { $notification = array(); foreach ( $validity->errors as $error_code => $error_messages ) { $notification[ $error_code ] = array( 'message' => implode( ' ', $error_messages ), 'data' => $validity->get_error_data( $error_code ), ); } return $notification; } else { return true; } } public function save() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated' ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } $action = 'save-customize_' . $this->get_stylesheet(); if ( ! check_ajax_referer( $action, 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce' ); } $changeset_post_id = $this->changeset_post_id(); $is_new_changeset = empty( $changeset_post_id ); if ( $is_new_changeset ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->create_posts ) ) { wp_send_json_error( 'cannot_create_changeset_post' ); } } else { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { wp_send_json_error( 'cannot_edit_changeset_post' ); } } if ( ! empty( $_POST['customize_changeset_data'] ) ) { $input_changeset_data = json_decode( wp_unslash( $_POST['customize_changeset_data'] ), true ); if ( ! is_array( $input_changeset_data ) ) { wp_send_json_error( 'invalid_customize_changeset_data' ); } } else { $input_changeset_data = array(); } $changeset_title = null; if ( isset( $_POST['customize_changeset_title'] ) ) { $changeset_title = sanitize_text_field( wp_unslash( $_POST['customize_changeset_title'] ) ); } $is_publish = null; $changeset_status = null; if ( isset( $_POST['customize_changeset_status'] ) ) { $changeset_status = wp_unslash( $_POST['customize_changeset_status'] ); if ( ! get_post_status_object( $changeset_status ) || ! in_array( $changeset_status, array( 'draft', 'pending', 'publish', 'future' ), true ) ) { wp_send_json_error( 'bad_customize_changeset_status', 400 ); } $is_publish = ( 'publish' === $changeset_status || 'future' === $changeset_status ); if ( $is_publish && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) { wp_send_json_error( 'changeset_publish_unauthorized', 403 ); } } $changeset_date_gmt = null; if ( isset( $_POST['customize_changeset_date'] ) ) { $changeset_date = wp_unslash( $_POST['customize_changeset_date'] ); if ( preg_match( '/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date ) ) { $mm = substr( $changeset_date, 5, 2 ); $jj = substr( $changeset_date, 8, 2 ); $aa = substr( $changeset_date, 0, 4 ); $valid_date = wp_checkdate( $mm, $jj, $aa, $changeset_date ); if ( ! $valid_date ) { wp_send_json_error( 'bad_customize_changeset_date', 400 ); } $changeset_date_gmt = get_gmt_from_date( $changeset_date ); } else { $timestamp = strtotime( $changeset_date ); if ( ! $timestamp ) { wp_send_json_error( 'bad_customize_changeset_date', 400 ); } $changeset_date_gmt = gmdate( 'Y-m-d H:i:s', $timestamp ); } } $lock_user_id = null; $autosave = ! empty( $_POST['customize_changeset_autosave'] ); if ( ! $is_new_changeset ) { $lock_user_id = wp_check_post_lock( $this->changeset_post_id() ); } if ( $lock_user_id && ! $autosave ) { $autosave = true; $changeset_status = null; $changeset_date_gmt = null; } if ( $autosave && ! defined( 'DOING_AUTOSAVE' ) ) { define( 'DOING_AUTOSAVE', true ); } $autosaved = false; $r = $this->save_changeset_post( array( 'status' => $changeset_status, 'title' => $changeset_title, 'date_gmt' => $changeset_date_gmt, 'data' => $input_changeset_data, 'autosave' => $autosave, ) ); if ( $autosave && ! is_wp_error( $r ) ) { $autosaved = true; } if ( $lock_user_id && ! is_wp_error( $r ) ) { $r = new WP_Error( 'changeset_locked', __( 'Changeset is being edited by other user.' ), array( 'lock_user' => $this->get_lock_user_data( $lock_user_id ), ) ); } if ( is_wp_error( $r ) ) { $response = array( 'message' => $r->get_error_message(), 'code' => $r->get_error_code(), ); if ( is_array( $r->get_error_data() ) ) { $response = array_merge( $response, $r->get_error_data() ); } else { $response['data'] = $r->get_error_data(); } } else { $response = $r; $changeset_post = get_post( $this->changeset_post_id() ); if ( $is_new_changeset ) { $this->dismiss_user_auto_draft_changesets(); } $response['changeset_status'] = $changeset_post->post_status; if ( $is_publish && 'trash' === $response['changeset_status'] ) { $response['changeset_status'] = 'publish'; } if ( 'publish' !== $response['changeset_status'] ) { $this->set_changeset_lock( $changeset_post->ID ); } if ( 'future' === $response['changeset_status'] ) { $response['changeset_date'] = $changeset_post->post_date; } if ( 'publish' === $response['changeset_status'] || 'trash' === $response['changeset_status'] ) { $response['next_changeset_uuid'] = wp_generate_uuid4(); } } if ( $autosave ) { $response['autosaved'] = $autosaved; } if ( isset( $response['setting_validities'] ) ) { $response['setting_validities'] = array_map( array( $this, 'prepare_setting_validity_for_js' ), $response['setting_validities'] ); } $response = apply_filters( 'customize_save_response', $response, $this ); if ( is_wp_error( $r ) ) { wp_send_json_error( $response ); } else { wp_send_json_success( $response ); } } public function save_changeset_post( $args = array() ) { $args = array_merge( array( 'status' => null, 'title' => null, 'data' => array(), 'date_gmt' => null, 'user_id' => get_current_user_id(), 'starter_content' => false, 'autosave' => false, ), $args ); $changeset_post_id = $this->changeset_post_id(); $existing_changeset_data = array(); if ( $changeset_post_id ) { $existing_status = get_post_status( $changeset_post_id ); if ( 'publish' === $existing_status || 'trash' === $existing_status ) { return new WP_Error( 'changeset_already_published', __( 'The previous set of changes has already been published. Please try saving your current set of changes again.' ), array( 'next_changeset_uuid' => wp_generate_uuid4(), ) ); } $existing_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); if ( is_wp_error( $existing_changeset_data ) ) { return $existing_changeset_data; } } if ( 'publish' === $args['status'] && false === has_action( 'transition_post_status', '_wp_customize_publish_changeset' ) ) { return new WP_Error( 'missing_publish_callback' ); } $now = gmdate( 'Y-m-d H:i:59' ); if ( $args['date_gmt'] ) { $is_future_dated = ( mysql2date( 'U', $args['date_gmt'], false ) > mysql2date( 'U', $now, false ) ); if ( ! $is_future_dated ) { return new WP_Error( 'not_future_date', __( 'You must supply a future date to schedule.' ) ); } if ( ! $this->is_theme_active() && ( 'future' === $args['status'] || $is_future_dated ) ) { return new WP_Error( 'cannot_schedule_theme_switches' ); } $will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status( $changeset_post_id ) ) ); if ( $will_remain_auto_draft ) { return new WP_Error( 'cannot_supply_date_for_auto_draft_changeset' ); } } elseif ( $changeset_post_id && 'future' === $args['status'] ) { $changeset_post = get_post( $changeset_post_id ); if ( mysql2date( 'U', $changeset_post->post_date_gmt, false ) <= mysql2date( 'U', $now, false ) ) { return new WP_Error( 'not_future_date', __( 'You must supply a future date to schedule.' ) ); } } if ( ! empty( $is_future_dated ) && 'publish' === $args['status'] ) { $args['status'] = 'future'; } if ( $args['autosave'] ) { if ( $args['date_gmt'] ) { return new WP_Error( 'illegal_autosave_with_date_gmt' ); } elseif ( $args['status'] ) { return new WP_Error( 'illegal_autosave_with_status' ); } elseif ( $args['user_id'] && get_current_user_id() !== $args['user_id'] ) { return new WP_Error( 'illegal_autosave_with_non_current_user' ); } } $update_transactionally = (bool) $args['status']; $allow_revision = (bool) $args['status']; foreach ( $args['data'] as $setting_id => $setting_params ) { if ( is_array( $setting_params ) && array_key_exists( 'value', $setting_params ) ) { $this->set_post_value( $setting_id, $setting_params['value'] ); } } $post_values = $this->unsanitized_post_values( array( 'exclude_changeset' => true, 'exclude_post_data' => false, ) ); $this->add_dynamic_settings( array_keys( $post_values ) ); $changed_setting_ids = array(); foreach ( $post_values as $setting_id => $setting_value ) { $setting = $this->get_setting( $setting_id ); if ( $setting && 'theme_mod' === $setting->type ) { $prefixed_setting_id = $this->get_stylesheet() . '::' . $setting->id; } else { $prefixed_setting_id = $setting_id; } $is_value_changed = ( ! isset( $existing_changeset_data[ $prefixed_setting_id ] ) || ! array_key_exists( 'value', $existing_changeset_data[ $prefixed_setting_id ] ) || $existing_changeset_data[ $prefixed_setting_id ]['value'] !== $setting_value ); if ( $is_value_changed ) { $changed_setting_ids[] = $setting_id; } } do_action( 'customize_save_validation_before', $this ); $validated_values = array_merge( array_fill_keys( array_keys( $args['data'] ), null ), $post_values ); $setting_validities = $this->validate_setting_values( $validated_values, array( 'validate_capability' => true, 'validate_existence' => true, ) ); $invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) ); if ( $update_transactionally && $invalid_setting_count > 0 ) { $response = array( 'setting_validities' => $setting_validities, 'message' => sprintf( _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ), ); return new WP_Error( 'transaction_fail', '', $response ); } $original_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); $data = $original_changeset_data; if ( is_wp_error( $data ) ) { $data = array(); } foreach ( $post_values as $setting_id => $post_value ) { if ( ! isset( $args['data'][ $setting_id ] ) ) { $args['data'][ $setting_id ] = array(); } if ( ! isset( $args['data'][ $setting_id ]['value'] ) ) { $args['data'][ $setting_id ]['value'] = $post_value; } } foreach ( $args['data'] as $setting_id => $setting_params ) { $setting = $this->get_setting( $setting_id ); if ( ! $setting || ! $setting->check_capabilities() ) { continue; } if ( isset( $setting_validities[ $setting_id ] ) && is_wp_error( $setting_validities[ $setting_id ] ) ) { continue; } $changeset_setting_id = $setting_id; if ( 'theme_mod' === $setting->type ) { $changeset_setting_id = sprintf( '%s::%s', $this->get_stylesheet(), $setting_id ); } if ( null === $setting_params ) { unset( $data[ $changeset_setting_id ] ); } else { if ( ! isset( $data[ $changeset_setting_id ] ) ) { $data[ $changeset_setting_id ] = array(); } $merged_setting_params = array_merge( $data[ $changeset_setting_id ], $setting_params ); if ( $data[ $changeset_setting_id ] === $merged_setting_params ) { continue; } $data[ $changeset_setting_id ] = array_merge( $merged_setting_params, array( 'type' => $setting->type, 'user_id' => $args['user_id'], 'date_modified_gmt' => current_time( 'mysql', true ), ) ); if ( empty( $args['starter_content'] ) ) { unset( $data[ $changeset_setting_id ]['starter_content'] ); } } } $filter_context = array( 'uuid' => $this->changeset_uuid(), 'title' => $args['title'], 'status' => $args['status'], 'date_gmt' => $args['date_gmt'], 'post_id' => $changeset_post_id, 'previous_data' => is_wp_error( $original_changeset_data ) ? array() : $original_changeset_data, 'manager' => $this, ); $data = apply_filters( 'customize_changeset_save_data', $data, $filter_context ); if ( 'publish' === $args['status'] && ! $this->is_theme_active() ) { $this->stop_previewing_theme(); switch_theme( $this->get_stylesheet() ); update_option( 'theme_switched_via_customizer', true ); $this->start_previewing_theme(); } $post_array = array( 'post_content' => wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), ); if ( $args['title'] ) { $post_array['post_title'] = $args['title']; } if ( $changeset_post_id ) { $post_array['ID'] = $changeset_post_id; } else { $post_array['post_type'] = 'customize_changeset'; $post_array['post_name'] = $this->changeset_uuid(); $post_array['post_status'] = 'auto-draft'; } if ( $args['status'] ) { $post_array['post_status'] = $args['status']; } if ( 'publish' === $args['status'] ) { $post_array['post_date_gmt'] = '0000-00-00 00:00:00'; $post_array['post_date'] = '0000-00-00 00:00:00'; } elseif ( $args['date_gmt'] ) { $post_array['post_date_gmt'] = $args['date_gmt']; $post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] ); } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) { $post_array['post_date'] = current_time( 'mysql' ); $post_array['post_date_gmt'] = ''; } $this->store_changeset_revision = $allow_revision; add_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ), 5, 3 ); add_filter( 'wp_insert_post_data', array( $this, 'preserve_insert_changeset_post_content' ), 5, 3 ); if ( $changeset_post_id ) { if ( $args['autosave'] && 'auto-draft' !== get_post_status( $changeset_post_id ) ) { add_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10, 4 ); $post_array['post_ID'] = $post_array['ID']; $post_array['post_type'] = 'customize_changeset'; $r = wp_create_post_autosave( wp_slash( $post_array ) ); remove_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10 ); } else { $post_array['edit_date'] = true; $r = wp_update_post( wp_slash( $post_array ), true ); if ( ! empty( $args['user_id'] ) ) { $autosave_draft = wp_get_post_autosave( $changeset_post_id, $args['user_id'] ); if ( $autosave_draft ) { wp_delete_post( $autosave_draft->ID, true ); } } } } else { $r = wp_insert_post( wp_slash( $post_array ), true ); if ( ! is_wp_error( $r ) ) { $this->_changeset_post_id = $r; } } remove_filter( 'wp_insert_post_data', array( $this, 'preserve_insert_changeset_post_content' ), 5 ); $this->_changeset_data = null; remove_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ) ); $response = array( 'setting_validities' => $setting_validities, ); if ( is_wp_error( $r ) ) { $response['changeset_post_save_failure'] = $r->get_error_code(); return new WP_Error( 'changeset_post_save_failure', '', $response ); } return $response; } public function preserve_insert_changeset_post_content( $data, $postarr, $unsanitized_postarr ) { if ( isset( $data['post_type'] ) && isset( $unsanitized_postarr['post_content'] ) && 'customize_changeset' === $data['post_type'] || ( 'revision' === $data['post_type'] && ! empty( $data['post_parent'] ) && 'customize_changeset' === get_post_type( $data['post_parent'] ) ) ) { $data['post_content'] = $unsanitized_postarr['post_content']; } return $data; } public function trash_changeset_post( $post ) { global $wpdb; $post = get_post( $post ); if ( ! ( $post instanceof WP_Post ) ) { return $post; } $post_id = $post->ID; if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_post( $post_id, true ); } if ( 'trash' === get_post_status( $post ) ) { return false; } $check = apply_filters( 'pre_trash_post', null, $post ); if ( null !== $check ) { return $check; } do_action( 'wp_trash_post', $post_id ); add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status ); add_post_meta( $post_id, '_wp_trash_meta_time', time() ); $old_status = $post->post_status; $new_status = 'trash'; $wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); $post->post_status = $new_status; wp_transition_post_status( $new_status, $old_status, $post ); do_action( "edit_post_{$post->post_type}", $post->ID, $post ); do_action( 'edit_post', $post->ID, $post ); do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); do_action( 'save_post', $post->ID, $post, true ); do_action( 'wp_insert_post', $post->ID, $post, true ); wp_after_insert_post( get_post( $post_id ), true, $post ); wp_trash_post_comments( $post_id ); do_action( 'trashed_post', $post_id ); return $post; } public function handle_changeset_trash_request() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated' ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } if ( ! check_ajax_referer( 'trash_customize_changeset', 'nonce', false ) ) { wp_send_json_error( array( 'code' => 'invalid_nonce', 'message' => __( 'There was an authentication problem. Please reload and try again.' ), ) ); } $changeset_post_id = $this->changeset_post_id(); if ( ! $changeset_post_id ) { wp_send_json_error( array( 'message' => __( 'No changes saved yet, so there is nothing to trash.' ), 'code' => 'non_existent_changeset', ) ); return; } if ( $changeset_post_id ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'changeset_trash_unauthorized', 'message' => __( 'Unable to trash changes.' ), ) ); } $lock_user = (int) wp_check_post_lock( $changeset_post_id ); if ( $lock_user && get_current_user_id() !== $lock_user ) { wp_send_json_error( array( 'code' => 'changeset_locked', 'message' => __( 'Changeset is being edited by other user.' ), 'lockUser' => $this->get_lock_user_data( $lock_user ), ) ); } } if ( 'trash' === get_post_status( $changeset_post_id ) ) { wp_send_json_error( array( 'message' => __( 'Changes have already been trashed.' ), 'code' => 'changeset_already_trashed', ) ); return; } $r = $this->trash_changeset_post( $changeset_post_id ); if ( ! ( $r instanceof WP_Post ) ) { wp_send_json_error( array( 'code' => 'changeset_trash_failure', 'message' => __( 'Unable to trash changes.' ), ) ); } wp_send_json_success( array( 'message' => __( 'Changes trashed successfully.' ), ) ); } public function grant_edit_post_capability_for_changeset( $caps, $cap, $user_id, $args ) { if ( 'edit_post' === $cap && ! empty( $args[0] ) && 'customize_changeset' === get_post_type( $args[0] ) ) { $post_type_obj = get_post_type_object( 'customize_changeset' ); $caps = map_meta_cap( $post_type_obj->cap->$cap, $user_id ); } return $caps; } public function set_changeset_lock( $changeset_post_id, $take_over = false ) { if ( $changeset_post_id ) { $can_override = ! (bool) get_post_meta( $changeset_post_id, '_edit_lock', true ); if ( $take_over ) { $can_override = true; } if ( $can_override ) { $lock = sprintf( '%s:%s', time(), get_current_user_id() ); update_post_meta( $changeset_post_id, '_edit_lock', $lock ); } else { $this->refresh_changeset_lock( $changeset_post_id ); } } } public function refresh_changeset_lock( $changeset_post_id ) { if ( ! $changeset_post_id ) { return; } $lock = get_post_meta( $changeset_post_id, '_edit_lock', true ); $lock = explode( ':', $lock ); if ( $lock && ! empty( $lock[1] ) ) { $user_id = (int) $lock[1]; $current_user_id = get_current_user_id(); if ( $user_id === $current_user_id ) { $lock = sprintf( '%s:%s', time(), $user_id ); update_post_meta( $changeset_post_id, '_edit_lock', $lock ); } } } public function add_customize_screen_to_heartbeat_settings( $settings ) { global $pagenow; if ( 'customize.php' === $pagenow ) { $settings['screenId'] = 'customize'; } return $settings; } protected function get_lock_user_data( $user_id ) { if ( ! $user_id ) { return null; } $lock_user = get_userdata( $user_id ); if ( ! $lock_user ) { return null; } return array( 'id' => $lock_user->ID, 'name' => $lock_user->display_name, 'avatar' => get_avatar_url( $lock_user->ID, array( 'size' => 128 ) ), ); } public function check_changeset_lock_with_heartbeat( $response, $data, $screen_id ) { if ( isset( $data['changeset_uuid'] ) ) { $changeset_post_id = $this->find_changeset_post_id( $data['changeset_uuid'] ); } else { $changeset_post_id = $this->changeset_post_id(); } if ( array_key_exists( 'check_changeset_lock', $data ) && 'customize' === $screen_id && $changeset_post_id && current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { $lock_user_id = wp_check_post_lock( $changeset_post_id ); if ( $lock_user_id ) { $response['customize_changeset_lock_user'] = $this->get_lock_user_data( $lock_user_id ); } else { $this->refresh_changeset_lock( $changeset_post_id ); } } return $response; } public function handle_override_changeset_lock_request() { if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview', 400 ); } if ( ! check_ajax_referer( 'customize_override_changeset_lock', 'nonce', false ) ) { wp_send_json_error( array( 'code' => 'invalid_nonce', 'message' => __( 'Security check failed.' ), ) ); } $changeset_post_id = $this->changeset_post_id(); if ( empty( $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'no_changeset_found_to_take_over', 'message' => __( 'No changeset found to take over' ), ) ); } if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'cannot_remove_changeset_lock', 'message' => __( 'Sorry, you are not allowed to take over.' ), ) ); } $this->set_changeset_lock( $changeset_post_id, true ); wp_send_json_success( 'changeset_taken_over' ); } protected $store_changeset_revision; public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) { unset( $last_revision ); if ( 'customize_changeset' === $post->post_type ) { $post_has_changed = $this->store_changeset_revision; } return $post_has_changed; } public function _publish_changeset_values( $changeset_post_id ) { global $wpdb; $publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); if ( is_wp_error( $publishing_changeset_data ) ) { return $publishing_changeset_data; } $changeset_post = get_post( $changeset_post_id ); $previous_changeset_post_id = $this->_changeset_post_id; $this->_changeset_post_id = $changeset_post_id; $previous_changeset_uuid = $this->_changeset_uuid; $this->_changeset_uuid = $changeset_post->post_name; $previous_changeset_data = $this->_changeset_data; $this->_changeset_data = $publishing_changeset_data; $setting_user_ids = array(); $theme_mod_settings = array(); $namespace_pattern = '/^(?P.+?)::(?P.+)$/'; $matches = array(); foreach ( $this->_changeset_data as $raw_setting_id => $setting_params ) { $actual_setting_id = null; $is_theme_mod_setting = ( isset( $setting_params['value'] ) && isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] && preg_match( $namespace_pattern, $raw_setting_id, $matches ) ); if ( $is_theme_mod_setting ) { if ( ! isset( $theme_mod_settings[ $matches['stylesheet'] ] ) ) { $theme_mod_settings[ $matches['stylesheet'] ] = array(); } $theme_mod_settings[ $matches['stylesheet'] ][ $matches['setting_id'] ] = $setting_params; if ( $this->get_stylesheet() === $matches['stylesheet'] ) { $actual_setting_id = $matches['setting_id']; } } else { $actual_setting_id = $raw_setting_id; } if ( $actual_setting_id && isset( $setting_params['user_id'] ) ) { $setting_user_ids[ $actual_setting_id ] = $setting_params['user_id']; } } $changeset_setting_values = $this->unsanitized_post_values( array( 'exclude_post_data' => true, 'exclude_changeset' => false, ) ); $changeset_setting_ids = array_keys( $changeset_setting_values ); $this->add_dynamic_settings( $changeset_setting_ids ); do_action( 'customize_save', $this ); $original_setting_capabilities = array(); foreach ( $changeset_setting_ids as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting && ! isset( $setting_user_ids[ $setting_id ] ) ) { $original_setting_capabilities[ $setting->id ] = $setting->capability; $setting->capability = 'exist'; } } $original_user_id = get_current_user_id(); foreach ( $changeset_setting_ids as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { if ( isset( $setting_user_ids[ $setting_id ] ) ) { wp_set_current_user( $setting_user_ids[ $setting_id ] ); } else { wp_set_current_user( $original_user_id ); } $setting->save(); } } wp_set_current_user( $original_user_id ); if ( did_action( 'switch_theme' ) ) { $other_theme_mod_settings = $theme_mod_settings; unset( $other_theme_mod_settings[ $this->get_stylesheet() ] ); $this->update_stashed_theme_mod_settings( $other_theme_mod_settings ); } do_action( 'customize_save_after', $this ); foreach ( $original_setting_capabilities as $setting_id => $capability ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { $setting->capability = $capability; } } $this->_changeset_data = $previous_changeset_data; $this->_changeset_post_id = $previous_changeset_post_id; $this->_changeset_uuid = $previous_changeset_uuid; $revisions = wp_get_post_revisions( $changeset_post_id, array( 'check_enabled' => false ) ); foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$changeset_post_id}-autosave" ) ) { $wpdb->update( $wpdb->posts, array( 'post_status' => 'auto-draft', 'post_type' => 'customize_changeset', 'post_name' => wp_generate_uuid4(), 'post_parent' => 0, ), array( 'ID' => $revision->ID, ) ); clean_post_cache( $revision->ID ); } } return true; } protected function update_stashed_theme_mod_settings( $inactive_theme_mod_settings ) { $stashed_theme_mod_settings = get_option( 'customize_stashed_theme_mods' ); if ( empty( $stashed_theme_mod_settings ) ) { $stashed_theme_mod_settings = array(); } unset( $stashed_theme_mod_settings[ $this->get_stylesheet() ] ); foreach ( $inactive_theme_mod_settings as $stylesheet => $theme_mod_settings ) { if ( ! isset( $stashed_theme_mod_settings[ $stylesheet ] ) ) { $stashed_theme_mod_settings[ $stylesheet ] = array(); } $stashed_theme_mod_settings[ $stylesheet ] = array_merge( $stashed_theme_mod_settings[ $stylesheet ], $theme_mod_settings ); } $autoload = false; $result = update_option( 'customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload ); if ( ! $result ) { return false; } return $stashed_theme_mod_settings; } public function refresh_nonces() { if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } wp_send_json_success( $this->get_nonces() ); } public function handle_dismiss_autosave_or_lock_request() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated', 401 ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview', 400 ); } if ( ! check_ajax_referer( 'customize_dismiss_autosave_or_lock', 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce', 403 ); } $changeset_post_id = $this->changeset_post_id(); $dismiss_lock = ! empty( $_POST['dismiss_lock'] ); $dismiss_autosave = ! empty( $_POST['dismiss_autosave'] ); if ( $dismiss_lock ) { if ( empty( $changeset_post_id ) && ! $dismiss_autosave ) { wp_send_json_error( 'no_changeset_to_dismiss_lock', 404 ); } if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) && ! $dismiss_autosave ) { wp_send_json_error( 'cannot_remove_changeset_lock', 403 ); } delete_post_meta( $changeset_post_id, '_edit_lock' ); if ( ! $dismiss_autosave ) { wp_send_json_success( 'changeset_lock_dismissed' ); } } if ( $dismiss_autosave ) { if ( empty( $changeset_post_id ) || 'auto-draft' === get_post_status( $changeset_post_id ) ) { $dismissed = $this->dismiss_user_auto_draft_changesets(); if ( $dismissed > 0 ) { wp_send_json_success( 'auto_draft_dismissed' ); } else { wp_send_json_error( 'no_auto_draft_to_delete', 404 ); } } else { $revision = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); if ( $revision ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) { wp_send_json_error( 'cannot_delete_autosave_revision', 403 ); } if ( ! wp_delete_post( $revision->ID, true ) ) { wp_send_json_error( 'autosave_revision_deletion_failure', 500 ); } else { wp_send_json_success( 'autosave_revision_deleted' ); } } else { wp_send_json_error( 'no_autosave_revision_to_delete', 404 ); } } } wp_send_json_error( 'unknown_error', 500 ); } public function add_setting( $id, $args = array() ) { if ( $id instanceof WP_Customize_Setting ) { $setting = $id; } else { $class = 'WP_Customize_Setting'; $args = apply_filters( 'customize_dynamic_setting_args', $args, $id ); $class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args ); $setting = new $class( $this, $id, $args ); } $this->settings[ $setting->id ] = $setting; return $setting; } public function add_dynamic_settings( $setting_ids ) { $new_settings = array(); foreach ( $setting_ids as $setting_id ) { if ( $this->get_setting( $setting_id ) ) { continue; } $setting_args = false; $setting_class = 'WP_Customize_Setting'; $setting_args = apply_filters( 'customize_dynamic_setting_args', $setting_args, $setting_id ); if ( false === $setting_args ) { continue; } $setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args ); $setting = new $setting_class( $this, $setting_id, $setting_args ); $this->add_setting( $setting ); $new_settings[] = $setting; } return $new_settings; } public function get_setting( $id ) { if ( isset( $this->settings[ $id ] ) ) { return $this->settings[ $id ]; } } public function remove_setting( $id ) { unset( $this->settings[ $id ] ); } public function add_panel( $id, $args = array() ) { if ( $id instanceof WP_Customize_Panel ) { $panel = $id; } else { $panel = new WP_Customize_Panel( $this, $id, $args ); } $this->panels[ $panel->id ] = $panel; return $panel; } public function get_panel( $id ) { if ( isset( $this->panels[ $id ] ) ) { return $this->panels[ $id ]; } } public function remove_panel( $id ) { if ( in_array( $id, $this->components, true ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), $id, sprintf( '%2$s', esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), 'customize_loaded_components' ) ), '4.5.0' ); } unset( $this->panels[ $id ] ); } public function register_panel_type( $panel ) { $this->registered_panel_types[] = $panel; } public function render_panel_templates() { foreach ( $this->registered_panel_types as $panel_type ) { $panel = new $panel_type( $this, 'temp', array() ); $panel->print_template(); } } public function add_section( $id, $args = array() ) { if ( $id instanceof WP_Customize_Section ) { $section = $id; } else { $section = new WP_Customize_Section( $this, $id, $args ); } $this->sections[ $section->id ] = $section; return $section; } public function get_section( $id ) { if ( isset( $this->sections[ $id ] ) ) { return $this->sections[ $id ]; } } public function remove_section( $id ) { unset( $this->sections[ $id ] ); } public function register_section_type( $section ) { $this->registered_section_types[] = $section; } public function render_section_templates() { foreach ( $this->registered_section_types as $section_type ) { $section = new $section_type( $this, 'temp', array() ); $section->print_template(); } } public function add_control( $id, $args = array() ) { if ( $id instanceof WP_Customize_Control ) { $control = $id; } else { $control = new WP_Customize_Control( $this, $id, $args ); } $this->controls[ $control->id ] = $control; return $control; } public function get_control( $id ) { if ( isset( $this->controls[ $id ] ) ) { return $this->controls[ $id ]; } } public function remove_control( $id ) { unset( $this->controls[ $id ] ); } public function register_control_type( $control ) { $this->registered_control_types[] = $control; } public function render_control_templates() { if ( $this->branching() ) { $l10n = array( 'locked' => __( '%s is already customizing this changeset. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 'locked_allow_override' => __( '%s is already customizing this changeset. Do you want to take over?' ), ); } else { $l10n = array( 'locked' => __( '%s is already customizing this site. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 'locked_allow_override' => __( '%s is already customizing this site. Do you want to take over?' ), ); } foreach ( $this->registered_control_types as $control_type ) { $control = new $control_type( $this, 'temp', array( 'settings' => array(), ) ); $control->print_template(); } ?> -#export-filters p { - margin: 0 0 1em; -} + -/* Press this styles */ + -.pressthis h4 { - margin: 2em 0 1em; -} - -.pressthis textarea { - width: 100%; - font-size: 1em; -} - -#pressthis-code-wrap { - overflow: auto; -} - -.pressthis-bookmarklet-wrapper { - margin: 20px 0 8px; - vertical-align: top; - position: relative; - z-index: 1; -} - -.pressthis-bookmarklet, -.pressthis-bookmarklet:hover, -.pressthis-bookmarklet:focus, -.pressthis-bookmarklet:active { - display: inline-block; - position: relative; - cursor: move; - color: #2c3338; - background: #dcdcde; - border-radius: 5px; - border: 1px solid #c3c4c7; - font-style: normal; - line-height: 16px; - font-size: 14px; - text-decoration: none; -} - -.pressthis-bookmarklet:active { - outline: none; -} - -.pressthis-bookmarklet:after { - content: ""; - width: 70%; - height: 55%; - z-index: -1; - position: absolute; - left: 10px; - bottom: 9px; - background: transparent; - transform: skew(-20deg) rotate(-6deg); - box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6); -} - -.pressthis-bookmarklet:hover:after { - transform: skew(-20deg) rotate(-9deg); - box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7); -} - -.pressthis-bookmarklet span { - display: inline-block; - margin: 0; - padding: 0 9px 8px 12px; -} + -.pressthis-bookmarklet span:before { - color: #787c82; - font: normal 20px/1 dashicons; - content: "\f157"; - position: relative; - display: inline-block; - top: 4px; - margin-left: 4px; -} + -/* to override the button class being applied */ -.pressthis-js-toggle.button.button { - margin-right: 10px; - padding: 0; - height: auto; - vertical-align: top; -} + + -.pressthis-js-toggle .dashicons { - margin: 5px 7px 6px 8px; - color: #50575e; -} + + + priority === $b->priority ) { return $a->instance_number - $b->instance_number; } else { return $a->priority - $b->priority; } } public function prepare_controls() { $controls = array(); $this->controls = wp_list_sort( $this->controls, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); foreach ( $this->controls as $id => $control ) { if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) { continue; } $this->sections[ $control->section ]->controls[] = $control; $controls[ $id ] = $control; } $this->controls = $controls; $this->sections = wp_list_sort( $this->sections, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $sections = array(); foreach ( $this->sections as $section ) { if ( ! $section->check_capabilities() ) { continue; } $section->controls = wp_list_sort( $section->controls, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ) ); if ( ! $section->panel ) { $sections[ $section->id ] = $section; } else { if ( isset( $this->panels [ $section->panel ] ) ) { $this->panels[ $section->panel ]->sections[ $section->id ] = $section; } } } $this->sections = $sections; $this->panels = wp_list_sort( $this->panels, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $panels = array(); foreach ( $this->panels as $panel ) { if ( ! $panel->check_capabilities() ) { continue; } $panel->sections = wp_list_sort( $panel->sections, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $panels[ $panel->id ] = $panel; } $this->panels = $panels; $this->containers = array_merge( $this->panels, $this->sections ); $this->containers = wp_list_sort( $this->containers, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); } public function enqueue_control_scripts() { foreach ( $this->controls as $control ) { $control->enqueue(); } if ( ! is_multisite() && ( current_user_can( 'install_themes' ) || current_user_can( 'update_themes' ) || current_user_can( 'delete_themes' ) ) ) { wp_enqueue_script( 'updates' ); wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'totals' => wp_get_update_data(), ) ); } } public function is_ios() { return wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ); } public function get_document_title_template() { if ( $this->is_theme_active() ) { $document_title_tmpl = __( 'Customize: %s' ); } else { $document_title_tmpl = __( 'Live Preview: %s' ); } $document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); return $document_title_tmpl; } public function set_preview_url( $preview_url ) { $preview_url = esc_url_raw( $preview_url ); $this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) ); } public function get_preview_url() { if ( empty( $this->preview_url ) ) { $preview_url = home_url( '/' ); } else { $preview_url = $this->preview_url; } return $preview_url; } public function is_cross_domain() { $admin_origin = wp_parse_url( admin_url() ); $home_origin = wp_parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) ); return $cross_domain; } public function get_allowed_urls() { $allowed_urls = array( home_url( '/' ) ); if ( is_ssl() && ! $this->is_cross_domain() ) { $allowed_urls[] = home_url( '/', 'https' ); } $allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) ); return $allowed_urls; } public function get_messenger_channel() { return $this->messenger_channel; } public function set_return_url( $return_url ) { $return_url = esc_url_raw( $return_url ); $return_url = remove_query_arg( wp_removable_query_args(), $return_url ); $return_url = wp_validate_redirect( $return_url ); $this->return_url = $return_url; } public function get_return_url() { global $_registered_pages; $referer = wp_get_referer(); $excluded_referer_basenames = array( 'customize.php', 'wp-login.php' ); if ( $this->return_url ) { $return_url = $this->return_url; } elseif ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) { $return_url = $referer; } elseif ( $this->preview_url ) { $return_url = $this->preview_url; } else { $return_url = home_url( '/' ); } $return_url_basename = wp_basename( parse_url( $this->return_url, PHP_URL_PATH ) ); $return_url_query = parse_url( $this->return_url, PHP_URL_QUERY ); if ( 'themes.php' === $return_url_basename && $return_url_query ) { parse_str( $return_url_query, $query_vars ); if ( isset( $query_vars['page'] ) && ! isset( $_registered_pages[ "appearance_page_{$query_vars['page']}" ] ) ) { $return_url = admin_url( 'themes.php' ); } } return $return_url; } public function set_autofocus( $autofocus ) { $this->autofocus = array_filter( wp_array_slice_assoc( $autofocus, array( 'panel', 'section', 'control' ) ), 'is_string' ); } public function get_autofocus() { return $this->autofocus; } public function get_nonces() { $nonces = array( 'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ), 'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ), 'switch_themes' => wp_create_nonce( 'switch_themes' ), 'dismiss_autosave_or_lock' => wp_create_nonce( 'customize_dismiss_autosave_or_lock' ), 'override_lock' => wp_create_nonce( 'customize_override_changeset_lock' ), 'trash' => wp_create_nonce( 'trash_customize_changeset' ), ); $nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this ); return $nonces; } public function customize_pane_settings() { $login_url = add_query_arg( array( 'interim-login' => 1, 'customize-login' => 1, ), wp_login_url() ); foreach ( array_keys( $this->unsanitized_post_values() ) as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { $setting->dirty = true; } } $autosave_revision_post = null; $autosave_autodraft_post = null; $changeset_post_id = $this->changeset_post_id(); if ( ! $this->saved_starter_content_changeset && ! $this->autosaved() ) { if ( $changeset_post_id ) { if ( is_user_logged_in() ) { $autosave_revision_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); } } else { $autosave_autodraft_posts = $this->get_changeset_posts( array( 'posts_per_page' => 1, 'post_status' => 'auto-draft', 'exclude_restore_dismissed' => true, ) ); if ( ! empty( $autosave_autodraft_posts ) ) { $autosave_autodraft_post = array_shift( $autosave_autodraft_posts ); } } } $current_user_can_publish = current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ); $status_choices = array(); if ( $current_user_can_publish ) { $status_choices[] = array( 'status' => 'publish', 'label' => __( 'Publish' ), ); } $status_choices[] = array( 'status' => 'draft', 'label' => __( 'Save Draft' ), ); if ( $current_user_can_publish ) { $status_choices[] = array( 'status' => 'future', 'label' => _x( 'Schedule', 'customizer changeset action/button label' ), ); } $changeset_post = null; if ( $changeset_post_id ) { $changeset_post = get_post( $changeset_post_id ); } $current_time = current_time( 'mysql', false ); $initial_date = $current_time; if ( $changeset_post ) { $initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID ); if ( $initial_date < $current_time ) { $initial_date = $current_time; } } $lock_user_id = false; if ( $this->changeset_post_id() ) { $lock_user_id = wp_check_post_lock( $this->changeset_post_id() ); } $settings = array( 'changeset' => array( 'uuid' => $this->changeset_uuid(), 'branching' => $this->branching(), 'autosaved' => $this->autosaved(), 'hasAutosaveRevision' => ! empty( $autosave_revision_post ), 'latestAutoDraftUuid' => $autosave_autodraft_post ? $autosave_autodraft_post->post_name : null, 'status' => $changeset_post ? $changeset_post->post_status : '', 'currentUserCanPublish' => $current_user_can_publish, 'publishDate' => $initial_date, 'statusChoices' => $status_choices, 'lockUser' => $lock_user_id ? $this->get_lock_user_data( $lock_user_id ) : null, ), 'initialServerDate' => $current_time, 'dateFormat' => get_option( 'date_format' ), 'timeFormat' => get_option( 'time_format' ), 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), 'initialClientTimestamp' => -1, 'timeouts' => array( 'windowRefresh' => 250, 'changesetAutoSave' => AUTOSAVE_INTERVAL * 1000, 'keepAliveCheck' => 2500, 'reflowPaneContents' => 100, 'previewFrameSensitivity' => 2000, ), 'theme' => array( 'stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active(), '_canInstall' => current_user_can( 'install_themes' ), ), 'url' => array( 'preview' => esc_url_raw( $this->get_preview_url() ), 'return' => esc_url_raw( $this->get_return_url() ), 'parent' => esc_url_raw( admin_url() ), 'activated' => esc_url_raw( home_url( '/' ) ), 'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ), 'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ), 'isCrossDomain' => $this->is_cross_domain(), 'home' => esc_url_raw( home_url( '/' ) ), 'login' => esc_url_raw( $login_url ), ), 'browser' => array( 'mobile' => wp_is_mobile(), 'ios' => $this->is_ios(), ), 'panels' => array(), 'sections' => array(), 'nonce' => $this->get_nonces(), 'autofocus' => $this->get_autofocus(), 'documentTitleTmpl' => $this->get_document_title_template(), 'previewableDevices' => $this->get_previewable_devices(), 'l10n' => array( 'confirmDeleteTheme' => __( 'Are you sure you want to delete this theme?' ), 'themeSearchResults' => __( '%d themes found' ), 'announceThemeCount' => __( 'Displaying %d themes' ), 'announceThemeDetails' => __( 'Showing details for theme: %s' ), ), ); $filesystem_method = get_filesystem_method(); ob_start(); $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); ob_end_clean(); if ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ) { $settings['theme']['_filesystemCredentialsNeeded'] = true; } foreach ( $this->sections() as $id => $section ) { if ( $section->check_capabilities() ) { $settings['sections'][ $id ] = $section->json(); } } foreach ( $this->panels() as $panel_id => $panel ) { if ( $panel->check_capabilities() ) { $settings['panels'][ $panel_id ] = $panel->json(); foreach ( $panel->sections as $section_id => $section ) { if ( $section->check_capabilities() ) { $settings['sections'][ $section_id ] = $section->json(); } } } } ?> + + array( 'label' => __( 'Enter desktop preview mode' ), 'default' => true, ), 'tablet' => array( 'label' => __( 'Enter tablet preview mode' ), ), 'mobile' => array( 'label' => __( 'Enter mobile preview mode' ), ), ); $devices = apply_filters( 'customize_previewable_devices', $devices ); return $devices; } public function register_controls() { $this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array( 'title' => $this->theme()->display( 'Name' ), 'description' => ( '

          ' . __( 'Looking for a theme? You can search or browse the WordPress.org theme directory, install and preview themes, then activate them right here.' ) . '

          ' . '

          ' . __( 'While previewing a new theme, you can continue to tailor things like widgets and menus, and explore theme-specific options.' ) . '

          ' ), 'capability' => 'switch_themes', 'priority' => 0, ) ) ); $this->add_section( new WP_Customize_Themes_Section( $this, 'installed_themes', array( 'title' => __( 'Installed themes' ), 'action' => 'installed', 'capability' => 'switch_themes', 'panel' => 'themes', 'priority' => 0, ) ) ); if ( ! is_multisite() ) { $this->add_section( new WP_Customize_Themes_Section( $this, 'wporg_themes', array( 'title' => __( 'WordPress.org themes' ), 'action' => 'wporg', 'filter_type' => 'remote', 'capability' => 'install_themes', 'panel' => 'themes', 'priority' => 5, ) ) ); } $this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array( 'capability' => 'switch_themes', ) ) ); $this->add_section( 'title_tagline', array( 'title' => __( 'Site Identity' ), 'priority' => 20, ) ); $this->add_setting( 'blogname', array( 'default' => get_option( 'blogname' ), 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'blogname', array( 'label' => __( 'Site Title' ), 'section' => 'title_tagline', ) ); $this->add_setting( 'blogdescription', array( 'default' => get_option( 'blogdescription' ), 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'blogdescription', array( 'label' => __( 'Tagline' ), 'section' => 'title_tagline', ) ); if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { $this->add_setting( 'header_text', array( 'theme_supports' => array( 'custom-logo', 'header-text' ), 'default' => 1, 'sanitize_callback' => 'absint', ) ); $this->add_control( 'header_text', array( 'label' => __( 'Display Site Title and Tagline' ), 'section' => 'title_tagline', 'settings' => 'header_text', 'type' => 'checkbox', ) ); } $this->add_setting( 'site_icon', array( 'type' => 'option', 'capability' => 'manage_options', 'transport' => 'postMessage', ) ); $this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array( 'label' => __( 'Site Icon' ), 'description' => sprintf( '

          ' . __( 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here!' ) . '

          ' . '

          ' . __( 'Site Icons should be square and at least %s pixels.' ) . '

          ', '512 × 512' ), 'section' => 'title_tagline', 'priority' => 60, 'height' => 512, 'width' => 512, ) ) ); $this->add_setting( 'custom_logo', array( 'theme_supports' => array( 'custom-logo' ), 'transport' => 'postMessage', ) ); $custom_logo_args = get_theme_support( 'custom-logo' ); $this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array( 'label' => __( 'Logo' ), 'section' => 'title_tagline', 'priority' => 8, 'height' => isset( $custom_logo_args[0]['height'] ) ? $custom_logo_args[0]['height'] : null, 'width' => isset( $custom_logo_args[0]['width'] ) ? $custom_logo_args[0]['width'] : null, 'flex_height' => isset( $custom_logo_args[0]['flex-height'] ) ? $custom_logo_args[0]['flex-height'] : null, 'flex_width' => isset( $custom_logo_args[0]['flex-width'] ) ? $custom_logo_args[0]['flex-width'] : null, 'button_labels' => array( 'select' => __( 'Select logo' ), 'change' => __( 'Change logo' ), 'remove' => __( 'Remove' ), 'default' => __( 'Default' ), 'placeholder' => __( 'No logo selected' ), 'frame_title' => __( 'Select logo' ), 'frame_button' => __( 'Choose logo' ), ), ) ) ); $this->selective_refresh->add_partial( 'custom_logo', array( 'settings' => array( 'custom_logo' ), 'selector' => '.custom-logo-link', 'render_callback' => array( $this, '_render_custom_logo_partial' ), 'container_inclusive' => true, ) ); $this->add_section( 'colors', array( 'title' => __( 'Colors' ), 'priority' => 40, ) ); $this->add_setting( 'header_textcolor', array( 'theme_supports' => array( 'custom-header', 'header-text' ), 'default' => get_theme_support( 'custom-header', 'default-text-color' ), 'sanitize_callback' => array( $this, '_sanitize_header_textcolor' ), 'sanitize_js_callback' => 'maybe_hash_hex_color', ) ); $this->add_control( 'display_header_text', array( 'settings' => 'header_textcolor', 'label' => __( 'Display Site Title and Tagline' ), 'section' => 'title_tagline', 'type' => 'checkbox', 'priority' => 40, ) ); $this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array( 'label' => __( 'Header Text Color' ), 'section' => 'colors', ) ) ); $this->add_setting( 'background_color', array( 'default' => get_theme_support( 'custom-background', 'default-color' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', ) ); $this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array( 'label' => __( 'Background Color' ), 'section' => 'colors', ) ) ); if ( current_theme_supports( 'custom-header', 'video' ) ) { $title = __( 'Header Media' ); $description = '

          ' . __( 'If you add a video, the image will be used as a fallback while the video loads.' ) . '

          '; $width = absint( get_theme_support( 'custom-header', 'width' ) ); $height = absint( get_theme_support( 'custom-header', 'height' ) ); if ( $width && $height ) { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.' ), '.mp4', sprintf( '%s × %s', $width, $height ) ); } elseif ( $width ) { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.' ), '.mp4', sprintf( '%s', $width ) ); } else { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.' ), '.mp4', sprintf( '%s', $height ) ); } } else { $title = __( 'Header Image' ); $description = ''; $control_description = ''; } $this->add_section( 'header_image', array( 'title' => $title, 'description' => $description, 'theme_supports' => 'custom-header', 'priority' => 60, ) ); $this->add_setting( 'header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'transport' => 'postMessage', 'sanitize_callback' => 'absint', 'validate_callback' => array( $this, '_validate_header_video' ), ) ); $this->add_setting( 'external_header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'transport' => 'postMessage', 'sanitize_callback' => array( $this, '_sanitize_external_header_video' ), 'validate_callback' => array( $this, '_validate_external_header_video' ), ) ); $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array( 'default' => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ), 'theme_supports' => 'custom-header', ) ) ); $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array( 'theme_supports' => 'custom-header', ) ) ); if ( current_theme_supports( 'custom-header', 'video' ) ) { $this->get_setting( 'header_image' )->transport = 'postMessage'; $this->get_setting( 'header_image_data' )->transport = 'postMessage'; } $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'label' => __( 'Header Video' ), 'description' => $control_description, 'section' => 'header_image', 'mime_type' => 'video', 'active_callback' => 'is_header_video_active', ) ) ); $this->add_control( 'external_header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'type' => 'url', 'description' => __( 'Or, enter a YouTube URL:' ), 'section' => 'header_image', 'active_callback' => 'is_header_video_active', ) ); $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); $this->selective_refresh->add_partial( 'custom_header', array( 'selector' => '#wp-custom-header', 'render_callback' => 'the_custom_header_markup', 'settings' => array( 'header_video', 'external_header_video', 'header_image' ), 'container_inclusive' => true, ) ); $this->add_section( 'background_image', array( 'title' => __( 'Background Image' ), 'theme_supports' => 'custom-background', 'priority' => 80, ) ); $this->add_setting( 'background_image', array( 'default' => get_theme_support( 'custom-background', 'default-image' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array( 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ) ); $this->add_control( new WP_Customize_Background_Image_Control( $this ) ); $this->add_setting( 'background_preset', array( 'default' => get_theme_support( 'custom-background', 'default-preset' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( 'background_preset', array( 'label' => _x( 'Preset', 'Background Preset' ), 'section' => 'background_image', 'type' => 'select', 'choices' => array( 'default' => _x( 'Default', 'Default Preset' ), 'fill' => __( 'Fill Screen' ), 'fit' => __( 'Fit to Screen' ), 'repeat' => _x( 'Repeat', 'Repeat Image' ), 'custom' => _x( 'Custom', 'Custom Preset' ), ), ) ); $this->add_setting( 'background_position_x', array( 'default' => get_theme_support( 'custom-background', 'default-position-x' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_setting( 'background_position_y', array( 'default' => get_theme_support( 'custom-background', 'default-position-y' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( new WP_Customize_Background_Position_Control( $this, 'background_position', array( 'label' => __( 'Image Position' ), 'section' => 'background_image', 'settings' => array( 'x' => 'background_position_x', 'y' => 'background_position_y', ), ) ) ); $this->add_setting( 'background_size', array( 'default' => get_theme_support( 'custom-background', 'default-size' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( 'background_size', array( 'label' => __( 'Image Size' ), 'section' => 'background_image', 'type' => 'select', 'choices' => array( 'auto' => _x( 'Original', 'Original Size' ), 'contain' => __( 'Fit to Screen' ), 'cover' => __( 'Fill Screen' ), ), ) ); $this->add_setting( 'background_repeat', array( 'default' => get_theme_support( 'custom-background', 'default-repeat' ), 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), 'theme_supports' => 'custom-background', ) ); $this->add_control( 'background_repeat', array( 'label' => __( 'Repeat Background Image' ), 'section' => 'background_image', 'type' => 'checkbox', ) ); $this->add_setting( 'background_attachment', array( 'default' => get_theme_support( 'custom-background', 'default-attachment' ), 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), 'theme_supports' => 'custom-background', ) ); $this->add_control( 'background_attachment', array( 'label' => __( 'Scroll with Page' ), 'section' => 'background_image', 'type' => 'checkbox', ) ); if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) { foreach ( array( 'color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment' ) as $prop ) { $this->get_setting( 'background_' . $prop )->transport = 'postMessage'; } } $this->add_section( 'static_front_page', array( 'title' => __( 'Homepage Settings' ), 'priority' => 120, 'description' => __( 'You can choose what’s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two Pages. One will become the homepage, and the other will be where your posts are displayed.' ), 'active_callback' => array( $this, 'has_published_pages' ), ) ); $this->add_setting( 'show_on_front', array( 'default' => get_option( 'show_on_front' ), 'capability' => 'manage_options', 'type' => 'option', ) ); $this->add_control( 'show_on_front', array( 'label' => __( 'Your homepage displays' ), 'section' => 'static_front_page', 'type' => 'radio', 'choices' => array( 'posts' => __( 'Your latest posts' ), 'page' => __( 'A static page' ), ), ) ); $this->add_setting( 'page_on_front', array( 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'page_on_front', array( 'label' => __( 'Homepage' ), 'section' => 'static_front_page', 'type' => 'dropdown-pages', 'allow_addition' => true, ) ); $this->add_setting( 'page_for_posts', array( 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'page_for_posts', array( 'label' => __( 'Posts page' ), 'section' => 'static_front_page', 'type' => 'dropdown-pages', 'allow_addition' => true, ) ); $section_description = '

          '; $section_description .= __( 'Add your own CSS code here to customize the appearance and layout of your site.' ); $section_description .= sprintf( ' %2$s %3$s', esc_url( __( 'https://codex.wordpress.org/CSS' ) ), __( 'Learn more about CSS' ), __( '(opens in a new tab)' ) ); $section_description .= '

          '; $section_description .= '

          ' . __( 'When using a keyboard to navigate:' ) . '

          '; $section_description .= '
            '; $section_description .= '
          • ' . __( 'In the editing area, the Tab key enters a tab character.' ) . '
          • '; $section_description .= '
          • ' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '
          • '; $section_description .= '
          • ' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '
          • '; $section_description .= '
          '; if ( 'false' !== wp_get_current_user()->syntax_highlighting ) { $section_description .= '

          '; $section_description .= sprintf( __( 'The edit field automatically highlights code syntax. You can disable this in your user profile%3$s to work in plain text mode.' ), esc_url( get_edit_profile_url() ), 'class="external-link" target="_blank"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); $section_description .= '

          '; } $section_description .= '

          '; $section_description .= ''; $section_description .= '

          '; $this->add_section( 'custom_css', array( 'title' => __( 'Additional CSS' ), 'priority' => 200, 'description_hidden' => true, 'description' => $section_description, ) ); $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 'capability' => 'edit_css', 'default' => '', ) ); $this->add_setting( $custom_css_setting ); $this->add_control( new WP_Customize_Code_Editor_Control( $this, 'custom_css', array( 'label' => __( 'CSS code' ), 'section' => 'custom_css', 'settings' => array( 'default' => $custom_css_setting->id ), 'code_type' => 'text/css', 'input_attrs' => array( 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', ), ) ) ); } public function has_published_pages() { $setting = $this->get_setting( 'nav_menus_created_posts' ); if ( $setting ) { foreach ( $setting->value() as $post_id ) { if ( 'page' === get_post_type( $post_id ) ) { return true; } } } return 0 !== count( get_pages( array( 'number' => 1 ) ) ); } public function register_dynamic_settings() { $setting_ids = array_keys( $this->unsanitized_post_values() ); $this->add_dynamic_settings( $setting_ids ); } public function handle_load_themes_request() { check_ajax_referer( 'switch_themes', 'nonce' ); if ( ! current_user_can( 'switch_themes' ) ) { wp_die( -1 ); } if ( empty( $_POST['theme_action'] ) ) { wp_send_json_error( 'missing_theme_action' ); } $theme_action = sanitize_key( $_POST['theme_action'] ); $themes = array(); $args = array(); if ( ! array_key_exists( 'search', $_POST ) ) { $args['search'] = ''; } else { $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) ); } if ( ! array_key_exists( 'tags', $_POST ) ) { $args['tag'] = ''; } else { $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) ); } if ( ! array_key_exists( 'page', $_POST ) ) { $args['page'] = 1; } else { $args['page'] = absint( $_POST['page'] ); } require_once ABSPATH . 'wp-admin/includes/theme.php'; if ( 'installed' === $theme_action ) { $themes = array( 'themes' => array() ); foreach ( wp_prepare_themes_for_js() as $theme ) { $theme['type'] = 'installed'; $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] ); $themes['themes'][] = $theme; } } elseif ( 'wporg' === $theme_action ) { if ( ! current_user_can( 'install_themes' ) ) { wp_die( -1 ); } $wporg_args = array( 'per_page' => 100, 'fields' => array( 'reviews_url' => true, ), ); $args = array_merge( $wporg_args, $args ); if ( '' === $args['search'] && '' === $args['tag'] ) { $args['browse'] = 'new'; } $themes = themes_api( 'query_themes', $args ); if ( is_wp_error( $themes ) ) { wp_send_json_error(); } $themes_allowedtags = array_fill_keys( array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ), array() ); $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true ); $themes_allowedtags['acronym']['title'] = true; $themes_allowedtags['abbr']['title'] = true; $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true ); $installed_themes = array(); $wp_themes = wp_get_themes(); foreach ( $wp_themes as $theme ) { $installed_themes[] = $theme->get_stylesheet(); } $update_php = network_admin_url( 'update.php?action=install-theme' ); foreach ( $themes->themes as &$theme ) { $theme->install_url = add_query_arg( array( 'theme' => $theme->slug, '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), ), $update_php ); $theme->name = wp_kses( $theme->name, $themes_allowedtags ); $theme->version = wp_kses( $theme->version, $themes_allowedtags ); $theme->description = wp_kses( $theme->description, $themes_allowedtags ); $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false, ) ); $theme->num_ratings = number_format_i18n( $theme->num_ratings ); $theme->preview_url = set_url_scheme( $theme->preview_url ); if ( in_array( $theme->slug, $installed_themes, true ) ) { $theme->type = 'installed'; } else { $theme->type = $theme_action; } $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug ); $theme->id = $theme->slug; $theme->screenshot = array( $theme->screenshot_url ); $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); if ( isset( $theme->parent ) ) { $theme->parent = $theme->parent['slug']; } else { $theme->parent = false; } unset( $theme->slug ); unset( $theme->screenshot_url ); unset( $theme->author ); } } $themes = apply_filters( 'customize_load_themes', $themes, $args, $this ); wp_send_json_success( $themes ); } public function _sanitize_header_textcolor( $color ) { if ( 'blank' === $color ) { return 'blank'; } $color = sanitize_hex_color_no_hash( $color ); if ( empty( $color ) ) { $color = get_theme_support( 'custom-header', 'default-text-color' ); } return $color; } public function _sanitize_background_setting( $value, $setting ) { if ( 'background_repeat' === $setting->id ) { if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) ); } } elseif ( 'background_attachment' === $setting->id ) { if ( ! in_array( $value, array( 'fixed', 'scroll' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) ); } } elseif ( 'background_position_x' === $setting->id ) { if ( ! in_array( $value, array( 'left', 'center', 'right' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background position X.' ) ); } } elseif ( 'background_position_y' === $setting->id ) { if ( ! in_array( $value, array( 'top', 'center', 'bottom' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background position Y.' ) ); } } elseif ( 'background_size' === $setting->id ) { if ( ! in_array( $value, array( 'auto', 'contain', 'cover' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) ); } } elseif ( 'background_preset' === $setting->id ) { if ( ! in_array( $value, array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) ); } } elseif ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) { $value = empty( $value ) ? '' : esc_url_raw( $value ); } else { return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) ); } return $value; } public function export_header_video_settings( $response, $selective_refresh, $partials ) { if ( isset( $partials['custom_header'] ) ) { $response['custom_header_settings'] = get_header_video_settings(); } return $response; } public function _validate_header_video( $validity, $value ) { $video = get_attached_file( absint( $value ) ); if ( $video ) { $size = filesize( $video ); if ( $size > 8 * MB_IN_BYTES ) { $validity->add( 'size_too_large', __( 'This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.' ) ); } if ( '.mp4' !== substr( $video, -4 ) && '.mov' !== substr( $video, -4 ) ) { $validity->add( 'invalid_file_type', sprintf( __( 'Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ), '.mp4', '.mov' ) ); } } return $validity; } public function _validate_external_header_video( $validity, $value ) { $video = esc_url_raw( $value ); if ( $video ) { if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) { $validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) ); } } return $validity; } public function _sanitize_external_header_video( $value ) { return esc_url_raw( trim( $value ) ); } public function _render_custom_logo_partial() { return get_custom_logo(); } } '; do_action( 'rss_tag_pre', 'rdf' ); ?> + +> + + <?php wp_title_rss(); ?> + + + + + + + + + + 2000-01-01T12:00+00:00 + + + + + + + + + + + + <?php the_title_rss(); ?> + -/*------------------------------------------------------------------------------ - 20.0 - Settings -------------------------------------------------------------------------------*/ + ]]> + post_date_gmt, false ); ?> + -.timezone-info code { - white-space: nowrap; -} + + ]]> + + ]]> + ]]> + -.defaultavatarpicker .avatar { - margin: 2px 0; - vertical-align: middle; + + + + +add_rule( $regex, $query, $after ); } function add_rewrite_tag( $tag, $regex, $query = '' ) { if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) { return; } global $wp_rewrite, $wp; if ( empty( $query ) ) { $qv = trim( $tag, '%' ); $wp->add_query_var( $qv ); $query = $qv . '='; } $wp_rewrite->add_rewrite_tag( $tag, $regex, $query ); } function remove_rewrite_tag( $tag ) { global $wp_rewrite; $wp_rewrite->remove_rewrite_tag( $tag ); } function add_permastruct( $name, $struct, $args = array() ) { global $wp_rewrite; if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } if ( func_num_args() == 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } $wp_rewrite->add_permastruct( $name, $struct, $args ); } function remove_permastruct( $name ) { global $wp_rewrite; $wp_rewrite->remove_permastruct( $name ); } function add_feed( $feedname, $function ) { global $wp_rewrite; if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) { $wp_rewrite->feeds[] = $feedname; } $hook = 'do_feed_' . $feedname; remove_action( $hook, $hook ); add_action( $hook, $function, 10, 2 ); return $hook; } function flush_rewrite_rules( $hard = true ) { global $wp_rewrite; if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) { $wp_rewrite->flush_rules( $hard ); } } function add_rewrite_endpoint( $name, $places, $query_var = true ) { global $wp_rewrite; $wp_rewrite->add_endpoint( $name, $places, $query_var ); } function _wp_filter_taxonomy_base( $base ) { if ( ! empty( $base ) ) { $base = preg_replace( '|^/index\.php/|', '', $base ); $base = trim( $base, '/' ); } return $base; } function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) { return $query_vars; } $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs, true ); if ( false === $postname_index ) { return $query_vars; } $compare = ''; if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) { $compare = 'year'; } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) { $compare = 'monthnum'; } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) { $compare = 'day'; } if ( ! $compare ) { return $query_vars; } $value = $query_vars[ $compare ]; $post = get_page_by_path( $value, OBJECT, 'post' ); if ( ! ( $post instanceof WP_Post ) ) { return $query_vars; } if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) { if ( (int) $query_vars['year'] !== (int) $matches[1] ) { return $query_vars; } if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) { return $query_vars; } } $maybe_page = ''; if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) { $maybe_page = $query_vars['monthnum']; } elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) { $maybe_page = $query_vars['day']; } $maybe_page = (int) trim( $maybe_page, '/' ); $post_page_count = substr_count( $post->post_content, '' ) + 1; if ( 1 === $post_page_count && $maybe_page ) { return $query_vars; } if ( $post_page_count > 1 && $maybe_page > $post_page_count ) { return $query_vars; } if ( '' !== $maybe_page ) { $query_vars['page'] = (int) $maybe_page; } unset( $query_vars['year'] ); unset( $query_vars['monthnum'] ); unset( $query_vars['day'] ); $query_vars['name'] = $post->post_name; return $query_vars; } function url_to_postid( $url ) { global $wp_rewrite; $url = apply_filters( 'url_to_postid', $url ); $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) ); $home_url_host = str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); if ( $url_host && $url_host !== $home_url_host ) { return 0; } if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) { $id = absint( $values[2] ); if ( $id ) { return $id; } } $url_split = explode( '#', $url ); $url = $url_split[0]; $url_split = explode( '?', $url ); $url = $url_split[0]; $scheme = parse_url( home_url(), PHP_URL_SCHEME ); $url = set_url_scheme( $url, $scheme ); if ( false !== strpos( home_url(), '://www.' ) && false === strpos( $url, '://www.' ) ) { $url = str_replace( '://', '://www.', $url ); } if ( false === strpos( home_url(), '://www.' ) ) { $url = str_replace( '://www.', '://', $url ); } if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) { $page_on_front = get_option( 'page_on_front' ); if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) { return (int) $page_on_front; } } $rewrite = $wp_rewrite->wp_rewrite_rules(); if ( empty( $rewrite ) ) { return 0; } if ( ! $wp_rewrite->using_index_permalinks() ) { $url = str_replace( $wp_rewrite->index . '/', '', $url ); } if ( false !== strpos( trailingslashit( $url ), home_url( '/' ) ) ) { $url = str_replace( home_url(), '', $url ); } else { $home_path = parse_url( home_url( '/' ) ); $home_path = isset( $home_path['path'] ) ? $home_path['path'] : ''; $url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) ); } $url = trim( $url, '/' ); $request = $url; $post_type_query_vars = array(); foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { if ( ! empty( $t->query_var ) ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } $request_match = $request; foreach ( (array) $rewrite as $match => $query ) { if ( ! empty( $url ) && ( $url != $request ) && ( strpos( $match, $url ) === 0 ) ) { $request_match = $url . '/' . $request; } if ( preg_match( "#^$match#", $request_match, $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } $query = preg_replace( '!^.+\?!', '', $query ); $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); global $wp; parse_str( $query, $query_vars ); $query = array(); foreach ( (array) $query_vars as $key => $value ) { if ( in_array( (string) $key, $wp->public_query_vars, true ) ) { $query[ $key ] = $value; if ( isset( $post_type_query_vars[ $key ] ) ) { $query['post_type'] = $post_type_query_vars[ $key ]; $query['name'] = $value; } } } $query = wp_resolve_numeric_slug_conflicts( $query ); $query = new WP_Query( $query ); if ( ! empty( $query->posts ) && $query->is_singular ) { return $query->post->ID; } else { return 0; } } } return 0; } 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return get_option( $deprecated_keys[ $option ], $default ); } $pre = apply_filters( "pre_option_{$option}", false, $option, $default ); if ( false !== $pre ) { return $pre; } if ( defined( 'WP_SETUP_CONFIG' ) ) { return false; } $passed_default = func_num_args() > 1; if ( ! wp_installing() ) { $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( isset( $notoptions[ $option ] ) ) { return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } $alloptions = wp_load_alloptions(); if ( isset( $alloptions[ $option ] ) ) { $value = $alloptions[ $option ]; } else { $value = wp_cache_get( $option, 'options' ); if ( false === $value ) { $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); if ( is_object( $row ) ) { $value = $row->option_value; wp_cache_add( $option, $value, 'options' ); } else { if ( ! is_array( $notoptions ) ) { $notoptions = array(); } $notoptions[ $option ] = true; wp_cache_set( 'notoptions', $notoptions, 'options' ); return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } } } } else { $suppress = $wpdb->suppress_errors(); $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); $wpdb->suppress_errors( $suppress ); if ( is_object( $row ) ) { $value = $row->option_value; } else { return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } } if ( 'home' === $option && '' === $value ) { return get_option( 'siteurl' ); } if ( in_array( $option, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) { $value = untrailingslashit( $value ); } return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option ); } function wp_protect_special_option( $option ) { if ( 'alloptions' === $option || 'notoptions' === $option ) { wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); } } function form_option( $option ) { echo esc_attr( get_option( $option ) ); } function wp_load_alloptions( $force_cache = false ) { global $wpdb; if ( ! wp_installing() || ! is_multisite() ) { $alloptions = wp_cache_get( 'alloptions', 'options', $force_cache ); } else { $alloptions = false; } if ( ! $alloptions ) { $suppress = $wpdb->suppress_errors(); $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ); if ( ! $alloptions_db ) { $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); } $wpdb->suppress_errors( $suppress ); $alloptions = array(); foreach ( (array) $alloptions_db as $o ) { $alloptions[ $o->option_name ] = $o->option_value; } if ( ! wp_installing() || ! is_multisite() ) { $alloptions = apply_filters( 'pre_cache_alloptions', $alloptions ); wp_cache_add( 'alloptions', $alloptions, 'options' ); } } return apply_filters( 'alloptions', $alloptions ); } function wp_load_core_site_options( $network_id = null ) { global $wpdb; if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) { return; } if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $core_options = array( 'site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); $core_options_in = "'" . implode( "', '", $core_options ) . "'"; $options = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) ); $data = array(); foreach ( $options as $option ) { $key = $option->meta_key; $cache_key = "{$network_id}:$key"; $option->meta_value = maybe_unserialize( $option->meta_value ); $data[ $cache_key ] = $option->meta_value; } wp_cache_set_multiple( $data, 'site-options' ); } function update_option( $option, $value, $autoload = null ) { global $wpdb; if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return update_option( $deprecated_keys[ $option ], $value, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); $old_value = get_option( $option ); $value = apply_filters( "pre_update_option_{$option}", $value, $old_value, $option ); $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) { return false; } if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) { if ( null === $autoload ) { $autoload = 'yes'; } return add_option( $option, $value, '', $autoload ); } $serialized_value = maybe_serialize( $value ); do_action( 'update_option', $option, $old_value, $value ); $update_args = array( 'option_value' => $serialized_value, ); if ( null !== $autoload ) { $update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; } $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); if ( ! $result ) { return false; } $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } if ( ! wp_installing() ) { $alloptions = wp_load_alloptions( true ); if ( isset( $alloptions[ $option ] ) ) { $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } do_action( "update_option_{$option}", $old_value, $value, $option ); do_action( 'updated_option', $option, $old_value, $value ); return true; } function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.3.0' ); } if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return add_option( $deprecated_keys[ $option ], $value, $deprecated, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) ) { return false; } } $serialized_value = maybe_serialize( $value ); $autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; do_action( 'add_option', $option, $value ); $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) ); if ( ! $result ) { return false; } if ( ! wp_installing() ) { if ( 'yes' === $autoload ) { $alloptions = wp_load_alloptions( true ); $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } do_action( "add_option_{$option}", $option, $value ); do_action( 'added_option', $option, $value ); return true; } function delete_option( $option ) { global $wpdb; if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } wp_protect_special_option( $option ); $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) ); if ( is_null( $row ) ) { return false; } do_action( 'delete_option', $option ); $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); if ( ! wp_installing() ) { if ( 'yes' === $row->autoload ) { $alloptions = wp_load_alloptions( true ); if ( is_array( $alloptions ) && isset( $alloptions[ $option ] ) ) { unset( $alloptions[ $option ] ); wp_cache_set( 'alloptions', $alloptions, 'options' ); } } else { wp_cache_delete( $option, 'options' ); } } if ( $result ) { do_action( "delete_option_{$option}", $option ); do_action( 'deleted_option', $option ); return true; } return false; } function delete_transient( $transient ) { do_action( "delete_transient_{$transient}", $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_delete( $transient, 'transient' ); } else { $option_timeout = '_transient_timeout_' . $transient; $option = '_transient_' . $transient; $result = delete_option( $option ); if ( $result ) { delete_option( $option_timeout ); } } if ( $result ) { do_action( 'deleted_transient', $transient ); } return $result; } function get_transient( $transient ) { $pre = apply_filters( "pre_transient_{$transient}", false, $transient ); if ( false !== $pre ) { return $pre; } if ( wp_using_ext_object_cache() || wp_installing() ) { $value = wp_cache_get( $transient, 'transient' ); } else { $transient_option = '_transient_' . $transient; if ( ! wp_installing() ) { $alloptions = wp_load_alloptions(); if ( ! isset( $alloptions[ $transient_option ] ) ) { $transient_timeout = '_transient_timeout_' . $transient; $timeout = get_option( $transient_timeout ); if ( false !== $timeout && $timeout < time() ) { delete_option( $transient_option ); delete_option( $transient_timeout ); $value = false; } } } if ( ! isset( $value ) ) { $value = get_option( $transient_option ); } } return apply_filters( "transient_{$transient}", $value, $transient ); } function set_transient( $transient, $value, $expiration = 0 ) { $expiration = (int) $expiration; $value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient ); $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_set( $transient, $value, 'transient', $expiration ); } else { $transient_timeout = '_transient_timeout_' . $transient; $transient_option = '_transient_' . $transient; if ( false === get_option( $transient_option ) ) { $autoload = 'yes'; if ( $expiration ) { $autoload = 'no'; add_option( $transient_timeout, time() + $expiration, '', 'no' ); } $result = add_option( $transient_option, $value, '', $autoload ); } else { $update = true; if ( $expiration ) { if ( false === get_option( $transient_timeout ) ) { delete_option( $transient_option ); add_option( $transient_timeout, time() + $expiration, '', 'no' ); $result = add_option( $transient_option, $value, '', 'no' ); $update = false; } else { update_option( $transient_timeout, time() + $expiration ); } } if ( $update ) { $result = update_option( $transient_option, $value ); } } } if ( $result ) { do_action( "set_transient_{$transient}", $value, $expiration, $transient ); do_action( 'setted_transient', $transient, $value, $expiration ); } return $result; } function delete_expired_transients( $force_db = false ) { global $wpdb; if ( ! $force_db && wp_using_ext_object_cache() ) { return; } $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b + WHERE a.option_name LIKE %s + AND a.option_name NOT LIKE %s + AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) + AND b.option_value < %d", $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', time() ) ); if ( ! is_multisite() ) { $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b + WHERE a.option_name LIKE %s + AND a.option_name NOT LIKE %s + AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) + AND b.option_value < %d", $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', time() ) ); } elseif ( is_multisite() && is_main_site() && is_main_network() ) { $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->sitemeta} a, {$wpdb->sitemeta} b + WHERE a.meta_key LIKE %s + AND a.meta_key NOT LIKE %s + AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) ) + AND b.meta_value < %d", $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', time() ) ); } } function wp_user_settings() { if ( ! is_admin() || wp_doing_ajax() ) { return; } $user_id = get_current_user_id(); if ( ! $user_id ) { return; } if ( ! is_user_member_of_blog() ) { return; } $settings = (string) get_user_option( 'user-settings', $user_id ); if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) { $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] ); if ( $cookie == $settings ) { return; } $last_saved = (int) get_user_option( 'user-settings-time', $user_id ); $current = isset( $_COOKIE[ 'wp-settings-time-' . $user_id ] ) ? preg_replace( '/[^0-9]/', '', $_COOKIE[ 'wp-settings-time-' . $user_id ] ) : 0; if ( $current > $last_saved ) { update_user_option( $user_id, 'user-settings', $cookie, false ); update_user_option( $user_id, 'user-settings-time', time() - 5, false ); return; } } $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) ); setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); $_COOKIE[ 'wp-settings-' . $user_id ] = $settings; } function get_user_setting( $name, $default = false ) { $all_user_settings = get_all_user_settings(); return isset( $all_user_settings[ $name ] ) ? $all_user_settings[ $name ] : $default; } function set_user_setting( $name, $value ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $all_user_settings[ $name ] = $value; return wp_set_all_user_settings( $all_user_settings ); } function delete_user_setting( $names ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $names = (array) $names; $deleted = false; foreach ( $names as $name ) { if ( isset( $all_user_settings[ $name ] ) ) { unset( $all_user_settings[ $name ] ); $deleted = true; } } if ( $deleted ) { return wp_set_all_user_settings( $all_user_settings ); } return false; } function get_all_user_settings() { global $_updated_user_settings; $user_id = get_current_user_id(); if ( ! $user_id ) { return array(); } if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) { return $_updated_user_settings; } $user_settings = array(); if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) { $cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] ); if ( strpos( $cookie, '=' ) ) { parse_str( $cookie, $user_settings ); } } else { $option = get_user_option( 'user-settings', $user_id ); if ( $option && is_string( $option ) ) { parse_str( $option, $user_settings ); } } $_updated_user_settings = $user_settings; return $user_settings; } function wp_set_all_user_settings( $user_settings ) { global $_updated_user_settings; $user_id = get_current_user_id(); if ( ! $user_id ) { return false; } if ( ! is_user_member_of_blog() ) { return; } $settings = ''; foreach ( $user_settings as $name => $value ) { $_name = preg_replace( '/[^A-Za-z0-9_-]+/', '', $name ); $_value = preg_replace( '/[^A-Za-z0-9_-]+/', '', $value ); if ( ! empty( $_name ) ) { $settings .= $_name . '=' . $_value . '&'; } } $settings = rtrim( $settings, '&' ); parse_str( $settings, $_updated_user_settings ); update_user_option( $user_id, 'user-settings', $settings, false ); update_user_option( $user_id, 'user-settings-time', time(), false ); return true; } function delete_all_user_settings() { $user_id = get_current_user_id(); if ( ! $user_id ) { return; } update_user_option( $user_id, 'user-settings', '', false ); setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); } function get_site_option( $option, $default = false, $deprecated = true ) { return get_network_option( null, $option, $default ); } function add_site_option( $option, $value ) { return add_network_option( null, $option, $value ); } function delete_site_option( $option ) { return delete_network_option( null, $option ); } function update_site_option( $option, $value ) { return update_network_option( null, $option, $value ); } function get_network_option( $network_id, $option, $default = false ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } $pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default ); if ( false !== $pre ) { return $pre; } $notoptions_key = "$network_id:notoptions"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { return apply_filters( "default_site_option_{$option}", $default, $option, $network_id ); } if ( ! is_multisite() ) { $default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); $value = get_option( $option, $default ); } else { $cache_key = "$network_id:$option"; $value = wp_cache_get( $cache_key, 'site-options' ); if ( ! isset( $value ) || false === $value ) { $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); if ( is_object( $row ) ) { $value = $row->meta_value; $value = maybe_unserialize( $value ); wp_cache_set( $cache_key, $value, 'site-options' ); } else { if ( ! is_array( $notoptions ) ) { $notoptions = array(); } $notoptions[ $option ] = true; wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); $value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); } } } if ( ! is_array( $notoptions ) ) { $notoptions = array(); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } return apply_filters( "site_option_{$option}", $value, $option, $network_id ); } function add_network_option( $network_id, $option, $value ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } wp_protect_special_option( $option ); $value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id ); $notoptions_key = "$network_id:notoptions"; if ( ! is_multisite() ) { $result = add_option( $option, $value, '', 'no' ); } else { $cache_key = "$network_id:$option"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { if ( false !== get_network_option( $network_id, $option, false ) ) { return false; } } $value = sanitize_option( $option, $value ); $serialized_value = maybe_serialize( $value ); $result = $wpdb->insert( $wpdb->sitemeta, array( 'site_id' => $network_id, 'meta_key' => $option, 'meta_value' => $serialized_value, ) ); if ( ! $result ) { return false; } wp_cache_set( $cache_key, $value, 'site-options' ); $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } } if ( $result ) { do_action( "add_site_option_{$option}", $option, $value, $network_id ); do_action( 'add_site_option', $option, $value, $network_id ); return true; } return false; } function delete_network_option( $network_id, $option ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } do_action( "pre_delete_site_option_{$option}", $option, $network_id ); if ( ! is_multisite() ) { $result = delete_option( $option ); } else { $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); if ( is_null( $row ) || ! $row->meta_id ) { return false; } $cache_key = "$network_id:$option"; wp_cache_delete( $cache_key, 'site-options' ); $result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $network_id, ) ); } if ( $result ) { do_action( "delete_site_option_{$option}", $option, $network_id ); do_action( 'delete_site_option', $option, $network_id ); return true; } return false; } function update_network_option( $network_id, $option, $value ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } wp_protect_special_option( $option ); $old_value = get_network_option( $network_id, $option, false ); $value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id ); if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) { return false; } if ( false === $old_value ) { return add_network_option( $network_id, $option, $value ); } $notoptions_key = "$network_id:notoptions"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } if ( ! is_multisite() ) { $result = update_option( $option, $value, 'no' ); } else { $value = sanitize_option( $option, $value ); $serialized_value = maybe_serialize( $value ); $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option, ) ); if ( $result ) { $cache_key = "$network_id:$option"; wp_cache_set( $cache_key, $value, 'site-options' ); } } if ( $result ) { do_action( "update_site_option_{$option}", $option, $value, $old_value, $network_id ); do_action( 'update_site_option', $option, $value, $old_value, $network_id ); return true; } return false; } function delete_site_transient( $transient ) { do_action( "delete_site_transient_{$transient}", $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_delete( $transient, 'site-transient' ); } else { $option_timeout = '_site_transient_timeout_' . $transient; $option = '_site_transient_' . $transient; $result = delete_site_option( $option ); if ( $result ) { delete_site_option( $option_timeout ); } } if ( $result ) { do_action( 'deleted_site_transient', $transient ); } return $result; } function get_site_transient( $transient ) { $pre = apply_filters( "pre_site_transient_{$transient}", false, $transient ); if ( false !== $pre ) { return $pre; } if ( wp_using_ext_object_cache() || wp_installing() ) { $value = wp_cache_get( $transient, 'site-transient' ); } else { $no_timeout = array( 'update_core', 'update_plugins', 'update_themes' ); $transient_option = '_site_transient_' . $transient; if ( ! in_array( $transient, $no_timeout, true ) ) { $transient_timeout = '_site_transient_timeout_' . $transient; $timeout = get_site_option( $transient_timeout ); if ( false !== $timeout && $timeout < time() ) { delete_site_option( $transient_option ); delete_site_option( $transient_timeout ); $value = false; } } if ( ! isset( $value ) ) { $value = get_site_option( $transient_option ); } } return apply_filters( "site_transient_{$transient}", $value, $transient ); } function set_site_transient( $transient, $value, $expiration = 0 ) { $value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient ); $expiration = (int) $expiration; $expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); } else { $transient_timeout = '_site_transient_timeout_' . $transient; $option = '_site_transient_' . $transient; if ( false === get_site_option( $option ) ) { if ( $expiration ) { add_site_option( $transient_timeout, time() + $expiration ); } $result = add_site_option( $option, $value ); } else { if ( $expiration ) { update_site_option( $transient_timeout, time() + $expiration ); } $result = update_site_option( $option, $value ); } } if ( $result ) { do_action( "set_site_transient_{$transient}", $value, $expiration, $transient ); do_action( 'setted_site_transient', $transient, $value, $expiration ); } return $result; } function register_initial_settings() { register_setting( 'general', 'blogname', array( 'show_in_rest' => array( 'name' => 'title', ), 'type' => 'string', 'description' => __( 'Site title.' ), ) ); register_setting( 'general', 'blogdescription', array( 'show_in_rest' => array( 'name' => 'description', ), 'type' => 'string', 'description' => __( 'Site tagline.' ), ) ); if ( ! is_multisite() ) { register_setting( 'general', 'siteurl', array( 'show_in_rest' => array( 'name' => 'url', 'schema' => array( 'format' => 'uri', ), ), 'type' => 'string', 'description' => __( 'Site URL.' ), ) ); } if ( ! is_multisite() ) { register_setting( 'general', 'admin_email', array( 'show_in_rest' => array( 'name' => 'email', 'schema' => array( 'format' => 'email', ), ), 'type' => 'string', 'description' => __( 'This address is used for admin purposes, like new user notification.' ), ) ); } register_setting( 'general', 'timezone_string', array( 'show_in_rest' => array( 'name' => 'timezone', ), 'type' => 'string', 'description' => __( 'A city in the same timezone as you.' ), ) ); register_setting( 'general', 'date_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A date format for all date strings.' ), ) ); register_setting( 'general', 'time_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A time format for all time strings.' ), ) ); register_setting( 'general', 'start_of_week', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'A day number of the week that the week should start on.' ), ) ); register_setting( 'general', 'WPLANG', array( 'show_in_rest' => array( 'name' => 'language', ), 'type' => 'string', 'description' => __( 'WordPress locale code.' ), 'default' => 'en_US', ) ); register_setting( 'writing', 'use_smilies', array( 'show_in_rest' => true, 'type' => 'boolean', 'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ), 'default' => true, ) ); register_setting( 'writing', 'default_category', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Default post category.' ), ) ); register_setting( 'writing', 'default_post_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'Default post format.' ), ) ); register_setting( 'reading', 'posts_per_page', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Blog pages show at most.' ), 'default' => 10, ) ); register_setting( 'reading', 'show_on_front', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'What to show on the front page' ), ) ); register_setting( 'reading', 'page_on_front', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should be displayed on the front page' ), ) ); register_setting( 'reading', 'page_for_posts', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should display the latest posts' ), ) ); register_setting( 'discussion', 'default_ping_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ), ) ); register_setting( 'discussion', 'default_comment_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow people to submit comments on new posts.' ), ) ); } function register_setting( $option_group, $option_name, $args = array() ) { global $new_allowed_options, $wp_registered_settings; $GLOBALS['new_whitelist_options'] = &$new_allowed_options; $defaults = array( 'type' => 'string', 'group' => $option_group, 'description' => '', 'sanitize_callback' => null, 'show_in_rest' => false, ); if ( is_callable( $args ) ) { $args = array( 'sanitize_callback' => $args, ); } $args = apply_filters( 'register_setting_args', $args, $defaults, $option_group, $option_name ); $args = wp_parse_args( $args, $defaults ); if ( false !== $args['show_in_rest'] && 'array' === $args['type'] && ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering an "array" setting to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.4.0' ); } if ( ! is_array( $wp_registered_settings ) ) { $wp_registered_settings = array(); } if ( 'misc' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $option_group = 'general'; } if ( 'privacy' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $option_group = 'reading'; } $new_allowed_options[ $option_group ][] = $option_name; if ( ! empty( $args['sanitize_callback'] ) ) { add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] ); } if ( array_key_exists( 'default', $args ) ) { add_filter( "default_option_{$option_name}", 'filter_default_option', 10, 3 ); } do_action( 'register_setting', $option_group, $option_name, $args ); $wp_registered_settings[ $option_name ] = $args; } function unregister_setting( $option_group, $option_name, $deprecated = '' ) { global $new_allowed_options, $wp_registered_settings; $GLOBALS['new_whitelist_options'] = &$new_allowed_options; if ( 'misc' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $option_group = 'general'; } if ( 'privacy' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $option_group = 'reading'; } $pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true ); if ( false !== $pos ) { unset( $new_allowed_options[ $option_group ][ $pos ] ); } if ( '' !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.7.0', sprintf( __( '%1$s is deprecated. The callback from %2$s is used instead.' ), '$sanitize_callback', 'register_setting()' ) ); remove_filter( "sanitize_option_{$option_name}", $deprecated ); } if ( isset( $wp_registered_settings[ $option_name ] ) ) { if ( ! empty( $wp_registered_settings[ $option_name ]['sanitize_callback'] ) ) { remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] ); } if ( array_key_exists( 'default', $wp_registered_settings[ $option_name ] ) ) { remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 ); } do_action( 'unregister_setting', $option_group, $option_name ); unset( $wp_registered_settings[ $option_name ] ); } } function get_registered_settings() { global $wp_registered_settings; if ( ! is_array( $wp_registered_settings ) ) { return array(); } return $wp_registered_settings; } function filter_default_option( $default, $option, $passed_default ) { if ( $passed_default ) { return $default; } $registered = get_registered_settings(); if ( empty( $registered[ $option ] ) ) { return $default; } return $registered[ $option ]['default']; } add_filter( $hook_name, $callback, $priority, $accepted_args ); return true; } function apply_filters( $hook_name, $value, ...$args ) { global $wp_filter, $wp_current_filter; if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $value; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } array_unshift( $args, $value ); $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args ); array_pop( $wp_current_filter ); return $filtered; } function apply_filters_ref_array( $hook_name, $args ) { global $wp_filter, $wp_current_filter; if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $args[0]; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args ); array_pop( $wp_current_filter ); return $filtered; } function has_filter( $hook_name, $callback = false ) { global $wp_filter; if ( ! isset( $wp_filter[ $hook_name ] ) ) { return false; } return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback ); } function remove_filter( $hook_name, $callback, $priority = 10 ) { global $wp_filter; $r = false; if ( isset( $wp_filter[ $hook_name ] ) ) { $r = $wp_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority ); if ( ! $wp_filter[ $hook_name ]->callbacks ) { unset( $wp_filter[ $hook_name ] ); } } return $r; } function remove_all_filters( $hook_name, $priority = false ) { global $wp_filter; if ( isset( $wp_filter[ $hook_name ] ) ) { $wp_filter[ $hook_name ]->remove_all_filters( $priority ); if ( ! $wp_filter[ $hook_name ]->has_filters() ) { unset( $wp_filter[ $hook_name ] ); } } return true; } function current_filter() { global $wp_current_filter; return end( $wp_current_filter ); } function doing_filter( $hook_name = null ) { global $wp_current_filter; if ( null === $hook_name ) { return ! empty( $wp_current_filter ); } return in_array( $hook_name, $wp_current_filter, true ); } function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { return add_filter( $hook_name, $callback, $priority, $accepted_args ); } function do_action( $hook_name, ...$arg ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } if ( empty( $arg ) ) { $arg[] = ''; } elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) { $arg[0] = $arg[0][0]; } $wp_filter[ $hook_name ]->do_action( $arg ); array_pop( $wp_current_filter ); } function do_action_ref_array( $hook_name, $args ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $wp_filter[ $hook_name ]->do_action( $args ); array_pop( $wp_current_filter ); } function has_action( $hook_name, $callback = false ) { return has_filter( $hook_name, $callback ); } function remove_action( $hook_name, $callback, $priority = 10 ) { return remove_filter( $hook_name, $callback, $priority ); } function remove_all_actions( $hook_name, $priority = false ) { return remove_all_filters( $hook_name, $priority ); } function current_action() { return current_filter(); } function doing_action( $hook_name = null ) { return doing_filter( $hook_name ); } function did_action( $hook_name ) { global $wp_actions; if ( ! isset( $wp_actions[ $hook_name ] ) ) { return 0; } return $wp_actions[ $hook_name ]; } function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_filter( $hook_name ) ) { return $args[0]; } _deprecated_hook( $hook_name, $version, $replacement, $message ); return apply_filters_ref_array( $hook_name, $args ); } function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_action( $hook_name ) ) { return; } _deprecated_hook( $hook_name, $version, $replacement, $message ); do_action_ref_array( $hook_name, $args ); } function plugin_basename( $file ) { global $wp_plugin_paths; $file = wp_normalize_path( $file ); arsort( $wp_plugin_paths ); foreach ( $wp_plugin_paths as $dir => $realdir ) { if ( strpos( $file, $realdir ) === 0 ) { $file = $dir . substr( $file, strlen( $realdir ) ); } } $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); $file = preg_replace( '#^' . preg_quote( $plugin_dir, '#' ) . '/|^' . preg_quote( $mu_plugin_dir, '#' ) . '/#', '', $file ); $file = trim( $file, '/' ); return $file; } function wp_register_plugin_realpath( $file ) { global $wp_plugin_paths; static $wp_plugin_path = null, $wpmu_plugin_path = null; if ( ! isset( $wp_plugin_path ) ) { $wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR ); $wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR ); } $plugin_path = wp_normalize_path( dirname( $file ) ); $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) { return false; } if ( $plugin_path !== $plugin_realpath ) { $wp_plugin_paths[ $plugin_path ] = $plugin_realpath; } return true; } function plugin_dir_path( $file ) { return trailingslashit( dirname( $file ) ); } function plugin_dir_url( $file ) { return trailingslashit( plugins_url( '', $file ) ); } function register_activation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'activate_' . $file, $callback ); } function register_deactivation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'deactivate_' . $file, $callback ); } function register_uninstall_hook( $file, $callback ) { if ( is_array( $callback ) && is_object( $callback[0] ) ) { _doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1.0' ); return; } $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); $plugin_basename = plugin_basename( $file ); if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) { $uninstallable_plugins[ $plugin_basename ] = $callback; update_option( 'uninstall_plugins', $uninstallable_plugins ); } } function _wp_call_all_hook( $args ) { global $wp_filter; $wp_filter['all']->do_all_hook( $args ); } function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) { if ( is_string( $callback ) ) { return $callback; } if ( is_object( $callback ) ) { $callback = array( $callback, '' ); } else { $callback = (array) $callback; } if ( is_object( $callback[0] ) ) { return spl_object_hash( $callback[0] ) . $callback[1]; } elseif ( is_string( $callback[0] ) ) { return $callback[0] . '::' . $callback[1]; } } register_attributes(); } public function register( $block_support_name, $block_support_config ) { $this->block_supports[ $block_support_name ] = array_merge( $block_support_config, array( 'name' => $block_support_name ) ); } public function apply_block_supports() { $block_attributes = self::$block_to_render['attrs']; $block_type = WP_Block_Type_Registry::get_instance()->get_registered( self::$block_to_render['blockName'] ); if ( ! $block_type || empty( $block_type ) ) { return array(); } $output = array(); foreach ( $this->block_supports as $block_support_config ) { if ( ! isset( $block_support_config['apply'] ) ) { continue; } $new_attributes = call_user_func( $block_support_config['apply'], $block_type, $block_attributes ); if ( ! empty( $new_attributes ) ) { foreach ( $new_attributes as $attribute_name => $attribute_value ) { if ( empty( $output[ $attribute_name ] ) ) { $output[ $attribute_name ] = $attribute_value; } else { $output[ $attribute_name ] .= " $attribute_value"; } } } } return $output; } private function register_attributes() { $block_registry = WP_Block_Type_Registry::get_instance(); $registered_block_types = $block_registry->get_all_registered(); foreach ( $registered_block_types as $block_type ) { if ( ! property_exists( $block_type, 'supports' ) ) { continue; } if ( ! $block_type->attributes ) { $block_type->attributes = array(); } foreach ( $this->block_supports as $block_support_config ) { if ( ! isset( $block_support_config['register_attribute'] ) ) { continue; } call_user_func( $block_support_config['register_attribute'], $block_type ); } } } } function get_block_wrapper_attributes( $extra_attributes = array() ) { $new_attributes = WP_Block_Supports::get_instance()->apply_block_supports(); if ( empty( $new_attributes ) && empty( $extra_attributes ) ) { return ''; } $attributes_to_merge = array( 'style', 'class' ); $attributes = array(); foreach ( $attributes_to_merge as $attribute_name ) { if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) { continue; } if ( empty( $new_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ]; continue; } if ( empty( $extra_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $new_attributes[ $attribute_name ]; continue; } $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ] . ' ' . $new_attributes[ $attribute_name ]; } foreach ( $extra_attributes as $attribute_name => $value ) { if ( ! in_array( $attribute_name, $attributes_to_merge, true ) ) { $attributes[ $attribute_name ] = $value; } } if ( empty( $attributes ) ) { return ''; } $normalized_attributes = array(); foreach ( $attributes as $key => $value ) { $normalized_attributes[] = $key . '="' . esc_attr( $value ) . '"'; } return implode( ' ', $normalized_attributes ); } feed = new AtomFeed(); $this->current = null; $this->map_attrs_func = array( __CLASS__, 'map_attrs' ); $this->map_xmlns_func = array( __CLASS__, 'map_xmlns' ); } public function AtomParser() { self::__construct(); } public static function map_attrs($k, $v) { return "$k=\"$v\""; } public static function map_xmlns($p, $n) { $xd = "xmlns"; if( 0 < strlen($n[0]) ) { $xd .= ":{$n[0]}"; } return "{$xd}=\"{$n[1]}\""; } function _p($msg) { if($this->debug) { print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n"; } } function error_handler($log_level, $log_text, $error_file, $error_line) { $this->error = $log_text; } function parse() { set_error_handler(array(&$this, 'error_handler')); array_unshift($this->ns_contexts, array()); if ( ! function_exists( 'xml_parser_create_ns' ) ) { trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); return false; } $parser = xml_parser_create_ns(); xml_set_object($parser, $this); xml_set_element_handler($parser, "start_element", "end_element"); xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0); xml_set_character_data_handler($parser, "cdata"); xml_set_default_handler($parser, "_default"); xml_set_start_namespace_decl_handler($parser, "start_ns"); xml_set_end_namespace_decl_handler($parser, "end_ns"); $this->content = ''; $ret = true; $fp = fopen($this->FILE, "r"); while ($data = fread($fp, 4096)) { if($this->debug) $this->content .= $data; if(!xml_parse($parser, $data, feof($fp))) { trigger_error(sprintf(__('XML Error: %1$s at line %2$s')."\n", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); $ret = false; break; } } fclose($fp); xml_parser_free($parser); unset($parser); restore_error_handler(); return $ret; } function start_element($parser, $name, $attrs) { $name_parts = explode(":", $name); $tag = array_pop($name_parts); switch($name) { case $this->NS . ':feed': $this->current = $this->feed; break; case $this->NS . ':entry': $this->current = new AtomEntry(); break; }; $this->_p("start_element('$name')"); array_unshift($this->ns_contexts, $this->ns_decls); $this->depth++; if(!empty($this->in_content)) { $this->content_ns_decls = array(); if($this->is_html || $this->is_text) trigger_error("Invalid content in element found. Content must not be of type text or html if it contains markup."); $attrs_prefix = array(); foreach($attrs as $key => $value) { $with_prefix = $this->ns_to_prefix($key, true); $attrs_prefix[$with_prefix[1]] = $this->xml_escape($value); } $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix))); if(strlen($attrs_str) > 0) { $attrs_str = " " . $attrs_str; } $with_prefix = $this->ns_to_prefix($name); if(!$this->is_declared_content_ns($with_prefix[0])) { array_push($this->content_ns_decls, $with_prefix[0]); } $xmlns_str = ''; if(count($this->content_ns_decls) > 0) { array_unshift($this->content_ns_contexts, $this->content_ns_decls); $xmlns_str .= join(' ', array_map($this->map_xmlns_func, array_keys($this->content_ns_contexts[0]), array_values($this->content_ns_contexts[0]))); if(strlen($xmlns_str) > 0) { $xmlns_str = " " . $xmlns_str; } } array_push($this->in_content, array($tag, $this->depth, "<". $with_prefix[1] ."{$xmlns_str}{$attrs_str}" . ">")); } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { $this->in_content = array(); $this->is_xhtml = $attrs['type'] == 'xhtml'; $this->is_html = $attrs['type'] == 'html' || $attrs['type'] == 'text/html'; $this->is_text = !in_array('type',array_keys($attrs)) || $attrs['type'] == 'text'; $type = $this->is_xhtml ? 'XHTML' : ($this->is_html ? 'HTML' : ($this->is_text ? 'TEXT' : $attrs['type'])); if(in_array('src',array_keys($attrs))) { $this->current->$tag = $attrs; } else { array_push($this->in_content, array($tag,$this->depth, $type)); } } else if($tag == 'link') { array_push($this->current->links, $attrs); } else if($tag == 'category') { array_push($this->current->categories, $attrs); } $this->ns_decls = array(); } function end_element($parser, $name) { $name_parts = explode(":", $name); $tag = array_pop($name_parts); $ccount = count($this->in_content); if(!empty($this->in_content)) { if($this->in_content[0][0] == $tag && $this->in_content[0][1] == $this->depth) { $origtype = $this->in_content[0][2]; array_shift($this->in_content); $newcontent = array(); foreach($this->in_content as $c) { if(count($c) == 3) { array_push($newcontent, $c[2]); } else { if($this->is_xhtml || $this->is_text) { array_push($newcontent, $this->xml_escape($c)); } else { array_push($newcontent, $c); } } } if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS)) { $this->current->$tag = array($origtype, join('',$newcontent)); } else { $this->current->$tag = join('',$newcontent); } $this->in_content = array(); } else if($this->in_content[$ccount-1][0] == $tag && $this->in_content[$ccount-1][1] == $this->depth) { $this->in_content[$ccount-1][2] = substr($this->in_content[$ccount-1][2],0,-1) . "/>"; } else { $endtag = $this->ns_to_prefix($name); array_push($this->in_content, array($tag, $this->depth, "")); } } array_shift($this->ns_contexts); $this->depth--; if($name == ($this->NS . ':entry')) { array_push($this->feed->entries, $this->current); $this->current = null; } $this->_p("end_element('$name')"); } function start_ns($parser, $prefix, $uri) { $this->_p("starting: " . $prefix . ":" . $uri); array_push($this->ns_decls, array($prefix,$uri)); } function end_ns($parser, $prefix) { $this->_p("ending: #" . $prefix . "#"); } function cdata($parser, $data) { $this->_p("data: #" . str_replace(array("\n"), array("\\n"), trim($data)) . "#"); if(!empty($this->in_content)) { array_push($this->in_content, $data); } } function _default($parser, $data) { } function ns_to_prefix($qname, $attr=false) { $components = explode(":", $qname); $name = array_pop($components); if(!empty($components)) { $ns = join(":",$components); foreach($this->ns_contexts as $context) { foreach($context as $mapping) { if($mapping[1] == $ns && strlen($mapping[0]) > 0) { return array($mapping, "$mapping[0]:$name"); } } } } if($attr) { return array(null, $name); } else { foreach($this->ns_contexts as $context) { foreach($context as $mapping) { if(strlen($mapping[0]) == 0) { return array($mapping, $name); } } } } } function is_declared_content_ns($new_mapping) { foreach($this->content_ns_contexts as $context) { foreach($context as $mapping) { if($new_mapping == $mapping) { return true; } } } return false; } function xml_escape($content) { return str_replace(array('&','"',"'",'<','>'), array('&','"',''','<','>'), $content ); } } { + "title": "block title", + "description": "block description", + "keywords": [ "block keyword" ], + "styles": [ + { + "label": "block style label" + } + ], + "variations": [ + { + "title": "block variation title", + "description": "block variation description", + "keywords": [ "block variation keyword" ] + } + ] } + $separator, 'link' => $link, 'format' => $format, ); return get_term_parents_list( $category_id, 'category', $args ); } function get_the_category( $post_id = false ) { $categories = get_the_terms( $post_id, 'category' ); if ( ! $categories || is_wp_error( $categories ) ) { $categories = array(); } $categories = array_values( $categories ); foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[ $key ] ); } return apply_filters( 'get_the_categories', $categories, $post_id ); } function get_the_category_by_ID( $cat_id ) { $cat_id = (int) $cat_id; $category = get_term( $cat_id ); if ( is_wp_error( $category ) ) { return $category; } return ( $category ) ? $category->name : ''; } function get_the_category_list( $separator = '', $parents = '', $post_id = false ) { global $wp_rewrite; if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) { return apply_filters( 'the_category', '', $separator, $parents ); } $categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id ); if ( empty( $categories ) ) { return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); } $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; $thelist = ''; if ( '' === $separator ) { $thelist .= ''; } else { $i = 0; foreach ( $categories as $category ) { if ( 0 < $i ) { $thelist .= $separator; } switch ( strtolower( $parents ) ) { case 'multiple': if ( $category->parent ) { $thelist .= get_category_parents( $category->parent, true, $separator ); } $thelist .= '' . $category->name . ''; break; case 'single': $thelist .= ''; if ( $category->parent ) { $thelist .= get_category_parents( $category->parent, false, $separator ); } $thelist .= "$category->name"; break; case '': default: $thelist .= '' . $category->name . ''; } ++$i; } } return apply_filters( 'the_category', $thelist, $separator, $parents ); } function in_category( $category, $post = null ) { if ( empty( $category ) ) { return false; } return has_category( $category, $post ); } function the_category( $separator = '', $parents = '', $post_id = false ) { echo get_the_category_list( $separator, $parents, $post_id ); } function category_description( $category = 0 ) { return term_description( $category ); } function wp_dropdown_categories( $args = '' ) { $defaults = array( 'show_option_all' => '', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'id' => '', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false, 'option_none_value' => -1, 'value_field' => 'term_id', 'required' => false, ); $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; if ( isset( $args['type'] ) && 'link' === $args['type'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'type => link', 'taxonomy => link_category' ) ); $args['taxonomy'] = 'link_category'; } $parsed_args = wp_parse_args( $args, $defaults ); $option_none_value = $parsed_args['option_none_value']; if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { $parsed_args['pad_counts'] = true; } $tab_index = $parsed_args['tab_index']; $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) { $tab_index_attribute = " tabindex=\"$tab_index\""; } $get_terms_args = $parsed_args; unset( $get_terms_args['name'] ); $categories = get_terms( $get_terms_args ); $name = esc_attr( $parsed_args['name'] ); $class = esc_attr( $parsed_args['class'] ); $id = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name; $required = $parsed_args['required'] ? 'required' : ''; if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) { $output = "\n"; } $output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args ); if ( $parsed_args['echo'] ) { echo $output; } return $output; } function wp_list_categories( $args = '' ) { $defaults = array( 'child_of' => 0, 'current_category' => 0, 'depth' => 0, 'echo' => 1, 'exclude' => '', 'exclude_tree' => '', 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'hide_empty' => 1, 'hide_title_if_empty' => false, 'hierarchical' => true, 'order' => 'ASC', 'orderby' => 'name', 'separator' => '
          ', 'show_count' => 0, 'show_option_all' => '', 'show_option_none' => __( 'No categories' ), 'style' => 'list', 'taxonomy' => 'category', 'title_li' => __( 'Categories' ), 'use_desc_for_title' => 1, ); $parsed_args = wp_parse_args( $args, $defaults ); if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { $parsed_args['pad_counts'] = true; } if ( true == $parsed_args['hierarchical'] ) { $exclude_tree = array(); if ( $parsed_args['exclude_tree'] ) { $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude_tree'] ) ); } if ( $parsed_args['exclude'] ) { $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude'] ) ); } $parsed_args['exclude_tree'] = $exclude_tree; $parsed_args['exclude'] = ''; } if ( ! isset( $parsed_args['class'] ) ) { $parsed_args['class'] = ( 'category' === $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy']; } if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) { return false; } $show_option_all = $parsed_args['show_option_all']; $show_option_none = $parsed_args['show_option_none']; $categories = get_categories( $parsed_args ); $output = ''; if ( $parsed_args['title_li'] && 'list' === $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) { $output = '
        • ' . $parsed_args['title_li'] . '
            '; } if ( empty( $categories ) ) { if ( ! empty( $show_option_none ) ) { if ( 'list' === $parsed_args['style'] ) { $output .= '
          • ' . $show_option_none . '
          • '; } else { $output .= $show_option_none; } } } else { if ( ! empty( $show_option_all ) ) { $posts_page = ''; $taxonomy_object = get_taxonomy( $parsed_args['taxonomy'] ); if ( ! in_array( 'post', $taxonomy_object->object_type, true ) && ! in_array( 'page', $taxonomy_object->object_type, true ) ) { foreach ( $taxonomy_object->object_type as $object_type ) { $_object_type = get_post_type_object( $object_type ); if ( ! empty( $_object_type->has_archive ) ) { $posts_page = get_post_type_archive_link( $object_type ); break; } } } if ( ! $posts_page ) { if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) { $posts_page = get_permalink( get_option( 'page_for_posts' ) ); } else { $posts_page = home_url( '/' ); } } $posts_page = esc_url( $posts_page ); if ( 'list' === $parsed_args['style'] ) { $output .= "
          • $show_option_all
          • "; } else { $output .= "$show_option_all"; } } if ( empty( $parsed_args['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) { $current_term_object = get_queried_object(); if ( $current_term_object && $parsed_args['taxonomy'] === $current_term_object->taxonomy ) { $parsed_args['current_category'] = get_queried_object_id(); } } if ( $parsed_args['hierarchical'] ) { $depth = $parsed_args['depth']; } else { $depth = -1; } $output .= walk_category_tree( $categories, $depth, $parsed_args ); } if ( $parsed_args['title_li'] && 'list' === $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) { $output .= '
        • '; } $html = apply_filters( 'wp_list_categories', $output, $args ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } function wp_tag_cloud( $args = '' ) { $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true, 'show_count' => 0, ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC', ) ) ); if ( empty( $tags ) || is_wp_error( $tags ) ) { return; } foreach ( $tags as $key => $tag ) { if ( 'edit' === $args['link'] ) { $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] ); } else { $link = get_term_link( $tag, $tag->taxonomy ); } if ( is_wp_error( $link ) ) { return; } $tags[ $key ]->link = $link; $tags[ $key ]->id = $tag->term_id; } $return = wp_generate_tag_cloud( $tags, $args ); $return = apply_filters( 'wp_tag_cloud', $return, $args ); if ( 'array' === $args['format'] || empty( $args['echo'] ) ) { return $return; } echo $return; } function default_topic_count_scale( $count ) { return round( log10( $count + 1 ) * 100 ); } function wp_generate_tag_cloud( $tags, $args = '' ) { $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'topic_count_text' => null, 'topic_count_text_callback' => null, 'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1, 'show_count' => 0, ); $args = wp_parse_args( $args, $defaults ); $return = ( 'array' === $args['format'] ) ? array() : ''; if ( empty( $tags ) ) { return $return; } if ( isset( $args['topic_count_text'] ) ) { $translate_nooped_plural = $args['topic_count_text']; } elseif ( ! empty( $args['topic_count_text_callback'] ) ) { if ( 'default_topic_count_text' === $args['topic_count_text_callback'] ) { $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } else { $translate_nooped_plural = false; } } elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { $translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] ); } else { $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } $tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args ); if ( empty( $tags_sorted ) ) { return $return; } if ( $tags_sorted !== $tags ) { $tags = $tags_sorted; unset( $tags_sorted ); } else { if ( 'RAND' === $args['order'] ) { shuffle( $tags ); } else { if ( 'name' === $args['orderby'] ) { uasort( $tags, '_wp_object_name_sort_cb' ); } else { uasort( $tags, '_wp_object_count_sort_cb' ); } if ( 'DESC' === $args['order'] ) { $tags = array_reverse( $tags, true ); } } } if ( $args['number'] > 0 ) { $tags = array_slice( $tags, 0, $args['number'] ); } $counts = array(); $real_counts = array(); foreach ( (array) $tags as $key => $tag ) { $real_counts[ $key ] = $tag->count; $counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count ); } $min_count = min( $counts ); $spread = max( $counts ) - $min_count; if ( $spread <= 0 ) { $spread = 1; } $font_spread = $args['largest'] - $args['smallest']; if ( $font_spread < 0 ) { $font_spread = 1; } $font_step = $font_spread / $spread; $aria_label = false; if ( $args['show_count'] || 0 !== $font_spread ) { $aria_label = true; } $tags_data = array(); foreach ( $tags as $key => $tag ) { $tag_id = isset( $tag->id ) ? $tag->id : $key; $count = $counts[ $key ]; $real_count = $real_counts[ $key ]; if ( $translate_nooped_plural ) { $formatted_count = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) ); } else { $formatted_count = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args ); } $tags_data[] = array( 'id' => $tag_id, 'url' => ( '#' !== $tag->link ) ? $tag->link : '#', 'role' => ( '#' !== $tag->link ) ? '' : ' role="button"', 'name' => $tag->name, 'formatted_count' => $formatted_count, 'slug' => $tag->slug, 'real_count' => $real_count, 'class' => 'tag-cloud-link tag-link-' . $tag_id, 'font_size' => $args['smallest'] + ( $count - $min_count ) * $font_step, 'aria_label' => $aria_label ? sprintf( ' aria-label="%1$s (%2$s)"', esc_attr( $tag->name ), esc_attr( $formatted_count ) ) : '', 'show_count' => $args['show_count'] ? ' (' . $real_count . ')' : '', ); } $tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data ); $a = array(); foreach ( $tags_data as $key => $tag_data ) { $class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 ); $a[] = sprintf( '%6$s%7$s', esc_url( $tag_data['url'] ), $tag_data['role'], esc_attr( $class ), esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ), $tag_data['aria_label'], esc_html( $tag_data['name'] ), $tag_data['show_count'] ); } switch ( $args['format'] ) { case 'array': $return =& $a; break; case 'list': $return = "
            \n\t
          • "; $return .= implode( "
          • \n\t
          • ", $a ); $return .= "
          • \n
          \n"; break; default: $return = implode( $args['separator'], $a ); break; } if ( $args['filter'] ) { return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args ); } else { return $return; } } function _wp_object_name_sort_cb( $a, $b ) { return strnatcasecmp( $a->name, $b->name ); } function _wp_object_count_sort_cb( $a, $b ) { return ( $a->count > $b->count ); } function walk_category_tree( ...$args ) { if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_Category; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function walk_category_dropdown_tree( ...$args ) { if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_CategoryDropdown; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function get_tag_link( $tag ) { return get_category_link( $tag ); } function get_the_tags( $post_id = 0 ) { $terms = get_the_terms( $post_id, 'post_tag' ); return apply_filters( 'get_the_tags', $terms ); } function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) { $tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after ); return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id ); } function the_tags( $before = null, $sep = ', ', $after = '' ) { if ( null === $before ) { $before = __( 'Tags: ' ); } $the_tags = get_the_tag_list( $before, $sep, $after ); if ( ! is_wp_error( $the_tags ) ) { echo $the_tags; } } function tag_description( $tag = 0 ) { return term_description( $tag ); } function term_description( $term = 0, $deprecated = null ) { if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) { $term = get_queried_object(); if ( $term ) { $term = $term->term_id; } } $description = get_term_field( 'description', $term ); return is_wp_error( $description ) ? '' : $description; } function get_the_terms( $post, $taxonomy ) { $post = get_post( $post ); if ( ! $post ) { return false; } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy ); if ( ! is_wp_error( $terms ) ) { $term_ids = wp_list_pluck( $terms, 'term_id' ); wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' ); } } $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); if ( empty( $terms ) ) { return false; } return $terms; } function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) { $terms = get_the_terms( $post_id, $taxonomy ); if ( is_wp_error( $terms ) ) { return $terms; } if ( empty( $terms ) ) { return false; } $links = array(); foreach ( $terms as $term ) { $link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $link ) ) { return $link; } $links[] = ''; } $term_links = apply_filters( "term_links-{$taxonomy}", $links ); return $before . implode( $sep, $term_links ) . $after; } function get_term_parents_list( $term_id, $taxonomy, $args = array() ) { $list = ''; $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! $term ) { return $list; } $term_id = $term->term_id; $defaults = array( 'format' => 'name', 'separator' => '/', 'link' => true, 'inclusive' => true, ); $args = wp_parse_args( $args, $defaults ); foreach ( array( 'link', 'inclusive' ) as $bool ) { $args[ $bool ] = wp_validate_boolean( $args[ $bool ] ); } $parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' ); if ( $args['inclusive'] ) { array_unshift( $parents, $term_id ); } foreach ( array_reverse( $parents ) as $term_id ) { $parent = get_term( $term_id, $taxonomy ); $name = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name; if ( $args['link'] ) { $list .= '' . $name . '' . $args['separator']; } else { $list .= $name . $args['separator']; } } return $list; } function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { $term_list = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after ); if ( is_wp_error( $term_list ) ) { return false; } echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); } function has_category( $category = '', $post = null ) { return has_term( $category, 'category', $post ); } function has_tag( $tag = '', $post = null ) { return has_term( $tag, 'post_tag', $post ); } function has_term( $term = '', $taxonomy = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $r = is_object_in_term( $post->ID, $taxonomy, $term ); if ( is_wp_error( $r ) ) { return false; } return $r; } _show_split_view = $params['show_split_view']; } } public function _startBlock( $header ) { return ''; } public function _lines( $lines, $prefix = ' ' ) { } public function addedLine( $line ) { return "" . __( 'Added:' ) . " {$line}"; } public function deletedLine( $line ) { return "" . __( 'Deleted:' ) . " {$line}"; } public function contextLine( $line ) { return "" . __( 'Unchanged:' ) . " {$line}"; } public function emptyLine() { return ' '; } public function _added( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' ); } if ( $this->_show_split_view ) { $r .= '' . $this->emptyLine() . $this->addedLine( $line ) . "\n"; } else { $r .= '' . $this->addedLine( $line ) . "\n"; } } return $r; } public function _deleted( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' ); } if ( $this->_show_split_view ) { $r .= '' . $this->deletedLine( $line ) . $this->emptyLine() . "\n"; } else { $r .= '' . $this->deletedLine( $line ) . "\n"; } } return $r; } public function _context( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' ); } if ( $this->_show_split_view ) { $r .= '' . $this->contextLine( $line ) . $this->contextLine( $line ) . "\n"; } else { $r .= '' . $this->contextLine( $line ) . "\n"; } } return $r; } public function _changed( $orig, $final ) { $r = ''; list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines( $orig, $final ); $orig_diffs = array(); $final_diffs = array(); foreach ( $orig_matches as $o => $f ) { if ( is_numeric( $o ) && is_numeric( $f ) ) { $text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) ); $renderer = new $this->inline_diff_renderer; $diff = $renderer->render( $text_diff ); if ( preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { $stripped_matches = strlen( strip_tags( implode( ' ', $diff_matches[0] ) ) ); $stripped_diff = strlen( strip_tags( $diff ) ) * 2 - $stripped_matches; $diff_ratio = $stripped_matches / $stripped_diff; if ( $diff_ratio > $this->_diff_threshold ) { continue; } } $orig_diffs[ $o ] = preg_replace( '|.*?|', '', $diff ); $final_diffs[ $f ] = preg_replace( '|.*?|', '', $diff ); } } foreach ( array_keys( $orig_rows ) as $row ) { if ( $orig_rows[ $row ] < 0 && $final_rows[ $row ] < 0 ) { continue; } if ( isset( $orig_diffs[ $orig_rows[ $row ] ] ) ) { $orig_line = $orig_diffs[ $orig_rows[ $row ] ]; } elseif ( isset( $orig[ $orig_rows[ $row ] ] ) ) { $orig_line = htmlspecialchars( $orig[ $orig_rows[ $row ] ] ); } else { $orig_line = ''; } if ( isset( $final_diffs[ $final_rows[ $row ] ] ) ) { $final_line = $final_diffs[ $final_rows[ $row ] ]; } elseif ( isset( $final[ $final_rows[ $row ] ] ) ) { $final_line = htmlspecialchars( $final[ $final_rows[ $row ] ] ); } else { $final_line = ''; } if ( $orig_rows[ $row ] < 0 ) { $r .= $this->_added( array( $final_line ), false ); } elseif ( $final_rows[ $row ] < 0 ) { $r .= $this->_deleted( array( $orig_line ), false ); } else { if ( $this->_show_split_view ) { $r .= '' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "\n"; } else { $r .= '' . $this->deletedLine( $orig_line ) . '' . $this->addedLine( $final_line ) . "\n"; } } } return $r; } public function interleave_changed_lines( $orig, $final ) { $matches = array(); foreach ( array_keys( $orig ) as $o ) { foreach ( array_keys( $final ) as $f ) { $matches[ "$o,$f" ] = $this->compute_string_distance( $orig[ $o ], $final[ $f ] ); } } asort( $matches ); $orig_matches = array(); $final_matches = array(); foreach ( $matches as $keys => $difference ) { list($o, $f) = explode( ',', $keys ); $o = (int) $o; $f = (int) $f; if ( isset( $orig_matches[ $o ] ) && isset( $final_matches[ $f ] ) ) { continue; } if ( ! isset( $orig_matches[ $o ] ) && ! isset( $final_matches[ $f ] ) ) { $orig_matches[ $o ] = $f; $final_matches[ $f ] = $o; continue; } if ( isset( $orig_matches[ $o ] ) ) { $final_matches[ $f ] = 'x'; } elseif ( isset( $final_matches[ $f ] ) ) { $orig_matches[ $o ] = 'x'; } } ksort( $orig_matches ); ksort( $final_matches ); $orig_rows = array_keys( $orig_matches ); $orig_rows_copy = $orig_rows; $final_rows = array_keys( $final_matches ); foreach ( $orig_rows_copy as $orig_row ) { $final_pos = array_search( $orig_matches[ $orig_row ], $final_rows, true ); $orig_pos = (int) array_search( $orig_row, $orig_rows, true ); if ( false === $final_pos ) { array_splice( $final_rows, $orig_pos, 0, -1 ); } elseif ( $final_pos < $orig_pos ) { $diff_array = range( -1, $final_pos - $orig_pos ); array_splice( $final_rows, $orig_pos, 0, $diff_array ); } elseif ( $final_pos > $orig_pos ) { $diff_array = range( -1, $orig_pos - $final_pos ); array_splice( $orig_rows, $orig_pos, 0, $diff_array ); } } $diff_count = count( $orig_rows ) - count( $final_rows ); if ( $diff_count < 0 ) { while ( $diff_count < 0 ) { array_push( $orig_rows, $diff_count++ ); } } elseif ( $diff_count > 0 ) { $diff_count = -1 * $diff_count; while ( $diff_count < 0 ) { array_push( $final_rows, $diff_count++ ); } } return array( $orig_matches, $final_matches, $orig_rows, $final_rows ); } public function compute_string_distance( $string1, $string2 ) { $count_key1 = md5( $string1 ); $count_key2 = md5( $string2 ); if ( ! isset( $this->count_cache[ $count_key1 ] ) ) { $this->count_cache[ $count_key1 ] = count_chars( $string1 ); } if ( ! isset( $this->count_cache[ $count_key2 ] ) ) { $this->count_cache[ $count_key2 ] = count_chars( $string2 ); } $chars1 = $this->count_cache[ $count_key1 ]; $chars2 = $this->count_cache[ $count_key2 ]; $difference_key = md5( implode( ',', $chars1 ) . ':' . implode( ',', $chars2 ) ); if ( ! isset( $this->difference_cache[ $difference_key ] ) ) { $this->difference_cache[ $difference_key ] = array_sum( array_map( array( $this, 'difference' ), $chars1, $chars2 ) ); } $difference = $this->difference_cache[ $difference_key ]; if ( ! $string1 ) { return $difference; } return $difference / strlen( $string1 ); } public function difference( $a, $b ) { return abs( $a - $b ); } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } } ID, '_thumbnail_id', true ); return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post ); } function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) { echo get_the_post_thumbnail( null, $size, $attr ); } function update_post_thumbnail_cache( $wp_query = null ) { if ( ! $wp_query ) { $wp_query = $GLOBALS['wp_query']; } if ( $wp_query->thumbnails_cached ) { return; } $thumb_ids = array(); foreach ( $wp_query->posts as $post ) { $id = get_post_thumbnail_id( $post->ID ); if ( $id ) { $thumb_ids[] = $id; } } if ( ! empty( $thumb_ids ) ) { _prime_post_caches( $thumb_ids, false, true ); } $wp_query->thumbnails_cached = true; } function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) { $post = get_post( $post ); if ( ! $post ) { return ''; } $post_thumbnail_id = get_post_thumbnail_id( $post ); $size = apply_filters( 'post_thumbnail_size', $size, $post->ID ); if ( $post_thumbnail_id ) { do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size ); if ( in_the_loop() ) { update_post_thumbnail_cache(); } $loading = wp_get_loading_attr_default( 'the_post_thumbnail' ); if ( empty( $attr ) ) { $attr = array( 'loading' => $loading ); } elseif ( is_array( $attr ) && ! array_key_exists( 'loading', $attr ) ) { $attr['loading'] = $loading; } elseif ( is_string( $attr ) && ! preg_match( '/(^|&)loading=/', $attr ) ) { $attr .= '&loading=' . $loading; } $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size ); } else { $html = ''; } return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr ); } function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) { $post_thumbnail_id = get_post_thumbnail_id( $post ); if ( ! $post_thumbnail_id ) { return false; } $thumbnail_url = wp_get_attachment_image_url( $post_thumbnail_id, $size ); return apply_filters( 'post_thumbnail_url', $thumbnail_url, $post, $size ); } function the_post_thumbnail_url( $size = 'post-thumbnail' ) { $url = get_the_post_thumbnail_url( null, $size ); if ( $url ) { echo esc_url( $url ); } } function get_the_post_thumbnail_caption( $post = null ) { $post_thumbnail_id = get_post_thumbnail_id( $post ); if ( ! $post_thumbnail_id ) { return ''; } $caption = wp_get_attachment_caption( $post_thumbnail_id ); if ( ! $caption ) { $caption = ''; } return $caption; } function the_post_thumbnail_caption( $post = null ) { echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) ); } methods = array( 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 'wp.newPost' => 'this:wp_newPost', 'wp.editPost' => 'this:wp_editPost', 'wp.deletePost' => 'this:wp_deletePost', 'wp.getPost' => 'this:wp_getPost', 'wp.getPosts' => 'this:wp_getPosts', 'wp.newTerm' => 'this:wp_newTerm', 'wp.editTerm' => 'this:wp_editTerm', 'wp.deleteTerm' => 'this:wp_deleteTerm', 'wp.getTerm' => 'this:wp_getTerm', 'wp.getTerms' => 'this:wp_getTerms', 'wp.getTaxonomy' => 'this:wp_getTaxonomy', 'wp.getTaxonomies' => 'this:wp_getTaxonomies', 'wp.getUser' => 'this:wp_getUser', 'wp.getUsers' => 'this:wp_getUsers', 'wp.getProfile' => 'this:wp_getProfile', 'wp.editProfile' => 'this:wp_editProfile', 'wp.getPage' => 'this:wp_getPage', 'wp.getPages' => 'this:wp_getPages', 'wp.newPage' => 'this:wp_newPage', 'wp.deletePage' => 'this:wp_deletePage', 'wp.editPage' => 'this:wp_editPage', 'wp.getPageList' => 'this:wp_getPageList', 'wp.getAuthors' => 'this:wp_getAuthors', 'wp.getCategories' => 'this:mw_getCategories', 'wp.getTags' => 'this:wp_getTags', 'wp.newCategory' => 'this:wp_newCategory', 'wp.deleteCategory' => 'this:wp_deleteCategory', 'wp.suggestCategories' => 'this:wp_suggestCategories', 'wp.uploadFile' => 'this:mw_newMediaObject', 'wp.deleteFile' => 'this:wp_deletePost', 'wp.getCommentCount' => 'this:wp_getCommentCount', 'wp.getPostStatusList' => 'this:wp_getPostStatusList', 'wp.getPageStatusList' => 'this:wp_getPageStatusList', 'wp.getPageTemplates' => 'this:wp_getPageTemplates', 'wp.getOptions' => 'this:wp_getOptions', 'wp.setOptions' => 'this:wp_setOptions', 'wp.getComment' => 'this:wp_getComment', 'wp.getComments' => 'this:wp_getComments', 'wp.deleteComment' => 'this:wp_deleteComment', 'wp.editComment' => 'this:wp_editComment', 'wp.newComment' => 'this:wp_newComment', 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList', 'wp.getMediaItem' => 'this:wp_getMediaItem', 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', 'wp.getPostFormats' => 'this:wp_getPostFormats', 'wp.getPostType' => 'this:wp_getPostType', 'wp.getPostTypes' => 'this:wp_getPostTypes', 'wp.getRevisions' => 'this:wp_getRevisions', 'wp.restoreRevision' => 'this:wp_restoreRevision', 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'blogger.getUserInfo' => 'this:blogger_getUserInfo', 'blogger.getPost' => 'this:blogger_getPost', 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', 'blogger.newPost' => 'this:blogger_newPost', 'blogger.editPost' => 'this:blogger_editPost', 'blogger.deletePost' => 'this:blogger_deletePost', 'metaWeblog.newPost' => 'this:mw_newPost', 'metaWeblog.editPost' => 'this:mw_editPost', 'metaWeblog.getPost' => 'this:mw_getPost', 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', 'metaWeblog.getCategories' => 'this:mw_getCategories', 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', 'metaWeblog.deletePost' => 'this:blogger_deletePost', 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'mt.getCategoryList' => 'this:mt_getCategoryList', 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', 'mt.getPostCategories' => 'this:mt_getPostCategories', 'mt.setPostCategories' => 'this:mt_setPostCategories', 'mt.supportedMethods' => 'this:mt_supportedMethods', 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', 'mt.publishPost' => 'this:mt_publishPost', 'pingback.ping' => 'this:pingback_ping', 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', 'demo.sayHello' => 'this:sayHello', 'demo.addTwoNumbers' => 'this:addTwoNumbers', ); $this->initialise_blog_option_info(); $this->methods = apply_filters( 'xmlrpc_methods', $this->methods ); $this->set_is_enabled(); } private function set_is_enabled() { $is_enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); if ( false === $is_enabled ) { $is_enabled = apply_filters( 'option_enable_xmlrpc', true ); } $this->is_enabled = apply_filters( 'xmlrpc_enabled', $is_enabled ); } public function __call( $name, $arguments ) { if ( '_multisite_getUsersBlogs' === $name ) { return $this->_multisite_getUsersBlogs( ...$arguments ); } return false; } public function serve_request() { $this->IXR_Server( $this->methods ); } public function sayHello() { return 'Hello!'; } public function addTwoNumbers( $args ) { $number1 = $args[0]; $number2 = $args[1]; return $number1 + $number2; } public function login( $username, $password ) { if ( ! $this->is_enabled ) { $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) ); return false; } if ( $this->auth_failed ) { $user = new WP_Error( 'login_prevented' ); } else { $user = wp_authenticate( $username, $password ); } if ( is_wp_error( $user ) ) { $this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) ); $this->auth_failed = true; $this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user ); return false; } wp_set_current_user( $user->ID ); return $user; } public function login_pass_ok( $username, $password ) { return (bool) $this->login( $username, $password ); } public function escape( &$data ) { if ( ! is_array( $data ) ) { return wp_slash( $data ); } foreach ( $data as &$v ) { if ( is_array( $v ) ) { $this->escape( $v ); } elseif ( ! is_object( $v ) ) { $v = wp_slash( $v ); } } } public function error( $error, $message = false ) { if ( $message && ! is_object( $error ) ) { $error = new IXR_Error( $error, $message ); } if ( ! $this->is_enabled ) { status_header( $error->code ); } $this->output( $error->getXml() ); } public function get_custom_fields( $post_id ) { $post_id = (int) $post_id; $custom_fields = array(); foreach ( (array) has_meta( $post_id ) as $meta ) { if ( ! current_user_can( 'edit_post_meta', $post_id, $meta['meta_key'] ) ) { continue; } $custom_fields[] = array( 'id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => $meta['meta_value'], ); } return $custom_fields; } public function set_custom_fields( $post_id, $fields ) { $post_id = (int) $post_id; foreach ( (array) $fields as $meta ) { if ( isset( $meta['id'] ) ) { $meta['id'] = (int) $meta['id']; $pmeta = get_metadata_by_mid( 'post', $meta['id'] ); if ( ! $pmeta || $pmeta->post_id != $post_id ) { continue; } if ( isset( $meta['key'] ) ) { $meta['key'] = wp_unslash( $meta['key'] ); if ( $meta['key'] !== $pmeta->meta_key ) { continue; } $meta['value'] = wp_unslash( $meta['value'] ); if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) { update_metadata_by_mid( 'post', $meta['id'], $meta['value'] ); } } elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) { delete_metadata_by_mid( 'post', $meta['id'] ); } } elseif ( current_user_can( 'add_post_meta', $post_id, wp_unslash( $meta['key'] ) ) ) { add_post_meta( $post_id, $meta['key'], $meta['value'] ); } } } public function get_term_custom_fields( $term_id ) { $term_id = (int) $term_id; $custom_fields = array(); foreach ( (array) has_term_meta( $term_id ) as $meta ) { if ( ! current_user_can( 'edit_term_meta', $term_id ) ) { continue; } $custom_fields[] = array( 'id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => $meta['meta_value'], ); } return $custom_fields; } public function set_term_custom_fields( $term_id, $fields ) { $term_id = (int) $term_id; foreach ( (array) $fields as $meta ) { if ( isset( $meta['id'] ) ) { $meta['id'] = (int) $meta['id']; $pmeta = get_metadata_by_mid( 'term', $meta['id'] ); if ( isset( $meta['key'] ) ) { $meta['key'] = wp_unslash( $meta['key'] ); if ( $meta['key'] !== $pmeta->meta_key ) { continue; } $meta['value'] = wp_unslash( $meta['value'] ); if ( current_user_can( 'edit_term_meta', $term_id ) ) { update_metadata_by_mid( 'term', $meta['id'], $meta['value'] ); } } elseif ( current_user_can( 'delete_term_meta', $term_id ) ) { delete_metadata_by_mid( 'term', $meta['id'] ); } } elseif ( current_user_can( 'add_term_meta', $term_id ) ) { add_term_meta( $term_id, $meta['key'], $meta['value'] ); } } } public function initialise_blog_option_info() { $this->blog_options = array( 'software_name' => array( 'desc' => __( 'Software Name' ), 'readonly' => true, 'value' => 'WordPress', ), 'software_version' => array( 'desc' => __( 'Software Version' ), 'readonly' => true, 'value' => get_bloginfo( 'version' ), ), 'blog_url' => array( 'desc' => __( 'WordPress Address (URL)' ), 'readonly' => true, 'option' => 'siteurl', ), 'home_url' => array( 'desc' => __( 'Site Address (URL)' ), 'readonly' => true, 'option' => 'home', ), 'login_url' => array( 'desc' => __( 'Login Address (URL)' ), 'readonly' => true, 'value' => wp_login_url(), ), 'admin_url' => array( 'desc' => __( 'The URL to the admin area' ), 'readonly' => true, 'value' => get_admin_url(), ), 'image_default_link_type' => array( 'desc' => __( 'Image default link type' ), 'readonly' => true, 'option' => 'image_default_link_type', ), 'image_default_size' => array( 'desc' => __( 'Image default size' ), 'readonly' => true, 'option' => 'image_default_size', ), 'image_default_align' => array( 'desc' => __( 'Image default align' ), 'readonly' => true, 'option' => 'image_default_align', ), 'template' => array( 'desc' => __( 'Template' ), 'readonly' => true, 'option' => 'template', ), 'stylesheet' => array( 'desc' => __( 'Stylesheet' ), 'readonly' => true, 'option' => 'stylesheet', ), 'post_thumbnail' => array( 'desc' => __( 'Post Thumbnail' ), 'readonly' => true, 'value' => current_theme_supports( 'post-thumbnails' ), ), 'time_zone' => array( 'desc' => __( 'Time Zone' ), 'readonly' => false, 'option' => 'gmt_offset', ), 'blog_title' => array( 'desc' => __( 'Site Title' ), 'readonly' => false, 'option' => 'blogname', ), 'blog_tagline' => array( 'desc' => __( 'Site Tagline' ), 'readonly' => false, 'option' => 'blogdescription', ), 'date_format' => array( 'desc' => __( 'Date Format' ), 'readonly' => false, 'option' => 'date_format', ), 'time_format' => array( 'desc' => __( 'Time Format' ), 'readonly' => false, 'option' => 'time_format', ), 'users_can_register' => array( 'desc' => __( 'Allow new users to sign up' ), 'readonly' => false, 'option' => 'users_can_register', ), 'thumbnail_size_w' => array( 'desc' => __( 'Thumbnail Width' ), 'readonly' => false, 'option' => 'thumbnail_size_w', ), 'thumbnail_size_h' => array( 'desc' => __( 'Thumbnail Height' ), 'readonly' => false, 'option' => 'thumbnail_size_h', ), 'thumbnail_crop' => array( 'desc' => __( 'Crop thumbnail to exact dimensions' ), 'readonly' => false, 'option' => 'thumbnail_crop', ), 'medium_size_w' => array( 'desc' => __( 'Medium size image width' ), 'readonly' => false, 'option' => 'medium_size_w', ), 'medium_size_h' => array( 'desc' => __( 'Medium size image height' ), 'readonly' => false, 'option' => 'medium_size_h', ), 'medium_large_size_w' => array( 'desc' => __( 'Medium-Large size image width' ), 'readonly' => false, 'option' => 'medium_large_size_w', ), 'medium_large_size_h' => array( 'desc' => __( 'Medium-Large size image height' ), 'readonly' => false, 'option' => 'medium_large_size_h', ), 'large_size_w' => array( 'desc' => __( 'Large size image width' ), 'readonly' => false, 'option' => 'large_size_w', ), 'large_size_h' => array( 'desc' => __( 'Large size image height' ), 'readonly' => false, 'option' => 'large_size_h', ), 'default_comment_status' => array( 'desc' => __( 'Allow people to submit comments on new posts.' ), 'readonly' => false, 'option' => 'default_comment_status', ), 'default_ping_status' => array( 'desc' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new posts.' ), 'readonly' => false, 'option' => 'default_ping_status', ), ); $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options ); } public function wp_getUsersBlogs( $args ) { if ( ! $this->minimum_args( $args, 2 ) ) { return $this->error; } if ( ! is_multisite() ) { array_unshift( $args, 1 ); return $this->blogger_getUsersBlogs( $args ); } $this->escape( $args ); $username = $args[0]; $password = $args[1]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUsersBlogs', $args, $this ); $blogs = (array) get_blogs_of_user( $user->ID ); $struct = array(); $primary_blog_id = 0; $active_blog = get_active_blog_for_user( $user->ID ); if ( $active_blog ) { $primary_blog_id = (int) $active_blog->blog_id; } foreach ( $blogs as $blog ) { if ( get_current_network_id() != $blog->site_id ) { continue; } $blog_id = $blog->userblog_id; switch_to_blog( $blog_id ); $is_admin = current_user_can( 'manage_options' ); $is_primary = ( (int) $blog_id === $primary_blog_id ); $struct[] = array( 'isAdmin' => $is_admin, 'isPrimary' => $is_primary, 'url' => home_url( '/' ), 'blogid' => (string) $blog_id, 'blogName' => get_option( 'blogname' ), 'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ), ); restore_current_blog(); } return $struct; } protected function minimum_args( $args, $count ) { if ( ! is_array( $args ) || count( $args ) < $count ) { $this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) ); return false; } return true; } protected function _prepare_taxonomy( $taxonomy, $fields ) { $_taxonomy = array( 'name' => $taxonomy->name, 'label' => $taxonomy->label, 'hierarchical' => (bool) $taxonomy->hierarchical, 'public' => (bool) $taxonomy->public, 'show_ui' => (bool) $taxonomy->show_ui, '_builtin' => (bool) $taxonomy->_builtin, ); if ( in_array( 'labels', $fields, true ) ) { $_taxonomy['labels'] = (array) $taxonomy->labels; } if ( in_array( 'cap', $fields, true ) ) { $_taxonomy['cap'] = (array) $taxonomy->cap; } if ( in_array( 'menu', $fields, true ) ) { $_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu; } if ( in_array( 'object_type', $fields, true ) ) { $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type ); } return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); } protected function _prepare_term( $term ) { $_term = $term; if ( ! is_array( $_term ) ) { $_term = get_object_vars( $_term ); } $_term['term_id'] = (string) $_term['term_id']; $_term['term_group'] = (string) $_term['term_group']; $_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id']; $_term['parent'] = (string) $_term['parent']; $_term['count'] = (int) $_term['count']; $_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] ); return apply_filters( 'xmlrpc_prepare_term', $_term, $term ); } protected function _convert_date( $date ) { if ( '0000-00-00 00:00:00' === $date ) { return new IXR_Date( '00000000T00:00:00Z' ); } return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) ); } protected function _convert_date_gmt( $date_gmt, $date ) { if ( '0000-00-00 00:00:00' !== $date && '0000-00-00 00:00:00' === $date_gmt ) { return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) ); } return $this->_convert_date( $date_gmt ); } protected function _prepare_post( $post, $fields ) { $_post = array( 'post_id' => (string) $post['ID'] ); $post_fields = array( 'post_title' => $post['post_title'], 'post_date' => $this->_convert_date( $post['post_date'] ), 'post_date_gmt' => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ), 'post_modified' => $this->_convert_date( $post['post_modified'] ), 'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ), 'post_status' => $post['post_status'], 'post_type' => $post['post_type'], 'post_name' => $post['post_name'], 'post_author' => $post['post_author'], 'post_password' => $post['post_password'], 'post_excerpt' => $post['post_excerpt'], 'post_content' => $post['post_content'], 'post_parent' => (string) $post['post_parent'], 'post_mime_type' => $post['post_mime_type'], 'link' => get_permalink( $post['ID'] ), 'guid' => $post['guid'], 'menu_order' => (int) $post['menu_order'], 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], 'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ), ); $post_fields['post_thumbnail'] = array(); $thumbnail_id = get_post_thumbnail_id( $post['ID'] ); if ( $thumbnail_id ) { $thumbnail_size = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail'; $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size ); } if ( 'future' === $post_fields['post_status'] ) { $post_fields['post_status'] = 'publish'; } $post_fields['post_format'] = get_post_format( $post['ID'] ); if ( empty( $post_fields['post_format'] ) ) { $post_fields['post_format'] = 'standard'; } if ( in_array( 'post', $fields, true ) ) { $_post = array_merge( $_post, $post_fields ); } else { $requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) ); $_post = array_merge( $_post, $requested_fields ); } $all_taxonomy_fields = in_array( 'taxonomies', $fields, true ); if ( $all_taxonomy_fields || in_array( 'terms', $fields, true ) ) { $post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' ); $terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies ); $_post['terms'] = array(); foreach ( $terms as $term ) { $_post['terms'][] = $this->_prepare_term( $term ); } } if ( in_array( 'custom_fields', $fields, true ) ) { $_post['custom_fields'] = $this->get_custom_fields( $post['ID'] ); } if ( in_array( 'enclosure', $fields, true ) ) { $_post['enclosure'] = array(); $enclosures = (array) get_post_meta( $post['ID'], 'enclosure' ); if ( ! empty( $enclosures ) ) { $encdata = explode( "\n", $enclosures[0] ); $_post['enclosure']['url'] = trim( htmlspecialchars( $encdata[0] ) ); $_post['enclosure']['length'] = (int) trim( $encdata[1] ); $_post['enclosure']['type'] = trim( $encdata[2] ); } } return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields ); } protected function _prepare_post_type( $post_type, $fields ) { $_post_type = array( 'name' => $post_type->name, 'label' => $post_type->label, 'hierarchical' => (bool) $post_type->hierarchical, 'public' => (bool) $post_type->public, 'show_ui' => (bool) $post_type->show_ui, '_builtin' => (bool) $post_type->_builtin, 'has_archive' => (bool) $post_type->has_archive, 'supports' => get_all_post_type_supports( $post_type->name ), ); if ( in_array( 'labels', $fields, true ) ) { $_post_type['labels'] = (array) $post_type->labels; } if ( in_array( 'cap', $fields, true ) ) { $_post_type['cap'] = (array) $post_type->cap; $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap; } if ( in_array( 'menu', $fields, true ) ) { $_post_type['menu_position'] = (int) $post_type->menu_position; $_post_type['menu_icon'] = $post_type->menu_icon; $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu; } if ( in_array( 'taxonomies', $fields, true ) ) { $_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' ); } return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type ); } protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) { $_media_item = array( 'attachment_id' => (string) $media_item->ID, 'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ), 'parent' => $media_item->post_parent, 'link' => wp_get_attachment_url( $media_item->ID ), 'title' => $media_item->post_title, 'caption' => $media_item->post_excerpt, 'description' => $media_item->post_content, 'metadata' => wp_get_attachment_metadata( $media_item->ID ), 'type' => $media_item->post_mime_type, ); $thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size ); if ( $thumbnail_src ) { $_media_item['thumbnail'] = $thumbnail_src[0]; } else { $_media_item['thumbnail'] = $_media_item['link']; } return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size ); } protected function _prepare_page( $page ) { $full_page = get_extended( $page->post_content ); $link = get_permalink( $page->ID ); $parent_title = ''; if ( ! empty( $page->post_parent ) ) { $parent = get_post( $page->post_parent ); $parent_title = $parent->post_title; } $allow_comments = comments_open( $page->ID ) ? 1 : 0; $allow_pings = pings_open( $page->ID ) ? 1 : 0; $page_date = $this->_convert_date( $page->post_date ); $page_date_gmt = $this->_convert_date_gmt( $page->post_date_gmt, $page->post_date ); $categories = array(); if ( is_object_in_taxonomy( 'page', 'category' ) ) { foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) { $categories[] = get_cat_name( $cat_id ); } } $author = get_userdata( $page->post_author ); $page_template = get_page_template_slug( $page->ID ); if ( empty( $page_template ) ) { $page_template = 'default'; } $_page = array( 'dateCreated' => $page_date, 'userid' => $page->post_author, 'page_id' => $page->ID, 'page_status' => $page->post_status, 'description' => $full_page['main'], 'title' => $page->post_title, 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'excerpt' => $page->post_excerpt, 'text_more' => $full_page['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'wp_slug' => $page->post_name, 'wp_password' => $page->post_password, 'wp_author' => $author->display_name, 'wp_page_parent_id' => $page->post_parent, 'wp_page_parent_title' => $parent_title, 'wp_page_order' => $page->menu_order, 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $page_date_gmt, 'custom_fields' => $this->get_custom_fields( $page->ID ), 'wp_page_template' => $page_template, ); return apply_filters( 'xmlrpc_prepare_page', $_page, $page ); } protected function _prepare_comment( $comment ) { $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date ); if ( '0' == $comment->comment_approved ) { $comment_status = 'hold'; } elseif ( 'spam' === $comment->comment_approved ) { $comment_status = 'spam'; } elseif ( '1' == $comment->comment_approved ) { $comment_status = 'approve'; } else { $comment_status = $comment->comment_approved; } $_comment = array( 'date_created_gmt' => $comment_date_gmt, 'user_id' => $comment->user_id, 'comment_id' => $comment->comment_ID, 'parent' => $comment->comment_parent, 'status' => $comment_status, 'content' => $comment->comment_content, 'link' => get_comment_link( $comment ), 'post_id' => $comment->comment_post_ID, 'post_title' => get_the_title( $comment->comment_post_ID ), 'author' => $comment->comment_author, 'author_url' => $comment->comment_author_url, 'author_email' => $comment->comment_author_email, 'author_ip' => $comment->comment_author_IP, 'type' => $comment->comment_type, ); return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment ); } protected function _prepare_user( $user, $fields ) { $_user = array( 'user_id' => (string) $user->ID ); $user_fields = array( 'username' => $user->user_login, 'first_name' => $user->user_firstname, 'last_name' => $user->user_lastname, 'registered' => $this->_convert_date( $user->user_registered ), 'bio' => $user->user_description, 'email' => $user->user_email, 'nickname' => $user->nickname, 'nicename' => $user->user_nicename, 'url' => $user->user_url, 'display_name' => $user->display_name, 'roles' => $user->roles, ); if ( in_array( 'all', $fields, true ) ) { $_user = array_merge( $_user, $user_fields ); } else { if ( in_array( 'basic', $fields, true ) ) { $basic_fields = array( 'username', 'email', 'registered', 'display_name', 'nicename' ); $fields = array_merge( $fields, $basic_fields ); } $requested_fields = array_intersect_key( $user_fields, array_flip( $fields ) ); $_user = array_merge( $_user, $requested_fields ); } return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields ); } public function wp_newPost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) { $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] ); } if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) { if ( '0000-00-00 00:00:00' === $content_struct['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $content_struct['post_date_gmt'] ); } else { $content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] ); } } do_action( 'xmlrpc_call', 'wp.newPost', $args, $this ); unset( $content_struct['ID'] ); return $this->_insert_post( $user, $content_struct ); } private function _is_greater_than_one( $count ) { return $count > 1; } private function _toggle_sticky( $post_data, $update = false ) { $post_type = get_post_type_object( $post_data['post_type'] ); if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) { if ( ! empty( $post_data['sticky'] ) ) { return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) ); } if ( $update ) { unstick_post( $post_data['ID'] ); } } elseif ( isset( $post_data['sticky'] ) ) { if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to make posts sticky.' ) ); } $sticky = wp_validate_boolean( $post_data['sticky'] ); if ( $sticky ) { stick_post( $post_data['ID'] ); } else { unstick_post( $post_data['ID'] ); } } } protected function _insert_post( $user, $content_struct ) { $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => null, 'post_password' => null, 'post_excerpt' => null, 'post_content' => null, 'post_title' => null, 'post_date' => null, 'post_date_gmt' => null, 'post_format' => null, 'post_name' => null, 'post_thumbnail' => null, 'post_parent' => null, 'ping_status' => null, 'comment_status' => null, 'custom_fields' => null, 'terms_names' => null, 'terms' => null, 'sticky' => null, 'enclosure' => null, 'ID' => null, ); $post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults ); $post_type = get_post_type_object( $post_data['post_type'] ); if ( ! $post_type ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } $update = ! empty( $post_data['ID'] ); if ( $update ) { if ( ! get_post( $post_data['ID'] ) ) { return new IXR_Error( 401, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( get_post_type( $post_data['ID'] ) !== $post_data['post_type'] ) { return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); } } else { if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); } } switch ( $post_data['post_status'] ) { case 'draft': case 'pending': break; case 'private': if ( ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type.' ) ); } break; case 'publish': case 'future': if ( ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type.' ) ); } break; default: if ( ! get_post_status_object( $post_data['post_status'] ) ) { $post_data['post_status'] = 'draft'; } break; } if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type.' ) ); } $post_data['post_author'] = absint( $post_data['post_author'] ); if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) ); } $author = get_userdata( $post_data['post_author'] ); if ( ! $author ) { return new IXR_Error( 404, __( 'Invalid author ID.' ) ); } } else { $post_data['post_author'] = $user->ID; } if ( isset( $post_data['comment_status'] ) && 'open' !== $post_data['comment_status'] && 'closed' !== $post_data['comment_status'] ) { unset( $post_data['comment_status'] ); } if ( isset( $post_data['ping_status'] ) && 'open' !== $post_data['ping_status'] && 'closed' !== $post_data['ping_status'] ) { unset( $post_data['ping_status'] ); } if ( ! empty( $post_data['post_date_gmt'] ) ) { $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $post_data['post_date'] ) ) { $dateCreated = $post_data['post_date']->getIso(); } $post_data['edit_date'] = false; if ( ! empty( $dateCreated ) ) { $post_data['post_date'] = iso8601_to_datetime( $dateCreated ); $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' ); $post_data['edit_date'] = true; } if ( ! isset( $post_data['ID'] ) ) { $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID; } $post_ID = $post_data['ID']; if ( 'post' === $post_data['post_type'] ) { $error = $this->_toggle_sticky( $post_data, $update ); if ( $error ) { return $error; } } if ( isset( $post_data['post_thumbnail'] ) ) { if ( ! $post_data['post_thumbnail'] ) { delete_post_thumbnail( $post_ID ); } elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ); unset( $content_struct['post_thumbnail'] ); } if ( isset( $post_data['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $post_data['custom_fields'] ); } if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) { $post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' ); $terms = array(); if ( isset( $post_data['terms'] ) && is_array( $post_data['terms'] ) ) { $taxonomies = array_keys( $post_data['terms'] ); foreach ( $taxonomies as $taxonomy ) { if ( ! array_key_exists( $taxonomy, $post_type_taxonomies ) ) { return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); } if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) ); } $term_ids = $post_data['terms'][ $taxonomy ]; $terms[ $taxonomy ] = array(); foreach ( $term_ids as $term_id ) { $term = get_term_by( 'id', $term_id, $taxonomy ); if ( ! $term ) { return new IXR_Error( 403, __( 'Invalid term ID.' ) ); } $terms[ $taxonomy ][] = (int) $term_id; } } } if ( isset( $post_data['terms_names'] ) && is_array( $post_data['terms_names'] ) ) { $taxonomies = array_keys( $post_data['terms_names'] ); foreach ( $taxonomies as $taxonomy ) { if ( ! array_key_exists( $taxonomy, $post_type_taxonomies ) ) { return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); } if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) ); } $ambiguous_terms = array(); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $tax_term_names = get_terms( array( 'taxonomy' => $taxonomy, 'fields' => 'names', 'hide_empty' => false, ) ); $tax_term_names_count = array_count_values( $tax_term_names ); $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one' ) ); $ambiguous_terms = array_keys( $ambiguous_tax_term_counts ); } $term_names = $post_data['terms_names'][ $taxonomy ]; foreach ( $term_names as $term_name ) { if ( in_array( $term_name, $ambiguous_terms, true ) ) { return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) ); } $term = get_term_by( 'name', $term_name, $taxonomy ); if ( ! $term ) { if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->edit_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) ); } $term_info = wp_insert_term( $term_name, $taxonomy ); if ( is_wp_error( $term_info ) ) { return new IXR_Error( 500, $term_info->get_error_message() ); } $terms[ $taxonomy ][] = (int) $term_info['term_id']; } else { $terms[ $taxonomy ][] = (int) $term->term_id; } } } } $post_data['tax_input'] = $terms; unset( $post_data['terms'], $post_data['terms_names'] ); } if ( isset( $post_data['post_format'] ) ) { $format = set_post_format( $post_ID, $post_data['post_format'] ); if ( is_wp_error( $format ) ) { return new IXR_Error( 500, $format->get_error_message() ); } unset( $post_data['post_format'] ); } $enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $enclosure ); $this->attach_uploads( $post_ID, $post_data['post_content'] ); $post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct ); $post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { if ( $update ) { return new IXR_Error( 401, __( 'Sorry, the post could not be updated.' ) ); } else { return new IXR_Error( 401, __( 'Sorry, the post could not be created.' ) ); } } return (string) $post_ID; } public function wp_editPost( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editPost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( isset( $content_struct['if_not_modified_since'] ) ) { if ( mysql2date( 'U', $post['post_modified_gmt'] ) > $content_struct['if_not_modified_since']->getTimestamp() ) { return new IXR_Error( 409, __( 'There is a revision of this post that is more recent.' ) ); } } $post['post_date'] = $this->_convert_date( $post['post_date'] ); if ( '0000-00-00 00:00:00' === $post['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $post['post_date_gmt'] ); } else { $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); } if ( ! isset( $content_struct['post_date'] ) ) { unset( $post['post_date'] ); } $this->escape( $post ); $merged_content_struct = array_merge( $post, $content_struct ); $retval = $this->_insert_post( $user, $merged_content_struct ); if ( $retval instanceof IXR_Error ) { return $retval; } return true; } public function wp_deletePost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deletePost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'delete_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); } $result = wp_delete_post( $post_id ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) ); } return true; } public function wp_getPost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } return $this->_prepare_post( $post, $fields ); } public function wp_getPosts( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array(); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPosts', $args, $this ); $query = array(); if ( isset( $filter['post_type'] ) ) { $post_type = get_post_type_object( $filter['post_type'] ); if ( ! ( (bool) $post_type ) ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } } else { $post_type = get_post_type_object( 'post' ); } if ( ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); } $query['post_type'] = $post_type->name; if ( isset( $filter['post_status'] ) ) { $query['post_status'] = $filter['post_status']; } if ( isset( $filter['number'] ) ) { $query['numberposts'] = absint( $filter['number'] ); } if ( isset( $filter['offset'] ) ) { $query['offset'] = absint( $filter['offset'] ); } if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['s'] ) ) { $query['s'] = $filter['s']; } $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { return array(); } $struct = array(); foreach ( $posts_list as $post ) { if ( ! current_user_can( 'edit_post', $post['ID'] ) ) { continue; } $struct[] = $this->_prepare_post( $post, $fields ); } return $struct; } public function wp_newTerm( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newTerm', $args, $this ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) ); } $taxonomy = (array) $taxonomy; $term_data = array(); $term_data['name'] = trim( $content_struct['name'] ); if ( empty( $term_data['name'] ) ) { return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); } if ( isset( $content_struct['parent'] ) ) { if ( ! $taxonomy['hierarchical'] ) { return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) ); } $parent_term_id = (int) $content_struct['parent']; $parent_term = get_term( $parent_term_id, $taxonomy['name'] ); if ( is_wp_error( $parent_term ) ) { return new IXR_Error( 500, $parent_term->get_error_message() ); } if ( ! $parent_term ) { return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); } $term_data['parent'] = $content_struct['parent']; } if ( isset( $content_struct['description'] ) ) { $term_data['description'] = $content_struct['description']; } if ( isset( $content_struct['slug'] ) ) { $term_data['slug'] = $content_struct['slug']; } $term = wp_insert_term( $term_data['name'], $taxonomy['name'], $term_data ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 500, __( 'Sorry, the term could not be created.' ) ); } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] ); } return (string) $term['term_id']; } public function wp_editTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $term_id = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editTerm', $args, $this ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); $taxonomy = (array) $taxonomy; $term_data = array(); $term = get_term( $term_id, $content_struct['taxonomy'] ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'edit_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this term.' ) ); } if ( isset( $content_struct['name'] ) ) { $term_data['name'] = trim( $content_struct['name'] ); if ( empty( $term_data['name'] ) ) { return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); } } if ( ! empty( $content_struct['parent'] ) ) { if ( ! $taxonomy['hierarchical'] ) { return new IXR_Error( 403, __( 'Cannot set parent term, taxonomy is not hierarchical.' ) ); } $parent_term_id = (int) $content_struct['parent']; $parent_term = get_term( $parent_term_id, $taxonomy['name'] ); if ( is_wp_error( $parent_term ) ) { return new IXR_Error( 500, $parent_term->get_error_message() ); } if ( ! $parent_term ) { return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); } $term_data['parent'] = $content_struct['parent']; } if ( isset( $content_struct['description'] ) ) { $term_data['description'] = $content_struct['description']; } if ( isset( $content_struct['slug'] ) ) { $term_data['slug'] = $content_struct['slug']; } $term = wp_update_term( $term_id, $taxonomy['name'], $term_data ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) ); } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_term_custom_fields( $term_id, $content_struct['custom_fields'] ); } return true; } public function wp_deleteTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $term_id = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deleteTerm', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); $term = get_term( $term_id, $taxonomy->name ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'delete_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this term.' ) ); } $result = wp_delete_term( $term_id, $taxonomy->name ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) ); } return $result; } public function wp_getTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $term_id = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTerm', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); $term = get_term( $term_id, $taxonomy->name, ARRAY_A ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'assign_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign this term.' ) ); } return $this->_prepare_term( $term ); } public function wp_getTerms( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $filter = isset( $args[4] ) ? $args[4] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTerms', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) ); } $query = array( 'taxonomy' => $taxonomy->name ); if ( isset( $filter['number'] ) ) { $query['number'] = absint( $filter['number'] ); } if ( isset( $filter['offset'] ) ) { $query['offset'] = absint( $filter['offset'] ); } if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['hide_empty'] ) ) { $query['hide_empty'] = $filter['hide_empty']; } else { $query['get'] = 'all'; } if ( isset( $filter['search'] ) ) { $query['search'] = $filter['search']; } $terms = get_terms( $query ); if ( is_wp_error( $terms ) ) { return new IXR_Error( 500, $terms->get_error_message() ); } $struct = array(); foreach ( $terms as $term ) { $struct[] = $this->_prepare_term( $term ); } return $struct; } public function wp_getTaxonomy( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTaxonomy', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) ); } return $this->_prepare_taxonomy( $taxonomy, $fields ); } public function wp_getTaxonomies( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTaxonomies', $args, $this ); $taxonomies = get_taxonomies( $filter, 'objects' ); $struct = array(); foreach ( $taxonomies as $taxonomy ) { if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { continue; } $struct[] = $this->_prepare_taxonomy( $taxonomy, $fields ); } return $struct; } public function wp_getUser( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUser', $args, $this ); if ( ! current_user_can( 'edit_user', $user_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this user.' ) ); } $user_data = get_userdata( $user_id ); if ( ! $user_data ) { return new IXR_Error( 404, __( 'Invalid user ID.' ) ); } return $this->_prepare_user( $user_data, $fields ); } public function wp_getUsers( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array(); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUsers', $args, $this ); if ( ! current_user_can( 'list_users' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to list users.' ) ); } $query = array( 'fields' => 'all_with_meta' ); $query['number'] = ( isset( $filter['number'] ) ) ? absint( $filter['number'] ) : 50; $query['offset'] = ( isset( $filter['offset'] ) ) ? absint( $filter['offset'] ) : 0; if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['role'] ) ) { if ( get_role( $filter['role'] ) === null ) { return new IXR_Error( 403, __( 'Invalid role.' ) ); } $query['role'] = $filter['role']; } if ( isset( $filter['who'] ) ) { $query['who'] = $filter['who']; } $users = get_users( $query ); $_users = array(); foreach ( $users as $user_data ) { if ( current_user_can( 'edit_user', $user_data->ID ) ) { $_users[] = $this->_prepare_user( $user_data, $fields ); } } return $_users; } public function wp_getProfile( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $fields = $args[3]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getProfile', $args, $this ); if ( ! current_user_can( 'edit_user', $user->ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) ); } $user_data = get_userdata( $user->ID ); return $this->_prepare_user( $user_data, $fields ); } public function wp_editProfile( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editProfile', $args, $this ); if ( ! current_user_can( 'edit_user', $user->ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) ); } $user_data = array(); $user_data['ID'] = $user->ID; if ( isset( $content_struct['first_name'] ) ) { $user_data['first_name'] = $content_struct['first_name']; } if ( isset( $content_struct['last_name'] ) ) { $user_data['last_name'] = $content_struct['last_name']; } if ( isset( $content_struct['url'] ) ) { $user_data['user_url'] = $content_struct['url']; } if ( isset( $content_struct['display_name'] ) ) { $user_data['display_name'] = $content_struct['display_name']; } if ( isset( $content_struct['nickname'] ) ) { $user_data['nickname'] = $content_struct['nickname']; } if ( isset( $content_struct['nicename'] ) ) { $user_data['user_nicename'] = $content_struct['nicename']; } if ( isset( $content_struct['bio'] ) ) { $user_data['description'] = $content_struct['bio']; } $result = wp_update_user( $user_data ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the user could not be updated.' ) ); } return true; } public function wp_getPage( $args ) { $this->escape( $args ); $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $page = get_post( $page_id ); if ( ! $page ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) ); } do_action( 'xmlrpc_call', 'wp.getPage', $args, $this ); if ( $page->ID && ( 'page' === $page->post_type ) ) { return $this->_prepare_page( $page ); } else { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } } public function wp_getPages( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $num_pages = isset( $args[3] ) ? (int) $args[3] : 10; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit pages.' ) ); } do_action( 'xmlrpc_call', 'wp.getPages', $args, $this ); $pages = get_posts( array( 'post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages, ) ); $num_pages = count( $pages ); if ( $num_pages >= 1 ) { $pages_struct = array(); foreach ( $pages as $page ) { if ( current_user_can( 'edit_page', $page->ID ) ) { $pages_struct[] = $this->_prepare_page( $page ); } } return $pages_struct; } return array(); } public function wp_newPage( $args ) { $username = $this->escape( $args[1] ); $password = $this->escape( $args[2] ); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newPage', $args, $this ); $args[3]['post_type'] = 'page'; return $this->mw_newPost( $args ); } public function wp_deletePage( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $page_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deletePage', $args, $this ); $actual_page = get_post( $page_id, ARRAY_A ); if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } if ( ! current_user_can( 'delete_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this page.' ) ); } $result = wp_delete_post( $page_id ); if ( ! $result ) { return new IXR_Error( 500, __( 'Failed to delete the page.' ) ); } do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args ); return true; } public function wp_editPage( $args ) { $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $escaped_username = $this->escape( $username ); $escaped_password = $this->escape( $password ); $user = $this->login( $escaped_username, $escaped_password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editPage', $args, $this ); $actual_page = get_post( $page_id, ARRAY_A ); if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } if ( ! current_user_can( 'edit_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) ); } $content['post_type'] = 'page'; $args = array( $page_id, $username, $password, $content, $publish, ); return $this->mw_editPost( $args ); } public function wp_getPageList( $args ) { global $wpdb; $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit pages.' ) ); } do_action( 'xmlrpc_call', 'wp.getPageList', $args, $this ); $page_list = $wpdb->get_results( " + SELECT ID page_id, + post_title page_title, + post_parent page_parent_id, + post_date_gmt, + post_date, + post_status + FROM {$wpdb->posts} + WHERE post_type = 'page' + ORDER BY ID + " ); $num_pages = count( $page_list ); for ( $i = 0; $i < $num_pages; $i++ ) { $page_list[ $i ]->dateCreated = $this->_convert_date( $page_list[ $i ]->post_date ); $page_list[ $i ]->date_created_gmt = $this->_convert_date_gmt( $page_list[ $i ]->post_date_gmt, $page_list[ $i ]->post_date ); unset( $page_list[ $i ]->post_date_gmt ); unset( $page_list[ $i ]->post_date ); unset( $page_list[ $i ]->post_status ); } return $page_list; } public function wp_getAuthors( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'wp.getAuthors', $args, $this ); $authors = array(); foreach ( get_users( array( 'fields' => array( 'ID', 'user_login', 'display_name' ) ) ) as $user ) { $authors[] = array( 'user_id' => $user->ID, 'user_login' => $user->user_login, 'display_name' => $user->display_name, ); } return $authors; } public function wp_getTags( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); } do_action( 'xmlrpc_call', 'wp.getKeywords', $args, $this ); $tags = array(); $all_tags = get_tags(); if ( $all_tags ) { foreach ( (array) $all_tags as $tag ) { $struct = array(); $struct['tag_id'] = $tag->term_id; $struct['name'] = $tag->name; $struct['count'] = $tag->count; $struct['slug'] = $tag->slug; $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) ); $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) ); $tags[] = $struct; } } return $tags; } public function wp_newCategory( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newCategory', $args, $this ); if ( ! current_user_can( 'manage_categories' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a category.' ) ); } if ( empty( $category['slug'] ) ) { $category['slug'] = ''; } if ( ! isset( $category['parent_id'] ) ) { $category['parent_id'] = ''; } if ( empty( $category['description'] ) ) { $category['description'] = ''; } $new_category = array( 'cat_name' => $category['name'], 'category_nicename' => $category['slug'], 'category_parent' => $category['parent_id'], 'category_description' => $category['description'], ); $cat_id = wp_insert_category( $new_category, true ); if ( is_wp_error( $cat_id ) ) { if ( 'term_exists' === $cat_id->get_error_code() ) { return (int) $cat_id->get_error_data(); } else { return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) ); } } elseif ( ! $cat_id ) { return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) ); } do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args ); return $cat_id; } public function wp_deleteCategory( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deleteCategory', $args, $this ); if ( ! current_user_can( 'delete_term', $category_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this category.' ) ); } $status = wp_delete_term( $category_id, 'category' ); if ( true == $status ) { do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); } return $status; } public function wp_suggestCategories( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category = $args[3]; $max_results = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'wp.suggestCategories', $args, $this ); $category_suggestions = array(); $args = array( 'get' => 'all', 'number' => $max_results, 'name__like' => $category, ); foreach ( (array) get_categories( $args ) as $cat ) { $category_suggestions[] = array( 'category_id' => $cat->term_id, 'category_name' => $cat->name, ); } return $category_suggestions; } public function wp_getComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getComment', $args, $this ); $comment = get_comment( $comment_id ); if ( ! $comment ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); } return $this->_prepare_comment( $comment ); } public function wp_getComments( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $struct = isset( $args[3] ) ? $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getComments', $args, $this ); if ( isset( $struct['status'] ) ) { $status = $struct['status']; } else { $status = ''; } if ( ! current_user_can( 'moderate_comments' ) && 'approve' !== $status ) { return new IXR_Error( 401, __( 'Invalid comment status.' ) ); } $post_id = ''; if ( isset( $struct['post_id'] ) ) { $post_id = absint( $struct['post_id'] ); } $post_type = ''; if ( isset( $struct['post_type'] ) ) { $post_type_object = get_post_type_object( $struct['post_type'] ); if ( ! $post_type_object || ! post_type_supports( $post_type_object->name, 'comments' ) ) { return new IXR_Error( 404, __( 'Invalid post type.' ) ); } $post_type = $struct['post_type']; } $offset = 0; if ( isset( $struct['offset'] ) ) { $offset = absint( $struct['offset'] ); } $number = 10; if ( isset( $struct['number'] ) ) { $number = absint( $struct['number'] ); } $comments = get_comments( array( 'status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number, 'post_type' => $post_type, ) ); $comments_struct = array(); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { $comments_struct[] = $this->_prepare_comment( $comment ); } } return $comments_struct; } public function wp_deleteComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_ID = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_comment( $comment_ID ) ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_ID ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) ); } do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this ); $status = wp_delete_comment( $comment_ID ); if ( $status ) { do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); } return $status; } public function wp_editComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_ID = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_comment( $comment_ID ) ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_ID ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); } do_action( 'xmlrpc_call', 'wp.editComment', $args, $this ); $comment = array( 'comment_ID' => $comment_ID, ); if ( isset( $content_struct['status'] ) ) { $statuses = get_comment_statuses(); $statuses = array_keys( $statuses ); if ( ! in_array( $content_struct['status'], $statuses, true ) ) { return new IXR_Error( 401, __( 'Invalid comment status.' ) ); } $comment['comment_approved'] = $content_struct['status']; } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; $comment['comment_date'] = get_date_from_gmt( $dateCreated ); $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' ); } if ( isset( $content_struct['content'] ) ) { $comment['comment_content'] = $content_struct['content']; } if ( isset( $content_struct['author'] ) ) { $comment['comment_author'] = $content_struct['author']; } if ( isset( $content_struct['author_url'] ) ) { $comment['comment_author_url'] = $content_struct['author_url']; } if ( isset( $content_struct['author_email'] ) ) { $comment['comment_author_email'] = $content_struct['author_email']; } $result = wp_update_comment( $comment, true ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the comment could not be updated.' ) ); } do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); return true; } public function wp_newComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post = $args[3]; $content_struct = $args[4]; $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false ); $user = $this->login( $username, $password ); if ( ! $user ) { $logged_in = false; if ( $allow_anon && get_option( 'comment_registration' ) ) { return new IXR_Error( 403, __( 'Sorry, you must be logged in to comment.' ) ); } elseif ( ! $allow_anon ) { return $this->error; } } else { $logged_in = true; } if ( is_numeric( $post ) ) { $post_id = absint( $post ); } else { $post_id = url_to_postid( $post ); } if ( ! $post_id ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! get_post( $post_id ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! comments_open( $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, comments are closed for this item.' ) ); } if ( 'publish' === get_post_status( $post_id ) && ! current_user_can( 'edit_post', $post_id ) && post_password_required( $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); } if ( 'private' === get_post_status( $post_id ) && ! current_user_can( 'read_post', $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); } $comment = array( 'comment_post_ID' => $post_id, 'comment_content' => trim( $content_struct['content'] ), ); if ( $logged_in ) { $display_name = $user->display_name; $user_email = $user->user_email; $user_url = $user->user_url; $comment['comment_author'] = $this->escape( $display_name ); $comment['comment_author_email'] = $this->escape( $user_email ); $comment['comment_author_url'] = $this->escape( $user_url ); $comment['user_ID'] = $user->ID; } else { $comment['comment_author'] = ''; if ( isset( $content_struct['author'] ) ) { $comment['comment_author'] = $content_struct['author']; } $comment['comment_author_email'] = ''; if ( isset( $content_struct['author_email'] ) ) { $comment['comment_author_email'] = $content_struct['author_email']; } $comment['comment_author_url'] = ''; if ( isset( $content_struct['author_url'] ) ) { $comment['comment_author_url'] = $content_struct['author_url']; } $comment['user_ID'] = 0; if ( get_option( 'require_name_email' ) ) { if ( strlen( $comment['comment_author_email'] ) < 6 || '' === $comment['comment_author'] ) { return new IXR_Error( 403, __( 'Comment author name and email are required.' ) ); } elseif ( ! is_email( $comment['comment_author_email'] ) ) { return new IXR_Error( 403, __( 'A valid email address is required.' ) ); } } } $comment['comment_parent'] = isset( $content_struct['comment_parent'] ) ? absint( $content_struct['comment_parent'] ) : 0; $allow_empty = apply_filters( 'allow_empty_comment', false, $comment ); if ( ! $allow_empty && '' === $comment['comment_content'] ) { return new IXR_Error( 403, __( 'Comment is required.' ) ); } do_action( 'xmlrpc_call', 'wp.newComment', $args, $this ); $comment_ID = wp_new_comment( $comment, true ); if ( is_wp_error( $comment_ID ) ) { return new IXR_Error( 403, $comment_ID->get_error_message() ); } if ( ! $comment_ID ) { return new IXR_Error( 403, __( 'Something went wrong.' ) ); } do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); return $comment_ID; } public function wp_getCommentStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getCommentStatusList', $args, $this ); return get_comment_statuses(); } public function wp_getCommentCount( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details of this post.' ) ); } do_action( 'xmlrpc_call', 'wp.getCommentCount', $args, $this ); $count = wp_count_comments( $post_id ); return array( 'approved' => $count->approved, 'awaiting_moderation' => $count->moderated, 'spam' => $count->spam, 'total_comments' => $count->total_comments, ); } public function wp_getPostStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPostStatusList', $args, $this ); return get_post_statuses(); } public function wp_getPageStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPageStatusList', $args, $this ); return get_page_statuses(); } public function wp_getPageTemplates( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } $templates = get_page_templates(); $templates['Default'] = 'default'; return $templates; } public function wp_getOptions( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $options = isset( $args[3] ) ? (array) $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( count( $options ) == 0 ) { $options = array_keys( $this->blog_options ); } return $this->_getOptions( $options ); } public function _getOptions( $options ) { $data = array(); $can_manage = current_user_can( 'manage_options' ); foreach ( $options as $option ) { if ( array_key_exists( $option, $this->blog_options ) ) { $data[ $option ] = $this->blog_options[ $option ]; if ( isset( $data[ $option ]['option'] ) ) { $data[ $option ]['value'] = get_option( $data[ $option ]['option'] ); unset( $data[ $option ]['option'] ); } if ( ! $can_manage ) { $data[ $option ]['readonly'] = true; } } } return $data; } public function wp_setOptions( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $options = (array) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'manage_options' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to update options.' ) ); } $option_names = array(); foreach ( $options as $o_name => $o_value ) { $option_names[] = $o_name; if ( ! array_key_exists( $o_name, $this->blog_options ) ) { continue; } if ( true == $this->blog_options[ $o_name ]['readonly'] ) { continue; } update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ) ); } return $this->_getOptions( $option_names ); } public function wp_getMediaItem( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $attachment_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'upload_files' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to upload files.' ) ); } do_action( 'xmlrpc_call', 'wp.getMediaItem', $args, $this ); $attachment = get_post( $attachment_id ); if ( ! $attachment || 'attachment' !== $attachment->post_type ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } return $this->_prepare_media_item( $attachment ); } public function wp_getMediaLibrary( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $struct = isset( $args[3] ) ? $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'upload_files' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to upload files.' ) ); } do_action( 'xmlrpc_call', 'wp.getMediaLibrary', $args, $this ); $parent_id = ( isset( $struct['parent_id'] ) ) ? absint( $struct['parent_id'] ) : ''; $mime_type = ( isset( $struct['mime_type'] ) ) ? $struct['mime_type'] : ''; $offset = ( isset( $struct['offset'] ) ) ? absint( $struct['offset'] ) : 0; $number = ( isset( $struct['number'] ) ) ? absint( $struct['number'] ) : -1; $attachments = get_posts( array( 'post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type, ) ); $attachments_struct = array(); foreach ( $attachments as $attachment ) { $attachments_struct[] = $this->_prepare_media_item( $attachment ); } return $attachments_struct; } public function wp_getPostFormats( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPostFormats', $args, $this ); $formats = get_post_format_strings(); if ( isset( $args[3] ) && is_array( $args[3] ) ) { if ( $args[3]['show-supported'] ) { if ( current_theme_supports( 'post-formats' ) ) { $supported = get_theme_support( 'post-formats' ); $data = array(); $data['all'] = $formats; $data['supported'] = $supported[0]; $formats = $data; } } } return $formats; } public function wp_getPostType( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_type_name = $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPostType', $args, $this ); if ( ! post_type_exists( $post_type_name ) ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } $post_type = get_post_type_object( $post_type_name ); if ( ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); } return $this->_prepare_post_type( $post_type, $fields ); } public function wp_getPostTypes( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPostTypes', $args, $this ); $post_types = get_post_types( $filter, 'objects' ); $struct = array(); foreach ( $post_types as $post_type ) { if ( ! current_user_can( $post_type->cap->edit_posts ) ) { continue; } $struct[ $post_type->name ] = $this->_prepare_post_type( $post_type, $fields ); } return $struct; } public function wp_getRevisions( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getRevisions', $args, $this ); $post = get_post( $post_id ); if ( ! $post ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } if ( ! wp_revisions_enabled( $post ) ) { return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) ); } $revisions = wp_get_post_revisions( $post_id ); if ( ! $revisions ) { return array(); } $struct = array(); foreach ( $revisions as $revision ) { if ( ! current_user_can( 'read_post', $revision->ID ) ) { continue; } if ( wp_is_post_autosave( $revision ) ) { continue; } $struct[] = $this->_prepare_post( get_object_vars( $revision ), $fields ); } return $struct; } public function wp_restoreRevision( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $revision_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.restoreRevision', $args, $this ); $revision = wp_get_post_revision( $revision_id ); if ( ! $revision ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( wp_is_post_autosave( $revision ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } $post = get_post( $revision->post_parent ); if ( ! $post ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! wp_revisions_enabled( $post ) ) { return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) ); } $post = wp_restore_post_revision( $revision_id ); return (bool) $post; } public function blogger_getUsersBlogs( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } if ( is_multisite() ) { return $this->_multisite_getUsersBlogs( $args ); } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.getUsersBlogs', $args, $this ); $is_admin = current_user_can( 'manage_options' ); $struct = array( 'isAdmin' => $is_admin, 'url' => get_option( 'home' ) . '/', 'blogid' => '1', 'blogName' => get_option( 'blogname' ), 'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ), ); return array( $struct ); } protected function _multisite_getUsersBlogs( $args ) { $current_blog = get_site(); $domain = $current_blog->domain; $path = $current_blog->path . 'xmlrpc.php'; $rpc = new IXR_Client( set_url_scheme( "http://{$domain}{$path}" ) ); $rpc->query( 'wp.getUsersBlogs', $args[1], $args[2] ); $blogs = $rpc->getResponse(); if ( isset( $blogs['faultCode'] ) ) { return new IXR_Error( $blogs['faultCode'], $blogs['faultString'] ); } if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) { return $blogs; } else { foreach ( (array) $blogs as $blog ) { if ( strpos( $blog['url'], $_SERVER['HTTP_HOST'] ) ) { return array( $blog ); } } return array(); } } public function blogger_getUserInfo( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to access user data on this site.' ) ); } do_action( 'xmlrpc_call', 'blogger.getUserInfo', $args, $this ); $struct = array( 'nickname' => $user->nickname, 'userid' => $user->ID, 'url' => $user->user_url, 'lastname' => $user->last_name, 'firstname' => $user->first_name, ); return $struct; } public function blogger_getPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $post_data = get_post( $post_ID, ARRAY_A ); if ( ! $post_data ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'blogger.getPost', $args, $this ); $categories = implode( ',', wp_get_post_categories( $post_ID ) ); $content = '' . wp_unslash( $post_data['post_title'] ) . ''; $content .= '' . $categories . ''; $content .= wp_unslash( $post_data['post_content'] ); $struct = array( 'userid' => $post_data['post_author'], 'dateCreated' => $this->_convert_date( $post_data['post_date'] ), 'content' => $content, 'postid' => (string) $post_data['ID'], ); return $struct; } public function blogger_getRecentPosts( $args ) { $this->escape( $args ); $username = $args[2]; $password = $args[3]; if ( isset( $args[4] ) ) { $query = array( 'numberposts' => absint( $args[4] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'blogger.getRecentPosts', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { $this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); return $this->error; } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $categories = implode( ',', wp_get_post_categories( $entry['ID'] ) ); $content = '' . wp_unslash( $entry['post_title'] ) . ''; $content .= '' . $categories . ''; $content .= wp_unslash( $entry['post_content'] ); $recent_posts[] = array( 'userid' => $entry['post_author'], 'dateCreated' => $post_date, 'content' => $content, 'postid' => (string) $entry['ID'], ); } return $recent_posts; } public function blogger_getTemplate( $args ) { return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) ); } public function blogger_setTemplate( $args ) { return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) ); } public function blogger_newPost( $args ) { $this->escape( $args ); $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.newPost', $args, $this ); $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || ! current_user_can( $cap ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); } $post_status = ( $publish ) ? 'publish' : 'draft'; $post_author = $user->ID; $post_title = xmlrpc_getposttitle( $content ); $post_category = xmlrpc_getpostcategory( $content ); $post_content = xmlrpc_removepostdata( $content ); $post_date = current_time( 'mysql' ); $post_date_gmt = current_time( 'mysql', 1 ); $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' ); $post_ID = wp_insert_post( $post_data ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); } $this->attach_uploads( $post_ID, $post_content ); do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args ); return $post_ID; } public function blogger_editPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.editPost', $args, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } $this->escape( $actual_post ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( 'publish' === $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } $postdata = array(); $postdata['ID'] = $actual_post['ID']; $postdata['post_content'] = xmlrpc_removepostdata( $content ); $postdata['post_title'] = xmlrpc_getposttitle( $content ); $postdata['post_category'] = xmlrpc_getpostcategory( $content ); $postdata['post_status'] = $actual_post['post_status']; $postdata['post_excerpt'] = $actual_post['post_excerpt']; $postdata['post_status'] = $publish ? 'publish' : 'draft'; $result = wp_update_post( $postdata ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) ); } $this->attach_uploads( $actual_post['ID'], $postdata['post_content'] ); do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args ); return true; } public function blogger_deletePost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.deletePost', $args, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } if ( ! current_user_can( 'delete_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); } $result = wp_delete_post( $post_ID ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) ); } do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args ); return true; } public function mw_newPost( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $publish = isset( $args[4] ) ? $args[4] : 0; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.newPost', $args, $this ); $page_template = ''; if ( ! empty( $content_struct['post_type'] ) ) { if ( 'page' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_pages'; } elseif ( isset( $content_struct['page_status'] ) && 'publish' === $content_struct['page_status'] ) { $cap = 'publish_pages'; } else { $cap = 'edit_pages'; } $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); $post_type = 'page'; if ( ! empty( $content_struct['wp_page_template'] ) ) { $page_template = $content_struct['wp_page_template']; } } elseif ( 'post' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_posts'; } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; } $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); $post_type = 'post'; } else { return new IXR_Error( 401, __( 'Invalid post type.' ) ); } } else { if ( $publish ) { $cap = 'publish_posts'; } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; } $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); $post_type = 'post'; } if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) ); } if ( ! current_user_can( $cap ) ) { return new IXR_Error( 401, $error_message ); } if ( isset( $content_struct['wp_post_format'] ) ) { $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); if ( ! array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { return new IXR_Error( 404, __( 'Invalid post format.' ) ); } } $post_name = ''; if ( isset( $content_struct['wp_slug'] ) ) { $post_name = $content_struct['wp_slug']; } if ( isset( $content_struct['wp_password'] ) ) { $post_password = $content_struct['wp_password']; } else { $post_password = ''; } if ( isset( $content_struct['wp_page_parent_id'] ) ) { $post_parent = $content_struct['wp_page_parent_id']; } else { $post_parent = 0; } if ( isset( $content_struct['wp_page_order'] ) ) { $menu_order = $content_struct['wp_page_order']; } else { $menu_order = 0; } $post_author = $user->ID; if ( isset( $content_struct['wp_author_id'] ) && ( $user->ID != $content_struct['wp_author_id'] ) ) { switch ( $post_type ) { case 'post': if ( ! current_user_can( 'edit_others_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) ); } break; case 'page': if ( ! current_user_can( 'edit_others_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create pages as this user.' ) ); } break; default: return new IXR_Error( 401, __( 'Invalid post type.' ) ); } $author = get_userdata( $content_struct['wp_author_id'] ); if ( ! $author ) { return new IXR_Error( 404, __( 'Invalid author ID.' ) ); } $post_author = $content_struct['wp_author_id']; } $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; $post_status = $publish ? 'publish' : 'draft'; if ( isset( $content_struct[ "{$post_type}_status" ] ) ) { switch ( $content_struct[ "{$post_type}_status" ] ) { case 'draft': case 'pending': case 'private': case 'publish': $post_status = $content_struct[ "{$post_type}_status" ]; break; default: $post_status = $publish ? 'publish' : 'draft'; break; } } $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null; $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; if ( isset( $content_struct['mt_allow_comments'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_comments'] ) ) { switch ( $content_struct['mt_allow_comments'] ) { case 'closed': $comment_status = 'closed'; break; case 'open': $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } else { switch ( (int) $content_struct['mt_allow_comments'] ) { case 0: case 2: $comment_status = 'closed'; break; case 1: $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } } else { $comment_status = get_default_comment_status( $post_type ); } if ( isset( $content_struct['mt_allow_pings'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_pings'] ) ) { switch ( $content_struct['mt_allow_pings'] ) { case 'closed': $ping_status = 'closed'; break; case 'open': $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } else { switch ( (int) $content_struct['mt_allow_pings'] ) { case 0: $ping_status = 'closed'; break; case 1: $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } } else { $ping_status = get_default_comment_status( $post_type, 'pingback' ); } if ( $post_more ) { $post_content = $post_content . '' . $post_more; } $to_ping = null; if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { $to_ping = $content_struct['mt_tb_ping_urls']; if ( is_array( $to_ping ) ) { $to_ping = implode( ' ', $to_ping ); } } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $content_struct['dateCreated'] ) ) { $dateCreated = $content_struct['dateCreated']->getIso(); } if ( ! empty( $dateCreated ) ) { $post_date = iso8601_to_datetime( $dateCreated ); $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' ); } else { $post_date = ''; $post_date_gmt = ''; } $post_category = array(); if ( isset( $content_struct['categories'] ) ) { $catnames = $content_struct['categories']; if ( is_array( $catnames ) ) { foreach ( $catnames as $cat ) { $post_category[] = get_cat_ID( $cat ); } } } $postdata = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template' ); $post_ID = get_default_post_to_edit( $post_type, true )->ID; $postdata['ID'] = $post_ID; if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $postdata; $data['sticky'] = $content_struct['sticky']; $error = $this->_toggle_sticky( $data ); if ( $error ) { return $error; } } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $content_struct['custom_fields'] ); } if ( isset( $content_struct['wp_post_thumbnail'] ) ) { if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } unset( $content_struct['wp_post_thumbnail'] ); } $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $thisEnclosure ); $this->attach_uploads( $post_ID, $post_content ); if ( isset( $content_struct['wp_post_format'] ) ) { set_post_format( $post_ID, $content_struct['wp_post_format'] ); } $post_ID = wp_insert_post( $postdata, true ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); } do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); return (string) $post_ID; } public function add_enclosure_if_new( $post_ID, $enclosure ) { if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; $found = false; $enclosures = get_post_meta( $post_ID, 'enclosure' ); if ( $enclosures ) { foreach ( $enclosures as $enc ) { if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) { $found = true; break; } } } if ( ! $found ) { add_post_meta( $post_ID, 'enclosure', $encstring ); } } } public function attach_uploads( $post_ID, $post_content ) { global $wpdb; $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); if ( is_array( $attachments ) ) { foreach ( $attachments as $file ) { if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false ) { $wpdb->update( $wpdb->posts, array( 'post_parent' => $post_ID ), array( 'ID' => $file->ID ) ); } } } } public function mw_editPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $publish = isset( $args[4] ) ? $args[4] : 0; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.editPost', $args, $this ); $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata || empty( $postdata['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! in_array( $postdata['post_type'], array( 'post', 'page' ), true ) ) { return new IXR_Error( 401, __( 'Invalid post type.' ) ); } if ( ! empty( $content_struct['post_type'] ) && ( $content_struct['post_type'] != $postdata['post_type'] ) ) { return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); } if ( isset( $content_struct['wp_post_format'] ) ) { $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); if ( ! array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { return new IXR_Error( 404, __( 'Invalid post format.' ) ); } } $this->escape( $postdata ); $ID = $postdata['ID']; $post_content = $postdata['post_content']; $post_title = $postdata['post_title']; $post_excerpt = $postdata['post_excerpt']; $post_password = $postdata['post_password']; $post_parent = $postdata['post_parent']; $post_type = $postdata['post_type']; $menu_order = $postdata['menu_order']; $ping_status = $postdata['ping_status']; $comment_status = $postdata['comment_status']; $post_name = $postdata['post_name']; if ( isset( $content_struct['wp_slug'] ) ) { $post_name = $content_struct['wp_slug']; } if ( isset( $content_struct['wp_password'] ) ) { $post_password = $content_struct['wp_password']; } if ( isset( $content_struct['wp_page_parent_id'] ) ) { $post_parent = $content_struct['wp_page_parent_id']; } if ( isset( $content_struct['wp_page_order'] ) ) { $menu_order = $content_struct['wp_page_order']; } $page_template = null; if ( ! empty( $content_struct['wp_page_template'] ) && 'page' === $post_type ) { $page_template = $content_struct['wp_page_template']; } $post_author = $postdata['post_author']; if ( isset( $content_struct['wp_author_id'] ) ) { if ( $user->ID != $content_struct['wp_author_id'] || $user->ID != $post_author ) { switch ( $post_type ) { case 'post': if ( ! current_user_can( 'edit_others_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the post author as this user.' ) ); } break; case 'page': if ( ! current_user_can( 'edit_others_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the page author as this user.' ) ); } break; default: return new IXR_Error( 401, __( 'Invalid post type.' ) ); } $post_author = $content_struct['wp_author_id']; } } if ( isset( $content_struct['mt_allow_comments'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_comments'] ) ) { switch ( $content_struct['mt_allow_comments'] ) { case 'closed': $comment_status = 'closed'; break; case 'open': $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } else { switch ( (int) $content_struct['mt_allow_comments'] ) { case 0: case 2: $comment_status = 'closed'; break; case 1: $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } } if ( isset( $content_struct['mt_allow_pings'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_pings'] ) ) { switch ( $content_struct['mt_allow_pings'] ) { case 'closed': $ping_status = 'closed'; break; case 'open': $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } else { switch ( (int) $content_struct['mt_allow_pings'] ) { case 0: $ping_status = 'closed'; break; case 1: $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } } if ( isset( $content_struct['title'] ) ) { $post_title = $content_struct['title']; } if ( isset( $content_struct['description'] ) ) { $post_content = $content_struct['description']; } $post_category = array(); if ( isset( $content_struct['categories'] ) ) { $catnames = $content_struct['categories']; if ( is_array( $catnames ) ) { foreach ( $catnames as $cat ) { $post_category[] = get_cat_ID( $cat ); } } } if ( isset( $content_struct['mt_excerpt'] ) ) { $post_excerpt = $content_struct['mt_excerpt']; } $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; $post_status = $publish ? 'publish' : 'draft'; if ( isset( $content_struct[ "{$post_type}_status" ] ) ) { switch ( $content_struct[ "{$post_type}_status" ] ) { case 'draft': case 'pending': case 'private': case 'publish': $post_status = $content_struct[ "{$post_type}_status" ]; break; default: $post_status = $publish ? 'publish' : 'draft'; break; } } $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; if ( 'publish' === $post_status || 'private' === $post_status ) { if ( 'page' === $post_type && ! current_user_can( 'publish_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) ); } elseif ( ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } } if ( $post_more ) { $post_content = $post_content . '' . $post_more; } $to_ping = null; if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { $to_ping = $content_struct['mt_tb_ping_urls']; if ( is_array( $to_ping ) ) { $to_ping = implode( ' ', $to_ping ); } } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $content_struct['dateCreated'] ) ) { $dateCreated = $content_struct['dateCreated']->getIso(); } $edit_date = false; if ( ! empty( $dateCreated ) ) { $post_date = iso8601_to_datetime( $dateCreated ); $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' ); $edit_date = true; } else { $post_date = $postdata['post_date']; $post_date_gmt = $postdata['post_date_gmt']; } $newpost = compact( 'ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'edit_date', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template' ); $result = wp_update_post( $newpost, true ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) ); } if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $newpost; $data['sticky'] = $content_struct['sticky']; $data['post_type'] = 'post'; $error = $this->_toggle_sticky( $data, true ); if ( $error ) { return $error; } } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $content_struct['custom_fields'] ); } if ( isset( $content_struct['wp_post_thumbnail'] ) ) { if ( empty( $content_struct['wp_post_thumbnail'] ) ) { delete_post_thumbnail( $post_ID ); } else { if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } } unset( $content_struct['wp_post_thumbnail'] ); } $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $thisEnclosure ); $this->attach_uploads( $ID, $post_content ); if ( isset( $content_struct['wp_post_format'] ) ) { set_post_format( $post_ID, $content_struct['wp_post_format'] ); } do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args ); return true; } public function mw_getPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getPost', $args, $this ); if ( '' !== $postdata['post_date'] ) { $post_date = $this->_convert_date( $postdata['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] ); $post_modified = $this->_convert_date( $postdata['post_modified'] ); $post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] ); $categories = array(); $catids = wp_get_post_categories( $post_ID ); foreach ( $catids as $catid ) { $categories[] = get_cat_name( $catid ); } $tagnames = array(); $tags = wp_get_post_tags( $post_ID ); if ( ! empty( $tags ) ) { foreach ( $tags as $tag ) { $tagnames[] = $tag->name; } $tagnames = implode( ', ', $tagnames ); } else { $tagnames = ''; } $post = get_extended( $postdata['post_content'] ); $link = get_permalink( $postdata['ID'] ); $author = get_userdata( $postdata['post_author'] ); $allow_comments = ( 'open' === $postdata['comment_status'] ) ? 1 : 0; $allow_pings = ( 'open' === $postdata['ping_status'] ) ? 1 : 0; if ( 'future' === $postdata['post_status'] ) { $postdata['post_status'] = 'publish'; } $post_format = get_post_format( $post_ID ); if ( empty( $post_format ) ) { $post_format = 'standard'; } $sticky = false; if ( is_sticky( $post_ID ) ) { $sticky = true; } $enclosure = array(); foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $encdata = explode( "\n", $enc ); $enclosure['url'] = trim( htmlspecialchars( $encdata[0] ) ); $enclosure['length'] = (int) trim( $encdata[1] ); $enclosure['type'] = trim( $encdata[2] ); break 2; } } } $resp = array( 'dateCreated' => $post_date, 'userid' => $postdata['post_author'], 'postid' => $postdata['ID'], 'description' => $post['main'], 'title' => $postdata['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $postdata['post_excerpt'], 'mt_text_more' => $post['extended'], 'wp_more_text' => $post['more_text'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $postdata['post_name'], 'wp_password' => $postdata['post_password'], 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $post_date_gmt, 'post_status' => $postdata['post_status'], 'custom_fields' => $this->get_custom_fields( $post_ID ), 'wp_post_format' => $post_format, 'sticky' => $sticky, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, ); if ( ! empty( $enclosure ) ) { $resp['enclosure'] = $enclosure; } $resp['wp_post_thumbnail'] = get_post_thumbnail_id( $postdata['ID'] ); return $resp; } else { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } } public function mw_getRecentPosts( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $query = array( 'numberposts' => absint( $args[3] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { return array(); } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] ); $post_modified = $this->_convert_date( $entry['post_modified'] ); $post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] ); $categories = array(); $catids = wp_get_post_categories( $entry['ID'] ); foreach ( $catids as $catid ) { $categories[] = get_cat_name( $catid ); } $tagnames = array(); $tags = wp_get_post_tags( $entry['ID'] ); if ( ! empty( $tags ) ) { foreach ( $tags as $tag ) { $tagnames[] = $tag->name; } $tagnames = implode( ', ', $tagnames ); } else { $tagnames = ''; } $post = get_extended( $entry['post_content'] ); $link = get_permalink( $entry['ID'] ); $author = get_userdata( $entry['post_author'] ); $allow_comments = ( 'open' === $entry['comment_status'] ) ? 1 : 0; $allow_pings = ( 'open' === $entry['ping_status'] ) ? 1 : 0; if ( 'future' === $entry['post_status'] ) { $entry['post_status'] = 'publish'; } $post_format = get_post_format( $entry['ID'] ); if ( empty( $post_format ) ) { $post_format = 'standard'; } $recent_posts[] = array( 'dateCreated' => $post_date, 'userid' => $entry['post_author'], 'postid' => (string) $entry['ID'], 'description' => $post['main'], 'title' => $entry['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'wp_more_text' => $post['more_text'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $entry['post_name'], 'wp_password' => $entry['post_password'], 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $post_date_gmt, 'post_status' => $entry['post_status'], 'custom_fields' => $this->get_custom_fields( $entry['ID'] ), 'wp_post_format' => $post_format, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, 'sticky' => ( 'post' === $entry['post_type'] && is_sticky( $entry['ID'] ) ), 'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] ), ); } return $recent_posts; } public function mw_getCategories( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getCategories', $args, $this ); $categories_struct = array(); $cats = get_categories( array( 'get' => 'all' ) ); if ( $cats ) { foreach ( $cats as $cat ) { $struct = array(); $struct['categoryId'] = $cat->term_id; $struct['parentId'] = $cat->parent; $struct['description'] = $cat->name; $struct['categoryDescription'] = $cat->description; $struct['categoryName'] = $cat->name; $struct['htmlUrl'] = esc_html( get_category_link( $cat->term_id ) ); $struct['rssUrl'] = esc_html( get_category_feed_link( $cat->term_id, 'rss2' ) ); $categories_struct[] = $struct; } } return $categories_struct; } public function mw_newMediaObject( $args ) { global $wpdb; $username = $this->escape( $args[1] ); $password = $this->escape( $args[2] ); $data = $args[3]; $name = sanitize_file_name( $data['name'] ); $type = $data['type']; $bits = $data['bits']; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject', $args, $this ); if ( ! current_user_can( 'upload_files' ) ) { $this->error = new IXR_Error( 401, __( 'Sorry, you are not allowed to upload files.' ) ); return $this->error; } if ( is_multisite() && upload_is_user_over_quota( false ) ) { $this->error = new IXR_Error( 401, sprintf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( get_space_allowed() * MB_IN_BYTES ) ) ); return $this->error; } $upload_err = apply_filters( 'pre_upload_error', false ); if ( $upload_err ) { return new IXR_Error( 500, $upload_err ); } $upload = wp_upload_bits( $name, null, $bits ); if ( ! empty( $upload['error'] ) ) { $errorString = sprintf( __( 'Could not write file %1$s (%2$s).' ), $name, $upload['error'] ); return new IXR_Error( 500, $errorString ); } $post_id = 0; if ( ! empty( $data['post_id'] ) ) { $post_id = (int) $data['post_id']; if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } } $attachment = array( 'post_title' => $name, 'post_content' => '', 'post_type' => 'attachment', 'post_parent' => $post_id, 'post_mime_type' => $type, 'guid' => $upload['url'], ); $id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); $struct = $this->_prepare_media_item( get_post( $id ) ); $struct['id'] = $struct['attachment_id']; $struct['file'] = $struct['title']; $struct['url'] = $struct['link']; return $struct; } public function mt_getRecentPostTitles( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $query = array( 'numberposts' => absint( $args[3] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.getRecentPostTitles', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { $this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); return $this->error; } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] ); $recent_posts[] = array( 'dateCreated' => $post_date, 'userid' => $entry['post_author'], 'postid' => (string) $entry['ID'], 'title' => $entry['post_title'], 'post_status' => $entry['post_status'], 'date_created_gmt' => $post_date_gmt, ); } return $recent_posts; } public function mt_getCategoryList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'mt.getCategoryList', $args, $this ); $categories_struct = array(); $cats = get_categories( array( 'hide_empty' => 0, 'hierarchical' => 0, ) ); if ( $cats ) { foreach ( $cats as $cat ) { $struct = array(); $struct['categoryId'] = $cat->term_id; $struct['categoryName'] = $cat->name; $categories_struct[] = $struct; } } return $categories_struct; } public function mt_getPostCategories( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_post( $post_ID ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'mt.getPostCategories', $args, $this ); $categories = array(); $catids = wp_get_post_categories( (int) $post_ID ); $isPrimary = true; foreach ( $catids as $catid ) { $categories[] = array( 'categoryName' => get_cat_name( $catid ), 'categoryId' => (string) $catid, 'isPrimary' => $isPrimary, ); $isPrimary = false; } return $categories; } public function mt_setPostCategories( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $categories = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.setPostCategories', $args, $this ); if ( ! get_post( $post_ID ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } $catids = array(); foreach ( $categories as $cat ) { $catids[] = $cat['categoryId']; } wp_set_post_categories( $post_ID, $catids ); return true; } public function mt_supportedMethods() { do_action( 'xmlrpc_call', 'mt.supportedMethods', array(), $this ); return array_keys( $this->methods ); } public function mt_supportedTextFilters() { do_action( 'xmlrpc_call', 'mt.supportedTextFilters', array(), $this ); return apply_filters( 'xmlrpc_text_filters', array() ); } public function mt_getTrackbackPings( $post_ID ) { global $wpdb; do_action( 'xmlrpc_call', 'mt.getTrackbackPings', $post_ID, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID ) ); if ( ! $comments ) { return array(); } $trackback_pings = array(); foreach ( $comments as $comment ) { if ( 'trackback' === $comment->comment_type ) { $content = $comment->comment_content; $title = substr( $content, 8, ( strpos( $content, '' ) - 8 ) ); $trackback_pings[] = array( 'pingTitle' => $title, 'pingURL' => $comment->comment_author_url, 'pingIP' => $comment->comment_author_IP, ); } } return $trackback_pings; } public function mt_publishPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.publishPost', $args, $this ); $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'publish_posts' ) || ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } $postdata['post_status'] = 'publish'; $postdata['post_category'] = wp_get_post_categories( $post_ID ); $this->escape( $postdata ); return wp_update_post( $postdata ); } public function pingback_ping( $args ) { global $wpdb; do_action( 'xmlrpc_call', 'pingback.ping', $args, $this ); $this->escape( $args ); $pagelinkedfrom = str_replace( '&', '&', $args[0] ); $pagelinkedto = str_replace( '&', '&', $args[1] ); $pagelinkedto = str_replace( '&', '&', $pagelinkedto ); $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto ); if ( ! $pagelinkedfrom ) { return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) ); } $pos1 = strpos( $pagelinkedto, str_replace( array( 'http://www.', 'http://', 'https://www.', 'https://' ), '', get_option( 'home' ) ) ); if ( ! $pos1 ) { return $this->pingback_error( 0, __( 'Is there no link to us?' ) ); } $urltest = parse_url( $pagelinkedto ); $post_ID = url_to_postid( $pagelinkedto ); if ( $post_ID ) { } elseif ( isset( $urltest['path'] ) && preg_match( '#p/[0-9]{1,}#', $urltest['path'], $match ) ) { $blah = explode( '/', $match[0] ); $post_ID = (int) $blah[1]; } elseif ( isset( $urltest['query'] ) && preg_match( '#p=[0-9]{1,}#', $urltest['query'], $match ) ) { $blah = explode( '=', $match[0] ); $post_ID = (int) $blah[1]; } elseif ( isset( $urltest['fragment'] ) ) { if ( (int) $urltest['fragment'] ) { $post_ID = (int) $urltest['fragment']; } elseif ( preg_match( '/post-[0-9]+/', $urltest['fragment'] ) ) { $post_ID = preg_replace( '/[^0-9]+/', '', $urltest['fragment'] ); } elseif ( is_string( $urltest['fragment'] ) ) { $title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] ); $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title ); $post_ID = $wpdb->get_var( $sql ); if ( ! $post_ID ) { return $this->pingback_error( 0, '' ); } } } else { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } $post_ID = (int) $post_ID; $post = get_post( $post_ID ); if ( ! $post ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } if ( url_to_postid( $pagelinkedfrom ) == $post_ID ) { return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); } if ( ! pings_open( $post ) ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom ) ) ) { return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) ); } sleep( 1 ); $remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $pagelinkedfrom ); $http_api_args = array( 'timeout' => 10, 'redirection' => 0, 'limit_response_size' => 153600, 'user-agent' => "$user_agent; verifying pingback from $remote_ip", 'headers' => array( 'X-Pingback-Forwarded-For' => $remote_ip, ), ); $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args ); $remote_source = wp_remote_retrieve_body( $request ); $remote_source_original = $remote_source; if ( ! $remote_source ) { return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); } $remote_source = apply_filters( 'pre_remote_source', $remote_source, $pagelinkedto ); $remote_source = str_replace( ']*>/', "\n\n", $remote_source ); preg_match( '|([^<]*?)|is', $remote_source, $matchtitle ); $title = isset( $matchtitle[1] ) ? $matchtitle[1] : ''; if ( empty( $title ) ) { return $this->pingback_error( 32, __( 'A title on that page cannot be found.' ) ); } $remote_source = preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $remote_source ); $remote_source = strip_tags( $remote_source, '' ); $p = explode( "\n\n", $remote_source ); $preg_target = preg_quote( $pagelinkedto, '|' ); foreach ( $p as $para ) { if ( strpos( $para, $pagelinkedto ) !== false ) { preg_match( '|]+?' . $preg_target . '[^>]*>([^>]+?)|', $para, $context ); if ( empty( $context ) ) { continue; } $excerpt = preg_replace( '|\|', '', $para ); if ( strlen( $context[1] ) > 100 ) { $context[1] = substr( $context[1], 0, 100 ) . '…'; } $marker = '' . $context[1] . ''; $excerpt = str_replace( $context[0], $marker, $excerpt ); $excerpt = strip_tags( $excerpt, '' ); $excerpt = trim( $excerpt ); $preg_marker = preg_quote( $marker, '|' ); $excerpt = preg_replace( "|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt ); $excerpt = strip_tags( $excerpt ); break; } } if ( empty( $context ) ) { return $this->pingback_error( 17, __( 'The source URL does not contain a link to the target URL, and so cannot be used as a source.' ) ); } $pagelinkedfrom = str_replace( '&', '&', $pagelinkedfrom ); $context = '[…] ' . esc_html( $excerpt ) . ' […]'; $pagelinkedfrom = $this->escape( $pagelinkedfrom ); $comment_post_ID = (int) $post_ID; $comment_author = $title; $comment_author_email = ''; $this->escape( $comment_author ); $comment_author_url = $pagelinkedfrom; $comment_content = $context; $this->escape( $comment_content ); $comment_type = 'pingback'; $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type', 'remote_source', 'remote_source_original' ); $comment_ID = wp_new_comment( $commentdata ); if ( is_wp_error( $comment_ID ) ) { return $this->pingback_error( 0, $comment_ID->get_error_message() ); } do_action( 'pingback_post', $comment_ID ); return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto ); } public function pingback_extensions_getPingbacks( $url ) { global $wpdb; do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks', $url, $this ); $url = $this->escape( $url ); $post_ID = url_to_postid( $url ); if ( ! $post_ID ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post ) { return $this->pingback_error( 32, __( 'The specified target URL does not exist.' ) ); } $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID ) ); if ( ! $comments ) { return array(); } $pingbacks = array(); foreach ( $comments as $comment ) { if ( 'pingback' === $comment->comment_type ) { $pingbacks[] = $comment->comment_author_url; } } return $pingbacks; } protected function pingback_error( $code, $message ) { return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) ); } } false, 'allowed' => null, 'blog_id' => 0, ); $args = wp_parse_args( $args, $defaults ); $theme_directories = search_theme_directories(); if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) { $current_theme = get_stylesheet(); if ( isset( $theme_directories[ $current_theme ] ) ) { $root_of_current_theme = get_raw_theme_root( $current_theme ); if ( ! in_array( $root_of_current_theme, $wp_theme_directories, true ) ) { $root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme; } $theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme; } } if ( empty( $theme_directories ) ) { return array(); } if ( is_multisite() && null !== $args['allowed'] ) { $allowed = $args['allowed']; if ( 'network' === $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() ); } elseif ( 'site' === $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) ); } elseif ( $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) ); } else { $theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) ); } } $themes = array(); static $_themes = array(); foreach ( $theme_directories as $theme => $theme_root ) { if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) { $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ]; } else { $themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] ); $_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ]; } } if ( null !== $args['errors'] ) { foreach ( $themes as $theme => $wp_theme ) { if ( $wp_theme->errors() != $args['errors'] ) { unset( $themes[ $theme ] ); } } } return $themes; } function wp_get_theme( $stylesheet = '', $theme_root = '' ) { global $wp_theme_directories; if ( empty( $stylesheet ) ) { $stylesheet = get_stylesheet(); } if ( empty( $theme_root ) ) { $theme_root = get_raw_theme_root( $stylesheet ); if ( false === $theme_root ) { $theme_root = WP_CONTENT_DIR . '/themes'; } elseif ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } } return new WP_Theme( $stylesheet, $theme_root ); } function wp_clean_themes_cache( $clear_update_cache = true ) { if ( $clear_update_cache ) { delete_site_transient( 'update_themes' ); } search_theme_directories( true ); foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme ) { $theme->cache_delete(); } } function is_child_theme() { return ( TEMPLATEPATH !== STYLESHEETPATH ); } function get_stylesheet() { return apply_filters( 'stylesheet', get_option( 'stylesheet' ) ); } function get_stylesheet_directory() { $stylesheet = get_stylesheet(); $theme_root = get_theme_root( $stylesheet ); $stylesheet_dir = "$theme_root/$stylesheet"; return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root ); } function get_stylesheet_directory_uri() { $stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) ); $theme_root_uri = get_theme_root_uri( $stylesheet ); $stylesheet_dir_uri = "$theme_root_uri/$stylesheet"; return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri ); } function get_stylesheet_uri() { $stylesheet_dir_uri = get_stylesheet_directory_uri(); $stylesheet_uri = $stylesheet_dir_uri . '/style.css'; return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri ); } function get_locale_stylesheet_uri() { global $wp_locale; $stylesheet_dir_uri = get_stylesheet_directory_uri(); $dir = get_stylesheet_directory(); $locale = get_locale(); if ( file_exists( "$dir/$locale.css" ) ) { $stylesheet_uri = "$stylesheet_dir_uri/$locale.css"; } elseif ( ! empty( $wp_locale->text_direction ) && file_exists( "$dir/{$wp_locale->text_direction}.css" ) ) { $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css"; } else { $stylesheet_uri = ''; } return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri ); } function get_template() { return apply_filters( 'template', get_option( 'template' ) ); } function get_template_directory() { $template = get_template(); $theme_root = get_theme_root( $template ); $template_dir = "$theme_root/$template"; return apply_filters( 'template_directory', $template_dir, $template, $theme_root ); } function get_template_directory_uri() { $template = str_replace( '%2F', '/', rawurlencode( get_template() ) ); $theme_root_uri = get_theme_root_uri( $template ); $template_dir_uri = "$theme_root_uri/$template"; return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); } function get_theme_roots() { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_roots = get_site_transient( 'theme_roots' ); if ( false === $theme_roots ) { search_theme_directories( true ); $theme_roots = get_site_transient( 'theme_roots' ); } return $theme_roots; } function register_theme_directory( $directory ) { global $wp_theme_directories; if ( ! file_exists( $directory ) ) { $directory = WP_CONTENT_DIR . '/' . $directory; if ( ! file_exists( $directory ) ) { return false; } } if ( ! is_array( $wp_theme_directories ) ) { $wp_theme_directories = array(); } $untrailed = untrailingslashit( $directory ); if ( ! empty( $untrailed ) && ! in_array( $untrailed, $wp_theme_directories, true ) ) { $wp_theme_directories[] = $untrailed; } return true; } function search_theme_directories( $force = false ) { global $wp_theme_directories; static $found_themes = null; if ( empty( $wp_theme_directories ) ) { return false; } if ( ! $force && isset( $found_themes ) ) { return $found_themes; } $found_themes = array(); $wp_theme_directories = (array) $wp_theme_directories; $relative_theme_roots = array(); foreach ( $wp_theme_directories as $theme_root ) { if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) { $relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root; } else { $relative_theme_roots[ $theme_root ] = $theme_root; } } $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ); if ( $cache_expiration ) { $cached_roots = get_site_transient( 'theme_roots' ); if ( is_array( $cached_roots ) ) { foreach ( $cached_roots as $theme_dir => $theme_root ) { if ( ! isset( $relative_theme_roots[ $theme_root ] ) ) { continue; } $found_themes[ $theme_dir ] = array( 'theme_file' => $theme_dir . '/style.css', 'theme_root' => $relative_theme_roots[ $theme_root ], ); } return $found_themes; } if ( ! is_int( $cache_expiration ) ) { $cache_expiration = 30 * MINUTE_IN_SECONDS; } } else { $cache_expiration = 30 * MINUTE_IN_SECONDS; } foreach ( $wp_theme_directories as $theme_root ) { $dirs = @ scandir( $theme_root ); if ( ! $dirs ) { trigger_error( "$theme_root is not readable", E_USER_NOTICE ); continue; } foreach ( $dirs as $dir ) { if ( ! is_dir( $theme_root . '/' . $dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) { $found_themes[ $dir ] = array( 'theme_file' => $dir . '/style.css', 'theme_root' => $theme_root, ); } else { $found_theme = false; $sub_dirs = @ scandir( $theme_root . '/' . $dir ); if ( ! $sub_dirs ) { trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE ); continue; } foreach ( $sub_dirs as $sub_dir ) { if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) ) { continue; } $found_themes[ $dir . '/' . $sub_dir ] = array( 'theme_file' => $dir . '/' . $sub_dir . '/style.css', 'theme_root' => $theme_root, ); $found_theme = true; } if ( ! $found_theme ) { $found_themes[ $dir ] = array( 'theme_file' => $dir . '/style.css', 'theme_root' => $theme_root, ); } } } } asort( $found_themes ); $theme_roots = array(); $relative_theme_roots = array_flip( $relative_theme_roots ); foreach ( $found_themes as $theme_dir => $theme_data ) { $theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; } if ( get_site_transient( 'theme_roots' ) != $theme_roots ) { set_site_transient( 'theme_roots', $theme_roots, $cache_expiration ); } return $found_themes; } function get_theme_root( $stylesheet_or_template = '' ) { global $wp_theme_directories; $theme_root = ''; if ( $stylesheet_or_template ) { $theme_root = get_raw_theme_root( $stylesheet_or_template ); if ( $theme_root ) { if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } } } if ( ! $theme_root ) { $theme_root = WP_CONTENT_DIR . '/themes'; } return apply_filters( 'theme_root', $theme_root ); } function get_theme_root_uri( $stylesheet_or_template = '', $theme_root = '' ) { global $wp_theme_directories; if ( $stylesheet_or_template && ! $theme_root ) { $theme_root = get_raw_theme_root( $stylesheet_or_template ); } if ( $stylesheet_or_template && $theme_root ) { if ( in_array( $theme_root, (array) $wp_theme_directories, true ) ) { if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) { $theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) ); } elseif ( 0 === strpos( $theme_root, ABSPATH ) ) { $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) ); } elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) { $theme_root_uri = plugins_url( basename( $theme_root ), $theme_root ); } else { $theme_root_uri = $theme_root; } } else { $theme_root_uri = content_url( $theme_root ); } } else { $theme_root_uri = content_url( 'themes' ); } return apply_filters( 'theme_root_uri', $theme_root_uri, get_option( 'siteurl' ), $stylesheet_or_template ); } function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_root = false; if ( ! $skip_cache ) { if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) { $theme_root = get_option( 'stylesheet_root' ); } elseif ( get_option( 'template' ) == $stylesheet_or_template ) { $theme_root = get_option( 'template_root' ); } } if ( empty( $theme_root ) ) { $theme_roots = get_theme_roots(); if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) { $theme_root = $theme_roots[ $stylesheet_or_template ]; } } return $theme_root; } function locale_stylesheet() { $stylesheet = get_locale_stylesheet_uri(); if ( empty( $stylesheet ) ) { return; } $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; printf( '', $stylesheet, $type_attr ); } function switch_theme( $stylesheet ) { global $wp_theme_directories, $wp_customize, $sidebars_widgets; $requirements = validate_theme_requirements( $stylesheet ); if ( is_wp_error( $requirements ) ) { wp_die( $requirements ); } $_sidebars_widgets = null; if ( 'wp_ajax_customize_save' === current_action() ) { $old_sidebars_widgets_data_setting = $wp_customize->get_setting( 'old_sidebars_widgets_data' ); if ( $old_sidebars_widgets_data_setting ) { $_sidebars_widgets = $wp_customize->post_value( $old_sidebars_widgets_data_setting ); } } elseif ( is_array( $sidebars_widgets ) ) { $_sidebars_widgets = $sidebars_widgets; } if ( is_array( $_sidebars_widgets ) ) { set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets, ) ); } $nav_menu_locations = get_theme_mod( 'nav_menu_locations' ); update_option( 'theme_switch_menu_locations', $nav_menu_locations ); if ( func_num_args() > 1 ) { $stylesheet = func_get_arg( 1 ); } $old_theme = wp_get_theme(); $new_theme = wp_get_theme( $stylesheet ); $template = $new_theme->get_template(); if ( wp_is_recovery_mode() ) { $paused_themes = wp_paused_themes(); $paused_themes->delete( $old_theme->get_stylesheet() ); $paused_themes->delete( $old_theme->get_template() ); } update_option( 'template', $template ); update_option( 'stylesheet', $stylesheet ); if ( count( $wp_theme_directories ) > 1 ) { update_option( 'template_root', get_raw_theme_root( $template, true ) ); update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) ); } else { delete_option( 'template_root' ); delete_option( 'stylesheet_root' ); } $new_name = $new_theme->get( 'Name' ); update_option( 'current_theme', $new_name ); 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 { if ( 'wp_ajax_customize_save' === current_action() ) { remove_theme_mod( 'sidebars_widgets' ); } } update_option( 'theme_switched', $old_theme->get_stylesheet() ); do_action( 'switch_theme', $new_name, $new_theme, $old_theme ); } function validate_current_theme() { if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) { return true; } if ( ! file_exists( get_template_directory() . '/templates/index.html' ) && ! file_exists( get_template_directory() . '/block-templates/index.html' ) && ! file_exists( get_template_directory() . '/index.php' ) ) { } elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) { } elseif ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { } else { return true; } $default = wp_get_theme( WP_DEFAULT_THEME ); if ( $default->exists() ) { switch_theme( WP_DEFAULT_THEME ); return false; } $default = WP_Theme::get_core_default_theme(); if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) { return true; } switch_theme( $default->get_stylesheet() ); return false; } function validate_theme_requirements( $stylesheet ) { $theme = wp_get_theme( $stylesheet ); $requirements = array( 'requires' => ! empty( $theme->get( 'RequiresWP' ) ) ? $theme->get( 'RequiresWP' ) : '', 'requires_php' => ! empty( $theme->get( 'RequiresPHP' ) ) ? $theme->get( 'RequiresPHP' ) : '', ); $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); if ( ! $compatible_wp && ! $compatible_php ) { return new WP_Error( 'theme_wp_php_incompatible', sprintf( _x( 'Error: Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } elseif ( ! $compatible_php ) { return new WP_Error( 'theme_php_incompatible', sprintf( _x( 'Error: Current PHP version does not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } elseif ( ! $compatible_wp ) { return new WP_Error( 'theme_wp_incompatible', sprintf( _x( 'Error: Current WordPress version does not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } return true; } function get_theme_mods() { $theme_slug = get_option( 'stylesheet' ); $mods = get_option( "theme_mods_$theme_slug" ); if ( false === $mods ) { $theme_name = get_option( 'current_theme' ); if ( false === $theme_name ) { $theme_name = wp_get_theme()->get( 'Name' ); } $mods = get_option( "mods_$theme_name" ); if ( is_admin() && false !== $mods ) { update_option( "theme_mods_$theme_slug", $mods ); delete_option( "mods_$theme_name" ); } } if ( ! is_array( $mods ) ) { $mods = array(); } return $mods; } function get_theme_mod( $name, $default = false ) { $mods = get_theme_mods(); if ( isset( $mods[ $name ] ) ) { return apply_filters( "theme_mod_{$name}", $mods[ $name ] ); } if ( is_string( $default ) ) { if ( preg_match( '#(?get( 'Name' ); } delete_option( 'mods_' . $theme_name ); } function get_header_textcolor() { return get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) ); } function header_textcolor() { echo get_header_textcolor(); } function display_header_text() { if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { return false; } $text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) ); return 'blank' !== $text_color; } function has_header_image() { return (bool) get_header_image(); } function get_header_image() { $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); if ( 'remove-header' === $url ) { return false; } if ( is_random_header_image() ) { $url = get_random_header_image(); } return esc_url_raw( set_url_scheme( $url ) ); } function get_header_image_tag( $attr = array() ) { $header = get_custom_header(); $header->url = get_header_image(); if ( ! $header->url ) { return ''; } $width = absint( $header->width ); $height = absint( $header->height ); $alt = ''; if ( ! empty( $header->attachment_id ) ) { $image_alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true ); if ( is_string( $image_alt ) ) { $alt = $image_alt; } } $attr = wp_parse_args( $attr, array( 'src' => $header->url, 'width' => $width, 'height' => $height, 'alt' => $alt, ) ); if ( empty( $attr['srcset'] ) && ! empty( $header->attachment_id ) ) { $image_meta = get_post_meta( $header->attachment_id, '_wp_attachment_metadata', true ); $size_array = array( $width, $height ); if ( is_array( $image_meta ) ) { $srcset = wp_calculate_image_srcset( $size_array, $header->url, $image_meta, $header->attachment_id ); if ( ! empty( $attr['sizes'] ) ) { $sizes = $attr['sizes']; } else { $sizes = wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id ); } if ( $srcset && $sizes ) { $attr['srcset'] = $srcset; $attr['sizes'] = $sizes; } } } $attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header ); $attr = array_map( 'esc_attr', $attr ); $html = ' $value ) { $html .= ' ' . $name . '="' . $value . '"'; } $html .= ' />'; return apply_filters( 'get_header_image_tag', $html, $header, $attr ); } function the_header_image_tag( $attr = array() ) { echo get_header_image_tag( $attr ); } function _get_random_header_data() { global $_wp_default_headers; static $_wp_random_header = null; if ( empty( $_wp_random_header ) ) { $header_image_mod = get_theme_mod( 'header_image', '' ); $headers = array(); if ( 'random-uploaded-image' === $header_image_mod ) { $headers = get_uploaded_header_images(); } elseif ( ! empty( $_wp_default_headers ) ) { if ( 'random-default-image' === $header_image_mod ) { $headers = $_wp_default_headers; } else { if ( current_theme_supports( 'custom-header', 'random-default' ) ) { $headers = $_wp_default_headers; } } } if ( empty( $headers ) ) { return new stdClass; } $_wp_random_header = (object) $headers[ array_rand( $headers ) ]; $_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() ); $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() ); } return $_wp_random_header; } function get_random_header_image() { $random_image = _get_random_header_data(); if ( empty( $random_image->url ) ) { return ''; } return $random_image->url; } function is_random_header_image( $type = 'any' ) { $header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); if ( 'any' === $type ) { if ( 'random-default-image' === $header_image_mod || 'random-uploaded-image' === $header_image_mod || ( '' !== get_random_header_image() && empty( $header_image_mod ) ) ) { return true; } } else { if ( "random-$type-image" === $header_image_mod ) { return true; } elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) { return true; } } return false; } function header_image() { $image = get_header_image(); if ( $image ) { echo esc_url( $image ); } } function get_uploaded_header_images() { $header_images = array(); $headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option( 'stylesheet' ), 'orderby' => 'none', 'nopaging' => true, ) ); if ( empty( $headers ) ) { return array(); } foreach ( (array) $headers as $header ) { $url = esc_url_raw( wp_get_attachment_url( $header->ID ) ); $header_data = wp_get_attachment_metadata( $header->ID ); $header_index = $header->ID; $header_images[ $header_index ] = array(); $header_images[ $header_index ]['attachment_id'] = $header->ID; $header_images[ $header_index ]['url'] = $url; $header_images[ $header_index ]['thumbnail_url'] = $url; $header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true ); if ( isset( $header_data['attachment_parent'] ) ) { $header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent']; } else { $header_images[ $header_index ]['attachment_parent'] = ''; } if ( isset( $header_data['width'] ) ) { $header_images[ $header_index ]['width'] = $header_data['width']; } if ( isset( $header_data['height'] ) ) { $header_images[ $header_index ]['height'] = $header_data['height']; } } return $header_images; } function get_custom_header() { global $_wp_default_headers; if ( is_random_header_image() ) { $data = _get_random_header_data(); } else { $data = get_theme_mod( 'header_image_data' ); if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) { $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() ); $data = array(); $data['url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args ); $data['thumbnail_url'] = $data['url']; if ( ! empty( $_wp_default_headers ) ) { foreach ( (array) $_wp_default_headers as $default_header ) { $url = vsprintf( $default_header['url'], $directory_args ); if ( $data['url'] == $url ) { $data = $default_header; $data['url'] = $url; $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); break; } } } } } $default = array( 'url' => '', 'thumbnail_url' => '', 'width' => get_theme_support( 'custom-header', 'width' ), 'height' => get_theme_support( 'custom-header', 'height' ), 'video' => get_theme_support( 'custom-header', 'video' ), ); return (object) wp_parse_args( $data, $default ); } function register_default_headers( $headers ) { global $_wp_default_headers; $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers ); } function unregister_default_headers( $header ) { global $_wp_default_headers; if ( is_array( $header ) ) { array_map( 'unregister_default_headers', $header ); } elseif ( isset( $_wp_default_headers[ $header ] ) ) { unset( $_wp_default_headers[ $header ] ); return true; } else { return false; } } function has_header_video() { return (bool) get_header_video_url(); } function get_header_video_url() { $id = absint( get_theme_mod( 'header_video' ) ); if ( $id ) { $url = wp_get_attachment_url( $id ); } else { $url = get_theme_mod( 'external_header_video' ); } $url = apply_filters( 'get_header_video_url', $url ); if ( ! $id && ! $url ) { return false; } return esc_url_raw( set_url_scheme( $url ) ); } function the_header_video_url() { $video = get_header_video_url(); if ( $video ) { echo esc_url( $video ); } } function get_header_video_settings() { $header = get_custom_header(); $video_url = get_header_video_url(); $video_type = wp_check_filetype( $video_url, wp_get_mime_types() ); $settings = array( 'mimeType' => '', 'posterUrl' => get_header_image(), 'videoUrl' => $video_url, 'width' => absint( $header->width ), 'height' => absint( $header->height ), 'minWidth' => 900, 'minHeight' => 500, 'l10n' => array( 'pause' => __( 'Pause' ), 'play' => __( 'Play' ), 'pauseSpeak' => __( 'Video is paused.' ), 'playSpeak' => __( 'Video is playing.' ), ), ); if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) { $settings['mimeType'] = 'video/x-youtube'; } elseif ( ! empty( $video_type['type'] ) ) { $settings['mimeType'] = $video_type['type']; } return apply_filters( 'header_video_settings', $settings ); } function has_custom_header() { if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) { return true; } return false; } function is_header_video_active() { if ( ! get_theme_support( 'custom-header', 'video' ) ) { return false; } $video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' ); if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) { $show_video = true; } else { $show_video = call_user_func( $video_active_cb ); } return apply_filters( 'is_header_video_active', $show_video ); } function get_custom_header_markup() { if ( ! has_custom_header() && ! is_customize_preview() ) { return ''; } return sprintf( '
          %s
          ', get_header_image_tag() ); } function the_custom_header_markup() { $custom_header = get_custom_header_markup(); if ( empty( $custom_header ) ) { return; } echo $custom_header; if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) { wp_enqueue_script( 'wp-custom-header' ); wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() ); } } function get_background_image() { return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) ); } function background_image() { echo get_background_image(); } function get_background_color() { return get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) ); } function background_color() { echo get_background_color(); } function _custom_background_cb() { $background = set_url_scheme( get_background_image() ); $color = get_background_color(); if ( get_theme_support( 'custom-background', 'default-color' ) === $color ) { $color = false; } $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; if ( ! $background && ! $color ) { if ( is_customize_preview() ) { printf( '', $type_attr ); } return; } $style = $color ? "background-color: #$color;" : ''; if ( $background ) { $image = ' background-image: url("' . esc_url_raw( $background ) . '");'; $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); $position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ); if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) { $position_x = 'left'; } if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) { $position_y = 'top'; } $position = " background-position: $position_x $position_y;"; $size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) ); if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) { $size = 'auto'; } $size = " background-size: $size;"; $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ); if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) { $repeat = 'repeat'; } $repeat = " background-repeat: $repeat;"; $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ); if ( 'fixed' !== $attachment ) { $attachment = 'scroll'; } $attachment = " background-attachment: $attachment;"; $style .= $image . $position . $size . $repeat . $attachment; } ?> + id="custom-background-css"> +body.custom-background { } + + + id="wp-custom-css"> + + + 'custom_css', 'post_status' => get_post_stati(), 'name' => sanitize_title( $stylesheet ), 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ); $post = null; if ( get_stylesheet() === $stylesheet ) { $post_id = get_theme_mod( 'custom_css_post_id' ); if ( $post_id > 0 && get_post( $post_id ) ) { $post = get_post( $post_id ); } if ( ! $post && -1 !== $post_id ) { $query = new WP_Query( $custom_css_query_vars ); $post = $query->post; set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 ); } } else { $query = new WP_Query( $custom_css_query_vars ); $post = $query->post; } return $post; } function wp_get_custom_css( $stylesheet = '' ) { $css = ''; if ( empty( $stylesheet ) ) { $stylesheet = get_stylesheet(); } $post = wp_get_custom_css_post( $stylesheet ); if ( $post ) { $css = $post->post_content; } $css = apply_filters( 'wp_get_custom_css', $css, $stylesheet ); return $css; } function wp_update_custom_css_post( $css, $args = array() ) { $args = wp_parse_args( $args, array( 'preprocessed' => '', 'stylesheet' => get_stylesheet(), ) ); $data = array( 'css' => $css, 'preprocessed' => $args['preprocessed'], ); $data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) ); $post_data = array( 'post_title' => $args['stylesheet'], 'post_name' => sanitize_title( $args['stylesheet'] ), 'post_type' => 'custom_css', 'post_status' => 'publish', 'post_content' => $data['css'], 'post_content_filtered' => $data['preprocessed'], ); $post = wp_get_custom_css_post( $args['stylesheet'] ); if ( $post ) { $post_data['ID'] = $post->ID; $r = wp_update_post( wp_slash( $post_data ), true ); } else { $r = wp_insert_post( wp_slash( $post_data ), true ); if ( ! is_wp_error( $r ) ) { if ( get_stylesheet() === $args['stylesheet'] ) { set_theme_mod( 'custom_css_post_id', $r ); } if ( 0 === count( wp_get_post_revisions( $r ) ) ) { wp_save_post_revision( $r ); } } } if ( is_wp_error( $r ) ) { return $r; } return get_post( $r ); } function add_editor_style( $stylesheet = 'editor-style.css' ) { global $editor_styles; add_theme_support( 'editor-style' ); $editor_styles = (array) $editor_styles; $stylesheet = (array) $stylesheet; if ( is_rtl() ) { $rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] ); $stylesheet[] = $rtl_stylesheet; } $editor_styles = array_merge( $editor_styles, $stylesheet ); } function remove_editor_styles() { if ( ! current_theme_supports( 'editor-style' ) ) { return false; } _remove_theme_support( 'editor-style' ); if ( is_admin() ) { $GLOBALS['editor_styles'] = array(); } return true; } function get_editor_stylesheets() { $stylesheets = array(); if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) { $editor_styles = $GLOBALS['editor_styles']; $editor_styles = array_unique( array_filter( $editor_styles ) ); $style_uri = get_stylesheet_directory_uri(); $style_dir = get_stylesheet_directory(); foreach ( $editor_styles as $key => $file ) { if ( preg_match( '~^(https?:)?//~', $file ) ) { $stylesheets[] = esc_url_raw( $file ); unset( $editor_styles[ $key ] ); } } if ( is_child_theme() ) { $template_uri = get_template_directory_uri(); $template_dir = get_template_directory(); foreach ( $editor_styles as $key => $file ) { if ( $file && file_exists( "$template_dir/$file" ) ) { $stylesheets[] = "$template_uri/$file"; } } } foreach ( $editor_styles as $file ) { if ( $file && file_exists( "$style_dir/$file" ) ) { $stylesheets[] = "$style_uri/$file"; } } } return apply_filters( 'editor_stylesheets', $stylesheets ); } function get_theme_starter_content() { $theme_support = get_theme_support( 'starter-content' ); if ( is_array( $theme_support ) && ! empty( $theme_support[0] ) && is_array( $theme_support[0] ) ) { $config = $theme_support[0]; } else { $config = array(); } $core_content = array( 'widgets' => array( 'text_business_info' => array( 'text', array( 'title' => _x( 'Find Us', 'Theme starter content' ), 'text' => implode( '', array( '' . _x( 'Address', 'Theme starter content' ) . "\n", _x( '123 Main Street', 'Theme starter content' ) . "\n", _x( 'New York, NY 10001', 'Theme starter content' ) . "\n\n", '' . _x( 'Hours', 'Theme starter content' ) . "\n", _x( 'Monday–Friday: 9:00AM–5:00PM', 'Theme starter content' ) . "\n", _x( 'Saturday & Sunday: 11:00AM–3:00PM', 'Theme starter content' ), ) ), 'filter' => true, 'visual' => true, ), ), 'text_about' => array( 'text', array( 'title' => _x( 'About This Site', 'Theme starter content' ), 'text' => _x( 'This may be a good place to introduce yourself and your site or include some credits.', 'Theme starter content' ), 'filter' => true, 'visual' => true, ), ), 'archives' => array( 'archives', array( 'title' => _x( 'Archives', 'Theme starter content' ), ), ), 'calendar' => array( 'calendar', array( 'title' => _x( 'Calendar', 'Theme starter content' ), ), ), 'categories' => array( 'categories', array( 'title' => _x( 'Categories', 'Theme starter content' ), ), ), 'meta' => array( 'meta', array( 'title' => _x( 'Meta', 'Theme starter content' ), ), ), 'recent-comments' => array( 'recent-comments', array( 'title' => _x( 'Recent Comments', 'Theme starter content' ), ), ), 'recent-posts' => array( 'recent-posts', array( 'title' => _x( 'Recent Posts', 'Theme starter content' ), ), ), 'search' => array( 'search', array( 'title' => _x( 'Search', 'Theme starter content' ), ), ), ), 'nav_menus' => array( 'link_home' => array( 'type' => 'custom', 'title' => _x( 'Home', 'Theme starter content' ), 'url' => home_url( '/' ), ), 'page_home' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{home}}', ), 'page_about' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{about}}', ), 'page_blog' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{blog}}', ), 'page_news' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{news}}', ), 'page_contact' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{contact}}', ), 'link_email' => array( 'title' => _x( 'Email', 'Theme starter content' ), 'url' => 'mailto:wordpress@example.com', ), 'link_facebook' => array( 'title' => _x( 'Facebook', 'Theme starter content' ), 'url' => 'https://www.facebook.com/wordpress', ), 'link_foursquare' => array( 'title' => _x( 'Foursquare', 'Theme starter content' ), 'url' => 'https://foursquare.com/', ), 'link_github' => array( 'title' => _x( 'GitHub', 'Theme starter content' ), 'url' => 'https://github.com/wordpress/', ), 'link_instagram' => array( 'title' => _x( 'Instagram', 'Theme starter content' ), 'url' => 'https://www.instagram.com/explore/tags/wordcamp/', ), 'link_linkedin' => array( 'title' => _x( 'LinkedIn', 'Theme starter content' ), 'url' => 'https://www.linkedin.com/company/1089783', ), 'link_pinterest' => array( 'title' => _x( 'Pinterest', 'Theme starter content' ), 'url' => 'https://www.pinterest.com/', ), 'link_twitter' => array( 'title' => _x( 'Twitter', 'Theme starter content' ), 'url' => 'https://twitter.com/wordpress', ), 'link_yelp' => array( 'title' => _x( 'Yelp', 'Theme starter content' ), 'url' => 'https://www.yelp.com', ), 'link_youtube' => array( 'title' => _x( 'YouTube', 'Theme starter content' ), 'url' => 'https://www.youtube.com/channel/UCdof4Ju7amm1chz1gi1T2ZA', ), ), 'posts' => array( 'home' => array( 'post_type' => 'page', 'post_title' => _x( 'Home', 'Theme starter content' ), 'post_content' => sprintf( "\n

          %s

          \n", _x( 'Welcome to your site! This is your homepage, which is what most visitors will see when they come to your site for the first time.', 'Theme starter content' ) ), ), 'about' => array( 'post_type' => 'page', 'post_title' => _x( 'About', 'Theme starter content' ), 'post_content' => sprintf( "\n

          %s

          \n", _x( 'You might be an artist who would like to introduce yourself and your work here or maybe you’re a business with a mission to describe.', 'Theme starter content' ) ), ), 'contact' => array( 'post_type' => 'page', 'post_title' => _x( 'Contact', 'Theme starter content' ), 'post_content' => sprintf( "\n

          %s

          \n", _x( 'This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'Theme starter content' ) ), ), 'blog' => array( 'post_type' => 'page', 'post_title' => _x( 'Blog', 'Theme starter content' ), ), 'news' => array( 'post_type' => 'page', 'post_title' => _x( 'News', 'Theme starter content' ), ), 'homepage-section' => array( 'post_type' => 'page', 'post_title' => _x( 'A homepage section', 'Theme starter content' ), 'post_content' => sprintf( "\n

          %s

          \n", _x( 'This is an example of a homepage section. Homepage sections can be any page other than the homepage itself, including the page that shows your latest blog posts.', 'Theme starter content' ) ), ), ), ); $content = array(); foreach ( $config as $type => $args ) { switch ( $type ) { case 'options': case 'theme_mods': $content[ $type ] = $config[ $type ]; break; case 'widgets': foreach ( $config[ $type ] as $sidebar_id => $widgets ) { foreach ( $widgets as $id => $widget ) { if ( is_array( $widget ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $widget = array( $core_content[ $type ][ $id ][0], array_merge( $core_content[ $type ][ $id ][1], $widget ), ); } $content[ $type ][ $sidebar_id ][] = $widget; } elseif ( is_string( $widget ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $widget ] ) ) { $content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ]; } } } break; case 'nav_menus': foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) { if ( empty( $nav_menu['name'] ) ) { $nav_menu['name'] = $nav_menu_location; } $content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name']; foreach ( $nav_menu['items'] as $id => $nav_menu_item ) { if ( is_array( $nav_menu_item ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $nav_menu_item = array_merge( $core_content[ $type ][ $id ], $nav_menu_item ); } $content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item; } elseif ( is_string( $nav_menu_item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $nav_menu_item ] ) ) { $content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ]; } } } break; case 'attachments': foreach ( $config[ $type ] as $id => $item ) { if ( ! empty( $item['file'] ) ) { $content[ $type ][ $id ] = $item; } } break; case 'posts': foreach ( $config[ $type ] as $id => $item ) { if ( is_array( $item ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $item = array_merge( $core_content[ $type ][ $id ], $item ); } $content[ $type ][ $id ] = wp_array_slice_assoc( $item, array( 'post_type', 'post_title', 'post_excerpt', 'post_name', 'post_content', 'menu_order', 'comment_status', 'thumbnail', 'template', ) ); } elseif ( is_string( $item ) && ! empty( $core_content[ $type ][ $item ] ) ) { $content[ $type ][ $item ] = $core_content[ $type ][ $item ]; } } break; } } return apply_filters( 'get_theme_starter_content', $content, $config ); } function add_theme_support( $feature, ...$args ) { global $_wp_theme_features; if ( ! $args ) { $args = true; } switch ( $feature ) { case 'post-thumbnails': if ( true === get_theme_support( 'post-thumbnails' ) ) { return; } if ( isset( $args[0] ) && is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { $args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) ); } break; case 'post-formats': if ( isset( $args[0] ) && is_array( $args[0] ) ) { $post_formats = get_post_format_slugs(); unset( $post_formats['standard'] ); $args[0] = array_intersect( $args[0], array_keys( $post_formats ) ); } else { _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of post formats.' ), '5.6.0' ); return false; } break; case 'html5': if ( empty( $args[0] ) || ! is_array( $args[0] ) ) { _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' ); if ( ! empty( $args[0] ) && ! is_array( $args[0] ) ) { return false; } $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); } if ( isset( $_wp_theme_features['html5'] ) ) { $args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] ); } break; case 'custom-logo': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'width' => null, 'height' => null, 'flex-width' => false, 'flex-height' => false, 'header-text' => '', 'unlink-homepage-logo' => false, ); $args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults ); if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) { $args[0]['flex-width'] = true; $args[0]['flex-height'] = true; } break; case 'custom-header-uploads': return add_theme_support( 'custom-header', array( 'uploads' => true ) ); case 'custom-header': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', 'video' => false, 'video-active-callback' => 'is_front_page', ); $jit = isset( $args[0]['__jit'] ); unset( $args[0]['__jit'] ); if ( isset( $_wp_theme_features['custom-header'] ) ) { $args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] ); } if ( $jit ) { $args[0] = wp_parse_args( $args[0], $defaults ); } if ( defined( 'NO_HEADER_TEXT' ) ) { $args[0]['header-text'] = ! NO_HEADER_TEXT; } elseif ( isset( $args[0]['header-text'] ) ) { define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) ); } if ( defined( 'HEADER_IMAGE_WIDTH' ) ) { $args[0]['width'] = (int) HEADER_IMAGE_WIDTH; } elseif ( isset( $args[0]['width'] ) ) { define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] ); } if ( defined( 'HEADER_IMAGE_HEIGHT' ) ) { $args[0]['height'] = (int) HEADER_IMAGE_HEIGHT; } elseif ( isset( $args[0]['height'] ) ) { define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] ); } if ( defined( 'HEADER_TEXTCOLOR' ) ) { $args[0]['default-text-color'] = HEADER_TEXTCOLOR; } elseif ( isset( $args[0]['default-text-color'] ) ) { define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] ); } if ( defined( 'HEADER_IMAGE' ) ) { $args[0]['default-image'] = HEADER_IMAGE; } elseif ( isset( $args[0]['default-image'] ) ) { define( 'HEADER_IMAGE', $args[0]['default-image'] ); } if ( $jit && ! empty( $args[0]['default-image'] ) ) { $args[0]['random-default'] = false; } if ( $jit ) { if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) ) { $args[0]['flex-width'] = true; } if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) ) { $args[0]['flex-height'] = true; } } break; case 'custom-background': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'default-image' => '', 'default-preset' => 'default', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-repeat' => 'repeat', 'default-attachment' => 'scroll', 'default-color' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); $jit = isset( $args[0]['__jit'] ); unset( $args[0]['__jit'] ); if ( isset( $_wp_theme_features['custom-background'] ) ) { $args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] ); } if ( $jit ) { $args[0] = wp_parse_args( $args[0], $defaults ); } if ( defined( 'BACKGROUND_COLOR' ) ) { $args[0]['default-color'] = BACKGROUND_COLOR; } elseif ( isset( $args[0]['default-color'] ) || $jit ) { define( 'BACKGROUND_COLOR', $args[0]['default-color'] ); } if ( defined( 'BACKGROUND_IMAGE' ) ) { $args[0]['default-image'] = BACKGROUND_IMAGE; } elseif ( isset( $args[0]['default-image'] ) || $jit ) { define( 'BACKGROUND_IMAGE', $args[0]['default-image'] ); } break; case 'title-tag': if ( did_action( 'wp_loaded' ) ) { _doing_it_wrong( "add_theme_support( 'title-tag' )", sprintf( __( 'Theme support for %1$s should be registered before the %2$s hook.' ), 'title-tag', 'wp_loaded' ), '4.1.0' ); return false; } } $_wp_theme_features[ $feature ] = $args; } function _custom_header_background_just_in_time() { global $custom_image_header, $custom_background; if ( current_theme_supports( 'custom-header' ) ) { add_theme_support( 'custom-header', array( '__jit' => true ) ); $args = get_theme_support( 'custom-header' ); if ( $args[0]['wp-head-callback'] ) { add_action( 'wp_head', $args[0]['wp-head-callback'] ); } if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php'; $custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } if ( current_theme_supports( 'custom-background' ) ) { add_theme_support( 'custom-background', array( '__jit' => true ) ); $args = get_theme_support( 'custom-background' ); add_action( 'wp_head', $args[0]['wp-head-callback'] ); if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-background.php'; $custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } } function _custom_logo_header_styles() { if ( ! current_theme_supports( 'custom-header', 'header-text' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) { $classes = (array) get_theme_support( 'custom-logo', 'header-text' ); $classes = array_map( 'sanitize_html_class', $classes ); $classes = '.' . implode( ', .', $classes ); $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; ?> + + + false ) ); return; } if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } switch ( $feature ) { case 'custom-header': if ( ! did_action( 'wp_loaded' ) ) { break; } $support = get_theme_support( 'custom-header' ); if ( isset( $support[0]['wp-head-callback'] ) ) { remove_action( 'wp_head', $support[0]['wp-head-callback'] ); } if ( isset( $GLOBALS['custom_image_header'] ) ) { remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); unset( $GLOBALS['custom_image_header'] ); } break; case 'custom-background': if ( ! did_action( 'wp_loaded' ) ) { break; } $support = get_theme_support( 'custom-background' ); if ( isset( $support[0]['wp-head-callback'] ) ) { remove_action( 'wp_head', $support[0]['wp-head-callback'] ); } remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); unset( $GLOBALS['custom_background'] ); break; } unset( $_wp_theme_features[ $feature ] ); return true; } function current_theme_supports( $feature, ...$args ) { global $_wp_theme_features; if ( 'custom-header-uploads' === $feature ) { return current_theme_supports( 'custom-header', 'uploads' ); } if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } if ( ! $args ) { return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); } switch ( $feature ) { case 'post-thumbnails': if ( true === $_wp_theme_features[ $feature ] ) { return true; } $content_type = $args[0]; return in_array( $content_type, $_wp_theme_features[ $feature ][0], true ); case 'html5': case 'post-formats': $type = $args[0]; return in_array( $type, $_wp_theme_features[ $feature ][0], true ); case 'custom-logo': case 'custom-header': case 'custom-background': return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] ); } return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); } function require_if_theme_supports( $feature, $include ) { if ( current_theme_supports( $feature ) ) { require $include; return true; } return false; } function register_theme_feature( $feature, $args = array() ) { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { $_wp_registered_theme_features = array(); } $defaults = array( 'type' => 'boolean', 'variadic' => false, 'description' => '', 'show_in_rest' => false, ); $args = wp_parse_args( $args, $defaults ); if ( true === $args['show_in_rest'] ) { $args['show_in_rest'] = array(); } if ( is_array( $args['show_in_rest'] ) ) { $args['show_in_rest'] = wp_parse_args( $args['show_in_rest'], array( 'schema' => array(), 'name' => $feature, 'prepare_callback' => null, ) ); } if ( ! in_array( $args['type'], array( 'string', 'boolean', 'integer', 'number', 'array', 'object' ), true ) ) { return new WP_Error( 'invalid_type', __( 'The feature "type" is not valid JSON Schema type.' ) ); } if ( true === $args['variadic'] && 'array' !== $args['type'] ) { return new WP_Error( 'variadic_must_be_array', __( 'When registering a "variadic" theme feature, the "type" must be an "array".' ) ); } if ( false !== $args['show_in_rest'] && in_array( $args['type'], array( 'array', 'object' ), true ) ) { if ( ! is_array( $args['show_in_rest'] ) || empty( $args['show_in_rest']['schema'] ) ) { return new WP_Error( 'missing_schema', __( 'When registering an "array" or "object" feature to show in the REST API, the feature\'s schema must also be defined.' ) ); } if ( 'array' === $args['type'] && ! isset( $args['show_in_rest']['schema']['items'] ) ) { return new WP_Error( 'missing_schema_items', __( 'When registering an "array" feature, the feature\'s schema must include the "items" keyword.' ) ); } if ( 'object' === $args['type'] && ! isset( $args['show_in_rest']['schema']['properties'] ) ) { return new WP_Error( 'missing_schema_properties', __( 'When registering an "object" feature, the feature\'s schema must include the "properties" keyword.' ) ); } } if ( is_array( $args['show_in_rest'] ) ) { if ( isset( $args['show_in_rest']['prepare_callback'] ) && ! is_callable( $args['show_in_rest']['prepare_callback'] ) ) { return new WP_Error( 'invalid_rest_prepare_callback', sprintf( __( 'The "%s" must be a callable function.' ), 'prepare_callback' ) ); } $args['show_in_rest']['schema'] = wp_parse_args( $args['show_in_rest']['schema'], array( 'description' => $args['description'], 'type' => $args['type'], 'default' => false, ) ); if ( is_bool( $args['show_in_rest']['schema']['default'] ) && ! in_array( 'boolean', (array) $args['show_in_rest']['schema']['type'], true ) ) { $args['show_in_rest']['schema']['type'] = (array) $args['show_in_rest']['schema']['type']; array_unshift( $args['show_in_rest']['schema']['type'], 'boolean' ); } $args['show_in_rest']['schema'] = rest_default_additional_properties_to_false( $args['show_in_rest']['schema'] ); } $_wp_registered_theme_features[ $feature ] = $args; return true; } function get_registered_theme_features() { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { return array(); } return $_wp_registered_theme_features; } function get_registered_theme_feature( $feature ) { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { return null; } return isset( $_wp_registered_theme_features[ $feature ] ) ? $_wp_registered_theme_features[ $feature ] : null; } function _delete_attachment_theme_mod( $id ) { $attachment_image = wp_get_attachment_url( $id ); $header_image = get_header_image(); $background_image = get_background_image(); $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id && $custom_logo_id == $id ) { remove_theme_mod( 'custom_logo' ); remove_theme_mod( 'header_text' ); } if ( $header_image && $header_image == $attachment_image ) { remove_theme_mod( 'header_image' ); remove_theme_mod( 'header_image_data' ); } if ( $background_image && $background_image == $attachment_image ) { remove_theme_mod( 'background_image' ); } } function check_theme_switched() { $stylesheet = get_option( 'theme_switched' ); if ( $stylesheet ) { $old_theme = wp_get_theme( $stylesheet ); if ( get_option( 'theme_switched_via_customizer' ) ) { remove_action( 'after_switch_theme', '_wp_menus_changed' ); remove_action( 'after_switch_theme', '_wp_sidebars_changed' ); update_option( 'theme_switched_via_customizer', false ); } if ( $old_theme->exists() ) { do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme ); } else { do_action( 'after_switch_theme', $stylesheet, $old_theme ); } flush_rewrite_rules(); update_option( 'theme_switched', false ); } } function _wp_customize_include() { $is_customize_admin_page = ( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) ); $should_include = ( $is_customize_admin_page || ( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] ) || ( ! empty( $_GET['customize_changeset_uuid'] ) || ! empty( $_POST['customize_changeset_uuid'] ) ) ); if ( ! $should_include ) { return; } $keys = array( 'changeset_uuid', 'customize_changeset_uuid', 'customize_theme', 'theme', 'customize_messenger_channel', 'customize_autosaved', ); $input_vars = array_merge( wp_array_slice_assoc( $_GET, $keys ), wp_array_slice_assoc( $_POST, $keys ) ); $theme = null; $autosaved = null; $messenger_channel = null; $changeset_uuid = false; $branching = false; if ( $is_customize_admin_page && isset( $input_vars['changeset_uuid'] ) ) { $changeset_uuid = sanitize_key( $input_vars['changeset_uuid'] ); } elseif ( ! empty( $input_vars['customize_changeset_uuid'] ) ) { $changeset_uuid = sanitize_key( $input_vars['customize_changeset_uuid'] ); } if ( $is_customize_admin_page && isset( $input_vars['theme'] ) ) { $theme = $input_vars['theme']; } elseif ( isset( $input_vars['customize_theme'] ) ) { $theme = $input_vars['customize_theme']; } if ( ! empty( $input_vars['customize_autosaved'] ) ) { $autosaved = true; } if ( isset( $input_vars['customize_messenger_channel'] ) ) { $messenger_channel = sanitize_key( $input_vars['customize_messenger_channel'] ); } $is_customize_save_action = ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && 'customize_save' === wp_unslash( $_REQUEST['action'] ) ); $settings_previewed = ! $is_customize_save_action; require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $GLOBALS['wp_customize'] = new WP_Customize_Manager( compact( 'changeset_uuid', 'theme', 'messenger_channel', 'settings_previewed', 'autosaved', 'branching' ) ); } function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_post ) { global $wp_customize, $wpdb; $is_publishing_changeset = ( 'customize_changeset' === $changeset_post->post_type && 'publish' === $new_status && 'publish' !== $old_status ); if ( ! $is_publishing_changeset ) { return; } if ( empty( $wp_customize ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $changeset_post->post_name, 'settings_previewed' => false, ) ); } if ( ! did_action( 'customize_register' ) ) { remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) ); $wp_customize->register_controls(); do_action( 'customize_register', $wp_customize ); } $wp_customize->_publish_changeset_values( $changeset_post->ID ); if ( ! wp_revisions_enabled( $changeset_post ) ) { $wp_customize->trash_changeset_post( $changeset_post->ID ); } } function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_post_data ) { if ( isset( $post_data['post_type'] ) && 'customize_changeset' === $post_data['post_type'] ) { if ( empty( $post_data['post_name'] ) && ! empty( $supplied_post_data['post_name'] ) ) { $post_data['post_name'] = $supplied_post_data['post_name']; } } return $post_data; } function _wp_customize_loader_settings() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) ); $browser = array( 'mobile' => wp_is_mobile(), 'ios' => wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ), ); $settings = array( 'url' => esc_url( admin_url( 'customize.php' ) ), 'isCrossDomain' => $cross_domain, 'browser' => $browser, 'l10n' => array( 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 'mainIframeTitle' => __( 'Customizer' ), ), ); $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';'; $wp_scripts = wp_scripts(); $data = $wp_scripts->get_data( 'customize-loader', 'data' ); if ( $data ) { $script = "$data\n$script"; } $wp_scripts->add_data( 'customize-loader', 'data', $script ); } function wp_customize_url( $stylesheet = '' ) { $url = admin_url( 'customize.php' ); if ( $stylesheet ) { $url .= '?theme=' . urlencode( $stylesheet ); } return esc_url( $url ); } function wp_customize_support_script() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) ); $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"'; ?> + > + (function() { + var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)'); -.options-general-php .date-time-text { - display: inline-block; - min-width: 10em; -} + + request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })(); + + request = true; + -.options-general-php input.small-text { - width: 56px; - margin: -2px 0; -} + b[c] = b[c].replace( rcs, ' ' ); + // The customizer requires postMessage and CORS (if the site is cross domain). + b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs; + }()); + + is_preview(); } function _wp_keep_alive_customize_changeset_dependent_auto_drafts( $new_status, $old_status, $post ) { global $wpdb; unset( $old_status ); if ( 'customize_changeset' !== $post->post_type || 'publish' === $new_status ) { return; } $data = json_decode( $post->post_content, true ); if ( empty( $data['nav_menus_created_posts']['value'] ) ) { return; } if ( 'trash' === $new_status ) { foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) { if ( ! empty( $post_id ) && 'draft' === get_post_status( $post_id ) ) { wp_trash_post( $post_id ); } } return; } $post_args = array(); if ( 'auto-draft' === $new_status ) { $post_args['post_date'] = $post->post_date; } else { $post_args['post_status'] = 'draft'; } foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) { if ( empty( $post_id ) || 'auto-draft' !== get_post_status( $post_id ) ) { continue; } $wpdb->update( $wpdb->posts, $post_args, array( 'ID' => $post_id ) ); clean_post_cache( $post_id ); } } function create_initial_theme_features() { register_theme_feature( 'align-wide', array( 'description' => __( 'Whether theme opts in to wide alignment CSS class.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'automatic-feed-links', array( 'description' => __( 'Whether posts and comments RSS feed links are added to head.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'block-templates', array( 'description' => __( 'Whether a theme uses block-based templates.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'custom-background', array( 'description' => __( 'Custom background if defined by the theme.' ), 'type' => 'object', 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'default-image' => array( 'type' => 'string', 'format' => 'uri', ), 'default-preset' => array( 'type' => 'string', 'enum' => array( 'default', 'fill', 'fit', 'repeat', 'custom', ), ), 'default-position-x' => array( 'type' => 'string', 'enum' => array( 'left', 'center', 'right', ), ), 'default-position-y' => array( 'type' => 'string', 'enum' => array( 'left', 'center', 'right', ), ), 'default-size' => array( 'type' => 'string', 'enum' => array( 'auto', 'contain', 'cover', ), ), 'default-repeat' => array( 'type' => 'string', 'enum' => array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat', ), ), 'default-attachment' => array( 'type' => 'string', 'enum' => array( 'scroll', 'fixed', ), ), 'default-color' => array( 'type' => 'string', ), ), ), ), ) ); register_theme_feature( 'custom-header', array( 'description' => __( 'Custom header if defined by the theme.' ), 'type' => 'object', 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'default-image' => array( 'type' => 'string', 'format' => 'uri', ), 'random-default' => array( 'type' => 'boolean', ), 'width' => array( 'type' => 'integer', ), 'height' => array( 'type' => 'integer', ), 'flex-height' => array( 'type' => 'boolean', ), 'flex-width' => array( 'type' => 'boolean', ), 'default-text-color' => array( 'type' => 'string', ), 'header-text' => array( 'type' => 'boolean', ), 'uploads' => array( 'type' => 'boolean', ), 'video' => array( 'type' => 'boolean', ), ), ), ), ) ); register_theme_feature( 'custom-logo', array( 'type' => 'object', 'description' => __( 'Custom logo if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'width' => array( 'type' => 'integer', ), 'height' => array( 'type' => 'integer', ), 'flex-width' => array( 'type' => 'boolean', ), 'flex-height' => array( 'type' => 'boolean', ), 'header-text' => array( 'type' => 'array', 'items' => array( 'type' => 'string', ), ), 'unlink-homepage-logo' => array( 'type' => 'boolean', ), ), ), ), ) ); register_theme_feature( 'customize-selective-refresh-widgets', array( 'description' => __( 'Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'dark-editor-style', array( 'description' => __( 'Whether theme opts in to the dark editor style UI.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-colors', array( 'description' => __( 'Whether the theme disables custom colors.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-font-sizes', array( 'description' => __( 'Whether the theme disables custom font sizes.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-gradients', array( 'description' => __( 'Whether the theme disables custom gradients.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'editor-color-palette', array( 'type' => 'array', 'description' => __( 'Custom color palette if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'slug' => array( 'type' => 'string', ), 'color' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-font-sizes', array( 'type' => 'array', 'description' => __( 'Custom font sizes if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'size' => array( 'type' => 'number', ), 'slug' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-gradient-presets', array( 'type' => 'array', 'description' => __( 'Custom gradient presets if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'gradient' => array( 'type' => 'string', ), 'slug' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-styles', array( 'description' => __( 'Whether theme opts in to the editor styles CSS wrapper.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'html5', array( 'type' => 'array', 'description' => __( 'Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'string', 'enum' => array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style', ), ), ), ), ) ); register_theme_feature( 'post-formats', array( 'type' => 'array', 'description' => __( 'Post formats supported.' ), 'show_in_rest' => array( 'name' => 'formats', 'schema' => array( 'items' => array( 'type' => 'string', 'enum' => get_post_format_slugs(), ), 'default' => array( 'standard' ), ), 'prepare_callback' => static function ( $formats ) { $formats = is_array( $formats ) ? array_values( $formats[0] ) : array(); $formats = array_merge( array( 'standard' ), $formats ); return $formats; }, ), ) ); register_theme_feature( 'post-thumbnails', array( 'type' => 'array', 'description' => __( 'The post types that support thumbnails or true if all post types are supported.' ), 'show_in_rest' => array( 'type' => array( 'boolean', 'array' ), 'schema' => array( 'items' => array( 'type' => 'string', ), ), ), ) ); register_theme_feature( 'responsive-embeds', array( 'description' => __( 'Whether the theme supports responsive embedded content.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'title-tag', array( 'description' => __( 'Whether the theme can manage the document title tag.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'wp-block-styles', array( 'description' => __( 'Whether theme opts in to default WordPress block styles for viewing.' ), 'show_in_rest' => true, ) ); } function wp_is_block_theme() { return wp_get_theme()->is_block_theme(); } function _add_default_theme_supports() { if ( ! wp_is_block_theme() ) { return; } add_theme_support( 'post-thumbnails' ); add_theme_support( 'responsive-embeds' ); add_theme_support( 'editor-styles' ); add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'search-form', 'gallery', 'caption', 'style', 'script' ) ); add_theme_support( 'automatic-feed-links' ); add_filter( 'should_load_separate_core_block_assets', '__return_true' ); } name = 'feed_' . $filename; $this->mod_name = 'feed_mod_' . $filename; $lifetime = $this->lifetime; $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename ); } public function save( $data ) { if ( $data instanceof SimplePie ) { $data = $data->data; } set_transient( $this->name, $data, $this->lifetime ); set_transient( $this->mod_name, time(), $this->lifetime ); return true; } public function load() { return get_transient( $this->name ); } public function mtime() { return get_transient( $this->mod_name ); } public function touch() { return set_transient( $this->mod_name, time(), $this->lifetime ); } public function unlink() { delete_transient( $this->name ); delete_transient( $this->mod_name ); return true; } } 'Theme Name', 'ThemeURI' => 'Theme URI', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'Version' => 'Version', 'Template' => 'Template', 'Status' => 'Status', 'Tags' => 'Tags', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', ); private static $default_themes = array( 'classic' => 'WordPress Classic', 'default' => 'WordPress Default', 'twentyten' => 'Twenty Ten', 'twentyeleven' => 'Twenty Eleven', 'twentytwelve' => 'Twenty Twelve', 'twentythirteen' => 'Twenty Thirteen', 'twentyfourteen' => 'Twenty Fourteen', 'twentyfifteen' => 'Twenty Fifteen', 'twentysixteen' => 'Twenty Sixteen', 'twentyseventeen' => 'Twenty Seventeen', 'twentynineteen' => 'Twenty Nineteen', 'twentytwenty' => 'Twenty Twenty', 'twentytwentyone' => 'Twenty Twenty-One', 'twentytwentytwo' => 'Twenty Twenty-Two', ); private static $tag_map = array( 'fixed-width' => 'fixed-layout', 'flexible-width' => 'fluid-layout', ); private $theme_root; private $headers = array(); private $headers_sanitized; private $name_translated; private $errors; private $stylesheet; private $template; private $parent; private $theme_root_uri; private $textdomain_loaded; private $cache_hash; private static $persistently_cache; private static $cache_expiration = 1800; public function __construct( $theme_dir, $theme_root, $_child = null ) { global $wp_theme_directories; if ( ! isset( self::$persistently_cache ) ) { self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' ); if ( self::$persistently_cache ) { wp_cache_add_global_groups( 'themes' ); if ( is_int( self::$persistently_cache ) ) { self::$cache_expiration = self::$persistently_cache; } } else { wp_cache_add_non_persistent_groups( 'themes' ); } } $this->theme_root = $theme_root; $this->stylesheet = $theme_dir; if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories, true ) ) { $this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet; $this->theme_root = dirname( $theme_root ); } $this->cache_hash = md5( $this->theme_root . '/' . $this->stylesheet ); $theme_file = $this->stylesheet . '/style.css'; $cache = $this->cache_get( 'theme' ); if ( is_array( $cache ) ) { foreach ( array( 'errors', 'headers', 'template' ) as $key ) { if ( isset( $cache[ $key ] ) ) { $this->$key = $cache[ $key ]; } } if ( $this->errors ) { return; } if ( isset( $cache['theme_root_template'] ) ) { $theme_root_template = $cache['theme_root_template']; } } elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) { $this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) ); } else { $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) ); } $this->template = $this->stylesheet; $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); if ( ! file_exists( $this->theme_root ) ) { $this->errors->add( 'theme_root_missing', __( 'Error: The themes directory is either empty or does not exist. Please check your installation.' ) ); } return; } elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; $this->errors = new WP_Error( 'theme_stylesheet_not_readable', __( 'Stylesheet is not readable.' ) ); $this->template = $this->stylesheet; $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); return; } else { $this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' ); $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true ); if ( $default_theme_slug ) { if ( basename( $this->stylesheet ) != $default_theme_slug ) { $this->headers['Name'] .= '/' . $this->stylesheet; } } } if ( ! $this->template && $this->stylesheet === $this->headers['Template'] ) { $this->errors = new WP_Error( 'theme_child_invalid', sprintf( __( 'The theme defines itself as its parent theme. Please check the %s header.' ), 'Template' ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, ) ); return; } if ( ! $this->template ) { $this->template = $this->headers['Template']; } if ( ! $this->template ) { $this->template = $this->stylesheet; $theme_path = $this->theme_root . '/' . $this->stylesheet; if ( ! file_exists( $theme_path . '/templates/index.html' ) && ! file_exists( $theme_path . '/block-templates/index.html' ) && ! file_exists( $theme_path . '/index.php' ) ) { $error_message = sprintf( __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. Child themes need to have a %4$s header in the %5$s stylesheet.' ), 'templates/index.html', 'index.php', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), 'Template', 'style.css' ); $this->errors = new WP_Error( 'theme_no_index', $error_message ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); return; } } if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) { $parent_dir = dirname( $this->stylesheet ); $directories = search_theme_directories(); if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) { $this->template = $parent_dir . '/' . $this->template; } elseif ( $directories && isset( $directories[ $this->template ] ) ) { $theme_root_template = $directories[ $this->template ]['theme_root']; } else { $this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); $this->parent = new WP_Theme( $this->template, $this->theme_root, $this ); return; } } if ( $this->template != $this->stylesheet ) { if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) { $_child->parent = null; $_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) ); $_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template, ) ); if ( $_child->stylesheet == $this->template ) { $this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); } return; } $this->parent = new WP_Theme( $this->template, isset( $theme_root_template ) ? $theme_root_template : $this->theme_root, $this ); } if ( wp_paused_themes()->get( $this->stylesheet ) && ( ! is_wp_error( $this->errors ) || ! isset( $this->errors->errors['theme_paused'] ) ) ) { $this->errors = new WP_Error( 'theme_paused', __( 'This theme failed to load properly and was paused within the admin backend.' ) ); } if ( ! is_array( $cache ) ) { $cache = array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ); if ( isset( $theme_root_template ) ) { $cache['theme_root_template'] = $theme_root_template; } $this->cache_add( 'theme', $cache ); } } public function __toString() { return (string) $this->display( 'Name' ); } public function __isset( $offset ) { static $properties = array( 'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet', 'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri', ); return in_array( $offset, $properties, true ); } public function __get( $offset ) { switch ( $offset ) { case 'name': case 'title': return $this->get( 'Name' ); case 'version': return $this->get( 'Version' ); case 'parent_theme': return $this->parent() ? $this->parent()->get( 'Name' ) : ''; case 'template_dir': return $this->get_template_directory(); case 'stylesheet_dir': return $this->get_stylesheet_directory(); case 'template': return $this->get_template(); case 'stylesheet': return $this->get_stylesheet(); case 'screenshot': return $this->get_screenshot( 'relative' ); case 'description': return $this->display( 'Description' ); case 'author': return $this->display( 'Author' ); case 'tags': return $this->get( 'Tags' ); case 'theme_root': return $this->get_theme_root(); case 'theme_root_uri': return $this->get_theme_root_uri(); default: return $this->offsetGet( $offset ); } } #[ReturnTypeWillChange] public function offsetSet( $offset, $value ) {} #[ReturnTypeWillChange] public function offsetUnset( $offset ) {} #[ReturnTypeWillChange] public function offsetExists( $offset ) { static $keys = array( 'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description', 'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir', 'Screenshot', 'Tags', 'Theme Root', 'Theme Root URI', 'Parent Theme', ); return in_array( $offset, $keys, true ); } #[ReturnTypeWillChange] public function offsetGet( $offset ) { switch ( $offset ) { case 'Name': case 'Title': return $this->get( 'Name' ); case 'Author': return $this->display( 'Author' ); case 'Author Name': return $this->display( 'Author', false ); case 'Author URI': return $this->display( 'AuthorURI' ); case 'Description': return $this->display( 'Description' ); case 'Version': case 'Status': return $this->get( $offset ); case 'Template': return $this->get_template(); case 'Stylesheet': return $this->get_stylesheet(); case 'Template Files': return $this->get_files( 'php', 1, true ); case 'Stylesheet Files': return $this->get_files( 'css', 0, false ); case 'Template Dir': return $this->get_template_directory(); case 'Stylesheet Dir': return $this->get_stylesheet_directory(); case 'Screenshot': return $this->get_screenshot( 'relative' ); case 'Tags': return $this->get( 'Tags' ); case 'Theme Root': return $this->get_theme_root(); case 'Theme Root URI': return $this->get_theme_root_uri(); case 'Parent Theme': return $this->parent() ? $this->parent()->get( 'Name' ) : ''; default: return null; } } public function errors() { return is_wp_error( $this->errors ) ? $this->errors : false; } public function exists() { return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes(), true ) ); } public function parent() { return isset( $this->parent ) ? $this->parent : false; } private function cache_add( $key, $data ) { return wp_cache_add( $key . '-' . $this->cache_hash, $data, 'themes', self::$cache_expiration ); } private function cache_get( $key ) { return wp_cache_get( $key . '-' . $this->cache_hash, 'themes' ); } public function cache_delete() { foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key ) { wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' ); } $this->template = null; $this->textdomain_loaded = null; $this->theme_root_uri = null; $this->parent = null; $this->errors = null; $this->headers_sanitized = null; $this->name_translated = null; $this->headers = array(); $this->__construct( $this->stylesheet, $this->theme_root ); } public function get( $header ) { if ( ! isset( $this->headers[ $header ] ) ) { return false; } if ( ! isset( $this->headers_sanitized ) ) { $this->headers_sanitized = $this->cache_get( 'headers' ); if ( ! is_array( $this->headers_sanitized ) ) { $this->headers_sanitized = array(); } } if ( isset( $this->headers_sanitized[ $header ] ) ) { return $this->headers_sanitized[ $header ]; } if ( self::$persistently_cache ) { foreach ( array_keys( $this->headers ) as $_header ) { $this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] ); } $this->cache_add( 'headers', $this->headers_sanitized ); } else { $this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] ); } return $this->headers_sanitized[ $header ]; } public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); if ( false === $value ) { return false; } if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) { $translate = false; } if ( $translate ) { $value = $this->translate_header( $header, $value ); } if ( $markup ) { $value = $this->markup_header( $header, $value, $translate ); } return $value; } private function sanitize_header( $header, $value ) { switch ( $header ) { case 'Status': if ( ! $value ) { $value = 'publish'; break; } case 'Name': static $header_tags = array( 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $value = wp_kses( $value, $header_tags ); break; case 'Author': case 'Description': static $header_tags_with_a = array( 'a' => array( 'href' => true, 'title' => true, ), 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $value = wp_kses( $value, $header_tags_with_a ); break; case 'ThemeURI': case 'AuthorURI': $value = esc_url_raw( $value ); break; case 'Tags': $value = array_filter( array_map( 'trim', explode( ',', strip_tags( $value ) ) ) ); break; case 'Version': case 'RequiresWP': case 'RequiresPHP': $value = strip_tags( $value ); break; } return $value; } private function markup_header( $header, $value, $translate ) { switch ( $header ) { case 'Name': if ( empty( $value ) ) { $value = esc_html( $this->get_stylesheet() ); } break; case 'Description': $value = wptexturize( $value ); break; case 'Author': if ( $this->get( 'AuthorURI' ) ) { $value = sprintf( '%2$s', $this->display( 'AuthorURI', true, $translate ), $value ); } elseif ( ! $value ) { $value = __( 'Anonymous' ); } break; case 'Tags': static $comma = null; if ( ! isset( $comma ) ) { $comma = wp_get_list_item_separator(); } $value = implode( $comma, $value ); break; case 'ThemeURI': case 'AuthorURI': $value = esc_url( $value ); break; } return $value; } private function translate_header( $header, $value ) { switch ( $header ) { case 'Name': if ( isset( $this->name_translated ) ) { return $this->name_translated; } $this->name_translated = translate( $value, $this->get( 'TextDomain' ) ); return $this->name_translated; case 'Tags': if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) ) { return $value; } static $tags_list; if ( ! isset( $tags_list ) ) { $tags_list = array( 'black' => __( 'Black' ), 'blue' => __( 'Blue' ), 'brown' => __( 'Brown' ), 'gray' => __( 'Gray' ), 'green' => __( 'Green' ), 'orange' => __( 'Orange' ), 'pink' => __( 'Pink' ), 'purple' => __( 'Purple' ), 'red' => __( 'Red' ), 'silver' => __( 'Silver' ), 'tan' => __( 'Tan' ), 'white' => __( 'White' ), 'yellow' => __( 'Yellow' ), 'dark' => _x( 'Dark', 'color scheme' ), 'light' => _x( 'Light', 'color scheme' ), 'fixed-layout' => __( 'Fixed Layout' ), 'fluid-layout' => __( 'Fluid Layout' ), 'responsive-layout' => __( 'Responsive Layout' ), 'blavatar' => __( 'Blavatar' ), 'photoblogging' => __( 'Photoblogging' ), 'seasonal' => __( 'Seasonal' ), ); $feature_list = get_theme_feature_list( false ); foreach ( $feature_list as $tags ) { $tags_list += $tags; } } foreach ( $value as &$tag ) { if ( isset( $tags_list[ $tag ] ) ) { $tag = $tags_list[ $tag ]; } elseif ( isset( self::$tag_map[ $tag ] ) ) { $tag = $tags_list[ self::$tag_map[ $tag ] ]; } } return $value; default: $value = translate( $value, $this->get( 'TextDomain' ) ); } return $value; } public function get_stylesheet() { return $this->stylesheet; } public function get_template() { return $this->template; } public function get_stylesheet_directory() { if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes(), true ) ) { return ''; } return $this->theme_root . '/' . $this->stylesheet; } public function get_template_directory() { if ( $this->parent() ) { $theme_root = $this->parent()->theme_root; } else { $theme_root = $this->theme_root; } return $theme_root . '/' . $this->template; } public function get_stylesheet_directory_uri() { return $this->get_theme_root_uri() . '/' . str_replace( '%2F', '/', rawurlencode( $this->stylesheet ) ); } public function get_template_directory_uri() { if ( $this->parent() ) { $theme_root_uri = $this->parent()->get_theme_root_uri(); } else { $theme_root_uri = $this->get_theme_root_uri(); } return $theme_root_uri . '/' . str_replace( '%2F', '/', rawurlencode( $this->template ) ); } public function get_theme_root() { return $this->theme_root; } public function get_theme_root_uri() { if ( ! isset( $this->theme_root_uri ) ) { $this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root ); } return $this->theme_root_uri; } public function get_screenshot( $uri = 'uri' ) { $screenshot = $this->cache_get( 'screenshot' ); if ( $screenshot ) { if ( 'relative' === $uri ) { return $screenshot; } return $this->get_stylesheet_directory_uri() . '/' . $screenshot; } elseif ( 0 === $screenshot ) { return false; } foreach ( array( 'png', 'gif', 'jpg', 'jpeg', 'webp' ) as $ext ) { if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) { $this->cache_add( 'screenshot', 'screenshot.' . $ext ); if ( 'relative' === $uri ) { return 'screenshot.' . $ext; } return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext; } } $this->cache_add( 'screenshot', 0 ); return false; } public function get_files( $type = null, $depth = 0, $search_parent = false ) { $files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth ); if ( $search_parent && $this->parent() ) { $files += (array) self::scandir( $this->get_template_directory(), $type, $depth ); } return array_filter( $files ); } public function get_post_templates() { if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) ) { return array(); } $post_templates = $this->cache_get( 'post_templates' ); if ( ! is_array( $post_templates ) ) { $post_templates = array(); $files = (array) $this->get_files( 'php', 1, true ); foreach ( $files as $file => $full_path ) { if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { continue; } $types = array( 'page' ); if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) { $types = explode( ',', _cleanup_header_comment( $type[1] ) ); } foreach ( $types as $type ) { $type = sanitize_key( $type ); if ( ! isset( $post_templates[ $type ] ) ) { $post_templates[ $type ] = array(); } $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] ); } } if ( current_theme_supports( 'block-templates' ) ) { $block_templates = get_block_templates( array(), 'wp_template' ); foreach ( get_post_types( array( 'public' => true ) ) as $type ) { foreach ( $block_templates as $block_template ) { if ( ! $block_template->is_custom ) { continue; } if ( isset( $block_template->post_types ) && ! in_array( $type, $block_template->post_types, true ) ) { continue; } $post_templates[ $type ][ $block_template->slug ] = $block_template->title; } } } $this->cache_add( 'post_templates', $post_templates ); } if ( $this->load_textdomain() ) { foreach ( $post_templates as &$post_type ) { foreach ( $post_type as &$post_template ) { $post_template = $this->translate_header( 'Template Name', $post_template ); } } } return $post_templates; } public function get_page_templates( $post = null, $post_type = 'page' ) { if ( $post ) { $post_type = get_post_type( $post ); } $post_templates = $this->get_post_templates(); $post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array(); $post_templates = (array) apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type ); $post_templates = (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type ); return $post_templates; } private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) { if ( ! is_dir( $path ) ) { return false; } if ( $extensions ) { $extensions = (array) $extensions; $_extensions = implode( '|', $extensions ); } $relative_path = trailingslashit( $relative_path ); if ( '/' === $relative_path ) { $relative_path = ''; } $results = scandir( $path ); $files = array(); $exclusions = (array) apply_filters( 'theme_scandir_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) ); foreach ( $results as $result ) { if ( '.' === $result[0] || in_array( $result, $exclusions, true ) ) { continue; } if ( is_dir( $path . '/' . $result ) ) { if ( ! $depth ) { continue; } $found = self::scandir( $path . '/' . $result, $extensions, $depth - 1, $relative_path . $result ); $files = array_merge_recursive( $files, $found ); } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) { $files[ $relative_path . $result ] = $path . '/' . $result; } } return $files; } public function load_textdomain() { if ( isset( $this->textdomain_loaded ) ) { return $this->textdomain_loaded; } $textdomain = $this->get( 'TextDomain' ); if ( ! $textdomain ) { $this->textdomain_loaded = false; return false; } if ( is_textdomain_loaded( $textdomain ) ) { $this->textdomain_loaded = true; return true; } $path = $this->get_stylesheet_directory(); $domainpath = $this->get( 'DomainPath' ); if ( $domainpath ) { $path .= $domainpath; } else { $path .= '/languages'; } $this->textdomain_loaded = load_theme_textdomain( $textdomain, $path ); return $this->textdomain_loaded; } public function is_allowed( $check = 'both', $blog_id = null ) { if ( ! is_multisite() ) { return true; } if ( 'both' === $check || 'network' === $check ) { $allowed = self::get_allowed_on_network(); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } if ( 'both' === $check || 'site' === $check ) { $allowed = self::get_allowed_on_site( $blog_id ); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } return false; } public function is_block_theme() { $paths_to_index_block_template = array( $this->get_file_path( '/block-templates/index.html' ), $this->get_file_path( '/templates/index.html' ), ); foreach ( $paths_to_index_block_template as $path_to_index_block_template ) { if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) { return true; } } return false; } public function get_file_path( $file = '' ) { $file = ltrim( $file, '/' ); $stylesheet_directory = $this->get_stylesheet_directory(); $template_directory = $this->get_template_directory(); if ( empty( $file ) ) { $path = $stylesheet_directory; } elseif ( file_exists( $stylesheet_directory . '/' . $file ) ) { $path = $stylesheet_directory . '/' . $file; } else { $path = $template_directory . '/' . $file; } return apply_filters( 'theme_file_path', $path, $file ); } public static function get_core_default_theme() { foreach ( array_reverse( self::$default_themes ) as $slug => $name ) { $theme = wp_get_theme( $slug ); if ( $theme->exists() ) { return $theme; } } return false; } public static function get_allowed( $blog_id = null ) { $network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id ); return $network + self::get_allowed_on_site( $blog_id ); } public static function get_allowed_on_network() { static $allowed_themes; if ( ! isset( $allowed_themes ) ) { $allowed_themes = (array) get_site_option( 'allowedthemes' ); } $allowed_themes = apply_filters( 'allowed_themes', $allowed_themes ); return $allowed_themes; } public static function get_allowed_on_site( $blog_id = null ) { static $allowed_themes = array(); if ( ! $blog_id || ! is_multisite() ) { $blog_id = get_current_blog_id(); } if ( isset( $allowed_themes[ $blog_id ] ) ) { return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } $current = get_current_blog_id() == $blog_id; if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); } else { switch_to_blog( $blog_id ); $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); restore_current_blog(); } if ( false === $allowed_themes[ $blog_id ] ) { if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); $allowed_themes[ $blog_id ] = get_option( 'allowed_themes' ); restore_current_blog(); } if ( ! is_array( $allowed_themes[ $blog_id ] ) || empty( $allowed_themes[ $blog_id ] ) ) { $allowed_themes[ $blog_id ] = array(); } else { $converted = array(); $themes = wp_get_themes(); foreach ( $themes as $stylesheet => $theme_data ) { if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get( 'Name' ) ] ) ) { $converted[ $stylesheet ] = true; } } $allowed_themes[ $blog_id ] = $converted; } if ( is_admin() && $allowed_themes[ $blog_id ] ) { if ( $current ) { update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); restore_current_blog(); } } } return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } public static function network_enable_theme( $stylesheets ) { if ( ! is_multisite() ) { return; } if ( ! is_array( $stylesheets ) ) { $stylesheets = array( $stylesheets ); } $allowed_themes = get_site_option( 'allowedthemes' ); foreach ( $stylesheets as $stylesheet ) { $allowed_themes[ $stylesheet ] = true; } update_site_option( 'allowedthemes', $allowed_themes ); } public static function network_disable_theme( $stylesheets ) { if ( ! is_multisite() ) { return; } if ( ! is_array( $stylesheets ) ) { $stylesheets = array( $stylesheets ); } $allowed_themes = get_site_option( 'allowedthemes' ); foreach ( $stylesheets as $stylesheet ) { if ( isset( $allowed_themes[ $stylesheet ] ) ) { unset( $allowed_themes[ $stylesheet ] ); } } update_site_option( 'allowedthemes', $allowed_themes ); } public static function sort_by_name( &$themes ) { if ( 0 === strpos( get_user_locale(), 'en_' ) ) { uasort( $themes, array( 'WP_Theme', '_name_sort' ) ); } else { foreach ( $themes as $key => $theme ) { $theme->translate_header( 'Name', $theme->headers['Name'] ); } uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) ); } } private static function _name_sort( $a, $b ) { return strnatcasecmp( $a->headers['Name'], $b->headers['Name'] ); } private static function _name_sort_i18n( $a, $b ) { return strnatcasecmp( $a->name_translated, $b->name_translated ); } } show_errors(); } if ( function_exists( 'mysqli_connect' ) ) { $this->use_mysqli = true; if ( defined( 'WP_USE_EXT_MYSQL' ) ) { $this->use_mysqli = ! WP_USE_EXT_MYSQL; } } $this->dbuser = $dbuser; $this->dbpassword = $dbpassword; $this->dbname = $dbname; $this->dbhost = $dbhost; if ( defined( 'WP_SETUP_CONFIG' ) ) { return; } $this->db_connect(); } public function __get( $name ) { if ( 'col_info' === $name ) { $this->load_col_info(); } return $this->$name; } public function __set( $name, $value ) { $protected_members = array( 'col_meta', 'table_charset', 'check_current_query', ); if ( in_array( $name, $protected_members, true ) ) { return; } $this->$name = $value; } public function __isset( $name ) { return isset( $this->$name ); } public function __unset( $name ) { unset( $this->$name ); } public function init_charset() { $charset = ''; $collate = ''; if ( function_exists( 'is_multisite' ) && is_multisite() ) { $charset = 'utf8'; if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) { $collate = DB_COLLATE; } else { $collate = 'utf8_general_ci'; } } elseif ( defined( 'DB_COLLATE' ) ) { $collate = DB_COLLATE; } if ( defined( 'DB_CHARSET' ) ) { $charset = DB_CHARSET; } $charset_collate = $this->determine_charset( $charset, $collate ); $this->charset = $charset_collate['charset']; $this->collate = $charset_collate['collate']; } public function determine_charset( $charset, $collate ) { if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) { return compact( 'charset', 'collate' ); } if ( 'utf8' === $charset && $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8mb4'; } if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8'; $collate = str_replace( 'utf8mb4_', 'utf8_', $collate ); } if ( 'utf8mb4' === $charset ) { if ( ! $collate || 'utf8_general_ci' === $collate ) { $collate = 'utf8mb4_unicode_ci'; } else { $collate = str_replace( 'utf8_', 'utf8mb4_', $collate ); } } if ( $this->has_cap( 'utf8mb4_520' ) && 'utf8mb4_unicode_ci' === $collate ) { $collate = 'utf8mb4_unicode_520_ci'; } return compact( 'charset', 'collate' ); } public function set_charset( $dbh, $charset = null, $collate = null ) { if ( ! isset( $charset ) ) { $charset = $this->charset; } if ( ! isset( $collate ) ) { $collate = $this->collate; } if ( $this->has_cap( 'collation' ) && ! empty( $charset ) ) { $set_charset_succeeded = true; if ( $this->use_mysqli ) { if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) { $set_charset_succeeded = mysqli_set_charset( $dbh, $charset ); } if ( $set_charset_succeeded ) { $query = $this->prepare( 'SET NAMES %s', $charset ); if ( ! empty( $collate ) ) { $query .= $this->prepare( ' COLLATE %s', $collate ); } mysqli_query( $dbh, $query ); } } else { if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) { $set_charset_succeeded = mysql_set_charset( $charset, $dbh ); } if ( $set_charset_succeeded ) { $query = $this->prepare( 'SET NAMES %s', $charset ); if ( ! empty( $collate ) ) { $query .= $this->prepare( ' COLLATE %s', $collate ); } mysql_query( $query, $dbh ); } } } } public function set_sql_mode( $modes = array() ) { if ( empty( $modes ) ) { if ( $this->use_mysqli ) { $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' ); } else { $res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh ); } if ( empty( $res ) ) { return; } if ( $this->use_mysqli ) { $modes_array = mysqli_fetch_array( $res ); if ( empty( $modes_array[0] ) ) { return; } $modes_str = $modes_array[0]; } else { $modes_str = mysql_result( $res, 0 ); } if ( empty( $modes_str ) ) { return; } $modes = explode( ',', $modes_str ); } $modes = array_change_key_case( $modes, CASE_UPPER ); $incompatible_modes = (array) apply_filters( 'incompatible_sql_modes', $this->incompatible_modes ); foreach ( $modes as $i => $mode ) { if ( in_array( $mode, $incompatible_modes, true ) ) { unset( $modes[ $i ] ); } } $modes_str = implode( ',', $modes ); if ( $this->use_mysqli ) { mysqli_query( $this->dbh, "SET SESSION sql_mode='$modes_str'" ); } else { mysql_query( "SET SESSION sql_mode='$modes_str'", $this->dbh ); } } public function set_prefix( $prefix, $set_table_names = true ) { if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { return new WP_Error( 'invalid_db_prefix', 'Invalid database prefix' ); } $old_prefix = is_multisite() ? '' : $prefix; if ( isset( $this->base_prefix ) ) { $old_prefix = $this->base_prefix; } $this->base_prefix = $prefix; if ( $set_table_names ) { foreach ( $this->tables( 'global' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } if ( is_multisite() && empty( $this->blogid ) ) { return $old_prefix; } $this->prefix = $this->get_blog_prefix(); foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } } return $old_prefix; } public function set_blog_id( $blog_id, $network_id = 0 ) { if ( ! empty( $network_id ) ) { $this->siteid = $network_id; } $old_blog_id = $this->blogid; $this->blogid = $blog_id; $this->prefix = $this->get_blog_prefix(); foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } return $old_blog_id; } public function get_blog_prefix( $blog_id = null ) { if ( is_multisite() ) { if ( null === $blog_id ) { $blog_id = $this->blogid; } $blog_id = (int) $blog_id; if ( defined( 'MULTISITE' ) && ( 0 === $blog_id || 1 === $blog_id ) ) { return $this->base_prefix; } else { return $this->base_prefix . $blog_id . '_'; } } else { return $this->base_prefix; } } public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) { switch ( $scope ) { case 'all': $tables = array_merge( $this->global_tables, $this->tables ); if ( is_multisite() ) { $tables = array_merge( $tables, $this->ms_global_tables ); } break; case 'blog': $tables = $this->tables; break; case 'global': $tables = $this->global_tables; if ( is_multisite() ) { $tables = array_merge( $tables, $this->ms_global_tables ); } break; case 'ms_global': $tables = $this->ms_global_tables; break; case 'old': $tables = $this->old_tables; break; default: return array(); } if ( $prefix ) { if ( ! $blog_id ) { $blog_id = $this->blogid; } $blog_prefix = $this->get_blog_prefix( $blog_id ); $base_prefix = $this->base_prefix; $global_tables = array_merge( $this->global_tables, $this->ms_global_tables ); foreach ( $tables as $k => $table ) { if ( in_array( $table, $global_tables, true ) ) { $tables[ $table ] = $base_prefix . $table; } else { $tables[ $table ] = $blog_prefix . $table; } unset( $tables[ $k ] ); } if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) ) { $tables['users'] = CUSTOM_USER_TABLE; } if ( isset( $tables['usermeta'] ) && defined( 'CUSTOM_USER_META_TABLE' ) ) { $tables['usermeta'] = CUSTOM_USER_META_TABLE; } } return $tables; } public function select( $db, $dbh = null ) { 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 = '

          ' . __( 'Cannot select database' ) . "

          \n"; $message .= '

          ' . sprintf( __( 'The database server could be connected to (which means your username and password is okay) but the %s database could not be selected.' ), '' . htmlspecialchars( $db, ENT_QUOTES ) . '' ) . "

          \n"; $message .= "
            \n"; $message .= '
          • ' . __( 'Are you sure it exists?' ) . "
          • \n"; $message .= '
          • ' . sprintf( __( 'Does the user %1$s have permission to use the %2$s database?' ), '' . htmlspecialchars( $this->dbuser, ENT_QUOTES ) . '', '' . htmlspecialchars( $db, ENT_QUOTES ) . '' ) . "
          • \n"; $message .= '
          • ' . sprintf( __( 'On some systems the name of your database is prefixed with your username, so it would be like username_%1$s. Could that be the problem?' ), htmlspecialchars( $db, ENT_QUOTES ) ) . "
          • \n"; $message .= "
          \n"; $message .= '

          ' . sprintf( __( 'If you do not know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

          \n"; $this->bail( $message, 'db_select_fail' ); } } } public function _weak_escape( $string ) { if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) { _deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' ); } return addslashes( $string ); } public function _real_escape( $string ) { if ( ! is_scalar( $string ) ) { return ''; } if ( $this->dbh ) { if ( $this->use_mysqli ) { $escaped = mysqli_real_escape_string( $this->dbh, $string ); } else { $escaped = mysql_real_escape_string( $string, $this->dbh ); } } else { $class = get_class( $this ); wp_load_translations_early(); _doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' ); $escaped = addslashes( $string ); } return $this->add_placeholder_escape( $escaped ); } public function _escape( $data ) { if ( is_array( $data ) ) { foreach ( $data as $k => $v ) { if ( is_array( $v ) ) { $data[ $k ] = $this->_escape( $v ); } else { $data[ $k ] = $this->_real_escape( $v ); } } } else { $data = $this->_real_escape( $data ); } return $data; } public function escape( $data ) { if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) { _deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' ); } if ( is_array( $data ) ) { foreach ( $data as $k => $v ) { if ( is_array( $v ) ) { $data[ $k ] = $this->escape( $v, 'recursive' ); } else { $data[ $k ] = $this->_weak_escape( $v, 'internal' ); } } } else { $data = $this->_weak_escape( $data, 'internal' ); } return $data; } public function escape_by_ref( &$string ) { if ( ! is_float( $string ) ) { $string = $this->_real_escape( $string ); } } public function prepare( $query, ...$args ) { if ( is_null( $query ) ) { return; } if ( strpos( $query, '%' ) === false ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' ); } $passed_as_array = false; if ( isset( $args[0] ) && is_array( $args[0] ) && 1 === count( $args ) ) { $passed_as_array = true; $args = $args[0]; } foreach ( $args as $arg ) { if ( ! is_scalar( $arg ) && ! is_null( $arg ) ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' ); } } $allowed_format = '(?:[1-9][0-9]*[$])?[-+0-9]*(?: |0|\'.)?[-+0-9]*(?:\.[0-9]+)?'; $query = str_replace( "'%s'", '%s', $query ); $query = str_replace( '"%s"', '%s', $query ); $query = preg_replace( '/(?add_placeholder_escape( $query ); } public function esc_like( $text ) { return addcslashes( $text, '_%\\' ); } public function print_error( $str = '' ) { global $EZSQL_ERROR; if ( ! $str ) { if ( $this->use_mysqli ) { $str = mysqli_error( $this->dbh ); } else { $str = mysql_error( $this->dbh ); } } $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str, ); if ( $this->suppress_errors ) { return false; } wp_load_translations_early(); $caller = $this->get_caller(); if ( $caller ) { $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller ); } else { $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query ); } error_log( $error_str ); if ( ! $this->show_errors ) { return false; } if ( is_multisite() ) { $msg = sprintf( "%s [%s]\n%s\n", __( 'WordPress database error:' ), $str, $this->last_query ); if ( defined( 'ERRORLOGFILE' ) ) { error_log( $msg, 3, ERRORLOGFILE ); } if ( defined( 'DIEONDBERROR' ) ) { wp_die( $msg ); } } else { $str = htmlspecialchars( $str, ENT_QUOTES ); $query = htmlspecialchars( $this->last_query, ENT_QUOTES ); printf( '

          %s [%s]
          %s

          ', __( 'WordPress database error:' ), $str, $query ); } } public function show_errors( $show = true ) { $errors = $this->show_errors; $this->show_errors = $show; return $errors; } public function hide_errors() { $show = $this->show_errors; $this->show_errors = false; return $show; } public function suppress_errors( $suppress = true ) { $errors = $this->suppress_errors; $this->suppress_errors = (bool) $suppress; return $errors; } public function flush() { $this->last_result = array(); $this->col_info = null; $this->last_query = null; $this->rows_affected = 0; $this->num_rows = 0; $this->last_error = ''; if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { mysqli_free_result( $this->result ); $this->result = null; if ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) { return; } while ( mysqli_more_results( $this->dbh ) ) { mysqli_next_result( $this->dbh ); } } elseif ( is_resource( $this->result ) ) { mysql_free_result( $this->result ); } } public function db_connect( $allow_bail = true ) { $this->is_mysql = true; $new_link = defined( 'MYSQL_NEW_LINK' ) ? MYSQL_NEW_LINK : true; $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0; if ( $this->use_mysqli ) { mysqli_report( MYSQLI_REPORT_OFF ); $this->dbh = mysqli_init(); $host = $this->dbhost; $port = null; $socket = null; $is_ipv6 = false; $host_data = $this->parse_db_host( $this->dbhost ); if ( $host_data ) { list( $host, $port, $socket, $is_ipv6 ) = $host_data; } if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) { $host = "[$host]"; } if ( WP_DEBUG ) { mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } else { @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } if ( $this->dbh->connect_errno ) { $this->dbh = null; $attempt_fallback = true; if ( $this->has_connected ) { $attempt_fallback = false; } elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) { $attempt_fallback = false; } elseif ( ! function_exists( 'mysql_connect' ) ) { $attempt_fallback = false; } if ( $attempt_fallback ) { $this->use_mysqli = false; return $this->db_connect( $allow_bail ); } } } else { if ( WP_DEBUG ) { $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); } else { $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); } } if ( ! $this->dbh && $allow_bail ) { wp_load_translations_early(); if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) { require_once WP_CONTENT_DIR . '/db-error.php'; die(); } $message = '

          ' . __( 'Error establishing a database connection' ) . "

          \n"; $message .= '

          ' . sprintf( __( 'This either means that the username and password information in your %1$s file is incorrect or that contact with the database server at %2$s could not be established. This could mean your host’s database server is down.' ), 'wp-config.php', '' . htmlspecialchars( $this->dbhost, ENT_QUOTES ) . '' ) . "

          \n"; $message .= "
            \n"; $message .= '
          • ' . __( 'Are you sure you have the correct username and password?' ) . "
          • \n"; $message .= '
          • ' . __( 'Are you sure you have typed the correct hostname?' ) . "
          • \n"; $message .= '
          • ' . __( 'Are you sure the database server is running?' ) . "
          • \n"; $message .= "
          \n"; $message .= '

          ' . sprintf( __( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

          \n"; $this->bail( $message, 'db_connect_fail' ); return false; } elseif ( $this->dbh ) { if ( ! $this->has_connected ) { $this->init_charset(); } $this->has_connected = true; $this->set_charset( $this->dbh ); $this->ready = true; $this->set_sql_mode(); $this->select( $this->dbname, $this->dbh ); return true; } return false; } public function parse_db_host( $host ) { $port = null; $socket = null; $is_ipv6 = false; $socket_pos = strpos( $host, ':/' ); if ( false !== $socket_pos ) { $socket = substr( $host, $socket_pos + 1 ); $host = substr( $host, 0, $socket_pos ); } if ( substr_count( $host, ':' ) > 1 ) { $pattern = '#^(?:\[)?(?P[0-9a-fA-F:]+)(?:\]:(?P[\d]+))?#'; $is_ipv6 = true; } else { $pattern = '#^(?P[^:/]*)(?::(?P[\d]+))?#'; } $matches = array(); $result = preg_match( $pattern, $host, $matches ); if ( 1 !== $result ) { return false; } $host = ''; foreach ( array( 'host', 'port' ) as $component ) { if ( ! empty( $matches[ $component ] ) ) { $$component = $matches[ $component ]; } } return array( $host, $port, $socket, $is_ipv6 ); } public function check_connection( $allow_bail = true ) { if ( $this->use_mysqli ) { if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) { return true; } } else { if ( ! empty( $this->dbh ) && mysql_ping( $this->dbh ) ) { return true; } } $error_reporting = false; if ( WP_DEBUG ) { $error_reporting = error_reporting(); error_reporting( $error_reporting & ~E_WARNING ); } for ( $tries = 1; $tries <= $this->reconnect_retries; $tries++ ) { if ( $this->reconnect_retries === $tries && WP_DEBUG ) { error_reporting( $error_reporting ); } if ( $this->db_connect( false ) ) { if ( $error_reporting ) { error_reporting( $error_reporting ); } return true; } sleep( 1 ); } if ( did_action( 'template_redirect' ) ) { return false; } if ( ! $allow_bail ) { return false; } wp_load_translations_early(); $message = '

          ' . __( 'Error reconnecting to the database' ) . "

          \n"; $message .= '

          ' . sprintf( __( 'This means that the contact with the database server at %s was lost. This could mean your host’s database server is down.' ), '' . htmlspecialchars( $this->dbhost, ENT_QUOTES ) . '' ) . "

          \n"; $message .= "
            \n"; $message .= '
          • ' . __( 'Are you sure the database server is running?' ) . "
          • \n"; $message .= '
          • ' . __( 'Are you sure the database server is not under particularly heavy load?' ) . "
          • \n"; $message .= "
          \n"; $message .= '

          ' . sprintf( __( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

          \n"; $this->bail( $message, 'db_connect_fail' ); dead_db(); } public function query( $query ) { if ( ! $this->ready ) { $this->check_current_query = true; return false; } $query = apply_filters( 'query', $query ); if ( ! $query ) { $this->insert_id = 0; return false; } $this->flush(); $this->func_call = "\$db->query(\"$query\")"; if ( $this->check_current_query && ! $this->check_ascii( $query ) ) { $stripped_query = $this->strip_invalid_text_from_query( $query ); $this->flush(); if ( $stripped_query !== $query ) { $this->insert_id = 0; $this->last_query = $query; wp_load_translations_early(); $this->last_error = __( 'WordPress database error: Could not perform query because it contains invalid data.' ); return false; } } $this->check_current_query = true; $this->last_query = $query; $this->_do_query( $query ); $mysql_errno = 0; if ( ! empty( $this->dbh ) ) { if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $mysql_errno = mysqli_errno( $this->dbh ); } else { $mysql_errno = 2006; } } else { if ( is_resource( $this->dbh ) ) { $mysql_errno = mysql_errno( $this->dbh ); } else { $mysql_errno = 2006; } } } if ( empty( $this->dbh ) || 2006 === $mysql_errno ) { if ( $this->check_connection() ) { $this->_do_query( $query ); } else { $this->insert_id = 0; return false; } } if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $this->last_error = mysqli_error( $this->dbh ); } else { $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); } } else { if ( is_resource( $this->dbh ) ) { $this->last_error = mysql_error( $this->dbh ); } else { $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); } } if ( $this->last_error ) { if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { $this->insert_id = 0; } $this->print_error(); return false; } if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) { $return_val = $this->result; } elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) { if ( $this->use_mysqli ) { $this->rows_affected = mysqli_affected_rows( $this->dbh ); } else { $this->rows_affected = mysql_affected_rows( $this->dbh ); } if ( preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { if ( $this->use_mysqli ) { $this->insert_id = mysqli_insert_id( $this->dbh ); } else { $this->insert_id = mysql_insert_id( $this->dbh ); } } $return_val = $this->rows_affected; } else { $num_rows = 0; if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { while ( $row = mysqli_fetch_object( $this->result ) ) { $this->last_result[ $num_rows ] = $row; $num_rows++; } } elseif ( is_resource( $this->result ) ) { while ( $row = mysql_fetch_object( $this->result ) ) { $this->last_result[ $num_rows ] = $row; $num_rows++; } } $this->num_rows = $num_rows; $return_val = $num_rows; } return $return_val; } private function _do_query( $query ) { if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->timer_start(); } if ( ! empty( $this->dbh ) && $this->use_mysqli ) { $this->result = mysqli_query( $this->dbh, $query ); } elseif ( ! empty( $this->dbh ) ) { $this->result = mysql_query( $query, $this->dbh ); } $this->num_queries++; if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->log_query( $query, $this->timer_stop(), $this->get_caller(), $this->time_start, array() ); } } public function log_query( $query, $query_time, $query_callstack, $query_start, $query_data ) { $query_data = apply_filters( 'log_query_custom_data', $query_data, $query, $query_time, $query_callstack, $query_start ); $this->queries[] = array( $query, $query_time, $query_callstack, $query_start, $query_data, ); } public function placeholder_escape() { static $placeholder; if ( ! $placeholder ) { $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; $salt = defined( 'AUTH_SALT' ) && AUTH_SALT ? AUTH_SALT : (string) rand(); $placeholder = '{' . hash_hmac( $algo, uniqid( $salt, true ), $salt ) . '}'; } if ( false === has_filter( 'query', array( $this, 'remove_placeholder_escape' ) ) ) { add_filter( 'query', array( $this, 'remove_placeholder_escape' ), 0 ); } return $placeholder; } public function add_placeholder_escape( $query ) { return str_replace( '%', $this->placeholder_escape(), $query ); } public function remove_placeholder_escape( $query ) { return str_replace( $this->placeholder_escape(), '%', $query ); } public function insert( $table, $data, $format = null ) { return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' ); } public function replace( $table, $data, $format = null ) { return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' ); } public function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) { $this->insert_id = 0; if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ), true ) ) { return false; } $data = $this->process_fields( $table, $data, $format ); if ( false === $data ) { return false; } $formats = array(); $values = array(); foreach ( $data as $value ) { if ( is_null( $value['value'] ) ) { $formats[] = 'NULL'; continue; } $formats[] = $value['format']; $values[] = $value['value']; } $fields = '`' . implode( '`, `', array_keys( $data ) ) . '`'; $formats = implode( ', ', $formats ); $sql = "$type INTO `$table` ($fields) VALUES ($formats)"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } public function update( $table, $data, $where, $format = null, $where_format = null ) { if ( ! is_array( $data ) || ! is_array( $where ) ) { return false; } $data = $this->process_fields( $table, $data, $format ); if ( false === $data ) { return false; } $where = $this->process_fields( $table, $where, $where_format ); if ( false === $where ) { return false; } $fields = array(); $conditions = array(); $values = array(); foreach ( $data as $field => $value ) { if ( is_null( $value['value'] ) ) { $fields[] = "`$field` = NULL"; continue; } $fields[] = "`$field` = " . $value['format']; $values[] = $value['value']; } foreach ( $where as $field => $value ) { if ( is_null( $value['value'] ) ) { $conditions[] = "`$field` IS NULL"; continue; } $conditions[] = "`$field` = " . $value['format']; $values[] = $value['value']; } $fields = implode( ', ', $fields ); $conditions = implode( ' AND ', $conditions ); $sql = "UPDATE `$table` SET $fields WHERE $conditions"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } public function delete( $table, $where, $where_format = null ) { if ( ! is_array( $where ) ) { return false; } $where = $this->process_fields( $table, $where, $where_format ); if ( false === $where ) { return false; } $conditions = array(); $values = array(); foreach ( $where as $field => $value ) { if ( is_null( $value['value'] ) ) { $conditions[] = "`$field` IS NULL"; continue; } $conditions[] = "`$field` = " . $value['format']; $values[] = $value['value']; } $conditions = implode( ' AND ', $conditions ); $sql = "DELETE FROM `$table` WHERE $conditions"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } protected function process_fields( $table, $data, $format ) { $data = $this->process_field_formats( $data, $format ); if ( false === $data ) { return false; } $data = $this->process_field_charsets( $data, $table ); if ( false === $data ) { return false; } $data = $this->process_field_lengths( $data, $table ); if ( false === $data ) { return false; } $converted_data = $this->strip_invalid_text( $data ); if ( $data !== $converted_data ) { $problem_fields = array(); foreach ( $data as $field => $value ) { if ( $value !== $converted_data[ $field ] ) { $problem_fields[] = $field; } } wp_load_translations_early(); if ( 1 === count( $problem_fields ) ) { $this->last_error = sprintf( __( 'WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.' ), reset( $problem_fields ) ); } else { $this->last_error = sprintf( __( 'WordPress database error: Processing the values for the following fields failed: %s. The supplied values may be too long or contain invalid data.' ), implode( ', ', $problem_fields ) ); } return false; } return $data; } protected function process_field_formats( $data, $format ) { $formats = (array) $format; $original_formats = $formats; foreach ( $data as $field => $value ) { $value = array( 'value' => $value, 'format' => '%s', ); if ( ! empty( $format ) ) { $value['format'] = array_shift( $formats ); if ( ! $value['format'] ) { $value['format'] = reset( $original_formats ); } } elseif ( isset( $this->field_types[ $field ] ) ) { $value['format'] = $this->field_types[ $field ]; } $data[ $field ] = $value; } return $data; } protected function process_field_charsets( $data, $table ) { foreach ( $data as $field => $value ) { if ( '%d' === $value['format'] || '%f' === $value['format'] ) { $value['charset'] = false; } else { $value['charset'] = $this->get_col_charset( $table, $field ); if ( is_wp_error( $value['charset'] ) ) { return false; } } $data[ $field ] = $value; } return $data; } protected function process_field_lengths( $data, $table ) { foreach ( $data as $field => $value ) { if ( '%d' === $value['format'] || '%f' === $value['format'] ) { $value['length'] = false; } else { $value['length'] = $this->get_col_length( $table, $field ); if ( is_wp_error( $value['length'] ) ) { return false; } } $data[ $field ] = $value; } return $data; } public function get_var( $query = null, $x = 0, $y = 0 ) { $this->func_call = "\$db->get_var(\"$query\", $x, $y)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } if ( ! empty( $this->last_result[ $y ] ) ) { $values = array_values( get_object_vars( $this->last_result[ $y ] ) ); } return ( isset( $values[ $x ] ) && '' !== $values[ $x ] ) ? $values[ $x ] : null; } public function get_row( $query = null, $output = OBJECT, $y = 0 ) { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } else { return null; } if ( ! isset( $this->last_result[ $y ] ) ) { return null; } if ( OBJECT === $output ) { return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; } elseif ( ARRAY_A === $output ) { return $this->last_result[ $y ] ? get_object_vars( $this->last_result[ $y ] ) : null; } elseif ( ARRAY_N === $output ) { return $this->last_result[ $y ] ? array_values( get_object_vars( $this->last_result[ $y ] ) ) : null; } elseif ( OBJECT === strtoupper( $output ) ) { return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; } else { $this->print_error( ' $db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N' ); } } public function get_col( $query = null, $x = 0 ) { if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } $new_array = array(); if ( $this->last_result ) { for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) { $new_array[ $i ] = $this->get_var( null, $x, $i ); } } return $new_array; } public function get_results( $query = null, $output = OBJECT ) { $this->func_call = "\$db->get_results(\"$query\", $output)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } else { return null; } $new_array = array(); if ( OBJECT === $output ) { return $this->last_result; } elseif ( OBJECT_K === $output ) { if ( $this->last_result ) { foreach ( $this->last_result as $row ) { $var_by_ref = get_object_vars( $row ); $key = array_shift( $var_by_ref ); if ( ! isset( $new_array[ $key ] ) ) { $new_array[ $key ] = $row; } } } return $new_array; } elseif ( ARRAY_A === $output || ARRAY_N === $output ) { if ( $this->last_result ) { foreach ( (array) $this->last_result as $row ) { if ( ARRAY_N === $output ) { $new_array[] = array_values( get_object_vars( $row ) ); } else { $new_array[] = get_object_vars( $row ); } } } return $new_array; } elseif ( strtoupper( $output ) === OBJECT ) { return $this->last_result; } return null; } protected function get_table_charset( $table ) { $tablekey = strtolower( $table ); $charset = apply_filters( 'pre_get_table_charset', null, $table ); if ( null !== $charset ) { return $charset; } if ( isset( $this->table_charset[ $tablekey ] ) ) { return $this->table_charset[ $tablekey ]; } $charsets = array(); $columns = array(); $table_parts = explode( '.', $table ); $table = '`' . implode( '`.`', $table_parts ) . '`'; $results = $this->get_results( "SHOW FULL COLUMNS FROM $table" ); if ( ! $results ) { return new WP_Error( 'wpdb_get_table_charset_failure', __( 'Could not retrieve table charset.' ) ); } foreach ( $results as $column ) { $columns[ strtolower( $column->Field ) ] = $column; } $this->col_meta[ $tablekey ] = $columns; foreach ( $columns as $column ) { if ( ! empty( $column->Collation ) ) { list( $charset ) = explode( '_', $column->Collation ); if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8'; } $charsets[ strtolower( $charset ) ] = true; } list( $type ) = explode( '(', $column->Type ); if ( in_array( strtoupper( $type ), array( 'BINARY', 'VARBINARY', 'TINYBLOB', 'MEDIUMBLOB', 'BLOB', 'LONGBLOB' ), true ) ) { $this->table_charset[ $tablekey ] = 'binary'; return 'binary'; } } if ( isset( $charsets['utf8mb3'] ) ) { $charsets['utf8'] = true; unset( $charsets['utf8mb3'] ); } $count = count( $charsets ); if ( 1 === $count ) { $charset = key( $charsets ); } elseif ( 0 === $count ) { $charset = false; } else { unset( $charsets['latin1'] ); $count = count( $charsets ); if ( 1 === $count ) { $charset = key( $charsets ); } elseif ( 2 === $count && isset( $charsets['utf8'], $charsets['utf8mb4'] ) ) { $charset = 'utf8'; } else { $charset = 'ascii'; } } $this->table_charset[ $tablekey ] = $charset; return $charset; } public function get_col_charset( $table, $column ) { $tablekey = strtolower( $table ); $columnkey = strtolower( $column ); $charset = apply_filters( 'pre_get_col_charset', null, $table, $column ); if ( null !== $charset ) { return $charset; } if ( empty( $this->is_mysql ) ) { return false; } if ( empty( $this->table_charset[ $tablekey ] ) ) { $table_charset = $this->get_table_charset( $table ); if ( is_wp_error( $table_charset ) ) { return $table_charset; } } if ( empty( $this->col_meta[ $tablekey ] ) ) { return $this->table_charset[ $tablekey ]; } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) { return $this->table_charset[ $tablekey ]; } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ]->Collation ) ) { return false; } list( $charset ) = explode( '_', $this->col_meta[ $tablekey ][ $columnkey ]->Collation ); return $charset; } public function get_col_length( $table, $column ) { $tablekey = strtolower( $table ); $columnkey = strtolower( $column ); if ( empty( $this->is_mysql ) ) { return false; } if ( empty( $this->col_meta[ $tablekey ] ) ) { $table_charset = $this->get_table_charset( $table ); if ( is_wp_error( $table_charset ) ) { return $table_charset; } } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) { return false; } $typeinfo = explode( '(', $this->col_meta[ $tablekey ][ $columnkey ]->Type ); $type = strtolower( $typeinfo[0] ); if ( ! empty( $typeinfo[1] ) ) { $length = trim( $typeinfo[1], ')' ); } else { $length = false; } switch ( $type ) { case 'char': case 'varchar': return array( 'type' => 'char', 'length' => (int) $length, ); case 'binary': case 'varbinary': return array( 'type' => 'byte', 'length' => (int) $length, ); case 'tinyblob': case 'tinytext': return array( 'type' => 'byte', 'length' => 255, ); case 'blob': case 'text': return array( 'type' => 'byte', 'length' => 65535, ); case 'mediumblob': case 'mediumtext': return array( 'type' => 'byte', 'length' => 16777215, ); case 'longblob': case 'longtext': return array( 'type' => 'byte', 'length' => 4294967295, ); default: return false; } } protected function check_ascii( $string ) { if ( function_exists( 'mb_check_encoding' ) ) { if ( mb_check_encoding( $string, 'ASCII' ) ) { return true; } } elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) { return true; } return false; } protected function check_safe_collation( $query ) { if ( $this->checking_collation ) { return true; } $query = ltrim( $query, "\r\n\t (" ); if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) { return true; } if ( $this->check_ascii( $query ) ) { return true; } $table = $this->get_table_from_query( $query ); if ( ! $table ) { return false; } $this->checking_collation = true; $collation = $this->get_table_charset( $table ); $this->checking_collation = false; if ( false === $collation || 'latin1' === $collation ) { return true; } $table = strtolower( $table ); if ( empty( $this->col_meta[ $table ] ) ) { return false; } foreach ( $this->col_meta[ $table ] as $col ) { if ( empty( $col->Collation ) ) { continue; } if ( ! in_array( $col->Collation, array( 'utf8_general_ci', 'utf8_bin', 'utf8mb4_general_ci', 'utf8mb4_bin' ), true ) ) { return false; } } return true; } protected function strip_invalid_text( $data ) { $db_check_string = false; foreach ( $data as &$value ) { $charset = $value['charset']; if ( is_array( $value['length'] ) ) { $length = $value['length']['length']; $truncate_by_byte_length = 'byte' === $value['length']['type']; } else { $length = false; $truncate_by_byte_length = false; } if ( false === $charset ) { continue; } if ( ! is_string( $value['value'] ) ) { continue; } $needs_validation = true; if ( 'latin1' === $charset || ( ! isset( $value['ascii'] ) && $this->check_ascii( $value['value'] ) ) ) { $truncate_by_byte_length = true; $needs_validation = false; } if ( $truncate_by_byte_length ) { mbstring_binary_safe_encoding(); if ( false !== $length && strlen( $value['value'] ) > $length ) { $value['value'] = substr( $value['value'], 0, $length ); } reset_mbstring_encoding(); if ( ! $needs_validation ) { continue; } } if ( ( 'utf8' === $charset || 'utf8mb3' === $charset || 'utf8mb4' === $charset ) && function_exists( 'mb_strlen' ) ) { $regex = '/ + ( + (?: [\x00-\x7F] # single-byte sequences 0xxxxxxx + | [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx + | \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2 + | [\xE1-\xEC][\x80-\xBF]{2} + | \xED[\x80-\x9F][\x80-\xBF] + | [\xEE-\xEF][\x80-\xBF]{2}'; if ( 'utf8mb4' === $charset ) { $regex .= ' + | \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3 + | [\xF1-\xF3][\x80-\xBF]{3} + | \xF4[\x80-\x8F][\x80-\xBF]{2} + '; } $regex .= '){1,40} # ...one or more times + ) + | . # anything else + /x'; $value['value'] = preg_replace( $regex, '$1', $value['value'] ); if ( false !== $length && mb_strlen( $value['value'], 'UTF-8' ) > $length ) { $value['value'] = mb_substr( $value['value'], 0, $length, 'UTF-8' ); } continue; } $value['db'] = true; $db_check_string = true; } unset( $value ); if ( $db_check_string ) { $queries = array(); foreach ( $data as $col => $value ) { if ( ! empty( $value['db'] ) ) { if ( isset( $value['length']['type'] ) && 'byte' === $value['length']['type'] ) { $charset = 'binary'; } else { $charset = $value['charset']; } if ( $this->charset ) { $connection_charset = $this->charset; } else { if ( $this->use_mysqli ) { $connection_charset = mysqli_character_set_name( $this->dbh ); } else { $connection_charset = mysql_client_encoding(); } } if ( is_array( $value['length'] ) ) { $length = sprintf( '%.0f', $value['length']['length'] ); $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), $length ) USING $connection_charset )", $value['value'] ); } elseif ( 'binary' !== $charset ) { $queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING $connection_charset )", $value['value'] ); } unset( $data[ $col ]['db'] ); } } $sql = array(); foreach ( $queries as $column => $query ) { if ( ! $query ) { continue; } $sql[] = $query . " AS x_$column"; } $this->check_current_query = false; $row = $this->get_row( 'SELECT ' . implode( ', ', $sql ), ARRAY_A ); if ( ! $row ) { return new WP_Error( 'wpdb_strip_invalid_text_failure', __( 'Could not strip invalid text.' ) ); } foreach ( array_keys( $data ) as $column ) { if ( isset( $row[ "x_$column" ] ) ) { $data[ $column ]['value'] = $row[ "x_$column" ]; } } } return $data; } protected function strip_invalid_text_from_query( $query ) { $trimmed_query = ltrim( $query, "\r\n\t (" ); if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) { return $query; } $table = $this->get_table_from_query( $query ); if ( $table ) { $charset = $this->get_table_charset( $table ); if ( is_wp_error( $charset ) ) { return $charset; } if ( 'binary' === $charset ) { return $query; } } else { $charset = $this->charset; } $data = array( 'value' => $query, 'charset' => $charset, 'ascii' => false, 'length' => false, ); $data = $this->strip_invalid_text( array( $data ) ); if ( is_wp_error( $data ) ) { return $data; } return $data[0]['value']; } public function strip_invalid_text_for_column( $table, $column, $value ) { if ( ! is_string( $value ) ) { return $value; } $charset = $this->get_col_charset( $table, $column ); if ( ! $charset ) { return $value; } elseif ( is_wp_error( $charset ) ) { return $charset; } $data = array( $column => array( 'value' => $value, 'charset' => $charset, 'length' => $this->get_col_length( $table, $column ), ), ); $data = $this->strip_invalid_text( $data ); if ( is_wp_error( $data ) ) { return $data; } return $data[ $column ]['value']; } protected function get_table_from_query( $query ) { $query = rtrim( $query, ';/-#' ); $query = ltrim( $query, "\r\n\t (" ); $query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query ); if ( preg_match( '/^\s*(?:' . 'SELECT.*?\s+FROM' . '|INSERT(?:\s+LOW_PRIORITY|\s+DELAYED|\s+HIGH_PRIORITY)?(?:\s+IGNORE)?(?:\s+INTO)?' . '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?' . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?' . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:.+?FROM)?' . ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } if ( preg_match( '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES).+WHERE\s+Name\s*=\s*("|\')((?:[0-9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)\\1/is', $query, $maybe ) ) { return $maybe[2]; } if ( preg_match( '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES)\s+(?:WHERE\s+Name\s+)?LIKE\s*("|\')((?:[\\\\0-9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)%?\\1/is', $query, $maybe ) ) { return str_replace( '\\_', '_', $maybe[2] ); } if ( preg_match( '/^\s*(?:' . '(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM' . '|DESCRIBE|DESC|EXPLAIN|HANDLER' . '|(?:LOCK|UNLOCK)\s+TABLE(?:S)?' . '|(?:RENAME|OPTIMIZE|BACKUP|RESTORE|CHECK|CHECKSUM|ANALYZE|REPAIR).*\s+TABLE' . '|TRUNCATE(?:\s+TABLE)?' . '|CREATE(?:\s+TEMPORARY)?\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?' . '|ALTER(?:\s+IGNORE)?\s+TABLE' . '|DROP\s+TABLE(?:\s+IF\s+EXISTS)?' . '|CREATE(?:\s+\w+)?\s+INDEX.*\s+ON' . '|DROP\s+INDEX.*\s+ON' . '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE' . '|(?:GRANT|REVOKE).*ON\s+TABLE' . '|SHOW\s+(?:.*FROM|.*TABLE)' . ')\s+\(*\s*((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } return false; } protected function load_col_info() { if ( $this->col_info ) { return; } if ( $this->use_mysqli ) { $num_fields = mysqli_num_fields( $this->result ); for ( $i = 0; $i < $num_fields; $i++ ) { $this->col_info[ $i ] = mysqli_fetch_field( $this->result ); } } else { $num_fields = mysql_num_fields( $this->result ); for ( $i = 0; $i < $num_fields; $i++ ) { $this->col_info[ $i ] = mysql_fetch_field( $this->result, $i ); } } } public function get_col_info( $info_type = 'name', $col_offset = -1 ) { $this->load_col_info(); if ( $this->col_info ) { if ( -1 === $col_offset ) { $i = 0; $new_array = array(); foreach ( (array) $this->col_info as $col ) { $new_array[ $i ] = $col->{$info_type}; $i++; } return $new_array; } else { return $this->col_info[ $col_offset ]->{$info_type}; } } } public function timer_start() { $this->time_start = microtime( true ); return true; } public function timer_stop() { return ( microtime( true ) - $this->time_start ); } public function bail( $message, $error_code = '500' ) { if ( $this->show_errors ) { $error = ''; if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $error = mysqli_error( $this->dbh ); } elseif ( mysqli_connect_errno() ) { $error = mysqli_connect_error(); } } else { if ( is_resource( $this->dbh ) ) { $error = mysql_error( $this->dbh ); } else { $error = mysql_error(); } } if ( $error ) { $message = '

          ' . $error . "

          \n" . $message; } wp_die( $message ); } else { if ( class_exists( 'WP_Error', false ) ) { $this->error = new WP_Error( $error_code, $message ); } else { $this->error = $message; } return false; } } public function close() { if ( ! $this->dbh ) { return false; } if ( $this->use_mysqli ) { $closed = mysqli_close( $this->dbh ); } else { $closed = mysql_close( $this->dbh ); } if ( $closed ) { $this->dbh = null; $this->ready = false; $this->has_connected = false; } return $closed; } public function check_database_version() { global $wp_version, $required_mysql_version; if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) { return new WP_Error( 'database_version', sprintf( __( 'Error: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) ); } } public function supports_collation() { _deprecated_function( __FUNCTION__, '3.5.0', 'wpdb::has_cap( \'collation\' )' ); return $this->has_cap( 'collation' ); } public function get_charset_collate() { $charset_collate = ''; if ( ! empty( $this->charset ) ) { $charset_collate = "DEFAULT CHARACTER SET $this->charset"; } if ( ! empty( $this->collate ) ) { $charset_collate .= " COLLATE $this->collate"; } return $charset_collate; } public function has_cap( $db_cap ) { $version = $this->db_version(); switch ( strtolower( $db_cap ) ) { case 'collation': case 'group_concat': case 'subqueries': return version_compare( $version, '4.1', '>=' ); case 'set_charset': return version_compare( $version, '5.0.7', '>=' ); case 'utf8mb4': if ( version_compare( $version, '5.5.3', '<' ) ) { return false; } if ( $this->use_mysqli ) { $client_version = mysqli_get_client_info(); } else { $client_version = mysql_get_client_info(); } if ( false !== strpos( $client_version, 'mysqlnd' ) ) { $client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version ); return version_compare( $client_version, '5.0.9', '>=' ); } else { return version_compare( $client_version, '5.5.3', '>=' ); } case 'utf8mb4_520': return version_compare( $version, '5.6', '>=' ); } return false; } public function get_caller() { return wp_debug_backtrace_summary( __CLASS__ ); } public function db_version() { return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() ); } public function db_server_info() { if ( $this->use_mysqli ) { $server_info = mysqli_get_server_info( $this->dbh ); } else { $server_info = mysql_get_server_info( $this->dbh ); } return $server_info; } } ID, $credentials['remember'], $secure_cookie ); do_action( 'wp_login', $user->user_login, $user ); return $user; } function wp_authenticate_username_password( $user, $username, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $username ) || empty( $password ) ) { if ( is_wp_error( $user ) ) { return $user; } $error = new WP_Error(); if ( empty( $username ) ) { $error->add( 'empty_username', __( 'Error: The username field is empty.' ) ); } if ( empty( $password ) ) { $error->add( 'empty_password', __( 'Error: The password field is empty.' ) ); } return $error; } $user = get_user_by( 'login', $username ); if ( ! $user ) { return new WP_Error( 'invalid_username', sprintf( __( 'Error: The username %s is not registered on this site. If you are unsure of your username, try your email address instead.' ), $username ) ); } $user = apply_filters( 'wp_authenticate_user', $user, $password ); if ( is_wp_error( $user ) ) { return $user; } if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { return new WP_Error( 'incorrect_password', sprintf( __( 'Error: The password you entered for the username %s is incorrect.' ), '' . $username . '' ) . ' ' . __( 'Lost your password?' ) . '' ); } return $user; } function wp_authenticate_email_password( $user, $email, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $email ) || empty( $password ) ) { if ( is_wp_error( $user ) ) { return $user; } $error = new WP_Error(); if ( empty( $email ) ) { $error->add( 'empty_username', __( 'Error: The email field is empty.' ) ); } if ( empty( $password ) ) { $error->add( 'empty_password', __( 'Error: The password field is empty.' ) ); } return $error; } if ( ! is_email( $email ) ) { return $user; } $user = get_user_by( 'email', $email ); if ( ! $user ) { return new WP_Error( 'invalid_email', __( 'Unknown email address. Check again or try your username.' ) ); } $user = apply_filters( 'wp_authenticate_user', $user, $password ); if ( is_wp_error( $user ) ) { return $user; } if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { return new WP_Error( 'incorrect_password', sprintf( __( 'Error: The password you entered for the email address %s is incorrect.' ), '' . $email . '' ) . ' ' . __( 'Lost your password?' ) . '' ); } return $user; } function wp_authenticate_cookie( $user, $username, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $username ) && empty( $password ) ) { $user_id = wp_validate_auth_cookie(); if ( $user_id ) { return new WP_User( $user_id ); } global $auth_secure_cookie; if ( $auth_secure_cookie ) { $auth_cookie = SECURE_AUTH_COOKIE; } else { $auth_cookie = AUTH_COOKIE; } if ( ! empty( $_COOKIE[ $auth_cookie ] ) ) { return new WP_Error( 'expired_session', __( 'Please log in again.' ) ); } } return $user; } function wp_authenticate_application_password( $input_user, $username, $password ) { if ( $input_user instanceof WP_User ) { return $input_user; } if ( ! WP_Application_Passwords::is_in_use() ) { return $input_user; } $is_api_request = ( ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ); $is_api_request = apply_filters( 'application_password_is_api_request', $is_api_request ); if ( ! $is_api_request ) { return $input_user; } $error = null; $user = get_user_by( 'login', $username ); if ( ! $user && is_email( $username ) ) { $user = get_user_by( 'email', $username ); } if ( ! $user ) { if ( is_email( $username ) ) { $error = new WP_Error( 'invalid_email', __( 'Error: Unknown email address. Check again or try your username.' ) ); } else { $error = new WP_Error( 'invalid_username', __( 'Error: Unknown username. Check again or try your email address.' ) ); } } elseif ( ! wp_is_application_passwords_available() ) { $error = new WP_Error( 'application_passwords_disabled', __( 'Application passwords are not available.' ) ); } elseif ( ! wp_is_application_passwords_available_for_user( $user ) ) { $error = new WP_Error( 'application_passwords_disabled_for_user', __( 'Application passwords are not available for your account. Please contact the site administrator for assistance.' ) ); } if ( $error ) { do_action( 'application_password_failed_authentication', $error ); return $error; } $password = preg_replace( '/[^a-z\d]/i', '', $password ); $hashed_passwords = WP_Application_Passwords::get_user_application_passwords( $user->ID ); foreach ( $hashed_passwords as $key => $item ) { if ( ! wp_check_password( $password, $item['password'], $user->ID ) ) { continue; } $error = new WP_Error(); do_action( 'wp_authenticate_application_password_errors', $error, $user, $item, $password ); if ( is_wp_error( $error ) && $error->has_errors() ) { do_action( 'application_password_failed_authentication', $error ); return $error; } WP_Application_Passwords::record_application_password_usage( $user->ID, $item['uuid'] ); do_action( 'application_password_did_authenticate', $user, $item ); return $user; } $error = new WP_Error( 'incorrect_password', __( 'The provided password is an invalid application password.' ) ); do_action( 'application_password_failed_authentication', $error ); return $error; } function wp_validate_application_password( $input_user ) { if ( ! empty( $input_user ) ) { return $input_user; } if ( ! wp_is_application_passwords_available() ) { return $input_user; } if ( ! isset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { return $input_user; } $authenticated = wp_authenticate_application_password( null, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ); if ( $authenticated instanceof WP_User ) { return $authenticated->ID; } return $input_user; } function wp_authenticate_spam_check( $user ) { if ( $user instanceof WP_User && is_multisite() ) { $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user ); if ( $spammed ) { return new WP_Error( 'spammer_account', __( 'Error: Your account has been marked as a spammer.' ) ); } } return $user; } function wp_validate_logged_in_cookie( $user_id ) { if ( $user_id ) { return $user_id; } if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { return false; } return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' ); } function count_user_posts( $userid, $post_type = 'post', $public_only = false ) { global $wpdb; $where = get_posts_by_author_sql( $post_type, true, $userid, $public_only ); $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only ); } function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) { global $wpdb; $count = array(); if ( empty( $users ) || ! is_array( $users ) ) { return $count; } $userlist = implode( ',', array_map( 'absint', $users ) ); $where = get_posts_by_author_sql( $post_type, true, null, $public_only ); $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); foreach ( $result as $row ) { $count[ $row[0] ] = $row[1]; } foreach ( $users as $id ) { if ( ! isset( $count[ $id ] ) ) { $count[ $id ] = 0; } } return $count; } function get_current_user_id() { if ( ! function_exists( 'wp_get_current_user' ) ) { return 0; } $user = wp_get_current_user(); return ( isset( $user->ID ) ? (int) $user->ID : 0 ); } function get_user_option( $option, $user = 0, $deprecated = '' ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } if ( empty( $user ) ) { $user = get_current_user_id(); } $user = get_userdata( $user ); if ( ! $user ) { return false; } $prefix = $wpdb->get_blog_prefix(); if ( $user->has_prop( $prefix . $option ) ) { $result = $user->get( $prefix . $option ); } elseif ( $user->has_prop( $option ) ) { $result = $user->get( $option ); } else { $result = false; } return apply_filters( "get_user_option_{$option}", $result, $option, $user ); } function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { global $wpdb; if ( ! $global ) { $option_name = $wpdb->get_blog_prefix() . $option_name; } return update_user_meta( $user_id, $option_name, $newvalue ); } function delete_user_option( $user_id, $option_name, $global = false ) { global $wpdb; if ( ! $global ) { $option_name = $wpdb->get_blog_prefix() . $option_name; } return delete_user_meta( $user_id, $option_name ); } function get_users( $args = array() ) { $args = wp_parse_args( $args ); $args['count_total'] = false; $user_search = new WP_User_Query( $args ); return (array) $user_search->get_results(); } function wp_list_users( $args = array() ) { $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'number' => '', 'exclude_admin' => true, 'show_fullname' => false, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'exclude' => '', 'include' => '', ); $args = wp_parse_args( $args, $defaults ); $return = ''; $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); $query_args['fields'] = 'ids'; $users = get_users( $query_args ); foreach ( $users as $user_id ) { $user = get_userdata( $user_id ); if ( $args['exclude_admin'] && 'admin' === $user->display_name ) { continue; } if ( $args['show_fullname'] && '' !== $user->first_name && '' !== $user->last_name ) { $name = "$user->first_name $user->last_name"; } else { $name = $user->display_name; } if ( ! $args['html'] ) { $return .= $name . ', '; continue; } if ( 'list' === $args['style'] ) { $return .= '
        • '; } $row = $name; if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { $row .= ' '; if ( empty( $args['feed_image'] ) ) { $row .= '('; } $row .= ''; } else { $row .= $name; } $row .= ''; if ( empty( $args['feed_image'] ) ) { $row .= ')'; } } $return .= $row; $return .= ( 'list' === $args['style'] ) ? '
        • ' : ', '; } $return = rtrim( $return, ', ' ); if ( ! $args['echo'] ) { return $return; } echo $return; } function get_blogs_of_user( $user_id, $all = false ) { global $wpdb; $user_id = (int) $user_id; if ( empty( $user_id ) ) { return array(); } $sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all ); if ( null !== $sites ) { return $sites; } $keys = get_user_meta( $user_id ); if ( empty( $keys ) ) { return array(); } if ( ! is_multisite() ) { $site_id = get_current_blog_id(); $sites = array( $site_id => new stdClass ); $sites[ $site_id ]->userblog_id = $site_id; $sites[ $site_id ]->blogname = get_option( 'blogname' ); $sites[ $site_id ]->domain = ''; $sites[ $site_id ]->path = ''; $sites[ $site_id ]->site_id = 1; $sites[ $site_id ]->siteurl = get_option( 'siteurl' ); $sites[ $site_id ]->archived = 0; $sites[ $site_id ]->spam = 0; $sites[ $site_id ]->deleted = 0; return $sites; } $site_ids = array(); if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) { $site_ids[] = 1; unset( $keys[ $wpdb->base_prefix . 'capabilities' ] ); } $keys = array_keys( $keys ); foreach ( $keys as $key ) { if ( 'capabilities' !== substr( $key, -12 ) ) { continue; } if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) ) { continue; } $site_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key ); if ( ! is_numeric( $site_id ) ) { continue; } $site_ids[] = (int) $site_id; } $sites = array(); if ( ! empty( $site_ids ) ) { $args = array( 'number' => '', 'site__in' => $site_ids, 'update_site_meta_cache' => false, ); if ( ! $all ) { $args['archived'] = 0; $args['spam'] = 0; $args['deleted'] = 0; } $_sites = get_sites( $args ); foreach ( $_sites as $site ) { $sites[ $site->id ] = (object) array( 'userblog_id' => $site->id, 'blogname' => $site->blogname, 'domain' => $site->domain, 'path' => $site->path, 'site_id' => $site->network_id, 'siteurl' => $site->siteurl, 'archived' => $site->archived, 'mature' => $site->mature, 'spam' => $site->spam, 'deleted' => $site->deleted, ); } } return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all ); } function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) { global $wpdb; $user_id = (int) $user_id; $blog_id = (int) $blog_id; if ( empty( $user_id ) ) { $user_id = get_current_user_id(); } if ( empty( $user_id ) ) { return false; } else { $user = get_userdata( $user_id ); if ( ! $user instanceof WP_User ) { return false; } } if ( ! is_multisite() ) { return true; } if ( empty( $blog_id ) ) { $blog_id = get_current_blog_id(); } $blog = get_site( $blog_id ); if ( ! $blog || ! isset( $blog->domain ) || $blog->archived || $blog->spam || $blog->deleted ) { return false; } $keys = get_user_meta( $user_id ); if ( empty( $keys ) ) { return false; } $base_capabilities_key = $wpdb->base_prefix . 'capabilities'; $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities'; if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) { return true; } if ( isset( $keys[ $site_capabilities_key ] ) ) { return true; } return false; } function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'user', $user_id, $meta_key, $meta_value, $unique ); } function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'user', $user_id, $meta_key, $meta_value ); } function get_user_meta( $user_id, $key = '', $single = false ) { return get_metadata( 'user', $user_id, $key, $single ); } function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'user', $user_id, $meta_key, $meta_value, $prev_value ); } function count_users( $strategy = 'time', $site_id = null ) { global $wpdb; if ( ! $site_id ) { $site_id = get_current_blog_id(); } $pre = apply_filters( 'pre_count_users', null, $strategy, $site_id ); if ( null !== $pre ) { return $pre; } $blog_prefix = $wpdb->get_blog_prefix( $site_id ); $result = array(); if ( 'time' === $strategy ) { if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $avail_roles = wp_roles()->get_names(); restore_current_blog(); } else { $avail_roles = wp_roles()->get_names(); } $select_count = array(); foreach ( $avail_roles as $this_role => $name ) { $select_count[] = $wpdb->prepare( 'COUNT(NULLIF(`meta_value` LIKE %s, false))', '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%' ); } $select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))"; $select_count = implode( ', ', $select_count ); $row = $wpdb->get_row( " + SELECT {$select_count}, COUNT(*) + FROM {$wpdb->usermeta} + INNER JOIN {$wpdb->users} ON user_id = ID + WHERE meta_key = '{$blog_prefix}capabilities' + ", ARRAY_N ); $col = 0; $role_counts = array(); foreach ( $avail_roles as $this_role => $name ) { $count = (int) $row[ $col++ ]; if ( $count > 0 ) { $role_counts[ $this_role ] = $count; } } $role_counts['none'] = (int) $row[ $col++ ]; $total_users = (int) $row[ $col ]; $result['total_users'] = $total_users; $result['avail_roles'] =& $role_counts; } else { $avail_roles = array( 'none' => 0, ); $users_of_blog = $wpdb->get_col( " + SELECT meta_value + FROM {$wpdb->usermeta} + INNER JOIN {$wpdb->users} ON user_id = ID + WHERE meta_key = '{$blog_prefix}capabilities' + " ); foreach ( $users_of_blog as $caps_meta ) { $b_roles = maybe_unserialize( $caps_meta ); if ( ! is_array( $b_roles ) ) { continue; } if ( empty( $b_roles ) ) { $avail_roles['none']++; } foreach ( $b_roles as $b_role => $val ) { if ( isset( $avail_roles[ $b_role ] ) ) { $avail_roles[ $b_role ]++; } else { $avail_roles[ $b_role ] = 1; } } } $result['total_users'] = count( $users_of_blog ); $result['avail_roles'] =& $avail_roles; } return $result; } function get_user_count( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } return (int) get_network_option( $network_id, 'user_count', -1 ); } function wp_maybe_update_user_counts( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $is_small_network = ! wp_is_large_user_count( $network_id ); if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) { return false; } return wp_update_user_counts( $network_id ); } function wp_update_user_counts( $network_id = null ) { global $wpdb; if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $query = "SELECT COUNT(ID) as c FROM $wpdb->users"; if ( is_multisite() ) { $query .= " WHERE spam = '0' AND deleted = '0'"; } $count = $wpdb->get_var( $query ); return update_network_option( $network_id, 'user_count', $count ); } function wp_schedule_update_user_counts() { if ( ! is_main_site() ) { return; } if ( ! wp_next_scheduled( 'wp_update_user_counts' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_user_counts' ); } } function wp_is_large_user_count( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $count = get_user_count( $network_id ); return apply_filters( 'wp_is_large_user_count', $count > 10000, $count, $network_id ); } function setup_userdata( $for_user_id = 0 ) { global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity; if ( ! $for_user_id ) { $for_user_id = get_current_user_id(); } $user = get_userdata( $for_user_id ); if ( ! $user ) { $user_ID = 0; $user_level = 0; $userdata = null; $user_login = ''; $user_email = ''; $user_url = ''; $user_identity = ''; return; } $user_ID = (int) $user->ID; $user_level = (int) $user->user_level; $userdata = $user; $user_login = $user->user_login; $user_email = $user->user_email; $user_url = $user->user_url; $user_identity = $user->display_name; } function wp_dropdown_users( $args = '' ) { $defaults = array( 'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', 'orderby' => 'display_name', 'order' => 'ASC', 'include' => '', 'exclude' => '', 'multi' => 0, 'show' => 'display_name', 'echo' => 1, 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 'blog_id' => get_current_blog_id(), 'who' => '', 'include_selected' => false, 'option_none_value' => -1, 'role' => '', 'role__in' => array(), 'role__not_in' => array(), 'capability' => '', 'capability__in' => array(), 'capability__not_in' => array(), ); $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; $parsed_args = wp_parse_args( $args, $defaults ); $query_args = wp_array_slice_assoc( $parsed_args, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in', 'capability', 'capability__in', 'capability__not_in', ) ); $fields = array( 'ID', 'user_login' ); $show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name'; if ( 'display_name_with_login' === $show ) { $fields[] = 'display_name'; } else { $fields[] = $show; } $query_args['fields'] = $fields; $show_option_all = $parsed_args['show_option_all']; $show_option_none = $parsed_args['show_option_none']; $option_none_value = $parsed_args['option_none_value']; $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args ); $users = get_users( $query_args ); $output = ''; if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) { $name = esc_attr( $parsed_args['name'] ); if ( $parsed_args['multi'] && ! $parsed_args['id'] ) { $id = ''; } else { $id = $parsed_args['id'] ? " id='" . esc_attr( $parsed_args['id'] ) . "'" : " id='$name'"; } $output = "'; } $html = apply_filters( 'wp_dropdown_users', $output ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function sanitize_user_field( $field, $value, $user_id, $context ) { $int_fields = array( 'ID' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } if ( 'raw' === $context ) { return $value; } if ( ! is_string( $value ) && ! is_numeric( $value ) ) { return $value; } $prefixed = false !== strpos( $field, 'user_' ); if ( 'edit' === $context ) { if ( $prefixed ) { $value = apply_filters( "edit_{$field}", $value, $user_id ); } else { $value = apply_filters( "edit_user_{$field}", $value, $user_id ); } if ( 'description' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { if ( $prefixed ) { $value = apply_filters( "pre_{$field}", $value ); } else { $value = apply_filters( "pre_user_{$field}", $value ); } } else { if ( $prefixed ) { $value = apply_filters( "{$field}", $value, $user_id, $context ); } else { $value = apply_filters( "user_{$field}", $value, $user_id, $context ); } } if ( 'user_url' === $field ) { $value = esc_url( $value ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function update_user_caches( $user ) { if ( $user instanceof WP_User ) { if ( ! $user->exists() ) { return false; } $user = $user->data; } wp_cache_add( $user->ID, $user, 'users' ); wp_cache_add( $user->user_login, $user->ID, 'userlogins' ); wp_cache_add( $user->user_email, $user->ID, 'useremail' ); wp_cache_add( $user->user_nicename, $user->ID, 'userslugs' ); } function clean_user_cache( $user ) { global $current_user; if ( is_numeric( $user ) ) { $user = new WP_User( $user ); } if ( ! $user->exists() ) { return; } wp_cache_delete( $user->ID, 'users' ); wp_cache_delete( $user->user_login, 'userlogins' ); wp_cache_delete( $user->user_email, 'useremail' ); wp_cache_delete( $user->user_nicename, 'userslugs' ); do_action( 'clean_user_cache', $user->ID, $user ); if ( get_current_user_id() === (int) $user->ID ) { $user_id = (int) $user->ID; $current_user = null; wp_set_current_user( $user_id, '' ); } } function username_exists( $username ) { $user = get_user_by( 'login', $username ); if ( $user ) { $user_id = $user->ID; } else { $user_id = false; } return apply_filters( 'username_exists', $user_id, $username ); } function email_exists( $email ) { $user = get_user_by( 'email', $email ); if ( $user ) { $user_id = $user->ID; } else { $user_id = false; } return apply_filters( 'email_exists', $user_id, $email ); } function validate_username( $username ) { $sanitized = sanitize_user( $username, true ); $valid = ( $sanitized == $username && ! empty( $sanitized ) ); return apply_filters( 'validate_username', $valid, $username ); } function wp_insert_user( $userdata ) { global $wpdb; if ( $userdata instanceof stdClass ) { $userdata = get_object_vars( $userdata ); } elseif ( $userdata instanceof WP_User ) { $userdata = $userdata->to_array(); } if ( ! empty( $userdata['ID'] ) ) { $user_id = (int) $userdata['ID']; $update = true; $old_user_data = get_userdata( $user_id ); if ( ! $old_user_data ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass; } else { $update = false; $user_pass = wp_hash_password( $userdata['user_pass'] ); } $sanitized_user_login = sanitize_user( $userdata['user_login'], true ); $pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login ); $user_login = trim( $pre_user_login ); if ( empty( $user_login ) ) { return new WP_Error( 'empty_user_login', __( 'Cannot create a user with an empty login name.' ) ); } elseif ( mb_strlen( $user_login ) > 60 ) { return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) ); } if ( ! $update && username_exists( $user_login ) ) { return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) ); } $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) { return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); } if ( ! empty( $userdata['user_nicename'] ) ) { $user_nicename = sanitize_user( $userdata['user_nicename'], true ); } else { $user_nicename = mb_substr( $user_login, 0, 50 ); } $user_nicename = sanitize_title( $user_nicename ); $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename ); if ( mb_strlen( $user_nicename ) > 50 ) { return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) ); } $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login ) ); if ( $user_nicename_check ) { $suffix = 2; while ( $user_nicename_check ) { $base_length = 49 - mb_strlen( $suffix ); $alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix"; $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login ) ); $suffix++; } $user_nicename = $alt_user_nicename; } $raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email']; $user_email = apply_filters( 'pre_user_email', $raw_user_email ); if ( ( ! $update || ( ! empty( $old_user_data ) && 0 !== strcasecmp( $user_email, $old_user_data->user_email ) ) ) && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email ) ) { return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) ); } $raw_user_url = empty( $userdata['user_url'] ) ? '' : $userdata['user_url']; $user_url = apply_filters( 'pre_user_url', $raw_user_url ); if ( mb_strlen( $user_url ) > 100 ) { return new WP_Error( 'user_url_too_long', __( 'User URL may not be longer than 100 characters.' ) ); } $user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered']; $user_activation_key = empty( $userdata['user_activation_key'] ) ? '' : $userdata['user_activation_key']; if ( ! empty( $userdata['spam'] ) && ! is_multisite() ) { return new WP_Error( 'no_spam', __( 'Sorry, marking a user as spam is only supported on Multisite.' ) ); } $spam = empty( $userdata['spam'] ) ? 0 : (bool) $userdata['spam']; $meta = array(); $nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname']; $meta['nickname'] = apply_filters( 'pre_user_nickname', $nickname ); $first_name = empty( $userdata['first_name'] ) ? '' : $userdata['first_name']; $meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name ); $last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name']; $meta['last_name'] = apply_filters( 'pre_user_last_name', $last_name ); if ( empty( $userdata['display_name'] ) ) { if ( $update ) { $display_name = $user_login; } elseif ( $meta['first_name'] && $meta['last_name'] ) { $display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] ); } elseif ( $meta['first_name'] ) { $display_name = $meta['first_name']; } elseif ( $meta['last_name'] ) { $display_name = $meta['last_name']; } else { $display_name = $user_login; } } else { $display_name = $userdata['display_name']; } $display_name = apply_filters( 'pre_user_display_name', $display_name ); $description = empty( $userdata['description'] ) ? '' : $userdata['description']; $meta['description'] = apply_filters( 'pre_user_description', $description ); $meta['rich_editing'] = empty( $userdata['rich_editing'] ) ? 'true' : $userdata['rich_editing']; $meta['syntax_highlighting'] = empty( $userdata['syntax_highlighting'] ) ? 'true' : $userdata['syntax_highlighting']; $meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true'; $admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color']; $meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color ); $meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : (bool) $userdata['use_ssl']; $meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front']; $meta['locale'] = isset( $userdata['locale'] ) ? $userdata['locale'] : ''; $compacted = compact( 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'display_name' ); $data = wp_unslash( $compacted ); if ( ! $update ) { $data = $data + compact( 'user_login' ); } if ( is_multisite() ) { $data = $data + compact( 'spam' ); } $data = apply_filters( 'wp_pre_insert_user_data', $data, $update, ( $update ? $user_id : null ), $userdata ); if ( empty( $data ) || ! is_array( $data ) ) { return new WP_Error( 'empty_data', __( 'Not enough data to create this user.' ) ); } if ( $update ) { if ( $user_email !== $old_user_data->user_email || $user_pass !== $old_user_data->user_pass ) { $data['user_activation_key'] = ''; } $wpdb->update( $wpdb->users, $data, array( 'ID' => $user_id ) ); } else { $wpdb->insert( $wpdb->users, $data ); $user_id = (int) $wpdb->insert_id; } $user = new WP_User( $user_id ); $meta = apply_filters( 'insert_user_meta', $meta, $user, $update, $userdata ); $custom_meta = array(); if ( array_key_exists( 'meta_input', $userdata ) && is_array( $userdata['meta_input'] ) && ! empty( $userdata['meta_input'] ) ) { $custom_meta = $userdata['meta_input']; } $custom_meta = apply_filters( 'insert_custom_user_meta', $custom_meta, $user, $update, $userdata ); $meta = array_merge( $meta, $custom_meta ); foreach ( $meta as $key => $value ) { update_user_meta( $user_id, $key, $value ); } foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) { if ( isset( $userdata[ $key ] ) ) { update_user_meta( $user_id, $key, $userdata[ $key ] ); } } if ( isset( $userdata['role'] ) ) { $user->set_role( $userdata['role'] ); } elseif ( ! $update ) { $user->set_role( get_option( 'default_role' ) ); } clean_user_cache( $user_id ); if ( $update ) { do_action( 'profile_update', $user_id, $old_user_data, $userdata ); if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) { if ( 1 == $userdata['spam'] ) { do_action( 'make_spam_user', $user_id ); } else { do_action( 'make_ham_user', $user_id ); } } } else { do_action( 'user_register', $user_id, $userdata ); } return $user_id; } function wp_update_user( $userdata ) { if ( $userdata instanceof stdClass ) { $userdata = get_object_vars( $userdata ); } elseif ( $userdata instanceof WP_User ) { $userdata = $userdata->to_array(); } $user_id = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0; if ( ! $user_id ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user_obj = get_userdata( $user_id ); if ( ! $user_obj ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user = $user_obj->to_array(); foreach ( _get_additional_user_keys( $user_obj ) as $key ) { $user[ $key ] = get_user_meta( $user_id, $key, true ); } $user = add_magic_quotes( $user ); if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) { $plaintext_pass = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] ); $send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata ); } if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) { $send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata ); } clean_user_cache( $user_obj ); $userdata = array_merge( $user, $userdata ); $user_id = wp_insert_user( $userdata ); if ( is_wp_error( $user_id ) ) { return $user_id; } $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $switched_locale = false; if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { $switched_locale = switch_to_locale( get_user_locale( $user_id ) ); } if ( ! empty( $send_password_change_email ) ) { $pass_change_text = __( 'Hi ###USERNAME###, -.options-general-php .spinner { - float: none; - margin: -3px 3px 0; -} +This notice confirms that your password was changed on ###SITENAME###. -.settings-php .language-install-spinner, -.options-general-php .language-install-spinner { - display: inline-block; - float: none; - margin: -3px 5px 0; - vertical-align: middle; -} +If you did not change your password, please contact the Site Administrator at +###ADMIN_EMAIL### -.form-table.permalink-structure .available-structure-tags li { - float: right; - margin-left: 5px; -} +This email has been sent to ###EMAIL### -/*------------------------------------------------------------------------------ - 21.0 - Network Admin -------------------------------------------------------------------------------*/ +Regards, +All at ###SITENAME### +###SITEURL###' ); $pass_change_email = array( 'to' => $user['user_email'], 'subject' => __( '[%s] Password Changed' ), 'message' => $pass_change_text, 'headers' => '', ); $pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata ); $pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] ); wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] ); } if ( ! empty( $send_email_change_email ) ) { $email_change_text = __( 'Hi ###USERNAME###, -.setup-php textarea { - max-width: 100%; -} +This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###. -.form-field #site-address { - max-width: 25em; -} +If you did not change your email, please contact the Site Administrator at +###ADMIN_EMAIL### -.form-field #domain { - max-width: 22em; -} +This email has been sent to ###EMAIL### -.form-field #site-title, -.form-field #admin-email, -.form-field #path, -.form-field #blog_registered, -.form-field #blog_last_updated { - max-width: 25em; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $email_change_email = array( 'to' => $user['user_email'], 'subject' => __( '[%s] Email Changed' ), 'message' => $email_change_text, 'headers' => '', ); $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); } if ( $switched_locale ) { restore_previous_locale(); } $current_user = wp_get_current_user(); if ( $current_user->ID == $user_id ) { if ( isset( $plaintext_pass ) ) { wp_clear_auth_cookie(); $logged_in_cookie = wp_parse_auth_cookie( '', 'logged_in' ); $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false ); $remember = false; if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) { $remember = true; } wp_set_auth_cookie( $user_id, $remember ); } } return $user_id; } function wp_create_user( $username, $password, $email = '' ) { $user_login = wp_slash( $username ); $user_email = wp_slash( $email ); $user_pass = $password; $userdata = compact( 'user_login', 'user_email', 'user_pass' ); return wp_insert_user( $userdata ); } function _get_additional_user_keys( $user ) { $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' ); return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); } function wp_get_user_contact_methods( $user = null ) { $methods = array(); if ( get_site_option( 'initial_db_version' ) < 23588 ) { $methods = array( 'aim' => __( 'AIM' ), 'yim' => __( 'Yahoo IM' ), 'jabber' => __( 'Jabber / Google Talk' ), ); } return apply_filters( 'user_contactmethods', $methods, $user ); } function _wp_get_user_contactmethods( $user = null ) { return wp_get_user_contact_methods( $user ); } function wp_get_password_hint() { $hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).' ); return apply_filters( 'password_hint', $hint ); } function get_password_reset_key( $user ) { global $wp_hasher; if ( ! ( $user instanceof WP_User ) ) { return new WP_Error( 'invalidcombo', __( 'Error: There is no account with that username or email address.' ) ); } do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' ); do_action( 'retrieve_password', $user->user_login ); $allow = true; if ( is_multisite() && is_user_spammy( $user ) ) { $allow = false; } $allow = apply_filters( 'allow_password_reset', $allow, $user->ID ); if ( ! $allow ) { return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) ); } elseif ( is_wp_error( $allow ) ) { return $allow; } $key = wp_generate_password( 20, false ); do_action( 'retrieve_password_key', $user->user_login, $key ); if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $hashed = time() . ':' . $wp_hasher->HashPassword( $key ); $key_saved = wp_update_user( array( 'ID' => $user->ID, 'user_activation_key' => $hashed, ) ); if ( is_wp_error( $key_saved ) ) { return $key_saved; } return $key; } function check_password_reset_key( $key, $login ) { global $wpdb, $wp_hasher; $key = preg_replace( '/[^a-z0-9]/i', '', $key ); if ( empty( $key ) || ! is_string( $key ) ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } if ( empty( $login ) || ! is_string( $login ) ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } $user = get_user_by( 'login', $login ); if ( ! $user ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS ); if ( false !== strpos( $user->user_activation_key, ':' ) ) { list( $pass_request_time, $pass_key ) = explode( ':', $user->user_activation_key, 2 ); $expiration_time = $pass_request_time + $expiration_duration; } else { $pass_key = $user->user_activation_key; $expiration_time = false; } if ( ! $pass_key ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } $hash_is_correct = $wp_hasher->CheckPassword( $key, $pass_key ); if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) { return $user; } elseif ( $hash_is_correct && $expiration_time ) { return new WP_Error( 'expired_key', __( 'Invalid key.' ) ); } if ( hash_equals( $user->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) { $return = new WP_Error( 'expired_key', __( 'Invalid key.' ) ); $user_id = $user->ID; return apply_filters( 'password_reset_key_expired', $return, $user_id ); } return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } function retrieve_password( $user_login = null ) { $errors = new WP_Error(); $user_data = false; if ( ! $user_login && ! empty( $_POST['user_login'] ) ) { $user_login = $_POST['user_login']; } if ( empty( $user_login ) ) { $errors->add( 'empty_username', __( 'Error: Please enter a username or email address.' ) ); } elseif ( strpos( $user_login, '@' ) ) { $user_data = get_user_by( 'email', trim( wp_unslash( $user_login ) ) ); if ( empty( $user_data ) ) { $errors->add( 'invalid_email', __( 'Error: There is no account with that username or email address.' ) ); } } else { $user_data = get_user_by( 'login', trim( wp_unslash( $user_login ) ) ); } $user_data = apply_filters( 'lostpassword_user_data', $user_data, $errors ); do_action( 'lostpassword_post', $errors, $user_data ); $errors = apply_filters( 'lostpassword_errors', $errors, $user_data ); if ( $errors->has_errors() ) { return $errors; } if ( ! $user_data ) { $errors->add( 'invalidcombo', __( 'Error: There is no account with that username or email address.' ) ); return $errors; } if ( ! apply_filters( 'send_retrieve_password_email', true, $user_login, $user_data ) ) { return true; } $user_login = $user_data->user_login; $user_email = $user_data->user_email; $key = get_password_reset_key( $user_data ); if ( is_wp_error( $key ) ) { return $key; } $locale = get_user_locale( $user_data ); $switched_locale = switch_to_locale( $locale ); if ( is_multisite() ) { $site_name = get_network()->site_name; } else { $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } $message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n"; $message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n"; $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n"; $message .= __( 'If this was a mistake, ignore this email and nothing will happen.' ) . "\r\n\r\n"; $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n"; $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . '&wp_lang=' . $locale . "\r\n\r\n"; if ( ! is_user_logged_in() ) { $requester_ip = $_SERVER['REMOTE_ADDR']; if ( $requester_ip ) { $message .= sprintf( __( 'This password reset request originated from the IP address %s.' ), $requester_ip ) . "\r\n"; } } $title = sprintf( __( '[%s] Password Reset' ), $site_name ); $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); if ( ! $message ) { return true; } $defaults = array( 'to' => $user_email, 'subject' => $title, 'message' => $message, 'headers' => '', ); $notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $key, $user_login, $user_data ); if ( $switched_locale ) { restore_previous_locale(); } if ( is_array( $notification_email ) ) { $notification_email = array_merge( $defaults, $notification_email ); } else { $notification_email = $defaults; } list( $to, $subject, $message, $headers ) = array_values( $notification_email ); $subject = wp_specialchars_decode( $subject ); if ( ! wp_mail( $to, $subject, $message, $headers ) ) { $errors->add( 'retrieve_password_email_failure', sprintf( __( 'Error: The email could not be sent. Your site may not be correctly configured to send emails. Get support for resetting your password.' ), esc_url( __( 'https://wordpress.org/support/article/resetting-your-password/' ) ) ) ); return $errors; } return true; } function reset_password( $user, $new_pass ) { do_action( 'password_reset', $user, $new_pass ); wp_set_password( $new_pass, $user->ID ); update_user_meta( $user->ID, 'default_password_nag', false ); do_action( 'after_password_reset', $user, $new_pass ); } function register_new_user( $user_login, $user_email ) { $errors = new WP_Error(); $sanitized_user_login = sanitize_user( $user_login ); $user_email = apply_filters( 'user_registration_email', $user_email ); if ( '' === $sanitized_user_login ) { $errors->add( 'empty_username', __( 'Error: Please enter a username.' ) ); } elseif ( ! validate_username( $user_login ) ) { $errors->add( 'invalid_username', __( 'Error: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); $sanitized_user_login = ''; } elseif ( username_exists( $sanitized_user_login ) ) { $errors->add( 'username_exists', __( 'Error: This username is already registered. Please choose another one.' ) ); } else { $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() ); if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) { $errors->add( 'invalid_username', __( 'Error: Sorry, that username is not allowed.' ) ); } } if ( '' === $user_email ) { $errors->add( 'empty_email', __( 'Error: Please type your email address.' ) ); } elseif ( ! is_email( $user_email ) ) { $errors->add( 'invalid_email', __( 'Error: The email address is not correct.' ) ); $user_email = ''; } elseif ( email_exists( $user_email ) ) { $errors->add( 'email_exists', sprintf( __( 'Error: This email address is already registered. Log in with this address or choose another one.' ), wp_login_url() ) ); } do_action( 'register_post', $sanitized_user_login, $user_email, $errors ); $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email ); if ( $errors->has_errors() ) { return $errors; } $user_pass = wp_generate_password( 12, false ); $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email ); if ( ! $user_id || is_wp_error( $user_id ) ) { $errors->add( 'registerfail', sprintf( __( 'Error: Could not register you… please contact the site admin!' ), get_option( 'admin_email' ) ) ); return $errors; } update_user_meta( $user_id, 'default_password_nag', true ); if ( ! empty( $_COOKIE['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); if ( in_array( $wp_lang, get_available_languages(), true ) ) { update_user_meta( $user_id, 'locale', $wp_lang ); } } do_action( 'register_new_user', $user_id ); return $user_id; } function wp_send_new_user_notifications( $user_id, $notify = 'both' ) { wp_new_user_notification( $user_id, null, $notify ); } function wp_get_session_token() { $cookie = wp_parse_auth_cookie( '', 'logged_in' ); return ! empty( $cookie['token'] ) ? $cookie['token'] : ''; } function wp_get_all_sessions() { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); return $manager->get_all(); } function wp_destroy_current_session() { $token = wp_get_session_token(); if ( $token ) { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy( $token ); } } function wp_destroy_other_sessions() { $token = wp_get_session_token(); if ( $token ) { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_others( $token ); } } function wp_destroy_all_sessions() { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_all(); } function wp_get_users_with_no_role( $site_id = null ) { global $wpdb; if ( ! $site_id ) { $site_id = get_current_blog_id(); } $prefix = $wpdb->get_blog_prefix( $site_id ); if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $role_names = wp_roles()->get_names(); restore_current_blog(); } else { $role_names = wp_roles()->get_names(); } $regex = implode( '|', array_keys( $role_names ) ); $regex = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex ); $users = $wpdb->get_col( $wpdb->prepare( " + SELECT user_id + FROM $wpdb->usermeta + WHERE meta_key = '{$prefix}capabilities' + AND meta_value NOT REGEXP %s + ", $regex ) ); return $users; } function _wp_get_current_user() { global $current_user; if ( ! empty( $current_user ) ) { if ( $current_user instanceof WP_User ) { return $current_user; } if ( is_object( $current_user ) && isset( $current_user->ID ) ) { $cur_id = $current_user->ID; $current_user = null; wp_set_current_user( $cur_id ); return $current_user; } $current_user = null; wp_set_current_user( 0 ); return $current_user; } if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { wp_set_current_user( 0 ); return $current_user; } $user_id = apply_filters( 'determine_current_user', false ); if ( ! $user_id ) { wp_set_current_user( 0 ); return $current_user; } wp_set_current_user( $user_id ); return $current_user; } function send_confirmation_on_profile_email() { global $errors; $current_user = wp_get_current_user(); if ( ! is_object( $errors ) ) { $errors = new WP_Error(); } if ( $current_user->ID != $_POST['user_id'] ) { return false; } if ( $current_user->user_email != $_POST['email'] ) { if ( ! is_email( $_POST['email'] ) ) { $errors->add( 'user_email', __( 'Error: The email address is not correct.' ), array( 'form-field' => 'email', ) ); return; } if ( email_exists( $_POST['email'] ) ) { $errors->add( 'user_email', __( 'Error: The email address is already used.' ), array( 'form-field' => 'email', ) ); delete_user_meta( $current_user->ID, '_new_email' ); return; } $hash = md5( $_POST['email'] . time() . wp_rand() ); $new_user_email = array( 'hash' => $hash, 'newemail' => $_POST['email'], ); update_user_meta( $current_user->ID, '_new_email', $new_user_email ); $sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $email_text = __( 'Howdy ###USERNAME###, -.form-field #path { - margin-bottom: 5px; -} +You recently requested to have the email address on your account changed. -#search-users, -#search-sites { - max-width: 60%; -} +If this is correct, please click on the following link to change it: +###ADMIN_URL### -/*------------------------------------------------------------------------------ - Credentials check dialog for Install and Updates -------------------------------------------------------------------------------*/ +You can safely ignore and delete this email if you do not want to +take this action. -.request-filesystem-credentials-dialog { - display: none; - /* The customizer uses visibility: hidden on the body for full-overlays. */ - visibility: visible; -} +This email has been sent to ###EMAIL### -.request-filesystem-credentials-dialog .notification-dialog { - top: 10%; - max-height: 85%; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email ); $content = str_replace( '###USERNAME###', $current_user->user_login, $content ); $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content ); $content = str_replace( '###EMAIL###', $_POST['email'], $content ); $content = str_replace( '###SITENAME###', $sitename, $content ); $content = str_replace( '###SITEURL###', home_url(), $content ); wp_mail( $_POST['email'], sprintf( __( '[%s] Email Change Request' ), $sitename ), $content ); $_POST['email'] = $current_user->user_email; } } function new_user_email_admin_notice() { global $pagenow; if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) ) { $email = get_user_meta( get_current_user_id(), '_new_email', true ); if ( $email ) { echo '

          ' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '' . esc_html( $email['newemail'] ) . '' ) . '

          '; } } } function _wp_privacy_action_request_types() { return array( 'export_personal_data', 'remove_personal_data', ); } function wp_register_user_personal_data_exporter( $exporters ) { $exporters['wordpress-user'] = array( 'exporter_friendly_name' => __( 'WordPress User' ), 'callback' => 'wp_user_personal_data_exporter', ); return $exporters; } function wp_user_personal_data_exporter( $email_address ) { $email_address = trim( $email_address ); $data_to_export = array(); $user = get_user_by( 'email', $email_address ); if ( ! $user ) { return array( 'data' => array(), 'done' => true, ); } $user_meta = get_user_meta( $user->ID ); $user_props_to_export = array( 'ID' => __( 'User ID' ), 'user_login' => __( 'User Login Name' ), 'user_nicename' => __( 'User Nice Name' ), 'user_email' => __( 'User Email' ), 'user_url' => __( 'User URL' ), 'user_registered' => __( 'User Registration Date' ), 'display_name' => __( 'User Display Name' ), 'nickname' => __( 'User Nickname' ), 'first_name' => __( 'User First Name' ), 'last_name' => __( 'User Last Name' ), 'description' => __( 'User Description' ), ); $user_data_to_export = array(); foreach ( $user_props_to_export as $key => $name ) { $value = ''; switch ( $key ) { case 'ID': case 'user_login': case 'user_nicename': case 'user_email': case 'user_url': case 'user_registered': case 'display_name': $value = $user->data->$key; break; case 'nickname': case 'first_name': case 'last_name': case 'description': $value = $user_meta[ $key ][0]; break; } if ( ! empty( $value ) ) { $user_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $reserved_names = array_values( $user_props_to_export ); $_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names ); if ( is_array( $_extra_data ) && ! empty( $_extra_data ) ) { $extra_data = array_filter( $_extra_data, static function( $item ) use ( $reserved_names ) { return ! in_array( $item['name'], $reserved_names, true ); } ); if ( count( $extra_data ) !== count( $_extra_data ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Filter %s returned items with reserved names.' ), 'wp_privacy_additional_user_profile_data' ), '5.4.0' ); } if ( ! empty( $extra_data ) ) { $user_data_to_export = array_merge( $user_data_to_export, $extra_data ); } } $data_to_export[] = array( 'group_id' => 'user', 'group_label' => __( 'User' ), 'group_description' => __( 'User’s profile data.' ), 'item_id' => "user-{$user->ID}", 'data' => $user_data_to_export, ); if ( isset( $user_meta['community-events-location'] ) ) { $location = maybe_unserialize( $user_meta['community-events-location'][0] ); $location_props_to_export = array( 'description' => __( 'City' ), 'country' => __( 'Country' ), 'latitude' => __( 'Latitude' ), 'longitude' => __( 'Longitude' ), 'ip' => __( 'IP' ), ); $location_data_to_export = array(); foreach ( $location_props_to_export as $key => $name ) { if ( ! empty( $location[ $key ] ) ) { $location_data_to_export[] = array( 'name' => $name, 'value' => $location[ $key ], ); } } $data_to_export[] = array( 'group_id' => 'community-events-location', 'group_label' => __( 'Community Events Location' ), 'group_description' => __( 'User’s location data used for the Community Events in the WordPress Events and News dashboard widget.' ), 'item_id' => "community-events-location-{$user->ID}", 'data' => $location_data_to_export, ); } if ( isset( $user_meta['session_tokens'] ) ) { $session_tokens = maybe_unserialize( $user_meta['session_tokens'][0] ); $session_tokens_props_to_export = array( 'expiration' => __( 'Expiration' ), 'ip' => __( 'IP' ), 'ua' => __( 'User Agent' ), 'login' => __( 'Last Login' ), ); foreach ( $session_tokens as $token_key => $session_token ) { $session_tokens_data_to_export = array(); foreach ( $session_tokens_props_to_export as $key => $name ) { if ( ! empty( $session_token[ $key ] ) ) { $value = $session_token[ $key ]; if ( in_array( $key, array( 'expiration', 'login' ), true ) ) { $value = date_i18n( 'F d, Y H:i A', $value ); } $session_tokens_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $data_to_export[] = array( 'group_id' => 'session-tokens', 'group_label' => __( 'Session Tokens' ), 'group_description' => __( 'User’s Session Tokens data.' ), 'item_id' => "session-tokens-{$user->ID}-{$token_key}", 'data' => $session_tokens_data_to_export, ); } } return array( 'data' => $data_to_export, 'done' => true, ); } function _wp_privacy_account_request_confirmed( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request ) { return; } if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return; } update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() ); wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-confirmed', ) ); } function _wp_privacy_send_request_confirmation_notification( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) { return; } $already_notified = (bool) get_post_meta( $request_id, '_wp_admin_notified', true ); if ( $already_notified ) { return; } if ( 'export_personal_data' === $request->action_name ) { $manage_url = admin_url( 'export-personal-data.php' ); } elseif ( 'remove_personal_data' === $request->action_name ) { $manage_url = admin_url( 'erase-personal-data.php' ); } $action_description = wp_user_request_action_description( $request->action_name ); $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request ); $email_data = array( 'request' => $request, 'user_email' => $request->email, 'description' => $action_description, 'manage_url' => $manage_url, 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), 'admin_email' => $admin_email, ); $subject = sprintf( __( '[%1$s] Action Confirmed: %2$s' ), $email_data['sitename'], $action_description ); $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, -.request-filesystem-credentials-dialog-content { - margin: 25px; -} +A user data privacy request has been confirmed on ###SITENAME###: -#request-filesystem-credentials-title { - font-size: 1.3em; - margin: 1em 0; -} +User: ###USER_EMAIL### +Request: ###DESCRIPTION### -.request-filesystem-credentials-form legend { - font-size: 1em; - padding: 1.33em 0; - font-weight: 600; -} +You can view and manage these data privacy requests here: -.request-filesystem-credentials-form input[type="text"], -.request-filesystem-credentials-form input[type="password"] { - display: block; -} +###MANAGE_URL### -.request-filesystem-credentials-dialog input[type="text"], -.request-filesystem-credentials-dialog input[type="password"] { - width: 100%; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.8.0', sprintf( __( '%1$s or %2$s' ), 'user_request_confirmed_email_content', 'user_erasure_fulfillment_email_content' ) ); $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $email_data['admin_email'], $subject, $content, $headers ); if ( $email_sent ) { update_post_meta( $request_id, '_wp_admin_notified', true ); } } function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) { return; } $already_notified = (bool) get_post_meta( $request_id, '_wp_user_notified', true ); if ( $already_notified ) { return; } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); $email_data = array( 'request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), ); $subject = sprintf( __( '[%s] Erasure Request Fulfilled' ), $email_data['sitename'] ); $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.8.0', 'user_erasure_fulfillment_email_subject' ); $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, -.request-filesystem-credentials-form .field-title { - font-weight: 600; -} +Your request to erase your personal data on ###SITENAME### has been completed. -.request-filesystem-credentials-dialog label[for="hostname"], -.request-filesystem-credentials-dialog label[for="public_key"], -.request-filesystem-credentials-dialog label[for="private_key"] { - display: block; - margin-bottom: 1em; -} +If you have any follow-up questions or concerns, please contact the site administrator. -.request-filesystem-credentials-dialog .ftp-username, -.request-filesystem-credentials-dialog .ftp-password { - float: right; - width: 48%; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); if ( ! empty( $email_data['privacy_policy_url'] ) ) { $content = __( 'Howdy, -.request-filesystem-credentials-dialog .ftp-password { - margin-right: 4%; -} +Your request to erase your personal data on ###SITENAME### has been completed. -.request-filesystem-credentials-dialog .request-filesystem-credentials-action-buttons { - text-align: left; -} +If you have any follow-up questions or concerns, please contact the site administrator. -.request-filesystem-credentials-dialog label[for="ftp"] { - margin-left: 10px; -} +For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL### -.request-filesystem-credentials-dialog #auth-keys-desc { - margin-bottom: 0; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); } $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.8.0', sprintf( __( '%1$s or %2$s' ), 'user_erasure_fulfillment_email_content', 'user_request_confirmed_email_content' ) ); $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters_deprecated( 'user_erasure_complete_email_headers', array( $headers, $subject, $content, $request_id, $email_data ), '5.8.0', 'user_erasure_fulfillment_email_headers' ); $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $user_email, $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( $email_sent ) { update_post_meta( $request_id, '_wp_user_notified', true ); } } function _wp_privacy_account_request_confirmed_message( $request_id ) { $request = wp_get_user_request( $request_id ); $message = '

          ' . __( 'Action has been confirmed.' ) . '

          '; $message .= '

          ' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '

          '; if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { if ( 'export_personal_data' === $request->action_name ) { $message = '

          ' . __( 'Thanks for confirming your export request.' ) . '

          '; $message .= '

          ' . __( 'The site administrator has been notified. You will receive a link to download your export via email when they fulfill your request.' ) . '

          '; } elseif ( 'remove_personal_data' === $request->action_name ) { $message = '

          ' . __( 'Thanks for confirming your erasure request.' ) . '

          '; $message .= '

          ' . __( 'The site administrator has been notified. You will receive an email confirmation when they erase your data.' ) . '

          '; } } $message = apply_filters( 'user_request_action_confirmed_message', $message, $request_id ); return $message; } function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array(), $status = 'pending' ) { $email_address = sanitize_email( $email_address ); $action_name = sanitize_key( $action_name ); if ( ! is_email( $email_address ) ) { return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) ); } if ( ! in_array( $action_name, _wp_privacy_action_request_types(), true ) ) { return new WP_Error( 'invalid_action', __( 'Invalid action name.' ) ); } if ( ! in_array( $status, array( 'pending', 'confirmed' ), true ) ) { return new WP_Error( 'invalid_status', __( 'Invalid request status.' ) ); } $user = get_user_by( 'email', $email_address ); $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0; $requests_query = new WP_Query( array( 'post_type' => 'user_request', 'post_name__in' => array( $action_name ), 'title' => $email_address, 'post_status' => array( 'request-pending', 'request-confirmed', ), 'fields' => 'ids', ) ); if ( $requests_query->found_posts ) { return new WP_Error( 'duplicate_request', __( 'An incomplete personal data request for this email address already exists.' ) ); } $request_id = wp_insert_post( array( 'post_author' => $user_id, 'post_name' => $action_name, 'post_title' => $email_address, 'post_content' => wp_json_encode( $request_data ), 'post_status' => 'request-' . $status, 'post_type' => 'user_request', 'post_date' => current_time( 'mysql', false ), 'post_date_gmt' => current_time( 'mysql', true ), ), true ); return $request_id; } function wp_user_request_action_description( $action_name ) { switch ( $action_name ) { case 'export_personal_data': $description = __( 'Export Personal Data' ); break; case 'remove_personal_data': $description = __( 'Erase Personal Data' ); break; default: $description = sprintf( __( 'Confirm the "%s" action' ), $action_name ); break; } return apply_filters( 'user_request_action_description', $description, $action_name ); } function wp_send_user_request( $request_id ) { $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); if ( ! $request ) { return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) ); } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $email_data = array( 'request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description( $request->action_name ), 'confirm_url' => add_query_arg( array( 'action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key( $request_id ), ), wp_login_url() ), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), ); $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, -#request-filesystem-credentials-dialog .button:not(:last-child) { - margin-left: 10px; -} +A request has been made to perform the following action on your account: -#request-filesystem-credentials-form .cancel-button { - display: none; -} + ###DESCRIPTION### -#request-filesystem-credentials-dialog .cancel-button { - display: inline; -} +To confirm this, please click on the following link: +###CONFIRM_URL### -.request-filesystem-credentials-dialog .ftp-username, -.request-filesystem-credentials-dialog .ftp-password { - float: none; - width: auto; -} +You can safely ignore and delete this email if you do not want to +take this action. -.request-filesystem-credentials-dialog .ftp-username { - margin-bottom: 1em; -} +Regards, +All at ###SITENAME### +###SITEURL###' ); $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); $content = str_replace( '###EMAIL###', $email_data['email'], $content ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $email_data['email'], $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( ! $email_sent ) { return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export confirmation email.' ) ); } return true; } function wp_generate_user_request_key( $request_id ) { global $wp_hasher; $key = wp_generate_password( 20, false ); if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword( $key ), ) ); return $key; } function wp_validate_user_request_key( $request_id, $key ) { global $wp_hasher; $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); $saved_key = $request->confirm_key; $key_request_time = $request->modified_timestamp; if ( ! $request || ! $saved_key || ! $key_request_time ) { return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) ); } if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return new WP_Error( 'expired_request', __( 'This personal data request has expired.' ) ); } if ( empty( $key ) ) { return new WP_Error( 'missing_key', __( 'The confirmation key is missing from this personal data request.' ) ); } if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $expiration_duration = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS ); $expiration_time = $key_request_time + $expiration_duration; if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) { return new WP_Error( 'invalid_key', __( 'The confirmation key is invalid for this personal data request.' ) ); } if ( ! $expiration_time || time() > $expiration_time ) { return new WP_Error( 'expired_key', __( 'The confirmation key has expired for this personal data request.' ) ); } return true; } function wp_get_user_request( $request_id ) { $request_id = absint( $request_id ); $post = get_post( $request_id ); if ( ! $post || 'user_request' !== $post->post_type ) { return false; } return new WP_User_Request( $post ); } function wp_is_application_passwords_supported() { return is_ssl() || 'local' === wp_get_environment_type(); } function wp_is_application_passwords_available() { return apply_filters( 'wp_is_application_passwords_available', wp_is_application_passwords_supported() ); } function wp_is_application_passwords_available_for_user( $user ) { if ( ! wp_is_application_passwords_available() ) { return false; } if ( ! is_object( $user ) ) { $user = get_userdata( $user ); } if ( ! $user || ! $user->exists() ) { return false; } return apply_filters( 'wp_is_application_passwords_available_for_user', true, $user ); } url = $url; $this->request = $request; } public function dispatch( $hook, $parameters = array() ) { $result = parent::dispatch( $hook, $parameters ); switch ( $hook ) { case 'curl.before_send': do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) ); break; } do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); return $result; } } request( $url, $args ); } function wp_safe_remote_get( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->get( $url, $args ); } function wp_safe_remote_post( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->post( $url, $args ); } function wp_safe_remote_head( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->head( $url, $args ); } function wp_remote_request( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->request( $url, $args ); } function wp_remote_get( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->get( $url, $args ); } function wp_remote_post( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->post( $url, $args ); } function wp_remote_head( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->head( $url, $args ); } function wp_remote_retrieve_headers( $response ) { if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { return array(); } return $response['headers']; } function wp_remote_retrieve_header( $response, $header ) { if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { return ''; } if ( isset( $response['headers'][ $header ] ) ) { return $response['headers'][ $header ]; } return ''; } function wp_remote_retrieve_response_code( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['code']; } function wp_remote_retrieve_response_message( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['message']; } function wp_remote_retrieve_body( $response ) { if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) { return ''; } return $response['body']; } function wp_remote_retrieve_cookies( $response ) { if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { return array(); } return $response['cookies']; } function wp_remote_retrieve_cookie( $response, $name ) { $cookies = wp_remote_retrieve_cookies( $response ); if ( empty( $cookies ) ) { return ''; } foreach ( $cookies as $cookie ) { if ( $cookie->name === $name ) { return $cookie; } } return ''; } function wp_remote_retrieve_cookie_value( $response, $name ) { $cookie = wp_remote_retrieve_cookie( $response, $name ); if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) { return ''; } return $cookie->value; } function wp_http_supports( $capabilities = array(), $url = null ) { $http = _wp_http_get_object(); $capabilities = wp_parse_args( $capabilities ); $count = count( $capabilities ); if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) { $capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) ); } if ( $url && ! isset( $capabilities['ssl'] ) ) { $scheme = parse_url( $url, PHP_URL_SCHEME ); if ( 'https' === $scheme || 'ssl' === $scheme ) { $capabilities['ssl'] = true; } } return (bool) $http->_get_first_available_transport( $capabilities ); } function get_http_origin() { $origin = ''; if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) { $origin = $_SERVER['HTTP_ORIGIN']; } return apply_filters( 'http_origin', $origin ); } function get_allowed_http_origins() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $allowed_origins = array_unique( array( 'http://' . $admin_origin['host'], 'https://' . $admin_origin['host'], 'http://' . $home_origin['host'], 'https://' . $home_origin['host'], ) ); return apply_filters( 'allowed_http_origins', $allowed_origins ); } function is_allowed_http_origin( $origin = null ) { $origin_arg = $origin; if ( null === $origin ) { $origin = get_http_origin(); } if ( $origin && ! in_array( $origin, get_allowed_http_origins(), true ) ) { $origin = ''; } return apply_filters( 'allowed_http_origin', $origin, $origin_arg ); } function send_origin_headers() { $origin = get_http_origin(); if ( is_allowed_http_origin( $origin ) ) { header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Credentials: true' ); if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { exit; } return $origin; } if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { status_header( 403 ); exit; } return false; } function wp_http_validate_url( $url ) { if ( ! is_string( $url ) || '' === $url || is_numeric( $url ) ) { return false; } $original_url = $url; $url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) ); if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) ) { return false; } $parsed_url = parse_url( $url ); if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { return false; } if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) ) { return false; } if ( false !== strpbrk( $parsed_url['host'], ':#?[]' ) ) { return false; } $parsed_home = parse_url( get_option( 'home' ) ); $same_host = isset( $parsed_home['host'] ) && strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); $host = trim( $parsed_url['host'], '.' ); if ( ! $same_host ) { if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) { $ip = $host; } else { $ip = gethostbyname( $host ); if ( $ip === $host ) { return false; } } if ( $ip ) { $parts = array_map( 'intval', explode( '.', $ip ) ); if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] || ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) || ( 192 === $parts[0] && 168 === $parts[1] ) ) { if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) ) { return false; } } } } if ( empty( $parsed_url['port'] ) ) { return $url; } $port = $parsed_url['port']; $allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url ); if ( is_array( $allowed_ports ) && in_array( $port, $allowed_ports, true ) ) { return $url; } if ( $parsed_home && $same_host && isset( $parsed_home['port'] ) && $parsed_home['port'] === $port ) { return $url; } return false; } function allowed_http_request_hosts( $is_external, $host ) { if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) ) { $is_external = true; } return $is_external; } function ms_allowed_http_request_hosts( $is_external, $host ) { global $wpdb; static $queried = array(); if ( $is_external ) { return $is_external; } if ( get_network()->domain === $host ) { return true; } if ( isset( $queried[ $host ] ) ) { return $queried[ $host ]; } $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); return $queried[ $host ]; } function wp_parse_url( $url, $component = -1 ) { $to_unset = array(); $url = (string) $url; if ( '//' === substr( $url, 0, 2 ) ) { $to_unset[] = 'scheme'; $url = 'placeholder:' . $url; } elseif ( '/' === substr( $url, 0, 1 ) ) { $to_unset[] = 'scheme'; $to_unset[] = 'host'; $url = 'placeholder://placeholder' . $url; } $parts = parse_url( $url ); if ( false === $parts ) { return $parts; } foreach ( $to_unset as $key ) { unset( $parts[ $key ] ); } return _get_component_from_parsed_url_array( $parts, $component ); } function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) { if ( -1 === $component ) { return $url_parts; } $key = _wp_translate_php_url_constant_to_key( $component ); if ( false !== $key && is_array( $url_parts ) && isset( $url_parts[ $key ] ) ) { return $url_parts[ $key ]; } else { return null; } } function _wp_translate_php_url_constant_to_key( $constant ) { $translation = array( PHP_URL_SCHEME => 'scheme', PHP_URL_HOST => 'host', PHP_URL_PORT => 'port', PHP_URL_USER => 'user', PHP_URL_PASS => 'pass', PHP_URL_PATH => 'path', PHP_URL_QUERY => 'query', PHP_URL_FRAGMENT => 'fragment', ); if ( isset( $translation[ $constant ] ) ) { return $translation[ $constant ]; } else { return false; } } get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) { return false; } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value ); $result = $wpdb->insert( $table, array( $column => $object_id, 'meta_key' => $meta_key, 'meta_value' => $meta_value, ) ); if ( ! $result ) { return false; } $mid = (int) $wpdb->insert_id; wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value ); return $mid; } function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) { global $wpdb; if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $meta_subtype = get_object_subtype( $meta_type, $object_id ); $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $raw_meta_key = $meta_key; $meta_key = wp_unslash( $meta_key ); $passed_value = $meta_value; $meta_value = wp_unslash( $meta_value ); $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype ); $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); if ( null !== $check ) { return (bool) $check; } if ( empty( $prev_value ) ) { $old_value = get_metadata_raw( $meta_type, $object_id, $meta_key ); if ( is_countable( $old_value ) && count( $old_value ) === 1 ) { if ( $old_value[0] === $meta_value ) { return false; } } } $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ); if ( empty( $meta_ids ) ) { return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value ); } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); $data = compact( 'meta_value' ); $where = array( $column => $object_id, 'meta_key' => $meta_key, ); if ( ! empty( $prev_value ) ) { $prev_value = maybe_serialize( $prev_value ); $where['meta_value'] = $prev_value; } foreach ( $meta_ids as $meta_id ) { do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } } $result = $wpdb->update( $table, $data, $where ); if ( ! $result ) { return false; } wp_cache_delete( $object_id, $meta_type . '_meta' ); foreach ( $meta_ids as $meta_id ) { do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } } return true; } function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) { global $wpdb; if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id && ! $delete_all ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $type_column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all ); if ( null !== $check ) { return (bool) $check; } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); if ( ! $delete_all ) { $query .= $wpdb->prepare( " AND $type_column = %d", $object_id ); } if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) { $query .= $wpdb->prepare( ' AND meta_value = %s', $meta_value ); } $meta_ids = $wpdb->get_col( $query ); if ( ! count( $meta_ids ) ) { return false; } if ( $delete_all ) { if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) { $object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s AND meta_value = %s", $meta_key, $meta_value ) ); } else { $object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s", $meta_key ) ); } } do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'delete_postmeta', $meta_ids ); } $query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . ' )'; $count = $wpdb->query( $query ); if ( ! $count ) { return false; } if ( $delete_all ) { $data = (array) $object_ids; } else { $data = array( $object_id ); } wp_cache_delete_multiple( $data, $meta_type . '_meta' ); do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'deleted_postmeta', $meta_ids ); } return true; } function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) { $value = get_metadata_raw( $meta_type, $object_id, $meta_key, $single ); if ( ! is_null( $value ) ) { return $value; } return get_metadata_default( $meta_type, $object_id, $meta_key, $single ); } function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = false ) { if ( ! $meta_type || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type ); if ( null !== $check ) { if ( $single && is_array( $check ) ) { return $check[0]; } else { return $check; } } $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); if ( isset( $meta_cache[ $object_id ] ) ) { $meta_cache = $meta_cache[ $object_id ]; } else { $meta_cache = null; } } if ( ! $meta_key ) { return $meta_cache; } if ( isset( $meta_cache[ $meta_key ] ) ) { if ( $single ) { return maybe_unserialize( $meta_cache[ $meta_key ][0] ); } else { return array_map( 'maybe_unserialize', $meta_cache[ $meta_key ] ); } } return null; } function get_metadata_default( $meta_type, $object_id, $meta_key, $single = false ) { if ( $single ) { $value = ''; } else { $value = array(); } $value = apply_filters( "default_{$meta_type}_metadata", $value, $object_id, $meta_key, $single, $meta_type ); if ( ! $single && ! wp_is_numeric_array( $value ) ) { $value = array( $value ); } return $value; } function metadata_exists( $meta_type, $object_id, $meta_key ) { if ( ! $meta_type || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true, $meta_type ); if ( null !== $check ) { return (bool) $check; } $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); $meta_cache = $meta_cache[ $object_id ]; } if ( isset( $meta_cache[ $meta_key ] ) ) { return true; } return false; } function get_metadata_by_mid( $meta_type, $meta_id ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata_by_mid", null, $meta_id ); if ( null !== $check ) { return $check; } $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) ); if ( empty( $meta ) ) { return false; } if ( isset( $meta->meta_value ) ) { $meta->meta_value = maybe_unserialize( $meta->meta_value ); } return $meta; } function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $check = apply_filters( "update_{$meta_type}_metadata_by_mid", null, $meta_id, $meta_value, $meta_key ); if ( null !== $check ) { return (bool) $check; } $meta = get_metadata_by_mid( $meta_type, $meta_id ); if ( $meta ) { $original_key = $meta->meta_key; $object_id = $meta->{$column}; if ( false === $meta_key ) { $meta_key = $original_key; } elseif ( ! is_string( $meta_key ) ) { return false; } $meta_subtype = get_object_subtype( $meta_type, $object_id ); $_meta_value = $meta_value; $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype ); $meta_value = maybe_serialize( $meta_value ); $data = array( 'meta_key' => $meta_key, 'meta_value' => $meta_value, ); $where = array(); $where[ $id_column ] = $meta_id; do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } $result = $wpdb->update( $table, $data, $where, '%s', '%d' ); if ( ! $result ) { return false; } wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } return true; } return false; } function delete_metadata_by_mid( $meta_type, $meta_id ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $check = apply_filters( "delete_{$meta_type}_metadata_by_mid", null, $meta_id ); if ( null !== $check ) { return (bool) $check; } $meta = get_metadata_by_mid( $meta_type, $meta_id ); if ( $meta ) { $object_id = (int) $meta->{$column}; do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); if ( 'post' === $meta_type || 'comment' === $meta_type ) { do_action( "delete_{$meta_type}meta", $meta_id ); } $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) ); wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); if ( 'post' === $meta_type || 'comment' === $meta_type ) { do_action( "deleted_{$meta_type}meta", $meta_id ); } return $result; } return false; } function update_meta_cache( $meta_type, $object_ids ) { global $wpdb; if ( ! $meta_type || ! $object_ids ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); if ( ! is_array( $object_ids ) ) { $object_ids = preg_replace( '|[^0-9,]|', '', $object_ids ); $object_ids = explode( ',', $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $check = apply_filters( "update_{$meta_type}_metadata_cache", null, $object_ids ); if ( null !== $check ) { return (bool) $check; } $cache_key = $meta_type . '_meta'; $non_cached_ids = array(); $cache = array(); $cache_values = wp_cache_get_multiple( $object_ids, $cache_key ); foreach ( $cache_values as $id => $cached_object ) { if ( false === $cached_object ) { $non_cached_ids[] = $id; } else { $cache[ $id ] = $cached_object; } } if ( empty( $non_cached_ids ) ) { return $cache; } $id_list = implode( ',', $non_cached_ids ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A ); if ( ! empty( $meta_list ) ) { foreach ( $meta_list as $metarow ) { $mpid = (int) $metarow[ $column ]; $mkey = $metarow['meta_key']; $mval = $metarow['meta_value']; if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) { $cache[ $mpid ] = array(); } if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) { $cache[ $mpid ][ $mkey ] = array(); } $cache[ $mpid ][ $mkey ][] = $mval; } } $data = array(); foreach ( $non_cached_ids as $id ) { if ( ! isset( $cache[ $id ] ) ) { $cache[ $id ] = array(); } $data[ $id ] = $cache[ $id ]; } wp_cache_add_multiple( $data, $cache_key ); return $cache; } function wp_metadata_lazyloader() { static $wp_metadata_lazyloader; if ( null === $wp_metadata_lazyloader ) { $wp_metadata_lazyloader = new WP_Metadata_Lazyloader(); } return $wp_metadata_lazyloader; } function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) { $meta_query_obj = new WP_Meta_Query( $meta_query ); return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context ); } function _get_meta_table( $type ) { global $wpdb; $table_name = $type . 'meta'; if ( empty( $wpdb->$table_name ) ) { return false; } return $wpdb->$table_name; } function is_protected_meta( $meta_key, $meta_type = '' ) { $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type ); } function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = '' ) { if ( ! empty( $object_subtype ) && has_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) { return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype ); } return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type ); } function register_meta( $object_type, $meta_key, $args, $deprecated = null ) { global $wp_meta_keys; if ( ! is_array( $wp_meta_keys ) ) { $wp_meta_keys = array(); } $defaults = array( 'object_subtype' => '', 'type' => 'string', 'description' => '', 'default' => '', 'single' => false, 'sanitize_callback' => null, 'auth_callback' => null, 'show_in_rest' => false, ); $has_old_sanitize_cb = false; $has_old_auth_cb = false; if ( is_callable( $args ) ) { $args = array( 'sanitize_callback' => $args, ); $has_old_sanitize_cb = true; } else { $args = (array) $args; } if ( is_callable( $deprecated ) ) { $args['auth_callback'] = $deprecated; $has_old_auth_cb = true; } $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key ); unset( $defaults['default'] ); $args = wp_parse_args( $args, $defaults ); if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) { if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.3.0' ); return false; } } $object_subtype = ! empty( $args['object_subtype'] ) ? $args['object_subtype'] : ''; if ( empty( $args['auth_callback'] ) ) { if ( is_protected_meta( $meta_key, $object_type ) ) { $args['auth_callback'] = '__return_false'; } else { $args['auth_callback'] = '__return_true'; } } if ( is_callable( $args['sanitize_callback'] ) ) { if ( ! empty( $object_subtype ) ) { add_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'], 10, 4 ); } else { add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 ); } } if ( is_callable( $args['auth_callback'] ) ) { if ( ! empty( $object_subtype ) ) { add_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'], 10, 6 ); } else { add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); } } if ( array_key_exists( 'default', $args ) ) { $schema = $args; if ( is_array( $args['show_in_rest'] ) && isset( $args['show_in_rest']['schema'] ) ) { $schema = array_merge( $schema, $args['show_in_rest']['schema'] ); } $check = rest_validate_value_from_schema( $args['default'], $schema ); if ( is_wp_error( $check ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering a default meta value the data must match the type provided.' ), '5.5.0' ); return false; } if ( ! has_filter( "default_{$object_type}_metadata", 'filter_default_metadata' ) ) { add_filter( "default_{$object_type}_metadata", 'filter_default_metadata', 10, 5 ); } } if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb ) { unset( $args['object_subtype'] ); $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args; return true; } return false; } function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) { global $wp_meta_keys; if ( wp_installing() ) { return $value; } if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $meta_type ] ) ) { return $value; } $defaults = array(); foreach ( $wp_meta_keys[ $meta_type ] as $sub_type => $meta_data ) { foreach ( $meta_data as $_meta_key => $args ) { if ( $_meta_key === $meta_key && array_key_exists( 'default', $args ) ) { $defaults[ $sub_type ] = $args; } } } if ( ! $defaults ) { return $value; } if ( isset( $defaults[''] ) ) { $metadata = $defaults['']; } else { $sub_type = get_object_subtype( $meta_type, $object_id ); if ( ! isset( $defaults[ $sub_type ] ) ) { return $value; } $metadata = $defaults[ $sub_type ]; } if ( $single ) { $value = $metadata['default']; } else { $value = array( $metadata['default'] ); } return $value; } function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = '' ) { $meta_keys = get_registered_meta_keys( $object_type, $object_subtype ); return isset( $meta_keys[ $meta_key ] ); } function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) { global $wp_meta_keys; if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { return false; } $args = $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ]; if ( isset( $args['sanitize_callback'] ) && is_callable( $args['sanitize_callback'] ) ) { if ( ! empty( $object_subtype ) ) { remove_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'] ); } else { remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] ); } } if ( isset( $args['auth_callback'] ) && is_callable( $args['auth_callback'] ) ) { if ( ! empty( $object_subtype ) ) { remove_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'] ); } else { remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] ); } } unset( $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] ); if ( empty( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) { unset( $wp_meta_keys[ $object_type ][ $object_subtype ] ); } if ( empty( $wp_meta_keys[ $object_type ] ) ) { unset( $wp_meta_keys[ $object_type ] ); } return true; } function get_registered_meta_keys( $object_type, $object_subtype = '' ) { global $wp_meta_keys; if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $object_type ] ) || ! isset( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) { return array(); } return $wp_meta_keys[ $object_type ][ $object_subtype ]; } function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) { $object_subtype = get_object_subtype( $object_type, $object_id ); if ( ! empty( $meta_key ) ) { if ( ! empty( $object_subtype ) && ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { $object_subtype = ''; } if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { return false; } $meta_keys = get_registered_meta_keys( $object_type, $object_subtype ); $meta_key_data = $meta_keys[ $meta_key ]; $data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] ); return $data; } $data = get_metadata( $object_type, $object_id ); if ( ! $data ) { return array(); } $meta_keys = get_registered_meta_keys( $object_type ); if ( ! empty( $object_subtype ) ) { $meta_keys = array_merge( $meta_keys, get_registered_meta_keys( $object_type, $object_subtype ) ); } return array_intersect_key( $data, $meta_keys ); } function _wp_register_meta_args_allowed_list( $args, $default_args ) { return array_intersect_key( $args, $default_args ); } function get_object_subtype( $object_type, $object_id ) { $object_id = (int) $object_id; $object_subtype = ''; switch ( $object_type ) { case 'post': $post_type = get_post_type( $object_id ); if ( ! empty( $post_type ) ) { $object_subtype = $post_type; } break; case 'term': $term = get_term( $object_id ); if ( ! $term instanceof WP_Term ) { break; } $object_subtype = $term->taxonomy; break; case 'comment': $comment = get_comment( $object_id ); if ( ! $comment ) { break; } $object_subtype = 'comment'; break; case 'user': $user = get_user_by( 'id', $object_id ); if ( ! $user ) { break; } $object_subtype = 'user'; break; } return apply_filters( "get_object_subtype_{$object_type}", $object_subtype, $object_id ); } $value ) { if ( 0 === strpos( $constant, 'E_' ) ) { $core_errors[ $value ] = $constant; } } if ( isset( $core_errors[ $error['type'] ] ) ) { $error['type'] = $core_errors[ $error['type'] ]; } $error_message = __( 'An error of type %1$s was caused in line %2$s of the file %3$s. Error message: %4$s' ); return sprintf( $error_message, "{$error['type']}", "{$error['line']}", "{$error['file']}", "{$error['message']}" ); } function wp_register_fatal_error_handler() { if ( ! wp_is_fatal_error_handler_enabled() ) { return; } $handler = null; if ( defined( 'WP_CONTENT_DIR' ) && is_readable( WP_CONTENT_DIR . '/fatal-error-handler.php' ) ) { $handler = include WP_CONTENT_DIR . '/fatal-error-handler.php'; } if ( ! is_object( $handler ) || ! is_callable( array( $handler, 'handle' ) ) ) { $handler = new WP_Fatal_Error_Handler(); } register_shutdown_function( array( $handler, 'handle' ) ); } function wp_is_fatal_error_handler_enabled() { $enabled = ! defined( 'WP_DISABLE_FATAL_ERROR_HANDLER' ) || ! WP_DISABLE_FATAL_ERROR_HANDLER; return apply_filters( 'wp_fatal_error_handler_enabled', $enabled ); } function wp_recovery_mode() { static $wp_recovery_mode; if ( ! $wp_recovery_mode ) { $wp_recovery_mode = new WP_Recovery_Mode(); } return $wp_recovery_mode; } '', 'path' => '/', 'network_id' => get_current_network_id(), 'registered' => $now, 'last_updated' => $now, 'public' => 1, 'archived' => 0, 'mature' => 0, 'spam' => 0, 'deleted' => 0, 'lang_id' => 0, ); $prepared_data = wp_prepare_site_data( $data, $defaults ); if ( is_wp_error( $prepared_data ) ) { return $prepared_data; } if ( false === $wpdb->insert( $wpdb->blogs, $prepared_data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error ); } $site_id = (int) $wpdb->insert_id; clean_blog_cache( $site_id ); $new_site = get_site( $site_id ); if ( ! $new_site ) { return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) ); } do_action( 'wp_insert_site', $new_site ); $args = array_diff_key( $data, $defaults ); if ( isset( $args['site_id'] ) ) { unset( $args['site_id'] ); } do_action( 'wp_initialize_site', $new_site, $args ); if ( has_action( 'wpmu_new_blog' ) ) { $user_id = ! empty( $args['user_id'] ) ? $args['user_id'] : 0; $meta = ! empty( $args['options'] ) ? $args['options'] : array(); if ( ! array_key_exists( 'WPLANG', $meta ) ) { $meta['WPLANG'] = get_network_option( $new_site->network_id, 'WPLANG' ); } $allowed_data_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); $meta = array_merge( array_intersect_key( $data, array_flip( $allowed_data_fields ) ), $meta ); do_action_deprecated( 'wpmu_new_blog', array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ), '5.1.0', 'wp_initialize_site' ); } return (int) $new_site->id; } function wp_update_site( $site_id, array $data ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $old_site = get_site( $site_id ); if ( ! $old_site ) { return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) ); } $defaults = $old_site->to_array(); $defaults['network_id'] = (int) $defaults['site_id']; $defaults['last_updated'] = current_time( 'mysql', true ); unset( $defaults['blog_id'], $defaults['site_id'] ); $data = wp_prepare_site_data( $data, $defaults, $old_site ); if ( is_wp_error( $data ) ) { return $data; } if ( false === $wpdb->update( $wpdb->blogs, $data, array( 'blog_id' => $old_site->id ) ) ) { return new WP_Error( 'db_update_error', __( 'Could not update site in the database.' ), $wpdb->last_error ); } clean_blog_cache( $old_site ); $new_site = get_site( $old_site->id ); do_action( 'wp_update_site', $new_site, $old_site ); return (int) $new_site->id; } function wp_delete_site( $site_id ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $old_site = get_site( $site_id ); if ( ! $old_site ) { return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) ); } $errors = new WP_Error(); do_action( 'wp_validate_site_deletion', $errors, $old_site ); if ( ! empty( $errors->errors ) ) { return $errors; } do_action_deprecated( 'delete_blog', array( $old_site->id, true ), '5.1.0' ); do_action( 'wp_uninitialize_site', $old_site ); if ( is_site_meta_supported() ) { $blog_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->blogmeta WHERE blog_id = %d ", $old_site->id ) ); foreach ( $blog_meta_ids as $mid ) { delete_metadata_by_mid( 'blog', $mid ); } } if ( false === $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $old_site->id ) ) ) { return new WP_Error( 'db_delete_error', __( 'Could not delete site from the database.' ), $wpdb->last_error ); } clean_blog_cache( $old_site ); do_action( 'wp_delete_site', $old_site ); do_action_deprecated( 'deleted_blog', array( $old_site->id, true ), '5.1.0' ); return $old_site; } function get_site( $site = null ) { if ( empty( $site ) ) { $site = get_current_blog_id(); } if ( $site instanceof WP_Site ) { $_site = $site; } elseif ( is_object( $site ) ) { $_site = new WP_Site( $site ); } else { $_site = WP_Site::get_instance( $site ); } if ( ! $_site ) { return null; } $_site = apply_filters( 'get_site', $_site ); return $_site; } function _prime_site_caches( $ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); if ( ! empty( $non_cached_ids ) ) { $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_site_cache( $fresh_sites, $update_meta_cache ); } } function update_site_cache( $sites, $update_meta_cache = true ) { if ( ! $sites ) { return; } $site_ids = array(); $site_data = array(); $blog_details_data = array(); foreach ( $sites as $site ) { $site_ids[] = $site->blog_id; $site_data[ $site->blog_id ] = $site; $blog_details_data[ $site->blog_id . 'short' ] = $site; } wp_cache_add_multiple( $site_data, 'sites' ); wp_cache_add_multiple( $blog_details_data, 'blog-details' ); if ( $update_meta_cache ) { update_sitemeta_cache( $site_ids ); } } function update_sitemeta_cache( $site_ids ) { if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) { add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ); } return update_meta_cache( 'blog', $site_ids ); } function get_sites( $args = array() ) { $query = new WP_Site_Query(); return $query->query( $args ); } function wp_prepare_site_data( $data, $defaults, $old_site = null ) { if ( isset( $data['site_id'] ) ) { if ( ! empty( $data['site_id'] ) && empty( $data['network_id'] ) ) { $data['network_id'] = $data['site_id']; } unset( $data['site_id'] ); } $data = apply_filters( 'wp_normalize_site_data', $data ); $allowed_data_fields = array( 'domain', 'path', 'network_id', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); $data = array_intersect_key( wp_parse_args( $data, $defaults ), array_flip( $allowed_data_fields ) ); $errors = new WP_Error(); do_action( 'wp_validate_site_data', $errors, $data, $old_site ); if ( ! empty( $errors->errors ) ) { return $errors; } $data['site_id'] = $data['network_id']; unset( $data['network_id'] ); return $data; } function wp_normalize_site_data( $data ) { if ( array_key_exists( 'domain', $data ) ) { $data['domain'] = trim( $data['domain'] ); $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) ); if ( is_subdomain_install() ) { $data['domain'] = str_replace( '@', '', $data['domain'] ); } } if ( array_key_exists( 'path', $data ) ) { $data['path'] = trailingslashit( '/' . trim( $data['path'], '/' ) ); } if ( array_key_exists( 'network_id', $data ) ) { $data['network_id'] = (int) $data['network_id']; } $status_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $status_fields as $status_field ) { if ( array_key_exists( $status_field, $data ) ) { $data[ $status_field ] = (int) $data[ $status_field ]; } } $date_fields = array( 'registered', 'last_updated' ); foreach ( $date_fields as $date_field ) { if ( ! array_key_exists( $date_field, $data ) ) { continue; } if ( empty( $data[ $date_field ] ) || '0000-00-00 00:00:00' === $data[ $date_field ] ) { unset( $data[ $date_field ] ); } } return $data; } function wp_validate_site_data( $errors, $data, $old_site = null ) { if ( empty( $data['domain'] ) ) { $errors->add( 'site_empty_domain', __( 'Site domain must not be empty.' ) ); } if ( empty( $data['path'] ) ) { $errors->add( 'site_empty_path', __( 'Site path must not be empty.' ) ); } if ( empty( $data['network_id'] ) ) { $errors->add( 'site_empty_network_id', __( 'Site network ID must be provided.' ) ); } $date_fields = array( 'registered', 'last_updated' ); foreach ( $date_fields as $date_field ) { if ( empty( $data[ $date_field ] ) ) { $errors->add( 'site_empty_' . $date_field, __( 'Both registration and last updated dates must be provided.' ) ); break; } if ( '0000-00-00 00:00:00' !== $data[ $date_field ] ) { $month = substr( $data[ $date_field ], 5, 2 ); $day = substr( $data[ $date_field ], 8, 2 ); $year = substr( $data[ $date_field ], 0, 4 ); $valid_date = wp_checkdate( $month, $day, $year, $data[ $date_field ] ); if ( ! $valid_date ) { $errors->add( 'site_invalid_' . $date_field, __( 'Both registration and last updated dates must be valid dates.' ) ); break; } } } if ( ! empty( $errors->errors ) ) { return; } if ( ! $old_site || $data['domain'] !== $old_site->domain || $data['path'] !== $old_site->path || $data['network_id'] !== $old_site->network_id ) { if ( domain_exists( $data['domain'], $data['path'], $data['network_id'] ) ) { $errors->add( 'site_taken', __( 'Sorry, that site already exists!' ) ); } } } function wp_initialize_site( $site_id, array $args = array() ) { global $wpdb, $wp_roles; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $site = get_site( $site_id ); if ( ! $site ) { return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) ); } if ( wp_is_site_initialized( $site ) ) { return new WP_Error( 'site_already_initialized', __( 'The site appears to be already initialized.' ) ); } $network = get_network( $site->network_id ); if ( ! $network ) { $network = get_network(); } $args = wp_parse_args( $args, array( 'user_id' => 0, 'title' => sprintf( __( 'Site %d' ), $site->id ), 'options' => array(), 'meta' => array(), ) ); $args = apply_filters( 'wp_initialize_site_args', $args, $site, $network ); $orig_installing = wp_installing(); if ( ! $orig_installing ) { wp_installing( true ); } $switch = false; if ( get_current_blog_id() !== $site->id ) { $switch = true; switch_to_blog( $site->id ); } require_once ABSPATH . 'wp-admin/includes/upgrade.php'; make_db_current_silent( 'blog' ); $home_scheme = 'http'; $siteurl_scheme = 'http'; if ( ! is_subdomain_install() ) { if ( 'https' === parse_url( get_home_url( $network->site_id ), PHP_URL_SCHEME ) ) { $home_scheme = 'https'; } if ( 'https' === parse_url( get_network_option( $network->id, 'siteurl' ), PHP_URL_SCHEME ) ) { $siteurl_scheme = 'https'; } } populate_options( array_merge( array( 'home' => untrailingslashit( $home_scheme . '://' . $site->domain . $site->path ), 'siteurl' => untrailingslashit( $siteurl_scheme . '://' . $site->domain . $site->path ), 'blogname' => wp_unslash( $args['title'] ), 'admin_email' => '', 'upload_path' => get_network_option( $network->id, 'ms_files_rewriting' ) ? UPLOADBLOGSDIR . "/{$site->id}/files" : get_blog_option( $network->site_id, 'upload_path' ), 'blog_public' => (int) $site->public, 'WPLANG' => get_network_option( $network->id, 'WPLANG' ), ), $args['options'] ) ); clean_blog_cache( $site ); populate_roles(); $wp_roles = new WP_Roles(); populate_site_meta( $site->id, $args['meta'] ); $table_prefix = $wpdb->get_blog_prefix(); delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); wp_install_defaults( $args['user_id'] ); add_user_to_blog( $site->id, $args['user_id'], 'administrator' ); if ( ! user_can( $args['user_id'], 'manage_network' ) && ! get_user_meta( $args['user_id'], 'primary_blog', true ) ) { update_user_meta( $args['user_id'], 'primary_blog', $site->id ); } if ( $switch ) { restore_current_blog(); } wp_installing( $orig_installing ); return true; } function wp_uninitialize_site( $site_id ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $site = get_site( $site_id ); if ( ! $site ) { return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) ); } if ( ! wp_is_site_initialized( $site ) ) { return new WP_Error( 'site_already_uninitialized', __( 'The site appears to be already uninitialized.' ) ); } $users = get_users( array( 'blog_id' => $site->id, 'fields' => 'ids', ) ); if ( ! empty( $users ) ) { foreach ( $users as $user_id ) { remove_user_from_blog( $user_id, $site->id ); } } $switch = false; if ( get_current_blog_id() !== $site->id ) { $switch = true; switch_to_blog( $site->id ); } $uploads = wp_get_upload_dir(); $tables = $wpdb->tables( 'blog' ); $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $site->id ); foreach ( (array) $drop_tables as $table ) { $wpdb->query( "DROP TABLE IF EXISTS `$table`" ); } $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $site->id ); $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); $top_dir = $dir; $stack = array( $dir ); $index = 0; while ( $index < count( $stack ) ) { $dir = $stack[ $index ]; $dh = @opendir( $dir ); if ( $dh ) { $file = @readdir( $dh ); while ( false !== $file ) { if ( '.' === $file || '..' === $file ) { $file = @readdir( $dh ); continue; } if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) { $stack[] = $dir . DIRECTORY_SEPARATOR . $file; } elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) { @unlink( $dir . DIRECTORY_SEPARATOR . $file ); } $file = @readdir( $dh ); } @closedir( $dh ); } $index++; } $stack = array_reverse( $stack ); foreach ( (array) $stack as $dir ) { if ( $dir != $top_dir ) { @rmdir( $dir ); } } if ( $switch ) { restore_current_blog(); } return true; } function wp_is_site_initialized( $site_id ) { global $wpdb; if ( is_object( $site_id ) ) { $site_id = $site_id->blog_id; } $site_id = (int) $site_id; $pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id ); if ( null !== $pre ) { return (bool) $pre; } $switch = false; if ( get_current_blog_id() !== $site_id ) { $switch = true; remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 ); switch_to_blog( $site_id ); } $suppress = $wpdb->suppress_errors(); $result = (bool) $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ); $wpdb->suppress_errors( $suppress ); if ( $switch ) { restore_current_blog(); add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 ); } return $result; } function clean_blog_cache( $blog ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( empty( $blog ) ) { return; } $blog_id = $blog; $blog = get_site( $blog_id ); if ( ! $blog ) { if ( ! is_numeric( $blog_id ) ) { return; } $blog = new WP_Site( (object) array( 'blog_id' => $blog_id, 'domain' => null, 'path' => null, ) ); } $blog_id = $blog->blog_id; $domain_path_key = md5( $blog->domain . $blog->path ); wp_cache_delete( $blog_id, 'sites' ); wp_cache_delete( $blog_id, 'site-details' ); wp_cache_delete( $blog_id, 'blog-details' ); wp_cache_delete( $blog_id . 'short', 'blog-details' ); wp_cache_delete( $domain_path_key, 'blog-lookup' ); wp_cache_delete( $domain_path_key, 'blog-id-cache' ); wp_cache_delete( $blog_id, 'blog_meta' ); do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key ); wp_cache_set( 'last_changed', microtime(), 'sites' ); do_action_deprecated( 'refresh_blog_details', array( $blog_id ), '4.9.0', 'clean_site_cache' ); } function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique ); } function delete_site_meta( $site_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'blog', $site_id, $meta_key, $meta_value ); } function get_site_meta( $site_id, $key = '', $single = false ) { return get_metadata( 'blog', $site_id, $key, $single ); } function update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value ); } function delete_site_meta_by_key( $meta_key ) { return delete_metadata( 'blog', null, $meta_key, '', true ); } function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) { if ( null === $old_site ) { wp_maybe_update_network_site_counts( $new_site->network_id ); return; } if ( $new_site->network_id != $old_site->network_id ) { wp_maybe_update_network_site_counts( $new_site->network_id ); wp_maybe_update_network_site_counts( $old_site->network_id ); } } function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null ) { $site_id = $new_site->id; if ( ! $old_site ) { $old_site = new WP_Site( new stdClass() ); } if ( $new_site->spam != $old_site->spam ) { if ( 1 == $new_site->spam ) { do_action( 'make_spam_blog', $site_id ); } else { do_action( 'make_ham_blog', $site_id ); } } if ( $new_site->mature != $old_site->mature ) { if ( 1 == $new_site->mature ) { do_action( 'mature_blog', $site_id ); } else { do_action( 'unmature_blog', $site_id ); } } if ( $new_site->archived != $old_site->archived ) { if ( 1 == $new_site->archived ) { do_action( 'archive_blog', $site_id ); } else { do_action( 'unarchive_blog', $site_id ); } } if ( $new_site->deleted != $old_site->deleted ) { if ( 1 == $new_site->deleted ) { do_action( 'make_delete_blog', $site_id ); } else { do_action( 'make_undelete_blog', $site_id ); } } if ( $new_site->public != $old_site->public ) { do_action( 'update_blog_public', $site_id, $new_site->public ); } } function wp_maybe_clean_new_site_cache_on_update( $new_site, $old_site ) { if ( $old_site->domain !== $new_site->domain || $old_site->path !== $new_site->path ) { clean_blog_cache( $new_site ); } } function wp_update_blog_public_option_on_site_update( $site_id, $public ) { if ( ! wp_is_site_initialized( $site_id ) ) { return; } update_blog_option( $site_id, 'blog_public', $public ); } function wp_cache_set_sites_last_changed() { wp_cache_set( 'last_changed', microtime(), 'sites' ); } function wp_check_site_meta_support_prefilter( $check ) { if ( ! is_site_meta_supported() ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); return false; } return $check; } current_time( 'mysql', true ) ) ); do_action( 'wpmu_blog_updated', $site_id ); } function get_blogaddress_by_id( $blog_id ) { $bloginfo = get_site( (int) $blog_id ); if ( empty( $bloginfo ) ) { return ''; } $scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME ); $scheme = empty( $scheme ) ? 'http' : $scheme; return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path ); } function get_blogaddress_by_name( $blogname ) { if ( is_subdomain_install() ) { if ( 'main' === $blogname ) { $blogname = 'www'; } $url = rtrim( network_home_url(), '/' ); if ( ! empty( $blogname ) ) { $url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url ); } } else { $url = network_home_url( $blogname ); } return esc_url( $url . '/' ); } function get_id_from_blogname( $slug ) { $current_network = get_network(); $slug = trim( $slug, '/' ); if ( is_subdomain_install() ) { $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain ); $path = $current_network->path; } else { $domain = $current_network->domain; $path = $current_network->path . $slug . '/'; } $site_ids = get_sites( array( 'number' => 1, 'fields' => 'ids', 'domain' => $domain, 'path' => $path, 'update_site_meta_cache' => false, ) ); if ( empty( $site_ids ) ) { return null; } return array_shift( $site_ids ); } function get_blog_details( $fields = null, $get_all = true ) { global $wpdb; if ( is_array( $fields ) ) { if ( isset( $fields['blog_id'] ) ) { $blog_id = $fields['blog_id']; } elseif ( isset( $fields['domain'] ) && isset( $fields['path'] ) ) { $key = md5( $fields['domain'] . $fields['path'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } elseif ( isset( $fields['domain'] ) && is_subdomain_install() ) { $key = md5( $fields['domain'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } else { return false; } } else { if ( ! $fields ) { $blog_id = get_current_blog_id(); } elseif ( ! is_numeric( $fields ) ) { $blog_id = get_id_from_blogname( $fields ); } else { $blog_id = $fields; } } $blog_id = (int) $blog_id; $all = $get_all ? '' : 'short'; $details = wp_cache_get( $blog_id . $all, 'blog-details' ); if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 == $details ) { return false; } else { wp_cache_delete( $blog_id . $all, 'blog-details' ); unset( $details ); } } else { return $details; } } if ( $get_all ) { $details = wp_cache_get( $blog_id . 'short', 'blog-details' ); } else { $details = wp_cache_get( $blog_id, 'blog-details' ); if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 == $details ) { return false; } else { wp_cache_delete( $blog_id, 'blog-details' ); unset( $details ); } } else { return $details; } } } if ( empty( $details ) ) { $details = WP_Site::get_instance( $blog_id ); if ( ! $details ) { wp_cache_set( $blog_id, -1, 'blog-details' ); return false; } } if ( ! $details instanceof WP_Site ) { $details = new WP_Site( $details ); } if ( ! $get_all ) { wp_cache_set( $blog_id . $all, $details, 'blog-details' ); return $details; } $switched_blog = false; if ( get_current_blog_id() !== $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $details->blogname = get_option( 'blogname' ); $details->siteurl = get_option( 'siteurl' ); $details->post_count = get_option( 'post_count' ); $details->home = get_option( 'home' ); if ( $switched_blog ) { restore_current_blog(); } $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); wp_cache_set( $blog_id . $all, $details, 'blog-details' ); $key = md5( $details->domain . $details->path ); wp_cache_set( $key, $details, 'blog-lookup' ); return $details; } function refresh_blog_details( $blog_id = 0 ) { $blog_id = (int) $blog_id; if ( ! $blog_id ) { $blog_id = get_current_blog_id(); } clean_blog_cache( $blog_id ); } function update_blog_details( $blog_id, $details = array() ) { global $wpdb; if ( empty( $details ) ) { return false; } if ( is_object( $details ) ) { $details = get_object_vars( $details ); } $site = wp_update_site( $blog_id, $details ); if ( is_wp_error( $site ) ) { return false; } return true; } function clean_site_details_cache( $site_id = 0 ) { $site_id = (int) $site_id; if ( ! $site_id ) { $site_id = get_current_blog_id(); } wp_cache_delete( $site_id, 'site-details' ); wp_cache_delete( $site_id, 'blog-details' ); } function get_blog_option( $id, $option, $default = false ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() == $id ) { return get_option( $option, $default ); } switch_to_blog( $id ); $value = get_option( $option, $default ); restore_current_blog(); return apply_filters( "blog_option_{$option}", $value, $id ); } 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; } function delete_blog_option( $id, $option ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() == $id ) { return delete_option( $option ); } switch_to_blog( $id ); $return = delete_option( $option ); restore_current_blog(); return $return; } function update_blog_option( $id, $option, $value, $deprecated = null ) { $id = (int) $id; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } if ( get_current_blog_id() == $id ) { return update_option( $option, $value ); } switch_to_blog( $id ); $return = update_option( $option, $value ); restore_current_blog(); return $return; } function switch_to_blog( $new_blog_id, $deprecated = null ) { global $wpdb; $prev_blog_id = get_current_blog_id(); if ( empty( $new_blog_id ) ) { $new_blog_id = $prev_blog_id; } $GLOBALS['_wp_switched_stack'][] = $prev_blog_id; if ( $new_blog_id == $prev_blog_id ) { do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); $GLOBALS['blog_id'] = $new_blog_id; if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'blog_meta' ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } function restore_current_blog() { global $wpdb; if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { return false; } $new_blog_id = array_pop( $GLOBALS['_wp_switched_stack'] ); $prev_blog_id = get_current_blog_id(); if ( $new_blog_id == $prev_blog_id ) { do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['blog_id'] = $new_blog_id; $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'blog_meta' ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } 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 ); } function ms_is_switched() { return ! empty( $GLOBALS['_wp_switched_stack'] ); } function is_archived( $id ) { return get_blog_status( $id, 'archived' ); } function update_archived( $id, $archived ) { update_blog_status( $id, 'archived', $archived ); return $archived; } function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { global $wpdb; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } $allowed_field_names = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); if ( ! in_array( $pref, $allowed_field_names, true ) ) { return $value; } $result = wp_update_site( $blog_id, array( $pref => $value, ) ); if ( is_wp_error( $result ) ) { return false; } return $value; } function get_blog_status( $id, $pref ) { global $wpdb; $details = get_site( $id ); if ( $details ) { return $details->$pref; } return $wpdb->get_var( $wpdb->prepare( "SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id ) ); } function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, 'MU' ); } return $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ), ARRAY_A ); } function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) { $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } wpmu_update_blogs_date(); } function _update_blog_date_on_post_delete( $post_id ) { $post = get_post( $post_id ); $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $post->post_status ) { return; } wpmu_update_blogs_date(); } function _update_posts_count_on_delete( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { return; } update_posts_count(); } function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) { if ( $new_status === $old_status ) { return; } if ( 'post' !== get_post_type( $post ) ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } update_posts_count(); } function wp_count_sites( $network_id = null ) { if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $counts = array(); $args = array( 'network_id' => $network_id, 'number' => 1, 'fields' => 'ids', 'no_found_rows' => false, ); $q = new WP_Site_Query( $args ); $counts['all'] = $q->found_sites; $_args = $args; $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $statuses as $status ) { $_args = $args; $_args[ $status ] = 1; $q = new WP_Site_Query( $_args ); $counts[ $status ] = $q->found_sites; } return $counts; } detect_error(); if ( ! $error ) { return; } if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) { load_default_textdomain(); } $handled = false; if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) { $handled = wp_recovery_mode()->handle_error( $error ); } if ( is_admin() || ! headers_sent() ) { $this->display_error_template( $error, $handled ); } } catch ( Exception $e ) { } } protected function detect_error() { $error = error_get_last(); if ( null === $error ) { return null; } if ( ! $this->should_handle_error( $error ) ) { return null; } return $error; } protected function should_handle_error( $error ) { $error_types_to_handle = array( E_ERROR, E_PARSE, E_USER_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR, ); if ( isset( $error['type'] ) && in_array( $error['type'], $error_types_to_handle, true ) ) { return true; } return (bool) apply_filters( 'wp_should_handle_php_error', false, $error ); } protected function display_error_template( $error, $handled ) { if ( defined( 'WP_CONTENT_DIR' ) ) { $php_error_pluggable = WP_CONTENT_DIR . '/php-error.php'; if ( is_readable( $php_error_pluggable ) ) { require_once $php_error_pluggable; return; } } $this->display_default_error_template( $error, $handled ); } protected function display_default_error_template( $error, $handled ) { if ( ! function_exists( '__' ) ) { wp_load_translations_early(); } if ( ! function_exists( 'wp_die' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } if ( ! class_exists( 'WP_Error' ) ) { require_once ABSPATH . WPINC . '/class-wp-error.php'; } if ( true === $handled && wp_is_recovery_mode() ) { $message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' ); } elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) { $message = __( 'There has been a critical error on this website. Please check your site admin email inbox for instructions.' ); } else { $message = __( 'There has been a critical error on this website.' ); } $message = sprintf( '

          %s

          %s

          ', $message, __( 'https://wordpress.org/support/article/faq-troubleshooting/' ), __( 'Learn more about troubleshooting WordPress.' ) ); $args = array( 'response' => 500, 'exit' => false, ); $message = apply_filters( 'wp_php_error_message', $message, $error ); $args = apply_filters( 'wp_php_error_args', $args, $error ); $wp_error = new WP_Error( 'internal_server_error', $message, array( 'error' => $error, ) ); wp_die( $wp_error, '', $args ); } } name; } if ( ! is_string( $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must be strings.' ), '5.0.0' ); return false; } if ( preg_match( '/[A-Z]+/', $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must not contain uppercase characters.' ), '5.0.0' ); return false; } $name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/'; if ( ! preg_match( $name_matcher, $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ), '5.0.0' ); return false; } if ( $this->is_registered( $name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block type "%s" is already registered.' ), $name ), '5.0.0' ); return false; } if ( ! $block_type ) { $block_type = new WP_Block_Type( $name, $args ); } $this->registered_block_types[ $name ] = $block_type; return $block_type; } public function unregister( $name ) { if ( $name instanceof WP_Block_Type ) { $name = $name->name; } if ( ! $this->is_registered( $name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block type "%s" is not registered.' ), $name ), '5.0.0' ); return false; } $unregistered_block_type = $this->registered_block_types[ $name ]; unset( $this->registered_block_types[ $name ] ); return $unregistered_block_type; } public function get_registered( $name ) { if ( ! $this->is_registered( $name ) ) { return null; } return $this->registered_block_types[ $name ]; } public function get_all_registered() { return $this->registered_block_types; } public function is_registered( $name ) { return isset( $this->registered_block_types[ $name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } '; do_action( 'rss_tag_pre', 'atom-comments' ); ?> + +> + + <?php + if ( is_singular() ) { printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() ); } elseif ( is_search() ) { printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); } else { printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); } ?> + + -.request-filesystem-credentials-dialog .ftp-password { - margin: 0; -} + -.request-filesystem-credentials-dialog .ftp-password em { - color: #8c8f94; -} + + + + + + + + + + + + + + +comment_post_ID ); $GLOBALS['post'] = $comment_post; ?> + + + <?php + if ( ! is_singular() ) { $title = get_the_title( $comment_post->ID ); $title = apply_filters( 'the_title_rss', $title ); printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); } else { printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); } ?> + + -.request-filesystem-credentials-dialog label { - display: block; - line-height: 1.5; - margin-bottom: 1em; -} + + + ' . get_comment_author_url() . '';} ?> -.request-filesystem-credentials-form legend { - padding-bottom: 0; -} + -.request-filesystem-credentials-form #ssh-keys legend { - font-size: 1.3em; -} + + + -.request-filesystem-credentials-form .notice { - margin: 0 0 20px; - clear: both; -} + + ]]> + + ]]> + -/*------------------------------------------------------------------------------ - Privacy Policy settings screen -------------------------------------------------------------------------------*/ -.tools-privacy-policy-page form { - margin-bottom: 1.3em; -} + comment_parent ) : ?> + + comment_parent ); ?> + + comment_ID, $comment_post->ID ); ?> + + + +post_type, 'post-formats' ) ) { return false; } $_format = get_the_terms( $post->ID, 'post_format' ); if ( empty( $_format ) ) { return false; } $format = reset( $_format ); return str_replace( 'post-format-', '', $format->slug ); } function has_post_format( $format = array(), $post = null ) { $prefixed = array(); if ( $format ) { foreach ( (array) $format as $single ) { $prefixed[] = 'post-format-' . sanitize_key( $single ); } } return has_term( $prefixed, 'post_format', $post ); } function set_post_format( $post, $format ) { $post = get_post( $post ); if ( ! $post ) { return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); } if ( ! empty( $format ) ) { $format = sanitize_key( $format ); if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs(), true ) ) { $format = ''; } else { $format = 'post-format-' . $format; } } return wp_set_post_terms( $post->ID, $format, 'post_format' ); } function get_post_format_strings() { $strings = array( 'standard' => _x( 'Standard', 'Post format' ), 'aside' => _x( 'Aside', 'Post format' ), 'chat' => _x( 'Chat', 'Post format' ), 'gallery' => _x( 'Gallery', 'Post format' ), 'link' => _x( 'Link', 'Post format' ), 'image' => _x( 'Image', 'Post format' ), 'quote' => _x( 'Quote', 'Post format' ), 'status' => _x( 'Status', 'Post format' ), 'video' => _x( 'Video', 'Post format' ), 'audio' => _x( 'Audio', 'Post format' ), ); return $strings; } function get_post_format_slugs() { $slugs = array_keys( get_post_format_strings() ); return array_combine( $slugs, $slugs ); } function get_post_format_string( $slug ) { $strings = get_post_format_strings(); if ( ! $slug ) { return $strings['standard']; } else { return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : ''; } } function get_post_format_link( $format ) { $term = get_term_by( 'slug', 'post-format-' . $format, 'post_format' ); if ( ! $term || is_wp_error( $term ) ) { return false; } return get_term_link( $term ); } function _post_format_request( $qvs ) { if ( ! isset( $qvs['post_format'] ) ) { return $qvs; } $slugs = get_post_format_slugs(); if ( isset( $slugs[ $qvs['post_format'] ] ) ) { $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; } $tax = get_taxonomy( 'post_format' ); if ( ! is_admin() ) { $qvs['post_type'] = $tax->object_type; } return $qvs; } function _post_format_link( $link, $term, $taxonomy ) { global $wp_rewrite; if ( 'post_format' !== $taxonomy ) { return $link; } if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); } else { $link = remove_query_arg( 'post_format', $link ); return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link ); } } function _post_format_get_term( $term ) { if ( isset( $term->slug ) ) { $term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } return $term; } function _post_format_get_terms( $terms, $taxonomies, $args ) { if ( in_array( 'post_format', (array) $taxonomies, true ) ) { if ( isset( $args['fields'] ) && 'names' === $args['fields'] ) { foreach ( $terms as $order => $name ) { $terms[ $order ] = get_post_format_string( str_replace( 'post-format-', '', $name ) ); } } else { foreach ( (array) $terms as $order => $term ) { if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) { $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } } } } return $terms; } function _post_format_wp_get_object_terms( $terms ) { foreach ( (array) $terms as $order => $term ) { if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) { $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } } return $terms; } +> + + + + -.tools-privacy-policy-page input.button { - margin: 0 6px 0 1px; -} +> + -.tools-privacy-policy-page select { - margin: 0 6px 0.5em 1px; -} + -.tools-privacy-edit { - margin: 1.5em 0; + + + +get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1", $site_id ) ); if ( empty( $_site ) || is_wp_error( $_site ) ) { $_site = -1; } wp_cache_add( $site_id, $_site, 'sites' ); } if ( is_numeric( $_site ) ) { return false; } return new WP_Site( $_site ); } public function __construct( $site ) { foreach ( get_object_vars( $site ) as $key => $value ) { $this->$key = $value; } } public function to_array() { return get_object_vars( $this ); } 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: if ( ! did_action( 'ms_loaded' ) ) { return null; } $details = $this->get_details(); if ( isset( $details->$key ) ) { return $details->$key; } } return null; } public function __isset( $key ) { switch ( $key ) { case 'id': case 'network_id': return true; case 'blogname': case 'siteurl': case 'post_count': case 'home': if ( ! did_action( 'ms_loaded' ) ) { return false; } return true; default: if ( ! did_action( 'ms_loaded' ) ) { return false; } $details = $this->get_details(); if ( isset( $details->$key ) ) { return true; } } return false; } public function __set( $key, $value ) { switch ( $key ) { case 'id': $this->blog_id = (string) $value; break; case 'network_id': $this->site_id = (string) $value; break; default: $this->$key = $value; } } private function get_details() { $details = wp_cache_get( $this->blog_id, 'site-details' ); if ( false === $details ) { switch_to_blog( $this->blog_id ); $details = new stdClass(); foreach ( get_object_vars( $this ) as $key => $value ) { $details->$key = $value; } $details->blogname = get_option( 'blogname' ); $details->siteurl = get_option( 'siteurl' ); $details->post_count = get_option( 'post_count' ); $details->home = get_option( 'home' ); restore_current_blog(); wp_cache_set( $this->blog_id, $details, 'site-details' ); } $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); $details = apply_filters( 'site_details', $details ); return $details; } } site_id ); } function generate_random_password( $len = 8 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' ); return wp_generate_password( $len ); } function is_site_admin( $user_login = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' ); if ( empty( $user_login ) ) { $user_id = get_current_user_id(); if ( !$user_id ) return false; } else { $user = get_user_by( 'login', $user_login ); if ( ! $user->exists() ) return false; $user_id = $user->ID; } return is_super_admin( $user_id ); } if ( !function_exists( 'graceful_fail' ) ) : function graceful_fail( $message ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' ); $message = apply_filters( 'graceful_fail', $message ); $message_template = apply_filters( 'graceful_fail_template', ' + + +Error! + + + +

          %s

          + +' ); die( sprintf( $message_template, $message ) ); } endif; function get_user_details( $username ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' ); return get_user_by('login', $username); } function clear_global_post_cache( $post_id ) { _deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' ); } function is_main_blog() { _deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' ); return is_main_site(); } function validate_email( $email, $check_domain = true) { _deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' ); return is_email( $email, $check_domain ); } function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' ); global $wpdb; $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A ); $blog_list = array(); foreach ( (array) $blogs as $details ) { $blog_list[ $details['blog_id'] ] = $details; $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); } if ( ! $blog_list ) { return array(); } if ( 'all' === $num ) { return array_slice( $blog_list, $start, count( $blog_list ) ); } else { return array_slice( $blog_list, $start, $num ); } } function get_most_active_blogs( $num = 10, $display = true ) { _deprecated_function( __FUNCTION__, '3.0.0' ); $blogs = get_blog_list( 0, 'all', false ); if ( is_array( $blogs ) ) { reset( $blogs ); $most_active = array(); $blog_list = array(); foreach ( (array) $blogs as $key => $details ) { $most_active[ $details['blog_id'] ] = $details['postcount']; $blog_list[ $details['blog_id'] ] = $details; } arsort( $most_active ); reset( $most_active ); $t = array(); foreach ( (array) $most_active as $key => $details ) { $t[ $key ] = $blog_list[ $key ]; } unset( $most_active ); $most_active = $t; } if ( $display ) { if ( is_array( $most_active ) ) { reset( $most_active ); foreach ( (array) $most_active as $key => $details ) { $url = esc_url('http://' . $details['domain'] . $details['path']); echo '
        • ' . $details['postcount'] . " $url
        • "; } } } return array_slice( $most_active, 0, $num ); } function wpmu_admin_do_redirect( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' ); $ref = ''; if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_POST['ref'] ) ) { $ref = $_POST['ref']; } elseif ( isset( $_GET['ref'] ) ) { $ref = $_GET['ref']; } if ( $ref ) { $ref = wpmu_admin_redirect_add_updated_param( $ref ); wp_redirect( $ref ); exit; } if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { wp_redirect( $_SERVER['HTTP_REFERER'] ); exit; } $url = wpmu_admin_redirect_add_updated_param( $url ); if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_GET['redirect'] ) ) { if ( 's_' === substr( $_GET['redirect'], 0, 2 ) ) $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); } elseif ( isset( $_POST['redirect'] ) ) { $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); } wp_redirect( $url ); exit; } function wpmu_admin_redirect_add_updated_param( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' ); if ( strpos( $url, 'updated=true' ) === false ) { if ( strpos( $url, '?' ) === false ) return $url . '?updated=true'; else return $url . '&updated=true'; } return $url; } function get_user_id_from_string( $string ) { _deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' ); if ( is_email( $string ) ) $user = get_user_by( 'email', $string ); elseif ( is_numeric( $string ) ) return $string; else $user = get_user_by( 'login', $string ); if ( $user ) return $user->ID; return 0; } function get_blogaddress_by_domain( $domain, $path ) { _deprecated_function( __FUNCTION__, '3.7.0' ); if ( is_subdomain_install() ) { $url = "http://" . $domain.$path; } else { if ( $domain != $_SERVER['HTTP_HOST'] ) { $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; if ( 'www.' !== $blogname ) $url .= $blogname . '/'; } else { $url = 'http://' . $domain . $path; } } return esc_url_raw( $url ); } function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0' ); if ( empty($path) ) $path = '/'; if ( domain_exists($domain, $path, $site_id) ) return __( 'Error: Site URL you’ve entered is already taken.' ); if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) return __( 'Error: There was a problem creating site entry.' ); switch_to_blog($blog_id); install_blog($blog_id); restore_current_blog(); return $blog_id; } function get_admin_users_for_domain( $domain = '', $path = '' ) { _deprecated_function( __FUNCTION__, '4.4.0' ); global $wpdb; if ( ! $domain ) { $network_id = get_current_network_id(); } else { $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1, 'domain' => $domain, 'path' => $path, ) ); $network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0; } if ( $network_id ) return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A ); return false; } function wp_get_sites( $args = array() ) { _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' ); if ( wp_is_large_network() ) return array(); $defaults = array( 'network_id' => get_current_network_id(), 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'limit' => 100, 'offset' => 0, ); $args = wp_parse_args( $args, $defaults ); if( is_array( $args['network_id'] ) ){ $args['network__in'] = $args['network_id']; $args['network_id'] = null; } if( is_numeric( $args['limit'] ) ){ $args['number'] = $args['limit']; $args['limit'] = null; } elseif ( ! $args['limit'] ) { $args['number'] = 0; $args['limit'] = null; } $args['count'] = false; $_sites = get_sites( $args ); $results = array(); foreach ( $_sites as $_site ) { $_site = get_site( $_site ); $results[] = $_site->to_array(); } return $results; } function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { global $wpdb; _deprecated_function( __FUNCTION__, '4.9.0' ); $current_user = wp_get_current_user(); if ( $blog_id == 0 ) { $blog_id = get_current_blog_id(); } $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; return isset( $current_user->$local_key ); } function insert_blog($domain, $path, $site_id) { _deprecated_function( __FUNCTION__, '5.1.0', 'wp_insert_site()' ); $data = array( 'domain' => $domain, 'path' => $path, 'site_id' => $site_id, ); $site_id = wp_insert_site( $data ); if ( is_wp_error( $site_id ) ) { return false; } clean_blog_cache( $site_id ); return $site_id; } function install_blog( $blog_id, $blog_title = '' ) { global $wpdb, $wp_roles; _deprecated_function( __FUNCTION__, '5.1.0' ); $blog_id = (int) $blog_id; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $suppress = $wpdb->suppress_errors(); if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) { die( '

          ' . __( 'Already Installed' ) . '

          ' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '

          ' ); } $wpdb->suppress_errors( $suppress ); $url = get_blogaddress_by_id( $blog_id ); make_db_current_silent( 'blog' ); populate_options(); populate_roles(); $wp_roles = new WP_Roles(); $siteurl = $home = untrailingslashit( $url ); if ( ! is_subdomain_install() ) { if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) { $siteurl = set_url_scheme( $siteurl, 'https' ); } if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) { $home = set_url_scheme( $home, 'https' ); } } update_option( 'siteurl', $siteurl ); update_option( 'home', $home ); if ( get_site_option( 'ms_files_rewriting' ) ) { update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); } else { update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); } update_option( 'blogname', wp_unslash( $blog_title ) ); update_option( 'admin_email', '' ); $table_prefix = $wpdb->get_blog_prefix(); delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); } function install_blog_defaults( $blog_id, $user_id ) { global $wpdb; _deprecated_function( __FUNCTION__, 'MU' ); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $suppress = $wpdb->suppress_errors(); wp_install_defaults( $user_id ); $wpdb->suppress_errors( $suppress ); } function update_user_status( $id, $pref, $value, $deprecated = null ) { global $wpdb; _deprecated_function( __FUNCTION__, '5.3.0', 'wp_update_user()' ); if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.0.2' ); } $wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) ); $user = new WP_User( $id ); clean_user_cache( $user ); if ( 'spam' === $pref ) { if ( $value == 1 ) { do_action( 'make_spam_user', $id ); } else { do_action( 'make_ham_user', $id ); } } return $value; } wp_enqueue_scripts
          ', 'admin_enqueue_scripts', 'login_enqueue_scripts' ); if ( $handle ) { $message .= ' ' . sprintf( __( 'This notice was triggered by the %s handle.' ), '' . $handle . '' ); } _doing_it_wrong( $function, $message, '3.3.0' ); } function wp_print_scripts( $handles = false ) { global $wp_scripts; do_action( 'wp_print_scripts' ); if ( '' === $handles ) { $handles = false; } _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { if ( ! $handles ) { return array(); } } return wp_scripts()->do_items( $handles ); } function wp_add_inline_script( $handle, $data, $position = 'after' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); if ( false !== stripos( $data, '' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Do not pass %1$s tags to %2$s.' ), '<script>', 'wp_add_inline_script()' ), '4.5.0' ); $data = trim( preg_replace( '#]*>(.*)#is', '$1', $data ) ); } return wp_scripts()->add_inline_script( $handle, $data, $position ); } function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); $registered = $wp_scripts->add( $handle, $src, $deps, $ver ); if ( $in_footer ) { $wp_scripts->add_data( $handle, 'group', 1 ); } return $registered; } function wp_localize_script( $handle, $object_name, $l10n ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return false; } return $wp_scripts->localize( $handle, $object_name, $l10n ); } function wp_set_script_translations( $handle, $domain = 'default', $path = null ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return false; } return $wp_scripts->set_translations( $handle, $domain, $path ); } function wp_deregister_script( $handle ) { global $pagenow; _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $current_filter = current_filter(); if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) || ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter ) ) { $not_allowed = array( 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', 'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone', ); if ( in_array( $handle, $not_allowed, true ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), "$handle", 'wp_enqueue_scripts' ), '3.6.0' ); return; } } wp_scripts()->remove( $handle ); } function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); if ( $src || $in_footer ) { $_handle = explode( '?', $handle ); if ( $src ) { $wp_scripts->add( $_handle[0], $src, $deps, $ver ); } if ( $in_footer ) { $wp_scripts->add_data( $_handle[0], 'group', 1 ); } } $wp_scripts->enqueue( $handle ); } function wp_dequeue_script( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_scripts()->dequeue( $handle ); } function wp_script_is( $handle, $list = 'enqueued' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return (bool) wp_scripts()->query( $handle, $list ); } function wp_script_add_data( $handle, $key, $value ) { return wp_scripts()->add_data( $handle, $key, $value ); } query( $args ); } function clean_network_cache( $ids ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $network_ids = (array) $ids; wp_cache_delete_multiple( $network_ids, 'networks' ); foreach ( $network_ids as $id ) { do_action( 'clean_network_cache', $id ); } wp_cache_set( 'last_changed', microtime(), 'networks' ); } function update_network_cache( $networks ) { $data = array(); foreach ( (array) $networks as $network ) { $data[ $network->id ] = $network; } wp_cache_add_multiple( $data, 'networks' ); } function _prime_network_caches( $network_ids ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); if ( ! empty( $non_cached_ids ) ) { $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_network_cache( $fresh_networks ); } } post_type ) { $caps[] = 'do_not_allow'; break; } if ( ( get_option( 'page_for_posts' ) == $post->ID ) || ( get_option( 'page_on_front' ) == $post->ID ) ) { $caps[] = 'manage_options'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'delete_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } if ( $post->post_author && $user_id == $post->post_author ) { if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } else { $caps[] = $post_type->cap->delete_posts; } } else { $caps[] = $post_type->cap->delete_posts; } } else { $caps[] = $post_type->cap->delete_others_posts; if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->delete_private_posts; } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; case 'edit_post': case 'edit_page': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'edit_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } if ( $post->post_author && $user_id == $post->post_author ) { if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } else { $caps[] = $post_type->cap->edit_posts; } } else { $caps[] = $post_type->cap->edit_posts; } } else { $caps[] = $post_type->cap->edit_others_posts; if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->edit_private_posts; } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; case 'read_post': case 'read_page': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'read_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } $status_obj = get_post_status_object( get_post_status( $post ) ); if ( ! $status_obj ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post status %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post with that status.' ), get_post_status( $post ), $cap ), '5.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( $status_obj->public ) { $caps[] = $post_type->cap->read; break; } if ( $post->post_author && $user_id == $post->post_author ) { $caps[] = $post_type->cap->read; } elseif ( $status_obj->private ) { $caps[] = $post_type->cap->read_private_posts; } else { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } break; case 'publish_post': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } $caps[] = $post_type->cap->publish_posts; break; case 'edit_post_meta': case 'delete_post_meta': case 'add_post_meta': case 'edit_comment_meta': case 'delete_comment_meta': case 'add_comment_meta': case 'edit_term_meta': case 'delete_term_meta': case 'add_term_meta': case 'edit_user_meta': case 'delete_user_meta': case 'add_user_meta': $object_type = explode( '_', $cap )[1]; $object_id = (int) $args[0]; $object_subtype = get_object_subtype( $object_type, $object_id ); if ( empty( $object_subtype ) ) { $caps[] = 'do_not_allow'; break; } $caps = map_meta_cap( "edit_{$object_type}", $user_id, $object_id ); $meta_key = isset( $args[1] ) ? $args[1] : false; if ( $meta_key ) { $allowed = ! is_protected_meta( $meta_key, $object_type ); if ( ! empty( $object_subtype ) && has_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) { $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } else { $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } if ( ! empty( $object_subtype ) ) { $allowed = apply_filters_deprecated( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ), '4.9.8', "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ); } if ( ! $allowed ) { $caps[] = $cap; } } break; case 'edit_comment': $comment = get_comment( $args[0] ); if ( ! $comment ) { $caps[] = 'do_not_allow'; break; } $post = get_post( $comment->comment_post_ID ); if ( $post ) { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } else { $caps = map_meta_cap( 'edit_posts', $user_id ); } break; case 'unfiltered_upload': if ( defined( 'ALLOW_UNFILTERED_UPLOADS' ) && ALLOW_UNFILTERED_UPLOADS && ( ! is_multisite() || is_super_admin( $user_id ) ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'edit_css': case 'unfiltered_html': if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'unfiltered_html'; } break; case 'edit_files': case 'edit_plugins': case 'edit_themes': if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) { $caps[] = 'do_not_allow'; } elseif ( ! wp_is_file_mod_allowed( 'capability_edit_themes' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = $cap; } break; case 'update_plugins': case 'delete_plugins': case 'install_plugins': case 'upload_plugins': case 'update_themes': case 'delete_themes': case 'install_themes': case 'upload_themes': case 'update_core': if ( ! wp_is_file_mod_allowed( 'capability_update_core' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } elseif ( 'upload_themes' === $cap ) { $caps[] = 'install_themes'; } elseif ( 'upload_plugins' === $cap ) { $caps[] = 'install_plugins'; } else { $caps[] = $cap; } break; case 'install_languages': case 'update_languages': if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'install_languages'; } break; case 'activate_plugins': case 'deactivate_plugins': case 'activate_plugin': case 'deactivate_plugin': $caps[] = 'activate_plugins'; if ( is_multisite() ) { $menu_perms = get_site_option( 'menu_items', array() ); if ( empty( $menu_perms['plugins'] ) ) { $caps[] = 'manage_network_plugins'; } } break; case 'resume_plugin': $caps[] = 'resume_plugins'; break; case 'resume_theme': $caps[] = 'resume_themes'; break; case 'delete_user': case 'delete_users': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'delete_users'; } break; case 'create_users': if ( ! is_multisite() ) { $caps[] = $cap; } elseif ( is_super_admin( $user_id ) || get_site_option( 'add_new_users' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'manage_links': if ( get_option( 'link_manager_enabled' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'customize': $caps[] = 'edit_theme_options'; break; case 'delete_site': if ( is_multisite() ) { $caps[] = 'manage_options'; } else { $caps[] = 'do_not_allow'; } break; case 'edit_term': case 'delete_term': case 'assign_term': $term_id = (int) $args[0]; $term = get_term( $term_id ); if ( ! $term || is_wp_error( $term ) ) { $caps[] = 'do_not_allow'; break; } $tax = get_taxonomy( $term->taxonomy ); if ( ! $tax ) { $caps[] = 'do_not_allow'; break; } if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id || get_option( 'default_term_' . $term->taxonomy ) == $term->term_id ) ) { $caps[] = 'do_not_allow'; break; } $taxo_cap = $cap . 's'; $caps = map_meta_cap( $tax->cap->$taxo_cap, $user_id, $term_id ); break; case 'manage_post_tags': case 'edit_categories': case 'edit_post_tags': case 'delete_categories': case 'delete_post_tags': $caps[] = 'manage_categories'; break; case 'assign_categories': case 'assign_post_tags': $caps[] = 'edit_posts'; break; case 'create_sites': case 'delete_sites': case 'manage_network': case 'manage_sites': case 'manage_network_users': case 'manage_network_plugins': case 'manage_network_themes': case 'manage_network_options': case 'upgrade_network': $caps[] = $cap; break; case 'setup_network': if ( is_multisite() ) { $caps[] = 'manage_network_options'; } else { $caps[] = 'manage_options'; } break; case 'update_php': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'update_core'; } break; case 'update_https': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'manage_options'; $caps[] = 'update_core'; } break; case 'export_others_personal_data': case 'erase_others_personal_data': case 'manage_privacy_options': $caps[] = is_multisite() ? 'manage_network' : 'manage_options'; break; case 'create_app_password': case 'list_app_passwords': case 'read_app_password': case 'edit_app_password': case 'delete_app_passwords': case 'delete_app_password': $caps = map_meta_cap( 'edit_user', $user_id, $args[0] ); break; default: global $post_type_meta_caps; if ( isset( $post_type_meta_caps[ $cap ] ) ) { return map_meta_cap( $post_type_meta_caps[ $cap ], $user_id, ...$args ); } $block_caps = array( 'edit_blocks', 'edit_others_blocks', 'publish_blocks', 'read_private_blocks', 'delete_blocks', 'delete_private_blocks', 'delete_published_blocks', 'delete_others_blocks', 'edit_private_blocks', 'edit_published_blocks', ); if ( in_array( $cap, $block_caps, true ) ) { $cap = str_replace( '_blocks', '_posts', $cap ); } $caps[] = $cap; } return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args ); } function current_user_can( $capability, ...$args ) { return user_can( wp_get_current_user(), $capability, ...$args ); } function current_user_can_for_blog( $blog_id, $capability, ...$args ) { $switched = is_multisite() ? switch_to_blog( $blog_id ) : false; $can = current_user_can( $capability, ...$args ); if ( $switched ) { restore_current_blog(); } return $can; } function author_can( $post, $capability, ...$args ) { $post = get_post( $post ); if ( ! $post ) { return false; } $author = get_userdata( $post->post_author ); if ( ! $author ) { return false; } return $author->has_cap( $capability, ...$args ); } function user_can( $user, $capability, ...$args ) { if ( ! is_object( $user ) ) { $user = get_userdata( $user ); } if ( empty( $user ) ) { $user = new WP_User( 0 ); $user->init( new stdClass ); } return $user->has_cap( $capability, ...$args ); } function wp_roles() { global $wp_roles; if ( ! isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); } return $wp_roles; } function get_role( $role ) { return wp_roles()->get_role( $role ); } function add_role( $role, $display_name, $capabilities = array() ) { if ( empty( $role ) ) { return; } return wp_roles()->add_role( $role, $display_name, $capabilities ); } function remove_role( $role ) { wp_roles()->remove_role( $role ); } function get_super_admins() { global $super_admins; if ( isset( $super_admins ) ) { return $super_admins; } else { return get_site_option( 'site_admins', array( 'admin' ) ); } } function is_super_admin( $user_id = false ) { if ( ! $user_id ) { $user = wp_get_current_user(); } else { $user = get_userdata( $user_id ); } if ( ! $user || ! $user->exists() ) { return false; } if ( is_multisite() ) { $super_admins = get_super_admins(); if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins, true ) ) { return true; } } else { if ( $user->has_cap( 'delete_users' ) ) { return true; } } return false; } function grant_super_admin( $user_id ) { if ( isset( $GLOBALS['super_admins'] ) || ! is_multisite() ) { return false; } do_action( 'grant_super_admin', $user_id ); $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); $user = get_userdata( $user_id ); if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) { $super_admins[] = $user->user_login; update_site_option( 'site_admins', $super_admins ); do_action( 'granted_super_admin', $user_id ); return true; } return false; } function revoke_super_admin( $user_id ) { if ( isset( $GLOBALS['super_admins'] ) || ! is_multisite() ) { return false; } do_action( 'revoke_super_admin', $user_id ); $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); $user = get_userdata( $user_id ); if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) { $key = array_search( $user->user_login, $super_admins, true ); if ( false !== $key ) { unset( $super_admins[ $key ] ); update_site_option( 'site_admins', $super_admins ); do_action( 'revoked_super_admin', $user_id ); return true; } } return false; } function wp_maybe_grant_install_languages_cap( $allcaps ) { if ( ! empty( $allcaps['update_core'] ) || ! empty( $allcaps['install_plugins'] ) || ! empty( $allcaps['install_themes'] ) ) { $allcaps['install_languages'] = true; } return $allcaps; } function wp_maybe_grant_resume_extensions_caps( $allcaps ) { if ( ! empty( $allcaps['activate_plugins'] ) ) { $allcaps['resume_plugins'] = true; } if ( ! empty( $allcaps['switch_themes'] ) ) { $allcaps['resume_themes'] = true; } return $allcaps; } function wp_maybe_grant_site_health_caps( $allcaps, $caps, $args, $user ) { if ( ! empty( $allcaps['install_plugins'] ) && ( ! is_multisite() || is_super_admin( $user->ID ) ) ) { $allcaps['view_site_health_checks'] = true; } return $allcaps; } return; _x( 'Administrator', 'User role' ); _x( 'Editor', 'User role' ); _x( 'Author', 'User role' ); _x( 'Contributor', 'User role' ); _x( 'Subscriber', 'User role' ); '; do_action( 'rss_tag_pre', 'rss2-comments' ); ?> + -.privacy_requests .column-type { - text-align: center; -} - -.privacy_requests thead td:first-child, -.privacy_requests tfoot td:first-child { - border-right: 4px solid #fff; -} - -.privacy_requests tbody th { - border-right: 4px solid #fff; - background: #fff; - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1); -} - -.privacy_requests .row-actions { - color: #787c82; -} - -.privacy_requests .row-actions.processing { - position: static; -} - -.privacy_requests tbody .has-request-results th { - box-shadow: none; -} - -.privacy_requests tbody .request-results th .notice { - margin: 0 0 5px; -} - -.privacy_requests tbody td { - background: #fff; - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1); -} - -.privacy_requests tbody .has-request-results td { - box-shadow: none; -} - -.privacy_requests .next_steps .button { - word-wrap: break-word; - white-space: normal; -} - -.privacy_requests .status-request-confirmed th, -.privacy_requests .status-request-confirmed td { - background-color: #fff; - border-right-color: #72aee6; -} - -.privacy_requests .status-request-failed th, -.privacy_requests .status-request-failed td { - background-color: #f6f7f7; - border-right-color: #d63638; -} - -.privacy_requests .export_personal_data_failed a { - vertical-align: baseline; -} - -.status-label { - font-weight: 600; -} - -.status-label.status-request-pending { - font-weight: 400; - font-style: italic; - color: #646970; -} - -.status-label.status-request-failed { - color: #d63638; - font-weight: 600; -} - -.wp-privacy-request-form { - clear: both; -} - -.wp-privacy-request-form-field { - margin: 1.5em 0; -} - -.wp-privacy-request-form input { - margin: 0; -} - -.email-personal-data::before { - display: inline-block; - font: normal 20px/1 dashicons; - margin: 3px -2px 0 5px; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - vertical-align: top; -} - -.email-personal-data--sending::before { - color: #d63638; - content: "\f463"; - animation: rotation 2s infinite linear; -} - -.email-personal-data--sent::before { - color: #68de7c; - content: "\f147"; -} - - -/* =Media Queries --------------------------------------------------------------- */ + +> + + + <?php + if ( is_singular() ) { printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() ); } elseif ( is_search() ) { printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); } else { printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); } ?> + + + + + + + + + + + + comment_post_ID ); $GLOBALS['post'] = $comment_post; ?> + + + <?php + if ( ! is_singular() ) { $title = get_the_title( $comment_post->ID ); $title = apply_filters( 'the_title_rss', $title ); printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); } else { printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); } ?> + + -@media screen and (max-width: 782px) { - /* Input Elements */ - textarea { - -webkit-appearance: none; - } + ]]> + + - input[type="text"], - input[type="password"], - input[type="date"], - input[type="datetime"], - input[type="datetime-local"], - input[type="email"], - input[type="month"], - input[type="number"], - input[type="search"], - input[type="tel"], - input[type="time"], - input[type="url"], - input[type="week"] { - -webkit-appearance: none; - padding: 3px 10px; - /* Only necessary for IE11 */ - min-height: 40px; - } + + + ]]> + + ]]> + ]]> + - ::-webkit-datetime-edit { - line-height: 1.875; /* 30px */ - } + comment_ID, $comment_post->ID ); ?> + + + + +use_trailing_slashes ) { $string = trailingslashit( $string ); } else { $string = untrailingslashit( $string ); } return apply_filters( 'user_trailingslashit', $string, $type_of_url ); } function permalink_anchor( $mode = 'id' ) { $post = get_post(); switch ( strtolower( $mode ) ) { case 'title': $title = sanitize_title( $post->post_title ) . '-' . $post->ID; echo ''; break; case 'id': default: echo ''; break; } } function wp_force_plain_post_permalink( $post = null, $sample = null ) { if ( null === $sample && is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) { $sample = true; } else { $post = get_post( $post ); $sample = null !== $sample ? $sample : false; } if ( ! $post ) { return true; } $post_status_obj = get_post_status_object( get_post_status( $post ) ); $post_type_obj = get_post_type_object( get_post_type( $post ) ); if ( ! $post_status_obj || ! $post_type_obj ) { return true; } if ( is_post_status_viewable( $post_status_obj ) || ( $post_status_obj->private && current_user_can( 'read_post', $post->ID ) ) || ( $post_status_obj->protected && $sample ) ) { return false; } return true; } function get_the_permalink( $post = 0, $leavename = false ) { return get_permalink( $post, $leavename ); } function get_permalink( $post = 0, $leavename = false ) { $rewritecode = array( '%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', $leavename ? '' : '%postname%', '%post_id%', '%category%', '%author%', $leavename ? '' : '%pagename%', ); if ( is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) { $sample = true; } else { $post = get_post( $post ); $sample = false; } if ( empty( $post->ID ) ) { return false; } if ( 'page' === $post->post_type ) { return get_page_link( $post, $leavename, $sample ); } elseif ( 'attachment' === $post->post_type ) { return get_attachment_link( $post, $leavename ); } elseif ( in_array( $post->post_type, get_post_types( array( '_builtin' => false ) ), true ) ) { return get_post_permalink( $post, $leavename, $sample ); } $permalink = get_option( 'permalink_structure' ); $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); if ( $permalink && ! wp_force_plain_post_permalink( $post ) ) { $category = ''; if ( strpos( $permalink, '%category%' ) !== false ) { $cats = get_the_category( $post->ID ); if ( $cats ) { $cats = wp_list_sort( $cats, array( 'term_id' => 'ASC', ) ); $category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post ); $category_object = get_term( $category_object, 'category' ); $category = $category_object->slug; if ( $category_object->parent ) { $category = get_category_parents( $category_object->parent, false, '/', true ) . $category; } } if ( empty( $category ) ) { $default_category = get_term( get_option( 'default_category' ), 'category' ); if ( $default_category && ! is_wp_error( $default_category ) ) { $category = $default_category->slug; } } } $author = ''; if ( strpos( $permalink, '%author%' ) !== false ) { $authordata = get_userdata( $post->post_author ); $author = $authordata->user_nicename; } $date = explode( ' ', str_replace( array( '-', ':' ), ' ', $post->post_date ) ); $rewritereplace = array( $date[0], $date[1], $date[2], $date[3], $date[4], $date[5], $post->post_name, $post->ID, $category, $author, $post->post_name, ); $permalink = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) ); $permalink = user_trailingslashit( $permalink, 'single' ); } else { $permalink = home_url( '?p=' . $post->ID ); } return apply_filters( 'post_link', $permalink, $post, $leavename ); } function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { global $wp_rewrite; $post = get_post( $id ); if ( is_wp_error( $post ) ) { return $post; } $post_link = $wp_rewrite->get_extra_permastruct( $post->post_type ); $slug = $post->post_name; $force_plain_link = wp_force_plain_post_permalink( $post ); $post_type = get_post_type_object( $post->post_type ); if ( $post_type->hierarchical ) { $slug = get_page_uri( $post ); } if ( ! empty( $post_link ) && ( ! $force_plain_link || $sample ) ) { if ( ! $leavename ) { $post_link = str_replace( "%$post->post_type%", $slug, $post_link ); } $post_link = home_url( user_trailingslashit( $post_link ) ); } else { if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_plain_link ) ) { $post_link = add_query_arg( $post_type->query_var, $slug, '' ); } else { $post_link = add_query_arg( array( 'post_type' => $post->post_type, 'p' => $post->ID, ), '' ); } $post_link = home_url( $post_link ); } return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample ); } function get_page_link( $post = false, $leavename = false, $sample = false ) { $post = get_post( $post ); if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { $link = home_url( '/' ); } else { $link = _get_page_link( $post, $leavename, $sample ); } return apply_filters( 'page_link', $link, $post->ID, $sample ); } function _get_page_link( $post = false, $leavename = false, $sample = false ) { global $wp_rewrite; $post = get_post( $post ); $force_plain_link = wp_force_plain_post_permalink( $post ); $link = $wp_rewrite->get_page_permastruct(); if ( ! empty( $link ) && ( ( isset( $post->post_status ) && ! $force_plain_link ) || $sample ) ) { if ( ! $leavename ) { $link = str_replace( '%pagename%', get_page_uri( $post ), $link ); } $link = home_url( $link ); $link = user_trailingslashit( $link, 'page' ); } else { $link = home_url( '?page_id=' . $post->ID ); } return apply_filters( '_get_page_link', $link, $post->ID ); } function get_attachment_link( $post = null, $leavename = false ) { global $wp_rewrite; $link = false; $post = get_post( $post ); $force_plain_link = wp_force_plain_post_permalink( $post ); $parent_id = $post->post_parent; $parent = $parent_id ? get_post( $parent_id ) : false; $parent_valid = true; if ( $parent_id && ( $post->post_parent === $post->ID || ! $parent || ! is_post_type_viewable( get_post_type( $parent ) ) ) ) { $parent_valid = false; } if ( $force_plain_link || ! $parent_valid ) { $link = false; } elseif ( $wp_rewrite->using_permalinks() && $parent ) { if ( 'page' === $parent->post_type ) { $parentlink = _get_page_link( $post->post_parent ); } else { $parentlink = get_permalink( $post->post_parent ); } if ( is_numeric( $post->post_name ) || false !== strpos( get_option( 'permalink_structure' ), '%category%' ) ) { $name = 'attachment/' . $post->post_name; } else { $name = $post->post_name; } if ( strpos( $parentlink, '?' ) === false ) { $link = user_trailingslashit( trailingslashit( $parentlink ) . '%postname%' ); } if ( ! $leavename ) { $link = str_replace( '%postname%', $name, $link ); } } elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) { $link = home_url( user_trailingslashit( $post->post_name ) ); } if ( ! $link ) { $link = home_url( '/?attachment_id=' . $post->ID ); } return apply_filters( 'attachment_link', $link, $post->ID ); } function get_year_link( $year ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } $yearlink = $wp_rewrite->get_year_permastruct(); if ( ! empty( $yearlink ) ) { $yearlink = str_replace( '%year%', $year, $yearlink ); $yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) ); } else { $yearlink = home_url( '?m=' . $year ); } return apply_filters( 'year_link', $yearlink, $year ); } function get_month_link( $year, $month ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } if ( ! $month ) { $month = current_time( 'm' ); } $monthlink = $wp_rewrite->get_month_permastruct(); if ( ! empty( $monthlink ) ) { $monthlink = str_replace( '%year%', $year, $monthlink ); $monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink ); $monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) ); } else { $monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) ); } return apply_filters( 'month_link', $monthlink, $year, $month ); } function get_day_link( $year, $month, $day ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } if ( ! $month ) { $month = current_time( 'm' ); } if ( ! $day ) { $day = current_time( 'j' ); } $daylink = $wp_rewrite->get_day_permastruct(); if ( ! empty( $daylink ) ) { $daylink = str_replace( '%year%', $year, $daylink ); $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink ); $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink ); $daylink = home_url( user_trailingslashit( $daylink, 'day' ) ); } else { $daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) ); } return apply_filters( 'day_link', $daylink, $year, $month, $day ); } function the_feed_link( $anchor, $feed = '' ) { $link = '' . $anchor . ''; echo apply_filters( 'the_feed_link', $link, $feed ); } function get_feed_link( $feed = '' ) { global $wp_rewrite; $permalink = $wp_rewrite->get_feed_permastruct(); if ( $permalink ) { if ( false !== strpos( $feed, 'comments_' ) ) { $feed = str_replace( 'comments_', '', $feed ); $permalink = $wp_rewrite->get_comment_feed_permastruct(); } if ( get_default_feed() == $feed ) { $feed = ''; } $permalink = str_replace( '%feed%', $feed, $permalink ); $permalink = preg_replace( '#/+#', '/', "/$permalink" ); $output = home_url( user_trailingslashit( $permalink, 'feed' ) ); } else { if ( empty( $feed ) ) { $feed = get_default_feed(); } if ( false !== strpos( $feed, 'comments_' ) ) { $feed = str_replace( 'comments_', 'comments-', $feed ); } $output = home_url( "?feed={$feed}" ); } return apply_filters( 'feed_link', $output, $feed ); } function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } if ( empty( $feed ) ) { $feed = get_default_feed(); } $post = get_post( $post_id ); if ( ! $post instanceof WP_Post ) { return ''; } $unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent; if ( get_option( 'permalink_structure' ) ) { if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) { $url = _get_page_link( $post_id ); } else { $url = get_permalink( $post_id ); } if ( $unattached ) { $url = home_url( '/feed/' ); if ( get_default_feed() !== $feed ) { $url .= "$feed/"; } $url = add_query_arg( 'attachment_id', $post_id, $url ); } else { $url = trailingslashit( $url ) . 'feed'; if ( get_default_feed() != $feed ) { $url .= "/$feed"; } $url = user_trailingslashit( $url, 'single_feed' ); } } else { if ( $unattached ) { $url = add_query_arg( array( 'feed' => $feed, 'attachment_id' => $post_id, ), home_url( '/' ) ); } elseif ( 'page' === $post->post_type ) { $url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id, ), home_url( '/' ) ); } else { $url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id, ), home_url( '/' ) ); } } return apply_filters( 'post_comments_feed_link', $url ); } function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { $url = get_post_comments_feed_link( $post_id, $feed ); if ( empty( $link_text ) ) { $link_text = __( 'Comments Feed' ); } $link = '' . $link_text . ''; echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed ); } function get_author_feed_link( $author_id, $feed = '' ) { $author_id = (int) $author_id; $permalink_structure = get_option( 'permalink_structure' ); if ( empty( $feed ) ) { $feed = get_default_feed(); } if ( ! $permalink_structure ) { $link = home_url( "?feed=$feed&author=" . $author_id ); } else { $link = get_author_posts_url( $author_id ); if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; } $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); } $link = apply_filters( 'author_feed_link', $link, $feed ); return $link; } function get_category_feed_link( $cat, $feed = '' ) { return get_term_feed_link( $cat, 'category', $feed ); } function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) { if ( ! is_object( $term ) ) { $term = (int) $term; } $term = get_term( $term, $taxonomy ); if ( empty( $term ) || is_wp_error( $term ) ) { return false; } $taxonomy = $term->taxonomy; if ( empty( $feed ) ) { $feed = get_default_feed(); } $permalink_structure = get_option( 'permalink_structure' ); if ( ! $permalink_structure ) { if ( 'category' === $taxonomy ) { $link = home_url( "?feed=$feed&cat=$term->term_id" ); } elseif ( 'post_tag' === $taxonomy ) { $link = home_url( "?feed=$feed&tag=$term->slug" ); } else { $t = get_taxonomy( $taxonomy ); $link = home_url( "?feed=$feed&$t->query_var=$term->slug" ); } } else { $link = get_term_link( $term, $term->taxonomy ); if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; } $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); } if ( 'category' === $taxonomy ) { $link = apply_filters( 'category_feed_link', $link, $feed ); } elseif ( 'post_tag' === $taxonomy ) { $link = apply_filters( 'tag_feed_link', $link, $feed ); } else { $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy ); } return $link; } function get_tag_feed_link( $tag, $feed = '' ) { return get_term_feed_link( $tag, 'post_tag', $feed ); } function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) { return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) ); } function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { $link = edit_term_link( $link, '', '', $tag, false ); echo $before . apply_filters( 'edit_tag_link', $link ) . $after; } function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { $term = get_term( $term, $taxonomy ); if ( ! $term || is_wp_error( $term ) ) { return; } $tax = get_taxonomy( $term->taxonomy ); $term_id = $term->term_id; if ( ! $tax || ! current_user_can( 'edit_term', $term_id ) ) { return; } $args = array( 'taxonomy' => $taxonomy, 'tag_ID' => $term_id, ); if ( $object_type ) { $args['post_type'] = $object_type; } elseif ( ! empty( $tax->object_type ) ) { $args['post_type'] = reset( $tax->object_type ); } if ( $tax->show_ui ) { $location = add_query_arg( $args, admin_url( 'term.php' ) ); } else { $location = ''; } return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type ); } function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) { if ( is_null( $term ) ) { $term = get_queried_object(); } else { $term = get_term( $term ); } if ( ! $term ) { return; } $tax = get_taxonomy( $term->taxonomy ); if ( ! current_user_can( 'edit_term', $term->term_id ) ) { return; } if ( empty( $link ) ) { $link = __( 'Edit This' ); } $link = '' . $link . ''; $link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after; if ( $echo ) { echo $link; } else { return $link; } } function get_search_link( $query = '' ) { global $wp_rewrite; if ( empty( $query ) ) { $search = get_search_query( false ); } else { $search = stripslashes( $query ); } $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = home_url( '?s=' . urlencode( $search ) ); } else { $search = urlencode( $search ); $search = str_replace( '%2F', '/', $search ); $link = str_replace( '%search%', $search, $permastruct ); $link = home_url( user_trailingslashit( $link, 'search' ) ); } return apply_filters( 'search_link', $link, $search ); } function get_search_feed_link( $search_query = '', $feed = '' ) { global $wp_rewrite; $link = get_search_link( $search_query ); if ( empty( $feed ) ) { $feed = get_default_feed(); } $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = add_query_arg( 'feed', $feed, $link ); } else { $link = trailingslashit( $link ); $link .= "feed/$feed/"; } return apply_filters( 'search_feed_link', $link, $feed, 'posts' ); } function get_search_comments_feed_link( $search_query = '', $feed = '' ) { global $wp_rewrite; if ( empty( $feed ) ) { $feed = get_default_feed(); } $link = get_search_feed_link( $search_query, $feed ); $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = add_query_arg( 'feed', 'comments-' . $feed, $link ); } else { $link = add_query_arg( 'withcomments', 1, $link ); } return apply_filters( 'search_feed_link', $link, $feed, 'comments' ); } function get_post_type_archive_link( $post_type ) { global $wp_rewrite; $post_type_obj = get_post_type_object( $post_type ); if ( ! $post_type_obj ) { return false; } if ( 'post' === $post_type ) { $show_on_front = get_option( 'show_on_front' ); $page_for_posts = get_option( 'page_for_posts' ); if ( 'page' === $show_on_front && $page_for_posts ) { $link = get_permalink( $page_for_posts ); } else { $link = get_home_url(); } return apply_filters( 'post_type_archive_link', $link, $post_type ); } if ( ! $post_type_obj->has_archive ) { return false; } if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) { $struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive; if ( $post_type_obj->rewrite['with_front'] ) { $struct = $wp_rewrite->front . $struct; } else { $struct = $wp_rewrite->root . $struct; } $link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) ); } else { $link = home_url( '?post_type=' . $post_type ); } return apply_filters( 'post_type_archive_link', $link, $post_type ); } function get_post_type_archive_feed_link( $post_type, $feed = '' ) { $default_feed = get_default_feed(); if ( empty( $feed ) ) { $feed = $default_feed; } $link = get_post_type_archive_link( $post_type ); if ( ! $link ) { return false; } $post_type_obj = get_post_type_object( $post_type ); if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) { $link = trailingslashit( $link ); $link .= 'feed/'; if ( $feed != $default_feed ) { $link .= "$feed/"; } } else { $link = add_query_arg( 'feed', $feed, $link ); } return apply_filters( 'post_type_archive_feed_link', $link, $feed ); } function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) { $post = get_post( $post ); if ( ! $post ) { return; } $post_type_object = get_post_type_object( $post->post_type ); if ( is_post_type_viewable( $post_type_object ) ) { if ( ! $preview_link ) { $preview_link = set_url_scheme( get_permalink( $post ) ); } $query_args['preview'] = 'true'; $preview_link = add_query_arg( $query_args, $preview_link ); } return apply_filters( 'preview_post_link', $preview_link, $post ); } function get_edit_post_link( $id = 0, $context = 'display' ) { $post = get_post( $id ); if ( ! $post ) { return; } if ( 'revision' === $post->post_type ) { $action = ''; } elseif ( 'display' === $context ) { $action = '&action=edit'; } else { $action = '&action=edit'; } $post_type_object = get_post_type_object( $post->post_type ); if ( ! $post_type_object ) { return; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } if ( $post_type_object->_edit_link ) { $link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ); } else { $link = ''; } return apply_filters( 'get_edit_post_link', $link, $post->ID, $context ); } function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) { $post = get_post( $id ); if ( ! $post ) { return; } $url = get_edit_post_link( $post->ID ); if ( ! $url ) { return; } if ( null === $text ) { $text = __( 'Edit This' ); } $link = '' . $text . ''; echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after; } function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } $post = get_post( $id ); if ( ! $post ) { return; } $post_type_object = get_post_type_object( $post->post_type ); if ( ! $post_type_object ) { return; } if ( ! current_user_can( 'delete_post', $post->ID ) ) { return; } $action = ( $force_delete || ! EMPTY_TRASH_DAYS ) ? 'delete' : 'trash'; $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) ); return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete ); } function get_edit_comment_link( $comment_id = 0 ) { $comment = get_comment( $comment_id ); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; } $location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID; return apply_filters( 'get_edit_comment_link', $location ); } function edit_comment_link( $text = null, $before = '', $after = '' ) { $comment = get_comment(); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; } if ( null === $text ) { $text = __( 'Edit This' ); } $link = '' . $text . ''; echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after; } function get_edit_bookmark_link( $link = 0 ) { $link = get_bookmark( $link ); if ( ! current_user_can( 'manage_links' ) ) { return; } $location = admin_url( 'link.php?action=edit&link_id=' ) . $link->link_id; return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id ); } function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) { $bookmark = get_bookmark( $bookmark ); if ( ! current_user_can( 'manage_links' ) ) { return; } if ( empty( $link ) ) { $link = __( 'Edit This' ); } $link = '' . $link . ''; echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after; } function get_edit_user_link( $user_id = null ) { if ( ! $user_id ) { $user_id = get_current_user_id(); } if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) { return ''; } $user = get_userdata( $user_id ); if ( ! $user ) { return ''; } if ( get_current_user_id() == $user->ID ) { $link = get_edit_profile_url( $user->ID ); } else { $link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) ); } return apply_filters( 'get_edit_user_link', $link, $user->ID ); } function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy ); } function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy ); } function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { global $wpdb; $post = get_post(); if ( ! $post || ! taxonomy_exists( $taxonomy ) ) { return null; } $current_post_date = $post->post_date; $join = ''; $where = ''; $adjacent = $previous ? 'previous' : 'next'; if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) { if ( false !== strpos( $excluded_terms, ' and ' ) ) { _deprecated_argument( __FUNCTION__, '3.3.0', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) ); $excluded_terms = explode( ' and ', $excluded_terms ); } else { $excluded_terms = explode( ',', $excluded_terms ); } $excluded_terms = array_map( 'intval', $excluded_terms ); } $excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms ); if ( $in_same_term || ! empty( $excluded_terms ) ) { if ( $in_same_term ) { $join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $where .= $wpdb->prepare( 'AND tt.taxonomy = %s', $taxonomy ); if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { return ''; } $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); $term_array = array_diff( $term_array, (array) $excluded_terms ); $term_array = array_map( 'intval', $term_array ); if ( ! $term_array || is_wp_error( $term_array ) ) { return ''; } $where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')'; } if ( ! empty( $excluded_terms ) ) { $where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )'; } } if ( is_user_logged_in() ) { $user_id = get_current_user_id(); $post_type_object = get_post_type_object( $post->post_type ); if ( empty( $post_type_object ) ) { $post_type_cap = $post->post_type; $read_private_cap = 'read_private_' . $post_type_cap . 's'; } else { $read_private_cap = $post_type_object->cap->read_private_posts; } $private_states = get_post_stati( array( 'private' => true ) ); $where .= " AND ( p.post_status = 'publish'"; foreach ( $private_states as $state ) { if ( current_user_can( $read_private_cap ) ) { $where .= $wpdb->prepare( ' OR p.post_status = %s', $state ); } else { $where .= $wpdb->prepare( ' OR (p.post_author = %d AND p.post_status = %s)', $user_id, $state ); } } $where .= ' )'; } else { $where .= " AND p.post_status = 'publish'"; } $op = $previous ? '<' : '>'; $order = $previous ? 'DESC' : 'ASC'; $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post ); $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post ); $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order ); $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; $query_key = 'adjacent_post_' . md5( $query ); $result = wp_cache_get( $query_key, 'counts' ); if ( false !== $result ) { if ( $result ) { $result = get_post( $result ); } return $result; } $result = $wpdb->get_var( $query ); if ( null === $result ) { $result = ''; } wp_cache_set( $query_key, $result, 'counts' ); if ( $result ) { $result = get_post( $result ); } return $result; } function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { $post = get_post(); if ( $previous && is_attachment() && $post ) { $post = get_post( $post->post_parent ); } else { $post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( empty( $post ) ) { return; } $post_title = the_title_attribute( array( 'echo' => false, 'post' => $post, ) ); if ( empty( $post_title ) ) { $post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); } $date = mysql2date( get_option( 'date_format' ), $post->post_date ); $title = str_replace( '%title', $post_title, $title ); $title = str_replace( '%date', $date, $title ); $link = $previous ? "\n"; $adjacent = $previous ? 'previous' : 'next'; return apply_filters( "{$adjacent}_post_rel_link", $link ); } function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy ); echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy ); } function adjacent_posts_rel_link_wp_head() { if ( ! is_single() || is_attachment() ) { return; } adjacent_posts_rel_link(); } function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy ); } function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy ); } function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) { $post = get_post(); if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) { return null; } $query_args = array( 'posts_per_page' => 1, 'order' => $start ? 'ASC' : 'DESC', 'update_post_term_cache' => false, 'update_post_meta_cache' => false, ); $term_array = array(); if ( ! is_array( $excluded_terms ) ) { if ( ! empty( $excluded_terms ) ) { $excluded_terms = explode( ',', $excluded_terms ); } else { $excluded_terms = array(); } } if ( $in_same_term || ! empty( $excluded_terms ) ) { if ( $in_same_term ) { $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); } if ( ! empty( $excluded_terms ) ) { $excluded_terms = array_map( 'intval', $excluded_terms ); $excluded_terms = array_diff( $excluded_terms, $term_array ); $inverse_terms = array(); foreach ( $excluded_terms as $excluded_term ) { $inverse_terms[] = $excluded_term * -1; } $excluded_terms = $inverse_terms; } $query_args['tax_query'] = array( array( 'taxonomy' => $taxonomy, 'terms' => array_merge( $term_array, $excluded_terms ), ), ); } return get_posts( $query_args ); } function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy ); } function previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); } function get_next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy ); } function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); } function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { if ( $previous && is_attachment() ) { $post = get_post( get_post()->post_parent ); } else { $post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( ! $post ) { $output = ''; } else { $title = $post->post_title; if ( empty( $post->post_title ) ) { $title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); } $title = apply_filters( 'the_title', $title, $post->ID ); $date = mysql2date( get_option( 'date_format' ), $post->post_date ); $rel = $previous ? 'prev' : 'next'; $string = ''; $inlink = str_replace( '%title', $title, $link ); $inlink = str_replace( '%date', $date, $inlink ); $inlink = $string . $inlink . ''; $output = str_replace( '%link', $inlink, $format ); } $adjacent = $previous ? 'previous' : 'next'; return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent ); } function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy ); } function get_pagenum_link( $pagenum = 1, $escape = true ) { global $wp_rewrite; $pagenum = (int) $pagenum; $request = remove_query_arg( 'paged' ); $home_root = parse_url( home_url() ); $home_root = ( isset( $home_root['path'] ) ) ? $home_root['path'] : ''; $home_root = preg_quote( $home_root, '|' ); $request = preg_replace( '|^' . $home_root . '|i', '', $request ); $request = preg_replace( '|^/+|', '', $request ); if ( ! $wp_rewrite->using_permalinks() || is_admin() ) { $base = trailingslashit( get_bloginfo( 'url' ) ); if ( $pagenum > 1 ) { $result = add_query_arg( 'paged', $pagenum, $base . $request ); } else { $result = $base . $request; } } else { $qs_regex = '|\?.*?$|'; preg_match( $qs_regex, $request, $qs_match ); if ( ! empty( $qs_match[0] ) ) { $query_string = $qs_match[0]; $request = preg_replace( $qs_regex, '', $request ); } else { $query_string = ''; } $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request ); $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request ); $request = ltrim( $request, '/' ); $base = trailingslashit( get_bloginfo( 'url' ) ); if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) { $base .= $wp_rewrite->index . '/'; } if ( $pagenum > 1 ) { $request = ( ( ! empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $pagenum, 'paged' ); } $result = $base . $request . $query_string; } $result = apply_filters( 'get_pagenum_link', $result, $pagenum ); if ( $escape ) { return esc_url( $result ); } else { return esc_url_raw( $result ); } } function get_next_posts_page_link( $max_page = 0 ) { global $paged; if ( ! is_single() ) { if ( ! $paged ) { $paged = 1; } $nextpage = (int) $paged + 1; if ( ! $max_page || $max_page >= $nextpage ) { return get_pagenum_link( $nextpage ); } } } function next_posts( $max_page = 0, $echo = true ) { $output = esc_url( get_next_posts_page_link( $max_page ) ); if ( $echo ) { echo $output; } else { return $output; } } function get_next_posts_link( $label = null, $max_page = 0 ) { global $paged, $wp_query; if ( ! $max_page ) { $max_page = $wp_query->max_num_pages; } if ( ! $paged ) { $paged = 1; } $nextpage = (int) $paged + 1; if ( null === $label ) { $label = __( 'Next Page »' ); } if ( ! is_single() && ( $nextpage <= $max_page ) ) { $attr = apply_filters( 'next_posts_link_attributes', '' ); return '" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } } function next_posts_link( $label = null, $max_page = 0 ) { echo get_next_posts_link( $label, $max_page ); } function get_previous_posts_page_link() { global $paged; if ( ! is_single() ) { $nextpage = (int) $paged - 1; if ( $nextpage < 1 ) { $nextpage = 1; } return get_pagenum_link( $nextpage ); } } function previous_posts( $echo = true ) { $output = esc_url( get_previous_posts_page_link() ); if ( $echo ) { echo $output; } else { return $output; } } function get_previous_posts_link( $label = null ) { global $paged; if ( null === $label ) { $label = __( '« Previous Page' ); } if ( ! is_single() && $paged > 1 ) { $attr = apply_filters( 'previous_posts_link_attributes', '' ); return '" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } } function previous_posts_link( $label = null ) { echo get_previous_posts_link( $label ); } function get_posts_nav_link( $args = array() ) { global $wp_query; $return = ''; if ( ! is_singular() ) { $defaults = array( 'sep' => ' — ', 'prelabel' => __( '« Previous Page' ), 'nxtlabel' => __( 'Next Page »' ), ); $args = wp_parse_args( $args, $defaults ); $max_num_pages = $wp_query->max_num_pages; $paged = get_query_var( 'paged' ); if ( $paged < 2 || $paged >= $max_num_pages ) { $args['sep'] = ''; } if ( $max_num_pages > 1 ) { $return = get_previous_posts_link( $args['prelabel'] ); $return .= preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $args['sep'] ); $return .= get_next_posts_link( $args['nxtlabel'] ); } } return $return; } function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) { $args = array_filter( compact( 'sep', 'prelabel', 'nxtlabel' ) ); echo get_posts_nav_link( $args ); } function get_the_post_navigation( $args = array() ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => '%title', 'next_text' => '%title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __( 'Post navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'post-navigation', ) ); $navigation = ''; $previous = get_previous_post_link( '', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); $next = get_next_post_link( '', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); if ( $previous || $next ) { $navigation = _navigation_markup( $previous . $next, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_post_navigation( $args = array() ) { echo get_the_post_navigation( $args ); } function get_the_posts_navigation( $args = array() ) { $navigation = ''; if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => __( 'Older posts' ), 'next_text' => __( 'Newer posts' ), 'screen_reader_text' => __( 'Posts navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'posts-navigation', ) ); $next_link = get_previous_posts_link( $args['next_text'] ); $prev_link = get_next_posts_link( $args['prev_text'] ); if ( $prev_link ) { $navigation .= ''; } if ( $next_link ) { $navigation .= ''; } $navigation = _navigation_markup( $navigation, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_posts_navigation( $args = array() ) { echo get_the_posts_navigation( $args ); } function get_the_posts_pagination( $args = array() ) { $navigation = ''; if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'mid_size' => 1, 'prev_text' => _x( 'Previous', 'previous set of posts' ), 'next_text' => _x( 'Next', 'next set of posts' ), 'screen_reader_text' => __( 'Posts navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'pagination', ) ); if ( isset( $args['type'] ) && 'array' === $args['type'] ) { $args['type'] = 'plain'; } $links = paginate_links( $args ); if ( $links ) { $navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } } return $navigation; } function the_posts_pagination( $args = array() ) { echo get_the_posts_pagination( $args ); } function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '', $aria_label = '' ) { if ( empty( $screen_reader_text ) ) { $screen_reader_text = __( 'Posts navigation' ); } if ( empty( $aria_label ) ) { $aria_label = $screen_reader_text; } $template = ' + '; $template = apply_filters( 'navigation_markup_template', $template, $class ); return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links, esc_html( $aria_label ) ); } function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { global $wp_rewrite; $pagenum = (int) $pagenum; $result = get_permalink(); if ( 'newest' === get_option( 'default_comments_page' ) ) { if ( $pagenum != $max_page ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } } elseif ( $pagenum > 1 ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } $result .= '#comments'; return apply_filters( 'get_comments_pagenum_link', $result ); } function get_next_comments_link( $label = '', $max_page = 0 ) { global $wp_query; if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( ! $page ) { $page = 1; } $nextpage = (int) $page + 1; if ( empty( $max_page ) ) { $max_page = $wp_query->max_num_comment_pages; } if ( empty( $max_page ) ) { $max_page = get_comment_pages_count(); } if ( $nextpage > $max_page ) { return; } if ( empty( $label ) ) { $label = __( 'Newer Comments »' ); } return '' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } function next_comments_link( $label = '', $max_page = 0 ) { echo get_next_comments_link( $label, $max_page ); } function get_previous_comments_link( $label = '' ) { if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( (int) $page <= 1 ) { return; } $prevpage = (int) $page - 1; if ( empty( $label ) ) { $label = __( '« Older Comments' ); } return '' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } function previous_comments_link( $label = '' ) { echo get_previous_comments_link( $label ); } function paginate_comments_links( $args = array() ) { global $wp_rewrite; if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( ! $page ) { $page = 1; } $max_page = get_comment_pages_count(); $defaults = array( 'base' => add_query_arg( 'cpage', '%#%' ), 'format' => '', 'total' => $max_page, 'current' => $page, 'echo' => true, 'type' => 'plain', 'add_fragment' => '#comments', ); if ( $wp_rewrite->using_permalinks() ) { $defaults['base'] = user_trailingslashit( trailingslashit( get_permalink() ) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged' ); } $args = wp_parse_args( $args, $defaults ); $page_links = paginate_links( $args ); if ( $args['echo'] && 'array' !== $args['type'] ) { echo $page_links; } else { return $page_links; } } function get_the_comments_navigation( $args = array() ) { $navigation = ''; if ( get_comment_pages_count() > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => __( 'Older comments' ), 'next_text' => __( 'Newer comments' ), 'screen_reader_text' => __( 'Comments navigation' ), 'aria_label' => __( 'Comments' ), 'class' => 'comment-navigation', ) ); $prev_link = get_previous_comments_link( $args['prev_text'] ); $next_link = get_next_comments_link( $args['next_text'] ); if ( $prev_link ) { $navigation .= ''; } if ( $next_link ) { $navigation .= ''; } $navigation = _navigation_markup( $navigation, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_comments_navigation( $args = array() ) { echo get_the_comments_navigation( $args ); } function get_the_comments_pagination( $args = array() ) { $navigation = ''; if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'screen_reader_text' => __( 'Comments navigation' ), 'aria_label' => __( 'Comments' ), 'class' => 'comments-pagination', ) ); $args['echo'] = false; if ( isset( $args['type'] ) && 'array' === $args['type'] ) { $args['type'] = 'plain'; } $links = paginate_comments_links( $args ); if ( $links ) { $navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_comments_pagination( $args = array() ) { echo get_the_comments_pagination( $args ); } function home_url( $path = '', $scheme = null ) { return get_home_url( null, $path, $scheme ); } function get_home_url( $blog_id = null, $path = '', $scheme = null ) { $orig_scheme = $scheme; if ( empty( $blog_id ) || ! is_multisite() ) { $url = get_option( 'home' ); } else { switch_to_blog( $blog_id ); $url = get_option( 'home' ); restore_current_blog(); } if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) { if ( is_ssl() ) { $scheme = 'https'; } else { $scheme = parse_url( $url, PHP_URL_SCHEME ); } } $url = set_url_scheme( $url, $scheme ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); } function site_url( $path = '', $scheme = null ) { return get_site_url( null, $path, $scheme ); } function get_site_url( $blog_id = null, $path = '', $scheme = null ) { if ( empty( $blog_id ) || ! is_multisite() ) { $url = get_option( 'siteurl' ); } else { switch_to_blog( $blog_id ); $url = get_option( 'siteurl' ); restore_current_blog(); } $url = set_url_scheme( $url, $scheme ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'site_url', $url, $path, $scheme, $blog_id ); } function admin_url( $path = '', $scheme = 'admin' ) { return get_admin_url( null, $path, $scheme ); } function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) { $url = get_site_url( $blog_id, 'wp-admin/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'admin_url', $url, $path, $blog_id, $scheme ); } function includes_url( $path = '', $scheme = null ) { $url = site_url( '/' . WPINC . '/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'includes_url', $url, $path, $scheme ); } function content_url( $path = '' ) { $url = set_url_scheme( WP_CONTENT_URL ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'content_url', $url, $path ); } function plugins_url( $path = '', $plugin = '' ) { $path = wp_normalize_path( $path ); $plugin = wp_normalize_path( $plugin ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); if ( ! empty( $plugin ) && 0 === strpos( $plugin, $mu_plugin_dir ) ) { $url = WPMU_PLUGIN_URL; } else { $url = WP_PLUGIN_URL; } $url = set_url_scheme( $url ); if ( ! empty( $plugin ) && is_string( $plugin ) ) { $folder = dirname( plugin_basename( $plugin ) ); if ( '.' !== $folder ) { $url .= '/' . ltrim( $folder, '/' ); } } if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'plugins_url', $url, $path, $plugin ); } function network_site_url( $path = '', $scheme = null ) { if ( ! is_multisite() ) { return site_url( $path, $scheme ); } $current_network = get_network(); if ( 'relative' === $scheme ) { $url = $current_network->path; } else { $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme ); } if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_site_url', $url, $path, $scheme ); } function network_home_url( $path = '', $scheme = null ) { if ( ! is_multisite() ) { return home_url( $path, $scheme ); } $current_network = get_network(); $orig_scheme = $scheme; if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) { $scheme = is_ssl() ? 'https' : 'http'; } if ( 'relative' === $scheme ) { $url = $current_network->path; } else { $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme ); } if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_home_url', $url, $path, $orig_scheme ); } function network_admin_url( $path = '', $scheme = 'admin' ) { if ( ! is_multisite() ) { return admin_url( $path, $scheme ); } $url = network_site_url( 'wp-admin/network/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_admin_url', $url, $path, $scheme ); } function user_admin_url( $path = '', $scheme = 'admin' ) { $url = network_site_url( 'wp-admin/user/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'user_admin_url', $url, $path, $scheme ); } function self_admin_url( $path = '', $scheme = 'admin' ) { if ( is_network_admin() ) { $url = network_admin_url( $path, $scheme ); } elseif ( is_user_admin() ) { $url = user_admin_url( $path, $scheme ); } else { $url = admin_url( $path, $scheme ); } return apply_filters( 'self_admin_url', $url, $path, $scheme ); } function set_url_scheme( $url, $scheme = null ) { $orig_scheme = $scheme; if ( ! $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; } elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) { $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http'; } elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; } $url = trim( $url ); if ( substr( $url, 0, 2 ) === '//' ) { $url = 'http:' . $url; } if ( 'relative' === $scheme ) { $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) ); if ( '' !== $url && '/' === $url[0] ) { $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" ); } } else { $url = preg_replace( '#^\w+://#', $scheme . '://', $url ); } return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme ); } function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) { $user_id = $user_id ? (int) $user_id : get_current_user_id(); $blogs = get_blogs_of_user( $user_id ); if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs ) ) { $url = user_admin_url( $path, $scheme ); } elseif ( ! is_multisite() ) { $url = admin_url( $path, $scheme ); } else { $current_blog = get_current_blog_id(); if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ), true ) ) ) { $url = admin_url( $path, $scheme ); } else { $active = get_active_blog_for_user( $user_id ); if ( $active ) { $url = get_admin_url( $active->blog_id, $path, $scheme ); } else { $url = user_admin_url( $path, $scheme ); } } } return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme ); } function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) { $user_id = $user_id ? (int) $user_id : get_current_user_id(); if ( is_user_admin() ) { $url = user_admin_url( 'profile.php', $scheme ); } elseif ( is_network_admin() ) { $url = network_admin_url( 'profile.php', $scheme ); } else { $url = get_dashboard_url( $user_id, 'profile.php', $scheme ); } return apply_filters( 'edit_profile_url', $url, $user_id, $scheme ); } function wp_get_canonical_url( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } if ( 'publish' !== $post->post_status ) { return false; } $canonical_url = get_permalink( $post ); if ( get_queried_object_id() === $post->ID ) { $page = get_query_var( 'page', 0 ); if ( $page >= 2 ) { if ( ! get_option( 'permalink_structure' ) ) { $canonical_url = add_query_arg( 'page', $page, $canonical_url ); } else { $canonical_url = trailingslashit( $canonical_url ) . user_trailingslashit( $page, 'single_paged' ); } } $cpage = get_query_var( 'cpage', 0 ); if ( $cpage ) { $canonical_url = get_comments_pagenum_link( $cpage ); } } return apply_filters( 'get_canonical_url', $canonical_url, $post ); } function rel_canonical() { if ( ! is_singular() ) { return; } $id = get_queried_object_id(); if ( 0 === $id ) { return; } $url = wp_get_canonical_url( $id ); if ( ! empty( $url ) ) { echo '' . "\n"; } } function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { $shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs ); if ( false !== $shortlink ) { return $shortlink; } $post_id = 0; if ( 'query' === $context && is_singular() ) { $post_id = get_queried_object_id(); $post = get_post( $post_id ); } elseif ( 'post' === $context ) { $post = get_post( $id ); if ( ! empty( $post->ID ) ) { $post_id = $post->ID; } } $shortlink = ''; if ( ! empty( $post_id ) ) { $post_type = get_post_type_object( $post->post_type ); if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { $shortlink = home_url( '/' ); } elseif ( $post_type && $post_type->public ) { $shortlink = home_url( '?p=' . $post_id ); } } return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs ); } function wp_shortlink_wp_head() { $shortlink = wp_get_shortlink( 0, 'query' ); if ( empty( $shortlink ) ) { return; } echo "\n"; } function wp_shortlink_header() { if ( headers_sent() ) { return; } $shortlink = wp_get_shortlink( 0, 'query' ); if ( empty( $shortlink ) ) { return; } header( 'Link: <' . $shortlink . '>; rel=shortlink', false ); } function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) { $post = get_post(); if ( empty( $text ) ) { $text = __( 'This is the short link.' ); } if ( empty( $title ) ) { $title = the_title_attribute( array( 'echo' => false ) ); } $shortlink = wp_get_shortlink( $post->ID ); if ( ! empty( $shortlink ) ) { $link = '' . $text . ''; $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title ); echo $before, $link, $after; } } function get_avatar_url( $id_or_email, $args = null ) { $args = get_avatar_data( $id_or_email, $args ); return $args['url']; } function is_avatar_comment_type( $comment_type ) { $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); return in_array( $comment_type, (array) $allowed_comment_types, true ); } function get_avatar_data( $id_or_email, $args = null ) { $args = wp_parse_args( $args, array( 'size' => 96, 'height' => null, 'width' => null, 'default' => get_option( 'avatar_default', 'mystery' ), 'force_default' => false, 'rating' => get_option( 'avatar_rating' ), 'scheme' => null, 'processed_args' => null, 'extra_attr' => '', ) ); if ( is_numeric( $args['size'] ) ) { $args['size'] = absint( $args['size'] ); if ( ! $args['size'] ) { $args['size'] = 96; } } else { $args['size'] = 96; } if ( is_numeric( $args['height'] ) ) { $args['height'] = absint( $args['height'] ); if ( ! $args['height'] ) { $args['height'] = $args['size']; } } else { $args['height'] = $args['size']; } if ( is_numeric( $args['width'] ) ) { $args['width'] = absint( $args['width'] ); if ( ! $args['width'] ) { $args['width'] = $args['size']; } } else { $args['width'] = $args['size']; } if ( empty( $args['default'] ) ) { $args['default'] = get_option( 'avatar_default', 'mystery' ); } switch ( $args['default'] ) { case 'mm': case 'mystery': case 'mysteryman': $args['default'] = 'mm'; break; case 'gravatar_default': $args['default'] = false; break; } $args['force_default'] = (bool) $args['force_default']; $args['rating'] = strtolower( $args['rating'] ); $args['found_avatar'] = false; $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); if ( isset( $args['url'] ) ) { return apply_filters( 'get_avatar_data', $args, $id_or_email ); } $email_hash = ''; $user = false; $email = false; if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { $id_or_email = get_comment( $id_or_email ); } if ( is_numeric( $id_or_email ) ) { $user = get_user_by( 'id', absint( $id_or_email ) ); } elseif ( is_string( $id_or_email ) ) { if ( strpos( $id_or_email, '@md5.gravatar.com' ) ) { list( $email_hash ) = explode( '@', $id_or_email ); } else { $email = $id_or_email; } } elseif ( $id_or_email instanceof WP_User ) { $user = $id_or_email; } elseif ( $id_or_email instanceof WP_Post ) { $user = get_user_by( 'id', (int) $id_or_email->post_author ); } elseif ( $id_or_email instanceof WP_Comment ) { if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { $args['url'] = false; return apply_filters( 'get_avatar_data', $args, $id_or_email ); } if ( ! empty( $id_or_email->user_id ) ) { $user = get_user_by( 'id', (int) $id_or_email->user_id ); } if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { $email = $id_or_email->comment_author_email; } } if ( ! $email_hash ) { if ( $user ) { $email = $user->user_email; } if ( $email ) { $email_hash = md5( strtolower( trim( $email ) ) ); } } if ( $email_hash ) { $args['found_avatar'] = true; $gravatar_server = hexdec( $email_hash[0] ) % 3; } else { $gravatar_server = rand( 0, 2 ); } $url_args = array( 's' => $args['size'], 'd' => $args['default'], 'f' => $args['force_default'] ? 'y' : false, 'r' => $args['rating'], ); if ( is_ssl() ) { $url = 'https://secure.gravatar.com/avatar/' . $email_hash; } else { $url = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash ); } $url = add_query_arg( rawurlencode_deep( array_filter( $url_args ) ), set_url_scheme( $url, $args['scheme'] ) ); $args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args ); return apply_filters( 'get_avatar_data', $args, $id_or_email ); } function get_theme_file_uri( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $url = get_stylesheet_directory_uri(); } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $url = get_stylesheet_directory_uri() . '/' . $file; } else { $url = get_template_directory_uri() . '/' . $file; } return apply_filters( 'theme_file_uri', $url, $file ); } function get_parent_theme_file_uri( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $url = get_template_directory_uri(); } else { $url = get_template_directory_uri() . '/' . $file; } return apply_filters( 'parent_theme_file_uri', $url, $file ); } function get_theme_file_path( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $path = get_stylesheet_directory(); } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $path = get_stylesheet_directory() . '/' . $file; } else { $path = get_template_directory() . '/' . $file; } return apply_filters( 'theme_file_path', $path, $file ); } function get_parent_theme_file_path( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $path = get_template_directory(); } else { $path = get_template_directory() . '/' . $file; } return apply_filters( 'parent_theme_file_path', $path, $file ); } function get_privacy_policy_url() { $url = ''; $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { $url = (string) get_permalink( $policy_page_id ); } return apply_filters( 'privacy_policy_url', $url, $policy_page_id ); } function the_privacy_policy_link( $before = '', $after = '' ) { echo get_the_privacy_policy_link( $before, $after ); } function get_the_privacy_policy_link( $before = '', $after = '' ) { $link = ''; $privacy_policy_url = get_privacy_policy_url(); $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); $page_title = ( $policy_page_id ) ? get_the_title( $policy_page_id ) : ''; if ( $privacy_policy_url && $page_title ) { $link = sprintf( '%s', esc_url( $privacy_policy_url ), esc_html( $page_title ) ); } $link = apply_filters( 'the_privacy_policy_link', $link, $privacy_policy_url ); if ( $link ) { return $before . $link . $after; } return ''; } registered_block_styles[ $block_name ] ) ) { $this->registered_block_styles[ $block_name ] = array(); } $this->registered_block_styles[ $block_name ][ $block_style_name ] = $style_properties; return true; } public function unregister( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ), '5.3.0' ); return false; } unset( $this->registered_block_styles[ $block_name ][ $block_style_name ] ); return true; } public function get_registered( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { return null; } return $this->registered_block_styles[ $block_name ][ $block_style_name ]; } public function get_all_registered() { return $this->registered_block_styles; } public function get_registered_styles_for_block( $block_name ) { if ( isset( $this->registered_block_styles[ $block_name ] ) ) { return $this->registered_block_styles[ $block_name ]; } return array(); } public function is_registered( $block_name, $block_style_name ) { return isset( $this->registered_block_styles[ $block_name ][ $block_style_name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } _subject = $subject; $this->_matches = $matches; $this->output = $this->_map(); } public static function apply( $subject, $matches ) { $oSelf = new WP_MatchesMapRegex( $subject, $matches ); return $oSelf->output; } private function _map() { $callback = array( $this, 'callback' ); return preg_replace_callback( $this->_pattern, $callback, $this->_subject ); } public function callback( $matches ) { $index = (int) substr( $matches[0], 9, -1 ); return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); } } errors ); return; } $support_errors = new WP_Error(); $response = wp_remote_request( home_url( '/', 'https' ), array( 'headers' => array( 'Cache-Control' => 'no-cache', ), 'sslverify' => true, ) ); if ( is_wp_error( $response ) ) { $unverified_response = wp_remote_request( home_url( '/', 'https' ), array( 'headers' => array( 'Cache-Control' => 'no-cache', ), 'sslverify' => false, ) ); if ( is_wp_error( $unverified_response ) ) { $support_errors->add( 'https_request_failed', __( 'HTTPS request failed.' ) ); } else { $support_errors->add( 'ssl_verification_failed', __( 'SSL verification failed.' ) ); } $response = $unverified_response; } if ( ! is_wp_error( $response ) ) { if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { $support_errors->add( 'bad_response_code', wp_remote_retrieve_response_message( $response ) ); } elseif ( false === wp_is_local_html_output( wp_remote_retrieve_body( $response ) ) ) { $support_errors->add( 'bad_response_source', __( 'It looks like the response did not come from this site.' ) ); } } update_option( 'https_detection_errors', $support_errors->errors ); } function wp_schedule_https_detection() { if ( wp_installing() ) { return; } if ( ! wp_next_scheduled( 'wp_https_detection' ) ) { wp_schedule_event( time(), 'twicedaily', 'wp_https_detection' ); } } function wp_cron_conditionally_prevent_sslverify( $request ) { if ( 'https' === wp_parse_url( $request['url'], PHP_URL_SCHEME ) ) { $request['args']['sslverify'] = false; } return $request; } function wp_is_local_html_output( $html ) { if ( has_action( 'wp_head', 'rsd_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); return false !== strpos( $html, $pattern ); } if ( has_action( 'wp_head', 'wlwmanifest_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', includes_url( 'wlwmanifest.xml' ) ); return false !== strpos( $html, $pattern ); } if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); return false !== strpos( $html, $pattern ); } return null; } deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { return WP_CONTENT_DIR . '/blog-deleted.php'; } else { wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) ); } } if ( '2' == $blog->deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) { return WP_CONTENT_DIR . '/blog-inactive.php'; } else { $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) ); wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ), sprintf( '%1$s', $admin_email ) ) ); } } if ( '1' == $blog->archived || '1' == $blog->spam ) { if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { return WP_CONTENT_DIR . '/blog-suspended.php'; } else { wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) ); } } return true; } function get_network_by_path( $domain, $path, $segments = null ) { return WP_Network::get_by_path( $domain, $path, $segments ); } function get_site_by_path( $domain, $path, $segments = null ) { $path_segments = array_filter( explode( '/', trim( $path, '/' ) ) ); $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path ); if ( null !== $segments && count( $path_segments ) > $segments ) { $path_segments = array_slice( $path_segments, 0, $segments ); } $paths = array(); while ( count( $path_segments ) ) { $paths[] = '/' . implode( '/', $path_segments ) . '/'; array_pop( $path_segments ); } $paths[] = '/'; $pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths ); if ( null !== $pre ) { if ( false !== $pre && ! $pre instanceof WP_Site ) { $pre = new WP_Site( $pre ); } return $pre; } $domains = array( $domain ); if ( 'www.' === substr( $domain, 0, 4 ) ) { $domains[] = substr( $domain, 4 ); } $args = array( 'number' => 1, 'update_site_meta_cache' => false, ); if ( count( $domains ) > 1 ) { $args['domain__in'] = $domains; $args['orderby']['domain_length'] = 'DESC'; } else { $args['domain'] = array_shift( $domains ); } if ( count( $paths ) > 1 ) { $args['path__in'] = $paths; $args['orderby']['path_length'] = 'DESC'; } else { $args['path'] = array_shift( $paths ); } $result = get_sites( $args ); $site = array_shift( $result ); if ( $site ) { return $site; } return false; } function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) { global $current_site, $current_blog; if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { $current_site = new stdClass; $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; $current_site->domain = DOMAIN_CURRENT_SITE; $current_site->path = PATH_CURRENT_SITE; if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) { $current_site->blog_id = BLOG_ID_CURRENT_SITE; } elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { $current_site->blog_id = BLOGID_CURRENT_SITE; } if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) { $current_blog = get_site_by_path( $domain, $path ); } elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) { $current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) ); } else { $current_blog = get_site_by_path( $domain, $path, 1 ); } } elseif ( ! $subdomain ) { $current_site = wp_cache_get( 'current_network', 'site-options' ); if ( ! $current_site ) { $networks = get_networks( array( 'number' => 2 ) ); if ( count( $networks ) === 1 ) { $current_site = array_shift( $networks ); wp_cache_add( 'current_network', $current_site, 'site-options' ); } elseif ( empty( $networks ) ) { return false; } } if ( empty( $current_site ) ) { $current_site = WP_Network::get_by_path( $domain, $path, 1 ); } if ( empty( $current_site ) ) { do_action( 'ms_network_not_found', $domain, $path ); return false; } elseif ( $path === $current_site->path ) { $current_blog = get_site_by_path( $domain, $path ); } else { $current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) ); } } else { $current_blog = get_site_by_path( $domain, $path, 1 ); if ( $current_blog ) { $current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 ); } else { $current_site = WP_Network::get_by_path( $domain, $path, 1 ); } } if ( $current_blog && $current_blog->site_id != $current_site->id ) { $current_site = WP_Network::get_instance( $current_blog->site_id ); } if ( empty( $current_site ) ) { do_action( 'ms_network_not_found', $domain, $path ); return false; } if ( empty( $current_blog ) && wp_installing() ) { $current_blog = new stdClass; $current_blog->blog_id = 1; $blog_id = 1; $current_blog->public = 1; } if ( empty( $current_blog ) ) { $scheme = is_ssl() ? 'https' : 'http'; $destination = "$scheme://{$current_site->domain}{$current_site->path}"; do_action( 'ms_site_not_found', $current_site, $domain, $path ); if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) { $destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); } elseif ( $subdomain ) { if ( '%siteurl%' !== NOBLOGREDIRECT ) { $destination = NOBLOGREDIRECT; } } elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) { return false; } return $destination; } if ( empty( $current_site->blog_id ) ) { $current_site->blog_id = get_main_site_id( $current_site->id ); } return true; } function ms_not_installed( $domain, $path ) { global $wpdb; if ( ! is_admin() ) { dead_db(); } wp_load_translations_early(); $title = __( 'Error establishing a database connection' ); $msg = '

          ' . $title . '

          '; $msg .= '

          ' . __( 'If your site does not display, please contact the owner of this network.' ) . ''; $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '

          '; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); if ( ! $wpdb->get_var( $query ) ) { $msg .= '

          ' . sprintf( __( 'Database tables are missing. This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ), '' . $wpdb->site . '' ) . '

          '; } else { $msg .= '

          ' . sprintf( __( 'Could not find site %1$s. Searched for table %2$s in database %3$s. Is that right?' ), '' . rtrim( $domain . $path, '/' ) . '', '' . $wpdb->blogs . '', '' . DB_NAME . '' ) . '

          '; } $msg .= '

          ' . __( 'What do I do now?' ) . ' '; $msg .= sprintf( __( 'Read the Debugging a WordPress Network article. Some of the suggestions there may help you figure out what went wrong.' ), __( 'https://wordpress.org/support/article/debugging-a-wordpress-network/' ) ); $msg .= ' ' . __( 'If you are still stuck with this message, then check that your database contains the following tables:' ) . '

            '; foreach ( $wpdb->tables( 'global' ) as $t => $table ) { if ( 'sitecategories' === $t ) { continue; } $msg .= '
          • ' . $table . '
          • '; } $msg .= '
          '; wp_die( $msg, $title, array( 'response' => 500 ) ); } function get_current_site_name( $current_site ) { _deprecated_function( __FUNCTION__, '3.9.0', 'get_current_site()' ); return $current_site; } function wpmu_current_site() { global $current_site; _deprecated_function( __FUNCTION__, '3.9.0' ); return $current_site; } function wp_get_network( $network ) { _deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' ); $network = get_network( $network ); if ( null === $network ) { return false; } return $network; } relation = 'OR'; } else { $this->relation = 'AND'; } $this->queries = $this->sanitize_query( $meta_query ); } public function sanitize_query( $queries ) { $clean_queries = array(); if ( ! is_array( $queries ) ) { return $clean_queries; } foreach ( $queries as $key => $query ) { if ( 'relation' === $key ) { $relation = $query; } elseif ( ! is_array( $query ) ) { continue; } elseif ( $this->is_first_order_clause( $query ) ) { if ( isset( $query['value'] ) && array() === $query['value'] ) { unset( $query['value'] ); } $clean_queries[ $key ] = $query; } else { $cleaned_query = $this->sanitize_query( $query ); if ( ! empty( $cleaned_query ) ) { $clean_queries[ $key ] = $cleaned_query; } } } if ( empty( $clean_queries ) ) { return $clean_queries; } if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) { $clean_queries['relation'] = 'OR'; $this->has_or_relation = true; } elseif ( 1 === count( $clean_queries ) ) { $clean_queries['relation'] = 'OR'; } else { $clean_queries['relation'] = 'AND'; } return $clean_queries; } protected function is_first_order_clause( $query ) { return isset( $query['key'] ) || isset( $query['value'] ); } public function parse_query_vars( $qv ) { $meta_query = array(); $primary_meta_query = array(); foreach ( array( 'key', 'compare', 'type', 'compare_key', 'type_key' ) as $key ) { if ( ! empty( $qv[ "meta_$key" ] ) ) { $primary_meta_query[ $key ] = $qv[ "meta_$key" ]; } } if ( isset( $qv['meta_value'] ) && '' !== $qv['meta_value'] && ( ! is_array( $qv['meta_value'] ) || $qv['meta_value'] ) ) { $primary_meta_query['value'] = $qv['meta_value']; } $existing_meta_query = isset( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ? $qv['meta_query'] : array(); if ( ! empty( $primary_meta_query ) && ! empty( $existing_meta_query ) ) { $meta_query = array( 'relation' => 'AND', $primary_meta_query, $existing_meta_query, ); } elseif ( ! empty( $primary_meta_query ) ) { $meta_query = array( $primary_meta_query, ); } elseif ( ! empty( $existing_meta_query ) ) { $meta_query = $existing_meta_query; } $this->__construct( $meta_query ); } public function get_cast_for_type( $type = '' ) { if ( empty( $type ) ) { return 'CHAR'; } $meta_type = strtoupper( $type ); if ( ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) ) { return 'CHAR'; } if ( 'NUMERIC' === $meta_type ) { $meta_type = 'SIGNED'; } return $meta_type; } public function get_sql( $type, $primary_table, $primary_id_column, $context = null ) { $meta_table = _get_meta_table( $type ); if ( ! $meta_table ) { return false; } $this->table_aliases = array(); $this->meta_table = $meta_table; $this->meta_id_column = sanitize_key( $type . '_id' ); $this->primary_table = $primary_table; $this->primary_id_column = $primary_id_column; $sql = $this->get_sql_clauses(); if ( false !== strpos( $sql['join'], 'LEFT JOIN' ) ) { $sql['join'] = str_replace( 'INNER JOIN', 'LEFT JOIN', $sql['join'] ); } return apply_filters_ref_array( 'get_meta_sql', array( $sql, $this->queries, $type, $primary_table, $primary_id_column, $context ) ); } protected function get_sql_clauses() { $queries = $this->queries; $sql = $this->get_sql_for_query( $queries ); if ( ! empty( $sql['where'] ) ) { $sql['where'] = ' AND ' . $sql['where']; } return $sql; } protected function get_sql_for_query( &$query, $depth = 0 ) { $sql_chunks = array( 'join' => array(), 'where' => array(), ); $sql = array( 'join' => '', 'where' => '', ); $indent = ''; for ( $i = 0; $i < $depth; $i++ ) { $indent .= ' '; } foreach ( $query as $key => &$clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; } elseif ( is_array( $clause ) ) { if ( $this->is_first_order_clause( $clause ) ) { $clause_sql = $this->get_sql_for_clause( $clause, $query, $key ); $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; } $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); } else { $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); $sql_chunks['where'][] = $clause_sql['where']; $sql_chunks['join'][] = $clause_sql['join']; } } } $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); if ( empty( $relation ) ) { $relation = 'AND'; } if ( ! empty( $sql_chunks['join'] ) ) { $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); } if ( ! empty( $sql_chunks['where'] ) ) { $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; } return $sql; } public function get_sql_for_clause( &$clause, $parent_query, $clause_key = '' ) { global $wpdb; $sql_chunks = array( 'where' => array(), 'join' => array(), ); if ( isset( $clause['compare'] ) ) { $clause['compare'] = strtoupper( $clause['compare'] ); } else { $clause['compare'] = isset( $clause['value'] ) && is_array( $clause['value'] ) ? 'IN' : '='; } $non_numeric_operators = array( '=', '!=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'EXISTS', 'NOT EXISTS', 'RLIKE', 'REGEXP', 'NOT REGEXP', ); $numeric_operators = array( '>', '>=', '<', '<=', 'BETWEEN', 'NOT BETWEEN', ); if ( ! in_array( $clause['compare'], $non_numeric_operators, true ) && ! in_array( $clause['compare'], $numeric_operators, true ) ) { $clause['compare'] = '='; } if ( isset( $clause['compare_key'] ) ) { $clause['compare_key'] = strtoupper( $clause['compare_key'] ); } else { $clause['compare_key'] = isset( $clause['key'] ) && is_array( $clause['key'] ) ? 'IN' : '='; } if ( ! in_array( $clause['compare_key'], $non_numeric_operators, true ) ) { $clause['compare_key'] = '='; } $meta_compare = $clause['compare']; $meta_compare_key = $clause['compare_key']; $join = ''; $alias = $this->find_compatible_table_alias( $clause, $parent_query ); if ( false === $alias ) { $i = count( $this->table_aliases ); $alias = $i ? 'mt' . $i : $this->meta_table; if ( 'NOT EXISTS' === $meta_compare ) { $join .= " LEFT JOIN $this->meta_table"; $join .= $i ? " AS $alias" : ''; if ( 'LIKE' === $meta_compare_key ) { $join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key LIKE %s )", '%' . $wpdb->esc_like( $clause['key'] ) . '%' ); } else { $join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] ); } } else { $join .= " INNER JOIN $this->meta_table"; $join .= $i ? " AS $alias" : ''; $join .= " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column )"; } $this->table_aliases[] = $alias; $sql_chunks['join'][] = $join; } $clause['alias'] = $alias; $_meta_type = isset( $clause['type'] ) ? $clause['type'] : ''; $meta_type = $this->get_cast_for_type( $_meta_type ); $clause['cast'] = $meta_type; if ( is_int( $clause_key ) || ! $clause_key ) { $clause_key = $clause['alias']; } $iterator = 1; $clause_key_base = $clause_key; while ( isset( $this->clauses[ $clause_key ] ) ) { $clause_key = $clause_key_base . '-' . $iterator; $iterator++; } $this->clauses[ $clause_key ] =& $clause; if ( array_key_exists( 'key', $clause ) ) { if ( 'NOT EXISTS' === $meta_compare ) { $sql_chunks['where'][] = $alias . '.' . $this->meta_id_column . ' IS NULL'; } else { if ( in_array( $meta_compare_key, array( '!=', 'NOT IN', 'NOT LIKE', 'NOT EXISTS', 'NOT REGEXP' ), true ) ) { $i = count( $this->table_aliases ); $subquery_alias = $i ? 'mt' . $i : $this->meta_table; $this->table_aliases[] = $subquery_alias; $meta_compare_string_start = 'NOT EXISTS ('; $meta_compare_string_start .= "SELECT 1 FROM $wpdb->postmeta $subquery_alias "; $meta_compare_string_start .= "WHERE $subquery_alias.post_ID = $alias.post_ID "; $meta_compare_string_end = 'LIMIT 1'; $meta_compare_string_end .= ')'; } switch ( $meta_compare_key ) { case '=': case 'EXISTS': $where = $wpdb->prepare( "$alias.meta_key = %s", trim( $clause['key'] ) ); break; case 'LIKE': $meta_compare_value = '%' . $wpdb->esc_like( trim( $clause['key'] ) ) . '%'; $where = $wpdb->prepare( "$alias.meta_key LIKE %s", $meta_compare_value ); break; case 'IN': $meta_compare_string = "$alias.meta_key IN (" . substr( str_repeat( ',%s', count( $clause['key'] ) ), 1 ) . ')'; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'RLIKE': case 'REGEXP': $operator = $meta_compare_key; if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { $cast = 'BINARY'; } else { $cast = ''; } $where = $wpdb->prepare( "$alias.meta_key $operator $cast %s", trim( $clause['key'] ) ); break; case '!=': case 'NOT EXISTS': $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key = %s " . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'NOT LIKE': $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key LIKE %s " . $meta_compare_string_end; $meta_compare_value = '%' . $wpdb->esc_like( trim( $clause['key'] ) ) . '%'; $where = $wpdb->prepare( $meta_compare_string, $meta_compare_value ); break; case 'NOT IN': $array_subclause = '(' . substr( str_repeat( ',%s', count( $clause['key'] ) ), 1 ) . ') '; $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key IN " . $array_subclause . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'NOT REGEXP': $operator = $meta_compare_key; if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { $cast = 'BINARY'; } else { $cast = ''; } $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key REGEXP $cast %s " . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; } $sql_chunks['where'][] = $where; } } if ( array_key_exists( 'value', $clause ) ) { $meta_value = $clause['value']; if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { if ( ! is_array( $meta_value ) ) { $meta_value = preg_split( '/[,\s]+/', $meta_value ); } } elseif ( is_string( $meta_value ) ) { $meta_value = trim( $meta_value ); } switch ( $meta_compare ) { case 'IN': case 'NOT IN': $meta_compare_string = '(' . substr( str_repeat( ',%s', count( $meta_value ) ), 1 ) . ')'; $where = $wpdb->prepare( $meta_compare_string, $meta_value ); break; case 'BETWEEN': case 'NOT BETWEEN': $where = $wpdb->prepare( '%s AND %s', $meta_value[0], $meta_value[1] ); break; case 'LIKE': case 'NOT LIKE': $meta_value = '%' . $wpdb->esc_like( $meta_value ) . '%'; $where = $wpdb->prepare( '%s', $meta_value ); break; case 'EXISTS': $meta_compare = '='; $where = $wpdb->prepare( '%s', $meta_value ); break; case 'NOT EXISTS': $where = ''; break; default: $where = $wpdb->prepare( '%s', $meta_value ); break; } if ( $where ) { if ( 'CHAR' === $meta_type ) { $sql_chunks['where'][] = "$alias.meta_value {$meta_compare} {$where}"; } else { $sql_chunks['where'][] = "CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$where}"; } } } if ( 1 < count( $sql_chunks['where'] ) ) { $sql_chunks['where'] = array( '( ' . implode( ' AND ', $sql_chunks['where'] ) . ' )' ); } return $sql_chunks; } public function get_clauses() { return $this->clauses; } protected function find_compatible_table_alias( $clause, $parent_query ) { $alias = false; foreach ( $parent_query as $sibling ) { if ( empty( $sibling['alias'] ) ) { continue; } if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) { continue; } $compatible_compares = array(); if ( 'OR' === $parent_query['relation'] ) { $compatible_compares = array( '=', 'IN', 'BETWEEN', 'LIKE', 'REGEXP', 'RLIKE', '>', '>=', '<', '<=' ); } elseif ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) { $compatible_compares = array( '!=', 'NOT IN', 'NOT LIKE' ); } $clause_compare = strtoupper( $clause['compare'] ); $sibling_compare = strtoupper( $sibling['compare'] ); if ( in_array( $clause_compare, $compatible_compares, true ) && in_array( $sibling_compare, $compatible_compares, true ) ) { $alias = preg_replace( '/\W/', '_', $sibling['alias'] ); break; } } return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this ); } public function has_or_relation() { return $this->has_or_relation; } } parsed_block = $block; $this->name = $block['blockName']; if ( is_null( $registry ) ) { $registry = WP_Block_Type_Registry::get_instance(); } $this->registry = $registry; $this->block_type = $registry->get_registered( $this->name ); $this->available_context = $available_context; if ( ! empty( $this->block_type->uses_context ) ) { foreach ( $this->block_type->uses_context as $context_name ) { if ( array_key_exists( $context_name, $this->available_context ) ) { $this->context[ $context_name ] = $this->available_context[ $context_name ]; } } } if ( ! empty( $block['innerBlocks'] ) ) { $child_context = $this->available_context; if ( ! empty( $this->block_type->provides_context ) ) { foreach ( $this->block_type->provides_context as $context_name => $attribute_name ) { if ( array_key_exists( $attribute_name, $this->attributes ) ) { $child_context[ $context_name ] = $this->attributes[ $attribute_name ]; } } } $this->inner_blocks = new WP_Block_List( $block['innerBlocks'], $child_context, $registry ); } if ( ! empty( $block['innerHTML'] ) ) { $this->inner_html = $block['innerHTML']; } if ( ! empty( $block['innerContent'] ) ) { $this->inner_content = $block['innerContent']; } } public function __get( $name ) { if ( 'attributes' === $name ) { $this->attributes = isset( $this->parsed_block['attrs'] ) ? $this->parsed_block['attrs'] : array(); if ( ! is_null( $this->block_type ) ) { $this->attributes = $this->block_type->prepare_attributes_for_render( $this->attributes ); } return $this->attributes; } return null; } public function render( $options = array() ) { global $post; $options = wp_parse_args( $options, array( 'dynamic' => true, ) ); $is_dynamic = $options['dynamic'] && $this->name && null !== $this->block_type && $this->block_type->is_dynamic(); $block_content = ''; if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) { $index = 0; foreach ( $this->inner_content as $chunk ) { if ( is_string( $chunk ) ) { $block_content .= $chunk; } else { $inner_block = $this->inner_blocks[ $index ]; $parent_block = $this; $pre_render = apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ); if ( ! is_null( $pre_render ) ) { $block_content .= $pre_render; } else { $source_block = $inner_block->parsed_block; $inner_block->parsed_block = apply_filters( 'render_block_data', $inner_block->parsed_block, $source_block, $parent_block ); $inner_block->context = apply_filters( 'render_block_context', $inner_block->context, $inner_block->parsed_block, $parent_block ); $block_content .= $inner_block->render(); } $index++; } } } if ( $is_dynamic ) { $global_post = $post; $parent = WP_Block_Supports::$block_to_render; WP_Block_Supports::$block_to_render = $this->parsed_block; $block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this ); WP_Block_Supports::$block_to_render = $parent; $post = $global_post; } if ( ! empty( $this->block_type->script ) ) { wp_enqueue_script( $this->block_type->script ); } if ( ! empty( $this->block_type->view_script ) && empty( $this->block_type->render_callback ) ) { wp_enqueue_script( $this->block_type->view_script ); } if ( ! empty( $this->block_type->style ) ) { wp_enqueue_style( $this->block_type->style ); } $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this ); $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this ); return $block_content; } } 400 ) ); } if ( self::application_name_exists_for_user( $user_id, $args['name'] ) ) { return new WP_Error( 'application_password_duplicate_name', __( 'Each application name should be unique.' ), array( 'status' => 409 ) ); } $new_password = wp_generate_password( static::PW_LENGTH, false ); $hashed_password = wp_hash_password( $new_password ); $new_item = array( 'uuid' => wp_generate_uuid4(), 'app_id' => empty( $args['app_id'] ) ? '' : $args['app_id'], 'name' => $args['name'], 'password' => $hashed_password, 'created' => time(), 'last_used' => null, 'last_ip' => null, ); $passwords = static::get_user_application_passwords( $user_id ); $passwords[] = $new_item; $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } $network_id = get_main_network_id(); if ( ! get_network_option( $network_id, self::OPTION_KEY_IN_USE ) ) { update_network_option( $network_id, self::OPTION_KEY_IN_USE, true ); } do_action( 'wp_create_application_password', $user_id, $new_item, $new_password, $args ); return array( $new_password, $new_item ); } public static function get_user_application_passwords( $user_id ) { $passwords = get_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, true ); if ( ! is_array( $passwords ) ) { return array(); } $save = false; foreach ( $passwords as $i => $password ) { if ( ! isset( $password['uuid'] ) ) { $passwords[ $i ]['uuid'] = wp_generate_uuid4(); $save = true; } } if ( $save ) { static::set_user_application_passwords( $user_id, $passwords ); } return $passwords; } public static function get_user_application_password( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $password ) { if ( $password['uuid'] === $uuid ) { return $password; } } return null; } public static function application_name_exists_for_user( $user_id, $name ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $password ) { if ( strtolower( $password['name'] ) === strtolower( $name ) ) { return true; } } return false; } public static function update_application_password( $user_id, $uuid, $update = array() ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as &$item ) { if ( $item['uuid'] !== $uuid ) { continue; } if ( ! empty( $update['name'] ) ) { $update['name'] = sanitize_text_field( $update['name'] ); } $save = false; if ( ! empty( $update['name'] ) && $item['name'] !== $update['name'] ) { $item['name'] = $update['name']; $save = true; } if ( $save ) { $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } } do_action( 'wp_update_application_password', $user_id, $item, $update ); return true; } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function record_application_password_usage( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as &$password ) { if ( $password['uuid'] !== $uuid ) { continue; } if ( $password['last_used'] + DAY_IN_SECONDS > time() ) { return true; } $password['last_used'] = time(); $password['last_ip'] = $_SERVER['REMOTE_ADDR']; $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } return true; } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function delete_application_password( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $key => $item ) { if ( $item['uuid'] === $uuid ) { unset( $passwords[ $key ] ); $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not delete application password.' ) ); } do_action( 'wp_delete_application_password', $user_id, $item ); return true; } } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function delete_all_application_passwords( $user_id ) { $passwords = static::get_user_application_passwords( $user_id ); if ( $passwords ) { $saved = static::set_user_application_passwords( $user_id, array() ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not delete application passwords.' ) ); } foreach ( $passwords as $item ) { do_action( 'wp_delete_application_password', $user_id, $item ); } return count( $passwords ); } return 0; } protected static function set_user_application_passwords( $user_id, $passwords ) { return update_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, $passwords ); } public static function chunk_password( $raw_password ) { $raw_password = preg_replace( '/[^a-z\d]/i', '', $raw_password ); return trim( chunk_split( $raw_password, 4, ' ' ) ); } } init(); $this->register_globals(); } public function init() { $this->weekday[0] = __( 'Sunday' ); $this->weekday[1] = __( 'Monday' ); $this->weekday[2] = __( 'Tuesday' ); $this->weekday[3] = __( 'Wednesday' ); $this->weekday[4] = __( 'Thursday' ); $this->weekday[5] = __( 'Friday' ); $this->weekday[6] = __( 'Saturday' ); $this->weekday_initial[ $this->weekday[0] ] = _x( 'S', 'Sunday initial' ); $this->weekday_initial[ $this->weekday[1] ] = _x( 'M', 'Monday initial' ); $this->weekday_initial[ $this->weekday[2] ] = _x( 'T', 'Tuesday initial' ); $this->weekday_initial[ $this->weekday[3] ] = _x( 'W', 'Wednesday initial' ); $this->weekday_initial[ $this->weekday[4] ] = _x( 'T', 'Thursday initial' ); $this->weekday_initial[ $this->weekday[5] ] = _x( 'F', 'Friday initial' ); $this->weekday_initial[ $this->weekday[6] ] = _x( 'S', 'Saturday initial' ); $this->weekday_abbrev[ $this->weekday[0] ] = __( 'Sun' ); $this->weekday_abbrev[ $this->weekday[1] ] = __( 'Mon' ); $this->weekday_abbrev[ $this->weekday[2] ] = __( 'Tue' ); $this->weekday_abbrev[ $this->weekday[3] ] = __( 'Wed' ); $this->weekday_abbrev[ $this->weekday[4] ] = __( 'Thu' ); $this->weekday_abbrev[ $this->weekday[5] ] = __( 'Fri' ); $this->weekday_abbrev[ $this->weekday[6] ] = __( 'Sat' ); $this->month['01'] = __( 'January' ); $this->month['02'] = __( 'February' ); $this->month['03'] = __( 'March' ); $this->month['04'] = __( 'April' ); $this->month['05'] = __( 'May' ); $this->month['06'] = __( 'June' ); $this->month['07'] = __( 'July' ); $this->month['08'] = __( 'August' ); $this->month['09'] = __( 'September' ); $this->month['10'] = __( 'October' ); $this->month['11'] = __( 'November' ); $this->month['12'] = __( 'December' ); $this->month_genitive['01'] = _x( 'January', 'genitive' ); $this->month_genitive['02'] = _x( 'February', 'genitive' ); $this->month_genitive['03'] = _x( 'March', 'genitive' ); $this->month_genitive['04'] = _x( 'April', 'genitive' ); $this->month_genitive['05'] = _x( 'May', 'genitive' ); $this->month_genitive['06'] = _x( 'June', 'genitive' ); $this->month_genitive['07'] = _x( 'July', 'genitive' ); $this->month_genitive['08'] = _x( 'August', 'genitive' ); $this->month_genitive['09'] = _x( 'September', 'genitive' ); $this->month_genitive['10'] = _x( 'October', 'genitive' ); $this->month_genitive['11'] = _x( 'November', 'genitive' ); $this->month_genitive['12'] = _x( 'December', 'genitive' ); $this->month_abbrev[ $this->month['01'] ] = _x( 'Jan', 'January abbreviation' ); $this->month_abbrev[ $this->month['02'] ] = _x( 'Feb', 'February abbreviation' ); $this->month_abbrev[ $this->month['03'] ] = _x( 'Mar', 'March abbreviation' ); $this->month_abbrev[ $this->month['04'] ] = _x( 'Apr', 'April abbreviation' ); $this->month_abbrev[ $this->month['05'] ] = _x( 'May', 'May abbreviation' ); $this->month_abbrev[ $this->month['06'] ] = _x( 'Jun', 'June abbreviation' ); $this->month_abbrev[ $this->month['07'] ] = _x( 'Jul', 'July abbreviation' ); $this->month_abbrev[ $this->month['08'] ] = _x( 'Aug', 'August abbreviation' ); $this->month_abbrev[ $this->month['09'] ] = _x( 'Sep', 'September abbreviation' ); $this->month_abbrev[ $this->month['10'] ] = _x( 'Oct', 'October abbreviation' ); $this->month_abbrev[ $this->month['11'] ] = _x( 'Nov', 'November abbreviation' ); $this->month_abbrev[ $this->month['12'] ] = _x( 'Dec', 'December abbreviation' ); $this->meridiem['am'] = __( 'am' ); $this->meridiem['pm'] = __( 'pm' ); $this->meridiem['AM'] = __( 'AM' ); $this->meridiem['PM'] = __( 'PM' ); $thousands_sep = __( 'number_format_thousands_sep' ); $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; $decimal_point = __( 'number_format_decimal_point' ); $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point; $this->list_item_separator = __( ', ' ); if ( isset( $GLOBALS['text_direction'] ) ) { $this->text_direction = $GLOBALS['text_direction']; } elseif ( 'rtl' === _x( 'ltr', 'text direction' ) ) { $this->text_direction = 'rtl'; } } public function get_weekday( $weekday_number ) { return $this->weekday[ $weekday_number ]; } public function get_weekday_initial( $weekday_name ) { return $this->weekday_initial[ $weekday_name ]; } public function get_weekday_abbrev( $weekday_name ) { return $this->weekday_abbrev[ $weekday_name ]; } public function get_month( $month_number ) { return $this->month[ zeroise( $month_number, 2 ) ]; } public function get_month_abbrev( $month_name ) { return $this->month_abbrev[ $month_name ]; } public function get_meridiem( $meridiem ) { return $this->meridiem[ $meridiem ]; } public function register_globals() { $GLOBALS['weekday'] = $this->weekday; $GLOBALS['weekday_initial'] = $this->weekday_initial; $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev; $GLOBALS['month'] = $this->month; $GLOBALS['month_abbrev'] = $this->month_abbrev; } public function is_rtl() { return 'rtl' === $this->text_direction; } public function _strings_for_pot() { __( 'F j, Y' ); __( 'g:i a' ); __( 'F j, Y g:i a' ); } public function get_list_item_separator() { return $this->list_item_separator; } } '; ?> + + + <?php wp_title_rss(); ?> + + + + http://backend.userland.com/rss092 + + - input[type="checkbox"], - .widefat th input[type="checkbox"], - .widefat thead td input[type="checkbox"], - .widefat tfoot td input[type="checkbox"] { - -webkit-appearance: none; - } + + + <?php the_title_rss(); ?> + ]]> + + + + + + +menu
          property.' ); return array(); } } public function initialize() { $this->user = new stdClass; if ( is_user_logged_in() ) { $this->user->blogs = get_blogs_of_user( get_current_user_id() ); if ( is_multisite() ) { $this->user->active_blog = get_active_blog_for_user( get_current_user_id() ); $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); $this->user->account_domain = $this->user->domain; } else { $this->user->active_blog = $this->user->blogs[ get_current_blog_id() ]; $this->user->domain = trailingslashit( home_url() ); $this->user->account_domain = $this->user->domain; } } add_action( 'wp_head', 'wp_admin_bar_header' ); add_action( 'admin_head', 'wp_admin_bar_header' ); if ( current_theme_supports( 'admin-bar' ) ) { $admin_bar_args = get_theme_support( 'admin-bar' ); $header_callback = $admin_bar_args[0]['callback']; } if ( empty( $header_callback ) ) { $header_callback = '_admin_bar_bump_cb'; } add_action( 'wp_head', $header_callback ); wp_enqueue_script( 'admin-bar' ); wp_enqueue_style( 'admin-bar' ); do_action( 'admin_bar_init' ); } public function add_menu( $node ) { $this->add_node( $node ); } public function remove_menu( $id ) { $this->remove_node( $id ); } public function add_node( $args ) { if ( func_num_args() >= 3 && is_string( $args ) ) { $args = array_merge( array( 'parent' => $args ), func_get_arg( 2 ) ); } if ( is_object( $args ) ) { $args = get_object_vars( $args ); } if ( empty( $args['id'] ) ) { if ( empty( $args['title'] ) ) { return; } _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3.0' ); $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) ); } $defaults = array( 'id' => false, 'title' => false, 'parent' => false, 'href' => false, 'group' => false, 'meta' => array(), ); $maybe_defaults = $this->get_node( $args['id'] ); if ( $maybe_defaults ) { $defaults = get_object_vars( $maybe_defaults ); } if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) ) { $args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] ); } $args = wp_parse_args( $args, $defaults ); $back_compat_parents = array( 'my-account-with-avatar' => array( 'my-account', '3.3' ), 'my-blogs' => array( 'my-sites', '3.3' ), ); if ( isset( $back_compat_parents[ $args['parent'] ] ) ) { list( $new_parent, $version ) = $back_compat_parents[ $args['parent'] ]; _deprecated_argument( __METHOD__, $version, sprintf( 'Use %s as the parent for the %s admin bar node instead of %s.', $new_parent, $args['id'], $args['parent'] ) ); $args['parent'] = $new_parent; } $this->_set_node( $args ); } final protected function _set_node( $args ) { $this->nodes[ $args['id'] ] = (object) $args; } final public function get_node( $id ) { $node = $this->_get_node( $id ); if ( $node ) { return clone $node; } } final protected function _get_node( $id ) { if ( $this->bound ) { return; } if ( empty( $id ) ) { $id = 'root'; } if ( isset( $this->nodes[ $id ] ) ) { return $this->nodes[ $id ]; } } final public function get_nodes() { $nodes = $this->_get_nodes(); if ( ! $nodes ) { return; } foreach ( $nodes as &$node ) { $node = clone $node; } return $nodes; } final protected function _get_nodes() { if ( $this->bound ) { return; } return $this->nodes; } final public function add_group( $args ) { $args['group'] = true; $this->add_node( $args ); } public function remove_node( $id ) { $this->_unset_node( $id ); } final protected function _unset_node( $id ) { unset( $this->nodes[ $id ] ); } public function render() { $root = $this->_bind(); if ( $root ) { $this->_render( $root ); } } final protected function _bind() { if ( $this->bound ) { return; } $this->remove_node( 'root' ); $this->add_node( array( 'id' => 'root', 'group' => false, ) ); foreach ( $this->_get_nodes() as $node ) { $node->children = array(); $node->type = ( $node->group ) ? 'group' : 'item'; unset( $node->group ); if ( ! $node->parent ) { $node->parent = 'root'; } } foreach ( $this->_get_nodes() as $node ) { if ( 'root' === $node->id ) { continue; } $parent = $this->_get_node( $node->parent ); if ( ! $parent ) { continue; } $group_class = ( 'root' === $node->parent ) ? 'ab-top-menu' : 'ab-submenu'; if ( 'group' === $node->type ) { if ( empty( $node->meta['class'] ) ) { $node->meta['class'] = $group_class; } else { $node->meta['class'] .= ' ' . $group_class; } } if ( 'item' === $parent->type && 'item' === $node->type ) { $default_id = $parent->id . '-default'; $default = $this->_get_node( $default_id ); if ( ! $default ) { $this->_set_node( array( 'id' => $default_id, 'parent' => $parent->id, 'type' => 'group', 'children' => array(), 'meta' => array( 'class' => $group_class, ), 'title' => false, 'href' => false, ) ); $default = $this->_get_node( $default_id ); $parent->children[] = $default; } $parent = $default; } elseif ( 'group' === $parent->type && 'group' === $node->type ) { $container_id = $parent->id . '-container'; $container = $this->_get_node( $container_id ); if ( ! $container ) { $this->_set_node( array( 'id' => $container_id, 'type' => 'container', 'children' => array( $parent ), 'parent' => false, 'title' => false, 'href' => false, 'meta' => array(), ) ); $container = $this->_get_node( $container_id ); $grandparent = $this->_get_node( $parent->parent ); if ( $grandparent ) { $container->parent = $grandparent->id; $index = array_search( $parent, $grandparent->children, true ); if ( false === $index ) { $grandparent->children[] = $container; } else { array_splice( $grandparent->children, $index, 1, array( $container ) ); } } $parent->parent = $container->id; } $parent = $container; } $node->parent = $parent->id; $parent->children[] = $node; } $root = $this->_get_node( 'root' ); $this->bound = true; return $root; } final protected function _render( $root ) { $class = 'nojq nojs'; if ( wp_is_mobile() ) { $class .= ' mobile'; } ?> +
          + + + + + + + +
          - .widefat th input[type="checkbox"], - .widefat thead td input[type="checkbox"], - .widefat tfoot td input[type="checkbox"] { - margin-bottom: 8px; - } + type || empty( $node->children ) ) { return; } echo '
          '; foreach ( $node->children as $group ) { $this->_render_group( $group ); } echo '
          '; } final protected function _render_group( $node ) { if ( 'container' === $node->type ) { $this->_render_container( $node ); return; } if ( 'group' !== $node->type || empty( $node->children ) ) { return; } if ( ! empty( $node->meta['class'] ) ) { $class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"'; } else { $class = ''; } echo "
            id ) . "'$class>"; foreach ( $node->children as $item ) { $this->_render_item( $item ); } echo '
          '; } final protected function _render_item( $node ) { if ( 'item' !== $node->type ) { return; } $is_parent = ! empty( $node->children ); $has_link = ! empty( $node->href ); $is_root_top_item = 'root-default' === $node->parent; $is_top_secondary_item = 'top-secondary' === $node->parent; $tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : ''; $aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; $menuclass = ''; $arrow = ''; if ( $is_parent ) { $menuclass = 'menupop '; $aria_attributes .= ' aria-haspopup="true"'; } if ( ! empty( $node->meta['class'] ) ) { $menuclass .= $node->meta['class']; } if ( ! $is_root_top_item && ! $is_top_secondary_item && $is_parent ) { $arrow = ''; } if ( $menuclass ) { $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; } echo "
        • id ) . "'$menuclass>"; if ( $has_link ) { $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' ); echo "meta[ $attribute ] ) ) { continue; } if ( 'onclick' === $attribute ) { echo " $attribute='" . esc_js( $node->meta[ $attribute ] ) . "'"; } else { echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . "'"; } } echo ">{$arrow}{$node->title}"; if ( $has_link ) { echo ''; } else { echo ''; } if ( $is_parent ) { echo '
          '; foreach ( $node->children as $group ) { $this->_render_group( $group ); } echo '
          '; } if ( ! empty( $node->meta['html'] ) ) { echo $node->meta['html']; } echo '
        • '; } public function recursive_render( $id, $node ) { _deprecated_function( __METHOD__, '3.3.0', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' ); $this->_render_item( $node ); } public function add_menus() { add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 ); add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 ); add_action( 'admin_bar_menu', 'wp_admin_bar_recovery_mode_menu', 8 ); add_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 ); add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 ); add_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 ); if ( ! is_network_admin() && ! is_user_admin() ) { add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 ); add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 ); } add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); do_action( 'add_admin_bar_menus' ); } } = 7; function wp_is_mobile() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $is_mobile = false; } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Android' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Silk/' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Kindle' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) !== false ) { $is_mobile = true; } else { $is_mobile = false; } return apply_filters( 'wp_is_mobile', $is_mobile ); } 'get_embed_template', 'is_404' => 'get_404_template', 'is_search' => 'get_search_template', 'is_front_page' => 'get_front_page_template', 'is_home' => 'get_home_template', 'is_privacy_policy' => 'get_privacy_policy_template', 'is_post_type_archive' => 'get_post_type_archive_template', 'is_tax' => 'get_taxonomy_template', 'is_attachment' => 'get_attachment_template', 'is_single' => 'get_single_template', 'is_page' => 'get_page_template', 'is_singular' => 'get_singular_template', 'is_category' => 'get_category_template', 'is_tag' => 'get_tag_template', 'is_author' => 'get_author_template', 'is_date' => 'get_date_template', 'is_archive' => 'get_archive_template', ); $template = false; foreach ( $tag_templates as $tag => $template_getter ) { if ( call_user_func( $tag ) ) { $template = call_user_func( $template_getter ); } if ( $template ) { if ( 'is_attachment' === $tag ) { remove_filter( 'the_content', 'prepend_attachment' ); } break; } } if ( ! $template ) { $template = get_index_template(); } $template = apply_filters( 'template_include', $template ); if ( $template ) { include $template; } elseif ( current_user_can( 'switch_themes' ) ) { $theme = wp_get_theme(); if ( $theme->errors() ) { wp_die( $theme->errors() ); } } return; } HashPassword( $key ); $records = $this->get_keys(); $records[ $token ] = array( 'hashed_key' => $hashed, 'created_at' => time(), ); $this->update_keys( $records ); do_action( 'generate_recovery_mode_key', $token, $key ); return $key; } public function validate_recovery_mode_key( $token, $key, $ttl ) { $records = $this->get_keys(); if ( ! isset( $records[ $token ] ) ) { return new WP_Error( 'token_not_found', __( 'Recovery Mode not initialized.' ) ); } $record = $records[ $token ]; $this->remove_key( $token ); if ( ! is_array( $record ) || ! isset( $record['hashed_key'], $record['created_at'] ) ) { return new WP_Error( 'invalid_recovery_key_format', __( 'Invalid recovery key format.' ) ); } if ( ! wp_check_password( $key, $record['hashed_key'] ) ) { return new WP_Error( 'hash_mismatch', __( 'Invalid recovery key.' ) ); } if ( time() > $record['created_at'] + $ttl ) { return new WP_Error( 'key_expired', __( 'Recovery key expired.' ) ); } return true; } public function clean_expired_keys( $ttl ) { $records = $this->get_keys(); foreach ( $records as $key => $record ) { if ( ! isset( $record['created_at'] ) || time() > $record['created_at'] + $ttl ) { unset( $records[ $key ] ); } } $this->update_keys( $records ); } private function remove_key( $token ) { $records = $this->get_keys(); if ( ! isset( $records[ $token ] ) ) { return; } unset( $records[ $token ] ); $this->update_keys( $records ); } private function get_keys() { return (array) get_option( $this->option_name, array() ); } private function update_keys( array $keys ) { return update_option( $this->option_name, $keys ); } } blockName = $name; $this->attrs = $attrs; $this->innerBlocks = $innerBlocks; $this->innerHTML = $innerHTML; $this->innerContent = $innerContent; } } class WP_Block_Parser_Frame { public $block; public $token_start; public $token_length; public $prev_offset; public $leading_html_start; function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) { $this->block = $block; $this->token_start = $token_start; $this->token_length = $token_length; $this->prev_offset = isset( $prev_offset ) ? $prev_offset : $token_start + $token_length; $this->leading_html_start = $leading_html_start; } } class WP_Block_Parser { public $document; public $offset; public $output; public $stack; public $empty_attrs; function parse( $document ) { $this->document = $document; $this->offset = 0; $this->output = array(); $this->stack = array(); $this->empty_attrs = json_decode( '{}', true ); do { } while ( $this->proceed() ); return $this->output; } function proceed() { $next_token = $this->next_token(); list( $token_type, $block_name, $attrs, $start_offset, $token_length ) = $next_token; $stack_depth = count( $this->stack ); $leading_html_start = $start_offset > $this->offset ? $this->offset : null; switch ( $token_type ) { case 'no-more-tokens': if ( 0 === $stack_depth ) { $this->add_freeform(); return false; } if ( 1 === $stack_depth ) { $this->add_block_from_stack(); return false; } while ( 0 < count( $this->stack ) ) { $this->add_block_from_stack(); } return false; case 'void-block': if ( 0 === $stack_depth ) { if ( isset( $leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $leading_html_start, $start_offset - $leading_html_start ) ); } $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); $this->offset = $start_offset + $token_length; return true; } $this->add_inner_block( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length ); $this->offset = $start_offset + $token_length; return true; case 'block-opener': array_push( $this->stack, new WP_Block_Parser_Frame( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length, $start_offset + $token_length, $leading_html_start ) ); $this->offset = $start_offset + $token_length; return true; case 'block-closer': if ( 0 === $stack_depth ) { $this->add_freeform(); return false; } if ( 1 === $stack_depth ) { $this->add_block_from_stack( $start_offset ); $this->offset = $start_offset + $token_length; return true; } $stack_top = array_pop( $this->stack ); $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; $stack_top->prev_offset = $start_offset + $token_length; $this->add_inner_block( $stack_top->block, $stack_top->token_start, $stack_top->token_length, $start_offset + $token_length ); $this->offset = $start_offset + $token_length; return true; default: $this->add_freeform(); return false; } } function next_token() { $matches = null; $has_match = preg_match( '/).)*+)?}\s+)?(?P\/)?-->/s', $this->document, $matches, PREG_OFFSET_CAPTURE, $this->offset ); if ( false === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } if ( 0 === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } list( $match, $started_at ) = $matches[0]; $length = strlen( $match ); $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1]; $is_void = isset( $matches['void'] ) && -1 !== $matches['void'][1]; $namespace = $matches['namespace']; $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/'; $name = $namespace . $matches['name'][0]; $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1]; $attrs = $has_attrs ? json_decode( $matches['attrs'][0], true ) : $this->empty_attrs; if ( $is_closer && ( $is_void || $has_attrs ) ) { } if ( $is_void ) { return array( 'void-block', $name, $attrs, $started_at, $length ); } if ( $is_closer ) { return array( 'block-closer', $name, null, $started_at, $length ); } return array( 'block-opener', $name, $attrs, $started_at, $length ); } function freeform( $innerHTML ) { return new WP_Block_Parser_Block( null, $this->empty_attrs, array(), $innerHTML, array( $innerHTML ) ); } function add_freeform( $length = null ) { $length = $length ? $length : strlen( $this->document ) - $this->offset; if ( 0 === $length ) { return; } $this->output[] = (array) $this->freeform( substr( $this->document, $this->offset, $length ) ); } function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { $parent = $this->stack[ count( $this->stack ) - 1 ]; $parent->block->innerBlocks[] = (array) $block; $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); if ( ! empty( $html ) ) { $parent->block->innerHTML .= $html; $parent->block->innerContent[] = $html; } $parent->block->innerContent[] = null; $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; } function add_block_from_stack( $end_offset = null ) { $stack_top = array_pop( $this->stack ); $prev_offset = $stack_top->prev_offset; $html = isset( $end_offset ) ? substr( $this->document, $prev_offset, $end_offset - $prev_offset ) : substr( $this->document, $prev_offset ); if ( ! empty( $html ) ) { $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; } if ( isset( $stack_top->leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $stack_top->leading_html_start, $stack_top->token_start - $stack_top->leading_html_start ) ); } $this->output[] = (array) $stack_top->block; } } register_handler( $id, $regex, $callback, $priority ); } function wp_embed_unregister_handler( $id, $priority = 10 ) { global $wp_embed; $wp_embed->unregister_handler( $id, $priority ); } function wp_embed_defaults( $url = '' ) { if ( ! empty( $GLOBALS['content_width'] ) ) { $width = (int) $GLOBALS['content_width']; } if ( empty( $width ) ) { $width = 500; } $height = min( ceil( $width * 1.5 ), 1000 ); return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url ); } function wp_oembed_get( $url, $args = '' ) { $oembed = _wp_oembed_get_object(); return $oembed->get_html( $url, $args ); } function _wp_oembed_get_object() { static $wp_oembed = null; if ( is_null( $wp_oembed ) ) { $wp_oembed = new WP_oEmbed(); } return $wp_oembed; } function wp_oembed_add_provider( $format, $provider, $regex = false ) { if ( did_action( 'plugins_loaded' ) ) { $oembed = _wp_oembed_get_object(); $oembed->providers[ $format ] = array( $provider, $regex ); } else { WP_oEmbed::_add_provider_early( $format, $provider, $regex ); } } function wp_oembed_remove_provider( $format ) { if ( did_action( 'plugins_loaded' ) ) { $oembed = _wp_oembed_get_object(); if ( isset( $oembed->providers[ $format ] ) ) { unset( $oembed->providers[ $format ] ); return true; } } else { WP_oEmbed::_remove_provider_early( $format ); } return false; } function wp_maybe_load_embeds() { if ( ! apply_filters( 'load_default_embeds', true ) ) { return; } wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' ); wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . implode( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 ); wp_embed_register_handler( 'video', '#^https?://.+?\.(' . implode( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 ); } function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { global $wp_embed; $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) ); return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr ); } function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) ); return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); } function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) { $dimensions = ''; if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) { $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] ); $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); } $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) ); return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); } function wp_oembed_register_route() { $controller = new WP_oEmbed_Controller(); $controller->register_routes(); } function wp_oembed_add_discovery_links() { $output = ''; if ( is_singular() ) { $output .= '' . "\n"; if ( class_exists( 'SimpleXMLElement' ) ) { $output .= '' . "\n"; } } echo apply_filters( 'oembed_discovery_links', $output ); } function wp_oembed_add_host_js() {} function wp_maybe_enqueue_oembed_host_js( $html ) { if ( has_action( 'wp_head', 'wp_oembed_add_host_js' ) && preg_match( '/]*?wp-embedded-content/', $html ) ) { wp_enqueue_script( 'wp-embed' ); } return $html; } function get_post_embed_url( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' ); $path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) ); if ( ! get_option( 'permalink_structure' ) || $path_conflict ) { $embed_url = add_query_arg( array( 'embed' => 'true' ), get_permalink( $post ) ); } return esc_url_raw( apply_filters( 'post_embed_url', $embed_url, $post ) ); } function get_oembed_endpoint_url( $permalink = '', $format = 'json' ) { $url = rest_url( 'oembed/1.0/embed' ); if ( '' !== $permalink ) { $url = add_query_arg( array( 'url' => urlencode( $permalink ), 'format' => ( 'json' !== $format ) ? $format : false, ), $url ); } return apply_filters( 'oembed_endpoint_url', $url, $permalink, $format ); } function get_post_embed_html( $width, $height, $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $embed_url = get_post_embed_url( $post ); $secret = wp_generate_password( 10, false ); $embed_url .= "#?secret={$secret}"; $output = sprintf( '
          %3$s
          ', esc_attr( $secret ), esc_url( get_permalink( $post ) ), get_the_title( $post ) ); $output .= sprintf( '', esc_url( $embed_url ), absint( $width ), absint( $height ), esc_attr( sprintf( __( '“%1$s” — %2$s' ), get_the_title( $post ), get_bloginfo( 'name' ) ) ), esc_attr( $secret ) ); $output .= wp_get_inline_script_tag( file_get_contents( ABSPATH . WPINC . '/js/wp-embed' . wp_scripts_get_suffix() . '.js' ) ); return apply_filters( 'embed_html', $output, $post, $width, $height ); } function get_oembed_response_data( $post, $width ) { $post = get_post( $post ); $width = absint( $width ); if ( ! $post ) { return false; } if ( ! is_post_publicly_viewable( $post ) ) { return false; } $min_max_width = apply_filters( 'oembed_min_max_width', array( 'min' => 200, 'max' => 600, ) ); $width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] ); $height = max( ceil( $width / 16 * 9 ), 200 ); $data = array( 'version' => '1.0', 'provider_name' => get_bloginfo( 'name' ), 'provider_url' => get_home_url(), 'author_name' => get_bloginfo( 'name' ), 'author_url' => get_home_url(), 'title' => get_the_title( $post ), 'type' => 'link', ); $author = get_userdata( $post->post_author ); if ( $author ) { $data['author_name'] = $author->display_name; $data['author_url'] = get_author_posts_url( $author->ID ); } return apply_filters( 'oembed_response_data', $data, $post, $width, $height ); } function get_oembed_response_data_for_url( $url, $args ) { $switched_blog = false; if ( is_multisite() ) { $url_parts = wp_parse_args( wp_parse_url( $url ), array( 'host' => '', 'path' => '/', ) ); $qv = array( 'domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false, ); if ( ! is_subdomain_install() ) { $path = explode( '/', ltrim( $url_parts['path'], '/' ) ); $path = reset( $path ); if ( $path ) { $qv['path'] = get_network()->path . $path . '/'; } } $sites = get_sites( $qv ); $site = reset( $sites ); if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) { return false; } if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { switch_to_blog( $site->blog_id ); $switched_blog = true; } } $post_id = url_to_postid( $url ); $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); if ( ! $post_id ) { if ( $switched_blog ) { restore_current_blog(); } return false; } $width = isset( $args['width'] ) ? $args['width'] : 0; $data = get_oembed_response_data( $post_id, $width ); if ( $switched_blog ) { restore_current_blog(); } return $data ? (object) $data : false; } function get_oembed_response_data_rich( $data, $post, $width, $height ) { $data['width'] = absint( $width ); $data['height'] = absint( $height ); $data['type'] = 'rich'; $data['html'] = get_post_embed_html( $width, $height, $post ); $thumbnail_id = false; if ( has_post_thumbnail( $post->ID ) ) { $thumbnail_id = get_post_thumbnail_id( $post->ID ); } if ( 'attachment' === get_post_type( $post ) ) { if ( wp_attachment_is_image( $post ) ) { $thumbnail_id = $post->ID; } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_id = get_post_thumbnail_id( $post ); $data['type'] = 'video'; } } if ( $thumbnail_id ) { list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) ); $data['thumbnail_url'] = $thumbnail_url; $data['thumbnail_width'] = $thumbnail_width; $data['thumbnail_height'] = $thumbnail_height; } return $data; } function wp_oembed_ensure_format( $format ) { if ( ! in_array( $format, array( 'json', 'xml' ), true ) ) { return 'json'; } return $format; } function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) { $params = $request->get_params(); if ( '/oembed/1.0/embed' !== $request->get_route() || 'GET' !== $request->get_method() ) { return $served; } if ( ! isset( $params['format'] ) || 'xml' !== $params['format'] ) { return $served; } $data = $server->response_to_data( $result, false ); if ( ! class_exists( 'SimpleXMLElement' ) ) { status_header( 501 ); die( get_status_header_desc( 501 ) ); } $result = _oembed_create_xml( $data ); if ( ! $result ) { status_header( 501 ); return get_status_header_desc( 501 ); } if ( ! headers_sent() ) { $server->send_header( 'Content-Type', 'text/xml; charset=' . get_option( 'blog_charset' ) ); } echo $result; return true; } function _oembed_create_xml( $data, $node = null ) { if ( ! is_array( $data ) || empty( $data ) ) { return false; } if ( null === $node ) { $node = new SimpleXMLElement( '' ); } foreach ( $data as $key => $value ) { if ( is_numeric( $key ) ) { $key = 'oembed'; } if ( is_array( $value ) ) { $item = $node->addChild( $key ); _oembed_create_xml( $value, $item ); } else { $node->addChild( $key, esc_html( $value ) ); } } return $node->asXML(); } function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) { if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) { return $result; } $title = ! empty( $data->title ) ? $data->title : ''; $pattern = '`]*)>`i'; if ( preg_match( $pattern, $result, $matches ) ) { $attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() ); foreach ( $attrs as $attr => $item ) { $lower_attr = strtolower( $attr ); if ( $lower_attr === $attr ) { continue; } if ( ! isset( $attrs[ $lower_attr ] ) ) { $attrs[ $lower_attr ] = $item; unset( $attrs[ $attr ] ); } } } if ( ! empty( $attrs['title']['value'] ) ) { $title = $attrs['title']['value']; } $title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url ); if ( '' === $title ) { return $result; } if ( isset( $attrs['title'] ) ) { unset( $attrs['title'] ); $attr_string = implode( ' ', wp_list_pluck( $attrs, 'whole' ) ); $result = str_replace( $matches[0], ')|ms', $html, $content ); if ( empty( $content[2] ) ) { return false; } $html = $content[1] . $content[2]; preg_match( '/ src=([\'"])(.*?)\1/', $html, $results ); if ( ! empty( $results ) ) { $secret = wp_generate_password( 10, false ); $url = esc_url( "{$results[2]}#?secret=$secret" ); $q = $results[1]; $html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html ); $html = str_replace( '%2$s', esc_url( get_permalink() ), sprintf( __( 'Continue reading %s' ), '' . get_the_title() . '' ) ); return ' … ' . $link; } function the_excerpt_embed() { $output = get_the_excerpt(); echo apply_filters( 'the_excerpt_embed', $output ); } function wp_embed_excerpt_attachment( $content ) { if ( is_attachment() ) { return prepend_attachment( '' ); } return $content; } function enqueue_embed_scripts() { wp_enqueue_style( 'wp-embed-template-ie' ); do_action( 'enqueue_embed_scripts' ); } function print_embed_styles() { $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; $suffix = SCRIPT_DEBUG ? '' : '.min'; ?> + > + + + + + +
          + +
          + + + %s', esc_url( home_url() ), esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ), esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ), esc_html( get_bloginfo( 'name' ) ) ); $site_title = '
          ' . $site_title . '
          '; echo apply_filters( 'embed_site_title_html', $site_title ); } function wp_filter_pre_oembed_result( $result, $url, $args ) { $data = get_oembed_response_data_for_url( $url, $args ); if ( $data ) { return _wp_oembed_get_object()->data2html( $data, $url ); } return $result; } $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args, ); $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_schedule_event_false', __( 'A plugin prevented the event from being scheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { $crons = array(); } $key = md5( serialize( $event->args ) ); $duplicate = false; if ( $event->timestamp < time() + 10 * MINUTE_IN_SECONDS ) { $min_timestamp = 0; } else { $min_timestamp = $event->timestamp - 10 * MINUTE_IN_SECONDS; } if ( $event->timestamp < time() ) { $max_timestamp = time() + 10 * MINUTE_IN_SECONDS; } else { $max_timestamp = $event->timestamp + 10 * MINUTE_IN_SECONDS; } foreach ( $crons as $event_timestamp => $cron ) { if ( $event_timestamp < $min_timestamp ) { continue; } if ( $event_timestamp > $max_timestamp ) { break; } if ( isset( $cron[ $event->hook ][ $key ] ) ) { $duplicate = true; break; } } if ( $duplicate ) { if ( $wp_error ) { return new WP_Error( 'duplicate_event', __( 'A duplicate event already exists.' ) ); } return false; } $event = apply_filters( 'schedule_event', $event ); if ( ! $event ) { if ( $wp_error ) { return new WP_Error( 'schedule_event_false', __( 'A plugin disallowed this event.' ) ); } return false; } $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 'schedule' => $event->schedule, 'args' => $event->args, ); uksort( $crons, 'strnatcasecmp' ); return _set_cron_array( $crons, $wp_error ); } function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $schedules = wp_get_schedules(); if ( ! isset( $schedules[ $recurrence ] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_schedule', __( 'Event schedule does not exist.' ) ); } return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[ $recurrence ]['interval'], ); $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_schedule_event_false', __( 'A plugin prevented the event from being scheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $event = apply_filters( 'schedule_event', $event ); if ( ! $event ) { if ( $wp_error ) { return new WP_Error( 'schedule_event_false', __( 'A plugin disallowed this event.' ) ); } return false; } $key = md5( serialize( $event->args ) ); $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { $crons = array(); } $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval, ); uksort( $crons, 'strnatcasecmp' ); return _set_cron_array( $crons, $wp_error ); } function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $schedules = wp_get_schedules(); $interval = 0; if ( isset( $schedules[ $recurrence ] ) ) { $interval = $schedules[ $recurrence ]['interval']; } if ( 0 === $interval ) { $scheduled_event = wp_get_scheduled_event( $hook, $args, $timestamp ); if ( $scheduled_event && isset( $scheduled_event->interval ) ) { $interval = $scheduled_event->interval; } } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $interval, ); $pre = apply_filters( 'pre_reschedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_reschedule_event_false', __( 'A plugin prevented the event from being rescheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } if ( 0 == $interval ) { if ( $wp_error ) { return new WP_Error( 'invalid_schedule', __( 'Event schedule does not exist.' ) ); } return false; } $now = time(); if ( $timestamp >= $now ) { $timestamp = $now + $interval; } else { $timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) ); } return wp_schedule_event( $timestamp, $recurrence, $hook, $args, $wp_error ); } function wp_unschedule_event( $timestamp, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $pre = apply_filters( 'pre_unschedule_event', null, $timestamp, $hook, $args, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_unschedule_event_false', __( 'A plugin prevented the event from being unscheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); $key = md5( serialize( $args ) ); unset( $crons[ $timestamp ][ $hook ][ $key ] ); if ( empty( $crons[ $timestamp ][ $hook ] ) ) { unset( $crons[ $timestamp ][ $hook ] ); } if ( empty( $crons[ $timestamp ] ) ) { unset( $crons[ $timestamp ] ); } return _set_cron_array( $crons, $wp_error ); } function wp_clear_scheduled_hook( $hook, $args = array(), $wp_error = false ) { if ( ! is_array( $args ) ) { _deprecated_argument( __FUNCTION__, '3.0.0', __( 'This argument has changed to an array to match the behavior of the other cron functions.' ) ); $args = array_slice( func_get_args(), 1 ); $wp_error = false; } $pre = apply_filters( 'pre_clear_scheduled_hook', null, $hook, $args, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_clear_scheduled_hook_false', __( 'A plugin prevented the hook from being cleared.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return 0; } $results = array(); $key = md5( serialize( $args ) ); foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ][ $key ] ) ) { $results[] = wp_unschedule_event( $timestamp, $hook, $args, true ); } } $errors = array_filter( $results, 'is_wp_error' ); $error = new WP_Error(); if ( $errors ) { if ( $wp_error ) { array_walk( $errors, array( $error, 'merge_from' ) ); return $error; } return false; } return count( $results ); } function wp_unschedule_hook( $hook, $wp_error = false ) { $pre = apply_filters( 'pre_unschedule_hook', null, $hook, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_unschedule_hook_false', __( 'A plugin prevented the hook from being cleared.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return 0; } $results = array(); foreach ( $crons as $timestamp => $args ) { if ( ! empty( $crons[ $timestamp ][ $hook ] ) ) { $results[] = count( $crons[ $timestamp ][ $hook ] ); } unset( $crons[ $timestamp ][ $hook ] ); if ( empty( $crons[ $timestamp ] ) ) { unset( $crons[ $timestamp ] ); } } if ( empty( $results ) ) { return 0; } $set = _set_cron_array( $crons, $wp_error ); if ( true === $set ) { return array_sum( $results ); } return $set; } function wp_get_scheduled_event( $hook, $args = array(), $timestamp = null ) { $pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp ); if ( null !== $pre ) { return $pre; } if ( null !== $timestamp && ! is_numeric( $timestamp ) ) { return false; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return false; } $key = md5( serialize( $args ) ); if ( ! $timestamp ) { $next = false; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ][ $key ] ) ) { $next = $timestamp; break; } } if ( ! $next ) { return false; } $timestamp = $next; } elseif ( ! isset( $crons[ $timestamp ][ $hook ][ $key ] ) ) { return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $crons[ $timestamp ][ $hook ][ $key ]['schedule'], 'args' => $args, ); if ( isset( $crons[ $timestamp ][ $hook ][ $key ]['interval'] ) ) { $event->interval = $crons[ $timestamp ][ $hook ][ $key ]['interval']; } return $event; } function wp_next_scheduled( $hook, $args = array() ) { $next_event = wp_get_scheduled_event( $hook, $args ); if ( ! $next_event ) { return false; } return $next_event->timestamp; } function spawn_cron( $gmt_time = 0 ) { if ( ! $gmt_time ) { $gmt_time = microtime( true ); } if ( defined( 'DOING_CRON' ) || isset( $_GET['doing_wp_cron'] ) ) { return false; } $lock = get_transient( 'doing_cron' ); if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS ) { $lock = 0; } if ( $lock + WP_CRON_LOCK_TIMEOUT > $gmt_time ) { return false; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return false; } $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return false; } if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || defined( 'DOING_AJAX' ) || defined( 'XMLRPC_REQUEST' ) ) { return false; } $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); ob_start(); wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); echo ' '; wp_ob_end_flush_all(); flush(); include_once ABSPATH . 'wp-cron.php'; return true; } $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); $cron_request = apply_filters( 'cron_request', array( 'url' => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ), 'key' => $doing_wp_cron, 'args' => array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), ), ), $doing_wp_cron ); $result = wp_remote_post( $cron_request['url'], $cron_request['args'] ); return ! is_wp_error( $result ); } function wp_cron() { if ( did_action( 'wp_loaded' ) ) { return _wp_cron(); } add_action( 'wp_loaded', '_wp_cron', 20 ); } function _wp_cron() { if ( strpos( $_SERVER['REQUEST_URI'], '/wp-cron.php' ) !== false || ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ) { return 0; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return 0; } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return 0; } $schedules = wp_get_schedules(); $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } foreach ( (array) $cronhooks as $hook => $args ) { if ( isset( $schedules[ $hook ]['callback'] ) && ! call_user_func( $schedules[ $hook ]['callback'] ) ) { continue; } $results[] = spawn_cron( $gmt_time ); break 2; } } if ( in_array( false, $results, true ) ) { return false; } return count( $results ); } function wp_get_schedules() { $schedules = array( 'hourly' => array( 'interval' => HOUR_IN_SECONDS, 'display' => __( 'Once Hourly' ), ), 'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ), ), 'daily' => array( 'interval' => DAY_IN_SECONDS, 'display' => __( 'Once Daily' ), ), 'weekly' => array( 'interval' => WEEK_IN_SECONDS, 'display' => __( 'Once Weekly' ), ), ); return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); } function wp_get_schedule( $hook, $args = array() ) { $schedule = false; $event = wp_get_scheduled_event( $hook, $args ); if ( $event ) { $schedule = $event->schedule; } return apply_filters( 'get_schedule', $schedule, $hook, $args ); } function wp_get_ready_cron_jobs() { $pre = apply_filters( 'pre_get_ready_cron_jobs', null ); if ( null !== $pre ) { return $pre; } $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { return array(); } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return array(); } $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } $results[ $timestamp ] = $cronhooks; } return $results; } function _get_cron_array() { $cron = get_option( 'cron' ); if ( ! is_array( $cron ) ) { return false; } if ( ! isset( $cron['version'] ) ) { $cron = _upgrade_cron_array( $cron ); } unset( $cron['version'] ); return $cron; } function _set_cron_array( $cron, $wp_error = false ) { if ( ! is_array( $cron ) ) { $cron = array(); } $cron['version'] = 2; $result = update_option( 'cron', $cron ); if ( $wp_error && ! $result ) { return new WP_Error( 'could_not_set', __( 'The cron event list could not be saved.' ) ); } return $result; } function _upgrade_cron_array( $cron ) { if ( isset( $cron['version'] ) && 2 == $cron['version'] ) { return $cron; } $new_cron = array(); foreach ( (array) $cron as $timestamp => $hooks ) { foreach ( (array) $hooks as $hook => $args ) { $key = md5( serialize( $args['args'] ) ); $new_cron[ $timestamp ][ $hook ][ $key ] = $args; } } $new_cron['version'] = 2; update_option( 'cron', $new_cron ); return $new_cron; } + + handlers[ $priority ][ $id ] = array( 'regex' => $regex, 'callback' => $callback, ); } public function unregister_handler( $id, $priority = 10 ) { unset( $this->handlers[ $priority ][ $id ] ); } public function get_embed_handler_html( $attr, $url ) { $rawattr = $attr; $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) ); ksort( $this->handlers ); foreach ( $this->handlers as $priority => $handlers ) { foreach ( $handlers as $id => $handler ) { if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ); if ( false !== $return ) { return apply_filters( 'embed_handler_html', $return, $url, $attr ); } } } } return false; } public function shortcode( $attr, $url = '' ) { $post = get_post(); if ( empty( $url ) && ! empty( $attr['src'] ) ) { $url = $attr['src']; } $this->last_url = $url; if ( empty( $url ) ) { $this->last_attr = $attr; return ''; } $rawattr = $attr; $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) ); $this->last_attr = $attr; $url = str_replace( '&', '&', $url ); $embed_handler_html = $this->get_embed_handler_html( $rawattr, $url ); if ( false !== $embed_handler_html ) { return $embed_handler_html; } $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null; if ( ! empty( $this->post_ID ) ) { $post_ID = $this->post_ID; } $key_suffix = md5( $url . serialize( $attr ) ); $cachekey = '_oembed_' . $key_suffix; $cachekey_time = '_oembed_time_' . $key_suffix; $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID ); $cache = ''; $cache_time = 0; $cached_post_id = $this->find_oembed_post_id( $key_suffix ); if ( $post_ID ) { $cache = get_post_meta( $post_ID, $cachekey, true ); $cache_time = get_post_meta( $post_ID, $cachekey_time, true ); if ( ! $cache_time ) { $cache_time = 0; } } elseif ( $cached_post_id ) { $cached_post = get_post( $cached_post_id ); $cache = $cached_post->post_content; $cache_time = strtotime( $cached_post->post_modified_gmt ); } $cached_recently = ( time() - $cache_time ) < $ttl; if ( $this->usecache || $cached_recently ) { if ( '{{unknown}}' === $cache ) { return $this->maybe_make_link( $url ); } if ( ! empty( $cache ) ) { return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); } } $attr['discover'] = apply_filters( 'embed_oembed_discover', true ); $html = wp_oembed_get( $url, $attr ); if ( $post_ID ) { if ( $html ) { update_post_meta( $post_ID, $cachekey, $html ); update_post_meta( $post_ID, $cachekey_time, time() ); } elseif ( ! $cache ) { update_post_meta( $post_ID, $cachekey, '{{unknown}}' ); } } else { $has_kses = false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ); if ( $has_kses ) { kses_remove_filters(); } $insert_post_args = array( 'post_name' => $key_suffix, 'post_status' => 'publish', 'post_type' => 'oembed_cache', ); if ( $html ) { if ( $cached_post_id ) { wp_update_post( wp_slash( array( 'ID' => $cached_post_id, 'post_content' => $html, ) ) ); } else { wp_insert_post( wp_slash( array_merge( $insert_post_args, array( 'post_content' => $html, ) ) ) ); } } elseif ( ! $cache ) { wp_insert_post( wp_slash( array_merge( $insert_post_args, array( 'post_content' => '{{unknown}}', ) ) ) ); } if ( $has_kses ) { kses_init_filters(); } } if ( $html ) { return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); } return $this->maybe_make_link( $url ); } public function delete_oembed_caches( $post_ID ) { $post_metas = get_post_custom_keys( $post_ID ); if ( empty( $post_metas ) ) { return; } foreach ( $post_metas as $post_meta_key ) { if ( '_oembed_' === substr( $post_meta_key, 0, 8 ) ) { delete_post_meta( $post_ID, $post_meta_key ); } } } public function cache_oembed( $post_ID ) { $post = get_post( $post_ID ); $post_types = get_post_types( array( 'show_ui' => true ) ); $cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types ); if ( empty( $post->ID ) || ! in_array( $post->post_type, $cache_oembed_types, true ) ) { return; } if ( ! empty( $post->post_content ) ) { $this->post_ID = $post->ID; $this->usecache = false; $content = $this->run_shortcode( $post->post_content ); $this->autoembed( $content ); $this->usecache = true; } } public function autoembed( $content ) { $content = wp_replace_in_html_tags( $content, array( "\n" => '' ) ); if ( preg_match( '#(^|\s|>)https?://#i', $content ) ) { $content = preg_replace_callback( '|^(\s*)(https?://[^\s<>"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); $content = preg_replace_callback( '|(]*)?>\s*)(https?://[^\s<>"]+)(\s*<\/p>)|i', array( $this, 'autoembed_callback' ), $content ); } return str_replace( '', "\n", $content ); } public function autoembed_callback( $matches ) { $oldval = $this->linkifunknown; $this->linkifunknown = false; $return = $this->shortcode( array(), $matches[2] ); $this->linkifunknown = $oldval; return $matches[1] . $return . $matches[3]; } public function maybe_make_link( $url ) { if ( $this->return_false_on_fail ) { return false; } $output = ( $this->linkifunknown ) ? '' . esc_html( $url ) . '' : $url; return apply_filters( 'embed_maybe_make_link', $output, $url ); } public function find_oembed_post_id( $cache_key ) { $cache_group = 'oembed_cache_post'; $oembed_post_id = wp_cache_get( $cache_key, $cache_group ); if ( $oembed_post_id && 'oembed_cache' === get_post_type( $oembed_post_id ) ) { return $oembed_post_id; } $oembed_post_query = new WP_Query( array( 'post_type' => 'oembed_cache', 'post_status' => 'publish', 'name' => $cache_key, 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ) ); if ( ! empty( $oembed_post_query->posts ) ) { $oembed_post_id = $oembed_post_query->posts[0]->ID; wp_cache_set( $cache_key, $oembed_post_id, $cache_group ); return $oembed_post_id; } return null; } } queue : (array) $handles; $this->all_deps( $handles ); foreach ( $this->to_do as $key => $handle ) { if ( ! in_array( $handle, $this->done, true ) && isset( $this->registered[ $handle ] ) ) { if ( $this->do_item( $handle, $group ) ) { $this->done[] = $handle; } unset( $this->to_do[ $key ] ); } } return $this->done; } public function do_item( $handle, $group = false ) { return isset( $this->registered[ $handle ] ); } public function all_deps( $handles, $recursion = false, $group = false ) { $handles = (array) $handles; if ( ! $handles ) { return false; } foreach ( $handles as $handle ) { $handle_parts = explode( '?', $handle ); $handle = $handle_parts[0]; $queued = in_array( $handle, $this->to_do, true ); if ( in_array( $handle, $this->done, true ) ) { continue; } $moved = $this->set_group( $handle, $recursion, $group ); $new_group = $this->groups[ $handle ]; if ( $queued && ! $moved ) { continue; } $keep_going = true; if ( ! isset( $this->registered[ $handle ] ) ) { $keep_going = false; } elseif ( $this->registered[ $handle ]->deps && array_diff( $this->registered[ $handle ]->deps, array_keys( $this->registered ) ) ) { $keep_going = false; } elseif ( $this->registered[ $handle ]->deps && ! $this->all_deps( $this->registered[ $handle ]->deps, true, $new_group ) ) { $keep_going = false; } if ( ! $keep_going ) { if ( $recursion ) { return false; } else { continue; } } if ( $queued ) { continue; } if ( isset( $handle_parts[1] ) ) { $this->args[ $handle ] = $handle_parts[1]; } $this->to_do[] = $handle; } return true; } public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { if ( isset( $this->registered[ $handle ] ) ) { return false; } $this->registered[ $handle ] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); if ( array_key_exists( $handle, $this->queued_before_register ) ) { if ( ! is_null( $this->queued_before_register[ $handle ] ) ) { $this->enqueue( $handle . '?' . $this->queued_before_register[ $handle ] ); } else { $this->enqueue( $handle ); } unset( $this->queued_before_register[ $handle ] ); } return true; } public function add_data( $handle, $key, $value ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } return $this->registered[ $handle ]->add_data( $key, $value ); } public function get_data( $handle, $key ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } if ( ! isset( $this->registered[ $handle ]->extra[ $key ] ) ) { return false; } return $this->registered[ $handle ]->extra[ $key ]; } public function remove( $handles ) { foreach ( (array) $handles as $handle ) { unset( $this->registered[ $handle ] ); } } public function enqueue( $handles ) { foreach ( (array) $handles as $handle ) { $handle = explode( '?', $handle ); if ( ! in_array( $handle[0], $this->queue, true ) && isset( $this->registered[ $handle[0] ] ) ) { $this->queue[] = $handle[0]; $this->all_queued_deps = null; if ( isset( $handle[1] ) ) { $this->args[ $handle[0] ] = $handle[1]; } } elseif ( ! isset( $this->registered[ $handle[0] ] ) ) { $this->queued_before_register[ $handle[0] ] = null; if ( isset( $handle[1] ) ) { $this->queued_before_register[ $handle[0] ] = $handle[1]; } } } } public function dequeue( $handles ) { foreach ( (array) $handles as $handle ) { $handle = explode( '?', $handle ); $key = array_search( $handle[0], $this->queue, true ); if ( false !== $key ) { $this->all_queued_deps = null; unset( $this->queue[ $key ] ); unset( $this->args[ $handle[0] ] ); } elseif ( array_key_exists( $handle[0], $this->queued_before_register ) ) { unset( $this->queued_before_register[ $handle[0] ] ); } } } protected function recurse_deps( $queue, $handle ) { if ( isset( $this->all_queued_deps ) ) { return isset( $this->all_queued_deps[ $handle ] ); } $all_deps = array_fill_keys( $queue, true ); $queues = array(); $done = array(); while ( $queue ) { foreach ( $queue as $queued ) { if ( ! isset( $done[ $queued ] ) && isset( $this->registered[ $queued ] ) ) { $deps = $this->registered[ $queued ]->deps; if ( $deps ) { $all_deps += array_fill_keys( $deps, true ); array_push( $queues, $deps ); } $done[ $queued ] = true; } } $queue = array_pop( $queues ); } $this->all_queued_deps = $all_deps; return isset( $this->all_queued_deps[ $handle ] ); } public function query( $handle, $status = 'registered' ) { switch ( $status ) { case 'registered': case 'scripts': if ( isset( $this->registered[ $handle ] ) ) { return $this->registered[ $handle ]; } return false; case 'enqueued': case 'queue': if ( in_array( $handle, $this->queue, true ) ) { return true; } return $this->recurse_deps( $this->queue, $handle ); case 'to_do': case 'to_print': return in_array( $handle, $this->to_do, true ); case 'done': case 'printed': return in_array( $handle, $this->done, true ); } return false; } public function set_group( $handle, $recursion, $group ) { $group = (int) $group; if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) { return false; } $this->groups[ $handle ] = $group; return true; } } true ) ); if ( is_array( $decoded_file ) ) { $config = $decoded_file; } } return $config; } public static function get_fields_to_translate() { _deprecated_function( __METHOD__, '5.9.0' ); return array(); } protected static function translate( $theme_json, $domain = 'default' ) { if ( null === static::$i18n_schema ) { $i18n_schema = wp_json_file_decode( __DIR__ . '/theme-i18n.json' ); static::$i18n_schema = null === $i18n_schema ? array() : $i18n_schema; } return translate_settings_using_i18n_schema( static::$i18n_schema, $theme_json, $domain ); } public static function get_core_data() { if ( null !== static::$core ) { return static::$core; } $config = static::read_json_file( __DIR__ . '/theme.json' ); $config = static::translate( $config ); static::$core = new WP_Theme_JSON( $config, 'default' ); return static::$core; } public static function get_theme_data( $deprecated = array(), $options = array() ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __METHOD__, '5.9.0' ); } $options = wp_parse_args( $options, array( 'with_supports' => true ) ); if ( null === static::$theme ) { $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); static::$theme = new WP_Theme_JSON( $theme_json_data ); if ( wp_get_theme()->parent() ) { $parent_theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json', true ) ); $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) ); $parent_theme = new WP_Theme_JSON( $parent_theme_json_data ); $parent_theme->merge( static::$theme ); static::$theme = $parent_theme; } } if ( ! $options['with_supports'] ) { return static::$theme; } $theme_support_data = WP_Theme_JSON::get_from_editor_settings( get_default_block_editor_settings() ); if ( ! static::theme_has_support() ) { if ( ! isset( $theme_support_data['settings']['color'] ) ) { $theme_support_data['settings']['color'] = array(); } $default_palette = false; if ( current_theme_supports( 'default-color-palette' ) ) { $default_palette = true; } if ( ! isset( $theme_support_data['settings']['color']['palette'] ) ) { $default_palette = true; } $theme_support_data['settings']['color']['defaultPalette'] = $default_palette; $default_gradients = false; if ( current_theme_supports( 'default-gradient-presets' ) ) { $default_gradients = true; } if ( ! isset( $theme_support_data['settings']['color']['gradients'] ) ) { $default_gradients = true; } $theme_support_data['settings']['color']['defaultGradients'] = $default_gradients; $theme_support_data['settings']['color']['defaultDuotone'] = false; } $with_theme_supports = new WP_Theme_JSON( $theme_support_data ); $with_theme_supports->merge( static::$theme ); return $with_theme_supports; } public static function get_user_data_from_wp_global_styles( $theme, $create_post = false, $post_status_filter = array( 'publish' ) ) { if ( ! $theme instanceof WP_Theme ) { $theme = wp_get_theme(); } $user_cpt = array(); $post_type_filter = 'wp_global_styles'; $args = array( 'numberposts' => 1, 'orderby' => 'date', 'order' => 'desc', 'post_type' => $post_type_filter, 'post_status' => $post_status_filter, 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => $theme->get_stylesheet(), ), ), ); $cache_key = sprintf( 'wp_global_styles_%s', md5( serialize( $args ) ) ); $post_id = wp_cache_get( $cache_key ); if ( (int) $post_id > 0 ) { return get_post( $post_id, ARRAY_A ); } if ( -1 === $post_id && ! $create_post ) { return $user_cpt; } $recent_posts = wp_get_recent_posts( $args ); if ( is_array( $recent_posts ) && ( count( $recent_posts ) === 1 ) ) { $user_cpt = $recent_posts[0]; } elseif ( $create_post ) { $cpt_post_id = wp_insert_post( array( 'post_content' => '{"version": ' . WP_Theme_JSON::LATEST_SCHEMA . ', "isGlobalStylesUserThemeJSON": true }', 'post_status' => 'publish', 'post_title' => 'Custom Styles', 'post_type' => $post_type_filter, 'post_name' => 'wp-global-styles-' . urlencode( wp_get_theme()->get_stylesheet() ), 'tax_input' => array( 'wp_theme' => array( wp_get_theme()->get_stylesheet() ), ), ), true ); $user_cpt = get_post( $cpt_post_id, ARRAY_A ); } $cache_expiration = $user_cpt ? DAY_IN_SECONDS : HOUR_IN_SECONDS; wp_cache_set( $cache_key, $user_cpt ? $user_cpt['ID'] : -1, '', $cache_expiration ); return $user_cpt; } public static function get_user_data() { if ( null !== static::$user ) { return static::$user; } $config = array(); $user_cpt = static::get_user_data_from_wp_global_styles( wp_get_theme() ); if ( array_key_exists( 'post_content', $user_cpt ) ) { $decoded_data = json_decode( $user_cpt['post_content'], true ); $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() ); return new WP_Theme_JSON( $config, 'custom' ); } if ( is_array( $decoded_data ) && isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) && $decoded_data['isGlobalStylesUserThemeJSON'] ) { unset( $decoded_data['isGlobalStylesUserThemeJSON'] ); $config = $decoded_data; } } static::$user = new WP_Theme_JSON( $config, 'custom' ); return static::$user; } public static function get_merged_data( $origin = 'custom' ) { if ( is_array( $origin ) ) { _deprecated_argument( __FUNCTION__, '5.9.0' ); } $result = new WP_Theme_JSON(); $result->merge( static::get_core_data() ); $result->merge( static::get_theme_data() ); if ( 'custom' === $origin ) { $result->merge( static::get_user_data() ); } return $result; } public static function get_user_global_styles_post_id() { if ( null !== static::$user_custom_post_type_id ) { return static::$user_custom_post_type_id; } $user_cpt = static::get_user_data_from_wp_global_styles( wp_get_theme(), true ); if ( array_key_exists( 'ID', $user_cpt ) ) { static::$user_custom_post_type_id = $user_cpt['ID']; } return static::$user_custom_post_type_id; } public static function theme_has_support() { if ( ! isset( static::$theme_has_support ) ) { static::$theme_has_support = ( is_readable( static::get_file_path_from_theme( 'theme.json' ) ) || is_readable( static::get_file_path_from_theme( 'theme.json', true ) ) ); } return static::$theme_has_support; } protected static function get_file_path_from_theme( $file_name, $template = false ) { $path = $template ? get_template_directory() : get_stylesheet_directory(); $candidate = $path . '/' . $file_name; return is_readable( $candidate ) ? $candidate : ''; } public static function clean_cached_data() { static::$core = null; static::$theme = null; static::$user = null; static::$user_custom_post_type_id = null; static::$theme_has_support = null; static::$i18n_schema = null; } public static function get_style_variations() { $variations = array(); $base_directory = get_stylesheet_directory() . '/styles'; if ( is_dir( $base_directory ) ) { $nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = iterator_to_array( new RegexIterator( $nested_files, '/^.+\.json$/i', RecursiveRegexIterator::GET_MATCH ) ); ksort( $nested_html_files ); foreach ( $nested_html_files as $path => $file ) { $decoded_file = wp_json_file_decode( $path, array( 'associative' => true ) ); if ( is_array( $decoded_file ) ) { $translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) ); $variation = ( new WP_Theme_JSON( $translated ) )->get_raw_data(); if ( empty( $variation['title'] ) ) { $variation['title'] = basename( $path, '.json' ); } $variations[] = $variation; } } } return $variations; } } add( $code, $message, $data ); } public function get_error_codes() { if ( ! $this->has_errors() ) { return array(); } return array_keys( $this->errors ); } public function get_error_code() { $codes = $this->get_error_codes(); if ( empty( $codes ) ) { return ''; } return $codes[0]; } public function get_error_messages( $code = '' ) { if ( empty( $code ) ) { $all_messages = array(); foreach ( (array) $this->errors as $code => $messages ) { $all_messages = array_merge( $all_messages, $messages ); } return $all_messages; } if ( isset( $this->errors[ $code ] ) ) { return $this->errors[ $code ]; } else { return array(); } } public function get_error_message( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $messages = $this->get_error_messages( $code ); if ( empty( $messages ) ) { return ''; } return $messages[0]; } public function get_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { return $this->error_data[ $code ]; } } public function has_errors() { if ( ! empty( $this->errors ) ) { return true; } return false; } public function add( $code, $message, $data = '' ) { $this->errors[ $code ][] = $message; if ( ! empty( $data ) ) { $this->add_data( $data, $code ); } do_action( 'wp_error_added', $code, $message, $data, $this ); } public function add_data( $data, $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { $this->additional_data[ $code ][] = $this->error_data[ $code ]; } $this->error_data[ $code ] = $data; } public function get_all_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $data = array(); if ( isset( $this->additional_data[ $code ] ) ) { $data = $this->additional_data[ $code ]; } if ( isset( $this->error_data[ $code ] ) ) { $data[] = $this->error_data[ $code ]; } return $data; } public function remove( $code ) { unset( $this->errors[ $code ] ); unset( $this->error_data[ $code ] ); unset( $this->additional_data[ $code ] ); } public function merge_from( WP_Error $error ) { static::copy_errors( $error, $this ); } public function export_to( WP_Error $error ) { static::copy_errors( $this, $error ); } protected static function copy_errors( WP_Error $from, WP_Error $to ) { foreach ( $from->get_error_codes() as $code ) { foreach ( $from->get_error_messages( $code ) as $error_message ) { $to->add( $code, $error_message ); } foreach ( $from->get_all_error_data( $code ) as $data ) { $to->add_data( $data, $code ); } } } } $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->controls = array(); } final public function active() { $section = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_section_active', $active, $section ); return $active; } public function active_callback() { return true; } public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden' ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; if ( $this->panel ) { $array['customizeAction'] = sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); } else { $array['customizeAction'] = __( 'Customizing' ); } return $array; } final public function check_capabilities() { if ( $this->capability && ! current_user_can( $this->capability ) ) { return false; } if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_section', $this ); do_action( "customize_render_section_{$this->id}" ); $this->render(); } protected function render() {} public function print_template() { ?> + + +
        • +

          + {{ data.title }} + +

          +
            + +
          +
        • + link_id, $bookmark, 'bookmark' ); $_bookmark = $bookmark; } else { if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) { $_bookmark = & $GLOBALS['link']; } else { $_bookmark = wp_cache_get( $bookmark, 'bookmark' ); if ( ! $_bookmark ) { $_bookmark = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark ) ); if ( $_bookmark ) { $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); } } } } if ( ! $_bookmark ) { return $_bookmark; } $_bookmark = sanitize_bookmark( $_bookmark, $filter ); if ( OBJECT === $output ) { return $_bookmark; } elseif ( ARRAY_A === $output ) { return get_object_vars( $_bookmark ); } elseif ( ARRAY_N === $output ) { return array_values( get_object_vars( $_bookmark ) ); } else { return $_bookmark; } } function get_bookmark_field( $field, $bookmark, $context = 'display' ) { $bookmark = (int) $bookmark; $bookmark = get_bookmark( $bookmark ); if ( is_wp_error( $bookmark ) ) { return $bookmark; } if ( ! is_object( $bookmark ) ) { return ''; } if ( ! isset( $bookmark->$field ) ) { return ''; } return sanitize_bookmark_field( $field, $bookmark->$field, $bookmark->link_id, $context ); } function get_bookmarks( $args = '' ) { global $wpdb; $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => '', 'search' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $key = md5( serialize( $parsed_args ) ); $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ); if ( 'rand' !== $parsed_args['orderby'] && $cache ) { if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { $bookmarks = $cache[ $key ]; return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args ); } } if ( ! is_array( $cache ) ) { $cache = array(); } $inclusions = ''; if ( ! empty( $parsed_args['include'] ) ) { $parsed_args['exclude'] = ''; $parsed_args['category'] = ''; $parsed_args['category_name'] = ''; $inclinks = wp_parse_id_list( $parsed_args['include'] ); if ( count( $inclinks ) ) { foreach ( $inclinks as $inclink ) { if ( empty( $inclusions ) ) { $inclusions = ' AND ( link_id = ' . $inclink . ' '; } else { $inclusions .= ' OR link_id = ' . $inclink . ' '; } } } } if ( ! empty( $inclusions ) ) { $inclusions .= ')'; } $exclusions = ''; if ( ! empty( $parsed_args['exclude'] ) ) { $exlinks = wp_parse_id_list( $parsed_args['exclude'] ); if ( count( $exlinks ) ) { foreach ( $exlinks as $exlink ) { if ( empty( $exclusions ) ) { $exclusions = ' AND ( link_id <> ' . $exlink . ' '; } else { $exclusions .= ' AND link_id <> ' . $exlink . ' '; } } } } if ( ! empty( $exclusions ) ) { $exclusions .= ')'; } if ( ! empty( $parsed_args['category_name'] ) ) { $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' ); if ( $parsed_args['category'] ) { $parsed_args['category'] = $parsed_args['category']->term_id; } else { $cache[ $key ] = array(); wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); return apply_filters( 'get_bookmarks', array(), $parsed_args ); } } $search = ''; if ( ! empty( $parsed_args['search'] ) ) { $like = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%'; $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like ); } $category_query = ''; $join = ''; if ( ! empty( $parsed_args['category'] ) ) { $incategories = wp_parse_id_list( $parsed_args['category'] ); if ( count( $incategories ) ) { foreach ( $incategories as $incat ) { if ( empty( $category_query ) ) { $category_query = ' AND ( tt.term_id = ' . $incat . ' '; } else { $category_query .= ' OR tt.term_id = ' . $incat . ' '; } } } } if ( ! empty( $category_query ) ) { $category_query .= ") AND taxonomy = 'link_category'"; $join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; } if ( $parsed_args['show_updated'] ) { $recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated '; } else { $recently_updated_test = ''; } $get_updated = ( $parsed_args['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; $orderby = strtolower( $parsed_args['orderby'] ); $length = ''; switch ( $orderby ) { case 'length': $length = ', CHAR_LENGTH(link_name) AS length'; break; case 'rand': $orderby = 'rand()'; break; case 'link_id': $orderby = "$wpdb->links.link_id"; break; default: $orderparams = array(); $keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' ); foreach ( explode( ',', $orderby ) as $ordparam ) { $ordparam = trim( $ordparam ); if ( in_array( 'link_' . $ordparam, $keys, true ) ) { $orderparams[] = 'link_' . $ordparam; } elseif ( in_array( $ordparam, $keys, true ) ) { $orderparams[] = $ordparam; } } $orderby = implode( ',', $orderparams ); } if ( empty( $orderby ) ) { $orderby = 'link_name'; } $order = strtoupper( $parsed_args['order'] ); if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) { $order = 'ASC'; } $visible = ''; if ( $parsed_args['hide_invisible'] ) { $visible = "AND link_visible = 'Y'"; } $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; $query .= " $exclusions $inclusions $search"; $query .= " ORDER BY $orderby $order"; if ( -1 != $parsed_args['limit'] ) { $query .= ' LIMIT ' . absint( $parsed_args['limit'] ); } $results = $wpdb->get_results( $query ); if ( 'rand()' !== $orderby ) { $cache[ $key ] = $results; wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); } return apply_filters( 'get_bookmarks', $results, $parsed_args ); } function sanitize_bookmark( $bookmark, $context = 'display' ) { $fields = array( 'link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated', 'link_rel', 'link_notes', 'link_rss', ); if ( is_object( $bookmark ) ) { $do_object = true; $link_id = $bookmark->link_id; } else { $do_object = false; $link_id = $bookmark['link_id']; } foreach ( $fields as $field ) { if ( $do_object ) { if ( isset( $bookmark->$field ) ) { $bookmark->$field = sanitize_bookmark_field( $field, $bookmark->$field, $link_id, $context ); } } else { if ( isset( $bookmark[ $field ] ) ) { $bookmark[ $field ] = sanitize_bookmark_field( $field, $bookmark[ $field ], $link_id, $context ); } } } return $bookmark; } function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { $int_fields = array( 'link_id', 'link_rating' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } switch ( $field ) { case 'link_category': $value = array_map( 'absint', (array) $value ); return $value; case 'link_visible': $value = preg_replace( '/[^YNyn]/', '', $value ); break; case 'link_target': $targets = array( '_top', '_blank' ); if ( ! in_array( $value, $targets, true ) ) { $value = ''; } break; } if ( 'raw' === $context ) { return $value; } if ( 'edit' === $context ) { $value = apply_filters( "edit_{$field}", $value, $bookmark_id ); if ( 'link_notes' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { $value = apply_filters( "pre_{$field}", $value ); } else { $value = apply_filters( "{$field}", $value, $bookmark_id, $context ); if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function clean_bookmark_cache( $bookmark_id ) { wp_cache_delete( $bookmark_id, 'bookmark' ); wp_cache_delete( 'get_bookmarks', 'bookmark' ); clean_object_term_cache( $bookmark_id, 'link' ); } path ); } if ( ! defined( 'SITECOOKIEPATH' ) ) { define( 'SITECOOKIEPATH', $current_network->path ); } if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) { $site_path = parse_url( get_option( 'siteurl' ), PHP_URL_PATH ); if ( ! is_subdomain_install() || is_string( $site_path ) && trim( $site_path, '/' ) ) { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); } else { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); } } if ( ! defined( 'COOKIE_DOMAIN' ) && is_subdomain_install() ) { if ( ! empty( $current_network->cookie_domain ) ) { define( 'COOKIE_DOMAIN', '.' . $current_network->cookie_domain ); } else { define( 'COOKIE_DOMAIN', '.' . $current_network->domain ); } } } function ms_file_constants() { if ( ! defined( 'WPMU_SENDFILE' ) ) { define( 'WPMU_SENDFILE', false ); } if ( ! defined( 'WPMU_ACCEL_REDIRECT' ) ) { define( 'WPMU_ACCEL_REDIRECT', false ); } } function ms_subdomain_constants() { static $subdomain_error = null; static $subdomain_error_warn = null; if ( false === $subdomain_error ) { return; } if ( $subdomain_error ) { $vhost_deprecated = sprintf( __( 'The constant %1$s is deprecated. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ), 'VHOST', 'SUBDOMAIN_INSTALL', 'wp-config.php', 'is_subdomain_install()' ); if ( $subdomain_error_warn ) { trigger_error( __( 'Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL. The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); } else { _deprecated_argument( 'define()', '3.0.0', $vhost_deprecated ); } return; } if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { $subdomain_error = true; if ( SUBDOMAIN_INSTALL !== ( 'yes' === VHOST ) ) { $subdomain_error_warn = true; } } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { $subdomain_error = false; define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); } elseif ( defined( 'VHOST' ) ) { $subdomain_error = true; define( 'SUBDOMAIN_INSTALL', 'yes' === VHOST ); } else { $subdomain_error = false; define( 'SUBDOMAIN_INSTALL', false ); define( 'VHOST', 'no' ); } } content ) && is_user_logged_in() ) { $_wp_current_template_content = sprintf( __( 'Empty template: %s' ), $block_template->title ); } elseif ( ! empty( $block_template->content ) ) { $_wp_current_template_content = $block_template->content; } if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_success( $block_template ); } } else { if ( $template ) { return $template; } if ( 'index' === $type ) { if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_error( array( 'message' => __( 'No matching template found.' ) ) ); } } else { return ''; } } add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 ); remove_action( 'wp_head', '_wp_render_title_tag', 1 ); add_action( 'wp_head', '_block_template_render_title_tag', 1 ); return ABSPATH . WPINC . '/template-canvas.php'; } function resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) { if ( ! $template_type ) { return null; } if ( empty( $template_hierarchy ) ) { $template_hierarchy = array( $template_type ); } $slugs = array_map( '_strip_template_file_suffix', $template_hierarchy ); $query = array( 'theme' => wp_get_theme()->get_stylesheet(), 'slug__in' => $slugs, ); $templates = get_block_templates( $query ); $slug_priorities = array_flip( $slugs ); usort( $templates, static function ( $template_a, $template_b ) use ( $slug_priorities ) { return $slug_priorities[ $template_a->slug ] - $slug_priorities[ $template_b->slug ]; } ); $theme_base_path = get_stylesheet_directory() . DIRECTORY_SEPARATOR; $parent_theme_base_path = get_template_directory() . DIRECTORY_SEPARATOR; if ( strpos( $fallback_template, $theme_base_path ) === 0 && strpos( $fallback_template, $parent_theme_base_path ) === false ) { $fallback_template_slug = substr( $fallback_template, strpos( $fallback_template, $theme_base_path ) + strlen( $theme_base_path ), -4 ); if ( count( $templates ) && $fallback_template_slug === $templates[0]->slug && 'theme' === $templates[0]->source ) { $template_file = _get_block_template_file( 'wp_template', $fallback_template_slug ); if ( $template_file && get_template() === $template_file['theme'] ) { array_shift( $templates ); } } } return count( $templates ) ? $templates[0] : null; } function _block_template_render_title_tag() { echo '' . wp_get_document_title() . '' . "\n"; } function get_the_block_template_html() { global $_wp_current_template_content; global $wp_embed; if ( ! $_wp_current_template_content ) { if ( is_user_logged_in() ) { return '

          ' . esc_html__( 'No matching template found' ) . '

          '; } return; } $content = $wp_embed->run_shortcode( $_wp_current_template_content ); $content = $wp_embed->autoembed( $content ); $content = do_blocks( $content ); $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = shortcode_unautop( $content ); $content = wp_filter_content_tags( $content ); $content = do_shortcode( $content ); $content = str_replace( ']]>', ']]>', $content ); return '
          ' . $content . '
          '; } function _block_template_viewport_meta_tag() { echo '' . "\n"; } function _strip_template_file_suffix( $template_file ) { return preg_replace( '/\.(php|html)$/', '', $template_file ); } function _block_template_render_without_post_block_context( $context ) { if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) { unset( $context['postId'] ); unset( $context['postType'] ); } return $context; } function _resolve_template_for_new_post( $wp_query ) { if ( ! $wp_query->is_main_query() ) { return; } remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' ); $page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null; $p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null; $post_id = $page_id ? $page_id : $p; $post = get_post( $post_id ); if ( $post && 'auto-draft' === $post->post_status && current_user_can( 'edit_post', $post->ID ) ) { $wp_query->set( 'post_status', 'auto-draft' ); } } function _resolve_home_block_template() { $show_on_front = get_option( 'show_on_front' ); $front_page_id = get_option( 'page_on_front' ); if ( 'page' === $show_on_front && $front_page_id ) { return array( 'postType' => 'page', 'postId' => $front_page_id, ); } $hierarchy = array( 'front-page', 'home', 'index' ); $template = resolve_block_template( 'home', $hierarchy, '' ); if ( ! $template ) { return null; } return array( 'postType' => 'wp_template', 'postId' => $template->id, ); } $value ) { if ( is_string( $value ) ) { $robots_strings[] = "{$directive}:{$value}"; } elseif ( $value ) { $robots_strings[] = $directive; } } if ( empty( $robots_strings ) ) { return; } echo "\n"; } function wp_robots_noindex( array $robots ) { if ( ! get_option( 'blog_public' ) ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_noindex_embeds( array $robots ) { if ( is_embed() ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_noindex_search( array $robots ) { if ( is_search() ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_no_robots( array $robots ) { $robots['noindex'] = true; if ( get_option( 'blog_public' ) ) { $robots['follow'] = true; } else { $robots['nofollow'] = true; } return $robots; } function wp_robots_sensitive_page( array $robots ) { $robots['noindex'] = true; $robots['noarchive'] = true; return $robots; } function wp_robots_max_image_preview_large( array $robots ) { if ( get_option( 'blog_public' ) ) { $robots['max-image-preview'] = 'large'; } return $robots; } itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) $iteration_count_log2 = 8; $this->iteration_count_log2 = $iteration_count_log2; $this->portable_hashes = $portable_hashes; $this->random_state = microtime(); if (function_exists('getmypid')) $this->random_state .= getmypid(); } function PasswordHash($iteration_count_log2, $portable_hashes) { self::__construct($iteration_count_log2, $portable_hashes); } function get_random_bytes($count) { $output = ''; if (@is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb'))) { $output = fread($fh, $count); fclose($fh); } if (strlen($output) < $count) { $output = ''; for ($i = 0; $i < $count; $i += 16) { $this->random_state = md5(microtime() . $this->random_state); $output .= md5($this->random_state, TRUE); } $output = substr($output, 0, $count); } return $output; } function encode64($input, $count) { $output = ''; $i = 0; do { $value = ord($input[$i++]); $output .= $this->itoa64[$value & 0x3f]; if ($i < $count) $value |= ord($input[$i]) << 8; $output .= $this->itoa64[($value >> 6) & 0x3f]; if ($i++ >= $count) break; if ($i < $count) $value |= ord($input[$i]) << 16; $output .= $this->itoa64[($value >> 12) & 0x3f]; if ($i++ >= $count) break; $output .= $this->itoa64[($value >> 18) & 0x3f]; } while ($i < $count); return $output; } function gensalt_private($input) { $output = '$P$'; $output .= $this->itoa64[min($this->iteration_count_log2 + ((PHP_VERSION >= '5') ? 5 : 3), 30)]; $output .= $this->encode64($input, 6); return $output; } function crypt_private($password, $setting) { $output = '*0'; if (substr($setting, 0, 2) === $output) $output = '*1'; $id = substr($setting, 0, 3); if ($id !== '$P$' && $id !== '$H$') return $output; $count_log2 = strpos($this->itoa64, $setting[3]); if ($count_log2 < 7 || $count_log2 > 30) return $output; $count = 1 << $count_log2; $salt = substr($setting, 4, 8); if (strlen($salt) !== 8) return $output; $hash = md5($salt . $password, TRUE); do { $hash = md5($hash . $password, TRUE); } while (--$count); $output = substr($setting, 0, 12); $output .= $this->encode64($hash, 16); return $output; } function gensalt_blowfish($input) { $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $output = '$2a$'; $output .= chr(ord('0') + $this->iteration_count_log2 / 10); $output .= chr(ord('0') + $this->iteration_count_log2 % 10); $output .= '$'; $i = 0; do { $c1 = ord($input[$i++]); $output .= $itoa64[$c1 >> 2]; $c1 = ($c1 & 0x03) << 4; if ($i >= 16) { $output .= $itoa64[$c1]; break; } $c2 = ord($input[$i++]); $c1 |= $c2 >> 4; $output .= $itoa64[$c1]; $c1 = ($c2 & 0x0f) << 2; $c2 = ord($input[$i++]); $c1 |= $c2 >> 6; $output .= $itoa64[$c1]; $output .= $itoa64[$c2 & 0x3f]; } while (1); return $output; } function HashPassword($password) { if ( strlen( $password ) > 4096 ) { return '*'; } $random = ''; if (CRYPT_BLOWFISH === 1 && !$this->portable_hashes) { $random = $this->get_random_bytes(16); $hash = crypt($password, $this->gensalt_blowfish($random)); if (strlen($hash) === 60) return $hash; } if (strlen($random) < 6) $random = $this->get_random_bytes(6); $hash = $this->crypt_private($password, $this->gensalt_private($random)); if (strlen($hash) === 34) return $hash; return '*'; } function CheckPassword($password, $stored_hash) { if ( strlen( $password ) > 4096 ) { return false; } $hash = $this->crypt_private($password, $stored_hash); if ($hash[0] === '*') $hash = crypt($password, $stored_hash); return $hash === $stored_hash; } } initialize(); $wp_admin_bar->add_menus(); return true; } function wp_admin_bar_render() { global $wp_admin_bar; static $rendered = false; if ( $rendered ) { return; } if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) { return; } do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) ); do_action( 'wp_before_admin_bar_render' ); $wp_admin_bar->render(); do_action( 'wp_after_admin_bar_render' ); $rendered = true; } function wp_admin_bar_wp_menu( $wp_admin_bar ) { if ( current_user_can( 'read' ) ) { $about_url = self_admin_url( 'about.php' ); } elseif ( is_multisite() ) { $about_url = get_dashboard_url( get_current_user_id(), 'about.php' ); } else { $about_url = false; } $wp_logo_menu_args = array( 'id' => 'wp-logo', 'title' => '' . __( 'About WordPress' ) . '', 'href' => $about_url, ); if ( ! $about_url ) { $wp_logo_menu_args['meta'] = array( 'tabindex' => 0, ); } $wp_admin_bar->add_node( $wp_logo_menu_args ); if ( $about_url ) { $wp_admin_bar->add_node( array( 'parent' => 'wp-logo', 'id' => 'about', 'title' => __( 'About WordPress' ), 'href' => $about_url, ) ); } $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'wporg', 'title' => __( 'WordPress.org' ), 'href' => __( 'https://wordpress.org/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'documentation', 'title' => __( 'Documentation' ), 'href' => __( 'https://wordpress.org/support/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'support-forums', 'title' => __( 'Support' ), 'href' => __( 'https://wordpress.org/support/forums/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'feedback', 'title' => __( 'Feedback' ), 'href' => __( 'https://wordpress.org/support/forum/requests-and-feedback' ), ) ); } function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) { if ( is_admin() ) { $wp_admin_bar->add_node( array( 'id' => 'menu-toggle', 'title' => '' . __( 'Menu' ) . '', 'href' => '#', ) ); } } function wp_admin_bar_my_account_item( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $avatar = get_avatar( $user_id, 26 ); $howdy = sprintf( __( 'Howdy, %s' ), '' . $current_user->display_name . '' ); $class = empty( $avatar ) ? '' : 'with-avatar'; $wp_admin_bar->add_node( array( 'id' => 'my-account', 'parent' => 'top-secondary', 'title' => $howdy . $avatar, 'href' => $profile_url, 'meta' => array( 'class' => $class, ), ) ); } function wp_admin_bar_my_account_menu( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $wp_admin_bar->add_group( array( 'parent' => 'my-account', 'id' => 'user-actions', ) ); $user_info = get_avatar( $user_id, 64 ); $user_info .= "{$current_user->display_name}"; if ( $current_user->display_name !== $current_user->user_login ) { $user_info .= "{$current_user->user_login}"; } $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'user-info', 'title' => $user_info, 'href' => $profile_url, 'meta' => array( 'tabindex' => -1, ), ) ); if ( false !== $profile_url ) { $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'edit-profile', 'title' => __( 'Edit Profile' ), 'href' => $profile_url, ) ); } $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'logout', 'title' => __( 'Log Out' ), 'href' => wp_logout_url(), ) ); } function wp_admin_bar_site_menu( $wp_admin_bar ) { if ( ! is_user_logged_in() ) { return; } if ( ! is_user_member_of_blog() && ! current_user_can( 'manage_network' ) ) { return; } $blogname = get_bloginfo( 'name' ); if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); } if ( is_network_admin() ) { $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) ); } elseif ( is_user_admin() ) { $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) ); } $title = wp_html_excerpt( $blogname, 40, '…' ); $wp_admin_bar->add_node( array( 'id' => 'site-name', 'title' => $title, 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), ) ); if ( is_admin() ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'edit-site', 'title' => __( 'Edit Site' ), 'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ), ) ); } } elseif ( current_user_can( 'read' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); wp_admin_bar_appearance_menu( $wp_admin_bar ); } } function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { if ( ! wp_is_block_theme() ) { return; } if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { return; } $wp_admin_bar->add_node( array( 'id' => 'site-editor', 'title' => __( 'Edit site' ), 'href' => admin_url( 'site-editor.php' ), ) ); } function wp_admin_bar_customize_menu( $wp_admin_bar ) { global $wp_customize; if ( wp_is_block_theme() && ! has_action( 'customize_register' ) ) { return; } if ( ! current_user_can( 'customize' ) || is_admin() ) { return; } if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { return; } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ( is_customize_preview() && $wp_customize->changeset_uuid() ) { $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url ); } $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); if ( is_customize_preview() ) { $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url ); } $wp_admin_bar->add_node( array( 'id' => 'customize', 'title' => __( 'Customize' ), 'href' => $customize_url, 'meta' => array( 'class' => 'hide-if-no-customize', ), ) ); add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); } function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { if ( ! is_user_logged_in() || ! is_multisite() ) { return; } if ( count( $wp_admin_bar->user->blogs ) < 1 && ! current_user_can( 'manage_network' ) ) { return; } if ( $wp_admin_bar->user->active_blog ) { $my_sites_url = get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' ); } else { $my_sites_url = admin_url( 'my-sites.php' ); } $wp_admin_bar->add_node( array( 'id' => 'my-sites', 'title' => __( 'My Sites' ), 'href' => $my_sites_url, ) ); if ( current_user_can( 'manage_network' ) ) { $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-super-admin', ) ); $wp_admin_bar->add_node( array( 'parent' => 'my-sites-super-admin', 'id' => 'network-admin', 'title' => __( 'Network Admin' ), 'href' => network_admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-d', 'title' => __( 'Dashboard' ), 'href' => network_admin_url(), ) ); if ( current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-s', 'title' => __( 'Sites' ), 'href' => network_admin_url( 'sites.php' ), ) ); } if ( current_user_can( 'manage_network_users' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-u', 'title' => __( 'Users' ), 'href' => network_admin_url( 'users.php' ), ) ); } if ( current_user_can( 'manage_network_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-t', 'title' => __( 'Themes' ), 'href' => network_admin_url( 'themes.php' ), ) ); } if ( current_user_can( 'manage_network_plugins' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-p', 'title' => __( 'Plugins' ), 'href' => network_admin_url( 'plugins.php' ), ) ); } if ( current_user_can( 'manage_network_options' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-o', 'title' => __( 'Settings' ), 'href' => network_admin_url( 'settings.php' ), ) ); } } $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-list', 'meta' => array( 'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '', ), ) ); $show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true ); foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { switch_to_blog( $blog->userblog_id ); if ( true === $show_site_icons && has_site_icon() ) { $blavatar = sprintf( '', esc_url( get_site_icon_url( 16 ) ), esc_url( get_site_icon_url( 32 ) ), ( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' ) ); } else { $blavatar = '
          '; } $blogname = $blog->blogname; if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); } $menu_id = 'blog-' . $blog->userblog_id; if ( current_user_can( 'read' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-d', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); } else { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => home_url(), ) ); } if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-n', 'title' => get_post_type_object( 'post' )->labels->new_item, 'href' => admin_url( 'post-new.php' ), ) ); } if ( current_user_can( 'edit_posts' ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url( 'edit-comments.php' ), ) ); } $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-v', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); restore_current_blog(); } } function wp_admin_bar_shortlink_menu( $wp_admin_bar ) { $short = wp_get_shortlink( 0, 'query' ); $id = 'get-shortlink'; if ( empty( $short ) ) { return; } $html = ''; $wp_admin_bar->add_node( array( 'id' => $id, 'title' => __( 'Shortlink' ), 'href' => $short, 'meta' => array( 'html' => $html ), ) ); } function wp_admin_bar_edit_menu( $wp_admin_bar ) { global $tag, $wp_the_query, $user_id, $post_id; if ( is_admin() ) { $current_screen = get_current_screen(); $post = get_post(); $post_type_object = null; if ( 'post' === $current_screen->base ) { $post_type_object = get_post_type_object( $post->post_type ); } elseif ( 'edit' === $current_screen->base ) { $post_type_object = get_post_type_object( $current_screen->post_type ); } elseif ( 'edit-comments' === $current_screen->base && $post_id ) { $post = get_post( $post_id ); if ( $post ) { $post_type_object = get_post_type_object( $post->post_type ); } } if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base ) && 'add' !== $current_screen->action && ( $post_type_object ) && current_user_can( 'read_post', $post->ID ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) ) { if ( 'draft' === $post->post_status ) { $preview_link = get_preview_post_link( $post ); $wp_admin_bar->add_node( array( 'id' => 'preview', 'title' => $post_type_object->labels->view_item, 'href' => esc_url( $preview_link ), 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), ) ); } else { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $post_type_object->labels->view_item, 'href' => get_permalink( $post->ID ), ) ); } } elseif ( 'edit' === $current_screen->base && ( $post_type_object ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) && ( get_post_type_archive_link( $post_type_object->name ) ) && ! ( 'post' === $post_type_object->name && 'posts' === get_option( 'show_on_front' ) ) ) { $wp_admin_bar->add_node( array( 'id' => 'archive', 'title' => $post_type_object->labels->view_items, 'href' => get_post_type_archive_link( $current_screen->post_type ), ) ); } elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) { $tax = get_taxonomy( $tag->taxonomy ); if ( is_taxonomy_viewable( $tax ) ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $tax->labels->view_item, 'href' => get_term_link( $tag ), ) ); } } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) { $user_object = get_userdata( $user_id ); $view_link = get_author_posts_url( $user_object->ID ); if ( $user_object->exists() && $view_link ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => __( 'View User' ), 'href' => $view_link, ) ); } } } else { $current_object = $wp_the_query->get_queried_object(); if ( empty( $current_object ) ) { return; } if ( ! empty( $current_object->post_type ) ) { $post_type_object = get_post_type_object( $current_object->post_type ); $edit_post_link = get_edit_post_link( $current_object->ID ); if ( $post_type_object && $edit_post_link && current_user_can( 'edit_post', $current_object->ID ) && $post_type_object->show_in_admin_bar ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => $edit_post_link, ) ); } } elseif ( ! empty( $current_object->taxonomy ) ) { $tax = get_taxonomy( $current_object->taxonomy ); $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ); if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => $edit_term_link, ) ); } } elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) { $edit_user_link = get_edit_user_link( $current_object->ID ); if ( $edit_user_link ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => __( 'Edit User' ), 'href' => $edit_user_link, ) ); } } } } function wp_admin_bar_new_content_menu( $wp_admin_bar ) { $actions = array(); $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ); if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->create_posts ) ) { $actions['post-new.php'] = array( $cpts['post']->labels->name_admin_bar, 'new-post' ); } if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) ) { $actions['media-new.php'] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' ); } if ( current_user_can( 'manage_links' ) ) { $actions['link-add.php'] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); } if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->create_posts ) ) { $actions['post-new.php?post_type=page'] = array( $cpts['page']->labels->name_admin_bar, 'new-page' ); } unset( $cpts['post'], $cpts['page'], $cpts['attachment'] ); foreach ( $cpts as $cpt ) { if ( ! current_user_can( $cpt->cap->create_posts ) ) { continue; } $key = 'post-new.php?post_type=' . $cpt->name; $actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name ); } if ( isset( $actions['post-new.php?post_type=content'] ) ) { $actions['post-new.php?post_type=content'][1] = 'add-new-content'; } if ( current_user_can( 'create_users' ) || ( is_multisite() && current_user_can( 'promote_users' ) ) ) { $actions['user-new.php'] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); } if ( ! $actions ) { return; } $title = '' . _x( 'New', 'admin bar menu group label' ) . ''; $wp_admin_bar->add_node( array( 'id' => 'new-content', 'title' => $title, 'href' => admin_url( current( array_keys( $actions ) ) ), ) ); foreach ( $actions as $link => $action ) { list( $title, $id ) = $action; $wp_admin_bar->add_node( array( 'parent' => 'new-content', 'id' => $id, 'title' => $title, 'href' => admin_url( $link ), ) ); } } function wp_admin_bar_comments_menu( $wp_admin_bar ) { if ( ! current_user_can( 'edit_posts' ) ) { return; } $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $awaiting_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) ); $icon = ''; $title = ''; $title .= '' . $awaiting_text . ''; $wp_admin_bar->add_node( array( 'id' => 'comments', 'title' => $icon . $title, 'href' => admin_url( 'edit-comments.php' ), ) ); } function wp_admin_bar_appearance_menu( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance', ) ); if ( current_user_can( 'switch_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ), ) ); } if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ), ) ); } if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ), ) ); } if ( current_theme_supports( 'custom-background' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __( 'Background' ), 'href' => admin_url( 'themes.php?page=custom-background' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } if ( current_theme_supports( 'custom-header' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __( 'Header' ), 'href' => admin_url( 'themes.php?page=custom-header' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } } function wp_admin_bar_updates_menu( $wp_admin_bar ) { $update_data = wp_get_update_data(); if ( ! $update_data['counts']['total'] ) { return; } $updates_text = sprintf( _n( '%s update available', '%s updates available', $update_data['counts']['total'] ), number_format_i18n( $update_data['counts']['total'] ) ); $icon = ''; $title = ''; $title .= '' . $updates_text . ''; $wp_admin_bar->add_node( array( 'id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url( 'update-core.php' ), ) ); } function wp_admin_bar_search_menu( $wp_admin_bar ) { if ( is_admin() ) { return; } $form = '
          '; $form .= ''; $form .= ''; $form .= ''; $form .= '
          '; $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'search', 'title' => $form, 'meta' => array( 'class' => 'admin-bar-search', 'tabindex' => -1, ), ) ); } function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) { if ( ! wp_is_recovery_mode() ) { return; } $url = wp_login_url(); $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url ); $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION ); $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'recovery-mode', 'title' => __( 'Exit Recovery Mode' ), 'href' => $url, ) ); } function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'id' => 'top-secondary', 'meta' => array( 'class' => 'ab-top-secondary', ), ) ); $wp_admin_bar->add_group( array( 'parent' => 'wp-logo', 'id' => 'wp-logo-external', 'meta' => array( 'class' => 'ab-sub-secondary', ), ) ); } function wp_admin_bar_header() { $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; ?> + media="print">#wpadminbar { display:none; } + + media="screen"> + html { margin-top: 32px !important; } + @media screen and ( max-width: 782px ) { + html { margin-top: 46px !important; } } + + $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; if ( ! isset( $this->settings ) ) { $this->settings = $id; } $settings = array(); if ( is_array( $this->settings ) ) { foreach ( $this->settings as $key => $setting ) { $settings[ $key ] = $this->manager->get_setting( $setting ); } } elseif ( is_string( $this->settings ) ) { $this->setting = $this->manager->get_setting( $this->settings ); $settings['default'] = $this->setting; } $this->settings = $settings; } public function enqueue() {} final public function active() { $control = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_control_active', $active, $control ); return $active; } public function active_callback() { return true; } final public function value( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) ) { return $this->settings[ $setting_key ]->value(); } } public function to_json() { $this->json['settings'] = array(); foreach ( $this->settings as $key => $setting ) { $this->json['settings'][ $key ] = $setting->id; } $this->json['type'] = $this->type; $this->json['priority'] = $this->priority; $this->json['active'] = $this->active(); $this->json['section'] = $this->section; $this->json['content'] = $this->get_content(); $this->json['label'] = $this->label; $this->json['description'] = $this->description; $this->json['instanceNumber'] = $this->instance_number; if ( 'dropdown-pages' === $this->type ) { $this->json['allow_addition'] = $this->allow_addition; } } public function json() { $this->to_json(); return $this->json; } final public function check_capabilities() { if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { return false; } foreach ( $this->settings as $setting ) { if ( ! $setting || ! $setting->check_capabilities() ) { return false; } } $section = $this->manager->get_section( $this->section ); if ( isset( $section ) && ! $section->check_capabilities() ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_control', $this ); do_action( "customize_render_control_{$this->id}", $this ); $this->render(); } protected function render() { $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); $class = 'customize-control customize-control-' . $this->type; printf( '
        • ', esc_attr( $id ), esc_attr( $class ) ); $this->render_content(); echo '
        • '; } public function get_link( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof WP_Customize_Setting ) { return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; } else { return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"'; } } public function link( $setting_key = 'default' ) { echo $this->get_link( $setting_key ); } public function input_attrs() { foreach ( $this->input_attrs as $attr => $value ) { echo $attr . '="' . esc_attr( $value ) . '" '; } } protected function render_content() { $input_id = '_customize-input-' . $this->id; $description_id = '_customize-description-' . $this->id; $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; switch ( $this->type ) { case 'checkbox': ?> + + + type="checkbox" + value="value() ); ?>" + link(); ?> + value() ); ?> + /> + + description ) ) : ?> + description; ?> + + + choices ) ) { return; } $name = '_customize-radio-' . $this->id; ?> + label ) ) : ?> + label ); ?> + + description ) ) : ?> + description; ?> + - .wp-core-ui select, - .wp-admin .form-table select { - min-height: 40px; - font-size: 16px; - line-height: 1.625; /* 26px */ - padding: 5px 8px 5px 24px; - } + choices as $value => $label ) : ?> + + + value="" + name="" + link(); ?> + value(), $value ); ?> + /> + + + + choices ) ) { return; } ?> + label ) ) : ?> + + + description ) ) : ?> + description; ?> + - .wp-admin .button-cancel { - margin-bottom: 0; - padding: 2px 0; - font-size: 14px; - vertical-align: middle; - } + + + label ) ) : ?> + + + description ) ) : ?> + description; ?> + + + + label ) ) : ?> + + + description ) ) : ?> + description; ?> + - #adduser .form-field input, - #createuser .form-field input { - width: 100%; + id; $show_option_none = __( '— Select —' ); $option_none_value = '0'; $dropdown = wp_dropdown_pages( array( 'name' => $dropdown_name, 'echo' => 0, 'show_option_none' => $show_option_none, 'option_none_value' => $option_none_value, 'selected' => $this->value(), ) ); if ( empty( $dropdown ) ) { $dropdown = sprintf( ''; } $dropdown = str_replace( 'get_link() . ' id="' . esc_attr( $input_id ) . '" ' . $describedby_attr, $dropdown ); $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' ); if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) { $auto_draft_page_options = ''; foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) { $post = get_post( $auto_draft_page_id ); if ( $post && 'page' === $post->post_type ) { $auto_draft_page_options .= sprintf( '', esc_attr( $post->ID ), esc_html( $post->post_title ) ); } } if ( $auto_draft_page_options ) { $dropdown = str_replace( '', $auto_draft_page_options . '', $dropdown ); } } echo $dropdown; ?> + allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : ?> + +
          + + + +
          + + + label ) ) : ?> + + + description ) ) : ?> + description; ?> + + + input_attrs(); ?> + input_attrs['value'] ) ) : ?> + value="value() ); ?>" + + link(); ?> + /> + + + output = $input; $this->input = $input; } public function get_input() { return $this->input; } public function get_output() { return $this->output; } public function filter( $args = array(), $operator = 'AND' ) { if ( empty( $args ) ) { return $this->output; } $operator = strtoupper( $operator ); if ( ! in_array( $operator, array( 'AND', 'OR', 'NOT' ), true ) ) { $this->output = array(); return $this->output; } $count = count( $args ); $filtered = array(); foreach ( $this->output as $key => $obj ) { $matched = 0; foreach ( $args as $m_key => $m_value ) { if ( is_array( $obj ) ) { if ( array_key_exists( $m_key, $obj ) && ( $m_value == $obj[ $m_key ] ) ) { $matched++; } } elseif ( is_object( $obj ) ) { if ( isset( $obj->{$m_key} ) && ( $m_value == $obj->{$m_key} ) ) { $matched++; } } } if ( ( 'AND' === $operator && $matched === $count ) || ( 'OR' === $operator && $matched > 0 ) || ( 'NOT' === $operator && 0 === $matched ) ) { $filtered[ $key ] = $obj; } } $this->output = $filtered; return $this->output; } public function pluck( $field, $index_key = null ) { $newlist = array(); if ( ! $index_key ) { foreach ( $this->output as $key => $value ) { if ( is_object( $value ) ) { $newlist[ $key ] = $value->$field; } else { $newlist[ $key ] = $value[ $field ]; } } $this->output = $newlist; return $this->output; } foreach ( $this->output as $value ) { if ( is_object( $value ) ) { if ( isset( $value->$index_key ) ) { $newlist[ $value->$index_key ] = $value->$field; } else { $newlist[] = $value->$field; } } else { if ( isset( $value[ $index_key ] ) ) { $newlist[ $value[ $index_key ] ] = $value[ $field ]; } else { $newlist[] = $value[ $field ]; } } } $this->output = $newlist; return $this->output; } public function sort( $orderby = array(), $order = 'ASC', $preserve_keys = false ) { if ( empty( $orderby ) ) { return $this->output; } if ( is_string( $orderby ) ) { $orderby = array( $orderby => $order ); } foreach ( $orderby as $field => $direction ) { $orderby[ $field ] = 'DESC' === strtoupper( $direction ) ? 'DESC' : 'ASC'; } $this->orderby = $orderby; if ( $preserve_keys ) { uasort( $this->output, array( $this, 'sort_callback' ) ); } else { usort( $this->output, array( $this, 'sort_callback' ) ); } $this->orderby = array(); return $this->output; } private function sort_callback( $a, $b ) { if ( empty( $this->orderby ) ) { return 0; } $a = (array) $a; $b = (array) $b; foreach ( $this->orderby as $field => $direction ) { if ( ! isset( $a[ $field ] ) || ! isset( $b[ $field ] ) ) { continue; } if ( $a[ $field ] == $b[ $field ] ) { continue; } $results = 'DESC' === $direction ? array( 1, -1 ) : array( -1, 1 ); if ( is_numeric( $a[ $field ] ) && is_numeric( $b[ $field ] ) ) { return ( $a[ $field ] < $b[ $field ] ) ? $results[0] : $results[1]; } return 0 > strcmp( $a[ $field ], $b[ $field ] ) ? $results[0] : $results[1]; } return 0; } } ID = $post->ID; $this->user_id = $post->post_author; $this->email = $post->post_title; $this->action_name = $post->post_name; $this->status = $post->post_status; $this->created_timestamp = strtotime( $post->post_date_gmt ); $this->modified_timestamp = strtotime( $post->post_modified_gmt ); $this->confirmed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_confirmed_timestamp', true ); $this->completed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_completed_timestamp', true ); $this->request_data = json_decode( $post->post_content, true ); $this->confirm_key = $post->post_password; } } init(); do_action( 'wp_sitemaps_init', $wp_sitemaps ); } return $wp_sitemaps; } function wp_get_sitemap_providers() { $sitemaps = wp_sitemaps_get_server(); return $sitemaps->registry->get_providers(); } function wp_register_sitemap_provider( $name, WP_Sitemaps_Provider $provider ) { $sitemaps = wp_sitemaps_get_server(); return $sitemaps->registry->add_provider( $name, $provider ); } function wp_sitemaps_get_max_urls( $object_type ) { return apply_filters( 'wp_sitemaps_max_urls', 2000, $object_type ); } function get_sitemap_url( $name, $subtype_name = '', $page = 1 ) { $sitemaps = wp_sitemaps_get_server(); if ( ! $sitemaps ) { return false; } if ( 'index' === $name ) { return $sitemaps->index->get_index_url(); } $provider = $sitemaps->registry->get_provider( $name ); if ( ! $provider ) { return false; } if ( $subtype_name && ! in_array( $subtype_name, array_keys( $provider->get_object_subtypes() ), true ) ) { return false; } $page = absint( $page ); if ( 0 >= $page ) { $page = 1; } return $provider->get_sitemap_url( $subtype_name, $page ); } add( $args ); } } public function add( $args = '' ) { $defaults = array( 'what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); $position = preg_replace( '/[^a-z0-9:_-]/i', '', $parsed_args['position'] ); $id = $parsed_args['id']; $what = $parsed_args['what']; $action = $parsed_args['action']; $old_id = $parsed_args['old_id']; $data = $parsed_args['data']; if ( is_wp_error( $id ) ) { $data = $id; $id = 0; } $response = ''; if ( is_wp_error( $data ) ) { foreach ( (array) $data->get_error_codes() as $code ) { $response .= "get_error_message( $code ) . ']]>'; $error_data = $data->get_error_data( $code ); if ( ! $error_data ) { continue; } $class = ''; if ( is_object( $error_data ) ) { $class = ' class="' . get_class( $error_data ) . '"'; $error_data = get_object_vars( $error_data ); } $response .= ""; if ( is_scalar( $error_data ) ) { $response .= ""; } elseif ( is_array( $error_data ) ) { foreach ( $error_data as $k => $v ) { $response .= "<$k>"; } } $response .= ''; } } else { $response = ""; } $s = ''; if ( is_array( $parsed_args['supplemental'] ) ) { foreach ( $parsed_args['supplemental'] as $k => $v ) { $s .= "<$k>"; } $s = "$s"; } if ( false === $action ) { $action = $_POST['action']; } $x = ''; $x .= ""; $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; $x .= $response; $x .= $s; $x .= ""; $x .= ''; $this->responses[] = $x; return $x; } public function send() { header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); echo ""; foreach ( (array) $this->responses as $response ) { echo $response; } echo ''; if ( wp_doing_ajax() ) { wp_die(); } else { die(); } } } 'post_parent', 'id' => 'ID', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $indent = str_repeat( $t, $depth ); $output .= "{$n}{$indent}
            {$n}"; } public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $indent = str_repeat( $t, $depth ); $output .= "{$indent}
          {$n}"; } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $page = $data_object; $current_page_id = $current_object_id; if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } if ( $depth ) { $indent = str_repeat( $t, $depth ); } else { $indent = ''; } $css_class = array( 'page_item', 'page-item-' . $page->ID ); if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { $css_class[] = 'page_item_has_children'; } if ( ! empty( $current_page_id ) ) { $_current_page = get_post( $current_page_id ); if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) { $css_class[] = 'current_page_ancestor'; } if ( $page->ID == $current_page_id ) { $css_class[] = 'current_page_item'; } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) { $css_class[] = 'current_page_parent'; } } elseif ( get_option( 'page_for_posts' ) == $page->ID ) { $css_class[] = 'current_page_parent'; } $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page_id ) ); $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; if ( '' === $page->post_title ) { $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); } $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; $atts = array(); $atts['href'] = get_permalink( $page->ID ); $atts['aria-current'] = ( $page->ID == $current_page_id ) ? 'page' : ''; $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page_id ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $output .= $indent . sprintf( '%s%s%s', $css_classes, $attributes, $args['link_before'], apply_filters( 'the_title', $page->post_title, $page->ID ), $args['link_after'] ); if ( ! empty( $args['show_date'] ) ) { if ( 'modified' === $args['show_date'] ) { $time = $page->post_modified; } else { $time = $page->post_date; } $date_format = empty( $args['date_format'] ) ? '' : $args['date_format']; $output .= ' ' . mysql2date( $date_format, $time ); } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $output .= "{$n}"; } } array( 'color', 'palette' ), 'prevent_override' => array( 'color', 'defaultPalette' ), 'use_default_names' => false, 'value_key' => 'color', 'css_vars' => '--wp--preset--color--$slug', 'classes' => array( '.has-$slug-color' => 'color', '.has-$slug-background-color' => 'background-color', '.has-$slug-border-color' => 'border-color', ), 'properties' => array( 'color', 'background-color', 'border-color' ), ), array( 'path' => array( 'color', 'gradients' ), 'prevent_override' => array( 'color', 'defaultGradients' ), 'use_default_names' => false, 'value_key' => 'gradient', 'css_vars' => '--wp--preset--gradient--$slug', 'classes' => array( '.has-$slug-gradient-background' => 'background' ), 'properties' => array( 'background' ), ), array( 'path' => array( 'color', 'duotone' ), 'prevent_override' => array( 'color', 'defaultDuotone' ), 'use_default_names' => false, 'value_func' => 'wp_get_duotone_filter_property', 'css_vars' => '--wp--preset--duotone--$slug', 'classes' => array(), 'properties' => array( 'filter' ), ), array( 'path' => array( 'typography', 'fontSizes' ), 'prevent_override' => false, 'use_default_names' => true, 'value_key' => 'size', 'css_vars' => '--wp--preset--font-size--$slug', 'classes' => array( '.has-$slug-font-size' => 'font-size' ), 'properties' => array( 'font-size' ), ), array( 'path' => array( 'typography', 'fontFamilies' ), 'prevent_override' => false, 'use_default_names' => false, 'value_key' => 'fontFamily', 'css_vars' => '--wp--preset--font-family--$slug', 'classes' => array( '.has-$slug-font-family' => 'font-family' ), 'properties' => array( 'font-family' ), ), ); const PROPERTIES_METADATA = array( 'background' => array( 'color', 'gradient' ), 'background-color' => array( 'color', 'background' ), 'border-radius' => array( 'border', 'radius' ), 'border-top-left-radius' => array( 'border', 'radius', 'topLeft' ), 'border-top-right-radius' => array( 'border', 'radius', 'topRight' ), 'border-bottom-left-radius' => array( 'border', 'radius', 'bottomLeft' ), 'border-bottom-right-radius' => array( 'border', 'radius', 'bottomRight' ), 'border-color' => array( 'border', 'color' ), 'border-width' => array( 'border', 'width' ), 'border-style' => array( 'border', 'style' ), 'color' => array( 'color', 'text' ), 'font-family' => array( 'typography', 'fontFamily' ), 'font-size' => array( 'typography', 'fontSize' ), 'font-style' => array( 'typography', 'fontStyle' ), 'font-weight' => array( 'typography', 'fontWeight' ), 'letter-spacing' => array( 'typography', 'letterSpacing' ), 'line-height' => array( 'typography', 'lineHeight' ), 'margin' => array( 'spacing', 'margin' ), 'margin-top' => array( 'spacing', 'margin', 'top' ), 'margin-right' => array( 'spacing', 'margin', 'right' ), 'margin-bottom' => array( 'spacing', 'margin', 'bottom' ), 'margin-left' => array( 'spacing', 'margin', 'left' ), 'padding' => array( 'spacing', 'padding' ), 'padding-top' => array( 'spacing', 'padding', 'top' ), 'padding-right' => array( 'spacing', 'padding', 'right' ), 'padding-bottom' => array( 'spacing', 'padding', 'bottom' ), 'padding-left' => array( 'spacing', 'padding', 'left' ), '--wp--style--block-gap' => array( 'spacing', 'blockGap' ), 'text-decoration' => array( 'typography', 'textDecoration' ), 'text-transform' => array( 'typography', 'textTransform' ), 'filter' => array( 'filter', 'duotone' ), ); const PROTECTED_PROPERTIES = array( 'spacing.blockGap' => array( 'spacing', 'blockGap' ), ); const VALID_TOP_LEVEL_KEYS = array( 'customTemplates', 'patterns', 'settings', 'styles', 'templateParts', 'version', 'title', ); const VALID_SETTINGS = array( 'appearanceTools' => null, 'border' => array( 'color' => null, 'radius' => null, 'style' => null, 'width' => null, ), 'color' => array( 'background' => null, 'custom' => null, 'customDuotone' => null, 'customGradient' => null, 'defaultDuotone' => null, 'defaultGradients' => null, 'defaultPalette' => null, 'duotone' => null, 'gradients' => null, 'link' => null, 'palette' => null, 'text' => null, ), 'custom' => null, 'layout' => array( 'contentSize' => null, 'wideSize' => null, ), 'spacing' => array( 'blockGap' => null, 'margin' => null, 'padding' => null, 'units' => null, ), 'typography' => array( 'customFontSize' => null, 'dropCap' => null, 'fontFamilies' => null, 'fontSizes' => null, 'fontStyle' => null, 'fontWeight' => null, 'letterSpacing' => null, 'lineHeight' => null, 'textDecoration' => null, 'textTransform' => null, ), ); const VALID_STYLES = array( 'border' => array( 'color' => null, 'radius' => null, 'style' => null, 'width' => null, ), 'color' => array( 'background' => null, 'gradient' => null, 'text' => null, ), 'filter' => array( 'duotone' => null, ), 'spacing' => array( 'margin' => null, 'padding' => null, 'blockGap' => 'top', ), 'typography' => array( 'fontFamily' => null, 'fontSize' => null, 'fontStyle' => null, 'fontWeight' => null, 'letterSpacing' => null, 'lineHeight' => null, 'textDecoration' => null, 'textTransform' => null, ), ); const ELEMENTS = array( 'link' => 'a', 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'h6' => 'h6', ); const APPEARANCE_TOOLS_OPT_INS = array( array( 'border', 'color' ), array( 'border', 'radius' ), array( 'border', 'style' ), array( 'border', 'width' ), array( 'color', 'link' ), array( 'spacing', 'blockGap' ), array( 'spacing', 'margin' ), array( 'spacing', 'padding' ), array( 'typography', 'lineHeight' ), ); const LATEST_SCHEMA = 2; public function __construct( $theme_json = array(), $origin = 'theme' ) { if ( ! in_array( $origin, static::VALID_ORIGINS, true ) ) { $origin = 'theme'; } $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json ); $valid_block_names = array_keys( static::get_blocks_metadata() ); $valid_element_names = array_keys( static::ELEMENTS ); $theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names ); $this->theme_json = static::maybe_opt_in_into_settings( $theme_json ); $nodes = static::get_setting_nodes( $this->theme_json ); foreach ( $nodes as $node ) { foreach ( static::PRESETS_METADATA as $preset_metadata ) { $path = array_merge( $node['path'], $preset_metadata['path'] ); $preset = _wp_array_get( $this->theme_json, $path, null ); if ( null !== $preset ) { if ( isset( $preset[0] ) || empty( $preset ) ) { _wp_array_set( $this->theme_json, $path, array( $origin => $preset ) ); } } } } } protected static function maybe_opt_in_into_settings( $theme_json ) { $new_theme_json = $theme_json; if ( isset( $new_theme_json['settings']['appearanceTools'] ) && true === $new_theme_json['settings']['appearanceTools'] ) { static::do_opt_in_into_settings( $new_theme_json['settings'] ); } if ( isset( $new_theme_json['settings']['blocks'] ) && is_array( $new_theme_json['settings']['blocks'] ) ) { foreach ( $new_theme_json['settings']['blocks'] as &$block ) { if ( isset( $block['appearanceTools'] ) && ( true === $block['appearanceTools'] ) ) { static::do_opt_in_into_settings( $block ); } } } return $new_theme_json; } protected static function do_opt_in_into_settings( &$context ) { foreach ( static::APPEARANCE_TOOLS_OPT_INS as $path ) { if ( 'unset prop' === _wp_array_get( $context, $path, 'unset prop' ) ) { _wp_array_set( $context, $path, true ); } } unset( $context['appearanceTools'] ); } protected static function sanitize( $input, $valid_block_names, $valid_element_names ) { $output = array(); if ( ! is_array( $input ) ) { return $output; } $output = array_intersect_key( $input, array_flip( static::VALID_TOP_LEVEL_KEYS ) ); $styles_non_top_level = static::VALID_STYLES; foreach ( array_keys( $styles_non_top_level ) as $section ) { foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { unset( $styles_non_top_level[ $section ][ $prop ] ); } } } $schema = array(); $schema_styles_elements = array(); foreach ( $valid_element_names as $element ) { $schema_styles_elements[ $element ] = $styles_non_top_level; } $schema_styles_blocks = array(); $schema_settings_blocks = array(); foreach ( $valid_block_names as $block ) { $schema_settings_blocks[ $block ] = static::VALID_SETTINGS; $schema_styles_blocks[ $block ] = $styles_non_top_level; $schema_styles_blocks[ $block ]['elements'] = $schema_styles_elements; } $schema['styles'] = static::VALID_STYLES; $schema['styles']['blocks'] = $schema_styles_blocks; $schema['styles']['elements'] = $schema_styles_elements; $schema['settings'] = static::VALID_SETTINGS; $schema['settings']['blocks'] = $schema_settings_blocks; foreach ( array( 'styles', 'settings' ) as $subtree ) { if ( ! isset( $input[ $subtree ] ) ) { continue; } if ( ! is_array( $input[ $subtree ] ) ) { unset( $output[ $subtree ] ); continue; } $result = static::remove_keys_not_in_schema( $input[ $subtree ], $schema[ $subtree ] ); if ( empty( $result ) ) { unset( $output[ $subtree ] ); } else { $output[ $subtree ] = $result; } } return $output; } protected static function get_blocks_metadata() { if ( null !== static::$blocks_metadata ) { return static::$blocks_metadata; } static::$blocks_metadata = array(); $registry = WP_Block_Type_Registry::get_instance(); $blocks = $registry->get_all_registered(); foreach ( $blocks as $block_name => $block_type ) { if ( isset( $block_type->supports['__experimentalSelector'] ) && is_string( $block_type->supports['__experimentalSelector'] ) ) { static::$blocks_metadata[ $block_name ]['selector'] = $block_type->supports['__experimentalSelector']; } else { static::$blocks_metadata[ $block_name ]['selector'] = '.wp-block-' . str_replace( '/', '-', str_replace( 'core/', '', $block_name ) ); } if ( isset( $block_type->supports['color']['__experimentalDuotone'] ) && is_string( $block_type->supports['color']['__experimentalDuotone'] ) ) { static::$blocks_metadata[ $block_name ]['duotone'] = $block_type->supports['color']['__experimentalDuotone']; } $block_selectors = explode( ',', static::$blocks_metadata[ $block_name ]['selector'] ); foreach ( static::ELEMENTS as $el_name => $el_selector ) { $element_selector = array(); foreach ( $block_selectors as $selector ) { $element_selector[] = $selector . ' ' . $el_selector; } static::$blocks_metadata[ $block_name ]['elements'][ $el_name ] = implode( ',', $element_selector ); } } return static::$blocks_metadata; } protected static function remove_keys_not_in_schema( $tree, $schema ) { $tree = array_intersect_key( $tree, $schema ); foreach ( $schema as $key => $data ) { if ( ! isset( $tree[ $key ] ) ) { continue; } if ( is_array( $schema[ $key ] ) && is_array( $tree[ $key ] ) ) { $tree[ $key ] = static::remove_keys_not_in_schema( $tree[ $key ], $schema[ $key ] ); if ( empty( $tree[ $key ] ) ) { unset( $tree[ $key ] ); } } elseif ( is_array( $schema[ $key ] ) && ! is_array( $tree[ $key ] ) ) { unset( $tree[ $key ] ); } } return $tree; } public function get_settings() { if ( ! isset( $this->theme_json['settings'] ) ) { return array(); } else { return $this->theme_json['settings']; } } public function get_stylesheet( $types = array( 'variables', 'styles', 'presets' ), $origins = null ) { if ( null === $origins ) { $origins = static::VALID_ORIGINS; } if ( is_string( $types ) ) { _deprecated_argument( __FUNCTION__, '5.9.0' ); if ( 'block_styles' === $types ) { $types = array( 'styles', 'presets' ); } elseif ( 'css_variables' === $types ) { $types = array( 'variables' ); } else { $types = array( 'variables', 'styles', 'presets' ); } } $blocks_metadata = static::get_blocks_metadata(); $style_nodes = static::get_style_nodes( $this->theme_json, $blocks_metadata ); $setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata ); $stylesheet = ''; if ( in_array( 'variables', $types, true ) ) { $stylesheet .= $this->get_css_variables( $setting_nodes, $origins ); } if ( in_array( 'styles', $types, true ) ) { $stylesheet .= $this->get_block_classes( $style_nodes ); } if ( in_array( 'presets', $types, true ) ) { $stylesheet .= $this->get_preset_classes( $setting_nodes, $origins ); } return $stylesheet; } public function get_custom_templates() { $custom_templates = array(); if ( ! isset( $this->theme_json['customTemplates'] ) || ! is_array( $this->theme_json['customTemplates'] ) ) { return $custom_templates; } foreach ( $this->theme_json['customTemplates'] as $item ) { if ( isset( $item['name'] ) ) { $custom_templates[ $item['name'] ] = array( 'title' => isset( $item['title'] ) ? $item['title'] : '', 'postTypes' => isset( $item['postTypes'] ) ? $item['postTypes'] : array( 'page' ), ); } } return $custom_templates; } public function get_template_parts() { $template_parts = array(); if ( ! isset( $this->theme_json['templateParts'] ) || ! is_array( $this->theme_json['templateParts'] ) ) { return $template_parts; } foreach ( $this->theme_json['templateParts'] as $item ) { if ( isset( $item['name'] ) ) { $template_parts[ $item['name'] ] = array( 'title' => isset( $item['title'] ) ? $item['title'] : '', 'area' => isset( $item['area'] ) ? $item['area'] : '', ); } } return $template_parts; } protected function get_block_classes( $style_nodes ) { $block_rules = ''; foreach ( $style_nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $selector = $metadata['selector']; $settings = _wp_array_get( $this->theme_json, array( 'settings' ) ); $declarations = static::compute_style_properties( $node, $settings ); $declarations_duotone = array(); foreach ( $declarations as $index => $declaration ) { if ( 'filter' === $declaration['name'] ) { unset( $declarations[ $index ] ); $declarations_duotone[] = $declaration; } } if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $block_rules .= 'body { margin: 0; }'; } $block_rules .= static::to_ruleset( $selector, $declarations ); if ( isset( $metadata['duotone'] ) && ! empty( $declarations_duotone ) ) { $selector_duotone = static::scope_selector( $metadata['selector'], $metadata['duotone'] ); $block_rules .= static::to_ruleset( $selector_duotone, $declarations_duotone ); } if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $block_rules .= '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }'; $block_rules .= '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }'; $block_rules .= '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null; if ( $has_block_gap_support ) { $block_rules .= '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }'; $block_rules .= '.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }'; } } } return $block_rules; } protected function get_preset_classes( $setting_nodes, $origins ) { $preset_rules = ''; foreach ( $setting_nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $selector = $metadata['selector']; $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $preset_rules .= static::compute_preset_classes( $node, $selector, $origins ); } return $preset_rules; } protected function get_css_variables( $nodes, $origins ) { $stylesheet = ''; foreach ( $nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $selector = $metadata['selector']; $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $declarations = array_merge( static::compute_preset_vars( $node, $origins ), static::compute_theme_vars( $node ) ); $stylesheet .= static::to_ruleset( $selector, $declarations ); } return $stylesheet; } protected static function to_ruleset( $selector, $declarations ) { if ( empty( $declarations ) ) { return ''; } $declaration_block = array_reduce( $declarations, static function ( $carry, $element ) { return $carry .= $element['name'] . ': ' . $element['value'] . ';'; }, '' ); return $selector . '{' . $declaration_block . '}'; } protected static function append_to_selector( $selector, $to_append ) { $new_selectors = array(); $selectors = explode( ',', $selector ); foreach ( $selectors as $sel ) { $new_selectors[] = $sel . $to_append; } return implode( ',', $new_selectors ); } protected static function compute_preset_classes( $settings, $selector, $origins ) { if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $selector = ''; } $stylesheet = ''; foreach ( static::PRESETS_METADATA as $preset_metadata ) { $slugs = static::get_settings_slugs( $settings, $preset_metadata, $origins ); foreach ( $preset_metadata['classes'] as $class => $property ) { foreach ( $slugs as $slug ) { $css_var = static::replace_slug_in_string( $preset_metadata['css_vars'], $slug ); $class_name = static::replace_slug_in_string( $class, $slug ); $stylesheet .= static::to_ruleset( static::append_to_selector( $selector, $class_name ), array( array( 'name' => $property, 'value' => 'var(' . $css_var . ') !important', ), ) ); } } } return $stylesheet; } protected static function scope_selector( $scope, $selector ) { $scopes = explode( ',', $scope ); $selectors = explode( ',', $selector ); $selectors_scoped = array(); foreach ( $scopes as $outer ) { foreach ( $selectors as $inner ) { $selectors_scoped[] = trim( $outer ) . ' ' . trim( $inner ); } } return implode( ', ', $selectors_scoped ); } protected static function get_settings_values_by_slug( $settings, $preset_metadata, $origins ) { $preset_per_origin = _wp_array_get( $settings, $preset_metadata['path'], array() ); $result = array(); foreach ( $origins as $origin ) { if ( ! isset( $preset_per_origin[ $origin ] ) ) { continue; } foreach ( $preset_per_origin[ $origin ] as $preset ) { $slug = _wp_to_kebab_case( $preset['slug'] ); $value = ''; if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) { $value_key = $preset_metadata['value_key']; $value = $preset[ $value_key ]; } elseif ( isset( $preset_metadata['value_func'] ) && is_callable( $preset_metadata['value_func'] ) ) { $value_func = $preset_metadata['value_func']; $value = call_user_func( $value_func, $preset ); } else { continue; } $result[ $slug ] = $value; } } return $result; } protected static function get_settings_slugs( $settings, $preset_metadata, $origins = null ) { if ( null === $origins ) { $origins = static::VALID_ORIGINS; } $preset_per_origin = _wp_array_get( $settings, $preset_metadata['path'], array() ); $result = array(); foreach ( $origins as $origin ) { if ( ! isset( $preset_per_origin[ $origin ] ) ) { continue; } foreach ( $preset_per_origin[ $origin ] as $preset ) { $slug = _wp_to_kebab_case( $preset['slug'] ); $result[ $slug ] = $slug; } } return $result; } protected static function replace_slug_in_string( $input, $slug ) { return strtr( $input, array( '$slug' => $slug ) ); } protected static function compute_preset_vars( $settings, $origins ) { $declarations = array(); foreach ( static::PRESETS_METADATA as $preset_metadata ) { $values_by_slug = static::get_settings_values_by_slug( $settings, $preset_metadata, $origins ); foreach ( $values_by_slug as $slug => $value ) { $declarations[] = array( 'name' => static::replace_slug_in_string( $preset_metadata['css_vars'], $slug ), 'value' => $value, ); } } return $declarations; } protected static function compute_theme_vars( $settings ) { $declarations = array(); $custom_values = _wp_array_get( $settings, array( 'custom' ), array() ); $css_vars = static::flatten_tree( $custom_values ); foreach ( $css_vars as $key => $value ) { $declarations[] = array( 'name' => '--wp--custom--' . $key, 'value' => $value, ); } return $declarations; } protected static function flatten_tree( $tree, $prefix = '', $token = '--' ) { $result = array(); foreach ( $tree as $property => $value ) { $new_key = $prefix . str_replace( '/', '-', strtolower( _wp_to_kebab_case( $property ) ) ); if ( is_array( $value ) ) { $new_prefix = $new_key . $token; $result = array_merge( $result, static::flatten_tree( $value, $new_prefix, $token ) ); } else { $result[ $new_key ] = $value; } } return $result; } protected static function compute_style_properties( $styles, $settings = array(), $properties = null ) { if ( null === $properties ) { $properties = static::PROPERTIES_METADATA; } $declarations = array(); if ( empty( $styles ) ) { return $declarations; } foreach ( $properties as $css_property => $value_path ) { $value = static::get_property_value( $styles, $value_path ); if ( is_array( $value_path ) ) { $path_string = implode( '.', $value_path ); if ( array_key_exists( $path_string, static::PROTECTED_PROPERTIES ) && _wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null ) { continue; } } $has_missing_value = empty( $value ) && ! is_numeric( $value ); if ( $has_missing_value || is_array( $value ) ) { continue; } $declarations[] = array( 'name' => $css_property, 'value' => $value, ); } return $declarations; } protected static function get_property_value( $styles, $path ) { $value = _wp_array_get( $styles, $path, '' ); if ( '' === $value || is_array( $value ) ) { return $value; } $prefix = 'var:'; $prefix_len = strlen( $prefix ); $token_in = '|'; $token_out = '--'; if ( 0 === strncmp( $value, $prefix, $prefix_len ) ) { $unwrapped_name = str_replace( $token_in, $token_out, substr( $value, $prefix_len ) ); $value = "var(--wp--$unwrapped_name)"; } return $value; } protected static function get_setting_nodes( $theme_json, $selectors = array() ) { $nodes = array(); if ( ! isset( $theme_json['settings'] ) ) { return $nodes; } $nodes[] = array( 'path' => array( 'settings' ), 'selector' => static::ROOT_BLOCK_SELECTOR, ); if ( ! isset( $theme_json['settings']['blocks'] ) ) { return $nodes; } foreach ( $theme_json['settings']['blocks'] as $name => $node ) { $selector = null; if ( isset( $selectors[ $name ]['selector'] ) ) { $selector = $selectors[ $name ]['selector']; } $nodes[] = array( 'path' => array( 'settings', 'blocks', $name ), 'selector' => $selector, ); } return $nodes; } protected static function get_style_nodes( $theme_json, $selectors = array() ) { $nodes = array(); if ( ! isset( $theme_json['styles'] ) ) { return $nodes; } $nodes[] = array( 'path' => array( 'styles' ), 'selector' => static::ROOT_BLOCK_SELECTOR, ); if ( isset( $theme_json['styles']['elements'] ) ) { foreach ( $theme_json['styles']['elements'] as $element => $node ) { $nodes[] = array( 'path' => array( 'styles', 'elements', $element ), 'selector' => static::ELEMENTS[ $element ], ); } } if ( ! isset( $theme_json['styles']['blocks'] ) ) { return $nodes; } foreach ( $theme_json['styles']['blocks'] as $name => $node ) { $selector = null; if ( isset( $selectors[ $name ]['selector'] ) ) { $selector = $selectors[ $name ]['selector']; } $duotone_selector = null; if ( isset( $selectors[ $name ]['duotone'] ) ) { $duotone_selector = $selectors[ $name ]['duotone']; } $nodes[] = array( 'path' => array( 'styles', 'blocks', $name ), 'selector' => $selector, 'duotone' => $duotone_selector, ); if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'] ) ) { foreach ( $theme_json['styles']['blocks'][ $name ]['elements'] as $element => $node ) { $nodes[] = array( 'path' => array( 'styles', 'blocks', $name, 'elements', $element ), 'selector' => $selectors[ $name ]['elements'][ $element ], ); } } } return $nodes; } protected static function get_metadata_boolean( $data, $path, $default = false ) { if ( is_bool( $path ) ) { return $path; } if ( is_array( $path ) ) { $value = _wp_array_get( $data, $path ); if ( null !== $value ) { return $value; } } return $default; } public function merge( $incoming ) { $incoming_data = $incoming->get_raw_data(); $this->theme_json = array_replace_recursive( $this->theme_json, $incoming_data ); $nodes = static::get_setting_nodes( $incoming_data ); $slugs_global = static::get_default_slugs( $this->theme_json, array( 'settings' ) ); foreach ( $nodes as $node ) { $slugs_node = static::get_default_slugs( $this->theme_json, $node['path'] ); $slugs = array_merge_recursive( $slugs_global, $slugs_node ); $path = array_merge( $node['path'], array( 'spacing', 'units' ) ); $content = _wp_array_get( $incoming_data, $path, null ); if ( isset( $content ) ) { _wp_array_set( $this->theme_json, $path, $content ); } foreach ( static::PRESETS_METADATA as $preset ) { $override_preset = ! static::get_metadata_boolean( $this->theme_json['settings'], $preset['prevent_override'], true ); foreach ( static::VALID_ORIGINS as $origin ) { $base_path = array_merge( $node['path'], $preset['path'] ); $path = array_merge( $base_path, array( $origin ) ); $content = _wp_array_get( $incoming_data, $path, null ); if ( ! isset( $content ) ) { continue; } if ( 'theme' === $origin && $preset['use_default_names'] ) { foreach ( $content as &$item ) { if ( ! array_key_exists( 'name', $item ) ) { $name = static::get_name_from_defaults( $item['slug'], $base_path ); if ( null !== $name ) { $item['name'] = $name; } } } } if ( ( 'theme' !== $origin ) || ( 'theme' === $origin && $override_preset ) ) { _wp_array_set( $this->theme_json, $path, $content ); } else { $slugs_for_preset = _wp_array_get( $slugs, $preset['path'], array() ); $content = static::filter_slugs( $content, $slugs_for_preset ); _wp_array_set( $this->theme_json, $path, $content ); } } } } } public function get_svg_filters( $origins ) { $blocks_metadata = static::get_blocks_metadata(); $setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata ); $filters = ''; foreach ( $setting_nodes as $metadata ) { $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); if ( empty( $node['color']['duotone'] ) ) { continue; } $duotone_presets = $node['color']['duotone']; foreach ( $origins as $origin ) { if ( ! isset( $duotone_presets[ $origin ] ) ) { continue; } foreach ( $duotone_presets[ $origin ] as $duotone_preset ) { $filters .= wp_get_duotone_filter_svg( $duotone_preset ); } } } return $filters; } protected static function should_override_preset( $theme_json, $path, $override ) { _deprecated_function( __METHOD__, '6.0.0', 'get_metadata_boolean' ); if ( is_bool( $override ) ) { return $override; } if ( is_array( $override ) ) { $value = _wp_array_get( $theme_json, array_merge( $path, $override ) ); if ( isset( $value ) ) { return ! $value; } $value = _wp_array_get( $theme_json, array_merge( array( 'settings' ), $override ) ); if ( isset( $value ) ) { return ! $value; } return true; } } protected static function get_default_slugs( $data, $node_path ) { $slugs = array(); foreach ( static::PRESETS_METADATA as $metadata ) { $path = array_merge( $node_path, $metadata['path'], array( 'default' ) ); $preset = _wp_array_get( $data, $path, null ); if ( ! isset( $preset ) ) { continue; } $slugs_for_preset = array(); $slugs_for_preset = array_map( static function( $value ) { return isset( $value['slug'] ) ? $value['slug'] : null; }, $preset ); _wp_array_set( $slugs, $metadata['path'], $slugs_for_preset ); } return $slugs; } protected function get_name_from_defaults( $slug, $base_path ) { $path = array_merge( $base_path, array( 'default' ) ); $default_content = _wp_array_get( $this->theme_json, $path, null ); if ( ! $default_content ) { return null; } foreach ( $default_content as $item ) { if ( $slug === $item['slug'] ) { return $item['name']; } } return null; } protected static function filter_slugs( $node, $slugs ) { if ( empty( $slugs ) ) { return $node; } $new_node = array(); foreach ( $node as $value ) { if ( isset( $value['slug'] ) && ! in_array( $value['slug'], $slugs, true ) ) { $new_node[] = $value; } } return $new_node; } public static function remove_insecure_properties( $theme_json ) { $sanitized = array(); $theme_json = WP_Theme_JSON_Schema::migrate( $theme_json ); $valid_block_names = array_keys( static::get_blocks_metadata() ); $valid_element_names = array_keys( static::ELEMENTS ); $theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names ); $blocks_metadata = static::get_blocks_metadata(); $style_nodes = static::get_style_nodes( $theme_json, $blocks_metadata ); foreach ( $style_nodes as $metadata ) { $input = _wp_array_get( $theme_json, $metadata['path'], array() ); if ( empty( $input ) ) { continue; } $output = static::remove_insecure_styles( $input ); if ( ! empty( $output ) ) { _wp_array_set( $sanitized, $metadata['path'], $output ); } } $setting_nodes = static::get_setting_nodes( $theme_json ); foreach ( $setting_nodes as $metadata ) { $input = _wp_array_get( $theme_json, $metadata['path'], array() ); if ( empty( $input ) ) { continue; } $output = static::remove_insecure_settings( $input ); if ( ! empty( $output ) ) { _wp_array_set( $sanitized, $metadata['path'], $output ); } } if ( empty( $sanitized['styles'] ) ) { unset( $theme_json['styles'] ); } else { $theme_json['styles'] = $sanitized['styles']; } if ( empty( $sanitized['settings'] ) ) { unset( $theme_json['settings'] ); } else { $theme_json['settings'] = $sanitized['settings']; } return $theme_json; } protected static function remove_insecure_settings( $input ) { $output = array(); foreach ( static::PRESETS_METADATA as $preset_metadata ) { foreach ( static::VALID_ORIGINS as $origin ) { $path_with_origin = array_merge( $preset_metadata['path'], array( $origin ) ); $presets = _wp_array_get( $input, $path_with_origin, null ); if ( null === $presets ) { continue; } $escaped_preset = array(); foreach ( $presets as $preset ) { if ( esc_attr( esc_html( $preset['name'] ) ) === $preset['name'] && sanitize_html_class( $preset['slug'] ) === $preset['slug'] ) { $value = null; if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) { $value = $preset[ $preset_metadata['value_key'] ]; } elseif ( isset( $preset_metadata['value_func'] ) && is_callable( $preset_metadata['value_func'] ) ) { $value = call_user_func( $preset_metadata['value_func'], $preset ); } $preset_is_valid = true; foreach ( $preset_metadata['properties'] as $property ) { if ( ! static::is_safe_css_declaration( $property, $value ) ) { $preset_is_valid = false; break; } } if ( $preset_is_valid ) { $escaped_preset[] = $preset; } } } if ( ! empty( $escaped_preset ) ) { _wp_array_set( $output, $path_with_origin, $escaped_preset ); } } } return $output; } protected static function remove_insecure_styles( $input ) { $output = array(); $declarations = static::compute_style_properties( $input ); foreach ( $declarations as $declaration ) { if ( static::is_safe_css_declaration( $declaration['name'], $declaration['value'] ) ) { $path = static::PROPERTIES_METADATA[ $declaration['name'] ]; $value = _wp_array_get( $input, $path, array() ); if ( ! is_array( $value ) ) { _wp_array_set( $output, $path, $value ); } } } return $output; } protected static function is_safe_css_declaration( $property_name, $property_value ) { $style_to_validate = $property_name . ': ' . $property_value; $filtered = esc_html( safecss_filter_attr( $style_to_validate ) ); return ! empty( trim( $filtered ) ); } public function get_raw_data() { return $this->theme_json; } public static function get_from_editor_settings( $settings ) { $theme_settings = array( 'version' => static::LATEST_SCHEMA, 'settings' => array(), ); if ( isset( $settings['disableCustomColors'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['custom'] = ! $settings['disableCustomColors']; } if ( isset( $settings['disableCustomGradients'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['customGradient'] = ! $settings['disableCustomGradients']; } if ( isset( $settings['disableCustomFontSizes'] ) ) { if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['customFontSize'] = ! $settings['disableCustomFontSizes']; } if ( isset( $settings['enableCustomLineHeight'] ) ) { if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['lineHeight'] = $settings['enableCustomLineHeight']; } if ( isset( $settings['enableCustomUnits'] ) ) { if ( ! isset( $theme_settings['settings']['spacing'] ) ) { $theme_settings['settings']['spacing'] = array(); } $theme_settings['settings']['spacing']['units'] = ( true === $settings['enableCustomUnits'] ) ? array( 'px', 'em', 'rem', 'vh', 'vw', '%' ) : $settings['enableCustomUnits']; } if ( isset( $settings['colors'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['palette'] = $settings['colors']; } if ( isset( $settings['gradients'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['gradients'] = $settings['gradients']; } if ( isset( $settings['fontSizes'] ) ) { $font_sizes = $settings['fontSizes']; foreach ( $font_sizes as $key => $font_size ) { if ( is_numeric( $font_size['size'] ) ) { $font_sizes[ $key ]['size'] = $font_size['size'] . 'px'; } } if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['fontSizes'] = $font_sizes; } if ( isset( $settings['enableCustomSpacing'] ) ) { if ( ! isset( $theme_settings['settings']['spacing'] ) ) { $theme_settings['settings']['spacing'] = array(); } $theme_settings['settings']['spacing']['padding'] = $settings['enableCustomSpacing']; } return $theme_settings; } public function get_patterns() { if ( isset( $this->theme_json['patterns'] ) && is_array( $this->theme_json['patterns'] ) ) { return $this->theme_json['patterns']; } return array(); } public function get_data() { $output = $this->theme_json; $nodes = static::get_setting_nodes( $output ); foreach ( $nodes as $node ) { foreach ( static::PRESETS_METADATA as $preset_metadata ) { $path = array_merge( $node['path'], $preset_metadata['path'] ); $preset = _wp_array_get( $output, $path, null ); if ( null === $preset ) { continue; } $items = array(); if ( isset( $preset['theme'] ) ) { foreach ( $preset['theme'] as $item ) { $slug = $item['slug']; unset( $item['slug'] ); $items[ $slug ] = $item; } } if ( isset( $preset['custom'] ) ) { foreach ( $preset['custom'] as $item ) { $slug = $item['slug']; unset( $item['slug'] ); $items[ $slug ] = $item; } } $flattened_preset = array(); foreach ( $items as $slug => $value ) { $flattened_preset[] = array_merge( array( 'slug' => $slug ), $value ); } _wp_array_set( $output, $path, $flattened_preset ); } } foreach ( $nodes as $node ) { $all_opt_ins_are_set = true; foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) { $full_path = array_merge( $node['path'], $opt_in_path ); $opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' ); if ( 'unset prop' === $opt_in_value ) { $all_opt_ins_are_set = false; break; } } if ( $all_opt_ins_are_set ) { _wp_array_set( $output, array_merge( $node['path'], array( 'appearanceTools' ) ), true ); foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) { $full_path = array_merge( $node['path'], $opt_in_path ); $opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' ); if ( true !== $opt_in_value ) { continue; } if ( ( 1 === count( $node['path'] ) ) && ( 'settings' === $node['path'][0] ) ) { unset( $output['settings'][ $opt_in_path[0] ][ $opt_in_path[1] ] ); if ( empty( $output['settings'][ $opt_in_path[0] ] ) ) { unset( $output['settings'][ $opt_in_path[0] ] ); } } elseif ( ( 3 === count( $node['path'] ) ) && ( 'settings' === $node['path'][0] ) && ( 'blocks' === $node['path'][1] ) ) { $block_name = $node['path'][2]; unset( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ][ $opt_in_path[1] ] ); if ( empty( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ] ) ) { unset( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ] ); } } } } } wp_recursive_ksort( $output ); return $output; } } 'text', 'title' => _x( 'Text', 'block category' ), 'icon' => null, ), array( 'slug' => 'media', 'title' => _x( 'Media', 'block category' ), 'icon' => null, ), array( 'slug' => 'design', 'title' => _x( 'Design', 'block category' ), 'icon' => null, ), array( 'slug' => 'widgets', 'title' => _x( 'Widgets', 'block category' ), 'icon' => null, ), array( 'slug' => 'theme', 'title' => _x( 'Theme', 'block category' ), 'icon' => null, ), array( 'slug' => 'embed', 'title' => _x( 'Embeds', 'block category' ), 'icon' => null, ), array( 'slug' => 'reusable', 'title' => _x( 'Reusable Blocks', 'block category' ), 'icon' => null, ), ); } function get_block_categories( $post_or_block_editor_context ) { $block_categories = get_default_block_categories(); $block_editor_context = $post_or_block_editor_context instanceof WP_Post ? new WP_Block_Editor_Context( array( 'post' => $post_or_block_editor_context, ) ) : $post_or_block_editor_context; $block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $block_categories = apply_filters_deprecated( 'block_categories', array( $block_categories, $post ), '5.8.0', 'block_categories_all' ); } return $block_categories; } function get_allowed_block_types( $block_editor_context ) { $allowed_block_types = true; $allowed_block_types = apply_filters( 'allowed_block_types_all', $allowed_block_types, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $allowed_block_types = apply_filters_deprecated( 'allowed_block_types', array( $allowed_block_types, $post ), '5.8.0', 'allowed_block_types_all' ); } return $allowed_block_types; } function get_default_block_editor_settings() { $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } $image_size_names = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); $available_image_sizes = array(); foreach ( $image_size_names as $image_size_slug => $image_size_name ) { $available_image_sizes[] = array( 'slug' => $image_size_slug, 'name' => $image_size_name, ); } $default_size = get_option( 'image_default_size', 'large' ); $image_default_size = in_array( $default_size, array_keys( $image_size_names ), true ) ? $default_size : 'large'; $image_dimensions = array(); $all_sizes = wp_get_registered_image_subsizes(); foreach ( $available_image_sizes as $size ) { $key = $size['slug']; if ( isset( $all_sizes[ $key ] ) ) { $image_dimensions[ $key ] = $all_sizes[ $key ]; } } $default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css'; if ( file_exists( $default_editor_styles_file ) ) { $default_editor_styles = array( array( 'css' => file_get_contents( $default_editor_styles_file ) ), ); } else { $default_editor_styles = array(); } $editor_settings = array( 'alignWide' => get_theme_support( 'align-wide' ), 'allowedBlockTypes' => true, 'allowedMimeTypes' => get_allowed_mime_types(), 'defaultEditorStyles' => $default_editor_styles, 'blockCategories' => get_default_block_categories(), 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), 'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ), 'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ), 'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ), 'enableCustomSpacing' => get_theme_support( 'custom-spacing' ), 'enableCustomUnits' => get_theme_support( 'custom-units' ), 'isRTL' => is_rtl(), 'imageDefaultSize' => $image_default_size, 'imageDimensions' => $image_dimensions, 'imageEditing' => true, 'imageSizes' => $available_image_sizes, 'maxUploadFileSize' => $max_upload_size, '__unstableGalleryWithImageBlocks' => true, ); $color_palette = current( (array) get_theme_support( 'editor-color-palette' ) ); if ( false !== $color_palette ) { $editor_settings['colors'] = $color_palette; } $font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) ); if ( false !== $font_sizes ) { $editor_settings['fontSizes'] = $font_sizes; } $gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) ); if ( false !== $gradient_presets ) { $editor_settings['gradients'] = $gradient_presets; } return $editor_settings; } function get_legacy_widget_block_editor_settings() { $editor_settings = array(); $editor_settings['widgetTypesToHideFromLegacyWidgetBlock'] = apply_filters( 'widget_types_to_hide_from_legacy_widget_block', array( 'pages', 'calendar', 'archives', 'media_audio', 'media_image', 'media_gallery', 'media_video', 'search', 'text', 'categories', 'recent-posts', 'recent-comments', 'rss', 'tag_cloud', 'custom_html', 'block', ) ); return $editor_settings; } function _wp_get_iframed_editor_assets() { global $pagenow; $script_handles = array(); $style_handles = array( 'wp-block-editor', 'wp-block-library', 'wp-edit-blocks', ); if ( current_theme_supports( 'wp-block-styles' ) ) { $style_handles[] = 'wp-block-library-theme'; } if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) { $style_handles[] = 'wp-widgets'; $style_handles[] = 'wp-edit-widgets'; } $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_type ) { if ( ! empty( $block_type->style ) ) { $style_handles[] = $block_type->style; } if ( ! empty( $block_type->editor_style ) ) { $style_handles[] = $block_type->editor_style; } if ( ! empty( $block_type->script ) ) { $script_handles[] = $block_type->script; } } $style_handles = array_unique( $style_handles ); $done = wp_styles()->done; ob_start(); wp_styles()->done = array( 'wp-reset-editor-styles' ); wp_styles()->do_items( $style_handles ); wp_styles()->done = $done; $styles = ob_get_clean(); $script_handles = array_unique( $script_handles ); $done = wp_scripts()->done; ob_start(); wp_scripts()->done = array(); wp_scripts()->do_items( $script_handles ); wp_scripts()->done = $done; $scripts = ob_get_clean(); return array( 'styles' => $styles, 'scripts' => $scripts, ); } function get_block_editor_settings( array $custom_settings, $block_editor_context ) { $editor_settings = array_merge( get_default_block_editor_settings(), array( 'allowedBlockTypes' => get_allowed_block_types( $block_editor_context ), 'blockCategories' => get_block_categories( $block_editor_context ), ), $custom_settings ); $global_styles = array(); $presets = array( array( 'css' => 'variables', '__unstableType' => 'presets', 'isGlobalStyles' => true, ), array( 'css' => 'presets', '__unstableType' => 'presets', 'isGlobalStyles' => true, ), ); foreach ( $presets as $preset_style ) { $actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) ); if ( '' !== $actual_css ) { $preset_style['css'] = $actual_css; $global_styles[] = $preset_style; } } if ( WP_Theme_JSON_Resolver::theme_has_support() ) { $block_classes = array( 'css' => 'styles', '__unstableType' => 'theme', 'isGlobalStyles' => true, ); $actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) ); if ( '' !== $actual_css ) { $block_classes['css'] = $actual_css; $global_styles[] = $block_classes; } } $editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() ); $editor_settings['__experimentalFeatures'] = wp_get_global_settings(); if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) { $colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette']; $editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ? $colors_by_origin['custom'] : ( isset( $colors_by_origin['theme'] ) ? $colors_by_origin['theme'] : $colors_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) { $gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients']; $editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ? $gradients_by_origin['custom'] : ( isset( $gradients_by_origin['theme'] ) ? $gradients_by_origin['theme'] : $gradients_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) { $font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes']; $editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ? $font_sizes_by_origin['custom'] : ( isset( $font_sizes_by_origin['theme'] ) ? $font_sizes_by_origin['theme'] : $font_sizes_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) { $editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom']; unset( $editor_settings['__experimentalFeatures']['color']['custom'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ) ) { $editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient']; unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) { $editor_settings['disableCustomFontSizes'] = ! $editor_settings['__experimentalFeatures']['typography']['customFontSize']; unset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ) ) { $editor_settings['enableCustomLineHeight'] = $editor_settings['__experimentalFeatures']['typography']['lineHeight']; unset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ); } if ( isset( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) { $editor_settings['enableCustomUnits'] = $editor_settings['__experimentalFeatures']['spacing']['units']; unset( $editor_settings['__experimentalFeatures']['spacing']['units'] ); } if ( isset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ) ) { $editor_settings['enableCustomSpacing'] = $editor_settings['__experimentalFeatures']['spacing']['padding']; unset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ); } $editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets(); $editor_settings['localAutosaveInterval'] = 15; $editor_settings['__experimentalDiscussionSettings'] = array( 'commentOrder' => get_option( 'comment_order' ), 'commentsPerPage' => get_option( 'comments_per_page' ), 'defaultCommentsPage' => get_option( 'default_comments_page' ), 'pageComments' => get_option( 'page_comments' ), 'threadComments' => get_option( 'thread_comments' ), 'threadCommentsDepth' => get_option( 'thread_comments_depth' ), 'defaultCommentStatus' => get_option( 'default_comment_status' ), 'avatarURL' => get_avatar_url( '', array( 'size' => 96, 'force_default' => true, 'default' => get_option( 'avatar_default' ), ) ), ); $editor_settings = apply_filters( 'block_editor_settings_all', $editor_settings, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $editor_settings = apply_filters_deprecated( 'block_editor_settings', array( $editor_settings, $post ), '5.8.0', 'block_editor_settings_all' ); } return $editor_settings; } function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) { global $post, $wp_scripts, $wp_styles; $preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $selected_post = $block_editor_context->post; $preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' ); } if ( empty( $preload_paths ) ) { return; } $backup_global_post = ! empty( $post ) ? clone $post : $post; $backup_wp_scripts = ! empty( $wp_scripts ) ? clone $wp_scripts : $wp_scripts; $backup_wp_styles = ! empty( $wp_styles ) ? clone $wp_styles : $wp_styles; foreach ( $preload_paths as &$path ) { if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) { $path = '/' . $path; continue; } if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) { $path[0] = '/' . $path[0]; } } unset( $path ); $preload_data = array_reduce( $preload_paths, 'rest_preload_api_request', array() ); $post = $backup_global_post; $wp_scripts = $backup_wp_scripts; $wp_styles = $backup_wp_styles; wp_add_inline_script( 'wp-api-fetch', sprintf( 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', wp_json_encode( $preload_data ) ), 'after' ); } function get_block_editor_theme_styles() { global $editor_styles; $styles = array(); if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) { foreach ( $editor_styles as $style ) { if ( preg_match( '~^(https?:)?//~', $style ) ) { $response = wp_remote_get( $style ); if ( ! is_wp_error( $response ) ) { $styles[] = array( 'css' => wp_remote_retrieve_body( $response ), '__unstableType' => 'theme', 'isGlobalStyles' => false, ); } } else { $file = get_theme_file_path( $style ); if ( is_file( $file ) ) { $styles[] = array( 'css' => file_get_contents( $file ), 'baseURL' => get_theme_file_uri( $style ), '__unstableType' => 'theme', 'isGlobalStyles' => false, ); } } } } return $styles; } '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'container_aria_label' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '
            %3$s
          ', 'item_spacing' => 'preserve', 'depth' => 0, 'walker' => '', 'theme_location' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $args['item_spacing'] = $defaults['item_spacing']; } $args = apply_filters( 'wp_nav_menu_args', $args ); $args = (object) $args; $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args ); if ( null !== $nav_menu ) { if ( $args->echo ) { echo $nav_menu; return; } return $nav_menu; } $menu = wp_get_nav_menu_object( $args->menu ); $locations = get_nav_menu_locations(); if ( ! $menu && $args->theme_location && $locations && isset( $locations[ $args->theme_location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); } if ( ! $menu && ! $args->theme_location ) { $menus = wp_get_nav_menus(); foreach ( $menus as $menu_maybe ) { $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ); if ( $menu_items ) { $menu = $menu_maybe; break; } } } if ( empty( $args->menu ) ) { $args->menu = $menu; } if ( $menu && ! is_wp_error( $menu ) && ! isset( $menu_items ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); } if ( ( ! $menu || is_wp_error( $menu ) || ( isset( $menu_items ) && empty( $menu_items ) && ! $args->theme_location ) ) && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) { return call_user_func( $args->fallback_cb, (array) $args ); } if ( ! $menu || is_wp_error( $menu ) ) { return false; } $nav_menu = ''; $items = ''; $show_container = false; if ( $args->container ) { $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags, true ) ) { $show_container = true; $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-' . $menu->slug . '-container"'; $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : ''; $aria_label = ( 'nav' === $args->container && $args->container_aria_label ) ? ' aria-label="' . esc_attr( $args->container_aria_label ) . '"' : ''; $nav_menu .= '<' . $args->container . $id . $class . $aria_label . '>'; } } _wp_menu_item_classes_by_context( $menu_items ); $sorted_menu_items = array(); $menu_items_with_children = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; if ( $menu_item->menu_item_parent ) { $menu_items_with_children[ $menu_item->menu_item_parent ] = true; } } if ( $menu_items_with_children ) { foreach ( $sorted_menu_items as &$menu_item ) { if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) { $menu_item->classes[] = 'menu-item-has-children'; } } } unset( $menu_items, $menu_item ); $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args ); unset( $sorted_menu_items ); if ( ! empty( $args->menu_id ) ) { $wrap_id = $args->menu_id; } else { $wrap_id = 'menu-' . $menu->slug; while ( in_array( $wrap_id, $menu_id_slugs, true ) ) { if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) { $wrap_id = preg_replace( '#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); } else { $wrap_id = $wrap_id . '-1'; } } } $menu_id_slugs[] = $wrap_id; $wrap_class = $args->menu_class ? $args->menu_class : ''; $items = apply_filters( 'wp_nav_menu_items', $items, $args ); $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); if ( empty( $items ) ) { return false; } $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); unset( $items ); if ( $show_container ) { $nav_menu .= 'container . '>'; } $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); if ( $args->echo ) { echo $nav_menu; } else { return $nav_menu; } } function _wp_menu_item_classes_by_context( &$menu_items ) { global $wp_query, $wp_rewrite; $queried_object = $wp_query->get_queried_object(); $queried_object_id = (int) $wp_query->queried_object_id; $active_object = ''; $active_ancestor_item_ids = array(); $active_parent_item_ids = array(); $active_parent_object_ids = array(); $possible_taxonomy_ancestors = array(); $possible_object_parents = array(); $home_page_id = (int) get_option( 'page_for_posts' ); if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) { foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { $term_hierarchy = _get_term_hierarchy( $taxonomy ); $terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) ); if ( is_array( $terms ) ) { $possible_object_parents = array_merge( $possible_object_parents, $terms ); $term_to_ancestor = array(); foreach ( (array) $term_hierarchy as $anc => $descs ) { foreach ( (array) $descs as $desc ) { $term_to_ancestor[ $desc ] = $anc; } } foreach ( $terms as $desc ) { do { $possible_taxonomy_ancestors[ $taxonomy ][] = $desc; if ( isset( $term_to_ancestor[ $desc ] ) ) { $_desc = $term_to_ancestor[ $desc ]; unset( $term_to_ancestor[ $desc ] ); $desc = $_desc; } else { $desc = 0; } } while ( ! empty( $desc ) ); } } } } } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) { $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy ); $term_to_ancestor = array(); foreach ( (array) $term_hierarchy as $anc => $descs ) { foreach ( (array) $descs as $desc ) { $term_to_ancestor[ $desc ] = $anc; } } $desc = $queried_object->term_id; do { $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc; if ( isset( $term_to_ancestor[ $desc ] ) ) { $_desc = $term_to_ancestor[ $desc ]; unset( $term_to_ancestor[ $desc ] ); $desc = $_desc; } else { $desc = 0; } } while ( ! empty( $desc ) ); } $possible_object_parents = array_filter( $possible_object_parents ); $front_page_url = home_url(); $front_page_id = (int) get_option( 'page_on_front' ); $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); foreach ( (array) $menu_items as $key => $menu_item ) { $menu_items[ $key ]->current = false; $classes = (array) $menu_item->classes; $classes[] = 'menu-item'; $classes[] = 'menu-item-type-' . $menu_item->type; $classes[] = 'menu-item-object-' . $menu_item->object; if ( 'post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id ) { $classes[] = 'menu-item-home'; } if ( 'post_type' === $menu_item->type && $privacy_policy_page_id === (int) $menu_item->object_id ) { $classes[] = 'menu-item-privacy-policy'; } if ( $wp_query->is_singular && 'taxonomy' === $menu_item->type && in_array( (int) $menu_item->object_id, $possible_object_parents, true ) ) { $active_parent_object_ids[] = (int) $menu_item->object_id; $active_parent_item_ids[] = (int) $menu_item->db_id; $active_object = $queried_object->post_type; } elseif ( $menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && 'post_type' === $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || ( 'post_type' === $menu_item->type && $wp_query->is_singular ) || ( 'taxonomy' === $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object ) ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } if ( 'post_type' === $menu_item->type && 'page' === $menu_item->object ) { $classes[] = 'page_item'; $classes[] = 'page-item-' . $menu_item->object_id; $classes[] = 'current_page_item'; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; $active_parent_object_ids[] = (int) $menu_item->post_parent; $active_object = $menu_item->object; } elseif ( 'post_type_archive' === $menu_item->type && is_post_type_archive( array( $menu_item->object ) ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; } elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) { $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); if ( is_customize_preview() ) { $_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' ); } $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current ); $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; $item_url = set_url_scheme( untrailingslashit( $raw_item_url ) ); $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) ); $matches = array( $current_url, urldecode( $current_url ), $_indexless_current, urldecode( $_indexless_current ), $_root_relative_current, urldecode( $_root_relative_current ), ); if ( $raw_item_url && in_array( $item_url, $matches, true ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ), true ) ) { $classes[] = 'current_page_item'; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; $active_parent_object_ids[] = (int) $menu_item->post_parent; $active_object = $menu_item->object; } elseif ( $item_url == $front_page_url && is_front_page() ) { $classes[] = 'current-menu-item'; } if ( untrailingslashit( $item_url ) == home_url() ) { $classes[] = 'menu-item-home'; } } if ( ! empty( $home_page_id ) && 'post_type' === $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) { $classes[] = 'current_page_parent'; } $menu_items[ $key ]->classes = array_unique( $classes ); } $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) ); $active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) ); $active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) ); foreach ( (array) $menu_items as $key => $parent_item ) { $classes = (array) $parent_item->classes; $menu_items[ $key ]->current_item_ancestor = false; $menu_items[ $key ]->current_item_parent = false; if ( isset( $parent_item->type ) && ( ( 'post_type' === $parent_item->type && ! empty( $queried_object->post_type ) && is_post_type_hierarchical( $queried_object->post_type ) && in_array( (int) $parent_item->object_id, $queried_object->ancestors, true ) && $parent_item->object != $queried_object->ID ) || ( 'taxonomy' === $parent_item->type && isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) && in_array( (int) $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ], true ) && ( ! isset( $queried_object->term_id ) || $parent_item->object_id != $queried_object->term_id ) ) ) ) { if ( ! empty( $queried_object->taxonomy ) ) { $classes[] = 'current-' . $queried_object->taxonomy . '-ancestor'; } else { $classes[] = 'current-' . $queried_object->post_type . '-ancestor'; } } if ( in_array( (int) $parent_item->db_id, $active_ancestor_item_ids, true ) ) { $classes[] = 'current-menu-ancestor'; $menu_items[ $key ]->current_item_ancestor = true; } if ( in_array( (int) $parent_item->db_id, $active_parent_item_ids, true ) ) { $classes[] = 'current-menu-parent'; $menu_items[ $key ]->current_item_parent = true; } if ( in_array( (int) $parent_item->object_id, $active_parent_object_ids, true ) ) { $classes[] = 'current-' . $active_object . '-parent'; } if ( 'post_type' === $parent_item->type && 'page' === $parent_item->object ) { if ( in_array( 'current-menu-parent', $classes, true ) ) { $classes[] = 'current_page_parent'; } if ( in_array( 'current-menu-ancestor', $classes, true ) ) { $classes[] = 'current_page_ancestor'; } } $menu_items[ $key ]->classes = array_unique( $classes ); } } function walk_nav_menu_tree( $items, $depth, $args ) { $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker; return $walker->walk( $items, $depth, $args ); } function _nav_menu_item_id_use_once( $id, $item ) { static $_used_ids = array(); if ( in_array( $item->ID, $_used_ids, true ) ) { return ''; } $_used_ids[] = $item->ID; return $id; } cookie_service = new WP_Recovery_Mode_Cookie_Service(); $this->key_service = new WP_Recovery_Mode_Key_Service(); $this->link_service = new WP_Recovery_Mode_Link_Service( $this->cookie_service, $this->key_service ); $this->email_service = new WP_Recovery_Mode_Email_Service( $this->link_service ); } public function initialize() { $this->is_initialized = true; add_action( 'wp_logout', array( $this, 'exit_recovery_mode' ) ); add_action( 'login_form_' . self::EXIT_ACTION, array( $this, 'handle_exit_recovery_mode' ) ); add_action( 'recovery_mode_clean_expired_keys', array( $this, 'clean_expired_keys' ) ); if ( ! wp_next_scheduled( 'recovery_mode_clean_expired_keys' ) && ! wp_installing() ) { wp_schedule_event( time(), 'daily', 'recovery_mode_clean_expired_keys' ); } if ( defined( 'WP_RECOVERY_MODE_SESSION_ID' ) ) { $this->is_active = true; $this->session_id = WP_RECOVERY_MODE_SESSION_ID; return; } if ( $this->cookie_service->is_cookie_set() ) { $this->handle_cookie(); return; } $this->link_service->handle_begin_link( $this->get_link_ttl() ); } public function is_active() { return $this->is_active; } public function get_session_id() { return $this->session_id; } public function is_initialized() { return $this->is_initialized; } public function handle_error( array $error ) { $extension = $this->get_extension_for_error( $error ); if ( ! $extension || $this->is_network_plugin( $extension ) ) { return new WP_Error( 'invalid_source', __( 'Error not caused by a plugin or theme.' ) ); } if ( ! $this->is_active() ) { if ( ! is_protected_endpoint() ) { return new WP_Error( 'non_protected_endpoint', __( 'Error occurred on a non-protected endpoint.' ) ); } if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } return $this->email_service->maybe_send_recovery_mode_email( $this->get_email_rate_limit(), $error, $extension ); } if ( ! $this->store_error( $error ) ) { return new WP_Error( 'storage_error', __( 'Failed to store the error.' ) ); } if ( headers_sent() ) { return true; } $this->redirect_protected(); } public function exit_recovery_mode() { if ( ! $this->is_active() ) { return false; } $this->email_service->clear_rate_limit(); $this->cookie_service->clear_cookie(); wp_paused_plugins()->delete_all(); wp_paused_themes()->delete_all(); return true; } public function handle_exit_recovery_mode() { $redirect_to = wp_get_referer(); if ( ! $redirect_to ) { $redirect_to = is_user_logged_in() ? admin_url() : home_url(); } if ( ! $this->is_active() ) { wp_safe_redirect( $redirect_to ); die; } if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) { return; } if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], self::EXIT_ACTION ) ) { wp_die( __( 'Exit recovery mode link expired.' ), 403 ); } if ( ! $this->exit_recovery_mode() ) { wp_die( __( 'Failed to exit recovery mode. Please try again later.' ) ); } wp_safe_redirect( $redirect_to ); die; } public function clean_expired_keys() { $this->key_service->clean_expired_keys( $this->get_link_ttl() ); } protected function handle_cookie() { $validated = $this->cookie_service->validate_cookie(); if ( is_wp_error( $validated ) ) { $this->cookie_service->clear_cookie(); $validated->add_data( array( 'status' => 403 ) ); wp_die( $validated ); } $session_id = $this->cookie_service->get_session_id_from_cookie(); if ( is_wp_error( $session_id ) ) { $this->cookie_service->clear_cookie(); $session_id->add_data( array( 'status' => 403 ) ); wp_die( $session_id ); } $this->is_active = true; $this->session_id = $session_id; } protected function get_email_rate_limit() { return apply_filters( 'recovery_mode_email_rate_limit', DAY_IN_SECONDS ); } protected function get_link_ttl() { $rate_limit = $this->get_email_rate_limit(); $valid_for = $rate_limit; $valid_for = apply_filters( 'recovery_mode_email_link_ttl', $valid_for ); return max( $valid_for, $rate_limit ); } protected function get_extension_for_error( $error ) { global $wp_theme_directories; if ( ! isset( $error['file'] ) ) { return false; } if ( ! defined( 'WP_PLUGIN_DIR' ) ) { return false; } $error_file = wp_normalize_path( $error['file'] ); $wp_plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); if ( 0 === strpos( $error_file, $wp_plugin_dir ) ) { $path = str_replace( $wp_plugin_dir . '/', '', $error_file ); $parts = explode( '/', $path ); return array( 'type' => 'plugin', 'slug' => $parts[0], ); } if ( empty( $wp_theme_directories ) ) { return false; } foreach ( $wp_theme_directories as $theme_directory ) { $theme_directory = wp_normalize_path( $theme_directory ); if ( 0 === strpos( $error_file, $theme_directory ) ) { $path = str_replace( $theme_directory . '/', '', $error_file ); $parts = explode( '/', $path ); return array( 'type' => 'theme', 'slug' => $parts[0], ); } } return false; } protected function is_network_plugin( $extension ) { if ( 'plugin' !== $extension['type'] ) { return false; } if ( ! is_multisite() ) { return false; } $network_plugins = wp_get_active_network_plugins(); foreach ( $network_plugins as $plugin ) { if ( 0 === strpos( $plugin, $extension['slug'] . '/' ) ) { return true; } } return false; } protected function store_error( $error ) { $extension = $this->get_extension_for_error( $error ); if ( ! $extension ) { return false; } switch ( $extension['type'] ) { case 'plugin': return wp_paused_plugins()->set( $extension['slug'], $error ); case 'theme': return wp_paused_themes()->set( $extension['slug'], $error ); default: return false; } } protected function redirect_protected() { if ( ! function_exists( 'wp_safe_redirect' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $scheme = is_ssl() ? 'https://' : 'http://'; $url = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; wp_safe_redirect( $url ); exit; } } ]*href/i', $comment, $out ); $num_links = apply_filters( 'comment_max_links_url', $num_links, $url, $comment ); if ( $num_links >= $max_links ) { return false; } } $mod_keys = trim( get_option( 'moderation_keys' ) ); if ( ! empty( $mod_keys ) ) { $words = explode( "\n", $mod_keys ); foreach ( (array) $words as $word ) { $word = trim( $word ); if ( empty( $word ) ) { continue; } $word = preg_quote( $word, '#' ); $pattern = "#$word#i"; if ( preg_match( $pattern, $author ) ) { return false; } if ( preg_match( $pattern, $email ) ) { return false; } if ( preg_match( $pattern, $url ) ) { return false; } if ( preg_match( $pattern, $comment ) ) { return false; } if ( preg_match( $pattern, $user_ip ) ) { return false; } if ( preg_match( $pattern, $user_agent ) ) { return false; } } } if ( 1 == get_option( 'comment_previously_approved' ) ) { if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) { $comment_user = get_user_by( 'email', wp_unslash( $email ) ); if ( ! empty( $comment_user->ID ) ) { $ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) ); } else { $ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) ); } if ( ( 1 == $ok_to_comment ) && ( empty( $mod_keys ) || false === strpos( $email, $mod_keys ) ) ) { return true; } else { return false; } } else { return false; } } return true; } function get_approved_comments( $post_id, $args = array() ) { if ( ! $post_id ) { return array(); } $defaults = array( 'status' => 1, 'post_id' => $post_id, 'order' => 'ASC', ); $parsed_args = wp_parse_args( $args, $defaults ); $query = new WP_Comment_Query; return $query->query( $parsed_args ); } function get_comment( $comment = null, $output = OBJECT ) { if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) { $comment = $GLOBALS['comment']; } if ( $comment instanceof WP_Comment ) { $_comment = $comment; } elseif ( is_object( $comment ) ) { $_comment = new WP_Comment( $comment ); } else { $_comment = WP_Comment::get_instance( $comment ); } if ( ! $_comment ) { return null; } $_comment = apply_filters( 'get_comment', $_comment ); if ( OBJECT === $output ) { return $_comment; } elseif ( ARRAY_A === $output ) { return $_comment->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_comment->to_array() ); } return $_comment; } function get_comments( $args = '' ) { $query = new WP_Comment_Query; return $query->query( $args ); } function get_comment_statuses() { $status = array( 'hold' => __( 'Unapproved' ), 'approve' => _x( 'Approved', 'comment status' ), 'spam' => _x( 'Spam', 'comment status' ), 'trash' => _x( 'Trash', 'comment status' ), ); return $status; } function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) { switch ( $comment_type ) { case 'pingback': case 'trackback': $supports = 'trackbacks'; $option = 'ping'; break; default: $supports = 'comments'; $option = 'comment'; break; } if ( 'page' === $post_type ) { $status = 'closed'; } elseif ( post_type_supports( $post_type, $supports ) ) { $status = get_option( "default_{$option}_status" ); } else { $status = 'closed'; } return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type ); } function get_lastcommentmodified( $timezone = 'server' ) { global $wpdb; $timezone = strtolower( $timezone ); $key = "lastcommentmodified:$timezone"; $comment_modified_date = wp_cache_get( $key, 'timeinfo' ); if ( false !== $comment_modified_date ) { return $comment_modified_date; } switch ( $timezone ) { case 'gmt': $comment_modified_date = $wpdb->get_var( "SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" ); break; case 'blog': $comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" ); break; case 'server': $add_seconds_server = gmdate( 'Z' ); $comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) ); break; } if ( $comment_modified_date ) { wp_cache_set( $key, $comment_modified_date, 'timeinfo' ); return $comment_modified_date; } return false; } function get_comment_count( $post_id = 0 ) { $post_id = (int) $post_id; $comment_count = array( 'approved' => 0, 'awaiting_moderation' => 0, 'spam' => 0, 'trash' => 0, 'post-trashed' => 0, 'total_comments' => 0, 'all' => 0, ); $args = array( 'count' => true, 'update_comment_meta_cache' => false, ); if ( $post_id > 0 ) { $args['post_id'] = $post_id; } $mapping = array( 'approved' => 'approve', 'awaiting_moderation' => 'hold', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed', ); $comment_count = array(); foreach ( $mapping as $key => $value ) { $comment_count[ $key ] = get_comments( array_merge( $args, array( 'status' => $value ) ) ); } $comment_count['all'] = $comment_count['approved'] + $comment_count['awaiting_moderation']; $comment_count['total_comments'] = $comment_count['all'] + $comment_count['spam']; return array_map( 'intval', $comment_count ); } function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique ); } function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'comment', $comment_id, $meta_key, $meta_value ); } function get_comment_meta( $comment_id, $key = '', $single = false ) { return get_metadata( 'comment', $comment_id, $key, $single ); } function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value ); } function wp_queue_comments_for_comment_meta_lazyload( $comments ) { $comment_ids = array(); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { if ( $comment instanceof WP_Comment ) { $comment_ids[] = $comment->comment_ID; } } } if ( $comment_ids ) { $lazyloader = wp_metadata_lazyloader(); $lazyloader->queue_objects( 'comment', $comment_ids ); } } function wp_set_comment_cookies( $comment, $user, $cookies_consent = true ) { if ( $user->exists() ) { return; } if ( false === $cookies_consent ) { $past = time() - YEAR_IN_SECONDS; setcookie( 'comment_author_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'comment_author_email_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'comment_author_url_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); return; } $comment_cookie_lifetime = time() + apply_filters( 'comment_cookie_lifetime', 30000000 ); $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_url_' . COOKIEHASH, esc_url( $comment->comment_author_url ), $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); } function sanitize_comment_cookies() { if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = apply_filters( 'pre_comment_author_name', $_COOKIE[ 'comment_author_' . COOKIEHASH ] ); $comment_author = wp_unslash( $comment_author ); $comment_author = esc_attr( $comment_author ); $_COOKIE[ 'comment_author_' . COOKIEHASH ] = $comment_author; } if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ); $comment_author_email = wp_unslash( $comment_author_email ); $comment_author_email = esc_attr( $comment_author_email ); $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] = $comment_author_email; } if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ); $comment_author_url = wp_unslash( $comment_author_url ); $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] = $comment_author_url; } } function wp_allow_comment( $commentdata, $wp_error = false ) { global $wpdb; $dupe = $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ", wp_unslash( $commentdata['comment_post_ID'] ), wp_unslash( $commentdata['comment_parent'] ), wp_unslash( $commentdata['comment_author'] ) ); if ( $commentdata['comment_author_email'] ) { $dupe .= $wpdb->prepare( 'AND comment_author_email = %s ', wp_unslash( $commentdata['comment_author_email'] ) ); } $dupe .= $wpdb->prepare( ') AND comment_content = %s LIMIT 1', wp_unslash( $commentdata['comment_content'] ) ); $dupe_id = $wpdb->get_var( $dupe ); $dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata ); if ( $dupe_id ) { do_action( 'comment_duplicate_trigger', $commentdata ); $comment_duplicate_message = apply_filters( 'comment_duplicate_message', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ) ); if ( $wp_error ) { return new WP_Error( 'comment_duplicate', $comment_duplicate_message, 409 ); } else { if ( wp_doing_ajax() ) { die( $comment_duplicate_message ); } wp_die( $comment_duplicate_message, 409 ); } } do_action( 'check_comment_flood', $commentdata['comment_author_IP'], $commentdata['comment_author_email'], $commentdata['comment_date_gmt'], $wp_error ); $is_flood = apply_filters( 'wp_is_comment_flood', false, $commentdata['comment_author_IP'], $commentdata['comment_author_email'], $commentdata['comment_date_gmt'], $wp_error ); if ( $is_flood ) { $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) ); return new WP_Error( 'comment_flood', $comment_flood_message, 429 ); } if ( ! empty( $commentdata['user_id'] ) ) { $user = get_userdata( $commentdata['user_id'] ); $post_author = $wpdb->get_var( $wpdb->prepare( "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $commentdata['comment_post_ID'] ) ); } if ( isset( $user ) && ( $commentdata['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) { $approved = 1; } else { if ( check_comment( $commentdata['comment_author'], $commentdata['comment_author_email'], $commentdata['comment_author_url'], $commentdata['comment_content'], $commentdata['comment_author_IP'], $commentdata['comment_agent'], $commentdata['comment_type'] ) ) { $approved = 1; } else { $approved = 0; } if ( wp_check_comment_disallowed_list( $commentdata['comment_author'], $commentdata['comment_author_email'], $commentdata['comment_author_url'], $commentdata['comment_content'], $commentdata['comment_author_IP'], $commentdata['comment_agent'] ) ) { $approved = EMPTY_TRASH_DAYS ? 'trash' : 'spam'; } } return apply_filters( 'pre_comment_approved', $approved, $commentdata ); } function check_comment_flood_db() { add_filter( 'wp_is_comment_flood', 'wp_check_comment_flood', 10, 5 ); } function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) { global $wpdb; if ( true === $is_flood ) { return $is_flood; } if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) { return false; } $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS ); if ( is_user_logged_in() ) { $user = get_current_user_id(); $check_column = '`user_id`'; } else { $user = $ip; $check_column = '`comment_author_IP`'; } $sql = $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( $check_column = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $user, $email ); $lasttime = $wpdb->get_var( $sql ); if ( $lasttime ) { $time_lastcomment = mysql2date( 'U', $lasttime, false ); $time_newcomment = mysql2date( 'U', $date, false ); $flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment ); if ( $flood_die ) { do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment ); if ( $avoid_die ) { return true; } else { $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) ); if ( wp_doing_ajax() ) { die( $comment_flood_message ); } wp_die( $comment_flood_message, 429 ); } } } return false; } function separate_comments( &$comments ) { $comments_by_type = array( 'comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array(), ); $count = count( $comments ); for ( $i = 0; $i < $count; $i++ ) { $type = $comments[ $i ]->comment_type; if ( empty( $type ) ) { $type = 'comment'; } $comments_by_type[ $type ][] = &$comments[ $i ]; if ( 'trackback' === $type || 'pingback' === $type ) { $comments_by_type['pings'][] = &$comments[ $i ]; } } return $comments_by_type; } function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { global $wp_query; if ( null === $comments && null === $per_page && null === $threaded && ! empty( $wp_query->max_num_comment_pages ) ) { return $wp_query->max_num_comment_pages; } if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments ) ) { $comments = $wp_query->comments; } if ( empty( $comments ) ) { return 0; } if ( ! get_option( 'page_comments' ) ) { return 1; } if ( ! isset( $per_page ) ) { $per_page = (int) get_query_var( 'comments_per_page' ); } if ( 0 === $per_page ) { $per_page = (int) get_option( 'comments_per_page' ); } if ( 0 === $per_page ) { return 1; } if ( ! isset( $threaded ) ) { $threaded = get_option( 'thread_comments' ); } if ( $threaded ) { $walker = new Walker_Comment; $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page ); } else { $count = ceil( count( $comments ) / $per_page ); } return $count; } function get_page_of_comment( $comment_ID, $args = array() ) { global $wpdb; $page = null; $comment = get_comment( $comment_ID ); if ( ! $comment ) { return; } $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', ); $args = wp_parse_args( $args, $defaults ); $original_args = $args; if ( get_option( 'page_comments' ) ) { if ( '' === $args['per_page'] ) { $args['per_page'] = get_query_var( 'comments_per_page' ); } if ( '' === $args['per_page'] ) { $args['per_page'] = get_option( 'comments_per_page' ); } } if ( empty( $args['per_page'] ) ) { $args['per_page'] = 0; $args['page'] = 0; } if ( $args['per_page'] < 1 ) { $page = 1; } if ( null === $page ) { if ( '' === $args['max_depth'] ) { if ( get_option( 'thread_comments' ) ) { $args['max_depth'] = get_option( 'thread_comments_depth' ); } else { $args['max_depth'] = -1; } } if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) { return get_page_of_comment( $comment->comment_parent, $args ); } $comment_args = array( 'type' => $args['type'], 'post_id' => $comment->comment_post_ID, 'fields' => 'ids', 'count' => true, 'status' => 'approve', 'parent' => 0, 'date_query' => array( array( 'column' => "$wpdb->comments.comment_date_gmt", 'before' => $comment->comment_date_gmt, ), ), ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args ); $comment_query = new WP_Comment_Query(); $older_comment_count = $comment_query->query( $comment_args ); if ( 0 == $older_comment_count ) { $page = 1; } else { $page = ceil( ( $older_comment_count + 1 ) / $args['per_page'] ); } } return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID ); } function wp_get_comment_fields_max_lengths() { global $wpdb; $lengths = array( 'comment_author' => 245, 'comment_author_email' => 100, 'comment_author_url' => 200, 'comment_content' => 65525, ); if ( $wpdb->is_mysql ) { foreach ( $lengths as $column => $length ) { $col_length = $wpdb->get_col_length( $wpdb->comments, $column ); $max_length = 0; if ( is_wp_error( $col_length ) ) { break; } if ( ! is_array( $col_length ) && (int) $col_length > 0 ) { $max_length = (int) $col_length; } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) { $max_length = (int) $col_length['length']; if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) { $max_length = $max_length - 10; } } if ( $max_length > 0 ) { $lengths[ $column ] = $max_length; } } } return apply_filters( 'wp_get_comment_fields_max_lengths', $lengths ); } function wp_check_comment_data_max_lengths( $comment_data ) { $max_lengths = wp_get_comment_fields_max_lengths(); if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) { return new WP_Error( 'comment_author_column_length', __( 'Error: Your name is too long.' ), 200 ); } if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) { return new WP_Error( 'comment_author_email_column_length', __( 'Error: Your email address is too long.' ), 200 ); } if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) { return new WP_Error( 'comment_author_url_column_length', __( 'Error: Your URL is too long.' ), 200 ); } if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) { return new WP_Error( 'comment_content_column_length', __( 'Error: Your comment is too long.' ), 200 ); } return true; } function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) { do_action_deprecated( 'wp_blacklist_check', array( $author, $email, $url, $comment, $user_ip, $user_agent ), '5.5.0', 'wp_check_comment_disallowed_list', __( 'Please consider writing more inclusive code.' ) ); do_action( 'wp_check_comment_disallowed_list', $author, $email, $url, $comment, $user_ip, $user_agent ); $mod_keys = trim( get_option( 'disallowed_keys' ) ); if ( '' === $mod_keys ) { return false; } $comment_without_html = wp_strip_all_tags( $comment ); $words = explode( "\n", $mod_keys ); foreach ( (array) $words as $word ) { $word = trim( $word ); if ( empty( $word ) ) { continue; } $word = preg_quote( $word, '#' ); $pattern = "#$word#i"; if ( preg_match( $pattern, $author ) || preg_match( $pattern, $email ) || preg_match( $pattern, $url ) || preg_match( $pattern, $comment ) || preg_match( $pattern, $comment_without_html ) || preg_match( $pattern, $user_ip ) || preg_match( $pattern, $user_agent ) ) { return true; } } return false; } function wp_count_comments( $post_id = 0 ) { $post_id = (int) $post_id; $filtered = apply_filters( 'wp_count_comments', array(), $post_id ); if ( ! empty( $filtered ) ) { return $filtered; } $count = wp_cache_get( "comments-{$post_id}", 'counts' ); if ( false !== $count ) { return $count; } $stats = get_comment_count( $post_id ); $stats['moderated'] = $stats['awaiting_moderation']; unset( $stats['awaiting_moderation'] ); $stats_object = (object) $stats; wp_cache_set( "comments-{$post_id}", $stats_object, 'counts' ); return $stats_object; } function wp_delete_comment( $comment_id, $force_delete = false ) { global $wpdb; $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } if ( ! $force_delete && EMPTY_TRASH_DAYS && ! in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ), true ) ) { return wp_trash_comment( $comment_id ); } do_action( 'delete_comment', $comment->comment_ID, $comment ); $children = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID ) ); if ( ! empty( $children ) ) { $wpdb->update( $wpdb->comments, array( 'comment_parent' => $comment->comment_parent ), array( 'comment_parent' => $comment->comment_ID ) ); clean_comment_cache( $children ); } $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) ); foreach ( $meta_ids as $mid ) { delete_metadata_by_mid( 'comment', $mid ); } if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) ) { return false; } do_action( 'deleted_comment', $comment->comment_ID, $comment ); $post_id = $comment->comment_post_ID; if ( $post_id && 1 == $comment->comment_approved ) { wp_update_comment_count( $post_id ); } clean_comment_cache( $comment->comment_ID ); do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' ); wp_transition_comment_status( 'delete', $comment->comment_approved, $comment ); return true; } function wp_trash_comment( $comment_id ) { if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_comment( $comment_id, true ); } $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'trash_comment', $comment->comment_ID, $comment ); if ( wp_set_comment_status( $comment, 'trash' ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() ); do_action( 'trashed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_untrash_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'untrash_comment', $comment->comment_ID, $comment ); $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ); if ( empty( $status ) ) { $status = '0'; } if ( wp_set_comment_status( $comment, $status ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); do_action( 'untrashed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_spam_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'spam_comment', $comment->comment_ID, $comment ); if ( wp_set_comment_status( $comment, 'spam' ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() ); do_action( 'spammed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_unspam_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'unspam_comment', $comment->comment_ID, $comment ); $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ); if ( empty( $status ) ) { $status = '0'; } if ( wp_set_comment_status( $comment, $status ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); do_action( 'unspammed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_get_comment_status( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } $approved = $comment->comment_approved; if ( null == $approved ) { return false; } elseif ( '1' == $approved ) { return 'approved'; } elseif ( '0' == $approved ) { return 'unapproved'; } elseif ( 'spam' === $approved ) { return 'spam'; } elseif ( 'trash' === $approved ) { return 'trash'; } else { return false; } } function wp_transition_comment_status( $new_status, $old_status, $comment ) { $comment_statuses = array( 0 => 'unapproved', 'hold' => 'unapproved', 1 => 'approved', 'approve' => 'approved', ); if ( isset( $comment_statuses[ $new_status ] ) ) { $new_status = $comment_statuses[ $new_status ]; } if ( isset( $comment_statuses[ $old_status ] ) ) { $old_status = $comment_statuses[ $old_status ]; } if ( $new_status != $old_status ) { do_action( 'transition_comment_status', $new_status, $old_status, $comment ); do_action( "comment_{$old_status}_to_{$new_status}", $comment ); } do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment ); } function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) { if ( 'approved' === $new_status || 'approved' === $old_status ) { $data = array(); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { $data[] = "lastcommentmodified:$timezone"; } wp_cache_delete_multiple( $data, 'timeinfo' ); } } function wp_get_current_commenter() { $comment_author = ''; if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = $_COOKIE[ 'comment_author_' . COOKIEHASH ]; } $comment_author_email = ''; if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = $_COOKIE[ 'comment_author_email_' . COOKIEHASH ]; } $comment_author_url = ''; if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ]; } return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) ); } function wp_get_unapproved_comment_author_email() { $commenter_email = ''; if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $comment_id = (int) $_GET['unapproved']; $comment = get_comment( $comment_id ); if ( $comment && hash_equals( $_GET['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) { $comment_preview_expires = strtotime( $comment->comment_date_gmt . '+10 minutes' ); if ( time() < $comment_preview_expires ) { $commenter_email = $comment->comment_author_email; } } } if ( ! $commenter_email ) { $commenter = wp_get_current_commenter(); $commenter_email = $commenter['comment_author_email']; } return $commenter_email; } function wp_insert_comment( $commentdata ) { global $wpdb; $data = wp_unslash( $commentdata ); $comment_author = ! isset( $data['comment_author'] ) ? '' : $data['comment_author']; $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email']; $comment_author_url = ! isset( $data['comment_author_url'] ) ? '' : $data['comment_author_url']; $comment_author_IP = ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP']; $comment_date = ! isset( $data['comment_date'] ) ? current_time( 'mysql' ) : $data['comment_date']; $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt']; $comment_post_ID = ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID']; $comment_content = ! isset( $data['comment_content'] ) ? '' : $data['comment_content']; $comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma']; $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved']; $comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent']; $comment_type = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type']; $comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent']; $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id']; $compacted = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' ); if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) { return false; } $id = (int) $wpdb->insert_id; if ( 1 == $comment_approved ) { wp_update_comment_count( $comment_post_ID ); $data = array(); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { $data[] = "lastcommentmodified:$timezone"; } wp_cache_delete_multiple( $data, 'timeinfo' ); } clean_comment_cache( $id ); $comment = get_comment( $id ); if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) { foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) { add_comment_meta( $comment->comment_ID, $meta_key, $meta_value, true ); } } do_action( 'wp_insert_comment', $id, $comment ); return $id; } function wp_filter_comment( $commentdata ) { if ( isset( $commentdata['user_ID'] ) ) { $commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_ID'] ); } elseif ( isset( $commentdata['user_id'] ) ) { $commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_id'] ); } $commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) ); $commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] ); $commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] ); $commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] ); $commentdata['comment_author_url'] = apply_filters( 'pre_comment_author_url', $commentdata['comment_author_url'] ); $commentdata['comment_author_email'] = apply_filters( 'pre_comment_author_email', $commentdata['comment_author_email'] ); $commentdata['filtered'] = true; return $commentdata; } function wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment ) { if ( $block ) { return $block; } if ( ( $time_newcomment - $time_lastcomment ) < 15 ) { return true; } return false; } function wp_new_comment( $commentdata, $wp_error = false ) { global $wpdb; if ( isset( $commentdata['user_ID'] ) ) { $commentdata['user_ID'] = (int) $commentdata['user_ID']; $commentdata['user_id'] = $commentdata['user_ID']; } $prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0; if ( ! isset( $commentdata['comment_author_IP'] ) ) { $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR']; } if ( ! isset( $commentdata['comment_agent'] ) ) { $commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; } $commentdata = apply_filters( 'preprocess_comment', $commentdata ); $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) { $commentdata['user_ID'] = (int) $commentdata['user_ID']; $commentdata['user_id'] = $commentdata['user_ID']; } elseif ( isset( $commentdata['user_id'] ) ) { $commentdata['user_id'] = (int) $commentdata['user_id']; } $commentdata['comment_parent'] = isset( $commentdata['comment_parent'] ) ? absint( $commentdata['comment_parent'] ) : 0; $parent_status = ( $commentdata['comment_parent'] > 0 ) ? wp_get_comment_status( $commentdata['comment_parent'] ) : ''; $commentdata['comment_parent'] = ( 'approved' === $parent_status || 'unapproved' === $parent_status ) ? $commentdata['comment_parent'] : 0; $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] ); $commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 ); if ( empty( $commentdata['comment_date'] ) ) { $commentdata['comment_date'] = current_time( 'mysql' ); } if ( empty( $commentdata['comment_date_gmt'] ) ) { $commentdata['comment_date_gmt'] = current_time( 'mysql', 1 ); } if ( empty( $commentdata['comment_type'] ) ) { $commentdata['comment_type'] = 'comment'; } $commentdata = wp_filter_comment( $commentdata ); $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); if ( is_wp_error( $commentdata['comment_approved'] ) ) { return $commentdata['comment_approved']; } $comment_ID = wp_insert_comment( $commentdata ); if ( ! $comment_ID ) { $fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' ); foreach ( $fields as $field ) { if ( isset( $commentdata[ $field ] ) ) { $commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] ); } } $commentdata = wp_filter_comment( $commentdata ); $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); if ( is_wp_error( $commentdata['comment_approved'] ) ) { return $commentdata['comment_approved']; } $comment_ID = wp_insert_comment( $commentdata ); if ( ! $comment_ID ) { return false; } } do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata ); return $comment_ID; } function wp_new_comment_notify_moderator( $comment_ID ) { $comment = get_comment( $comment_ID ); $maybe_notify = ( '0' == $comment->comment_approved ); $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID ); if ( ! $maybe_notify ) { return false; } return wp_notify_moderator( $comment_ID ); } function wp_new_comment_notify_postauthor( $comment_ID ) { $comment = get_comment( $comment_ID ); $maybe_notify = get_option( 'comments_notify' ); $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID ); if ( ! $maybe_notify ) { return false; } if ( ! isset( $comment->comment_approved ) || '1' != $comment->comment_approved ) { return false; } return wp_notify_postauthor( $comment_ID ); } function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false ) { global $wpdb; switch ( $comment_status ) { case 'hold': case '0': $status = '0'; break; case 'approve': case '1': $status = '1'; add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' ); break; case 'spam': $status = 'spam'; break; case 'trash': $status = 'trash'; break; default: return false; } $comment_old = clone get_comment( $comment_id ); if ( ! $wpdb->update( $wpdb->comments, array( 'comment_approved' => $status ), array( 'comment_ID' => $comment_old->comment_ID ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update comment status.' ), $wpdb->last_error ); } else { return false; } } clean_comment_cache( $comment_old->comment_ID ); $comment = get_comment( $comment_old->comment_ID ); do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status ); wp_transition_comment_status( $comment_status, $comment_old->comment_approved, $comment ); wp_update_comment_count( $comment->comment_post_ID ); return true; } function wp_update_comment( $commentarr, $wp_error = false ) { global $wpdb; $comment = get_comment( $commentarr['comment_ID'], ARRAY_A ); if ( empty( $comment ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_comment_id', __( 'Invalid comment ID.' ) ); } else { return false; } } if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post_id', __( 'Invalid post ID.' ) ); } else { return false; } } $comment = wp_slash( $comment ); $old_status = $comment['comment_approved']; $commentarr = array_merge( $comment, $commentarr ); $commentarr = wp_filter_comment( $commentarr ); $data = wp_unslash( $commentarr ); $data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] ); $data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] ); if ( ! isset( $data['comment_approved'] ) ) { $data['comment_approved'] = 1; } elseif ( 'hold' === $data['comment_approved'] ) { $data['comment_approved'] = 0; } elseif ( 'approve' === $data['comment_approved'] ) { $data['comment_approved'] = 1; } $comment_ID = $data['comment_ID']; $comment_post_ID = $data['comment_post_ID']; $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr ); if ( is_wp_error( $data ) ) { if ( $wp_error ) { return $data; } else { return false; } } $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' ); $data = wp_array_slice_assoc( $data, $keys ); $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) ); if ( false === $rval ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error ); } else { return false; } } if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) { foreach ( $commentarr['comment_meta'] as $meta_key => $meta_value ) { update_comment_meta( $comment_ID, $meta_key, $meta_value ); } } clean_comment_cache( $comment_ID ); wp_update_comment_count( $comment_post_ID ); do_action( 'edit_comment', $comment_ID, $data ); $comment = get_comment( $comment_ID ); wp_transition_comment_status( $comment->comment_approved, $old_status, $comment ); return $rval; } function wp_defer_comment_counting( $defer = null ) { static $_defer = false; if ( is_bool( $defer ) ) { $_defer = $defer; if ( ! $defer ) { wp_update_comment_count( null, true ); } } return $_defer; } function wp_update_comment_count( $post_id, $do_deferred = false ) { static $_deferred = array(); if ( empty( $post_id ) && ! $do_deferred ) { return false; } if ( $do_deferred ) { $_deferred = array_unique( $_deferred ); foreach ( $_deferred as $i => $_post_id ) { wp_update_comment_count_now( $_post_id ); unset( $_deferred[ $i ] ); } } if ( wp_defer_comment_counting() ) { $_deferred[] = $post_id; return true; } elseif ( $post_id ) { return wp_update_comment_count_now( $post_id ); } } function wp_update_comment_count_now( $post_id ) { global $wpdb; $post_id = (int) $post_id; if ( ! $post_id ) { return false; } wp_cache_delete( 'comments-0', 'counts' ); wp_cache_delete( "comments-{$post_id}", 'counts' ); $post = get_post( $post_id ); if ( ! $post ) { return false; } $old = (int) $post->comment_count; $new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id ); if ( is_null( $new ) ) { $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) ); } else { $new = (int) $new; } $wpdb->update( $wpdb->posts, array( 'comment_count' => $new ), array( 'ID' => $post_id ) ); clean_post_cache( $post ); do_action( 'wp_update_comment_count', $post_id, $new, $old ); do_action( "edit_post_{$post->post_type}", $post_id, $post ); do_action( 'edit_post', $post_id, $post ); return true; } function discover_pingback_server_uri( $url, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); } $pingback_str_dquote = 'rel="pingback"'; $pingback_str_squote = 'rel=\'pingback\''; $parsed_url = parse_url( $url ); if ( ! isset( $parsed_url['host'] ) ) { return false; } $uploads_dir = wp_get_upload_dir(); if ( 0 === strpos( $url, $uploads_dir['baseurl'] ) ) { return false; } $response = wp_safe_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0', ) ); if ( is_wp_error( $response ) ) { return false; } if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) { return wp_remote_retrieve_header( $response, 'x-pingback' ); } if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) { return false; } $response = wp_safe_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0', ) ); if ( is_wp_error( $response ) ) { return false; } $contents = wp_remote_retrieve_body( $response ); $pingback_link_offset_dquote = strpos( $contents, $pingback_str_dquote ); $pingback_link_offset_squote = strpos( $contents, $pingback_str_squote ); if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { $quote = ( $pingback_link_offset_dquote ) ? '"' : '\''; $pingback_link_offset = ( '"' === $quote ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote; $pingback_href_pos = strpos( $contents, 'href=', $pingback_link_offset ); $pingback_href_start = $pingback_href_pos + 6; $pingback_href_end = strpos( $contents, $quote, $pingback_href_start ); $pingback_server_url_len = $pingback_href_end - $pingback_href_start; $pingback_server_url = substr( $contents, $pingback_href_start, $pingback_server_url_len ); if ( $pingback_server_url_len > 0 ) { return $pingback_server_url; } } return false; } function do_all_pings() { do_action( 'do_all_pings' ); } function do_all_pingbacks() { $pings = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_pingme', 'fields' => 'ids', ) ); foreach ( $pings as $ping ) { delete_post_meta( $ping, '_pingme' ); pingback( null, $ping ); } } function do_all_enclosures() { $enclosures = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_encloseme', 'fields' => 'ids', ) ); foreach ( $enclosures as $enclosure ) { delete_post_meta( $enclosure, '_encloseme' ); do_enclose( null, $enclosure ); } } function do_all_trackbacks() { $trackbacks = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_trackbackme', 'fields' => 'ids', ) ); foreach ( $trackbacks as $trackback ) { delete_post_meta( $trackback, '_trackbackme' ); do_trackbacks( $trackback ); } } function do_trackbacks( $post_id ) { global $wpdb; $post = get_post( $post_id ); if ( ! $post ) { return false; } $to_ping = get_to_ping( $post ); $pinged = get_pung( $post ); if ( empty( $to_ping ) ) { $wpdb->update( $wpdb->posts, array( 'to_ping' => '' ), array( 'ID' => $post->ID ) ); return; } if ( empty( $post->post_excerpt ) ) { $excerpt = apply_filters( 'the_content', $post->post_content, $post->ID ); } else { $excerpt = apply_filters( 'the_excerpt', $post->post_excerpt ); } $excerpt = str_replace( ']]>', ']]>', $excerpt ); $excerpt = wp_html_excerpt( $excerpt, 252, '…' ); $post_title = apply_filters( 'the_title', $post->post_title, $post->ID ); $post_title = strip_tags( $post_title ); if ( $to_ping ) { foreach ( (array) $to_ping as $tb_ping ) { $tb_ping = trim( $tb_ping ); if ( ! in_array( $tb_ping, $pinged, true ) ) { trackback( $tb_ping, $post_title, $excerpt, $post->ID ); $pinged[] = $tb_ping; } else { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, + '')) WHERE ID = %d", $tb_ping, $post->ID ) ); } } } } function generic_ping( $post_id = 0 ) { $services = get_option( 'ping_sites' ); $services = explode( "\n", $services ); foreach ( (array) $services as $service ) { $service = trim( $service ); if ( '' !== $service ) { weblog_ping( $service ); } } return $post_id; } function pingback( $content, $post_id ) { include_once ABSPATH . WPINC . '/class-IXR.php'; include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php'; $post_links = array(); $post = get_post( $post_id ); if ( ! $post ) { return; } $pung = get_pung( $post ); if ( empty( $content ) ) { $content = $post->post_content; } $post_links_temp = wp_extract_urls( $content ); foreach ( (array) $post_links_temp as $link_test ) { if ( ! in_array( $link_test, $pung, true ) && ( url_to_postid( $link_test ) != $post->ID ) && ! is_local_attachment( $link_test ) ) { $test = parse_url( $link_test ); if ( $test ) { if ( isset( $test['query'] ) ) { $post_links[] = $link_test; } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) { $post_links[] = $link_test; } } } } $post_links = array_unique( $post_links ); do_action_ref_array( 'pre_ping', array( &$post_links, &$pung, $post->ID ) ); foreach ( (array) $post_links as $pagelinkedto ) { $pingback_server_url = discover_pingback_server_uri( $pagelinkedto ); if ( $pingback_server_url ) { set_time_limit( 60 ); $pagelinkedfrom = get_permalink( $post ); $client = new WP_HTTP_IXR_Client( $pingback_server_url ); $client->timeout = 3; $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . get_bloginfo( 'version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom ); $client->debug = false; if ( $client->query( 'pingback.ping', $pagelinkedfrom, $pagelinkedto ) || ( isset( $client->error->code ) && 48 == $client->error->code ) ) { add_ping( $post, $pagelinkedto ); } } } } function privacy_ping_filter( $sites ) { if ( '0' != get_option( 'blog_public' ) ) { return $sites; } else { return ''; } } function trackback( $trackback_url, $title, $excerpt, $ID ) { global $wpdb; if ( empty( $trackback_url ) ) { return; } $options = array(); $options['timeout'] = 10; $options['body'] = array( 'title' => $title, 'url' => get_permalink( $ID ), 'blog_name' => get_option( 'blogname' ), 'excerpt' => $excerpt, ); $response = wp_safe_remote_post( $trackback_url, $options ); if ( is_wp_error( $response ) ) { return; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID ) ); return $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID ) ); } function weblog_ping( $server = '', $path = '' ) { include_once ABSPATH . WPINC . '/class-IXR.php'; include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php'; $client = new WP_HTTP_IXR_Client( $server, ( ( ! strlen( trim( $path ) ) || ( '/' === $path ) ) ? false : $path ) ); $client->timeout = 3; $client->useragent .= ' -- WordPress/' . get_bloginfo( 'version' ); $client->debug = false; $home = trailingslashit( home_url() ); if ( ! $client->query( 'weblogUpdates.extendedPing', get_option( 'blogname' ), $home, get_bloginfo( 'rss2_url' ) ) ) { $client->query( 'weblogUpdates.ping', get_option( 'blogname' ), $home ); } } function pingback_ping_source_uri( $source_uri ) { return (string) wp_http_validate_url( $source_uri ); } function xmlrpc_pingback_error( $ixr_error ) { if ( 48 === $ixr_error->code ) { return $ixr_error; } return new IXR_Error( 0, '' ); } function clean_comment_cache( $ids ) { $comment_ids = (array) $ids; wp_cache_delete_multiple( $comment_ids, 'comment' ); foreach ( $comment_ids as $id ) { do_action( 'clean_comment_cache', $id ); } wp_cache_set( 'last_changed', microtime(), 'comment' ); } function update_comment_cache( $comments, $update_meta_cache = true ) { $data = array(); foreach ( (array) $comments as $comment ) { $data[ $comment->comment_ID ] = $comment; } wp_cache_add_multiple( $data, 'comment' ); if ( $update_meta_cache ) { $comment_ids = array(); foreach ( $comments as $comment ) { $comment_ids[] = $comment->comment_ID; } update_meta_cache( 'comment', $comment_ids ); } } function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' ); if ( ! empty( $non_cached_ids ) ) { $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_comment_cache( $fresh_comments, $update_meta_cache ); } } function _close_comments_for_old_posts( $posts, $query ) { if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) ) { return $posts; } $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) { return $posts; } $days_old = (int) get_option( 'close_comments_days_old' ); if ( ! $days_old ) { return $posts; } if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { $posts[0]->comment_status = 'closed'; $posts[0]->ping_status = 'closed'; } return $posts; } function _close_comments_for_old_post( $open, $post_id ) { if ( ! $open ) { return $open; } if ( ! get_option( 'close_comments_for_old_posts' ) ) { return $open; } $days_old = (int) get_option( 'close_comments_days_old' ); if ( ! $days_old ) { return $open; } $post = get_post( $post_id ); $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); if ( ! in_array( $post->post_type, $post_types, true ) ) { return $open; } if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { return $open; } if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { return false; } return $open; } function wp_handle_comment_submission( $comment_data ) { $comment_post_ID = 0; $comment_parent = 0; $user_ID = 0; $comment_author = null; $comment_author_email = null; $comment_author_url = null; $comment_content = null; if ( isset( $comment_data['comment_post_ID'] ) ) { $comment_post_ID = (int) $comment_data['comment_post_ID']; } if ( isset( $comment_data['author'] ) && is_string( $comment_data['author'] ) ) { $comment_author = trim( strip_tags( $comment_data['author'] ) ); } if ( isset( $comment_data['email'] ) && is_string( $comment_data['email'] ) ) { $comment_author_email = trim( $comment_data['email'] ); } if ( isset( $comment_data['url'] ) && is_string( $comment_data['url'] ) ) { $comment_author_url = trim( $comment_data['url'] ); } if ( isset( $comment_data['comment'] ) && is_string( $comment_data['comment'] ) ) { $comment_content = trim( $comment_data['comment'] ); } if ( isset( $comment_data['comment_parent'] ) ) { $comment_parent = absint( $comment_data['comment_parent'] ); } $post = get_post( $comment_post_ID ); if ( empty( $post->comment_status ) ) { do_action( 'comment_id_not_found', $comment_post_ID ); return new WP_Error( 'comment_id_not_found' ); } $status = get_post_status( $post ); if ( ( 'private' === $status ) && ! current_user_can( 'read_post', $comment_post_ID ) ) { return new WP_Error( 'comment_id_not_found' ); } $status_obj = get_post_status_object( $status ); if ( ! comments_open( $comment_post_ID ) ) { do_action( 'comment_closed', $comment_post_ID ); return new WP_Error( 'comment_closed', __( 'Sorry, comments are closed for this item.' ), 403 ); } elseif ( 'trash' === $status ) { do_action( 'comment_on_trash', $comment_post_ID ); return new WP_Error( 'comment_on_trash' ); } elseif ( ! $status_obj->public && ! $status_obj->private ) { do_action( 'comment_on_draft', $comment_post_ID ); if ( current_user_can( 'read_post', $comment_post_ID ) ) { return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); } else { return new WP_Error( 'comment_on_draft' ); } } elseif ( post_password_required( $comment_post_ID ) ) { do_action( 'comment_on_password_protected', $comment_post_ID ); return new WP_Error( 'comment_on_password_protected' ); } else { do_action( 'pre_comment_on_post', $comment_post_ID ); } $user = wp_get_current_user(); if ( $user->exists() ) { if ( empty( $user->display_name ) ) { $user->display_name = $user->user_login; } $comment_author = $user->display_name; $comment_author_email = $user->user_email; $comment_author_url = $user->user_url; $user_ID = $user->ID; if ( current_user_can( 'unfiltered_html' ) ) { if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] ) || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_ID ) ) { kses_remove_filters(); kses_init_filters(); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); add_filter( 'pre_comment_content', 'wp_filter_kses' ); } } } else { if ( get_option( 'comment_registration' ) ) { return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 ); } } $comment_type = 'comment'; if ( get_option( 'require_name_email' ) && ! $user->exists() ) { if ( '' == $comment_author_email || '' == $comment_author ) { return new WP_Error( 'require_name_email', __( 'Error: Please fill the required fields.' ), 200 ); } elseif ( ! is_email( $comment_author_email ) ) { return new WP_Error( 'require_valid_email', __( 'Error: Please enter a valid email address.' ), 200 ); } } $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata ); if ( '' === $comment_content && ! $allow_empty_comment ) { return new WP_Error( 'require_valid_comment', __( 'Error: Please type your comment text.' ), 200 ); } $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata ); if ( is_wp_error( $check_max_lengths ) ) { return $check_max_lengths; } $comment_id = wp_new_comment( wp_slash( $commentdata ), true ); if ( is_wp_error( $comment_id ) ) { return $comment_id; } if ( ! $comment_id ) { return new WP_Error( 'comment_save_error', __( 'Error: The comment could not be saved. Please try again later.' ), 500 ); } return get_comment( $comment_id ); } function wp_register_comment_personal_data_exporter( $exporters ) { $exporters['wordpress-comments'] = array( 'exporter_friendly_name' => __( 'WordPress Comments' ), 'callback' => 'wp_comments_personal_data_exporter', ); return $exporters; } function wp_comments_personal_data_exporter( $email_address, $page = 1 ) { $number = 500; $page = (int) $page; $data_to_export = array(); $comments = get_comments( array( 'author_email' => $email_address, 'number' => $number, 'paged' => $page, 'order_by' => 'comment_ID', 'order' => 'ASC', 'update_comment_meta_cache' => false, ) ); $comment_prop_to_export = array( 'comment_author' => __( 'Comment Author' ), 'comment_author_email' => __( 'Comment Author Email' ), 'comment_author_url' => __( 'Comment Author URL' ), 'comment_author_IP' => __( 'Comment Author IP' ), 'comment_agent' => __( 'Comment Author User Agent' ), 'comment_date' => __( 'Comment Date' ), 'comment_content' => __( 'Comment Content' ), 'comment_link' => __( 'Comment URL' ), ); foreach ( (array) $comments as $comment ) { $comment_data_to_export = array(); foreach ( $comment_prop_to_export as $key => $name ) { $value = ''; switch ( $key ) { case 'comment_author': case 'comment_author_email': case 'comment_author_url': case 'comment_author_IP': case 'comment_agent': case 'comment_date': $value = $comment->{$key}; break; case 'comment_content': $value = get_comment_text( $comment->comment_ID ); break; case 'comment_link': $value = get_comment_link( $comment->comment_ID ); $value = sprintf( '%s', esc_url( $value ), esc_html( $value ) ); break; } if ( ! empty( $value ) ) { $comment_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $data_to_export[] = array( 'group_id' => 'comments', 'group_label' => __( 'Comments' ), 'group_description' => __( 'User’s comment data.' ), 'item_id' => "comment-{$comment->comment_ID}", 'data' => $comment_data_to_export, ); } $done = count( $comments ) < $number; return array( 'data' => $data_to_export, 'done' => $done, ); } function wp_register_comment_personal_data_eraser( $erasers ) { $erasers['wordpress-comments'] = array( 'eraser_friendly_name' => __( 'WordPress Comments' ), 'callback' => 'wp_comments_personal_data_eraser', ); return $erasers; } function wp_comments_personal_data_eraser( $email_address, $page = 1 ) { global $wpdb; if ( empty( $email_address ) ) { return array( 'items_removed' => false, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } $number = 500; $page = (int) $page; $items_removed = false; $items_retained = false; $comments = get_comments( array( 'author_email' => $email_address, 'number' => $number, 'paged' => $page, 'order_by' => 'comment_ID', 'order' => 'ASC', 'include_unapproved' => true, ) ); $anon_author = __( 'Anonymous' ); $messages = array(); foreach ( (array) $comments as $comment ) { $anonymized_comment = array(); $anonymized_comment['comment_agent'] = ''; $anonymized_comment['comment_author'] = $anon_author; $anonymized_comment['comment_author_email'] = ''; $anonymized_comment['comment_author_IP'] = wp_privacy_anonymize_data( 'ip', $comment->comment_author_IP ); $anonymized_comment['comment_author_url'] = ''; $anonymized_comment['user_id'] = 0; $comment_id = (int) $comment->comment_ID; $anon_message = apply_filters( 'wp_anonymize_comment', true, $comment, $anonymized_comment ); if ( true !== $anon_message ) { if ( $anon_message && is_string( $anon_message ) ) { $messages[] = esc_html( $anon_message ); } else { $messages[] = sprintf( __( 'Comment %d contains personal data but could not be anonymized.' ), $comment_id ); } $items_retained = true; continue; } $args = array( 'comment_ID' => $comment_id, ); $updated = $wpdb->update( $wpdb->comments, $anonymized_comment, $args ); if ( $updated ) { $items_removed = true; clean_comment_cache( $comment_id ); } else { $items_retained = true; } } $done = count( $comments ) < $number; return array( 'items_removed' => $items_removed, 'items_retained' => $items_retained, 'messages' => $messages, 'done' => $done, ); } function wp_cache_set_comments_last_changed() { wp_cache_set( 'last_changed', microtime(), 'comment' ); } function _wp_batch_update_comment_type() { global $wpdb; $lock_name = 'update_comment_type.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_name ); if ( ! $lock_result || ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) ) { wp_schedule_single_event( time() + ( 5 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); return; } } update_option( $lock_name, time() ); $empty_comment_type = $wpdb->get_var( "SELECT comment_ID FROM $wpdb->comments + WHERE comment_type = '' + LIMIT 1" ); if ( ! $empty_comment_type ) { update_option( 'finished_updating_comment_type', true ); delete_option( $lock_name ); return; } wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); $comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID + FROM {$wpdb->comments} + WHERE comment_type = '' + ORDER BY comment_ID DESC + LIMIT %d", $comment_batch_size ) ); if ( $comment_ids ) { $comment_id_list = implode( ',', $comment_ids ); $wpdb->query( "UPDATE {$wpdb->comments} + SET comment_type = 'comment' + WHERE comment_type = '' + AND comment_ID IN ({$comment_id_list})" ); clean_comment_cache( $comment_ids ); } delete_option( $lock_name ); } function _wp_check_for_scheduled_update_comment_type() { if ( ! get_option( 'finished_updating_comment_type' ) && ! wp_next_scheduled( 'wp_update_comment_type_batch' ) ) { wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_update_comment_type_batch' ); } } user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httprequest($path, $fp, $URI, $this->_httpmethod); } $this->_disconnect($fp); if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { $this->_httpsrequest($URI,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httpsrequest($path, $URI, $this->_httpmethod); } if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } function submit($URI, $formvars="", $formfiles="") { unset($postdata); $postdata = $this->_prepare_post_body($formvars, $formfiles); $URI_PARTS = parse_url($URI); if (!empty($URI_PARTS["user"])) $this->user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { $this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); } $this->_disconnect($fp); if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata); } if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } function fetchlinks($URI) { if ($this->fetch($URI)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striplinks($this->results[$x]); } else $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results, $URI); return true; } else return false; } function fetchform($URI) { if ($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_stripform($this->results[$x]); } else $this->results = $this->_stripform($this->results); return true; } else return false; } function fetchtext($URI) { if($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striptext($this->results[$x]); } else $this->results = $this->_striptext($this->results); return true; } else return false; } function submitlinks($URI, $formvars="", $formfiles="") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striplinks($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } function submittext($URI, $formvars = "", $formfiles = "") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striptext($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striptext($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } function set_submit_multipart() { $this->_submit_type = "multipart/form-data"; } function set_submit_normal() { $this->_submit_type = "application/x-www-form-urlencoded"; } function _striplinks($document) { preg_match_all("'<\s*a\s.*?href\s*=\s* # find ]+)) # if quote found, match up to next matching + # quote, otherwise match up to next space + 'isx",$document,$links); foreach ( $links[2] as $key => $val ) { if(!empty($val)) $match[] = $val; } foreach ( $links[3] as $key => $val ) { if(!empty($val)) $match[] = $val; } return $match; } function _stripform($document) { preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); $match = implode("\r\n",$elements[0]); return $match; } function _striptext($document) { $search = array("']*?>.*?'si", "'<[\/\!]*?[^<>]*?>'si", "'([\r\n])[\s]+'", "'&(quot|#34|#034|#x22);'i", "'&(amp|#38|#038|#x26);'i", "'&(lt|#60|#060|#x3c);'i", "'&(gt|#62|#062|#x3e);'i", "'&(nbsp|#160|#xa0);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&(reg|#174);'i", "'&(deg|#176);'i", "'&(#39|#039|#x27);'", "'&(euro|#8364);'i", "'&a(uml|UML);'", "'&o(uml|UML);'", "'&u(uml|UML);'", "'&A(uml|UML);'", "'&O(uml|UML);'", "'&U(uml|UML);'", "'ß'i", ); $replace = array( "", "", "\\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), chr(174), chr(176), chr(39), chr(128), chr(0xE4), chr(0xF6), chr(0xFC), chr(0xC4), chr(0xD6), chr(0xDC), chr(0xDF), ); $text = preg_replace($search,$replace,$document); return $text; } function _expandlinks($links,$URI) { preg_match("/^[^\?]+/",$URI,$match); $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); $match = preg_replace("|/$|","",$match); $match_part = parse_url($match); $match_root = $match_part["scheme"]."://".$match_part["host"]; $search = array( "|^http://".preg_quote($this->host)."|i", "|^(\/)|i", "|^(?!http://)(?!mailto:)|i", "|/\./|", "|/[^\/]+/\.\./|" ); $replace = array( "", $match_root."/", $match."/", "/", "/" ); $expandedLinks = preg_replace($search,$replace,$links); return $expandedLinks; } function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") { $cookie_headers = ''; if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; if(!empty($this->agent)) $headers .= "User-Agent: ".$this->agent."\r\n"; if(!empty($this->host) && !isset($this->rawheaders['Host'])) { $headers .= "Host: ".$this->host; if(!empty($this->port) && $this->port != 80) $headers .= ":".$this->port; $headers .= "\r\n"; } if(!empty($this->accept)) $headers .= "Accept: ".$this->accept."\r\n"; if(!empty($this->referer)) $headers .= "Referer: ".$this->referer."\r\n"; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_headers .= 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers .= substr($cookie_headers,0,-2) . "\r\n"; } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; foreach ( $this->rawheaders as $headerKey => $headerVal ) $headers .= $headerKey.": ".$headerVal."\r\n"; } if(!empty($content_type)) { $headers .= "Content-type: $content_type"; if ($content_type == "multipart/form-data") $headers .= "; boundary=".$this->_mime_boundary; $headers .= "\r\n"; } if(!empty($body)) $headers .= "Content-length: ".strlen($body)."\r\n"; if(!empty($this->user) || !empty($this->pass)) $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; if(!empty($this->proxy_user)) $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; $headers .= "\r\n"; if ($this->read_timeout > 0) socket_set_timeout($fp, $this->read_timeout); $this->timed_out = false; fwrite($fp,$headers.$body,strlen($headers.$body)); $this->_redirectaddr = false; unset($this->headers); while($currentHeader = fgets($fp,$this->_maxlinelen)) { if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } if($currentHeader == "\r\n") break; if(preg_match("/^(Location:|URI:)/i",$currentHeader)) { preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches); if(!preg_match("|\:\/\/|",$matches[2])) { $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$currentHeader)) { if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) { $this->status= $status[1]; } $this->response_code = $currentHeader; } $this->headers[] = $currentHeader; } $results = ''; do { $_data = fread($fp, $this->maxlength); if (strlen($_data) == 0) { break; } $results .= $_data; } while(true); if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } elseif(is_array($this->results)) $this->results[] = $results; else $this->results = $results; return true; } function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") { if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $headers = array(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; if(!empty($this->agent)) $headers[] = "User-Agent: ".$this->agent; if(!empty($this->host)) if(!empty($this->port)) $headers[] = "Host: ".$this->host.":".$this->port; else $headers[] = "Host: ".$this->host; if(!empty($this->accept)) $headers[] = "Accept: ".$this->accept; if(!empty($this->referer)) $headers[] = "Referer: ".$this->referer; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_str = 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_str .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers[] = substr($cookie_str,0,-2); } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; foreach ( $this->rawheaders as $headerKey => $headerVal ) $headers[] = $headerKey.": ".$headerVal; } if(!empty($content_type)) { if ($content_type == "multipart/form-data") $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; else $headers[] = "Content-type: $content_type"; } if(!empty($body)) $headers[] = "Content-length: ".strlen($body); if(!empty($this->user) || !empty($this->pass)) $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); $headerfile = tempnam( $this->temp_dir, "sno" ); $cmdline_params = '-k -D ' . escapeshellarg( $headerfile ); foreach ( $headers as $header ) { $cmdline_params .= ' -H ' . escapeshellarg( $header ); } if ( ! empty( $body ) ) { $cmdline_params .= ' -d ' . escapeshellarg( $body ); } if ( $this->read_timeout > 0 ) { $cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout ); } exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return ); if($return) { $this->error = "Error: cURL could not retrieve the document, error $return."; return false; } $results = implode("\r\n",$results); $result_headers = file("$headerfile"); $this->_redirectaddr = false; unset($this->headers); for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) { if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) { preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches); if(!preg_match("|\:\/\/|",$matches[2])) { $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) $this->response_code = $result_headers[$currentHeader]; $this->headers[] = $result_headers[$currentHeader]; } if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } elseif(is_array($this->results)) $this->results[] = $results; else $this->results = $results; unlink("$headerfile"); return true; } function setcookies() { for($x=0; $xheaders); $x++) { if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) $this->cookies[$match[1]] = urldecode($match[2]); } } function _check_timeout($fp) { if ($this->read_timeout > 0) { $fp_status = socket_get_status($fp); if ($fp_status["timed_out"]) { $this->timed_out = true; return true; } } return false; } function _connect(&$fp) { if(!empty($this->proxy_host) && !empty($this->proxy_port)) { $this->_isproxy = true; $host = $this->proxy_host; $port = $this->proxy_port; } else { $host = $this->host; $port = $this->port; } $this->status = 0; if($fp = fsockopen( $host, $port, $errno, $errstr, $this->_fp_timeout )) { return true; } else { $this->status = $errno; switch($errno) { case -3: $this->error="socket creation failed (-3)"; case -4: $this->error="dns lookup failure (-4)"; case -5: $this->error="connection refused or timed out (-5)"; default: $this->error="connection failed (".$errno.")"; } return false; } } function _disconnect($fp) { return(fclose($fp)); } function _prepare_post_body($formvars, $formfiles) { settype($formvars, "array"); settype($formfiles, "array"); $postdata = ''; if (count($formvars) == 0 && count($formfiles) == 0) return; switch ($this->_submit_type) { case "application/x-www-form-urlencoded": reset($formvars); foreach ( $formvars as $key => $val ) { if (is_array($val) || is_object($val)) { foreach ( $val as $cur_key => $cur_val ) { $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; } } else $postdata .= urlencode($key)."=".urlencode($val)."&"; } break; case "multipart/form-data": $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); reset($formvars); foreach ( $formvars as $key => $val ) { if (is_array($val) || is_object($val)) { foreach ( $val as $cur_key => $cur_val ) { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; $postdata .= "$cur_val\r\n"; } } else { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; $postdata .= "$val\r\n"; } } reset($formfiles); foreach ( $formfiles as $field_name => $file_names ) { settype($file_names, "array"); foreach ( $file_names as $file_name ) { if (!is_readable($file_name)) continue; $fp = fopen($file_name, "r"); $file_content = fread($fp, filesize($file_name)); fclose($fp); $base_name = basename($file_name); $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; $postdata .= "$file_content\r\n"; } } $postdata .= "--".$this->_mime_boundary."--\r\n"; break; } return $postdata; } } endif; ?> +taxonomy ) && 'nav_menu' === $menu_obj->taxonomy ) { return true; } return false; } function register_nav_menus( $locations = array() ) { global $_wp_registered_nav_menus; add_theme_support( 'menus' ); foreach ( $locations as $key => $value ) { if ( is_int( $key ) ) { _doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' ); break; } } $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations ); } function unregister_nav_menu( $location ) { global $_wp_registered_nav_menus; if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[ $location ] ) ) { unset( $_wp_registered_nav_menus[ $location ] ); if ( empty( $_wp_registered_nav_menus ) ) { _remove_theme_support( 'menus' ); } return true; } return false; } function register_nav_menu( $location, $description ) { register_nav_menus( array( $location => $description ) ); } function get_registered_nav_menus() { global $_wp_registered_nav_menus; if ( isset( $_wp_registered_nav_menus ) ) { return $_wp_registered_nav_menus; } return array(); } function get_nav_menu_locations() { $locations = get_theme_mod( 'nav_menu_locations' ); return ( is_array( $locations ) ) ? $locations : array(); } function has_nav_menu( $location ) { $has_nav_menu = false; $registered_nav_menus = get_registered_nav_menus(); if ( isset( $registered_nav_menus[ $location ] ) ) { $locations = get_nav_menu_locations(); $has_nav_menu = ! empty( $locations[ $location ] ); } return apply_filters( 'has_nav_menu', $has_nav_menu, $location ); } function wp_get_nav_menu_name( $location ) { $menu_name = ''; $locations = get_nav_menu_locations(); if ( isset( $locations[ $location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $location ] ); if ( $menu && $menu->name ) { $menu_name = $menu->name; } } return apply_filters( 'wp_get_nav_menu_name', $menu_name, $location ); } function is_nav_menu_item( $menu_item_id = 0 ) { return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' === get_post_type( $menu_item_id ) ) ); } function wp_create_nav_menu( $menu_name ) { return wp_update_nav_menu_object( 0, array( 'menu-name' => $menu_name ) ); } function wp_delete_nav_menu( $menu ) { $menu = wp_get_nav_menu_object( $menu ); if ( ! $menu ) { return false; } $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' ); if ( ! empty( $menu_objects ) ) { foreach ( $menu_objects as $item ) { wp_delete_post( $item ); } } $result = wp_delete_term( $menu->term_id, 'nav_menu' ); $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { if ( $menu_id == $menu->term_id ) { $locations[ $location ] = 0; } } set_theme_mod( 'nav_menu_locations', $locations ); if ( $result && ! is_wp_error( $result ) ) { do_action( 'wp_delete_nav_menu', $menu->term_id ); } return $result; } function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) { $menu_id = (int) $menu_id; $_menu = wp_get_nav_menu_object( $menu_id ); $args = array( 'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ), 'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ), 'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ), 'slug' => null, ); $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); if ( $_possible_existing && ! is_wp_error( $_possible_existing ) && isset( $_possible_existing->term_id ) && $_possible_existing->term_id != $menu_id ) { return new WP_Error( 'menu_exists', sprintf( __( 'The menu name %s conflicts with another menu name. Please try another.' ), '' . esc_html( $menu_data['menu-name'] ) . '' ) ); } if ( ! $_menu || is_wp_error( $_menu ) ) { $menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); if ( $menu_exists ) { return new WP_Error( 'menu_exists', sprintf( __( 'The menu name %s conflicts with another menu name. Please try another.' ), '' . esc_html( $menu_data['menu-name'] ) . '' ) ); } $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args ); if ( is_wp_error( $_menu ) ) { return $_menu; } do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data ); return (int) $_menu['term_id']; } if ( ! $_menu || ! isset( $_menu->term_id ) ) { return 0; } $menu_id = (int) $_menu->term_id; $update_response = wp_update_term( $menu_id, 'nav_menu', $args ); if ( is_wp_error( $update_response ) ) { return $update_response; } $menu_id = (int) $update_response['term_id']; do_action( 'wp_update_nav_menu', $menu_id, $menu_data ); return $menu_id; } function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array(), $fire_after_hooks = true ) { $menu_id = (int) $menu_id; $menu_item_db_id = (int) $menu_item_db_id; if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) ) { return new WP_Error( 'update_nav_menu_item_failed', __( 'The given object ID is not that of a menu item.' ) ); } $menu = wp_get_nav_menu_object( $menu_id ); if ( ! $menu && 0 !== $menu_id ) { return new WP_Error( 'invalid_menu_id', __( 'Invalid menu ID.' ) ); } if ( is_wp_error( $menu ) ) { return $menu; } $defaults = array( 'menu-item-db-id' => $menu_item_db_id, 'menu-item-object-id' => 0, 'menu-item-object' => '', 'menu-item-parent-id' => 0, 'menu-item-position' => 0, 'menu-item-type' => 'custom', 'menu-item-title' => '', 'menu-item-url' => '', 'menu-item-description' => '', 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => '', 'menu-item-xfn' => '', 'menu-item-status' => '', 'menu-item-post-date' => '', 'menu-item-post-date-gmt' => '', ); $args = wp_parse_args( $menu_item_data, $defaults ); if ( 0 == $menu_id ) { $args['menu-item-position'] = 1; } elseif ( 0 == (int) $args['menu-item-position'] ) { $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); $last_item = array_pop( $menu_items ); $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items ); } $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0; if ( 'custom' === $args['menu-item-type'] ) { $args['menu-item-url'] = trim( $args['menu-item-url'] ); } else { $args['menu-item-url'] = ''; $original_title = ''; if ( 'taxonomy' === $args['menu-item-type'] ) { $original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); } elseif ( 'post_type' === $args['menu-item-type'] ) { $original_object = get_post( $args['menu-item-object-id'] ); $original_parent = (int) $original_object->post_parent; $original_title = $original_object->post_title; } elseif ( 'post_type_archive' === $args['menu-item-type'] ) { $original_object = get_post_type_object( $args['menu-item-object'] ); if ( $original_object ) { $original_title = $original_object->labels->archives; } } if ( wp_unslash( $args['menu-item-title'] ) === wp_specialchars_decode( $original_title ) ) { $args['menu-item-title'] = ''; } if ( '' === $args['menu-item-title'] && '' === $args['menu-item-description'] ) { $args['menu-item-description'] = ' '; } } $post = array( 'menu_order' => $args['menu-item-position'], 'ping_status' => 0, 'post_content' => $args['menu-item-description'], 'post_excerpt' => $args['menu-item-attr-title'], 'post_parent' => $original_parent, 'post_title' => $args['menu-item-title'], 'post_type' => 'nav_menu_item', ); $post_date = wp_resolve_post_date( $args['menu-item-post-date'], $args['menu-item-post-date-gmt'] ); if ( $post_date ) { $post['post_date'] = $post_date; } $update = 0 != $menu_item_db_id; if ( ! $update ) { $post['ID'] = 0; $post['post_status'] = 'publish' === $args['menu-item-status'] ? 'publish' : 'draft'; $menu_item_db_id = wp_insert_post( $post, true, $fire_after_hooks ); if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) ) { return $menu_item_db_id; } do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args ); } if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) ) { $update_terms = wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' ); if ( is_wp_error( $update_terms ) ) { return $update_terms; } } if ( 'custom' === $args['menu-item-type'] ) { $args['menu-item-object-id'] = $menu_item_db_id; $args['menu-item-object'] = 'custom'; } $menu_item_db_id = (int) $menu_item_db_id; update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ( (int) $args['menu-item-parent-id'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ( (int) $args['menu-item-object-id'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) ); $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) ); $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) ); update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw( $args['menu-item-url'] ) ); if ( 0 == $menu_id ) { update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() ); } elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) ) { delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' ); } if ( $update ) { $post['ID'] = $menu_item_db_id; $post['post_status'] = ( 'draft' === $args['menu-item-status'] ) ? 'draft' : 'publish'; $update_post = wp_update_post( $post, true ); if ( is_wp_error( $update_post ) ) { return $update_post; } } do_action( 'wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args ); return $menu_item_db_id; } function wp_get_nav_menus( $args = array() ) { $defaults = array( 'taxonomy' => 'nav_menu', 'hide_empty' => false, 'orderby' => 'name', ); $args = wp_parse_args( $args, $defaults ); return apply_filters( 'wp_get_nav_menus', get_terms( $args ), $args ); } function _is_valid_nav_menu_item( $item ) { return empty( $item->_invalid ); } function wp_get_nav_menu_items( $menu, $args = array() ) { $menu = wp_get_nav_menu_object( $menu ); if ( ! $menu ) { return false; } static $fetched = array(); if ( ! taxonomy_exists( 'nav_menu' ) ) { return false; } $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true, 'tax_query' => array( array( 'taxonomy' => 'nav_menu', 'field' => 'term_taxonomy_id', 'terms' => $menu->term_taxonomy_id, ), ), ); $args = wp_parse_args( $args, $defaults ); if ( $menu->count > 0 ) { $items = get_posts( $args ); } else { $items = array(); } if ( empty( $fetched[ $menu->term_id ] ) ) { $fetched[ $menu->term_id ] = true; $post_ids = array(); $term_ids = array(); foreach ( $items as $item ) { $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true ); $type = get_post_meta( $item->ID, '_menu_item_type', true ); if ( 'post_type' === $type ) { $post_ids[] = (int) $object_id; } elseif ( 'taxonomy' === $type ) { $term_ids[] = (int) $object_id; } } if ( ! empty( $post_ids ) ) { _prime_post_caches( $post_ids, false ); } unset( $post_ids ); if ( ! empty( $term_ids ) ) { _prime_term_caches( $term_ids ); } unset( $term_ids ); } $items = array_map( 'wp_setup_nav_menu_item', $items ); if ( ! is_admin() ) { $items = array_filter( $items, '_is_valid_nav_menu_item' ); } if ( ARRAY_A === $args['output'] ) { $items = wp_list_sort( $items, array( $args['output_key'] => 'ASC', ) ); $i = 1; foreach ( $items as $k => $item ) { $items[ $k ]->{$args['output_key']} = $i++; } } return apply_filters( 'wp_get_nav_menu_items', $items, $menu, $args ); } function wp_setup_nav_menu_item( $menu_item ) { if ( isset( $menu_item->post_type ) ) { if ( 'nav_menu_item' === $menu_item->post_type ) { $menu_item->db_id = (int) $menu_item->ID; $menu_item->menu_item_parent = ! isset( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent; $menu_item->object_id = ! isset( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id; $menu_item->object = ! isset( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object; $menu_item->type = ! isset( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type; if ( 'post_type' === $menu_item->type ) { $object = get_post_type_object( $menu_item->object ); if ( $object ) { $menu_item->type_label = $object->labels->singular_name; if ( function_exists( 'get_post_states' ) ) { $menu_post = get_post( $menu_item->object_id ); $post_states = get_post_states( $menu_post ); if ( $post_states ) { $menu_item->type_label = wp_strip_all_tags( implode( ', ', $post_states ) ); } } } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } if ( 'trash' === get_post_status( $menu_item->object_id ) ) { $menu_item->_invalid = true; } $original_object = get_post( $menu_item->object_id ); if ( $original_object ) { $menu_item->url = get_permalink( $original_object->ID ); $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID ); } else { $menu_item->url = ''; $original_title = ''; $menu_item->_invalid = true; } if ( '' === $original_title ) { $original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id ); } $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title; } elseif ( 'post_type_archive' === $menu_item->type ) { $object = get_post_type_object( $menu_item->object ); if ( $object ) { $menu_item->title = ( '' === $menu_item->post_title ) ? $object->labels->archives : $menu_item->post_title; $post_type_description = $object->description; } else { $post_type_description = ''; $menu_item->_invalid = true; } $menu_item->type_label = __( 'Post Type Archive' ); $post_content = wp_trim_words( $menu_item->post_content, 200 ); $post_type_description = ( '' === $post_content ) ? $post_type_description : $post_content; $menu_item->url = get_post_type_archive_link( $menu_item->object ); } elseif ( 'taxonomy' === $menu_item->type ) { $object = get_taxonomy( $menu_item->object ); if ( $object ) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); if ( $original_object && ! is_wp_error( $original_object ) ) { $menu_item->url = get_term_link( (int) $menu_item->object_id, $menu_item->object ); $original_title = $original_object->name; } else { $menu_item->url = ''; $original_title = ''; $menu_item->_invalid = true; } if ( '' === $original_title ) { $original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id ); } $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title; } else { $menu_item->type_label = __( 'Custom Link' ); $menu_item->title = $menu_item->post_title; $menu_item->url = ! isset( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url; } $menu_item->target = ! isset( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target; $menu_item->attr_title = ! isset( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title; if ( ! isset( $menu_item->description ) ) { $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) ); } $menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes; $menu_item->xfn = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn; } else { $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->ID; $menu_item->type = 'post_type'; $object = get_post_type_object( $menu_item->post_type ); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; if ( '' === $menu_item->post_title ) { $menu_item->post_title = sprintf( __( '#%d (no title)' ), $menu_item->ID ); } $menu_item->title = $menu_item->post_title; $menu_item->url = get_permalink( $menu_item->ID ); $menu_item->target = ''; $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' ); $menu_item->description = apply_filters( 'nav_menu_description', '' ); $menu_item->classes = array(); $menu_item->xfn = ''; } } elseif ( isset( $menu_item->taxonomy ) ) { $menu_item->ID = $menu_item->term_id; $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->term_id; $menu_item->post_parent = (int) $menu_item->parent; $menu_item->type = 'taxonomy'; $object = get_taxonomy( $menu_item->taxonomy ); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; $menu_item->title = $menu_item->name; $menu_item->url = get_term_link( $menu_item, $menu_item->taxonomy ); $menu_item->target = ''; $menu_item->attr_title = ''; $menu_item->description = get_term_field( 'description', $menu_item->term_id, $menu_item->taxonomy ); $menu_item->classes = array(); $menu_item->xfn = ''; } return apply_filters( 'wp_setup_nav_menu_item', $menu_item ); } function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) { $object_id = (int) $object_id; $menu_item_ids = array(); $query = new WP_Query; $menu_items = $query->query( array( 'meta_key' => '_menu_item_object_id', 'meta_value' => $object_id, 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'posts_per_page' => -1, ) ); foreach ( (array) $menu_items as $menu_item ) { if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) { $menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true ); if ( 'post_type' === $object_type && 'post_type' === $menu_item_type ) { $menu_item_ids[] = (int) $menu_item->ID; } elseif ( 'taxonomy' === $object_type && 'taxonomy' === $menu_item_type && get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy ) { $menu_item_ids[] = (int) $menu_item->ID; } } } return array_unique( $menu_item_ids ); } function _wp_delete_post_menu_item( $object_id ) { $object_id = (int) $object_id; $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' ); foreach ( (array) $menu_item_ids as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function _wp_delete_tax_menu_item( $object_id, $tt_id, $taxonomy ) { $object_id = (int) $object_id; $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); foreach ( (array) $menu_item_ids as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) { if ( 'publish' !== $new_status || 'publish' === $old_status || 'page' !== $post->post_type ) { return; } if ( ! empty( $post->post_parent ) ) { return; } $auto_add = get_option( 'nav_menu_options' ); if ( empty( $auto_add ) || ! is_array( $auto_add ) || ! isset( $auto_add['auto_add'] ) ) { return; } $auto_add = $auto_add['auto_add']; if ( empty( $auto_add ) || ! is_array( $auto_add ) ) { return; } $args = array( 'menu-item-object-id' => $post->ID, 'menu-item-object' => $post->post_type, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish', ); foreach ( $auto_add as $menu_id ) { $items = wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); if ( ! is_array( $items ) ) { continue; } foreach ( $items as $item ) { if ( $post->ID == $item->object_id ) { continue 2; } } wp_update_nav_menu_item( $menu_id, 0, $args ); } } function _wp_delete_customize_changeset_dependent_auto_drafts( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'customize_changeset' !== $post->post_type ) { return; } $data = json_decode( $post->post_content, true ); if ( empty( $data['nav_menus_created_posts']['value'] ) ) { return; } remove_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); foreach ( $data['nav_menus_created_posts']['value'] as $stub_post_id ) { if ( empty( $stub_post_id ) ) { continue; } if ( 'auto-draft' === get_post_status( $stub_post_id ) ) { wp_delete_post( $stub_post_id, true ); } elseif ( 'draft' === get_post_status( $stub_post_id ) ) { wp_trash_post( $stub_post_id ); delete_post_meta( $stub_post_id, '_customize_changeset_uuid' ); } } add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); } function _wp_menus_changed() { $old_nav_menu_locations = get_option( 'theme_switch_menu_locations', array() ); $new_nav_menu_locations = get_nav_menu_locations(); $mapped_nav_menu_locations = wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ); set_theme_mod( 'nav_menu_locations', $mapped_nav_menu_locations ); delete_option( 'theme_switch_menu_locations' ); } function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) { $registered_nav_menus = get_registered_nav_menus(); $new_nav_menu_locations = array_intersect_key( $new_nav_menu_locations, $registered_nav_menus ); if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } if ( 1 === count( $old_nav_menu_locations ) && 1 === count( $registered_nav_menus ) ) { $new_nav_menu_locations[ key( $registered_nav_menus ) ] = array_pop( $old_nav_menu_locations ); return $new_nav_menu_locations; } $old_locations = array_keys( $old_nav_menu_locations ); foreach ( $registered_nav_menus as $location => $name ) { if ( in_array( $location, $old_locations, true ) ) { $new_nav_menu_locations[ $location ] = $old_nav_menu_locations[ $location ]; unset( $old_nav_menu_locations[ $location ] ); } } if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } $common_slug_groups = array( array( 'primary', 'menu-1', 'main', 'header', 'navigation', 'top' ), array( 'secondary', 'menu-2', 'footer', 'subsidiary', 'bottom' ), array( 'social' ), ); foreach ( $common_slug_groups as $slug_group ) { foreach ( $slug_group as $slug ) { foreach ( $registered_nav_menus as $new_location => $name ) { if ( is_string( $new_location ) && false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) { continue; } elseif ( is_numeric( $new_location ) && $new_location !== $slug ) { continue; } foreach ( $old_nav_menu_locations as $location => $menu_id ) { foreach ( $slug_group as $slug ) { if ( is_string( $location ) && false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) { continue; } elseif ( is_numeric( $location ) && $location !== $slug ) { continue; } if ( ! empty( $old_nav_menu_locations[ $location ] ) ) { $new_nav_menu_locations[ $new_location ] = $old_nav_menu_locations[ $location ]; unset( $old_nav_menu_locations[ $location ] ); continue 3; } } } } } } return $new_nav_menu_locations; } + + +<# var w_rule = '', classes = [], + w, h, settings = wp.media.view.settings, + isYouTube = isVimeo = false; - .form-table th, - .form-table td, - .label-responsive { - display: block; - width: auto; - vertical-align: middle; + if ( ! _.isEmpty( data.model.src ) ) { + isYouTube = data.model.src.match(/youtube|youtu\.be/); + isVimeo = -1 !== data.model.src.indexOf('vimeo'); } - .label-responsive { - margin: 0.5em 0; + if ( settings.contentWidth && data.model.width >= settings.contentWidth ) { + w = settings.contentWidth; + } else { + w = data.model.width; } - .export-filters li { - margin-bottom: 0; + if ( w !== data.model.width ) { + h = Math.ceil( ( data.model.height * w ) / data.model.width ); + } else { + h = data.model.height; } - .form-table .color-palette td { - display: table-cell; - width: 15px; + if ( w ) { + w_rule = 'width: ' + w + 'px; '; } - .form-table table.color-palette { - margin-left: 10px; + if ( isYouTube ) { + classes.push( 'youtube-video' ); } - textarea, - input { - font-size: 16px; + if ( isVimeo ) { + classes.push( 'vimeo-video' ); } - .form-table td input[type="text"], - .form-table td input[type="email"], - .form-table td input[type="password"], - .form-table td select, - .form-table td textarea, - .form-table span.description, - #profile-page .form-table textarea { - width: 100%; - display: block; - max-width: none; - box-sizing: border-box; +#> +
          + +
          + Learn how to describe the purpose of the image%3$s
          . Leave empty if the image is purely decorative.' ), esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), 'target="_blank" rel="noopener"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); ?> - input[type="text"].small-text, - input[type="search"].small-text, - input[type="password"].small-text, - input[type="number"].small-text, - input[type="number"].small-text, - .form-table input[type="text"].small-text { - width: auto; - max-width: 4.375em; /* 70px, enough for 4 digits to fit comfortably */ - display: inline; - padding: 3px 6px; - margin: 0 3px; - } - - .form-table .regular-text ~ input[type="text"].small-text { - margin-top: 5px; - } - - #pass-strength-result { - width: 100%; - box-sizing: border-box; - padding: 8px; - } - - p.search-box { - float: none; - position: absolute; - bottom: 0; - width: 98%; - height: 90px; - margin-bottom: 20px; - } - - p.search-box input[name="s"] { - float: none; - width: 100%; - margin-bottom: 10px; - vertical-align: middle; - } - - p.search-box input[type="submit"] { - margin-bottom: 10px; - } - - .form-table span.description { - display: inline; - padding: 4px 0 0; - line-height: 1.4; - font-size: 14px; - } - - .form-table th { - padding: 10px 0 0; - border-bottom: 0; - } - - .form-table td { - margin-bottom: 0; - padding: 4px 0 6px; - } - - .form-table.permalink-structure td code { - margin-right: 32px; - display: inline-block; - } + + - .form-table.permalink-structure td input[type="text"] { - margin-right: 32px; - margin-top: 4px; - width: 96%; - } + + - .form-table input.regular-text { - width: 100%; - } + + - .form-table label { - font-size: 14px; - } + + - .background-position-control .button-group > label { - font-size: 0; - } + + - .wp-pwd button.button { - background: transparent; - border: 1px solid transparent; - box-shadow: none; - line-height: 2; - margin: 0; - padding: 5px 9px; - position: absolute; - left: 0; - top: 0; - width: 2.375rem; - height: 2.375rem; - min-width: 40px; - min-height: 40px; - } + + - .wp-pwd button.wp-hide-pw { - left: 2.5rem; - } + + - .wp-pwd button.button:active { - background: transparent; - box-shadow: none; - transform: none; - } + + - .wp-pwd .button .text { - display: none; - } + + - .wp-pwd [type="text"], - .wp-pwd [type="password"] { - line-height: 2; - padding-left: 5rem; - } + + - .regular-text { - max-width: 100%; - } -} + + -@media only screen and (max-width: 768px) { - .form-field input[type="text"], - .form-field input[type="email"], - .form-field input[type="password"], - .form-field select, - .form-field textarea { - width: 99%; - } + + -.media-item .media-item-info .A1B1 { - padding: 0 10px 0 0; -} + + -.media-item td.savesend { - padding-bottom: 15px; -} + + -.media-upload-form td label { - margin-left: 6px; - margin-right: 2px; -} + + -.media-item .describe p.help { - margin: 0; - padding: 0 5px 0 0; -} + + -.media-item .edit-attachment.copy-to-clipboard-container { - margin-top: 0; -} + + -.media-item-copy-container .success { - line-height: 0; -} + + -.media-upload-form .media-item { - min-height: 70px; - margin-bottom: 1px; - position: relative; - width: 100%; - background: #fff; -} + + -.media-item .original { - position: relative; - height: 34px; -} + + -.media-item .progress { - float: left; - height: 22px; - margin: 7px 6px; - width: 200px; - line-height: 2em; - padding: 0; - overflow: hidden; - border-radius: 22px; - background: #dcdcde; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} - -.media-item .bar { - z-index: 9; - width: 0; - height: 100%; - margin-top: -22px; - border-radius: 22px; - background-color: #2271b1; - box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.3); -} - -.media-item .progress .percent { - z-index: 10; - position: relative; - width: 200px; - padding: 0; - color: #fff; - text-align: center; - line-height: 22px; - font-weight: 400; - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -} - -.upload-php .fixed .column-parent { - width: 15%; -} - -.js .html-uploader #plupload-upload-ui { - display: none; -} - -.js .html-uploader #html-upload-ui { - display: block; -} - -#html-upload-ui #async-upload { - font-size: 1em; -} - -.media-upload-form .media-item.error, -.media-upload-form .media-item .error { - width: auto; - margin: 0 0 1px; -} - -.media-upload-form .media-item .error { - padding: 10px 14px 10px 0; - min-height: 50px; -} - -.media-item .error-div button.dismiss { - float: left; - margin: 0 15px 0 10px; -} - -/*------------------------------------------------------------------------------ - 14.1 - Media Library -------------------------------------------------------------------------------*/ - -.find-box { - background-color: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - width: 600px; - overflow: hidden; - margin-right: -300px; - position: fixed; - top: 30px; - bottom: 30px; - right: 50%; - z-index: 100105; -} - -.find-box-head { - background: #fff; - border-bottom: 1px solid #dcdcde; - height: 36px; - font-size: 18px; - font-weight: 600; - line-height: 2; - padding: 0 16px 0 36px; - position: absolute; - top: 0; - right: 0; - left: 0; -} - -.find-box-inside { - overflow: auto; - padding: 16px; - background-color: #fff; - position: absolute; - top: 37px; - bottom: 45px; - overflow-y: scroll; - width: 100%; - box-sizing: border-box; -} - -.find-box-search { - padding-bottom: 16px; -} - -.find-box-search .spinner { - float: none; - right: 105px; - position: absolute; -} - -.find-box-search, -#find-posts-response { - position: relative; /* RTL fix, #WP28010 */ -} - -#find-posts-input, -#find-posts-search { - float: right; -} - -#find-posts-input { - width: 140px; - height: 28px; - margin: 0 0 0 4px; -} - -.widefat .found-radio { - padding-left: 0; - width: 16px; -} - -#find-posts-close { - width: 36px; - height: 36px; - border: none; - padding: 0; - position: absolute; - top: 0; - left: 0; - cursor: pointer; - text-align: center; - background: none; - color: #646970; -} - -#find-posts-close:hover, -#find-posts-close:focus { - color: #135e96; -} - -#find-posts-close:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -#find-posts-close:before { - font: normal 20px/36px dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - content: "\f158"; -} - -.find-box-buttons { - padding: 8px 16px; - background: #fff; - border-top: 1px solid #dcdcde; - position: absolute; - bottom: 0; - right: 0; - left: 0; -} - -@media screen and (max-width: 782px) { - .find-box-inside { - bottom: 57px; - } -} - -@media screen and (max-width: 660px) { - - .find-box { - top: 0; - bottom: 0; - right: 0; - left: 0; - margin: 0; - width: 100%; - } - -} - -.ui-find-overlay { - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 100100; -} - -.drag-drop #drag-drop-area { - border: 4px dashed #c3c4c7; - height: 200px; -} - -.drag-drop .drag-drop-inside { - margin: 60px auto 0; - width: 250px; -} - -.drag-drop-inside p { - font-size: 14px; - margin: 5px 0; - display: none; -} - -.drag-drop .drag-drop-inside p { - text-align: center; -} - -.drag-drop-inside p.drag-drop-info { - font-size: 20px; -} - -.drag-drop .drag-drop-inside p, -.drag-drop-inside p.drag-drop-buttons { - display: block; -} - -/* -#drag-drop-area:-moz-drag-over { - border-color: #83b4d8; -} -border color while dragging a file over the uploader drop area */ -.drag-drop.drag-over #drag-drop-area { - border-color: #9ec2e6; -} - -#plupload-upload-ui { - position: relative; -} - -/** - * Media Library grid view - */ - -.media-frame.mode-grid, -.media-frame.mode-grid .media-frame-content, -.media-frame.mode-grid .attachments-browser:not(.has-load-more) .attachments, -.media-frame.mode-grid .attachments-browser.has-load-more .attachments-wrapper, -.media-frame.mode-grid .uploader-inline-content { - position: static; -} - -/* Regions we don't use at all */ -.media-frame.mode-grid .media-frame-title, -.media-frame.mode-grid .media-frame-router, -.media-frame.mode-grid .media-frame-menu { - display: none; -} - -.media-frame.mode-grid .media-frame-content { - background-color: transparent; - border: none; -} - -.upload-php .mode-grid .media-sidebar { - position: relative; - width: auto; - margin-top: 12px; - padding: 0 16px; - border-right: 4px solid #d63638; - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); - background-color: #fff; -} - -.upload-php .mode-grid .hide-sidebar .media-sidebar { - display: none; -} - -.upload-php .mode-grid .media-sidebar .media-uploader-status { - border-bottom: none; - padding-bottom: 0; - max-width: 100%; -} - -.upload-php .mode-grid .media-sidebar .upload-error { - margin: 12px 0; - padding: 4px 0 0; - border: none; - box-shadow: none; - background: none; -} - -.upload-php .mode-grid .media-sidebar .media-uploader-status.errors h2 { - display: none; -} - -.media-frame.mode-grid .uploader-inline { - position: relative; - top: auto; - left: auto; - right: auto; - bottom: auto; - padding-top: 0; - margin-top: 20px; - border: 4px dashed #c3c4c7; -} - -.media-frame.mode-select .attachments-browser.fixed:not(.has-load-more) .attachments, -.media-frame.mode-select .attachments-browser.has-load-more.fixed .attachments-wrapper { - position: relative; - top: 94px; /* prevent jumping up when the toolbar becomes fixed */ - padding-bottom: 94px; /* offset for above so the bottom doesn't get cut off */ -} - -.media-frame.mode-grid .attachment:focus, -.media-frame.mode-grid .selected.attachment:focus, -.media-frame.mode-grid .attachment.details:focus { - box-shadow: - inset 0 0 2px 3px #f0f0f1, - inset 0 0 0 7px #4f94d4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -6px; -} - -.media-frame.mode-grid .selected.attachment { - box-shadow: - inset 0 0 0 5px #f0f0f1, - inset 0 0 0 7px #c3c4c7; -} - -.media-frame.mode-grid .attachment.details { - box-shadow: - inset 0 0 0 3px #f0f0f1, - inset 0 0 0 7px #4f94d4; -} - -.media-frame.mode-grid.mode-select .attachment .thumbnail { - opacity: 0.65; -} - -.media-frame.mode-select .attachment.selected .thumbnail { - opacity: 1; -} - -.media-frame.mode-grid .media-toolbar { - margin-bottom: 15px; - height: auto; -} - -.media-frame.mode-grid .media-toolbar select { - margin: 0 0 0 10px; -} - -.media-frame.mode-grid.mode-edit .media-toolbar-secondary > .select-mode-toggle-button { - margin: 0 0 0 8px; - vertical-align: middle; -} - -.media-frame.mode-grid .attachments-browser .bulk-select { - display: inline-block; - margin: 0 0 0 10px; -} + + -.media-frame.mode-grid .attachments-browser .attachments { - padding: 2px; -} + + -.edit-attachment-frame .edit-media-header .right:before, -.edit-attachment-frame .edit-media-header .left:before { - font: normal 20px/50px dashicons !important; - display: inline; - font-weight: 300; -} + + -.upload-php .media-modal-close:hover, -.upload-php .media-modal-close:focus, -.edit-attachment-frame .edit-media-header .left:hover, -.edit-attachment-frame .edit-media-header .right:hover, -.edit-attachment-frame .edit-media-header .left:focus, -.edit-attachment-frame .edit-media-header .right:focus { - background: #dcdcde; - border-color: #c3c4c7; - color: #000; - outline: none; - box-shadow: none; -} + + -.upload-php .media-modal-close:focus, -.edit-attachment-frame .edit-media-header .left:focus, -.edit-attachment-frame .edit-media-header .right:focus { - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} + + -.edit-attachment-frame .edit-media-header .right:before { - content: "\f341"; -} + 0, 'show_description' => 0, 'show_images' => 1, 'show_name' => 0, 'before' => '
        • ', 'after' => '
        • ', 'between' => "\n", 'show_rating' => 0, 'link_before' => '', 'link_after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $output = ''; foreach ( (array) $bookmarks as $bookmark ) { if ( ! isset( $bookmark->recently_updated ) ) { $bookmark->recently_updated = false; } $output .= $parsed_args['before']; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= ''; } $the_link = '#'; if ( ! empty( $bookmark->link_url ) ) { $the_link = esc_url( $bookmark->link_url ); } $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) ); $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); $title = $desc; if ( $parsed_args['show_updated'] ) { if ( '00' !== substr( $bookmark->link_updated_f, 0, 2 ) ) { $title .= ' ('; $title .= sprintf( __( 'Last updated: %s' ), gmdate( get_option( 'links_updated_date_format' ), $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ); $title .= ')'; } } $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"'; if ( '' !== $title ) { $title = ' title="' . $title . '"'; } $rel = $bookmark->link_rel; $target = $bookmark->link_target; if ( '' !== $target ) { if ( is_string( $rel ) && '' !== $rel ) { if ( ! str_contains( $rel, 'noopener' ) ) { $rel = trim( $rel ) . ' noopener'; } } else { $rel = 'noopener'; } $target = ' target="' . $target . '"'; } if ( '' !== $rel ) { $rel = ' rel="' . esc_attr( $rel ) . '"'; } $output .= ''; $output .= $parsed_args['link_before']; if ( null != $bookmark->link_image && $parsed_args['show_images'] ) { if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { $output .= "link_image\" $alt $title />"; } else { $output .= 'link_image\" $alt $title />"; } if ( $parsed_args['show_name'] ) { $output .= " $name"; } } else { $output .= $name; } $output .= $parsed_args['link_after']; $output .= ''; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= ''; } if ( $parsed_args['show_description'] && '' !== $desc ) { $output .= $parsed_args['between'] . $desc; } if ( $parsed_args['show_rating'] ) { $output .= $parsed_args['between'] . sanitize_bookmark_field( 'link_rating', $bookmark->link_rating, $bookmark->link_id, 'display' ); } $output .= $parsed_args['after'] . "\n"; } return $output; } function wp_list_bookmarks( $args = '' ) { $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 'exclude_category' => '', 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 'categorize' => 1, 'title_li' => __( 'Bookmarks' ), 'title_before' => '

          ', 'title_after' => '

          ', 'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat', 'category_before' => '
        • ', 'category_after' => '
        • ', ); $parsed_args = wp_parse_args( $args, $defaults ); $output = ''; if ( ! is_array( $parsed_args['class'] ) ) { $parsed_args['class'] = explode( ' ', $parsed_args['class'] ); } $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] ); $parsed_args['class'] = trim( implode( ' ', $parsed_args['class'] ) ); if ( $parsed_args['categorize'] ) { $cats = get_terms( array( 'taxonomy' => 'link_category', 'name__like' => $parsed_args['category_name'], 'include' => $parsed_args['category'], 'exclude' => $parsed_args['exclude_category'], 'orderby' => $parsed_args['category_orderby'], 'order' => $parsed_args['category_order'], 'hierarchical' => 0, ) ); if ( empty( $cats ) ) { $parsed_args['categorize'] = false; } } if ( $parsed_args['categorize'] ) { foreach ( (array) $cats as $cat ) { $params = array_merge( $parsed_args, array( 'category' => $cat->term_id ) ); $bookmarks = get_bookmarks( $params ); if ( empty( $bookmarks ) ) { continue; } $output .= str_replace( array( '%id', '%class' ), array( "linkcat-$cat->term_id", $parsed_args['class'] ), $parsed_args['category_before'] ); $catname = apply_filters( 'link_category', $cat->name ); $output .= $parsed_args['title_before']; $output .= $catname; $output .= $parsed_args['title_after']; $output .= "\n\t
            \n"; $output .= _walk_bookmarks( $bookmarks, $parsed_args ); $output .= "\n\t
          \n"; $output .= $parsed_args['category_after'] . "\n"; } } else { $bookmarks = get_bookmarks( $parsed_args ); if ( ! empty( $bookmarks ) ) { if ( ! empty( $parsed_args['title_li'] ) ) { $output .= str_replace( array( '%id', '%class' ), array( 'linkcat-' . $parsed_args['category'], $parsed_args['class'] ), $parsed_args['category_before'] ); $output .= $parsed_args['title_before']; $output .= $parsed_args['title_li']; $output .= $parsed_args['title_after']; $output .= "\n\t
            \n"; $output .= _walk_bookmarks( $bookmarks, $parsed_args ); $output .= "\n\t
          \n"; $output .= $parsed_args['category_after'] . "\n"; } else { $output .= _walk_bookmarks( $bookmarks, $parsed_args ); } } } $html = apply_filters( 'wp_list_bookmarks', $output ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } 'menu_item_parent', 'id' => 'db_id', ); public function start_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $classes = array( 'sub-menu' ); $class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $output .= "{$n}{$indent}{$n}"; } public function end_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $output .= "$indent{$n}"; } public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { $menu_item = $data_object; if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; $classes = empty( $menu_item->classes ) ? array() : (array) $menu_item->classes; $classes[] = 'menu-item-' . $menu_item->ID; $args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth ); $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $atts = array(); $atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : ''; $atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : ''; if ( '_blank' === $menu_item->target && empty( $menu_item->xfn ) ) { $atts['rel'] = 'noopener'; } else { $atts['rel'] = $menu_item->xfn; } $atts['href'] = ! empty( $menu_item->url ) ? $menu_item->url : ''; $atts['aria-current'] = $menu_item->current ? 'page' : ''; $atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID ); $title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth ); $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args ); } public function end_el( &$output, $data_object, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $output .= "{$n}"; } } link_service = $link_service; } public function maybe_send_recovery_mode_email( $rate_limit, $error, $extension ) { $last_sent = get_option( self::RATE_LIMIT_OPTION ); if ( ! $last_sent || time() > $last_sent + $rate_limit ) { if ( ! update_option( self::RATE_LIMIT_OPTION, time() ) ) { return new WP_Error( 'storage_error', __( 'Could not update the email last sent time.' ) ); } $sent = $this->send_recovery_mode_email( $rate_limit, $error, $extension ); if ( $sent ) { return true; } return new WP_Error( 'email_failed', sprintf( __( 'The email could not be sent. Possible reason: your host may have disabled the %s function.' ), 'mail()' ) ); } $err_message = sprintf( __( 'A recovery link was already sent %1$s ago. Please wait another %2$s before requesting a new email.' ), human_time_diff( $last_sent ), human_time_diff( $last_sent + $rate_limit ) ); return new WP_Error( 'email_sent_already', $err_message ); } public function clear_rate_limit() { return delete_option( self::RATE_LIMIT_OPTION ); } private function send_recovery_mode_email( $rate_limit, $error, $extension ) { $url = $this->link_service->generate_url(); $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $switched_locale = false; if ( function_exists( 'switch_to_locale' ) && isset( $GLOBALS['wp_locale_switcher'] ) ) { $switched_locale = switch_to_locale( get_locale() ); } if ( $extension ) { $cause = $this->get_cause( $extension ); $details = wp_strip_all_tags( wp_get_extension_error_description( $error ) ); if ( $details ) { $header = __( 'Error Details' ); $details = "\n\n" . $header . "\n" . str_pad( '', strlen( $header ), '=' ) . "\n" . $details; } } else { $cause = ''; $details = ''; } $support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) ); $debug = apply_filters( 'recovery_email_debug_info', $this->get_debug( $extension ) ); $message = __( 'Howdy! -.edit-attachment-frame .edit-media-header [disabled], -.edit-attachment-frame .edit-media-header [disabled]:hover { - color: #c3c4c7; - background: inherit; - cursor: default; -} +Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email. +###CAUSE### +First, visit your website (###SITEURL###) and check for any visible issues. Next, visit the page where the error was caught (###PAGEURL###) and check for any visible issues. -.edit-attachment-frame .media-frame-content, -.edit-attachment-frame .media-frame-router { - right: 0; -} +###SUPPORT### -.edit-attachment-frame .media-frame-content { - border-bottom: none; - bottom: 0; - top: 50px; -} +If your site appears broken and you can\'t access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further. -.edit-attachment-frame .attachment-details { - position: absolute; - overflow: auto; - top: 0; - bottom: 0; - left: 0; - right: 0; - box-shadow: inset 0 4px 4px -4px rgba(0, 0, 0, 0.1); -} +###LINK### -.edit-attachment-frame .attachment-media-view { - float: right; - width: 65%; - height: 100%; -} +To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires. -.edit-attachment-frame .attachment-media-view .thumbnail { - box-sizing: border-box; - padding: 16px; - height: 100%; -} +When seeking help with this issue, you may be asked for some of the following information: +###DEBUG### -.edit-attachment-frame .attachment-media-view .details-image { - display: block; - margin: 0 auto 16px; - max-width: 100%; - max-height: 90%; - max-height: calc( 100% - 42px ); /* leave space for actions underneath */ - background-image: linear-gradient(-45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7), linear-gradient(-45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7); - background-position: 100% 0, 10px 10px; - background-size: 20px 20px; -} +###DETAILS###' ); $message = str_replace( array( '###LINK###', '###EXPIRES###', '###CAUSE###', '###DETAILS###', '###SITEURL###', '###PAGEURL###', '###SUPPORT###', '###DEBUG###', ), array( $url, human_time_diff( time() + $rate_limit ), $cause ? "\n{$cause}\n" : "\n", $details, home_url( '/' ), home_url( $_SERVER['REQUEST_URI'] ), $support, implode( "\r\n", $debug ), ), $message ); $email = array( 'to' => $this->get_recovery_mode_email_address(), 'subject' => __( '[%s] Your Site is Experiencing a Technical Issue' ), 'message' => $message, 'headers' => '', 'attachments' => '', ); $email = apply_filters( 'recovery_mode_email', $email, $url ); $sent = wp_mail( $email['to'], wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ), $email['message'], $email['headers'], $email['attachments'] ); if ( $switched_locale ) { restore_previous_locale(); } return $sent; } private function get_recovery_mode_email_address() { if ( defined( 'RECOVERY_MODE_EMAIL' ) && is_email( RECOVERY_MODE_EMAIL ) ) { return RECOVERY_MODE_EMAIL; } return get_option( 'admin_email' ); } private function get_cause( $extension ) { if ( 'plugin' === $extension['type'] ) { $plugin = $this->get_plugin( $extension ); if ( false === $plugin ) { $name = $extension['slug']; } else { $name = $plugin['Name']; } $cause = sprintf( __( 'In this case, WordPress caught an error with one of your plugins, %s.' ), $name ); } else { $theme = wp_get_theme( $extension['slug'] ); $name = $theme->exists() ? $theme->display( 'Name' ) : $extension['slug']; $cause = sprintf( __( 'In this case, WordPress caught an error with your theme, %s.' ), $name ); } return $cause; } private function get_plugin( $extension ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) { return $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]; } else { foreach ( $plugins as $file => $plugin_data ) { if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) { return $plugin_data; } } } return false; } private function get_debug( $extension ) { $theme = wp_get_theme(); $wp_version = get_bloginfo( 'version' ); if ( $extension ) { $plugin = $this->get_plugin( $extension ); } else { $plugin = null; } $debug = array( 'wp' => sprintf( __( 'WordPress version %s' ), $wp_version ), 'theme' => sprintf( __( 'Active theme: %1$s (version %2$s)' ), $theme->get( 'Name' ), $theme->get( 'Version' ) ), ); if ( null !== $plugin ) { $debug['plugin'] = sprintf( __( 'Current plugin: %1$s (version %2$s)' ), $plugin['Name'], $plugin['Version'] ); } $debug['php'] = sprintf( __( 'PHP version %s' ), PHP_VERSION ); return $debug; } } blocks = $blocks; $this->available_context = $available_context; $this->registry = $registry; } #[ReturnTypeWillChange] public function offsetExists( $index ) { return isset( $this->blocks[ $index ] ); } #[ReturnTypeWillChange] public function offsetGet( $index ) { $block = $this->blocks[ $index ]; if ( isset( $block ) && is_array( $block ) ) { $block = new WP_Block( $block, $this->available_context, $this->registry ); $this->blocks[ $index ] = $block; } return $block; } #[ReturnTypeWillChange] public function offsetSet( $index, $value ) { if ( is_null( $index ) ) { $this->blocks[] = $value; } else { $this->blocks[ $index ] = $value; } } #[ReturnTypeWillChange] public function offsetUnset( $index ) { unset( $this->blocks[ $index ] ); } #[ReturnTypeWillChange] public function rewind() { reset( $this->blocks ); } #[ReturnTypeWillChange] public function current() { return $this->offsetGet( $this->key() ); } #[ReturnTypeWillChange] public function key() { return key( $this->blocks ); } #[ReturnTypeWillChange] public function next() { next( $this->blocks ); } #[ReturnTypeWillChange] public function valid() { return null !== key( $this->blocks ); } #[ReturnTypeWillChange] public function count() { return count( $this->blocks ); } } get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id ) ); if ( ! $_comment ) { return false; } wp_cache_add( $_comment->comment_ID, $_comment, 'comment' ); } return new WP_Comment( $_comment ); } public function __construct( $comment ) { foreach ( get_object_vars( $comment ) as $key => $value ) { $this->$key = $value; } } public function to_array() { return get_object_vars( $this ); } public function get_children( $args = array() ) { $defaults = array( 'format' => 'tree', 'status' => 'all', 'hierarchical' => 'threaded', 'orderby' => '', ); $_args = wp_parse_args( $args, $defaults ); $_args['parent'] = $this->comment_ID; if ( is_null( $this->children ) ) { if ( $this->populated_children ) { $this->children = array(); } else { $this->children = get_comments( $_args ); } } if ( 'flat' === $_args['format'] ) { $children = array(); foreach ( $this->children as $child ) { $child_args = $_args; $child_args['format'] = 'flat'; unset( $child_args['parent'] ); $children = array_merge( $children, array( $child ), $child->get_children( $child_args ) ); } } else { $children = $this->children; } return $children; } public function add_child( WP_Comment $child ) { $this->children[ $child->comment_ID ] = $child; } public function get_child( $child_id ) { if ( isset( $this->children[ $child_id ] ) ) { return $this->children[ $child_id ]; } return false; } public function populated_children( $set ) { $this->populated_children = (bool) $set; } public function __isset( $name ) { if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) { $post = get_post( $this->comment_post_ID ); return property_exists( $post, $name ); } } public function __get( $name ) { if ( in_array( $name, $this->post_fields, true ) ) { $post = get_post( $this->comment_post_ID ); return $post->$name; } } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); public $query_vars; public $query_var_defaults; public $networks; public $found_networks = 0; public $max_num_pages = 0; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'network__in' => '', 'network__not_in' => '', 'count' => false, 'fields' => '', 'number' => '', 'offset' => '', 'no_found_rows' => true, 'orderby' => 'id', 'order' => 'ASC', 'domain' => '', 'domain__in' => '', 'domain__not_in' => '', 'path' => '', 'path__in' => '', 'path__not_in' => '', 'search' => '', 'update_network_cache' => true, ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_network_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_networks(); } public function get_networks() { $this->parse_query(); do_action_ref_array( 'pre_get_networks', array( &$this ) ); $network_data = null; $network_data = apply_filters_ref_array( 'networks_pre_query', array( $network_data, &$this ) ); if ( null !== $network_data ) { if ( is_array( $network_data ) && ! $this->query_vars['count'] ) { $this->networks = $network_data; } return $network_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_network_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'networks' ); $cache_key = "get_network_ids:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'networks' ); if ( false === $cache_value ) { $network_ids = $this->get_network_ids(); if ( $network_ids ) { $this->set_found_networks(); } $cache_value = array( 'network_ids' => $network_ids, 'found_networks' => $this->found_networks, ); wp_cache_add( $cache_key, $cache_value, 'networks' ); } else { $network_ids = $cache_value['network_ids']; $this->found_networks = $cache_value['found_networks']; } if ( $this->found_networks && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $network_ids; } $network_ids = array_map( 'intval', $network_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->networks = $network_ids; return $this->networks; } if ( $this->query_vars['update_network_cache'] ) { _prime_network_caches( $network_ids ); } $_networks = array(); foreach ( $network_ids as $network_id ) { $_network = get_network( $network_id ); if ( $_network ) { $_networks[] = $_network; } } $_networks = apply_filters_ref_array( 'the_networks', array( $_networks, &$this ) ); $this->networks = array_map( 'get_network', $_networks ); return $this->networks; } protected function get_network_ids() { global $wpdb; $order = $this->parse_order( $this->query_vars['order'] ); if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'network__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "$wpdb->site.id $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "$wpdb->site.id"; } if ( ! empty( $this->query_vars['network__in'] ) ) { $this->sql_clauses['where']['network__in'] = "$wpdb->site.id IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['network__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['network__not_in'] ) ) { $this->sql_clauses['where']['network__not_in'] = "$wpdb->site.id NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['network__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['domain'] ) ) { $this->sql_clauses['where']['domain'] = $wpdb->prepare( "$wpdb->site.domain = %s", $this->query_vars['domain'] ); } if ( is_array( $this->query_vars['domain__in'] ) ) { $this->sql_clauses['where']['domain__in'] = "$wpdb->site.domain IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['domain__not_in'] ) ) { $this->sql_clauses['where']['domain__not_in'] = "$wpdb->site.domain NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__not_in'] ) ) . "' )"; } if ( ! empty( $this->query_vars['path'] ) ) { $this->sql_clauses['where']['path'] = $wpdb->prepare( "$wpdb->site.path = %s", $this->query_vars['path'] ); } if ( is_array( $this->query_vars['path__in'] ) ) { $this->sql_clauses['where']['path__in'] = "$wpdb->site.path IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['path__not_in'] ) ) { $this->sql_clauses['where']['path__not_in'] = "$wpdb->site.path NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__not_in'] ) ) . "' )"; } if ( strlen( $this->query_vars['search'] ) ) { $this->sql_clauses['where']['search'] = $this->get_search_sql( $this->query_vars['search'], array( "$wpdb->site.domain", "$wpdb->site.path" ) ); } $join = ''; $where = implode( ' AND ', $this->sql_clauses['where'] ); $groupby = ''; $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->site $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " + {$this->sql_clauses['select']} + {$this->sql_clauses['from']} + {$where} + {$this->sql_clauses['groupby']} + {$this->sql_clauses['orderby']} + {$this->sql_clauses['limits']} + "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } $network_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $network_ids ); } private function set_found_networks() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_networks_query = apply_filters( 'found_networks_query', 'SELECT FOUND_ROWS()', $this ); $this->found_networks = (int) $wpdb->get_var( $found_networks_query ); } } protected function get_search_sql( $search, $columns ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return '(' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'id', 'domain', 'path', ); $parsed = false; if ( 'network__in' === $orderby ) { $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->site}.id, $network__in )"; } elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) { $field = substr( $orderby, 0, -7 ); $parsed = "CHAR_LENGTH($wpdb->site.$field)"; } elseif ( in_array( $orderby, $allowed_keys, true ) ) { $parsed = "$wpdb->site.$orderby"; } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'ASC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } array( 'https://www.youtube.com/oembed', true ), '#https?://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://((m|www)\.)?youtube\.com/shorts/*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://youtu\.be/.*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://(.+\.)?vimeo\.com/.*#i' => array( 'https://vimeo.com/api/oembed.{format}', true ), '#https?://(www\.)?dailymotion\.com/.*#i' => array( 'https://www.dailymotion.com/services/oembed', true ), '#https?://dai\.ly/.*#i' => array( 'https://www.dailymotion.com/services/oembed', true ), '#https?://(www\.)?flickr\.com/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ), '#https?://flic\.kr/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ), '#https?://(.+\.)?smugmug\.com/.*#i' => array( 'https://api.smugmug.com/services/oembed/', true ), '#https?://(www\.)?scribd\.com/(doc|document)/.*#i' => array( 'https://www.scribd.com/services/oembed', true ), '#https?://wordpress\.tv/.*#i' => array( 'https://wordpress.tv/oembed/', true ), '#https?://(.+\.)?polldaddy\.com/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://poll\.fm/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://(.+\.)?survey\.fm/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/status(es)?/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}$#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/likes$#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/lists/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/timelines/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/i/moments/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?soundcloud\.com/.*#i' => array( 'https://soundcloud.com/oembed', true ), '#https?://(.+?\.)?slideshare\.net/.*#i' => array( 'https://www.slideshare.net/api/oembed/2', true ), '#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ), '#https?://(.+\.)?imgur\.com/.*#i' => array( 'https://api.imgur.com/oembed', true ), '#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'https://issuu.com/oembed_wp', true ), '#https?://(www\.)?mixcloud\.com/.*#i' => array( 'https://www.mixcloud.com/oembed', true ), '#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'https://www.ted.com/services/v1/oembed.{format}', true ), '#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'https://animoto.com/oembeds/create', true ), '#https?://(.+)\.tumblr\.com/post/.*#i' => array( 'https://www.tumblr.com/oembed/1.0', true ), '#https?://(www\.)?kickstarter\.com/projects/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ), '#https?://kck\.st/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ), '#https?://cloudup\.com/.*#i' => array( 'https://cloudup.com/oembed', true ), '#https?://(www\.)?reverbnation\.com/.*#i' => array( 'https://www.reverbnation.com/oembed', true ), '#https?://videopress\.com/v/.*#' => array( 'https://public-api.wordpress.com/oembed/?for=' . $host, true ), '#https?://(www\.)?reddit\.com/r/[^/]+/comments/.*#i' => array( 'https://www.reddit.com/oembed', true ), '#https?://(www\.)?speakerdeck\.com/.*#i' => array( 'https://speakerdeck.com/oembed.{format}', true ), '#https?://(www\.)?screencast\.com/.*#i' => array( 'https://api.screencast.com/external/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(com|com\.mx|com\.br|ca)/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(co\.uk|de|fr|it|es|in|nl|ru)/.*#i' => array( 'https://read.amazon.co.uk/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(co\.jp|com\.au)/.*#i' => array( 'https://read.amazon.com.au/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.cn/.*#i' => array( 'https://read.amazon.cn/kp/api/oembed', true ), '#https?://(www\.)?a\.co/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://(www\.)?amzn\.to/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://(www\.)?amzn\.eu/.*#i' => array( 'https://read.amazon.co.uk/kp/api/oembed', true ), '#https?://(www\.)?amzn\.in/.*#i' => array( 'https://read.amazon.in/kp/api/oembed', true ), '#https?://(www\.)?amzn\.asia/.*#i' => array( 'https://read.amazon.com.au/kp/api/oembed', true ), '#https?://(www\.)?z\.cn/.*#i' => array( 'https://read.amazon.cn/kp/api/oembed', true ), '#https?://www\.someecards\.com/.+-cards/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://www\.someecards\.com/usercards/viewcard/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://some\.ly\/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://(www\.)?tiktok\.com/.*/video/.*#i' => array( 'https://www.tiktok.com/oembed', true ), '#https?://([a-z]{2}|www)\.pinterest\.com(\.(au|mx))?/.*#i' => array( 'https://www.pinterest.com/oembed.json', true ), '#https?://(www\.)?wolframcloud\.com/obj/.+#i' => array( 'https://www.wolframcloud.com/oembed', true ), ); if ( ! empty( self::$early_providers['add'] ) ) { foreach ( self::$early_providers['add'] as $format => $data ) { $providers[ $format ] = $data; } } if ( ! empty( self::$early_providers['remove'] ) ) { foreach ( self::$early_providers['remove'] as $format ) { unset( $providers[ $format ] ); } } self::$early_providers = array(); $this->providers = apply_filters( 'oembed_providers', $providers ); add_filter( 'oembed_dataparse', array( $this, '_strip_newlines' ), 10, 3 ); } public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; } public function get_provider( $url, $args = '' ) { $args = wp_parse_args( $args ); $provider = false; if ( ! isset( $args['discover'] ) ) { $args['discover'] = true; } foreach ( $this->providers as $matchmask => $data ) { list( $providerurl, $regex ) = $data; if ( ! $regex ) { $matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; $matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask ); } if ( preg_match( $matchmask, $url ) ) { $provider = str_replace( '{format}', 'json', $providerurl ); break; } } if ( ! $provider && $args['discover'] ) { $provider = $this->discover( $url ); } return $provider; } public static function _add_provider_early( $format, $provider, $regex = false ) { if ( empty( self::$early_providers['add'] ) ) { self::$early_providers['add'] = array(); } self::$early_providers['add'][ $format ] = array( $provider, $regex ); } public static function _remove_provider_early( $format ) { if ( empty( self::$early_providers['remove'] ) ) { self::$early_providers['remove'] = array(); } self::$early_providers['remove'][] = $format; } public function get_data( $url, $args = '' ) { $args = wp_parse_args( $args ); $provider = $this->get_provider( $url, $args ); if ( ! $provider ) { return false; } $data = $this->fetch( $provider, $url, $args ); if ( false === $data ) { return false; } return $data; } public function get_html( $url, $args = '' ) { $pre = apply_filters( 'pre_oembed_result', null, $url, $args ); if ( null !== $pre ) { return $pre; } $data = $this->get_data( $url, $args ); if ( false === $data ) { return false; } return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args ); } public function discover( $url ) { $providers = array(); $args = array( 'limit_response_size' => 153600, ); $args = apply_filters( 'oembed_remote_get_args', $args, $url ); $request = wp_safe_remote_get( $url, $args ); $html = wp_remote_retrieve_body( $request ); if ( $html ) { $linktypes = apply_filters( 'oembed_linktypes', array( 'application/json+oembed' => 'json', 'text/xml+oembed' => 'xml', 'application/xml+oembed' => 'xml', ) ); $html_head_end = stripos( $html, '' ); if ( $html_head_end ) { $html = substr( $html, 0, $html_head_end ); } $tagfound = false; foreach ( $linktypes as $linktype => $format ) { if ( stripos( $html, $linktype ) ) { $tagfound = true; break; } } if ( $tagfound && preg_match_all( '#]+)/?>#iU', $html, $links ) ) { foreach ( $links[1] as $link ) { $atts = shortcode_parse_atts( $link ); if ( ! empty( $atts['type'] ) && ! empty( $linktypes[ $atts['type'] ] ) && ! empty( $atts['href'] ) ) { $providers[ $linktypes[ $atts['type'] ] ] = htmlspecialchars_decode( $atts['href'] ); if ( 'json' === $linktypes[ $atts['type'] ] ) { break; } } } } } if ( ! empty( $providers['json'] ) ) { return $providers['json']; } elseif ( ! empty( $providers['xml'] ) ) { return $providers['xml']; } else { return false; } } public function fetch( $provider, $url, $args = '' ) { $args = wp_parse_args( $args, wp_embed_defaults( $url ) ); $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider ); $provider = add_query_arg( 'maxheight', (int) $args['height'], $provider ); $provider = add_query_arg( 'url', urlencode( $url ), $provider ); $provider = add_query_arg( 'dnt', 1, $provider ); $provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args ); foreach ( array( 'json', 'xml' ) as $format ) { $result = $this->_fetch_with_format( $provider, $format ); if ( is_wp_error( $result ) && 'not-implemented' === $result->get_error_code() ) { continue; } return ( $result && ! is_wp_error( $result ) ) ? $result : false; } return false; } private function _fetch_with_format( $provider_url_with_args, $format ) { $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args ); $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args ); $response = wp_safe_remote_get( $provider_url_with_args, $args ); if ( 501 == wp_remote_retrieve_response_code( $response ) ) { return new WP_Error( 'not-implemented' ); } $body = wp_remote_retrieve_body( $response ); if ( ! $body ) { return false; } $parse_method = "_parse_$format"; return $this->$parse_method( $body ); } private function _parse_json( $response_body ) { $data = json_decode( trim( $response_body ) ); return ( $data && is_object( $data ) ) ? $data : false; } private function _parse_xml( $response_body ) { if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { return false; } if ( PHP_VERSION_ID < 80000 ) { $loader = libxml_disable_entity_loader( true ); } $errors = libxml_use_internal_errors( true ); $return = $this->_parse_xml_body( $response_body ); libxml_use_internal_errors( $errors ); if ( PHP_VERSION_ID < 80000 && isset( $loader ) ) { libxml_disable_entity_loader( $loader ); } return $return; } private function _parse_xml_body( $response_body ) { if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) ) { return false; } $dom = new DOMDocument; $success = $dom->loadXML( $response_body ); if ( ! $success ) { return false; } if ( isset( $dom->doctype ) ) { return false; } foreach ( $dom->childNodes as $child ) { if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType ) { return false; } } $xml = simplexml_import_dom( $dom ); if ( ! $xml ) { return false; } $return = new stdClass; foreach ( $xml as $key => $value ) { $return->$key = (string) $value; } return $return; } public function data2html( $data, $url ) { if ( ! is_object( $data ) || empty( $data->type ) ) { return false; } $return = false; switch ( $data->type ) { case 'photo': if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) ) { break; } if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) ) { break; } $title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : ''; $return = '' . esc_attr( $title ) . ''; break; case 'video': case 'rich': if ( ! empty( $data->html ) && is_string( $data->html ) ) { $return = $data->html; } break; case 'link': if ( ! empty( $data->title ) && is_string( $data->title ) ) { $return = '' . esc_html( $data->title ) . ''; } break; default: $return = false; } return apply_filters( 'oembed_dataparse', $return, $data, $url ); } public function _strip_newlines( $html, $data, $url ) { if ( false === strpos( $html, "\n" ) ) { return $html; } $count = 1; $found = array(); $token = '__PRE__'; $search = array( "\t", "\n", "\r", ' ' ); $replace = array( '__TAB__', '__NL__', '__CR__', '__SPACE__' ); $tokenized = str_replace( $search, $replace, $html ); preg_match_all( '#(]*>.+?)#i', $tokenized, $matches, PREG_SET_ORDER ); foreach ( $matches as $i => $match ) { $tag_html = str_replace( $replace, $search, $match[0] ); $tag_token = $token . $i; $found[ $tag_token ] = $tag_html; $html = str_replace( $tag_html, $tag_token, $html, $count ); } $replaced = str_replace( $replace, $search, $html ); $stripped = str_replace( array( "\r\n", "\n" ), '', $replaced ); $pre = array_values( $found ); $tokens = array_keys( $found ); return str_replace( $tokens, $pre, $stripped ); } } file = $file; } public static function test( $args = array() ) { return false; } public static function supports_mime_type( $mime_type ) { return false; } abstract public function load(); abstract public function save( $destfilename = null, $mime_type = null ); abstract public function resize( $max_w, $max_h, $crop = false ); abstract public function multi_resize( $sizes ); abstract public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ); abstract public function rotate( $angle ); abstract public function flip( $horz, $vert ); abstract public function stream( $mime_type = null ); public function get_size() { return $this->size; } protected function update_size( $width = null, $height = null ) { $this->size = array( 'width' => (int) $width, 'height' => (int) $height, ); return true; } public function get_quality() { if ( ! $this->quality ) { $this->set_quality(); } return $this->quality; } public function set_quality( $quality = null ) { $mime_type = ! empty( $this->output_mime_type ) ? $this->output_mime_type : $this->mime_type; $default_quality = $this->get_default_quality( $mime_type ); if ( null === $quality ) { $quality = apply_filters( 'wp_editor_set_quality', $default_quality, $mime_type ); if ( 'image/jpeg' === $mime_type ) { $quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' ); } if ( $quality < 0 || $quality > 100 ) { $quality = $default_quality; } } if ( 0 === $quality ) { $quality = 1; } if ( ( $quality >= 1 ) && ( $quality <= 100 ) ) { $this->quality = $quality; return true; } else { return new WP_Error( 'invalid_image_quality', __( 'Attempted to set image quality outside of the range [1,100].' ) ); } } protected function get_default_quality( $mime_type ) { switch ( $mime_type ) { case 'image/webp': $quality = 86; break; case 'image/jpeg': default: $quality = $this->default_quality; } return $quality; } protected function get_output_format( $filename = null, $mime_type = null ) { $new_ext = null; if ( $mime_type ) { $new_ext = $this->get_extension( $mime_type ); } if ( $filename ) { $file_ext = strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) ); $file_mime = $this->get_mime_type( $file_ext ); } else { $file_ext = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) ); $file_mime = $this->mime_type; } if ( ! $mime_type || ( $file_mime == $mime_type ) ) { $mime_type = $file_mime; $new_ext = $file_ext; } $output_format = apply_filters( 'image_editor_output_format', array(), $filename, $mime_type ); if ( isset( $output_format[ $mime_type ] ) && $this->supports_mime_type( $output_format[ $mime_type ] ) ) { $mime_type = $output_format[ $mime_type ]; $new_ext = $this->get_extension( $mime_type ); } if ( ! $this->supports_mime_type( $mime_type ) ) { $mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type ); $new_ext = $this->get_extension( $mime_type ); } if ( $filename && $new_ext ) { $dir = pathinfo( $filename, PATHINFO_DIRNAME ); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); $filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}"; } if ( $mime_type && ( $mime_type !== $this->mime_type ) ) { if ( $mime_type !== $this->output_mime_type ) { $this->output_mime_type = $mime_type; $this->set_quality(); } } elseif ( ! empty( $this->output_mime_type ) ) { $this->output_mime_type = null; $this->set_quality(); } return array( $filename, $new_ext, $mime_type ); } public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) { if ( ! $suffix ) { $suffix = $this->get_suffix(); } $dir = pathinfo( $this->file, PATHINFO_DIRNAME ); $ext = pathinfo( $this->file, PATHINFO_EXTENSION ); $name = wp_basename( $this->file, ".$ext" ); $new_ext = strtolower( $extension ? $extension : $ext ); if ( ! is_null( $dest_path ) ) { if ( ! wp_is_stream( $dest_path ) ) { $_dest_path = realpath( $dest_path ); if ( $_dest_path ) { $dir = $_dest_path; } } else { $dir = $dest_path; } } return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}"; } public function get_suffix() { if ( ! $this->get_size() ) { return false; } return "{$this->size['width']}x{$this->size['height']}"; } public function maybe_exif_rotate() { $orientation = null; if ( is_callable( 'exif_read_data' ) && 'image/jpeg' === $this->mime_type ) { $exif_data = @exif_read_data( $this->file ); if ( ! empty( $exif_data['Orientation'] ) ) { $orientation = (int) $exif_data['Orientation']; } } $orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file ); if ( ! $orientation || 1 === $orientation ) { return false; } switch ( $orientation ) { case 2: $result = $this->flip( true, false ); break; case 3: $result = $this->flip( true, true ); break; case 4: $result = $this->flip( false, true ); break; case 5: $result = $this->rotate( 90 ); if ( ! is_wp_error( $result ) ) { $result = $this->flip( false, true ); } break; case 6: $result = $this->rotate( 270 ); break; case 7: $result = $this->rotate( 90 ); if ( ! is_wp_error( $result ) ) { $result = $this->flip( true, false ); } break; case 8: $result = $this->rotate( 90 ); break; } return $result; } protected function make_image( $filename, $callback, $arguments ) { $stream = wp_is_stream( $filename ); if ( $stream ) { ob_start(); } else { wp_mkdir_p( dirname( $filename ) ); } $result = call_user_func_array( $callback, $arguments ); if ( $result && $stream ) { $contents = ob_get_contents(); $fp = fopen( $filename, 'w' ); if ( ! $fp ) { ob_end_clean(); return false; } fwrite( $fp, $contents ); fclose( $fp ); } if ( $stream ) { ob_end_clean(); } return $result; } protected static function get_mime_type( $extension = null ) { if ( ! $extension ) { return false; } $mime_types = wp_get_mime_types(); $extensions = array_keys( $mime_types ); foreach ( $extensions as $_extension ) { if ( preg_match( "/{$extension}/i", $_extension ) ) { return $mime_types[ $_extension ]; } } return false; } protected static function get_extension( $mime_type = null ) { if ( empty( $mime_type ) ) { return false; } return wp_get_default_extension_for_mime_type( $mime_type ); } } get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) ); if ( ! $_post ) { return false; } $_post = sanitize_post( $_post, 'raw' ); wp_cache_add( $_post->ID, $_post, 'posts' ); } elseif ( empty( $_post->filter ) || 'raw' !== $_post->filter ) { $_post = sanitize_post( $_post, 'raw' ); } return new WP_Post( $_post ); } public function __construct( $post ) { foreach ( get_object_vars( $post ) as $key => $value ) { $this->$key = $value; } } public function __isset( $key ) { if ( 'ancestors' === $key ) { return true; } if ( 'page_template' === $key ) { return true; } if ( 'post_category' === $key ) { return true; } if ( 'tags_input' === $key ) { return true; } return metadata_exists( 'post', $this->ID, $key ); } public function __get( $key ) { if ( 'page_template' === $key && $this->__isset( $key ) ) { return get_post_meta( $this->ID, '_wp_page_template', true ); } if ( 'post_category' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) { $terms = get_the_terms( $this, 'category' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'term_id' ); } if ( 'tags_input' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) { $terms = get_the_terms( $this, 'post_tag' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'name' ); } if ( 'ancestors' === $key ) { $value = get_post_ancestors( $this ); } else { $value = get_post_meta( $this->ID, $key, true ); } if ( $this->filter ) { $value = sanitize_post_field( $key, $value, $this->ID, $this->filter ); } return $value; } public function filter( $filter ) { if ( $this->filter === $filter ) { return $this; } if ( 'raw' === $filter ) { return self::get_instance( $this->ID ); } return sanitize_post( $this, $filter ); } public function to_array() { $post = get_object_vars( $this ); foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) { if ( $this->__isset( $key ) ) { $post[ $key ] = $this->__get( $key ); } } return $post; } } ' . __( 'There are no options for this widget.' ) . '

          '; return 'noform'; } public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { if ( ! empty( $id_base ) ) { $id_base = strtolower( $id_base ); } else { $id_base = preg_replace( '/(wp_)?widget_/', '', strtolower( get_class( $this ) ) ); } $this->id_base = $id_base; $this->name = $name; $this->option_name = 'widget_' . $this->id_base; $this->widget_options = wp_parse_args( $widget_options, array( 'classname' => str_replace( '\\', '_', $this->option_name ), 'customize_selective_refresh' => false, ) ); $this->control_options = wp_parse_args( $control_options, array( 'id_base' => $this->id_base ) ); } public function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) { _deprecated_constructor( 'WP_Widget', '4.3.0', get_class( $this ) ); WP_Widget::__construct( $id_base, $name, $widget_options, $control_options ); } public function get_field_name( $field_name ) { $pos = strpos( $field_name, '[' ); if ( false !== $pos ) { $field_name = '[' . substr_replace( $field_name, '][', $pos, strlen( '[' ) ); } else { $field_name = '[' . $field_name . ']'; } return 'widget-' . $this->id_base . '[' . $this->number . ']' . $field_name; } public function get_field_id( $field_name ) { $field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name ); $field_name = trim( $field_name, '-' ); return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name; } public function _register() { $settings = $this->get_settings(); $empty = true; if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) { $settings = $settings->getArrayCopy(); } if ( is_array( $settings ) ) { foreach ( array_keys( $settings ) as $number ) { if ( is_numeric( $number ) ) { $this->_set( $number ); $this->_register_one( $number ); $empty = false; } } } if ( $empty ) { $this->_set( 1 ); $this->_register_one(); } } public function _set( $number ) { $this->number = $number; $this->id = $this->id_base . '-' . $number; } public function _get_display_callback() { return array( $this, 'display_callback' ); } public function _get_update_callback() { return array( $this, 'update_callback' ); } public function _get_form_callback() { return array( $this, 'form_callback' ); } public function is_preview() { global $wp_customize; return ( isset( $wp_customize ) && $wp_customize->is_preview() ); } public function display_callback( $args, $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $this->_set( $widget_args['number'] ); $instances = $this->get_settings(); if ( isset( $instances[ $this->number ] ) ) { $instance = $instances[ $this->number ]; $instance = apply_filters( 'widget_display_callback', $instance, $this, $args ); if ( false === $instance ) { return; } $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $this->widget( $args, $instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } } } public function update_callback( $deprecated = 1 ) { global $wp_registered_widgets; $all_instances = $this->get_settings(); if ( $this->updated ) { return; } if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { if ( isset( $_POST['the-widget-id'] ) ) { $del_id = $_POST['the-widget-id']; } else { return; } if ( isset( $wp_registered_widgets[ $del_id ]['params'][0]['number'] ) ) { $number = $wp_registered_widgets[ $del_id ]['params'][0]['number']; if ( $this->id_base . '-' . $number == $del_id ) { unset( $all_instances[ $number ] ); } } } else { if ( isset( $_POST[ 'widget-' . $this->id_base ] ) && is_array( $_POST[ 'widget-' . $this->id_base ] ) ) { $settings = $_POST[ 'widget-' . $this->id_base ]; } elseif ( isset( $_POST['id_base'] ) && $_POST['id_base'] == $this->id_base ) { $num = $_POST['multi_number'] ? (int) $_POST['multi_number'] : (int) $_POST['widget_number']; $settings = array( $num => array() ); } else { return; } foreach ( $settings as $number => $new_instance ) { $new_instance = stripslashes_deep( $new_instance ); $this->_set( $number ); $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $instance = $this->update( $new_instance, $old_instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } $instance = apply_filters( 'widget_update_callback', $instance, $new_instance, $old_instance, $this ); if ( false !== $instance ) { $all_instances[ $number ] = $instance; } break; } } $this->save_settings( $all_instances ); $this->updated = true; } public function form_callback( $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $all_instances = $this->get_settings(); if ( -1 == $widget_args['number'] ) { $this->_set( '__i__' ); $instance = array(); } else { $this->_set( $widget_args['number'] ); $instance = $all_instances[ $widget_args['number'] ]; } $instance = apply_filters( 'widget_form_callback', $instance, $this ); $return = null; if ( false !== $instance ) { $return = $this->form( $instance ); do_action_ref_array( 'in_widget_form', array( &$this, &$return, $instance ) ); } return $return; } public function _register_one( $number = -1 ) { wp_register_sidebar_widget( $this->id, $this->name, $this->_get_display_callback(), $this->widget_options, array( 'number' => $number ) ); _register_widget_update_callback( $this->id_base, $this->_get_update_callback(), $this->control_options, array( 'number' => -1 ) ); _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); } public function save_settings( $settings ) { $settings['_multiwidget'] = 1; update_option( $this->option_name, $settings ); } public function get_settings() { $settings = get_option( $this->option_name ); if ( false === $settings ) { if ( isset( $this->alt_option_name ) ) { $settings = get_option( $this->alt_option_name ); } else { $this->save_settings( array() ); } } if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) { $settings = array(); } if ( ! empty( $settings ) && ! isset( $settings['_multiwidget'] ) ) { $settings = wp_convert_widget_settings( $this->id_base, $this->option_name, $settings ); } unset( $settings['_multiwidget'], $settings['__i__'] ); return $settings; } } post_status ) { return; } if ( ! $post->post_name ) { wp_update_post( array( 'ID' => $post_id, 'post_name' => 'custom_slug_' . uniqid(), ) ); } $terms = get_the_terms( $post_id, 'wp_theme' ); if ( ! is_array( $terms ) || ! count( $terms ) ) { wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' ); } } function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) { return $override_slug; } if ( ! $override_slug ) { $override_slug = $slug; } $theme = wp_get_theme()->get_stylesheet(); $terms = get_the_terms( $post_ID, 'wp_theme' ); if ( $terms && ! is_wp_error( $terms ) ) { $theme = $terms[0]->name; } $check_query_args = array( 'post_name__in' => array( $override_slug ), 'post_type' => $post_type, 'posts_per_page' => 1, 'no_found_rows' => true, 'post__not_in' => array( $post_ID ), 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => $theme, ), ), ); $check_query = new WP_Query( $check_query_args ); $posts = $check_query->posts; if ( count( $posts ) > 0 ) { $suffix = 2; do { $query_args = $check_query_args; $alt_post_name = _truncate_post_slug( $override_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $query_args['post_name__in'] = array( $alt_post_name ); $query = new WP_Query( $query_args ); $suffix++; } while ( count( $query->posts ) > 0 ); $override_slug = $alt_post_name; } return $override_slug; } function the_block_template_skip_link() { global $_wp_current_template_content; if ( ! current_theme_supports( 'block-templates' ) ) { return; } if ( ! $_wp_current_template_content ) { return; } ?> -.edit-attachment-frame .attachment-media-view .details-image.icon { - background: none; -} + + + + - -

          -

          - - -

          -

          - - - - - 1 ) { $_POST['allusers'] = array( $id ); $title = __( 'Users' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
          '; confirm_delete_users( $_POST['allusers'] ); echo '
          '; require_once ABSPATH . 'wp-admin/admin-footer.php'; } else { wp_redirect( network_admin_url( 'users.php' ) ); } exit; case 'allusers': if ( ! current_user_can( 'manage_network_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( isset( $_POST['action'] ) && isset( $_POST['allusers'] ) ) { check_admin_referer( 'bulk-users-network' ); $doaction = $_POST['action']; $userfunction = ''; foreach ( (array) $_POST['allusers'] as $user_id ) { if ( ! empty( $user_id ) ) { switch ( $doaction ) { case 'delete': if ( ! current_user_can( 'delete_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $title = __( 'Users' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
          '; confirm_delete_users( $_POST['allusers'] ); echo '
          '; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; case 'spam': $user = get_userdata( $user_id ); if ( is_super_admin( $user->ID ) ) { wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); } $userfunction = 'all_spam'; $blogs = get_blogs_of_user( $user_id, true ); foreach ( (array) $blogs as $details ) { if ( get_network()->site_id != $details->userblog_id ) { update_blog_status( $details->userblog_id, 'spam', '1' ); } } $user_data = $user->to_array(); $user_data['spam'] = '1'; wp_update_user( $user_data ); break; case 'notspam': $user = get_userdata( $user_id ); $userfunction = 'all_notspam'; $blogs = get_blogs_of_user( $user_id, true ); foreach ( (array) $blogs as $details ) { update_blog_status( $details->userblog_id, 'spam', '0' ); } $user_data = $user->to_array(); $user_data['spam'] = '0'; wp_update_user( $user_data ); break; } } } if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) { $sendback = wp_get_referer(); $user_ids = (array) $_POST['allusers']; $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids ); wp_safe_redirect( $sendback ); exit; } wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction, ), wp_get_referer() ) ); } else { $location = network_admin_url( 'users.php' ); if ( ! empty( $_REQUEST['paged'] ) ) { $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); } wp_redirect( $location ); } exit; case 'dodelete': check_admin_referer( 'ms-users-delete' ); if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { foreach ( $_POST['blog'] as $id => $users ) { foreach ( $users as $blogid => $user_id ) { if ( ! current_user_can( 'delete_user', $id ) ) { continue; } if ( ! empty( $_POST['delete'] ) && 'reassign' === $_POST['delete'][ $blogid ][ $id ] ) { remove_user_from_blog( $id, $blogid, (int) $user_id ); } else { remove_user_from_blog( $id, $blogid ); } } } } $i = 0; if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) { foreach ( $_POST['user'] as $id ) { if ( ! current_user_can( 'delete_user', $id ) ) { continue; } wpmu_delete_user( $id ); $i++; } } if ( 1 === $i ) { $deletefunction = 'delete'; } else { $deletefunction = 'all_delete'; } wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction, ), network_admin_url( 'users.php' ) ) ); exit; } } $wp_list_table = _get_list_table( 'WP_MS_Users_List_Table' ); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->prepare_items(); $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); if ( $pagenum > $total_pages && $total_pages > 0 ) { wp_redirect( add_query_arg( 'paged', $total_pages ) ); exit; } $title = __( 'Users' ); $parent_file = 'users.php'; add_screen_option( 'per_page' ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

          ' . __( 'This table shows all users across the network and the sites to which they are assigned.' ) . '

          ' . '

          ' . __( 'Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.' ) . '

          ' . '

          ' . __( 'You can also go to the user’s profile page by clicking on the individual username.' ) . '

          ' . '

          ' . __( 'You can sort the table by clicking on any of the table headings and switch between list and excerpt views by using the icons above the users list.' ) . '

          ' . '

          ' . __( 'The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.' ) . '

          ' . '

          ' . __( 'You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.' ) . '

          ', ) ); get_current_screen()->set_help_sidebar( '

          ' . __( 'For more information:' ) . '

          ' . '

          ' . __( 'Documentation on Network Users' ) . '

          ' . '

          ' . __( 'Support Forums' ) . '

          ' ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter users list' ), 'heading_pagination' => __( 'Users list navigation' ), 'heading_list' => __( 'Users list' ), ) ); require_once ABSPATH . 'wp-admin/admin-header.php'; if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) { ?> -

          - -

          - -
          -

          - - - - '; printf( __( 'Search results for: %s' ), '' . esc_html( $usersearch ) . '' ); echo ''; } ?> - -
          - - views(); ?> - -
          - search_box( __( 'Search Users' ), 'all-user' ); ?> -
          - -
          - display(); ?> -
          -
          - - -%s', $update_data['counts']['total'], number_format_i18n( $update_data['counts']['total'] ) ) ), $cap, 'update-core.php', ); } else { $submenu['index.php'][10] = array( __( 'Updates' ), $cap, 'update-core.php' ); } unset( $cap ); $submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' ); $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); $menu[5] = array( __( 'Sites' ), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'dashicons-admin-multisite' ); $submenu['sites.php'][5] = array( __( 'All Sites' ), 'manage_sites', 'sites.php' ); $submenu['sites.php'][10] = array( _x( 'Add New', 'site' ), 'create_sites', 'site-new.php' ); $menu[10] = array( __( 'Users' ), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' ); $submenu['users.php'][5] = array( __( 'All Users' ), 'manage_network_users', 'users.php' ); $submenu['users.php'][10] = array( _x( 'Add New', 'user' ), 'create_users', 'user-new.php' ); if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) { $menu[15] = array( sprintf( __( 'Themes %s' ), sprintf( '%s', $update_data['counts']['themes'], number_format_i18n( $update_data['counts']['themes'] ) ) ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance', ); } else { $menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); } $submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' ); $submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' ); $submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) { $menu[20] = array( sprintf( __( 'Plugins %s' ), sprintf( '%s', $update_data['counts']['plugins'], number_format_i18n( $update_data['counts']['plugins'] ) ) ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins', ); } else { $menu[20] = array( __( 'Plugins' ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); } $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' ); $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); $menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) { $submenu['settings.php'][5] = array( __( 'Network Settings' ), 'manage_network_options', 'settings.php' ); $submenu['settings.php'][10] = array( __( 'Network Setup' ), 'setup_network', 'setup.php' ); } unset( $update_data ); $menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' ); require_once ABSPATH . 'wp-admin/includes/menu.php'; add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] && is_array( $_POST['option'] ) ) { check_admin_referer( 'edit-site' ); switch_to_blog( $id ); $skip_options = array( 'allowedthemes' ); foreach ( (array) $_POST['option'] as $key => $val ) { $key = wp_unslash( $key ); $val = wp_unslash( $val ); if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) { continue; } update_option( $key, $val ); } do_action( 'wpmu_update_blog_options', $id ); restore_current_blog(); wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id, ), 'site-settings.php' ) ); exit; } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'updated' === $_GET['update'] ) { $messages[] = __( 'Site options updated.' ); } } $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - -
          -

          -

          |

          - - $id, 'selected' => 'site-settings', ) ); if ( ! empty( $messages ) ) { foreach ( $messages as $msg ) { echo '

          ' . $msg . '

          '; } } ?> -
          - - - - get_blog_prefix( $id ); $sql = "SELECT * FROM {$blog_prefix}options - WHERE option_name NOT LIKE %s - AND option_name NOT LIKE %s"; $query = $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', '%' . $wpdb->esc_like( 'user_roles' ) ); $options = $wpdb->get_results( $query ); foreach ( $options as $option ) { if ( 'default_role' === $option->option_name ) { $editblog_default_role = $option->option_value; } $disabled = false; $class = 'all-options'; if ( is_serialized( $option->option_value ) ) { if ( is_serialized_string( $option->option_value ) ) { $option->option_value = esc_html( maybe_unserialize( $option->option_value ) ); } else { $option->option_value = 'SERIALIZED DATA'; $disabled = true; $class = 'all-options disabled'; } } if ( strpos( $option->option_value, "\n" ) !== false ) { ?> - - - - - - - - option_name, array( 'siteurl', 'home' ), true ) ) { ?> - - - - - - - - -
          - -
          -add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

          ' . __( 'Add User will set up a new user account on the network and send that person an email with username and password.' ) . '

          ' . '

          ' . __( 'Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.' ) . '

          ', ) ); get_current_screen()->set_help_sidebar( '

          ' . __( 'For more information:' ) . '

          ' . '

          ' . __( 'Documentation on Network Users' ) . '

          ' . '

          ' . __( 'Support Forums' ) . '

          ' ); if ( isset( $_REQUEST['action'] ) && 'add-user' === $_REQUEST['action'] ) { check_admin_referer( 'add-user', '_wpnonce_add-user' ); if ( ! current_user_can( 'manage_network_users' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } if ( ! is_array( $_POST['user'] ) ) { wp_die( __( 'Cannot create an empty user.' ) ); } $user = wp_unslash( $_POST['user'] ); $user_details = wpmu_validate_user_signup( $user['username'], $user['email'] ); if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) { $add_user_errors = $user_details['errors']; } else { $password = wp_generate_password( 12, false ); $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, sanitize_email( $user['email'] ) ); if ( ! $user_id ) { $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); } else { do_action( 'network_user_new_created_user', $user_id ); wp_redirect( add_query_arg( array( 'update' => 'added', 'user_id' => $user_id, ), 'user-new.php' ) ); exit; } } } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'added' === $_GET['update'] ) { $edit_link = ''; if ( isset( $_GET['user_id'] ) ) { $user_id_new = absint( $_GET['user_id'] ); if ( $user_id_new ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); } } $message = __( 'User added.' ); if ( $edit_link ) { $message .= sprintf( ' %s', $edit_link, __( 'Edit user' ) ); } $messages[] = $message; } } $title = __( 'Add New User' ); $parent_file = 'users.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - -
          -

          -

          ' . $msg . '

          '; } } if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> -
          - get_error_messages() as $message ) { echo "

          $message

          "; } ?> -
          - -
          - - - - - - - - - - - - - - -
          - -add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME ); $is_main_site = is_main_site( $id ); if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] ) { check_admin_referer( 'edit-site' ); switch_to_blog( $id ); delete_option( 'rewrite_rules' ); $blog_data = wp_unslash( $_POST['blog'] ); $blog_data['scheme'] = $parsed_scheme; if ( $is_main_site ) { $blog_data['domain'] = $details->domain; $blog_data['path'] = $details->path; } else { $new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME ); if ( ! $new_url_scheme ) { $blog_data['url'] = esc_url( $parsed_scheme . '://' . $blog_data['url'] ); } $update_parsed_url = parse_url( $blog_data['url'] ); if ( ! isset( $update_parsed_url['path'] ) ) { $update_parsed_url['path'] = '/'; } $blog_data['scheme'] = $update_parsed_url['scheme']; $blog_data['domain'] = $update_parsed_url['host']; $blog_data['path'] = $update_parsed_url['path']; } $existing_details = get_site( $id ); $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); foreach ( $blog_data_checkboxes as $c ) { if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) { $blog_data[ $c ] = $existing_details->$c; } else { $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; } } update_blog_details( $id, $blog_data ); $new_details = get_site( $id ); $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); $old_home_parsed = parse_url( $old_home_url ); if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); update_option( 'home', $new_home_url ); } $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); $old_site_parsed = parse_url( $old_site_url ); if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); update_option( 'siteurl', $new_site_url ); } restore_current_blog(); wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id, ), 'site-info.php' ) ); exit; } if ( isset( $_GET['update'] ) ) { $messages = array(); if ( 'updated' === $_GET['update'] ) { $messages[] = __( 'Site info updated.' ); } } $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - -
          -

          -

          |

          - $id, 'selected' => 'site-info', ) ); if ( ! empty( $messages ) ) { foreach ( $messages as $msg ) { echo '

          ' . $msg . '

          '; } } ?> -
          - - - - - - - - - - - - - - - - - - - - - - - - _x( 'Public', 'site' ) ); if ( ! $is_main_site ) { $attribute_fields['archived'] = __( 'Archived' ); $attribute_fields['spam'] = _x( 'Spam', 'site' ); $attribute_fields['deleted'] = __( 'Deleted' ); } $attribute_fields['mature'] = __( 'Mature' ); ?> - - - - - - - -
          - -
          -add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter site themes list' ), 'heading_pagination' => __( 'Site themes list navigation' ), 'heading_list' => __( 'Site themes list' ), ) ); $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); $action = $wp_list_table->current_action(); $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; $temp_args = array( 'enabled', 'disabled', 'error' ); $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( $temp_args, wp_get_referer() ); if ( ! empty( $_REQUEST['paged'] ) ) { $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); } $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $wp_list_table->prepare_items(); $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); if ( $action ) { switch_to_blog( $id ); $allowed_themes = get_option( 'allowedthemes' ); switch ( $action ) { case 'enable': check_admin_referer( 'enable-theme_' . $_GET['theme'] ); $theme = $_GET['theme']; $action = 'enabled'; $n = 1; if ( ! $allowed_themes ) { $allowed_themes = array( $theme => true ); } else { $allowed_themes[ $theme ] = true; } break; case 'disable': check_admin_referer( 'disable-theme_' . $_GET['theme'] ); $theme = $_GET['theme']; $action = 'disabled'; $n = 1; if ( ! $allowed_themes ) { $allowed_themes = array(); } else { unset( $allowed_themes[ $theme ] ); } break; case 'enable-selected': check_admin_referer( 'bulk-themes' ); if ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; $action = 'enabled'; $n = count( $themes ); foreach ( (array) $themes as $theme ) { $allowed_themes[ $theme ] = true; } } else { $action = 'error'; $n = 'none'; } break; case 'disable-selected': check_admin_referer( 'bulk-themes' ); if ( isset( $_POST['checked'] ) ) { $themes = (array) $_POST['checked']; $action = 'disabled'; $n = count( $themes ); foreach ( (array) $themes as $theme ) { unset( $allowed_themes[ $theme ] ); } } else { $action = 'error'; $n = 'none'; } break; default: if ( isset( $_POST['checked'] ) ) { check_admin_referer( 'bulk-themes' ); $themes = (array) $_POST['checked']; $n = count( $themes ); $screen = get_current_screen()->id; $referer = apply_filters( "handle_network_bulk_actions-{$screen}", $referer, $action, $themes, $id ); } else { $action = 'error'; $n = 'none'; } } update_option( 'allowedthemes', $allowed_themes ); restore_current_blog(); wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n, ), $referer ) ); exit; } if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) { wp_safe_redirect( $referer ); exit; } add_thickbox(); add_screen_option( 'per_page' ); $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - -
          -

          -

          |

          - $id, 'selected' => 'site-themes', ) ); if ( isset( $_GET['enabled'] ) ) { $enabled = absint( $_GET['enabled'] ); if ( 1 === $enabled ) { $message = __( 'Theme enabled.' ); } else { $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); } echo '

          ' . sprintf( $message, number_format_i18n( $enabled ) ) . '

          '; } elseif ( isset( $_GET['disabled'] ) ) { $disabled = absint( $_GET['disabled'] ); if ( 1 === $disabled ) { $message = __( 'Theme disabled.' ); } else { $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); } echo '

          ' . sprintf( $message, number_format_i18n( $disabled ) ) . '

          '; } elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { echo '

          ' . __( 'No theme selected.' ) . '

          '; } ?> - -

          - -
          -search_box( __( 'Search Installed Themes' ), 'theme' ); ?> - -
          - -views(); ?> - -
          - - -display(); ?> - -
          - -
          - -prepare_items(); get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); get_current_screen()->set_screen_reader_content( array( 'heading_views' => __( 'Filter site users list' ), 'heading_pagination' => __( 'Site users list navigation' ), 'heading_list' => __( 'Site users list' ), ) ); $_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( 'update', wp_get_referer() ); if ( ! empty( $_REQUEST['paged'] ) ) { $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); } $id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; if ( ! $id ) { wp_die( __( 'Invalid site ID.' ) ); } $details = get_site( $id ); if ( ! $details ) { wp_die( __( 'The requested site does not exist.' ) ); } if ( ! can_edit_network( $details->site_id ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $is_main_site = is_main_site( $id ); switch_to_blog( $id ); $action = $wp_list_table->current_action(); if ( $action ) { switch ( $action ) { case 'newuser': check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); $user = $_POST['user']; if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { $update = 'err_new'; } else { $password = wp_generate_password( 12, false ); $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); if ( false === $user_id ) { $update = 'err_new_dup'; } else { $result = add_user_to_blog( $id, $user_id, $_POST['new_role'] ); if ( is_wp_error( $result ) ) { $update = 'err_add_fail'; } else { $update = 'newuser'; do_action( 'network_site_users_created_user', $user_id ); } } } break; case 'adduser': check_admin_referer( 'add-user', '_wpnonce_add-user' ); if ( ! empty( $_POST['newuser'] ) ) { $update = 'adduser'; $newuser = $_POST['newuser']; $user = get_user_by( 'login', $newuser ); if ( $user && $user->exists() ) { if ( ! is_user_member_of_blog( $user->ID, $id ) ) { $result = add_user_to_blog( $id, $user->ID, $_POST['new_role'] ); if ( is_wp_error( $result ) ) { $update = 'err_add_fail'; } } else { $update = 'err_add_member'; } } else { $update = 'err_add_notfound'; } } else { $update = 'err_add_notfound'; } break; case 'remove': if ( ! current_user_can( 'remove_users' ) ) { wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 ); } check_admin_referer( 'bulk-users' ); $update = 'remove'; if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; remove_user_from_blog( $user_id, $id ); } } elseif ( isset( $_GET['user'] ) ) { remove_user_from_blog( $_GET['user'] ); } else { $update = 'err_remove'; } break; case 'promote': check_admin_referer( 'bulk-users' ); $editable_roles = get_editable_roles(); $role = $_REQUEST['new_role']; if ( empty( $editable_roles[ $role ] ) ) { wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); } if ( isset( $_REQUEST['users'] ) ) { $userids = $_REQUEST['users']; $update = 'promote'; foreach ( $userids as $user_id ) { $user_id = (int) $user_id; if ( ! is_user_member_of_blog( $user_id ) ) { wp_die( '

          ' . __( 'Something went wrong.' ) . '

          ' . '

          ' . __( 'One of the selected users is not a member of this site.' ) . '

          ', 403 ); } $user = get_userdata( $user_id ); $user->set_role( $role ); } } else { $update = 'err_promote'; } break; default: if ( ! isset( $_REQUEST['users'] ) ) { break; } check_admin_referer( 'bulk-users' ); $userids = $_REQUEST['users']; $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $userids, $id ); $update = $action; break; } wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); exit; } restore_current_blog(); if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) { wp_safe_redirect( $referer ); exit; } add_screen_option( 'per_page' ); $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) { wp_enqueue_script( 'user-suggest' ); } require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - - - - -
          -

          -

          |

          - $id, 'selected' => 'site-users', ) ); if ( isset( $_GET['update'] ) ) : switch ( $_GET['update'] ) { case 'adduser': echo '

          ' . __( 'User added.' ) . '

          '; break; case 'err_add_member': echo '

          ' . __( 'User is already a member of this site.' ) . '

          '; break; case 'err_add_fail': echo '

          ' . __( 'User could not be added to this site.' ) . '

          '; break; case 'err_add_notfound': echo '

          ' . __( 'Enter the username of an existing user.' ) . '

          '; break; case 'promote': echo '

          ' . __( 'Changed roles.' ) . '

          '; break; case 'err_promote': echo '

          ' . __( 'Select a user to change role.' ) . '

          '; break; case 'remove': echo '

          ' . __( 'User removed from this site.' ) . '

          '; break; case 'err_remove': echo '

          ' . __( 'Select a user to remove.' ) . '

          '; break; case 'newuser': echo '

          ' . __( 'User created.' ) . '

          '; break; case 'err_new': echo '

          ' . __( 'Enter the username and email.' ) . '

          '; break; case 'err_new_dup': echo '

          ' . __( 'Duplicated username or email address.' ) . '

          '; break; } endif; ?> - -
          -search_box( __( 'Search Users' ), 'user' ); ?> - -
          - -views(); ?> - -
          - - -display(); ?> - -
          - - -

          -
          - - - - - - - - - - - - - 'submit-add-existing-user' ) ); ?> -
          - - - -

          -
          - - - - - - - - - - - - - - - - - - - - 'submit-add-user' ) ); ?> -
          - -
          -domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) ); $redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request ); if ( $redirect_network_admin_request ) { wp_redirect( network_admin_url() ); exit; } unset( $redirect_network_admin_request ); __( 'Author' ), 'comment' => _x( 'Comment', 'column name' ), ), array(), array(), 'comment', ); } protected function get_table_classes() { $classes = parent::get_table_classes(); $classes[] = 'wp-list-table'; $classes[] = 'comments-box'; return $classes; } public function display( $output_empty = false ) { $singular = $this->_args['singular']; wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); ?> - - - > - display_rows_or_placeholder(); } ?> - - - status; $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); $download_data_markup = ''; $download_data_markup .= '' . '' . '' . ''; $download_data_markup .= ''; $row_actions['download-data'] = $download_data_markup; if ( 'request-completed' !== $status ) { $complete_request_markup = ''; $complete_request_markup .= sprintf( '%s', esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'complete', 'request_id' => array( $request_id ), ), admin_url( 'export-personal-data.php' ) ), 'bulk-privacy_requests' ) ), esc_attr( sprintf( __( 'Mark export request for “%s” as completed.' ), $item->email ) ), __( 'Complete request' ) ); $complete_request_markup .= ''; } if ( ! empty( $complete_request_markup ) ) { $row_actions['complete-request'] = $complete_request_markup; } return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) ); } public function column_next_steps( $item ) { $status = $item->status; switch ( $status ) { case 'request-pending': esc_html_e( 'Waiting for confirmation' ); break; case 'request-confirmed': $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $exporters_count = count( $exporters ); $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); echo '
          '; ?> - - - - - '; break; case 'request-failed': echo ''; break; case 'request-completed': echo '' . esc_html__( 'Remove request' ) . ''; break; } } } '', 'email' => __( 'Requester' ), 'status' => __( 'Status' ), 'created_timestamp' => __( 'Requested' ), 'next_steps' => __( 'Next steps' ), ); return $columns; } protected function get_admin_url() { $pagenow = str_replace( '_', '-', $this->request_type ); if ( 'remove-personal-data' === $pagenow ) { $pagenow = 'erase-personal-data'; } return admin_url( $pagenow . '.php' ); } protected function get_sortable_columns() { $desc_first = isset( $_GET['orderby'] ); return array( 'email' => 'requester', 'created_timestamp' => array( 'requested', $desc_first ), ); } protected function get_default_primary_column_name() { return 'email'; } protected function get_request_counts() { global $wpdb; $cache_key = $this->post_type . '-' . $this->request_type; $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { return $counts; } $query = " - SELECT post_status, COUNT( * ) AS num_posts - FROM {$wpdb->posts} - WHERE post_type = %s - AND post_name = %s - GROUP BY post_status"; $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A ); $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; } $counts = (object) $counts; wp_cache_set( $cache_key, $counts, 'counts' ); return $counts; } protected function get_views() { $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : ''; $statuses = _wp_privacy_statuses(); $views = array(); $counts = $this->get_request_counts(); $total_requests = absint( array_sum( (array) $counts ) ); $admin_url = $this->get_admin_url(); $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : ''; $status_label = sprintf( _nx( 'All (%s)', 'All (%s)', $total_requests, 'requests' ), number_format_i18n( $total_requests ) ); $views['all'] = sprintf( '%s', esc_url( $admin_url ), $current_link_attributes, $status_label ); foreach ( $statuses as $status => $label ) { $post_status = get_post_status_object( $status ); if ( ! $post_status ) { continue; } $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : ''; $total_status_requests = absint( $counts->{$status} ); if ( ! $total_status_requests ) { continue; } $status_label = sprintf( translate_nooped_plural( $post_status->label_count, $total_status_requests ), number_format_i18n( $total_status_requests ) ); $status_link = add_query_arg( 'filter-status', $status, $admin_url ); $views[ $status ] = sprintf( '%s', esc_url( $status_link ), $current_link_attributes, $status_label ); } return $views; } protected function get_bulk_actions() { return array( 'resend' => __( 'Resend confirmation requests' ), 'complete' => __( 'Mark requests as completed' ), 'delete' => __( 'Delete requests' ), ); } public function process_bulk_action() { $action = $this->current_action(); $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); if ( empty( $request_ids ) ) { return; } $count = 0; $failures = 0; check_admin_referer( 'bulk-privacy_requests' ); switch ( $action ) { case 'resend': foreach ( $request_ids as $request_id ) { $resend = _wp_privacy_resend_request( $request_id ); if ( $resend && ! is_wp_error( $resend ) ) { $count++; } else { $failures++; } } if ( $failures ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d confirmation request failed to resend.', '%d confirmation requests failed to resend.', $failures ), $failures ), 'error' ); } if ( $count ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d confirmation request re-sent successfully.', '%d confirmation requests re-sent successfully.', $count ), $count ), 'success' ); } break; case 'complete': foreach ( $request_ids as $request_id ) { $result = _wp_privacy_completed_request( $request_id ); if ( $result && ! is_wp_error( $result ) ) { $count++; } } add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request marked as complete.', '%d requests marked as complete.', $count ), $count ), 'success' ); break; case 'delete': foreach ( $request_ids as $request_id ) { if ( wp_delete_post( $request_id, true ) ) { $count++; } else { $failures++; } } if ( $failures ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request failed to delete.', '%d requests failed to delete.', $failures ), $failures ), 'error' ); } if ( $count ) { add_settings_error( 'bulk_action', 'bulk_action', sprintf( _n( '%d request deleted successfully.', '%d requests deleted successfully.', $count ), $count ), 'success' ); } break; } } public function prepare_items() { $this->items = array(); $posts_per_page = $this->get_items_per_page( $this->request_type . '_requests_per_page' ); $args = array( 'post_type' => $this->post_type, 'post_name__in' => array( $this->request_type ), 'posts_per_page' => $posts_per_page, 'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0, 'post_status' => 'any', 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', ); $orderby_mapping = array( 'requester' => 'post_title', 'requested' => 'post_date', ); if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) { $args['orderby'] = $orderby_mapping[ $_REQUEST['orderby'] ]; } if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['order'] ), array( 'ASC', 'DESC' ), true ) ) { $args['order'] = strtoupper( $_REQUEST['order'] ); } if ( ! empty( $_REQUEST['filter-status'] ) ) { $filter_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : ''; $args['post_status'] = $filter_status; } $requests_query = new WP_Query( $args ); $requests = $requests_query->posts; foreach ( $requests as $request ) { $this->items[] = wp_get_user_request( $request->ID ); } $this->items = array_filter( $this->items ); $this->set_pagination_args( array( 'total_items' => $requests_query->found_posts, 'per_page' => $posts_per_page, ) ); } public function column_cb( $item ) { return sprintf( '', esc_attr( $item->ID ) ); } public function column_status( $item ) { $status = get_post_status( $item->ID ); $status_object = get_post_status_object( $status ); if ( ! $status_object || empty( $status_object->label ) ) { return '-'; } $timestamp = false; switch ( $status ) { case 'request-confirmed': $timestamp = $item->confirmed_timestamp; break; case 'request-completed': $timestamp = $item->completed_timestamp; break; } echo ''; echo esc_html( $status_object->label ); if ( $timestamp ) { echo ' (' . $this->get_timestamp_as_date( $timestamp ) . ')'; } echo ''; } protected function get_timestamp_as_date( $timestamp ) { if ( empty( $timestamp ) ) { return ''; } $time_diff = time() - $timestamp; if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) ); } return date_i18n( get_option( 'date_format' ), $timestamp ); } public function column_default( $item, $column_name ) { do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); } public function column_created_timestamp( $item ) { return $this->get_timestamp_as_date( $item->created_timestamp ); } public function column_email( $item ) { return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( array() ) ); } public function column_next_steps( $item ) {} public function single_row( $item ) { $status = $item->status; echo ''; $this->single_row_columns( $item ); echo ''; } public function embed_scripts() {} } 'tags', 'singular' => 'tag', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $action = $this->screen->action; $post_type = $this->screen->post_type; $taxonomy = $this->screen->taxonomy; if ( empty( $taxonomy ) ) { $taxonomy = 'post_tag'; } if ( ! taxonomy_exists( $taxonomy ) ) { wp_die( __( 'Invalid taxonomy.' ) ); } $tax = get_taxonomy( $taxonomy ); if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) { $post_type = 'post'; } } public function ajax_user_can() { return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms ); } public function prepare_items() { $taxonomy = $this->screen->taxonomy; $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" ); if ( 'post_tag' === $taxonomy ) { $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' ); } elseif ( 'category' === $taxonomy ) { $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); } $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'taxonomy' => $taxonomy, 'search' => $search, 'page' => $this->get_pagenum(), 'number' => $tags_per_page, 'hide_empty' => 0, ); if ( ! empty( $_REQUEST['orderby'] ) ) { $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); } if ( ! empty( $_REQUEST['order'] ) ) { $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); } $args['offset'] = ( $args['page'] - 1 ) * $args['number']; $this->callback_args = $args; if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { $args['number'] = 0; $args['offset'] = $args['number']; } $this->items = get_terms( $args ); $this->set_pagination_args( array( 'total_items' => wp_count_terms( array( 'taxonomy' => $taxonomy, 'search' => $search, ) ), 'per_page' => $tags_per_page, ) ); } public function no_items() { echo get_taxonomy( $this->screen->taxonomy )->labels->not_found; } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) { $actions['delete'] = __( 'Delete' ); } return $actions; } public function current_action() { if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) { return 'bulk-delete'; } return parent::current_action(); } public function get_columns() { $columns = array( 'cb' => '', 'name' => _x( 'Name', 'term name' ), 'description' => __( 'Description' ), 'slug' => __( 'Slug' ), ); if ( 'link_category' === $this->screen->taxonomy ) { $columns['links'] = __( 'Links' ); } else { $columns['posts'] = _x( 'Count', 'Number/count of items' ); } return $columns; } protected function get_sortable_columns() { return array( 'name' => 'name', 'description' => 'description', 'slug' => 'slug', 'posts' => 'count', 'links' => 'count', ); } public function display_rows_or_placeholder() { $taxonomy = $this->screen->taxonomy; $number = $this->callback_args['number']; $offset = $this->callback_args['offset']; $count = 0; if ( empty( $this->items ) || ! is_array( $this->items ) ) { echo ''; $this->no_items(); echo ''; return; } if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) { if ( ! empty( $this->callback_args['search'] ) ) { $children = array(); } else { $children = _get_term_hierarchy( $taxonomy ); } $this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count ); } else { foreach ( $this->items as $term ) { $this->single_row( $term ); } } } private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) { $end = $start + $per_page; foreach ( $terms as $key => $term ) { if ( $count >= $end ) { break; } if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) { continue; } if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { $my_parents = array(); $parent_ids = array(); $p = $term->parent; while ( $p ) { $my_parent = get_term( $p, $taxonomy ); $my_parents[] = $my_parent; $p = $my_parent->parent; if ( in_array( $p, $parent_ids, true ) ) { break; } $parent_ids[] = $p; } unset( $parent_ids ); $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { echo "\t"; $this->single_row( $my_parent, $level - $num_parents ); $num_parents--; } } if ( $count >= $start ) { echo "\t"; $this->single_row( $term, $level ); } ++$count; unset( $terms[ $key ] ); if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) { $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); } } } public function single_row( $tag, $level = 0 ) { global $taxonomy; $tag = sanitize_term( $tag, $taxonomy ); $this->level = $level; if ( $tag->parent ) { $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); $level = 'level-' . $count; } else { $level = 'level-0'; } echo ''; $this->single_row_columns( $tag ); echo ''; } public function column_cb( $item ) { $tag = $item; if ( current_user_can( 'delete_term', $tag->term_id ) ) { return sprintf( '' . '', $tag->term_id, sprintf( __( 'Select %s' ), $tag->name ) ); } return ' '; } public function column_name( $tag ) { $taxonomy = $this->screen->taxonomy; $pad = str_repeat( '— ', max( 0, $this->level ) ); $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); if ( $edit_link ) { $edit_link = add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), $edit_link ); $name = sprintf( '%s', esc_url( $edit_link ), esc_attr( sprintf( __( '“%s” (Edit)' ), $tag->name ) ), $name ); } $out = sprintf( '%s
          ', $name ); $out .= ''; return $out; } protected function get_default_primary_column_name() { return 'name'; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $tag = $item; $taxonomy = $this->screen->taxonomy; $tax = get_taxonomy( $taxonomy ); $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; $edit_link = add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) ); $actions = array(); if ( current_user_can( 'edit_term', $tag->term_id ) ) { $actions['edit'] = sprintf( '%s', esc_url( $edit_link ), esc_attr( sprintf( __( 'Edit “%s”' ), $tag->name ) ), __( 'Edit' ) ); $actions['inline hide-if-no-js'] = sprintf( '', esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), __( 'Quick Edit' ) ); } if ( current_user_can( 'delete_term', $tag->term_id ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), __( 'Delete' ) ); } if ( is_taxonomy_viewable( $tax ) ) { $actions['view'] = sprintf( '%s', get_term_link( $tag ), esc_attr( sprintf( __( 'View “%s” archive' ), $tag->name ) ), __( 'View' ) ); } $actions = apply_filters( 'tag_row_actions', $actions, $tag ); $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); return $this->row_actions( $actions ); } public function column_description( $tag ) { if ( $tag->description ) { return $tag->description; } else { return '' . __( 'No description' ) . ''; } } public function column_slug( $tag ) { return apply_filters( 'editable_slug', $tag->slug, $tag ); } public function column_posts( $tag ) { $count = number_format_i18n( $tag->count ); $tax = get_taxonomy( $this->screen->taxonomy ); $ptype_object = get_post_type_object( $this->screen->post_type ); if ( ! $ptype_object->show_ui ) { return $count; } if ( $tax->query_var ) { $args = array( $tax->query_var => $tag->slug ); } else { $args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug, ); } if ( 'post' !== $this->screen->post_type ) { $args['post_type'] = $this->screen->post_type; } if ( 'attachment' === $this->screen->post_type ) { return "$count"; } return "$count"; } public function column_links( $tag ) { $count = number_format_i18n( $tag->count ); if ( $count ) { $count = "$count"; } return $count; } public function column_default( $item, $column_name ) { return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id ); } public function inline_edit() { $tax = get_taxonomy( $this->screen->taxonomy ); if ( ! current_user_can( $tax->cap->edit_terms ) ) { return; } ?> - -
          - - - - - -
          -
          - 'user', 'plural' => 'users', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $this->is_site_users = 'site-users-network' === $this->screen->id; if ( $this->is_site_users ) { $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; } } public function ajax_user_can() { if ( $this->is_site_users ) { return current_user_can( 'manage_sites' ); } else { return current_user_can( 'list_users' ); } } public function prepare_items() { global $role, $usersearch; $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; $users_per_page = $this->get_items_per_page( $per_page ); $paged = $this->get_pagenum(); if ( 'none' === $role ) { $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'include' => wp_get_users_with_no_role( $this->site_id ), 'search' => $usersearch, 'fields' => 'all_with_meta', ); } else { $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'role' => $role, 'search' => $usersearch, 'fields' => 'all_with_meta', ); } if ( '' !== $args['search'] ) { $args['search'] = '*' . $args['search'] . '*'; } if ( $this->is_site_users ) { $args['blog_id'] = $this->site_id; } if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } $args = apply_filters( 'users_list_table_query_args', $args ); $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); $this->set_pagination_args( array( 'total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page, ) ); } public function no_items() { _e( 'No users found.' ); } protected function get_views() { global $role; $wp_roles = wp_roles(); $count_users = ! wp_is_large_user_count(); if ( $this->is_site_users ) { $url = 'site-users.php?id=' . $this->site_id; } else { $url = 'users.php'; } $role_links = array(); $avail_roles = array(); $all_text = __( 'All' ); $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; if ( $count_users ) { if ( $this->is_site_users ) { switch_to_blog( $this->site_id ); $users_of_blog = count_users( 'time', $this->site_id ); restore_current_blog(); } else { $users_of_blog = count_users(); } $total_users = $users_of_blog['total_users']; $avail_roles =& $users_of_blog['avail_roles']; unset( $users_of_blog ); $all_text = sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ); } $role_links['all'] = sprintf( '%s', $url, $current_link_attributes, $all_text ); foreach ( $wp_roles->get_names() as $this_role => $name ) { if ( $count_users && ! isset( $avail_roles[ $this_role ] ) ) { continue; } $current_link_attributes = ''; if ( $this_role === $role ) { $current_link_attributes = ' class="current" aria-current="page"'; } $name = translate_user_role( $name ); if ( $count_users ) { $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles[ $this_role ] ) ); } $role_links[ $this_role ] = "$name"; } if ( ! empty( $avail_roles['none'] ) ) { $current_link_attributes = ''; if ( 'none' === $role ) { $current_link_attributes = ' class="current" aria-current="page"'; } $name = __( 'No role' ); $name = sprintf( __( '%1$s (%2$s)' ), $name, number_format_i18n( $avail_roles['none'] ) ); $role_links['none'] = "$name"; } return $role_links; } protected function get_bulk_actions() { $actions = array(); if ( is_multisite() ) { if ( current_user_can( 'remove_users' ) ) { $actions['remove'] = __( 'Remove' ); } } else { if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); } } if ( current_user_can( 'edit_users' ) ) { $actions['resetpassword'] = __( 'Send password reset' ); } return $actions; } protected function extra_tablenav( $which ) { $id = 'bottom' === $which ? 'new_role2' : 'new_role'; $button_id = 'bottom' === $which ? 'changeit2' : 'changeit'; ?> -
          - has_items() ) : ?> - - - -
          - '', 'username' => __( 'Username' ), 'name' => __( 'Name' ), 'email' => __( 'Email' ), 'role' => __( 'Role' ), 'posts' => _x( 'Posts', 'post type general name' ), ); if ( $this->is_site_users ) { unset( $c['posts'] ); } return $c; } protected function get_sortable_columns() { $c = array( 'username' => 'login', 'email' => 'email', ); return $c; } public function display_rows() { if ( ! $this->is_site_users ) { $post_counts = count_many_users_posts( array_keys( $this->items ) ); } foreach ( $this->items as $userid => $user_object ) { echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); } } public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { if ( ! ( $user_object instanceof WP_User ) ) { $user_object = get_userdata( (int) $user_object ); } $user_object->filter = 'display'; $email = $user_object->user_email; if ( $this->is_site_users ) { $url = "site-users.php?id={$this->site_id}&"; } else { $url = 'users.php?'; } $user_roles = $this->get_role_list( $user_object ); $actions = array(); $checkbox = ''; $super_admin = ''; if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { if ( in_array( $user_object->user_login, get_super_admins(), true ) ) { $super_admin = ' — ' . __( 'Super Admin' ); } } if ( current_user_can( 'list_users' ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); if ( current_user_can( 'edit_user', $user_object->ID ) ) { $edit = "{$user_object->user_login}{$super_admin}
          "; $actions['edit'] = '' . __( 'Edit' ) . ''; } else { $edit = "{$user_object->user_login}{$super_admin}
          "; } if ( ! is_multisite() && get_current_user_id() !== $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) { $actions['delete'] = "" . __( 'Delete' ) . ''; } if ( is_multisite() && current_user_can( 'remove_user', $user_object->ID ) ) { $actions['remove'] = "" . __( 'Remove' ) . ''; } $author_posts_url = get_author_posts_url( $user_object->ID ); if ( $author_posts_url ) { $actions['view'] = sprintf( '%s', esc_url( $author_posts_url ), esc_attr( sprintf( __( 'View posts by %s' ), $user_object->display_name ) ), __( 'View' ) ); } if ( get_current_user_id() !== $user_object->ID && current_user_can( 'edit_user', $user_object->ID ) ) { $actions['resetpassword'] = "" . __( 'Send password reset' ) . ''; } $actions = apply_filters( 'user_row_actions', $actions, $user_object ); $role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) ); $checkbox = sprintf( '' . '', $user_object->ID, sprintf( __( 'Select %s' ), $user_object->user_login ), $role_classes ); } else { $edit = "{$user_object->user_login}{$super_admin}"; } $avatar = get_avatar( $user_object->ID, 32 ); $roles_list = implode( ', ', $user_roles ); $r = ""; list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $classes = "$column_name column-$column_name"; if ( $primary === $column_name ) { $classes .= ' has-row-actions column-primary'; } if ( 'posts' === $column_name ) { $classes .= ' num'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"'; $attributes = "class='$classes' $data"; if ( 'cb' === $column_name ) { $r .= "$checkbox"; } else { $r .= ""; switch ( $column_name ) { case 'username': $r .= "$avatar $edit"; break; case 'name': if ( $user_object->first_name && $user_object->last_name ) { $r .= "$user_object->first_name $user_object->last_name"; } elseif ( $user_object->first_name ) { $r .= $user_object->first_name; } elseif ( $user_object->last_name ) { $r .= $user_object->last_name; } else { $r .= sprintf( '%s', _x( 'Unknown', 'name' ) ); } break; case 'email': $r .= "$email"; break; case 'role': $r .= esc_html( $roles_list ); break; case 'posts': if ( $numposts > 0 ) { $r .= sprintf( '%s', "edit.php?author={$user_object->ID}", $numposts, sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) ); } else { $r .= 0; } break; default: $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); } if ( $primary === $column_name ) { $r .= $this->row_actions( $actions ); } $r .= ''; } } $r .= ''; return $r; } protected function get_default_primary_column_name() { return 'username'; } protected function get_role_list( $user_object ) { $wp_roles = wp_roles(); $role_list = array(); foreach ( $user_object->roles as $role ) { if ( isset( $wp_roles->role_names[ $role ] ) ) { $role_list[ $role ] = translate_user_role( $wp_roles->role_names[ $role ] ); } } if ( empty( $role_list ) ) { $role_list['none'] = _x( 'None', 'no user roles' ); } return apply_filters( 'get_role_list', $role_list, $user_object ); } } $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', ); if ( isset( $wp_registered_widget_controls[ $widget['id'] ]['id_base'] ) && isset( $widget['params'][0]['number'] ) ) { $id_base = $wp_registered_widget_controls[ $widget['id'] ]['id_base']; $args['_temp_id'] = "$id_base-__i__"; $args['_multi_num'] = next_widget_id_number( $id_base ); $args['_add'] = 'multi'; } else { $args['_add'] = 'single'; if ( $sidebar ) { $args['_hide'] = '1'; } } $control_args = array( 0 => $args, 1 => $widget['params'][0], ); $sidebar_args = wp_list_widget_controls_dynamic_sidebar( $control_args ); wp_widget_control( ...$sidebar_args ); } } function _sort_name_callback( $a, $b ) { return strnatcasecmp( $a['name'], $b['name'] ); } function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) { add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); $description = wp_sidebar_description( $sidebar ); echo '
          '; if ( $sidebar_name ) { $add_to = sprintf( __( 'Add to: %s' ), $sidebar_name ); ?> - - - - '; } function wp_list_widget_controls_dynamic_sidebar( $params ) { global $wp_registered_widgets; static $i = 0; $i++; $widget_id = $params[0]['widget_id']; $id = isset( $params[0]['_temp_id'] ) ? $params[0]['_temp_id'] : $widget_id; $hidden = isset( $params[0]['_hide'] ) ? ' style="display:none;"' : ''; $params[0]['before_widget'] = "
          "; $params[0]['after_widget'] = '
          '; $params[0]['before_title'] = '%BEG_OF_TITLE%'; $params[0]['after_title'] = '%END_OF_TITLE%'; if ( is_callable( $wp_registered_widgets[ $widget_id ]['callback'] ) ) { $wp_registered_widgets[ $widget_id ]['_callback'] = $wp_registered_widgets[ $widget_id ]['callback']; $wp_registered_widgets[ $widget_id ]['callback'] = 'wp_widget_control'; } return $params; } function next_widget_id_number( $id_base ) { global $wp_registered_widgets; $number = 1; foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( preg_match( '/' . preg_quote( $id_base, '/' ) . '-([0-9]+)$/', $widget_id, $matches ) ) { $number = max( $number, $matches[1] ); } } $number++; return $number; } function wp_widget_control( $sidebar_args ) { global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets; $widget_id = $sidebar_args['widget_id']; $sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false; $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ], true ) : '-1'; $control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array(); $widget = $wp_registered_widgets[ $widget_id ]; $id_format = $widget['id']; $widget_number = isset( $control['params'][0]['number'] ) ? $control['params'][0]['number'] : ''; $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $widget_id; $width = isset( $control['width'] ) ? $control['width'] : ''; $height = isset( $control['height'] ) ? $control['height'] : ''; $multi_number = isset( $sidebar_args['_multi_num'] ) ? $sidebar_args['_multi_num'] : ''; $add_new = isset( $sidebar_args['_add'] ) ? $sidebar_args['_add'] : ''; $before_form = isset( $sidebar_args['before_form'] ) ? $sidebar_args['before_form'] : '
          '; $after_form = isset( $sidebar_args['after_form'] ) ? $sidebar_args['after_form'] : '
          '; $before_widget_content = isset( $sidebar_args['before_widget_content'] ) ? $sidebar_args['before_widget_content'] : '
          '; $after_widget_content = isset( $sidebar_args['after_widget_content'] ) ? $sidebar_args['after_widget_content'] : '
          '; $query_arg = array( 'editwidget' => $widget['id'] ); if ( $add_new ) { $query_arg['addnew'] = 1; if ( $multi_number ) { $query_arg['num'] = $multi_number; $query_arg['base'] = $id_base; } } else { $query_arg['sidebar'] = $sidebar_id; $query_arg['key'] = $key; } if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) { $control['params'][0]['number'] = -1; if ( isset( $control['id_base'] ) ) { $id_format = $control['id_base'] . '-__i__'; } } $wp_registered_widgets[ $widget_id ]['callback'] = $wp_registered_widgets[ $widget_id ]['_callback']; unset( $wp_registered_widgets[ $widget_id ]['_callback'] ); $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); $has_form = 'noform'; echo $sidebar_args['before_widget']; ?> -
          -
          - - - - - - -
          -

          -
          - -
          - - - " . __( 'There are no options for this widget.' ) . "

          \n"; } $noform_class = ''; if ( 'noform' === $has_form ) { $noform_class = ' widget-control-noform'; } ?> - - - - - - - - - -
          -
          - - - | - -
          -
          - 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?> - -
          -
          -
          - -
          - -
          - -
          - 0 ) { return $file; } if ( defined( 'WP_IMPORTING' ) ) { return $file; } $space_left = get_upload_space_available(); $file_size = filesize( $file['tmp_name'] ); if ( $space_left < $file_size ) { $file['error'] = sprintf( __( 'Not enough space to upload. %s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) ); } if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) { $file['error'] = sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) ); } if ( upload_is_user_over_quota( false ) ) { $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); } if ( $file['error'] > 0 && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); } return $file; } function wpmu_delete_blog( $blog_id, $drop = false ) { global $wpdb; $blog_id = (int) $blog_id; $switch = false; if ( get_current_blog_id() !== $blog_id ) { $switch = true; switch_to_blog( $blog_id ); } $blog = get_site( $blog_id ); $current_network = get_network(); if ( $drop && ! $blog ) { $drop = false; } if ( $drop && ( 1 === $blog_id || is_main_site( $blog_id ) || ( $blog->path === $current_network->path && $blog->domain === $current_network->domain ) ) ) { $drop = false; } $upload_path = trim( get_option( 'upload_path' ) ); if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) { $drop = false; } if ( $drop ) { wp_delete_site( $blog_id ); } else { do_action_deprecated( 'delete_blog', array( $blog_id, false ), '5.1.0' ); $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids', ) ); if ( ! empty( $users ) ) { foreach ( $users as $user_id ) { remove_user_from_blog( $user_id, $blog_id ); } } update_blog_status( $blog_id, 'deleted', 1 ); do_action_deprecated( 'deleted_blog', array( $blog_id, false ), '5.1.0' ); } if ( $switch ) { restore_current_blog(); } } function wpmu_delete_user( $id ) { global $wpdb; if ( ! is_numeric( $id ) ) { return false; } $id = (int) $id; $user = new WP_User( $id ); if ( ! $user->exists() ) { return false; } $_super_admins = get_super_admins(); if ( in_array( $user->user_login, $_super_admins, true ) ) { return false; } do_action( 'wpmu_delete_user', $id, $user ); $blogs = get_blogs_of_user( $id ); if ( ! empty( $blogs ) ) { foreach ( $blogs as $blog ) { switch_to_blog( $blog->userblog_id ); remove_user_from_blog( $id, $blog->userblog_id ); $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); foreach ( (array) $post_ids as $post_id ) { wp_delete_post( $post_id ); } $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); if ( $link_ids ) { foreach ( $link_ids as $link_id ) { wp_delete_link( $link_id ); } } restore_current_blog(); } } $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); foreach ( $meta as $mid ) { delete_metadata_by_mid( 'user', $mid ); } $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); clean_user_cache( $user ); do_action( 'deleted_user', $id, null, $user ); return true; } function upload_is_user_over_quota( $display_message = true ) { if ( get_site_option( 'upload_space_check_disabled' ) ) { return false; } $space_allowed = get_space_allowed(); if ( ! is_numeric( $space_allowed ) ) { $space_allowed = 10; } $space_used = get_space_used(); if ( ( $space_allowed - $space_used ) < 0 ) { if ( $display_message ) { printf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( $space_allowed * MB_IN_BYTES ) ); } return true; } else { return false; } } function display_space_usage() { $space_allowed = get_space_allowed(); $space_used = get_space_used(); $percent_used = ( $space_used / $space_allowed ) * 100; $space = size_format( $space_allowed * MB_IN_BYTES ); ?> - - - - - - - - - - - - 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic', 'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue', 'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam', 'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål', 'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu', ); $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code ); return strtr( $code, $lang_codes ); } function sync_category_tag_slugs( $term, $taxonomy ) { if ( global_terms_enabled() && ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) ) { if ( is_object( $term ) ) { $term->slug = sanitize_title( $term->name ); } else { $term['slug'] = sanitize_title( $term['name'] ); } } return $term; } function _access_denied_splash() { if ( ! is_user_logged_in() || is_network_admin() ) { return; } $blogs = get_blogs_of_user( get_current_user_id() ); if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) { return; } $blog_name = get_bloginfo( 'name' ); if ( empty( $blogs ) ) { wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 ); } $output = '

          ' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '

          '; $output .= '

          ' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '

          '; $output .= '

          ' . __( 'Your Sites' ) . '

          '; $output .= ''; foreach ( $blogs as $blog ) { $output .= ''; $output .= ""; $output .= ''; $output .= ''; } $output .= '
          {$blog->blogname}' . __( 'Visit Dashboard' ) . ' | ' . '' . __( 'View Site' ) . '
          '; wp_die( $output, 403 ); } function check_import_new_users( $permission ) { if ( ! current_user_can( 'manage_network_users' ) ) { return false; } return true; } function mu_dropdown_languages( $lang_files = array(), $current = '' ) { $flag = false; $output = array(); foreach ( (array) $lang_files as $val ) { $code_lang = basename( $val, '.mo' ); if ( 'en_US' === $code_lang ) { $flag = true; $ae = __( 'American English' ); $output[ $ae ] = ''; } elseif ( 'en_GB' === $code_lang ) { $flag = true; $be = __( 'British English' ); $output[ $be ] = ''; } else { $translated = format_code_lang( $code_lang ); $output[ $translated ] = ''; } } if ( false === $flag ) { $output[] = ''; } uksort( $output, 'strnatcasecmp' ); $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current ); echo implode( "\n\t", $output ); } function site_admin_notice() { global $wp_db_version, $pagenow; if ( ! current_user_can( 'upgrade_network' ) ) { return false; } if ( 'upgrade.php' === $pagenow ) { return; } if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) { echo "
          " . sprintf( __( 'Thank you for Updating! Please visit the Upgrade Network page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . '
          '; } } function avoid_blog_page_permalink_collision( $data, $postarr ) { if ( is_subdomain_install() ) { return $data; } if ( 'page' !== $data['post_type'] ) { return $data; } if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) { return $data; } if ( ! is_main_site() ) { return $data; } if ( isset( $data['post_parent'] ) && $data['post_parent'] ) { return $data; } $post_name = $data['post_name']; $c = 0; while ( $c < 10 && get_id_from_blogname( $post_name ) ) { $post_name .= mt_rand( 1, 10 ); $c++; } if ( $post_name !== $data['post_name'] ) { $data['post_name'] = $post_name; } return $data; } function choose_primary_blog() { ?> - - - - - - - - - - -

          - - -

          - -

          - - -
          - - ID ) . '">' . $current_user->user_login . ''; ?> - - ID ) ) { wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) ); } if ( in_array( $delete_user->user_login, $site_admins, true ) ) { wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '' . $delete_user->user_login . '' ) ); } ?> - - - - '; } else { ?> - - - - - - -

          - -

          - -
          - - - array( 'label' => __( 'Info' ), 'url' => 'site-info.php', 'cap' => 'manage_sites', ), 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php', 'cap' => 'manage_sites', ), 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php', 'cap' => 'manage_sites', ), 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites', ), ) ); $parsed_args = wp_parse_args( $args, array( 'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info', ) ); $screen_links = array(); foreach ( $parsed_args['links'] as $link_id => $link ) { if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) { continue; } $classes = array( 'nav-tab' ); $aria_current = ''; if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) { $classes[] = 'nav-tab-active'; $aria_current = ' aria-current="page"'; } $esc_classes = implode( ' ', $classes ); $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) ); $screen_links[ $link_id ] = '' . esc_html( $link['label'] ) . ''; } echo ''; } function get_site_screen_help_tab_args() { return array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

          ' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '

          ' . '

          ' . __( 'Info — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '

          ' . '

          ' . __( 'Users — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '

          ' . '

          ' . sprintf( __( 'Themes — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '

          ' . '

          ' . __( 'Settings — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '

          ', ); } function get_site_screen_help_sidebar_content() { return '

          ' . __( 'For more information:' ) . '

          ' . '

          ' . __( 'Documentation on Site Management' ) . '

          ' . '

          ' . __( 'Support Forums' ) . '

          '; } post_parent !== $post->ID && $compare_from->ID !== $post->ID ) { return false; } if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) { return false; } if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) { $temp = $compare_from; $compare_from = $compare_to; $compare_to = $temp; } if ( $compare_from && empty( $compare_from->post_title ) ) { $compare_from->post_title = __( '(no title)' ); } if ( empty( $compare_to->post_title ) ) { $compare_to->post_title = __( '(no title)' ); } $return = array(); foreach ( _wp_post_revision_fields( $post ) as $field => $name ) { $content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : ''; $content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' ); $args = array( 'show_split_view' => true, 'title_left' => __( 'Removed' ), 'title_right' => __( 'Added' ), ); $args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to ); $diff = wp_text_diff( $content_from, $content_to, $args ); if ( ! $diff && 'post_title' === $field ) { $diff = ''; if ( true === $args['show_split_view'] ) { $diff .= ''; } else { $diff .= ''; if ( $compare_from->post_title !== $compare_to->post_title ) { $diff .= ''; } } $diff .= ''; $diff .= '
          ' . esc_html( $compare_from->post_title ) . '' . esc_html( $compare_to->post_title ) . '' . esc_html( $compare_from->post_title ) . '
          ' . esc_html( $compare_to->post_title ) . '
          '; } if ( $diff ) { $return[] = array( 'id' => $field, 'name' => $name, 'diff' => $diff, ); } } return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to ); } function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) { $post = get_post( $post ); $authors = array(); $now_gmt = time(); $revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false, ) ); if ( ! wp_revisions_enabled( $post ) ) { foreach ( $revisions as $revision_id => $revision ) { if ( ! wp_is_post_autosave( $revision ) ) { unset( $revisions[ $revision_id ] ); } } $revisions = array( $post->ID => $post ) + $revisions; } $show_avatars = get_option( 'show_avatars' ); cache_users( wp_list_pluck( $revisions, 'post_author' ) ); $can_restore = current_user_can( 'edit_post', $post->ID ); $current_id = false; foreach ( $revisions as $revision ) { $modified = strtotime( $revision->post_modified ); $modified_gmt = strtotime( $revision->post_modified_gmt . ' +0000' ); if ( $can_restore ) { $restore_link = str_replace( '&', '&', wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore', ), admin_url( 'revision.php' ) ), "restore-post_{$revision->ID}" ) ); } if ( ! isset( $authors[ $revision->post_author ] ) ) { $authors[ $revision->post_author ] = array( 'id' => (int) $revision->post_author, 'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '', 'name' => get_the_author_meta( 'display_name', $revision->post_author ), ); } $autosave = (bool) wp_is_post_autosave( $revision ); $current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt; if ( $current && ! empty( $current_id ) ) { if ( $current_id < $revision->ID ) { $revisions[ $current_id ]['current'] = false; $current_id = $revision->ID; } else { $current = false; } } elseif ( $current ) { $current_id = $revision->ID; } $revisions_data = array( 'id' => $revision->ID, 'title' => get_the_title( $post->ID ), 'author' => $authors[ $revision->post_author ], 'date' => date_i18n( __( 'M j, Y @ H:i' ), $modified ), 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ), 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ), 'autosave' => $autosave, 'current' => $current, 'restoreUrl' => $can_restore ? $restore_link : false, ); $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post ); } if ( 1 === count( $revisions ) ) { $revisions[ $post->ID ] = array( 'id' => $post->ID, 'title' => get_the_title( $post->ID ), 'author' => $authors[ $revision->post_author ], 'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ), 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ), 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ), 'autosave' => false, 'current' => true, 'restoreUrl' => false, ); $current_id = $post->ID; } if ( empty( $current_id ) ) { if ( $revisions[ $revision->ID ]['autosave'] ) { $revision = end( $revisions ); while ( $revision['autosave'] ) { $revision = prev( $revisions ); } $current_id = $revision['id']; } else { $current_id = $revision->ID; } $revisions[ $current_id ]['current'] = true; } $compare_two_mode = is_numeric( $from ); if ( ! $compare_two_mode ) { $found = array_search( $selected_revision_id, array_keys( $revisions ), true ); if ( $found ) { $from = array_keys( array_slice( $revisions, $found - 1, 1, true ) ); $from = reset( $from ); } else { $from = 0; } } $from = absint( $from ); $diffs = array( array( 'id' => $from . ':' . $selected_revision_id, 'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ), ), ); return array( 'postId' => $post->ID, 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), 'revisionData' => array_values( $revisions ), 'to' => $selected_revision_id, 'from' => $from, 'diffData' => $diffs, 'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ), 'compareTwoMode' => absint( $compare_two_mode ), 'revisionIds' => array_keys( $revisions ), ); } function wp_print_revision_templates() { global $post; ?> - - - - - - - - - $cat_name, 'category_parent' => $category_parent, ) ); } function wp_create_categories( $categories, $post_id = '' ) { $cat_ids = array(); foreach ( $categories as $category ) { $id = category_exists( $category ); if ( $id ) { $cat_ids[] = $id; } else { $id = wp_create_category( $category ); if ( $id ) { $cat_ids[] = $id; } } } if ( $post_id ) { wp_set_post_categories( $post_id, $cat_ids ); } return $cat_ids; } function wp_insert_category( $catarr, $wp_error = false ) { $cat_defaults = array( 'cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '', ); $catarr = wp_parse_args( $catarr, $cat_defaults ); if ( '' === trim( $catarr['cat_name'] ) ) { if ( ! $wp_error ) { return 0; } else { return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) ); } } $catarr['cat_ID'] = (int) $catarr['cat_ID']; $update = ! empty( $catarr['cat_ID'] ); $name = $catarr['cat_name']; $description = $catarr['category_description']; $slug = $catarr['category_nicename']; $parent = (int) $catarr['category_parent']; if ( $parent < 0 ) { $parent = 0; } if ( empty( $parent ) || ! term_exists( $parent, $catarr['taxonomy'] ) || ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) { $parent = 0; } $args = compact( 'name', 'slug', 'parent', 'description' ); if ( $update ) { $catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args ); } else { $catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args ); } if ( is_wp_error( $catarr['cat_ID'] ) ) { if ( $wp_error ) { return $catarr['cat_ID']; } else { return 0; } } return $catarr['cat_ID']['term_id']; } function wp_update_category( $catarr ) { $cat_ID = (int) $catarr['cat_ID']; if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) { return false; } $category = get_term( $cat_ID, 'category', ARRAY_A ); _make_cat_compat( $category ); $category = wp_slash( $category ); $catarr = array_merge( $category, $catarr ); return wp_insert_category( $catarr ); } function tag_exists( $tag_name ) { return term_exists( $tag_name, 'post_tag' ); } function wp_create_tag( $tag_name ) { return wp_create_term( $tag_name, 'post_tag' ); } function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { return get_terms_to_edit( $post_id, $taxonomy ); } function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { $post_id = (int) $post_id; if ( ! $post_id ) { return false; } $terms = get_object_term_cache( $post_id, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post_id, $taxonomy ); wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' ); } if ( ! $terms ) { return false; } if ( is_wp_error( $terms ) ) { return $terms; } $term_names = array(); foreach ( $terms as $term ) { $term_names[] = $term->name; } $terms_to_edit = esc_attr( implode( ',', $term_names ) ); $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); return $terms_to_edit; } function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) { $id = term_exists( $tag_name, $taxonomy ); if ( $id ) { return $id; } return wp_insert_term( $tag_name, $taxonomy ); } strings['up_to_date'] = __( 'The plugin is at the latest version.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['remove_old'] = __( 'Removing the old version of the plugin…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old plugin.' ); $this->strings['process_failed'] = __( 'Plugin update failed.' ); $this->strings['process_success'] = __( 'Plugin updated successfully.' ); $this->strings['process_bulk_success'] = __( 'Plugins updated successfully.' ); } public function install_strings() { $this->strings['no_package'] = __( 'Installation package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the package…' ); $this->strings['installing_package'] = __( 'Installing the plugin…' ); $this->strings['remove_old'] = __( 'Removing the current plugin…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the current plugin.' ); $this->strings['no_files'] = __( 'The plugin contains no files.' ); $this->strings['process_failed'] = __( 'Plugin installation failed.' ); $this->strings['process_success'] = __( 'Plugin installed successfully.' ); $this->strings['process_success_specific'] = __( 'Successfully installed the plugin %1$s %2$s.' ); if ( ! empty( $this->skin->overwrite ) ) { if ( 'update-plugin' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Updating the plugin…' ); $this->strings['process_failed'] = __( 'Plugin update failed.' ); $this->strings['process_success'] = __( 'Plugin updated successfully.' ); } if ( 'downgrade-plugin' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Downgrading the plugin…' ); $this->strings['process_failed'] = __( 'Plugin downgrade failed.' ); $this->strings['process_success'] = __( 'Plugin downgraded successfully.' ); } } } public function install( $package, $args = array() ) { $defaults = array( 'clear_update_cache' => true, 'overwrite_package' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->install_strings(); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); } $this->run( array( 'package' => $package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => $parsed_args['overwrite_package'], 'clear_working' => true, 'hook_extra' => array( 'type' => 'plugin', 'action' => 'install', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 ); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); if ( $parsed_args['overwrite_package'] ) { do_action( 'upgrader_overwrote_package', $package, $this->new_plugin_data, 'plugin' ); } return true; } public function upgrade( $plugin, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); $current = get_site_transient( 'update_plugins' ); if ( ! isset( $current->response[ $plugin ] ) ) { $this->skin->before(); $this->skin->set_result( false ); $this->skin->error( 'up_to_date' ); $this->skin->after(); return false; } $r = $current->response[ $plugin ]; add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 ); add_filter( 'upgrader_pre_install', array( $this, 'active_before' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); add_filter( 'upgrader_post_install', array( $this, 'active_after' ), 10, 2 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); } $this->run( array( 'package' => $r->package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array( 'plugin' => $plugin, 'type' => 'plugin', 'action' => 'update', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 ); remove_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ) ); remove_filter( 'upgrader_pre_install', array( $this, 'active_before' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) ); remove_filter( 'upgrader_post_install', array( $this, 'active_after' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $plugin ] ) ) { unset( $past_failure_emails[ $plugin ] ); update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; } public function bulk_upgrade( $plugins, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_plugins' ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); $maintenance = ( is_multisite() && ! empty( $plugins ) ); foreach ( $plugins as $plugin ) { $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin ] ) ); } if ( $maintenance ) { $this->maintenance_mode( true ); } $results = array(); $this->update_count = count( $plugins ); $this->update_current = 0; foreach ( $plugins as $plugin ) { $this->update_current++; $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true ); if ( ! isset( $current->response[ $plugin ] ) ) { $this->skin->set_result( 'up_to_date' ); $this->skin->before(); $this->skin->feedback( 'up_to_date' ); $this->skin->after(); $results[ $plugin ] = true; continue; } $r = $current->response[ $plugin ]; $this->skin->plugin_active = is_plugin_active( $plugin ); $result = $this->run( array( 'package' => $r->package, 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'plugin' => $plugin, ), ) ); $results[ $plugin ] = $result; if ( false === $result ) { break; } } $this->maintenance_mode( false ); wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true, 'plugins' => $plugins, ) ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ) ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $plugin => $result ) { if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $plugin ] ) ) { continue; } unset( $past_failure_emails[ $plugin ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } public function check_package( $source ) { global $wp_filesystem, $wp_version; $this->new_plugin_data = array(); if ( is_wp_error( $source ) ) { return $source; } $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { return $source; } $files = glob( $working_directory . '*.php' ); if ( $files ) { foreach ( $files as $file ) { $info = get_plugin_data( $file, false, false ); if ( ! empty( $info['Name'] ) ) { $this->new_plugin_data = $info; break; } } } if ( empty( $this->new_plugin_data ) ) { return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) ); } $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), phpversion(), $requires_php ); return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), $wp_version, $requires_wp ); return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); } return $source; } public function plugin_info() { if ( ! is_array( $this->result ) ) { return false; } if ( empty( $this->result['destination_name'] ) ) { return false; } $plugin = get_plugins( '/' . $this->result['destination_name'] ); if ( empty( $plugin ) ) { return false; } $pluginfiles = array_keys( $plugin ); return $this->result['destination_name'] . '/' . $pluginfiles[0]; } public function deactivate_plugin_before_upgrade( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( empty( $plugin ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } if ( is_plugin_active( $plugin ) ) { deactivate_plugins( $plugin, true ); } return $response; } public function active_before( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( ! wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( ! is_plugin_active( $plugin ) ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( true ); } return $response; } public function active_after( $response, $plugin ) { if ( is_wp_error( $response ) ) { return $response; } if ( ! wp_doing_cron() ) { return $response; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( ! is_plugin_active( $plugin ) ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( false ); } return $response; } public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) { global $wp_filesystem; if ( is_wp_error( $removed ) ) { return $removed; } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; if ( empty( $plugin ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } $plugins_dir = $wp_filesystem->wp_plugins_dir(); $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin ) ); if ( ! $wp_filesystem->exists( $this_plugin_dir ) ) { return $removed; } if ( strpos( $plugin, '/' ) && $this_plugin_dir !== $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { $deleted = $wp_filesystem->delete( $plugins_dir . $plugin ); } if ( ! $deleted ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } return true; } } $plugin_name, 'policy_text' => $policy_text, ); if ( ! in_array( $data, self::$policy_content, true ) ) { self::$policy_content[] = $data; } } public static function text_change_check() { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( empty( $policy_page_id ) ) { return false; } if ( ! current_user_can( 'edit_post', $policy_page_id ) ) { return false; } $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); if ( empty( $old ) ) { return false; } $cached = get_option( '_wp_suggested_policy_text_has_changed' ); if ( ! did_action( 'admin_init' ) ) { return 'changed' === $cached; } $new = self::$policy_content; foreach ( $old as $key => $data ) { if ( ! is_array( $data ) || ! empty( $data['removed'] ) ) { unset( $old[ $key ] ); continue; } $old[ $key ] = array( 'plugin_name' => $data['plugin_name'], 'policy_text' => $data['policy_text'], ); } sort( $old ); sort( $new ); if ( $new != $old ) { add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) ); $state = 'changed'; } else { $state = 'not-changed'; } if ( $cached !== $state ) { update_option( '_wp_suggested_policy_text_has_changed', $state ); } return 'changed' === $state; } public static function policy_text_changed_notice() { global $post; $screen = get_current_screen()->id; if ( 'privacy' !== $screen ) { return; } ?> -
          -

          - review the guide and update your privacy policy.' ), esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) ) ); ?> -

          -
          - $old_data ) { if ( ! empty( $old_data['removed'] ) ) { $update_cache = true; continue; } if ( ! empty( $old_data['updated'] ) ) { $done[] = array( 'plugin_name' => $old_data['plugin_name'], 'policy_text' => $old_data['policy_text'], 'added' => $old_data['updated'], ); $update_cache = true; } else { $done[] = $old_data; } } if ( $update_cache ) { delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); foreach ( $done as $data ) { add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data ); } } } public static function get_suggested_policy_text() { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); $checked = array(); $time = time(); $update_cache = false; $new = self::$policy_content; $old = array(); if ( $policy_page_id ) { $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); } foreach ( $new as $new_key => $new_data ) { foreach ( $old as $old_key => $old_data ) { $found = false; if ( $new_data['policy_text'] === $old_data['policy_text'] ) { if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) { $old_data['plugin_name'] = $new_data['plugin_name']; $update_cache = true; } if ( ! empty( $old_data['removed'] ) ) { unset( $old_data['removed'] ); $old_data['added'] = $time; $update_cache = true; } $checked[] = $old_data; $found = true; } elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) { $checked[] = array( 'plugin_name' => $new_data['plugin_name'], 'policy_text' => $new_data['policy_text'], 'updated' => $time, ); $found = true; $update_cache = true; } if ( $found ) { unset( $new[ $new_key ], $old[ $old_key ] ); continue 2; } } } if ( ! empty( $new ) ) { foreach ( $new as $new_data ) { if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) { $new_data['added'] = $time; $checked[] = $new_data; } } $update_cache = true; } if ( ! empty( $old ) ) { foreach ( $old as $old_data ) { if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) { $data = array( 'plugin_name' => $old_data['plugin_name'], 'policy_text' => $old_data['policy_text'], 'removed' => $time, ); $checked[] = $data; } } $update_cache = true; } if ( $update_cache && $policy_page_id ) { delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' ); foreach ( $checked as $data ) { add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data ); } } return $checked; } public static function notice( $post = null ) { if ( is_null( $post ) ) { global $post; } else { $post = get_post( $post ); } if ( ! ( $post instanceof WP_Post ) ) { return; } if ( ! current_user_can( 'manage_privacy_options' ) ) { return; } $current_screen = get_current_screen(); $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) { return; } $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' ); $url = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); $label = __( 'View Privacy Policy Guide.' ); if ( get_current_screen()->is_block_editor() ) { wp_enqueue_script( 'wp-notices' ); $action = array( 'url' => $url, 'label' => $label, ); wp_add_inline_script( 'wp-notices', sprintf( 'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )', $message, wp_json_encode( $action ) ), 'after' ); } else { ?> -
          -

          - %s %s', $url, $label, __( '(opens in a new tab)' ) ); ?> -

          -
          -

          ' . sprintf( $removed, $date ) . '

          '; } elseif ( ! empty( $section['updated'] ) ) { $badge_class = ' blue'; $date = date_i18n( $date_format, $section['updated'] ); $badge_title = sprintf( __( 'Updated %s.' ), $date ); } $plugin_name = esc_html( $section['plugin_name'] ); $sanitized_policy_name = sanitize_title_with_dashes( $plugin_name ); ?> -

          - -

          - - ' . __( 'Suggested text:' ) . ' '; $content = ''; $strings = array(); if ( $description ) { $strings[] = '
          '; } $strings[] = '

          ' . __( 'Who we are' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '

          '; $strings[] = '

          ' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'What personal data we collect and why we collect it' ) . '

          '; $strings[] = '

          ' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '

          '; $strings[] = '

          ' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '

          '; $strings[] = '

          ' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '

          '; $strings[] = '

          ' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '

          '; $strings[] = '

          ' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '

          '; } $strings[] = '

          ' . __( 'Comments' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '

          '; $strings[] = '

          ' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '

          '; } $strings[] = '

          ' . __( 'Media' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'Contact forms' ) . '

          '; $strings[] = '

          ' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '

          '; } $strings[] = '

          ' . __( 'Cookies' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '

          '; $strings[] = '

          ' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '

          '; $strings[] = '

          ' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '

          '; $strings[] = '

          ' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '

          '; } if ( ! $description ) { $strings[] = '

          ' . __( 'Embedded content from other websites' ) . '

          '; $strings[] = '

          ' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '

          '; $strings[] = '

          ' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'Analytics' ) . '

          '; $strings[] = '

          ' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider’s privacy policy, if any.' ) . '

          '; $strings[] = '

          ' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '

          '; } $strings[] = '

          ' . __( 'Who we share your data with' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '

          '; $strings[] = '

          ' . __( 'By default WordPress does not share any personal data with anyone.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '

          '; } $strings[] = '

          ' . __( 'How long we retain your data' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '

          '; $strings[] = '

          ' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '

          '; } $strings[] = '

          ' . __( 'What rights you have over your data' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '

          '; } $strings[] = '

          ' . __( 'Where your data is sent' ) . '

          '; if ( $description ) { $strings[] = '

          ' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '

          '; $strings[] = '

          ' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '

          '; } else { $strings[] = '

          ' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'Contact information' ) . '

          '; $strings[] = '

          ' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'Additional information' ) . '

          '; $strings[] = '

          ' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'How we protect your data' ) . '

          '; $strings[] = '

          ' . __( 'In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'What data breach procedures we have in place' ) . '

          '; $strings[] = '

          ' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'What third parties we receive data from' ) . '

          '; $strings[] = '

          ' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'What automated decision making and/or profiling we do with user data' ) . '

          '; $strings[] = '

          ' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '

          '; } if ( $description ) { $strings[] = '

          ' . __( 'Industry regulatory disclosure requirements' ) . '

          '; $strings[] = '

          ' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '

          '; $strings[] = '
          '; } if ( $blocks ) { foreach ( $strings as $key => $string ) { if ( 0 === strpos( $string, '

          ' ) ) { $strings[ $key ] = '' . $string . ''; } if ( 0 === strpos( $string, '

          ' ) ) { $strings[ $key ] = '' . $string . ''; } } } $content = implode( '', $strings ); return apply_filters_deprecated( 'wp_get_default_privacy_policy_content', array( $content, $strings, $description, $blocks ), '5.7.0', 'wp_add_privacy_policy_content()' ); } public static function add_suggested_content() { $content = self::get_default_content( false, false ); wp_add_privacy_policy_content( __( 'WordPress' ), $content ); } } upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' ); } public function before( $title = '' ) { parent::before( $this->plugin_info['Title'] ); } public function after( $title = '' ) { parent::after( $this->plugin_info['Title'] ); $this->decrement_update_count( 'plugin' ); } public function bulk_footer() { parent::bulk_footer(); $update_actions = array( 'plugins_page' => sprintf( '%s', self_admin_url( 'plugins.php' ), __( 'Go to Plugins page' ) ), 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), __( 'Go to WordPress Updates page' ) ), ); if ( ! current_user_can( 'activate_plugins' ) ) { unset( $update_actions['plugins_page'] ); } $update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } 'latest' ); } return $updates[0]; } function get_core_updates( $options = array() ) { $options = array_merge( array( 'available' => true, 'dismissed' => false, ), $options ); $dismissed = get_site_option( 'dismissed_update_core' ); if ( ! is_array( $dismissed ) ) { $dismissed = array(); } $from_api = get_site_transient( 'update_core' ); if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { return false; } $updates = $from_api->updates; $result = array(); foreach ( $updates as $update ) { if ( 'autoupdate' === $update->response ) { continue; } if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) { if ( $options['dismissed'] ) { $update->dismissed = true; $result[] = $update; } } else { if ( $options['available'] ) { $update->dismissed = false; $result[] = $update; } } } return $result; } function find_core_auto_update() { $updates = get_site_transient( 'update_core' ); if ( ! $updates || empty( $updates->updates ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $auto_update = false; $upgrader = new WP_Automatic_Updater; foreach ( $updates->updates as $update ) { if ( 'autoupdate' !== $update->response ) { continue; } if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) { continue; } if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) { $auto_update = $update; } } return $auto_update; } function get_core_checksums( $version, $locale ) { $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' ); $url = $http_url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $options = array( 'timeout' => wp_doing_cron() ? 30 : 3, ); $response = wp_remote_get( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $response = wp_remote_get( $http_url, $options ); } if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { return false; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) { return false; } return $body['checksums']; } function dismiss_core_update( $update ) { $dismissed = get_site_option( 'dismissed_update_core' ); $dismissed[ $update->current . '|' . $update->locale ] = true; return update_site_option( 'dismissed_update_core', $dismissed ); } function undismiss_core_update( $version, $locale ) { $dismissed = get_site_option( 'dismissed_update_core' ); $key = $version . '|' . $locale; if ( ! isset( $dismissed[ $key ] ) ) { return false; } unset( $dismissed[ $key ] ); return update_site_option( 'dismissed_update_core', $dismissed ); } function find_core_update( $version, $locale ) { $from_api = get_site_transient( 'update_core' ); if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { return false; } $updates = $from_api->updates; foreach ( $updates as $update ) { if ( $update->current == $version && $update->locale == $locale ) { return $update; } } return false; } function core_update_footer( $msg = '' ) { if ( ! current_user_can( 'update_core' ) ) { return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); } $cur = get_preferred_from_update_core(); if ( ! is_object( $cur ) ) { $cur = new stdClass; } if ( ! isset( $cur->current ) ) { $cur->current = ''; } if ( ! isset( $cur->response ) ) { $cur->response = ''; } require ABSPATH . WPINC . '/version.php'; $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); if ( $is_development_version ) { return sprintf( __( 'You are using a development version (%1$s). Cool! Please stay updated.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) ); } switch ( $cur->response ) { case 'upgrade': return sprintf( '%s', network_admin_url( 'update-core.php' ), sprintf( __( 'Get Version %s' ), $cur->current ) ); case 'latest': default: return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); } } function update_nag() { global $pagenow; if ( is_multisite() && ! current_user_can( 'update_core' ) ) { return false; } if ( 'update-core.php' === $pagenow ) { return; } $cur = get_preferred_from_update_core(); if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) { return false; } $version_url = sprintf( esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), sanitize_title( $cur->current ) ); if ( current_user_can( 'update_core' ) ) { $msg = sprintf( __( 'WordPress %2$s is available! Please update now.' ), $version_url, $cur->current, network_admin_url( 'update-core.php' ), esc_attr__( 'Please update WordPress now' ) ); } else { $msg = sprintf( __( 'WordPress %2$s is available! Please notify the site administrator.' ), $version_url, $cur->current ); } echo "
          $msg
          "; } function update_right_now_message() { $theme_name = wp_get_theme(); if ( current_user_can( 'switch_themes' ) ) { $theme_name = sprintf( '%1$s', $theme_name ); } $msg = ''; if ( current_user_can( 'update_core' ) ) { $cur = get_preferred_from_update_core(); if ( isset( $cur->response ) && 'upgrade' === $cur->response ) { $msg .= sprintf( '%s ', network_admin_url( 'update-core.php' ), sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) ); } } $content = __( 'WordPress %1$s running %2$s theme.' ); $content = apply_filters( 'update_right_now_text', $content ); $msg .= sprintf( '' . $content . '', get_bloginfo( 'version', 'display' ), $theme_name ); echo "

          $msg

          "; } function get_plugin_updates() { $all_plugins = get_plugins(); $upgrade_plugins = array(); $current = get_site_transient( 'update_plugins' ); foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) { if ( isset( $current->response[ $plugin_file ] ) ) { $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; } } return $upgrade_plugins; } function wp_plugin_update_rows() { if ( ! current_user_can( 'update_plugins' ) ) { return; } $plugins = get_site_transient( 'update_plugins' ); if ( isset( $plugins->response ) && is_array( $plugins->response ) ) { $plugins = array_keys( $plugins->response ); foreach ( $plugins as $plugin_file ) { add_action( "after_plugin_row_{$plugin_file}", 'wp_plugin_update_row', 10, 2 ); } } } function wp_plugin_update_row( $file, $plugin_data ) { $current = get_site_transient( 'update_plugins' ); if ( ! isset( $current->response[ $file ] ) ) { return false; } $response = $current->response[ $file ]; $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'em' => array(), 'strong' => array(), ); $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags ); $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id; if ( isset( $response->slug ) ) { $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '§ion=changelog' ); } elseif ( isset( $response->url ) ) { $details_url = $response->url; } else { $details_url = $plugin_data['PluginURI']; } $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 600, 'height' => 800, ), $details_url ); $wp_list_table = _get_list_table( 'WP_Plugins_List_Table', array( 'screen' => get_current_screen(), ) ); if ( is_network_admin() || ! is_multisite() ) { if ( is_network_admin() ) { $active_class = is_plugin_active_for_network( $file ) ? ' active' : ''; } else { $active_class = is_plugin_active( $file ) ? ' active' : ''; } $requires_php = isset( $response->requires_php ) ? $response->requires_php : null; $compatible_php = is_php_version_compatible( $requires_php ); $notice_type = $compatible_php ? 'notice-warning' : 'notice-error'; printf( '' . '' . '

          ', $active_class, esc_attr( $plugin_slug . '-update' ), esc_attr( $plugin_slug ), esc_attr( $file ), esc_attr( $wp_list_table->get_column_count() ), $notice_type ); if ( ! current_user_can( 'update_plugins' ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ) ); } elseif ( empty( $response->package ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this plugin.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ) ); } else { if ( $compatible_php ) { printf( __( 'There is a new version of %1$s available. View version %4$s details or update now.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ), wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ), sprintf( 'class="update-link" aria-label="%s"', esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) ) ) ); } else { printf( __( 'There is a new version of %1$s available, but it does not work with your version of PHP. View version %4$s details or learn more about updating PHP.' ), $plugin_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) ), esc_attr( $response->new_version ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '
          ', '' ); } } do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); echo '

          '; } } function get_theme_updates() { $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response ) ) { return array(); } $update_themes = array(); foreach ( $current->response as $stylesheet => $data ) { $update_themes[ $stylesheet ] = wp_get_theme( $stylesheet ); $update_themes[ $stylesheet ]->update = $data; } return $update_themes; } function wp_theme_update_rows() { if ( ! current_user_can( 'update_themes' ) ) { return; } $themes = get_site_transient( 'update_themes' ); if ( isset( $themes->response ) && is_array( $themes->response ) ) { $themes = array_keys( $themes->response ); foreach ( $themes as $theme ) { add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 ); } } } function wp_theme_update_row( $theme_key, $theme ) { $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme_key ] ) ) { return false; } $response = $current->response[ $theme_key ]; $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $current->response[ $theme_key ]['url'] ); $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); $active = $theme->is_allowed( 'network' ) ? ' active' : ''; $requires_wp = isset( $response['requires'] ) ? $response['requires'] : null; $requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null; $compatible_wp = is_wp_version_compatible( $requires_wp ); $compatible_php = is_php_version_compatible( $requires_php ); printf( '' . '' . '

          ', $active, esc_attr( $theme->get_stylesheet() . '-update' ), esc_attr( $theme->get_stylesheet() ), $wp_list_table->get_column_count() ); if ( $compatible_wp && $compatible_php ) { if ( ! current_user_can( 'update_themes' ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } elseif ( empty( $response['package'] ) ) { printf( __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'] ); } else { printf( __( 'There is a new version of %1$s available. View version %4$s details or update now.' ), $theme['Name'], esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) ), $response['new_version'], wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ), sprintf( 'class="update-link" aria-label="%s"', esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) ) ) ); } } else { if ( ! $compatible_wp && ! $compatible_php ) { printf( __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), $theme['Name'] ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

          ', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

          ', '' ); } } elseif ( ! $compatible_wp ) { printf( __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), $theme['Name'] ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { printf( __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), $theme['Name'] ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

          ', '' ); } } } do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); echo '

          '; } function maintenance_nag() { require ABSPATH . WPINC . '/version.php'; global $upgrading; $nag = isset( $upgrading ); if ( ! $nag ) { $failed = get_site_option( 'auto_core_update_failed' ); $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) { $nag = true; } } if ( ! $nag ) { return false; } if ( current_user_can( 'update_core' ) ) { $msg = sprintf( __( 'An automated WordPress update has failed to complete - please attempt the update again now.' ), 'update-core.php' ); } else { $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' ); } echo "
          $msg
          "; } function wp_print_admin_notice_templates() { ?> - - - - - - -
          -

          - Exit Recovery Mode' ), esc_url( $url ) ); ?> -

          -
          - is_disabled(); switch ( $type ) { case 'plugin': return apply_filters( 'plugins_auto_update_enabled', $enabled ); case 'theme': return apply_filters( 'themes_auto_update_enabled', $enabled ); } return false; } function wp_is_auto_update_forced_for_item( $type, $update, $item ) { return apply_filters( "auto_update_{$type}", $update, $item ); } function wp_get_auto_update_message() { $next_update_time = wp_next_scheduled( 'wp_version_check' ); if ( false === $next_update_time ) { $message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' ); } else { $time_to_next_update = human_time_diff( (int) $next_update_time ); $overdue = ( time() - $next_update_time ) > 0; if ( $overdue ) { $message = sprintf( __( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ), $time_to_next_update ); } else { $message = sprintf( __( 'Automatic update scheduled in %s.' ), $time_to_next_update ); } } return $message; } features = $_REQUEST['features']; } $paged = $this->get_pagenum(); $per_page = 36; $tabs = array(); $tabs['dashboard'] = __( 'Search' ); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } $tabs['upload'] = __( 'Upload' ); $tabs['featured'] = _x( 'Featured', 'themes' ); $tabs['new'] = _x( 'Latest', 'themes' ); $tabs['updated'] = _x( 'Recently Updated', 'themes' ); $nonmenu_tabs = array( 'theme-information' ); $tabs = apply_filters( 'install_themes_tabs', $tabs ); $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults, ); switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; switch ( $type ) { case 'tag': $args['tag'] = array_map( 'sanitize_key', $search_terms ); break; case 'term': $args['search'] = $search_string; break; case 'author': $args['author'] = $search_string; break; } if ( ! empty( $this->features ) ) { $args['tag'] = $this->features; $_REQUEST['s'] = implode( ',', $this->features ); $_REQUEST['type'] = 'tag'; } add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); break; case 'featured': case 'new': case 'updated': $args['browse'] = $tab; break; default: $args = false; break; } $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); if ( ! $args ) { return; } $api = themes_api( 'query_themes', $args ); if ( is_wp_error( $api ) ) { wp_die( '

          ' . $api->get_error_message() . '

          ' . __( 'Try Again' ) . '

          ' ); } $this->items = $api->themes; $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $args['per_page'], 'infinite_scroll' => true, ) ); } public function no_items() { _e( 'No themes match your request.' ); } protected function get_views() { global $tabs, $tab; $display_tabs = array(); foreach ( (array) $tabs as $action => $text ) { $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; $href = self_admin_url( 'theme-install.php?tab=' . $action ); $display_tabs[ 'theme-install-' . $action ] = "$text"; } return $display_tabs; } public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); ?> -
          -
          - -
          - pagination( 'top' ); ?> -
          -
          - -
          - display_rows_or_placeholder(); ?> -
          - - tablenav( 'bottom' ); } public function display_rows() { $themes = $this->items; foreach ( $themes as $theme ) { ?> -
          - single_row( $theme ); ?> -
          - theme_installer(); } public function single_row( $theme ) { global $themes_allowedtags; if ( empty( $theme ) ) { return; } $name = wp_kses( $theme->name, $themes_allowedtags ); $author = wp_kses( $theme->author, $themes_allowedtags ); $preview_title = sprintf( __( 'Preview “%s”' ), $name ); $preview_url = add_query_arg( array( 'tab' => 'theme-information', 'theme' => $theme->slug, ), self_admin_url( 'theme-install.php' ) ); $actions = array(); $install_url = add_query_arg( array( 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $update_url = add_query_arg( array( 'action' => 'upgrade-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $status = $this->_get_theme_status( $theme ); switch ( $status ) { case 'update_available': $actions[] = sprintf( '%s', esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), __( 'Update' ) ); break; case 'newer_installed': case 'latest_installed': $actions[] = sprintf( '%s', esc_attr__( 'This theme is already installed and is up to date' ), _x( 'Installed', 'theme' ) ); break; case 'install': default: $actions[] = sprintf( '%s', esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), __( 'Install Now' ) ); break; } $actions[] = sprintf( '%s', esc_url( $preview_url ), esc_attr( sprintf( __( 'Preview %s' ), $name ) ), __( 'Preview' ) ); $actions = apply_filters( 'theme_install_actions', $actions, $theme ); ?> - - - - -

          -
          - -
          - - - - install_theme_info( $theme ); } public function theme_installer() { ?> -
          -
          -
          - - -
          -
          -
          -
          - -
          -
          -
          - -
          -
          - install_theme_info( $theme ); ?> -
          -
          - -
          -
          - name, $themes_allowedtags ); $author = wp_kses( $theme->author, $themes_allowedtags ); $install_url = add_query_arg( array( 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $update_url = add_query_arg( array( 'action' => 'upgrade-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); $status = $this->_get_theme_status( $theme ); ?> -
          - %s', esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), __( 'Update' ) ); break; case 'newer_installed': case 'latest_installed': printf( '%s', esc_attr__( 'This theme is already installed and is up to date' ), _x( 'Installed', 'theme' ) ); break; case 'install': default: printf( '%s', esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), __( 'Install' ) ); break; } ?> -

          - - - - screenshot_url ) ) : ?> - - -
          - $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, ) ); ?> -
          - - version, $themes_allowedtags ); ?> -
          -
          - description, $themes_allowedtags ); ?> -
          -
          - -
          - slug ); if ( $installed_theme->exists() ) { if ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '=' ) ) { $status = 'latest_installed'; } elseif ( version_compare( $installed_theme->get( 'Version' ), $theme->version, '>' ) ) { $status = 'newer_installed'; } else { $status = 'update_available'; } } return $status; } } cap->create_posts ) ) { $quick_draft_title = sprintf( '%1$s %2$s', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) ); wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); } wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); if ( is_network_admin() ) { do_action( 'wp_network_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); } elseif ( is_user_admin() ) { do_action( 'wp_user_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() ); } else { do_action( 'wp_dashboard_setup' ); $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); } foreach ( $dashboard_widgets as $widget_id ) { $name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " " . __( 'View all' ) . ''; wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] ); } if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) { check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); ob_start(); wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); ob_end_clean(); wp_redirect( remove_query_arg( 'edit' ) ); exit; } do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); do_action( 'do_meta_boxes', $screen->id, 'side', '' ); } function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) { global $wp_dashboard_control_callbacks; $screen = get_current_screen(); $private_callback_args = array( '__widget_basename' => $widget_name ); if ( is_null( $callback_args ) ) { $callback_args = $private_callback_args; } elseif ( is_array( $callback_args ) ) { $callback_args = array_merge( $callback_args, $private_callback_args ); } if ( $control_callback && is_callable( $control_callback ) && current_user_can( 'edit_dashboard' ) ) { $wp_dashboard_control_callbacks[ $widget_id ] = $control_callback; if ( isset( $_GET['edit'] ) && $widget_id === $_GET['edit'] ) { list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); $widget_name .= ' ' . __( 'Cancel' ) . ''; $callback = '_wp_dashboard_control_callback'; } else { list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); $widget_name .= ' ' . __( 'Configure' ) . ''; } } $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); if ( in_array( $widget_id, $side_widgets, true ) ) { $context = 'side'; } $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' ); if ( in_array( $widget_id, $high_priority_widgets, true ) ) { $priority = 'high'; } if ( empty( $context ) ) { $context = 'normal'; } if ( empty( $priority ) ) { $priority = 'core'; } add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args ); } function _wp_dashboard_control_callback( $dashboard, $meta_box ) { echo '
          '; wp_dashboard_trigger_widget_control( $meta_box['id'] ); wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); echo ''; submit_button( __( 'Save Changes' ) ); echo '
          '; } function wp_dashboard() { $screen = get_current_screen(); $columns = absint( $screen->get_columns() ); $columns_css = ''; if ( $columns ) { $columns_css = " columns-$columns"; } ?> -
          -
          - id, 'normal', '' ); ?> -
          -
          - id, 'side', '' ); ?> -
          -
          - id, 'column3', '' ); ?> -
          -
          - id, 'column4', '' ); ?> -
          -
          - - -
          -
            - publish ) { if ( 'post' === $post_type ) { $text = _n( '%s Post', '%s Posts', $num_posts->publish ); } else { $text = _n( '%s Page', '%s Pages', $num_posts->publish ); } $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { printf( '
          • %2$s
          • ', $post_type, $text ); } else { printf( '
          • %2$s
          • ', $post_type, $text ); } } } $num_comm = wp_count_comments(); if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); ?> -
          • - -
          • - moderated ); $text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n ); ?> -
          • - -
          • - ' . implode( "\n
          • ", $elements ) . "
          • \n"; } ?> -
          - $content

          "; } ?> -
          - -
          - -
          - ' . __( 'Create a New Site' ) . ''; } if ( current_user_can( 'create_users' ) ) { $actions['create-user'] = '' . __( 'Create a New User' ) . ''; } $c_users = get_user_count(); $c_blogs = get_blog_count(); $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); if ( $actions ) { echo '
            '; foreach ( $actions as $class => $action ) { $actions[ $class ] = "\t
          • $action"; } echo implode( " |
          • \n", $actions ) . "\n"; echo '
          '; } ?> -
          - -

          - - - - -
          -

          - - - 'submit_users' ) ); ?> -

          -
          - -
          -

          - - - 'submit_sites' ) ); ?> -

          -
          - post_status ) { $post = get_default_post_to_edit( 'post', true ); update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); } else { $post->post_title = ''; } } else { $post = get_default_post_to_edit( 'post', true ); $user_id = get_current_user_id(); if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) { update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); } } $post_ID = (int) $post->ID; ?> - -
          - - -
          - - -
          - - -
          - -
          - - -
          - -

          - - - - - 'save-post' ) ); ?> -
          -

          - -
          - 'post', 'post_status' => 'draft', 'author' => get_current_user_id(), 'posts_per_page' => 4, 'orderby' => 'modified', 'order' => 'DESC', ); $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); $drafts = get_posts( $query_args ); if ( ! $drafts ) { return; } } echo '
          '; if ( count( $drafts ) > 3 ) { printf( '

          %s

          ' . "\n", esc_url( admin_url( 'edit.php?post_status=draft' ) ), __( 'View all drafts' ) ); } echo '

          ' . __( 'Your Recent Drafts' ) . "

          \n"; echo '
            '; $draft_length = (int) _x( '10', 'draft_length' ); $drafts = array_slice( $drafts, 0, 3 ); foreach ( $drafts as $draft ) { $url = get_edit_post_link( $draft->ID ); $title = _draft_or_post_title( $draft->ID ); echo "
          • \n"; printf( '
            %s
            ', esc_url( $url ), esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), esc_html( $title ), get_the_time( 'c', $draft ), get_the_time( __( 'F j, Y' ), $draft ) ); $the_content = wp_trim_words( $draft->post_content, $draft_length ); if ( $the_content ) { echo '

            ' . $the_content . '

            '; } echo "
          • \n"; } echo "
          \n"; echo '
          '; } function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $GLOBALS['comment'] = clone $comment; if ( $comment->comment_post_ID > 0 ) { $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = '' . $comment_post_title . ''; } else { $comment_post_link = ''; } $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'edit' => '', 'spam' => '', 'trash' => '', 'delete' => '', 'view' => '', ); $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); $actions['approve'] = sprintf( '%s', $approve_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '%s', $unapprove_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); $actions['edit'] = sprintf( '%s', "comment.php?action=editcomment&c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $actions['reply'] = sprintf( '', $comment->comment_ID, $comment->comment_post_ID, esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); $actions['spam'] = sprintf( '%s', $spam_url, "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), _x( 'Spam', 'verb' ) ); if ( ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', $delete_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Delete this comment permanently' ), __( 'Delete Permanently' ) ); } else { $actions['trash'] = sprintf( '%s', $trash_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Move this comment to the Trash' ), _x( 'Trash', 'verb' ) ); } $actions['view'] = sprintf( '%s', esc_url( get_comment_link( $comment ) ), esc_attr__( 'View this comment' ), __( 'View' ) ); $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { $sep = ''; } else { $sep = ' | '; } if ( 'reply' === $action || 'quickedit' === $action ) { $action .= ' hide-if-no-js'; } if ( 'view' === $action && '1' !== $comment->comment_approved ) { $action .= ' hidden'; } $actions_string .= "$sep$link"; } } ?> - -
        • > - - - - comment_type || 'comment' === $comment->comment_type ) : ?> - -
          -

          - ' . get_comment_author_link( $comment ) . '', $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( __( 'From %1$s %2$s' ), '' . get_comment_author_link( $comment ) . '', '' . __( '[Pending]' ) . '' ); } ?> -

          - - comment_type ) { case 'pingback': $type = __( 'Pingback' ); break; case 'trackback': $type = __( 'Trackback' ); break; default: $type = ucwords( $comment->comment_type ); } $type = esc_html( $type ); ?> -
          -

          - $type", $comment_post_link, '' . __( '[Pending]' ) . '' ); } else { printf( _x( '%1$s %2$s', 'dashboard' ), "$type", '' . __( '[Pending]' ) . '' ); } ?> -

          -

          - - -

          - -

          - -
          -
        • - '; $future_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'future', 'order' => 'ASC', 'title' => __( 'Publishing Soon' ), 'id' => 'future-posts', ) ); $recent_posts = wp_dashboard_recent_posts( array( 'max' => 5, 'status' => 'publish', 'order' => 'DESC', 'title' => __( 'Recently Published' ), 'id' => 'published-posts', ) ); $recent_comments = wp_dashboard_recent_comments(); if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) { echo '
          '; echo '

          ' . __( 'No activity yet!' ) . '

          '; echo '
          '; } echo '
          '; } function wp_dashboard_recent_posts( $args ) { $query_args = array( 'post_type' => 'post', 'post_status' => $args['status'], 'orderby' => 'date', 'order' => $args['order'], 'posts_per_page' => (int) $args['max'], 'no_found_rows' => true, 'cache_results' => false, 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable', ); $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args ); $posts = new WP_Query( $query_args ); if ( $posts->have_posts() ) { echo '
          '; echo '

          ' . $args['title'] . '

          '; echo '
            '; $today = current_time( 'Y-m-d' ); $tomorrow = current_datetime()->modify( '+1 day' )->format( 'Y-m-d' ); $year = current_time( 'Y' ); while ( $posts->have_posts() ) { $posts->the_post(); $time = get_the_time( 'U' ); if ( gmdate( 'Y-m-d', $time ) === $today ) { $relative = __( 'Today' ); } elseif ( gmdate( 'Y-m-d', $time ) === $tomorrow ) { $relative = __( 'Tomorrow' ); } elseif ( gmdate( 'Y', $time ) !== $year ) { $relative = date_i18n( __( 'M jS Y' ), $time ); } else { $relative = date_i18n( __( 'M jS' ), $time ); } $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink(); $draft_or_post_title = _draft_or_post_title(); printf( '
          • %1$s %4$s
          • ', sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ), $recent_post_link, esc_attr( sprintf( __( 'Edit “%s”' ), $draft_or_post_title ) ), $draft_or_post_title ); } echo '
          '; echo '
          '; } else { return false; } wp_reset_postdata(); return true; } function wp_dashboard_recent_comments( $total_items = 5 ) { $comments = array(); $comments_query = array( 'number' => $total_items * 5, 'offset' => 0, ); if ( ! current_user_can( 'edit_posts' ) ) { $comments_query['status'] = 'approve'; } while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { if ( ! is_array( $possible ) ) { break; } foreach ( $possible as $comment ) { if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) { continue; } $comments[] = $comment; if ( count( $comments ) === $total_items ) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; } if ( $comments ) { echo '
          '; echo '

          ' . __( 'Recent Comments' ) . '

          '; echo '
            '; foreach ( $comments as $comment ) { _wp_dashboard_recent_comments_row( $comment ); } echo '
          '; if ( current_user_can( 'edit_posts' ) ) { echo '

          ' . __( 'View more comments' ) . '

          '; _get_list_table( 'WP_Comments_List_Table' )->views(); } wp_comment_reply( -1, false, 'dashboard', false ); wp_comment_trashnotice(); echo '
          '; } else { return false; } return true; } function wp_dashboard_rss_output( $widget_id ) { $widgets = get_option( 'dashboard_widget_options' ); echo '
          '; wp_widget_rss_output( $widgets[ $widget_id ] ); echo '
          '; } function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) { $loading = '

          ' . __( 'Loading…' ) . '

          ' . __( 'This widget requires JavaScript.' ) . '

          '; $doing_ajax = wp_doing_ajax(); if ( empty( $check_urls ) ) { $widgets = get_option( 'dashboard_widget_options' ); if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) { echo $loading; return false; } $check_urls = array( $widgets[ $widget_id ]['url'] ); } $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); $output = get_transient( $cache_key ); if ( false !== $output ) { echo $output; return true; } if ( ! $doing_ajax ) { echo $loading; return false; } if ( $callback && is_callable( $callback ) ) { array_unshift( $args, $widget_id, $check_urls ); ob_start(); call_user_func_array( $callback, $args ); set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); } return true; } function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { global $wp_dashboard_control_callbacks; if ( is_scalar( $widget_control_id ) && $widget_control_id && isset( $wp_dashboard_control_callbacks[ $widget_control_id ] ) && is_callable( $wp_dashboard_control_callbacks[ $widget_control_id ] ) ) { call_user_func( $wp_dashboard_control_callbacks[ $widget_control_id ], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[ $widget_control_id ], ) ); } } function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { $widget_options = get_option( 'dashboard_widget_options' ); if ( ! $widget_options ) { $widget_options = array(); } if ( ! isset( $widget_options[ $widget_id ] ) ) { $widget_options[ $widget_id ] = array(); } $number = 1; $widget_options[ $widget_id ]['number'] = $number; if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) { $_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] ); $widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] ); $widget_options[ $widget_id ]['number'] = $number; if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) { $rss = fetch_feed( $widget_options[ $widget_id ]['url'] ); if ( is_wp_error( $rss ) ) { $widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) ); } else { $widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) ); $rss->__destruct(); unset( $rss ); } } update_option( 'dashboard_widget_options', $widget_options ); $locale = get_user_locale(); $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); delete_transient( $cache_key ); } wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs ); } function wp_dashboard_events_news() { wp_print_community_events_markup(); ?> - -
          - -
          - - - - - -
          -

          - -

          - - - - -
          - -
          - -
          - - - - - - - - - - - - - - array( 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), 'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ), 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), 'items' => 2, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, ), 'planet' => array( 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), 'items' => apply_filters( 'dashboard_secondary_items', 3 ), 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, ), ); wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); } function wp_dashboard_primary_output( $widget_id, $feeds ) { foreach ( $feeds as $type => $args ) { $args['type'] = $type; echo '
          '; wp_widget_rss_output( $args['url'], $args ); echo '
          '; } } function wp_dashboard_quota() { if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { return true; } $quota = get_space_allowed(); $used = get_space_used(); if ( $used > $quota ) { $percentused = '100'; } else { $percentused = ( $used / $quota ) * 100; } $used_class = ( $percentused >= 70 ) ? ' warning' : ''; $used = round( $used, 2 ); $percentused = number_format( $percentused ); ?> -

          -
          -
            -
          • - %2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), $text, __( 'Manage Uploads' ) ); ?> -
          • - %2$s (%3$s)', esc_url( admin_url( 'upload.php' ) ), $text, __( 'Manage Uploads' ) ); ?> -
          • -
          -
          - %s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } else { $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), sprintf( '%s', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) ); } $browser_nag_class = ''; if ( ! empty( $response['img_src'] ) ) { $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) ) ? $response['img_src_ssl'] : $response['img_src']; $notice .= '
          '; $browser_nag_class = ' has-browser-icon'; } $notice .= "

          {$msg}

          "; $browsehappy = 'https://browsehappy.com/'; $locale = get_user_locale(); if ( 'en_US' !== $locale ) { $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); } if ( $is_IE ) { $msg_browsehappy = sprintf( __( 'Learn how to browse happy' ), esc_url( $browsehappy ) ); } else { $msg_browsehappy = sprintf( __( 'Update %2$s or learn how to browse happy' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ); } $notice .= '

          ' . $msg_browsehappy . '

          '; $notice .= '

          ' . __( 'Dismiss' ) . '

          '; $notice .= '
          '; } echo apply_filters( 'browse-happy-notice', $notice, $response ); } function dashboard_browser_nag_class( $classes ) { $response = wp_check_browser_version(); if ( $response && $response['insecure'] ) { $classes[] = 'browser-insecure'; } return $classes; } function wp_check_browser_version() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } $key = md5( $_SERVER['HTTP_USER_AGENT'] ); $response = get_site_transient( 'browser_' . $key ); if ( false === $response ) { require ABSPATH . WPINC . '/version.php'; $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; $options = array( 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_post( $url, $options ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $response = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $response ) ) { return false; } set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); } return $response; } function wp_dashboard_php_nag() { $response = wp_check_php_version(); if ( ! $response ) { return; } if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) { $msg = sprintf( __( 'Your site is running an insecure version of PHP (%s), which should be updated.' ), PHP_VERSION ); } else { $msg = sprintf( __( 'Your site is running an outdated version of PHP (%s), which should be updated.' ), PHP_VERSION ); } ?> -

          - -

          -

          - -

          - -

          - %2$s %3$s', esc_url( wp_get_update_php_url() ), __( 'Learn more about updating PHP' ), __( '(opens in a new tab)' ) ); ?> -

          - 0, 'recommended' => 0, 'critical' => 0, ); } $issues_total = $issue_counts['recommended'] + $issue_counts['critical']; ?> -
          -
          -
          - -
          -
          - - - - - -
          -
          - -
          - -

          - visit the Site Health screen to gather information about your site now.' ), esc_url( admin_url( 'site-health.php' ) ) ); ?> -

          - -

          - - - - - 1 ) : ?> - - - - - - -

          - - - 0 && false !== $get_issues ) : ?> -

          - %1$d item on the Site Health screen.', 'Take a look at the %1$d items on the Site Health screen.', $issues_total ), $issues_total, esc_url( admin_url( 'site-health.php' ) ) ); ?> -

          - -
          -
          - - -
          -
          -
          - -
          -

          -

          - - - -

          -
          -
          -
          -
          -
          -

          -

          - -
          -
          -
          -
          -
          - -

          -

          - - -

          -

          - - - - -
          -
          -
          -
          -
          - -

          -

          - - -

          -

          - - -
          -
          -
          -
          - sprintf( __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), 'php.ini', 'post_max_size', 'upload_max_filesize' ), ); } $overrides = array( 'test_form' => false, 'test_type' => false, ); $_FILES['import']['name'] .= '.txt'; $upload = wp_handle_upload( $_FILES['import'], $overrides ); if ( isset( $upload['error'] ) ) { return $upload; } $attachment = array( 'post_title' => wp_basename( $upload['file'] ), 'post_content' => $upload['url'], 'post_mime_type' => $upload['type'], 'guid' => $upload['url'], 'context' => 'import', 'post_status' => 'private', ); $id = wp_insert_attachment( $attachment, $upload['file'] ); wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); return array( 'file' => $upload['file'], 'id' => $id, ); } function wp_get_popular_importers() { require ABSPATH . WPINC . '/version.php'; $locale = get_user_locale(); $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); $popular_importers = get_site_transient( $cache_key ); if ( ! $popular_importers ) { $url = add_query_arg( array( 'locale' => $locale, 'version' => $wp_version, ), 'http://api.wordpress.org/core/importers/1.1/' ); $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_get( $url, $options ); $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); if ( is_array( $popular_importers ) ) { set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS ); } else { $popular_importers = false; } } if ( is_array( $popular_importers ) ) { if ( $popular_importers['translated'] ) { return $popular_importers['importers']; } foreach ( $popular_importers['importers'] as &$importer ) { $importer['description'] = translate( $importer['description'] ); if ( 'WordPress' !== $importer['name'] ) { $importer['name'] = translate( $importer['name'] ); } } return $popular_importers['importers']; } return array( 'blogger' => array( 'name' => __( 'Blogger' ), 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), 'plugin-slug' => 'blogger-importer', 'importer-id' => 'blogger', ), 'wpcat2tag' => array( 'name' => __( 'Categories and Tags Converter' ), 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), 'plugin-slug' => 'wpcat2tag-importer', 'importer-id' => 'wp-cat2tag', ), 'livejournal' => array( 'name' => __( 'LiveJournal' ), 'description' => __( 'Import posts from LiveJournal using their API.' ), 'plugin-slug' => 'livejournal-importer', 'importer-id' => 'livejournal', ), 'movabletype' => array( 'name' => __( 'Movable Type and TypePad' ), 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), 'plugin-slug' => 'movabletype-importer', 'importer-id' => 'mt', ), 'rss' => array( 'name' => __( 'RSS' ), 'description' => __( 'Import posts from an RSS feed.' ), 'plugin-slug' => 'rss-importer', 'importer-id' => 'rss', ), 'tumblr' => array( 'name' => __( 'Tumblr' ), 'description' => __( 'Import posts & media from Tumblr using their API.' ), 'plugin-slug' => 'tumblr-importer', 'importer-id' => 'tumblr', ), 'wordpress' => array( 'name' => 'WordPress', 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), 'plugin-slug' => 'wordpress-importer', 'importer-id' => 'wordpress', ), ); } method = 'ssh2'; $this->errors = new WP_Error(); if ( ! extension_loaded( 'ssh2' ) ) { $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) ); return; } if ( empty( $opt['port'] ) ) { $this->options['port'] = 22; } else { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'SSH2 hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( ! empty( $opt['public_key'] ) && ! empty( $opt['private_key'] ) ) { $this->options['public_key'] = $opt['public_key']; $this->options['private_key'] = $opt['private_key']; $this->options['hostkey'] = array( 'hostkey' => 'ssh-rsa,ssh-ed25519' ); $this->keys = true; } elseif ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'SSH2 username is required' ) ); } if ( ! empty( $opt['username'] ) ) { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { if ( ! $this->keys ) { $this->errors->add( 'empty_password', __( 'SSH2 password is required' ) ); } } else { $this->options['password'] = $opt['password']; } } public function connect() { if ( ! $this->keys ) { $this->link = @ssh2_connect( $this->options['hostname'], $this->options['port'] ); } else { $this->link = @ssh2_connect( $this->options['hostname'], $this->options['port'], $this->options['hostkey'] ); } if ( ! $this->link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to SSH2 Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->keys ) { if ( ! @ssh2_auth_password( $this->link, $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } } else { if ( ! @ssh2_auth_pubkey_file( $this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Public and Private keys incorrect for %s' ), $this->options['username'] ) ); return false; } } $this->sftp_link = ssh2_sftp( $this->link ); if ( ! $this->sftp_link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to initialize a SFTP subsystem session with the SSH2 Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } return true; } public function sftp_path( $path ) { if ( '/' === $path ) { $path = '/./'; } return 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $path, '/' ); } public function run_command( $command, $returnbool = false ) { if ( ! $this->link ) { return false; } $stream = ssh2_exec( $this->link, $command ); if ( ! $stream ) { $this->errors->add( 'command', sprintf( __( 'Unable to perform command: %s' ), $command ) ); } else { stream_set_blocking( $stream, true ); stream_set_timeout( $stream, FS_TIMEOUT ); $data = stream_get_contents( $stream ); fclose( $stream ); if ( $returnbool ) { return ( false === $data ) ? false : '' !== trim( $data ); } else { return $data; } } return false; } public function get_contents( $file ) { return file_get_contents( $this->sftp_path( $file ) ); } public function get_contents_array( $file ) { return file( $this->sftp_path( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $ret = file_put_contents( $this->sftp_path( $file ), $contents ); if ( strlen( $contents ) !== $ret ) { return false; } $this->chmod( $file, $mode ); return true; } public function cwd() { $cwd = ssh2_sftp_realpath( $this->sftp_link, '.' ); if ( $cwd ) { $cwd = trailingslashit( trim( $cwd ) ); } return $cwd; } public function chdir( $dir ) { return $this->run_command( 'cd ' . $dir, true ); } public function chgrp( $file, $group, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chgrp %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chgrp -R %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chmod %o %s', $mode, escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chmod -R %o %s', $mode, escapeshellarg( $file ) ), true ); } public function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive || ! $this->is_dir( $file ) ) { return $this->run_command( sprintf( 'chown %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true ); } return $this->run_command( sprintf( 'chown -R %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true ); } public function owner( $file ) { $owneruid = @fileowner( $this->sftp_path( $file ) ); if ( ! $owneruid ) { return false; } if ( ! function_exists( 'posix_getpwuid' ) ) { return $owneruid; } $ownerarray = posix_getpwuid( $owneruid ); if ( ! $ownerarray ) { return false; } return $ownerarray['name']; } public function getchmod( $file ) { return substr( decoct( @fileperms( $this->sftp_path( $file ) ) ), -3 ); } public function group( $file ) { $gid = @filegroup( $this->sftp_path( $file ) ); if ( ! $gid ) { return false; } if ( ! function_exists( 'posix_getgrgid' ) ) { return $gid; } $grouparray = posix_getgrgid( $gid ); if ( ! $grouparray ) { return false; } return $grouparray['name']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { if ( $this->exists( $destination ) ) { if ( $overwrite ) { $this->delete( $destination, false, 'f' ); } else { return false; } } return ssh2_sftp_rename( $this->sftp_link, $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( 'f' === $type || $this->is_file( $file ) ) { return ssh2_sftp_unlink( $this->sftp_link, $file ); } if ( ! $recursive ) { return ssh2_sftp_rmdir( $this->sftp_link, $file ); } $filelist = $this->dirlist( $file ); if ( is_array( $filelist ) ) { foreach ( $filelist as $filename => $fileinfo ) { $this->delete( $file . '/' . $filename, $recursive, $fileinfo['type'] ); } } return ssh2_sftp_rmdir( $this->sftp_link, $file ); } public function exists( $file ) { return file_exists( $this->sftp_path( $file ) ); } public function is_file( $file ) { return is_file( $this->sftp_path( $file ) ); } public function is_dir( $path ) { return is_dir( $this->sftp_path( $path ) ); } public function is_readable( $file ) { return is_readable( $this->sftp_path( $file ) ); } public function is_writable( $file ) { return true; } public function atime( $file ) { return fileatime( $this->sftp_path( $file ) ); } public function mtime( $file ) { return filemtime( $this->sftp_path( $file ) ); } public function size( $file ) { return filesize( $this->sftp_path( $file ) ); } public function touch( $file, $time = 0, $atime = 0 ) { } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } if ( ! ssh2_sftp_mkdir( $this->sftp_link, $path, $chmod, true ) ) { return false; } ssh2_sftp_chmod( $this->sftp_link, $path, $chmod ); if ( $chown ) { $this->chown( $path, $chown ); } if ( $chgrp ) { $this->chgrp( $path, $chgrp ); } return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path, $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ); } else { $limit_file = false; } if ( ! $this->is_dir( $path ) || ! $this->is_readable( $path ) ) { return false; } $ret = array(); $dir = dir( $this->sftp_path( $path ) ); if ( ! $dir ) { return false; } while ( false !== ( $entry = $dir->read() ) ) { $struc = array(); $struc['name'] = $entry; if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } $struc['perms'] = $this->gethchmod( $path . '/' . $entry ); $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $struc['number'] = false; $struc['owner'] = $this->owner( $path . '/' . $entry ); $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset( $dir ); return $ret; } } user_id = absint( $user_id ); $this->user_location = $user_location; } public function get_events( $location_search = '', $timezone = '' ) { $cached_events = $this->get_cached_events(); if ( ! $location_search && $cached_events ) { return $cached_events; } require ABSPATH . WPINC . '/version.php'; $api_url = 'http://api.wordpress.org/events/1.0/'; $request_args = $this->get_request_args( $location_search, $timezone ); $request_args['user-agent'] = 'WordPress/' . $wp_version . '; ' . home_url( '/' ); if ( wp_http_supports( array( 'ssl' ) ) ) { $api_url = set_url_scheme( $api_url, 'https' ); } $response = wp_remote_get( $api_url, $request_args ); $response_code = wp_remote_retrieve_response_code( $response ); $response_body = json_decode( wp_remote_retrieve_body( $response ), true ); $response_error = null; if ( is_wp_error( $response ) ) { $response_error = $response; } elseif ( 200 !== $response_code ) { $response_error = new WP_Error( 'api-error', sprintf( __( 'Invalid API response code (%d).' ), $response_code ) ); } elseif ( ! isset( $response_body['location'], $response_body['events'] ) ) { $response_error = new WP_Error( 'api-invalid-response', isset( $response_body['error'] ) ? $response_body['error'] : __( 'Unknown API error.' ) ); } if ( is_wp_error( $response_error ) ) { return $response_error; } else { $expiration = false; if ( isset( $response_body['ttl'] ) ) { $expiration = $response_body['ttl']; unset( $response_body['ttl'] ); } if ( ! empty( $response_body['location']['ip'] ) ) { $response_body['location']['ip'] = $request_args['body']['ip']; } if ( $this->coordinates_match( $request_args['body'], $response_body['location'] ) && empty( $response_body['location']['description'] ) ) { $response_body['location']['description'] = $this->user_location['description']; } $this->cache_events( $response_body, $expiration ); $response_body['events'] = $this->trim_events( $response_body['events'] ); return $response_body; } } protected function get_request_args( $search = '', $timezone = '' ) { $args = array( 'number' => 5, 'ip' => self::get_unsafe_client_ip(), ); if ( empty( $search ) && isset( $this->user_location['latitude'], $this->user_location['longitude'] ) ) { $args['latitude'] = $this->user_location['latitude']; $args['longitude'] = $this->user_location['longitude']; } else { $args['locale'] = get_user_locale( $this->user_id ); if ( $timezone ) { $args['timezone'] = $timezone; } if ( $search ) { $args['location'] = $search; } } return array( 'body' => $args, ); } public static function get_unsafe_client_ip() { $client_ip = false; $address_headers = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR', ); foreach ( $address_headers as $header ) { if ( array_key_exists( $header, $_SERVER ) ) { $address_chain = explode( ',', $_SERVER[ $header ] ); $client_ip = trim( $address_chain[0] ); break; } } if ( ! $client_ip ) { return false; } $anon_ip = wp_privacy_anonymize_ip( $client_ip, true ); if ( '0.0.0.0' === $anon_ip || '::' === $anon_ip ) { return false; } return $anon_ip; } protected function coordinates_match( $a, $b ) { if ( ! isset( $a['latitude'], $a['longitude'], $b['latitude'], $b['longitude'] ) ) { return false; } return $a['latitude'] === $b['latitude'] && $a['longitude'] === $b['longitude']; } protected function get_events_transient_key( $location ) { $key = false; if ( isset( $location['ip'] ) ) { $key = 'community-events-' . md5( $location['ip'] ); } elseif ( isset( $location['latitude'], $location['longitude'] ) ) { $key = 'community-events-' . md5( $location['latitude'] . $location['longitude'] ); } return $key; } protected function cache_events( $events, $expiration = false ) { $set = false; $transient_key = $this->get_events_transient_key( $events['location'] ); $cache_expiration = $expiration ? absint( $expiration ) : HOUR_IN_SECONDS * 12; if ( $transient_key ) { $set = set_site_transient( $transient_key, $events, $cache_expiration ); } return $set; } public function get_cached_events() { $cached_response = get_site_transient( $this->get_events_transient_key( $this->user_location ) ); if ( isset( $cached_response['events'] ) ) { $cached_response['events'] = $this->trim_events( $cached_response['events'] ); } return $cached_response; } protected function format_event_data_time( $response_body ) { _deprecated_function( __METHOD__, '5.5.2', 'This is no longer used by core, and only kept for backward compatibility.' ); if ( isset( $response_body['events'] ) ) { foreach ( $response_body['events'] as $key => $event ) { $timestamp = strtotime( $event['date'] ); $formatted_date = date_i18n( __( 'l, M j, Y' ), $timestamp ); $formatted_time = date_i18n( get_option( 'time_format' ), $timestamp ); if ( isset( $event['end_date'] ) ) { $end_timestamp = strtotime( $event['end_date'] ); $formatted_end_date = date_i18n( __( 'l, M j, Y' ), $end_timestamp ); if ( 'meetup' !== $event['type'] && $formatted_end_date !== $formatted_date ) { $start_month = date_i18n( _x( 'F', 'upcoming events month format' ), $timestamp ); $end_month = date_i18n( _x( 'F', 'upcoming events month format' ), $end_timestamp ); if ( $start_month === $end_month ) { $formatted_date = sprintf( __( '%1$s %2$d–%3$d, %4$d' ), $start_month, date_i18n( _x( 'j', 'upcoming events day format' ), $timestamp ), date_i18n( _x( 'j', 'upcoming events day format' ), $end_timestamp ), date_i18n( _x( 'Y', 'upcoming events year format' ), $timestamp ) ); } else { $formatted_date = sprintf( __( '%1$s %2$d – %3$s %4$d, %5$d' ), $start_month, date_i18n( _x( 'j', 'upcoming events day format' ), $timestamp ), $end_month, date_i18n( _x( 'j', 'upcoming events day format' ), $end_timestamp ), date_i18n( _x( 'Y', 'upcoming events year format' ), $timestamp ) ); } $formatted_date = wp_maybe_decline_date( $formatted_date, 'F j, Y' ); } } $response_body['events'][ $key ]['formatted_date'] = $formatted_date; $response_body['events'][ $key ]['formatted_time'] = $formatted_time; } } return $response_body; } protected function trim_events( array $events ) { $future_events = array(); foreach ( $events as $event ) { $end_time = (int) $event['end_unix_timestamp']; if ( time() < $end_time ) { $event['title'] = html_entity_decode( $event['title'], ENT_QUOTES, 'UTF-8' ); array_push( $future_events, $event ); } } $future_wordcamps = array_filter( $future_events, static function( $wordcamp ) { return 'wordcamp' === $wordcamp['type']; } ); $future_wordcamps = array_values( $future_wordcamps ); $trimmed_events = array_slice( $future_events, 0, 3 ); $trimmed_event_types = wp_list_pluck( $trimmed_events, 'type' ); if ( $future_wordcamps && ! in_array( 'wordcamp', $trimmed_event_types, true ) ) { array_pop( $trimmed_events ); array_push( $trimmed_events, $future_wordcamps[0] ); } return $trimmed_events; } protected function maybe_log_events_response( $message, $details ) { _deprecated_function( __METHOD__, '4.9.0' ); if ( ! WP_DEBUG_LOG ) { return; } error_log( sprintf( '%s: %s. Details: %s', __METHOD__, trim( $message, '.' ), wp_json_encode( $details ) ) ); } } false, 'test_type' => false, ); $file = wp_handle_upload( $_FILES[ $form ], $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'] ); } $this->filename = $_FILES[ $form ]['name']; $this->package = $file['file']; $attachment = array( 'post_title' => $this->filename, 'post_content' => $file['url'], 'post_mime_type' => $file['type'], 'guid' => $file['url'], 'context' => 'upgrader', 'post_status' => 'private', ); $this->id = wp_insert_attachment( $attachment, $file['file'] ); wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) ); } elseif ( is_numeric( $_GET[ $urlholder ] ) ) { $this->id = (int) $_GET[ $urlholder ]; $attachment = get_post( $this->id ); if ( empty( $attachment ) ) { wp_die( __( 'Please select a file' ) ); } $this->filename = $attachment->post_title; $this->package = get_attached_file( $attachment->ID ); } else { $uploads = wp_upload_dir(); if ( ! ( $uploads && false === $uploads['error'] ) ) { wp_die( $uploads['error'] ); } $this->filename = sanitize_file_name( $_GET[ $urlholder ] ); $this->package = $uploads['basedir'] . '/' . $this->filename; if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) { wp_die( __( 'Please select a file' ) ); } } } public function cleanup() { if ( $this->id ) { wp_delete_attachment( $this->id ); } elseif ( file_exists( $this->package ) ) { return @unlink( $this->package ); } return true; } } cap->create_posts ) ) { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) ); } } if ( isset( $post_data['content'] ) ) { $post_data['post_content'] = $post_data['content']; } if ( isset( $post_data['excerpt'] ) ) { $post_data['post_excerpt'] = $post_data['excerpt']; } if ( isset( $post_data['parent_id'] ) ) { $post_data['post_parent'] = (int) $post_data['parent_id']; } if ( isset( $post_data['trackback_url'] ) ) { $post_data['to_ping'] = $post_data['trackback_url']; } $post_data['user_ID'] = get_current_user_id(); if ( ! empty( $post_data['post_author_override'] ) ) { $post_data['post_author'] = (int) $post_data['post_author_override']; } else { if ( ! empty( $post_data['post_author'] ) ) { $post_data['post_author'] = (int) $post_data['post_author']; } else { $post_data['post_author'] = (int) $post_data['user_ID']; } } if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] ) && ! current_user_can( $ptype->cap->edit_others_posts ) ) { if ( $update ) { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) ); } } else { if ( 'page' === $post_data['post_type'] ) { return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) ); } else { return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) ); } } } if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'auto-draft' === $post_data['post_status'] ) { $post_data['post_status'] = 'draft'; } if ( ! get_post_status_object( $post_data['post_status'] ) ) { unset( $post_data['post_status'] ); } } if ( isset( $post_data['saveasdraft'] ) && '' !== $post_data['saveasdraft'] ) { $post_data['post_status'] = 'draft'; } if ( isset( $post_data['saveasprivate'] ) && '' !== $post_data['saveasprivate'] ) { $post_data['post_status'] = 'private'; } if ( isset( $post_data['publish'] ) && ( '' !== $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] ) ) { $post_data['post_status'] = 'publish'; } if ( isset( $post_data['advanced'] ) && '' !== $post_data['advanced'] ) { $post_data['post_status'] = 'draft'; } if ( isset( $post_data['pending'] ) && '' !== $post_data['pending'] ) { $post_data['post_status'] = 'pending'; } if ( isset( $post_data['ID'] ) ) { $post_id = $post_data['ID']; } else { $post_id = false; } $previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false; if ( isset( $post_data['post_status'] ) && 'private' === $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) { $post_data['post_status'] = $previous_status ? $previous_status : 'pending'; } $published_statuses = array( 'publish', 'future' ); if ( isset( $post_data['post_status'] ) && ( in_array( $post_data['post_status'], $published_statuses, true ) && ! current_user_can( $ptype->cap->publish_posts ) ) ) { if ( ! in_array( $previous_status, $published_statuses, true ) || ! current_user_can( 'edit_post', $post_id ) ) { $post_data['post_status'] = 'pending'; } } if ( ! isset( $post_data['post_status'] ) ) { $post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status; } if ( isset( $post_data['post_password'] ) && ! current_user_can( $ptype->cap->publish_posts ) ) { unset( $post_data['post_password'] ); } if ( ! isset( $post_data['comment_status'] ) ) { $post_data['comment_status'] = 'closed'; } if ( ! isset( $post_data['ping_status'] ) ) { $post_data['ping_status'] = 'closed'; } foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] != $post_data[ $timeunit ] ) { $post_data['edit_date'] = '1'; break; } } if ( ! empty( $post_data['edit_date'] ) ) { $aa = $post_data['aa']; $mm = $post_data['mm']; $jj = $post_data['jj']; $hh = $post_data['hh']; $mn = $post_data['mn']; $ss = $post_data['ss']; $aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa; $mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm; $jj = ( $jj > 31 ) ? 31 : $jj; $jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj; $hh = ( $hh > 23 ) ? $hh - 24 : $hh; $mn = ( $mn > 59 ) ? $mn - 60 : $mn; $ss = ( $ss > 59 ) ? $ss - 60 : $ss; $post_data['post_date'] = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $aa, $mm, $jj, $hh, $mn, $ss ); $valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] ); if ( ! $valid_date ) { return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); } $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); } if ( isset( $post_data['post_category'] ) ) { $category_object = get_taxonomy( 'category' ); if ( ! current_user_can( $category_object->cap->assign_terms ) ) { unset( $post_data['post_category'] ); } } return $post_data; } function _wp_get_allowed_postdata( $post_data = null ) { if ( empty( $post_data ) ) { $post_data = $_POST; } if ( is_wp_error( $post_data ) ) { return $post_data; } return array_diff_key( $post_data, array_flip( array( 'meta_input', 'file', 'guid' ) ) ); } function edit_post( $post_data = null ) { global $wpdb; if ( empty( $post_data ) ) { $post_data = &$_POST; } unset( $post_data['filter'] ); $post_ID = (int) $post_data['post_ID']; $post = get_post( $post_ID ); $post_data['post_type'] = $post->post_type; $post_data['post_mime_type'] = $post->post_mime_type; if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'inherit' === $post_data['post_status'] ) { unset( $post_data['post_status'] ); } } $ptype = get_post_type_object( $post_data['post_type'] ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { if ( 'page' === $post_data['post_type'] ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } else { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } } if ( post_type_supports( $ptype->name, 'revisions' ) ) { $revisions = wp_get_post_revisions( $post_ID, array( 'order' => 'ASC', 'posts_per_page' => 1, ) ); $revision = current( $revisions ); if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 ) { _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) ); } } if ( isset( $post_data['visibility'] ) ) { switch ( $post_data['visibility'] ) { case 'public': $post_data['post_password'] = ''; break; case 'password': unset( $post_data['sticky'] ); break; case 'private': $post_data['post_status'] = 'private'; $post_data['post_password'] = ''; unset( $post_data['sticky'] ); break; } } $post_data = _wp_translate_postdata( true, $post_data ); if ( is_wp_error( $post_data ) ) { wp_die( $post_data->get_error_message() ); } $translated = _wp_get_allowed_postdata( $post_data ); if ( isset( $post_data['post_format'] ) ) { set_post_format( $post_ID, $post_data['post_format'] ); } $format_meta_urls = array( 'url', 'link_url', 'quote_source_url' ); foreach ( $format_meta_urls as $format_meta_url ) { $keyed = '_format_' . $format_meta_url; if ( isset( $post_data[ $keyed ] ) ) { update_post_meta( $post_ID, $keyed, wp_slash( esc_url_raw( wp_unslash( $post_data[ $keyed ] ) ) ) ); } } $format_keys = array( 'quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed' ); foreach ( $format_keys as $key ) { $keyed = '_format_' . $key; if ( isset( $post_data[ $keyed ] ) ) { if ( current_user_can( 'unfiltered_html' ) ) { update_post_meta( $post_ID, $keyed, $post_data[ $keyed ] ); } else { update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) ); } } } if ( 'attachment' === $post_data['post_type'] && preg_match( '#^(audio|video)/#', $post_data['post_mime_type'] ) ) { $id3data = wp_get_attachment_metadata( $post_ID ); if ( ! is_array( $id3data ) ) { $id3data = array(); } foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) { if ( isset( $post_data[ 'id3_' . $key ] ) ) { $id3data[ $key ] = sanitize_text_field( wp_unslash( $post_data[ 'id3_' . $key ] ) ); } } wp_update_attachment_metadata( $post_ID, $id3data ); } if ( isset( $post_data['meta'] ) && $post_data['meta'] ) { foreach ( $post_data['meta'] as $key => $value ) { $meta = get_post_meta_by_id( $key ); if ( ! $meta ) { continue; } if ( $meta->post_id != $post_ID ) { continue; } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $meta->meta_key ) ) { continue; } if ( is_protected_meta( $value['key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $value['key'] ) ) { continue; } update_meta( $key, $value['key'], $value['value'] ); } } if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) { foreach ( $post_data['deletemeta'] as $key => $value ) { $meta = get_post_meta_by_id( $key ); if ( ! $meta ) { continue; } if ( $meta->post_id != $post_ID ) { continue; } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $post_ID, $meta->meta_key ) ) { continue; } delete_meta( $key ); } } if ( 'attachment' === $post_data['post_type'] ) { if ( isset( $post_data['_wp_attachment_image_alt'] ) ) { $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); if ( get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); } } $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array(); $translated = apply_filters( 'attachment_fields_to_save', $translated, $attachment_data ); } if ( isset( $post_data['tax_input'] ) ) { foreach ( (array) $post_data['tax_input'] as $taxonomy => $terms ) { $tax_object = get_taxonomy( $taxonomy ); if ( $tax_object && isset( $tax_object->meta_box_sanitize_cb ) ) { $translated['tax_input'][ $taxonomy ] = call_user_func_array( $tax_object->meta_box_sanitize_cb, array( $taxonomy, $terms ) ); } } } add_meta( $post_ID ); update_post_meta( $post_ID, '_edit_last', get_current_user_id() ); $success = wp_update_post( $translated ); if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) { $fields = array( 'post_title', 'post_content', 'post_excerpt' ); foreach ( $fields as $field ) { if ( isset( $translated[ $field ] ) ) { $translated[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $translated[ $field ] ); } } wp_update_post( $translated ); } _fix_attachment_links( $post_ID ); wp_set_post_lock( $post_ID ); if ( current_user_can( $ptype->cap->edit_others_posts ) && current_user_can( $ptype->cap->publish_posts ) ) { if ( ! empty( $post_data['sticky'] ) ) { stick_post( $post_ID ); } else { unstick_post( $post_ID ); } } return $post_ID; } function bulk_edit_posts( $post_data = null ) { global $wpdb; if ( empty( $post_data ) ) { $post_data = &$_POST; } if ( isset( $post_data['post_type'] ) ) { $ptype = get_post_type_object( $post_data['post_type'] ); } else { $ptype = get_post_type_object( 'post' ); } if ( ! current_user_can( $ptype->cap->edit_posts ) ) { if ( 'page' === $ptype->name ) { wp_die( __( 'Sorry, you are not allowed to edit pages.' ) ); } else { wp_die( __( 'Sorry, you are not allowed to edit posts.' ) ); } } if ( -1 == $post_data['_status'] ) { $post_data['post_status'] = null; unset( $post_data['post_status'] ); } else { $post_data['post_status'] = $post_data['_status']; } unset( $post_data['_status'] ); if ( ! empty( $post_data['post_status'] ) ) { $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); if ( 'inherit' === $post_data['post_status'] ) { unset( $post_data['post_status'] ); } } $post_IDs = array_map( 'intval', (array) $post_data['post'] ); $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky', 'post_format', ); foreach ( $reset as $field ) { if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) { unset( $post_data[ $field ] ); } } if ( isset( $post_data['post_category'] ) ) { if ( is_array( $post_data['post_category'] ) && ! empty( $post_data['post_category'] ) ) { $new_cats = array_map( 'absint', $post_data['post_category'] ); } else { unset( $post_data['post_category'] ); } } $tax_input = array(); if ( isset( $post_data['tax_input'] ) ) { foreach ( $post_data['tax_input'] as $tax_name => $terms ) { if ( empty( $terms ) ) { continue; } if ( is_taxonomy_hierarchical( $tax_name ) ) { $tax_input[ $tax_name ] = array_map( 'absint', $terms ); } else { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $tax_input[ $tax_name ] = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } } } if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) { $parent = (int) $post_data['post_parent']; $pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" ); $children = array(); for ( $i = 0; $i < 50 && $parent > 0; $i++ ) { $children[] = $parent; foreach ( $pages as $page ) { if ( (int) $page->ID === $parent ) { $parent = (int) $page->post_parent; break; } } } } $updated = array(); $skipped = array(); $locked = array(); $shared_post_data = $post_data; foreach ( $post_IDs as $post_ID ) { $post_data = $shared_post_data; $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); if ( ! isset( $post_type_object ) || ( isset( $children ) && in_array( $post_ID, $children, true ) ) || ! current_user_can( 'edit_post', $post_ID ) ) { $skipped[] = $post_ID; continue; } if ( wp_check_post_lock( $post_ID ) ) { $locked[] = $post_ID; continue; } $post = get_post( $post_ID ); $tax_names = get_object_taxonomies( $post ); foreach ( $tax_names as $tax_name ) { $taxonomy_obj = get_taxonomy( $tax_name ); if ( isset( $tax_input[ $tax_name ] ) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) { $new_terms = $tax_input[ $tax_name ]; } else { $new_terms = array(); } if ( $taxonomy_obj->hierarchical ) { $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array( 'fields' => 'ids' ) ); } else { $current_terms = (array) wp_get_object_terms( $post_ID, $tax_name, array( 'fields' => 'names' ) ); } $post_data['tax_input'][ $tax_name ] = array_merge( $current_terms, $new_terms ); } if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) { $cats = (array) wp_get_post_categories( $post_ID ); $post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) ); unset( $post_data['tax_input']['category'] ); } $post_data['post_ID'] = $post_ID; $post_data['post_type'] = $post->post_type; $post_data['post_mime_type'] = $post->post_mime_type; foreach ( array( 'comment_status', 'ping_status', 'post_author' ) as $field ) { if ( ! isset( $post_data[ $field ] ) ) { $post_data[ $field ] = $post->$field; } } $post_data = _wp_translate_postdata( true, $post_data ); if ( is_wp_error( $post_data ) ) { $skipped[] = $post_ID; continue; } $post_data = _wp_get_allowed_postdata( $post_data ); if ( isset( $shared_post_data['post_format'] ) ) { set_post_format( $post_ID, $shared_post_data['post_format'] ); } unset( $post_data['tax_input']['post_format'] ); $post_id = wp_update_post( $post_data ); update_post_meta( $post_id, '_edit_last', get_current_user_id() ); $updated[] = $post_id; if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { if ( 'sticky' === $post_data['sticky'] ) { stick_post( $post_ID ); } else { unstick_post( $post_ID ); } } } return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked, ); } function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) { $post_title = ''; if ( ! empty( $_REQUEST['post_title'] ) ) { $post_title = esc_html( wp_unslash( $_REQUEST['post_title'] ) ); } $post_content = ''; if ( ! empty( $_REQUEST['content'] ) ) { $post_content = esc_html( wp_unslash( $_REQUEST['content'] ) ); } $post_excerpt = ''; if ( ! empty( $_REQUEST['excerpt'] ) ) { $post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] ) ); } if ( $create_in_db ) { $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft', ), false, false ); $post = get_post( $post_id ); if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) { set_post_format( $post, get_option( 'default_post_format' ) ); } wp_after_insert_post( $post, false, null ); if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); } } else { $post = new stdClass; $post->ID = 0; $post->post_author = ''; $post->post_date = ''; $post->post_date_gmt = ''; $post->post_password = ''; $post->post_name = ''; $post->post_type = $post_type; $post->post_status = 'draft'; $post->to_ping = ''; $post->pinged = ''; $post->comment_status = get_default_comment_status( $post_type ); $post->ping_status = get_default_comment_status( $post_type, 'pingback' ); $post->post_pingback = get_option( 'default_pingback_flag' ); $post->post_category = get_option( 'default_category' ); $post->page_template = 'default'; $post->post_parent = 0; $post->menu_order = 0; $post = new WP_Post( $post ); } $post->post_content = (string) apply_filters( 'default_content', $post_content, $post ); $post->post_title = (string) apply_filters( 'default_title', $post_title, $post ); $post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post ); return $post; } function post_exists( $title, $content = '', $date = '', $type = '', $status = '' ) { global $wpdb; $post_title = wp_unslash( sanitize_post_field( 'post_title', $title, 0, 'db' ) ); $post_content = wp_unslash( sanitize_post_field( 'post_content', $content, 0, 'db' ) ); $post_date = wp_unslash( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); $post_type = wp_unslash( sanitize_post_field( 'post_type', $type, 0, 'db' ) ); $post_status = wp_unslash( sanitize_post_field( 'post_status', $status, 0, 'db' ) ); $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; $args = array(); if ( ! empty( $date ) ) { $query .= ' AND post_date = %s'; $args[] = $post_date; } if ( ! empty( $title ) ) { $query .= ' AND post_title = %s'; $args[] = $post_title; } if ( ! empty( $content ) ) { $query .= ' AND post_content = %s'; $args[] = $post_content; } if ( ! empty( $type ) ) { $query .= ' AND post_type = %s'; $args[] = $post_type; } if ( ! empty( $status ) ) { $query .= ' AND post_status = %s'; $args[] = $post_status; } if ( ! empty( $args ) ) { return (int) $wpdb->get_var( $wpdb->prepare( $query, $args ) ); } return 0; } function wp_write_post() { if ( isset( $_POST['post_type'] ) ) { $ptype = get_post_type_object( $_POST['post_type'] ); } else { $ptype = get_post_type_object( 'post' ); } if ( ! current_user_can( $ptype->cap->edit_posts ) ) { if ( 'page' === $ptype->name ) { return new WP_Error( 'edit_pages', __( 'Sorry, you are not allowed to create pages on this site.' ) ); } else { return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to create posts or drafts on this site.' ) ); } } $_POST['post_mime_type'] = ''; unset( $_POST['filter'] ); if ( isset( $_POST['post_ID'] ) ) { return edit_post(); } if ( isset( $_POST['visibility'] ) ) { switch ( $_POST['visibility'] ) { case 'public': $_POST['post_password'] = ''; break; case 'password': unset( $_POST['sticky'] ); break; case 'private': $_POST['post_status'] = 'private'; $_POST['post_password'] = ''; unset( $_POST['sticky'] ); break; } } $translated = _wp_translate_postdata( false ); if ( is_wp_error( $translated ) ) { return $translated; } $translated = _wp_get_allowed_postdata( $translated ); $post_ID = wp_insert_post( $translated ); if ( is_wp_error( $post_ID ) ) { return $post_ID; } if ( empty( $post_ID ) ) { return 0; } add_meta( $post_ID ); add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); _fix_attachment_links( $post_ID ); wp_set_post_lock( $post_ID ); return $post_ID; } function write_post() { $result = wp_write_post(); if ( is_wp_error( $result ) ) { wp_die( $result->get_error_message() ); } else { return $result; } } function add_meta( $post_ID ) { $post_ID = (int) $post_ID; $metakeyselect = isset( $_POST['metakeyselect'] ) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : ''; $metakeyinput = isset( $_POST['metakeyinput'] ) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : ''; $metavalue = isset( $_POST['metavalue'] ) ? $_POST['metavalue'] : ''; if ( is_string( $metavalue ) ) { $metavalue = trim( $metavalue ); } if ( ( ( '#NONE#' !== $metakeyselect ) && ! empty( $metakeyselect ) ) || ! empty( $metakeyinput ) ) { if ( '#NONE#' !== $metakeyselect ) { $metakey = $metakeyselect; } if ( $metakeyinput ) { $metakey = $metakeyinput; } if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) ) { return false; } $metakey = wp_slash( $metakey ); return add_post_meta( $post_ID, $metakey, $metavalue ); } return false; } function delete_meta( $mid ) { return delete_metadata_by_mid( 'post', $mid ); } function get_meta_keys() { global $wpdb; $keys = $wpdb->get_col( " - SELECT meta_key - FROM $wpdb->postmeta - GROUP BY meta_key - ORDER BY meta_key" ); return $keys; } function get_post_meta_by_id( $mid ) { return get_metadata_by_mid( 'post', $mid ); } function has_meta( $postid ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, post_id - FROM $wpdb->postmeta WHERE post_id = %d - ORDER BY meta_key,meta_id", $postid ), ARRAY_A ); } function update_meta( $meta_id, $meta_key, $meta_value ) { $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key ); } function _fix_attachment_links( $post ) { $post = get_post( $post, ARRAY_A ); $content = $post['post_content']; if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ), true ) ) { return; } if ( ! strpos( $content, '?attachment_id=' ) || ! preg_match_all( '/]+)>[\s\S]+?<\/a>/', $content, $link_matches ) ) { return; } $site_url = get_bloginfo( 'url' ); $site_url = substr( $site_url, (int) strpos( $site_url, '://' ) ); $replace = ''; foreach ( $link_matches[1] as $key => $value ) { if ( ! strpos( $value, '?attachment_id=' ) || ! strpos( $value, 'wp-att-' ) || ! preg_match( '/href=(["\'])[^"\']*\?attachment_id=(\d+)[^"\']*\\1/', $value, $url_match ) || ! preg_match( '/rel=["\'][^"\']*wp-att-(\d+)/', $value, $rel_match ) ) { continue; } $quote = $url_match[1]; $url_id = (int) $url_match[2]; $rel_id = (int) $rel_match[1]; if ( ! $url_id || ! $rel_id || $url_id != $rel_id || strpos( $url_match[0], $site_url ) === false ) { continue; } $link = $link_matches[0][ $key ]; $replace = str_replace( $url_match[0], 'href=' . $quote . get_attachment_link( $url_id ) . $quote, $link ); $content = str_replace( $link, $replace, $content ); } if ( $replace ) { $post['post_content'] = $content; $post = add_magic_quotes( $post ); return wp_update_post( $post ); } } function get_available_post_statuses( $type = 'post' ) { $stati = wp_count_posts( $type ); return array_keys( get_object_vars( $stati ) ); } function wp_edit_posts_query( $q = false ) { if ( false === $q ) { $q = $_GET; } $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; $post_stati = get_post_stati(); if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) { $post_type = $q['post_type']; } else { $post_type = 'post'; } $avail_post_stati = get_available_post_statuses( $post_type ); $post_status = ''; $perm = ''; if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) { $post_status = $q['post_status']; $perm = 'readable'; } $orderby = ''; if ( isset( $q['orderby'] ) ) { $orderby = $q['orderby']; } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ), true ) ) { $orderby = 'modified'; } $order = ''; if ( isset( $q['order'] ) ) { $order = $q['order']; } elseif ( isset( $q['post_status'] ) && 'pending' === $q['post_status'] ) { $order = 'ASC'; } $per_page = "edit_{$post_type}_per_page"; $posts_per_page = (int) get_user_option( $per_page ); if ( empty( $posts_per_page ) || $posts_per_page < 1 ) { $posts_per_page = 20; } $posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page ); $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type ); $query = compact( 'post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page' ); if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) { $query['orderby'] = 'menu_order title'; $query['order'] = 'asc'; $query['posts_per_page'] = -1; $query['posts_per_archive_page'] = -1; $query['fields'] = 'id=>parent'; } if ( ! empty( $q['show_sticky'] ) ) { $query['post__in'] = (array) get_option( 'sticky_posts' ); } wp( $query ); return $avail_post_stati; } function wp_edit_attachments_query_vars( $q = false ) { if ( false === $q ) { $q = $_GET; } $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; $q['post_type'] = 'attachment'; $post_type = get_post_type_object( 'attachment' ); $states = 'inherit'; if ( current_user_can( $post_type->cap->read_private_posts ) ) { $states .= ',private'; } $q['post_status'] = isset( $q['status'] ) && 'trash' === $q['status'] ? 'trash' : $states; $q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' === $q['attachment-filter'] ? 'trash' : $states; $media_per_page = (int) get_user_option( 'upload_per_page' ); if ( empty( $media_per_page ) || $media_per_page < 1 ) { $media_per_page = 20; } $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page ); $post_mime_types = get_post_mime_types(); if ( isset( $q['post_mime_type'] ) && ! array_intersect( (array) $q['post_mime_type'], array_keys( $post_mime_types ) ) ) { unset( $q['post_mime_type'] ); } foreach ( array_keys( $post_mime_types ) as $type ) { if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" === $q['attachment-filter'] ) { $q['post_mime_type'] = $type; break; } } if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' === $q['attachment-filter'] ) ) { $q['post_parent'] = 0; } if ( isset( $q['mine'] ) || ( isset( $q['attachment-filter'] ) && 'mine' === $q['attachment-filter'] ) ) { $q['author'] = get_current_user_id(); } if ( isset( $q['s'] ) ) { add_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); } return $q; } function wp_edit_attachments_query( $q = false ) { wp( wp_edit_attachments_query_vars( $q ) ); $post_mime_types = get_post_mime_types(); $avail_post_mime_types = get_available_post_mime_types( 'attachment' ); return array( $post_mime_types, $avail_post_mime_types ); } function postbox_classes( $box_id, $screen_id ) { if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) { $classes = array( '' ); } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) { $closed = get_user_option( 'closedpostboxes_' . $screen_id ); if ( ! is_array( $closed ) ) { $classes = array( '' ); } else { $classes = in_array( $box_id, $closed, true ) ? array( 'closed' ) : array( '' ); } } else { $classes = array( '' ); } $classes = apply_filters( "postbox_classes_{$screen_id}_{$box_id}", $classes ); return implode( ' ', $classes ); } function get_sample_permalink( $id, $title = null, $name = null ) { $post = get_post( $id ); if ( ! $post ) { return array( '', '' ); } $ptype = get_post_type_object( $post->post_type ); $original_status = $post->post_status; $original_date = $post->post_date; $original_name = $post->post_name; if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) { $post->post_status = 'publish'; $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID ); } if ( ! is_null( $name ) ) { $post->post_name = sanitize_title( $name ? $name : $title, $post->ID ); } $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent ); $post->filter = 'sample'; $permalink = get_permalink( $post, true ); $permalink = str_replace( "%$post->post_type%", '%pagename%', $permalink ); if ( $ptype->hierarchical ) { $uri = get_page_uri( $post ); if ( $uri ) { $uri = untrailingslashit( $uri ); $uri = strrev( stristr( strrev( $uri ), '/' ) ); $uri = untrailingslashit( $uri ); } $uri = apply_filters( 'editable_slug', $uri, $post ); if ( ! empty( $uri ) ) { $uri .= '/'; } $permalink = str_replace( '%pagename%', "{$uri}%pagename%", $permalink ); } $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) ); $post->post_status = $original_status; $post->post_date = $original_date; $post->post_name = $original_name; unset( $post->filter ); return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post ); } function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { $post = get_post( $id ); if ( ! $post ) { return ''; } list($permalink, $post_name) = get_sample_permalink( $post->ID, $new_title, $new_slug ); $view_link = false; $preview_target = ''; if ( current_user_can( 'read_post', $post->ID ) ) { if ( 'draft' === $post->post_status || empty( $post->post_name ) ) { $view_link = get_preview_post_link( $post ); $preview_target = " target='wp-preview-{$post->ID}'"; } else { if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) { $view_link = get_permalink( $post ); } else { $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink ); } } } if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { $return = '' . __( 'Permalink:' ) . "\n"; if ( false !== $view_link ) { $display_link = urldecode( $view_link ); $return .= '' . esc_html( $display_link ) . "\n"; } else { $return .= '' . $permalink . "\n"; } if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id ) ) { $return .= '' . __( 'Change Permalink Structure' ) . "\n"; } } else { if ( mb_strlen( $post_name ) > 34 ) { $post_name_abridged = mb_substr( $post_name, 0, 16 ) . '…' . mb_substr( $post_name, -16 ); } else { $post_name_abridged = $post_name; } $post_name_html = '' . esc_html( $post_name_abridged ) . ''; $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( urldecode( $permalink ) ) ); $return = '' . __( 'Permalink:' ) . "\n"; $return .= '' . $display_link . "\n"; $return .= '‎'; $return .= '\n"; $return .= '' . esc_html( $post_name ) . "\n"; } $return = apply_filters( 'get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post ); return $return; } function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $post = get_post( $post ); $post_type_object = get_post_type_object( $post->post_type ); $set_thumbnail_link = '

          %s

          '; $upload_iframe_src = get_upload_iframe_src( 'image', $post->ID ); $content = sprintf( $set_thumbnail_link, esc_url( $upload_iframe_src ), '', esc_html( $post_type_object->labels->set_featured_image ) ); if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( 266, 266 ); $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post ); $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size ); if ( ! empty( $thumbnail_html ) ) { $content = sprintf( $set_thumbnail_link, esc_url( $upload_iframe_src ), ' aria-describedby="set-post-thumbnail-desc"', $thumbnail_html ); $content .= '

          ' . __( 'Click the image to edit or update' ) . '

          '; $content .= '

          ' . esc_html( $post_type_object->labels->remove_featured_image ) . '

          '; } } $content .= ''; return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id ); } function wp_check_post_lock( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $lock = get_post_meta( $post->ID, '_edit_lock', true ); if ( ! $lock ) { return false; } $lock = explode( ':', $lock ); $time = $lock[0]; $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); if ( ! get_userdata( $user ) ) { return false; } $time_window = apply_filters( 'wp_check_post_lock_window', 150 ); if ( $time && $time > time() - $time_window && get_current_user_id() != $user ) { return $user; } return false; } function wp_set_post_lock( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $user_id = get_current_user_id(); if ( 0 == $user_id ) { return false; } $now = time(); $lock = "$now:$user_id"; update_post_meta( $post->ID, '_edit_lock', $lock ); return array( $now, $user_id ); } function _admin_notice_post_locked() { $post = get_post(); if ( ! $post ) { return; } $user = null; $user_id = wp_check_post_lock( $post->ID ); if ( $user_id ) { $user = get_userdata( $user_id ); } if ( $user ) { if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) ) { return; } $locked = true; } else { $locked = false; } $sendback = wp_get_referer(); if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { $sendback_text = __( 'Go back' ); } else { $sendback = admin_url( 'edit.php' ); if ( 'post' !== $post->post_type ) { $sendback = add_query_arg( 'post_type', $post->post_type, $sendback ); } $sendback_text = get_post_type_object( $post->post_type )->labels->all_items; } $hidden = $locked ? '' : ' hidden'; ?> -
          -
          -
          - post_type )->public ) { if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) { $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); $query_args['preview_id'] = $post->ID; $query_args['preview_nonce'] = $nonce; } } $preview_link = get_preview_post_link( $post->ID, $query_args ); $override = apply_filters( 'override_post_lock', true, $post, $user ); $tab_last = $override ? '' : ' wp-tab-last'; ?> -
          -
          ID, 64 ); ?>
          -

          - display_name ) ); } else { printf( __( '%s is currently editing this post.' ), esc_html( $user->display_name ) ); } ?> -

          - -

          - - - - - - -

          -
          - -
          -
          -

          -
          - - -

          - -

          -
          - -
          -
          - ID; $new_autosave['post_author'] = $post_author; $post = get_post( $post_id ); $autosave_is_different = false; foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) { $autosave_is_different = true; break; } } if ( ! $autosave_is_different ) { wp_delete_post_revision( $old_autosave->ID ); return 0; } do_action( 'wp_creating_autosave', $new_autosave ); return wp_update_post( $new_autosave ); } $post_data = wp_unslash( $post_data ); return _wp_put_post_revision( $post_data, true ); } function post_preview() { $post_ID = (int) $_POST['post_ID']; $_POST['ID'] = $post_ID; $post = get_post( $post_ID ); if ( ! $post ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! current_user_can( 'edit_post', $post->ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } $is_autosave = false; if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) ) { $saved_post_id = edit_post(); } else { $is_autosave = true; if ( isset( $_POST['post_status'] ) && 'auto-draft' === $_POST['post_status'] ) { $_POST['post_status'] = 'draft'; } $saved_post_id = wp_create_post_autosave( $post->ID ); } if ( is_wp_error( $saved_post_id ) ) { wp_die( $saved_post_id->get_error_message() ); } $query_args = array(); if ( $is_autosave && $saved_post_id ) { $query_args['preview_id'] = $post->ID; $query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID ); if ( isset( $_POST['post_format'] ) ) { $query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] ); } if ( isset( $_POST['_thumbnail_id'] ) ) { $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; } } return get_preview_post_link( $post, $query_args ); } function wp_autosave( $post_data ) { if ( ! defined( 'DOING_AUTOSAVE' ) ) { define( 'DOING_AUTOSAVE', true ); } $post_id = (int) $post_data['post_id']; $post_data['ID'] = $post_id; $post_data['post_ID'] = $post_id; if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) { return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) ); } $post = get_post( $post_id ); if ( ! current_user_can( 'edit_post', $post->ID ) ) { return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) ); } if ( 'auto-draft' === $post->post_status ) { $post_data['post_status'] = 'draft'; } if ( 'page' !== $post_data['post_type'] && ! empty( $post_data['catslist'] ) ) { $post_data['post_category'] = explode( ',', $post_data['catslist'] ); } if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status ) ) { return edit_post( wp_slash( $post_data ) ); } else { return wp_create_post_autosave( wp_slash( $post_data ) ); } } function redirect_post( $post_id = '' ) { if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) { $status = get_post_status( $post_id ); if ( isset( $_POST['publish'] ) ) { switch ( $status ) { case 'pending': $message = 8; break; case 'future': $message = 9; break; default: $message = 6; } } else { $message = 'draft' === $status ? 10 : 1; } $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) ); } elseif ( isset( $_POST['addmeta'] ) && $_POST['addmeta'] ) { $location = add_query_arg( 'message', 2, wp_get_referer() ); $location = explode( '#', $location ); $location = $location[0] . '#postcustom'; } elseif ( isset( $_POST['deletemeta'] ) && $_POST['deletemeta'] ) { $location = add_query_arg( 'message', 3, wp_get_referer() ); $location = explode( '#', $location ); $location = $location[0] . '#postcustom'; } else { $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) ); } wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ); exit; } function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) { return array_map( 'intval', $terms ); } function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { if ( ! is_array( $terms ) ) { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $terms = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } $clean_terms = array(); foreach ( $terms as $term ) { if ( empty( $term ) ) { continue; } $_term = get_terms( array( 'taxonomy' => $taxonomy, 'name' => $term, 'fields' => 'ids', 'hide_empty' => false, ) ); if ( ! empty( $_term ) ) { $clean_terms[] = (int) $_term[0]; } else { $clean_terms[] = $term; } } return $clean_terms; } function use_block_editor_for_post( $post ) { $post = get_post( $post ); if ( ! $post ) { return false; } if ( isset( $_GET['meta-box-loader'] ) ) { check_admin_referer( 'meta-box-loader', 'meta-box-loader-nonce' ); return false; } $use_block_editor = use_block_editor_for_post_type( $post->post_type ); return apply_filters( 'use_block_editor_for_post', $use_block_editor, $post ); } function use_block_editor_for_post_type( $post_type ) { if ( ! post_type_exists( $post_type ) ) { return false; } if ( ! post_type_supports( $post_type, 'editor' ) ) { return false; } $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object && ! $post_type_object->show_in_rest ) { return false; } return apply_filters( 'use_block_editor_for_post_type', true, $post_type ); } function get_block_editor_server_block_settings() { $block_registry = WP_Block_Type_Registry::get_instance(); $blocks = array(); $fields_to_pick = array( 'api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations', ); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { foreach ( $fields_to_pick as $field => $key ) { if ( ! isset( $block_type->{ $field } ) ) { continue; } if ( ! isset( $blocks[ $block_name ] ) ) { $blocks[ $block_name ] = array(); } $blocks[ $block_name ][ $key ] = $block_type->{ $field }; } } return $blocks; } function the_block_editor_meta_boxes() { global $post, $current_screen, $wp_meta_boxes; $_original_meta_boxes = $wp_meta_boxes; $wp_meta_boxes = apply_filters( 'filter_block_editor_meta_boxes', $wp_meta_boxes ); $locations = array( 'side', 'normal', 'advanced' ); $priorities = array( 'high', 'sorted', 'core', 'default', 'low' ); ?> -
          - -
          -
          - - -
          - -
          - -
          - - id ][ $location ] ) ) { continue; } foreach ( $priorities as $priority ) { if ( ! isset( $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ] ) ) { continue; } $meta_boxes = (array) $wp_meta_boxes[ $current_screen->id ][ $location ][ $priority ]; foreach ( $meta_boxes as $meta_box ) { if ( false == $meta_box || ! $meta_box['title'] ) { continue; } if ( isset( $meta_box['args']['__back_compat_meta_box'] ) && $meta_box['args']['__back_compat_meta_box'] ) { continue; } $meta_boxes_per_location[ $location ][] = array( 'id' => $meta_box['id'], 'title' => $meta_box['title'], ); } } } $script = 'window._wpLoadBlockEditor.then( function() { - wp.data.dispatch( \'core/edit-post\' ).setAvailableMetaBoxesPerLocation( ' . wp_json_encode( $meta_boxes_per_location ) . ' ); - } );'; wp_add_inline_script( 'wp-edit-post', $script ); if ( wp_script_is( 'wp-edit-post', 'done' ) ) { printf( "\n", trim( $script ) ); } $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ); if ( $enable_custom_fields ) { $script = "( function( $ ) { - if ( $('#postcustom').length ) { - $( '#the-list' ).wpList( { - addBefore: function( s ) { - s.data += '&post_id=$post->ID'; - return s; - }, - addAfter: function() { - $('table#list-table').show(); - } - }); - } - } )( jQuery );"; wp_enqueue_script( 'wp-lists' ); wp_add_inline_script( 'wp-lists', $script ); } $wp_meta_boxes = $_original_meta_boxes; } function the_block_editor_meta_box_post_form_hidden_fields( $post ) { $form_extra = ''; if ( 'auto-draft' === $post->post_status ) { $form_extra .= ""; } $form_action = 'editpost'; $nonce_action = 'update-post_' . $post->ID; $form_extra .= ""; $referer = wp_get_referer(); $current_user = wp_get_current_user(); $user_id = $current_user->ID; wp_nonce_field( $nonce_action ); ob_start(); do_action( 'edit_form_after_title', $post ); do_action( 'edit_form_advanced', $post ); $classic_output = ob_get_clean(); $classic_elements = wp_html_split( $classic_output ); $hidden_inputs = ''; foreach ( $classic_elements as $element ) { if ( 0 !== strpos( $element, ' - - - - - - - - '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false, ); $args = wp_parse_args( $args, $defaults ); if ( $args['skip_header_footer'] ) { $this->done_header = true; $this->done_footer = true; $this->display_footer_actions = false; } parent::__construct( $args ); } public function before() { $name = $this->upgrader->get_name_for_update( $this->language_update ); echo '
          '; printf( '

          ' . __( 'Updating translations for %1$s (%2$s)…' ) . '

          ', $name, $this->language_update->language ); } public function error( $errors ) { echo '
          '; parent::error( $errors ); echo '
          '; } public function after() { echo '
          '; } public function bulk_footer() { $this->decrement_update_count( 'translation' ); $update_actions = array( 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), __( 'Go to WordPress Updates page' ) ), ); $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); if ( $update_actions && $this->display_footer_actions ) { $this->feedback( implode( ' | ', $update_actions ) ); } } } is_vcs_checkout( WP_CONTENT_DIR ) ) { return; } foreach ( $language_updates as $key => $language_update ) { $update = ! empty( $language_update->autoupdate ); $update = apply_filters( 'async_update_translation', $update, $language_update ); if ( ! $update ) { unset( $language_updates[ $key ] ); } } if ( empty( $language_updates ) ) { return; } if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) { $skin = $upgrader->skin; } else { $skin = new Language_Pack_Upgrader_Skin( array( 'skip_header_footer' => true, ) ); } $lp_upgrader = new Language_Pack_Upgrader( $skin ); $lp_upgrader->bulk_upgrade( $language_updates ); } public function upgrade_strings() { $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while they are updated as well.' ); $this->strings['up_to_date'] = __( 'Your translations are all up to date.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['process_failed'] = __( 'Translation update failed.' ); $this->strings['process_success'] = __( 'Translation updated successfully.' ); $this->strings['remove_old'] = __( 'Removing the old version of the translation…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old translation.' ); } public function upgrade( $update = false, $args = array() ) { if ( $update ) { $update = array( $update ); } $results = $this->bulk_upgrade( $update, $args ); if ( ! is_array( $results ) ) { return $results; } return $results[0]; } public function bulk_upgrade( $language_updates = array(), $args = array() ) { global $wp_filesystem; $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); if ( ! $language_updates ) { $language_updates = wp_get_translation_updates(); } if ( empty( $language_updates ) ) { $this->skin->header(); $this->skin->set_result( true ); $this->skin->feedback( 'up_to_date' ); $this->skin->bulk_footer(); $this->skin->footer(); return true; } if ( 'upgrader_process_complete' === current_filter() ) { $this->skin->feedback( 'starting_upgrade' ); } remove_all_filters( 'upgrader_pre_install' ); remove_all_filters( 'upgrader_clear_destination' ); remove_all_filters( 'upgrader_post_install' ); remove_all_filters( 'upgrader_source_selection' ); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $results = array(); $this->update_count = count( $language_updates ); $this->update_current = 0; $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR ); if ( ! $wp_filesystem->exists( $remote_destination ) ) { if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination ); } } $language_updates_results = array(); foreach ( $language_updates as $language_update ) { $this->skin->language_update = $language_update; $destination = WP_LANG_DIR; if ( 'plugin' === $language_update->type ) { $destination .= '/plugins'; } elseif ( 'theme' === $language_update->type ) { $destination .= '/themes'; } $this->update_current++; $options = array( 'package' => $language_update->package, 'destination' => $destination, 'clear_destination' => true, 'abort_if_destination_exists' => false, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'language_update_type' => $language_update->type, 'language_update' => $language_update, ), ); $result = $this->run( $options ); $results[] = $this->result; if ( false === $result ) { break; } $language_updates_results[] = array( 'language' => $language_update->language, 'type' => $language_update->type, 'slug' => isset( $language_update->slug ) ? $language_update->slug : 'default', 'version' => $language_update->version, ); } remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); remove_action( 'upgrader_process_complete', 'wp_version_check' ); remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); remove_action( 'upgrader_process_complete', 'wp_update_themes' ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'translation', 'bulk' => true, 'translations' => $language_updates_results, ) ); add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); if ( $parsed_args['clear_update_cache'] ) { wp_clean_update_cache(); } return $results; } public function check_package( $source, $remote_source ) { global $wp_filesystem; if ( is_wp_error( $source ) ) { return $source; } $files = $wp_filesystem->dirlist( $remote_source ); $po = false; $mo = false; foreach ( (array) $files as $file => $filedata ) { if ( '.po' === substr( $file, -3 ) ) { $po = true; } elseif ( '.mo' === substr( $file, -3 ) ) { $mo = true; } } if ( ! $mo || ! $po ) { return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'], sprintf( __( 'The language pack is missing either the %1$s or %2$s files.' ), '.po', '.mo' ) ); } return $source; } public function get_name_for_update( $update ) { switch ( $update->type ) { case 'core': return 'WordPress'; case 'theme': $theme = wp_get_theme( $update->slug ); if ( $theme->exists() ) { return $theme->Get( 'Name' ); } break; case 'plugin': $plugin_data = get_plugins( '/' . $update->slug ); $plugin_data = reset( $plugin_data ); if ( $plugin_data ) { return $plugin_data['Name']; } break; } return ''; } public function clear_destination( $remote_destination ) { global $wp_filesystem; $language_update = $this->skin->language_update; $language_directory = WP_LANG_DIR . '/'; if ( 'core' === $language_update->type ) { $files = array( $remote_destination . $language_update->language . '.po', $remote_destination . $language_update->language . '.mo', $remote_destination . 'admin-' . $language_update->language . '.po', $remote_destination . 'admin-' . $language_update->language . '.mo', $remote_destination . 'admin-network-' . $language_update->language . '.po', $remote_destination . 'admin-network-' . $language_update->language . '.mo', $remote_destination . 'continents-cities-' . $language_update->language . '.po', $remote_destination . 'continents-cities-' . $language_update->language . '.mo', ); $json_translation_files = glob( $language_directory . $language_update->language . '-*.json' ); if ( $json_translation_files ) { foreach ( $json_translation_files as $json_translation_file ) { $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); } } } else { $files = array( $remote_destination . $language_update->slug . '-' . $language_update->language . '.po', $remote_destination . $language_update->slug . '-' . $language_update->language . '.mo', ); $language_directory = $language_directory . $language_update->type . 's/'; $json_translation_files = glob( $language_directory . $language_update->slug . '-' . $language_update->language . '-*.json' ); if ( $json_translation_files ) { foreach ( $json_translation_files as $json_translation_file ) { $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); } } } $files = array_filter( $files, array( $wp_filesystem, 'exists' ) ); if ( ! $files ) { return true; } $unwritable_files = array(); foreach ( $files as $file ) { if ( ! $wp_filesystem->is_writable( $file ) ) { $wp_filesystem->chmod( $file, FS_CHMOD_FILE ); if ( ! $wp_filesystem->is_writable( $file ) ) { $unwritable_files[] = $file; } } } if ( ! empty( $unwritable_files ) ) { return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) ); } foreach ( $files as $file ) { if ( ! $wp_filesystem->delete( $file ) ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } } return true; } } 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '', 'overwrite' => '', ); $args = wp_parse_args( $args, $defaults ); $this->type = $args['type']; $this->url = $args['url']; $this->api = isset( $args['api'] ) ? $args['api'] : array(); $this->overwrite = $args['overwrite']; parent::__construct( $args ); } public function before() { if ( ! empty( $this->api ) ) { $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version ); } } public function hide_process_failed( $wp_error ) { if ( 'upload' === $this->type && '' === $this->overwrite && $wp_error->get_error_code() === 'folder_exists' ) { return true; } return false; } public function after() { if ( $this->do_overwrite() ) { return; } $plugin_file = $this->upgrader->plugin_info(); $install_actions = array(); $from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins'; if ( 'import' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin & Run Importer' ) ); } elseif ( 'press-this' === $from ) { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin & Go to Press This' ) ); } else { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Activate Plugin' ) ); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $install_actions['network_activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&networkwide=1&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), __( 'Network Activate' ) ); unset( $install_actions['activate_plugin'] ); } if ( 'import' === $from ) { $install_actions['importers_page'] = sprintf( '%s', admin_url( 'import.php' ), __( 'Go to Importers' ) ); } elseif ( 'web' === $this->type ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), __( 'Go to Plugin Installer' ) ); } elseif ( 'upload' === $this->type && 'plugins' === $from ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), __( 'Go to Plugin Installer' ) ); } else { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugins.php' ), __( 'Go to Plugins page' ) ); } if ( ! $this->result || is_wp_error( $this->result ) ) { unset( $install_actions['activate_plugin'], $install_actions['network_activate'] ); } elseif ( ! current_user_can( 'activate_plugin', $plugin_file ) || is_plugin_active( $plugin_file ) ) { unset( $install_actions['activate_plugin'] ); } $install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file ); if ( ! empty( $install_actions ) ) { $this->feedback( implode( ' ', (array) $install_actions ) ); } } private function do_overwrite() { if ( 'upload' !== $this->type || ! is_wp_error( $this->result ) || 'folder_exists' !== $this->result->get_error_code() ) { return false; } $folder = $this->result->get_error_data( 'folder_exists' ); $folder = ltrim( substr( $folder, strlen( WP_PLUGIN_DIR ) ), '/' ); $current_plugin_data = false; $all_plugins = get_plugins(); foreach ( $all_plugins as $plugin => $plugin_data ) { if ( strrpos( $plugin, $folder ) !== 0 ) { continue; } $current_plugin_data = $plugin_data; } $new_plugin_data = $this->upgrader->new_plugin_data; if ( ! $current_plugin_data || ! $new_plugin_data ) { return false; } echo '

          ' . esc_html__( 'This plugin is already installed.' ) . '

          '; $this->is_downgrading = version_compare( $current_plugin_data['Version'], $new_plugin_data['Version'], '>' ); $rows = array( 'Name' => __( 'Plugin name' ), 'Version' => __( 'Version' ), 'Author' => __( 'Author' ), 'RequiresWP' => __( 'Required WordPress version' ), 'RequiresPHP' => __( 'Required PHP version' ), ); $table = ''; $table .= ''; $table .= ''; $is_same_plugin = true; foreach ( $rows as $field => $label ) { $old_value = ! empty( $current_plugin_data[ $field ] ) ? (string) $current_plugin_data[ $field ] : '-'; $new_value = ! empty( $new_plugin_data[ $field ] ) ? (string) $new_plugin_data[ $field ] : '-'; $is_same_plugin = $is_same_plugin && ( $old_value === $new_value ); $diff_field = ( 'Version' !== $field && $new_value !== $old_value ); $diff_version = ( 'Version' === $field && $this->is_downgrading ); $table .= ''; $table .= ( $diff_field || $diff_version ) ? ''; } $table .= '
          ' . esc_html_x( 'Current', 'plugin' ) . '' . esc_html_x( 'Uploaded', 'plugin' ) . '
          ' . $label . '' . wp_strip_all_tags( $old_value ) . '' : ''; $table .= wp_strip_all_tags( $new_value ) . '
          '; echo apply_filters( 'install_plugin_overwrite_comparison', $table, $current_plugin_data, $new_plugin_data ); $install_actions = array(); $can_update = true; $blocked_message = '

          ' . esc_html__( 'The plugin cannot be updated due to the following:' ) . '

          '; $blocked_message .= '
            '; $requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null; $requires_wp = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), phpversion(), $requires_php ); $blocked_message .= '
          • ' . esc_html( $error ) . '
          • '; $can_update = false; } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), get_bloginfo( 'version' ), $requires_wp ); $blocked_message .= '
          • ' . esc_html( $error ) . '
          • '; $can_update = false; } $blocked_message .= '
          '; if ( $can_update ) { if ( $this->is_downgrading ) { $warning = sprintf( __( 'You are uploading an older version of a current plugin. You can continue to install the older version, but be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } else { $warning = sprintf( __( 'You are updating a plugin. Be sure to back up your database and files first.' ), __( 'https://wordpress.org/support/article/wordpress-backups/' ) ); } echo '

          ' . $warning . '

          '; $overwrite = $this->is_downgrading ? 'downgrade-plugin' : 'update-plugin'; $install_actions['overwrite_plugin'] = sprintf( '%s', wp_nonce_url( add_query_arg( 'overwrite', $overwrite, $this->url ), 'plugin-upload' ), _x( 'Replace current with uploaded', 'plugin' ) ); } else { echo $blocked_message; } $cancel_url = add_query_arg( 'action', 'upload-plugin-cancel-overwrite', $this->url ); $install_actions['plugins_page'] = sprintf( '%s', wp_nonce_url( $cancel_url, 'plugin-upload-cancel-overwrite' ), __( 'Cancel and go back' ) ); $install_actions = apply_filters( 'install_plugin_overwrite_actions', $install_actions, $this->api, $new_plugin_data ); if ( ! empty( $install_actions ) ) { printf( '', __( 'The uploaded file has expired. Please go back and upload it again.' ) ); echo '

          ' . implode( ' ', (array) $install_actions ) . '

          '; } return true; } } zipname = $p_zipname; $this->zip_fd = 0; $this->magic_quotes_status = -1; return; } public function PclZip($p_zipname) { self::__construct($p_zipname); } function create($p_filelist) { $v_result=1; $this->privErrorReset(); $v_options = array(); $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_size = func_num_args(); if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_ADD => 'optional', PCLZIP_CB_POST_ADD => 'optional', PCLZIP_OPT_NO_COMPRESSION => 'optional', PCLZIP_OPT_COMMENT => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } } else { $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; if ($v_size == 2) { $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $v_string_list = array(); $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); if (is_array($p_filelist)) { if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } else { $v_string_list = $p_filelist; } } else if (is_string($p_filelist)) { $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); return 0; } if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { if ($v_string != '') { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } else { } } } $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); if ($v_result != 1) { return 0; } } $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); if ($v_result != 1) { return 0; } $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); if ($v_result != 1) { return 0; } return $p_result_list; } function add($p_filelist) { $v_result=1; $this->privErrorReset(); $v_options = array(); $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; $v_size = func_num_args(); if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_ADD => 'optional', PCLZIP_CB_POST_ADD => 'optional', PCLZIP_OPT_NO_COMPRESSION => 'optional', PCLZIP_OPT_COMMENT => 'optional', PCLZIP_OPT_ADD_COMMENT => 'optional', PCLZIP_OPT_PREPEND_COMMENT => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } } else { $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; if ($v_size == 2) { $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $v_string_list = array(); $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); if (is_array($p_filelist)) { if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } else { $v_string_list = $p_filelist; } } else if (is_string($p_filelist)) { $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); return 0; } if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } } $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); if ($v_result != 1) { return 0; } } $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); if ($v_result != 1) { return 0; } $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); if ($v_result != 1) { return 0; } return $p_result_list; } function listContent() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $p_list = array(); if (($v_result = $this->privList($p_list)) != 1) { unset($p_list); return(0); } return $p_list; } function extract() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_path = ''; $v_remove_path = ""; $v_remove_all_path = false; $v_size = func_num_args(); $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; if ($v_size > 0) { $v_arg_list = func_get_args(); if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_PATH => 'optional', PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_EXTRACT => 'optional', PCLZIP_CB_POST_EXTRACT => 'optional', PCLZIP_OPT_SET_CHMOD => 'optional', PCLZIP_OPT_BY_NAME => 'optional', PCLZIP_OPT_BY_EREG => 'optional', PCLZIP_OPT_BY_PREG => 'optional', PCLZIP_OPT_BY_INDEX => 'optional', PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', PCLZIP_OPT_REPLACE_NEWER => 'optional' ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } if (isset($v_options[PCLZIP_OPT_PATH])) { $v_path = $v_options[PCLZIP_OPT_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { $v_path .= '/'; } $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; } } else { $v_path = $v_arg_list[0]; if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $this->privOptionDefaultThreshold($v_options); $p_list = array(); $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options); if ($v_result < 1) { unset($p_list); return(0); } return $p_list; } function extractByIndex($p_index) { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_path = ''; $v_remove_path = ""; $v_remove_all_path = false; $v_size = func_num_args(); $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; if ($v_size > 1) { $v_arg_list = func_get_args(); array_shift($v_arg_list); $v_size--; if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_PATH => 'optional', PCLZIP_OPT_REMOVE_PATH => 'optional', PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', PCLZIP_OPT_ADD_PATH => 'optional', PCLZIP_CB_PRE_EXTRACT => 'optional', PCLZIP_CB_POST_EXTRACT => 'optional', PCLZIP_OPT_SET_CHMOD => 'optional', PCLZIP_OPT_REPLACE_NEWER => 'optional' ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' )); if ($v_result != 1) { return 0; } if (isset($v_options[PCLZIP_OPT_PATH])) { $v_path = $v_options[PCLZIP_OPT_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; } if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { $v_path .= '/'; } $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; } if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; } else { } } else { $v_path = $v_arg_list[0]; if ($v_size == 2) { $v_remove_path = $v_arg_list[1]; } else if ($v_size > 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); return 0; } } } $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); $v_options_trick = array(); $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional' )); if ($v_result != 1) { return 0; } $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; $this->privOptionDefaultThreshold($v_options); if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { return(0); } return $p_list; } function delete() { $v_result=1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } $v_options = array(); $v_size = func_num_args(); if ($v_size > 0) { $v_arg_list = func_get_args(); $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (PCLZIP_OPT_BY_NAME => 'optional', PCLZIP_OPT_BY_EREG => 'optional', PCLZIP_OPT_BY_PREG => 'optional', PCLZIP_OPT_BY_INDEX => 'optional' )); if ($v_result != 1) { return 0; } } $this->privDisableMagicQuotes(); $v_list = array(); if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { $this->privSwapBackMagicQuotes(); unset($v_list); return(0); } $this->privSwapBackMagicQuotes(); return $v_list; } function deleteByIndex($p_index) { $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); return $p_list; } function properties() { $this->privErrorReset(); $this->privDisableMagicQuotes(); if (!$this->privCheckFormat()) { $this->privSwapBackMagicQuotes(); return(0); } $v_prop = array(); $v_prop['comment'] = ''; $v_prop['nb'] = 0; $v_prop['status'] = 'not_exist'; if (@is_file($this->zipname)) { if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); return 0; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privSwapBackMagicQuotes(); return 0; } $this->privCloseFd(); $v_prop['comment'] = $v_central_dir['comment']; $v_prop['nb'] = $v_central_dir['entries']; $v_prop['status'] = 'ok'; } $this->privSwapBackMagicQuotes(); return $v_prop; } function duplicate($p_archive) { $v_result = 1; $this->privErrorReset(); if (is_object($p_archive) && $p_archive instanceof pclzip) { $v_result = $this->privDuplicate($p_archive->zipname); } else if (is_string($p_archive)) { if (!is_file($p_archive)) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); $v_result = PCLZIP_ERR_MISSING_FILE; } else { $v_result = $this->privDuplicate($p_archive); } } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); $v_result = PCLZIP_ERR_INVALID_PARAMETER; } return $v_result; } function merge($p_archive_to_add) { $v_result = 1; $this->privErrorReset(); if (!$this->privCheckFormat()) { return(0); } if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip) { $v_result = $this->privMerge($p_archive_to_add); } else if (is_string($p_archive_to_add)) { $v_object_archive = new PclZip($p_archive_to_add); $v_result = $this->privMerge($v_object_archive); } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); $v_result = PCLZIP_ERR_INVALID_PARAMETER; } return $v_result; } function errorCode() { if (PCLZIP_ERROR_EXTERNAL == 1) { return(PclErrorCode()); } else { return($this->error_code); } } function errorName($p_with_code=false) { $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE' ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' ); if (isset($v_name[$this->error_code])) { $v_value = $v_name[$this->error_code]; } else { $v_value = 'NoName'; } if ($p_with_code) { return($v_value.' ('.$this->error_code.')'); } else { return($v_value); } } function errorInfo($p_full=false) { if (PCLZIP_ERROR_EXTERNAL == 1) { return(PclErrorString()); } else { if ($p_full) { return($this->errorName(true)." : ".$this->error_string); } else { return($this->error_string." [code ".$this->error_code."]"); } } } function privCheckFormat($p_level=0) { $v_result = true; clearstatcache(); $this->privErrorReset(); if (!is_file($this->zipname)) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); return(false); } if (!is_readable($this->zipname)) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); return(false); } return $v_result; } function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) { $v_result=1; $i=0; while ($i<$p_size) { if (!isset($v_requested_options[$p_options_list[$i]])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); return PclZip::errorCode(); } switch ($p_options_list[$i]) { case PCLZIP_OPT_PATH : case PCLZIP_OPT_REMOVE_PATH : case PCLZIP_OPT_ADD_PATH : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); $i++; break; case PCLZIP_OPT_TEMP_FILE_THRESHOLD : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } $v_value = $p_options_list[$i+1]; if ((!is_integer($v_value)) || ($v_value<0)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $v_value*1048576; $i++; break; case PCLZIP_OPT_TEMP_FILE_ON : if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = true; break; case PCLZIP_OPT_TEMP_FILE_OFF : if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); return PclZip::errorCode(); } if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = true; break; case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if ( is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) { $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); $i++; } else { } break; case PCLZIP_OPT_BY_NAME : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; } else if (is_array($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_BY_EREG : $p_options_list[$i] = PCLZIP_OPT_BY_PREG; case PCLZIP_OPT_BY_PREG : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_COMMENT : case PCLZIP_OPT_ADD_COMMENT : case PCLZIP_OPT_PREPEND_COMMENT : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'"); return PclZip::errorCode(); } if (is_string($p_options_list[$i+1])) { $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'"); return PclZip::errorCode(); } $i++; break; case PCLZIP_OPT_BY_INDEX : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_work_list = array(); if (is_string($p_options_list[$i+1])) { $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); $v_work_list = explode(",", $p_options_list[$i+1]); } else if (is_integer($p_options_list[$i+1])) { $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; } else if (is_array($p_options_list[$i+1])) { $v_work_list = $p_options_list[$i+1]; } else { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_sort_flag=false; $v_sort_value=0; for ($j=0; $j= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; $i++; break; case PCLZIP_CB_PRE_EXTRACT : case PCLZIP_CB_POST_EXTRACT : case PCLZIP_CB_PRE_ADD : case PCLZIP_CB_POST_ADD : if (($i+1) >= $p_size) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_function_name = $p_options_list[$i+1]; if (!function_exists($v_function_name)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } $v_result_list[$p_options_list[$i]] = $v_function_name; $i++; break; default : PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" .$p_options_list[$i]."'"); return PclZip::errorCode(); } $i++; } if ($v_requested_options !== false) { for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { if ($v_requested_options[$key] == 'mandatory') { if (!isset($v_result_list[$key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); return PclZip::errorCode(); } } } } if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { } return $v_result; } function privOptionDefaultThreshold(&$p_options) { $v_result=1; if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { return $v_result; } $v_memory_limit = ini_get('memory_limit'); $v_memory_limit = trim($v_memory_limit); $v_memory_limit_int = (int) $v_memory_limit; $last = strtolower(substr($v_memory_limit, -1)); if($last == 'g') $v_memory_limit_int = $v_memory_limit_int*1073741824; if($last == 'm') $v_memory_limit_int = $v_memory_limit_int*1048576; if($last == 'k') $v_memory_limit_int = $v_memory_limit_int*1024; $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO); if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); } return $v_result; } function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) { $v_result=1; foreach ($p_file_list as $v_key => $v_value) { if (!isset($v_requested_options[$v_key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); return PclZip::errorCode(); } switch ($v_key) { case PCLZIP_ATT_FILE_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['filename'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_NEW_SHORT_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['new_short_name'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_NEW_FULL_NAME : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); if ($p_filedescr['new_full_name'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } break; case PCLZIP_ATT_FILE_COMMENT : if (!is_string($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['comment'] = $v_value; break; case PCLZIP_ATT_FILE_MTIME : if (!is_integer($v_value)) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); } $p_filedescr['mtime'] = $v_value; break; case PCLZIP_ATT_FILE_CONTENT : $p_filedescr['content'] = $v_value; break; default : PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'"); return PclZip::errorCode(); } if ($v_requested_options !== false) { for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { if ($v_requested_options[$key] == 'mandatory') { if (!isset($p_file_list[$key])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); return PclZip::errorCode(); } } } } } return $v_result; } function privFileDescrExpand(&$p_filedescr_list, &$p_options) { $v_result=1; $v_result_list = array(); for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options); $v_result_list[sizeof($v_result_list)] = $v_descr; if ($v_descr['type'] == 'folder') { $v_dirlist_descr = array(); $v_dirlist_nb = 0; if ($v_folder_handler = @opendir($v_descr['filename'])) { while (($v_item_handler = @readdir($v_folder_handler)) !== false) { if (($v_item_handler == '.') || ($v_item_handler == '..')) { continue; } $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; if (($v_descr['stored_filename'] != $v_descr['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { if ($v_descr['stored_filename'] != '') { $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; } else { $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; } } $v_dirlist_nb++; } @closedir($v_folder_handler); } else { } if ($v_dirlist_nb != 0) { if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { return $v_result; } $v_result_list = array_merge($v_result_list, $v_dirlist_descr); } else { } unset($v_dirlist_descr); } } $p_filedescr_list = $v_result_list; return $v_result; } function privCreate($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); $this->privDisableMagicQuotes(); if (($v_result = $this->privOpenFd('wb')) != 1) { return $v_result; } $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privAdd($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); return $v_result; } $this->privDisableMagicQuotes(); if (($v_result=$this->privOpenFd('rb')) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } @rewind($this->zip_fd); $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = $v_central_dir['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $v_header_list = array(); if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { fclose($v_zip_temp_fd); $this->privCloseFd(); @unlink($v_zip_temp_name); $this->privSwapBackMagicQuotes(); return $v_result; } $v_offset = @ftell($this->zip_fd); $v_size = $v_central_dir['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_zip_temp_fd, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { fclose($v_zip_temp_fd); $this->privCloseFd(); @unlink($v_zip_temp_name); $this->privSwapBackMagicQuotes(); return $v_result; } $v_count++; } $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = $v_central_dir['comment']; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; } if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; } $v_size = @ftell($this->zip_fd)-$v_offset; if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); $this->privSwapBackMagicQuotes(); return $v_result; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $this->privCloseFd(); @fclose($v_zip_temp_fd); $this->privSwapBackMagicQuotes(); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); return $v_result; } function privOpenFd($p_mode) { $v_result=1; if ($this->zip_fd != 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); return PclZip::errorCode(); } if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); return PclZip::errorCode(); } return $v_result; } function privCloseFd() { $v_result=1; if ($this->zip_fd != 0) @fclose($this->zip_fd); $this->zip_fd = 0; return $v_result; } function privAddList($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_header_list = array(); if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { return $v_result; } $v_offset = @ftell($this->zip_fd); for ($i=0,$v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { return $v_result; } $v_count++; } $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = ''; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } $v_size = @ftell($this->zip_fd)-$v_offset; if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); return $v_result; } return $v_result; } function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) { $v_result=1; $v_header = array(); $v_nb = sizeof($p_result_list); for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, $p_options); if ($v_result != 1) { return $v_result; } $p_result_list[$v_nb++] = $v_header; } } return $v_result; } function privAddFile($p_filedescr, &$p_header, &$p_options) { $v_result=1; $p_filename = $p_filedescr['filename']; if ($p_filename == "") { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); return PclZip::errorCode(); } clearstatcache(); $p_header['version'] = 20; $p_header['version_extracted'] = 10; $p_header['flag'] = 0; $p_header['compression'] = 0; $p_header['crc'] = 0; $p_header['compressed_size'] = 0; $p_header['filename_len'] = strlen($p_filename); $p_header['extra_len'] = 0; $p_header['disk'] = 0; $p_header['internal'] = 0; $p_header['offset'] = 0; $p_header['filename'] = $p_filename; $p_header['stored_filename'] = $p_filedescr['stored_filename']; $p_header['extra'] = ''; $p_header['status'] = 'ok'; $p_header['index'] = -1; if ($p_filedescr['type']=='file') { $p_header['external'] = 0x00000000; $p_header['size'] = filesize($p_filename); } else if ($p_filedescr['type']=='folder') { $p_header['external'] = 0x00000010; $p_header['mtime'] = filemtime($p_filename); $p_header['size'] = filesize($p_filename); } else if ($p_filedescr['type'] == 'virtual_file') { $p_header['external'] = 0x00000000; $p_header['size'] = strlen($p_filedescr['content']); } if (isset($p_filedescr['mtime'])) { $p_header['mtime'] = $p_filedescr['mtime']; } else if ($p_filedescr['type'] == 'virtual_file') { $p_header['mtime'] = time(); } else { $p_header['mtime'] = filemtime($p_filename); } if (isset($p_filedescr['comment'])) { $p_header['comment_len'] = strlen($p_filedescr['comment']); $p_header['comment'] = $p_filedescr['comment']; } else { $p_header['comment_len'] = 0; $p_header['comment'] = ''; } if (isset($p_options[PCLZIP_CB_PRE_ADD])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_header, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); if ($v_result == 0) { $p_header['status'] = "skipped"; $v_result = 1; } if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); } } if ($p_header['stored_filename'] == "") { $p_header['status'] = "filtered"; } if (strlen($p_header['stored_filename']) > 0xFF) { $p_header['status'] = 'filename_too_long'; } if ($p_header['status'] == 'ok') { if ($p_filedescr['type'] == 'file') { if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); if ($v_result < PCLZIP_ERR_NO_ERROR) { return $v_result; } } else { if (($v_file = @fopen($p_filename, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); return PclZip::errorCode(); } if ($p_header['size'] > 0) { $v_content = @fread($v_file, $p_header['size']); } else { $v_content = ''; } @fclose($v_file); $p_header['crc'] = @crc32($v_content); if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } else { $v_content = @gzdeflate($v_content); $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); return $v_result; } @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); } } else if ($p_filedescr['type'] == 'virtual_file') { $v_content = $p_filedescr['content']; $p_header['crc'] = @crc32($v_content); if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } else { $v_content = @gzdeflate($v_content); $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); return $v_result; } @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); } else if ($p_filedescr['type'] == 'folder') { if (@substr($p_header['stored_filename'], -1) != '/') { $p_header['stored_filename'] .= '/'; } $p_header['size'] = 0; $p_header['external'] = 0x00000010; if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { return $v_result; } } } if (isset($p_options[PCLZIP_CB_POST_ADD])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_header, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); if ($v_result == 0) { $v_result = 1; } } return $v_result; } function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) { $v_result=PCLZIP_ERR_NO_ERROR; $p_filename = $p_filedescr['filename']; if (($v_file = @fopen($p_filename, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); return PclZip::errorCode(); } $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { fclose($v_file); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = filesize($p_filename); while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_file, $v_read_size); @gzputs($v_file_compressed, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_file); @gzclose($v_file_compressed); if (filesize($v_gzip_temp_name) < 18) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); return PclZip::errorCode(); } if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } $v_binary_data = @fread($v_file_compressed, 10); $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); $v_data_header['os'] = bin2hex($v_data_header['os']); @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); $v_binary_data = @fread($v_file_compressed, 8); $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); $p_header['compression'] = ord($v_data_header['cm']); $p_header['crc'] = $v_data_footer['crc']; $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; @fclose($v_file_compressed); if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { return $v_result; } if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } fseek($v_file_compressed, 10); $v_size = $p_header['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_file_compressed, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_file_compressed); @unlink($v_gzip_temp_name); return $v_result; } function privCalculateStoredFilename(&$p_filedescr, &$p_options) { $v_result=1; $p_filename = $p_filedescr['filename']; if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; } else { $p_add_dir = ''; } if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; } else { $p_remove_dir = ''; } if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; } else { $p_remove_all_dir = 0; } if (isset($p_filedescr['new_full_name'])) { $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); } else { if (isset($p_filedescr['new_short_name'])) { $v_path_info = pathinfo($p_filename); $v_dir = ''; if ($v_path_info['dirname'] != '') { $v_dir = $v_path_info['dirname'].'/'; } $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; } else { $v_stored_filename = $p_filename; } if ($p_remove_all_dir) { $v_stored_filename = basename($p_filename); } else if ($p_remove_dir != "") { if (substr($p_remove_dir, -1) != '/') $p_remove_dir .= "/"; if ( (substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { if ( (substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { $p_remove_dir = "./".$p_remove_dir; } if ( (substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { $p_remove_dir = substr($p_remove_dir, 2); } } $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename); if ($v_compare > 0) { if ($v_compare == 2) { $v_stored_filename = ""; } else { $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir)); } } } $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); if ($p_add_dir != "") { if (substr($p_add_dir, -1) == "/") $v_stored_filename = $p_add_dir.$v_stored_filename; else $v_stored_filename = $p_add_dir."/".$v_stored_filename; } } $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); $p_filedescr['stored_filename'] = $v_stored_filename; return $v_result; } function privWriteFileHeader(&$p_header) { $v_result=1; $p_header['offset'] = ftell($this->zip_fd); $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); fputs($this->zip_fd, $v_binary_data, 30); if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } return $v_result; } function privWriteCentralFileHeader(&$p_header) { $v_result=1; $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); fputs($this->zip_fd, $v_binary_data, 46); if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } if ($p_header['comment_len'] != 0) { fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); } return $v_result; } function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) { $v_result=1; $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); fputs($this->zip_fd, $v_binary_data, 22); if (strlen($p_comment) != 0) { fputs($this->zip_fd, $p_comment, strlen($p_comment)); } return $v_result; } function privList(&$p_list) { $v_result=1; $this->privDisableMagicQuotes(); if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); return PclZip::errorCode(); } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_central_dir['offset'])) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } for ($i=0; $i<$v_central_dir['entries']; $i++) { if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_header['index'] = $i; $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); unset($v_header); } $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privConvertHeader2FileInfo($p_header, &$p_info) { $v_result=1; $v_temp_path = PclZipUtilPathReduction($p_header['filename']); $p_info['filename'] = $v_temp_path; $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); $p_info['stored_filename'] = $v_temp_path; $p_info['size'] = $p_header['size']; $p_info['compressed_size'] = $p_header['compressed_size']; $p_info['mtime'] = $p_header['mtime']; $p_info['comment'] = $p_header['comment']; $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); $p_info['index'] = $p_header['index']; $p_info['status'] = $p_header['status']; $p_info['crc'] = $p_header['crc']; return $v_result; } function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) { $v_result=1; $this->privDisableMagicQuotes(); if ( ($p_path == "") || ( (substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path,1,2)!=":/"))) $p_path = "./".$p_path; if (($p_path != "./") && ($p_path != "/")) { while (substr($p_path, -1) == "/") { $p_path = substr($p_path, 0, strlen($p_path)-1); } } if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { $p_remove_path .= '/'; } $p_remove_path_size = strlen($p_remove_path); if (($v_result = $this->privOpenFd('rb')) != 1) { $this->privSwapBackMagicQuotes(); return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_pos_entry = $v_central_dir['offset']; $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_pos_entry)) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_header = array(); if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_header['index'] = $i; $v_pos_entry = ftell($this->zip_fd); $v_extract = false; if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_extract = true; } } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { $v_extract = true; } } } else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { $v_extract = true; } } else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_extract = true; } if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { $j_start = $j+1; } if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { break; } } } else { $v_extract = true; } if ( ($v_extract) && ( ($v_header['compression'] != 8) && ($v_header['compression'] != 0))) { $v_header['status'] = 'unsupported_compression'; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is " ."compressed by an unsupported compression " ."method (".$v_header['compression'].") "); return PclZip::errorCode(); } } if (($v_extract) && (($v_header['flag'] & 1) == 1)) { $v_header['status'] = 'unsupported_encryption'; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for " ." filename '".$v_header['stored_filename'] ."'"); return PclZip::errorCode(); } } if (($v_extract) && ($v_header['status'] != 'ok')) { $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]); if ($v_result != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $v_extract = false; } if ($v_extract) { @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_header['offset'])) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { $v_string = ''; $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } $p_file_list[$v_nb_extracted]['content'] = $v_string; $v_nb_extracted++; if ($v_result1 == 2) { break; } } elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } if ($v_result1 == 2) { break; } } else { $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result1; } if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } if ($v_result1 == 2) { break; } } } } $this->privCloseFd(); $this->privSwapBackMagicQuotes(); return $v_result; } function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) { $v_result=1; if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if ($p_remove_all_path == true) { if (($p_entry['external']&0x00000010)==0x00000010) { $p_entry['status'] = "filtered"; return $v_result; } $p_entry['filename'] = basename($p_entry['filename']); } else if ($p_remove_path != "") { if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { $p_entry['status'] = "filtered"; return $v_result; } $p_remove_path_size = strlen($p_remove_path); if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) { $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); } } if ($p_path != '') { $p_entry['filename'] = $p_path."/".$p_entry['filename']; } if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); if ($v_inclusion == 0) { PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is " ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); return PclZip::errorCode(); } } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (file_exists($p_entry['filename'])) { if (is_dir($p_entry['filename'])) { $p_entry['status'] = "already_a_directory"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is " ."already used by an existing directory"); return PclZip::errorCode(); } } else if (!is_writeable($p_entry['filename'])) { $p_entry['status'] = "write_protected"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists " ."and is write protected"); return PclZip::errorCode(); } } else if (filemtime($p_entry['filename']) > $p_entry['mtime']) { if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { } else { $p_entry['status'] = "newer_exist"; if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists " ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); return PclZip::errorCode(); } } } else { } } else { if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) $v_dir_to_check = $p_entry['filename']; else if (!strstr($p_entry['filename'], "/")) $v_dir_to_check = ""; else $v_dir_to_check = dirname($p_entry['filename']); if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { $p_entry['status'] = "path_creation_fail"; $v_result = 1; } } } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compression'] == 0) { if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } $v_size = $p_entry['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } fclose($v_dest_file); touch($p_entry['filename'], $p_entry['mtime']); } else { if (($p_entry['flag'] & 1) == 1) { PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); return PclZip::errorCode(); } if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); if ($v_result < PCLZIP_ERR_NO_ERROR) { return $v_result; } } else { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } $v_file_content = @gzinflate($v_buffer); unset($v_buffer); if ($v_file_content === FALSE) { $p_entry['status'] = "error"; return $v_result; } if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } @fwrite($v_dest_file, $v_file_content, $p_entry['size']); unset($v_file_content); @fclose($v_dest_file); } @touch($p_entry['filename'], $p_entry['mtime']); } if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); } } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privExtractFileUsingTempFile(&$p_entry, &$p_options) { $v_result=1; $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { fclose($v_file); PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); @fwrite($v_dest_file, $v_binary_data, 10); $v_size = $p_entry['compressed_size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); @fwrite($v_dest_file, $v_binary_data, 8); @fclose($v_dest_file); if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { $p_entry['status'] = "write_error"; return $v_result; } if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { @fclose($v_dest_file); $p_entry['status'] = "read_error"; PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); return PclZip::errorCode(); } $v_size = $p_entry['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($v_src_file, $v_read_size); @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @fclose($v_dest_file); @gzclose($v_src_file); @unlink($v_gzip_temp_name); return $v_result; } function privExtractFileInOutput(&$p_entry, &$p_options) { $v_result=1; if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compressed_size'] == $p_entry['size']) { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } echo $v_buffer; unset($v_buffer); } else { if ($p_entry['compressed_size'] > 0) { $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_buffer = ''; } $v_file_content = gzinflate($v_buffer); unset($v_buffer); echo $v_file_content; unset($v_file_content); } } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) { $v_result=1; $v_header = array(); if (($v_result = $this->privReadFileHeader($v_header)) != 1) { return $v_result; } if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { } if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); if ($v_result == 0) { $p_entry['status'] = "skipped"; $v_result = 1; } if ($v_result == 2) { $p_entry['status'] = "aborted"; $v_result = PCLZIP_ERR_USER_ABORTED; } $p_entry['filename'] = $v_local_header['filename']; } if ($p_entry['status'] == 'ok') { if (!(($p_entry['external']&0x00000010)==0x00000010)) { if ($p_entry['compression'] == 0) { if ($p_entry['compressed_size'] > 0) { $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $p_string = ''; } } else { if ($p_entry['compressed_size'] > 0) { $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); } else { $v_data = ''; } if (($p_string = @gzinflate($v_data)) === FALSE) { } } } else { } } if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); $v_local_header['content'] = $p_string; $p_string = ''; $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); $p_string = $v_local_header['content']; unset($v_local_header['content']); if ($v_result == 2) { $v_result = PCLZIP_ERR_USER_ABORTED; } } return $v_result; } function privReadFileHeader(&$p_header) { $v_result=1; $v_binary_data = @fread($this->zip_fd, 4); $v_data = unpack('Vid', $v_binary_data); if ($v_data['id'] != 0x04034b50) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); return PclZip::errorCode(); } $v_binary_data = fread($this->zip_fd, 26); if (strlen($v_binary_data) != 26) { $p_header['filename'] = ""; $p_header['status'] = "invalid_header"; PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); if ($v_data['extra_len'] != 0) { $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); } else { $p_header['extra'] = ''; } $p_header['version_extracted'] = $v_data['version']; $p_header['compression'] = $v_data['compression']; $p_header['size'] = $v_data['size']; $p_header['compressed_size'] = $v_data['compressed_size']; $p_header['crc'] = $v_data['crc']; $p_header['flag'] = $v_data['flag']; $p_header['filename_len'] = $v_data['filename_len']; $p_header['mdate'] = $v_data['mdate']; $p_header['mtime'] = $v_data['mtime']; if ($p_header['mdate'] && $p_header['mtime']) { $v_hour = ($p_header['mtime'] & 0xF800) >> 11; $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; $v_seconde = ($p_header['mtime'] & 0x001F)*2; $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; $v_month = ($p_header['mdate'] & 0x01E0) >> 5; $v_day = $p_header['mdate'] & 0x001F; $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); } else { $p_header['mtime'] = time(); } $p_header['stored_filename'] = $p_header['filename']; $p_header['status'] = "ok"; return $v_result; } function privReadCentralFileHeader(&$p_header) { $v_result=1; $v_binary_data = @fread($this->zip_fd, 4); $v_data = unpack('Vid', $v_binary_data); if ($v_data['id'] != 0x02014b50) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); return PclZip::errorCode(); } $v_binary_data = fread($this->zip_fd, 42); if (strlen($v_binary_data) != 42) { $p_header['filename'] = ""; $p_header['status'] = "invalid_header"; PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); if ($p_header['filename_len'] != 0) $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); else $p_header['filename'] = ''; if ($p_header['extra_len'] != 0) $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); else $p_header['extra'] = ''; if ($p_header['comment_len'] != 0) $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); else $p_header['comment'] = ''; if (1) { $v_hour = ($p_header['mtime'] & 0xF800) >> 11; $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; $v_seconde = ($p_header['mtime'] & 0x001F)*2; $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; $v_month = ($p_header['mdate'] & 0x01E0) >> 5; $v_day = $p_header['mdate'] & 0x001F; $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); } else { $p_header['mtime'] = time(); } $p_header['stored_filename'] = $p_header['filename']; $p_header['status'] = 'ok'; if (substr($p_header['filename'], -1) == '/') { $p_header['external'] = 0x00000010; } return $v_result; } function privCheckFileHeaders(&$p_local_header, &$p_central_header) { $v_result=1; if ($p_local_header['filename'] != $p_central_header['filename']) { } if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { } if ($p_local_header['flag'] != $p_central_header['flag']) { } if ($p_local_header['compression'] != $p_central_header['compression']) { } if ($p_local_header['mtime'] != $p_central_header['mtime']) { } if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { } if (($p_local_header['flag'] & 8) == 8) { $p_local_header['size'] = $p_central_header['size']; $p_local_header['compressed_size'] = $p_central_header['compressed_size']; $p_local_header['crc'] = $p_central_header['crc']; } return $v_result; } function privReadEndCentralDir(&$p_central_dir) { $v_result=1; $v_size = filesize($this->zipname); @fseek($this->zip_fd, $v_size); if (@ftell($this->zip_fd) != $v_size) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_found = 0; if ($v_size > 26) { @fseek($this->zip_fd, $v_size-22); if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_binary_data = @fread($this->zip_fd, 4); $v_data = @unpack('Vid', $v_binary_data); if ($v_data['id'] == 0x06054b50) { $v_found = 1; } $v_pos = ftell($this->zip_fd); } if (!$v_found) { $v_maximum_size = 65557; if ($v_maximum_size > $v_size) $v_maximum_size = $v_size; @fseek($this->zip_fd, $v_size-$v_maximum_size); if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); return PclZip::errorCode(); } $v_pos = ftell($this->zip_fd); $v_bytes = 0x00000000; while ($v_pos < $v_size) { $v_byte = @fread($this->zip_fd, 1); $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); if ($v_bytes == 0x504b0506) { $v_pos++; break; } $v_pos++; } if ($v_pos == $v_size) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); return PclZip::errorCode(); } } $v_binary_data = fread($this->zip_fd, 18); if (strlen($v_binary_data) != 18) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); return PclZip::errorCode(); } $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { if (0) { PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive.' .' Some trailing bytes exists after the archive.'); return PclZip::errorCode(); } } if ($v_data['comment_size'] != 0) { $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); } else $p_central_dir['comment'] = ''; $p_central_dir['entries'] = $v_data['entries']; $p_central_dir['disk_entries'] = $v_data['disk_entries']; $p_central_dir['offset'] = $v_data['offset']; $p_central_dir['size'] = $v_data['size']; $p_central_dir['disk'] = $v_data['disk']; $p_central_dir['disk_start'] = $v_data['disk_start']; return $v_result; } function privDeleteByRule(&$p_result_list, &$p_options) { $v_result=1; $v_list_detail = array(); if (($v_result=$this->privOpenFd('rb')) != 1) { return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); return $v_result; } @rewind($this->zip_fd); $v_pos_entry = $v_central_dir['offset']; @rewind($this->zip_fd); if (@fseek($this->zip_fd, $v_pos_entry)) { $this->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_header_list = array(); $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { $v_header_list[$v_nb_extracted] = array(); if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { $this->privCloseFd(); return $v_result; } $v_header_list[$v_nb_extracted]['index'] = $i; $v_found = false; if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; } elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { $v_found = true; } } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { $v_found = true; } } } else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { $v_found = true; } } else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { $v_found = true; } if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { $j_start = $j+1; } if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { break; } } } else { $v_found = true; } if ($v_found) { unset($v_header_list[$v_nb_extracted]); } else { $v_nb_extracted++; } } if ($v_nb_extracted > 0) { $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; $v_temp_zip = new PclZip($v_zip_temp_name); if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { $this->privCloseFd(); return $v_result; } for ($i=0; $izip_fd); if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); return PclZip::errorCode(); } $v_local_header = array(); if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { } unset($v_local_header); if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { $this->privCloseFd(); $v_temp_zip->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } } $v_offset = @ftell($v_temp_zip->zip_fd); for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); } $v_comment = ''; if (isset($p_options[PCLZIP_OPT_COMMENT])) { $v_comment = $p_options[PCLZIP_OPT_COMMENT]; } $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { unset($v_header_list); $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($v_zip_temp_name); return $v_result; } $v_temp_zip->privCloseFd(); $this->privCloseFd(); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); unset($v_temp_zip); } else if ($v_central_dir['entries'] != 0) { $this->privCloseFd(); if (($v_result = $this->privOpenFd('wb')) != 1) { return $v_result; } if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { return $v_result; } $this->privCloseFd(); } return $v_result; } function privDirCheck($p_dir, $p_is_dir=false) { $v_result = 1; if (($p_is_dir) && (substr($p_dir, -1)=='/')) { $p_dir = substr($p_dir, 0, strlen($p_dir)-1); } if ((is_dir($p_dir)) || ($p_dir == "")) { return 1; } $p_parent_dir = dirname($p_dir); if ($p_parent_dir != $p_dir) { if ($p_parent_dir != "") { if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) { return $v_result; } } } if (!@mkdir($p_dir, 0777)) { PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); return PclZip::errorCode(); } return $v_result; } function privMerge(&$p_archive_to_add) { $v_result=1; if (!is_file($p_archive_to_add->zipname)) { $v_result = 1; return $v_result; } if (!is_file($this->zipname)) { $v_result = $this->privDuplicate($p_archive_to_add->zipname); return $v_result; } if (($v_result=$this->privOpenFd('rb')) != 1) { return $v_result; } $v_central_dir = array(); if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { $this->privCloseFd(); return $v_result; } @rewind($this->zip_fd); if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) { $this->privCloseFd(); return $v_result; } $v_central_dir_to_add = array(); if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); return $v_result; } @rewind($p_archive_to_add->zip_fd); $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = $v_central_dir['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_size = $v_central_dir_to_add['offset']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_offset = @ftell($v_zip_temp_fd); $v_size = $v_central_dir['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_size = $v_central_dir_to_add['size']; while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; $v_size = @ftell($v_zip_temp_fd)-$v_offset; $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { $this->privCloseFd(); $p_archive_to_add->privCloseFd(); @fclose($v_zip_temp_fd); $this->zip_fd = null; unset($v_header_list); return $v_result; } $v_swap = $this->zip_fd; $this->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; $this->privCloseFd(); $p_archive_to_add->privCloseFd(); @fclose($v_zip_temp_fd); @unlink($this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); return $v_result; } function privDuplicate($p_archive_filename) { $v_result=1; if (!is_file($p_archive_filename)) { $v_result = 1; return $v_result; } if (($v_result=$this->privOpenFd('wb')) != 1) { return $v_result; } if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { $this->privCloseFd(); PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); return PclZip::errorCode(); } $v_size = filesize($p_archive_filename); while ($v_size != 0) { $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = fread($v_zip_temp_fd, $v_read_size); @fwrite($this->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } $this->privCloseFd(); @fclose($v_zip_temp_fd); return $v_result; } function privErrorLog($p_error_code=0, $p_error_string='') { if (PCLZIP_ERROR_EXTERNAL == 1) { PclError($p_error_code, $p_error_string); } else { $this->error_code = $p_error_code; $this->error_string = $p_error_string; } } function privErrorReset() { if (PCLZIP_ERROR_EXTERNAL == 1) { PclErrorReset(); } else { $this->error_code = 0; $this->error_string = ''; } } function privDisableMagicQuotes() { $v_result=1; return $v_result; } function privSwapBackMagicQuotes() { $v_result=1; return $v_result; } } function PclZipUtilPathReduction($p_dir) { $v_result = ""; if ($p_dir != "") { $v_list = explode("/", $p_dir); $v_skip = 0; for ($i=sizeof($v_list)-1; $i>=0; $i--) { if ($v_list[$i] == ".") { } else if ($v_list[$i] == "..") { $v_skip++; } else if ($v_list[$i] == "") { if ($i == 0) { $v_result = "/".$v_result; if ($v_skip > 0) { $v_result = $p_dir; $v_skip = 0; } } else if ($i == (sizeof($v_list)-1)) { $v_result = $v_list[$i]; } else { } } else { if ($v_skip > 0) { $v_skip--; } else { $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); } } } if ($v_skip > 0) { while ($v_skip > 0) { $v_result = '../'.$v_result; $v_skip--; } } } return $v_result; } function PclZipUtilPathInclusion($p_dir, $p_path) { $v_result = 1; if ( ($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); } if ( ($p_path == '.') || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); } $v_list_dir = explode("/", $p_dir); $v_list_dir_size = sizeof($v_list_dir); $v_list_path = explode("/", $p_path); $v_list_path_size = sizeof($v_list_path); $i = 0; $j = 0; while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { if ($v_list_dir[$i] == '') { $i++; continue; } if ($v_list_path[$j] == '') { $j++; continue; } if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { $v_result = 0; } $i++; $j++; } if ($v_result) { while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { $v_result = 2; } else if ($i < $v_list_dir_size) { $v_result = 0; } } return $v_result; } function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) { $v_result = 1; if ($p_mode==0) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==1) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==2) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } else if ($p_mode==3) { while ($p_size != 0) { $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } } return $v_result; } function PclZipUtilRename($p_src, $p_dest) { $v_result = 1; if (!@rename($p_src, $p_dest)) { if (!@copy($p_src, $p_dest)) { $v_result = 0; } else if (!@unlink($p_src)) { $v_result = 0; } } return $v_result; } function PclZipUtilOptionText($p_option) { $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { $v_prefix = substr($v_key, 0, 10); if (( ($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) { return $v_key; } } $v_result = 'Unknown'; return $v_result; } function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) { if (stristr(php_uname(), 'windows')) { if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { $p_path = substr($p_path, $v_position+1); } if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { $p_path = strtr($p_path, '\\', '/'); } } return $p_path; } ?> -errors = new WP_Error(); } public function get_errors() { return $this->errors; } public function get_error_messages() { $messages = array(); foreach ( $this->errors->get_error_codes() as $error_code ) { $error_data = $this->errors->get_error_data( $error_code ); if ( $error_data && is_string( $error_data ) ) { $messages[] = $this->errors->get_error_message( $error_code ) . ' ' . esc_html( strip_tags( $error_data ) ); } else { $messages[] = $this->errors->get_error_message( $error_code ); } } return implode( ', ', $messages ); } public function error( $errors, ...$args ) { if ( is_string( $errors ) ) { $string = $errors; if ( ! empty( $this->upgrader->strings[ $string ] ) ) { $string = $this->upgrader->strings[ $string ]; } if ( false !== strpos( $string, '%' ) ) { if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } $errors_count = count( $this->errors->get_error_codes() ); $this->errors->add( 'unknown_upgrade_error_' . ( $errors_count + 1 ), $string ); } elseif ( is_wp_error( $errors ) ) { foreach ( $errors->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $errors->get_error_message( $error_code ), $errors->get_error_data( $error_code ) ); } } parent::error( $errors, ...$args ); } public function feedback( $feedback, ...$args ) { if ( is_wp_error( $feedback ) ) { foreach ( $feedback->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $feedback->get_error_message( $error_code ), $feedback->get_error_data( $error_code ) ); } } parent::feedback( $feedback, ...$args ); } } __( 'Theme Functions' ), 'header.php' => __( 'Theme Header' ), 'footer.php' => __( 'Theme Footer' ), 'sidebar.php' => __( 'Sidebar' ), 'comments.php' => __( 'Comments' ), 'searchform.php' => __( 'Search Form' ), '404.php' => __( '404 Template' ), 'link.php' => __( 'Links Template' ), 'index.php' => __( 'Main Index Template' ), 'archive.php' => __( 'Archives' ), 'author.php' => __( 'Author Template' ), 'taxonomy.php' => __( 'Taxonomy Template' ), 'category.php' => __( 'Category Template' ), 'tag.php' => __( 'Tag Template' ), 'home.php' => __( 'Posts Page' ), 'search.php' => __( 'Search Results' ), 'date.php' => __( 'Date Template' ), 'singular.php' => __( 'Singular Template' ), 'single.php' => __( 'Single Post' ), 'page.php' => __( 'Single Page' ), 'front-page.php' => __( 'Homepage' ), 'privacy-policy.php' => __( 'Privacy Policy Page' ), 'attachment.php' => __( 'Attachment Template' ), 'image.php' => __( 'Image Attachment Template' ), 'video.php' => __( 'Video Attachment Template' ), 'audio.php' => __( 'Audio Attachment Template' ), 'application.php' => __( 'Application Attachment Template' ), 'embed.php' => __( 'Embed Template' ), 'embed-404.php' => __( 'Embed 404 Template' ), 'embed-content.php' => __( 'Embed Content Template' ), 'header-embed.php' => __( 'Embed Header Template' ), 'footer-embed.php' => __( 'Embed Footer Template' ), 'style.css' => __( 'Stylesheet' ), 'editor-style.css' => __( 'Visual Editor Stylesheet' ), 'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ), 'rtl.css' => __( 'RTL Stylesheet' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ), 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ), 'comments-popup.php' => __( 'Popup Comments' ), ); function get_file_description( $file ) { global $wp_file_descriptions, $allowed_files; $dirname = pathinfo( $file, PATHINFO_DIRNAME ); $file_path = $allowed_files[ $file ]; if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) { return $wp_file_descriptions[ basename( $file ) ]; } elseif ( file_exists( $file_path ) && is_file( $file_path ) ) { $template_data = implode( '', file( $file_path ) ); if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) { return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) ); } } return trim( basename( $file ) ); } function get_home_path() { $home = set_url_scheme( get_option( 'home' ), 'http' ); $siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' ); if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) { $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) ); $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos ); $home_path = trailingslashit( $home_path ); } else { $home_path = ABSPATH; } return str_replace( '\\', '/', $home_path ); } function list_files( $folder = '', $levels = 100, $exclusions = array() ) { if ( empty( $folder ) ) { return false; } $folder = trailingslashit( $folder ); if ( ! $levels ) { return false; } $files = array(); $dir = @opendir( $folder ); if ( $dir ) { while ( ( $file = readdir( $dir ) ) !== false ) { if ( in_array( $file, array( '.', '..' ), true ) ) { continue; } if ( '.' === $file[0] || in_array( $file, $exclusions, true ) ) { continue; } if ( is_dir( $folder . $file ) ) { $files2 = list_files( $folder . $file, $levels - 1 ); if ( $files2 ) { $files = array_merge( $files, $files2 ); } else { $files[] = $folder . $file . '/'; } } else { $files[] = $folder . $file; } } closedir( $dir ); } return $files; } function wp_get_plugin_file_editable_extensions( $plugin ) { $default_types = array( 'bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', 'json', 'jsx', 'less', 'md', 'patch', 'php', 'php3', 'php4', 'php5', 'php7', 'phps', 'phtml', 'sass', 'scss', 'sh', 'sql', 'svg', 'text', 'txt', 'xml', 'yaml', 'yml', ); $file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin ); return $file_types; } function wp_get_theme_file_editable_extensions( $theme ) { $default_types = array( 'bash', 'conf', 'css', 'diff', 'htm', 'html', 'http', 'inc', 'include', 'js', 'json', 'jsx', 'less', 'md', 'patch', 'php', 'php3', 'php4', 'php5', 'php7', 'phps', 'phtml', 'sass', 'scss', 'sh', 'sql', 'svg', 'text', 'txt', 'xml', 'yaml', 'yml', ); $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme ); return array_unique( array_merge( $file_types, $default_types ) ); } function wp_print_file_editor_templates() { ?> - - exists() ) { return new WP_Error( 'non_existent_theme', __( 'The requested theme does not exist.' ) ); } if ( ! wp_verify_nonce( $args['nonce'], 'edit-theme_' . $stylesheet . '_' . $file ) ) { return new WP_Error( 'nonce_failure' ); } if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) { return new WP_Error( 'theme_no_stylesheet', __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() ); } $editable_extensions = wp_get_theme_file_editable_extensions( $theme ); $allowed_files = array(); foreach ( $editable_extensions as $type ) { switch ( $type ) { case 'php': $allowed_files = array_merge( $allowed_files, $theme->get_files( 'php', -1 ) ); break; case 'css': $style_files = $theme->get_files( 'css', -1 ); $allowed_files['style.css'] = $style_files['style.css']; $allowed_files = array_merge( $allowed_files, $style_files ); break; default: $allowed_files = array_merge( $allowed_files, $theme->get_files( $type, -1 ) ); break; } } if ( 0 !== validate_file( $file, array_keys( $allowed_files ) ) ) { return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) ); } $real_file = $theme->get_stylesheet_directory() . '/' . $file; $is_active = ( get_stylesheet() === $stylesheet || get_template() === $stylesheet ); } else { return new WP_Error( 'missing_theme_or_plugin' ); } if ( ! is_file( $real_file ) ) { return new WP_Error( 'file_does_not_exist', __( 'File does not exist! Please double check the name and try again.' ) ); } $extension = null; if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) { $extension = strtolower( $matches[1] ); if ( ! in_array( $extension, $editable_extensions, true ) ) { return new WP_Error( 'illegal_file_type', __( 'Files of this type are not editable.' ) ); } } $previous_content = file_get_contents( $real_file ); if ( ! is_writable( $real_file ) ) { return new WP_Error( 'file_not_writable' ); } $f = fopen( $real_file, 'w+' ); if ( false === $f ) { return new WP_Error( 'file_not_writable' ); } $written = fwrite( $f, $content ); fclose( $f ); if ( false === $written ) { return new WP_Error( 'unable_to_write', __( 'Unable to write to file.' ) ); } wp_opcache_invalidate( $real_file, true ); if ( $is_active && 'php' === $extension ) { $scrape_key = md5( rand() ); $transient = 'scrape_key_' . $scrape_key; $scrape_nonce = (string) rand(); set_transient( $transient, $scrape_nonce, 60 ); $cookies = wp_unslash( $_COOKIE ); $scrape_params = array( 'wp_scrape_key' => $scrape_key, 'wp_scrape_nonce' => $scrape_nonce, ); $headers = array( 'Cache-Control' => 'no-cache', ); $sslverify = apply_filters( 'https_local_ssl_verify', false ); if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); } set_time_limit( 300 ); $timeout = 100; $needle_start = "###### wp_scraping_result_start:$scrape_key ######"; $needle_end = "###### wp_scraping_result_end:$scrape_key ######"; if ( $plugin ) { $url = add_query_arg( compact( 'plugin', 'file' ), admin_url( 'plugin-editor.php' ) ); } elseif ( isset( $stylesheet ) ) { $url = add_query_arg( array( 'theme' => $stylesheet, 'file' => $file, ), admin_url( 'theme-editor.php' ) ); } else { $url = admin_url(); } if ( function_exists( 'session_status' ) && PHP_SESSION_ACTIVE === session_status() ) { session_write_close(); } $url = add_query_arg( $scrape_params, $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); $body = wp_remote_retrieve_body( $r ); $scrape_result_position = strpos( $body, $needle_start ); $loopback_request_failure = array( 'code' => 'loopback_request_failed', 'message' => __( 'Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.' ), ); $json_parse_failure = array( 'code' => 'json_parse_error', ); $result = null; if ( false === $scrape_result_position ) { $result = $loopback_request_failure; } else { $error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) ); $error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) ); $result = json_decode( trim( $error_output ), true ); if ( empty( $result ) ) { $result = $json_parse_failure; } } if ( true === $result ) { $url = home_url( '/' ); $url = add_query_arg( $scrape_params, $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); $body = wp_remote_retrieve_body( $r ); $scrape_result_position = strpos( $body, $needle_start ); if ( false === $scrape_result_position ) { $result = $loopback_request_failure; } else { $error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) ); $error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) ); $result = json_decode( trim( $error_output ), true ); if ( empty( $result ) ) { $result = $json_parse_failure; } } } delete_transient( $transient ); if ( true !== $result ) { file_put_contents( $real_file, $previous_content ); wp_opcache_invalidate( $real_file, true ); if ( ! isset( $result['message'] ) ) { $message = __( 'Something went wrong.' ); } else { $message = $result['message']; unset( $result['message'] ); } return new WP_Error( 'php_error', $message, $result ); } } if ( $theme instanceof WP_Theme ) { $theme->cache_delete(); } return true; } function wp_tempnam( $filename = '', $dir = '' ) { if ( empty( $dir ) ) { $dir = get_temp_dir(); } if ( empty( $filename ) || in_array( $filename, array( '.', '/', '\\' ), true ) ) { $filename = uniqid(); } $temp_filename = basename( $filename ); $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename ); if ( ! $temp_filename ) { return wp_tempnam( dirname( $filename ), $dir ); } $temp_filename .= '-' . wp_generate_password( 6, false ); $temp_filename .= '.tmp'; $temp_filename = $dir . wp_unique_filename( $dir, $temp_filename ); $fp = @fopen( $temp_filename, 'x' ); if ( ! $fp && is_writable( $dir ) && file_exists( $temp_filename ) ) { return wp_tempnam( $filename, $dir ); } if ( $fp ) { fclose( $fp ); } return $temp_filename; } function validate_file_to_edit( $file, $allowed_files = array() ) { $code = validate_file( $file, $allowed_files ); if ( ! $code ) { return $file; } switch ( $code ) { case 1: wp_die( __( 'Sorry, that file cannot be edited.' ) ); case 3: wp_die( __( 'Sorry, that file cannot be edited.' ) ); } } function _wp_handle_upload( &$file, $overrides, $time, $action ) { if ( ! function_exists( 'wp_handle_upload_error' ) ) { function wp_handle_upload_error( &$file, $message ) { return array( 'error' => $message ); } } $file = apply_filters( "{$action}_prefilter", $file ); $overrides = apply_filters( "{$action}_overrides", $overrides, $file ); $upload_error_handler = 'wp_handle_upload_error'; if ( isset( $overrides['upload_error_handler'] ) ) { $upload_error_handler = $overrides['upload_error_handler']; } if ( isset( $file['error'] ) && ! is_numeric( $file['error'] ) && $file['error'] ) { return call_user_func_array( $upload_error_handler, array( &$file, $file['error'] ) ); } $unique_filename_callback = null; if ( isset( $overrides['unique_filename_callback'] ) ) { $unique_filename_callback = $overrides['unique_filename_callback']; } if ( isset( $overrides['upload_error_strings'] ) ) { $upload_error_strings = $overrides['upload_error_strings']; } else { $upload_error_strings = array( false, sprintf( __( 'The uploaded file exceeds the %1$s directive in %2$s.' ), 'upload_max_filesize', 'php.ini' ), sprintf( __( 'The uploaded file exceeds the %s directive that was specified in the HTML form.' ), 'MAX_FILE_SIZE' ), __( 'The uploaded file was only partially uploaded.' ), __( 'No file was uploaded.' ), '', __( 'Missing a temporary folder.' ), __( 'Failed to write file to disk.' ), __( 'File upload stopped by extension.' ), ); } $test_form = isset( $overrides['test_form'] ) ? $overrides['test_form'] : true; $test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true; $test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true; $mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false; if ( $test_form && ( ! isset( $_POST['action'] ) || $_POST['action'] !== $action ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Invalid form submission.' ) ) ); } if ( isset( $file['error'] ) && $file['error'] > 0 ) { return call_user_func_array( $upload_error_handler, array( &$file, $upload_error_strings[ $file['error'] ] ) ); } $test_uploaded_file = 'wp_handle_upload' === $action ? is_uploaded_file( $file['tmp_name'] ) : @is_readable( $file['tmp_name'] ); if ( ! $test_uploaded_file ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) ); } $test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] ); if ( $test_size && ! ( $test_file_size > 0 ) ) { if ( is_multisite() ) { $error_msg = __( 'File is empty. Please upload something more substantial.' ); } else { $error_msg = sprintf( __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ), 'php.ini', 'post_max_size', 'upload_max_filesize' ); } return call_user_func_array( $upload_error_handler, array( &$file, $error_msg ) ); } if ( $test_type ) { $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); $ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext']; $type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type']; $proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename']; if ( $proper_filename ) { $file['name'] = $proper_filename; } if ( ( ! $type || ! $ext ) && ! current_user_can( 'unfiltered_upload' ) ) { return call_user_func_array( $upload_error_handler, array( &$file, __( 'Sorry, you are not allowed to upload this file type.' ) ) ); } if ( ! $type ) { $type = $file['type']; } } else { $type = ''; } $uploads = wp_upload_dir( $time ); if ( ! ( $uploads && false === $uploads['error'] ) ) { return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) ); } $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); $new_file = $uploads['path'] . "/$filename"; $move_new_file = apply_filters( 'pre_move_uploaded_file', null, $file, $new_file, $type ); if ( null === $move_new_file ) { if ( 'wp_handle_upload' === $action ) { $move_new_file = @move_uploaded_file( $file['tmp_name'], $new_file ); } else { $move_new_file = @copy( $file['tmp_name'], $new_file ); unlink( $file['tmp_name'] ); } if ( false === $move_new_file ) { if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; } else { $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; } return $upload_error_handler( $file, sprintf( __( 'The uploaded file could not be moved to %s.' ), $error_path ) ); } } $stat = stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0000666; chmod( $new_file, $perms ); $url = $uploads['url'] . "/$filename"; if ( is_multisite() ) { clean_dirsize_cache( $new_file ); } return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type, ), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' ); } function wp_handle_upload( &$file, $overrides = false, $time = null ) { $action = 'wp_handle_upload'; if ( isset( $overrides['action'] ) ) { $action = $overrides['action']; } return _wp_handle_upload( $file, $overrides, $time, $action ); } function wp_handle_sideload( &$file, $overrides = false, $time = null ) { $action = 'wp_handle_sideload'; if ( isset( $overrides['action'] ) ) { $action = $overrides['action']; } return _wp_handle_upload( $file, $overrides, $time, $action ); } function download_url( $url, $timeout = 300, $signature_verification = false ) { if ( ! $url ) { return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) ); } $url_path = parse_url( $url, PHP_URL_PATH ); $url_filename = ''; if ( is_string( $url_path ) && '' !== $url_path ) { $url_filename = basename( $url_path ); } $tmpfname = wp_tempnam( $url_filename ); if ( ! $tmpfname ) { return new WP_Error( 'http_no_file', __( 'Could not create temporary file.' ) ); } $response = wp_safe_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname, ) ); if ( is_wp_error( $response ) ) { unlink( $tmpfname ); return $response; } $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $response_code ) { $data = array( 'code' => $response_code, ); $tmpf = fopen( $tmpfname, 'rb' ); if ( $tmpf ) { $response_size = apply_filters( 'download_url_error_max_body_size', KB_IN_BYTES ); $data['body'] = fread( $tmpf, $response_size ); fclose( $tmpf ); } unlink( $tmpfname ); return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data ); } $content_disposition = wp_remote_retrieve_header( $response, 'content-disposition' ); if ( $content_disposition ) { $content_disposition = strtolower( $content_disposition ); if ( 0 === strpos( $content_disposition, 'attachment; filename=' ) ) { $tmpfname_disposition = sanitize_file_name( substr( $content_disposition, 21 ) ); } else { $tmpfname_disposition = ''; } if ( $tmpfname_disposition && is_string( $tmpfname_disposition ) && ( 0 === validate_file( $tmpfname_disposition ) ) ) { $tmpfname_disposition = dirname( $tmpfname ) . '/' . $tmpfname_disposition; if ( rename( $tmpfname, $tmpfname_disposition ) ) { $tmpfname = $tmpfname_disposition; } if ( ( $tmpfname !== $tmpfname_disposition ) && file_exists( $tmpfname_disposition ) ) { unlink( $tmpfname_disposition ); } } } $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); if ( $content_md5 ) { $md5_check = verify_file_md5( $tmpfname, $content_md5 ); if ( is_wp_error( $md5_check ) ) { unlink( $tmpfname ); return $md5_check; } } if ( $signature_verification ) { $signed_hostnames = apply_filters( 'wp_signature_hosts', array( 'wordpress.org', 'downloads.wordpress.org', 's.w.org' ) ); $signature_verification = in_array( parse_url( $url, PHP_URL_HOST ), $signed_hostnames, true ); } if ( $signature_verification ) { $signature = wp_remote_retrieve_header( $response, 'x-content-signature' ); if ( ! $signature ) { $signature_url = false; if ( is_string( $url_path ) && ( '.zip' === substr( $url_path, -4 ) || '.tar.gz' === substr( $url_path, -7 ) ) ) { $signature_url = str_replace( $url_path, $url_path . '.sig', $url ); } $signature_url = apply_filters( 'wp_signature_url', $signature_url, $url ); if ( $signature_url ) { $signature_request = wp_safe_remote_get( $signature_url, array( 'limit_response_size' => 10 * KB_IN_BYTES, ) ); if ( ! is_wp_error( $signature_request ) && 200 === wp_remote_retrieve_response_code( $signature_request ) ) { $signature = explode( "\n", wp_remote_retrieve_body( $signature_request ) ); } } } $signature_verification = verify_file_signature( $tmpfname, $signature, $url_filename ); } if ( is_wp_error( $signature_verification ) ) { if ( apply_filters( 'wp_signature_softfail', true, $url ) ) { $signature_verification->add_data( $tmpfname, 'softfail-filename' ); } else { unlink( $tmpfname ); } return $signature_verification; } return $tmpfname; } function verify_file_md5( $filename, $expected_md5 ) { if ( 32 === strlen( $expected_md5 ) ) { $expected_raw_md5 = pack( 'H*', $expected_md5 ); } elseif ( 24 === strlen( $expected_md5 ) ) { $expected_raw_md5 = base64_decode( $expected_md5 ); } else { return false; } $file_md5 = md5_file( $filename, true ); if ( $file_md5 === $expected_raw_md5 ) { return true; } return new WP_Error( 'md5_mismatch', sprintf( __( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ), bin2hex( $file_md5 ), bin2hex( $expected_raw_md5 ) ) ); } function verify_file_signature( $filename, $signatures, $filename_for_errors = false ) { if ( ! $filename_for_errors ) { $filename_for_errors = wp_basename( $filename ); } if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ), true ) ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) ? 'sodium_crypto_sign_verify_detached' : 'sha384' ) ); } if ( ! extension_loaded( 'sodium' ) && in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) && extension_loaded( 'opcache' ) ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), ) ); } if ( ! extension_loaded( 'sodium' ) && ! ParagonIE_Sodium_Compat::polyfill_is_fast() ) { $sodium_compat_is_fast = false; if ( method_exists( 'ParagonIE_Sodium_Compat', 'runtime_speed_test' ) ) { $old_fastMult = ParagonIE_Sodium_Compat::$fastMult; ParagonIE_Sodium_Compat::$fastMult = true; $sodium_compat_is_fast = ParagonIE_Sodium_Compat::runtime_speed_test( 100, 10 ); ParagonIE_Sodium_Compat::$fastMult = $old_fastMult; } if ( ! $sodium_compat_is_fast ) { return new WP_Error( 'signature_verification_unsupported', sprintf( __( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), 'polyfill_is_fast' => false, 'max_execution_time' => ini_get( 'max_execution_time' ), ) ); } } if ( ! $signatures ) { return new WP_Error( 'signature_verification_no_signature', sprintf( __( 'The authenticity of %s could not be verified as no signature was found.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'filename' => $filename_for_errors, ) ); } $trusted_keys = wp_trusted_keys(); $file_hash = hash_file( 'sha384', $filename, true ); mbstring_binary_safe_encoding(); $skipped_key = 0; $skipped_signature = 0; foreach ( (array) $signatures as $signature ) { $signature_raw = base64_decode( $signature ); if ( SODIUM_CRYPTO_SIGN_BYTES !== strlen( $signature_raw ) ) { $skipped_signature++; continue; } foreach ( (array) $trusted_keys as $key ) { $key_raw = base64_decode( $key ); if ( SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES !== strlen( $key_raw ) ) { $skipped_key++; continue; } if ( sodium_crypto_sign_verify_detached( $signature_raw, $file_hash, $key_raw ) ) { reset_mbstring_encoding(); return true; } } } reset_mbstring_encoding(); return new WP_Error( 'signature_verification_failed', sprintf( __( 'The authenticity of %s could not be verified.' ), '' . esc_html( $filename_for_errors ) . '' ), array( 'filename' => $filename_for_errors, 'keys' => $trusted_keys, 'signatures' => $signatures, 'hash' => bin2hex( $file_hash ), 'skipped_key' => $skipped_key, 'skipped_sig' => $skipped_signature, 'php' => phpversion(), 'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ), ) ); } function wp_trusted_keys() { $trusted_keys = array(); if ( time() < 1617235200 ) { $trusted_keys[] = 'fRPyrxb/MvVLbdsYi+OOEv4xc+Eqpsj+kkAS6gNOkI0='; } return apply_filters( 'wp_trusted_keys', $trusted_keys ); } function unzip_file( $file, $to ) { global $wp_filesystem; if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } wp_raise_memory_limit( 'admin' ); $needed_dirs = array(); $to = trailingslashit( $to ); if ( ! $wp_filesystem->is_dir( $to ) ) { $path = preg_split( '![/\\\]!', untrailingslashit( $to ) ); for ( $i = count( $path ); $i >= 0; $i-- ) { if ( empty( $path[ $i ] ) ) { continue; } $dir = implode( '/', array_slice( $path, 0, $i + 1 ) ); if ( preg_match( '!^[a-z]:$!i', $dir ) ) { continue; } if ( ! $wp_filesystem->is_dir( $dir ) ) { $needed_dirs[] = $dir; } else { break; } } } if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { $result = _unzip_file_ziparchive( $file, $to, $needed_dirs ); if ( true === $result ) { return $result; } elseif ( is_wp_error( $result ) ) { if ( 'incompatible_archive' !== $result->get_error_code() ) { return $result; } } } return _unzip_file_pclzip( $file, $to, $needed_dirs ); } function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) { global $wp_filesystem; $z = new ZipArchive(); $zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS ); if ( true !== $zopen ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) ); } $uncompressed_size = 0; for ( $i = 0; $i < $z->numFiles; $i++ ) { $info = $z->statIndex( $i ); if ( ! $info ) { return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); } if ( '__MACOSX/' === substr( $info['name'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $info['name'] ) ) { continue; } $uncompressed_size += $info['size']; $dirname = dirname( $info['name'] ); if ( '/' === substr( $info['name'], -1 ) ) { $needed_dirs[] = $to . untrailingslashit( $info['name'] ); } elseif ( '.' !== $dirname ) { $needed_dirs[] = $to . untrailingslashit( $dirname ); } } if ( wp_doing_cron() ) { $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false; if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) { return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) ); } } $needed_dirs = array_unique( $needed_dirs ); foreach ( $needed_dirs as $dir ) { if ( untrailingslashit( $to ) === $dir ) { continue; } if ( strpos( $dir, $to ) === false ) { continue; } $parent_folder = dirname( $dir ); while ( ! empty( $parent_folder ) && untrailingslashit( $to ) !== $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } } asort( $needed_dirs ); foreach ( $needed_dirs as $_dir ) { if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) { return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) ); } } unset( $needed_dirs ); for ( $i = 0; $i < $z->numFiles; $i++ ) { $info = $z->statIndex( $i ); if ( ! $info ) { return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); } if ( '/' === substr( $info['name'], -1 ) ) { continue; } if ( '__MACOSX/' === substr( $info['name'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $info['name'] ) ) { continue; } $contents = $z->getFromIndex( $i ); if ( false === $contents ) { return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] ); } if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] ); } } $z->close(); return true; } function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { global $wp_filesystem; mbstring_binary_safe_encoding(); require_once ABSPATH . 'wp-admin/includes/class-pclzip.php'; $archive = new PclZip( $file ); $archive_files = $archive->extract( PCLZIP_OPT_EXTRACT_AS_STRING ); reset_mbstring_encoding(); if ( ! is_array( $archive_files ) ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), $archive->errorInfo( true ) ); } if ( 0 === count( $archive_files ) ) { return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) ); } $uncompressed_size = 0; foreach ( $archive_files as $file ) { if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { continue; } $uncompressed_size += $file['size']; $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) ); } if ( wp_doing_cron() ) { $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false; if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) { return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) ); } } $needed_dirs = array_unique( $needed_dirs ); foreach ( $needed_dirs as $dir ) { if ( untrailingslashit( $to ) === $dir ) { continue; } if ( strpos( $dir, $to ) === false ) { continue; } $parent_folder = dirname( $dir ); while ( ! empty( $parent_folder ) && untrailingslashit( $to ) !== $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } } asort( $needed_dirs ); foreach ( $needed_dirs as $_dir ) { if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) { return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) ); } } unset( $needed_dirs ); foreach ( $archive_files as $file ) { if ( $file['folder'] ) { continue; } if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { continue; } if ( 0 !== validate_file( $file['filename'] ) ) { continue; } if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] ); } } return true; } function copy_dir( $from, $to, $skip_list = array() ) { global $wp_filesystem; $dirlist = $wp_filesystem->dirlist( $from ); if ( false === $dirlist ) { return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $to ) ); } $from = trailingslashit( $from ); $to = trailingslashit( $to ); foreach ( (array) $dirlist as $filename => $fileinfo ) { if ( in_array( $filename, $skip_list, true ) ) { continue; } if ( 'f' === $fileinfo['type'] ) { if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { $wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE ); if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename ); } } wp_opcache_invalidate( $to . $filename ); } elseif ( 'd' === $fileinfo['type'] ) { if ( ! $wp_filesystem->is_dir( $to . $filename ) ) { if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename ); } } $sub_skip_list = array(); foreach ( $skip_list as $skip_item ) { if ( 0 === strpos( $skip_item, $filename . '/' ) ) { $sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item ); } } $result = copy_dir( $from . $filename, $to . $filename, $sub_skip_list ); if ( is_wp_error( $result ) ) { return $result; } } } return true; } function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) { global $wp_filesystem; require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'; $method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership ); if ( ! $method ) { return false; } if ( ! class_exists( "WP_Filesystem_$method" ) ) { $abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); if ( ! file_exists( $abstraction_file ) ) { return; } require_once $abstraction_file; } $method = "WP_Filesystem_$method"; $wp_filesystem = new $method( $args ); if ( ! defined( 'FS_CONNECT_TIMEOUT' ) ) { define( 'FS_CONNECT_TIMEOUT', 30 ); } if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 30 ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return false; } if ( ! $wp_filesystem->connect() ) { return false; } if ( ! defined( 'FS_CHMOD_DIR' ) ) { define( 'FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) ); } if ( ! defined( 'FS_CHMOD_FILE' ) ) { define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); } return true; } function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_file_ownership = false ) { $method = defined( 'FS_METHOD' ) ? FS_METHOD : false; if ( ! $context ) { $context = WP_CONTENT_DIR; } if ( WP_LANG_DIR === $context && ! is_dir( $context ) ) { $context = dirname( $context ); } $context = trailingslashit( $context ); if ( ! $method ) { $temp_file_name = $context . 'temp-write-test-' . str_replace( '.', '-', uniqid( '', true ) ); $temp_handle = @fopen( $temp_file_name, 'w' ); if ( $temp_handle ) { $wp_file_owner = false; $temp_file_owner = false; if ( function_exists( 'fileowner' ) ) { $wp_file_owner = @fileowner( __FILE__ ); $temp_file_owner = @fileowner( $temp_file_name ); } if ( false !== $wp_file_owner && $wp_file_owner === $temp_file_owner ) { $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'file_owner'; } elseif ( $allow_relaxed_file_ownership ) { $method = 'direct'; $GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership'; } fclose( $temp_handle ); @unlink( $temp_file_name ); } } if ( ! $method && isset( $args['connection_type'] ) && 'ssh' === $args['connection_type'] && extension_loaded( 'ssh2' ) ) { $method = 'ssh2'; } if ( ! $method && extension_loaded( 'ftp' ) ) { $method = 'ftpext'; } if ( ! $method && ( extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) ) { $method = 'ftpsockets'; } return apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership ); } function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = '', $extra_fields = null, $allow_relaxed_file_ownership = false ) { global $pagenow; $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership ); if ( '' !== $req_cred ) { return $req_cred; } if ( empty( $type ) ) { $type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership ); } if ( 'direct' === $type ) { return true; } if ( is_null( $extra_fields ) ) { $extra_fields = array( 'version', 'locale' ); } $credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '', ) ); $submitted_form = wp_unslash( $_POST ); if ( ! isset( $_POST['_fs_nonce'] ) || ! wp_verify_nonce( $_POST['_fs_nonce'], 'filesystem-credentials' ) ) { unset( $submitted_form['hostname'], $submitted_form['username'], $submitted_form['password'], $submitted_form['public_key'], $submitted_form['private_key'], $submitted_form['connection_type'] ); } $ftp_constants = array( 'hostname' => 'FTP_HOST', 'username' => 'FTP_USER', 'password' => 'FTP_PASS', 'public_key' => 'FTP_PUBKEY', 'private_key' => 'FTP_PRIKEY', ); foreach ( $ftp_constants as $key => $constant ) { if ( defined( $constant ) ) { $credentials[ $key ] = constant( $constant ); } elseif ( ! empty( $submitted_form[ $key ] ) ) { $credentials[ $key ] = $submitted_form[ $key ]; } elseif ( ! isset( $credentials[ $key ] ) ) { $credentials[ $key ] = ''; } } $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); if ( strpos( $credentials['hostname'], ':' ) ) { list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); if ( ! is_numeric( $credentials['port'] ) ) { unset( $credentials['port'] ); } } else { unset( $credentials['port'] ); } if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' === FS_METHOD ) ) { $credentials['connection_type'] = 'ssh'; } elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $type ) { $credentials['connection_type'] = 'ftps'; } elseif ( ! empty( $submitted_form['connection_type'] ) ) { $credentials['connection_type'] = $submitted_form['connection_type']; } elseif ( ! isset( $credentials['connection_type'] ) ) { $credentials['connection_type'] = 'ftp'; } if ( ! $error && ( ! empty( $credentials['hostname'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['password'] ) || 'ssh' === $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) ) ) { $stored_credentials = $credentials; if ( ! empty( $stored_credentials['port'] ) ) { $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; } unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] ); if ( ! wp_installing() ) { update_option( 'ftp_credentials', $stored_credentials ); } return $credentials; } $hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : ''; $username = isset( $credentials['username'] ) ? $credentials['username'] : ''; $public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : ''; $private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : ''; $port = isset( $credentials['port'] ) ? $credentials['port'] : ''; $connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : ''; if ( $error ) { $error_string = __( 'Error: Could not connect to the server. Please verify the settings are correct.' ); if ( is_wp_error( $error ) ) { $error_string = esc_html( $error->get_error_message() ); } echo '

          ' . $error_string . '

          '; } $types = array(); if ( extension_loaded( 'ftp' ) || extension_loaded( 'sockets' ) || function_exists( 'fsockopen' ) ) { $types['ftp'] = __( 'FTP' ); } if ( extension_loaded( 'ftp' ) ) { $types['ftps'] = __( 'FTPS (SSL)' ); } if ( extension_loaded( 'ssh2' ) ) { $types['ssh'] = __( 'SSH2' ); } $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); ?> -
          -
          - " . __( 'Connection Information' ) . ""; ?> -

          - -

          - -
          - -
          -
          - -
          -
          - - $text ) : ?> - - -
          - -
          > - - - -

          -
          - '; } } if ( ! function_exists( 'submit_button' ) ) { require_once ABSPATH . '/wp-admin/includes/template.php'; } ?> -

          - - - -

          -
          -
          - -
          -
          - -
          - true, 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'switch_themes' ); } public function prepare_items() { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! empty( $_REQUEST['s'] ) ) { $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) ); } if ( ! empty( $_REQUEST['features'] ) ) { $this->features = $_REQUEST['features']; } if ( $this->search_terms || $this->features ) { foreach ( $themes as $key => $theme ) { if ( ! $this->search_theme( $theme ) ) { unset( $themes[ $key ] ); } } } unset( $themes[ get_option( 'stylesheet' ) ] ); WP_Theme::sort_by_name( $themes ); $per_page = 36; $page = $this->get_pagenum(); $start = ( $page - 1 ) * $per_page; $this->items = array_slice( $themes, $start, $per_page, true ); $this->set_pagination_args( array( 'total_items' => count( $themes ), 'per_page' => $per_page, 'infinite_scroll' => true, ) ); } public function no_items() { if ( $this->search_terms || $this->features ) { _e( 'No items found.' ); return; } $blog_id = get_current_blog_id(); if ( is_multisite() ) { if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) { printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) ); return; } elseif ( current_user_can( 'manage_network_themes' ) ) { printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) ); return; } } else { if ( current_user_can( 'install_themes' ) ) { printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the Install Themes tab above.' ), admin_url( 'theme-install.php' ) ); return; } } printf( __( 'Only the active theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) ); } public function tablenav( $which = 'top' ) { if ( $this->get_pagination_arg( 'total_pages' ) <= 1 ) { return; } ?> -
          - pagination( $which ); ?> - -
          -
          - - tablenav( 'top' ); ?> - -
          - display_rows_or_placeholder(); ?> -
          - - tablenav( 'bottom' ); ?> - has_items() ) { $this->display_rows(); } else { echo '
          '; $this->no_items(); echo '
          '; } } public function display_rows() { $themes = $this->items; foreach ( $themes as $theme ) : ?> -
          - get_template(); $stylesheet = $theme->get_stylesheet(); $title = $theme->display( 'Name' ); $version = $theme->display( 'Version' ); $author = $theme->display( 'Author' ); $activate_link = wp_nonce_url( 'themes.php?action=activate&template=' . urlencode( $template ) . '&stylesheet=' . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet ); $actions = array(); $actions['activate'] = sprintf( '%s', $activate_link, esc_attr( sprintf( _x( 'Activate “%s”', 'theme' ), $title ) ), __( 'Activate' ) ); if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $actions['preview'] .= sprintf( '%s', wp_customize_url( $stylesheet ), __( 'Live Preview' ) ); } if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ), esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ), __( 'Delete' ) ); } $actions = apply_filters( 'theme_action_links', $actions, $theme, 'all' ); $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, 'all' ); $delete_action = isset( $actions['delete'] ) ? '
          ' . $actions['delete'] . '
          ' : ''; unset( $actions['delete'] ); $screenshot = $theme->get_screenshot(); ?> - - - - - - - - - - - - -

          -
          - -
          - - -
          -

          -

          display( 'Description' ); ?>

          - parent() ) { printf( '

          ' . __( 'This child theme requires its parent theme, %2$s.' ) . '

          ', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), $theme->parent()->display( 'Name' ) ); } ?> -
          - -
          - features as $word ) { if ( ! in_array( $word, $theme->get( 'Tags' ), true ) ) { return false; } } foreach ( $this->search_terms as $word ) { if ( in_array( $word, $theme->get( 'Tags' ), true ) ) { continue; } foreach ( array( 'Name', 'Description', 'Author', 'AuthorURI' ) as $header ) { if ( false !== stripos( strip_tags( $theme->display( $header, false, true ) ), $word ) ) { continue 2; } } if ( false !== stripos( $theme->get_stylesheet(), $word ) ) { continue; } if ( false !== stripos( $theme->get_template(), $word ) ) { continue; } return false; } return true; } public function _js_vars( $extra_args = array() ) { $search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'search' => $search_string, 'features' => $this->features, 'paged' => $this->get_pagenum(), 'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1, ); if ( is_array( $extra_args ) ) { $args = array_merge( $args, $extra_args ); } printf( "\n", wp_json_encode( $args ) ); parent::_js_vars(); } } db_fields = $fields; } } public function start_lvl( &$output, $depth = 0, $args = null ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent
            \n"; } public function end_lvl( &$output, $depth = 0, $args = null ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent
          "; } public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { global $_nav_menu_placeholder, $nav_menu_selected_id; $menu_item = $data_object; $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; $possible_object_id = isset( $menu_item->post_type ) && 'nav_menu_item' === $menu_item->post_type ? $menu_item->object_id : $_nav_menu_placeholder; $possible_db_id = ( ! empty( $menu_item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $menu_item->ID : 0; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $output .= $indent . '
        • '; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; } } status_list = array( 'archived' => array( 'site-archived', __( 'Archived' ) ), 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), 'mature' => array( 'site-mature', __( 'Mature' ) ), ); parent::__construct( array( 'plural' => 'sites', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'manage_sites' ); } public function prepare_items() { global $mode, $s, $wpdb; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'sites_list_mode', $mode ); } else { $mode = get_user_setting( 'sites_list_mode', 'list' ); } $per_page = $this->get_items_per_page( 'sites_network_per_page' ); $pagenum = $this->get_pagenum(); $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; $wild = ''; if ( false !== strpos( $s, '*' ) ) { $wild = '*'; $s = trim( $s, '*' ); } if ( ! $s && wp_is_large_network() ) { if ( ! isset( $_REQUEST['orderby'] ) ) { $_GET['orderby'] = ''; $_REQUEST['orderby'] = ''; } if ( ! isset( $_REQUEST['order'] ) ) { $_GET['order'] = 'DESC'; $_REQUEST['order'] = 'DESC'; } } $args = array( 'number' => (int) $per_page, 'offset' => (int) ( ( $pagenum - 1 ) * $per_page ), 'network_id' => get_current_network_id(), ); if ( empty( $s ) ) { } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) || preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); $reg_blog_ids = $wpdb->get_col( $sql ); if ( $reg_blog_ids ) { $args['site__in'] = $reg_blog_ids; } } elseif ( is_numeric( $s ) && empty( $wild ) ) { $args['ID'] = $s; } else { $args['search'] = $s; if ( ! is_subdomain_install() ) { $args['search_columns'] = array( 'path' ); } } $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; if ( 'registered' === $order_by ) { } elseif ( 'lastupdated' === $order_by ) { $order_by = 'last_updated'; } elseif ( 'blogname' === $order_by ) { if ( is_subdomain_install() ) { $order_by = 'domain'; } else { $order_by = 'path'; } } elseif ( 'blog_id' === $order_by ) { $order_by = 'id'; } elseif ( ! $order_by ) { $order_by = false; } $args['orderby'] = $order_by; if ( $order_by ) { $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; } if ( wp_is_large_network() ) { $args['no_found_rows'] = true; } else { $args['no_found_rows'] = false; } $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) { $args[ $status ] = 1; } $args = apply_filters( 'ms_sites_list_table_query_args', $args ); $_sites = get_sites( $args ); if ( is_array( $_sites ) ) { update_site_cache( $_sites ); $this->items = array_slice( $_sites, 0, $per_page ); } $total_sites = get_sites( array_merge( $args, array( 'count' => true, 'offset' => 0, 'number' => 0, ) ) ); $this->set_pagination_args( array( 'total_items' => $total_sites, 'per_page' => $per_page, ) ); } public function no_items() { _e( 'No sites found.' ); } protected function get_views() { $counts = wp_count_sites(); $statuses = array( 'all' => _nx_noop( 'All (%s)', 'All (%s)', 'sites' ), 'public' => _n_noop( 'Public (%s)', 'Public (%s)' ), 'archived' => _n_noop( 'Archived (%s)', 'Archived (%s)' ), 'mature' => _n_noop( 'Mature (%s)', 'Mature (%s)' ), 'spam' => _nx_noop( 'Spam (%s)', 'Spam (%s)', 'sites' ), 'deleted' => _n_noop( 'Deleted (%s)', 'Deleted (%s)' ), ); $view_links = array(); $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; $url = 'sites.php'; foreach ( $statuses as $status => $label_count ) { $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status ) ? ' class="current" aria-current="page"' : ''; if ( (int) $counts[ $status ] > 0 ) { $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); $view_links[ $status ] = sprintf( '%3$s', esc_url( $full_url ), $current_link_attributes, $label ); } } return $view_links; } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( 'delete_sites' ) ) { $actions['delete'] = __( 'Delete' ); } $actions['spam'] = _x( 'Mark as spam', 'site' ); $actions['notspam'] = _x( 'Not spam', 'site' ); return $actions; } protected function pagination( $which ) { global $mode; parent::pagination( $which ); if ( 'top' === $which ) { $this->view_switcher( $mode ); } } protected function extra_tablenav( $which ) { ?> -
          - 'site-query-submit' ) ); } } ?> -
          - '', 'blogname' => __( 'URL' ), 'lastupdated' => __( 'Last Updated' ), 'registered' => _x( 'Registered', 'site' ), 'users' => __( 'Users' ), ); if ( has_filter( 'wpmublogsaction' ) ) { $sites_columns['plugins'] = __( 'Actions' ); } return apply_filters( 'wpmu_blogs_columns', $sites_columns ); } protected function get_sortable_columns() { return array( 'blogname' => 'blogname', 'lastupdated' => 'lastupdated', 'registered' => 'blog_id', ); } public function column_cb( $item ) { $blog = $item; if ( ! is_main_site( $blog['blog_id'] ) ) : $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); ?> - - - - - - site_states( $blog ); ?> - - '; printf( __( '%1$s – %2$s' ), get_option( 'blogname' ), '' . get_option( 'blogdescription' ) . '' ); echo '

          '; restore_current_blog(); } } public function column_lastupdated( $blog ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); } public function column_registered( $blog ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } if ( '0000-00-00 00:00:00' === $blog['registered'] ) { echo '—'; } else { echo mysql2date( $date, $blog['registered'] ); } } public function column_users( $blog ) { $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); if ( ! $user_count ) { $blog_users = new WP_User_Query( array( 'blog_id' => $blog['blog_id'], 'fields' => 'ID', 'number' => 1, 'count_total' => true, ) ); $user_count = $blog_users->get_total(); wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS ); } printf( '%s', esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), number_format_i18n( $user_count ) ); } public function column_plugins( $blog ) { if ( has_filter( 'wpmublogsaction' ) ) { do_action( 'wpmublogsaction', $blog['blog_id'] ); } } public function column_default( $item, $column_name ) { do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] ); } public function display_rows() { foreach ( $this->items as $blog ) { $blog = $blog->to_array(); $class = ''; reset( $this->status_list ); foreach ( $this->status_list as $status => $col ) { if ( 1 == $blog[ $status ] ) { $class = " class='{$col[0]}'"; } } echo ""; $this->single_row_columns( $blog ); echo ''; } } protected function site_states( $site ) { $site_states = array(); $_site = WP_Site::get_instance( $site['blog_id'] ); if ( is_main_site( $_site->id ) ) { $site_states['main'] = __( 'Main' ); } reset( $this->status_list ); $site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; foreach ( $this->status_list as $status => $col ) { if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) { $site_states[ $col[0] ] = $col[1]; } } $site_states = apply_filters( 'display_site_states', $site_states, $_site ); if ( ! empty( $site_states ) ) { $state_count = count( $site_states ); $i = 0; echo ' — '; foreach ( $site_states as $state ) { ++$i; $sep = ( $i < $state_count ) ? ', ' : ''; echo "{$state}{$sep}"; } } } protected function get_default_primary_column_name() { return 'blogname'; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $blog = $item; $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); $actions = array( 'edit' => '', 'backend' => '', 'activate' => '', 'deactivate' => '', 'archive' => '', 'unarchive' => '', 'spam' => '', 'unspam' => '', 'delete' => '', 'visit' => '', ); $actions['edit'] = '' . __( 'Edit' ) . ''; $actions['backend'] = "" . __( 'Dashboard' ) . ''; if ( get_network()->site_id != $blog['blog_id'] ) { if ( '1' == $blog['deleted'] ) { $actions['activate'] = '' . __( 'Activate' ) . ''; } else { $actions['deactivate'] = '' . __( 'Deactivate' ) . ''; } if ( '1' == $blog['archived'] ) { $actions['unarchive'] = '' . __( 'Unarchive' ) . ''; } else { $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . ''; } if ( '1' == $blog['spam'] ) { $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . ''; } else { $actions['spam'] = '' . _x( 'Spam', 'site' ) . ''; } if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { $actions['delete'] = '' . __( 'Delete' ) . ''; } } $actions['visit'] = "" . __( 'Visit' ) . ''; $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); return $this->row_actions( $actions ); } } 'all', 'author' => false, 'category' => false, 'start_date' => false, 'end_date' => false, 'status' => false, ); $args = wp_parse_args( $args, $defaults ); do_action( 'export_wp', $args ); $sitename = sanitize_key( get_bloginfo( 'name' ) ); if ( ! empty( $sitename ) ) { $sitename .= '.'; } $date = gmdate( 'Y-m-d' ); $wp_filename = $sitename . 'WordPress.' . $date . '.xml'; $filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date ); header( 'Content-Description: File Transfer' ); header( 'Content-Disposition: attachment; filename=' . $filename ); header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) { $ptype = get_post_type_object( $args['content'] ); if ( ! $ptype->can_export ) { $args['content'] = 'post'; } $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); } else { $post_types = get_post_types( array( 'can_export' => true ) ); $esses = array_fill( 0, count( $post_types ), '%s' ); $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types ); } if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] ); } else { $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; } $join = ''; if ( $args['category'] && 'post' === $args['content'] ) { $term = term_exists( $args['category'], 'category' ); if ( $term ) { $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)"; $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] ); } } if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) { if ( $args['author'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] ); } if ( $args['start_date'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) ); } if ( $args['end_date'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) ); } } $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ); $cats = array(); $tags = array(); $terms = array(); if ( isset( $term ) && $term ) { $cat = get_term( $term['term_id'], 'category' ); $cats = array( $cat->term_id => $cat ); unset( $term, $cat ); } elseif ( 'all' === $args['content'] ) { $categories = (array) get_categories( array( 'get' => 'all' ) ); $tags = (array) get_tags( array( 'get' => 'all' ) ); $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) ); $custom_terms = (array) get_terms( array( 'taxonomy' => $custom_taxonomies, 'get' => 'all', ) ); while ( $cat = array_shift( $categories ) ) { if ( ! $cat->parent || isset( $cats[ $cat->parent ] ) ) { $cats[ $cat->term_id ] = $cat; } else { $categories[] = $cat; } } while ( $t = array_shift( $custom_terms ) ) { if ( ! $t->parent || isset( $terms[ $t->parent ] ) ) { $terms[ $t->term_id ] = $t; } else { $custom_terms[] = $t; } } unset( $categories, $custom_taxonomies, $custom_terms ); } function wxr_cdata( $str ) { if ( ! seems_utf8( $str ) ) { $str = utf8_encode( $str ); } $str = '', ']]]]>', $str ) . ']]>'; return $str; } function wxr_site_url() { if ( is_multisite() ) { return network_home_url(); } else { return get_bloginfo_rss( 'url' ); } } function wxr_cat_name( $category ) { if ( empty( $category->name ) ) { return; } echo '' . wxr_cdata( $category->name ) . "\n"; } function wxr_category_description( $category ) { if ( empty( $category->description ) ) { return; } echo '' . wxr_cdata( $category->description ) . "\n"; } function wxr_tag_name( $tag ) { if ( empty( $tag->name ) ) { return; } echo '' . wxr_cdata( $tag->name ) . "\n"; } function wxr_tag_description( $tag ) { if ( empty( $tag->description ) ) { return; } echo '' . wxr_cdata( $tag->description ) . "\n"; } function wxr_term_name( $term ) { if ( empty( $term->name ) ) { return; } echo '' . wxr_cdata( $term->name ) . "\n"; } function wxr_term_description( $term ) { if ( empty( $term->description ) ) { return; } echo "\t\t" . wxr_cdata( $term->description ) . "\n"; } function wxr_term_meta( $term ) { global $wpdb; $termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) ); foreach ( $termmeta as $meta ) { if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) { printf( "\t\t\n\t\t\t%s\n\t\t\t%s\n\t\t\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) ); } } } function wxr_authors_list( array $post_ids = null ) { global $wpdb; if ( ! empty( $post_ids ) ) { $post_ids = array_map( 'absint', $post_ids ); $and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')'; } else { $and = ''; } $authors = array(); $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" ); foreach ( (array) $results as $result ) { $authors[] = get_userdata( $result->post_author ); } $authors = array_filter( $authors ); foreach ( $authors as $author ) { echo "\t"; echo '' . (int) $author->ID . ''; echo '' . wxr_cdata( $author->user_login ) . ''; echo '' . wxr_cdata( $author->user_email ) . ''; echo '' . wxr_cdata( $author->display_name ) . ''; echo '' . wxr_cdata( $author->first_name ) . ''; echo '' . wxr_cdata( $author->last_name ) . ''; echo "\n"; } } function wxr_nav_menu_terms() { $nav_menus = wp_get_nav_menus(); if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) { return; } foreach ( $nav_menus as $menu ) { echo "\t"; echo '' . (int) $menu->term_id . ''; echo 'nav_menu'; echo '' . wxr_cdata( $menu->slug ) . ''; wxr_term_name( $menu ); echo "\n"; } } function wxr_post_taxonomy() { $post = get_post(); $taxonomies = get_object_taxonomies( $post->post_type ); if ( empty( $taxonomies ) ) { return; } $terms = wp_get_object_terms( $post->ID, $taxonomies ); foreach ( (array) $terms as $term ) { echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "\n"; } } function wxr_filter_postmeta( $return_me, $meta_key ) { if ( '_edit_lock' === $meta_key ) { $return_me = true; } return $return_me; } add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 ); echo '\n"; ?> - - - - - - - - - - - - - - - - - - - - - - <?php bloginfo_rss( 'name' ); ?> - - - - - - - - - - - - - term_id; ?> - slug ); ?> - parent ? $cats[ $c->parent ]->slug : '' ); ?> - - - - - - term_id; ?> - slug ); ?> - - - - - - term_id; ?> - taxonomy ); ?> - slug ); ?> - parent ? $terms[ $t->parent ]->slug : '' ); ?> - - - - - - - - in_the_loop = true; while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { $where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')'; $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); foreach ( $posts as $post ) { setup_postdata( $post ); $title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) ); $content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); $excerpt = wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) ); $is_sticky = is_sticky( $post->ID ) ? 1 : 0; ?> - - <?php echo $title; ?> - - - - - - - - ID; ?> - post_date ); ?> - post_date_gmt ); ?> - post_modified ); ?> - post_modified_gmt ); ?> - comment_status ); ?> - ping_status ); ?> - post_name ); ?> - post_status ); ?> - post_parent; ?> - menu_order; ?> - post_type ); ?> - post_password ); ?> - - post_type ) : ?> - ID ) ); ?> - - - get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); foreach ( $postmeta as $meta ) : if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { continue; } ?> - - meta_key ); ?> - meta_value ); ?> - - get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); $comments = array_map( 'get_comment', $_comments ); foreach ( $comments as $c ) : ?> - - comment_ID; ?> - comment_author ); ?> - comment_author_email ); ?> - comment_author_url ); ?> - comment_author_IP ); ?> - comment_date ); ?> - comment_date_gmt ); ?> - comment_content ); ?> - comment_approved ); ?> - comment_type ); ?> - comment_parent; ?> - user_id; ?> - get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); foreach ( $c_meta as $meta ) : if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) { continue; } ?> - - meta_key ); ?> - meta_value ); ?> - - - - - - - - - 'Plugin Name', 'PluginURI' => 'Plugin URI', 'Version' => 'Version', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', 'UpdateURI' => 'Update URI', '_sitewide' => 'Site Wide Only', ); $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' ); if ( ! $plugin_data['Network'] && $plugin_data['_sitewide'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), 'Site Wide Only: true', 'Network: true' ) ); $plugin_data['Network'] = $plugin_data['_sitewide']; } $plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) ); unset( $plugin_data['_sitewide'] ); if ( ! $plugin_data['TextDomain'] ) { $plugin_slug = dirname( plugin_basename( $plugin_file ) ); if ( '.' !== $plugin_slug && false === strpos( $plugin_slug, '/' ) ) { $plugin_data['TextDomain'] = $plugin_slug; } } if ( $markup || $translate ) { $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate ); } else { $plugin_data['Title'] = $plugin_data['Name']; $plugin_data['AuthorName'] = $plugin_data['Author']; } return $plugin_data; } function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) { $plugin_file = plugin_basename( $plugin_file ); if ( $translate ) { $textdomain = $plugin_data['TextDomain']; if ( $textdomain ) { if ( ! is_textdomain_loaded( $textdomain ) ) { if ( $plugin_data['DomainPath'] ) { load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] ); } else { load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); } } } elseif ( 'hello.php' === basename( $plugin_file ) ) { $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { if ( ! empty( $plugin_data[ $field ] ) ) { $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain ); } } } } $allowed_tags_in_links = array( 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $allowed_tags = $allowed_tags_in_links; $allowed_tags['a'] = array( 'href' => true, 'title' => true, ); $plugin_data['Name'] = wp_kses( $plugin_data['Name'], $allowed_tags_in_links ); $plugin_data['Author'] = wp_kses( $plugin_data['Author'], $allowed_tags ); $plugin_data['Description'] = wp_kses( $plugin_data['Description'], $allowed_tags ); $plugin_data['Version'] = wp_kses( $plugin_data['Version'], $allowed_tags ); $plugin_data['PluginURI'] = esc_url( $plugin_data['PluginURI'] ); $plugin_data['AuthorURI'] = esc_url( $plugin_data['AuthorURI'] ); $plugin_data['Title'] = $plugin_data['Name']; $plugin_data['AuthorName'] = $plugin_data['Author']; if ( $markup ) { if ( $plugin_data['PluginURI'] && $plugin_data['Name'] ) { $plugin_data['Title'] = '' . $plugin_data['Name'] . ''; } if ( $plugin_data['AuthorURI'] && $plugin_data['Author'] ) { $plugin_data['Author'] = '' . $plugin_data['Author'] . ''; } $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); if ( $plugin_data['Author'] ) { $plugin_data['Description'] .= sprintf( ' ' . __( 'By %s.' ) . '', $plugin_data['Author'] ); } } return $plugin_data; } function get_plugin_files( $plugin ) { $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; $dir = dirname( $plugin_file ); $plugin_files = array( plugin_basename( $plugin_file ) ); if ( is_dir( $dir ) && WP_PLUGIN_DIR !== $dir ) { $exclusions = (array) apply_filters( 'plugin_files_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) ); $list_files = list_files( $dir, 100, $exclusions ); $list_files = array_map( 'plugin_basename', $list_files ); $plugin_files = array_merge( $plugin_files, $list_files ); $plugin_files = array_values( array_unique( $plugin_files ) ); } return $plugin_files; } function get_plugins( $plugin_folder = '' ) { $cache_plugins = wp_cache_get( 'plugins', 'plugins' ); if ( ! $cache_plugins ) { $cache_plugins = array(); } if ( isset( $cache_plugins[ $plugin_folder ] ) ) { return $cache_plugins[ $plugin_folder ]; } $wp_plugins = array(); $plugin_root = WP_PLUGIN_DIR; if ( ! empty( $plugin_folder ) ) { $plugin_root .= $plugin_folder; } $plugins_dir = @opendir( $plugin_root ); $plugin_files = array(); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( '.' === substr( $file, 0, 1 ) ) { continue; } if ( is_dir( $plugin_root . '/' . $file ) ) { $plugins_subdir = @opendir( $plugin_root . '/' . $file ); if ( $plugins_subdir ) { while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) { if ( '.' === substr( $subfile, 0, 1 ) ) { continue; } if ( '.php' === substr( $subfile, -4 ) ) { $plugin_files[] = "$file/$subfile"; } } closedir( $plugins_subdir ); } } else { if ( '.php' === substr( $file, -4 ) ) { $plugin_files[] = $file; } } } closedir( $plugins_dir ); } if ( empty( $plugin_files ) ) { return $wp_plugins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( "$plugin_root/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { continue; } $wp_plugins[ plugin_basename( $plugin_file ) ] = $plugin_data; } uasort( $wp_plugins, '_sort_uname_callback' ); $cache_plugins[ $plugin_folder ] = $wp_plugins; wp_cache_set( 'plugins', $cache_plugins, 'plugins' ); return $wp_plugins; } function get_mu_plugins() { $wp_plugins = array(); $plugin_files = array(); if ( ! is_dir( WPMU_PLUGIN_DIR ) ) { return $wp_plugins; } $plugins_dir = @opendir( WPMU_PLUGIN_DIR ); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( '.php' === substr( $file, -4 ) ) { $plugin_files[] = $file; } } } else { return $wp_plugins; } closedir( $plugins_dir ); if ( empty( $plugin_files ) ) { return $wp_plugins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { $plugin_data['Name'] = $plugin_file; } $wp_plugins[ $plugin_file ] = $plugin_data; } if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) { unset( $wp_plugins['index.php'] ); } uasort( $wp_plugins, '_sort_uname_callback' ); return $wp_plugins; } function _sort_uname_callback( $a, $b ) { return strnatcasecmp( $a['Name'], $b['Name'] ); } function get_dropins() { $dropins = array(); $plugin_files = array(); $_dropins = _get_dropins(); $plugins_dir = @opendir( WP_CONTENT_DIR ); if ( $plugins_dir ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( isset( $_dropins[ $file ] ) ) { $plugin_files[] = $file; } } } else { return $dropins; } closedir( $plugins_dir ); if ( empty( $plugin_files ) ) { return $dropins; } foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) { continue; } $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); if ( empty( $plugin_data['Name'] ) ) { $plugin_data['Name'] = $plugin_file; } $dropins[ $plugin_file ] = $plugin_data; } uksort( $dropins, 'strnatcasecmp' ); return $dropins; } function _get_dropins() { $dropins = array( 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), 'db.php' => array( __( 'Custom database class.' ), true ), 'db-error.php' => array( __( 'Custom database error message.' ), true ), 'install.php' => array( __( 'Custom installation script.' ), true ), 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), 'object-cache.php' => array( __( 'External object cache.' ), true ), 'php-error.php' => array( __( 'Custom PHP error message.' ), true ), 'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), ); if ( is_multisite() ) { $dropins['sunrise.php'] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); $dropins['blog-deleted.php'] = array( __( 'Custom site deleted message.' ), true ); $dropins['blog-inactive.php'] = array( __( 'Custom site inactive message.' ), true ); $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); } return $dropins; } function is_plugin_active( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin ); } function is_plugin_inactive( $plugin ) { return ! is_plugin_active( $plugin ); } function is_plugin_active_for_network( $plugin ) { if ( ! is_multisite() ) { return false; } $plugins = get_site_option( 'active_sitewide_plugins' ); if ( isset( $plugins[ $plugin ] ) ) { return true; } return false; } function is_network_only_plugin( $plugin ) { $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); if ( $plugin_data ) { return $plugin_data['Network']; } return false; } function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { $plugin = plugin_basename( trim( $plugin ) ); if ( is_multisite() && ( $network_wide || is_network_only_plugin( $plugin ) ) ) { $network_wide = true; $current = get_site_option( 'active_sitewide_plugins', array() ); $_GET['networkwide'] = 1; } else { $current = get_option( 'active_plugins', array() ); } $valid = validate_plugin( $plugin ); if ( is_wp_error( $valid ) ) { return $valid; } $requirements = validate_plugin_requirements( $plugin ); if ( is_wp_error( $requirements ) ) { return $requirements; } if ( $network_wide && ! isset( $current[ $plugin ] ) || ! $network_wide && ! in_array( $plugin, $current, true ) ) { if ( ! empty( $redirect ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); } ob_start(); plugin_sandbox_scrape( $plugin ); if ( ! $silent ) { do_action( 'activate_plugin', $plugin, $network_wide ); do_action( "activate_{$plugin}", $network_wide ); } if ( $network_wide ) { $current = get_site_option( 'active_sitewide_plugins', array() ); $current[ $plugin ] = time(); update_site_option( 'active_sitewide_plugins', $current ); } else { $current = get_option( 'active_plugins', array() ); $current[] = $plugin; sort( $current ); update_option( 'active_plugins', $current ); } if ( ! $silent ) { do_action( 'activated_plugin', $plugin, $network_wide ); } if ( ob_get_length() > 0 ) { $output = ob_get_clean(); return new WP_Error( 'unexpected_output', __( 'The plugin generated unexpected output.' ), $output ); } ob_end_clean(); } return null; } function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { if ( is_multisite() ) { $network_current = get_site_option( 'active_sitewide_plugins', array() ); } $current = get_option( 'active_plugins', array() ); $do_blog = false; $do_network = false; foreach ( (array) $plugins as $plugin ) { $plugin = plugin_basename( trim( $plugin ) ); if ( ! is_plugin_active( $plugin ) ) { continue; } $network_deactivating = ( false !== $network_wide ) && is_plugin_active_for_network( $plugin ); if ( ! $silent ) { do_action( 'deactivate_plugin', $plugin, $network_deactivating ); } if ( false !== $network_wide ) { if ( is_plugin_active_for_network( $plugin ) ) { $do_network = true; unset( $network_current[ $plugin ] ); } elseif ( $network_wide ) { continue; } } if ( true !== $network_wide ) { $key = array_search( $plugin, $current, true ); if ( false !== $key ) { $do_blog = true; unset( $current[ $key ] ); } } if ( $do_blog && wp_is_recovery_mode() ) { list( $extension ) = explode( '/', $plugin ); wp_paused_plugins()->delete( $extension ); } if ( ! $silent ) { do_action( "deactivate_{$plugin}", $network_deactivating ); do_action( 'deactivated_plugin', $plugin, $network_deactivating ); } } if ( $do_blog ) { update_option( 'active_plugins', $current ); } if ( $do_network ) { update_site_option( 'active_sitewide_plugins', $network_current ); } } function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) { if ( ! is_array( $plugins ) ) { $plugins = array( $plugins ); } $errors = array(); foreach ( $plugins as $plugin ) { if ( ! empty( $redirect ) ) { $redirect = add_query_arg( 'plugin', $plugin, $redirect ); } $result = activate_plugin( $plugin, $redirect, $network_wide, $silent ); if ( is_wp_error( $result ) ) { $errors[ $plugin ] = $result; } } if ( ! empty( $errors ) ) { return new WP_Error( 'plugins_invalid', __( 'One of the plugins is invalid.' ), $errors ); } return true; } function delete_plugins( $plugins, $deprecated = '' ) { global $wp_filesystem; if ( empty( $plugins ) ) { return false; } $checked = array(); foreach ( $plugins as $plugin ) { $checked[] = 'checked[]=' . $plugin; } $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&' . implode( '&', $checked ), 'bulk-plugins' ); ob_start(); $credentials = request_filesystem_credentials( $url ); $data = ob_get_clean(); if ( false === $credentials ) { if ( ! empty( $data ) ) { require_once ABSPATH . 'wp-admin/admin-header.php'; echo $data; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } return; } if ( ! WP_Filesystem( $credentials ) ) { ob_start(); request_filesystem_credentials( $url, '', true ); $data = ob_get_clean(); if ( ! empty( $data ) ) { require_once ABSPATH . 'wp-admin/admin-header.php'; echo $data; require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } return; } if ( ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); } $plugins_dir = $wp_filesystem->wp_plugins_dir(); if ( empty( $plugins_dir ) ) { return new WP_Error( 'fs_no_plugins_dir', __( 'Unable to locate WordPress plugin directory.' ) ); } $plugins_dir = trailingslashit( $plugins_dir ); $plugin_translations = wp_get_installed_translations( 'plugins' ); $errors = array(); foreach ( $plugins as $plugin_file ) { if ( is_uninstallable_plugin( $plugin_file ) ) { uninstall_plugin( $plugin_file ); } do_action( 'delete_plugin', $plugin_file ); $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) ); if ( strpos( $plugin_file, '/' ) && $this_plugin_dir !== $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { $deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file ); } do_action( 'deleted_plugin', $plugin_file, $deleted ); if ( ! $deleted ) { $errors[] = $plugin_file; continue; } $plugin_slug = dirname( $plugin_file ); if ( 'hello.php' === $plugin_file ) { $plugin_slug = 'hello-dolly'; } if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { $translations = $plugin_translations[ $plugin_slug ]; foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' ); $json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' ); if ( $json_translation_files ) { array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); } } } } $current = get_site_transient( 'update_plugins' ); if ( $current ) { $deleted = array_diff( $plugins, $errors ); foreach ( $deleted as $plugin_file ) { unset( $current->response[ $plugin_file ] ); } set_site_transient( 'update_plugins', $current ); } if ( ! empty( $errors ) ) { if ( 1 === count( $errors ) ) { $message = __( 'Could not fully remove the plugin %s.' ); } else { $message = __( 'Could not fully remove the plugins %s.' ); } return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) ); } return true; } function validate_active_plugins() { $plugins = get_option( 'active_plugins', array() ); if ( ! is_array( $plugins ) ) { update_option( 'active_plugins', array() ); $plugins = array(); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); $plugins = array_merge( $plugins, array_keys( $network_plugins ) ); } if ( empty( $plugins ) ) { return array(); } $invalid = array(); foreach ( $plugins as $plugin ) { $result = validate_plugin( $plugin ); if ( is_wp_error( $result ) ) { $invalid[ $plugin ] = $result; deactivate_plugins( $plugin, true ); } } return $invalid; } function validate_plugin( $plugin ) { if ( validate_file( $plugin ) ) { return new WP_Error( 'plugin_invalid', __( 'Invalid plugin path.' ) ); } if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin ) ) { return new WP_Error( 'plugin_not_found', __( 'Plugin file does not exist.' ) ); } $installed_plugins = get_plugins(); if ( ! isset( $installed_plugins[ $plugin ] ) ) { return new WP_Error( 'no_plugin_header', __( 'The plugin does not have a valid header.' ) ); } return 0; } function validate_plugin_requirements( $plugin ) { $plugin_headers = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $requirements = array( 'requires' => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '', 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '', ); $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); $php_update_message = '

          ' . sprintf( __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $php_update_message .= '

          ' . $annotation . ''; } if ( ! $compatible_wp && ! $compatible_php ) { return new WP_Error( 'plugin_wp_php_incompatible', '

          ' . sprintf( _x( 'Error: Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ), get_bloginfo( 'version' ), phpversion(), $plugin_headers['Name'], $requirements['requires'], $requirements['requires_php'] ) . $php_update_message . '

          ' ); } elseif ( ! $compatible_php ) { return new WP_Error( 'plugin_php_incompatible', '

          ' . sprintf( _x( 'Error: Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ), phpversion(), $plugin_headers['Name'], $requirements['requires_php'] ) . $php_update_message . '

          ' ); } elseif ( ! $compatible_wp ) { return new WP_Error( 'plugin_wp_incompatible', '

          ' . sprintf( _x( 'Error: Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ), get_bloginfo( 'version' ), $plugin_headers['Name'], $requirements['requires'] ) . '

          ' ); } return true; } function is_uninstallable_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); if ( isset( $uninstallable_plugins[ $file ] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { return true; } return false; } function uninstall_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); do_action( 'pre_uninstall_plugin', $plugin, $uninstallable_plugins ); if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { if ( isset( $uninstallable_plugins[ $file ] ) ) { unset( $uninstallable_plugins[ $file ] ); update_option( 'uninstall_plugins', $uninstallable_plugins ); } unset( $uninstallable_plugins ); define( 'WP_UNINSTALL_PLUGIN', $file ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); include_once WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php'; return true; } if ( isset( $uninstallable_plugins[ $file ] ) ) { $callable = $uninstallable_plugins[ $file ]; unset( $uninstallable_plugins[ $file ] ); update_option( 'uninstall_plugins', $uninstallable_plugins ); unset( $uninstallable_plugins ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); include_once WP_PLUGIN_DIR . '/' . $file; add_action( "uninstall_{$file}", $callable ); do_action( "uninstall_{$file}" ); } } function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null ) { global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages; $menu_slug = plugin_basename( $menu_slug ); $admin_page_hooks[ $menu_slug ] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $menu_slug, '' ); if ( ! empty( $callback ) && ! empty( $hookname ) && current_user_can( $capability ) ) { add_action( $hookname, $callback ); } if ( empty( $icon_url ) ) { $icon_url = 'dashicons-admin-generic'; $icon_class = 'menu-icon-generic '; } else { $icon_url = set_url_scheme( $icon_url ); $icon_class = ''; } $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url ); if ( null !== $position && ! is_numeric( $position ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The seventh parameter passed to %s should be numeric representing menu position.' ), 'add_menu_page()' ), '6.0.0' ); $position = null; } if ( null === $position || ! is_numeric( $position ) ) { $menu[] = $new_menu; } elseif ( isset( $menu[ (string) $position ] ) ) { $collision_avoider = base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001; $position = (string) ( $position + $collision_avoider ); $menu[ $position ] = $new_menu; } else { $position = (string) $position; $menu[ $position ] = $new_menu; } $_registered_pages[ $hookname ] = true; $_parent_pages[ $menu_slug ] = false; return $hookname; } function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv, $_registered_pages, $_parent_pages; $menu_slug = plugin_basename( $menu_slug ); $parent_slug = plugin_basename( $parent_slug ); if ( isset( $_wp_real_parent_file[ $parent_slug ] ) ) { $parent_slug = $_wp_real_parent_file[ $parent_slug ]; } if ( ! current_user_can( $capability ) ) { $_wp_submenu_nopriv[ $parent_slug ][ $menu_slug ] = true; return false; } if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) { foreach ( (array) $menu as $parent_menu ) { if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) { $submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 ); } } } $new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title ); if ( null !== $position && ! is_numeric( $position ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The seventh parameter passed to %s should be numeric representing menu position.' ), 'add_submenu_page()' ), '5.3.0' ); $position = null; } if ( null === $position || ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) ) { $submenu[ $parent_slug ][] = $new_sub_menu; } else { $position = max( $position, 0 ); if ( 0 === $position ) { array_unshift( $submenu[ $parent_slug ], $new_sub_menu ); } else { $before_items = array_slice( $submenu[ $parent_slug ], 0, $position, true ); $after_items = array_slice( $submenu[ $parent_slug ], $position, null, true ); $before_items[] = $new_sub_menu; $submenu[ $parent_slug ] = array_merge( $before_items, $after_items ); } } ksort( $submenu[ $parent_slug ] ); $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug ); if ( ! empty( $callback ) && ! empty( $hookname ) ) { add_action( $hookname, $callback ); } $_registered_pages[ $hookname ] = true; if ( 'tools.php' === $parent_slug ) { $_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true; } $_parent_pages[ $menu_slug ] = $parent_slug; return $hookname; } function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { if ( current_user_can( 'edit_users' ) ) { $parent = 'users.php'; } else { $parent = 'profile.php'; } return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) { return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position ); } function remove_menu_page( $menu_slug ) { global $menu; foreach ( $menu as $i => $item ) { if ( $menu_slug === $item[2] ) { unset( $menu[ $i ] ); return $item; } } return false; } function remove_submenu_page( $menu_slug, $submenu_slug ) { global $submenu; if ( ! isset( $submenu[ $menu_slug ] ) ) { return false; } foreach ( $submenu[ $menu_slug ] as $i => $item ) { if ( $submenu_slug === $item[2] ) { unset( $submenu[ $menu_slug ][ $i ] ); return $item; } } return false; } function menu_page_url( $menu_slug, $display = true ) { global $_parent_pages; if ( isset( $_parent_pages[ $menu_slug ] ) ) { $parent_slug = $_parent_pages[ $menu_slug ]; if ( $parent_slug && ! isset( $_parent_pages[ $parent_slug ] ) ) { $url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) ); } else { $url = admin_url( 'admin.php?page=' . $menu_slug ); } } else { $url = ''; } $url = esc_url( $url ); if ( $display ) { echo $url; } return $url; } function get_admin_page_parent( $parent_page = '' ) { global $parent_file, $menu, $submenu, $pagenow, $typenow, $plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv; if ( ! empty( $parent_page ) && 'admin.php' !== $parent_page ) { if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) { $parent_page = $_wp_real_parent_file[ $parent_page ]; } return $parent_page; } if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) { foreach ( (array) $menu as $parent_menu ) { if ( $parent_menu[2] === $plugin_page ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } } if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) { $parent_file = $pagenow; if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } return $parent_file; } foreach ( array_keys( (array) $submenu ) as $parent_page ) { foreach ( $submenu[ $parent_page ] as $submenu_array ) { if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) { $parent_page = $_wp_real_parent_file[ $parent_page ]; } if ( ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $submenu_array[2] ) { $parent_file = $parent_page; return $parent_page; } elseif ( empty( $typenow ) && $pagenow === $submenu_array[2] && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) ) { $parent_file = $parent_page; return $parent_page; } elseif ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] ) { $parent_file = $parent_page; return $parent_page; } } } if ( empty( $parent_file ) ) { $parent_file = ''; } return ''; } function get_admin_page_title() { global $title, $menu, $submenu, $pagenow, $typenow, $plugin_page; if ( ! empty( $title ) ) { return $title; } $hook = get_plugin_page_hook( $plugin_page, $pagenow ); $parent = get_admin_page_parent(); $parent1 = $parent; if ( empty( $parent ) ) { foreach ( (array) $menu as $menu_array ) { if ( isset( $menu_array[3] ) ) { if ( $menu_array[2] === $pagenow ) { $title = $menu_array[3]; return $menu_array[3]; } elseif ( isset( $plugin_page ) && $plugin_page === $menu_array[2] && $hook === $menu_array[5] ) { $title = $menu_array[3]; return $menu_array[3]; } } else { $title = $menu_array[0]; return $title; } } } else { foreach ( array_keys( $submenu ) as $parent ) { foreach ( $submenu[ $parent ] as $submenu_array ) { if ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] && ( $pagenow === $parent || $plugin_page === $parent || $plugin_page === $hook || 'admin.php' === $pagenow && $parent1 !== $submenu_array[2] || ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $parent ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } if ( $submenu_array[2] !== $pagenow || isset( $_GET['page'] ) ) { continue; } if ( isset( $submenu_array[3] ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } else { $title = $submenu_array[0]; return $title; } } } if ( empty( $title ) ) { foreach ( $menu as $menu_array ) { if ( isset( $plugin_page ) && $plugin_page === $menu_array[2] && 'admin.php' === $pagenow && $parent1 === $menu_array[2] ) { $title = $menu_array[3]; return $menu_array[3]; } } } } return $title; } function get_plugin_page_hook( $plugin_page, $parent_page ) { $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); if ( has_action( $hook ) ) { return $hook; } else { return null; } } function get_plugin_page_hookname( $plugin_page, $parent_page ) { global $admin_page_hooks; $parent = get_admin_page_parent( $parent_page ); $page_type = 'admin'; if ( empty( $parent_page ) || 'admin.php' === $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) { if ( isset( $admin_page_hooks[ $plugin_page ] ) ) { $page_type = 'toplevel'; } elseif ( isset( $admin_page_hooks[ $parent ] ) ) { $page_type = $admin_page_hooks[ $parent ]; } } elseif ( isset( $admin_page_hooks[ $parent ] ) ) { $page_type = $admin_page_hooks[ $parent ]; } $plugin_name = preg_replace( '!\.php!', '', $plugin_page ); return $page_type . '_page_' . $plugin_name; } function user_can_access_admin_page() { global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv, $plugin_page, $_registered_pages; $parent = get_admin_page_parent(); if ( ! isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $parent ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) ) { if ( isset( $_wp_submenu_nopriv[ $parent ][ $plugin_page ] ) ) { return false; } $hookname = get_plugin_page_hookname( $plugin_page, $parent ); if ( ! isset( $_registered_pages[ $hookname ] ) ) { return false; } } if ( empty( $parent ) ) { if ( isset( $_wp_menu_nopriv[ $pagenow ] ) ) { return false; } if ( isset( $_wp_submenu_nopriv[ $pagenow ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } foreach ( array_keys( $_wp_submenu_nopriv ) as $key ) { if ( isset( $_wp_submenu_nopriv[ $key ][ $pagenow ] ) ) { return false; } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $key ][ $plugin_page ] ) ) { return false; } } return true; } if ( isset( $plugin_page ) && $plugin_page === $parent && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } if ( isset( $submenu[ $parent ] ) ) { foreach ( $submenu[ $parent ] as $submenu_array ) { if ( isset( $plugin_page ) && $submenu_array[2] === $plugin_page ) { return current_user_can( $submenu_array[1] ); } elseif ( $submenu_array[2] === $pagenow ) { return current_user_can( $submenu_array[1] ); } } } foreach ( $menu as $menu_array ) { if ( $menu_array[2] === $parent ) { return current_user_can( $menu_array[1] ); } } return true; } function option_update_filter( $options ) { global $new_allowed_options; if ( is_array( $new_allowed_options ) ) { $options = add_allowed_options( $new_allowed_options, $options ); } return $options; } function add_allowed_options( $new_options, $options = '' ) { if ( '' === $options ) { global $allowed_options; } else { $allowed_options = $options; } foreach ( $new_options as $page => $keys ) { foreach ( $keys as $key ) { if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) { $allowed_options[ $page ] = array(); $allowed_options[ $page ][] = $key; } else { $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false === $pos ) { $allowed_options[ $page ][] = $key; } } } } return $allowed_options; } function remove_allowed_options( $del_options, $options = '' ) { if ( '' === $options ) { global $allowed_options; } else { $allowed_options = $options; } foreach ( $del_options as $page => $keys ) { foreach ( $keys as $key ) { if ( isset( $allowed_options[ $page ] ) && is_array( $allowed_options[ $page ] ) ) { $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false !== $pos ) { unset( $allowed_options[ $page ][ $pos ] ); } } } } return $allowed_options; } function settings_fields( $option_group ) { echo ""; echo ''; wp_nonce_field( "$option_group-options" ); } function wp_clean_plugins_cache( $clear_update_cache = true ) { if ( $clear_update_cache ) { delete_site_transient( 'update_plugins' ); } wp_cache_delete( 'plugins', 'plugins' ); } function plugin_sandbox_scrape( $plugin ) { if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); include_once WP_PLUGIN_DIR . '/' . $plugin; } function wp_add_privacy_policy_content( $plugin_name, $policy_text ) { if ( ! is_admin() ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ), 'admin_init' ), '4.9.7' ); return; } elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ), 'admin_init' ), '4.9.7' ); return; } if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } WP_Privacy_Policy_Content::add( $plugin_name, $policy_text ); } function is_plugin_paused( $plugin ) { if ( ! isset( $GLOBALS['_paused_plugins'] ) ) { return false; } if ( ! is_plugin_active( $plugin ) ) { return false; } list( $plugin ) = explode( '/', $plugin ); return array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ); } function wp_get_plugin_error( $plugin ) { if ( ! isset( $GLOBALS['_paused_plugins'] ) ) { return false; } list( $plugin ) = explode( '/', $plugin ); if ( ! array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ) ) { return false; } return $GLOBALS['_paused_plugins'][ $plugin ]; } function resume_plugin( $plugin, $redirect = '' ) { if ( ! empty( $redirect ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-resume-error_' . $plugin ), $redirect ) ); ob_start(); plugin_sandbox_scrape( $plugin ); ob_clean(); } list( $extension ) = explode( '/', $plugin ); $result = wp_paused_plugins()->delete( $extension ); if ( ! $result ) { return new WP_Error( 'could_not_resume_plugin', __( 'Could not resume the plugin.' ) ); } return true; } function paused_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'resume_plugins' ) ) { return; } if ( ! isset( $GLOBALS['_paused_plugins'] ) || empty( $GLOBALS['_paused_plugins'] ) ) { return; } printf( '

          %s
          %s

          %s

          ', __( 'One or more plugins failed to load properly.' ), __( 'You can find more details and make changes on the Plugins screen.' ), esc_url( admin_url( 'plugins.php?plugin_status=paused' ) ), __( 'Go to the Plugins screen' ) ); } function deactivated_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'activate_plugins' ) ) { return; } $blog_deactivated_plugins = get_option( 'wp_force_deactivated_plugins' ); $site_deactivated_plugins = array(); if ( false === $blog_deactivated_plugins ) { update_option( 'wp_force_deactivated_plugins', array() ); } if ( is_multisite() ) { $site_deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins' ); if ( false === $site_deactivated_plugins ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } } if ( empty( $blog_deactivated_plugins ) && empty( $site_deactivated_plugins ) ) { return; } $deactivated_plugins = array_merge( $blog_deactivated_plugins, $site_deactivated_plugins ); foreach ( $deactivated_plugins as $plugin ) { if ( ! empty( $plugin['version_compatible'] ) && ! empty( $plugin['version_deactivated'] ) ) { $explanation = sprintf( __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s, please upgrade to %1$s %4$s or later.' ), $plugin['plugin_name'], $plugin['version_deactivated'], $GLOBALS['wp_version'], $plugin['version_compatible'] ); } else { $explanation = sprintf( __( '%1$s %2$s was deactivated due to incompatibility with WordPress %3$s.' ), $plugin['plugin_name'], ! empty( $plugin['version_deactivated'] ) ? $plugin['version_deactivated'] : '', $GLOBALS['wp_version'], $plugin['version_compatible'] ); } printf( '

          %s
          %s

          %s

          ', sprintf( __( '%s plugin deactivated during WordPress upgrade.' ), $plugin['plugin_name'] ), $explanation, esc_url( admin_url( 'plugins.php?plugin_status=inactive' ) ), __( 'Go to the Plugins screen' ) ); } update_option( 'wp_force_deactivated_plugins', array() ); if ( is_multisite() ) { update_site_option( 'wp_force_deactivated_plugins', array() ); } } __( 'Name' ), 'created' => __( 'Created' ), 'last_used' => __( 'Last Used' ), 'last_ip' => __( 'Last IP' ), 'revoke' => __( 'Revoke' ), ); } public function prepare_items() { global $user_id; $this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) ); } public function column_name( $item ) { echo esc_html( $item['name'] ); } public function column_created( $item ) { if ( empty( $item['created'] ) ) { echo '—'; } else { echo date_i18n( __( 'F j, Y' ), $item['created'] ); } } public function column_last_used( $item ) { if ( empty( $item['last_used'] ) ) { echo '—'; } else { echo date_i18n( __( 'F j, Y' ), $item['last_used'] ); } } public function column_last_ip( $item ) { if ( empty( $item['last_ip'] ) ) { echo '—'; } else { echo $item['last_ip']; } } public function column_revoke( $item ) { $name = 'revoke-application-password-' . $item['uuid']; printf( '', esc_attr( $name ), esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ), __( 'Revoke' ) ); } protected function column_default( $item, $column_name ) { do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); } protected function display_tablenav( $which ) { ?> -
          - -
          - -
          - -
          - bulk_actions( $which ); ?> -
          - extra_tablenav( $which ); $this->pagination( $which ); ?> -
          -
          - '; $this->single_row_columns( $item ); echo ''; } protected function get_default_primary_column_name() { return 'name'; } public function print_js_template_row() { list( $columns, $hidden, , $primary ) = $this->get_column_info(); echo ''; foreach ( $columns as $column_name => $display_name ) { $is_primary = $primary === $column_name; $classes = "{$column_name} column-{$column_name}"; if ( $is_primary ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } printf( '', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) ); switch ( $column_name ) { case 'name': echo '{{ data.name }}'; break; case 'created': echo '<# print( wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ', data.created ) ) #>'; break; case 'last_used': echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>"; break; case 'last_ip': echo "{{ data.last_ip || '—' }}"; break; case 'revoke': printf( '', esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ), esc_html__( 'Revoke' ) ); break; default: do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name ); break; } if ( $is_primary ) { echo ''; } echo ''; } echo ''; } } errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); } $themes_dir = $wp_filesystem->wp_themes_dir(); if ( empty( $themes_dir ) ) { return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) ); } do_action( 'delete_theme', $stylesheet ); $themes_dir = trailingslashit( $themes_dir ); $theme_dir = trailingslashit( $themes_dir . $stylesheet ); $deleted = $wp_filesystem->delete( $theme_dir, true ); do_action( 'deleted_theme', $stylesheet, $deleted ); if ( ! $deleted ) { return new WP_Error( 'could_not_remove_theme', sprintf( __( 'Could not fully remove the theme %s.' ), $stylesheet ) ); } $theme_translations = wp_get_installed_translations( 'themes' ); if ( ! empty( $theme_translations[ $stylesheet ] ) ) { $translations = $theme_translations[ $stylesheet ]; foreach ( $translations as $translation => $data ) { $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' ); if ( $json_translation_files ) { array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); } } } if ( is_multisite() ) { WP_Theme::network_disable_theme( $stylesheet ); } delete_site_transient( 'update_themes' ); return true; } function get_page_templates( $post = null, $post_type = 'page' ) { return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) ); } function _get_template_edit_filename( $fullpath, $containingfolder ) { return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath ); } function theme_update_available( $theme ) { echo get_theme_update_available( $theme ); } function get_theme_update_available( $theme ) { static $themes_update = null; if ( ! current_user_can( 'update_themes' ) ) { return false; } if ( ! isset( $themes_update ) ) { $themes_update = get_site_transient( 'update_themes' ); } if ( ! ( $theme instanceof WP_Theme ) ) { return false; } $stylesheet = $theme->get_stylesheet(); $html = ''; if ( isset( $themes_update->response[ $stylesheet ] ) ) { $update = $themes_update->response[ $stylesheet ]; $theme_name = $theme->display( 'Name' ); $details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800, ), $update['url'] ); $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); if ( ! is_multisite() ) { if ( ! current_user_can( 'update_themes' ) ) { $html = sprintf( '

          ' . __( 'There is a new version of %1$s available. View version %4$s details.' ) . '

          ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } elseif ( empty( $update['package'] ) ) { $html = sprintf( '

          ' . __( 'There is a new version of %1$s available. View version %4$s details. Automatic update is unavailable for this theme.' ) . '

          ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'] ); } else { $html = sprintf( '

          ' . __( 'There is a new version of %1$s available. View version %4$s details or update now.' ) . '

          ', $theme_name, esc_url( $details_url ), sprintf( 'class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ) ), $update['new_version'], $update_url, sprintf( 'aria-label="%s" id="update-theme" data-slug="%s"', esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme_name ) ), $stylesheet ) ); } } } return $html; } function get_theme_feature_list( $api = true ) { $features = array( __( 'Subject' ) => array( 'blog' => __( 'Blog' ), 'e-commerce' => __( 'E-Commerce' ), 'education' => __( 'Education' ), 'entertainment' => __( 'Entertainment' ), 'food-and-drink' => __( 'Food & Drink' ), 'holiday' => __( 'Holiday' ), 'news' => __( 'News' ), 'photography' => __( 'Photography' ), 'portfolio' => __( 'Portfolio' ), ), __( 'Features' ) => array( 'accessibility-ready' => __( 'Accessibility Ready' ), 'block-patterns' => __( 'Block Editor Patterns' ), 'block-styles' => __( 'Block Editor Styles' ), 'custom-background' => __( 'Custom Background' ), 'custom-colors' => __( 'Custom Colors' ), 'custom-header' => __( 'Custom Header' ), 'custom-logo' => __( 'Custom Logo' ), 'editor-style' => __( 'Editor Style' ), 'featured-image-header' => __( 'Featured Image Header' ), 'featured-images' => __( 'Featured Images' ), 'footer-widgets' => __( 'Footer Widgets' ), 'full-site-editing' => __( 'Full Site Editing' ), 'full-width-template' => __( 'Full Width Template' ), 'post-formats' => __( 'Post Formats' ), 'sticky-post' => __( 'Sticky Post' ), 'template-editing' => __( 'Template Editing' ), 'theme-options' => __( 'Theme Options' ), ), __( 'Layout' ) => array( 'grid-layout' => __( 'Grid Layout' ), 'one-column' => __( 'One Column' ), 'two-columns' => __( 'Two Columns' ), 'three-columns' => __( 'Three Columns' ), 'four-columns' => __( 'Four Columns' ), 'left-sidebar' => __( 'Left Sidebar' ), 'right-sidebar' => __( 'Right Sidebar' ), 'wide-blocks' => __( 'Wide Blocks' ), ), ); if ( ! $api || ! current_user_can( 'install_themes' ) ) { return $features; } $feature_list = get_site_transient( 'wporg_theme_feature_list' ); if ( ! $feature_list ) { set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); } if ( ! $feature_list ) { $feature_list = themes_api( 'feature_list', array() ); if ( is_wp_error( $feature_list ) ) { return $features; } } if ( ! $feature_list ) { return $features; } set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); $category_translations = array( 'Layout' => __( 'Layout' ), 'Features' => __( 'Features' ), 'Subject' => __( 'Subject' ), ); $wporg_features = array(); foreach ( (array) $feature_list as $feature_category => $feature_items ) { if ( isset( $category_translations[ $feature_category ] ) ) { $feature_category = $category_translations[ $feature_category ]; } $wporg_features[ $feature_category ] = array(); foreach ( $feature_items as $feature ) { if ( isset( $features[ $feature_category ][ $feature ] ) ) { $wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ]; } else { $wporg_features[ $feature_category ][ $feature ] = $feature; } } } return $wporg_features; } function themes_api( $action, $args = array() ) { require ABSPATH . WPINC . '/version.php'; if ( is_array( $args ) ) { $args = (object) $args; } if ( 'query_themes' === $action ) { if ( ! isset( $args->per_page ) ) { $args->per_page = 24; } } if ( ! isset( $args->locale ) ) { $args->locale = get_user_locale(); } if ( ! isset( $args->wp_version ) ) { $args->wp_version = substr( $wp_version, 0, 3 ); } $args = apply_filters( 'themes_api_args', $args, $action ); $res = apply_filters( 'themes_api', false, $action, $args ); if ( ! $res ) { $url = 'http://api.wordpress.org/themes/info/1.2/'; $url = add_query_arg( array( 'action' => $action, 'request' => $args, ), $url ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $http_args = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); $request = wp_remote_get( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { if ( ! wp_doing_ajax() ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); } $request = wp_remote_get( $http_url, $http_args ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'themes_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( is_array( $res ) ) { $res = (object) $res; } elseif ( null === $res ) { $res = new WP_Error( 'themes_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } if ( isset( $res->error ) ) { $res = new WP_Error( 'themes_api_failed', $res->error ); } } if ( ! is_wp_error( $res ) ) { if ( 'query_themes' === $action ) { foreach ( $res->themes as $i => $theme ) { $res->themes[ $i ] = (object) $theme; } } if ( 'feature_list' === $action ) { $res = (array) $res; } } } return apply_filters( 'themes_api_result', $res, $action, $args ); } function wp_prepare_themes_for_js( $themes = null ) { $current_theme = get_stylesheet(); $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme ); if ( ! empty( $prepared_themes ) ) { return $prepared_themes; } $prepared_themes[ $current_theme ] = array(); if ( null === $themes ) { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! isset( $themes[ $current_theme ] ) ) { $themes[ $current_theme ] = wp_get_theme(); } } $updates = array(); $no_updates = array(); if ( ! is_multisite() && current_user_can( 'update_themes' ) ) { $updates_transient = get_site_transient( 'update_themes' ); if ( isset( $updates_transient->response ) ) { $updates = $updates_transient->response; } if ( isset( $updates_transient->no_update ) ) { $no_updates = $updates_transient->no_update; } } WP_Theme::sort_by_name( $themes ); $parents = array(); $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); foreach ( $themes as $theme ) { $slug = $theme->get_stylesheet(); $encoded_slug = urlencode( $slug ); $parent = false; if ( $theme->parent() ) { $parent = $theme->parent(); $parents[ $slug ] = $parent->get_stylesheet(); $parent = $parent->display( 'Name' ); } $customize_action = null; $can_edit_theme_options = current_user_can( 'edit_theme_options' ); $can_customize = current_user_can( 'customize' ); $is_block_theme = $theme->is_block_theme(); if ( $is_block_theme && $can_edit_theme_options ) { $customize_action = esc_url( admin_url( 'site-editor.php' ) ); } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { $customize_action = esc_url( add_query_arg( array( 'return' => urlencode( esc_url_raw( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), ), wp_customize_url( $slug ) ) ); } $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; $auto_update = in_array( $slug, $auto_updates, true ); $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; if ( isset( $updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $updates[ $slug ]; } elseif ( isset( $no_updates[ $slug ] ) ) { $auto_update_supported = true; $auto_update_filter_payload = (object) $no_updates[ $slug ]; } else { $auto_update_supported = false; $auto_update_filter_payload = (object) array( 'theme' => $slug, 'new_version' => $theme->get( 'Version' ), 'url' => '', 'package' => '', 'requires' => $theme->get( 'RequiresWP' ), 'requires_php' => $theme->get( 'RequiresPHP' ), ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $auto_update_filter_payload ); $prepared_themes[ $slug ] = array( 'id' => $slug, 'name' => $theme->display( 'Name' ), 'screenshot' => array( $theme->get_screenshot() ), 'description' => $theme->display( 'Description' ), 'author' => $theme->display( 'Author', false, true ), 'authorAndUri' => $theme->display( 'Author' ), 'tags' => $theme->display( 'Tags' ), 'version' => $theme->get( 'Version' ), 'compatibleWP' => is_wp_version_compatible( $theme->get( 'RequiresWP' ) ), 'compatiblePHP' => is_php_version_compatible( $theme->get( 'RequiresPHP' ) ), 'updateResponse' => array( 'compatibleWP' => is_wp_version_compatible( $update_requires_wp ), 'compatiblePHP' => is_php_version_compatible( $update_requires_php ), ), 'parent' => $parent, 'active' => $slug === $current_theme, 'hasUpdate' => isset( $updates[ $slug ] ), 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 'update' => get_theme_update_available( $theme ), 'autoupdate' => array( 'enabled' => $auto_update || $auto_update_forced, 'supported' => $auto_update_supported, 'forced' => $auto_update_forced, ), 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 'customize' => $customize_action, 'delete' => ( ! is_multisite() && current_user_can( 'delete_themes' ) ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, 'autoupdate' => wp_is_auto_update_enabled_for_type( 'theme' ) && ! is_multisite() && current_user_can( 'update_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=' . $auto_update_action . '&stylesheet=' . $encoded_slug ), 'updates' ) : null, ), 'blockTheme' => $theme->is_block_theme(), ); } if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); } $prepared_themes = apply_filters( 'wp_prepare_themes_for_js', $prepared_themes ); $prepared_themes = array_values( $prepared_themes ); return array_filter( $prepared_themes ); } function customize_themes_print_templates() { ?> - - delete( $extension ); if ( ! $result ) { return new WP_Error( 'could_not_resume_theme', __( 'Could not resume the theme.' ) ); } return true; } function paused_themes_notice() { if ( 'themes.php' === $GLOBALS['pagenow'] ) { return; } if ( ! current_user_can( 'resume_themes' ) ) { return; } if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) { return; } printf( '

          %s
          %s

          %s

          ', __( 'One or more themes failed to load properly.' ), __( 'You can find more details and make changes on the Themes screen.' ), esc_url( admin_url( 'themes.php' ) ), __( 'Go to the Themes screen' ) ); } $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; ob_start(); $item_id = esc_attr( $menu_item->ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = false; if ( 'taxonomy' === $menu_item->type ) { $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); if ( $original_object && ! is_wp_error( $original_object ) ) { $original_title = $original_object->name; } } elseif ( 'post_type' === $menu_item->type ) { $original_object = get_post( $menu_item->object_id ); if ( $original_object ) { $original_title = get_the_title( $original_object->ID ); } } elseif ( 'post_type_archive' === $menu_item->type ) { $original_object = get_post_type_object( $menu_item->object ); if ( $original_object ) { $original_title = $original_object->labels->archives; } } $classes = array( 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $menu_item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), ); $title = $menu_item->title; if ( ! empty( $menu_item->_invalid ) ) { $classes[] = 'menu-item-invalid'; $title = sprintf( __( '%s (Invalid)' ), $menu_item->title ); } elseif ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { $classes[] = 'pending'; $title = sprintf( __( '%s (Pending)' ), $menu_item->title ); } $title = ( ! isset( $menu_item->label ) || '' === $menu_item->label ) ? $title : $menu_item->label; $submenu_text = ''; if ( 0 === $depth ) { $submenu_text = 'style="display: none;"'; } ?> -
        • " . ''; } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { $output .= "
        • \n"; } } post_type ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } $result = wp_send_user_request( $request_id ); if ( is_wp_error( $result ) ) { return $result; } elseif ( ! $result ) { return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation for personal data request.' ) ); } return true; } function _wp_privacy_completed_request( $request_id ) { $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); if ( ! $request ) { return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) ); } update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); $result = wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-completed', ) ); return $result; } function _wp_personal_data_handle_actions() { if ( isset( $_POST['privacy_action_email_retry'] ) ) { check_admin_referer( 'bulk-privacy_requests' ); $request_id = absint( current( array_keys( (array) wp_unslash( $_POST['privacy_action_email_retry'] ) ) ) ); $result = _wp_privacy_resend_request( $request_id ); if ( is_wp_error( $result ) ) { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', $result->get_error_message(), 'error' ); } else { add_settings_error( 'privacy_action_email_retry', 'privacy_action_email_retry', __( 'Confirmation request sent again successfully.' ), 'success' ); } } elseif ( isset( $_POST['action'] ) ) { $action = ! empty( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; switch ( $action ) { case 'add_export_personal_data_request': case 'add_remove_personal_data_request': check_admin_referer( 'personal-data-request' ); if ( ! isset( $_POST['type_of_action'], $_POST['username_or_email_for_privacy_request'] ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } $action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) ); $username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) ); $email_address = ''; $status = 'pending'; if ( ! isset( $_POST['send_confirmation_email'] ) ) { $status = 'confirmed'; } if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { add_settings_error( 'action_type', 'action_type', __( 'Invalid personal data action.' ), 'error' ); } if ( ! is_email( $username_or_email_address ) ) { $user = get_user_by( 'login', $username_or_email_address ); if ( ! $user instanceof WP_User ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', __( 'Unable to add this request. A valid email address or username must be supplied.' ), 'error' ); } else { $email_address = $user->user_email; } } else { $email_address = $username_or_email_address; } if ( empty( $email_address ) ) { break; } $request_id = wp_create_user_request( $email_address, $action_type, array(), $status ); $message = ''; if ( is_wp_error( $request_id ) ) { $message = $request_id->get_error_message(); } elseif ( ! $request_id ) { $message = __( 'Unable to initiate confirmation request.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'error' ); break; } if ( 'pending' === $status ) { wp_send_user_request( $request_id ); $message = __( 'Confirmation request initiated successfully.' ); } elseif ( 'confirmed' === $status ) { $message = __( 'Request added successfully.' ); } if ( $message ) { add_settings_error( 'username_or_email_for_privacy_request', 'username_or_email_for_privacy_request', $message, 'success' ); break; } } } } function _wp_personal_data_cleanup_requests() { $expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS ); $requests_query = new WP_Query( array( 'post_type' => 'user_request', 'posts_per_page' => -1, 'post_status' => 'request-pending', 'fields' => 'ids', 'date_query' => array( array( 'column' => 'post_modified_gmt', 'before' => $expires . ' seconds ago', ), ), ) ); $request_ids = $requests_query->posts; foreach ( $request_ids as $request_id ) { wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-failed', 'post_password' => '', ) ); } } function wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id = '', $groups_count = 1 ) { $group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id ); $group_html = '

          '; $group_html .= esc_html( $group_data['group_label'] ); $items_count = count( (array) $group_data['items'] ); if ( $items_count > 1 ) { $group_html .= sprintf( ' (%d)', $items_count ); } $group_html .= '

          '; if ( ! empty( $group_data['group_description'] ) ) { $group_html .= '

          ' . esc_html( $group_data['group_description'] ) . '

          '; } $group_html .= '
          '; foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) { $group_html .= ''; $group_html .= ''; foreach ( (array) $group_item_data as $group_item_datum ) { $value = $group_item_datum['value']; if ( false === strpos( $value, ' ' ) && ( 0 === strpos( $value, 'http://' ) || 0 === strpos( $value, 'https://' ) ) ) { $value = '' . esc_html( $value ) . ''; } $group_html .= ''; $group_html .= ''; $group_html .= ''; $group_html .= ''; } $group_html .= ''; $group_html .= '
          ' . esc_html( $group_item_datum['name'] ) . '' . wp_kses( $value, 'personal_data_export' ) . '
          '; } if ( $groups_count > 1 ) { $group_html .= '
          '; $group_html .= ' ' . esc_html__( 'Go to top' ) . ''; $group_html .= '
          '; } $group_html .= '
          '; return $group_html; } function wp_privacy_generate_personal_data_export_file( $request_id ) { if ( ! class_exists( 'ZipArchive' ) ) { wp_send_json_error( __( 'Unable to generate personal data export file. ZipArchive not available.' ) ); } $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when generating personal data export file.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'Invalid email address when generating personal data export file.' ) ); } $exports_dir = wp_privacy_exports_dir(); $exports_url = wp_privacy_exports_url(); if ( ! wp_mkdir_p( $exports_dir ) ) { wp_send_json_error( __( 'Unable to create personal data export folder.' ) ); } $index_pathname = $exports_dir . 'index.php'; if ( ! file_exists( $index_pathname ) ) { $file = fopen( $index_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to protect personal data export folder from browsing.' ) ); } fwrite( $file, " _x( 'About', 'personal data group label' ), 'group_description' => _x( 'Overview of export report.', 'personal data group description' ), 'items' => array( 'about-1' => array( array( 'name' => _x( 'Report generated for', 'email address' ), 'value' => $email_address, ), array( 'name' => _x( 'For site', 'website name' ), 'value' => get_bloginfo( 'name' ), ), array( 'name' => _x( 'At URL', 'website URL' ), 'value' => get_bloginfo( 'url' ), ), array( 'name' => _x( 'On', 'date/time' ), 'value' => current_time( 'mysql' ), ), ), ), ); $groups = get_post_meta( $request_id, '_export_data_grouped', true ); if ( is_array( $groups ) ) { $groups = array_merge( array( 'about' => $about_group ), $groups ); $groups_count = count( $groups ); } else { if ( false !== $groups ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s post meta must be an array.' ), '_export_data_grouped' ), '5.8.0' ); } $groups = null; $groups_count = 0; } $groups_json = wp_json_encode( $groups ); if ( false === $groups_json ) { $error_message = sprintf( __( 'Unable to encode the personal data for export. Error: %s' ), json_last_error_msg() ); wp_send_json_error( $error_message ); } $file = fopen( $json_report_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to open personal data export file (JSON report) for writing.' ) ); } fwrite( $file, '{' ); fwrite( $file, '"' . $title . '":' ); fwrite( $file, $groups_json ); fwrite( $file, '}' ); fclose( $file ); $file = fopen( $html_report_pathname, 'w' ); if ( false === $file ) { wp_send_json_error( __( 'Unable to open personal data export (HTML report) for writing.' ) ); } fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, "' ); fwrite( $file, '' ); fwrite( $file, esc_html( $title ) ); fwrite( $file, '' ); fwrite( $file, "\n" ); fwrite( $file, "\n" ); fwrite( $file, '

          ' . esc_html__( 'Personal Data Export' ) . '

          ' ); if ( $groups_count > 1 ) { fwrite( $file, '
          ' ); fwrite( $file, '

          ' . esc_html__( 'Table of Contents' ) . '

          ' ); fwrite( $file, '
            ' ); foreach ( (array) $groups as $group_id => $group_data ) { $group_label = esc_html( $group_data['group_label'] ); $group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id ); $group_items_count = count( (array) $group_data['items'] ); if ( $group_items_count > 1 ) { $group_label .= sprintf( ' (%d)', $group_items_count ); } fwrite( $file, '
          • ' ); fwrite( $file, '' . $group_label . '' ); fwrite( $file, '
          • ' ); } fwrite( $file, '
          ' ); fwrite( $file, '
          ' ); } foreach ( (array) $groups as $group_id => $group_data ) { fwrite( $file, wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id, $groups_count ) ); } fwrite( $file, "\n" ); fwrite( $file, "\n" ); fclose( $file ); $error = false; $archive_filename = get_post_meta( $request_id, '_export_file_name', true ); $archive_pathname = get_post_meta( $request_id, '_export_file_path', true ); if ( ! empty( $archive_filename ) ) { $archive_pathname = $exports_dir . $archive_filename; } elseif ( ! empty( $archive_pathname ) ) { $archive_filename = basename( $archive_pathname ); update_post_meta( $request_id, '_export_file_name', $archive_filename ); delete_post_meta( $request_id, '_export_file_url' ); delete_post_meta( $request_id, '_export_file_path' ); } else { $archive_filename = $file_basename . '.zip'; $archive_pathname = $exports_dir . $archive_filename; update_post_meta( $request_id, '_export_file_name', $archive_filename ); } $archive_url = $exports_url . $archive_filename; if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) { wp_delete_file( $archive_pathname ); } $zip = new ZipArchive; if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) { $error = __( 'Unable to archive the personal data export file (JSON format).' ); } if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) { $error = __( 'Unable to archive the personal data export file (HTML format).' ); } $zip->close(); if ( ! $error ) { do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id, $json_report_pathname ); } } else { $error = __( 'Unable to open personal data export file (archive) for writing.' ); } unlink( $json_report_pathname ); unlink( $html_report_pathname ); if ( $error ) { wp_send_json_error( $error ); } } function wp_privacy_send_personal_data_export_email( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) ); } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); $exports_url = wp_privacy_exports_url(); $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); $export_file_url = $exports_url . $export_file_name; $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $site_url = home_url(); $request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request ); $email_data = array( 'request' => $request, 'expiration' => $expiration, 'expiration_date' => $expiration_date, 'message_recipient' => $request_email, 'export_file_url' => $export_file_url, 'sitename' => $site_name, 'siteurl' => $site_url, ); $subject = sprintf( __( '[%s] Personal Data Export' ), $site_name ); $subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data ); $email_text = __( 'Howdy, - -Your request for an export of personal data has been completed. You may -download your personal data by clicking on the link below. For privacy -and security, we will automatically delete the file on ###EXPIRATION###, -so please download it before then. - -###LINK### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data ); $content = str_replace( '###EXPIRATION###', $expiration_date, $content ); $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content ); $content = str_replace( '###EMAIL###', $request_email, $content ); $content = str_replace( '###SITENAME###', $site_name, $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $site_url ), $content ); $headers = ''; $headers = apply_filters( 'wp_privacy_personal_data_email_headers', $headers, $subject, $content, $request_id, $email_data ); $mail_success = wp_mail( $request_email, $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( ! $mail_success ) { return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) ); } return true; } function wp_privacy_process_personal_data_export_page( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'data', $response ) ) { return $response; } if ( ! is_array( $response['data'] ) ) { return $response; } $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when merging personal data to export.' ) ); } $export_data = array(); if ( 1 === $exporter_index && 1 === $page ) { update_post_meta( $request_id, '_export_data_raw', $export_data ); } else { $accumulated_data = get_post_meta( $request_id, '_export_data_raw', true ); if ( $accumulated_data ) { $export_data = $accumulated_data; } } $export_data = array_merge( $export_data, $response['data'] ); update_post_meta( $request_id, '_export_data_raw', $export_data ); $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); $is_last_exporter = count( $exporters ) === $exporter_index; $exporter_done = $response['done']; if ( ! $is_last_exporter || ! $exporter_done ) { return $response; } $groups = array(); foreach ( (array) $export_data as $export_datum ) { $group_id = $export_datum['group_id']; $group_label = $export_datum['group_label']; $group_description = ''; if ( ! empty( $export_datum['group_description'] ) ) { $group_description = $export_datum['group_description']; } if ( ! array_key_exists( $group_id, $groups ) ) { $groups[ $group_id ] = array( 'group_label' => $group_label, 'group_description' => $group_description, 'items' => array(), ); } $item_id = $export_datum['item_id']; if ( ! array_key_exists( $item_id, $groups[ $group_id ]['items'] ) ) { $groups[ $group_id ]['items'][ $item_id ] = array(); } $old_item_data = $groups[ $group_id ]['items'][ $item_id ]; $merged_item_data = array_merge( $export_datum['data'], $old_item_data ); $groups[ $group_id ]['items'][ $item_id ] = $merged_item_data; } delete_post_meta( $request_id, '_export_data_raw' ); update_post_meta( $request_id, '_export_data_grouped', $groups ); do_action( 'wp_privacy_personal_data_export_file', $request_id ); delete_post_meta( $request_id, '_export_data_grouped' ); if ( $send_as_email ) { $mail_success = wp_privacy_send_personal_data_export_email( $request_id ); if ( is_wp_error( $mail_success ) ) { wp_send_json_error( $mail_success->get_error_message() ); } _wp_privacy_completed_request( $request_id ); } else { $exports_url = wp_privacy_exports_url(); $export_file_name = get_post_meta( $request_id, '_export_file_name', true ); $export_file_url = $exports_url . $export_file_name; if ( ! empty( $export_file_url ) ) { $response['url'] = $export_file_url; } } return $response; } function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) { if ( ! is_array( $response ) ) { return $response; } if ( ! array_key_exists( 'done', $response ) ) { return $response; } if ( ! array_key_exists( 'items_removed', $response ) ) { return $response; } if ( ! array_key_exists( 'items_retained', $response ) ) { return $response; } if ( ! array_key_exists( 'messages', $response ) ) { return $response; } $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request ID when processing personal data to erase.' ) ); } $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $is_last_eraser = count( $erasers ) === $eraser_index; $eraser_done = $response['done']; if ( ! $is_last_eraser || ! $eraser_done ) { return $response; } _wp_privacy_completed_request( $request_id ); do_action( 'wp_privacy_personal_data_erased', $request_id ); return $response; } skin = new WP_Upgrader_Skin(); } else { $this->skin = $skin; } } public function init() { $this->skin->set_upgrader( $this ); $this->generic_strings(); } public function generic_strings() { $this->strings['bad_request'] = __( 'Invalid data provided.' ); $this->strings['fs_unavailable'] = __( 'Could not access filesystem.' ); $this->strings['fs_error'] = __( 'Filesystem error.' ); $this->strings['fs_no_root_dir'] = __( 'Unable to locate WordPress root directory.' ); $this->strings['fs_no_content_dir'] = __( 'Unable to locate WordPress content directory (wp-content).' ); $this->strings['fs_no_plugins_dir'] = __( 'Unable to locate WordPress plugin directory.' ); $this->strings['fs_no_themes_dir'] = __( 'Unable to locate WordPress theme directory.' ); $this->strings['fs_no_folder'] = __( 'Unable to locate needed folder (%s).' ); $this->strings['download_failed'] = __( 'Download failed.' ); $this->strings['installing_package'] = __( 'Installing the latest version…' ); $this->strings['no_files'] = __( 'The package contains no files.' ); $this->strings['folder_exists'] = __( 'Destination folder already exists.' ); $this->strings['mkdir_failed'] = __( 'Could not create directory.' ); $this->strings['incompatible_archive'] = __( 'The package could not be installed.' ); $this->strings['files_not_writable'] = __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ); $this->strings['maintenance_start'] = __( 'Enabling Maintenance mode…' ); $this->strings['maintenance_end'] = __( 'Disabling Maintenance mode…' ); } public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) { global $wp_filesystem; $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ); if ( false === $credentials ) { return false; } if ( ! WP_Filesystem( $credentials, $directories[0], $allow_relaxed_file_ownership ) ) { $error = true; if ( is_object( $wp_filesystem ) && $wp_filesystem->errors->has_errors() ) { $error = $wp_filesystem->errors; } $this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership ); return false; } if ( ! is_object( $wp_filesystem ) ) { return new WP_Error( 'fs_unavailable', $this->strings['fs_unavailable'] ); } if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { return new WP_Error( 'fs_error', $this->strings['fs_error'], $wp_filesystem->errors ); } foreach ( (array) $directories as $dir ) { switch ( $dir ) { case ABSPATH: if ( ! $wp_filesystem->abspath() ) { return new WP_Error( 'fs_no_root_dir', $this->strings['fs_no_root_dir'] ); } break; case WP_CONTENT_DIR: if ( ! $wp_filesystem->wp_content_dir() ) { return new WP_Error( 'fs_no_content_dir', $this->strings['fs_no_content_dir'] ); } break; case WP_PLUGIN_DIR: if ( ! $wp_filesystem->wp_plugins_dir() ) { return new WP_Error( 'fs_no_plugins_dir', $this->strings['fs_no_plugins_dir'] ); } break; case get_theme_root(): if ( ! $wp_filesystem->wp_themes_dir() ) { return new WP_Error( 'fs_no_themes_dir', $this->strings['fs_no_themes_dir'] ); } break; default: if ( ! $wp_filesystem->find_folder( $dir ) ) { return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], esc_html( basename( $dir ) ) ) ); } break; } } return true; } public function download_package( $package, $check_signatures = false, $hook_extra = array() ) { $reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra ); if ( false !== $reply ) { return $reply; } if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { return $package; } if ( empty( $package ) ) { return new WP_Error( 'no_package', $this->strings['no_package'] ); } $this->skin->feedback( 'downloading_package', $package ); $download_file = download_url( $package, 300, $check_signatures ); if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) { return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() ); } return $download_file; } public function unpack_package( $package, $delete_package = true ) { global $wp_filesystem; $this->skin->feedback( 'unpack_package' ); $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; $upgrade_files = $wp_filesystem->dirlist( $upgrade_folder ); if ( ! empty( $upgrade_files ) ) { foreach ( $upgrade_files as $file ) { $wp_filesystem->delete( $upgrade_folder . $file['name'], true ); } } $working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' ); if ( $wp_filesystem->is_dir( $working_dir ) ) { $wp_filesystem->delete( $working_dir, true ); } $result = unzip_file( $package, $working_dir ); if ( $delete_package ) { unlink( $package ); } if ( is_wp_error( $result ) ) { $wp_filesystem->delete( $working_dir, true ); if ( 'incompatible_archive' === $result->get_error_code() ) { return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() ); } return $result; } return $working_dir; } protected function flatten_dirlist( $nested_files, $path = '' ) { $files = array(); foreach ( $nested_files as $name => $details ) { $files[ $path . $name ] = $details; if ( ! empty( $details['files'] ) ) { $children = $this->flatten_dirlist( $details['files'], $path . $name . '/' ); $files = $files + $children; } } return $files; } public function clear_destination( $remote_destination ) { global $wp_filesystem; $files = $wp_filesystem->dirlist( $remote_destination, true, true ); if ( false === $files ) { return true; } $files = $this->flatten_dirlist( $files ); $unwritable_files = array(); foreach ( $files as $filename => $file_details ) { if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) { $wp_filesystem->chmod( $remote_destination . $filename, ( 'd' === $file_details['type'] ? FS_CHMOD_DIR : FS_CHMOD_FILE ) ); if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) { $unwritable_files[] = $filename; } } } if ( ! empty( $unwritable_files ) ) { return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) ); } if ( ! $wp_filesystem->delete( $remote_destination, true ) ) { return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); } return true; } public function install_package( $args = array() ) { global $wp_filesystem, $wp_theme_directories; $defaults = array( 'source' => '', 'destination' => '', 'clear_destination' => false, 'clear_working' => false, 'abort_if_destination_exists' => true, 'hook_extra' => array(), ); $args = wp_parse_args( $args, $defaults ); $source = $args['source']; $destination = $args['destination']; $clear_destination = $args['clear_destination']; set_time_limit( 300 ); if ( empty( $source ) || empty( $destination ) ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } $this->skin->feedback( 'installing_package' ); $res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] ); if ( is_wp_error( $res ) ) { return $res; } $remote_source = $args['source']; $local_destination = $destination; $source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) ); $remote_destination = $wp_filesystem->find_folder( $local_destination ); if ( 1 === count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); } elseif ( 0 === count( $source_files ) ) { return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); } else { $source = trailingslashit( $args['source'] ); } $source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] ); if ( is_wp_error( $source ) ) { return $source; } if ( $source !== $remote_source ) { $source_files = array_keys( $wp_filesystem->dirlist( $source ) ); } $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' ); if ( is_array( $wp_theme_directories ) ) { $protected_directories = array_merge( $protected_directories, $wp_theme_directories ); } if ( in_array( $destination, $protected_directories, true ) ) { $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) ); $destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) ); } if ( $clear_destination ) { $this->skin->feedback( 'remove_old' ); $removed = $this->clear_destination( $remote_destination ); $removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] ); if ( is_wp_error( $removed ) ) { return $removed; } } elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) { $_files = $wp_filesystem->dirlist( $remote_destination ); if ( ! empty( $_files ) ) { $wp_filesystem->delete( $remote_source, true ); return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination ); } } if ( ! $wp_filesystem->exists( $remote_destination ) ) { if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination ); } } $result = copy_dir( $source, $remote_destination ); if ( is_wp_error( $result ) ) { if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } return $result; } if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } $destination_name = basename( str_replace( $local_destination, '', $destination ) ); if ( '.' === $destination_name ) { $destination_name = ''; } $this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' ); $res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result ); if ( is_wp_error( $res ) ) { $this->result = $res; return $res; } return $this->result; } public function run( $options ) { $defaults = array( 'package' => '', 'destination' => '', 'clear_destination' => false, 'clear_working' => true, 'abort_if_destination_exists' => true, 'is_multi' => false, 'hook_extra' => array(), ); $options = wp_parse_args( $options, $defaults ); $options = apply_filters( 'upgrader_package_options', $options ); if ( ! $options['is_multi'] ) { $this->skin->header(); } $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) ); if ( ! $res ) { if ( ! $options['is_multi'] ) { $this->skin->footer(); } return false; } $this->skin->before(); if ( is_wp_error( $res ) ) { $this->skin->error( $res ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $res; } $download = $this->download_package( $options['package'], true, $options['hook_extra'] ); if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { if ( 'signature_verification_no_signature' !== $download->get_error_code() || WP_DEBUG ) { $this->skin->feedback( $download->get_error_message() ); wp_version_check( array( 'signature_failure_code' => $download->get_error_code(), 'signature_failure_data' => $download->get_error_data(), ) ); } $download = $download->get_error_data( 'softfail-filename' ); } if ( is_wp_error( $download ) ) { $this->skin->error( $download ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $download; } $delete_package = ( $download !== $options['package'] ); $working_dir = $this->unpack_package( $download, $delete_package ); if ( is_wp_error( $working_dir ) ) { $this->skin->error( $working_dir ); $this->skin->after(); if ( ! $options['is_multi'] ) { $this->skin->footer(); } return $working_dir; } $result = $this->install_package( array( 'source' => $working_dir, 'destination' => $options['destination'], 'clear_destination' => $options['clear_destination'], 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 'clear_working' => $options['clear_working'], 'hook_extra' => $options['hook_extra'], ) ); $result = apply_filters( 'upgrader_install_package_result', $result, $options['hook_extra'] ); $this->skin->set_result( $result ); if ( is_wp_error( $result ) ) { $this->skin->error( $result ); if ( ! method_exists( $this->skin, 'hide_process_failed' ) || ! $this->skin->hide_process_failed( $result ) ) { $this->skin->feedback( 'process_failed' ); } } else { $this->skin->feedback( 'process_success' ); } $this->skin->after(); if ( ! $options['is_multi'] ) { do_action( 'upgrader_process_complete', $this, $options['hook_extra'] ); $this->skin->footer(); } return $result; } public function maintenance_mode( $enable = false ) { global $wp_filesystem; $file = $wp_filesystem->abspath() . '.maintenance'; if ( $enable ) { $this->skin->feedback( 'maintenance_start' ); $maintenance_string = ''; $wp_filesystem->delete( $file ); $wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE ); } elseif ( ! $enable && $wp_filesystem->exists( $file ) ) { $this->skin->feedback( 'maintenance_end' ); $wp_filesystem->delete( $file ); } } public static function create_lock( $lock_name, $release_timeout = null ) { global $wpdb; if ( ! $release_timeout ) { $release_timeout = HOUR_IN_SECONDS; } $lock_option = $lock_name . '.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_option ); if ( ! $lock_result ) { return false; } if ( $lock_result > ( time() - $release_timeout ) ) { return false; } WP_Upgrader::release_lock( $lock_name ); return WP_Upgrader::create_lock( $lock_name, $release_timeout ); } update_option( $lock_option, time() ); return true; } public static function release_lock( $lock_name ) { return delete_option( $lock_name . '.lock' ); } } require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-theme-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-language-pack-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-core-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-file-upload-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; ID; $post_type = $post->post_type; $post_type_object = get_post_type_object( $post_type ); $can_publish = current_user_can( $post_type_object->cap->publish_posts ); ?> -
          - -
          - - -
          - -
          - -
          -
          - post_status, array( 'publish', 'future', 'pending' ), true ) ) { $private_style = ''; if ( 'private' === $post->post_status ) { $private_style = 'style="display:none"'; } ?> - type="submit" name="save" id="save-post" value="" class="button" /> - - post_status && $can_publish ) { ?> - - - -
          - - -
          - post_status ) { $preview_button_text = __( 'Preview Changes' ); } else { $preview_button_text = __( 'Preview' ); } $preview_button = sprintf( '%1$s %2$s', $preview_button_text, __( '(opens in a new tab)' ) ); ?> - - -
          - -
          -
          - -
          -
          - - - post_status ) { case 'private': _e( 'Privately Published' ); break; case 'publish': _e( 'Published' ); break; case 'future': _e( 'Scheduled' ); break; case 'pending': _e( 'Pending Review' ); break; case 'draft': case 'auto-draft': _e( 'Draft' ); break; } ?> - - - post_status || 'private' === $post->post_status || $can_publish ) { $private_style = ''; if ( 'private' === $post->post_status ) { $private_style = 'style="display:none"'; } ?> - class="edit-post-status hide-if-no-js" role="button"> - -
          - - - - - -
          - -
          - -
          - - - post_status ) { $post->post_password = ''; $visibility = 'private'; $visibility_trans = __( 'Private' ); } elseif ( ! empty( $post->post_password ) ) { $visibility = 'password'; $visibility_trans = __( 'Password protected' ); } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) { $visibility = 'public'; $visibility_trans = __( 'Public, Sticky' ); } else { $visibility = 'public'; $visibility_trans = __( 'Public' ); } echo esc_html( $visibility_trans ); ?> - - - - - -
          - - - /> - - - - />
          - - - />
          - - - />
          -
          - - />
          - -

          - - -

          -
          - -
          - - post_status ) { $stamp = __( 'Scheduled for: %s' ); } elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { $stamp = __( 'Published on: %s' ); } elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { $stamp = __( 'Publish immediately' ); } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { $stamp = __( 'Schedule for: %s' ); } else { $stamp = __( 'Publish on: %s' ); } $date = sprintf( $date_string, date_i18n( $date_format, strtotime( $post->post_date ) ), date_i18n( $time_format, strtotime( $post->post_date ) ) ); } else { $stamp = __( 'Publish immediately' ); $date = sprintf( $date_string, date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ), date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) ) ); } if ( ! empty( $args['args']['revisions_count'] ) ) : ?> -
          - ' . number_format_i18n( $args['args']['revisions_count'] ) . '' ); ?> - -
          - -
          - - ' . $date . '' ); ?> - - - - - -
          - - -
          -
          - post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) : ?> -
          -

          - unpublished customization changes. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ), esc_url( add_query_arg( 'changeset_uuid', rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ), admin_url( 'customize.php' ) ) ) ); ?> -

          -
          - -
          -
          -
          - -
          - -
          - - - -
          - -
          - - post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) { if ( $can_publish ) : if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> - - - - - - - - - - - 'publish' ) ); ?> - -
          -
          -
          - -
          - -
          - -
          - - -
          - -
          - - -
          -
          - - post_date ) ), date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) ); printf( __( 'Uploaded on: %s' ), '' . $uploaded_on . '' ); ?> - -
          - - -
          -
          -
          - -
          -
          - ID ) ) { if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { echo "" . __( 'Move to Trash' ) . ''; } else { $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; echo "" . __( 'Delete permanently' ) . ''; } } ?> -
          - -
          - - - -
          -
          -
          - -
          - - post_type, 'post-formats' ) ) : $post_formats = get_theme_support( 'post-formats' ); if ( is_array( $post_formats[0] ) ) : $post_format = get_post_format( $post->ID ); if ( ! $post_format ) { $post_format = '0'; } if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) { $post_formats[0][] = $post_format; } ?> -
          -
          - - /> - -
          /> - -
          -
          - 'post_tag' ); if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); } else { $args = $box['args']; } $parsed_args = wp_parse_args( $args, $defaults ); $tax_name = esc_attr( $parsed_args['taxonomy'] ); $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); $comma = _x( ',', 'tag delimiter' ); $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); if ( ! is_string( $terms_to_edit ) ) { $terms_to_edit = ''; } ?> -
          -
          -
          - -

          -
          - -
          - - - -
          -

          labels->separate_items_with_commas; ?>

          - -

          labels->no_terms; ?>

          - -
          -
            -
            - -

            - - 'category' ); if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); } else { $args = $box['args']; } $parsed_args = wp_parse_args( $args, $defaults ); $tax_name = esc_attr( $parsed_args['taxonomy'] ); $taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); ?> -
            - - - - -
            - "; ?> -
              - ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids, ) ); ?> -
            -
            - cap->edit_terms ) ) : ?> -
            - - labels->add_new_item ); ?> - -

            - - - - $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', ); $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); wp_dropdown_categories( $parent_dropdown_args ); ?> - - - -

            -
            - -
            - - -

            - Learn more about manual excerpts.' ), __( 'https://wordpress.org/support/article/excerpt/' ) ); ?> -

            - to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; if ( '' !== $post->pinged ) { $pings = '

            ' . __( 'Already pinged:' ) . '

              '; $already_pinged = explode( "\n", trim( $post->pinged ) ); foreach ( $already_pinged as $pinged_url ) { $pings .= "\n\t
            • " . esc_html( $pinged_url ) . '
            • '; } $pings .= '
            '; } ?> -

            - - -

            -

            -

            - pingbacks, no other action necessary.' ), __( 'https://wordpress.org/support/article/introduction-to-blogging/#comments' ) ); ?> -

            - -
            -
            - ID ); foreach ( $metadata as $key => $value ) { if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) { unset( $metadata[ $key ] ); } } list_meta( $metadata ); meta_form( $post ); ?> -
            -

            - use in your theme.' ), __( 'https://wordpress.org/support/article/custom-fields/' ) ); ?> -

            - - -

            -
            - - -

            - -

            - $post->ID, 'number' => 1, 'count' => true, ) ); $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); $wp_list_table->display( true ); if ( 1 > $total ) { echo '

            ' . __( 'No comments yet.' ) . '

            '; } else { $hidden = get_hidden_meta_boxes( get_current_screen() ); if ( ! in_array( 'commentsdiv', $hidden, true ) ) { ?> - - -

            - post_name, $post ); ?> - - post_type ); ?> - - array( $post_type_object->cap->edit_posts ), 'name' => 'post_author_override', 'selected' => empty( $post->ID ) ? $user_ID : $post->post_author, 'include_selected' => true, 'show' => 'display_name_with_login', ) ); } function post_revisions_meta_box( $post ) { wp_list_post_revisions( $post ); } function page_attributes_meta_box( $post ) { if ( is_post_type_hierarchical( $post->post_type ) ) : $dropdown_args = array( 'post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __( '(no parent)' ), 'sort_column' => 'menu_order, post_title', 'echo' => 0, ); $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); $pages = wp_dropdown_pages( $dropdown_args ); if ( ! empty( $pages ) ) : ?> -

            - - 0 && get_option( 'page_for_posts' ) != $post->ID ) : $template = ! empty( $post->page_template ) ? $post->page_template : false; ?> -

            - -

            - - - post_type, 'page-attributes' ) ) : ?> -

            - - - post_type && get_current_screen()->get_help_tabs() ) : ?> -

            - - - -
            -
              -
            • -
            • -
            - -
            -
              - link_id ) ) { wp_link_category_checklist( $link->link_id ); } else { wp_link_category_checklist(); } ?> -
            -
            - - - -
            - - -
            -
            - -
            -

            -

            -

            -
            -

            - link_rel ) ? $link->link_rel : ''; $link_rels = preg_split( '/\s+/', $link_rel ); if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) { echo ' checked="checked"'; } if ( '' === $xfn_value ) { if ( 'family' === $xfn_relationship && ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) ) ) { echo ' checked="checked"'; } if ( 'friendship' === $xfn_relationship && ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) ) ) { echo ' checked="checked"'; } if ( 'geographical' === $xfn_relationship && ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) ) ) { echo ' checked="checked"'; } if ( 'identity' === $xfn_relationship && in_array( 'me', $link_rels, true ) ) { echo ' checked="checked"'; } } } function link_xfn_meta_box( $link ) { ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

            XFN.' ); ?>

            - - - - - - - - - - - - - - - - - - - - ID, '_thumbnail_id', true ); echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); } function attachment_id3_data_meta_box( $post ) { $meta = array(); if ( ! empty( $post->ID ) ) { $meta = wp_get_attachment_metadata( $post->ID ); } foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : $value = ''; if ( ! empty( $meta[ $key ] ) ) { $value = $meta[ $key ]; } ?> -

            -
            - -

            - post_type; $post_type_object = get_post_type_object( $post_type ); $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { if ( wp_attachment_is( 'audio', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } $publish_callback_args = array( '__back_compat_meta_box' => true ); if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) { $revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) ); if ( count( $revisions ) > 1 ) { $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => reset( $revisions ), '__back_compat_meta_box' => true, ); add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } if ( 'attachment' === $post_type ) { wp_enqueue_script( 'image-edit' ); wp_enqueue_style( 'imgareaselect' ); add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); add_action( 'edit_form_after_title', 'edit_form_image_editor' ); if ( wp_attachment_is( 'audio', $post ) ) { add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } else { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); } if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); } foreach ( get_object_taxonomies( $post ) as $tax_name ) { $taxonomy = get_taxonomy( $tax_name ); if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { continue; } $label = $taxonomy->labels->name; if ( ! is_taxonomy_hierarchical( $tax_name ) ) { $tax_meta_box_id = 'tagsdiv-' . $tax_name; } else { $tax_meta_box_id = $tax_name . 'div'; } add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name, '__back_compat_meta_box' => true, ) ); } if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); } if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'excerpt' ) ) { add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'trackbacks' ) ) { add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'custom-fields' ) ) { add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), '__block_editor_compatible_meta_box' => true, ) ); } do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' ); if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } $stati = get_post_stati( array( 'public' => true ) ); if ( empty( $stati ) ) { $stati = array( 'publish' ); } $stati[] = 'private'; if ( in_array( get_post_status( $post ), $stati, true ) ) { if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } } if ( ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); } do_action( 'add_meta_boxes', $post_type, $post ); do_action( "add_meta_boxes_{$post_type}", $post ); do_action( 'do_meta_boxes', $post_type, 'normal', $post ); do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); do_action( 'do_meta_boxes', $post_type, 'side', $post ); } Note that password carefully! It is a random password that was generated just for you.' ); $user_id = wp_create_user( $user_name, $user_password, $user_email ); update_user_meta( $user_id, 'default_password_nag', true ); $email_password = true; $user_created = true; } elseif ( ! $user_id ) { $message = '' . __( 'Your chosen password.' ) . ''; $user_id = wp_create_user( $user_name, $user_password, $user_email ); $user_created = true; } else { $message = __( 'User already exists. Password inherited.' ); } $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); if ( $user_created ) { $user->user_url = $guessurl; wp_update_user( $user ); } wp_install_defaults( $user_id ); wp_install_maybe_enable_pretty_permalinks(); flush_rewrite_rules(); wp_new_blog_notification( $blog_title, $guessurl, $user_id, ( $email_password ? $user_password : __( 'The password you chose during installation.' ) ) ); wp_cache_flush(); do_action( 'wp_install', $user ); return array( 'url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message, ); } endif; if ( ! function_exists( 'wp_install_defaults' ) ) : function wp_install_defaults( $user_id ) { global $wpdb, $wp_rewrite, $table_prefix; $cat_name = __( 'Uncategorized' ); $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); if ( global_terms_enabled() ) { $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); if ( null == $cat_id ) { $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ), ) ); $cat_id = $wpdb->insert_id; } update_option( 'default_category', $cat_id ); } else { $cat_id = 1; } $wpdb->insert( $wpdb->terms, array( 'term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0, ) ); $wpdb->insert( $wpdb->term_taxonomy, array( 'term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1, ) ); $cat_tt_id = $wpdb->insert_id; $now = current_time( 'mysql' ); $now_gmt = current_time( 'mysql', 1 ); $first_post_guid = get_option( 'home' ) . '/?p=1'; if ( is_multisite() ) { $first_post = get_site_option( 'first_post' ); if ( ! $first_post ) { $first_post = "\n

            " . __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) . "

            \n"; } $first_post = sprintf( $first_post, sprintf( '%s', esc_url( network_home_url() ), get_network()->site_name ) ); $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post ); $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post ); } else { $first_post = "\n

            " . __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) . "

            \n"; } $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_post, 'post_excerpt' => '', 'post_title' => __( 'Hello world!' ), 'post_name' => sanitize_title( _x( 'hello-world', 'Default post slug' ) ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'comment_count' => 1, 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); if ( is_multisite() ) { update_posts_count(); } $wpdb->insert( $wpdb->term_relationships, array( 'term_taxonomy_id' => $cat_tt_id, 'object_id' => 1, ) ); if ( is_multisite() ) { $first_comment_author = get_site_option( 'first_comment_author' ); $first_comment_email = get_site_option( 'first_comment_email' ); $first_comment_url = get_site_option( 'first_comment_url', network_home_url() ); $first_comment = get_site_option( 'first_comment' ); } $first_comment_author = ! empty( $first_comment_author ) ? $first_comment_author : __( 'A WordPress Commenter' ); $first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : 'wapuu@wordpress.example'; $first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : esc_url( __( 'https://wordpress.org/' ) ); $first_comment = ! empty( $first_comment ) ? $first_comment : sprintf( __( 'Hi, this is a comment. -To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard. -Commenter avatars come from Gravatar.' ), esc_url( __( 'https://en.gravatar.com/' ) ) ); $wpdb->insert( $wpdb->comments, array( 'comment_post_ID' => 1, 'comment_author' => $first_comment_author, 'comment_author_email' => $first_comment_email, 'comment_author_url' => $first_comment_url, 'comment_date' => $now, 'comment_date_gmt' => $now_gmt, 'comment_content' => $first_comment, 'comment_type' => 'comment', ) ); if ( is_multisite() ) { $first_page = get_site_option( 'first_page' ); } if ( empty( $first_page ) ) { $first_page = "\n

            "; $first_page .= __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:" ); $first_page .= "

            \n\n\n"; $first_page .= "\n

            "; $first_page .= __( "Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)" ); $first_page .= "

            \n\n\n"; $first_page .= "\n

            "; $first_page .= __( '...or something like this:' ); $first_page .= "

            \n\n\n"; $first_page .= "\n

            "; $first_page .= __( 'The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.' ); $first_page .= "

            \n\n\n"; $first_page .= "\n

            "; $first_page .= sprintf( __( 'As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!' ), admin_url() ); $first_page .= "

            \n"; } $first_post_guid = get_option( 'home' ) . '/?page_id=2'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $first_page, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Sample Page' ), 'post_name' => __( 'sample-page' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $first_post_guid, 'post_type' => 'page', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); if ( is_multisite() ) { $privacy_policy_content = get_site_option( 'default_privacy_policy_content' ); } else { if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { include_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } $privacy_policy_content = WP_Privacy_Policy_Content::get_default_content(); } if ( ! empty( $privacy_policy_content ) ) { $privacy_policy_guid = get_option( 'home' ) . '/?page_id=3'; $wpdb->insert( $wpdb->posts, array( 'post_author' => $user_id, 'post_date' => $now, 'post_date_gmt' => $now_gmt, 'post_content' => $privacy_policy_content, 'post_excerpt' => '', 'comment_status' => 'closed', 'post_title' => __( 'Privacy Policy' ), 'post_name' => __( 'privacy-policy' ), 'post_modified' => $now, 'post_modified_gmt' => $now_gmt, 'guid' => $privacy_policy_guid, 'post_type' => 'page', 'post_status' => 'draft', 'to_ping' => '', 'pinged' => '', 'post_content_filtered' => '', ) ); $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 3, 'meta_key' => '_wp_page_template', 'meta_value' => 'default', ) ); update_option( 'wp_page_for_privacy_policy', 3 ); } update_option( 'widget_block', array( 2 => array( 'content' => '' ), 3 => array( 'content' => '

            ' . __( 'Recent Posts' ) . '

            ' ), 4 => array( 'content' => '

            ' . __( 'Recent Comments' ) . '

            ' ), 5 => array( 'content' => '

            ' . __( 'Archives' ) . '

            ' ), 6 => array( 'content' => '

            ' . __( 'Categories' ) . '

            ' ), '_multiwidget' => 1, ) ); update_option( 'sidebars_widgets', array( 'wp_inactive_widgets' => array(), 'sidebar-1' => array( 0 => 'block-2', 1 => 'block-3', 2 => 'block-4', ), 'sidebar-2' => array( 0 => 'block-5', 1 => 'block-6', ), 'array_version' => 3, ) ); if ( ! is_multisite() ) { update_user_meta( $user_id, 'show_welcome_panel', 1 ); } elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) ) { update_user_meta( $user_id, 'show_welcome_panel', 2 ); } if ( is_multisite() ) { $wp_rewrite->init(); $wp_rewrite->flush_rules(); $user = new WP_User( $user_id ); $wpdb->update( $wpdb->options, array( 'option_value' => $user->user_email ), array( 'option_name' => 'admin_email' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) ); if ( ! is_super_admin( $user_id ) && 1 != $user_id ) { $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id, 'meta_key' => $wpdb->base_prefix . '1_capabilities', ) ); } } } endif; function wp_install_maybe_enable_pretty_permalinks() { global $wp_rewrite; if ( get_option( 'permalink_structure' ) ) { return true; } $permalink_structures = array( '/%year%/%monthnum%/%day%/%postname%/', '/index.php/%year%/%monthnum%/%day%/%postname%/', ); foreach ( (array) $permalink_structures as $permalink_structure ) { $wp_rewrite->set_permalink_structure( $permalink_structure ); $wp_rewrite->flush_rules( true ); $test_url = ''; $first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' ); if ( $first_post ) { $test_url = get_permalink( $first_post->ID ); } $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; if ( $pretty_permalinks ) { return true; } } $wp_rewrite->set_permalink_structure( '' ); $wp_rewrite->flush_rules( true ); return false; } if ( ! function_exists( 'wp_new_blog_notification' ) ) : function wp_new_blog_notification( $blog_title, $blog_url, $user_id, $password ) { $user = new WP_User( $user_id ); $email = $user->user_email; $name = $user->user_login; $login_url = wp_login_url(); $message = sprintf( __( 'Your new WordPress site has been successfully set up at: - -%1$s - -You can log in to the administrator account with the following information: - -Username: %2$s -Password: %3$s -Log in here: %4$s - -We hope you enjoy your new site. Thanks! - ---The WordPress Team -https://wordpress.org/ -' ), $blog_url, $name, $password, $login_url ); $installed_email = array( 'to' => $email, 'subject' => __( 'New WordPress Site' ), 'message' => $message, 'headers' => '', ); $installed_email = apply_filters( 'wp_installed_email', $installed_email, $user, $blog_title, $blog_url, $password ); wp_mail( $installed_email['to'], $installed_email['subject'], $installed_email['message'], $installed_email['headers'] ); } endif; if ( ! function_exists( 'wp_upgrade' ) ) : function wp_upgrade() { global $wp_current_db_version, $wp_db_version, $wpdb; $wp_current_db_version = __get_option( 'db_version' ); if ( $wp_db_version == $wp_current_db_version ) { return; } if ( ! is_blog_installed() ) { return; } wp_check_mysql_version(); wp_cache_flush(); pre_schema_upgrade(); make_db_current_silent(); upgrade_all(); if ( is_multisite() && is_main_site() ) { upgrade_network(); } wp_cache_flush(); if ( is_multisite() ) { update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version ); update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() ); } do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version ); } endif; function upgrade_all() { global $wp_current_db_version, $wp_db_version; $wp_current_db_version = __get_option( 'db_version' ); if ( $wp_db_version == $wp_current_db_version ) { return; } if ( empty( $wp_current_db_version ) ) { $wp_current_db_version = 0; $template = __get_option( 'template' ); if ( ! empty( $template ) ) { $wp_current_db_version = 2541; } } if ( $wp_current_db_version < 6039 ) { upgrade_230_options_table(); } populate_options(); if ( $wp_current_db_version < 2541 ) { upgrade_100(); upgrade_101(); upgrade_110(); upgrade_130(); } if ( $wp_current_db_version < 3308 ) { upgrade_160(); } if ( $wp_current_db_version < 4772 ) { upgrade_210(); } if ( $wp_current_db_version < 4351 ) { upgrade_old_slugs(); } if ( $wp_current_db_version < 5539 ) { upgrade_230(); } if ( $wp_current_db_version < 6124 ) { upgrade_230_old_tables(); } if ( $wp_current_db_version < 7499 ) { upgrade_250(); } if ( $wp_current_db_version < 7935 ) { upgrade_252(); } if ( $wp_current_db_version < 8201 ) { upgrade_260(); } if ( $wp_current_db_version < 8989 ) { upgrade_270(); } if ( $wp_current_db_version < 10360 ) { upgrade_280(); } if ( $wp_current_db_version < 11958 ) { upgrade_290(); } if ( $wp_current_db_version < 15260 ) { upgrade_300(); } if ( $wp_current_db_version < 19389 ) { upgrade_330(); } if ( $wp_current_db_version < 20080 ) { upgrade_340(); } if ( $wp_current_db_version < 22422 ) { upgrade_350(); } if ( $wp_current_db_version < 25824 ) { upgrade_370(); } if ( $wp_current_db_version < 26148 ) { upgrade_372(); } if ( $wp_current_db_version < 26691 ) { upgrade_380(); } if ( $wp_current_db_version < 29630 ) { upgrade_400(); } if ( $wp_current_db_version < 33055 ) { upgrade_430(); } if ( $wp_current_db_version < 33056 ) { upgrade_431(); } if ( $wp_current_db_version < 35700 ) { upgrade_440(); } if ( $wp_current_db_version < 36686 ) { upgrade_450(); } if ( $wp_current_db_version < 37965 ) { upgrade_460(); } if ( $wp_current_db_version < 44719 ) { upgrade_510(); } if ( $wp_current_db_version < 45744 ) { upgrade_530(); } if ( $wp_current_db_version < 48575 ) { upgrade_550(); } if ( $wp_current_db_version < 49752 ) { upgrade_560(); } if ( $wp_current_db_version < 51917 ) { upgrade_590(); } if ( $wp_current_db_version < 53011 ) { upgrade_600(); } maybe_disable_link_manager(); maybe_disable_automattic_widgets(); update_option( 'db_version', $wp_db_version ); update_option( 'db_upgraded', true ); } function upgrade_100() { global $wpdb; $posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" ); if ( $posts ) { foreach ( $posts as $post ) { if ( '' === $post->post_name ) { $newtitle = sanitize_title( $post->post_title ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID ) ); } } } $categories = $wpdb->get_results( "SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories" ); foreach ( $categories as $category ) { if ( '' === $category->category_nicename ) { $newtitle = sanitize_title( $category->cat_name ); $wpdb->update( $wpdb->categories, array( 'category_nicename' => $newtitle ), array( 'cat_ID' => $category->cat_ID ) ); } } $sql = "UPDATE $wpdb->options - SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/') - WHERE option_name LIKE %s - AND option_value LIKE %s"; $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( 'links_rating_image' ) . '%', $wpdb->esc_like( 'wp-links/links-images/' ) . '%' ) ); $done_ids = $wpdb->get_results( "SELECT DISTINCT post_id FROM $wpdb->post2cat" ); if ( $done_ids ) : $done_posts = array(); foreach ( $done_ids as $done_id ) : $done_posts[] = $done_id->post_id; endforeach; $catwhere = ' AND ID NOT IN (' . implode( ',', $done_posts ) . ')'; else : $catwhere = ''; endif; $allposts = $wpdb->get_results( "SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere" ); if ( $allposts ) : foreach ( $allposts as $post ) { $cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) ); if ( ! $cat && 0 != $post->post_category ) { $wpdb->insert( $wpdb->post2cat, array( 'post_id' => $post->ID, 'category_id' => $post->post_category, ) ); } } endif; } function upgrade_101() { global $wpdb; add_clean_index( $wpdb->posts, 'post_name' ); add_clean_index( $wpdb->posts, 'post_status' ); add_clean_index( $wpdb->categories, 'category_nicename' ); add_clean_index( $wpdb->comments, 'comment_approved' ); add_clean_index( $wpdb->comments, 'comment_post_ID' ); add_clean_index( $wpdb->links, 'link_category' ); add_clean_index( $wpdb->links, 'link_visible' ); } function upgrade_110() { global $wpdb; $users = $wpdb->get_results( "SELECT ID, user_nickname, user_nicename FROM $wpdb->users" ); foreach ( $users as $user ) { if ( '' === $user->user_nicename ) { $newname = sanitize_title( $user->user_nickname ); $wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) ); } } $users = $wpdb->get_results( "SELECT ID, user_pass from $wpdb->users" ); foreach ( $users as $row ) { if ( ! preg_match( '/^[A-Fa-f0-9]{32}$/', $row->user_pass ) ) { $wpdb->update( $wpdb->users, array( 'user_pass' => md5( $row->user_pass ) ), array( 'ID' => $row->ID ) ); } } $all_options = get_alloptions_110(); $time_difference = $all_options->time_difference; $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_option( 'gmt_offset', $gmt_offset ); $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_hours = (int) $diff_gmt_weblogger; $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) ); $wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); $wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" ); $wpdb->query( "UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'" ); $wpdb->query( "UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); $wpdb->query( "UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); } } function upgrade_130() { global $wpdb; $posts = $wpdb->get_results( "SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts" ); if ( $posts ) { foreach ( $posts as $post ) { $post_content = addslashes( deslash( $post->post_content ) ); $post_title = addslashes( deslash( $post->post_title ) ); $post_excerpt = addslashes( deslash( $post->post_excerpt ) ); if ( empty( $post->guid ) ) { $guid = get_permalink( $post->ID ); } else { $guid = $post->guid; } $wpdb->update( $wpdb->posts, compact( 'post_title', 'post_content', 'post_excerpt', 'guid' ), array( 'ID' => $post->ID ) ); } } $comments = $wpdb->get_results( "SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments" ); if ( $comments ) { foreach ( $comments as $comment ) { $comment_content = deslash( $comment->comment_content ); $comment_author = deslash( $comment->comment_author ); $wpdb->update( $wpdb->comments, compact( 'comment_content', 'comment_author' ), array( 'comment_ID' => $comment->comment_ID ) ); } } $links = $wpdb->get_results( "SELECT link_id, link_name, link_description FROM $wpdb->links" ); if ( $links ) { foreach ( $links as $link ) { $link_name = deslash( $link->link_name ); $link_description = deslash( $link->link_description ); $wpdb->update( $wpdb->links, compact( 'link_name', 'link_description' ), array( 'link_id' => $link->link_id ) ); } } $active_plugins = __get_option( 'active_plugins' ); if ( ! is_array( $active_plugins ) ) { $active_plugins = explode( "\n", trim( $active_plugins ) ); update_option( 'active_plugins', $active_plugins ); } $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options' ); $wpdb->query( "UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'" ); $wpdb->query( "UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '', '') WHERE comment_content LIKE '%'" ); $options = $wpdb->get_results( "SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name" ); foreach ( $options as $option ) { if ( 1 != $option->dupes ) { $limit = $option->dupes - 1; $dupe_ids = $wpdb->get_col( $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit ) ); if ( $dupe_ids ) { $dupe_ids = implode( ',', $dupe_ids ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)" ); } } } make_site_theme(); } function upgrade_160() { global $wpdb, $wp_current_db_version; populate_roles_160(); $users = $wpdb->get_results( "SELECT * FROM $wpdb->users" ); foreach ( $users as $user ) : if ( ! empty( $user->user_firstname ) ) { update_user_meta( $user->ID, 'first_name', wp_slash( $user->user_firstname ) ); } if ( ! empty( $user->user_lastname ) ) { update_user_meta( $user->ID, 'last_name', wp_slash( $user->user_lastname ) ); } if ( ! empty( $user->user_nickname ) ) { update_user_meta( $user->ID, 'nickname', wp_slash( $user->user_nickname ) ); } if ( ! empty( $user->user_level ) ) { update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level ); } if ( ! empty( $user->user_icq ) ) { update_user_meta( $user->ID, 'icq', wp_slash( $user->user_icq ) ); } if ( ! empty( $user->user_aim ) ) { update_user_meta( $user->ID, 'aim', wp_slash( $user->user_aim ) ); } if ( ! empty( $user->user_msn ) ) { update_user_meta( $user->ID, 'msn', wp_slash( $user->user_msn ) ); } if ( ! empty( $user->user_yim ) ) { update_user_meta( $user->ID, 'yim', wp_slash( $user->user_icq ) ); } if ( ! empty( $user->user_description ) ) { update_user_meta( $user->ID, 'description', wp_slash( $user->user_description ) ); } if ( isset( $user->user_idmode ) ) : $idmode = $user->user_idmode; if ( 'nickname' === $idmode ) { $id = $user->user_nickname; } if ( 'login' === $idmode ) { $id = $user->user_login; } if ( 'firstname' === $idmode ) { $id = $user->user_firstname; } if ( 'lastname' === $idmode ) { $id = $user->user_lastname; } if ( 'namefl' === $idmode ) { $id = $user->user_firstname . ' ' . $user->user_lastname; } if ( 'namelf' === $idmode ) { $id = $user->user_lastname . ' ' . $user->user_firstname; } if ( ! $idmode ) { $id = $user->user_nickname; } $wpdb->update( $wpdb->users, array( 'display_name' => $id ), array( 'ID' => $user->ID ) ); endif; $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities' ); if ( empty( $caps ) || defined( 'RESET_CAPS' ) ) { $level = get_user_meta( $user->ID, $wpdb->prefix . 'user_level', true ); $role = translate_level_to_role( $level ); update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array( $role => true ) ); } endforeach; $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' ); $wpdb->hide_errors(); foreach ( $old_user_fields as $old ) { $wpdb->query( "ALTER TABLE $wpdb->users DROP $old" ); } $wpdb->show_errors(); $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" ); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { $wpdb->update( $wpdb->posts, array( 'comment_count' => $comment->c ), array( 'ID' => $comment->comment_post_ID ) ); } } if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) { $objects = $wpdb->get_results( "SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'" ); foreach ( $objects as $object ) { $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', 'post_mime_type' => $object->post_type, 'post_type' => '', ), array( 'ID' => $object->ID ) ); $meta = get_post_meta( $object->ID, 'imagedata', true ); if ( ! empty( $meta['file'] ) ) { update_attached_file( $object->ID, $meta['file'] ); } } } } function upgrade_210() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 3506 ) { $posts = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts" ); if ( ! empty( $posts ) ) { foreach ( $posts as $post ) { $status = $post->post_status; $type = 'post'; if ( 'static' === $status ) { $status = 'publish'; $type = 'page'; } elseif ( 'attachment' === $status ) { $status = 'inherit'; $type = 'attachment'; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID ) ); } } } if ( $wp_current_db_version < 3845 ) { populate_roles_210(); } if ( $wp_current_db_version < 3531 ) { $now = gmdate( 'Y-m-d H:i:59' ); $wpdb->query( "UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'" ); $posts = $wpdb->get_results( "SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'" ); if ( ! empty( $posts ) ) { foreach ( $posts as $post ) { wp_schedule_single_event( mysql2date( 'U', $post->post_date, false ), 'publish_future_post', array( $post->ID ) ); } } } } function upgrade_230() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 5200 ) { populate_roles_230(); } $tt_ids = array(); $have_tags = false; $categories = $wpdb->get_results( "SELECT * FROM $wpdb->categories ORDER BY cat_ID" ); foreach ( $categories as $category ) { $term_id = (int) $category->cat_ID; $name = $category->cat_name; $description = $category->category_description; $slug = $category->category_nicename; $parent = $category->category_parent; $term_group = 0; $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); if ( $exists ) { $term_group = $exists[0]->term_group; $id = $exists[0]->term_id; $num = 2; do { $alt_slug = $slug . "-$num"; $num++; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); $slug = $alt_slug; if ( empty( $term_group ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group" ) + 1; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id ) ); } } $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES - (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group ) ); $count = 0; if ( ! empty( $category->category_count ) ) { $count = (int) $category->category_count; $taxonomy = 'category'; $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( ! empty( $category->link_count ) ) { $count = (int) $category->link_count; $taxonomy = 'link_category'; $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( ! empty( $category->tag_count ) ) { $have_tags = true; $count = (int) $category->tag_count; $taxonomy = 'post_tag'; $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent', 'count' ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } if ( empty( $count ) ) { $count = 0; $taxonomy = 'category'; $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent', 'count' ) ); $tt_ids[ $term_id ][ $taxonomy ] = (int) $wpdb->insert_id; } } $select = 'post_id, category_id'; if ( $have_tags ) { $select .= ', rel_type'; } $posts = $wpdb->get_results( "SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id" ); foreach ( $posts as $post ) { $post_id = (int) $post->post_id; $term_id = (int) $post->category_id; $taxonomy = 'category'; if ( ! empty( $post->rel_type ) && 'tag' === $post->rel_type ) { $taxonomy = 'tag'; } $tt_id = $tt_ids[ $term_id ][ $taxonomy ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $post_id, 'term_taxonomy_id' => $tt_id, ) ); } if ( $wp_current_db_version < 3570 ) { $link_cat_id_map = array(); $default_link_cat = 0; $tt_ids = array(); $link_cats = $wpdb->get_results( 'SELECT cat_id, cat_name FROM ' . $wpdb->prefix . 'linkcategories' ); foreach ( $link_cats as $category ) { $cat_id = (int) $category->cat_id; $term_id = 0; $name = wp_slash( $category->cat_name ); $slug = sanitize_title( $name ); $term_group = 0; $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); if ( $exists ) { $term_group = $exists[0]->term_group; $term_id = $exists[0]->term_id; } if ( empty( $term_id ) ) { $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ); $term_id = (int) $wpdb->insert_id; } $link_cat_id_map[ $cat_id ] = $term_id; $default_link_cat = $term_id; $wpdb->insert( $wpdb->term_taxonomy, array( 'term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0, ) ); $tt_ids[ $term_id ] = (int) $wpdb->insert_id; } $links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" ); if ( ! empty( $links ) ) { foreach ( $links as $link ) { if ( 0 == $link->link_category ) { continue; } if ( ! isset( $link_cat_id_map[ $link->link_category ] ) ) { continue; } $term_id = $link_cat_id_map[ $link->link_category ]; $tt_id = $tt_ids[ $term_id ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id, ) ); } } update_option( 'default_link_category', $default_link_cat ); } else { $links = $wpdb->get_results( "SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id" ); foreach ( $links as $link ) { $link_id = (int) $link->link_id; $term_id = (int) $link->category_id; $taxonomy = 'link_category'; $tt_id = $tt_ids[ $term_id ][ $taxonomy ]; if ( empty( $tt_id ) ) { continue; } $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $link_id, 'term_taxonomy_id' => $tt_id, ) ); } } if ( $wp_current_db_version < 4772 ) { $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories' ); } $terms = $wpdb->get_results( "SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy" ); foreach ( (array) $terms as $term ) { if ( 'post_tag' === $term->taxonomy || 'category' === $term->taxonomy ) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id ) ); } else { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ) ); } $wpdb->update( $wpdb->term_taxonomy, array( 'count' => $count ), array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); } } function upgrade_230_options_table() { global $wpdb; $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' ); $wpdb->hide_errors(); foreach ( $old_options_fields as $old ) { $wpdb->query( "ALTER TABLE $wpdb->options DROP $old" ); } $wpdb->show_errors(); } function upgrade_230_old_tables() { global $wpdb; $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat' ); $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat' ); } function upgrade_old_slugs() { global $wpdb; $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'" ); } function upgrade_250() { global $wp_current_db_version; if ( $wp_current_db_version < 6689 ) { populate_roles_250(); } } function upgrade_252() { global $wpdb; $wpdb->query( "UPDATE $wpdb->users SET user_activation_key = ''" ); } function upgrade_260() { global $wp_current_db_version; if ( $wp_current_db_version < 8000 ) { populate_roles_260(); } } function upgrade_270() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 8980 ) { populate_roles_270(); } if ( $wp_current_db_version < 8921 ) { $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" ); } } function upgrade_280() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 10360 ) { populate_roles_280(); } if ( is_multisite() ) { $start = 0; while ( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) { foreach ( $rows as $row ) { $value = maybe_unserialize( $row->option_value ); if ( $value === $row->option_value ) { $value = stripslashes( $value ); } if ( $value !== $row->option_value ) { update_option( $row->option_name, $value ); } } $start += 20; } clean_blog_cache( get_current_blog_id() ); } } function upgrade_290() { global $wp_current_db_version; if ( $wp_current_db_version < 11958 ) { if ( get_option( 'thread_comments_depth' ) == '1' ) { update_option( 'thread_comments_depth', 2 ); update_option( 'thread_comments', 0 ); } } } function upgrade_300() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 15093 ) { populate_roles_300(); } if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false ) { add_site_option( 'siteurl', '' ); } if ( wp_should_upgrade_global_tables() ) { $sql = "DELETE FROM $wpdb->usermeta - WHERE meta_key LIKE %s - OR meta_key LIKE %s - OR meta_key LIKE %s - OR meta_key LIKE %s - OR meta_key LIKE %s - OR meta_key LIKE %s - OR meta_key = 'manageedittagscolumnshidden' - OR meta_key = 'managecategoriescolumnshidden' - OR meta_key = 'manageedit-tagscolumnshidden' - OR meta_key = 'manageeditcolumnshidden' - OR meta_key = 'categories_per_page' - OR meta_key = 'edit_tags_per_page'"; $prefix = $wpdb->esc_like( $wpdb->base_prefix ); $wpdb->query( $wpdb->prepare( $sql, $prefix . '%' . $wpdb->esc_like( 'meta-box-hidden' ) . '%', $prefix . '%' . $wpdb->esc_like( 'closedpostboxes' ) . '%', $prefix . '%' . $wpdb->esc_like( 'manage-' ) . '%' . $wpdb->esc_like( '-columns-hidden' ) . '%', $prefix . '%' . $wpdb->esc_like( 'meta-box-order' ) . '%', $prefix . '%' . $wpdb->esc_like( 'metaboxorder' ) . '%', $prefix . '%' . $wpdb->esc_like( 'screen_layout' ) . '%' ) ); } } function upgrade_330() { global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets; if ( $wp_current_db_version < 19061 && wp_should_upgrade_global_tables() ) { $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" ); } if ( $wp_current_db_version >= 11548 ) { return; } $sidebars_widgets = get_option( 'sidebars_widgets', array() ); $_sidebars_widgets = array(); if ( isset( $sidebars_widgets['wp_inactive_widgets'] ) || empty( $sidebars_widgets ) ) { $sidebars_widgets['array_version'] = 3; } elseif ( ! isset( $sidebars_widgets['array_version'] ) ) { $sidebars_widgets['array_version'] = 1; } switch ( $sidebars_widgets['array_version'] ) { case 1: foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( (array) $sidebar as $i => $name ) { $id = strtolower( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; continue; } $id = sanitize_title( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; continue; } $found = false; foreach ( $wp_registered_widgets as $widget_id => $widget ) { if ( strtolower( $widget['name'] ) == strtolower( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; $found = true; break; } elseif ( sanitize_title( $widget['name'] ) == sanitize_title( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; $found = true; break; } } if ( $found ) { continue; } unset( $_sidebars_widgets[ $index ][ $i ] ); } } } $_sidebars_widgets['array_version'] = 2; $sidebars_widgets = $_sidebars_widgets; unset( $_sidebars_widgets ); case 2: $sidebars_widgets = retrieve_widgets(); $sidebars_widgets['array_version'] = 3; update_option( 'sidebars_widgets', $sidebars_widgets ); } } function upgrade_340() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 19798 ) { $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" ); $wpdb->show_errors(); } if ( $wp_current_db_version < 19799 ) { $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE $wpdb->comments DROP INDEX comment_approved" ); $wpdb->show_errors(); } if ( $wp_current_db_version < 20022 && wp_should_upgrade_global_tables() ) { $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" ); } if ( $wp_current_db_version < 20080 ) { if ( 'yes' === $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) { $uninstall_plugins = get_option( 'uninstall_plugins' ); delete_option( 'uninstall_plugins' ); add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' ); } } } function upgrade_350() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { update_option( 'link_manager_enabled', 1 ); } if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) { $meta_keys = array(); foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) { if ( false !== strpos( $name, '-' ) ) { $meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page'; } } if ( $meta_keys ) { $meta_keys = implode( "', '", $meta_keys ); $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')" ); } } if ( $wp_current_db_version < 22422 ) { $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ); if ( $term ) { wp_delete_term( $term->term_id, 'post_format' ); } } } function upgrade_370() { global $wp_current_db_version; if ( $wp_current_db_version < 25824 ) { wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' ); } } function upgrade_372() { global $wp_current_db_version; if ( $wp_current_db_version < 26148 ) { wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); } } function upgrade_380() { global $wp_current_db_version; if ( $wp_current_db_version < 26691 ) { deactivate_plugins( array( 'mp6/mp6.php' ), true ); } } function upgrade_400() { global $wp_current_db_version; if ( $wp_current_db_version < 29630 ) { if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) { if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) { update_option( 'WPLANG', WPLANG ); } else { update_option( 'WPLANG', '' ); } } } } function upgrade_420() {} function upgrade_430() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 32364 ) { upgrade_430_fix_comments(); } if ( $wp_current_db_version < 32814 ) { update_option( 'finished_splitting_shared_terms', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); } if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) { if ( is_multisite() ) { $tables = $wpdb->tables( 'blog' ); } else { $tables = $wpdb->tables( 'all' ); if ( ! wp_should_upgrade_global_tables() ) { $global_tables = $wpdb->tables( 'global' ); $tables = array_diff_assoc( $tables, $global_tables ); } } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } function upgrade_430_fix_comments() { global $wpdb; $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' ); if ( is_wp_error( $content_length ) ) { return; } if ( false === $content_length ) { $content_length = array( 'type' => 'byte', 'length' => 65535, ); } elseif ( ! is_array( $content_length ) ) { $length = (int) $content_length > 0 ? (int) $content_length : 65535; $content_length = array( 'type' => 'byte', 'length' => $length, ); } if ( 'byte' !== $content_length['type'] || 0 === $content_length['length'] ) { return; } $allowed_length = (int) $content_length['length'] - 10; $comments = $wpdb->get_results( "SELECT `comment_ID` FROM `{$wpdb->comments}` - WHERE `comment_date_gmt` > '2015-04-26' - AND LENGTH( `comment_content` ) >= {$allowed_length} - AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )" ); foreach ( $comments as $comment ) { wp_delete_comment( $comment->comment_ID, true ); } } function upgrade_431() { $cron_array = _get_cron_array(); if ( isset( $cron_array['wp_batch_split_terms'] ) ) { unset( $cron_array['wp_batch_split_terms'] ); _set_cron_array( $cron_array ); } } function upgrade_440() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 34030 ) { $wpdb->query( "ALTER TABLE {$wpdb->options} MODIFY option_name VARCHAR(191)" ); } $roles = wp_roles(); foreach ( $roles->role_objects as $role ) { if ( $role->has_cap( 'add_users' ) ) { $role->remove_cap( 'add_users' ); } } } function upgrade_450() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 36180 ) { wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); } if ( $wp_current_db_version < 36679 && is_multisite() ) { $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^[0-9]+_new_email$'" ); } delete_user_setting( 'wplink' ); } function upgrade_460() { global $wp_current_db_version; if ( $wp_current_db_version < 37854 ) { delete_post_meta_by_key( '_post_restored_from' ); } if ( $wp_current_db_version < 37965 ) { $uninstall_plugins = get_option( 'uninstall_plugins', array() ); if ( ! empty( $uninstall_plugins ) ) { foreach ( $uninstall_plugins as $basename => $callback ) { if ( is_array( $callback ) && is_object( $callback[0] ) ) { unset( $uninstall_plugins[ $basename ] ); } } update_option( 'uninstall_plugins', $uninstall_plugins ); } } } function upgrade_500() { } function upgrade_510() { delete_site_option( 'upgrade_500_was_gutenberg_active' ); } function upgrade_530() { if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) { update_option( 'admin_email_lifespan', 0 ); } } function upgrade_550() { global $wp_current_db_version; if ( $wp_current_db_version < 48121 ) { $comment_previously_approved = get_option( 'comment_whitelist', '' ); update_option( 'comment_previously_approved', $comment_previously_approved ); delete_option( 'comment_whitelist' ); } if ( $wp_current_db_version < 48575 ) { $disallowed_list = get_option( 'blacklist_keys' ); if ( false === $disallowed_list ) { $disallowed_list = get_option( 'blocklist_keys' ); } update_option( 'disallowed_keys', $disallowed_list ); delete_option( 'blacklist_keys' ); delete_option( 'blocklist_keys' ); } if ( $wp_current_db_version < 48748 ) { update_option( 'finished_updating_comment_type', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); } } function upgrade_560() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 49572 ) { $post_category_exists = $wpdb->get_var( "SHOW COLUMNS FROM $wpdb->posts LIKE 'post_category'" ); if ( ! is_null( $post_category_exists ) ) { $wpdb->query( "ALTER TABLE $wpdb->posts DROP COLUMN `post_category`" ); } update_option( 'auto_update_core_major', 'unset' ); } if ( $wp_current_db_version < 49632 ) { save_mod_rewrite_rules(); } if ( $wp_current_db_version < 49735 ) { delete_transient( 'dirsize_cache' ); } if ( $wp_current_db_version < 49752 ) { $results = $wpdb->get_results( $wpdb->prepare( "SELECT 1 FROM {$wpdb->usermeta} WHERE meta_key = %s LIMIT 1", WP_Application_Passwords::USERMETA_KEY_APPLICATION_PASSWORDS ) ); if ( ! empty( $results ) ) { $network_id = get_main_network_id(); update_network_option( $network_id, WP_Application_Passwords::OPTION_KEY_IN_USE, 1 ); } } } function upgrade_590() { global $wp_current_db_version; if ( $wp_current_db_version < 51917 ) { $crons = _get_cron_array(); if ( $crons && is_array( $crons ) ) { $crons = array_filter( $crons ); _set_cron_array( $crons ); } } } function upgrade_600() { global $wp_current_db_version; if ( $wp_current_db_version < 53011 ) { wp_update_user_counts(); } } function upgrade_network() { global $wp_current_db_version, $wpdb; delete_expired_transients( true ); if ( $wp_current_db_version < 11549 ) { $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' ); $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' ); if ( $wpmu_sitewide_plugins ) { if ( ! $active_sitewide_plugins ) { $sitewide_plugins = (array) $wpmu_sitewide_plugins; } else { $sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins ); } update_site_option( 'active_sitewide_plugins', $sitewide_plugins ); } delete_site_option( 'wpmu_sitewide_plugins' ); delete_site_option( 'deactivated_sitewide_plugins' ); $start = 0; while ( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) { foreach ( $rows as $row ) { $value = $row->meta_value; if ( ! @unserialize( $value ) ) { $value = stripslashes( $value ); } if ( $value !== $row->meta_value ) { update_site_option( $row->meta_key, $value ); } } $start += 20; } } if ( $wp_current_db_version < 13576 ) { update_site_option( 'global_terms_enabled', '1' ); } if ( $wp_current_db_version < 19390 ) { update_site_option( 'initial_db_version', $wp_current_db_version ); } if ( $wp_current_db_version < 19470 ) { if ( false === get_site_option( 'active_sitewide_plugins' ) ) { update_site_option( 'active_sitewide_plugins', array() ); } } if ( $wp_current_db_version < 20148 ) { $allowedthemes = get_site_option( 'allowedthemes' ); $allowed_themes = get_site_option( 'allowed_themes' ); if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) { $converted = array(); $themes = wp_get_themes(); foreach ( $themes as $stylesheet => $theme_data ) { if ( isset( $allowed_themes[ $theme_data->get( 'Name' ) ] ) ) { $converted[ $stylesheet ] = true; } } update_site_option( 'allowedthemes', $converted ); delete_site_option( 'allowed_themes' ); } } if ( $wp_current_db_version < 21823 ) { update_site_option( 'ms_files_rewriting', '1' ); } if ( $wp_current_db_version < 24448 ) { $illegal_names = get_site_option( 'illegal_names' ); if ( is_array( $illegal_names ) && count( $illegal_names ) === 1 ) { $illegal_name = reset( $illegal_names ); $illegal_names = explode( ' ', $illegal_name ); update_site_option( 'illegal_names', $illegal_names ); } } if ( $wp_current_db_version < 31351 && 'utf8mb4' === $wpdb->charset ) { if ( wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" ); $wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" ); $tables = $wpdb->tables( 'global' ); if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) { unset( $tables['sitecategories'] ); } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) { if ( wp_should_upgrade_global_tables() ) { $upgrade = false; $indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" ); foreach ( $indexes as $index ) { if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) { $upgrade = true; break; } } if ( $upgrade ) { $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" ); } $tables = $wpdb->tables( 'global' ); if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) { unset( $tables['sitecategories'] ); } foreach ( $tables as $table ) { maybe_convert_table_to_utf8mb4( $table ); } } } if ( $wp_current_db_version < 44467 ) { $network_id = get_main_network_id(); delete_network_option( $network_id, 'site_meta_supported' ); is_site_meta_supported(); } } function maybe_create_table( $table_name, $create_ddl ) { global $wpdb; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ); if ( $wpdb->get_var( $query ) === $table_name ) { return true; } $wpdb->query( $create_ddl ); if ( $wpdb->get_var( $query ) === $table_name ) { return true; } return false; } function drop_index( $table, $index ) { global $wpdb; $wpdb->hide_errors(); $wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" ); for ( $i = 0; $i < 25; $i++ ) { $wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" ); } $wpdb->show_errors(); return true; } function add_clean_index( $table, $index ) { global $wpdb; drop_index( $table, $index ); $wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" ); return true; } function maybe_add_column( $table_name, $column_name, $create_ddl ) { global $wpdb; foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } $wpdb->query( $create_ddl ); foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { if ( $column === $column_name ) { return true; } } return false; } function maybe_convert_table_to_utf8mb4( $table ) { global $wpdb; $results = $wpdb->get_results( "SHOW FULL COLUMNS FROM `$table`" ); if ( ! $results ) { return false; } foreach ( $results as $column ) { if ( $column->Collation ) { list( $charset ) = explode( '_', $column->Collation ); $charset = strtolower( $charset ); if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) { return false; } } } $table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" ); if ( ! $table_details ) { return false; } list( $table_charset ) = explode( '_', $table_details->Collation ); $table_charset = strtolower( $table_charset ); if ( 'utf8mb4' === $table_charset ) { return true; } return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" ); } function get_alloptions_110() { global $wpdb; $all_options = new stdClass; $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); if ( $options ) { foreach ( $options as $option ) { if ( 'siteurl' === $option->option_name || 'home' === $option->option_name || 'category_base' === $option->option_name ) { $option->option_value = untrailingslashit( $option->option_value ); } $all_options->{$option->option_name} = stripslashes( $option->option_value ); } } return $all_options; } function __get_option( $setting ) { global $wpdb; if ( 'home' === $setting && defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) { return untrailingslashit( WP_SITEURL ); } $option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) ); if ( 'home' === $setting && ! $option ) { return __get_option( 'siteurl' ); } if ( in_array( $setting, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) { $option = untrailingslashit( $option ); } return maybe_unserialize( $option ); } function deslash( $content ) { $content = preg_replace( "/\\\+'/", "'", $content ); $content = preg_replace( '/\\\+"/', '"', $content ); $content = preg_replace( '/\\\+/', '\\', $content ); return $content; } function dbDelta( $queries = '', $execute = true ) { global $wpdb; if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) ) { $queries = wp_get_db_schema( $queries ); } if ( ! is_array( $queries ) ) { $queries = explode( ';', $queries ); $queries = array_filter( $queries ); } $queries = apply_filters( 'dbdelta_queries', $queries ); $cqueries = array(); $iqueries = array(); $for_update = array(); foreach ( $queries as $qry ) { if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { $cqueries[ trim( $matches[1], '`' ) ] = $qry; $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; } elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { array_unshift( $cqueries, $qry ); } elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; } elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; } else { } } $cqueries = apply_filters( 'dbdelta_create_queries', $cqueries ); $iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries ); $text_fields = array( 'tinytext', 'text', 'mediumtext', 'longtext' ); $blob_fields = array( 'tinyblob', 'blob', 'mediumblob', 'longblob' ); $global_tables = $wpdb->tables( 'global' ); foreach ( $cqueries as $table => $qry ) { if ( in_array( $table, $global_tables, true ) && ! wp_should_upgrade_global_tables() ) { unset( $cqueries[ $table ], $for_update[ $table ] ); continue; } $suppress = $wpdb->suppress_errors(); $tablefields = $wpdb->get_results( "DESCRIBE {$table};" ); $wpdb->suppress_errors( $suppress ); if ( ! $tablefields ) { continue; } $cfields = array(); $indices = array(); $indices_without_subparts = array(); preg_match( '|\((.*)\)|ms', $qry, $match2 ); $qryline = trim( $match2[1] ); $flds = explode( "\n", $qryline ); foreach ( $flds as $fld ) { $fld = trim( $fld, " \t\n\r\0\x0B," ); preg_match( '|^([^ ]*)|', $fld, $fvals ); $fieldname = trim( $fvals[1], '`' ); $fieldname_lowercased = strtolower( $fieldname ); $validfield = true; switch ( $fieldname_lowercased ) { case '': case 'primary': case 'index': case 'fulltext': case 'unique': case 'key': case 'spatial': $validfield = false; preg_match( '/^' . '(?P' . 'PRIMARY\s+KEY|(?:UNIQUE|FULLTEXT|SPATIAL)\s+(?:KEY|INDEX)|KEY|INDEX' . ')' . '\s+' . '(?:' . '`?' . '(?P' . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' . ')' . '`?' . '\s+' . ')*' . '\(' . '(?P' . '.+?' . ')' . '\)' . '$/im', $fld, $index_matches ); $index_type = strtoupper( preg_replace( '/\s+/', ' ', trim( $index_matches['index_type'] ) ) ); $index_type = str_replace( 'INDEX', 'KEY', $index_type ); $index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`'; $index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) ); $index_columns_without_subparts = $index_columns; foreach ( $index_columns as $id => &$index_column ) { preg_match( '/' . '`?' . '(?P' . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' . ')' . '`?' . '(?:' . '\s*' . '\(' . '\s*' . '(?P' . '\d+' . ')' . '\s*' . '\)' . ')?' . '/', $index_column, $index_column_matches ); $index_column = '`' . $index_column_matches['column_name'] . '`'; $index_columns_without_subparts[ $id ] = $index_column; if ( isset( $index_column_matches['sub_part'] ) ) { $index_column .= '(' . $index_column_matches['sub_part'] . ')'; } } $indices[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns ) . ')'; $indices_without_subparts[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns_without_subparts ) . ')'; unset( $index_column, $index_column_matches, $index_matches, $index_type, $index_name, $index_columns, $index_columns_without_subparts ); break; } if ( $validfield ) { $cfields[ $fieldname_lowercased ] = $fld; } } foreach ( $tablefields as $tablefield ) { $tablefield_field_lowercased = strtolower( $tablefield->Field ); $tablefield_type_lowercased = strtolower( $tablefield->Type ); if ( array_key_exists( $tablefield_field_lowercased, $cfields ) ) { preg_match( '|`?' . $tablefield->Field . '`? ([^ ]*( unsigned)?)|i', $cfields[ $tablefield_field_lowercased ], $matches ); $fieldtype = $matches[1]; $fieldtype_lowercased = strtolower( $fieldtype ); if ( $tablefield->Type != $fieldtype ) { $do_change = true; if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) { $do_change = false; } } if ( in_array( $fieldtype_lowercased, $blob_fields, true ) && in_array( $tablefield_type_lowercased, $blob_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $blob_fields, true ) < array_search( $tablefield_type_lowercased, $blob_fields, true ) ) { $do_change = false; } } if ( $do_change ) { $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN `{$tablefield->Field}` " . $cfields[ $tablefield_field_lowercased ]; $for_update[ $table . '.' . $tablefield->Field ] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; } } if ( preg_match( "| DEFAULT '(.*?)'|i", $cfields[ $tablefield_field_lowercased ], $matches ) ) { $default_value = $matches[1]; if ( $tablefield->Default != $default_value ) { $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN `{$tablefield->Field}` SET DEFAULT '{$default_value}'"; $for_update[ $table . '.' . $tablefield->Field ] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}"; } } unset( $cfields[ $tablefield_field_lowercased ] ); } else { } } foreach ( $cfields as $fieldname => $fielddef ) { $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; $for_update[ $table . '.' . $fieldname ] = 'Added column ' . $table . '.' . $fieldname; } $tableindices = $wpdb->get_results( "SHOW INDEX FROM {$table};" ); if ( $tableindices ) { $index_ary = array(); foreach ( $tableindices as $tableindex ) { $keyname = strtolower( $tableindex->Key_name ); $index_ary[ $keyname ]['columns'][] = array( 'fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part, ); $index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false; $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type; } foreach ( $index_ary as $index_name => $index_data ) { $index_string = ''; if ( 'primary' === $index_name ) { $index_string .= 'PRIMARY '; } elseif ( $index_data['unique'] ) { $index_string .= 'UNIQUE '; } if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'FULLTEXT '; } if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'SPATIAL '; } $index_string .= 'KEY '; if ( 'primary' !== $index_name ) { $index_string .= '`' . $index_name . '`'; } $index_columns = ''; foreach ( $index_data['columns'] as $column_data ) { if ( '' !== $index_columns ) { $index_columns .= ','; } $index_columns .= '`' . $column_data['fieldname'] . '`'; } $index_string .= " ($index_columns)"; $aindex = array_search( $index_string, $indices_without_subparts, true ); if ( false !== $aindex ) { unset( $indices_without_subparts[ $aindex ] ); unset( $indices[ $aindex ] ); } } } foreach ( (array) $indices as $index ) { $cqueries[] = "ALTER TABLE {$table} ADD $index"; $for_update[] = 'Added index ' . $table . ' ' . $index; } unset( $cqueries[ $table ], $for_update[ $table ] ); } $allqueries = array_merge( $cqueries, $iqueries ); if ( $execute ) { foreach ( $allqueries as $query ) { $wpdb->query( $query ); } } return $for_update; } function make_db_current( $tables = 'all' ) { $alterations = dbDelta( $tables ); echo "
              \n"; foreach ( $alterations as $alteration ) { echo "
            1. $alteration
            2. \n"; } echo "
            \n"; } function make_db_current_silent( $tables = 'all' ) { dbDelta( $tables ); } function make_site_theme_from_oldschool( $theme_name, $template ) { $home_path = get_home_path(); $site_dir = WP_CONTENT_DIR . "/themes/$template"; if ( ! file_exists( "$home_path/index.php" ) ) { return false; } $files = array( 'index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php', ); foreach ( $files as $oldfile => $newfile ) { if ( 'index.php' === $oldfile ) { $oldpath = $home_path; } else { $oldpath = ABSPATH; } if ( 'index.php' === $oldfile ) { $index = implode( '', file( "$oldpath/$oldfile" ) ); if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) { return false; } continue; } } if ( ! copy( "$oldpath/$oldfile", "$site_dir/$newfile" ) ) { return false; } chmod( "$site_dir/$newfile", 0777 ); $lines = explode( "\n", implode( '', file( "$site_dir/$newfile" ) ) ); if ( $lines ) { $f = fopen( "$site_dir/$newfile", 'w' ); foreach ( $lines as $line ) { if ( preg_match( '/require.*wp-blog-header/', $line ) ) { $line = '//' . $line; } $line = str_replace( "/wp-layout.css", "", $line ); $line = str_replace( "", '', $line ); fwrite( $f, "{$line}\n" ); } fclose( $f ); } } $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option( 'siteurl' ) . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n"; $stylelines = file_get_contents( "$site_dir/style.css" ); if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); fwrite( $f, $header ); fwrite( $f, $stylelines ); fclose( $f ); } return true; } function make_site_theme_from_default( $theme_name, $template ) { $site_dir = WP_CONTENT_DIR . "/themes/$template"; $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; $theme_dir = @opendir( $default_dir ); if ( $theme_dir ) { while ( ( $theme_file = readdir( $theme_dir ) ) !== false ) { if ( is_dir( "$default_dir/$theme_file" ) ) { continue; } if ( ! copy( "$default_dir/$theme_file", "$site_dir/$theme_file" ) ) { return; } chmod( "$site_dir/$theme_file", 0777 ); } closedir( $theme_dir ); } $stylelines = explode( "\n", implode( '', file( "$site_dir/style.css" ) ) ); if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); foreach ( $stylelines as $line ) { if ( strpos( $line, 'Theme Name:' ) !== false ) { $line = 'Theme Name: ' . $theme_name; } elseif ( strpos( $line, 'Theme URI:' ) !== false ) { $line = 'Theme URI: ' . __get_option( 'url' ); } elseif ( strpos( $line, 'Description:' ) !== false ) { $line = 'Description: Your theme.'; } elseif ( strpos( $line, 'Version:' ) !== false ) { $line = 'Version: 1'; } elseif ( strpos( $line, 'Author:' ) !== false ) { $line = 'Author: You'; } fwrite( $f, $line . "\n" ); } fclose( $f ); } umask( 0 ); if ( ! mkdir( "$site_dir/images", 0777 ) ) { return false; } $images_dir = @opendir( "$default_dir/images" ); if ( $images_dir ) { while ( ( $image = readdir( $images_dir ) ) !== false ) { if ( is_dir( "$default_dir/images/$image" ) ) { continue; } if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) { return; } chmod( "$site_dir/images/$image", 0777 ); } closedir( $images_dir ); } } function make_site_theme() { $theme_name = __get_option( 'blogname' ); $template = sanitize_title( $theme_name ); $site_dir = WP_CONTENT_DIR . "/themes/$template"; if ( is_dir( $site_dir ) ) { return false; } if ( ! is_writable( WP_CONTENT_DIR . '/themes' ) ) { return false; } umask( 0 ); if ( ! mkdir( $site_dir, 0777 ) ) { return false; } if ( file_exists( ABSPATH . 'wp-layout.css' ) ) { if ( ! make_site_theme_from_oldschool( $theme_name, $template ) ) { return false; } } else { if ( ! make_site_theme_from_default( $theme_name, $template ) ) { return false; } } $current_template = __get_option( 'template' ); if ( WP_DEFAULT_THEME == $current_template ) { update_option( 'template', $template ); update_option( 'stylesheet', $template ); } return $template; } function translate_level_to_role( $level ) { switch ( $level ) { case 10: case 9: case 8: return 'administrator'; case 7: case 6: case 5: return 'editor'; case 4: case 3: case 2: return 'author'; case 1: return 'contributor'; case 0: default: return 'subscriber'; } } function wp_check_mysql_version() { global $wpdb; $result = $wpdb->check_database_version(); if ( is_wp_error( $result ) ) { wp_die( $result ); } } function maybe_disable_automattic_widgets() { $plugins = __get_option( 'active_plugins' ); foreach ( (array) $plugins as $plugin ) { if ( 'widgets.php' === basename( $plugin ) ) { array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 ); update_option( 'active_plugins', $plugins ); break; } } } function maybe_disable_link_manager() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) { update_option( 'link_manager_enabled', 0 ); } } function pre_schema_upgrade() { global $wp_current_db_version, $wpdb; if ( $wp_current_db_version < 11557 ) { $wpdb->query( "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id" ); $wpdb->query( "ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)" ); $wpdb->query( "ALTER TABLE $wpdb->options DROP INDEX option_name" ); } if ( $wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables() ) { if ( $wp_current_db_version < 25179 ) { $wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" ); $wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" ); } if ( $wp_current_db_version < 25448 ) { $wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'" ); $wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0" ); } } if ( $wp_current_db_version < 31351 ) { if ( ! is_multisite() && wp_should_upgrade_global_tables() ) { $wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); } $wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" ); $wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX name, ADD INDEX name(name(191))" ); $wpdb->query( "ALTER TABLE $wpdb->commentmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); $wpdb->query( "ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))" ); } if ( $wp_current_db_version < 34978 ) { if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->termmeta}'" ) && $wpdb->get_results( "SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'" ) ) { $wpdb->query( "ALTER TABLE $wpdb->termmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" ); maybe_convert_table_to_utf8mb4( $wpdb->termmeta ); } } } if ( ! function_exists( 'install_global_terms' ) ) : function install_global_terms() { global $wpdb, $charset_collate; $ms_queries = " -CREATE TABLE $wpdb->sitecategories ( - cat_ID bigint(20) NOT NULL auto_increment, - cat_name varchar(55) NOT NULL default '', - category_nicename varchar(200) NOT NULL default '', - last_updated timestamp NOT NULL, - PRIMARY KEY (cat_ID), - KEY category_nicename (category_nicename), - KEY last_updated (last_updated) -) $charset_collate; -"; dbDelta( $ms_queries ); } endif; function wp_should_upgrade_global_tables() { if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { return false; } $should_upgrade = true; if ( ! is_main_network() ) { $should_upgrade = false; } if ( ! is_main_site() ) { $should_upgrade = false; } return apply_filters( 'wp_should_upgrade_global_tables', $should_upgrade ); } $this->_timeout, "usec"=>0))) { $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } return true; } function _connect($host, $port) { $this->SendMSG("Creating socket"); if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); return FALSE; } if(!$this->_settimeout($sock)) return FALSE; $this->SendMSG("Connecting to \"".$host.":".$port."\""); if (!($res = @socket_connect($sock, $host, $port))) { $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); @socket_close($sock); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction,'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); } else { $this->_message.=$tmp; $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; $this->SendMSG("Creating data socket"); $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->_ftp_data_sock < 0) { $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock))); return FALSE; } if(!$this->_settimeout($this->_ftp_data_sock)) { $this->_data_close(); return FALSE; } if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } else $this->_ftp_temp_sock=$this->_ftp_data_sock; } else { if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { $this->PushError("_data_prepare","cannot get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); $this->_data_close(); return FALSE; } if(!@socket_bind($this->_ftp_data_sock,$addr)){ $this->PushError("_data_prepare","cannot bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!@socket_listen($this->_ftp_data_sock)) { $this->PushError("_data_prepare","cannot listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { $this->PushError("_data_prepare","cannot get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); $this->_data_close(); return FALSE; } if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { $NewLine=$this->_eol_code[$this->OS_local]; if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); if($this->_ftp_temp_sock===FALSE) { $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return FALSE; } } while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) { if($block==="") break; if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { $NewLine=$this->_eol_code[$this->OS_local]; if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); if($this->_ftp_temp_sock===FALSE) { $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return false; } } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return true; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) { $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); $this->_data_close(); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @socket_close($this->_ftp_temp_sock); @socket_close($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit() { if($this->_connected) { @socket_close($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?> -id ] ) ) { $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); } return $column_headers[ $screen->id ]; } function get_hidden_columns( $screen ) { if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $hidden = get_user_option( 'manage' . $screen->id . 'columnshidden' ); $use_defaults = ! is_array( $hidden ); if ( $use_defaults ) { $hidden = array(); $hidden = apply_filters( 'default_hidden_columns', $hidden, $screen ); } return apply_filters( 'hidden_columns', $hidden, $screen, $use_defaults ); } function meta_box_prefs( $screen ) { global $wp_meta_boxes; if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } if ( empty( $wp_meta_boxes[ $screen->id ] ) ) { return; } $hidden = get_hidden_meta_boxes( $screen ); foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { continue; } foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { if ( false === $box || ! $box['title'] ) { continue; } if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) { continue; } $widget_title = $box['title']; if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { $widget_title = $box['args']['__widget_basename']; } $is_hidden = in_array( $box['id'], $hidden, true ); printf( '', esc_attr( $box['id'] ), checked( $is_hidden, false, false ), $widget_title ); } } } } function get_hidden_meta_boxes( $screen ) { if ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $hidden = get_user_option( "metaboxhidden_{$screen->id}" ); $use_defaults = ! is_array( $hidden ); if ( $use_defaults ) { $hidden = array(); if ( 'post' === $screen->base ) { if ( in_array( $screen->post_type, array( 'post', 'page', 'attachment' ), true ) ) { $hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' ); } else { $hidden = array( 'slugdiv' ); } } $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen ); } return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); } function add_screen_option( $option, $args = array() ) { $current_screen = get_current_screen(); if ( ! $current_screen ) { return; } $current_screen->add_option( $option, $args ); } function get_current_screen() { global $current_screen; if ( ! isset( $current_screen ) ) { return null; } return $current_screen; } function set_current_screen( $hook_name = '' ) { WP_Screen::get( $hook_name )->set_current_screen(); } find_folder( ABSPATH ); if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { $folder = '/'; } return $folder; } public function wp_content_dir() { return $this->find_folder( WP_CONTENT_DIR ); } public function wp_plugins_dir() { return $this->find_folder( WP_PLUGIN_DIR ); } public function wp_themes_dir( $theme = false ) { $theme_root = get_theme_root( $theme ); if ( '/themes' === $theme_root || ! is_dir( $theme_root ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } return $this->find_folder( $theme_root ); } public function wp_lang_dir() { return $this->find_folder( WP_LANG_DIR ); } public function find_base_dir( $base = '.', $verbose = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' ); $this->verbose = $verbose; return $this->abspath(); } public function get_base_dir( $base = '.', $verbose = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' ); $this->verbose = $verbose; return $this->abspath(); } public function find_folder( $folder ) { if ( isset( $this->cache[ $folder ] ) ) { return $this->cache[ $folder ]; } if ( stripos( $this->method, 'ftp' ) !== false ) { $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR, 'FTP_LANG_DIR' => WP_LANG_DIR, ); foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; } if ( $folder === $dir ) { return trailingslashit( constant( $constant ) ); } } foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; } if ( 0 === stripos( $folder, $dir ) ) { $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); $potential_folder = trailingslashit( $potential_folder ); if ( $this->is_dir( $potential_folder ) ) { $this->cache[ $folder ] = $potential_folder; return $potential_folder; } } } } elseif ( 'direct' === $this->method ) { $folder = str_replace( '\\', '/', $folder ); return trailingslashit( $folder ); } $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); $folder = str_replace( '\\', '/', $folder ); if ( isset( $this->cache[ $folder ] ) ) { return $this->cache[ $folder ]; } if ( $this->exists( $folder ) ) { $folder = trailingslashit( $folder ); $this->cache[ $folder ] = $folder; return $folder; } $return = $this->search_for_folder( $folder ); if ( $return ) { $this->cache[ $folder ] = $return; } return $return; } public function search_for_folder( $folder, $base = '.', $loop = false ) { if ( empty( $base ) || '.' === $base ) { $base = trailingslashit( $this->cwd() ); } $folder = untrailingslashit( $folder ); if ( $this->verbose ) { printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "
            \n", $folder, $base ); } $folder_parts = explode( '/', $folder ); $folder_part_keys = array_keys( $folder_parts ); $last_index = array_pop( $folder_part_keys ); $last_path = $folder_parts[ $last_index ]; $files = $this->dirlist( $base ); foreach ( $folder_parts as $index => $key ) { if ( $index === $last_index ) { continue; } if ( isset( $files[ $key ] ) ) { $newdir = trailingslashit( path_join( $base, $key ) ); if ( $this->verbose ) { printf( "\n" . __( 'Changing to %s' ) . "
            \n", $newdir ); } $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); $ret = $this->search_for_folder( $newfolder, $newdir, $loop ); if ( $ret ) { return $ret; } } } if ( isset( $files[ $last_path ] ) ) { if ( $this->verbose ) { printf( "\n" . __( 'Found %s' ) . "
            \n", $base . $last_path ); } return trailingslashit( $base . $last_path ); } if ( $loop || '/' === $base ) { return false; } return $this->search_for_folder( $folder, '/', true ); } public function gethchmod( $file ) { $perms = intval( $this->getchmod( $file ), 8 ); if ( ( $perms & 0xC000 ) === 0xC000 ) { $info = 's'; } elseif ( ( $perms & 0xA000 ) === 0xA000 ) { $info = 'l'; } elseif ( ( $perms & 0x8000 ) === 0x8000 ) { $info = '-'; } elseif ( ( $perms & 0x6000 ) === 0x6000 ) { $info = 'b'; } elseif ( ( $perms & 0x4000 ) === 0x4000 ) { $info = 'd'; } elseif ( ( $perms & 0x2000 ) === 0x2000 ) { $info = 'c'; } elseif ( ( $perms & 0x1000 ) === 0x1000 ) { $info = 'p'; } else { $info = 'u'; } $info .= ( ( $perms & 0x0100 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0080 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0040 ) ? ( ( $perms & 0x0800 ) ? 's' : 'x' ) : ( ( $perms & 0x0800 ) ? 'S' : '-' ) ); $info .= ( ( $perms & 0x0020 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0010 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0008 ) ? ( ( $perms & 0x0400 ) ? 's' : 'x' ) : ( ( $perms & 0x0400 ) ? 'S' : '-' ) ); $info .= ( ( $perms & 0x0004 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0002 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0001 ) ? ( ( $perms & 0x0200 ) ? 't' : 'x' ) : ( ( $perms & 0x0200 ) ? 'T' : '-' ) ); return $info; } public function getchmod( $file ) { return '777'; } public function getnumchmodfromh( $mode ) { $realmode = ''; $legal = array( '', 'w', 'r', 'x', '-' ); $attarray = preg_split( '//', $mode ); for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { $key = array_search( $attarray[ $i ], $legal, true ); if ( $key ) { $realmode .= $legal[ $key ]; } } $mode = str_pad( $realmode, 10, '-', STR_PAD_LEFT ); $trans = array( '-' => '0', 'r' => '4', 'w' => '2', 'x' => '1', ); $mode = strtr( $mode, $trans ); $newmode = $mode[0]; $newmode .= $mode[1] + $mode[2] + $mode[3]; $newmode .= $mode[4] + $mode[5] + $mode[6]; $newmode .= $mode[7] + $mode[8] + $mode[9]; return $newmode; } public function is_binary( $text ) { return (bool) preg_match( '|[^\x20-\x7E]|', $text ); } public function chown( $file, $owner, $recursive = false ) { return false; } public function connect() { return true; } public function get_contents( $file ) { return false; } public function get_contents_array( $file ) { return false; } public function put_contents( $file, $contents, $mode = false ) { return false; } public function cwd() { return false; } public function chdir( $dir ) { return false; } public function chgrp( $file, $group, $recursive = false ) { return false; } public function chmod( $file, $mode = false, $recursive = false ) { return false; } public function owner( $file ) { return false; } public function group( $file ) { return false; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { return false; } public function move( $source, $destination, $overwrite = false ) { return false; } public function delete( $file, $recursive = false, $type = false ) { return false; } public function exists( $file ) { return false; } public function is_file( $file ) { return false; } public function is_dir( $path ) { return false; } public function is_readable( $file ) { return false; } public function is_writable( $file ) { return false; } public function atime( $file ) { return false; } public function mtime( $file ) { return false; } public function size( $file ) { return false; } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { return false; } public function rmdir( $path, $recursive = false ) { return false; } public function dirlist( $path, $include_hidden = true, $recursive = false ) { return false; } } no_update ) ) { foreach ( $plugin_info->no_update as $plugin ) { if ( isset( $plugin->slug ) ) { $plugin->upgrade = false; $plugins[ $plugin->slug ] = $plugin; } } } if ( isset( $plugin_info->response ) ) { foreach ( $plugin_info->response as $plugin ) { if ( isset( $plugin->slug ) ) { $plugin->upgrade = true; $plugins[ $plugin->slug ] = $plugin; } } } return $plugins; } protected function get_installed_plugin_slugs() { return array_keys( $this->get_installed_plugins() ); } public function prepare_items() { include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; global $tabs, $tab, $paged, $type, $term; wp_reset_vars( array( 'tab' ) ); $paged = $this->get_pagenum(); $per_page = 36; $tabs = array(); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); } $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); if ( current_user_can( 'upload_plugins' ) ) { $tabs['upload'] = __( 'Upload Plugin' ); } $nonmenu_tabs = array( 'plugin-information' ); $tabs = apply_filters( 'install_plugins_tabs', $tabs ); $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } $installed_plugins = $this->get_installed_plugins(); $args = array( 'page' => $paged, 'per_page' => $per_page, 'locale' => get_user_locale(), ); switch ( $tab ) { case 'search': $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; switch ( $type ) { case 'tag': $args['tag'] = sanitize_title_with_dashes( $term ); break; case 'term': $args['search'] = $term; break; case 'author': $args['author'] = $term; break; } break; case 'featured': case 'popular': case 'new': case 'beta': $args['browse'] = $tab; break; case 'recommended': $args['browse'] = $tab; $args['installed_plugins'] = array_keys( $installed_plugins ); break; case 'favorites': $action = 'save_wporg_username_' . get_current_user_id(); if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); if ( ! isset( $_GET['save'] ) || $_GET['save'] ) { update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); } } else { $user = get_user_option( 'wporg_favorites' ); } if ( $user ) { $args['user'] = $user; } else { $args = false; } add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 ); break; default: $args = false; break; } $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args ); if ( ! $args ) { return; } $api = plugins_api( 'query_plugins', $args ); if ( is_wp_error( $api ) ) { $this->error = $api; return; } $this->items = $api->plugins; if ( $this->orderby ) { uasort( $this->items, array( $this, 'order_callback' ) ); } $this->set_pagination_args( array( 'total_items' => $api->info['results'], 'per_page' => $args['per_page'], ) ); if ( isset( $api->info['groups'] ) ) { $this->groups = $api->info['groups']; } if ( $installed_plugins ) { $js_plugins = array_fill_keys( array( 'all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins' ), array() ); $js_plugins['all'] = array_values( wp_list_pluck( $installed_plugins, 'plugin' ) ); $upgrade_plugins = wp_filter_object_list( $installed_plugins, array( 'upgrade' => true ), 'and', 'plugin' ); if ( $upgrade_plugins ) { $js_plugins['upgrade'] = array_values( $upgrade_plugins ); } wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'plugins' => $js_plugins, 'totals' => wp_get_update_data(), ) ); } } public function no_items() { if ( isset( $this->error ) ) { ?> -

            error->get_error_message(); ?>

            -

            -
            - -
            - $text ) { $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; $href = self_admin_url( 'plugin-install.php?tab=' . $action ); $display_tabs[ 'plugin-install-' . $action ] = "$text"; } unset( $display_tabs['plugin-install-upload'] ); return $display_tabs; } public function views() { $views = $this->get_views(); $views = apply_filters( "views_{$this->screen->id}", $views ); $this->screen->render_screen_reader_content( 'heading_views' ); ?> -
            - - - -
            - _args['singular']; $data_attr = ''; if ( $singular ) { $data_attr = " data-wp-lists='list:$singular'"; } $this->display_tablenav( 'top' ); ?> -
            - screen->render_screen_reader_content( 'heading_list' ); ?> -
            > - display_rows_or_placeholder(); ?> -
            -
            - display_tablenav( 'bottom' ); } protected function display_tablenav( $which ) { if ( 'featured' === $GLOBALS['tab'] ) { return; } if ( 'top' === $which ) { wp_referer_field(); ?> -
            -
            - -
            - pagination( $which ); ?> -
            -
            - -
            - pagination( $which ); ?> -
            -
            - _args['plural'] ); } public function get_columns() { return array(); } private function order_callback( $plugin_a, $plugin_b ) { $orderby = $this->orderby; if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) { return 0; } $a = $plugin_a->$orderby; $b = $plugin_b->$orderby; if ( $a === $b ) { return 0; } if ( 'DESC' === $this->order ) { return ( $a < $b ) ? 1 : -1; } else { return ( $a < $b ) ? -1 : 1; } } public function display_rows() { $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array(), ); $plugins_group_titles = array( 'Performance' => _x( 'Performance', 'Plugin installer group title' ), 'Social' => _x( 'Social', 'Plugin installer group title' ), 'Tools' => _x( 'Tools', 'Plugin installer group title' ), ); $group = null; foreach ( (array) $this->items as $plugin ) { if ( is_object( $plugin ) ) { $plugin = (array) $plugin; } if ( isset( $plugin['group'] ) && $plugin['group'] !== $group ) { if ( isset( $this->groups[ $plugin['group'] ] ) ) { $group_name = $this->groups[ $plugin['group'] ]; if ( isset( $plugins_group_titles[ $group_name ] ) ) { $group_name = $plugins_group_titles[ $group_name ]; } } else { $group_name = $plugin['group']; } if ( ! empty( $group ) ) { echo ''; } echo '

            ' . esc_html( $group_name ) . '

            '; echo '
            '; $group = $plugin['group']; } $title = wp_kses( $plugin['name'], $plugins_allowedtags ); $description = strip_tags( $plugin['short_description'] ); $description = apply_filters( 'plugin_install_description', $description, $plugin ); $version = wp_kses( $plugin['version'], $plugins_allowedtags ); $name = strip_tags( $title . ' ' . $version ); $author = wp_kses( $plugin['author'], $plugins_allowedtags ); if ( ! empty( $author ) ) { $author = ' ' . sprintf( __( 'By %s' ), $author ) . ''; } $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); $action_links = array(); if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { $status = install_plugin_install_status( $plugin ); switch ( $status['status'] ) { case 'install': if ( $status['url'] ) { if ( $compatible_php && $compatible_wp ) { $action_links[] = sprintf( '%s', esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Install Now' ) ); } else { $action_links[] = sprintf( '', _x( 'Cannot Install', 'plugin' ) ); } } break; case 'update_available': if ( $status['url'] ) { if ( $compatible_php && $compatible_wp ) { $action_links[] = sprintf( '%s', esc_attr( $status['file'] ), esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), esc_attr( $name ), __( 'Update Now' ) ); } else { $action_links[] = sprintf( '', _x( 'Cannot Update', 'plugin' ) ); } } break; case 'latest_installed': case 'newer_installed': if ( is_plugin_active( $status['file'] ) ) { $action_links[] = sprintf( '', _x( 'Active', 'plugin' ) ); } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { if ( $compatible_php && $compatible_wp ) { $button_text = __( 'Activate' ); $button_label = _x( 'Activate %s', 'plugin' ); $activate_url = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 'action' => 'activate', 'plugin' => $status['file'], ), network_admin_url( 'plugins.php' ) ); if ( is_network_admin() ) { $button_text = __( 'Network Activate' ); $button_label = _x( 'Network Activate %s', 'plugin' ); $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); } $action_links[] = sprintf( '%3$s', esc_url( $activate_url ), esc_attr( sprintf( $button_label, $plugin['name'] ) ), $button_text ); } else { $action_links[] = sprintf( '', _x( 'Cannot Activate', 'plugin' ) ); } } else { $action_links[] = sprintf( '', _x( 'Installed', 'plugin' ) ); } break; } } $details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550' ); $action_links[] = sprintf( '%s', esc_url( $details_link ), esc_attr( sprintf( __( 'More information about %s' ), $name ) ), esc_attr( $name ), __( 'More Details' ) ); if ( ! empty( $plugin['icons']['svg'] ) ) { $plugin_icon_url = $plugin['icons']['svg']; } elseif ( ! empty( $plugin['icons']['2x'] ) ) { $plugin_icon_url = $plugin['icons']['2x']; } elseif ( ! empty( $plugin['icons']['1x'] ) ) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); $last_updated_timestamp = strtotime( $plugin['last_updated'] ); ?> -
            -

            '; if ( ! $compatible_php && ! $compatible_wp ) { _e( 'This plugin does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } } elseif ( ! $compatible_wp ) { _e( 'This plugin does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { _e( 'This plugin does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } } echo '

            '; } ?> -
            -
            -

            - - - - -

            -
            - -
            -

            -

            -
            -
            -
            -
            - $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'], ) ); ?> - -
            -
            - - -
            -
            - = 1000000 ) { $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); $active_installs_text = sprintf( _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), number_format_i18n( $active_installs_millions ) ); } elseif ( 0 === $plugin['active_installs'] ) { $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' ); } else { $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; } printf( __( '%s Active Installations' ), $active_installs_text ); ?> -
            -
            - ' . __( 'Untested with your version of WordPress' ) . ''; } elseif ( ! $compatible_wp ) { echo '' . __( 'Incompatible with your version of WordPress' ) . ''; } else { echo '' . __( 'Compatible with your version of WordPress' ) . ''; } ?> -
            -
            -
            -
            '; } } } $sub ) { foreach ( $sub as $index => $data ) { if ( ! current_user_can( $data[1] ) ) { unset( $submenu[ $parent ][ $index ] ); $_wp_submenu_nopriv[ $parent ][ $data[2] ] = true; } } unset( $index, $data ); if ( empty( $submenu[ $parent ] ) ) { unset( $submenu[ $parent ] ); } } unset( $sub, $parent ); foreach ( $menu as $id => $data ) { if ( empty( $submenu[ $data[2] ] ) ) { continue; } $subs = $submenu[ $data[2] ]; $first_sub = reset( $subs ); $old_parent = $data[2]; $new_parent = $first_sub[2]; if ( $new_parent != $old_parent ) { $_wp_real_parent_file[ $old_parent ] = $new_parent; $menu[ $id ][2] = $new_parent; foreach ( $submenu[ $old_parent ] as $index => $data ) { $submenu[ $new_parent ][ $index ] = $submenu[ $old_parent ][ $index ]; unset( $submenu[ $old_parent ][ $index ] ); } unset( $submenu[ $old_parent ], $index ); if ( isset( $_wp_submenu_nopriv[ $old_parent ] ) ) { $_wp_submenu_nopriv[ $new_parent ] = $_wp_submenu_nopriv[ $old_parent ]; } } } unset( $id, $data, $subs, $first_sub, $old_parent, $new_parent ); if ( is_network_admin() ) { do_action( 'network_admin_menu', '' ); } elseif ( is_user_admin() ) { do_action( 'user_admin_menu', '' ); } else { do_action( 'admin_menu', '' ); } foreach ( $menu as $id => $data ) { if ( ! current_user_can( $data[1] ) ) { $_wp_menu_nopriv[ $data[2] ] = true; } if ( ! empty( $submenu[ $data[2] ] ) && 1 === count( $submenu[ $data[2] ] ) ) { $subs = $submenu[ $data[2] ]; $first_sub = reset( $subs ); if ( $data[2] == $first_sub[2] ) { unset( $submenu[ $data[2] ] ); } } if ( empty( $submenu[ $data[2] ] ) ) { if ( isset( $_wp_menu_nopriv[ $data[2] ] ) ) { unset( $menu[ $id ] ); } } } unset( $id, $data, $subs, $first_sub ); function add_cssclass( $class_to_add, $classes ) { if ( empty( $classes ) ) { return $class_to_add; } return $classes . ' ' . $class_to_add; } function add_menu_classes( $menu ) { $first_item = false; $last_order = false; $items_count = count( $menu ); $i = 0; foreach ( $menu as $order => $top ) { $i++; if ( 0 == $order ) { $menu[0][4] = add_cssclass( 'menu-top-first', $top[4] ); $last_order = 0; continue; } if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { $first_item = true; $classes = $menu[ $last_order ][4]; $menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes ); continue; } if ( $first_item ) { $classes = $menu[ $order ][4]; $menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes ); $first_item = false; } if ( $i == $items_count ) { $classes = $menu[ $order ][4]; $menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes ); } $last_order = $order; } return apply_filters( 'add_menu_classes', $menu ); } uksort( $menu, 'strnatcasecmp' ); if ( apply_filters( 'custom_menu_order', false ) ) { $menu_order = array(); foreach ( $menu as $menu_item ) { $menu_order[] = $menu_item[2]; } unset( $menu_item ); $default_menu_order = $menu_order; $menu_order = apply_filters( 'menu_order', $menu_order ); $menu_order = array_flip( $menu_order ); $default_menu_order = array_flip( $default_menu_order ); function sort_menu( $a, $b ) { global $menu_order, $default_menu_order; $a = $a[2]; $b = $b[2]; if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) { return -1; } elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { return 1; } elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { if ( $menu_order[ $a ] == $menu_order[ $b ] ) { return 0; } return ( $menu_order[ $a ] < $menu_order[ $b ] ) ? -1 : 1; } else { return ( $default_menu_order[ $a ] <= $default_menu_order[ $b ] ) ? -1 : 1; } } usort( $menu, 'sort_menu' ); unset( $menu_order, $default_menu_order ); } $prev_menu_was_separator = false; foreach ( $menu as $id => $data ) { if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { $prev_menu_was_separator = false; } else { if ( true === $prev_menu_was_separator ) { unset( $menu[ $id ] ); } $prev_menu_was_separator = true; } } unset( $id, $data, $prev_menu_was_separator ); $last_menu_key = array_keys( $menu ); $last_menu_key = array_pop( $last_menu_key ); if ( ! empty( $menu ) && 'wp-menu-separator' === $menu[ $last_menu_key ][4] ) { unset( $menu[ $last_menu_key ] ); } unset( $last_menu_key ); if ( ! user_can_access_admin_page() ) { do_action( 'admin_page_access_denied' ); wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); } $menu = add_menu_classes( $menu ); $_GET['list_args']['screen']['id'] ) ); if ( ! $wp_list_table ) { wp_die( 0 ); } if ( ! $wp_list_table->ajax_user_can() ) { wp_die( -1 ); } $wp_list_table->ajax_response(); wp_die( 0 ); } function wp_ajax_ajax_tag_search() { if ( ! isset( $_GET['tax'] ) ) { wp_die( 0 ); } $taxonomy = sanitize_key( $_GET['tax'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! current_user_can( $tax->cap->assign_terms ) ) { wp_die( -1 ); } $s = wp_unslash( $_GET['q'] ); $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $s = str_replace( $comma, ',', $s ); } if ( false !== strpos( $s, ',' ) ) { $s = explode( ',', $s ); $s = $s[ count( $s ) - 1 ]; } $s = trim( $s ); $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s ); if ( ( 0 == $term_search_min_chars ) || ( strlen( $s ) < $term_search_min_chars ) ) { wp_die(); } $results = get_terms( array( 'taxonomy' => $taxonomy, 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false, 'number' => isset( $_GET['number'] ) ? (int) $_GET['number'] : 0, ) ); echo implode( "\n", $results ); wp_die(); } function wp_ajax_wp_compression_test() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( -1 ); } if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) { update_site_option( 'can_compress_scripts', 0 ); wp_die( 0 ); } if ( isset( $_GET['test'] ) ) { header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); header( 'Content-Type: application/javascript; charset=UTF-8' ); $force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ); $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; if ( 1 == $_GET['test'] ) { echo $test_str; wp_die(); } elseif ( 2 == $_GET['test'] ) { if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { wp_die( -1 ); } if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) { header( 'Content-Encoding: deflate' ); $out = gzdeflate( $test_str, 1 ); } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) { header( 'Content-Encoding: gzip' ); $out = gzencode( $test_str, 1 ); } else { wp_die( -1 ); } echo $out; wp_die(); } elseif ( 'no' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 0 ); } elseif ( 'yes' === $_GET['test'] ) { check_ajax_referer( 'update_can_compress_scripts' ); update_site_option( 'can_compress_scripts', 1 ); } } wp_die( 0 ); } function wp_ajax_imgedit_preview() { $post_id = (int) $_GET['postid']; if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$post_id" ); include_once ABSPATH . 'wp-admin/includes/image-edit.php'; if ( ! stream_preview_image( $post_id ) ) { wp_die( -1 ); } wp_die(); } function wp_ajax_oembed_cache() { $GLOBALS['wp_embed']->cache_oembed( $_GET['post'] ); wp_die( 0 ); } function wp_ajax_autocomplete_user() { if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) ) { wp_die( -1 ); } if ( ! current_user_can( 'manage_network_users' ) && ! apply_filters( 'autocomplete_users_for_site_admins', false ) ) { wp_die( -1 ); } $return = array(); if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) { $type = $_REQUEST['autocomplete_type']; } else { $type = 'add'; } if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) { $field = $_REQUEST['autocomplete_field']; } else { $field = 'user_login'; } if ( isset( $_REQUEST['site_id'] ) ) { $id = absint( $_REQUEST['site_id'] ); } else { $id = get_current_blog_id(); } $include_blog_users = ( 'search' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', ) ) : array() ); $exclude_blog_users = ( 'add' === $type ? get_users( array( 'blog_id' => $id, 'fields' => 'ID', ) ) : array() ); $users = get_users( array( 'blog_id' => false, 'search' => '*' . $_REQUEST['term'] . '*', 'include' => $include_blog_users, 'exclude' => $exclude_blog_users, 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), ) ); foreach ( $users as $user ) { $return[] = array( 'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result' ), $user->user_login, $user->user_email ), 'value' => $user->$field, ); } wp_die( wp_json_encode( $return ) ); } function wp_ajax_get_community_events() { require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php'; check_ajax_referer( 'community_events' ); $search = isset( $_POST['location'] ) ? wp_unslash( $_POST['location'] ) : ''; $timezone = isset( $_POST['timezone'] ) ? wp_unslash( $_POST['timezone'] ) : ''; $user_id = get_current_user_id(); $saved_location = get_user_option( 'community-events-location', $user_id ); $events_client = new WP_Community_Events( $user_id, $saved_location ); $events = $events_client->get_events( $search, $timezone ); $ip_changed = false; if ( is_wp_error( $events ) ) { wp_send_json_error( array( 'error' => $events->get_error_message(), ) ); } else { if ( empty( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) ) { $ip_changed = true; } elseif ( isset( $saved_location['ip'] ) && ! empty( $events['location']['ip'] ) && $saved_location['ip'] !== $events['location']['ip'] ) { $ip_changed = true; } if ( $ip_changed || $search ) { update_user_meta( $user_id, 'community-events-location', $events['location'] ); } wp_send_json_success( $events ); } } function wp_ajax_dashboard_widgets() { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; $pagenow = $_GET['pagenow']; if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) { set_current_screen( $pagenow ); } switch ( $_GET['widget'] ) { case 'dashboard_primary': wp_dashboard_primary(); break; } wp_die(); } function wp_ajax_logged_in() { wp_die( 1 ); } function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { $total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0; $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0; $page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0; $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; if ( ! $total || ! $per_page || ! $page || ! $url ) { $time = time(); $comment = get_comment( $comment_id ); $comment_status = ''; $comment_link = ''; if ( $comment ) { $comment_status = $comment->comment_approved; } if ( 1 === (int) $comment_status ) { $comment_link = get_comment_link( $comment ); } $counts = wp_count_comments(); $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $comment_id, 'supplemental' => array( 'status' => $comment_status, 'postId' => $comment ? $comment->comment_post_ID : '', 'time' => $time, 'in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf( _n( '%s Comment', '%s Comments', $counts->approved ), number_format_i18n( $counts->approved ) ), 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), 'comment_link' => $comment_link, ), ) ); $x->send(); } $total += $delta; if ( $total < 0 ) { $total = 0; } if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { $post_id = 0; $status = 'all'; $parsed = parse_url( $url ); if ( isset( $parsed['query'] ) ) { parse_str( $parsed['query'], $query_vars ); if ( ! empty( $query_vars['comment_status'] ) ) { $status = $query_vars['comment_status']; } if ( ! empty( $query_vars['p'] ) ) { $post_id = (int) $query_vars['p']; } if ( ! empty( $query_vars['comment_type'] ) ) { $type = $query_vars['comment_type']; } } if ( empty( $type ) ) { $comment_count = wp_count_comments( $post_id ); if ( isset( $comment_count->$status ) ) { $total = $comment_count->$status; } } } $time = time(); $comment = get_comment( $comment_id ); $counts = wp_count_comments(); $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $comment_id, 'supplemental' => array( 'status' => $comment ? $comment->comment_approved : '', 'postId' => $comment ? $comment->comment_post_ID : '', 'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ), 'total_pages' => ceil( $total / $per_page ), 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), 'total' => $total, 'time' => $time, 'in_moderation' => $counts->moderated, 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), ), ) ); $x->send(); } function _wp_ajax_add_hierarchical_term() { $action = $_POST['action']; $taxonomy = get_taxonomy( substr( $action, 4 ) ); check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name ); if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) { wp_die( -1 ); } $names = explode( ',', $_POST[ 'new' . $taxonomy->name ] ); $parent = isset( $_POST[ 'new' . $taxonomy->name . '_parent' ] ) ? (int) $_POST[ 'new' . $taxonomy->name . '_parent' ] : 0; if ( 0 > $parent ) { $parent = 0; } if ( 'category' === $taxonomy->name ) { $post_category = isset( $_POST['post_category'] ) ? (array) $_POST['post_category'] : array(); } else { $post_category = ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input'][ $taxonomy->name ] ) ) ? (array) $_POST['tax_input'][ $taxonomy->name ] : array(); } $checked_categories = array_map( 'absint', (array) $post_category ); $popular_ids = wp_popular_terms_checklist( $taxonomy->name, 0, 10, false ); foreach ( $names as $cat_name ) { $cat_name = trim( $cat_name ); $category_nicename = sanitize_title( $cat_name ); if ( '' === $category_nicename ) { continue; } $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); if ( ! $cat_id || is_wp_error( $cat_id ) ) { continue; } else { $cat_id = $cat_id['term_id']; } $checked_categories[] = $cat_id; if ( $parent ) { continue; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $cat_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } if ( $parent ) { $parent = get_term( $parent, $taxonomy->name ); $term_id = $parent->term_id; while ( $parent->parent ) { $parent = get_term( $parent->parent, $taxonomy->name ); if ( is_wp_error( $parent ) ) { break; } $term_id = $parent->term_id; } ob_start(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids, ) ); $data = ob_get_clean(); $add = array( 'what' => $taxonomy->name, 'id' => $term_id, 'data' => str_replace( array( "\n", "\t" ), '', $data ), 'position' => -1, ); } ob_start(); wp_dropdown_categories( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', ) ); $sup = ob_get_clean(); $add['supplemental'] = array( 'newcat_parent' => $sup ); $x = new WP_Ajax_Response( $add ); $x->send(); } function wp_ajax_delete_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; $comment = get_comment( $id ); if ( ! $comment ) { wp_die( time() ); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { wp_die( -1 ); } check_ajax_referer( "delete-comment_$id" ); $status = wp_get_comment_status( $comment ); $delta = -1; if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) { if ( 'trash' === $status ) { wp_die( time() ); } $r = wp_trash_comment( $comment ); } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) { if ( 'trash' !== $status ) { wp_die( time() ); } $r = wp_untrash_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { if ( 'spam' === $status ) { wp_die( time() ); } $r = wp_spam_comment( $comment ); } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) { if ( 'spam' !== $status ) { wp_die( time() ); } $r = wp_unspam_comment( $comment ); if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) { $delta = 1; } } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { $r = wp_delete_comment( $comment ); } else { wp_die( -1 ); } if ( $r ) { _wp_ajax_delete_comment_response( $comment->comment_ID, $delta ); } wp_die( 0 ); } function wp_ajax_delete_tag() { $tag_id = (int) $_POST['tag_ID']; check_ajax_referer( "delete-tag_$tag_id" ); if ( ! current_user_can( 'delete_term', $tag_id ) ) { wp_die( -1 ); } $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag'; $tag = get_term( $tag_id, $taxonomy ); if ( ! $tag || is_wp_error( $tag ) ) { wp_die( 1 ); } if ( wp_delete_term( $tag_id, $taxonomy ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_delete_link() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "delete-bookmark_$id" ); if ( ! current_user_can( 'manage_links' ) ) { wp_die( -1 ); } $link = get_bookmark( $id ); if ( ! $link || is_wp_error( $link ) ) { wp_die( 1 ); } if ( wp_delete_link( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_delete_meta() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "delete-meta_$id" ); $meta = get_metadata_by_mid( 'post', $id ); if ( ! $meta ) { wp_die( 1 ); } if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $meta->post_id, $meta->meta_key ) ) { wp_die( -1 ); } if ( delete_meta( $meta->meta_id ) ) { wp_die( 1 ); } wp_die( 0 ); } function wp_ajax_delete_post( $action ) { if ( empty( $action ) ) { $action = 'delete-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( wp_delete_post( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_trash_post( $action ) { if ( empty( $action ) ) { $action = 'trash-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( 'trash-post' === $action ) { $done = wp_trash_post( $id ); } else { $done = wp_untrash_post( $id ); } if ( $done ) { wp_die( 1 ); } wp_die( 0 ); } function wp_ajax_untrash_post( $action ) { if ( empty( $action ) ) { $action = 'untrash-post'; } wp_ajax_trash_post( $action ); } function wp_ajax_delete_page( $action ) { if ( empty( $action ) ) { $action = 'delete-page'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_page', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( wp_delete_post( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } function wp_ajax_dim_comment() { $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; $comment = get_comment( $id ); if ( ! $comment ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => new WP_Error( 'invalid_comment', sprintf( __( 'Comment %d does not exist' ), $id ) ), ) ); $x->send(); } if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) ) { wp_die( -1 ); } $current = wp_get_comment_status( $comment ); if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) { wp_die( time() ); } check_ajax_referer( "approve-comment_$id" ); if ( in_array( $current, array( 'unapproved', 'spam' ), true ) ) { $result = wp_set_comment_status( $comment, 'approve', true ); } else { $result = wp_set_comment_status( $comment, 'hold', true ); } if ( is_wp_error( $result ) ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $result, ) ); $x->send(); } _wp_ajax_delete_comment_response( $comment->comment_ID ); wp_die( 0 ); } function wp_ajax_add_link_category( $action ) { if ( empty( $action ) ) { $action = 'add-link-category'; } check_ajax_referer( $action ); $tax = get_taxonomy( 'link_category' ); if ( ! current_user_can( $tax->cap->manage_terms ) ) { wp_die( -1 ); } $names = explode( ',', wp_unslash( $_POST['newcat'] ) ); $x = new WP_Ajax_Response(); foreach ( $names as $cat_name ) { $cat_name = trim( $cat_name ); $slug = sanitize_title( $cat_name ); if ( '' === $slug ) { continue; } $cat_id = wp_insert_term( $cat_name, 'link_category' ); if ( ! $cat_id || is_wp_error( $cat_id ) ) { continue; } else { $cat_id = $cat_id['term_id']; } $cat_name = esc_html( $cat_name ); $x->add( array( 'what' => 'link-category', 'id' => $cat_id, 'data' => "", 'position' => -1, ) ); } $x->send(); } function wp_ajax_add_tag() { check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); $taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag'; $tax = get_taxonomy( $taxonomy ); if ( ! current_user_can( $tax->cap->edit_terms ) ) { wp_die( -1 ); } $x = new WP_Ajax_Response(); $tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); if ( $tag && ! is_wp_error( $tag ) ) { $tag = get_term( $tag['term_id'], $taxonomy ); } if ( ! $tag || is_wp_error( $tag ) ) { $message = __( 'An error has occurred. Please reload the page and try again.' ); $error_code = 'error'; if ( is_wp_error( $tag ) && $tag->get_error_message() ) { $message = $tag->get_error_message(); } if ( is_wp_error( $tag ) && $tag->get_error_code() ) { $error_code = $tag->get_error_code(); } $x->add( array( 'what' => 'taxonomy', 'data' => new WP_Error( $error_code, $message ), ) ); $x->send(); } $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) ); $level = 0; $noparents = ''; if ( is_taxonomy_hierarchical( $taxonomy ) ) { $level = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); ob_start(); $wp_list_table->single_row( $tag, $level ); $noparents = ob_get_clean(); } ob_start(); $wp_list_table->single_row( $tag ); $parents = ob_get_clean(); require ABSPATH . 'wp-admin/includes/edit-tag-messages.php'; $message = ''; if ( isset( $messages[ $tax->name ][1] ) ) { $message = $messages[ $tax->name ][1]; } elseif ( isset( $messages['_item'][1] ) ) { $message = $messages['_item'][1]; } $x->add( array( 'what' => 'taxonomy', 'data' => $message, 'supplemental' => array( 'parents' => $parents, 'noparents' => $noparents, 'notice' => $message, ), ) ); $x->add( array( 'what' => 'term', 'position' => $level, 'supplemental' => (array) $tag, ) ); $x->send(); } function wp_ajax_get_tagcloud() { if ( ! isset( $_POST['tax'] ) ) { wp_die( 0 ); } $taxonomy = sanitize_key( $_POST['tax'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! current_user_can( $tax->cap->assign_terms ) ) { wp_die( -1 ); } $tags = get_terms( array( 'taxonomy' => $taxonomy, 'number' => 45, 'orderby' => 'count', 'order' => 'DESC', ) ); if ( empty( $tags ) ) { wp_die( $tax->labels->not_found ); } if ( is_wp_error( $tags ) ) { wp_die( $tags->get_error_message() ); } foreach ( $tags as $key => $tag ) { $tags[ $key ]->link = '#'; $tags[ $key ]->id = $tag->term_id; } $return = wp_generate_tag_cloud( $tags, array( 'filter' => 0, 'format' => 'list', ) ); if ( empty( $return ) ) { wp_die( 0 ); } echo $return; wp_die(); } function wp_ajax_get_comments( $action ) { global $post_id; if ( empty( $action ) ) { $action = 'get-comments'; } check_ajax_referer( $action ); if ( empty( $post_id ) && ! empty( $_REQUEST['p'] ) ) { $id = absint( $_REQUEST['p'] ); if ( ! empty( $id ) ) { $post_id = $id; } } if ( empty( $post_id ) ) { wp_die( -1 ); } $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } $wp_list_table->prepare_items(); if ( ! $wp_list_table->has_items() ) { wp_die( 1 ); } $x = new WP_Ajax_Response(); ob_start(); foreach ( $wp_list_table->items as $comment ) { if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && 0 === $comment->comment_approved ) { continue; } get_comment( $comment ); $wp_list_table->single_row( $comment ); } $comment_list_item = ob_get_clean(); $x->add( array( 'what' => 'comments', 'data' => $comment_list_item, ) ); $x->send(); } function wp_ajax_replyto_comment( $action ) { if ( empty( $action ) ) { $action = 'replyto-comment'; } check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); $comment_post_ID = (int) $_POST['comment_post_ID']; $post = get_post( $comment_post_ID ); if ( ! $post ) { wp_die( -1 ); } if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) { wp_die( -1 ); } if ( empty( $post->post_status ) ) { wp_die( 1 ); } elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) { wp_die( __( 'You cannot reply to a comment on a draft post.' ) ); } $user = wp_get_current_user(); if ( $user->exists() ) { $user_ID = $user->ID; $comment_author = wp_slash( $user->display_name ); $comment_author_email = wp_slash( $user->user_email ); $comment_author_url = wp_slash( $user->user_url ); $comment_content = trim( $_POST['content'] ); $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment'; if ( current_user_can( 'unfiltered_html' ) ) { if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) { $_POST['_wp_unfiltered_html_comment'] = ''; } if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); kses_init_filters(); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); add_filter( 'pre_comment_content', 'wp_filter_kses' ); } } } else { wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) ); } if ( '' === $comment_content ) { wp_die( __( 'Please type your comment text.' ) ); } $comment_parent = 0; if ( isset( $_POST['comment_ID'] ) ) { $comment_parent = absint( $_POST['comment_ID'] ); } $comment_auto_approved = false; $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); if ( ! empty( $_POST['approve_parent'] ) ) { $parent = get_comment( $comment_parent ); if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_ID ) { if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { wp_die( -1 ); } if ( wp_set_comment_status( $parent, 'approve' ) ) { $comment_auto_approved = true; } } } $comment_id = wp_new_comment( $commentdata ); if ( is_wp_error( $comment_id ) ) { wp_die( $comment_id->get_error_message() ); } $comment = get_comment( $comment_id ); if ( ! $comment ) { wp_die( 1 ); } $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; ob_start(); if ( isset( $_REQUEST['mode'] ) && 'dashboard' === $_REQUEST['mode'] ) { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; _wp_dashboard_recent_comments_row( $comment ); } else { if ( isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); } $wp_list_table->single_row( $comment ); } $comment_list_item = ob_get_clean(); $response = array( 'what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position, ); $counts = wp_count_comments(); $response['supplemental'] = array( 'in_moderation' => $counts->moderated, 'i18n_comments_text' => sprintf( _n( '%s Comment', '%s Comments', $counts->approved ), number_format_i18n( $counts->approved ) ), 'i18n_moderation_text' => sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ), number_format_i18n( $counts->moderated ) ), ); if ( $comment_auto_approved ) { $response['supplemental']['parent_approved'] = $parent->comment_ID; $response['supplemental']['parent_post_id'] = $parent->comment_post_ID; } $x = new WP_Ajax_Response(); $x->add( $response ); $x->send(); } function wp_ajax_edit_comment() { check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); $comment_id = (int) $_POST['comment_ID']; if ( ! current_user_can( 'edit_comment', $comment_id ) ) { wp_die( -1 ); } if ( '' === $_POST['content'] ) { wp_die( __( 'Please type your comment text.' ) ); } if ( isset( $_POST['status'] ) ) { $_POST['comment_status'] = $_POST['status']; } $updated = edit_comment(); if ( is_wp_error( $updated ) ) { wp_die( $updated->get_error_message() ); } $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0; $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); $comment = get_comment( $comment_id ); if ( empty( $comment->comment_ID ) ) { wp_die( -1 ); } ob_start(); $wp_list_table->single_row( $comment ); $comment_list_item = ob_get_clean(); $x = new WP_Ajax_Response(); $x->add( array( 'what' => 'edit_comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position, ) ); $x->send(); } function wp_ajax_add_menu_item() { check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; $menu_items_data = array(); foreach ( (array) $_POST['menu-item'] as $menu_item_data ) { if ( ! empty( $menu_item_data['menu-item-type'] ) && 'custom' !== $menu_item_data['menu-item-type'] && ! empty( $menu_item_data['menu-item-object-id'] ) ) { switch ( $menu_item_data['menu-item-type'] ) { case 'post_type': $_object = get_post( $menu_item_data['menu-item-object-id'] ); break; case 'post_type_archive': $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); break; case 'taxonomy': $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); break; } $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); $_menu_item = reset( $_menu_items ); $menu_item_data['menu-item-description'] = $_menu_item->description; } $menu_items_data[] = $menu_item_data; } $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); if ( is_wp_error( $item_ids ) ) { wp_die( 0 ); } $menu_items = array(); foreach ( (array) $item_ids as $menu_item_id ) { $menu_obj = get_post( $menu_item_id ); if ( ! empty( $menu_obj->ID ) ) { $menu_obj = wp_setup_nav_menu_item( $menu_obj ); $menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title; $menu_obj->label = $menu_obj->title; $menu_items[] = $menu_obj; } } $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] ); if ( ! class_exists( $walker_class_name ) ) { wp_die( 0 ); } if ( ! empty( $menu_items ) ) { $args = array( 'after' => '', 'before' => '', 'link_after' => '', 'link_before' => '', 'walker' => new $walker_class_name, ); echo walk_nav_menu_tree( $menu_items, 0, (object) $args ); } wp_die(); } function wp_ajax_add_meta() { check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' ); $c = 0; $pid = (int) $_POST['post_id']; $post = get_post( $pid ); if ( isset( $_POST['metakeyselect'] ) || isset( $_POST['metakeyinput'] ) ) { if ( ! current_user_can( 'edit_post', $pid ) ) { wp_die( -1 ); } if ( isset( $_POST['metakeyselect'] ) && '#NONE#' === $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) { wp_die( 1 ); } if ( 'auto-draft' === $post->post_status ) { $post_data = array(); $post_data['action'] = 'draft'; $post_data['post_ID'] = $pid; $post_data['post_type'] = $post->post_type; $post_data['post_status'] = 'draft'; $now = time(); $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) ); $pid = edit_post( $post_data ); if ( $pid ) { if ( is_wp_error( $pid ) ) { $x = new WP_Ajax_Response( array( 'what' => 'meta', 'data' => $pid, ) ); $x->send(); } $mid = add_meta( $pid ); if ( ! $mid ) { wp_die( __( 'Please provide a custom field value.' ) ); } } else { wp_die( 0 ); } } else { $mid = add_meta( $pid ); if ( ! $mid ) { wp_die( __( 'Please provide a custom field value.' ) ); } } $meta = get_metadata_by_mid( 'post', $mid ); $pid = (int) $meta->post_id; $meta = get_object_vars( $meta ); $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'data' => _list_meta_row( $meta, $c ), 'position' => 1, 'supplemental' => array( 'postid' => $pid ), ) ); } else { $mid = (int) key( $_POST['meta'] ); $key = wp_unslash( $_POST['meta'][ $mid ]['key'] ); $value = wp_unslash( $_POST['meta'][ $mid ]['value'] ); if ( '' === trim( $key ) ) { wp_die( __( 'Please provide a custom field name.' ) ); } $meta = get_metadata_by_mid( 'post', $mid ); if ( ! $meta ) { wp_die( 0 ); } if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) || ! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) || ! current_user_can( 'edit_post_meta', $meta->post_id, $key ) ) { wp_die( -1 ); } if ( $meta->meta_value != $value || $meta->meta_key != $key ) { $u = update_metadata_by_mid( 'post', $mid, $value, $key ); if ( ! $u ) { wp_die( 0 ); } } $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'old_id' => $mid, 'data' => _list_meta_row( array( 'meta_key' => $key, 'meta_value' => $value, 'meta_id' => $mid, ), $c ), 'position' => 0, 'supplemental' => array( 'postid' => $meta->post_id ), ) ); } $x->send(); } function wp_ajax_add_user( $action ) { if ( empty( $action ) ) { $action = 'add-user'; } check_ajax_referer( $action ); if ( ! current_user_can( 'create_users' ) ) { wp_die( -1 ); } $user_id = edit_user(); if ( ! $user_id ) { wp_die( 0 ); } elseif ( is_wp_error( $user_id ) ) { $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, ) ); $x->send(); } $user_object = get_userdata( $user_id ); $wp_list_table = _get_list_table( 'WP_Users_List_Table' ); $role = current( $user_object->roles ); $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, 'data' => $wp_list_table->single_row( $user_object, '', $role ), 'supplemental' => array( 'show-link' => sprintf( __( 'User %s added' ), '' . $user_object->user_login . '' ), 'role' => $role, ), ) ); $x->send(); } function wp_ajax_closed_postboxes() { check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); $closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed'] ) : array(); $closed = array_filter( $closed ); $hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array(); $hidden = array_filter( $hidden ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } if ( is_array( $closed ) ) { update_user_meta( $user->ID, "closedpostboxes_$page", $closed ); } if ( is_array( $hidden ) ) { $hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) ); update_user_meta( $user->ID, "metaboxhidden_$page", $hidden ); } wp_die( 1 ); } function wp_ajax_hidden_columns() { check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } $hidden = ! empty( $_POST['hidden'] ) ? explode( ',', $_POST['hidden'] ) : array(); update_user_meta( $user->ID, "manage{$page}columnshidden", $hidden ); wp_die( 1 ); } function wp_ajax_update_welcome_panel() { check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 ); wp_die( 1 ); } function wp_ajax_menu_get_metabox() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; if ( isset( $_POST['item-type'] ) && 'post_type' === $_POST['item-type'] ) { $type = 'posttype'; $callback = 'wp_nav_menu_item_post_type_meta_box'; $items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); } elseif ( isset( $_POST['item-type'] ) && 'taxonomy' === $_POST['item-type'] ) { $type = 'taxonomy'; $callback = 'wp_nav_menu_item_taxonomy_meta_box'; $items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' ); } if ( ! empty( $_POST['item-object'] ) && isset( $items[ $_POST['item-object'] ] ) ) { $menus_meta_box_object = $items[ $_POST['item-object'] ]; $item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_object ); $box_args = array( 'id' => 'add-' . $item->name, 'title' => $item->labels->name, 'callback' => $callback, 'args' => $item, ); ob_start(); $callback( null, $box_args ); $markup = ob_get_clean(); echo wp_json_encode( array( 'replace-id' => $type . '-' . $item->name, 'markup' => $markup, ) ); } wp_die(); } function wp_ajax_wp_link_ajax() { check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' ); $args = array(); if ( isset( $_POST['search'] ) ) { $args['s'] = wp_unslash( $_POST['search'] ); } if ( isset( $_POST['term'] ) ) { $args['s'] = wp_unslash( $_POST['term'] ); } $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } $results = _WP_Editors::wp_link_query( $args ); if ( ! isset( $results ) ) { wp_die( 0 ); } echo wp_json_encode( $results ); echo "\n"; wp_die(); } function wp_ajax_menu_locations_save() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( ! isset( $_POST['menu-locations'] ) ) { wp_die( 0 ); } set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) ); wp_die( 1 ); } function wp_ajax_meta_box_order() { check_ajax_referer( 'meta-box-order' ); $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; if ( 'auto' !== $page_columns ) { $page_columns = (int) $page_columns; } $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( sanitize_key( $page ) != $page ) { wp_die( 0 ); } $user = wp_get_current_user(); if ( ! $user ) { wp_die( -1 ); } if ( $order ) { update_user_meta( $user->ID, "meta-box-order_$page", $order ); } if ( $page_columns ) { update_user_meta( $user->ID, "screen_layout_$page", $page_columns ); } wp_send_json_success(); } function wp_ajax_menu_quick_search() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; _wp_ajax_menu_quick_search( $_POST ); wp_die(); } function wp_ajax_get_permalink() { check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; wp_die( get_preview_post_link( $post_id ) ); } function wp_ajax_sample_permalink() { check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0; $title = isset( $_POST['new_title'] ) ? $_POST['new_title'] : ''; $slug = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null; wp_die( get_sample_permalink_html( $post_id, $title, $slug ) ); } function wp_ajax_inline_save() { global $mode; check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) { wp_die(); } $post_ID = (int) $_POST['post_ID']; if ( 'page' === $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this page.' ) ); } } else { if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } } $last = wp_check_post_lock( $post_ID ); if ( $last ) { $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); $msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); if ( 'page' === $_POST['post_type'] ) { $msg_template = __( 'Saving is disabled: %s is currently editing this page.' ); } printf( $msg_template, esc_html( $last_user_name ) ); wp_die(); } $data = &$_POST; $post = get_post( $post_ID, ARRAY_A ); $post = wp_slash( $post ); $data['content'] = $post['post_content']; $data['excerpt'] = $post['post_excerpt']; $data['user_ID'] = get_current_user_id(); if ( isset( $data['post_parent'] ) ) { $data['parent_id'] = $data['post_parent']; } if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) { $data['visibility'] = 'private'; $data['post_status'] = 'private'; } else { $data['post_status'] = $data['_status']; } if ( empty( $data['comment_status'] ) ) { $data['comment_status'] = 'closed'; } if ( empty( $data['ping_status'] ) ) { $data['ping_status'] = 'closed'; } if ( ! empty( $data['tax_input'] ) ) { foreach ( $data['tax_input'] as $taxonomy => $terms ) { $tax_object = get_taxonomy( $taxonomy ); if ( ! apply_filters( 'quick_edit_show_taxonomy', $tax_object->show_in_quick_edit, $taxonomy, $post['post_type'] ) ) { unset( $data['tax_input'][ $taxonomy ] ); } } } if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) { $post['post_status'] = 'publish'; $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] ); } edit_post(); $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) ); $mode = 'excerpt' === $_POST['post_view'] ? 'excerpt' : 'list'; $level = 0; if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) { $request_post = array( get_post( $_POST['post_ID'] ) ); $parent = $request_post[0]->post_parent; while ( $parent > 0 ) { $parent_post = get_post( $parent ); $parent = $parent_post->post_parent; $level++; } } $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level ); wp_die(); } function wp_ajax_inline_save_tax() { check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); $taxonomy = sanitize_key( $_POST['taxonomy'] ); $tax = get_taxonomy( $taxonomy ); if ( ! $tax ) { wp_die( 0 ); } if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) { wp_die( -1 ); } $id = (int) $_POST['tax_ID']; if ( ! current_user_can( 'edit_term', $id ) ) { wp_die( -1 ); } $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) ); $tag = get_term( $id, $taxonomy ); $_POST['description'] = $tag->description; $updated = wp_update_term( $id, $taxonomy, $_POST ); if ( $updated && ! is_wp_error( $updated ) ) { $tag = get_term( $updated['term_id'], $taxonomy ); if ( ! $tag || is_wp_error( $tag ) ) { if ( is_wp_error( $tag ) && $tag->get_error_message() ) { wp_die( $tag->get_error_message() ); } wp_die( __( 'Item not updated.' ) ); } } else { if ( is_wp_error( $updated ) && $updated->get_error_message() ) { wp_die( $updated->get_error_message() ); } wp_die( __( 'Item not updated.' ) ); } $level = 0; $parent = $tag->parent; while ( $parent > 0 ) { $parent_tag = get_term( $parent, $taxonomy ); $parent = $parent_tag->parent; $level++; } $wp_list_table->single_row( $tag, $level ); wp_die(); } function wp_ajax_find_posts() { check_ajax_referer( 'find-posts' ); $post_types = get_post_types( array( 'public' => true ), 'objects' ); unset( $post_types['attachment'] ); $s = wp_unslash( $_POST['ps'] ); $args = array( 'post_type' => array_keys( $post_types ), 'post_status' => 'any', 'posts_per_page' => 50, ); if ( '' !== $s ) { $args['s'] = $s; } $posts = get_posts( $args ); if ( ! $posts ) { wp_send_json_error( __( 'No items found.' ) ); } $html = ''; $alt = ''; foreach ( $posts as $post ) { $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' ); $alt = ( 'alternate' === $alt ) ? '' : 'alternate'; switch ( $post->post_status ) { case 'publish': case 'private': $stat = __( 'Published' ); break; case 'future': $stat = __( 'Scheduled' ); break; case 'pending': $stat = __( 'Pending Review' ); break; case 'draft': $stat = __( 'Draft' ); break; } if ( '0000-00-00 00:00:00' === $post->post_date ) { $time = ''; } else { $time = mysql2date( __( 'Y/m/d' ), $post->post_date ); } $html .= ''; $html .= '' . "\n\n"; } $html .= '

            ' . __( 'Title' ) . '' . __( 'Type' ) . '' . __( 'Date' ) . '' . __( 'Status' ) . '
            ' . esc_html( $post_types[ $post->post_type ]->labels->singular_name ) . '' . esc_html( $time ) . '' . esc_html( $stat ) . '
            '; wp_send_json_success( $html ); } function wp_ajax_widgets_order() { check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } unset( $_POST['savewidgets'], $_POST['action'] ); if ( is_array( $_POST['sidebars'] ) ) { $sidebars = array(); foreach ( wp_unslash( $_POST['sidebars'] ) as $key => $val ) { $sb = array(); if ( ! empty( $val ) ) { $val = explode( ',', $val ); foreach ( $val as $k => $v ) { if ( strpos( $v, 'widget-' ) === false ) { continue; } $sb[ $k ] = substr( $v, strpos( $v, '_' ) + 1 ); } } $sidebars[ $key ] = $sb; } wp_set_sidebars_widgets( $sidebars ); wp_die( 1 ); } wp_die( -1 ); } function wp_ajax_save_widget() { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['id_base'] ) ) { wp_die( -1 ); } unset( $_POST['savewidgets'], $_POST['action'] ); do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); $id_base = wp_unslash( $_POST['id_base'] ); $widget_id = wp_unslash( $_POST['widget-id'] ); $sidebar_id = $_POST['sidebar']; $multi_number = ! empty( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : 0; $settings = isset( $_POST[ 'widget-' . $id_base ] ) && is_array( $_POST[ 'widget-' . $id_base ] ) ? $_POST[ 'widget-' . $id_base ] : false; $error = '

            ' . __( 'An error has occurred. Please reload the page and try again.' ) . '

            '; $sidebars = wp_get_sidebars_widgets(); $sidebar = isset( $sidebars[ $sidebar_id ] ) ? $sidebars[ $sidebar_id ] : array(); if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { wp_die( $error ); } $sidebar = array_diff( $sidebar, array( $widget_id ) ); $_POST = array( 'sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1', ); do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base ); } elseif ( $settings && preg_match( '/__i__|%i%/', key( $settings ) ) ) { if ( ! $multi_number ) { wp_die( $error ); } $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) ); $widget_id = $id_base . '-' . $multi_number; $sidebar[] = $widget_id; } $_POST['widget-id'] = $sidebar; foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name == $id_base ) { if ( ! is_callable( $control['callback'] ) ) { continue; } ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { $sidebars[ $sidebar_id ] = $sidebar; wp_set_sidebars_widgets( $sidebars ); echo "deleted:$widget_id"; wp_die(); } if ( ! empty( $_POST['add_new'] ) ) { wp_die(); } $form = $wp_registered_widget_controls[ $widget_id ]; if ( $form ) { call_user_func_array( $form['callback'], $form['params'] ); } wp_die(); } function wp_ajax_update_widget() { global $wp_customize; $wp_customize->widgets->wp_ajax_update_widget(); } function wp_ajax_delete_inactive_widgets() { check_ajax_referer( 'remove-inactive-widgets', 'removeinactivewidgets' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } unset( $_POST['removeinactivewidgets'], $_POST['action'] ); do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); $sidebars_widgets = wp_get_sidebars_widgets(); foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) { $pieces = explode( '-', $widget_id ); $multi_number = array_pop( $pieces ); $id_base = implode( '-', $pieces ); $widget = get_option( 'widget_' . $id_base ); unset( $widget[ $multi_number ] ); update_option( 'widget_' . $id_base, $widget ); unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] ); } wp_set_sidebars_widgets( $sidebars_widgets ); wp_die(); } function wp_ajax_media_create_image_subsizes() { check_ajax_referer( 'media-form' ); if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error( array( 'message' => __( 'Sorry, you are not allowed to upload files.' ) ) ); } if ( empty( $_POST['attachment_id'] ) ) { wp_send_json_error( array( 'message' => __( 'Upload failed. Please reload and try again.' ) ) ); } $attachment_id = (int) $_POST['attachment_id']; if ( ! empty( $_POST['_wp_upload_failed_cleanup'] ) ) { if ( wp_attachment_is_image( $attachment_id ) && current_user_can( 'delete_post', $attachment_id ) ) { $attachment = get_post( $attachment_id ); if ( $attachment && ( time() - strtotime( $attachment->post_date_gmt ) < 600 ) ) { wp_delete_attachment( $attachment_id, true ); wp_send_json_success(); } } } if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } wp_update_image_subsizes( $attachment_id ); if ( ! empty( $_POST['_legacy_support'] ) ) { $response = array( 'id' => $attachment_id ); } else { $response = wp_prepare_attachment_for_js( $attachment_id ); if ( ! $response ) { wp_send_json_error( array( 'message' => __( 'Upload failed.' ) ) ); } } wp_send_json_success( $response ); } function wp_ajax_upload_attachment() { check_ajax_referer( 'media-form' ); if ( ! current_user_can( 'upload_files' ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'Sorry, you are not allowed to upload files.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } if ( isset( $_REQUEST['post_id'] ) ) { $post_id = $_REQUEST['post_id']; if ( ! current_user_can( 'edit_post', $post_id ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'Sorry, you are not allowed to attach files to this post.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } } else { $post_id = null; } $post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array(); if ( is_wp_error( $post_data ) ) { wp_die( $post_data->get_error_message() ); } if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) { $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => __( 'The uploaded file is not a valid image. Please try again.' ), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } } $attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data ); if ( is_wp_error( $attachment_id ) ) { echo wp_json_encode( array( 'success' => false, 'data' => array( 'message' => $attachment_id->get_error_message(), 'filename' => esc_html( $_FILES['async-upload']['name'] ), ), ) ); wp_die(); } if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) { if ( 'custom-background' === $post_data['context'] ) { update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] ); } if ( 'custom-header' === $post_data['context'] ) { update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] ); } } $attachment = wp_prepare_attachment_for_js( $attachment_id ); if ( ! $attachment ) { wp_die(); } echo wp_json_encode( array( 'success' => true, 'data' => $attachment, ) ); wp_die(); } function wp_ajax_image_editor() { $attachment_id = (int) $_POST['postid']; if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_die( -1 ); } check_ajax_referer( "image_editor-$attachment_id" ); include_once ABSPATH . 'wp-admin/includes/image-edit.php'; $msg = false; switch ( $_POST['do'] ) { case 'save': $msg = wp_save_image( $attachment_id ); if ( ! empty( $msg->error ) ) { wp_send_json_error( $msg ); } wp_send_json_success( $msg ); break; case 'scale': $msg = wp_save_image( $attachment_id ); break; case 'restore': $msg = wp_restore_image( $attachment_id ); break; } ob_start(); wp_image_editor( $attachment_id, $msg ); $html = ob_get_clean(); if ( ! empty( $msg->error ) ) { wp_send_json_error( array( 'message' => $msg, 'html' => $html, ) ); } wp_send_json_success( array( 'message' => $msg, 'html' => $html, ) ); } function wp_ajax_set_post_thumbnail() { $json = ! empty( $_REQUEST['json'] ); $post_ID = (int) $_POST['post_id']; if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( -1 ); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( $json ) { check_ajax_referer( "update-post_$post_ID" ); } else { check_ajax_referer( "set_post_thumbnail-$post_ID" ); } if ( '-1' == $thumbnail_id ) { if ( delete_post_thumbnail( $post_ID ) ) { $return = _wp_post_thumbnail_html( null, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); } else { wp_die( 0 ); } } if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) { $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); } wp_die( 0 ); } function wp_ajax_get_post_thumbnail_html() { $post_ID = (int) $_POST['post_id']; check_ajax_referer( "update-post_$post_ID" ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( -1 ); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( -1 === $thumbnail_id ) { $thumbnail_id = null; } $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID ); wp_send_json_success( $return ); } function wp_ajax_set_attachment_thumbnail() { if ( empty( $_POST['urls'] ) || ! is_array( $_POST['urls'] ) ) { wp_send_json_error(); } $thumbnail_id = (int) $_POST['thumbnail_id']; if ( empty( $thumbnail_id ) ) { wp_send_json_error(); } $post_ids = array(); foreach ( $_POST['urls'] as $url ) { $post_id = attachment_url_to_postid( $url ); if ( ! empty( $post_id ) ) { $post_ids[] = $post_id; } } if ( empty( $post_ids ) ) { wp_send_json_error(); } $success = 0; foreach ( $post_ids as $post_id ) { if ( ! current_user_can( 'edit_post', $post_id ) ) { continue; } if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) { $success++; } } if ( 0 === $success ) { wp_send_json_error(); } else { wp_send_json_success(); } wp_send_json_error(); } function wp_ajax_date_format() { wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) ); } function wp_ajax_time_format() { wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) ); } function wp_ajax_wp_fullscreen_save_post() { $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; $post = null; if ( $post_id ) { $post = get_post( $post_id ); } check_ajax_referer( 'update-post_' . $post_id, '_wpnonce' ); $post_id = edit_post(); if ( is_wp_error( $post_id ) ) { wp_send_json_error(); } if ( $post ) { $last_date = mysql2date( __( 'F j, Y' ), $post->post_modified ); $last_time = mysql2date( __( 'g:i a' ), $post->post_modified ); } else { $last_date = date_i18n( __( 'F j, Y' ) ); $last_time = date_i18n( __( 'g:i a' ) ); } $last_id = get_post_meta( $post_id, '_edit_last', true ); if ( $last_id ) { $last_user = get_userdata( $last_id ); $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time ); } else { $last_edited = sprintf( __( 'Last edited on %1$s at %2$s' ), $last_date, $last_time ); } wp_send_json_success( array( 'last_edited' => $last_edited ) ); } function wp_ajax_wp_remove_post_lock() { if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) ) { wp_die( 0 ); } $post_id = (int) $_POST['post_ID']; $post = get_post( $post_id ); if ( ! $post ) { wp_die( 0 ); } check_ajax_referer( 'update-post_' . $post_id ); if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) ); if ( get_current_user_id() != $active_lock[1] ) { wp_die( 0 ); } $new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1]; update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) ); wp_die( 1 ); } function wp_ajax_dismiss_wp_pointer() { $pointer = $_POST['pointer']; if ( sanitize_key( $pointer ) != $pointer ) { wp_die( 0 ); } $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); if ( in_array( $pointer, $dismissed, true ) ) { wp_die( 0 ); } $dismissed[] = $pointer; $dismissed = implode( ',', $dismissed ); update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); wp_die( 1 ); } function wp_ajax_get_attachment() { if ( ! isset( $_REQUEST['id'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } $post = get_post( $id ); if ( ! $post ) { wp_send_json_error(); } if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error(); } $attachment = wp_prepare_attachment_for_js( $id ); if ( ! $attachment ) { wp_send_json_error(); } wp_send_json_success( $attachment ); } function wp_ajax_query_attachments() { if ( ! current_user_can( 'upload_files' ) ) { wp_send_json_error(); } $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); $keys = array( 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type', 'post_parent', 'author', 'post__in', 'post__not_in', 'year', 'monthnum', ); foreach ( get_taxonomies_for_attachments( 'objects' ) as $t ) { if ( $t->query_var && isset( $query[ $t->query_var ] ) ) { $keys[] = $t->query_var; } } $query = array_intersect_key( $query, array_flip( $keys ) ); $query['post_type'] = 'attachment'; if ( MEDIA_TRASH && ! empty( $_REQUEST['query']['post_status'] ) && 'trash' === $_REQUEST['query']['post_status'] ) { $query['post_status'] = 'trash'; } else { $query['post_status'] = 'inherit'; } if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) ) { $query['post_status'] .= ',private'; } if ( isset( $query['s'] ) ) { add_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); } $query = apply_filters( 'ajax_query_attachments_args', $query ); $attachments_query = new WP_Query( $query ); $posts = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts ); $posts = array_filter( $posts ); $total_posts = $attachments_query->found_posts; if ( $total_posts < 1 ) { unset( $query['paged'] ); $count_query = new WP_Query(); $count_query->query( $query ); $total_posts = $count_query->found_posts; } $posts_per_page = (int) $attachments_query->get( 'posts_per_page' ); $max_pages = $posts_per_page ? ceil( $total_posts / $posts_per_page ) : 0; header( 'X-WP-Total: ' . (int) $total_posts ); header( 'X-WP-TotalPages: ' . (int) $max_pages ); wp_send_json_success( $posts ); } function wp_ajax_save_attachment() { if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } check_ajax_referer( 'update-post_' . $id, 'nonce' ); if ( ! current_user_can( 'edit_post', $id ) ) { wp_send_json_error(); } $changes = $_REQUEST['changes']; $post = get_post( $id, ARRAY_A ); if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } if ( isset( $changes['parent'] ) ) { $post['post_parent'] = $changes['parent']; } if ( isset( $changes['title'] ) ) { $post['post_title'] = $changes['title']; } if ( isset( $changes['caption'] ) ) { $post['post_excerpt'] = $changes['caption']; } if ( isset( $changes['description'] ) ) { $post['post_content'] = $changes['description']; } if ( MEDIA_TRASH && isset( $changes['status'] ) ) { $post['post_status'] = $changes['status']; } if ( isset( $changes['alt'] ) ) { $alt = wp_unslash( $changes['alt'] ); if ( get_post_meta( $id, '_wp_attachment_image_alt', true ) !== $alt ) { $alt = wp_strip_all_tags( $alt, true ); update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); } } if ( wp_attachment_is( 'audio', $post['ID'] ) ) { $changed = false; $id3data = wp_get_attachment_metadata( $post['ID'] ); if ( ! is_array( $id3data ) ) { $changed = true; $id3data = array(); } foreach ( wp_get_attachment_id3_keys( (object) $post, 'edit' ) as $key => $label ) { if ( isset( $changes[ $key ] ) ) { $changed = true; $id3data[ $key ] = sanitize_text_field( wp_unslash( $changes[ $key ] ) ); } } if ( $changed ) { wp_update_attachment_metadata( $id, $id3data ); } } if ( MEDIA_TRASH && isset( $changes['status'] ) && 'trash' === $changes['status'] ) { wp_delete_post( $id ); } else { wp_update_post( $post ); } wp_send_json_success(); } function wp_ajax_save_attachment_compat() { if ( ! isset( $_REQUEST['id'] ) ) { wp_send_json_error(); } $id = absint( $_REQUEST['id'] ); if ( ! $id ) { wp_send_json_error(); } if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) ) { wp_send_json_error(); } $attachment_data = $_REQUEST['attachments'][ $id ]; check_ajax_referer( 'update-post_' . $id, 'nonce' ); if ( ! current_user_can( 'edit_post', $id ) ) { wp_send_json_error(); } $post = get_post( $id, ARRAY_A ); if ( 'attachment' !== $post['post_type'] ) { wp_send_json_error(); } $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data ); if ( isset( $post['errors'] ) ) { $errors = $post['errors']; unset( $post['errors'] ); } wp_update_post( $post ); foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { if ( isset( $attachment_data[ $taxonomy ] ) ) { wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false ); } } $attachment = wp_prepare_attachment_for_js( $id ); if ( ! $attachment ) { wp_send_json_error(); } wp_send_json_success( $attachment ); } function wp_ajax_save_attachment_order() { if ( ! isset( $_REQUEST['post_id'] ) ) { wp_send_json_error(); } $post_id = absint( $_REQUEST['post_id'] ); if ( ! $post_id ) { wp_send_json_error(); } if ( empty( $_REQUEST['attachments'] ) ) { wp_send_json_error(); } check_ajax_referer( 'update-post_' . $post_id, 'nonce' ); $attachments = $_REQUEST['attachments']; if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_send_json_error(); } foreach ( $attachments as $attachment_id => $menu_order ) { if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } $attachment = get_post( $attachment_id ); if ( ! $attachment ) { continue; } if ( 'attachment' !== $attachment->post_type ) { continue; } wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order, ) ); } wp_send_json_success(); } function wp_ajax_send_attachment_to_editor() { check_ajax_referer( 'media-send-to-editor', 'nonce' ); $attachment = wp_unslash( $_POST['attachment'] ); $id = (int) $attachment['id']; $post = get_post( $id ); if ( ! $post ) { wp_send_json_error(); } if ( 'attachment' !== $post->post_type ) { wp_send_json_error(); } if ( current_user_can( 'edit_post', $id ) ) { $insert_into_post_id = (int) $_POST['post_id']; if ( 0 == $post->post_parent && $insert_into_post_id ) { wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id, ) ); } } $url = empty( $attachment['url'] ) ? '' : $attachment['url']; $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) == $url ); remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : ''; if ( '' === trim( $caption ) ) { $caption = ''; } $title = ''; $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt ); } elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post ) ) { $html = stripslashes_deep( $_POST['html'] ); } else { $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; $rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; if ( ! empty( $url ) ) { $html = '' . $html . ''; } } $html = apply_filters( 'media_send_to_editor', $html, $id, $attachment ); wp_send_json_success( $html ); } function wp_ajax_send_link_to_editor() { global $post, $wp_embed; check_ajax_referer( 'media-send-to-editor', 'nonce' ); $src = wp_unslash( $_POST['src'] ); if ( ! $src ) { wp_send_json_error(); } if ( ! strpos( $src, '://' ) ) { $src = 'http://' . $src; } $src = esc_url_raw( $src ); if ( ! $src ) { wp_send_json_error(); } $link_text = trim( wp_unslash( $_POST['link_text'] ) ); if ( ! $link_text ) { $link_text = wp_basename( $src ); } $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 ); $check_embed = $wp_embed->run_shortcode( '[embed]' . $src . '[/embed]' ); $fallback = $wp_embed->maybe_make_link( $src ); if ( $check_embed !== $fallback ) { $html = '[embed]' . $src . '[/embed]'; } elseif ( $link_text ) { $html = '' . $link_text . ''; } else { $html = ''; } $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } $html = apply_filters( "{$type}_send_to_editor_url", $html, $src, $link_text ); wp_send_json_success( $html ); } function wp_ajax_heartbeat() { if ( empty( $_POST['_nonce'] ) ) { wp_send_json_error(); } $response = array(); $data = array(); $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); if ( ! empty( $_POST['screen_id'] ) ) { $screen_id = sanitize_key( $_POST['screen_id'] ); } else { $screen_id = 'front'; } if ( ! empty( $_POST['data'] ) ) { $data = wp_unslash( (array) $_POST['data'] ); } if ( 1 !== $nonce_state ) { $response = apply_filters( 'wp_refresh_nonces', $response, $data, $screen_id ); if ( false === $nonce_state ) { $response['nonces_expired'] = true; wp_send_json( $response ); } } if ( ! empty( $data ) ) { $response = apply_filters( 'heartbeat_received', $response, $data, $screen_id ); } $response = apply_filters( 'heartbeat_send', $response, $screen_id ); do_action( 'heartbeat_tick', $response, $screen_id ); $response['server_time'] = time(); wp_send_json( $response ); } function wp_ajax_get_revision_diffs() { require ABSPATH . 'wp-admin/includes/revision.php'; $post = get_post( (int) $_REQUEST['post_id'] ); if ( ! $post ) { wp_send_json_error(); } if ( ! current_user_can( 'edit_post', $post->ID ) ) { wp_send_json_error(); } $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ); if ( ! $revisions ) { wp_send_json_error(); } $return = array(); set_time_limit( 0 ); foreach ( $_REQUEST['compare'] as $compare_key ) { list( $compare_from, $compare_to ) = explode( ':', $compare_key ); $return[] = array( 'id' => $compare_key, 'fields' => wp_get_revision_ui_diff( $post, $compare_from, $compare_to ), ); } wp_send_json_success( $return ); } function wp_ajax_save_user_color_scheme() { global $_wp_admin_css_colors; check_ajax_referer( 'save-color-scheme', 'nonce' ); $color_scheme = sanitize_key( $_POST['color_scheme'] ); if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) { wp_send_json_error(); } $previous_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true ); update_user_meta( get_current_user_id(), 'admin_color', $color_scheme ); wp_send_json_success( array( 'previousScheme' => 'admin-color-' . $previous_color_scheme, 'currentScheme' => 'admin-color-' . $color_scheme, ) ); } function wp_ajax_query_themes() { global $themes_allowedtags, $theme_field_defaults; if ( ! current_user_can( 'install_themes' ) ) { wp_send_json_error(); } $args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array( 'per_page' => 20, 'fields' => array_merge( (array) $theme_field_defaults, array( 'reviews_url' => true, ) ), ) ); if ( isset( $args['browse'] ) && 'favorites' === $args['browse'] && ! isset( $args['user'] ) ) { $user = get_user_option( 'wporg_favorites' ); if ( $user ) { $args['user'] = $user; } } $old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search'; $args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args ); $api = themes_api( 'query_themes', $args ); if ( is_wp_error( $api ) ) { wp_send_json_error(); } $update_php = network_admin_url( 'update.php?action=install-theme' ); $installed_themes = search_theme_directories(); if ( false === $installed_themes ) { $installed_themes = array(); } foreach ( $installed_themes as $theme_slug => $theme_data ) { if ( str_contains( $theme_slug, '/' ) ) { unset( $installed_themes[ $theme_slug ] ); } } foreach ( $api->themes as &$theme ) { $theme->install_url = add_query_arg( array( 'theme' => $theme->slug, '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), ), $update_php ); if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $theme->activate_url = add_query_arg( array( 'action' => 'enable', '_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ), 'theme' => $theme->slug, ), network_admin_url( 'themes.php' ) ); } else { $theme->activate_url = add_query_arg( array( 'action' => 'activate', '_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ), 'stylesheet' => $theme->slug, ), admin_url( 'themes.php' ) ); } } $is_theme_installed = array_key_exists( $theme->slug, $installed_themes ); $theme->block_theme = $is_theme_installed && wp_get_theme( $theme->slug )->is_block_theme(); if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $customize_url = $theme->block_theme ? admin_url( 'site-editor.php' ) : wp_customize_url( $theme->slug ); $theme->customize_url = add_query_arg( array( 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ), ), $customize_url ); } $theme->name = wp_kses( $theme->name, $themes_allowedtags ); $theme->author = wp_kses( $theme->author['display_name'], $themes_allowedtags ); $theme->version = wp_kses( $theme->version, $themes_allowedtags ); $theme->description = wp_kses( $theme->description, $themes_allowedtags ); $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false, ) ); $theme->num_ratings = number_format_i18n( $theme->num_ratings ); $theme->preview_url = set_url_scheme( $theme->preview_url ); $theme->compatible_wp = is_wp_version_compatible( $theme->requires ); $theme->compatible_php = is_php_version_compatible( $theme->requires_php ); } wp_send_json_success( $api ); } function wp_ajax_parse_embed() { global $post, $wp_embed, $content_width; if ( empty( $_POST['shortcode'] ) ) { wp_send_json_error(); } $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { wp_send_json_error(); } setup_postdata( $post ); } elseif ( ! current_user_can( 'edit_posts' ) ) { wp_send_json_error(); } $shortcode = wp_unslash( $_POST['shortcode'] ); preg_match( '/' . get_shortcode_regex() . '/s', $shortcode, $matches ); $atts = shortcode_parse_atts( $matches[3] ); if ( ! empty( $matches[5] ) ) { $url = $matches[5]; } elseif ( ! empty( $atts['src'] ) ) { $url = $atts['src']; } else { $url = ''; } $parsed = false; $wp_embed->return_false_on_fail = true; if ( 0 === $post_id ) { $wp_embed->usecache = false; } if ( is_ssl() && 0 === strpos( $url, 'http://' ) ) { $ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode ); $parsed = $wp_embed->run_shortcode( $ssl_shortcode ); if ( ! $parsed ) { $no_ssl_support = true; } } if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { if ( ! isset( $content_width ) ) { $content_width = (int) $_POST['maxwidth']; } else { $content_width = min( $content_width, (int) $_POST['maxwidth'] ); } } if ( $url && ! $parsed ) { $parsed = $wp_embed->run_shortcode( $shortcode ); } if ( ! $parsed ) { wp_send_json_error( array( 'type' => 'not-embeddable', 'message' => sprintf( __( '%s failed to embed.' ), '' . esc_html( $url ) . '' ), ) ); } if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) { $styles = ''; $mce_styles = wpview_media_sandbox_styles(); foreach ( $mce_styles as $style ) { $styles .= sprintf( '', $style ); } $html = do_shortcode( $parsed ); global $wp_scripts; if ( ! empty( $wp_scripts ) ) { $wp_scripts->done = array(); } ob_start(); wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) ); $scripts = ob_get_clean(); $parsed = $styles . $html . $scripts; } if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) || preg_match( '%]*href="http://%', $parsed ) ) ) ) { wp_send_json_error( array( 'type' => 'not-ssl', 'message' => __( 'This preview is unavailable in the editor.' ), ) ); } $return = array( 'body' => $parsed, 'attr' => $wp_embed->last_attr, ); if ( strpos( $parsed, 'class="wp-embedded-content' ) ) { if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { $script_src = includes_url( 'js/wp-embed.js' ); } else { $script_src = includes_url( 'js/wp-embed.min.js' ); } $return['head'] = ''; $return['sandbox'] = true; } wp_send_json_success( $return ); } function wp_ajax_parse_media_shortcode() { global $post, $wp_scripts; if ( empty( $_POST['shortcode'] ) ) { wp_send_json_error(); } $shortcode = wp_unslash( $_POST['shortcode'] ); if ( ! empty( $_POST['post_ID'] ) ) { $post = get_post( (int) $_POST['post_ID'] ); } if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { if ( 'embed' === $shortcode ) { wp_send_json_error(); } } else { setup_postdata( $post ); } $parsed = do_shortcode( $shortcode ); if ( empty( $parsed ) ) { wp_send_json_error( array( 'type' => 'no-items', 'message' => __( 'No items found.' ), ) ); } $head = ''; $styles = wpview_media_sandbox_styles(); foreach ( $styles as $style ) { $head .= ''; } if ( ! empty( $wp_scripts ) ) { $wp_scripts->done = array(); } ob_start(); echo $parsed; if ( 'playlist' === $_REQUEST['type'] ) { wp_underscore_playlist_templates(); wp_print_scripts( 'wp-playlist' ); } else { wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) ); } wp_send_json_success( array( 'head' => $head, 'body' => ob_get_clean(), ) ); } function wp_ajax_destroy_sessions() { $user = get_userdata( (int) $_POST['user_id'] ); if ( $user ) { if ( ! current_user_can( 'edit_user', $user->ID ) ) { $user = false; } elseif ( ! wp_verify_nonce( $_POST['nonce'], 'update-user_' . $user->ID ) ) { $user = false; } } if ( ! $user ) { wp_send_json_error( array( 'message' => __( 'Could not log out user sessions. Please try again.' ), ) ); } $sessions = WP_Session_Tokens::get_instance( $user->ID ); if ( get_current_user_id() === $user->ID ) { $sessions->destroy_others( wp_get_session_token() ); $message = __( 'You are now logged out everywhere else.' ); } else { $sessions->destroy_all(); $message = sprintf( __( '%s has been logged out.' ), $user->display_name ); } wp_send_json_success( array( 'message' => $message ) ); } function wp_ajax_crop_image() { $attachment_id = absint( $_POST['id'] ); check_ajax_referer( 'image_editor-' . $attachment_id, 'nonce' ); if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_send_json_error(); } $context = str_replace( '_', '-', $_POST['context'] ); $data = array_map( 'absint', $_POST['cropDetails'] ); $cropped = wp_crop_image( $attachment_id, $data['x1'], $data['y1'], $data['width'], $data['height'], $data['dst_width'], $data['dst_height'] ); if ( ! $cropped || is_wp_error( $cropped ) ) { wp_send_json_error( array( 'message' => __( 'Image could not be processed.' ) ) ); } switch ( $context ) { case 'site-icon': require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'; $wp_site_icon = new WP_Site_Icon(); if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) { wp_delete_file( $cropped ); add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); break; } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $wp_site_icon->create_attachment_object( $cropped, $attachment_id ); unset( $attachment['ID'] ); add_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); $attachment_id = $wp_site_icon->insert_attachment( $attachment, $cropped ); remove_filter( 'intermediate_image_sizes_advanced', array( $wp_site_icon, 'additional_sizes' ) ); add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) ); break; default: do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $parent_url = wp_get_attachment_url( $attachment_id ); $parent_basename = wp_basename( $parent_url ); $url = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $original_attachment = get_post( $attachment_id ); $sanitized_post_title = sanitize_file_name( $original_attachment->post_title ); $use_original_title = ( ( '' !== trim( $original_attachment->post_title ) ) && ( $parent_basename !== $sanitized_post_title ) && ( pathinfo( $parent_basename, PATHINFO_FILENAME ) !== $sanitized_post_title ) ); $use_original_description = ( '' !== trim( $original_attachment->post_content ) ); $attachment = array( 'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ), 'post_content' => $use_original_description ? $original_attachment->post_content : $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => $context, ); if ( '' !== trim( $original_attachment->post_excerpt ) ) { $attachment['post_excerpt'] = $original_attachment->post_excerpt; } if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) { $attachment['meta_input'] = array( '_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ), ); } $attachment_id = wp_insert_attachment( $attachment, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); $metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context ); } wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) ); } function wp_ajax_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } function wp_ajax_nopriv_generate_password() { wp_send_json_success( wp_generate_password( 24 ) ); } function wp_ajax_save_wporg_username() { if ( ! current_user_can( 'install_themes' ) && ! current_user_can( 'install_plugins' ) ) { wp_send_json_error(); } check_ajax_referer( 'save_wporg_username_' . get_current_user_id() ); $username = isset( $_REQUEST['username'] ) ? wp_unslash( $_REQUEST['username'] ) : false; if ( ! $username ) { wp_send_json_error(); } wp_send_json_success( update_user_meta( get_current_user_id(), 'wporg_favorites', $username ) ); } function wp_ajax_install_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $slug = sanitize_key( wp_unslash( $_POST['slug'] ) ); $status = array( 'install' => 'theme', 'slug' => $slug, ); if ( ! current_user_can( 'install_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to install themes on this site.' ); wp_send_json_error( $status ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/theme.php'; $api = themes_api( 'theme_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ), ) ); if ( is_wp_error( $api ) ) { $status['errorMessage'] = $api->get_error_message(); wp_send_json_error( $status ); } $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Theme_Upgrader( $skin ); $result = $upgrader->install( $api->download_link ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $result ) ) { $status['errorCode'] = $result->get_error_code(); $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_null( $result ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['themeName'] = wp_get_theme( $slug )->get( 'Name' ); if ( current_user_can( 'switch_themes' ) ) { if ( is_multisite() ) { $status['activateUrl'] = add_query_arg( array( 'action' => 'enable', '_wpnonce' => wp_create_nonce( 'enable-theme_' . $slug ), 'theme' => $slug, ), network_admin_url( 'themes.php' ) ); } else { $status['activateUrl'] = add_query_arg( array( 'action' => 'activate', '_wpnonce' => wp_create_nonce( 'switch-theme_' . $slug ), 'stylesheet' => $slug, ), admin_url( 'themes.php' ) ); } } $theme = wp_get_theme( $slug ); $status['blockTheme'] = $theme->is_block_theme(); if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $status['customizeUrl'] = add_query_arg( array( 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ), ), wp_customize_url( $slug ) ); } wp_send_json_success( $status ); } function wp_ajax_update_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) ); $status = array( 'update' => 'theme', 'slug' => $stylesheet, 'oldVersion' => '', 'newVersion' => '', ); if ( ! current_user_can( 'update_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to update themes for this site.' ); wp_send_json_error( $status ); } $theme = wp_get_theme( $stylesheet ); if ( $theme->exists() ) { $status['oldVersion'] = $theme->get( 'Version' ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $current = get_site_transient( 'update_themes' ); if ( empty( $current ) ) { wp_update_themes(); } $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Theme_Upgrader( $skin ); $result = $upgrader->bulk_upgrade( array( $stylesheet ) ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_array( $result ) && ! empty( $result[ $stylesheet ] ) ) { if ( true === $result[ $stylesheet ] ) { $status['errorMessage'] = $upgrader->strings['up_to_date']; wp_send_json_error( $status ); } $theme = wp_get_theme( $stylesheet ); if ( $theme->exists() ) { $status['newVersion'] = $theme->get( 'Version' ); } wp_send_json_success( $status ); } elseif ( false === $result ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['errorMessage'] = __( 'Theme update failed.' ); wp_send_json_error( $status ); } function wp_ajax_delete_theme() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __( 'No theme specified.' ), ) ); } $stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) ); $status = array( 'delete' => 'theme', 'slug' => $stylesheet, ); if ( ! current_user_can( 'delete_themes' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to delete themes on this site.' ); wp_send_json_error( $status ); } if ( ! wp_get_theme( $stylesheet )->exists() ) { $status['errorMessage'] = __( 'The requested theme does not exist.' ); wp_send_json_error( $status ); } $url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ); ob_start(); $credentials = request_filesystem_credentials( $url ); ob_end_clean(); if ( false === $credentials || ! WP_Filesystem( $credentials ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } include_once ABSPATH . 'wp-admin/includes/theme.php'; $result = delete_theme( $stylesheet ); if ( is_wp_error( $result ) ) { $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( false === $result ) { $status['errorMessage'] = __( 'Theme could not be deleted.' ); wp_send_json_error( $status ); } wp_send_json_success( $status ); } function wp_ajax_install_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $status = array( 'install' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), ); if ( ! current_user_can( 'install_plugins' ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.' ); wp_send_json_error( $status ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $api = plugins_api( 'plugin_information', array( 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 'fields' => array( 'sections' => false, ), ) ); if ( is_wp_error( $api ) ) { $status['errorMessage'] = $api->get_error_message(); wp_send_json_error( $status ); } $status['pluginName'] = $api->name; $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader( $skin ); $result = $upgrader->install( $api->download_link ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $result ) ) { $status['errorCode'] = $result->get_error_code(); $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_null( $result ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $install_status = install_plugin_install_status( $api ); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; $plugins_url = ( 'import' === $pagenow ) ? admin_url( 'plugins.php' ) : network_admin_url( 'plugins.php' ); if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) { $status['activateUrl'] = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $install_status['file'] ), 'action' => 'activate', 'plugin' => $install_status['file'], ), $plugins_url ); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) && 'import' !== $pagenow ) { $status['activateUrl'] = add_query_arg( array( 'networkwide' => 1 ), $status['activateUrl'] ); } wp_send_json_success( $status ); } function wp_ajax_update_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['plugin'] ) || empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); $status = array( 'update' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), 'oldVersion' => '', 'newVersion' => '', ); if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' ); wp_send_json_error( $status ); } $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $status['plugin'] = $plugin; $status['pluginName'] = $plugin_data['Name']; if ( $plugin_data['Version'] ) { $status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; wp_update_plugins(); $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader( $skin ); $result = $upgrader->bulk_upgrade( array( $plugin ) ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $status['debug'] = $skin->get_upgrade_messages(); } if ( is_wp_error( $skin->result ) ) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error( $status ); } elseif ( $skin->get_errors()->has_errors() ) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error( $status ); } elseif ( is_array( $result ) && ! empty( $result[ $plugin ] ) ) { if ( true === $result[ $plugin ] ) { $status['errorMessage'] = $upgrader->strings['up_to_date']; wp_send_json_error( $status ); } $plugin_data = get_plugins( '/' . $result[ $plugin ]['destination_name'] ); $plugin_data = reset( $plugin_data ); if ( $plugin_data['Version'] ) { $status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } wp_send_json_success( $status ); } elseif ( false === $result ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $status['errorMessage'] = __( 'Plugin update failed.' ); wp_send_json_error( $status ); } function wp_ajax_delete_plugin() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) || empty( $_POST['plugin'] ) ) { wp_send_json_error( array( 'slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) ); $status = array( 'delete' => 'plugin', 'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ), ); if ( ! current_user_can( 'delete_plugins' ) || 0 !== validate_file( $plugin ) ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to delete plugins for this site.' ); wp_send_json_error( $status ); } $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $status['plugin'] = $plugin; $status['pluginName'] = $plugin_data['Name']; if ( is_plugin_active( $plugin ) ) { $status['errorMessage'] = __( 'You cannot delete a plugin while it is active on the main site.' ); wp_send_json_error( $status ); } $url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $plugin, 'bulk-plugins' ); ob_start(); $credentials = request_filesystem_credentials( $url ); ob_end_clean(); if ( false === $credentials || ! WP_Filesystem( $credentials ) ) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' ); if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { $status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() ); } wp_send_json_error( $status ); } $result = delete_plugins( array( $plugin ) ); if ( is_wp_error( $result ) ) { $status['errorMessage'] = $result->get_error_message(); wp_send_json_error( $status ); } elseif ( false === $result ) { $status['errorMessage'] = __( 'Plugin could not be deleted.' ); wp_send_json_error( $status ); } wp_send_json_success( $status ); } function wp_ajax_search_plugins() { check_ajax_referer( 'updates' ); wp_plugin_update_rows(); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; if ( 'plugins-network' === $pagenow || 'plugins' === $pagenow ) { set_current_screen( $pagenow ); } $wp_list_table = _get_list_table( 'WP_Plugins_List_Table', array( 'screen' => get_current_screen(), ) ); $status = array(); if ( ! $wp_list_table->ajax_user_can() ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); wp_send_json_error( $status ); } $_SERVER['REQUEST_URI'] = add_query_arg( array_diff_key( $_POST, array( '_ajax_nonce' => null, 'action' => null, ) ), network_admin_url( 'plugins.php', 'relative' ) ); $GLOBALS['s'] = wp_unslash( $_POST['s'] ); $wp_list_table->prepare_items(); ob_start(); $wp_list_table->display(); $status['count'] = count( $wp_list_table->items ); $status['items'] = ob_get_clean(); wp_send_json_success( $status ); } function wp_ajax_search_install_plugins() { check_ajax_referer( 'updates' ); $pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : ''; if ( 'plugin-install-network' === $pagenow || 'plugin-install' === $pagenow ) { set_current_screen( $pagenow ); } $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table', array( 'screen' => get_current_screen(), ) ); $status = array(); if ( ! $wp_list_table->ajax_user_can() ) { $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); wp_send_json_error( $status ); } $_SERVER['REQUEST_URI'] = add_query_arg( array_diff_key( $_POST, array( '_ajax_nonce' => null, 'action' => null, ) ), network_admin_url( 'plugin-install.php', 'relative' ) ); $wp_list_table->prepare_items(); ob_start(); $wp_list_table->display(); $status['count'] = (int) $wp_list_table->get_pagination_arg( 'total_items' ); $status['items'] = ob_get_clean(); wp_send_json_success( $status ); } function wp_ajax_edit_theme_plugin_file() { $r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) ); if ( is_wp_error( $r ) ) { wp_send_json_error( array_merge( array( 'code' => $r->get_error_code(), 'message' => $r->get_error_message(), ), (array) $r->get_error_data() ) ); } else { wp_send_json_success( array( 'message' => __( 'File edited successfully.' ), ) ); } } function wp_ajax_wp_privacy_export_personal_data() { if ( empty( $_POST['id'] ) ) { wp_send_json_error( __( 'Missing request ID.' ) ); } $request_id = (int) $_POST['id']; if ( $request_id < 1 ) { wp_send_json_error( __( 'Invalid request ID.' ) ); } if ( ! current_user_can( 'export_others_personal_data' ) ) { wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) ); } check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' ); $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request type.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'A valid email address must be given.' ) ); } if ( ! isset( $_POST['exporter'] ) ) { wp_send_json_error( __( 'Missing exporter index.' ) ); } $exporter_index = (int) $_POST['exporter']; if ( ! isset( $_POST['page'] ) ) { wp_send_json_error( __( 'Missing page index.' ) ); } $page = (int) $_POST['page']; $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false; $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); if ( ! is_array( $exporters ) ) { wp_send_json_error( __( 'An exporter has improperly used the registration filter.' ) ); } if ( 0 < count( $exporters ) ) { if ( $exporter_index < 1 ) { wp_send_json_error( __( 'Exporter index cannot be negative.' ) ); } if ( $exporter_index > count( $exporters ) ) { wp_send_json_error( __( 'Exporter index is out of range.' ) ); } if ( $page < 1 ) { wp_send_json_error( __( 'Page index cannot be less than one.' ) ); } $exporter_keys = array_keys( $exporters ); $exporter_key = $exporter_keys[ $exporter_index - 1 ]; $exporter = $exporters[ $exporter_key ]; if ( ! is_array( $exporter ) ) { wp_send_json_error( sprintf( __( 'Expected an array describing the exporter at index %s.' ), $exporter_key ) ); } if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) { wp_send_json_error( sprintf( __( 'Exporter array at index %s does not include a friendly name.' ), $exporter_key ) ); } $exporter_friendly_name = $exporter['exporter_friendly_name']; if ( ! array_key_exists( 'callback', $exporter ) ) { wp_send_json_error( sprintf( __( 'Exporter does not include a callback: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! is_callable( $exporter['callback'] ) ) { wp_send_json_error( sprintf( __( 'Exporter callback is not a valid callback: %s.' ), esc_html( $exporter_friendly_name ) ) ); } $callback = $exporter['callback']; $response = call_user_func( $callback, $email_address, $page ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } if ( ! is_array( $response ) ) { wp_send_json_error( sprintf( __( 'Expected response as an array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! array_key_exists( 'data', $response ) ) { wp_send_json_error( sprintf( __( 'Expected data in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! is_array( $response['data'] ) ) { wp_send_json_error( sprintf( __( 'Expected data array in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } if ( ! array_key_exists( 'done', $response ) ) { wp_send_json_error( sprintf( __( 'Expected done (boolean) in response array from exporter: %s.' ), esc_html( $exporter_friendly_name ) ) ); } } else { $exporter_key = ''; $response = array( 'data' => array(), 'done' => true, ); } $response = apply_filters( 'wp_privacy_personal_data_export_page', $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } wp_send_json_success( $response ); } function wp_ajax_wp_privacy_erase_personal_data() { if ( empty( $_POST['id'] ) ) { wp_send_json_error( __( 'Missing request ID.' ) ); } $request_id = (int) $_POST['id']; if ( $request_id < 1 ) { wp_send_json_error( __( 'Invalid request ID.' ) ); } if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) { wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) ); } check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' ); $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { wp_send_json_error( __( 'Invalid request type.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { wp_send_json_error( __( 'Invalid email address in request.' ) ); } if ( ! isset( $_POST['eraser'] ) ) { wp_send_json_error( __( 'Missing eraser index.' ) ); } $eraser_index = (int) $_POST['eraser']; if ( ! isset( $_POST['page'] ) ) { wp_send_json_error( __( 'Missing page index.' ) ); } $page = (int) $_POST['page']; $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); if ( 0 < count( $erasers ) ) { if ( $eraser_index < 1 ) { wp_send_json_error( __( 'Eraser index cannot be less than one.' ) ); } if ( $eraser_index > count( $erasers ) ) { wp_send_json_error( __( 'Eraser index is out of range.' ) ); } if ( $page < 1 ) { wp_send_json_error( __( 'Page index cannot be less than one.' ) ); } $eraser_keys = array_keys( $erasers ); $eraser_key = $eraser_keys[ $eraser_index - 1 ]; $eraser = $erasers[ $eraser_key ]; if ( ! is_array( $eraser ) ) { wp_send_json_error( sprintf( __( 'Expected an array describing the eraser at index %d.' ), $eraser_index ) ); } if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) { wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a friendly name.' ), $eraser_index ) ); } $eraser_friendly_name = $eraser['eraser_friendly_name']; if ( ! array_key_exists( 'callback', $eraser ) ) { wp_send_json_error( sprintf( __( 'Eraser does not include a callback: %s.' ), esc_html( $eraser_friendly_name ) ) ); } if ( ! is_callable( $eraser['callback'] ) ) { wp_send_json_error( sprintf( __( 'Eraser callback is not valid: %s.' ), esc_html( $eraser_friendly_name ) ) ); } $callback = $eraser['callback']; $response = call_user_func( $callback, $email_address, $page ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } if ( ! is_array( $response ) ) { wp_send_json_error( sprintf( __( 'Did not receive array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'items_removed', $response ) ) { wp_send_json_error( sprintf( __( 'Expected items_removed key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'items_retained', $response ) ) { wp_send_json_error( sprintf( __( 'Expected items_retained key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'messages', $response ) ) { wp_send_json_error( sprintf( __( 'Expected messages key in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! is_array( $response['messages'] ) ) { wp_send_json_error( sprintf( __( 'Expected messages key to reference an array in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } if ( ! array_key_exists( 'done', $response ) ) { wp_send_json_error( sprintf( __( 'Expected done flag in response array from %1$s eraser (index %2$d).' ), esc_html( $eraser_friendly_name ), $eraser_index ) ); } } else { $eraser_key = ''; $response = array( 'items_removed' => false, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } $response = apply_filters( 'wp_privacy_personal_data_erasure_page', $response, $eraser_index, $email_address, $page, $request_id, $eraser_key ); if ( is_wp_error( $response ) ) { wp_send_json_error( $response ); } wp_send_json_success( $response ); } function wp_ajax_health_check_dotorg_communication() { _doing_it_wrong( 'wp_ajax_health_check_dotorg_communication', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_dotorg_communication', 'WP_REST_Site_Health_Controller::test_dotorg_communication' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_dotorg_communication() ); } function wp_ajax_health_check_background_updates() { _doing_it_wrong( 'wp_ajax_health_check_background_updates', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_background_updates', 'WP_REST_Site_Health_Controller::test_background_updates' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_background_updates() ); } function wp_ajax_health_check_loopback_requests() { _doing_it_wrong( 'wp_ajax_health_check_loopback_requests', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_loopback_requests', 'WP_REST_Site_Health_Controller::test_loopback_requests' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Site_Health' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } $site_health = WP_Site_Health::get_instance(); wp_send_json_success( $site_health->get_test_loopback_requests() ); } function wp_ajax_health_check_site_status_result() { check_ajax_referer( 'health-check-site-status-result' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { wp_send_json_error(); } set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) ); wp_send_json_success(); } function wp_ajax_health_check_get_sizes() { _doing_it_wrong( 'wp_ajax_health_check_get_sizes', sprintf( __( 'The Site Health check for %1$s has been replaced with %2$s.' ), 'wp_ajax_health_check_get_sizes', 'WP_REST_Site_Health_Controller::get_directory_sizes' ), '5.6.0' ); check_ajax_referer( 'health-check-site-status-result' ); if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) { wp_send_json_error(); } if ( ! class_exists( 'WP_Debug_Data' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php'; } $sizes_data = WP_Debug_Data::get_sizes(); $all_sizes = array( 'raw' => 0 ); foreach ( $sizes_data as $name => $value ) { $name = sanitize_text_field( $name ); $data = array(); if ( isset( $value['size'] ) ) { if ( is_string( $value['size'] ) ) { $data['size'] = sanitize_text_field( $value['size'] ); } else { $data['size'] = (int) $value['size']; } } if ( isset( $value['debug'] ) ) { if ( is_string( $value['debug'] ) ) { $data['debug'] = sanitize_text_field( $value['debug'] ); } else { $data['debug'] = (int) $value['debug']; } } if ( ! empty( $value['raw'] ) ) { $data['raw'] = (int) $value['raw']; } $all_sizes[ $name ] = $data; } if ( isset( $all_sizes['total_size']['debug'] ) && 'not available' === $all_sizes['total_size']['debug'] ) { wp_send_json_error( $all_sizes ); } wp_send_json_success( $all_sizes ); } function wp_ajax_rest_nonce() { exit( wp_create_nonce( 'wp_rest' ) ); } function wp_ajax_toggle_auto_updates() { check_ajax_referer( 'updates' ); if ( empty( $_POST['type'] ) || empty( $_POST['asset'] ) || empty( $_POST['state'] ) ) { wp_send_json_error( array( 'error' => __( 'Invalid data. No selected item.' ) ) ); } $asset = sanitize_text_field( urldecode( $_POST['asset'] ) ); if ( 'enable' !== $_POST['state'] && 'disable' !== $_POST['state'] ) { wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown state.' ) ) ); } $state = $_POST['state']; if ( 'plugin' !== $_POST['type'] && 'theme' !== $_POST['type'] ) { wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) ); } $type = $_POST['type']; switch ( $type ) { case 'plugin': if ( ! current_user_can( 'update_plugins' ) ) { $error_message = __( 'Sorry, you are not allowed to modify plugins.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $option = 'auto_update_plugins'; $all_items = apply_filters( 'all_plugins', get_plugins() ); break; case 'theme': if ( ! current_user_can( 'update_themes' ) ) { $error_message = __( 'Sorry, you are not allowed to modify themes.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $option = 'auto_update_themes'; $all_items = wp_get_themes(); break; default: wp_send_json_error( array( 'error' => __( 'Invalid data. Unknown type.' ) ) ); } if ( ! array_key_exists( $asset, $all_items ) ) { $error_message = __( 'Invalid data. The item does not exist.' ); wp_send_json_error( array( 'error' => $error_message ) ); } $auto_updates = (array) get_site_option( $option, array() ); if ( 'disable' === $state ) { $auto_updates = array_diff( $auto_updates, array( $asset ) ); } else { $auto_updates[] = $asset; $auto_updates = array_unique( $auto_updates ); } $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); update_site_option( $option, $auto_updates ); wp_send_json_success(); } function wp_ajax_send_password_reset() { $user_id = isset( $_POST['user_id'] ) ? (int) $_POST['user_id'] : 0; check_ajax_referer( 'reset-password-for-' . $user_id, 'nonce' ); if ( ! current_user_can( 'edit_user', $user_id ) ) { wp_send_json_error( __( 'Cannot send password reset, permission denied.' ) ); } $user = get_userdata( $user_id ); $results = retrieve_password( $user->user_login ); if ( true === $results ) { wp_send_json_success( sprintf( __( 'A password reset link was emailed to %s.' ), $user->display_name ) ); } else { wp_send_json_error( $results->get_error_message() ); } } ' . __( 'You need a higher level of permission.' ) . '' . '

            ' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '

            ', 403 ); } $_POST['link_url'] = esc_html( $_POST['link_url'] ); $_POST['link_url'] = esc_url( $_POST['link_url'] ); $_POST['link_name'] = esc_html( $_POST['link_name'] ); $_POST['link_image'] = esc_html( $_POST['link_image'] ); $_POST['link_rss'] = esc_url( $_POST['link_rss'] ); if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) { $_POST['link_visible'] = 'Y'; } if ( ! empty( $link_id ) ) { $_POST['link_id'] = $link_id; return wp_update_link( $_POST ); } else { return wp_insert_link( $_POST ); } } function get_default_link_to_edit() { $link = new stdClass; if ( isset( $_GET['linkurl'] ) ) { $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) ); } else { $link->link_url = ''; } if ( isset( $_GET['name'] ) ) { $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) ); } else { $link->link_name = ''; } $link->link_visible = 'Y'; return $link; } function wp_delete_link( $link_id ) { global $wpdb; do_action( 'delete_link', $link_id ); wp_delete_object_term_relationships( $link_id, 'link_category' ); $wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) ); do_action( 'deleted_link', $link_id ); clean_bookmark_cache( $link_id ); return true; } function wp_get_link_cats( $link_id = 0 ) { $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) ); return array_unique( $cats ); } function get_link_to_edit( $link ) { return get_bookmark( $link, OBJECT, 'edit' ); } function wp_insert_link( $linkdata, $wp_error = false ) { global $wpdb; $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0, ); $parsed_args = wp_parse_args( $linkdata, $defaults ); $parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) ); $link_id = $parsed_args['link_id']; $link_name = $parsed_args['link_name']; $link_url = $parsed_args['link_url']; $update = false; if ( ! empty( $link_id ) ) { $update = true; } if ( '' === trim( $link_name ) ) { if ( '' !== trim( $link_url ) ) { $link_name = $link_url; } else { return 0; } } if ( '' === trim( $link_url ) ) { return 0; } $link_rating = ( ! empty( $parsed_args['link_rating'] ) ) ? $parsed_args['link_rating'] : 0; $link_image = ( ! empty( $parsed_args['link_image'] ) ) ? $parsed_args['link_image'] : ''; $link_target = ( ! empty( $parsed_args['link_target'] ) ) ? $parsed_args['link_target'] : ''; $link_visible = ( ! empty( $parsed_args['link_visible'] ) ) ? $parsed_args['link_visible'] : 'Y'; $link_owner = ( ! empty( $parsed_args['link_owner'] ) ) ? $parsed_args['link_owner'] : get_current_user_id(); $link_notes = ( ! empty( $parsed_args['link_notes'] ) ) ? $parsed_args['link_notes'] : ''; $link_description = ( ! empty( $parsed_args['link_description'] ) ) ? $parsed_args['link_description'] : ''; $link_rss = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : ''; $link_rel = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : ''; $link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array(); if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) { $link_category = array( get_option( 'default_link_category' ) ); } if ( $update ) { if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ), compact( 'link_id' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error ); } else { return 0; } } } else { if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error ); } else { return 0; } } $link_id = (int) $wpdb->insert_id; } wp_set_link_cats( $link_id, $link_category ); if ( $update ) { do_action( 'edit_link', $link_id ); } else { do_action( 'add_link', $link_id ); } clean_bookmark_cache( $link_id ); return $link_id; } function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { if ( ! is_array( $link_categories ) || 0 === count( $link_categories ) ) { $link_categories = array( get_option( 'default_link_category' ) ); } $link_categories = array_map( 'intval', $link_categories ); $link_categories = array_unique( $link_categories ); wp_set_object_terms( $link_id, $link_categories, 'link_category' ); clean_bookmark_cache( $link_id ); } function wp_update_link( $linkdata ) { $link_id = (int) $linkdata['link_id']; $link = get_bookmark( $link_id, ARRAY_A ); $link = wp_slash( $link ); if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && count( $linkdata['link_category'] ) > 0 ) { $link_cats = $linkdata['link_category']; } else { $link_cats = $link['link_category']; } $linkdata = array_merge( $link, $linkdata ); $linkdata['link_category'] = $link_cats; return wp_insert_link( $linkdata ); } function wp_link_manager_disabled_message() { global $pagenow; if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) { return; } add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); $really_can_manage_links = current_user_can( 'manage_links' ); remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 ); if ( $really_can_manage_links ) { $plugins = get_plugins(); if ( empty( $plugins['link-manager/link-manager.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ), 'install-plugin_link-manager' ); wp_die( sprintf( __( 'If you are looking to use the link manager, please install the Link Manager plugin.' ), esc_url( $install_url ) ) ); } } elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ), 'activate-plugin_link-manager/link-manager.php' ); wp_die( sprintf( __( 'Please activate the Link Manager plugin to use the link manager.' ), esc_url( $activate_url ) ) ); } } } wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); } strings['up_to_date'] = __( 'WordPress is at the latest version.' ); $this->strings['locked'] = __( 'Another update is currently in progress.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['copy_failed'] = __( 'Could not copy files.' ); $this->strings['copy_failed_space'] = __( 'Could not copy files. You may have run out of disk space.' ); $this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' ); $this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' ); } public function upgrade( $current, $args = array() ) { global $wp_filesystem; require ABSPATH . WPINC . '/version.php'; $start_time = time(); $defaults = array( 'pre_check_md5' => true, 'attempt_rollback' => false, 'do_rollback' => false, 'allow_relaxed_file_ownership' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); if ( ! isset( $current->response ) || 'latest' === $current->response ) { return new WP_Error( 'up_to_date', $this->strings['up_to_date'] ); } $res = $this->fs_connect( array( ABSPATH, WP_CONTENT_DIR ), $parsed_args['allow_relaxed_file_ownership'] ); if ( ! $res || is_wp_error( $res ) ) { return $res; } $wp_dir = trailingslashit( $wp_filesystem->abspath() ); $partial = true; if ( $parsed_args['do_rollback'] ) { $partial = false; } elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() ) { $partial = false; } if ( $parsed_args['do_rollback'] && $current->packages->rollback ) { $to_download = 'rollback'; } elseif ( $current->packages->partial && 'reinstall' !== $current->response && $wp_version === $current->partial_version && $partial ) { $to_download = 'partial'; } elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { $to_download = 'new_bundled'; } elseif ( $current->packages->no_content ) { $to_download = 'no_content'; } else { $to_download = 'full'; } $lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS ); if ( ! $lock ) { return new WP_Error( 'locked', $this->strings['locked'] ); } $download = $this->download_package( $current->packages->$to_download, true ); if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) { apply_filters( 'update_feedback', $download->get_error_message() ); wp_version_check( array( 'signature_failure_code' => $download->get_error_code(), 'signature_failure_data' => $download->get_error_data(), ) ); $download = $download->get_error_data( 'softfail-filename' ); } if ( is_wp_error( $download ) ) { WP_Upgrader::release_lock( 'core_updater' ); return $download; } $working_dir = $this->unpack_package( $download ); if ( is_wp_error( $working_dir ) ) { WP_Upgrader::release_lock( 'core_updater' ); return $working_dir; } if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) { $wp_filesystem->delete( $working_dir, true ); WP_Upgrader::release_lock( 'core_updater' ); return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' ); } $wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE ); wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' ); require_once ABSPATH . 'wp-admin/includes/update-core.php'; if ( ! function_exists( 'update_core' ) ) { WP_Upgrader::release_lock( 'core_updater' ); return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] ); } $result = update_core( $working_dir, $wp_dir ); if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) { $try_rollback = false; if ( is_wp_error( $result ) ) { $error_code = $result->get_error_code(); if ( false !== strpos( $error_code, 'do_rollback' ) ) { $try_rollback = true; } elseif ( false !== strpos( $error_code, '__copy_dir' ) ) { $try_rollback = true; } elseif ( 'disk_full' === $error_code ) { $try_rollback = true; } } if ( $try_rollback ) { apply_filters( 'update_feedback', $result ); apply_filters( 'update_feedback', $this->strings['start_rollback'] ); $rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) ); $original_result = $result; $result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], (object) array( 'update' => $original_result, 'rollback' => $rollback_result, ) ); } } do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core', ) ); delete_site_transient( 'update_core' ); if ( ! $parsed_args['do_rollback'] ) { $stats = array( 'update_type' => $current->response, 'success' => true, 'fs_method' => $wp_filesystem->method, 'fs_method_forced' => defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' ), 'fs_method_direct' => ! empty( $GLOBALS['_wp_filesystem_direct_method'] ) ? $GLOBALS['_wp_filesystem_direct_method'] : '', 'time_taken' => time() - $start_time, 'reported' => $wp_version, 'attempted' => $current->version, ); if ( is_wp_error( $result ) ) { $stats['success'] = false; if ( ! empty( $try_rollback ) ) { $stats['error_code'] = $original_result->get_error_code(); $stats['error_data'] = $original_result->get_error_data(); $stats['rollback'] = ! is_wp_error( $rollback_result ); if ( is_wp_error( $rollback_result ) ) { $stats['rollback_code'] = $rollback_result->get_error_code(); $stats['rollback_data'] = $rollback_result->get_error_data(); } } else { $stats['error_code'] = $result->get_error_code(); $stats['error_data'] = $result->get_error_data(); } } wp_version_check( $stats ); } WP_Upgrader::release_lock( 'core_updater' ); return $result; } public static function should_update_to_version( $offered_ver ) { require ABSPATH . WPINC . '/version.php'; $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); $current_is_development_version = (bool) strpos( $wp_version, '-' ); $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { $upgrade_dev = true; $upgrade_minor = true; $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { $upgrade_dev = false; $upgrade_minor = true; $upgrade_major = false; } } if ( $offered_ver === $wp_version ) { return false; } if ( version_compare( $wp_version, $offered_ver, '>' ) ) { return false; } $failure_data = get_site_option( 'auto_core_update_failed' ); if ( $failure_data ) { if ( ! empty( $failure_data['critical'] ) ) { return false; } if ( $wp_version === $failure_data['current'] && false !== strpos( $offered_ver, '.1.next.minor' ) ) { return false; } if ( empty( $failure_data['retry'] ) && $wp_version === $failure_data['current'] && $offered_ver === $failure_data['attempted'] ) { return false; } } if ( $current_is_development_version ) { if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) ) { return false; } } if ( $current_branch === $new_branch ) { return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); } if ( version_compare( $new_branch, $current_branch, '>' ) ) { return apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); } return false; } public function check_files() { global $wp_version, $wp_local_package; $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); if ( ! is_array( $checksums ) ) { return false; } foreach ( $checksums as $file => $checksum ) { if ( 'wp-content' === substr( $file, 0, 10 ) ) { continue; } if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) { return false; } } return true; } } method = 'direct'; $this->errors = new WP_Error(); } public function get_contents( $file ) { return @file_get_contents( $file ); } public function get_contents_array( $file ) { return @file( $file ); } public function put_contents( $file, $contents, $mode = false ) { $fp = @fopen( $file, 'wb' ); if ( ! $fp ) { return false; } mbstring_binary_safe_encoding(); $data_length = strlen( $contents ); $bytes_written = fwrite( $fp, $contents ); reset_mbstring_encoding(); fclose( $fp ); if ( $data_length !== $bytes_written ) { return false; } $this->chmod( $file, $mode ); return true; } public function cwd() { return getcwd(); } public function chdir( $dir ) { return @chdir( $dir ); } public function chgrp( $file, $group, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive ) { return chgrp( $file, $group ); } if ( ! $this->is_dir( $file ) ) { return chgrp( $file, $group ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chgrp( $file . $filename, $group, $recursive ); } return true; } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( ! $recursive || ! $this->is_dir( $file ) ) { return chmod( $file, $mode ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . $filename, $mode, $recursive ); } return true; } public function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive ) { return chown( $file, $owner ); } if ( ! $this->is_dir( $file ) ) { return chown( $file, $owner ); } $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chown( $file . '/' . $filename, $owner, $recursive ); } return true; } public function owner( $file ) { $owneruid = @fileowner( $file ); if ( ! $owneruid ) { return false; } if ( ! function_exists( 'posix_getpwuid' ) ) { return $owneruid; } $ownerarray = posix_getpwuid( $owneruid ); if ( ! $ownerarray ) { return false; } return $ownerarray['name']; } public function getchmod( $file ) { return substr( decoct( @fileperms( $file ) ), -3 ); } public function group( $file ) { $gid = @filegroup( $file ); if ( ! $gid ) { return false; } if ( ! function_exists( 'posix_getgrgid' ) ) { return $gid; } $grouparray = posix_getgrgid( $gid ); if ( ! $grouparray ) { return false; } return $grouparray['name']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $rtval = copy( $source, $destination ); if ( $mode ) { $this->chmod( $destination, $mode ); } return $rtval; } public function move( $source, $destination, $overwrite = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } if ( @rename( $source, $destination ) ) { return true; } if ( $this->copy( $source, $destination, $overwrite ) && $this->exists( $destination ) ) { $this->delete( $source ); return true; } else { return false; } } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } $file = str_replace( '\\', '/', $file ); if ( 'f' === $type || $this->is_file( $file ) ) { return @unlink( $file ); } if ( ! $recursive && $this->is_dir( $file ) ) { return @rmdir( $file ); } $file = trailingslashit( $file ); $filelist = $this->dirlist( $file, true ); $retval = true; if ( is_array( $filelist ) ) { foreach ( $filelist as $filename => $fileinfo ) { if ( ! $this->delete( $file . $filename, $recursive, $fileinfo['type'] ) ) { $retval = false; } } } if ( file_exists( $file ) && ! @rmdir( $file ) ) { $retval = false; } return $retval; } public function exists( $file ) { return @file_exists( $file ); } public function is_file( $file ) { return @is_file( $file ); } public function is_dir( $path ) { return @is_dir( $path ); } public function is_readable( $file ) { return @is_readable( $file ); } public function is_writable( $file ) { return @is_writable( $file ); } public function atime( $file ) { return @fileatime( $file ); } public function mtime( $file ) { return @filemtime( $file ); } public function size( $file ) { return @filesize( $file ); } public function touch( $file, $time = 0, $atime = 0 ) { if ( 0 === $time ) { $time = time(); } if ( 0 === $atime ) { $atime = time(); } return touch( $file, $time, $atime ); } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } if ( ! @mkdir( $path ) ) { return false; } $this->chmod( $path, $chmod ); if ( $chown ) { $this->chown( $path, $chown ); } if ( $chgrp ) { $this->chgrp( $path, $chgrp ); } return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path, $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ); } else { $limit_file = false; } if ( ! $this->is_dir( $path ) || ! $this->is_readable( $path ) ) { return false; } $dir = dir( $path ); if ( ! $dir ) { return false; } $ret = array(); while ( false !== ( $entry = $dir->read() ) ) { $struc = array(); $struc['name'] = $entry; if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } $struc['perms'] = $this->gethchmod( $path . '/' . $entry ); $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $struc['number'] = false; $struc['owner'] = $this->owner( $path . '/' . $entry ); $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset( $dir ); return $ret; } } method = 'ftpsockets'; $this->errors = new WP_Error(); if ( ! include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) { return; } $this->ftp = new ftp(); if ( empty( $opt['port'] ) ) { $this->options['port'] = 21; } else { $this->options['port'] = (int) $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); } else { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { $this->errors->add( 'empty_password', __( 'FTP password is required' ) ); } else { $this->options['password'] = $opt['password']; } } public function connect() { if ( ! $this->ftp ) { return false; } $this->ftp->setTimeout( FS_CONNECT_TIMEOUT ); if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->ftp->connect() ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! $this->ftp->login( $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } $this->ftp->SetType( FTP_BINARY ); $this->ftp->Passive( true ); $this->ftp->setTimeout( FS_TIMEOUT ); return true; } public function get_contents( $file ) { if ( ! $this->exists( $file ) ) { return false; } $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); if ( ! $this->ftp->fget( $temphandle, $file ) ) { fclose( $temphandle ); unlink( $tempfile ); reset_mbstring_encoding(); return ''; } reset_mbstring_encoding(); fseek( $temphandle, 0 ); $contents = ''; while ( ! feof( $temphandle ) ) { $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); } fclose( $temphandle ); unlink( $tempfile ); return $contents; } public function get_contents_array( $file ) { return explode( "\n", $this->get_contents( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $tempfile = wp_tempnam( $file ); $temphandle = @fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); $bytes_written = fwrite( $temphandle, $contents ); if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) { fclose( $temphandle ); unlink( $tempfile ); reset_mbstring_encoding(); return false; } fseek( $temphandle, 0 ); $ret = $this->ftp->fput( $file, $temphandle ); reset_mbstring_encoding(); fclose( $temphandle ); unlink( $tempfile ); $this->chmod( $file, $mode ); return $ret; } public function cwd() { $cwd = $this->ftp->pwd(); if ( $cwd ) { $cwd = trailingslashit( $cwd ); } return $cwd; } public function chdir( $dir ) { return $this->ftp->chdir( $dir ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( $recursive && $this->is_dir( $file ) ) { $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . '/' . $filename, $mode, $recursive ); } } return $this->ftp->chmod( $file, $mode ); } public function owner( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['owner']; } public function getchmod( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['permsn']; } public function group( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['group']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { return $this->ftp->rename( $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } if ( 'f' === $type || $this->is_file( $file ) ) { return $this->ftp->delete( $file ); } if ( ! $recursive ) { return $this->ftp->rmdir( $file ); } return $this->ftp->mdel( $file ); } public function exists( $file ) { $list = $this->ftp->nlist( $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; } return ! empty( $list ); } public function is_file( $file ) { if ( $this->is_dir( $file ) ) { return false; } if ( $this->exists( $file ) ) { return true; } return false; } public function is_dir( $path ) { $cwd = $this->cwd(); if ( $this->chdir( $path ) ) { $this->chdir( $cwd ); return true; } return false; } public function is_readable( $file ) { return true; } public function is_writable( $file ) { return true; } public function atime( $file ) { return false; } public function mtime( $file ) { return $this->ftp->mdtm( $file ); } public function size( $file ) { return $this->ftp->filesize( $file ); } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! $this->ftp->mkdir( $path ) ) { return false; } if ( ! $chmod ) { $chmod = FS_CHMOD_DIR; } $this->chmod( $path, $chmod ); return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ) . '/'; } else { $limit_file = false; } mbstring_binary_safe_encoding(); $list = $this->ftp->dirlist( $path ); if ( empty( $list ) && ! $this->exists( $path ) ) { reset_mbstring_encoding(); return false; } $ret = array(); foreach ( $list as $struc ) { if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } if ( $struc['islink'] ) { $struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] ); } $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $ret[ $struc['name'] ] = $struc; } reset_mbstring_encoding(); return $ret; } public function __destruct() { $this->ftp->quit(); } } strings['up_to_date'] = __( 'The theme is at the latest version.' ); $this->strings['no_package'] = __( 'Update package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the update…' ); $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); $this->strings['process_failed'] = __( 'Theme update failed.' ); $this->strings['process_success'] = __( 'Theme updated successfully.' ); } public function install_strings() { $this->strings['no_package'] = __( 'Installation package not available.' ); $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '%s' ); $this->strings['unpack_package'] = __( 'Unpacking the package…' ); $this->strings['installing_package'] = __( 'Installing the theme…' ); $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); $this->strings['no_files'] = __( 'The theme contains no files.' ); $this->strings['process_failed'] = __( 'Theme installation failed.' ); $this->strings['process_success'] = __( 'Theme installed successfully.' ); $this->strings['process_success_specific'] = __( 'Successfully installed the theme %1$s %2$s.' ); $this->strings['parent_theme_search'] = __( 'This theme requires a parent theme. Checking if it is installed…' ); $this->strings['parent_theme_prepare_install'] = __( 'Preparing to install %1$s %2$s…' ); $this->strings['parent_theme_currently_installed'] = __( 'The parent theme, %1$s %2$s, is currently installed.' ); $this->strings['parent_theme_install_success'] = __( 'Successfully installed the parent theme, %1$s %2$s.' ); $this->strings['parent_theme_not_found'] = sprintf( __( 'The parent theme could not be found. You will need to install the parent theme, %s, before you can use this child theme.' ), '%s' ); $this->strings['current_theme_has_errors'] = __( 'The active theme has the following error: "%s".' ); if ( ! empty( $this->skin->overwrite ) ) { if ( 'update-theme' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Updating the theme…' ); $this->strings['process_failed'] = __( 'Theme update failed.' ); $this->strings['process_success'] = __( 'Theme updated successfully.' ); } if ( 'downgrade-theme' === $this->skin->overwrite ) { $this->strings['installing_package'] = __( 'Downgrading the theme…' ); $this->strings['process_failed'] = __( 'Theme downgrade failed.' ); $this->strings['process_success'] = __( 'Theme downgraded successfully.' ); } } } public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { $theme_info = $this->theme_info(); if ( ! $theme_info->parent() ) { return $install_result; } $this->skin->feedback( 'parent_theme_search' ); if ( ! $theme_info->parent()->errors() ) { $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display( 'Name' ), $theme_info->parent()->display( 'Version' ) ); return $install_result; } $api = themes_api( 'theme_information', array( 'slug' => $theme_info->get( 'Template' ), 'fields' => array( 'sections' => false, 'tags' => false, ), ) ); if ( ! $api || is_wp_error( $api ) ) { $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); return $install_result; } $child_api = $this->skin->api; $child_success_message = $this->strings['process_success']; $this->skin->api = $api; $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); add_filter( 'install_theme_complete_actions', '__return_false', 999 ); $parent_result = $this->run( array( 'package' => $api->download_link, 'destination' => get_theme_root(), 'clear_destination' => false, 'clear_working' => true, ) ); if ( is_wp_error( $parent_result ) ) { add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); } remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); $this->result = $child_result; $this->skin->api = $child_api; $this->strings['process_success'] = $child_success_message; return $install_result; } public function hide_activate_preview_actions( $actions ) { unset( $actions['activate'], $actions['preview'] ); return $actions; } public function install( $package, $args = array() ) { $defaults = array( 'clear_update_cache' => true, 'overwrite_package' => false, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->install_strings(); add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); add_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ), 10, 3 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $package, 'destination' => get_theme_root(), 'clear_destination' => $parsed_args['overwrite_package'], 'clear_working' => true, 'hook_extra' => array( 'type' => 'theme', 'action' => 'install', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); remove_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); if ( $parsed_args['overwrite_package'] ) { do_action( 'upgrader_overwrote_package', $package, $this->new_theme_data, 'theme' ); } return true; } public function upgrade( $theme, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->upgrade_strings(); $current = get_site_transient( 'update_themes' ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->before(); $this->skin->set_result( false ); $this->skin->error( 'up_to_date' ); $this->skin->after(); return false; } $r = $current->response[ $theme ]; add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); if ( $parsed_args['clear_update_cache'] ) { add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); } $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array( 'theme' => $theme, 'type' => 'theme', 'action' => 'update', ), ) ); remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); if ( ! $this->result || is_wp_error( $this->result ) ) { return $this->result; } wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); if ( isset( $past_failure_emails[ $theme ] ) ) { unset( $past_failure_emails[ $theme ] ); update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } return true; } public function bulk_upgrade( $themes, $args = array() ) { $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_themes' ); add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); $this->skin->header(); $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); $maintenance = ( is_multisite() && ! empty( $themes ) ); foreach ( $themes as $theme ) { $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme; } if ( $maintenance ) { $this->maintenance_mode( true ); } $results = array(); $this->update_count = count( $themes ); $this->update_current = 0; foreach ( $themes as $theme ) { $this->update_current++; $this->skin->theme_info = $this->theme_info( $theme ); if ( ! isset( $current->response[ $theme ] ) ) { $this->skin->set_result( true ); $this->skin->before(); $this->skin->feedback( 'up_to_date' ); $this->skin->after(); $results[ $theme ] = true; continue; } $r = $current->response[ $theme ]; $result = $this->run( array( 'package' => $r['package'], 'destination' => get_theme_root( $theme ), 'clear_destination' => true, 'clear_working' => true, 'is_multi' => true, 'hook_extra' => array( 'theme' => $theme, ), ) ); $results[ $theme ] = $result; if ( false === $result ) { break; } } $this->maintenance_mode( false ); wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true, 'themes' => $themes, ) ); $this->skin->bulk_footer(); $this->skin->footer(); remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); foreach ( $results as $theme => $result ) { if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) { continue; } unset( $past_failure_emails[ $theme ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); return $results; } public function check_package( $source ) { global $wp_filesystem, $wp_version; $this->new_theme_data = array(); if ( is_wp_error( $source ) ) { return $source; } $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { return $source; } if ( ! file_exists( $working_directory . 'style.css' ) ) { return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], sprintf( __( 'The theme is missing the %s stylesheet.' ), 'style.css' ) ); } $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Version' => 'Version', 'Author' => 'Author', 'Template' => 'Template', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', ) ); if ( empty( $info['Name'] ) ) { return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], sprintf( __( 'The %s stylesheet does not contain a valid theme header.' ), 'style.css' ) ); } if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) && ! file_exists( $working_directory . 'templates/index.html' ) && ! file_exists( $working_directory . 'block-templates/index.html' ) ) { return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], sprintf( __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. Child themes need to have a %4$s header in the %5$s stylesheet.' ), 'templates/index.html', 'index.php', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), 'Template', 'style.css' ) ); } $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; if ( ! is_php_version_compatible( $requires_php ) ) { $error = sprintf( __( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ), phpversion(), $requires_php ); return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); } if ( ! is_wp_version_compatible( $requires_wp ) ) { $error = sprintf( __( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ), $wp_version, $requires_wp ); return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); } $this->new_theme_data = $info; return $source; } public function current_before( $response, $theme ) { if ( is_wp_error( $response ) ) { return $response; } $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; if ( get_stylesheet() !== $theme ) { return $response; } if ( ! $this->bulk ) { $this->maintenance_mode( true ); } return $response; } public function current_after( $response, $theme ) { if ( is_wp_error( $response ) ) { return $response; } $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; if ( get_stylesheet() !== $theme ) { return $response; } if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) { wp_clean_themes_cache(); $stylesheet = $this->result['destination_name']; switch_theme( $stylesheet ); } if ( ! $this->bulk ) { $this->maintenance_mode( false ); } return $response; } public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) { global $wp_filesystem; if ( is_wp_error( $removed ) ) { return $removed; } if ( ! isset( $theme['theme'] ) ) { return $removed; } $theme = $theme['theme']; $themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) ); if ( $wp_filesystem->exists( $themes_dir . $theme ) ) { if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) { return false; } } return true; } public function theme_info( $theme = null ) { if ( empty( $theme ) ) { if ( ! empty( $this->result['destination_name'] ) ) { $theme = $this->result['destination_name']; } else { return false; } } $theme = wp_get_theme( $theme ); $theme->cache_delete(); return $theme; } } array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array(), ), ); $theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true, 'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true, 'tags' => true, 'num_ratings' => true, ); function install_themes_feature_list() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' ); $cache = get_transient( 'wporg_theme_feature_list' ); if ( ! $cache ) { set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); } if ( $cache ) { return $cache; } $feature_list = themes_api( 'feature_list', array() ); if ( is_wp_error( $feature_list ) ) { return array(); } set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); return $feature_list; } function install_theme_search_form( $type_selector = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; if ( ! $type_selector ) { echo '

            ' . __( 'Search for themes by keyword.' ) . '

            '; } ?> -
            - - - - - - - - - - -
            - -

            -

            - -
            - - '; foreach ( (array) $feature_list as $feature_name => $features ) { $feature_name = esc_html( $feature_name ); echo '
            ' . $feature_name . '
            '; echo '
              '; foreach ( $features as $feature => $feature_name ) { $feature_name = esc_html( $feature_name ); $feature = esc_attr( $feature ); ?> - -
            1. - - -
            2. - - -
            -
            - - - -
            - -
            - -

            -
            - - - - -
            - prepare_items(); $wp_list_table->single_row( $theme ); } function display_themes() { global $wp_list_table; if ( ! isset( $wp_list_table ) ) { $wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' ); } $wp_list_table->prepare_items(); $wp_list_table->display(); } function install_theme_information() { global $wp_list_table; $theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) ); if ( is_wp_error( $theme ) ) { wp_die( $theme ); } iframe_header( __( 'Theme Installation' ) ); if ( ! isset( $wp_list_table ) ) { $wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' ); } $wp_list_table->theme_installer_single( $theme ); iframe_footer(); exit; } 'bookmarks', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'manage_links' ); } public function prepare_items() { global $cat_id, $s, $orderby, $order; wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) ); $args = array( 'hide_invisible' => 0, 'hide_empty' => 0, ); if ( 'all' !== $cat_id ) { $args['category'] = $cat_id; } if ( ! empty( $s ) ) { $args['search'] = $s; } if ( ! empty( $orderby ) ) { $args['orderby'] = $orderby; } if ( ! empty( $order ) ) { $args['order'] = $order; } $this->items = get_bookmarks( $args ); } public function no_items() { _e( 'No links found.' ); } protected function get_bulk_actions() { $actions = array(); $actions['delete'] = __( 'Delete' ); return $actions; } protected function extra_tablenav( $which ) { global $cat_id; if ( 'top' !== $which ) { return; } ?> -
            - $cat_id, 'name' => 'cat_id', 'taxonomy' => 'link_category', 'show_option_all' => get_taxonomy( 'link_category' )->labels->all_items, 'hide_empty' => true, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', ); echo ''; wp_dropdown_categories( $dropdown_options ); submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); ?> -
            - '', 'name' => _x( 'Name', 'link name' ), 'url' => __( 'URL' ), 'categories' => __( 'Categories' ), 'rel' => __( 'Relationship' ), 'visible' => __( 'Visible' ), 'rating' => __( 'Rating' ), ); } protected function get_sortable_columns() { return array( 'name' => 'name', 'url' => 'url', 'visible' => 'visible', 'rating' => 'rating', ); } protected function get_default_primary_column_name() { return 'name'; } public function column_cb( $item ) { $link = $item; ?> - - - %s', $edit_link, esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ), $link->link_name ); } public function column_url( $link ) { $short_url = url_shorten( $link->link_url ); echo "$short_url"; } public function column_categories( $link ) { global $cat_id; $cat_names = array(); foreach ( $link->link_category as $category ) { $cat = get_term( $category, 'link_category', OBJECT, 'display' ); if ( is_wp_error( $cat ) ) { echo $cat->get_error_message(); } $cat_name = $cat->name; if ( (int) $cat_id !== $category ) { $cat_name = "$cat_name"; } $cat_names[] = $cat_name; } echo implode( ', ', $cat_names ); } public function column_rel( $link ) { echo empty( $link->link_rel ) ? '
            ' : $link->link_rel; } public function column_visible( $link ) { if ( 'Y' === $link->link_visible ) { _e( 'Yes' ); } else { _e( 'No' ); } } public function column_rating( $link ) { echo $link->link_rating; } public function column_default( $item, $column_name ) { do_action( 'manage_link_custom_column', $column_name, $item->link_id ); } public function display_rows() { foreach ( $this->items as $link ) { $link = sanitize_bookmark( $link ); $link->link_name = esc_attr( $link->link_name ); $link->link_category = wp_get_link_cats( $link->link_id ); ?> - - single_row_columns( $link ); ?> - - ' . __( 'Edit' ) . ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ), esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ), __( 'Delete' ) ); return $this->row_actions( $actions ); } } '', 'nonce' => '', 'title' => '', 'context' => false, ); $this->options = wp_parse_args( $args, $defaults ); } public function set_upgrader( &$upgrader ) { if ( is_object( $upgrader ) ) { $this->upgrader =& $upgrader; } $this->add_strings(); } public function add_strings() { } public function set_result( $result ) { $this->result = $result; } public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) { $url = $this->options['url']; if ( ! $context ) { $context = $this->options['context']; } if ( ! empty( $this->options['nonce'] ) ) { $url = wp_nonce_url( $url, $this->options['nonce'] ); } $extra_fields = array(); return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership ); } public function header() { if ( $this->done_header ) { return; } $this->done_header = true; echo '
            '; echo '

            ' . $this->options['title'] . '

            '; } public function footer() { if ( $this->done_footer ) { return; } $this->done_footer = true; echo '
            '; } public function error( $errors ) { if ( ! $this->done_header ) { $this->header(); } if ( is_string( $errors ) ) { $this->feedback( $errors ); } elseif ( is_wp_error( $errors ) && $errors->has_errors() ) { foreach ( $errors->get_error_messages() as $message ) { if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { $this->feedback( $message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); } else { $this->feedback( $message ); } } } } public function feedback( $feedback, ...$args ) { if ( isset( $this->upgrader->strings[ $feedback ] ) ) { $feedback = $this->upgrader->strings[ $feedback ]; } if ( strpos( $feedback, '%' ) !== false ) { if ( $args ) { $args = array_map( 'strip_tags', $args ); $args = array_map( 'esc_html', $args ); $feedback = vsprintf( $feedback, $args ); } } if ( empty( $feedback ) ) { return; } show_message( $feedback ); } public function before() {} public function after() {} protected function decrement_update_count( $type ) { if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { echo ''; } else { echo ''; } } public function bulk_header() {} public function bulk_footer() {} public function hide_process_failed( $wp_error ) { return false; } } per_page ) ) { $args->per_page = 24; } } if ( ! isset( $args->locale ) ) { $args->locale = get_user_locale(); } if ( ! isset( $args->wp_version ) ) { $args->wp_version = substr( $wp_version, 0, 3 ); } $args = apply_filters( 'plugins_api_args', $args, $action ); $res = apply_filters( 'plugins_api', false, $action, $args ); if ( false === $res ) { $url = 'http://api.wordpress.org/plugins/info/1.2/'; $url = add_query_arg( array( 'action' => $action, 'request' => $args, ), $url ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $http_args = array( 'timeout' => 15, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); $request = wp_remote_get( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { if ( ! wp_is_json_request() ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); } $request = wp_remote_get( $http_url, $http_args ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'plugins_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( is_array( $res ) ) { $res = (object) $res; } elseif ( null === $res ) { $res = new WP_Error( 'plugins_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } if ( isset( $res->error ) ) { $res = new WP_Error( 'plugins_api_failed', $res->error ); } } } elseif ( ! is_wp_error( $res ) ) { $res->external = true; } return apply_filters( 'plugins_api_result', $res, $action, $args ); } function install_popular_tags( $args = array() ) { $key = md5( serialize( $args ) ); $tags = get_site_transient( 'poptags_' . $key ); if ( false !== $tags ) { return $tags; } $tags = plugins_api( 'hot_tags', $args ); if ( is_wp_error( $tags ) ) { return $tags; } set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS ); return $tags; } function install_dashboard() { display_plugins_table(); ?> - - '; } function install_search_form( $deprecated = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; ?> -
            - - - - - - 'search-submit' ) ); ?> -
            - -
            -

            -
            - - - - -
            -
            - -

            -
            - -

            - - - - -

            -
            - ' . __( 'You are using a development version of WordPress. These feature plugins are also under development. Learn more.' ) . '

            ', 'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/' ); break; case 'install_plugins_featured': printf( '

            ' . __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the WordPress Plugin Directory or upload a plugin in .zip format by clicking the button at the top of this page.' ) . '

            ', __( 'https://wordpress.org/plugins/' ) ); break; case 'install_plugins_recommended': echo '

            ' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '

            '; break; case 'install_plugins_favorites': if ( empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) { return; } break; } ?> -
            - display(); ?> -
            - response ) ) { foreach ( (array) $update_plugins->response as $file => $plugin ) { if ( $plugin->slug === $api->slug ) { $status = 'update_available'; $update_file = $file; $version = $plugin->new_version; if ( current_user_can( 'update_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $update_file ), 'upgrade-plugin_' . $update_file ); } break; } } } if ( 'install' === $status ) { if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) { $installed_plugin = get_plugins( '/' . $api->slug ); if ( empty( $installed_plugin ) ) { if ( current_user_can( 'install_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug ); } } else { $key = array_keys( $installed_plugin ); $key = reset( $key ); $update_file = $api->slug . '/' . $key; if ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '=' ) ) { $status = 'latest_installed'; } elseif ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '<' ) ) { $status = 'newer_installed'; $version = $installed_plugin[ $key ]['Version']; } else { if ( ! $loop ) { delete_site_transient( 'update_plugins' ); wp_update_plugins(); return install_plugin_install_status( $api, true ); } } } } else { if ( current_user_can( 'install_plugins' ) ) { $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug ); } } } if ( isset( $_GET['from'] ) ) { $url .= '&from=' . urlencode( wp_unslash( $_GET['from'] ) ); } $file = $update_file; return compact( 'status', 'url', 'version', 'file' ); } function install_plugin_information() { global $tab; if ( empty( $_REQUEST['plugin'] ) ) { return; } $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), ) ); if ( is_wp_error( $api ) ) { wp_die( $api ); } $plugins_allowedtags = array( 'a' => array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 'p' => array(), 'br' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array(), ), 'blockquote' => array( 'cite' => true ), ); $plugins_section_titles = array( 'description' => _x( 'Description', 'Plugin installer section title' ), 'installation' => _x( 'Installation', 'Plugin installer section title' ), 'faq' => _x( 'FAQ', 'Plugin installer section title' ), 'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ), 'changelog' => _x( 'Changelog', 'Plugin installer section title' ), 'reviews' => _x( 'Reviews', 'Plugin installer section title' ), 'other_notes' => _x( 'Other Notes', 'Plugin installer section title' ), ); foreach ( (array) $api->sections as $section_name => $content ) { $api->sections[ $section_name ] = wp_kses( $content, $plugins_allowedtags ); } foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) { if ( isset( $api->$key ) ) { $api->$key = wp_kses( $api->$key, $plugins_allowedtags ); } } $_tab = esc_attr( $tab ); $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) { $section_titles = array_keys( (array) $api->sections ); $section = reset( $section_titles ); } iframe_header( __( 'Plugin Installation' ) ); $_with_banner = ''; if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) { $_with_banner = 'with-banner'; $low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low']; $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high']; ?> - - '; echo "

            {$api->name}

            "; echo "
            \n"; foreach ( (array) $api->sections as $section_name => $content ) { if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) { continue; } if ( isset( $plugins_section_titles[ $section_name ] ) ) { $title = $plugins_section_titles[ $section_name ]; } else { $title = ucwords( str_replace( '_', ' ', $section_name ) ); } $class = ( $section_name === $section ) ? ' class="current"' : ''; $href = add_query_arg( array( 'tab' => $tab, 'section' => $section_name, ) ); $href = esc_url( $href ); $san_section = esc_attr( $section_name ); echo "\t$title\n"; } echo "
            \n"; ?> -
            -
            -
              - version ) ) { ?> -
            • version; ?>
            • - author ) ) { ?> -
            • author, '_blank' ); ?>
            • - last_updated ) ) { ?> -
            • - last_updated ) ) ); ?> -
            • - requires ) ) { ?> -
            • - - requires ); ?> -
            • - tested ) ) { ?> -
            • tested; ?>
            • - requires_php ) ) { ?> -
            • - - requires_php ); ?> -
            • - active_installs ) ) { ?> -
            • - active_installs >= 1000000 ) { $active_installs_millions = floor( $api->active_installs / 1000000 ); printf( _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), number_format_i18n( $active_installs_millions ) ); } elseif ( $api->active_installs < 10 ) { _ex( 'Less Than 10', 'Active plugin installations' ); } else { echo number_format_i18n( $api->active_installs ) . '+'; } ?> -
            • - slug ) && empty( $api->external ) ) { ?> -
            • - homepage ) ) { ?> -
            • - donate_link ) && empty( $api->contributors ) ) { ?> -
            • - -
            - rating ) ) { ?> -

            - $api->rating, 'type' => 'percent', 'number' => $api->num_ratings, ) ); ?> - - ratings ) && array_sum( (array) $api->ratings ) > 0 ) { ?> -

            -

            - ratings as $key => $ratecount ) { $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0; $aria_label = esc_attr( sprintf( _n( 'Reviews with %1$d star: %2$s. Opens in a new tab.', 'Reviews with %1$d stars: %2$s. Opens in a new tab.', $key ), $key, number_format_i18n( $ratecount ) ) ); ?> -
            - - %s', "https://wordpress.org/support/plugin/{$api->slug}/reviews/?filter={$key}", $aria_label, sprintf( _n( '%d star', '%d stars', $key ), $key ) ); ?> - - - - - -
            - contributors ) ) { ?> -

            -
              - contributors as $contrib_username => $contrib_details ) { $contrib_name = $contrib_details['display_name']; if ( ! $contrib_name ) { $contrib_name = $contrib_username; } $contrib_name = esc_html( $contrib_name ); $contrib_profile = esc_url( $contrib_details['profile'] ); $contrib_avatar = esc_url( add_query_arg( 's', '36', $contrib_details['avatar'] ) ); echo "
            • {$contrib_name}
            • "; } ?> -
            - donate_link ) ) { ?> - - - -
            -
            - requires_php ) ? $api->requires_php : null; $requires_wp = isset( $api->requires ) ? $api->requires : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); $tested_wp = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) ); if ( ! $compatible_php ) { echo '

            '; _e( 'Error: This plugin requires a newer version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Click here to learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } else { echo '

            '; } echo '
            '; } if ( ! $tested_wp ) { echo '

            '; _e( 'Warning: This plugin has not been tested with your current version of WordPress.' ); echo '

            '; } elseif ( ! $compatible_wp ) { echo '

            '; _e( 'Error: This plugin requires a newer version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Click here to update WordPress.' ), self_admin_url( 'update-core.php' ) ); } echo '

            '; } foreach ( (array) $api->sections as $section_name => $content ) { $content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' ); $content = links_add_target( $content, '_blank' ); $san_section = esc_attr( $section_name ); $display = ( $section_name === $section ) ? 'block' : 'none'; echo "\t
            \n"; echo $content; echo "\t
            \n"; } echo "
            \n"; echo "
            \n"; echo "\n"; echo "\n"; iframe_footer(); exit; } get_items_per_page( 'users_network_per_page' ); $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; $paged = $this->get_pagenum(); $args = array( 'number' => $users_per_page, 'offset' => ( $paged - 1 ) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta', ); if ( wp_is_large_network( 'users' ) ) { $args['search'] = ltrim( $args['search'], '*' ); } elseif ( '' !== $args['search'] ) { $args['search'] = trim( $args['search'], '*' ); $args['search'] = '*' . $args['search'] . '*'; } if ( 'super' === $role ) { $args['login__in'] = get_super_admins(); } if ( ! $usersearch && wp_is_large_network( 'users' ) ) { if ( ! isset( $_REQUEST['orderby'] ) ) { $_GET['orderby'] = 'id'; $_REQUEST['orderby'] = 'id'; } if ( ! isset( $_REQUEST['order'] ) ) { $_GET['order'] = 'DESC'; $_REQUEST['order'] = 'DESC'; } $args['count_total'] = false; } if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } $args = apply_filters( 'users_list_table_query_args', $args ); $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); $this->set_pagination_args( array( 'total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page, ) ); } protected function get_bulk_actions() { $actions = array(); if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete' ); } $actions['spam'] = _x( 'Mark as spam', 'user' ); $actions['notspam'] = _x( 'Not spam', 'user' ); return $actions; } public function no_items() { _e( 'No users found.' ); } protected function get_views() { global $role; $total_users = get_user_count(); $super_admins = get_super_admins(); $total_admins = count( $super_admins ); $current_link_attributes = 'super' !== $role ? ' class="current" aria-current="page"' : ''; $role_links = array(); $role_links['all'] = sprintf( '%s', network_admin_url( 'users.php' ), $current_link_attributes, sprintf( _nx( 'All (%s)', 'All (%s)', $total_users, 'users' ), number_format_i18n( $total_users ) ) ); $current_link_attributes = 'super' === $role ? ' class="current" aria-current="page"' : ''; $role_links['super'] = sprintf( '%s', network_admin_url( 'users.php?role=super' ), $current_link_attributes, sprintf( _n( 'Super Admin (%s)', 'Super Admins (%s)', $total_admins ), number_format_i18n( $total_admins ) ) ); return $role_links; } protected function pagination( $which ) { global $mode; parent::pagination( $which ); if ( 'top' === $which ) { $this->view_switcher( $mode ); } } public function get_columns() { $users_columns = array( 'cb' => '', 'username' => __( 'Username' ), 'name' => __( 'Name' ), 'email' => __( 'Email' ), 'registered' => _x( 'Registered', 'user' ), 'blogs' => __( 'Sites' ), ); return apply_filters( 'wpmu_users_columns', $users_columns ); } protected function get_sortable_columns() { return array( 'username' => 'login', 'name' => 'name', 'email' => 'email', 'registered' => 'id', ); } public function column_cb( $item ) { $user = $item; if ( is_super_admin( $user->ID ) ) { return; } ?> - - - ID; } public function column_username( $user ) { $super_admins = get_super_admins(); $avatar = get_avatar( $user->user_email, 32 ); echo $avatar; if ( current_user_can( 'edit_user', $user->ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $edit = "{$user->user_login}"; } else { $edit = $user->user_login; } ?> - - user_login, $super_admins, true ) ) { echo ' — ' . __( 'Super Admin' ); } ?> - - first_name && $user->last_name ) { echo "$user->first_name $user->last_name"; } elseif ( $user->first_name ) { echo $user->first_name; } elseif ( $user->last_name ) { echo $user->last_name; } else { echo '' . _x( 'Unknown', 'name' ) . ''; } } public function column_email( $user ) { echo "$user->user_email"; } public function column_registered( $user ) { global $mode; if ( 'list' === $mode ) { $date = __( 'Y/m/d' ); } else { $date = __( 'Y/m/d g:i:s a' ); } echo mysql2date( $date, $user->user_registered ); } protected function _column_blogs( $user, $classes, $data, $primary ) { echo ''; echo $this->column_blogs( $user ); echo $this->handle_row_actions( $user, 'blogs', $primary ); echo ''; } public function column_blogs( $user ) { $blogs = get_blogs_of_user( $user->ID, true ); if ( ! is_array( $blogs ) ) { return; } foreach ( $blogs as $site ) { if ( ! can_edit_network( $site->site_id ) ) { continue; } $path = ( '/' === $site->path ) ? '' : $site->path; $site_classes = array( 'site-' . $site->site_id ); $site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $site->userblog_id, $site->site_id, $user ); if ( is_array( $site_classes ) && ! empty( $site_classes ) ) { $site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) ); echo ''; } else { echo ''; } echo '' . str_replace( '.' . get_network()->domain, '', $site->domain . $path ) . ''; echo ' '; $actions = array(); $actions['edit'] = '' . __( 'Edit' ) . ''; $class = ''; if ( 1 === (int) $site->spam ) { $class .= 'site-spammed '; } if ( 1 === (int) $site->mature ) { $class .= 'site-mature '; } if ( 1 === (int) $site->deleted ) { $class .= 'site-deleted '; } if ( 1 === (int) $site->archived ) { $class .= 'site-archived '; } $actions['view'] = '' . __( 'View' ) . ''; $actions = apply_filters( 'ms_user_list_site_actions', $actions, $site->userblog_id ); $action_count = count( $actions ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; $sep = ( $i < $action_count ) ? ' | ' : ''; echo "$link$sep"; } echo '
            '; } } public function column_default( $item, $column_name ) { echo apply_filters( 'manage_users_custom_column', '', $column_name, $item->ID ); } public function display_rows() { foreach ( $this->items as $user ) { $class = ''; $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted', ); foreach ( $status_list as $status => $col ) { if ( $user->$status ) { $class .= " $col"; } } ?> - - single_row_columns( $user ); ?> - - ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $actions['edit'] = '' . __( 'Edit' ) . ''; } if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) { $actions['delete'] = '' . __( 'Delete' ) . ''; } $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); return $this->row_actions( $actions ); } } get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments - WHERE comment_author = %s AND $date_field = %s", stripslashes( $comment_author ), stripslashes( $comment_date ) ) ); } function edit_comment() { if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) { wp_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) ); } if ( isset( $_POST['newcomment_author'] ) ) { $_POST['comment_author'] = $_POST['newcomment_author']; } if ( isset( $_POST['newcomment_author_email'] ) ) { $_POST['comment_author_email'] = $_POST['newcomment_author_email']; } if ( isset( $_POST['newcomment_author_url'] ) ) { $_POST['comment_author_url'] = $_POST['newcomment_author_url']; } if ( isset( $_POST['comment_status'] ) ) { $_POST['comment_approved'] = $_POST['comment_status']; } if ( isset( $_POST['content'] ) ) { $_POST['comment_content'] = $_POST['content']; } if ( isset( $_POST['comment_ID'] ) ) { $_POST['comment_ID'] = (int) $_POST['comment_ID']; } foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) { if ( ! empty( $_POST[ 'hidden_' . $timeunit ] ) && $_POST[ 'hidden_' . $timeunit ] !== $_POST[ $timeunit ] ) { $_POST['edit_date'] = '1'; break; } } if ( ! empty( $_POST['edit_date'] ) ) { $aa = $_POST['aa']; $mm = $_POST['mm']; $jj = $_POST['jj']; $hh = $_POST['hh']; $mn = $_POST['mn']; $ss = $_POST['ss']; $jj = ( $jj > 31 ) ? 31 : $jj; $hh = ( $hh > 23 ) ? $hh - 24 : $hh; $mn = ( $mn > 59 ) ? $mn - 60 : $mn; $ss = ( $ss > 59 ) ? $ss - 60 : $ss; $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; } return wp_update_comment( $_POST, true ); } function get_comment_to_edit( $id ) { $comment = get_comment( $id ); if ( ! $comment ) { return false; } $comment->comment_ID = (int) $comment->comment_ID; $comment->comment_post_ID = (int) $comment->comment_post_ID; $comment->comment_content = format_to_edit( $comment->comment_content ); $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); $comment->comment_author = format_to_edit( $comment->comment_author ); $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); $comment->comment_author_url = esc_url( $comment->comment_author_url ); return $comment; } function get_pending_comments_num( $post_id ) { global $wpdb; $single = false; if ( ! is_array( $post_id ) ) { $post_id_array = (array) $post_id; $single = true; } else { $post_id_array = $post_id; } $post_id_array = array_map( 'intval', $post_id_array ); $post_id_in = "'" . implode( "', '", $post_id_array ) . "'"; $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A ); if ( $single ) { if ( empty( $pending ) ) { return 0; } else { return absint( $pending[0]['num_comments'] ); } } $pending_keyed = array(); foreach ( $post_id_array as $id ) { $pending_keyed[ $id ] = 0; } if ( ! empty( $pending ) ) { foreach ( $pending as $pend ) { $pending_keyed[ $pend['comment_post_ID'] ] = absint( $pend['num_comments'] ); } } return $pending_keyed; } function floated_admin_avatar( $name ) { $avatar = get_avatar( get_comment(), 32, 'mystery' ); return "$avatar $name"; } function enqueue_comment_hotkeys_js() { if ( 'true' === get_user_option( 'comment_shortcuts' ) ) { wp_enqueue_script( 'jquery-table-hotkeys' ); } } function comment_footer_die( $msg ) { echo "

            $msg

            "; require_once ABSPATH . 'wp-admin/admin-footer.php'; die; } $object_id, 'post_title' => get_the_title( $object_id ), 'post_type' => get_post_type( $object_id ), ) ); echo "\n"; } } } elseif ( taxonomy_exists( $object_type ) ) { if ( isset( $request['ID'] ) ) { $object_id = (int) $request['ID']; if ( 'markup' === $response_format ) { echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { $post_obj = get_term( $object_id, $object_type ); echo wp_json_encode( array( 'ID' => $object_id, 'post_title' => $post_obj->name, 'post_type' => $object_type, ) ); echo "\n"; } } } } elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) { if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) { $post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) ); $args = array_merge( $args, array( 'no_found_rows' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'posts_per_page' => 10, 'post_type' => $matches[2], 's' => $query, ) ); if ( isset( $post_type_obj->_default_query ) ) { $args = array_merge( $args, (array) $post_type_obj->_default_query ); } $search_results_query = new WP_Query( $args ); if ( ! $search_results_query->have_posts() ) { return; } while ( $search_results_query->have_posts() ) { $post = $search_results_query->next_post(); if ( 'markup' === $response_format ) { $var_by_ref = $post->ID; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { echo wp_json_encode( array( 'ID' => $post->ID, 'post_title' => get_the_title( $post->ID ), 'post_type' => $matches[2], ) ); echo "\n"; } } } elseif ( 'taxonomy' === $matches[1] ) { $terms = get_terms( array( 'taxonomy' => $matches[2], 'name__like' => $query, 'number' => 10, 'hide_empty' => false, ) ); if ( empty( $terms ) || is_wp_error( $terms ) ) { return; } foreach ( (array) $terms as $term ) { if ( 'markup' === $response_format ) { echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args ); } elseif ( 'json' === $response_format ) { echo wp_json_encode( array( 'ID' => $term->term_id, 'post_title' => $term->name, 'post_type' => $matches[2], ) ); echo "\n"; } } } } } function wp_nav_menu_setup() { wp_nav_menu_post_type_meta_boxes(); add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); wp_nav_menu_taxonomy_meta_boxes(); add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { $user = wp_get_current_user(); update_user_meta( $user->ID, 'managenav-menuscolumnshidden', array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', 4 => 'title-attribute', ) ); } } function wp_initial_nav_menu_meta_boxes() { global $wp_meta_boxes; if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array( $wp_meta_boxes ) ) { return; } $initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' ); $hidden_meta_boxes = array(); foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) { foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) { foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) { if ( in_array( $box['id'], $initial_meta_boxes, true ) ) { unset( $box['id'] ); } else { $hidden_meta_boxes[] = $box['id']; } } } } $user = wp_get_current_user(); update_user_meta( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes ); } function wp_nav_menu_post_type_meta_boxes() { $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); if ( ! $post_types ) { return; } foreach ( $post_types as $post_type ) { $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); if ( $post_type ) { $id = $post_type->name; $priority = ( 'page' === $post_type->name ? 'core' : 'default' ); add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type ); } } } function wp_nav_menu_taxonomy_meta_boxes() { $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' ); if ( ! $taxonomies ) { return; } foreach ( $taxonomies as $tax ) { $tax = apply_filters( 'nav_menu_meta_box_object', $tax ); if ( $tax ) { $id = $tax->name; add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax ); } } } function wp_nav_menu_disabled_check( $nav_menu_selected_id, $display = true ) { global $one_theme_location_no_menus; if ( $one_theme_location_no_menus ) { return false; } return disabled( $nav_menu_selected_id, 0, $display ); } function wp_nav_menu_item_link_meta_box() { global $_nav_menu_placeholder, $nav_menu_selected_id; $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1; ?> -
            - - - - - -

            - - class="button submit-add-to-menu right" value="" name="add-custom-menu-item" id="submit-customlinkdiv" /> - - -

            - -
            - name; $post_type = get_post_type_object( $post_type_name ); $tab_name = $post_type_name . '-tab'; $per_page = 50; $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'title', 'posts_per_page' => $per_page, 'post_type' => $post_type_name, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, ); if ( isset( $box['args']->_default_query ) ) { $args = array_merge( $args, (array) $box['args']->_default_query ); } $important_pages = array(); if ( 'page' === $post_type_name ) { $suppress_page_ids = array(); $front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0; $front_page_obj = null; if ( ! empty( $front_page ) ) { $front_page_obj = get_post( $front_page ); $front_page_obj->front_or_home = true; $important_pages[] = $front_page_obj; $suppress_page_ids[] = $front_page_obj->ID; } else { $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; $front_page_obj = (object) array( 'front_or_home' => true, 'ID' => 0, 'object_id' => $_nav_menu_placeholder, 'post_content' => '', 'post_excerpt' => '', 'post_parent' => '', 'post_title' => _x( 'Home', 'nav menu home label' ), 'post_type' => 'nav_menu_item', 'type' => 'custom', 'url' => home_url( '/' ), ); $important_pages[] = $front_page_obj; } $posts_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0; if ( ! empty( $posts_page ) ) { $posts_page_obj = get_post( $posts_page ); $posts_page_obj->posts_page = true; $important_pages[] = $posts_page_obj; $suppress_page_ids[] = $posts_page_obj->ID; } $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! empty( $privacy_policy_page_id ) ) { $privacy_policy_page = get_post( $privacy_policy_page_id ); if ( $privacy_policy_page instanceof WP_Post && 'publish' === $privacy_policy_page->post_status ) { $privacy_policy_page->privacy_policy_page = true; $important_pages[] = $privacy_policy_page; $suppress_page_ids[] = $privacy_policy_page->ID; } } if ( ! empty( $suppress_page_ids ) ) { $args['post__not_in'] = $suppress_page_ids; } } $get_posts = new WP_Query; $posts = $get_posts->query( $args ); if ( ! $get_posts->post_count ) { if ( ! empty( $suppress_page_ids ) ) { unset( $args['post__not_in'] ); $get_posts = new WP_Query; $posts = $get_posts->query( $args ); } else { echo '

            ' . __( 'No items.' ) . '

            '; return; } } elseif ( ! empty( $important_pages ) ) { $posts = array_merge( $important_pages, $posts ); } $num_pages = $get_posts->max_num_pages; $page_links = paginate_links( array( 'base' => add_query_arg( array( $tab_name => 'all', 'paged' => '%#%', 'item-type' => 'post_type', 'item-object' => $post_type_name, ) ), 'format' => '', 'prev_text' => '' . __( '«' ) . '', 'next_text' => '' . __( '»' ) . '', 'before_page_number' => '' . __( 'Page' ) . ' ', 'total' => $num_pages, 'current' => $pagenum, ) ); $db_fields = false; if ( is_post_type_hierarchical( $post_type_name ) ) { $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID', ); } $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-recent'; if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'search' ), true ) ) { $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $most_recent_url = ''; $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { $most_recent_url = esc_url( add_query_arg( $tab_name, 'most-recent', remove_query_arg( $removed_args ) ) ); $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?> -
            - - -
            -
              - 'post_date', 'order' => 'DESC', 'posts_per_page' => 15, ) ); $most_recent = $get_posts->query( $recent_args ); $args['walker'] = $walker; $most_recent = apply_filters( "nav_menu_items_{$post_type_name}_recent", $most_recent, $args, $box, $recent_args ); echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $most_recent ), 0, (object) $args ); ?> -
            -
            - - - -
            - - - -
              - has_archive ) { $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; array_unshift( $posts, (object) array( 'ID' => 0, 'object_id' => $_nav_menu_placeholder, 'object' => $post_type_name, 'post_content' => '', 'post_excerpt' => '', 'post_title' => $post_type->labels->archives, 'post_type' => 'nav_menu_item', 'type' => 'post_type_archive', 'url' => get_post_type_archive_link( $post_type_name ), ) ); } $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type ); $checkbox_items = walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $posts ), 0, (object) $args ); echo $checkbox_items; ?> -
            - - - -
            - -

            - - id="" class="select-all" /> - - - - - class="button submit-add-to-menu right" value="" name="add-post-type-menu-item" id="" /> - - -

            - -
            - name; $taxonomy = get_taxonomy( $taxonomy_name ); $tab_name = $taxonomy_name . '-tab'; $per_page = 50; $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'taxonomy' => $taxonomy_name, 'child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'number' => $per_page, 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'name', 'pad_counts' => false, ); $terms = get_terms( $args ); if ( ! $terms || is_wp_error( $terms ) ) { echo '

            ' . __( 'No items.' ) . '

            '; return; } $num_pages = ceil( wp_count_terms( array_merge( $args, array( 'number' => '', 'offset' => '', ) ) ) / $per_page ); $page_links = paginate_links( array( 'base' => add_query_arg( array( $tab_name => 'all', 'paged' => '%#%', 'item-type' => 'taxonomy', 'item-object' => $taxonomy_name, ) ), 'format' => '', 'prev_text' => '' . __( '«' ) . '', 'next_text' => '' . __( '»' ) . '', 'before_page_number' => '' . __( 'Page' ) . ' ', 'total' => $num_pages, 'current' => $pagenum, ) ); $db_fields = false; if ( is_taxonomy_hierarchical( $taxonomy_name ) ) { $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', ); } $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-used'; if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'most-used', 'search' ), true ) ) { $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $most_used_url = ''; $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { $most_used_url = esc_url( add_query_arg( $tab_name, 'most-used', remove_query_arg( $removed_args ) ) ); $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?> -
            - - -
            -
              - $taxonomy_name, 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false, ) ); $args['walker'] = $walker; echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $popular_terms ), 0, (object) $args ); ?> -
            -
            - -
            - - - -
              - -
            - - - -
            - -
            - $taxonomy_name, 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false, ) ); } else { $searched = ''; $search_results = array(); } ?> -

            - - - - 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?> -

            - -
              - - - -
            • get_error_message(); ?>
            • - -
            • - -
            -
            - -

            - - id="" class="select-all" /> - - - - - class="button submit-add-to-menu right" value="" name="add-taxonomy-menu-item" id="" /> - - -

            - -
            - $_item_object_data ) { if ( empty( $_item_object_data['menu-item-object-id'] ) && ( ! isset( $_item_object_data['menu-item-type'] ) || in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) || ! ( 'custom' === $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || ! empty( $_item_object_data['menu-item-db-id'] ) ) ) { continue; } if ( empty( $_item_object_data['menu-item-db-id'] ) || ( 0 > $_possible_db_id ) || $_possible_db_id != $_item_object_data['menu-item-db-id'] ) { $_actual_db_id = 0; } else { $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; } $args = array( 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ), 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ), 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ), 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ), 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ), 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ), 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ), 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ), 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ), 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ), 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ), 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ), ); $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args ); } } return $items_saved; } function _wp_nav_menu_meta_box_object( $data_object = null ) { if ( isset( $data_object->name ) ) { if ( 'page' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'menu_order title', 'post_status' => 'publish', ); } elseif ( 'post' === $data_object->name ) { $data_object->_default_query = array( 'post_status' => 'publish', ); } elseif ( 'category' === $data_object->name ) { $data_object->_default_query = array( 'orderby' => 'id', 'order' => 'DESC', ); } else { $data_object->_default_query = array( 'post_status' => 'publish', ); } } return $data_object; } function wp_get_nav_menu_to_edit( $menu_id = 0 ) { $menu = wp_get_nav_menu_object( $menu_id ); if ( is_nav_menu( $menu ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'post_status' => 'any' ) ); $result = '
            ' : '">'; $result .= '

            ' . __( 'Add menu items from the column on the left.' ) . '

            '; $result .= '
            '; if ( empty( $menu_items ) ) { return $result . ' '; } $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); if ( class_exists( $walker_class_name ) ) { $walker = new $walker_class_name; } else { return new WP_Error( 'menu_walker_not_exist', sprintf( __( 'The Walker class named %s does not exist.' ), '' . $walker_class_name . '' ) ); } $some_pending_menu_items = false; $some_invalid_menu_items = false; foreach ( (array) $menu_items as $menu_item ) { if ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { $some_pending_menu_items = true; } if ( ! empty( $menu_item->_invalid ) ) { $some_invalid_menu_items = true; } } if ( $some_pending_menu_items ) { $result .= '

            ' . __( 'Click Save Menu to make pending menu items public.' ) . '

            '; } if ( $some_invalid_menu_items ) { $result .= '

            ' . __( 'There are some invalid menu items. Please check or delete them.' ) . '

            '; } $result .= ' '; return $result; } elseif ( is_wp_error( $menu ) ) { return $menu; } } function wp_nav_menu_manage_columns() { return array( '_title' => __( 'Show advanced menu properties' ), 'cb' => '', 'link-target' => __( 'Link Target' ), 'title-attribute' => __( 'Title Attribute' ), 'css-classes' => __( 'CSS Classes' ), 'xfn' => __( 'Link Relationship (XFN)' ), 'description' => __( 'Description' ), ); } function _wp_delete_orphaned_draft_menu_items() { global $wpdb; $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); $menu_items_to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < %d", $delete_timestamp ) ); foreach ( (array) $menu_items_to_delete as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) { $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish', ) ); $messages = array(); $menu_items = array(); foreach ( $unsorted_menu_items as $_item ) { $menu_items[ $_item->db_id ] = $_item; } $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn', ); wp_defer_term_counting( true ); if ( ! empty( $_POST['menu-item-db-id'] ) ) { foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) { if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) { continue; } $args = array(); foreach ( $post_fields as $field ) { $args[ $field ] = isset( $_POST[ $field ][ $_key ] ) ? $_POST[ $field ][ $_key ] : ''; } $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][ $_key ] != $_key ? 0 : $_key ), $args ); if ( is_wp_error( $menu_item_db_id ) ) { $messages[] = '

            ' . $menu_item_db_id->get_error_message() . '

            '; } else { unset( $menu_items[ $menu_item_db_id ] ); } } } if ( ! empty( $menu_items ) ) { foreach ( array_keys( $menu_items ) as $menu_item_id ) { if ( is_nav_menu_item( $menu_item_id ) ) { wp_delete_post( $menu_item_id ); } } } $auto_add = ! empty( $_POST['auto-add-pages'] ); $nav_menu_option = (array) get_option( 'nav_menu_options' ); if ( ! isset( $nav_menu_option['auto_add'] ) ) { $nav_menu_option['auto_add'] = array(); } if ( $auto_add ) { if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ) ) { $nav_menu_option['auto_add'][] = $nav_menu_selected_id; } } else { $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'], true ); if ( false !== $key ) { unset( $nav_menu_option['auto_add'][ $key ] ); } } $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); update_option( 'nav_menu_options', $nav_menu_option ); wp_defer_term_counting( false ); do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); $messages[] = '

            ' . sprintf( __( '%s has been updated.' ), '' . $nav_menu_selected_title . '' ) . '

            '; unset( $menu_items, $unsorted_menu_items ); return $messages; } function _wp_expand_nav_menu_post_data() { if ( ! isset( $_POST['nav-menu-data'] ) ) { return; } $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) ); if ( ! is_null( $data ) && $data ) { foreach ( $data as $post_input_data ) { preg_match( '#([^\[]*)(\[(.+)\])?#', $post_input_data->name, $matches ); $array_bits = array( $matches[1] ); if ( isset( $matches[3] ) ) { $array_bits = array_merge( $array_bits, explode( '][', $matches[3] ) ); } $new_post_data = array(); for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) { if ( count( $array_bits ) - 1 == $i ) { $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value ); } else { $new_post_data = array( $array_bits[ $i ] => $new_post_data ); } } $_POST = array_replace_recursive( $_POST, $new_post_data ); } } } - - - - - - '; echo '

            ' . __( 'The character encoding of your site (UTF-8 is recommended)' ) . '

            '; } 3, 'body' => array( 'wp_version' => $wp_version, 'locale' => get_locale(), 'version' => $args['version'], ), ); if ( 'core' !== $type ) { $options['body']['slug'] = $args['slug']; } $request = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $request ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $request = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $request ) ) { $res = new WP_Error( 'translations_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), $request->get_error_message() ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! is_object( $res ) && ! is_array( $res ) ) { $res = new WP_Error( 'translations_api_failed', sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ), wp_remote_retrieve_body( $request ) ); } } } return apply_filters( 'translations_api_result', $res, $type, $args ); } function wp_get_available_translations() { if ( ! wp_installing() ) { $translations = get_site_transient( 'available_translations' ); if ( false !== $translations ) { return $translations; } } require ABSPATH . WPINC . '/version.php'; $api = translations_api( 'core', array( 'version' => $wp_version ) ); if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { return array(); } $translations = array(); foreach ( $api['translations'] as $translation ) { $translations[ $translation['language'] ] = $translation; } if ( ! defined( 'WP_INSTALLING' ) ) { set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS ); } return $translations; } function wp_install_language_form( $languages ) { global $wp_local_package; $installed_languages = get_available_languages(); echo "\n"; echo "\n"; echo '

            '; } function wp_download_language_pack( $download ) { if ( in_array( $download, get_available_languages(), true ) ) { return $download; } if ( ! wp_is_file_mod_allowed( 'download_language_pack' ) ) { return false; } $translations = wp_get_available_translations(); if ( ! $translations ) { return false; } foreach ( $translations as $translation ) { if ( $translation['language'] === $download ) { $translation_to_load = true; break; } } if ( empty( $translation_to_load ) ) { return false; } $translation = (object) $translation; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); $translation->type = 'core'; $result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) ); if ( ! $result || is_wp_error( $result ) ) { return false; } return $translation->language; } function wp_can_install_language_pack() { if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { return false; } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $skin = new Automatic_Upgrader_Skin; $upgrader = new Language_Pack_Upgrader( $skin ); $upgrader->init(); $check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); if ( ! $check || is_wp_error( $check ) ) { return false; } return true; } admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'customize_save_after', array( $this, 'customize_set_last_used' ) ); add_action( 'wp_ajax_custom-header-crop', array( $this, 'ajax_header_crop' ) ); add_action( 'wp_ajax_custom-header-add', array( $this, 'ajax_header_add' ) ); add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove' ) ); } public function init() { $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) ); if ( ! $page ) { return; } add_action( "admin_print_scripts-{$page}", array( $this, 'js_includes' ) ); add_action( "admin_print_styles-{$page}", array( $this, 'css_includes' ) ); add_action( "admin_head-{$page}", array( $this, 'help' ) ); add_action( "admin_head-{$page}", array( $this, 'take_action' ), 50 ); add_action( "admin_head-{$page}", array( $this, 'js' ), 50 ); if ( $this->admin_header_callback ) { add_action( "admin_head-{$page}", $this->admin_header_callback, 51 ); } } public function help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

            ' . __( 'This screen is used to customize the header section of your theme.' ) . '

            ' . '

            ' . __( 'You can choose from the theme’s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.' ) . '

            ', ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-image', 'title' => __( 'Header Image' ), 'content' => '

            ' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the “Choose Image” button.' ) . '

            ' . '

            ' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you would like and click the “Save Changes” button.' ) . '

            ' . '

            ' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the “Random” radio button next to the Uploaded Images or Default Images section to enable this feature.' ) . '

            ' . '

            ' . __( 'If you do not want a header image to be displayed on your site at all, click the “Remove Header Image” button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click “Save Changes”.' ) . '

            ', ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-text', 'title' => __( 'Header Text' ), 'content' => '

            ' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the General Settings section.' ), admin_url( 'options-general.php' ) ) . '

            ' . '

            ' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '

            ' . '

            ' . __( 'Do not forget to click “Save Changes” when you are done!' ) . '

            ', ) ); get_current_screen()->set_help_sidebar( '

            ' . __( 'For more information:' ) . '

            ' . '

            ' . __( 'Documentation on Custom Header' ) . '

            ' . '

            ' . __( 'Support' ) . '

            ' ); } public function step() { if ( ! isset( $_GET['step'] ) ) { return 1; } $step = (int) $_GET['step']; if ( $step < 1 || 3 < $step || ( 2 === $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) || ( 3 === $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) ) ) { return 1; } return $step; } public function js_includes() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) ) { wp_enqueue_media(); wp_enqueue_script( 'custom-header' ); if ( current_theme_supports( 'custom-header', 'header-text' ) ) { wp_enqueue_script( 'wp-color-picker' ); } } elseif ( 2 === $step ) { wp_enqueue_script( 'imgareaselect' ); } } public function css_includes() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { wp_enqueue_style( 'wp-color-picker' ); } elseif ( 2 === $step ) { wp_enqueue_style( 'imgareaselect' ); } } public function take_action() { if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( empty( $_POST ) ) { return; } $this->updated = true; if ( isset( $_POST['resetheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->reset_header_image(); return; } if ( isset( $_POST['removeheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->remove_header_image(); return; } if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); set_theme_mod( 'header_textcolor', 'blank' ); } elseif ( isset( $_POST['text-color'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['text-color'] ); if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) { set_theme_mod( 'header_textcolor', $color ); } elseif ( ! $color ) { set_theme_mod( 'header_textcolor', 'blank' ); } } if ( isset( $_POST['default-header'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->set_header_image( $_POST['default-header'] ); return; } } public function process_default_headers() { global $_wp_default_headers; if ( ! isset( $_wp_default_headers ) ) { return; } if ( ! empty( $this->default_headers ) ) { return; } $this->default_headers = $_wp_default_headers; $template_directory_uri = get_template_directory_uri(); $stylesheet_directory_uri = get_stylesheet_directory_uri(); foreach ( array_keys( $this->default_headers ) as $header ) { $this->default_headers[ $header ]['url'] = sprintf( $this->default_headers[ $header ]['url'], $template_directory_uri, $stylesheet_directory_uri ); $this->default_headers[ $header ]['thumbnail_url'] = sprintf( $this->default_headers[ $header ]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri ); } } public function show_header_selector( $type = 'default' ) { if ( 'default' === $type ) { $headers = $this->default_headers; } else { $headers = get_uploaded_header_images(); $type = 'uploaded'; } if ( 1 < count( $headers ) ) { echo '
            '; echo ''; echo '
            '; } echo '
            '; foreach ( $headers as $header_key => $header ) { $header_thumbnail = $header['thumbnail_url']; $header_url = $header['url']; $header_alt_text = empty( $header['alt_text'] ) ? '' : $header['alt_text']; echo '
            '; echo ''; echo '
            '; } echo '
            '; } public function js() { $step = $this->step(); if ( ( 1 === $step || 3 === $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) { $this->js_1(); } elseif ( 2 === $step ) { $this->js_2(); } } public function js_1() { $default_color = ''; if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) { $default_color = get_theme_support( 'custom-header', 'default-text-color' ); if ( $default_color && false === strpos( $default_color, '#' ) ) { $default_color = '#' . $default_color; } } ?> - - - - process_default_headers(); ?> - -
            -

            - - -
            -

            - Customizer.' ), admin_url( 'customize.php?autofocus[control]=header_image' ) ); ?> -

            -
            - - - updated ) ) { ?> -
            -

            - Visit your site to see how it looks.' ), home_url( '/' ) ); ?> -

            -
            - - -

            - - - - - - - - - - - - - - - - - - - - -
            - - - - - - - - - default_headers ) ) : ?> - - - - - - - - - - - - - - - - - - - - -

            - - - - - - - - - - - - - - - - - -
            -
            - - ' . __( 'Something went wrong.' ) . '' . '

            ' . __( 'The active theme does not support uploading a custom header image.' ) . '

            ', 403 ); } if ( empty( $_POST ) && isset( $_GET['file'] ) ) { $attachment_id = absint( $_GET['file'] ); $file = get_attached_file( $attachment_id, true ); $url = wp_get_attachment_image_src( $attachment_id, 'full' ); $url = $url[0]; } elseif ( isset( $_POST ) ) { $data = $this->step_2_manage_upload(); $attachment_id = $data['attachment_id']; $file = $data['file']; $url = $data['url']; } if ( file_exists( $file ) ) { list( $width, $height, $type, $attr ) = wp_getimagesize( $file ); } else { $data = wp_get_attachment_metadata( $attachment_id ); $height = isset( $data['height'] ) ? (int) $data['height'] : 0; $width = isset( $data['width'] ) ? (int) $data['width'] : 0; unset( $data ); } $max_width = 0; if ( current_theme_supports( 'custom-header', 'flex-width' ) ) { $max_width = 1500; } if ( current_theme_supports( 'custom-header', 'max-width' ) ) { $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); } $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) && (int) get_theme_support( 'custom-header', 'width' ) === $width && (int) get_theme_support( 'custom-header', 'height' ) === $height ) { if ( file_exists( $file ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); return $this->finished(); } elseif ( $width > $max_width ) { $oitar = $width / $max_width; $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) ); if ( ! $image || is_wp_error( $image ) ) { wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); } $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); $width = $width / $oitar; $height = $height / $oitar; } else { $oitar = 1; } ?> - -
            -

            - -
            -

            -

            - -
            - -
            - - - - - - - - - - - - -

            - - -

            -
            -
            - false ); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); } $file = wp_handle_upload( $uploaded_file, $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'], __( 'Image Upload Error' ) ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = wp_basename( $file ); $attachment = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-header', ); $attachment_id = wp_insert_attachment( $attachment, $file ); return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); } public function step_3() { check_admin_referer( 'custom-header-crop-image' ); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { wp_die( '

            ' . __( 'Something went wrong.' ) . '

            ' . '

            ' . __( 'The active theme does not support uploading a custom header image.' ) . '

            ', 403 ); } if ( ! empty( $_POST['skip-cropping'] ) && ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { wp_die( '

            ' . __( 'Something went wrong.' ) . '

            ' . '

            ' . __( 'The active theme does not support a flexible sized header image.' ) . '

            ', 403 ); } if ( $_POST['oitar'] > 1 ) { $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; $_POST['y1'] = $_POST['y1'] * $_POST['oitar']; $_POST['width'] = $_POST['width'] * $_POST['oitar']; $_POST['height'] = $_POST['height'] * $_POST['oitar']; } $attachment_id = absint( $_POST['attachment_id'] ); $original = get_attached_file( $attachment_id ); $dimensions = $this->get_header_dimensions( array( 'height' => $_POST['height'], 'width' => $_POST['width'], ) ); $height = $dimensions['dst_height']; $width = $dimensions['dst_width']; if ( empty( $_POST['skip-cropping'] ) ) { $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height ); } elseif ( ! empty( $_POST['create-new-attachment'] ) ) { $cropped = _copy_image_file( $attachment_id ); } else { $cropped = get_attached_file( $attachment_id ); } if ( ! $cropped || is_wp_error( $cropped ) ) { wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $this->create_attachment_object( $cropped, $attachment_id ); if ( ! empty( $_POST['create-new-attachment'] ) ) { unset( $attachment['ID'] ); } $attachment_id = $this->insert_attachment( $attachment, $cropped ); $url = wp_get_attachment_url( $attachment_id ); $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); $medium = str_replace( wp_basename( $original ), 'midsize-' . wp_basename( $original ), $original ); if ( file_exists( $medium ) ) { wp_delete_file( $medium ); } if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) { wp_delete_file( $original ); } return $this->finished(); } public function finished() { $this->updated = true; $this->step_1(); } public function admin_page() { if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( __( 'Sorry, you are not allowed to customize headers.' ) ); } $step = $this->step(); if ( 2 === $step ) { $this->step_2(); } elseif ( 3 === $step ) { $this->step_3(); } else { $this->step_1(); } } public function attachment_fields_to_edit( $form_fields ) { return $form_fields; } public function filter_upload_tabs( $tabs ) { return $tabs; } final public function set_header_image( $choice ) { if ( is_array( $choice ) || is_object( $choice ) ) { $choice = (array) $choice; if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) { return; } $choice['url'] = esc_url_raw( $choice['url'] ); $header_image_data = (object) array( 'attachment_id' => $choice['attachment_id'], 'url' => $choice['url'], 'thumbnail_url' => $choice['url'], 'height' => $choice['height'], 'width' => $choice['width'], ); update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() ); set_theme_mod( 'header_image', $choice['url'] ); set_theme_mod( 'header_image_data', $header_image_data ); return; } if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ), true ) ) { set_theme_mod( 'header_image', $choice ); remove_theme_mod( 'header_image_data' ); return; } $uploaded = get_uploaded_header_images(); if ( $uploaded && isset( $uploaded[ $choice ] ) ) { $header_image_data = $uploaded[ $choice ]; } else { $this->process_default_headers(); if ( isset( $this->default_headers[ $choice ] ) ) { $header_image_data = $this->default_headers[ $choice ]; } else { return; } } set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); set_theme_mod( 'header_image_data', $header_image_data ); } final public function remove_header_image() { $this->set_header_image( 'remove-header' ); } final public function reset_header_image() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) { $this->remove_header_image(); return; } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $default_data = array(); foreach ( $this->default_headers as $header => $details ) { if ( $details['url'] === $default ) { $default_data = $details; break; } } set_theme_mod( 'header_image', $default ); set_theme_mod( 'header_image_data', (object) $default_data ); } final public function get_header_dimensions( $dimensions ) { $max_width = 0; $width = absint( $dimensions['width'] ); $height = absint( $dimensions['height'] ); $theme_height = get_theme_support( 'custom-header', 'height' ); $theme_width = get_theme_support( 'custom-header', 'width' ); $has_flex_width = current_theme_supports( 'custom-header', 'flex-width' ); $has_flex_height = current_theme_supports( 'custom-header', 'flex-height' ); $has_max_width = current_theme_supports( 'custom-header', 'max-width' ); $dst = array( 'dst_height' => null, 'dst_width' => null, ); if ( $has_flex_width ) { $max_width = 1500; } if ( $has_max_width ) { $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); } $max_width = max( $max_width, $theme_width ); if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) { $dst['dst_height'] = absint( $height * ( $max_width / $width ) ); } elseif ( $has_flex_height && $has_flex_width ) { $dst['dst_height'] = $height; } else { $dst['dst_height'] = $theme_height; } if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) { $dst['dst_width'] = absint( $width * ( $max_width / $width ) ); } elseif ( $has_flex_width && $has_flex_height ) { $dst['dst_width'] = $width; } else { $dst['dst_width'] = $theme_width; } return $dst; } final public function create_attachment_object( $cropped, $parent_attachment_id ) { $parent = get_post( $parent_attachment_id ); $parent_url = wp_get_attachment_url( $parent->ID ); $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $attachment = array( 'ID' => $parent_attachment_id, 'post_title' => wp_basename( $cropped ), 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'custom-header', 'post_parent' => $parent_attachment_id, ); return $attachment; } final public function insert_attachment( $attachment, $cropped ) { $parent_id = isset( $attachment['post_parent'] ) ? $attachment['post_parent'] : null; unset( $attachment['post_parent'] ); $attachment_id = wp_insert_attachment( $attachment, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); if ( $parent_id ) { $metadata['attachment_parent'] = $parent_id; } $metadata = apply_filters( 'wp_header_image_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); return $attachment_id; } public function ajax_header_crop() { check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { wp_send_json_error(); } $crop_details = $_POST['cropDetails']; $dimensions = $this->get_header_dimensions( array( 'height' => $crop_details['height'], 'width' => $crop_details['width'], ) ); $attachment_id = absint( $_POST['id'] ); $cropped = wp_crop_image( $attachment_id, (int) $crop_details['x1'], (int) $crop_details['y1'], (int) $crop_details['width'], (int) $crop_details['height'], (int) $dimensions['dst_width'], (int) $dimensions['dst_height'] ); if ( ! $cropped || is_wp_error( $cropped ) ) { wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); $attachment = $this->create_attachment_object( $cropped, $attachment_id ); $previous = $this->get_previous_crop( $attachment ); if ( $previous ) { $attachment['ID'] = $previous; } else { unset( $attachment['ID'] ); } $new_attachment_id = $this->insert_attachment( $attachment, $cropped ); $attachment['attachment_id'] = $new_attachment_id; $attachment['url'] = wp_get_attachment_url( $new_attachment_id ); $attachment['width'] = $dimensions['dst_width']; $attachment['height'] = $dimensions['dst_height']; wp_send_json_success( $attachment ); } public function ajax_header_add() { check_ajax_referer( 'header-add', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } public function ajax_header_remove() { check_ajax_referer( 'header-remove', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); delete_post_meta( $attachment_id, $key ); delete_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } public function customize_set_last_used( $wp_customize ) { $header_image_data_setting = $wp_customize->get_setting( 'header_image_data' ); if ( ! $header_image_data_setting ) { return; } $data = $header_image_data_setting->post_value(); if ( ! isset( $data['attachment_id'] ) ) { return; } $attachment_id = $data['attachment_id']; $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); } public function get_default_header_images() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) { return $this->default_headers; } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $already_has_default = false; foreach ( $this->default_headers as $k => $h ) { if ( $h['url'] === $default ) { $already_has_default = true; break; } } if ( $already_has_default ) { return $this->default_headers; } $header_images = array(); $header_images['default'] = array( 'url' => $default, 'thumbnail_url' => $default, 'description' => 'Default', ); return array_merge( $header_images, $this->default_headers ); } public function get_uploaded_header_images() { $header_images = get_uploaded_header_images(); $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); $alt_text_key = '_wp_attachment_image_alt'; foreach ( $header_images as &$header_image ) { $header_meta = get_post_meta( $header_image['attachment_id'] ); $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; } return $header_images; } public function get_previous_crop( $attachment ) { $header_images = $this->get_uploaded_header_images(); if ( empty( $header_images ) ) { return false; } $previous = false; foreach ( $header_images as $image ) { if ( $image['attachment_parent'] === $attachment['post_parent'] ) { $previous = $image['attachment_id']; break; } } return $previous; } } prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d", $meta_key, $offset, $limit ); $results = $wpdb->get_results( $sql ); $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { $hashtable[ $r->meta_value ] = (int) $r->post_id; } } } while ( count( $results ) == $limit ); return $hashtable; } public function count_imported_posts( $importer_name, $blog_id ) { global $wpdb; $count = 0; $meta_key = $importer_name . '_' . $blog_id . '_permalink'; $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ); $result = $wpdb->get_results( $sql ); if ( ! empty( $result ) ) { $count = (int) $result[0]->cnt; } return $count; } public function get_imported_comments( $blog_id ) { global $wpdb; $hashtable = array(); $limit = 100; $offset = 0; do { $sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit ); $results = $wpdb->get_results( $sql ); $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { list ( $comment_agent_blog_id, $source_comment_id ) = explode( '-', $r->comment_agent ); $source_comment_id = (int) $source_comment_id; if ( $blog_id == $comment_agent_blog_id ) { $hashtable[ $source_comment_id ] = (int) $r->comment_ID; } } } } while ( count( $results ) == $limit ); return $hashtable; } public function set_blog( $blog_id ) { if ( is_numeric( $blog_id ) ) { $blog_id = (int) $blog_id; } else { $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); $parsed = parse_url( $blog ); if ( ! $parsed || empty( $parsed['host'] ) ) { fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" ); exit; } if ( empty( $parsed['path'] ) ) { $parsed['path'] = '/'; } $blogs = get_sites( array( 'domain' => $parsed['host'], 'number' => 1, 'path' => $parsed['path'], ) ); if ( ! $blogs ) { fwrite( STDERR, "Error: Could not find blog\n" ); exit; } $blog = array_shift( $blogs ); $blog_id = (int) $blog->blog_id; } if ( function_exists( 'is_multisite' ) ) { if ( is_multisite() ) { switch_to_blog( $blog_id ); } } return $blog_id; } public function set_user( $user_id ) { if ( is_numeric( $user_id ) ) { $user_id = (int) $user_id; } else { $user_id = (int) username_exists( $user_id ); } if ( ! $user_id || ! wp_set_current_user( $user_id ) ) { fwrite( STDERR, "Error: can not find user\n" ); exit; } return $user_id; } public function cmpr_strlen( $a, $b ) { return strlen( $b ) - strlen( $a ); } public function get_page( $url, $username = '', $password = '', $head = false ) { add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); $headers = array(); $args = array(); if ( true === $head ) { $args['method'] = 'HEAD'; } if ( ! empty( $username ) && ! empty( $password ) ) { $headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" ); } $args['headers'] = $headers; return wp_safe_remote_request( $url, $args ); } public function bump_request_timeout( $val ) { return 60; } public function is_user_over_quota() { if ( function_exists( 'upload_is_user_over_quota' ) ) { if ( upload_is_user_over_quota() ) { return true; } } return false; } public function min_whitespace( $text ) { return preg_replace( '|[\r\n\t ]+|', ' ', $text ); } public function stop_the_insanity() { global $wpdb, $wp_actions; $wpdb->queries = array(); $wp_actions = array(); } } function get_cli_args( $param, $required = false ) { $args = $_SERVER['argv']; if ( ! is_array( $args ) ) { $args = array(); } $out = array(); $last_arg = null; $return = null; $il = count( $args ); for ( $i = 1, $il; $i < $il; $i++ ) { if ( (bool) preg_match( '/^--(.+)/', $args[ $i ], $match ) ) { $parts = explode( '=', $match[1] ); $key = preg_replace( '/[^a-z0-9]+/', '', $parts[0] ); if ( isset( $parts[1] ) ) { $out[ $key ] = $parts[1]; } else { $out[ $key ] = true; } $last_arg = $key; } elseif ( (bool) preg_match( '/^-([a-zA-Z0-9]+)/', $args[ $i ], $match ) ) { for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) { $key = $match[1][ $j ]; $out[ $key ] = true; } $last_arg = $key; } elseif ( null !== $last_arg ) { $out[ $last_arg ] = $args[ $i ]; } } if ( isset( $out[ $param ] ) ) { $return = $out[ $param ]; } if ( ! isset( $out[ $param ] ) && $required ) { echo "\"$param\" parameter is required but was not specified\n"; exit; } return $return; } 'posts', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $post_type = $this->screen->post_type; $post_type_object = get_post_type_object( $post_type ); $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false, ) ); $this->user_posts_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) - FROM $wpdb->posts - WHERE post_type = %s - AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) - AND post_author = %d", $post_type, get_current_user_id() ) ); if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) { $_GET['author'] = get_current_user_id(); } $sticky_posts = get_option( 'sticky_posts' ); if ( 'post' === $post_type && $sticky_posts ) { $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); $this->sticky_posts_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) - FROM $wpdb->posts - WHERE post_type = %s - AND post_status NOT IN ('trash', 'auto-draft') - AND ID IN ($sticky_posts)", $post_type ) ); } } public function set_hierarchical_display( $display ) { $this->hierarchical_display = $display; } public function ajax_user_can() { return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); } public function prepare_items() { global $mode, $avail_post_stati, $wp_query, $per_page; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'posts_list_mode', $mode ); } else { $mode = get_user_setting( 'posts_list_mode', 'list' ); } $avail_post_stati = wp_edit_posts_query(); $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); $post_type = $this->screen->post_type; $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); if ( $this->hierarchical_display ) { $total_items = $wp_query->post_count; } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { $total_items = $wp_query->found_posts; } else { $post_counts = (array) wp_count_posts( $post_type, 'readable' ); if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) { $total_items = $post_counts[ $_REQUEST['post_status'] ]; } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { $total_items = $this->sticky_posts_count; } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) { $total_items = $this->user_posts_count; } else { $total_items = array_sum( $post_counts ); foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { $total_items -= $post_counts[ $state ]; } } } $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => $per_page, ) ); } public function has_items() { return have_posts(); } public function no_items() { if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; } else { echo get_post_type_object( $this->screen->post_type )->labels->not_found; } } protected function is_base_request() { $vars = $_GET; unset( $vars['paged'] ); if ( empty( $vars ) ) { return true; } elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) { return $this->screen->post_type === $vars['post_type']; } return 1 === count( $vars ) && ! empty( $vars['mode'] ); } protected function get_edit_link( $args, $link_text, $css_class = '' ) { $url = add_query_arg( $args, 'edit.php' ); $class_html = ''; $aria_current = ''; if ( ! empty( $css_class ) ) { $class_html = sprintf( ' class="%s"', esc_attr( $css_class ) ); if ( 'current' === $css_class ) { $aria_current = ' aria-current="page"'; } } return sprintf( '%s', esc_url( $url ), $class_html, $aria_current, $link_text ); } protected function get_views() { global $locked_post_status, $avail_post_stati; $post_type = $this->screen->post_type; if ( ! empty( $locked_post_status ) ) { return array(); } $status_links = array(); $num_posts = wp_count_posts( $post_type, 'readable' ); $total_posts = array_sum( (array) $num_posts ); $class = ''; $current_user_id = get_current_user_id(); $all_args = array( 'post_type' => $post_type ); $mine = ''; foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { $total_posts -= $num_posts->$state; } if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) { if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) { $class = 'current'; } $mine_args = array( 'post_type' => $post_type, 'author' => $current_user_id, ); $mine_inner_html = sprintf( _nx( 'Mine (%s)', 'Mine (%s)', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ); $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); $all_args['all_posts'] = 1; $class = ''; } if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { $class = 'current'; } $all_inner_html = sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ); $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); if ( $mine ) { $status_links['mine'] = $mine; } foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { $class = ''; $status_name = $status->name; if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) { continue; } if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { $class = 'current'; } $status_args = array( 'post_status' => $status_name, 'post_type' => $post_type, ); $status_label = sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ); $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); } if ( ! empty( $this->sticky_posts_count ) ) { $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; $sticky_args = array( 'post_type' => $post_type, 'show_sticky' => 1, ); $sticky_inner_html = sprintf( _nx( 'Sticky (%s)', 'Sticky (%s)', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ); $sticky_link = array( 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), ); $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); } return $status_links; } protected function get_bulk_actions() { $actions = array(); $post_type_obj = get_post_type_object( $this->screen->post_type ); if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { if ( $this->is_trash ) { $actions['untrash'] = __( 'Restore' ); } else { $actions['edit'] = __( 'Edit' ); } } if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } } return $actions; } protected function categories_dropdown( $post_type ) { global $cat; if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) { return; } if ( is_object_in_taxonomy( $post_type, 'category' ) ) { $dropdown_options = array( 'show_option_all' => get_taxonomy( 'category' )->labels->all_items, 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat, ); echo ''; wp_dropdown_categories( $dropdown_options ); } } protected function formats_dropdown( $post_type ) { if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) { return; } if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) { return; } $used_post_formats = get_terms( array( 'taxonomy' => 'post_format', 'hide_empty' => true, ) ); if ( ! $used_post_formats ) { return; } $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; ?> - - - -
            - months_dropdown( $this->screen->post_type ); $this->categories_dropdown( $this->screen->post_type ); $this->formats_dropdown( $this->screen->post_type ); do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); $output = ob_get_clean(); if ( ! empty( $output ) ) { echo $output; submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } } if ( $this->is_trash && $this->has_items() && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> -
            - screen->post_type ) ? 'pages' : 'posts', ); } public function get_columns() { $post_type = $this->screen->post_type; $posts_columns = array(); $posts_columns['cb'] = ''; $posts_columns['title'] = _x( 'Title', 'column name' ); if ( post_type_supports( $post_type, 'author' ) ) { $posts_columns['author'] = __( 'Author' ); } $taxonomies = get_object_taxonomies( $post_type, 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); foreach ( $taxonomies as $taxonomy ) { if ( 'category' === $taxonomy ) { $column_key = 'categories'; } elseif ( 'post_tag' === $taxonomy ) { $column_key = 'tags'; } else { $column_key = 'taxonomy-' . $taxonomy; } $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; } $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) { $posts_columns['comments'] = sprintf( '%2$s', esc_attr__( 'Comments' ), __( 'Comments' ) ); } $posts_columns['date'] = __( 'Date' ); if ( 'page' === $post_type ) { $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); } else { $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); } return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); } protected function get_sortable_columns() { return array( 'title' => 'title', 'parent' => 'parent', 'comments' => 'comment_count', 'date' => array( 'date', true ), ); } public function display_rows( $posts = array(), $level = 0 ) { global $wp_query, $per_page; if ( empty( $posts ) ) { $posts = $wp_query->posts; } add_filter( 'the_title', 'esc_html' ); if ( $this->hierarchical_display ) { $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); } else { $this->_display_rows( $posts, $level ); } } private function _display_rows( $posts, $level = 0 ) { $post_type = $this->screen->post_type; $post_ids = array(); foreach ( $posts as $a_post ) { $post_ids[] = $a_post->ID; } if ( post_type_supports( $post_type, 'comments' ) ) { $this->comment_pending_count = get_pending_comments_num( $post_ids ); } foreach ( $posts as $post ) { $this->single_row( $post, $level ); } } private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) { global $wpdb; $level = 0; if ( ! $pages ) { $pages = get_pages( array( 'sort_column' => 'menu_order' ) ); if ( ! $pages ) { return; } } if ( empty( $_REQUEST['s'] ) ) { $top_level_pages = array(); $children_pages = array(); foreach ( $pages as $page ) { if ( $page->post_parent === $page->ID ) { $page->post_parent = 0; $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); clean_post_cache( $page ); } if ( $page->post_parent > 0 ) { $children_pages[ $page->post_parent ][] = $page; } else { $top_level_pages[] = $page; } } $pages = &$top_level_pages; } $count = 0; $start = ( $pagenum - 1 ) * $per_page; $end = $start + $per_page; $to_display = array(); foreach ( $pages as $page ) { if ( $count >= $end ) { break; } if ( $count >= $start ) { $to_display[ $page->ID ] = $level; } $count++; if ( isset( $children_pages ) ) { $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); } } if ( isset( $children_pages ) && $count < $end ) { foreach ( $children_pages as $orphans ) { foreach ( $orphans as $op ) { if ( $count >= $end ) { break; } if ( $count >= $start ) { $to_display[ $op->ID ] = 0; } $count++; } } } $ids = array_keys( $to_display ); _prime_post_caches( $ids ); if ( ! isset( $GLOBALS['post'] ) ) { $GLOBALS['post'] = reset( $ids ); } foreach ( $to_display as $page_id => $level ) { echo "\t"; $this->single_row( $page_id, $level ); } } private function _page_rows( &$children_pages, &$count, $parent_page, $level, $pagenum, $per_page, &$to_display ) { if ( ! isset( $children_pages[ $parent_page ] ) ) { return; } $start = ( $pagenum - 1 ) * $per_page; $end = $start + $per_page; foreach ( $children_pages[ $parent_page ] as $page ) { if ( $count >= $end ) { break; } if ( $count === $start && $page->post_parent > 0 ) { $my_parents = array(); $my_parent = $page->post_parent; while ( $my_parent ) { $parent_id = $my_parent; if ( is_object( $my_parent ) ) { $parent_id = $my_parent->ID; } $my_parent = get_post( $parent_id ); $my_parents[] = $my_parent; if ( ! $my_parent->post_parent ) { break; } $my_parent = $my_parent->post_parent; } $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { $to_display[ $my_parent->ID ] = $level - $num_parents; $num_parents--; } } if ( $count >= $start ) { $to_display[ $page->ID ] = $level; } $count++; $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); } unset( $children_pages[ $parent_page ] ); } public function column_cb( $item ) { $post = $item; $show = current_user_can( 'edit_post', $post->ID ); if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) : ?> - - -
            - - - - -
            - '; echo $this->column_title( $post ); echo $this->handle_row_actions( $post, 'title', $primary ); echo ''; } public function column_title( $post ) { global $mode; if ( $this->hierarchical_display ) { if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) { $find_main_page = (int) $post->post_parent; while ( $find_main_page > 0 ) { $parent = get_post( $find_main_page ); if ( is_null( $parent ) ) { break; } $this->current_level++; $find_main_page = (int) $parent->post_parent; if ( ! isset( $parent_name ) ) { $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); } } } } $can_edit_post = current_user_can( 'edit_post', $post->ID ); if ( $can_edit_post && 'trash' !== $post->post_status ) { $lock_holder = wp_check_post_lock( $post->ID ); if ( $lock_holder ) { $lock_holder = get_userdata( $lock_holder ); $locked_avatar = get_avatar( $lock_holder->ID, 18 ); $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); } else { $locked_avatar = ''; $locked_text = ''; } echo '
            ' . $locked_avatar . ' ' . $locked_text . "
            \n"; } $pad = str_repeat( '— ', $this->current_level ); echo ''; $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' !== $post->post_status ) { printf( '%s%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), $pad, $title ); } else { printf( '%s%s', $pad, $title ); } _post_states( $post ); if ( isset( $parent_name ) ) { $post_type_object = get_post_type_object( $post->post_type ); echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); } echo "\n"; if ( 'excerpt' === $mode && ! is_post_type_hierarchical( $this->screen->post_type ) && current_user_can( 'read_post', $post->ID ) ) { if ( post_password_required( $post ) ) { echo '' . esc_html( get_the_excerpt() ) . ''; } else { echo esc_html( get_the_excerpt() ); } } get_inline_data( $post ); } public function column_date( $post ) { global $mode; if ( '0000-00-00 00:00:00' === $post->post_date ) { $t_time = __( 'Unpublished' ); $time_diff = 0; } else { $t_time = sprintf( __( '%1$s at %2$s' ), get_the_time( __( 'Y/m/d' ), $post ), get_the_time( __( 'g:i a' ), $post ) ); $time = get_post_timestamp( $post ); $time_diff = time() - $time; } if ( 'publish' === $post->post_status ) { $status = __( 'Published' ); } elseif ( 'future' === $post->post_status ) { if ( $time_diff > 0 ) { $status = '' . __( 'Missed schedule' ) . ''; } else { $status = __( 'Scheduled' ); } } else { $status = __( 'Last Modified' ); } $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); if ( $status ) { echo $status . '
            '; } echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); } public function column_comments( $post ) { ?> -
            - comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0; $this->comments_bubble( $post->ID, $pending_comments ); ?> -
            - $post->post_type, 'author' => get_the_author_meta( 'ID' ), ); echo $this->get_edit_link( $args, get_the_author() ); } public function column_default( $item, $column_name ) { $post = $item; if ( 'categories' === $column_name ) { $taxonomy = 'category'; } elseif ( 'tags' === $column_name ) { $taxonomy = 'post_tag'; } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { $taxonomy = substr( $column_name, 9 ); } else { $taxonomy = false; } if ( $taxonomy ) { $taxonomy_object = get_taxonomy( $taxonomy ); $terms = get_the_terms( $post->ID, $taxonomy ); if ( is_array( $terms ) ) { $term_links = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); if ( 'post' !== $post->post_type ) { $posts_in_term_qv['post_type'] = $post->post_type; } if ( $taxonomy_object->query_var ) { $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; } else { $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; } $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); } $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); echo implode( wp_get_list_item_separator(), $term_links ); } else { echo '' . $taxonomy_object->labels->no_terms . ''; } return; } if ( is_post_type_hierarchical( $post->post_type ) ) { do_action( 'manage_pages_custom_column', $column_name, $post->ID ); } else { do_action( 'manage_posts_custom_column', $column_name, $post->ID ); } do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); } public function single_row( $post, $level = 0 ) { $global_post = get_post(); $post = get_post( $post ); $this->current_level = $level; $GLOBALS['post'] = $post; setup_postdata( $post ); $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' ); $lock_holder = wp_check_post_lock( $post->ID ); if ( $lock_holder ) { $classes .= ' wp-locked'; } if ( $post->post_parent ) { $count = count( get_post_ancestors( $post->ID ) ); $classes .= ' level-' . $count; } else { $classes .= ' level-0'; } ?> - - single_row_columns( $post ); ?> - - post_type ); $can_edit_post = current_user_can( 'edit_post', $post->ID ); $actions = array(); $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' !== $post->post_status ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), __( 'Edit' ) ); if ( 'wp_block' !== $post->post_type ) { $actions['inline hide-if-no-js'] = sprintf( '', esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), __( 'Quick Edit' ) ); } } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( 'trash' === $post->post_status ) { $actions['untrash'] = sprintf( '%s', wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), __( 'Restore' ) ); } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = sprintf( '%s', get_delete_post_link( $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), _x( 'Trash', 'verb' ) ); } if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', get_delete_post_link( $post->ID, '', true ), esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ), __( 'Delete Permanently' ) ); } } if ( is_post_type_viewable( $post_type_object ) ) { if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) { if ( $can_edit_post ) { $preview_link = get_preview_post_link( $post ); $actions['view'] = sprintf( '%s', esc_url( $preview_link ), esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), __( 'Preview' ) ); } } elseif ( 'trash' !== $post->post_status ) { $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $title ) ), __( 'View' ) ); } } if ( 'wp_block' === $post->post_type ) { $actions['export'] = sprintf( '', $post->ID, esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), __( 'Export as JSON' ) ); } if ( is_post_type_hierarchical( $post->post_type ) ) { $actions = apply_filters( 'page_row_actions', $actions, $post ); } else { $actions = apply_filters( 'post_row_actions', $actions, $post ); } return $this->row_actions( $actions ); } public function inline_edit() { global $mode; $screen = $this->screen; $post = get_default_post_to_edit( $screen->post_type ); $post_type_object = get_post_type_object( $screen->post_type ); $taxonomy_names = get_object_taxonomies( $screen->post_type ); $hierarchical_taxonomies = array(); $flat_taxonomies = array(); foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); $show_in_quick_edit = $taxonomy->show_in_quick_edit; if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { continue; } if ( $taxonomy->hierarchical ) { $hierarchical_taxonomies[] = $taxonomy; } else { $flat_taxonomies[] = $taxonomy; } } $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; $can_publish = current_user_can( $post_type_object->cap->publish_posts ); $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true, ); ?> - -
            - - post_type}"; $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; $bulk = 0; while ( $bulk < 2 ) : $classes = $inline_edit_classes . ' '; $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes; ?> - - - - -
            -
            - get_charset_collate(); function wp_get_db_schema( $scope = 'all', $blog_id = null ) { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); if ( $blog_id && $blog_id != $wpdb->blogid ) { $old_blog_id = $wpdb->set_blog_id( $blog_id ); } $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); $max_index_length = 191; $blog_tables = "CREATE TABLE $wpdb->termmeta ( - meta_id bigint(20) unsigned NOT NULL auto_increment, - term_id bigint(20) unsigned NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY term_id (term_id), - KEY meta_key (meta_key($max_index_length)) -) $charset_collate; -CREATE TABLE $wpdb->terms ( - term_id bigint(20) unsigned NOT NULL auto_increment, - name varchar(200) NOT NULL default '', - slug varchar(200) NOT NULL default '', - term_group bigint(10) NOT NULL default 0, - PRIMARY KEY (term_id), - KEY slug (slug($max_index_length)), - KEY name (name($max_index_length)) -) $charset_collate; -CREATE TABLE $wpdb->term_taxonomy ( - term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, - term_id bigint(20) unsigned NOT NULL default 0, - taxonomy varchar(32) NOT NULL default '', - description longtext NOT NULL, - parent bigint(20) unsigned NOT NULL default 0, - count bigint(20) NOT NULL default 0, - PRIMARY KEY (term_taxonomy_id), - UNIQUE KEY term_id_taxonomy (term_id,taxonomy), - KEY taxonomy (taxonomy) -) $charset_collate; -CREATE TABLE $wpdb->term_relationships ( - object_id bigint(20) unsigned NOT NULL default 0, - term_taxonomy_id bigint(20) unsigned NOT NULL default 0, - term_order int(11) NOT NULL default 0, - PRIMARY KEY (object_id,term_taxonomy_id), - KEY term_taxonomy_id (term_taxonomy_id) -) $charset_collate; -CREATE TABLE $wpdb->commentmeta ( - meta_id bigint(20) unsigned NOT NULL auto_increment, - comment_id bigint(20) unsigned NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY comment_id (comment_id), - KEY meta_key (meta_key($max_index_length)) -) $charset_collate; -CREATE TABLE $wpdb->comments ( - comment_ID bigint(20) unsigned NOT NULL auto_increment, - comment_post_ID bigint(20) unsigned NOT NULL default '0', - comment_author tinytext NOT NULL, - comment_author_email varchar(100) NOT NULL default '', - comment_author_url varchar(200) NOT NULL default '', - comment_author_IP varchar(100) NOT NULL default '', - comment_date datetime NOT NULL default '0000-00-00 00:00:00', - comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - comment_content text NOT NULL, - comment_karma int(11) NOT NULL default '0', - comment_approved varchar(20) NOT NULL default '1', - comment_agent varchar(255) NOT NULL default '', - comment_type varchar(20) NOT NULL default 'comment', - comment_parent bigint(20) unsigned NOT NULL default '0', - user_id bigint(20) unsigned NOT NULL default '0', - PRIMARY KEY (comment_ID), - KEY comment_post_ID (comment_post_ID), - KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), - KEY comment_date_gmt (comment_date_gmt), - KEY comment_parent (comment_parent), - KEY comment_author_email (comment_author_email(10)) -) $charset_collate; -CREATE TABLE $wpdb->links ( - link_id bigint(20) unsigned NOT NULL auto_increment, - link_url varchar(255) NOT NULL default '', - link_name varchar(255) NOT NULL default '', - link_image varchar(255) NOT NULL default '', - link_target varchar(25) NOT NULL default '', - link_description varchar(255) NOT NULL default '', - link_visible varchar(20) NOT NULL default 'Y', - link_owner bigint(20) unsigned NOT NULL default '1', - link_rating int(11) NOT NULL default '0', - link_updated datetime NOT NULL default '0000-00-00 00:00:00', - link_rel varchar(255) NOT NULL default '', - link_notes mediumtext NOT NULL, - link_rss varchar(255) NOT NULL default '', - PRIMARY KEY (link_id), - KEY link_visible (link_visible) -) $charset_collate; -CREATE TABLE $wpdb->options ( - option_id bigint(20) unsigned NOT NULL auto_increment, - option_name varchar(191) NOT NULL default '', - option_value longtext NOT NULL, - autoload varchar(20) NOT NULL default 'yes', - PRIMARY KEY (option_id), - UNIQUE KEY option_name (option_name), - KEY autoload (autoload) -) $charset_collate; -CREATE TABLE $wpdb->postmeta ( - meta_id bigint(20) unsigned NOT NULL auto_increment, - post_id bigint(20) unsigned NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY post_id (post_id), - KEY meta_key (meta_key($max_index_length)) -) $charset_collate; -CREATE TABLE $wpdb->posts ( - ID bigint(20) unsigned NOT NULL auto_increment, - post_author bigint(20) unsigned NOT NULL default '0', - post_date datetime NOT NULL default '0000-00-00 00:00:00', - post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content longtext NOT NULL, - post_title text NOT NULL, - post_excerpt text NOT NULL, - post_status varchar(20) NOT NULL default 'publish', - comment_status varchar(20) NOT NULL default 'open', - ping_status varchar(20) NOT NULL default 'open', - post_password varchar(255) NOT NULL default '', - post_name varchar(200) NOT NULL default '', - to_ping text NOT NULL, - pinged text NOT NULL, - post_modified datetime NOT NULL default '0000-00-00 00:00:00', - post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content_filtered longtext NOT NULL, - post_parent bigint(20) unsigned NOT NULL default '0', - guid varchar(255) NOT NULL default '', - menu_order int(11) NOT NULL default '0', - post_type varchar(20) NOT NULL default 'post', - post_mime_type varchar(100) NOT NULL default '', - comment_count bigint(20) NOT NULL default '0', - PRIMARY KEY (ID), - KEY post_name (post_name($max_index_length)), - KEY type_status_date (post_type,post_status,post_date,ID), - KEY post_parent (post_parent), - KEY post_author (post_author) -) $charset_collate;\n"; $users_single_table = "CREATE TABLE $wpdb->users ( - ID bigint(20) unsigned NOT NULL auto_increment, - user_login varchar(60) NOT NULL default '', - user_pass varchar(255) NOT NULL default '', - user_nicename varchar(50) NOT NULL default '', - user_email varchar(100) NOT NULL default '', - user_url varchar(100) NOT NULL default '', - user_registered datetime NOT NULL default '0000-00-00 00:00:00', - user_activation_key varchar(255) NOT NULL default '', - user_status int(11) NOT NULL default '0', - display_name varchar(250) NOT NULL default '', - PRIMARY KEY (ID), - KEY user_login_key (user_login), - KEY user_nicename (user_nicename), - KEY user_email (user_email) -) $charset_collate;\n"; $users_multi_table = "CREATE TABLE $wpdb->users ( - ID bigint(20) unsigned NOT NULL auto_increment, - user_login varchar(60) NOT NULL default '', - user_pass varchar(255) NOT NULL default '', - user_nicename varchar(50) NOT NULL default '', - user_email varchar(100) NOT NULL default '', - user_url varchar(100) NOT NULL default '', - user_registered datetime NOT NULL default '0000-00-00 00:00:00', - user_activation_key varchar(255) NOT NULL default '', - user_status int(11) NOT NULL default '0', - display_name varchar(250) NOT NULL default '', - spam tinyint(2) NOT NULL default '0', - deleted tinyint(2) NOT NULL default '0', - PRIMARY KEY (ID), - KEY user_login_key (user_login), - KEY user_nicename (user_nicename), - KEY user_email (user_email) -) $charset_collate;\n"; $usermeta_table = "CREATE TABLE $wpdb->usermeta ( - umeta_id bigint(20) unsigned NOT NULL auto_increment, - user_id bigint(20) unsigned NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (umeta_id), - KEY user_id (user_id), - KEY meta_key (meta_key($max_index_length)) -) $charset_collate;\n"; if ( $is_multisite ) { $global_tables = $users_multi_table . $usermeta_table; } else { $global_tables = $users_single_table . $usermeta_table; } $ms_global_tables = "CREATE TABLE $wpdb->blogs ( - blog_id bigint(20) NOT NULL auto_increment, - site_id bigint(20) NOT NULL default '0', - domain varchar(200) NOT NULL default '', - path varchar(100) NOT NULL default '', - registered datetime NOT NULL default '0000-00-00 00:00:00', - last_updated datetime NOT NULL default '0000-00-00 00:00:00', - public tinyint(2) NOT NULL default '1', - archived tinyint(2) NOT NULL default '0', - mature tinyint(2) NOT NULL default '0', - spam tinyint(2) NOT NULL default '0', - deleted tinyint(2) NOT NULL default '0', - lang_id int(11) NOT NULL default '0', - PRIMARY KEY (blog_id), - KEY domain (domain(50),path(5)), - KEY lang_id (lang_id) -) $charset_collate; -CREATE TABLE $wpdb->blogmeta ( - meta_id bigint(20) unsigned NOT NULL auto_increment, - blog_id bigint(20) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY meta_key (meta_key($max_index_length)), - KEY blog_id (blog_id) -) $charset_collate; -CREATE TABLE $wpdb->registration_log ( - ID bigint(20) NOT NULL auto_increment, - email varchar(255) NOT NULL default '', - IP varchar(30) NOT NULL default '', - blog_id bigint(20) NOT NULL default '0', - date_registered datetime NOT NULL default '0000-00-00 00:00:00', - PRIMARY KEY (ID), - KEY IP (IP) -) $charset_collate; -CREATE TABLE $wpdb->site ( - id bigint(20) NOT NULL auto_increment, - domain varchar(200) NOT NULL default '', - path varchar(100) NOT NULL default '', - PRIMARY KEY (id), - KEY domain (domain(140),path(51)) -) $charset_collate; -CREATE TABLE $wpdb->sitemeta ( - meta_id bigint(20) NOT NULL auto_increment, - site_id bigint(20) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value longtext, - PRIMARY KEY (meta_id), - KEY meta_key (meta_key($max_index_length)), - KEY site_id (site_id) -) $charset_collate; -CREATE TABLE $wpdb->signups ( - signup_id bigint(20) NOT NULL auto_increment, - domain varchar(200) NOT NULL default '', - path varchar(100) NOT NULL default '', - title longtext NOT NULL, - user_login varchar(60) NOT NULL default '', - user_email varchar(100) NOT NULL default '', - registered datetime NOT NULL default '0000-00-00 00:00:00', - activated datetime NOT NULL default '0000-00-00 00:00:00', - active tinyint(1) NOT NULL default '0', - activation_key varchar(50) NOT NULL default '', - meta longtext, - PRIMARY KEY (signup_id), - KEY activation_key (activation_key), - KEY user_email (user_email), - KEY user_login_email (user_login,user_email), - KEY domain_path (domain(140),path(51)) -) $charset_collate;"; switch ( $scope ) { case 'blog': $queries = $blog_tables; break; case 'global': $queries = $global_tables; if ( $is_multisite ) { $queries .= $ms_global_tables; } break; case 'ms_global': $queries = $ms_global_tables; break; case 'all': default: $queries = $global_tables . $blog_tables; if ( $is_multisite ) { $queries .= $ms_global_tables; } break; } if ( isset( $old_blog_id ) ) { $wpdb->set_blog_id( $old_blog_id ); } return $queries; } $wp_queries = wp_get_db_schema( 'all' ); function populate_options( array $options = array() ) { global $wpdb, $wp_db_version, $wp_current_db_version; $guessurl = wp_guess_url(); do_action( 'populate_options' ); $stylesheet = WP_DEFAULT_THEME; $template = WP_DEFAULT_THEME; $theme = wp_get_theme( WP_DEFAULT_THEME ); if ( ! $theme->exists() ) { $theme = WP_Theme::get_core_default_theme(); } if ( $theme ) { $stylesheet = $theme->get_stylesheet(); $template = $theme->get_template(); } $timezone_string = ''; $gmt_offset = 0; $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); if ( is_numeric( $offset_or_tz ) ) { $gmt_offset = $offset_or_tz; } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { $timezone_string = $offset_or_tz; } $defaults = array( 'siteurl' => $guessurl, 'home' => $guessurl, 'blogname' => __( 'My Site' ), 'blogdescription' => __( 'Just another WordPress site' ), 'users_can_register' => 0, 'admin_email' => 'you@example.com', 'start_of_week' => _x( '1', 'start of week' ), 'use_balanceTags' => 0, 'use_smilies' => 1, 'require_name_email' => 1, 'comments_notify' => 1, 'posts_per_rss' => 10, 'rss_use_excerpt' => 0, 'mailserver_url' => 'mail.example.com', 'mailserver_login' => 'login@example.com', 'mailserver_pass' => 'password', 'mailserver_port' => 110, 'default_category' => 1, 'default_comment_status' => 'open', 'default_ping_status' => 'open', 'default_pingback_flag' => 1, 'posts_per_page' => 10, 'date_format' => __( 'F j, Y' ), 'time_format' => __( 'g:i a' ), 'links_updated_date_format' => __( 'F j, Y g:i a' ), 'comment_moderation' => 0, 'moderation_notify' => 1, 'permalink_structure' => '', 'rewrite_rules' => '', 'hack_file' => 0, 'blog_charset' => 'UTF-8', 'moderation_keys' => '', 'active_plugins' => array(), 'category_base' => '', 'ping_sites' => 'http://rpc.pingomatic.com/', 'comment_max_links' => 2, 'gmt_offset' => $gmt_offset, 'default_email_category' => 1, 'recently_edited' => '', 'template' => $template, 'stylesheet' => $stylesheet, 'comment_registration' => 0, 'html_type' => 'text/html', 'use_trackback' => 0, 'default_role' => 'subscriber', 'db_version' => $wp_db_version, 'uploads_use_yearmonth_folders' => 1, 'upload_path' => '', 'blog_public' => '1', 'default_link_category' => 2, 'show_on_front' => 'posts', 'tag_base' => '', 'show_avatars' => '1', 'avatar_rating' => 'G', 'upload_url_path' => '', 'thumbnail_size_w' => 150, 'thumbnail_size_h' => 150, 'thumbnail_crop' => 1, 'medium_size_w' => 300, 'medium_size_h' => 300, 'avatar_default' => 'mystery', 'large_size_w' => 1024, 'large_size_h' => 1024, 'image_default_link_type' => 'none', 'image_default_size' => '', 'image_default_align' => '', 'close_comments_for_old_posts' => 0, 'close_comments_days_old' => 14, 'thread_comments' => 1, 'thread_comments_depth' => 5, 'page_comments' => 0, 'comments_per_page' => 50, 'default_comments_page' => 'newest', 'comment_order' => 'asc', 'sticky_posts' => array(), 'widget_categories' => array(), 'widget_text' => array(), 'widget_rss' => array(), 'uninstall_plugins' => array(), 'timezone_string' => $timezone_string, 'page_for_posts' => 0, 'page_on_front' => 0, 'default_post_format' => 0, 'link_manager_enabled' => 0, 'finished_splitting_shared_terms' => 1, 'site_icon' => 0, 'medium_large_size_w' => 768, 'medium_large_size_h' => 0, 'wp_page_for_privacy_policy' => 0, 'show_comments_cookies_opt_in' => 1, 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), 'disallowed_keys' => '', 'comment_previously_approved' => 1, 'auto_plugin_theme_update_emails' => array(), 'auto_update_core_dev' => 'enabled', 'auto_update_core_minor' => 'enabled', 'auto_update_core_major' => 'enabled', 'wp_force_deactivated_plugins' => array(), ); if ( ! is_multisite() ) { $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version ? $wp_current_db_version : $wp_db_version; } if ( is_multisite() ) { $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; } $options = wp_parse_args( $options, $defaults ); $fat_options = array( 'moderation_keys', 'recently_edited', 'disallowed_keys', 'uninstall_plugins', 'auto_plugin_theme_update_emails', ); $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); $insert = ''; foreach ( $options as $option => $value ) { if ( in_array( $option, $existing_options, true ) ) { continue; } if ( in_array( $option, $fat_options, true ) ) { $autoload = 'no'; } else { $autoload = 'yes'; } if ( is_array( $value ) ) { $value = serialize( $value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload ); } if ( ! empty( $insert ) ) { $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); } if ( ! __get_option( 'home' ) ) { update_option( 'home', $guessurl ); } $unusedoptions = array( 'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit', ); foreach ( $unusedoptions as $option ) { delete_option( $option ); } $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" ); delete_expired_transients( true ); } function populate_roles() { populate_roles_160(); populate_roles_210(); populate_roles_230(); populate_roles_250(); populate_roles_260(); populate_roles_270(); populate_roles_280(); populate_roles_300(); } function populate_roles_160() { add_role( 'administrator', 'Administrator' ); add_role( 'editor', 'Editor' ); add_role( 'author', 'Author' ); add_role( 'contributor', 'Contributor' ); add_role( 'subscriber', 'Subscriber' ); $role = get_role( 'administrator' ); $role->add_cap( 'switch_themes' ); $role->add_cap( 'edit_themes' ); $role->add_cap( 'activate_plugins' ); $role->add_cap( 'edit_plugins' ); $role->add_cap( 'edit_users' ); $role->add_cap( 'edit_files' ); $role->add_cap( 'manage_options' ); $role->add_cap( 'moderate_comments' ); $role->add_cap( 'manage_categories' ); $role->add_cap( 'manage_links' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'import' ); $role->add_cap( 'unfiltered_html' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_others_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'edit_pages' ); $role->add_cap( 'read' ); $role->add_cap( 'level_10' ); $role->add_cap( 'level_9' ); $role->add_cap( 'level_8' ); $role->add_cap( 'level_7' ); $role->add_cap( 'level_6' ); $role->add_cap( 'level_5' ); $role->add_cap( 'level_4' ); $role->add_cap( 'level_3' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'editor' ); $role->add_cap( 'moderate_comments' ); $role->add_cap( 'manage_categories' ); $role->add_cap( 'manage_links' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'unfiltered_html' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_others_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'edit_pages' ); $role->add_cap( 'read' ); $role->add_cap( 'level_7' ); $role->add_cap( 'level_6' ); $role->add_cap( 'level_5' ); $role->add_cap( 'level_4' ); $role->add_cap( 'level_3' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'author' ); $role->add_cap( 'upload_files' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'edit_published_posts' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'read' ); $role->add_cap( 'level_2' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'contributor' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'read' ); $role->add_cap( 'level_1' ); $role->add_cap( 'level_0' ); $role = get_role( 'subscriber' ); $role->add_cap( 'read' ); $role->add_cap( 'level_0' ); } function populate_roles_210() { $roles = array( 'administrator', 'editor' ); foreach ( $roles as $role ) { $role = get_role( $role ); if ( empty( $role ) ) { continue; } $role->add_cap( 'edit_others_pages' ); $role->add_cap( 'edit_published_pages' ); $role->add_cap( 'publish_pages' ); $role->add_cap( 'delete_pages' ); $role->add_cap( 'delete_others_pages' ); $role->add_cap( 'delete_published_pages' ); $role->add_cap( 'delete_posts' ); $role->add_cap( 'delete_others_posts' ); $role->add_cap( 'delete_published_posts' ); $role->add_cap( 'delete_private_posts' ); $role->add_cap( 'edit_private_posts' ); $role->add_cap( 'read_private_posts' ); $role->add_cap( 'delete_private_pages' ); $role->add_cap( 'edit_private_pages' ); $role->add_cap( 'read_private_pages' ); } $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_users' ); $role->add_cap( 'create_users' ); } $role = get_role( 'author' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_posts' ); $role->add_cap( 'delete_published_posts' ); } $role = get_role( 'contributor' ); if ( ! empty( $role ) ) { $role->add_cap( 'delete_posts' ); } } function populate_roles_230() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'unfiltered_upload' ); } } function populate_roles_250() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'edit_dashboard' ); } } function populate_roles_260() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'update_plugins' ); $role->add_cap( 'delete_plugins' ); } } function populate_roles_270() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'install_plugins' ); $role->add_cap( 'update_themes' ); } } function populate_roles_280() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'install_themes' ); } } function populate_roles_300() { $role = get_role( 'administrator' ); if ( ! empty( $role ) ) { $role->add_cap( 'update_core' ); $role->add_cap( 'list_users' ); $role->add_cap( 'remove_users' ); $role->add_cap( 'promote_users' ); $role->add_cap( 'edit_theme_options' ); $role->add_cap( 'delete_themes' ); $role->add_cap( 'export' ); } } if ( ! function_exists( 'install_network' ) ) : function install_network() { if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { define( 'WP_INSTALLING_NETWORK', true ); } dbDelta( wp_get_db_schema( 'global' ) ); } endif; function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { global $wpdb, $current_site, $wp_rewrite; $errors = new WP_Error(); if ( '' === $domain ) { $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); } if ( '' === $site_name ) { $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); } $network_exists = false; if ( is_multisite() ) { if ( get_network( (int) $network_id ) ) { $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); } } else { if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); } } if ( ! is_email( $email ) ) { $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); } if ( $errors->has_errors() ) { return $errors; } if ( 1 == $network_id ) { $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, ) ); $network_id = $wpdb->insert_id; } else { $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id, ) ); } populate_network_meta( $network_id, array( 'admin_email' => $email, 'site_name' => $site_name, 'subdomain_install' => $subdomain_install, ) ); $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) ); if ( ! is_multisite() ) { $current_site = new stdClass; $current_site->domain = $domain; $current_site->path = $path; $current_site->site_name = ucfirst( $domain ); $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ), ) ); $current_site->blog_id = $wpdb->insert_id; update_user_meta( $site_user->ID, 'source_domain', $domain ); update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id ); if ( $subdomain_install ) { $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); } else { $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); } flush_rewrite_rules(); if ( ! $subdomain_install ) { return true; } $vhost_ok = false; $errstr = ''; $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1', ) ); if ( is_wp_error( $page ) ) { $errstr = $page->get_error_message(); } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { $vhost_ok = true; } if ( ! $vhost_ok ) { $msg = '

            ' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '

            '; $msg .= '

            ' . sprintf( __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), '' . $hostname . '' ); if ( ! empty( $errstr ) ) { $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '' . $errstr . '' ); } $msg .= '

            '; $msg .= '

            ' . sprintf( __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), '*' ) . '

            '; $msg .= '

            ' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '

            '; return new WP_Error( 'no_wildcard_dns', $msg ); } } return true; } function populate_network_meta( $network_id, array $meta = array() ) { global $wpdb, $wp_db_version; $network_id = (int) $network_id; $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : ''; $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0; $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false; if ( false === $site_user ) { $site_user = wp_get_current_user(); } if ( empty( $email ) ) { $email = $site_user->user_email; } $template = get_option( 'template' ); $stylesheet = get_option( 'stylesheet' ); $allowed_themes = array( $stylesheet => true ); if ( $template != $stylesheet ) { $allowed_themes[ $template ] = true; } if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { $allowed_themes[ WP_DEFAULT_THEME ] = true; } if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { $core_default = WP_Theme::get_core_default_theme(); if ( $core_default ) { $allowed_themes[ $core_default->get_stylesheet() ] = true; } } if ( function_exists( 'clean_network_cache' ) ) { clean_network_cache( $network_id ); } else { wp_cache_delete( $network_id, 'networks' ); } if ( ! is_multisite() ) { $site_admins = array( $site_user->user_login ); $users = get_users( array( 'fields' => array( 'user_login' ), 'role' => 'administrator', ) ); if ( $users ) { foreach ( $users as $user ) { $site_admins[] = $user->user_login; } $site_admins = array_unique( $site_admins ); } } else { $site_admins = get_site_option( 'site_admins' ); } $welcome_email = __( 'Howdy USERNAME, - -Your new SITE_NAME site has been successfully set up at: -BLOG_URL - -You can log in to the administrator account with the following information: - -Username: USERNAME -Password: PASSWORD -Log in here: BLOG_URLwp-login.php - -We hope you enjoy your new site. Thanks! - ---The Team @ SITE_NAME' ); $misc_exts = array( 'jpg', 'jpeg', 'png', 'gif', 'webp', 'mov', 'avi', 'mpg', '3gp', '3g2', 'midi', 'mid', 'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key', ); $audio_exts = wp_get_audio_extensions(); $video_exts = wp_get_video_extensions(); $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); $sitemeta = array( 'site_name' => __( 'My Network' ), 'admin_email' => $email, 'admin_user_id' => $site_user->ID, 'registration' => 'none', 'upload_filetypes' => implode( ' ', $upload_filetypes ), 'blog_upload_space' => 100, 'fileupload_maxk' => 1500, 'site_admins' => $site_admins, 'allowedthemes' => $allowed_themes, 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), 'wpmu_upgrade_site' => $wp_db_version, 'welcome_email' => $welcome_email, 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ), 'siteurl' => get_option( 'siteurl' ) . '/', 'add_new_users' => '0', 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', 'subdomain_install' => $subdomain_install, 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', 'user_count' => get_site_option( 'user_count' ), 'initial_db_version' => get_option( 'initial_db_version' ), 'active_sitewide_plugins' => array(), 'WPLANG' => get_locale(), ); if ( ! $subdomain_install ) { $sitemeta['illegal_names'][] = 'blog'; } $sitemeta = wp_parse_args( $meta, $sitemeta ); $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); $insert = ''; foreach ( $sitemeta as $meta_key => $meta_value ) { if ( is_array( $meta_value ) ) { $meta_value = serialize( $meta_value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); } $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); } function populate_site_meta( $site_id, array $meta = array() ) { global $wpdb; $site_id = (int) $site_id; if ( ! is_site_meta_supported() ) { return; } if ( empty( $meta ) ) { return; } $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id ); $insert = ''; foreach ( $site_meta as $meta_key => $meta_value ) { if ( is_array( $meta_value ) ) { $meta_value = serialize( $meta_value ); } if ( ! empty( $insert ) ) { $insert .= ', '; } $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value ); } $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); wp_cache_delete( $site_id, 'blog_meta' ); wp_cache_set_sites_last_changed(); } '', 1 => __( 'Item added.' ), 2 => __( 'Item deleted.' ), 3 => __( 'Item updated.' ), 4 => __( 'Item not added.' ), 5 => __( 'Item not updated.' ), 6 => __( 'Items deleted.' ), ); $messages['category'] = array( 0 => '', 1 => __( 'Category added.' ), 2 => __( 'Category deleted.' ), 3 => __( 'Category updated.' ), 4 => __( 'Category not added.' ), 5 => __( 'Category not updated.' ), 6 => __( 'Categories deleted.' ), ); $messages['post_tag'] = array( 0 => '', 1 => __( 'Tag added.' ), 2 => __( 'Tag deleted.' ), 3 => __( 'Tag updated.' ), 4 => __( 'Tag not added.' ), 5 => __( 'Tag not updated.' ), 6 => __( 'Tags deleted.' ), ); $messages = apply_filters( 'term_updated_messages', $messages ); $message = false; if ( isset( $_REQUEST['message'] ) && (int) $_REQUEST['message'] ) { $msg = (int) $_REQUEST['message']; if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { $message = $messages[ $taxonomy ][ $msg ]; } elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) { $message = $messages['_item'][ $msg ]; } } status; $request_id = $item->ID; $row_actions = array(); if ( 'request-confirmed' !== $status ) { $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $erasers_count = count( $erasers ); $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); $remove_data_markup = ''; $remove_data_markup .= '' . '' . '' . ''; $remove_data_markup .= ''; $row_actions['remove-data'] = $remove_data_markup; } if ( 'request-completed' !== $status ) { $complete_request_markup = ''; $complete_request_markup .= sprintf( '%s', esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'complete', 'request_id' => array( $request_id ), ), admin_url( 'erase-personal-data.php' ) ), 'bulk-privacy_requests' ) ), esc_attr( sprintf( __( 'Mark export request for “%s” as completed.' ), $item->email ) ), __( 'Complete request' ) ); $complete_request_markup .= ''; } if ( ! empty( $complete_request_markup ) ) { $row_actions['complete-request'] = $complete_request_markup; } return sprintf( '%2$s %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) ); } public function column_next_steps( $item ) { $status = $item->status; switch ( $status ) { case 'request-pending': esc_html_e( 'Waiting for confirmation' ); break; case 'request-confirmed': $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); $erasers_count = count( $erasers ); $request_id = $item->ID; $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); echo '
            '; ?> - - - - - '; break; case 'request-failed': echo ''; break; case 'request-completed': echo '' . esc_html__( 'Remove request' ) . ''; break; } } } _screen = $screen; if ( ! empty( $columns ) ) { $this->_columns = $columns; add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); } } protected function get_column_info() { $columns = get_column_headers( $this->_screen ); $hidden = get_hidden_columns( $this->_screen ); $sortable = array(); $primary = $this->get_default_primary_column_name(); return array( $columns, $hidden, $sortable, $primary ); } public function get_columns() { return $this->_columns; } } 'WordPress/' . $version . '; ' . home_url( '/' ) ); if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $response = wp_remote_get( $url, $options ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $results = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $results ) ) { return false; } set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); } return $results; } function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { $display_name = '' . esc_html( $display_name ) . ''; } function _wp_credits_build_object_link( &$data ) { $data = '' . esc_html( $data[0] ) . ''; } function wp_credits_section_title( $group_data = array() ) { if ( ! count( $group_data ) ) { return; } if ( $group_data['name'] ) { if ( 'Translators' === $group_data['name'] ) { $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); } elseif ( isset( $group_data['placeholders'] ) ) { $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); } else { $title = translate( $group_data['name'] ); } echo '

            ' . esc_html( $title ) . "

            \n"; } } function wp_credits_section_list( $credits = array(), $slug = '' ) { $group_data = isset( $credits['groups'][ $slug ] ) ? $credits['groups'][ $slug ] : array(); $credits_data = $credits['data']; if ( ! count( $group_data ) ) { return; } if ( ! empty( $group_data['shuffle'] ) ) { shuffle( $group_data['data'] ); } switch ( $group_data['type'] ) { case 'list': array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits_data['profiles'] ); echo '

            ' . wp_sprintf( '%l.', $group_data['data'] ) . "

            \n\n"; break; case 'libraries': array_walk( $group_data['data'], '_wp_credits_build_object_link' ); echo '

            ' . wp_sprintf( '%l.', $group_data['data'] ) . "

            \n\n"; break; default: $compact = 'compact' === $group_data['type']; $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); echo '\n"; break; } } prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); if ( $wpdb->get_var( $sql ) ) { return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); } return false; } function allow_subdomain_install() { $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { return false; } return true; } function allow_subdirectory_install() { global $wpdb; if ( apply_filters( 'allow_subdirectory_install', false ) ) { return true; } if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) { return true; } $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); if ( empty( $post ) ) { return true; } return false; } function get_clean_basedomain() { $existing_domain = network_domain_check(); if ( $existing_domain ) { return $existing_domain; } $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); $slash = strpos( $domain, '/' ); if ( $slash ) { $domain = substr( $domain, 0, $slash ); } return $domain; } function network_step1( $errors = false ) { global $is_apache; if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { echo '

            ' . __( 'Error:' ) . ' ' . sprintf( __( 'The constant %s cannot be defined when creating a network.' ), 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) . '

            '; echo '
            '; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $active_plugins = get_option( 'active_plugins' ); if ( ! empty( $active_plugins ) ) { echo '

            ' . __( 'Warning:' ) . ' ' . sprintf( __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '

            '; echo '

            ' . __( 'Once the network is created, you may reactivate your plugins.' ) . '

            '; echo ''; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } $hostname = get_clean_basedomain(); $has_ports = strstr( $hostname, ':' ); if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { echo '

            ' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '

            '; echo '

            ' . sprintf( __( 'You cannot use port numbers such as %s.' ), '' . $has_ports . '' ) . '

            '; echo '' . __( 'Go to Dashboard' ) . ''; echo ''; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); } echo '
            '; wp_nonce_field( 'install-network-1' ); $error_codes = array(); if ( is_wp_error( $errors ) ) { echo '

            ' . __( 'Error: The network could not be created.' ) . '

            '; foreach ( $errors->get_error_messages() as $error ) { echo "

            $error

            "; } echo '
            '; $error_codes = $errors->get_error_codes(); } if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) { $site_name = $_POST['sitename']; } else { $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); } if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) { $admin_email = $_POST['email']; } else { $admin_email = get_option( 'admin_email' ); } ?> -

            -

            -

            ' . __( 'Note:' ) . ' '; printf( __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), 'mod_rewrite' ); echo '

            '; } elseif ( $is_apache ) { echo '

            ' . __( 'Warning:' ) . ' '; printf( __( 'It looks like the Apache %s module is not installed.' ), 'mod_rewrite' ); echo '

            '; } if ( $got_mod_rewrite || $is_apache ) { echo '

            '; printf( __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ), 'mod_rewrite', 'https://httpd.apache.org/docs/mod/mod_rewrite.html', 'https://www.google.com/search?q=apache+mod_rewrite' ); echo '

            '; } } if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> -

            -

            -

            -

            - - - - - - - - - - - - -

            ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

            '; } $is_www = ( 0 === strpos( $hostname, 'www.' ) ); if ( $is_www ) : ?> -

            -

            - ' . substr( $hostname, 4 ) . '', '' . $hostname . '', 'www' ); ?> -

            - - - - - - - - -

            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            - ' . $errors->get_error_message() . ''; } if ( $_POST ) { if ( allow_subdomain_install() ) { $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; } else { $subdomain_install = false; } } else { if ( is_multisite() ) { $subdomain_install = is_subdomain_install(); ?> -

            - get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); ?> -

            -

            - -

            -

            -

            - ' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %1$s and %2$s files.' ), 'wp-config.php', '.htaccess' ); } elseif ( file_exists( $home_path . 'web.config' ) ) { echo '' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %1$s and %2$s files.' ), 'wp-config.php', 'web.config' ); } else { echo '' . __( 'Caution:' ) . ' '; printf( __( 'You should back up your existing %s file.' ), 'wp-config.php' ); } ?> -

            - -
              -
            1. - above the line reading %3$s:' ), 'wp-config.php', '' . $location_of_wp_config . '', '/* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */' ); ?> -

              - - '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '', ); foreach ( $keys_salts as $c => $v ) { if ( defined( $c ) ) { unset( $keys_salts[ $c ] ); } } if ( ! empty( $keys_salts ) ) { $keys_salts_str = ''; $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); if ( is_wp_error( $from_api ) ) { foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; } } else { $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; } } $num_keys_salts = count( $keys_salts ); ?> -

              - wp-config.php' ); } else { printf( __( 'These unique authentication keys are also missing from your %s file.' ), 'wp-config.php' ); } ?> - -

              - - -
            2. - - - - - - - - - '; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $web_config_file .= ' - - - - '; } $web_config_file .= ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'; echo '
            3. '; printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), 'web.config', '' . $home_path . '' ); echo '

              '; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '

              ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

              '; } ?> - -
            4. -
            - -

            '; printf( __( 'It seems your network is running with Nginx web server. Learn more about further configuration.' ), __( 'https://wordpress.org/support/article/nginx/' ) ); echo '

            '; else : $ms_files_rewriting = ''; if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; } $htaccess_file = <<

            '; printf( __( 'Add the following to your %1$s file in %2$s, replacing other WordPress rules:' ), '.htaccess', '' . $home_path . '' ); echo '

            '; if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { echo '

            ' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

            '; } ?> - - - - - -

            - 400 ? 400 / $big : 1; $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $can_restore = false; if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) { $can_restore = wp_basename( $meta['file'] ) !== $backup_sizes['full-orig']['file']; } if ( $msg ) { if ( isset( $msg->error ) ) { $note = ""; } elseif ( isset( $msg->msg ) ) { $note = ""; } } $edit_custom_sizes = false; $edit_custom_sizes = apply_filters( 'edit_custom_thumbnail_sizes', $edit_custom_sizes ); ?> -
            -
            - -
            - -
            - - get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ), ) ) ) { $note_no_rotate = ''; ?> - - - ' . __( 'Image rotation is not supported by your web host.' ) . '

            '; ?> - - - - - - - -
            - - - -
            - - - - - - - - -
            - -
            - -
            - - )" disabled="disabled" class="button button-primary imgedit-submit-btn" value="" /> -
            -
            - -
            -
            -
            -

            - -
            -

            -
            - -

            - ' . $meta['width'] . ' × ' . $meta['height'] . '' ); ?> -

            - -
            - -
            - -
            - - - - - - ! -
            , 'scale')" class="button button-primary" value="" />
            -
            -
            - -
            -
            -
            - - - -
            -
            -

            -
            -

            - -

            -
            - , 'restore')" class="button button-primary" value="" /> -
            -
            -
            -
            - - - -
            -
            -

            - - -
            -

            - -


            -

            - -


            -

            -
            -
            - -
            - -
            - - - - - -
            -
            - -
            - -
            - - - - - -
            -
            - -
            - - - -
            -
            -

            - -
            -

            -
            -
            - -
            - -
            -
            - -
            -
            - - - - - - - - - - - - - - - - - $size ) { if ( array_key_exists( $size, $meta['sizes'] ) ) { if ( 'thumbnail' === $size ) { continue; } ?> - - - - - -
            -
            -
            - - - -
            - -
            -
            - -
            - stream( $mime_type ) ) ) { return false; } return true; } else { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); $image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' ); switch ( $mime_type ) { case 'image/jpeg': header( 'Content-Type: image/jpeg' ); return imagejpeg( $image, null, 90 ); case 'image/png': header( 'Content-Type: image/png' ); return imagepng( $image ); case 'image/gif': header( 'Content-Type: image/gif' ); return imagegif( $image ); case 'image/webp': if ( function_exists( 'imagewebp' ) ) { header( 'Content-Type: image/webp' ); return imagewebp( $image, null, 90 ); } return false; default: return false; } } } function wp_save_image_file( $filename, $image, $mime_type, $post_id ) { if ( $image instanceof WP_Image_Editor ) { $image = apply_filters( 'image_editor_save_pre', $image, $post_id ); $saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id ); if ( null !== $saved ) { return $saved; } return $image->save( $filename, $mime_type ); } else { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); $image = apply_filters_deprecated( 'image_save_pre', array( $image, $post_id ), '3.5.0', 'image_editor_save_pre' ); $saved = apply_filters_deprecated( 'wp_save_image_file', array( null, $filename, $image, $mime_type, $post_id ), '3.5.0', 'wp_save_image_editor_file' ); if ( null !== $saved ) { return $saved; } switch ( $mime_type ) { case 'image/jpeg': return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) ); case 'image/png': return imagepng( $image, $filename ); case 'image/gif': return imagegif( $image, $filename ); case 'image/webp': if ( function_exists( 'imagewebp' ) ) { return imagewebp( $image, $filename ); } return false; default: return false; } } } function _image_get_preview_ratio( $w, $h ) { $max = max( $w, $h ); return $max > 400 ? ( 400 / $max ) : 1; } function _rotate_image_resource( $img, $angle ) { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' ); if ( function_exists( 'imagerotate' ) ) { $rotated = imagerotate( $img, $angle, 0 ); if ( is_gd_image( $rotated ) ) { imagedestroy( $img ); $img = $rotated; } } return $img; } function _flip_image_resource( $img, $horz, $vert ) { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' ); $w = imagesx( $img ); $h = imagesy( $img ); $dst = wp_imagecreatetruecolor( $w, $h ); if ( is_gd_image( $dst ) ) { $sx = $vert ? ( $w - 1 ) : 0; $sy = $horz ? ( $h - 1 ) : 0; $sw = $vert ? -$w : $w; $sh = $horz ? -$h : $h; if ( imagecopyresampled( $dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh ) ) { imagedestroy( $img ); $img = $dst; } } return $img; } function _crop_image_resource( $img, $x, $y, $w, $h ) { $dst = wp_imagecreatetruecolor( $w, $h ); if ( is_gd_image( $dst ) ) { if ( imagecopy( $dst, $img, 0, 0, $x, $y, $w, $h ) ) { imagedestroy( $img ); $img = $dst; } } return $img; } function image_edit_apply_changes( $image, $changes ) { if ( is_gd_image( $image ) ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); } if ( ! is_array( $changes ) ) { return $image; } foreach ( $changes as $key => $obj ) { if ( isset( $obj->r ) ) { $obj->type = 'rotate'; $obj->angle = $obj->r; unset( $obj->r ); } elseif ( isset( $obj->f ) ) { $obj->type = 'flip'; $obj->axis = $obj->f; unset( $obj->f ); } elseif ( isset( $obj->c ) ) { $obj->type = 'crop'; $obj->sel = $obj->c; unset( $obj->c ); } $changes[ $key ] = $obj; } if ( count( $changes ) > 1 ) { $filtered = array( $changes[0] ); for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) { $combined = false; if ( $filtered[ $i ]->type == $changes[ $j ]->type ) { switch ( $filtered[ $i ]->type ) { case 'rotate': $filtered[ $i ]->angle += $changes[ $j ]->angle; $combined = true; break; case 'flip': $filtered[ $i ]->axis ^= $changes[ $j ]->axis; $combined = true; break; } } if ( ! $combined ) { $filtered[ ++$i ] = $changes[ $j ]; } } $changes = $filtered; unset( $filtered ); } if ( $image instanceof WP_Image_Editor ) { $image = apply_filters( 'wp_image_editor_before_change', $image, $changes ); } elseif ( is_gd_image( $image ) ) { $image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' ); } foreach ( $changes as $operation ) { switch ( $operation->type ) { case 'rotate': if ( 0 != $operation->angle ) { if ( $image instanceof WP_Image_Editor ) { $image->rotate( $operation->angle ); } else { $image = _rotate_image_resource( $image, $operation->angle ); } } break; case 'flip': if ( 0 != $operation->axis ) { if ( $image instanceof WP_Image_Editor ) { $image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } else { $image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); } } break; case 'crop': $sel = $operation->sel; if ( $image instanceof WP_Image_Editor ) { $size = $image->get_size(); $w = $size['width']; $h = $size['height']; $scale = 1 / _image_get_preview_ratio( $w, $h ); $image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } else { $scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); $image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale ); } break; } } return $image; } function stream_preview_image( $post_id ) { $post = get_post( $post_id ); wp_raise_memory_limit( 'admin' ); $img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) ); if ( is_wp_error( $img ) ) { return false; } $changes = ! empty( $_REQUEST['history'] ) ? json_decode( wp_unslash( $_REQUEST['history'] ) ) : null; if ( $changes ) { $img = image_edit_apply_changes( $img, $changes ); } $size = $img->get_size(); $w = $size['width']; $h = $size['height']; $ratio = _image_get_preview_ratio( $w, $h ); $w2 = max( 1, $w * $ratio ); $h2 = max( 1, $h * $ratio ); if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) { return false; } return wp_stream_image( $img, $post->post_mime_type, $post_id ); } function wp_restore_image( $post_id ) { $meta = wp_get_attachment_metadata( $post_id ); $file = get_attached_file( $post_id ); $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); $old_backup_sizes = $backup_sizes; $restored = false; $msg = new stdClass; if ( ! is_array( $backup_sizes ) ) { $msg->error = __( 'Cannot load image metadata.' ); return $msg; } $parts = pathinfo( $file ); $suffix = time() . rand( 100, 999 ); $default_sizes = get_intermediate_image_sizes(); if ( isset( $backup_sizes['full-orig'] ) && is_array( $backup_sizes['full-orig'] ) ) { $data = $backup_sizes['full-orig']; if ( $parts['basename'] != $data['file'] ) { if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) { if ( preg_match( '/-e[0-9]{13}\./', $parts['basename'] ) ) { wp_delete_file( $file ); } } elseif ( isset( $meta['width'], $meta['height'] ) ) { $backup_sizes[ "full-$suffix" ] = array( 'width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename'], ); } } $restored_file = path_join( $parts['dirname'], $data['file'] ); $restored = update_attached_file( $post_id, $restored_file ); $meta['file'] = _wp_relative_upload_path( $restored_file ); $meta['width'] = $data['width']; $meta['height'] = $data['height']; } foreach ( $default_sizes as $default_size ) { if ( isset( $backup_sizes[ "$default_size-orig" ] ) ) { $data = $backup_sizes[ "$default_size-orig" ]; if ( isset( $meta['sizes'][ $default_size ] ) && $meta['sizes'][ $default_size ]['file'] != $data['file'] ) { if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) { if ( preg_match( '/-e[0-9]{13}-/', $meta['sizes'][ $default_size ]['file'] ) ) { $delete_file = path_join( $parts['dirname'], $meta['sizes'][ $default_size ]['file'] ); wp_delete_file( $delete_file ); } } else { $backup_sizes[ "$default_size-{$suffix}" ] = $meta['sizes'][ $default_size ]; } } $meta['sizes'][ $default_size ] = $data; } else { unset( $meta['sizes'][ $default_size ] ); } } if ( ! wp_update_attachment_metadata( $post_id, $meta ) || ( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) { $msg->error = __( 'Cannot save image metadata.' ); return $msg; } if ( ! $restored ) { $msg->error = __( 'Image metadata is inconsistent.' ); } else { $msg->msg = __( 'Image restored successfully.' ); } return $msg; } function wp_save_image( $post_id ) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $return = new stdClass; $success = false; $delete = false; $scaled = false; $nocrop = false; $post = get_post( $post_id ); $img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) ); if ( is_wp_error( $img ) ) { $return->error = esc_js( __( 'Unable to create new image.' ) ); return $return; } $fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0; $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0; $target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : ''; $scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do']; if ( $scale && $fwidth > 0 && $fheight > 0 ) { $size = $img->get_size(); $sX = $size['width']; $sY = $size['height']; $diff = round( $sX / $sY, 2 ) - round( $fwidth / $fheight, 2 ); if ( -0.1 < $diff && $diff < 0.1 ) { if ( $img->resize( $fwidth, $fheight ) ) { $scaled = true; } } if ( ! $scaled ) { $return->error = esc_js( __( 'Error while saving the scaled image. Please reload the page and try again.' ) ); return $return; } } elseif ( ! empty( $_REQUEST['history'] ) ) { $changes = json_decode( wp_unslash( $_REQUEST['history'] ) ); if ( $changes ) { $img = image_edit_apply_changes( $img, $changes ); } } else { $return->error = esc_js( __( 'Nothing to save, the image has not changed.' ) ); return $return; } $meta = wp_get_attachment_metadata( $post_id ); $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); if ( ! is_array( $meta ) ) { $return->error = esc_js( __( 'Image data does not exist. Please re-upload the image.' ) ); return $return; } if ( ! is_array( $backup_sizes ) ) { $backup_sizes = array(); } $path = get_attached_file( $post_id ); $basename = pathinfo( $path, PATHINFO_BASENAME ); $dirname = pathinfo( $path, PATHINFO_DIRNAME ); $ext = pathinfo( $path, PATHINFO_EXTENSION ); $filename = pathinfo( $path, PATHINFO_FILENAME ); $suffix = time() . rand( 100, 999 ); if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && isset( $backup_sizes['full-orig'] ) && $backup_sizes['full-orig']['file'] != $basename ) { if ( 'thumbnail' === $target ) { $new_path = "{$dirname}/{$filename}-temp.{$ext}"; } else { $new_path = $path; } } else { while ( true ) { $filename = preg_replace( '/-e([0-9]+)$/', '', $filename ); $filename .= "-e{$suffix}"; $new_filename = "{$filename}.{$ext}"; $new_path = "{$dirname}/$new_filename"; if ( file_exists( $new_path ) ) { $suffix++; } else { break; } } } if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) { $return->error = esc_js( __( 'Unable to save the image.' ) ); return $return; } if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) { $tag = false; if ( isset( $backup_sizes['full-orig'] ) ) { if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] !== $basename ) { $tag = "full-$suffix"; } } else { $tag = 'full-orig'; } if ( $tag ) { $backup_sizes[ $tag ] = array( 'width' => $meta['width'], 'height' => $meta['height'], 'file' => $basename, ); } $success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path ); $meta['file'] = _wp_relative_upload_path( $new_path ); $size = $img->get_size(); $meta['width'] = $size['width']; $meta['height'] = $size['height']; if ( $success ) { $sizes = get_intermediate_image_sizes(); if ( 'nothumb' === $target || 'all' === $target ) { if ( 'nothumb' === $target ) { $sizes = array_diff( $sizes, array( 'thumbnail' ) ); } } elseif ( 'thumbnail' !== $target ) { $sizes = array_diff( $sizes, array( $target ) ); } } $return->fw = $meta['width']; $return->fh = $meta['height']; } elseif ( 'thumbnail' === $target ) { $sizes = array( 'thumbnail' ); $success = true; $delete = true; $nocrop = true; } else { $sizes = array( $target ); $success = true; $delete = true; $nocrop = $_wp_additional_image_sizes[ $size ]['crop']; } if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && ! empty( $meta['sizes'] ) ) { foreach ( $meta['sizes'] as $size ) { if ( ! empty( $size['file'] ) && preg_match( '/-e[0-9]{13}-/', $size['file'] ) ) { $delete_file = path_join( $dirname, $size['file'] ); wp_delete_file( $delete_file ); } } } if ( isset( $sizes ) ) { $_sizes = array(); foreach ( $sizes as $size ) { $tag = false; if ( isset( $meta['sizes'][ $size ] ) ) { if ( isset( $backup_sizes[ "$size-orig" ] ) ) { if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes[ "$size-orig" ]['file'] != $meta['sizes'][ $size ]['file'] ) { $tag = "$size-$suffix"; } } else { $tag = "$size-orig"; } if ( $tag ) { $backup_sizes[ $tag ] = $meta['sizes'][ $size ]; } } if ( isset( $_wp_additional_image_sizes[ $size ] ) ) { $width = (int) $_wp_additional_image_sizes[ $size ]['width']; $height = (int) $_wp_additional_image_sizes[ $size ]['height']; $crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop']; } else { $height = get_option( "{$size}_size_h" ); $width = get_option( "{$size}_size_w" ); $crop = ( $nocrop ) ? false : get_option( "{$size}_crop" ); } $_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop, ); } $meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) ); } unset( $img ); if ( $success ) { wp_update_attachment_metadata( $post_id, $meta ); update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ); if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) { if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' === $_REQUEST['context'] ) { $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true ); $return->thumbnail = $thumb_url[0]; } else { $file_url = wp_get_attachment_url( $post_id ); if ( ! empty( $meta['sizes']['thumbnail'] ) ) { $thumb = $meta['sizes']['thumbnail']; $return->thumbnail = path_join( dirname( $file_url ), $thumb['file'] ); } else { $return->thumbnail = "$file_url?w=128&h=128"; } } } } else { $delete = true; } if ( $delete ) { wp_delete_file( $new_path ); } $return->msg = esc_js( __( 'Image saved' ) ); return $return; } 'category', 'descendants_and_self' => $descendants_and_self, 'selected_cats' => $selected_cats, 'popular_cats' => $popular_cats, 'walker' => $walker, 'checked_ontop' => $checked_ontop, ) ); } function wp_terms_checklist( $post_id = 0, $args = array() ) { $defaults = array( 'descendants_and_self' => 0, 'selected_cats' => false, 'popular_cats' => false, 'walker' => null, 'taxonomy' => 'category', 'checked_ontop' => true, 'echo' => true, ); $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); $parsed_args = wp_parse_args( $params, $defaults ); if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) { $walker = new Walker_Category_Checklist; } else { $walker = $parsed_args['walker']; } $taxonomy = $parsed_args['taxonomy']; $descendants_and_self = (int) $parsed_args['descendants_and_self']; $args = array( 'taxonomy' => $taxonomy ); $tax = get_taxonomy( $taxonomy ); $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); $args['list_only'] = ! empty( $parsed_args['list_only'] ); if ( is_array( $parsed_args['selected_cats'] ) ) { $args['selected_cats'] = array_map( 'intval', $parsed_args['selected_cats'] ); } elseif ( $post_id ) { $args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) ); } else { $args['selected_cats'] = array(); } if ( is_array( $parsed_args['popular_cats'] ) ) { $args['popular_cats'] = array_map( 'intval', $parsed_args['popular_cats'] ); } else { $args['popular_cats'] = get_terms( array( 'taxonomy' => $taxonomy, 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false, ) ); } if ( $descendants_and_self ) { $categories = (array) get_terms( array( 'taxonomy' => $taxonomy, 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0, ) ); $self = get_term( $descendants_and_self, $taxonomy ); array_unshift( $categories, $self ); } else { $categories = (array) get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', ) ); } $output = ''; if ( $parsed_args['checked_ontop'] ) { $checked_categories = array(); $keys = array_keys( $categories ); foreach ( $keys as $k ) { if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) { $checked_categories[] = $categories[ $k ]; unset( $categories[ $k ] ); } } $output .= $walker->walk( $checked_categories, 0, $args ); } $output .= $walker->walk( $categories, 0, $args ); if ( $parsed_args['echo'] ) { echo $output; } return $output; } function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { $post = get_post(); if ( $post && $post->ID ) { $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); } else { $checked_terms = array(); } $terms = get_terms( array( 'taxonomy' => $taxonomy, 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false, ) ); $tax = get_taxonomy( $taxonomy ); $popular_ids = array(); foreach ( (array) $terms as $term ) { $popular_ids[] = $term->term_id; if ( ! $display ) { continue; } $id = "popular-$taxonomy-$term->term_id"; $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; ?> - - - - 'link_category', 'orderby' => 'name', 'hide_empty' => 0, ) ); if ( empty( $categories ) ) { return; } foreach ( $categories as $category ) { $cat_id = $category->term_id; $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) ); $checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : ''; echo ''; } } function get_inline_data( $post ) { $post_type_object = get_post_type_object( $post->post_type ); if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } $title = esc_textarea( trim( $post->post_title ) ); echo ' -'; } function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) { global $wp_list_table; $content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode, ) ); if ( ! empty( $content ) ) { echo $content; return; } if ( ! $wp_list_table ) { if ( 'single' === $mode ) { $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); } else { $wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); } } ?> -
            - -
            - - - -
            - - - - - - - ' . _x( 'Name', 'meta name' ) . ' - ' . __( 'Value' ) . ' - - - - - -'; return; } $count = 0; ?> - - - - - - - - - - -
            - "; $r .= "\n\t\t"; $r .= "\n\t\t
            "; $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) ); $r .= "\n\t\t"; $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) ); $r .= '
            '; $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); $r .= ''; $r .= "\n\t\t\n\t"; return $r; } function meta_form( $post = null ) { global $wpdb; $post = get_post( $post ); $keys = apply_filters( 'postmeta_form_keys', null, $post ); if ( null === $keys ) { $limit = apply_filters( 'postmeta_form_limit', 30 ); $keys = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT meta_key - FROM $wpdb->postmeta - WHERE meta_key NOT BETWEEN '_' AND '_z' - HAVING meta_key NOT LIKE %s - ORDER BY meta_key - LIMIT %d", $wpdb->esc_like( '_' ) . '%', $limit ) ); } if ( $keys ) { natcasesort( $keys ); $meta_key_input_id = 'metakeyselect'; } else { $meta_key_input_id = 'metakeyinput'; } ?> -

            - - - - - - - - - - - - - - - - -
            - - - - - - - - - -
            -
            - 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta', ) ); ?> -
            - -
            - post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' === $post->post_date_gmt ) ); } $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) { $tab_index_attribute = " tabindex=\"$tab_index\""; } $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date; $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' ); $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' ); $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : current_time( 'Y' ); $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : current_time( 'H' ); $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : current_time( 'i' ); $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : current_time( 's' ); $cur_jj = current_time( 'd' ); $cur_mm = current_time( 'm' ); $cur_aa = current_time( 'Y' ); $cur_hh = current_time( 'H' ); $cur_mn = current_time( 'i' ); $month = ''; $day = ''; $year = ''; $hour = ''; $minute = ''; echo '
            '; printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute ); echo '
            '; if ( $multi ) { return; } echo "\n\n"; $map = array( 'mm' => array( $mm, $cur_mm ), 'jj' => array( $jj, $cur_jj ), 'aa' => array( $aa, $cur_aa ), 'hh' => array( $hh, $cur_hh ), 'mn' => array( $mn, $cur_mn ), ); foreach ( $map as $timeunit => $value ) { list( $unit, $curr ) = $value; echo '' . "\n"; $cur_timeunit = 'cur_' . $timeunit; echo '' . "\n"; } ?> - -

            - - -

            - " . esc_html( $template ) . ''; } } function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { global $wpdb; $post = get_post( $post ); $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); if ( $items ) { foreach ( $items as $item ) { if ( $post && $post->ID && (int) $item->ID === $post->ID ) { continue; } $pad = str_repeat( ' ', $level * 3 ); $selected = selected( $default_page, $item->ID, false ); echo "\n\t'; parent_dropdown( $default_page, $item->ID, $level + 1 ); } } else { return false; } } function wp_dropdown_roles( $selected = '' ) { $r = ''; $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role( $details['name'] ); if ( $selected === $role ) { $r .= "\n\t"; } else { $r .= "\n\t"; } } echo $r; } function wp_import_upload_form( $action ) { $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = size_format( $bytes ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?> -

            -

            - -
            -

            - %s (%s)', __( 'Choose a file from your computer:' ), sprintf( __( 'Maximum size: %s' ), $size ) ); ?> - - - -

            - -
            - id ) ) { return; } $page = $screen->id; if ( ! isset( $wp_meta_boxes ) ) { $wp_meta_boxes = array(); } if ( ! isset( $wp_meta_boxes[ $page ] ) ) { $wp_meta_boxes[ $page ] = array(); } if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { $wp_meta_boxes[ $page ][ $context ] = array(); } foreach ( array_keys( $wp_meta_boxes[ $page ] ) as $a_context ) { foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) { if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) { continue; } if ( ( 'core' === $priority || 'sorted' === $priority ) && false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) { return; } if ( 'core' === $priority ) { if ( 'default' === $a_priority ) { $wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ]; unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] ); } return; } if ( empty( $priority ) ) { $priority = $a_priority; } elseif ( 'sorted' === $priority ) { $title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title']; $callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback']; $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args']; } if ( $priority !== $a_priority || $context !== $a_context ) { unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ); } } } if ( empty( $priority ) ) { $priority = 'low'; } if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { $wp_meta_boxes[ $page ][ $context ][ $priority ] = array(); } $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = array( 'id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args, ); } function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '

            '; if ( $plugin ) { printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "{$plugin['Name']}" ); } else { _e( 'This meta box is not compatible with the block editor.' ); } echo '

            '; if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ); echo '

            '; printf( __( 'Please install the Classic Editor plugin to use this meta box.' ), esc_url( $install_url ) ); echo '

            '; } } elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' ); echo '

            '; printf( __( 'Please activate the Classic Editor plugin to use this meta box.' ), esc_url( $activate_url ) ); echo '

            '; } } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), get_edit_post_link( $data_object ) ); echo '

            '; printf( __( 'Please open the classic editor to use this meta box.' ), esc_url( $edit_url ) ); echo '

            '; } } function _get_plugin_from_callback( $callback ) { try { if ( is_array( $callback ) ) { $reflection = new ReflectionMethod( $callback[0], $callback[1] ); } elseif ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) { $reflection = new ReflectionMethod( $callback ); } else { $reflection = new ReflectionFunction( $callback ); } } catch ( ReflectionException $exception ) { return null; } if ( ! $reflection->isInternal() ) { $filename = wp_normalize_path( $reflection->getFileName() ); $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); if ( strpos( $filename, $plugin_dir ) === 0 ) { $filename = str_replace( $plugin_dir, '', $filename ); $filename = preg_replace( '|^/([^/]*/).*$|', '\\1', $filename ); $plugins = get_plugins(); foreach ( $plugins as $name => $plugin ) { if ( strpos( $name, $filename ) === 0 ) { return $plugin; } } } } return null; } function do_meta_boxes( $screen, $context, $data_object ) { global $wp_meta_boxes; static $already_sorted = false; if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $page = $screen->id; $hidden = get_hidden_meta_boxes( $screen ); printf( '
            ', esc_attr( $context ) ); $sorted = get_user_option( "meta-box-order_$page" ); if ( ! $already_sorted && $sorted ) { foreach ( $sorted as $box_context => $ids ) { foreach ( explode( ',', $ids ) as $id ) { if ( $id && 'dashboard_browser_nag' !== $id ) { add_meta_box( $id, null, null, $screen, $box_context, 'sorted' ); } } } } $already_sorted = true; $i = 0; if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { if ( false === $box || ! $box['title'] ) { continue; } $block_compatible = true; if ( is_array( $box['args'] ) ) { if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { continue; } if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) { $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box']; unset( $box['args']['__block_editor_compatible_meta_box'] ); } if ( ! $block_compatible && $screen->is_block_editor() ) { $box['old_callback'] = $box['callback']; $box['callback'] = 'do_block_editor_incompatible_meta_box'; } if ( isset( $box['args']['__back_compat_meta_box'] ) ) { $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box']; unset( $box['args']['__back_compat_meta_box'] ); } } $i++; $hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : ''; echo '
            ' . "\n"; echo '
            '; echo '

            '; if ( 'dashboard_php_nag' === $box['id'] ) { echo ''; echo '' . __( 'Warning:' ) . ' '; } echo $box['title']; echo "

            \n"; if ( 'dashboard_browser_nag' !== $box['id'] ) { $widget_title = $box['title']; if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { $widget_title = $box['args']['__widget_basename']; unset( $box['args']['__widget_basename'] ); } echo '
            '; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
            '; } echo '
            '; echo '
            ' . "\n"; if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { $plugin = _get_plugin_from_callback( $box['callback'] ); if ( $plugin ) { ?> -
            -

            - {$plugin['Name']}" ); ?> -

            -
            - \n"; echo "
            \n"; } } } } echo '
            '; return $i; } function remove_meta_box( $id, $screen, $context ) { global $wp_meta_boxes; if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } elseif ( is_array( $screen ) ) { foreach ( $screen as $single_screen ) { remove_meta_box( $id, $single_screen, $context ); } } if ( ! isset( $screen->id ) ) { return; } $page = $screen->id; if ( ! isset( $wp_meta_boxes ) ) { $wp_meta_boxes = array(); } if ( ! isset( $wp_meta_boxes[ $page ] ) ) { $wp_meta_boxes[ $page ] = array(); } if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { $wp_meta_boxes[ $page ][ $context ] = array(); } foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false; } } function do_accordion_sections( $screen, $context, $data_object ) { global $wp_meta_boxes; wp_enqueue_script( 'accordion' ); if ( empty( $screen ) ) { $screen = get_current_screen(); } elseif ( is_string( $screen ) ) { $screen = convert_to_screen( $screen ); } $page = $screen->id; $hidden = get_hidden_meta_boxes( $screen ); ?> -
            -
              - -
            • -

              - - -

              -
              -
              - -
              -
              -
            • - -
            -
            - $id, 'title' => $title, 'callback' => $callback, ); } function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) { global $wp_settings_fields; if ( 'misc' === $page ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $page = 'general'; } if ( 'privacy' === $page ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $page = 'reading'; } $wp_settings_fields[ $page ][ $section ][ $id ] = array( 'id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args, ); } function do_settings_sections( $page ) { global $wp_settings_sections, $wp_settings_fields; if ( ! isset( $wp_settings_sections[ $page ] ) ) { return; } foreach ( (array) $wp_settings_sections[ $page ] as $section ) { if ( $section['title'] ) { echo "

            {$section['title']}

            \n"; } if ( $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } echo ''; do_settings_fields( $page, $section['id'] ); echo ''; } } function do_settings_fields( $page, $section ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $class = ''; if ( ! empty( $field['args']['class'] ) ) { $class = ' class="' . esc_attr( $field['args']['class'] ) . '"'; } echo ""; if ( ! empty( $field['args']['label_for'] ) ) { echo ''; } else { echo '' . $field['title'] . ''; } echo ''; call_user_func( $field['callback'], $field['args'] ); echo ''; echo ''; } } function add_settings_error( $setting, $code, $message, $type = 'error' ) { global $wp_settings_errors; $wp_settings_errors[] = array( 'setting' => $setting, 'code' => $code, 'message' => $message, 'type' => $type, ); } function get_settings_errors( $setting = '', $sanitize = false ) { global $wp_settings_errors; if ( $sanitize ) { sanitize_option( $setting, get_option( $setting ) ); } if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) { $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) ); delete_transient( 'settings_errors' ); } if ( empty( $wp_settings_errors ) ) { return array(); } if ( $setting ) { $setting_errors = array(); foreach ( (array) $wp_settings_errors as $key => $details ) { if ( $setting === $details['setting'] ) { $setting_errors[] = $wp_settings_errors[ $key ]; } } return $setting_errors; } return $wp_settings_errors; } function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) { return; } $settings_errors = get_settings_errors( $setting, $sanitize ); if ( empty( $settings_errors ) ) { return; } $output = ''; foreach ( $settings_errors as $key => $details ) { if ( 'updated' === $details['type'] ) { $details['type'] = 'success'; } if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ), true ) ) { $details['type'] = 'notice-' . $details['type']; } $css_id = sprintf( 'setting-error-%s', esc_attr( $details['code'] ) ); $css_class = sprintf( 'notice %s settings-error is-dismissible', esc_attr( $details['type'] ) ); $output .= "
            \n"; $output .= "

            {$details['message']}

            "; $output .= "
            \n"; } echo $output; } function find_posts_div( $found_action = '' ) { ?> - - post_password ) ) { echo esc_attr( $post->post_password ); } } function _draft_or_post_title( $post = 0 ) { $title = get_the_title( $post ); if ( empty( $title ) ) { $title = __( '(no title)' ); } return esc_html( $title ); } function _admin_search_query() { echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; } function iframe_header( $title = '', $deprecated = false ) { show_admin_bar( false ); global $hook_suffix, $admin_body_class, $wp_locale; $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); $current_screen = get_current_screen(); header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); _wp_admin_html_begin(); ?> -<?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?> - - - - - -class="wp-admin wp-core-ui no-js iframe "> - - - - - - - $state$sep"; } } if ( $display ) { echo $post_states_string; } return $post_states_string; } function get_post_states( $post ) { $post_states = array(); if ( isset( $_REQUEST['post_status'] ) ) { $post_status = $_REQUEST['post_status']; } else { $post_status = ''; } if ( ! empty( $post->post_password ) ) { $post_states['protected'] = _x( 'Password protected', 'post status' ); } if ( 'private' === $post->post_status && 'private' !== $post_status ) { $post_states['private'] = _x( 'Private', 'post status' ); } if ( 'draft' === $post->post_status ) { if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { $post_states[] = __( 'Customization Draft' ); } elseif ( 'draft' !== $post_status ) { $post_states['draft'] = _x( 'Draft', 'post status' ); } } elseif ( 'trash' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { $post_states[] = _x( 'Customization Draft', 'post status' ); } if ( 'pending' === $post->post_status && 'pending' !== $post_status ) { $post_states['pending'] = _x( 'Pending', 'post status' ); } if ( is_sticky( $post->ID ) ) { $post_states['sticky'] = _x( 'Sticky', 'post status' ); } if ( 'future' === $post->post_status ) { $post_states['scheduled'] = _x( 'Scheduled', 'post status' ); } if ( 'page' === get_option( 'show_on_front' ) ) { if ( (int) get_option( 'page_on_front' ) === $post->ID ) { $post_states['page_on_front'] = _x( 'Front Page', 'page label' ); } if ( (int) get_option( 'page_for_posts' ) === $post->ID ) { $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' ); } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' ); } return apply_filters( 'display_post_states', $post_states, $post ); } function _media_states( $post, $display = true ) { $media_states = get_media_states( $post ); $media_states_string = ''; if ( ! empty( $media_states ) ) { $state_count = count( $media_states ); $i = 0; $media_states_string .= ' — '; foreach ( $media_states as $state ) { ++$i; $sep = ( $i < $state_count ) ? ', ' : ''; $media_states_string .= "$state$sep"; } } if ( $display ) { echo $media_states_string; } return $media_states_string; } function get_media_states( $post ) { static $header_images; $media_states = array(); $stylesheet = get_option( 'stylesheet' ); if ( current_theme_supports( 'custom-header' ) ) { $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true ); if ( is_random_header_image() ) { if ( ! isset( $header_images ) ) { $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' ); } if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) { $media_states[] = __( 'Header Image' ); } } else { $header_image = get_header_image(); if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) { $media_states[] = __( 'Header Image' ); } if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) { $media_states[] = __( 'Current Header Image' ); } } if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) { $mods = get_theme_mods(); if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) { $media_states[] = __( 'Current Header Video' ); } } } if ( current_theme_supports( 'custom-background' ) ) { $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true ); if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) { $media_states[] = __( 'Background Image' ); $background_image = get_background_image(); if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) { $media_states[] = __( 'Current Background Image' ); } } } if ( (int) get_option( 'site_icon' ) === $post->ID ) { $media_states[] = __( 'Site Icon' ); } if ( (int) get_theme_mod( 'custom_logo' ) === $post->ID ) { $media_states[] = __( 'Logo' ); } return apply_filters( 'display_media_states', $media_states, $post ); } function compression_test() { ?> - - $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; } } elseif ( ! empty( $other_attributes ) ) { $attributes = $other_attributes; } $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $button = ''; if ( $wrap ) { $button = '

            ' . $button . '

            '; } return $button; } function _wp_admin_html_begin() { global $is_IE; $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : ''; if ( $is_IE ) { header( 'X-UA-Compatible: IE=edge' ); } ?> - - -> - - - wp-admin/includes/template.php', 'add_meta_box()', 'add_meta_boxes' ), '3.3.0' ); return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us', ); } return WP_Screen::get( $hook_name ); } function _local_storage_notice() { ?> - - 0, 'type' => 'rating', 'number' => 0, 'echo' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $rating = (float) str_replace( ',', '.', $parsed_args['rating'] ); if ( 'percent' === $parsed_args['type'] ) { $rating = round( $rating / 10, 0 ) / 2; } $full_stars = floor( $rating ); $half_stars = ceil( $rating - $full_stars ); $empty_stars = 5 - $full_stars - $half_stars; if ( $parsed_args['number'] ) { $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] ); $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) ); } else { $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) ); } $output = '
            '; $output .= '' . $title . ''; $output .= str_repeat( '', $full_stars ); $output .= str_repeat( '', $half_stars ); $output .= str_repeat( '', $empty_stars ); $output .= '
            '; if ( $parsed_args['echo'] ) { echo $output; } return $output; } function _wp_posts_page_notice() { printf( '

            %s

            ', __( 'You are currently editing the page that shows your latest posts.' ) ); } function _wp_block_editor_posts_page_notice() { wp_add_inline_script( 'wp-notices', sprintf( 'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { isDismissible: false } )', __( 'You are currently editing the page that shows your latest posts.' ) ), 'after' ); } _timeout)) { $this->PushError('_settimeout','socket set send timeout'); $this->_quit(); return FALSE; } return TRUE; } function _connect($host, $port) { $this->SendMSG("Creating socket"); $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); if (!$sock) { $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction, 'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@fgets($this->_ftp_control_sock, 512); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed'); } else { $this->_message.=$tmp; if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed'); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); if(!$this->_ftp_data_sock) { $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); $this->_data_close(); return FALSE; } else $this->_ftp_data_sock; } else { $this->SendMSG("Only passive connections available!"); return FALSE; } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } while (!feof($this->_ftp_data_sock)) { $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return TRUE; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { $this->PushError("_data_write","Can't write to socket"); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @fclose($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit($force=FALSE) { if($this->_connected or $force) { @fclose($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?> - '', 'nonce' => '', ); $args = wp_parse_args( $args, $defaults ); parent::__construct( $args ); } public function add_strings() { $this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' ); $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while updating %1$s: %2$s' ); $this->upgrader->strings['skin_update_failed'] = __( 'The update of %s failed.' ); $this->upgrader->strings['skin_update_successful'] = __( '%s updated successfully.' ); $this->upgrader->strings['skin_upgrade_end'] = __( 'All updates have been completed.' ); } public function feedback( $feedback, ...$args ) { if ( isset( $this->upgrader->strings[ $feedback ] ) ) { $feedback = $this->upgrader->strings[ $feedback ]; } if ( strpos( $feedback, '%' ) !== false ) { if ( $args ) { $args = array_map( 'strip_tags', $args ); $args = array_map( 'esc_html', $args ); $feedback = vsprintf( $feedback, $args ); } } if ( empty( $feedback ) ) { return; } if ( $this->in_loop ) { echo "$feedback
            \n"; } else { echo "

            $feedback

            \n"; } } public function header() { } public function footer() { } public function error( $errors ) { if ( is_string( $errors ) && isset( $this->upgrader->strings[ $errors ] ) ) { $this->error = $this->upgrader->strings[ $errors ]; } if ( is_wp_error( $errors ) ) { $messages = array(); foreach ( $errors->get_error_messages() as $emessage ) { if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { $messages[] = $emessage . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ); } else { $messages[] = $emessage; } } $this->error = implode( ', ', $messages ); } echo ''; } public function bulk_header() { $this->feedback( 'skin_upgrade_start' ); } public function bulk_footer() { $this->feedback( 'skin_upgrade_end' ); } public function before( $title = '' ) { $this->in_loop = true; printf( '

            ' . $this->upgrader->strings['skin_before_update_header'] . '

            ', $title, $this->upgrader->update_current, $this->upgrader->update_count ); echo ''; echo '

            '; $this->flush_output(); } public function after( $title = '' ) { echo '

            '; if ( $this->error || ! $this->result ) { if ( $this->error ) { echo '

            ' . sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '' . $this->error . '' ) . '

            '; } else { echo '

            ' . sprintf( $this->upgrader->strings['skin_update_failed'], $title ) . '

            '; } echo ''; } if ( $this->result && ! is_wp_error( $this->result ) ) { if ( ! $this->error ) { echo '
            ' . '

            ' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) . ' ' . '

            '; } echo ''; } $this->reset(); $this->flush_output(); } public function reset() { $this->in_loop = false; $this->error = false; } public function flush_output() { wp_ob_end_flush_all(); flush(); } } 'comments', 'singular' => 'comment', 'ajax' => true, 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function floated_admin_avatar( $name, $comment_id ) { $comment = get_comment( $comment_id ); $avatar = get_avatar( $comment, 32, 'mystery' ); return "$avatar $name"; } public function ajax_user_can() { return current_user_can( 'edit_posts' ); } public function prepare_items() { global $mode, $post_id, $comment_status, $comment_type, $search; if ( ! empty( $_REQUEST['mode'] ) ) { $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; set_user_setting( 'posts_list_mode', $mode ); } else { $mode = get_user_setting( 'posts_list_mode', 'list' ); } $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) { $comment_status = 'all'; } $comment_type = ! empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : ''; $post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : ''; $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : ''; $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : ''; $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : ''; $comments_per_page = $this->get_per_page( $comment_status ); $doing_ajax = wp_doing_ajax(); if ( isset( $_REQUEST['number'] ) ) { $number = (int) $_REQUEST['number']; } else { $number = $comments_per_page + min( 8, $comments_per_page ); } $page = $this->get_pagenum(); if ( isset( $_REQUEST['start'] ) ) { $start = $_REQUEST['start']; } else { $start = ( $page - 1 ) * $comments_per_page; } if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) { $start += $_REQUEST['offset']; } $status_map = array( 'mine' => '', 'moderated' => 'hold', 'approved' => 'approve', 'all' => '', ); $args = array( 'status' => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status, 'search' => $search, 'user_id' => $user_id, 'offset' => $start, 'number' => $number, 'post_id' => $post_id, 'type' => $comment_type, 'orderby' => $orderby, 'order' => $order, 'post_type' => $post_type, ); $args = apply_filters( 'comments_list_table_query_args', $args ); $_comments = get_comments( $args ); if ( is_array( $_comments ) ) { update_comment_cache( $_comments ); $this->items = array_slice( $_comments, 0, $comments_per_page ); $this->extra_items = array_slice( $_comments, $comments_per_page ); $_comment_post_ids = array_unique( wp_list_pluck( $_comments, 'comment_post_ID' ) ); $this->pending_count = get_pending_comments_num( $_comment_post_ids ); } $total_comments = get_comments( array_merge( $args, array( 'count' => true, 'offset' => 0, 'number' => 0, ) ) ); $this->set_pagination_args( array( 'total_items' => $total_comments, 'per_page' => $comments_per_page, ) ); } public function get_per_page( $comment_status = 'all' ) { $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); return apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); } public function no_items() { global $comment_status; if ( 'moderated' === $comment_status ) { _e( 'No comments awaiting moderation.' ); } elseif ( 'trash' === $comment_status ) { _e( 'No comments found in Trash.' ); } else { _e( 'No comments found.' ); } } protected function get_views() { global $post_id, $comment_status, $comment_type; $status_links = array(); $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); $stati = array( 'all' => _nx_noop( 'All (%s)', 'All (%s)', 'comments' ), 'mine' => _nx_noop( 'Mine (%s)', 'Mine (%s)', 'comments' ), 'moderated' => _nx_noop( 'Pending (%s)', 'Pending (%s)', 'comments' ), 'approved' => _nx_noop( 'Approved (%s)', 'Approved (%s)', 'comments' ), 'spam' => _nx_noop( 'Spam (%s)', 'Spam (%s)', 'comments' ), 'trash' => _nx_noop( 'Trash (%s)', 'Trash (%s)', 'comments' ), ); if ( ! EMPTY_TRASH_DAYS ) { unset( $stati['trash'] ); } $link = admin_url( 'edit-comments.php' ); if ( ! empty( $comment_type ) && 'all' !== $comment_type ) { $link = add_query_arg( 'comment_type', $comment_type, $link ); } foreach ( $stati as $status => $label ) { $current_link_attributes = ''; if ( $status === $comment_status ) { $current_link_attributes = ' class="current" aria-current="page"'; } if ( 'mine' === $status ) { $current_user_id = get_current_user_id(); $num_comments->mine = get_comments( array( 'post_id' => $post_id ? $post_id : 0, 'user_id' => $current_user_id, 'count' => true, ) ); $link = add_query_arg( 'user_id', $current_user_id, $link ); } else { $link = remove_query_arg( 'user_id', $link ); } if ( ! isset( $num_comments->$status ) ) { $num_comments->$status = 10; } $link = add_query_arg( 'comment_status', $status, $link ); if ( $post_id ) { $link = add_query_arg( 'p', absint( $post_id ), $link ); } $status_links[ $status ] = "" . sprintf( translate_nooped_plural( $label, $num_comments->$status ), sprintf( '%s', ( 'moderated' === $status ) ? 'pending' : $status, number_format_i18n( $num_comments->$status ) ) ) . ''; } return apply_filters( 'comment_status_links', $status_links ); } protected function get_bulk_actions() { global $comment_status; $actions = array(); if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) { $actions['unapprove'] = __( 'Unapprove' ); } if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) { $actions['approve'] = __( 'Approve' ); } if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) { $actions['spam'] = _x( 'Mark as spam', 'comment' ); } if ( 'trash' === $comment_status ) { $actions['untrash'] = __( 'Restore' ); } elseif ( 'spam' === $comment_status ) { $actions['unspam'] = _x( 'Not spam', 'comment' ); } if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } return $actions; } protected function extra_tablenav( $which ) { global $comment_status, $comment_type; static $has_items; if ( ! isset( $has_items ) ) { $has_items = $this->has_items(); } echo '
            '; if ( 'top' === $which ) { ob_start(); $this->comment_type_dropdown( $comment_type ); do_action( 'restrict_manage_comments' ); $output = ob_get_clean(); if ( ! empty( $output ) && $this->has_items() ) { echo $output; submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } } if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items && current_user_can( 'moderate_comments' ) ) { wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); submit_button( $title, 'apply', 'delete_all', false ); } do_action( 'manage_comments_nav', $comment_status, $which ); echo '
            '; } public function current_action() { if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { return 'delete_all'; } return parent::current_action(); } public function get_columns() { global $post_id; $columns = array(); if ( $this->checkbox ) { $columns['cb'] = ''; } $columns['author'] = __( 'Author' ); $columns['comment'] = _x( 'Comment', 'column name' ); if ( ! $post_id ) { $columns['response'] = __( 'In response to' ); } $columns['date'] = _x( 'Submitted on', 'column name' ); return $columns; } protected function comment_type_dropdown( $comment_type ) { $comment_types = apply_filters( 'admin_comment_types_dropdown', array( 'comment' => __( 'Comments' ), 'pings' => __( 'Pings' ), ) ); if ( $comment_types && is_array( $comment_types ) ) { printf( '', __( 'Filter by comment type' ) ); echo ''; } } protected function get_sortable_columns() { return array( 'author' => 'comment_author', 'response' => 'comment_post_ID', 'date' => 'comment_date', ); } protected function get_default_primary_column_name() { return 'comment'; } public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); static $has_items; if ( ! isset( $has_items ) ) { $has_items = $this->has_items(); if ( $has_items ) { $this->display_tablenav( 'top' ); } } $this->screen->render_screen_reader_content( 'heading_list' ); ?> - - - - print_column_headers(); ?> - - - - - display_rows_or_placeholder(); ?> - - - - items; $this->items = $this->extra_items; $this->display_rows_or_placeholder(); $this->items = $items; ?> - - - - - print_column_headers( false ); ?> - - - -
            - display_tablenav( 'bottom' ); } public function single_row( $item ) { global $post, $comment; $comment = $item; $the_comment_class = wp_get_comment_status( $comment ); if ( ! $the_comment_class ) { $the_comment_class = ''; } $the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) ); if ( $comment->comment_post_ID > 0 ) { $post = get_post( $comment->comment_post_ID ); } $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); echo ""; $this->single_row_columns( $comment ); echo "\n"; unset( $GLOBALS['post'], $GLOBALS['comment'] ); } protected function handle_row_actions( $item, $column_name, $primary ) { global $comment_status; if ( $primary !== $column_name ) { return ''; } if ( ! $this->user_can ) { return ''; } $comment = $item; $the_comment_status = wp_get_comment_status( $comment ); $out = ''; $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); $url = "comment.php?c=$comment->comment_ID"; $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'quickedit' => '', 'edit' => '', 'spam' => '', 'unspam' => '', 'trash' => '', 'untrash' => '', 'delete' => '', ); if ( $comment_status && 'all' !== $comment_status ) { if ( 'approved' === $the_comment_status ) { $actions['unapprove'] = sprintf( '%s', $unapprove_url, "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); } elseif ( 'unapproved' === $the_comment_status ) { $actions['approve'] = sprintf( '%s', $approve_url, "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); } } else { $actions['approve'] = sprintf( '%s', $approve_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '%s', $unapprove_url, "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); } if ( 'spam' !== $the_comment_status ) { $actions['spam'] = sprintf( '%s', $spam_url, "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), _x( 'Spam', 'verb' ) ); } elseif ( 'spam' === $the_comment_status ) { $actions['unspam'] = sprintf( '%s', $unspam_url, "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1", esc_attr__( 'Restore this comment from the spam' ), _x( 'Not Spam', 'comment' ) ); } if ( 'trash' === $the_comment_status ) { $actions['untrash'] = sprintf( '%s', $untrash_url, "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1", esc_attr__( 'Restore this comment from the Trash' ), __( 'Restore' ) ); } if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '%s', $delete_url, "delete:the-comment-list:comment-{$comment->comment_ID}::delete=1", esc_attr__( 'Delete this comment permanently' ), __( 'Delete Permanently' ) ); } else { $actions['trash'] = sprintf( '%s', $trash_url, "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", esc_attr__( 'Move this comment to the Trash' ), _x( 'Trash', 'verb' ) ); } if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) { $actions['edit'] = sprintf( '%s', "comment.php?action=editcomment&c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $format = ''; $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick edit this comment inline' ), __( 'Quick Edit' ) ); $actions['reply'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); } $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); $always_visible = false; $mode = get_user_setting( 'posts_list_mode', 'list' ); if ( 'excerpt' === $mode ) { $always_visible = true; } $out .= '
            '; $i = 0; foreach ( $actions as $action => $link ) { ++$i; if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) { $sep = ''; } else { $sep = ' | '; } if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { $action .= ' hide-if-no-js'; } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) || ( 'unspam' === $action && 'spam' === $the_comment_status ) ) { if ( '1' === get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { $action .= ' approve'; } else { $action .= ' unapprove'; } } $out .= "$sep$link"; } $out .= '
            '; $out .= ''; return $out; } public function column_cb( $item ) { $comment = $item; if ( $this->user_can ) { ?> - - - '; $this->column_author( $comment ); echo '
            '; if ( $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); if ( $parent ) { $parent_link = esc_url( get_comment_link( $parent ) ); $name = get_comment_author( $parent ); printf( __( 'In reply to %s.' ), '' . $name . '' ); } } comment_text( $comment ); if ( $this->user_can ) { $comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content ); ?> - - 50 ) { $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); } echo ''; comment_author( $comment ); echo '
            '; if ( ! empty( $author_url_display ) ) { printf( '%s
            ', esc_url( $author_url ), esc_html( $author_url_display ) ); } if ( $this->user_can ) { if ( ! empty( $comment->comment_author_email ) ) { $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ! empty( $email ) && '@' !== $email ) { printf( '%2$s
            ', esc_url( 'mailto:' . $email ), esc_html( $email ) ); } } $author_ip = get_comment_author_IP( $comment ); if ( $author_ip ) { $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail', ), admin_url( 'edit-comments.php' ) ); if ( 'spam' === $comment_status ) { $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); } printf( '%2$s', esc_url( $author_ip_url ), esc_html( $author_ip ) ); } } } public function column_date( $comment ) { $submitted = sprintf( __( '%1$s at %2$s' ), get_comment_date( __( 'Y/m/d' ), $comment ), get_comment_date( __( 'g:i a' ), $comment ) ); echo ''; } public function column_response( $comment ) { $post = get_post(); if ( ! $post ) { return; } if ( isset( $this->pending_count[ $post->ID ] ) ) { $pending_comments = $this->pending_count[ $post->ID ]; } else { $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); $pending_comments = $_pending_count_temp[ $post->ID ]; $this->pending_count[ $post->ID ] = $pending_comments; } if ( current_user_can( 'edit_post', $post->ID ) ) { $post_link = ""; $post_link .= esc_html( get_the_title( $post->ID ) ) . ''; } else { $post_link = esc_html( get_the_title( $post->ID ) ); } echo ''; } public function column_default( $item, $column_name ) { do_action( 'manage_comments_custom_column', $column_name, $item->comment_ID ); } } 'themes', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken', 'auto-update-enabled', 'auto-update-disabled' ), true ) ) { $status = 'all'; } $page = $this->get_pagenum(); $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false; if ( $this->is_site_themes ) { $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0; } $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) && ! $this->is_site_themes && current_user_can( 'update_themes' ); } protected function get_table_classes() { return array( 'widefat', 'plugins' ); } public function ajax_user_can() { if ( $this->is_site_themes ) { return current_user_can( 'manage_sites' ); } else { return current_user_can( 'manage_network_themes' ); } } public function prepare_items() { global $status, $totals, $page, $orderby, $order, $s; wp_reset_vars( array( 'orderby', 'order', 's' ) ); $themes = array( 'all' => apply_filters( 'all_themes', wp_get_themes() ), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ), ); if ( $this->show_autoupdates ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); $themes['auto-update-enabled'] = array(); $themes['auto-update-disabled'] = array(); } if ( $this->is_site_themes ) { $themes_per_page = $this->get_items_per_page( 'site_themes_network_per_page' ); $allowed_where = 'site'; } else { $themes_per_page = $this->get_items_per_page( 'themes_network_per_page' ); $allowed_where = 'network'; } $current = get_site_transient( 'update_themes' ); $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current; foreach ( (array) $themes['all'] as $key => $theme ) { if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) { unset( $themes['all'][ $key ] ); continue; } if ( $maybe_update && isset( $current->response[ $key ] ) ) { $themes['all'][ $key ]->update = true; $themes['upgrade'][ $key ] = $themes['all'][ $key ]; } $filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled'; $themes[ $filter ][ $key ] = $themes['all'][ $key ]; $theme_data = array( 'update_supported' => isset( $theme->update_supported ) ? $theme->update_supported : true, ); if ( isset( $current->response[ $key ] ) ) { $theme_data = array_merge( (array) $current->response[ $key ], $theme_data ); } elseif ( isset( $current->no_update[ $key ] ) ) { $theme_data = array_merge( (array) $current->no_update[ $key ], $theme_data ); } else { $theme_data['update_supported'] = false; } $theme->update_supported = $theme_data['update_supported']; $filter_payload = array( 'theme' => $key, 'new_version' => '', 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); $filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $theme_data, $filter_payload ) ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $filter_payload ); if ( ! is_null( $auto_update_forced ) ) { $theme->auto_update_forced = $auto_update_forced; } if ( $this->show_autoupdates ) { $enabled = in_array( $key, $auto_updates, true ) && $theme->update_supported; if ( isset( $theme->auto_update_forced ) ) { $enabled = (bool) $theme->auto_update_forced; } if ( $enabled ) { $themes['auto-update-enabled'][ $key ] = $theme; } else { $themes['auto-update-disabled'][ $key ] = $theme; } } } if ( $s ) { $status = 'search'; $themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) ); } $totals = array(); $js_themes = array(); foreach ( $themes as $type => $list ) { $totals[ $type ] = count( $list ); $js_themes[ $type ] = array_keys( $list ); } if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } $this->items = $themes[ $status ]; WP_Theme::sort_by_name( $this->items ); $this->has_items = ! empty( $themes['all'] ); $total_this_page = $totals[ $status ]; wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'themes' => $js_themes, 'totals' => wp_get_update_data(), ) ); if ( $orderby ) { $orderby = ucfirst( $orderby ); $order = strtoupper( $order ); if ( 'Name' === $orderby ) { if ( 'ASC' === $order ) { $this->items = array_reverse( $this->items ); } } else { uasort( $this->items, array( $this, '_order_callback' ) ); } } $start = ( $page - 1 ) * $themes_per_page; if ( $total_this_page > $themes_per_page ) { $this->items = array_slice( $this->items, $start, $themes_per_page, true ); } $this->set_pagination_args( array( 'total_items' => $total_this_page, 'per_page' => $themes_per_page, ) ); } public function _search_callback( $theme ) { static $term = null; if ( is_null( $term ) ) { $term = wp_unslash( $_REQUEST['s'] ); } foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) { if ( false !== stripos( $theme->display( $field, false, true ), $term ) ) { return true; } } if ( false !== stripos( $theme->get_stylesheet(), $term ) ) { return true; } if ( false !== stripos( $theme->get_template(), $term ) ) { return true; } return false; } public function _order_callback( $theme_a, $theme_b ) { global $orderby, $order; $a = $theme_a[ $orderby ]; $b = $theme_b[ $orderby ]; if ( $a === $b ) { return 0; } if ( 'DESC' === $order ) { return ( $a < $b ) ? 1 : -1; } else { return ( $a < $b ) ? -1 : 1; } } public function no_items() { if ( $this->has_items ) { _e( 'No themes found.' ); } else { _e( 'No themes are currently available.' ); } } public function get_columns() { $columns = array( 'cb' => '', 'name' => __( 'Theme' ), 'description' => __( 'Description' ), ); if ( $this->show_autoupdates ) { $columns['auto-updates'] = __( 'Automatic Updates' ); } return $columns; } protected function get_sortable_columns() { return array( 'name' => 'name', ); } protected function get_primary_column_name() { return 'name'; } protected function get_views() { global $totals, $status; $status_links = array(); foreach ( $totals as $type => $count ) { if ( ! $count ) { continue; } switch ( $type ) { case 'all': $text = _nx( 'All (%s)', 'All (%s)', $count, 'themes' ); break; case 'enabled': $text = _nx( 'Enabled (%s)', 'Enabled (%s)', $count, 'themes' ); break; case 'disabled': $text = _nx( 'Disabled (%s)', 'Disabled (%s)', $count, 'themes' ); break; case 'upgrade': $text = _nx( 'Update Available (%s)', 'Update Available (%s)', $count, 'themes' ); break; case 'broken': $text = _nx( 'Broken (%s)', 'Broken (%s)', $count, 'themes' ); break; case 'auto-update-enabled': $text = _n( 'Auto-updates Enabled (%s)', 'Auto-updates Enabled (%s)', $count ); break; case 'auto-update-disabled': $text = _n( 'Auto-updates Disabled (%s)', 'Auto-updates Disabled (%s)', $count ); break; } if ( $this->is_site_themes ) { $url = 'site-themes.php?id=' . $this->site_id; } else { $url = 'themes.php'; } if ( 'search' !== $type ) { $status_links[ $type ] = sprintf( "%s", esc_url( add_query_arg( 'theme_status', $type, $url ) ), ( $type === $status ) ? ' class="current" aria-current="page"' : '', sprintf( $text, number_format_i18n( $count ) ) ); } } return $status_links; } protected function get_bulk_actions() { global $status; $actions = array(); if ( 'enabled' !== $status ) { $actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ); } if ( 'disabled' !== $status ) { $actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ); } if ( ! $this->is_site_themes ) { if ( current_user_can( 'update_themes' ) ) { $actions['update-selected'] = __( 'Update' ); } if ( current_user_can( 'delete_themes' ) ) { $actions['delete-selected'] = __( 'Delete' ); } } if ( $this->show_autoupdates ) { if ( 'auto-update-enabled' !== $status ) { $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' ); } if ( 'auto-update-disabled' !== $status ) { $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' ); } } return $actions; } public function display_rows() { foreach ( $this->items as $theme ) { $this->single_row( $theme ); } } public function column_cb( $item ) { $theme = $item; $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); ?> - - - is_site_themes ) { $url = "site-themes.php?id={$this->site_id}&"; $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $url = 'themes.php?'; $allowed = $theme->is_allowed( 'network' ); } $actions = array( 'enable' => '', 'disable' => '', 'delete' => '', ); $stylesheet = $theme->get_stylesheet(); $theme_key = urlencode( $stylesheet ); if ( ! $allowed ) { if ( ! $theme->errors() ) { $url = add_query_arg( array( 'action' => 'enable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { $aria_label = sprintf( __( 'Enable %s' ), $theme->display( 'Name' ) ); } else { $aria_label = sprintf( __( 'Network Enable %s' ), $theme->display( 'Name' ) ); } $actions['enable'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'enable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) ); } } else { $url = add_query_arg( array( 'action' => 'disable', 'theme' => $theme_key, 'paged' => $page, 's' => $s, ), $url ); if ( $this->is_site_themes ) { $aria_label = sprintf( __( 'Disable %s' ), $theme->display( 'Name' ) ); } else { $aria_label = sprintf( __( 'Network Disable %s' ), $theme->display( 'Name' ) ); } $actions['disable'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'disable-theme_' . $stylesheet ) ), esc_attr( $aria_label ), ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) ); } if ( ! $allowed && ! $this->is_site_themes && current_user_can( 'delete_themes' ) && get_option( 'stylesheet' ) !== $stylesheet && get_option( 'template' ) !== $stylesheet ) { $url = add_query_arg( array( 'action' => 'delete-selected', 'checked[]' => $theme_key, 'theme_status' => $context, 'paged' => $page, 's' => $s, ), 'themes.php' ); $aria_label = sprintf( _x( 'Delete %s', 'theme' ), $theme->display( 'Name' ) ); $actions['delete'] = sprintf( '%s', esc_url( wp_nonce_url( $url, 'bulk-themes' ) ), esc_attr( $aria_label ), __( 'Delete' ) ); } $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme, $context ); $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, $context ); echo $this->row_actions( $actions, true ); } public function column_description( $theme ) { global $status, $totals; if ( $theme->errors() ) { $pre = 'broken' === $status ? __( 'Broken Theme:' ) . ' ' : ''; echo '

            ' . $pre . $theme->errors()->get_error_message() . '

            '; } if ( $this->is_site_themes ) { $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $allowed = $theme->is_allowed( 'network' ); } $class = ! $allowed ? 'inactive' : 'active'; if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) { $class .= ' update'; } echo "

            " . $theme->display( 'Description' ) . "

            -
            "; $stylesheet = $theme->get_stylesheet(); $theme_meta = array(); if ( $theme->get( 'Version' ) ) { $theme_meta[] = sprintf( __( 'Version %s' ), $theme->display( 'Version' ) ); } $theme_meta[] = sprintf( __( 'By %s' ), $theme->display( 'Author' ) ); if ( $theme->get( 'ThemeURI' ) ) { $aria_label = sprintf( __( 'Visit theme site for %s' ), $theme->display( 'Name' ) ); $theme_meta[] = sprintf( '%s', $theme->display( 'ThemeURI' ), esc_attr( $aria_label ), __( 'Visit Theme Site' ) ); } if ( $theme->parent() ) { $theme_meta[] = sprintf( __( 'Child theme of %s' ), '' . $theme->parent()->display( 'Name' ) . '' ); } $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); echo implode( ' | ', $theme_meta ); echo '
            '; } public function column_autoupdates( $theme ) { global $status, $page; static $auto_updates, $available_updates; if ( ! $auto_updates ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } if ( ! $available_updates ) { $available_updates = get_site_transient( 'update_themes' ); } $stylesheet = $theme->get_stylesheet(); if ( isset( $theme->auto_update_forced ) ) { if ( $theme->auto_update_forced ) { $text = __( 'Auto-updates enabled' ); } else { $text = __( 'Auto-updates disabled' ); } $action = 'unavailable'; $time_class = ' hidden'; } elseif ( empty( $theme->update_supported ) ) { $text = ''; $action = 'unavailable'; $time_class = ' hidden'; } elseif ( in_array( $stylesheet, $auto_updates, true ) ) { $text = __( 'Disable auto-updates' ); $action = 'disable'; $time_class = ''; } else { $text = __( 'Enable auto-updates' ); $action = 'enable'; $time_class = ' hidden'; } $query_args = array( 'action' => "{$action}-auto-update", 'theme' => $stylesheet, 'paged' => $page, 'theme_status' => $status, ); $url = add_query_arg( $query_args, 'themes.php' ); if ( 'unavailable' === $action ) { $html[] = '' . $text . ''; } else { $html[] = sprintf( '', wp_nonce_url( $url, 'updates' ), $action ); $html[] = ''; $html[] = '' . $text . ''; $html[] = ''; } if ( isset( $available_updates->response[ $stylesheet ] ) ) { $html[] = sprintf( '
            %s
            ', $time_class, wp_get_auto_update_message() ); } $html = implode( '', $html ); echo apply_filters( 'theme_auto_update_setting_html', $html, $stylesheet, $theme ); echo ''; } public function column_default( $item, $column_name ) { do_action( 'manage_themes_custom_column', $column_name, $item->get_stylesheet(), $item ); } public function single_row_columns( $item ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; if ( in_array( $column_name, $hidden, true ) ) { $extra_classes .= ' hidden'; } switch ( $column_name ) { case 'cb': echo ''; $this->column_cb( $item ); echo ''; break; case 'name': $active_theme_label = ''; if ( ! empty( $this->site_id ) ) { $stylesheet = get_blog_option( $this->site_id, 'stylesheet' ); $template = get_blog_option( $this->site_id, 'template' ); if ( $item->get_template() === $template ) { $active_theme_label = ' — ' . __( 'Active Theme' ); } if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet ) { $active_theme_label = ' — ' . __( 'Active Child Theme' ); } } echo "" . $item->display( 'Name' ) . $active_theme_label . ''; $this->column_name( $item ); echo ''; break; case 'description': echo ""; $this->column_description( $item ); echo ''; break; case 'auto-updates': echo ""; $this->column_autoupdates( $item ); echo ''; break; default: echo ""; $this->column_default( $item, $column_name ); echo ''; break; } } } public function single_row( $theme ) { global $status, $totals; if ( $this->is_site_themes ) { $allowed = $theme->is_allowed( 'site', $this->site_id ); } else { $allowed = $theme->is_allowed( 'network' ); } $stylesheet = $theme->get_stylesheet(); $class = ! $allowed ? 'inactive' : 'active'; if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) { $class .= ' update'; } printf( '', esc_attr( $class ), esc_attr( $stylesheet ) ); $this->single_row_columns( $theme ); echo ''; if ( $this->is_site_themes ) { remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' ); } do_action( 'after_theme_row', $stylesheet, $theme, $status ); do_action( "after_theme_row_{$stylesheet}", $stylesheet, $theme, $status ); } } __( 'From Computer' ), 'type_url' => __( 'From URL' ), 'gallery' => __( 'Gallery' ), 'library' => __( 'Media Library' ), ); return apply_filters( 'media_upload_tabs', $_default_tabs ); } function update_gallery_tab( $tabs ) { global $wpdb; if ( ! isset( $_REQUEST['post_id'] ) ) { unset( $tabs['gallery'] ); return $tabs; } $post_id = (int) $_REQUEST['post_id']; if ( $post_id ) { $attachments = (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ); } if ( empty( $attachments ) ) { unset( $tabs['gallery'] ); return $tabs; } $tabs['gallery'] = sprintf( __( 'Gallery (%s)' ), "$attachments" ); return $tabs; } function the_media_upload_tabs() { global $redir_tab; $tabs = media_upload_tabs(); $default = 'type'; if ( ! empty( $tabs ) ) { echo "
              \n"; if ( isset( $redir_tab ) && array_key_exists( $redir_tab, $tabs ) ) { $current = $redir_tab; } elseif ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) { $current = $_GET['tab']; } else { $current = apply_filters( 'media_upload_default_tab', $default ); } foreach ( $tabs as $callback => $text ) { $class = ''; if ( $current == $callback ) { $class = " class='current'"; } $href = add_query_arg( array( 'tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false, ) ); $link = "$text"; echo "\t
            • $link
            • \n"; } echo "
            \n"; } } function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' ) { $html = get_image_tag( $id, $alt, '', $align, $size ); if ( $rel ) { if ( is_string( $rel ) ) { $rel = ' rel="' . esc_attr( $rel ) . '"'; } else { $rel = ' rel="attachment wp-att-' . (int) $id . '"'; } } else { $rel = ''; } if ( $url ) { $html = '' . $html . ''; } $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt, $rel ); return $html; } function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { $caption = apply_filters( 'image_add_caption_text', $caption, $id ); if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) { return $html; } $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) { return $html; } $width = $matches[1]; $caption = str_replace( array( "\r\n", "\r" ), "\n", $caption ); $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '
            ', $caption ); $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html ); if ( empty( $align ) ) { $align = 'none'; } $shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]'; return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); } function _cleanup_image_add_caption( $matches ) { return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] ); } function media_send_to_editor( $html ) { ?> - - false ) ) { $time = current_time( 'mysql' ); $post = get_post( $post_id ); if ( $post ) { if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) { $time = $post->post_date; } } $file = wp_handle_upload( $_FILES[ $file_id ], $overrides, $time ); if ( isset( $file['error'] ) ) { return new WP_Error( 'upload_error', $file['error'] ); } $name = $_FILES[ $file_id ]['name']; $ext = pathinfo( $name, PATHINFO_EXTENSION ); $name = wp_basename( $name, ".$ext" ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = sanitize_text_field( $name ); $content = ''; $excerpt = ''; if ( preg_match( '#^audio#', $type ) ) { $meta = wp_read_audio_metadata( $file ); if ( ! empty( $meta['title'] ) ) { $title = $meta['title']; } if ( ! empty( $title ) ) { if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] ); } elseif ( ! empty( $meta['album'] ) ) { $content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] ); } elseif ( ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] ); } else { $content .= sprintf( __( '"%s".' ), $title ); } } elseif ( ! empty( $meta['album'] ) ) { if ( ! empty( $meta['artist'] ) ) { $content .= sprintf( __( '%1$s by %2$s.' ), $meta['album'], $meta['artist'] ); } else { $content .= $meta['album'] . '.'; } } elseif ( ! empty( $meta['artist'] ) ) { $content .= $meta['artist'] . '.'; } if ( ! empty( $meta['year'] ) ) { $content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] ); } if ( ! empty( $meta['track_number'] ) ) { $track_number = explode( '/', $meta['track_number'] ); if ( is_numeric( $track_number[0] ) ) { if ( isset( $track_number[1] ) && is_numeric( $track_number[1] ) ) { $content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) ); } else { $content .= ' ' . sprintf( __( 'Track %s.' ), number_format_i18n( $track_number[0] ) ); } } } if ( ! empty( $meta['genre'] ) ) { $content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] ); } } elseif ( 0 === strpos( $type, 'image/' ) ) { $image_meta = wp_read_image_metadata( $file ); if ( $image_meta ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { $title = $image_meta['title']; } if ( trim( $image_meta['caption'] ) ) { $excerpt = $image_meta['caption']; } } } $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, 'post_excerpt' => $excerpt, ), $post_data ); unset( $attachment['ID'] ); $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $attachment_id ) ) { if ( ! headers_sent() ) { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } return $attachment_id; } function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { $overrides = array( 'test_form' => false ); if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) { $time = $post_data['post_date']; } else { $post = get_post( $post_id ); if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) { $time = $post->post_date; } else { $time = current_time( 'mysql' ); } } $file = wp_handle_sideload( $file_array, $overrides, $time ); if ( isset( $file['error'] ) ) { return new WP_Error( 'upload_error', $file['error'] ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) ); $content = ''; $image_meta = wp_read_image_metadata( $file ); if ( $image_meta ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { $title = $image_meta['title']; } if ( trim( $image_meta['caption'] ) ) { $content = $image_meta['caption']; } } if ( isset( $desc ) ) { $title = $desc; } $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, ), $post_data ); unset( $attachment['ID'] ); $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $attachment_id ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } return $attachment_id; } function wp_iframe( $content_func, ...$args ) { _wp_admin_html_begin(); ?> - <?php bloginfo( 'name' ); ?> › <?php _e( 'Uploads' ); ?> — <?php _e( 'WordPress' ); ?> - - - - - class="wp-core-ui no-js"> - - - - - - $post ) ); $img = ' '; $id_attribute = 1 === $instance ? ' id="insert-media-button"' : ''; printf( '', $id_attribute, esc_attr( $editor_id ), $img . __( 'Add Media' ) ); $legacy_filter = apply_filters_deprecated( 'media_buttons_context', array( '' ), '3.5.0', 'media_buttons' ); if ( $legacy_filter ) { if ( 0 === stripos( trim( $legacy_filter ), '' ) ) { $legacy_filter .= ''; } echo $legacy_filter; } } function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) { global $post_ID; if ( empty( $post_id ) ) { $post_id = $post_ID; } $upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) ); if ( $type && 'media' !== $type ) { $upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src ); } if ( ! empty( $tab ) ) { $upload_iframe_src = add_query_arg( 'tab', $tab, $upload_iframe_src ); } $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src ); return add_query_arg( 'TB_iframe', true, $upload_iframe_src ); } function media_upload_form_handler() { check_admin_referer( 'media-form' ); $errors = null; if ( isset( $_POST['send'] ) ) { $keys = array_keys( $_POST['send'] ); $send_id = (int) reset( $keys ); } if ( ! empty( $_POST['attachments'] ) ) { foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { $post = get_post( $attachment_id, ARRAY_A ); $_post = $post; if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } if ( isset( $attachment['post_content'] ) ) { $post['post_content'] = $attachment['post_content']; } if ( isset( $attachment['post_title'] ) ) { $post['post_title'] = $attachment['post_title']; } if ( isset( $attachment['post_excerpt'] ) ) { $post['post_excerpt'] = $attachment['post_excerpt']; } if ( isset( $attachment['menu_order'] ) ) { $post['menu_order'] = $attachment['menu_order']; } if ( isset( $send_id ) && $attachment_id == $send_id ) { if ( isset( $attachment['post_parent'] ) ) { $post['post_parent'] = $attachment['post_parent']; } } $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); if ( isset( $attachment['image_alt'] ) ) { $image_alt = wp_unslash( $attachment['image_alt'] ); if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { $image_alt = wp_strip_all_tags( $image_alt, true ); update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); } } if ( isset( $post['errors'] ) ) { $errors[ $attachment_id ] = $post['errors']; unset( $post['errors'] ); } if ( $post != $_post ) { wp_update_post( $post ); } foreach ( get_attachment_taxonomies( $post ) as $t ) { if ( isset( $attachment[ $t ] ) ) { wp_set_object_terms( $attachment_id, array_map( 'trim', preg_split( '/,+/', $attachment[ $t ] ) ), $t, false ); } } } } if ( isset( $_POST['insert-gallery'] ) || isset( $_POST['update-gallery'] ) ) { ?> - - $html"; } $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment ); return media_send_to_editor( $html ); } return $errors; } function wp_media_upload_handler() { $errors = array(); $id = 0; if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) { check_admin_referer( 'media-form' ); $id = media_handle_upload( 'async-upload', $_REQUEST['post_id'] ); unset( $_FILES ); if ( is_wp_error( $id ) ) { $errors['upload_error'] = $id; $id = false; } } if ( ! empty( $_POST['insertonlybutton'] ) ) { $src = $_POST['src']; if ( ! empty( $src ) && ! strpos( $src, '://' ) ) { $src = "http://$src"; } if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) { $title = esc_html( wp_unslash( $_POST['title'] ) ); if ( empty( $title ) ) { $title = esc_html( wp_basename( $src ) ); } if ( $title && $src ) { $html = "$title"; } $type = 'file'; $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); if ( $ext ) { $ext_type = wp_ext2type( $ext ); if ( 'audio' === $ext_type || 'video' === $ext_type ) { $type = $ext_type; } } $html = apply_filters( "{$type}_send_to_editor_url", $html, esc_url_raw( $src ), $title ); } else { $align = ''; $alt = esc_attr( wp_unslash( $_POST['alt'] ) ); if ( isset( $_POST['align'] ) ) { $align = esc_attr( wp_unslash( $_POST['align'] ) ); $class = " class='align$align'"; } if ( ! empty( $src ) ) { $html = "$alt"; } $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align ); } return media_send_to_editor( $html ); } if ( isset( $_POST['save'] ) ) { $errors['upload_notice'] = __( 'Saved.' ); wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } elseif ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { $type = 'image'; if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ), true ) ) { $type = $_GET['type']; } return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id ); } return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } function media_sideload_image( $file, $post_id = 0, $desc = null, $return_type = 'html' ) { if ( ! empty( $file ) ) { $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' ); $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file ); $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches ); if ( ! $matches ) { return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) ); } $file_array = array(); $file_array['name'] = wp_basename( $matches[0] ); $file_array['tmp_name'] = download_url( $file ); if ( is_wp_error( $file_array['tmp_name'] ) ) { return $file_array['tmp_name']; } $id = media_handle_sideload( $file_array, $post_id, $desc ); if ( is_wp_error( $id ) ) { @unlink( $file_array['tmp_name'] ); return $id; } add_post_meta( $id, '_source_url', $file ); if ( 'id' === $return_type ) { return $id; } $src = wp_get_attachment_url( $id ); } if ( ! empty( $src ) ) { if ( 'src' === $return_type ) { return $src; } $alt = isset( $desc ) ? esc_attr( $desc ) : ''; $html = "$alt"; return $html; } else { return new WP_Error( 'image_sideload_failed' ); } } function media_upload_gallery() { $errors = array(); if ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } wp_enqueue_script( 'admin-gallery' ); return wp_iframe( 'media_upload_gallery_form', $errors ); } function media_upload_library() { $errors = array(); if ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string( $return ) ) { return $return; } if ( is_array( $return ) ) { $errors = $return; } } return wp_iframe( 'media_upload_library_form', $errors ); } function image_align_input_fields( $post, $checked = '' ) { if ( empty( $checked ) ) { $checked = get_user_setting( 'align', 'none' ); } $alignments = array( 'none' => __( 'None' ), 'left' => __( 'Left' ), 'center' => __( 'Center' ), 'right' => __( 'Right' ), ); if ( ! array_key_exists( (string) $checked, $alignments ) ) { $checked = 'none'; } $out = array(); foreach ( $alignments as $name => $label ) { $name = esc_attr( $name ); $out[] = ""; } return implode( "\n", $out ); } function image_size_input_fields( $post, $check = '' ) { $size_names = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); if ( empty( $check ) ) { $check = get_user_setting( 'imgsize', 'medium' ); } $out = array(); foreach ( $size_names as $size => $label ) { $downsize = image_downsize( $post->ID, $size ); $checked = ''; $enabled = ( $downsize[3] || 'full' === $size ); $css_id = "image-size-{$size}-{$post->ID}"; if ( $size == $check ) { if ( $enabled ) { $checked = " checked='checked'"; } else { $check = ''; } } elseif ( ! $check && $enabled && 'thumbnail' !== $size ) { $check = $size; $checked = " checked='checked'"; } $html = "
            "; $html .= ""; if ( $enabled ) { $html .= " '; } $html .= '
            '; $out[] = $html; } return array( 'label' => __( 'Size' ), 'input' => 'html', 'html' => implode( "\n", $out ), ); } function image_link_input_fields( $post, $url_type = '' ) { $file = wp_get_attachment_url( $post->ID ); $link = get_attachment_link( $post->ID ); if ( empty( $url_type ) ) { $url_type = get_user_setting( 'urlbutton', 'post' ); } $url = ''; if ( 'file' === $url_type ) { $url = $file; } elseif ( 'post' === $url_type ) { $url = $link; } return " -
            - - - -'; } function wp_caption_input_textarea( $edit_post ) { $name = "attachments[{$edit_post->ID}][post_excerpt]"; return ''; } function image_attachment_fields_to_edit( $form_fields, $post ) { return $form_fields; } function media_single_attachment_fields_to_edit( $form_fields, $post ) { unset( $form_fields['url'], $form_fields['align'], $form_fields['image-size'] ); return $form_fields; } function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { unset( $form_fields['image_url'] ); return $form_fields; } function image_media_send_to_editor( $html, $attachment_id, $attachment ) { $post = get_post( $attachment_id ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $url = $attachment['url']; $align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; $alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url ); return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt ); } return $html; } function get_attachment_fields_to_edit( $post, $errors = null ) { if ( is_int( $post ) ) { $post = get_post( $post ); } if ( is_array( $post ) ) { $post = new WP_Post( (object) $post ); } $image_url = wp_get_attachment_url( $post->ID ); $edit_post = sanitize_post( $post, 'edit' ); $form_fields = array( 'post_title' => array( 'label' => __( 'Title' ), 'value' => $edit_post->post_title, ), 'image_alt' => array(), 'post_excerpt' => array( 'label' => __( 'Caption' ), 'input' => 'html', 'html' => wp_caption_input_textarea( $edit_post ), ), 'post_content' => array( 'label' => __( 'Description' ), 'value' => $edit_post->post_content, 'input' => 'textarea', ), 'url' => array( 'label' => __( 'Link URL' ), 'input' => 'html', 'html' => image_link_input_fields( $post, get_option( 'image_default_link_type' ) ), 'helps' => __( 'Enter a link URL or click above for presets.' ), ), 'menu_order' => array( 'label' => __( 'Order' ), 'value' => $edit_post->menu_order, ), 'image_url' => array( 'label' => __( 'File URL' ), 'input' => 'html', 'html' => "
            ", 'value' => wp_get_attachment_url( $post->ID ), 'helps' => __( 'Location of the uploaded file.' ), ), ); foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( ! $t['public'] || ! $t['show_ui'] ) { continue; } if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $values = array(); foreach ( $terms as $term ) { $values[] = $term->slug; } $t['value'] = implode( ', ', $values ); $form_fields[ $taxonomy ] = $t; } $form_fields = array_merge_recursive( $form_fields, (array) $errors ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); if ( empty( $alt ) ) { $alt = ''; } $form_fields['post_title']['required'] = true; $form_fields['image_alt'] = array( 'value' => $alt, 'label' => __( 'Alternative Text' ), 'helps' => __( 'Alt text for the image, e.g. “The Mona Lisa”' ), ); $form_fields['align'] = array( 'label' => __( 'Alignment' ), 'input' => 'html', 'html' => image_align_input_fields( $post, get_option( 'image_default_align' ) ), ); $form_fields['image-size'] = image_size_input_fields( $post, get_option( 'image_default_size', 'medium' ) ); } else { unset( $form_fields['image_alt'] ); } $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); return $form_fields; } function get_media_items( $post_id, $errors ) { $attachments = array(); if ( $post_id ) { $post = get_post( $post_id ); if ( $post && 'attachment' === $post->post_type ) { $attachments = array( $post->ID => $post ); } else { $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC', ) ); } } else { if ( is_array( $GLOBALS['wp_the_query']->posts ) ) { foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) { $attachments[ $attachment->ID ] = $attachment; } } } $output = ''; foreach ( (array) $attachments as $id => $attachment ) { if ( 'trash' === $attachment->post_status ) { continue; } $item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) ); if ( $item ) { $output .= "\n
            $item\n
            "; } } return $output; } function get_media_item( $attachment_id, $args = null ) { global $redir_tab; $thumb_url = false; $attachment_id = (int) $attachment_id; if ( $attachment_id ) { $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ); if ( $thumb_url ) { $thumb_url = $thumb_url[0]; } } $post = get_post( $attachment_id ); $current_post_id = ! empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0; $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true, ); $parsed_args = wp_parse_args( $args, $default_args ); $parsed_args = apply_filters( 'get_media_item_args', $parsed_args ); $toggle_on = __( 'Show' ); $toggle_off = __( 'Hide' ); $file = get_attached_file( $post->ID ); $filename = esc_html( wp_basename( $file ) ); $title = esc_attr( $post->post_title ); $post_mime_types = get_post_mime_types(); $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) ); $type = reset( $keys ); $type_html = ""; $form_fields = get_attachment_fields_to_edit( $post, $parsed_args['errors'] ); if ( $parsed_args['toggle'] ) { $class = empty( $parsed_args['errors'] ) ? 'startclosed' : 'startopen'; $toggle_links = " - $toggle_on - $toggle_off"; } else { $class = ''; $toggle_links = ''; } $display_title = ( ! empty( $title ) ) ? $title : $filename; $display_title = $parsed_args['show_title'] ? "
            " . wp_html_excerpt( $display_title, 60, '…' ) . '
            ' : ''; $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) ); $order = ''; foreach ( $form_fields as $key => $val ) { if ( 'menu_order' === $key ) { if ( $gallery ) { $order = ""; } else { $order = ""; } unset( $form_fields['menu_order'] ); break; } } $media_dims = ''; $meta = wp_get_attachment_metadata( $post->ID ); if ( isset( $meta['width'], $meta['height'] ) ) { $media_dims .= "{$meta['width']} × {$meta['height']} "; } $media_dims = apply_filters( 'media_meta', $media_dims, $post ); $image_edit_button = ''; if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { $nonce = wp_create_nonce( "image_editor-$post->ID" ); $image_edit_button = " "; } $attachment_url = get_permalink( $attachment_id ); $item = " - $type_html - $toggle_links - $order - $display_title - - - - - \n"; $item .= " - - - \n - \n - \n"; $defaults = array( 'input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), ); if ( $parsed_args['send'] ) { $parsed_args['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false ); } $delete = empty( $parsed_args['delete'] ) ? '' : $parsed_args['delete']; if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { if ( ! EMPTY_TRASH_DAYS ) { $delete = "" . __( 'Delete Permanently' ) . ''; } elseif ( ! MEDIA_TRASH ) { $delete = "" . __( 'Delete' ) . " - '; } else { $delete = "" . __( 'Move to Trash' ) . " - '; } } else { $delete = ''; } $thumbnail = ''; $calling_post_id = 0; if ( isset( $_GET['post_id'] ) ) { $calling_post_id = absint( $_GET['post_id'] ); } elseif ( isset( $_POST ) && count( $_POST ) ) { $calling_post_id = $post->post_parent; } if ( 'image' === $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { $calling_post = get_post( $calling_post_id ); $calling_post_type_object = get_post_type_object( $calling_post->post_type ); $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); $thumbnail = "" . esc_html( $calling_post_type_object->labels->use_featured_image ) . ''; } if ( ( $parsed_args['send'] || $thumbnail || $delete ) && ! isset( $form_fields['buttons'] ) ) { $form_fields['buttons'] = array( 'tr' => "\t\t\n" ); } $hidden_fields = array(); foreach ( $form_fields as $id => $field ) { if ( '_' === $id[0] ) { continue; } if ( ! empty( $field['tr'] ) ) { $item .= $field['tr']; continue; } $field = array_merge( $defaults, $field ); $name = "attachments[$attachment_id][$id]"; if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } $required = $field['required'] ? '*' : ''; $required_attr = $field['required'] ? ' required' : ''; $class = $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; $extra_rows = array(); if ( ! empty( $field['errors'] ) ) { foreach ( array_unique( (array) $field['errors'] ) as $error ) { $extra_rows['error'][] = $error; } } if ( ! empty( $field['extra_rows'] ) ) { foreach ( $field['extra_rows'] as $class => $rows ) { foreach ( (array) $rows as $html ) { $extra_rows[ $class ][] = $html; } } } foreach ( $extra_rows as $class => $rows ) { foreach ( $rows as $html ) { $item .= "\t\t\n"; } } } if ( ! empty( $form_fields['_final'] ) ) { $item .= "\t\t\n"; } $item .= "\t\n"; $item .= "\t
            -

            -

            $image_edit_button

            -
            -

            " . __( 'File name:' ) . " $filename

            -

            " . __( 'File type:' ) . " $post->post_mime_type

            -

            " . __( 'Upload date:' ) . ' ' . mysql2date( __( 'F j, Y' ), $post->post_date ) . '

            '; if ( ! empty( $media_dims ) ) { $item .= '

            ' . __( 'Dimensions:' ) . " $media_dims

            \n"; } $item .= "

            " . sprintf( __( 'Required fields are marked %s' ), '*' ) . "

            " . $parsed_args['send'] . " $thumbnail $delete
            "; if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' === $id && user_can_richedit() ) { $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); } $item .= "'; } else { $item .= ""; } if ( ! empty( $field['helps'] ) ) { $item .= "

            " . implode( "

            \n

            ", array_unique( (array) $field['helps'] ) ) . '

            '; } $item .= "
            $html
            {$form_fields['_final']}
            \n"; foreach ( $hidden_fields as $name => $value ) { $item .= "\t\n"; } if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) { $parent = (int) $_REQUEST['post_id']; $parent_name = "attachments[$attachment_id][post_parent]"; $item .= "\t\n"; } return $item; } function get_compat_media_markup( $attachment_id, $args = null ) { $post = get_post( $attachment_id ); $default_args = array( 'errors' => null, 'in_modal' => false, ); $user_can_edit = current_user_can( 'edit_post', $attachment_id ); $args = wp_parse_args( $args, $default_args ); $args = apply_filters( 'get_media_item_args', $args ); $form_fields = array(); if ( $args['in_modal'] ) { foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( ! $t['public'] || ! $t['show_ui'] ) { continue; } if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $values = array(); foreach ( $terms as $term ) { $values[] = $term->slug; } $t['value'] = implode( ', ', $values ); $t['taxonomy'] = true; $form_fields[ $taxonomy ] = $t; } } $form_fields = array_merge_recursive( $form_fields, (array) $args['errors'] ); $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); $media_meta = apply_filters( 'media_meta', '', $post ); $defaults = array( 'input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), 'show_in_edit' => true, 'show_in_modal' => true, ); $hidden_fields = array(); $item = ''; foreach ( $form_fields as $id => $field ) { if ( '_' === $id[0] ) { continue; } $name = "attachments[$attachment_id][$id]"; $id_attr = "attachments-$attachment_id-$id"; if ( ! empty( $field['tr'] ) ) { $item .= $field['tr']; continue; } $field = array_merge( $defaults, $field ); if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) { continue; } if ( 'hidden' === $field['input'] ) { $hidden_fields[ $name ] = $field['value']; continue; } $readonly = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : ''; $required = $field['required'] ? '*' : ''; $required_attr = $field['required'] ? ' required' : ''; $class = 'compat-field-' . $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t"; $item .= "\t\t\t"; $item .= "\n\t\t\t"; if ( ! empty( $field[ $field['input'] ] ) ) { $item .= $field[ $field['input'] ]; } elseif ( 'textarea' === $field['input'] ) { if ( 'post_content' === $id && user_can_richedit() ) { $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES ); } $item .= "'; } else { $item .= ""; } if ( ! empty( $field['helps'] ) ) { $item .= "

            " . implode( "

            \n

            ", array_unique( (array) $field['helps'] ) ) . '

            '; } $item .= "\n\t\t\n"; $extra_rows = array(); if ( ! empty( $field['errors'] ) ) { foreach ( array_unique( (array) $field['errors'] ) as $error ) { $extra_rows['error'][] = $error; } } if ( ! empty( $field['extra_rows'] ) ) { foreach ( $field['extra_rows'] as $class => $rows ) { foreach ( (array) $rows as $html ) { $extra_rows[ $class ][] = $html; } } } foreach ( $extra_rows as $class => $rows ) { foreach ( $rows as $html ) { $item .= "\t\t$html\n"; } } } if ( ! empty( $form_fields['_final'] ) ) { $item .= "\t\t{$form_fields['_final']}\n"; } if ( $item ) { $item = '

            ' . sprintf( __( 'Required fields are marked %s' ), '*' ) . '

            ' . '' . $item . '
            '; } foreach ( $hidden_fields as $hidden_field => $value ) { $item .= '' . "\n"; } if ( $item ) { $item = '' . $item; } return array( 'item' => $item, 'meta' => $media_meta, ); } function media_upload_header() { $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; echo ''; if ( empty( $_GET['chromeless'] ) ) { echo '
            '; the_media_upload_tabs(); echo '
            '; } } function media_upload_form( $errors = null ) { global $type, $tab, $is_IE, $is_opera; if ( ! _device_can_upload() ) { echo '

            ' . sprintf( __( 'The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.' ), 'https://apps.wordpress.org/' ) . '

            '; return; } $upload_action_url = admin_url( 'async-upload.php' ); $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $_type = isset( $type ) ? $type : ''; $_tab = isset( $tab ) ? $tab : ''; $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } ?> -
            - -
            -
            - get_error_message(); } ?> -
            - $post_id, '_wpnonce' => wp_create_nonce( 'media-form' ), 'type' => $_type, 'tab' => $_tab, 'short' => '1', ); $post_params = apply_filters( 'upload_post_params', $post_params ); $plupload_init = array( 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'url' => $upload_action_url, 'filters' => array( 'max_file_size' => $max_upload_size . 'b' ), 'multipart_params' => $post_params, ); if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) { $plupload_init['multi_selection'] = false; } if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { $plupload_init['webp_upload_error'] = true; } $plupload_init = apply_filters( 'plupload_init', $plupload_init ); ?> - - -
            - -
            -
            -

            -

            -

            -
            -
            - -
            - -
            - -

            - - - - -

            -
            - -
            - -

            - -

            - -
            - - - - -

            - - - - -
            - ' . esc_html( $id->get_error_message() ) . '
            '; exit; } } ?> - - -

            - -

            -
            - -
            - - - -

            - - - -
            -
            - -
            -
            -
            - - -
            - - - - - - - | - | - -
            - - -
            - - - - - - - - -
              - $reals ) { foreach ( $reals as $real ) { if ( isset( $num_posts[ $_type ] ) ) { $num_posts[ $_type ] += $_num_posts[ $real ]; } else { $num_posts[ $_type ] = $_num_posts[ $real ]; } } } if ( empty( $_GET['post_mime_type'] ) && ! empty( $num_posts[ $type ] ) ) { $_GET['post_mime_type'] = $type; list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); } if ( empty( $_GET['post_mime_type'] ) || 'all' === $_GET['post_mime_type'] ) { $class = ' class="current"'; } else { $class = ''; } $type_links[] = '
            • ' . __( 'All Types' ) . ''; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; } if ( isset( $_GET['post_mime_type'] ) && wp_match_mime_types( $mime_type, $_GET['post_mime_type'] ) ) { $class = ' class="current"'; } $type_links[] = '
            • ' . sprintf( translate_nooped_plural( $label[2], $num_posts[ $mime_type ] ), '' . number_format_i18n( $num_posts[ $mime_type ] ) . '' ) . ''; } echo implode( ' |
            • ', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . ''; unset( $type_links ); ?> -
            - -
            - - add_query_arg( 'paged', '%#%' ), 'format' => '', 'prev_text' => __( '«' ), 'next_text' => __( '»' ), 'total' => ceil( $wp_query->found_posts / 10 ), 'current' => $q['paged'], ) ); if ( $page_links ) { echo "
            $page_links
            "; } ?> - -
            - posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; $arc_result = $wpdb->get_results( $arc_query ); $month_count = count( $arc_result ); $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> - - - - - -
            - -
            -
            -
            - -
            - - - - -
            - - -
            -

            - - -

            -
            - - - - - - '; } else { $caption = ''; } $default_align = get_option( 'image_default_align' ); if ( empty( $default_align ) ) { $default_align = 'none'; } if ( 'image' === $default_view ) { $view = 'image-only'; $table_class = ''; } else { $view = 'not-image'; $table_class = $view; } return ' -

               

            -

            ' . sprintf( __( 'Required fields are marked %s' ), '*' ) . '

            - - - - - - - - - - - - - - - - - - ' . $caption . ' - - - - - - - - - - - - - - - - - -
            - - -
            - -

            ' . __( 'Link text, e.g. “Ransom Demands (PDF)”' ) . '

            - - -

            ' . __( 'Alt text for the image, e.g. “The Mona Lisa”' ) . '

            - - - - - - - - -
            - -
            - - - -

            ' . __( 'Enter a link URL or click above for presets.' ) . '

            - -
            - ' . get_submit_button( __( 'Insert into Post' ), '', 'insertonlybutton', false ) . ' -
            '; } function media_upload_flash_bypass() { $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); $post = get_post(); if ( $post ) { $browser_uploader .= '&post_id=' . (int) $post->ID; } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID']; } ?> -

            - browser uploader instead.' ), $browser_uploader, 'target="_blank"' ); ?> -

            - -

            - Switch to the multi-file uploader.' ); ?> -

            - '; $end = ''; } ?> -

            - ' . sprintf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( get_space_allowed() * MB_IN_BYTES ) ) . '

            '; } function edit_form_image_editor( $post ) { $open = isset( $_GET['image-editor'] ); if ( $open ) { require_once ABSPATH . 'wp-admin/includes/image-edit.php'; } $thumb_url = false; $attachment_id = (int) $post->ID; if ( $attachment_id ) { $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); } $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); $att_url = wp_get_attachment_url( $post->ID ); ?> -
            - ID ) ) : $image_edit_button = ''; if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { $nonce = wp_create_nonce( "image_editor-$post->ID" ); $image_edit_button = " "; } $open_style = ''; $not_open_style = ''; if ( $open ) { $open_style = ' style="display:none"'; } else { $not_open_style = ' style="display:none"'; } ?> -
            - - class="wp_attachment_image wp-clearfix" id="media-head-"> -

            -

            -
            - class="image-editor" id="image-editor-"> - - - $att_url ) ); elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ) : wp_maybe_generate_attachment_metadata( $post ); $meta = wp_get_attachment_metadata( $attachment_id ); $w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0; $h = ! empty( $meta['height'] ) ? $meta['height'] : 0; if ( $h && $w < $meta['width'] ) { $h = round( ( $meta['height'] * $w ) / $meta['width'] ); } $attr = array( 'src' => $att_url ); if ( ! empty( $w ) && ! empty( $h ) ) { $attr['width'] = $w; $attr['height'] = $h; } $thumb_id = get_post_thumbnail_id( $attachment_id ); if ( ! empty( $thumb_id ) ) { $attr['poster'] = wp_get_attachment_url( $thumb_id ); } echo wp_video_shortcode( $attr ); elseif ( isset( $thumb_url[0] ) ) : ?> -
            -

            - -

            -
            - - -
            - post_mime_type, 0, 5 ) ) : ?> -

            -
            - -

            -

            - Learn how to describe the purpose of the image%3$s. Leave empty if the image is purely decorative.' ), esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), 'target="_blank" rel="noopener"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); ?> -

            - - -

            -
            - -

            - - 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); $editor_args = array( 'textarea_name' => 'content', 'textarea_rows' => 5, 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings, ); ?> - - - post_content ), 'attachment_content', $editor_args ); ?> - -
            - ID ); echo $extras['item']; echo '' . "\n"; } function attachment_submitbox_metadata() { $post = get_post(); $attachment_id = $post->ID; $file = get_attached_file( $attachment_id ); $filename = esc_html( wp_basename( $file ) ); $media_dims = ''; $meta = wp_get_attachment_metadata( $attachment_id ); if ( isset( $meta['width'], $meta['height'] ) ) { $media_dims .= "{$meta['width']} × {$meta['height']} "; } $media_dims = apply_filters( 'media_meta', $media_dims, $post ); $att_url = wp_get_attachment_url( $attachment_id ); $author = new WP_User( $post->post_author ); $uploaded_by_name = __( '(no author)' ); $uploaded_by_link = ''; if ( $author->exists() ) { $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname; $uploaded_by_link = get_edit_user_link( $author->ID ); } ?> -
            - - - - - -
            - - post_parent ) { $post_parent = get_post( $post->post_parent ); if ( $post_parent ) { $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); $uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' ); ?> -
            - - - - - -
            - - -
            - - - - - - -
            -
            - -
            -
            - - - ID ), $matches ) ) { echo esc_html( strtoupper( $matches[1] ) ); list( $mime_type ) = explode( '/', $post->post_mime_type ); if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) { if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) { echo ' (' . $meta['mime_type'] . ')'; } } } else { echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) ); } ?> - -
            - - -
            - -
            - post_mime_type ) ) { $fields = array( 'length_formatted' => __( 'Length:' ), 'bitrate' => __( 'Bitrate:' ), ); $fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post ); foreach ( $fields as $key => $label ) { if ( empty( $meta[ $key ] ) ) { continue; } ?> -
            - - - - -
            - __( 'Audio Format:' ), 'codec' => __( 'Audio Codec:' ), ); $audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post ); foreach ( $audio_fields as $key => $label ) { if ( empty( $meta['audio'][ $key ] ) ) { continue; } ?> -
            - -
            - -
            - -
            - -
            - - - - -
            - $list ) { if ( 'length' !== $key && ! empty( $list ) ) { $metadata[ $key ] = wp_kses_post( reset( $list ) ); if ( 'terms_of_use' === $key && 0 === strpos( $metadata[ $key ], 'yright notice.' ) ) { $metadata[ $key ] = 'Cop' . $metadata[ $key ]; } } } break; } } if ( ! empty( $data['id3v2']['APIC'] ) ) { $image = reset( $data['id3v2']['APIC'] ); if ( ! empty( $image['data'] ) ) { $metadata['image'] = array( 'data' => $image['data'], 'mime' => $image['image_mime'], 'width' => $image['image_width'], 'height' => $image['image_height'], ); } } elseif ( ! empty( $data['comments']['picture'] ) ) { $image = reset( $data['comments']['picture'] ); if ( ! empty( $image['data'] ) ) { $metadata['image'] = array( 'data' => $image['data'], 'mime' => $image['image_mime'], ); } } } function wp_read_video_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } $metadata = array(); if ( ! defined( 'GETID3_TEMP_DIR' ) ) { define( 'GETID3_TEMP_DIR', get_temp_dir() ); } if ( ! class_exists( 'getID3', false ) ) { require ABSPATH . WPINC . '/ID3/getid3.php'; } $id3 = new getID3(); $id3->options_audiovideo_quicktime_ReturnAtomData = true; $data = $id3->analyze( $file ); if ( isset( $data['video']['lossless'] ) ) { $metadata['lossless'] = $data['video']['lossless']; } if ( ! empty( $data['video']['bitrate'] ) ) { $metadata['bitrate'] = (int) $data['video']['bitrate']; } if ( ! empty( $data['video']['bitrate_mode'] ) ) { $metadata['bitrate_mode'] = $data['video']['bitrate_mode']; } if ( ! empty( $data['filesize'] ) ) { $metadata['filesize'] = (int) $data['filesize']; } if ( ! empty( $data['mime_type'] ) ) { $metadata['mime_type'] = $data['mime_type']; } if ( ! empty( $data['playtime_seconds'] ) ) { $metadata['length'] = (int) round( $data['playtime_seconds'] ); } if ( ! empty( $data['playtime_string'] ) ) { $metadata['length_formatted'] = $data['playtime_string']; } if ( ! empty( $data['video']['resolution_x'] ) ) { $metadata['width'] = (int) $data['video']['resolution_x']; } if ( ! empty( $data['video']['resolution_y'] ) ) { $metadata['height'] = (int) $data['video']['resolution_y']; } if ( ! empty( $data['fileformat'] ) ) { $metadata['fileformat'] = $data['fileformat']; } if ( ! empty( $data['video']['dataformat'] ) ) { $metadata['dataformat'] = $data['video']['dataformat']; } if ( ! empty( $data['video']['encoder'] ) ) { $metadata['encoder'] = $data['video']['encoder']; } if ( ! empty( $data['video']['codec'] ) ) { $metadata['codec'] = $data['video']['codec']; } if ( ! empty( $data['audio'] ) ) { unset( $data['audio']['streams'] ); $metadata['audio'] = $data['audio']; } if ( empty( $metadata['created_timestamp'] ) ) { $created_timestamp = wp_get_media_creation_timestamp( $data ); if ( false !== $created_timestamp ) { $metadata['created_timestamp'] = $created_timestamp; } } wp_add_id3_tag_data( $metadata, $data ); $file_format = isset( $metadata['fileformat'] ) ? $metadata['fileformat'] : null; return apply_filters( 'wp_read_video_metadata', $metadata, $file, $file_format, $data ); } function wp_read_audio_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } $metadata = array(); if ( ! defined( 'GETID3_TEMP_DIR' ) ) { define( 'GETID3_TEMP_DIR', get_temp_dir() ); } if ( ! class_exists( 'getID3', false ) ) { require ABSPATH . WPINC . '/ID3/getid3.php'; } $id3 = new getID3(); $id3->options_audiovideo_quicktime_ReturnAtomData = true; $data = $id3->analyze( $file ); if ( ! empty( $data['audio'] ) ) { unset( $data['audio']['streams'] ); $metadata = $data['audio']; } if ( ! empty( $data['fileformat'] ) ) { $metadata['fileformat'] = $data['fileformat']; } if ( ! empty( $data['filesize'] ) ) { $metadata['filesize'] = (int) $data['filesize']; } if ( ! empty( $data['mime_type'] ) ) { $metadata['mime_type'] = $data['mime_type']; } if ( ! empty( $data['playtime_seconds'] ) ) { $metadata['length'] = (int) round( $data['playtime_seconds'] ); } if ( ! empty( $data['playtime_string'] ) ) { $metadata['length_formatted'] = $data['playtime_string']; } if ( empty( $metadata['created_timestamp'] ) ) { $created_timestamp = wp_get_media_creation_timestamp( $data ); if ( false !== $created_timestamp ) { $metadata['created_timestamp'] = $created_timestamp; } } wp_add_id3_tag_data( $metadata, $data ); return $metadata; } function wp_get_media_creation_timestamp( $metadata ) { $creation_date = false; if ( empty( $metadata['fileformat'] ) ) { return $creation_date; } switch ( $metadata['fileformat'] ) { case 'asf': if ( isset( $metadata['asf']['file_properties_object']['creation_date_unix'] ) ) { $creation_date = (int) $metadata['asf']['file_properties_object']['creation_date_unix']; } break; case 'matroska': case 'webm': if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) { $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] ); } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) { $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix']; } break; case 'quicktime': case 'mp4': if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) { $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix']; } break; } return $creation_date; } function wp_media_attach_action( $parent_id, $action = 'attach' ) { global $wpdb; if ( ! $parent_id ) { return; } if ( ! current_user_can( 'edit_post', $parent_id ) ) { wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); } $ids = array(); foreach ( (array) $_REQUEST['media'] as $attachment_id ) { $attachment_id = (int) $attachment_id; if ( ! current_user_can( 'edit_post', $attachment_id ) ) { continue; } $ids[] = $attachment_id; } if ( ! empty( $ids ) ) { $ids_string = implode( ',', $ids ); if ( 'attach' === $action ) { $result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $ids_string )", $parent_id ) ); } else { $result = $wpdb->query( "UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )" ); } } if ( isset( $result ) ) { foreach ( $ids as $attachment_id ) { do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id ); clean_attachment_cache( $attachment_id ); } $location = 'upload.php'; $referer = wp_get_referer(); if ( $referer ) { if ( false !== strpos( $referer, 'upload.php' ) ) { $location = remove_query_arg( array( 'attached', 'detach' ), $referer ); } } $key = 'attach' === $action ? 'attached' : 'detach'; $location = add_query_arg( array( $key => $result ), $location ); wp_redirect( $location ); exit; } } test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ), $this->test_wp_version_check_attached(), $this->test_filters_automatic_updater_disabled(), $this->test_wp_automatic_updates_disabled(), $this->test_if_failed_update(), $this->test_vcs_abspath(), $this->test_check_wp_filesystem_method(), $this->test_all_files_writable(), $this->test_accepts_dev_updates(), $this->test_accepts_minor_updates(), ); $tests = array_filter( $tests ); $tests = array_map( static function( $test ) { $test = (object) $test; if ( empty( $test->severity ) ) { $test->severity = 'warning'; } return $test; }, $tests ); return $tests; } public function test_constants( $constant, $value ) { $acceptable_values = (array) $value; if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) { return array( 'description' => sprintf( __( 'The %s constant is defined and enabled.' ), "$constant" ), 'severity' => 'fail', ); } } public function test_wp_version_check_attached() { if ( ( ! is_multisite() || is_main_site() && is_network_admin() ) && ! has_filter( 'wp_version_check', 'wp_version_check' ) ) { return array( 'description' => sprintf( __( 'A plugin has prevented updates by disabling %s.' ), 'wp_version_check()' ), 'severity' => 'fail', ); } } public function test_filters_automatic_updater_disabled() { if ( apply_filters( 'automatic_updater_disabled', false ) ) { return array( 'description' => sprintf( __( 'The %s filter is enabled.' ), 'automatic_updater_disabled' ), 'severity' => 'fail', ); } } public function test_wp_automatic_updates_disabled() { if ( ! class_exists( 'WP_Automatic_Updater' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; } $auto_updates = new WP_Automatic_Updater(); if ( ! $auto_updates->is_disabled() ) { return false; } return array( 'description' => __( 'All automatic updates are disabled.' ), 'severity' => 'fail', ); } public function test_if_failed_update() { $failed = get_site_option( 'auto_core_update_failed' ); if ( ! $failed ) { return false; } if ( ! empty( $failed['critical'] ) ) { $description = __( 'A previous automatic background update ended with a critical failure, so updates are now disabled.' ); $description .= ' ' . __( 'You would have received an email because of this.' ); $description .= ' ' . __( "When you've been able to update using the \"Update now\" button on Dashboard > Updates, we'll clear this error for future update attempts." ); $description .= ' ' . sprintf( __( 'The error code was %s.' ), '' . $failed['error_code'] . '' ); return array( 'description' => $description, 'severity' => 'warning', ); } $description = __( 'A previous automatic background update could not occur.' ); if ( empty( $failed['retry'] ) ) { $description .= ' ' . __( 'You would have received an email because of this.' ); } $description .= ' ' . __( "We'll try again with the next release." ); $description .= ' ' . sprintf( __( 'The error code was %s.' ), '' . $failed['error_code'] . '' ); return array( 'description' => $description, 'severity' => 'warning', ); } public function test_vcs_abspath() { $context_dirs = array( ABSPATH ); $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' ); $check_dirs = array(); foreach ( $context_dirs as $context_dir ) { do { $check_dirs[] = $context_dir; if ( dirname( $context_dir ) === $context_dir ) { break; } } while ( $context_dir = dirname( $context_dir ) ); } $check_dirs = array_unique( $check_dirs ); foreach ( $vcs_dirs as $vcs_dir ) { foreach ( $check_dirs as $check_dir ) { if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) { break 2; } } } if ( $checkout && ! apply_filters( 'automatic_updates_is_vcs_checkout', true, ABSPATH ) ) { return array( 'description' => sprintf( __( 'The folder %1$s was detected as being under version control (%2$s), but the %3$s filter is allowing updates.' ), '' . $check_dir . '', "$vcs_dir", 'automatic_updates_is_vcs_checkout' ), 'severity' => 'info', ); } if ( $checkout ) { return array( 'description' => sprintf( __( 'The folder %1$s was detected as being under version control (%2$s).' ), '' . $check_dir . '', "$vcs_dir" ), 'severity' => 'warning', ); } return array( 'description' => __( 'No version control systems were detected.' ), 'severity' => 'pass', ); } public function test_check_wp_filesystem_method() { if ( ! function_exists( 'request_filesystem_credentials' ) ) { require_once ABSPATH . '/wp-admin/includes/file.php'; } $skin = new Automatic_Upgrader_Skin; $success = $skin->request_filesystem_credentials( false, ABSPATH ); if ( ! $success ) { $description = __( 'Your installation of WordPress prompts for FTP credentials to perform updates.' ); $description .= ' ' . __( '(Your site is performing updates over FTP due to file ownership. Talk to your hosting company.)' ); return array( 'description' => $description, 'severity' => 'fail', ); } return array( 'description' => __( 'Your installation of WordPress does not require FTP credentials to perform updates.' ), 'severity' => 'pass', ); } public function test_all_files_writable() { global $wp_filesystem; require ABSPATH . WPINC . '/version.php'; $skin = new Automatic_Upgrader_Skin; $success = $skin->request_filesystem_credentials( false, ABSPATH ); if ( ! $success ) { return false; } WP_Filesystem(); if ( 'direct' !== $wp_filesystem->method ) { return false; } if ( ! function_exists( 'get_core_checksums' ) ) { require_once ABSPATH . '/wp-admin/includes/update.php'; } $checksums = get_core_checksums( $wp_version, 'en_US' ); $dev = ( false !== strpos( $wp_version, '-' ) ); if ( ! $checksums && $dev ) { $checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' ); } if ( ! $checksums && $dev ) { return false; } if ( ! $checksums ) { $description = sprintf( __( "Couldn't retrieve a list of the checksums for WordPress %s." ), $wp_version ); $description .= ' ' . __( 'This could mean that connections are failing to WordPress.org.' ); return array( 'description' => $description, 'severity' => 'warning', ); } $unwritable_files = array(); foreach ( array_keys( $checksums ) as $file ) { if ( 'wp-content' === substr( $file, 0, 10 ) ) { continue; } if ( ! file_exists( ABSPATH . $file ) ) { continue; } if ( ! is_writable( ABSPATH . $file ) ) { $unwritable_files[] = $file; } } if ( $unwritable_files ) { if ( count( $unwritable_files ) > 20 ) { $unwritable_files = array_slice( $unwritable_files, 0, 20 ); $unwritable_files[] = '...'; } return array( 'description' => __( 'Some files are not writable by WordPress:' ) . '
            • ' . implode( '
            • ', $unwritable_files ) . '
            ', 'severity' => 'fail', ); } else { return array( 'description' => __( 'All of your WordPress files are writable.' ), 'severity' => 'pass', ); } } public function test_accepts_dev_updates() { require ABSPATH . WPINC . '/version.php'; if ( false === strpos( $wp_version, '-' ) ) { return false; } if ( defined( 'WP_AUTO_UPDATE_CORE' ) && ( 'minor' === WP_AUTO_UPDATE_CORE || false === WP_AUTO_UPDATE_CORE ) ) { return array( 'description' => sprintf( __( 'WordPress development updates are blocked by the %s constant.' ), 'WP_AUTO_UPDATE_CORE' ), 'severity' => 'fail', ); } if ( ! apply_filters( 'allow_dev_auto_core_updates', $wp_version ) ) { return array( 'description' => sprintf( __( 'WordPress development updates are blocked by the %s filter.' ), 'allow_dev_auto_core_updates' ), 'severity' => 'fail', ); } } public function test_accepts_minor_updates() { if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) { return array( 'description' => sprintf( __( 'WordPress security and maintenance releases are blocked by %s.' ), "define( 'WP_AUTO_UPDATE_CORE', false );" ), 'severity' => 'fail', ); } if ( ! apply_filters( 'allow_minor_auto_core_updates', true ) ) { return array( 'description' => sprintf( __( 'WordPress security and maintenance releases are blocked by the %s filter.' ), 'allow_minor_auto_core_updates' ), 'severity' => 'fail', ); } } } '', 'singular' => '', 'ajax' => false, 'screen' => null, ) ); $this->screen = convert_to_screen( $args['screen'] ); add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 ); if ( ! $args['plural'] ) { $args['plural'] = $this->screen->base; } $args['plural'] = sanitize_key( $args['plural'] ); $args['singular'] = sanitize_key( $args['singular'] ); $this->_args = $args; if ( $args['ajax'] ) { add_action( 'admin_footer', array( $this, '_js_vars' ) ); } if ( empty( $this->modes ) ) { $this->modes = array( 'list' => __( 'Compact view' ), 'excerpt' => __( 'Extended view' ), ); } } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } return false; } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; } public function ajax_user_can() { die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' ); } public function prepare_items() { die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' ); } protected function set_pagination_args( $args ) { $args = wp_parse_args( $args, array( 'total_items' => 0, 'total_pages' => 0, 'per_page' => 0, ) ); if ( ! $args['total_pages'] && $args['per_page'] > 0 ) { $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] ); } if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); exit; } $this->_pagination_args = $args; } public function get_pagination_arg( $key ) { if ( 'page' === $key ) { return $this->get_pagenum(); } if ( isset( $this->_pagination_args[ $key ] ) ) { return $this->_pagination_args[ $key ]; } return 0; } public function has_items() { return ! empty( $this->items ); } public function no_items() { _e( 'No items found.' ); } public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { return; } $input_id = $input_id . '-search-input'; if ( ! empty( $_REQUEST['orderby'] ) ) { echo ''; } if ( ! empty( $_REQUEST['order'] ) ) { echo ''; } if ( ! empty( $_REQUEST['post_mime_type'] ) ) { echo ''; } if ( ! empty( $_REQUEST['detached'] ) ) { echo ''; } ?> - - get_views(); $views = apply_filters( "views_{$this->screen->id}", $views ); if ( empty( $views ) ) { return; } $this->screen->render_screen_reader_content( 'heading_views' ); echo "
              \n"; foreach ( $views as $class => $view ) { $views[ $class ] = "\t
            • $view"; } echo implode( " |
            • \n", $views ) . "\n"; echo '
            '; } protected function get_bulk_actions() { return array(); } protected function bulk_actions( $which = '' ) { if ( is_null( $this->_actions ) ) { $this->_actions = $this->get_bulk_actions(); $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); $two = ''; } else { $two = '2'; } if ( empty( $this->_actions ) ) { return; } echo ''; echo '\n"; submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) ); echo "\n"; } public function current_action() { if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) { return false; } if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) { return $_REQUEST['action']; } return false; } protected function row_actions( $actions, $always_visible = false ) { $action_count = count( $actions ); if ( ! $action_count ) { return ''; } $mode = get_user_setting( 'posts_list_mode', 'list' ); if ( 'excerpt' === $mode ) { $always_visible = true; } $out = '
            '; $i = 0; foreach ( $actions as $action => $link ) { ++$i; $sep = ( $i < $action_count ) ? ' | ' : ''; $out .= "$link$sep"; } $out .= '
            '; $out .= ''; return $out; } protected function months_dropdown( $post_type ) { global $wpdb, $wp_locale; if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) { return; } $months = apply_filters( 'pre_months_dropdown_query', false, $post_type ); if ( ! is_array( $months ) ) { $extra_checks = "AND post_status != 'auto-draft'"; if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) { $extra_checks .= " AND post_status != 'trash'"; } elseif ( isset( $_GET['post_status'] ) ) { $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] ); } $months = $wpdb->get_results( $wpdb->prepare( " - SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month - FROM $wpdb->posts - WHERE post_type = %s - $extra_checks - ORDER BY post_date DESC - ", $post_type ) ); } $months = apply_filters( 'months_dropdown_results', $months, $post_type ); $month_count = count( $months ); if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) { return; } $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; ?> - - - - -
            - modes as $mode => $title ) { $classes = array( 'view-' . $mode ); $aria_current = ''; if ( $current_mode === $mode ) { $classes[] = 'current'; $aria_current = ' aria-current="page"'; } printf( "%s\n", esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ), implode( ' ', $classes ), $title ); } ?> -
            -
            %s', __( 'No comments' ) ); } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) { printf( '%s', $approved_comments_number, $pending_comments ? $approved_phrase : $approved_only_phrase ); } elseif ( $approved_comments ) { printf( '%s', esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'approved', ), admin_url( 'edit-comments.php' ) ) ), $approved_comments_number, $pending_comments ? $approved_phrase : $approved_only_phrase ); } else { printf( '%s', $approved_comments_number, $pending_comments ? __( 'No approved comments' ) : __( 'No comments' ) ); } if ( $pending_comments ) { printf( '%s', esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'moderated', ), admin_url( 'edit-comments.php' ) ) ), $pending_comments_number, $pending_phrase ); } else { printf( '%s', $pending_comments_number, $approved_comments ? __( 'No pending comments' ) : __( 'No comments' ) ); } } public function get_pagenum() { $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) { $pagenum = $this->_pagination_args['total_pages']; } return max( 1, $pagenum ); } protected function get_items_per_page( $option, $default_value = 20 ) { $per_page = (int) get_user_option( $option ); if ( empty( $per_page ) || $per_page < 1 ) { $per_page = $default_value; } return (int) apply_filters( "{$option}", $per_page ); } protected function pagination( $which ) { if ( empty( $this->_pagination_args ) ) { return; } $total_items = $this->_pagination_args['total_items']; $total_pages = $this->_pagination_args['total_pages']; $infinite_scroll = false; if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { $infinite_scroll = $this->_pagination_args['infinite_scroll']; } if ( 'top' === $which && $total_pages > 1 ) { $this->screen->render_screen_reader_content( 'heading_pagination' ); } $output = '' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . ''; $current = $this->get_pagenum(); $removable_query_args = wp_removable_query_args(); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = remove_query_arg( $removable_query_args, $current_url ); $page_links = array(); $total_pages_before = ''; $total_pages_after = ''; $disable_first = false; $disable_last = false; $disable_prev = false; $disable_next = false; if ( 1 == $current ) { $disable_first = true; $disable_prev = true; } if ( $total_pages == $current ) { $disable_last = true; $disable_next = true; } if ( $disable_first ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( remove_query_arg( 'paged', $current_url ) ), __( 'First page' ), '«' ); } if ( $disable_prev ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ), __( 'Previous page' ), '‹' ); } if ( 'bottom' === $which ) { $html_current_page = $current; $total_pages_before = '' . __( 'Current Page' ) . ''; } else { $html_current_page = sprintf( "%s", '', $current, strlen( $total_pages ) ); } $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after; if ( $disable_next ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ), __( 'Next page' ), '›' ); } if ( $disable_last ) { $page_links[] = ''; } else { $page_links[] = sprintf( "%s", esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), __( 'Last page' ), '»' ); } $pagination_links_class = 'pagination-links'; if ( ! empty( $infinite_scroll ) ) { $pagination_links_class .= ' hide-if-js'; } $output .= "\n" . implode( "\n", $page_links ) . ''; if ( $total_pages ) { $page_class = $total_pages < 2 ? ' one-page' : ''; } else { $page_class = ' no-pages'; } $this->_pagination = "
            $output
            "; echo $this->_pagination; } public function get_columns() { die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' ); } protected function get_sortable_columns() { return array(); } protected function get_default_primary_column_name() { $columns = $this->get_columns(); $column = ''; if ( empty( $columns ) ) { return $column; } foreach ( $columns as $col => $column_name ) { if ( 'cb' === $col ) { continue; } $column = $col; break; } return $column; } public function get_primary_column() { return $this->get_primary_column_name(); } protected function get_primary_column_name() { $columns = get_column_headers( $this->screen ); $default = $this->get_default_primary_column_name(); if ( ! isset( $columns[ $default ] ) ) { $default = self::get_default_primary_column_name(); } $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { $column = $default; } return $column; } protected function get_column_info() { if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) { $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); foreach ( $this->_column_headers as $key => $value ) { $column_headers[ $key ] = $value; } return $column_headers; } $columns = get_column_headers( $this->screen ); $hidden = get_hidden_columns( $this->screen ); $sortable_columns = $this->get_sortable_columns(); $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns ); $sortable = array(); foreach ( $_sortable as $id => $data ) { if ( empty( $data ) ) { continue; } $data = (array) $data; if ( ! isset( $data[1] ) ) { $data[1] = false; } $sortable[ $id ] = $data; } $primary = $this->get_primary_column_name(); $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); return $this->_column_headers; } public function get_column_count() { list ( $columns, $hidden ) = $this->get_column_info(); $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); return count( $columns ) - count( $hidden ); } public function print_column_headers( $with_id = true ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = remove_query_arg( 'paged', $current_url ); if ( isset( $_GET['orderby'] ) ) { $current_orderby = $_GET['orderby']; } else { $current_orderby = ''; } if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { $current_order = 'desc'; } else { $current_order = 'asc'; } if ( ! empty( $columns['cb'] ) ) { static $cb_counter = 1; $columns['cb'] = '' . ''; $cb_counter++; } foreach ( $columns as $column_key => $column_display_name ) { $class = array( 'manage-column', "column-$column_key" ); if ( in_array( $column_key, $hidden, true ) ) { $class[] = 'hidden'; } if ( 'cb' === $column_key ) { $class[] = 'check-column'; } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) { $class[] = 'num'; } if ( $column_key === $primary ) { $class[] = 'column-primary'; } if ( isset( $sortable[ $column_key ] ) ) { list( $orderby, $desc_first ) = $sortable[ $column_key ]; if ( $current_orderby === $orderby ) { $order = 'asc' === $current_order ? 'desc' : 'asc'; $class[] = 'sorted'; $class[] = $current_order; } else { $order = strtolower( $desc_first ); if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) { $order = $desc_first ? 'desc' : 'asc'; } $class[] = 'sortable'; $class[] = 'desc' === $order ? 'asc' : 'desc'; } $column_display_name = sprintf( '%s', esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ), $column_display_name ); } $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; $id = $with_id ? "id='$column_key'" : ''; if ( ! empty( $class ) ) { $class = "class='" . implode( ' ', $class ) . "'"; } echo "<$tag $scope $id $class>$column_display_name"; } } public function display() { $singular = $this->_args['singular']; $this->display_tablenav( 'top' ); $this->screen->render_screen_reader_content( 'heading_list' ); ?> - - - - print_column_headers(); ?> - - - - - > - display_rows_or_placeholder(); ?> - - - - - print_column_headers( false ); ?> - - - -
            - display_tablenav( 'bottom' ); } protected function get_table_classes() { $mode = get_user_setting( 'posts_list_mode', 'list' ); $mode_class = esc_attr( 'table-view-' . $mode ); return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] ); } protected function display_tablenav( $which ) { if ( 'top' === $which ) { wp_nonce_field( 'bulk-' . $this->_args['plural'] ); } ?> -
            - - has_items() ) : ?> -
            - bulk_actions( $which ); ?> -
            - extra_tablenav( $which ); $this->pagination( $which ); ?> - -
            -
            - has_items() ) { $this->display_rows(); } else { echo ''; $this->no_items(); echo ''; } } public function display_rows() { foreach ( $this->items as $item ) { $this->single_row( $item ); } } public function single_row( $item ) { echo ''; $this->single_row_columns( $item ); echo ''; } protected function column_default( $item, $column_name ) {} protected function column_cb( $item ) {} protected function single_row_columns( $item ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { $classes = "$column_name column-$column_name"; if ( $primary === $column_name ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"'; $attributes = "class='$classes' $data"; if ( 'cb' === $column_name ) { echo ''; echo $this->column_cb( $item ); echo ''; } elseif ( method_exists( $this, '_column_' . $column_name ) ) { echo call_user_func( array( $this, '_column_' . $column_name ), $item, $classes, $data, $primary ); } elseif ( method_exists( $this, 'column_' . $column_name ) ) { echo ""; echo call_user_func( array( $this, 'column_' . $column_name ), $item ); echo $this->handle_row_actions( $item, $column_name, $primary ); echo ''; } else { echo ""; echo $this->column_default( $item, $column_name ); echo $this->handle_row_actions( $item, $column_name, $primary ); echo ''; } } } protected function handle_row_actions( $item, $column_name, $primary ) { return $column_name === $primary ? '' : ''; } public function ajax_response() { $this->prepare_items(); ob_start(); if ( ! empty( $_REQUEST['no_placeholder'] ) ) { $this->display_rows(); } else { $this->display_rows_or_placeholder(); } $rows = ob_get_clean(); $response = array( 'rows' => $rows ); if ( isset( $this->_pagination_args['total_items'] ) ) { $response['total_items_i18n'] = sprintf( _n( '%s item', '%s items', $this->_pagination_args['total_items'] ), number_format_i18n( $this->_pagination_args['total_items'] ) ); } if ( isset( $this->_pagination_args['total_pages'] ) ) { $response['total_pages'] = $this->_pagination_args['total_pages']; $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] ); } die( wp_json_encode( $response ) ); } public function _js_vars() { $args = array( 'class' => get_class( $this ), 'screen' => array( 'id' => $this->screen->id, 'base' => $this->screen->base, ), ); printf( "\n", wp_json_encode( $args ) ); } } $text ) { $instructions[ $line ] = '# ' . $text; } $instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker ); if ( $switched_locale ) { restore_previous_locale(); } $insertion = array_merge( $instructions, $insertion ); $start_marker = "# BEGIN {$marker}"; $end_marker = "# END {$marker}"; $fp = fopen( $filename, 'r+' ); if ( ! $fp ) { return false; } flock( $fp, LOCK_EX ); $lines = array(); while ( ! feof( $fp ) ) { $lines[] = rtrim( fgets( $fp ), "\r\n" ); } $pre_lines = array(); $post_lines = array(); $existing_lines = array(); $found_marker = false; $found_end_marker = false; foreach ( $lines as $line ) { if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) { $found_marker = true; continue; } elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) { $found_end_marker = true; continue; } if ( ! $found_marker ) { $pre_lines[] = $line; } elseif ( $found_marker && $found_end_marker ) { $post_lines[] = $line; } else { $existing_lines[] = $line; } } if ( $existing_lines === $insertion ) { flock( $fp, LOCK_UN ); fclose( $fp ); return true; } $new_file_data = implode( "\n", array_merge( $pre_lines, array( $start_marker ), $insertion, array( $end_marker ), $post_lines ) ); fseek( $fp, 0 ); $bytes = fwrite( $fp, $new_file_data ); if ( $bytes ) { ftruncate( $fp, ftell( $fp ) ); } fflush( $fp ); flock( $fp, LOCK_UN ); fclose( $fp ); return (bool) $bytes; } function save_mod_rewrite_rules() { global $wp_rewrite; if ( is_multisite() ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $home_path = get_home_path(); $htaccess_file = $home_path . '.htaccess'; if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable( $htaccess_file ) ) { if ( got_mod_rewrite() ) { $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); return insert_with_markers( $htaccess_file, 'WordPress', $rules ); } } return false; } function iis7_save_url_rewrite_rules() { global $wp_rewrite; if ( is_multisite() ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $home_path = get_home_path(); $web_config_file = $home_path . 'web.config'; if ( iis7_supports_permalinks() && ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() || win_is_writable( $web_config_file ) ) ) { $rule = $wp_rewrite->iis7_url_rewrite_rules( false ); if ( ! empty( $rule ) ) { return iis7_add_rewrite_rule( $web_config_file, $rule ); } else { return iis7_delete_rewrite_rule( $web_config_file ); } } return false; } function update_recently_edited( $file ) { $oldfiles = (array) get_option( 'recently_edited' ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $oldfiles = array_reverse( $oldfiles ); $oldfiles = array_unique( $oldfiles ); if ( 5 < count( $oldfiles ) ) { array_pop( $oldfiles ); } } else { $oldfiles[] = $file; } update_option( 'recently_edited', $oldfiles ); } function wp_make_theme_file_tree( $allowed_files ) { $tree_list = array(); foreach ( $allowed_files as $file_name => $absolute_filename ) { $list = explode( '/', $file_name ); $last_dir = &$tree_list; foreach ( $list as $dir ) { $last_dir =& $last_dir[ $dir ]; } $last_dir = $file_name; } return $tree_list; } function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) { global $relative_file, $stylesheet; if ( is_array( $tree ) ) { $index = 0; $size = count( $tree ); foreach ( $tree as $label => $theme_file ) : $index++; if ( ! is_array( $theme_file ) ) { wp_print_theme_file_tree( $theme_file, $level, $index, $size ); continue; } ?> -
          • - -
            -
          • - rawurlencode( $tree ), 'theme' => rawurlencode( $stylesheet ), ), self_admin_url( 'theme-editor.php' ) ); ?> -
          • - - (' . esc_html( $filename ) . ')'; } if ( $relative_file === $filename ) { echo '' . $file_description . ''; } else { echo $file_description; } ?> - -
          • - $plugin_file ) : $index++; if ( ! is_array( $plugin_file ) ) { wp_print_plugin_file_tree( $plugin_file, $label, $level, $index, $size ); continue; } ?> -
          • - -
            -
          • - rawurlencode( $tree ), 'plugin' => rawurlencode( $plugin ), ), self_admin_url( 'plugin-editor.php' ) ); ?> -
          • - - ' . esc_html( $label ) . ''; } else { echo esc_html( $label ); } ?> - -
          • - get_error_data() && is_string( $message->get_error_data() ) ) { $message = $message->get_error_message() . ': ' . $message->get_error_data(); } else { $message = $message->get_error_message(); } } echo "

            $message

            \n"; wp_ob_end_flush_all(); flush(); } function wp_doc_link_parse( $content ) { if ( ! is_string( $content ) || empty( $content ) ) { return array(); } if ( ! function_exists( 'token_get_all' ) ) { return array(); } $tokens = token_get_all( $content ); $count = count( $tokens ); $functions = array(); $ignore_functions = array(); for ( $t = 0; $t < $count - 2; $t++ ) { if ( ! is_array( $tokens[ $t ] ) ) { continue; } if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) { if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR === $tokens[ $t - 1 ][0] ) ) { $ignore_functions[] = $tokens[ $t ][1]; } $functions[] = $tokens[ $t ][1]; } } $functions = array_unique( $functions ); sort( $functions ); $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); $ignore_functions = array_unique( $ignore_functions ); $out = array(); foreach ( $functions as $function ) { if ( in_array( $function, $ignore_functions, true ) ) { continue; } $out[] = $function; } return $out; } function set_screen_options() { if ( ! isset( $_POST['wp_screen_options'] ) || ! is_array( $_POST['wp_screen_options'] ) ) { return; } check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); $user = wp_get_current_user(); if ( ! $user ) { return; } $option = $_POST['wp_screen_options']['option']; $value = $_POST['wp_screen_options']['value']; if ( sanitize_key( $option ) !== $option ) { return; } $map_option = $option; $type = str_replace( 'edit_', '', $map_option ); $type = str_replace( '_per_page', '', $type ); if ( in_array( $type, get_taxonomies(), true ) ) { $map_option = 'edit_tags_per_page'; } elseif ( in_array( $type, get_post_types(), true ) ) { $map_option = 'edit_per_page'; } else { $option = str_replace( '-', '_', $option ); } switch ( $map_option ) { case 'edit_per_page': case 'users_per_page': case 'edit_comments_per_page': case 'upload_per_page': case 'edit_tags_per_page': case 'plugins_per_page': case 'export_personal_data_requests_per_page': case 'remove_personal_data_requests_per_page': case 'sites_network_per_page': case 'users_network_per_page': case 'site_users_network_per_page': case 'plugins_network_per_page': case 'themes_network_per_page': case 'site_themes_network_per_page': $value = (int) $value; if ( $value < 1 || $value > 999 ) { return; } break; default: $screen_option = false; if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) { $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); } $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value ); if ( false === $value ) { return; } break; } update_user_meta( $user->ID, $option, $value ); $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() ); if ( isset( $_POST['mode'] ) ) { $url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url ); } wp_safe_redirect( $url ); exit; } function iis7_rewrite_rule_exists( $filename ) { if ( ! file_exists( $filename ) ) { return false; } if ( ! class_exists( 'DOMDocument', false ) ) { return false; } $doc = new DOMDocument(); if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( 0 === $rules->length ) { return false; } return true; } function iis7_delete_rewrite_rule( $filename ) { if ( ! file_exists( $filename ) ) { return true; } if ( ! class_exists( 'DOMDocument', false ) ) { return false; } $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( $rules->length > 0 ) { $child = $rules->item( 0 ); $parent = $child->parentNode; $parent->removeChild( $child ); $doc->formatOutput = true; saveDomDocument( $doc, $filename ); } return true; } function iis7_add_rewrite_rule( $filename, $rewrite_rule ) { if ( ! class_exists( 'DOMDocument', false ) ) { return false; } if ( ! file_exists( $filename ) ) { $fp = fopen( $filename, 'w' ); fwrite( $fp, '' ); fclose( $fp ); } $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc->load( $filename ) === false ) { return false; } $xpath = new DOMXPath( $doc ); $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); if ( $wordpress_rules->length > 0 ) { return true; } $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' ); if ( $xml_nodes->length > 0 ) { $rules_node = $xml_nodes->item( 0 ); } else { $rules_node = $doc->createElement( 'rules' ); $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' ); if ( $xml_nodes->length > 0 ) { $rewrite_node = $xml_nodes->item( 0 ); $rewrite_node->appendChild( $rules_node ); } else { $rewrite_node = $doc->createElement( 'rewrite' ); $rewrite_node->appendChild( $rules_node ); $xml_nodes = $xpath->query( '/configuration/system.webServer' ); if ( $xml_nodes->length > 0 ) { $system_web_server_node = $xml_nodes->item( 0 ); $system_web_server_node->appendChild( $rewrite_node ); } else { $system_web_server_node = $doc->createElement( 'system.webServer' ); $system_web_server_node->appendChild( $rewrite_node ); $xml_nodes = $xpath->query( '/configuration' ); if ( $xml_nodes->length > 0 ) { $config_node = $xml_nodes->item( 0 ); $config_node->appendChild( $system_web_server_node ); } else { $config_node = $doc->createElement( 'configuration' ); $doc->appendChild( $config_node ); $config_node->appendChild( $system_web_server_node ); } } } } $rule_fragment = $doc->createDocumentFragment(); $rule_fragment->appendXML( $rewrite_rule ); $rules_node->appendChild( $rule_fragment ); $doc->encoding = 'UTF-8'; $doc->formatOutput = true; saveDomDocument( $doc, $filename ); return true; } function saveDomDocument( $doc, $filename ) { $config = $doc->saveXML(); $config = preg_replace( "/([^\r])\n/", "$1\r\n", $config ); $fp = fopen( $filename, 'w' ); fwrite( $fp, $config ); fclose( $fp ); } function admin_color_scheme_picker( $user_id ) { global $_wp_admin_css_colors; ksort( $_wp_admin_css_colors ); if ( isset( $_wp_admin_css_colors['fresh'] ) ) { $_wp_admin_css_colors = array_filter( array_merge( array( 'fresh' => '', 'light' => '', 'modern' => '', ), $_wp_admin_css_colors ) ); } $current_color = get_user_option( 'admin_color', $user_id ); if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) { $current_color = 'fresh'; } ?> -
            - - $color_info ) : ?> -
            - /> - - - - - - colors as $html_color ) { ?> - - - -
             
            -
            - -
            - icon_colors ) ) { $icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors; } elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) { $icon_colors = $_wp_admin_css_colors['fresh']->icon_colors; } else { $icon_colors = array( 'base' => '#a7aaad', 'focus' => '#72aee6', 'current' => '#fff', ); } echo '\n"; } function wp_admin_viewport_meta() { $viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' ); if ( empty( $viewport_meta ) ) { return; } echo ''; } function _customizer_mobile_viewport_meta( $viewport_meta ) { return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2'; } function wp_check_locked_posts( $response, $data, $screen_id ) { $checked = array(); if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { foreach ( $data['wp-check-locked-posts'] as $key ) { $post_id = absint( substr( $key, 5 ) ); if ( ! $post_id ) { continue; } $user_id = wp_check_post_lock( $post_id ); if ( $user_id ) { $user = get_userdata( $user_id ); if ( $user && current_user_can( 'edit_post', $post_id ) ) { $send = array( 'name' => $user->display_name, 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ), ); if ( get_option( 'show_avatars' ) ) { $send['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 18 ) ); $send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) ); } $checked[ $key ] = $send; } } } } if ( ! empty( $checked ) ) { $response['wp-check-locked-posts'] = $checked; } return $response; } function wp_refresh_post_lock( $response, $data, $screen_id ) { if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) { $received = $data['wp-refresh-post-lock']; $send = array(); $post_id = absint( $received['post_id'] ); if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $user_id = wp_check_post_lock( $post_id ); $user = get_userdata( $user_id ); if ( $user ) { $error = array( 'name' => $user->display_name, 'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ), ); if ( get_option( 'show_avatars' ) ) { $error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) ); $error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) ); } $send['lock_error'] = $error; } else { $new_lock = wp_set_post_lock( $post_id ); if ( $new_lock ) { $send['new_lock'] = implode( ':', $new_lock ); } } $response['wp-refresh-post-lock'] = $send; } return $response; } function wp_refresh_post_nonces( $response, $data, $screen_id ) { if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) { $received = $data['wp-refresh-post-nonces']; $response['wp-refresh-post-nonces'] = array( 'check' => 1 ); $post_id = absint( $received['post_id'] ); if ( ! $post_id ) { return $response; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $response; } $response['wp-refresh-post-nonces'] = array( 'replace' => array( 'getpermalinknonce' => wp_create_nonce( 'getpermalink' ), 'samplepermalinknonce' => wp_create_nonce( 'samplepermalink' ), 'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ), '_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ), '_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ), ), ); } return $response; } function wp_refresh_heartbeat_nonces( $response ) { $response['rest_nonce'] = wp_create_nonce( 'wp_rest' ); $response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' ); return $response; } function wp_heartbeat_set_suspension( $settings ) { global $pagenow; if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) { $settings['suspension'] = 'disable'; } return $settings; } function heartbeat_autosave( $response, $data ) { if ( ! empty( $data['wp_autosave'] ) ) { $saved = wp_autosave( $data['wp_autosave'] ); if ( is_wp_error( $saved ) ) { $response['wp_autosave'] = array( 'success' => false, 'message' => $saved->get_error_message(), ); } elseif ( empty( $saved ) ) { $response['wp_autosave'] = array( 'success' => false, 'message' => __( 'Error while saving.' ), ); } else { $draft_saved_date_format = __( 'g:i:s a' ); $response['wp_autosave'] = array( 'success' => true, 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ), ); } } return $response; } function wp_admin_canonical_url() { $removable_query_args = wp_removable_query_args(); if ( empty( $removable_query_args ) ) { return; } $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $filtered_url = remove_query_arg( $removable_query_args, $current_url ); ?> - - - - - $hash, 'newemail' => $value, ); update_option( 'adminhash', $new_admin_email ); $switched_locale = switch_to_locale( get_user_locale() ); $email_text = __( 'Howdy ###USERNAME###, - -Someone with administrator capabilities recently requested to have the -administration email address changed on this site: -###SITEURL### - -To confirm this change, please click on the following link: -###ADMIN_URL### - -You can safely ignore and delete this email if you do not want to -take this action. - -This email has been sent to ###EMAIL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); $current_user = wp_get_current_user(); $content = str_replace( '###USERNAME###', $current_user->user_login, $content ); $content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content ); $content = str_replace( '###EMAIL###', $value, $content ); $content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content ); $content = str_replace( '###SITEURL###', home_url(), $content ); if ( '' !== get_option( 'blogname' ) ) { $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); } wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), $site_title ), $content ); if ( $switched_locale ) { restore_previous_locale(); } } function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) { if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) { $title = sprintf( __( '%s (Draft)' ), $title ); } return $title; } function wp_check_php_version() { $version = phpversion(); $key = md5( $version ); $response = get_site_transient( 'php_check_' . $key ); if ( false === $response ) { $url = 'http://api.wordpress.org/core/serve-happy/1.0/'; if ( wp_http_supports( array( 'ssl' ) ) ) { $url = set_url_scheme( $url, 'https' ); } $url = add_query_arg( 'php_version', $version, $url ); $response = wp_remote_get( $url ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return false; } $response = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $response ) ) { return false; } set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS ); } if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) { $response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version ); } return $response; } options['context'] = $context; } ob_start(); $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership ); ob_end_clean(); return $result; } public function get_upgrade_messages() { return $this->messages; } public function feedback( $feedback, ...$args ) { if ( is_wp_error( $feedback ) ) { $string = $feedback->get_error_message(); } elseif ( is_array( $feedback ) ) { return; } else { $string = $feedback; } if ( ! empty( $this->upgrader->strings[ $string ] ) ) { $string = $this->upgrader->strings[ $string ]; } if ( strpos( $string, '%' ) !== false ) { if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } $string = trim( $string ); $string = wp_kses( $string, array( 'a' => array( 'href' => true, ), 'br' => true, 'em' => true, 'strong' => true, ) ); if ( empty( $string ) ) { return; } $this->messages[] = $string; } public function header() { ob_start(); } public function footer() { $output = ob_get_clean(); if ( ! empty( $output ) ) { $this->feedback( $output ); } } } method = 'ftpext'; $this->errors = new WP_Error(); if ( ! extension_loaded( 'ftp' ) ) { $this->errors->add( 'no_ftp_ext', __( 'The ftp PHP extension is not available' ) ); return; } if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 240 ); } if ( empty( $opt['port'] ) ) { $this->options['port'] = 21; } else { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } if ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); } else { $this->options['username'] = $opt['username']; } if ( empty( $opt['password'] ) ) { $this->errors->add( 'empty_password', __( 'FTP password is required' ) ); } else { $this->options['password'] = $opt['password']; } $this->options['ssl'] = false; if ( isset( $opt['connection_type'] ) && 'ftps' === $opt['connection_type'] ) { $this->options['ssl'] = true; } } public function connect() { if ( isset( $this->options['ssl'] ) && $this->options['ssl'] && function_exists( 'ftp_ssl_connect' ) ) { $this->link = @ftp_ssl_connect( $this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT ); } else { $this->link = @ftp_connect( $this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT ); } if ( ! $this->link ) { $this->errors->add( 'connect', sprintf( __( 'Failed to connect to FTP Server %s' ), $this->options['hostname'] . ':' . $this->options['port'] ) ); return false; } if ( ! @ftp_login( $this->link, $this->options['username'], $this->options['password'] ) ) { $this->errors->add( 'auth', sprintf( __( 'Username/Password incorrect for %s' ), $this->options['username'] ) ); return false; } ftp_pasv( $this->link, true ); if ( @ftp_get_option( $this->link, FTP_TIMEOUT_SEC ) < FS_TIMEOUT ) { @ftp_set_option( $this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT ); } return true; } public function get_contents( $file ) { $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'w+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } if ( ! ftp_fget( $this->link, $temphandle, $file, FTP_BINARY ) ) { fclose( $temphandle ); unlink( $tempfile ); return false; } fseek( $temphandle, 0 ); $contents = ''; while ( ! feof( $temphandle ) ) { $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); } fclose( $temphandle ); unlink( $tempfile ); return $contents; } public function get_contents_array( $file ) { return explode( "\n", $this->get_contents( $file ) ); } public function put_contents( $file, $contents, $mode = false ) { $tempfile = wp_tempnam( $file ); $temphandle = fopen( $tempfile, 'wb+' ); if ( ! $temphandle ) { unlink( $tempfile ); return false; } mbstring_binary_safe_encoding(); $data_length = strlen( $contents ); $bytes_written = fwrite( $temphandle, $contents ); reset_mbstring_encoding(); if ( $data_length !== $bytes_written ) { fclose( $temphandle ); unlink( $tempfile ); return false; } fseek( $temphandle, 0 ); $ret = ftp_fput( $this->link, $file, $temphandle, FTP_BINARY ); fclose( $temphandle ); unlink( $tempfile ); $this->chmod( $file, $mode ); return $ret; } public function cwd() { $cwd = ftp_pwd( $this->link ); if ( $cwd ) { $cwd = trailingslashit( $cwd ); } return $cwd; } public function chdir( $dir ) { return @ftp_chdir( $this->link, $dir ); } public function chmod( $file, $mode = false, $recursive = false ) { if ( ! $mode ) { if ( $this->is_file( $file ) ) { $mode = FS_CHMOD_FILE; } elseif ( $this->is_dir( $file ) ) { $mode = FS_CHMOD_DIR; } else { return false; } } if ( $recursive && $this->is_dir( $file ) ) { $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { $this->chmod( $file . '/' . $filename, $mode, $recursive ); } } if ( ! function_exists( 'ftp_chmod' ) ) { return (bool) ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) ); } return (bool) ftp_chmod( $this->link, $mode, $file ); } public function owner( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['owner']; } public function getchmod( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['permsn']; } public function group( $file ) { $dir = $this->dirlist( $file ); return $dir[ $file ]['group']; } public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $content = $this->get_contents( $source ); if ( false === $content ) { return false; } return $this->put_contents( $destination, $content, $mode ); } public function move( $source, $destination, $overwrite = false ) { return ftp_rename( $this->link, $source, $destination ); } public function delete( $file, $recursive = false, $type = false ) { if ( empty( $file ) ) { return false; } if ( 'f' === $type || $this->is_file( $file ) ) { return ftp_delete( $this->link, $file ); } if ( ! $recursive ) { return ftp_rmdir( $this->link, $file ); } $filelist = $this->dirlist( trailingslashit( $file ) ); if ( ! empty( $filelist ) ) { foreach ( $filelist as $delete_file ) { $this->delete( trailingslashit( $file ) . $delete_file['name'], $recursive, $delete_file['type'] ); } } return ftp_rmdir( $this->link, $file ); } public function exists( $file ) { $list = ftp_nlist( $this->link, $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; } return ! empty( $list ); } public function is_file( $file ) { return $this->exists( $file ) && ! $this->is_dir( $file ); } public function is_dir( $path ) { $cwd = $this->cwd(); $result = @ftp_chdir( $this->link, trailingslashit( $path ) ); if ( $result && $path === $this->cwd() || $this->cwd() !== $cwd ) { @ftp_chdir( $this->link, $cwd ); return true; } return false; } public function is_readable( $file ) { return true; } public function is_writable( $file ) { return true; } public function atime( $file ) { return false; } public function mtime( $file ) { return ftp_mdtm( $this->link, $file ); } public function size( $file ) { return ftp_size( $this->link, $file ); } public function touch( $file, $time = 0, $atime = 0 ) { return false; } public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { $path = untrailingslashit( $path ); if ( empty( $path ) ) { return false; } if ( ! ftp_mkdir( $this->link, $path ) ) { return false; } $this->chmod( $path, $chmod ); return true; } public function rmdir( $path, $recursive = false ) { return $this->delete( $path, $recursive ); } public function parselisting( $line ) { static $is_windows = null; if ( is_null( $is_windows ) ) { $is_windows = stripos( ftp_systype( $this->link ), 'win' ) !== false; } if ( $is_windows && preg_match( '/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/', $line, $lucifer ) ) { $b = array(); if ( $lucifer[3] < 70 ) { $lucifer[3] += 2000; } else { $lucifer[3] += 1900; } $b['isdir'] = ( '' === $lucifer[7] ); if ( $b['isdir'] ) { $b['type'] = 'd'; } else { $b['type'] = 'f'; } $b['size'] = $lucifer[7]; $b['month'] = $lucifer[1]; $b['day'] = $lucifer[2]; $b['year'] = $lucifer[3]; $b['hour'] = $lucifer[4]; $b['minute'] = $lucifer[5]; $b['time'] = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) === 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] ); $b['am/pm'] = $lucifer[6]; $b['name'] = $lucifer[8]; } elseif ( ! $is_windows ) { $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ); if ( $lucifer ) { $lcount = count( $lucifer ); if ( $lcount < 8 ) { return ''; } $b = array(); $b['isdir'] = 'd' === $lucifer[0][0]; $b['islink'] = 'l' === $lucifer[0][0]; if ( $b['isdir'] ) { $b['type'] = 'd'; } elseif ( $b['islink'] ) { $b['type'] = 'l'; } else { $b['type'] = 'f'; } $b['perms'] = $lucifer[0]; $b['permsn'] = $this->getnumchmodfromh( $b['perms'] ); $b['number'] = $lucifer[1]; $b['owner'] = $lucifer[2]; $b['group'] = $lucifer[3]; $b['size'] = $lucifer[4]; if ( 8 === $lcount ) { sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); $b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); $b['name'] = $lucifer[7]; } else { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) { $b['year'] = gmdate( 'Y' ); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { $b['year'] = $lucifer[7]; $b['hour'] = 0; $b['minute'] = 0; } $b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) ); $b['name'] = $lucifer[8]; } } } if ( isset( $b['islink'] ) && $b['islink'] ) { $b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] ); } return $b; } public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ) . '/'; } else { $limit_file = false; } $pwd = ftp_pwd( $this->link ); if ( ! @ftp_chdir( $this->link, $path ) ) { return false; } $list = ftp_rawlist( $this->link, '-a', false ); @ftp_chdir( $this->link, $pwd ); if ( empty( $list ) ) { return false; } $dirlist = array(); foreach ( $list as $k => $v ) { $entry = $this->parselisting( $v ); if ( empty( $entry ) ) { continue; } if ( '.' === $entry['name'] || '..' === $entry['name'] ) { continue; } if ( ! $include_hidden && '.' === $entry['name'][0] ) { continue; } if ( $limit_file && $entry['name'] !== $limit_file ) { continue; } $dirlist[ $entry['name'] ] = $entry; } $ret = array(); foreach ( (array) $dirlist as $struc ) { if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $struc['name'] ] = $struc; } return $ret; } public function __destruct() { if ( $this->link ) { ftp_close( $this->link ); } } } 'plugins', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); $allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' ); $status = 'all'; if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) { $status = $_REQUEST['plugin_status']; } if ( isset( $_REQUEST['s'] ) ) { $_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) ); } $page = $this->get_pagenum(); $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'plugin' ) && current_user_can( 'update_plugins' ) && ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) && ! in_array( $status, array( 'mustuse', 'dropins' ), true ); } protected function get_table_classes() { return array( 'widefat', $this->_args['plural'] ); } public function ajax_user_can() { return current_user_can( 'activate_plugins' ); } public function prepare_items() { global $status, $plugins, $totals, $page, $orderby, $order, $s; wp_reset_vars( array( 'orderby', 'order' ) ); $all_plugins = apply_filters( 'all_plugins', get_plugins() ); $plugins = array( 'all' => $all_plugins, 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array(), 'paused' => array(), ); if ( $this->show_autoupdates ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $plugins['auto-update-enabled'] = array(); $plugins['auto-update-disabled'] = array(); } $screen = $this->screen; if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { $plugins['mustuse'] = get_mu_plugins(); } if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { $plugins['dropins'] = get_dropins(); } if ( current_user_can( 'update_plugins' ) ) { $current = get_site_transient( 'update_plugins' ); foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { if ( isset( $current->response[ $plugin_file ] ) ) { $plugins['all'][ $plugin_file ]['update'] = true; $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; } } } } if ( ! $screen->in_admin( 'network' ) ) { $show = current_user_can( 'manage_network_plugins' ); $show_network_active = apply_filters( 'show_network_active_plugins', $show ); } if ( $screen->in_admin( 'network' ) ) { $recently_activated = get_site_option( 'recently_activated', array() ); } else { $recently_activated = get_option( 'recently_activated', array() ); } foreach ( $recently_activated as $key => $time ) { if ( $time + WEEK_IN_SECONDS < time() ) { unset( $recently_activated[ $key ] ); } } if ( $screen->in_admin( 'network' ) ) { update_site_option( 'recently_activated', $recently_activated ); } else { update_option( 'recently_activated', $recently_activated ); } $plugin_info = get_site_transient( 'update_plugins' ); foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { if ( isset( $plugin_info->response[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); } elseif ( empty( $plugin_data['update-supported'] ) ) { $plugin_data['update-supported'] = false; } $filter_payload = array( 'id' => $plugin_file, 'slug' => '', 'plugin' => $plugin_file, 'new_version' => '', 'url' => '', 'package' => '', 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'requires_php' => '', 'compatibility' => new stdClass(), ); $filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload ); if ( ! is_null( $auto_update_forced ) ) { $plugin_data['auto-update-forced'] = $auto_update_forced; } $plugins['all'][ $plugin_file ] = $plugin_data; if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { $plugins['upgrade'][ $plugin_file ] = $plugin_data; } if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { if ( $show_network_active ) { $plugins['inactive'][ $plugin_file ] = $plugin_data; } else { unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { if ( $show_network_active ) { $plugins['active'][ $plugin_file ] = $plugin_data; } else { unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { $plugins['active'][ $plugin_file ] = $plugin_data; if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) { $plugins['paused'][ $plugin_file ] = $plugin_data; } } else { if ( isset( $recently_activated[ $plugin_file ] ) ) { $plugins['recently_activated'][ $plugin_file ] = $plugin_data; } $plugins['inactive'][ $plugin_file ] = $plugin_data; } if ( $this->show_autoupdates ) { $enabled = in_array( $plugin_file, $auto_updates, true ) && $plugin_data['update-supported']; if ( isset( $plugin_data['auto-update-forced'] ) ) { $enabled = (bool) $plugin_data['auto-update-forced']; } if ( $enabled ) { $plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data; } else { $plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data; } } } if ( strlen( $s ) ) { $status = 'search'; $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); } $totals = array(); foreach ( $plugins as $type => $list ) { $totals[ $type ] = count( $list ); } if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } $this->items = array(); foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { $this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); } $total_this_page = $totals[ $status ]; $js_plugins = array(); foreach ( $plugins as $key => $list ) { $js_plugins[ $key ] = array_keys( $list ); } wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'plugins' => $js_plugins, 'totals' => wp_get_update_data(), ) ); if ( ! $orderby ) { $orderby = 'Name'; } else { $orderby = ucfirst( $orderby ); } $order = strtoupper( $order ); uasort( $this->items, array( $this, '_order_callback' ) ); $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); $start = ( $page - 1 ) * $plugins_per_page; if ( $total_this_page > $plugins_per_page ) { $this->items = array_slice( $this->items, $start, $plugins_per_page ); } $this->set_pagination_args( array( 'total_items' => $total_this_page, 'per_page' => $plugins_per_page, ) ); } public function _search_callback( $plugin ) { global $s; foreach ( $plugin as $value ) { if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { return true; } } return false; } public function _order_callback( $plugin_a, $plugin_b ) { global $orderby, $order; $a = $plugin_a[ $orderby ]; $b = $plugin_b[ $orderby ]; if ( $a === $b ) { return 0; } if ( 'DESC' === $order ) { return strcasecmp( $b, $a ); } else { return strcasecmp( $a, $b ); } } public function no_items() { global $plugins; if ( ! empty( $_REQUEST['s'] ) ) { $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); printf( __( 'No plugins found for: %s.' ), '' . $s . '' ); if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { echo ' ' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . ''; } } elseif ( ! empty( $plugins['all'] ) ) { _e( 'No plugins found.' ); } else { _e( 'No plugins are currently available.' ); } } public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { return; } $input_id = $input_id . '-search-input'; if ( ! empty( $_REQUEST['orderby'] ) ) { echo ''; } if ( ! empty( $_REQUEST['order'] ) ) { echo ''; } ?> - - ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '' : '', 'name' => __( 'Plugin' ), 'description' => __( 'Description' ), ); if ( $this->show_autoupdates ) { $columns['auto-updates'] = __( 'Automatic Updates' ); } return $columns; } protected function get_sortable_columns() { return array(); } protected function get_views() { global $totals, $status; $status_links = array(); foreach ( $totals as $type => $count ) { if ( ! $count ) { continue; } switch ( $type ) { case 'all': $text = _nx( 'All (%s)', 'All (%s)', $count, 'plugins' ); break; case 'active': $text = _n( 'Active (%s)', 'Active (%s)', $count ); break; case 'recently_activated': $text = _n( 'Recently Active (%s)', 'Recently Active (%s)', $count ); break; case 'inactive': $text = _n( 'Inactive (%s)', 'Inactive (%s)', $count ); break; case 'mustuse': $text = _n( 'Must-Use (%s)', 'Must-Use (%s)', $count ); break; case 'dropins': $text = _n( 'Drop-in (%s)', 'Drop-ins (%s)', $count ); break; case 'paused': $text = _n( 'Paused (%s)', 'Paused (%s)', $count ); break; case 'upgrade': $text = _n( 'Update Available (%s)', 'Update Available (%s)', $count ); break; case 'auto-update-enabled': $text = _n( 'Auto-updates Enabled (%s)', 'Auto-updates Enabled (%s)', $count ); break; case 'auto-update-disabled': $text = _n( 'Auto-updates Disabled (%s)', 'Auto-updates Disabled (%s)', $count ); break; } if ( 'search' !== $type ) { $status_links[ $type ] = sprintf( "%s", add_query_arg( 'plugin_status', $type, 'plugins.php' ), ( $type === $status ) ? ' class="current" aria-current="page"' : '', sprintf( $text, number_format_i18n( $count ) ) ); } } return $status_links; } protected function get_bulk_actions() { global $status; $actions = array(); if ( 'active' !== $status ) { $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); } if ( 'inactive' !== $status && 'recent' !== $status ) { $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); } if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) { if ( current_user_can( 'update_plugins' ) ) { $actions['update-selected'] = __( 'Update' ); } if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) { $actions['delete-selected'] = __( 'Delete' ); } if ( $this->show_autoupdates ) { if ( 'auto-update-enabled' !== $status ) { $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' ); } if ( 'auto-update-disabled' !== $status ) { $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' ); } } } return $actions; } public function bulk_actions( $which = '' ) { global $status; if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } parent::bulk_actions( $which ); } protected function extra_tablenav( $which ) { global $status; if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) { return; } echo '
            '; if ( 'recently_activated' === $status ) { submit_button( __( 'Clear List' ), '', 'clear-recent-list', false ); } elseif ( 'top' === $which && 'mustuse' === $status ) { echo '

            ' . sprintf( __( 'Files in the %s directory are executed automatically.' ), '' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '' ) . '

            '; } elseif ( 'top' === $which && 'dropins' === $status ) { echo '

            ' . sprintf( __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), '' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '' ) . '

            '; } echo '
            '; } public function current_action() { if ( isset( $_POST['clear-recent-list'] ) ) { return 'clear-recent-list'; } return parent::current_action(); } public function display_rows() { global $status; if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } foreach ( $this->items as $plugin_file => $plugin_data ) { $this->single_row( array( $plugin_file, $plugin_data ) ); } } public function single_row( $item ) { global $status, $page, $s, $totals; static $plugin_id_attrs = array(); list( $plugin_file, $plugin_data ) = $item; $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] ); $plugin_id_attr = $plugin_slug; $suffix = 2; while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) { $plugin_id_attr = "$plugin_slug-$suffix"; $suffix++; } $plugin_id_attrs[] = $plugin_id_attr; $context = $status; $screen = $this->screen; $actions = array( 'deactivate' => '', 'activate' => '', 'details' => '', 'delete' => '', ); $restrict_network_active = false; $restrict_network_only = false; $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null; $requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null; $compatible_php = is_php_version_compatible( $requires_php ); $compatible_wp = is_wp_version_compatible( $requires_wp ); if ( 'mustuse' === $context ) { $is_active = true; } elseif ( 'dropins' === $context ) { $dropins = _get_dropins(); $plugin_name = $plugin_file; if ( $plugin_file !== $plugin_data['Name'] ) { $plugin_name .= '
            ' . $plugin_data['Name']; } if ( true === ( $dropins[ $plugin_file ][1] ) ) { $is_active = true; $description = '

            ' . $dropins[ $plugin_file ][0] . '

            '; } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { $is_active = true; $description = '

            ' . $dropins[ $plugin_file ][0] . '

            '; } else { $is_active = false; $description = '

            ' . $dropins[ $plugin_file ][0] . ' ' . __( 'Inactive:' ) . ' ' . sprintf( __( 'Requires %1$s in %2$s file.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);", 'wp-config.php' ) . '

            '; } if ( $plugin_data['Description'] ) { $description .= '

            ' . $plugin_data['Description'] . '

            '; } } else { if ( $screen->in_admin( 'network' ) ) { $is_active = is_plugin_active_for_network( $plugin_file ); } else { $is_active = is_plugin_active( $plugin_file ); $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); } if ( $screen->in_admin( 'network' ) ) { if ( $is_active ) { if ( current_user_can( 'manage_network_plugins' ) ) { $actions['deactivate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Network Deactivate' ) ); } } else { if ( current_user_can( 'manage_network_plugins' ) ) { if ( $compatible_php && $compatible_wp ) { $actions['activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Network Activate' ) ); } else { $actions['activate'] = sprintf( '%s', _x( 'Cannot Activate', 'plugin' ) ); } } if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Delete' ) ); } } } else { if ( $restrict_network_active ) { $actions = array( 'network_active' => __( 'Network Active' ), ); } elseif ( $restrict_network_only ) { $actions = array( 'network_only' => __( 'Network Only' ), ); } elseif ( $is_active ) { if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { $actions['deactivate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Deactivate' ) ); } if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) { $actions['resume'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Resume' ) ); } } else { if ( current_user_can( 'activate_plugin', $plugin_file ) ) { if ( $compatible_php && $compatible_wp ) { $actions['activate'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Activate' ) ); } else { $actions['activate'] = sprintf( '%s', _x( 'Cannot Activate', 'plugin' ) ); } } if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { $actions['delete'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), esc_attr( $plugin_id_attr ), esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), __( 'Delete' ) ); } } } } $actions = array_filter( $actions ); if ( $screen->in_admin( 'network' ) ) { $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); } else { $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); } $class = $is_active ? 'active' : 'inactive'; $checkbox_id = 'checkbox_' . md5( $plugin_file ); if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { $checkbox = ''; } else { $checkbox = sprintf( '' . '', $checkbox_id, sprintf( __( 'Select %s' ), $plugin_data['Name'] ), esc_attr( $plugin_file ) ); } if ( 'dropins' !== $context ) { $description = '

            ' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '

            '; $plugin_name = $plugin_data['Name']; } if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) || ! $compatible_php || ! $compatible_wp ) { $class .= ' update'; } $paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ); if ( $paused ) { $class .= ' paused'; } if ( is_uninstallable_plugin( $plugin_file ) ) { $class .= ' is-uninstallable'; } printf( '', esc_attr( $class ), esc_attr( $plugin_slug ), esc_attr( $plugin_file ) ); list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); $available_updates = get_site_transient( 'update_plugins' ); foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; if ( in_array( $column_name, $hidden, true ) ) { $extra_classes = ' hidden'; } switch ( $column_name ) { case 'cb': echo "$checkbox"; break; case 'name': echo "$plugin_name"; echo $this->row_actions( $actions, true ); echo ''; break; case 'description': $classes = 'column-description desc'; echo " -
            $description
            -
            "; $plugin_meta = array(); if ( ! empty( $plugin_data['Version'] ) ) { $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); } if ( ! empty( $plugin_data['Author'] ) ) { $author = $plugin_data['Author']; if ( ! empty( $plugin_data['AuthorURI'] ) ) { $author = '' . $plugin_data['Author'] . ''; } $plugin_meta[] = sprintf( __( 'By %s' ), $author ); } if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { $plugin_meta[] = sprintf( '%s', esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550' ) ), esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), esc_attr( $plugin_name ), __( 'View details' ) ); } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { $aria_label = sprintf( __( 'Visit plugin site for %s' ), $plugin_name ); $plugin_meta[] = sprintf( '%s', esc_url( $plugin_data['PluginURI'] ), esc_attr( $aria_label ), __( 'Visit plugin site' ) ); } $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); echo implode( ' | ', $plugin_meta ); echo '
            '; if ( $paused ) { $notice_text = __( 'This plugin failed to load properly and is paused during recovery mode.' ); printf( '

            %s

            ', $notice_text ); $error = wp_get_plugin_error( $plugin_file ); if ( false !== $error ) { printf( '

            %s

            ', wp_get_extension_error_description( $error ) ); } } echo ''; break; case 'auto-updates': if ( ! $this->show_autoupdates ) { break; } echo ""; $html = array(); if ( isset( $plugin_data['auto-update-forced'] ) ) { if ( $plugin_data['auto-update-forced'] ) { $text = __( 'Auto-updates enabled' ); } else { $text = __( 'Auto-updates disabled' ); } $action = 'unavailable'; $time_class = ' hidden'; } elseif ( empty( $plugin_data['update-supported'] ) ) { $text = ''; $action = 'unavailable'; $time_class = ' hidden'; } elseif ( in_array( $plugin_file, $auto_updates, true ) ) { $text = __( 'Disable auto-updates' ); $action = 'disable'; $time_class = ''; } else { $text = __( 'Enable auto-updates' ); $action = 'enable'; $time_class = ' hidden'; } $query_args = array( 'action' => "{$action}-auto-update", 'plugin' => $plugin_file, 'paged' => $page, 'plugin_status' => $status, ); $url = add_query_arg( $query_args, 'plugins.php' ); if ( 'unavailable' === $action ) { $html[] = '' . $text . ''; } else { $html[] = sprintf( '', wp_nonce_url( $url, 'updates' ), $action ); $html[] = ''; $html[] = '' . $text . ''; $html[] = ''; } if ( ! empty( $plugin_data['update'] ) ) { $html[] = sprintf( '
            %s
            ', $time_class, wp_get_auto_update_message() ); } $html = implode( '', $html ); echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data ); echo ''; echo ''; break; default: $classes = "$column_name column-$column_name $class"; echo ""; do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); echo ''; } } echo ''; if ( ! $compatible_php || ! $compatible_wp ) { printf( '' . '' . '

            ', esc_attr( $this->get_column_count() ) ); if ( ! $compatible_php && ! $compatible_wp ) { _e( 'This plugin does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } elseif ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } } elseif ( ! $compatible_wp ) { _e( 'This plugin does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { printf( ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { _e( 'This plugin does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { printf( ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); wp_update_php_annotation( '

            ', '' ); } } echo '

            '; } do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); } protected function get_primary_column_name() { return 'name'; } } detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); $this->modes = array( 'list' => __( 'List view' ), 'grid' => __( 'Grid view' ), ); parent::__construct( array( 'plural' => 'media', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } public function ajax_user_can() { return current_user_can( 'upload_files' ); } public function prepare_items() { global $mode, $wp_query, $post_mime_types, $avail_post_mime_types; $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; $not_in = array(); $crons = _get_cron_array(); if ( is_array( $crons ) ) { foreach ( $crons as $cron ) { if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { $details = reset( $cron['upgrader_scheduled_cleanup'] ); if ( ! empty( $details['args'][0] ) ) { $not_in[] = (int) $details['args'][0]; } } } } if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { $not_in = array_merge( array_values( $_REQUEST['post__not_in'] ), $not_in ); } if ( ! empty( $not_in ) ) { $_REQUEST['post__not_in'] = $not_in; } list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter']; $this->set_pagination_args( array( 'total_items' => $wp_query->found_posts, 'total_pages' => $wp_query->max_num_pages, 'per_page' => $wp_query->query_vars['posts_per_page'], ) ); } protected function get_views() { global $post_mime_types, $avail_post_mime_types; $type_links = array(); $filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter']; $type_links['all'] = sprintf( '', selected( $filter, true, false ), __( 'All media items' ) ); foreach ( $post_mime_types as $mime_type => $label ) { if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; } $selected = selected( $filter && 0 === strpos( $filter, 'post_mime_type:' ) && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), true, false ); $type_links[ $mime_type ] = sprintf( '', esc_attr( $mime_type ), $selected, $label[0] ); } $type_links['detached'] = ''; $type_links['mine'] = sprintf( '', selected( 'mine' === $filter, true, false ), _x( 'Mine', 'media items' ) ); if ( $this->is_trash || ( defined( 'MEDIA_TRASH' ) && MEDIA_TRASH ) ) { $type_links['trash'] = sprintf( '', selected( 'trash' === $filter, true, false ), _x( 'Trash', 'attachment filter' ) ); } return $type_links; } protected function get_bulk_actions() { $actions = array(); if ( MEDIA_TRASH ) { if ( $this->is_trash ) { $actions['untrash'] = __( 'Restore' ); $actions['delete'] = __( 'Delete permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } } else { $actions['delete'] = __( 'Delete permanently' ); } if ( $this->detached ) { $actions['attach'] = __( 'Attach' ); } return $actions; } protected function extra_tablenav( $which ) { if ( 'bar' !== $which ) { return; } ?> -
            - is_trash ) { $this->months_dropdown( 'attachment' ); } do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); if ( $this->is_trash && $this->has_items() && current_user_can( 'edit_others_posts' ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> -
            - is_trash ) { _e( 'No media files found in Trash.' ); } else { _e( 'No media files found.' ); } } public function views() { global $mode; $views = $this->get_views(); $this->screen->render_screen_reader_content( 'heading_views' ); ?> -
            -
            - view_switcher( $mode ); ?> - - - - - extra_tablenav( 'bar' ); $views = apply_filters( "views_{$this->screen->id}", array() ); if ( ! empty( $views ) ) { echo ''; } ?> -
            - -
            - - -
            -
            - '; $posts_columns['title'] = _x( 'File', 'column name' ); $posts_columns['author'] = __( 'Author' ); $taxonomies = get_taxonomies_for_attachments( 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); foreach ( $taxonomies as $taxonomy ) { if ( 'category' === $taxonomy ) { $column_key = 'categories'; } elseif ( 'post_tag' === $taxonomy ) { $column_key = 'tags'; } else { $column_key = 'taxonomy-' . $taxonomy; } $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; } if ( ! $this->detached ) { $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); if ( post_type_supports( 'attachment', 'comments' ) ) { $posts_columns['comments'] = '' . __( 'Comments' ) . ''; } } $posts_columns['date'] = _x( 'Date', 'column name' ); return apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); } protected function get_sortable_columns() { return array( 'title' => 'title', 'author' => 'author', 'parent' => 'parent', 'comments' => 'comment_count', 'date' => array( 'date', true ), ); } public function column_cb( $item ) { $post = $item; if ( current_user_can( 'edit_post', $post->ID ) ) { ?> - - - post_mime_type ); $title = _draft_or_post_title(); $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); $link_start = ''; $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { $link_start = sprintf( '', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) ); $link_end = ''; } $class = $thumb ? ' class="has-media-icon"' : ''; ?> - > - - - - -

            - - ID ); echo esc_html( wp_basename( $file ) ); ?> -

            - %s', esc_url( add_query_arg( array( 'author' => get_the_author_meta( 'ID' ) ), 'upload.php' ) ), get_the_author() ); } public function column_desc( $post ) { echo has_excerpt() ? $post->post_excerpt : ''; } public function column_date( $post ) { if ( '0000-00-00 00:00:00' === $post->post_date ) { $h_time = __( 'Unpublished' ); } else { $time = get_post_timestamp( $post ); $time_diff = time() - $time; if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); } else { $h_time = get_the_time( __( 'Y/m/d' ), $post ); } } echo apply_filters( 'media_date_column_time', $h_time, $post, 'date' ); } public function column_parent( $post ) { $user_can_edit = current_user_can( 'edit_post', $post->ID ); if ( $post->post_parent > 0 ) { $parent = get_post( $post->post_parent ); } else { $parent = false; } if ( $parent ) { $title = _draft_or_post_title( $post->post_parent ); $parent_type = get_post_type_object( $parent->post_type ); if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { printf( '%s', get_edit_post_link( $post->post_parent ), $title ); } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) { printf( '%s', $title ); } else { _e( '(Private post)' ); } if ( $user_can_edit ) : $detach_url = add_query_arg( array( 'parent_post_id' => $post->post_parent, 'media[]' => $post->ID, '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ), ), 'upload.php' ); printf( '
            %s', $detach_url, esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ), __( 'Detach' ) ); endif; } else { _e( '(Unattached)' ); ?> - post_parent ); printf( '
            %s', $post->ID, esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ), __( 'Attach' ) ); } } } public function column_comments( $post ) { echo '
            '; if ( isset( $this->comment_pending_count[ $post->ID ] ) ) { $pending_comments = $this->comment_pending_count[ $post->ID ]; } else { $pending_comments = get_pending_comments_num( $post->ID ); } $this->comments_bubble( $post->ID, $pending_comments ); echo '
            '; } public function column_default( $item, $column_name ) { $post = $item; if ( 'categories' === $column_name ) { $taxonomy = 'category'; } elseif ( 'tags' === $column_name ) { $taxonomy = 'post_tag'; } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { $taxonomy = substr( $column_name, 9 ); } else { $taxonomy = false; } if ( $taxonomy ) { $terms = get_the_terms( $post->ID, $taxonomy ); if ( is_array( $terms ) ) { $out = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; $out[] = sprintf( '%s', esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) ); } echo implode( wp_get_list_item_separator(), $out ); } else { echo '' . get_taxonomy( $taxonomy )->labels->no_terms . ''; } return; } do_action( 'manage_media_custom_column', $column_name, $post->ID ); } public function display_rows() { global $post, $wp_query; $post_ids = wp_list_pluck( $wp_query->posts, 'ID' ); reset( $wp_query->posts ); $this->comment_pending_count = get_pending_comments_num( $post_ids ); add_filter( 'the_title', 'esc_html' ); while ( have_posts() ) : the_post(); if ( $this->is_trash && 'trash' !== $post->post_status || ! $this->is_trash && 'trash' === $post->post_status ) { continue; } $post_owner = ( get_current_user_id() === (int) $post->post_author ) ? 'self' : 'other'; ?> - - single_row_columns( $post ); ?> - - detached ) { if ( current_user_can( 'edit_post', $post->ID ) ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), __( 'Edit' ) ); } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { $actions['trash'] = sprintf( '%s', wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), _x( 'Trash', 'verb' ) ); } else { $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), $delete_ays, esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), __( 'Delete Permanently' ) ); } } $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), __( 'View' ) ); if ( current_user_can( 'edit_post', $post->ID ) ) { $actions['attach'] = sprintf( '%s', $post->ID, esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ), __( 'Attach' ) ); } } else { if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { $actions['edit'] = sprintf( '%s', get_edit_post_link( $post->ID ), esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), __( 'Edit' ) ); } if ( current_user_can( 'delete_post', $post->ID ) ) { if ( $this->is_trash ) { $actions['untrash'] = sprintf( '%s', wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ), esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ), __( 'Restore' ) ); } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { $actions['trash'] = sprintf( '%s', wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), _x( 'Trash', 'verb' ) ); } if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) { $delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; $actions['delete'] = sprintf( '%s', wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), $delete_ays, esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), __( 'Delete Permanently' ) ); } } if ( ! $this->is_trash ) { $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), __( 'View' ) ); $actions['copy'] = sprintf( '', esc_url( wp_get_attachment_url( $post->ID ) ), esc_attr( sprintf( __( 'Copy “%s” URL to clipboard' ), $att_title ) ), __( 'Copy URL to clipboard' ), __( 'Copied!' ) ); } } return apply_filters( 'media_row_actions', $actions, $post, $this->detached ); } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } $att_title = _draft_or_post_title(); $actions = $this->_get_row_actions( $item, $att_title ); return $this->row_actions( $actions ); } } ID ); $url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url ); $size = wp_getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $attachment = array( 'ID' => $parent_attachment_id, 'post_title' => wp_basename( $cropped ), 'post_content' => $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'site-icon', ); return $attachment; } public function insert_attachment( $attachment, $file ) { $attachment_id = wp_insert_attachment( $attachment, $file ); $metadata = wp_generate_attachment_metadata( $attachment_id, $file ); $metadata = apply_filters( 'site_icon_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); return $attachment_id; } public function additional_sizes( $sizes = array() ) { $only_crop_sizes = array(); $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes ); natsort( $this->site_icon_sizes ); $this->site_icon_sizes = array_reverse( $this->site_icon_sizes ); foreach ( $sizes as $name => $size_array ) { if ( isset( $size_array['crop'] ) ) { $only_crop_sizes[ $name ] = $size_array; } } foreach ( $this->site_icon_sizes as $size ) { if ( $size < $this->min_size ) { $only_crop_sizes[ 'site_icon-' . $size ] = array( 'width ' => $size, 'height' => $size, 'crop' => true, ); } } return $only_crop_sizes; } public function intermediate_image_sizes( $sizes = array() ) { $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes ); foreach ( $this->site_icon_sizes as $size ) { $sizes[] = 'site_icon-' . $size; } return $sizes; } public function delete_attachment_data( $post_id ) { $site_icon_id = get_option( 'site_icon' ); if ( $site_icon_id && $post_id == $site_icon_id ) { delete_option( 'site_icon' ); } } public function get_post_metadata( $value, $post_id, $meta_key, $single ) { if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) { $site_icon_id = get_option( 'site_icon' ); if ( $post_id == $site_icon_id ) { add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) ); } } return $value; } } '', 'theme' => '', 'nonce' => '', 'title' => __( 'Update Theme' ), ); $args = wp_parse_args( $args, $defaults ); $this->theme = $args['theme']; parent::__construct( $args ); } public function after() { $this->decrement_update_count( 'theme' ); $update_actions = array(); $theme_info = $this->upgrader->theme_info(); if ( $theme_info ) { $name = $theme_info->display( 'Name' ); $stylesheet = $this->upgrader->result['destination_name']; $template = $theme_info->get_template(); $activate_link = add_query_arg( array( 'action' => 'activate', 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), ), admin_url( 'themes.php' ) ); $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); $customize_url = add_query_arg( array( 'theme' => urlencode( $stylesheet ), 'return' => urlencode( admin_url( 'themes.php' ) ), ), admin_url( 'customize.php' ) ); if ( get_stylesheet() === $stylesheet ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $update_actions['preview'] = sprintf( '' . '%s', esc_url( $customize_url ), __( 'Customize' ), sprintf( __( 'Customize “%s”' ), $name ) ); } } elseif ( current_user_can( 'switch_themes' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $update_actions['preview'] = sprintf( '' . '%s', esc_url( $customize_url ), __( 'Live Preview' ), sprintf( __( 'Live Preview “%s”' ), $name ) ); } $update_actions['activate'] = sprintf( '' . '%s', esc_url( $activate_link ), __( 'Activate' ), sprintf( _x( 'Activate “%s”', 'theme' ), $name ) ); } if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) { unset( $update_actions['preview'], $update_actions['activate'] ); } } $update_actions['themes_page'] = sprintf( '%s', self_admin_url( 'themes.php' ), __( 'Go to Themes page' ) ); $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme ); if ( ! empty( $update_actions ) ) { $this->feedback( implode( ' | ', (array) $update_actions ) ); } } } crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs ); if ( is_wp_error( $src ) ) { return $src; } if ( ! $dst_file ) { $dst_file = str_replace( wp_basename( $src_file ), 'cropped-' . wp_basename( $src_file ), $src_file ); } wp_mkdir_p( dirname( $dst_file ) ); $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) ); $result = $editor->save( $dst_file ); if ( is_wp_error( $result ) ) { return $result; } if ( ! empty( $result['path'] ) ) { return $result['path']; } return $dst_file; } function wp_get_missing_image_subsizes( $attachment_id ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return array(); } $registered_sizes = wp_get_registered_image_subsizes(); $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $image_meta ) ) { return $registered_sizes; } if ( ! empty( $image_meta['original_image'] ) ) { $image_file = wp_get_original_image_path( $attachment_id ); $imagesize = wp_getimagesize( $image_file ); } if ( ! empty( $imagesize ) ) { $full_width = $imagesize[0]; $full_height = $imagesize[1]; } else { $full_width = (int) $image_meta['width']; $full_height = (int) $image_meta['height']; } $possible_sizes = array(); foreach ( $registered_sizes as $size_name => $size_data ) { if ( image_resize_dimensions( $full_width, $full_height, $size_data['width'], $size_data['height'], $size_data['crop'] ) ) { $possible_sizes[ $size_name ] = $size_data; } } if ( empty( $image_meta['sizes'] ) ) { $image_meta['sizes'] = array(); } $missing_sizes = array_diff_key( $possible_sizes, $image_meta['sizes'] ); return apply_filters( 'wp_get_missing_image_subsizes', $missing_sizes, $image_meta, $attachment_id ); } function wp_update_image_subsizes( $attachment_id ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); $image_file = wp_get_original_image_path( $attachment_id ); if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { if ( ! empty( $image_file ) ) { $image_meta = wp_create_image_subsizes( $image_file, $attachment_id ); } else { return new WP_Error( 'invalid_attachment', __( 'The attached file cannot be found.' ) ); } } else { $missing_sizes = wp_get_missing_image_subsizes( $attachment_id ); if ( empty( $missing_sizes ) ) { return $image_meta; } $image_meta = _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id ); } $image_meta = apply_filters( 'wp_generate_attachment_metadata', $image_meta, $attachment_id, 'update' ); wp_update_attachment_metadata( $attachment_id, $image_meta ); return $image_meta; } function _wp_image_meta_replace_original( $saved_data, $original_file, $image_meta, $attachment_id ) { $new_file = $saved_data['path']; update_attached_file( $attachment_id, $new_file ); $image_meta['width'] = $saved_data['width']; $image_meta['height'] = $saved_data['height']; $image_meta['file'] = _wp_relative_upload_path( $new_file ); $image_meta['original_image'] = wp_basename( $original_file ); $image_meta['filesize'] = wp_filesize( $new_file ); return $image_meta; } function wp_create_image_subsizes( $file, $attachment_id ) { $imagesize = wp_getimagesize( $file ); if ( empty( $imagesize ) ) { return array(); } $image_meta = array( 'width' => $imagesize[0], 'height' => $imagesize[1], 'file' => _wp_relative_upload_path( $file ), 'filesize' => wp_filesize( $file ), 'sizes' => array(), ); $exif_meta = wp_read_image_metadata( $file ); if ( $exif_meta ) { $image_meta['image_meta'] = $exif_meta; } if ( 'image/png' !== $imagesize['mime'] ) { $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id ); if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } $resized = $editor->resize( $threshold, $threshold ); $rotated = null; if ( ! is_wp_error( $resized ) && is_array( $exif_meta ) ) { $resized = $editor->maybe_exif_rotate(); $rotated = $resized; } if ( ! is_wp_error( $resized ) ) { $saved = $editor->save( $editor->generate_filename( 'scaled' ) ); if ( ! is_wp_error( $saved ) ) { $image_meta = _wp_image_meta_replace_original( $saved, $file, $image_meta, $attachment_id ); if ( true === $rotated && ! empty( $image_meta['image_meta']['orientation'] ) ) { $image_meta['image_meta']['orientation'] = 1; } } else { } } else { } } elseif ( ! empty( $exif_meta['orientation'] ) && 1 !== (int) $exif_meta['orientation'] ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } $rotated = $editor->maybe_exif_rotate(); if ( true === $rotated ) { $saved = $editor->save( $editor->generate_filename( 'rotated' ) ); if ( ! is_wp_error( $saved ) ) { $image_meta = _wp_image_meta_replace_original( $saved, $file, $image_meta, $attachment_id ); if ( ! empty( $image_meta['image_meta']['orientation'] ) ) { $image_meta['image_meta']['orientation'] = 1; } } else { } } } } wp_update_attachment_metadata( $attachment_id, $image_meta ); $new_sizes = wp_get_registered_image_subsizes(); $new_sizes = apply_filters( 'intermediate_image_sizes_advanced', $new_sizes, $image_meta, $attachment_id ); return _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ); } function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) { if ( empty( $image_meta ) || ! is_array( $image_meta ) ) { return array(); } if ( isset( $image_meta['sizes'] ) && is_array( $image_meta['sizes'] ) ) { foreach ( $image_meta['sizes'] as $size_name => $size_meta ) { if ( array_key_exists( $size_name, $new_sizes ) ) { unset( $new_sizes[ $size_name ] ); } } } else { $image_meta['sizes'] = array(); } if ( empty( $new_sizes ) ) { return $image_meta; } $priority = array( 'medium' => null, 'large' => null, 'thumbnail' => null, 'medium_large' => null, ); $new_sizes = array_filter( array_merge( $priority, $new_sizes ) ); $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) { return $image_meta; } if ( ! empty( $image_meta['image_meta'] ) ) { $rotated = $editor->maybe_exif_rotate(); if ( is_wp_error( $rotated ) ) { } } if ( method_exists( $editor, 'make_subsize' ) ) { foreach ( $new_sizes as $new_size_name => $new_size_data ) { $new_size_meta = $editor->make_subsize( $new_size_data ); if ( is_wp_error( $new_size_meta ) ) { } else { $image_meta['sizes'][ $new_size_name ] = $new_size_meta; wp_update_attachment_metadata( $attachment_id, $image_meta ); } } } else { $created_sizes = $editor->multi_resize( $new_sizes ); if ( ! empty( $created_sizes ) ) { $image_meta['sizes'] = array_merge( $image_meta['sizes'], $created_sizes ); wp_update_attachment_metadata( $attachment_id, $image_meta ); } } return $image_meta; } function wp_generate_attachment_metadata( $attachment_id, $file ) { $attachment = get_post( $attachment_id ); $metadata = array(); $support = false; $mime_type = get_post_mime_type( $attachment ); if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) { $metadata = wp_create_image_subsizes( $file, $attachment_id ); } elseif ( wp_attachment_is( 'video', $attachment ) ) { $metadata = wp_read_video_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' ); } elseif ( wp_attachment_is( 'audio', $attachment ) ) { $metadata = wp_read_audio_metadata( $file ); $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' ); } if ( ! is_array( $metadata ) ) { $metadata = array(); } if ( $support && ! empty( $metadata['image']['data'] ) ) { $hash = md5( $metadata['image']['data'] ); $posts = get_posts( array( 'fields' => 'ids', 'post_type' => 'attachment', 'post_mime_type' => $metadata['image']['mime'], 'post_status' => 'inherit', 'posts_per_page' => 1, 'meta_key' => '_cover_hash', 'meta_value' => $hash, ) ); $exists = reset( $posts ); if ( ! empty( $exists ) ) { update_post_meta( $attachment_id, '_thumbnail_id', $exists ); } else { $ext = '.jpg'; switch ( $metadata['image']['mime'] ) { case 'image/gif': $ext = '.gif'; break; case 'image/png': $ext = '.png'; break; case 'image/webp': $ext = '.webp'; break; } $basename = str_replace( '.', '-', wp_basename( $file ) ) . '-image' . $ext; $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); if ( false === $uploaded['error'] ) { $image_attachment = array( 'post_mime_type' => $metadata['image']['mime'], 'post_type' => 'attachment', 'post_content' => '', ); $image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded ); $sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] ); add_post_meta( $sub_attachment_id, '_cover_hash', $hash ); $attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] ); wp_update_attachment_metadata( $sub_attachment_id, $attach_data ); update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id ); } } } elseif ( 'application/pdf' === $mime_type ) { $fallback_sizes = array( 'thumbnail', 'medium', 'large', ); $fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata ); $registered_sizes = wp_get_registered_image_subsizes(); $merged_sizes = array_intersect_key( $registered_sizes, array_flip( $fallback_sizes ) ); if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) { $merged_sizes['thumbnail']['crop'] = false; } if ( ! empty( $merged_sizes ) ) { $editor = wp_get_image_editor( $file ); if ( ! is_wp_error( $editor ) ) { $dirname = dirname( $file ) . '/'; $ext = '.' . pathinfo( $file, PATHINFO_EXTENSION ); $preview_file = $dirname . wp_unique_filename( $dirname, wp_basename( $file, $ext ) . '-pdf.jpg' ); $uploaded = $editor->save( $preview_file, 'image/jpeg' ); unset( $editor ); if ( ! is_wp_error( $uploaded ) ) { $image_file = $uploaded['path']; unset( $uploaded['path'] ); $metadata['sizes'] = array( 'full' => $uploaded, ); wp_update_attachment_metadata( $attachment_id, $metadata ); $metadata = _wp_make_subsizes( $merged_sizes, $image_file, $metadata, $attachment_id ); } } } } unset( $metadata['image']['data'] ); if ( ! isset( $metadata['filesize'] ) && file_exists( $file ) ) { $metadata['filesize'] = wp_filesize( $file ); } return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id, 'create' ); } function wp_exif_frac2dec( $str ) { if ( ! is_scalar( $str ) || is_bool( $str ) ) { return 0; } if ( ! is_string( $str ) ) { return $str; } if ( substr_count( $str, '/' ) !== 1 ) { if ( is_numeric( $str ) ) { return (float) $str; } return 0; } list( $numerator, $denominator ) = explode( '/', $str ); if ( ! is_numeric( $numerator ) || ! is_numeric( $denominator ) ) { return 0; } if ( 0 == $denominator ) { return 0; } return $numerator / $denominator; } function wp_exif_date2ts( $str ) { list( $date, $time ) = explode( ' ', trim( $str ) ); list( $y, $m, $d ) = explode( ':', $date ); return strtotime( "{$y}-{$m}-{$d} {$time}" ); } function wp_read_image_metadata( $file ) { if ( ! file_exists( $file ) ) { return false; } list( , , $image_type ) = wp_getimagesize( $file ); $meta = array( 'aperture' => 0, 'credit' => '', 'camera' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'focal_length' => 0, 'iso' => 0, 'shutter_speed' => 0, 'title' => '', 'orientation' => 0, 'keywords' => array(), ); $iptc = array(); $info = array(); if ( is_callable( 'iptcparse' ) ) { wp_getimagesize( $file, $info ); if ( ! empty( $info['APP13'] ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $iptc = iptcparse( $info['APP13'] ); } else { $iptc = @iptcparse( $info['APP13'] ); } if ( ! is_array( $iptc ) ) { $iptc = array(); } if ( ! empty( $iptc['2#105'][0] ) ) { $meta['title'] = trim( $iptc['2#105'][0] ); } elseif ( ! empty( $iptc['2#005'][0] ) ) { $meta['title'] = trim( $iptc['2#005'][0] ); } if ( ! empty( $iptc['2#120'][0] ) ) { $caption = trim( $iptc['2#120'][0] ); mbstring_binary_safe_encoding(); $caption_length = strlen( $caption ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $caption_length < 80 ) { $meta['title'] = $caption; } $meta['caption'] = $caption; } if ( ! empty( $iptc['2#110'][0] ) ) { $meta['credit'] = trim( $iptc['2#110'][0] ); } elseif ( ! empty( $iptc['2#080'][0] ) ) { $meta['credit'] = trim( $iptc['2#080'][0] ); } if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) { $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); } if ( ! empty( $iptc['2#116'][0] ) ) { $meta['copyright'] = trim( $iptc['2#116'][0] ); } if ( ! empty( $iptc['2#025'][0] ) ) { $meta['keywords'] = array_values( $iptc['2#025'] ); } } } $exif = array(); $exif_image_types = apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ); if ( is_callable( 'exif_read_data' ) && in_array( $image_type, $exif_image_types, true ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $exif = exif_read_data( $file ); } else { $exif = @exif_read_data( $file ); } if ( ! is_array( $exif ) ) { $exif = array(); } if ( ! empty( $exif['ImageDescription'] ) ) { mbstring_binary_safe_encoding(); $description_length = strlen( $exif['ImageDescription'] ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $description_length < 80 ) { $meta['title'] = trim( $exif['ImageDescription'] ); } if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) { $meta['caption'] = trim( $exif['COMPUTED']['UserComment'] ); } if ( empty( $meta['caption'] ) ) { $meta['caption'] = trim( $exif['ImageDescription'] ); } } elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) { $meta['caption'] = trim( $exif['Comments'] ); } if ( empty( $meta['credit'] ) ) { if ( ! empty( $exif['Artist'] ) ) { $meta['credit'] = trim( $exif['Artist'] ); } elseif ( ! empty( $exif['Author'] ) ) { $meta['credit'] = trim( $exif['Author'] ); } } if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) { $meta['copyright'] = trim( $exif['Copyright'] ); } if ( ! empty( $exif['FNumber'] ) && is_scalar( $exif['FNumber'] ) ) { $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); } if ( ! empty( $exif['Model'] ) ) { $meta['camera'] = trim( $exif['Model'] ); } if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) { $meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] ); } if ( ! empty( $exif['FocalLength'] ) ) { $meta['focal_length'] = (string) $exif['FocalLength']; if ( is_scalar( $exif['FocalLength'] ) ) { $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] ); } } if ( ! empty( $exif['ISOSpeedRatings'] ) ) { $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; $meta['iso'] = trim( $meta['iso'] ); } if ( ! empty( $exif['ExposureTime'] ) ) { $meta['shutter_speed'] = (string) $exif['ExposureTime']; if ( is_scalar( $exif['ExposureTime'] ) ) { $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] ); } } if ( ! empty( $exif['Orientation'] ) ) { $meta['orientation'] = $exif['Orientation']; } } foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) { $meta[ $key ] = utf8_encode( $meta[ $key ] ); } } foreach ( $meta['keywords'] as $key => $keyword ) { if ( ! seems_utf8( $keyword ) ) { $meta['keywords'][ $key ] = utf8_encode( $keyword ); } } $meta = wp_kses_post_deep( $meta ); return apply_filters( 'wp_read_image_metadata', $meta, $file, $image_type, $iptc, $exif ); } function file_is_valid_image( $path ) { $size = wp_getimagesize( $path ); return ! empty( $size ); } function file_is_displayable_image( $path ) { $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_ICO, IMAGETYPE_WEBP ); $info = wp_getimagesize( $path ); if ( empty( $info ) ) { $result = false; } elseif ( ! in_array( $info[2], $displayable_image_types, true ) ) { $result = false; } else { $result = true; } return apply_filters( 'file_is_displayable_image', $result, $path ); } function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) { $filepath = _load_image_to_edit_path( $attachment_id, $size ); if ( empty( $filepath ) ) { return false; } switch ( $mime_type ) { case 'image/jpeg': $image = imagecreatefromjpeg( $filepath ); break; case 'image/png': $image = imagecreatefrompng( $filepath ); break; case 'image/gif': $image = imagecreatefromgif( $filepath ); break; case 'image/webp': $image = false; if ( function_exists( 'imagecreatefromwebp' ) ) { $image = imagecreatefromwebp( $filepath ); } break; default: $image = false; break; } if ( is_gd_image( $image ) ) { $image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size ); if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) { imagealphablending( $image, false ); imagesavealpha( $image, true ); } } return $image; } function _load_image_to_edit_path( $attachment_id, $size = 'full' ) { $filepath = get_attached_file( $attachment_id ); if ( $filepath && file_exists( $filepath ) ) { if ( 'full' !== $size ) { $data = image_get_intermediate_size( $attachment_id, $size ); if ( $data ) { $filepath = path_join( dirname( $filepath ), $data['file'] ); $filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size ); } } } elseif ( function_exists( 'fopen' ) && ini_get( 'allow_url_fopen' ) ) { $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size ); } return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size ); } function _copy_image_file( $attachment_id ) { $dst_file = get_attached_file( $attachment_id ); $src_file = $dst_file; if ( ! file_exists( $src_file ) ) { $src_file = _load_image_to_edit_path( $attachment_id ); } if ( $src_file ) { $dst_file = str_replace( wp_basename( $dst_file ), 'copy-' . wp_basename( $dst_file ), $dst_file ); $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) ); wp_mkdir_p( dirname( $dst_file ) ); if ( ! copy( $src_file, $dst_file ) ) { $dst_file = false; } } else { $dst_file = false; } return $dst_file; } post_type; $replace_editor = apply_filters( 'replace_editor', false, $post ); if ( ! $replace_editor ) { $is_block_editor = use_block_editor_for_post( $post ); } } } break; case 'edit-tags': case 'term': if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) { $post_type = 'post'; } break; case 'upload': $post_type = 'attachment'; break; } } switch ( $base ) { case 'post': if ( null === $post_type ) { $post_type = 'post'; } if ( empty( $post_id ) ) { $is_block_editor = use_block_editor_for_post_type( $post_type ); } $id = $post_type; break; case 'edit': if ( null === $post_type ) { $post_type = 'post'; } $id .= '-' . $post_type; break; case 'edit-tags': case 'term': if ( null === $taxonomy ) { $taxonomy = 'post_tag'; } if ( null === $post_type ) { $post_type = 'post'; if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { $post_type = $_REQUEST['post_type']; } } $id = 'edit-' . $taxonomy; break; } if ( 'network' === $in_admin ) { $id .= '-network'; $base .= '-network'; } elseif ( 'user' === $in_admin ) { $id .= '-user'; $base .= '-user'; } if ( isset( self::$_registry[ $id ] ) ) { $screen = self::$_registry[ $id ]; if ( get_current_screen() === $screen ) { return $screen; } } else { $screen = new self(); $screen->id = $id; } $screen->base = $base; $screen->action = $action; $screen->post_type = (string) $post_type; $screen->taxonomy = (string) $taxonomy; $screen->is_user = ( 'user' === $in_admin ); $screen->is_network = ( 'network' === $in_admin ); $screen->in_admin = $in_admin; $screen->is_block_editor = $is_block_editor; self::$_registry[ $id ] = $screen; return $screen; } public function set_current_screen() { global $current_screen, $taxnow, $typenow; $current_screen = $this; $typenow = $this->post_type; $taxnow = $this->taxonomy; do_action( 'current_screen', $current_screen ); } private function __construct() {} public function in_admin( $admin = null ) { if ( empty( $admin ) ) { return (bool) $this->in_admin; } return ( $admin === $this->in_admin ); } public function is_block_editor( $set = null ) { if ( null !== $set ) { $this->is_block_editor = (bool) $set; } return $this->is_block_editor; } public static function add_old_compat_help( $screen, $help ) { self::$_old_compat_help[ $screen->id ] = $help; } public function set_parentage( $parent_file ) { $this->parent_file = $parent_file; list( $this->parent_base ) = explode( '?', $parent_file ); $this->parent_base = str_replace( '.php', '', $this->parent_base ); } public function add_option( $option, $args = array() ) { $this->_options[ $option ] = $args; } public function remove_option( $option ) { unset( $this->_options[ $option ] ); } public function remove_options() { $this->_options = array(); } public function get_options() { return $this->_options; } public function get_option( $option, $key = false ) { if ( ! isset( $this->_options[ $option ] ) ) { return null; } if ( $key ) { if ( isset( $this->_options[ $option ][ $key ] ) ) { return $this->_options[ $option ][ $key ]; } return null; } return $this->_options[ $option ]; } public function get_help_tabs() { $help_tabs = $this->_help_tabs; $priorities = array(); foreach ( $help_tabs as $help_tab ) { if ( isset( $priorities[ $help_tab['priority'] ] ) ) { $priorities[ $help_tab['priority'] ][] = $help_tab; } else { $priorities[ $help_tab['priority'] ] = array( $help_tab ); } } ksort( $priorities ); $sorted = array(); foreach ( $priorities as $list ) { foreach ( $list as $tab ) { $sorted[ $tab['id'] ] = $tab; } } return $sorted; } public function get_help_tab( $id ) { if ( ! isset( $this->_help_tabs[ $id ] ) ) { return null; } return $this->_help_tabs[ $id ]; } public function add_help_tab( $args ) { $defaults = array( 'title' => false, 'id' => false, 'content' => '', 'callback' => false, 'priority' => 10, ); $args = wp_parse_args( $args, $defaults ); $args['id'] = sanitize_html_class( $args['id'] ); if ( ! $args['id'] || ! $args['title'] ) { return; } $this->_help_tabs[ $args['id'] ] = $args; } public function remove_help_tab( $id ) { unset( $this->_help_tabs[ $id ] ); } public function remove_help_tabs() { $this->_help_tabs = array(); } public function get_help_sidebar() { return $this->_help_sidebar; } public function set_help_sidebar( $content ) { $this->_help_sidebar = $content; } public function get_columns() { return $this->columns; } public function get_screen_reader_content() { return $this->_screen_reader_content; } public function get_screen_reader_text( $key ) { if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { return null; } return $this->_screen_reader_content[ $key ]; } public function set_screen_reader_content( $content = array() ) { $defaults = array( 'heading_views' => __( 'Filter items list' ), 'heading_pagination' => __( 'Items list navigation' ), 'heading_list' => __( 'Items list' ), ); $content = wp_parse_args( $content, $defaults ); $this->_screen_reader_content = $content; } public function remove_screen_reader_content() { $this->_screen_reader_content = array(); } public function render_screen_meta() { self::$_old_compat_help = apply_filters_deprecated( 'contextual_help_list', array( self::$_old_compat_help, $this ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; $old_help = apply_filters_deprecated( 'contextual_help', array( $old_help, $this->id, $this ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); if ( empty( $old_help ) && ! $this->get_help_tabs() ) { $default_help = apply_filters_deprecated( 'default_contextual_help', array( '' ), '3.3.0', 'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()' ); if ( $default_help ) { $old_help = '

            ' . $default_help . '

            '; } } if ( $old_help ) { $this->add_help_tab( array( 'id' => 'old-contextual-help', 'title' => __( 'Overview' ), 'content' => $old_help, ) ); } $help_sidebar = $this->get_help_sidebar(); $help_class = 'hidden'; if ( ! $help_sidebar ) { $help_class .= ' no-sidebar'; } ?> -
            - -
            -
            -
            -
            -
              - get_help_tabs() as $tab ) : $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; ?> - - - -
            -
            - - -
            - -
            - - -
            - get_help_tabs() as $tab ) : $panel_id = "tab-panel-{$tab['id']}"; ?> - -
            - -
            - -
            -
            -
            - 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; if ( $this->show_screen_options() ) { $this->render_screen_options(); } ?> -
            - get_help_tabs() && ! $this->show_screen_options() ) { return; } ?> - - _show_screen_options ) ) { return $this->_show_screen_options; } $columns = get_column_headers( $this ); $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); $this->_screen_settings = ''; if ( 'post' === $this->base ) { $expand = ''; $this->_screen_settings = $expand; } $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); if ( $this->_screen_settings || $this->_options ) { $show_screen = true; } $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); return $this->_show_screen_options; } public function render_screen_options( $options = array() ) { $options = wp_parse_args( $options, array( 'wrap' => true, ) ); $wrapper_start = ''; $wrapper_end = ''; $form_start = ''; $form_end = ''; if ( $options['wrap'] ) { $wrapper_start = ''; } if ( 'widgets' !== $this->base ) { $form_start = "\n
            \n"; $form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n
            \n"; } echo $wrapper_start . $form_start; $this->render_meta_boxes_preferences(); $this->render_list_table_columns_preferences(); $this->render_screen_layout(); $this->render_per_page_options(); $this->render_view_mode(); echo $this->_screen_settings; $show_button = apply_filters( 'screen_options_show_submit', false, $this ); if ( $show_button ) { submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true ); } echo $form_end . $wrapper_end; } public function render_meta_boxes_preferences() { global $wp_meta_boxes; if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { return; } ?> -
            - -

            - - -

            - id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { if ( isset( $_GET['welcome'] ) ) { $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); } else { $welcome_checked = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); if ( 2 === $welcome_checked && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) { $welcome_checked = false; } } echo '\n"; } ?> -
            - -
            - - $title ) { if ( in_array( $column, $special, true ) ) { continue; } if ( empty( $title ) ) { continue; } $title = wp_strip_all_tags( $title ); $id = "$column-hide"; echo '\n"; } ?> -
            - get_option( 'layout_columns' ) ) { return; } $screen_layout_columns = $this->get_columns(); $num = $this->get_option( 'layout_columns', 'max' ); ?> -
            - - - - -
            - get_option( 'per_page' ) ) { return; } $per_page_label = $this->get_option( 'per_page', 'label' ); if ( null === $per_page_label ) { $per_page_label = __( 'Number of items per page:' ); } $option = $this->get_option( 'per_page', 'option' ); if ( ! $option ) { $option = str_replace( '-', '_', "{$this->id}_per_page" ); } $per_page = (int) get_user_option( $option ); if ( empty( $per_page ) || $per_page < 1 ) { $per_page = $this->get_option( 'per_page', 'default' ); if ( ! $per_page ) { $per_page = 20; } } if ( 'edit_comments_per_page' === $option ) { $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); } elseif ( 'categories_per_page' === $option ) { $per_page = apply_filters( 'edit_categories_per_page', $per_page ); } else { $per_page = apply_filters( "{$option}", $per_page ); } if ( isset( $this->post_type ) ) { $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); } add_filter( 'screen_options_show_submit', '__return_true' ); ?> -
            - - - - - - -
            - base && 'edit-comments' !== $screen->base ) { return; } $view_mode_post_types = get_post_types( array( 'show_ui' => true ) ); $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) { return; } if ( ! isset( $mode ) ) { $mode = get_user_setting( 'posts_list_mode', 'list' ); } add_filter( 'screen_options_show_submit', '__return_true' ); ?> -
            - - - -
            - _screen_reader_content[ $key ] ) ) { return; } echo "<$tag class='screen-reader-text'>" . $this->_screen_reader_content[ $key ] . ""; } } LocalEcho=$le; $this->Verbose=$verb; $this->_lastaction=NULL; $this->_error_array=array(); $this->_eol_code=array(FTP_OS_Unix=>"\n", FTP_OS_Mac=>"\r", FTP_OS_Windows=>"\r\n"); $this->AuthorizedTransferMode=array(FTP_AUTOASCII, FTP_ASCII, FTP_BINARY); $this->OS_FullName=array(FTP_OS_Unix => 'UNIX', FTP_OS_Windows => 'WINDOWS', FTP_OS_Mac => 'MACOS'); $this->AutoAsciiExt=array("ASP","BAT","C","CPP","CSS","CSV","JS","H","HTM","HTML","SHTML","INI","LOG","PHP3","PHTML","PL","PERL","SH","SQL","TXT"); $this->_port_available=($port_mode==TRUE); $this->SendMSG("Staring FTP client class".($this->_port_available?"":" without PORT mode support")); $this->_connected=FALSE; $this->_ready=FALSE; $this->_can_restore=FALSE; $this->_code=0; $this->_message=""; $this->_ftp_buff_size=4096; $this->_curtype=NULL; $this->SetUmask(0022); $this->SetType(FTP_AUTOASCII); $this->SetTimeout(30); $this->Passive(!$this->_port_available); $this->_login="anonymous"; $this->_password="anon@ftp.com"; $this->_features=array(); $this->OS_local=FTP_OS_Unix; $this->OS_remote=FTP_OS_Unix; $this->features=array(); if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows; elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac; } function ftp_base($port_mode=FALSE) { $this->__construct($port_mode); } function parselisting($line) { $is_windows = ($this->OS_remote == FTP_OS_Windows); if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|) +(.+)/",$line,$lucifer)) { $b = array(); if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } $b['isdir'] = ($lucifer[7]==""); if ( $b['isdir'] ) $b['type'] = 'd'; else $b['type'] = 'f'; $b['size'] = $lucifer[7]; $b['month'] = $lucifer[1]; $b['day'] = $lucifer[2]; $b['year'] = $lucifer[3]; $b['hour'] = $lucifer[4]; $b['minute'] = $lucifer[5]; $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]); $b['am/pm'] = $lucifer[6]; $b['name'] = $lucifer[8]; } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) { $lcount=count($lucifer); if ($lcount<8) return ''; $b = array(); $b['isdir'] = $lucifer[0][0] === "d"; $b['islink'] = $lucifer[0][0] === "l"; if ( $b['isdir'] ) $b['type'] = 'd'; elseif ( $b['islink'] ) $b['type'] = 'l'; else $b['type'] = 'f'; $b['perms'] = $lucifer[0]; $b['number'] = $lucifer[1]; $b['owner'] = $lucifer[2]; $b['group'] = $lucifer[3]; $b['size'] = $lucifer[4]; if ($lcount==8) { sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']); sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']); $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']); $b['name'] = $lucifer[7]; } else { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) { $b['year'] = gmdate("Y"); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { $b['year'] = $lucifer[7]; $b['hour'] = 0; $b['minute'] = 0; } $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute'])); $b['name'] = $lucifer[8]; } } return $b; } function SendMSG($message = "", $crlf=true) { if ($this->Verbose) { echo $message.($crlf?CRLF:""); flush(); } return TRUE; } function SetType($mode=FTP_AUTOASCII) { if(!in_array($mode, $this->AuthorizedTransferMode)) { $this->SendMSG("Wrong type"); return FALSE; } $this->_type=$mode; $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) ); return TRUE; } function _settype($mode=FTP_ASCII) { if($this->_ready) { if($mode==FTP_BINARY) { if($this->_curtype!=FTP_BINARY) { if(!$this->_exec("TYPE I", "SetType")) return FALSE; $this->_curtype=FTP_BINARY; } } elseif($this->_curtype!=FTP_ASCII) { if(!$this->_exec("TYPE A", "SetType")) return FALSE; $this->_curtype=FTP_ASCII; } } else return FALSE; return TRUE; } function Passive($pasv=NULL) { if(is_null($pasv)) $this->_passive=!$this->_passive; else $this->_passive=$pasv; if(!$this->_port_available and !$this->_passive) { $this->SendMSG("Only passive connections available!"); $this->_passive=TRUE; return FALSE; } $this->SendMSG("Passive mode ".($this->_passive?"on":"off")); return TRUE; } function SetServer($host, $port=21, $reconnect=true) { if(!is_long($port)) { $this->verbose=true; $this->SendMSG("Incorrect port syntax"); return FALSE; } else { $ip=@gethostbyname($host); $dns=@gethostbyaddr($host); if(!$ip) $ip=$host; if(!$dns) $dns=$host; $ipaslong = ip2long($ip); if ( ($ipaslong == false) || ($ipaslong === -1) ) { $this->SendMSG("Wrong host name/address \"".$host."\""); return FALSE; } $this->_host=$ip; $this->_fullhost=$dns; $this->_port=$port; $this->_dataport=$port-1; } $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\""); if($reconnect){ if($this->_connected) { $this->SendMSG("Reconnecting"); if(!$this->quit(FTP_FORCE)) return FALSE; if(!$this->connect()) return FALSE; } } return TRUE; } function SetUmask($umask=0022) { $this->_umask=$umask; umask($this->_umask); $this->SendMSG("UMASK 0".decoct($this->_umask)); return TRUE; } function SetTimeout($timeout=30) { $this->_timeout=$timeout; $this->SendMSG("Timeout ".$this->_timeout); if($this->_connected) if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE; return TRUE; } function connect($server=NULL) { if(!empty($server)) { if(!$this->SetServer($server)) return false; } if($this->_ready) return true; $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]); if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) { $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\""); return FALSE; } $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting."); do { if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; $this->_lastaction=time(); } while($this->_code<200); $this->_ready=true; $syst=$this->systype(); if(!$syst) $this->SendMSG("Cannot detect remote OS"); else { if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows; elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac; elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix; else $this->OS_remote=FTP_OS_Mac; $this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]); } if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled"); else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); return TRUE; } function quit($force=false) { if($this->_ready) { if(!$this->_exec("QUIT") and !$force) return FALSE; if(!$this->_checkCode() and !$force) return FALSE; $this->_ready=false; $this->SendMSG("Session finished"); } $this->_quit(); return TRUE; } function login($user=NULL, $pass=NULL) { if(!is_null($user)) $this->_login=$user; else $this->_login="anonymous"; if(!is_null($pass)) $this->_password=$pass; else $this->_password="anon@anon.com"; if(!$this->_exec("USER ".$this->_login, "login")) return FALSE; if(!$this->_checkCode()) return FALSE; if($this->_code!=230) { if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE; if(!$this->_checkCode()) return FALSE; } $this->SendMSG("Authentication succeeded"); if(empty($this->_features)) { if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled"); else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features))); } return TRUE; } function pwd() { if(!$this->_exec("PWD", "pwd")) return FALSE; if(!$this->_checkCode()) return FALSE; return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message); } function cdup() { if(!$this->_exec("CDUP", "cdup")) return FALSE; if(!$this->_checkCode()) return FALSE; return true; } function chdir($pathname) { if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function rmdir($pathname) { if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function mkdir($pathname) { if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function rename($from, $to) { if(!$this->_exec("RNFR ".$from, "rename")) return FALSE; if(!$this->_checkCode()) return FALSE; if($this->_code==350) { if(!$this->_exec("RNTO ".$to, "rename")) return FALSE; if(!$this->_checkCode()) return FALSE; } else return FALSE; return TRUE; } function filesize($pathname) { if(!isset($this->_features["SIZE"])) { $this->PushError("filesize", "not supported by server"); return FALSE; } if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE; if(!$this->_checkCode()) return FALSE; return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); } function abort() { if(!$this->_exec("ABOR", "abort")) return FALSE; if(!$this->_checkCode()) { if($this->_code!=426) return FALSE; if(!$this->_readmsg("abort")) return FALSE; if(!$this->_checkCode()) return FALSE; } return true; } function mdtm($pathname) { if(!isset($this->_features["MDTM"])) { $this->PushError("mdtm", "not supported by server"); return FALSE; } if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE; if(!$this->_checkCode()) return FALSE; $mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); return $timestamp; } function systype() { if(!$this->_exec("SYST", "systype")) return FALSE; if(!$this->_checkCode()) return FALSE; $DATA = explode(" ", $this->_message); return array($DATA[1], $DATA[3]); } function delete($pathname) { if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function site($command, $fnction="site") { if(!$this->_exec("SITE ".$command, $fnction)) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function chmod($pathname, $mode) { if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE; return TRUE; } function restore($from) { if(!isset($this->_features["REST"])) { $this->PushError("restore", "not supported by server"); return FALSE; } if($this->_curtype!=FTP_BINARY) { $this->PushError("restore", "cannot restore in ASCII mode"); return FALSE; } if(!$this->_exec("REST ".$from, "resore")) return FALSE; if(!$this->_checkCode()) return FALSE; return TRUE; } function features() { if(!$this->_exec("FEAT", "features")) return FALSE; if(!$this->_checkCode()) return FALSE; $f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY); $this->_features=array(); foreach($f as $k=>$v) { $v=explode(" ", trim($v)); $this->_features[array_shift($v)]=$v; } return true; } function rawlist($pathname="", $arg="") { return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist"); } function nlist($pathname="", $arg="") { return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist"); } function is_exists($pathname) { return $this->file_exists($pathname); } function file_exists($pathname) { $exists=true; if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE; else { if(!$this->_checkCode()) $exists=FALSE; $this->abort(); } if($exists) $this->SendMSG("Remote file ".$pathname." exists"); else $this->SendMSG("Remote file ".$pathname." does not exist"); return $exists; } function fget($fp, $remotefile, $rest=0) { if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("RETR ".$remotefile, "get")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $out=$this->_data_read($mode, $fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $out; } function get($remotefile, $localfile=NULL, $rest=0) { if(is_null($localfile)) $localfile=$remotefile; if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten"); $fp = @fopen($localfile, "w"); if (!$fp) { $this->PushError("get","cannot open local file", "Cannot create \"".$localfile."\""); return FALSE; } if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { fclose($fp); return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("RETR ".$remotefile, "get")) { $this->_data_close(); fclose($fp); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); fclose($fp); return FALSE; } $out=$this->_data_read($mode, $fp); fclose($fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $out; } function fput($remotefile, $fp, $rest=0) { if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($remotefile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("STOR ".$remotefile, "put")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ret=$this->_data_write($mode, $fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $ret; } function put($localfile, $remotefile=NULL, $rest=0) { if(is_null($remotefile)) $remotefile=$localfile; if (!file_exists($localfile)) { $this->PushError("put","cannot open local file", "No such file or directory \"".$localfile."\""); return FALSE; } $fp = @fopen($localfile, "r"); if (!$fp) { $this->PushError("put","cannot open local file", "Cannot read file \"".$localfile."\""); return FALSE; } if($this->_can_restore and $rest!=0) fseek($fp, $rest); $pi=pathinfo($localfile); if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; else $mode=FTP_BINARY; if(!$this->_data_prepare($mode)) { fclose($fp); return FALSE; } if($this->_can_restore and $rest!=0) $this->restore($rest); if(!$this->_exec("STOR ".$remotefile, "put")) { $this->_data_close(); fclose($fp); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); fclose($fp); return FALSE; } $ret=$this->_data_write($mode, $fp); fclose($fp); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; return $ret; } function mput($local=".", $remote=NULL, $continious=false) { $local=realpath($local); if(!@file_exists($local)) { $this->PushError("mput","cannot open local folder", "Cannot stat folder \"".$local."\""); return FALSE; } if(!is_dir($local)) return $this->put($local, $remote); if(empty($remote)) $remote="."; elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE; if($handle = opendir($local)) { $list=array(); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") $list[]=$file; } closedir($handle); } else { $this->PushError("mput","cannot open local folder", "Cannot read folder \"".$local."\""); return FALSE; } if(empty($list)) return TRUE; $ret=true; foreach($list as $el) { if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el); else $t=$this->put($local."/".$el, $remote."/".$el); if(!$t) { $ret=FALSE; if(!$continious) break; } } return $ret; } function mget($remote, $local=".", $continious=false) { $list=$this->rawlist($remote, "-lA"); if($list===false) { $this->PushError("mget","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return FALSE; } if(empty($list)) return true; if(!@file_exists($local)) { if(!@mkdir($local)) { $this->PushError("mget","cannot create local folder", "Cannot create folder \"".$local."\""); return FALSE; } } foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; foreach($list as $el) { if($el["type"]=="d") { if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) { $this->PushError("mget", "cannot copy folder", "Cannot copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } else { if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) { $this->PushError("mget", "cannot copy file", "Cannot copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } @chmod($local."/".$el["name"], $el["perms"]); $t=strtotime($el["date"]); if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t); } return $ret; } function mdel($remote, $continious=false) { $list=$this->rawlist($remote, "-la"); if($list===false) { $this->PushError("mdel","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return false; } foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; foreach($list as $el) { if ( empty($el) ) continue; if($el["type"]=="d") { if(!$this->mdel($remote."/".$el["name"], $continious)) { $ret=false; if(!$continious) break; } } else { if (!$this->delete($remote."/".$el["name"])) { $this->PushError("mdel", "cannot delete file", "Cannot delete remote file \"".$remote."/".$el["name"]."\""); $ret=false; if(!$continious) break; } } } if(!$this->rmdir($remote)) { $this->PushError("mdel", "cannot delete folder", "Cannot delete remote folder \"".$remote."/".$el["name"]."\""); $ret=false; } return $ret; } function mmkdir($dir, $mode = 0777) { if(empty($dir)) return FALSE; if($this->is_exists($dir) or $dir == "/" ) return TRUE; if(!$this->mmkdir(dirname($dir), $mode)) return false; $r=$this->mkdir($dir, $mode); $this->chmod($dir,$mode); return $r; } function glob($pattern, $handle=NULL) { $path=$output=null; if(PHP_OS=='WIN32') $slash='\\'; else $slash='/'; $lastpos=strrpos($pattern,$slash); if(!($lastpos===false)) { $path=substr($pattern,0,-$lastpos-1); $pattern=substr($pattern,$lastpos); } else $path=getcwd(); if(is_array($handle) and !empty($handle)) { foreach($handle as $dir) { if($this->glob_pattern_match($pattern,$dir)) $output[]=$dir; } } else { $handle=@opendir($path); if($handle===false) return false; while($dir=readdir($handle)) { if($this->glob_pattern_match($pattern,$dir)) $output[]=$dir; } closedir($handle); } if(is_array($output)) return $output; return false; } function glob_pattern_match($pattern,$subject) { $out=null; $chunks=explode(';',$pattern); foreach($chunks as $pattern) { $escape=array('$','^','.','{','}','(',')','[',']','|'); while(strpos($pattern,'**')!==false) $pattern=str_replace('**','*',$pattern); foreach($escape as $probe) $pattern=str_replace($probe,"\\$probe",$pattern); $pattern=str_replace('?*','*', str_replace('*?','*', str_replace('*',".*", str_replace('?','.{1,1}',$pattern)))); $out[]=$pattern; } if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject)); else { foreach($out as $tester) if($this->my_regexp("^$tester$",$subject)) return true; } return false; } function glob_regexp($pattern,$subject) { $sensitive=(PHP_OS!='WIN32'); return ($sensitive? preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $subject ) : preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $subject ) ); } function dirlist($remote) { $list=$this->rawlist($remote, "-la"); if($list===false) { $this->PushError("dirlist","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents"); return false; } $dirlist = array(); foreach($list as $k=>$v) { $entry=$this->parselisting($v); if ( empty($entry) ) continue; if($entry["name"]=="." or $entry["name"]=="..") continue; $dirlist[$entry['name']] = $entry; } return $dirlist; } function _checkCode() { return ($this->_code<400 and $this->_code>0); } function _list($arg="", $cmd="LIST", $fnction="_list") { if(!$this->_data_prepare()) return false; if(!$this->_exec($cmd.$arg, $fnction)) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $out=""; if($this->_code<200) { $out=$this->_data_read(); $this->_data_close(); if(!$this->_readmsg()) return FALSE; if(!$this->_checkCode()) return FALSE; if($out === FALSE ) return FALSE; $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY); } return $out; } function PushError($fctname,$msg,$desc=false){ $error=array(); $error['time']=time(); $error['fctname']=$fctname; $error['msg']=$msg; $error['desc']=$desc; if($desc) $tmp=' ('.$desc.')'; else $tmp=''; $this->SendMSG($fctname.': '.$msg.$tmp); return(array_push($this->_error_array,$error)); } function PopError(){ if(count($this->_error_array)) return(array_pop($this->_error_array)); else return(false); } } $mod_sockets = extension_loaded( 'sockets' ); if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) { $prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : ''; @dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX ); $mod_sockets = extension_loaded( 'sockets' ); } require_once __DIR__ . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php"; if ( $mod_sockets ) { class ftp extends ftp_sockets {} } else { class ftp extends ftp_pure {} } $update ) { if ( 'upgrade' === $update->response ) { $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version ); } else { $core_update_needed = ''; } } } $info = array(); $info['wp-core'] = array( 'label' => __( 'WordPress' ), 'fields' => array( 'version' => array( 'label' => __( 'Version' ), 'value' => $core_version . $core_update_needed, 'debug' => $core_version, ), 'site_language' => array( 'label' => __( 'Site Language' ), 'value' => get_locale(), ), 'user_language' => array( 'label' => __( 'User Language' ), 'value' => get_user_locale(), ), 'timezone' => array( 'label' => __( 'Timezone' ), 'value' => wp_timezone_string(), ), 'home_url' => array( 'label' => __( 'Home URL' ), 'value' => get_bloginfo( 'url' ), 'private' => true, ), 'site_url' => array( 'label' => __( 'Site URL' ), 'value' => get_bloginfo( 'wpurl' ), 'private' => true, ), 'permalink' => array( 'label' => __( 'Permalink structure' ), 'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ), 'debug' => $permalink_structure, ), 'https_status' => array( 'label' => __( 'Is this site using HTTPS?' ), 'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ), 'debug' => $is_ssl, ), 'multisite' => array( 'label' => __( 'Is this a multisite?' ), 'value' => $is_multisite ? __( 'Yes' ) : __( 'No' ), 'debug' => $is_multisite, ), 'user_registration' => array( 'label' => __( 'Can anyone register on this site?' ), 'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ), 'debug' => $users_can_register, ), 'blog_public' => array( 'label' => __( 'Is this site discouraging search engines?' ), 'value' => $blog_public ? __( 'No' ) : __( 'Yes' ), 'debug' => $blog_public, ), 'default_comment_status' => array( 'label' => __( 'Default comment status' ), 'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ), 'debug' => $default_comment_status, ), 'environment_type' => array( 'label' => __( 'Environment type' ), 'value' => $environment_type, 'debug' => $environment_type, ), ), ); if ( ! $is_multisite ) { $info['wp-paths-sizes'] = array( 'label' => __( 'Directories and Sizes' ), 'fields' => array(), ); } $info['wp-dropins'] = array( 'label' => __( 'Drop-ins' ), 'show_count' => true, 'description' => sprintf( __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), '' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '' ), 'fields' => array(), ); $info['wp-active-theme'] = array( 'label' => __( 'Active Theme' ), 'fields' => array(), ); $info['wp-parent-theme'] = array( 'label' => __( 'Parent Theme' ), 'fields' => array(), ); $info['wp-themes-inactive'] = array( 'label' => __( 'Inactive Themes' ), 'show_count' => true, 'fields' => array(), ); $info['wp-mu-plugins'] = array( 'label' => __( 'Must Use Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-plugins-active'] = array( 'label' => __( 'Active Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-plugins-inactive'] = array( 'label' => __( 'Inactive Plugins' ), 'show_count' => true, 'fields' => array(), ); $info['wp-media'] = array( 'label' => __( 'Media Handling' ), 'fields' => array(), ); $info['wp-server'] = array( 'label' => __( 'Server' ), 'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.' ), 'fields' => array(), ); $info['wp-database'] = array( 'label' => __( 'Database' ), 'fields' => array(), ); $wp_debug_log_value = __( 'Disabled' ); if ( is_string( WP_DEBUG_LOG ) ) { $wp_debug_log_value = WP_DEBUG_LOG; } elseif ( WP_DEBUG_LOG ) { $wp_debug_log_value = __( 'Enabled' ); } if ( defined( 'CONCATENATE_SCRIPTS' ) ) { $concatenate_scripts = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); $concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false'; } else { $concatenate_scripts = __( 'Undefined' ); $concatenate_scripts_debug = 'undefined'; } if ( defined( 'COMPRESS_SCRIPTS' ) ) { $compress_scripts = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); $compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false'; } else { $compress_scripts = __( 'Undefined' ); $compress_scripts_debug = 'undefined'; } if ( defined( 'COMPRESS_CSS' ) ) { $compress_css = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' ); $compress_css_debug = COMPRESS_CSS ? 'true' : 'false'; } else { $compress_css = __( 'Undefined' ); $compress_css_debug = 'undefined'; } if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) { $wp_environment_type = WP_ENVIRONMENT_TYPE; } else { $wp_environment_type = __( 'Undefined' ); } $info['wp-constants'] = array( 'label' => __( 'WordPress Constants' ), 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ), 'fields' => array( 'ABSPATH' => array( 'label' => 'ABSPATH', 'value' => ABSPATH, 'private' => true, ), 'WP_HOME' => array( 'label' => 'WP_HOME', 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ), 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ), ), 'WP_SITEURL' => array( 'label' => 'WP_SITEURL', 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ), 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ), ), 'WP_CONTENT_DIR' => array( 'label' => 'WP_CONTENT_DIR', 'value' => WP_CONTENT_DIR, ), 'WP_PLUGIN_DIR' => array( 'label' => 'WP_PLUGIN_DIR', 'value' => WP_PLUGIN_DIR, ), 'WP_MEMORY_LIMIT' => array( 'label' => 'WP_MEMORY_LIMIT', 'value' => WP_MEMORY_LIMIT, ), 'WP_MAX_MEMORY_LIMIT' => array( 'label' => 'WP_MAX_MEMORY_LIMIT', 'value' => WP_MAX_MEMORY_LIMIT, ), 'WP_DEBUG' => array( 'label' => 'WP_DEBUG', 'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_DEBUG, ), 'WP_DEBUG_DISPLAY' => array( 'label' => 'WP_DEBUG_DISPLAY', 'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_DEBUG_DISPLAY, ), 'WP_DEBUG_LOG' => array( 'label' => 'WP_DEBUG_LOG', 'value' => $wp_debug_log_value, 'debug' => WP_DEBUG_LOG, ), 'SCRIPT_DEBUG' => array( 'label' => 'SCRIPT_DEBUG', 'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => SCRIPT_DEBUG, ), 'WP_CACHE' => array( 'label' => 'WP_CACHE', 'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ), 'debug' => WP_CACHE, ), 'CONCATENATE_SCRIPTS' => array( 'label' => 'CONCATENATE_SCRIPTS', 'value' => $concatenate_scripts, 'debug' => $concatenate_scripts_debug, ), 'COMPRESS_SCRIPTS' => array( 'label' => 'COMPRESS_SCRIPTS', 'value' => $compress_scripts, 'debug' => $compress_scripts_debug, ), 'COMPRESS_CSS' => array( 'label' => 'COMPRESS_CSS', 'value' => $compress_css, 'debug' => $compress_css_debug, ), 'WP_ENVIRONMENT_TYPE' => array( 'label' => 'WP_ENVIRONMENT_TYPE', 'value' => $wp_environment_type, 'debug' => $wp_environment_type, ), 'DB_CHARSET' => array( 'label' => 'DB_CHARSET', 'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ), 'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ), ), 'DB_COLLATE' => array( 'label' => 'DB_COLLATE', 'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ), 'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ), ), ), ); $is_writable_abspath = wp_is_writable( ABSPATH ); $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); $info['wp-filesystem'] = array( 'label' => __( 'Filesystem Permissions' ), 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ), 'fields' => array( 'wordpress' => array( 'label' => __( 'The main WordPress directory' ), 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ), ), 'wp-content' => array( 'label' => __( 'The wp-content directory' ), 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ), ), 'uploads' => array( 'label' => __( 'The uploads directory' ), 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ), ), 'plugins' => array( 'label' => __( 'The plugins directory' ), 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ), ), 'themes' => array( 'label' => __( 'The themes directory' ), 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ), ), ), ); if ( is_multisite() ) { $network_query = new WP_Network_Query(); $network_ids = $network_query->query( array( 'fields' => 'ids', 'number' => 100, 'no_found_rows' => false, ) ); $site_count = 0; foreach ( $network_ids as $network_id ) { $site_count += get_blog_count( $network_id ); } $info['wp-core']['fields']['site_count'] = array( 'label' => __( 'Site count' ), 'value' => $site_count, ); $info['wp-core']['fields']['network_count'] = array( 'label' => __( 'Network count' ), 'value' => $network_query->found_networks, ); } $info['wp-core']['fields']['user_count'] = array( 'label' => __( 'User count' ), 'value' => get_user_count(), ); $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) ); if ( ! is_wp_error( $wp_dotorg ) ) { $info['wp-core']['fields']['dotorg_communication'] = array( 'label' => __( 'Communication with WordPress.org' ), 'value' => __( 'WordPress.org is reachable' ), 'debug' => 'true', ); } else { $info['wp-core']['fields']['dotorg_communication'] = array( 'label' => __( 'Communication with WordPress.org' ), 'value' => sprintf( __( 'Unable to reach WordPress.org at %1$s: %2$s' ), gethostbyname( 'wordpress.org' ), $wp_dotorg->get_error_message() ), 'debug' => $wp_dotorg->get_error_message(), ); } if ( ! $is_multisite ) { $loading = __( 'Loading…' ); $info['wp-paths-sizes']['fields'] = array( 'wordpress_path' => array( 'label' => __( 'WordPress directory location' ), 'value' => untrailingslashit( ABSPATH ), ), 'wordpress_size' => array( 'label' => __( 'WordPress directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'uploads_path' => array( 'label' => __( 'Uploads directory location' ), 'value' => $upload_dir['basedir'], ), 'uploads_size' => array( 'label' => __( 'Uploads directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'themes_path' => array( 'label' => __( 'Themes directory location' ), 'value' => get_theme_root(), ), 'themes_size' => array( 'label' => __( 'Themes directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'plugins_path' => array( 'label' => __( 'Plugins directory location' ), 'value' => WP_PLUGIN_DIR, ), 'plugins_size' => array( 'label' => __( 'Plugins directory size' ), 'value' => $loading, 'debug' => 'loading...', ), 'database_size' => array( 'label' => __( 'Database size' ), 'value' => $loading, 'debug' => 'loading...', ), 'total_size' => array( 'label' => __( 'Total installation size' ), 'value' => $loading, 'debug' => 'loading...', ), ); } $dropins = get_dropins(); $dropin_descriptions = _get_dropins(); $not_available = __( 'Not available' ); foreach ( $dropins as $dropin_key => $dropin ) { $info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array( 'label' => $dropin_key, 'value' => $dropin_descriptions[ $dropin_key ][0], 'debug' => 'true', ); } $info['wp-media']['fields']['image_editor'] = array( 'label' => __( 'Active editor' ), 'value' => _wp_image_editor_choose(), ); if ( class_exists( 'Imagick' ) ) { $imagick = new Imagick(); $imagemagick_version = $imagick->getVersion(); } else { $imagemagick_version = __( 'Not available' ); } $info['wp-media']['fields']['imagick_module_version'] = array( 'label' => __( 'ImageMagick version number' ), 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ), ); $info['wp-media']['fields']['imagemagick_version'] = array( 'label' => __( 'ImageMagick version string' ), 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ), ); $imagick_version = phpversion( 'imagick' ); $info['wp-media']['fields']['imagick_version'] = array( 'label' => __( 'Imagick version' ), 'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ), ); if ( ! function_exists( 'ini_get' ) ) { $info['wp-media']['fields']['ini_get'] = array( 'label' => __( 'File upload settings' ), 'value' => sprintf( __( 'Unable to determine some settings, as the %s function has been disabled.' ), 'ini_get()' ), 'debug' => 'ini_get() is disabled', ); } else { $post_max_size = ini_get( 'post_max_size' ); $upload_max_filesize = ini_get( 'upload_max_filesize' ); $max_file_uploads = ini_get( 'max_file_uploads' ); $effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) ); $info['wp-media']['fields']['file_uploads'] = array( 'label' => __( 'File uploads' ), 'value' => empty( ini_get( 'file_uploads' ) ) ? __( 'Disabled' ) : __( 'Enabled' ), 'debug' => 'File uploads is turned off', ); $info['wp-media']['fields']['post_max_size'] = array( 'label' => __( 'Max size of post data allowed' ), 'value' => $post_max_size, ); $info['wp-media']['fields']['upload_max_filesize'] = array( 'label' => __( 'Max size of an uploaded file' ), 'value' => $upload_max_filesize, ); $info['wp-media']['fields']['max_effective_size'] = array( 'label' => __( 'Max effective file size' ), 'value' => size_format( $effective ), ); $info['wp-media']['fields']['max_file_uploads'] = array( 'label' => __( 'Max number of files allowed' ), 'value' => number_format( $max_file_uploads ), ); } if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) { $limits = array( 'area' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : $not_available ), 'disk' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : $not_available ), 'file' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : $not_available ), 'map' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : $not_available ), 'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : $not_available ), 'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : $not_available ), ); $limits_debug = array( 'imagick::RESOURCETYPE_AREA' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : 'not available' ), 'imagick::RESOURCETYPE_DISK' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : 'not available' ), 'imagick::RESOURCETYPE_FILE' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : 'not available' ), 'imagick::RESOURCETYPE_MAP' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : 'not available' ), 'imagick::RESOURCETYPE_MEMORY' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : 'not available' ), 'imagick::RESOURCETYPE_THREAD' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : 'not available' ), ); $info['wp-media']['fields']['imagick_limits'] = array( 'label' => __( 'Imagick Resource Limits' ), 'value' => $limits, 'debug' => $limits_debug, ); try { $formats = Imagick::queryFormats( '*' ); } catch ( Exception $e ) { $formats = array(); } $info['wp-media']['fields']['imagemagick_file_formats'] = array( 'label' => __( 'ImageMagick supported file formats' ), 'value' => ( empty( $formats ) ) ? __( 'Unable to determine' ) : implode( ', ', $formats ), 'debug' => ( empty( $formats ) ) ? 'Unable to determine' : implode( ', ', $formats ), ); } if ( function_exists( 'gd_info' ) ) { $gd = gd_info(); } else { $gd = false; } $info['wp-media']['fields']['gd_version'] = array( 'label' => __( 'GD version' ), 'value' => ( is_array( $gd ) ? $gd['GD Version'] : $not_available ), 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ), ); $gd_image_formats = array(); $gd_supported_formats = array( 'GIF Create' => 'GIF', 'JPEG' => 'JPEG', 'PNG' => 'PNG', 'WebP' => 'WebP', 'BMP' => 'BMP', 'AVIF' => 'AVIF', 'HEIF' => 'HEIF', 'TIFF' => 'TIFF', 'XPM' => 'XPM', ); foreach ( $gd_supported_formats as $format_key => $format ) { $index = $format_key . ' Support'; if ( isset( $gd[ $index ] ) && $gd[ $index ] ) { array_push( $gd_image_formats, $format ); } } if ( ! empty( $gd_image_formats ) ) { $info['wp-media']['fields']['gd_formats'] = array( 'label' => __( 'GD supported file formats' ), 'value' => implode( ', ', $gd_image_formats ), ); } if ( function_exists( 'exec' ) ) { $gs = exec( 'gs --version' ); if ( empty( $gs ) ) { $gs = $not_available; $gs_debug = 'not available'; } else { $gs_debug = $gs; } } else { $gs = __( 'Unable to determine if Ghostscript is installed' ); $gs_debug = 'unknown'; } $info['wp-media']['fields']['ghostscript_version'] = array( 'label' => __( 'Ghostscript version' ), 'value' => $gs, 'debug' => $gs_debug, ); if ( function_exists( 'php_uname' ) ) { $server_architecture = sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) ); } else { $server_architecture = 'unknown'; } if ( function_exists( 'phpversion' ) ) { $php_version_debug = phpversion(); $php64bit = ( PHP_INT_SIZE * 8 === 64 ); $php_version = sprintf( '%s %s', $php_version_debug, ( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) ) ); if ( $php64bit ) { $php_version_debug .= ' 64bit'; } } else { $php_version = __( 'Unable to determine PHP version' ); $php_version_debug = 'unknown'; } if ( function_exists( 'php_sapi_name' ) ) { $php_sapi = php_sapi_name(); } else { $php_sapi = 'unknown'; } $info['wp-server']['fields']['server_architecture'] = array( 'label' => __( 'Server architecture' ), 'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ), 'debug' => $server_architecture, ); $info['wp-server']['fields']['httpd_software'] = array( 'label' => __( 'Web server' ), 'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ), 'debug' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown' ), ); $info['wp-server']['fields']['php_version'] = array( 'label' => __( 'PHP version' ), 'value' => $php_version, 'debug' => $php_version_debug, ); $info['wp-server']['fields']['php_sapi'] = array( 'label' => __( 'PHP SAPI' ), 'value' => ( 'unknown' !== $php_sapi ? $php_sapi : __( 'Unable to determine PHP SAPI' ) ), 'debug' => $php_sapi, ); if ( ! function_exists( 'ini_get' ) ) { $info['wp-server']['fields']['ini_get'] = array( 'label' => __( 'Server settings' ), 'value' => sprintf( __( 'Unable to determine some settings, as the %s function has been disabled.' ), 'ini_get()' ), 'debug' => 'ini_get() is disabled', ); } else { $info['wp-server']['fields']['max_input_variables'] = array( 'label' => __( 'PHP max input variables' ), 'value' => ini_get( 'max_input_vars' ), ); $info['wp-server']['fields']['time_limit'] = array( 'label' => __( 'PHP time limit' ), 'value' => ini_get( 'max_execution_time' ), ); if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) { $info['wp-server']['fields']['memory_limit'] = array( 'label' => __( 'PHP memory limit' ), 'value' => WP_Site_Health::get_instance()->php_memory_limit, ); $info['wp-server']['fields']['admin_memory_limit'] = array( 'label' => __( 'PHP memory limit (only for admin screens)' ), 'value' => ini_get( 'memory_limit' ), ); } else { $info['wp-server']['fields']['memory_limit'] = array( 'label' => __( 'PHP memory limit' ), 'value' => ini_get( 'memory_limit' ), ); } $info['wp-server']['fields']['max_input_time'] = array( 'label' => __( 'Max input time' ), 'value' => ini_get( 'max_input_time' ), ); $info['wp-server']['fields']['upload_max_filesize'] = array( 'label' => __( 'Upload max filesize' ), 'value' => ini_get( 'upload_max_filesize' ), ); $info['wp-server']['fields']['php_post_max_size'] = array( 'label' => __( 'PHP post max size' ), 'value' => ini_get( 'post_max_size' ), ); } if ( function_exists( 'curl_version' ) ) { $curl = curl_version(); $info['wp-server']['fields']['curl_version'] = array( 'label' => __( 'cURL version' ), 'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ), ); } else { $info['wp-server']['fields']['curl_version'] = array( 'label' => __( 'cURL version' ), 'value' => $not_available, 'debug' => 'not available', ); } $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ); $info['wp-server']['fields']['suhosin'] = array( 'label' => __( 'Is SUHOSIN installed?' ), 'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $suhosin_loaded, ); $imagick_loaded = extension_loaded( 'imagick' ); $info['wp-server']['fields']['imagick_availability'] = array( 'label' => __( 'Is the Imagick library available?' ), 'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $imagick_loaded, ); $pretty_permalinks_supported = got_url_rewrite(); $info['wp-server']['fields']['pretty_permalinks'] = array( 'label' => __( 'Are pretty permalinks supported?' ), 'value' => ( $pretty_permalinks_supported ? __( 'Yes' ) : __( 'No' ) ), 'debug' => $pretty_permalinks_supported, ); if ( is_file( ABSPATH . '.htaccess' ) ) { $htaccess_content = file_get_contents( ABSPATH . '.htaccess' ); $filtered_htaccess_content = trim( preg_replace( '/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content ) ); $filtered_htaccess_content = ! empty( $filtered_htaccess_content ); if ( $filtered_htaccess_content ) { $htaccess_rules_string = sprintf( __( 'Custom rules have been added to your %s file.' ), '.htaccess' ); } else { $htaccess_rules_string = sprintf( __( 'Your %s file contains only core WordPress features.' ), '.htaccess' ); } $info['wp-server']['fields']['htaccess_extra_rules'] = array( 'label' => __( '.htaccess rules' ), 'value' => $htaccess_rules_string, 'debug' => $filtered_htaccess_content, ); } if ( is_resource( $wpdb->dbh ) ) { $extension = 'mysql'; } elseif ( is_object( $wpdb->dbh ) ) { $extension = get_class( $wpdb->dbh ); } else { $extension = null; } $server = $wpdb->get_var( 'SELECT VERSION()' ); if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { $client_version = $wpdb->dbh->client_info; } else { if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) { $client_version = $matches[0]; } else { $client_version = null; } } $info['wp-database']['fields']['extension'] = array( 'label' => __( 'Extension' ), 'value' => $extension, ); $info['wp-database']['fields']['server_version'] = array( 'label' => __( 'Server version' ), 'value' => $server, ); $info['wp-database']['fields']['client_version'] = array( 'label' => __( 'Client version' ), 'value' => $client_version, ); $info['wp-database']['fields']['database_user'] = array( 'label' => __( 'Database username' ), 'value' => $wpdb->dbuser, 'private' => true, ); $info['wp-database']['fields']['database_host'] = array( 'label' => __( 'Database host' ), 'value' => $wpdb->dbhost, 'private' => true, ); $info['wp-database']['fields']['database_name'] = array( 'label' => __( 'Database name' ), 'value' => $wpdb->dbname, 'private' => true, ); $info['wp-database']['fields']['database_prefix'] = array( 'label' => __( 'Table prefix' ), 'value' => $wpdb->prefix, 'private' => true, ); $info['wp-database']['fields']['database_charset'] = array( 'label' => __( 'Database charset' ), 'value' => $wpdb->charset, 'private' => true, ); $info['wp-database']['fields']['database_collate'] = array( 'label' => __( 'Database collation' ), 'value' => $wpdb->collate, 'private' => true, ); $info['wp-database']['fields']['max_allowed_packet'] = array( 'label' => __( 'Max allowed packet size' ), 'value' => self::get_mysql_var( 'max_allowed_packet' ), ); $info['wp-database']['fields']['max_connections'] = array( 'label' => __( 'Max connections number' ), 'value' => self::get_mysql_var( 'max_connections' ), ); $mu_plugins = get_mu_plugins(); foreach ( $mu_plugins as $plugin_path => $plugin ) { $plugin_version = $plugin['Version']; $plugin_author = $plugin['Author']; $plugin_version_string = __( 'No version or author information is available.' ); $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); } else { if ( ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); } if ( ! empty( $plugin_version ) ) { $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); } } $info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( 'label' => $plugin['Name'], 'value' => $plugin_version_string, 'debug' => $plugin_version_string_debug, ); } $plugins = get_plugins(); $plugin_updates = get_plugin_updates(); $transient = get_site_transient( 'update_plugins' ); $auto_updates = array(); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); } foreach ( $plugins as $plugin_path => $plugin ) { $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive'; $plugin_version = $plugin['Version']; $plugin_author = $plugin['Author']; $plugin_version_string = __( 'No version or author information is available.' ); $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); } else { if ( ! empty( $plugin_author ) ) { $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); } if ( ! empty( $plugin_version ) ) { $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); } } if ( array_key_exists( $plugin_path, $plugin_updates ) ) { $plugin_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version ); $plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $plugin_path ] ) ) { $item = $transient->response[ $plugin_path ]; } elseif ( isset( $transient->no_update[ $plugin_path ] ) ) { $item = $transient->no_update[ $plugin_path ]; } else { $item = array( 'id' => $plugin_path, 'slug' => '', 'plugin' => $plugin_path, 'new_version' => '', 'url' => '', 'package' => '', 'icons' => array(), 'banners' => array(), 'banners_rtl' => array(), 'tested' => '', 'requires_php' => '', 'compatibility' => new stdClass(), ); $item = wp_parse_args( $plugin, $item ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $plugin_path, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Auto-updates enabled' ); } else { $auto_updates_string = __( 'Auto-updates disabled' ); } $auto_updates_string = apply_filters( 'plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled ); $plugin_version_string .= ' | ' . $auto_updates_string; $plugin_version_string_debug .= ', ' . $auto_updates_string; } $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( 'label' => $plugin['Name'], 'value' => $plugin_version_string, 'debug' => $plugin_version_string_debug, ); } global $_wp_theme_features; $theme_features = array(); if ( ! empty( $_wp_theme_features ) ) { foreach ( $_wp_theme_features as $feature => $options ) { $theme_features[] = $feature; } } $active_theme = wp_get_theme(); $theme_updates = get_theme_updates(); $transient = get_site_transient( 'update_themes' ); $active_theme_version = $active_theme->version; $active_theme_version_debug = $active_theme_version; $auto_updates = array(); $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' ); if ( $auto_updates_enabled ) { $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); } if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) { $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version']; $active_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version ); $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version ); } $active_theme_author_uri = $active_theme->display( 'AuthorURI' ); if ( $active_theme->parent_theme ) { $active_theme_parent_theme = sprintf( __( '%1$s (%2$s)' ), $active_theme->parent_theme, $active_theme->template ); $active_theme_parent_theme_debug = sprintf( '%s (%s)', $active_theme->parent_theme, $active_theme->template ); } else { $active_theme_parent_theme = __( 'None' ); $active_theme_parent_theme_debug = 'none'; } $info['wp-active-theme']['fields'] = array( 'name' => array( 'label' => __( 'Name' ), 'value' => sprintf( __( '%1$s (%2$s)' ), $active_theme->name, $active_theme->stylesheet ), ), 'version' => array( 'label' => __( 'Version' ), 'value' => $active_theme_version, 'debug' => $active_theme_version_debug, ), 'author' => array( 'label' => __( 'Author' ), 'value' => wp_kses( $active_theme->author, array() ), ), 'author_website' => array( 'label' => __( 'Author website' ), 'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ), 'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ), ), 'parent_theme' => array( 'label' => __( 'Parent theme' ), 'value' => $active_theme_parent_theme, 'debug' => $active_theme_parent_theme_debug, ), 'theme_features' => array( 'label' => __( 'Theme features' ), 'value' => implode( ', ', $theme_features ), ), 'theme_path' => array( 'label' => __( 'Theme directory location' ), 'value' => get_stylesheet_directory(), ), ); if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $active_theme->stylesheet ] ) ) { $item = $transient->response[ $active_theme->stylesheet ]; } elseif ( isset( $transient->no_update[ $active_theme->stylesheet ] ) ) { $item = $transient->no_update[ $active_theme->stylesheet ]; } else { $item = array( 'theme' => $active_theme->stylesheet, 'new_version' => $active_theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $active_theme->stylesheet, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Enabled' ); } else { $auto_updates_string = __( 'Disabled' ); } $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled ); $info['wp-active-theme']['fields']['auto_update'] = array( 'label' => __( 'Auto-updates' ), 'value' => $auto_updates_string, 'debug' => $auto_updates_string, ); } $parent_theme = $active_theme->parent(); if ( $parent_theme ) { $parent_theme_version = $parent_theme->version; $parent_theme_version_debug = $parent_theme_version; if ( array_key_exists( $parent_theme->stylesheet, $theme_updates ) ) { $parent_theme_update_new_version = $theme_updates[ $parent_theme->stylesheet ]->update['new_version']; $parent_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $parent_theme_update_new_version ); $parent_theme_version_debug .= sprintf( ' (latest version: %s)', $parent_theme_update_new_version ); } $parent_theme_author_uri = $parent_theme->display( 'AuthorURI' ); $info['wp-parent-theme']['fields'] = array( 'name' => array( 'label' => __( 'Name' ), 'value' => sprintf( __( '%1$s (%2$s)' ), $parent_theme->name, $parent_theme->stylesheet ), ), 'version' => array( 'label' => __( 'Version' ), 'value' => $parent_theme_version, 'debug' => $parent_theme_version_debug, ), 'author' => array( 'label' => __( 'Author' ), 'value' => wp_kses( $parent_theme->author, array() ), ), 'author_website' => array( 'label' => __( 'Author website' ), 'value' => ( $parent_theme_author_uri ? $parent_theme_author_uri : __( 'Undefined' ) ), 'debug' => ( $parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)' ), ), 'theme_path' => array( 'label' => __( 'Theme directory location' ), 'value' => get_template_directory(), ), ); if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) { $item = $transient->response[ $parent_theme->stylesheet ]; } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) { $item = $transient->no_update[ $parent_theme->stylesheet ]; } else { $item = array( 'theme' => $parent_theme->stylesheet, 'new_version' => $parent_theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true ); } if ( $enabled ) { $parent_theme_auto_update_string = __( 'Enabled' ); } else { $parent_theme_auto_update_string = __( 'Disabled' ); } $parent_theme_auto_update_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $parent_theme, $enabled ); $info['wp-parent-theme']['fields']['auto_update'] = array( 'label' => __( 'Auto-update' ), 'value' => $parent_theme_auto_update_string, 'debug' => $parent_theme_auto_update_string, ); } } $all_themes = wp_get_themes(); foreach ( $all_themes as $theme_slug => $theme ) { if ( $active_theme->stylesheet === $theme_slug ) { continue; } if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) { continue; } $theme_version = $theme->version; $theme_author = $theme->author; $theme_author = wp_kses( $theme_author, array() ); $theme_version_string = __( 'No version or author information is available.' ); $theme_version_string_debug = 'undefined'; if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) { $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author ); $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author ); } else { if ( ! empty( $theme_author ) ) { $theme_version_string = sprintf( __( 'By %s' ), $theme_author ); $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author ); } if ( ! empty( $theme_version ) ) { $theme_version_string = sprintf( __( 'Version %s' ), $theme_version ); $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version ); } } if ( array_key_exists( $theme_slug, $theme_updates ) ) { $theme_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] ); $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] ); } if ( $auto_updates_enabled ) { if ( isset( $transient->response[ $theme_slug ] ) ) { $item = $transient->response[ $theme_slug ]; } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) { $item = $transient->no_update[ $theme_slug ]; } else { $item = array( 'theme' => $theme_slug, 'new_version' => $theme->version, 'url' => '', 'package' => '', 'requires' => '', 'requires_php' => '', ); } $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; } else { $enabled = in_array( $theme_slug, $auto_updates, true ); } if ( $enabled ) { $auto_updates_string = __( 'Auto-updates enabled' ); } else { $auto_updates_string = __( 'Auto-updates disabled' ); } $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled ); $theme_version_string .= ' | ' . $auto_updates_string; $theme_version_string_debug .= ', ' . $auto_updates_string; } $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array( 'label' => sprintf( __( '%1$s (%2$s)' ), $theme->name, $theme_slug ), 'value' => $theme_version_string, 'debug' => $theme_version_string_debug, ); } if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); $info['wp-filesystem']['fields']['mu-plugins'] = array( 'label' => __( 'The must use plugins directory' ), 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ), ); } $info = apply_filters( 'debug_information', $info ); return $info; } public static function get_mysql_var( $mysql_var ) { global $wpdb; $result = $wpdb->get_row( $wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ), ARRAY_A ); if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) { return $result['Value']; } return null; } public static function format( $info_array, $data_type ) { $return = "`\n"; foreach ( $info_array as $section => $details ) { if ( empty( $details['fields'] ) || ( isset( $details['private'] ) && $details['private'] ) ) { continue; } $section_label = 'debug' === $data_type ? $section : $details['label']; $return .= sprintf( "### %s%s ###\n\n", $section_label, ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' ) ); foreach ( $details['fields'] as $field_name => $field ) { if ( isset( $field['private'] ) && true === $field['private'] ) { continue; } if ( 'debug' === $data_type && isset( $field['debug'] ) ) { $debug_data = $field['debug']; } else { $debug_data = $field['value']; } if ( is_array( $debug_data ) ) { $value = ''; foreach ( $debug_data as $sub_field_name => $sub_field_value ) { $value .= sprintf( "\n\t%s: %s", $sub_field_name, $sub_field_value ); } } elseif ( is_bool( $debug_data ) ) { $value = $debug_data ? 'true' : 'false'; } elseif ( empty( $debug_data ) && '0' !== $debug_data ) { $value = 'undefined'; } else { $value = $debug_data; } if ( 'debug' === $data_type ) { $label = $field_name; } else { $label = $field['label']; } $return .= sprintf( "%s: %s\n", $label, $value ); } $return .= "\n"; } $return .= '`'; return $return; } public static function get_database_size() { global $wpdb; $size = 0; $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A ); if ( $wpdb->num_rows > 0 ) { foreach ( $rows as $row ) { $size += $row['Data_length'] + $row['Index_length']; } } return (int) $size; } public static function get_sizes() { $size_db = self::get_database_size(); $upload_dir = wp_get_upload_dir(); if ( function_exists( 'ini_get' ) ) { $max_execution_time = ini_get( 'max_execution_time' ); } if ( empty( $max_execution_time ) ) { $max_execution_time = 30; } if ( $max_execution_time > 20 ) { $max_execution_time -= 2; } $paths = array( 'wordpress_size' => untrailingslashit( ABSPATH ), 'themes_size' => get_theme_root(), 'plugins_size' => WP_PLUGIN_DIR, 'uploads_size' => $upload_dir['basedir'], ); $exclude = $paths; unset( $exclude['wordpress_size'] ); $exclude = array_values( $exclude ); $size_total = 0; $all_sizes = array(); foreach ( $paths as $name => $path ) { $dir_size = null; $results = array( 'path' => $path, 'raw' => 0, ); if ( microtime( true ) - WP_START_TIMESTAMP < $max_execution_time ) { if ( 'wordpress_size' === $name ) { $dir_size = recurse_dirsize( $path, $exclude, $max_execution_time ); } else { $dir_size = recurse_dirsize( $path, null, $max_execution_time ); } } if ( false === $dir_size ) { $results['size'] = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' ); $results['debug'] = 'not accessible'; $size_total = null; } elseif ( null === $dir_size ) { $results['size'] = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' ); $results['debug'] = 'timeout while calculating size'; $size_total = null; } else { if ( null !== $size_total ) { $size_total += $dir_size; } $results['raw'] = $dir_size; $results['size'] = size_format( $dir_size, 2 ); $results['debug'] = $results['size'] . " ({$dir_size} bytes)"; } $all_sizes[ $name ] = $results; } if ( $size_db > 0 ) { $database_size = size_format( $size_db, 2 ); $all_sizes['database_size'] = array( 'raw' => $size_db, 'size' => $database_size, 'debug' => $database_size . " ({$size_db} bytes)", ); } else { $all_sizes['database_size'] = array( 'size' => __( 'Not available' ), 'debug' => 'not available', ); } if ( null !== $size_total && $size_db > 0 ) { $total_size = $size_total + $size_db; $total_size_mb = size_format( $total_size, 2 ); $all_sizes['total_size'] = array( 'raw' => $total_size, 'size' => $total_size_mb, 'debug' => $total_size_mb . " ({$total_size} bytes)", ); } else { $all_sizes['total_size'] = array( 'size' => __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ), 'debug' => 'not available', ); } return $all_sizes; } } 0) ); if ( $categories ) { foreach ( $categories as $category ) { if ( $current_cat != $category->term_id && $category_parent == $category->parent) { $pad = str_repeat( '– ', $level ); $category->name = esc_html( $category->name ); echo "\n\t"; wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories ); } } } else { return false; } } function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' ); register_setting( $option_group, $option_name, $sanitize_callback ); } function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' ); unregister_setting( $option_group, $option_name, $sanitize_callback ); } function codepress_get_lang( $filename ) { _deprecated_function( __FUNCTION__, '3.0.0' ); } function codepress_footer_js() { _deprecated_function( __FUNCTION__, '3.0.0' ); } function use_codepress() { _deprecated_function( __FUNCTION__, '3.0.0' ); } function get_author_user_ids() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); } function get_editable_authors( $user_id ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( !$editable ) { return false; } else { $editable = join(',', $editable); $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); } return apply_filters('get_editable_authors', $authors); } function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( ! $user = get_userdata( $user_id ) ) return array(); $post_type_obj = get_post_type_object($post_type); if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) return array($user->ID); else return array(); } if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); if ( $exclude_zeros ) $query .= " AND meta_value != '0'"; return $wpdb->get_col( $query ); } function get_nonauthor_user_ids() { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( !is_multisite() ) $level_key = $wpdb->get_blog_prefix() . 'user_level'; else $level_key = $wpdb->get_blog_prefix() . 'capabilities'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); } if ( ! class_exists( 'WP_User_Search', false ) ) : class WP_User_Search { var $results; var $search_term; var $page; var $role; var $raw_page; var $users_per_page = 50; var $first_user; var $last_user; var $query_limit; var $query_orderby; var $query_from; var $query_where; var $total_users_for_query = 0; var $too_many_total_users = false; var $search_errors; var $paging_text; function __construct( $search_term = '', $page = '', $role = '' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' ); $this->search_term = wp_unslash( $search_term ); $this->raw_page = ( '' == $page ) ? false : (int) $page; $this->page = ( '' == $page ) ? 1 : (int) $page; $this->role = $role; $this->prepare_query(); $this->query(); $this->do_paging(); } public function WP_User_Search( $search_term = '', $page = '', $role = '' ) { self::__construct( $search_term, $page, $role ); } public function prepare_query() { global $wpdb; $this->first_user = ($this->page - 1) * $this->users_per_page; $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page); $this->query_orderby = ' ORDER BY user_login'; $search_sql = ''; if ( $this->search_term ) { $searches = array(); $search_sql = 'AND ('; foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); $search_sql .= implode(' OR ', $searches); $search_sql .= ')'; } $this->query_from = " FROM $wpdb->users"; $this->query_where = " WHERE 1=1 $search_sql"; if ( $this->role ) { $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); } elseif ( is_multisite() ) { $level_key = $wpdb->prefix . 'capabilities'; $this->query_from .= ", $wpdb->usermeta"; $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; } do_action_ref_array( 'pre_user_search', array( &$this ) ); } public function query() { global $wpdb; $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); if ( $this->results ) $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); else $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); } function prepare_vars_for_template_usage() {} public function do_paging() { if ( $this->total_users_for_query > $this->users_per_page ) { $args = array(); if ( ! empty($this->search_term) ) $args['usersearch'] = urlencode($this->search_term); if ( ! empty($this->role) ) $args['role'] = urlencode($this->role); $this->paging_text = paginate_links( array( 'total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => $args ) ); if ( $this->paging_text ) { $this->paging_text = sprintf( '' . __( 'Displaying %1$s–%2$s of %3$s' ) . '%s', number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), number_format_i18n( $this->total_users_for_query ), $this->paging_text ); } } } public function get_results() { return (array) $this->results; } function page_links() { echo $this->paging_text; } function results_are_paged() { if ( $this->paging_text ) return true; return false; } function is_search() { if ( $this->search_term ) return true; return false; } } endif; function get_others_unpublished_posts( $user_id, $type = 'any' ) { _deprecated_function( __FUNCTION__, '3.1.0' ); global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( in_array($type, array('draft', 'pending')) ) $type_sql = " post_status = '$type' "; else $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; if ( !$editable ) { $other_unpubs = ''; } else { $editable = join(',', $editable); $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); } return apply_filters('get_others_drafts', $other_unpubs); } function get_others_drafts($user_id) { _deprecated_function( __FUNCTION__, '3.1.0' ); return get_others_unpublished_posts($user_id, 'draft'); } function get_others_pending($user_id) { _deprecated_function( __FUNCTION__, '3.1.0' ); return get_others_unpublished_posts($user_id, 'pending'); } function wp_dashboard_quick_press_output() { _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' ); wp_dashboard_quick_press(); } function wp_tiny_mce( $teeny = false, $settings = false ) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); static $num = 1; if ( ! class_exists( '_WP_Editors', false ) ) require_once ABSPATH . WPINC . '/class-wp-editor.php'; $editor_id = 'content' . $num++; $set = array( 'teeny' => $teeny, 'tinymce' => $settings ? $settings : true, 'quicktags' => false ); $set = _WP_Editors::parse_settings($editor_id, $set); _WP_Editors::editor_settings($editor_id, $set); } function wp_preload_dialogs() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function wp_print_editor_js() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function wp_quicktags() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); } function screen_layout( $screen ) { _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' ); $current_screen = get_current_screen(); if ( ! $current_screen ) return ''; ob_start(); $current_screen->render_screen_layout(); return ob_get_clean(); } function screen_options( $screen ) { _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' ); $current_screen = get_current_screen(); if ( ! $current_screen ) return ''; ob_start(); $current_screen->render_per_page_options(); return ob_get_clean(); } function screen_meta( $screen ) { $current_screen = get_current_screen(); $current_screen->render_screen_meta(); } function favorite_actions() { _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' ); } function media_upload_image() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_audio() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_video() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function media_upload_file() { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); } function type_url_form_image() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" ); return wp_media_insert_url_form( 'image' ); } function type_url_form_audio() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" ); return wp_media_insert_url_form( 'audio' ); } function type_url_form_video() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" ); return wp_media_insert_url_form( 'video' ); } function type_url_form_file() { _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" ); return wp_media_insert_url_form( 'file' ); } function add_contextual_help( $screen, $help ) { _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' ); if ( is_string( $screen ) ) $screen = convert_to_screen( $screen ); WP_Screen::add_old_compat_help( $screen, $help ); } function get_allowed_themes() { _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" ); $themes = wp_get_themes( array( 'allowed' => true ) ); $wp_themes = array(); foreach ( $themes as $theme ) { $wp_themes[ $theme->get('Name') ] = $theme; } return $wp_themes; } function get_broken_themes() { _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" ); $themes = wp_get_themes( array( 'errors' => true ) ); $broken = array(); foreach ( $themes as $theme ) { $name = $theme->get('Name'); $broken[ $name ] = array( 'Name' => $name, 'Title' => $name, 'Description' => $theme->errors()->get_error_message(), ); } return $broken; } function current_theme_info() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); return wp_get_theme(); } function _insert_into_post_button( $type ) { _deprecated_function( __FUNCTION__, '3.5.0' ); } function _media_button($title, $icon, $type, $id) { _deprecated_function( __FUNCTION__, '3.5.0' ); } function get_post_to_edit( $id ) { _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); return get_post( $id, OBJECT, 'edit' ); } function get_default_page_to_edit() { _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" ); $page = get_default_post_to_edit(); $page->post_type = 'page'; return $page; } function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' ); return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) ); } function wp_nav_menu_locations_meta_box() { _deprecated_function( __FUNCTION__, '3.6.0' ); } function wp_update_core($current, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Core_Upgrader(); return $upgrader->upgrade($current); } function wp_update_plugin($plugin, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Plugin_Upgrader(); return $upgrader->upgrade($plugin); } function wp_update_theme($theme, $feedback = '') { _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' ); if ( !empty($feedback) ) add_filter('update_feedback', $feedback); require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new Theme_Upgrader(); return $upgrader->upgrade($theme); } function the_attachment_links( $id = false ) { _deprecated_function( __FUNCTION__, '3.7.0' ); } function screen_icon() { _deprecated_function( __FUNCTION__, '3.8.0' ); echo get_screen_icon(); } function get_screen_icon() { _deprecated_function( __FUNCTION__, '3.8.0' ); return ''; } function wp_dashboard_incoming_links_output() {} function wp_dashboard_secondary_output() {} function wp_dashboard_incoming_links() {} function wp_dashboard_incoming_links_control() {} function wp_dashboard_plugins() {} function wp_dashboard_primary_control() {} function wp_dashboard_recent_comments_control() {} function wp_dashboard_secondary() {} function wp_dashboard_secondary_control() {} function wp_dashboard_plugins_output( $rss, $args = array() ) { _deprecated_function( __FUNCTION__, '4.8.0' ); $popular = fetch_feed( $args['url']['popular'] ); if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { $plugin_slugs = array_keys( get_plugins() ); set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); } echo '
              '; foreach ( array( $popular ) as $feed ) { if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) continue; $items = $feed->get_items(0, 5); while ( true ) { if ( 0 === count($items) ) continue 2; $item_key = array_rand($items); $item = $items[$item_key]; list($link, $frag) = explode( '#', $item->get_link() ); $link = esc_url($link); if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) $slug = $matches[1]; else { unset( $items[$item_key] ); continue; } reset( $plugin_slugs ); foreach ( $plugin_slugs as $plugin_slug ) { if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { unset( $items[$item_key] ); continue 2; } } break; } while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) unset($items[$item_key]); if ( !isset($items[$item_key]) ) continue; $raw_title = $item->get_title(); $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; echo '
            • ' . __( 'Popular Plugin' ) . ': ' . esc_html( $raw_title ) . ' (' . __( 'Install' ) . ')
            • '; $feed->__destruct(); unset( $feed ); } echo '
            '; } function _relocate_children( $old_ID, $new_ID ) { _deprecated_function( __FUNCTION__, '3.9.0' ); } function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); global $_wp_last_object_menu; $_wp_last_object_menu++; return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu); } function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); global $_wp_last_utility_menu; $_wp_last_utility_menu++; return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu); } function post_form_autocomplete_off() { global $is_safari, $is_chrome; _deprecated_function( __FUNCTION__, '4.6.0' ); if ( $is_safari || $is_chrome ) { echo ' autocomplete="off"'; } } function options_permalink_add_js() { ?> - - admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) ); add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) ); } public function init() { $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) ); if ( ! $page ) { return; } add_action( "load-{$page}", array( $this, 'admin_load' ) ); add_action( "load-{$page}", array( $this, 'take_action' ), 49 ); add_action( "load-{$page}", array( $this, 'handle_upload' ), 49 ); if ( $this->admin_header_callback ) { add_action( "admin_head-{$page}", $this->admin_header_callback, 51 ); } } public function admin_load() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

            ' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '

            ' . '

            ' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '

            ' . '

            ' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '

            ' . '

            ' . __( 'Do not forget to click on the Save Changes button when you are finished.' ) . '

            ', ) ); get_current_screen()->set_help_sidebar( '

            ' . __( 'For more information:' ) . '

            ' . '

            ' . __( 'Documentation on Custom Background' ) . '

            ' . '

            ' . __( 'Support' ) . '

            ' ); wp_enqueue_media(); wp_enqueue_script( 'custom-background' ); wp_enqueue_style( 'wp-color-picker' ); } public function take_action() { if ( empty( $_POST ) ) { return; } if ( isset( $_POST['reset-background'] ) ) { check_admin_referer( 'custom-background-reset', '_wpnonce-custom-background-reset' ); remove_theme_mod( 'background_image' ); remove_theme_mod( 'background_image_thumb' ); $this->updated = true; return; } if ( isset( $_POST['remove-background'] ) ) { check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' ); set_theme_mod( 'background_image', '' ); set_theme_mod( 'background_image_thumb', '' ); $this->updated = true; wp_safe_redirect( $_POST['_wp_http_referer'] ); return; } if ( isset( $_POST['background-preset'] ) ) { check_admin_referer( 'custom-background' ); if ( in_array( $_POST['background-preset'], array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) { $preset = $_POST['background-preset']; } else { $preset = 'default'; } set_theme_mod( 'background_preset', $preset ); } if ( isset( $_POST['background-position'] ) ) { check_admin_referer( 'custom-background' ); $position = explode( ' ', $_POST['background-position'] ); if ( in_array( $position[0], array( 'left', 'center', 'right' ), true ) ) { $position_x = $position[0]; } else { $position_x = 'left'; } if ( in_array( $position[1], array( 'top', 'center', 'bottom' ), true ) ) { $position_y = $position[1]; } else { $position_y = 'top'; } set_theme_mod( 'background_position_x', $position_x ); set_theme_mod( 'background_position_y', $position_y ); } if ( isset( $_POST['background-size'] ) ) { check_admin_referer( 'custom-background' ); if ( in_array( $_POST['background-size'], array( 'auto', 'contain', 'cover' ), true ) ) { $size = $_POST['background-size']; } else { $size = 'auto'; } set_theme_mod( 'background_size', $size ); } if ( isset( $_POST['background-repeat'] ) ) { check_admin_referer( 'custom-background' ); $repeat = $_POST['background-repeat']; if ( 'no-repeat' !== $repeat ) { $repeat = 'repeat'; } set_theme_mod( 'background_repeat', $repeat ); } if ( isset( $_POST['background-attachment'] ) ) { check_admin_referer( 'custom-background' ); $attachment = $_POST['background-attachment']; if ( 'fixed' !== $attachment ) { $attachment = 'scroll'; } set_theme_mod( 'background_attachment', $attachment ); } if ( isset( $_POST['background-color'] ) ) { check_admin_referer( 'custom-background' ); $color = preg_replace( '/[^0-9a-fA-F]/', '', $_POST['background-color'] ); if ( strlen( $color ) === 6 || strlen( $color ) === 3 ) { set_theme_mod( 'background_color', $color ); } else { set_theme_mod( 'background_color', '' ); } } $this->updated = true; } public function admin_page() { ?> -
            -

            - - -
            -

            - Customizer.' ), admin_url( 'customize.php?autofocus[control]=background_image' ) ); ?> -

            -
            - - - updated ) ) { ?> -
            -

            - Visit your site to see how it looks.' ), home_url( '/' ) ); ?> -

            -
            - - -

            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

            -
            - - - - - - array( 'label' => __( 'Top Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center top' => array( 'label' => __( 'Top' ), 'icon' => 'dashicons dashicons-arrow-up-alt', ), 'right top' => array( 'label' => __( 'Top Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), array( 'left center' => array( 'label' => __( 'Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center center' => array( 'label' => __( 'Center' ), 'icon' => 'background-position-center-icon', ), 'right center' => array( 'label' => __( 'Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), array( 'left bottom' => array( 'label' => __( 'Bottom Left' ), 'icon' => 'dashicons dashicons-arrow-left-alt', ), 'center bottom' => array( 'label' => __( 'Bottom' ), 'icon' => 'dashicons dashicons-arrow-down-alt', ), 'right bottom' => array( 'label' => __( 'Bottom Right' ), 'icon' => 'dashicons dashicons-arrow-right-alt', ), ), ); ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            - -
            - false ); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); } $file = wp_handle_upload( $uploaded_file, $overrides ); if ( isset( $file['error'] ) ) { wp_die( $file['error'] ); } $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = wp_basename( $file ); $attachment = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-background', ); $id = wp_insert_attachment( $attachment, $file ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); set_theme_mod( 'background_image', esc_url_raw( $url ) ); $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); do_action( 'wp_create_file_in_uploads', $file, $id ); $this->updated = true; } public function ajax_background_add() { check_ajax_referer( 'background-add', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() ); wp_send_json_success(); } public function attachment_fields_to_edit( $form_fields ) { return $form_fields; } public function filter_upload_tabs( $tabs ) { return $tabs; } public function wp_set_background_image() { check_ajax_referer( 'custom-background' ); if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) { exit; } $attachment_id = absint( $_POST['attachment_id'] ); $sizes = array_keys( apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ) ); $size = 'thumbnail'; if ( in_array( $_POST['size'], $sizes, true ) ) { $size = esc_attr( $_POST['size'] ); } update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); $url = wp_get_attachment_image_src( $attachment_id, $size ); $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); exit; } } domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ) ); $redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request ); if ( $redirect_user_admin_request ) { wp_redirect( user_admin_url() ); exit; } unset( $redirect_user_admin_request ); - -> - - - - - <?php _e( 'WordPress › Database Repair' ); ?> - - - - - -' . __( 'Allow automatic database repair' ) . ''; echo '

            '; printf( __( 'To allow use of this page to automatically repair database problems, please add the following line to your %s file. Once this line is added to your config, reload this page.' ), 'wp-config.php' ); echo "

            define('WP_ALLOW_REPAIR', true);

            "; $default_key = 'put your unique phrase here'; $missing_key = false; $duplicated_keys = array(); foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) { if ( defined( $key ) ) { $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] ); } else { $missing_key = true; } } if ( isset( $duplicated_keys[ $default_key ] ) ) { $duplicated_keys[ $default_key ] = true; } $duplicated_keys = array_filter( $duplicated_keys ); if ( $duplicated_keys || $missing_key ) { echo '

            ' . __( 'Check secret keys' ) . '

            '; echo '

            ' . sprintf( __( 'While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the WordPress.org secret key service.' ), 'wp-config.php', 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '

            '; } } elseif ( isset( $_GET['repair'] ) ) { echo '

            ' . __( 'Database repair results' ) . '

            '; $optimize = 2 == $_GET['repair']; $okay = true; $problems = array(); $tables = $wpdb->tables(); $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->sitecategories ) ); if ( is_multisite() && ! $wpdb->get_var( $query ) ) { unset( $tables['sitecategories'] ); } $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); foreach ( $tables as $table ) { $check = $wpdb->get_row( "CHECK TABLE $table" ); echo '

            '; if ( 'OK' === $check->Msg_text ) { printf( __( 'The %s table is okay.' ), "$table" ); } else { printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table…' ), "$table", "$check->Msg_text" ); $repair = $wpdb->get_row( "REPAIR TABLE $table" ); echo '
                '; if ( 'OK' === $repair->Msg_text ) { printf( __( 'Successfully repaired the %s table.' ), "$table" ); } else { printf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "$table", "$repair->Msg_text" ) . '
            '; $problems[ $table ] = $repair->Msg_text; $okay = false; } } if ( $okay && $optimize ) { $analyze = $wpdb->get_row( "ANALYZE TABLE $table" ); echo '
                '; if ( 'Table is already up to date' === $analyze->Msg_text ) { printf( __( 'The %s table is already optimized.' ), "$table" ); } else { $optimize = $wpdb->get_row( "OPTIMIZE TABLE $table" ); echo '
                '; if ( 'OK' === $optimize->Msg_text || 'Table is already up to date' === $optimize->Msg_text ) { printf( __( 'Successfully optimized the %s table.' ), "$table" ); } else { printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "$table", "$optimize->Msg_text" ); } } } echo '

            '; } if ( $problems ) { printf( '

            ' . __( 'Some database problems could not be repaired. Please copy-and-paste the following list of errors to the WordPress support forums to get additional assistance.' ) . '

            ', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); $problem_output = ''; foreach ( $problems as $table => $problem ) { $problem_output .= "$table: $problem\n"; } echo '

            '; } else { echo '

            ' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "

            define('WP_ALLOW_REPAIR', true);

            "; } } else { echo '

            ' . __( 'WordPress database repair' ) . '

            '; if ( isset( $_GET['referrer'] ) && 'is_blog_installed' === $_GET['referrer'] ) { echo '

            ' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '

            '; } else { echo '

            ' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '

            '; } ?> -

            -

            -

            - - - -getTimestamp() + $datetime->getOffset(); } if ( $translate ) { return wp_date( $format, $datetime->getTimestamp() ); } return $datetime->format( $format ); } function current_time( $type, $gmt = 0 ) { if ( 'timestamp' === $type || 'U' === $type ) { return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); } if ( 'mysql' === $type ) { $type = 'Y-m-d H:i:s'; } $timezone = $gmt ? new DateTimeZone( 'UTC' ) : wp_timezone(); $datetime = new DateTime( 'now', $timezone ); return $datetime->format( $type ); } function current_datetime() { return new DateTimeImmutable( 'now', wp_timezone() ); } function wp_timezone_string() { $timezone_string = get_option( 'timezone_string' ); if ( $timezone_string ) { return $timezone_string; } $offset = (float) get_option( 'gmt_offset' ); $hours = (int) $offset; $minutes = ( $offset - $hours ); $sign = ( $offset < 0 ) ? '-' : '+'; $abs_hour = abs( $hours ); $abs_mins = abs( $minutes * 60 ); $tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins ); return $tz_offset; } function wp_timezone() { return new DateTimeZone( wp_timezone_string() ); } function date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) { $timestamp = $timestamp_with_offset; if ( ! is_numeric( $timestamp ) ) { $timestamp = current_time( 'timestamp', $gmt ); } if ( 'U' === $format ) { $date = $timestamp; } elseif ( $gmt && false === $timestamp_with_offset ) { $date = wp_date( $format, null, new DateTimeZone( 'UTC' ) ); } elseif ( false === $timestamp_with_offset ) { $date = wp_date( $format ); } else { $local_time = gmdate( 'Y-m-d H:i:s', $timestamp ); $timezone = wp_timezone(); $datetime = date_create( $local_time, $timezone ); $date = wp_date( $format, $datetime->getTimestamp(), $timezone ); } $date = apply_filters( 'date_i18n', $date, $format, $timestamp, $gmt ); return $date; } function wp_date( $format, $timestamp = null, $timezone = null ) { global $wp_locale; if ( null === $timestamp ) { $timestamp = time(); } elseif ( ! is_numeric( $timestamp ) ) { return false; } if ( ! $timezone ) { $timezone = wp_timezone(); } $datetime = date_create( '@' . $timestamp ); $datetime->setTimezone( $timezone ); if ( empty( $wp_locale->month ) || empty( $wp_locale->weekday ) ) { $date = $datetime->format( $format ); } else { $format = preg_replace( '/(?get_month( $datetime->format( 'm' ) ); $weekday = $wp_locale->get_weekday( $datetime->format( 'w' ) ); for ( $i = 0; $i < $format_length; $i ++ ) { switch ( $format[ $i ] ) { case 'D': $new_format .= addcslashes( $wp_locale->get_weekday_abbrev( $weekday ), '\\A..Za..z' ); break; case 'F': $new_format .= addcslashes( $month, '\\A..Za..z' ); break; case 'l': $new_format .= addcslashes( $weekday, '\\A..Za..z' ); break; case 'M': $new_format .= addcslashes( $wp_locale->get_month_abbrev( $month ), '\\A..Za..z' ); break; case 'a': $new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'a' ) ), '\\A..Za..z' ); break; case 'A': $new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'A' ) ), '\\A..Za..z' ); break; case '\\': $new_format .= $format[ $i ]; if ( $i < $format_length ) { $new_format .= $format[ ++$i ]; } break; default: $new_format .= $format[ $i ]; break; } } $date = $datetime->format( $new_format ); $date = wp_maybe_decline_date( $date, $format ); } $date = apply_filters( 'wp_date', $date, $format, $timestamp, $timezone ); return $date; } function wp_maybe_decline_date( $date, $format = '' ) { global $wp_locale; if ( ! function_exists( '_x' ) ) { return $date; } if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) { $months = $wp_locale->month; $months_genitive = $wp_locale->month_genitive; if ( $format ) { $decline = preg_match( '#[dj]\.? F#', $format ); } else { $decline = preg_match( '#\b\d{1,2}\.? [^\d ]+\b#u', $date ); } if ( $decline ) { foreach ( $months as $key => $month ) { $months[ $key ] = '# ' . preg_quote( $month, '#' ) . '\b#u'; } foreach ( $months_genitive as $key => $month ) { $months_genitive[ $key ] = ' ' . $month; } $date = preg_replace( $months, $months_genitive, $date ); } if ( $format ) { $decline = preg_match( '#F [dj]#', $format ); } else { $decline = preg_match( '#\b[^\d ]+ \d{1,2}(st|nd|rd|th)?\b#u', trim( $date ) ); } if ( $decline ) { foreach ( $months as $key => $month ) { $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?([-–]\d{1,2})?(st|nd|rd|th)?\b#u'; } foreach ( $months_genitive as $key => $month ) { $months_genitive[ $key ] = '$1$3 ' . $month; } $date = preg_replace( $months, $months_genitive, $date ); } } $locale = get_locale(); if ( 'ca' === $locale ) { $date = preg_replace( '# de ([ao])#i', " d'\\1", $date ); } return $date; } function number_format_i18n( $number, $decimals = 0 ) { global $wp_locale; if ( isset( $wp_locale ) ) { $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); } else { $formatted = number_format( $number, absint( $decimals ) ); } return apply_filters( 'number_format_i18n', $formatted, $number, $decimals ); } function size_format( $bytes, $decimals = 0 ) { $quant = array( _x( 'YB', 'unit symbol' ) => YB_IN_BYTES, _x( 'ZB', 'unit symbol' ) => ZB_IN_BYTES, _x( 'EB', 'unit symbol' ) => EB_IN_BYTES, _x( 'PB', 'unit symbol' ) => PB_IN_BYTES, _x( 'TB', 'unit symbol' ) => TB_IN_BYTES, _x( 'GB', 'unit symbol' ) => GB_IN_BYTES, _x( 'MB', 'unit symbol' ) => MB_IN_BYTES, _x( 'KB', 'unit symbol' ) => KB_IN_BYTES, _x( 'B', 'unit symbol' ) => 1, ); if ( 0 === $bytes ) { return number_format_i18n( 0, $decimals ) . ' ' . _x( 'B', 'unit symbol' ); } foreach ( $quant as $unit => $mag ) { if ( (float) $bytes >= $mag ) { return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; } } return false; } function human_readable_duration( $duration = '' ) { if ( ( empty( $duration ) || ! is_string( $duration ) ) ) { return false; } $duration = trim( $duration ); if ( '-' === substr( $duration, 0, 1 ) ) { $duration = substr( $duration, 1 ); } $duration_parts = array_reverse( explode( ':', $duration ) ); $duration_count = count( $duration_parts ); $hour = null; $minute = null; $second = null; if ( 3 === $duration_count ) { if ( ! ( (bool) preg_match( '/^([0-9]+):([0-5]?[0-9]):([0-5]?[0-9])$/', $duration ) ) ) { return false; } list( $second, $minute, $hour ) = $duration_parts; } elseif ( 2 === $duration_count ) { if ( ! ( (bool) preg_match( '/^([0-5]?[0-9]):([0-5]?[0-9])$/', $duration ) ) ) { return false; } list( $second, $minute ) = $duration_parts; } else { return false; } $human_readable_duration = array(); if ( is_numeric( $hour ) ) { $human_readable_duration[] = sprintf( _n( '%s hour', '%s hours', $hour ), (int) $hour ); } if ( is_numeric( $minute ) ) { $human_readable_duration[] = sprintf( _n( '%s minute', '%s minutes', $minute ), (int) $minute ); } if ( is_numeric( $second ) ) { $human_readable_duration[] = sprintf( _n( '%s second', '%s seconds', $second ), (int) $second ); } return implode( ', ', $human_readable_duration ); } function get_weekstartend( $mysqlstring, $start_of_week = '' ) { $my = substr( $mysqlstring, 0, 4 ); $mm = substr( $mysqlstring, 8, 2 ); $md = substr( $mysqlstring, 5, 2 ); $day = mktime( 0, 0, 0, $md, $mm, $my ); $weekday = gmdate( 'w', $day ); if ( ! is_numeric( $start_of_week ) ) { $start_of_week = get_option( 'start_of_week' ); } if ( $weekday < $start_of_week ) { $weekday += 7; } $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); $end = $start + WEEK_IN_SECONDS - 1; return compact( 'start', 'end' ); } function maybe_serialize( $data ) { if ( is_array( $data ) || is_object( $data ) ) { return serialize( $data ); } if ( is_serialized( $data, false ) ) { return serialize( $data ); } return $data; } function maybe_unserialize( $data ) { if ( is_serialized( $data ) ) { return @unserialize( trim( $data ) ); } return $data; } function is_serialized( $data, $strict = true ) { if ( ! is_string( $data ) ) { return false; } $data = trim( $data ); if ( 'N;' === $data ) { return true; } if ( strlen( $data ) < 4 ) { return false; } if ( ':' !== $data[1] ) { return false; } if ( $strict ) { $lastc = substr( $data, -1 ); if ( ';' !== $lastc && '}' !== $lastc ) { return false; } } else { $semicolon = strpos( $data, ';' ); $brace = strpos( $data, '}' ); if ( false === $semicolon && false === $brace ) { return false; } if ( false !== $semicolon && $semicolon < 3 ) { return false; } if ( false !== $brace && $brace < 4 ) { return false; } } $token = $data[0]; switch ( $token ) { case 's': if ( $strict ) { if ( '"' !== substr( $data, -2, 1 ) ) { return false; } } elseif ( false === strpos( $data, '"' ) ) { return false; } case 'a': case 'O': return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); case 'b': case 'i': case 'd': $end = $strict ? '$' : ''; return (bool) preg_match( "/^{$token}:[0-9.E+-]+;$end/", $data ); } return false; } function is_serialized_string( $data ) { if ( ! is_string( $data ) ) { return false; } $data = trim( $data ); if ( strlen( $data ) < 4 ) { return false; } elseif ( ':' !== $data[1] ) { return false; } elseif ( ';' !== substr( $data, -1 ) ) { return false; } elseif ( 's' !== $data[0] ) { return false; } elseif ( '"' !== substr( $data, -2, 1 ) ) { return false; } else { return true; } } function xmlrpc_getposttitle( $content ) { global $post_default_title; if ( preg_match( '/(.+?)<\/title>/is', $content, $matchtitle ) ) { $post_title = $matchtitle[1]; } else { $post_title = $post_default_title; } return $post_title; } function xmlrpc_getpostcategory( $content ) { global $post_default_category; if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) { $post_category = trim( $matchcat[1], ',' ); $post_category = explode( ',', $post_category ); } else { $post_category = $post_default_category; } return $post_category; } function xmlrpc_removepostdata( $content ) { $content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content ); $content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content ); $content = trim( $content ); return $content; } function wp_extract_urls( $content ) { preg_match_all( "#([\"']?)(" . '(?:([\w-]+:)?//?)' . '[^\s()<>]+' . '[.]' . '(?:' . '\([\w\d]+\)|' . '(?:' . "[^`!()\[\]{}:'\".,<>«»“”‘’\s]|" . '(?:[:]\d+)?/?' . ')+' . ')' . ")\\1#", $content, $post_links ); $post_links = array_unique( array_map( static function( $link ) { $link = html_entity_decode( $link ); return str_replace( ';', '', $link ); }, $post_links[2] ) ); return array_values( $post_links ); } function do_enclose( $content, $post ) { global $wpdb; include_once ABSPATH . WPINC . '/class-IXR.php'; $post = get_post( $post ); if ( ! $post ) { return false; } if ( null === $content ) { $content = $post->post_content; } $post_links = array(); $pung = get_enclosed( $post->ID ); $post_links_temp = wp_extract_urls( $content ); foreach ( $pung as $link_test ) { if ( ! in_array( $link_test, $post_links_temp, true ) ) { $mids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $link_test ) . '%' ) ); foreach ( $mids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } } } foreach ( (array) $post_links_temp as $link_test ) { if ( ! in_array( $link_test, $pung, true ) ) { $test = parse_url( $link_test ); if ( false === $test ) { continue; } if ( isset( $test['query'] ) ) { $post_links[] = $link_test; } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) { $post_links[] = $link_test; } } } $post_links = apply_filters( 'enclosure_links', $post_links, $post->ID ); foreach ( (array) $post_links as $url ) { $url = strip_fragment_from_url( $url ); if ( '' !== $url && ! $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $url ) . '%' ) ) ) { $headers = wp_get_http_headers( $url ); if ( $headers ) { $len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0; $type = isset( $headers['content-type'] ) ? $headers['content-type'] : ''; $allowed_types = array( 'video', 'audio' ); $url_parts = parse_url( $url ); if ( false !== $url_parts && ! empty( $url_parts['path'] ) ) { $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION ); if ( ! empty( $extension ) ) { foreach ( wp_get_mime_types() as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $type = $mime; break; } } } } if ( in_array( substr( $type, 0, strpos( $type, '/' ) ), $allowed_types, true ) ) { add_post_meta( $post->ID, 'enclosure', "$url\n$len\n$mime\n" ); } } } } } function wp_get_http_headers( $url, $deprecated = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); } $response = wp_safe_remote_head( $url ); if ( is_wp_error( $response ) ) { return false; } return wp_remote_retrieve_headers( $response ); } function is_new_day() { global $currentday, $previousday; if ( $currentday !== $previousday ) { return 1; } else { return 0; } } function build_query( $data ) { return _http_build_query( $data, null, '&', '', false ); } function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) { $ret = array(); foreach ( (array) $data as $k => $v ) { if ( $urlencode ) { $k = urlencode( $k ); } if ( is_int( $k ) && null != $prefix ) { $k = $prefix . $k; } if ( ! empty( $key ) ) { $k = $key . '%5B' . $k . '%5D'; } if ( null === $v ) { continue; } elseif ( false === $v ) { $v = '0'; } if ( is_array( $v ) || is_object( $v ) ) { array_push( $ret, _http_build_query( $v, '', $sep, $k, $urlencode ) ); } elseif ( $urlencode ) { array_push( $ret, $k . '=' . urlencode( $v ) ); } else { array_push( $ret, $k . '=' . $v ); } } if ( null === $sep ) { $sep = ini_get( 'arg_separator.output' ); } return implode( $sep, $ret ); } function add_query_arg( ...$args ) { if ( is_array( $args[0] ) ) { if ( count( $args ) < 2 || false === $args[1] ) { $uri = $_SERVER['REQUEST_URI']; } else { $uri = $args[1]; } } else { if ( count( $args ) < 3 || false === $args[2] ) { $uri = $_SERVER['REQUEST_URI']; } else { $uri = $args[2]; } } $frag = strstr( $uri, '#' ); if ( $frag ) { $uri = substr( $uri, 0, -strlen( $frag ) ); } else { $frag = ''; } if ( 0 === stripos( $uri, 'http://' ) ) { $protocol = 'http://'; $uri = substr( $uri, 7 ); } elseif ( 0 === stripos( $uri, 'https://' ) ) { $protocol = 'https://'; $uri = substr( $uri, 8 ); } else { $protocol = ''; } if ( strpos( $uri, '?' ) !== false ) { list( $base, $query ) = explode( '?', $uri, 2 ); $base .= '?'; } elseif ( $protocol || strpos( $uri, '=' ) === false ) { $base = $uri . '?'; $query = ''; } else { $base = ''; $query = $uri; } wp_parse_str( $query, $qs ); $qs = urlencode_deep( $qs ); if ( is_array( $args[0] ) ) { foreach ( $args[0] as $k => $v ) { $qs[ $k ] = $v; } } else { $qs[ $args[0] ] = $args[1]; } foreach ( $qs as $k => $v ) { if ( false === $v ) { unset( $qs[ $k ] ); } } $ret = build_query( $qs ); $ret = trim( $ret, '?' ); $ret = preg_replace( '#=(&|$)#', '$1', $ret ); $ret = $protocol . $base . $ret . $frag; $ret = rtrim( $ret, '?' ); $ret = str_replace( '?#', '#', $ret ); return $ret; } function remove_query_arg( $key, $query = false ) { if ( is_array( $key ) ) { foreach ( $key as $k ) { $query = add_query_arg( $k, false, $query ); } return $query; } return add_query_arg( $key, false, $query ); } function wp_removable_query_args() { $removable_query_args = array( 'activate', 'activated', 'admin_email_remind_later', 'approved', 'core-major-auto-updates-saved', 'deactivate', 'delete_count', 'deleted', 'disabled', 'doing_wp_cron', 'enabled', 'error', 'hotkeys_highlight_first', 'hotkeys_highlight_last', 'ids', 'locked', 'message', 'same', 'saved', 'settings-updated', 'skipped', 'spammed', 'trashed', 'unspammed', 'untrashed', 'update', 'updated', 'wp-post-new-reload', ); return apply_filters( 'removable_query_args', $removable_query_args ); } function add_magic_quotes( $array ) { foreach ( (array) $array as $k => $v ) { if ( is_array( $v ) ) { $array[ $k ] = add_magic_quotes( $v ); } elseif ( is_string( $v ) ) { $array[ $k ] = addslashes( $v ); } else { continue; } } return $array; } function wp_remote_fopen( $uri ) { $parsed_url = parse_url( $uri ); if ( ! $parsed_url || ! is_array( $parsed_url ) ) { return false; } $options = array(); $options['timeout'] = 10; $response = wp_safe_remote_get( $uri, $options ); if ( is_wp_error( $response ) ) { return false; } return wp_remote_retrieve_body( $response ); } function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; $wp->main( $query_vars ); if ( ! isset( $wp_the_query ) ) { $wp_the_query = $wp_query; } } function get_status_header_desc( $code ) { global $wp_header_to_desc; $code = absint( $code ); if ( ! isset( $wp_header_to_desc ) ) { $wp_header_to_desc = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Reserved', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 510 => 'Not Extended', 511 => 'Network Authentication Required', ); } if ( isset( $wp_header_to_desc[ $code ] ) ) { return $wp_header_to_desc[ $code ]; } else { return ''; } } function status_header( $code, $description = '' ) { if ( ! $description ) { $description = get_status_header_desc( $code ); } if ( empty( $description ) ) { return; } $protocol = wp_get_server_protocol(); $status_header = "$protocol $code $description"; if ( function_exists( 'apply_filters' ) ) { $status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol ); } if ( ! headers_sent() ) { header( $status_header, true, $code ); } } function wp_get_nocache_headers() { $headers = array( 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', ); if ( function_exists( 'apply_filters' ) ) { $headers = (array) apply_filters( 'nocache_headers', $headers ); } $headers['Last-Modified'] = false; return $headers; } function nocache_headers() { if ( headers_sent() ) { return; } $headers = wp_get_nocache_headers(); unset( $headers['Last-Modified'] ); header_remove( 'Last-Modified' ); foreach ( $headers as $name => $field_value ) { header( "{$name}: {$field_value}" ); } } function cache_javascript_headers() { $expiresOffset = 10 * DAY_IN_SECONDS; header( 'Content-Type: text/javascript; charset=' . get_bloginfo( 'charset' ) ); header( 'Vary: Accept-Encoding' ); header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiresOffset ) . ' GMT' ); } function get_num_queries() { global $wpdb; return $wpdb->num_queries; } function bool_from_yn( $yn ) { return ( 'y' === strtolower( $yn ) ); } function do_feed() { global $wp_query; $feed = get_query_var( 'feed' ); $feed = preg_replace( '/^_+/', '', $feed ); if ( '' === $feed || 'feed' === $feed ) { $feed = get_default_feed(); } if ( ! has_action( "do_feed_{$feed}" ) ) { wp_die( __( '<strong>Error</strong>: This is not a valid feed template.' ), '', array( 'response' => 404 ) ); } do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed ); } function do_feed_rdf() { load_template( ABSPATH . WPINC . '/feed-rdf.php' ); } function do_feed_rss() { load_template( ABSPATH . WPINC . '/feed-rss.php' ); } function do_feed_rss2( $for_comments ) { if ( $for_comments ) { load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' ); } else { load_template( ABSPATH . WPINC . '/feed-rss2.php' ); } } function do_feed_atom( $for_comments ) { if ( $for_comments ) { load_template( ABSPATH . WPINC . '/feed-atom-comments.php' ); } else { load_template( ABSPATH . WPINC . '/feed-atom.php' ); } } function do_robots() { header( 'Content-Type: text/plain; charset=utf-8' ); do_action( 'do_robotstxt' ); $output = "User-agent: *\n"; $public = get_option( 'blog_public' ); $site_url = parse_url( site_url() ); $path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : ''; $output .= "Disallow: $path/wp-admin/\n"; $output .= "Allow: $path/wp-admin/admin-ajax.php\n"; echo apply_filters( 'robots_txt', $output, $public ); } function do_favicon() { do_action( 'do_faviconico' ); wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-blue-white-bg.png' ) ) ); exit; } function is_blog_installed() { global $wpdb; if ( wp_cache_get( 'is_blog_installed' ) ) { return true; } $suppress = $wpdb->suppress_errors(); if ( ! wp_installing() ) { $alloptions = wp_load_alloptions(); } if ( ! isset( $alloptions['siteurl'] ) ) { $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); } else { $installed = $alloptions['siteurl']; } $wpdb->suppress_errors( $suppress ); $installed = ! empty( $installed ); wp_cache_set( 'is_blog_installed', $installed ); if ( $installed ) { return true; } if ( defined( 'WP_REPAIRING' ) ) { return true; } $suppress = $wpdb->suppress_errors(); $wp_tables = $wpdb->tables(); foreach ( $wp_tables as $table ) { if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) { continue; } if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) { continue; } $described_table = $wpdb->get_results( "DESCRIBE $table;" ); if ( ( ! $described_table && empty( $wpdb->last_error ) ) || ( is_array( $described_table ) && 0 === count( $described_table ) ) ) { continue; } wp_load_translations_early(); $wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' ); dead_db(); } $wpdb->suppress_errors( $suppress ); wp_cache_set( 'is_blog_installed', false ); return false; } function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) { $actionurl = str_replace( '&', '&', $actionurl ); return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) ); } function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) { $name = esc_attr( $name ); $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; if ( $referer ) { $nonce_field .= wp_referer_field( false ); } if ( $echo ) { echo $nonce_field; } return $nonce_field; } function wp_referer_field( $echo = true ) { $referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; if ( $echo ) { echo $referer_field; } return $referer_field; } function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) { $ref = wp_get_original_referer(); if ( ! $ref ) { $ref = ( 'previous' === $jump_back_to ) ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] ); } $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />'; if ( $echo ) { echo $orig_referer_field; } return $orig_referer_field; } function wp_get_referer() { if ( ! function_exists( 'wp_validate_redirect' ) ) { return false; } $ref = wp_get_raw_referer(); if ( $ref && wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref && home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref ) { return wp_validate_redirect( $ref, false ); } return false; } function wp_get_raw_referer() { if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { return wp_unslash( $_REQUEST['_wp_http_referer'] ); } elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { return wp_unslash( $_SERVER['HTTP_REFERER'] ); } return false; } function wp_get_original_referer() { if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) { return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false ); } return false; } function wp_mkdir_p( $target ) { $wrapper = null; if ( wp_is_stream( $target ) ) { list( $wrapper, $target ) = explode( '://', $target, 2 ); } $target = str_replace( '//', '/', $target ); if ( null !== $wrapper ) { $target = $wrapper . '://' . $target; } $target = rtrim( $target, '/' ); if ( empty( $target ) ) { $target = '/'; } if ( file_exists( $target ) ) { return @is_dir( $target ); } if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) { return false; } $target_parent = dirname( $target ); while ( '.' !== $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { $target_parent = dirname( $target_parent ); } $stat = @stat( $target_parent ); if ( $stat ) { $dir_perms = $stat['mode'] & 0007777; } else { $dir_perms = 0777; } if ( @mkdir( $target, $dir_perms, true ) ) { if ( ( $dir_perms & ~umask() ) != $dir_perms ) { $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) ); for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) { chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms ); } } return true; } return false; } function path_is_absolute( $path ) { if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file( $path ) ) ) { return true; } if ( realpath( $path ) == $path ) { return true; } if ( strlen( $path ) == 0 || '.' === $path[0] ) { return false; } if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) { return true; } return ( '/' === $path[0] || '\\' === $path[0] ); } function path_join( $base, $path ) { if ( path_is_absolute( $path ) ) { return $path; } return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' ); } function wp_normalize_path( $path ) { $wrapper = ''; if ( wp_is_stream( $path ) ) { list( $wrapper, $path ) = explode( '://', $path, 2 ); $wrapper .= '://'; } $path = str_replace( '\\', '/', $path ); $path = preg_replace( '|(?<=.)/+|', '/', $path ); if ( ':' === substr( $path, 1, 1 ) ) { $path = ucfirst( $path ); } return $wrapper . $path; } function get_temp_dir() { static $temp = ''; if ( defined( 'WP_TEMP_DIR' ) ) { return trailingslashit( WP_TEMP_DIR ); } if ( $temp ) { return trailingslashit( $temp ); } if ( function_exists( 'sys_get_temp_dir' ) ) { $temp = sys_get_temp_dir(); if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) { return trailingslashit( $temp ); } } $temp = ini_get( 'upload_tmp_dir' ); if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) { return trailingslashit( $temp ); } $temp = WP_CONTENT_DIR . '/'; if ( is_dir( $temp ) && wp_is_writable( $temp ) ) { return $temp; } return '/tmp/'; } function wp_is_writable( $path ) { if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { return win_is_writable( $path ); } else { return @is_writable( $path ); } } function win_is_writable( $path ) { if ( '/' === $path[ strlen( $path ) - 1 ] ) { return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' ); } elseif ( is_dir( $path ) ) { return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' ); } $should_delete_tmp_file = ! file_exists( $path ); $f = @fopen( $path, 'a' ); if ( false === $f ) { return false; } fclose( $f ); if ( $should_delete_tmp_file ) { unlink( $path ); } return true; } function wp_get_upload_dir() { return wp_upload_dir( null, false ); } function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) { static $cache = array(), $tested_paths = array(); $key = sprintf( '%d-%s', get_current_blog_id(), (string) $time ); if ( $refresh_cache || empty( $cache[ $key ] ) ) { $cache[ $key ] = _wp_upload_dir( $time ); } $uploads = apply_filters( 'upload_dir', $cache[ $key ] ); if ( $create_dir ) { $path = $uploads['path']; if ( array_key_exists( $path, $tested_paths ) ) { $uploads['error'] = $tested_paths[ $path ]; } else { if ( ! wp_mkdir_p( $path ) ) { if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; } else { $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir']; } $uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) ); } $tested_paths[ $path ] = $uploads['error']; } } return $uploads; } function _wp_upload_dir( $time = null ) { $siteurl = get_option( 'siteurl' ); $upload_path = trim( get_option( 'upload_path' ) ); if ( empty( $upload_path ) || 'wp-content/uploads' === $upload_path ) { $dir = WP_CONTENT_DIR . '/uploads'; } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { $dir = path_join( ABSPATH, $upload_path ); } else { $dir = $upload_path; } $url = get_option( 'upload_url_path' ); if ( ! $url ) { if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path == $dir ) ) { $url = WP_CONTENT_URL . '/uploads'; } else { $url = trailingslashit( $siteurl ) . $upload_path; } } if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS; } if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) { if ( ! get_site_option( 'ms_files_rewriting' ) ) { if ( defined( 'MULTISITE' ) ) { $ms_dir = '/sites/' . get_current_blog_id(); } else { $ms_dir = '/' . get_current_blog_id(); } $dir .= $ms_dir; $url .= $ms_dir; } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) { if ( defined( 'BLOGUPLOADDIR' ) ) { $dir = untrailingslashit( BLOGUPLOADDIR ); } else { $dir = ABSPATH . UPLOADS; } $url = trailingslashit( $siteurl ) . 'files'; } } $basedir = $dir; $baseurl = $url; $subdir = ''; if ( get_option( 'uploads_use_yearmonth_folders' ) ) { if ( ! $time ) { $time = current_time( 'mysql' ); } $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $subdir = "/$y/$m"; } $dir .= $subdir; $url .= $subdir; return array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $basedir, 'baseurl' => $baseurl, 'error' => false, ); } function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { $filename = sanitize_file_name( $filename ); $ext2 = null; $number = ''; $alt_filenames = array(); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); $name = pathinfo( $filename, PATHINFO_BASENAME ); if ( $ext ) { $ext = '.' . $ext; } if ( $name === $ext ) { $name = ''; } if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) { $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext ); } else { $fname = pathinfo( $filename, PATHINFO_FILENAME ); if ( $fname && preg_match( '/-(?:\d+x\d+|scaled|rotated)$/', $fname ) ) { $number = 1; $filename = str_replace( "{$fname}{$ext}", "{$fname}-{$number}{$ext}", $filename ); } $file_type = wp_check_filetype( $filename ); $mime_type = $file_type['type']; $is_image = ( ! empty( $mime_type ) && 0 === strpos( $mime_type, 'image/' ) ); $upload_dir = wp_get_upload_dir(); $lc_filename = null; $lc_ext = strtolower( $ext ); $_dir = trailingslashit( $dir ); if ( $ext && $lc_ext !== $ext ) { $lc_filename = preg_replace( '|' . preg_quote( $ext ) . '$|', $lc_ext, $filename ); } while ( file_exists( $_dir . $filename ) || ( $lc_filename && file_exists( $_dir . $lc_filename ) ) ) { $new_number = (int) $number + 1; if ( $lc_filename ) { $lc_filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $lc_filename ); } if ( '' === "{$number}{$ext}" ) { $filename = "{$filename}-{$new_number}"; } else { $filename = str_replace( array( "-{$number}{$ext}", "{$number}{$ext}" ), "-{$new_number}{$ext}", $filename ); } $number = $new_number; } if ( $lc_filename ) { $filename = $lc_filename; } $files = array(); $count = 10000; if ( $name && $ext && @is_dir( $dir ) && false !== strpos( $dir, $upload_dir['basedir'] ) ) { $files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename ); if ( null === $files ) { $files = @scandir( $dir ); } if ( ! empty( $files ) ) { $files = array_diff( $files, array( '.', '..' ) ); } if ( ! empty( $files ) ) { $count = count( $files ); $i = 0; while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) { $new_number = (int) $number + 1; $filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $filename ); $number = $new_number; $i++; } } } if ( $is_image ) { $output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type ); $alt_types = array(); if ( ! empty( $output_formats[ $mime_type ] ) ) { $alt_mime_type = $output_formats[ $mime_type ]; $alt_types = array_keys( array_intersect( $output_formats, array( $mime_type, $alt_mime_type ) ) ); $alt_types[] = $alt_mime_type; } elseif ( ! empty( $output_formats ) ) { $alt_types = array_keys( array_intersect( $output_formats, array( $mime_type ) ) ); } $alt_types = array_unique( array_diff( $alt_types, array( $mime_type ) ) ); foreach ( $alt_types as $alt_type ) { $alt_ext = wp_get_default_extension_for_mime_type( $alt_type ); if ( ! $alt_ext ) { continue; } $alt_ext = ".{$alt_ext}"; $alt_filename = preg_replace( '|' . preg_quote( $lc_ext ) . '$|', $alt_ext, $filename ); $alt_filenames[ $alt_ext ] = $alt_filename; } if ( ! empty( $alt_filenames ) ) { $alt_filenames[ $lc_ext ] = $filename; $i = 0; while ( $i <= $count && _wp_check_alternate_file_names( $alt_filenames, $_dir, $files ) ) { $new_number = (int) $number + 1; foreach ( $alt_filenames as $alt_ext => $alt_filename ) { $alt_filenames[ $alt_ext ] = str_replace( array( "-{$number}{$alt_ext}", "{$number}{$alt_ext}" ), "-{$new_number}{$alt_ext}", $alt_filename ); } $filename = str_replace( array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ), "-{$new_number}{$lc_ext}", $filename ); $number = $new_number; $i++; } } } } return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback, $alt_filenames, $number ); } function _wp_check_alternate_file_names( $filenames, $dir, $files ) { foreach ( $filenames as $filename ) { if ( file_exists( $dir . $filename ) ) { return true; } if ( ! empty( $files ) && _wp_check_existing_file_names( $filename, $files ) ) { return true; } } return false; } function _wp_check_existing_file_names( $filename, $files ) { $fname = pathinfo( $filename, PATHINFO_FILENAME ); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); if ( empty( $fname ) ) { return false; } if ( $ext ) { $ext = ".$ext"; } $regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/i'; foreach ( $files as $file ) { if ( preg_match( $regex, $file ) ) { return true; } } return false; } function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.0.0' ); } if ( empty( $name ) ) { return array( 'error' => __( 'Empty filename' ) ); } $wp_filetype = wp_check_filetype( $name ); if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) { return array( 'error' => __( 'Sorry, you are not allowed to upload this file type.' ) ); } $upload = wp_upload_dir( $time ); if ( false !== $upload['error'] ) { return $upload; } $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time, ) ); if ( ! is_array( $upload_bits_error ) ) { $upload['error'] = $upload_bits_error; return $upload; } $filename = wp_unique_filename( $upload['path'], $name ); $new_file = $upload['path'] . "/$filename"; if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) { $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir']; } else { $error_path = wp_basename( $upload['basedir'] ) . $upload['subdir']; } $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path ); return array( 'error' => $message ); } $ifp = @fopen( $new_file, 'wb' ); if ( ! $ifp ) { return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ), ); } fwrite( $ifp, $bits ); fclose( $ifp ); clearstatcache(); $stat = @ stat( dirname( $new_file ) ); $perms = $stat['mode'] & 0007777; $perms = $perms & 0000666; chmod( $new_file, $perms ); clearstatcache(); $url = $upload['url'] . "/$filename"; if ( is_multisite() ) { clean_dirsize_cache( $new_file ); } return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false, ), 'sideload' ); } function wp_ext2type( $ext ) { $ext = strtolower( $ext ); $ext2type = wp_get_ext_types(); foreach ( $ext2type as $type => $exts ) { if ( in_array( $ext, $exts, true ) ) { return $type; } } } function wp_get_default_extension_for_mime_type( $mime_type ) { $extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) ); if ( empty( $extensions[0] ) ) { return false; } return $extensions[0]; } function wp_check_filetype( $filename, $mimes = null ) { if ( empty( $mimes ) ) { $mimes = get_allowed_mime_types(); } $type = false; $ext = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!\.(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $filename, $ext_matches ) ) { $type = $mime_match; $ext = $ext_matches[1]; break; } } return compact( 'ext', 'type' ); } function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { $proper_filename = false; $wp_filetype = wp_check_filetype( $filename, $mimes ); $ext = $wp_filetype['ext']; $type = $wp_filetype['type']; if ( ! file_exists( $file ) ) { return compact( 'ext', 'type', 'proper_filename' ); } $real_mime = false; if ( $type && 0 === strpos( $type, 'image/' ) ) { $real_mime = wp_get_image_mime( $file ); if ( $real_mime && $real_mime != $type ) { $mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array( 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/tiff' => 'tif', 'image/webp' => 'webp', ) ); if ( ! empty( $mime_to_ext[ $real_mime ] ) ) { $filename_parts = explode( '.', $filename ); array_pop( $filename_parts ); $filename_parts[] = $mime_to_ext[ $real_mime ]; $new_filename = implode( '.', $filename_parts ); if ( $new_filename != $filename ) { $proper_filename = $new_filename; } $wp_filetype = wp_check_filetype( $new_filename, $mimes ); $ext = $wp_filetype['ext']; $type = $wp_filetype['type']; } else { $real_mime = false; } } } if ( $type && ! $real_mime && extension_loaded( 'fileinfo' ) ) { $finfo = finfo_open( FILEINFO_MIME_TYPE ); $real_mime = finfo_file( $finfo, $file ); finfo_close( $finfo ); $nonspecific_types = array( 'application/octet-stream', 'application/encrypted', 'application/CDFV2-encrypted', 'application/zip', ); if ( in_array( $real_mime, $nonspecific_types, true ) ) { if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ), true ) ) { $type = false; $ext = false; } } elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) { if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) { $type = false; $ext = false; } } elseif ( 'text/plain' === $real_mime ) { if ( ! in_array( $type, array( 'text/plain', 'text/csv', 'application/csv', 'text/richtext', 'text/tsv', 'text/vtt', ), true ) ) { $type = false; $ext = false; } } elseif ( 'application/csv' === $real_mime ) { if ( ! in_array( $type, array( 'text/csv', 'text/plain', 'application/csv', ), true ) ) { $type = false; $ext = false; } } elseif ( 'text/rtf' === $real_mime ) { if ( ! in_array( $type, array( 'text/rtf', 'text/plain', 'application/rtf', ), true ) ) { $type = false; $ext = false; } } else { if ( $type !== $real_mime ) { $type = false; $ext = false; } } } if ( $type ) { $allowed = get_allowed_mime_types(); if ( ! in_array( $type, $allowed, true ) ) { $type = false; $ext = false; } } return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime ); } function wp_get_image_mime( $file ) { try { if ( is_callable( 'exif_imagetype' ) ) { $imagetype = exif_imagetype( $file ); $mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false; } elseif ( function_exists( 'getimagesize' ) ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { $imagesize = getimagesize( $file ); } else { $imagesize = @getimagesize( $file ); } $mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false; } else { $mime = false; } if ( false !== $mime ) { return $mime; } $magic = file_get_contents( $file, false, null, 0, 12 ); if ( false === $magic ) { return false; } $magic = bin2hex( $magic ); if ( ( 0 === strpos( $magic, '52494646' ) ) && ( 16 === strpos( $magic, '57454250' ) ) ) { $mime = 'image/webp'; } } catch ( Exception $e ) { $mime = false; } return $mime; } function wp_get_mime_types() { return apply_filters( 'mime_types', array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tiff|tif' => 'image/tiff', 'webp' => 'image/webp', 'ico' => 'image/x-icon', 'heic' => 'image/heic', 'asf|asx' => 'video/x-ms-asf', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wm' => 'video/x-ms-wm', 'avi' => 'video/avi', 'divx' => 'video/divx', 'flv' => 'video/x-flv', 'mov|qt' => 'video/quicktime', 'mpeg|mpg|mpe' => 'video/mpeg', 'mp4|m4v' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'mkv' => 'video/x-matroska', '3gp|3gpp' => 'video/3gpp', '3g2|3gp2' => 'video/3gpp2', 'txt|asc|c|cc|h|srt' => 'text/plain', 'csv' => 'text/csv', 'tsv' => 'text/tab-separated-values', 'ics' => 'text/calendar', 'rtx' => 'text/richtext', 'css' => 'text/css', 'htm|html' => 'text/html', 'vtt' => 'text/vtt', 'dfxp' => 'application/ttaf+xml', 'mp3|m4a|m4b' => 'audio/mpeg', 'aac' => 'audio/aac', 'ra|ram' => 'audio/x-realaudio', 'wav' => 'audio/wav', 'ogg|oga' => 'audio/ogg', 'flac' => 'audio/flac', 'mid|midi' => 'audio/midi', 'wma' => 'audio/x-ms-wma', 'wax' => 'audio/x-ms-wax', 'mka' => 'audio/x-matroska', 'rtf' => 'application/rtf', 'js' => 'application/javascript', 'pdf' => 'application/pdf', 'swf' => 'application/x-shockwave-flash', 'class' => 'application/java', 'tar' => 'application/x-tar', 'zip' => 'application/zip', 'gz|gzip' => 'application/x-gzip', 'rar' => 'application/rar', '7z' => 'application/x-7z-compressed', 'exe' => 'application/x-msdownload', 'psd' => 'application/octet-stream', 'xcf' => 'application/octet-stream', 'doc' => 'application/msword', 'pot|pps|ppt' => 'application/vnd.ms-powerpoint', 'wri' => 'application/vnd.ms-write', 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel', 'mdb' => 'application/vnd.ms-access', 'mpp' => 'application/vnd.ms-project', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', 'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12', 'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote', 'oxps' => 'application/oxps', 'xps' => 'application/vnd.ms-xpsdocument', 'odt' => 'application/vnd.oasis.opendocument.text', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odb' => 'application/vnd.oasis.opendocument.database', 'odf' => 'application/vnd.oasis.opendocument.formula', 'wp|wpd' => 'application/wordperfect', 'key' => 'application/vnd.apple.keynote', 'numbers' => 'application/vnd.apple.numbers', 'pages' => 'application/vnd.apple.pages', ) ); } function wp_get_ext_types() { return apply_filters( 'ext2type', array( 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'webp' ), 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ), 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ), 'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ), 'text' => array( 'asc', 'csv', 'tsv', 'txt' ), 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ), 'code' => array( 'css', 'htm', 'html', 'php', 'js' ), ) ); } function wp_filesize( $path ) { $size = apply_filters( 'pre_wp_filesize', null, $path ); if ( is_int( $size ) ) { return $size; } $size = file_exists( $path ) ? (int) filesize( $path ) : 0; return (int) apply_filters( 'wp_filesize', $size, $path ); } function get_allowed_mime_types( $user = null ) { $t = wp_get_mime_types(); unset( $t['swf'], $t['exe'] ); if ( function_exists( 'current_user_can' ) ) { $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); } if ( empty( $unfiltered ) ) { unset( $t['htm|html'], $t['js'] ); } return apply_filters( 'upload_mimes', $t, $user ); } function wp_nonce_ays( $action ) { $title = __( 'Something went wrong.' ); $response_code = 403; if ( 'log-out' === $action ) { $title = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ); $html = $title; $html .= '</p><p>'; $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; $html .= sprintf( __( 'Do you really want to <a href="%s">log out</a>?' ), wp_logout_url( $redirect_to ) ); } else { $html = __( 'The link you followed has expired.' ); if ( wp_get_referer() ) { $html .= '</p><p>'; $html .= sprintf( '<a href="%s">%s</a>', esc_url( remove_query_arg( 'updated', wp_get_referer() ) ), __( 'Please try again.' ) ); } } wp_die( $html, $title, $response_code ); } function wp_die( $message = '', $title = '', $args = array() ) { global $wp_query; if ( is_int( $args ) ) { $args = array( 'response' => $args ); } elseif ( is_int( $title ) ) { $args = array( 'response' => $title ); $title = ''; } if ( wp_doing_ajax() ) { $callback = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); } elseif ( wp_is_json_request() ) { $callback = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) { $callback = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' ); } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { $callback = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); } elseif ( wp_is_xml_request() || isset( $wp_query ) && ( function_exists( 'is_feed' ) && is_feed() || function_exists( 'is_comment_feed' ) && is_comment_feed() || function_exists( 'is_trackback' ) && is_trackback() ) ) { $callback = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' ); } else { $callback = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); } call_user_func( $callback, $message, $title, $args ); } function _default_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( is_string( $message ) ) { if ( ! empty( $parsed_args['additional_errors'] ) ) { $message = array_merge( array( $message ), wp_list_pluck( $parsed_args['additional_errors'], 'message' ) ); $message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>"; } $message = sprintf( '<div class="wp-die-message">%s</div>', $message ); } $have_gettext = function_exists( '__' ); if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) { $link_url = $parsed_args['link_url']; if ( function_exists( 'esc_url' ) ) { $link_url = esc_url( $link_url ); } $link_text = $parsed_args['link_text']; $message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>"; } if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) { $back_text = $have_gettext ? __( '« Back' ) : '« Back'; $message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>"; } if ( ! did_action( 'admin_head' ) ) : if ( ! headers_sent() ) { header( "Content-Type: text/html; charset={$parsed_args['charset']}" ); status_header( $parsed_args['response'] ); nocache_headers(); } $text_direction = $parsed_args['text_direction']; $dir_attr = "dir='$text_direction'"; if ( empty( $args['text_direction'] ) && function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) { $dir_attr = get_language_attributes(); } ?> -<!DOCTYPE html> -<html <?php echo $dir_attr; ?>> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $parsed_args['charset']; ?>" /> - <meta name="viewport" content="width=device-width"> - <?php - if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) { add_filter( 'wp_robots', 'wp_robots_no_robots' ); wp_robots(); } ?> - <title><?php echo $title; ?> - - - - - - - - 200 ) ); list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( ! headers_sent() ) { if ( null !== $args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } if ( is_scalar( $message ) ) { $message = (string) $message; } else { $message = '0'; } if ( $parsed_args['exit'] ) { die( $message ); } echo $message; } function _json_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $data = array( 'code' => $parsed_args['code'], 'message' => $message, 'data' => array( 'status' => $parsed_args['response'], ), 'additional_errors' => $parsed_args['additional_errors'], ); if ( ! headers_sent() ) { header( "Content-Type: application/json; charset={$parsed_args['charset']}" ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } echo wp_json_encode( $data ); if ( $parsed_args['exit'] ) { die(); } } function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $data = array( 'code' => $parsed_args['code'], 'message' => $message, 'data' => array( 'status' => $parsed_args['response'], ), 'additional_errors' => $parsed_args['additional_errors'], ); if ( ! headers_sent() ) { header( "Content-Type: application/javascript; charset={$parsed_args['charset']}" ); header( 'X-Content-Type-Options: nosniff' ); header( 'X-Robots-Tag: noindex' ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } $result = wp_json_encode( $data ); $jsonp_callback = $_GET['_jsonp']; echo '/**/' . $jsonp_callback . '(' . $result . ')'; if ( $parsed_args['exit'] ) { die(); } } function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { global $wp_xmlrpc_server; list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( ! headers_sent() ) { nocache_headers(); } if ( $wp_xmlrpc_server ) { $error = new IXR_Error( $parsed_args['response'], $message ); $wp_xmlrpc_server->output( $error->getXml() ); } if ( $parsed_args['exit'] ) { die(); } } function _xml_wp_die_handler( $message, $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); $message = htmlspecialchars( $message ); $title = htmlspecialchars( $title ); $xml = << - {$parsed_args['code']} - <![CDATA[{$title}]]> - - - {$parsed_args['response']} - - - -EOD; -if ( ! headers_sent() ) { header( "Content-Type: text/xml; charset={$parsed_args['charset']}" ); if ( null !== $parsed_args['response'] ) { status_header( $parsed_args['response'] ); } nocache_headers(); } echo $xml; if ( $parsed_args['exit'] ) { die(); } } function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); if ( $parsed_args['exit'] ) { if ( is_scalar( $message ) ) { die( (string) $message ); } die(); } if ( is_scalar( $message ) ) { echo (string) $message; } } function _wp_die_process_input( $message, $title = '', $args = array() ) { $defaults = array( 'response' => 0, 'code' => '', 'exit' => true, 'back_link' => false, 'link_url' => '', 'link_text' => '', 'text_direction' => '', 'charset' => 'utf-8', 'additional_errors' => array(), ); $args = wp_parse_args( $args, $defaults ); if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) { if ( ! empty( $message->errors ) ) { $errors = array(); foreach ( (array) $message->errors as $error_code => $error_messages ) { foreach ( (array) $error_messages as $error_message ) { $errors[] = array( 'code' => $error_code, 'message' => $error_message, 'data' => $message->get_error_data( $error_code ), ); } } $message = $errors[0]['message']; if ( empty( $args['code'] ) ) { $args['code'] = $errors[0]['code']; } if ( empty( $args['response'] ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['status'] ) ) { $args['response'] = $errors[0]['data']['status']; } if ( empty( $title ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['title'] ) ) { $title = $errors[0]['data']['title']; } unset( $errors[0] ); $args['additional_errors'] = array_values( $errors ); } else { $message = ''; } } $have_gettext = function_exists( '__' ); if ( empty( $args['code'] ) ) { $args['code'] = 'wp_die'; } if ( empty( $args['response'] ) ) { $args['response'] = 500; } if ( empty( $title ) ) { $title = $have_gettext ? __( 'WordPress › Error' ) : 'WordPress › Error'; } if ( empty( $args['text_direction'] ) || ! in_array( $args['text_direction'], array( 'ltr', 'rtl' ), true ) ) { $args['text_direction'] = 'ltr'; if ( function_exists( 'is_rtl' ) && is_rtl() ) { $args['text_direction'] = 'rtl'; } } if ( ! empty( $args['charset'] ) ) { $args['charset'] = _canonical_charset( $args['charset'] ); } return array( $message, $title, $args ); } function wp_json_encode( $data, $options = 0, $depth = 512 ) { $json = json_encode( $data, $options, $depth ); if ( false !== $json ) { return $json; } try { $data = _wp_json_sanity_check( $data, $depth ); } catch ( Exception $e ) { return false; } return json_encode( $data, $options, $depth ); } function _wp_json_sanity_check( $data, $depth ) { if ( $depth < 0 ) { throw new Exception( 'Reached depth limit' ); } if ( is_array( $data ) ) { $output = array(); foreach ( $data as $id => $el ) { if ( is_string( $id ) ) { $clean_id = _wp_json_convert_string( $id ); } else { $clean_id = $id; } if ( is_array( $el ) || is_object( $el ) ) { $output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 ); } elseif ( is_string( $el ) ) { $output[ $clean_id ] = _wp_json_convert_string( $el ); } else { $output[ $clean_id ] = $el; } } } elseif ( is_object( $data ) ) { $output = new stdClass; foreach ( $data as $id => $el ) { if ( is_string( $id ) ) { $clean_id = _wp_json_convert_string( $id ); } else { $clean_id = $id; } if ( is_array( $el ) || is_object( $el ) ) { $output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 ); } elseif ( is_string( $el ) ) { $output->$clean_id = _wp_json_convert_string( $el ); } else { $output->$clean_id = $el; } } } elseif ( is_string( $data ) ) { return _wp_json_convert_string( $data ); } else { return $data; } return $output; } function _wp_json_convert_string( $string ) { static $use_mb = null; if ( is_null( $use_mb ) ) { $use_mb = function_exists( 'mb_convert_encoding' ); } if ( $use_mb ) { $encoding = mb_detect_encoding( $string, mb_detect_order(), true ); if ( $encoding ) { return mb_convert_encoding( $string, 'UTF-8', $encoding ); } else { return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' ); } } else { return wp_check_invalid_utf8( $string, true ); } } function _wp_json_prepare_data( $data ) { _deprecated_function( __FUNCTION__, '5.3.0' ); return $data; } function wp_send_json( $response, $status_code = null, $options = 0 ) { if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Return a %1$s or %2$s object from your callback when using the REST API.' ), 'WP_REST_Response', 'WP_Error' ), '5.5.0' ); } if ( ! headers_sent() ) { header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); if ( null !== $status_code ) { status_header( $status_code ); } } echo wp_json_encode( $response, $options ); if ( wp_doing_ajax() ) { wp_die( '', '', array( 'response' => null, ) ); } else { die; } } function wp_send_json_success( $data = null, $status_code = null, $options = 0 ) { $response = array( 'success' => true ); if ( isset( $data ) ) { $response['data'] = $data; } wp_send_json( $response, $status_code, $options ); } function wp_send_json_error( $data = null, $status_code = null, $options = 0 ) { $response = array( 'success' => false ); if ( isset( $data ) ) { if ( is_wp_error( $data ) ) { $result = array(); foreach ( $data->errors as $code => $messages ) { foreach ( $messages as $message ) { $result[] = array( 'code' => $code, 'message' => $message, ); } } $response['data'] = $result; } else { $response['data'] = $data; } } wp_send_json( $response, $status_code, $options ); } function wp_check_jsonp_callback( $callback ) { if ( ! is_string( $callback ) ) { return false; } preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count ); return 0 === $illegal_char_count; } function wp_json_file_decode( $filename, $options = array() ) { $result = null; $filename = wp_normalize_path( realpath( $filename ) ); if ( ! file_exists( $filename ) ) { trigger_error( sprintf( __( "File %s doesn't exist!" ), $filename ) ); return $result; } $options = wp_parse_args( $options, array( 'associative' => false ) ); $decoded_file = json_decode( file_get_contents( $filename ), $options['associative'] ); if ( JSON_ERROR_NONE !== json_last_error() ) { trigger_error( sprintf( __( 'Error when decoding a JSON file at path %1$s: %2$s' ), $filename, json_last_error_msg() ) ); return $result; } return $decoded_file; } function _config_wp_home( $url = '' ) { if ( defined( 'WP_HOME' ) ) { return untrailingslashit( WP_HOME ); } return $url; } function _config_wp_siteurl( $url = '' ) { if ( defined( 'WP_SITEURL' ) ) { return untrailingslashit( WP_SITEURL ); } return $url; } function _delete_option_fresh_site() { update_option( 'fresh_site', '0' ); } function _mce_set_direction( $mce_init ) { if ( is_rtl() ) { $mce_init['directionality'] = 'rtl'; $mce_init['rtl_ui'] = true; if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) { $mce_init['plugins'] .= ',directionality'; } if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) { $mce_init['toolbar1'] .= ',ltr'; } } return $mce_init; } function smilies_init() { global $wpsmiliestrans, $wp_smiliessearch; if ( ! get_option( 'use_smilies' ) ) { return; } if ( ! isset( $wpsmiliestrans ) ) { $wpsmiliestrans = array( ':mrgreen:' => 'mrgreen.png', ':neutral:' => "\xf0\x9f\x98\x90", ':twisted:' => "\xf0\x9f\x98\x88", ':arrow:' => "\xe2\x9e\xa1", ':shock:' => "\xf0\x9f\x98\xaf", ':smile:' => "\xf0\x9f\x99\x82", ':???:' => "\xf0\x9f\x98\x95", ':cool:' => "\xf0\x9f\x98\x8e", ':evil:' => "\xf0\x9f\x91\xbf", ':grin:' => "\xf0\x9f\x98\x80", ':idea:' => "\xf0\x9f\x92\xa1", ':oops:' => "\xf0\x9f\x98\xb3", ':razz:' => "\xf0\x9f\x98\x9b", ':roll:' => "\xf0\x9f\x99\x84", ':wink:' => "\xf0\x9f\x98\x89", ':cry:' => "\xf0\x9f\x98\xa5", ':eek:' => "\xf0\x9f\x98\xae", ':lol:' => "\xf0\x9f\x98\x86", ':mad:' => "\xf0\x9f\x98\xa1", ':sad:' => "\xf0\x9f\x99\x81", '8-)' => "\xf0\x9f\x98\x8e", '8-O' => "\xf0\x9f\x98\xaf", ':-(' => "\xf0\x9f\x99\x81", ':-)' => "\xf0\x9f\x99\x82", ':-?' => "\xf0\x9f\x98\x95", ':-D' => "\xf0\x9f\x98\x80", ':-P' => "\xf0\x9f\x98\x9b", ':-o' => "\xf0\x9f\x98\xae", ':-x' => "\xf0\x9f\x98\xa1", ':-|' => "\xf0\x9f\x98\x90", ';-)' => "\xf0\x9f\x98\x89", '8O' => "\xf0\x9f\x98\xaf", ':(' => "\xf0\x9f\x99\x81", ':)' => "\xf0\x9f\x99\x82", ':?' => "\xf0\x9f\x98\x95", ':D' => "\xf0\x9f\x98\x80", ':P' => "\xf0\x9f\x98\x9b", ':o' => "\xf0\x9f\x98\xae", ':x' => "\xf0\x9f\x98\xa1", ':|' => "\xf0\x9f\x98\x90", ';)' => "\xf0\x9f\x98\x89", ':!:' => "\xe2\x9d\x97", ':?:' => "\xe2\x9d\x93", ); } $wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans ); if ( count( $wpsmiliestrans ) == 0 ) { return; } krsort( $wpsmiliestrans ); $spaces = wp_spaces_regexp(); $wp_smiliessearch = '/(?<=' . $spaces . '|^)'; $subchar = ''; foreach ( (array) $wpsmiliestrans as $smiley => $img ) { $firstchar = substr( $smiley, 0, 1 ); $rest = substr( $smiley, 1 ); if ( $firstchar != $subchar ) { if ( '' !== $subchar ) { $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; } $subchar = $firstchar; $wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:'; } else { $wp_smiliessearch .= '|'; } $wp_smiliessearch .= preg_quote( $rest, '/' ); } $wp_smiliessearch .= ')(?=' . $spaces . '|$)/m'; } function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { $parsed_args =& $args; } else { wp_parse_str( $args, $parsed_args ); } if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; } function wp_parse_list( $list ) { if ( ! is_array( $list ) ) { return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY ); } return $list; } function wp_parse_id_list( $list ) { $list = wp_parse_list( $list ); return array_unique( array_map( 'absint', $list ) ); } function wp_parse_slug_list( $list ) { $list = wp_parse_list( $list ); return array_unique( array_map( 'sanitize_title', $list ) ); } function wp_array_slice_assoc( $array, $keys ) { $slice = array(); foreach ( $keys as $key ) { if ( isset( $array[ $key ] ) ) { $slice[ $key ] = $array[ $key ]; } } return $slice; } function _wp_array_get( $array, $path, $default = null ) { if ( ! is_array( $path ) || 0 === count( $path ) ) { return $default; } foreach ( $path as $path_element ) { if ( ! is_array( $array ) || ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) || ! array_key_exists( $path_element, $array ) ) { return $default; } $array = $array[ $path_element ]; } return $array; } function _wp_array_set( &$array, $path, $value = null ) { if ( ! is_array( $array ) ) { return; } if ( ! is_array( $path ) ) { return; } $path_length = count( $path ); if ( 0 === $path_length ) { return; } foreach ( $path as $path_element ) { if ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) { return; } } for ( $i = 0; $i < $path_length - 1; ++$i ) { $path_element = $path[ $i ]; if ( ! array_key_exists( $path_element, $array ) || ! is_array( $array[ $path_element ] ) ) { $array[ $path_element ] = array(); } $array = &$array[ $path_element ]; } $array[ $path[ $i ] ] = $value; } function _wp_to_kebab_case( $string ) { $rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff'; $rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf'; $rsPunctuationRange = '\\x{2000}-\\x{206f}'; $rsSpaceRange = ' \\t\\x0b\\f\\xa0\\x{feff}\\n\\r\\x{2028}\\x{2029}\\x{1680}\\x{180e}\\x{2000}\\x{2001}\\x{2002}\\x{2003}\\x{2004}\\x{2005}\\x{2006}\\x{2007}\\x{2008}\\x{2009}\\x{200a}\\x{202f}\\x{205f}\\x{3000}'; $rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde'; $rsBreakRange = $rsNonCharRange . $rsPunctuationRange . $rsSpaceRange; $rsBreak = '[' . $rsBreakRange . ']'; $rsDigits = '\\d+'; $rsLower = '[' . $rsLowerRange . ']'; $rsMisc = '[^' . $rsBreakRange . $rsDigits . $rsLowerRange . $rsUpperRange . ']'; $rsUpper = '[' . $rsUpperRange . ']'; $rsMiscLower = '(?:' . $rsLower . '|' . $rsMisc . ')'; $rsMiscUpper = '(?:' . $rsUpper . '|' . $rsMisc . ')'; $rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])'; $rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])'; $regexp = '/' . implode( '|', array( $rsUpper . '?' . $rsLower . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper, '$' ) ) . ')', $rsMiscUpper . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper . $rsMiscLower, '$' ) ) . ')', $rsUpper . '?' . $rsMiscLower . '+', $rsUpper . '+', $rsOrdUpper, $rsOrdLower, $rsDigits, ) ) . '/u'; preg_match_all( $regexp, str_replace( "'", '', $string ), $matches ); return strtolower( implode( '-', $matches[0] ) ); } function wp_is_numeric_array( $data ) { if ( ! is_array( $data ) ) { return false; } $keys = array_keys( $data ); $string_keys = array_filter( $keys, 'is_string' ); return count( $string_keys ) === 0; } function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); $util->filter( $args, $operator ); if ( $field ) { $util->pluck( $field ); } return $util->get_output(); } function wp_list_filter( $list, $args = array(), $operator = 'AND' ) { return wp_filter_object_list( $list, $args, $operator ); } function wp_list_pluck( $list, $field, $index_key = null ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); return $util->pluck( $field, $index_key ); } function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) { if ( ! is_array( $list ) ) { return array(); } $util = new WP_List_Util( $list ); return $util->sort( $orderby, $order, $preserve_keys ); } function wp_maybe_load_widgets() { if ( ! apply_filters( 'load_default_widgets', true ) ) { return; } require_once ABSPATH . WPINC . '/default-widgets.php'; add_action( '_admin_menu', 'wp_widgets_add_menu' ); } function wp_widgets_add_menu() { global $submenu; if ( ! current_theme_supports( 'widgets' ) ) { return; } $menu_name = __( 'Widgets' ); if ( wp_is_block_theme() ) { $submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' ); } else { $submenu['themes.php'][7] = array( $menu_name, 'edit_theme_options', 'widgets.php' ); } ksort( $submenu['themes.php'], SORT_NUMERIC ); } function wp_ob_end_flush_all() { $levels = ob_get_level(); for ( $i = 0; $i < $levels; $i++ ) { ob_end_flush(); } } function dead_db() { global $wpdb; wp_load_translations_early(); if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) { require_once WP_CONTENT_DIR . '/db-error.php'; die(); } if ( wp_installing() || defined( 'WP_ADMIN' ) ) { wp_die( $wpdb->error ); } wp_die( '

            ' . __( 'Error establishing a database connection' ) . '

            ', __( 'Database Error' ) ); } function absint( $maybeint ) { return abs( (int) $maybeint ); } function _deprecated_function( $function, $version, $replacement = '' ) { do_action( 'deprecated_function_run', $function, $replacement, $version ); if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $replacement ) { trigger_error( sprintf( __( 'Function %1$s is deprecated since version %2$s! Use %3$s instead.' ), $function, $version, $replacement ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Function %1$s is deprecated since version %2$s with no alternative available.' ), $function, $version ), E_USER_DEPRECATED ); } } else { if ( $replacement ) { trigger_error( sprintf( 'Function %1$s is deprecated since version %2$s! Use %3$s instead.', $function, $version, $replacement ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'Function %1$s is deprecated since version %2$s with no alternative available.', $function, $version ), E_USER_DEPRECATED ); } } } } function _deprecated_constructor( $class, $version, $parent_class = '' ) { do_action( 'deprecated_constructor_run', $class, $version, $parent_class ); if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $parent_class ) { trigger_error( sprintf( __( 'The called constructor method for %1$s class in %2$s is deprecated since version %3$s! Use %4$s instead.' ), $class, $parent_class, $version, '__construct()' ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'The called constructor method for %1$s class is deprecated since version %2$s! Use %3$s instead.' ), $class, $version, '__construct()' ), E_USER_DEPRECATED ); } } else { if ( $parent_class ) { trigger_error( sprintf( 'The called constructor method for %1$s class in %2$s is deprecated since version %3$s! Use %4$s instead.', $class, $parent_class, $version, '__construct()' ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'The called constructor method for %1$s class is deprecated since version %2$s! Use %3$s instead.', $class, $version, '__construct()' ), E_USER_DEPRECATED ); } } } } function _deprecated_file( $file, $version, $replacement = '', $message = '' ) { do_action( 'deprecated_file_included', $file, $replacement, $version, $message ); if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) { $message = empty( $message ) ? '' : ' ' . $message; if ( function_exists( '__' ) ) { if ( $replacement ) { trigger_error( sprintf( __( 'File %1$s is deprecated since version %2$s! Use %3$s instead.' ), $file, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'File %1$s is deprecated since version %2$s with no alternative available.' ), $file, $version ) . $message, E_USER_DEPRECATED ); } } else { if ( $replacement ) { trigger_error( sprintf( 'File %1$s is deprecated since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'File %1$s is deprecated since version %2$s with no alternative available.', $file, $version ) . $message, E_USER_DEPRECATED ); } } } } function _deprecated_argument( $function, $version, $message = '' ) { do_action( 'deprecated_argument_run', $function, $message, $version ); if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { if ( function_exists( '__' ) ) { if ( $message ) { trigger_error( sprintf( __( 'Function %1$s was called with an argument that is deprecated since version %2$s! %3$s' ), $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Function %1$s was called with an argument that is deprecated since version %2$s with no alternative available.' ), $function, $version ), E_USER_DEPRECATED ); } } else { if ( $message ) { trigger_error( sprintf( 'Function %1$s was called with an argument that is deprecated since version %2$s! %3$s', $function, $version, $message ), E_USER_DEPRECATED ); } else { trigger_error( sprintf( 'Function %1$s was called with an argument that is deprecated since version %2$s with no alternative available.', $function, $version ), E_USER_DEPRECATED ); } } } } function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) { do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message ); if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) { $message = empty( $message ) ? '' : ' ' . $message; if ( $replacement ) { trigger_error( sprintf( __( 'Hook %1$s is deprecated since version %2$s! Use %3$s instead.' ), $hook, $version, $replacement ) . $message, E_USER_DEPRECATED ); } else { trigger_error( sprintf( __( 'Hook %1$s is deprecated since version %2$s with no alternative available.' ), $hook, $version ) . $message, E_USER_DEPRECATED ); } } } function _doing_it_wrong( $function, $message, $version ) { do_action( 'doing_it_wrong_run', $function, $message, $version ); if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) { if ( function_exists( '__' ) ) { if ( $version ) { $version = sprintf( __( '(This message was added in version %s.)' ), $version ); } $message .= ' ' . sprintf( __( 'Please see Debugging in WordPress for more information.' ), __( 'https://wordpress.org/support/article/debugging-in-wordpress/' ) ); trigger_error( sprintf( __( 'Function %1$s was called incorrectly. %2$s %3$s' ), $function, $message, $version ), E_USER_NOTICE ); } else { if ( $version ) { $version = sprintf( '(This message was added in version %s.)', $version ); } $message .= sprintf( ' Please see Debugging in WordPress for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/' ); trigger_error( sprintf( 'Function %1$s was called incorrectly. %2$s %3$s', $function, $message, $version ), E_USER_NOTICE ); } } } function is_lighttpd_before_150() { $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' ); $server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : ''; return ( 'lighttpd' === $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ) ); } function apache_mod_loaded( $mod, $default = false ) { global $is_apache; if ( ! $is_apache ) { return false; } if ( function_exists( 'apache_get_modules' ) ) { $mods = apache_get_modules(); if ( in_array( $mod, $mods, true ) ) { return true; } } elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) { ob_start(); phpinfo( 8 ); $phpinfo = ob_get_clean(); if ( false !== strpos( $phpinfo, $mod ) ) { return true; } } return $default; } function iis7_supports_permalinks() { global $is_iis7; $supports_permalinks = false; if ( $is_iis7 ) { $supports_permalinks = class_exists( 'DOMDocument', false ) && isset( $_SERVER['IIS_UrlRewriteModule'] ) && ( 'cgi-fcgi' === PHP_SAPI ); } return apply_filters( 'iis7_supports_permalinks', $supports_permalinks ); } function validate_file( $file, $allowed_files = array() ) { if ( ! is_scalar( $file ) || '' === $file ) { return 0; } if ( '../' === $file ) { return 1; } if ( preg_match_all( '#\.\./#', $file, $matches, PREG_SET_ORDER ) && ( count( $matches ) > 1 ) ) { return 1; } if ( false !== strpos( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) { return 1; } if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files, true ) ) { return 3; } if ( ':' === substr( $file, 1, 1 ) ) { return 2; } return 0; } function force_ssl_admin( $force = null ) { static $forced = false; if ( ! is_null( $force ) ) { $old_forced = $forced; $forced = $force; return $old_forced; } return $forced; } function wp_guess_url() { if ( defined( 'WP_SITEURL' ) && '' !== WP_SITEURL ) { $url = WP_SITEURL; } else { $abspath_fix = str_replace( '\\', '/', ABSPATH ); $script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] ); if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) { $path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] ); } elseif ( $script_filename_dir . '/' === $abspath_fix ) { $path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] ); } else { if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) { $directory = str_replace( ABSPATH, '', $script_filename_dir ); $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ); } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) { $subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) ); $path = preg_replace( '#/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ) . $subdirectory; } else { $path = $_SERVER['REQUEST_URI']; } } $schema = is_ssl() ? 'https://' : 'http://'; $url = $schema . $_SERVER['HTTP_HOST'] . $path; } return rtrim( $url, '/' ); } function wp_suspend_cache_addition( $suspend = null ) { static $_suspend = false; if ( is_bool( $suspend ) ) { $_suspend = $suspend; } return $_suspend; } function wp_suspend_cache_invalidation( $suspend = true ) { global $_wp_suspend_cache_invalidation; $current_suspend = $_wp_suspend_cache_invalidation; $_wp_suspend_cache_invalidation = $suspend; return $current_suspend; } function is_main_site( $site_id = null, $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( ! $site_id ) { $site_id = get_current_blog_id(); } $site_id = (int) $site_id; return get_main_site_id( $network_id ) === $site_id; } function get_main_site_id( $network_id = null ) { if ( ! is_multisite() ) { return get_current_blog_id(); } $network = get_network( $network_id ); if ( ! $network ) { return 0; } return $network->site_id; } function is_main_network( $network_id = null ) { if ( ! is_multisite() ) { return true; } if ( null === $network_id ) { $network_id = get_current_network_id(); } $network_id = (int) $network_id; return ( get_main_network_id() === $network_id ); } function get_main_network_id() { if ( ! is_multisite() ) { return 1; } $current_network = get_network(); if ( defined( 'PRIMARY_NETWORK_ID' ) ) { $main_network_id = PRIMARY_NETWORK_ID; } elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) { $main_network_id = 1; } else { $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1, ) ); $main_network_id = array_shift( $_networks ); } return (int) apply_filters( 'get_main_network_id', $main_network_id ); } function global_terms_enabled() { if ( ! is_multisite() ) { return false; } static $global_terms = null; if ( is_null( $global_terms ) ) { $filter = apply_filters( 'global_terms_enabled', null ); if ( ! is_null( $filter ) ) { $global_terms = (bool) $filter; } else { $global_terms = (bool) get_site_option( 'global_terms_enabled', false ); } } return $global_terms; } function is_site_meta_supported() { global $wpdb; if ( ! is_multisite() ) { return false; } $network_id = get_main_network_id(); $supported = get_network_option( $network_id, 'site_meta_supported', false ); if ( false === $supported ) { $supported = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->blogmeta}'" ) ? 1 : 0; update_network_option( $network_id, 'site_meta_supported', $supported ); } return (bool) $supported; } function wp_timezone_override_offset() { $timezone_string = get_option( 'timezone_string' ); if ( ! $timezone_string ) { return false; } $timezone_object = timezone_open( $timezone_string ); $datetime_object = date_create(); if ( false === $timezone_object || false === $datetime_object ) { return false; } return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); } function _wp_timezone_choice_usort_callback( $a, $b ) { if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) { if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) { return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) ); } if ( 'UTC' === $a['city'] ) { if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) { return 1; } return -1; } if ( 'UTC' === $b['city'] ) { if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) { return -1; } return 1; } return strnatcasecmp( $a['city'], $b['city'] ); } if ( $a['t_continent'] == $b['t_continent'] ) { if ( $a['t_city'] == $b['t_city'] ) { return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] ); } return strnatcasecmp( $a['t_city'], $b['t_city'] ); } else { if ( 'Etc' === $a['continent'] ) { return 1; } if ( 'Etc' === $b['continent'] ) { return -1; } return strnatcasecmp( $a['t_continent'], $b['t_continent'] ); } } function wp_timezone_choice( $selected_zone, $locale = null ) { static $mo_loaded = false, $locale_loaded = null; $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' ); if ( ! $mo_loaded || $locale !== $locale_loaded ) { $locale_loaded = $locale ? $locale : get_locale(); $mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo'; unload_textdomain( 'continents-cities' ); load_textdomain( 'continents-cities', $mofile ); $mo_loaded = true; } $zonen = array(); foreach ( timezone_identifiers_list() as $zone ) { $zone = explode( '/', $zone ); if ( ! in_array( $zone[0], $continents, true ) ) { continue; } $exists = array( 0 => ( isset( $zone[0] ) && $zone[0] ), 1 => ( isset( $zone[1] ) && $zone[1] ), 2 => ( isset( $zone[2] ) && $zone[2] ), ); $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ); $exists[4] = ( $exists[1] && $exists[3] ); $exists[5] = ( $exists[2] && $exists[3] ); $zonen[] = array( 'continent' => ( $exists[0] ? $zone[0] : '' ), 'city' => ( $exists[1] ? $zone[1] : '' ), 'subcity' => ( $exists[2] ? $zone[2] : '' ), 't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ), 't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), 't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ), ); } usort( $zonen, '_wp_timezone_choice_usort_callback' ); $structure = array(); if ( empty( $selected_zone ) ) { $structure[] = ''; } foreach ( $zonen as $key => $zone ) { $value = array( $zone['continent'] ); if ( empty( $zone['city'] ) ) { $display = $zone['t_continent']; } else { if ( ! isset( $zonen[ $key - 1 ] ) || $zonen[ $key - 1 ]['continent'] !== $zone['continent'] ) { $label = $zone['t_continent']; $structure[] = ''; } $value[] = $zone['city']; $display = $zone['t_city']; if ( ! empty( $zone['subcity'] ) ) { $value[] = $zone['subcity']; $display .= ' - ' . $zone['t_subcity']; } } $value = implode( '/', $value ); $selected = ''; if ( $value === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; if ( ! empty( $zone['city'] ) && ( ! isset( $zonen[ $key + 1 ] ) || ( isset( $zonen[ $key + 1 ] ) && $zonen[ $key + 1 ]['continent'] !== $zone['continent'] ) ) ) { $structure[] = ''; } } $structure[] = ''; $selected = ''; if ( 'UTC' === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; $structure[] = ''; $structure[] = ''; $offset_range = array( -12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14, ); foreach ( $offset_range as $offset ) { if ( 0 <= $offset ) { $offset_name = '+' . $offset; } else { $offset_name = (string) $offset; } $offset_value = $offset_name; $offset_name = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $offset_name ); $offset_name = 'UTC' . $offset_name; $offset_value = 'UTC' . $offset_value; $selected = ''; if ( $offset_value === $selected_zone ) { $selected = 'selected="selected" '; } $structure[] = ''; } $structure[] = ''; return implode( "\n", $structure ); } function _cleanup_header_comment( $str ) { return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $str ) ); } function wp_scheduled_delete() { global $wpdb; $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); $posts_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A ); foreach ( (array) $posts_to_delete as $post ) { $post_id = (int) $post['post_id']; if ( ! $post_id ) { continue; } $del_post = get_post( $post_id ); if ( ! $del_post || 'trash' !== $del_post->post_status ) { delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); } else { wp_delete_post( $post_id ); } } $comments_to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < %d", $delete_timestamp ), ARRAY_A ); foreach ( (array) $comments_to_delete as $comment ) { $comment_id = (int) $comment['comment_id']; if ( ! $comment_id ) { continue; } $del_comment = get_comment( $comment_id ); if ( ! $del_comment || 'trash' !== $del_comment->comment_approved ) { delete_comment_meta( $comment_id, '_wp_trash_meta_time' ); delete_comment_meta( $comment_id, '_wp_trash_meta_status' ); } else { wp_delete_comment( $del_comment ); } } } function get_file_data( $file, $default_headers, $context = '' ) { $file_data = file_get_contents( $file, false, null, 0, 8 * KB_IN_BYTES ); if ( false === $file_data ) { $file_data = ''; } $file_data = str_replace( "\r", "\n", $file_data ); $extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array(); if ( $extra_headers ) { $extra_headers = array_combine( $extra_headers, $extra_headers ); $all_headers = array_merge( $extra_headers, (array) $default_headers ); } else { $all_headers = $default_headers; } foreach ( $all_headers as $field => $regex ) { if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) { $all_headers[ $field ] = _cleanup_header_comment( $match[1] ); } else { $all_headers[ $field ] = ''; } } return $all_headers; } function __return_true() { return true; } function __return_false() { return false; } function __return_zero() { return 0; } function __return_empty_array() { return array(); } function __return_null() { return null; } function __return_empty_string() { return ''; } function send_nosniff_header() { header( 'X-Content-Type-Options: nosniff' ); } function _wp_mysql_week( $column ) { $start_of_week = (int) get_option( 'start_of_week' ); switch ( $start_of_week ) { case 1: return "WEEK( $column, 1 )"; case 2: case 3: case 4: case 5: case 6: return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )"; case 0: default: return "WEEK( $column, 0 )"; } } function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { $override = is_null( $start_parent ) ? array() : array( $start => $start_parent ); $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ); if ( ! $arbitrary_loop_member ) { return array(); } return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true ); } function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) { $tortoise = $start; $hare = $start; $evanescent_hare = $start; $return = array(); while ( $tortoise && ( $evanescent_hare = isset( $override[ $hare ] ) ? $override[ $hare ] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) ) && ( $hare = isset( $override[ $evanescent_hare ] ) ? $override[ $evanescent_hare ] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) ) ) { if ( $_return_loop ) { $return[ $tortoise ] = true; $return[ $evanescent_hare ] = true; $return[ $hare ] = true; } if ( $tortoise == $evanescent_hare || $tortoise == $hare ) { return $_return_loop ? $return : $tortoise; } $tortoise = isset( $override[ $tortoise ] ) ? $override[ $tortoise ] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) ); } return false; } function send_frame_options_header() { header( 'X-Frame-Options: SAMEORIGIN' ); } function wp_allowed_protocols() { static $protocols = array(); if ( empty( $protocols ) ) { $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); } if ( ! did_action( 'wp_loaded' ) ) { $protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) ); } return $protocols; } function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { static $truncate_paths; $trace = debug_backtrace( false ); $caller = array(); $check_class = ! is_null( $ignore_class ); $skip_frames++; if ( ! isset( $truncate_paths ) ) { $truncate_paths = array( wp_normalize_path( WP_CONTENT_DIR ), wp_normalize_path( ABSPATH ), ); } foreach ( $trace as $call ) { if ( $skip_frames > 0 ) { $skip_frames--; } elseif ( isset( $call['class'] ) ) { if ( $check_class && $ignore_class == $call['class'] ) { continue; } $caller[] = "{$call['class']}{$call['type']}{$call['function']}"; } else { if ( in_array( $call['function'], array( 'do_action', 'apply_filters', 'do_action_ref_array', 'apply_filters_ref_array' ), true ) ) { $caller[] = "{$call['function']}('{$call['args'][0]}')"; } elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ), true ) ) { $filename = isset( $call['args'][0] ) ? $call['args'][0] : ''; $caller[] = $call['function'] . "('" . str_replace( $truncate_paths, '', wp_normalize_path( $filename ) ) . "')"; } else { $caller[] = $call['function']; } } } if ( $pretty ) { return implode( ', ', array_reverse( $caller ) ); } else { return $caller; } } function _get_non_cached_ids( $object_ids, $cache_key ) { $non_cached_ids = array(); $cache_values = wp_cache_get_multiple( $object_ids, $cache_key ); foreach ( $cache_values as $id => $value ) { if ( ! $value ) { $non_cached_ids[] = (int) $id; } } return $non_cached_ids; } function _device_can_upload() { if ( ! wp_is_mobile() ) { return true; } $ua = $_SERVER['HTTP_USER_AGENT']; if ( strpos( $ua, 'iPhone' ) !== false || strpos( $ua, 'iPad' ) !== false || strpos( $ua, 'iPod' ) !== false ) { return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' ); } return true; } function wp_is_stream( $path ) { $scheme_separator = strpos( $path, '://' ); if ( false === $scheme_separator ) { return false; } $stream = substr( $path, 0, $scheme_separator ); return in_array( $stream, stream_get_wrappers(), true ); } function wp_checkdate( $month, $day, $year, $source_date ) { return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date ); } function wp_auth_check_load() { if ( ! is_admin() && ! is_user_logged_in() ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { return; } $screen = get_current_screen(); $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); $show = ! in_array( $screen->id, $hidden, true ); if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { wp_enqueue_style( 'wp-auth-check' ); wp_enqueue_script( 'wp-auth-check' ); add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); } } function wp_auth_check_html() { $login_url = wp_login_url(); $current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; $same_domain = ( strpos( $login_url, $current_domain ) === 0 ); $same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain ); $wrap_class = $same_domain ? 'hidden' : 'hidden fallback'; ?> -
            -
            -
            - - '1', 'wp_lang' => get_user_locale(), ), $login_url ); ?> -
            - -
            -

            -

            -

            -
            -
            -
            - [\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) ); } function _canonical_charset( $charset ) { if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) { return 'UTF-8'; } if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) { return 'ISO-8859-1'; } return $charset; } function mbstring_binary_safe_encoding( $reset = false ) { static $encodings = array(); static $overloaded = null; if ( is_null( $overloaded ) ) { if ( function_exists( 'mb_internal_encoding' ) && ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) ) { $overloaded = true; } else { $overloaded = false; } } if ( false === $overloaded ) { return; } if ( ! $reset ) { $encoding = mb_internal_encoding(); array_push( $encodings, $encoding ); mb_internal_encoding( 'ISO-8859-1' ); } if ( $reset && $encodings ) { $encoding = array_pop( $encodings ); mb_internal_encoding( $encoding ); } } function reset_mbstring_encoding() { mbstring_binary_safe_encoding( true ); } function wp_validate_boolean( $var ) { if ( is_bool( $var ) ) { return $var; } if ( is_string( $var ) && 'false' === strtolower( $var ) ) { return false; } return (bool) $var; } function wp_delete_file( $file ) { $delete = apply_filters( 'wp_delete_file', $file ); if ( ! empty( $delete ) ) { @unlink( $delete ); } } function wp_delete_file_from_directory( $file, $directory ) { if ( wp_is_stream( $file ) ) { $real_file = $file; $real_directory = $directory; } else { $real_file = realpath( wp_normalize_path( $file ) ); $real_directory = realpath( wp_normalize_path( $directory ) ); } if ( false !== $real_file ) { $real_file = wp_normalize_path( $real_file ); } if ( false !== $real_directory ) { $real_directory = wp_normalize_path( $real_directory ); } if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) { return false; } wp_delete_file( $file ); return true; } function wp_post_preview_js() { global $post; if ( ! is_preview() || empty( $post ) ) { return; } $name = 'wp-preview-' . (int) $post->ID; ?> - - $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { if ( false !== ini_set( 'memory_limit', $filtered_limit ) ) { return $filtered_limit; } else { return false; } } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { if ( false !== ini_set( 'memory_limit', $wp_max_limit ) ) { return $wp_max_limit; } else { return false; } } return false; } function wp_generate_uuid4() { return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0x0fff ) | 0x4000, mt_rand( 0, 0x3fff ) | 0x8000, mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); } function wp_is_uuid( $uuid, $version = null ) { if ( ! is_string( $uuid ) ) { return false; } if ( is_numeric( $version ) ) { if ( 4 !== (int) $version ) { _doing_it_wrong( __FUNCTION__, __( 'Only UUID V4 is supported at this time.' ), '4.9.0' ); return false; } $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/'; } else { $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/'; } return (bool) preg_match( $regex, $uuid ); } function wp_unique_id( $prefix = '' ) { static $id_counter = 0; return $prefix . (string) ++$id_counter; } function wp_cache_get_last_changed( $group ) { $last_changed = wp_cache_get( 'last_changed', $group ); if ( ! $last_changed ) { $last_changed = microtime(); wp_cache_set( 'last_changed', $last_changed, $group ); } return $last_changed; } function wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) { $send = true; if ( 'you@example.com' === $old_email ) { $send = false; } $send = apply_filters( 'send_site_admin_email_change_email', $send, $old_email, $new_email ); if ( ! $send ) { return; } $email_change_text = __( 'Hi, - -This notice confirms that the admin email address was changed on ###SITENAME###. - -The new admin email address is ###NEW_EMAIL###. - -This email has been sent to ###OLD_EMAIL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $email_change_email = array( 'to' => $old_email, 'subject' => __( '[%s] Admin Email Changed' ), 'message' => $email_change_text, 'headers' => '', ); $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $email_change_email = apply_filters( 'site_admin_email_change_email', $email_change_email, $old_email, $new_email ); $email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITENAME###', $site_name, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $site_name ), $email_change_email['message'], $email_change_email['headers'] ); } function wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) { if ( empty( $ip_addr ) ) { return '0.0.0.0'; } $ip_prefix = ''; $is_ipv6 = substr_count( $ip_addr, ':' ) > 1; $is_ipv4 = ( 3 === substr_count( $ip_addr, '.' ) ); if ( $is_ipv6 && $is_ipv4 ) { $ip_prefix = '::ffff:'; $ip_addr = preg_replace( '/^\[?[0-9a-f:]*:/i', '', $ip_addr ); $ip_addr = str_replace( ']', '', $ip_addr ); $is_ipv6 = false; } if ( $is_ipv6 ) { $left_bracket = strpos( $ip_addr, '[' ); $right_bracket = strpos( $ip_addr, ']' ); $percent = strpos( $ip_addr, '%' ); $netmask = 'ffff:ffff:ffff:ffff:0000:0000:0000:0000'; if ( false !== $left_bracket && false !== $right_bracket ) { $ip_addr = substr( $ip_addr, $left_bracket + 1, $right_bracket - $left_bracket - 1 ); } elseif ( false !== $left_bracket || false !== $right_bracket ) { return '::'; } if ( false !== $percent ) { $ip_addr = substr( $ip_addr, 0, $percent ); } if ( preg_match( '/[^0-9a-f:]/i', $ip_addr ) ) { return '::'; } if ( function_exists( 'inet_pton' ) && function_exists( 'inet_ntop' ) ) { $ip_addr = inet_ntop( inet_pton( $ip_addr ) & inet_pton( $netmask ) ); if ( false === $ip_addr ) { return '::'; } } elseif ( ! $ipv6_fallback ) { return '::'; } } elseif ( $is_ipv4 ) { $last_octet_position = strrpos( $ip_addr, '.' ); $ip_addr = substr( $ip_addr, 0, $last_octet_position ) . '.0'; } else { return '0.0.0.0'; } return $ip_prefix . $ip_addr; } function wp_privacy_anonymize_data( $type, $data = '' ) { switch ( $type ) { case 'email': $anonymous = 'deleted@site.invalid'; break; case 'url': $anonymous = 'https://site.invalid'; break; case 'ip': $anonymous = wp_privacy_anonymize_ip( $data ); break; case 'date': $anonymous = '0000-00-00 00:00:00'; break; case 'text': $anonymous = __( '[deleted]' ); break; case 'longtext': $anonymous = __( 'This content was deleted by the author.' ); break; default: $anonymous = ''; break; } return apply_filters( 'wp_privacy_anonymize_data', $anonymous, $type, $data ); } function wp_privacy_exports_dir() { $upload_dir = wp_upload_dir(); $exports_dir = trailingslashit( $upload_dir['basedir'] ) . 'wp-personal-data-exports/'; return apply_filters( 'wp_privacy_exports_dir', $exports_dir ); } function wp_privacy_exports_url() { $upload_dir = wp_upload_dir(); $exports_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-personal-data-exports/'; return apply_filters( 'wp_privacy_exports_url', $exports_url ); } function wp_schedule_delete_old_privacy_export_files() { if ( wp_installing() ) { return; } if ( ! wp_next_scheduled( 'wp_privacy_delete_old_export_files' ) ) { wp_schedule_event( time(), 'hourly', 'wp_privacy_delete_old_export_files' ); } } function wp_privacy_delete_old_export_files() { $exports_dir = wp_privacy_exports_dir(); if ( ! is_dir( $exports_dir ) ) { return; } require_once ABSPATH . 'wp-admin/includes/file.php'; $export_files = list_files( $exports_dir, 100, array( 'index.php' ) ); $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); foreach ( (array) $export_files as $export_file ) { $file_age_in_seconds = time() - filemtime( $export_file ); if ( $expiration < $file_age_in_seconds ) { unlink( $export_file ); } } } function wp_get_update_php_url() { $default_url = wp_get_default_update_php_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) { $update_url = getenv( 'WP_UPDATE_PHP_URL' ); } $update_url = apply_filters( 'wp_update_php_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } function wp_get_default_update_php_url() { return _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page' ); } function wp_update_php_annotation( $before = '

            ', $after = '

            ' ) { $annotation = wp_get_update_php_annotation(); if ( $annotation ) { echo $before . $annotation . $after; } } function wp_get_update_php_annotation() { $update_url = wp_get_update_php_url(); $default_url = wp_get_default_update_php_url(); if ( $update_url === $default_url ) { return ''; } $annotation = sprintf( __( 'This resource is provided by your web host, and is specific to your site. For more information, see the official WordPress documentation.' ), esc_url( $default_url ) ); return $annotation; } function wp_get_direct_php_update_url() { $direct_update_url = ''; if ( false !== getenv( 'WP_DIRECT_UPDATE_PHP_URL' ) ) { $direct_update_url = getenv( 'WP_DIRECT_UPDATE_PHP_URL' ); } $direct_update_url = apply_filters( 'wp_direct_php_update_url', $direct_update_url ); return $direct_update_url; } function wp_direct_php_update_button() { $direct_update_url = wp_get_direct_php_update_url(); if ( empty( $direct_update_url ) ) { return; } echo '

            '; printf( '%2$s %3$s', esc_url( $direct_update_url ), __( 'Update PHP' ), __( '(opens in a new tab)' ) ); echo '

            '; } function wp_get_update_https_url() { $default_url = wp_get_default_update_https_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_HTTPS_URL' ) ) { $update_url = getenv( 'WP_UPDATE_HTTPS_URL' ); } $update_url = apply_filters( 'wp_update_https_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } function wp_get_default_update_https_url() { return __( 'https://wordpress.org/support/article/why-should-i-use-https/' ); } function wp_get_direct_update_https_url() { $direct_update_url = ''; if ( false !== getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' ) ) { $direct_update_url = getenv( 'WP_DIRECT_UPDATE_HTTPS_URL' ); } $direct_update_url = apply_filters( 'wp_direct_update_https_url', $direct_update_url ); return $direct_update_url; } function get_dirsize( $directory, $max_execution_time = null ) { if ( is_multisite() && is_main_site() ) { $size = recurse_dirsize( $directory, $directory . '/sites', $max_execution_time ); } else { $size = recurse_dirsize( $directory, null, $max_execution_time ); } return $size; } function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) { $directory = untrailingslashit( $directory ); $save_cache = false; if ( ! isset( $directory_cache ) ) { $directory_cache = get_transient( 'dirsize_cache' ); $save_cache = true; } if ( isset( $directory_cache[ $directory ] ) && is_int( $directory_cache[ $directory ] ) ) { return $directory_cache[ $directory ]; } if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) ) { return false; } if ( ( is_string( $exclude ) && $directory === $exclude ) || ( is_array( $exclude ) && in_array( $directory, $exclude, true ) ) ) { return false; } if ( null === $max_execution_time ) { if ( function_exists( 'ini_get' ) ) { $max_execution_time = ini_get( 'max_execution_time' ); } else { $max_execution_time = 0; } if ( $max_execution_time > 10 ) { $max_execution_time -= 1; } } $size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache ); if ( false === $size ) { $size = 0; $handle = opendir( $directory ); if ( $handle ) { while ( ( $file = readdir( $handle ) ) !== false ) { $path = $directory . '/' . $file; if ( '.' !== $file && '..' !== $file ) { if ( is_file( $path ) ) { $size += filesize( $path ); } elseif ( is_dir( $path ) ) { $handlesize = recurse_dirsize( $path, $exclude, $max_execution_time, $directory_cache ); if ( $handlesize > 0 ) { $size += $handlesize; } } if ( $max_execution_time > 0 && ( microtime( true ) - WP_START_TIMESTAMP ) > $max_execution_time ) { $size = null; break; } } } closedir( $handle ); } } if ( ! is_array( $directory_cache ) ) { $directory_cache = array(); } $directory_cache[ $directory ] = $size; if ( $save_cache ) { set_transient( 'dirsize_cache', $directory_cache ); } return $size; } function clean_dirsize_cache( $path ) { if ( ! is_string( $path ) || empty( $path ) ) { trigger_error( sprintf( __( '%1$s only accepts a non-empty path string, received %2$s.' ), 'clean_dirsize_cache()', '' . gettype( $path ) . '' ) ); return; } $directory_cache = get_transient( 'dirsize_cache' ); if ( empty( $directory_cache ) ) { return; } if ( strpos( $path, '/' ) === false && strpos( $path, '\\' ) === false ) { unset( $directory_cache[ $path ] ); set_transient( 'dirsize_cache', $directory_cache ); return; } $last_path = null; $path = untrailingslashit( $path ); unset( $directory_cache[ $path ] ); while ( $last_path !== $path && DIRECTORY_SEPARATOR !== $path && '.' !== $path && '..' !== $path ) { $last_path = $path; $path = dirname( $path ); unset( $directory_cache[ $path ] ); } set_transient( 'dirsize_cache', $directory_cache ); } function is_wp_version_compatible( $required ) { global $wp_version; list( $version ) = explode( '-', $wp_version ); return empty( $required ) || version_compare( $version, $required, '>=' ); } function is_php_version_compatible( $required ) { return empty( $required ) || version_compare( phpversion(), $required, '>=' ); } function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) { return abs( (float) $expected - (float) $actual ) <= $precision; } function wp_recursive_ksort( &$array ) { foreach ( $array as &$value ) { if ( is_array( $value ) ) { wp_recursive_ksort( $value ); } } ksort( $array ); } parser = $parser; xml_set_object( $this->parser, $this ); xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' ); $status = xml_parse( $this->parser, $source ); if (! $status ) { $errorcode = xml_get_error_code( $this->parser ); if ( $errorcode != XML_ERROR_NONE ) { $xml_error = xml_error_string( $errorcode ); $error_line = xml_get_current_line_number($this->parser); $error_col = xml_get_current_column_number($this->parser); $errormsg = "$xml_error at line $error_line, column $error_col"; $this->error( $errormsg ); } } xml_parser_free( $this->parser ); unset( $this->parser ); $this->normalize(); } public function MagpieRSS( $source ) { self::__construct( $source ); } function feed_start_element($p, $element, &$attrs) { $el = $element = strtolower($element); $attrs = array_change_key_case($attrs, CASE_LOWER); $ns = false; if ( strpos( $element, ':' ) ) { list($ns, $el) = explode( ':', $element, 2); } if ( $ns and $ns != 'rdf' ) { $this->current_namespace = $ns; } if (!isset($this->feed_type) ) { if ( $el == 'rdf' ) { $this->feed_type = RSS; $this->feed_version = '1.0'; } elseif ( $el == 'rss' ) { $this->feed_type = RSS; $this->feed_version = $attrs['version']; } elseif ( $el == 'feed' ) { $this->feed_type = ATOM; $this->feed_version = $attrs['version']; $this->inchannel = true; } return; } if ( $el == 'channel' ) { $this->inchannel = true; } elseif ($el == 'item' or $el == 'entry' ) { $this->initem = true; if ( isset($attrs['rdf:about']) ) { $this->current_item['about'] = $attrs['rdf:about']; } } elseif ( $this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) { $this->intextinput = true; } elseif ( $this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) { $this->inimage = true; } elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { if ($el == 'content' ) { $el = 'atom_content'; } $this->incontent = $el; } elseif ($this->feed_type == ATOM and $this->incontent ) { $attrs_str = join(' ', array_map(array('MagpieRSS', 'map_attrs'), array_keys($attrs), array_values($attrs) ) ); $this->append_content( "<$element $attrs_str>" ); array_unshift( $this->stack, $el ); } elseif ($this->feed_type == ATOM and $el == 'link' ) { if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) { $link_el = 'link'; } else { $link_el = 'link_' . $attrs['rel']; } $this->append($link_el, $attrs['href']); } else { array_unshift($this->stack, $el); } } function feed_cdata ($p, $text) { if ($this->feed_type == ATOM and $this->incontent) { $this->append_content( $text ); } else { $current_el = join('_', array_reverse($this->stack)); $this->append($current_el, $text); } } function feed_end_element ($p, $el) { $el = strtolower($el); if ( $el == 'item' or $el == 'entry' ) { $this->items[] = $this->current_item; $this->current_item = array(); $this->initem = false; } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) { $this->intextinput = false; } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) { $this->inimage = false; } elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { $this->incontent = false; } elseif ($el == 'channel' or $el == 'feed' ) { $this->inchannel = false; } elseif ($this->feed_type == ATOM and $this->incontent ) { if ( $this->stack[0] == $el ) { $this->append_content(""); } else { $this->append_content("<$el />"); } array_shift( $this->stack ); } else { array_shift( $this->stack ); } $this->current_namespace = false; } function concat (&$str1, $str2="") { if (!isset($str1) ) { $str1=""; } $str1 .= $str2; } function append_content($text) { if ( $this->initem ) { $this->concat( $this->current_item[ $this->incontent ], $text ); } elseif ( $this->inchannel ) { $this->concat( $this->channel[ $this->incontent ], $text ); } } function append($el, $text) { if (!$el) { return; } if ( $this->current_namespace ) { if ( $this->initem ) { $this->concat( $this->current_item[ $this->current_namespace ][ $el ], $text); } elseif ($this->inchannel) { $this->concat( $this->channel[ $this->current_namespace][ $el ], $text ); } elseif ($this->intextinput) { $this->concat( $this->textinput[ $this->current_namespace][ $el ], $text ); } elseif ($this->inimage) { $this->concat( $this->image[ $this->current_namespace ][ $el ], $text ); } } else { if ( $this->initem ) { $this->concat( $this->current_item[ $el ], $text); } elseif ($this->intextinput) { $this->concat( $this->textinput[ $el ], $text ); } elseif ($this->inimage) { $this->concat( $this->image[ $el ], $text ); } elseif ($this->inchannel) { $this->concat( $this->channel[ $el ], $text ); } } } function normalize () { if ( $this->is_atom() ) { $this->channel['descripton'] = $this->channel['tagline']; for ( $i = 0; $i < count($this->items); $i++) { $item = $this->items[$i]; if ( isset($item['summary']) ) $item['description'] = $item['summary']; if ( isset($item['atom_content'])) $item['content']['encoded'] = $item['atom_content']; $this->items[$i] = $item; } } elseif ( $this->is_rss() ) { $this->channel['tagline'] = $this->channel['description']; for ( $i = 0; $i < count($this->items); $i++) { $item = $this->items[$i]; if ( isset($item['description'])) $item['summary'] = $item['description']; if ( isset($item['content']['encoded'] ) ) $item['atom_content'] = $item['content']['encoded']; $this->items[$i] = $item; } } } function is_rss () { if ( $this->feed_type == RSS ) { return $this->feed_version; } else { return false; } } function is_atom() { if ( $this->feed_type == ATOM ) { return $this->feed_version; } else { return false; } } function map_attrs($k, $v) { return "$k=\"$v\""; } function error( $errormsg, $lvl = E_USER_WARNING ) { if ( MAGPIE_DEBUG ) { trigger_error( $errormsg, $lvl); } else { error_log( $errormsg, 0); } } } if ( !function_exists('fetch_rss') ) : function fetch_rss ($url) { init(); if ( !isset($url) ) { return false; } if ( !MAGPIE_CACHE_ON ) { $resp = _fetch_remote_file( $url ); if ( is_success( $resp->status ) ) { return _response_to_rss( $resp ); } else { return false; } } else { $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); if (MAGPIE_DEBUG and $cache->ERROR) { debug($cache->ERROR, E_USER_WARNING); } $cache_status = 0; $request_headers = array(); $rss = 0; $errormsg = 0; if (!$cache->ERROR) { $cache_status = $cache->check_cache( $url ); } if ( $cache_status == 'HIT' ) { $rss = $cache->get( $url ); if ( isset($rss) and $rss ) { $rss->from_cache = 1; if ( MAGPIE_DEBUG > 1) { debug("MagpieRSS: Cache HIT", E_USER_NOTICE); } return $rss; } } if ( $cache_status == 'STALE' ) { $rss = $cache->get( $url ); if ( isset($rss->etag) and $rss->last_modified ) { $request_headers['If-None-Match'] = $rss->etag; $request_headers['If-Last-Modified'] = $rss->last_modified; } } $resp = _fetch_remote_file( $url, $request_headers ); if (isset($resp) and $resp) { if ($resp->status == '304' ) { if ( MAGPIE_DEBUG > 1) { debug("Got 304 for $url"); } $cache->set($url, $rss); return $rss; } elseif ( is_success( $resp->status ) ) { $rss = _response_to_rss( $resp ); if ( $rss ) { if (MAGPIE_DEBUG > 1) { debug("Fetch successful"); } $cache->set( $url, $rss ); return $rss; } } else { $errormsg = "Failed to fetch $url. "; if ( $resp->error ) { $http_error = substr($resp->error, 0, -2); $errormsg .= "(HTTP Error: $http_error)"; } else { $errormsg .= "(HTTP Response: " . $resp->response_code .')'; } } } else { $errormsg = "Unable to retrieve RSS file for unknown reasons."; } if ($rss) { if ( MAGPIE_DEBUG ) { debug("Returning STALE object for $url"); } return $rss; } return false; } } endif; function _fetch_remote_file($url, $headers = "" ) { $resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) ); if ( is_wp_error($resp) ) { $error = array_shift($resp->errors); $resp = new stdClass; $resp->status = 500; $resp->response_code = 500; $resp->error = $error[0] . "\n"; return $resp; } $return_headers = array(); foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { if ( !is_array($value) ) { $return_headers[] = "$key: $value"; } else { foreach ( $value as $v ) $return_headers[] = "$key: $v"; } } $response = new stdClass; $response->status = wp_remote_retrieve_response_code( $resp ); $response->response_code = wp_remote_retrieve_response_code( $resp ); $response->headers = $return_headers; $response->results = wp_remote_retrieve_body( $resp ); return $response; } function _response_to_rss ($resp) { $rss = new MagpieRSS( $resp->results ); if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) { foreach ( (array) $resp->headers as $h) { if (strpos($h, ": ")) { list($field, $val) = explode(": ", $h, 2); } else { $field = $h; $val = ""; } if ( $field == 'etag' ) { $rss->etag = $val; } if ( $field == 'last-modified' ) { $rss->last_modified = $val; } } return $rss; } else { $errormsg = "Failed to parse RSS file."; if ($rss) { $errormsg .= " (" . $rss->ERROR . ")"; } return false; } } function init () { if ( defined('MAGPIE_INITALIZED') ) { return; } else { define('MAGPIE_INITALIZED', 1); } if ( !defined('MAGPIE_CACHE_ON') ) { define('MAGPIE_CACHE_ON', 1); } if ( !defined('MAGPIE_CACHE_DIR') ) { define('MAGPIE_CACHE_DIR', './cache'); } if ( !defined('MAGPIE_CACHE_AGE') ) { define('MAGPIE_CACHE_AGE', 60*60); } if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { define('MAGPIE_CACHE_FRESH_ONLY', 0); } if ( !defined('MAGPIE_DEBUG') ) { define('MAGPIE_DEBUG', 0); } if ( !defined('MAGPIE_USER_AGENT') ) { $ua = 'WordPress/' . $GLOBALS['wp_version']; if ( MAGPIE_CACHE_ON ) { $ua = $ua . ')'; } else { $ua = $ua . '; No cache)'; } define('MAGPIE_USER_AGENT', $ua); } if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { define('MAGPIE_FETCH_TIME_OUT', 2); } if ( !defined('MAGPIE_USE_GZIP') ) { define('MAGPIE_USE_GZIP', true); } } function is_info ($sc) { return $sc >= 100 && $sc < 200; } function is_success ($sc) { return $sc >= 200 && $sc < 300; } function is_redirect ($sc) { return $sc >= 300 && $sc < 400; } function is_error ($sc) { return $sc >= 400 && $sc < 600; } function is_client_error ($sc) { return $sc >= 400 && $sc < 500; } function is_server_error ($sc) { return $sc >= 500 && $sc < 600; } class RSSCache { var $BASE_CACHE; var $MAX_AGE = 43200; var $ERROR = ''; function __construct( $base = '', $age = '' ) { $this->BASE_CACHE = WP_CONTENT_DIR . '/cache'; if ( $base ) { $this->BASE_CACHE = $base; } if ( $age ) { $this->MAX_AGE = $age; } } public function RSSCache( $base = '', $age = '' ) { self::__construct( $base, $age ); } function set ($url, $rss) { $cache_option = 'rss_' . $this->file_name( $url ); set_transient($cache_option, $rss, $this->MAX_AGE); return $cache_option; } function get ($url) { $this->ERROR = ""; $cache_option = 'rss_' . $this->file_name( $url ); if ( ! $rss = get_transient( $cache_option ) ) { $this->debug( "Cache does not contain: $url (cache option: $cache_option)" ); return 0; } return $rss; } function check_cache ( $url ) { $this->ERROR = ""; $cache_option = 'rss_' . $this->file_name( $url ); if ( get_transient($cache_option) ) { return 'HIT'; } else { return 'MISS'; } } function serialize ( $rss ) { return serialize( $rss ); } function unserialize ( $data ) { return unserialize( $data ); } function file_name ($url) { return md5( $url ); } function error ($errormsg, $lvl=E_USER_WARNING) { $this->ERROR = $errormsg; if ( MAGPIE_DEBUG ) { trigger_error( $errormsg, $lvl); } else { error_log( $errormsg, 0); } } function debug ($debugmsg, $lvl=E_USER_NOTICE) { if ( MAGPIE_DEBUG ) { $this->error("MagpieRSS [debug] $debugmsg", $lvl); } } } if ( !function_exists('parse_w3cdtf') ) : function parse_w3cdtf ( $date_str ) { $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; if ( preg_match( $pat, $date_str, $match ) ) { list( $year, $month, $day, $hours, $minutes, $seconds) = array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); $offset = 0; if ( $match[11] == 'Z' ) { } else { list( $tz_mod, $tz_hour, $tz_min ) = array( $match[8], $match[9], $match[10]); if ( ! $tz_hour ) { $tz_hour = 0; } if ( ! $tz_min ) { $tz_min = 0; } $offset_secs = (($tz_hour*60)+$tz_min)*60; if ( $tz_mod == '+' ) { $offset_secs = $offset_secs * -1; } $offset = $offset_secs; } $epoch = $epoch + $offset; return $epoch; } else { return -1; } } endif; if ( !function_exists('wp_rss') ) : function wp_rss( $url, $num_items = -1 ) { if ( $rss = fetch_rss( $url ) ) { echo '
              '; if ( $num_items !== -1 ) { $rss->items = array_slice( $rss->items, 0, $num_items ); } foreach ( (array) $rss->items as $item ) { printf( '
            • %3$s
            • ', esc_url( $item['link'] ), esc_attr( strip_tags( $item['description'] ) ), esc_html( $item['title'] ) ); } echo '
            '; } else { _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); } } endif; if ( !function_exists('get_rss') ) : function get_rss ($url, $num_items = 5) { $rss = fetch_rss($url); if ( $rss ) { $rss->items = array_slice($rss->items, 0, $num_items); foreach ( (array) $rss->items as $item ) { echo "
          • \n"; echo ""; echo esc_html($item['title']); echo "
            \n"; echo "
          • \n"; } } else { return false; } } endif; &/\[\]\x00-\x20=]@', $tag ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' ), '4.4.0' ); return; } $shortcode_tags[ $tag ] = $callback; } function remove_shortcode( $tag ) { global $shortcode_tags; unset( $shortcode_tags[ $tag ] ); } function remove_all_shortcodes() { global $shortcode_tags; $shortcode_tags = array(); } function shortcode_exists( $tag ) { global $shortcode_tags; return array_key_exists( $tag, $shortcode_tags ); } function has_shortcode( $content, $tag ) { if ( false === strpos( $content, '[' ) ) { return false; } if ( shortcode_exists( $tag ) ) { preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); if ( empty( $matches ) ) { return false; } foreach ( $matches as $shortcode ) { if ( $tag === $shortcode[2] ) { return true; } elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) { return true; } } } return false; } function apply_shortcodes( $content, $ignore_html = false ) { return do_shortcode( $content, $ignore_html ); } function do_shortcode( $content, $ignore_html = false ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $content; } preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { return $content; } $content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); $content = unescape_invalid_shortcodes( $content ); return $content; } function get_shortcode_regex( $tagnames = null ) { global $shortcode_tags; if ( empty( $tagnames ) ) { $tagnames = array_keys( $shortcode_tags ); } $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); return '\\[' . '(\\[?)' . "($tagregexp)" . '(?![\\w-])' . '(' . '[^\\]\\/]*' . '(?:' . '\\/(?!\\])' . '[^\\]\\/]*' . ')*?' . ')' . '(?:' . '(\\/)' . '\\]' . '|' . '\\]' . '(?:' . '(' . '[^\\[]*+' . '(?:' . '\\[(?!\\/\\2\\])' . '[^\\[]*+' . ')*+' . ')' . '\\[\\/\\2\\]' . ')?' . ')' . '(\\]?)'; } function do_shortcode_tag( $m ) { global $shortcode_tags; if ( '[' === $m[1] && ']' === $m[6] ) { return substr( $m[0], 1, -1 ); } $tag = $m[2]; $attr = shortcode_parse_atts( $m[3] ); if ( ! is_callable( $shortcode_tags[ $tag ] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ), '4.3.0' ); return $m[0]; } $return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m ); if ( false !== $return ) { return $return; } $content = isset( $m[5] ) ? $m[5] : null; $output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6]; return apply_filters( 'do_shortcode_tag', $output, $tag, $attr, $m ); } function do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ) { $trans = array( '[' => '[', ']' => ']', ); $content = strtr( $content, $trans ); $trans = array( '[' => '[', ']' => ']', ); $pattern = get_shortcode_regex( $tagnames ); $textarr = wp_html_split( $content ); foreach ( $textarr as &$element ) { if ( '' === $element || '<' !== $element[0] ) { continue; } $noopen = false === strpos( $element, '[' ); $noclose = false === strpos( $element, ']' ); if ( $noopen || $noclose ) { if ( $noopen xor $noclose ) { $element = strtr( $element, $trans ); } continue; } if ( $ignore_html || '', $serialized_block_name, $serialized_attributes ); } return sprintf( '%s', $serialized_block_name, $serialized_attributes, $block_content, $serialized_block_name ); } function serialize_block( $block ) { $block_content = ''; $index = 0; foreach ( $block['innerContent'] as $chunk ) { $block_content .= is_string( $chunk ) ? $chunk : serialize_block( $block['innerBlocks'][ $index++ ] ); } if ( ! is_array( $block['attrs'] ) ) { $block['attrs'] = array(); } return get_comment_delimited_block_content( $block['blockName'], $block['attrs'], $block_content ); } function serialize_blocks( $blocks ) { return implode( '', array_map( 'serialize_block', $blocks ) ); } function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols = array() ) { $result = ''; $blocks = parse_blocks( $text ); foreach ( $blocks as $block ) { $block = filter_block_kses( $block, $allowed_html, $allowed_protocols ); $result .= serialize_block( $block ); } return $result; } function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() ) { $block['attrs'] = filter_block_kses_value( $block['attrs'], $allowed_html, $allowed_protocols ); if ( is_array( $block['innerBlocks'] ) ) { foreach ( $block['innerBlocks'] as $i => $inner_block ) { $block['innerBlocks'][ $i ] = filter_block_kses( $inner_block, $allowed_html, $allowed_protocols ); } } return $block; } function filter_block_kses_value( $value, $allowed_html, $allowed_protocols = array() ) { if ( is_array( $value ) ) { foreach ( $value as $key => $inner_value ) { $filtered_key = filter_block_kses_value( $key, $allowed_html, $allowed_protocols ); $filtered_value = filter_block_kses_value( $inner_value, $allowed_html, $allowed_protocols ); if ( $filtered_key !== $key ) { unset( $value[ $key ] ); } $value[ $filtered_key ] = $filtered_value; } } elseif ( is_string( $value ) ) { return wp_kses( $value, $allowed_html, $allowed_protocols ); } return $value; } function excerpt_remove_blocks( $content ) { $allowed_inner_blocks = array( null, 'core/freeform', 'core/heading', 'core/html', 'core/list', 'core/media-text', 'core/paragraph', 'core/preformatted', 'core/pullquote', 'core/quote', 'core/table', 'core/verse', ); $allowed_wrapper_blocks = array( 'core/columns', 'core/column', 'core/group', ); $allowed_wrapper_blocks = apply_filters( 'excerpt_allowed_wrapper_blocks', $allowed_wrapper_blocks ); $allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks ); $allowed_blocks = apply_filters( 'excerpt_allowed_blocks', $allowed_blocks ); $blocks = parse_blocks( $content ); $output = ''; foreach ( $blocks as $block ) { if ( in_array( $block['blockName'], $allowed_blocks, true ) ) { if ( ! empty( $block['innerBlocks'] ) ) { if ( in_array( $block['blockName'], $allowed_wrapper_blocks, true ) ) { $output .= _excerpt_render_inner_blocks( $block, $allowed_blocks ); continue; } foreach ( $block['innerBlocks'] as $inner_block ) { if ( ! in_array( $inner_block['blockName'], $allowed_inner_blocks, true ) || ! empty( $inner_block['innerBlocks'] ) ) { continue 2; } } } $output .= render_block( $block ); } } return $output; } function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) { $output = ''; foreach ( $parsed_block['innerBlocks'] as $inner_block ) { if ( ! in_array( $inner_block['blockName'], $allowed_blocks, true ) ) { continue; } if ( empty( $inner_block['innerBlocks'] ) ) { $output .= render_block( $inner_block ); } else { $output .= _excerpt_render_inner_blocks( $inner_block, $allowed_blocks ); } } return $output; } function render_block( $parsed_block ) { global $post; $parent_block = null; $pre_render = apply_filters( 'pre_render_block', null, $parsed_block, $parent_block ); if ( ! is_null( $pre_render ) ) { return $pre_render; } $source_block = $parsed_block; $parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block ); $context = array(); if ( $post instanceof WP_Post ) { $context['postId'] = $post->ID; $context['postType'] = $post->post_type; } $context = apply_filters( 'render_block_context', $context, $parsed_block, $parent_block ); $block = new WP_Block( $parsed_block, $context ); return $block->render(); } function parse_blocks( $content ) { $parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' ); $parser = new $parser_class(); return $parser->parse( $content ); } function do_blocks( $content ) { $blocks = parse_blocks( $content ); $output = ''; foreach ( $blocks as $block ) { $output .= render_block( $block ); } $priority = has_filter( 'the_content', 'wpautop' ); if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) { remove_filter( 'the_content', 'wpautop', $priority ); add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 ); } return $output; } function _restore_wpautop_hook( $content ) { $current_priority = has_filter( 'the_content', '_restore_wpautop_hook' ); add_filter( 'the_content', 'wpautop', $current_priority - 1 ); remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority ); return $content; } function block_version( $content ) { return has_blocks( $content ) ? 1 : 0; } function register_block_style( $block_name, $style_properties ) { return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties ); } function unregister_block_style( $block_name, $block_style_name ) { return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name ); } function block_has_support( $block_type, $feature, $default = false ) { $block_support = $default; if ( $block_type && property_exists( $block_type, 'supports' ) ) { $block_support = _wp_array_get( $block_type->supports, $feature, $default ); } return true === $block_support || is_array( $block_support ); } function wp_migrate_old_typography_shape( $metadata ) { if ( ! isset( $metadata['supports'] ) ) { return $metadata; } $typography_keys = array( '__experimentalFontFamily', '__experimentalFontStyle', '__experimentalFontWeight', '__experimentalLetterSpacing', '__experimentalTextDecoration', '__experimentalTextTransform', 'fontSize', 'lineHeight', ); foreach ( $typography_keys as $typography_key ) { $support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null ); if ( null !== $support_for_key ) { _doing_it_wrong( 'register_block_type_from_metadata()', sprintf( __( 'Block "%1$s" is declaring %2$s support in %3$s file under %4$s. %2$s support is now declared under %5$s.' ), $metadata['name'], "$typography_key", 'block.json', "supports.$typography_key", "supports.typography.$typography_key" ), '5.8.0' ); _wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key ); unset( $metadata['supports'][ $typography_key ] ); } } return $metadata; } function build_query_vars_from_query_block( $block, $page ) { $query = array( 'post_type' => 'post', 'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array(), ); if ( isset( $block->context['query'] ) ) { if ( ! empty( $block->context['query']['postType'] ) ) { $post_type_param = $block->context['query']['postType']; if ( is_post_type_viewable( $post_type_param ) ) { $query['post_type'] = $post_type_param; } } if ( isset( $block->context['query']['sticky'] ) && ! empty( $block->context['query']['sticky'] ) ) { $sticky = get_option( 'sticky_posts' ); if ( 'only' === $block->context['query']['sticky'] ) { $query['post__in'] = $sticky; } else { $query['post__not_in'] = array_merge( $query['post__not_in'], $sticky ); } } if ( ! empty( $block->context['query']['exclude'] ) ) { $excluded_post_ids = array_map( 'intval', $block->context['query']['exclude'] ); $excluded_post_ids = array_filter( $excluded_post_ids ); $query['post__not_in'] = array_merge( $query['post__not_in'], $excluded_post_ids ); } if ( isset( $block->context['query']['perPage'] ) && is_numeric( $block->context['query']['perPage'] ) ) { $per_page = absint( $block->context['query']['perPage'] ); $offset = 0; if ( isset( $block->context['query']['offset'] ) && is_numeric( $block->context['query']['offset'] ) ) { $offset = absint( $block->context['query']['offset'] ); } $query['offset'] = ( $per_page * ( $page - 1 ) ) + $offset; $query['posts_per_page'] = $per_page; } if ( ! empty( $block->context['query']['categoryIds'] ) || ! empty( $block->context['query']['tagIds'] ) ) { $tax_query = array(); if ( ! empty( $block->context['query']['categoryIds'] ) ) { $tax_query[] = array( 'taxonomy' => 'category', 'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ), 'include_children' => false, ); } if ( ! empty( $block->context['query']['tagIds'] ) ) { $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ), 'include_children' => false, ); } $query['tax_query'] = $tax_query; } if ( ! empty( $block->context['query']['taxQuery'] ) ) { $query['tax_query'] = array(); foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) { if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) { $query['tax_query'][] = array( 'taxonomy' => $taxonomy, 'terms' => array_filter( array_map( 'intval', $terms ) ), 'include_children' => false, ); } } } if ( isset( $block->context['query']['order'] ) && in_array( strtoupper( $block->context['query']['order'] ), array( 'ASC', 'DESC' ), true ) ) { $query['order'] = strtoupper( $block->context['query']['order'] ); } if ( isset( $block->context['query']['orderBy'] ) ) { $query['orderby'] = $block->context['query']['orderBy']; } if ( isset( $block->context['query']['author'] ) && (int) $block->context['query']['author'] > 0 ) { $query['author'] = (int) $block->context['query']['author']; } if ( ! empty( $block->context['query']['search'] ) ) { $query['s'] = $block->context['query']['search']; } } return $query; } function get_query_pagination_arrow( $block, $is_next ) { $arrow_map = array( 'none' => '', 'arrow' => array( 'next' => '→', 'previous' => '←', ), 'chevron' => array( 'next' => '»', 'previous' => '«', ), ); if ( ! empty( $block->context['paginationArrow'] ) && array_key_exists( $block->context['paginationArrow'], $arrow_map ) && ! empty( $arrow_map[ $block->context['paginationArrow'] ] ) ) { $pagination_type = $is_next ? 'next' : 'previous'; $arrow_attribute = $block->context['paginationArrow']; $arrow = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ]; $arrow_classes = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute"; return "$arrow"; } return null; } function _wp_multiple_block_styles( $metadata ) { foreach ( array( 'style', 'editorStyle' ) as $key ) { if ( ! empty( $metadata[ $key ] ) && is_array( $metadata[ $key ] ) ) { $default_style = array_shift( $metadata[ $key ] ); foreach ( $metadata[ $key ] as $handle ) { $args = array( 'handle' => $handle ); if ( 0 === strpos( $handle, 'file:' ) && isset( $metadata['file'] ) ) { $style_path = remove_block_asset_path_prefix( $handle ); $theme_path_norm = wp_normalize_path( get_theme_file_path() ); $style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) ); $is_theme_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $theme_path_norm ); $style_uri = plugins_url( $style_path, $metadata['file'] ); if ( $is_theme_block ) { $style_uri = get_theme_file_uri( str_replace( $theme_path_norm, '', $style_path_norm ) ); } $args = array( 'handle' => sanitize_key( "{$metadata['name']}-{$style_path}" ), 'src' => $style_uri, ); } wp_enqueue_block_style( $metadata['name'], $args ); } $metadata[ $key ] = $default_style; } } return $metadata; } add_filter( 'block_type_metadata', '_wp_multiple_block_styles' ); function build_comment_query_vars_from_block( $block ) { $comment_args = array( 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', 'no_found_rows' => false, ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } if ( ! empty( $block->context['postId'] ) ) { $comment_args['post_id'] = (int) $block->context['postId']; } if ( get_option( 'thread_comments' ) ) { $comment_args['hierarchical'] = 'threaded'; } else { $comment_args['hierarchical'] = false; } if ( get_option( 'page_comments' ) === '1' || get_option( 'page_comments' ) === true ) { $per_page = get_option( 'comments_per_page' ); $default_page = get_option( 'default_comments_page' ); if ( $per_page > 0 ) { $comment_args['number'] = $per_page; $page = (int) get_query_var( 'cpage' ); if ( $page ) { $comment_args['paged'] = $page; } elseif ( 'oldest' === $default_page ) { $comment_args['paged'] = 1; } elseif ( 'newest' === $default_page ) { $max_num_pages = (int) ( new WP_Comment_Query( $comment_args ) )->max_num_pages; if ( 0 !== $max_num_pages ) { $comment_args['paged'] = $max_num_pages; } } if ( 0 === $page && isset( $comment_args['paged'] ) && $comment_args['paged'] > 0 ) { set_query_var( 'cpage', $comment_args['paged'] ); } } } return $comment_args; } function get_comments_pagination_arrow( $block, $pagination_type = 'next' ) { $arrow_map = array( 'none' => '', 'arrow' => array( 'next' => '→', 'previous' => '←', ), 'chevron' => array( 'next' => '»', 'previous' => '«', ), ); if ( ! empty( $block->context['comments/paginationArrow'] ) && ! empty( $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ] ) ) { $arrow_attribute = $block->context['comments/paginationArrow']; $arrow = $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ]; $arrow_classes = "wp-block-comments-pagination-$pagination_type-arrow is-arrow-$arrow_attribute"; return "$arrow"; } return null; } get_settings(); return _wp_array_get( $settings, $path, $settings ); } function wp_get_global_styles( $path = array(), $context = array() ) { if ( ! empty( $context['block_name'] ) ) { $path = array_merge( array( 'blocks', $context['block_name'] ), $path ); } $origin = 'custom'; if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) { $origin = 'theme'; } $styles = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_raw_data()['styles']; return _wp_array_get( $styles, $path, $styles ); } function wp_get_global_stylesheet( $types = array() ) { $can_use_cached = ( ( empty( $types ) ) && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && ! is_admin() ); $transient_name = 'global_styles_' . get_stylesheet(); if ( $can_use_cached ) { $cached = get_transient( $transient_name ); if ( $cached ) { return $cached; } } $tree = WP_Theme_JSON_Resolver::get_merged_data(); $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); if ( empty( $types ) && ! $supports_theme_json ) { $types = array( 'variables', 'presets' ); } elseif ( empty( $types ) ) { $types = array( 'variables', 'styles', 'presets' ); } $styles_variables = ''; if ( in_array( 'variables', $types, true ) ) { $styles_variables = $tree->get_stylesheet( array( 'variables' ) ); $types = array_diff( $types, array( 'variables' ) ); } $styles_rest = ''; if ( ! empty( $types ) ) { $origins = array( 'default', 'theme', 'custom' ); if ( ! $supports_theme_json ) { $origins = array( 'default' ); } $styles_rest = $tree->get_stylesheet( $types, $origins ); } $stylesheet = $styles_variables . $styles_rest; if ( $can_use_cached ) { set_transient( $transient_name, $stylesheet, MINUTE_IN_SECONDS ); } return $stylesheet; } function wp_get_global_styles_svg_filters() { $can_use_cached = ( ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) && ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) && ! is_admin() ); $transient_name = 'global_styles_svg_filters_' . get_stylesheet(); if ( $can_use_cached ) { $cached = get_transient( $transient_name ); if ( $cached ) { return $cached; } } $supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support(); $origins = array( 'default', 'theme', 'custom' ); if ( ! $supports_theme_json ) { $origins = array( 'default' ); } $tree = WP_Theme_JSON_Resolver::get_merged_data(); $svgs = $tree->get_svg_filters( $origins ); if ( $can_use_cached ) { set_transient( $transient_name, $svgs, MINUTE_IN_SECONDS ); } return $svgs; } register( $widget ); } function unregister_widget( $widget ) { global $wp_widget_factory; $wp_widget_factory->unregister( $widget ); } function register_sidebars( $number = 1, $args = array() ) { global $wp_registered_sidebars; $number = (int) $number; if ( is_string( $args ) ) { parse_str( $args, $args ); } for ( $i = 1; $i <= $number; $i++ ) { $_args = $args; if ( $number > 1 ) { if ( isset( $args['name'] ) ) { $_args['name'] = sprintf( $args['name'], $i ); } else { $_args['name'] = sprintf( __( 'Sidebar %d' ), $i ); } } else { $_args['name'] = isset( $args['name'] ) ? $args['name'] : __( 'Sidebar' ); } if ( isset( $args['id'] ) ) { $_args['id'] = $args['id']; $n = 2; while ( is_registered_sidebar( $_args['id'] ) ) { $_args['id'] = $args['id'] . '-' . $n++; } } else { $n = count( $wp_registered_sidebars ); do { $_args['id'] = 'sidebar-' . ++$n; } while ( is_registered_sidebar( $_args['id'] ) ); } register_sidebar( $_args ); } } function register_sidebar( $args = array() ) { global $wp_registered_sidebars; $i = count( $wp_registered_sidebars ) + 1; $id_is_empty = empty( $args['id'] ); $defaults = array( 'name' => sprintf( __( 'Sidebar %d' ), $i ), 'id' => "sidebar-$i", 'description' => '', 'class' => '', 'before_widget' => '
          • ', 'after_widget' => "
          • \n", 'before_title' => '

            ', 'after_title' => "

            \n", 'before_sidebar' => '', 'after_sidebar' => '', 'show_in_rest' => false, ); $sidebar = wp_parse_args( $args, apply_filters( 'register_sidebar_defaults', $defaults ) ); if ( $id_is_empty ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ), 'id', $sidebar['name'], $sidebar['id'] ), '4.2.0' ); } $wp_registered_sidebars[ $sidebar['id'] ] = $sidebar; add_theme_support( 'widgets' ); do_action( 'register_sidebar', $sidebar ); return $sidebar['id']; } function unregister_sidebar( $sidebar_id ) { global $wp_registered_sidebars; unset( $wp_registered_sidebars[ $sidebar_id ] ); } function is_registered_sidebar( $sidebar_id ) { global $wp_registered_sidebars; return isset( $wp_registered_sidebars[ $sidebar_id ] ); } function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array(), ...$params ) { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks; $id = strtolower( $id ); if ( empty( $output_callback ) ) { unset( $wp_registered_widgets[ $id ] ); return; } $id_base = _get_widget_id_base( $id ); if ( in_array( $output_callback, $_wp_deprecated_widgets_callbacks, true ) && ! is_callable( $output_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); unset( $wp_registered_widget_updates[ $id_base ] ); return; } $defaults = array( 'classname' => $output_callback ); $options = wp_parse_args( $options, $defaults ); $widget = array( 'name' => $name, 'id' => $id, 'callback' => $output_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); if ( is_callable( $output_callback ) && ( ! isset( $wp_registered_widgets[ $id ] ) || did_action( 'widgets_init' ) ) ) { do_action( 'wp_register_sidebar_widget', $widget ); $wp_registered_widgets[ $id ] = $widget; } } function wp_widget_description( $id ) { if ( ! is_scalar( $id ) ) { return; } global $wp_registered_widgets; if ( isset( $wp_registered_widgets[ $id ]['description'] ) ) { return esc_html( $wp_registered_widgets[ $id ]['description'] ); } } function wp_sidebar_description( $id ) { if ( ! is_scalar( $id ) ) { return; } global $wp_registered_sidebars; if ( isset( $wp_registered_sidebars[ $id ]['description'] ) ) { return wp_kses( $wp_registered_sidebars[ $id ]['description'], 'sidebar_description' ); } } function wp_unregister_sidebar_widget( $id ) { do_action( 'wp_unregister_sidebar_widget', $id ); wp_register_sidebar_widget( $id, '', '' ); wp_unregister_widget_control( $id ); } function wp_register_widget_control( $id, $name, $control_callback, $options = array(), ...$params ) { global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks; $id = strtolower( $id ); $id_base = _get_widget_id_base( $id ); if ( empty( $control_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); unset( $wp_registered_widget_updates[ $id_base ] ); return; } if ( in_array( $control_callback, $_wp_deprecated_widgets_callbacks, true ) && ! is_callable( $control_callback ) ) { unset( $wp_registered_widgets[ $id ] ); return; } if ( isset( $wp_registered_widget_controls[ $id ] ) && ! did_action( 'widgets_init' ) ) { return; } $defaults = array( 'width' => 250, 'height' => 200, ); $options = wp_parse_args( $options, $defaults ); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $control_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_controls[ $id ] = $widget; if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) { return; } if ( isset( $widget['params'][0]['number'] ) ) { $widget['params'][0]['number'] = -1; } unset( $widget['width'], $widget['height'], $widget['name'], $widget['id'] ); $wp_registered_widget_updates[ $id_base ] = $widget; } function _register_widget_update_callback( $id_base, $update_callback, $options = array(), ...$params ) { global $wp_registered_widget_updates; if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) { if ( empty( $update_callback ) ) { unset( $wp_registered_widget_updates[ $id_base ] ); } return; } $widget = array( 'callback' => $update_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_updates[ $id_base ] = $widget; } function _register_widget_form_callback( $id, $name, $form_callback, $options = array(), ...$params ) { global $wp_registered_widget_controls; $id = strtolower( $id ); if ( empty( $form_callback ) ) { unset( $wp_registered_widget_controls[ $id ] ); return; } if ( isset( $wp_registered_widget_controls[ $id ] ) && ! did_action( 'widgets_init' ) ) { return; } $defaults = array( 'width' => 250, 'height' => 200, ); $options = wp_parse_args( $options, $defaults ); $options['width'] = (int) $options['width']; $options['height'] = (int) $options['height']; $widget = array( 'name' => $name, 'id' => $id, 'callback' => $form_callback, 'params' => $params, ); $widget = array_merge( $widget, $options ); $wp_registered_widget_controls[ $id ] = $widget; } function wp_unregister_widget_control( $id ) { wp_register_widget_control( $id, '', '' ); } function dynamic_sidebar( $index = 1 ) { global $wp_registered_sidebars, $wp_registered_widgets; if ( is_int( $index ) ) { $index = "sidebar-$index"; } else { $index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { if ( sanitize_title( $value['name'] ) === $index ) { $index = $key; break; } } } $sidebars_widgets = wp_get_sidebars_widgets(); if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { do_action( 'dynamic_sidebar_before', $index, false ); do_action( 'dynamic_sidebar_after', $index, false ); return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); } $sidebar = $wp_registered_sidebars[ $index ]; $sidebar['before_sidebar'] = sprintf( $sidebar['before_sidebar'], $sidebar['id'], $sidebar['class'] ); do_action( 'dynamic_sidebar_before', $index, true ); if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) { echo $sidebar['before_sidebar']; } $did_one = false; foreach ( (array) $sidebars_widgets[ $index ] as $id ) { if ( ! isset( $wp_registered_widgets[ $id ] ) ) { continue; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $id, 'widget_name' => $wp_registered_widgets[ $id ]['name'], ) ), ), (array) $wp_registered_widgets[ $id ]['params'] ); $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], str_replace( '\\', '_', $id ), $classname_ ); $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $id ]['callback']; do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); $did_one = true; } } if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) { echo $sidebar['after_sidebar']; } do_action( 'dynamic_sidebar_after', $index, true ); return apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index ); } function is_active_widget( $callback = false, $widget_id = false, $id_base = false, $skip_inactive = true ) { global $wp_registered_widgets; $sidebars_widgets = wp_get_sidebars_widgets(); if ( is_array( $sidebars_widgets ) ) { foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( $skip_inactive && ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) ) { continue; } if ( is_array( $widgets ) ) { foreach ( $widgets as $widget ) { if ( ( $callback && isset( $wp_registered_widgets[ $widget ]['callback'] ) && $wp_registered_widgets[ $widget ]['callback'] === $callback ) || ( $id_base && _get_widget_id_base( $widget ) === $id_base ) ) { if ( ! $widget_id || $widget_id === $wp_registered_widgets[ $widget ]['id'] ) { return $sidebar; } } } } } } return false; } function is_dynamic_sidebar() { global $wp_registered_widgets, $wp_registered_sidebars; $sidebars_widgets = get_option( 'sidebars_widgets' ); foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { if ( ! empty( $sidebars_widgets[ $index ] ) ) { foreach ( (array) $sidebars_widgets[ $index ] as $widget ) { if ( array_key_exists( $widget, $wp_registered_widgets ) ) { return true; } } } } return false; } function is_active_sidebar( $index ) { $index = ( is_int( $index ) ) ? "sidebar-$index" : sanitize_title( $index ); $sidebars_widgets = wp_get_sidebars_widgets(); $is_active_sidebar = ! empty( $sidebars_widgets[ $index ] ); return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index ); } function wp_get_sidebars_widgets( $deprecated = true ) { if ( true !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); } global $_wp_sidebars_widgets, $sidebars_widgets; if ( ! is_admin() ) { if ( empty( $_wp_sidebars_widgets ) ) { $_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() ); } $sidebars_widgets = $_wp_sidebars_widgets; } else { $sidebars_widgets = get_option( 'sidebars_widgets', array() ); } if ( is_array( $sidebars_widgets ) && isset( $sidebars_widgets['array_version'] ) ) { unset( $sidebars_widgets['array_version'] ); } return apply_filters( 'sidebars_widgets', $sidebars_widgets ); } function wp_get_sidebar( $id ) { global $wp_registered_sidebars; foreach ( (array) $wp_registered_sidebars as $sidebar ) { if ( $sidebar['id'] === $id ) { return $sidebar; } } if ( 'wp_inactive_widgets' === $id ) { return array( 'id' => 'wp_inactive_widgets', 'name' => __( 'Inactive widgets' ), ); } return null; } function wp_set_sidebars_widgets( $sidebars_widgets ) { global $_wp_sidebars_widgets; $_wp_sidebars_widgets = null; if ( ! isset( $sidebars_widgets['array_version'] ) ) { $sidebars_widgets['array_version'] = 3; } update_option( 'sidebars_widgets', $sidebars_widgets ); } function wp_get_widget_defaults() { global $wp_registered_sidebars; $defaults = array(); foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { $defaults[ $index ] = array(); } return $defaults; } function wp_convert_widget_settings( $base_name, $option_name, $settings ) { $single = false; $changed = false; if ( empty( $settings ) ) { $single = true; } else { foreach ( array_keys( $settings ) as $number ) { if ( 'number' === $number ) { continue; } if ( ! is_numeric( $number ) ) { $single = true; break; } } } if ( $single ) { $settings = array( 2 => $settings ); if ( is_admin() ) { $sidebars_widgets = get_option( 'sidebars_widgets' ); } else { if ( empty( $GLOBALS['_wp_sidebars_widgets'] ) ) { $GLOBALS['_wp_sidebars_widgets'] = get_option( 'sidebars_widgets', array() ); } $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets']; } foreach ( (array) $sidebars_widgets as $index => $sidebar ) { if ( is_array( $sidebar ) ) { foreach ( $sidebar as $i => $name ) { if ( $base_name === $name ) { $sidebars_widgets[ $index ][ $i ] = "$name-2"; $changed = true; break 2; } } } } if ( is_admin() && $changed ) { update_option( 'sidebars_widgets', $sidebars_widgets ); } } $settings['_multiwidget'] = 1; if ( is_admin() ) { update_option( $option_name, $settings ); } return $settings; } function the_widget( $widget, $instance = array(), $args = array() ) { global $wp_widget_factory; if ( ! isset( $wp_widget_factory->widgets[ $widget ] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Widgets need to be registered using %s, before they can be displayed.' ), 'register_widget()' ), '4.9.0' ); return; } $widget_obj = $wp_widget_factory->widgets[ $widget ]; if ( ! ( $widget_obj instanceof WP_Widget ) ) { return; } $default_args = array( 'before_widget' => '
            ', 'after_widget' => '
            ', 'before_title' => '

            ', 'after_title' => '

            ', ); $args = wp_parse_args( $args, $default_args ); $args['before_widget'] = sprintf( $args['before_widget'], $widget_obj->widget_options['classname'] ); $instance = wp_parse_args( $instance ); $instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args ); if ( false === $instance ) { return; } do_action( 'the_widget', $widget, $instance, $args ); $widget_obj->_set( -1 ); $widget_obj->widget( $args, $instance ); } function _get_widget_id_base( $id ) { return preg_replace( '/-[0-9]+$/', '', $id ); } function _wp_sidebars_changed() { global $sidebars_widgets; if ( ! is_array( $sidebars_widgets ) ) { $sidebars_widgets = wp_get_sidebars_widgets(); } retrieve_widgets( true ); } function retrieve_widgets( $theme_changed = false ) { global $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; $registered_sidebars_keys = array_keys( $wp_registered_sidebars ); $registered_widgets_ids = array_keys( $wp_registered_widgets ); if ( ! is_array( get_theme_mod( 'sidebars_widgets' ) ) ) { if ( empty( $sidebars_widgets ) ) { return array(); } unset( $sidebars_widgets['array_version'] ); $sidebars_widgets_keys = array_keys( $sidebars_widgets ); sort( $sidebars_widgets_keys ); sort( $registered_sidebars_keys ); if ( $sidebars_widgets_keys === $registered_sidebars_keys ) { $sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids ); return $sidebars_widgets; } } $sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids ); $sidebars_widgets = wp_map_sidebars_widgets( $sidebars_widgets ); $shown_widgets = array_merge( ...array_values( $sidebars_widgets ) ); $lost_widgets = array_diff( $registered_widgets_ids, $shown_widgets ); foreach ( $lost_widgets as $key => $widget_id ) { $number = preg_replace( '/.+?-([0-9]+)$/', '$1', $widget_id ); if ( is_numeric( $number ) && (int) $number < 2 ) { unset( $lost_widgets[ $key ] ); } } $sidebars_widgets['wp_inactive_widgets'] = array_merge( $lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets'] ); if ( 'customize' !== $theme_changed ) { wp_set_sidebars_widgets( $sidebars_widgets ); } return $sidebars_widgets; } function wp_map_sidebars_widgets( $existing_sidebars_widgets ) { global $wp_registered_sidebars; $new_sidebars_widgets = array( 'wp_inactive_widgets' => array(), ); if ( ! is_array( $existing_sidebars_widgets ) || empty( $existing_sidebars_widgets ) ) { return $new_sidebars_widgets; } foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], (array) $widgets ); unset( $existing_sidebars_widgets[ $sidebar ] ); } } if ( 1 === count( $existing_sidebars_widgets ) && 1 === count( $wp_registered_sidebars ) ) { $new_sidebars_widgets[ key( $wp_registered_sidebars ) ] = array_pop( $existing_sidebars_widgets ); return $new_sidebars_widgets; } $existing_sidebars = array_keys( $existing_sidebars_widgets ); foreach ( $wp_registered_sidebars as $sidebar => $name ) { if ( in_array( $sidebar, $existing_sidebars, true ) ) { $new_sidebars_widgets[ $sidebar ] = $existing_sidebars_widgets[ $sidebar ]; unset( $existing_sidebars_widgets[ $sidebar ] ); } elseif ( ! array_key_exists( $sidebar, $new_sidebars_widgets ) ) { $new_sidebars_widgets[ $sidebar ] = array(); } } if ( ! empty( $existing_sidebars_widgets ) ) { $common_slug_groups = array( array( 'sidebar', 'primary', 'main', 'right' ), array( 'second', 'left' ), array( 'sidebar-2', 'footer', 'bottom' ), array( 'header', 'top' ), ); foreach ( $common_slug_groups as $slug_group ) { foreach ( $slug_group as $slug ) { foreach ( $wp_registered_sidebars as $new_sidebar => $args ) { if ( false === stripos( $new_sidebar, $slug ) && false === stripos( $slug, $new_sidebar ) ) { continue; } foreach ( $existing_sidebars_widgets as $sidebar => $widgets ) { foreach ( $slug_group as $slug ) { if ( false === stripos( $sidebar, $slug ) && false === stripos( $slug, $sidebar ) ) { continue; } if ( ! empty( $existing_sidebars_widgets[ $sidebar ] ) ) { $new_sidebars_widgets[ $new_sidebar ] = array_merge( $new_sidebars_widgets[ $new_sidebar ], $existing_sidebars_widgets[ $sidebar ] ); unset( $existing_sidebars_widgets[ $sidebar ] ); continue 3; } } } } } } } foreach ( $existing_sidebars_widgets as $widgets ) { if ( is_array( $widgets ) && ! empty( $widgets ) ) { $new_sidebars_widgets['wp_inactive_widgets'] = array_merge( $new_sidebars_widgets['wp_inactive_widgets'], $widgets ); } } $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); $old_sidebars_widgets = isset( $old_sidebars_widgets['data'] ) ? $old_sidebars_widgets['data'] : false; if ( is_array( $old_sidebars_widgets ) ) { $old_sidebars_widgets = array_filter( $old_sidebars_widgets ); foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) { unset( $old_sidebars_widgets[ $new_sidebar ] ); } } foreach ( $old_sidebars_widgets as $sidebar => $widgets ) { if ( 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) { unset( $old_sidebars_widgets[ $sidebar ] ); } } $old_sidebars_widgets = _wp_remove_unregistered_widgets( $old_sidebars_widgets ); if ( ! empty( $old_sidebars_widgets ) ) { foreach ( $old_sidebars_widgets as $old_sidebar => $old_widgets ) { foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { foreach ( $old_widgets as $key => $widget_id ) { $active_key = array_search( $widget_id, $new_widgets, true ); if ( false !== $active_key ) { if ( 'wp_inactive_widgets' === $new_sidebar ) { unset( $new_sidebars_widgets['wp_inactive_widgets'][ $active_key ] ); } else { unset( $old_sidebars_widgets[ $old_sidebar ][ $key ] ); } } } } } } $new_sidebars_widgets = array_merge( $new_sidebars_widgets, $old_sidebars_widgets ); } return $new_sidebars_widgets; } function _wp_remove_unregistered_widgets( $sidebars_widgets, $allowed_widget_ids = array() ) { if ( empty( $allowed_widget_ids ) ) { $allowed_widget_ids = array_keys( $GLOBALS['wp_registered_widgets'] ); } foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( is_array( $widgets ) ) { $sidebars_widgets[ $sidebar ] = array_intersect( $widgets, $allowed_widget_ids ); } } return $sidebars_widgets; } function wp_widget_rss_output( $rss, $args = array() ) { if ( is_string( $rss ) ) { $rss = fetch_feed( $rss ); } elseif ( is_array( $rss ) && isset( $rss['url'] ) ) { $args = $rss; $rss = fetch_feed( $rss['url'] ); } elseif ( ! is_object( $rss ) ) { return; } if ( is_wp_error( $rss ) ) { if ( is_admin() || current_user_can( 'manage_options' ) ) { echo '

            ' . __( 'RSS Error:' ) . ' ' . $rss->get_error_message() . '

            '; } return; } $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0, ); $args = wp_parse_args( $args, $default_args ); $items = (int) $args['items']; if ( $items < 1 || 20 < $items ) { $items = 10; } $show_summary = (int) $args['show_summary']; $show_author = (int) $args['show_author']; $show_date = (int) $args['show_date']; if ( ! $rss->get_item_quantity() ) { echo '
            • ' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '
            '; $rss->__destruct(); unset( $rss ); return; } echo '
              '; foreach ( $rss->get_items( 0, $items ) as $item ) { $link = $item->get_link(); while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) { $link = substr( $link, 1 ); } $link = esc_url( strip_tags( $link ) ); $title = esc_html( trim( strip_tags( $item->get_title() ) ) ); if ( empty( $title ) ) { $title = __( 'Untitled' ); } $desc = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ); $desc = esc_attr( wp_trim_words( $desc, 55, ' […]' ) ); $summary = ''; if ( $show_summary ) { $summary = $desc; if ( '[...]' === substr( $summary, -5 ) ) { $summary = substr( $summary, 0, -5 ) . '[…]'; } $summary = '
              ' . esc_html( $summary ) . '
              '; } $date = ''; if ( $show_date ) { $date = $item->get_date( 'U' ); if ( $date ) { $date = ' ' . date_i18n( get_option( 'date_format' ), $date ) . ''; } } $author = ''; if ( $show_author ) { $author = $item->get_author(); if ( is_object( $author ) ) { $author = $author->get_name(); $author = ' ' . esc_html( strip_tags( $author ) ) . ''; } } if ( '' === $link ) { echo "
            • $title{$date}{$summary}{$author}
            • "; } elseif ( $show_summary ) { echo "
            • $title{$date}{$summary}{$author}
            • "; } else { echo "
            • $title{$date}{$author}
            • "; } } echo '
            '; $rss->__destruct(); unset( $rss ); } function wp_widget_rss_form( $args, $inputs = null ) { $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true, ); $inputs = wp_parse_args( $inputs, $default_inputs ); $args['title'] = isset( $args['title'] ) ? $args['title'] : ''; $args['url'] = isset( $args['url'] ) ? $args['url'] : ''; $args['items'] = isset( $args['items'] ) ? (int) $args['items'] : 0; if ( $args['items'] < 1 || 20 < $args['items'] ) { $args['items'] = 10; } $args['show_summary'] = isset( $args['show_summary'] ) ? (int) $args['show_summary'] : (int) $inputs['show_summary']; $args['show_author'] = isset( $args['show_author'] ) ? (int) $args['show_author'] : (int) $inputs['show_author']; $args['show_date'] = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date']; if ( ! empty( $args['error'] ) ) { echo '

            ' . __( 'RSS Error:' ) . ' ' . $args['error'] . '

            '; } $esc_number = esc_attr( $args['number'] ); if ( $inputs['url'] ) : ?> -

            -

            - -

            -

            - -

            -

            - -

            - - /> -
            - - /> -
            - - /> -
            - -

            - - - get_error_message(); } else { $link = esc_url( strip_tags( $rss->get_permalink() ) ); while ( stristr( $link, 'http' ) !== $link ) { $link = substr( $link, 1 ); } $rss->__destruct(); unset( $rss ); } } return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' ); } function wp_widgets_init() { if ( ! is_blog_installed() ) { return; } register_widget( 'WP_Widget_Pages' ); register_widget( 'WP_Widget_Calendar' ); register_widget( 'WP_Widget_Archives' ); if ( get_option( 'link_manager_enabled' ) ) { register_widget( 'WP_Widget_Links' ); } register_widget( 'WP_Widget_Media_Audio' ); register_widget( 'WP_Widget_Media_Image' ); register_widget( 'WP_Widget_Media_Gallery' ); register_widget( 'WP_Widget_Media_Video' ); register_widget( 'WP_Widget_Meta' ); register_widget( 'WP_Widget_Search' ); register_widget( 'WP_Widget_Text' ); register_widget( 'WP_Widget_Categories' ); register_widget( 'WP_Widget_Recent_Posts' ); register_widget( 'WP_Widget_Recent_Comments' ); register_widget( 'WP_Widget_RSS' ); register_widget( 'WP_Widget_Tag_Cloud' ); register_widget( 'WP_Nav_Menu_Widget' ); register_widget( 'WP_Widget_Custom_HTML' ); register_widget( 'WP_Widget_Block' ); do_action( 'widgets_init' ); } function wp_setup_widgets_block_editor() { add_theme_support( 'widgets-block-editor' ); } function wp_use_widgets_block_editor() { return apply_filters( 'use_widgets_block_editor', get_theme_support( 'widgets-block-editor' ) ); } function wp_parse_widget_id( $id ) { $parsed = array(); if ( preg_match( '/^(.+)-(\d+)$/', $id, $matches ) ) { $parsed['id_base'] = $matches[1]; $parsed['number'] = (int) $matches[2]; } else { $parsed['id_base'] = $id; } return $parsed; } function wp_find_widgets_sidebar( $widget_id ) { foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { foreach ( $widget_ids as $maybe_widget_id ) { if ( $maybe_widget_id === $widget_id ) { return (string) $sidebar_id; } } } return null; } function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) { $sidebars = wp_get_sidebars_widgets(); foreach ( $sidebars as $maybe_sidebar_id => $widgets ) { foreach ( $widgets as $i => $maybe_widget_id ) { if ( $widget_id === $maybe_widget_id && $sidebar_id !== $maybe_sidebar_id ) { unset( $sidebars[ $maybe_sidebar_id ][ $i ] ); continue 2; } } } if ( $sidebar_id ) { $sidebars[ $sidebar_id ][] = $widget_id; } wp_set_sidebars_widgets( $sidebars ); } function wp_render_widget( $widget_id, $sidebar_id ) { global $wp_registered_widgets, $wp_registered_sidebars; if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { return ''; } if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { $sidebar = $wp_registered_sidebars[ $sidebar_id ]; } elseif ( 'wp_inactive_widgets' === $sidebar_id ) { $sidebar = array(); } else { return ''; } $params = array_merge( array( array_merge( $sidebar, array( 'widget_id' => $widget_id, 'widget_name' => $wp_registered_widgets[ $widget_id ]['name'], ) ), ), (array) $wp_registered_widgets[ $widget_id ]['params'] ); $classname_ = ''; foreach ( (array) $wp_registered_widgets[ $widget_id ]['classname'] as $cn ) { if ( is_string( $cn ) ) { $classname_ .= '_' . $cn; } elseif ( is_object( $cn ) ) { $classname_ .= '_' . get_class( $cn ); } } $classname_ = ltrim( $classname_, '_' ); $params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $widget_id, $classname_ ); $params = apply_filters( 'dynamic_sidebar_params', $params ); $callback = $wp_registered_widgets[ $widget_id ]['callback']; ob_start(); do_action( 'dynamic_sidebar', $wp_registered_widgets[ $widget_id ] ); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); } function wp_render_widget_control( $id ) { global $wp_registered_widget_controls; if ( ! isset( $wp_registered_widget_controls[ $id ]['callback'] ) ) { return null; } $callback = $wp_registered_widget_controls[ $id ]['callback']; $params = $wp_registered_widget_controls[ $id ]['params']; ob_start(); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); } function wp_check_widget_editor_deps() { global $wp_scripts, $wp_styles; if ( $wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) || $wp_scripts->query( 'wp-customize-widgets', 'enqueued' ) ) { if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) { _doing_it_wrong( 'wp_enqueue_script()', sprintf( __( '"%1$s" script should not be enqueued together with the new widgets editor (%2$s or %3$s).' ), 'wp-editor', 'wp-edit-widgets', 'wp-customize-widgets' ), '5.8.0' ); } if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) { _doing_it_wrong( 'wp_enqueue_style()', sprintf( __( '"%1$s" style should not be enqueued together with the new widgets editor (%2$s or %3$s).' ), 'wp-edit-post', 'wp-edit-widgets', 'wp-customize-widgets' ), '5.8.0' ); } } } comment_ID ) ? $comment->comment_ID : $comment_ID; if ( empty( $comment->comment_author ) ) { $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; if ( $user ) { $author = $user->display_name; } else { $author = __( 'Anonymous' ); } } else { $author = $comment->comment_author; } return apply_filters( 'get_comment_author', $author, $comment_ID, $comment ); } function comment_author( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author = get_comment_author( $comment ); echo apply_filters( 'comment_author', $author, $comment->comment_ID ); } function get_comment_author_email( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment ); } function comment_author_email( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author_email = get_comment_author_email( $comment ); echo apply_filters( 'author_email', $author_email, $comment->comment_ID ); } function comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) { $link = get_comment_author_email_link( $linktext, $before, $after, $comment ); if ( $link ) { echo $link; } } function get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) { $comment = get_comment( $comment ); $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ( ! empty( $email ) ) && ( '@' !== $email ) ) { $display = ( '' !== $linktext ) ? $linktext : $email; $return = $before; $return .= sprintf( '%2$s', esc_url( 'mailto:' . $email ), esc_html( $display ) ); $return .= $after; return $return; } else { return ''; } } function get_comment_author_link( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $url = get_comment_author_url( $comment ); $author = get_comment_author( $comment ); if ( empty( $url ) || 'http://' === $url ) { $return = $author; } else { $return = "$author"; } return apply_filters( 'get_comment_author_link', $return, $author, $comment->comment_ID ); } function comment_author_link( $comment_ID = 0 ) { echo get_comment_author_link( $comment_ID ); } function get_comment_author_IP( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); } function comment_author_IP( $comment_ID = 0 ) { echo esc_html( get_comment_author_IP( $comment_ID ) ); } function get_comment_author_url( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $url = ''; $id = 0; if ( ! empty( $comment ) ) { $author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url; $url = esc_url( $author_url, array( 'http', 'https' ) ); $id = $comment->comment_ID; } return apply_filters( 'get_comment_author_url', $url, $id, $comment ); } function comment_author_url( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $author_url = get_comment_author_url( $comment ); echo apply_filters( 'comment_url', $author_url, $comment->comment_ID ); } function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { $url = get_comment_author_url( $comment ); $display = ( '' !== $linktext ) ? $linktext : $url; $display = str_replace( 'http://www.', '', $display ); $display = str_replace( 'http://', '', $display ); if ( '/' === substr( $display, -1 ) ) { $display = substr( $display, 0, -1 ); } $return = "$before$display$after"; return apply_filters( 'get_comment_author_url_link', $return ); } function comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) { echo get_comment_author_url_link( $linktext, $before, $after, $comment ); } function comment_class( $css_class = '', $comment = null, $post_id = null, $display = true ) { $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post_id ) ) . '"'; if ( $display ) { echo $css_class; } else { return $css_class; } } function get_comment_class( $css_class = '', $comment_id = null, $post_id = null ) { global $comment_alt, $comment_depth, $comment_thread_alt; $classes = array(); $comment = get_comment( $comment_id ); if ( ! $comment ) { return $classes; } $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type; $user = $comment->user_id ? get_userdata( $comment->user_id ) : false; if ( $user ) { $classes[] = 'byuser'; $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id ); $post = get_post( $post_id ); if ( $post ) { if ( $comment->user_id === $post->post_author ) { $classes[] = 'bypostauthor'; } } } if ( empty( $comment_alt ) ) { $comment_alt = 0; } if ( empty( $comment_depth ) ) { $comment_depth = 1; } if ( empty( $comment_thread_alt ) ) { $comment_thread_alt = 0; } if ( $comment_alt % 2 ) { $classes[] = 'odd'; $classes[] = 'alt'; } else { $classes[] = 'even'; } $comment_alt++; if ( 1 == $comment_depth ) { if ( $comment_thread_alt % 2 ) { $classes[] = 'thread-odd'; $classes[] = 'thread-alt'; } else { $classes[] = 'thread-even'; } $comment_thread_alt++; } $classes[] = "depth-$comment_depth"; if ( ! empty( $css_class ) ) { if ( ! is_array( $css_class ) ) { $css_class = preg_split( '#\s+#', $css_class ); } $classes = array_merge( $classes, $css_class ); } $classes = array_map( 'esc_attr', $classes ); return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post_id ); } function get_comment_date( $format = '', $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); $date = mysql2date( $_format, $comment->comment_date ); return apply_filters( 'get_comment_date', $date, $format, $comment ); } function comment_date( $format = '', $comment_ID = 0 ) { echo get_comment_date( $format, $comment_ID ); } function get_comment_excerpt( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); if ( ! post_password_required( $comment->comment_post_ID ) ) { $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) ); } else { $comment_text = __( 'Password protected' ); } $comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' ); $comment_excerpt_length = apply_filters( 'comment_excerpt_length', $comment_excerpt_length ); $excerpt = wp_trim_words( $comment_text, $comment_excerpt_length, '…' ); return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment ); } function comment_excerpt( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); $comment_excerpt = get_comment_excerpt( $comment ); echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID ); } function get_comment_ID() { $comment = get_comment(); $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; return apply_filters( 'get_comment_ID', $comment_ID, $comment ); } function comment_ID() { echo get_comment_ID(); } function get_comment_link( $comment = null, $args = array() ) { global $wp_rewrite, $in_comment_loop; $comment = get_comment( $comment ); if ( ! is_array( $args ) ) { $args = array( 'page' => $args ); } $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', 'cpage' => null, ); $args = wp_parse_args( $args, $defaults ); $link = get_permalink( $comment->comment_post_ID ); if ( ! is_null( $args['cpage'] ) ) { $cpage = $args['cpage']; } else { if ( '' === $args['per_page'] && get_option( 'page_comments' ) ) { $args['per_page'] = get_option( 'comments_per_page' ); } if ( empty( $args['per_page'] ) ) { $args['per_page'] = 0; $args['page'] = 0; } $cpage = $args['page']; if ( '' == $cpage ) { if ( ! empty( $in_comment_loop ) ) { $cpage = get_query_var( 'cpage' ); } else { $cpage = get_page_of_comment( $comment->comment_ID, $args ); } } if ( 'oldest' === get_option( 'default_comments_page' ) && 1 === $cpage ) { $cpage = ''; } } if ( $cpage && get_option( 'page_comments' ) ) { if ( $wp_rewrite->using_permalinks() ) { if ( $cpage ) { $link = trailingslashit( $link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage; } $link = user_trailingslashit( $link, 'comment' ); } elseif ( $cpage ) { $link = add_query_arg( 'cpage', $cpage, $link ); } } if ( $wp_rewrite->using_permalinks() ) { $link = user_trailingslashit( $link, 'comment' ); } $link = $link . '#comment-' . $comment->comment_ID; return apply_filters( 'get_comment_link', $link, $comment, $args, $cpage ); } function get_comments_link( $post_id = 0 ) { $hash = get_comments_number( $post_id ) ? '#comments' : '#respond'; $comments_link = get_permalink( $post_id ) . $hash; return apply_filters( 'get_comments_link', $comments_link, $post_id ); } function comments_link( $deprecated = '', $deprecated_2 = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '0.72' ); } if ( ! empty( $deprecated_2 ) ) { _deprecated_argument( __FUNCTION__, '1.3.0' ); } echo esc_url( get_comments_link() ); } function get_comments_number( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post ) { $count = 0; } else { $count = $post->comment_count; $post_id = $post->ID; } return apply_filters( 'get_comments_number', $count, $post_id ); } function comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) { echo get_comments_number_text( $zero, $one, $more, $post_id ); } function get_comments_number_text( $zero = false, $one = false, $more = false, $post_id = 0 ) { $number = get_comments_number( $post_id ); if ( $number > 1 ) { if ( false === $more ) { $output = sprintf( _n( '%s Comment', '%s Comments', $number ), number_format_i18n( $number ) ); } else { if ( 'on' === _x( 'off', 'Comment number declension: on or off' ) ) { $text = preg_replace( '#.+?#', '', $more ); $text = preg_replace( '/&.+?;/', '', $text ); $text = trim( strip_tags( $text ), '% ' ); if ( $text && ! preg_match( '/[0-9]+/', $text ) && false !== strpos( $more, '%' ) ) { $new_text = _n( '%s Comment', '%s Comments', $number ); $new_text = trim( sprintf( $new_text, '' ) ); $more = str_replace( $text, $new_text, $more ); if ( false === strpos( $more, '%' ) ) { $more = '% ' . $more; } } } $output = str_replace( '%', number_format_i18n( $number ), $more ); } } elseif ( 0 == $number ) { $output = ( false === $zero ) ? __( 'No Comments' ) : $zero; } else { $output = ( false === $one ) ? __( '1 Comment' ) : $one; } return apply_filters( 'comments_number', $output, $number ); } function get_comment_text( $comment_ID = 0, $args = array() ) { $comment = get_comment( $comment_ID ); $comment_content = $comment->comment_content; if ( is_comment_feed() && $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); if ( $parent ) { $parent_link = esc_url( get_comment_link( $parent ) ); $name = get_comment_author( $parent ); $comment_content = sprintf( ent2ncr( __( 'In reply to %s.' ) ), '' . $name . '' ) . "\n\n" . $comment_content; } } return apply_filters( 'get_comment_text', $comment_content, $comment, $args ); } function comment_text( $comment_ID = 0, $args = array() ) { $comment = get_comment( $comment_ID ); $comment_text = get_comment_text( $comment, $args ); echo apply_filters( 'comment_text', $comment_text, $comment, $args ); } function get_comment_time( $format = '', $gmt = false, $translate = true ) { $comment = get_comment(); $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); $date = mysql2date( $_format, $comment_date, $translate ); return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment ); } function comment_time( $format = '' ) { echo get_comment_time( $format ); } function get_comment_type( $comment_ID = 0 ) { $comment = get_comment( $comment_ID ); if ( '' === $comment->comment_type ) { $comment->comment_type = 'comment'; } return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment ); } function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) { if ( false === $commenttxt ) { $commenttxt = _x( 'Comment', 'noun' ); } if ( false === $trackbacktxt ) { $trackbacktxt = __( 'Trackback' ); } if ( false === $pingbacktxt ) { $pingbacktxt = __( 'Pingback' ); } $type = get_comment_type(); switch ( $type ) { case 'trackback': echo $trackbacktxt; break; case 'pingback': echo $pingbacktxt; break; default: echo $commenttxt; } } function get_trackback_url() { if ( get_option( 'permalink_structure' ) ) { $tb_url = trailingslashit( get_permalink() ) . user_trailingslashit( 'trackback', 'single_trackback' ); } else { $tb_url = get_option( 'siteurl' ) . '/wp-trackback.php?p=' . get_the_ID(); } return apply_filters( 'trackback_url', $tb_url ); } function trackback_url( $deprecated_echo = true ) { if ( true !== $deprecated_echo ) { _deprecated_argument( __FUNCTION__, '2.5.0', sprintf( __( 'Use %s instead if you do not want the value echoed.' ), 'get_trackback_url()' ) ); } if ( $deprecated_echo ) { echo get_trackback_url(); } else { return get_trackback_url(); } } function trackback_rdf( $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.5.0' ); } if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) { return; } echo ' - \n"; echo ''; } function comments_open( $post_id = null ) { $_post = get_post( $post_id ); $post_id = $_post ? $_post->ID : 0; $open = ( $_post && ( 'open' === $_post->comment_status ) ); return apply_filters( 'comments_open', $open, $post_id ); } function pings_open( $post_id = null ) { $_post = get_post( $post_id ); $post_id = $_post ? $_post->ID : 0; $open = ( $_post && ( 'open' === $_post->ping_status ) ); return apply_filters( 'pings_open', $open, $post_id ); } function wp_comment_form_unfiltered_html_nonce() { $post = get_post(); $post_id = $post ? $post->ID : 0; if ( current_user_can( 'unfiltered_html' ) ) { wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false ); echo "\n"; } } function comments_template( $file = '/comments.php', $separate_comments = false ) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage; if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) { return; } if ( empty( $file ) ) { $file = '/comments.php'; } $req = get_option( 'require_name_email' ); $commenter = wp_get_current_commenter(); $comment_author = $commenter['comment_author']; $comment_author_email = $commenter['comment_author_email']; $comment_author_url = esc_url( $commenter['comment_author_url'] ); $comment_args = array( 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', 'post_id' => $post->ID, 'no_found_rows' => false, 'update_comment_meta_cache' => false, ); if ( get_option( 'thread_comments' ) ) { $comment_args['hierarchical'] = 'threaded'; } else { $comment_args['hierarchical'] = false; } if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $per_page = 0; if ( get_option( 'page_comments' ) ) { $per_page = (int) get_query_var( 'comments_per_page' ); if ( 0 === $per_page ) { $per_page = (int) get_option( 'comments_per_page' ); } $comment_args['number'] = $per_page; $page = (int) get_query_var( 'cpage' ); if ( $page ) { $comment_args['offset'] = ( $page - 1 ) * $per_page; } elseif ( 'oldest' === get_option( 'default_comments_page' ) ) { $comment_args['offset'] = 0; } else { $top_level_query = new WP_Comment_Query(); $top_level_args = array( 'count' => true, 'orderby' => false, 'post_id' => $post->ID, 'status' => 'approve', ); if ( $comment_args['hierarchical'] ) { $top_level_args['parent'] = 0; } if ( isset( $comment_args['include_unapproved'] ) ) { $top_level_args['include_unapproved'] = $comment_args['include_unapproved']; } $top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args ); $top_level_count = $top_level_query->query( $top_level_args ); $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page; } } $comment_args = apply_filters( 'comments_template_query_args', $comment_args ); $comment_query = new WP_Comment_Query( $comment_args ); $_comments = $comment_query->comments; if ( $comment_args['hierarchical'] ) { $comments_flat = array(); foreach ( $_comments as $_comment ) { $comments_flat[] = $_comment; $comment_children = $_comment->get_children( array( 'format' => 'flat', 'status' => $comment_args['status'], 'orderby' => $comment_args['orderby'], ) ); foreach ( $comment_children as $comment_child ) { $comments_flat[] = $comment_child; } } } else { $comments_flat = $_comments; } $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID ); $comments = &$wp_query->comments; $wp_query->comment_count = count( $wp_query->comments ); $wp_query->max_num_comment_pages = $comment_query->max_num_pages; if ( $separate_comments ) { $wp_query->comments_by_type = separate_comments( $comments ); $comments_by_type = &$wp_query->comments_by_type; } else { $wp_query->comments_by_type = array(); } $overridden_cpage = false; if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) { set_query_var( 'cpage', 'newest' === get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 ); $overridden_cpage = true; } if ( ! defined( 'COMMENTS_TEMPLATE' ) ) { define( 'COMMENTS_TEMPLATE', true ); } $theme_template = STYLESHEETPATH . $file; $include = apply_filters( 'comments_template', $theme_template ); if ( file_exists( $include ) ) { require $include; } elseif ( file_exists( TEMPLATEPATH . $file ) ) { require TEMPLATEPATH . $file; } else { require ABSPATH . WPINC . '/theme-compat/comments.php'; } } function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { $post_id = get_the_ID(); $post_title = get_the_title(); $number = get_comments_number( $post_id ); if ( false === $zero ) { $zero = sprintf( __( 'No Comments on %s' ), $post_title ); } if ( false === $one ) { $one = sprintf( __( '1 Comment on %s' ), $post_title ); } if ( false === $more ) { $more = _n( '%1$s Comment on %2$s', '%1$s Comments on %2$s', $number ); $more = sprintf( $more, number_format_i18n( $number ), $post_title ); } if ( false === $none ) { $none = sprintf( __( 'Comments Off on %s' ), $post_title ); } if ( 0 == $number && ! comments_open() && ! pings_open() ) { echo '' . $none . ''; return; } if ( post_password_required() ) { _e( 'Enter your password to view comments.' ); return; } echo ''; comments_number( $zero, $one, $more ); echo ''; } function get_comment_reply_link( $args = array(), $comment = null, $post = null ) { $defaults = array( 'add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __( 'Reply' ), 'reply_to_text' => __( 'Reply to %s' ), 'login_text' => __( 'Log in to Reply' ), 'max_depth' => 0, 'depth' => 0, 'before' => '', 'after' => '', ); $args = wp_parse_args( $args, $defaults ); if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) { return; } $comment = get_comment( $comment ); if ( empty( $comment ) ) { return; } if ( empty( $post ) ) { $post = $comment->comment_post_ID; } $post = get_post( $post ); if ( ! comments_open( $post->ID ) ) { return false; } if ( get_option( 'page_comments' ) ) { $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) ); } else { $permalink = get_permalink( $post->ID ); } $args = apply_filters( 'comment_reply_link_args', $args, $comment, $post ); if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = sprintf( '', esc_url( wp_login_url( get_permalink() ) ), $args['login_text'] ); } else { $data_attributes = array( 'commentid' => $comment->comment_ID, 'postid' => $post->ID, 'belowelement' => $args['add_below'] . '-' . $comment->comment_ID, 'respondelement' => $args['respond_id'], 'replyto' => sprintf( $args['reply_to_text'], get_comment_author( $comment ) ), ); $data_attribute_string = ''; foreach ( $data_attributes as $name => $value ) { $data_attribute_string .= " data-${name}=\"" . esc_attr( $value ) . '"'; } $data_attribute_string = trim( $data_attribute_string ); $link = sprintf( "%s", esc_url( add_query_arg( array( 'replytocom' => $comment->comment_ID, 'unapproved' => false, 'moderation-hash' => false, ), $permalink ) ) . '#' . $args['respond_id'], $data_attribute_string, esc_attr( sprintf( $args['reply_to_text'], get_comment_author( $comment ) ) ), $args['reply_text'] ); } return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post ); } function comment_reply_link( $args = array(), $comment = null, $post = null ) { echo get_comment_reply_link( $args, $comment, $post ); } function get_post_reply_link( $args = array(), $post = null ) { $defaults = array( 'add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __( 'Leave a Comment' ), 'login_text' => __( 'Log in to leave a Comment' ), 'before' => '', 'after' => '', ); $args = wp_parse_args( $args, $defaults ); $post = get_post( $post ); if ( ! comments_open( $post->ID ) ) { return false; } if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = sprintf( '', wp_login_url( get_permalink() ), $args['login_text'] ); } else { $onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )', $args['add_below'], $post->ID, $args['respond_id'] ); $link = sprintf( "%s", get_permalink( $post->ID ) . '#' . $args['respond_id'], $onclick, $args['reply_text'] ); } $formatted_link = $args['before'] . $link . $args['after']; return apply_filters( 'post_comments_link', $formatted_link, $post ); } function post_reply_link( $args = array(), $post = null ) { echo get_post_reply_link( $args, $post ); } function get_cancel_comment_reply_link( $text = '' ) { if ( empty( $text ) ) { $text = __( 'Click here to cancel reply.' ); } $style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"'; $link = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond'; $formatted_link = '' . $text . ''; return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text ); } function cancel_comment_reply_link( $text = '' ) { echo get_cancel_comment_reply_link( $text ); } function get_comment_id_fields( $post_id = 0 ) { if ( empty( $post_id ) ) { $post_id = get_the_ID(); } $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0; $result = "\n"; $result .= "\n"; return apply_filters( 'comment_id_fields', $result, $post_id, $reply_to_id ); } function comment_id_fields( $post_id = 0 ) { echo get_comment_id_fields( $post_id ); } function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) { global $comment; if ( false === $no_reply_text ) { $no_reply_text = __( 'Leave a Reply' ); } if ( false === $reply_text ) { $reply_text = __( 'Leave a Reply to %s' ); } $reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0; if ( 0 == $reply_to_id ) { echo $no_reply_text; } else { $comment = get_comment( $reply_to_id ); if ( $link_to_parent ) { $author = '' . get_comment_author( $comment ) . ''; } else { $author = get_comment_author( $comment ); } printf( $reply_text, $author ); } } function wp_list_comments( $args = array(), $comments = null ) { global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop; $in_comment_loop = true; $comment_alt = 0; $comment_thread_alt = 0; $comment_depth = 1; $defaults = array( 'walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml', 'short_ping' => false, 'echo' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args ); if ( null !== $comments ) { $comments = (array) $comments; if ( empty( $comments ) ) { return; } if ( 'all' !== $parsed_args['type'] ) { $comments_by_type = separate_comments( $comments ); if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $comments; } } else { if ( $parsed_args['page'] || $parsed_args['per_page'] ) { $current_cpage = get_query_var( 'cpage' ); if ( ! $current_cpage ) { $current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages; } $current_per_page = get_query_var( 'comments_per_page' ); if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) { $comment_args = array( 'post_id' => get_the_ID(), 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve', ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $comments = get_comments( $comment_args ); if ( 'all' !== $parsed_args['type'] ) { $comments_by_type = separate_comments( $comments ); if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $comments; } } } else { if ( empty( $wp_query->comments ) ) { return; } if ( 'all' !== $parsed_args['type'] ) { if ( empty( $wp_query->comments_by_type ) ) { $wp_query->comments_by_type = separate_comments( $wp_query->comments ); } if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) { return; } $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ]; } else { $_comments = $wp_query->comments; } if ( $wp_query->max_num_comment_pages ) { $default_comments_page = get_option( 'default_comments_page' ); $cpage = get_query_var( 'cpage' ); if ( 'newest' === $default_comments_page ) { $parsed_args['cpage'] = $cpage; } elseif ( 1 == $cpage ) { $parsed_args['cpage'] = ''; } else { $parsed_args['cpage'] = $cpage; } $parsed_args['page'] = 0; $parsed_args['per_page'] = 0; } } } if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) { $parsed_args['per_page'] = get_query_var( 'comments_per_page' ); } if ( empty( $parsed_args['per_page'] ) ) { $parsed_args['per_page'] = 0; $parsed_args['page'] = 0; } if ( '' === $parsed_args['max_depth'] ) { if ( get_option( 'thread_comments' ) ) { $parsed_args['max_depth'] = get_option( 'thread_comments_depth' ); } else { $parsed_args['max_depth'] = -1; } } if ( '' === $parsed_args['page'] ) { if ( empty( $overridden_cpage ) ) { $parsed_args['page'] = get_query_var( 'cpage' ); } else { $threaded = ( -1 != $parsed_args['max_depth'] ); $parsed_args['page'] = ( 'newest' === get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1; set_query_var( 'cpage', $parsed_args['page'] ); } } $parsed_args['page'] = (int) $parsed_args['page']; if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) { $parsed_args['page'] = 1; } if ( null === $parsed_args['reverse_top_level'] ) { $parsed_args['reverse_top_level'] = ( 'desc' === get_option( 'comment_order' ) ); } wp_queue_comments_for_comment_meta_lazyload( $_comments ); if ( empty( $parsed_args['walker'] ) ) { $walker = new Walker_Comment; } else { $walker = $parsed_args['walker']; } $output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args ); $in_comment_loop = false; if ( $parsed_args['echo'] ) { echo $output; } else { return $output; } } function comment_form( $args = array(), $post_id = null ) { if ( null === $post_id ) { $post_id = get_the_ID(); } if ( ! comments_open( $post_id ) ) { do_action( 'comment_form_comments_closed' ); return; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) { $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; } $req = get_option( 'require_name_email' ); $html5 = 'html5' === $args['format']; $required_attribute = ( $html5 ? ' required' : ' required="required"' ); $checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' ); $required_indicator = ' '; $fields = array( 'author' => sprintf( '

            %s %s

            ', sprintf( '', __( 'Name' ), ( $req ? $required_indicator : '' ) ), sprintf( '', esc_attr( $commenter['comment_author'] ), ( $req ? $required_attribute : '' ) ) ), 'email' => sprintf( '', sprintf( '', __( 'Email' ), ( $req ? $required_indicator : '' ) ), sprintf( '', ( $html5 ? 'type="email"' : 'type="text"' ), esc_attr( $commenter['comment_author_email'] ), ( $req ? $required_attribute : '' ) ) ), 'url' => sprintf( '

            %s %s

            ', sprintf( '', __( 'Website' ) ), sprintf( '', ( $html5 ? 'type="url"' : 'type="text"' ), esc_attr( $commenter['comment_author_url'] ) ) ), ); if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { $consent = empty( $commenter['comment_author_email'] ) ? '' : $checked_attribute; $fields['cookies'] = sprintf( '', sprintf( '', $consent ), sprintf( '', __( 'Save my name, email, and website in this browser for the next time I comment.' ) ) ); if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { $args['fields']['cookies'] = $fields['cookies']; } } $required_text = sprintf( ' ', trim( $required_indicator ) ); $fields = apply_filters( 'comment_form_default_fields', $fields ); $defaults = array( 'fields' => $fields, 'comment_field' => sprintf( '

            %s %s

            ', sprintf( '', _x( 'Comment', 'noun' ), $required_indicator ), '' ), 'must_log_in' => sprintf( '', sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) ), 'logged_in_as' => sprintf( '

            %s%s

            ', sprintf( __( 'Logged in as %3$s. Log out?' ), get_edit_user_link(), esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ), $required_text ), 'comment_notes_before' => sprintf( '

            %s%s

            ', sprintf( '%s', __( 'Your email address will not be published.' ) ), $required_text ), 'comment_notes_after' => '', 'action' => site_url( '/wp-comments-post.php' ), 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_container' => 'comment-respond', 'class_form' => 'comment-form', 'class_submit' => 'submit', 'name_submit' => 'submit', 'title_reply' => __( 'Leave a Reply' ), 'title_reply_to' => __( 'Leave a Reply to %s' ), 'title_reply_before' => '

            ', 'title_reply_after' => '

            ', 'cancel_reply_before' => ' ', 'cancel_reply_after' => '', 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'submit_button' => '', 'submit_field' => '

            %1$s %2$s

            ', 'format' => 'xhtml', ); $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); $args = array_merge( $defaults, $args ); if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { $args['fields']['email'] = str_replace( ' aria-describedby="email-notes"', '', $args['fields']['email'] ); } do_action( 'comment_form_before' ); ?> -
            - ', esc_url( $args['action'] ), esc_attr( $args['id_form'] ), esc_attr( $args['class_form'] ), ( $html5 ? ' novalidate' : '' ) ); do_action( 'comment_form_top' ); if ( is_user_logged_in() ) : echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); else : echo $args['comment_notes_before']; endif; $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); $first_field = reset( $comment_field_keys ); $last_field = end( $comment_field_keys ); foreach ( $comment_fields as $name => $field ) { if ( 'comment' === $name ) { echo apply_filters( 'comment_form_field_comment', $field ); echo $args['comment_notes_after']; } elseif ( ! is_user_logged_in() ) { if ( $first_field === $name ) { do_action( 'comment_form_before_fields' ); } echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; if ( $last_field === $name ) { do_action( 'comment_form_after_fields' ); } } } $submit_button = sprintf( $args['submit_button'], esc_attr( $args['name_submit'] ), esc_attr( $args['id_submit'] ), esc_attr( $args['class_submit'] ), esc_attr( $args['label_submit'] ) ); $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); $submit_field = sprintf( $args['submit_field'], $submit_button, get_comment_id_fields( $post_id ) ); echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); do_action( 'comment_form', $post_id ); echo ''; endif; ?> -
            - __( 'Title' ), 'post_content' => __( 'Content' ), 'post_excerpt' => __( 'Excerpt' ), ); } $fields = apply_filters( '_wp_post_revision_fields', $fields, $post ); foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) { unset( $fields[ $protect ] ); } return $fields; } function _wp_post_revision_data( $post = array(), $autosave = false ) { if ( ! is_array( $post ) ) { $post = get_post( $post, ARRAY_A ); } $fields = _wp_post_revision_fields( $post ); $revision_data = array(); foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) { $revision_data[ $field ] = $post[ $field ]; } $revision_data['post_parent'] = $post['ID']; $revision_data['post_status'] = 'inherit'; $revision_data['post_type'] = 'revision'; $revision_data['post_name'] = $autosave ? "$post[ID]-autosave-v1" : "$post[ID]-revision-v1"; $revision_data['post_date'] = isset( $post['post_modified'] ) ? $post['post_modified'] : ''; $revision_data['post_date_gmt'] = isset( $post['post_modified_gmt'] ) ? $post['post_modified_gmt'] : ''; return $revision_data; } function wp_save_post_revision( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } $post = get_post( $post_id ); if ( ! $post ) { return; } if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { return; } if ( 'auto-draft' === $post->post_status ) { return; } if ( ! wp_revisions_enabled( $post ) ) { return; } $revisions = wp_get_post_revisions( $post_id ); if ( $revisions ) { foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) { $last_revision = $revision; break; } } if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) { $post_has_changed = false; foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) { $post_has_changed = true; break; } } $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post ); if ( ! $post_has_changed ) { return; } } } $return = _wp_put_post_revision( $post ); $revisions_to_keep = wp_revisions_to_keep( $post ); if ( $revisions_to_keep < 0 ) { return $return; } $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); $delete = count( $revisions ) - $revisions_to_keep; if ( $delete < 1 ) { return $return; } $revisions = array_slice( $revisions, 0, $delete ); for ( $i = 0; isset( $revisions[ $i ] ); $i++ ) { if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) { continue; } wp_delete_post_revision( $revisions[ $i ]->ID ); } return $return; } function wp_get_post_autosave( $post_id, $user_id = 0 ) { global $wpdb; $autosave_name = $post_id . '-autosave-v1'; $user_id_query = ( 0 !== $user_id ) ? "AND post_author = $user_id" : null; $autosave_query = " - SELECT * - FROM $wpdb->posts - WHERE post_parent = %d - AND post_type = 'revision' - AND post_status = 'inherit' - AND post_name = %s " . $user_id_query . ' - ORDER BY post_date DESC - LIMIT 1'; $autosave = $wpdb->get_results( $wpdb->prepare( $autosave_query, $post_id, $autosave_name ) ); if ( ! $autosave ) { return false; } return get_post( $autosave[0] ); } function wp_is_post_revision( $post ) { $post = wp_get_post_revision( $post ); if ( ! $post ) { return false; } return (int) $post->post_parent; } function wp_is_post_autosave( $post ) { $post = wp_get_post_revision( $post ); if ( ! $post ) { return false; } if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) { return (int) $post->post_parent; } return false; } function _wp_put_post_revision( $post = null, $autosave = false ) { if ( is_object( $post ) ) { $post = get_object_vars( $post ); } elseif ( ! is_array( $post ) ) { $post = get_post( $post, ARRAY_A ); } if ( ! $post || empty( $post['ID'] ) ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } if ( isset( $post['post_type'] ) && 'revision' === $post['post_type'] ) { return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); } $post = _wp_post_revision_data( $post, $autosave ); $post = wp_slash( $post ); $revision_id = wp_insert_post( $post, true ); if ( is_wp_error( $revision_id ) ) { return $revision_id; } if ( $revision_id ) { do_action( '_wp_put_post_revision', $revision_id ); } return $revision_id; } function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) { $revision = get_post( $post, OBJECT, $filter ); if ( ! $revision ) { return $revision; } if ( 'revision' !== $revision->post_type ) { return null; } if ( OBJECT === $output ) { return $revision; } elseif ( ARRAY_A === $output ) { $_revision = get_object_vars( $revision ); return $_revision; } elseif ( ARRAY_N === $output ) { $_revision = array_values( get_object_vars( $revision ) ); return $_revision; } return $revision; } function wp_restore_post_revision( $revision_id, $fields = null ) { $revision = wp_get_post_revision( $revision_id, ARRAY_A ); if ( ! $revision ) { return $revision; } if ( ! is_array( $fields ) ) { $fields = array_keys( _wp_post_revision_fields( $revision ) ); } $update = array(); foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) { $update[ $field ] = $revision[ $field ]; } if ( ! $update ) { return false; } $update['ID'] = $revision['post_parent']; $update = wp_slash( $update ); $post_id = wp_update_post( $update ); if ( ! $post_id || is_wp_error( $post_id ) ) { return $post_id; } update_post_meta( $post_id, '_edit_last', get_current_user_id() ); do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); return $post_id; } function wp_delete_post_revision( $revision_id ) { $revision = wp_get_post_revision( $revision_id ); if ( ! $revision ) { return $revision; } $delete = wp_delete_post( $revision->ID ); if ( $delete ) { do_action( 'wp_delete_post_revision', $revision->ID, $revision ); } return $delete; } function wp_get_post_revisions( $post_id = 0, $args = null ) { $post = get_post( $post_id ); if ( ! $post || empty( $post->ID ) ) { return array(); } $defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true, ); $args = wp_parse_args( $args, $defaults ); if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) { return array(); } $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit', ) ); $revisions = get_children( $args ); if ( ! $revisions ) { return array(); } return $revisions; } function wp_get_post_revisions_url( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post instanceof WP_Post ) { return null; } if ( 'revision' === $post->post_type ) { return get_edit_post_link( $post ); } if ( ! wp_revisions_enabled( $post ) ) { return null; } $revisions = wp_get_post_revisions( $post->ID, array( 'posts_per_page' => 1 ) ); if ( 0 === count( $revisions ) ) { return null; } $revision = reset( $revisions ); return get_edit_post_link( $revision ); } function wp_revisions_enabled( $post ) { return wp_revisions_to_keep( $post ) !== 0; } function wp_revisions_to_keep( $post ) { $num = WP_POST_REVISIONS; if ( true === $num ) { $num = -1; } else { $num = (int) $num; } if ( ! post_type_supports( $post->post_type, 'revisions' ) ) { $num = 0; } $num = apply_filters( 'wp_revisions_to_keep', $num, $post ); $num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post ); return (int) $num; } function _set_preview( $post ) { if ( ! is_object( $post ) ) { return $post; } $preview = wp_get_post_autosave( $post->ID ); if ( is_object( $preview ) ) { $preview = sanitize_post( $preview ); $post->post_content = $preview->post_content; $post->post_title = $preview->post_title; $post->post_excerpt = $preview->post_excerpt; } add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 ); add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 ); return $post; } function _show_post_preview() { if ( isset( $_GET['preview_id'] ) && isset( $_GET['preview_nonce'] ) ) { $id = (int) $_GET['preview_id']; if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) { wp_die( __( 'Sorry, you are not allowed to preview drafts.' ), 403 ); } add_filter( 'the_preview', '_set_preview' ); } } function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { $post = get_post(); if ( ! $post ) { return $terms; } if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' !== $taxonomy || 'revision' === $post->post_type ) { return $terms; } if ( 'standard' === $_REQUEST['post_format'] ) { $terms = array(); } else { $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ); if ( $term ) { $terms = array( $term ); } } return $terms; } function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { $post = get_post(); if ( ! $post ) { return $value; } if ( empty( $_REQUEST['_thumbnail_id'] ) || empty( $_REQUEST['preview_id'] ) || $post->ID != $post_id || '_thumbnail_id' !== $meta_key || 'revision' === $post->post_type || $post_id != $_REQUEST['preview_id'] ) { return $value; } $thumbnail_id = (int) $_REQUEST['_thumbnail_id']; if ( $thumbnail_id <= 0 ) { return ''; } return (string) $thumbnail_id; } function _wp_get_post_revision_version( $revision ) { if ( is_object( $revision ) ) { $revision = get_object_vars( $revision ); } elseif ( ! is_array( $revision ) ) { return false; } if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) { return (int) $matches[1]; } return 0; } function _wp_upgrade_revisions_of_post( $post, $revisions ) { global $wpdb; $lock = "revision-upgrade-{$post->ID}"; $now = time(); $result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) ); if ( ! $result ) { $locked = get_option( $lock ); if ( ! $locked ) { return false; } if ( $locked > $now - 3600 ) { return false; } } update_option( $lock, $now ); reset( $revisions ); $add_last = true; do { $this_revision = current( $revisions ); $prev_revision = next( $revisions ); $this_revision_version = _wp_get_post_revision_version( $this_revision ); if ( false === $this_revision_version ) { continue; } if ( 0 < $this_revision_version ) { $add_last = false; continue; } $update = array( 'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ), ); if ( $prev_revision ) { $prev_revision_version = _wp_get_post_revision_version( $prev_revision ); if ( $prev_revision_version < 1 ) { $update['post_author'] = $prev_revision->post_author; } } $result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) ); if ( $result ) { wp_cache_delete( $this_revision->ID, 'posts' ); } } while ( $prev_revision ); delete_option( $lock ); if ( $add_last ) { wp_save_post_revision( $post->ID ); } return true; } false, 'post_tag' => false, 'post_format' => false, ); } else { $post_format_base = apply_filters( 'post_format_rewrite_base', 'type' ); $rewrite = array( 'category' => array( 'hierarchical' => true, 'slug' => get_option( 'category_base' ) ? get_option( 'category_base' ) : 'category', 'with_front' => ! get_option( 'category_base' ) || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_CATEGORIES, ), 'post_tag' => array( 'hierarchical' => false, 'slug' => get_option( 'tag_base' ) ? get_option( 'tag_base' ) : 'tag', 'with_front' => ! get_option( 'tag_base' ) || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_TAGS, ), 'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false, ); } register_taxonomy( 'category', 'post', array( 'hierarchical' => true, 'query_var' => 'category_name', 'rewrite' => $rewrite['category'], 'public' => true, 'show_ui' => true, 'show_admin_column' => true, '_builtin' => true, 'capabilities' => array( 'manage_terms' => 'manage_categories', 'edit_terms' => 'edit_categories', 'delete_terms' => 'delete_categories', 'assign_terms' => 'assign_categories', ), 'show_in_rest' => true, 'rest_base' => 'categories', 'rest_controller_class' => 'WP_REST_Terms_Controller', ) ); register_taxonomy( 'post_tag', 'post', array( 'hierarchical' => false, 'query_var' => 'tag', 'rewrite' => $rewrite['post_tag'], 'public' => true, 'show_ui' => true, 'show_admin_column' => true, '_builtin' => true, 'capabilities' => array( 'manage_terms' => 'manage_post_tags', 'edit_terms' => 'edit_post_tags', 'delete_terms' => 'delete_post_tags', 'assign_terms' => 'assign_post_tags', ), 'show_in_rest' => true, 'rest_base' => 'tags', 'rest_controller_class' => 'WP_REST_Terms_Controller', ) ); register_taxonomy( 'nav_menu', 'nav_menu_item', array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Navigation Menus' ), 'singular_name' => __( 'Navigation Menu' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'capabilities' => array( 'manage_terms' => 'edit_theme_options', 'edit_terms' => 'edit_theme_options', 'delete_terms' => 'edit_theme_options', 'assign_terms' => 'edit_theme_options', ), 'show_in_rest' => true, 'rest_base' => 'menus', 'rest_controller_class' => 'WP_REST_Menus_Controller', ) ); register_taxonomy( 'link_category', 'link', array( 'hierarchical' => false, 'labels' => array( 'name' => __( 'Link Categories' ), 'singular_name' => __( 'Link Category' ), 'search_items' => __( 'Search Link Categories' ), 'popular_items' => null, 'all_items' => __( 'All Link Categories' ), 'edit_item' => __( 'Edit Link Category' ), 'update_item' => __( 'Update Link Category' ), 'add_new_item' => __( 'Add New Link Category' ), 'new_item_name' => __( 'New Link Category Name' ), 'separate_items_with_commas' => null, 'add_or_remove_items' => null, 'choose_from_most_used' => null, 'back_to_items' => __( '← Go to Link Categories' ), ), 'capabilities' => array( 'manage_terms' => 'manage_links', 'edit_terms' => 'manage_links', 'delete_terms' => 'manage_links', 'assign_terms' => 'manage_links', ), 'query_var' => false, 'rewrite' => false, 'public' => false, 'show_ui' => true, '_builtin' => true, ) ); register_taxonomy( 'post_format', 'post', array( 'public' => true, 'hierarchical' => false, 'labels' => array( 'name' => _x( 'Formats', 'post format' ), 'singular_name' => _x( 'Format', 'post format' ), ), 'query_var' => true, 'rewrite' => $rewrite['post_format'], 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => current_theme_supports( 'post-formats' ), ) ); register_taxonomy( 'wp_theme', array( 'wp_template', 'wp_template_part', 'wp_global_styles' ), array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Themes' ), 'singular_name' => __( 'Theme' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'show_in_rest' => false, ) ); register_taxonomy( 'wp_template_part_area', array( 'wp_template_part' ), array( 'public' => false, 'hierarchical' => false, 'labels' => array( 'name' => __( 'Template Part Areas' ), 'singular_name' => __( 'Template Part Area' ), ), 'query_var' => false, 'rewrite' => false, 'show_ui' => false, '_builtin' => true, 'show_in_nav_menus' => false, 'show_in_rest' => false, ) ); } function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_taxonomies; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field ); } function get_object_taxonomies( $object, $output = 'names' ) { global $wp_taxonomies; if ( is_object( $object ) ) { if ( 'attachment' === $object->post_type ) { return get_attachment_taxonomies( $object, $output ); } $object = $object->post_type; } $object = (array) $object; $taxonomies = array(); foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) { if ( array_intersect( $object, (array) $tax_obj->object_type ) ) { if ( 'names' === $output ) { $taxonomies[] = $tax_name; } else { $taxonomies[ $tax_name ] = $tax_obj; } } } return $taxonomies; } function get_taxonomy( $taxonomy ) { global $wp_taxonomies; if ( ! taxonomy_exists( $taxonomy ) ) { return false; } return $wp_taxonomies[ $taxonomy ]; } function taxonomy_exists( $taxonomy ) { global $wp_taxonomies; return isset( $wp_taxonomies[ $taxonomy ] ); } function is_taxonomy_hierarchical( $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return false; } $taxonomy = get_taxonomy( $taxonomy ); return $taxonomy->hierarchical; } function register_taxonomy( $taxonomy, $object_type, $args = array() ) { global $wp_taxonomies; if ( ! is_array( $wp_taxonomies ) ) { $wp_taxonomies = array(); } $args = wp_parse_args( $args ); if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { _doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2.0' ); return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) ); } $taxonomy_object = new WP_Taxonomy( $taxonomy, $object_type, $args ); $taxonomy_object->add_rewrite_rules(); $wp_taxonomies[ $taxonomy ] = $taxonomy_object; $taxonomy_object->add_hooks(); if ( ! empty( $taxonomy_object->default_term ) ) { $term = term_exists( $taxonomy_object->default_term['name'], $taxonomy ); if ( $term ) { update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); } else { $term = wp_insert_term( $taxonomy_object->default_term['name'], $taxonomy, array( 'slug' => sanitize_title( $taxonomy_object->default_term['slug'] ), 'description' => $taxonomy_object->default_term['description'], ) ); if ( ! is_wp_error( $term ) ) { update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] ); } } } do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object ); do_action( "registered_taxonomy_{$taxonomy}", $taxonomy, $object_type, (array) $taxonomy_object ); return $taxonomy_object; } function unregister_taxonomy( $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $taxonomy_object = get_taxonomy( $taxonomy ); if ( $taxonomy_object->_builtin ) { return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) ); } global $wp_taxonomies; $taxonomy_object->remove_rewrite_rules(); $taxonomy_object->remove_hooks(); if ( ! empty( $taxonomy_object->default_term ) ) { delete_option( 'default_term_' . $taxonomy_object->name ); } unset( $wp_taxonomies[ $taxonomy ] ); do_action( 'unregistered_taxonomy', $taxonomy ); return true; } function get_taxonomy_labels( $tax ) { $tax->labels = (array) $tax->labels; if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) ) { $tax->labels['separate_items_with_commas'] = $tax->helps; } if ( isset( $tax->no_tagcloud ) && empty( $tax->labels['not_found'] ) ) { $tax->labels['not_found'] = $tax->no_tagcloud; } $nohier_vs_hier_defaults = WP_Taxonomy::get_default_labels(); $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); $taxonomy = $tax->name; $default_labels = clone $labels; $labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels ); $labels = (object) array_merge( (array) $default_labels, (array) $labels ); return $labels; } function register_taxonomy_for_object_type( $taxonomy, $object_type ) { global $wp_taxonomies; if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) { return false; } if ( ! get_post_type_object( $object_type ) ) { return false; } if ( ! in_array( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ) ) { $wp_taxonomies[ $taxonomy ]->object_type[] = $object_type; } $wp_taxonomies[ $taxonomy ]->object_type = array_filter( $wp_taxonomies[ $taxonomy ]->object_type ); do_action( 'registered_taxonomy_for_object_type', $taxonomy, $object_type ); return true; } function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) { global $wp_taxonomies; if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) { return false; } if ( ! get_post_type_object( $object_type ) ) { return false; } $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ); if ( false === $key ) { return false; } unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] ); do_action( 'unregistered_taxonomy_for_object_type', $taxonomy, $object_type ); return true; } function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) { global $wpdb; if ( ! is_array( $term_ids ) ) { $term_ids = array( $term_ids ); } if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( (array) $taxonomies as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } $defaults = array( 'order' => 'ASC' ); $args = wp_parse_args( $args, $defaults ); $order = ( 'desc' === strtolower( $args['order'] ) ) ? 'DESC' : 'ASC'; $term_ids = array_map( 'intval', $term_ids ); $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'"; $term_ids = "'" . implode( "', '", $term_ids ) . "'"; $sql = "SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order"; $last_changed = wp_cache_get_last_changed( 'terms' ); $cache_key = 'get_objects_in_term:' . md5( $sql ) . ":$last_changed"; $cache = wp_cache_get( $cache_key, 'terms' ); if ( false === $cache ) { $object_ids = $wpdb->get_col( $sql ); wp_cache_set( $cache_key, $object_ids, 'terms' ); } else { $object_ids = (array) $cache; } if ( ! $object_ids ) { return array(); } return $object_ids; } function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) { $tax_query_obj = new WP_Tax_Query( $tax_query ); return $tax_query_obj->get_sql( $primary_table, $primary_id_column ); } function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { if ( empty( $term ) ) { return new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( $term instanceof WP_Term ) { $_term = $term; } elseif ( is_object( $term ) ) { if ( empty( $term->filter ) || 'raw' === $term->filter ) { $_term = sanitize_term( $term, $taxonomy, 'raw' ); $_term = new WP_Term( $_term ); } else { $_term = WP_Term::get_instance( $term->term_id ); } } else { $_term = WP_Term::get_instance( $term, $taxonomy ); } if ( is_wp_error( $_term ) ) { return $_term; } elseif ( ! $_term ) { return null; } $taxonomy = $_term->taxonomy; $_term = apply_filters( 'get_term', $_term, $taxonomy ); $_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy ); if ( ! ( $_term instanceof WP_Term ) ) { return $_term; } $_term->filter( $filter ); if ( ARRAY_A === $output ) { return $_term->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_term->to_array() ); } return $_term; } function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { if ( 'term_taxonomy_id' !== $field && ! taxonomy_exists( $taxonomy ) ) { return false; } if ( 'slug' === $field || 'name' === $field ) { $value = (string) $value; if ( 0 === strlen( $value ) ) { return false; } } if ( 'id' === $field || 'ID' === $field || 'term_id' === $field ) { $term = get_term( (int) $value, $taxonomy, $output, $filter ); if ( is_wp_error( $term ) || null === $term ) { $term = false; } return $term; } $args = array( 'get' => 'all', 'number' => 1, 'taxonomy' => $taxonomy, 'update_term_meta_cache' => false, 'orderby' => 'none', 'suppress_filter' => true, ); switch ( $field ) { case 'slug': $args['slug'] = $value; break; case 'name': $args['name'] = $value; break; case 'term_taxonomy_id': $args['term_taxonomy_id'] = $value; unset( $args['taxonomy'] ); break; default: return false; } $terms = get_terms( $args ); if ( is_wp_error( $terms ) || empty( $terms ) ) { return false; } $term = array_shift( $terms ); if ( 'term_taxonomy_id' === $field ) { $taxonomy = $term->taxonomy; } return get_term( $term, $taxonomy, $output, $filter ); } function get_term_children( $term_id, $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id; $terms = _get_term_hierarchy( $taxonomy ); if ( ! isset( $terms[ $term_id ] ) ) { return array(); } $children = $terms[ $term_id ]; foreach ( (array) $terms[ $term_id ] as $child ) { if ( $term_id === $child ) { continue; } if ( isset( $terms[ $child ] ) ) { $children = array_merge( $children, get_term_children( $child, $taxonomy ) ); } } return $children; } function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) { $term = get_term( $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! is_object( $term ) ) { return ''; } if ( ! isset( $term->$field ) ) { return ''; } return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context ); } function get_term_to_edit( $id, $taxonomy ) { $term = get_term( $id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! is_object( $term ) ) { return ''; } return sanitize_term( $term, $taxonomy, 'edit' ); } function get_terms( $args = array(), $deprecated = '' ) { $term_query = new WP_Term_Query(); $defaults = array( 'suppress_filter' => false, ); $_args = wp_parse_args( $args ); $key_intersect = array_intersect_key( $term_query->query_var_defaults, (array) $_args ); $do_legacy_args = $deprecated || empty( $key_intersect ); if ( $do_legacy_args ) { $taxonomies = (array) $args; $args = wp_parse_args( $deprecated, $defaults ); $args['taxonomy'] = $taxonomies; } else { $args = wp_parse_args( $args, $defaults ); if ( isset( $args['taxonomy'] ) && null !== $args['taxonomy'] ) { $args['taxonomy'] = (array) $args['taxonomy']; } } if ( ! empty( $args['taxonomy'] ) ) { foreach ( $args['taxonomy'] as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } } $suppress_filter = $args['suppress_filter']; unset( $args['suppress_filter'] ); $terms = $term_query->query( $args ); if ( ! is_array( $terms ) ) { return $terms; } if ( $suppress_filter ) { return $terms; } return apply_filters( 'get_terms', $terms, $term_query->query_vars['taxonomy'], $term_query->query_vars, $term_query ); } function add_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) { if ( wp_term_is_shared( $term_id ) ) { return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' ), $term_id ); } return add_metadata( 'term', $term_id, $meta_key, $meta_value, $unique ); } function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'term', $term_id, $meta_key, $meta_value ); } function get_term_meta( $term_id, $key = '', $single = false ) { return get_metadata( 'term', $term_id, $key, $single ); } function update_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) { if ( wp_term_is_shared( $term_id ) ) { return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' ), $term_id ); } return update_metadata( 'term', $term_id, $meta_key, $meta_value, $prev_value ); } function update_termmeta_cache( $term_ids ) { return update_meta_cache( 'term', $term_ids ); } function has_term_meta( $term_id ) { $check = wp_check_term_meta_support_prefilter( null ); if ( null !== $check ) { return $check; } global $wpdb; return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, term_id FROM $wpdb->termmeta WHERE term_id = %d ORDER BY meta_key,meta_id", $term_id ), ARRAY_A ); } function register_term_meta( $taxonomy, $meta_key, array $args ) { $args['object_subtype'] = $taxonomy; return register_meta( 'term', $meta_key, $args ); } function unregister_term_meta( $taxonomy, $meta_key ) { return unregister_meta_key( 'term', $meta_key, $taxonomy ); } function term_exists( $term, $taxonomy = '', $parent = null ) { global $_wp_suspend_cache_invalidation; if ( null === $term ) { return null; } $defaults = array( 'get' => 'all', 'fields' => 'ids', 'number' => 1, 'update_term_meta_cache' => false, 'order' => 'ASC', 'orderby' => 'term_id', 'suppress_filter' => true, ); if ( ! empty( $_wp_suspend_cache_invalidation ) ) { $defaults['cache_domain'] = microtime(); } if ( ! empty( $taxonomy ) ) { $defaults['taxonomy'] = $taxonomy; $defaults['fields'] = 'all'; } $defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent ); if ( is_int( $term ) ) { if ( 0 === $term ) { return 0; } $args = wp_parse_args( array( 'include' => array( $term ) ), $defaults ); $terms = get_terms( $args ); } else { $term = trim( wp_unslash( $term ) ); if ( '' === $term ) { return null; } if ( ! empty( $taxonomy ) && is_numeric( $parent ) ) { $defaults['parent'] = (int) $parent; } $args = wp_parse_args( array( 'slug' => sanitize_title( $term ) ), $defaults ); $terms = get_terms( $args ); if ( empty( $terms ) || is_wp_error( $terms ) ) { $args = wp_parse_args( array( 'name' => $term ), $defaults ); $terms = get_terms( $args ); } } if ( empty( $terms ) || is_wp_error( $terms ) ) { return null; } $_term = array_shift( $terms ); if ( ! empty( $taxonomy ) ) { return array( 'term_id' => (string) $_term->term_id, 'term_taxonomy_id' => (string) $_term->term_taxonomy_id, ); } return (string) $_term; } function term_is_ancestor_of( $term1, $term2, $taxonomy ) { if ( ! isset( $term1->term_id ) ) { $term1 = get_term( $term1, $taxonomy ); } if ( ! isset( $term2->parent ) ) { $term2 = get_term( $term2, $taxonomy ); } if ( empty( $term1->term_id ) || empty( $term2->parent ) ) { return false; } if ( $term2->parent === $term1->term_id ) { return true; } return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy ); } function sanitize_term( $term, $taxonomy, $context = 'display' ) { $fields = array( 'term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group', 'term_taxonomy_id', 'object_id' ); $do_object = is_object( $term ); $term_id = $do_object ? $term->term_id : ( isset( $term['term_id'] ) ? $term['term_id'] : 0 ); foreach ( (array) $fields as $field ) { if ( $do_object ) { if ( isset( $term->$field ) ) { $term->$field = sanitize_term_field( $field, $term->$field, $term_id, $taxonomy, $context ); } } else { if ( isset( $term[ $field ] ) ) { $term[ $field ] = sanitize_term_field( $field, $term[ $field ], $term_id, $taxonomy, $context ); } } } if ( $do_object ) { $term->filter = $context; } else { $term['filter'] = $context; } return $term; } function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) { $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; if ( $value < 0 ) { $value = 0; } } $context = strtolower( $context ); if ( 'raw' === $context ) { return $value; } if ( 'edit' === $context ) { $value = apply_filters( "edit_term_{$field}", $value, $term_id, $taxonomy ); $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_id ); if ( 'description' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { $value = apply_filters( "pre_term_{$field}", $value, $taxonomy ); $value = apply_filters( "pre_{$taxonomy}_{$field}", $value ); if ( 'slug' === $field ) { $value = apply_filters( 'pre_category_nicename', $value ); } } elseif ( 'rss' === $context ) { $value = apply_filters( "term_{$field}_rss", $value, $taxonomy ); $value = apply_filters( "{$taxonomy}_{$field}_rss", $value ); } else { $value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context ); $value = apply_filters( "{$taxonomy}_{$field}", $value, $term_id, $context ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function wp_count_terms( $args = array(), $deprecated = '' ) { $use_legacy_args = false; if ( $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) ) ) { $use_legacy_args = true; } $defaults = array( 'hide_empty' => false ); if ( $use_legacy_args ) { $defaults['taxonomy'] = $args; $args = $deprecated; } $args = wp_parse_args( $args, $defaults ); if ( isset( $args['ignore_empty'] ) ) { $args['hide_empty'] = $args['ignore_empty']; unset( $args['ignore_empty'] ); } $args['fields'] = 'count'; return get_terms( $args ); } function wp_delete_object_term_relationships( $object_id, $taxonomies ) { $object_id = (int) $object_id; if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( (array) $taxonomies as $taxonomy ) { $term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) ); $term_ids = array_map( 'intval', $term_ids ); wp_remove_object_terms( $object_id, $term_ids, $taxonomy ); } } function wp_delete_term( $term, $taxonomy, $args = array() ) { global $wpdb; $term = (int) $term; $ids = term_exists( $term, $taxonomy ); if ( ! $ids ) { return false; } if ( is_wp_error( $ids ) ) { return $ids; } $tt_id = $ids['term_taxonomy_id']; $defaults = array(); if ( 'category' === $taxonomy ) { $defaults['default'] = (int) get_option( 'default_category' ); if ( $defaults['default'] === $term ) { return 0; } } $taxonomy_object = get_taxonomy( $taxonomy ); if ( ! empty( $taxonomy_object->default_term ) ) { $defaults['default'] = (int) get_option( 'default_term_' . $taxonomy ); if ( $defaults['default'] === $term ) { return 0; } } $args = wp_parse_args( $args, $defaults ); if ( isset( $args['default'] ) ) { $default = (int) $args['default']; if ( ! term_exists( $default, $taxonomy ) ) { unset( $default ); } } if ( isset( $args['force_default'] ) ) { $force_default = $args['force_default']; } do_action( 'pre_delete_term', $term, $taxonomy ); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $term_obj = get_term( $term, $taxonomy ); if ( is_wp_error( $term_obj ) ) { return $term_obj; } $parent = $term_obj->parent; $edit_ids = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM $wpdb->term_taxonomy WHERE `parent` = " . (int) $term_obj->term_id ); $edit_tt_ids = wp_list_pluck( $edit_ids, 'term_taxonomy_id' ); do_action( 'edit_term_taxonomies', $edit_tt_ids ); $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id ) + compact( 'taxonomy' ) ); $edit_term_ids = wp_list_pluck( $edit_ids, 'term_id' ); clean_term_cache( $edit_term_ids, $taxonomy ); do_action( 'edited_term_taxonomies', $edit_tt_ids ); } $deleted_term = get_term( $term, $taxonomy ); $object_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) ); foreach ( $object_ids as $object_id ) { if ( ! isset( $default ) ) { wp_remove_object_terms( $object_id, $term, $taxonomy ); continue; } $terms = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids', 'orderby' => 'none', ) ); if ( 1 === count( $terms ) && isset( $default ) ) { $terms = array( $default ); } else { $terms = array_diff( $terms, array( $term ) ); if ( isset( $default ) && isset( $force_default ) && $force_default ) { $terms = array_merge( $terms, array( $default ) ); } } $terms = array_map( 'intval', $terms ); wp_set_object_terms( $object_id, $terms, $taxonomy ); } $tax_object = get_taxonomy( $taxonomy ); foreach ( $tax_object->object_type as $object_type ) { clean_object_term_cache( $object_ids, $object_type ); } $term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) ); foreach ( $term_meta_ids as $mid ) { delete_metadata_by_mid( 'term', $mid ); } do_action( 'delete_term_taxonomy', $tt_id ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); do_action( 'deleted_term_taxonomy', $tt_id ); if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term ) ) ) { $wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) ); } clean_term_cache( $term, $taxonomy ); do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids ); do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids ); return true; } function wp_delete_category( $cat_ID ) { return wp_delete_term( $cat_ID, 'category' ); } function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { if ( empty( $object_ids ) || empty( $taxonomies ) ) { return array(); } if ( ! is_array( $taxonomies ) ) { $taxonomies = array( $taxonomies ); } foreach ( $taxonomies as $taxonomy ) { if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } } if ( ! is_array( $object_ids ) ) { $object_ids = array( $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $args = wp_parse_args( $args ); $args = apply_filters( 'wp_get_object_terms_args', $args, $object_ids, $taxonomies ); $terms = array(); if ( count( $taxonomies ) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy( $taxonomy ); if ( isset( $t->args ) && is_array( $t->args ) && array_merge( $args, $t->args ) != $args ) { unset( $taxonomies[ $index ] ); $terms = array_merge( $terms, wp_get_object_terms( $object_ids, $taxonomy, array_merge( $args, $t->args ) ) ); } } } else { $t = get_taxonomy( $taxonomies[0] ); if ( isset( $t->args ) && is_array( $t->args ) ) { $args = array_merge( $args, $t->args ); } } $args['taxonomy'] = $taxonomies; $args['object_ids'] = $object_ids; if ( ! empty( $taxonomies ) ) { $terms_from_remaining_taxonomies = get_terms( $args ); if ( ! empty( $args['fields'] ) && 0 === strpos( $args['fields'], 'id=>' ) ) { $terms = $terms + $terms_from_remaining_taxonomies; } else { $terms = array_merge( $terms, $terms_from_remaining_taxonomies ); } } $terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args ); $object_ids = implode( ',', $object_ids ); $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'"; return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args ); } function wp_insert_term( $term, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term = apply_filters( 'pre_insert_term', $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( is_int( $term ) && 0 === $term ) { return new WP_Error( 'invalid_term_id', __( 'Invalid term ID.' ) ); } if ( '' === trim( $term ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); if ( (int) $args['parent'] > 0 && ! term_exists( (int) $args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $args['name'] = $term; $args['taxonomy'] = $taxonomy; $args['description'] = (string) $args['description']; $args = sanitize_term( $args, $taxonomy, 'db' ); $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parent = (int) $args['parent']; $slug_provided = ! empty( $args['slug'] ); if ( ! $slug_provided ) { $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $term_group = 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } } $name_matches = get_terms( array( 'taxonomy' => $taxonomy, 'name' => $name, 'hide_empty' => false, 'parent' => $args['parent'], 'update_term_meta_cache' => false, ) ); $name_match = null; if ( $name_matches ) { foreach ( $name_matches as $_match ) { if ( strtolower( $name ) === strtolower( $_match->name ) ) { $name_match = $_match; break; } } } if ( $name_match ) { $slug_match = get_term_by( 'slug', $slug, $taxonomy ); if ( ! $slug_provided || $name_match->slug === $slug || $slug_match ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { $siblings = get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', 'parent' => $parent, 'update_term_meta_cache' => false, ) ); $existing_term = null; $sibling_names = wp_list_pluck( $siblings, 'name' ); $sibling_slugs = wp_list_pluck( $siblings, 'slug' ); if ( ( ! $slug_provided || $name_match->slug === $slug ) && in_array( $name, $sibling_names, true ) ) { $existing_term = $name_match; } elseif ( $slug_match && in_array( $slug, $sibling_slugs, true ) ) { $existing_term = $slug_match; } if ( $existing_term ) { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists with this parent.' ), $existing_term->term_id ); } } else { return new WP_Error( 'term_exists', __( 'A term with the name provided already exists in this taxonomy.' ), $name_match->term_id ); } } } $slug = wp_unique_term_slug( $slug, (object) $args ); $data = compact( 'name', 'slug', 'term_group' ); $data = apply_filters( 'wp_insert_term_data', $data, $taxonomy, $args ); if ( false === $wpdb->insert( $wpdb->terms, $data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database.' ), $wpdb->last_error ); } $term_id = (int) $wpdb->insert_id; if ( empty( $slug ) ) { $slug = sanitize_title( $slug, $term_id ); do_action( 'edit_terms', $term_id, $taxonomy ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); do_action( 'edited_terms', $term_id, $taxonomy ); } $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); if ( ! empty( $tt_id ) ) { return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } if ( false === $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ) + array( 'count' => 0 ) ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term taxonomy into the database.' ), $wpdb->last_error ); } $tt_id = (int) $wpdb->insert_id; $duplicate_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.slug, tt.term_taxonomy_id, tt.taxonomy FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON ( tt.term_id = t.term_id ) WHERE t.slug = %s AND tt.parent = %d AND tt.taxonomy = %s AND t.term_id < %d AND tt.term_taxonomy_id != %d", $slug, $parent, $taxonomy, $term_id, $tt_id ) ); $duplicate_term = apply_filters( 'wp_insert_term_duplicate_term_check', $duplicate_term, $term, $taxonomy, $args, $tt_id ); if ( $duplicate_term ) { $wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) ); $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); $term_id = (int) $duplicate_term->term_id; $tt_id = (int) $duplicate_term->term_taxonomy_id; clean_term_cache( $term_id, $taxonomy ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } do_action( 'create_term', $term_id, $tt_id, $taxonomy ); do_action( "create_{$taxonomy}", $term_id, $tt_id ); $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); clean_term_cache( $term_id, $taxonomy ); do_action( 'created_term', $term_id, $tt_id, $taxonomy ); do_action( "created_{$taxonomy}", $term_id, $tt_id ); do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false ); do_action( "saved_{$taxonomy}", $term_id, $tt_id, false ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) { global $wpdb; $object_id = (int) $object_id; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } if ( ! $append ) { $old_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids', 'orderby' => 'none', 'update_term_meta_cache' => false, ) ); } else { $old_tt_ids = array(); } $tt_ids = array(); $term_ids = array(); $new_tt_ids = array(); foreach ( (array) $terms as $term ) { if ( '' === trim( $term ) ) { continue; } $term_info = term_exists( $term, $taxonomy ); if ( ! $term_info ) { if ( is_int( $term ) ) { continue; } $term_info = wp_insert_term( $term, $taxonomy ); } if ( is_wp_error( $term_info ) ) { return $term_info; } $term_ids[] = $term_info['term_id']; $tt_id = $term_info['term_taxonomy_id']; $tt_ids[] = $tt_id; if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) ) { continue; } do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy ); $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id, ) ); do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy ); $new_tt_ids[] = $tt_id; } if ( $new_tt_ids ) { wp_update_term_count( $new_tt_ids, $taxonomy ); } if ( ! $append ) { $delete_tt_ids = array_diff( $old_tt_ids, $tt_ids ); if ( $delete_tt_ids ) { $in_delete_tt_ids = "'" . implode( "', '", $delete_tt_ids ) . "'"; $delete_term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT tt.term_id FROM $wpdb->term_taxonomy AS tt WHERE tt.taxonomy = %s AND tt.term_taxonomy_id IN ($in_delete_tt_ids)", $taxonomy ) ); $delete_term_ids = array_map( 'intval', $delete_term_ids ); $remove = wp_remove_object_terms( $object_id, $delete_term_ids, $taxonomy ); if ( is_wp_error( $remove ) ) { return $remove; } } } $t = get_taxonomy( $taxonomy ); if ( ! $append && isset( $t->sort ) && $t->sort ) { $values = array(); $term_order = 0; $final_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids', 'update_term_meta_cache' => false, ) ); foreach ( $tt_ids as $tt_id ) { if ( in_array( (int) $tt_id, $final_tt_ids, true ) ) { $values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order ); } } if ( $values ) { if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . implode( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error ); } } } wp_cache_delete( $object_id, $taxonomy . '_relationships' ); wp_cache_delete( 'last_changed', 'terms' ); do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ); return $tt_ids; } function wp_add_object_terms( $object_id, $terms, $taxonomy ) { return wp_set_object_terms( $object_id, $terms, $taxonomy, true ); } function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { global $wpdb; $object_id = (int) $object_id; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } $tt_ids = array(); foreach ( (array) $terms as $term ) { if ( '' === trim( $term ) ) { continue; } $term_info = term_exists( $term, $taxonomy ); if ( ! $term_info ) { if ( is_int( $term ) ) { continue; } } if ( is_wp_error( $term_info ) ) { return $term_info; } $tt_ids[] = $term_info['term_taxonomy_id']; } if ( $tt_ids ) { $in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'"; do_action( 'delete_term_relationships', $object_id, $tt_ids, $taxonomy ); $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) ); wp_cache_delete( $object_id, $taxonomy . '_relationships' ); wp_cache_delete( 'last_changed', 'terms' ); do_action( 'deleted_term_relationships', $object_id, $tt_ids, $taxonomy ); wp_update_term_count( $tt_ids, $taxonomy ); return (bool) $deleted; } return false; } function wp_unique_term_slug( $slug, $term ) { global $wpdb; $needs_suffix = true; $original_slug = $slug; if ( ! term_exists( $slug ) || get_option( 'db_version' ) >= 30133 && ! get_term_by( 'slug', $slug, $term->taxonomy ) ) { $needs_suffix = false; } $parent_suffix = ''; if ( $needs_suffix && is_taxonomy_hierarchical( $term->taxonomy ) && ! empty( $term->parent ) ) { $the_parent = $term->parent; while ( ! empty( $the_parent ) ) { $parent_term = get_term( $the_parent, $term->taxonomy ); if ( is_wp_error( $parent_term ) || empty( $parent_term ) ) { break; } $parent_suffix .= '-' . $parent_term->slug; if ( ! term_exists( $slug . $parent_suffix ) ) { break; } if ( empty( $parent_term->parent ) ) { break; } $the_parent = $parent_term->parent; } } if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) { if ( $parent_suffix ) { $slug .= $parent_suffix; } if ( ! empty( $term->term_id ) ) { $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id ); } else { $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); } if ( $wpdb->get_var( $query ) ) { $num = 2; do { $alt_slug = $slug . "-$num"; $num++; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); $slug = $alt_slug; } } return apply_filters( 'wp_unique_term_slug', $slug, $term, $original_slug ); } function wp_update_term( $term_id, $taxonomy, $args = array() ) { global $wpdb; if ( ! taxonomy_exists( $taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $term_id = (int) $term_id; $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! $term ) { return new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } $term = (array) $term->data; $term = wp_slash( $term ); $args = array_merge( $term, $args ); $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '', ); $args = wp_parse_args( $args, $defaults ); $args = sanitize_term( $args, $taxonomy, 'db' ); $parsed_args = $args; $name = wp_unslash( $args['name'] ); $description = wp_unslash( $args['description'] ); $parsed_args['name'] = $name; $parsed_args['description'] = $description; if ( '' === trim( $name ) ) { return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) ); } if ( (int) $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) { return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); } $empty_slug = false; if ( empty( $args['slug'] ) ) { $empty_slug = true; $slug = sanitize_title( $name ); } else { $slug = $args['slug']; } $parsed_args['slug'] = $slug; $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0; if ( $args['alias_of'] ) { $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); if ( ! empty( $alias->term_group ) ) { $term_group = $alias->term_group; } elseif ( ! empty( $alias->term_id ) ) { $term_group = $wpdb->get_var( "SELECT MAX(term_group) FROM $wpdb->terms" ) + 1; wp_update_term( $alias->term_id, $taxonomy, array( 'term_group' => $term_group, ) ); } $parsed_args['term_group'] = $term_group; } $parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args ); $duplicate = get_term_by( 'slug', $slug, $taxonomy ); if ( $duplicate && $duplicate->term_id !== $term_id ) { if ( $empty_slug || ( $parent !== (int) $term['parent'] ) ) { $slug = wp_unique_term_slug( $slug, (object) $args ); } else { return new WP_Error( 'duplicate_term_slug', sprintf( __( 'The slug “%s” is already in use by another term.' ), $slug ) ); } } $tt_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) ); $_term_id = _split_shared_term( $term_id, $tt_id ); if ( ! is_wp_error( $_term_id ) ) { $term_id = $_term_id; } do_action( 'edit_terms', $term_id, $taxonomy ); $data = compact( 'name', 'slug', 'term_group' ); $data = apply_filters( 'wp_update_term_data', $data, $term_id, $taxonomy, $args ); $wpdb->update( $wpdb->terms, $data, compact( 'term_id' ) ); if ( empty( $slug ) ) { $slug = sanitize_title( $name, $term_id ); $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); } do_action( 'edited_terms', $term_id, $taxonomy ); do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); do_action( 'edit_term', $term_id, $tt_id, $taxonomy ); do_action( "edit_{$taxonomy}", $term_id, $tt_id ); $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); clean_term_cache( $term_id, $taxonomy ); do_action( 'edited_term', $term_id, $tt_id, $taxonomy ); do_action( "edited_{$taxonomy}", $term_id, $tt_id ); do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true ); do_action( "saved_{$taxonomy}", $term_id, $tt_id, true ); return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id, ); } function wp_defer_term_counting( $defer = null ) { static $_defer = false; if ( is_bool( $defer ) ) { $_defer = $defer; if ( ! $defer ) { wp_update_term_count( null, null, true ); } } return $_defer; } function wp_update_term_count( $terms, $taxonomy, $do_deferred = false ) { static $_deferred = array(); if ( $do_deferred ) { foreach ( (array) array_keys( $_deferred ) as $tax ) { wp_update_term_count_now( $_deferred[ $tax ], $tax ); unset( $_deferred[ $tax ] ); } } if ( empty( $terms ) ) { return false; } if ( ! is_array( $terms ) ) { $terms = array( $terms ); } if ( wp_defer_term_counting() ) { if ( ! isset( $_deferred[ $taxonomy ] ) ) { $_deferred[ $taxonomy ] = array(); } $_deferred[ $taxonomy ] = array_unique( array_merge( $_deferred[ $taxonomy ], $terms ) ); return true; } return wp_update_term_count_now( $terms, $taxonomy ); } function wp_update_term_count_now( $terms, $taxonomy ) { $terms = array_map( 'intval', $terms ); $taxonomy = get_taxonomy( $taxonomy ); if ( ! empty( $taxonomy->update_count_callback ) ) { call_user_func( $taxonomy->update_count_callback, $terms, $taxonomy ); } else { $object_types = (array) $taxonomy->object_type; foreach ( $object_types as &$object_type ) { if ( 0 === strpos( $object_type, 'attachment:' ) ) { list( $object_type ) = explode( ':', $object_type ); } } if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) { _update_post_term_count( $terms, $taxonomy ); } else { _update_generic_term_count( $terms, $taxonomy ); } } clean_term_cache( $terms, '', false ); return true; } function clean_object_term_cache( $object_ids, $object_type ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( ! is_array( $object_ids ) ) { $object_ids = array( $object_ids ); } $taxonomies = get_object_taxonomies( $object_type ); foreach ( $taxonomies as $taxonomy ) { wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" ); } wp_cache_delete( 'last_changed', 'terms' ); do_action( 'clean_object_term_cache', $object_ids, $object_type ); } function clean_term_cache( $ids, $taxonomy = '', $clean_taxonomy = true ) { global $wpdb, $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( ! is_array( $ids ) ) { $ids = array( $ids ); } $taxonomies = array(); if ( empty( $taxonomy ) ) { $tt_ids = array_map( 'intval', $ids ); $tt_ids = implode( ', ', $tt_ids ); $terms = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)" ); $ids = array(); foreach ( (array) $terms as $term ) { $taxonomies[] = $term->taxonomy; $ids[] = $term->term_id; } wp_cache_delete_multiple( $ids, 'terms' ); $taxonomies = array_unique( $taxonomies ); } else { wp_cache_delete_multiple( $ids, 'terms' ); $taxonomies = array( $taxonomy ); } foreach ( $taxonomies as $taxonomy ) { if ( $clean_taxonomy ) { clean_taxonomy_cache( $taxonomy ); } do_action( 'clean_term_cache', $ids, $taxonomy, $clean_taxonomy ); } wp_cache_set( 'last_changed', microtime(), 'terms' ); } function clean_taxonomy_cache( $taxonomy ) { wp_cache_delete( 'all_ids', $taxonomy ); wp_cache_delete( 'get', $taxonomy ); wp_cache_delete( 'last_changed', 'terms' ); delete_option( "{$taxonomy}_children" ); _get_term_hierarchy( $taxonomy ); do_action( 'clean_taxonomy_cache', $taxonomy ); } function get_object_term_cache( $id, $taxonomy ) { $_term_ids = wp_cache_get( $id, "{$taxonomy}_relationships" ); if ( false === $_term_ids ) { return false; } $term_ids = array(); foreach ( $_term_ids as $term_id ) { if ( is_numeric( $term_id ) ) { $term_ids[] = (int) $term_id; } elseif ( isset( $term_id->term_id ) ) { $term_ids[] = (int) $term_id->term_id; } } _prime_term_caches( $term_ids ); $terms = array(); foreach ( $term_ids as $term_id ) { $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } $terms[] = $term; } return $terms; } function update_object_term_cache( $object_ids, $object_type ) { if ( empty( $object_ids ) ) { return; } if ( ! is_array( $object_ids ) ) { $object_ids = explode( ',', $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $non_cached_ids = array(); $taxonomies = get_object_taxonomies( $object_type ); foreach ( $taxonomies as $taxonomy ) { $cache_values = wp_cache_get_multiple( (array) $object_ids, "{$taxonomy}_relationships" ); foreach ( $cache_values as $id => $value ) { if ( false === $value ) { $non_cached_ids[] = $id; } } } if ( empty( $non_cached_ids ) ) { return false; } $non_cached_ids = array_unique( $non_cached_ids ); $terms = wp_get_object_terms( $non_cached_ids, $taxonomies, array( 'fields' => 'all_with_object_id', 'orderby' => 'name', 'update_term_meta_cache' => false, ) ); $object_terms = array(); foreach ( (array) $terms as $term ) { $object_terms[ $term->object_id ][ $term->taxonomy ][] = $term->term_id; } foreach ( $non_cached_ids as $id ) { foreach ( $taxonomies as $taxonomy ) { if ( ! isset( $object_terms[ $id ][ $taxonomy ] ) ) { if ( ! isset( $object_terms[ $id ] ) ) { $object_terms[ $id ] = array(); } $object_terms[ $id ][ $taxonomy ] = array(); } } } $cache_values = array(); foreach ( $object_terms as $id => $value ) { foreach ( $value as $taxonomy => $terms ) { $cache_values[ $taxonomy ][ $id ] = $terms; } } foreach ( $cache_values as $taxonomy => $data ) { wp_cache_add_multiple( $data, "{$taxonomy}_relationships" ); } } function update_term_cache( $terms, $taxonomy = '' ) { $data = array(); foreach ( (array) $terms as $term ) { $_term = clone $term; unset( $_term->object_id ); $data[ $term->term_id ] = $_term; } wp_cache_add_multiple( $data, 'terms' ); } function _get_term_hierarchy( $taxonomy ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { return array(); } $children = get_option( "{$taxonomy}_children" ); if ( is_array( $children ) ) { return $children; } $children = array(); $terms = get_terms( array( 'taxonomy' => $taxonomy, 'get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent', 'update_term_meta_cache' => false, ) ); foreach ( $terms as $term_id => $parent ) { if ( $parent > 0 ) { $children[ $parent ][] = $term_id; } } update_option( "{$taxonomy}_children", $children ); return $children; } function _get_term_children( $term_id, $terms, $taxonomy, &$ancestors = array() ) { $empty_array = array(); if ( empty( $terms ) ) { return $empty_array; } $term_id = (int) $term_id; $term_list = array(); $has_children = _get_term_hierarchy( $taxonomy ); if ( $term_id && ! isset( $has_children[ $term_id ] ) ) { return $empty_array; } if ( empty( $ancestors ) ) { $ancestors[ $term_id ] = 1; } foreach ( (array) $terms as $term ) { $use_id = false; if ( ! is_object( $term ) ) { $term = get_term( $term, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } $use_id = true; } if ( isset( $ancestors[ $term->term_id ] ) ) { continue; } if ( (int) $term->parent === $term_id ) { if ( $use_id ) { $term_list[] = $term->term_id; } else { $term_list[] = $term; } if ( ! isset( $has_children[ $term->term_id ] ) ) { continue; } $ancestors[ $term->term_id ] = 1; $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors ); if ( $children ) { $term_list = array_merge( $term_list, $children ); } } } return $term_list; } function _pad_term_counts( &$terms, $taxonomy ) { global $wpdb; if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { return; } $term_hier = _get_term_hierarchy( $taxonomy ); if ( empty( $term_hier ) ) { return; } $term_items = array(); $terms_by_id = array(); $term_ids = array(); foreach ( (array) $terms as $key => $term ) { $terms_by_id[ $term->term_id ] = & $terms[ $key ]; $term_ids[ $term->term_taxonomy_id ] = $term->term_id; } $tax_obj = get_taxonomy( $taxonomy ); $object_types = esc_sql( $tax_obj->object_type ); $results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys( $term_ids ) ) . ") AND post_type IN ('" . implode( "', '", $object_types ) . "') AND post_status = 'publish'" ); foreach ( $results as $row ) { $id = $term_ids[ $row->term_taxonomy_id ]; $term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1; } foreach ( $term_ids as $term_id ) { $child = $term_id; $ancestors = array(); while ( ! empty( $terms_by_id[ $child ] ) && $parent = $terms_by_id[ $child ]->parent ) { $ancestors[] = $child; if ( ! empty( $term_items[ $term_id ] ) ) { foreach ( $term_items[ $term_id ] as $item_id => $touches ) { $term_items[ $parent ][ $item_id ] = isset( $term_items[ $parent ][ $item_id ] ) ? ++$term_items[ $parent ][ $item_id ] : 1; } } $child = $parent; if ( in_array( $parent, $ancestors, true ) ) { break; } } } foreach ( (array) $term_items as $id => $items ) { if ( isset( $terms_by_id[ $id ] ) ) { $terms_by_id[ $id ]->count = count( $items ); } } } function _prime_term_caches( $term_ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' ); if ( ! empty( $non_cached_ids ) ) { $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_term_cache( $fresh_terms ); if ( $update_meta_cache ) { update_termmeta_cache( $non_cached_ids ); } } } function _update_post_term_count( $terms, $taxonomy ) { global $wpdb; $object_types = (array) $taxonomy->object_type; foreach ( $object_types as &$object_type ) { list( $object_type ) = explode( ':', $object_type ); } $object_types = array_unique( $object_types ); $check_attachments = array_search( 'attachment', $object_types, true ); if ( false !== $check_attachments ) { unset( $object_types[ $check_attachments ] ); $check_attachments = true; } if ( $object_types ) { $object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) ); } $post_statuses = array( 'publish' ); $post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) ); foreach ( (array) $terms as $term ) { $count = 0; if ( $check_attachments ) { $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status IN ('" . implode( "', '", $post_statuses ) . "') OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) IN ('" . implode( "', '", $post_statuses ) . "') ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) ); } if ( $object_types ) { $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status IN ('" . implode( "', '", $post_statuses ) . "') AND post_type IN ('" . implode( "', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) ); } do_action( 'edit_term_taxonomy', $term, $taxonomy->name ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); do_action( 'edited_term_taxonomy', $term, $taxonomy->name ); } } function _update_generic_term_count( $terms, $taxonomy ) { global $wpdb; foreach ( (array) $terms as $term ) { $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) ); do_action( 'edit_term_taxonomy', $term, $taxonomy->name ); $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); do_action( 'edited_term_taxonomy', $term, $taxonomy->name ); } } function _split_shared_term( $term_id, $term_taxonomy_id, $record = true ) { global $wpdb; if ( is_object( $term_id ) ) { $shared_term = $term_id; $term_id = (int) $shared_term->term_id; } if ( is_object( $term_taxonomy_id ) ) { $term_taxonomy = $term_taxonomy_id; $term_taxonomy_id = (int) $term_taxonomy->term_taxonomy_id; } $shared_tt_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy tt WHERE tt.term_id = %d AND tt.term_taxonomy_id != %d", $term_id, $term_taxonomy_id ) ); if ( ! $shared_tt_count ) { return $term_id; } $check_term_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) ); if ( $check_term_id !== $term_id ) { return $check_term_id; } if ( empty( $shared_term ) ) { $shared_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.* FROM $wpdb->terms t WHERE t.term_id = %d", $term_id ) ); } $new_term_data = array( 'name' => $shared_term->name, 'slug' => $shared_term->slug, 'term_group' => $shared_term->term_group, ); if ( false === $wpdb->insert( $wpdb->terms, $new_term_data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not split shared term.' ), $wpdb->last_error ); } $new_term_id = (int) $wpdb->insert_id; $wpdb->update( $wpdb->term_taxonomy, array( 'term_id' => $new_term_id ), array( 'term_taxonomy_id' => $term_taxonomy_id ) ); if ( empty( $term_taxonomy ) ) { $term_taxonomy = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) ); } $children_tt_ids = $wpdb->get_col( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE parent = %d AND taxonomy = %s", $term_id, $term_taxonomy->taxonomy ) ); if ( ! empty( $children_tt_ids ) ) { foreach ( $children_tt_ids as $child_tt_id ) { $wpdb->update( $wpdb->term_taxonomy, array( 'parent' => $new_term_id ), array( 'term_taxonomy_id' => $child_tt_id ) ); clean_term_cache( (int) $child_tt_id, '', false ); } } else { clean_term_cache( $new_term_id, $term_taxonomy->taxonomy, false ); } clean_term_cache( $term_id, $term_taxonomy->taxonomy, false ); $taxonomies_to_clean = array( $term_taxonomy->taxonomy ); $shared_term_taxonomies = $wpdb->get_col( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) ); $taxonomies_to_clean = array_merge( $taxonomies_to_clean, $shared_term_taxonomies ); foreach ( $taxonomies_to_clean as $taxonomy_to_clean ) { clean_taxonomy_cache( $taxonomy_to_clean ); } if ( $record ) { $split_term_data = get_option( '_split_terms', array() ); if ( ! isset( $split_term_data[ $term_id ] ) ) { $split_term_data[ $term_id ] = array(); } $split_term_data[ $term_id ][ $term_taxonomy->taxonomy ] = $new_term_id; update_option( '_split_terms', $split_term_data ); } $shared_terms_exist = $wpdb->get_results( "SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt - LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id - GROUP BY t.term_id - HAVING term_tt_count > 1 - LIMIT 1" ); if ( ! $shared_terms_exist ) { update_option( 'finished_splitting_shared_terms', true ); } do_action( 'split_shared_term', $term_id, $new_term_id, $term_taxonomy_id, $term_taxonomy->taxonomy ); return $new_term_id; } function _wp_batch_split_terms() { global $wpdb; $lock_name = 'term_split.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_name ); if ( ! $lock_result || ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) ) { wp_schedule_single_event( time() + ( 5 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); return; } } update_option( $lock_name, time() ); $shared_terms = $wpdb->get_results( "SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt - LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id - GROUP BY t.term_id - HAVING term_tt_count > 1 - LIMIT 10" ); if ( ! $shared_terms ) { update_option( 'finished_splitting_shared_terms', true ); delete_option( $lock_name ); return; } wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' ); $_shared_terms = array(); foreach ( $shared_terms as $shared_term ) { $term_id = (int) $shared_term->term_id; $_shared_terms[ $term_id ] = $shared_term; } $shared_terms = $_shared_terms; $shared_term_ids = implode( ',', array_keys( $shared_terms ) ); $shared_tts = $wpdb->get_results( "SELECT * FROM {$wpdb->term_taxonomy} WHERE `term_id` IN ({$shared_term_ids})" ); $split_term_data = get_option( '_split_terms', array() ); $skipped_first_term = array(); $taxonomies = array(); foreach ( $shared_tts as $shared_tt ) { $term_id = (int) $shared_tt->term_id; if ( ! isset( $skipped_first_term[ $term_id ] ) ) { $skipped_first_term[ $term_id ] = 1; continue; } if ( ! isset( $split_term_data[ $term_id ] ) ) { $split_term_data[ $term_id ] = array(); } if ( ! isset( $taxonomies[ $shared_tt->taxonomy ] ) ) { $taxonomies[ $shared_tt->taxonomy ] = 1; } $split_term_data[ $term_id ][ $shared_tt->taxonomy ] = _split_shared_term( $shared_terms[ $term_id ], $shared_tt, false ); } foreach ( array_keys( $taxonomies ) as $tax ) { delete_option( "{$tax}_children" ); _get_term_hierarchy( $tax ); } update_option( '_split_terms', $split_term_data ); delete_option( $lock_name ); } function _wp_check_for_scheduled_split_terms() { if ( ! get_option( 'finished_splitting_shared_terms' ) && ! wp_next_scheduled( 'wp_split_shared_term_batch' ) ) { wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_split_shared_term_batch' ); } } function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { if ( 'category' !== $taxonomy ) { return; } foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) { if ( (int) get_option( $option, -1 ) === $term_id ) { update_option( $option, $new_term_id ); } } } function _wp_check_split_terms_in_menus( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { global $wpdb; $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT m1.post_id - FROM {$wpdb->postmeta} AS m1 - INNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id ) - INNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id ) - WHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' ) - AND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = %s ) - AND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id ) ); if ( $post_ids ) { foreach ( $post_ids as $post_id ) { update_post_meta( $post_id, '_menu_item_object_id', $new_term_id, $term_id ); } } } function _wp_check_split_nav_menu_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { if ( 'nav_menu' !== $taxonomy ) { return; } $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { if ( $term_id === $menu_id ) { $locations[ $location ] = $new_term_id; } } set_theme_mod( 'nav_menu_locations', $locations ); } function wp_get_split_terms( $old_term_id ) { $split_terms = get_option( '_split_terms', array() ); $terms = array(); if ( isset( $split_terms[ $old_term_id ] ) ) { $terms = $split_terms[ $old_term_id ]; } return $terms; } function wp_get_split_term( $old_term_id, $taxonomy ) { $split_terms = wp_get_split_terms( $old_term_id ); $term_id = false; if ( isset( $split_terms[ $taxonomy ] ) ) { $term_id = (int) $split_terms[ $taxonomy ]; } return $term_id; } function wp_term_is_shared( $term_id ) { global $wpdb; if ( get_option( 'finished_splitting_shared_terms' ) ) { return false; } $tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) ); return $tt_count > 1; } function get_term_link( $term, $taxonomy = '' ) { global $wp_rewrite; if ( ! is_object( $term ) ) { if ( is_int( $term ) ) { $term = get_term( $term, $taxonomy ); } else { $term = get_term_by( 'slug', $term, $taxonomy ); } } if ( ! is_object( $term ) ) { $term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); } if ( is_wp_error( $term ) ) { return $term; } $taxonomy = $term->taxonomy; $termlink = $wp_rewrite->get_extra_permastruct( $taxonomy ); $termlink = apply_filters( 'pre_term_link', $termlink, $term ); $slug = $term->slug; $t = get_taxonomy( $taxonomy ); if ( empty( $termlink ) ) { if ( 'category' === $taxonomy ) { $termlink = '?cat=' . $term->term_id; } elseif ( $t->query_var ) { $termlink = "?$t->query_var=$slug"; } else { $termlink = "?taxonomy=$taxonomy&term=$slug"; } $termlink = home_url( $termlink ); } else { if ( ! empty( $t->rewrite['hierarchical'] ) ) { $hierarchical_slugs = array(); $ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' ); foreach ( (array) $ancestors as $ancestor ) { $ancestor_term = get_term( $ancestor, $taxonomy ); $hierarchical_slugs[] = $ancestor_term->slug; } $hierarchical_slugs = array_reverse( $hierarchical_slugs ); $hierarchical_slugs[] = $slug; $termlink = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs ), $termlink ); } else { $termlink = str_replace( "%$taxonomy%", $slug, $termlink ); } $termlink = home_url( user_trailingslashit( $termlink, 'category' ) ); } if ( 'post_tag' === $taxonomy ) { $termlink = apply_filters( 'tag_link', $termlink, $term->term_id ); } elseif ( 'category' === $taxonomy ) { $termlink = apply_filters( 'category_link', $termlink, $term->term_id ); } return apply_filters( 'term_link', $termlink, $term, $taxonomy ); } function the_taxonomies( $args = array() ) { $defaults = array( 'post' => 0, 'before' => '', 'sep' => ' ', 'after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); echo $parsed_args['before'] . implode( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after']; } function get_the_taxonomies( $post = 0, $args = array() ) { $post = get_post( $post ); $args = wp_parse_args( $args, array( 'template' => __( '%s: %l.' ), 'term_template' => '%2$s', ) ); $taxonomies = array(); if ( ! $post ) { return $taxonomies; } foreach ( get_object_taxonomies( $post ) as $taxonomy ) { $t = (array) get_taxonomy( $taxonomy ); if ( empty( $t['label'] ) ) { $t['label'] = $taxonomy; } if ( empty( $t['args'] ) ) { $t['args'] = array(); } if ( empty( $t['template'] ) ) { $t['template'] = $args['template']; } if ( empty( $t['term_template'] ) ) { $t['term_template'] = $args['term_template']; } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] ); } $links = array(); foreach ( $terms as $term ) { $links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link( $term ) ), $term->name ); } if ( $links ) { $taxonomies[ $taxonomy ] = wp_sprintf( $t['template'], $t['label'], $links, $terms ); } } return $taxonomies; } function get_post_taxonomies( $post = 0 ) { $post = get_post( $post ); return get_object_taxonomies( $post ); } function is_object_in_term( $object_id, $taxonomy, $terms = null ) { $object_id = (int) $object_id; if ( ! $object_id ) { return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) ); } $object_terms = get_object_term_cache( $object_id, $taxonomy ); if ( false === $object_terms ) { $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) ); if ( is_wp_error( $object_terms ) ) { return $object_terms; } wp_cache_set( $object_id, wp_list_pluck( $object_terms, 'term_id' ), "{$taxonomy}_relationships" ); } if ( is_wp_error( $object_terms ) ) { return $object_terms; } if ( empty( $object_terms ) ) { return false; } if ( empty( $terms ) ) { return ( ! empty( $object_terms ) ); } $terms = (array) $terms; $ints = array_filter( $terms, 'is_int' ); if ( $ints ) { $strs = array_diff( $terms, $ints ); } else { $strs =& $terms; } foreach ( $object_terms as $object_term ) { if ( $ints && in_array( $object_term->term_id, $ints, true ) ) { return true; } if ( $strs ) { $numeric_strs = array_map( 'intval', array_filter( $strs, 'is_numeric' ) ); if ( in_array( $object_term->term_id, $numeric_strs, true ) ) { return true; } if ( in_array( $object_term->name, $strs, true ) ) { return true; } if ( in_array( $object_term->slug, $strs, true ) ) { return true; } } } return false; } function is_object_in_taxonomy( $object_type, $taxonomy ) { $taxonomies = get_object_taxonomies( $object_type ); if ( empty( $taxonomies ) ) { return false; } return in_array( $taxonomy, $taxonomies, true ); } function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) { $object_id = (int) $object_id; $ancestors = array(); if ( empty( $object_id ) ) { return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); } if ( ! $resource_type ) { if ( is_taxonomy_hierarchical( $object_type ) ) { $resource_type = 'taxonomy'; } elseif ( post_type_exists( $object_type ) ) { $resource_type = 'post_type'; } } if ( 'taxonomy' === $resource_type ) { $term = get_term( $object_id, $object_type ); while ( ! is_wp_error( $term ) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors, true ) ) { $ancestors[] = (int) $term->parent; $term = get_term( $term->parent, $object_type ); } } elseif ( 'post_type' === $resource_type ) { $ancestors = get_post_ancestors( $object_id ); } return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); } function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) { $term = get_term( $term_id, $taxonomy ); if ( ! $term || is_wp_error( $term ) ) { return false; } return (int) $term->parent; } function wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) { if ( ! $parent ) { return 0; } if ( $parent === $term_id ) { return 0; } $loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ); if ( ! $loop ) { return $parent; } if ( isset( $loop[ $term_id ] ) ) { return 0; } foreach ( array_keys( $loop ) as $loop_member ) { wp_update_term( $loop_member, $taxonomy, array( 'parent' => 0 ) ); } return $parent; } function is_taxonomy_viewable( $taxonomy ) { if ( is_scalar( $taxonomy ) ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return false; } } return $taxonomy->publicly_queryable; } function wp_cache_set_terms_last_changed() { wp_cache_set( 'last_changed', microtime(), 'terms' ); } function wp_check_term_meta_support_prefilter( $check ) { if ( get_option( 'db_version' ) < 34370 ) { return false; } return $check; } 'category' ); $args = wp_parse_args( $args, $defaults ); $args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args ); if ( isset( $args['type'] ) && 'link' === $args['type'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'type => link', 'taxonomy => link_category' ) ); $args['taxonomy'] = 'link_category'; } $categories = get_terms( $args ); if ( is_wp_error( $categories ) ) { $categories = array(); } else { $categories = (array) $categories; foreach ( array_keys( $categories ) as $k ) { _make_cat_compat( $categories[ $k ] ); } } return $categories; } function get_category( $category, $output = OBJECT, $filter = 'raw' ) { $category = get_term( $category, 'category', $output, $filter ); if ( is_wp_error( $category ) ) { return $category; } _make_cat_compat( $category ); return $category; } function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) { $category_path = rawurlencode( urldecode( $category_path ) ); $category_path = str_replace( '%2F', '/', $category_path ); $category_path = str_replace( '%20', ' ', $category_path ); $category_paths = '/' . trim( $category_path, '/' ); $leaf_path = sanitize_title( basename( $category_paths ) ); $category_paths = explode( '/', $category_paths ); $full_path = ''; foreach ( (array) $category_paths as $pathdir ) { $full_path .= ( '' !== $pathdir ? '/' : '' ) . sanitize_title( $pathdir ); } $categories = get_terms( array( 'taxonomy' => 'category', 'get' => 'all', 'slug' => $leaf_path, ) ); if ( empty( $categories ) ) { return; } foreach ( $categories as $category ) { $path = '/' . $leaf_path; $curcategory = $category; while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) { $curcategory = get_term( $curcategory->parent, 'category' ); if ( is_wp_error( $curcategory ) ) { return $curcategory; } $path = '/' . $curcategory->slug . $path; } if ( $path == $full_path ) { $category = get_term( $category->term_id, 'category', $output ); _make_cat_compat( $category ); return $category; } } if ( ! $full_match ) { $category = get_term( reset( $categories )->term_id, 'category', $output ); _make_cat_compat( $category ); return $category; } } function get_category_by_slug( $slug ) { $category = get_term_by( 'slug', $slug, 'category' ); if ( $category ) { _make_cat_compat( $category ); } return $category; } function get_cat_ID( $cat_name ) { $cat = get_term_by( 'name', $cat_name, 'category' ); if ( $cat ) { return $cat->term_id; } return 0; } function get_cat_name( $cat_id ) { $cat_id = (int) $cat_id; $category = get_term( $cat_id, 'category' ); if ( ! $category || is_wp_error( $category ) ) { return ''; } return $category->name; } function cat_is_ancestor_of( $cat1, $cat2 ) { return term_is_ancestor_of( $cat1, $cat2, 'category' ); } function sanitize_category( $category, $context = 'display' ) { return sanitize_term( $category, 'category', $context ); } function sanitize_category_field( $field, $value, $cat_id, $context ) { return sanitize_term_field( $field, $value, $cat_id, 'category', $context ); } function get_tags( $args = '' ) { $defaults = array( 'taxonomy' => 'post_tag' ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( $args ); if ( empty( $tags ) ) { $tags = array(); } else { $tags = apply_filters( 'get_tags', $tags, $args ); } return $tags; } function get_tag( $tag, $output = OBJECT, $filter = 'raw' ) { return get_term( $tag, 'post_tag', $output, $filter ); } function clean_category_cache( $id ) { clean_term_cache( $id, 'category' ); } function _make_cat_compat( &$category ) { if ( is_object( $category ) && ! is_wp_error( $category ) ) { $category->cat_ID = $category->term_id; $category->category_count = $category->count; $category->category_description = $category->description; $category->cat_name = $category->name; $category->category_nicename = $category->slug; $category->category_parent = $category->parent; } elseif ( is_array( $category ) && isset( $category['term_id'] ) ) { $category['cat_ID'] = &$category['term_id']; $category['category_count'] = &$category['count']; $category['category_description'] = &$category['description']; $category['cat_name'] = &$category['name']; $category['category_nicename'] = &$category['slug']; $category['category_parent'] = &$category['parent']; } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); protected $filtered_where_clause; public $date_query = false; public $query_vars; public $query_var_defaults; public $comments; public $found_comments = 0; public $max_num_pages = 0; public function __call( $name, $arguments ) { if ( 'get_search_sql' === $name ) { return $this->get_search_sql( ...$arguments ); } return false; } public function __construct( $query = '' ) { $this->query_var_defaults = array( 'author_email' => '', 'author_url' => '', 'author__in' => '', 'author__not_in' => '', 'include_unapproved' => '', 'fields' => '', 'ID' => '', 'comment__in' => '', 'comment__not_in' => '', 'karma' => '', 'number' => '', 'offset' => '', 'no_found_rows' => true, 'orderby' => '', 'order' => 'DESC', 'paged' => 1, 'parent' => '', 'parent__in' => '', 'parent__not_in' => '', 'post_author__in' => '', 'post_author__not_in' => '', 'post_ID' => '', 'post_id' => 0, 'post__in' => '', 'post__not_in' => '', 'post_author' => '', 'post_name' => '', 'post_parent' => '', 'post_status' => '', 'post_type' => '', 'status' => 'all', 'type' => '', 'type__in' => '', 'type__not_in' => '', 'user_id' => '', 'search' => '', 'count' => false, 'meta_key' => '', 'meta_value' => '', 'meta_query' => '', 'date_query' => null, 'hierarchical' => false, 'cache_domain' => 'core', 'update_comment_meta_cache' => true, 'update_comment_post_cache' => false, ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_comment_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_comments(); } public function get_comments() { global $wpdb; $this->parse_query(); $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $this->query_vars ); do_action_ref_array( 'pre_get_comments', array( &$this ) ); $this->meta_query->parse_query_vars( $this->query_vars ); if ( ! empty( $this->meta_query->queries ) ) { $this->meta_query_clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this ); } $comment_data = null; $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) ); if ( null !== $comment_data ) { if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) { $this->comments = $comment_data; } return $comment_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_comment_meta_cache'], $_args['update_comment_post_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'comment' ); $cache_key = "get_comments:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'comment' ); if ( false === $cache_value ) { $comment_ids = $this->get_comment_ids(); if ( $comment_ids ) { $this->set_found_comments(); } $cache_value = array( 'comment_ids' => $comment_ids, 'found_comments' => $this->found_comments, ); wp_cache_add( $cache_key, $cache_value, 'comment' ); } else { $comment_ids = $cache_value['comment_ids']; $this->found_comments = $cache_value['found_comments']; } if ( $this->found_comments && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_comments / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $comment_ids; } $comment_ids = array_map( 'intval', $comment_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->comments = $comment_ids; return $this->comments; } _prime_comment_caches( $comment_ids, $this->query_vars['update_comment_meta_cache'] ); $_comments = array(); foreach ( $comment_ids as $comment_id ) { $_comment = get_comment( $comment_id ); if ( $_comment ) { $_comments[] = $_comment; } } if ( $this->query_vars['update_comment_post_cache'] ) { $comment_post_ids = array(); foreach ( $_comments as $_comment ) { $comment_post_ids[] = $_comment->comment_post_ID; } _prime_post_caches( $comment_post_ids, false, false ); } $_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) ); $comments = array_map( 'get_comment', $_comments ); if ( $this->query_vars['hierarchical'] ) { $comments = $this->fill_descendants( $comments ); } $this->comments = $comments; return $this->comments; } protected function get_comment_ids() { global $wpdb; $approved_clauses = array(); $status_clauses = array(); $statuses = wp_parse_list( $this->query_vars['status'] ); if ( empty( $statuses ) ) { $statuses = array( 'all' ); } if ( ! in_array( 'any', $statuses, true ) ) { foreach ( $statuses as $status ) { switch ( $status ) { case 'hold': $status_clauses[] = "comment_approved = '0'"; break; case 'approve': $status_clauses[] = "comment_approved = '1'"; break; case 'all': case '': $status_clauses[] = "( comment_approved = '0' OR comment_approved = '1' )"; break; default: $status_clauses[] = $wpdb->prepare( 'comment_approved = %s', $status ); break; } } if ( ! empty( $status_clauses ) ) { $approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )'; } } if ( ! empty( $this->query_vars['include_unapproved'] ) ) { $include_unapproved = wp_parse_list( $this->query_vars['include_unapproved'] ); $unapproved_ids = array(); $unapproved_emails = array(); foreach ( $include_unapproved as $unapproved_identifier ) { if ( is_numeric( $unapproved_identifier ) ) { $approved_clauses[] = $wpdb->prepare( "( user_id = %d AND comment_approved = '0' )", $unapproved_identifier ); } else { if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' AND {$wpdb->comments}.comment_ID = %d )", $unapproved_identifier, (int) $_GET['unapproved'] ); } else { $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' )", $unapproved_identifier ); } } } } if ( ! empty( $approved_clauses ) ) { if ( 1 === count( $approved_clauses ) ) { $this->sql_clauses['where']['approved'] = $approved_clauses[0]; } else { $this->sql_clauses['where']['approved'] = '( ' . implode( ' OR ', $approved_clauses ) . ' )'; } } $order = ( 'ASC' === strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC'; if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); $found_orderby_comment_id = false; foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ), true ) ) { $found_orderby_comment_id = true; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'comment__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } if ( empty( $orderby_array ) ) { $orderby_array[] = "$wpdb->comments.comment_date_gmt $order"; } if ( ! $found_orderby_comment_id ) { $comment_id_order = ''; foreach ( $orderby_array as $orderby_clause ) { if ( preg_match( '/comment_date(?:_gmt)*\ (ASC|DESC)/', $orderby_clause, $match ) ) { $comment_id_order = $match[1]; break; } } if ( ! $comment_id_order ) { foreach ( $orderby_array as $orderby_clause ) { if ( false !== strpos( 'ASC', $orderby_clause ) ) { $comment_id_order = 'ASC'; } else { $comment_id_order = 'DESC'; } break; } } if ( ! $comment_id_order ) { $comment_id_order = 'DESC'; } $orderby_array[] = "$wpdb->comments.comment_ID $comment_id_order"; } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "$wpdb->comments.comment_date_gmt $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $paged = absint( $this->query_vars['paged'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . ( $number * ( $paged - 1 ) ) . ',' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "$wpdb->comments.comment_ID"; } $post_id = absint( $this->query_vars['post_id'] ); if ( ! empty( $post_id ) ) { $this->sql_clauses['where']['post_id'] = $wpdb->prepare( 'comment_post_ID = %d', $post_id ); } if ( ! empty( $this->query_vars['comment__in'] ) ) { $this->sql_clauses['where']['comment__in'] = "$wpdb->comments.comment_ID IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['comment__not_in'] ) ) { $this->sql_clauses['where']['comment__not_in'] = "$wpdb->comments.comment_ID NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['parent__in'] ) ) { $this->sql_clauses['where']['parent__in'] = 'comment_parent IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['parent__not_in'] ) ) { $this->sql_clauses['where']['parent__not_in'] = 'comment_parent NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post__in'] ) ) { $this->sql_clauses['where']['post__in'] = 'comment_post_ID IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post__not_in'] ) ) { $this->sql_clauses['where']['post__not_in'] = 'comment_post_ID NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__not_in'] ) ) . ' )'; } if ( '' !== $this->query_vars['author_email'] ) { $this->sql_clauses['where']['author_email'] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] ); } if ( '' !== $this->query_vars['author_url'] ) { $this->sql_clauses['where']['author_url'] = $wpdb->prepare( 'comment_author_url = %s', $this->query_vars['author_url'] ); } if ( '' !== $this->query_vars['karma'] ) { $this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] ); } $raw_types = array( 'IN' => array_merge( (array) $this->query_vars['type'], (array) $this->query_vars['type__in'] ), 'NOT IN' => (array) $this->query_vars['type__not_in'], ); $comment_types = array(); foreach ( $raw_types as $operator => $_raw_types ) { $_raw_types = array_unique( $_raw_types ); foreach ( $_raw_types as $type ) { switch ( $type ) { case '': case 'all': break; case 'comment': case 'comments': $comment_types[ $operator ][] = "''"; $comment_types[ $operator ][] = "'comment'"; break; case 'pings': $comment_types[ $operator ][] = "'pingback'"; $comment_types[ $operator ][] = "'trackback'"; break; default: $comment_types[ $operator ][] = $wpdb->prepare( '%s', $type ); break; } } if ( ! empty( $comment_types[ $operator ] ) ) { $types_sql = implode( ', ', $comment_types[ $operator ] ); $this->sql_clauses['where'][ 'comment_type__' . strtolower( str_replace( ' ', '_', $operator ) ) ] = "comment_type $operator ($types_sql)"; } } $parent = $this->query_vars['parent']; if ( $this->query_vars['hierarchical'] && ! $parent ) { $parent = 0; } if ( '' !== $parent ) { $this->sql_clauses['where']['parent'] = $wpdb->prepare( 'comment_parent = %d', $parent ); } if ( is_array( $this->query_vars['user_id'] ) ) { $this->sql_clauses['where']['user_id'] = 'user_id IN (' . implode( ',', array_map( 'absint', $this->query_vars['user_id'] ) ) . ')'; } elseif ( '' !== $this->query_vars['user_id'] ) { $this->sql_clauses['where']['user_id'] = $wpdb->prepare( 'user_id = %d', $this->query_vars['user_id'] ); } if ( isset( $this->query_vars['search'] ) && strlen( $this->query_vars['search'] ) ) { $search_sql = $this->get_search_sql( $this->query_vars['search'], array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); $this->sql_clauses['where']['search'] = preg_replace( '/^\s*AND\s*/', '', $search_sql ); } $join_posts_table = false; $plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent' ) ); $post_fields = array_filter( $plucked ); if ( ! empty( $post_fields ) ) { $join_posts_table = true; foreach ( $post_fields as $field_name => $field_value ) { $esses = array_fill( 0, count( (array) $field_value ), '%s' ); $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $field_value ); } } foreach ( array( 'post_status', 'post_type' ) as $field_name ) { $q_values = array(); if ( ! empty( $this->query_vars[ $field_name ] ) ) { $q_values = $this->query_vars[ $field_name ]; if ( ! is_array( $q_values ) ) { $q_values = explode( ',', $q_values ); } if ( in_array( 'any', $q_values, true ) || empty( $q_values ) ) { continue; } $join_posts_table = true; $esses = array_fill( 0, count( $q_values ), '%s' ); $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $q_values ); } } if ( ! empty( $this->query_vars['author__in'] ) ) { $this->sql_clauses['where']['author__in'] = 'user_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['author__not_in'] ) ) { $this->sql_clauses['where']['author__not_in'] = 'user_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post_author__in'] ) ) { $join_posts_table = true; $this->sql_clauses['where']['post_author__in'] = 'post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['post_author__not_in'] ) ) { $join_posts_table = true; $this->sql_clauses['where']['post_author__not_in'] = 'post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )'; } $join = ''; $groupby = ''; if ( $join_posts_table ) { $join .= "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID"; } if ( ! empty( $this->meta_query_clauses ) ) { $join .= $this->meta_query_clauses['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $this->meta_query_clauses['where'] ); if ( ! $this->query_vars['count'] ) { $groupby = "{$wpdb->comments}.comment_ID"; } } if ( ! empty( $this->query_vars['date_query'] ) && is_array( $this->query_vars['date_query'] ) ) { $this->date_query = new WP_Date_Query( $this->query_vars['date_query'], 'comment_date' ); $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $this->filtered_where_clause = $where; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->comments $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } else { $comment_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $comment_ids ); } } private function set_found_comments() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_comments_query = apply_filters( 'found_comments_query', 'SELECT FOUND_ROWS()', $this ); $this->found_comments = (int) $wpdb->get_var( $found_comments_query ); } } protected function fill_descendants( $comments ) { global $wpdb; $levels = array( 0 => wp_list_pluck( $comments, 'comment_ID' ), ); $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) ); $last_changed = wp_cache_get_last_changed( 'comment' ); $level = 0; $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' ); do { $child_ids = array(); $uncached_parent_ids = array(); $_parent_ids = $levels[ $level ]; foreach ( $_parent_ids as $parent_id ) { $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; $parent_child_ids = wp_cache_get( $cache_key, 'comment' ); if ( false !== $parent_child_ids ) { $child_ids = array_merge( $child_ids, $parent_child_ids ); } else { $uncached_parent_ids[] = $parent_id; } } if ( $uncached_parent_ids ) { $parent_query_args = $this->query_vars; foreach ( $exclude_keys as $exclude_key ) { $parent_query_args[ $exclude_key ] = ''; } $parent_query_args['parent__in'] = $uncached_parent_ids; $parent_query_args['no_found_rows'] = true; $parent_query_args['hierarchical'] = false; $parent_query_args['offset'] = 0; $parent_query_args['number'] = 0; $level_comments = get_comments( $parent_query_args ); $parent_map = array_fill_keys( $uncached_parent_ids, array() ); foreach ( $level_comments as $level_comment ) { $parent_map[ $level_comment->comment_parent ][] = $level_comment->comment_ID; $child_ids[] = $level_comment->comment_ID; } $data = array(); foreach ( $parent_map as $parent_id => $children ) { $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; $data[ $cache_key ] = $children; } wp_cache_set_multiple( $data, 'comment' ); } $level++; $levels[ $level ] = $child_ids; } while ( $child_ids ); $descendant_ids = array(); for ( $i = 1, $c = count( $levels ); $i < $c; $i++ ) { $descendant_ids = array_merge( $descendant_ids, $levels[ $i ] ); } _prime_comment_caches( $descendant_ids, $this->query_vars['update_comment_meta_cache'] ); $all_comments = $comments; foreach ( $descendant_ids as $descendant_id ) { $all_comments[] = get_comment( $descendant_id ); } if ( 'threaded' === $this->query_vars['hierarchical'] ) { $threaded_comments = array(); $ref = array(); foreach ( $all_comments as $k => $c ) { $_c = get_comment( $c->comment_ID ); if ( ! isset( $ref[ $c->comment_parent ] ) ) { $threaded_comments[ $_c->comment_ID ] = $_c; $ref[ $_c->comment_ID ] = $threaded_comments[ $_c->comment_ID ]; } else { $ref[ $_c->comment_parent ]->add_child( $_c ); $ref[ $_c->comment_ID ] = $ref[ $_c->comment_parent ]->get_child( $_c->comment_ID ); } } foreach ( $ref as $_ref ) { $_ref->populated_children( true ); } $comments = $threaded_comments; } else { $comments = $all_comments; } return $comments; } protected function get_search_sql( $search, $columns ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return ' AND (' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'comment_agent', 'comment_approved', 'comment_author', 'comment_author_email', 'comment_author_IP', 'comment_author_url', 'comment_content', 'comment_date', 'comment_date_gmt', 'comment_ID', 'comment_karma', 'comment_parent', 'comment_post_ID', 'comment_type', 'user_id', ); if ( ! empty( $this->query_vars['meta_key'] ) ) { $allowed_keys[] = $this->query_vars['meta_key']; $allowed_keys[] = 'meta_value'; $allowed_keys[] = 'meta_value_num'; } $meta_query_clauses = $this->meta_query->get_clauses(); if ( $meta_query_clauses ) { $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_query_clauses ) ); } $parsed = false; if ( $this->query_vars['meta_key'] === $orderby || 'meta_value' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value"; } elseif ( 'meta_value_num' === $orderby ) { $parsed = "$wpdb->commentmeta.meta_value+0"; } elseif ( 'comment__in' === $orderby ) { $comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) ); $parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )"; } elseif ( in_array( $orderby, $allowed_keys, true ) ) { if ( isset( $meta_query_clauses[ $orderby ] ) ) { $meta_clause = $meta_query_clauses[ $orderby ]; $parsed = sprintf( 'CAST(%s.meta_value AS %s)', esc_sql( $meta_clause['alias'] ), esc_sql( $meta_clause['cast'] ) ); } else { $parsed = "$wpdb->comments.$orderby"; } } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } document_title_separator' ) ); } return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated ); } function wp_title_rss( $deprecated = '–' ) { if ( '–' !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), 'document_title_separator' ) ); } echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated ); } function get_the_title_rss() { $title = get_the_title(); return apply_filters( 'the_title_rss', $title ); } function the_title_rss() { echo get_the_title_rss(); } function get_the_content_feed( $feed_type = null ) { if ( ! $feed_type ) { $feed_type = get_default_feed(); } $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); return apply_filters( 'the_content_feed', $content, $feed_type ); } function the_content_feed( $feed_type = null ) { echo get_the_content_feed( $feed_type ); } function the_excerpt_rss() { $output = get_the_excerpt(); echo apply_filters( 'the_excerpt_rss', $output ); } function the_permalink_rss() { echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); } function comments_link_feed() { echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) ); } function comment_guid( $comment_id = null ) { echo esc_url( get_comment_guid( $comment_id ) ); } function get_comment_guid( $comment_id = null ) { $comment = get_comment( $comment_id ); if ( ! is_object( $comment ) ) { return false; } return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; } function comment_link( $comment = null ) { echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) ); } function get_comment_author_rss() { return apply_filters( 'comment_author_rss', get_comment_author() ); } function comment_author_rss() { echo get_comment_author_rss(); } function comment_text_rss() { $comment_text = get_comment_text(); $comment_text = apply_filters( 'comment_text_rss', $comment_text ); echo $comment_text; } function get_the_category_rss( $type = null ) { if ( empty( $type ) ) { $type = get_default_feed(); } $categories = get_the_category(); $tags = get_the_tags(); $the_list = ''; $cat_names = array(); $filter = 'rss'; if ( 'atom' === $type ) { $filter = 'raw'; } if ( ! empty( $categories ) ) { foreach ( (array) $categories as $category ) { $cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter ); } } if ( ! empty( $tags ) ) { foreach ( (array) $tags as $tag ) { $cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter ); } } $cat_names = array_unique( $cat_names ); foreach ( $cat_names as $cat_name ) { if ( 'rdf' === $type ) { $the_list .= "\t\t\n"; } elseif ( 'atom' === $type ) { $the_list .= sprintf( '', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); } else { $the_list .= "\t\t\n"; } } return apply_filters( 'the_category_rss', $the_list, $type ); } function the_category_rss( $type = null ) { echo get_the_category_rss( $type ); } function html_type_rss() { $type = get_bloginfo( 'html_type' ); if ( strpos( $type, 'xhtml' ) !== false ) { $type = 'xhtml'; } else { $type = 'html'; } echo $type; } function rss_enclosure() { if ( post_password_required() ) { return; } foreach ( (array) get_post_custom() as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); $t = preg_split( '/[ \t]/', trim( $enclosure[2] ) ); $type = $t[0]; echo apply_filters( 'rss_enclosure', '' . "\n" ); } } } } function atom_enclosure() { if ( post_password_required() ) { return; } foreach ( (array) get_post_custom() as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $enclosure = explode( "\n", $enc ); $url = ''; $type = ''; $length = 0; $mimes = get_allowed_mime_types(); if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) { $url = trim( $enclosure[0] ); } for ( $i = 1; $i <= 2; $i++ ) { if ( isset( $enclosure[ $i ] ) ) { if ( is_numeric( $enclosure[ $i ] ) ) { $length = trim( $enclosure[ $i ] ); } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) { $type = trim( $enclosure[ $i ] ); } } } $html_link_tag = sprintf( "\n", esc_url( $url ), esc_attr( $length ), esc_attr( $type ) ); echo apply_filters( 'atom_enclosure', $html_link_tag ); } } } } function prep_atom_text_construct( $data ) { if ( strpos( $data, '<' ) === false && strpos( $data, '&' ) === false ) { return array( 'text', $data ); } if ( ! function_exists( 'xml_parser_create' ) ) { trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); return array( 'html', "" ); } $parser = xml_parser_create(); xml_parse( $parser, '
            ' . $data . '
            ', true ); $code = xml_get_error_code( $parser ); xml_parser_free( $parser ); unset( $parser ); if ( ! $code ) { if ( strpos( $data, '<' ) === false ) { return array( 'text', $data ); } else { $data = "
            $data
            "; return array( 'xhtml', $data ); } } if ( strpos( $data, ']]>' ) === false ) { return array( 'html', "" ); } else { return array( 'html', htmlspecialchars( $data ) ); } } function atom_site_icon() { $url = get_site_icon_url( 32 ); if ( $url ) { echo '' . convert_chars( $url ) . "\n"; } } function rss2_site_icon() { $rss_title = get_wp_title_rss(); if ( empty( $rss_title ) ) { $rss_title = get_bloginfo_rss( 'name' ); } $url = get_site_icon_url( 32 ); if ( $url ) { echo ' - - ' . convert_chars( $url ) . ' - ' . $rss_title . ' - ' . get_bloginfo_rss( 'url' ) . ' - 32 - 32 - ' . "\n"; } } function get_self_link() { $host = parse_url( home_url() ); return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ); } function self_link() { echo esc_url( apply_filters( 'self_link', get_self_link() ) ); } function get_feed_build_date( $format ) { global $wp_query; $datetime = false; $max_modified_time = false; $utc = new DateTimeZone( 'UTC' ); if ( ! empty( $wp_query ) && $wp_query->have_posts() ) { $modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' ); if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) { $comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' ); $modified_times = array_merge( $modified_times, $comment_times ); } $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', max( $modified_times ), $utc ); } if ( false === $datetime ) { $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', get_lastpostmodified( 'GMT' ), $utc ); } if ( false !== $datetime ) { $max_modified_time = $datetime->format( $format ); } return apply_filters( 'get_feed_build_date', $max_modified_time, $format ); } function feed_content_type( $type = '' ) { if ( empty( $type ) ) { $type = get_default_feed(); } $types = array( 'rss' => 'application/rss+xml', 'rss2' => 'application/rss+xml', 'rss-http' => 'text/xml', 'atom' => 'application/atom+xml', 'rdf' => 'application/rdf+xml', ); $content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream'; return apply_filters( 'feed_content_type', $content_type, $type ); } function fetch_feed( $url ) { if ( ! class_exists( 'SimplePie', false ) ) { require_once ABSPATH . WPINC . '/class-simplepie.php'; } require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php'; require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php'; require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php'; $feed = new SimplePie(); $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); if ( method_exists( 'SimplePie_Cache', 'register' ) ) { SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' ); $feed->set_cache_location( 'wp_transient' ); } else { require_once ABSPATH . WPINC . '/class-wp-feed-cache.php'; $feed->set_cache_class( 'WP_Feed_Cache' ); } $feed->set_file_class( 'WP_SimplePie_File' ); $feed->set_feed_url( $url ); $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); $feed->init(); $feed->set_output_encoding( get_option( 'blog_charset' ) ); if ( $feed->error() ) { return new WP_Error( 'simplepie-error', $feed->error() ); } return $feed; } 'parent', 'id' => 'term_id', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $indent = str_repeat( "\t", $depth ); $output .= "$indent
              \n"; } public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $indent = str_repeat( "\t", $depth ); $output .= "$indent
            \n"; } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $category = $data_object; $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category ); if ( '' === $cat_name ) { return; } $atts = array(); $atts['href'] = get_term_link( $category ); if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) { $atts['title'] = strip_tags( apply_filters( 'category_description', $category->description, $category ) ); } $atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $link = sprintf( '%s', $attributes, $cat_name ); if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { $link .= ' '; if ( empty( $args['feed_image'] ) ) { $link .= '('; } $link .= ''; } $link .= ''; if ( empty( $args['feed_image'] ) ) { $link .= ')'; } } if ( ! empty( $args['show_count'] ) ) { $link .= ' (' . number_format_i18n( $category->count ) . ')'; } if ( 'list' === $args['style'] ) { $output .= "\tterm_id, ); if ( ! empty( $args['current_category'] ) ) { $_current_terms = get_terms( array( 'taxonomy' => $category->taxonomy, 'include' => $args['current_category'], 'hide_empty' => false, ) ); foreach ( $_current_terms as $_current_term ) { if ( $category->term_id == $_current_term->term_id ) { $css_classes[] = 'current-cat'; $link = str_replace( 'term_id == $_current_term->parent ) { $css_classes[] = 'current-cat-parent'; } while ( $_current_term->parent ) { if ( $category->term_id == $_current_term->parent ) { $css_classes[] = 'current-cat-ancestor'; break; } $_current_term = get_term( $_current_term->parent, $category->taxonomy ); } } } $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) ); $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; $output .= $css_classes; $output .= ">$link\n"; } elseif ( isset( $args['separator'] ) ) { $output .= "\t$link" . $args['separator'] . "\n"; } else { $output .= "\t$link
            \n"; } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( 'list' !== $args['style'] ) { return; } $output .= "\n"; } } relation = 'OR'; } else { $this->relation = 'AND'; } if ( ! isset( $date_query[0] ) ) { $date_query = array( $date_query ); } if ( ! empty( $date_query['column'] ) ) { $date_query['column'] = esc_sql( $date_query['column'] ); } else { $date_query['column'] = esc_sql( $default_column ); } $this->column = $this->validate_column( $this->column ); $this->compare = $this->get_compare( $date_query ); $this->queries = $this->sanitize_query( $date_query ); } public function sanitize_query( $queries, $parent_query = null ) { $cleaned_query = array(); $defaults = array( 'column' => 'post_date', 'compare' => '=', 'relation' => 'AND', ); foreach ( $queries as $qkey => $qvalue ) { if ( is_numeric( $qkey ) && ! is_array( $qvalue ) ) { unset( $queries[ $qkey ] ); } } foreach ( $defaults as $dkey => $dvalue ) { if ( isset( $queries[ $dkey ] ) ) { continue; } if ( isset( $parent_query[ $dkey ] ) ) { $queries[ $dkey ] = $parent_query[ $dkey ]; } else { $queries[ $dkey ] = $dvalue; } } if ( $this->is_first_order_clause( $queries ) ) { $this->validate_date_values( $queries ); } foreach ( $queries as $key => $q ) { if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) { $cleaned_query[ $key ] = $q; } else { $cleaned_query[] = $this->sanitize_query( $q, $queries ); } } return $cleaned_query; } protected function is_first_order_clause( $query ) { $time_keys = array_intersect( $this->time_keys, array_keys( $query ) ); return ! empty( $time_keys ); } public function get_compare( $query ) { if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { return strtoupper( $query['compare'] ); } return $this->compare; } public function validate_date_values( $date_query = array() ) { if ( empty( $date_query ) ) { return false; } $valid = true; if ( array_key_exists( 'before', $date_query ) && is_array( $date_query['before'] ) ) { $valid = $this->validate_date_values( $date_query['before'] ); } if ( array_key_exists( 'after', $date_query ) && is_array( $date_query['after'] ) ) { $valid = $this->validate_date_values( $date_query['after'] ); } $min_max_checks = array(); if ( array_key_exists( 'year', $date_query ) ) { if ( is_array( $date_query['year'] ) ) { $_year = reset( $date_query['year'] ); } else { $_year = $date_query['year']; } $max_days_of_year = gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1; } else { $max_days_of_year = 366; } $min_max_checks['dayofyear'] = array( 'min' => 1, 'max' => $max_days_of_year, ); $min_max_checks['dayofweek'] = array( 'min' => 1, 'max' => 7, ); $min_max_checks['dayofweek_iso'] = array( 'min' => 1, 'max' => 7, ); $min_max_checks['month'] = array( 'min' => 1, 'max' => 12, ); if ( isset( $_year ) ) { $week_count = gmdate( 'W', mktime( 0, 0, 0, 12, 28, $_year ) ); } else { $week_count = 53; } $min_max_checks['week'] = array( 'min' => 1, 'max' => $week_count, ); $min_max_checks['day'] = array( 'min' => 1, 'max' => 31, ); $min_max_checks['hour'] = array( 'min' => 0, 'max' => 23, ); $min_max_checks['minute'] = array( 'min' => 0, 'max' => 59, ); $min_max_checks['second'] = array( 'min' => 0, 'max' => 59, ); foreach ( $min_max_checks as $key => $check ) { if ( ! array_key_exists( $key, $date_query ) ) { continue; } foreach ( (array) $date_query[ $key ] as $_value ) { $is_between = $_value >= $check['min'] && $_value <= $check['max']; if ( ! is_numeric( $_value ) || ! $is_between ) { $error = sprintf( __( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ), '' . esc_html( $_value ) . '', '' . esc_html( $key ) . '', '' . esc_html( $check['min'] ) . '', '' . esc_html( $check['max'] ) . '' ); _doing_it_wrong( __CLASS__, $error, '4.1.0' ); $valid = false; } } } if ( ! $valid ) { return $valid; } $day_month_year_error_msg = ''; $day_exists = array_key_exists( 'day', $date_query ) && is_numeric( $date_query['day'] ); $month_exists = array_key_exists( 'month', $date_query ) && is_numeric( $date_query['month'] ); $year_exists = array_key_exists( 'year', $date_query ) && is_numeric( $date_query['year'] ); if ( $day_exists && $month_exists && $year_exists ) { if ( ! wp_checkdate( $date_query['month'], $date_query['day'], $date_query['year'], sprintf( '%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day'] ) ) ) { $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.' ), '' . esc_html( $date_query['year'] ) . '', '' . esc_html( $date_query['month'] ) . '', '' . esc_html( $date_query['day'] ) . '' ); $valid = false; } } elseif ( $day_exists && $month_exists ) { if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) { $day_month_year_error_msg = sprintf( __( 'The following values do not describe a valid date: month %1$s, day %2$s.' ), '' . esc_html( $date_query['month'] ) . '', '' . esc_html( $date_query['day'] ) . '' ); $valid = false; } } if ( ! empty( $day_month_year_error_msg ) ) { _doing_it_wrong( __CLASS__, $day_month_year_error_msg, '4.1.0' ); } return $valid; } public function validate_column( $column ) { global $wpdb; $valid_columns = array( 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt', 'user_registered', 'registered', 'last_updated', ); if ( false === strpos( $column, '.' ) ) { if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ), true ) ) { $column = 'post_date'; } $known_columns = array( $wpdb->posts => array( 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt', ), $wpdb->comments => array( 'comment_date', 'comment_date_gmt', ), $wpdb->users => array( 'user_registered', ), $wpdb->blogs => array( 'registered', 'last_updated', ), ); foreach ( $known_columns as $table_name => $table_columns ) { if ( in_array( $column, $table_columns, true ) ) { $column = $table_name . '.' . $column; break; } } } return preg_replace( '/[^a-zA-Z0-9_$\.]/', '', $column ); } public function get_sql() { $sql = $this->get_sql_clauses(); $where = $sql['where']; return apply_filters( 'get_date_sql', $where, $this ); } protected function get_sql_clauses() { $sql = $this->get_sql_for_query( $this->queries ); if ( ! empty( $sql['where'] ) ) { $sql['where'] = ' AND ' . $sql['where']; } return $sql; } protected function get_sql_for_query( $query, $depth = 0 ) { $sql_chunks = array( 'join' => array(), 'where' => array(), ); $sql = array( 'join' => '', 'where' => '', ); $indent = ''; for ( $i = 0; $i < $depth; $i++ ) { $indent .= ' '; } foreach ( $query as $key => $clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; } elseif ( is_array( $clause ) ) { if ( $this->is_first_order_clause( $clause ) ) { $clause_sql = $this->get_sql_for_clause( $clause, $query ); $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; } $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); } else { $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); $sql_chunks['where'][] = $clause_sql['where']; $sql_chunks['join'][] = $clause_sql['join']; } } } $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); if ( empty( $relation ) ) { $relation = 'AND'; } if ( ! empty( $sql_chunks['join'] ) ) { $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); } if ( ! empty( $sql_chunks['where'] ) ) { $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; } return $sql; } protected function get_sql_for_subquery( $query ) { return $this->get_sql_for_clause( $query, '' ); } protected function get_sql_for_clause( $query, $parent_query ) { global $wpdb; $where_parts = array(); $column = ( ! empty( $query['column'] ) ) ? esc_sql( $query['column'] ) : $this->column; $column = $this->validate_column( $column ); $compare = $this->get_compare( $query ); $inclusive = ! empty( $query['inclusive'] ); $lt = '<'; $gt = '>'; if ( $inclusive ) { $lt .= '='; $gt .= '='; } if ( ! empty( $query['after'] ) ) { $where_parts[] = $wpdb->prepare( "$column $gt %s", $this->build_mysql_datetime( $query['after'], ! $inclusive ) ); } if ( ! empty( $query['before'] ) ) { $where_parts[] = $wpdb->prepare( "$column $lt %s", $this->build_mysql_datetime( $query['before'], $inclusive ) ); } $date_units = array( 'YEAR' => array( 'year' ), 'MONTH' => array( 'month', 'monthnum' ), '_wp_mysql_week' => array( 'week', 'w' ), 'DAYOFYEAR' => array( 'dayofyear' ), 'DAYOFMONTH' => array( 'day' ), 'DAYOFWEEK' => array( 'dayofweek' ), 'WEEKDAY' => array( 'dayofweek_iso' ), ); foreach ( $date_units as $sql_part => $query_parts ) { foreach ( $query_parts as $query_part ) { if ( isset( $query[ $query_part ] ) ) { $value = $this->build_value( $compare, $query[ $query_part ] ); if ( $value ) { switch ( $sql_part ) { case '_wp_mysql_week': $where_parts[] = _wp_mysql_week( $column ) . " $compare $value"; break; case 'WEEKDAY': $where_parts[] = "$sql_part( $column ) + 1 $compare $value"; break; default: $where_parts[] = "$sql_part( $column ) $compare $value"; } break; } } } } if ( isset( $query['hour'] ) || isset( $query['minute'] ) || isset( $query['second'] ) ) { foreach ( array( 'hour', 'minute', 'second' ) as $unit ) { if ( ! isset( $query[ $unit ] ) ) { $query[ $unit ] = null; } } $time_query = $this->build_time_query( $column, $compare, $query['hour'], $query['minute'], $query['second'] ); if ( $time_query ) { $where_parts[] = $time_query; } } return array( 'where' => $where_parts, 'join' => array(), ); } public function build_value( $compare, $value ) { if ( ! isset( $value ) ) { return false; } switch ( $compare ) { case 'IN': case 'NOT IN': $value = (array) $value; $value = array_filter( $value, 'is_numeric' ); if ( empty( $value ) ) { return false; } return '(' . implode( ',', array_map( 'intval', $value ) ) . ')'; case 'BETWEEN': case 'NOT BETWEEN': if ( ! is_array( $value ) || 2 !== count( $value ) ) { $value = array( $value, $value ); } else { $value = array_values( $value ); } foreach ( $value as $v ) { if ( ! is_numeric( $v ) ) { return false; } } $value = array_map( 'intval', $value ); return $value[0] . ' AND ' . $value[1]; default: if ( ! is_numeric( $value ) ) { return false; } return (int) $value; } } public function build_mysql_datetime( $datetime, $default_to_max = false ) { if ( ! is_array( $datetime ) ) { if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], 'day' => (int) $matches[3], ); } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { $datetime = array( 'year' => (int) $matches[1], 'month' => (int) $matches[2], 'day' => (int) $matches[3], 'hour' => (int) $matches[4], 'minute' => (int) $matches[5], ); } if ( ! is_array( $datetime ) ) { $wp_timezone = wp_timezone(); $dt = date_create( $datetime, $wp_timezone ); if ( false === $dt ) { return gmdate( 'Y-m-d H:i:s', false ); } return $dt->setTimezone( $wp_timezone )->format( 'Y-m-d H:i:s' ); } } $datetime = array_map( 'absint', $datetime ); if ( ! isset( $datetime['year'] ) ) { $datetime['year'] = current_time( 'Y' ); } if ( ! isset( $datetime['month'] ) ) { $datetime['month'] = ( $default_to_max ) ? 12 : 1; } if ( ! isset( $datetime['day'] ) ) { $datetime['day'] = ( $default_to_max ) ? (int) gmdate( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1; } if ( ! isset( $datetime['hour'] ) ) { $datetime['hour'] = ( $default_to_max ) ? 23 : 0; } if ( ! isset( $datetime['minute'] ) ) { $datetime['minute'] = ( $default_to_max ) ? 59 : 0; } if ( ! isset( $datetime['second'] ) ) { $datetime['second'] = ( $default_to_max ) ? 59 : 0; } return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second'] ); } public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) { global $wpdb; if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) ) { return false; } if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { $return = array(); $value = $this->build_value( $compare, $hour ); if ( false !== $value ) { $return[] = "HOUR( $column ) $compare $value"; } $value = $this->build_value( $compare, $minute ); if ( false !== $value ) { $return[] = "MINUTE( $column ) $compare $value"; } $value = $this->build_value( $compare, $second ); if ( false !== $value ) { $return[] = "SECOND( $column ) $compare $value"; } return implode( ' AND ', $return ); } if ( isset( $hour ) && ! isset( $minute ) && ! isset( $second ) ) { $value = $this->build_value( $compare, $hour ); if ( false !== $value ) { return "HOUR( $column ) $compare $value"; } } elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) ) { $value = $this->build_value( $compare, $minute ); if ( false !== $value ) { return "MINUTE( $column ) $compare $value"; } } elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) ) { $value = $this->build_value( $compare, $second ); if ( false !== $value ) { return "SECOND( $column ) $compare $value"; } } if ( ! isset( $minute ) ) { return false; } $format = ''; $time = ''; if ( null !== $hour ) { $format .= '%H.'; $time .= sprintf( '%02d', $hour ) . '.'; } else { $format .= '0.'; $time .= '0.'; } $format .= '%i'; $time .= sprintf( '%02d', $minute ); if ( isset( $second ) ) { $format .= '%s'; $time .= sprintf( '%02d', $second ); } return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); } } $value ) { $values[ $key ] = wp_cache_add( $key, $value, $group, $expire ); } return $values; } endif; if ( ! function_exists( 'wp_cache_set_multiple' ) ) : function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = wp_cache_set( $key, $value, $group, $expire ); } return $values; } endif; if ( ! function_exists( 'wp_cache_get_multiple' ) ) : function wp_cache_get_multiple( $keys, $group = '', $force = false ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = wp_cache_get( $key, $group, $force ); } return $values; } endif; if ( ! function_exists( 'wp_cache_delete_multiple' ) ) : function wp_cache_delete_multiple( array $keys, $group = '' ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = wp_cache_delete( $key, $group ); } return $values; } endif; if ( ! function_exists( 'wp_cache_flush_runtime' ) ) : function wp_cache_flush_runtime() { return wp_using_ext_object_cache() ? false : wp_cache_flush(); } endif; version_checked ) { $current = false; } if ( ! is_object( $current ) ) { $current = new stdClass; $current->updates = array(); $current->version_checked = $wp_version; } if ( ! empty( $extra_stats ) ) { $force_check = true; } $timeout = MINUTE_IN_SECONDS; $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( ! $force_check && $time_not_changed ) { return; } $locale = apply_filters( 'core_version_check_locale', get_locale() ); $current->last_checked = time(); set_site_transient( 'update_core', $current ); if ( method_exists( $wpdb, 'db_version' ) ) { $mysql_version = preg_replace( '/[^0-9.].*/', '', $wpdb->db_version() ); } else { $mysql_version = 'N/A'; } if ( is_multisite() ) { $num_blogs = get_blog_count(); $wp_install = network_site_url(); $multisite_enabled = 1; } else { $multisite_enabled = 0; $num_blogs = 1; $wp_install = home_url( '/' ); } $query = array( 'version' => $wp_version, 'php' => $php_version, 'locale' => $locale, 'mysql' => $mysql_version, 'local_package' => isset( $wp_local_package ) ? $wp_local_package : '', 'blogs' => $num_blogs, 'users' => get_user_count(), 'multisite_enabled' => $multisite_enabled, 'initial_db_version' => get_site_option( 'initial_db_version' ), ); $query = apply_filters( 'core_version_check_query_args', $query ); $post_body = array( 'translations' => wp_json_encode( $translations ), ); if ( is_array( $extra_stats ) ) { $post_body = array_merge( $post_body, $extra_stats ); } if ( defined( 'WP_AUTO_UPDATE_CORE' ) && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { $query['channel'] = WP_AUTO_UPDATE_CORE; } $url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, '', '&' ); $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $doing_cron = wp_doing_cron(); $options = array( 'timeout' => $doing_cron ? 30 : 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 'headers' => array( 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ), ), 'body' => $post_body, ); $response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { return; } $body = trim( wp_remote_retrieve_body( $response ) ); $body = json_decode( $body, true ); if ( ! is_array( $body ) || ! isset( $body['offers'] ) ) { return; } $offers = $body['offers']; foreach ( $offers as &$offer ) { foreach ( $offer as $offer_key => $value ) { if ( 'packages' === $offer_key ) { $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) ); } elseif ( 'download' === $offer_key ) { $offer['download'] = esc_url( $value ); } else { $offer[ $offer_key ] = esc_html( $value ); } } $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files', ), '' ) ); } $updates = new stdClass(); $updates->updates = $offers; $updates->last_checked = time(); $updates->version_checked = $wp_version; if ( isset( $body['translations'] ) ) { $updates->translations = $body['translations']; } set_site_transient( 'update_core', $updates ); if ( ! empty( $body['ttl'] ) ) { $ttl = (int) $body['ttl']; if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) { wp_schedule_single_event( time() + $ttl, 'wp_version_check' ); } } if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) { do_action( 'wp_maybe_auto_update' ); } } function wp_update_plugins( $extra_stats = array() ) { if ( wp_installing() ) { return; } require ABSPATH . WPINC . '/version.php'; if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); $translations = wp_get_installed_translations( 'plugins' ); $active = get_option( 'active_plugins', array() ); $current = get_site_transient( 'update_plugins' ); if ( ! is_object( $current ) ) { $current = new stdClass; } $updates = new stdClass; $updates->last_checked = time(); $updates->response = array(); $updates->translations = array(); $updates->no_update = array(); $doing_cron = wp_doing_cron(); switch ( current_filter() ) { case 'upgrader_process_complete': $timeout = 0; break; case 'load-update-core.php': $timeout = MINUTE_IN_SECONDS; break; case 'load-plugins.php': case 'load-update.php': $timeout = HOUR_IN_SECONDS; break; default: if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $plugin_changed = false; foreach ( $plugins as $file => $p ) { $updates->checked[ $file ] = $p['Version']; if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) { $plugin_changed = true; } } if ( isset( $current->response ) && is_array( $current->response ) ) { foreach ( $current->response as $plugin_file => $update_details ) { if ( ! isset( $plugins[ $plugin_file ] ) ) { $plugin_changed = true; break; } } } if ( ! $plugin_changed ) { return; } } $current->last_checked = time(); set_site_transient( 'update_plugins', $current ); $to_send = compact( 'plugins', 'active' ); $locales = array_values( get_available_languages() ); $locales = apply_filters( 'plugins_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { $timeout = 3 + (int) ( count( $plugins ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'plugins' => wp_json_encode( $to_send ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), 'all' => wp_json_encode( true ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = 'http://api.wordpress.org/plugins/update-check/1.1/'; $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) { return; } $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); if ( $response && is_array( $response ) ) { $updates->response = $response['plugins']; $updates->translations = $response['translations']; $updates->no_update = $response['no_update']; } foreach ( $plugins as $plugin_file => $plugin_data ) { if ( ! $plugin_data['UpdateURI'] || isset( $updates->response[ $plugin_file ] ) ) { continue; } $hostname = wp_parse_url( esc_url_raw( $plugin_data['UpdateURI'] ), PHP_URL_HOST ); $update = apply_filters( "update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales ); if ( ! $update ) { continue; } $update = (object) $update; if ( ! isset( $update->version ) ) { continue; } $update->id = $plugin_data['UpdateURI']; $update->plugin = $plugin_file; if ( ! isset( $update->new_version ) ) { $update->new_version = $update->version; } if ( ! empty( $update->translations ) ) { foreach ( $update->translations as $translation ) { if ( isset( $translation['language'], $translation['package'] ) ) { $translation['type'] = 'plugin'; $translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id; $updates->translations[] = $translation; } } } unset( $updates->no_update[ $plugin_file ], $updates->response[ $plugin_file ] ); if ( version_compare( $update->new_version, $plugin_data['Version'], '>' ) ) { $updates->response[ $plugin_file ] = $update; } else { $updates->no_update[ $plugin_file ] = $update; } } $sanitize_plugin_update_payload = static function( &$item ) { $item = (object) $item; unset( $item->translations, $item->compatibility ); return $item; }; array_walk( $updates->response, $sanitize_plugin_update_payload ); array_walk( $updates->no_update, $sanitize_plugin_update_payload ); set_site_transient( 'update_plugins', $updates ); } function wp_update_themes( $extra_stats = array() ) { if ( wp_installing() ) { return; } require ABSPATH . WPINC . '/version.php'; $installed_themes = wp_get_themes(); $translations = wp_get_installed_translations( 'themes' ); $last_update = get_site_transient( 'update_themes' ); if ( ! is_object( $last_update ) ) { $last_update = new stdClass; } $themes = array(); $checked = array(); $request = array(); $request['active'] = get_option( 'stylesheet' ); foreach ( $installed_themes as $theme ) { $checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' ); $themes[ $theme->get_stylesheet() ] = array( 'Name' => $theme->get( 'Name' ), 'Title' => $theme->get( 'Name' ), 'Version' => $theme->get( 'Version' ), 'Author' => $theme->get( 'Author' ), 'Author URI' => $theme->get( 'AuthorURI' ), 'Template' => $theme->get_template(), 'Stylesheet' => $theme->get_stylesheet(), ); } $doing_cron = wp_doing_cron(); switch ( current_filter() ) { case 'upgrader_process_complete': $timeout = 0; break; case 'load-update-core.php': $timeout = MINUTE_IN_SECONDS; break; case 'load-themes.php': case 'load-update.php': $timeout = HOUR_IN_SECONDS; break; default: if ( $doing_cron ) { $timeout = 2 * HOUR_IN_SECONDS; } else { $timeout = 12 * HOUR_IN_SECONDS; } } $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked ); if ( $time_not_changed && ! $extra_stats ) { $theme_changed = false; foreach ( $checked as $slug => $v ) { if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) { $theme_changed = true; } } if ( isset( $last_update->response ) && is_array( $last_update->response ) ) { foreach ( $last_update->response as $slug => $update_details ) { if ( ! isset( $checked[ $slug ] ) ) { $theme_changed = true; break; } } } if ( ! $theme_changed ) { return; } } $last_update->last_checked = time(); set_site_transient( 'update_themes', $last_update ); $request['themes'] = $themes; $locales = array_values( get_available_languages() ); $locales = apply_filters( 'themes_update_check_locales', $locales ); $locales = array_unique( $locales ); if ( $doing_cron ) { $timeout = 30; } else { $timeout = 3 + (int) ( count( $themes ) / 10 ); } $options = array( 'timeout' => $timeout, 'body' => array( 'themes' => wp_json_encode( $request ), 'translations' => wp_json_encode( $translations ), 'locale' => wp_json_encode( $locales ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), ); if ( $extra_stats ) { $options['body']['update_stats'] = wp_json_encode( $extra_stats ); } $url = 'http://api.wordpress.org/themes/update-check/1.1/'; $http_url = $url; $ssl = wp_http_supports( array( 'ssl' ) ); if ( $ssl ) { $url = set_url_scheme( $url, 'https' ); } $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { trigger_error( sprintf( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); $raw_response = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) { return; } $new_update = new stdClass; $new_update->last_checked = time(); $new_update->checked = $checked; $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); if ( is_array( $response ) ) { $new_update->response = $response['themes']; $new_update->no_update = $response['no_update']; $new_update->translations = $response['translations']; } set_site_transient( 'update_themes', $new_update ); } function wp_maybe_auto_update() { include_once ABSPATH . 'wp-admin/includes/admin.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $upgrader = new WP_Automatic_Updater; $upgrader->run(); } function wp_get_translation_updates() { $updates = array(); $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme', ); foreach ( $transients as $transient => $type ) { $transient = get_site_transient( $transient ); if ( empty( $transient->translations ) ) { continue; } foreach ( $transient->translations as $translation ) { $updates[] = (object) $translation; } } return $updates; } function wp_get_update_data() { $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0, ); $plugins = current_user_can( 'update_plugins' ); if ( $plugins ) { $update_plugins = get_site_transient( 'update_plugins' ); if ( ! empty( $update_plugins->response ) ) { $counts['plugins'] = count( $update_plugins->response ); } } $themes = current_user_can( 'update_themes' ); if ( $themes ) { $update_themes = get_site_transient( 'update_themes' ); if ( ! empty( $update_themes->response ) ) { $counts['themes'] = count( $update_themes->response ); } } $core = current_user_can( 'update_core' ); if ( $core && function_exists( 'get_core_updates' ) ) { $update_wordpress = get_core_updates( array( 'dismissed' => false ) ); if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ), true ) && current_user_can( 'update_core' ) ) { $counts['wordpress'] = 1; } } if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) { $counts['translations'] = 1; } $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations']; $titles = array(); if ( $counts['wordpress'] ) { $titles['wordpress'] = sprintf( __( '%d WordPress Update' ), $counts['wordpress'] ); } if ( $counts['plugins'] ) { $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] ); } if ( $counts['themes'] ) { $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); } if ( $counts['translations'] ) { $titles['translations'] = __( 'Translation Updates' ); } $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : ''; $update_data = array( 'counts' => $counts, 'title' => $update_title, ); return apply_filters( 'wp_get_update_data', $update_data, $titles ); } function _maybe_update_core() { require ABSPATH . WPINC . '/version.php'; $current = get_site_transient( 'update_core' ); if ( isset( $current->last_checked, $current->version_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) && $current->version_checked === $wp_version ) { return; } wp_version_check(); } function _maybe_update_plugins() { $current = get_site_transient( 'update_plugins' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) { return; } wp_update_plugins(); } function _maybe_update_themes() { $current = get_site_transient( 'update_themes' ); if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) { return; } wp_update_themes(); } function wp_schedule_update_checks() { if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_version_check' ); } if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_plugins' ); } if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_themes' ); } } function wp_clean_update_cache() { if ( function_exists( 'wp_clean_plugins_cache' ) ) { wp_clean_plugins_cache(); } else { delete_site_transient( 'update_plugins' ); } wp_clean_themes_cache(); delete_site_transient( 'update_core' ); } if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) { return; } add_action( 'admin_init', '_maybe_update_core' ); add_action( 'wp_version_check', 'wp_version_check' ); add_action( 'load-plugins.php', 'wp_update_plugins' ); add_action( 'load-update.php', 'wp_update_plugins' ); add_action( 'load-update-core.php', 'wp_update_plugins' ); add_action( 'admin_init', '_maybe_update_plugins' ); add_action( 'wp_update_plugins', 'wp_update_plugins' ); add_action( 'load-themes.php', 'wp_update_themes' ); add_action( 'load-update.php', 'wp_update_themes' ); add_action( 'load-update-core.php', 'wp_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' ); add_action( 'update_option_WPLANG', 'wp_clean_update_cache', 10, 0 ); add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' ); add_action( 'init', 'wp_schedule_update_checks' ); '', 'REQUEST_URI' => '', ); $_SERVER = array_merge( $default_server_values, $_SERVER ); if ( empty( $_SERVER['REQUEST_URI'] ) || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } else { if ( ! isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) ) { $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; } if ( isset( $_SERVER['PATH_INFO'] ) ) { if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) { $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; } else { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; } } if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } } if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) { $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; } if ( isset( $_SERVER['SCRIPT_NAME'] ) && ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) ) { unset( $_SERVER['PATH_INFO'] ); } $PHP_SELF = $_SERVER['PHP_SELF']; if ( empty( $PHP_SELF ) ) { $_SERVER['PHP_SELF'] = preg_replace( '/(\?.*)?$/', '', $_SERVER['REQUEST_URI'] ); $PHP_SELF = $_SERVER['PHP_SELF']; } wp_populate_basic_auth_from_authorization_header(); } function wp_populate_basic_auth_from_authorization_header() { if ( ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) && ! isset( $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] ) ) { return; } if ( isset( $_SERVER['PHP_AUTH_USER'] ) || isset( $_SERVER['PHP_AUTH_PW'] ) ) { return; } $header = isset( $_SERVER['HTTP_AUTHORIZATION'] ) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; if ( ! preg_match( '%^Basic [a-z\d/+]*={0,2}$%i', $header ) ) { return; } $token = substr( $header, 6 ); $userpass = base64_decode( $token ); list( $user, $pass ) = explode( ':', $userpass ); $_SERVER['PHP_AUTH_USER'] = $user; $_SERVER['PHP_AUTH_PW'] = $pass; } function wp_check_php_mysql_versions() { global $required_php_version, $wp_version; $php_version = phpversion(); if ( version_compare( $required_php_version, $php_version, '>' ) ) { $protocol = wp_get_server_protocol(); header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); header( 'Content-Type: text/html; charset=utf-8' ); printf( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version ); exit( 1 ); } if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) || ! file_exists( ABSPATH . 'wp-content/db.php' ) ) ) { require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early(); $args = array( 'exit' => false, 'code' => 'mysql_not_found', ); wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ), __( 'Requirements Not Met' ), $args ); exit( 1 ); } } function wp_get_environment_type() { static $current_env = ''; if ( ! defined( 'WP_RUN_CORE_TESTS' ) && $current_env ) { return $current_env; } $wp_environments = array( 'local', 'development', 'staging', 'production', ); if ( defined( 'WP_ENVIRONMENT_TYPES' ) && function_exists( '_deprecated_argument' ) ) { if ( function_exists( '__' ) ) { $message = sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' ); } else { $message = sprintf( 'The %s constant is no longer supported.', 'WP_ENVIRONMENT_TYPES' ); } _deprecated_argument( 'define()', '5.5.1', $message ); } if ( function_exists( 'getenv' ) ) { $has_env = getenv( 'WP_ENVIRONMENT_TYPE' ); if ( false !== $has_env ) { $current_env = $has_env; } } if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) { $current_env = WP_ENVIRONMENT_TYPE; } if ( ! in_array( $current_env, $wp_environments, true ) ) { $current_env = 'production'; } return $current_env; } function wp_favicon_request() { if ( '/favicon.ico' === $_SERVER['REQUEST_URI'] ) { header( 'Content-Type: image/vnd.microsoft.icon' ); exit; } } function wp_maintenance() { if ( ! wp_is_maintenance_mode() ) { return; } if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { require_once WP_CONTENT_DIR . '/maintenance.php'; die(); } require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early(); header( 'Retry-After: 600' ); wp_die( __( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ), __( 'Maintenance' ), 503 ); } function wp_is_maintenance_mode() { global $upgrading; if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) { return false; } require ABSPATH . '.maintenance'; if ( ( time() - $upgrading ) >= 10 * MINUTE_IN_SECONDS ) { return false; } if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) { return false; } return true; } function timer_float() { return microtime( true ) - $_SERVER['REQUEST_TIME_FLOAT']; } function timer_start() { global $timestart; $timestart = microtime( true ); return true; } function timer_stop( $display = 0, $precision = 3 ) { global $timestart, $timeend; $timeend = microtime( true ); $timetotal = $timeend - $timestart; $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); if ( $display ) { echo $r; } return $r; } function wp_debug_mode() { if ( ! apply_filters( 'enable_wp_debug_mode_checks', true ) ) { return; } if ( WP_DEBUG ) { error_reporting( E_ALL ); if ( WP_DEBUG_DISPLAY ) { ini_set( 'display_errors', 1 ); } elseif ( null !== WP_DEBUG_DISPLAY ) { ini_set( 'display_errors', 0 ); } if ( in_array( strtolower( (string) WP_DEBUG_LOG ), array( 'true', '1' ), true ) ) { $log_path = WP_CONTENT_DIR . '/debug.log'; } elseif ( is_string( WP_DEBUG_LOG ) ) { $log_path = WP_DEBUG_LOG; } else { $log_path = false; } if ( $log_path ) { ini_set( 'log_errors', 1 ); ini_set( 'error_log', $log_path ); } } else { error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); } if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() || wp_is_json_request() ) { ini_set( 'display_errors', 0 ); } } function wp_set_lang_dir() { if ( ! defined( 'WP_LANG_DIR' ) ) { if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || ! @is_dir( ABSPATH . WPINC . '/languages' ) ) { define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); if ( ! defined( 'LANGDIR' ) ) { define( 'LANGDIR', 'wp-content/languages' ); } } else { define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); if ( ! defined( 'LANGDIR' ) ) { define( 'LANGDIR', WPINC . '/languages' ); } } } } function require_wp_db() { global $wpdb; require_once ABSPATH . WPINC . '/wp-db.php'; if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) { require_once WP_CONTENT_DIR . '/db.php'; } if ( isset( $wpdb ) ) { return; } $dbuser = defined( 'DB_USER' ) ? DB_USER : ''; $dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : ''; $dbname = defined( 'DB_NAME' ) ? DB_NAME : ''; $dbhost = defined( 'DB_HOST' ) ? DB_HOST : ''; $wpdb = new wpdb( $dbuser, $dbpassword, $dbname, $dbhost ); } function wp_set_wpdb_vars() { global $wpdb, $table_prefix; if ( ! empty( $wpdb->error ) ) { dead_db(); } $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 'parent' => '%d', 'count' => '%d', 'object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', ); $prefix = $wpdb->set_prefix( $table_prefix ); if ( is_wp_error( $prefix ) ) { wp_load_translations_early(); wp_die( sprintf( __( 'Error: %1$s in %2$s can only contain numbers, letters, and underscores.' ), '$table_prefix', 'wp-config.php' ) ); } } function wp_using_ext_object_cache( $using = null ) { global $_wp_using_ext_object_cache; $current_using = $_wp_using_ext_object_cache; if ( null !== $using ) { $_wp_using_ext_object_cache = $using; } return $current_using; } function wp_start_object_cache() { global $wp_filter; static $first_init = true; if ( $first_init && apply_filters( 'enable_loading_object_cache_dropin', true ) ) { if ( ! function_exists( 'wp_cache_init' ) ) { if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { require_once WP_CONTENT_DIR . '/object-cache.php'; if ( function_exists( 'wp_cache_init' ) ) { wp_using_ext_object_cache( true ); } if ( $wp_filter ) { $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter ); } } } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { wp_using_ext_object_cache( true ); } } if ( ! wp_using_ext_object_cache() ) { require_once ABSPATH . WPINC . '/cache.php'; } require_once ABSPATH . WPINC . '/cache-compat.php'; if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( get_current_blog_id() ); } elseif ( function_exists( 'wp_cache_init' ) ) { wp_cache_init(); } if ( function_exists( 'wp_cache_add_global_groups' ) ) { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta' ) ); wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } $first_init = false; } function wp_not_installed() { if ( is_multisite() ) { if ( ! is_blog_installed() && ! wp_installing() ) { nocache_headers(); wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); } } elseif ( ! is_blog_installed() && ! wp_installing() ) { nocache_headers(); require ABSPATH . WPINC . '/kses.php'; require ABSPATH . WPINC . '/pluggable.php'; $link = wp_guess_url() . '/wp-admin/install.php'; wp_redirect( $link ); die(); } } function wp_get_mu_plugins() { $mu_plugins = array(); if ( ! is_dir( WPMU_PLUGIN_DIR ) ) { return $mu_plugins; } $dh = opendir( WPMU_PLUGIN_DIR ); if ( ! $dh ) { return $mu_plugins; } while ( ( $plugin = readdir( $dh ) ) !== false ) { if ( '.php' === substr( $plugin, -4 ) ) { $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; } } closedir( $dh ); sort( $mu_plugins ); return $mu_plugins; } function wp_get_active_and_valid_plugins() { $plugins = array(); $active_plugins = (array) get_option( 'active_plugins', array() ); if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { _deprecated_file( 'my-hacks.php', '1.5.0' ); array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); } if ( empty( $active_plugins ) || wp_installing() ) { return $plugins; } $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; foreach ( $active_plugins as $plugin ) { if ( ! validate_file( $plugin ) && '.php' === substr( $plugin, -4 ) && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins, true ) ) ) { $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } } if ( wp_is_recovery_mode() ) { $plugins = wp_skip_paused_plugins( $plugins ); } return $plugins; } function wp_skip_paused_plugins( array $plugins ) { $paused_plugins = wp_paused_plugins()->get_all(); if ( empty( $paused_plugins ) ) { return $plugins; } foreach ( $plugins as $index => $plugin ) { list( $plugin ) = explode( '/', plugin_basename( $plugin ) ); if ( array_key_exists( $plugin, $paused_plugins ) ) { unset( $plugins[ $index ] ); $GLOBALS['_paused_plugins'][ $plugin ] = $paused_plugins[ $plugin ]; } } return $plugins; } function wp_get_active_and_valid_themes() { global $pagenow; $themes = array(); if ( wp_installing() && 'wp-activate.php' !== $pagenow ) { return $themes; } if ( TEMPLATEPATH !== STYLESHEETPATH ) { $themes[] = STYLESHEETPATH; } $themes[] = TEMPLATEPATH; if ( wp_is_recovery_mode() ) { $themes = wp_skip_paused_themes( $themes ); if ( empty( $themes ) ) { add_filter( 'wp_using_themes', '__return_false' ); } } return $themes; } function wp_skip_paused_themes( array $themes ) { $paused_themes = wp_paused_themes()->get_all(); if ( empty( $paused_themes ) ) { return $themes; } foreach ( $themes as $index => $theme ) { $theme = basename( $theme ); if ( array_key_exists( $theme, $paused_themes ) ) { unset( $themes[ $index ] ); $GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ]; } } return $themes; } function wp_is_recovery_mode() { return wp_recovery_mode()->is_active(); } function is_protected_endpoint() { if ( isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { return true; } if ( is_admin() && ! wp_doing_ajax() ) { return true; } if ( is_protected_ajax_action() ) { return true; } return (bool) apply_filters( 'is_protected_endpoint', false ); } function is_protected_ajax_action() { if ( ! wp_doing_ajax() ) { return false; } if ( ! isset( $_REQUEST['action'] ) ) { return false; } $actions_to_protect = array( 'edit-theme-plugin-file', 'heartbeat', 'install-plugin', 'install-theme', 'search-plugins', 'search-install-plugins', 'update-plugin', 'update-theme', ); $actions_to_protect = (array) apply_filters( 'wp_protected_ajax_actions', $actions_to_protect ); if ( ! in_array( $_REQUEST['action'], $actions_to_protect, true ) ) { return false; } return true; } function wp_set_internal_encoding() { if ( function_exists( 'mb_internal_encoding' ) ) { $charset = get_option( 'blog_charset' ); if ( ! $charset || ! @mb_internal_encoding( $charset ) ) { mb_internal_encoding( 'UTF-8' ); } } } function wp_magic_quotes() { $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER ); $_REQUEST = array_merge( $_GET, $_POST ); } function shutdown_action_hook() { do_action( 'shutdown' ); wp_cache_close(); } function wp_clone( $object ) { return clone( $object ); } function is_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin(); } elseif ( defined( 'WP_ADMIN' ) ) { return WP_ADMIN; } return false; } function is_blog_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'site' ); } elseif ( defined( 'WP_BLOG_ADMIN' ) ) { return WP_BLOG_ADMIN; } return false; } function is_network_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'network' ); } elseif ( defined( 'WP_NETWORK_ADMIN' ) ) { return WP_NETWORK_ADMIN; } return false; } function is_user_admin() { if ( isset( $GLOBALS['current_screen'] ) ) { return $GLOBALS['current_screen']->in_admin( 'user' ); } elseif ( defined( 'WP_USER_ADMIN' ) ) { return WP_USER_ADMIN; } return false; } function is_multisite() { if ( defined( 'MULTISITE' ) ) { return MULTISITE; } if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) { return true; } return false; } function get_current_blog_id() { global $blog_id; return absint( $blog_id ); } function get_current_network_id() { if ( ! is_multisite() ) { return 1; } $current_network = get_network(); if ( ! isset( $current_network->id ) ) { return get_main_network_id(); } return absint( $current_network->id ); } function wp_load_translations_early() { global $wp_locale; static $loaded = false; if ( $loaded ) { return; } $loaded = true; if ( function_exists( 'did_action' ) && did_action( 'init' ) ) { return; } require ABSPATH . WPINC . '/version.php'; require_once ABSPATH . WPINC . '/pomo/mo.php'; require_once ABSPATH . WPINC . '/l10n.php'; require_once ABSPATH . WPINC . '/class-wp-locale.php'; require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php'; require_once ABSPATH . WPINC . '/plugin.php'; $locales = array(); $locations = array(); while ( true ) { if ( defined( 'WPLANG' ) ) { if ( '' === WPLANG ) { break; } $locales[] = WPLANG; } if ( isset( $wp_local_package ) ) { $locales[] = $wp_local_package; } if ( ! $locales ) { break; } if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) ) { $locations[] = WP_LANG_DIR; } if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) { $locations[] = WP_CONTENT_DIR . '/languages'; } if ( @is_dir( ABSPATH . 'wp-content/languages' ) ) { $locations[] = ABSPATH . 'wp-content/languages'; } if ( @is_dir( ABSPATH . WPINC . '/languages' ) ) { $locations[] = ABSPATH . WPINC . '/languages'; } if ( ! $locations ) { break; } $locations = array_unique( $locations ); foreach ( $locales as $locale ) { foreach ( $locations as $location ) { if ( file_exists( $location . '/' . $locale . '.mo' ) ) { load_textdomain( 'default', $location . '/' . $locale . '.mo' ); if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) { load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' ); } break 2; } } } break; } $wp_locale = new WP_Locale(); } function wp_installing( $is_installing = null ) { static $installing = null; if ( is_null( $installing ) ) { $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING; } if ( ! is_null( $is_installing ) ) { $old_installing = $installing; $installing = $is_installing; return (bool) $old_installing; } return (bool) $installing; } function is_ssl() { if ( isset( $_SERVER['HTTPS'] ) ) { if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) { return true; } if ( '1' == $_SERVER['HTTPS'] ) { return true; } } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { return true; } return false; } function wp_convert_hr_to_bytes( $value ) { $value = strtolower( trim( $value ) ); $bytes = (int) $value; if ( false !== strpos( $value, 'g' ) ) { $bytes *= GB_IN_BYTES; } elseif ( false !== strpos( $value, 'm' ) ) { $bytes *= MB_IN_BYTES; } elseif ( false !== strpos( $value, 'k' ) ) { $bytes *= KB_IN_BYTES; } return min( $bytes, PHP_INT_MAX ); } function wp_is_ini_value_changeable( $setting ) { static $ini_all; if ( ! isset( $ini_all ) ) { $ini_all = false; if ( function_exists( 'ini_get_all' ) ) { $ini_all = ini_get_all(); } } if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) { return true; } if ( ! is_array( $ini_all ) ) { return true; } return false; } function wp_doing_ajax() { return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ); } function wp_using_themes() { return apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ); } function wp_doing_cron() { return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON ); } function is_wp_error( $thing ) { $is_wp_error = ( $thing instanceof WP_Error ); if ( $is_wp_error ) { do_action( 'is_wp_error_instance', $thing ); } return $is_wp_error; } function wp_is_file_mod_allowed( $context ) { return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context ); } function wp_start_scraping_edited_file_errors() { if ( ! isset( $_REQUEST['wp_scrape_key'] ) || ! isset( $_REQUEST['wp_scrape_nonce'] ) ) { return; } $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) { echo "###### wp_scraping_result_start:$key ######"; echo wp_json_encode( array( 'code' => 'scrape_nonce_failure', 'message' => __( 'Scrape key check failed. Please try again.' ), ) ); echo "###### wp_scraping_result_end:$key ######"; die(); } if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); } function wp_finalize_scraping_edited_file_errors( $scrape_key ) { $error = error_get_last(); echo "\n###### wp_scraping_result_start:$scrape_key ######\n"; if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) { $error = str_replace( ABSPATH, '', $error ); echo wp_json_encode( $error ); } else { echo wp_json_encode( true ); } echo "\n###### wp_scraping_result_end:$scrape_key ######\n"; } function wp_is_json_request() { if ( isset( $_SERVER['HTTP_ACCEPT'] ) && wp_is_json_media_type( $_SERVER['HTTP_ACCEPT'] ) ) { return true; } if ( isset( $_SERVER['CONTENT_TYPE'] ) && wp_is_json_media_type( $_SERVER['CONTENT_TYPE'] ) ) { return true; } return false; } function wp_is_jsonp_request() { if ( ! isset( $_GET['_jsonp'] ) ) { return false; } if ( ! function_exists( 'wp_check_jsonp_callback' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } $jsonp_callback = $_GET['_jsonp']; if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) { return false; } $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true ); return $jsonp_enabled; } function wp_is_json_media_type( $media_type ) { static $cache = array(); if ( ! isset( $cache[ $media_type ] ) ) { $cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type ); } return $cache[ $media_type ]; } function wp_is_xml_request() { $accepted = array( 'text/xml', 'application/rss+xml', 'application/atom+xml', 'application/rdf+xml', 'text/xml+oembed', 'application/xml+oembed', ); if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) { foreach ( $accepted as $type ) { if ( false !== strpos( $_SERVER['HTTP_ACCEPT'], $type ) ) { return true; } } } if ( isset( $_SERVER['CONTENT_TYPE'] ) && in_array( $_SERVER['CONTENT_TYPE'], $accepted, true ) ) { return true; } return false; } function wp_is_site_protected_by_basic_auth( $context = '' ) { global $pagenow; if ( ! $context ) { if ( 'wp-login.php' === $pagenow ) { $context = 'login'; } elseif ( is_admin() ) { $context = 'admin'; } else { $context = 'front'; } } $is_protected = ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW'] ); return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context ); } generate_cookie(); $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); $expire = time() + $length; setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); if ( COOKIEPATH !== SITECOOKIEPATH ) { setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); } } public function clear_cookie() { setcookie( RECOVERY_MODE_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( RECOVERY_MODE_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); } public function validate_cookie( $cookie = '' ) { if ( ! $cookie ) { if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) { return new WP_Error( 'no_cookie', __( 'No cookie present.' ) ); } $cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ]; } $parts = $this->parse_cookie( $cookie ); if ( is_wp_error( $parts ) ) { return $parts; } list( , $created_at, $random, $signature ) = $parts; if ( ! ctype_digit( $created_at ) ) { return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) ); } $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); if ( time() > $created_at + $length ) { return new WP_Error( 'expired', __( 'Cookie expired.' ) ); } $to_sign = sprintf( 'recovery_mode|%s|%s', $created_at, $random ); $hashed = $this->recovery_mode_hash( $to_sign ); if ( ! hash_equals( $signature, $hashed ) ) { return new WP_Error( 'signature_mismatch', __( 'Invalid cookie.' ) ); } return true; } public function get_session_id_from_cookie( $cookie = '' ) { if ( ! $cookie ) { if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) { return new WP_Error( 'no_cookie', __( 'No cookie present.' ) ); } $cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ]; } $parts = $this->parse_cookie( $cookie ); if ( is_wp_error( $parts ) ) { return $parts; } list( , , $random ) = $parts; return sha1( $random ); } private function parse_cookie( $cookie ) { $cookie = base64_decode( $cookie ); $parts = explode( '|', $cookie ); if ( 4 !== count( $parts ) ) { return new WP_Error( 'invalid_format', __( 'Invalid cookie format.' ) ); } return $parts; } private function generate_cookie() { $to_sign = sprintf( 'recovery_mode|%s|%s', time(), wp_generate_password( 20, false ) ); $signed = $this->recovery_mode_hash( $to_sign ); return base64_encode( sprintf( '%s|%s', $to_sign, $signed ) ); } private function recovery_mode_hash( $data ) { if ( ! defined( 'AUTH_KEY' ) || AUTH_KEY === 'put your unique phrase here' ) { $auth_key = get_site_option( 'recovery_mode_auth_key' ); if ( ! $auth_key ) { if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $auth_key = wp_generate_password( 64, true, true ); update_site_option( 'recovery_mode_auth_key', $auth_key ); } } else { $auth_key = AUTH_KEY; } if ( ! defined( 'AUTH_SALT' ) || AUTH_SALT === 'put your unique phrase here' || AUTH_SALT === $auth_key ) { $auth_salt = get_site_option( 'recovery_mode_auth_salt' ); if ( ! $auth_salt ) { if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $auth_salt = wp_generate_password( 64, true, true ); update_site_option( 'recovery_mode_auth_salt', $auth_salt ); } } else { $auth_salt = AUTH_SALT; } $secret = $auth_key . $auth_salt; return hash_hmac( 'sha1', $data, $secret ); } } ! has_blocks(), 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, '_content_editor_dfw' => false, 'tinymce' => true, 'quicktags' => true, ) ); self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() ); if ( self::$this_tinymce ) { if ( false !== strpos( $editor_id, '[' ) ) { self::$this_tinymce = false; _deprecated_argument( 'wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.' ); } } self::$this_quicktags = (bool) $set['quicktags']; if ( self::$this_tinymce ) { self::$has_tinymce = true; } if ( self::$this_quicktags ) { self::$has_quicktags = true; } if ( empty( $set['editor_height'] ) ) { return $set; } if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) { $cookie = (int) get_user_setting( 'ed_size' ); if ( $cookie ) { $set['editor_height'] = $cookie; } } if ( $set['editor_height'] < 50 ) { $set['editor_height'] = 50; } elseif ( $set['editor_height'] > 5000 ) { $set['editor_height'] = 5000; } return $set; } public static function editor( $content, $editor_id, $settings = array() ) { $set = self::parse_settings( $editor_id, $settings ); $editor_class = ' class="' . trim( esc_attr( $set['editor_class'] ) . ' wp-editor-area' ) . '"'; $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; $default_editor = 'html'; $buttons = ''; $autocomplete = ''; $editor_id_attr = esc_attr( $editor_id ); if ( $set['drag_drop_upload'] ) { self::$drag_drop_upload = true; } if ( ! empty( $set['editor_height'] ) ) { $height = ' style="height: ' . (int) $set['editor_height'] . 'px"'; } else { $height = ' rows="' . (int) $set['textarea_rows'] . '"'; } if ( ! current_user_can( 'upload_files' ) ) { $set['media_buttons'] = false; } if ( self::$this_tinymce ) { $autocomplete = ' autocomplete="off"'; if ( self::$this_quicktags ) { $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor(); if ( 'html' !== $default_editor ) { $default_editor = 'tinymce'; } $buttons .= '\n"; $buttons .= '\n"; } else { $default_editor = 'tinymce'; } } $switch_class = 'html' === $default_editor ? 'html-active' : 'tmce-active'; $wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class; if ( $set['_content_editor_dfw'] ) { $wrap_class .= ' has-dfw'; } echo '
            '; if ( self::$editor_buttons_css ) { wp_print_styles( 'editor-buttons' ); self::$editor_buttons_css = false; } if ( ! empty( $set['editor_css'] ) ) { echo $set['editor_css'] . "\n"; } if ( ! empty( $buttons ) || $set['media_buttons'] ) { echo '
            '; if ( $set['media_buttons'] ) { self::$has_medialib = true; if ( ! function_exists( 'media_buttons' ) ) { require ABSPATH . 'wp-admin/includes/media.php'; } echo '
            '; do_action( 'media_buttons', $editor_id ); echo "
            \n"; } echo '
            ' . $buttons . "
            \n"; echo "
            \n"; } $quicktags_toolbar = ''; if ( self::$this_quicktags ) { if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && 'post' === $GLOBALS['current_screen']->base ) { $toolbar_id = 'ed_toolbar'; } else { $toolbar_id = 'qt_' . $editor_id_attr . '_toolbar'; } $quicktags_toolbar = '
            '; } $the_editor = apply_filters( 'the_editor', '
            ' . $quicktags_toolbar . '%s
            ' ); if ( self::$this_tinymce ) { add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); } $content = apply_filters( 'the_editor_content', $content, $default_editor ); if ( self::$this_tinymce ) { remove_filter( 'the_editor_content', 'format_for_editor' ); } if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) { $content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' ); } elseif ( 'tinymce' === $default_editor && has_filter( 'richedit_pre' ) ) { $content = apply_filters_deprecated( 'richedit_pre', array( $content ), '4.3.0', 'format_for_editor' ); } if ( false !== stripos( $content, 'textarea' ) ) { $content = preg_replace( '%\n\n"; self::editor_settings( $editor_id, $set ); } public static function editor_settings( $editor_id, $set ) { if ( empty( self::$first_init ) ) { if ( is_admin() ) { add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); } else { add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); } } if ( self::$this_quicktags ) { $qtInit = array( 'id' => $editor_id, 'buttons' => '', ); if ( is_array( $set['quicktags'] ) ) { $qtInit = array_merge( $qtInit, $set['quicktags'] ); } if ( empty( $qtInit['buttons'] ) ) { $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close'; } if ( $set['_content_editor_dfw'] ) { $qtInit['buttons'] .= ',dfw'; } $qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id ); self::$qt_settings[ $editor_id ] = $qtInit; self::$qt_buttons = array_merge( self::$qt_buttons, explode( ',', $qtInit['buttons'] ) ); } if ( self::$this_tinymce ) { if ( empty( self::$first_init ) ) { $baseurl = self::get_baseurl(); $mce_locale = self::get_mce_locale(); $ext_plugins = ''; if ( $set['teeny'] ) { $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink', ), $editor_id ); } else { $mce_external_plugins = apply_filters( 'mce_external_plugins', array(), $editor_id ); $plugins = array( 'charmap', 'colorpicker', 'hr', 'lists', 'media', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wpdialogs', 'wptextpattern', 'wpview', ); if ( ! self::$has_medialib ) { $plugins[] = 'image'; } $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins, $editor_id ) ); $key = array_search( 'spellchecker', $plugins, true ); if ( false !== $key ) { unset( $plugins[ $key ] ); } if ( ! empty( $mce_external_plugins ) ) { $mce_external_languages = apply_filters( 'mce_external_languages', array(), $editor_id ); $loaded_langs = array(); $strings = ''; if ( ! empty( $mce_external_languages ) ) { foreach ( $mce_external_languages as $name => $path ) { if ( @is_file( $path ) && @is_readable( $path ) ) { include_once $path; $ext_plugins .= $strings . "\n"; $loaded_langs[] = $name; } } } foreach ( $mce_external_plugins as $name => $url ) { if ( in_array( $name, $plugins, true ) ) { unset( $mce_external_plugins[ $name ] ); continue; } $url = set_url_scheme( $url ); $mce_external_plugins[ $name ] = $url; $plugurl = dirname( $url ); $strings = ''; if ( ! in_array( $name, $loaded_langs, true ) ) { $path = str_replace( content_url(), '', $plugurl ); $path = WP_CONTENT_DIR . $path . '/langs/'; $path = trailingslashit( realpath( $path ) ); if ( @is_file( $path . $mce_locale . '.js' ) ) { $strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n"; } if ( @is_file( $path . $mce_locale . '_dlg.js' ) ) { $strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n"; } if ( 'en' !== $mce_locale && empty( $strings ) ) { if ( @is_file( $path . 'en.js' ) ) { $str1 = @file_get_contents( $path . 'en.js' ); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n"; } if ( @is_file( $path . 'en_dlg.js' ) ) { $str2 = @file_get_contents( $path . 'en_dlg.js' ); $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n"; } } if ( ! empty( $strings ) ) { $ext_plugins .= "\n" . $strings . "\n"; } } $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; } } } self::$plugins = $plugins; self::$ext_plugins = $ext_plugins; $settings = self::default_settings(); $settings['plugins'] = implode( ',', $plugins ); if ( ! empty( $mce_external_plugins ) ) { $settings['external_plugins'] = wp_json_encode( $mce_external_plugins ); } if ( apply_filters( 'disable_captions', '' ) ) { $settings['wpeditimage_disable_captions'] = true; } $mce_css = $settings['content_css']; if ( is_admin() ) { $editor_styles = get_editor_stylesheets(); if ( ! empty( $editor_styles ) ) { foreach ( $editor_styles as $key => $url ) { if ( strpos( $url, ',' ) !== false ) { $editor_styles[ $key ] = str_replace( ',', '%2C', $url ); } } $mce_css .= ',' . implode( ',', $editor_styles ); } } $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); if ( ! empty( $mce_css ) ) { $settings['content_css'] = $mce_css; } else { unset( $settings['content_css'] ); } self::$first_init = $settings; } if ( $set['teeny'] ) { $mce_buttons = array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen', ); $mce_buttons = apply_filters( 'teeny_mce_buttons', $mce_buttons, $editor_id ); $mce_buttons_2 = array(); $mce_buttons_3 = array(); $mce_buttons_4 = array(); } else { $mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker', ); if ( ! wp_is_mobile() ) { if ( $set['_content_editor_dfw'] ) { $mce_buttons[] = 'wp_adv'; $mce_buttons[] = 'dfw'; } else { $mce_buttons[] = 'fullscreen'; $mce_buttons[] = 'wp_adv'; } } else { $mce_buttons[] = 'wp_adv'; } $mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id ); $mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', ); if ( ! wp_is_mobile() ) { $mce_buttons_2[] = 'wp_help'; } $mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id ); $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id ); $mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id ); } $body_class = $editor_id; $post = get_post(); if ( $post ) { $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status ); if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post ); if ( $post_format && ! is_wp_error( $post_format ) ) { $body_class .= ' post-format-' . sanitize_html_class( $post_format ); } else { $body_class .= ' post-format-standard'; } } $page_template = get_page_template_slug( $post ); if ( false !== $page_template ) { $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) ); $body_class .= ' page-template-' . sanitize_html_class( $page_template ); } } $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); if ( ! empty( $set['tinymce']['body_class'] ) ) { $body_class .= ' ' . $set['tinymce']['body_class']; unset( $set['tinymce']['body_class'] ); } $mceInit = array( 'selector' => "#$editor_id", 'wpautop' => (bool) $set['wpautop'], 'indent' => ! $set['wpautop'], 'toolbar1' => implode( ',', $mce_buttons ), 'toolbar2' => implode( ',', $mce_buttons_2 ), 'toolbar3' => implode( ',', $mce_buttons_3 ), 'toolbar4' => implode( ',', $mce_buttons_4 ), 'tabfocus_elements' => $set['tabfocus_elements'], 'body_class' => $body_class, ); $mceInit = array_merge( self::$first_init, $mceInit ); if ( is_array( $set['tinymce'] ) ) { $mceInit = array_merge( $mceInit, $set['tinymce'] ); } if ( $set['teeny'] ) { $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id ); } else { $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id ); } if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) { $mceInit['toolbar3'] = $mceInit['toolbar4']; $mceInit['toolbar4'] = ''; } self::$mce_settings[ $editor_id ] = $mceInit; } } private static function _parse_init( $init ) { $options = ''; foreach ( $init as $key => $value ) { if ( is_bool( $value ) ) { $val = $value ? 'true' : 'false'; $options .= $key . ':' . $val . ','; continue; } elseif ( ! empty( $value ) && is_string( $value ) && ( ( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) || ( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) || preg_match( '/^\(?function ?\(/', $value ) ) ) { $options .= $key . ':' . $value . ','; continue; } $options .= $key . ':"' . $value . '",'; } return '{' . trim( $options, ' ,' ) . '}'; } public static function enqueue_scripts( $default_scripts = false ) { if ( $default_scripts || self::$has_tinymce ) { wp_enqueue_script( 'editor' ); } if ( $default_scripts || self::$has_quicktags ) { wp_enqueue_script( 'quicktags' ); wp_enqueue_style( 'buttons' ); } if ( $default_scripts || in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) { wp_enqueue_script( 'wplink' ); wp_enqueue_script( 'jquery-ui-autocomplete' ); } if ( self::$has_medialib ) { add_thickbox(); wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'wp-embed' ); } elseif ( $default_scripts ) { wp_enqueue_script( 'media-upload' ); } do_action( 'wp_enqueue_editor', array( 'tinymce' => ( $default_scripts || self::$has_tinymce ), 'quicktags' => ( $default_scripts || self::$has_quicktags ), ) ); } public static function enqueue_default_editor() { if ( did_action( 'wp_enqueue_editor' ) ) { return; } self::enqueue_scripts( true ); wp_enqueue_style( 'editor-buttons' ); if ( is_admin() ) { add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'admin_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); } else { add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); add_action( 'wp_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); } } public static function print_default_editor_scripts() { $user_can_richedit = user_can_richedit(); if ( $user_can_richedit ) { $settings = self::default_settings(); $settings['toolbar1'] = 'bold,italic,bullist,numlist,link'; $settings['wpautop'] = false; $settings['indent'] = true; $settings['elementpath'] = false; if ( is_rtl() ) { $settings['directionality'] = 'rtl'; } $settings['plugins'] = implode( ',', array( 'charmap', 'colorpicker', 'hr', 'lists', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wptextpattern', ) ); $settings = self::_parse_init( $settings ); } else { $settings = '{}'; } ?> - - $value ) { if ( is_array( $value ) ) { $shortcut_labels[ $name ] = $value[1]; } } $settings = array( 'theme' => 'modern', 'skin' => 'lightgray', 'language' => self::get_mce_locale(), 'formats' => '{' . 'alignleft: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},' . '{selector: "img,table,dl.wp-caption", classes: "alignleft"}' . '],' . 'aligncenter: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},' . '{selector: "img,table,dl.wp-caption", classes: "aligncenter"}' . '],' . 'alignright: [' . '{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},' . '{selector: "img,table,dl.wp-caption", classes: "alignright"}' . '],' . 'strikethrough: {inline: "del"}' . '}', 'relative_urls' => false, 'remove_script_host' => false, 'convert_urls' => false, 'browser_spellcheck' => true, 'fix_list_elements' => true, 'entities' => '38,amp,60,lt,62,gt', 'entity_encoding' => 'raw', 'keep_styles' => false, 'cache_suffix' => 'wp-mce-' . $tinymce_version, 'resize' => 'vertical', 'menubar' => false, 'branding' => false, 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform', 'end_container_on_empty_block' => true, 'wpeditimage_html5_captions' => true, 'wp_lang_attr' => get_bloginfo( 'language' ), 'wp_keep_scroll_position' => false, 'wp_shortcut_labels' => wp_json_encode( $shortcut_labels ), ); $suffix = SCRIPT_DEBUG ? '' : '.min'; $version = 'ver=' . get_bloginfo( 'version' ); $settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' . includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" ); return $settings; } private static function get_translation() { if ( empty( self::$translation ) ) { self::$translation = array( 'New document' => __( 'New document' ), 'Formats' => _x( 'Formats', 'TinyMCE' ), 'Headings' => _x( 'Headings', 'TinyMCE' ), 'Heading 1' => array( __( 'Heading 1' ), 'access1' ), 'Heading 2' => array( __( 'Heading 2' ), 'access2' ), 'Heading 3' => array( __( 'Heading 3' ), 'access3' ), 'Heading 4' => array( __( 'Heading 4' ), 'access4' ), 'Heading 5' => array( __( 'Heading 5' ), 'access5' ), 'Heading 6' => array( __( 'Heading 6' ), 'access6' ), 'Blocks' => _x( 'Blocks', 'TinyMCE' ), 'Paragraph' => array( __( 'Paragraph' ), 'access7' ), 'Blockquote' => array( __( 'Blockquote' ), 'accessQ' ), 'Div' => _x( 'Div', 'HTML tag' ), 'Pre' => _x( 'Pre', 'HTML tag' ), 'Preformatted' => _x( 'Preformatted', 'HTML tag' ), 'Address' => _x( 'Address', 'HTML tag' ), 'Inline' => _x( 'Inline', 'HTML elements' ), 'Underline' => array( __( 'Underline' ), 'metaU' ), 'Strikethrough' => array( __( 'Strikethrough' ), 'accessD' ), 'Subscript' => __( 'Subscript' ), 'Superscript' => __( 'Superscript' ), 'Clear formatting' => __( 'Clear formatting' ), 'Bold' => array( __( 'Bold' ), 'metaB' ), 'Italic' => array( __( 'Italic' ), 'metaI' ), 'Code' => array( __( 'Code' ), 'accessX' ), 'Source code' => __( 'Source code' ), 'Font Family' => __( 'Font Family' ), 'Font Sizes' => __( 'Font Sizes' ), 'Align center' => array( __( 'Align center' ), 'accessC' ), 'Align right' => array( __( 'Align right' ), 'accessR' ), 'Align left' => array( __( 'Align left' ), 'accessL' ), 'Justify' => array( __( 'Justify' ), 'accessJ' ), 'Increase indent' => __( 'Increase indent' ), 'Decrease indent' => __( 'Decrease indent' ), 'Cut' => array( __( 'Cut' ), 'metaX' ), 'Copy' => array( __( 'Copy' ), 'metaC' ), 'Paste' => array( __( 'Paste' ), 'metaV' ), 'Select all' => array( __( 'Select all' ), 'metaA' ), 'Undo' => array( __( 'Undo' ), 'metaZ' ), 'Redo' => array( __( 'Redo' ), 'metaY' ), 'Ok' => __( 'OK' ), 'Cancel' => __( 'Cancel' ), 'Close' => __( 'Close' ), 'Visual aids' => __( 'Visual aids' ), 'Bullet list' => array( __( 'Bulleted list' ), 'accessU' ), 'Numbered list' => array( __( 'Numbered list' ), 'accessO' ), 'Square' => _x( 'Square', 'list style' ), 'Default' => _x( 'Default', 'list style' ), 'Circle' => _x( 'Circle', 'list style' ), 'Disc' => _x( 'Disc', 'list style' ), 'Lower Greek' => _x( 'Lower Greek', 'list style' ), 'Lower Alpha' => _x( 'Lower Alpha', 'list style' ), 'Upper Alpha' => _x( 'Upper Alpha', 'list style' ), 'Upper Roman' => _x( 'Upper Roman', 'list style' ), 'Lower Roman' => _x( 'Lower Roman', 'list style' ), 'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ), 'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ), 'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ), 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' => __( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' ), 'Id' => _x( 'Id', 'Id for link anchor (TinyMCE)' ), 'Document properties' => __( 'Document properties' ), 'Robots' => __( 'Robots' ), 'Title' => __( 'Title' ), 'Keywords' => __( 'Keywords' ), 'Encoding' => __( 'Encoding' ), 'Description' => __( 'Description' ), 'Author' => __( 'Author' ), 'Image' => __( 'Image' ), 'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ), 'General' => __( 'General' ), 'Advanced' => __( 'Advanced' ), 'Source' => __( 'Source' ), 'Border' => __( 'Border' ), 'Constrain proportions' => __( 'Constrain proportions' ), 'Vertical space' => __( 'Vertical space' ), 'Image description' => __( 'Image description' ), 'Style' => __( 'Style' ), 'Dimensions' => __( 'Dimensions' ), 'Insert image' => __( 'Insert image' ), 'Date/time' => __( 'Date/time' ), 'Insert date/time' => __( 'Insert date/time' ), 'Table of Contents' => __( 'Table of Contents' ), 'Insert/Edit code sample' => __( 'Insert/edit code sample' ), 'Language' => __( 'Language' ), 'Media' => __( 'Media' ), 'Insert/edit media' => __( 'Insert/edit media' ), 'Poster' => __( 'Poster' ), 'Alternative source' => __( 'Alternative source' ), 'Paste your embed code below:' => __( 'Paste your embed code below:' ), 'Insert video' => __( 'Insert video' ), 'Embed' => __( 'Embed' ), 'Special character' => __( 'Special character' ), 'Right to left' => _x( 'Right to left', 'editor button' ), 'Left to right' => _x( 'Left to right', 'editor button' ), 'Emoticons' => __( 'Emoticons' ), 'Nonbreaking space' => __( 'Nonbreaking space' ), 'Page break' => __( 'Page break' ), 'Paste as text' => __( 'Paste as text' ), 'Preview' => __( 'Preview' ), 'Print' => __( 'Print' ), 'Save' => __( 'Save' ), 'Fullscreen' => __( 'Fullscreen' ), 'Horizontal line' => __( 'Horizontal line' ), 'Horizontal space' => __( 'Horizontal space' ), 'Restore last draft' => __( 'Restore last draft' ), 'Insert/edit link' => array( __( 'Insert/edit link' ), 'metaK' ), 'Remove link' => array( __( 'Remove link' ), 'accessS' ), 'Link' => __( 'Link' ), 'Insert link' => __( 'Insert link' ), 'Target' => __( 'Target' ), 'New window' => __( 'New window' ), 'Text to display' => __( 'Text to display' ), 'Url' => __( 'URL' ), 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?' => __( 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?' ), 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?' => __( 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?' ), 'Color' => __( 'Color' ), 'Custom color' => __( 'Custom color' ), 'Custom...' => _x( 'Custom...', 'label for custom color' ), 'No color' => __( 'No color' ), 'R' => _x( 'R', 'Short for red in RGB' ), 'G' => _x( 'G', 'Short for green in RGB' ), 'B' => _x( 'B', 'Short for blue in RGB' ), 'Could not find the specified string.' => __( 'Could not find the specified string.' ), 'Replace' => _x( 'Replace', 'find/replace' ), 'Next' => _x( 'Next', 'find/replace' ), 'Prev' => _x( 'Prev', 'find/replace' ), 'Whole words' => _x( 'Whole words', 'find/replace' ), 'Find and replace' => __( 'Find and replace' ), 'Replace with' => _x( 'Replace with', 'find/replace' ), 'Find' => _x( 'Find', 'find/replace' ), 'Replace all' => _x( 'Replace all', 'find/replace' ), 'Match case' => __( 'Match case' ), 'Spellcheck' => __( 'Check Spelling' ), 'Finish' => _x( 'Finish', 'spellcheck' ), 'Ignore all' => _x( 'Ignore all', 'spellcheck' ), 'Ignore' => _x( 'Ignore', 'spellcheck' ), 'Add to Dictionary' => __( 'Add to Dictionary' ), 'Insert table' => __( 'Insert table' ), 'Delete table' => __( 'Delete table' ), 'Table properties' => __( 'Table properties' ), 'Row properties' => __( 'Table row properties' ), 'Cell properties' => __( 'Table cell properties' ), 'Border color' => __( 'Border color' ), 'Row' => __( 'Row' ), 'Rows' => __( 'Rows' ), 'Column' => __( 'Column' ), 'Cols' => __( 'Columns' ), 'Cell' => _x( 'Cell', 'table cell' ), 'Header cell' => __( 'Header cell' ), 'Header' => _x( 'Header', 'table header' ), 'Body' => _x( 'Body', 'table body' ), 'Footer' => _x( 'Footer', 'table footer' ), 'Insert row before' => __( 'Insert row before' ), 'Insert row after' => __( 'Insert row after' ), 'Insert column before' => __( 'Insert column before' ), 'Insert column after' => __( 'Insert column after' ), 'Paste row before' => __( 'Paste table row before' ), 'Paste row after' => __( 'Paste table row after' ), 'Delete row' => __( 'Delete row' ), 'Delete column' => __( 'Delete column' ), 'Cut row' => __( 'Cut table row' ), 'Copy row' => __( 'Copy table row' ), 'Merge cells' => __( 'Merge table cells' ), 'Split cell' => __( 'Split table cell' ), 'Height' => __( 'Height' ), 'Width' => __( 'Width' ), 'Caption' => __( 'Caption' ), 'Alignment' => __( 'Alignment' ), 'H Align' => _x( 'H Align', 'horizontal table cell alignment' ), 'Left' => __( 'Left' ), 'Center' => __( 'Center' ), 'Right' => __( 'Right' ), 'None' => _x( 'None', 'table cell alignment attribute' ), 'V Align' => _x( 'V Align', 'vertical table cell alignment' ), 'Top' => __( 'Top' ), 'Middle' => __( 'Middle' ), 'Bottom' => __( 'Bottom' ), 'Row group' => __( 'Row group' ), 'Column group' => __( 'Column group' ), 'Row type' => __( 'Row type' ), 'Cell type' => __( 'Cell type' ), 'Cell padding' => __( 'Cell padding' ), 'Cell spacing' => __( 'Cell spacing' ), 'Scope' => _x( 'Scope', 'table cell scope attribute' ), 'Insert template' => _x( 'Insert template', 'TinyMCE' ), 'Templates' => _x( 'Templates', 'TinyMCE' ), 'Background color' => __( 'Background color' ), 'Text color' => __( 'Text color' ), 'Show blocks' => _x( 'Show blocks', 'editor button' ), 'Show invisible characters' => __( 'Show invisible characters' ), 'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ), 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __( 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) . "\n\n" . __( 'If you are looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ), 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help.' ), 'Rich Text Area. Press Control-Option-H for help.' => __( 'Rich Text Area. Press Control-Option-H for help.' ), 'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ), 'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser’s edit menu instead.' ), 'Insert' => _x( 'Insert', 'TinyMCE menu' ), 'File' => _x( 'File', 'TinyMCE menu' ), 'Edit' => _x( 'Edit', 'TinyMCE menu' ), 'Tools' => _x( 'Tools', 'TinyMCE menu' ), 'View' => _x( 'View', 'TinyMCE menu' ), 'Table' => _x( 'Table', 'TinyMCE menu' ), 'Format' => _x( 'Format', 'TinyMCE menu' ), 'Toolbar Toggle' => array( __( 'Toolbar Toggle' ), 'accessZ' ), 'Insert Read More tag' => array( __( 'Insert Read More tag' ), 'accessT' ), 'Insert Page Break tag' => array( __( 'Insert Page Break tag' ), 'accessP' ), 'Read more...' => __( 'Read more...' ), 'Distraction-free writing mode' => array( __( 'Distraction-free writing mode' ), 'accessW' ), 'No alignment' => __( 'No alignment' ), 'Remove' => __( 'Remove' ), 'Edit|button' => __( 'Edit' ), 'Paste URL or type to search' => __( 'Paste URL or type to search' ), 'Apply' => __( 'Apply' ), 'Link options' => __( 'Link options' ), 'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), 'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), 'Add Media' => array( __( 'Add Media' ), 'accessM' ), 'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ), 'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts' ), 'Default shortcuts,' => __( 'Default shortcuts,' ), 'Additional shortcuts,' => __( 'Additional shortcuts,' ), 'Focus shortcuts:' => __( 'Focus shortcuts:' ), 'Inline toolbar (when an image, link or preview is selected)' => __( 'Inline toolbar (when an image, link or preview is selected)' ), 'Editor menu (when enabled)' => __( 'Editor menu (when enabled)' ), 'Editor toolbar' => __( 'Editor toolbar' ), 'Elements path' => __( 'Elements path' ), 'Ctrl + Alt + letter:' => __( 'Ctrl + Alt + letter:' ), 'Shift + Alt + letter:' => __( 'Shift + Alt + letter:' ), 'Cmd + letter:' => __( 'Cmd + letter:' ), 'Ctrl + letter:' => __( 'Ctrl + letter:' ), 'Letter' => __( 'Letter' ), 'Action' => __( 'Action' ), 'Warning: the link has been inserted but may have errors. Please test it.' => __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' => __( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ), 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' => __( 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ), 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' => __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ), 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' => __( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ), ); } return self::$translation; } public static function wp_mce_translation( $mce_locale = '', $json_only = false ) { if ( ! $mce_locale ) { $mce_locale = self::get_mce_locale(); } $mce_translation = self::get_translation(); foreach ( $mce_translation as $name => $value ) { if ( is_array( $value ) ) { $mce_translation[ $name ] = $value[0]; } } $mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale ); foreach ( $mce_translation as $key => $value ) { if ( $key === $value ) { unset( $mce_translation[ $key ] ); continue; } if ( false !== strpos( $value, '&' ) ) { $mce_translation[ $key ] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' ); } } if ( is_rtl() ) { $mce_translation['_dir'] = 'rtl'; } if ( $json_only ) { return wp_json_encode( $mce_translation ); } $baseurl = self::get_baseurl(); return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" . "tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n"; } public static function force_uncompressed_tinymce() { $has_custom_theme = false; foreach ( self::$mce_settings as $init ) { if ( ! empty( $init['theme_url'] ) ) { $has_custom_theme = true; break; } } if ( ! $has_custom_theme ) { return; } $wp_scripts = wp_scripts(); $wp_scripts->remove( 'wp-tinymce' ); wp_register_tinymce_scripts( $wp_scripts, true ); } public static function print_tinymce_scripts() { global $concatenate_scripts; if ( self::$tinymce_scripts_printed ) { return; } self::$tinymce_scripts_printed = true; if ( ! isset( $concatenate_scripts ) ) { script_concat_settings(); } wp_print_scripts( array( 'wp-tinymce' ) ); echo "\n"; } public static function editor_js() { global $tinymce_version; $tmce_on = ! empty( self::$mce_settings ); $mceInit = ''; $qtInit = ''; if ( $tmce_on ) { foreach ( self::$mce_settings as $editor_id => $init ) { $options = self::_parse_init( $init ); $mceInit .= "'$editor_id':{$options},"; } $mceInit = '{' . trim( $mceInit, ',' ) . '}'; } else { $mceInit = '{}'; } if ( ! empty( self::$qt_settings ) ) { foreach ( self::$qt_settings as $editor_id => $init ) { $options = self::_parse_init( $init ); $qtInit .= "'$editor_id':{$options},"; } $qtInit = '{' . trim( $qtInit, ',' ) . '}'; } else { $qtInit = '{}'; } $ref = array( 'plugins' => implode( ',', self::$plugins ), 'theme' => 'modern', 'language' => self::$mce_locale, ); $suffix = SCRIPT_DEBUG ? '' : '.min'; $baseurl = self::get_baseurl(); $version = 'ver=' . $tinymce_version; do_action( 'before_wp_tiny_mce', self::$mce_settings ); ?> - - - \n"; } } do_action( 'wp_tiny_mce_init', self::$mce_settings ); ?> - - true ), 'objects' ); $pt_names = array_keys( $pts ); $query = array( 'post_type' => $pt_names, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'posts_per_page' => 20, ); $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1; if ( isset( $args['s'] ) ) { $query['s'] = $args['s']; } $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0; $query = apply_filters( 'wp_link_query_args', $query ); $get_posts = new WP_Query; $posts = $get_posts->query( $query ); $results = array(); foreach ( $posts as $post ) { if ( 'post' === $post->post_type ) { $info = mysql2date( __( 'Y/m/d' ), $post->post_date ); } else { $info = $pts[ $post->post_type ]->labels->singular_name; } $results[] = array( 'ID' => $post->ID, 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ), 'permalink' => get_permalink( $post->ID ), 'info' => $info, ); } $results = apply_filters( 'wp_link_query', $results, $query ); return ! empty( $results ) ? $results : false; } public static function wp_link_dialog() { if ( self::$link_dialog_printed ) { return; } self::$link_dialog_printed = true; ?> - - - init(); add_action( 'init', array( $this, 'init' ), 0 ); } public function init() { if ( function_exists( 'is_admin' ) && ! is_admin() && function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'script' ) ) { $this->type_attr = " type='text/javascript'"; } do_action_ref_array( 'wp_default_scripts', array( &$this ) ); } public function print_scripts( $handles = false, $group = false ) { return $this->do_items( $handles, $group ); } public function print_scripts_l10n( $handle, $display = true ) { _deprecated_function( __FUNCTION__, '3.3.0', 'WP_Scripts::print_extra_script()' ); return $this->print_extra_script( $handle, $display ); } public function print_extra_script( $handle, $display = true ) { $output = $this->get_data( $handle, 'data' ); if ( ! $output ) { return; } if ( ! $display ) { return $output; } printf( "\n", $this->type_attr, esc_attr( $handle ) ); if ( $this->type_attr ) { echo "/* type_attr ) { echo "/* ]]> */\n"; } echo "\n"; return true; } public function do_item( $handle, $group = false ) { if ( ! parent::do_item( $handle ) ) { return false; } if ( 0 === $group && $this->groups[ $handle ] > 0 ) { $this->in_footer[] = $handle; return false; } if ( false === $group && in_array( $handle, $this->in_footer, true ) ) { $this->in_footer = array_diff( $this->in_footer, (array) $handle ); } $obj = $this->registered[ $handle ]; if ( null === $obj->ver ) { $ver = ''; } else { $ver = $obj->ver ? $obj->ver : $this->default_version; } if ( isset( $this->args[ $handle ] ) ) { $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ]; } $src = $obj->src; $cond_before = ''; $cond_after = ''; $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; if ( $conditional ) { $cond_before = "\n"; } $before_handle = $this->print_inline_script( $handle, 'before', false ); $after_handle = $this->print_inline_script( $handle, 'after', false ); if ( $before_handle ) { $before_handle = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $before_handle ); } if ( $after_handle ) { $after_handle = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $after_handle ); } if ( $before_handle || $after_handle ) { $inline_script_tag = $cond_before . $before_handle . $after_handle . $cond_after; } else { $inline_script_tag = ''; } $translations_stop_concat = ! empty( $obj->textdomain ); $translations = $this->print_translations( $handle, false ); if ( $translations ) { $translations = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $translations ); } if ( $this->do_concat ) { $srce = apply_filters( 'script_loader_src', $src, $handle ); if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) { $this->do_concat = false; _print_scripts(); $this->reset(); } elseif ( $this->in_default_dir( $srce ) && ! $conditional ) { $this->print_code .= $this->print_extra_script( $handle, false ); $this->concat .= "$handle,"; $this->concat_version .= "$handle$ver"; return true; } else { $this->ext_handles .= "$handle,"; $this->ext_version .= "$handle$ver"; } } $has_conditional_data = $conditional && $this->get_data( $handle, 'data' ); if ( $has_conditional_data ) { echo $cond_before; } $this->print_extra_script( $handle ); if ( $has_conditional_data ) { echo $cond_after; } if ( ! $src ) { if ( $inline_script_tag ) { if ( $this->do_concat ) { $this->print_html .= $inline_script_tag; } else { echo $inline_script_tag; } } return true; } if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) { $src = $this->base_url . $src; } if ( ! empty( $ver ) ) { $src = add_query_arg( 'ver', $ver, $src ); } $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); if ( ! $src ) { return true; } $tag = $translations . $cond_before . $before_handle; $tag .= sprintf( "\n", $this->type_attr, $src, esc_attr( $handle ) ); $tag .= $after_handle . $cond_after; $tag = apply_filters( 'script_loader_tag', $tag, $handle, $src ); if ( $this->do_concat ) { $this->print_html .= $tag; } else { echo $tag; } return true; } public function add_inline_script( $handle, $data, $position = 'after' ) { if ( ! $data ) { return false; } if ( 'after' !== $position ) { $position = 'before'; } $script = (array) $this->get_data( $handle, $position ); $script[] = $data; return $this->add_data( $handle, $position, $script ); } public function print_inline_script( $handle, $position = 'after', $display = true ) { $output = $this->get_data( $handle, $position ); if ( empty( $output ) ) { return false; } $output = trim( implode( "\n", $output ), "\n" ); if ( $display ) { printf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), esc_attr( $position ), $output ); } return $output; } public function localize( $handle, $object_name, $l10n ) { if ( 'jquery' === $handle ) { $handle = 'jquery-core'; } if ( is_array( $l10n ) && isset( $l10n['l10n_print_after'] ) ) { $after = $l10n['l10n_print_after']; unset( $l10n['l10n_print_after'] ); } if ( ! is_array( $l10n ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'The %1$s parameter must be an array. To pass arbitrary data to scripts, use the %2$s function instead.' ), '$l10n', 'wp_add_inline_script()' ), '5.7.0' ); } if ( is_string( $l10n ) ) { $l10n = html_entity_decode( $l10n, ENT_QUOTES, 'UTF-8' ); } else { foreach ( (array) $l10n as $key => $value ) { if ( ! is_scalar( $value ) ) { continue; } $l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); } } $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; if ( ! empty( $after ) ) { $script .= "\n$after;"; } $data = $this->get_data( $handle, 'data' ); if ( ! empty( $data ) ) { $script = "$data\n$script"; } return $this->add_data( $handle, 'data', $script ); } public function set_group( $handle, $recursion, $group = false ) { if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) { $grp = 1; } else { $grp = (int) $this->get_data( $handle, 'group' ); } if ( false !== $group && $grp > $group ) { $grp = $group; } return parent::set_group( $handle, $recursion, $grp ); } public function set_translations( $handle, $domain = 'default', $path = null ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } $obj = $this->registered[ $handle ]; if ( ! in_array( 'wp-i18n', $obj->deps, true ) ) { $obj->deps[] = 'wp-i18n'; } return $obj->set_translations( $domain, $path ); } public function print_translations( $handle, $display = true ) { if ( ! isset( $this->registered[ $handle ] ) || empty( $this->registered[ $handle ]->textdomain ) ) { return false; } $domain = $this->registered[ $handle ]->textdomain; $path = $this->registered[ $handle ]->translations_path; $json_translations = load_script_textdomain( $handle, $domain, $path ); if ( ! $json_translations ) { return false; } $output = <<\n%s\n\n", $this->type_attr, esc_attr( $handle ), $output ); } return $output; } public function all_deps( $handles, $recursion = false, $group = false ) { $r = parent::all_deps( $handles, $recursion, $group ); if ( ! $recursion ) { $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); } return $r; } public function do_head_items() { $this->do_items( false, 0 ); return $this->done; } public function do_footer_items() { $this->do_items( false, 1 ); return $this->done; } public function in_default_dir( $src ) { if ( ! $this->default_dirs ) { return true; } if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) { return false; } foreach ( (array) $this->default_dirs as $test ) { if ( 0 === strpos( $src, $test ) ) { return true; } } return false; } public function reset() { $this->do_concat = false; $this->print_code = ''; $this->concat = ''; $this->concat_version = ''; $this->print_html = ''; $this->ext_version = ''; $this->ext_handles = ''; } } user_id = $user_id; } final public static function get_instance( $user_id ) { $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); return new $manager( $user_id ); } private function hash_token( $token ) { if ( function_exists( 'hash' ) ) { return hash( 'sha256', $token ); } else { return sha1( $token ); } } final public function get( $token ) { $verifier = $this->hash_token( $token ); return $this->get_session( $verifier ); } final public function verify( $token ) { $verifier = $this->hash_token( $token ); return (bool) $this->get_session( $verifier ); } final public function create( $expiration ) { $session = apply_filters( 'attach_session_information', array(), $this->user_id ); $session['expiration'] = $expiration; if ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { $session['ip'] = $_SERVER['REMOTE_ADDR']; } if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $session['ua'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); } $session['login'] = time(); $token = wp_generate_password( 43, false, false ); $this->update( $token, $session ); return $token; } final public function update( $token, $session ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, $session ); } final public function destroy( $token ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, null ); } final public function destroy_others( $token_to_keep ) { $verifier = $this->hash_token( $token_to_keep ); $session = $this->get_session( $verifier ); if ( $session ) { $this->destroy_other_sessions( $verifier ); } else { $this->destroy_all_sessions(); } } final protected function is_still_valid( $session ) { return $session['expiration'] >= time(); } final public function destroy_all() { $this->destroy_all_sessions(); } final public static function destroy_all_for_all_users() { $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); call_user_func( array( $manager, 'drop_sessions' ) ); } final public function get_all() { return array_values( $this->get_sessions() ); } abstract protected function get_sessions(); abstract protected function get_session( $verifier ); abstract protected function update_session( $verifier, $session = null ); abstract protected function destroy_other_sessions( $verifier ); abstract protected function destroy_all_sessions(); public static function drop_sessions() {} } 'border.radius', 'spacing.customMargin' => 'spacing.margin', 'spacing.customPadding' => 'spacing.padding', 'typography.customLineHeight' => 'typography.lineHeight', ); public static function migrate( $theme_json ) { if ( ! isset( $theme_json['version'] ) ) { $theme_json = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, ); } if ( 1 === $theme_json['version'] ) { $theme_json = self::migrate_v1_to_v2( $theme_json ); } return $theme_json; } private static function migrate_v1_to_v2( $old ) { $new = $old; if ( isset( $old['settings'] ) ) { $new['settings'] = self::rename_paths( $old['settings'], self::V1_TO_V2_RENAMED_PATHS ); } $new['version'] = 2; return $new; } private static function rename_paths( $settings, $paths_to_rename ) { $new_settings = $settings; self::rename_settings( $new_settings, $paths_to_rename ); if ( isset( $new_settings['blocks'] ) && is_array( $new_settings['blocks'] ) ) { foreach ( $new_settings['blocks'] as &$block_settings ) { self::rename_settings( $block_settings, $paths_to_rename ); } } return $new_settings; } private static function rename_settings( &$settings, $paths_to_rename ) { foreach ( $paths_to_rename as $original => $renamed ) { $original_path = explode( '.', $original ); $renamed_path = explode( '.', $renamed ); $current_value = _wp_array_get( $settings, $original_path, null ); if ( null !== $current_value ) { _wp_array_set( $settings, $renamed_path, $current_value ); self::unset_setting_by_path( $settings, $original_path ); } } } private static function unset_setting_by_path( &$settings, $path ) { $tmp_settings = &$settings; $last_key = array_pop( $path ); foreach ( $path as $key ) { $tmp_settings = &$tmp_settings[ $key ]; } unset( $tmp_settings[ $last_key ] ); } } ', $open_sq_flag = '', $apos_flag = ''; if ( empty( $text ) || false === $run_texturize ) { return $text; } if ( $reset || ! isset( $static_characters ) ) { $run_texturize = apply_filters( 'run_wptexturize', $run_texturize ); if ( false === $run_texturize ) { return $text; } $opening_quote = _x( '“', 'opening curly double quote' ); $closing_quote = _x( '”', 'closing curly double quote' ); $apos = _x( '’', 'apostrophe' ); $prime = _x( '′', 'prime' ); $double_prime = _x( '″', 'double prime' ); $opening_single_quote = _x( '‘', 'opening curly single quote' ); $closing_single_quote = _x( '’', 'closing curly single quote' ); $en_dash = _x( '–', 'en dash' ); $em_dash = _x( '—', 'em dash' ); $default_no_texturize_tags = array( 'pre', 'code', 'kbd', 'style', 'script', 'tt' ); $default_no_texturize_shortcodes = array( 'code' ); if ( isset( $wp_cockneyreplace ) ) { $cockney = array_keys( $wp_cockneyreplace ); $cockneyreplace = array_values( $wp_cockneyreplace ); } else { $cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em", 'Comma-separated list of words to texturize in your language' ) ); $cockneyreplace = explode( ',', _x( '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em', 'Comma-separated list of replacement words in your language' ) ); } $static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney ); $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); $dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array(), ); $dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array(), ); $dynamic = array(); $spaces = wp_spaces_regexp(); if ( "'" !== $apos || "'" !== $closing_single_quote ) { $dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote; } if ( "'" !== $apos || '"' !== $closing_quote ) { $dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote; } if ( "'" !== $apos ) { $dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag; } if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) { $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote; } if ( "'" !== $opening_single_quote ) { $dynamic[ '/(?<=\A|[([{"\-]|<|' . $spaces . ')\'/' ] = $open_sq_flag; } if ( "'" !== $apos ) { $dynamic[ '/(?&/\[\]\x00-\x20=]++)@', $text, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); $found_shortcodes = ! empty( $tagnames ); $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : ''; $regex = _get_wptexturize_split_regex( $shortcode_regex ); $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); foreach ( $textarr as &$curl ) { $first = $curl[0]; if ( '<' === $first ) { if ( ''; $quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|>|" . $spaces . ')/'; $prime_pattern = "/(?<=\\d)$needle/"; $flag_after_digit = "/(?<=\\d)$flag/"; $flag_no_digit = "/(? &$sentence ) { if ( false === strpos( $sentence, $needle ) ) { continue; } elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) { $sentence = preg_replace( $quote_pattern, $flag, $sentence, -1, $count ); if ( $count > 1 ) { $sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, -1, $count2 ); if ( 0 === $count2 ) { $count2 = substr_count( $sentence, "$flag." ); if ( $count2 > 0 ) { $pos = strrpos( $sentence, "$flag." ); } else { $pos = strrpos( $sentence, $flag ); } $sentence = substr_replace( $sentence, $close_quote, $pos, strlen( $flag ) ); } $sentence = preg_replace( $prime_pattern, $prime, $sentence ); $sentence = preg_replace( $flag_after_digit, $prime, $sentence ); $sentence = str_replace( $flag, $close_quote, $sentence ); } elseif ( 1 == $count ) { $sentence = str_replace( $flag, $close_quote, $sentence ); $sentence = preg_replace( $prime_pattern, $prime, $sentence ); } else { $sentence = preg_replace( $prime_pattern, $prime, $sentence ); } } else { $sentence = preg_replace( $prime_pattern, $prime, $sentence ); $sentence = preg_replace( $quote_pattern, $close_quote, $sentence ); } if ( '"' === $needle && false !== strpos( $sentence, '"' ) ) { $sentence = str_replace( '"', $close_quote, $sentence ); } } return implode( $open_quote, $sentences ); } function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) { if ( isset( $text[1] ) && '/' !== $text[1] ) { $opening_tag = true; $name_offset = 1; } elseif ( 0 === count( $stack ) ) { return; } else { $opening_tag = false; $name_offset = 2; } $space = strpos( $text, ' ' ); if ( false === $space ) { $space = -1; } else { $space -= $name_offset; } $tag = substr( $text, $name_offset, $space ); if ( in_array( $tag, $disabled_elements, true ) ) { if ( $opening_tag ) { array_push( $stack, $tag ); } elseif ( end( $stack ) == $tag ) { array_pop( $stack ); } } } function wpautop( $text, $br = true ) { $pre_tags = array(); if ( trim( $text ) === '' ) { return ''; } $text = $text . "\n"; if ( strpos( $text, '', $text ); $last_part = array_pop( $text_parts ); $text = ''; $i = 0; foreach ( $text_parts as $text_part ) { $start = strpos( $text_part, ''; $text .= substr( $text_part, 0, $start ) . $name; $i++; } $text .= $last_part; } $text = preg_replace( '|\s*|', "\n\n", $text ); $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; $text = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $text ); $text = preg_replace( '!()!', "$1\n\n", $text ); $text = preg_replace( '!()!', "$1\n\n", $text ); $text = str_replace( array( "\r\n", "\r" ), "\n", $text ); $text = wp_replace_in_html_tags( $text, array( "\n" => ' ' ) ); if ( strpos( $text, '\s*|', '', $text ); } if ( strpos( $text, '' ) !== false ) { $text = preg_replace( '|(]*>)\s*|', '$1', $text ); $text = preg_replace( '|\s*|', '', $text ); $text = preg_replace( '%\s*(]*>)\s*%', '$1', $text ); } if ( strpos( $text, '\]]*[>\]])\s*%', '$1', $text ); $text = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $text ); $text = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $text ); } if ( strpos( $text, ']*>)|', '$1', $text ); $text = preg_replace( '|\s*|', '', $text ); } $text = preg_replace( "/\n\n+/", "\n\n", $text ); $paragraphs = preg_split( '/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY ); $text = ''; foreach ( $paragraphs as $paragraph ) { $text .= '

            ' . trim( $paragraph, "\n" ) . "

            \n"; } $text = preg_replace( '|

            \s*

            |', '', $text ); $text = preg_replace( '!

            ([^<]+)!', '

            $1

            ', $text ); $text = preg_replace( '!

            \s*(]*>)\s*

            !', '$1', $text ); $text = preg_replace( '|

            (|', '$1', $text ); $text = preg_replace( '|

            ]*)>|i', '

            ', $text ); $text = str_replace( '

            ', '

            ', $text ); $text = preg_replace( '!

            \s*(]*>)!', '$1', $text ); $text = preg_replace( '!(]*>)\s*

            !', '$1', $text ); if ( $br ) { $text = preg_replace_callback( '/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $text ); $text = str_replace( array( '
            ', '
            ' ), '
            ', $text ); $text = preg_replace( '|(?)\s*\n|', "
            \n", $text ); $text = str_replace( '', "\n", $text ); } $text = preg_replace( '!(]*>)\s*
            !', '$1', $text ); $text = preg_replace( '!
            (\s*]*>)!', '$1', $text ); $text = preg_replace( "|\n

            $|", '

            ', $text ); if ( ! empty( $pre_tags ) ) { $text = str_replace( array_keys( $pre_tags ), array_values( $pre_tags ), $text ); } if ( false !== strpos( $text, '' ) ) { $text = str_replace( array( ' ', '' ), "\n", $text ); } return $text; } function wp_html_split( $input ) { return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE ); } function get_html_split_regex() { static $regex; if ( ! isset( $regex ) ) { $comments = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?'; $cdata = '!\[CDATA\[' . '[^\]]*+' . '(?:' . '](?!]>)' . '[^\]]*+' . ')*+' . '(?:]]>)?'; $escaped = '(?=' . '!--' . '|' . '!\[CDATA\[' . ')' . '(?(?=!-)' . $comments . '|' . $cdata . ')'; $regex = '/(' . '<' . '(?' . $escaped . '|' . '[^>]*>?' . ')' . ')/'; } return $regex; } function _get_wptexturize_split_regex( $shortcode_regex = '' ) { static $html_regex; if ( ! isset( $html_regex ) ) { $comment_regex = '!' . '(?:' . '-(?!->)' . '[^\-]*+' . ')*+' . '(?:-->)?'; $html_regex = '<' . '(?(?=!--)' . $comment_regex . '|' . '[^>]*>?' . ')'; } if ( empty( $shortcode_regex ) ) { $regex = '/(' . $html_regex . ')/'; } else { $regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/'; } return $regex; } function _get_wptexturize_shortcode_regex( $tagnames ) { $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); $tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; $regex = '\[' . '[\/\[]?' . $tagregexp . '(?:' . '[^\[\]<>]+' . '|' . '<[^\[\]>]*>' . ')*+' . '\]' . '\]?'; return $regex; } function wp_replace_in_html_tags( $haystack, $replace_pairs ) { $textarr = wp_html_split( $haystack ); $changed = false; if ( 1 === count( $replace_pairs ) ) { foreach ( $replace_pairs as $needle => $replace ) { } for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { if ( false !== strpos( $textarr[ $i ], $needle ) ) { $textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] ); $changed = true; } } } else { $needles = array_keys( $replace_pairs ); for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { foreach ( $needles as $needle ) { if ( false !== strpos( $textarr[ $i ], $needle ) ) { $textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs ); $changed = true; break; } } } } if ( $changed ) { $haystack = implode( $textarr ); } return $haystack; } function _autop_newline_preservation_helper( $matches ) { return str_replace( "\n", '', $matches[0] ); } function shortcode_unautop( $text ) { global $shortcode_tags; if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { return $text; } $tagregexp = implode( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); $spaces = wp_spaces_regexp(); $pattern = '/' . '

            ' . '(?:' . $spaces . ')*+' . '(' . '\\[' . "($tagregexp)" . '(?![\\w-])' . '[^\\]\\/]*' . '(?:' . '\\/(?!\\])' . '[^\\]\\/]*' . ')*?' . '(?:' . '\\/\\]' . '|' . '\\]' . '(?:' . '[^\\[]*+' . '(?:' . '\\[(?!\\/\\2\\])' . '[^\\[]*+' . ')*+' . '\\[\\/\\2\\]' . ')?' . ')' . ')' . '(?:' . $spaces . ')*+' . '<\\/p>' . '/'; return preg_replace( $pattern, '$1', $text ); } function seems_utf8( $str ) { mbstring_binary_safe_encoding(); $length = strlen( $str ); reset_mbstring_encoding(); for ( $i = 0; $i < $length; $i++ ) { $c = ord( $str[ $i ] ); if ( $c < 0x80 ) { $n = 0; } elseif ( ( $c & 0xE0 ) == 0xC0 ) { $n = 1; } elseif ( ( $c & 0xF0 ) == 0xE0 ) { $n = 2; } elseif ( ( $c & 0xF8 ) == 0xF0 ) { $n = 3; } elseif ( ( $c & 0xFC ) == 0xF8 ) { $n = 4; } elseif ( ( $c & 0xFE ) == 0xFC ) { $n = 5; } else { return false; } for ( $j = 0; $j < $n; $j++ ) { if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) { return false; } } } return true; } function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } if ( ! preg_match( '/[&<>"\']/', $string ) ) { return $string; } if ( empty( $quote_style ) ) { $quote_style = ENT_NOQUOTES; } elseif ( ENT_XML1 === $quote_style ) { $quote_style = ENT_QUOTES | ENT_XML1; } elseif ( ! in_array( $quote_style, array( ENT_NOQUOTES, ENT_COMPAT, ENT_QUOTES, 'single', 'double' ), true ) ) { $quote_style = ENT_QUOTES; } if ( ! $charset ) { static $_charset = null; if ( ! isset( $_charset ) ) { $alloptions = wp_load_alloptions(); $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : ''; } $charset = $_charset; } if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ), true ) ) { $charset = 'UTF-8'; } $_quote_style = $quote_style; if ( 'double' === $quote_style ) { $quote_style = ENT_COMPAT; $_quote_style = ENT_COMPAT; } elseif ( 'single' === $quote_style ) { $quote_style = ENT_NOQUOTES; } if ( ! $double_encode ) { $string = wp_kses_normalize_entities( $string, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' ); } $string = htmlspecialchars( $string, $quote_style, $charset, $double_encode ); if ( 'single' === $_quote_style ) { $string = str_replace( "'", ''', $string ); } return $string; } function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } if ( strpos( $string, '&' ) === false ) { return $string; } if ( empty( $quote_style ) ) { $quote_style = ENT_NOQUOTES; } elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { $quote_style = ENT_QUOTES; } $single = array( ''' => '\'', ''' => '\'', ); $single_preg = array( '/�*39;/' => ''', '/�*27;/i' => ''', ); $double = array( '"' => '"', '"' => '"', '"' => '"', ); $double_preg = array( '/�*34;/' => '"', '/�*22;/i' => '"', ); $others = array( '<' => '<', '<' => '<', '>' => '>', '>' => '>', '&' => '&', '&' => '&', '&' => '&', ); $others_preg = array( '/�*60;/' => '<', '/�*62;/' => '>', '/�*38;/' => '&', '/�*26;/i' => '&', ); if ( ENT_QUOTES === $quote_style ) { $translation = array_merge( $single, $double, $others ); $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); } elseif ( ENT_COMPAT === $quote_style || 'double' === $quote_style ) { $translation = array_merge( $double, $others ); $translation_preg = array_merge( $double_preg, $others_preg ); } elseif ( 'single' === $quote_style ) { $translation = array_merge( $single, $others ); $translation_preg = array_merge( $single_preg, $others_preg ); } elseif ( ENT_NOQUOTES === $quote_style ) { $translation = $others; $translation_preg = $others_preg; } $string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string ); return strtr( $string, $translation ); } function wp_check_invalid_utf8( $string, $strip = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } static $is_utf8 = null; if ( ! isset( $is_utf8 ) ) { $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ); } if ( ! $is_utf8 ) { return $string; } static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { $utf8_pcre = @preg_match( '/^./u', 'a' ); } if ( ! $utf8_pcre ) { return $string; } if ( 1 === @preg_match( '/^./us', $string ) ) { return $string; } if ( $strip && function_exists( 'iconv' ) ) { return iconv( 'utf-8', 'utf-8', $string ); } return ''; } function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters = false ) { $unicode = ''; $values = array(); $num_octets = 1; $unicode_length = 0; mbstring_binary_safe_encoding(); $string_length = strlen( $utf8_string ); reset_mbstring_encoding(); for ( $i = 0; $i < $string_length; $i++ ) { $value = ord( $utf8_string[ $i ] ); if ( $value < 128 ) { $char = chr( $value ); $encoded_char = $encode_ascii_characters ? rawurlencode( $char ) : $char; $encoded_char_length = strlen( $encoded_char ); if ( $length && ( $unicode_length + $encoded_char_length ) > $length ) { break; } $unicode .= $encoded_char; $unicode_length += $encoded_char_length; } else { if ( count( $values ) == 0 ) { if ( $value < 224 ) { $num_octets = 2; } elseif ( $value < 240 ) { $num_octets = 3; } else { $num_octets = 4; } } $values[] = $value; if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) { break; } if ( count( $values ) == $num_octets ) { for ( $j = 0; $j < $num_octets; $j++ ) { $unicode .= '%' . dechex( $values[ $j ] ); } $unicode_length += $num_octets * 3; $values = array(); $num_octets = 1; } } } return $unicode; } function remove_accents( $string, $locale = '' ) { if ( ! preg_match( '/[\x80-\xff]/', $string ) ) { return $string; } if ( seems_utf8( $string ) ) { $chars = array( 'ª' => 'a', 'º' => 'o', 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ý' => 'Y', 'Þ' => 'TH', 'ß' => 's', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ý' => 'y', 'þ' => 'th', 'ÿ' => 'y', 'Ø' => 'O', 'Ā' => 'A', 'ā' => 'a', 'Ă' => 'A', 'ă' => 'a', 'Ą' => 'A', 'ą' => 'a', 'Ć' => 'C', 'ć' => 'c', 'Ĉ' => 'C', 'ĉ' => 'c', 'Ċ' => 'C', 'ċ' => 'c', 'Č' => 'C', 'č' => 'c', 'Ď' => 'D', 'ď' => 'd', 'Đ' => 'D', 'đ' => 'd', 'Ē' => 'E', 'ē' => 'e', 'Ĕ' => 'E', 'ĕ' => 'e', 'Ė' => 'E', 'ė' => 'e', 'Ę' => 'E', 'ę' => 'e', 'Ě' => 'E', 'ě' => 'e', 'Ĝ' => 'G', 'ĝ' => 'g', 'Ğ' => 'G', 'ğ' => 'g', 'Ġ' => 'G', 'ġ' => 'g', 'Ģ' => 'G', 'ģ' => 'g', 'Ĥ' => 'H', 'ĥ' => 'h', 'Ħ' => 'H', 'ħ' => 'h', 'Ĩ' => 'I', 'ĩ' => 'i', 'Ī' => 'I', 'ī' => 'i', 'Ĭ' => 'I', 'ĭ' => 'i', 'Į' => 'I', 'į' => 'i', 'İ' => 'I', 'ı' => 'i', 'IJ' => 'IJ', 'ij' => 'ij', 'Ĵ' => 'J', 'ĵ' => 'j', 'Ķ' => 'K', 'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'L', 'ĺ' => 'l', 'Ļ' => 'L', 'ļ' => 'l', 'Ľ' => 'L', 'ľ' => 'l', 'Ŀ' => 'L', 'ŀ' => 'l', 'Ł' => 'L', 'ł' => 'l', 'Ń' => 'N', 'ń' => 'n', 'Ņ' => 'N', 'ņ' => 'n', 'Ň' => 'N', 'ň' => 'n', 'ʼn' => 'n', 'Ŋ' => 'N', 'ŋ' => 'n', 'Ō' => 'O', 'ō' => 'o', 'Ŏ' => 'O', 'ŏ' => 'o', 'Ő' => 'O', 'ő' => 'o', 'Œ' => 'OE', 'œ' => 'oe', 'Ŕ' => 'R', 'ŕ' => 'r', 'Ŗ' => 'R', 'ŗ' => 'r', 'Ř' => 'R', 'ř' => 'r', 'Ś' => 'S', 'ś' => 's', 'Ŝ' => 'S', 'ŝ' => 's', 'Ş' => 'S', 'ş' => 's', 'Š' => 'S', 'š' => 's', 'Ţ' => 'T', 'ţ' => 't', 'Ť' => 'T', 'ť' => 't', 'Ŧ' => 'T', 'ŧ' => 't', 'Ũ' => 'U', 'ũ' => 'u', 'Ū' => 'U', 'ū' => 'u', 'Ŭ' => 'U', 'ŭ' => 'u', 'Ů' => 'U', 'ů' => 'u', 'Ű' => 'U', 'ű' => 'u', 'Ų' => 'U', 'ų' => 'u', 'Ŵ' => 'W', 'ŵ' => 'w', 'Ŷ' => 'Y', 'ŷ' => 'y', 'Ÿ' => 'Y', 'Ź' => 'Z', 'ź' => 'z', 'Ż' => 'Z', 'ż' => 'z', 'Ž' => 'Z', 'ž' => 'z', 'ſ' => 's', 'Ș' => 'S', 'ș' => 's', 'Ț' => 'T', 'ț' => 't', '€' => 'E', '£' => '', 'Ơ' => 'O', 'ơ' => 'o', 'Ư' => 'U', 'ư' => 'u', 'Ầ' => 'A', 'ầ' => 'a', 'Ằ' => 'A', 'ằ' => 'a', 'Ề' => 'E', 'ề' => 'e', 'Ồ' => 'O', 'ồ' => 'o', 'Ờ' => 'O', 'ờ' => 'o', 'Ừ' => 'U', 'ừ' => 'u', 'Ỳ' => 'Y', 'ỳ' => 'y', 'Ả' => 'A', 'ả' => 'a', 'Ẩ' => 'A', 'ẩ' => 'a', 'Ẳ' => 'A', 'ẳ' => 'a', 'Ẻ' => 'E', 'ẻ' => 'e', 'Ể' => 'E', 'ể' => 'e', 'Ỉ' => 'I', 'ỉ' => 'i', 'Ỏ' => 'O', 'ỏ' => 'o', 'Ổ' => 'O', 'ổ' => 'o', 'Ở' => 'O', 'ở' => 'o', 'Ủ' => 'U', 'ủ' => 'u', 'Ử' => 'U', 'ử' => 'u', 'Ỷ' => 'Y', 'ỷ' => 'y', 'Ẫ' => 'A', 'ẫ' => 'a', 'Ẵ' => 'A', 'ẵ' => 'a', 'Ẽ' => 'E', 'ẽ' => 'e', 'Ễ' => 'E', 'ễ' => 'e', 'Ỗ' => 'O', 'ỗ' => 'o', 'Ỡ' => 'O', 'ỡ' => 'o', 'Ữ' => 'U', 'ữ' => 'u', 'Ỹ' => 'Y', 'ỹ' => 'y', 'Ấ' => 'A', 'ấ' => 'a', 'Ắ' => 'A', 'ắ' => 'a', 'Ế' => 'E', 'ế' => 'e', 'Ố' => 'O', 'ố' => 'o', 'Ớ' => 'O', 'ớ' => 'o', 'Ứ' => 'U', 'ứ' => 'u', 'Ạ' => 'A', 'ạ' => 'a', 'Ậ' => 'A', 'ậ' => 'a', 'Ặ' => 'A', 'ặ' => 'a', 'Ẹ' => 'E', 'ẹ' => 'e', 'Ệ' => 'E', 'ệ' => 'e', 'Ị' => 'I', 'ị' => 'i', 'Ọ' => 'O', 'ọ' => 'o', 'Ộ' => 'O', 'ộ' => 'o', 'Ợ' => 'O', 'ợ' => 'o', 'Ụ' => 'U', 'ụ' => 'u', 'Ự' => 'U', 'ự' => 'u', 'Ỵ' => 'Y', 'ỵ' => 'y', 'ɑ' => 'a', 'Ǖ' => 'U', 'ǖ' => 'u', 'Ǘ' => 'U', 'ǘ' => 'u', 'Ǎ' => 'A', 'ǎ' => 'a', 'Ǐ' => 'I', 'ǐ' => 'i', 'Ǒ' => 'O', 'ǒ' => 'o', 'Ǔ' => 'U', 'ǔ' => 'u', 'Ǚ' => 'U', 'ǚ' => 'u', 'Ǜ' => 'U', 'ǜ' => 'u', ); if ( empty( $locale ) ) { $locale = get_locale(); } if ( str_starts_with( $locale, 'de' ) ) { $chars['Ä'] = 'Ae'; $chars['ä'] = 'ae'; $chars['Ö'] = 'Oe'; $chars['ö'] = 'oe'; $chars['Ü'] = 'Ue'; $chars['ü'] = 'ue'; $chars['ß'] = 'ss'; } elseif ( 'da_DK' === $locale ) { $chars['Æ'] = 'Ae'; $chars['æ'] = 'ae'; $chars['Ø'] = 'Oe'; $chars['ø'] = 'oe'; $chars['Å'] = 'Aa'; $chars['å'] = 'aa'; } elseif ( 'ca' === $locale ) { $chars['l·l'] = 'll'; } elseif ( 'sr_RS' === $locale || 'bs_BA' === $locale ) { $chars['Đ'] = 'DJ'; $chars['đ'] = 'dj'; } $string = strtr( $string, $chars ); } else { $chars = array(); $chars['in'] = "\x80\x83\x8a\x8e\x9a\x9e" . "\x9f\xa2\xa5\xb5\xc0\xc1\xc2" . "\xc3\xc4\xc5\xc7\xc8\xc9\xca" . "\xcb\xcc\xcd\xce\xcf\xd1\xd2" . "\xd3\xd4\xd5\xd6\xd8\xd9\xda" . "\xdb\xdc\xdd\xe0\xe1\xe2\xe3" . "\xe4\xe5\xe7\xe8\xe9\xea\xeb" . "\xec\xed\xee\xef\xf1\xf2\xf3" . "\xf4\xf5\xf6\xf8\xf9\xfa\xfb" . "\xfc\xfd\xff"; $chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; $string = strtr( $string, $chars['in'], $chars['out'] ); $double_chars = array(); $double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" ); $double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' ); $string = str_replace( $double_chars['in'], $double_chars['out'], $string ); } return $string; } function sanitize_file_name( $filename ) { $filename_raw = $filename; $filename = remove_accents( $filename ); $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) ); static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { $utf8_pcre = @preg_match( '/^./u', 'a' ); } if ( ! seems_utf8( $filename ) ) { $_ext = pathinfo( $filename, PATHINFO_EXTENSION ); $_name = pathinfo( $filename, PATHINFO_FILENAME ); $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext; } if ( $utf8_pcre ) { $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); } $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); $filename = str_replace( $special_chars, '', $filename ); $filename = str_replace( array( '%20', '+' ), '-', $filename ); $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); $filename = trim( $filename, '.-_' ); if ( false === strpos( $filename, '.' ) ) { $mime_types = wp_get_mime_types(); $filetype = wp_check_filetype( 'test.' . $filename, $mime_types ); if ( $filetype['ext'] === $filename ) { $filename = 'unnamed-file.' . $filetype['ext']; } } $parts = explode( '.', $filename ); if ( count( $parts ) <= 2 ) { return apply_filters( 'sanitize_file_name', $filename, $filename_raw ); } $filename = array_shift( $parts ); $extension = array_pop( $parts ); $mimes = get_allowed_mime_types(); foreach ( (array) $parts as $part ) { $filename .= '.' . $part; if ( preg_match( '/^[a-zA-Z]{2,5}\d?$/', $part ) ) { $allowed = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!^(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $part ) ) { $allowed = true; break; } } if ( ! $allowed ) { $filename .= '_'; } } } $filename .= '.' . $extension; return apply_filters( 'sanitize_file_name', $filename, $filename_raw ); } function sanitize_user( $username, $strict = false ) { $raw_username = $username; $username = wp_strip_all_tags( $username ); $username = remove_accents( $username ); $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); $username = preg_replace( '/&.+?;/', '', $username ); if ( $strict ) { $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); } $username = trim( $username ); $username = preg_replace( '|\s+|', ' ', $username ); return apply_filters( 'sanitize_user', $username, $raw_username, $strict ); } function sanitize_key( $key ) { $sanitized_key = ''; if ( is_scalar( $key ) ) { $sanitized_key = strtolower( $key ); $sanitized_key = preg_replace( '/[^a-z0-9_\-]/', '', $sanitized_key ); } return apply_filters( 'sanitize_key', $sanitized_key, $key ); } function sanitize_title( $title, $fallback_title = '', $context = 'save' ) { $raw_title = $title; if ( 'save' === $context ) { $title = remove_accents( $title ); } $title = apply_filters( 'sanitize_title', $title, $raw_title, $context ); if ( '' === $title || false === $title ) { $title = $fallback_title; } return $title; } function sanitize_title_for_query( $title ) { return sanitize_title( $title, '', 'query' ); } function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { $title = strip_tags( $title ); $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); $title = str_replace( '%', '', $title ); $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); if ( seems_utf8( $title ) ) { if ( function_exists( 'mb_strtolower' ) ) { $title = mb_strtolower( $title, 'UTF-8' ); } $title = utf8_uri_encode( $title, 200 ); } $title = strtolower( $title ); if ( 'save' === $context ) { $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title ); $title = str_replace( '/', '-', $title ); $title = str_replace( array( '%c2%ad', '%c2%a1', '%c2%bf', '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba', '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d', '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f', '%e2%80%a2', '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2', '%c2%b4', '%cb%8a', '%cc%81', '%cd%81', '%cc%80', '%cc%84', '%cc%8c', '%e2%80%8b', '%e2%80%8c', '%e2%80%8d', '%e2%80%8e', '%e2%80%8f', '%e2%80%aa', '%e2%80%ab', '%e2%80%ac', '%e2%80%ad', '%e2%80%ae', '%ef%bb%bf', ), '', $title ); $title = str_replace( array( '%e2%80%80', '%e2%80%81', '%e2%80%82', '%e2%80%83', '%e2%80%84', '%e2%80%85', '%e2%80%86', '%e2%80%87', '%e2%80%88', '%e2%80%89', '%e2%80%8a', '%e2%80%a8', '%e2%80%a9', '%e2%80%af', ), '-', $title ); $title = str_replace( '%c3%97', 'x', $title ); } $title = preg_replace( '/&.+?;/', '', $title ); $title = str_replace( '.', '-', $title ); $title = preg_replace( '/[^%a-z0-9 _-]/', '', $title ); $title = preg_replace( '/\s+/', '-', $title ); $title = preg_replace( '|-+|', '-', $title ); $title = trim( $title, '-' ); return $title; } function sanitize_sql_orderby( $orderby ) { if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) { return $orderby; } return false; } function sanitize_html_class( $class, $fallback = '' ) { $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class ); $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized ); if ( '' === $sanitized && $fallback ) { return sanitize_html_class( $fallback ); } return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback ); } function convert_chars( $content, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '0.71' ); } if ( strpos( $content, '&' ) !== false ) { $content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content ); } return $content; } function convert_invalid_entities( $content ) { $wp_htmltranswinuni = array( '€' => '€', '' => '', '‚' => '‚', 'ƒ' => 'ƒ', '„' => '„', '…' => '…', '†' => '†', '‡' => '‡', 'ˆ' => 'ˆ', '‰' => '‰', 'Š' => 'Š', '‹' => '‹', 'Œ' => 'Œ', '' => '', 'Ž' => 'Ž', '' => '', '' => '', '‘' => '‘', '’' => '’', '“' => '“', '”' => '”', '•' => '•', '–' => '–', '—' => '—', '˜' => '˜', '™' => '™', 'š' => 'š', '›' => '›', 'œ' => 'œ', '' => '', 'ž' => 'ž', 'Ÿ' => 'Ÿ', ); if ( strpos( $content, '' ) !== false ) { $content = strtr( $content, $wp_htmltranswinuni ); } return $content; } function balanceTags( $text, $force = false ) { if ( $force || (int) get_option( 'use_balanceTags' ) === 1 ) { return force_balance_tags( $text ); } else { return $text; } } function force_balance_tags( $text ) { $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = ''; $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track', 'wbr' ); $nestable_tags = array( 'article', 'aside', 'blockquote', 'details', 'div', 'figure', 'object', 'q', 'section', 'span' ); $text = str_replace( '< !--', '< !--', $text ); $text = preg_replace( '#<([0-9]{1})#', '<$1', $text ); $tag_pattern = ( '#<' . '(/?)' . '(' . '(?:[a-z](?:[a-z0-9._]*)-(?:[a-z0-9._-]+)+)' . '|' . '(?:[\w:]+)' . ')' . '(?:' . '\s*' . '(/?)' . '|' . '(\s+)' . '([^>]*)' . ')' . '>#' ); while ( preg_match( $tag_pattern, $text, $regex ) ) { $full_match = $regex[0]; $has_leading_slash = ! empty( $regex[1] ); $tag_name = $regex[2]; $tag = strtolower( $tag_name ); $is_single_tag = in_array( $tag, $single_tags, true ); $pre_attribute_ws = isset( $regex[4] ) ? $regex[4] : ''; $attributes = trim( isset( $regex[5] ) ? $regex[5] : $regex[3] ); $has_self_closer = '/' === substr( $attributes, -1 ); $newtext .= $tagqueue; $i = strpos( $text, $full_match ); $l = strlen( $full_match ); $tagqueue = ''; if ( $has_leading_slash ) { if ( $stacksize <= 0 ) { $tag = ''; } elseif ( $tagstack[ $stacksize - 1 ] === $tag ) { $tag = ''; array_pop( $tagstack ); $stacksize--; } else { for ( $j = $stacksize - 1; $j >= 0; $j-- ) { if ( $tagstack[ $j ] === $tag ) { for ( $k = $stacksize - 1; $k >= $j; $k-- ) { $tagqueue .= ''; $stacksize--; } break; } } $tag = ''; } } else { if ( $has_self_closer ) { if ( ! $is_single_tag ) { $attributes = trim( substr( $attributes, 0, -1 ) ) . "> 0 && ! in_array( $tag, $nestable_tags, true ) && $tagstack[ $stacksize - 1 ] === $tag ) { $tagqueue = ''; $stacksize--; } $stacksize = array_push( $tagstack, $tag ); } if ( $has_self_closer && $is_single_tag ) { $pre_attribute_ws = ' '; } $tag = '<' . $tag . $pre_attribute_ws . $attributes . '>'; if ( ! empty( $tagqueue ) ) { $tagqueue .= $tag; $tag = ''; } } $newtext .= substr( $text, 0, $i ) . $tag; $text = substr( $text, $i + $l ); } $newtext .= $tagqueue; $newtext .= $text; while ( $x = array_pop( $tagstack ) ) { $newtext .= ''; } $newtext = str_replace( '< !--', ' - -

            - -
            - - - cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?> -
            - - - -
            - - -
              -
              -
              - -
              - -
              - - - -

              - - - - -

              -
              -
              - 'nav_menu_instance', 'render_callback' => array( $this, 'render_nav_menu_partial' ), 'container_inclusive' => true, 'settings' => array(), 'capability' => 'edit_theme_options', ) ); } return $partial_args; } public function customize_preview_init() { add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) ); add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 ); add_filter( 'wp_nav_menu', array( $this, 'filter_wp_nav_menu' ), 10, 2 ); add_filter( 'wp_footer', array( $this, 'export_preview_data' ), 1 ); add_filter( 'customize_render_partials_response', array( $this, 'export_partial_rendered_nav_menu_instances' ) ); } public function make_auto_draft_status_previewable() { global $wp_post_statuses; $wp_post_statuses['auto-draft']->protected = true; } public function sanitize_nav_menus_created_posts( $value ) { $post_ids = array(); foreach ( wp_parse_id_list( $value ) as $post_id ) { if ( empty( $post_id ) ) { continue; } $post = get_post( $post_id ); if ( 'auto-draft' !== $post->post_status && 'draft' !== $post->post_status ) { continue; } $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj ) { continue; } if ( ! current_user_can( $post_type_obj->cap->publish_posts ) || ! current_user_can( 'edit_post', $post_id ) ) { continue; } $post_ids[] = $post->ID; } return $post_ids; } public function save_nav_menus_created_posts( $setting ) { $post_ids = $setting->post_value(); if ( ! empty( $post_ids ) ) { foreach ( $post_ids as $post_id ) { $current_status = get_post_status( $post_id ); if ( 'auto-draft' !== $current_status && 'draft' !== $current_status ) { continue; } $target_status = 'attachment' === get_post_type( $post_id ) ? 'inherit' : 'publish'; $args = array( 'ID' => $post_id, 'post_status' => $target_status, ); $post_name = get_post_meta( $post_id, '_customize_draft_post_name', true ); if ( $post_name ) { $args['post_name'] = $post_name; } wp_update_post( wp_slash( $args ) ); delete_post_meta( $post_id, '_customize_draft_post_name' ); } } } public function filter_wp_nav_menu_args( $args ) { $can_partial_refresh = ( ! empty( $args['echo'] ) && ( empty( $args['fallback_cb'] ) || is_string( $args['fallback_cb'] ) ) && ( empty( $args['walker'] ) || is_string( $args['walker'] ) ) && ( ! empty( $args['theme_location'] ) || ( ! empty( $args['menu'] ) && ( is_numeric( $args['menu'] ) || is_object( $args['menu'] ) ) ) ) && ( ! empty( $args['container'] ) || ( isset( $args['items_wrap'] ) && '<' === substr( $args['items_wrap'], 0, 1 ) ) ) ); $args['can_partial_refresh'] = $can_partial_refresh; $exported_args = $args; if ( ! $can_partial_refresh ) { $exported_args['fallback_cb'] = ''; $exported_args['walker'] = ''; } if ( ! empty( $exported_args['menu'] ) && is_object( $exported_args['menu'] ) ) { $exported_args['menu'] = $exported_args['menu']->term_id; } ksort( $exported_args ); $exported_args['args_hmac'] = $this->hash_nav_menu_args( $exported_args ); $args['customize_preview_nav_menus_args'] = $exported_args; $this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args; return $args; } public function filter_wp_nav_menu( $nav_menu_content, $args ) { if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) { $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) ); $attributes .= ' data-customize-partial-type="nav_menu_instance"'; $attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) ); $nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . str_replace( '\\', '\\\\', $attributes ), $nav_menu_content, 1 ); } return $nav_menu_content; } public function hash_nav_menu_args( $args ) { return wp_hash( serialize( $args ) ); } public function customize_preview_enqueue_deps() { wp_enqueue_script( 'customize-preview-nav-menus' ); } public function export_preview_data() { $exports = array( 'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args, ); printf( '', wp_json_encode( $exports ) ); } public function export_partial_rendered_nav_menu_instances( $response ) { $response['nav_menu_instance_args'] = $this->preview_nav_menu_instance_args; return $response; } public function render_nav_menu_partial( $partial, $nav_menu_args ) { unset( $partial ); if ( ! isset( $nav_menu_args['args_hmac'] ) ) { return false; } $nav_menu_args_hmac = $nav_menu_args['args_hmac']; unset( $nav_menu_args['args_hmac'] ); ksort( $nav_menu_args ); if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) { return false; } ob_start(); wp_nav_menu( $nav_menu_args ); $content = ob_get_clean(); return $content; } } public_query_vars, true ) ) { $this->public_query_vars[] = $qv; } } public function remove_query_var( $name ) { $this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) ); } public function set_query_var( $key, $value ) { $this->query_vars[ $key ] = $value; } public function parse_request( $extra_query_vars = '' ) { global $wp_rewrite; if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) { return false; } $this->query_vars = array(); $post_type_query_vars = array(); if ( is_array( $extra_query_vars ) ) { $this->extra_query_vars = & $extra_query_vars; } elseif ( ! empty( $extra_query_vars ) ) { parse_str( $extra_query_vars, $this->extra_query_vars ); } $rewrite = $wp_rewrite->wp_rewrite_rules(); if ( ! empty( $rewrite ) ) { $error = '404'; $this->did_permalink = true; $pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : ''; list( $pathinfo ) = explode( '?', $pathinfo ); $pathinfo = str_replace( '%', '%25', $pathinfo ); list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] ); $self = $_SERVER['PHP_SELF']; $home_path = parse_url( home_url(), PHP_URL_PATH ); $home_path_regex = ''; if ( is_string( $home_path ) && '' !== $home_path ) { $home_path = trim( $home_path, '/' ); $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); } $req_uri = str_replace( $pathinfo, '', $req_uri ); $req_uri = trim( $req_uri, '/' ); $pathinfo = trim( $pathinfo, '/' ); $self = trim( $self, '/' ); if ( ! empty( $home_path_regex ) ) { $req_uri = preg_replace( $home_path_regex, '', $req_uri ); $req_uri = trim( $req_uri, '/' ); $pathinfo = preg_replace( $home_path_regex, '', $pathinfo ); $pathinfo = trim( $pathinfo, '/' ); $self = preg_replace( $home_path_regex, '', $self ); $self = trim( $self, '/' ); } if ( ! empty( $pathinfo ) && ! preg_match( '|^.*' . $wp_rewrite->index . '$|', $pathinfo ) ) { $requested_path = $pathinfo; } else { if ( $req_uri == $wp_rewrite->index ) { $req_uri = ''; } $requested_path = $req_uri; } $requested_file = $req_uri; $this->request = $requested_path; $request_match = $requested_path; if ( empty( $request_match ) ) { if ( isset( $rewrite['$'] ) ) { $this->matched_rule = '$'; $query = $rewrite['$']; $matches = array( '' ); } } else { foreach ( (array) $rewrite as $match => $query ) { if ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) { $request_match = $requested_file . '/' . $requested_path; } if ( preg_match( "#^$match#", $request_match, $matches ) || preg_match( "#^$match#", urldecode( $request_match ), $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } $this->matched_rule = $match; break; } } } if ( ! empty( $this->matched_rule ) ) { $query = preg_replace( '!^.+\?!', '', $query ); $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); $this->matched_query = $query; parse_str( $query, $perma_query_vars ); if ( '404' == $error ) { unset( $error, $_GET['error'] ); } } if ( empty( $requested_path ) || $requested_file == $self || strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { unset( $error, $_GET['error'] ); if ( isset( $perma_query_vars ) && strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) { unset( $perma_query_vars ); } $this->did_permalink = false; } } $this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars ); foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { if ( is_post_type_viewable( $t ) && $t->query_var ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } foreach ( $this->public_query_vars as $wpvar ) { if ( isset( $this->extra_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $this->extra_query_vars[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_POST[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_POST[ $wpvar ]; } elseif ( isset( $_GET[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $_GET[ $wpvar ]; } elseif ( isset( $perma_query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = $perma_query_vars[ $wpvar ]; } if ( ! empty( $this->query_vars[ $wpvar ] ) ) { if ( ! is_array( $this->query_vars[ $wpvar ] ) ) { $this->query_vars[ $wpvar ] = (string) $this->query_vars[ $wpvar ]; } else { foreach ( $this->query_vars[ $wpvar ] as $vkey => $v ) { if ( is_scalar( $v ) ) { $this->query_vars[ $wpvar ][ $vkey ] = (string) $v; } } } if ( isset( $post_type_query_vars[ $wpvar ] ) ) { $this->query_vars['post_type'] = $post_type_query_vars[ $wpvar ]; $this->query_vars['name'] = $this->query_vars[ $wpvar ]; } } } foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) { if ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) { $this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] ); } } if ( ! is_admin() ) { foreach ( get_taxonomies( array( 'publicly_queryable' => false ), 'objects' ) as $taxonomy => $t ) { if ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) { unset( $this->query_vars['taxonomy'], $this->query_vars['term'] ); } } } if ( isset( $this->query_vars['post_type'] ) ) { $queryable_post_types = get_post_types( array( 'publicly_queryable' => true ) ); if ( ! is_array( $this->query_vars['post_type'] ) ) { if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types, true ) ) { unset( $this->query_vars['post_type'] ); } } else { $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types ); } } $this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars ); foreach ( (array) $this->private_query_vars as $var ) { if ( isset( $this->extra_query_vars[ $var ] ) ) { $this->query_vars[ $var ] = $this->extra_query_vars[ $var ]; } } if ( isset( $error ) ) { $this->query_vars['error'] = $error; } $this->query_vars = apply_filters( 'request', $this->query_vars ); do_action_ref_array( 'parse_request', array( &$this ) ); return true; } public function send_headers() { $headers = array(); $status = null; $exit_required = false; $date_format = 'D, d M Y H:i:s'; if ( is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } elseif ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $expires = 10 * MINUTE_IN_SECONDS; $headers['Expires'] = gmdate( $date_format, time() + $expires ); $headers['Cache-Control'] = sprintf( 'max-age=%d, must-revalidate', $expires ); } if ( ! empty( $this->query_vars['error'] ) ) { $status = (int) $this->query_vars['error']; if ( 404 === $status ) { if ( ! is_user_logged_in() ) { $headers = array_merge( $headers, wp_get_nocache_headers() ); } $headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ); } elseif ( in_array( $status, array( 403, 500, 502, 503 ), true ) ) { $exit_required = true; } } elseif ( empty( $this->query_vars['feed'] ) ) { $headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ); } else { $type = $this->query_vars['feed']; if ( 'feed' === $this->query_vars['feed'] ) { $type = get_default_feed(); } $headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' ); if ( ! empty( $this->query_vars['withcomments'] ) || false !== strpos( $this->query_vars['feed'], 'comments-' ) || ( empty( $this->query_vars['withoutcomments'] ) && ( ! empty( $this->query_vars['p'] ) || ! empty( $this->query_vars['name'] ) || ! empty( $this->query_vars['page_id'] ) || ! empty( $this->query_vars['pagename'] ) || ! empty( $this->query_vars['attachment'] ) || ! empty( $this->query_vars['attachment_id'] ) ) ) ) { $wp_last_modified_post = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false ); $wp_last_modified_comment = mysql2date( $date_format, get_lastcommentmodified( 'GMT' ), false ); if ( strtotime( $wp_last_modified_post ) > strtotime( $wp_last_modified_comment ) ) { $wp_last_modified = $wp_last_modified_post; } else { $wp_last_modified = $wp_last_modified_comment; } } else { $wp_last_modified = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false ); } if ( ! $wp_last_modified ) { $wp_last_modified = gmdate( $date_format ); } $wp_last_modified .= ' GMT'; $wp_etag = '"' . md5( $wp_last_modified ) . '"'; $headers['Last-Modified'] = $wp_last_modified; $headers['ETag'] = $wp_etag; if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) { $client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] ); } else { $client_etag = false; } $client_last_modified = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; $wp_modified_timestamp = strtotime( $wp_last_modified ); if ( ( $client_last_modified && $client_etag ) ? ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag == $wp_etag ) ) : ( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag == $wp_etag ) ) ) { $status = 304; $exit_required = true; } } $headers = apply_filters( 'wp_headers', $headers, $this ); if ( ! empty( $status ) ) { status_header( $status ); } if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) { unset( $headers['Last-Modified'] ); if ( ! headers_sent() ) { header_remove( 'Last-Modified' ); } } if ( ! headers_sent() ) { foreach ( (array) $headers as $name => $field_value ) { header( "{$name}: {$field_value}" ); } } if ( $exit_required ) { exit; } do_action_ref_array( 'send_headers', array( &$this ) ); } public function build_query_string() { $this->query_string = ''; foreach ( (array) array_keys( $this->query_vars ) as $wpvar ) { if ( '' != $this->query_vars[ $wpvar ] ) { $this->query_string .= ( strlen( $this->query_string ) < 1 ) ? '' : '&'; if ( ! is_scalar( $this->query_vars[ $wpvar ] ) ) { continue; } $this->query_string .= $wpvar . '=' . rawurlencode( $this->query_vars[ $wpvar ] ); } } if ( has_filter( 'query_string' ) ) { $this->query_string = apply_filters_deprecated( 'query_string', array( $this->query_string ), '2.1.0', 'query_vars, request' ); parse_str( $this->query_string, $this->query_vars ); } } public function register_globals() { global $wp_query; foreach ( (array) $wp_query->query_vars as $key => $value ) { $GLOBALS[ $key ] = $value; } $GLOBALS['query_string'] = $this->query_string; $GLOBALS['posts'] = & $wp_query->posts; $GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null; $GLOBALS['request'] = $wp_query->request; if ( $wp_query->is_single() || $wp_query->is_page() ) { $GLOBALS['more'] = 1; $GLOBALS['single'] = 1; } if ( $wp_query->is_author() ) { $GLOBALS['authordata'] = get_userdata( get_queried_object_id() ); } } public function init() { wp_get_current_user(); } public function query_posts() { global $wp_the_query; $this->build_query_string(); $wp_the_query->query( $this->query_vars ); } public function handle_404() { global $wp_query; if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) { return; } if ( is_404() ) { return; } $set_404 = true; if ( is_admin() || is_robots() || is_favicon() ) { $set_404 = false; } elseif ( $wp_query->posts ) { $content_found = true; if ( is_singular() ) { $post = isset( $wp_query->post ) ? $wp_query->post : null; if ( $post && pings_open( $post ) && ! headers_sent() ) { header( 'X-Pingback: ' . get_bloginfo( 'pingback_url', 'display' ) ); } $next = ''; if ( $post && ! empty( $this->query_vars['page'] ) ) { if ( false !== strpos( $post->post_content, $next ) ) { $page = trim( $this->query_vars['page'], '/' ); $content_found = (int) $page <= ( substr_count( $post->post_content, $next ) + 1 ); } else { $content_found = false; } } } if ( $wp_query->is_posts_page && ! empty( $this->query_vars['page'] ) ) { $content_found = false; } if ( $content_found ) { $set_404 = false; } } elseif ( ! is_paged() ) { $author = get_query_var( 'author' ); if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) || ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() || is_home() || is_search() || is_feed() ) { $set_404 = false; } } if ( $set_404 ) { $wp_query->set_404(); status_header( 404 ); nocache_headers(); } else { status_header( 200 ); } } public function main( $query_args = '' ) { $this->init(); $parsed = $this->parse_request( $query_args ); $this->send_headers(); if ( $parsed ) { $this->query_posts(); $this->handle_404(); $this->register_globals(); } do_action_ref_array( 'wp', array( &$this ) ); } } 'parent', 'id' => 'term_id', ); public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $category = $data_object; $pad = str_repeat( ' ', $depth * 3 ); $cat_name = apply_filters( 'list_cats', $category->name, $category ); if ( isset( $args['value_field'] ) && isset( $category->{$args['value_field']} ) ) { $value_field = $args['value_field']; } else { $value_field = 'term_id'; } $output .= "\t\n"; } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); public $meta_query = false; protected $meta_query_clauses; public $date_query = false; public $query_vars; public $query_var_defaults; public $sites; public $found_sites = 0; public $max_num_pages = 0; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'fields' => '', 'ID' => '', 'site__in' => '', 'site__not_in' => '', 'number' => 100, 'offset' => '', 'no_found_rows' => true, 'orderby' => 'id', 'order' => 'ASC', 'network_id' => 0, 'network__in' => '', 'network__not_in' => '', 'domain' => '', 'domain__in' => '', 'domain__not_in' => '', 'path' => '', 'path__in' => '', 'path__not_in' => '', 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'lang_id' => null, 'lang__in' => '', 'lang__not_in' => '', 'search' => '', 'search_columns' => array(), 'count' => false, 'date_query' => null, 'update_site_cache' => true, 'update_site_meta_cache' => true, 'meta_query' => '', 'meta_key' => '', 'meta_value' => '', 'meta_type' => '', 'meta_compare' => '', ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_site_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_sites(); } public function get_sites() { global $wpdb; $this->parse_query(); $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $this->query_vars ); do_action_ref_array( 'pre_get_sites', array( &$this ) ); $this->meta_query->parse_query_vars( $this->query_vars ); if ( ! empty( $this->meta_query->queries ) ) { $this->meta_query_clauses = $this->meta_query->get_sql( 'blog', $wpdb->blogs, 'blog_id', $this ); } $site_data = null; $site_data = apply_filters_ref_array( 'sites_pre_query', array( $site_data, &$this ) ); if ( null !== $site_data ) { if ( is_array( $site_data ) && ! $this->query_vars['count'] ) { $this->sites = $site_data; } return $site_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_site_cache'], $_args['update_site_meta_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'sites' ); $cache_key = "get_sites:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'sites' ); if ( false === $cache_value ) { $site_ids = $this->get_site_ids(); if ( $site_ids ) { $this->set_found_sites(); } $cache_value = array( 'site_ids' => $site_ids, 'found_sites' => $this->found_sites, ); wp_cache_add( $cache_key, $cache_value, 'sites' ); } else { $site_ids = $cache_value['site_ids']; $this->found_sites = $cache_value['found_sites']; } if ( $this->found_sites && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $site_ids; } $site_ids = array_map( 'intval', $site_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->sites = $site_ids; return $this->sites; } if ( $this->query_vars['update_site_cache'] ) { _prime_site_caches( $site_ids, $this->query_vars['update_site_meta_cache'] ); } $_sites = array(); foreach ( $site_ids as $site_id ) { $_site = get_site( $site_id ); if ( $_site ) { $_sites[] = $_site; } } $_sites = apply_filters_ref_array( 'the_sites', array( $_sites, &$this ) ); $this->sites = array_map( 'get_site', $_sites ); return $this->sites; } protected function get_site_ids() { global $wpdb; $order = $this->parse_order( $this->query_vars['order'] ); if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'site__in' === $_orderby || 'network__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "{$wpdb->blogs}.blog_id $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "{$wpdb->blogs}.blog_id"; } $site_id = absint( $this->query_vars['ID'] ); if ( ! empty( $site_id ) ) { $this->sql_clauses['where']['ID'] = $wpdb->prepare( "{$wpdb->blogs}.blog_id = %d", $site_id ); } if ( ! empty( $this->query_vars['site__in'] ) ) { $this->sql_clauses['where']['site__in'] = "{$wpdb->blogs}.blog_id IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['site__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['site__not_in'] ) ) { $this->sql_clauses['where']['site__not_in'] = "{$wpdb->blogs}.blog_id NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['site__not_in'] ) ) . ' )'; } $network_id = absint( $this->query_vars['network_id'] ); if ( ! empty( $network_id ) ) { $this->sql_clauses['where']['network_id'] = $wpdb->prepare( 'site_id = %d', $network_id ); } if ( ! empty( $this->query_vars['network__in'] ) ) { $this->sql_clauses['where']['network__in'] = 'site_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['network__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['network__not_in'] ) ) { $this->sql_clauses['where']['network__not_in'] = 'site_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['network__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['domain'] ) ) { $this->sql_clauses['where']['domain'] = $wpdb->prepare( 'domain = %s', $this->query_vars['domain'] ); } if ( is_array( $this->query_vars['domain__in'] ) ) { $this->sql_clauses['where']['domain__in'] = "domain IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['domain__not_in'] ) ) { $this->sql_clauses['where']['domain__not_in'] = "domain NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__not_in'] ) ) . "' )"; } if ( ! empty( $this->query_vars['path'] ) ) { $this->sql_clauses['where']['path'] = $wpdb->prepare( 'path = %s', $this->query_vars['path'] ); } if ( is_array( $this->query_vars['path__in'] ) ) { $this->sql_clauses['where']['path__in'] = "path IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['path__not_in'] ) ) { $this->sql_clauses['where']['path__not_in'] = "path NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__not_in'] ) ) . "' )"; } if ( is_numeric( $this->query_vars['archived'] ) ) { $archived = absint( $this->query_vars['archived'] ); $this->sql_clauses['where']['archived'] = $wpdb->prepare( 'archived = %s ', absint( $archived ) ); } if ( is_numeric( $this->query_vars['mature'] ) ) { $mature = absint( $this->query_vars['mature'] ); $this->sql_clauses['where']['mature'] = $wpdb->prepare( 'mature = %d ', $mature ); } if ( is_numeric( $this->query_vars['spam'] ) ) { $spam = absint( $this->query_vars['spam'] ); $this->sql_clauses['where']['spam'] = $wpdb->prepare( 'spam = %d ', $spam ); } if ( is_numeric( $this->query_vars['deleted'] ) ) { $deleted = absint( $this->query_vars['deleted'] ); $this->sql_clauses['where']['deleted'] = $wpdb->prepare( 'deleted = %d ', $deleted ); } if ( is_numeric( $this->query_vars['public'] ) ) { $public = absint( $this->query_vars['public'] ); $this->sql_clauses['where']['public'] = $wpdb->prepare( 'public = %d ', $public ); } if ( is_numeric( $this->query_vars['lang_id'] ) ) { $lang_id = absint( $this->query_vars['lang_id'] ); $this->sql_clauses['where']['lang_id'] = $wpdb->prepare( 'lang_id = %d ', $lang_id ); } if ( ! empty( $this->query_vars['lang__in'] ) ) { $this->sql_clauses['where']['lang__in'] = 'lang_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['lang__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['lang__not_in'] ) ) { $this->sql_clauses['where']['lang__not_in'] = 'lang_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['lang__not_in'] ) ) . ' )'; } if ( strlen( $this->query_vars['search'] ) ) { $search_columns = array(); if ( $this->query_vars['search_columns'] ) { $search_columns = array_intersect( $this->query_vars['search_columns'], array( 'domain', 'path' ) ); } if ( ! $search_columns ) { $search_columns = array( 'domain', 'path' ); } $search_columns = apply_filters( 'site_search_columns', $search_columns, $this->query_vars['search'], $this ); $this->sql_clauses['where']['search'] = $this->get_search_sql( $this->query_vars['search'], $search_columns ); } $date_query = $this->query_vars['date_query']; if ( ! empty( $date_query ) && is_array( $date_query ) ) { $this->date_query = new WP_Date_Query( $date_query, 'registered' ); $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } $join = ''; $groupby = ''; if ( ! empty( $this->meta_query_clauses ) ) { $join .= $this->meta_query_clauses['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $this->meta_query_clauses['where'] ); if ( ! $this->query_vars['count'] ) { $groupby = "{$wpdb->blogs}.blog_id"; } } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->blogs $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } $site_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $site_ids ); } private function set_found_sites() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_sites_query = apply_filters( 'found_sites_query', 'SELECT FOUND_ROWS()', $this ); $this->found_sites = (int) $wpdb->get_var( $found_sites_query ); } } protected function get_search_sql( $search, $columns ) { global $wpdb; if ( false !== strpos( $search, '*' ) ) { $like = '%' . implode( '%', array_map( array( $wpdb, 'esc_like' ), explode( '*', $search ) ) ) . '%'; } else { $like = '%' . $wpdb->esc_like( $search ) . '%'; } $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return '(' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $parsed = false; switch ( $orderby ) { case 'site__in': $site__in = implode( ',', array_map( 'absint', $this->query_vars['site__in'] ) ); $parsed = "FIELD( {$wpdb->blogs}.blog_id, $site__in )"; break; case 'network__in': $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->blogs}.site_id, $network__in )"; break; case 'domain': case 'last_updated': case 'path': case 'registered': case 'deleted': case 'spam': case 'mature': case 'archived': case 'public': $parsed = $orderby; break; case 'network_id': $parsed = 'site_id'; break; case 'domain_length': $parsed = 'CHAR_LENGTH(domain)'; break; case 'path_length': $parsed = 'CHAR_LENGTH(path)'; break; case 'id': $parsed = "{$wpdb->blogs}.blog_id"; break; } if ( ! empty( $parsed ) || empty( $this->meta_query_clauses ) ) { return $parsed; } $meta_clauses = $this->meta_query->get_clauses(); if ( empty( $meta_clauses ) ) { return $parsed; } $primary_meta_query = reset( $meta_clauses ); if ( ! empty( $primary_meta_query['key'] ) && $primary_meta_query['key'] === $orderby ) { $orderby = 'meta_value'; } switch ( $orderby ) { case 'meta_value': if ( ! empty( $primary_meta_query['type'] ) ) { $parsed = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})"; } else { $parsed = "{$primary_meta_query['alias']}.meta_value"; } break; case 'meta_value_num': $parsed = "{$primary_meta_query['alias']}.meta_value+0"; break; default: if ( isset( $meta_clauses[ $orderby ] ) ) { $meta_clause = $meta_clauses[ $orderby ]; $parsed = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})"; } } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'ASC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->sections = array(); } final public function active() { $panel = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_panel_active', $active, $panel ); return $active; } public function active_callback() { return true; } public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type' ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; $array['autoExpandSoleSection'] = $this->auto_expand_sole_section; return $array; } public function check_capabilities() { if ( $this->capability && ! current_user_can( $this->capability ) ) { return false; } if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_panel', $this ); do_action( "customize_render_panel_{$this->id}" ); $this->render(); } protected function render() {} protected function render_content() {} public function print_template() { ?> - - - -
            • -

              - {{ data.title }} - -

              -
                -
              • - -
              • - -
                - - {{ data.title }}' ); ?> - - <# if ( data.description ) { #> - - <# } #> -
                - <# if ( data.description ) { #> -
                - {{{ data.description }}} -
                - <# } #> - -
                -
              • - array(), 'a' => array( 'href' => true, 'rel' => true, 'rev' => true, 'name' => true, 'target' => true, 'download' => array( 'valueless' => 'y', ), ), 'abbr' => array(), 'acronym' => array(), 'area' => array( 'alt' => true, 'coords' => true, 'href' => true, 'nohref' => true, 'shape' => true, 'target' => true, ), 'article' => array( 'align' => true, ), 'aside' => array( 'align' => true, ), 'audio' => array( 'autoplay' => true, 'controls' => true, 'loop' => true, 'muted' => true, 'preload' => true, 'src' => true, ), 'b' => array(), 'bdo' => array(), 'big' => array(), 'blockquote' => array( 'cite' => true, ), 'br' => array(), 'button' => array( 'disabled' => true, 'name' => true, 'type' => true, 'value' => true, ), 'caption' => array( 'align' => true, ), 'cite' => array(), 'code' => array(), 'col' => array( 'align' => true, 'char' => true, 'charoff' => true, 'span' => true, 'valign' => true, 'width' => true, ), 'colgroup' => array( 'align' => true, 'char' => true, 'charoff' => true, 'span' => true, 'valign' => true, 'width' => true, ), 'del' => array( 'datetime' => true, ), 'dd' => array(), 'dfn' => array(), 'details' => array( 'align' => true, 'open' => true, ), 'div' => array( 'align' => true, ), 'dl' => array(), 'dt' => array(), 'em' => array(), 'fieldset' => array(), 'figure' => array( 'align' => true, ), 'figcaption' => array( 'align' => true, ), 'font' => array( 'color' => true, 'face' => true, 'size' => true, ), 'footer' => array( 'align' => true, ), 'h1' => array( 'align' => true, ), 'h2' => array( 'align' => true, ), 'h3' => array( 'align' => true, ), 'h4' => array( 'align' => true, ), 'h5' => array( 'align' => true, ), 'h6' => array( 'align' => true, ), 'header' => array( 'align' => true, ), 'hgroup' => array( 'align' => true, ), 'hr' => array( 'align' => true, 'noshade' => true, 'size' => true, 'width' => true, ), 'i' => array(), 'img' => array( 'alt' => true, 'align' => true, 'border' => true, 'height' => true, 'hspace' => true, 'loading' => true, 'longdesc' => true, 'vspace' => true, 'src' => true, 'usemap' => true, 'width' => true, ), 'ins' => array( 'datetime' => true, 'cite' => true, ), 'kbd' => array(), 'label' => array( 'for' => true, ), 'legend' => array( 'align' => true, ), 'li' => array( 'align' => true, 'value' => true, ), 'main' => array( 'align' => true, ), 'map' => array( 'name' => true, ), 'mark' => array(), 'menu' => array( 'type' => true, ), 'nav' => array( 'align' => true, ), 'object' => array( 'data' => array( 'required' => true, 'value_callback' => '_wp_kses_allow_pdf_objects', ), 'type' => array( 'required' => true, 'values' => array( 'application/pdf' ), ), ), 'p' => array( 'align' => true, ), 'pre' => array( 'width' => true, ), 'q' => array( 'cite' => true, ), 'rb' => array(), 'rp' => array(), 'rt' => array(), 'rtc' => array(), 'ruby' => array(), 's' => array(), 'samp' => array(), 'span' => array( 'align' => true, ), 'section' => array( 'align' => true, ), 'small' => array(), 'strike' => array(), 'strong' => array(), 'sub' => array(), 'summary' => array( 'align' => true, ), 'sup' => array(), 'table' => array( 'align' => true, 'bgcolor' => true, 'border' => true, 'cellpadding' => true, 'cellspacing' => true, 'rules' => true, 'summary' => true, 'width' => true, ), 'tbody' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'td' => array( 'abbr' => true, 'align' => true, 'axis' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'colspan' => true, 'headers' => true, 'height' => true, 'nowrap' => true, 'rowspan' => true, 'scope' => true, 'valign' => true, 'width' => true, ), 'textarea' => array( 'cols' => true, 'rows' => true, 'disabled' => true, 'name' => true, 'readonly' => true, ), 'tfoot' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'th' => array( 'abbr' => true, 'align' => true, 'axis' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'colspan' => true, 'headers' => true, 'height' => true, 'nowrap' => true, 'rowspan' => true, 'scope' => true, 'valign' => true, 'width' => true, ), 'thead' => array( 'align' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'title' => array(), 'tr' => array( 'align' => true, 'bgcolor' => true, 'char' => true, 'charoff' => true, 'valign' => true, ), 'track' => array( 'default' => true, 'kind' => true, 'label' => true, 'src' => true, 'srclang' => true, ), 'tt' => array(), 'u' => array(), 'ul' => array( 'type' => true, ), 'ol' => array( 'start' => true, 'type' => true, 'reversed' => true, ), 'var' => array(), 'video' => array( 'autoplay' => true, 'controls' => true, 'height' => true, 'loop' => true, 'muted' => true, 'playsinline' => true, 'poster' => true, 'preload' => true, 'src' => true, 'width' => true, ), ); $allowedtags = array( 'a' => array( 'href' => true, 'title' => true, ), 'abbr' => array( 'title' => true, ), 'acronym' => array( 'title' => true, ), 'b' => array(), 'blockquote' => array( 'cite' => true, ), 'cite' => array(), 'code' => array(), 'del' => array( 'datetime' => true, ), 'em' => array(), 'i' => array(), 'q' => array( 'cite' => true, ), 's' => array(), 'strike' => array(), 'strong' => array(), ); $allowedentitynames = array( 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', 'sup1', 'sup2', 'sup3', 'frac14', 'frac12', 'frac34', 'there4', ); $allowedxmlentitynames = array( 'amp', 'lt', 'gt', 'apos', 'quot', ); $allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags ); } else { $allowedtags = wp_kses_array_lc( $allowedtags ); $allowedposttags = wp_kses_array_lc( $allowedposttags ); } function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) { if ( empty( $allowed_protocols ) ) { $allowed_protocols = wp_allowed_protocols(); } $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) ); $string = wp_kses_normalize_entities( $string ); $string = wp_kses_hook( $string, $allowed_html, $allowed_protocols ); return wp_kses_split( $string, $allowed_html, $allowed_protocols ); } function wp_kses_one_attr( $string, $element ) { $uris = wp_kses_uri_attributes(); $allowed_html = wp_kses_allowed_html( 'post' ); $allowed_protocols = wp_allowed_protocols(); $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) ); $matches = array(); preg_match( '/^\s*/', $string, $matches ); $lead = $matches[0]; preg_match( '/\s*$/', $string, $matches ); $trail = $matches[0]; if ( empty( $trail ) ) { $string = substr( $string, strlen( $lead ) ); } else { $string = substr( $string, strlen( $lead ), -strlen( $trail ) ); } $split = preg_split( '/\s*=\s*/', $string, 2 ); $name = $split[0]; if ( count( $split ) == 2 ) { $value = $split[1]; if ( '' === $value ) { $quote = ''; } else { $quote = $value[0]; } if ( '"' === $quote || "'" === $quote ) { if ( substr( $value, -1 ) != $quote ) { return ''; } $value = substr( $value, 1, -1 ); } else { $quote = '"'; } $value = esc_attr( $value ); if ( in_array( strtolower( $name ), $uris, true ) ) { $value = wp_kses_bad_protocol( $value, $allowed_protocols ); } $string = "$name=$quote$value$quote"; $vless = 'n'; } else { $value = ''; $vless = 'y'; } wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html ); return $lead . $string . $trail; } function wp_kses_allowed_html( $context = '' ) { global $allowedposttags, $allowedtags, $allowedentitynames; if ( is_array( $context ) ) { $html = $context; $context = 'explicit'; return apply_filters( 'wp_kses_allowed_html', $html, $context ); } switch ( $context ) { case 'post': $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context ); if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) { $tags = $allowedposttags; $tags['form'] = array( 'action' => true, 'accept' => true, 'accept-charset' => true, 'enctype' => true, 'method' => true, 'name' => true, 'target' => true, ); $tags = apply_filters( 'wp_kses_allowed_html', $tags, $context ); } return $tags; case 'user_description': case 'pre_user_description': $tags = $allowedtags; $tags['a']['rel'] = true; return apply_filters( 'wp_kses_allowed_html', $tags, $context ); case 'strip': return apply_filters( 'wp_kses_allowed_html', array(), $context ); case 'entities': return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context ); case 'data': default: return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context ); } } function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) { return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols ); } function wp_kses_version() { return '0.2.2'; } function wp_kses_split( $string, $allowed_html, $allowed_protocols ) { global $pass_allowed_html, $pass_allowed_protocols; $pass_allowed_html = $allowed_html; $pass_allowed_protocols = $allowed_protocols; return preg_replace_callback( '%(|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string ); } function wp_kses_uri_attributes() { $uri_attributes = array( 'action', 'archive', 'background', 'cite', 'classid', 'codebase', 'data', 'formaction', 'href', 'icon', 'longdesc', 'manifest', 'poster', 'profile', 'src', 'usemap', 'xmlns', ); $uri_attributes = apply_filters( 'wp_kses_uri_attributes', $uri_attributes ); return $uri_attributes; } function _wp_kses_split_callback( $match ) { global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2( $match[0], $pass_allowed_html, $pass_allowed_protocols ); } function wp_kses_split2( $string, $allowed_html, $allowed_protocols ) { $string = wp_kses_stripslashes( $string ); if ( '<' !== substr( $string, 0, 1 ) ) { return '>'; } if ( '' ), '', $string ); while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) { $string = $newstring; } if ( '' === $string ) { return ''; } $string = preg_replace( '/--+/', '-', $string ); $string = preg_replace( '/-$/', '', $string ); return ""; } if ( ! preg_match( '%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $string, $matches ) ) { return ''; } $slash = trim( $matches[1] ); $elem = $matches[2]; $attrlist = $matches[3]; if ( ! is_array( $allowed_html ) ) { $allowed_html = wp_kses_allowed_html( $allowed_html ); } if ( ! isset( $allowed_html[ strtolower( $elem ) ] ) ) { return ''; } if ( '' !== $slash ) { return ""; } return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols ); } function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) { if ( ! is_array( $allowed_html ) ) { $allowed_html = wp_kses_allowed_html( $allowed_html ); } $xhtml_slash = ''; if ( preg_match( '%\s*/\s*$%', $attr ) ) { $xhtml_slash = ' /'; } $element_low = strtolower( $element ); if ( empty( $allowed_html[ $element_low ] ) || true === $allowed_html[ $element_low ] ) { return "<$element$xhtml_slash>"; } $attrarr = wp_kses_hair( $attr, $allowed_protocols ); $required_attrs = array_filter( $allowed_html[ $element_low ], function( $required_attr_limits ) { return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required']; } ); $stripped_tag = ''; if ( empty( $xhtml_slash ) ) { $stripped_tag = "<$element>"; } $attr2 = ''; foreach ( $attrarr as $arreach ) { $required = isset( $required_attrs[ strtolower( $arreach['name'] ) ] ); if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) { $attr2 .= ' ' . $arreach['whole']; if ( $required ) { unset( $required_attrs[ strtolower( $arreach['name'] ) ] ); } } elseif ( $required ) { return $stripped_tag; } } if ( ! empty( $required_attrs ) ) { return $stripped_tag; } $attr2 = preg_replace( '/[<>]/', '', $attr2 ); return "<$element$attr2$xhtml_slash>"; } function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) { $name_low = strtolower( $name ); $element_low = strtolower( $element ); if ( ! isset( $allowed_html[ $element_low ] ) ) { $name = ''; $value = ''; $whole = ''; return false; } $allowed_attr = $allowed_html[ $element_low ]; if ( ! isset( $allowed_attr[ $name_low ] ) || '' === $allowed_attr[ $name_low ] ) { if ( strpos( $name_low, 'data-' ) === 0 && ! empty( $allowed_attr['data-*'] ) && preg_match( '/^data(?:-[a-z0-9_]+)+$/', $name_low, $match ) ) { $allowed_attr[ $match[0] ] = $allowed_attr['data-*']; } else { $name = ''; $value = ''; $whole = ''; return false; } } if ( 'style' === $name_low ) { $new_value = safecss_filter_attr( $value ); if ( empty( $new_value ) ) { $name = ''; $value = ''; $whole = ''; return false; } $whole = str_replace( $value, $new_value, $whole ); $value = $new_value; } if ( is_array( $allowed_attr[ $name_low ] ) ) { foreach ( $allowed_attr[ $name_low ] as $currkey => $currval ) { if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) { $name = ''; $value = ''; $whole = ''; return false; } } } return true; } function wp_kses_hair( $attr, $allowed_protocols ) { $attrarr = array(); $mode = 0; $attrname = ''; $uris = wp_kses_uri_attributes(); while ( strlen( $attr ) != 0 ) { $working = 0; switch ( $mode ) { case 0: if ( preg_match( '/^([_a-zA-Z][-_a-zA-Z0-9:.]*)/', $attr, $match ) ) { $attrname = $match[1]; $working = 1; $mode = 1; $attr = preg_replace( '/^[_a-zA-Z][-_a-zA-Z0-9:.]*/', '', $attr ); } break; case 1: if ( preg_match( '/^\s*=\s*/', $attr ) ) { $working = 1; $mode = 2; $attr = preg_replace( '/^\s*=\s*/', '', $attr ); break; } if ( preg_match( '/^\s+/', $attr ) ) { $working = 1; $mode = 0; if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } $attr = preg_replace( '/^\s+/', '', $attr ); } break; case 2: if ( preg_match( '%^"([^"]*)"(\s+|/?$)%', $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( '/^"[^"]*"(\s+|$)/', '', $attr ); break; } if ( preg_match( "%^'([^']*)'(\s+|/?$)%", $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( "/^'[^']*'(\s+|$)/", '', $attr ); break; } if ( preg_match( "%^([^\s\"']+)(\s+|/?$)%", $attr, $match ) ) { $thisval = $match[1]; if ( in_array( strtolower( $attrname ), $uris, true ) ) { $thisval = wp_kses_bad_protocol( $thisval, $allowed_protocols ); } if ( false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n', ); } $working = 1; $mode = 0; $attr = preg_replace( "%^[^\s\"']+(\s+|$)%", '', $attr ); } break; } if ( 0 == $working ) { $attr = wp_kses_html_error( $attr ); $mode = 0; } } if ( 1 == $mode && false === array_key_exists( $attrname, $attrarr ) ) { $attrarr[ $attrname ] = array( 'name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y', ); } return $attrarr; } function wp_kses_attr_parse( $element ) { $valid = preg_match( '%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches ); if ( 1 !== $valid ) { return false; } $begin = $matches[1]; $slash = $matches[2]; $elname = $matches[3]; $attr = $matches[4]; $end = $matches[5]; if ( '' !== $slash ) { return false; } if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) { $xhtml_slash = $matches[0]; $attr = substr( $attr, 0, -strlen( $xhtml_slash ) ); } else { $xhtml_slash = ''; } $attrarr = wp_kses_hair_parse( $attr ); if ( false === $attrarr ) { return false; } array_unshift( $attrarr, $begin . $slash . $elname ); array_push( $attrarr, $xhtml_slash . $end ); return $attrarr; } function wp_kses_hair_parse( $attr ) { if ( '' === $attr ) { return array(); } $regex = '(?:' . '[_a-zA-Z][-_a-zA-Z0-9:.]*' . '|' . '\[\[?[^\[\]]+\]\]?' . ')' . '(?:' . '\s*=\s*' . '(?:' . '"[^"]*"' . '|' . "'[^']*'" . '|' . '[^\s"\']+' . '(?:\s|$)' . ')' . '|' . '(?:\s|$)' . ')' . '\s*'; $validation = "%^($regex)+$%"; $extraction = "%$regex%"; if ( 1 === preg_match( $validation, $attr ) ) { preg_match_all( $extraction, $attr, $attrarr ); return $attrarr[0]; } else { return false; } } function wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) { $ok = true; switch ( strtolower( $checkname ) ) { case 'maxlen': if ( strlen( $value ) > $checkvalue ) { $ok = false; } break; case 'minlen': if ( strlen( $value ) < $checkvalue ) { $ok = false; } break; case 'maxval': if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) { $ok = false; } if ( $value > $checkvalue ) { $ok = false; } break; case 'minval': if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) { $ok = false; } if ( $value < $checkvalue ) { $ok = false; } break; case 'valueless': if ( strtolower( $checkvalue ) != $vless ) { $ok = false; } break; case 'values': if ( false === array_search( strtolower( $value ), $checkvalue, true ) ) { $ok = false; } break; case 'value_callback': if ( ! call_user_func( $checkvalue, $value ) ) { $ok = false; } break; } return $ok; } function wp_kses_bad_protocol( $string, $allowed_protocols ) { $string = wp_kses_no_null( $string ); $iterations = 0; do { $original_string = $string; $string = wp_kses_bad_protocol_once( $string, $allowed_protocols ); } while ( $original_string != $string && ++$iterations < 6 ); if ( $original_string != $string ) { return ''; } return $string; } function wp_kses_no_null( $string, $options = null ) { if ( ! isset( $options['slash_zero'] ) ) { $options = array( 'slash_zero' => 'remove' ); } $string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string ); if ( 'remove' === $options['slash_zero'] ) { $string = preg_replace( '/\\\\+0+/', '', $string ); } return $string; } function wp_kses_stripslashes( $string ) { return preg_replace( '%\\\\"%', '"', $string ); } function wp_kses_array_lc( $inarray ) { $outarray = array(); foreach ( (array) $inarray as $inkey => $inval ) { $outkey = strtolower( $inkey ); $outarray[ $outkey ] = array(); foreach ( (array) $inval as $inkey2 => $inval2 ) { $outkey2 = strtolower( $inkey2 ); $outarray[ $outkey ][ $outkey2 ] = $inval2; } } return $outarray; } function wp_kses_html_error( $string ) { return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string ); } function wp_kses_bad_protocol_once( $string, $allowed_protocols, $count = 1 ) { $string = preg_replace( '/(�*58(?![;0-9])|�*3a(?![;a-f0-9]))/i', '$1;', $string ); $string2 = preg_split( '/:|�*58;|�*3a;|:/i', $string, 2 ); if ( isset( $string2[1] ) && ! preg_match( '%/\?%', $string2[0] ) ) { $string = trim( $string2[1] ); $protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ); if ( 'feed:' === $protocol ) { if ( $count > 2 ) { return ''; } $string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count ); if ( empty( $string ) ) { return $string; } } $string = $protocol . $string; } return $string; } function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) { $string2 = wp_kses_decode_entities( $string ); $string2 = preg_replace( '/\s/', '', $string2 ); $string2 = wp_kses_no_null( $string2 ); $string2 = strtolower( $string2 ); $allowed = false; foreach ( (array) $allowed_protocols as $one_protocol ) { if ( strtolower( $one_protocol ) == $string2 ) { $allowed = true; break; } } if ( $allowed ) { return "$string2:"; } else { return ''; } } function wp_kses_normalize_entities( $string, $context = 'html' ) { $string = str_replace( '&', '&', $string ); if ( 'xml' === $context ) { $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $string ); } else { $string = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string ); } $string = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string ); $string = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string ); return $string; } function wp_kses_named_entities( $matches ) { global $allowedentitynames; if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; return ( ! in_array( $i, $allowedentitynames, true ) ) ? "&$i;" : "&$i;"; } function wp_kses_xml_named_entities( $matches ) { global $allowedentitynames, $allowedxmlentitynames; if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; if ( in_array( $i, $allowedxmlentitynames, true ) ) { return "&$i;"; } elseif ( in_array( $i, $allowedentitynames, true ) ) { return html_entity_decode( "&$i;", ENT_HTML5 ); } return "&$i;"; } function wp_kses_normalize_entities2( $matches ) { if ( empty( $matches[1] ) ) { return ''; } $i = $matches[1]; if ( valid_unicode( $i ) ) { $i = str_pad( ltrim( $i, '0' ), 3, '0', STR_PAD_LEFT ); $i = "&#$i;"; } else { $i = "&#$i;"; } return $i; } function wp_kses_normalize_entities3( $matches ) { if ( empty( $matches[1] ) ) { return ''; } $hexchars = $matches[1]; return ( ! valid_unicode( hexdec( $hexchars ) ) ) ? "&#x$hexchars;" : '&#x' . ltrim( $hexchars, '0' ) . ';'; } function valid_unicode( $i ) { return ( 0x9 == $i || 0xa == $i || 0xd == $i || ( 0x20 <= $i && $i <= 0xd7ff ) || ( 0xe000 <= $i && $i <= 0xfffd ) || ( 0x10000 <= $i && $i <= 0x10ffff ) ); } function wp_kses_decode_entities( $string ) { $string = preg_replace_callback( '/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string ); $string = preg_replace_callback( '/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string ); return $string; } function _wp_kses_decode_entities_chr( $match ) { return chr( $match[1] ); } function _wp_kses_decode_entities_chr_hexdec( $match ) { return chr( hexdec( $match[1] ) ); } function wp_filter_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), current_filter() ) ); } function wp_kses_data( $data ) { return wp_kses( $data, current_filter() ); } function wp_filter_post_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'post' ) ); } function wp_filter_global_styles_post( $data ) { $decoded_data = json_decode( wp_unslash( $data ), true ); $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE === $json_decoding_error && is_array( $decoded_data ) && isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) && $decoded_data['isGlobalStylesUserThemeJSON'] ) { unset( $decoded_data['isGlobalStylesUserThemeJSON'] ); $data_to_encode = WP_Theme_JSON::remove_insecure_properties( $decoded_data ); $data_to_encode['isGlobalStylesUserThemeJSON'] = true; return wp_slash( wp_json_encode( $data_to_encode ) ); } return $data; } function wp_kses_post( $data ) { return wp_kses( $data, 'post' ); } function wp_kses_post_deep( $data ) { return map_deep( $data, 'wp_kses_post' ); } function wp_filter_nohtml_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'strip' ) ); } function kses_init_filters() { add_filter( 'title_save_pre', 'wp_filter_kses' ); if ( current_user_can( 'unfiltered_html' ) ) { add_filter( 'pre_comment_content', 'wp_filter_post_kses' ); } else { add_filter( 'pre_comment_content', 'wp_filter_kses' ); } add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 ); add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 ); add_filter( 'content_save_pre', 'wp_filter_post_kses' ); add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' ); add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' ); } function kses_remove_filters() { remove_filter( 'title_save_pre', 'wp_filter_kses' ); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); remove_filter( 'pre_comment_content', 'wp_filter_kses' ); remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 ); remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 ); remove_filter( 'content_save_pre', 'wp_filter_post_kses' ); remove_filter( 'excerpt_save_pre', 'wp_filter_post_kses' ); remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' ); } function kses_init() { kses_remove_filters(); if ( ! current_user_can( 'unfiltered_html' ) ) { kses_init_filters(); } } function safecss_filter_attr( $css, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.8.1' ); } $css = wp_kses_no_null( $css ); $css = str_replace( array( "\n", "\r", "\t" ), '', $css ); $allowed_protocols = wp_allowed_protocols(); $css_array = explode( ';', trim( $css ) ); $allowed_attr = apply_filters( 'safe_style_css', array( 'background', 'background-color', 'background-image', 'background-position', 'background-size', 'background-attachment', 'background-blend-mode', 'border', 'border-radius', 'border-width', 'border-color', 'border-style', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-top-left-radius', 'border-top-right-radius', 'border-spacing', 'border-collapse', 'caption-side', 'columns', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-span', 'column-width', 'color', 'filter', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-align', 'text-decoration', 'text-indent', 'text-transform', 'height', 'min-height', 'max-height', 'width', 'min-width', 'max-width', 'margin', 'margin-right', 'margin-bottom', 'margin-left', 'margin-top', 'padding', 'padding-right', 'padding-bottom', 'padding-left', 'padding-top', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'grid-template-columns', 'grid-auto-columns', 'grid-column-start', 'grid-column-end', 'grid-column-gap', 'grid-template-rows', 'grid-auto-rows', 'grid-row-start', 'grid-row-end', 'grid-row-gap', 'grid-gap', 'justify-content', 'justify-items', 'justify-self', 'align-content', 'align-items', 'align-self', 'clear', 'cursor', 'direction', 'float', 'list-style-type', 'object-position', 'overflow', 'vertical-align', ) ); $css_url_data_types = array( 'background', 'background-image', 'cursor', 'list-style', 'list-style-image', ); $css_gradient_data_types = array( 'background', 'background-image', ); if ( empty( $allowed_attr ) ) { return $css; } $css = ''; foreach ( $css_array as $css_item ) { if ( '' === $css_item ) { continue; } $css_item = trim( $css_item ); $css_test_string = $css_item; $found = false; $url_attr = false; $gradient_attr = false; if ( strpos( $css_item, ':' ) === false ) { $found = true; } else { $parts = explode( ':', $css_item, 2 ); $css_selector = trim( $parts[0] ); if ( in_array( $css_selector, $allowed_attr, true ) ) { $found = true; $url_attr = in_array( $css_selector, $css_url_data_types, true ); $gradient_attr = in_array( $css_selector, $css_gradient_data_types, true ); } } if ( $found && $url_attr ) { preg_match_all( '/url\([^)]+\)/', $parts[1], $url_matches ); foreach ( $url_matches[0] as $url_match ) { preg_match( '/^url\(\s*([\'\"]?)(.*)(\g1)\s*\)$/', $url_match, $url_pieces ); if ( empty( $url_pieces[2] ) ) { $found = false; break; } $url = trim( $url_pieces[2] ); if ( empty( $url ) || wp_kses_bad_protocol( $url, $allowed_protocols ) !== $url ) { $found = false; break; } else { $css_test_string = str_replace( $url_match, '', $css_test_string ); } } } if ( $found && $gradient_attr ) { $css_value = trim( $parts[1] ); if ( preg_match( '/^(repeating-)?(linear|radial|conic)-gradient\(([^()]|rgb[a]?\([^()]*\))*\)$/', $css_value ) ) { $css_test_string = str_replace( $css_value, '', $css_test_string ); } } if ( $found ) { $css_test_string = preg_replace( '/calc\(((?:\([^()]*\)?|[^()])*)\)/', '', $css_test_string ); $css_test_string = preg_replace( '/\(?var\(--[a-zA-Z0-9_-]*\)/', '', $css_test_string ); $allow_css = ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ); $allow_css = apply_filters( 'safecss_filter_attr_allow_css', $allow_css, $css_test_string ); if ( $allow_css ) { if ( '' !== $css ) { $css .= ';'; } $css .= $css_item; } } } return $css; } function _wp_add_global_attributes( $value ) { $global_attributes = array( 'aria-describedby' => true, 'aria-details' => true, 'aria-label' => true, 'aria-labelledby' => true, 'aria-hidden' => true, 'class' => true, 'data-*' => true, 'dir' => true, 'id' => true, 'lang' => true, 'style' => true, 'title' => true, 'role' => true, 'xml:lang' => true, ); if ( true === $value ) { $value = array(); } if ( is_array( $value ) ) { return array_merge( $value, $global_attributes ); } return $value; } function _wp_kses_allow_pdf_objects( $url ) { if ( str_contains( $url, '?' ) || str_contains( $url, '#' ) ) { return false; } if ( ! str_ends_with( $url, '.pdf' ) ) { return false; } $upload_info = wp_upload_dir( null, false ); $parsed_url = wp_parse_url( $upload_info['url'] ); $upload_host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; $upload_port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; if ( str_starts_with( $url, "http://$upload_host$upload_port/" ) || str_starts_with( $url, "https://$upload_host$upload_port/" ) ) { return true; } return false; } array( 'name_admin_bar' => _x( 'Post', 'add new from admin bar' ), ), 'public' => true, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'map_meta_cap' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-admin-post', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ), 'show_in_rest' => true, 'rest_base' => 'posts', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'page', array( 'labels' => array( 'name_admin_bar' => _x( 'Page', 'add new from admin bar' ), ), 'public' => true, 'publicly_queryable' => false, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'page', 'map_meta_cap' => true, 'menu_position' => 20, 'menu_icon' => 'dashicons-admin-page', 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), 'show_in_rest' => true, 'rest_base' => 'pages', 'rest_controller_class' => 'WP_REST_Posts_Controller', ) ); register_post_type( 'attachment', array( 'labels' => array( 'name' => _x( 'Media', 'post type general name' ), 'name_admin_bar' => _x( 'Media', 'add new from admin bar' ), 'add_new' => _x( 'Add New', 'add new media' ), 'edit_item' => __( 'Edit Media' ), 'view_item' => __( 'View Attachment Page' ), 'attributes' => __( 'Attachment Attributes' ), ), 'public' => true, 'show_ui' => true, '_builtin' => true, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'capabilities' => array( 'create_posts' => 'upload_files', ), 'map_meta_cap' => true, 'menu_icon' => 'dashicons-admin-media', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'show_in_nav_menus' => false, 'delete_with_user' => true, 'supports' => array( 'title', 'author', 'comments' ), 'show_in_rest' => true, 'rest_base' => 'media', 'rest_controller_class' => 'WP_REST_Attachments_Controller', ) ); add_post_type_support( 'attachment:audio', 'thumbnail' ); add_post_type_support( 'attachment:video', 'thumbnail' ); register_post_type( 'revision', array( 'labels' => array( 'name' => __( 'Revisions' ), 'singular_name' => __( 'Revision' ), ), 'public' => false, '_builtin' => true, '_edit_link' => 'revision.php?revision=%d', 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => true, 'supports' => array( 'author' ), ) ); register_post_type( 'nav_menu_item', array( 'labels' => array( 'name' => __( 'Navigation Menu Items' ), 'singular_name' => __( 'Navigation Menu Item' ), ), 'public' => false, '_builtin' => true, 'hierarchical' => false, 'rewrite' => false, 'delete_with_user' => false, 'query_var' => false, 'map_meta_cap' => true, 'capability_type' => array( 'edit_theme_options', 'edit_theme_options' ), 'capabilities' => array( 'edit_post' => 'edit_post', 'read_post' => 'read_post', 'delete_post' => 'delete_post', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'read' => 'read', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', ), 'show_in_rest' => true, 'rest_base' => 'menu-items', 'rest_controller_class' => 'WP_REST_Menu_Items_Controller', ) ); register_post_type( 'custom_css', array( 'labels' => array( 'name' => __( 'Custom CSS' ), 'singular_name' => __( 'Custom CSS' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => true, '_builtin' => true, 'supports' => array( 'title', 'revisions' ), 'capabilities' => array( 'delete_posts' => 'edit_theme_options', 'delete_post' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_post' => 'edit_css', 'edit_posts' => 'edit_css', 'edit_others_posts' => 'edit_css', 'edit_published_posts' => 'edit_css', 'read_post' => 'read', 'read_private_posts' => 'read', 'publish_posts' => 'edit_theme_options', ), ) ); register_post_type( 'customize_changeset', array( 'labels' => array( 'name' => _x( 'Changesets', 'post type general name' ), 'singular_name' => _x( 'Changeset', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Customize Changeset' ), 'add_new_item' => __( 'Add New Changeset' ), 'new_item' => __( 'New Changeset' ), 'edit_item' => __( 'Edit Changeset' ), 'view_item' => __( 'View Changeset' ), 'all_items' => __( 'All Changesets' ), 'search_items' => __( 'Search Changesets' ), 'not_found' => __( 'No changesets found.' ), 'not_found_in_trash' => __( 'No changesets found in Trash.' ), ), 'public' => false, '_builtin' => true, 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array( 'title', 'author' ), 'capability_type' => 'customize_changeset', 'capabilities' => array( 'create_posts' => 'customize', 'delete_others_posts' => 'customize', 'delete_post' => 'customize', 'delete_posts' => 'customize', 'delete_private_posts' => 'customize', 'delete_published_posts' => 'customize', 'edit_others_posts' => 'customize', 'edit_post' => 'customize', 'edit_posts' => 'customize', 'edit_private_posts' => 'customize', 'edit_published_posts' => 'do_not_allow', 'publish_posts' => 'customize', 'read' => 'read', 'read_post' => 'customize', 'read_private_posts' => 'customize', ), ) ); register_post_type( 'oembed_cache', array( 'labels' => array( 'name' => __( 'oEmbed Responses' ), 'singular_name' => __( 'oEmbed Response' ), ), 'public' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'delete_with_user' => false, 'can_export' => false, '_builtin' => true, 'supports' => array(), ) ); register_post_type( 'user_request', array( 'labels' => array( 'name' => __( 'User Requests' ), 'singular_name' => __( 'User Request' ), ), 'public' => false, '_builtin' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'can_export' => false, 'delete_with_user' => false, 'supports' => array(), ) ); register_post_type( 'wp_block', array( 'labels' => array( 'name' => _x( 'Reusable blocks', 'post type general name' ), 'singular_name' => _x( 'Reusable block', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Reusable block' ), 'add_new_item' => __( 'Add new Reusable block' ), 'new_item' => __( 'New Reusable block' ), 'edit_item' => __( 'Edit Reusable block' ), 'view_item' => __( 'View Reusable block' ), 'all_items' => __( 'All Reusable blocks' ), 'search_items' => __( 'Search Reusable blocks' ), 'not_found' => __( 'No reusable blocks found.' ), 'not_found_in_trash' => __( 'No reusable blocks found in Trash.' ), 'filter_items_list' => __( 'Filter reusable blocks list' ), 'items_list_navigation' => __( 'Reusable blocks list navigation' ), 'items_list' => __( 'Reusable blocks list' ), 'item_published' => __( 'Reusable block published.' ), 'item_published_privately' => __( 'Reusable block published privately.' ), 'item_reverted_to_draft' => __( 'Reusable block reverted to draft.' ), 'item_scheduled' => __( 'Reusable block scheduled.' ), 'item_updated' => __( 'Reusable block updated.' ), ), 'public' => false, '_builtin' => true, 'show_ui' => true, 'show_in_menu' => false, 'rewrite' => false, 'show_in_rest' => true, 'rest_base' => 'blocks', 'rest_controller_class' => 'WP_REST_Blocks_Controller', 'capability_type' => 'block', 'capabilities' => array( 'read' => 'edit_posts', 'create_posts' => 'publish_posts', 'edit_posts' => 'edit_posts', 'edit_published_posts' => 'edit_published_posts', 'delete_published_posts' => 'delete_published_posts', 'edit_others_posts' => 'edit_others_posts', 'delete_others_posts' => 'delete_others_posts', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_template', array( 'labels' => array( 'name' => _x( 'Templates', 'post type general name' ), 'singular_name' => _x( 'Template', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template' ), 'add_new_item' => __( 'Add New Template' ), 'new_item' => __( 'New Template' ), 'edit_item' => __( 'Edit Template' ), 'view_item' => __( 'View Template' ), 'all_items' => __( 'Templates' ), 'search_items' => __( 'Search Templates' ), 'parent_item_colon' => __( 'Parent Template:' ), 'not_found' => __( 'No templates found.' ), 'not_found_in_trash' => __( 'No templates found in Trash.' ), 'archives' => __( 'Template archives' ), 'insert_into_item' => __( 'Insert into template' ), 'uploaded_to_this_item' => __( 'Uploaded to this template' ), 'filter_items_list' => __( 'Filter templates list' ), 'items_list_navigation' => __( 'Templates list navigation' ), 'items_list' => __( 'Templates list' ), ), 'description' => __( 'Templates to include in your theme.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'templates', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'capability_type' => array( 'template', 'templates' ), 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_template_part', array( 'labels' => array( 'name' => _x( 'Template Parts', 'post type general name' ), 'singular_name' => _x( 'Template Part', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Template Part' ), 'add_new_item' => __( 'Add New Template Part' ), 'new_item' => __( 'New Template Part' ), 'edit_item' => __( 'Edit Template Part' ), 'view_item' => __( 'View Template Part' ), 'all_items' => __( 'Template Parts' ), 'search_items' => __( 'Search Template Parts' ), 'parent_item_colon' => __( 'Parent Template Part:' ), 'not_found' => __( 'No template parts found.' ), 'not_found_in_trash' => __( 'No template parts found in Trash.' ), 'archives' => __( 'Template part archives' ), 'insert_into_item' => __( 'Insert into template part' ), 'uploaded_to_this_item' => __( 'Uploaded to this template part' ), 'filter_items_list' => __( 'Filter template parts list' ), 'items_list_navigation' => __( 'Template parts list navigation' ), 'items_list' => __( 'Template parts list' ), ), 'description' => __( 'Template parts to include in your templates.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'template-parts', 'rest_controller_class' => 'WP_REST_Templates_Controller', 'map_meta_cap' => true, 'capabilities' => array( 'create_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'read' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', ), 'supports' => array( 'title', 'slug', 'excerpt', 'editor', 'revisions', 'author', ), ) ); register_post_type( 'wp_global_styles', array( 'label' => _x( 'Global Styles', 'post type general name' ), 'description' => __( 'Global styles to include in themes.' ), 'public' => false, '_builtin' => true, 'show_ui' => false, 'show_in_rest' => false, 'rewrite' => false, 'capabilities' => array( 'read' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'edit_others_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', ), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_type( 'wp_navigation', array( 'labels' => array( 'name' => _x( 'Navigation Menus', 'post type general name' ), 'singular_name' => _x( 'Navigation Menu', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Navigation Menu' ), 'add_new_item' => __( 'Add New Navigation Menu' ), 'new_item' => __( 'New Navigation Menu' ), 'edit_item' => __( 'Edit Navigation Menu' ), 'view_item' => __( 'View Navigation Menu' ), 'all_items' => __( 'Navigation Menus' ), 'search_items' => __( 'Search Navigation Menus' ), 'parent_item_colon' => __( 'Parent Navigation Menu:' ), 'not_found' => __( 'No Navigation Menu found.' ), 'not_found_in_trash' => __( 'No Navigation Menu found in Trash.' ), 'archives' => __( 'Navigation Menu archives' ), 'insert_into_item' => __( 'Insert into Navigation Menu' ), 'uploaded_to_this_item' => __( 'Uploaded to this Navigation Menu' ), 'filter_items_list' => __( 'Filter Navigation Menu list' ), 'items_list_navigation' => __( 'Navigation Menus list navigation' ), 'items_list' => __( 'Navigation Menus list' ), ), 'description' => __( 'Navigation menus that can be inserted into your site.' ), 'public' => false, '_builtin' => true, 'has_archive' => false, 'show_ui' => true, 'show_in_menu' => false, 'show_in_admin_bar' => false, 'show_in_rest' => true, 'rewrite' => false, 'map_meta_cap' => true, 'capabilities' => array( 'edit_others_posts' => 'edit_theme_options', 'delete_posts' => 'edit_theme_options', 'publish_posts' => 'edit_theme_options', 'create_posts' => 'edit_theme_options', 'read_private_posts' => 'edit_theme_options', 'delete_private_posts' => 'edit_theme_options', 'delete_published_posts' => 'edit_theme_options', 'delete_others_posts' => 'edit_theme_options', 'edit_private_posts' => 'edit_theme_options', 'edit_published_posts' => 'edit_theme_options', 'edit_posts' => 'edit_theme_options', ), 'rest_base' => 'navigation', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'supports' => array( 'title', 'editor', 'revisions', ), ) ); register_post_status( 'publish', array( 'label' => _x( 'Published', 'post status' ), 'public' => true, '_builtin' => true, 'label_count' => _n_noop( 'Published (%s)', 'Published (%s)' ), ) ); register_post_status( 'future', array( 'label' => _x( 'Scheduled', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Scheduled (%s)', 'Scheduled (%s)' ), ) ); register_post_status( 'draft', array( 'label' => _x( 'Draft', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Draft (%s)', 'Drafts (%s)' ), 'date_floating' => true, ) ); register_post_status( 'pending', array( 'label' => _x( 'Pending', 'post status' ), 'protected' => true, '_builtin' => true, 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)' ), 'date_floating' => true, ) ); register_post_status( 'private', array( 'label' => _x( 'Private', 'post status' ), 'private' => true, '_builtin' => true, 'label_count' => _n_noop( 'Private (%s)', 'Private (%s)' ), ) ); register_post_status( 'trash', array( 'label' => _x( 'Trash', 'post status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Trash (%s)', 'Trash (%s)' ), 'show_in_admin_status_list' => true, ) ); register_post_status( 'auto-draft', array( 'label' => 'auto-draft', 'internal' => true, '_builtin' => true, 'date_floating' => true, ) ); register_post_status( 'inherit', array( 'label' => 'inherit', 'internal' => true, '_builtin' => true, 'exclude_from_search' => false, ) ); register_post_status( 'request-pending', array( 'label' => _x( 'Pending', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Pending (%s)', 'Pending (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-confirmed', array( 'label' => _x( 'Confirmed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Confirmed (%s)', 'Confirmed (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-failed', array( 'label' => _x( 'Failed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Failed (%s)', 'Failed (%s)' ), 'exclude_from_search' => false, ) ); register_post_status( 'request-completed', array( 'label' => _x( 'Completed', 'request status' ), 'internal' => true, '_builtin' => true, 'label_count' => _n_noop( 'Completed (%s)', 'Completed (%s)' ), 'exclude_from_search' => false, ) ); } function get_attached_file( $attachment_id, $unfiltered = false ) { $file = get_post_meta( $attachment_id, '_wp_attached_file', true ); if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) ) { $uploads = wp_get_upload_dir(); if ( false === $uploads['error'] ) { $file = $uploads['basedir'] . "/$file"; } } if ( $unfiltered ) { return $file; } return apply_filters( 'get_attached_file', $file, $attachment_id ); } function update_attached_file( $attachment_id, $file ) { if ( ! get_post( $attachment_id ) ) { return false; } $file = apply_filters( 'update_attached_file', $file, $attachment_id ); $file = _wp_relative_upload_path( $file ); if ( $file ) { return update_post_meta( $attachment_id, '_wp_attached_file', $file ); } else { return delete_post_meta( $attachment_id, '_wp_attached_file' ); } } function _wp_relative_upload_path( $path ) { $new_path = $path; $uploads = wp_get_upload_dir(); if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) { $new_path = str_replace( $uploads['basedir'], '', $new_path ); $new_path = ltrim( $new_path, '/' ); } return apply_filters( '_wp_relative_upload_path', $new_path, $path ); } function get_children( $args = '', $output = OBJECT ) { $kids = array(); if ( empty( $args ) ) { if ( isset( $GLOBALS['post'] ) ) { $args = array( 'post_parent' => (int) $GLOBALS['post']->post_parent ); } else { return $kids; } } elseif ( is_object( $args ) ) { $args = array( 'post_parent' => (int) $args->post_parent ); } elseif ( is_numeric( $args ) ) { $args = array( 'post_parent' => (int) $args ); } $defaults = array( 'numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'post_parent' => 0, ); $parsed_args = wp_parse_args( $args, $defaults ); $children = get_posts( $parsed_args ); if ( ! $children ) { return $kids; } if ( ! empty( $parsed_args['fields'] ) ) { return $children; } update_post_cache( $children ); foreach ( $children as $key => $child ) { $kids[ $child->ID ] = $children[ $key ]; } if ( OBJECT === $output ) { return $kids; } elseif ( ARRAY_A === $output ) { $weeuns = array(); foreach ( (array) $kids as $kid ) { $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); } return $weeuns; } elseif ( ARRAY_N === $output ) { $babes = array(); foreach ( (array) $kids as $kid ) { $babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); } return $babes; } else { return $kids; } } function get_extended( $post ) { if ( preg_match( '//', $post, $matches ) ) { list($main, $extended) = explode( $matches[0], $post, 2 ); $more_text = $matches[1]; } else { $main = $post; $extended = ''; $more_text = ''; } $main = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $main ); $extended = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $extended ); $more_text = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $more_text ); return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text, ); } function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { if ( empty( $post ) && isset( $GLOBALS['post'] ) ) { $post = $GLOBALS['post']; } if ( $post instanceof WP_Post ) { $_post = $post; } elseif ( is_object( $post ) ) { if ( empty( $post->filter ) ) { $_post = sanitize_post( $post, 'raw' ); $_post = new WP_Post( $_post ); } elseif ( 'raw' === $post->filter ) { $_post = new WP_Post( $post ); } else { $_post = WP_Post::get_instance( $post->ID ); } } else { $_post = WP_Post::get_instance( $post ); } if ( ! $_post ) { return null; } $_post = $_post->filter( $filter ); if ( ARRAY_A === $output ) { return $_post->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_post->to_array() ); } return $_post; } function get_post_ancestors( $post ) { $post = get_post( $post ); if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) { return array(); } $ancestors = array(); $id = $post->post_parent; $ancestors[] = $id; while ( $ancestor = get_post( $id ) ) { if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors, true ) ) { break; } $id = $ancestor->post_parent; $ancestors[] = $id; } return $ancestors; } function get_post_field( $field, $post = null, $context = 'display' ) { $post = get_post( $post ); if ( ! $post ) { return ''; } if ( ! isset( $post->$field ) ) { return ''; } return sanitize_post_field( $field, $post->$field, $post->ID, $context ); } function get_post_mime_type( $post = null ) { $post = get_post( $post ); if ( is_object( $post ) ) { return $post->post_mime_type; } return false; } function get_post_status( $post = null ) { $post = get_post( $post ); if ( ! is_object( $post ) ) { return false; } $post_status = $post->post_status; if ( 'attachment' === $post->post_type && 'inherit' === $post_status ) { if ( 0 === $post->post_parent || ! get_post( $post->post_parent ) || $post->ID === $post->post_parent ) { $post_status = 'publish'; } elseif ( 'trash' === get_post_status( $post->post_parent ) ) { $post_status = get_post_meta( $post->post_parent, '_wp_trash_meta_status', true ); if ( ! $post_status ) { $post_status = 'publish'; } } else { $post_status = get_post_status( $post->post_parent ); } } elseif ( 'attachment' === $post->post_type && ! in_array( $post_status, array( 'private', 'trash', 'auto-draft' ), true ) ) { $post_status = 'publish'; } return apply_filters( 'get_post_status', $post_status, $post ); } function get_post_statuses() { $status = array( 'draft' => __( 'Draft' ), 'pending' => __( 'Pending Review' ), 'private' => __( 'Private' ), 'publish' => __( 'Published' ), ); return $status; } function get_page_statuses() { $status = array( 'draft' => __( 'Draft' ), 'private' => __( 'Private' ), 'publish' => __( 'Published' ), ); return $status; } function _wp_privacy_statuses() { return array( 'request-pending' => _x( 'Pending', 'request status' ), 'request-confirmed' => _x( 'Confirmed', 'request status' ), 'request-failed' => _x( 'Failed', 'request status' ), 'request-completed' => _x( 'Completed', 'request status' ), ); } function register_post_status( $post_status, $args = array() ) { global $wp_post_statuses; if ( ! is_array( $wp_post_statuses ) ) { $wp_post_statuses = array(); } $defaults = array( 'label' => false, 'label_count' => false, 'exclude_from_search' => null, '_builtin' => false, 'public' => null, 'internal' => null, 'protected' => null, 'private' => null, 'publicly_queryable' => null, 'show_in_admin_status_list' => null, 'show_in_admin_all_list' => null, 'date_floating' => null, ); $args = wp_parse_args( $args, $defaults ); $args = (object) $args; $post_status = sanitize_key( $post_status ); $args->name = $post_status; if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) { $args->internal = true; } if ( null === $args->public ) { $args->public = false; } if ( null === $args->private ) { $args->private = false; } if ( null === $args->protected ) { $args->protected = false; } if ( null === $args->internal ) { $args->internal = false; } if ( null === $args->publicly_queryable ) { $args->publicly_queryable = $args->public; } if ( null === $args->exclude_from_search ) { $args->exclude_from_search = $args->internal; } if ( null === $args->show_in_admin_all_list ) { $args->show_in_admin_all_list = ! $args->internal; } if ( null === $args->show_in_admin_status_list ) { $args->show_in_admin_status_list = ! $args->internal; } if ( null === $args->date_floating ) { $args->date_floating = false; } if ( false === $args->label ) { $args->label = $post_status; } if ( false === $args->label_count ) { $args->label_count = _n_noop( $args->label, $args->label ); } $wp_post_statuses[ $post_status ] = $args; return $args; } function get_post_status_object( $post_status ) { global $wp_post_statuses; if ( empty( $wp_post_statuses[ $post_status ] ) ) { return null; } return $wp_post_statuses[ $post_status ]; } function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_statuses; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_post_statuses, $args, $operator, $field ); } function is_post_type_hierarchical( $post_type ) { if ( ! post_type_exists( $post_type ) ) { return false; } $post_type = get_post_type_object( $post_type ); return $post_type->hierarchical; } function post_type_exists( $post_type ) { return (bool) get_post_type_object( $post_type ); } function get_post_type( $post = null ) { $post = get_post( $post ); if ( $post ) { return $post->post_type; } return false; } function get_post_type_object( $post_type ) { global $wp_post_types; if ( ! is_scalar( $post_type ) || empty( $wp_post_types[ $post_type ] ) ) { return null; } return $wp_post_types[ $post_type ]; } function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_types; $field = ( 'names' === $output ) ? 'name' : false; return wp_filter_object_list( $wp_post_types, $args, $operator, $field ); } function register_post_type( $post_type, $args = array() ) { global $wp_post_types; if ( ! is_array( $wp_post_types ) ) { $wp_post_types = array(); } $post_type = sanitize_key( $post_type ); if ( empty( $post_type ) || strlen( $post_type ) > 20 ) { _doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2.0' ); return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) ); } $post_type_object = new WP_Post_Type( $post_type, $args ); $post_type_object->add_supports(); $post_type_object->add_rewrite_rules(); $post_type_object->register_meta_boxes(); $wp_post_types[ $post_type ] = $post_type_object; $post_type_object->add_hooks(); $post_type_object->register_taxonomies(); do_action( 'registered_post_type', $post_type, $post_type_object ); do_action( "registered_post_type_{$post_type}", $post_type, $post_type_object ); return $post_type_object; } function unregister_post_type( $post_type ) { global $wp_post_types; if ( ! post_type_exists( $post_type ) ) { return new WP_Error( 'invalid_post_type', __( 'Invalid post type.' ) ); } $post_type_object = get_post_type_object( $post_type ); if ( $post_type_object->_builtin ) { return new WP_Error( 'invalid_post_type', __( 'Unregistering a built-in post type is not allowed' ) ); } $post_type_object->remove_supports(); $post_type_object->remove_rewrite_rules(); $post_type_object->unregister_meta_boxes(); $post_type_object->remove_hooks(); $post_type_object->unregister_taxonomies(); unset( $wp_post_types[ $post_type ] ); do_action( 'unregistered_post_type', $post_type ); return true; } function get_post_type_capabilities( $args ) { if ( ! is_array( $args->capability_type ) ) { $args->capability_type = array( $args->capability_type, $args->capability_type . 's' ); } list( $singular_base, $plural_base ) = $args->capability_type; $default_capabilities = array( 'edit_post' => 'edit_' . $singular_base, 'read_post' => 'read_' . $singular_base, 'delete_post' => 'delete_' . $singular_base, 'edit_posts' => 'edit_' . $plural_base, 'edit_others_posts' => 'edit_others_' . $plural_base, 'delete_posts' => 'delete_' . $plural_base, 'publish_posts' => 'publish_' . $plural_base, 'read_private_posts' => 'read_private_' . $plural_base, ); if ( $args->map_meta_cap ) { $default_capabilities_for_mapping = array( 'read' => 'read', 'delete_private_posts' => 'delete_private_' . $plural_base, 'delete_published_posts' => 'delete_published_' . $plural_base, 'delete_others_posts' => 'delete_others_' . $plural_base, 'edit_private_posts' => 'edit_private_' . $plural_base, 'edit_published_posts' => 'edit_published_' . $plural_base, ); $default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping ); } $capabilities = array_merge( $default_capabilities, $args->capabilities ); if ( ! isset( $capabilities['create_posts'] ) ) { $capabilities['create_posts'] = $capabilities['edit_posts']; } if ( $args->map_meta_cap ) { _post_type_meta_capabilities( $capabilities ); } return (object) $capabilities; } function _post_type_meta_capabilities( $capabilities = null ) { global $post_type_meta_caps; foreach ( $capabilities as $core => $custom ) { if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ), true ) ) { $post_type_meta_caps[ $custom ] = $core; } } } function get_post_type_labels( $post_type_object ) { $nohier_vs_hier_defaults = WP_Post_Type::get_default_labels(); $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); $post_type = $post_type_object->name; $default_labels = clone $labels; $labels = apply_filters( "post_type_labels_{$post_type}", $labels ); $labels = (object) array_merge( (array) $default_labels, (array) $labels ); return $labels; } function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { $object->labels = (array) $object->labels; if ( isset( $object->label ) && empty( $object->labels['name'] ) ) { $object->labels['name'] = $object->label; } if ( ! isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) { $object->labels['singular_name'] = $object->labels['name']; } if ( ! isset( $object->labels['name_admin_bar'] ) ) { $object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name; } if ( ! isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) { $object->labels['menu_name'] = $object->labels['name']; } if ( ! isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) { $object->labels['all_items'] = $object->labels['menu_name']; } if ( ! isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) { $object->labels['archives'] = $object->labels['all_items']; } $defaults = array(); foreach ( $nohier_vs_hier_defaults as $key => $value ) { $defaults[ $key ] = $object->hierarchical ? $value[1] : $value[0]; } $labels = array_merge( $defaults, $object->labels ); $object->labels = (object) $object->labels; return (object) $labels; } function _add_post_type_submenus() { foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { $ptype_obj = get_post_type_object( $ptype ); if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) { continue; } add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" ); } } function add_post_type_support( $post_type, $feature, ...$args ) { global $_wp_post_type_features; $features = (array) $feature; foreach ( $features as $feature ) { if ( $args ) { $_wp_post_type_features[ $post_type ][ $feature ] = $args; } else { $_wp_post_type_features[ $post_type ][ $feature ] = true; } } } function remove_post_type_support( $post_type, $feature ) { global $_wp_post_type_features; unset( $_wp_post_type_features[ $post_type ][ $feature ] ); } function get_all_post_type_supports( $post_type ) { global $_wp_post_type_features; if ( isset( $_wp_post_type_features[ $post_type ] ) ) { return $_wp_post_type_features[ $post_type ]; } return array(); } function post_type_supports( $post_type, $feature ) { global $_wp_post_type_features; return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ); } function get_post_types_by_support( $feature, $operator = 'and' ) { global $_wp_post_type_features; $features = array_fill_keys( (array) $feature, true ); return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) ); } function set_post_type( $post_id = 0, $post_type = 'post' ) { global $wpdb; $post_type = sanitize_post_field( 'post_type', $post_type, $post_id, 'db' ); $return = $wpdb->update( $wpdb->posts, array( 'post_type' => $post_type ), array( 'ID' => $post_id ) ); clean_post_cache( $post_id ); return $return; } function is_post_type_viewable( $post_type ) { if ( is_scalar( $post_type ) ) { $post_type = get_post_type_object( $post_type ); if ( ! $post_type ) { return false; } } if ( ! is_object( $post_type ) ) { return false; } $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); } function is_post_status_viewable( $post_status ) { if ( is_scalar( $post_status ) ) { $post_status = get_post_status_object( $post_status ); if ( ! $post_status ) { return false; } } if ( ! is_object( $post_status ) || $post_status->internal || $post_status->protected ) { return false; } $is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status ); } function is_post_publicly_viewable( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $post_type = get_post_type( $post ); $post_status = get_post_status( $post ); return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status ); } function get_posts( $args = null ) { $defaults = array( 'numberposts' => 5, 'category' => 0, 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), 'exclude' => array(), 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'suppress_filters' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); if ( empty( $parsed_args['post_status'] ) ) { $parsed_args['post_status'] = ( 'attachment' === $parsed_args['post_type'] ) ? 'inherit' : 'publish'; } if ( ! empty( $parsed_args['numberposts'] ) && empty( $parsed_args['posts_per_page'] ) ) { $parsed_args['posts_per_page'] = $parsed_args['numberposts']; } if ( ! empty( $parsed_args['category'] ) ) { $parsed_args['cat'] = $parsed_args['category']; } if ( ! empty( $parsed_args['include'] ) ) { $incposts = wp_parse_id_list( $parsed_args['include'] ); $parsed_args['posts_per_page'] = count( $incposts ); $parsed_args['post__in'] = $incposts; } elseif ( ! empty( $parsed_args['exclude'] ) ) { $parsed_args['post__not_in'] = wp_parse_id_list( $parsed_args['exclude'] ); } $parsed_args['ignore_sticky_posts'] = true; $parsed_args['no_found_rows'] = true; $get_posts = new WP_Query; return $get_posts->query( $parsed_args ); } function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); } function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return delete_metadata( 'post', $post_id, $meta_key, $meta_value ); } function get_post_meta( $post_id, $key = '', $single = false ) { return get_metadata( 'post', $post_id, $key, $single ); } function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { $the_post = wp_is_post_revision( $post_id ); if ( $the_post ) { $post_id = $the_post; } return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); } function delete_post_meta_by_key( $post_meta_key ) { return delete_metadata( 'post', null, $post_meta_key, '', true ); } function register_post_meta( $post_type, $meta_key, array $args ) { $args['object_subtype'] = $post_type; return register_meta( 'post', $meta_key, $args ); } function unregister_post_meta( $post_type, $meta_key ) { return unregister_meta_key( 'post', $meta_key, $post_type ); } function get_post_custom( $post_id = 0 ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } return get_post_meta( $post_id ); } function get_post_custom_keys( $post_id = 0 ) { $custom = get_post_custom( $post_id ); if ( ! is_array( $custom ) ) { return; } $keys = array_keys( $custom ); if ( $keys ) { return $keys; } } function get_post_custom_values( $key = '', $post_id = 0 ) { if ( ! $key ) { return null; } $custom = get_post_custom( $post_id ); return isset( $custom[ $key ] ) ? $custom[ $key ] : null; } function is_sticky( $post_id = 0 ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } $stickies = get_option( 'sticky_posts' ); if ( is_array( $stickies ) ) { $stickies = array_map( 'intval', $stickies ); $is_sticky = in_array( $post_id, $stickies, true ); } else { $is_sticky = false; } return apply_filters( 'is_sticky', $is_sticky, $post_id ); } function sanitize_post( $post, $context = 'display' ) { if ( is_object( $post ) ) { if ( isset( $post->filter ) && $context == $post->filter ) { return $post; } if ( ! isset( $post->ID ) ) { $post->ID = 0; } foreach ( array_keys( get_object_vars( $post ) ) as $field ) { $post->$field = sanitize_post_field( $field, $post->$field, $post->ID, $context ); } $post->filter = $context; } elseif ( is_array( $post ) ) { if ( isset( $post['filter'] ) && $context == $post['filter'] ) { return $post; } if ( ! isset( $post['ID'] ) ) { $post['ID'] = 0; } foreach ( array_keys( $post ) as $field ) { $post[ $field ] = sanitize_post_field( $field, $post[ $field ], $post['ID'], $context ); } $post['filter'] = $context; } return $post; } function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { $int_fields = array( 'ID', 'post_parent', 'menu_order' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } $array_int_fields = array( 'ancestors' ); if ( in_array( $field, $array_int_fields, true ) ) { $value = array_map( 'absint', $value ); return $value; } if ( 'raw' === $context ) { return $value; } $prefixed = false; if ( false !== strpos( $field, 'post_' ) ) { $prefixed = true; $field_no_prefix = str_replace( 'post_', '', $field ); } if ( 'edit' === $context ) { $format_to_edit = array( 'post_content', 'post_excerpt', 'post_title', 'post_password' ); if ( $prefixed ) { $value = apply_filters( "edit_{$field}", $value, $post_id ); $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id ); } else { $value = apply_filters( "edit_post_{$field}", $value, $post_id ); } if ( in_array( $field, $format_to_edit, true ) ) { if ( 'post_content' === $field ) { $value = format_to_edit( $value, user_can_richedit() ); } else { $value = format_to_edit( $value ); } } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { if ( $prefixed ) { $value = apply_filters( "pre_{$field}", $value ); $value = apply_filters( "{$field_no_prefix}_save_pre", $value ); } else { $value = apply_filters( "pre_post_{$field}", $value ); $value = apply_filters( "{$field}_pre", $value ); } } else { if ( $prefixed ) { $value = apply_filters( "{$field}", $value, $post_id, $context ); } else { $value = apply_filters( "post_{$field}", $value, $post_id, $context ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function stick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); $updated = false; if ( ! is_array( $stickies ) ) { $stickies = array(); } else { $stickies = array_unique( array_map( 'intval', $stickies ) ); } if ( ! in_array( $post_id, $stickies, true ) ) { $stickies[] = $post_id; $updated = update_option( 'sticky_posts', array_values( $stickies ) ); } if ( $updated ) { do_action( 'post_stuck', $post_id ); } } function unstick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); if ( ! is_array( $stickies ) ) { return; } $stickies = array_values( array_unique( array_map( 'intval', $stickies ) ) ); if ( ! in_array( $post_id, $stickies, true ) ) { return; } $offset = array_search( $post_id, $stickies, true ); if ( false === $offset ) { return; } array_splice( $stickies, $offset, 1 ); $updated = update_option( 'sticky_posts', $stickies ); if ( $updated ) { do_action( 'post_unstuck', $post_id ); } } function _count_posts_cache_key( $type = 'post', $perm = '' ) { $cache_key = 'posts-' . $type; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $cache_key .= '_' . $perm . '_' . get_current_user_id(); } } return $cache_key; } function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; if ( ! post_type_exists( $type ) ) { return new stdClass; } $cache_key = _count_posts_cache_key( $type, $perm ); $counts = wp_cache_get( $cache_key, 'counts' ); if ( false !== $counts ) { foreach ( get_post_stati() as $status ) { if ( ! isset( $counts->{$status} ) ) { $counts->{$status} = 0; } } return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id() ); } } $query .= ' GROUP BY post_status'; $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; } $counts = (object) $counts; wp_cache_set( $cache_key, $counts, 'counts' ); return apply_filters( 'wp_count_posts', $counts, $type, $perm ); } function wp_count_attachments( $mime_type = '' ) { global $wpdb; $and = wp_post_mime_type_where( $mime_type ); $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A ); $counts = array(); foreach ( (array) $count as $row ) { $counts[ $row['post_mime_type'] ] = $row['num_posts']; } $counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and" ); return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type ); } function get_post_mime_types() { $post_mime_types = array( 'image' => array( __( 'Images' ), __( 'Manage Images' ), _n_noop( 'Image (%s)', 'Images (%s)' ), ), 'audio' => array( _x( 'Audio', 'file type group' ), __( 'Manage Audio' ), _n_noop( 'Audio (%s)', 'Audio (%s)' ), ), 'video' => array( _x( 'Video', 'file type group' ), __( 'Manage Video' ), _n_noop( 'Video (%s)', 'Video (%s)' ), ), 'document' => array( __( 'Documents' ), __( 'Manage Documents' ), _n_noop( 'Document (%s)', 'Documents (%s)' ), ), 'spreadsheet' => array( __( 'Spreadsheets' ), __( 'Manage Spreadsheets' ), _n_noop( 'Spreadsheet (%s)', 'Spreadsheets (%s)' ), ), 'archive' => array( _x( 'Archives', 'file type group' ), __( 'Manage Archives' ), _n_noop( 'Archive (%s)', 'Archives (%s)' ), ), ); $ext_types = wp_get_ext_types(); $mime_types = wp_get_mime_types(); foreach ( $post_mime_types as $group => $labels ) { if ( in_array( $group, array( 'image', 'audio', 'video' ), true ) ) { continue; } if ( ! isset( $ext_types[ $group ] ) ) { unset( $post_mime_types[ $group ] ); continue; } $group_mime_types = array(); foreach ( $ext_types[ $group ] as $extension ) { foreach ( $mime_types as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $group_mime_types[] = $mime; break; } } } $group_mime_types = implode( ',', array_unique( $group_mime_types ) ); $post_mime_types[ $group_mime_types ] = $labels; unset( $post_mime_types[ $group ] ); } return apply_filters( 'post_mime_types', $post_mime_types ); } function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) { $matches = array(); if ( is_string( $wildcard_mime_types ) ) { $wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) ); } if ( is_string( $real_mime_types ) ) { $real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) ); } $patternses = array(); $wild = '[-._a-z0-9]*'; foreach ( (array) $wildcard_mime_types as $type ) { $mimes = array_map( 'trim', explode( ',', $type ) ); foreach ( $mimes as $mime ) { $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) ); $patternses[][ $type ] = "^$regex$"; if ( false === strpos( $mime, '/' ) ) { $patternses[][ $type ] = "^$regex/"; $patternses[][ $type ] = $regex; } } } asort( $patternses ); foreach ( $patternses as $patterns ) { foreach ( $patterns as $type => $pattern ) { foreach ( (array) $real_mime_types as $real ) { if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ], true ) ) ) { $matches[ $type ][] = $real; } } } } return $matches; } function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) { $where = ''; $wildcards = array( '', '%', '%/%' ); if ( is_string( $post_mime_types ) ) { $post_mime_types = array_map( 'trim', explode( ',', $post_mime_types ) ); } $wheres = array(); foreach ( (array) $post_mime_types as $mime_type ) { $mime_type = preg_replace( '/\s/', '', $mime_type ); $slashpos = strpos( $mime_type, '/' ); if ( false !== $slashpos ) { $mime_group = preg_replace( '/[^-*.a-zA-Z0-9]/', '', substr( $mime_type, 0, $slashpos ) ); $mime_subgroup = preg_replace( '/[^-*.+a-zA-Z0-9]/', '', substr( $mime_type, $slashpos + 1 ) ); if ( empty( $mime_subgroup ) ) { $mime_subgroup = '*'; } else { $mime_subgroup = str_replace( '/', '', $mime_subgroup ); } $mime_pattern = "$mime_group/$mime_subgroup"; } else { $mime_pattern = preg_replace( '/[^-*.a-zA-Z0-9]/', '', $mime_type ); if ( false === strpos( $mime_pattern, '*' ) ) { $mime_pattern .= '/*'; } } $mime_pattern = preg_replace( '/\*+/', '%', $mime_pattern ); if ( in_array( $mime_type, $wildcards, true ) ) { return ''; } if ( false !== strpos( $mime_pattern, '%' ) ) { $wheres[] = empty( $table_alias ) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; } else { $wheres[] = empty( $table_alias ) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; } } if ( ! empty( $wheres ) ) { $where = ' AND (' . implode( ' OR ', $wheres ) . ') '; } return $where; } function wp_delete_post( $postid = 0, $force_delete = false ) { global $wpdb; $post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $postid ) ); if ( ! $post ) { return $post; } $post = get_post( $post ); if ( ! $force_delete && ( 'post' === $post->post_type || 'page' === $post->post_type ) && 'trash' !== get_post_status( $postid ) && EMPTY_TRASH_DAYS ) { return wp_trash_post( $postid ); } if ( 'attachment' === $post->post_type ) { return wp_delete_attachment( $postid, $force_delete ); } $check = apply_filters( 'pre_delete_post', null, $post, $force_delete ); if ( null !== $check ) { return $check; } do_action( 'before_delete_post', $postid, $post ); delete_post_meta( $postid, '_wp_trash_meta_status' ); delete_post_meta( $postid, '_wp_trash_meta_time' ); wp_delete_object_term_relationships( $postid, get_object_taxonomies( $post->post_type ) ); $parent_data = array( 'post_parent' => $post->post_parent ); $parent_where = array( 'post_parent' => $postid ); if ( is_post_type_hierarchical( $post->post_type ) ) { $children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type ); $children = $wpdb->get_results( $children_query ); if ( $children ) { $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); } } $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) ); foreach ( $revision_ids as $revision_id ) { wp_delete_post_revision( $revision_id ); } $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); wp_defer_comment_counting( true ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $postid ) ); foreach ( $comment_ids as $comment_id ) { wp_delete_comment( $comment_id, true ); } wp_defer_comment_counting( false ); $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ) ); foreach ( $post_meta_ids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } do_action( 'delete_post', $postid, $post ); $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) ); if ( ! $result ) { return false; } do_action( 'deleted_post', $postid, $post ); clean_post_cache( $post ); if ( is_post_type_hierarchical( $post->post_type ) && $children ) { foreach ( $children as $child ) { clean_post_cache( $child ); } } wp_clear_scheduled_hook( 'publish_future_post', array( $postid ) ); do_action( 'after_delete_post', $postid, $post ); return $post; } function _reset_front_page_settings_for_post( $post_id ) { $post = get_post( $post_id ); if ( 'page' === $post->post_type ) { if ( get_option( 'page_on_front' ) == $post->ID ) { update_option( 'show_on_front', 'posts' ); update_option( 'page_on_front', 0 ); } if ( get_option( 'page_for_posts' ) == $post->ID ) { update_option( 'page_for_posts', 0 ); } } unstick_post( $post->ID ); } function wp_trash_post( $post_id = 0 ) { if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_post( $post_id, true ); } $post = get_post( $post_id ); if ( ! $post ) { return $post; } if ( 'trash' === $post->post_status ) { return false; } $check = apply_filters( 'pre_trash_post', null, $post ); if ( null !== $check ) { return $check; } do_action( 'wp_trash_post', $post_id ); add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status ); add_post_meta( $post_id, '_wp_trash_meta_time', time() ); $post_updated = wp_update_post( array( 'ID' => $post_id, 'post_status' => 'trash', ) ); if ( ! $post_updated ) { return false; } wp_trash_post_comments( $post_id ); do_action( 'trashed_post', $post_id ); return $post; } function wp_untrash_post( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post ) { return $post; } $post_id = $post->ID; if ( 'trash' !== $post->post_status ) { return false; } $previous_status = get_post_meta( $post_id, '_wp_trash_meta_status', true ); $check = apply_filters( 'pre_untrash_post', null, $post, $previous_status ); if ( null !== $check ) { return $check; } do_action( 'untrash_post', $post_id, $previous_status ); $new_status = ( 'attachment' === $post->post_type ) ? 'inherit' : 'draft'; $post_status = apply_filters( 'wp_untrash_post_status', $new_status, $post_id, $previous_status ); delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); $post_updated = wp_update_post( array( 'ID' => $post_id, 'post_status' => $post_status, ) ); if ( ! $post_updated ) { return false; } wp_untrash_post_comments( $post_id ); do_action( 'untrashed_post', $post_id, $previous_status ); return $post; } function wp_trash_post_comments( $post = null ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; do_action( 'trash_post_comments', $post_id ); $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ) ); if ( ! $comments ) { return; } $statuses = array(); foreach ( $comments as $comment ) { $statuses[ $comment->comment_ID ] = $comment->comment_approved; } add_post_meta( $post_id, '_wp_trash_meta_comments_status', $statuses ); $result = $wpdb->update( $wpdb->comments, array( 'comment_approved' => 'post-trashed' ), array( 'comment_post_ID' => $post_id ) ); clean_comment_cache( array_keys( $statuses ) ); do_action( 'trashed_post_comments', $post_id, $statuses ); return $result; } function wp_untrash_post_comments( $post = null ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; $statuses = get_post_meta( $post_id, '_wp_trash_meta_comments_status', true ); if ( ! $statuses ) { return true; } do_action( 'untrash_post_comments', $post_id ); $group_by_status = array(); foreach ( $statuses as $comment_id => $comment_status ) { $group_by_status[ $comment_status ][] = $comment_id; } foreach ( $group_by_status as $status => $comments ) { if ( 'post-trashed' === $status ) { $status = '0'; } $comments_in = implode( ', ', array_map( 'intval', $comments ) ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) ); } clean_comment_cache( array_keys( $statuses ) ); delete_post_meta( $post_id, '_wp_trash_meta_comments_status' ); do_action( 'untrashed_post_comments', $post_id ); } function wp_get_post_categories( $post_id = 0, $args = array() ) { $post_id = (int) $post_id; $defaults = array( 'fields' => 'ids' ); $args = wp_parse_args( $args, $defaults ); $cats = wp_get_object_terms( $post_id, 'category', $args ); return $cats; } function wp_get_post_tags( $post_id = 0, $args = array() ) { return wp_get_post_terms( $post_id, 'post_tag', $args ); } function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) { $post_id = (int) $post_id; $defaults = array( 'fields' => 'all' ); $args = wp_parse_args( $args, $defaults ); $tags = wp_get_object_terms( $post_id, $taxonomy, $args ); return $tags; } function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) { if ( is_numeric( $args ) ) { _deprecated_argument( __FUNCTION__, '3.1.0', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) ); $args = array( 'numberposts' => absint( $args ) ); } $defaults = array( 'numberposts' => 10, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $results = get_posts( $parsed_args ); if ( ARRAY_A === $output ) { foreach ( $results as $key => $result ) { $results[ $key ] = get_object_vars( $result ); } return $results ? $results : array(); } return $results ? $results : false; } function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) { global $wpdb; $unsanitized_postarr = $postarr; $user_id = get_current_user_id(); $defaults = array( 'post_author' => $user_id, 'post_content' => '', 'post_content_filtered' => '', 'post_title' => '', 'post_excerpt' => '', 'post_status' => 'draft', 'post_type' => 'post', 'comment_status' => '', 'ping_status' => '', 'post_password' => '', 'to_ping' => '', 'pinged' => '', 'post_parent' => 0, 'menu_order' => 0, 'guid' => '', 'import_id' => 0, 'context' => '', 'post_date' => '', 'post_date_gmt' => '', ); $postarr = wp_parse_args( $postarr, $defaults ); unset( $postarr['filter'] ); $postarr = sanitize_post( $postarr, 'db' ); $post_ID = 0; $update = false; $guid = $postarr['guid']; if ( ! empty( $postarr['ID'] ) ) { $update = true; $post_ID = $postarr['ID']; $post_before = get_post( $post_ID ); if ( is_null( $post_before ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } return 0; } $guid = get_post_field( 'guid', $post_ID ); $previous_status = get_post_field( 'post_status', $post_ID ); } else { $previous_status = 'new'; $post_before = null; } $post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type']; $post_title = $postarr['post_title']; $post_content = $postarr['post_content']; $post_excerpt = $postarr['post_excerpt']; if ( isset( $postarr['post_name'] ) ) { $post_name = $postarr['post_name']; } elseif ( $update ) { $post_name = $post_before->post_name; } $maybe_empty = 'attachment' !== $post_type && ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { if ( $wp_error ) { return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); } else { return 0; } } $post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status']; if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) { $post_status = 'inherit'; } if ( ! empty( $postarr['post_category'] ) ) { $post_category = array_filter( $postarr['post_category'] ); } if ( empty( $post_category ) || 0 === count( $post_category ) || ! is_array( $post_category ) ) { if ( 'post' === $post_type && 'auto-draft' !== $post_status ) { $post_category = array( get_option( 'default_category' ) ); } else { $post_category = array(); } } $post_type_object = get_post_type_object( $post_type ); if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) { $post_name = ''; } elseif ( $update && 'pending' === $post_status && ! current_user_can( 'publish_post', $post_ID ) ) { $post_name = ''; } if ( empty( $post_name ) ) { if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) { $post_name = sanitize_title( $post_title ); } else { $post_name = ''; } } else { $check_name = sanitize_title( $post_name, '', 'old-save' ); if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) { $post_name = $check_name; } else { $post_name = sanitize_title( $post_name ); } } $post_date = wp_resolve_post_date( $postarr['post_date'], $postarr['post_date_gmt'] ); if ( ! $post_date ) { if ( $wp_error ) { return new WP_Error( 'invalid_date', __( 'Invalid date.' ) ); } else { return 0; } } if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_date_gmt'] ) { if ( ! in_array( $post_status, get_post_stati( array( 'date_floating' => true ) ), true ) ) { $post_date_gmt = get_gmt_from_date( $post_date ); } else { $post_date_gmt = '0000-00-00 00:00:00'; } } else { $post_date_gmt = $postarr['post_date_gmt']; } if ( $update || '0000-00-00 00:00:00' === $post_date ) { $post_modified = current_time( 'mysql' ); $post_modified_gmt = current_time( 'mysql', 1 ); } else { $post_modified = $post_date; $post_modified_gmt = $post_date_gmt; } if ( 'attachment' !== $post_type ) { $now = gmdate( 'Y-m-d H:i:s' ); if ( 'publish' === $post_status ) { if ( strtotime( $post_date_gmt ) - strtotime( $now ) >= MINUTE_IN_SECONDS ) { $post_status = 'future'; } } elseif ( 'future' === $post_status ) { if ( strtotime( $post_date_gmt ) - strtotime( $now ) < MINUTE_IN_SECONDS ) { $post_status = 'publish'; } } } if ( empty( $postarr['comment_status'] ) ) { if ( $update ) { $comment_status = 'closed'; } else { $comment_status = get_default_comment_status( $post_type ); } } else { $comment_status = $postarr['comment_status']; } $post_content_filtered = $postarr['post_content_filtered']; $post_author = isset( $postarr['post_author'] ) ? $postarr['post_author'] : $user_id; $ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status']; $to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : ''; $pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : ''; $import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0; if ( isset( $postarr['menu_order'] ) ) { $menu_order = (int) $postarr['menu_order']; } else { $menu_order = 0; } $post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : ''; if ( 'private' === $post_status ) { $post_password = ''; } if ( isset( $postarr['post_parent'] ) ) { $post_parent = (int) $postarr['post_parent']; } else { $post_parent = 0; } $new_postarr = array_merge( array( 'ID' => $post_ID, ), compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) ) ); $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr ); if ( 'trash' === $previous_status && 'trash' !== $post_status ) { $desired_post_slug = get_post_meta( $post_ID, '_wp_desired_post_slug', true ); if ( $desired_post_slug ) { delete_post_meta( $post_ID, '_wp_desired_post_slug' ); $post_name = $desired_post_slug; } } if ( 'trash' !== $post_status && $post_name ) { $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID ); if ( $add_trashed_suffix ) { wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID ); } } if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) { $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ID ); } $post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent ); $post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : ''; $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ); $emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' ); foreach ( $emoji_fields as $emoji_field ) { if ( isset( $data[ $emoji_field ] ) ) { $charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field ); if ( 'utf8' === $charset ) { $data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] ); } } } if ( 'attachment' === $post_type ) { $data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr, $update ); } else { $data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr, $update ); } $data = wp_unslash( $data ); $where = array( 'ID' => $post_ID ); if ( $update ) { do_action( 'pre_post_update', $post_ID, $data ); if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { if ( $wp_error ) { if ( 'attachment' === $post_type ) { $message = __( 'Could not update attachment in the database.' ); } else { $message = __( 'Could not update post in the database.' ); } return new WP_Error( 'db_update_error', $message, $wpdb->last_error ); } else { return 0; } } } else { if ( ! empty( $import_id ) ) { $import_id = (int) $import_id; if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id ) ) ) { $data['ID'] = $import_id; } } if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { if ( $wp_error ) { if ( 'attachment' === $post_type ) { $message = __( 'Could not insert attachment into the database.' ); } else { $message = __( 'Could not insert post into the database.' ); } return new WP_Error( 'db_insert_error', $message, $wpdb->last_error ); } else { return 0; } } $post_ID = (int) $wpdb->insert_id; $where = array( 'ID' => $post_ID ); } if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) { $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent ); $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); clean_post_cache( $post_ID ); } if ( is_object_in_taxonomy( $post_type, 'category' ) ) { wp_set_post_categories( $post_ID, $post_category ); } if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) { wp_set_post_tags( $post_ID, $postarr['tags_input'] ); } if ( 'auto-draft' !== $post_status ) { foreach ( get_object_taxonomies( $post_type, 'object' ) as $taxonomy => $tax_object ) { if ( ! empty( $tax_object->default_term ) ) { if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) { $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] ); } $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { $postarr['tax_input'][ $taxonomy ] = $terms; } if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) { $default_term_id = get_option( 'default_term_' . $taxonomy ); if ( ! empty( $default_term_id ) ) { $postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id ); } } } } } if ( ! empty( $postarr['tax_input'] ) ) { foreach ( $postarr['tax_input'] as $taxonomy => $tags ) { $taxonomy_obj = get_taxonomy( $taxonomy ); if ( ! $taxonomy_obj ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid taxonomy: %s.' ), $taxonomy ), '4.4.0' ); continue; } if ( is_array( $tags ) ) { $tags = array_filter( $tags ); } if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) { wp_set_post_terms( $post_ID, $tags, $taxonomy ); } } } if ( ! empty( $postarr['meta_input'] ) ) { foreach ( $postarr['meta_input'] as $field => $value ) { update_post_meta( $post_ID, $field, $value ); } } $current_guid = get_post_field( 'guid', $post_ID ); if ( ! $update && '' === $current_guid ) { $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); } if ( 'attachment' === $postarr['post_type'] ) { if ( ! empty( $postarr['file'] ) ) { update_attached_file( $post_ID, $postarr['file'] ); } if ( ! empty( $postarr['context'] ) ) { add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true ); } } if ( isset( $postarr['_thumbnail_id'] ) ) { $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type; if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { if ( wp_attachment_is( 'audio', $post_ID ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post_ID ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } if ( $thumbnail_support ) { $thumbnail_id = (int) $postarr['_thumbnail_id']; if ( -1 === $thumbnail_id ) { delete_post_thumbnail( $post_ID ); } else { set_post_thumbnail( $post_ID, $thumbnail_id ); } } } clean_post_cache( $post_ID ); $post = get_post( $post_ID ); if ( ! empty( $postarr['page_template'] ) ) { $post->page_template = $postarr['page_template']; $page_templates = wp_get_theme()->get_page_templates( $post ); if ( 'default' !== $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_page_template', __( 'Invalid page template.' ) ); } update_post_meta( $post_ID, '_wp_page_template', 'default' ); } else { update_post_meta( $post_ID, '_wp_page_template', $postarr['page_template'] ); } } if ( 'attachment' !== $postarr['post_type'] ) { wp_transition_post_status( $data['post_status'], $previous_status, $post ); } else { if ( $update ) { do_action( 'edit_attachment', $post_ID ); $post_after = get_post( $post_ID ); do_action( 'attachment_updated', $post_ID, $post_after, $post_before ); } else { do_action( 'add_attachment', $post_ID ); } return $post_ID; } if ( $update ) { do_action( "edit_post_{$post->post_type}", $post_ID, $post ); do_action( 'edit_post', $post_ID, $post ); $post_after = get_post( $post_ID ); do_action( 'post_updated', $post_ID, $post_after, $post_before ); } do_action( "save_post_{$post->post_type}", $post_ID, $post, $update ); do_action( 'save_post', $post_ID, $post, $update ); do_action( 'wp_insert_post', $post_ID, $post, $update ); if ( $fire_after_hooks ) { wp_after_insert_post( $post, $update, $post_before ); } return $post_ID; } function wp_update_post( $postarr = array(), $wp_error = false, $fire_after_hooks = true ) { if ( is_object( $postarr ) ) { $postarr = get_object_vars( $postarr ); $postarr = wp_slash( $postarr ); } $post = get_post( $postarr['ID'], ARRAY_A ); if ( is_null( $post ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) ); } return 0; } $post = wp_slash( $post ); if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] ) && count( $postarr['post_category'] ) > 0 ) { $post_cats = $postarr['post_category']; } else { $post_cats = $post['post_category']; } if ( isset( $post['post_status'] ) && in_array( $post['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) && empty( $postarr['edit_date'] ) && ( '0000-00-00 00:00:00' === $post['post_date_gmt'] ) ) { $clear_date = true; } else { $clear_date = false; } $postarr = array_merge( $post, $postarr ); $postarr['post_category'] = $post_cats; if ( $clear_date ) { $postarr['post_date'] = current_time( 'mysql' ); $postarr['post_date_gmt'] = ''; } if ( 'attachment' === $postarr['post_type'] ) { return wp_insert_attachment( $postarr, false, 0, $wp_error ); } if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $postarr['post_type'], 'post_tag' ) ) { $tags = get_the_terms( $postarr['ID'], 'post_tag' ); $tag_names = array(); if ( $tags && ! is_wp_error( $tags ) ) { $tag_names = wp_list_pluck( $tags, 'name' ); } if ( $postarr['tags_input'] === $tag_names ) { unset( $postarr['tags_input'] ); } } return wp_insert_post( $postarr, $wp_error, $fire_after_hooks ); } function wp_publish_post( $post ) { global $wpdb; $post = get_post( $post ); if ( ! $post ) { return; } if ( 'publish' === $post->post_status ) { return; } $post_before = get_post( $post->ID ); foreach ( get_object_taxonomies( $post->post_type, 'object' ) as $taxonomy => $tax_object ) { if ( 'category' !== $taxonomy && empty( $tax_object->default_term ) ) { continue; } if ( ! empty( get_the_terms( $post, $taxonomy ) ) ) { continue; } if ( 'category' === $taxonomy ) { $default_term_id = (int) get_option( 'default_category', 0 ); } else { $default_term_id = (int) get_option( 'default_term_' . $taxonomy, 0 ); } if ( ! $default_term_id ) { continue; } wp_set_post_terms( $post->ID, array( $default_term_id ), $taxonomy ); } $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); $old_status = $post->post_status; $post->post_status = 'publish'; wp_transition_post_status( 'publish', $old_status, $post ); do_action( "edit_post_{$post->post_type}", $post->ID, $post ); do_action( 'edit_post', $post->ID, $post ); do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); do_action( 'save_post', $post->ID, $post, true ); do_action( 'wp_insert_post', $post->ID, $post, true ); wp_after_insert_post( $post, true, $post_before ); } function check_and_publish_future_post( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return; } if ( 'future' !== $post->post_status ) { return; } $time = strtotime( $post->post_date_gmt . ' GMT' ); if ( $time > time() ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); return; } wp_publish_post( $post_id ); } function wp_resolve_post_date( $post_date = '', $post_date_gmt = '' ) { if ( empty( $post_date ) || '0000-00-00 00:00:00' === $post_date ) { if ( empty( $post_date_gmt ) || '0000-00-00 00:00:00' === $post_date_gmt ) { $post_date = current_time( 'mysql' ); } else { $post_date = get_date_from_gmt( $post_date_gmt ); } } $month = substr( $post_date, 5, 2 ); $day = substr( $post_date, 8, 2 ); $year = substr( $post_date, 0, 4 ); $valid_date = wp_checkdate( $month, $day, $year, $post_date ); if ( ! $valid_date ) { return false; } return $post_date; } function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) || ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type ) { return $slug; } $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent ); if ( null !== $override_slug ) { return $override_slug; } global $wpdb, $wp_rewrite; $original_slug = $slug; $feeds = $wp_rewrite->feeds; if ( ! is_array( $feeds ) ) { $feeds = array(); } if ( 'attachment' === $post_type ) { $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) ); $is_bad_attachment_slug = apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || $is_bad_attachment_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } elseif ( is_post_type_hierarchical( $post_type ) ) { if ( 'nav_menu_item' === $post_type ) { return $slug; } $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) ); $is_bad_hierarchical_slug = apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || $is_bad_hierarchical_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } else { $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); $post = get_post( $post_ID ); $conflicts_with_date_archive = false; if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) ) { $slug_num = (int) $slug; if ( $slug_num ) { $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs, true ); if ( 0 === $postname_index || ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && 13 > $slug_num ) || ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && 32 > $slug_num ) ) { $conflicts_with_date_archive = true; } } } $is_bad_flat_slug = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ); if ( $post_name_check || in_array( $slug, $feeds, true ) || 'embed' === $slug || $conflicts_with_date_archive || $is_bad_flat_slug ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name; } } return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ); } function _truncate_post_slug( $slug, $length = 200 ) { if ( strlen( $slug ) > $length ) { $decoded_slug = urldecode( $slug ); if ( $decoded_slug === $slug ) { $slug = substr( $slug, 0, $length ); } else { $slug = utf8_uri_encode( $decoded_slug, $length, true ); } } return rtrim( $slug, '-' ); } function wp_add_post_tags( $post_id = 0, $tags = '' ) { return wp_set_post_tags( $post_id, $tags, true ); } function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { return wp_set_post_terms( $post_id, $tags, 'post_tag', $append ); } function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { $post_id = (int) $post_id; if ( ! $post_id ) { return false; } if ( empty( $tags ) ) { $tags = array(); } if ( ! is_array( $tags ) ) { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $tags = str_replace( $comma, ',', $tags ); } $tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) ); } if ( is_taxonomy_hierarchical( $taxonomy ) ) { $tags = array_unique( array_map( 'intval', $tags ) ); } return wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); } function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) { $post_ID = (int) $post_ID; $post_type = get_post_type( $post_ID ); $post_status = get_post_status( $post_ID ); $post_categories = (array) $post_categories; if ( empty( $post_categories ) ) { $default_category_post_types = apply_filters( 'default_category_post_types', array() ); $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); if ( in_array( $post_type, $default_category_post_types, true ) && is_object_in_taxonomy( $post_type, 'category' ) && 'auto-draft' !== $post_status ) { $post_categories = array( get_option( 'default_category' ) ); $append = false; } else { $post_categories = array(); } } elseif ( 1 === count( $post_categories ) && '' === reset( $post_categories ) ) { return true; } return wp_set_post_terms( $post_ID, $post_categories, 'category', $append ); } function wp_transition_post_status( $new_status, $old_status, $post ) { do_action( 'transition_post_status', $new_status, $old_status, $post ); do_action( "{$old_status}_to_{$new_status}", $post ); do_action( "{$new_status}_{$post->post_type}", $post->ID, $post, $old_status ); } function wp_after_insert_post( $post, $update, $post_before ) { $post = get_post( $post ); if ( ! $post ) { return; } $post_id = $post->ID; do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before ); } function add_ping( $post_id, $uri ) { global $wpdb; $post = get_post( $post_id ); if ( ! $post ) { return false; } $pung = trim( $post->pinged ); $pung = preg_split( '/\s/', $pung ); if ( is_array( $uri ) ) { $pung = array_merge( $pung, $uri ); } else { $pung[] = $uri; } $new = implode( "\n", $pung ); $new = apply_filters( 'add_ping', $new ); $return = $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $return; } function get_enclosed( $post_id ) { $custom_fields = get_post_custom( $post_id ); $pung = array(); if ( ! is_array( $custom_fields ) ) { return $pung; } foreach ( $custom_fields as $key => $val ) { if ( 'enclosure' !== $key || ! is_array( $val ) ) { continue; } foreach ( $val as $enc ) { $enclosure = explode( "\n", $enc ); $pung[] = trim( $enclosure[0] ); } } return apply_filters( 'get_enclosed', $pung, $post_id ); } function get_pung( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $pung = trim( $post->pinged ); $pung = preg_split( '/\s/', $pung ); return apply_filters( 'get_pung', $pung ); } function get_to_ping( $post_id ) { $post = get_post( $post_id ); if ( ! $post ) { return false; } $to_ping = sanitize_trackback_urls( $post->to_ping ); $to_ping = preg_split( '/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY ); return apply_filters( 'get_to_ping', $to_ping ); } function trackback_url_list( $tb_list, $post_id ) { if ( ! empty( $tb_list ) ) { $postdata = get_post( $post_id, ARRAY_A ); $excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] ); if ( strlen( $excerpt ) > 255 ) { $excerpt = substr( $excerpt, 0, 252 ) . '…'; } $trackback_urls = explode( ',', $tb_list ); foreach ( (array) $trackback_urls as $tb_url ) { $tb_url = trim( $tb_url ); trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id ); } } } function get_all_page_ids() { global $wpdb; $page_ids = wp_cache_get( 'all_page_ids', 'posts' ); if ( ! is_array( $page_ids ) ) { $page_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type = 'page'" ); wp_cache_add( 'all_page_ids', $page_ids, 'posts' ); } return $page_ids; } function get_page( $page, $output = OBJECT, $filter = 'raw' ) { return get_post( $page, $output, $filter ); } function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) { global $wpdb; $last_changed = wp_cache_get_last_changed( 'posts' ); $hash = md5( $page_path . serialize( $post_type ) ); $cache_key = "get_page_by_path:$hash:$last_changed"; $cached = wp_cache_get( $cache_key, 'posts' ); if ( false !== $cached ) { if ( '0' === $cached || 0 === $cached ) { return; } else { return get_post( $cached, $output ); } } $page_path = rawurlencode( urldecode( $page_path ) ); $page_path = str_replace( '%2F', '/', $page_path ); $page_path = str_replace( '%20', ' ', $page_path ); $parts = explode( '/', trim( $page_path, '/' ) ); $parts = array_map( 'sanitize_title_for_query', $parts ); $escaped_parts = esc_sql( $parts ); $in_string = "'" . implode( "','", $escaped_parts ) . "'"; if ( is_array( $post_type ) ) { $post_types = $post_type; } else { $post_types = array( $post_type, 'attachment' ); } $post_types = esc_sql( $post_types ); $post_type_in_string = "'" . implode( "','", $post_types ) . "'"; $sql = " - SELECT ID, post_name, post_parent, post_type - FROM $wpdb->posts - WHERE post_name IN ($in_string) - AND post_type IN ($post_type_in_string) - "; $pages = $wpdb->get_results( $sql, OBJECT_K ); $revparts = array_reverse( $parts ); $foundid = 0; foreach ( (array) $pages as $page ) { if ( $page->post_name == $revparts[0] ) { $count = 0; $p = $page; while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) { $count++; $parent = $pages[ $p->post_parent ]; if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) { break; } $p = $parent; } if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) { $foundid = $page->ID; if ( $page->post_type == $post_type ) { break; } } } } wp_cache_set( $cache_key, $foundid, 'posts' ); if ( $foundid ) { return get_post( $foundid, $output ); } return null; } function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { global $wpdb; if ( is_array( $post_type ) ) { $post_type = esc_sql( $post_type ); $post_type_in_string = "'" . implode( "','", $post_type ) . "'"; $sql = $wpdb->prepare( " - SELECT ID - FROM $wpdb->posts - WHERE post_title = %s - AND post_type IN ($post_type_in_string) - ", $page_title ); } else { $sql = $wpdb->prepare( " - SELECT ID - FROM $wpdb->posts - WHERE post_title = %s - AND post_type = %s - ", $page_title, $post_type ); } $page = $wpdb->get_var( $sql ); if ( $page ) { return get_post( $page, $output ); } return null; } function get_page_children( $page_id, $pages ) { $children = array(); foreach ( (array) $pages as $page ) { $children[ (int) $page->post_parent ][] = $page; } $page_list = array(); if ( isset( $children[ $page_id ] ) ) { $to_look = array_reverse( $children[ $page_id ] ); while ( $to_look ) { $p = array_pop( $to_look ); $page_list[] = $p; if ( isset( $children[ $p->ID ] ) ) { foreach ( array_reverse( $children[ $p->ID ] ) as $child ) { $to_look[] = $child; } } } } return $page_list; } function get_page_hierarchy( &$pages, $page_id = 0 ) { if ( empty( $pages ) ) { return array(); } $children = array(); foreach ( (array) $pages as $p ) { $parent_id = (int) $p->post_parent; $children[ $parent_id ][] = $p; } $result = array(); _page_traverse_name( $page_id, $children, $result ); return $result; } function _page_traverse_name( $page_id, &$children, &$result ) { if ( isset( $children[ $page_id ] ) ) { foreach ( (array) $children[ $page_id ] as $child ) { $result[ $child->ID ] = $child->post_name; _page_traverse_name( $child->ID, $children, $result ); } } } function get_page_uri( $page = 0 ) { if ( ! $page instanceof WP_Post ) { $page = get_post( $page ); } if ( ! $page ) { return false; } $uri = $page->post_name; foreach ( $page->ancestors as $parent ) { $parent = get_post( $parent ); if ( $parent && $parent->post_name ) { $uri = $parent->post_name . '/' . $uri; } } return apply_filters( 'get_page_uri', $uri, $page ); } function get_pages( $args = array() ) { global $wpdb; $defaults = array( 'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => array(), 'include' => array(), 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'parent' => -1, 'exclude_tree' => array(), 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish', ); $parsed_args = wp_parse_args( $args, $defaults ); $number = (int) $parsed_args['number']; $offset = (int) $parsed_args['offset']; $child_of = (int) $parsed_args['child_of']; $hierarchical = $parsed_args['hierarchical']; $exclude = $parsed_args['exclude']; $meta_key = $parsed_args['meta_key']; $meta_value = $parsed_args['meta_value']; $parent = $parsed_args['parent']; $post_status = $parsed_args['post_status']; $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); if ( ! in_array( $parsed_args['post_type'], $hierarchical_post_types, true ) ) { return false; } if ( $parent > 0 && ! $child_of ) { $hierarchical = false; } if ( ! is_array( $post_status ) ) { $post_status = explode( ',', $post_status ); } if ( array_diff( $post_status, get_post_stati() ) ) { return false; } $key = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) ); $last_changed = wp_cache_get_last_changed( 'posts' ); $cache_key = "get_pages:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'posts' ); if ( false !== $cache ) { _prime_post_caches( $cache, false, false ); $pages = array_map( 'get_post', $cache ); $pages = apply_filters( 'get_pages', $pages, $parsed_args ); return $pages; } $inclusions = ''; if ( ! empty( $parsed_args['include'] ) ) { $child_of = 0; $parent = -1; $exclude = ''; $meta_key = ''; $meta_value = ''; $hierarchical = false; $incpages = wp_parse_id_list( $parsed_args['include'] ); if ( ! empty( $incpages ) ) { $inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')'; } } $exclusions = ''; if ( ! empty( $exclude ) ) { $expages = wp_parse_id_list( $exclude ); if ( ! empty( $expages ) ) { $exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) . ')'; } } $author_query = ''; if ( ! empty( $parsed_args['authors'] ) ) { $post_authors = wp_parse_list( $parsed_args['authors'] ); if ( ! empty( $post_authors ) ) { foreach ( $post_authors as $post_author ) { if ( 0 == (int) $post_author ) { $post_author = get_user_by( 'login', $post_author ); if ( empty( $post_author ) ) { continue; } if ( empty( $post_author->ID ) ) { continue; } $post_author = $post_author->ID; } if ( '' === $author_query ) { $author_query = $wpdb->prepare( ' post_author = %d ', $post_author ); } else { $author_query .= $wpdb->prepare( ' OR post_author = %d ', $post_author ); } } if ( '' !== $author_query ) { $author_query = " AND ($author_query)"; } } } $join = ''; $where = "$exclusions $inclusions "; if ( '' !== $meta_key || '' !== $meta_value ) { $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); if ( '' !== $meta_key ) { $where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_key = %s", $meta_key ); } if ( '' !== $meta_value ) { $where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_value = %s", $meta_value ); } } if ( is_array( $parent ) ) { $post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) ); if ( ! empty( $post_parent__in ) ) { $where .= " AND post_parent IN ($post_parent__in)"; } } elseif ( $parent >= 0 ) { $where .= $wpdb->prepare( ' AND post_parent = %d ', $parent ); } if ( 1 === count( $post_status ) ) { $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $parsed_args['post_type'], reset( $post_status ) ); } else { $post_status = implode( "', '", $post_status ); $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $parsed_args['post_type'] ); } $orderby_array = array(); $allowed_keys = array( 'author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified', 'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent', 'ID', 'rand', 'comment_count', ); foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) { $orderby = trim( $orderby ); if ( ! in_array( $orderby, $allowed_keys, true ) ) { continue; } switch ( $orderby ) { case 'menu_order': break; case 'ID': $orderby = "$wpdb->posts.ID"; break; case 'rand': $orderby = 'RAND()'; break; case 'comment_count': $orderby = "$wpdb->posts.comment_count"; break; default: if ( 0 === strpos( $orderby, 'post_' ) ) { $orderby = "$wpdb->posts." . $orderby; } else { $orderby = "$wpdb->posts.post_" . $orderby; } } $orderby_array[] = $orderby; } $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title"; $sort_order = strtoupper( $parsed_args['sort_order'] ); if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ), true ) ) { $sort_order = 'ASC'; } $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; $query .= $author_query; $query .= ' ORDER BY ' . $sort_column . ' ' . $sort_order; if ( ! empty( $number ) ) { $query .= ' LIMIT ' . $offset . ',' . $number; } $pages = $wpdb->get_results( $query ); if ( empty( $pages ) ) { wp_cache_set( $cache_key, array(), 'posts' ); $pages = apply_filters( 'get_pages', array(), $parsed_args ); return $pages; } $num_pages = count( $pages ); for ( $i = 0; $i < $num_pages; $i++ ) { $pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' ); } update_post_cache( $pages ); if ( $child_of || $hierarchical ) { $pages = get_page_children( $child_of, $pages ); } if ( ! empty( $parsed_args['exclude_tree'] ) ) { $exclude = wp_parse_id_list( $parsed_args['exclude_tree'] ); foreach ( $exclude as $id ) { $children = get_page_children( $id, $pages ); foreach ( $children as $child ) { $exclude[] = $child->ID; } } $num_pages = count( $pages ); for ( $i = 0; $i < $num_pages; $i++ ) { if ( in_array( $pages[ $i ]->ID, $exclude, true ) ) { unset( $pages[ $i ] ); } } } $page_structure = array(); foreach ( $pages as $page ) { $page_structure[] = $page->ID; } wp_cache_set( $cache_key, $page_structure, 'posts' ); $pages = array_map( 'get_post', $pages ); return apply_filters( 'get_pages', $pages, $parsed_args ); } function is_local_attachment( $url ) { if ( strpos( $url, home_url() ) === false ) { return false; } if ( strpos( $url, home_url( '/?attachment_id=' ) ) !== false ) { return true; } $id = url_to_postid( $url ); if ( $id ) { $post = get_post( $id ); if ( 'attachment' === $post->post_type ) { return true; } } return false; } function wp_insert_attachment( $args, $file = false, $parent = 0, $wp_error = false, $fire_after_hooks = true ) { $defaults = array( 'file' => $file, 'post_parent' => 0, ); $data = wp_parse_args( $args, $defaults ); if ( ! empty( $parent ) ) { $data['post_parent'] = $parent; } $data['post_type'] = 'attachment'; return wp_insert_post( $data, $wp_error, $fire_after_hooks ); } function wp_delete_attachment( $post_id, $force_delete = false ) { global $wpdb; $post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id ) ); if ( ! $post ) { return $post; } $post = get_post( $post ); if ( 'attachment' !== $post->post_type ) { return false; } if ( ! $force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' !== $post->post_status ) { return wp_trash_post( $post_id ); } $check = apply_filters( 'pre_delete_attachment', null, $post, $force_delete ); if ( null !== $check ) { return $check; } delete_post_meta( $post_id, '_wp_trash_meta_status' ); delete_post_meta( $post_id, '_wp_trash_meta_time' ); $meta = wp_get_attachment_metadata( $post_id ); $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); $file = get_attached_file( $post_id ); if ( is_multisite() && is_string( $file ) && ! empty( $file ) ) { clean_dirsize_cache( $file ); } do_action( 'delete_attachment', $post_id, $post ); wp_delete_object_term_relationships( $post_id, array( 'category', 'post_tag' ) ); wp_delete_object_term_relationships( $post_id, get_object_taxonomies( $post->post_type ) ); delete_metadata( 'post', null, '_thumbnail_id', $post_id, true ); wp_defer_comment_counting( true ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $post_id ) ); foreach ( $comment_ids as $comment_id ) { wp_delete_comment( $comment_id, true ); } wp_defer_comment_counting( false ); $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ) ); foreach ( $post_meta_ids as $mid ) { delete_metadata_by_mid( 'post', $mid ); } do_action( 'delete_post', $post_id, $post ); $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) ); if ( ! $result ) { return false; } do_action( 'deleted_post', $post_id, $post ); wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ); clean_post_cache( $post ); return $post; } function wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ) { global $wpdb; $uploadpath = wp_get_upload_dir(); $deleted = true; if ( ! empty( $meta['thumb'] ) ) { if ( ! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id ) ) ) { $thumbfile = str_replace( wp_basename( $file ), $meta['thumb'], $file ); if ( ! empty( $thumbfile ) ) { $thumbfile = path_join( $uploadpath['basedir'], $thumbfile ); $thumbdir = path_join( $uploadpath['basedir'], dirname( $file ) ); if ( ! wp_delete_file_from_directory( $thumbfile, $thumbdir ) ) { $deleted = false; } } } } if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) { $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) ); foreach ( $meta['sizes'] as $size => $sizeinfo ) { $intermediate_file = str_replace( wp_basename( $file ), $sizeinfo['file'], $file ); if ( ! empty( $intermediate_file ) ) { $intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file ); if ( ! wp_delete_file_from_directory( $intermediate_file, $intermediate_dir ) ) { $deleted = false; } } } } if ( ! empty( $meta['original_image'] ) ) { if ( empty( $intermediate_dir ) ) { $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) ); } $original_image = str_replace( wp_basename( $file ), $meta['original_image'], $file ); if ( ! empty( $original_image ) ) { $original_image = path_join( $uploadpath['basedir'], $original_image ); if ( ! wp_delete_file_from_directory( $original_image, $intermediate_dir ) ) { $deleted = false; } } } if ( is_array( $backup_sizes ) ) { $del_dir = path_join( $uploadpath['basedir'], dirname( $meta['file'] ) ); foreach ( $backup_sizes as $size ) { $del_file = path_join( dirname( $meta['file'] ), $size['file'] ); if ( ! empty( $del_file ) ) { $del_file = path_join( $uploadpath['basedir'], $del_file ); if ( ! wp_delete_file_from_directory( $del_file, $del_dir ) ) { $deleted = false; } } } } if ( ! wp_delete_file_from_directory( $file, $uploadpath['basedir'] ) ) { $deleted = false; } return $deleted; } function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { $attachment_id = (int) $attachment_id; if ( ! $attachment_id ) { $post = get_post(); if ( ! $post ) { return false; } $attachment_id = $post->ID; } $data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); if ( ! $data ) { return false; } if ( $unfiltered ) { return $data; } return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); } function wp_update_attachment_metadata( $attachment_id, $data ) { $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); if ( ! $post ) { return false; } $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); if ( $data ) { return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); } else { return delete_post_meta( $post->ID, '_wp_attachment_metadata' ); } } function wp_get_attachment_url( $attachment_id = 0 ) { global $pagenow; $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); if ( ! $post ) { return false; } if ( 'attachment' !== $post->post_type ) { return false; } $url = ''; $file = get_post_meta( $post->ID, '_wp_attached_file', true ); if ( $file ) { $uploads = wp_get_upload_dir(); if ( $uploads && false === $uploads['error'] ) { if ( 0 === strpos( $file, $uploads['basedir'] ) ) { $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $file ); } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) { $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . wp_basename( $file ); } else { $url = $uploads['baseurl'] . "/$file"; } } } if ( ! $url ) { $url = get_the_guid( $post->ID ); } if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) { $url = set_url_scheme( $url ); } $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID ); if ( ! $url ) { return false; } return $url; } function wp_get_attachment_caption( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } if ( 'attachment' !== $post->post_type ) { return false; } $caption = $post->post_excerpt; return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID ); } function wp_get_attachment_thumb_file( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } $imagedata = wp_get_attachment_metadata( $post->ID ); if ( ! is_array( $imagedata ) ) { return false; } $file = get_attached_file( $post->ID ); if ( ! empty( $imagedata['thumb'] ) ) { $thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file ); if ( file_exists( $thumbfile ) ) { return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); } } return false; } function wp_get_attachment_thumb_url( $post_id = 0 ) { $post_id = (int) $post_id; $post = get_post( $post_id ); if ( ! $post ) { return false; } $url = wp_get_attachment_url( $post->ID ); if ( ! $url ) { return false; } $sized = image_downsize( $post_id, 'thumbnail' ); if ( $sized ) { return $sized[0]; } $thumb = wp_get_attachment_thumb_file( $post->ID ); if ( ! $thumb ) { return false; } $url = str_replace( wp_basename( $url ), wp_basename( $thumb ), $url ); return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); } function wp_attachment_is( $type, $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $file = get_attached_file( $post->ID ); if ( ! $file ) { return false; } if ( 0 === strpos( $post->post_mime_type, $type . '/' ) ) { return true; } $check = wp_check_filetype( $file ); if ( empty( $check['ext'] ) ) { return false; } $ext = $check['ext']; if ( 'import' !== $post->post_mime_type ) { return $type === $ext; } switch ( $type ) { case 'image': $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ); return in_array( $ext, $image_exts, true ); case 'audio': return in_array( $ext, wp_get_audio_extensions(), true ); case 'video': return in_array( $ext, wp_get_video_extensions(), true ); default: return $type === $ext; } } function wp_attachment_is_image( $post = null ) { return wp_attachment_is( 'image', $post ); } function wp_mime_type_icon( $mime = 0 ) { if ( ! is_numeric( $mime ) ) { $icon = wp_cache_get( "mime_type_icon_$mime" ); } $post_id = 0; if ( empty( $icon ) ) { $post_mimes = array(); if ( is_numeric( $mime ) ) { $mime = (int) $mime; $post = get_post( $mime ); if ( $post ) { $post_id = (int) $post->ID; $file = get_attached_file( $post_id ); $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $file ); if ( ! empty( $ext ) ) { $post_mimes[] = $ext; $ext_type = wp_ext2type( $ext ); if ( $ext_type ) { $post_mimes[] = $ext_type; } } $mime = $post->post_mime_type; } else { $mime = 0; } } else { $post_mimes[] = $mime; } $icon_files = wp_cache_get( 'icon_files' ); if ( ! is_array( $icon_files ) ) { $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' ); $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) ); $dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) ); $icon_files = array(); while ( $dirs ) { $keys = array_keys( $dirs ); $dir = array_shift( $keys ); $uri = array_shift( $dirs ); $dh = opendir( $dir ); if ( $dh ) { while ( false !== $file = readdir( $dh ) ) { $file = wp_basename( $file ); if ( '.' === substr( $file, 0, 1 ) ) { continue; } $ext = strtolower( substr( $file, -4 ) ); if ( ! in_array( $ext, array( '.png', '.gif', '.jpg' ), true ) ) { if ( is_dir( "$dir/$file" ) ) { $dirs[ "$dir/$file" ] = "$uri/$file"; } continue; } $icon_files[ "$dir/$file" ] = "$uri/$file"; } closedir( $dh ); } } wp_cache_add( 'icon_files', $icon_files, 'default', 600 ); } $types = array(); foreach ( $icon_files as $file => $uri ) { $types[ preg_replace( '/^([^.]*).*$/', '$1', wp_basename( $file ) ) ] =& $icon_files[ $file ]; } if ( ! empty( $mime ) ) { $post_mimes[] = substr( $mime, 0, strpos( $mime, '/' ) ); $post_mimes[] = substr( $mime, strpos( $mime, '/' ) + 1 ); $post_mimes[] = str_replace( '/', '_', $mime ); } $matches = wp_match_mime_types( array_keys( $types ), $post_mimes ); $matches['default'] = array( 'default' ); foreach ( $matches as $match => $wilds ) { foreach ( $wilds as $wild ) { if ( ! isset( $types[ $wild ] ) ) { continue; } $icon = $types[ $wild ]; if ( ! is_numeric( $mime ) ) { wp_cache_add( "mime_type_icon_$mime", $icon ); } break 2; } } } return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); } function wp_check_for_changed_slugs( $post_id, $post, $post_before ) { if ( $post->post_name == $post_before->post_name ) { return; } if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { return; } $old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' ); if ( ! empty( $post_before->post_name ) && ! in_array( $post_before->post_name, $old_slugs, true ) ) { add_post_meta( $post_id, '_wp_old_slug', $post_before->post_name ); } if ( in_array( $post->post_name, $old_slugs, true ) ) { delete_post_meta( $post_id, '_wp_old_slug', $post->post_name ); } } function wp_check_for_changed_dates( $post_id, $post, $post_before ) { $previous_date = gmdate( 'Y-m-d', strtotime( $post_before->post_date ) ); $new_date = gmdate( 'Y-m-d', strtotime( $post->post_date ) ); if ( $new_date == $previous_date ) { return; } if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { return; } $old_dates = (array) get_post_meta( $post_id, '_wp_old_date' ); if ( ! empty( $previous_date ) && ! in_array( $previous_date, $old_dates, true ) ) { add_post_meta( $post_id, '_wp_old_date', $previous_date ); } if ( in_array( $new_date, $old_dates, true ) ) { delete_post_meta( $post_id, '_wp_old_date', $new_date ); } } function get_private_posts_cap_sql( $post_type ) { return get_posts_by_author_sql( $post_type, false ); } function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) { global $wpdb; if ( is_array( $post_type ) ) { $post_types = $post_type; } else { $post_types = array( $post_type ); } $post_type_clauses = array(); foreach ( $post_types as $post_type ) { $post_type_obj = get_post_type_object( $post_type ); if ( ! $post_type_obj ) { continue; } $cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' ); if ( ! $cap ) { $cap = current_user_can( $post_type_obj->cap->read_private_posts ); } $post_status_sql = "post_status = 'publish'"; if ( false === $public_only ) { if ( $cap ) { $post_status_sql .= " OR post_status = 'private'"; } elseif ( is_user_logged_in() ) { $id = get_current_user_id(); if ( null === $post_author || ! $full ) { $post_status_sql .= " OR post_status = 'private' AND post_author = $id"; } elseif ( $id == (int) $post_author ) { $post_status_sql .= " OR post_status = 'private'"; } } } $post_type_clauses[] = "( post_type = '" . $post_type . "' AND ( $post_status_sql ) )"; } if ( empty( $post_type_clauses ) ) { return $full ? 'WHERE 1 = 0' : '1 = 0'; } $sql = '( ' . implode( ' OR ', $post_type_clauses ) . ' )'; if ( null !== $post_author ) { $sql .= $wpdb->prepare( ' AND post_author = %d', $post_author ); } if ( $full ) { $sql = 'WHERE ' . $sql; } return $sql; } function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { $lastpostdate = _get_last_post_time( $timezone, 'date', $post_type ); return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone, $post_type ); } function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { $lastpostmodified = apply_filters( 'pre_get_lastpostmodified', false, $timezone, $post_type ); if ( false !== $lastpostmodified ) { return $lastpostmodified; } $lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type ); $lastpostdate = get_lastpostdate( $timezone, $post_type ); if ( $lastpostdate > $lastpostmodified ) { $lastpostmodified = $lastpostdate; } return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone, $post_type ); } function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { global $wpdb; if ( ! in_array( $field, array( 'date', 'modified' ), true ) ) { return false; } $timezone = strtolower( $timezone ); $key = "lastpost{$field}:$timezone"; if ( 'any' !== $post_type ) { $key .= ':' . sanitize_key( $post_type ); } $date = wp_cache_get( $key, 'timeinfo' ); if ( false !== $date ) { return $date; } if ( 'any' === $post_type ) { $post_types = get_post_types( array( 'public' => true ) ); array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) ); $post_types = "'" . implode( "', '", $post_types ) . "'"; } else { $post_types = "'" . sanitize_key( $post_type ) . "'"; } switch ( $timezone ) { case 'gmt': $date = $wpdb->get_var( "SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'blog': $date = $wpdb->get_var( "SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'server': $add_seconds_server = gmdate( 'Z' ); $date = $wpdb->get_var( "SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; } if ( $date ) { wp_cache_set( $key, $date, 'timeinfo' ); return $date; } return false; } function update_post_cache( &$posts ) { if ( ! $posts ) { return; } $data = array(); foreach ( $posts as $post ) { if ( empty( $post->filter ) || 'raw' !== $post->filter ) { $post = sanitize_post( $post, 'raw' ); } $data[ $post->ID ] = $post; } wp_cache_add_multiple( $data, 'posts' ); } function clean_post_cache( $post ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $post = get_post( $post ); if ( ! $post ) { return; } wp_cache_delete( $post->ID, 'posts' ); wp_cache_delete( $post->ID, 'post_meta' ); clean_object_term_cache( $post->ID, $post->post_type ); wp_cache_delete( 'wp_get_archives', 'general' ); do_action( 'clean_post_cache', $post->ID, $post ); if ( 'page' === $post->post_type ) { wp_cache_delete( 'all_page_ids', 'posts' ); do_action( 'clean_page_cache', $post->ID ); } wp_cache_set( 'last_changed', microtime(), 'posts' ); } function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) { if ( ! $posts ) { return; } update_post_cache( $posts ); $post_ids = array(); foreach ( $posts as $post ) { $post_ids[] = $post->ID; } if ( ! $post_type ) { $post_type = 'any'; } if ( $update_term_cache ) { if ( is_array( $post_type ) ) { $ptypes = $post_type; } elseif ( 'any' === $post_type ) { $ptypes = array(); foreach ( $posts as $post ) { $ptypes[] = $post->post_type; } $ptypes = array_unique( $ptypes ); } else { $ptypes = array( $post_type ); } if ( ! empty( $ptypes ) ) { update_object_term_cache( $post_ids, $ptypes ); } } if ( $update_meta_cache ) { update_postmeta_cache( $post_ids ); } } function update_postmeta_cache( $post_ids ) { return update_meta_cache( 'post', $post_ids ); } function clean_attachment_cache( $id, $clean_terms = false ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $id = (int) $id; wp_cache_delete( $id, 'posts' ); wp_cache_delete( $id, 'post_meta' ); if ( $clean_terms ) { clean_object_term_cache( $id, 'attachment' ); } do_action( 'clean_attachment_cache', $id ); } function _transition_post_status( $new_status, $old_status, $post ) { global $wpdb; if ( 'publish' !== $old_status && 'publish' === $new_status ) { if ( '' === get_the_guid( $post->ID ) ) { $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); } do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' ); } if ( 'publish' === $new_status || 'publish' === $old_status ) { foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' ); wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' ); wp_cache_delete( "lastpostdate:$timezone:{$post->post_type}", 'timeinfo' ); } } if ( $new_status !== $old_status ) { wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' ); wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' ); } wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); } function _future_post_hook( $deprecated, $post ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT' ), 'publish_future_post', array( $post->ID ) ); } function _publish_post_hook( $post_id ) { if ( defined( 'XMLRPC_REQUEST' ) ) { do_action( 'xmlrpc_publish_post', $post_id ); } if ( defined( 'WP_IMPORTING' ) ) { return; } if ( get_option( 'default_pingback_flag' ) ) { add_post_meta( $post_id, '_pingme', '1', true ); } add_post_meta( $post_id, '_encloseme', '1', true ); $to_ping = get_to_ping( $post_id ); if ( ! empty( $to_ping ) ) { add_post_meta( $post_id, '_trackbackme', '1' ); } if ( ! wp_next_scheduled( 'do_pings' ) ) { wp_schedule_single_event( time(), 'do_pings' ); } } function wp_get_post_parent_id( $post = null ) { $post = get_post( $post ); if ( ! $post || is_wp_error( $post ) ) { return false; } return (int) $post->post_parent; } function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) { if ( ! $post_parent ) { return 0; } if ( ! $post_ID ) { return $post_parent; } if ( $post_parent == $post_ID ) { return 0; } $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ); if ( ! $loop ) { return $post_parent; } if ( isset( $loop[ $post_ID ] ) ) { return 0; } foreach ( array_keys( $loop ) as $loop_member ) { wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0, ) ); } return $post_parent; } function set_post_thumbnail( $post, $thumbnail_id ) { $post = get_post( $post ); $thumbnail_id = absint( $thumbnail_id ); if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) { if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) { return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id ); } else { return delete_post_meta( $post->ID, '_thumbnail_id' ); } } return false; } function delete_post_thumbnail( $post ) { $post = get_post( $post ); if ( $post ) { return delete_post_meta( $post->ID, '_thumbnail_id' ); } return false; } function wp_delete_auto_drafts() { global $wpdb; $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" ); foreach ( (array) $old_posts as $delete ) { wp_delete_post( $delete, true ); } } function wp_queue_posts_for_term_meta_lazyload( $posts ) { $post_type_taxonomies = array(); $term_ids = array(); foreach ( $posts as $post ) { if ( ! ( $post instanceof WP_Post ) ) { continue; } if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) { $post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type ); } foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) { $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false !== $terms ) { foreach ( $terms as $term ) { if ( ! in_array( $term->term_id, $term_ids, true ) ) { $term_ids[] = $term->term_id; } } } } } if ( $term_ids ) { $lazyloader = wp_metadata_lazyloader(); $lazyloader->queue_objects( 'term', $term_ids ); } } function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) { foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) { $tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) ); wp_update_term_count( $tt_ids, $taxonomy ); } } function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $ids, 'posts' ); if ( ! empty( $non_cached_ids ) ) { $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) ); update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache ); } } function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) { $trashed_posts_with_desired_slug = get_posts( array( 'name' => $post_name, 'post_status' => 'trash', 'post_type' => 'any', 'nopaging' => true, 'post__not_in' => array( $post_ID ), ) ); if ( ! empty( $trashed_posts_with_desired_slug ) ) { foreach ( $trashed_posts_with_desired_slug as $_post ) { wp_add_trashed_suffix_to_post_name_for_post( $_post ); } } } function wp_add_trashed_suffix_to_post_name_for_post( $post ) { global $wpdb; $post = get_post( $post ); if ( '__trashed' === substr( $post->post_name, -9 ) ) { return $post->post_name; } add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name ); $post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed'; $wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); return $post_name; } function _filter_query_attachment_filenames( $clauses ) { global $wpdb; remove_filter( 'posts_clauses', __FUNCTION__ ); $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )"; $clauses['groupby'] = "{$wpdb->posts}.ID"; $clauses['where'] = preg_replace( "/\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\'[^']+\')\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where'] ); return $clauses; } function wp_cache_set_posts_last_changed() { wp_cache_set( 'last_changed', microtime(), 'posts' ); } function get_available_post_mime_types( $type = 'attachment' ) { global $wpdb; $types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) ); return $types; } function wp_get_original_image_path( $attachment_id, $unfiltered = false ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return false; } $image_meta = wp_get_attachment_metadata( $attachment_id ); $image_file = get_attached_file( $attachment_id, $unfiltered ); if ( empty( $image_meta['original_image'] ) ) { $original_image = $image_file; } else { $original_image = path_join( dirname( $image_file ), $image_meta['original_image'] ); } return apply_filters( 'wp_get_original_image_path', $original_image, $attachment_id ); } function wp_get_original_image_url( $attachment_id ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return false; } $image_url = wp_get_attachment_url( $attachment_id ); if ( ! $image_url ) { return false; } $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $image_meta['original_image'] ) ) { $original_image_url = $image_url; } else { $original_image_url = path_join( dirname( $image_url ), $image_meta['original_image'] ); } return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id ); } function wp_untrash_post_set_previous_status( $new_status, $post_id, $previous_status ) { return $previous_status; } use = $use; $this->_mb_strlen = function_exists('mb_strlen'); $this->_mb_convert_encoding = function_exists('mb_convert_encoding'); $this->_mb_substr = function_exists('mb_substr'); } public function Services_JSON( $use = 0 ) { _deprecated_constructor( 'Services_JSON', '5.3.0', get_class( $this ) ); self::__construct( $use ); } var $_mb_strlen = false; var $_mb_substr = false; var $_mb_convert_encoding = false; function utf162utf8($utf16) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if($this->_mb_convert_encoding) { return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); } $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch(true) { case ((0x7F & $bytes) == $bytes): return chr(0x7F & $bytes); case (0x07FF & $bytes) == $bytes: return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); } return ''; } function utf82utf16($utf8) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if($this->_mb_convert_encoding) { return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); } switch($this->strlen8($utf8)) { case 1: return $utf8; case 2: return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1]))); case 3: return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2]))); } return ''; } function encode($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); header('Content-type: application/json'); return $this->encodeUnsafe($var); } function encodeUnsafe($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $lc = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, 'C'); $ret = $this->_encode($var); setlocale(LC_NUMERIC, $lc); return $ret; } function _encode($var) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); switch (gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; case 'NULL': return 'null'; case 'integer': return (int) $var; case 'double': case 'float': return (float) $var; case 'string': $ascii = ''; $strlen_var = $this->strlen8($var); for ($c = 0; $c < $strlen_var; ++$c) { $ord_var_c = ord($var[$c]); switch (true) { case $ord_var_c == 0x08: $ascii .= '\b'; break; case $ord_var_c == 0x09: $ascii .= '\t'; break; case $ord_var_c == 0x0A: $ascii .= '\n'; break; case $ord_var_c == 0x0C: $ascii .= '\f'; break; case $ord_var_c == 0x0D: $ascii .= '\r'; break; case $ord_var_c == 0x22: case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: $ascii .= '\\'.$var[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): $ascii .= $var[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): if ($c+1 >= $strlen_var) { $c += 1; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1])); $c += 1; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF0) == 0xE0): if ($c+2 >= $strlen_var) { $c += 2; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, @ord($var[$c + 1]), @ord($var[$c + 2])); $c += 2; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF8) == 0xF0): if ($c+3 >= $strlen_var) { $c += 3; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3])); $c += 3; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFC) == 0xF8): if ($c+4 >= $strlen_var) { $c += 4; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4])); $c += 4; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFE) == 0xFC): if ($c+5 >= $strlen_var) { $c += 5; $ascii .= '?'; break; } $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4]), ord($var[$c + 5])); $c += 5; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; } } return '"'.$ascii.'"'; case 'array': if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { $properties = array_map(array($this, 'name_value'), array_keys($var), array_values($var)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; } $elements = array_map(array($this, '_encode'), $var); foreach($elements as $element) { if(Services_JSON::isError($element)) { return $element; } } return '[' . join(',', $elements) . ']'; case 'object': if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) { $recode = $var->toJSON(); if (method_exists($recode, 'toJSON')) { return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new Services_JSON_Error(get_class($var). " toJSON returned an object with a toJSON method."); } return $this->_encode( $recode ); } $vars = get_object_vars($var); $properties = array_map(array($this, 'name_value'), array_keys($vars), array_values($vars)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; default: return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); } } function name_value($name, $value) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $encoded_value = $this->_encode($value); if(Services_JSON::isError($encoded_value)) { return $encoded_value; } return $this->_encode((string) $name) . ':' . $encoded_value; } function reduce_string($str) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $str = preg_replace(array( '#^\s*//(.+)$#m', '#^\s*/\*(.+)\*/#Us', '#/\*(.+)\*/\s*$#Us' ), '', $str); return trim($str); } function decode($str) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $str = $this->reduce_string($str); switch (strtolower($str)) { case 'true': return true; case 'false': return false; case 'null': return null; default: $m = array(); if (is_numeric($str)) { return ((float)$str == (integer)$str) ? (integer)$str : (float)$str; } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { $delim = $this->substr8($str, 0, 1); $chrs = $this->substr8($str, 1, -1); $utf8 = ''; $strlen_chrs = $this->strlen8($chrs); for ($c = 0; $c < $strlen_chrs; ++$c) { $substr_chrs_c_2 = $this->substr8($chrs, $c, 2); $ord_chrs_c = ord($chrs[$c]); switch (true) { case $substr_chrs_c_2 == '\b': $utf8 .= chr(0x08); ++$c; break; case $substr_chrs_c_2 == '\t': $utf8 .= chr(0x09); ++$c; break; case $substr_chrs_c_2 == '\n': $utf8 .= chr(0x0A); ++$c; break; case $substr_chrs_c_2 == '\f': $utf8 .= chr(0x0C); ++$c; break; case $substr_chrs_c_2 == '\r': $utf8 .= chr(0x0D); ++$c; break; case $substr_chrs_c_2 == '\\"': case $substr_chrs_c_2 == '\\\'': case $substr_chrs_c_2 == '\\\\': case $substr_chrs_c_2 == '\\/': if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || ($delim == "'" && $substr_chrs_c_2 != '\\"')) { $utf8 .= $chrs[++$c]; } break; case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)): $utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2))) . chr(hexdec($this->substr8($chrs, ($c + 4), 2))); $utf8 .= $this->utf162utf8($utf16); $c += 5; break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): $utf8 .= $chrs[$c]; break; case ($ord_chrs_c & 0xE0) == 0xC0: $utf8 .= $this->substr8($chrs, $c, 2); ++$c; break; case ($ord_chrs_c & 0xF0) == 0xE0: $utf8 .= $this->substr8($chrs, $c, 3); $c += 2; break; case ($ord_chrs_c & 0xF8) == 0xF0: $utf8 .= $this->substr8($chrs, $c, 4); $c += 3; break; case ($ord_chrs_c & 0xFC) == 0xF8: $utf8 .= $this->substr8($chrs, $c, 5); $c += 4; break; case ($ord_chrs_c & 0xFE) == 0xFC: $utf8 .= $this->substr8($chrs, $c, 6); $c += 5; break; } } return $utf8; } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { if ($str[0] == '[') { $stk = array(SERVICES_JSON_IN_ARR); $arr = array(); } else { if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $stk = array(SERVICES_JSON_IN_OBJ); $obj = array(); } else { $stk = array(SERVICES_JSON_IN_OBJ); $obj = new stdClass(); } } array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => 0, 'delim' => false)); $chrs = $this->substr8($str, 1, -1); $chrs = $this->reduce_string($chrs); if ($chrs == '') { if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } else { return $obj; } } $strlen_chrs = $this->strlen8($chrs); for ($c = 0; $c <= $strlen_chrs; ++$c) { $top = end($stk); $substr_chrs_c_2 = $this->substr8($chrs, $c, 2); if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { $slice = $this->substr8($chrs, $top['where'], ($c - $top['where'])); array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); if (reset($stk) == SERVICES_JSON_IN_ARR) { array_push($arr, $this->decode($slice)); } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { $parts = array(); if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) { $key = $this->decode($parts[1]); $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B")); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) { $key = $parts[1]; $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B")); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } } } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c])); } elseif (($chrs[$c] == $top['delim']) && ($top['what'] == SERVICES_JSON_IN_STR) && (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) { array_pop($stk); } elseif (($chrs[$c] == '[') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { array_pop($stk); } elseif (($chrs[$c] == '{') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { array_pop($stk); } elseif (($substr_chrs_c_2 == '/*') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); $c++; } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { array_pop($stk); $c++; for ($i = $top['where']; $i <= $c; ++$i) $chrs = substr_replace($chrs, ' ', $i, 1); } } if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { return $obj; } } } } function isError($data, $code = null) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if (class_exists('pear')) { return PEAR::isError($data, $code); } elseif (is_object($data) && ($data instanceof services_json_error || is_subclass_of($data, 'services_json_error'))) { return true; } return false; } function strlen8( $str ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if ( $this->_mb_strlen ) { return mb_strlen( $str, "8bit" ); } return strlen( $str ); } function substr8( $string, $start, $length=false ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); if ( $length === false ) { $length = $this->strlen8( $string ) - $start; } if ( $this->_mb_substr ) { return mb_substr( $string, $start, $length, "8bit" ); } return substr( $string, $start, $length ); } } if (class_exists('PEAR_Error')) { class Services_JSON_Error extends PEAR_Error { function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); parent::PEAR_Error($message, $code, $mode, $options, $userinfo); } public function Services_JSON_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { _deprecated_constructor( 'Services_JSON_Error', '5.3.0', get_class( $this ) ); self::__construct($message, $code, $mode, $options, $userinfo); } } } else { class Services_JSON_Error { function __construct( $message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null ) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); } public function Services_JSON_Error( $message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null ) { _deprecated_constructor( 'Services_JSON_Error', '5.3.0', get_class( $this ) ); self::__construct( $message, $code, $mode, $options, $userinfo ); } } } endif; ' . SIMPLEPIE_NAME . ''); define('SIMPLEPIE_LOCATOR_NONE', 0); define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1); define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2); define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4); define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8); define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16); define('SIMPLEPIE_LOCATOR_ALL', 31); define('SIMPLEPIE_TYPE_NONE', 0); define('SIMPLEPIE_TYPE_RSS_090', 1); define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2); define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4); define('SIMPLEPIE_TYPE_RSS_091', 6); define('SIMPLEPIE_TYPE_RSS_092', 8); define('SIMPLEPIE_TYPE_RSS_093', 16); define('SIMPLEPIE_TYPE_RSS_094', 32); define('SIMPLEPIE_TYPE_RSS_10', 64); define('SIMPLEPIE_TYPE_RSS_20', 128); define('SIMPLEPIE_TYPE_RSS_RDF', 65); define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190); define('SIMPLEPIE_TYPE_RSS_ALL', 255); define('SIMPLEPIE_TYPE_ATOM_03', 256); define('SIMPLEPIE_TYPE_ATOM_10', 512); define('SIMPLEPIE_TYPE_ATOM_ALL', 768); define('SIMPLEPIE_TYPE_ALL', 1023); define('SIMPLEPIE_CONSTRUCT_NONE', 0); define('SIMPLEPIE_CONSTRUCT_TEXT', 1); define('SIMPLEPIE_CONSTRUCT_HTML', 2); define('SIMPLEPIE_CONSTRUCT_XHTML', 4); define('SIMPLEPIE_CONSTRUCT_BASE64', 8); define('SIMPLEPIE_CONSTRUCT_IRI', 16); define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32); define('SIMPLEPIE_CONSTRUCT_ALL', 63); define('SIMPLEPIE_SAME_CASE', 1); define('SIMPLEPIE_LOWERCASE', 2); define('SIMPLEPIE_UPPERCASE', 4); define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'); define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace'); define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom'); define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#'); define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/'); define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/'); define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/'); define('SIMPLEPIE_NAMESPACE_RSS_20', ''); define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/'); define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/'); define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#'); define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/'); define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml'); define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/'); define('SIMPLEPIE_FILE_SOURCE_NONE', 0); define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1); define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2); define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4); define('SIMPLEPIE_FILE_SOURCE_CURL', 8); define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16); class SimplePie { public $data = array(); public $error; public $status_code; public $sanitize; public $useragent = SIMPLEPIE_USERAGENT; public $feed_url; public $permanent_url = null; public $file; public $raw_data; public $timeout = 10; public $curl_options = array(); public $force_fsockopen = false; public $force_feed = false; public $cache = true; public $force_cache_fallback = false; public $cache_duration = 3600; public $autodiscovery_cache_duration = 604800; public $cache_location = './cache'; public $cache_name_function = 'md5'; public $order_by_date = true; public $input_encoding = false; public $autodiscovery = SIMPLEPIE_LOCATOR_ALL; public $registry; public $max_checked_feeds = 10; public $all_discovered_feeds = array(); public $image_handler = ''; public $multifeed_url = array(); public $multifeed_objects = array(); public $config_settings = null; public $item_limit = 0; public $check_modified = false; public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); public $enable_exceptions = false; public function __construct() { if (version_compare(PHP_VERSION, '5.6', '<')) { trigger_error('Please upgrade to PHP 5.6 or newer.'); die(); } $this->sanitize = new SimplePie_Sanitize(); $this->registry = new SimplePie_Registry(); if (func_num_args() > 0) { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', $level); $args = func_get_args(); switch (count($args)) { case 3: $this->set_cache_duration($args[2]); case 2: $this->set_cache_location($args[1]); case 1: $this->set_feed_url($args[0]); $this->init(); } } } public function __toString() { return md5(serialize($this->data)); } public function __destruct() { if (!gc_enabled()) { if (!empty($this->data['items'])) { foreach ($this->data['items'] as $item) { $item->__destruct(); } unset($item, $this->data['items']); } if (!empty($this->data['ordered_items'])) { foreach ($this->data['ordered_items'] as $item) { $item->__destruct(); } unset($item, $this->data['ordered_items']); } } } public function force_feed($enable = false) { $this->force_feed = (bool) $enable; } public function set_feed_url($url) { $this->multifeed_url = array(); if (is_array($url)) { foreach ($url as $value) { $this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1)); } } else { $this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1)); $this->permanent_url = $this->feed_url; } } public function set_file(&$file) { if ($file instanceof SimplePie_File) { $this->feed_url = $file->url; $this->permanent_url = $this->feed_url; $this->file =& $file; return true; } return false; } public function set_raw_data($data) { $this->raw_data = $data; } public function set_timeout($timeout = 10) { $this->timeout = (int) $timeout; } public function set_curl_options(array $curl_options = array()) { $this->curl_options = $curl_options; } public function force_fsockopen($enable = false) { $this->force_fsockopen = (bool) $enable; } public function enable_cache($enable = true) { $this->cache = (bool) $enable; } public function force_cache_fallback($enable = false) { $this->force_cache_fallback= (bool) $enable; } public function set_cache_duration($seconds = 3600) { $this->cache_duration = (int) $seconds; } public function set_autodiscovery_cache_duration($seconds = 604800) { $this->autodiscovery_cache_duration = (int) $seconds; } public function set_cache_location($location = './cache') { $this->cache_location = (string) $location; } public function get_cache_filename($url) { $url .= $this->force_feed ? '#force_feed' : ''; $options = array(); if ($this->timeout != 10) { $options[CURLOPT_TIMEOUT] = $this->timeout; } if ($this->useragent !== SIMPLEPIE_USERAGENT) { $options[CURLOPT_USERAGENT] = $this->useragent; } if (!empty($this->curl_options)) { foreach ($this->curl_options as $k => $v) { $options[$k] = $v; } } if (!empty($options)) { ksort($options); $url .= '#' . urlencode(var_export($options, true)); } return call_user_func($this->cache_name_function, $url); } public function enable_order_by_date($enable = true) { $this->order_by_date = (bool) $enable; } public function set_input_encoding($encoding = false) { if ($encoding) { $this->input_encoding = (string) $encoding; } else { $this->input_encoding = false; } } public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) { $this->autodiscovery = (int) $level; } public function &get_registry() { return $this->registry; } public function set_cache_class($class = 'SimplePie_Cache') { return $this->registry->register('Cache', $class, true); } public function set_locator_class($class = 'SimplePie_Locator') { return $this->registry->register('Locator', $class, true); } public function set_parser_class($class = 'SimplePie_Parser') { return $this->registry->register('Parser', $class, true); } public function set_file_class($class = 'SimplePie_File') { return $this->registry->register('File', $class, true); } public function set_sanitize_class($class = 'SimplePie_Sanitize') { return $this->registry->register('Sanitize', $class, true); } public function set_item_class($class = 'SimplePie_Item') { return $this->registry->register('Item', $class, true); } public function set_author_class($class = 'SimplePie_Author') { return $this->registry->register('Author', $class, true); } public function set_category_class($class = 'SimplePie_Category') { return $this->registry->register('Category', $class, true); } public function set_enclosure_class($class = 'SimplePie_Enclosure') { return $this->registry->register('Enclosure', $class, true); } public function set_caption_class($class = 'SimplePie_Caption') { return $this->registry->register('Caption', $class, true); } public function set_copyright_class($class = 'SimplePie_Copyright') { return $this->registry->register('Copyright', $class, true); } public function set_credit_class($class = 'SimplePie_Credit') { return $this->registry->register('Credit', $class, true); } public function set_rating_class($class = 'SimplePie_Rating') { return $this->registry->register('Rating', $class, true); } public function set_restriction_class($class = 'SimplePie_Restriction') { return $this->registry->register('Restriction', $class, true); } public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') { return $this->registry->register('Content_Type_Sniffer', $class, true); } public function set_source_class($class = 'SimplePie_Source') { return $this->registry->register('Source', $class, true); } public function set_useragent($ua = SIMPLEPIE_USERAGENT) { $this->useragent = (string) $ua; } public function set_cache_name_function($function = 'md5') { if (is_callable($function)) { $this->cache_name_function = $function; } } public function set_stupidly_fast($set = false) { if ($set) { $this->enable_order_by_date(false); $this->remove_div(false); $this->strip_comments(false); $this->strip_htmltags(false); $this->strip_attributes(false); $this->add_attributes(false); $this->set_image_handler(false); $this->set_https_domains(array()); } } public function set_max_checked_feeds($max = 10) { $this->max_checked_feeds = (int) $max; } public function remove_div($enable = true) { $this->sanitize->remove_div($enable); } public function strip_htmltags($tags = '', $encode = null) { if ($tags === '') { $tags = $this->strip_htmltags; } $this->sanitize->strip_htmltags($tags); if ($encode !== null) { $this->sanitize->encode_instead_of_strip($tags); } } public function encode_instead_of_strip($enable = true) { $this->sanitize->encode_instead_of_strip($enable); } public function strip_attributes($attribs = '') { if ($attribs === '') { $attribs = $this->strip_attributes; } $this->sanitize->strip_attributes($attribs); } public function add_attributes($attribs = '') { if ($attribs === '') { $attribs = $this->add_attributes; } $this->sanitize->add_attributes($attribs); } public function set_output_encoding($encoding = 'UTF-8') { $this->sanitize->set_output_encoding($encoding); } public function strip_comments($strip = false) { $this->sanitize->strip_comments($strip); } public function set_url_replacements($element_attribute = null) { $this->sanitize->set_url_replacements($element_attribute); } public function set_https_domains($domains = array()) { if (is_array($domains)) { $this->sanitize->set_https_domains($domains); } } public function set_image_handler($page = false, $qs = 'i') { if ($page !== false) { $this->sanitize->set_image_handler($page . '?' . $qs . '='); } else { $this->image_handler = ''; } } public function set_item_limit($limit = 0) { $this->item_limit = (int) $limit; } public function enable_exceptions($enable = true) { $this->enable_exceptions = $enable; } public function init() { if (!extension_loaded('xml') || !extension_loaded('pcre')) { $this->error = 'XML or PCRE extensions not loaded!'; return false; } elseif (!extension_loaded('xmlreader')) { static $xml_is_sane = null; if ($xml_is_sane === null) { $parser_check = xml_parser_create(); xml_parse_into_struct($parser_check, '&', $values); xml_parser_free($parser_check); $xml_is_sane = isset($values[0]['value']); } if (!$xml_is_sane) { return false; } } if ($this->registry->get_class('Sanitize') !== 'SimplePie_Sanitize') { $this->sanitize = $this->registry->create('Sanitize'); } if (method_exists($this->sanitize, 'set_registry')) { $this->sanitize->set_registry($this->registry); } $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache')); $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); if (!empty($this->multifeed_url)) { $i = 0; $success = 0; $this->multifeed_objects = array(); $this->error = array(); foreach ($this->multifeed_url as $url) { $this->multifeed_objects[$i] = clone $this; $this->multifeed_objects[$i]->set_feed_url($url); $single_success = $this->multifeed_objects[$i]->init(); $success |= $single_success; if (!$single_success) { $this->error[$i] = $this->multifeed_objects[$i]->error(); } $i++; } return (bool) $success; } elseif ($this->feed_url === null && $this->raw_data === null) { return false; } $this->error = null; $this->data = array(); $this->check_modified = false; $this->multifeed_objects = array(); $cache = false; if ($this->feed_url !== null) { $parsed_feed_url = $this->registry->call('Misc', 'parse_url', array($this->feed_url)); if ($this->cache && $parsed_feed_url['scheme'] !== '') { $filename = $this->get_cache_filename($this->feed_url); $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $filename, 'spc')); } if (($fetched = $this->fetch_data($cache)) === true) { return true; } elseif ($fetched === false) { return false; } list($headers, $sniffed) = $fetched; } if(empty($this->raw_data)){ $this->error = "A feed could not be found at `$this->feed_url`. Empty body."; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } $encodings = array(); if ($this->input_encoding !== false) { $encodings[] = strtoupper($this->input_encoding); } $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); $text_types = array('text/xml', 'text/xml-external-parsed-entity'); if (isset($sniffed)) { if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { $encodings[] = strtoupper($charset[1]); } $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); $encodings[] = 'UTF-8'; } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { $encodings[] = strtoupper($charset[1]); } $encodings[] = 'US-ASCII'; } elseif (substr($sniffed, 0, 5) === 'text/') { $encodings[] = 'UTF-8'; } } $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); $encodings[] = 'UTF-8'; $encodings[] = 'ISO-8859-1'; $encodings = array_unique($encodings); foreach ($encodings as $encoding) { if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) { $parser = $this->registry->create('Parser'); if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url)) { $this->data = $parser->get_data(); if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE)) { $this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed."; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } if (isset($headers)) { $this->data['headers'] = $headers; } $this->data['build'] = SIMPLEPIE_BUILD; if ($cache && !$cache->save($this)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } return true; } } } if (isset($parser)) { $this->error = $this->feed_url; $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); } else { $this->error = 'The data could not be converted to UTF-8.'; if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) { $this->error .= ' You MUST have either the iconv, mbstring or intl (PHP 5.5+) extension installed and enabled.'; } else { $missingExtensions = array(); if (!extension_loaded('iconv')) { $missingExtensions[] = 'iconv'; } if (!extension_loaded('mbstring')) { $missingExtensions[] = 'mbstring'; } if (!class_exists('\UConverter')) { $missingExtensions[] = 'intl (PHP 5.5+)'; } $this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.'; } } $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } protected function fetch_data(&$cache) { if ($cache) { $this->data = $cache->load(); if (!empty($this->data)) { if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) { $cache->unlink(); $this->data = array(); } elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) { $cache = false; $this->data = array(); } elseif (isset($this->data['feed_url'])) { if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) { if ($this->data['feed_url'] !== $this->data['url']) { $this->set_feed_url($this->data['feed_url']); return $this->init(); } $cache->unlink(); $this->data = array(); } } elseif ($cache->mtime() + $this->cache_duration < time()) { $this->check_modified = true; if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) { $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); if (isset($this->data['headers']['last-modified'])) { $headers['if-modified-since'] = $this->data['headers']['last-modified']; } if (isset($this->data['headers']['etag'])) { $headers['if-none-match'] = $this->data['headers']['etag']; } $file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); $this->status_code = $file->status_code; if ($file->success) { if ($file->status_code === 304) { $this->raw_data = false; $cache->touch(); return true; } } else { $this->check_modified = false; if($this->force_cache_fallback) { $cache->touch(); return true; } unset($file); } } } else { $this->raw_data = false; return true; } } else { $cache->unlink(); $this->data = array(); } } if (!isset($file)) { if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url) { $file =& $this->file; } else { $headers = array( 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ); $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); } } $this->status_code = $file->status_code; if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { $this->error = $file->error; return !empty($this->data); } if (!$this->force_feed) { $locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options)); if (!$locate->is_feed($file)) { $copyStatusCode = $file->status_code; $copyContentType = $file->headers['content-type']; try { $microformats = false; if (class_exists('DOMXpath') && function_exists('Mf2\parse')) { $doc = new DOMDocument(); @$doc->loadHTML($file->body); $xpath = new DOMXpath($doc); $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '. 'contains(concat(" ", @class, " "), " h-entry ")]'; $result = $xpath->query($query); $microformats = $result->length !== 0; } $discovered = $locate->find($this->autodiscovery, $this->all_discovered_feeds); if ($microformats) { if ($hub = $locate->get_rel_link('hub')) { $self = $locate->get_rel_link('self'); $this->store_links($file, $hub, $self); } if (isset($this->all_discovered_feeds)) { $this->all_discovered_feeds[] = $file; } } else { if ($discovered) { $file = $discovered; } else { unset($file); $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); return false; } } } catch (SimplePie_Exception $e) { unset($file); $this->error = $e->getMessage(); $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine())); return false; } if ($cache) { $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); if (!$cache->save($this)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); } } $this->feed_url = $file->url; $locate = null; } $this->raw_data = $file->body; $this->permanent_url = $file->permanent_url; $headers = $file->headers; $sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file)); $sniffed = $sniffer->get_type(); return array($headers, $sniffed); } public function error() { return $this->error; } public function status_code() { return $this->status_code; } public function get_raw_data() { return $this->raw_data; } public function get_encoding() { return $this->sanitize->output_encoding; } public function handle_content_type($mime = 'text/html') { if (!headers_sent()) { $header = "Content-type: $mime;"; if ($this->get_encoding()) { $header .= ' charset=' . $this->get_encoding(); } else { $header .= ' charset=UTF-8'; } header($header); } } public function get_type() { if (!isset($this->data['type'])) { $this->data['type'] = SIMPLEPIE_TYPE_ALL; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) { $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) { $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10; } if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; } } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) { $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { case '0.91': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { case '0': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; break; case '24': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND; break; } } break; case '0.92': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092; break; case '0.93': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093; break; case '0.94': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094; break; case '2.0': $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20; break; } } } else { $this->data['type'] = SIMPLEPIE_TYPE_NONE; } } return $this->data['type']; } public function subscribe_url($permanent = false) { if ($permanent) { if ($this->permanent_url !== null) { return str_replace('&', '&', $this->sanitize($this->permanent_url, SIMPLEPIE_CONSTRUCT_IRI)); } } else { if ($this->feed_url !== null) { return str_replace('&', '&', $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI)); } } return null; } public function get_feed_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_10) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_ATOM_03) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_RSS_RDF) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) { return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; } } return null; } public function get_channel_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_ALL) { if ($return = $this->get_feed_tags($namespace, $tag)) { return $return; } } if ($type & SIMPLEPIE_TYPE_RSS_10) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_090) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) { if (isset($channel[0]['child'][$namespace][$tag])) { return $channel[0]['child'][$namespace][$tag]; } } } return null; } public function get_image_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_RSS_10) { if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_090) { if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) { if (isset($image[0]['child'][$namespace][$tag])) { return $image[0]['child'][$namespace][$tag]; } } } return null; } public function get_base($element = array()) { if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) { return $element['xml_base']; } elseif ($this->get_link() !== null) { return $this->get_link(); } return $this->subscribe_url(); } public function sanitize($data, $type, $base = '') { try { return $this->sanitize->sanitize($data, $type, $base); } catch (SimplePie_Exception $e) { if (!$this->enable_exceptions) { $this->error = $e->getMessage(); $this->registry->call('Misc', 'error', array($this->error, E_USER_WARNING, $e->getFile(), $e->getLine())); return ''; } throw $e; } } public function get_title() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) { return $categories[$key]; } return null; } public function get_categories() { $categories = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { $term = null; $scheme = null; $label = null; if (isset($category['attribs']['']['term'])) { $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['scheme'])) { $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); if (isset($category['attribs']['']['domain'])) { $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); } else { $scheme = null; } $categories[] = $this->registry->create('Category', array($term, $scheme, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($categories)) { return array_unique($categories); } return null; } public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) { return $authors[$key]; } return null; } public function get_authors() { $authors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { $name = null; $uri = null; $email = null; if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $authors[] = $this->registry->create('Author', array($name, $uri, $email)); } } if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { $name = null; $url = null; $email = null; if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $authors[] = $this->registry->create('Author', array($name, $url, $email)); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($authors)) { return array_unique($authors); } return null; } public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) { return $contributors[$key]; } return null; } public function get_contributors() { $contributors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { $name = null; $uri = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { $name = null; $url = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $contributors[] = $this->registry->create('Author', array($name, $url, $email)); } } if (!empty($contributors)) { return array_unique($contributors); } return null; } public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if (isset($links[$key])) { return $links[$key]; } return null; } public function get_permalink() { return $this->get_link(0); } public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { $this->data['links'] = array(); if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } $keys = array_keys($this->data['links']); foreach ($keys as $key) { if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) { if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; } else { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; } } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; } $this->data['links'][$key] = array_unique($this->data['links'][$key]); } } if (isset($this->data['headers']['link'])) { $link_headers = $this->data['headers']['link']; if (is_string($link_headers)) { $link_headers = array($link_headers); } $matches = preg_filter('/<([^>]+)>; rel='.preg_quote($rel).'/', '$1', $link_headers); if (!empty($matches)) { return $matches; } } if (isset($this->data['links'][$rel])) { return $this->data['links'][$rel]; } return null; } public function get_all_discovered_feeds() { return $this->all_discovered_feeds; } public function get_description() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } return null; } public function get_copyright() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_language() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) { return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['headers']['content-language'])) { return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_latitude() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } return null; } public function get_longitude() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { return (float) $return[0]['data']; } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { return (float) $return[0]['data']; } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } return null; } public function get_image_title() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_image_url() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } return null; } public function get_image_link() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } return null; } public function get_image_width() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) { return round($return[0]['data']); } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return 88.0; } return null; } public function get_image_height() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) { return round($return[0]['data']); } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { return 31.0; } return null; } public function get_item_quantity($max = 0) { $max = (int) $max; $qty = count($this->get_items()); if ($max === 0) { return $qty; } return ($qty > $max) ? $max : $qty; } public function get_item($key = 0) { $items = $this->get_items(); if (isset($items[$key])) { return $items[$key]; } return null; } public function get_items($start = 0, $end = 0) { if (!isset($this->data['items'])) { if (!empty($this->multifeed_objects)) { $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); if (empty($this->data['items'])) { return array(); } return $this->data['items']; } $this->data['items'] = array(); if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); } } } if (empty($this->data['items'])) { return array(); } if ($this->order_by_date) { if (!isset($this->data['ordered_items'])) { $this->data['ordered_items'] = $this->data['items']; usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); } $items = $this->data['ordered_items']; } else { $items = $this->data['items']; } if ($end === 0) { return array_slice($items, $start); } return array_slice($items, $start, $end); } public function set_favicon_handler($page = false, $qs = 'i') { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Favicon handling has been removed, please use your own handling', $level); return false; } public function get_favicon() { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('Favicon handling has been removed, please use your own handling', $level); if (($url = $this->get_link()) !== null) { return 'https://www.google.com/s2/favicons?domain=' . urlencode($url); } return false; } public function __call($method, $args) { if (strpos($method, 'subscribe_') === 0) { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level); return ''; } if ($method === 'enable_xml_dump') { $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level); return false; } $class = get_class($this); $trace = debug_backtrace(); $file = $trace[0]['file']; $line = $trace[0]['line']; trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR); } public static function sort_items($a, $b) { $a_date = $a->get_date('U'); $b_date = $b->get_date('U'); if ($a_date && $b_date) { return $a_date > $b_date ? -1 : 1; } if ($a_date) { return 1; } if ($b_date) { return -1; } return 0; } public static function merge_items($urls, $start = 0, $end = 0, $limit = 0) { if (is_array($urls) && sizeof($urls) > 0) { $items = array(); foreach ($urls as $arg) { if ($arg instanceof SimplePie) { $items = array_merge($items, $arg->get_items(0, $limit)); } else { trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); } } usort($items, array(get_class($urls[0]), 'sort_items')); if ($end === 0) { return array_slice($items, $start); } return array_slice($items, $start, $end); } trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); return array(); } private function store_links(&$file, $hub, $self) { if (isset($file->headers['link']['hub']) || (isset($file->headers['link']) && preg_match('/rel=hub/', $file->headers['link']))) { return; } if ($hub) { if (isset($file->headers['link'])) { if ($file->headers['link'] !== '') { $file->headers['link'] = ', '; } } else { $file->headers['link'] = ''; } $file->headers['link'] .= '<'.$hub.'>; rel=hub'; if ($self) { $file->headers['link'] .= ', <'.$self.'>; rel=self'; } } } } endif; '', 'from' => '', 'where' => array(), 'orderby' => '', 'limits' => '', ); public $query_vars; public $query_var_defaults; public $terms; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'taxonomy' => null, 'object_ids' => null, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'include' => array(), 'exclude' => array(), 'exclude_tree' => array(), 'number' => '', 'offset' => '', 'fields' => 'all', 'count' => false, 'name' => '', 'slug' => '', 'term_taxonomy_id' => '', 'hierarchical' => true, 'search' => '', 'name__like' => '', 'description__like' => '', 'pad_counts' => false, 'get' => '', 'child_of' => 0, 'parent' => '', 'childless' => false, 'cache_domain' => 'core', 'update_term_meta_cache' => true, 'meta_query' => '', 'meta_key' => '', 'meta_value' => '', 'meta_type' => '', 'meta_compare' => '', ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $taxonomies = isset( $query['taxonomy'] ) ? (array) $query['taxonomy'] : null; $this->query_var_defaults = apply_filters( 'get_terms_defaults', $this->query_var_defaults, $taxonomies ); $query = wp_parse_args( $query, $this->query_var_defaults ); $query['number'] = absint( $query['number'] ); $query['offset'] = absint( $query['offset'] ); if ( 0 < (int) $query['parent'] ) { $query['child_of'] = false; } if ( 'all' === $query['get'] ) { $query['childless'] = false; $query['child_of'] = 0; $query['hide_empty'] = 0; $query['hierarchical'] = false; $query['pad_counts'] = false; } $query['taxonomy'] = $taxonomies; $this->query_vars = $query; do_action( 'parse_term_query', $this ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_terms(); } public function get_terms() { global $wpdb; $this->parse_query( $this->query_vars ); $args = &$this->query_vars; $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $args ); do_action_ref_array( 'pre_get_terms', array( &$this ) ); $taxonomies = (array) $args['taxonomy']; $has_hierarchical_tax = false; if ( $taxonomies ) { foreach ( $taxonomies as $_tax ) { if ( is_taxonomy_hierarchical( $_tax ) ) { $has_hierarchical_tax = true; } } } else { $has_hierarchical_tax = true; } if ( ! $has_hierarchical_tax ) { $args['hierarchical'] = false; $args['pad_counts'] = false; } if ( 0 < (int) $args['parent'] ) { $args['child_of'] = false; } if ( 'all' === $args['get'] ) { $args['childless'] = false; $args['child_of'] = 0; $args['hide_empty'] = 0; $args['hierarchical'] = false; $args['pad_counts'] = false; } $args = apply_filters( 'get_terms_args', $args, $taxonomies ); $child_of = $args['child_of']; $parent = $args['parent']; if ( $child_of ) { $_parent = $child_of; } elseif ( $parent ) { $_parent = $parent; } else { $_parent = false; } if ( $_parent ) { $in_hierarchy = false; foreach ( $taxonomies as $_tax ) { $hierarchy = _get_term_hierarchy( $_tax ); if ( isset( $hierarchy[ $_parent ] ) ) { $in_hierarchy = true; } } if ( ! $in_hierarchy ) { if ( 'count' === $args['fields'] ) { return 0; } else { $this->terms = array(); return $this->terms; } } } $_orderby = $this->query_vars['orderby']; if ( 'term_order' === $_orderby && empty( $this->query_vars['object_ids'] ) ) { $_orderby = 'term_id'; } $orderby = $this->parse_orderby( $_orderby ); if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $order = $this->parse_order( $this->query_vars['order'] ); if ( $taxonomies ) { $this->sql_clauses['where']['taxonomy'] = "tt.taxonomy IN ('" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "')"; } if ( empty( $args['exclude'] ) ) { $args['exclude'] = array(); } if ( empty( $args['include'] ) ) { $args['include'] = array(); } $exclude = $args['exclude']; $exclude_tree = $args['exclude_tree']; $include = $args['include']; $inclusions = ''; if ( ! empty( $include ) ) { $exclude = ''; $exclude_tree = ''; $inclusions = implode( ',', wp_parse_id_list( $include ) ); } if ( ! empty( $inclusions ) ) { $this->sql_clauses['where']['inclusions'] = 't.term_id IN ( ' . $inclusions . ' )'; } $exclusions = array(); if ( ! empty( $exclude_tree ) ) { $exclude_tree = wp_parse_id_list( $exclude_tree ); $excluded_children = $exclude_tree; foreach ( $exclude_tree as $extrunk ) { $excluded_children = array_merge( $excluded_children, (array) get_terms( array( 'taxonomy' => reset( $taxonomies ), 'child_of' => (int) $extrunk, 'fields' => 'ids', 'hide_empty' => 0, ) ) ); } $exclusions = array_merge( $excluded_children, $exclusions ); } if ( ! empty( $exclude ) ) { $exclusions = array_merge( wp_parse_id_list( $exclude ), $exclusions ); } $childless = (bool) $args['childless']; if ( $childless ) { foreach ( $taxonomies as $_tax ) { $term_hierarchy = _get_term_hierarchy( $_tax ); $exclusions = array_merge( array_keys( $term_hierarchy ), $exclusions ); } } if ( ! empty( $exclusions ) ) { $exclusions = 't.term_id NOT IN (' . implode( ',', array_map( 'intval', $exclusions ) ) . ')'; } else { $exclusions = ''; } $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies ); if ( ! empty( $exclusions ) ) { $this->sql_clauses['where']['exclusions'] = preg_replace( '/^\s*AND\s*/', '', $exclusions ); } if ( '' === $args['name'] ) { $args['name'] = array(); } else { $args['name'] = (array) $args['name']; } if ( ! empty( $args['name'] ) ) { $names = $args['name']; foreach ( $names as &$_name ) { $_name = stripslashes( sanitize_term_field( 'name', $_name, 0, reset( $taxonomies ), 'db' ) ); } $this->sql_clauses['where']['name'] = "t.name IN ('" . implode( "', '", array_map( 'esc_sql', $names ) ) . "')"; } if ( '' === $args['slug'] ) { $args['slug'] = array(); } else { $args['slug'] = array_map( 'sanitize_title', (array) $args['slug'] ); } if ( ! empty( $args['slug'] ) ) { $slug = implode( "', '", $args['slug'] ); $this->sql_clauses['where']['slug'] = "t.slug IN ('" . $slug . "')"; } if ( '' === $args['term_taxonomy_id'] ) { $args['term_taxonomy_id'] = array(); } else { $args['term_taxonomy_id'] = array_map( 'intval', (array) $args['term_taxonomy_id'] ); } if ( ! empty( $args['term_taxonomy_id'] ) ) { $tt_ids = implode( ',', $args['term_taxonomy_id'] ); $this->sql_clauses['where']['term_taxonomy_id'] = "tt.term_taxonomy_id IN ({$tt_ids})"; } if ( ! empty( $args['name__like'] ) ) { $this->sql_clauses['where']['name__like'] = $wpdb->prepare( 't.name LIKE %s', '%' . $wpdb->esc_like( $args['name__like'] ) . '%' ); } if ( ! empty( $args['description__like'] ) ) { $this->sql_clauses['where']['description__like'] = $wpdb->prepare( 'tt.description LIKE %s', '%' . $wpdb->esc_like( $args['description__like'] ) . '%' ); } if ( '' === $args['object_ids'] ) { $args['object_ids'] = array(); } else { $args['object_ids'] = array_map( 'intval', (array) $args['object_ids'] ); } if ( ! empty( $args['object_ids'] ) ) { $object_ids = implode( ', ', $args['object_ids'] ); $this->sql_clauses['where']['object_ids'] = "tr.object_id IN ($object_ids)"; } if ( ! empty( $args['object_ids'] ) ) { $args['hide_empty'] = false; } if ( '' !== $parent ) { $parent = (int) $parent; $this->sql_clauses['where']['parent'] = "tt.parent = '$parent'"; } $hierarchical = $args['hierarchical']; if ( 'count' === $args['fields'] ) { $hierarchical = false; } if ( $args['hide_empty'] && ! $hierarchical ) { $this->sql_clauses['where']['count'] = 'tt.count > 0'; } $number = $args['number']; $offset = $args['offset']; if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } else { $limits = ''; } if ( ! empty( $args['search'] ) ) { $this->sql_clauses['where']['search'] = $this->get_search_sql( $args['search'] ); } $join = ''; $distinct = ''; $this->meta_query->parse_query_vars( $this->query_vars ); $mq_sql = $this->meta_query->get_sql( 'term', 't', 'term_id' ); $meta_clauses = $this->meta_query->get_clauses(); if ( ! empty( $meta_clauses ) ) { $join .= $mq_sql['join']; $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $mq_sql['where'] ); $distinct .= 'DISTINCT'; } $selects = array(); switch ( $args['fields'] ) { case 'count': $orderby = ''; $order = ''; $selects = array( 'COUNT(*)' ); break; default: $selects = array( 't.term_id' ); if ( 'all_with_object_id' === $args['fields'] && ! empty( $args['object_ids'] ) ) { $selects[] = 'tr.object_id'; } break; } $_fields = $args['fields']; $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) ); $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; if ( ! empty( $this->query_vars['object_ids'] ) ) { $join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $distinct = 'DISTINCT'; } $where = implode( ' AND ', $this->sql_clauses['where'] ); $clauses = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); $clauses = apply_filters( 'terms_clauses', compact( $clauses ), $taxonomies, $args ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $order = isset( $clauses['order'] ) ? $clauses['order'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; if ( $where ) { $where = "WHERE $where"; } $this->sql_clauses['select'] = "SELECT $distinct $fields"; $this->sql_clauses['from'] = "FROM $wpdb->terms AS t $join"; $this->sql_clauses['orderby'] = $orderby ? "$orderby $order" : ''; $this->sql_clauses['limits'] = $limits; $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; $this->terms = null; $this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) ); if ( null !== $this->terms ) { return $this->terms; } $cache_args = wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ); unset( $cache_args['update_term_meta_cache'] ); if ( 'count' !== $_fields && 'all_with_object_id' !== $_fields ) { $cache_args['fields'] = 'all'; } $key = md5( serialize( $cache_args ) . serialize( $taxonomies ) . $this->request ); $last_changed = wp_cache_get_last_changed( 'terms' ); $cache_key = "get_terms:$key:$last_changed"; $cache = wp_cache_get( $cache_key, 'terms' ); if ( false !== $cache ) { if ( 'ids' === $_fields ) { $cache = array_map( 'intval', $cache ); } elseif ( 'count' !== $_fields ) { if ( ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) || ( 'all' === $_fields && $args['pad_counts'] ) ) { $term_ids = wp_list_pluck( $cache, 'term_id' ); } else { $term_ids = array_map( 'intval', $cache ); } _prime_term_caches( $term_ids, $args['update_term_meta_cache'] ); $term_objects = $this->populate_terms( $cache ); $cache = $this->format_terms( $term_objects, $_fields ); } $this->terms = $cache; return $this->terms; } if ( 'count' === $_fields ) { $count = $wpdb->get_var( $this->request ); wp_cache_set( $cache_key, $count, 'terms' ); return $count; } $terms = $wpdb->get_results( $this->request ); if ( empty( $terms ) ) { wp_cache_add( $cache_key, array(), 'terms' ); return array(); } $term_ids = wp_list_pluck( $terms, 'term_id' ); _prime_term_caches( $term_ids, false ); $term_objects = $this->populate_terms( $terms ); if ( $child_of ) { foreach ( $taxonomies as $_tax ) { $children = _get_term_hierarchy( $_tax ); if ( ! empty( $children ) ) { $term_objects = _get_term_children( $child_of, $term_objects, $_tax ); } } } if ( $args['pad_counts'] && 'all' === $_fields ) { foreach ( $taxonomies as $_tax ) { _pad_term_counts( $term_objects, $_tax ); } } if ( $hierarchical && $args['hide_empty'] && is_array( $term_objects ) ) { foreach ( $term_objects as $k => $term ) { if ( ! $term->count ) { $children = get_term_children( $term->term_id, $term->taxonomy ); if ( is_array( $children ) ) { foreach ( $children as $child_id ) { $child = get_term( $child_id, $term->taxonomy ); if ( $child->count ) { continue 2; } } } unset( $term_objects[ $k ] ); } } } if ( $hierarchical && $number && is_array( $term_objects ) ) { if ( $offset >= count( $term_objects ) ) { $term_objects = array(); } else { $term_objects = array_slice( $term_objects, $offset, $number, true ); } } if ( $args['update_term_meta_cache'] ) { $term_ids = wp_list_pluck( $term_objects, 'term_id' ); update_termmeta_cache( $term_ids ); } if ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) { $term_cache = array(); foreach ( $term_objects as $term ) { $object = new stdClass(); $object->term_id = $term->term_id; $object->object_id = $term->object_id; $term_cache[] = $object; } } elseif ( 'all' === $_fields && $args['pad_counts'] ) { $term_cache = array(); foreach ( $term_objects as $term ) { $object = new stdClass(); $object->term_id = $term->term_id; $object->count = $term->count; $term_cache[] = $object; } } else { $term_cache = wp_list_pluck( $term_objects, 'term_id' ); } wp_cache_add( $cache_key, $term_cache, 'terms' ); $this->terms = $this->format_terms( $term_objects, $_fields ); return $this->terms; } protected function parse_orderby( $orderby_raw ) { $_orderby = strtolower( $orderby_raw ); $maybe_orderby_meta = false; if ( in_array( $_orderby, array( 'term_id', 'name', 'slug', 'term_group' ), true ) ) { $orderby = "t.$_orderby"; } elseif ( in_array( $_orderby, array( 'count', 'parent', 'taxonomy', 'term_taxonomy_id', 'description' ), true ) ) { $orderby = "tt.$_orderby"; } elseif ( 'term_order' === $_orderby ) { $orderby = 'tr.term_order'; } elseif ( 'include' === $_orderby && ! empty( $this->query_vars['include'] ) ) { $include = implode( ',', wp_parse_id_list( $this->query_vars['include'] ) ); $orderby = "FIELD( t.term_id, $include )"; } elseif ( 'slug__in' === $_orderby && ! empty( $this->query_vars['slug'] ) && is_array( $this->query_vars['slug'] ) ) { $slugs = implode( "', '", array_map( 'sanitize_title_for_query', $this->query_vars['slug'] ) ); $orderby = "FIELD( t.slug, '" . $slugs . "')"; } elseif ( 'none' === $_orderby ) { $orderby = ''; } elseif ( empty( $_orderby ) || 'id' === $_orderby || 'term_id' === $_orderby ) { $orderby = 't.term_id'; } else { $orderby = 't.name'; $maybe_orderby_meta = true; } $orderby = apply_filters( 'get_terms_orderby', $orderby, $this->query_vars, $this->query_vars['taxonomy'] ); if ( $maybe_orderby_meta ) { $maybe_orderby_meta = $this->parse_orderby_meta( $_orderby ); if ( $maybe_orderby_meta ) { $orderby = $maybe_orderby_meta; } } return $orderby; } protected function format_terms( $term_objects, $_fields ) { $_terms = array(); if ( 'id=>parent' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->parent; } } elseif ( 'ids' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = (int) $term->term_id; } } elseif ( 'tt_ids' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = (int) $term->term_taxonomy_id; } } elseif ( 'names' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = $term->name; } } elseif ( 'slugs' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[] = $term->slug; } } elseif ( 'id=>name' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->name; } } elseif ( 'id=>slug' === $_fields ) { foreach ( $term_objects as $term ) { $_terms[ $term->term_id ] = $term->slug; } } elseif ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { $_terms = $term_objects; } return $_terms; } protected function parse_orderby_meta( $orderby_raw ) { $orderby = ''; $this->meta_query->get_sql( 'term', 't', 'term_id' ); $meta_clauses = $this->meta_query->get_clauses(); if ( ! $meta_clauses || ! $orderby_raw ) { return $orderby; } $allowed_keys = array(); $primary_meta_key = null; $primary_meta_query = reset( $meta_clauses ); if ( ! empty( $primary_meta_query['key'] ) ) { $primary_meta_key = $primary_meta_query['key']; $allowed_keys[] = $primary_meta_key; } $allowed_keys[] = 'meta_value'; $allowed_keys[] = 'meta_value_num'; $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_clauses ) ); if ( ! in_array( $orderby_raw, $allowed_keys, true ) ) { return $orderby; } switch ( $orderby_raw ) { case $primary_meta_key: case 'meta_value': if ( ! empty( $primary_meta_query['type'] ) ) { $orderby = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})"; } else { $orderby = "{$primary_meta_query['alias']}.meta_value"; } break; case 'meta_value_num': $orderby = "{$primary_meta_query['alias']}.meta_value+0"; break; default: if ( array_key_exists( $orderby_raw, $meta_clauses ) ) { $meta_clause = $meta_clauses[ $orderby_raw ]; $orderby = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})"; } break; } return $orderby; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } protected function get_search_sql( $search ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; return $wpdb->prepare( '((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like ); } protected function populate_terms( $terms ) { $term_objects = array(); if ( ! is_array( $terms ) ) { return $term_objects; } foreach ( $terms as $key => $term_data ) { if ( is_object( $term_data ) && property_exists( $term_data, 'term_id' ) ) { $term = get_term( $term_data->term_id ); if ( property_exists( $term_data, 'object_id' ) ) { $term->object_id = (int) $term_data->object_id; } if ( property_exists( $term_data, 'count' ) ) { $term->count = (int) $term_data->count; } } else { $term = get_term( $term_data ); } if ( $term instanceof WP_Term ) { $term_objects[ $key ] = $term; } } return $term_objects; } } original_locale = determine_locale(); $this->available_languages = array_merge( array( 'en_US' ), get_available_languages() ); } public function init() { add_filter( 'locale', array( $this, 'filter_locale' ) ); } public function switch_to_locale( $locale ) { $current_locale = determine_locale(); if ( $current_locale === $locale ) { return false; } if ( ! in_array( $locale, $this->available_languages, true ) ) { return false; } $this->locales[] = $locale; $this->change_locale( $locale ); do_action( 'switch_locale', $locale ); return true; } public function restore_previous_locale() { $previous_locale = array_pop( $this->locales ); if ( null === $previous_locale ) { return false; } $locale = end( $this->locales ); if ( ! $locale ) { $locale = $this->original_locale; } $this->change_locale( $locale ); do_action( 'restore_previous_locale', $locale, $previous_locale ); return $locale; } public function restore_current_locale() { if ( empty( $this->locales ) ) { return false; } $this->locales = array( $this->original_locale ); return $this->restore_previous_locale(); } public function is_switched() { return ! empty( $this->locales ); } public function filter_locale( $locale ) { $switched_locale = end( $this->locales ); if ( $switched_locale ) { return $switched_locale; } return $locale; } private function load_translations( $locale ) { global $l10n; $domains = $l10n ? array_keys( $l10n ) : array(); load_default_textdomain( $locale ); foreach ( $domains as $domain ) { if ( 'default' === $domain ) { continue; } unload_textdomain( $domain ); get_translations_for_domain( $domain ); } } private function change_locale( $locale ) { _get_path_to_translation( null, true ); $this->load_translations( $locale ); $GLOBALS['wp_locale'] = new WP_Locale(); do_action( 'change_locale', $locale ); } } 'comment_parent', 'id' => 'comment_ID', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { case 'div': break; case 'ol': $output .= '
                  ' . "\n"; break; case 'ul': default: $output .= '
                    ' . "\n"; break; } } public function end_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { case 'div': break; case 'ol': $output .= "
                \n"; break; case 'ul': default: $output .= "\n"; break; } } public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( ! $element ) { return; } $id_field = $this->db_fields['id']; $id = $element->$id_field; parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); if ( $max_depth <= $depth + 1 && isset( $children_elements[ $id ] ) ) { foreach ( $children_elements[ $id ] as $child ) { $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); } unset( $children_elements[ $id ] ); } } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $comment = $data_object; $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; if ( ! empty( $args['callback'] ) ) { ob_start(); call_user_func( $args['callback'], $comment, $args, $depth ); $output .= ob_get_clean(); return; } if ( 'comment' === $comment->comment_type ) { add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 ); } if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) { ob_start(); $this->ping( $comment, $depth, $args ); $output .= ob_get_clean(); } elseif ( 'html5' === $args['format'] ) { ob_start(); $this->html5_comment( $comment, $depth, $args ); $output .= ob_get_clean(); } else { ob_start(); $this->comment( $comment, $depth, $args ); $output .= ob_get_clean(); } if ( 'comment' === $comment->comment_type ) { remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 ); } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( ! empty( $args['end-callback'] ) ) { ob_start(); call_user_func( $args['end-callback'], $data_object, $args, $depth ); $output .= ob_get_clean(); return; } if ( 'div' === $args['style'] ) { $output .= "
                \n"; } else { $output .= "\n"; } } protected function ping( $comment, $depth, $args ) { $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; ?> - < id="comment-" > -
                - ', '' ); ?> -
                - comment_approved && ! $show_pending_links ) { $comment_text = wp_kses( $comment_text, array() ); } return $comment_text; } protected function comment( $comment, $depth, $args ) { if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } $commenter = wp_get_current_commenter(); $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; if ( $commenter['comment_author_email'] ) { $moderation_note = __( 'Your comment is awaiting moderation.' ); } else { $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' ); } ?> - < has_children ? 'parent' : '', $comment ); ?> id="comment-"> - -
                - -
                - - comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } printf( __( '%s says:' ), sprintf( '%s', $comment_author ) ); ?> -
                - comment_approved ) : ?> - -
                - - - - - $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'], ) ) ); ?> - - $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
                ', 'after' => '
                ', ) ) ); ?> - - -
                - - - < id="comment-" has_children ? 'parent' : '', $comment ); ?>> -
                -
                -
                - - comment_approved && ! $show_pending_links ) { $comment_author = get_comment_author( $comment ); } printf( __( '%s says:' ), sprintf( '%s', $comment_author ) ); ?> -
                - - - - comment_approved ) : ?> - - -
                - -
                - -
                - - comment_approved || $show_pending_links ) { comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
                ', 'after' => '
                ', ) ) ); } ?> -
                - rest_api_init' ), '5.1.0' ); } if ( isset( $args['args'] ) ) { $common_args = $args['args']; unset( $args['args'] ); } else { $common_args = array(); } if ( isset( $args['callback'] ) ) { $args = array( $args ); } $defaults = array( 'methods' => 'GET', 'callback' => null, 'args' => array(), ); foreach ( $args as $key => &$arg_group ) { if ( ! is_numeric( $key ) ) { continue; } $arg_group = array_merge( $defaults, $arg_group ); $arg_group['args'] = array_merge( $common_args, $arg_group['args'] ); if ( ! isset( $arg_group['permission_callback'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The REST API route definition for %1$s is missing the required %2$s argument. For REST API routes that are intended to be public, use %3$s as the permission callback.' ), '' . $clean_namespace . '/' . trim( $route, '/' ) . '', 'permission_callback', '__return_true' ), '5.5.0' ); } } $full_route = '/' . $clean_namespace . '/' . trim( $route, '/' ); rest_get_server()->register_route( $clean_namespace, $full_route, $args, $override ); return true; } function register_rest_field( $object_type, $attribute, $args = array() ) { global $wp_rest_additional_fields; $defaults = array( 'get_callback' => null, 'update_callback' => null, 'schema' => null, ); $args = wp_parse_args( $args, $defaults ); $object_types = (array) $object_type; foreach ( $object_types as $object_type ) { $wp_rest_additional_fields[ $object_type ][ $attribute ] = $args; } } function rest_api_init() { rest_api_register_rewrites(); global $wp; $wp->add_query_var( 'rest_route' ); } function rest_api_register_rewrites() { global $wp_rewrite; add_rewrite_rule( '^' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); } function rest_api_default_filters() { if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 ); add_filter( 'deprecated_function_trigger_error', '__return_false' ); add_action( 'deprecated_argument_run', 'rest_handle_deprecated_argument', 10, 3 ); add_filter( 'deprecated_argument_trigger_error', '__return_false' ); add_action( 'doing_it_wrong_run', 'rest_handle_doing_it_wrong', 10, 3 ); add_filter( 'doing_it_wrong_trigger_error', '__return_false' ); } add_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 ); add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 ); add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3 ); add_filter( 'rest_index', 'rest_add_application_passwords_to_index' ); } function create_initial_rest_routes() { foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) { $controller = $post_type->get_rest_controller(); if ( ! $controller ) { continue; } $controller->register_routes(); if ( post_type_supports( $post_type->name, 'revisions' ) ) { $revisions_controller = new WP_REST_Revisions_Controller( $post_type->name ); $revisions_controller->register_routes(); } if ( 'attachment' !== $post_type->name ) { $autosaves_controller = new WP_REST_Autosaves_Controller( $post_type->name ); $autosaves_controller->register_routes(); } } $controller = new WP_REST_Post_Types_Controller; $controller->register_routes(); $controller = new WP_REST_Post_Statuses_Controller; $controller->register_routes(); $controller = new WP_REST_Taxonomies_Controller; $controller->register_routes(); foreach ( get_taxonomies( array( 'show_in_rest' => true ), 'object' ) as $taxonomy ) { $controller = $taxonomy->get_rest_controller(); if ( ! $controller ) { continue; } $controller->register_routes(); } $controller = new WP_REST_Users_Controller; $controller->register_routes(); $controller = new WP_REST_Application_Passwords_Controller(); $controller->register_routes(); $controller = new WP_REST_Comments_Controller; $controller->register_routes(); $search_handlers = array( new WP_REST_Post_Search_Handler(), new WP_REST_Term_Search_Handler(), new WP_REST_Post_Format_Search_Handler(), ); $search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers ); $controller = new WP_REST_Search_Controller( $search_handlers ); $controller->register_routes(); $controller = new WP_REST_Block_Renderer_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Types_Controller(); $controller->register_routes(); $controller = new WP_REST_Global_Styles_Controller; $controller->register_routes(); $controller = new WP_REST_Settings_Controller; $controller->register_routes(); $controller = new WP_REST_Themes_Controller; $controller->register_routes(); $controller = new WP_REST_Plugins_Controller(); $controller->register_routes(); $controller = new WP_REST_Sidebars_Controller(); $controller->register_routes(); $controller = new WP_REST_Widget_Types_Controller(); $controller->register_routes(); $controller = new WP_REST_Widgets_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Directory_Controller(); $controller->register_routes(); $controller = new WP_REST_Pattern_Directory_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Patterns_Controller(); $controller->register_routes(); $controller = new WP_REST_Block_Pattern_Categories_Controller(); $controller->register_routes(); $site_health = WP_Site_Health::get_instance(); $controller = new WP_REST_Site_Health_Controller( $site_health ); $controller->register_routes(); $controller = new WP_REST_URL_Details_Controller(); $controller->register_routes(); $controller = new WP_REST_Menu_Locations_Controller(); $controller->register_routes(); $controller = new WP_REST_Edit_Site_Export_Controller(); $controller->register_routes(); } function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { return; } define( 'REST_REQUEST', true ); $server = rest_get_server(); $route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ); if ( empty( $route ) ) { $route = '/'; } $server->serve_request( $route ); die(); } function rest_get_url_prefix() { return apply_filters( 'rest_url_prefix', 'wp-json' ); } function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { if ( empty( $path ) ) { $path = '/'; } $path = '/' . ltrim( $path, '/' ); if ( is_multisite() && get_blog_option( $blog_id, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) { global $wp_rewrite; if ( $wp_rewrite->using_index_permalinks() ) { $url = get_home_url( $blog_id, $wp_rewrite->index . '/' . rest_get_url_prefix(), $scheme ); } else { $url = get_home_url( $blog_id, rest_get_url_prefix(), $scheme ); } $url .= $path; } else { $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) ); if ( 'index.php' !== substr( $url, 9 ) ) { $url .= 'index.php'; } $url = add_query_arg( 'rest_route', $path, $url ); } if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) { if ( parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) === $_SERVER['SERVER_NAME'] ) { $url = set_url_scheme( $url, 'https' ); } } if ( is_admin() && force_ssl_admin() ) { $url = set_url_scheme( $url, 'https' ); } return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme ); } function rest_url( $path = '', $scheme = 'rest' ) { return get_rest_url( null, $path, $scheme ); } function rest_do_request( $request ) { $request = rest_ensure_request( $request ); return rest_get_server()->dispatch( $request ); } function rest_get_server() { global $wp_rest_server; if ( empty( $wp_rest_server ) ) { $wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' ); $wp_rest_server = new $wp_rest_server_class; do_action( 'rest_api_init', $wp_rest_server ); } return $wp_rest_server; } function rest_ensure_request( $request ) { if ( $request instanceof WP_REST_Request ) { return $request; } if ( is_string( $request ) ) { return new WP_REST_Request( 'GET', $request ); } return new WP_REST_Request( 'GET', '', $request ); } function rest_ensure_response( $response ) { if ( is_wp_error( $response ) ) { return $response; } if ( $response instanceof WP_REST_Response ) { return $response; } if ( $response instanceof WP_HTTP_Response ) { return new WP_REST_Response( $response->get_data(), $response->get_status(), $response->get_headers() ); } return new WP_REST_Response( $response ); } function rest_handle_deprecated_function( $function, $replacement, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( ! empty( $replacement ) ) { $string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement ); } else { $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version ); } header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) ); } function rest_handle_deprecated_argument( $function, $message, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( $message ) { $string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message ); } else { $string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version ); } header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) ); } function rest_handle_doing_it_wrong( $function, $message, $version ) { if ( ! WP_DEBUG || headers_sent() ) { return; } if ( $version ) { $string = __( '%1$s (since %2$s; %3$s)' ); $string = sprintf( $string, $function, $version, $message ); } else { $string = __( '%1$s (%2$s)' ); $string = sprintf( $string, $function, $message ); } header( sprintf( 'X-WP-DoingItWrong: %s', $string ) ); } function rest_send_cors_headers( $value ) { $origin = get_http_origin(); if ( $origin ) { if ( 'null' !== $origin ) { $origin = esc_url_raw( $origin ); } header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin', false ); } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { header( 'Vary: Origin', false ); } return $value; } function rest_handle_options_request( $response, $handler, $request ) { if ( ! empty( $response ) || $request->get_method() !== 'OPTIONS' ) { return $response; } $response = new WP_REST_Response(); $data = array(); foreach ( $handler->get_routes() as $route => $endpoints ) { $match = preg_match( '@^' . $route . '$@i', $request->get_route(), $matches ); if ( ! $match ) { continue; } $args = array(); foreach ( $matches as $param => $value ) { if ( ! is_int( $param ) ) { $args[ $param ] = $value; } } foreach ( $endpoints as $endpoint ) { unset( $args[0] ); $request->set_url_params( $args ); $request->set_attributes( $endpoint ); } $data = $handler->get_data_for_route( $route, $endpoints, 'help' ); $response->set_matched_route( $route ); break; } $response->set_data( $data ); return $response; } function rest_send_allow_header( $response, $server, $request ) { $matched_route = $response->get_matched_route(); if ( ! $matched_route ) { return $response; } $routes = $server->get_routes(); $allowed_methods = array(); foreach ( $routes[ $matched_route ] as $_handler ) { foreach ( $_handler['methods'] as $handler_method => $value ) { if ( ! empty( $_handler['permission_callback'] ) ) { $permission = call_user_func( $_handler['permission_callback'], $request ); $allowed_methods[ $handler_method ] = true === $permission; } else { $allowed_methods[ $handler_method ] = true; } } } $allowed_methods = array_filter( $allowed_methods ); if ( $allowed_methods ) { $response->header( 'Allow', implode( ', ', array_map( 'strtoupper', array_keys( $allowed_methods ) ) ) ); } return $response; } function _rest_array_intersect_key_recursive( $array1, $array2 ) { $array1 = array_intersect_key( $array1, $array2 ); foreach ( $array1 as $key => $value ) { if ( is_array( $value ) && is_array( $array2[ $key ] ) ) { $array1[ $key ] = _rest_array_intersect_key_recursive( $value, $array2[ $key ] ); } } return $array1; } function rest_filter_response_fields( $response, $server, $request ) { if ( ! isset( $request['_fields'] ) || $response->is_error() ) { return $response; } $data = $response->get_data(); $fields = wp_parse_list( $request['_fields'] ); if ( 0 === count( $fields ) ) { return $response; } $fields = array_map( 'trim', $fields ); $fields_as_keyed = array(); foreach ( $fields as $field ) { $parts = explode( '.', $field ); $ref = &$fields_as_keyed; while ( count( $parts ) > 1 ) { $next = array_shift( $parts ); if ( isset( $ref[ $next ] ) && true === $ref[ $next ] ) { break 2; } $ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] : array(); $ref = &$ref[ $next ]; } $last = array_shift( $parts ); $ref[ $last ] = true; } if ( wp_is_numeric_array( $data ) ) { $new_data = array(); foreach ( $data as $item ) { $new_data[] = _rest_array_intersect_key_recursive( $item, $fields_as_keyed ); } } else { $new_data = _rest_array_intersect_key_recursive( $data, $fields_as_keyed ); } $response->set_data( $new_data ); return $response; } function rest_is_field_included( $field, $fields ) { if ( in_array( $field, $fields, true ) ) { return true; } foreach ( $fields as $accepted_field ) { if ( strpos( $accepted_field, "$field." ) === 0 ) { return true; } if ( strpos( $field, "$accepted_field." ) === 0 ) { return true; } } return false; } function rest_output_rsd() { $api_root = get_rest_url(); if ( empty( $api_root ) ) { return; } ?> - - ', esc_url( $api_root ) ); $resource = rest_get_queried_resource_route(); if ( $resource ) { printf( '', esc_url( rest_url( $resource ) ) ); } } function rest_output_link_header() { if ( headers_sent() ) { return; } $api_root = get_rest_url(); if ( empty( $api_root ) ) { return; } header( sprintf( 'Link: <%s>; rel="https://api.w.org/"', esc_url_raw( $api_root ) ), false ); $resource = rest_get_queried_resource_route(); if ( $resource ) { header( sprintf( 'Link: <%s>; rel="alternate"; type="application/json"', esc_url_raw( rest_url( $resource ) ) ), false ); } } function rest_cookie_check_errors( $result ) { if ( ! empty( $result ) ) { return $result; } global $wp_rest_auth_cookie; if ( true !== $wp_rest_auth_cookie && is_user_logged_in() ) { return $result; } $nonce = null; if ( isset( $_REQUEST['_wpnonce'] ) ) { $nonce = $_REQUEST['_wpnonce']; } elseif ( isset( $_SERVER['HTTP_X_WP_NONCE'] ) ) { $nonce = $_SERVER['HTTP_X_WP_NONCE']; } if ( null === $nonce ) { wp_set_current_user( 0 ); return true; } $result = wp_verify_nonce( $nonce, 'wp_rest' ); if ( ! $result ) { return new WP_Error( 'rest_cookie_invalid_nonce', __( 'Cookie check failed' ), array( 'status' => 403 ) ); } rest_get_server()->send_header( 'X-WP-Nonce', wp_create_nonce( 'wp_rest' ) ); return true; } function rest_cookie_collect_status() { global $wp_rest_auth_cookie; $status_type = current_action(); if ( 'auth_cookie_valid' !== $status_type ) { $wp_rest_auth_cookie = substr( $status_type, 12 ); return; } $wp_rest_auth_cookie = true; } function rest_application_password_collect_status( $user_or_error, $app_password = array() ) { global $wp_rest_application_password_status, $wp_rest_application_password_uuid; $wp_rest_application_password_status = $user_or_error; if ( empty( $app_password['uuid'] ) ) { $wp_rest_application_password_uuid = null; } else { $wp_rest_application_password_uuid = $app_password['uuid']; } } function rest_get_authenticated_app_password() { global $wp_rest_application_password_uuid; return $wp_rest_application_password_uuid; } function rest_application_password_check_errors( $result ) { global $wp_rest_application_password_status; if ( ! empty( $result ) ) { return $result; } if ( is_wp_error( $wp_rest_application_password_status ) ) { $data = $wp_rest_application_password_status->get_error_data(); if ( ! isset( $data['status'] ) ) { $data['status'] = 401; } $wp_rest_application_password_status->add_data( $data ); return $wp_rest_application_password_status; } if ( $wp_rest_application_password_status instanceof WP_User ) { return true; } return $result; } function rest_add_application_passwords_to_index( $response ) { if ( ! wp_is_application_passwords_available() ) { return $response; } $response->data['authentication']['application-passwords'] = array( 'endpoints' => array( 'authorization' => admin_url( 'authorize-application.php' ), ), ); return $response; } function rest_get_avatar_urls( $id_or_email ) { $avatar_sizes = rest_get_avatar_sizes(); $urls = array(); foreach ( $avatar_sizes as $size ) { $urls[ $size ] = get_avatar_url( $id_or_email, array( 'size' => $size ) ); } return $urls; } function rest_get_avatar_sizes() { return apply_filters( 'rest_avatar_sizes', array( 24, 48, 96 ) ); } function rest_parse_date( $date, $force_utc = false ) { if ( $force_utc ) { $date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date ); } $regex = '#^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}(?::\d{2})?)?$#'; if ( ! preg_match( $regex, $date, $matches ) ) { return false; } return strtotime( $date ); } function rest_parse_hex_color( $color ) { $regex = '|^#([A-Fa-f0-9]{3}){1,2}$|'; if ( ! preg_match( $regex, $color, $matches ) ) { return false; } return $color; } function rest_get_date_with_gmt( $date, $is_utc = false ) { $has_timezone = preg_match( '#(Z|[+-]\d{2}(:\d{2})?)$#', $date ); $date = rest_parse_date( $date ); if ( empty( $date ) ) { return null; } if ( ! $is_utc && ! $has_timezone ) { $local = gmdate( 'Y-m-d H:i:s', $date ); $utc = get_gmt_from_date( $local ); } else { $utc = gmdate( 'Y-m-d H:i:s', $date ); $local = get_date_from_gmt( $utc ); } return array( $local, $utc ); } function rest_authorization_required_code() { return is_user_logged_in() ? 403 : 401; } function rest_validate_request_arg( $value, $request, $param ) { $attributes = $request->get_attributes(); if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) { return true; } $args = $attributes['args'][ $param ]; return rest_validate_value_from_schema( $value, $args, $param ); } function rest_sanitize_request_arg( $value, $request, $param ) { $attributes = $request->get_attributes(); if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) { return $value; } $args = $attributes['args'][ $param ]; return rest_sanitize_value_from_schema( $value, $args, $param ); } function rest_parse_request_arg( $value, $request, $param ) { $is_valid = rest_validate_request_arg( $value, $request, $param ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } $value = rest_sanitize_request_arg( $value, $request, $param ); return $value; } function rest_is_ip_address( $ip ) { $ipv4_pattern = '/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/'; if ( ! preg_match( $ipv4_pattern, $ip ) && ! Requests_IPv6::check_ipv6( $ip ) ) { return false; } return $ip; } function rest_sanitize_boolean( $value ) { if ( is_string( $value ) ) { $value = strtolower( $value ); if ( in_array( $value, array( 'false', '0' ), true ) ) { $value = false; } } return (bool) $value; } function rest_is_boolean( $maybe_bool ) { if ( is_bool( $maybe_bool ) ) { return true; } if ( is_string( $maybe_bool ) ) { $maybe_bool = strtolower( $maybe_bool ); $valid_boolean_values = array( 'false', 'true', '0', '1', ); return in_array( $maybe_bool, $valid_boolean_values, true ); } if ( is_int( $maybe_bool ) ) { return in_array( $maybe_bool, array( 0, 1 ), true ); } return false; } function rest_is_integer( $maybe_integer ) { return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer; } function rest_is_array( $maybe_array ) { if ( is_scalar( $maybe_array ) ) { $maybe_array = wp_parse_list( $maybe_array ); } return wp_is_numeric_array( $maybe_array ); } function rest_sanitize_array( $maybe_array ) { if ( is_scalar( $maybe_array ) ) { return wp_parse_list( $maybe_array ); } if ( ! is_array( $maybe_array ) ) { return array(); } return array_values( $maybe_array ); } function rest_is_object( $maybe_object ) { if ( '' === $maybe_object ) { return true; } if ( $maybe_object instanceof stdClass ) { return true; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } return is_array( $maybe_object ); } function rest_sanitize_object( $maybe_object ) { if ( '' === $maybe_object ) { return array(); } if ( $maybe_object instanceof stdClass ) { return (array) $maybe_object; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } if ( ! is_array( $maybe_object ) ) { return array(); } return $maybe_object; } function rest_get_best_type_for_value( $value, $types ) { static $checks = array( 'array' => 'rest_is_array', 'object' => 'rest_is_object', 'integer' => 'rest_is_integer', 'number' => 'is_numeric', 'boolean' => 'rest_is_boolean', 'string' => 'is_string', 'null' => 'is_null', ); if ( '' === $value && in_array( 'string', $types, true ) ) { return 'string'; } foreach ( $types as $type ) { if ( isset( $checks[ $type ] ) && $checks[ $type ]( $value ) ) { return $type; } } return ''; } function rest_handle_multi_type_schema( $value, $args, $param = '' ) { $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); $invalid_types = array_diff( $args['type'], $allowed_types ); if ( $invalid_types ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only contain the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } $best_type = rest_get_best_type_for_value( $value, $args['type'] ); if ( ! $best_type ) { if ( ! $invalid_types ) { return ''; } $best_type = reset( $invalid_types ); } return $best_type; } function rest_validate_array_contains_unique_items( $array ) { $seen = array(); foreach ( $array as $item ) { $stabilized = rest_stabilize_value( $item ); $key = serialize( $stabilized ); if ( ! isset( $seen[ $key ] ) ) { $seen[ $key ] = true; continue; } return false; } return true; } function rest_stabilize_value( $value ) { if ( is_scalar( $value ) || is_null( $value ) ) { return $value; } if ( is_object( $value ) ) { _doing_it_wrong( __FUNCTION__, __( 'Cannot stabilize objects. Convert the object to an array first.' ), '5.5.0' ); return $value; } ksort( $value ); foreach ( $value as $k => $v ) { $value[ $k ] = rest_stabilize_value( $v ); } return $value; } function rest_validate_json_schema_pattern( $pattern, $value ) { $escaped_pattern = str_replace( '#', '\\#', $pattern ); return 1 === preg_match( '#' . $escaped_pattern . '#u', $value ); } function rest_find_matching_pattern_property_schema( $property, $args ) { if ( isset( $args['patternProperties'] ) ) { foreach ( $args['patternProperties'] as $pattern => $child_schema ) { if ( rest_validate_json_schema_pattern( $pattern, $property ) ) { return $child_schema; } } } return null; } function rest_format_combining_operation_error( $param, $error ) { $position = $error['index']; $reason = $error['error_object']->get_error_message(); if ( isset( $error['schema']['title'] ) ) { $title = $error['schema']['title']; return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%1$s is not a valid %2$s. Reason: %3$s' ), $param, $title, $reason ), array( 'position' => $position ) ); } return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%1$s does not match the expected format. Reason: %2$s' ), $param, $reason ), array( 'position' => $position ) ); } function rest_get_combining_operation_error( $value, $param, $errors ) { if ( 1 === count( $errors ) ) { return rest_format_combining_operation_error( $param, $errors[0] ); } $filtered_errors = array(); foreach ( $errors as $error ) { $error_code = $error['error_object']->get_error_code(); $error_data = $error['error_object']->get_error_data(); if ( 'rest_invalid_type' !== $error_code || ( isset( $error_data['param'] ) && $param !== $error_data['param'] ) ) { $filtered_errors[] = $error; } } if ( 1 === count( $filtered_errors ) ) { return rest_format_combining_operation_error( $param, $filtered_errors[0] ); } if ( count( $filtered_errors ) > 1 && 'object' === $filtered_errors[0]['schema']['type'] ) { $result = null; $number = 0; foreach ( $filtered_errors as $error ) { if ( isset( $error['schema']['properties'] ) ) { $n = count( array_intersect_key( $error['schema']['properties'], $value ) ); if ( $n > $number ) { $result = $error; $number = $n; } } } if ( null !== $result ) { return rest_format_combining_operation_error( $param, $result ); } } $schema_titles = array(); foreach ( $errors as $error ) { if ( isset( $error['schema']['title'] ) ) { $schema_titles[] = $error['schema']['title']; } } if ( count( $schema_titles ) === count( $errors ) ) { return new WP_Error( 'rest_no_matching_schema', wp_sprintf( __( '%1$s is not a valid %2$l.' ), $param, $schema_titles ) ); } return new WP_Error( 'rest_no_matching_schema', sprintf( __( '%s does not match any of the expected formats.' ), $param ) ); } function rest_find_any_matching_schema( $value, $args, $param ) { $errors = array(); foreach ( $args['anyOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { return $schema; } $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } return rest_get_combining_operation_error( $value, $param, $errors ); } function rest_find_one_matching_schema( $value, $args, $param, $stop_after_first_match = false ) { $matching_schemas = array(); $errors = array(); foreach ( $args['oneOf'] as $index => $schema ) { if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) { $schema['type'] = $args['type']; } $is_valid = rest_validate_value_from_schema( $value, $schema, $param ); if ( ! is_wp_error( $is_valid ) ) { if ( $stop_after_first_match ) { return $schema; } $matching_schemas[] = array( 'schema_object' => $schema, 'index' => $index, ); } else { $errors[] = array( 'error_object' => $is_valid, 'schema' => $schema, 'index' => $index, ); } } if ( ! $matching_schemas ) { return rest_get_combining_operation_error( $value, $param, $errors ); } if ( count( $matching_schemas ) > 1 ) { $schema_positions = array(); $schema_titles = array(); foreach ( $matching_schemas as $schema ) { $schema_positions[] = $schema['index']; if ( isset( $schema['schema_object']['title'] ) ) { $schema_titles[] = $schema['schema_object']['title']; } } if ( count( $schema_titles ) === count( $matching_schemas ) ) { return new WP_Error( 'rest_one_of_multiple_matches', wp_sprintf( __( '%1$s matches %2$l, but should match only one.' ), $param, $schema_titles ), array( 'positions' => $schema_positions ) ); } return new WP_Error( 'rest_one_of_multiple_matches', sprintf( __( '%s matches more than one of the expected formats.' ), $param ), array( 'positions' => $schema_positions ) ); } return $matching_schemas[0]['schema_object']; } function rest_are_values_equal( $value1, $value2 ) { if ( is_array( $value1 ) && is_array( $value2 ) ) { if ( count( $value1 ) !== count( $value2 ) ) { return false; } foreach ( $value1 as $index => $value ) { if ( ! array_key_exists( $index, $value2 ) || ! rest_are_values_equal( $value, $value2[ $index ] ) ) { return false; } } return true; } if ( is_int( $value1 ) && is_float( $value2 ) || is_float( $value1 ) && is_int( $value2 ) ) { return (float) $value1 === (float) $value2; } return $value1 === $value2; } function rest_validate_enum( $value, $args, $param ) { $sanitized_value = rest_sanitize_value_from_schema( $value, $args, $param ); if ( is_wp_error( $sanitized_value ) ) { return $sanitized_value; } foreach ( $args['enum'] as $enum_value ) { if ( rest_are_values_equal( $sanitized_value, $enum_value ) ) { return true; } } $encoded_enum_values = array(); foreach ( $args['enum'] as $enum_value ) { $encoded_enum_values[] = is_scalar( $enum_value ) ? $enum_value : wp_json_encode( $enum_value ); } if ( count( $encoded_enum_values ) === 1 ) { return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not %2$s.' ), $param, $encoded_enum_values[0] ) ); } return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not one of %2$l.' ), $param, $encoded_enum_values ) ); } function rest_get_allowed_schema_keywords() { return array( 'title', 'description', 'default', 'type', 'format', 'enum', 'items', 'properties', 'additionalProperties', 'patternProperties', 'minProperties', 'maxProperties', 'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf', 'minLength', 'maxLength', 'pattern', 'minItems', 'maxItems', 'uniqueItems', 'anyOf', 'oneOf', ); } function rest_validate_value_from_schema( $value, $args, $param = '' ) { if ( isset( $args['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) { $args['type'] = $matching_schema['type']; } } if ( isset( $args['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) { $args['type'] = $matching_schema['type']; } } $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); if ( ! isset( $args['type'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type" schema keyword for %s is required.' ), $param ), '5.5.0' ); } if ( is_array( $args['type'] ) ) { $best_type = rest_handle_multi_type_schema( $value, $args, $param ); if ( ! $best_type ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, implode( ',', $args['type'] ) ), array( 'param' => $param ) ); } $args['type'] = $best_type; } if ( ! in_array( $args['type'], $allowed_types, true ) ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } switch ( $args['type'] ) { case 'null': $is_valid = rest_validate_null_value_from_schema( $value, $param ); break; case 'boolean': $is_valid = rest_validate_boolean_value_from_schema( $value, $param ); break; case 'object': $is_valid = rest_validate_object_value_from_schema( $value, $args, $param ); break; case 'array': $is_valid = rest_validate_array_value_from_schema( $value, $args, $param ); break; case 'number': $is_valid = rest_validate_number_value_from_schema( $value, $args, $param ); break; case 'string': $is_valid = rest_validate_string_value_from_schema( $value, $args, $param ); break; case 'integer': $is_valid = rest_validate_integer_value_from_schema( $value, $args, $param ); break; default: $is_valid = true; break; } if ( is_wp_error( $is_valid ) ) { return $is_valid; } if ( ! empty( $args['enum'] ) ) { $enum_contains_value = rest_validate_enum( $value, $args, $param ); if ( is_wp_error( $enum_contains_value ) ) { return $enum_contains_value; } } if ( isset( $args['format'] ) && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) ) ) { switch ( $args['format'] ) { case 'hex-color': if ( ! rest_parse_hex_color( $value ) ) { return new WP_Error( 'rest_invalid_hex_color', __( 'Invalid hex color.' ) ); } break; case 'date-time': if ( ! rest_parse_date( $value ) ) { return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) ); } break; case 'email': if ( ! is_email( $value ) ) { return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) ); } break; case 'ip': if ( ! rest_is_ip_address( $value ) ) { return new WP_Error( 'rest_invalid_ip', sprintf( __( '%s is not a valid IP address.' ), $param ) ); } break; case 'uuid': if ( ! wp_is_uuid( $value ) ) { return new WP_Error( 'rest_invalid_uuid', sprintf( __( '%s is not a valid UUID.' ), $param ) ); } break; } } return true; } function rest_validate_null_value_from_schema( $value, $param ) { if ( null !== $value ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'null' ), array( 'param' => $param ) ); } return true; } function rest_validate_boolean_value_from_schema( $value, $param ) { if ( ! rest_is_boolean( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'boolean' ), array( 'param' => $param ) ); } return true; } function rest_validate_object_value_from_schema( $value, $args, $param ) { if ( ! rest_is_object( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'object' ), array( 'param' => $param ) ); } $value = rest_sanitize_object( $value ); if ( isset( $args['required'] ) && is_array( $args['required'] ) ) { foreach ( $args['required'] as $name ) { if ( ! array_key_exists( $name, $value ) ) { return new WP_Error( 'rest_property_required', sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param ) ); } } } elseif ( isset( $args['properties'] ) ) { foreach ( $args['properties'] as $name => $property ) { if ( isset( $property['required'] ) && true === $property['required'] && ! array_key_exists( $name, $value ) ) { return new WP_Error( 'rest_property_required', sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param ) ); } } } foreach ( $value as $property => $v ) { if ( isset( $args['properties'][ $property ] ) ) { $is_valid = rest_validate_value_from_schema( $v, $args['properties'][ $property ], $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } continue; } $pattern_property_schema = rest_find_matching_pattern_property_schema( $property, $args ); if ( null !== $pattern_property_schema ) { $is_valid = rest_validate_value_from_schema( $v, $pattern_property_schema, $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } continue; } if ( isset( $args['additionalProperties'] ) ) { if ( false === $args['additionalProperties'] ) { return new WP_Error( 'rest_additional_properties_forbidden', sprintf( __( '%1$s is not a valid property of Object.' ), $property ) ); } if ( is_array( $args['additionalProperties'] ) ) { $is_valid = rest_validate_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } } } } if ( isset( $args['minProperties'] ) && count( $value ) < $args['minProperties'] ) { return new WP_Error( 'rest_too_few_properties', sprintf( _n( '%1$s must contain at least %2$s property.', '%1$s must contain at least %2$s properties.', $args['minProperties'] ), $param, number_format_i18n( $args['minProperties'] ) ) ); } if ( isset( $args['maxProperties'] ) && count( $value ) > $args['maxProperties'] ) { return new WP_Error( 'rest_too_many_properties', sprintf( _n( '%1$s must contain at most %2$s property.', '%1$s must contain at most %2$s properties.', $args['maxProperties'] ), $param, number_format_i18n( $args['maxProperties'] ) ) ); } return true; } function rest_validate_array_value_from_schema( $value, $args, $param ) { if ( ! rest_is_array( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'array' ), array( 'param' => $param ) ); } $value = rest_sanitize_array( $value ); if ( isset( $args['items'] ) ) { foreach ( $value as $index => $v ) { $is_valid = rest_validate_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } } } if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) { return new WP_Error( 'rest_too_few_items', sprintf( _n( '%1$s must contain at least %2$s item.', '%1$s must contain at least %2$s items.', $args['minItems'] ), $param, number_format_i18n( $args['minItems'] ) ) ); } if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) { return new WP_Error( 'rest_too_many_items', sprintf( _n( '%1$s must contain at most %2$s item.', '%1$s must contain at most %2$s items.', $args['maxItems'] ), $param, number_format_i18n( $args['maxItems'] ) ) ); } if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) { return new WP_Error( 'rest_duplicate_items', sprintf( __( '%s has duplicate items.' ), $param ) ); } return true; } function rest_validate_number_value_from_schema( $value, $args, $param ) { if ( ! is_numeric( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ), array( 'param' => $param ) ); } if ( isset( $args['multipleOf'] ) && fmod( $value, $args['multipleOf'] ) !== 0.0 ) { return new WP_Error( 'rest_invalid_multiple', sprintf( __( '%1$s must be a multiple of %2$s.' ), $param, $args['multipleOf'] ) ); } if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) { if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) ); } if ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) ); } } if ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) { if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) ); } if ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) ); } } if ( isset( $args['minimum'], $args['maximum'] ) ) { if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) { if ( $value >= $args['maximum'] || $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( ! empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) { if ( $value > $args['maximum'] || $value <= $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( ! empty( $args['exclusiveMaximum'] ) && empty( $args['exclusiveMinimum'] ) ) { if ( $value >= $args['maximum'] || $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } if ( empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) { if ( $value > $args['maximum'] || $value < $args['minimum'] ) { return new WP_Error( 'rest_out_of_bounds', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) ); } } } return true; } function rest_validate_string_value_from_schema( $value, $args, $param ) { if ( ! is_string( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ), array( 'param' => $param ) ); } if ( isset( $args['minLength'] ) && mb_strlen( $value ) < $args['minLength'] ) { return new WP_Error( 'rest_too_short', sprintf( _n( '%1$s must be at least %2$s character long.', '%1$s must be at least %2$s characters long.', $args['minLength'] ), $param, number_format_i18n( $args['minLength'] ) ) ); } if ( isset( $args['maxLength'] ) && mb_strlen( $value ) > $args['maxLength'] ) { return new WP_Error( 'rest_too_long', sprintf( _n( '%1$s must be at most %2$s character long.', '%1$s must be at most %2$s characters long.', $args['maxLength'] ), $param, number_format_i18n( $args['maxLength'] ) ) ); } if ( isset( $args['pattern'] ) && ! rest_validate_json_schema_pattern( $args['pattern'], $value ) ) { return new WP_Error( 'rest_invalid_pattern', sprintf( __( '%1$s does not match pattern %2$s.' ), $param, $args['pattern'] ) ); } return true; } function rest_validate_integer_value_from_schema( $value, $args, $param ) { $is_valid_number = rest_validate_number_value_from_schema( $value, $args, $param ); if ( is_wp_error( $is_valid_number ) ) { return $is_valid_number; } if ( ! rest_is_integer( $value ) ) { return new WP_Error( 'rest_invalid_type', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ), array( 'param' => $param ) ); } return true; } function rest_sanitize_value_from_schema( $value, $args, $param = '' ) { if ( isset( $args['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) ) { $args['type'] = $matching_schema['type']; } $value = rest_sanitize_value_from_schema( $value, $matching_schema, $param ); } if ( isset( $args['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $value, $args, $param ); if ( is_wp_error( $matching_schema ) ) { return $matching_schema; } if ( ! isset( $args['type'] ) ) { $args['type'] = $matching_schema['type']; } $value = rest_sanitize_value_from_schema( $value, $matching_schema, $param ); } $allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' ); if ( ! isset( $args['type'] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type" schema keyword for %s is required.' ), $param ), '5.5.0' ); } if ( is_array( $args['type'] ) ) { $best_type = rest_handle_multi_type_schema( $value, $args, $param ); if ( ! $best_type ) { return null; } $args['type'] = $best_type; } if ( ! in_array( $args['type'], $allowed_types, true ) ) { _doing_it_wrong( __FUNCTION__, wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ), '5.5.0' ); } if ( 'array' === $args['type'] ) { $value = rest_sanitize_array( $value ); if ( ! empty( $args['items'] ) ) { foreach ( $value as $index => $v ) { $value[ $index ] = rest_sanitize_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' ); } } if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) { return new WP_Error( 'rest_duplicate_items', sprintf( __( '%s has duplicate items.' ), $param ) ); } return $value; } if ( 'object' === $args['type'] ) { $value = rest_sanitize_object( $value ); foreach ( $value as $property => $v ) { if ( isset( $args['properties'][ $property ] ) ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['properties'][ $property ], $param . '[' . $property . ']' ); continue; } $pattern_property_schema = rest_find_matching_pattern_property_schema( $property, $args ); if ( null !== $pattern_property_schema ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $pattern_property_schema, $param . '[' . $property . ']' ); continue; } if ( isset( $args['additionalProperties'] ) ) { if ( false === $args['additionalProperties'] ) { unset( $value[ $property ] ); } elseif ( is_array( $args['additionalProperties'] ) ) { $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' ); } } } return $value; } if ( 'null' === $args['type'] ) { return null; } if ( 'integer' === $args['type'] ) { return (int) $value; } if ( 'number' === $args['type'] ) { return (float) $value; } if ( 'boolean' === $args['type'] ) { return rest_sanitize_boolean( $value ); } if ( isset( $args['format'] ) && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) ) ) { switch ( $args['format'] ) { case 'hex-color': return (string) sanitize_hex_color( $value ); case 'date-time': return sanitize_text_field( $value ); case 'email': return sanitize_text_field( $value ); case 'uri': return esc_url_raw( $value ); case 'ip': return sanitize_text_field( $value ); case 'uuid': return sanitize_text_field( $value ); case 'text-field': return sanitize_text_field( $value ); case 'textarea-field': return sanitize_textarea_field( $value ); } } if ( 'string' === $args['type'] ) { return (string) $value; } return $value; } function rest_preload_api_request( $memo, $path ) { if ( ! is_array( $memo ) ) { $memo = array(); } if ( empty( $path ) ) { return $memo; } $method = 'GET'; if ( is_array( $path ) && 2 === count( $path ) ) { $method = end( $path ); $path = reset( $path ); if ( ! in_array( $method, array( 'GET', 'OPTIONS' ), true ) ) { $method = 'GET'; } } $path = untrailingslashit( $path ); if ( empty( $path ) ) { $path = '/'; } $path_parts = parse_url( $path ); if ( false === $path_parts ) { return $memo; } $request = new WP_REST_Request( $method, $path_parts['path'] ); if ( ! empty( $path_parts['query'] ) ) { parse_str( $path_parts['query'], $query_params ); $request->set_query_params( $query_params ); } $response = rest_do_request( $request ); if ( 200 === $response->status ) { $server = rest_get_server(); $response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $server, $request ); $embed = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false; $data = (array) $server->response_to_data( $response, $embed ); if ( 'OPTIONS' === $method ) { $memo[ $method ][ $path ] = array( 'body' => $data, 'headers' => $response->headers, ); } else { $memo[ $path ] = array( 'body' => $data, 'headers' => $response->headers, ); } } return $memo; } function rest_parse_embed_param( $embed ) { if ( ! $embed || 'true' === $embed || '1' === $embed ) { return true; } $rels = wp_parse_list( $embed ); if ( ! $rels ) { return true; } return $rels; } function rest_filter_response_by_context( $data, $schema, $context ) { if ( isset( $schema['anyOf'] ) ) { $matching_schema = rest_find_any_matching_schema( $data, $schema, '' ); if ( ! is_wp_error( $matching_schema ) ) { if ( ! isset( $schema['type'] ) ) { $schema['type'] = $matching_schema['type']; } $data = rest_filter_response_by_context( $data, $matching_schema, $context ); } } if ( isset( $schema['oneOf'] ) ) { $matching_schema = rest_find_one_matching_schema( $data, $schema, '', true ); if ( ! is_wp_error( $matching_schema ) ) { if ( ! isset( $schema['type'] ) ) { $schema['type'] = $matching_schema['type']; } $data = rest_filter_response_by_context( $data, $matching_schema, $context ); } } if ( ! is_array( $data ) && ! is_object( $data ) ) { return $data; } if ( isset( $schema['type'] ) ) { $type = $schema['type']; } elseif ( isset( $schema['properties'] ) ) { $type = 'object'; } else { return $data; } $is_array_type = 'array' === $type || ( is_array( $type ) && in_array( 'array', $type, true ) ); $is_object_type = 'object' === $type || ( is_array( $type ) && in_array( 'object', $type, true ) ); if ( $is_array_type && $is_object_type ) { if ( rest_is_array( $data ) ) { $is_object_type = false; } else { $is_array_type = false; } } $has_additional_properties = $is_object_type && isset( $schema['additionalProperties'] ) && is_array( $schema['additionalProperties'] ); foreach ( $data as $key => $value ) { $check = array(); if ( $is_array_type ) { $check = isset( $schema['items'] ) ? $schema['items'] : array(); } elseif ( $is_object_type ) { if ( isset( $schema['properties'][ $key ] ) ) { $check = $schema['properties'][ $key ]; } else { $pattern_property_schema = rest_find_matching_pattern_property_schema( $key, $schema ); if ( null !== $pattern_property_schema ) { $check = $pattern_property_schema; } elseif ( $has_additional_properties ) { $check = $schema['additionalProperties']; } } } if ( ! isset( $check['context'] ) ) { continue; } if ( ! in_array( $context, $check['context'], true ) ) { if ( $is_array_type ) { $data = array(); break; } if ( is_object( $data ) ) { unset( $data->$key ); } else { unset( $data[ $key ] ); } } elseif ( is_array( $value ) || is_object( $value ) ) { $new_value = rest_filter_response_by_context( $value, $check, $context ); if ( is_object( $data ) ) { $data->$key = $new_value; } else { $data[ $key ] = $new_value; } } } return $data; } function rest_default_additional_properties_to_false( $schema ) { $type = (array) $schema['type']; if ( in_array( 'object', $type, true ) ) { if ( isset( $schema['properties'] ) ) { foreach ( $schema['properties'] as $key => $child_schema ) { $schema['properties'][ $key ] = rest_default_additional_properties_to_false( $child_schema ); } } if ( isset( $schema['patternProperties'] ) ) { foreach ( $schema['patternProperties'] as $key => $child_schema ) { $schema['patternProperties'][ $key ] = rest_default_additional_properties_to_false( $child_schema ); } } if ( ! isset( $schema['additionalProperties'] ) ) { $schema['additionalProperties'] = false; } } if ( in_array( 'array', $type, true ) ) { if ( isset( $schema['items'] ) ) { $schema['items'] = rest_default_additional_properties_to_false( $schema['items'] ); } } return $schema; } function rest_get_route_for_post( $post ) { $post = get_post( $post ); if ( ! $post instanceof WP_Post ) { return ''; } $post_type_route = rest_get_route_for_post_type_items( $post->post_type ); if ( ! $post_type_route ) { return ''; } $route = sprintf( '%s/%d', $post_type_route, $post->ID ); return apply_filters( 'rest_route_for_post', $route, $post ); } function rest_get_route_for_post_type_items( $post_type ) { $post_type = get_post_type_object( $post_type ); if ( ! $post_type ) { return ''; } if ( ! $post_type->show_in_rest ) { return ''; } $namespace = ! empty( $post_type->rest_namespace ) ? $post_type->rest_namespace : 'wp/v2'; $rest_base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); return apply_filters( 'rest_route_for_post_type_items', $route, $post_type ); } function rest_get_route_for_term( $term ) { $term = get_term( $term ); if ( ! $term instanceof WP_Term ) { return ''; } $taxonomy_route = rest_get_route_for_taxonomy_items( $term->taxonomy ); if ( ! $taxonomy_route ) { return ''; } $route = sprintf( '%s/%d', $taxonomy_route, $term->term_id ); return apply_filters( 'rest_route_for_term', $route, $term ); } function rest_get_route_for_taxonomy_items( $taxonomy ) { $taxonomy = get_taxonomy( $taxonomy ); if ( ! $taxonomy ) { return ''; } if ( ! $taxonomy->show_in_rest ) { return ''; } $namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2'; $rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $route = sprintf( '/%s/%s', $namespace, $rest_base ); return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy ); } function rest_get_queried_resource_route() { if ( is_singular() ) { $route = rest_get_route_for_post( get_queried_object() ); } elseif ( is_category() || is_tag() || is_tax() ) { $route = rest_get_route_for_term( get_queried_object() ); } elseif ( is_author() ) { $route = '/wp/v2/users/' . get_queried_object_id(); } else { $route = ''; } return apply_filters( 'rest_queried_resource_route', $route ); } function rest_get_endpoint_args_for_schema( $schema, $method = WP_REST_Server::CREATABLE ) { $schema_properties = ! empty( $schema['properties'] ) ? $schema['properties'] : array(); $endpoint_args = array(); $valid_schema_properties = rest_get_allowed_schema_keywords(); $valid_schema_properties = array_diff( $valid_schema_properties, array( 'default', 'required' ) ); foreach ( $schema_properties as $field_id => $params ) { if ( ! empty( $params['readonly'] ) ) { continue; } $endpoint_args[ $field_id ] = array( 'validate_callback' => 'rest_validate_request_arg', 'sanitize_callback' => 'rest_sanitize_request_arg', ); if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) { $endpoint_args[ $field_id ]['default'] = $params['default']; } if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) { $endpoint_args[ $field_id ]['required'] = true; } foreach ( $valid_schema_properties as $schema_prop ) { if ( isset( $params[ $schema_prop ] ) ) { $endpoint_args[ $field_id ][ $schema_prop ] = $params[ $schema_prop ]; } } if ( isset( $params['arg_options'] ) ) { if ( WP_REST_Server::CREATABLE !== $method ) { $params['arg_options'] = array_diff_key( $params['arg_options'], array( 'required' => '', 'default' => '', ) ); } $endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] ); } } return $endpoint_args; } function rest_convert_error_to_response( $error ) { $status = array_reduce( $error->get_all_error_data(), static function ( $status, $error_data ) { return is_array( $error_data ) && isset( $error_data['status'] ) ? $error_data['status'] : $status; }, 500 ); $errors = array(); foreach ( (array) $error->errors as $code => $messages ) { $all_data = $error->get_all_error_data( $code ); $last_data = array_pop( $all_data ); foreach ( (array) $messages as $message ) { $formatted = array( 'code' => $code, 'message' => $message, 'data' => $last_data, ); if ( $all_data ) { $formatted['additional_data'] = $all_data; } $errors[] = $formatted; } } $data = $errors[0]; if ( count( $errors ) > 1 ) { array_shift( $errors ); $data['additional_errors'] = $errors; } return new WP_REST_Response( $data, $status ); } domain = $parsed_url['host']; } $this->path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '/'; if ( '/' !== substr( $this->path, -1 ) ) { $this->path = dirname( $this->path ) . '/'; } if ( is_string( $data ) ) { $pairs = explode( ';', $data ); $name = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) ); $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 ); $this->name = $name; $this->value = urldecode( $value ); array_shift( $pairs ); foreach ( $pairs as $pair ) { $pair = rtrim( $pair ); if ( empty( $pair ) ) { continue; } list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); $key = strtolower( trim( $key ) ); if ( 'expires' === $key ) { $val = strtotime( $val ); } $this->$key = $val; } } else { if ( ! isset( $data['name'] ) ) { return; } foreach ( array( 'name', 'value', 'path', 'domain', 'port', 'host_only' ) as $field ) { if ( isset( $data[ $field ] ) ) { $this->$field = $data[ $field ]; } } if ( isset( $data['expires'] ) ) { $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); } else { $this->expires = null; } } } public function test( $url ) { if ( is_null( $this->name ) ) { return false; } if ( isset( $this->expires ) && time() > $this->expires ) { return false; } $url = parse_url( $url ); $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' === $url['scheme'] ? 443 : 80 ); $url['path'] = isset( $url['path'] ) ? $url['path'] : '/'; $path = isset( $this->path ) ? $this->path : '/'; $port = isset( $this->port ) ? $this->port : null; $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); if ( false === stripos( $domain, '.' ) ) { $domain .= '.local'; } $domain = ( '.' === substr( $domain, 0, 1 ) ) ? substr( $domain, 1 ) : $domain; if ( substr( $url['host'], -strlen( $domain ) ) !== $domain ) { return false; } if ( ! empty( $port ) && ! in_array( $url['port'], array_map( 'intval', explode( ',', $port ) ), true ) ) { return false; } if ( substr( $url['path'], 0, strlen( $path ) ) !== $path ) { return false; } return true; } public function getHeaderValue() { if ( ! isset( $this->name ) || ! isset( $this->value ) ) { return ''; } return $this->name . '=' . apply_filters( 'wp_http_cookie_value', $this->value, $this->name ); } public function getFullHeader() { return 'Cookie: ' . $this->getHeaderValue(); } public function get_attributes() { return array( 'expires' => $this->expires, 'path' => $this->path, 'domain' => $this->domain, ); } } permalink_structure ); } public function using_index_permalinks() { if ( empty( $this->permalink_structure ) ) { return false; } return preg_match( '#^/*' . $this->index . '#', $this->permalink_structure ); } public function using_mod_rewrite_permalinks() { return $this->using_permalinks() && ! $this->using_index_permalinks(); } public function preg_index( $number ) { $match_prefix = '$'; $match_suffix = ''; if ( ! empty( $this->matches ) ) { $match_prefix = '$' . $this->matches . '['; $match_suffix = ']'; } return "$match_prefix$number$match_suffix"; } public function page_uri_index() { global $wpdb; $pages = $wpdb->get_results( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'" ); $posts = get_page_hierarchy( $pages ); if ( ! $posts ) { return array( array(), array() ); } $posts = array_reverse( $posts, true ); $page_uris = array(); $page_attachment_uris = array(); foreach ( $posts as $id => $post ) { $uri = get_page_uri( $id ); $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ) ); if ( ! empty( $attachments ) ) { foreach ( $attachments as $attachment ) { $attach_uri = get_page_uri( $attachment->ID ); $page_attachment_uris[ $attach_uri ] = $attachment->ID; } } $page_uris[ $uri ] = $id; } return array( $page_uris, $page_attachment_uris ); } public function page_rewrite_rules() { $this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' ); return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES, true, true, false, false ); } public function get_date_permastruct() { if ( isset( $this->date_structure ) ) { return $this->date_structure; } if ( empty( $this->permalink_structure ) ) { $this->date_structure = ''; return false; } $endians = array( '%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%' ); $this->date_structure = ''; $date_endian = ''; foreach ( $endians as $endian ) { if ( false !== strpos( $this->permalink_structure, $endian ) ) { $date_endian = $endian; break; } } if ( empty( $date_endian ) ) { $date_endian = '%year%/%monthnum%/%day%'; } $front = $this->front; preg_match_all( '/%.+?%/', $this->permalink_structure, $tokens ); $tok_index = 1; foreach ( (array) $tokens[0] as $token ) { if ( '%post_id%' === $token && ( $tok_index <= 3 ) ) { $front = $front . 'date/'; break; } $tok_index++; } $this->date_structure = $front . $date_endian; return $this->date_structure; } public function get_year_permastruct() { $structure = $this->get_date_permastruct(); if ( empty( $structure ) ) { return false; } $structure = str_replace( '%monthnum%', '', $structure ); $structure = str_replace( '%day%', '', $structure ); $structure = preg_replace( '#/+#', '/', $structure ); return $structure; } public function get_month_permastruct() { $structure = $this->get_date_permastruct(); if ( empty( $structure ) ) { return false; } $structure = str_replace( '%day%', '', $structure ); $structure = preg_replace( '#/+#', '/', $structure ); return $structure; } public function get_day_permastruct() { return $this->get_date_permastruct(); } public function get_category_permastruct() { return $this->get_extra_permastruct( 'category' ); } public function get_tag_permastruct() { return $this->get_extra_permastruct( 'post_tag' ); } public function get_extra_permastruct( $name ) { if ( empty( $this->permalink_structure ) ) { return false; } if ( isset( $this->extra_permastructs[ $name ] ) ) { return $this->extra_permastructs[ $name ]['struct']; } return false; } public function get_author_permastruct() { if ( isset( $this->author_structure ) ) { return $this->author_structure; } if ( empty( $this->permalink_structure ) ) { $this->author_structure = ''; return false; } $this->author_structure = $this->front . $this->author_base . '/%author%'; return $this->author_structure; } public function get_search_permastruct() { if ( isset( $this->search_structure ) ) { return $this->search_structure; } if ( empty( $this->permalink_structure ) ) { $this->search_structure = ''; return false; } $this->search_structure = $this->root . $this->search_base . '/%search%'; return $this->search_structure; } public function get_page_permastruct() { if ( isset( $this->page_structure ) ) { return $this->page_structure; } if ( empty( $this->permalink_structure ) ) { $this->page_structure = ''; return false; } $this->page_structure = $this->root . '%pagename%'; return $this->page_structure; } public function get_feed_permastruct() { if ( isset( $this->feed_structure ) ) { return $this->feed_structure; } if ( empty( $this->permalink_structure ) ) { $this->feed_structure = ''; return false; } $this->feed_structure = $this->root . $this->feed_base . '/%feed%'; return $this->feed_structure; } public function get_comment_feed_permastruct() { if ( isset( $this->comment_feed_structure ) ) { return $this->comment_feed_structure; } if ( empty( $this->permalink_structure ) ) { $this->comment_feed_structure = ''; return false; } $this->comment_feed_structure = $this->root . $this->comments_base . '/' . $this->feed_base . '/%feed%'; return $this->comment_feed_structure; } public function add_rewrite_tag( $tag, $regex, $query ) { $position = array_search( $tag, $this->rewritecode, true ); if ( false !== $position && null !== $position ) { $this->rewritereplace[ $position ] = $regex; $this->queryreplace[ $position ] = $query; } else { $this->rewritecode[] = $tag; $this->rewritereplace[] = $regex; $this->queryreplace[] = $query; } } public function remove_rewrite_tag( $tag ) { $position = array_search( $tag, $this->rewritecode, true ); if ( false !== $position && null !== $position ) { unset( $this->rewritecode[ $position ] ); unset( $this->rewritereplace[ $position ] ); unset( $this->queryreplace[ $position ] ); } } public function generate_rewrite_rules( $permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true ) { $feedregex2 = ''; foreach ( (array) $this->feeds as $feed_name ) { $feedregex2 .= $feed_name . '|'; } $feedregex2 = '(' . trim( $feedregex2, '|' ) . ')/?$'; $feedregex = $this->feed_base . '/' . $feedregex2; $trackbackregex = 'trackback/?$'; $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$'; $commentregex = $this->comments_pagination_base . '-([0-9]{1,})/?$'; $embedregex = 'embed/?$'; if ( $endpoints ) { $ep_query_append = array(); foreach ( (array) $this->endpoints as $endpoint ) { $epmatch = $endpoint[1] . '(/(.*))?/?$'; $epquery = '&' . $endpoint[2] . '='; $ep_query_append[ $epmatch ] = array( $endpoint[0], $epquery ); } } $front = substr( $permalink_structure, 0, strpos( $permalink_structure, '%' ) ); preg_match_all( '/%.+?%/', $permalink_structure, $tokens ); $num_tokens = count( $tokens[0] ); $index = $this->index; $feedindex = $index; $trackbackindex = $index; $embedindex = $index; $queries = array(); for ( $i = 0; $i < $num_tokens; ++$i ) { if ( 0 < $i ) { $queries[ $i ] = $queries[ $i - 1 ] . '&'; } else { $queries[ $i ] = ''; } $query_token = str_replace( $this->rewritecode, $this->queryreplace, $tokens[0][ $i ] ) . $this->preg_index( $i + 1 ); $queries[ $i ] .= $query_token; } $structure = $permalink_structure; if ( '/' !== $front ) { $structure = str_replace( $front, '', $structure ); } $structure = trim( $structure, '/' ); $dirs = $walk_dirs ? explode( '/', $structure ) : array( $structure ); $num_dirs = count( $dirs ); $front = preg_replace( '|^/+|', '', $front ); $post_rewrite = array(); $struct = $front; for ( $j = 0; $j < $num_dirs; ++$j ) { $struct .= $dirs[ $j ] . '/'; $struct = ltrim( $struct, '/' ); $match = str_replace( $this->rewritecode, $this->rewritereplace, $struct ); $num_toks = preg_match_all( '/%.+?%/', $struct, $toks ); $query = ( ! empty( $num_toks ) && isset( $queries[ $num_toks - 1 ] ) ) ? $queries[ $num_toks - 1 ] : ''; switch ( $dirs[ $j ] ) { case '%year%': $ep_mask_specific = EP_YEAR; break; case '%monthnum%': $ep_mask_specific = EP_MONTH; break; case '%day%': $ep_mask_specific = EP_DAY; break; default: $ep_mask_specific = EP_NONE; } $pagematch = $match . $pageregex; $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index( $num_toks + 1 ); $commentmatch = $match . $commentregex; $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index( $num_toks + 1 ); if ( get_option( 'page_on_front' ) ) { $rootcommentmatch = $match . $commentregex; $rootcommentquery = $index . '?' . $query . '&page_id=' . get_option( 'page_on_front' ) . '&cpage=' . $this->preg_index( $num_toks + 1 ); } $feedmatch = $match . $feedregex; $feedquery = $feedindex . '?' . $query . '&feed=' . $this->preg_index( $num_toks + 1 ); $feedmatch2 = $match . $feedregex2; $feedquery2 = $feedindex . '?' . $query . '&feed=' . $this->preg_index( $num_toks + 1 ); $embedmatch = $match . $embedregex; $embedquery = $embedindex . '?' . $query . '&embed=true'; if ( $forcomments ) { $feedquery .= '&withcomments=1'; $feedquery2 .= '&withcomments=1'; } $rewrite = array(); if ( $feed ) { $rewrite = array( $feedmatch => $feedquery, $feedmatch2 => $feedquery2, $embedmatch => $embedquery, ); } if ( $paged ) { $rewrite = array_merge( $rewrite, array( $pagematch => $pagequery ) ); } if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) { $rewrite = array_merge( $rewrite, array( $commentmatch => $commentquery ) ); } elseif ( EP_ROOT & $ep_mask && get_option( 'page_on_front' ) ) { $rewrite = array_merge( $rewrite, array( $rootcommentmatch => $rootcommentquery ) ); } if ( $endpoints ) { foreach ( (array) $ep_query_append as $regex => $ep ) { if ( $ep[0] & $ep_mask || $ep[0] & $ep_mask_specific ) { $rewrite[ $match . $regex ] = $index . '?' . $query . $ep[1] . $this->preg_index( $num_toks + 2 ); } } } if ( $num_toks ) { $post = false; $page = false; if ( strpos( $struct, '%postname%' ) !== false || strpos( $struct, '%post_id%' ) !== false || strpos( $struct, '%pagename%' ) !== false || ( strpos( $struct, '%year%' ) !== false && strpos( $struct, '%monthnum%' ) !== false && strpos( $struct, '%day%' ) !== false && strpos( $struct, '%hour%' ) !== false && strpos( $struct, '%minute%' ) !== false && strpos( $struct, '%second%' ) !== false ) ) { $post = true; if ( strpos( $struct, '%pagename%' ) !== false ) { $page = true; } } if ( ! $post ) { foreach ( get_post_types( array( '_builtin' => false ) ) as $ptype ) { if ( strpos( $struct, "%$ptype%" ) !== false ) { $post = true; $page = is_post_type_hierarchical( $ptype ); break; } } } if ( $post ) { $trackbackmatch = $match . $trackbackregex; $trackbackquery = $trackbackindex . '?' . $query . '&tb=1'; $embedmatch = $match . $embedregex; $embedquery = $embedindex . '?' . $query . '&embed=true'; $match = rtrim( $match, '/' ); $submatchbase = str_replace( array( '(', ')' ), '', $match ); $sub1 = $submatchbase . '/([^/]+)/'; $sub1tb = $sub1 . $trackbackregex; $sub1feed = $sub1 . $feedregex; $sub1feed2 = $sub1 . $feedregex2; $sub1comment = $sub1 . $commentregex; $sub1embed = $sub1 . $embedregex; $sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2tb = $sub2 . $trackbackregex; $sub2feed = $sub2 . $feedregex; $sub2feed2 = $sub2 . $feedregex2; $sub2comment = $sub2 . $commentregex; $sub2embed = $sub2 . $embedregex; $subquery = $index . '?attachment=' . $this->preg_index( 1 ); $subtbquery = $subquery . '&tb=1'; $subfeedquery = $subquery . '&feed=' . $this->preg_index( 2 ); $subcommentquery = $subquery . '&cpage=' . $this->preg_index( 2 ); $subembedquery = $subquery . '&embed=true'; if ( ! empty( $endpoints ) ) { foreach ( (array) $ep_query_append as $regex => $ep ) { if ( $ep[0] & EP_ATTACHMENT ) { $rewrite[ $sub1 . $regex ] = $subquery . $ep[1] . $this->preg_index( 3 ); $rewrite[ $sub2 . $regex ] = $subquery . $ep[1] . $this->preg_index( 3 ); } } } $sub1 .= '?$'; $sub2 .= '?$'; $match = $match . '(?:/([0-9]+))?/?$'; $query = $index . '?' . $query . '&page=' . $this->preg_index( $num_toks + 1 ); } else { $match .= '?$'; $query = $index . '?' . $query; } $rewrite = array_merge( $rewrite, array( $match => $query ) ); if ( $post ) { $rewrite = array_merge( array( $trackbackmatch => $trackbackquery ), $rewrite ); $rewrite = array_merge( array( $embedmatch => $embedquery ), $rewrite ); if ( ! $page ) { $rewrite = array_merge( $rewrite, array( $sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery, $sub1comment => $subcommentquery, $sub1embed => $subembedquery, ) ); } $rewrite = array_merge( array( $sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery, $sub2comment => $subcommentquery, $sub2embed => $subembedquery, ), $rewrite ); } } $post_rewrite = array_merge( $rewrite, $post_rewrite ); } return $post_rewrite; } public function generate_rewrite_rule( $permalink_structure, $walk_dirs = false ) { return $this->generate_rewrite_rules( $permalink_structure, EP_NONE, false, false, false, $walk_dirs ); } public function rewrite_rules() { $rewrite = array(); if ( empty( $this->permalink_structure ) ) { return $rewrite; } $home_path = parse_url( home_url() ); $robots_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); $favicon_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array(); $deprecated_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old', '.*wp-app\.php(/.*)?$' => $this->index . '?error=403', ); $registration_pages = array(); if ( is_multisite() && is_main_site() ) { $registration_pages['.*wp-signup.php$'] = $this->index . '?signup=true'; $registration_pages['.*wp-activate.php$'] = $this->index . '?activate=true'; } $registration_pages['.*wp-register.php$'] = $this->index . '?register=true'; $post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK ); $post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite ); $date_rewrite = $this->generate_rewrite_rules( $this->get_date_permastruct(), EP_DATE ); $date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite ); $root_rewrite = $this->generate_rewrite_rules( $this->root . '/', EP_ROOT ); $root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite ); $comments_rewrite = $this->generate_rewrite_rules( $this->root . $this->comments_base, EP_COMMENTS, false, true, true, false ); $comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite ); $search_structure = $this->get_search_permastruct(); $search_rewrite = $this->generate_rewrite_rules( $search_structure, EP_SEARCH ); $search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite ); $author_rewrite = $this->generate_rewrite_rules( $this->get_author_permastruct(), EP_AUTHORS ); $author_rewrite = apply_filters( 'author_rewrite_rules', $author_rewrite ); $page_rewrite = $this->page_rewrite_rules(); $page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite ); foreach ( $this->extra_permastructs as $permastructname => $struct ) { if ( is_array( $struct ) ) { if ( count( $struct ) == 2 ) { $rules = $this->generate_rewrite_rules( $struct[0], $struct[1] ); } else { $rules = $this->generate_rewrite_rules( $struct['struct'], $struct['ep_mask'], $struct['paged'], $struct['feed'], $struct['forcomments'], $struct['walk_dirs'], $struct['endpoints'] ); } } else { $rules = $this->generate_rewrite_rules( $struct ); } $rules = apply_filters( "{$permastructname}_rewrite_rules", $rules ); if ( 'post_tag' === $permastructname ) { $rules = apply_filters_deprecated( 'tag_rewrite_rules', array( $rules ), '3.1.0', 'post_tag_rewrite_rules' ); } $this->extra_rules_top = array_merge( $this->extra_rules_top, $rules ); } if ( $this->use_verbose_page_rules ) { $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules ); } else { $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules ); } do_action_ref_array( 'generate_rewrite_rules', array( &$this ) ); $this->rules = apply_filters( 'rewrite_rules_array', $this->rules ); return $this->rules; } public function wp_rewrite_rules() { $this->rules = get_option( 'rewrite_rules' ); if ( empty( $this->rules ) ) { $this->matches = 'matches'; $this->rewrite_rules(); if ( ! did_action( 'wp_loaded' ) ) { add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); return $this->rules; } update_option( 'rewrite_rules', $this->rules ); } return $this->rules; } public function mod_rewrite_rules() { if ( ! $this->using_permalinks() ) { return ''; } $site_root = parse_url( site_url() ); if ( isset( $site_root['path'] ) ) { $site_root = trailingslashit( $site_root['path'] ); } $home_root = parse_url( home_url() ); if ( isset( $home_root['path'] ) ) { $home_root = trailingslashit( $home_root['path'] ); } else { $home_root = '/'; } $rules = "\n"; $rules .= "RewriteEngine On\n"; $rules .= "RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n"; $rules .= "RewriteBase $home_root\n"; $rules .= "RewriteRule ^index\.php$ - [L]\n"; foreach ( (array) $this->non_wp_rules as $match => $query ) { $match = str_replace( '.+?', '.+', $match ); $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } if ( $this->use_verbose_rules ) { $this->matches = ''; $rewrite = $this->rewrite_rules(); $num_rules = count( $rewrite ); $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . "RewriteCond %{REQUEST_FILENAME} -d\n" . "RewriteRule ^.*$ - [S=$num_rules]\n"; foreach ( (array) $rewrite as $match => $query ) { $match = str_replace( '.+?', '.+', $match ); if ( strpos( $query, $this->index ) !== false ) { $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } else { $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n"; } } } else { $rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" . "RewriteCond %{REQUEST_FILENAME} !-d\n" . "RewriteRule . {$home_root}{$this->index} [L]\n"; } $rules .= "\n"; $rules = apply_filters( 'mod_rewrite_rules', $rules ); return apply_filters_deprecated( 'rewrite_rules', array( $rules ), '1.5.0', 'mod_rewrite_rules' ); } public function iis7_url_rewrite_rules( $add_parent_tags = false ) { if ( ! $this->using_permalinks() ) { return ''; } $rules = ''; if ( $add_parent_tags ) { $rules .= ' - - - '; } $rules .= ' - - - - - - - - '; if ( $add_parent_tags ) { $rules .= ' - - - -'; } return apply_filters( 'iis7_url_rewrite_rules', $rules ); } public function add_rule( $regex, $query, $after = 'bottom' ) { if ( is_array( $query ) ) { $external = false; $query = add_query_arg( $query, 'index.php' ); } else { $index = false === strpos( $query, '?' ) ? strlen( $query ) : strpos( $query, '?' ); $front = substr( $query, 0, $index ); $external = $front != $this->index; } if ( $external ) { $this->add_external_rule( $regex, $query ); } else { if ( 'bottom' === $after ) { $this->extra_rules = array_merge( $this->extra_rules, array( $regex => $query ) ); } else { $this->extra_rules_top = array_merge( $this->extra_rules_top, array( $regex => $query ) ); } } } public function add_external_rule( $regex, $query ) { $this->non_wp_rules[ $regex ] = $query; } public function add_endpoint( $name, $places, $query_var = true ) { global $wp; if ( true === $query_var || null === $query_var ) { $query_var = $name; } $this->endpoints[] = array( $places, $name, $query_var ); if ( $query_var ) { $wp->add_query_var( $query_var ); } } public function add_permastruct( $name, $struct, $args = array() ) { if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } if ( func_num_args() == 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } $defaults = array( 'with_front' => true, 'ep_mask' => EP_NONE, 'paged' => true, 'feed' => true, 'forcomments' => false, 'walk_dirs' => true, 'endpoints' => true, ); $args = array_intersect_key( $args, $defaults ); $args = wp_parse_args( $args, $defaults ); if ( $args['with_front'] ) { $struct = $this->front . $struct; } else { $struct = $this->root . $struct; } $args['struct'] = $struct; $this->extra_permastructs[ $name ] = $args; } public function remove_permastruct( $name ) { unset( $this->extra_permastructs[ $name ] ); } public function flush_rules( $hard = true ) { static $do_hard_later = null; if ( ! did_action( 'wp_loaded' ) ) { add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); $do_hard_later = ( isset( $do_hard_later ) ) ? $do_hard_later || $hard : $hard; return; } if ( isset( $do_hard_later ) ) { $hard = $do_hard_later; unset( $do_hard_later ); } update_option( 'rewrite_rules', '' ); $this->wp_rewrite_rules(); if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) { return; } if ( function_exists( 'save_mod_rewrite_rules' ) ) { save_mod_rewrite_rules(); } if ( function_exists( 'iis7_save_url_rewrite_rules' ) ) { iis7_save_url_rewrite_rules(); } } public function init() { $this->extra_rules = array(); $this->non_wp_rules = array(); $this->endpoints = array(); $this->permalink_structure = get_option( 'permalink_structure' ); $this->front = substr( $this->permalink_structure, 0, strpos( $this->permalink_structure, '%' ) ); $this->root = ''; if ( $this->using_index_permalinks() ) { $this->root = $this->index . '/'; } unset( $this->author_structure ); unset( $this->date_structure ); unset( $this->page_structure ); unset( $this->search_structure ); unset( $this->feed_structure ); unset( $this->comment_feed_structure ); $this->use_trailing_slashes = ( '/' === substr( $this->permalink_structure, -1, 1 ) ); if ( preg_match( '/^[^%]*%(?:postname|category|tag|author)%/', $this->permalink_structure ) ) { $this->use_verbose_page_rules = true; } else { $this->use_verbose_page_rules = false; } } public function set_permalink_structure( $permalink_structure ) { if ( $permalink_structure != $this->permalink_structure ) { $old_permalink_structure = $this->permalink_structure; update_option( 'permalink_structure', $permalink_structure ); $this->init(); do_action( 'permalink_structure_changed', $old_permalink_structure, $permalink_structure ); } } public function set_category_base( $category_base ) { if ( get_option( 'category_base' ) !== $category_base ) { update_option( 'category_base', $category_base ); $this->init(); } } public function set_tag_base( $tag_base ) { if ( get_option( 'tag_base' ) !== $tag_base ) { update_option( 'tag_base', $tag_base ); $this->init(); } } public function __construct() { $this->init(); } } username() . ':' . $this->password(); } public function authentication_header() { return 'Proxy-Authorization: Basic ' . base64_encode( $this->authentication() ); } public function send_through_proxy( $uri ) { $check = parse_url( $uri ); if ( false === $check ) { return true; } $home = parse_url( get_option( 'siteurl' ) ); $result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home ); if ( ! is_null( $result ) ) { return $result; } if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] === $check['host'] ) ) { return false; } if ( ! defined( 'WP_PROXY_BYPASS_HOSTS' ) ) { return true; } static $bypass_hosts = null; static $wildcard_regex = array(); if ( null === $bypass_hosts ) { $bypass_hosts = preg_split( '|,\s*|', WP_PROXY_BYPASS_HOSTS ); if ( false !== strpos( WP_PROXY_BYPASS_HOSTS, '*' ) ) { $wildcard_regex = array(); foreach ( $bypass_hosts as $host ) { $wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) ); } $wildcard_regex = '/^(' . implode( '|', $wildcard_regex ) . ')$/i'; } } if ( ! empty( $wildcard_regex ) ) { return ! preg_match( $wildcard_regex, $check['host'] ); } else { return ! in_array( $check['host'], $bypass_hosts, true ); } } } is_preview = false; } } if ( is_admin() || is_search() || is_preview() || is_trackback() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) { return; } if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) { $requested_url = is_ssl() ? 'https://' : 'http://'; $requested_url .= $_SERVER['HTTP_HOST']; $requested_url .= $_SERVER['REQUEST_URI']; } $original = parse_url( $requested_url ); if ( false === $original ) { return; } $redirect = $original; $redirect_url = false; $redirect_obj = false; if ( ! isset( $redirect['path'] ) ) { $redirect['path'] = ''; } if ( ! isset( $redirect['query'] ) ) { $redirect['query'] = ''; } $redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] ); if ( get_query_var( 'preview' ) ) { $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] ); } $post_id = get_query_var( 'p' ); if ( is_feed() && $post_id ) { $redirect_url = get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); $redirect_obj = get_post( $post_id ); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ), $redirect_url ); $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH ); } } if ( is_singular() && $wp_query->post_count < 1 && $post_id ) { $vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $post_id ) ); if ( ! empty( $vars[0] ) ) { $vars = $vars[0]; if ( 'revision' === $vars->post_type && $vars->post_parent > 0 ) { $post_id = $vars->post_parent; } $redirect_url = get_permalink( $post_id ); $redirect_obj = get_post( $post_id ); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } } if ( is_404() ) { $post_id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) ); $redirect_post = $post_id ? get_post( $post_id ) : false; if ( $redirect_post ) { $post_type_obj = get_post_type_object( $redirect_post->post_type ); if ( $post_type_obj && $post_type_obj->public && 'auto-draft' !== $redirect_post->post_status ) { $redirect_url = get_permalink( $redirect_post ); $redirect_obj = get_post( $redirect_post ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } $year = get_query_var( 'year' ); $month = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); if ( $year && $month && $day ) { $date = sprintf( '%04d-%02d-%02d', $year, $month, $day ); if ( ! wp_checkdate( $month, $day, $year, $date ) ) { $redirect_url = get_month_link( $year, $month ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url ); } } elseif ( $year && $month && $month > 12 ) { $redirect_url = get_year_link( $year ); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url ); } if ( get_query_var( 'page' ) ) { $post_id = 0; if ( $wp_query->queried_object instanceof WP_Post ) { $post_id = $wp_query->queried_object->ID; } elseif ( $wp_query->post ) { $post_id = $wp_query->post->ID; } if ( $post_id ) { $redirect_url = get_permalink( $post_id ); $redirect_obj = get_post( $post_id ); $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); } } if ( ! $redirect_url ) { $redirect_url = redirect_guess_404_permalink(); if ( $redirect_url ) { $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); } } } elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) { if ( is_attachment() && ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) ) && ! $redirect_url ) { if ( ! empty( $_GET['attachment_id'] ) ) { $redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) ); $redirect_obj = get_post( get_query_var( 'attachment_id' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] ); } } else { $redirect_url = get_attachment_link(); $redirect_obj = get_post(); } } elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) { $redirect_url = get_permalink( get_query_var( 'p' ) ); $redirect_obj = get_post( get_query_var( 'p' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] ); } } elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) { $redirect_url = get_permalink( $wp_query->get_queried_object_id() ); $redirect_obj = get_post( $wp_query->get_queried_object_id() ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'name', $redirect['query'] ); } } elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) { $redirect_url = get_permalink( get_query_var( 'page_id' ) ); $redirect_obj = get_post( get_query_var( 'page_id' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] ); } } elseif ( is_page() && ! is_feed() && ! $redirect_url && 'page' === get_option( 'show_on_front' ) && get_queried_object_id() === (int) get_option( 'page_on_front' ) ) { $redirect_url = home_url( '/' ); } elseif ( is_home() && ! empty( $_GET['page_id'] ) && ! $redirect_url && 'page' === get_option( 'show_on_front' ) && get_query_var( 'page_id' ) === (int) get_option( 'page_for_posts' ) ) { $redirect_url = get_permalink( get_option( 'page_for_posts' ) ); $redirect_obj = get_post( get_option( 'page_for_posts' ) ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] ); } } elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) { $m = get_query_var( 'm' ); switch ( strlen( $m ) ) { case 4: $redirect_url = get_year_link( $m ); break; case 6: $redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) ); break; case 8: $redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) ); break; } if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'm', $redirect['query'] ); } } elseif ( is_date() ) { $year = get_query_var( 'year' ); $month = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); if ( is_day() && $year && $month && ! empty( $_GET['day'] ) ) { $redirect_url = get_day_link( $year, $month, $day ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] ); } } elseif ( is_month() && $year && ! empty( $_GET['monthnum'] ) ) { $redirect_url = get_month_link( $year, $month ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] ); } } elseif ( is_year() && ! empty( $_GET['year'] ) ) { $redirect_url = get_year_link( $year ); if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'year', $redirect['query'] ); } } } elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { $author = get_userdata( get_query_var( 'author' ) ); if ( false !== $author && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) { $redirect_url = get_author_posts_url( $author->ID, $author->user_nicename ); $redirect_obj = $author; if ( $redirect_url ) { $redirect['query'] = remove_query_arg( 'author', $redirect['query'] ); } } } elseif ( is_category() || is_tag() || is_tax() ) { $term_count = 0; foreach ( $wp_query->tax_query->queried_terms as $tax_query ) { $term_count += count( $tax_query['terms'] ); } $obj = $wp_query->get_queried_object(); if ( $term_count <= 1 && ! empty( $obj->term_id ) ) { $tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy ); if ( $tax_url && ! is_wp_error( $tax_url ) ) { if ( ! empty( $redirect['query'] ) ) { $qv_remove = array( 'term', 'taxonomy' ); if ( is_category() ) { $qv_remove[] = 'category_name'; $qv_remove[] = 'cat'; } elseif ( is_tag() ) { $qv_remove[] = 'tag'; $qv_remove[] = 'tag_id'; } else { $tax_obj = get_taxonomy( $obj->taxonomy ); if ( false !== $tax_obj->query_var ) { $qv_remove[] = $tax_obj->query_var; } } $rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) ); if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) { $redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] ); $tax_url = parse_url( $tax_url ); if ( ! empty( $tax_url['query'] ) ) { parse_str( $tax_url['query'], $query_vars ); $redirect['query'] = add_query_arg( $query_vars, $redirect['query'] ); } else { $redirect['path'] = $tax_url['path']; } } else { foreach ( $qv_remove as $_qv ) { if ( isset( $rewrite_vars[ $_qv ] ) ) { $redirect['query'] = remove_query_arg( $_qv, $redirect['query'] ); } } } } } } } elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) { $category_name = get_query_var( 'category_name' ); if ( $category_name ) { $category = get_category_by_path( $category_name ); if ( ! $category || is_wp_error( $category ) || ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() ) ) { $redirect_url = get_permalink( $wp_query->get_queried_object_id() ); $redirect_obj = get_post( $wp_query->get_queried_object_id() ); } } } if ( is_singular() && get_query_var( 'page' ) ) { $page = get_query_var( 'page' ); if ( ! $redirect_url ) { $redirect_url = get_permalink( get_queried_object_id() ); $redirect_obj = get_post( get_queried_object_id() ); } if ( $page > 1 ) { $redirect_url = trailingslashit( $redirect_url ); if ( is_front_page() ) { $redirect_url .= user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' ); } else { $redirect_url .= user_trailingslashit( $page, 'single_paged' ); } } $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); } if ( get_query_var( 'sitemap' ) ) { $redirect_url = get_sitemap_url( get_query_var( 'sitemap' ), get_query_var( 'sitemap-subtype' ), get_query_var( 'paged' ) ); $redirect['query'] = remove_query_arg( array( 'sitemap', 'sitemap-subtype', 'paged' ), $redirect['query'] ); } elseif ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) { $paged = get_query_var( 'paged' ); $feed = get_query_var( 'feed' ); $cpage = get_query_var( 'cpage' ); while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) { $redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] ); $redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] ); $redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] ); } $addl_path = ''; $default_feed = get_default_feed(); if ( is_feed() && in_array( $feed, $wp_rewrite->feeds, true ) ) { $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : ''; if ( ! is_singular() && get_query_var( 'withcomments' ) ) { $addl_path .= 'comments/'; } if ( ( 'rss' === $default_feed && 'feed' === $feed ) || 'rss' === $feed ) { $format = ( 'rss2' === $default_feed ) ? '' : 'rss2'; } else { $format = ( $default_feed === $feed || 'feed' === $feed ) ? '' : $feed; } $addl_path .= user_trailingslashit( 'feed/' . $format, 'feed' ); $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); } elseif ( is_feed() && 'old' === $feed ) { $old_feed_files = array( 'wp-atom.php' => 'atom', 'wp-commentsrss2.php' => 'comments_rss2', 'wp-feed.php' => $default_feed, 'wp-rdf.php' => 'rdf', 'wp-rss.php' => 'rss2', 'wp-rss2.php' => 'rss2', ); if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) { $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] ); wp_redirect( $redirect_url, 301 ); die(); } } if ( $paged > 0 ) { $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] ); if ( ! is_feed() ) { if ( ! is_single() ) { $addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : ''; if ( $paged > 1 ) { $addl_path .= user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' ); } } } elseif ( $paged > 1 ) { $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] ); } } $default_comments_page = get_option( 'default_comments_page' ); if ( get_option( 'page_comments' ) && ( 'newest' === $default_comments_page && $cpage > 0 || 'newest' !== $default_comments_page && $cpage > 1 ) ) { $addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' ); $addl_path .= user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' ); $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); } $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] ); $redirect['path'] = user_trailingslashit( $redirect['path'] ); if ( ! empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false ) { $redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/'; } if ( ! empty( $addl_path ) ) { $redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path; } $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; } if ( 'wp-register.php' === basename( $redirect['path'] ) ) { if ( is_multisite() ) { $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); } else { $redirect_url = wp_registration_url(); } wp_redirect( $redirect_url, 301 ); die(); } } $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); if ( $redirect_url && ! empty( $redirect['query'] ) ) { parse_str( $redirect['query'], $_parsed_query ); $redirect = parse_url( $redirect_url ); if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) { parse_str( $redirect['query'], $_parsed_redirect_query ); if ( empty( $_parsed_redirect_query['name'] ) ) { unset( $_parsed_query['name'] ); } } $_parsed_query = array_combine( rawurlencode_deep( array_keys( $_parsed_query ) ), rawurlencode_deep( array_values( $_parsed_query ) ) ); $redirect_url = add_query_arg( $_parsed_query, $redirect_url ); } if ( $redirect_url ) { $redirect = parse_url( $redirect_url ); } $user_home = parse_url( home_url() ); if ( ! empty( $user_home['host'] ) ) { $redirect['host'] = $user_home['host']; } if ( empty( $user_home['path'] ) ) { $user_home['path'] = '/'; } if ( ! empty( $user_home['port'] ) ) { $redirect['port'] = $user_home['port']; } else { unset( $redirect['port'] ); } $redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] ); $punctuation_pattern = implode( '|', array_map( 'preg_quote', array( ' ', '%20', '!', '%21', '"', '%22', "'", '%27', '(', '%28', ')', '%29', ',', '%2C', '.', '%2E', ';', '%3B', '{', '%7B', '}', '%7D', '%E2%80%9C', '%E2%80%9D', ) ) ); $redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] ); if ( ! empty( $redirect['query'] ) ) { $redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] ); $redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' ); $redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] ); $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); } if ( ! $wp_rewrite->using_index_permalinks() ) { $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] ); } if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() && ! is_404() && ( ! is_front_page() || is_front_page() && get_query_var( 'paged' ) > 1 ) ) { $user_ts_type = ''; if ( get_query_var( 'paged' ) > 0 ) { $user_ts_type = 'paged'; } else { foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) { $func = 'is_' . $type; if ( call_user_func( $func ) ) { $user_ts_type = $type; break; } } } $redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type ); } elseif ( is_front_page() ) { $redirect['path'] = trailingslashit( $redirect['path'] ); } if ( is_robots() || ! empty( get_query_var( 'sitemap' ) ) || ! empty( get_query_var( 'sitemap-stylesheet' ) ) ) { $redirect['path'] = untrailingslashit( $redirect['path'] ); } if ( strpos( $redirect['path'], '//' ) > -1 ) { $redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] ); } if ( trailingslashit( $redirect['path'] ) === trailingslashit( $user_home['path'] ) ) { $redirect['path'] = trailingslashit( $redirect['path'] ); } $original_host_low = strtolower( $original['host'] ); $redirect_host_low = strtolower( $redirect['host'] ); if ( $original_host_low === $redirect_host_low || ( 'www.' . $original_host_low !== $redirect_host_low && 'www.' . $redirect_host_low !== $original_host_low ) ) { $redirect['host'] = $original['host']; } $compare_original = array( $original['host'], $original['path'] ); if ( ! empty( $original['port'] ) ) { $compare_original[] = $original['port']; } if ( ! empty( $original['query'] ) ) { $compare_original[] = $original['query']; } $compare_redirect = array( $redirect['host'], $redirect['path'] ); if ( ! empty( $redirect['port'] ) ) { $compare_redirect[] = $redirect['port']; } if ( ! empty( $redirect['query'] ) ) { $compare_redirect[] = $redirect['query']; } if ( $compare_original !== $compare_redirect ) { $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; if ( ! empty( $redirect['port'] ) ) { $redirect_url .= ':' . $redirect['port']; } $redirect_url .= $redirect['path']; if ( ! empty( $redirect['query'] ) ) { $redirect_url .= '?' . $redirect['query']; } } if ( ! $redirect_url || $redirect_url === $requested_url ) { return; } if ( false !== strpos( $requested_url, '%' ) ) { if ( ! function_exists( 'lowercase_octets' ) ) { function lowercase_octets( $matches ) { return strtolower( $matches[0] ); } } $requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url ); } if ( $redirect_obj instanceof WP_Post ) { $post_status_obj = get_post_status_object( get_post_status( $redirect_obj ) ); if ( ! ( $post_status_obj->private && current_user_can( 'read_post', $redirect_obj->ID ) ) && ! is_post_publicly_viewable( $redirect_obj ) ) { $redirect_obj = false; $redirect_url = false; } } $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url ); if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) === strip_fragment_from_url( $requested_url ) ) { return; } if ( $do_redirect ) { if ( ! redirect_canonical( $redirect_url, false ) ) { wp_redirect( $redirect_url, 301 ); exit; } else { return; } } else { return $redirect_url; } } function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) { $parsed_url = parse_url( $url ); if ( ! empty( $parsed_url['query'] ) ) { parse_str( $parsed_url['query'], $parsed_query ); foreach ( $args_to_check as $qv ) { if ( ! isset( $parsed_query[ $qv ] ) ) { $query_string = remove_query_arg( $qv, $query_string ); } } } else { $query_string = remove_query_arg( $args_to_check, $query_string ); } return $query_string; } function strip_fragment_from_url( $url ) { $parsed_url = wp_parse_url( $url ); if ( ! empty( $parsed_url['host'] ) ) { $url = ''; if ( ! empty( $parsed_url['scheme'] ) ) { $url = $parsed_url['scheme'] . ':'; } $url .= '//' . $parsed_url['host']; if ( ! empty( $parsed_url['port'] ) ) { $url .= ':' . $parsed_url['port']; } if ( ! empty( $parsed_url['path'] ) ) { $url .= $parsed_url['path']; } if ( ! empty( $parsed_url['query'] ) ) { $url .= '?' . $parsed_url['query']; } } return $url; } function redirect_guess_404_permalink() { global $wpdb; if ( false === apply_filters( 'do_redirect_guess_404_permalink', true ) ) { return false; } $pre = apply_filters( 'pre_redirect_guess_404_permalink', null ); if ( null !== $pre ) { return $pre; } if ( get_query_var( 'name' ) ) { $strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false ); if ( $strict_guess ) { $where = $wpdb->prepare( 'post_name = %s', get_query_var( 'name' ) ); } else { $where = $wpdb->prepare( 'post_name LIKE %s', $wpdb->esc_like( get_query_var( 'name' ) ) . '%' ); } if ( get_query_var( 'post_type' ) ) { if ( is_array( get_query_var( 'post_type' ) ) ) { $where .= " AND post_type IN ('" . join( "', '", esc_sql( get_query_var( 'post_type' ) ) ) . "')"; } else { $where .= $wpdb->prepare( ' AND post_type = %s', get_query_var( 'post_type' ) ); } } else { $where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')"; } if ( get_query_var( 'year' ) ) { $where .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) ); } if ( get_query_var( 'monthnum' ) ) { $where .= $wpdb->prepare( ' AND MONTH(post_date) = %d', get_query_var( 'monthnum' ) ); } if ( get_query_var( 'day' ) ) { $where .= $wpdb->prepare( ' AND DAYOFMONTH(post_date) = %d', get_query_var( 'day' ) ); } $publicly_viewable_statuses = array_filter( get_post_stati(), 'is_post_status_viewable' ); $post_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE $where AND post_status IN ('" . implode( "', '", esc_sql( $publicly_viewable_statuses ) ) . "')" ); if ( ! $post_id ) { return false; } if ( get_query_var( 'feed' ) ) { return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); } elseif ( get_query_var( 'page' ) > 1 ) { return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); } else { return get_permalink( $post_id ); } } return false; } function wp_redirect_admin_locations() { global $wp_rewrite; if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) ) { return; } $admins = array( home_url( 'wp-admin', 'relative' ), home_url( 'dashboard', 'relative' ), home_url( 'admin', 'relative' ), site_url( 'dashboard', 'relative' ), site_url( 'admin', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true ) ) { wp_redirect( admin_url() ); exit; } $logins = array( home_url( 'wp-login.php', 'relative' ), home_url( 'login', 'relative' ), site_url( 'login', 'relative' ), ); if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins, true ) ) { wp_redirect( wp_login_url() ); exit; } } url = $url; $this->timeout = $timeout; $this->redirects = $redirects; $this->headers = $headers; $this->useragent = $useragent; $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE; if ( preg_match( '/^http(s)?:\/\//i', $url ) ) { $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects, ); if ( ! empty( $this->headers ) ) { $args['headers'] = $this->headers; } if ( SIMPLEPIE_USERAGENT != $this->useragent ) { $args['user-agent'] = $this->useragent; } $res = wp_safe_remote_request( $url, $args ); if ( is_wp_error( $res ) ) { $this->error = 'WP HTTP Error: ' . $res->get_error_message(); $this->success = false; } else { $this->headers = wp_remote_retrieve_headers( $res ); foreach ( $this->headers as $name => $value ) { if ( ! is_array( $value ) ) { continue; } if ( 'content-type' === $name ) { $this->headers[ $name ] = array_pop( $value ); } else { $this->headers[ $name ] = implode( ', ', $value ); } } $this->body = wp_remote_retrieve_body( $res ); $this->status_code = wp_remote_retrieve_response_code( $res ); } } else { $this->error = ''; $this->success = false; } } } add( $key, $data, $group, (int) $expire ); } function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->add_multiple( $data, $group, $expire ); } function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->replace( $key, $data, $group, (int) $expire ); } function wp_cache_set( $key, $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->set( $key, $data, $group, (int) $expire ); } function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; return $wp_object_cache->set_multiple( $data, $group, $expire ); } function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { global $wp_object_cache; return $wp_object_cache->get( $key, $group, $force, $found ); } function wp_cache_get_multiple( $keys, $group = '', $force = false ) { global $wp_object_cache; return $wp_object_cache->get_multiple( $keys, $group, $force ); } function wp_cache_delete( $key, $group = '' ) { global $wp_object_cache; return $wp_object_cache->delete( $key, $group ); } function wp_cache_delete_multiple( array $keys, $group = '' ) { global $wp_object_cache; return $wp_object_cache->delete_multiple( $keys, $group ); } function wp_cache_incr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->incr( $key, $offset, $group ); } function wp_cache_decr( $key, $offset = 1, $group = '' ) { global $wp_object_cache; return $wp_object_cache->decr( $key, $offset, $group ); } function wp_cache_flush() { global $wp_object_cache; return $wp_object_cache->flush(); } function wp_cache_flush_runtime() { return wp_cache_flush(); } function wp_cache_close() { return true; } function wp_cache_add_global_groups( $groups ) { global $wp_object_cache; $wp_object_cache->add_global_groups( $groups ); } function wp_cache_add_non_persistent_groups( $groups ) { } function wp_cache_switch_to_blog( $blog_id ) { global $wp_object_cache; $wp_object_cache->switch_to_blog( $blog_id ); } function wp_cache_reset() { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_cache_switch_to_blog()' ); global $wp_object_cache; $wp_object_cache->reset(); } multisite = is_multisite(); $this->blog_prefix = $this->multisite ? get_current_blog_id() . ':' : ''; } public function __get( $name ) { return $this->$name; } public function __set( $name, $value ) { return $this->$name = $value; } public function __isset( $name ) { return isset( $this->$name ); } public function __unset( $name ) { unset( $this->$name ); } protected function _exists( $key, $group ) { return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) ); } public function add( $key, $data, $group = 'default', $expire = 0 ) { if ( wp_suspend_cache_addition() ) { return false; } if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } public function add_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->add( $key, $value, $group, $expire ); } return $values; } public function replace( $key, $data, $group = 'default', $expire = 0 ) { if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( ! $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } public function set( $key, $data, $group = 'default', $expire = 0 ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( is_object( $data ) ) { $data = clone $data; } $this->cache[ $group ][ $key ] = $data; return true; } public function set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->set( $key, $value, $group, $expire ); } return $values; } public function get( $key, $group = 'default', $force = false, &$found = null ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( $this->_exists( $key, $group ) ) { $found = true; $this->cache_hits += 1; if ( is_object( $this->cache[ $group ][ $key ] ) ) { return clone $this->cache[ $group ][ $key ]; } else { return $this->cache[ $group ][ $key ]; } } $found = false; $this->cache_misses += 1; return false; } public function get_multiple( $keys, $group = 'default', $force = false ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->get( $key, $group, $force ); } return $values; } public function delete( $key, $group = 'default', $deprecated = false ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } unset( $this->cache[ $group ][ $key ] ); return true; } public function delete_multiple( array $keys, $group = '' ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->delete( $key, $group ); } return $values; } public function incr( $key, $offset = 1, $group = 'default' ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] += $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } public function decr( $key, $offset = 1, $group = 'default' ) { if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] -= $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } public function flush() { $this->cache = array(); return true; } public function add_global_groups( $groups ) { $groups = (array) $groups; $groups = array_fill_keys( $groups, true ); $this->global_groups = array_merge( $this->global_groups, $groups ); } public function switch_to_blog( $blog_id ) { $blog_id = (int) $blog_id; $this->blog_prefix = $this->multisite ? $blog_id . ':' : ''; } public function reset() { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Object_Cache::switch_to_blog()' ); foreach ( array_keys( $this->cache ) as $group ) { if ( ! isset( $this->global_groups[ $group ] ) ) { unset( $this->cache[ $group ] ); } } } public function stats() { echo '

                '; echo "Cache Hits: {$this->cache_hits}
                "; echo "Cache Misses: {$this->cache_misses}
                "; echo '

                '; echo '
                  '; foreach ( $this->cache as $group => $cache ) { echo '
                • Group: ' . esc_html( $group ) . ' - ( ' . number_format( strlen( serialize( $cache ) ) / KB_IN_BYTES, 2 ) . 'k )
                • '; } echo '
                '; } } ID : false; } function the_title( $before = '', $after = '', $echo = true ) { $title = get_the_title(); if ( strlen( $title ) == 0 ) { return; } $title = $before . $title . $after; if ( $echo ) { echo $title; } else { return $title; } } function the_title_attribute( $args = '' ) { $defaults = array( 'before' => '', 'after' => '', 'echo' => true, 'post' => get_post(), ); $parsed_args = wp_parse_args( $args, $defaults ); $title = get_the_title( $parsed_args['post'] ); if ( strlen( $title ) == 0 ) { return; } $title = $parsed_args['before'] . $title . $parsed_args['after']; $title = esc_attr( strip_tags( $title ) ); if ( $parsed_args['echo'] ) { echo $title; } else { return $title; } } function get_the_title( $post = 0 ) { $post = get_post( $post ); $title = isset( $post->post_title ) ? $post->post_title : ''; $id = isset( $post->ID ) ? $post->ID : 0; if ( ! is_admin() ) { if ( ! empty( $post->post_password ) ) { $prepend = __( 'Protected: %s' ); $protected_title_format = apply_filters( 'protected_title_format', $prepend, $post ); $title = sprintf( $protected_title_format, $title ); } elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) { $prepend = __( 'Private: %s' ); $private_title_format = apply_filters( 'private_title_format', $prepend, $post ); $title = sprintf( $private_title_format, $title ); } } return apply_filters( 'the_title', $title, $id ); } function the_guid( $post = 0 ) { $post = get_post( $post ); $guid = isset( $post->guid ) ? get_the_guid( $post ) : ''; $id = isset( $post->ID ) ? $post->ID : 0; echo apply_filters( 'the_guid', $guid, $id ); } function get_the_guid( $post = 0 ) { $post = get_post( $post ); $guid = isset( $post->guid ) ? $post->guid : ''; $id = isset( $post->ID ) ? $post->ID : 0; return apply_filters( 'get_the_guid', $guid, $id ); } function the_content( $more_link_text = null, $strip_teaser = false ) { $content = get_the_content( $more_link_text, $strip_teaser ); $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); echo $content; } function get_the_content( $more_link_text = null, $strip_teaser = false, $post = null ) { global $page, $more, $preview, $pages, $multipage; $_post = get_post( $post ); if ( ! ( $_post instanceof WP_Post ) ) { return ''; } if ( null === $post && did_action( 'the_post' ) ) { $elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' ); } else { $elements = generate_postdata( $_post ); } if ( null === $more_link_text ) { $more_link_text = sprintf( '%2$s', sprintf( __( 'Continue reading %s' ), the_title_attribute( array( 'echo' => false, 'post' => $_post, ) ) ), __( '(more…)' ) ); } $output = ''; $has_teaser = false; if ( post_password_required( $_post ) ) { return get_the_password_form( $_post ); } if ( $elements['page'] > count( $elements['pages'] ) ) { $elements['page'] = count( $elements['pages'] ); } $page_no = $elements['page']; $content = $elements['pages'][ $page_no - 1 ]; if ( preg_match( '//', $content, $matches ) ) { if ( has_block( 'more', $content ) ) { $content = preg_replace( '//', '', $content ); } $content = explode( $matches[0], $content, 2 ); if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) { $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); } $has_teaser = true; } else { $content = array( $content ); } if ( false !== strpos( $_post->post_content, '' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) { $strip_teaser = true; } $teaser = $content[0]; if ( $elements['more'] && $strip_teaser && $has_teaser ) { $teaser = ''; } $output .= $teaser; if ( count( $content ) > 1 ) { if ( $elements['more'] ) { $output .= '' . $content[1]; } else { if ( ! empty( $more_link_text ) ) { $output .= apply_filters( 'the_content_more_link', ' ID}\" class=\"more-link\">$more_link_text", $more_link_text ); } $output = force_balance_tags( $output ); } } return $output; } function the_excerpt() { echo apply_filters( 'the_excerpt', get_the_excerpt() ); } function get_the_excerpt( $post = null ) { if ( is_bool( $post ) ) { _deprecated_argument( __FUNCTION__, '2.3.0' ); } $post = get_post( $post ); if ( empty( $post ) ) { return ''; } if ( post_password_required( $post ) ) { return __( 'There is no excerpt because this is a protected post.' ); } return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); } function has_excerpt( $post = 0 ) { $post = get_post( $post ); return ( ! empty( $post->post_excerpt ) ); } function post_class( $class = '', $post_id = null ) { echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post_id ) ) ) . '"'; } function get_post_class( $class = '', $post_id = null ) { $post = get_post( $post_id ); $classes = array(); if ( $class ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_map( 'esc_attr', $class ); } else { $class = array(); } if ( ! $post ) { return $classes; } $classes[] = 'post-' . $post->ID; if ( ! is_admin() ) { $classes[] = $post->post_type; } $classes[] = 'type-' . $post->post_type; $classes[] = 'status-' . $post->post_status; if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post->ID ); if ( $post_format && ! is_wp_error( $post_format ) ) { $classes[] = 'format-' . sanitize_html_class( $post_format ); } else { $classes[] = 'format-standard'; } } $post_password_required = post_password_required( $post->ID ); if ( $post_password_required ) { $classes[] = 'post-password-required'; } elseif ( ! empty( $post->post_password ) ) { $classes[] = 'post-password-protected'; } if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) { $classes[] = 'has-post-thumbnail'; } if ( is_sticky( $post->ID ) ) { if ( is_home() && ! is_paged() ) { $classes[] = 'sticky'; } elseif ( is_admin() ) { $classes[] = 'status-sticky'; } } $classes[] = 'hentry'; $taxonomies = get_taxonomies( array( 'public' => true ) ); foreach ( (array) $taxonomies as $taxonomy ) { if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) { if ( empty( $term->slug ) ) { continue; } $term_class = sanitize_html_class( $term->slug, $term->term_id ); if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { $term_class = $term->term_id; } if ( 'post_tag' === $taxonomy ) { $classes[] = 'tag-' . $term_class; } else { $classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id ); } } } } $classes = array_map( 'esc_attr', $classes ); $classes = apply_filters( 'post_class', $classes, $class, $post->ID ); return array_unique( $classes ); } function body_class( $class = '' ) { echo 'class="' . esc_attr( implode( ' ', get_body_class( $class ) ) ) . '"'; } function get_body_class( $class = '' ) { global $wp_query; $classes = array(); if ( is_rtl() ) { $classes[] = 'rtl'; } if ( is_front_page() ) { $classes[] = 'home'; } if ( is_home() ) { $classes[] = 'blog'; } if ( is_privacy_policy() ) { $classes[] = 'privacy-policy'; } if ( is_archive() ) { $classes[] = 'archive'; } if ( is_date() ) { $classes[] = 'date'; } if ( is_search() ) { $classes[] = 'search'; $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results'; } if ( is_paged() ) { $classes[] = 'paged'; } if ( is_attachment() ) { $classes[] = 'attachment'; } if ( is_404() ) { $classes[] = 'error404'; } if ( is_singular() ) { $post_id = $wp_query->get_queried_object_id(); $post = $wp_query->get_queried_object(); $post_type = $post->post_type; if ( is_page_template() ) { $classes[] = "{$post_type}-template"; $template_slug = get_page_template_slug( $post_id ); $template_parts = explode( '/', $template_slug ); foreach ( $template_parts as $part ) { $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) ); } $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) ); } else { $classes[] = "{$post_type}-template-default"; } if ( is_single() ) { $classes[] = 'single'; if ( isset( $post->post_type ) ) { $classes[] = 'single-' . sanitize_html_class( $post->post_type, $post_id ); $classes[] = 'postid-' . $post_id; if ( post_type_supports( $post->post_type, 'post-formats' ) ) { $post_format = get_post_format( $post->ID ); if ( $post_format && ! is_wp_error( $post_format ) ) { $classes[] = 'single-format-' . sanitize_html_class( $post_format ); } else { $classes[] = 'single-format-standard'; } } } } if ( is_attachment() ) { $mime_type = get_post_mime_type( $post_id ); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); $classes[] = 'attachmentid-' . $post_id; $classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type ); } elseif ( is_page() ) { $classes[] = 'page'; $page_id = $wp_query->get_queried_object_id(); $post = get_post( $page_id ); $classes[] = 'page-id-' . $page_id; if ( get_pages( array( 'parent' => $page_id, 'number' => 1, ) ) ) { $classes[] = 'page-parent'; } if ( $post->post_parent ) { $classes[] = 'page-child'; $classes[] = 'parent-pageid-' . $post->post_parent; } } } elseif ( is_archive() ) { if ( is_post_type_archive() ) { $classes[] = 'post-type-archive'; $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); } elseif ( is_author() ) { $author = $wp_query->get_queried_object(); $classes[] = 'author'; if ( isset( $author->user_nicename ) ) { $classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID ); $classes[] = 'author-' . $author->ID; } } elseif ( is_category() ) { $cat = $wp_query->get_queried_object(); $classes[] = 'category'; if ( isset( $cat->term_id ) ) { $cat_class = sanitize_html_class( $cat->slug, $cat->term_id ); if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) { $cat_class = $cat->term_id; } $classes[] = 'category-' . $cat_class; $classes[] = 'category-' . $cat->term_id; } } elseif ( is_tag() ) { $tag = $wp_query->get_queried_object(); $classes[] = 'tag'; if ( isset( $tag->term_id ) ) { $tag_class = sanitize_html_class( $tag->slug, $tag->term_id ); if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) { $tag_class = $tag->term_id; } $classes[] = 'tag-' . $tag_class; $classes[] = 'tag-' . $tag->term_id; } } elseif ( is_tax() ) { $term = $wp_query->get_queried_object(); if ( isset( $term->term_id ) ) { $term_class = sanitize_html_class( $term->slug, $term->term_id ); if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) { $term_class = $term->term_id; } $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy ); $classes[] = 'term-' . $term_class; $classes[] = 'term-' . $term->term_id; } } } if ( is_user_logged_in() ) { $classes[] = 'logged-in'; } if ( is_admin_bar_showing() ) { $classes[] = 'admin-bar'; $classes[] = 'no-customize-support'; } if ( current_theme_supports( 'custom-background' ) && ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) ) { $classes[] = 'custom-background'; } if ( has_custom_logo() ) { $classes[] = 'wp-custom-logo'; } if ( current_theme_supports( 'responsive-embeds' ) ) { $classes[] = 'wp-embed-responsive'; } $page = $wp_query->get( 'page' ); if ( ! $page || $page < 2 ) { $page = $wp_query->get( 'paged' ); } if ( $page && $page > 1 && ! is_404() ) { $classes[] = 'paged-' . $page; if ( is_single() ) { $classes[] = 'single-paged-' . $page; } elseif ( is_page() ) { $classes[] = 'page-paged-' . $page; } elseif ( is_category() ) { $classes[] = 'category-paged-' . $page; } elseif ( is_tag() ) { $classes[] = 'tag-paged-' . $page; } elseif ( is_date() ) { $classes[] = 'date-paged-' . $page; } elseif ( is_author() ) { $classes[] = 'author-paged-' . $page; } elseif ( is_search() ) { $classes[] = 'search-paged-' . $page; } elseif ( is_post_type_archive() ) { $classes[] = 'post-type-paged-' . $page; } } if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { $class = array(); } $classes = array_map( 'esc_attr', $classes ); $classes = apply_filters( 'body_class', $classes, $class ); return array_unique( $classes ); } function post_password_required( $post = null ) { $post = get_post( $post ); if ( empty( $post->post_password ) ) { return apply_filters( 'post_password_required', false, $post ); } if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) { return apply_filters( 'post_password_required', true, $post ); } require_once ABSPATH . WPINC . '/class-phpass.php'; $hasher = new PasswordHash( 8, true ); $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ); if ( 0 !== strpos( $hash, '$P$B' ) ) { $required = true; } else { $required = ! $hasher->CheckPassword( $post->post_password, $hash ); } return apply_filters( 'post_password_required', $required, $post ); } function wp_link_pages( $args = '' ) { global $page, $numpages, $multipage, $more; $defaults = array( 'before' => '

                ' . __( 'Pages:' ), 'after' => '

                ', 'link_before' => '', 'link_after' => '', 'aria_current' => 'page', 'next_or_number' => 'number', 'separator' => ' ', 'nextpagelink' => __( 'Next page' ), 'previouspagelink' => __( 'Previous page' ), 'pagelink' => '%', 'echo' => 1, ); $parsed_args = wp_parse_args( $args, $defaults ); $parsed_args = apply_filters( 'wp_link_pages_args', $parsed_args ); $output = ''; if ( $multipage ) { if ( 'number' === $parsed_args['next_or_number'] ) { $output .= $parsed_args['before']; for ( $i = 1; $i <= $numpages; $i++ ) { $link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after']; if ( $i != $page || ! $more && 1 == $page ) { $link = _wp_link_page( $i ) . $link . ''; } elseif ( $i === $page ) { $link = '' . $link . ''; } $link = apply_filters( 'wp_link_pages_link', $link, $i ); $output .= ( 1 === $i ) ? ' ' : $parsed_args['separator']; $output .= $link; } $output .= $parsed_args['after']; } elseif ( $more ) { $output .= $parsed_args['before']; $prev = $page - 1; if ( $prev > 0 ) { $link = _wp_link_page( $prev ) . $parsed_args['link_before'] . $parsed_args['previouspagelink'] . $parsed_args['link_after'] . ''; $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); } $next = $page + 1; if ( $next <= $numpages ) { if ( $prev ) { $output .= $parsed_args['separator']; } $link = _wp_link_page( $next ) . $parsed_args['link_before'] . $parsed_args['nextpagelink'] . $parsed_args['link_after'] . ''; $output .= apply_filters( 'wp_link_pages_link', $link, $next ); } $output .= $parsed_args['after']; } } $html = apply_filters( 'wp_link_pages', $output, $args ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function _wp_link_page( $i ) { global $wp_rewrite; $post = get_post(); $query_args = array(); if ( 1 == $i ) { $url = get_permalink(); } else { if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) { $url = add_query_arg( 'page', $i, get_permalink() ); } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' ); } else { $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' ); } } if ( is_preview() ) { if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) { $query_args['preview_id'] = wp_unslash( $_GET['preview_id'] ); $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] ); } $url = get_preview_post_link( $post, $query_args, $url ); } return ''; } function post_custom( $key = '' ) { $custom = get_post_custom(); if ( ! isset( $custom[ $key ] ) ) { return false; } elseif ( 1 === count( $custom[ $key ] ) ) { return $custom[ $key ][0]; } else { return $custom[ $key ]; } } function the_meta() { $keys = get_post_custom_keys(); if ( $keys ) { $li_html = ''; foreach ( (array) $keys as $key ) { $keyt = trim( $key ); if ( is_protected_meta( $keyt, 'post' ) ) { continue; } $values = array_map( 'trim', get_post_custom_values( $key ) ); $value = implode( ', ', $values ); $html = sprintf( "
              • %s
              • \n", sprintf( _x( '%s:', 'Post custom field name' ), $key ), $value ); $li_html .= apply_filters( 'the_meta_key', $html, $key, $value ); } if ( $li_html ) { echo "\n"; } } } function wp_dropdown_pages( $args = '' ) { $defaults = array( 'depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', 'value_field' => 'ID', ); $parsed_args = wp_parse_args( $args, $defaults ); $pages = get_pages( $parsed_args ); $output = ''; if ( empty( $parsed_args['id'] ) ) { $parsed_args['id'] = $parsed_args['name']; } if ( ! empty( $pages ) ) { $class = ''; if ( ! empty( $parsed_args['class'] ) ) { $class = " class='" . esc_attr( $parsed_args['class'] ) . "'"; } $output = "\n"; } $html = apply_filters( 'wp_dropdown_pages', $output, $parsed_args, $pages ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function wp_list_pages( $args = '' ) { $defaults = array( 'depth' => 0, 'show_date' => '', 'date_format' => get_option( 'date_format' ), 'child_of' => 0, 'exclude' => '', 'title_li' => __( 'Pages' ), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '', 'item_spacing' => 'preserve', 'walker' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); if ( ! in_array( $parsed_args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $parsed_args['item_spacing'] = $defaults['item_spacing']; } $output = ''; $current_page = 0; $parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] ); $exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array(); $parsed_args['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) ); $parsed_args['hierarchical'] = 0; $pages = get_pages( $parsed_args ); if ( ! empty( $pages ) ) { if ( $parsed_args['title_li'] ) { $output .= ''; } } $html = apply_filters( 'wp_list_pages', $output, $parsed_args, $pages ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } function wp_page_menu( $args = array() ) { $defaults = array( 'sort_column' => 'menu_order, post_title', 'menu_id' => '', 'menu_class' => 'menu', 'container' => 'div', 'echo' => true, 'link_before' => '', 'link_after' => '', 'before' => '
                  ', 'after' => '
                ', 'item_spacing' => 'discard', 'walker' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $args['item_spacing'] = $defaults['item_spacing']; } if ( 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $args = apply_filters( 'wp_page_menu_args', $args ); $menu = ''; $list_args = $args; if ( ! empty( $args['show_home'] ) ) { if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) { $text = __( 'Home' ); } else { $text = $args['show_home']; } $class = ''; if ( is_front_page() && ! is_paged() ) { $class = 'class="current_page_item"'; } $menu .= '
              • ' . $args['link_before'] . $text . $args['link_after'] . '
              • '; if ( 'page' === get_option( 'show_on_front' ) ) { if ( ! empty( $list_args['exclude'] ) ) { $list_args['exclude'] .= ','; } else { $list_args['exclude'] = ''; } $list_args['exclude'] .= get_option( 'page_on_front' ); } } $list_args['echo'] = false; $list_args['title_li'] = ''; $menu .= wp_list_pages( $list_args ); $container = sanitize_text_field( $args['container'] ); if ( empty( $container ) ) { $container = 'div'; } if ( $menu ) { if ( isset( $args['fallback_cb'] ) && 'wp_page_menu' === $args['fallback_cb'] && 'ul' !== $container ) { $args['before'] = "
                  {$n}"; $args['after'] = '
                '; } $menu = $args['before'] . $menu . $args['after']; } $attrs = ''; if ( ! empty( $args['menu_id'] ) ) { $attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"'; } if ( ! empty( $args['menu_class'] ) ) { $attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"'; } $menu = "<{$container}{$attrs}>" . $menu . "{$n}"; $menu = apply_filters( 'wp_page_menu', $menu, $args ); if ( $args['echo'] ) { echo $menu; } else { return $menu; } } function walk_page_tree( $pages, $depth, $current_page, $args ) { if ( empty( $args['walker'] ) ) { $walker = new Walker_Page; } else { $walker = $args['walker']; } foreach ( (array) $pages as $page ) { if ( $page->post_parent ) { $args['pages_with_children'][ $page->post_parent ] = true; } } return $walker->walk( $pages, $depth, $args, $current_page ); } function walk_page_dropdown_tree( ...$args ) { if ( empty( $args[2]['walker'] ) ) { $walker = new Walker_PageDropdown; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.5.0' ); } if ( $fullsize ) { echo wp_get_attachment_link( $id, 'full', $permalink ); } else { echo wp_get_attachment_link( $id, 'thumbnail', $permalink ); } } function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { $_post = get_post( $id ); if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { return __( 'Missing Attachment' ); } $url = wp_get_attachment_url( $_post->ID ); if ( $permalink ) { $url = get_attachment_link( $_post->ID ); } if ( $text ) { $link_text = $text; } elseif ( $size && 'none' !== $size ) { $link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); } else { $link_text = ''; } if ( '' === trim( $link_text ) ) { $link_text = $_post->post_title; } if ( '' === trim( $link_text ) ) { $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) ); } return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text, $attr ); } function prepend_attachment( $content ) { $post = get_post(); if ( empty( $post->post_type ) || 'attachment' !== $post->post_type ) { return $content; } if ( wp_attachment_is( 'video', $post ) ) { $meta = wp_get_attachment_metadata( get_the_ID() ); $atts = array( 'src' => wp_get_attachment_url() ); if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { $atts['width'] = (int) $meta['width']; $atts['height'] = (int) $meta['height']; } if ( has_post_thumbnail() ) { $atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() ); } $p = wp_video_shortcode( $atts ); } elseif ( wp_attachment_is( 'audio', $post ) ) { $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) ); } else { $p = '

                '; $p .= wp_get_attachment_link( 0, 'medium', false ); $p .= '

                '; } $p = apply_filters( 'prepend_attachment', $p ); return "$p\n$content"; } function get_the_password_form( $post = 0 ) { $post = get_post( $post ); $label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID ); $output = '
                -

                ' . __( 'This content is password protected. To view it please enter your password below:' ) . '

                -

                - '; return apply_filters( 'the_password_form', $output, $post ); } function is_page_template( $template = '' ) { if ( ! is_singular() ) { return false; } $page_template = get_page_template_slug( get_queried_object_id() ); if ( empty( $template ) ) { return (bool) $page_template; } if ( $template == $page_template ) { return true; } if ( is_array( $template ) ) { if ( ( in_array( 'default', $template, true ) && ! $page_template ) || in_array( $page_template, $template, true ) ) { return true; } } return ( 'default' === $template && ! $page_template ); } function get_page_template_slug( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( ! $template || 'default' === $template ) { return ''; } return $template; } function wp_post_revision_title( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); $autosavef = __( '%s [Autosave]' ); $currentf = __( '%s [Current Revision]' ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); $edit_link = get_edit_post_link( $revision->ID ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) { $date = "$date"; } if ( ! wp_is_post_revision( $revision ) ) { $date = sprintf( $currentf, $date ); } elseif ( wp_is_post_autosave( $revision ) ) { $date = sprintf( $autosavef, $date ); } return $date; } function wp_post_revision_title_expanded( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } $author = get_the_author_meta( 'display_name', $revision->post_author ); $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); $gravatar = get_avatar( $revision->post_author, 24 ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); $edit_link = get_edit_post_link( $revision->ID ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) { $date = "$date"; } $revision_date_author = sprintf( __( '%1$s %2$s, %3$s ago (%4$s)' ), $gravatar, $author, human_time_diff( strtotime( $revision->post_modified_gmt ) ), $date ); $autosavef = __( '%s [Autosave]' ); $currentf = __( '%s [Current Revision]' ); if ( ! wp_is_post_revision( $revision ) ) { $revision_date_author = sprintf( $currentf, $revision_date_author ); } elseif ( wp_is_post_autosave( $revision ) ) { $revision_date_author = sprintf( $autosavef, $revision_date_author ); } return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link ); } function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { $post = get_post( $post_id ); if ( ! $post ) { return; } if ( is_array( $type ) ) { $type = ! empty( $type['type'] ) ? $type['type'] : $type; _deprecated_argument( __FUNCTION__, '3.6.0' ); } $revisions = wp_get_post_revisions( $post->ID ); if ( ! $revisions ) { return; } $rows = ''; foreach ( $revisions as $revision ) { if ( ! current_user_can( 'read_post', $revision->ID ) ) { continue; } $is_autosave = wp_is_post_autosave( $revision ); if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) { continue; } $rows .= "\t
              • " . wp_post_revision_title_expanded( $revision ) . "
              • \n"; } echo "

                " . __( 'JavaScript must be enabled to use this feature.' ) . "

                \n"; echo "
                  \n"; echo $rows; echo '
                '; } function get_post_parent( $post = null ) { $wp_post = get_post( $post ); return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null; } function has_post_parent( $post = null ) { return (bool) get_post_parent( $post ); } original_stylesheet = get_stylesheet(); $this->theme = wp_get_theme( 0 === validate_file( $args['theme'] ) ? $args['theme'] : null ); $this->messenger_channel = $args['messenger_channel']; $this->_changeset_uuid = $args['changeset_uuid']; foreach ( array( 'settings_previewed', 'autosaved', 'branching' ) as $key ) { if ( isset( $args[ $key ] ) ) { $this->$key = (bool) $args[ $key ]; } } require_once ABSPATH . WPINC . '/class-wp-customize-setting.php'; require_once ABSPATH . WPINC . '/class-wp-customize-panel.php'; require_once ABSPATH . WPINC . '/class-wp-customize-section.php'; require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-code-editor-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-themes-panel.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php'; require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php'; $components = apply_filters( 'customize_loaded_components', $this->components, $this ); require_once ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php'; $this->selective_refresh = new WP_Customize_Selective_Refresh( $this ); if ( in_array( 'widgets', $components, true ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-widgets.php'; $this->widgets = new WP_Customize_Widgets( $this ); } if ( in_array( 'nav_menus', $components, true ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-nav-menus.php'; $this->nav_menus = new WP_Customize_Nav_Menus( $this ); } add_action( 'setup_theme', array( $this, 'setup_theme' ) ); add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); remove_action( 'init', 'wp_cron' ); remove_action( 'admin_init', '_maybe_update_core' ); remove_action( 'admin_init', '_maybe_update_plugins' ); remove_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_ajax_customize_save', array( $this, 'save' ) ); add_action( 'wp_ajax_customize_trash', array( $this, 'handle_changeset_trash_request' ) ); add_action( 'wp_ajax_customize_refresh_nonces', array( $this, 'refresh_nonces' ) ); add_action( 'wp_ajax_customize_load_themes', array( $this, 'handle_load_themes_request' ) ); add_filter( 'heartbeat_settings', array( $this, 'add_customize_screen_to_heartbeat_settings' ) ); add_filter( 'heartbeat_received', array( $this, 'check_changeset_lock_with_heartbeat' ), 10, 3 ); add_action( 'wp_ajax_customize_override_changeset_lock', array( $this, 'handle_override_changeset_lock_request' ) ); add_action( 'wp_ajax_customize_dismiss_autosave_or_lock', array( $this, 'handle_dismiss_autosave_or_lock_request' ) ); add_action( 'customize_register', array( $this, 'register_controls' ) ); add_action( 'customize_register', array( $this, 'register_dynamic_settings' ), 11 ); add_action( 'customize_controls_init', array( $this, 'prepare_controls' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_panel_templates' ), 1 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_section_templates' ), 1 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_control_templates' ), 1 ); add_filter( 'customize_render_partials_response', array( $this, 'export_header_video_settings' ), 10, 3 ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 ); if ( current_user_can( 'install_themes' ) || current_user_can( 'update_themes' ) ) { require_once ABSPATH . 'wp-admin/includes/update.php'; add_action( 'customize_controls_print_footer_scripts', 'wp_print_admin_notice_templates' ); } } public function doing_ajax( $action = null ) { if ( ! wp_doing_ajax() ) { return false; } if ( ! $action ) { return true; } else { return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action; } } protected function wp_die( $ajax_message, $message = null ) { if ( $this->doing_ajax() ) { wp_die( $ajax_message ); } if ( ! $message ) { $message = __( 'Something went wrong.' ); } if ( $this->messenger_channel ) { ob_start(); wp_enqueue_scripts(); wp_print_scripts( array( 'customize-base' ) ); $settings = array( 'messengerArgs' => array( 'channel' => $this->messenger_channel, 'url' => wp_customize_url(), ), 'error' => $ajax_message, ); ?> - - doing_ajax() || isset( $_POST['customized'] ) ) { return '_ajax_wp_die_handler'; } return '_default_wp_die_handler'; } public function setup_theme() { global $pagenow; if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) { if ( ! is_user_logged_in() ) { auth_redirect(); } else { wp_die( '

                ' . __( 'You need a higher level of permission.' ) . '

                ' . '

                ' . __( 'Sorry, you are not allowed to customize this site.' ) . '

                ', 403 ); } return; } if ( isset( $this->_changeset_uuid ) && false !== $this->_changeset_uuid && ! wp_is_uuid( $this->_changeset_uuid ) ) { $this->wp_die( -1, __( 'Invalid changeset UUID' ) ); } $has_post_data_nonce = ( check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false ) || check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce', false ) || check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'customize_preview_nonce', false ) ); if ( ! current_user_can( 'customize' ) || ! $has_post_data_nonce ) { unset( $_POST['customized'] ); unset( $_REQUEST['customized'] ); } if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) { $this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) ); } if ( ! headers_sent() ) { send_origin_headers(); } if ( $this->messenger_channel ) { show_admin_bar( false ); } if ( $this->is_theme_active() ) { add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) ); } else { if ( ! current_user_can( 'switch_themes' ) ) { $this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) ); } if ( $this->theme()->errors() ) { $this->wp_die( -1, $this->theme()->errors()->get_error_message() ); } if ( ! $this->theme()->is_allowed() ) { $this->wp_die( -1, __( 'The requested theme does not exist.' ) ); } } add_action( 'after_setup_theme', array( $this, 'establish_loaded_changeset' ), 5 ); if ( get_option( 'fresh_site' ) && 'customize.php' === $pagenow ) { add_action( 'after_setup_theme', array( $this, 'import_theme_starter_content' ), 100 ); } $this->start_previewing_theme(); } public function establish_loaded_changeset() { global $pagenow; if ( empty( $this->_changeset_uuid ) ) { $changeset_uuid = null; if ( ! $this->branching() && $this->is_theme_active() ) { $unpublished_changeset_posts = $this->get_changeset_posts( array( 'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ), 'exclude_restore_dismissed' => false, 'author' => 'any', 'posts_per_page' => 1, 'order' => 'DESC', 'orderby' => 'date', ) ); $unpublished_changeset_post = array_shift( $unpublished_changeset_posts ); if ( ! empty( $unpublished_changeset_post ) && wp_is_uuid( $unpublished_changeset_post->post_name ) ) { $changeset_uuid = $unpublished_changeset_post->post_name; } } if ( empty( $changeset_uuid ) ) { $changeset_uuid = wp_generate_uuid4(); } $this->_changeset_uuid = $changeset_uuid; } if ( is_admin() && 'customize.php' === $pagenow ) { $this->set_changeset_lock( $this->changeset_post_id() ); } } public function after_setup_theme() { $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) ); if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) { wp_redirect( 'themes.php?broken=true' ); exit; } } public function start_previewing_theme() { if ( $this->is_preview() ) { return; } $this->previewing = true; if ( ! $this->is_theme_active() ) { add_filter( 'template', array( $this, 'get_template' ) ); add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) ); add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) ); add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) ); add_filter( 'pre_option_template', array( $this, 'get_template' ) ); add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) ); add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) ); } do_action( 'start_previewing_theme', $this ); } public function stop_previewing_theme() { if ( ! $this->is_preview() ) { return; } $this->previewing = false; if ( ! $this->is_theme_active() ) { remove_filter( 'template', array( $this, 'get_template' ) ); remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) ); remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) ); remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) ); remove_filter( 'pre_option_template', array( $this, 'get_template' ) ); remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) ); remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) ); } do_action( 'stop_previewing_theme', $this ); } public function settings_previewed() { return $this->settings_previewed; } public function autosaved() { return $this->autosaved; } public function branching() { $this->branching = apply_filters( 'customize_changeset_branching', $this->branching, $this ); return $this->branching; } public function changeset_uuid() { if ( empty( $this->_changeset_uuid ) ) { $this->establish_loaded_changeset(); } return $this->_changeset_uuid; } public function theme() { if ( ! $this->theme ) { $this->theme = wp_get_theme(); } return $this->theme; } public function settings() { return $this->settings; } public function controls() { return $this->controls; } public function containers() { return $this->containers; } public function sections() { return $this->sections; } public function panels() { return $this->panels; } public function is_theme_active() { return $this->get_stylesheet() === $this->original_stylesheet; } public function wp_loaded() { $this->register_panel_type( 'WP_Customize_Panel' ); $this->register_panel_type( 'WP_Customize_Themes_Panel' ); $this->register_section_type( 'WP_Customize_Section' ); $this->register_section_type( 'WP_Customize_Sidebar_Section' ); $this->register_section_type( 'WP_Customize_Themes_Section' ); $this->register_control_type( 'WP_Customize_Color_Control' ); $this->register_control_type( 'WP_Customize_Media_Control' ); $this->register_control_type( 'WP_Customize_Upload_Control' ); $this->register_control_type( 'WP_Customize_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Position_Control' ); $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); $this->register_control_type( 'WP_Customize_Theme_Control' ); $this->register_control_type( 'WP_Customize_Code_Editor_Control' ); $this->register_control_type( 'WP_Customize_Date_Time_Control' ); do_action( 'customize_register', $this ); if ( $this->settings_previewed() ) { foreach ( $this->settings as $setting ) { $setting->preview(); } } if ( $this->is_preview() && ! is_admin() ) { $this->customize_preview_init(); } } public function wp_redirect_status( $status ) { _deprecated_function( __FUNCTION__, '4.7.0' ); if ( $this->is_preview() && ! is_admin() ) { return 200; } return $status; } public function find_changeset_post_id( $uuid ) { $cache_group = 'customize_changeset_post'; $changeset_post_id = wp_cache_get( $uuid, $cache_group ); if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) { return $changeset_post_id; } $changeset_post_query = new WP_Query( array( 'post_type' => 'customize_changeset', 'post_status' => get_post_stati(), 'name' => $uuid, 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ) ); if ( ! empty( $changeset_post_query->posts ) ) { $changeset_post_id = $changeset_post_query->posts[0]->ID; wp_cache_set( $uuid, $changeset_post_id, $cache_group ); return $changeset_post_id; } return null; } protected function get_changeset_posts( $args = array() ) { $default_args = array( 'exclude_restore_dismissed' => true, 'posts_per_page' => -1, 'post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'order' => 'DESC', 'orderby' => 'date', 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ); if ( get_current_user_id() ) { $default_args['author'] = get_current_user_id(); } $args = array_merge( $default_args, $args ); if ( ! empty( $args['exclude_restore_dismissed'] ) ) { unset( $args['exclude_restore_dismissed'] ); $args['meta_query'] = array( array( 'key' => '_customize_restore_dismissed', 'compare' => 'NOT EXISTS', ), ); } return get_posts( $args ); } protected function dismiss_user_auto_draft_changesets() { $changeset_autodraft_posts = $this->get_changeset_posts( array( 'post_status' => 'auto-draft', 'exclude_restore_dismissed' => true, 'posts_per_page' => -1, ) ); $dismissed = 0; foreach ( $changeset_autodraft_posts as $autosave_autodraft_post ) { if ( $autosave_autodraft_post->ID === $this->changeset_post_id() ) { continue; } if ( update_post_meta( $autosave_autodraft_post->ID, '_customize_restore_dismissed', true ) ) { $dismissed++; } } return $dismissed; } public function changeset_post_id() { if ( ! isset( $this->_changeset_post_id ) ) { $post_id = $this->find_changeset_post_id( $this->changeset_uuid() ); if ( ! $post_id ) { $post_id = false; } $this->_changeset_post_id = $post_id; } if ( false === $this->_changeset_post_id ) { return null; } return $this->_changeset_post_id; } protected function get_changeset_post_data( $post_id ) { if ( ! $post_id ) { return new WP_Error( 'empty_post_id' ); } $changeset_post = get_post( $post_id ); if ( ! $changeset_post ) { return new WP_Error( 'missing_post' ); } if ( 'revision' === $changeset_post->post_type ) { if ( 'customize_changeset' !== get_post_type( $changeset_post->post_parent ) ) { return new WP_Error( 'wrong_post_type' ); } } elseif ( 'customize_changeset' !== $changeset_post->post_type ) { return new WP_Error( 'wrong_post_type' ); } $changeset_data = json_decode( $changeset_post->post_content, true ); $last_error = json_last_error(); if ( $last_error ) { return new WP_Error( 'json_parse_error', '', $last_error ); } if ( ! is_array( $changeset_data ) ) { return new WP_Error( 'expected_array' ); } return $changeset_data; } public function changeset_data() { if ( isset( $this->_changeset_data ) ) { return $this->_changeset_data; } $changeset_post_id = $this->changeset_post_id(); if ( ! $changeset_post_id ) { $this->_changeset_data = array(); } else { if ( $this->autosaved() && is_user_logged_in() ) { $autosave_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); if ( $autosave_post ) { $data = $this->get_changeset_post_data( $autosave_post->ID ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } } } if ( ! isset( $this->_changeset_data ) ) { $data = $this->get_changeset_post_data( $changeset_post_id ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } else { $this->_changeset_data = array(); } } } return $this->_changeset_data; } protected $pending_starter_content_settings_ids = array(); public function import_theme_starter_content( $starter_content = array() ) { if ( empty( $starter_content ) ) { $starter_content = get_theme_starter_content(); } $changeset_data = array(); if ( $this->changeset_post_id() ) { if ( 'auto-draft' !== get_post_status( $this->changeset_post_id() ) ) { return; } $changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() ); } $sidebars_widgets = isset( $starter_content['widgets'] ) && ! empty( $this->widgets ) ? $starter_content['widgets'] : array(); $attachments = isset( $starter_content['attachments'] ) && ! empty( $this->nav_menus ) ? $starter_content['attachments'] : array(); $posts = isset( $starter_content['posts'] ) && ! empty( $this->nav_menus ) ? $starter_content['posts'] : array(); $options = isset( $starter_content['options'] ) ? $starter_content['options'] : array(); $nav_menus = isset( $starter_content['nav_menus'] ) && ! empty( $this->nav_menus ) ? $starter_content['nav_menus'] : array(); $theme_mods = isset( $starter_content['theme_mods'] ) ? $starter_content['theme_mods'] : array(); $max_widget_numbers = array(); foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { $sidebar_widget_ids = array(); foreach ( $widgets as $widget ) { list( $id_base, $instance ) = $widget; if ( ! isset( $max_widget_numbers[ $id_base ] ) ) { $settings = get_option( "widget_{$id_base}", array() ); if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) { $settings = $settings->getArrayCopy(); } unset( $settings['_multiwidget'] ); $widget_numbers = array_keys( $settings ); if ( count( $widget_numbers ) > 0 ) { $widget_numbers[] = 1; $max_widget_numbers[ $id_base ] = max( ...$widget_numbers ); } else { $max_widget_numbers[ $id_base ] = 1; } } $max_widget_numbers[ $id_base ] += 1; $widget_id = sprintf( '%s-%d', $id_base, $max_widget_numbers[ $id_base ] ); $setting_id = sprintf( 'widget_%s[%d]', $id_base, $max_widget_numbers[ $id_base ] ); $setting_value = $this->widgets->sanitize_widget_js_instance( $instance ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $setting_value ); $this->pending_starter_content_settings_ids[] = $setting_id; } $sidebar_widget_ids[] = $widget_id; } $setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $sidebar_widget_ids ); $this->pending_starter_content_settings_ids[] = $setting_id; } } $starter_content_auto_draft_post_ids = array(); if ( ! empty( $changeset_data['nav_menus_created_posts']['value'] ) ) { $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value'] ); } $needed_posts = array(); $attachments = $this->prepare_starter_content_attachments( $attachments ); foreach ( $attachments as $attachment ) { $key = 'attachment:' . $attachment['post_name']; $needed_posts[ $key ] = true; } foreach ( array_keys( $posts ) as $post_symbol ) { if ( empty( $posts[ $post_symbol ]['post_name'] ) && empty( $posts[ $post_symbol ]['post_title'] ) ) { unset( $posts[ $post_symbol ] ); continue; } if ( empty( $posts[ $post_symbol ]['post_name'] ) ) { $posts[ $post_symbol ]['post_name'] = sanitize_title( $posts[ $post_symbol ]['post_title'] ); } if ( empty( $posts[ $post_symbol ]['post_type'] ) ) { $posts[ $post_symbol ]['post_type'] = 'post'; } $needed_posts[ $posts[ $post_symbol ]['post_type'] . ':' . $posts[ $post_symbol ]['post_name'] ] = true; } $all_post_slugs = array_merge( wp_list_pluck( $attachments, 'post_name' ), wp_list_pluck( $posts, 'post_name' ) ); $post_types = array_filter( array_merge( array( 'attachment' ), wp_list_pluck( $posts, 'post_type' ) ) ); $existing_starter_content_posts = array(); if ( ! empty( $starter_content_auto_draft_post_ids ) ) { $existing_posts_query = new WP_Query( array( 'post__in' => $starter_content_auto_draft_post_ids, 'post_status' => 'auto-draft', 'post_type' => $post_types, 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $post_name = $existing_post->post_name; if ( empty( $post_name ) ) { $post_name = get_post_meta( $existing_post->ID, '_customize_draft_post_name', true ); } $existing_starter_content_posts[ $existing_post->post_type . ':' . $post_name ] = $existing_post; } } if ( ! empty( $all_post_slugs ) ) { $existing_posts_query = new WP_Query( array( 'post_name__in' => $all_post_slugs, 'post_status' => array_diff( get_post_stati(), array( 'auto-draft' ) ), 'post_type' => 'any', 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $key = $existing_post->post_type . ':' . $existing_post->post_name; if ( isset( $needed_posts[ $key ] ) && ! isset( $existing_starter_content_posts[ $key ] ) ) { $existing_starter_content_posts[ $key ] = $existing_post; } } } if ( ! empty( $attachments ) ) { $attachment_ids = array(); foreach ( $attachments as $symbol => $attachment ) { $file_array = array( 'name' => $attachment['file_name'], ); $file_path = $attachment['file_path']; $attachment_id = null; $attached_file = null; if ( isset( $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ] ) ) { $attachment_post = $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ]; $attachment_id = $attachment_post->ID; $attached_file = get_attached_file( $attachment_id ); if ( empty( $attached_file ) || ! file_exists( $attached_file ) ) { $attachment_id = null; $attached_file = null; } elseif ( $this->get_stylesheet() !== get_post_meta( $attachment_post->ID, '_starter_content_theme', true ) ) { $metadata = wp_generate_attachment_metadata( $attachment_post->ID, $attached_file ); wp_update_attachment_metadata( $attachment_id, $metadata ); update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() ); } } if ( ! $attachment_id ) { $temp_file_name = wp_tempnam( wp_basename( $file_path ) ); if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) { $file_array['tmp_name'] = $temp_file_name; } if ( empty( $file_array['tmp_name'] ) ) { continue; } $attachment_post_data = array_merge( wp_array_slice_assoc( $attachment, array( 'post_title', 'post_content', 'post_excerpt' ) ), array( 'post_status' => 'auto-draft', ) ); $attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data ); if ( is_wp_error( $attachment_id ) ) { continue; } update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() ); update_post_meta( $attachment_id, '_customize_draft_post_name', $attachment['post_name'] ); } $attachment_ids[ $symbol ] = $attachment_id; } $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, array_values( $attachment_ids ) ); } if ( ! empty( $posts ) ) { foreach ( array_keys( $posts ) as $post_symbol ) { if ( empty( $posts[ $post_symbol ]['post_type'] ) || empty( $posts[ $post_symbol ]['post_name'] ) ) { continue; } $post_type = $posts[ $post_symbol ]['post_type']; if ( ! empty( $posts[ $post_symbol ]['post_name'] ) ) { $post_name = $posts[ $post_symbol ]['post_name']; } elseif ( ! empty( $posts[ $post_symbol ]['post_title'] ) ) { $post_name = sanitize_title( $posts[ $post_symbol ]['post_title'] ); } else { continue; } if ( isset( $existing_starter_content_posts[ $post_type . ':' . $post_name ] ) ) { $posts[ $post_symbol ]['ID'] = $existing_starter_content_posts[ $post_type . ':' . $post_name ]->ID; continue; } if ( ! empty( $posts[ $post_symbol ]['thumbnail'] ) && preg_match( '/^{{(?P.+)}}$/', $posts[ $post_symbol ]['thumbnail'], $matches ) && isset( $attachment_ids[ $matches['symbol'] ] ) ) { $posts[ $post_symbol ]['meta_input']['_thumbnail_id'] = $attachment_ids[ $matches['symbol'] ]; } if ( ! empty( $posts[ $post_symbol ]['template'] ) ) { $posts[ $post_symbol ]['meta_input']['_wp_page_template'] = $posts[ $post_symbol ]['template']; } $r = $this->nav_menus->insert_auto_draft_post( $posts[ $post_symbol ] ); if ( $r instanceof WP_Post ) { $posts[ $post_symbol ]['ID'] = $r->ID; } } $starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, wp_list_pluck( $posts, 'ID' ) ); } if ( ! empty( $this->nav_menus ) && ! empty( $starter_content_auto_draft_post_ids ) ) { $setting_id = 'nav_menus_created_posts'; $this->set_post_value( $setting_id, array_unique( array_values( $starter_content_auto_draft_post_ids ) ) ); $this->pending_starter_content_settings_ids[] = $setting_id; } $placeholder_id = -1; $reused_nav_menu_setting_ids = array(); foreach ( $nav_menus as $nav_menu_location => $nav_menu ) { $nav_menu_term_id = null; $nav_menu_setting_id = null; $matches = array(); foreach ( $changeset_data as $setting_id => $setting_params ) { $can_reuse = ( ! empty( $setting_params['starter_content'] ) && ! in_array( $setting_id, $reused_nav_menu_setting_ids, true ) && preg_match( '#^nav_menu\[(?P-?\d+)\]$#', $setting_id, $matches ) ); if ( $can_reuse ) { $nav_menu_term_id = (int) $matches['nav_menu_id']; $nav_menu_setting_id = $setting_id; $reused_nav_menu_setting_ids[] = $setting_id; break; } } if ( ! $nav_menu_term_id ) { while ( isset( $changeset_data[ sprintf( 'nav_menu[%d]', $placeholder_id ) ] ) ) { $placeholder_id--; } $nav_menu_term_id = $placeholder_id; $nav_menu_setting_id = sprintf( 'nav_menu[%d]', $placeholder_id ); } $this->set_post_value( $nav_menu_setting_id, array( 'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location, ) ); $this->pending_starter_content_settings_ids[] = $nav_menu_setting_id; $position = 0; foreach ( $nav_menu['items'] as $nav_menu_item ) { $nav_menu_item_setting_id = sprintf( 'nav_menu_item[%d]', $placeholder_id-- ); if ( ! isset( $nav_menu_item['position'] ) ) { $nav_menu_item['position'] = $position++; } $nav_menu_item['nav_menu_term_id'] = $nav_menu_term_id; if ( isset( $nav_menu_item['object_id'] ) ) { if ( 'post_type' === $nav_menu_item['type'] && preg_match( '/^{{(?P.+)}}$/', $nav_menu_item['object_id'], $matches ) && isset( $posts[ $matches['symbol'] ] ) ) { $nav_menu_item['object_id'] = $posts[ $matches['symbol'] ]['ID']; if ( empty( $nav_menu_item['title'] ) ) { $original_object = get_post( $nav_menu_item['object_id'] ); $nav_menu_item['title'] = $original_object->post_title; } } else { continue; } } else { $nav_menu_item['object_id'] = 0; } if ( empty( $changeset_data[ $nav_menu_item_setting_id ] ) || ! empty( $changeset_data[ $nav_menu_item_setting_id ]['starter_content'] ) ) { $this->set_post_value( $nav_menu_item_setting_id, $nav_menu_item ); $this->pending_starter_content_settings_ids[] = $nav_menu_item_setting_id; } } $setting_id = sprintf( 'nav_menu_locations[%s]', $nav_menu_location ); if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) { $this->set_post_value( $setting_id, $nav_menu_term_id ); $this->pending_starter_content_settings_ids[] = $setting_id; } } foreach ( $options as $name => $value ) { $value = maybe_serialize( $value ); if ( is_serialized( $value ) ) { if ( preg_match( '/s:\d+:"{{(?P.+)}}"/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $symbol_match = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $symbol_match = $attachment_ids[ $matches['symbol'] ]; } if ( isset( $symbol_match ) ) { $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); } else { continue; } } } elseif ( preg_match( '/^{{(?P.+)}}$/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $value = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $value = $attachment_ids[ $matches['symbol'] ]; } else { continue; } } $value = maybe_unserialize( $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; } } foreach ( $theme_mods as $name => $value ) { $value = maybe_serialize( $value ); if ( is_serialized( $value ) ) { if ( preg_match( '/s:\d+:"{{(?P.+)}}"/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $symbol_match = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $symbol_match = $attachment_ids[ $matches['symbol'] ]; } if ( isset( $symbol_match ) ) { $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); } else { continue; } } } elseif ( preg_match( '/^{{(?P.+)}}$/', $value, $matches ) ) { if ( isset( $posts[ $matches['symbol'] ] ) ) { $value = $posts[ $matches['symbol'] ]['ID']; } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { $value = $attachment_ids[ $matches['symbol'] ]; } else { continue; } } $value = maybe_unserialize( $value ); if ( 'header_image' === $name ) { $name = 'header_image_data'; $metadata = wp_get_attachment_metadata( $value ); if ( empty( $metadata ) ) { continue; } $value = array( 'attachment_id' => $value, 'url' => wp_get_attachment_url( $value ), 'height' => $metadata['height'], 'width' => $metadata['width'], ); } 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 ); } } } protected function prepare_starter_content_attachments( $attachments ) { $prepared_attachments = array(); if ( empty( $attachments ) ) { return $prepared_attachments; } require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; foreach ( $attachments as $symbol => $attachment ) { if ( empty( $attachment['file'] ) || preg_match( '#^https?://$#', $attachment['file'] ) ) { continue; } $file_path = null; if ( file_exists( $attachment['file'] ) ) { $file_path = $attachment['file']; } elseif ( is_child_theme() && file_exists( get_stylesheet_directory() . '/' . $attachment['file'] ) ) { $file_path = get_stylesheet_directory() . '/' . $attachment['file']; } elseif ( file_exists( get_template_directory() . '/' . $attachment['file'] ) ) { $file_path = get_template_directory() . '/' . $attachment['file']; } else { continue; } $file_name = wp_basename( $attachment['file'] ); $checked_filetype = wp_check_filetype( $file_name ); if ( empty( $checked_filetype['type'] ) ) { continue; } if ( empty( $attachment['post_name'] ) ) { if ( ! empty( $attachment['post_title'] ) ) { $attachment['post_name'] = sanitize_title( $attachment['post_title'] ); } else { $attachment['post_name'] = sanitize_title( preg_replace( '/\.\w+$/', '', $file_name ) ); } } $attachment['file_name'] = $file_name; $attachment['file_path'] = $file_path; $prepared_attachments[ $symbol ] = $attachment; } return $prepared_attachments; } public function _save_starter_content_changeset() { if ( empty( $this->pending_starter_content_settings_ids ) ) { return; } $this->save_changeset_post( array( 'data' => array_fill_keys( $this->pending_starter_content_settings_ids, array( 'starter_content' => true ) ), 'starter_content' => true, ) ); $this->saved_starter_content_changeset = true; $this->pending_starter_content_settings_ids = array(); } public function unsanitized_post_values( $args = array() ) { $args = array_merge( array( 'exclude_changeset' => false, 'exclude_post_data' => ! current_user_can( 'customize' ), ), $args ); $values = array(); if ( ! $this->is_theme_active() ) { $stashed_theme_mods = get_option( 'customize_stashed_theme_mods' ); $stylesheet = $this->get_stylesheet(); if ( isset( $stashed_theme_mods[ $stylesheet ] ) ) { $values = array_merge( $values, wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' ) ); } } if ( ! $args['exclude_changeset'] ) { foreach ( $this->changeset_data() as $setting_id => $setting_params ) { if ( ! array_key_exists( 'value', $setting_params ) ) { continue; } if ( isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] ) { $namespace_pattern = '/^(?P.+?)::(?P.+)$/'; if ( preg_match( $namespace_pattern, $setting_id, $matches ) && $this->get_stylesheet() === $matches['stylesheet'] ) { $values[ $matches['setting_id'] ] = $setting_params['value']; } } else { $values[ $setting_id ] = $setting_params['value']; } } } if ( ! $args['exclude_post_data'] ) { if ( ! isset( $this->_post_values ) ) { if ( isset( $_POST['customized'] ) ) { $post_values = json_decode( wp_unslash( $_POST['customized'] ), true ); } else { $post_values = array(); } if ( is_array( $post_values ) ) { $this->_post_values = $post_values; } else { $this->_post_values = array(); } } $values = array_merge( $values, $this->_post_values ); } return $values; } public function post_value( $setting, $default_value = null ) { $post_values = $this->unsanitized_post_values(); if ( ! array_key_exists( $setting->id, $post_values ) ) { return $default_value; } $value = $post_values[ $setting->id ]; $valid = $setting->validate( $value ); if ( is_wp_error( $valid ) ) { return $default_value; } $value = $setting->sanitize( $value ); if ( is_null( $value ) || is_wp_error( $value ) ) { return $default_value; } return $value; } public function set_post_value( $setting_id, $value ) { $this->unsanitized_post_values(); $this->_post_values[ $setting_id ] = $value; do_action( "customize_post_value_set_{$setting_id}", $value, $this ); do_action( 'customize_post_value_set', $setting_id, $value, $this ); } public function customize_preview_init() { if ( ! headers_sent() ) { nocache_headers(); header( 'X-Robots: noindex, nofollow, noarchive' ); } add_filter( 'wp_robots', 'wp_robots_no_robots' ); add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' ) ); if ( $this->messenger_channel && ! current_user_can( 'customize' ) ) { $this->wp_die( -1, sprintf( __( 'Unauthorized. You may remove the %s param to preview as frontend.' ), 'customize_messenger_channel' ) ); return; } $this->prepare_controls(); add_filter( 'wp_redirect', array( $this, 'add_state_query_params' ) ); wp_enqueue_script( 'customize-preview' ); wp_enqueue_style( 'customize-preview' ); add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) ); add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) ); add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); add_filter( 'get_edit_post_link', '__return_empty_string' ); do_action( 'customize_preview_init', $this ); } public function filter_iframe_security_headers( $headers ) { $headers['X-Frame-Options'] = 'SAMEORIGIN'; $headers['Content-Security-Policy'] = "frame-ancestors 'self'"; return $headers; } public function add_state_query_params( $url ) { $parsed_original_url = wp_parse_url( $url ); $is_allowed = false; foreach ( $this->get_allowed_urls() as $allowed_url ) { $parsed_allowed_url = wp_parse_url( $allowed_url ); $is_allowed = ( $parsed_allowed_url['scheme'] === $parsed_original_url['scheme'] && $parsed_allowed_url['host'] === $parsed_original_url['host'] && 0 === strpos( $parsed_original_url['path'], $parsed_allowed_url['path'] ) ); if ( $is_allowed ) { break; } } if ( $is_allowed ) { $query_params = array( 'customize_changeset_uuid' => $this->changeset_uuid(), ); if ( ! $this->is_theme_active() ) { $query_params['customize_theme'] = $this->get_stylesheet(); } if ( $this->messenger_channel ) { $query_params['customize_messenger_channel'] = $this->messenger_channel; } $url = add_query_arg( $query_params, $url ); } return $url; } public function customize_preview_override_404_status() { _deprecated_function( __METHOD__, '4.7.0' ); } public function customize_preview_base() { _deprecated_function( __METHOD__, '4.7.0' ); } public function customize_preview_html5() { _deprecated_function( __FUNCTION__, '4.7.0' ); } public function customize_preview_loading_style() { ?> - - messenger_channel ) { return; } ?> - - unsanitized_post_values( array( 'exclude_changeset' => true ) ); $setting_validities = $this->validate_setting_values( $post_values ); $exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities ); $self_url = empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); $state_query_params = array( 'customize_theme', 'customize_changeset_uuid', 'customize_messenger_channel', ); $self_url = remove_query_arg( $state_query_params, $self_url ); $allowed_urls = $this->get_allowed_urls(); $allowed_hosts = array(); foreach ( $allowed_urls as $allowed_url ) { $parsed = wp_parse_url( $allowed_url ); if ( empty( $parsed['host'] ) ) { continue; } $host = $parsed['host']; if ( ! empty( $parsed['port'] ) ) { $host .= ':' . $parsed['port']; } $allowed_hosts[] = $host; } $switched_locale = switch_to_locale( get_user_locale() ); $l10n = array( 'shiftClickToEdit' => __( 'Shift-click to edit this element.' ), 'linkUnpreviewable' => __( 'This link is not live-previewable.' ), 'formUnpreviewable' => __( 'This form is not live-previewable.' ), ); if ( $switched_locale ) { restore_previous_locale(); } $settings = array( 'changeset' => array( 'uuid' => $this->changeset_uuid(), 'autosaved' => $this->autosaved(), ), 'timeouts' => array( 'selectiveRefresh' => 250, 'keepAliveSend' => 1000, ), 'theme' => array( 'stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active(), ), 'url' => array( 'self' => $self_url, 'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ), 'allowedHosts' => array_unique( $allowed_hosts ), 'isCrossDomain' => $this->is_cross_domain(), ), 'channel' => $this->messenger_channel, 'activePanels' => array(), 'activeSections' => array(), 'activeControls' => array(), 'settingValidities' => $exported_setting_validities, 'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(), 'l10n' => $l10n, '_dirty' => array_keys( $post_values ), ); foreach ( $this->panels as $panel_id => $panel ) { if ( $panel->check_capabilities() ) { $settings['activePanels'][ $panel_id ] = $panel->active(); foreach ( $panel->sections as $section_id => $section ) { if ( $section->check_capabilities() ) { $settings['activeSections'][ $section_id ] = $section->active(); } } } } foreach ( $this->sections as $id => $section ) { if ( $section->check_capabilities() ) { $settings['activeSections'][ $id ] = $section->active(); } } foreach ( $this->controls as $id => $control ) { if ( $control->check_capabilities() ) { $settings['activeControls'][ $id ] = $control->active(); } } ?> - - previewing; } public function get_template() { return $this->theme()->get_template(); } public function get_stylesheet() { return $this->theme()->get_stylesheet(); } public function get_template_root() { return get_raw_theme_root( $this->get_template(), true ); } public function get_stylesheet_root() { return get_raw_theme_root( $this->get_stylesheet(), true ); } public function current_theme( $current_theme ) { return $this->theme()->display( 'Name' ); } public function validate_setting_values( $setting_values, $options = array() ) { $options = wp_parse_args( $options, array( 'validate_capability' => false, 'validate_existence' => false, ) ); $validities = array(); foreach ( $setting_values as $setting_id => $unsanitized_value ) { $setting = $this->get_setting( $setting_id ); if ( ! $setting ) { if ( $options['validate_existence'] ) { $validities[ $setting_id ] = new WP_Error( 'unrecognized', __( 'Setting does not exist or is unrecognized.' ) ); } continue; } if ( $options['validate_capability'] && ! current_user_can( $setting->capability ) ) { $validity = new WP_Error( 'unauthorized', __( 'Unauthorized to modify setting due to capability.' ) ); } else { if ( is_null( $unsanitized_value ) ) { continue; } $validity = $setting->validate( $unsanitized_value ); } if ( ! is_wp_error( $validity ) ) { $late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting ); if ( is_wp_error( $late_validity ) && $late_validity->has_errors() ) { $validity = $late_validity; } } if ( ! is_wp_error( $validity ) ) { $value = $setting->sanitize( $unsanitized_value ); if ( is_null( $value ) ) { $validity = false; } elseif ( is_wp_error( $value ) ) { $validity = $value; } } if ( false === $validity ) { $validity = new WP_Error( 'invalid_value', __( 'Invalid value.' ) ); } $validities[ $setting_id ] = $validity; } return $validities; } public function prepare_setting_validity_for_js( $validity ) { if ( is_wp_error( $validity ) ) { $notification = array(); foreach ( $validity->errors as $error_code => $error_messages ) { $notification[ $error_code ] = array( 'message' => implode( ' ', $error_messages ), 'data' => $validity->get_error_data( $error_code ), ); } return $notification; } else { return true; } } public function save() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated' ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } $action = 'save-customize_' . $this->get_stylesheet(); if ( ! check_ajax_referer( $action, 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce' ); } $changeset_post_id = $this->changeset_post_id(); $is_new_changeset = empty( $changeset_post_id ); if ( $is_new_changeset ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->create_posts ) ) { wp_send_json_error( 'cannot_create_changeset_post' ); } } else { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { wp_send_json_error( 'cannot_edit_changeset_post' ); } } if ( ! empty( $_POST['customize_changeset_data'] ) ) { $input_changeset_data = json_decode( wp_unslash( $_POST['customize_changeset_data'] ), true ); if ( ! is_array( $input_changeset_data ) ) { wp_send_json_error( 'invalid_customize_changeset_data' ); } } else { $input_changeset_data = array(); } $changeset_title = null; if ( isset( $_POST['customize_changeset_title'] ) ) { $changeset_title = sanitize_text_field( wp_unslash( $_POST['customize_changeset_title'] ) ); } $is_publish = null; $changeset_status = null; if ( isset( $_POST['customize_changeset_status'] ) ) { $changeset_status = wp_unslash( $_POST['customize_changeset_status'] ); if ( ! get_post_status_object( $changeset_status ) || ! in_array( $changeset_status, array( 'draft', 'pending', 'publish', 'future' ), true ) ) { wp_send_json_error( 'bad_customize_changeset_status', 400 ); } $is_publish = ( 'publish' === $changeset_status || 'future' === $changeset_status ); if ( $is_publish && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) { wp_send_json_error( 'changeset_publish_unauthorized', 403 ); } } $changeset_date_gmt = null; if ( isset( $_POST['customize_changeset_date'] ) ) { $changeset_date = wp_unslash( $_POST['customize_changeset_date'] ); if ( preg_match( '/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date ) ) { $mm = substr( $changeset_date, 5, 2 ); $jj = substr( $changeset_date, 8, 2 ); $aa = substr( $changeset_date, 0, 4 ); $valid_date = wp_checkdate( $mm, $jj, $aa, $changeset_date ); if ( ! $valid_date ) { wp_send_json_error( 'bad_customize_changeset_date', 400 ); } $changeset_date_gmt = get_gmt_from_date( $changeset_date ); } else { $timestamp = strtotime( $changeset_date ); if ( ! $timestamp ) { wp_send_json_error( 'bad_customize_changeset_date', 400 ); } $changeset_date_gmt = gmdate( 'Y-m-d H:i:s', $timestamp ); } } $lock_user_id = null; $autosave = ! empty( $_POST['customize_changeset_autosave'] ); if ( ! $is_new_changeset ) { $lock_user_id = wp_check_post_lock( $this->changeset_post_id() ); } if ( $lock_user_id && ! $autosave ) { $autosave = true; $changeset_status = null; $changeset_date_gmt = null; } if ( $autosave && ! defined( 'DOING_AUTOSAVE' ) ) { define( 'DOING_AUTOSAVE', true ); } $autosaved = false; $r = $this->save_changeset_post( array( 'status' => $changeset_status, 'title' => $changeset_title, 'date_gmt' => $changeset_date_gmt, 'data' => $input_changeset_data, 'autosave' => $autosave, ) ); if ( $autosave && ! is_wp_error( $r ) ) { $autosaved = true; } if ( $lock_user_id && ! is_wp_error( $r ) ) { $r = new WP_Error( 'changeset_locked', __( 'Changeset is being edited by other user.' ), array( 'lock_user' => $this->get_lock_user_data( $lock_user_id ), ) ); } if ( is_wp_error( $r ) ) { $response = array( 'message' => $r->get_error_message(), 'code' => $r->get_error_code(), ); if ( is_array( $r->get_error_data() ) ) { $response = array_merge( $response, $r->get_error_data() ); } else { $response['data'] = $r->get_error_data(); } } else { $response = $r; $changeset_post = get_post( $this->changeset_post_id() ); if ( $is_new_changeset ) { $this->dismiss_user_auto_draft_changesets(); } $response['changeset_status'] = $changeset_post->post_status; if ( $is_publish && 'trash' === $response['changeset_status'] ) { $response['changeset_status'] = 'publish'; } if ( 'publish' !== $response['changeset_status'] ) { $this->set_changeset_lock( $changeset_post->ID ); } if ( 'future' === $response['changeset_status'] ) { $response['changeset_date'] = $changeset_post->post_date; } if ( 'publish' === $response['changeset_status'] || 'trash' === $response['changeset_status'] ) { $response['next_changeset_uuid'] = wp_generate_uuid4(); } } if ( $autosave ) { $response['autosaved'] = $autosaved; } if ( isset( $response['setting_validities'] ) ) { $response['setting_validities'] = array_map( array( $this, 'prepare_setting_validity_for_js' ), $response['setting_validities'] ); } $response = apply_filters( 'customize_save_response', $response, $this ); if ( is_wp_error( $r ) ) { wp_send_json_error( $response ); } else { wp_send_json_success( $response ); } } public function save_changeset_post( $args = array() ) { $args = array_merge( array( 'status' => null, 'title' => null, 'data' => array(), 'date_gmt' => null, 'user_id' => get_current_user_id(), 'starter_content' => false, 'autosave' => false, ), $args ); $changeset_post_id = $this->changeset_post_id(); $existing_changeset_data = array(); if ( $changeset_post_id ) { $existing_status = get_post_status( $changeset_post_id ); if ( 'publish' === $existing_status || 'trash' === $existing_status ) { return new WP_Error( 'changeset_already_published', __( 'The previous set of changes has already been published. Please try saving your current set of changes again.' ), array( 'next_changeset_uuid' => wp_generate_uuid4(), ) ); } $existing_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); if ( is_wp_error( $existing_changeset_data ) ) { return $existing_changeset_data; } } if ( 'publish' === $args['status'] && false === has_action( 'transition_post_status', '_wp_customize_publish_changeset' ) ) { return new WP_Error( 'missing_publish_callback' ); } $now = gmdate( 'Y-m-d H:i:59' ); if ( $args['date_gmt'] ) { $is_future_dated = ( mysql2date( 'U', $args['date_gmt'], false ) > mysql2date( 'U', $now, false ) ); if ( ! $is_future_dated ) { return new WP_Error( 'not_future_date', __( 'You must supply a future date to schedule.' ) ); } if ( ! $this->is_theme_active() && ( 'future' === $args['status'] || $is_future_dated ) ) { return new WP_Error( 'cannot_schedule_theme_switches' ); } $will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status( $changeset_post_id ) ) ); if ( $will_remain_auto_draft ) { return new WP_Error( 'cannot_supply_date_for_auto_draft_changeset' ); } } elseif ( $changeset_post_id && 'future' === $args['status'] ) { $changeset_post = get_post( $changeset_post_id ); if ( mysql2date( 'U', $changeset_post->post_date_gmt, false ) <= mysql2date( 'U', $now, false ) ) { return new WP_Error( 'not_future_date', __( 'You must supply a future date to schedule.' ) ); } } if ( ! empty( $is_future_dated ) && 'publish' === $args['status'] ) { $args['status'] = 'future'; } if ( $args['autosave'] ) { if ( $args['date_gmt'] ) { return new WP_Error( 'illegal_autosave_with_date_gmt' ); } elseif ( $args['status'] ) { return new WP_Error( 'illegal_autosave_with_status' ); } elseif ( $args['user_id'] && get_current_user_id() !== $args['user_id'] ) { return new WP_Error( 'illegal_autosave_with_non_current_user' ); } } $update_transactionally = (bool) $args['status']; $allow_revision = (bool) $args['status']; foreach ( $args['data'] as $setting_id => $setting_params ) { if ( is_array( $setting_params ) && array_key_exists( 'value', $setting_params ) ) { $this->set_post_value( $setting_id, $setting_params['value'] ); } } $post_values = $this->unsanitized_post_values( array( 'exclude_changeset' => true, 'exclude_post_data' => false, ) ); $this->add_dynamic_settings( array_keys( $post_values ) ); $changed_setting_ids = array(); foreach ( $post_values as $setting_id => $setting_value ) { $setting = $this->get_setting( $setting_id ); if ( $setting && 'theme_mod' === $setting->type ) { $prefixed_setting_id = $this->get_stylesheet() . '::' . $setting->id; } else { $prefixed_setting_id = $setting_id; } $is_value_changed = ( ! isset( $existing_changeset_data[ $prefixed_setting_id ] ) || ! array_key_exists( 'value', $existing_changeset_data[ $prefixed_setting_id ] ) || $existing_changeset_data[ $prefixed_setting_id ]['value'] !== $setting_value ); if ( $is_value_changed ) { $changed_setting_ids[] = $setting_id; } } do_action( 'customize_save_validation_before', $this ); $validated_values = array_merge( array_fill_keys( array_keys( $args['data'] ), null ), $post_values ); $setting_validities = $this->validate_setting_values( $validated_values, array( 'validate_capability' => true, 'validate_existence' => true, ) ); $invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) ); if ( $update_transactionally && $invalid_setting_count > 0 ) { $response = array( 'setting_validities' => $setting_validities, 'message' => sprintf( _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ), ); return new WP_Error( 'transaction_fail', '', $response ); } $original_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); $data = $original_changeset_data; if ( is_wp_error( $data ) ) { $data = array(); } foreach ( $post_values as $setting_id => $post_value ) { if ( ! isset( $args['data'][ $setting_id ] ) ) { $args['data'][ $setting_id ] = array(); } if ( ! isset( $args['data'][ $setting_id ]['value'] ) ) { $args['data'][ $setting_id ]['value'] = $post_value; } } foreach ( $args['data'] as $setting_id => $setting_params ) { $setting = $this->get_setting( $setting_id ); if ( ! $setting || ! $setting->check_capabilities() ) { continue; } if ( isset( $setting_validities[ $setting_id ] ) && is_wp_error( $setting_validities[ $setting_id ] ) ) { continue; } $changeset_setting_id = $setting_id; if ( 'theme_mod' === $setting->type ) { $changeset_setting_id = sprintf( '%s::%s', $this->get_stylesheet(), $setting_id ); } if ( null === $setting_params ) { unset( $data[ $changeset_setting_id ] ); } else { if ( ! isset( $data[ $changeset_setting_id ] ) ) { $data[ $changeset_setting_id ] = array(); } $merged_setting_params = array_merge( $data[ $changeset_setting_id ], $setting_params ); if ( $data[ $changeset_setting_id ] === $merged_setting_params ) { continue; } $data[ $changeset_setting_id ] = array_merge( $merged_setting_params, array( 'type' => $setting->type, 'user_id' => $args['user_id'], 'date_modified_gmt' => current_time( 'mysql', true ), ) ); if ( empty( $args['starter_content'] ) ) { unset( $data[ $changeset_setting_id ]['starter_content'] ); } } } $filter_context = array( 'uuid' => $this->changeset_uuid(), 'title' => $args['title'], 'status' => $args['status'], 'date_gmt' => $args['date_gmt'], 'post_id' => $changeset_post_id, 'previous_data' => is_wp_error( $original_changeset_data ) ? array() : $original_changeset_data, 'manager' => $this, ); $data = apply_filters( 'customize_changeset_save_data', $data, $filter_context ); if ( 'publish' === $args['status'] && ! $this->is_theme_active() ) { $this->stop_previewing_theme(); switch_theme( $this->get_stylesheet() ); update_option( 'theme_switched_via_customizer', true ); $this->start_previewing_theme(); } $post_array = array( 'post_content' => wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), ); if ( $args['title'] ) { $post_array['post_title'] = $args['title']; } if ( $changeset_post_id ) { $post_array['ID'] = $changeset_post_id; } else { $post_array['post_type'] = 'customize_changeset'; $post_array['post_name'] = $this->changeset_uuid(); $post_array['post_status'] = 'auto-draft'; } if ( $args['status'] ) { $post_array['post_status'] = $args['status']; } if ( 'publish' === $args['status'] ) { $post_array['post_date_gmt'] = '0000-00-00 00:00:00'; $post_array['post_date'] = '0000-00-00 00:00:00'; } elseif ( $args['date_gmt'] ) { $post_array['post_date_gmt'] = $args['date_gmt']; $post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] ); } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) { $post_array['post_date'] = current_time( 'mysql' ); $post_array['post_date_gmt'] = ''; } $this->store_changeset_revision = $allow_revision; add_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ), 5, 3 ); add_filter( 'wp_insert_post_data', array( $this, 'preserve_insert_changeset_post_content' ), 5, 3 ); if ( $changeset_post_id ) { if ( $args['autosave'] && 'auto-draft' !== get_post_status( $changeset_post_id ) ) { add_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10, 4 ); $post_array['post_ID'] = $post_array['ID']; $post_array['post_type'] = 'customize_changeset'; $r = wp_create_post_autosave( wp_slash( $post_array ) ); remove_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10 ); } else { $post_array['edit_date'] = true; $r = wp_update_post( wp_slash( $post_array ), true ); if ( ! empty( $args['user_id'] ) ) { $autosave_draft = wp_get_post_autosave( $changeset_post_id, $args['user_id'] ); if ( $autosave_draft ) { wp_delete_post( $autosave_draft->ID, true ); } } } } else { $r = wp_insert_post( wp_slash( $post_array ), true ); if ( ! is_wp_error( $r ) ) { $this->_changeset_post_id = $r; } } remove_filter( 'wp_insert_post_data', array( $this, 'preserve_insert_changeset_post_content' ), 5 ); $this->_changeset_data = null; remove_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ) ); $response = array( 'setting_validities' => $setting_validities, ); if ( is_wp_error( $r ) ) { $response['changeset_post_save_failure'] = $r->get_error_code(); return new WP_Error( 'changeset_post_save_failure', '', $response ); } return $response; } public function preserve_insert_changeset_post_content( $data, $postarr, $unsanitized_postarr ) { if ( isset( $data['post_type'] ) && isset( $unsanitized_postarr['post_content'] ) && 'customize_changeset' === $data['post_type'] || ( 'revision' === $data['post_type'] && ! empty( $data['post_parent'] ) && 'customize_changeset' === get_post_type( $data['post_parent'] ) ) ) { $data['post_content'] = $unsanitized_postarr['post_content']; } return $data; } public function trash_changeset_post( $post ) { global $wpdb; $post = get_post( $post ); if ( ! ( $post instanceof WP_Post ) ) { return $post; } $post_id = $post->ID; if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_post( $post_id, true ); } if ( 'trash' === get_post_status( $post ) ) { return false; } $check = apply_filters( 'pre_trash_post', null, $post ); if ( null !== $check ) { return $check; } do_action( 'wp_trash_post', $post_id ); add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status ); add_post_meta( $post_id, '_wp_trash_meta_time', time() ); $old_status = $post->post_status; $new_status = 'trash'; $wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); $post->post_status = $new_status; wp_transition_post_status( $new_status, $old_status, $post ); do_action( "edit_post_{$post->post_type}", $post->ID, $post ); do_action( 'edit_post', $post->ID, $post ); do_action( "save_post_{$post->post_type}", $post->ID, $post, true ); do_action( 'save_post', $post->ID, $post, true ); do_action( 'wp_insert_post', $post->ID, $post, true ); wp_after_insert_post( get_post( $post_id ), true, $post ); wp_trash_post_comments( $post_id ); do_action( 'trashed_post', $post_id ); return $post; } public function handle_changeset_trash_request() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated' ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } if ( ! check_ajax_referer( 'trash_customize_changeset', 'nonce', false ) ) { wp_send_json_error( array( 'code' => 'invalid_nonce', 'message' => __( 'There was an authentication problem. Please reload and try again.' ), ) ); } $changeset_post_id = $this->changeset_post_id(); if ( ! $changeset_post_id ) { wp_send_json_error( array( 'message' => __( 'No changes saved yet, so there is nothing to trash.' ), 'code' => 'non_existent_changeset', ) ); return; } if ( $changeset_post_id ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'changeset_trash_unauthorized', 'message' => __( 'Unable to trash changes.' ), ) ); } $lock_user = (int) wp_check_post_lock( $changeset_post_id ); if ( $lock_user && get_current_user_id() !== $lock_user ) { wp_send_json_error( array( 'code' => 'changeset_locked', 'message' => __( 'Changeset is being edited by other user.' ), 'lockUser' => $this->get_lock_user_data( $lock_user ), ) ); } } if ( 'trash' === get_post_status( $changeset_post_id ) ) { wp_send_json_error( array( 'message' => __( 'Changes have already been trashed.' ), 'code' => 'changeset_already_trashed', ) ); return; } $r = $this->trash_changeset_post( $changeset_post_id ); if ( ! ( $r instanceof WP_Post ) ) { wp_send_json_error( array( 'code' => 'changeset_trash_failure', 'message' => __( 'Unable to trash changes.' ), ) ); } wp_send_json_success( array( 'message' => __( 'Changes trashed successfully.' ), ) ); } public function grant_edit_post_capability_for_changeset( $caps, $cap, $user_id, $args ) { if ( 'edit_post' === $cap && ! empty( $args[0] ) && 'customize_changeset' === get_post_type( $args[0] ) ) { $post_type_obj = get_post_type_object( 'customize_changeset' ); $caps = map_meta_cap( $post_type_obj->cap->$cap, $user_id ); } return $caps; } public function set_changeset_lock( $changeset_post_id, $take_over = false ) { if ( $changeset_post_id ) { $can_override = ! (bool) get_post_meta( $changeset_post_id, '_edit_lock', true ); if ( $take_over ) { $can_override = true; } if ( $can_override ) { $lock = sprintf( '%s:%s', time(), get_current_user_id() ); update_post_meta( $changeset_post_id, '_edit_lock', $lock ); } else { $this->refresh_changeset_lock( $changeset_post_id ); } } } public function refresh_changeset_lock( $changeset_post_id ) { if ( ! $changeset_post_id ) { return; } $lock = get_post_meta( $changeset_post_id, '_edit_lock', true ); $lock = explode( ':', $lock ); if ( $lock && ! empty( $lock[1] ) ) { $user_id = (int) $lock[1]; $current_user_id = get_current_user_id(); if ( $user_id === $current_user_id ) { $lock = sprintf( '%s:%s', time(), $user_id ); update_post_meta( $changeset_post_id, '_edit_lock', $lock ); } } } public function add_customize_screen_to_heartbeat_settings( $settings ) { global $pagenow; if ( 'customize.php' === $pagenow ) { $settings['screenId'] = 'customize'; } return $settings; } protected function get_lock_user_data( $user_id ) { if ( ! $user_id ) { return null; } $lock_user = get_userdata( $user_id ); if ( ! $lock_user ) { return null; } return array( 'id' => $lock_user->ID, 'name' => $lock_user->display_name, 'avatar' => get_avatar_url( $lock_user->ID, array( 'size' => 128 ) ), ); } public function check_changeset_lock_with_heartbeat( $response, $data, $screen_id ) { if ( isset( $data['changeset_uuid'] ) ) { $changeset_post_id = $this->find_changeset_post_id( $data['changeset_uuid'] ); } else { $changeset_post_id = $this->changeset_post_id(); } if ( array_key_exists( 'check_changeset_lock', $data ) && 'customize' === $screen_id && $changeset_post_id && current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { $lock_user_id = wp_check_post_lock( $changeset_post_id ); if ( $lock_user_id ) { $response['customize_changeset_lock_user'] = $this->get_lock_user_data( $lock_user_id ); } else { $this->refresh_changeset_lock( $changeset_post_id ); } } return $response; } public function handle_override_changeset_lock_request() { if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview', 400 ); } if ( ! check_ajax_referer( 'customize_override_changeset_lock', 'nonce', false ) ) { wp_send_json_error( array( 'code' => 'invalid_nonce', 'message' => __( 'Security check failed.' ), ) ); } $changeset_post_id = $this->changeset_post_id(); if ( empty( $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'no_changeset_found_to_take_over', 'message' => __( 'No changeset found to take over' ), ) ); } if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) { wp_send_json_error( array( 'code' => 'cannot_remove_changeset_lock', 'message' => __( 'Sorry, you are not allowed to take over.' ), ) ); } $this->set_changeset_lock( $changeset_post_id, true ); wp_send_json_success( 'changeset_taken_over' ); } protected $store_changeset_revision; public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) { unset( $last_revision ); if ( 'customize_changeset' === $post->post_type ) { $post_has_changed = $this->store_changeset_revision; } return $post_has_changed; } public function _publish_changeset_values( $changeset_post_id ) { global $wpdb; $publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id ); if ( is_wp_error( $publishing_changeset_data ) ) { return $publishing_changeset_data; } $changeset_post = get_post( $changeset_post_id ); $previous_changeset_post_id = $this->_changeset_post_id; $this->_changeset_post_id = $changeset_post_id; $previous_changeset_uuid = $this->_changeset_uuid; $this->_changeset_uuid = $changeset_post->post_name; $previous_changeset_data = $this->_changeset_data; $this->_changeset_data = $publishing_changeset_data; $setting_user_ids = array(); $theme_mod_settings = array(); $namespace_pattern = '/^(?P.+?)::(?P.+)$/'; $matches = array(); foreach ( $this->_changeset_data as $raw_setting_id => $setting_params ) { $actual_setting_id = null; $is_theme_mod_setting = ( isset( $setting_params['value'] ) && isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] && preg_match( $namespace_pattern, $raw_setting_id, $matches ) ); if ( $is_theme_mod_setting ) { if ( ! isset( $theme_mod_settings[ $matches['stylesheet'] ] ) ) { $theme_mod_settings[ $matches['stylesheet'] ] = array(); } $theme_mod_settings[ $matches['stylesheet'] ][ $matches['setting_id'] ] = $setting_params; if ( $this->get_stylesheet() === $matches['stylesheet'] ) { $actual_setting_id = $matches['setting_id']; } } else { $actual_setting_id = $raw_setting_id; } if ( $actual_setting_id && isset( $setting_params['user_id'] ) ) { $setting_user_ids[ $actual_setting_id ] = $setting_params['user_id']; } } $changeset_setting_values = $this->unsanitized_post_values( array( 'exclude_post_data' => true, 'exclude_changeset' => false, ) ); $changeset_setting_ids = array_keys( $changeset_setting_values ); $this->add_dynamic_settings( $changeset_setting_ids ); do_action( 'customize_save', $this ); $original_setting_capabilities = array(); foreach ( $changeset_setting_ids as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting && ! isset( $setting_user_ids[ $setting_id ] ) ) { $original_setting_capabilities[ $setting->id ] = $setting->capability; $setting->capability = 'exist'; } } $original_user_id = get_current_user_id(); foreach ( $changeset_setting_ids as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { if ( isset( $setting_user_ids[ $setting_id ] ) ) { wp_set_current_user( $setting_user_ids[ $setting_id ] ); } else { wp_set_current_user( $original_user_id ); } $setting->save(); } } wp_set_current_user( $original_user_id ); if ( did_action( 'switch_theme' ) ) { $other_theme_mod_settings = $theme_mod_settings; unset( $other_theme_mod_settings[ $this->get_stylesheet() ] ); $this->update_stashed_theme_mod_settings( $other_theme_mod_settings ); } do_action( 'customize_save_after', $this ); foreach ( $original_setting_capabilities as $setting_id => $capability ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { $setting->capability = $capability; } } $this->_changeset_data = $previous_changeset_data; $this->_changeset_post_id = $previous_changeset_post_id; $this->_changeset_uuid = $previous_changeset_uuid; $revisions = wp_get_post_revisions( $changeset_post_id, array( 'check_enabled' => false ) ); foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$changeset_post_id}-autosave" ) ) { $wpdb->update( $wpdb->posts, array( 'post_status' => 'auto-draft', 'post_type' => 'customize_changeset', 'post_name' => wp_generate_uuid4(), 'post_parent' => 0, ), array( 'ID' => $revision->ID, ) ); clean_post_cache( $revision->ID ); } } return true; } protected function update_stashed_theme_mod_settings( $inactive_theme_mod_settings ) { $stashed_theme_mod_settings = get_option( 'customize_stashed_theme_mods' ); if ( empty( $stashed_theme_mod_settings ) ) { $stashed_theme_mod_settings = array(); } unset( $stashed_theme_mod_settings[ $this->get_stylesheet() ] ); foreach ( $inactive_theme_mod_settings as $stylesheet => $theme_mod_settings ) { if ( ! isset( $stashed_theme_mod_settings[ $stylesheet ] ) ) { $stashed_theme_mod_settings[ $stylesheet ] = array(); } $stashed_theme_mod_settings[ $stylesheet ] = array_merge( $stashed_theme_mod_settings[ $stylesheet ], $theme_mod_settings ); } $autoload = false; $result = update_option( 'customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload ); if ( ! $result ) { return false; } return $stashed_theme_mod_settings; } public function refresh_nonces() { if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview' ); } wp_send_json_success( $this->get_nonces() ); } public function handle_dismiss_autosave_or_lock_request() { if ( ! is_user_logged_in() ) { wp_send_json_error( 'unauthenticated', 401 ); } if ( ! $this->is_preview() ) { wp_send_json_error( 'not_preview', 400 ); } if ( ! check_ajax_referer( 'customize_dismiss_autosave_or_lock', 'nonce', false ) ) { wp_send_json_error( 'invalid_nonce', 403 ); } $changeset_post_id = $this->changeset_post_id(); $dismiss_lock = ! empty( $_POST['dismiss_lock'] ); $dismiss_autosave = ! empty( $_POST['dismiss_autosave'] ); if ( $dismiss_lock ) { if ( empty( $changeset_post_id ) && ! $dismiss_autosave ) { wp_send_json_error( 'no_changeset_to_dismiss_lock', 404 ); } if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) && ! $dismiss_autosave ) { wp_send_json_error( 'cannot_remove_changeset_lock', 403 ); } delete_post_meta( $changeset_post_id, '_edit_lock' ); if ( ! $dismiss_autosave ) { wp_send_json_success( 'changeset_lock_dismissed' ); } } if ( $dismiss_autosave ) { if ( empty( $changeset_post_id ) || 'auto-draft' === get_post_status( $changeset_post_id ) ) { $dismissed = $this->dismiss_user_auto_draft_changesets(); if ( $dismissed > 0 ) { wp_send_json_success( 'auto_draft_dismissed' ); } else { wp_send_json_error( 'no_auto_draft_to_delete', 404 ); } } else { $revision = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); if ( $revision ) { if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) { wp_send_json_error( 'cannot_delete_autosave_revision', 403 ); } if ( ! wp_delete_post( $revision->ID, true ) ) { wp_send_json_error( 'autosave_revision_deletion_failure', 500 ); } else { wp_send_json_success( 'autosave_revision_deleted' ); } } else { wp_send_json_error( 'no_autosave_revision_to_delete', 404 ); } } } wp_send_json_error( 'unknown_error', 500 ); } public function add_setting( $id, $args = array() ) { if ( $id instanceof WP_Customize_Setting ) { $setting = $id; } else { $class = 'WP_Customize_Setting'; $args = apply_filters( 'customize_dynamic_setting_args', $args, $id ); $class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args ); $setting = new $class( $this, $id, $args ); } $this->settings[ $setting->id ] = $setting; return $setting; } public function add_dynamic_settings( $setting_ids ) { $new_settings = array(); foreach ( $setting_ids as $setting_id ) { if ( $this->get_setting( $setting_id ) ) { continue; } $setting_args = false; $setting_class = 'WP_Customize_Setting'; $setting_args = apply_filters( 'customize_dynamic_setting_args', $setting_args, $setting_id ); if ( false === $setting_args ) { continue; } $setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args ); $setting = new $setting_class( $this, $setting_id, $setting_args ); $this->add_setting( $setting ); $new_settings[] = $setting; } return $new_settings; } public function get_setting( $id ) { if ( isset( $this->settings[ $id ] ) ) { return $this->settings[ $id ]; } } public function remove_setting( $id ) { unset( $this->settings[ $id ] ); } public function add_panel( $id, $args = array() ) { if ( $id instanceof WP_Customize_Panel ) { $panel = $id; } else { $panel = new WP_Customize_Panel( $this, $id, $args ); } $this->panels[ $panel->id ] = $panel; return $panel; } public function get_panel( $id ) { if ( isset( $this->panels[ $id ] ) ) { return $this->panels[ $id ]; } } public function remove_panel( $id ) { if ( in_array( $id, $this->components, true ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), $id, sprintf( '%2$s', esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), 'customize_loaded_components' ) ), '4.5.0' ); } unset( $this->panels[ $id ] ); } public function register_panel_type( $panel ) { $this->registered_panel_types[] = $panel; } public function render_panel_templates() { foreach ( $this->registered_panel_types as $panel_type ) { $panel = new $panel_type( $this, 'temp', array() ); $panel->print_template(); } } public function add_section( $id, $args = array() ) { if ( $id instanceof WP_Customize_Section ) { $section = $id; } else { $section = new WP_Customize_Section( $this, $id, $args ); } $this->sections[ $section->id ] = $section; return $section; } public function get_section( $id ) { if ( isset( $this->sections[ $id ] ) ) { return $this->sections[ $id ]; } } public function remove_section( $id ) { unset( $this->sections[ $id ] ); } public function register_section_type( $section ) { $this->registered_section_types[] = $section; } public function render_section_templates() { foreach ( $this->registered_section_types as $section_type ) { $section = new $section_type( $this, 'temp', array() ); $section->print_template(); } } public function add_control( $id, $args = array() ) { if ( $id instanceof WP_Customize_Control ) { $control = $id; } else { $control = new WP_Customize_Control( $this, $id, $args ); } $this->controls[ $control->id ] = $control; return $control; } public function get_control( $id ) { if ( isset( $this->controls[ $id ] ) ) { return $this->controls[ $id ]; } } public function remove_control( $id ) { unset( $this->controls[ $id ] ); } public function register_control_type( $control ) { $this->registered_control_types[] = $control; } public function render_control_templates() { if ( $this->branching() ) { $l10n = array( 'locked' => __( '%s is already customizing this changeset. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 'locked_allow_override' => __( '%s is already customizing this changeset. Do you want to take over?' ), ); } else { $l10n = array( 'locked' => __( '%s is already customizing this site. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 'locked_allow_override' => __( '%s is already customizing this site. Do you want to take over?' ), ); } foreach ( $this->registered_control_types as $control_type ) { $control = new $control_type( $this, 'temp', array( 'settings' => array(), ) ); $control->print_template(); } ?> - - - - - - - - - - - - - - - priority === $b->priority ) { return $a->instance_number - $b->instance_number; } else { return $a->priority - $b->priority; } } public function prepare_controls() { $controls = array(); $this->controls = wp_list_sort( $this->controls, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); foreach ( $this->controls as $id => $control ) { if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) { continue; } $this->sections[ $control->section ]->controls[] = $control; $controls[ $id ] = $control; } $this->controls = $controls; $this->sections = wp_list_sort( $this->sections, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $sections = array(); foreach ( $this->sections as $section ) { if ( ! $section->check_capabilities() ) { continue; } $section->controls = wp_list_sort( $section->controls, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ) ); if ( ! $section->panel ) { $sections[ $section->id ] = $section; } else { if ( isset( $this->panels [ $section->panel ] ) ) { $this->panels[ $section->panel ]->sections[ $section->id ] = $section; } } } $this->sections = $sections; $this->panels = wp_list_sort( $this->panels, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $panels = array(); foreach ( $this->panels as $panel ) { if ( ! $panel->check_capabilities() ) { continue; } $panel->sections = wp_list_sort( $panel->sections, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); $panels[ $panel->id ] = $panel; } $this->panels = $panels; $this->containers = array_merge( $this->panels, $this->sections ); $this->containers = wp_list_sort( $this->containers, array( 'priority' => 'ASC', 'instance_number' => 'ASC', ), 'ASC', true ); } public function enqueue_control_scripts() { foreach ( $this->controls as $control ) { $control->enqueue(); } if ( ! is_multisite() && ( current_user_can( 'install_themes' ) || current_user_can( 'update_themes' ) || current_user_can( 'delete_themes' ) ) ) { wp_enqueue_script( 'updates' ); wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( 'totals' => wp_get_update_data(), ) ); } } public function is_ios() { return wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ); } public function get_document_title_template() { if ( $this->is_theme_active() ) { $document_title_tmpl = __( 'Customize: %s' ); } else { $document_title_tmpl = __( 'Live Preview: %s' ); } $document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); return $document_title_tmpl; } public function set_preview_url( $preview_url ) { $preview_url = esc_url_raw( $preview_url ); $this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) ); } public function get_preview_url() { if ( empty( $this->preview_url ) ) { $preview_url = home_url( '/' ); } else { $preview_url = $this->preview_url; } return $preview_url; } public function is_cross_domain() { $admin_origin = wp_parse_url( admin_url() ); $home_origin = wp_parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) ); return $cross_domain; } public function get_allowed_urls() { $allowed_urls = array( home_url( '/' ) ); if ( is_ssl() && ! $this->is_cross_domain() ) { $allowed_urls[] = home_url( '/', 'https' ); } $allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) ); return $allowed_urls; } public function get_messenger_channel() { return $this->messenger_channel; } public function set_return_url( $return_url ) { $return_url = esc_url_raw( $return_url ); $return_url = remove_query_arg( wp_removable_query_args(), $return_url ); $return_url = wp_validate_redirect( $return_url ); $this->return_url = $return_url; } public function get_return_url() { global $_registered_pages; $referer = wp_get_referer(); $excluded_referer_basenames = array( 'customize.php', 'wp-login.php' ); if ( $this->return_url ) { $return_url = $this->return_url; } elseif ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) { $return_url = $referer; } elseif ( $this->preview_url ) { $return_url = $this->preview_url; } else { $return_url = home_url( '/' ); } $return_url_basename = wp_basename( parse_url( $this->return_url, PHP_URL_PATH ) ); $return_url_query = parse_url( $this->return_url, PHP_URL_QUERY ); if ( 'themes.php' === $return_url_basename && $return_url_query ) { parse_str( $return_url_query, $query_vars ); if ( isset( $query_vars['page'] ) && ! isset( $_registered_pages[ "appearance_page_{$query_vars['page']}" ] ) ) { $return_url = admin_url( 'themes.php' ); } } return $return_url; } public function set_autofocus( $autofocus ) { $this->autofocus = array_filter( wp_array_slice_assoc( $autofocus, array( 'panel', 'section', 'control' ) ), 'is_string' ); } public function get_autofocus() { return $this->autofocus; } public function get_nonces() { $nonces = array( 'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ), 'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ), 'switch_themes' => wp_create_nonce( 'switch_themes' ), 'dismiss_autosave_or_lock' => wp_create_nonce( 'customize_dismiss_autosave_or_lock' ), 'override_lock' => wp_create_nonce( 'customize_override_changeset_lock' ), 'trash' => wp_create_nonce( 'trash_customize_changeset' ), ); $nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this ); return $nonces; } public function customize_pane_settings() { $login_url = add_query_arg( array( 'interim-login' => 1, 'customize-login' => 1, ), wp_login_url() ); foreach ( array_keys( $this->unsanitized_post_values() ) as $setting_id ) { $setting = $this->get_setting( $setting_id ); if ( $setting ) { $setting->dirty = true; } } $autosave_revision_post = null; $autosave_autodraft_post = null; $changeset_post_id = $this->changeset_post_id(); if ( ! $this->saved_starter_content_changeset && ! $this->autosaved() ) { if ( $changeset_post_id ) { if ( is_user_logged_in() ) { $autosave_revision_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); } } else { $autosave_autodraft_posts = $this->get_changeset_posts( array( 'posts_per_page' => 1, 'post_status' => 'auto-draft', 'exclude_restore_dismissed' => true, ) ); if ( ! empty( $autosave_autodraft_posts ) ) { $autosave_autodraft_post = array_shift( $autosave_autodraft_posts ); } } } $current_user_can_publish = current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ); $status_choices = array(); if ( $current_user_can_publish ) { $status_choices[] = array( 'status' => 'publish', 'label' => __( 'Publish' ), ); } $status_choices[] = array( 'status' => 'draft', 'label' => __( 'Save Draft' ), ); if ( $current_user_can_publish ) { $status_choices[] = array( 'status' => 'future', 'label' => _x( 'Schedule', 'customizer changeset action/button label' ), ); } $changeset_post = null; if ( $changeset_post_id ) { $changeset_post = get_post( $changeset_post_id ); } $current_time = current_time( 'mysql', false ); $initial_date = $current_time; if ( $changeset_post ) { $initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID ); if ( $initial_date < $current_time ) { $initial_date = $current_time; } } $lock_user_id = false; if ( $this->changeset_post_id() ) { $lock_user_id = wp_check_post_lock( $this->changeset_post_id() ); } $settings = array( 'changeset' => array( 'uuid' => $this->changeset_uuid(), 'branching' => $this->branching(), 'autosaved' => $this->autosaved(), 'hasAutosaveRevision' => ! empty( $autosave_revision_post ), 'latestAutoDraftUuid' => $autosave_autodraft_post ? $autosave_autodraft_post->post_name : null, 'status' => $changeset_post ? $changeset_post->post_status : '', 'currentUserCanPublish' => $current_user_can_publish, 'publishDate' => $initial_date, 'statusChoices' => $status_choices, 'lockUser' => $lock_user_id ? $this->get_lock_user_data( $lock_user_id ) : null, ), 'initialServerDate' => $current_time, 'dateFormat' => get_option( 'date_format' ), 'timeFormat' => get_option( 'time_format' ), 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), 'initialClientTimestamp' => -1, 'timeouts' => array( 'windowRefresh' => 250, 'changesetAutoSave' => AUTOSAVE_INTERVAL * 1000, 'keepAliveCheck' => 2500, 'reflowPaneContents' => 100, 'previewFrameSensitivity' => 2000, ), 'theme' => array( 'stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active(), '_canInstall' => current_user_can( 'install_themes' ), ), 'url' => array( 'preview' => esc_url_raw( $this->get_preview_url() ), 'return' => esc_url_raw( $this->get_return_url() ), 'parent' => esc_url_raw( admin_url() ), 'activated' => esc_url_raw( home_url( '/' ) ), 'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ), 'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ), 'isCrossDomain' => $this->is_cross_domain(), 'home' => esc_url_raw( home_url( '/' ) ), 'login' => esc_url_raw( $login_url ), ), 'browser' => array( 'mobile' => wp_is_mobile(), 'ios' => $this->is_ios(), ), 'panels' => array(), 'sections' => array(), 'nonce' => $this->get_nonces(), 'autofocus' => $this->get_autofocus(), 'documentTitleTmpl' => $this->get_document_title_template(), 'previewableDevices' => $this->get_previewable_devices(), 'l10n' => array( 'confirmDeleteTheme' => __( 'Are you sure you want to delete this theme?' ), 'themeSearchResults' => __( '%d themes found' ), 'announceThemeCount' => __( 'Displaying %d themes' ), 'announceThemeDetails' => __( 'Showing details for theme: %s' ), ), ); $filesystem_method = get_filesystem_method(); ob_start(); $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); ob_end_clean(); if ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ) { $settings['theme']['_filesystemCredentialsNeeded'] = true; } foreach ( $this->sections() as $id => $section ) { if ( $section->check_capabilities() ) { $settings['sections'][ $id ] = $section->json(); } } foreach ( $this->panels() as $panel_id => $panel ) { if ( $panel->check_capabilities() ) { $settings['panels'][ $panel_id ] = $panel->json(); foreach ( $panel->sections as $section_id => $section ) { if ( $section->check_capabilities() ) { $settings['sections'][ $section_id ] = $section->json(); } } } } ?> - - array( 'label' => __( 'Enter desktop preview mode' ), 'default' => true, ), 'tablet' => array( 'label' => __( 'Enter tablet preview mode' ), ), 'mobile' => array( 'label' => __( 'Enter mobile preview mode' ), ), ); $devices = apply_filters( 'customize_previewable_devices', $devices ); return $devices; } public function register_controls() { $this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array( 'title' => $this->theme()->display( 'Name' ), 'description' => ( '

                ' . __( 'Looking for a theme? You can search or browse the WordPress.org theme directory, install and preview themes, then activate them right here.' ) . '

                ' . '

                ' . __( 'While previewing a new theme, you can continue to tailor things like widgets and menus, and explore theme-specific options.' ) . '

                ' ), 'capability' => 'switch_themes', 'priority' => 0, ) ) ); $this->add_section( new WP_Customize_Themes_Section( $this, 'installed_themes', array( 'title' => __( 'Installed themes' ), 'action' => 'installed', 'capability' => 'switch_themes', 'panel' => 'themes', 'priority' => 0, ) ) ); if ( ! is_multisite() ) { $this->add_section( new WP_Customize_Themes_Section( $this, 'wporg_themes', array( 'title' => __( 'WordPress.org themes' ), 'action' => 'wporg', 'filter_type' => 'remote', 'capability' => 'install_themes', 'panel' => 'themes', 'priority' => 5, ) ) ); } $this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array( 'capability' => 'switch_themes', ) ) ); $this->add_section( 'title_tagline', array( 'title' => __( 'Site Identity' ), 'priority' => 20, ) ); $this->add_setting( 'blogname', array( 'default' => get_option( 'blogname' ), 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'blogname', array( 'label' => __( 'Site Title' ), 'section' => 'title_tagline', ) ); $this->add_setting( 'blogdescription', array( 'default' => get_option( 'blogdescription' ), 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'blogdescription', array( 'label' => __( 'Tagline' ), 'section' => 'title_tagline', ) ); if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { $this->add_setting( 'header_text', array( 'theme_supports' => array( 'custom-logo', 'header-text' ), 'default' => 1, 'sanitize_callback' => 'absint', ) ); $this->add_control( 'header_text', array( 'label' => __( 'Display Site Title and Tagline' ), 'section' => 'title_tagline', 'settings' => 'header_text', 'type' => 'checkbox', ) ); } $this->add_setting( 'site_icon', array( 'type' => 'option', 'capability' => 'manage_options', 'transport' => 'postMessage', ) ); $this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array( 'label' => __( 'Site Icon' ), 'description' => sprintf( '

                ' . __( 'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here!' ) . '

                ' . '

                ' . __( 'Site Icons should be square and at least %s pixels.' ) . '

                ', '512 × 512' ), 'section' => 'title_tagline', 'priority' => 60, 'height' => 512, 'width' => 512, ) ) ); $this->add_setting( 'custom_logo', array( 'theme_supports' => array( 'custom-logo' ), 'transport' => 'postMessage', ) ); $custom_logo_args = get_theme_support( 'custom-logo' ); $this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array( 'label' => __( 'Logo' ), 'section' => 'title_tagline', 'priority' => 8, 'height' => isset( $custom_logo_args[0]['height'] ) ? $custom_logo_args[0]['height'] : null, 'width' => isset( $custom_logo_args[0]['width'] ) ? $custom_logo_args[0]['width'] : null, 'flex_height' => isset( $custom_logo_args[0]['flex-height'] ) ? $custom_logo_args[0]['flex-height'] : null, 'flex_width' => isset( $custom_logo_args[0]['flex-width'] ) ? $custom_logo_args[0]['flex-width'] : null, 'button_labels' => array( 'select' => __( 'Select logo' ), 'change' => __( 'Change logo' ), 'remove' => __( 'Remove' ), 'default' => __( 'Default' ), 'placeholder' => __( 'No logo selected' ), 'frame_title' => __( 'Select logo' ), 'frame_button' => __( 'Choose logo' ), ), ) ) ); $this->selective_refresh->add_partial( 'custom_logo', array( 'settings' => array( 'custom_logo' ), 'selector' => '.custom-logo-link', 'render_callback' => array( $this, '_render_custom_logo_partial' ), 'container_inclusive' => true, ) ); $this->add_section( 'colors', array( 'title' => __( 'Colors' ), 'priority' => 40, ) ); $this->add_setting( 'header_textcolor', array( 'theme_supports' => array( 'custom-header', 'header-text' ), 'default' => get_theme_support( 'custom-header', 'default-text-color' ), 'sanitize_callback' => array( $this, '_sanitize_header_textcolor' ), 'sanitize_js_callback' => 'maybe_hash_hex_color', ) ); $this->add_control( 'display_header_text', array( 'settings' => 'header_textcolor', 'label' => __( 'Display Site Title and Tagline' ), 'section' => 'title_tagline', 'type' => 'checkbox', 'priority' => 40, ) ); $this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array( 'label' => __( 'Header Text Color' ), 'section' => 'colors', ) ) ); $this->add_setting( 'background_color', array( 'default' => get_theme_support( 'custom-background', 'default-color' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', ) ); $this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array( 'label' => __( 'Background Color' ), 'section' => 'colors', ) ) ); if ( current_theme_supports( 'custom-header', 'video' ) ) { $title = __( 'Header Media' ); $description = '

                ' . __( 'If you add a video, the image will be used as a fallback while the video loads.' ) . '

                '; $width = absint( get_theme_support( 'custom-header', 'width' ) ); $height = absint( get_theme_support( 'custom-header', 'height' ) ); if ( $width && $height ) { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.' ), '.mp4', sprintf( '%s × %s', $width, $height ) ); } elseif ( $width ) { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.' ), '.mp4', sprintf( '%s', $width ) ); } else { $control_description = sprintf( __( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.' ), '.mp4', sprintf( '%s', $height ) ); } } else { $title = __( 'Header Image' ); $description = ''; $control_description = ''; } $this->add_section( 'header_image', array( 'title' => $title, 'description' => $description, 'theme_supports' => 'custom-header', 'priority' => 60, ) ); $this->add_setting( 'header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'transport' => 'postMessage', 'sanitize_callback' => 'absint', 'validate_callback' => array( $this, '_validate_header_video' ), ) ); $this->add_setting( 'external_header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'transport' => 'postMessage', 'sanitize_callback' => array( $this, '_sanitize_external_header_video' ), 'validate_callback' => array( $this, '_validate_external_header_video' ), ) ); $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array( 'default' => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ), 'theme_supports' => 'custom-header', ) ) ); $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array( 'theme_supports' => 'custom-header', ) ) ); if ( current_theme_supports( 'custom-header', 'video' ) ) { $this->get_setting( 'header_image' )->transport = 'postMessage'; $this->get_setting( 'header_image_data' )->transport = 'postMessage'; } $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'label' => __( 'Header Video' ), 'description' => $control_description, 'section' => 'header_image', 'mime_type' => 'video', 'active_callback' => 'is_header_video_active', ) ) ); $this->add_control( 'external_header_video', array( 'theme_supports' => array( 'custom-header', 'video' ), 'type' => 'url', 'description' => __( 'Or, enter a YouTube URL:' ), 'section' => 'header_image', 'active_callback' => 'is_header_video_active', ) ); $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); $this->selective_refresh->add_partial( 'custom_header', array( 'selector' => '#wp-custom-header', 'render_callback' => 'the_custom_header_markup', 'settings' => array( 'header_video', 'external_header_video', 'header_image' ), 'container_inclusive' => true, ) ); $this->add_section( 'background_image', array( 'title' => __( 'Background Image' ), 'theme_supports' => 'custom-background', 'priority' => 80, ) ); $this->add_setting( 'background_image', array( 'default' => get_theme_support( 'custom-background', 'default-image' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array( 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ) ); $this->add_control( new WP_Customize_Background_Image_Control( $this ) ); $this->add_setting( 'background_preset', array( 'default' => get_theme_support( 'custom-background', 'default-preset' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( 'background_preset', array( 'label' => _x( 'Preset', 'Background Preset' ), 'section' => 'background_image', 'type' => 'select', 'choices' => array( 'default' => _x( 'Default', 'Default Preset' ), 'fill' => __( 'Fill Screen' ), 'fit' => __( 'Fit to Screen' ), 'repeat' => _x( 'Repeat', 'Repeat Image' ), 'custom' => _x( 'Custom', 'Custom Preset' ), ), ) ); $this->add_setting( 'background_position_x', array( 'default' => get_theme_support( 'custom-background', 'default-position-x' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_setting( 'background_position_y', array( 'default' => get_theme_support( 'custom-background', 'default-position-y' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( new WP_Customize_Background_Position_Control( $this, 'background_position', array( 'label' => __( 'Image Position' ), 'section' => 'background_image', 'settings' => array( 'x' => 'background_position_x', 'y' => 'background_position_y', ), ) ) ); $this->add_setting( 'background_size', array( 'default' => get_theme_support( 'custom-background', 'default-size' ), 'theme_supports' => 'custom-background', 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), ) ); $this->add_control( 'background_size', array( 'label' => __( 'Image Size' ), 'section' => 'background_image', 'type' => 'select', 'choices' => array( 'auto' => _x( 'Original', 'Original Size' ), 'contain' => __( 'Fit to Screen' ), 'cover' => __( 'Fill Screen' ), ), ) ); $this->add_setting( 'background_repeat', array( 'default' => get_theme_support( 'custom-background', 'default-repeat' ), 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), 'theme_supports' => 'custom-background', ) ); $this->add_control( 'background_repeat', array( 'label' => __( 'Repeat Background Image' ), 'section' => 'background_image', 'type' => 'checkbox', ) ); $this->add_setting( 'background_attachment', array( 'default' => get_theme_support( 'custom-background', 'default-attachment' ), 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), 'theme_supports' => 'custom-background', ) ); $this->add_control( 'background_attachment', array( 'label' => __( 'Scroll with Page' ), 'section' => 'background_image', 'type' => 'checkbox', ) ); if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) { foreach ( array( 'color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment' ) as $prop ) { $this->get_setting( 'background_' . $prop )->transport = 'postMessage'; } } $this->add_section( 'static_front_page', array( 'title' => __( 'Homepage Settings' ), 'priority' => 120, 'description' => __( 'You can choose what’s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two Pages. One will become the homepage, and the other will be where your posts are displayed.' ), 'active_callback' => array( $this, 'has_published_pages' ), ) ); $this->add_setting( 'show_on_front', array( 'default' => get_option( 'show_on_front' ), 'capability' => 'manage_options', 'type' => 'option', ) ); $this->add_control( 'show_on_front', array( 'label' => __( 'Your homepage displays' ), 'section' => 'static_front_page', 'type' => 'radio', 'choices' => array( 'posts' => __( 'Your latest posts' ), 'page' => __( 'A static page' ), ), ) ); $this->add_setting( 'page_on_front', array( 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'page_on_front', array( 'label' => __( 'Homepage' ), 'section' => 'static_front_page', 'type' => 'dropdown-pages', 'allow_addition' => true, ) ); $this->add_setting( 'page_for_posts', array( 'type' => 'option', 'capability' => 'manage_options', ) ); $this->add_control( 'page_for_posts', array( 'label' => __( 'Posts page' ), 'section' => 'static_front_page', 'type' => 'dropdown-pages', 'allow_addition' => true, ) ); $section_description = '

                '; $section_description .= __( 'Add your own CSS code here to customize the appearance and layout of your site.' ); $section_description .= sprintf( ' %2$s %3$s', esc_url( __( 'https://codex.wordpress.org/CSS' ) ), __( 'Learn more about CSS' ), __( '(opens in a new tab)' ) ); $section_description .= '

                '; $section_description .= '

                ' . __( 'When using a keyboard to navigate:' ) . '

                '; $section_description .= '
                  '; $section_description .= '
                • ' . __( 'In the editing area, the Tab key enters a tab character.' ) . '
                • '; $section_description .= '
                • ' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '
                • '; $section_description .= '
                • ' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '
                • '; $section_description .= '
                '; if ( 'false' !== wp_get_current_user()->syntax_highlighting ) { $section_description .= '

                '; $section_description .= sprintf( __( 'The edit field automatically highlights code syntax. You can disable this in your user profile%3$s to work in plain text mode.' ), esc_url( get_edit_profile_url() ), 'class="external-link" target="_blank"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); $section_description .= '

                '; } $section_description .= '

                '; $section_description .= ''; $section_description .= '

                '; $this->add_section( 'custom_css', array( 'title' => __( 'Additional CSS' ), 'priority' => 200, 'description_hidden' => true, 'description' => $section_description, ) ); $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 'capability' => 'edit_css', 'default' => '', ) ); $this->add_setting( $custom_css_setting ); $this->add_control( new WP_Customize_Code_Editor_Control( $this, 'custom_css', array( 'label' => __( 'CSS code' ), 'section' => 'custom_css', 'settings' => array( 'default' => $custom_css_setting->id ), 'code_type' => 'text/css', 'input_attrs' => array( 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', ), ) ) ); } public function has_published_pages() { $setting = $this->get_setting( 'nav_menus_created_posts' ); if ( $setting ) { foreach ( $setting->value() as $post_id ) { if ( 'page' === get_post_type( $post_id ) ) { return true; } } } return 0 !== count( get_pages( array( 'number' => 1 ) ) ); } public function register_dynamic_settings() { $setting_ids = array_keys( $this->unsanitized_post_values() ); $this->add_dynamic_settings( $setting_ids ); } public function handle_load_themes_request() { check_ajax_referer( 'switch_themes', 'nonce' ); if ( ! current_user_can( 'switch_themes' ) ) { wp_die( -1 ); } if ( empty( $_POST['theme_action'] ) ) { wp_send_json_error( 'missing_theme_action' ); } $theme_action = sanitize_key( $_POST['theme_action'] ); $themes = array(); $args = array(); if ( ! array_key_exists( 'search', $_POST ) ) { $args['search'] = ''; } else { $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) ); } if ( ! array_key_exists( 'tags', $_POST ) ) { $args['tag'] = ''; } else { $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) ); } if ( ! array_key_exists( 'page', $_POST ) ) { $args['page'] = 1; } else { $args['page'] = absint( $_POST['page'] ); } require_once ABSPATH . 'wp-admin/includes/theme.php'; if ( 'installed' === $theme_action ) { $themes = array( 'themes' => array() ); foreach ( wp_prepare_themes_for_js() as $theme ) { $theme['type'] = 'installed'; $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] ); $themes['themes'][] = $theme; } } elseif ( 'wporg' === $theme_action ) { if ( ! current_user_can( 'install_themes' ) ) { wp_die( -1 ); } $wporg_args = array( 'per_page' => 100, 'fields' => array( 'reviews_url' => true, ), ); $args = array_merge( $wporg_args, $args ); if ( '' === $args['search'] && '' === $args['tag'] ) { $args['browse'] = 'new'; } $themes = themes_api( 'query_themes', $args ); if ( is_wp_error( $themes ) ) { wp_send_json_error(); } $themes_allowedtags = array_fill_keys( array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ), array() ); $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true ); $themes_allowedtags['acronym']['title'] = true; $themes_allowedtags['abbr']['title'] = true; $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true ); $installed_themes = array(); $wp_themes = wp_get_themes(); foreach ( $wp_themes as $theme ) { $installed_themes[] = $theme->get_stylesheet(); } $update_php = network_admin_url( 'update.php?action=install-theme' ); foreach ( $themes->themes as &$theme ) { $theme->install_url = add_query_arg( array( 'theme' => $theme->slug, '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), ), $update_php ); $theme->name = wp_kses( $theme->name, $themes_allowedtags ); $theme->version = wp_kses( $theme->version, $themes_allowedtags ); $theme->description = wp_kses( $theme->description, $themes_allowedtags ); $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false, ) ); $theme->num_ratings = number_format_i18n( $theme->num_ratings ); $theme->preview_url = set_url_scheme( $theme->preview_url ); if ( in_array( $theme->slug, $installed_themes, true ) ) { $theme->type = 'installed'; } else { $theme->type = $theme_action; } $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug ); $theme->id = $theme->slug; $theme->screenshot = array( $theme->screenshot_url ); $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags ); $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); if ( isset( $theme->parent ) ) { $theme->parent = $theme->parent['slug']; } else { $theme->parent = false; } unset( $theme->slug ); unset( $theme->screenshot_url ); unset( $theme->author ); } } $themes = apply_filters( 'customize_load_themes', $themes, $args, $this ); wp_send_json_success( $themes ); } public function _sanitize_header_textcolor( $color ) { if ( 'blank' === $color ) { return 'blank'; } $color = sanitize_hex_color_no_hash( $color ); if ( empty( $color ) ) { $color = get_theme_support( 'custom-header', 'default-text-color' ); } return $color; } public function _sanitize_background_setting( $value, $setting ) { if ( 'background_repeat' === $setting->id ) { if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) ); } } elseif ( 'background_attachment' === $setting->id ) { if ( ! in_array( $value, array( 'fixed', 'scroll' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) ); } } elseif ( 'background_position_x' === $setting->id ) { if ( ! in_array( $value, array( 'left', 'center', 'right' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background position X.' ) ); } } elseif ( 'background_position_y' === $setting->id ) { if ( ! in_array( $value, array( 'top', 'center', 'bottom' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background position Y.' ) ); } } elseif ( 'background_size' === $setting->id ) { if ( ! in_array( $value, array( 'auto', 'contain', 'cover' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) ); } } elseif ( 'background_preset' === $setting->id ) { if ( ! in_array( $value, array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) { return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) ); } } elseif ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) { $value = empty( $value ) ? '' : esc_url_raw( $value ); } else { return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) ); } return $value; } public function export_header_video_settings( $response, $selective_refresh, $partials ) { if ( isset( $partials['custom_header'] ) ) { $response['custom_header_settings'] = get_header_video_settings(); } return $response; } public function _validate_header_video( $validity, $value ) { $video = get_attached_file( absint( $value ) ); if ( $video ) { $size = filesize( $video ); if ( $size > 8 * MB_IN_BYTES ) { $validity->add( 'size_too_large', __( 'This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.' ) ); } if ( '.mp4' !== substr( $video, -4 ) && '.mov' !== substr( $video, -4 ) ) { $validity->add( 'invalid_file_type', sprintf( __( 'Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ), '.mp4', '.mov' ) ); } } return $validity; } public function _validate_external_header_video( $validity, $value ) { $video = esc_url_raw( $value ); if ( $video ) { if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) { $validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) ); } } return $validity; } public function _sanitize_external_header_video( $value ) { return esc_url_raw( trim( $value ) ); } public function _render_custom_logo_partial() { return get_custom_logo(); } } '; do_action( 'rss_tag_pre', 'rdf' ); ?> - -> - - <?php wp_title_rss(); ?> - - - - - - - - - - 2000-01-01T12:00+00:00 - - - - - - - - - - - - <?php the_title_rss(); ?> - - - ]]> - post_date_gmt, false ); ?> - - - - ]]> - - ]]> - ]]> - - - - - - -add_rule( $regex, $query, $after ); } function add_rewrite_tag( $tag, $regex, $query = '' ) { if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) { return; } global $wp_rewrite, $wp; if ( empty( $query ) ) { $qv = trim( $tag, '%' ); $wp->add_query_var( $qv ); $query = $qv . '='; } $wp_rewrite->add_rewrite_tag( $tag, $regex, $query ); } function remove_rewrite_tag( $tag ) { global $wp_rewrite; $wp_rewrite->remove_rewrite_tag( $tag ); } function add_permastruct( $name, $struct, $args = array() ) { global $wp_rewrite; if ( ! is_array( $args ) ) { $args = array( 'with_front' => $args ); } if ( func_num_args() == 4 ) { $args['ep_mask'] = func_get_arg( 3 ); } $wp_rewrite->add_permastruct( $name, $struct, $args ); } function remove_permastruct( $name ) { global $wp_rewrite; $wp_rewrite->remove_permastruct( $name ); } function add_feed( $feedname, $function ) { global $wp_rewrite; if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) { $wp_rewrite->feeds[] = $feedname; } $hook = 'do_feed_' . $feedname; remove_action( $hook, $hook ); add_action( $hook, $function, 10, 2 ); return $hook; } function flush_rewrite_rules( $hard = true ) { global $wp_rewrite; if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) { $wp_rewrite->flush_rules( $hard ); } } function add_rewrite_endpoint( $name, $places, $query_var = true ) { global $wp_rewrite; $wp_rewrite->add_endpoint( $name, $places, $query_var ); } function _wp_filter_taxonomy_base( $base ) { if ( ! empty( $base ) ) { $base = preg_replace( '|^/index\.php/|', '', $base ); $base = trim( $base, '/' ); } return $base; } function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) { if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) { return $query_vars; } $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) ); $postname_index = array_search( '%postname%', $permastructs, true ); if ( false === $postname_index ) { return $query_vars; } $compare = ''; if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) { $compare = 'year'; } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) { $compare = 'monthnum'; } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) { $compare = 'day'; } if ( ! $compare ) { return $query_vars; } $value = $query_vars[ $compare ]; $post = get_page_by_path( $value, OBJECT, 'post' ); if ( ! ( $post instanceof WP_Post ) ) { return $query_vars; } if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) { if ( (int) $query_vars['year'] !== (int) $matches[1] ) { return $query_vars; } if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) { return $query_vars; } } $maybe_page = ''; if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) { $maybe_page = $query_vars['monthnum']; } elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) { $maybe_page = $query_vars['day']; } $maybe_page = (int) trim( $maybe_page, '/' ); $post_page_count = substr_count( $post->post_content, '' ) + 1; if ( 1 === $post_page_count && $maybe_page ) { return $query_vars; } if ( $post_page_count > 1 && $maybe_page > $post_page_count ) { return $query_vars; } if ( '' !== $maybe_page ) { $query_vars['page'] = (int) $maybe_page; } unset( $query_vars['year'] ); unset( $query_vars['monthnum'] ); unset( $query_vars['day'] ); $query_vars['name'] = $post->post_name; return $query_vars; } function url_to_postid( $url ) { global $wp_rewrite; $url = apply_filters( 'url_to_postid', $url ); $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) ); $home_url_host = str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); if ( $url_host && $url_host !== $home_url_host ) { return 0; } if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) { $id = absint( $values[2] ); if ( $id ) { return $id; } } $url_split = explode( '#', $url ); $url = $url_split[0]; $url_split = explode( '?', $url ); $url = $url_split[0]; $scheme = parse_url( home_url(), PHP_URL_SCHEME ); $url = set_url_scheme( $url, $scheme ); if ( false !== strpos( home_url(), '://www.' ) && false === strpos( $url, '://www.' ) ) { $url = str_replace( '://', '://www.', $url ); } if ( false === strpos( home_url(), '://www.' ) ) { $url = str_replace( '://www.', '://', $url ); } if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) { $page_on_front = get_option( 'page_on_front' ); if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) { return (int) $page_on_front; } } $rewrite = $wp_rewrite->wp_rewrite_rules(); if ( empty( $rewrite ) ) { return 0; } if ( ! $wp_rewrite->using_index_permalinks() ) { $url = str_replace( $wp_rewrite->index . '/', '', $url ); } if ( false !== strpos( trailingslashit( $url ), home_url( '/' ) ) ) { $url = str_replace( home_url(), '', $url ); } else { $home_path = parse_url( home_url( '/' ) ); $home_path = isset( $home_path['path'] ) ? $home_path['path'] : ''; $url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) ); } $url = trim( $url, '/' ); $request = $url; $post_type_query_vars = array(); foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { if ( ! empty( $t->query_var ) ) { $post_type_query_vars[ $t->query_var ] = $post_type; } } $request_match = $request; foreach ( (array) $rewrite as $match => $query ) { if ( ! empty( $url ) && ( $url != $request ) && ( strpos( $match, $url ) === 0 ) ) { $request_match = $url . '/' . $request; } if ( preg_match( "#^$match#", $request_match, $matches ) ) { if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { $page = get_page_by_path( $matches[ $varmatch[1] ] ); if ( ! $page ) { continue; } $post_status_obj = get_post_status_object( $page->post_status ); if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } $query = preg_replace( '!^.+\?!', '', $query ); $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) ); global $wp; parse_str( $query, $query_vars ); $query = array(); foreach ( (array) $query_vars as $key => $value ) { if ( in_array( (string) $key, $wp->public_query_vars, true ) ) { $query[ $key ] = $value; if ( isset( $post_type_query_vars[ $key ] ) ) { $query['post_type'] = $post_type_query_vars[ $key ]; $query['name'] = $value; } } } $query = wp_resolve_numeric_slug_conflicts( $query ); $query = new WP_Query( $query ); if ( ! empty( $query->posts ) && $query->is_singular ) { return $query->post->ID; } else { return 0; } } } return 0; } 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return get_option( $deprecated_keys[ $option ], $default ); } $pre = apply_filters( "pre_option_{$option}", false, $option, $default ); if ( false !== $pre ) { return $pre; } if ( defined( 'WP_SETUP_CONFIG' ) ) { return false; } $passed_default = func_num_args() > 1; if ( ! wp_installing() ) { $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( isset( $notoptions[ $option ] ) ) { return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } $alloptions = wp_load_alloptions(); if ( isset( $alloptions[ $option ] ) ) { $value = $alloptions[ $option ]; } else { $value = wp_cache_get( $option, 'options' ); if ( false === $value ) { $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); if ( is_object( $row ) ) { $value = $row->option_value; wp_cache_add( $option, $value, 'options' ); } else { if ( ! is_array( $notoptions ) ) { $notoptions = array(); } $notoptions[ $option ] = true; wp_cache_set( 'notoptions', $notoptions, 'options' ); return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } } } } else { $suppress = $wpdb->suppress_errors(); $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); $wpdb->suppress_errors( $suppress ); if ( is_object( $row ) ) { $value = $row->option_value; } else { return apply_filters( "default_option_{$option}", $default, $option, $passed_default ); } } if ( 'home' === $option && '' === $value ) { return get_option( 'siteurl' ); } if ( in_array( $option, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) { $value = untrailingslashit( $value ); } return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option ); } function wp_protect_special_option( $option ) { if ( 'alloptions' === $option || 'notoptions' === $option ) { wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); } } function form_option( $option ) { echo esc_attr( get_option( $option ) ); } function wp_load_alloptions( $force_cache = false ) { global $wpdb; if ( ! wp_installing() || ! is_multisite() ) { $alloptions = wp_cache_get( 'alloptions', 'options', $force_cache ); } else { $alloptions = false; } if ( ! $alloptions ) { $suppress = $wpdb->suppress_errors(); $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ); if ( ! $alloptions_db ) { $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); } $wpdb->suppress_errors( $suppress ); $alloptions = array(); foreach ( (array) $alloptions_db as $o ) { $alloptions[ $o->option_name ] = $o->option_value; } if ( ! wp_installing() || ! is_multisite() ) { $alloptions = apply_filters( 'pre_cache_alloptions', $alloptions ); wp_cache_add( 'alloptions', $alloptions, 'options' ); } } return apply_filters( 'alloptions', $alloptions ); } function wp_load_core_site_options( $network_id = null ) { global $wpdb; if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) { return; } if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $core_options = array( 'site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); $core_options_in = "'" . implode( "', '", $core_options ) . "'"; $options = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) ); $data = array(); foreach ( $options as $option ) { $key = $option->meta_key; $cache_key = "{$network_id}:$key"; $option->meta_value = maybe_unserialize( $option->meta_value ); $data[ $cache_key ] = $option->meta_value; } wp_cache_set_multiple( $data, 'site-options' ); } function update_option( $option, $value, $autoload = null ) { global $wpdb; if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return update_option( $deprecated_keys[ $option ], $value, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); $old_value = get_option( $option ); $value = apply_filters( "pre_update_option_{$option}", $value, $old_value, $option ); $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) { return false; } if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) { if ( null === $autoload ) { $autoload = 'yes'; } return add_option( $option, $value, '', $autoload ); } $serialized_value = maybe_serialize( $value ); do_action( 'update_option', $option, $old_value, $value ); $update_args = array( 'option_value' => $serialized_value, ); if ( null !== $autoload ) { $update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; } $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); if ( ! $result ) { return false; } $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } if ( ! wp_installing() ) { $alloptions = wp_load_alloptions( true ); if ( isset( $alloptions[ $option ] ) ) { $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } do_action( "update_option_{$option}", $old_value, $value, $option ); do_action( 'updated_option', $option, $old_value, $value ); return true; } function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.3.0' ); } if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } $deprecated_keys = array( 'blacklist_keys' => 'disallowed_keys', 'comment_whitelist' => 'comment_previously_approved', ); if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) { _deprecated_argument( __FUNCTION__, '5.5.0', sprintf( __( 'The "%1$s" option key has been renamed to "%2$s".' ), $option, $deprecated_keys[ $option ] ) ); return add_option( $deprecated_keys[ $option ], $value, $deprecated, $autoload ); } wp_protect_special_option( $option ); if ( is_object( $value ) ) { $value = clone $value; } $value = sanitize_option( $option, $value ); $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) ) { return false; } } $serialized_value = maybe_serialize( $value ); $autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; do_action( 'add_option', $option, $value ); $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) ); if ( ! $result ) { return false; } if ( ! wp_installing() ) { if ( 'yes' === $autoload ) { $alloptions = wp_load_alloptions( true ); $alloptions[ $option ] = $serialized_value; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { wp_cache_set( $option, $serialized_value, 'options' ); } } $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } do_action( "add_option_{$option}", $option, $value ); do_action( 'added_option', $option, $value ); return true; } function delete_option( $option ) { global $wpdb; if ( is_scalar( $option ) ) { $option = trim( $option ); } if ( empty( $option ) ) { return false; } wp_protect_special_option( $option ); $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) ); if ( is_null( $row ) ) { return false; } do_action( 'delete_option', $option ); $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); if ( ! wp_installing() ) { if ( 'yes' === $row->autoload ) { $alloptions = wp_load_alloptions( true ); if ( is_array( $alloptions ) && isset( $alloptions[ $option ] ) ) { unset( $alloptions[ $option ] ); wp_cache_set( 'alloptions', $alloptions, 'options' ); } } else { wp_cache_delete( $option, 'options' ); } } if ( $result ) { do_action( "delete_option_{$option}", $option ); do_action( 'deleted_option', $option ); return true; } return false; } function delete_transient( $transient ) { do_action( "delete_transient_{$transient}", $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_delete( $transient, 'transient' ); } else { $option_timeout = '_transient_timeout_' . $transient; $option = '_transient_' . $transient; $result = delete_option( $option ); if ( $result ) { delete_option( $option_timeout ); } } if ( $result ) { do_action( 'deleted_transient', $transient ); } return $result; } function get_transient( $transient ) { $pre = apply_filters( "pre_transient_{$transient}", false, $transient ); if ( false !== $pre ) { return $pre; } if ( wp_using_ext_object_cache() || wp_installing() ) { $value = wp_cache_get( $transient, 'transient' ); } else { $transient_option = '_transient_' . $transient; if ( ! wp_installing() ) { $alloptions = wp_load_alloptions(); if ( ! isset( $alloptions[ $transient_option ] ) ) { $transient_timeout = '_transient_timeout_' . $transient; $timeout = get_option( $transient_timeout ); if ( false !== $timeout && $timeout < time() ) { delete_option( $transient_option ); delete_option( $transient_timeout ); $value = false; } } } if ( ! isset( $value ) ) { $value = get_option( $transient_option ); } } return apply_filters( "transient_{$transient}", $value, $transient ); } function set_transient( $transient, $value, $expiration = 0 ) { $expiration = (int) $expiration; $value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient ); $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_set( $transient, $value, 'transient', $expiration ); } else { $transient_timeout = '_transient_timeout_' . $transient; $transient_option = '_transient_' . $transient; if ( false === get_option( $transient_option ) ) { $autoload = 'yes'; if ( $expiration ) { $autoload = 'no'; add_option( $transient_timeout, time() + $expiration, '', 'no' ); } $result = add_option( $transient_option, $value, '', $autoload ); } else { $update = true; if ( $expiration ) { if ( false === get_option( $transient_timeout ) ) { delete_option( $transient_option ); add_option( $transient_timeout, time() + $expiration, '', 'no' ); $result = add_option( $transient_option, $value, '', 'no' ); $update = false; } else { update_option( $transient_timeout, time() + $expiration ); } } if ( $update ) { $result = update_option( $transient_option, $value ); } } } if ( $result ) { do_action( "set_transient_{$transient}", $value, $expiration, $transient ); do_action( 'setted_transient', $transient, $value, $expiration ); } return $result; } function delete_expired_transients( $force_db = false ) { global $wpdb; if ( ! $force_db && wp_using_ext_object_cache() ) { return; } $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b - WHERE a.option_name LIKE %s - AND a.option_name NOT LIKE %s - AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) - AND b.option_value < %d", $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', time() ) ); if ( ! is_multisite() ) { $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b - WHERE a.option_name LIKE %s - AND a.option_name NOT LIKE %s - AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) - AND b.option_value < %d", $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', time() ) ); } elseif ( is_multisite() && is_main_site() && is_main_network() ) { $wpdb->query( $wpdb->prepare( "DELETE a, b FROM {$wpdb->sitemeta} a, {$wpdb->sitemeta} b - WHERE a.meta_key LIKE %s - AND a.meta_key NOT LIKE %s - AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) ) - AND b.meta_value < %d", $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', time() ) ); } } function wp_user_settings() { if ( ! is_admin() || wp_doing_ajax() ) { return; } $user_id = get_current_user_id(); if ( ! $user_id ) { return; } if ( ! is_user_member_of_blog() ) { return; } $settings = (string) get_user_option( 'user-settings', $user_id ); if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) { $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] ); if ( $cookie == $settings ) { return; } $last_saved = (int) get_user_option( 'user-settings-time', $user_id ); $current = isset( $_COOKIE[ 'wp-settings-time-' . $user_id ] ) ? preg_replace( '/[^0-9]/', '', $_COOKIE[ 'wp-settings-time-' . $user_id ] ) : 0; if ( $current > $last_saved ) { update_user_option( $user_id, 'user-settings', $cookie, false ); update_user_option( $user_id, 'user-settings-time', time() - 5, false ); return; } } $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) ); setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); $_COOKIE[ 'wp-settings-' . $user_id ] = $settings; } function get_user_setting( $name, $default = false ) { $all_user_settings = get_all_user_settings(); return isset( $all_user_settings[ $name ] ) ? $all_user_settings[ $name ] : $default; } function set_user_setting( $name, $value ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $all_user_settings[ $name ] = $value; return wp_set_all_user_settings( $all_user_settings ); } function delete_user_setting( $names ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $names = (array) $names; $deleted = false; foreach ( $names as $name ) { if ( isset( $all_user_settings[ $name ] ) ) { unset( $all_user_settings[ $name ] ); $deleted = true; } } if ( $deleted ) { return wp_set_all_user_settings( $all_user_settings ); } return false; } function get_all_user_settings() { global $_updated_user_settings; $user_id = get_current_user_id(); if ( ! $user_id ) { return array(); } if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) { return $_updated_user_settings; } $user_settings = array(); if ( isset( $_COOKIE[ 'wp-settings-' . $user_id ] ) ) { $cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE[ 'wp-settings-' . $user_id ] ); if ( strpos( $cookie, '=' ) ) { parse_str( $cookie, $user_settings ); } } else { $option = get_user_option( 'user-settings', $user_id ); if ( $option && is_string( $option ) ) { parse_str( $option, $user_settings ); } } $_updated_user_settings = $user_settings; return $user_settings; } function wp_set_all_user_settings( $user_settings ) { global $_updated_user_settings; $user_id = get_current_user_id(); if ( ! $user_id ) { return false; } if ( ! is_user_member_of_blog() ) { return; } $settings = ''; foreach ( $user_settings as $name => $value ) { $_name = preg_replace( '/[^A-Za-z0-9_-]+/', '', $name ); $_value = preg_replace( '/[^A-Za-z0-9_-]+/', '', $value ); if ( ! empty( $_name ) ) { $settings .= $_name . '=' . $_value . '&'; } } $settings = rtrim( $settings, '&' ); parse_str( $settings, $_updated_user_settings ); update_user_option( $user_id, 'user-settings', $settings, false ); update_user_option( $user_id, 'user-settings-time', time(), false ); return true; } function delete_all_user_settings() { $user_id = get_current_user_id(); if ( ! $user_id ) { return; } update_user_option( $user_id, 'user-settings', '', false ); setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); } function get_site_option( $option, $default = false, $deprecated = true ) { return get_network_option( null, $option, $default ); } function add_site_option( $option, $value ) { return add_network_option( null, $option, $value ); } function delete_site_option( $option ) { return delete_network_option( null, $option ); } function update_site_option( $option, $value ) { return update_network_option( null, $option, $value ); } function get_network_option( $network_id, $option, $default = false ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } $pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default ); if ( false !== $pre ) { return $pre; } $notoptions_key = "$network_id:notoptions"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { return apply_filters( "default_site_option_{$option}", $default, $option, $network_id ); } if ( ! is_multisite() ) { $default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); $value = get_option( $option, $default ); } else { $cache_key = "$network_id:$option"; $value = wp_cache_get( $cache_key, 'site-options' ); if ( ! isset( $value ) || false === $value ) { $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); if ( is_object( $row ) ) { $value = $row->meta_value; $value = maybe_unserialize( $value ); wp_cache_set( $cache_key, $value, 'site-options' ); } else { if ( ! is_array( $notoptions ) ) { $notoptions = array(); } $notoptions[ $option ] = true; wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); $value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id ); } } } if ( ! is_array( $notoptions ) ) { $notoptions = array(); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } return apply_filters( "site_option_{$option}", $value, $option, $network_id ); } function add_network_option( $network_id, $option, $value ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } wp_protect_special_option( $option ); $value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id ); $notoptions_key = "$network_id:notoptions"; if ( ! is_multisite() ) { $result = add_option( $option, $value, '', 'no' ); } else { $cache_key = "$network_id:$option"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { if ( false !== get_network_option( $network_id, $option, false ) ) { return false; } } $value = sanitize_option( $option, $value ); $serialized_value = maybe_serialize( $value ); $result = $wpdb->insert( $wpdb->sitemeta, array( 'site_id' => $network_id, 'meta_key' => $option, 'meta_value' => $serialized_value, ) ); if ( ! $result ) { return false; } wp_cache_set( $cache_key, $value, 'site-options' ); $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } } if ( $result ) { do_action( "add_site_option_{$option}", $option, $value, $network_id ); do_action( 'add_site_option', $option, $value, $network_id ); return true; } return false; } function delete_network_option( $network_id, $option ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } do_action( "pre_delete_site_option_{$option}", $option, $network_id ); if ( ! is_multisite() ) { $result = delete_option( $option ); } else { $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); if ( is_null( $row ) || ! $row->meta_id ) { return false; } $cache_key = "$network_id:$option"; wp_cache_delete( $cache_key, 'site-options' ); $result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $network_id, ) ); } if ( $result ) { do_action( "delete_site_option_{$option}", $option, $network_id ); do_action( 'delete_site_option', $option, $network_id ); return true; } return false; } function update_network_option( $network_id, $option, $value ) { global $wpdb; if ( $network_id && ! is_numeric( $network_id ) ) { return false; } $network_id = (int) $network_id; if ( ! $network_id ) { $network_id = get_current_network_id(); } wp_protect_special_option( $option ); $old_value = get_network_option( $network_id, $option, false ); $value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id ); if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) { return false; } if ( false === $old_value ) { return add_network_option( $network_id, $option, $value ); } $notoptions_key = "$network_id:notoptions"; $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { unset( $notoptions[ $option ] ); wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); } if ( ! is_multisite() ) { $result = update_option( $option, $value, 'no' ); } else { $value = sanitize_option( $option, $value ); $serialized_value = maybe_serialize( $value ); $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option, ) ); if ( $result ) { $cache_key = "$network_id:$option"; wp_cache_set( $cache_key, $value, 'site-options' ); } } if ( $result ) { do_action( "update_site_option_{$option}", $option, $value, $old_value, $network_id ); do_action( 'update_site_option', $option, $value, $old_value, $network_id ); return true; } return false; } function delete_site_transient( $transient ) { do_action( "delete_site_transient_{$transient}", $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_delete( $transient, 'site-transient' ); } else { $option_timeout = '_site_transient_timeout_' . $transient; $option = '_site_transient_' . $transient; $result = delete_site_option( $option ); if ( $result ) { delete_site_option( $option_timeout ); } } if ( $result ) { do_action( 'deleted_site_transient', $transient ); } return $result; } function get_site_transient( $transient ) { $pre = apply_filters( "pre_site_transient_{$transient}", false, $transient ); if ( false !== $pre ) { return $pre; } if ( wp_using_ext_object_cache() || wp_installing() ) { $value = wp_cache_get( $transient, 'site-transient' ); } else { $no_timeout = array( 'update_core', 'update_plugins', 'update_themes' ); $transient_option = '_site_transient_' . $transient; if ( ! in_array( $transient, $no_timeout, true ) ) { $transient_timeout = '_site_transient_timeout_' . $transient; $timeout = get_site_option( $transient_timeout ); if ( false !== $timeout && $timeout < time() ) { delete_site_option( $transient_option ); delete_site_option( $transient_timeout ); $value = false; } } if ( ! isset( $value ) ) { $value = get_site_option( $transient_option ); } } return apply_filters( "site_transient_{$transient}", $value, $transient ); } function set_site_transient( $transient, $value, $expiration = 0 ) { $value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient ); $expiration = (int) $expiration; $expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient ); if ( wp_using_ext_object_cache() || wp_installing() ) { $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); } else { $transient_timeout = '_site_transient_timeout_' . $transient; $option = '_site_transient_' . $transient; if ( false === get_site_option( $option ) ) { if ( $expiration ) { add_site_option( $transient_timeout, time() + $expiration ); } $result = add_site_option( $option, $value ); } else { if ( $expiration ) { update_site_option( $transient_timeout, time() + $expiration ); } $result = update_site_option( $option, $value ); } } if ( $result ) { do_action( "set_site_transient_{$transient}", $value, $expiration, $transient ); do_action( 'setted_site_transient', $transient, $value, $expiration ); } return $result; } function register_initial_settings() { register_setting( 'general', 'blogname', array( 'show_in_rest' => array( 'name' => 'title', ), 'type' => 'string', 'description' => __( 'Site title.' ), ) ); register_setting( 'general', 'blogdescription', array( 'show_in_rest' => array( 'name' => 'description', ), 'type' => 'string', 'description' => __( 'Site tagline.' ), ) ); if ( ! is_multisite() ) { register_setting( 'general', 'siteurl', array( 'show_in_rest' => array( 'name' => 'url', 'schema' => array( 'format' => 'uri', ), ), 'type' => 'string', 'description' => __( 'Site URL.' ), ) ); } if ( ! is_multisite() ) { register_setting( 'general', 'admin_email', array( 'show_in_rest' => array( 'name' => 'email', 'schema' => array( 'format' => 'email', ), ), 'type' => 'string', 'description' => __( 'This address is used for admin purposes, like new user notification.' ), ) ); } register_setting( 'general', 'timezone_string', array( 'show_in_rest' => array( 'name' => 'timezone', ), 'type' => 'string', 'description' => __( 'A city in the same timezone as you.' ), ) ); register_setting( 'general', 'date_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A date format for all date strings.' ), ) ); register_setting( 'general', 'time_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'A time format for all time strings.' ), ) ); register_setting( 'general', 'start_of_week', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'A day number of the week that the week should start on.' ), ) ); register_setting( 'general', 'WPLANG', array( 'show_in_rest' => array( 'name' => 'language', ), 'type' => 'string', 'description' => __( 'WordPress locale code.' ), 'default' => 'en_US', ) ); register_setting( 'writing', 'use_smilies', array( 'show_in_rest' => true, 'type' => 'boolean', 'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ), 'default' => true, ) ); register_setting( 'writing', 'default_category', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Default post category.' ), ) ); register_setting( 'writing', 'default_post_format', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'Default post format.' ), ) ); register_setting( 'reading', 'posts_per_page', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Blog pages show at most.' ), 'default' => 10, ) ); register_setting( 'reading', 'show_on_front', array( 'show_in_rest' => true, 'type' => 'string', 'description' => __( 'What to show on the front page' ), ) ); register_setting( 'reading', 'page_on_front', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should be displayed on the front page' ), ) ); register_setting( 'reading', 'page_for_posts', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'The ID of the page that should display the latest posts' ), ) ); register_setting( 'discussion', 'default_ping_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ), ) ); register_setting( 'discussion', 'default_comment_status', array( 'show_in_rest' => array( 'schema' => array( 'enum' => array( 'open', 'closed' ), ), ), 'type' => 'string', 'description' => __( 'Allow people to submit comments on new posts.' ), ) ); } function register_setting( $option_group, $option_name, $args = array() ) { global $new_allowed_options, $wp_registered_settings; $GLOBALS['new_whitelist_options'] = &$new_allowed_options; $defaults = array( 'type' => 'string', 'group' => $option_group, 'description' => '', 'sanitize_callback' => null, 'show_in_rest' => false, ); if ( is_callable( $args ) ) { $args = array( 'sanitize_callback' => $args, ); } $args = apply_filters( 'register_setting_args', $args, $defaults, $option_group, $option_name ); $args = wp_parse_args( $args, $defaults ); if ( false !== $args['show_in_rest'] && 'array' === $args['type'] && ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering an "array" setting to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.4.0' ); } if ( ! is_array( $wp_registered_settings ) ) { $wp_registered_settings = array(); } if ( 'misc' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $option_group = 'general'; } if ( 'privacy' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $option_group = 'reading'; } $new_allowed_options[ $option_group ][] = $option_name; if ( ! empty( $args['sanitize_callback'] ) ) { add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] ); } if ( array_key_exists( 'default', $args ) ) { add_filter( "default_option_{$option_name}", 'filter_default_option', 10, 3 ); } do_action( 'register_setting', $option_group, $option_name, $args ); $wp_registered_settings[ $option_name ] = $args; } function unregister_setting( $option_group, $option_name, $deprecated = '' ) { global $new_allowed_options, $wp_registered_settings; $GLOBALS['new_whitelist_options'] = &$new_allowed_options; if ( 'misc' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $option_group = 'general'; } if ( 'privacy' === $option_group ) { _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); $option_group = 'reading'; } $pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true ); if ( false !== $pos ) { unset( $new_allowed_options[ $option_group ][ $pos ] ); } if ( '' !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.7.0', sprintf( __( '%1$s is deprecated. The callback from %2$s is used instead.' ), '$sanitize_callback', 'register_setting()' ) ); remove_filter( "sanitize_option_{$option_name}", $deprecated ); } if ( isset( $wp_registered_settings[ $option_name ] ) ) { if ( ! empty( $wp_registered_settings[ $option_name ]['sanitize_callback'] ) ) { remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] ); } if ( array_key_exists( 'default', $wp_registered_settings[ $option_name ] ) ) { remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 ); } do_action( 'unregister_setting', $option_group, $option_name ); unset( $wp_registered_settings[ $option_name ] ); } } function get_registered_settings() { global $wp_registered_settings; if ( ! is_array( $wp_registered_settings ) ) { return array(); } return $wp_registered_settings; } function filter_default_option( $default, $option, $passed_default ) { if ( $passed_default ) { return $default; } $registered = get_registered_settings(); if ( empty( $registered[ $option ] ) ) { return $default; } return $registered[ $option ]['default']; } add_filter( $hook_name, $callback, $priority, $accepted_args ); return true; } function apply_filters( $hook_name, $value, ...$args ) { global $wp_filter, $wp_current_filter; if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $value; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } array_unshift( $args, $value ); $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args ); array_pop( $wp_current_filter ); return $filtered; } function apply_filters_ref_array( $hook_name, $args ) { global $wp_filter, $wp_current_filter; if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $args[0]; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args ); array_pop( $wp_current_filter ); return $filtered; } function has_filter( $hook_name, $callback = false ) { global $wp_filter; if ( ! isset( $wp_filter[ $hook_name ] ) ) { return false; } return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback ); } function remove_filter( $hook_name, $callback, $priority = 10 ) { global $wp_filter; $r = false; if ( isset( $wp_filter[ $hook_name ] ) ) { $r = $wp_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority ); if ( ! $wp_filter[ $hook_name ]->callbacks ) { unset( $wp_filter[ $hook_name ] ); } } return $r; } function remove_all_filters( $hook_name, $priority = false ) { global $wp_filter; if ( isset( $wp_filter[ $hook_name ] ) ) { $wp_filter[ $hook_name ]->remove_all_filters( $priority ); if ( ! $wp_filter[ $hook_name ]->has_filters() ) { unset( $wp_filter[ $hook_name ] ); } } return true; } function current_filter() { global $wp_current_filter; return end( $wp_current_filter ); } function doing_filter( $hook_name = null ) { global $wp_current_filter; if ( null === $hook_name ) { return ! empty( $wp_current_filter ); } return in_array( $hook_name, $wp_current_filter, true ); } function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { return add_filter( $hook_name, $callback, $priority, $accepted_args ); } function do_action( $hook_name, ...$arg ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } if ( empty( $arg ) ) { $arg[] = ''; } elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) { $arg[0] = $arg[0][0]; } $wp_filter[ $hook_name ]->do_action( $arg ); array_pop( $wp_current_filter ); } function do_action_ref_array( $hook_name, $args ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $wp_filter[ $hook_name ]->do_action( $args ); array_pop( $wp_current_filter ); } function has_action( $hook_name, $callback = false ) { return has_filter( $hook_name, $callback ); } function remove_action( $hook_name, $callback, $priority = 10 ) { return remove_filter( $hook_name, $callback, $priority ); } function remove_all_actions( $hook_name, $priority = false ) { return remove_all_filters( $hook_name, $priority ); } function current_action() { return current_filter(); } function doing_action( $hook_name = null ) { return doing_filter( $hook_name ); } function did_action( $hook_name ) { global $wp_actions; if ( ! isset( $wp_actions[ $hook_name ] ) ) { return 0; } return $wp_actions[ $hook_name ]; } function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_filter( $hook_name ) ) { return $args[0]; } _deprecated_hook( $hook_name, $version, $replacement, $message ); return apply_filters_ref_array( $hook_name, $args ); } function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_action( $hook_name ) ) { return; } _deprecated_hook( $hook_name, $version, $replacement, $message ); do_action_ref_array( $hook_name, $args ); } function plugin_basename( $file ) { global $wp_plugin_paths; $file = wp_normalize_path( $file ); arsort( $wp_plugin_paths ); foreach ( $wp_plugin_paths as $dir => $realdir ) { if ( strpos( $file, $realdir ) === 0 ) { $file = $dir . substr( $file, strlen( $realdir ) ); } } $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); $file = preg_replace( '#^' . preg_quote( $plugin_dir, '#' ) . '/|^' . preg_quote( $mu_plugin_dir, '#' ) . '/#', '', $file ); $file = trim( $file, '/' ); return $file; } function wp_register_plugin_realpath( $file ) { global $wp_plugin_paths; static $wp_plugin_path = null, $wpmu_plugin_path = null; if ( ! isset( $wp_plugin_path ) ) { $wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR ); $wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR ); } $plugin_path = wp_normalize_path( dirname( $file ) ); $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) { return false; } if ( $plugin_path !== $plugin_realpath ) { $wp_plugin_paths[ $plugin_path ] = $plugin_realpath; } return true; } function plugin_dir_path( $file ) { return trailingslashit( dirname( $file ) ); } function plugin_dir_url( $file ) { return trailingslashit( plugins_url( '', $file ) ); } function register_activation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'activate_' . $file, $callback ); } function register_deactivation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'deactivate_' . $file, $callback ); } function register_uninstall_hook( $file, $callback ) { if ( is_array( $callback ) && is_object( $callback[0] ) ) { _doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1.0' ); return; } $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); $plugin_basename = plugin_basename( $file ); if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) { $uninstallable_plugins[ $plugin_basename ] = $callback; update_option( 'uninstall_plugins', $uninstallable_plugins ); } } function _wp_call_all_hook( $args ) { global $wp_filter; $wp_filter['all']->do_all_hook( $args ); } function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) { if ( is_string( $callback ) ) { return $callback; } if ( is_object( $callback ) ) { $callback = array( $callback, '' ); } else { $callback = (array) $callback; } if ( is_object( $callback[0] ) ) { return spl_object_hash( $callback[0] ) . $callback[1]; } elseif ( is_string( $callback[0] ) ) { return $callback[0] . '::' . $callback[1]; } } register_attributes(); } public function register( $block_support_name, $block_support_config ) { $this->block_supports[ $block_support_name ] = array_merge( $block_support_config, array( 'name' => $block_support_name ) ); } public function apply_block_supports() { $block_attributes = self::$block_to_render['attrs']; $block_type = WP_Block_Type_Registry::get_instance()->get_registered( self::$block_to_render['blockName'] ); if ( ! $block_type || empty( $block_type ) ) { return array(); } $output = array(); foreach ( $this->block_supports as $block_support_config ) { if ( ! isset( $block_support_config['apply'] ) ) { continue; } $new_attributes = call_user_func( $block_support_config['apply'], $block_type, $block_attributes ); if ( ! empty( $new_attributes ) ) { foreach ( $new_attributes as $attribute_name => $attribute_value ) { if ( empty( $output[ $attribute_name ] ) ) { $output[ $attribute_name ] = $attribute_value; } else { $output[ $attribute_name ] .= " $attribute_value"; } } } } return $output; } private function register_attributes() { $block_registry = WP_Block_Type_Registry::get_instance(); $registered_block_types = $block_registry->get_all_registered(); foreach ( $registered_block_types as $block_type ) { if ( ! property_exists( $block_type, 'supports' ) ) { continue; } if ( ! $block_type->attributes ) { $block_type->attributes = array(); } foreach ( $this->block_supports as $block_support_config ) { if ( ! isset( $block_support_config['register_attribute'] ) ) { continue; } call_user_func( $block_support_config['register_attribute'], $block_type ); } } } } function get_block_wrapper_attributes( $extra_attributes = array() ) { $new_attributes = WP_Block_Supports::get_instance()->apply_block_supports(); if ( empty( $new_attributes ) && empty( $extra_attributes ) ) { return ''; } $attributes_to_merge = array( 'style', 'class' ); $attributes = array(); foreach ( $attributes_to_merge as $attribute_name ) { if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) { continue; } if ( empty( $new_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ]; continue; } if ( empty( $extra_attributes[ $attribute_name ] ) ) { $attributes[ $attribute_name ] = $new_attributes[ $attribute_name ]; continue; } $attributes[ $attribute_name ] = $extra_attributes[ $attribute_name ] . ' ' . $new_attributes[ $attribute_name ]; } foreach ( $extra_attributes as $attribute_name => $value ) { if ( ! in_array( $attribute_name, $attributes_to_merge, true ) ) { $attributes[ $attribute_name ] = $value; } } if ( empty( $attributes ) ) { return ''; } $normalized_attributes = array(); foreach ( $attributes as $key => $value ) { $normalized_attributes[] = $key . '="' . esc_attr( $value ) . '"'; } return implode( ' ', $normalized_attributes ); } feed = new AtomFeed(); $this->current = null; $this->map_attrs_func = array( __CLASS__, 'map_attrs' ); $this->map_xmlns_func = array( __CLASS__, 'map_xmlns' ); } public function AtomParser() { self::__construct(); } public static function map_attrs($k, $v) { return "$k=\"$v\""; } public static function map_xmlns($p, $n) { $xd = "xmlns"; if( 0 < strlen($n[0]) ) { $xd .= ":{$n[0]}"; } return "{$xd}=\"{$n[1]}\""; } function _p($msg) { if($this->debug) { print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n"; } } function error_handler($log_level, $log_text, $error_file, $error_line) { $this->error = $log_text; } function parse() { set_error_handler(array(&$this, 'error_handler')); array_unshift($this->ns_contexts, array()); if ( ! function_exists( 'xml_parser_create_ns' ) ) { trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); return false; } $parser = xml_parser_create_ns(); xml_set_object($parser, $this); xml_set_element_handler($parser, "start_element", "end_element"); xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0); xml_set_character_data_handler($parser, "cdata"); xml_set_default_handler($parser, "_default"); xml_set_start_namespace_decl_handler($parser, "start_ns"); xml_set_end_namespace_decl_handler($parser, "end_ns"); $this->content = ''; $ret = true; $fp = fopen($this->FILE, "r"); while ($data = fread($fp, 4096)) { if($this->debug) $this->content .= $data; if(!xml_parse($parser, $data, feof($fp))) { trigger_error(sprintf(__('XML Error: %1$s at line %2$s')."\n", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); $ret = false; break; } } fclose($fp); xml_parser_free($parser); unset($parser); restore_error_handler(); return $ret; } function start_element($parser, $name, $attrs) { $name_parts = explode(":", $name); $tag = array_pop($name_parts); switch($name) { case $this->NS . ':feed': $this->current = $this->feed; break; case $this->NS . ':entry': $this->current = new AtomEntry(); break; }; $this->_p("start_element('$name')"); array_unshift($this->ns_contexts, $this->ns_decls); $this->depth++; if(!empty($this->in_content)) { $this->content_ns_decls = array(); if($this->is_html || $this->is_text) trigger_error("Invalid content in element found. Content must not be of type text or html if it contains markup."); $attrs_prefix = array(); foreach($attrs as $key => $value) { $with_prefix = $this->ns_to_prefix($key, true); $attrs_prefix[$with_prefix[1]] = $this->xml_escape($value); } $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix))); if(strlen($attrs_str) > 0) { $attrs_str = " " . $attrs_str; } $with_prefix = $this->ns_to_prefix($name); if(!$this->is_declared_content_ns($with_prefix[0])) { array_push($this->content_ns_decls, $with_prefix[0]); } $xmlns_str = ''; if(count($this->content_ns_decls) > 0) { array_unshift($this->content_ns_contexts, $this->content_ns_decls); $xmlns_str .= join(' ', array_map($this->map_xmlns_func, array_keys($this->content_ns_contexts[0]), array_values($this->content_ns_contexts[0]))); if(strlen($xmlns_str) > 0) { $xmlns_str = " " . $xmlns_str; } } array_push($this->in_content, array($tag, $this->depth, "<". $with_prefix[1] ."{$xmlns_str}{$attrs_str}" . ">")); } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { $this->in_content = array(); $this->is_xhtml = $attrs['type'] == 'xhtml'; $this->is_html = $attrs['type'] == 'html' || $attrs['type'] == 'text/html'; $this->is_text = !in_array('type',array_keys($attrs)) || $attrs['type'] == 'text'; $type = $this->is_xhtml ? 'XHTML' : ($this->is_html ? 'HTML' : ($this->is_text ? 'TEXT' : $attrs['type'])); if(in_array('src',array_keys($attrs))) { $this->current->$tag = $attrs; } else { array_push($this->in_content, array($tag,$this->depth, $type)); } } else if($tag == 'link') { array_push($this->current->links, $attrs); } else if($tag == 'category') { array_push($this->current->categories, $attrs); } $this->ns_decls = array(); } function end_element($parser, $name) { $name_parts = explode(":", $name); $tag = array_pop($name_parts); $ccount = count($this->in_content); if(!empty($this->in_content)) { if($this->in_content[0][0] == $tag && $this->in_content[0][1] == $this->depth) { $origtype = $this->in_content[0][2]; array_shift($this->in_content); $newcontent = array(); foreach($this->in_content as $c) { if(count($c) == 3) { array_push($newcontent, $c[2]); } else { if($this->is_xhtml || $this->is_text) { array_push($newcontent, $this->xml_escape($c)); } else { array_push($newcontent, $c); } } } if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS)) { $this->current->$tag = array($origtype, join('',$newcontent)); } else { $this->current->$tag = join('',$newcontent); } $this->in_content = array(); } else if($this->in_content[$ccount-1][0] == $tag && $this->in_content[$ccount-1][1] == $this->depth) { $this->in_content[$ccount-1][2] = substr($this->in_content[$ccount-1][2],0,-1) . "/>"; } else { $endtag = $this->ns_to_prefix($name); array_push($this->in_content, array($tag, $this->depth, "")); } } array_shift($this->ns_contexts); $this->depth--; if($name == ($this->NS . ':entry')) { array_push($this->feed->entries, $this->current); $this->current = null; } $this->_p("end_element('$name')"); } function start_ns($parser, $prefix, $uri) { $this->_p("starting: " . $prefix . ":" . $uri); array_push($this->ns_decls, array($prefix,$uri)); } function end_ns($parser, $prefix) { $this->_p("ending: #" . $prefix . "#"); } function cdata($parser, $data) { $this->_p("data: #" . str_replace(array("\n"), array("\\n"), trim($data)) . "#"); if(!empty($this->in_content)) { array_push($this->in_content, $data); } } function _default($parser, $data) { } function ns_to_prefix($qname, $attr=false) { $components = explode(":", $qname); $name = array_pop($components); if(!empty($components)) { $ns = join(":",$components); foreach($this->ns_contexts as $context) { foreach($context as $mapping) { if($mapping[1] == $ns && strlen($mapping[0]) > 0) { return array($mapping, "$mapping[0]:$name"); } } } } if($attr) { return array(null, $name); } else { foreach($this->ns_contexts as $context) { foreach($context as $mapping) { if(strlen($mapping[0]) == 0) { return array($mapping, $name); } } } } } function is_declared_content_ns($new_mapping) { foreach($this->content_ns_contexts as $context) { foreach($context as $mapping) { if($new_mapping == $mapping) { return true; } } } return false; } function xml_escape($content) { return str_replace(array('&','"',"'",'<','>'), array('&','"',''','<','>'), $content ); } } { - "title": "block title", - "description": "block description", - "keywords": [ "block keyword" ], - "styles": [ - { - "label": "block style label" - } - ], - "variations": [ - { - "title": "block variation title", - "description": "block variation description", - "keywords": [ "block variation keyword" ] - } - ] -} - $separator, 'link' => $link, 'format' => $format, ); return get_term_parents_list( $category_id, 'category', $args ); } function get_the_category( $post_id = false ) { $categories = get_the_terms( $post_id, 'category' ); if ( ! $categories || is_wp_error( $categories ) ) { $categories = array(); } $categories = array_values( $categories ); foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[ $key ] ); } return apply_filters( 'get_the_categories', $categories, $post_id ); } function get_the_category_by_ID( $cat_id ) { $cat_id = (int) $cat_id; $category = get_term( $cat_id ); if ( is_wp_error( $category ) ) { return $category; } return ( $category ) ? $category->name : ''; } function get_the_category_list( $separator = '', $parents = '', $post_id = false ) { global $wp_rewrite; if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) { return apply_filters( 'the_category', '', $separator, $parents ); } $categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id ); if ( empty( $categories ) ) { return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); } $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; $thelist = ''; if ( '' === $separator ) { $thelist .= ''; } else { $i = 0; foreach ( $categories as $category ) { if ( 0 < $i ) { $thelist .= $separator; } switch ( strtolower( $parents ) ) { case 'multiple': if ( $category->parent ) { $thelist .= get_category_parents( $category->parent, true, $separator ); } $thelist .= '' . $category->name . ''; break; case 'single': $thelist .= ''; if ( $category->parent ) { $thelist .= get_category_parents( $category->parent, false, $separator ); } $thelist .= "$category->name"; break; case '': default: $thelist .= '' . $category->name . ''; } ++$i; } } return apply_filters( 'the_category', $thelist, $separator, $parents ); } function in_category( $category, $post = null ) { if ( empty( $category ) ) { return false; } return has_category( $category, $post ); } function the_category( $separator = '', $parents = '', $post_id = false ) { echo get_the_category_list( $separator, $parents, $post_id ); } function category_description( $category = 0 ) { return term_description( $category ); } function wp_dropdown_categories( $args = '' ) { $defaults = array( 'show_option_all' => '', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'id' => '', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false, 'option_none_value' => -1, 'value_field' => 'term_id', 'required' => false, ); $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; if ( isset( $args['type'] ) && 'link' === $args['type'] ) { _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'type => link', 'taxonomy => link_category' ) ); $args['taxonomy'] = 'link_category'; } $parsed_args = wp_parse_args( $args, $defaults ); $option_none_value = $parsed_args['option_none_value']; if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { $parsed_args['pad_counts'] = true; } $tab_index = $parsed_args['tab_index']; $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) { $tab_index_attribute = " tabindex=\"$tab_index\""; } $get_terms_args = $parsed_args; unset( $get_terms_args['name'] ); $categories = get_terms( $get_terms_args ); $name = esc_attr( $parsed_args['name'] ); $class = esc_attr( $parsed_args['class'] ); $id = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name; $required = $parsed_args['required'] ? 'required' : ''; if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) { $output = "\n"; } $output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args ); if ( $parsed_args['echo'] ) { echo $output; } return $output; } function wp_list_categories( $args = '' ) { $defaults = array( 'child_of' => 0, 'current_category' => 0, 'depth' => 0, 'echo' => 1, 'exclude' => '', 'exclude_tree' => '', 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'hide_empty' => 1, 'hide_title_if_empty' => false, 'hierarchical' => true, 'order' => 'ASC', 'orderby' => 'name', 'separator' => '
                ', 'show_count' => 0, 'show_option_all' => '', 'show_option_none' => __( 'No categories' ), 'style' => 'list', 'taxonomy' => 'category', 'title_li' => __( 'Categories' ), 'use_desc_for_title' => 1, ); $parsed_args = wp_parse_args( $args, $defaults ); if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { $parsed_args['pad_counts'] = true; } if ( true == $parsed_args['hierarchical'] ) { $exclude_tree = array(); if ( $parsed_args['exclude_tree'] ) { $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude_tree'] ) ); } if ( $parsed_args['exclude'] ) { $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude'] ) ); } $parsed_args['exclude_tree'] = $exclude_tree; $parsed_args['exclude'] = ''; } if ( ! isset( $parsed_args['class'] ) ) { $parsed_args['class'] = ( 'category' === $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy']; } if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) { return false; } $show_option_all = $parsed_args['show_option_all']; $show_option_none = $parsed_args['show_option_none']; $categories = get_categories( $parsed_args ); $output = ''; if ( $parsed_args['title_li'] && 'list' === $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) { $output = '
              • ' . $parsed_args['title_li'] . '
                  '; } if ( empty( $categories ) ) { if ( ! empty( $show_option_none ) ) { if ( 'list' === $parsed_args['style'] ) { $output .= '
                • ' . $show_option_none . '
                • '; } else { $output .= $show_option_none; } } } else { if ( ! empty( $show_option_all ) ) { $posts_page = ''; $taxonomy_object = get_taxonomy( $parsed_args['taxonomy'] ); if ( ! in_array( 'post', $taxonomy_object->object_type, true ) && ! in_array( 'page', $taxonomy_object->object_type, true ) ) { foreach ( $taxonomy_object->object_type as $object_type ) { $_object_type = get_post_type_object( $object_type ); if ( ! empty( $_object_type->has_archive ) ) { $posts_page = get_post_type_archive_link( $object_type ); break; } } } if ( ! $posts_page ) { if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) { $posts_page = get_permalink( get_option( 'page_for_posts' ) ); } else { $posts_page = home_url( '/' ); } } $posts_page = esc_url( $posts_page ); if ( 'list' === $parsed_args['style'] ) { $output .= "
                • $show_option_all
                • "; } else { $output .= "$show_option_all"; } } if ( empty( $parsed_args['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) { $current_term_object = get_queried_object(); if ( $current_term_object && $parsed_args['taxonomy'] === $current_term_object->taxonomy ) { $parsed_args['current_category'] = get_queried_object_id(); } } if ( $parsed_args['hierarchical'] ) { $depth = $parsed_args['depth']; } else { $depth = -1; } $output .= walk_category_tree( $categories, $depth, $parsed_args ); } if ( $parsed_args['title_li'] && 'list' === $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) { $output .= '
              • '; } $html = apply_filters( 'wp_list_categories', $output, $args ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } function wp_tag_cloud( $args = '' ) { $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true, 'show_count' => 0, ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC', ) ) ); if ( empty( $tags ) || is_wp_error( $tags ) ) { return; } foreach ( $tags as $key => $tag ) { if ( 'edit' === $args['link'] ) { $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] ); } else { $link = get_term_link( $tag, $tag->taxonomy ); } if ( is_wp_error( $link ) ) { return; } $tags[ $key ]->link = $link; $tags[ $key ]->id = $tag->term_id; } $return = wp_generate_tag_cloud( $tags, $args ); $return = apply_filters( 'wp_tag_cloud', $return, $args ); if ( 'array' === $args['format'] || empty( $args['echo'] ) ) { return $return; } echo $return; } function default_topic_count_scale( $count ) { return round( log10( $count + 1 ) * 100 ); } function wp_generate_tag_cloud( $tags, $args = '' ) { $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'topic_count_text' => null, 'topic_count_text_callback' => null, 'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1, 'show_count' => 0, ); $args = wp_parse_args( $args, $defaults ); $return = ( 'array' === $args['format'] ) ? array() : ''; if ( empty( $tags ) ) { return $return; } if ( isset( $args['topic_count_text'] ) ) { $translate_nooped_plural = $args['topic_count_text']; } elseif ( ! empty( $args['topic_count_text_callback'] ) ) { if ( 'default_topic_count_text' === $args['topic_count_text_callback'] ) { $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } else { $translate_nooped_plural = false; } } elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { $translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] ); } else { $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } $tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args ); if ( empty( $tags_sorted ) ) { return $return; } if ( $tags_sorted !== $tags ) { $tags = $tags_sorted; unset( $tags_sorted ); } else { if ( 'RAND' === $args['order'] ) { shuffle( $tags ); } else { if ( 'name' === $args['orderby'] ) { uasort( $tags, '_wp_object_name_sort_cb' ); } else { uasort( $tags, '_wp_object_count_sort_cb' ); } if ( 'DESC' === $args['order'] ) { $tags = array_reverse( $tags, true ); } } } if ( $args['number'] > 0 ) { $tags = array_slice( $tags, 0, $args['number'] ); } $counts = array(); $real_counts = array(); foreach ( (array) $tags as $key => $tag ) { $real_counts[ $key ] = $tag->count; $counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count ); } $min_count = min( $counts ); $spread = max( $counts ) - $min_count; if ( $spread <= 0 ) { $spread = 1; } $font_spread = $args['largest'] - $args['smallest']; if ( $font_spread < 0 ) { $font_spread = 1; } $font_step = $font_spread / $spread; $aria_label = false; if ( $args['show_count'] || 0 !== $font_spread ) { $aria_label = true; } $tags_data = array(); foreach ( $tags as $key => $tag ) { $tag_id = isset( $tag->id ) ? $tag->id : $key; $count = $counts[ $key ]; $real_count = $real_counts[ $key ]; if ( $translate_nooped_plural ) { $formatted_count = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) ); } else { $formatted_count = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args ); } $tags_data[] = array( 'id' => $tag_id, 'url' => ( '#' !== $tag->link ) ? $tag->link : '#', 'role' => ( '#' !== $tag->link ) ? '' : ' role="button"', 'name' => $tag->name, 'formatted_count' => $formatted_count, 'slug' => $tag->slug, 'real_count' => $real_count, 'class' => 'tag-cloud-link tag-link-' . $tag_id, 'font_size' => $args['smallest'] + ( $count - $min_count ) * $font_step, 'aria_label' => $aria_label ? sprintf( ' aria-label="%1$s (%2$s)"', esc_attr( $tag->name ), esc_attr( $formatted_count ) ) : '', 'show_count' => $args['show_count'] ? ' (' . $real_count . ')' : '', ); } $tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data ); $a = array(); foreach ( $tags_data as $key => $tag_data ) { $class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 ); $a[] = sprintf( '%6$s%7$s', esc_url( $tag_data['url'] ), $tag_data['role'], esc_attr( $class ), esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ), $tag_data['aria_label'], esc_html( $tag_data['name'] ), $tag_data['show_count'] ); } switch ( $args['format'] ) { case 'array': $return =& $a; break; case 'list': $return = "
                  \n\t
                • "; $return .= implode( "
                • \n\t
                • ", $a ); $return .= "
                • \n
                \n"; break; default: $return = implode( $args['separator'], $a ); break; } if ( $args['filter'] ) { return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args ); } else { return $return; } } function _wp_object_name_sort_cb( $a, $b ) { return strnatcasecmp( $a->name, $b->name ); } function _wp_object_count_sort_cb( $a, $b ) { return ( $a->count > $b->count ); } function walk_category_tree( ...$args ) { if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_Category; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function walk_category_dropdown_tree( ...$args ) { if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_CategoryDropdown; } else { $walker = $args[2]['walker']; } return $walker->walk( ...$args ); } function get_tag_link( $tag ) { return get_category_link( $tag ); } function get_the_tags( $post_id = 0 ) { $terms = get_the_terms( $post_id, 'post_tag' ); return apply_filters( 'get_the_tags', $terms ); } function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) { $tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after ); return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id ); } function the_tags( $before = null, $sep = ', ', $after = '' ) { if ( null === $before ) { $before = __( 'Tags: ' ); } $the_tags = get_the_tag_list( $before, $sep, $after ); if ( ! is_wp_error( $the_tags ) ) { echo $the_tags; } } function tag_description( $tag = 0 ) { return term_description( $tag ); } function term_description( $term = 0, $deprecated = null ) { if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) { $term = get_queried_object(); if ( $term ) { $term = $term->term_id; } } $description = get_term_field( 'description', $term ); return is_wp_error( $description ) ? '' : $description; } function get_the_terms( $post, $taxonomy ) { $post = get_post( $post ); if ( ! $post ) { return false; } $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy ); if ( ! is_wp_error( $terms ) ) { $term_ids = wp_list_pluck( $terms, 'term_id' ); wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' ); } } $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); if ( empty( $terms ) ) { return false; } return $terms; } function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) { $terms = get_the_terms( $post_id, $taxonomy ); if ( is_wp_error( $terms ) ) { return $terms; } if ( empty( $terms ) ) { return false; } $links = array(); foreach ( $terms as $term ) { $link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $link ) ) { return $link; } $links[] = ''; } $term_links = apply_filters( "term_links-{$taxonomy}", $links ); return $before . implode( $sep, $term_links ) . $after; } function get_term_parents_list( $term_id, $taxonomy, $args = array() ) { $list = ''; $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; } if ( ! $term ) { return $list; } $term_id = $term->term_id; $defaults = array( 'format' => 'name', 'separator' => '/', 'link' => true, 'inclusive' => true, ); $args = wp_parse_args( $args, $defaults ); foreach ( array( 'link', 'inclusive' ) as $bool ) { $args[ $bool ] = wp_validate_boolean( $args[ $bool ] ); } $parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' ); if ( $args['inclusive'] ) { array_unshift( $parents, $term_id ); } foreach ( array_reverse( $parents ) as $term_id ) { $parent = get_term( $term_id, $taxonomy ); $name = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name; if ( $args['link'] ) { $list .= '' . $name . '' . $args['separator']; } else { $list .= $name . $args['separator']; } } return $list; } function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { $term_list = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after ); if ( is_wp_error( $term_list ) ) { return false; } echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); } function has_category( $category = '', $post = null ) { return has_term( $category, 'category', $post ); } function has_tag( $tag = '', $post = null ) { return has_term( $tag, 'post_tag', $post ); } function has_term( $term = '', $taxonomy = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $r = is_object_in_term( $post->ID, $taxonomy, $term ); if ( is_wp_error( $r ) ) { return false; } return $r; } _show_split_view = $params['show_split_view']; } } public function _startBlock( $header ) { return ''; } public function _lines( $lines, $prefix = ' ' ) { } public function addedLine( $line ) { return "" . __( 'Added:' ) . " {$line}"; } public function deletedLine( $line ) { return "" . __( 'Deleted:' ) . " {$line}"; } public function contextLine( $line ) { return "" . __( 'Unchanged:' ) . " {$line}"; } public function emptyLine() { return ' '; } public function _added( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' ); } if ( $this->_show_split_view ) { $r .= '' . $this->emptyLine() . $this->addedLine( $line ) . "\n"; } else { $r .= '' . $this->addedLine( $line ) . "\n"; } } return $r; } public function _deleted( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' ); } if ( $this->_show_split_view ) { $r .= '' . $this->deletedLine( $line ) . $this->emptyLine() . "\n"; } else { $r .= '' . $this->deletedLine( $line ) . "\n"; } } return $r; } public function _context( $lines, $encode = true ) { $r = ''; foreach ( $lines as $line ) { if ( $encode ) { $processed_line = htmlspecialchars( $line ); $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' ); } if ( $this->_show_split_view ) { $r .= '' . $this->contextLine( $line ) . $this->contextLine( $line ) . "\n"; } else { $r .= '' . $this->contextLine( $line ) . "\n"; } } return $r; } public function _changed( $orig, $final ) { $r = ''; list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines( $orig, $final ); $orig_diffs = array(); $final_diffs = array(); foreach ( $orig_matches as $o => $f ) { if ( is_numeric( $o ) && is_numeric( $f ) ) { $text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) ); $renderer = new $this->inline_diff_renderer; $diff = $renderer->render( $text_diff ); if ( preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { $stripped_matches = strlen( strip_tags( implode( ' ', $diff_matches[0] ) ) ); $stripped_diff = strlen( strip_tags( $diff ) ) * 2 - $stripped_matches; $diff_ratio = $stripped_matches / $stripped_diff; if ( $diff_ratio > $this->_diff_threshold ) { continue; } } $orig_diffs[ $o ] = preg_replace( '|.*?|', '', $diff ); $final_diffs[ $f ] = preg_replace( '|.*?|', '', $diff ); } } foreach ( array_keys( $orig_rows ) as $row ) { if ( $orig_rows[ $row ] < 0 && $final_rows[ $row ] < 0 ) { continue; } if ( isset( $orig_diffs[ $orig_rows[ $row ] ] ) ) { $orig_line = $orig_diffs[ $orig_rows[ $row ] ]; } elseif ( isset( $orig[ $orig_rows[ $row ] ] ) ) { $orig_line = htmlspecialchars( $orig[ $orig_rows[ $row ] ] ); } else { $orig_line = ''; } if ( isset( $final_diffs[ $final_rows[ $row ] ] ) ) { $final_line = $final_diffs[ $final_rows[ $row ] ]; } elseif ( isset( $final[ $final_rows[ $row ] ] ) ) { $final_line = htmlspecialchars( $final[ $final_rows[ $row ] ] ); } else { $final_line = ''; } if ( $orig_rows[ $row ] < 0 ) { $r .= $this->_added( array( $final_line ), false ); } elseif ( $final_rows[ $row ] < 0 ) { $r .= $this->_deleted( array( $orig_line ), false ); } else { if ( $this->_show_split_view ) { $r .= '' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "\n"; } else { $r .= '' . $this->deletedLine( $orig_line ) . '' . $this->addedLine( $final_line ) . "\n"; } } } return $r; } public function interleave_changed_lines( $orig, $final ) { $matches = array(); foreach ( array_keys( $orig ) as $o ) { foreach ( array_keys( $final ) as $f ) { $matches[ "$o,$f" ] = $this->compute_string_distance( $orig[ $o ], $final[ $f ] ); } } asort( $matches ); $orig_matches = array(); $final_matches = array(); foreach ( $matches as $keys => $difference ) { list($o, $f) = explode( ',', $keys ); $o = (int) $o; $f = (int) $f; if ( isset( $orig_matches[ $o ] ) && isset( $final_matches[ $f ] ) ) { continue; } if ( ! isset( $orig_matches[ $o ] ) && ! isset( $final_matches[ $f ] ) ) { $orig_matches[ $o ] = $f; $final_matches[ $f ] = $o; continue; } if ( isset( $orig_matches[ $o ] ) ) { $final_matches[ $f ] = 'x'; } elseif ( isset( $final_matches[ $f ] ) ) { $orig_matches[ $o ] = 'x'; } } ksort( $orig_matches ); ksort( $final_matches ); $orig_rows = array_keys( $orig_matches ); $orig_rows_copy = $orig_rows; $final_rows = array_keys( $final_matches ); foreach ( $orig_rows_copy as $orig_row ) { $final_pos = array_search( $orig_matches[ $orig_row ], $final_rows, true ); $orig_pos = (int) array_search( $orig_row, $orig_rows, true ); if ( false === $final_pos ) { array_splice( $final_rows, $orig_pos, 0, -1 ); } elseif ( $final_pos < $orig_pos ) { $diff_array = range( -1, $final_pos - $orig_pos ); array_splice( $final_rows, $orig_pos, 0, $diff_array ); } elseif ( $final_pos > $orig_pos ) { $diff_array = range( -1, $orig_pos - $final_pos ); array_splice( $orig_rows, $orig_pos, 0, $diff_array ); } } $diff_count = count( $orig_rows ) - count( $final_rows ); if ( $diff_count < 0 ) { while ( $diff_count < 0 ) { array_push( $orig_rows, $diff_count++ ); } } elseif ( $diff_count > 0 ) { $diff_count = -1 * $diff_count; while ( $diff_count < 0 ) { array_push( $final_rows, $diff_count++ ); } } return array( $orig_matches, $final_matches, $orig_rows, $final_rows ); } public function compute_string_distance( $string1, $string2 ) { $count_key1 = md5( $string1 ); $count_key2 = md5( $string2 ); if ( ! isset( $this->count_cache[ $count_key1 ] ) ) { $this->count_cache[ $count_key1 ] = count_chars( $string1 ); } if ( ! isset( $this->count_cache[ $count_key2 ] ) ) { $this->count_cache[ $count_key2 ] = count_chars( $string2 ); } $chars1 = $this->count_cache[ $count_key1 ]; $chars2 = $this->count_cache[ $count_key2 ]; $difference_key = md5( implode( ',', $chars1 ) . ':' . implode( ',', $chars2 ) ); if ( ! isset( $this->difference_cache[ $difference_key ] ) ) { $this->difference_cache[ $difference_key ] = array_sum( array_map( array( $this, 'difference' ), $chars1, $chars2 ) ); } $difference = $this->difference_cache[ $difference_key ]; if ( ! $string1 ) { return $difference; } return $difference / strlen( $string1 ); } public function difference( $a, $b ) { return abs( $a - $b ); } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } } ID, '_thumbnail_id', true ); return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post ); } function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) { echo get_the_post_thumbnail( null, $size, $attr ); } function update_post_thumbnail_cache( $wp_query = null ) { if ( ! $wp_query ) { $wp_query = $GLOBALS['wp_query']; } if ( $wp_query->thumbnails_cached ) { return; } $thumb_ids = array(); foreach ( $wp_query->posts as $post ) { $id = get_post_thumbnail_id( $post->ID ); if ( $id ) { $thumb_ids[] = $id; } } if ( ! empty( $thumb_ids ) ) { _prime_post_caches( $thumb_ids, false, true ); } $wp_query->thumbnails_cached = true; } function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) { $post = get_post( $post ); if ( ! $post ) { return ''; } $post_thumbnail_id = get_post_thumbnail_id( $post ); $size = apply_filters( 'post_thumbnail_size', $size, $post->ID ); if ( $post_thumbnail_id ) { do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size ); if ( in_the_loop() ) { update_post_thumbnail_cache(); } $loading = wp_get_loading_attr_default( 'the_post_thumbnail' ); if ( empty( $attr ) ) { $attr = array( 'loading' => $loading ); } elseif ( is_array( $attr ) && ! array_key_exists( 'loading', $attr ) ) { $attr['loading'] = $loading; } elseif ( is_string( $attr ) && ! preg_match( '/(^|&)loading=/', $attr ) ) { $attr .= '&loading=' . $loading; } $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size ); } else { $html = ''; } return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr ); } function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) { $post_thumbnail_id = get_post_thumbnail_id( $post ); if ( ! $post_thumbnail_id ) { return false; } $thumbnail_url = wp_get_attachment_image_url( $post_thumbnail_id, $size ); return apply_filters( 'post_thumbnail_url', $thumbnail_url, $post, $size ); } function the_post_thumbnail_url( $size = 'post-thumbnail' ) { $url = get_the_post_thumbnail_url( null, $size ); if ( $url ) { echo esc_url( $url ); } } function get_the_post_thumbnail_caption( $post = null ) { $post_thumbnail_id = get_post_thumbnail_id( $post ); if ( ! $post_thumbnail_id ) { return ''; } $caption = wp_get_attachment_caption( $post_thumbnail_id ); if ( ! $caption ) { $caption = ''; } return $caption; } function the_post_thumbnail_caption( $post = null ) { echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) ); } methods = array( 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 'wp.newPost' => 'this:wp_newPost', 'wp.editPost' => 'this:wp_editPost', 'wp.deletePost' => 'this:wp_deletePost', 'wp.getPost' => 'this:wp_getPost', 'wp.getPosts' => 'this:wp_getPosts', 'wp.newTerm' => 'this:wp_newTerm', 'wp.editTerm' => 'this:wp_editTerm', 'wp.deleteTerm' => 'this:wp_deleteTerm', 'wp.getTerm' => 'this:wp_getTerm', 'wp.getTerms' => 'this:wp_getTerms', 'wp.getTaxonomy' => 'this:wp_getTaxonomy', 'wp.getTaxonomies' => 'this:wp_getTaxonomies', 'wp.getUser' => 'this:wp_getUser', 'wp.getUsers' => 'this:wp_getUsers', 'wp.getProfile' => 'this:wp_getProfile', 'wp.editProfile' => 'this:wp_editProfile', 'wp.getPage' => 'this:wp_getPage', 'wp.getPages' => 'this:wp_getPages', 'wp.newPage' => 'this:wp_newPage', 'wp.deletePage' => 'this:wp_deletePage', 'wp.editPage' => 'this:wp_editPage', 'wp.getPageList' => 'this:wp_getPageList', 'wp.getAuthors' => 'this:wp_getAuthors', 'wp.getCategories' => 'this:mw_getCategories', 'wp.getTags' => 'this:wp_getTags', 'wp.newCategory' => 'this:wp_newCategory', 'wp.deleteCategory' => 'this:wp_deleteCategory', 'wp.suggestCategories' => 'this:wp_suggestCategories', 'wp.uploadFile' => 'this:mw_newMediaObject', 'wp.deleteFile' => 'this:wp_deletePost', 'wp.getCommentCount' => 'this:wp_getCommentCount', 'wp.getPostStatusList' => 'this:wp_getPostStatusList', 'wp.getPageStatusList' => 'this:wp_getPageStatusList', 'wp.getPageTemplates' => 'this:wp_getPageTemplates', 'wp.getOptions' => 'this:wp_getOptions', 'wp.setOptions' => 'this:wp_setOptions', 'wp.getComment' => 'this:wp_getComment', 'wp.getComments' => 'this:wp_getComments', 'wp.deleteComment' => 'this:wp_deleteComment', 'wp.editComment' => 'this:wp_editComment', 'wp.newComment' => 'this:wp_newComment', 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList', 'wp.getMediaItem' => 'this:wp_getMediaItem', 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', 'wp.getPostFormats' => 'this:wp_getPostFormats', 'wp.getPostType' => 'this:wp_getPostType', 'wp.getPostTypes' => 'this:wp_getPostTypes', 'wp.getRevisions' => 'this:wp_getRevisions', 'wp.restoreRevision' => 'this:wp_restoreRevision', 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'blogger.getUserInfo' => 'this:blogger_getUserInfo', 'blogger.getPost' => 'this:blogger_getPost', 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', 'blogger.newPost' => 'this:blogger_newPost', 'blogger.editPost' => 'this:blogger_editPost', 'blogger.deletePost' => 'this:blogger_deletePost', 'metaWeblog.newPost' => 'this:mw_newPost', 'metaWeblog.editPost' => 'this:mw_editPost', 'metaWeblog.getPost' => 'this:mw_getPost', 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', 'metaWeblog.getCategories' => 'this:mw_getCategories', 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', 'metaWeblog.deletePost' => 'this:blogger_deletePost', 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'mt.getCategoryList' => 'this:mt_getCategoryList', 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', 'mt.getPostCategories' => 'this:mt_getPostCategories', 'mt.setPostCategories' => 'this:mt_setPostCategories', 'mt.supportedMethods' => 'this:mt_supportedMethods', 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', 'mt.publishPost' => 'this:mt_publishPost', 'pingback.ping' => 'this:pingback_ping', 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', 'demo.sayHello' => 'this:sayHello', 'demo.addTwoNumbers' => 'this:addTwoNumbers', ); $this->initialise_blog_option_info(); $this->methods = apply_filters( 'xmlrpc_methods', $this->methods ); $this->set_is_enabled(); } private function set_is_enabled() { $is_enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); if ( false === $is_enabled ) { $is_enabled = apply_filters( 'option_enable_xmlrpc', true ); } $this->is_enabled = apply_filters( 'xmlrpc_enabled', $is_enabled ); } public function __call( $name, $arguments ) { if ( '_multisite_getUsersBlogs' === $name ) { return $this->_multisite_getUsersBlogs( ...$arguments ); } return false; } public function serve_request() { $this->IXR_Server( $this->methods ); } public function sayHello() { return 'Hello!'; } public function addTwoNumbers( $args ) { $number1 = $args[0]; $number2 = $args[1]; return $number1 + $number2; } public function login( $username, $password ) { if ( ! $this->is_enabled ) { $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) ); return false; } if ( $this->auth_failed ) { $user = new WP_Error( 'login_prevented' ); } else { $user = wp_authenticate( $username, $password ); } if ( is_wp_error( $user ) ) { $this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) ); $this->auth_failed = true; $this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user ); return false; } wp_set_current_user( $user->ID ); return $user; } public function login_pass_ok( $username, $password ) { return (bool) $this->login( $username, $password ); } public function escape( &$data ) { if ( ! is_array( $data ) ) { return wp_slash( $data ); } foreach ( $data as &$v ) { if ( is_array( $v ) ) { $this->escape( $v ); } elseif ( ! is_object( $v ) ) { $v = wp_slash( $v ); } } } public function error( $error, $message = false ) { if ( $message && ! is_object( $error ) ) { $error = new IXR_Error( $error, $message ); } if ( ! $this->is_enabled ) { status_header( $error->code ); } $this->output( $error->getXml() ); } public function get_custom_fields( $post_id ) { $post_id = (int) $post_id; $custom_fields = array(); foreach ( (array) has_meta( $post_id ) as $meta ) { if ( ! current_user_can( 'edit_post_meta', $post_id, $meta['meta_key'] ) ) { continue; } $custom_fields[] = array( 'id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => $meta['meta_value'], ); } return $custom_fields; } public function set_custom_fields( $post_id, $fields ) { $post_id = (int) $post_id; foreach ( (array) $fields as $meta ) { if ( isset( $meta['id'] ) ) { $meta['id'] = (int) $meta['id']; $pmeta = get_metadata_by_mid( 'post', $meta['id'] ); if ( ! $pmeta || $pmeta->post_id != $post_id ) { continue; } if ( isset( $meta['key'] ) ) { $meta['key'] = wp_unslash( $meta['key'] ); if ( $meta['key'] !== $pmeta->meta_key ) { continue; } $meta['value'] = wp_unslash( $meta['value'] ); if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) { update_metadata_by_mid( 'post', $meta['id'], $meta['value'] ); } } elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) { delete_metadata_by_mid( 'post', $meta['id'] ); } } elseif ( current_user_can( 'add_post_meta', $post_id, wp_unslash( $meta['key'] ) ) ) { add_post_meta( $post_id, $meta['key'], $meta['value'] ); } } } public function get_term_custom_fields( $term_id ) { $term_id = (int) $term_id; $custom_fields = array(); foreach ( (array) has_term_meta( $term_id ) as $meta ) { if ( ! current_user_can( 'edit_term_meta', $term_id ) ) { continue; } $custom_fields[] = array( 'id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => $meta['meta_value'], ); } return $custom_fields; } public function set_term_custom_fields( $term_id, $fields ) { $term_id = (int) $term_id; foreach ( (array) $fields as $meta ) { if ( isset( $meta['id'] ) ) { $meta['id'] = (int) $meta['id']; $pmeta = get_metadata_by_mid( 'term', $meta['id'] ); if ( isset( $meta['key'] ) ) { $meta['key'] = wp_unslash( $meta['key'] ); if ( $meta['key'] !== $pmeta->meta_key ) { continue; } $meta['value'] = wp_unslash( $meta['value'] ); if ( current_user_can( 'edit_term_meta', $term_id ) ) { update_metadata_by_mid( 'term', $meta['id'], $meta['value'] ); } } elseif ( current_user_can( 'delete_term_meta', $term_id ) ) { delete_metadata_by_mid( 'term', $meta['id'] ); } } elseif ( current_user_can( 'add_term_meta', $term_id ) ) { add_term_meta( $term_id, $meta['key'], $meta['value'] ); } } } public function initialise_blog_option_info() { $this->blog_options = array( 'software_name' => array( 'desc' => __( 'Software Name' ), 'readonly' => true, 'value' => 'WordPress', ), 'software_version' => array( 'desc' => __( 'Software Version' ), 'readonly' => true, 'value' => get_bloginfo( 'version' ), ), 'blog_url' => array( 'desc' => __( 'WordPress Address (URL)' ), 'readonly' => true, 'option' => 'siteurl', ), 'home_url' => array( 'desc' => __( 'Site Address (URL)' ), 'readonly' => true, 'option' => 'home', ), 'login_url' => array( 'desc' => __( 'Login Address (URL)' ), 'readonly' => true, 'value' => wp_login_url(), ), 'admin_url' => array( 'desc' => __( 'The URL to the admin area' ), 'readonly' => true, 'value' => get_admin_url(), ), 'image_default_link_type' => array( 'desc' => __( 'Image default link type' ), 'readonly' => true, 'option' => 'image_default_link_type', ), 'image_default_size' => array( 'desc' => __( 'Image default size' ), 'readonly' => true, 'option' => 'image_default_size', ), 'image_default_align' => array( 'desc' => __( 'Image default align' ), 'readonly' => true, 'option' => 'image_default_align', ), 'template' => array( 'desc' => __( 'Template' ), 'readonly' => true, 'option' => 'template', ), 'stylesheet' => array( 'desc' => __( 'Stylesheet' ), 'readonly' => true, 'option' => 'stylesheet', ), 'post_thumbnail' => array( 'desc' => __( 'Post Thumbnail' ), 'readonly' => true, 'value' => current_theme_supports( 'post-thumbnails' ), ), 'time_zone' => array( 'desc' => __( 'Time Zone' ), 'readonly' => false, 'option' => 'gmt_offset', ), 'blog_title' => array( 'desc' => __( 'Site Title' ), 'readonly' => false, 'option' => 'blogname', ), 'blog_tagline' => array( 'desc' => __( 'Site Tagline' ), 'readonly' => false, 'option' => 'blogdescription', ), 'date_format' => array( 'desc' => __( 'Date Format' ), 'readonly' => false, 'option' => 'date_format', ), 'time_format' => array( 'desc' => __( 'Time Format' ), 'readonly' => false, 'option' => 'time_format', ), 'users_can_register' => array( 'desc' => __( 'Allow new users to sign up' ), 'readonly' => false, 'option' => 'users_can_register', ), 'thumbnail_size_w' => array( 'desc' => __( 'Thumbnail Width' ), 'readonly' => false, 'option' => 'thumbnail_size_w', ), 'thumbnail_size_h' => array( 'desc' => __( 'Thumbnail Height' ), 'readonly' => false, 'option' => 'thumbnail_size_h', ), 'thumbnail_crop' => array( 'desc' => __( 'Crop thumbnail to exact dimensions' ), 'readonly' => false, 'option' => 'thumbnail_crop', ), 'medium_size_w' => array( 'desc' => __( 'Medium size image width' ), 'readonly' => false, 'option' => 'medium_size_w', ), 'medium_size_h' => array( 'desc' => __( 'Medium size image height' ), 'readonly' => false, 'option' => 'medium_size_h', ), 'medium_large_size_w' => array( 'desc' => __( 'Medium-Large size image width' ), 'readonly' => false, 'option' => 'medium_large_size_w', ), 'medium_large_size_h' => array( 'desc' => __( 'Medium-Large size image height' ), 'readonly' => false, 'option' => 'medium_large_size_h', ), 'large_size_w' => array( 'desc' => __( 'Large size image width' ), 'readonly' => false, 'option' => 'large_size_w', ), 'large_size_h' => array( 'desc' => __( 'Large size image height' ), 'readonly' => false, 'option' => 'large_size_h', ), 'default_comment_status' => array( 'desc' => __( 'Allow people to submit comments on new posts.' ), 'readonly' => false, 'option' => 'default_comment_status', ), 'default_ping_status' => array( 'desc' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new posts.' ), 'readonly' => false, 'option' => 'default_ping_status', ), ); $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options ); } public function wp_getUsersBlogs( $args ) { if ( ! $this->minimum_args( $args, 2 ) ) { return $this->error; } if ( ! is_multisite() ) { array_unshift( $args, 1 ); return $this->blogger_getUsersBlogs( $args ); } $this->escape( $args ); $username = $args[0]; $password = $args[1]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUsersBlogs', $args, $this ); $blogs = (array) get_blogs_of_user( $user->ID ); $struct = array(); $primary_blog_id = 0; $active_blog = get_active_blog_for_user( $user->ID ); if ( $active_blog ) { $primary_blog_id = (int) $active_blog->blog_id; } foreach ( $blogs as $blog ) { if ( get_current_network_id() != $blog->site_id ) { continue; } $blog_id = $blog->userblog_id; switch_to_blog( $blog_id ); $is_admin = current_user_can( 'manage_options' ); $is_primary = ( (int) $blog_id === $primary_blog_id ); $struct[] = array( 'isAdmin' => $is_admin, 'isPrimary' => $is_primary, 'url' => home_url( '/' ), 'blogid' => (string) $blog_id, 'blogName' => get_option( 'blogname' ), 'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ), ); restore_current_blog(); } return $struct; } protected function minimum_args( $args, $count ) { if ( ! is_array( $args ) || count( $args ) < $count ) { $this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) ); return false; } return true; } protected function _prepare_taxonomy( $taxonomy, $fields ) { $_taxonomy = array( 'name' => $taxonomy->name, 'label' => $taxonomy->label, 'hierarchical' => (bool) $taxonomy->hierarchical, 'public' => (bool) $taxonomy->public, 'show_ui' => (bool) $taxonomy->show_ui, '_builtin' => (bool) $taxonomy->_builtin, ); if ( in_array( 'labels', $fields, true ) ) { $_taxonomy['labels'] = (array) $taxonomy->labels; } if ( in_array( 'cap', $fields, true ) ) { $_taxonomy['cap'] = (array) $taxonomy->cap; } if ( in_array( 'menu', $fields, true ) ) { $_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu; } if ( in_array( 'object_type', $fields, true ) ) { $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type ); } return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); } protected function _prepare_term( $term ) { $_term = $term; if ( ! is_array( $_term ) ) { $_term = get_object_vars( $_term ); } $_term['term_id'] = (string) $_term['term_id']; $_term['term_group'] = (string) $_term['term_group']; $_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id']; $_term['parent'] = (string) $_term['parent']; $_term['count'] = (int) $_term['count']; $_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] ); return apply_filters( 'xmlrpc_prepare_term', $_term, $term ); } protected function _convert_date( $date ) { if ( '0000-00-00 00:00:00' === $date ) { return new IXR_Date( '00000000T00:00:00Z' ); } return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) ); } protected function _convert_date_gmt( $date_gmt, $date ) { if ( '0000-00-00 00:00:00' !== $date && '0000-00-00 00:00:00' === $date_gmt ) { return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) ); } return $this->_convert_date( $date_gmt ); } protected function _prepare_post( $post, $fields ) { $_post = array( 'post_id' => (string) $post['ID'] ); $post_fields = array( 'post_title' => $post['post_title'], 'post_date' => $this->_convert_date( $post['post_date'] ), 'post_date_gmt' => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ), 'post_modified' => $this->_convert_date( $post['post_modified'] ), 'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ), 'post_status' => $post['post_status'], 'post_type' => $post['post_type'], 'post_name' => $post['post_name'], 'post_author' => $post['post_author'], 'post_password' => $post['post_password'], 'post_excerpt' => $post['post_excerpt'], 'post_content' => $post['post_content'], 'post_parent' => (string) $post['post_parent'], 'post_mime_type' => $post['post_mime_type'], 'link' => get_permalink( $post['ID'] ), 'guid' => $post['guid'], 'menu_order' => (int) $post['menu_order'], 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], 'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ), ); $post_fields['post_thumbnail'] = array(); $thumbnail_id = get_post_thumbnail_id( $post['ID'] ); if ( $thumbnail_id ) { $thumbnail_size = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail'; $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size ); } if ( 'future' === $post_fields['post_status'] ) { $post_fields['post_status'] = 'publish'; } $post_fields['post_format'] = get_post_format( $post['ID'] ); if ( empty( $post_fields['post_format'] ) ) { $post_fields['post_format'] = 'standard'; } if ( in_array( 'post', $fields, true ) ) { $_post = array_merge( $_post, $post_fields ); } else { $requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) ); $_post = array_merge( $_post, $requested_fields ); } $all_taxonomy_fields = in_array( 'taxonomies', $fields, true ); if ( $all_taxonomy_fields || in_array( 'terms', $fields, true ) ) { $post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' ); $terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies ); $_post['terms'] = array(); foreach ( $terms as $term ) { $_post['terms'][] = $this->_prepare_term( $term ); } } if ( in_array( 'custom_fields', $fields, true ) ) { $_post['custom_fields'] = $this->get_custom_fields( $post['ID'] ); } if ( in_array( 'enclosure', $fields, true ) ) { $_post['enclosure'] = array(); $enclosures = (array) get_post_meta( $post['ID'], 'enclosure' ); if ( ! empty( $enclosures ) ) { $encdata = explode( "\n", $enclosures[0] ); $_post['enclosure']['url'] = trim( htmlspecialchars( $encdata[0] ) ); $_post['enclosure']['length'] = (int) trim( $encdata[1] ); $_post['enclosure']['type'] = trim( $encdata[2] ); } } return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields ); } protected function _prepare_post_type( $post_type, $fields ) { $_post_type = array( 'name' => $post_type->name, 'label' => $post_type->label, 'hierarchical' => (bool) $post_type->hierarchical, 'public' => (bool) $post_type->public, 'show_ui' => (bool) $post_type->show_ui, '_builtin' => (bool) $post_type->_builtin, 'has_archive' => (bool) $post_type->has_archive, 'supports' => get_all_post_type_supports( $post_type->name ), ); if ( in_array( 'labels', $fields, true ) ) { $_post_type['labels'] = (array) $post_type->labels; } if ( in_array( 'cap', $fields, true ) ) { $_post_type['cap'] = (array) $post_type->cap; $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap; } if ( in_array( 'menu', $fields, true ) ) { $_post_type['menu_position'] = (int) $post_type->menu_position; $_post_type['menu_icon'] = $post_type->menu_icon; $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu; } if ( in_array( 'taxonomies', $fields, true ) ) { $_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' ); } return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type ); } protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) { $_media_item = array( 'attachment_id' => (string) $media_item->ID, 'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ), 'parent' => $media_item->post_parent, 'link' => wp_get_attachment_url( $media_item->ID ), 'title' => $media_item->post_title, 'caption' => $media_item->post_excerpt, 'description' => $media_item->post_content, 'metadata' => wp_get_attachment_metadata( $media_item->ID ), 'type' => $media_item->post_mime_type, ); $thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size ); if ( $thumbnail_src ) { $_media_item['thumbnail'] = $thumbnail_src[0]; } else { $_media_item['thumbnail'] = $_media_item['link']; } return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size ); } protected function _prepare_page( $page ) { $full_page = get_extended( $page->post_content ); $link = get_permalink( $page->ID ); $parent_title = ''; if ( ! empty( $page->post_parent ) ) { $parent = get_post( $page->post_parent ); $parent_title = $parent->post_title; } $allow_comments = comments_open( $page->ID ) ? 1 : 0; $allow_pings = pings_open( $page->ID ) ? 1 : 0; $page_date = $this->_convert_date( $page->post_date ); $page_date_gmt = $this->_convert_date_gmt( $page->post_date_gmt, $page->post_date ); $categories = array(); if ( is_object_in_taxonomy( 'page', 'category' ) ) { foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) { $categories[] = get_cat_name( $cat_id ); } } $author = get_userdata( $page->post_author ); $page_template = get_page_template_slug( $page->ID ); if ( empty( $page_template ) ) { $page_template = 'default'; } $_page = array( 'dateCreated' => $page_date, 'userid' => $page->post_author, 'page_id' => $page->ID, 'page_status' => $page->post_status, 'description' => $full_page['main'], 'title' => $page->post_title, 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'excerpt' => $page->post_excerpt, 'text_more' => $full_page['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'wp_slug' => $page->post_name, 'wp_password' => $page->post_password, 'wp_author' => $author->display_name, 'wp_page_parent_id' => $page->post_parent, 'wp_page_parent_title' => $parent_title, 'wp_page_order' => $page->menu_order, 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $page_date_gmt, 'custom_fields' => $this->get_custom_fields( $page->ID ), 'wp_page_template' => $page_template, ); return apply_filters( 'xmlrpc_prepare_page', $_page, $page ); } protected function _prepare_comment( $comment ) { $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date ); if ( '0' == $comment->comment_approved ) { $comment_status = 'hold'; } elseif ( 'spam' === $comment->comment_approved ) { $comment_status = 'spam'; } elseif ( '1' == $comment->comment_approved ) { $comment_status = 'approve'; } else { $comment_status = $comment->comment_approved; } $_comment = array( 'date_created_gmt' => $comment_date_gmt, 'user_id' => $comment->user_id, 'comment_id' => $comment->comment_ID, 'parent' => $comment->comment_parent, 'status' => $comment_status, 'content' => $comment->comment_content, 'link' => get_comment_link( $comment ), 'post_id' => $comment->comment_post_ID, 'post_title' => get_the_title( $comment->comment_post_ID ), 'author' => $comment->comment_author, 'author_url' => $comment->comment_author_url, 'author_email' => $comment->comment_author_email, 'author_ip' => $comment->comment_author_IP, 'type' => $comment->comment_type, ); return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment ); } protected function _prepare_user( $user, $fields ) { $_user = array( 'user_id' => (string) $user->ID ); $user_fields = array( 'username' => $user->user_login, 'first_name' => $user->user_firstname, 'last_name' => $user->user_lastname, 'registered' => $this->_convert_date( $user->user_registered ), 'bio' => $user->user_description, 'email' => $user->user_email, 'nickname' => $user->nickname, 'nicename' => $user->user_nicename, 'url' => $user->user_url, 'display_name' => $user->display_name, 'roles' => $user->roles, ); if ( in_array( 'all', $fields, true ) ) { $_user = array_merge( $_user, $user_fields ); } else { if ( in_array( 'basic', $fields, true ) ) { $basic_fields = array( 'username', 'email', 'registered', 'display_name', 'nicename' ); $fields = array_merge( $fields, $basic_fields ); } $requested_fields = array_intersect_key( $user_fields, array_flip( $fields ) ); $_user = array_merge( $_user, $requested_fields ); } return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields ); } public function wp_newPost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) { $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] ); } if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) { if ( '0000-00-00 00:00:00' === $content_struct['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $content_struct['post_date_gmt'] ); } else { $content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] ); } } do_action( 'xmlrpc_call', 'wp.newPost', $args, $this ); unset( $content_struct['ID'] ); return $this->_insert_post( $user, $content_struct ); } private function _is_greater_than_one( $count ) { return $count > 1; } private function _toggle_sticky( $post_data, $update = false ) { $post_type = get_post_type_object( $post_data['post_type'] ); if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) { if ( ! empty( $post_data['sticky'] ) ) { return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) ); } if ( $update ) { unstick_post( $post_data['ID'] ); } } elseif ( isset( $post_data['sticky'] ) ) { if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to make posts sticky.' ) ); } $sticky = wp_validate_boolean( $post_data['sticky'] ); if ( $sticky ) { stick_post( $post_data['ID'] ); } else { unstick_post( $post_data['ID'] ); } } } protected function _insert_post( $user, $content_struct ) { $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => null, 'post_password' => null, 'post_excerpt' => null, 'post_content' => null, 'post_title' => null, 'post_date' => null, 'post_date_gmt' => null, 'post_format' => null, 'post_name' => null, 'post_thumbnail' => null, 'post_parent' => null, 'ping_status' => null, 'comment_status' => null, 'custom_fields' => null, 'terms_names' => null, 'terms' => null, 'sticky' => null, 'enclosure' => null, 'ID' => null, ); $post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults ); $post_type = get_post_type_object( $post_data['post_type'] ); if ( ! $post_type ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } $update = ! empty( $post_data['ID'] ); if ( $update ) { if ( ! get_post( $post_data['ID'] ) ) { return new IXR_Error( 401, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( get_post_type( $post_data['ID'] ) !== $post_data['post_type'] ) { return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); } } else { if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); } } switch ( $post_data['post_status'] ) { case 'draft': case 'pending': break; case 'private': if ( ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type.' ) ); } break; case 'publish': case 'future': if ( ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type.' ) ); } break; default: if ( ! get_post_status_object( $post_data['post_status'] ) ) { $post_data['post_status'] = 'draft'; } break; } if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type.' ) ); } $post_data['post_author'] = absint( $post_data['post_author'] ); if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) ); } $author = get_userdata( $post_data['post_author'] ); if ( ! $author ) { return new IXR_Error( 404, __( 'Invalid author ID.' ) ); } } else { $post_data['post_author'] = $user->ID; } if ( isset( $post_data['comment_status'] ) && 'open' !== $post_data['comment_status'] && 'closed' !== $post_data['comment_status'] ) { unset( $post_data['comment_status'] ); } if ( isset( $post_data['ping_status'] ) && 'open' !== $post_data['ping_status'] && 'closed' !== $post_data['ping_status'] ) { unset( $post_data['ping_status'] ); } if ( ! empty( $post_data['post_date_gmt'] ) ) { $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $post_data['post_date'] ) ) { $dateCreated = $post_data['post_date']->getIso(); } $post_data['edit_date'] = false; if ( ! empty( $dateCreated ) ) { $post_data['post_date'] = iso8601_to_datetime( $dateCreated ); $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' ); $post_data['edit_date'] = true; } if ( ! isset( $post_data['ID'] ) ) { $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID; } $post_ID = $post_data['ID']; if ( 'post' === $post_data['post_type'] ) { $error = $this->_toggle_sticky( $post_data, $update ); if ( $error ) { return $error; } } if ( isset( $post_data['post_thumbnail'] ) ) { if ( ! $post_data['post_thumbnail'] ) { delete_post_thumbnail( $post_ID ); } elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ); unset( $content_struct['post_thumbnail'] ); } if ( isset( $post_data['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $post_data['custom_fields'] ); } if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) { $post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' ); $terms = array(); if ( isset( $post_data['terms'] ) && is_array( $post_data['terms'] ) ) { $taxonomies = array_keys( $post_data['terms'] ); foreach ( $taxonomies as $taxonomy ) { if ( ! array_key_exists( $taxonomy, $post_type_taxonomies ) ) { return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); } if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) ); } $term_ids = $post_data['terms'][ $taxonomy ]; $terms[ $taxonomy ] = array(); foreach ( $term_ids as $term_id ) { $term = get_term_by( 'id', $term_id, $taxonomy ); if ( ! $term ) { return new IXR_Error( 403, __( 'Invalid term ID.' ) ); } $terms[ $taxonomy ][] = (int) $term_id; } } } if ( isset( $post_data['terms_names'] ) && is_array( $post_data['terms_names'] ) ) { $taxonomies = array_keys( $post_data['terms_names'] ); foreach ( $taxonomies as $taxonomy ) { if ( ! array_key_exists( $taxonomy, $post_type_taxonomies ) ) { return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); } if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) ); } $ambiguous_terms = array(); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $tax_term_names = get_terms( array( 'taxonomy' => $taxonomy, 'fields' => 'names', 'hide_empty' => false, ) ); $tax_term_names_count = array_count_values( $tax_term_names ); $ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one' ) ); $ambiguous_terms = array_keys( $ambiguous_tax_term_counts ); } $term_names = $post_data['terms_names'][ $taxonomy ]; foreach ( $term_names as $term_name ) { if ( in_array( $term_name, $ambiguous_terms, true ) ) { return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) ); } $term = get_term_by( 'name', $term_name, $taxonomy ); if ( ! $term ) { if ( ! current_user_can( $post_type_taxonomies[ $taxonomy ]->cap->edit_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) ); } $term_info = wp_insert_term( $term_name, $taxonomy ); if ( is_wp_error( $term_info ) ) { return new IXR_Error( 500, $term_info->get_error_message() ); } $terms[ $taxonomy ][] = (int) $term_info['term_id']; } else { $terms[ $taxonomy ][] = (int) $term->term_id; } } } } $post_data['tax_input'] = $terms; unset( $post_data['terms'], $post_data['terms_names'] ); } if ( isset( $post_data['post_format'] ) ) { $format = set_post_format( $post_ID, $post_data['post_format'] ); if ( is_wp_error( $format ) ) { return new IXR_Error( 500, $format->get_error_message() ); } unset( $post_data['post_format'] ); } $enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $enclosure ); $this->attach_uploads( $post_ID, $post_data['post_content'] ); $post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct ); $post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { if ( $update ) { return new IXR_Error( 401, __( 'Sorry, the post could not be updated.' ) ); } else { return new IXR_Error( 401, __( 'Sorry, the post could not be created.' ) ); } } return (string) $post_ID; } public function wp_editPost( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editPost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( isset( $content_struct['if_not_modified_since'] ) ) { if ( mysql2date( 'U', $post['post_modified_gmt'] ) > $content_struct['if_not_modified_since']->getTimestamp() ) { return new IXR_Error( 409, __( 'There is a revision of this post that is more recent.' ) ); } } $post['post_date'] = $this->_convert_date( $post['post_date'] ); if ( '0000-00-00 00:00:00' === $post['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { unset( $post['post_date_gmt'] ); } else { $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); } if ( ! isset( $content_struct['post_date'] ) ) { unset( $post['post_date'] ); } $this->escape( $post ); $merged_content_struct = array_merge( $post, $content_struct ); $retval = $this->_insert_post( $user, $merged_content_struct ); if ( $retval instanceof IXR_Error ) { return $retval; } return true; } public function wp_deletePost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deletePost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'delete_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); } $result = wp_delete_post( $post_id ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) ); } return true; } public function wp_getPost( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPost', $args, $this ); $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } return $this->_prepare_post( $post, $fields ); } public function wp_getPosts( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array(); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPosts', $args, $this ); $query = array(); if ( isset( $filter['post_type'] ) ) { $post_type = get_post_type_object( $filter['post_type'] ); if ( ! ( (bool) $post_type ) ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } } else { $post_type = get_post_type_object( 'post' ); } if ( ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); } $query['post_type'] = $post_type->name; if ( isset( $filter['post_status'] ) ) { $query['post_status'] = $filter['post_status']; } if ( isset( $filter['number'] ) ) { $query['numberposts'] = absint( $filter['number'] ); } if ( isset( $filter['offset'] ) ) { $query['offset'] = absint( $filter['offset'] ); } if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['s'] ) ) { $query['s'] = $filter['s']; } $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { return array(); } $struct = array(); foreach ( $posts_list as $post ) { if ( ! current_user_can( 'edit_post', $post['ID'] ) ) { continue; } $struct[] = $this->_prepare_post( $post, $fields ); } return $struct; } public function wp_newTerm( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newTerm', $args, $this ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) ); } $taxonomy = (array) $taxonomy; $term_data = array(); $term_data['name'] = trim( $content_struct['name'] ); if ( empty( $term_data['name'] ) ) { return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); } if ( isset( $content_struct['parent'] ) ) { if ( ! $taxonomy['hierarchical'] ) { return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) ); } $parent_term_id = (int) $content_struct['parent']; $parent_term = get_term( $parent_term_id, $taxonomy['name'] ); if ( is_wp_error( $parent_term ) ) { return new IXR_Error( 500, $parent_term->get_error_message() ); } if ( ! $parent_term ) { return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); } $term_data['parent'] = $content_struct['parent']; } if ( isset( $content_struct['description'] ) ) { $term_data['description'] = $content_struct['description']; } if ( isset( $content_struct['slug'] ) ) { $term_data['slug'] = $content_struct['slug']; } $term = wp_insert_term( $term_data['name'], $taxonomy['name'], $term_data ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 500, __( 'Sorry, the term could not be created.' ) ); } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] ); } return (string) $term['term_id']; } public function wp_editTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $term_id = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editTerm', $args, $this ); if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $content_struct['taxonomy'] ); $taxonomy = (array) $taxonomy; $term_data = array(); $term = get_term( $term_id, $content_struct['taxonomy'] ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'edit_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this term.' ) ); } if ( isset( $content_struct['name'] ) ) { $term_data['name'] = trim( $content_struct['name'] ); if ( empty( $term_data['name'] ) ) { return new IXR_Error( 403, __( 'The term name cannot be empty.' ) ); } } if ( ! empty( $content_struct['parent'] ) ) { if ( ! $taxonomy['hierarchical'] ) { return new IXR_Error( 403, __( 'Cannot set parent term, taxonomy is not hierarchical.' ) ); } $parent_term_id = (int) $content_struct['parent']; $parent_term = get_term( $parent_term_id, $taxonomy['name'] ); if ( is_wp_error( $parent_term ) ) { return new IXR_Error( 500, $parent_term->get_error_message() ); } if ( ! $parent_term ) { return new IXR_Error( 403, __( 'Parent term does not exist.' ) ); } $term_data['parent'] = $content_struct['parent']; } if ( isset( $content_struct['description'] ) ) { $term_data['description'] = $content_struct['description']; } if ( isset( $content_struct['slug'] ) ) { $term_data['slug'] = $content_struct['slug']; } $term = wp_update_term( $term_id, $taxonomy['name'], $term_data ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) ); } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_term_custom_fields( $term_id, $content_struct['custom_fields'] ); } return true; } public function wp_deleteTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $term_id = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deleteTerm', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); $term = get_term( $term_id, $taxonomy->name ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'delete_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this term.' ) ); } $result = wp_delete_term( $term_id, $taxonomy->name ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) ); } return $result; } public function wp_getTerm( $args ) { if ( ! $this->minimum_args( $args, 5 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $term_id = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTerm', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); $term = get_term( $term_id, $taxonomy->name, ARRAY_A ); if ( is_wp_error( $term ) ) { return new IXR_Error( 500, $term->get_error_message() ); } if ( ! $term ) { return new IXR_Error( 404, __( 'Invalid term ID.' ) ); } if ( ! current_user_can( 'assign_term', $term_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign this term.' ) ); } return $this->_prepare_term( $term ); } public function wp_getTerms( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; $filter = isset( $args[4] ) ? $args[4] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTerms', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) ); } $query = array( 'taxonomy' => $taxonomy->name ); if ( isset( $filter['number'] ) ) { $query['number'] = absint( $filter['number'] ); } if ( isset( $filter['offset'] ) ) { $query['offset'] = absint( $filter['offset'] ); } if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['hide_empty'] ) ) { $query['hide_empty'] = $filter['hide_empty']; } else { $query['get'] = 'all'; } if ( isset( $filter['search'] ) ) { $query['search'] = $filter['search']; } $terms = get_terms( $query ); if ( is_wp_error( $terms ) ) { return new IXR_Error( 500, $terms->get_error_message() ); } $struct = array(); foreach ( $terms as $term ) { $struct[] = $this->_prepare_term( $term ); } return $struct; } public function wp_getTaxonomy( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $taxonomy = $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTaxonomy', $args, $this ); if ( ! taxonomy_exists( $taxonomy ) ) { return new IXR_Error( 403, __( 'Invalid taxonomy.' ) ); } $taxonomy = get_taxonomy( $taxonomy ); if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) ); } return $this->_prepare_taxonomy( $taxonomy, $fields ); } public function wp_getTaxonomies( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getTaxonomies', $args, $this ); $taxonomies = get_taxonomies( $filter, 'objects' ); $struct = array(); foreach ( $taxonomies as $taxonomy ) { if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) { continue; } $struct[] = $this->_prepare_taxonomy( $taxonomy, $fields ); } return $struct; } public function wp_getUser( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUser', $args, $this ); if ( ! current_user_can( 'edit_user', $user_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this user.' ) ); } $user_data = get_userdata( $user_id ); if ( ! $user_data ) { return new IXR_Error( 404, __( 'Invalid user ID.' ) ); } return $this->_prepare_user( $user_data, $fields ); } public function wp_getUsers( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array(); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getUsers', $args, $this ); if ( ! current_user_can( 'list_users' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to list users.' ) ); } $query = array( 'fields' => 'all_with_meta' ); $query['number'] = ( isset( $filter['number'] ) ) ? absint( $filter['number'] ) : 50; $query['offset'] = ( isset( $filter['offset'] ) ) ? absint( $filter['offset'] ) : 0; if ( isset( $filter['orderby'] ) ) { $query['orderby'] = $filter['orderby']; if ( isset( $filter['order'] ) ) { $query['order'] = $filter['order']; } } if ( isset( $filter['role'] ) ) { if ( get_role( $filter['role'] ) === null ) { return new IXR_Error( 403, __( 'Invalid role.' ) ); } $query['role'] = $filter['role']; } if ( isset( $filter['who'] ) ) { $query['who'] = $filter['who']; } $users = get_users( $query ); $_users = array(); foreach ( $users as $user_data ) { if ( current_user_can( 'edit_user', $user_data->ID ) ) { $_users[] = $this->_prepare_user( $user_data, $fields ); } } return $_users; } public function wp_getProfile( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $fields = $args[3]; } else { $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getProfile', $args, $this ); if ( ! current_user_can( 'edit_user', $user->ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) ); } $user_data = get_userdata( $user->ID ); return $this->_prepare_user( $user_data, $fields ); } public function wp_editProfile( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editProfile', $args, $this ); if ( ! current_user_can( 'edit_user', $user->ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) ); } $user_data = array(); $user_data['ID'] = $user->ID; if ( isset( $content_struct['first_name'] ) ) { $user_data['first_name'] = $content_struct['first_name']; } if ( isset( $content_struct['last_name'] ) ) { $user_data['last_name'] = $content_struct['last_name']; } if ( isset( $content_struct['url'] ) ) { $user_data['user_url'] = $content_struct['url']; } if ( isset( $content_struct['display_name'] ) ) { $user_data['display_name'] = $content_struct['display_name']; } if ( isset( $content_struct['nickname'] ) ) { $user_data['nickname'] = $content_struct['nickname']; } if ( isset( $content_struct['nicename'] ) ) { $user_data['user_nicename'] = $content_struct['nicename']; } if ( isset( $content_struct['bio'] ) ) { $user_data['description'] = $content_struct['bio']; } $result = wp_update_user( $user_data ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the user could not be updated.' ) ); } return true; } public function wp_getPage( $args ) { $this->escape( $args ); $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $page = get_post( $page_id ); if ( ! $page ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) ); } do_action( 'xmlrpc_call', 'wp.getPage', $args, $this ); if ( $page->ID && ( 'page' === $page->post_type ) ) { return $this->_prepare_page( $page ); } else { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } } public function wp_getPages( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $num_pages = isset( $args[3] ) ? (int) $args[3] : 10; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit pages.' ) ); } do_action( 'xmlrpc_call', 'wp.getPages', $args, $this ); $pages = get_posts( array( 'post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages, ) ); $num_pages = count( $pages ); if ( $num_pages >= 1 ) { $pages_struct = array(); foreach ( $pages as $page ) { if ( current_user_can( 'edit_page', $page->ID ) ) { $pages_struct[] = $this->_prepare_page( $page ); } } return $pages_struct; } return array(); } public function wp_newPage( $args ) { $username = $this->escape( $args[1] ); $password = $this->escape( $args[2] ); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newPage', $args, $this ); $args[3]['post_type'] = 'page'; return $this->mw_newPost( $args ); } public function wp_deletePage( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $page_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deletePage', $args, $this ); $actual_page = get_post( $page_id, ARRAY_A ); if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } if ( ! current_user_can( 'delete_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this page.' ) ); } $result = wp_delete_post( $page_id ); if ( ! $result ) { return new IXR_Error( 500, __( 'Failed to delete the page.' ) ); } do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args ); return true; } public function wp_editPage( $args ) { $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $escaped_username = $this->escape( $username ); $escaped_password = $this->escape( $password ); $user = $this->login( $escaped_username, $escaped_password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.editPage', $args, $this ); $actual_page = get_post( $page_id, ARRAY_A ); if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } if ( ! current_user_can( 'edit_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) ); } $content['post_type'] = 'page'; $args = array( $page_id, $username, $password, $content, $publish, ); return $this->mw_editPost( $args ); } public function wp_getPageList( $args ) { global $wpdb; $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit pages.' ) ); } do_action( 'xmlrpc_call', 'wp.getPageList', $args, $this ); $page_list = $wpdb->get_results( " - SELECT ID page_id, - post_title page_title, - post_parent page_parent_id, - post_date_gmt, - post_date, - post_status - FROM {$wpdb->posts} - WHERE post_type = 'page' - ORDER BY ID - " ); $num_pages = count( $page_list ); for ( $i = 0; $i < $num_pages; $i++ ) { $page_list[ $i ]->dateCreated = $this->_convert_date( $page_list[ $i ]->post_date ); $page_list[ $i ]->date_created_gmt = $this->_convert_date_gmt( $page_list[ $i ]->post_date_gmt, $page_list[ $i ]->post_date ); unset( $page_list[ $i ]->post_date_gmt ); unset( $page_list[ $i ]->post_date ); unset( $page_list[ $i ]->post_status ); } return $page_list; } public function wp_getAuthors( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'wp.getAuthors', $args, $this ); $authors = array(); foreach ( get_users( array( 'fields' => array( 'ID', 'user_login', 'display_name' ) ) ) as $user ) { $authors[] = array( 'user_id' => $user->ID, 'user_login' => $user->user_login, 'display_name' => $user->display_name, ); } return $authors; } public function wp_getTags( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) ); } do_action( 'xmlrpc_call', 'wp.getKeywords', $args, $this ); $tags = array(); $all_tags = get_tags(); if ( $all_tags ) { foreach ( (array) $all_tags as $tag ) { $struct = array(); $struct['tag_id'] = $tag->term_id; $struct['name'] = $tag->name; $struct['count'] = $tag->count; $struct['slug'] = $tag->slug; $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) ); $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) ); $tags[] = $struct; } } return $tags; } public function wp_newCategory( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.newCategory', $args, $this ); if ( ! current_user_can( 'manage_categories' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a category.' ) ); } if ( empty( $category['slug'] ) ) { $category['slug'] = ''; } if ( ! isset( $category['parent_id'] ) ) { $category['parent_id'] = ''; } if ( empty( $category['description'] ) ) { $category['description'] = ''; } $new_category = array( 'cat_name' => $category['name'], 'category_nicename' => $category['slug'], 'category_parent' => $category['parent_id'], 'category_description' => $category['description'], ); $cat_id = wp_insert_category( $new_category, true ); if ( is_wp_error( $cat_id ) ) { if ( 'term_exists' === $cat_id->get_error_code() ) { return (int) $cat_id->get_error_data(); } else { return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) ); } } elseif ( ! $cat_id ) { return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) ); } do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args ); return $cat_id; } public function wp_deleteCategory( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.deleteCategory', $args, $this ); if ( ! current_user_can( 'delete_term', $category_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this category.' ) ); } $status = wp_delete_term( $category_id, 'category' ); if ( true == $status ) { do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args ); } return $status; } public function wp_suggestCategories( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $category = $args[3]; $max_results = (int) $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'wp.suggestCategories', $args, $this ); $category_suggestions = array(); $args = array( 'get' => 'all', 'number' => $max_results, 'name__like' => $category, ); foreach ( (array) get_categories( $args ) as $cat ) { $category_suggestions[] = array( 'category_id' => $cat->term_id, 'category_name' => $cat->name, ); } return $category_suggestions; } public function wp_getComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getComment', $args, $this ); $comment = get_comment( $comment_id ); if ( ! $comment ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); } return $this->_prepare_comment( $comment ); } public function wp_getComments( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $struct = isset( $args[3] ) ? $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getComments', $args, $this ); if ( isset( $struct['status'] ) ) { $status = $struct['status']; } else { $status = ''; } if ( ! current_user_can( 'moderate_comments' ) && 'approve' !== $status ) { return new IXR_Error( 401, __( 'Invalid comment status.' ) ); } $post_id = ''; if ( isset( $struct['post_id'] ) ) { $post_id = absint( $struct['post_id'] ); } $post_type = ''; if ( isset( $struct['post_type'] ) ) { $post_type_object = get_post_type_object( $struct['post_type'] ); if ( ! $post_type_object || ! post_type_supports( $post_type_object->name, 'comments' ) ) { return new IXR_Error( 404, __( 'Invalid post type.' ) ); } $post_type = $struct['post_type']; } $offset = 0; if ( isset( $struct['offset'] ) ) { $offset = absint( $struct['offset'] ); } $number = 10; if ( isset( $struct['number'] ) ) { $number = absint( $struct['number'] ); } $comments = get_comments( array( 'status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number, 'post_type' => $post_type, ) ); $comments_struct = array(); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { $comments_struct[] = $this->_prepare_comment( $comment ); } } return $comments_struct; } public function wp_deleteComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_ID = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_comment( $comment_ID ) ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_ID ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) ); } do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this ); $status = wp_delete_comment( $comment_ID ); if ( $status ) { do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); } return $status; } public function wp_editComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $comment_ID = (int) $args[3]; $content_struct = $args[4]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_comment( $comment_ID ) ) { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } if ( ! current_user_can( 'edit_comment', $comment_ID ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); } do_action( 'xmlrpc_call', 'wp.editComment', $args, $this ); $comment = array( 'comment_ID' => $comment_ID, ); if ( isset( $content_struct['status'] ) ) { $statuses = get_comment_statuses(); $statuses = array_keys( $statuses ); if ( ! in_array( $content_struct['status'], $statuses, true ) ) { return new IXR_Error( 401, __( 'Invalid comment status.' ) ); } $comment['comment_approved'] = $content_struct['status']; } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; $comment['comment_date'] = get_date_from_gmt( $dateCreated ); $comment['comment_date_gmt'] = iso8601_to_datetime( $dateCreated, 'gmt' ); } if ( isset( $content_struct['content'] ) ) { $comment['comment_content'] = $content_struct['content']; } if ( isset( $content_struct['author'] ) ) { $comment['comment_author'] = $content_struct['author']; } if ( isset( $content_struct['author_url'] ) ) { $comment['comment_author_url'] = $content_struct['author_url']; } if ( isset( $content_struct['author_email'] ) ) { $comment['comment_author_email'] = $content_struct['author_email']; } $result = wp_update_comment( $comment, true ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the comment could not be updated.' ) ); } do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); return true; } public function wp_newComment( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post = $args[3]; $content_struct = $args[4]; $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false ); $user = $this->login( $username, $password ); if ( ! $user ) { $logged_in = false; if ( $allow_anon && get_option( 'comment_registration' ) ) { return new IXR_Error( 403, __( 'Sorry, you must be logged in to comment.' ) ); } elseif ( ! $allow_anon ) { return $this->error; } } else { $logged_in = true; } if ( is_numeric( $post ) ) { $post_id = absint( $post ); } else { $post_id = url_to_postid( $post ); } if ( ! $post_id ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! get_post( $post_id ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! comments_open( $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, comments are closed for this item.' ) ); } if ( 'publish' === get_post_status( $post_id ) && ! current_user_can( 'edit_post', $post_id ) && post_password_required( $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); } if ( 'private' === get_post_status( $post_id ) && ! current_user_can( 'read_post', $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); } $comment = array( 'comment_post_ID' => $post_id, 'comment_content' => trim( $content_struct['content'] ), ); if ( $logged_in ) { $display_name = $user->display_name; $user_email = $user->user_email; $user_url = $user->user_url; $comment['comment_author'] = $this->escape( $display_name ); $comment['comment_author_email'] = $this->escape( $user_email ); $comment['comment_author_url'] = $this->escape( $user_url ); $comment['user_ID'] = $user->ID; } else { $comment['comment_author'] = ''; if ( isset( $content_struct['author'] ) ) { $comment['comment_author'] = $content_struct['author']; } $comment['comment_author_email'] = ''; if ( isset( $content_struct['author_email'] ) ) { $comment['comment_author_email'] = $content_struct['author_email']; } $comment['comment_author_url'] = ''; if ( isset( $content_struct['author_url'] ) ) { $comment['comment_author_url'] = $content_struct['author_url']; } $comment['user_ID'] = 0; if ( get_option( 'require_name_email' ) ) { if ( strlen( $comment['comment_author_email'] ) < 6 || '' === $comment['comment_author'] ) { return new IXR_Error( 403, __( 'Comment author name and email are required.' ) ); } elseif ( ! is_email( $comment['comment_author_email'] ) ) { return new IXR_Error( 403, __( 'A valid email address is required.' ) ); } } } $comment['comment_parent'] = isset( $content_struct['comment_parent'] ) ? absint( $content_struct['comment_parent'] ) : 0; $allow_empty = apply_filters( 'allow_empty_comment', false, $comment ); if ( ! $allow_empty && '' === $comment['comment_content'] ) { return new IXR_Error( 403, __( 'Comment is required.' ) ); } do_action( 'xmlrpc_call', 'wp.newComment', $args, $this ); $comment_ID = wp_new_comment( $comment, true ); if ( is_wp_error( $comment_ID ) ) { return new IXR_Error( 403, $comment_ID->get_error_message() ); } if ( ! $comment_ID ) { return new IXR_Error( 403, __( 'Something went wrong.' ) ); } do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); return $comment_ID; } public function wp_getCommentStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getCommentStatusList', $args, $this ); return get_comment_statuses(); } public function wp_getCommentCount( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $post = get_post( $post_id, ARRAY_A ); if ( empty( $post['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details of this post.' ) ); } do_action( 'xmlrpc_call', 'wp.getCommentCount', $args, $this ); $count = wp_count_comments( $post_id ); return array( 'approved' => $count->approved, 'awaiting_moderation' => $count->moderated, 'spam' => $count->spam, 'total_comments' => $count->total_comments, ); } public function wp_getPostStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPostStatusList', $args, $this ); return get_post_statuses(); } public function wp_getPageStatusList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPageStatusList', $args, $this ); return get_page_statuses(); } public function wp_getPageTemplates( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_pages' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } $templates = get_page_templates(); $templates['Default'] = 'default'; return $templates; } public function wp_getOptions( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $options = isset( $args[3] ) ? (array) $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( count( $options ) == 0 ) { $options = array_keys( $this->blog_options ); } return $this->_getOptions( $options ); } public function _getOptions( $options ) { $data = array(); $can_manage = current_user_can( 'manage_options' ); foreach ( $options as $option ) { if ( array_key_exists( $option, $this->blog_options ) ) { $data[ $option ] = $this->blog_options[ $option ]; if ( isset( $data[ $option ]['option'] ) ) { $data[ $option ]['value'] = get_option( $data[ $option ]['option'] ); unset( $data[ $option ]['option'] ); } if ( ! $can_manage ) { $data[ $option ]['readonly'] = true; } } } return $data; } public function wp_setOptions( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $options = (array) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'manage_options' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to update options.' ) ); } $option_names = array(); foreach ( $options as $o_name => $o_value ) { $option_names[] = $o_name; if ( ! array_key_exists( $o_name, $this->blog_options ) ) { continue; } if ( true == $this->blog_options[ $o_name ]['readonly'] ) { continue; } update_option( $this->blog_options[ $o_name ]['option'], wp_unslash( $o_value ) ); } return $this->_getOptions( $option_names ); } public function wp_getMediaItem( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $attachment_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'upload_files' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to upload files.' ) ); } do_action( 'xmlrpc_call', 'wp.getMediaItem', $args, $this ); $attachment = get_post( $attachment_id ); if ( ! $attachment || 'attachment' !== $attachment->post_type ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } return $this->_prepare_media_item( $attachment ); } public function wp_getMediaLibrary( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $struct = isset( $args[3] ) ? $args[3] : array(); $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'upload_files' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to upload files.' ) ); } do_action( 'xmlrpc_call', 'wp.getMediaLibrary', $args, $this ); $parent_id = ( isset( $struct['parent_id'] ) ) ? absint( $struct['parent_id'] ) : ''; $mime_type = ( isset( $struct['mime_type'] ) ) ? $struct['mime_type'] : ''; $offset = ( isset( $struct['offset'] ) ) ? absint( $struct['offset'] ) : 0; $number = ( isset( $struct['number'] ) ) ? absint( $struct['number'] ) : -1; $attachments = get_posts( array( 'post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type, ) ); $attachments_struct = array(); foreach ( $attachments as $attachment ) { $attachments_struct[] = $this->_prepare_media_item( $attachment ); } return $attachments_struct; } public function wp_getPostFormats( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 403, __( 'Sorry, you are not allowed to access details about this site.' ) ); } do_action( 'xmlrpc_call', 'wp.getPostFormats', $args, $this ); $formats = get_post_format_strings(); if ( isset( $args[3] ) && is_array( $args[3] ) ) { if ( $args[3]['show-supported'] ) { if ( current_theme_supports( 'post-formats' ) ) { $supported = get_theme_support( 'post-formats' ); $data = array(); $data['all'] = $formats; $data['supported'] = $supported[0]; $formats = $data; } } } return $formats; } public function wp_getPostType( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_type_name = $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPostType', $args, $this ); if ( ! post_type_exists( $post_type_name ) ) { return new IXR_Error( 403, __( 'Invalid post type.' ) ); } $post_type = get_post_type_object( $post_type_name ); if ( ! current_user_can( $post_type->cap->edit_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); } return $this->_prepare_post_type( $post_type, $fields ); } public function wp_getPostTypes( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getPostTypes', $args, $this ); $post_types = get_post_types( $filter, 'objects' ); $struct = array(); foreach ( $post_types as $post_type ) { if ( ! current_user_can( $post_type->cap->edit_posts ) ) { continue; } $struct[ $post_type->name ] = $this->_prepare_post_type( $post_type, $fields ); } return $struct; } public function wp_getRevisions( $args ) { if ( ! $this->minimum_args( $args, 4 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $post_id = (int) $args[3]; if ( isset( $args[4] ) ) { $fields = $args[4]; } else { $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' ); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.getRevisions', $args, $this ); $post = get_post( $post_id ); if ( ! $post ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } if ( ! wp_revisions_enabled( $post ) ) { return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) ); } $revisions = wp_get_post_revisions( $post_id ); if ( ! $revisions ) { return array(); } $struct = array(); foreach ( $revisions as $revision ) { if ( ! current_user_can( 'read_post', $revision->ID ) ) { continue; } if ( wp_is_post_autosave( $revision ) ) { continue; } $struct[] = $this->_prepare_post( get_object_vars( $revision ), $fields ); } return $struct; } public function wp_restoreRevision( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $revision_id = (int) $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'wp.restoreRevision', $args, $this ); $revision = wp_get_post_revision( $revision_id ); if ( ! $revision ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( wp_is_post_autosave( $revision ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } $post = get_post( $revision->post_parent ); if ( ! $post ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! wp_revisions_enabled( $post ) ) { return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) ); } $post = wp_restore_post_revision( $revision_id ); return (bool) $post; } public function blogger_getUsersBlogs( $args ) { if ( ! $this->minimum_args( $args, 3 ) ) { return $this->error; } if ( is_multisite() ) { return $this->_multisite_getUsersBlogs( $args ); } $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.getUsersBlogs', $args, $this ); $is_admin = current_user_can( 'manage_options' ); $struct = array( 'isAdmin' => $is_admin, 'url' => get_option( 'home' ) . '/', 'blogid' => '1', 'blogName' => get_option( 'blogname' ), 'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ), ); return array( $struct ); } protected function _multisite_getUsersBlogs( $args ) { $current_blog = get_site(); $domain = $current_blog->domain; $path = $current_blog->path . 'xmlrpc.php'; $rpc = new IXR_Client( set_url_scheme( "http://{$domain}{$path}" ) ); $rpc->query( 'wp.getUsersBlogs', $args[1], $args[2] ); $blogs = $rpc->getResponse(); if ( isset( $blogs['faultCode'] ) ) { return new IXR_Error( $blogs['faultCode'], $blogs['faultString'] ); } if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) { return $blogs; } else { foreach ( (array) $blogs as $blog ) { if ( strpos( $blog['url'], $_SERVER['HTTP_HOST'] ) ) { return array( $blog ); } } return array(); } } public function blogger_getUserInfo( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to access user data on this site.' ) ); } do_action( 'xmlrpc_call', 'blogger.getUserInfo', $args, $this ); $struct = array( 'nickname' => $user->nickname, 'userid' => $user->ID, 'url' => $user->user_url, 'lastname' => $user->last_name, 'firstname' => $user->first_name, ); return $struct; } public function blogger_getPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $post_data = get_post( $post_ID, ARRAY_A ); if ( ! $post_data ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'blogger.getPost', $args, $this ); $categories = implode( ',', wp_get_post_categories( $post_ID ) ); $content = '' . wp_unslash( $post_data['post_title'] ) . ''; $content .= '' . $categories . ''; $content .= wp_unslash( $post_data['post_content'] ); $struct = array( 'userid' => $post_data['post_author'], 'dateCreated' => $this->_convert_date( $post_data['post_date'] ), 'content' => $content, 'postid' => (string) $post_data['ID'], ); return $struct; } public function blogger_getRecentPosts( $args ) { $this->escape( $args ); $username = $args[2]; $password = $args[3]; if ( isset( $args[4] ) ) { $query = array( 'numberposts' => absint( $args[4] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'blogger.getRecentPosts', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { $this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); return $this->error; } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $categories = implode( ',', wp_get_post_categories( $entry['ID'] ) ); $content = '' . wp_unslash( $entry['post_title'] ) . ''; $content .= '' . $categories . ''; $content .= wp_unslash( $entry['post_content'] ); $recent_posts[] = array( 'userid' => $entry['post_author'], 'dateCreated' => $post_date, 'content' => $content, 'postid' => (string) $entry['ID'], ); } return $recent_posts; } public function blogger_getTemplate( $args ) { return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) ); } public function blogger_setTemplate( $args ) { return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) ); } public function blogger_newPost( $args ) { $this->escape( $args ); $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.newPost', $args, $this ); $cap = ( $publish ) ? 'publish_posts' : 'edit_posts'; if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || ! current_user_can( $cap ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); } $post_status = ( $publish ) ? 'publish' : 'draft'; $post_author = $user->ID; $post_title = xmlrpc_getposttitle( $content ); $post_category = xmlrpc_getpostcategory( $content ); $post_content = xmlrpc_removepostdata( $content ); $post_date = current_time( 'mysql' ); $post_date_gmt = current_time( 'mysql', 1 ); $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' ); $post_ID = wp_insert_post( $post_data ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); } $this->attach_uploads( $post_ID, $post_content ); do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args ); return $post_ID; } public function blogger_editPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $content = $args[4]; $publish = $args[5]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.editPost', $args, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } $this->escape( $actual_post ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( 'publish' === $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } $postdata = array(); $postdata['ID'] = $actual_post['ID']; $postdata['post_content'] = xmlrpc_removepostdata( $content ); $postdata['post_title'] = xmlrpc_getposttitle( $content ); $postdata['post_category'] = xmlrpc_getpostcategory( $content ); $postdata['post_status'] = $actual_post['post_status']; $postdata['post_excerpt'] = $actual_post['post_excerpt']; $postdata['post_status'] = $publish ? 'publish' : 'draft'; $result = wp_update_post( $postdata ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) ); } $this->attach_uploads( $actual_post['ID'], $postdata['post_content'] ); do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args ); return true; } public function blogger_deletePost( $args ) { $this->escape( $args ); $post_ID = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'blogger.deletePost', $args, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } if ( ! current_user_can( 'delete_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) ); } $result = wp_delete_post( $post_ID ); if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) ); } do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args ); return true; } public function mw_newPost( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $publish = isset( $args[4] ) ? $args[4] : 0; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.newPost', $args, $this ); $page_template = ''; if ( ! empty( $content_struct['post_type'] ) ) { if ( 'page' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_pages'; } elseif ( isset( $content_struct['page_status'] ) && 'publish' === $content_struct['page_status'] ) { $cap = 'publish_pages'; } else { $cap = 'edit_pages'; } $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' ); $post_type = 'page'; if ( ! empty( $content_struct['wp_page_template'] ) ) { $page_template = $content_struct['wp_page_template']; } } elseif ( 'post' === $content_struct['post_type'] ) { if ( $publish ) { $cap = 'publish_posts'; } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; } $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); $post_type = 'post'; } else { return new IXR_Error( 401, __( 'Invalid post type.' ) ); } } else { if ( $publish ) { $cap = 'publish_posts'; } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { $cap = 'publish_posts'; } else { $cap = 'edit_posts'; } $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); $post_type = 'post'; } if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) ); } if ( ! current_user_can( $cap ) ) { return new IXR_Error( 401, $error_message ); } if ( isset( $content_struct['wp_post_format'] ) ) { $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); if ( ! array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { return new IXR_Error( 404, __( 'Invalid post format.' ) ); } } $post_name = ''; if ( isset( $content_struct['wp_slug'] ) ) { $post_name = $content_struct['wp_slug']; } if ( isset( $content_struct['wp_password'] ) ) { $post_password = $content_struct['wp_password']; } else { $post_password = ''; } if ( isset( $content_struct['wp_page_parent_id'] ) ) { $post_parent = $content_struct['wp_page_parent_id']; } else { $post_parent = 0; } if ( isset( $content_struct['wp_page_order'] ) ) { $menu_order = $content_struct['wp_page_order']; } else { $menu_order = 0; } $post_author = $user->ID; if ( isset( $content_struct['wp_author_id'] ) && ( $user->ID != $content_struct['wp_author_id'] ) ) { switch ( $post_type ) { case 'post': if ( ! current_user_can( 'edit_others_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) ); } break; case 'page': if ( ! current_user_can( 'edit_others_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to create pages as this user.' ) ); } break; default: return new IXR_Error( 401, __( 'Invalid post type.' ) ); } $author = get_userdata( $content_struct['wp_author_id'] ); if ( ! $author ) { return new IXR_Error( 404, __( 'Invalid author ID.' ) ); } $post_author = $content_struct['wp_author_id']; } $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; $post_status = $publish ? 'publish' : 'draft'; if ( isset( $content_struct[ "{$post_type}_status" ] ) ) { switch ( $content_struct[ "{$post_type}_status" ] ) { case 'draft': case 'pending': case 'private': case 'publish': $post_status = $content_struct[ "{$post_type}_status" ]; break; default: $post_status = $publish ? 'publish' : 'draft'; break; } } $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null; $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; if ( isset( $content_struct['mt_allow_comments'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_comments'] ) ) { switch ( $content_struct['mt_allow_comments'] ) { case 'closed': $comment_status = 'closed'; break; case 'open': $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } else { switch ( (int) $content_struct['mt_allow_comments'] ) { case 0: case 2: $comment_status = 'closed'; break; case 1: $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } } else { $comment_status = get_default_comment_status( $post_type ); } if ( isset( $content_struct['mt_allow_pings'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_pings'] ) ) { switch ( $content_struct['mt_allow_pings'] ) { case 'closed': $ping_status = 'closed'; break; case 'open': $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } else { switch ( (int) $content_struct['mt_allow_pings'] ) { case 0: $ping_status = 'closed'; break; case 1: $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } } else { $ping_status = get_default_comment_status( $post_type, 'pingback' ); } if ( $post_more ) { $post_content = $post_content . '' . $post_more; } $to_ping = null; if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { $to_ping = $content_struct['mt_tb_ping_urls']; if ( is_array( $to_ping ) ) { $to_ping = implode( ' ', $to_ping ); } } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $content_struct['dateCreated'] ) ) { $dateCreated = $content_struct['dateCreated']->getIso(); } if ( ! empty( $dateCreated ) ) { $post_date = iso8601_to_datetime( $dateCreated ); $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' ); } else { $post_date = ''; $post_date_gmt = ''; } $post_category = array(); if ( isset( $content_struct['categories'] ) ) { $catnames = $content_struct['categories']; if ( is_array( $catnames ) ) { foreach ( $catnames as $cat ) { $post_category[] = get_cat_ID( $cat ); } } } $postdata = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template' ); $post_ID = get_default_post_to_edit( $post_type, true )->ID; $postdata['ID'] = $post_ID; if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $postdata; $data['sticky'] = $content_struct['sticky']; $error = $this->_toggle_sticky( $data ); if ( $error ) { return $error; } } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $content_struct['custom_fields'] ); } if ( isset( $content_struct['wp_post_thumbnail'] ) ) { if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } unset( $content_struct['wp_post_thumbnail'] ); } $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $thisEnclosure ); $this->attach_uploads( $post_ID, $post_content ); if ( isset( $content_struct['wp_post_format'] ) ) { set_post_format( $post_ID, $content_struct['wp_post_format'] ); } $post_ID = wp_insert_post( $postdata, true ); if ( is_wp_error( $post_ID ) ) { return new IXR_Error( 500, $post_ID->get_error_message() ); } if ( ! $post_ID ) { return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) ); } do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args ); return (string) $post_ID; } public function add_enclosure_if_new( $post_ID, $enclosure ) { if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n"; $found = false; $enclosures = get_post_meta( $post_ID, 'enclosure' ); if ( $enclosures ) { foreach ( $enclosures as $enc ) { if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) { $found = true; break; } } } if ( ! $found ) { add_post_meta( $post_ID, 'enclosure', $encstring ); } } } public function attach_uploads( $post_ID, $post_content ) { global $wpdb; $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); if ( is_array( $attachments ) ) { foreach ( $attachments as $file ) { if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false ) { $wpdb->update( $wpdb->posts, array( 'post_parent' => $post_ID ), array( 'ID' => $file->ID ) ); } } } } public function mw_editPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $content_struct = $args[3]; $publish = isset( $args[4] ) ? $args[4] : 0; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.editPost', $args, $this ); $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata || empty( $postdata['ID'] ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } if ( ! in_array( $postdata['post_type'], array( 'post', 'page' ), true ) ) { return new IXR_Error( 401, __( 'Invalid post type.' ) ); } if ( ! empty( $content_struct['post_type'] ) && ( $content_struct['post_type'] != $postdata['post_type'] ) ) { return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); } if ( isset( $content_struct['wp_post_format'] ) ) { $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] ); if ( ! array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) { return new IXR_Error( 404, __( 'Invalid post format.' ) ); } } $this->escape( $postdata ); $ID = $postdata['ID']; $post_content = $postdata['post_content']; $post_title = $postdata['post_title']; $post_excerpt = $postdata['post_excerpt']; $post_password = $postdata['post_password']; $post_parent = $postdata['post_parent']; $post_type = $postdata['post_type']; $menu_order = $postdata['menu_order']; $ping_status = $postdata['ping_status']; $comment_status = $postdata['comment_status']; $post_name = $postdata['post_name']; if ( isset( $content_struct['wp_slug'] ) ) { $post_name = $content_struct['wp_slug']; } if ( isset( $content_struct['wp_password'] ) ) { $post_password = $content_struct['wp_password']; } if ( isset( $content_struct['wp_page_parent_id'] ) ) { $post_parent = $content_struct['wp_page_parent_id']; } if ( isset( $content_struct['wp_page_order'] ) ) { $menu_order = $content_struct['wp_page_order']; } $page_template = null; if ( ! empty( $content_struct['wp_page_template'] ) && 'page' === $post_type ) { $page_template = $content_struct['wp_page_template']; } $post_author = $postdata['post_author']; if ( isset( $content_struct['wp_author_id'] ) ) { if ( $user->ID != $content_struct['wp_author_id'] || $user->ID != $post_author ) { switch ( $post_type ) { case 'post': if ( ! current_user_can( 'edit_others_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the post author as this user.' ) ); } break; case 'page': if ( ! current_user_can( 'edit_others_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the page author as this user.' ) ); } break; default: return new IXR_Error( 401, __( 'Invalid post type.' ) ); } $post_author = $content_struct['wp_author_id']; } } if ( isset( $content_struct['mt_allow_comments'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_comments'] ) ) { switch ( $content_struct['mt_allow_comments'] ) { case 'closed': $comment_status = 'closed'; break; case 'open': $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } else { switch ( (int) $content_struct['mt_allow_comments'] ) { case 0: case 2: $comment_status = 'closed'; break; case 1: $comment_status = 'open'; break; default: $comment_status = get_default_comment_status( $post_type ); break; } } } if ( isset( $content_struct['mt_allow_pings'] ) ) { if ( ! is_numeric( $content_struct['mt_allow_pings'] ) ) { switch ( $content_struct['mt_allow_pings'] ) { case 'closed': $ping_status = 'closed'; break; case 'open': $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } else { switch ( (int) $content_struct['mt_allow_pings'] ) { case 0: $ping_status = 'closed'; break; case 1: $ping_status = 'open'; break; default: $ping_status = get_default_comment_status( $post_type, 'pingback' ); break; } } } if ( isset( $content_struct['title'] ) ) { $post_title = $content_struct['title']; } if ( isset( $content_struct['description'] ) ) { $post_content = $content_struct['description']; } $post_category = array(); if ( isset( $content_struct['categories'] ) ) { $catnames = $content_struct['categories']; if ( is_array( $catnames ) ) { foreach ( $catnames as $cat ) { $post_category[] = get_cat_ID( $cat ); } } } if ( isset( $content_struct['mt_excerpt'] ) ) { $post_excerpt = $content_struct['mt_excerpt']; } $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; $post_status = $publish ? 'publish' : 'draft'; if ( isset( $content_struct[ "{$post_type}_status" ] ) ) { switch ( $content_struct[ "{$post_type}_status" ] ) { case 'draft': case 'pending': case 'private': case 'publish': $post_status = $content_struct[ "{$post_type}_status" ]; break; default: $post_status = $publish ? 'publish' : 'draft'; break; } } $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; if ( 'publish' === $post_status || 'private' === $post_status ) { if ( 'page' === $post_type && ! current_user_can( 'publish_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) ); } elseif ( ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } } if ( $post_more ) { $post_content = $post_content . '' . $post_more; } $to_ping = null; if ( isset( $content_struct['mt_tb_ping_urls'] ) ) { $to_ping = $content_struct['mt_tb_ping_urls']; if ( is_array( $to_ping ) ) { $to_ping = implode( ' ', $to_ping ); } } if ( ! empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; } elseif ( ! empty( $content_struct['dateCreated'] ) ) { $dateCreated = $content_struct['dateCreated']->getIso(); } $edit_date = false; if ( ! empty( $dateCreated ) ) { $post_date = iso8601_to_datetime( $dateCreated ); $post_date_gmt = iso8601_to_datetime( $dateCreated, 'gmt' ); $edit_date = true; } else { $post_date = $postdata['post_date']; $post_date_gmt = $postdata['post_date_gmt']; } $newpost = compact( 'ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'edit_date', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template' ); $result = wp_update_post( $newpost, true ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } if ( ! $result ) { return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) ); } if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { $data = $newpost; $data['sticky'] = $content_struct['sticky']; $data['post_type'] = 'post'; $error = $this->_toggle_sticky( $data, true ); if ( $error ) { return $error; } } if ( isset( $content_struct['custom_fields'] ) ) { $this->set_custom_fields( $post_ID, $content_struct['custom_fields'] ); } if ( isset( $content_struct['wp_post_thumbnail'] ) ) { if ( empty( $content_struct['wp_post_thumbnail'] ) ) { delete_post_thumbnail( $post_ID ); } else { if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } } unset( $content_struct['wp_post_thumbnail'] ); } $thisEnclosure = isset( $content_struct['enclosure'] ) ? $content_struct['enclosure'] : null; $this->add_enclosure_if_new( $post_ID, $thisEnclosure ); $this->attach_uploads( $ID, $post_content ); if ( isset( $content_struct['wp_post_format'] ) ) { set_post_format( $post_ID, $content_struct['wp_post_format'] ); } do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args ); return true; } public function mw_getPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getPost', $args, $this ); if ( '' !== $postdata['post_date'] ) { $post_date = $this->_convert_date( $postdata['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] ); $post_modified = $this->_convert_date( $postdata['post_modified'] ); $post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] ); $categories = array(); $catids = wp_get_post_categories( $post_ID ); foreach ( $catids as $catid ) { $categories[] = get_cat_name( $catid ); } $tagnames = array(); $tags = wp_get_post_tags( $post_ID ); if ( ! empty( $tags ) ) { foreach ( $tags as $tag ) { $tagnames[] = $tag->name; } $tagnames = implode( ', ', $tagnames ); } else { $tagnames = ''; } $post = get_extended( $postdata['post_content'] ); $link = get_permalink( $postdata['ID'] ); $author = get_userdata( $postdata['post_author'] ); $allow_comments = ( 'open' === $postdata['comment_status'] ) ? 1 : 0; $allow_pings = ( 'open' === $postdata['ping_status'] ) ? 1 : 0; if ( 'future' === $postdata['post_status'] ) { $postdata['post_status'] = 'publish'; } $post_format = get_post_format( $post_ID ); if ( empty( $post_format ) ) { $post_format = 'standard'; } $sticky = false; if ( is_sticky( $post_ID ) ) { $sticky = true; } $enclosure = array(); foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) { if ( 'enclosure' === $key ) { foreach ( (array) $val as $enc ) { $encdata = explode( "\n", $enc ); $enclosure['url'] = trim( htmlspecialchars( $encdata[0] ) ); $enclosure['length'] = (int) trim( $encdata[1] ); $enclosure['type'] = trim( $encdata[2] ); break 2; } } } $resp = array( 'dateCreated' => $post_date, 'userid' => $postdata['post_author'], 'postid' => $postdata['ID'], 'description' => $post['main'], 'title' => $postdata['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $postdata['post_excerpt'], 'mt_text_more' => $post['extended'], 'wp_more_text' => $post['more_text'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $postdata['post_name'], 'wp_password' => $postdata['post_password'], 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $post_date_gmt, 'post_status' => $postdata['post_status'], 'custom_fields' => $this->get_custom_fields( $post_ID ), 'wp_post_format' => $post_format, 'sticky' => $sticky, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, ); if ( ! empty( $enclosure ) ) { $resp['enclosure'] = $enclosure; } $resp['wp_post_thumbnail'] = get_post_thumbnail_id( $postdata['ID'] ); return $resp; } else { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } } public function mw_getRecentPosts( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $query = array( 'numberposts' => absint( $args[3] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { return array(); } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] ); $post_modified = $this->_convert_date( $entry['post_modified'] ); $post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] ); $categories = array(); $catids = wp_get_post_categories( $entry['ID'] ); foreach ( $catids as $catid ) { $categories[] = get_cat_name( $catid ); } $tagnames = array(); $tags = wp_get_post_tags( $entry['ID'] ); if ( ! empty( $tags ) ) { foreach ( $tags as $tag ) { $tagnames[] = $tag->name; } $tagnames = implode( ', ', $tagnames ); } else { $tagnames = ''; } $post = get_extended( $entry['post_content'] ); $link = get_permalink( $entry['ID'] ); $author = get_userdata( $entry['post_author'] ); $allow_comments = ( 'open' === $entry['comment_status'] ) ? 1 : 0; $allow_pings = ( 'open' === $entry['ping_status'] ) ? 1 : 0; if ( 'future' === $entry['post_status'] ) { $entry['post_status'] = 'publish'; } $post_format = get_post_format( $entry['ID'] ); if ( empty( $post_format ) ) { $post_format = 'standard'; } $recent_posts[] = array( 'dateCreated' => $post_date, 'userid' => $entry['post_author'], 'postid' => (string) $entry['ID'], 'description' => $post['main'], 'title' => $entry['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'wp_more_text' => $post['more_text'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $entry['post_name'], 'wp_password' => $entry['post_password'], 'wp_author_id' => (string) $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => $post_date_gmt, 'post_status' => $entry['post_status'], 'custom_fields' => $this->get_custom_fields( $entry['ID'] ), 'wp_post_format' => $post_format, 'date_modified' => $post_modified, 'date_modified_gmt' => $post_modified_gmt, 'sticky' => ( 'post' === $entry['post_type'] && is_sticky( $entry['ID'] ) ), 'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] ), ); } return $recent_posts; } public function mw_getCategories( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'metaWeblog.getCategories', $args, $this ); $categories_struct = array(); $cats = get_categories( array( 'get' => 'all' ) ); if ( $cats ) { foreach ( $cats as $cat ) { $struct = array(); $struct['categoryId'] = $cat->term_id; $struct['parentId'] = $cat->parent; $struct['description'] = $cat->name; $struct['categoryDescription'] = $cat->description; $struct['categoryName'] = $cat->name; $struct['htmlUrl'] = esc_html( get_category_link( $cat->term_id ) ); $struct['rssUrl'] = esc_html( get_category_feed_link( $cat->term_id, 'rss2' ) ); $categories_struct[] = $struct; } } return $categories_struct; } public function mw_newMediaObject( $args ) { global $wpdb; $username = $this->escape( $args[1] ); $password = $this->escape( $args[2] ); $data = $args[3]; $name = sanitize_file_name( $data['name'] ); $type = $data['type']; $bits = $data['bits']; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject', $args, $this ); if ( ! current_user_can( 'upload_files' ) ) { $this->error = new IXR_Error( 401, __( 'Sorry, you are not allowed to upload files.' ) ); return $this->error; } if ( is_multisite() && upload_is_user_over_quota( false ) ) { $this->error = new IXR_Error( 401, sprintf( __( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ), size_format( get_space_allowed() * MB_IN_BYTES ) ) ); return $this->error; } $upload_err = apply_filters( 'pre_upload_error', false ); if ( $upload_err ) { return new IXR_Error( 500, $upload_err ); } $upload = wp_upload_bits( $name, null, $bits ); if ( ! empty( $upload['error'] ) ) { $errorString = sprintf( __( 'Could not write file %1$s (%2$s).' ), $name, $upload['error'] ); return new IXR_Error( 500, $errorString ); } $post_id = 0; if ( ! empty( $data['post_id'] ) ) { $post_id = (int) $data['post_id']; if ( ! current_user_can( 'edit_post', $post_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } } $attachment = array( 'post_title' => $name, 'post_content' => '', 'post_type' => 'attachment', 'post_parent' => $post_id, 'post_mime_type' => $type, 'guid' => $upload['url'], ); $id = wp_insert_attachment( $attachment, $upload['file'], $post_id ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args ); $struct = $this->_prepare_media_item( get_post( $id ) ); $struct['id'] = $struct['attachment_id']; $struct['file'] = $struct['title']; $struct['url'] = $struct['link']; return $struct; } public function mt_getRecentPostTitles( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; if ( isset( $args[3] ) ) { $query = array( 'numberposts' => absint( $args[3] ) ); } else { $query = array(); } $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.getRecentPostTitles', $args, $this ); $posts_list = wp_get_recent_posts( $query ); if ( ! $posts_list ) { $this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); return $this->error; } $recent_posts = array(); foreach ( $posts_list as $entry ) { if ( ! current_user_can( 'edit_post', $entry['ID'] ) ) { continue; } $post_date = $this->_convert_date( $entry['post_date'] ); $post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] ); $recent_posts[] = array( 'dateCreated' => $post_date, 'userid' => $entry['post_author'], 'postid' => (string) $entry['ID'], 'title' => $entry['post_title'], 'post_status' => $entry['post_status'], 'date_created_gmt' => $post_date_gmt, ); } return $recent_posts; } public function mt_getCategoryList( $args ) { $this->escape( $args ); $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! current_user_can( 'edit_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) ); } do_action( 'xmlrpc_call', 'mt.getCategoryList', $args, $this ); $categories_struct = array(); $cats = get_categories( array( 'hide_empty' => 0, 'hierarchical' => 0, ) ); if ( $cats ) { foreach ( $cats as $cat ) { $struct = array(); $struct['categoryId'] = $cat->term_id; $struct['categoryName'] = $cat->name; $categories_struct[] = $struct; } } return $categories_struct; } public function mt_getPostCategories( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } if ( ! get_post( $post_ID ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } do_action( 'xmlrpc_call', 'mt.getPostCategories', $args, $this ); $categories = array(); $catids = wp_get_post_categories( (int) $post_ID ); $isPrimary = true; foreach ( $catids as $catid ) { $categories[] = array( 'categoryName' => get_cat_name( $catid ), 'categoryId' => (string) $catid, 'isPrimary' => $isPrimary, ); $isPrimary = false; } return $categories; } public function mt_setPostCategories( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $categories = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.setPostCategories', $args, $this ); if ( ! get_post( $post_ID ) ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } $catids = array(); foreach ( $categories as $cat ) { $catids[] = $cat['categoryId']; } wp_set_post_categories( $post_ID, $catids ); return true; } public function mt_supportedMethods() { do_action( 'xmlrpc_call', 'mt.supportedMethods', array(), $this ); return array_keys( $this->methods ); } public function mt_supportedTextFilters() { do_action( 'xmlrpc_call', 'mt.supportedTextFilters', array(), $this ); return apply_filters( 'xmlrpc_text_filters', array() ); } public function mt_getTrackbackPings( $post_ID ) { global $wpdb; do_action( 'xmlrpc_call', 'mt.getTrackbackPings', $post_ID, $this ); $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post ) { return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); } $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID ) ); if ( ! $comments ) { return array(); } $trackback_pings = array(); foreach ( $comments as $comment ) { if ( 'trackback' === $comment->comment_type ) { $content = $comment->comment_content; $title = substr( $content, 8, ( strpos( $content, '' ) - 8 ) ); $trackback_pings[] = array( 'pingTitle' => $title, 'pingURL' => $comment->comment_author_url, 'pingIP' => $comment->comment_author_IP, ); } } return $trackback_pings; } public function mt_publishPost( $args ) { $this->escape( $args ); $post_ID = (int) $args[0]; $username = $args[1]; $password = $args[2]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } do_action( 'xmlrpc_call', 'mt.publishPost', $args, $this ); $postdata = get_post( $post_ID, ARRAY_A ); if ( ! $postdata ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'publish_posts' ) || ! current_user_can( 'edit_post', $post_ID ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); } $postdata['post_status'] = 'publish'; $postdata['post_category'] = wp_get_post_categories( $post_ID ); $this->escape( $postdata ); return wp_update_post( $postdata ); } public function pingback_ping( $args ) { global $wpdb; do_action( 'xmlrpc_call', 'pingback.ping', $args, $this ); $this->escape( $args ); $pagelinkedfrom = str_replace( '&', '&', $args[0] ); $pagelinkedto = str_replace( '&', '&', $args[1] ); $pagelinkedto = str_replace( '&', '&', $pagelinkedto ); $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto ); if ( ! $pagelinkedfrom ) { return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) ); } $pos1 = strpos( $pagelinkedto, str_replace( array( 'http://www.', 'http://', 'https://www.', 'https://' ), '', get_option( 'home' ) ) ); if ( ! $pos1 ) { return $this->pingback_error( 0, __( 'Is there no link to us?' ) ); } $urltest = parse_url( $pagelinkedto ); $post_ID = url_to_postid( $pagelinkedto ); if ( $post_ID ) { } elseif ( isset( $urltest['path'] ) && preg_match( '#p/[0-9]{1,}#', $urltest['path'], $match ) ) { $blah = explode( '/', $match[0] ); $post_ID = (int) $blah[1]; } elseif ( isset( $urltest['query'] ) && preg_match( '#p=[0-9]{1,}#', $urltest['query'], $match ) ) { $blah = explode( '=', $match[0] ); $post_ID = (int) $blah[1]; } elseif ( isset( $urltest['fragment'] ) ) { if ( (int) $urltest['fragment'] ) { $post_ID = (int) $urltest['fragment']; } elseif ( preg_match( '/post-[0-9]+/', $urltest['fragment'] ) ) { $post_ID = preg_replace( '/[^0-9]+/', '', $urltest['fragment'] ); } elseif ( is_string( $urltest['fragment'] ) ) { $title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] ); $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title ); $post_ID = $wpdb->get_var( $sql ); if ( ! $post_ID ) { return $this->pingback_error( 0, '' ); } } } else { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } $post_ID = (int) $post_ID; $post = get_post( $post_ID ); if ( ! $post ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } if ( url_to_postid( $pagelinkedfrom ) == $post_ID ) { return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); } if ( ! pings_open( $post ) ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom ) ) ) { return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) ); } sleep( 1 ); $remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $pagelinkedfrom ); $http_api_args = array( 'timeout' => 10, 'redirection' => 0, 'limit_response_size' => 153600, 'user-agent' => "$user_agent; verifying pingback from $remote_ip", 'headers' => array( 'X-Pingback-Forwarded-For' => $remote_ip, ), ); $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args ); $remote_source = wp_remote_retrieve_body( $request ); $remote_source_original = $remote_source; if ( ! $remote_source ) { return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); } $remote_source = apply_filters( 'pre_remote_source', $remote_source, $pagelinkedto ); $remote_source = str_replace( ']*>/', "\n\n", $remote_source ); preg_match( '|([^<]*?)|is', $remote_source, $matchtitle ); $title = isset( $matchtitle[1] ) ? $matchtitle[1] : ''; if ( empty( $title ) ) { return $this->pingback_error( 32, __( 'A title on that page cannot be found.' ) ); } $remote_source = preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $remote_source ); $remote_source = strip_tags( $remote_source, '' ); $p = explode( "\n\n", $remote_source ); $preg_target = preg_quote( $pagelinkedto, '|' ); foreach ( $p as $para ) { if ( strpos( $para, $pagelinkedto ) !== false ) { preg_match( '|]+?' . $preg_target . '[^>]*>([^>]+?)|', $para, $context ); if ( empty( $context ) ) { continue; } $excerpt = preg_replace( '|\|', '', $para ); if ( strlen( $context[1] ) > 100 ) { $context[1] = substr( $context[1], 0, 100 ) . '…'; } $marker = '' . $context[1] . ''; $excerpt = str_replace( $context[0], $marker, $excerpt ); $excerpt = strip_tags( $excerpt, '' ); $excerpt = trim( $excerpt ); $preg_marker = preg_quote( $marker, '|' ); $excerpt = preg_replace( "|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt ); $excerpt = strip_tags( $excerpt ); break; } } if ( empty( $context ) ) { return $this->pingback_error( 17, __( 'The source URL does not contain a link to the target URL, and so cannot be used as a source.' ) ); } $pagelinkedfrom = str_replace( '&', '&', $pagelinkedfrom ); $context = '[…] ' . esc_html( $excerpt ) . ' […]'; $pagelinkedfrom = $this->escape( $pagelinkedfrom ); $comment_post_ID = (int) $post_ID; $comment_author = $title; $comment_author_email = ''; $this->escape( $comment_author ); $comment_author_url = $pagelinkedfrom; $comment_content = $context; $this->escape( $comment_content ); $comment_type = 'pingback'; $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type', 'remote_source', 'remote_source_original' ); $comment_ID = wp_new_comment( $commentdata ); if ( is_wp_error( $comment_ID ) ) { return $this->pingback_error( 0, $comment_ID->get_error_message() ); } do_action( 'pingback_post', $comment_ID ); return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto ); } public function pingback_extensions_getPingbacks( $url ) { global $wpdb; do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks', $url, $this ); $url = $this->escape( $url ); $post_ID = url_to_postid( $url ); if ( ! $post_ID ) { return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } $actual_post = get_post( $post_ID, ARRAY_A ); if ( ! $actual_post ) { return $this->pingback_error( 32, __( 'The specified target URL does not exist.' ) ); } $comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID ) ); if ( ! $comments ) { return array(); } $pingbacks = array(); foreach ( $comments as $comment ) { if ( 'pingback' === $comment->comment_type ) { $pingbacks[] = $comment->comment_author_url; } } return $pingbacks; } protected function pingback_error( $code, $message ) { return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) ); } } false, 'allowed' => null, 'blog_id' => 0, ); $args = wp_parse_args( $args, $defaults ); $theme_directories = search_theme_directories(); if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) { $current_theme = get_stylesheet(); if ( isset( $theme_directories[ $current_theme ] ) ) { $root_of_current_theme = get_raw_theme_root( $current_theme ); if ( ! in_array( $root_of_current_theme, $wp_theme_directories, true ) ) { $root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme; } $theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme; } } if ( empty( $theme_directories ) ) { return array(); } if ( is_multisite() && null !== $args['allowed'] ) { $allowed = $args['allowed']; if ( 'network' === $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() ); } elseif ( 'site' === $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) ); } elseif ( $allowed ) { $theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) ); } else { $theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) ); } } $themes = array(); static $_themes = array(); foreach ( $theme_directories as $theme => $theme_root ) { if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) { $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ]; } else { $themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] ); $_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ]; } } if ( null !== $args['errors'] ) { foreach ( $themes as $theme => $wp_theme ) { if ( $wp_theme->errors() != $args['errors'] ) { unset( $themes[ $theme ] ); } } } return $themes; } function wp_get_theme( $stylesheet = '', $theme_root = '' ) { global $wp_theme_directories; if ( empty( $stylesheet ) ) { $stylesheet = get_stylesheet(); } if ( empty( $theme_root ) ) { $theme_root = get_raw_theme_root( $stylesheet ); if ( false === $theme_root ) { $theme_root = WP_CONTENT_DIR . '/themes'; } elseif ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } } return new WP_Theme( $stylesheet, $theme_root ); } function wp_clean_themes_cache( $clear_update_cache = true ) { if ( $clear_update_cache ) { delete_site_transient( 'update_themes' ); } search_theme_directories( true ); foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme ) { $theme->cache_delete(); } } function is_child_theme() { return ( TEMPLATEPATH !== STYLESHEETPATH ); } function get_stylesheet() { return apply_filters( 'stylesheet', get_option( 'stylesheet' ) ); } function get_stylesheet_directory() { $stylesheet = get_stylesheet(); $theme_root = get_theme_root( $stylesheet ); $stylesheet_dir = "$theme_root/$stylesheet"; return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root ); } function get_stylesheet_directory_uri() { $stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) ); $theme_root_uri = get_theme_root_uri( $stylesheet ); $stylesheet_dir_uri = "$theme_root_uri/$stylesheet"; return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri ); } function get_stylesheet_uri() { $stylesheet_dir_uri = get_stylesheet_directory_uri(); $stylesheet_uri = $stylesheet_dir_uri . '/style.css'; return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri ); } function get_locale_stylesheet_uri() { global $wp_locale; $stylesheet_dir_uri = get_stylesheet_directory_uri(); $dir = get_stylesheet_directory(); $locale = get_locale(); if ( file_exists( "$dir/$locale.css" ) ) { $stylesheet_uri = "$stylesheet_dir_uri/$locale.css"; } elseif ( ! empty( $wp_locale->text_direction ) && file_exists( "$dir/{$wp_locale->text_direction}.css" ) ) { $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css"; } else { $stylesheet_uri = ''; } return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri ); } function get_template() { return apply_filters( 'template', get_option( 'template' ) ); } function get_template_directory() { $template = get_template(); $theme_root = get_theme_root( $template ); $template_dir = "$theme_root/$template"; return apply_filters( 'template_directory', $template_dir, $template, $theme_root ); } function get_template_directory_uri() { $template = str_replace( '%2F', '/', rawurlencode( get_template() ) ); $theme_root_uri = get_theme_root_uri( $template ); $template_dir_uri = "$theme_root_uri/$template"; return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri ); } function get_theme_roots() { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_roots = get_site_transient( 'theme_roots' ); if ( false === $theme_roots ) { search_theme_directories( true ); $theme_roots = get_site_transient( 'theme_roots' ); } return $theme_roots; } function register_theme_directory( $directory ) { global $wp_theme_directories; if ( ! file_exists( $directory ) ) { $directory = WP_CONTENT_DIR . '/' . $directory; if ( ! file_exists( $directory ) ) { return false; } } if ( ! is_array( $wp_theme_directories ) ) { $wp_theme_directories = array(); } $untrailed = untrailingslashit( $directory ); if ( ! empty( $untrailed ) && ! in_array( $untrailed, $wp_theme_directories, true ) ) { $wp_theme_directories[] = $untrailed; } return true; } function search_theme_directories( $force = false ) { global $wp_theme_directories; static $found_themes = null; if ( empty( $wp_theme_directories ) ) { return false; } if ( ! $force && isset( $found_themes ) ) { return $found_themes; } $found_themes = array(); $wp_theme_directories = (array) $wp_theme_directories; $relative_theme_roots = array(); foreach ( $wp_theme_directories as $theme_root ) { if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) { $relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root; } else { $relative_theme_roots[ $theme_root ] = $theme_root; } } $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ); if ( $cache_expiration ) { $cached_roots = get_site_transient( 'theme_roots' ); if ( is_array( $cached_roots ) ) { foreach ( $cached_roots as $theme_dir => $theme_root ) { if ( ! isset( $relative_theme_roots[ $theme_root ] ) ) { continue; } $found_themes[ $theme_dir ] = array( 'theme_file' => $theme_dir . '/style.css', 'theme_root' => $relative_theme_roots[ $theme_root ], ); } return $found_themes; } if ( ! is_int( $cache_expiration ) ) { $cache_expiration = 30 * MINUTE_IN_SECONDS; } } else { $cache_expiration = 30 * MINUTE_IN_SECONDS; } foreach ( $wp_theme_directories as $theme_root ) { $dirs = @ scandir( $theme_root ); if ( ! $dirs ) { trigger_error( "$theme_root is not readable", E_USER_NOTICE ); continue; } foreach ( $dirs as $dir ) { if ( ! is_dir( $theme_root . '/' . $dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) { $found_themes[ $dir ] = array( 'theme_file' => $dir . '/style.css', 'theme_root' => $theme_root, ); } else { $found_theme = false; $sub_dirs = @ scandir( $theme_root . '/' . $dir ); if ( ! $sub_dirs ) { trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE ); continue; } foreach ( $sub_dirs as $sub_dir ) { if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || '.' === $dir[0] || 'CVS' === $dir ) { continue; } if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) ) { continue; } $found_themes[ $dir . '/' . $sub_dir ] = array( 'theme_file' => $dir . '/' . $sub_dir . '/style.css', 'theme_root' => $theme_root, ); $found_theme = true; } if ( ! $found_theme ) { $found_themes[ $dir ] = array( 'theme_file' => $dir . '/style.css', 'theme_root' => $theme_root, ); } } } } asort( $found_themes ); $theme_roots = array(); $relative_theme_roots = array_flip( $relative_theme_roots ); foreach ( $found_themes as $theme_dir => $theme_data ) { $theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; } if ( get_site_transient( 'theme_roots' ) != $theme_roots ) { set_site_transient( 'theme_roots', $theme_roots, $cache_expiration ); } return $found_themes; } function get_theme_root( $stylesheet_or_template = '' ) { global $wp_theme_directories; $theme_root = ''; if ( $stylesheet_or_template ) { $theme_root = get_raw_theme_root( $stylesheet_or_template ); if ( $theme_root ) { if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } } } if ( ! $theme_root ) { $theme_root = WP_CONTENT_DIR . '/themes'; } return apply_filters( 'theme_root', $theme_root ); } function get_theme_root_uri( $stylesheet_or_template = '', $theme_root = '' ) { global $wp_theme_directories; if ( $stylesheet_or_template && ! $theme_root ) { $theme_root = get_raw_theme_root( $stylesheet_or_template ); } if ( $stylesheet_or_template && $theme_root ) { if ( in_array( $theme_root, (array) $wp_theme_directories, true ) ) { if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) { $theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) ); } elseif ( 0 === strpos( $theme_root, ABSPATH ) ) { $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) ); } elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) { $theme_root_uri = plugins_url( basename( $theme_root ), $theme_root ); } else { $theme_root_uri = $theme_root; } } else { $theme_root_uri = content_url( $theme_root ); } } else { $theme_root_uri = content_url( 'themes' ); } return apply_filters( 'theme_root_uri', $theme_root_uri, get_option( 'siteurl' ), $stylesheet_or_template ); } function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_root = false; if ( ! $skip_cache ) { if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) { $theme_root = get_option( 'stylesheet_root' ); } elseif ( get_option( 'template' ) == $stylesheet_or_template ) { $theme_root = get_option( 'template_root' ); } } if ( empty( $theme_root ) ) { $theme_roots = get_theme_roots(); if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) { $theme_root = $theme_roots[ $stylesheet_or_template ]; } } return $theme_root; } function locale_stylesheet() { $stylesheet = get_locale_stylesheet_uri(); if ( empty( $stylesheet ) ) { return; } $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; printf( '', $stylesheet, $type_attr ); } function switch_theme( $stylesheet ) { global $wp_theme_directories, $wp_customize, $sidebars_widgets; $requirements = validate_theme_requirements( $stylesheet ); if ( is_wp_error( $requirements ) ) { wp_die( $requirements ); } $_sidebars_widgets = null; if ( 'wp_ajax_customize_save' === current_action() ) { $old_sidebars_widgets_data_setting = $wp_customize->get_setting( 'old_sidebars_widgets_data' ); if ( $old_sidebars_widgets_data_setting ) { $_sidebars_widgets = $wp_customize->post_value( $old_sidebars_widgets_data_setting ); } } elseif ( is_array( $sidebars_widgets ) ) { $_sidebars_widgets = $sidebars_widgets; } if ( is_array( $_sidebars_widgets ) ) { set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets, ) ); } $nav_menu_locations = get_theme_mod( 'nav_menu_locations' ); update_option( 'theme_switch_menu_locations', $nav_menu_locations ); if ( func_num_args() > 1 ) { $stylesheet = func_get_arg( 1 ); } $old_theme = wp_get_theme(); $new_theme = wp_get_theme( $stylesheet ); $template = $new_theme->get_template(); if ( wp_is_recovery_mode() ) { $paused_themes = wp_paused_themes(); $paused_themes->delete( $old_theme->get_stylesheet() ); $paused_themes->delete( $old_theme->get_template() ); } update_option( 'template', $template ); update_option( 'stylesheet', $stylesheet ); if ( count( $wp_theme_directories ) > 1 ) { update_option( 'template_root', get_raw_theme_root( $template, true ) ); update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) ); } else { delete_option( 'template_root' ); delete_option( 'stylesheet_root' ); } $new_name = $new_theme->get( 'Name' ); update_option( 'current_theme', $new_name ); 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 { if ( 'wp_ajax_customize_save' === current_action() ) { remove_theme_mod( 'sidebars_widgets' ); } } update_option( 'theme_switched', $old_theme->get_stylesheet() ); do_action( 'switch_theme', $new_name, $new_theme, $old_theme ); } function validate_current_theme() { if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) { return true; } if ( ! file_exists( get_template_directory() . '/templates/index.html' ) && ! file_exists( get_template_directory() . '/block-templates/index.html' ) && ! file_exists( get_template_directory() . '/index.php' ) ) { } elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) { } elseif ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { } else { return true; } $default = wp_get_theme( WP_DEFAULT_THEME ); if ( $default->exists() ) { switch_theme( WP_DEFAULT_THEME ); return false; } $default = WP_Theme::get_core_default_theme(); if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) { return true; } switch_theme( $default->get_stylesheet() ); return false; } function validate_theme_requirements( $stylesheet ) { $theme = wp_get_theme( $stylesheet ); $requirements = array( 'requires' => ! empty( $theme->get( 'RequiresWP' ) ) ? $theme->get( 'RequiresWP' ) : '', 'requires_php' => ! empty( $theme->get( 'RequiresPHP' ) ) ? $theme->get( 'RequiresPHP' ) : '', ); $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); if ( ! $compatible_wp && ! $compatible_php ) { return new WP_Error( 'theme_wp_php_incompatible', sprintf( _x( 'Error: Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } elseif ( ! $compatible_php ) { return new WP_Error( 'theme_php_incompatible', sprintf( _x( 'Error: Current PHP version does not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } elseif ( ! $compatible_wp ) { return new WP_Error( 'theme_wp_incompatible', sprintf( _x( 'Error: Current WordPress version does not meet minimum requirements for %s.', 'theme' ), $theme->display( 'Name' ) ) ); } return true; } function get_theme_mods() { $theme_slug = get_option( 'stylesheet' ); $mods = get_option( "theme_mods_$theme_slug" ); if ( false === $mods ) { $theme_name = get_option( 'current_theme' ); if ( false === $theme_name ) { $theme_name = wp_get_theme()->get( 'Name' ); } $mods = get_option( "mods_$theme_name" ); if ( is_admin() && false !== $mods ) { update_option( "theme_mods_$theme_slug", $mods ); delete_option( "mods_$theme_name" ); } } if ( ! is_array( $mods ) ) { $mods = array(); } return $mods; } function get_theme_mod( $name, $default = false ) { $mods = get_theme_mods(); if ( isset( $mods[ $name ] ) ) { return apply_filters( "theme_mod_{$name}", $mods[ $name ] ); } if ( is_string( $default ) ) { if ( preg_match( '#(?get( 'Name' ); } delete_option( 'mods_' . $theme_name ); } function get_header_textcolor() { return get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) ); } function header_textcolor() { echo get_header_textcolor(); } function display_header_text() { if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { return false; } $text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) ); return 'blank' !== $text_color; } function has_header_image() { return (bool) get_header_image(); } function get_header_image() { $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); if ( 'remove-header' === $url ) { return false; } if ( is_random_header_image() ) { $url = get_random_header_image(); } return esc_url_raw( set_url_scheme( $url ) ); } function get_header_image_tag( $attr = array() ) { $header = get_custom_header(); $header->url = get_header_image(); if ( ! $header->url ) { return ''; } $width = absint( $header->width ); $height = absint( $header->height ); $alt = ''; if ( ! empty( $header->attachment_id ) ) { $image_alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true ); if ( is_string( $image_alt ) ) { $alt = $image_alt; } } $attr = wp_parse_args( $attr, array( 'src' => $header->url, 'width' => $width, 'height' => $height, 'alt' => $alt, ) ); if ( empty( $attr['srcset'] ) && ! empty( $header->attachment_id ) ) { $image_meta = get_post_meta( $header->attachment_id, '_wp_attachment_metadata', true ); $size_array = array( $width, $height ); if ( is_array( $image_meta ) ) { $srcset = wp_calculate_image_srcset( $size_array, $header->url, $image_meta, $header->attachment_id ); if ( ! empty( $attr['sizes'] ) ) { $sizes = $attr['sizes']; } else { $sizes = wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id ); } if ( $srcset && $sizes ) { $attr['srcset'] = $srcset; $attr['sizes'] = $sizes; } } } $attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header ); $attr = array_map( 'esc_attr', $attr ); $html = ' $value ) { $html .= ' ' . $name . '="' . $value . '"'; } $html .= ' />'; return apply_filters( 'get_header_image_tag', $html, $header, $attr ); } function the_header_image_tag( $attr = array() ) { echo get_header_image_tag( $attr ); } function _get_random_header_data() { global $_wp_default_headers; static $_wp_random_header = null; if ( empty( $_wp_random_header ) ) { $header_image_mod = get_theme_mod( 'header_image', '' ); $headers = array(); if ( 'random-uploaded-image' === $header_image_mod ) { $headers = get_uploaded_header_images(); } elseif ( ! empty( $_wp_default_headers ) ) { if ( 'random-default-image' === $header_image_mod ) { $headers = $_wp_default_headers; } else { if ( current_theme_supports( 'custom-header', 'random-default' ) ) { $headers = $_wp_default_headers; } } } if ( empty( $headers ) ) { return new stdClass; } $_wp_random_header = (object) $headers[ array_rand( $headers ) ]; $_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() ); $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() ); } return $_wp_random_header; } function get_random_header_image() { $random_image = _get_random_header_data(); if ( empty( $random_image->url ) ) { return ''; } return $random_image->url; } function is_random_header_image( $type = 'any' ) { $header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); if ( 'any' === $type ) { if ( 'random-default-image' === $header_image_mod || 'random-uploaded-image' === $header_image_mod || ( '' !== get_random_header_image() && empty( $header_image_mod ) ) ) { return true; } } else { if ( "random-$type-image" === $header_image_mod ) { return true; } elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) { return true; } } return false; } function header_image() { $image = get_header_image(); if ( $image ) { echo esc_url( $image ); } } function get_uploaded_header_images() { $header_images = array(); $headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option( 'stylesheet' ), 'orderby' => 'none', 'nopaging' => true, ) ); if ( empty( $headers ) ) { return array(); } foreach ( (array) $headers as $header ) { $url = esc_url_raw( wp_get_attachment_url( $header->ID ) ); $header_data = wp_get_attachment_metadata( $header->ID ); $header_index = $header->ID; $header_images[ $header_index ] = array(); $header_images[ $header_index ]['attachment_id'] = $header->ID; $header_images[ $header_index ]['url'] = $url; $header_images[ $header_index ]['thumbnail_url'] = $url; $header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true ); if ( isset( $header_data['attachment_parent'] ) ) { $header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent']; } else { $header_images[ $header_index ]['attachment_parent'] = ''; } if ( isset( $header_data['width'] ) ) { $header_images[ $header_index ]['width'] = $header_data['width']; } if ( isset( $header_data['height'] ) ) { $header_images[ $header_index ]['height'] = $header_data['height']; } } return $header_images; } function get_custom_header() { global $_wp_default_headers; if ( is_random_header_image() ) { $data = _get_random_header_data(); } else { $data = get_theme_mod( 'header_image_data' ); if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) { $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() ); $data = array(); $data['url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args ); $data['thumbnail_url'] = $data['url']; if ( ! empty( $_wp_default_headers ) ) { foreach ( (array) $_wp_default_headers as $default_header ) { $url = vsprintf( $default_header['url'], $directory_args ); if ( $data['url'] == $url ) { $data = $default_header; $data['url'] = $url; $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); break; } } } } } $default = array( 'url' => '', 'thumbnail_url' => '', 'width' => get_theme_support( 'custom-header', 'width' ), 'height' => get_theme_support( 'custom-header', 'height' ), 'video' => get_theme_support( 'custom-header', 'video' ), ); return (object) wp_parse_args( $data, $default ); } function register_default_headers( $headers ) { global $_wp_default_headers; $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers ); } function unregister_default_headers( $header ) { global $_wp_default_headers; if ( is_array( $header ) ) { array_map( 'unregister_default_headers', $header ); } elseif ( isset( $_wp_default_headers[ $header ] ) ) { unset( $_wp_default_headers[ $header ] ); return true; } else { return false; } } function has_header_video() { return (bool) get_header_video_url(); } function get_header_video_url() { $id = absint( get_theme_mod( 'header_video' ) ); if ( $id ) { $url = wp_get_attachment_url( $id ); } else { $url = get_theme_mod( 'external_header_video' ); } $url = apply_filters( 'get_header_video_url', $url ); if ( ! $id && ! $url ) { return false; } return esc_url_raw( set_url_scheme( $url ) ); } function the_header_video_url() { $video = get_header_video_url(); if ( $video ) { echo esc_url( $video ); } } function get_header_video_settings() { $header = get_custom_header(); $video_url = get_header_video_url(); $video_type = wp_check_filetype( $video_url, wp_get_mime_types() ); $settings = array( 'mimeType' => '', 'posterUrl' => get_header_image(), 'videoUrl' => $video_url, 'width' => absint( $header->width ), 'height' => absint( $header->height ), 'minWidth' => 900, 'minHeight' => 500, 'l10n' => array( 'pause' => __( 'Pause' ), 'play' => __( 'Play' ), 'pauseSpeak' => __( 'Video is paused.' ), 'playSpeak' => __( 'Video is playing.' ), ), ); if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) { $settings['mimeType'] = 'video/x-youtube'; } elseif ( ! empty( $video_type['type'] ) ) { $settings['mimeType'] = $video_type['type']; } return apply_filters( 'header_video_settings', $settings ); } function has_custom_header() { if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) { return true; } return false; } function is_header_video_active() { if ( ! get_theme_support( 'custom-header', 'video' ) ) { return false; } $video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' ); if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) { $show_video = true; } else { $show_video = call_user_func( $video_active_cb ); } return apply_filters( 'is_header_video_active', $show_video ); } function get_custom_header_markup() { if ( ! has_custom_header() && ! is_customize_preview() ) { return ''; } return sprintf( '
                %s
                ', get_header_image_tag() ); } function the_custom_header_markup() { $custom_header = get_custom_header_markup(); if ( empty( $custom_header ) ) { return; } echo $custom_header; if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) { wp_enqueue_script( 'wp-custom-header' ); wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() ); } } function get_background_image() { return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) ); } function background_image() { echo get_background_image(); } function get_background_color() { return get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) ); } function background_color() { echo get_background_color(); } function _custom_background_cb() { $background = set_url_scheme( get_background_image() ); $color = get_background_color(); if ( get_theme_support( 'custom-background', 'default-color' ) === $color ) { $color = false; } $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; if ( ! $background && ! $color ) { if ( is_customize_preview() ) { printf( '', $type_attr ); } return; } $style = $color ? "background-color: #$color;" : ''; if ( $background ) { $image = ' background-image: url("' . esc_url_raw( $background ) . '");'; $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); $position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ); if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) { $position_x = 'left'; } if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) { $position_y = 'top'; } $position = " background-position: $position_x $position_y;"; $size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) ); if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) { $size = 'auto'; } $size = " background-size: $size;"; $repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ); if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) { $repeat = 'repeat'; } $repeat = " background-repeat: $repeat;"; $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ); if ( 'fixed' !== $attachment ) { $attachment = 'scroll'; } $attachment = " background-attachment: $attachment;"; $style .= $image . $position . $size . $repeat . $attachment; } ?> - id="custom-background-css"> -body.custom-background { } - - - id="wp-custom-css"> - - - 'custom_css', 'post_status' => get_post_stati(), 'name' => sanitize_title( $stylesheet ), 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ); $post = null; if ( get_stylesheet() === $stylesheet ) { $post_id = get_theme_mod( 'custom_css_post_id' ); if ( $post_id > 0 && get_post( $post_id ) ) { $post = get_post( $post_id ); } if ( ! $post && -1 !== $post_id ) { $query = new WP_Query( $custom_css_query_vars ); $post = $query->post; set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 ); } } else { $query = new WP_Query( $custom_css_query_vars ); $post = $query->post; } return $post; } function wp_get_custom_css( $stylesheet = '' ) { $css = ''; if ( empty( $stylesheet ) ) { $stylesheet = get_stylesheet(); } $post = wp_get_custom_css_post( $stylesheet ); if ( $post ) { $css = $post->post_content; } $css = apply_filters( 'wp_get_custom_css', $css, $stylesheet ); return $css; } function wp_update_custom_css_post( $css, $args = array() ) { $args = wp_parse_args( $args, array( 'preprocessed' => '', 'stylesheet' => get_stylesheet(), ) ); $data = array( 'css' => $css, 'preprocessed' => $args['preprocessed'], ); $data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) ); $post_data = array( 'post_title' => $args['stylesheet'], 'post_name' => sanitize_title( $args['stylesheet'] ), 'post_type' => 'custom_css', 'post_status' => 'publish', 'post_content' => $data['css'], 'post_content_filtered' => $data['preprocessed'], ); $post = wp_get_custom_css_post( $args['stylesheet'] ); if ( $post ) { $post_data['ID'] = $post->ID; $r = wp_update_post( wp_slash( $post_data ), true ); } else { $r = wp_insert_post( wp_slash( $post_data ), true ); if ( ! is_wp_error( $r ) ) { if ( get_stylesheet() === $args['stylesheet'] ) { set_theme_mod( 'custom_css_post_id', $r ); } if ( 0 === count( wp_get_post_revisions( $r ) ) ) { wp_save_post_revision( $r ); } } } if ( is_wp_error( $r ) ) { return $r; } return get_post( $r ); } function add_editor_style( $stylesheet = 'editor-style.css' ) { global $editor_styles; add_theme_support( 'editor-style' ); $editor_styles = (array) $editor_styles; $stylesheet = (array) $stylesheet; if ( is_rtl() ) { $rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] ); $stylesheet[] = $rtl_stylesheet; } $editor_styles = array_merge( $editor_styles, $stylesheet ); } function remove_editor_styles() { if ( ! current_theme_supports( 'editor-style' ) ) { return false; } _remove_theme_support( 'editor-style' ); if ( is_admin() ) { $GLOBALS['editor_styles'] = array(); } return true; } function get_editor_stylesheets() { $stylesheets = array(); if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) { $editor_styles = $GLOBALS['editor_styles']; $editor_styles = array_unique( array_filter( $editor_styles ) ); $style_uri = get_stylesheet_directory_uri(); $style_dir = get_stylesheet_directory(); foreach ( $editor_styles as $key => $file ) { if ( preg_match( '~^(https?:)?//~', $file ) ) { $stylesheets[] = esc_url_raw( $file ); unset( $editor_styles[ $key ] ); } } if ( is_child_theme() ) { $template_uri = get_template_directory_uri(); $template_dir = get_template_directory(); foreach ( $editor_styles as $key => $file ) { if ( $file && file_exists( "$template_dir/$file" ) ) { $stylesheets[] = "$template_uri/$file"; } } } foreach ( $editor_styles as $file ) { if ( $file && file_exists( "$style_dir/$file" ) ) { $stylesheets[] = "$style_uri/$file"; } } } return apply_filters( 'editor_stylesheets', $stylesheets ); } function get_theme_starter_content() { $theme_support = get_theme_support( 'starter-content' ); if ( is_array( $theme_support ) && ! empty( $theme_support[0] ) && is_array( $theme_support[0] ) ) { $config = $theme_support[0]; } else { $config = array(); } $core_content = array( 'widgets' => array( 'text_business_info' => array( 'text', array( 'title' => _x( 'Find Us', 'Theme starter content' ), 'text' => implode( '', array( '' . _x( 'Address', 'Theme starter content' ) . "\n", _x( '123 Main Street', 'Theme starter content' ) . "\n", _x( 'New York, NY 10001', 'Theme starter content' ) . "\n\n", '' . _x( 'Hours', 'Theme starter content' ) . "\n", _x( 'Monday–Friday: 9:00AM–5:00PM', 'Theme starter content' ) . "\n", _x( 'Saturday & Sunday: 11:00AM–3:00PM', 'Theme starter content' ), ) ), 'filter' => true, 'visual' => true, ), ), 'text_about' => array( 'text', array( 'title' => _x( 'About This Site', 'Theme starter content' ), 'text' => _x( 'This may be a good place to introduce yourself and your site or include some credits.', 'Theme starter content' ), 'filter' => true, 'visual' => true, ), ), 'archives' => array( 'archives', array( 'title' => _x( 'Archives', 'Theme starter content' ), ), ), 'calendar' => array( 'calendar', array( 'title' => _x( 'Calendar', 'Theme starter content' ), ), ), 'categories' => array( 'categories', array( 'title' => _x( 'Categories', 'Theme starter content' ), ), ), 'meta' => array( 'meta', array( 'title' => _x( 'Meta', 'Theme starter content' ), ), ), 'recent-comments' => array( 'recent-comments', array( 'title' => _x( 'Recent Comments', 'Theme starter content' ), ), ), 'recent-posts' => array( 'recent-posts', array( 'title' => _x( 'Recent Posts', 'Theme starter content' ), ), ), 'search' => array( 'search', array( 'title' => _x( 'Search', 'Theme starter content' ), ), ), ), 'nav_menus' => array( 'link_home' => array( 'type' => 'custom', 'title' => _x( 'Home', 'Theme starter content' ), 'url' => home_url( '/' ), ), 'page_home' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{home}}', ), 'page_about' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{about}}', ), 'page_blog' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{blog}}', ), 'page_news' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{news}}', ), 'page_contact' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{contact}}', ), 'link_email' => array( 'title' => _x( 'Email', 'Theme starter content' ), 'url' => 'mailto:wordpress@example.com', ), 'link_facebook' => array( 'title' => _x( 'Facebook', 'Theme starter content' ), 'url' => 'https://www.facebook.com/wordpress', ), 'link_foursquare' => array( 'title' => _x( 'Foursquare', 'Theme starter content' ), 'url' => 'https://foursquare.com/', ), 'link_github' => array( 'title' => _x( 'GitHub', 'Theme starter content' ), 'url' => 'https://github.com/wordpress/', ), 'link_instagram' => array( 'title' => _x( 'Instagram', 'Theme starter content' ), 'url' => 'https://www.instagram.com/explore/tags/wordcamp/', ), 'link_linkedin' => array( 'title' => _x( 'LinkedIn', 'Theme starter content' ), 'url' => 'https://www.linkedin.com/company/1089783', ), 'link_pinterest' => array( 'title' => _x( 'Pinterest', 'Theme starter content' ), 'url' => 'https://www.pinterest.com/', ), 'link_twitter' => array( 'title' => _x( 'Twitter', 'Theme starter content' ), 'url' => 'https://twitter.com/wordpress', ), 'link_yelp' => array( 'title' => _x( 'Yelp', 'Theme starter content' ), 'url' => 'https://www.yelp.com', ), 'link_youtube' => array( 'title' => _x( 'YouTube', 'Theme starter content' ), 'url' => 'https://www.youtube.com/channel/UCdof4Ju7amm1chz1gi1T2ZA', ), ), 'posts' => array( 'home' => array( 'post_type' => 'page', 'post_title' => _x( 'Home', 'Theme starter content' ), 'post_content' => sprintf( "\n

                %s

                \n", _x( 'Welcome to your site! This is your homepage, which is what most visitors will see when they come to your site for the first time.', 'Theme starter content' ) ), ), 'about' => array( 'post_type' => 'page', 'post_title' => _x( 'About', 'Theme starter content' ), 'post_content' => sprintf( "\n

                %s

                \n", _x( 'You might be an artist who would like to introduce yourself and your work here or maybe you’re a business with a mission to describe.', 'Theme starter content' ) ), ), 'contact' => array( 'post_type' => 'page', 'post_title' => _x( 'Contact', 'Theme starter content' ), 'post_content' => sprintf( "\n

                %s

                \n", _x( 'This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'Theme starter content' ) ), ), 'blog' => array( 'post_type' => 'page', 'post_title' => _x( 'Blog', 'Theme starter content' ), ), 'news' => array( 'post_type' => 'page', 'post_title' => _x( 'News', 'Theme starter content' ), ), 'homepage-section' => array( 'post_type' => 'page', 'post_title' => _x( 'A homepage section', 'Theme starter content' ), 'post_content' => sprintf( "\n

                %s

                \n", _x( 'This is an example of a homepage section. Homepage sections can be any page other than the homepage itself, including the page that shows your latest blog posts.', 'Theme starter content' ) ), ), ), ); $content = array(); foreach ( $config as $type => $args ) { switch ( $type ) { case 'options': case 'theme_mods': $content[ $type ] = $config[ $type ]; break; case 'widgets': foreach ( $config[ $type ] as $sidebar_id => $widgets ) { foreach ( $widgets as $id => $widget ) { if ( is_array( $widget ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $widget = array( $core_content[ $type ][ $id ][0], array_merge( $core_content[ $type ][ $id ][1], $widget ), ); } $content[ $type ][ $sidebar_id ][] = $widget; } elseif ( is_string( $widget ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $widget ] ) ) { $content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ]; } } } break; case 'nav_menus': foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) { if ( empty( $nav_menu['name'] ) ) { $nav_menu['name'] = $nav_menu_location; } $content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name']; foreach ( $nav_menu['items'] as $id => $nav_menu_item ) { if ( is_array( $nav_menu_item ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $nav_menu_item = array_merge( $core_content[ $type ][ $id ], $nav_menu_item ); } $content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item; } elseif ( is_string( $nav_menu_item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $nav_menu_item ] ) ) { $content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ]; } } } break; case 'attachments': foreach ( $config[ $type ] as $id => $item ) { if ( ! empty( $item['file'] ) ) { $content[ $type ][ $id ] = $item; } } break; case 'posts': foreach ( $config[ $type ] as $id => $item ) { if ( is_array( $item ) ) { if ( ! empty( $core_content[ $type ][ $id ] ) ) { $item = array_merge( $core_content[ $type ][ $id ], $item ); } $content[ $type ][ $id ] = wp_array_slice_assoc( $item, array( 'post_type', 'post_title', 'post_excerpt', 'post_name', 'post_content', 'menu_order', 'comment_status', 'thumbnail', 'template', ) ); } elseif ( is_string( $item ) && ! empty( $core_content[ $type ][ $item ] ) ) { $content[ $type ][ $item ] = $core_content[ $type ][ $item ]; } } break; } } return apply_filters( 'get_theme_starter_content', $content, $config ); } function add_theme_support( $feature, ...$args ) { global $_wp_theme_features; if ( ! $args ) { $args = true; } switch ( $feature ) { case 'post-thumbnails': if ( true === get_theme_support( 'post-thumbnails' ) ) { return; } if ( isset( $args[0] ) && is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { $args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) ); } break; case 'post-formats': if ( isset( $args[0] ) && is_array( $args[0] ) ) { $post_formats = get_post_format_slugs(); unset( $post_formats['standard'] ); $args[0] = array_intersect( $args[0], array_keys( $post_formats ) ); } else { _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of post formats.' ), '5.6.0' ); return false; } break; case 'html5': if ( empty( $args[0] ) || ! is_array( $args[0] ) ) { _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' ); if ( ! empty( $args[0] ) && ! is_array( $args[0] ) ) { return false; } $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); } if ( isset( $_wp_theme_features['html5'] ) ) { $args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] ); } break; case 'custom-logo': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'width' => null, 'height' => null, 'flex-width' => false, 'flex-height' => false, 'header-text' => '', 'unlink-homepage-logo' => false, ); $args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults ); if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) { $args[0]['flex-width'] = true; $args[0]['flex-height'] = true; } break; case 'custom-header-uploads': return add_theme_support( 'custom-header', array( 'uploads' => true ) ); case 'custom-header': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', 'video' => false, 'video-active-callback' => 'is_front_page', ); $jit = isset( $args[0]['__jit'] ); unset( $args[0]['__jit'] ); if ( isset( $_wp_theme_features['custom-header'] ) ) { $args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] ); } if ( $jit ) { $args[0] = wp_parse_args( $args[0], $defaults ); } if ( defined( 'NO_HEADER_TEXT' ) ) { $args[0]['header-text'] = ! NO_HEADER_TEXT; } elseif ( isset( $args[0]['header-text'] ) ) { define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) ); } if ( defined( 'HEADER_IMAGE_WIDTH' ) ) { $args[0]['width'] = (int) HEADER_IMAGE_WIDTH; } elseif ( isset( $args[0]['width'] ) ) { define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] ); } if ( defined( 'HEADER_IMAGE_HEIGHT' ) ) { $args[0]['height'] = (int) HEADER_IMAGE_HEIGHT; } elseif ( isset( $args[0]['height'] ) ) { define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] ); } if ( defined( 'HEADER_TEXTCOLOR' ) ) { $args[0]['default-text-color'] = HEADER_TEXTCOLOR; } elseif ( isset( $args[0]['default-text-color'] ) ) { define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] ); } if ( defined( 'HEADER_IMAGE' ) ) { $args[0]['default-image'] = HEADER_IMAGE; } elseif ( isset( $args[0]['default-image'] ) ) { define( 'HEADER_IMAGE', $args[0]['default-image'] ); } if ( $jit && ! empty( $args[0]['default-image'] ) ) { $args[0]['random-default'] = false; } if ( $jit ) { if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) ) { $args[0]['flex-width'] = true; } if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) ) { $args[0]['flex-height'] = true; } } break; case 'custom-background': if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( 'default-image' => '', 'default-preset' => 'default', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-repeat' => 'repeat', 'default-attachment' => 'scroll', 'default-color' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); $jit = isset( $args[0]['__jit'] ); unset( $args[0]['__jit'] ); if ( isset( $_wp_theme_features['custom-background'] ) ) { $args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] ); } if ( $jit ) { $args[0] = wp_parse_args( $args[0], $defaults ); } if ( defined( 'BACKGROUND_COLOR' ) ) { $args[0]['default-color'] = BACKGROUND_COLOR; } elseif ( isset( $args[0]['default-color'] ) || $jit ) { define( 'BACKGROUND_COLOR', $args[0]['default-color'] ); } if ( defined( 'BACKGROUND_IMAGE' ) ) { $args[0]['default-image'] = BACKGROUND_IMAGE; } elseif ( isset( $args[0]['default-image'] ) || $jit ) { define( 'BACKGROUND_IMAGE', $args[0]['default-image'] ); } break; case 'title-tag': if ( did_action( 'wp_loaded' ) ) { _doing_it_wrong( "add_theme_support( 'title-tag' )", sprintf( __( 'Theme support for %1$s should be registered before the %2$s hook.' ), 'title-tag', 'wp_loaded' ), '4.1.0' ); return false; } } $_wp_theme_features[ $feature ] = $args; } function _custom_header_background_just_in_time() { global $custom_image_header, $custom_background; if ( current_theme_supports( 'custom-header' ) ) { add_theme_support( 'custom-header', array( '__jit' => true ) ); $args = get_theme_support( 'custom-header' ); if ( $args[0]['wp-head-callback'] ) { add_action( 'wp_head', $args[0]['wp-head-callback'] ); } if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php'; $custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } if ( current_theme_supports( 'custom-background' ) ) { add_theme_support( 'custom-background', array( '__jit' => true ) ); $args = get_theme_support( 'custom-background' ); add_action( 'wp_head', $args[0]['wp-head-callback'] ); if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-background.php'; $custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } } function _custom_logo_header_styles() { if ( ! current_theme_supports( 'custom-header', 'header-text' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) { $classes = (array) get_theme_support( 'custom-logo', 'header-text' ); $classes = array_map( 'sanitize_html_class', $classes ); $classes = '.' . implode( ', .', $classes ); $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; ?> - - - false ) ); return; } if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } switch ( $feature ) { case 'custom-header': if ( ! did_action( 'wp_loaded' ) ) { break; } $support = get_theme_support( 'custom-header' ); if ( isset( $support[0]['wp-head-callback'] ) ) { remove_action( 'wp_head', $support[0]['wp-head-callback'] ); } if ( isset( $GLOBALS['custom_image_header'] ) ) { remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); unset( $GLOBALS['custom_image_header'] ); } break; case 'custom-background': if ( ! did_action( 'wp_loaded' ) ) { break; } $support = get_theme_support( 'custom-background' ); if ( isset( $support[0]['wp-head-callback'] ) ) { remove_action( 'wp_head', $support[0]['wp-head-callback'] ); } remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); unset( $GLOBALS['custom_background'] ); break; } unset( $_wp_theme_features[ $feature ] ); return true; } function current_theme_supports( $feature, ...$args ) { global $_wp_theme_features; if ( 'custom-header-uploads' === $feature ) { return current_theme_supports( 'custom-header', 'uploads' ); } if ( ! isset( $_wp_theme_features[ $feature ] ) ) { return false; } if ( ! $args ) { return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); } switch ( $feature ) { case 'post-thumbnails': if ( true === $_wp_theme_features[ $feature ] ) { return true; } $content_type = $args[0]; return in_array( $content_type, $_wp_theme_features[ $feature ][0], true ); case 'html5': case 'post-formats': $type = $args[0]; return in_array( $type, $_wp_theme_features[ $feature ][0], true ); case 'custom-logo': case 'custom-header': case 'custom-background': return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] ); } return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); } function require_if_theme_supports( $feature, $include ) { if ( current_theme_supports( $feature ) ) { require $include; return true; } return false; } function register_theme_feature( $feature, $args = array() ) { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { $_wp_registered_theme_features = array(); } $defaults = array( 'type' => 'boolean', 'variadic' => false, 'description' => '', 'show_in_rest' => false, ); $args = wp_parse_args( $args, $defaults ); if ( true === $args['show_in_rest'] ) { $args['show_in_rest'] = array(); } if ( is_array( $args['show_in_rest'] ) ) { $args['show_in_rest'] = wp_parse_args( $args['show_in_rest'], array( 'schema' => array(), 'name' => $feature, 'prepare_callback' => null, ) ); } if ( ! in_array( $args['type'], array( 'string', 'boolean', 'integer', 'number', 'array', 'object' ), true ) ) { return new WP_Error( 'invalid_type', __( 'The feature "type" is not valid JSON Schema type.' ) ); } if ( true === $args['variadic'] && 'array' !== $args['type'] ) { return new WP_Error( 'variadic_must_be_array', __( 'When registering a "variadic" theme feature, the "type" must be an "array".' ) ); } if ( false !== $args['show_in_rest'] && in_array( $args['type'], array( 'array', 'object' ), true ) ) { if ( ! is_array( $args['show_in_rest'] ) || empty( $args['show_in_rest']['schema'] ) ) { return new WP_Error( 'missing_schema', __( 'When registering an "array" or "object" feature to show in the REST API, the feature\'s schema must also be defined.' ) ); } if ( 'array' === $args['type'] && ! isset( $args['show_in_rest']['schema']['items'] ) ) { return new WP_Error( 'missing_schema_items', __( 'When registering an "array" feature, the feature\'s schema must include the "items" keyword.' ) ); } if ( 'object' === $args['type'] && ! isset( $args['show_in_rest']['schema']['properties'] ) ) { return new WP_Error( 'missing_schema_properties', __( 'When registering an "object" feature, the feature\'s schema must include the "properties" keyword.' ) ); } } if ( is_array( $args['show_in_rest'] ) ) { if ( isset( $args['show_in_rest']['prepare_callback'] ) && ! is_callable( $args['show_in_rest']['prepare_callback'] ) ) { return new WP_Error( 'invalid_rest_prepare_callback', sprintf( __( 'The "%s" must be a callable function.' ), 'prepare_callback' ) ); } $args['show_in_rest']['schema'] = wp_parse_args( $args['show_in_rest']['schema'], array( 'description' => $args['description'], 'type' => $args['type'], 'default' => false, ) ); if ( is_bool( $args['show_in_rest']['schema']['default'] ) && ! in_array( 'boolean', (array) $args['show_in_rest']['schema']['type'], true ) ) { $args['show_in_rest']['schema']['type'] = (array) $args['show_in_rest']['schema']['type']; array_unshift( $args['show_in_rest']['schema']['type'], 'boolean' ); } $args['show_in_rest']['schema'] = rest_default_additional_properties_to_false( $args['show_in_rest']['schema'] ); } $_wp_registered_theme_features[ $feature ] = $args; return true; } function get_registered_theme_features() { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { return array(); } return $_wp_registered_theme_features; } function get_registered_theme_feature( $feature ) { global $_wp_registered_theme_features; if ( ! is_array( $_wp_registered_theme_features ) ) { return null; } return isset( $_wp_registered_theme_features[ $feature ] ) ? $_wp_registered_theme_features[ $feature ] : null; } function _delete_attachment_theme_mod( $id ) { $attachment_image = wp_get_attachment_url( $id ); $header_image = get_header_image(); $background_image = get_background_image(); $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id && $custom_logo_id == $id ) { remove_theme_mod( 'custom_logo' ); remove_theme_mod( 'header_text' ); } if ( $header_image && $header_image == $attachment_image ) { remove_theme_mod( 'header_image' ); remove_theme_mod( 'header_image_data' ); } if ( $background_image && $background_image == $attachment_image ) { remove_theme_mod( 'background_image' ); } } function check_theme_switched() { $stylesheet = get_option( 'theme_switched' ); if ( $stylesheet ) { $old_theme = wp_get_theme( $stylesheet ); if ( get_option( 'theme_switched_via_customizer' ) ) { remove_action( 'after_switch_theme', '_wp_menus_changed' ); remove_action( 'after_switch_theme', '_wp_sidebars_changed' ); update_option( 'theme_switched_via_customizer', false ); } if ( $old_theme->exists() ) { do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme ); } else { do_action( 'after_switch_theme', $stylesheet, $old_theme ); } flush_rewrite_rules(); update_option( 'theme_switched', false ); } } function _wp_customize_include() { $is_customize_admin_page = ( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) ); $should_include = ( $is_customize_admin_page || ( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] ) || ( ! empty( $_GET['customize_changeset_uuid'] ) || ! empty( $_POST['customize_changeset_uuid'] ) ) ); if ( ! $should_include ) { return; } $keys = array( 'changeset_uuid', 'customize_changeset_uuid', 'customize_theme', 'theme', 'customize_messenger_channel', 'customize_autosaved', ); $input_vars = array_merge( wp_array_slice_assoc( $_GET, $keys ), wp_array_slice_assoc( $_POST, $keys ) ); $theme = null; $autosaved = null; $messenger_channel = null; $changeset_uuid = false; $branching = false; if ( $is_customize_admin_page && isset( $input_vars['changeset_uuid'] ) ) { $changeset_uuid = sanitize_key( $input_vars['changeset_uuid'] ); } elseif ( ! empty( $input_vars['customize_changeset_uuid'] ) ) { $changeset_uuid = sanitize_key( $input_vars['customize_changeset_uuid'] ); } if ( $is_customize_admin_page && isset( $input_vars['theme'] ) ) { $theme = $input_vars['theme']; } elseif ( isset( $input_vars['customize_theme'] ) ) { $theme = $input_vars['customize_theme']; } if ( ! empty( $input_vars['customize_autosaved'] ) ) { $autosaved = true; } if ( isset( $input_vars['customize_messenger_channel'] ) ) { $messenger_channel = sanitize_key( $input_vars['customize_messenger_channel'] ); } $is_customize_save_action = ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && 'customize_save' === wp_unslash( $_REQUEST['action'] ) ); $settings_previewed = ! $is_customize_save_action; require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $GLOBALS['wp_customize'] = new WP_Customize_Manager( compact( 'changeset_uuid', 'theme', 'messenger_channel', 'settings_previewed', 'autosaved', 'branching' ) ); } function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_post ) { global $wp_customize, $wpdb; $is_publishing_changeset = ( 'customize_changeset' === $changeset_post->post_type && 'publish' === $new_status && 'publish' !== $old_status ); if ( ! $is_publishing_changeset ) { return; } if ( empty( $wp_customize ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $changeset_post->post_name, 'settings_previewed' => false, ) ); } if ( ! did_action( 'customize_register' ) ) { remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) ); $wp_customize->register_controls(); do_action( 'customize_register', $wp_customize ); } $wp_customize->_publish_changeset_values( $changeset_post->ID ); if ( ! wp_revisions_enabled( $changeset_post ) ) { $wp_customize->trash_changeset_post( $changeset_post->ID ); } } function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_post_data ) { if ( isset( $post_data['post_type'] ) && 'customize_changeset' === $post_data['post_type'] ) { if ( empty( $post_data['post_name'] ) && ! empty( $supplied_post_data['post_name'] ) ) { $post_data['post_name'] = $supplied_post_data['post_name']; } } return $post_data; } function _wp_customize_loader_settings() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) ); $browser = array( 'mobile' => wp_is_mobile(), 'ios' => wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ), ); $settings = array( 'url' => esc_url( admin_url( 'customize.php' ) ), 'isCrossDomain' => $cross_domain, 'browser' => $browser, 'l10n' => array( 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 'mainIframeTitle' => __( 'Customizer' ), ), ); $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';'; $wp_scripts = wp_scripts(); $data = $wp_scripts->get_data( 'customize-loader', 'data' ); if ( $data ) { $script = "$data\n$script"; } $wp_scripts->add_data( 'customize-loader', 'data', $script ); } function wp_customize_url( $stylesheet = '' ) { $url = admin_url( 'customize.php' ); if ( $stylesheet ) { $url .= '?theme=' . urlencode( $stylesheet ); } return esc_url( $url ); } function wp_customize_support_script() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) ); $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"'; ?> - > - (function() { - var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)'); - - - request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })(); - - request = true; - - - b[c] = b[c].replace( rcs, ' ' ); - // The customizer requires postMessage and CORS (if the site is cross domain). - b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs; - }()); - - is_preview(); } function _wp_keep_alive_customize_changeset_dependent_auto_drafts( $new_status, $old_status, $post ) { global $wpdb; unset( $old_status ); if ( 'customize_changeset' !== $post->post_type || 'publish' === $new_status ) { return; } $data = json_decode( $post->post_content, true ); if ( empty( $data['nav_menus_created_posts']['value'] ) ) { return; } if ( 'trash' === $new_status ) { foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) { if ( ! empty( $post_id ) && 'draft' === get_post_status( $post_id ) ) { wp_trash_post( $post_id ); } } return; } $post_args = array(); if ( 'auto-draft' === $new_status ) { $post_args['post_date'] = $post->post_date; } else { $post_args['post_status'] = 'draft'; } foreach ( $data['nav_menus_created_posts']['value'] as $post_id ) { if ( empty( $post_id ) || 'auto-draft' !== get_post_status( $post_id ) ) { continue; } $wpdb->update( $wpdb->posts, $post_args, array( 'ID' => $post_id ) ); clean_post_cache( $post_id ); } } function create_initial_theme_features() { register_theme_feature( 'align-wide', array( 'description' => __( 'Whether theme opts in to wide alignment CSS class.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'automatic-feed-links', array( 'description' => __( 'Whether posts and comments RSS feed links are added to head.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'block-templates', array( 'description' => __( 'Whether a theme uses block-based templates.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'custom-background', array( 'description' => __( 'Custom background if defined by the theme.' ), 'type' => 'object', 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'default-image' => array( 'type' => 'string', 'format' => 'uri', ), 'default-preset' => array( 'type' => 'string', 'enum' => array( 'default', 'fill', 'fit', 'repeat', 'custom', ), ), 'default-position-x' => array( 'type' => 'string', 'enum' => array( 'left', 'center', 'right', ), ), 'default-position-y' => array( 'type' => 'string', 'enum' => array( 'left', 'center', 'right', ), ), 'default-size' => array( 'type' => 'string', 'enum' => array( 'auto', 'contain', 'cover', ), ), 'default-repeat' => array( 'type' => 'string', 'enum' => array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat', ), ), 'default-attachment' => array( 'type' => 'string', 'enum' => array( 'scroll', 'fixed', ), ), 'default-color' => array( 'type' => 'string', ), ), ), ), ) ); register_theme_feature( 'custom-header', array( 'description' => __( 'Custom header if defined by the theme.' ), 'type' => 'object', 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'default-image' => array( 'type' => 'string', 'format' => 'uri', ), 'random-default' => array( 'type' => 'boolean', ), 'width' => array( 'type' => 'integer', ), 'height' => array( 'type' => 'integer', ), 'flex-height' => array( 'type' => 'boolean', ), 'flex-width' => array( 'type' => 'boolean', ), 'default-text-color' => array( 'type' => 'string', ), 'header-text' => array( 'type' => 'boolean', ), 'uploads' => array( 'type' => 'boolean', ), 'video' => array( 'type' => 'boolean', ), ), ), ), ) ); register_theme_feature( 'custom-logo', array( 'type' => 'object', 'description' => __( 'Custom logo if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'properties' => array( 'width' => array( 'type' => 'integer', ), 'height' => array( 'type' => 'integer', ), 'flex-width' => array( 'type' => 'boolean', ), 'flex-height' => array( 'type' => 'boolean', ), 'header-text' => array( 'type' => 'array', 'items' => array( 'type' => 'string', ), ), 'unlink-homepage-logo' => array( 'type' => 'boolean', ), ), ), ), ) ); register_theme_feature( 'customize-selective-refresh-widgets', array( 'description' => __( 'Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'dark-editor-style', array( 'description' => __( 'Whether theme opts in to the dark editor style UI.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-colors', array( 'description' => __( 'Whether the theme disables custom colors.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-font-sizes', array( 'description' => __( 'Whether the theme disables custom font sizes.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'disable-custom-gradients', array( 'description' => __( 'Whether the theme disables custom gradients.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'editor-color-palette', array( 'type' => 'array', 'description' => __( 'Custom color palette if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'slug' => array( 'type' => 'string', ), 'color' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-font-sizes', array( 'type' => 'array', 'description' => __( 'Custom font sizes if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'size' => array( 'type' => 'number', ), 'slug' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-gradient-presets', array( 'type' => 'array', 'description' => __( 'Custom gradient presets if defined by the theme.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string', ), 'gradient' => array( 'type' => 'string', ), 'slug' => array( 'type' => 'string', ), ), ), ), ), ) ); register_theme_feature( 'editor-styles', array( 'description' => __( 'Whether theme opts in to the editor styles CSS wrapper.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'html5', array( 'type' => 'array', 'description' => __( 'Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.' ), 'show_in_rest' => array( 'schema' => array( 'items' => array( 'type' => 'string', 'enum' => array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style', ), ), ), ), ) ); register_theme_feature( 'post-formats', array( 'type' => 'array', 'description' => __( 'Post formats supported.' ), 'show_in_rest' => array( 'name' => 'formats', 'schema' => array( 'items' => array( 'type' => 'string', 'enum' => get_post_format_slugs(), ), 'default' => array( 'standard' ), ), 'prepare_callback' => static function ( $formats ) { $formats = is_array( $formats ) ? array_values( $formats[0] ) : array(); $formats = array_merge( array( 'standard' ), $formats ); return $formats; }, ), ) ); register_theme_feature( 'post-thumbnails', array( 'type' => 'array', 'description' => __( 'The post types that support thumbnails or true if all post types are supported.' ), 'show_in_rest' => array( 'type' => array( 'boolean', 'array' ), 'schema' => array( 'items' => array( 'type' => 'string', ), ), ), ) ); register_theme_feature( 'responsive-embeds', array( 'description' => __( 'Whether the theme supports responsive embedded content.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'title-tag', array( 'description' => __( 'Whether the theme can manage the document title tag.' ), 'show_in_rest' => true, ) ); register_theme_feature( 'wp-block-styles', array( 'description' => __( 'Whether theme opts in to default WordPress block styles for viewing.' ), 'show_in_rest' => true, ) ); } function wp_is_block_theme() { return wp_get_theme()->is_block_theme(); } function _add_default_theme_supports() { if ( ! wp_is_block_theme() ) { return; } add_theme_support( 'post-thumbnails' ); add_theme_support( 'responsive-embeds' ); add_theme_support( 'editor-styles' ); add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'search-form', 'gallery', 'caption', 'style', 'script' ) ); add_theme_support( 'automatic-feed-links' ); add_filter( 'should_load_separate_core_block_assets', '__return_true' ); } name = 'feed_' . $filename; $this->mod_name = 'feed_mod_' . $filename; $lifetime = $this->lifetime; $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename ); } public function save( $data ) { if ( $data instanceof SimplePie ) { $data = $data->data; } set_transient( $this->name, $data, $this->lifetime ); set_transient( $this->mod_name, time(), $this->lifetime ); return true; } public function load() { return get_transient( $this->name ); } public function mtime() { return get_transient( $this->mod_name ); } public function touch() { return set_transient( $this->mod_name, time(), $this->lifetime ); } public function unlink() { delete_transient( $this->name ); delete_transient( $this->mod_name ); return true; } } 'Theme Name', 'ThemeURI' => 'Theme URI', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'Version' => 'Version', 'Template' => 'Template', 'Status' => 'Status', 'Tags' => 'Tags', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'RequiresWP' => 'Requires at least', 'RequiresPHP' => 'Requires PHP', ); private static $default_themes = array( 'classic' => 'WordPress Classic', 'default' => 'WordPress Default', 'twentyten' => 'Twenty Ten', 'twentyeleven' => 'Twenty Eleven', 'twentytwelve' => 'Twenty Twelve', 'twentythirteen' => 'Twenty Thirteen', 'twentyfourteen' => 'Twenty Fourteen', 'twentyfifteen' => 'Twenty Fifteen', 'twentysixteen' => 'Twenty Sixteen', 'twentyseventeen' => 'Twenty Seventeen', 'twentynineteen' => 'Twenty Nineteen', 'twentytwenty' => 'Twenty Twenty', 'twentytwentyone' => 'Twenty Twenty-One', 'twentytwentytwo' => 'Twenty Twenty-Two', ); private static $tag_map = array( 'fixed-width' => 'fixed-layout', 'flexible-width' => 'fluid-layout', ); private $theme_root; private $headers = array(); private $headers_sanitized; private $name_translated; private $errors; private $stylesheet; private $template; private $parent; private $theme_root_uri; private $textdomain_loaded; private $cache_hash; private static $persistently_cache; private static $cache_expiration = 1800; public function __construct( $theme_dir, $theme_root, $_child = null ) { global $wp_theme_directories; if ( ! isset( self::$persistently_cache ) ) { self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' ); if ( self::$persistently_cache ) { wp_cache_add_global_groups( 'themes' ); if ( is_int( self::$persistently_cache ) ) { self::$cache_expiration = self::$persistently_cache; } } else { wp_cache_add_non_persistent_groups( 'themes' ); } } $this->theme_root = $theme_root; $this->stylesheet = $theme_dir; if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories, true ) ) { $this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet; $this->theme_root = dirname( $theme_root ); } $this->cache_hash = md5( $this->theme_root . '/' . $this->stylesheet ); $theme_file = $this->stylesheet . '/style.css'; $cache = $this->cache_get( 'theme' ); if ( is_array( $cache ) ) { foreach ( array( 'errors', 'headers', 'template' ) as $key ) { if ( isset( $cache[ $key ] ) ) { $this->$key = $cache[ $key ]; } } if ( $this->errors ) { return; } if ( isset( $cache['theme_root_template'] ) ) { $theme_root_template = $cache['theme_root_template']; } } elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) { $this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) ); } else { $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) ); } $this->template = $this->stylesheet; $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); if ( ! file_exists( $this->theme_root ) ) { $this->errors->add( 'theme_root_missing', __( 'Error: The themes directory is either empty or does not exist. Please check your installation.' ) ); } return; } elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; $this->errors = new WP_Error( 'theme_stylesheet_not_readable', __( 'Stylesheet is not readable.' ) ); $this->template = $this->stylesheet; $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); return; } else { $this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' ); $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true ); if ( $default_theme_slug ) { if ( basename( $this->stylesheet ) != $default_theme_slug ) { $this->headers['Name'] .= '/' . $this->stylesheet; } } } if ( ! $this->template && $this->stylesheet === $this->headers['Template'] ) { $this->errors = new WP_Error( 'theme_child_invalid', sprintf( __( 'The theme defines itself as its parent theme. Please check the %s header.' ), 'Template' ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, ) ); return; } if ( ! $this->template ) { $this->template = $this->headers['Template']; } if ( ! $this->template ) { $this->template = $this->stylesheet; $theme_path = $this->theme_root . '/' . $this->stylesheet; if ( ! file_exists( $theme_path . '/templates/index.html' ) && ! file_exists( $theme_path . '/block-templates/index.html' ) && ! file_exists( $theme_path . '/index.php' ) ) { $error_message = sprintf( __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. Child themes need to have a %4$s header in the %5$s stylesheet.' ), 'templates/index.html', 'index.php', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), 'Template', 'style.css' ); $this->errors = new WP_Error( 'theme_no_index', $error_message ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); return; } } if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) { $parent_dir = dirname( $this->stylesheet ); $directories = search_theme_directories(); if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) { $this->template = $parent_dir . '/' . $this->template; } elseif ( $directories && isset( $directories[ $this->template ] ) ) { $theme_root_template = $directories[ $this->template ]['theme_root']; } else { $this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); $this->parent = new WP_Theme( $this->template, $this->theme_root, $this ); return; } } if ( $this->template != $this->stylesheet ) { if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) { $_child->parent = null; $_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) ); $_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template, ) ); if ( $_child->stylesheet == $this->template ) { $this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) ); $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ) ); } return; } $this->parent = new WP_Theme( $this->template, isset( $theme_root_template ) ? $theme_root_template : $this->theme_root, $this ); } if ( wp_paused_themes()->get( $this->stylesheet ) && ( ! is_wp_error( $this->errors ) || ! isset( $this->errors->errors['theme_paused'] ) ) ) { $this->errors = new WP_Error( 'theme_paused', __( 'This theme failed to load properly and was paused within the admin backend.' ) ); } if ( ! is_array( $cache ) ) { $cache = array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template, ); if ( isset( $theme_root_template ) ) { $cache['theme_root_template'] = $theme_root_template; } $this->cache_add( 'theme', $cache ); } } public function __toString() { return (string) $this->display( 'Name' ); } public function __isset( $offset ) { static $properties = array( 'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet', 'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri', ); return in_array( $offset, $properties, true ); } public function __get( $offset ) { switch ( $offset ) { case 'name': case 'title': return $this->get( 'Name' ); case 'version': return $this->get( 'Version' ); case 'parent_theme': return $this->parent() ? $this->parent()->get( 'Name' ) : ''; case 'template_dir': return $this->get_template_directory(); case 'stylesheet_dir': return $this->get_stylesheet_directory(); case 'template': return $this->get_template(); case 'stylesheet': return $this->get_stylesheet(); case 'screenshot': return $this->get_screenshot( 'relative' ); case 'description': return $this->display( 'Description' ); case 'author': return $this->display( 'Author' ); case 'tags': return $this->get( 'Tags' ); case 'theme_root': return $this->get_theme_root(); case 'theme_root_uri': return $this->get_theme_root_uri(); default: return $this->offsetGet( $offset ); } } public function offsetSet( $offset, $value ) {} public function offsetUnset( $offset ) {} public function offsetExists( $offset ) { static $keys = array( 'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description', 'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir', 'Screenshot', 'Tags', 'Theme Root', 'Theme Root URI', 'Parent Theme', ); return in_array( $offset, $keys, true ); } public function offsetGet( $offset ) { switch ( $offset ) { case 'Name': case 'Title': return $this->get( 'Name' ); case 'Author': return $this->display( 'Author' ); case 'Author Name': return $this->display( 'Author', false ); case 'Author URI': return $this->display( 'AuthorURI' ); case 'Description': return $this->display( 'Description' ); case 'Version': case 'Status': return $this->get( $offset ); case 'Template': return $this->get_template(); case 'Stylesheet': return $this->get_stylesheet(); case 'Template Files': return $this->get_files( 'php', 1, true ); case 'Stylesheet Files': return $this->get_files( 'css', 0, false ); case 'Template Dir': return $this->get_template_directory(); case 'Stylesheet Dir': return $this->get_stylesheet_directory(); case 'Screenshot': return $this->get_screenshot( 'relative' ); case 'Tags': return $this->get( 'Tags' ); case 'Theme Root': return $this->get_theme_root(); case 'Theme Root URI': return $this->get_theme_root_uri(); case 'Parent Theme': return $this->parent() ? $this->parent()->get( 'Name' ) : ''; default: return null; } } public function errors() { return is_wp_error( $this->errors ) ? $this->errors : false; } public function exists() { return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes(), true ) ); } public function parent() { return isset( $this->parent ) ? $this->parent : false; } private function cache_add( $key, $data ) { return wp_cache_add( $key . '-' . $this->cache_hash, $data, 'themes', self::$cache_expiration ); } private function cache_get( $key ) { return wp_cache_get( $key . '-' . $this->cache_hash, 'themes' ); } public function cache_delete() { foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key ) { wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' ); } $this->template = null; $this->textdomain_loaded = null; $this->theme_root_uri = null; $this->parent = null; $this->errors = null; $this->headers_sanitized = null; $this->name_translated = null; $this->headers = array(); $this->__construct( $this->stylesheet, $this->theme_root ); } public function get( $header ) { if ( ! isset( $this->headers[ $header ] ) ) { return false; } if ( ! isset( $this->headers_sanitized ) ) { $this->headers_sanitized = $this->cache_get( 'headers' ); if ( ! is_array( $this->headers_sanitized ) ) { $this->headers_sanitized = array(); } } if ( isset( $this->headers_sanitized[ $header ] ) ) { return $this->headers_sanitized[ $header ]; } if ( self::$persistently_cache ) { foreach ( array_keys( $this->headers ) as $_header ) { $this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] ); } $this->cache_add( 'headers', $this->headers_sanitized ); } else { $this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] ); } return $this->headers_sanitized[ $header ]; } public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); if ( false === $value ) { return false; } if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) { $translate = false; } if ( $translate ) { $value = $this->translate_header( $header, $value ); } if ( $markup ) { $value = $this->markup_header( $header, $value, $translate ); } return $value; } private function sanitize_header( $header, $value ) { switch ( $header ) { case 'Status': if ( ! $value ) { $value = 'publish'; break; } case 'Name': static $header_tags = array( 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $value = wp_kses( $value, $header_tags ); break; case 'Author': case 'Description': static $header_tags_with_a = array( 'a' => array( 'href' => true, 'title' => true, ), 'abbr' => array( 'title' => true ), 'acronym' => array( 'title' => true ), 'code' => true, 'em' => true, 'strong' => true, ); $value = wp_kses( $value, $header_tags_with_a ); break; case 'ThemeURI': case 'AuthorURI': $value = esc_url_raw( $value ); break; case 'Tags': $value = array_filter( array_map( 'trim', explode( ',', strip_tags( $value ) ) ) ); break; case 'Version': case 'RequiresWP': case 'RequiresPHP': $value = strip_tags( $value ); break; } return $value; } private function markup_header( $header, $value, $translate ) { switch ( $header ) { case 'Name': if ( empty( $value ) ) { $value = esc_html( $this->get_stylesheet() ); } break; case 'Description': $value = wptexturize( $value ); break; case 'Author': if ( $this->get( 'AuthorURI' ) ) { $value = sprintf( '%2$s', $this->display( 'AuthorURI', true, $translate ), $value ); } elseif ( ! $value ) { $value = __( 'Anonymous' ); } break; case 'Tags': static $comma = null; if ( ! isset( $comma ) ) { $comma = wp_get_list_item_separator(); } $value = implode( $comma, $value ); break; case 'ThemeURI': case 'AuthorURI': $value = esc_url( $value ); break; } return $value; } private function translate_header( $header, $value ) { switch ( $header ) { case 'Name': if ( isset( $this->name_translated ) ) { return $this->name_translated; } $this->name_translated = translate( $value, $this->get( 'TextDomain' ) ); return $this->name_translated; case 'Tags': if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) ) { return $value; } static $tags_list; if ( ! isset( $tags_list ) ) { $tags_list = array( 'black' => __( 'Black' ), 'blue' => __( 'Blue' ), 'brown' => __( 'Brown' ), 'gray' => __( 'Gray' ), 'green' => __( 'Green' ), 'orange' => __( 'Orange' ), 'pink' => __( 'Pink' ), 'purple' => __( 'Purple' ), 'red' => __( 'Red' ), 'silver' => __( 'Silver' ), 'tan' => __( 'Tan' ), 'white' => __( 'White' ), 'yellow' => __( 'Yellow' ), 'dark' => _x( 'Dark', 'color scheme' ), 'light' => _x( 'Light', 'color scheme' ), 'fixed-layout' => __( 'Fixed Layout' ), 'fluid-layout' => __( 'Fluid Layout' ), 'responsive-layout' => __( 'Responsive Layout' ), 'blavatar' => __( 'Blavatar' ), 'photoblogging' => __( 'Photoblogging' ), 'seasonal' => __( 'Seasonal' ), ); $feature_list = get_theme_feature_list( false ); foreach ( $feature_list as $tags ) { $tags_list += $tags; } } foreach ( $value as &$tag ) { if ( isset( $tags_list[ $tag ] ) ) { $tag = $tags_list[ $tag ]; } elseif ( isset( self::$tag_map[ $tag ] ) ) { $tag = $tags_list[ self::$tag_map[ $tag ] ]; } } return $value; default: $value = translate( $value, $this->get( 'TextDomain' ) ); } return $value; } public function get_stylesheet() { return $this->stylesheet; } public function get_template() { return $this->template; } public function get_stylesheet_directory() { if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes(), true ) ) { return ''; } return $this->theme_root . '/' . $this->stylesheet; } public function get_template_directory() { if ( $this->parent() ) { $theme_root = $this->parent()->theme_root; } else { $theme_root = $this->theme_root; } return $theme_root . '/' . $this->template; } public function get_stylesheet_directory_uri() { return $this->get_theme_root_uri() . '/' . str_replace( '%2F', '/', rawurlencode( $this->stylesheet ) ); } public function get_template_directory_uri() { if ( $this->parent() ) { $theme_root_uri = $this->parent()->get_theme_root_uri(); } else { $theme_root_uri = $this->get_theme_root_uri(); } return $theme_root_uri . '/' . str_replace( '%2F', '/', rawurlencode( $this->template ) ); } public function get_theme_root() { return $this->theme_root; } public function get_theme_root_uri() { if ( ! isset( $this->theme_root_uri ) ) { $this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root ); } return $this->theme_root_uri; } public function get_screenshot( $uri = 'uri' ) { $screenshot = $this->cache_get( 'screenshot' ); if ( $screenshot ) { if ( 'relative' === $uri ) { return $screenshot; } return $this->get_stylesheet_directory_uri() . '/' . $screenshot; } elseif ( 0 === $screenshot ) { return false; } foreach ( array( 'png', 'gif', 'jpg', 'jpeg', 'webp' ) as $ext ) { if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) { $this->cache_add( 'screenshot', 'screenshot.' . $ext ); if ( 'relative' === $uri ) { return 'screenshot.' . $ext; } return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext; } } $this->cache_add( 'screenshot', 0 ); return false; } public function get_files( $type = null, $depth = 0, $search_parent = false ) { $files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth ); if ( $search_parent && $this->parent() ) { $files += (array) self::scandir( $this->get_template_directory(), $type, $depth ); } return array_filter( $files ); } public function get_post_templates() { if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) ) { return array(); } $post_templates = $this->cache_get( 'post_templates' ); if ( ! is_array( $post_templates ) ) { $post_templates = array(); $files = (array) $this->get_files( 'php', 1, true ); foreach ( $files as $file => $full_path ) { if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { continue; } $types = array( 'page' ); if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) { $types = explode( ',', _cleanup_header_comment( $type[1] ) ); } foreach ( $types as $type ) { $type = sanitize_key( $type ); if ( ! isset( $post_templates[ $type ] ) ) { $post_templates[ $type ] = array(); } $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] ); } } if ( current_theme_supports( 'block-templates' ) ) { $block_templates = get_block_templates( array(), 'wp_template' ); foreach ( get_post_types( array( 'public' => true ) ) as $type ) { foreach ( $block_templates as $block_template ) { if ( ! $block_template->is_custom ) { continue; } if ( isset( $block_template->post_types ) && ! in_array( $type, $block_template->post_types, true ) ) { continue; } $post_templates[ $type ][ $block_template->slug ] = $block_template->title; } } } $this->cache_add( 'post_templates', $post_templates ); } if ( $this->load_textdomain() ) { foreach ( $post_templates as &$post_type ) { foreach ( $post_type as &$post_template ) { $post_template = $this->translate_header( 'Template Name', $post_template ); } } } return $post_templates; } public function get_page_templates( $post = null, $post_type = 'page' ) { if ( $post ) { $post_type = get_post_type( $post ); } $post_templates = $this->get_post_templates(); $post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array(); $post_templates = (array) apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type ); $post_templates = (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type ); return $post_templates; } private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) { if ( ! is_dir( $path ) ) { return false; } if ( $extensions ) { $extensions = (array) $extensions; $_extensions = implode( '|', $extensions ); } $relative_path = trailingslashit( $relative_path ); if ( '/' === $relative_path ) { $relative_path = ''; } $results = scandir( $path ); $files = array(); $exclusions = (array) apply_filters( 'theme_scandir_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) ); foreach ( $results as $result ) { if ( '.' === $result[0] || in_array( $result, $exclusions, true ) ) { continue; } if ( is_dir( $path . '/' . $result ) ) { if ( ! $depth ) { continue; } $found = self::scandir( $path . '/' . $result, $extensions, $depth - 1, $relative_path . $result ); $files = array_merge_recursive( $files, $found ); } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) { $files[ $relative_path . $result ] = $path . '/' . $result; } } return $files; } public function load_textdomain() { if ( isset( $this->textdomain_loaded ) ) { return $this->textdomain_loaded; } $textdomain = $this->get( 'TextDomain' ); if ( ! $textdomain ) { $this->textdomain_loaded = false; return false; } if ( is_textdomain_loaded( $textdomain ) ) { $this->textdomain_loaded = true; return true; } $path = $this->get_stylesheet_directory(); $domainpath = $this->get( 'DomainPath' ); if ( $domainpath ) { $path .= $domainpath; } else { $path .= '/languages'; } $this->textdomain_loaded = load_theme_textdomain( $textdomain, $path ); return $this->textdomain_loaded; } public function is_allowed( $check = 'both', $blog_id = null ) { if ( ! is_multisite() ) { return true; } if ( 'both' === $check || 'network' === $check ) { $allowed = self::get_allowed_on_network(); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } if ( 'both' === $check || 'site' === $check ) { $allowed = self::get_allowed_on_site( $blog_id ); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } return false; } public function is_block_theme() { $paths_to_index_block_template = array( $this->get_file_path( '/block-templates/index.html' ), $this->get_file_path( '/templates/index.html' ), ); foreach ( $paths_to_index_block_template as $path_to_index_block_template ) { if ( is_file( $path_to_index_block_template ) && is_readable( $path_to_index_block_template ) ) { return true; } } return false; } public function get_file_path( $file = '' ) { $file = ltrim( $file, '/' ); $stylesheet_directory = $this->get_stylesheet_directory(); $template_directory = $this->get_template_directory(); if ( empty( $file ) ) { $path = $stylesheet_directory; } elseif ( file_exists( $stylesheet_directory . '/' . $file ) ) { $path = $stylesheet_directory . '/' . $file; } else { $path = $template_directory . '/' . $file; } return apply_filters( 'theme_file_path', $path, $file ); } public static function get_core_default_theme() { foreach ( array_reverse( self::$default_themes ) as $slug => $name ) { $theme = wp_get_theme( $slug ); if ( $theme->exists() ) { return $theme; } } return false; } public static function get_allowed( $blog_id = null ) { $network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id ); return $network + self::get_allowed_on_site( $blog_id ); } public static function get_allowed_on_network() { static $allowed_themes; if ( ! isset( $allowed_themes ) ) { $allowed_themes = (array) get_site_option( 'allowedthemes' ); } $allowed_themes = apply_filters( 'allowed_themes', $allowed_themes ); return $allowed_themes; } public static function get_allowed_on_site( $blog_id = null ) { static $allowed_themes = array(); if ( ! $blog_id || ! is_multisite() ) { $blog_id = get_current_blog_id(); } if ( isset( $allowed_themes[ $blog_id ] ) ) { return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } $current = get_current_blog_id() == $blog_id; if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); } else { switch_to_blog( $blog_id ); $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); restore_current_blog(); } if ( false === $allowed_themes[ $blog_id ] ) { if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); $allowed_themes[ $blog_id ] = get_option( 'allowed_themes' ); restore_current_blog(); } if ( ! is_array( $allowed_themes[ $blog_id ] ) || empty( $allowed_themes[ $blog_id ] ) ) { $allowed_themes[ $blog_id ] = array(); } else { $converted = array(); $themes = wp_get_themes(); foreach ( $themes as $stylesheet => $theme_data ) { if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get( 'Name' ) ] ) ) { $converted[ $stylesheet ] = true; } } $allowed_themes[ $blog_id ] = $converted; } if ( is_admin() && $allowed_themes[ $blog_id ] ) { if ( $current ) { update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); } else { switch_to_blog( $blog_id ); update_option( 'allowedthemes', $allowed_themes[ $blog_id ] ); delete_option( 'allowed_themes' ); restore_current_blog(); } } } return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } public static function network_enable_theme( $stylesheets ) { if ( ! is_multisite() ) { return; } if ( ! is_array( $stylesheets ) ) { $stylesheets = array( $stylesheets ); } $allowed_themes = get_site_option( 'allowedthemes' ); foreach ( $stylesheets as $stylesheet ) { $allowed_themes[ $stylesheet ] = true; } update_site_option( 'allowedthemes', $allowed_themes ); } public static function network_disable_theme( $stylesheets ) { if ( ! is_multisite() ) { return; } if ( ! is_array( $stylesheets ) ) { $stylesheets = array( $stylesheets ); } $allowed_themes = get_site_option( 'allowedthemes' ); foreach ( $stylesheets as $stylesheet ) { if ( isset( $allowed_themes[ $stylesheet ] ) ) { unset( $allowed_themes[ $stylesheet ] ); } } update_site_option( 'allowedthemes', $allowed_themes ); } public static function sort_by_name( &$themes ) { if ( 0 === strpos( get_user_locale(), 'en_' ) ) { uasort( $themes, array( 'WP_Theme', '_name_sort' ) ); } else { foreach ( $themes as $key => $theme ) { $theme->translate_header( 'Name', $theme->headers['Name'] ); } uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) ); } } private static function _name_sort( $a, $b ) { return strnatcasecmp( $a->headers['Name'], $b->headers['Name'] ); } private static function _name_sort_i18n( $a, $b ) { return strnatcasecmp( $a->name_translated, $b->name_translated ); } } show_errors(); } if ( function_exists( 'mysqli_connect' ) ) { $this->use_mysqli = true; if ( defined( 'WP_USE_EXT_MYSQL' ) ) { $this->use_mysqli = ! WP_USE_EXT_MYSQL; } } $this->dbuser = $dbuser; $this->dbpassword = $dbpassword; $this->dbname = $dbname; $this->dbhost = $dbhost; if ( defined( 'WP_SETUP_CONFIG' ) ) { return; } $this->db_connect(); } public function __get( $name ) { if ( 'col_info' === $name ) { $this->load_col_info(); } return $this->$name; } public function __set( $name, $value ) { $protected_members = array( 'col_meta', 'table_charset', 'check_current_query', ); if ( in_array( $name, $protected_members, true ) ) { return; } $this->$name = $value; } public function __isset( $name ) { return isset( $this->$name ); } public function __unset( $name ) { unset( $this->$name ); } public function init_charset() { $charset = ''; $collate = ''; if ( function_exists( 'is_multisite' ) && is_multisite() ) { $charset = 'utf8'; if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) { $collate = DB_COLLATE; } else { $collate = 'utf8_general_ci'; } } elseif ( defined( 'DB_COLLATE' ) ) { $collate = DB_COLLATE; } if ( defined( 'DB_CHARSET' ) ) { $charset = DB_CHARSET; } $charset_collate = $this->determine_charset( $charset, $collate ); $this->charset = $charset_collate['charset']; $this->collate = $charset_collate['collate']; } public function determine_charset( $charset, $collate ) { if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) { return compact( 'charset', 'collate' ); } if ( 'utf8' === $charset && $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8mb4'; } if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8'; $collate = str_replace( 'utf8mb4_', 'utf8_', $collate ); } if ( 'utf8mb4' === $charset ) { if ( ! $collate || 'utf8_general_ci' === $collate ) { $collate = 'utf8mb4_unicode_ci'; } else { $collate = str_replace( 'utf8_', 'utf8mb4_', $collate ); } } if ( $this->has_cap( 'utf8mb4_520' ) && 'utf8mb4_unicode_ci' === $collate ) { $collate = 'utf8mb4_unicode_520_ci'; } return compact( 'charset', 'collate' ); } public function set_charset( $dbh, $charset = null, $collate = null ) { if ( ! isset( $charset ) ) { $charset = $this->charset; } if ( ! isset( $collate ) ) { $collate = $this->collate; } if ( $this->has_cap( 'collation' ) && ! empty( $charset ) ) { $set_charset_succeeded = true; if ( $this->use_mysqli ) { if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) { $set_charset_succeeded = mysqli_set_charset( $dbh, $charset ); } if ( $set_charset_succeeded ) { $query = $this->prepare( 'SET NAMES %s', $charset ); if ( ! empty( $collate ) ) { $query .= $this->prepare( ' COLLATE %s', $collate ); } mysqli_query( $dbh, $query ); } } else { if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) { $set_charset_succeeded = mysql_set_charset( $charset, $dbh ); } if ( $set_charset_succeeded ) { $query = $this->prepare( 'SET NAMES %s', $charset ); if ( ! empty( $collate ) ) { $query .= $this->prepare( ' COLLATE %s', $collate ); } mysql_query( $query, $dbh ); } } } } public function set_sql_mode( $modes = array() ) { if ( empty( $modes ) ) { if ( $this->use_mysqli ) { $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' ); } else { $res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh ); } if ( empty( $res ) ) { return; } if ( $this->use_mysqli ) { $modes_array = mysqli_fetch_array( $res ); if ( empty( $modes_array[0] ) ) { return; } $modes_str = $modes_array[0]; } else { $modes_str = mysql_result( $res, 0 ); } if ( empty( $modes_str ) ) { return; } $modes = explode( ',', $modes_str ); } $modes = array_change_key_case( $modes, CASE_UPPER ); $incompatible_modes = (array) apply_filters( 'incompatible_sql_modes', $this->incompatible_modes ); foreach ( $modes as $i => $mode ) { if ( in_array( $mode, $incompatible_modes, true ) ) { unset( $modes[ $i ] ); } } $modes_str = implode( ',', $modes ); if ( $this->use_mysqli ) { mysqli_query( $this->dbh, "SET SESSION sql_mode='$modes_str'" ); } else { mysql_query( "SET SESSION sql_mode='$modes_str'", $this->dbh ); } } public function set_prefix( $prefix, $set_table_names = true ) { if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { return new WP_Error( 'invalid_db_prefix', 'Invalid database prefix' ); } $old_prefix = is_multisite() ? '' : $prefix; if ( isset( $this->base_prefix ) ) { $old_prefix = $this->base_prefix; } $this->base_prefix = $prefix; if ( $set_table_names ) { foreach ( $this->tables( 'global' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } if ( is_multisite() && empty( $this->blogid ) ) { return $old_prefix; } $this->prefix = $this->get_blog_prefix(); foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } } return $old_prefix; } public function set_blog_id( $blog_id, $network_id = 0 ) { if ( ! empty( $network_id ) ) { $this->siteid = $network_id; } $old_blog_id = $this->blogid; $this->blogid = $blog_id; $this->prefix = $this->get_blog_prefix(); foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } return $old_blog_id; } public function get_blog_prefix( $blog_id = null ) { if ( is_multisite() ) { if ( null === $blog_id ) { $blog_id = $this->blogid; } $blog_id = (int) $blog_id; if ( defined( 'MULTISITE' ) && ( 0 === $blog_id || 1 === $blog_id ) ) { return $this->base_prefix; } else { return $this->base_prefix . $blog_id . '_'; } } else { return $this->base_prefix; } } public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) { switch ( $scope ) { case 'all': $tables = array_merge( $this->global_tables, $this->tables ); if ( is_multisite() ) { $tables = array_merge( $tables, $this->ms_global_tables ); } break; case 'blog': $tables = $this->tables; break; case 'global': $tables = $this->global_tables; if ( is_multisite() ) { $tables = array_merge( $tables, $this->ms_global_tables ); } break; case 'ms_global': $tables = $this->ms_global_tables; break; case 'old': $tables = $this->old_tables; break; default: return array(); } if ( $prefix ) { if ( ! $blog_id ) { $blog_id = $this->blogid; } $blog_prefix = $this->get_blog_prefix( $blog_id ); $base_prefix = $this->base_prefix; $global_tables = array_merge( $this->global_tables, $this->ms_global_tables ); foreach ( $tables as $k => $table ) { if ( in_array( $table, $global_tables, true ) ) { $tables[ $table ] = $base_prefix . $table; } else { $tables[ $table ] = $blog_prefix . $table; } unset( $tables[ $k ] ); } if ( isset( $tables['users'] ) && defined( 'CUSTOM_USER_TABLE' ) ) { $tables['users'] = CUSTOM_USER_TABLE; } if ( isset( $tables['usermeta'] ) && defined( 'CUSTOM_USER_META_TABLE' ) ) { $tables['usermeta'] = CUSTOM_USER_META_TABLE; } } return $tables; } public function select( $db, $dbh = null ) { 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 = '

                ' . __( 'Cannot select database' ) . "

                \n"; $message .= '

                ' . sprintf( __( 'The database server could be connected to (which means your username and password is okay) but the %s database could not be selected.' ), '' . htmlspecialchars( $db, ENT_QUOTES ) . '' ) . "

                \n"; $message .= "
                  \n"; $message .= '
                • ' . __( 'Are you sure it exists?' ) . "
                • \n"; $message .= '
                • ' . sprintf( __( 'Does the user %1$s have permission to use the %2$s database?' ), '' . htmlspecialchars( $this->dbuser, ENT_QUOTES ) . '', '' . htmlspecialchars( $db, ENT_QUOTES ) . '' ) . "
                • \n"; $message .= '
                • ' . sprintf( __( 'On some systems the name of your database is prefixed with your username, so it would be like username_%1$s. Could that be the problem?' ), htmlspecialchars( $db, ENT_QUOTES ) ) . "
                • \n"; $message .= "
                \n"; $message .= '

                ' . sprintf( __( 'If you do not know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

                \n"; $this->bail( $message, 'db_select_fail' ); } } } public function _weak_escape( $string ) { if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) { _deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' ); } return addslashes( $string ); } public function _real_escape( $string ) { if ( ! is_scalar( $string ) ) { return ''; } if ( $this->dbh ) { if ( $this->use_mysqli ) { $escaped = mysqli_real_escape_string( $this->dbh, $string ); } else { $escaped = mysql_real_escape_string( $string, $this->dbh ); } } else { $class = get_class( $this ); wp_load_translations_early(); _doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' ); $escaped = addslashes( $string ); } return $this->add_placeholder_escape( $escaped ); } public function _escape( $data ) { if ( is_array( $data ) ) { foreach ( $data as $k => $v ) { if ( is_array( $v ) ) { $data[ $k ] = $this->_escape( $v ); } else { $data[ $k ] = $this->_real_escape( $v ); } } } else { $data = $this->_real_escape( $data ); } return $data; } public function escape( $data ) { if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) { _deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' ); } if ( is_array( $data ) ) { foreach ( $data as $k => $v ) { if ( is_array( $v ) ) { $data[ $k ] = $this->escape( $v, 'recursive' ); } else { $data[ $k ] = $this->_weak_escape( $v, 'internal' ); } } } else { $data = $this->_weak_escape( $data, 'internal' ); } return $data; } public function escape_by_ref( &$string ) { if ( ! is_float( $string ) ) { $string = $this->_real_escape( $string ); } } public function prepare( $query, ...$args ) { if ( is_null( $query ) ) { return; } if ( strpos( $query, '%' ) === false ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' ); } $passed_as_array = false; if ( isset( $args[0] ) && is_array( $args[0] ) && 1 === count( $args ) ) { $passed_as_array = true; $args = $args[0]; } foreach ( $args as $arg ) { if ( ! is_scalar( $arg ) && ! is_null( $arg ) ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' ); } } $allowed_format = '(?:[1-9][0-9]*[$])?[-+0-9]*(?: |0|\'.)?[-+0-9]*(?:\.[0-9]+)?'; $query = str_replace( "'%s'", '%s', $query ); $query = str_replace( '"%s"', '%s', $query ); $query = preg_replace( '/(?add_placeholder_escape( $query ); } public function esc_like( $text ) { return addcslashes( $text, '_%\\' ); } public function print_error( $str = '' ) { global $EZSQL_ERROR; if ( ! $str ) { if ( $this->use_mysqli ) { $str = mysqli_error( $this->dbh ); } else { $str = mysql_error( $this->dbh ); } } $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str, ); if ( $this->suppress_errors ) { return false; } wp_load_translations_early(); $caller = $this->get_caller(); if ( $caller ) { $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller ); } else { $error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query ); } error_log( $error_str ); if ( ! $this->show_errors ) { return false; } if ( is_multisite() ) { $msg = sprintf( "%s [%s]\n%s\n", __( 'WordPress database error:' ), $str, $this->last_query ); if ( defined( 'ERRORLOGFILE' ) ) { error_log( $msg, 3, ERRORLOGFILE ); } if ( defined( 'DIEONDBERROR' ) ) { wp_die( $msg ); } } else { $str = htmlspecialchars( $str, ENT_QUOTES ); $query = htmlspecialchars( $this->last_query, ENT_QUOTES ); printf( '

                %s [%s]
                %s

                ', __( 'WordPress database error:' ), $str, $query ); } } public function show_errors( $show = true ) { $errors = $this->show_errors; $this->show_errors = $show; return $errors; } public function hide_errors() { $show = $this->show_errors; $this->show_errors = false; return $show; } public function suppress_errors( $suppress = true ) { $errors = $this->suppress_errors; $this->suppress_errors = (bool) $suppress; return $errors; } public function flush() { $this->last_result = array(); $this->col_info = null; $this->last_query = null; $this->rows_affected = 0; $this->num_rows = 0; $this->last_error = ''; if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { mysqli_free_result( $this->result ); $this->result = null; if ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) { return; } while ( mysqli_more_results( $this->dbh ) ) { mysqli_next_result( $this->dbh ); } } elseif ( is_resource( $this->result ) ) { mysql_free_result( $this->result ); } } public function db_connect( $allow_bail = true ) { $this->is_mysql = true; $new_link = defined( 'MYSQL_NEW_LINK' ) ? MYSQL_NEW_LINK : true; $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0; if ( $this->use_mysqli ) { mysqli_report( MYSQLI_REPORT_OFF ); $this->dbh = mysqli_init(); $host = $this->dbhost; $port = null; $socket = null; $is_ipv6 = false; $host_data = $this->parse_db_host( $this->dbhost ); if ( $host_data ) { list( $host, $port, $socket, $is_ipv6 ) = $host_data; } if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) { $host = "[$host]"; } if ( WP_DEBUG ) { mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } else { @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } if ( $this->dbh->connect_errno ) { $this->dbh = null; $attempt_fallback = true; if ( $this->has_connected ) { $attempt_fallback = false; } elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) { $attempt_fallback = false; } elseif ( ! function_exists( 'mysql_connect' ) ) { $attempt_fallback = false; } if ( $attempt_fallback ) { $this->use_mysqli = false; return $this->db_connect( $allow_bail ); } } } else { if ( WP_DEBUG ) { $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); } else { $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); } } if ( ! $this->dbh && $allow_bail ) { wp_load_translations_early(); if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) { require_once WP_CONTENT_DIR . '/db-error.php'; die(); } $message = '

                ' . __( 'Error establishing a database connection' ) . "

                \n"; $message .= '

                ' . sprintf( __( 'This either means that the username and password information in your %1$s file is incorrect or that contact with the database server at %2$s could not be established. This could mean your host’s database server is down.' ), 'wp-config.php', '' . htmlspecialchars( $this->dbhost, ENT_QUOTES ) . '' ) . "

                \n"; $message .= "
                  \n"; $message .= '
                • ' . __( 'Are you sure you have the correct username and password?' ) . "
                • \n"; $message .= '
                • ' . __( 'Are you sure you have typed the correct hostname?' ) . "
                • \n"; $message .= '
                • ' . __( 'Are you sure the database server is running?' ) . "
                • \n"; $message .= "
                \n"; $message .= '

                ' . sprintf( __( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

                \n"; $this->bail( $message, 'db_connect_fail' ); return false; } elseif ( $this->dbh ) { if ( ! $this->has_connected ) { $this->init_charset(); } $this->has_connected = true; $this->set_charset( $this->dbh ); $this->ready = true; $this->set_sql_mode(); $this->select( $this->dbname, $this->dbh ); return true; } return false; } public function parse_db_host( $host ) { $port = null; $socket = null; $is_ipv6 = false; $socket_pos = strpos( $host, ':/' ); if ( false !== $socket_pos ) { $socket = substr( $host, $socket_pos + 1 ); $host = substr( $host, 0, $socket_pos ); } if ( substr_count( $host, ':' ) > 1 ) { $pattern = '#^(?:\[)?(?P[0-9a-fA-F:]+)(?:\]:(?P[\d]+))?#'; $is_ipv6 = true; } else { $pattern = '#^(?P[^:/]*)(?::(?P[\d]+))?#'; } $matches = array(); $result = preg_match( $pattern, $host, $matches ); if ( 1 !== $result ) { return false; } $host = ''; foreach ( array( 'host', 'port' ) as $component ) { if ( ! empty( $matches[ $component ] ) ) { $$component = $matches[ $component ]; } } return array( $host, $port, $socket, $is_ipv6 ); } public function check_connection( $allow_bail = true ) { if ( $this->use_mysqli ) { if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) { return true; } } else { if ( ! empty( $this->dbh ) && mysql_ping( $this->dbh ) ) { return true; } } $error_reporting = false; if ( WP_DEBUG ) { $error_reporting = error_reporting(); error_reporting( $error_reporting & ~E_WARNING ); } for ( $tries = 1; $tries <= $this->reconnect_retries; $tries++ ) { if ( $this->reconnect_retries === $tries && WP_DEBUG ) { error_reporting( $error_reporting ); } if ( $this->db_connect( false ) ) { if ( $error_reporting ) { error_reporting( $error_reporting ); } return true; } sleep( 1 ); } if ( did_action( 'template_redirect' ) ) { return false; } if ( ! $allow_bail ) { return false; } wp_load_translations_early(); $message = '

                ' . __( 'Error reconnecting to the database' ) . "

                \n"; $message .= '

                ' . sprintf( __( 'This means that the contact with the database server at %s was lost. This could mean your host’s database server is down.' ), '' . htmlspecialchars( $this->dbhost, ENT_QUOTES ) . '' ) . "

                \n"; $message .= "
                  \n"; $message .= '
                • ' . __( 'Are you sure the database server is running?' ) . "
                • \n"; $message .= '
                • ' . __( 'Are you sure the database server is not under particularly heavy load?' ) . "
                • \n"; $message .= "
                \n"; $message .= '

                ' . sprintf( __( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.' ), __( 'https://wordpress.org/support/forums/' ) ) . "

                \n"; $this->bail( $message, 'db_connect_fail' ); dead_db(); } public function query( $query ) { if ( ! $this->ready ) { $this->check_current_query = true; return false; } $query = apply_filters( 'query', $query ); if ( ! $query ) { $this->insert_id = 0; return false; } $this->flush(); $this->func_call = "\$db->query(\"$query\")"; if ( $this->check_current_query && ! $this->check_ascii( $query ) ) { $stripped_query = $this->strip_invalid_text_from_query( $query ); $this->flush(); if ( $stripped_query !== $query ) { $this->insert_id = 0; $this->last_query = $query; wp_load_translations_early(); $this->last_error = __( 'WordPress database error: Could not perform query because it contains invalid data.' ); return false; } } $this->check_current_query = true; $this->last_query = $query; $this->_do_query( $query ); $mysql_errno = 0; if ( ! empty( $this->dbh ) ) { if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $mysql_errno = mysqli_errno( $this->dbh ); } else { $mysql_errno = 2006; } } else { if ( is_resource( $this->dbh ) ) { $mysql_errno = mysql_errno( $this->dbh ); } else { $mysql_errno = 2006; } } } if ( empty( $this->dbh ) || 2006 === $mysql_errno ) { if ( $this->check_connection() ) { $this->_do_query( $query ); } else { $this->insert_id = 0; return false; } } if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $this->last_error = mysqli_error( $this->dbh ); } else { $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); } } else { if ( is_resource( $this->dbh ) ) { $this->last_error = mysql_error( $this->dbh ); } else { $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); } } if ( $this->last_error ) { if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { $this->insert_id = 0; } $this->print_error(); return false; } if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) { $return_val = $this->result; } elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) { if ( $this->use_mysqli ) { $this->rows_affected = mysqli_affected_rows( $this->dbh ); } else { $this->rows_affected = mysql_affected_rows( $this->dbh ); } if ( preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { if ( $this->use_mysqli ) { $this->insert_id = mysqli_insert_id( $this->dbh ); } else { $this->insert_id = mysql_insert_id( $this->dbh ); } } $return_val = $this->rows_affected; } else { $num_rows = 0; if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { while ( $row = mysqli_fetch_object( $this->result ) ) { $this->last_result[ $num_rows ] = $row; $num_rows++; } } elseif ( is_resource( $this->result ) ) { while ( $row = mysql_fetch_object( $this->result ) ) { $this->last_result[ $num_rows ] = $row; $num_rows++; } } $this->num_rows = $num_rows; $return_val = $num_rows; } return $return_val; } private function _do_query( $query ) { if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->timer_start(); } if ( ! empty( $this->dbh ) && $this->use_mysqli ) { $this->result = mysqli_query( $this->dbh, $query ); } elseif ( ! empty( $this->dbh ) ) { $this->result = mysql_query( $query, $this->dbh ); } $this->num_queries++; if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { $this->log_query( $query, $this->timer_stop(), $this->get_caller(), $this->time_start, array() ); } } public function log_query( $query, $query_time, $query_callstack, $query_start, $query_data ) { $query_data = apply_filters( 'log_query_custom_data', $query_data, $query, $query_time, $query_callstack, $query_start ); $this->queries[] = array( $query, $query_time, $query_callstack, $query_start, $query_data, ); } public function placeholder_escape() { static $placeholder; if ( ! $placeholder ) { $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; $salt = defined( 'AUTH_SALT' ) && AUTH_SALT ? AUTH_SALT : (string) rand(); $placeholder = '{' . hash_hmac( $algo, uniqid( $salt, true ), $salt ) . '}'; } if ( false === has_filter( 'query', array( $this, 'remove_placeholder_escape' ) ) ) { add_filter( 'query', array( $this, 'remove_placeholder_escape' ), 0 ); } return $placeholder; } public function add_placeholder_escape( $query ) { return str_replace( '%', $this->placeholder_escape(), $query ); } public function remove_placeholder_escape( $query ) { return str_replace( $this->placeholder_escape(), '%', $query ); } public function insert( $table, $data, $format = null ) { return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' ); } public function replace( $table, $data, $format = null ) { return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' ); } public function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) { $this->insert_id = 0; if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ), true ) ) { return false; } $data = $this->process_fields( $table, $data, $format ); if ( false === $data ) { return false; } $formats = array(); $values = array(); foreach ( $data as $value ) { if ( is_null( $value['value'] ) ) { $formats[] = 'NULL'; continue; } $formats[] = $value['format']; $values[] = $value['value']; } $fields = '`' . implode( '`, `', array_keys( $data ) ) . '`'; $formats = implode( ', ', $formats ); $sql = "$type INTO `$table` ($fields) VALUES ($formats)"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } public function update( $table, $data, $where, $format = null, $where_format = null ) { if ( ! is_array( $data ) || ! is_array( $where ) ) { return false; } $data = $this->process_fields( $table, $data, $format ); if ( false === $data ) { return false; } $where = $this->process_fields( $table, $where, $where_format ); if ( false === $where ) { return false; } $fields = array(); $conditions = array(); $values = array(); foreach ( $data as $field => $value ) { if ( is_null( $value['value'] ) ) { $fields[] = "`$field` = NULL"; continue; } $fields[] = "`$field` = " . $value['format']; $values[] = $value['value']; } foreach ( $where as $field => $value ) { if ( is_null( $value['value'] ) ) { $conditions[] = "`$field` IS NULL"; continue; } $conditions[] = "`$field` = " . $value['format']; $values[] = $value['value']; } $fields = implode( ', ', $fields ); $conditions = implode( ' AND ', $conditions ); $sql = "UPDATE `$table` SET $fields WHERE $conditions"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } public function delete( $table, $where, $where_format = null ) { if ( ! is_array( $where ) ) { return false; } $where = $this->process_fields( $table, $where, $where_format ); if ( false === $where ) { return false; } $conditions = array(); $values = array(); foreach ( $where as $field => $value ) { if ( is_null( $value['value'] ) ) { $conditions[] = "`$field` IS NULL"; continue; } $conditions[] = "`$field` = " . $value['format']; $values[] = $value['value']; } $conditions = implode( ' AND ', $conditions ); $sql = "DELETE FROM `$table` WHERE $conditions"; $this->check_current_query = false; return $this->query( $this->prepare( $sql, $values ) ); } protected function process_fields( $table, $data, $format ) { $data = $this->process_field_formats( $data, $format ); if ( false === $data ) { return false; } $data = $this->process_field_charsets( $data, $table ); if ( false === $data ) { return false; } $data = $this->process_field_lengths( $data, $table ); if ( false === $data ) { return false; } $converted_data = $this->strip_invalid_text( $data ); if ( $data !== $converted_data ) { $problem_fields = array(); foreach ( $data as $field => $value ) { if ( $value !== $converted_data[ $field ] ) { $problem_fields[] = $field; } } wp_load_translations_early(); if ( 1 === count( $problem_fields ) ) { $this->last_error = sprintf( __( 'WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.' ), reset( $problem_fields ) ); } else { $this->last_error = sprintf( __( 'WordPress database error: Processing the values for the following fields failed: %s. The supplied values may be too long or contain invalid data.' ), implode( ', ', $problem_fields ) ); } return false; } return $data; } protected function process_field_formats( $data, $format ) { $formats = (array) $format; $original_formats = $formats; foreach ( $data as $field => $value ) { $value = array( 'value' => $value, 'format' => '%s', ); if ( ! empty( $format ) ) { $value['format'] = array_shift( $formats ); if ( ! $value['format'] ) { $value['format'] = reset( $original_formats ); } } elseif ( isset( $this->field_types[ $field ] ) ) { $value['format'] = $this->field_types[ $field ]; } $data[ $field ] = $value; } return $data; } protected function process_field_charsets( $data, $table ) { foreach ( $data as $field => $value ) { if ( '%d' === $value['format'] || '%f' === $value['format'] ) { $value['charset'] = false; } else { $value['charset'] = $this->get_col_charset( $table, $field ); if ( is_wp_error( $value['charset'] ) ) { return false; } } $data[ $field ] = $value; } return $data; } protected function process_field_lengths( $data, $table ) { foreach ( $data as $field => $value ) { if ( '%d' === $value['format'] || '%f' === $value['format'] ) { $value['length'] = false; } else { $value['length'] = $this->get_col_length( $table, $field ); if ( is_wp_error( $value['length'] ) ) { return false; } } $data[ $field ] = $value; } return $data; } public function get_var( $query = null, $x = 0, $y = 0 ) { $this->func_call = "\$db->get_var(\"$query\", $x, $y)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } if ( ! empty( $this->last_result[ $y ] ) ) { $values = array_values( get_object_vars( $this->last_result[ $y ] ) ); } return ( isset( $values[ $x ] ) && '' !== $values[ $x ] ) ? $values[ $x ] : null; } public function get_row( $query = null, $output = OBJECT, $y = 0 ) { $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } else { return null; } if ( ! isset( $this->last_result[ $y ] ) ) { return null; } if ( OBJECT === $output ) { return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; } elseif ( ARRAY_A === $output ) { return $this->last_result[ $y ] ? get_object_vars( $this->last_result[ $y ] ) : null; } elseif ( ARRAY_N === $output ) { return $this->last_result[ $y ] ? array_values( get_object_vars( $this->last_result[ $y ] ) ) : null; } elseif ( OBJECT === strtoupper( $output ) ) { return $this->last_result[ $y ] ? $this->last_result[ $y ] : null; } else { $this->print_error( ' $db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N' ); } } public function get_col( $query = null, $x = 0 ) { if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } $new_array = array(); if ( $this->last_result ) { for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) { $new_array[ $i ] = $this->get_var( null, $x, $i ); } } return $new_array; } public function get_results( $query = null, $output = OBJECT ) { $this->func_call = "\$db->get_results(\"$query\", $output)"; if ( $query ) { if ( $this->check_current_query && $this->check_safe_collation( $query ) ) { $this->check_current_query = false; } $this->query( $query ); } else { return null; } $new_array = array(); if ( OBJECT === $output ) { return $this->last_result; } elseif ( OBJECT_K === $output ) { if ( $this->last_result ) { foreach ( $this->last_result as $row ) { $var_by_ref = get_object_vars( $row ); $key = array_shift( $var_by_ref ); if ( ! isset( $new_array[ $key ] ) ) { $new_array[ $key ] = $row; } } } return $new_array; } elseif ( ARRAY_A === $output || ARRAY_N === $output ) { if ( $this->last_result ) { foreach ( (array) $this->last_result as $row ) { if ( ARRAY_N === $output ) { $new_array[] = array_values( get_object_vars( $row ) ); } else { $new_array[] = get_object_vars( $row ); } } } return $new_array; } elseif ( strtoupper( $output ) === OBJECT ) { return $this->last_result; } return null; } protected function get_table_charset( $table ) { $tablekey = strtolower( $table ); $charset = apply_filters( 'pre_get_table_charset', null, $table ); if ( null !== $charset ) { return $charset; } if ( isset( $this->table_charset[ $tablekey ] ) ) { return $this->table_charset[ $tablekey ]; } $charsets = array(); $columns = array(); $table_parts = explode( '.', $table ); $table = '`' . implode( '`.`', $table_parts ) . '`'; $results = $this->get_results( "SHOW FULL COLUMNS FROM $table" ); if ( ! $results ) { return new WP_Error( 'wpdb_get_table_charset_failure', __( 'Could not retrieve table charset.' ) ); } foreach ( $results as $column ) { $columns[ strtolower( $column->Field ) ] = $column; } $this->col_meta[ $tablekey ] = $columns; foreach ( $columns as $column ) { if ( ! empty( $column->Collation ) ) { list( $charset ) = explode( '_', $column->Collation ); if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { $charset = 'utf8'; } $charsets[ strtolower( $charset ) ] = true; } list( $type ) = explode( '(', $column->Type ); if ( in_array( strtoupper( $type ), array( 'BINARY', 'VARBINARY', 'TINYBLOB', 'MEDIUMBLOB', 'BLOB', 'LONGBLOB' ), true ) ) { $this->table_charset[ $tablekey ] = 'binary'; return 'binary'; } } if ( isset( $charsets['utf8mb3'] ) ) { $charsets['utf8'] = true; unset( $charsets['utf8mb3'] ); } $count = count( $charsets ); if ( 1 === $count ) { $charset = key( $charsets ); } elseif ( 0 === $count ) { $charset = false; } else { unset( $charsets['latin1'] ); $count = count( $charsets ); if ( 1 === $count ) { $charset = key( $charsets ); } elseif ( 2 === $count && isset( $charsets['utf8'], $charsets['utf8mb4'] ) ) { $charset = 'utf8'; } else { $charset = 'ascii'; } } $this->table_charset[ $tablekey ] = $charset; return $charset; } public function get_col_charset( $table, $column ) { $tablekey = strtolower( $table ); $columnkey = strtolower( $column ); $charset = apply_filters( 'pre_get_col_charset', null, $table, $column ); if ( null !== $charset ) { return $charset; } if ( empty( $this->is_mysql ) ) { return false; } if ( empty( $this->table_charset[ $tablekey ] ) ) { $table_charset = $this->get_table_charset( $table ); if ( is_wp_error( $table_charset ) ) { return $table_charset; } } if ( empty( $this->col_meta[ $tablekey ] ) ) { return $this->table_charset[ $tablekey ]; } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) { return $this->table_charset[ $tablekey ]; } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ]->Collation ) ) { return false; } list( $charset ) = explode( '_', $this->col_meta[ $tablekey ][ $columnkey ]->Collation ); return $charset; } public function get_col_length( $table, $column ) { $tablekey = strtolower( $table ); $columnkey = strtolower( $column ); if ( empty( $this->is_mysql ) ) { return false; } if ( empty( $this->col_meta[ $tablekey ] ) ) { $table_charset = $this->get_table_charset( $table ); if ( is_wp_error( $table_charset ) ) { return $table_charset; } } if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) { return false; } $typeinfo = explode( '(', $this->col_meta[ $tablekey ][ $columnkey ]->Type ); $type = strtolower( $typeinfo[0] ); if ( ! empty( $typeinfo[1] ) ) { $length = trim( $typeinfo[1], ')' ); } else { $length = false; } switch ( $type ) { case 'char': case 'varchar': return array( 'type' => 'char', 'length' => (int) $length, ); case 'binary': case 'varbinary': return array( 'type' => 'byte', 'length' => (int) $length, ); case 'tinyblob': case 'tinytext': return array( 'type' => 'byte', 'length' => 255, ); case 'blob': case 'text': return array( 'type' => 'byte', 'length' => 65535, ); case 'mediumblob': case 'mediumtext': return array( 'type' => 'byte', 'length' => 16777215, ); case 'longblob': case 'longtext': return array( 'type' => 'byte', 'length' => 4294967295, ); default: return false; } } protected function check_ascii( $string ) { if ( function_exists( 'mb_check_encoding' ) ) { if ( mb_check_encoding( $string, 'ASCII' ) ) { return true; } } elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) { return true; } return false; } protected function check_safe_collation( $query ) { if ( $this->checking_collation ) { return true; } $query = ltrim( $query, "\r\n\t (" ); if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) { return true; } if ( $this->check_ascii( $query ) ) { return true; } $table = $this->get_table_from_query( $query ); if ( ! $table ) { return false; } $this->checking_collation = true; $collation = $this->get_table_charset( $table ); $this->checking_collation = false; if ( false === $collation || 'latin1' === $collation ) { return true; } $table = strtolower( $table ); if ( empty( $this->col_meta[ $table ] ) ) { return false; } foreach ( $this->col_meta[ $table ] as $col ) { if ( empty( $col->Collation ) ) { continue; } if ( ! in_array( $col->Collation, array( 'utf8_general_ci', 'utf8_bin', 'utf8mb4_general_ci', 'utf8mb4_bin' ), true ) ) { return false; } } return true; } protected function strip_invalid_text( $data ) { $db_check_string = false; foreach ( $data as &$value ) { $charset = $value['charset']; if ( is_array( $value['length'] ) ) { $length = $value['length']['length']; $truncate_by_byte_length = 'byte' === $value['length']['type']; } else { $length = false; $truncate_by_byte_length = false; } if ( false === $charset ) { continue; } if ( ! is_string( $value['value'] ) ) { continue; } $needs_validation = true; if ( 'latin1' === $charset || ( ! isset( $value['ascii'] ) && $this->check_ascii( $value['value'] ) ) ) { $truncate_by_byte_length = true; $needs_validation = false; } if ( $truncate_by_byte_length ) { mbstring_binary_safe_encoding(); if ( false !== $length && strlen( $value['value'] ) > $length ) { $value['value'] = substr( $value['value'], 0, $length ); } reset_mbstring_encoding(); if ( ! $needs_validation ) { continue; } } if ( ( 'utf8' === $charset || 'utf8mb3' === $charset || 'utf8mb4' === $charset ) && function_exists( 'mb_strlen' ) ) { $regex = '/ - ( - (?: [\x00-\x7F] # single-byte sequences 0xxxxxxx - | [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx - | \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2 - | [\xE1-\xEC][\x80-\xBF]{2} - | \xED[\x80-\x9F][\x80-\xBF] - | [\xEE-\xEF][\x80-\xBF]{2}'; if ( 'utf8mb4' === $charset ) { $regex .= ' - | \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3 - | [\xF1-\xF3][\x80-\xBF]{3} - | \xF4[\x80-\x8F][\x80-\xBF]{2} - '; } $regex .= '){1,40} # ...one or more times - ) - | . # anything else - /x'; $value['value'] = preg_replace( $regex, '$1', $value['value'] ); if ( false !== $length && mb_strlen( $value['value'], 'UTF-8' ) > $length ) { $value['value'] = mb_substr( $value['value'], 0, $length, 'UTF-8' ); } continue; } $value['db'] = true; $db_check_string = true; } unset( $value ); if ( $db_check_string ) { $queries = array(); foreach ( $data as $col => $value ) { if ( ! empty( $value['db'] ) ) { if ( isset( $value['length']['type'] ) && 'byte' === $value['length']['type'] ) { $charset = 'binary'; } else { $charset = $value['charset']; } if ( $this->charset ) { $connection_charset = $this->charset; } else { if ( $this->use_mysqli ) { $connection_charset = mysqli_character_set_name( $this->dbh ); } else { $connection_charset = mysql_client_encoding(); } } if ( is_array( $value['length'] ) ) { $length = sprintf( '%.0f', $value['length']['length'] ); $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), $length ) USING $connection_charset )", $value['value'] ); } elseif ( 'binary' !== $charset ) { $queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING $connection_charset )", $value['value'] ); } unset( $data[ $col ]['db'] ); } } $sql = array(); foreach ( $queries as $column => $query ) { if ( ! $query ) { continue; } $sql[] = $query . " AS x_$column"; } $this->check_current_query = false; $row = $this->get_row( 'SELECT ' . implode( ', ', $sql ), ARRAY_A ); if ( ! $row ) { return new WP_Error( 'wpdb_strip_invalid_text_failure', __( 'Could not strip invalid text.' ) ); } foreach ( array_keys( $data ) as $column ) { if ( isset( $row[ "x_$column" ] ) ) { $data[ $column ]['value'] = $row[ "x_$column" ]; } } } return $data; } protected function strip_invalid_text_from_query( $query ) { $trimmed_query = ltrim( $query, "\r\n\t (" ); if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) { return $query; } $table = $this->get_table_from_query( $query ); if ( $table ) { $charset = $this->get_table_charset( $table ); if ( is_wp_error( $charset ) ) { return $charset; } if ( 'binary' === $charset ) { return $query; } } else { $charset = $this->charset; } $data = array( 'value' => $query, 'charset' => $charset, 'ascii' => false, 'length' => false, ); $data = $this->strip_invalid_text( array( $data ) ); if ( is_wp_error( $data ) ) { return $data; } return $data[0]['value']; } public function strip_invalid_text_for_column( $table, $column, $value ) { if ( ! is_string( $value ) ) { return $value; } $charset = $this->get_col_charset( $table, $column ); if ( ! $charset ) { return $value; } elseif ( is_wp_error( $charset ) ) { return $charset; } $data = array( $column => array( 'value' => $value, 'charset' => $charset, 'length' => $this->get_col_length( $table, $column ), ), ); $data = $this->strip_invalid_text( $data ); if ( is_wp_error( $data ) ) { return $data; } return $data[ $column ]['value']; } protected function get_table_from_query( $query ) { $query = rtrim( $query, ';/-#' ); $query = ltrim( $query, "\r\n\t (" ); $query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query ); if ( preg_match( '/^\s*(?:' . 'SELECT.*?\s+FROM' . '|INSERT(?:\s+LOW_PRIORITY|\s+DELAYED|\s+HIGH_PRIORITY)?(?:\s+IGNORE)?(?:\s+INTO)?' . '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?' . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?' . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:.+?FROM)?' . ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } if ( preg_match( '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES).+WHERE\s+Name\s*=\s*("|\')((?:[0-9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)\\1/is', $query, $maybe ) ) { return $maybe[2]; } if ( preg_match( '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES)\s+(?:WHERE\s+Name\s+)?LIKE\s*("|\')((?:[\\\\0-9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)%?\\1/is', $query, $maybe ) ) { return str_replace( '\\_', '_', $maybe[2] ); } if ( preg_match( '/^\s*(?:' . '(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM' . '|DESCRIBE|DESC|EXPLAIN|HANDLER' . '|(?:LOCK|UNLOCK)\s+TABLE(?:S)?' . '|(?:RENAME|OPTIMIZE|BACKUP|RESTORE|CHECK|CHECKSUM|ANALYZE|REPAIR).*\s+TABLE' . '|TRUNCATE(?:\s+TABLE)?' . '|CREATE(?:\s+TEMPORARY)?\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?' . '|ALTER(?:\s+IGNORE)?\s+TABLE' . '|DROP\s+TABLE(?:\s+IF\s+EXISTS)?' . '|CREATE(?:\s+\w+)?\s+INDEX.*\s+ON' . '|DROP\s+INDEX.*\s+ON' . '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE' . '|(?:GRANT|REVOKE).*ON\s+TABLE' . '|SHOW\s+(?:.*FROM|.*TABLE)' . ')\s+\(*\s*((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } return false; } protected function load_col_info() { if ( $this->col_info ) { return; } if ( $this->use_mysqli ) { $num_fields = mysqli_num_fields( $this->result ); for ( $i = 0; $i < $num_fields; $i++ ) { $this->col_info[ $i ] = mysqli_fetch_field( $this->result ); } } else { $num_fields = mysql_num_fields( $this->result ); for ( $i = 0; $i < $num_fields; $i++ ) { $this->col_info[ $i ] = mysql_fetch_field( $this->result, $i ); } } } public function get_col_info( $info_type = 'name', $col_offset = -1 ) { $this->load_col_info(); if ( $this->col_info ) { if ( -1 === $col_offset ) { $i = 0; $new_array = array(); foreach ( (array) $this->col_info as $col ) { $new_array[ $i ] = $col->{$info_type}; $i++; } return $new_array; } else { return $this->col_info[ $col_offset ]->{$info_type}; } } } public function timer_start() { $this->time_start = microtime( true ); return true; } public function timer_stop() { return ( microtime( true ) - $this->time_start ); } public function bail( $message, $error_code = '500' ) { if ( $this->show_errors ) { $error = ''; if ( $this->use_mysqli ) { if ( $this->dbh instanceof mysqli ) { $error = mysqli_error( $this->dbh ); } elseif ( mysqli_connect_errno() ) { $error = mysqli_connect_error(); } } else { if ( is_resource( $this->dbh ) ) { $error = mysql_error( $this->dbh ); } else { $error = mysql_error(); } } if ( $error ) { $message = '

                ' . $error . "

                \n" . $message; } wp_die( $message ); } else { if ( class_exists( 'WP_Error', false ) ) { $this->error = new WP_Error( $error_code, $message ); } else { $this->error = $message; } return false; } } public function close() { if ( ! $this->dbh ) { return false; } if ( $this->use_mysqli ) { $closed = mysqli_close( $this->dbh ); } else { $closed = mysql_close( $this->dbh ); } if ( $closed ) { $this->dbh = null; $this->ready = false; $this->has_connected = false; } return $closed; } public function check_database_version() { global $wp_version, $required_mysql_version; if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) { return new WP_Error( 'database_version', sprintf( __( 'Error: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) ); } } public function supports_collation() { _deprecated_function( __FUNCTION__, '3.5.0', 'wpdb::has_cap( \'collation\' )' ); return $this->has_cap( 'collation' ); } public function get_charset_collate() { $charset_collate = ''; if ( ! empty( $this->charset ) ) { $charset_collate = "DEFAULT CHARACTER SET $this->charset"; } if ( ! empty( $this->collate ) ) { $charset_collate .= " COLLATE $this->collate"; } return $charset_collate; } public function has_cap( $db_cap ) { $version = $this->db_version(); switch ( strtolower( $db_cap ) ) { case 'collation': case 'group_concat': case 'subqueries': return version_compare( $version, '4.1', '>=' ); case 'set_charset': return version_compare( $version, '5.0.7', '>=' ); case 'utf8mb4': if ( version_compare( $version, '5.5.3', '<' ) ) { return false; } if ( $this->use_mysqli ) { $client_version = mysqli_get_client_info(); } else { $client_version = mysql_get_client_info(); } if ( false !== strpos( $client_version, 'mysqlnd' ) ) { $client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version ); return version_compare( $client_version, '5.0.9', '>=' ); } else { return version_compare( $client_version, '5.5.3', '>=' ); } case 'utf8mb4_520': return version_compare( $version, '5.6', '>=' ); } return false; } public function get_caller() { return wp_debug_backtrace_summary( __CLASS__ ); } public function db_version() { return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() ); } public function db_server_info() { if ( $this->use_mysqli ) { $server_info = mysqli_get_server_info( $this->dbh ); } else { $server_info = mysql_get_server_info( $this->dbh ); } return $server_info; } } ID, $credentials['remember'], $secure_cookie ); do_action( 'wp_login', $user->user_login, $user ); return $user; } function wp_authenticate_username_password( $user, $username, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $username ) || empty( $password ) ) { if ( is_wp_error( $user ) ) { return $user; } $error = new WP_Error(); if ( empty( $username ) ) { $error->add( 'empty_username', __( 'Error: The username field is empty.' ) ); } if ( empty( $password ) ) { $error->add( 'empty_password', __( 'Error: The password field is empty.' ) ); } return $error; } $user = get_user_by( 'login', $username ); if ( ! $user ) { return new WP_Error( 'invalid_username', sprintf( __( 'Error: The username %s is not registered on this site. If you are unsure of your username, try your email address instead.' ), $username ) ); } $user = apply_filters( 'wp_authenticate_user', $user, $password ); if ( is_wp_error( $user ) ) { return $user; } if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { return new WP_Error( 'incorrect_password', sprintf( __( 'Error: The password you entered for the username %s is incorrect.' ), '' . $username . '' ) . ' ' . __( 'Lost your password?' ) . '' ); } return $user; } function wp_authenticate_email_password( $user, $email, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $email ) || empty( $password ) ) { if ( is_wp_error( $user ) ) { return $user; } $error = new WP_Error(); if ( empty( $email ) ) { $error->add( 'empty_username', __( 'Error: The email field is empty.' ) ); } if ( empty( $password ) ) { $error->add( 'empty_password', __( 'Error: The password field is empty.' ) ); } return $error; } if ( ! is_email( $email ) ) { return $user; } $user = get_user_by( 'email', $email ); if ( ! $user ) { return new WP_Error( 'invalid_email', __( 'Unknown email address. Check again or try your username.' ) ); } $user = apply_filters( 'wp_authenticate_user', $user, $password ); if ( is_wp_error( $user ) ) { return $user; } if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { return new WP_Error( 'incorrect_password', sprintf( __( 'Error: The password you entered for the email address %s is incorrect.' ), '' . $email . '' ) . ' ' . __( 'Lost your password?' ) . '' ); } return $user; } function wp_authenticate_cookie( $user, $username, $password ) { if ( $user instanceof WP_User ) { return $user; } if ( empty( $username ) && empty( $password ) ) { $user_id = wp_validate_auth_cookie(); if ( $user_id ) { return new WP_User( $user_id ); } global $auth_secure_cookie; if ( $auth_secure_cookie ) { $auth_cookie = SECURE_AUTH_COOKIE; } else { $auth_cookie = AUTH_COOKIE; } if ( ! empty( $_COOKIE[ $auth_cookie ] ) ) { return new WP_Error( 'expired_session', __( 'Please log in again.' ) ); } } return $user; } function wp_authenticate_application_password( $input_user, $username, $password ) { if ( $input_user instanceof WP_User ) { return $input_user; } if ( ! WP_Application_Passwords::is_in_use() ) { return $input_user; } $is_api_request = ( ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ); $is_api_request = apply_filters( 'application_password_is_api_request', $is_api_request ); if ( ! $is_api_request ) { return $input_user; } $error = null; $user = get_user_by( 'login', $username ); if ( ! $user && is_email( $username ) ) { $user = get_user_by( 'email', $username ); } if ( ! $user ) { if ( is_email( $username ) ) { $error = new WP_Error( 'invalid_email', __( 'Error: Unknown email address. Check again or try your username.' ) ); } else { $error = new WP_Error( 'invalid_username', __( 'Error: Unknown username. Check again or try your email address.' ) ); } } elseif ( ! wp_is_application_passwords_available() ) { $error = new WP_Error( 'application_passwords_disabled', __( 'Application passwords are not available.' ) ); } elseif ( ! wp_is_application_passwords_available_for_user( $user ) ) { $error = new WP_Error( 'application_passwords_disabled_for_user', __( 'Application passwords are not available for your account. Please contact the site administrator for assistance.' ) ); } if ( $error ) { do_action( 'application_password_failed_authentication', $error ); return $error; } $password = preg_replace( '/[^a-z\d]/i', '', $password ); $hashed_passwords = WP_Application_Passwords::get_user_application_passwords( $user->ID ); foreach ( $hashed_passwords as $key => $item ) { if ( ! wp_check_password( $password, $item['password'], $user->ID ) ) { continue; } $error = new WP_Error(); do_action( 'wp_authenticate_application_password_errors', $error, $user, $item, $password ); if ( is_wp_error( $error ) && $error->has_errors() ) { do_action( 'application_password_failed_authentication', $error ); return $error; } WP_Application_Passwords::record_application_password_usage( $user->ID, $item['uuid'] ); do_action( 'application_password_did_authenticate', $user, $item ); return $user; } $error = new WP_Error( 'incorrect_password', __( 'The provided password is an invalid application password.' ) ); do_action( 'application_password_failed_authentication', $error ); return $error; } function wp_validate_application_password( $input_user ) { if ( ! empty( $input_user ) ) { return $input_user; } if ( ! wp_is_application_passwords_available() ) { return $input_user; } if ( ! isset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) { return $input_user; } $authenticated = wp_authenticate_application_password( null, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ); if ( $authenticated instanceof WP_User ) { return $authenticated->ID; } return $input_user; } function wp_authenticate_spam_check( $user ) { if ( $user instanceof WP_User && is_multisite() ) { $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user ); if ( $spammed ) { return new WP_Error( 'spammer_account', __( 'Error: Your account has been marked as a spammer.' ) ); } } return $user; } function wp_validate_logged_in_cookie( $user_id ) { if ( $user_id ) { return $user_id; } if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { return false; } return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' ); } function count_user_posts( $userid, $post_type = 'post', $public_only = false ) { global $wpdb; $where = get_posts_by_author_sql( $post_type, true, $userid, $public_only ); $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only ); } function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) { global $wpdb; $count = array(); if ( empty( $users ) || ! is_array( $users ) ) { return $count; } $userlist = implode( ',', array_map( 'absint', $users ) ); $where = get_posts_by_author_sql( $post_type, true, null, $public_only ); $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); foreach ( $result as $row ) { $count[ $row[0] ] = $row[1]; } foreach ( $users as $id ) { if ( ! isset( $count[ $id ] ) ) { $count[ $id ] = 0; } } return $count; } function get_current_user_id() { if ( ! function_exists( 'wp_get_current_user' ) ) { return 0; } $user = wp_get_current_user(); return ( isset( $user->ID ) ? (int) $user->ID : 0 ); } function get_user_option( $option, $user = 0, $deprecated = '' ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } if ( empty( $user ) ) { $user = get_current_user_id(); } $user = get_userdata( $user ); if ( ! $user ) { return false; } $prefix = $wpdb->get_blog_prefix(); if ( $user->has_prop( $prefix . $option ) ) { $result = $user->get( $prefix . $option ); } elseif ( $user->has_prop( $option ) ) { $result = $user->get( $option ); } else { $result = false; } return apply_filters( "get_user_option_{$option}", $result, $option, $user ); } function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { global $wpdb; if ( ! $global ) { $option_name = $wpdb->get_blog_prefix() . $option_name; } return update_user_meta( $user_id, $option_name, $newvalue ); } function delete_user_option( $user_id, $option_name, $global = false ) { global $wpdb; if ( ! $global ) { $option_name = $wpdb->get_blog_prefix() . $option_name; } return delete_user_meta( $user_id, $option_name ); } function get_users( $args = array() ) { $args = wp_parse_args( $args ); $args['count_total'] = false; $user_search = new WP_User_Query( $args ); return (array) $user_search->get_results(); } function wp_list_users( $args = array() ) { $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'number' => '', 'exclude_admin' => true, 'show_fullname' => false, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'exclude' => '', 'include' => '', ); $args = wp_parse_args( $args, $defaults ); $return = ''; $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); $query_args['fields'] = 'ids'; $users = get_users( $query_args ); foreach ( $users as $user_id ) { $user = get_userdata( $user_id ); if ( $args['exclude_admin'] && 'admin' === $user->display_name ) { continue; } if ( $args['show_fullname'] && '' !== $user->first_name && '' !== $user->last_name ) { $name = "$user->first_name $user->last_name"; } else { $name = $user->display_name; } if ( ! $args['html'] ) { $return .= $name . ', '; continue; } if ( 'list' === $args['style'] ) { $return .= '
              • '; } $row = $name; if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { $row .= ' '; if ( empty( $args['feed_image'] ) ) { $row .= '('; } $row .= ''; } else { $row .= $name; } $row .= ''; if ( empty( $args['feed_image'] ) ) { $row .= ')'; } } $return .= $row; $return .= ( 'list' === $args['style'] ) ? '
              • ' : ', '; } $return = rtrim( $return, ', ' ); if ( ! $args['echo'] ) { return $return; } echo $return; } function get_blogs_of_user( $user_id, $all = false ) { global $wpdb; $user_id = (int) $user_id; if ( empty( $user_id ) ) { return array(); } $sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all ); if ( null !== $sites ) { return $sites; } $keys = get_user_meta( $user_id ); if ( empty( $keys ) ) { return array(); } if ( ! is_multisite() ) { $site_id = get_current_blog_id(); $sites = array( $site_id => new stdClass ); $sites[ $site_id ]->userblog_id = $site_id; $sites[ $site_id ]->blogname = get_option( 'blogname' ); $sites[ $site_id ]->domain = ''; $sites[ $site_id ]->path = ''; $sites[ $site_id ]->site_id = 1; $sites[ $site_id ]->siteurl = get_option( 'siteurl' ); $sites[ $site_id ]->archived = 0; $sites[ $site_id ]->spam = 0; $sites[ $site_id ]->deleted = 0; return $sites; } $site_ids = array(); if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) { $site_ids[] = 1; unset( $keys[ $wpdb->base_prefix . 'capabilities' ] ); } $keys = array_keys( $keys ); foreach ( $keys as $key ) { if ( 'capabilities' !== substr( $key, -12 ) ) { continue; } if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) ) { continue; } $site_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key ); if ( ! is_numeric( $site_id ) ) { continue; } $site_ids[] = (int) $site_id; } $sites = array(); if ( ! empty( $site_ids ) ) { $args = array( 'number' => '', 'site__in' => $site_ids, 'update_site_meta_cache' => false, ); if ( ! $all ) { $args['archived'] = 0; $args['spam'] = 0; $args['deleted'] = 0; } $_sites = get_sites( $args ); foreach ( $_sites as $site ) { $sites[ $site->id ] = (object) array( 'userblog_id' => $site->id, 'blogname' => $site->blogname, 'domain' => $site->domain, 'path' => $site->path, 'site_id' => $site->network_id, 'siteurl' => $site->siteurl, 'archived' => $site->archived, 'mature' => $site->mature, 'spam' => $site->spam, 'deleted' => $site->deleted, ); } } return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all ); } function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) { global $wpdb; $user_id = (int) $user_id; $blog_id = (int) $blog_id; if ( empty( $user_id ) ) { $user_id = get_current_user_id(); } if ( empty( $user_id ) ) { return false; } else { $user = get_userdata( $user_id ); if ( ! $user instanceof WP_User ) { return false; } } if ( ! is_multisite() ) { return true; } if ( empty( $blog_id ) ) { $blog_id = get_current_blog_id(); } $blog = get_site( $blog_id ); if ( ! $blog || ! isset( $blog->domain ) || $blog->archived || $blog->spam || $blog->deleted ) { return false; } $keys = get_user_meta( $user_id ); if ( empty( $keys ) ) { return false; } $base_capabilities_key = $wpdb->base_prefix . 'capabilities'; $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities'; if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) { return true; } if ( isset( $keys[ $site_capabilities_key ] ) ) { return true; } return false; } function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'user', $user_id, $meta_key, $meta_value, $unique ); } function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'user', $user_id, $meta_key, $meta_value ); } function get_user_meta( $user_id, $key = '', $single = false ) { return get_metadata( 'user', $user_id, $key, $single ); } function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'user', $user_id, $meta_key, $meta_value, $prev_value ); } function count_users( $strategy = 'time', $site_id = null ) { global $wpdb; if ( ! $site_id ) { $site_id = get_current_blog_id(); } $pre = apply_filters( 'pre_count_users', null, $strategy, $site_id ); if ( null !== $pre ) { return $pre; } $blog_prefix = $wpdb->get_blog_prefix( $site_id ); $result = array(); if ( 'time' === $strategy ) { if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $avail_roles = wp_roles()->get_names(); restore_current_blog(); } else { $avail_roles = wp_roles()->get_names(); } $select_count = array(); foreach ( $avail_roles as $this_role => $name ) { $select_count[] = $wpdb->prepare( 'COUNT(NULLIF(`meta_value` LIKE %s, false))', '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%' ); } $select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))"; $select_count = implode( ', ', $select_count ); $row = $wpdb->get_row( " - SELECT {$select_count}, COUNT(*) - FROM {$wpdb->usermeta} - INNER JOIN {$wpdb->users} ON user_id = ID - WHERE meta_key = '{$blog_prefix}capabilities' - ", ARRAY_N ); $col = 0; $role_counts = array(); foreach ( $avail_roles as $this_role => $name ) { $count = (int) $row[ $col++ ]; if ( $count > 0 ) { $role_counts[ $this_role ] = $count; } } $role_counts['none'] = (int) $row[ $col++ ]; $total_users = (int) $row[ $col ]; $result['total_users'] = $total_users; $result['avail_roles'] =& $role_counts; } else { $avail_roles = array( 'none' => 0, ); $users_of_blog = $wpdb->get_col( " - SELECT meta_value - FROM {$wpdb->usermeta} - INNER JOIN {$wpdb->users} ON user_id = ID - WHERE meta_key = '{$blog_prefix}capabilities' - " ); foreach ( $users_of_blog as $caps_meta ) { $b_roles = maybe_unserialize( $caps_meta ); if ( ! is_array( $b_roles ) ) { continue; } if ( empty( $b_roles ) ) { $avail_roles['none']++; } foreach ( $b_roles as $b_role => $val ) { if ( isset( $avail_roles[ $b_role ] ) ) { $avail_roles[ $b_role ]++; } else { $avail_roles[ $b_role ] = 1; } } } $result['total_users'] = count( $users_of_blog ); $result['avail_roles'] =& $avail_roles; } return $result; } function get_user_count( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } return (int) get_network_option( $network_id, 'user_count', -1 ); } function wp_maybe_update_user_counts( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $is_small_network = ! wp_is_large_user_count( $network_id ); if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) { return false; } return wp_update_user_counts( $network_id ); } function wp_update_user_counts( $network_id = null ) { global $wpdb; if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $query = "SELECT COUNT(ID) as c FROM $wpdb->users"; if ( is_multisite() ) { $query .= " WHERE spam = '0' AND deleted = '0'"; } $count = $wpdb->get_var( $query ); return update_network_option( $network_id, 'user_count', $count ); } function wp_schedule_update_user_counts() { if ( ! is_main_site() ) { return; } if ( ! wp_next_scheduled( 'wp_update_user_counts' ) && ! wp_installing() ) { wp_schedule_event( time(), 'twicedaily', 'wp_update_user_counts' ); } } function wp_is_large_user_count( $network_id = null ) { if ( ! is_multisite() && null !== $network_id ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Unable to pass %s if not using multisite.' ), '$network_id' ), '6.0.0' ); } $count = get_user_count( $network_id ); return apply_filters( 'wp_is_large_user_count', $count > 10000, $count, $network_id ); } function setup_userdata( $for_user_id = 0 ) { global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity; if ( ! $for_user_id ) { $for_user_id = get_current_user_id(); } $user = get_userdata( $for_user_id ); if ( ! $user ) { $user_ID = 0; $user_level = 0; $userdata = null; $user_login = ''; $user_email = ''; $user_url = ''; $user_identity = ''; return; } $user_ID = (int) $user->ID; $user_level = (int) $user->user_level; $userdata = $user; $user_login = $user->user_login; $user_email = $user->user_email; $user_url = $user->user_url; $user_identity = $user->display_name; } function wp_dropdown_users( $args = '' ) { $defaults = array( 'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', 'orderby' => 'display_name', 'order' => 'ASC', 'include' => '', 'exclude' => '', 'multi' => 0, 'show' => 'display_name', 'echo' => 1, 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 'blog_id' => get_current_blog_id(), 'who' => '', 'include_selected' => false, 'option_none_value' => -1, 'role' => '', 'role__in' => array(), 'role__not_in' => array(), 'capability' => '', 'capability__in' => array(), 'capability__not_in' => array(), ); $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; $parsed_args = wp_parse_args( $args, $defaults ); $query_args = wp_array_slice_assoc( $parsed_args, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in', 'capability', 'capability__in', 'capability__not_in', ) ); $fields = array( 'ID', 'user_login' ); $show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name'; if ( 'display_name_with_login' === $show ) { $fields[] = 'display_name'; } else { $fields[] = $show; } $query_args['fields'] = $fields; $show_option_all = $parsed_args['show_option_all']; $show_option_none = $parsed_args['show_option_none']; $option_none_value = $parsed_args['option_none_value']; $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args ); $users = get_users( $query_args ); $output = ''; if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) { $name = esc_attr( $parsed_args['name'] ); if ( $parsed_args['multi'] && ! $parsed_args['id'] ) { $id = ''; } else { $id = $parsed_args['id'] ? " id='" . esc_attr( $parsed_args['id'] ) . "'" : " id='$name'"; } $output = "'; } $html = apply_filters( 'wp_dropdown_users', $output ); if ( $parsed_args['echo'] ) { echo $html; } return $html; } function sanitize_user_field( $field, $value, $user_id, $context ) { $int_fields = array( 'ID' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } if ( 'raw' === $context ) { return $value; } if ( ! is_string( $value ) && ! is_numeric( $value ) ) { return $value; } $prefixed = false !== strpos( $field, 'user_' ); if ( 'edit' === $context ) { if ( $prefixed ) { $value = apply_filters( "edit_{$field}", $value, $user_id ); } else { $value = apply_filters( "edit_user_{$field}", $value, $user_id ); } if ( 'description' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { if ( $prefixed ) { $value = apply_filters( "pre_{$field}", $value ); } else { $value = apply_filters( "pre_user_{$field}", $value ); } } else { if ( $prefixed ) { $value = apply_filters( "{$field}", $value, $user_id, $context ); } else { $value = apply_filters( "user_{$field}", $value, $user_id, $context ); } } if ( 'user_url' === $field ) { $value = esc_url( $value ); } if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function update_user_caches( $user ) { if ( $user instanceof WP_User ) { if ( ! $user->exists() ) { return false; } $user = $user->data; } wp_cache_add( $user->ID, $user, 'users' ); wp_cache_add( $user->user_login, $user->ID, 'userlogins' ); wp_cache_add( $user->user_email, $user->ID, 'useremail' ); wp_cache_add( $user->user_nicename, $user->ID, 'userslugs' ); } function clean_user_cache( $user ) { global $current_user; if ( is_numeric( $user ) ) { $user = new WP_User( $user ); } if ( ! $user->exists() ) { return; } wp_cache_delete( $user->ID, 'users' ); wp_cache_delete( $user->user_login, 'userlogins' ); wp_cache_delete( $user->user_email, 'useremail' ); wp_cache_delete( $user->user_nicename, 'userslugs' ); do_action( 'clean_user_cache', $user->ID, $user ); if ( get_current_user_id() === (int) $user->ID ) { $user_id = (int) $user->ID; $current_user = null; wp_set_current_user( $user_id, '' ); } } function username_exists( $username ) { $user = get_user_by( 'login', $username ); if ( $user ) { $user_id = $user->ID; } else { $user_id = false; } return apply_filters( 'username_exists', $user_id, $username ); } function email_exists( $email ) { $user = get_user_by( 'email', $email ); if ( $user ) { $user_id = $user->ID; } else { $user_id = false; } return apply_filters( 'email_exists', $user_id, $email ); } function validate_username( $username ) { $sanitized = sanitize_user( $username, true ); $valid = ( $sanitized == $username && ! empty( $sanitized ) ); return apply_filters( 'validate_username', $valid, $username ); } function wp_insert_user( $userdata ) { global $wpdb; if ( $userdata instanceof stdClass ) { $userdata = get_object_vars( $userdata ); } elseif ( $userdata instanceof WP_User ) { $userdata = $userdata->to_array(); } if ( ! empty( $userdata['ID'] ) ) { $user_id = (int) $userdata['ID']; $update = true; $old_user_data = get_userdata( $user_id ); if ( ! $old_user_data ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass; } else { $update = false; $user_pass = wp_hash_password( $userdata['user_pass'] ); } $sanitized_user_login = sanitize_user( $userdata['user_login'], true ); $pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login ); $user_login = trim( $pre_user_login ); if ( empty( $user_login ) ) { return new WP_Error( 'empty_user_login', __( 'Cannot create a user with an empty login name.' ) ); } elseif ( mb_strlen( $user_login ) > 60 ) { return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) ); } if ( ! $update && username_exists( $user_login ) ) { return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) ); } $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) { return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) ); } if ( ! empty( $userdata['user_nicename'] ) ) { $user_nicename = sanitize_user( $userdata['user_nicename'], true ); } else { $user_nicename = mb_substr( $user_login, 0, 50 ); } $user_nicename = sanitize_title( $user_nicename ); $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename ); if ( mb_strlen( $user_nicename ) > 50 ) { return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) ); } $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login ) ); if ( $user_nicename_check ) { $suffix = 2; while ( $user_nicename_check ) { $base_length = 49 - mb_strlen( $suffix ); $alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix"; $user_nicename_check = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login ) ); $suffix++; } $user_nicename = $alt_user_nicename; } $raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email']; $user_email = apply_filters( 'pre_user_email', $raw_user_email ); if ( ( ! $update || ( ! empty( $old_user_data ) && 0 !== strcasecmp( $user_email, $old_user_data->user_email ) ) ) && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email ) ) { return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) ); } $raw_user_url = empty( $userdata['user_url'] ) ? '' : $userdata['user_url']; $user_url = apply_filters( 'pre_user_url', $raw_user_url ); if ( mb_strlen( $user_url ) > 100 ) { return new WP_Error( 'user_url_too_long', __( 'User URL may not be longer than 100 characters.' ) ); } $user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered']; $user_activation_key = empty( $userdata['user_activation_key'] ) ? '' : $userdata['user_activation_key']; if ( ! empty( $userdata['spam'] ) && ! is_multisite() ) { return new WP_Error( 'no_spam', __( 'Sorry, marking a user as spam is only supported on Multisite.' ) ); } $spam = empty( $userdata['spam'] ) ? 0 : (bool) $userdata['spam']; $meta = array(); $nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname']; $meta['nickname'] = apply_filters( 'pre_user_nickname', $nickname ); $first_name = empty( $userdata['first_name'] ) ? '' : $userdata['first_name']; $meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name ); $last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name']; $meta['last_name'] = apply_filters( 'pre_user_last_name', $last_name ); if ( empty( $userdata['display_name'] ) ) { if ( $update ) { $display_name = $user_login; } elseif ( $meta['first_name'] && $meta['last_name'] ) { $display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] ); } elseif ( $meta['first_name'] ) { $display_name = $meta['first_name']; } elseif ( $meta['last_name'] ) { $display_name = $meta['last_name']; } else { $display_name = $user_login; } } else { $display_name = $userdata['display_name']; } $display_name = apply_filters( 'pre_user_display_name', $display_name ); $description = empty( $userdata['description'] ) ? '' : $userdata['description']; $meta['description'] = apply_filters( 'pre_user_description', $description ); $meta['rich_editing'] = empty( $userdata['rich_editing'] ) ? 'true' : $userdata['rich_editing']; $meta['syntax_highlighting'] = empty( $userdata['syntax_highlighting'] ) ? 'true' : $userdata['syntax_highlighting']; $meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true'; $admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color']; $meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color ); $meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : (bool) $userdata['use_ssl']; $meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front']; $meta['locale'] = isset( $userdata['locale'] ) ? $userdata['locale'] : ''; $compacted = compact( 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'display_name' ); $data = wp_unslash( $compacted ); if ( ! $update ) { $data = $data + compact( 'user_login' ); } if ( is_multisite() ) { $data = $data + compact( 'spam' ); } $data = apply_filters( 'wp_pre_insert_user_data', $data, $update, ( $update ? $user_id : null ), $userdata ); if ( empty( $data ) || ! is_array( $data ) ) { return new WP_Error( 'empty_data', __( 'Not enough data to create this user.' ) ); } if ( $update ) { if ( $user_email !== $old_user_data->user_email || $user_pass !== $old_user_data->user_pass ) { $data['user_activation_key'] = ''; } $wpdb->update( $wpdb->users, $data, array( 'ID' => $user_id ) ); } else { $wpdb->insert( $wpdb->users, $data ); $user_id = (int) $wpdb->insert_id; } $user = new WP_User( $user_id ); $meta = apply_filters( 'insert_user_meta', $meta, $user, $update, $userdata ); $custom_meta = array(); if ( array_key_exists( 'meta_input', $userdata ) && is_array( $userdata['meta_input'] ) && ! empty( $userdata['meta_input'] ) ) { $custom_meta = $userdata['meta_input']; } $custom_meta = apply_filters( 'insert_custom_user_meta', $custom_meta, $user, $update, $userdata ); $meta = array_merge( $meta, $custom_meta ); foreach ( $meta as $key => $value ) { update_user_meta( $user_id, $key, $value ); } foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) { if ( isset( $userdata[ $key ] ) ) { update_user_meta( $user_id, $key, $userdata[ $key ] ); } } if ( isset( $userdata['role'] ) ) { $user->set_role( $userdata['role'] ); } elseif ( ! $update ) { $user->set_role( get_option( 'default_role' ) ); } clean_user_cache( $user_id ); if ( $update ) { do_action( 'profile_update', $user_id, $old_user_data, $userdata ); if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) { if ( 1 == $userdata['spam'] ) { do_action( 'make_spam_user', $user_id ); } else { do_action( 'make_ham_user', $user_id ); } } } else { do_action( 'user_register', $user_id, $userdata ); } return $user_id; } function wp_update_user( $userdata ) { if ( $userdata instanceof stdClass ) { $userdata = get_object_vars( $userdata ); } elseif ( $userdata instanceof WP_User ) { $userdata = $userdata->to_array(); } $user_id = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0; if ( ! $user_id ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user_obj = get_userdata( $user_id ); if ( ! $user_obj ) { return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); } $user = $user_obj->to_array(); foreach ( _get_additional_user_keys( $user_obj ) as $key ) { $user[ $key ] = get_user_meta( $user_id, $key, true ); } $user = add_magic_quotes( $user ); if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) { $plaintext_pass = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] ); $send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata ); } if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) { $send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata ); } clean_user_cache( $user_obj ); $userdata = array_merge( $user, $userdata ); $user_id = wp_insert_user( $userdata ); if ( is_wp_error( $user_id ) ) { return $user_id; } $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $switched_locale = false; if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { $switched_locale = switch_to_locale( get_user_locale( $user_id ) ); } if ( ! empty( $send_password_change_email ) ) { $pass_change_text = __( 'Hi ###USERNAME###, - -This notice confirms that your password was changed on ###SITENAME###. - -If you did not change your password, please contact the Site Administrator at -###ADMIN_EMAIL### - -This email has been sent to ###EMAIL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $pass_change_email = array( 'to' => $user['user_email'], 'subject' => __( '[%s] Password Changed' ), 'message' => $pass_change_text, 'headers' => '', ); $pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata ); $pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] ); $pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] ); wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] ); } if ( ! empty( $send_email_change_email ) ) { $email_change_text = __( 'Hi ###USERNAME###, - -This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###. - -If you did not change your email, please contact the Site Administrator at -###ADMIN_EMAIL### - -This email has been sent to ###EMAIL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $email_change_email = array( 'to' => $user['user_email'], 'subject' => __( '[%s] Email Changed' ), 'message' => $email_change_text, 'headers' => '', ); $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] ); $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); } if ( $switched_locale ) { restore_previous_locale(); } $current_user = wp_get_current_user(); if ( $current_user->ID == $user_id ) { if ( isset( $plaintext_pass ) ) { wp_clear_auth_cookie(); $logged_in_cookie = wp_parse_auth_cookie( '', 'logged_in' ); $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false ); $remember = false; if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) { $remember = true; } wp_set_auth_cookie( $user_id, $remember ); } } return $user_id; } function wp_create_user( $username, $password, $email = '' ) { $user_login = wp_slash( $username ); $user_email = wp_slash( $email ); $user_pass = $password; $userdata = compact( 'user_login', 'user_email', 'user_pass' ); return wp_insert_user( $userdata ); } function _get_additional_user_keys( $user ) { $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' ); return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); } function wp_get_user_contact_methods( $user = null ) { $methods = array(); if ( get_site_option( 'initial_db_version' ) < 23588 ) { $methods = array( 'aim' => __( 'AIM' ), 'yim' => __( 'Yahoo IM' ), 'jabber' => __( 'Jabber / Google Talk' ), ); } return apply_filters( 'user_contactmethods', $methods, $user ); } function _wp_get_user_contactmethods( $user = null ) { return wp_get_user_contact_methods( $user ); } function wp_get_password_hint() { $hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).' ); return apply_filters( 'password_hint', $hint ); } function get_password_reset_key( $user ) { global $wp_hasher; if ( ! ( $user instanceof WP_User ) ) { return new WP_Error( 'invalidcombo', __( 'Error: There is no account with that username or email address.' ) ); } do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' ); do_action( 'retrieve_password', $user->user_login ); $allow = true; if ( is_multisite() && is_user_spammy( $user ) ) { $allow = false; } $allow = apply_filters( 'allow_password_reset', $allow, $user->ID ); if ( ! $allow ) { return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) ); } elseif ( is_wp_error( $allow ) ) { return $allow; } $key = wp_generate_password( 20, false ); do_action( 'retrieve_password_key', $user->user_login, $key ); if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $hashed = time() . ':' . $wp_hasher->HashPassword( $key ); $key_saved = wp_update_user( array( 'ID' => $user->ID, 'user_activation_key' => $hashed, ) ); if ( is_wp_error( $key_saved ) ) { return $key_saved; } return $key; } function check_password_reset_key( $key, $login ) { global $wpdb, $wp_hasher; $key = preg_replace( '/[^a-z0-9]/i', '', $key ); if ( empty( $key ) || ! is_string( $key ) ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } if ( empty( $login ) || ! is_string( $login ) ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } $user = get_user_by( 'login', $login ); if ( ! $user ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS ); if ( false !== strpos( $user->user_activation_key, ':' ) ) { list( $pass_request_time, $pass_key ) = explode( ':', $user->user_activation_key, 2 ); $expiration_time = $pass_request_time + $expiration_duration; } else { $pass_key = $user->user_activation_key; $expiration_time = false; } if ( ! $pass_key ) { return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } $hash_is_correct = $wp_hasher->CheckPassword( $key, $pass_key ); if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) { return $user; } elseif ( $hash_is_correct && $expiration_time ) { return new WP_Error( 'expired_key', __( 'Invalid key.' ) ); } if ( hash_equals( $user->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) { $return = new WP_Error( 'expired_key', __( 'Invalid key.' ) ); $user_id = $user->ID; return apply_filters( 'password_reset_key_expired', $return, $user_id ); } return new WP_Error( 'invalid_key', __( 'Invalid key.' ) ); } function retrieve_password( $user_login = null ) { $errors = new WP_Error(); $user_data = false; if ( ! $user_login && ! empty( $_POST['user_login'] ) ) { $user_login = $_POST['user_login']; } if ( empty( $user_login ) ) { $errors->add( 'empty_username', __( 'Error: Please enter a username or email address.' ) ); } elseif ( strpos( $user_login, '@' ) ) { $user_data = get_user_by( 'email', trim( wp_unslash( $user_login ) ) ); if ( empty( $user_data ) ) { $errors->add( 'invalid_email', __( 'Error: There is no account with that username or email address.' ) ); } } else { $user_data = get_user_by( 'login', trim( wp_unslash( $user_login ) ) ); } $user_data = apply_filters( 'lostpassword_user_data', $user_data, $errors ); do_action( 'lostpassword_post', $errors, $user_data ); $errors = apply_filters( 'lostpassword_errors', $errors, $user_data ); if ( $errors->has_errors() ) { return $errors; } if ( ! $user_data ) { $errors->add( 'invalidcombo', __( 'Error: There is no account with that username or email address.' ) ); return $errors; } if ( ! apply_filters( 'send_retrieve_password_email', true, $user_login, $user_data ) ) { return true; } $user_login = $user_data->user_login; $user_email = $user_data->user_email; $key = get_password_reset_key( $user_data ); if ( is_wp_error( $key ) ) { return $key; } $locale = get_user_locale( $user_data ); $switched_locale = switch_to_locale( $locale ); if ( is_multisite() ) { $site_name = get_network()->site_name; } else { $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } $message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n"; $message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n"; $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n"; $message .= __( 'If this was a mistake, ignore this email and nothing will happen.' ) . "\r\n\r\n"; $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n"; $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . '&wp_lang=' . $locale . "\r\n\r\n"; if ( ! is_user_logged_in() ) { $requester_ip = $_SERVER['REMOTE_ADDR']; if ( $requester_ip ) { $message .= sprintf( __( 'This password reset request originated from the IP address %s.' ), $requester_ip ) . "\r\n"; } } $title = sprintf( __( '[%s] Password Reset' ), $site_name ); $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); if ( ! $message ) { return true; } $defaults = array( 'to' => $user_email, 'subject' => $title, 'message' => $message, 'headers' => '', ); $notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $key, $user_login, $user_data ); if ( $switched_locale ) { restore_previous_locale(); } if ( is_array( $notification_email ) ) { $notification_email = array_merge( $defaults, $notification_email ); } else { $notification_email = $defaults; } list( $to, $subject, $message, $headers ) = array_values( $notification_email ); $subject = wp_specialchars_decode( $subject ); if ( ! wp_mail( $to, $subject, $message, $headers ) ) { $errors->add( 'retrieve_password_email_failure', sprintf( __( 'Error: The email could not be sent. Your site may not be correctly configured to send emails. Get support for resetting your password.' ), esc_url( __( 'https://wordpress.org/support/article/resetting-your-password/' ) ) ) ); return $errors; } return true; } function reset_password( $user, $new_pass ) { do_action( 'password_reset', $user, $new_pass ); wp_set_password( $new_pass, $user->ID ); update_user_meta( $user->ID, 'default_password_nag', false ); do_action( 'after_password_reset', $user, $new_pass ); } function register_new_user( $user_login, $user_email ) { $errors = new WP_Error(); $sanitized_user_login = sanitize_user( $user_login ); $user_email = apply_filters( 'user_registration_email', $user_email ); if ( '' === $sanitized_user_login ) { $errors->add( 'empty_username', __( 'Error: Please enter a username.' ) ); } elseif ( ! validate_username( $user_login ) ) { $errors->add( 'invalid_username', __( 'Error: This username is invalid because it uses illegal characters. Please enter a valid username.' ) ); $sanitized_user_login = ''; } elseif ( username_exists( $sanitized_user_login ) ) { $errors->add( 'username_exists', __( 'Error: This username is already registered. Please choose another one.' ) ); } else { $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() ); if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) { $errors->add( 'invalid_username', __( 'Error: Sorry, that username is not allowed.' ) ); } } if ( '' === $user_email ) { $errors->add( 'empty_email', __( 'Error: Please type your email address.' ) ); } elseif ( ! is_email( $user_email ) ) { $errors->add( 'invalid_email', __( 'Error: The email address is not correct.' ) ); $user_email = ''; } elseif ( email_exists( $user_email ) ) { $errors->add( 'email_exists', sprintf( __( 'Error: This email address is already registered. Log in with this address or choose another one.' ), wp_login_url() ) ); } do_action( 'register_post', $sanitized_user_login, $user_email, $errors ); $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email ); if ( $errors->has_errors() ) { return $errors; } $user_pass = wp_generate_password( 12, false ); $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email ); if ( ! $user_id || is_wp_error( $user_id ) ) { $errors->add( 'registerfail', sprintf( __( 'Error: Could not register you… please contact the site admin!' ), get_option( 'admin_email' ) ) ); return $errors; } update_user_meta( $user_id, 'default_password_nag', true ); if ( ! empty( $_COOKIE['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); if ( in_array( $wp_lang, get_available_languages(), true ) ) { update_user_meta( $user_id, 'locale', $wp_lang ); } } do_action( 'register_new_user', $user_id ); return $user_id; } function wp_send_new_user_notifications( $user_id, $notify = 'both' ) { wp_new_user_notification( $user_id, null, $notify ); } function wp_get_session_token() { $cookie = wp_parse_auth_cookie( '', 'logged_in' ); return ! empty( $cookie['token'] ) ? $cookie['token'] : ''; } function wp_get_all_sessions() { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); return $manager->get_all(); } function wp_destroy_current_session() { $token = wp_get_session_token(); if ( $token ) { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy( $token ); } } function wp_destroy_other_sessions() { $token = wp_get_session_token(); if ( $token ) { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_others( $token ); } } function wp_destroy_all_sessions() { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_all(); } function wp_get_users_with_no_role( $site_id = null ) { global $wpdb; if ( ! $site_id ) { $site_id = get_current_blog_id(); } $prefix = $wpdb->get_blog_prefix( $site_id ); if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $role_names = wp_roles()->get_names(); restore_current_blog(); } else { $role_names = wp_roles()->get_names(); } $regex = implode( '|', array_keys( $role_names ) ); $regex = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex ); $users = $wpdb->get_col( $wpdb->prepare( " - SELECT user_id - FROM $wpdb->usermeta - WHERE meta_key = '{$prefix}capabilities' - AND meta_value NOT REGEXP %s - ", $regex ) ); return $users; } function _wp_get_current_user() { global $current_user; if ( ! empty( $current_user ) ) { if ( $current_user instanceof WP_User ) { return $current_user; } if ( is_object( $current_user ) && isset( $current_user->ID ) ) { $cur_id = $current_user->ID; $current_user = null; wp_set_current_user( $cur_id ); return $current_user; } $current_user = null; wp_set_current_user( 0 ); return $current_user; } if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { wp_set_current_user( 0 ); return $current_user; } $user_id = apply_filters( 'determine_current_user', false ); if ( ! $user_id ) { wp_set_current_user( 0 ); return $current_user; } wp_set_current_user( $user_id ); return $current_user; } function send_confirmation_on_profile_email() { global $errors; $current_user = wp_get_current_user(); if ( ! is_object( $errors ) ) { $errors = new WP_Error(); } if ( $current_user->ID != $_POST['user_id'] ) { return false; } if ( $current_user->user_email != $_POST['email'] ) { if ( ! is_email( $_POST['email'] ) ) { $errors->add( 'user_email', __( 'Error: The email address is not correct.' ), array( 'form-field' => 'email', ) ); return; } if ( email_exists( $_POST['email'] ) ) { $errors->add( 'user_email', __( 'Error: The email address is already used.' ), array( 'form-field' => 'email', ) ); delete_user_meta( $current_user->ID, '_new_email' ); return; } $hash = md5( $_POST['email'] . time() . wp_rand() ); $new_user_email = array( 'hash' => $hash, 'newemail' => $_POST['email'], ); update_user_meta( $current_user->ID, '_new_email', $new_user_email ); $sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $email_text = __( 'Howdy ###USERNAME###, - -You recently requested to have the email address on your account changed. - -If this is correct, please click on the following link to change it: -###ADMIN_URL### - -You can safely ignore and delete this email if you do not want to -take this action. - -This email has been sent to ###EMAIL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email ); $content = str_replace( '###USERNAME###', $current_user->user_login, $content ); $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content ); $content = str_replace( '###EMAIL###', $_POST['email'], $content ); $content = str_replace( '###SITENAME###', $sitename, $content ); $content = str_replace( '###SITEURL###', home_url(), $content ); wp_mail( $_POST['email'], sprintf( __( '[%s] Email Change Request' ), $sitename ), $content ); $_POST['email'] = $current_user->user_email; } } function new_user_email_admin_notice() { global $pagenow; if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) ) { $email = get_user_meta( get_current_user_id(), '_new_email', true ); if ( $email ) { echo '

                ' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '' . esc_html( $email['newemail'] ) . '' ) . '

                '; } } } function _wp_privacy_action_request_types() { return array( 'export_personal_data', 'remove_personal_data', ); } function wp_register_user_personal_data_exporter( $exporters ) { $exporters['wordpress-user'] = array( 'exporter_friendly_name' => __( 'WordPress User' ), 'callback' => 'wp_user_personal_data_exporter', ); return $exporters; } function wp_user_personal_data_exporter( $email_address ) { $email_address = trim( $email_address ); $data_to_export = array(); $user = get_user_by( 'email', $email_address ); if ( ! $user ) { return array( 'data' => array(), 'done' => true, ); } $user_meta = get_user_meta( $user->ID ); $user_props_to_export = array( 'ID' => __( 'User ID' ), 'user_login' => __( 'User Login Name' ), 'user_nicename' => __( 'User Nice Name' ), 'user_email' => __( 'User Email' ), 'user_url' => __( 'User URL' ), 'user_registered' => __( 'User Registration Date' ), 'display_name' => __( 'User Display Name' ), 'nickname' => __( 'User Nickname' ), 'first_name' => __( 'User First Name' ), 'last_name' => __( 'User Last Name' ), 'description' => __( 'User Description' ), ); $user_data_to_export = array(); foreach ( $user_props_to_export as $key => $name ) { $value = ''; switch ( $key ) { case 'ID': case 'user_login': case 'user_nicename': case 'user_email': case 'user_url': case 'user_registered': case 'display_name': $value = $user->data->$key; break; case 'nickname': case 'first_name': case 'last_name': case 'description': $value = $user_meta[ $key ][0]; break; } if ( ! empty( $value ) ) { $user_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $reserved_names = array_values( $user_props_to_export ); $_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names ); if ( is_array( $_extra_data ) && ! empty( $_extra_data ) ) { $extra_data = array_filter( $_extra_data, static function( $item ) use ( $reserved_names ) { return ! in_array( $item['name'], $reserved_names, true ); } ); if ( count( $extra_data ) !== count( $_extra_data ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Filter %s returned items with reserved names.' ), 'wp_privacy_additional_user_profile_data' ), '5.4.0' ); } if ( ! empty( $extra_data ) ) { $user_data_to_export = array_merge( $user_data_to_export, $extra_data ); } } $data_to_export[] = array( 'group_id' => 'user', 'group_label' => __( 'User' ), 'group_description' => __( 'User’s profile data.' ), 'item_id' => "user-{$user->ID}", 'data' => $user_data_to_export, ); if ( isset( $user_meta['community-events-location'] ) ) { $location = maybe_unserialize( $user_meta['community-events-location'][0] ); $location_props_to_export = array( 'description' => __( 'City' ), 'country' => __( 'Country' ), 'latitude' => __( 'Latitude' ), 'longitude' => __( 'Longitude' ), 'ip' => __( 'IP' ), ); $location_data_to_export = array(); foreach ( $location_props_to_export as $key => $name ) { if ( ! empty( $location[ $key ] ) ) { $location_data_to_export[] = array( 'name' => $name, 'value' => $location[ $key ], ); } } $data_to_export[] = array( 'group_id' => 'community-events-location', 'group_label' => __( 'Community Events Location' ), 'group_description' => __( 'User’s location data used for the Community Events in the WordPress Events and News dashboard widget.' ), 'item_id' => "community-events-location-{$user->ID}", 'data' => $location_data_to_export, ); } if ( isset( $user_meta['session_tokens'] ) ) { $session_tokens = maybe_unserialize( $user_meta['session_tokens'][0] ); $session_tokens_props_to_export = array( 'expiration' => __( 'Expiration' ), 'ip' => __( 'IP' ), 'ua' => __( 'User Agent' ), 'login' => __( 'Last Login' ), ); foreach ( $session_tokens as $token_key => $session_token ) { $session_tokens_data_to_export = array(); foreach ( $session_tokens_props_to_export as $key => $name ) { if ( ! empty( $session_token[ $key ] ) ) { $value = $session_token[ $key ]; if ( in_array( $key, array( 'expiration', 'login' ), true ) ) { $value = date_i18n( 'F d, Y H:i A', $value ); } $session_tokens_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $data_to_export[] = array( 'group_id' => 'session-tokens', 'group_label' => __( 'Session Tokens' ), 'group_description' => __( 'User’s Session Tokens data.' ), 'item_id' => "session-tokens-{$user->ID}-{$token_key}", 'data' => $session_tokens_data_to_export, ); } } return array( 'data' => $data_to_export, 'done' => true, ); } function _wp_privacy_account_request_confirmed( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request ) { return; } if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return; } update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() ); wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-confirmed', ) ); } function _wp_privacy_send_request_confirmation_notification( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) { return; } $already_notified = (bool) get_post_meta( $request_id, '_wp_admin_notified', true ); if ( $already_notified ) { return; } if ( 'export_personal_data' === $request->action_name ) { $manage_url = admin_url( 'export-personal-data.php' ); } elseif ( 'remove_personal_data' === $request->action_name ) { $manage_url = admin_url( 'erase-personal-data.php' ); } $action_description = wp_user_request_action_description( $request->action_name ); $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request ); $email_data = array( 'request' => $request, 'user_email' => $request->email, 'description' => $action_description, 'manage_url' => $manage_url, 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), 'admin_email' => $admin_email, ); $subject = sprintf( __( '[%1$s] Action Confirmed: %2$s' ), $email_data['sitename'], $action_description ); $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, - -A user data privacy request has been confirmed on ###SITENAME###: - -User: ###USER_EMAIL### -Request: ###DESCRIPTION### - -You can view and manage these data privacy requests here: - -###MANAGE_URL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.8.0', sprintf( __( '%1$s or %2$s' ), 'user_request_confirmed_email_content', 'user_erasure_fulfillment_email_content' ) ); $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $email_data['admin_email'], $subject, $content, $headers ); if ( $email_sent ) { update_post_meta( $request_id, '_wp_admin_notified', true ); } } function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) { return; } $already_notified = (bool) get_post_meta( $request_id, '_wp_user_notified', true ); if ( $already_notified ) { return; } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); $email_data = array( 'request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), ); $subject = sprintf( __( '[%s] Erasure Request Fulfilled' ), $email_data['sitename'] ); $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.8.0', 'user_erasure_fulfillment_email_subject' ); $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, - -Your request to erase your personal data on ###SITENAME### has been completed. - -If you have any follow-up questions or concerns, please contact the site administrator. - -Regards, -All at ###SITENAME### -###SITEURL###' ); if ( ! empty( $email_data['privacy_policy_url'] ) ) { $content = __( 'Howdy, - -Your request to erase your personal data on ###SITENAME### has been completed. - -If you have any follow-up questions or concerns, please contact the site administrator. - -For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL### - -Regards, -All at ###SITENAME### -###SITEURL###' ); } $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.8.0', sprintf( __( '%1$s or %2$s' ), 'user_erasure_fulfillment_email_content', 'user_request_confirmed_email_content' ) ); $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters_deprecated( 'user_erasure_complete_email_headers', array( $headers, $subject, $content, $request_id, $email_data ), '5.8.0', 'user_erasure_fulfillment_email_headers' ); $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $user_email, $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( $email_sent ) { update_post_meta( $request_id, '_wp_user_notified', true ); } } function _wp_privacy_account_request_confirmed_message( $request_id ) { $request = wp_get_user_request( $request_id ); $message = '

                ' . __( 'Action has been confirmed.' ) . '

                '; $message .= '

                ' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '

                '; if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { if ( 'export_personal_data' === $request->action_name ) { $message = '

                ' . __( 'Thanks for confirming your export request.' ) . '

                '; $message .= '

                ' . __( 'The site administrator has been notified. You will receive a link to download your export via email when they fulfill your request.' ) . '

                '; } elseif ( 'remove_personal_data' === $request->action_name ) { $message = '

                ' . __( 'Thanks for confirming your erasure request.' ) . '

                '; $message .= '

                ' . __( 'The site administrator has been notified. You will receive an email confirmation when they erase your data.' ) . '

                '; } } $message = apply_filters( 'user_request_action_confirmed_message', $message, $request_id ); return $message; } function wp_create_user_request( $email_address = '', $action_name = '', $request_data = array(), $status = 'pending' ) { $email_address = sanitize_email( $email_address ); $action_name = sanitize_key( $action_name ); if ( ! is_email( $email_address ) ) { return new WP_Error( 'invalid_email', __( 'Invalid email address.' ) ); } if ( ! in_array( $action_name, _wp_privacy_action_request_types(), true ) ) { return new WP_Error( 'invalid_action', __( 'Invalid action name.' ) ); } if ( ! in_array( $status, array( 'pending', 'confirmed' ), true ) ) { return new WP_Error( 'invalid_status', __( 'Invalid request status.' ) ); } $user = get_user_by( 'email', $email_address ); $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0; $requests_query = new WP_Query( array( 'post_type' => 'user_request', 'post_name__in' => array( $action_name ), 'title' => $email_address, 'post_status' => array( 'request-pending', 'request-confirmed', ), 'fields' => 'ids', ) ); if ( $requests_query->found_posts ) { return new WP_Error( 'duplicate_request', __( 'An incomplete personal data request for this email address already exists.' ) ); } $request_id = wp_insert_post( array( 'post_author' => $user_id, 'post_name' => $action_name, 'post_title' => $email_address, 'post_content' => wp_json_encode( $request_data ), 'post_status' => 'request-' . $status, 'post_type' => 'user_request', 'post_date' => current_time( 'mysql', false ), 'post_date_gmt' => current_time( 'mysql', true ), ), true ); return $request_id; } function wp_user_request_action_description( $action_name ) { switch ( $action_name ) { case 'export_personal_data': $description = __( 'Export Personal Data' ); break; case 'remove_personal_data': $description = __( 'Erase Personal Data' ); break; default: $description = sprintf( __( 'Confirm the "%s" action' ), $action_name ); break; } return apply_filters( 'user_request_action_description', $description, $action_name ); } function wp_send_user_request( $request_id ) { $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); if ( ! $request ) { return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) ); } if ( ! empty( $request->user_id ) ) { $locale = get_user_locale( $request->user_id ); } else { $locale = get_locale(); } $switched_locale = switch_to_locale( $locale ); $email_data = array( 'request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description( $request->action_name ), 'confirm_url' => add_query_arg( array( 'action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key( $request_id ), ), wp_login_url() ), 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 'siteurl' => home_url(), ); $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); $content = __( 'Howdy, - -A request has been made to perform the following action on your account: - - ###DESCRIPTION### - -To confirm this, please click on the following link: -###CONFIRM_URL### - -You can safely ignore and delete this email if you do not want to -take this action. - -Regards, -All at ###SITENAME### -###SITEURL###' ); $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); $content = str_replace( '###EMAIL###', $email_data['email'], $content ); $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); $headers = ''; $headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data ); $email_sent = wp_mail( $email_data['email'], $subject, $content, $headers ); if ( $switched_locale ) { restore_previous_locale(); } if ( ! $email_sent ) { return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export confirmation email.' ) ); } return true; } function wp_generate_user_request_key( $request_id ) { global $wp_hasher; $key = wp_generate_password( 20, false ); if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } wp_update_post( array( 'ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword( $key ), ) ); return $key; } function wp_validate_user_request_key( $request_id, $key ) { global $wp_hasher; $request_id = absint( $request_id ); $request = wp_get_user_request( $request_id ); $saved_key = $request->confirm_key; $key_request_time = $request->modified_timestamp; if ( ! $request || ! $saved_key || ! $key_request_time ) { return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) ); } if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) { return new WP_Error( 'expired_request', __( 'This personal data request has expired.' ) ); } if ( empty( $key ) ) { return new WP_Error( 'missing_key', __( 'The confirmation key is missing from this personal data request.' ) ); } if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $expiration_duration = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS ); $expiration_time = $key_request_time + $expiration_duration; if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) { return new WP_Error( 'invalid_key', __( 'The confirmation key is invalid for this personal data request.' ) ); } if ( ! $expiration_time || time() > $expiration_time ) { return new WP_Error( 'expired_key', __( 'The confirmation key has expired for this personal data request.' ) ); } return true; } function wp_get_user_request( $request_id ) { $request_id = absint( $request_id ); $post = get_post( $request_id ); if ( ! $post || 'user_request' !== $post->post_type ) { return false; } return new WP_User_Request( $post ); } function wp_is_application_passwords_supported() { return is_ssl() || 'local' === wp_get_environment_type(); } function wp_is_application_passwords_available() { return apply_filters( 'wp_is_application_passwords_available', wp_is_application_passwords_supported() ); } function wp_is_application_passwords_available_for_user( $user ) { if ( ! wp_is_application_passwords_available() ) { return false; } if ( ! is_object( $user ) ) { $user = get_userdata( $user ); } if ( ! $user || ! $user->exists() ) { return false; } return apply_filters( 'wp_is_application_passwords_available_for_user', true, $user ); } url = $url; $this->request = $request; } public function dispatch( $hook, $parameters = array() ) { $result = parent::dispatch( $hook, $parameters ); switch ( $hook ) { case 'curl.before_send': do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) ); break; } do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); return $result; } } request( $url, $args ); } function wp_safe_remote_get( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->get( $url, $args ); } function wp_safe_remote_post( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->post( $url, $args ); } function wp_safe_remote_head( $url, $args = array() ) { $args['reject_unsafe_urls'] = true; $http = _wp_http_get_object(); return $http->head( $url, $args ); } function wp_remote_request( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->request( $url, $args ); } function wp_remote_get( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->get( $url, $args ); } function wp_remote_post( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->post( $url, $args ); } function wp_remote_head( $url, $args = array() ) { $http = _wp_http_get_object(); return $http->head( $url, $args ); } function wp_remote_retrieve_headers( $response ) { if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { return array(); } return $response['headers']; } function wp_remote_retrieve_header( $response, $header ) { if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { return ''; } if ( isset( $response['headers'][ $header ] ) ) { return $response['headers'][ $header ]; } return ''; } function wp_remote_retrieve_response_code( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['code']; } function wp_remote_retrieve_response_message( $response ) { if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { return ''; } return $response['response']['message']; } function wp_remote_retrieve_body( $response ) { if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) { return ''; } return $response['body']; } function wp_remote_retrieve_cookies( $response ) { if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { return array(); } return $response['cookies']; } function wp_remote_retrieve_cookie( $response, $name ) { $cookies = wp_remote_retrieve_cookies( $response ); if ( empty( $cookies ) ) { return ''; } foreach ( $cookies as $cookie ) { if ( $cookie->name === $name ) { return $cookie; } } return ''; } function wp_remote_retrieve_cookie_value( $response, $name ) { $cookie = wp_remote_retrieve_cookie( $response, $name ); if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) { return ''; } return $cookie->value; } function wp_http_supports( $capabilities = array(), $url = null ) { $http = _wp_http_get_object(); $capabilities = wp_parse_args( $capabilities ); $count = count( $capabilities ); if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) { $capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) ); } if ( $url && ! isset( $capabilities['ssl'] ) ) { $scheme = parse_url( $url, PHP_URL_SCHEME ); if ( 'https' === $scheme || 'ssl' === $scheme ) { $capabilities['ssl'] = true; } } return (bool) $http->_get_first_available_transport( $capabilities ); } function get_http_origin() { $origin = ''; if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) { $origin = $_SERVER['HTTP_ORIGIN']; } return apply_filters( 'http_origin', $origin ); } function get_allowed_http_origins() { $admin_origin = parse_url( admin_url() ); $home_origin = parse_url( home_url() ); $allowed_origins = array_unique( array( 'http://' . $admin_origin['host'], 'https://' . $admin_origin['host'], 'http://' . $home_origin['host'], 'https://' . $home_origin['host'], ) ); return apply_filters( 'allowed_http_origins', $allowed_origins ); } function is_allowed_http_origin( $origin = null ) { $origin_arg = $origin; if ( null === $origin ) { $origin = get_http_origin(); } if ( $origin && ! in_array( $origin, get_allowed_http_origins(), true ) ) { $origin = ''; } return apply_filters( 'allowed_http_origin', $origin, $origin_arg ); } function send_origin_headers() { $origin = get_http_origin(); if ( is_allowed_http_origin( $origin ) ) { header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Credentials: true' ); if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { exit; } return $origin; } if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { status_header( 403 ); exit; } return false; } function wp_http_validate_url( $url ) { if ( ! is_string( $url ) || '' === $url || is_numeric( $url ) ) { return false; } $original_url = $url; $url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) ); if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) ) { return false; } $parsed_url = parse_url( $url ); if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { return false; } if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) ) { return false; } if ( false !== strpbrk( $parsed_url['host'], ':#?[]' ) ) { return false; } $parsed_home = parse_url( get_option( 'home' ) ); $same_host = isset( $parsed_home['host'] ) && strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); $host = trim( $parsed_url['host'], '.' ); if ( ! $same_host ) { if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) { $ip = $host; } else { $ip = gethostbyname( $host ); if ( $ip === $host ) { return false; } } if ( $ip ) { $parts = array_map( 'intval', explode( '.', $ip ) ); if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] || ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) || ( 192 === $parts[0] && 168 === $parts[1] ) ) { if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) ) { return false; } } } } if ( empty( $parsed_url['port'] ) ) { return $url; } $port = $parsed_url['port']; $allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url ); if ( is_array( $allowed_ports ) && in_array( $port, $allowed_ports, true ) ) { return $url; } if ( $parsed_home && $same_host && isset( $parsed_home['port'] ) && $parsed_home['port'] === $port ) { return $url; } return false; } function allowed_http_request_hosts( $is_external, $host ) { if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) ) { $is_external = true; } return $is_external; } function ms_allowed_http_request_hosts( $is_external, $host ) { global $wpdb; static $queried = array(); if ( $is_external ) { return $is_external; } if ( get_network()->domain === $host ) { return true; } if ( isset( $queried[ $host ] ) ) { return $queried[ $host ]; } $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); return $queried[ $host ]; } function wp_parse_url( $url, $component = -1 ) { $to_unset = array(); $url = (string) $url; if ( '//' === substr( $url, 0, 2 ) ) { $to_unset[] = 'scheme'; $url = 'placeholder:' . $url; } elseif ( '/' === substr( $url, 0, 1 ) ) { $to_unset[] = 'scheme'; $to_unset[] = 'host'; $url = 'placeholder://placeholder' . $url; } $parts = parse_url( $url ); if ( false === $parts ) { return $parts; } foreach ( $to_unset as $key ) { unset( $parts[ $key ] ); } return _get_component_from_parsed_url_array( $parts, $component ); } function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) { if ( -1 === $component ) { return $url_parts; } $key = _wp_translate_php_url_constant_to_key( $component ); if ( false !== $key && is_array( $url_parts ) && isset( $url_parts[ $key ] ) ) { return $url_parts[ $key ]; } else { return null; } } function _wp_translate_php_url_constant_to_key( $constant ) { $translation = array( PHP_URL_SCHEME => 'scheme', PHP_URL_HOST => 'host', PHP_URL_PORT => 'port', PHP_URL_USER => 'user', PHP_URL_PASS => 'pass', PHP_URL_PATH => 'path', PHP_URL_QUERY => 'query', PHP_URL_FRAGMENT => 'fragment', ); if ( isset( $translation[ $constant ] ) ) { return $translation[ $constant ]; } else { return false; } } get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) { return false; } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value ); $result = $wpdb->insert( $table, array( $column => $object_id, 'meta_key' => $meta_key, 'meta_value' => $meta_value, ) ); if ( ! $result ) { return false; } $mid = (int) $wpdb->insert_id; wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value ); return $mid; } function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) { global $wpdb; if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $meta_subtype = get_object_subtype( $meta_type, $object_id ); $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $raw_meta_key = $meta_key; $meta_key = wp_unslash( $meta_key ); $passed_value = $meta_value; $meta_value = wp_unslash( $meta_value ); $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype ); $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); if ( null !== $check ) { return (bool) $check; } if ( empty( $prev_value ) ) { $old_value = get_metadata_raw( $meta_type, $object_id, $meta_key ); if ( is_countable( $old_value ) && count( $old_value ) === 1 ) { if ( $old_value[0] === $meta_value ) { return false; } } } $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ); if ( empty( $meta_ids ) ) { return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value ); } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); $data = compact( 'meta_value' ); $where = array( $column => $object_id, 'meta_key' => $meta_key, ); if ( ! empty( $prev_value ) ) { $prev_value = maybe_serialize( $prev_value ); $where['meta_value'] = $prev_value; } foreach ( $meta_ids as $meta_id ) { do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } } $result = $wpdb->update( $table, $data, $where ); if ( ! $result ) { return false; } wp_cache_delete( $object_id, $meta_type . '_meta' ); foreach ( $meta_ids as $meta_id ) { do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } } return true; } function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) { global $wpdb; if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id && ! $delete_all ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $type_column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta_key = wp_unslash( $meta_key ); $meta_value = wp_unslash( $meta_value ); $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all ); if ( null !== $check ) { return (bool) $check; } $_meta_value = $meta_value; $meta_value = maybe_serialize( $meta_value ); $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); if ( ! $delete_all ) { $query .= $wpdb->prepare( " AND $type_column = %d", $object_id ); } if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) { $query .= $wpdb->prepare( ' AND meta_value = %s', $meta_value ); } $meta_ids = $wpdb->get_col( $query ); if ( ! count( $meta_ids ) ) { return false; } if ( $delete_all ) { if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) { $object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s AND meta_value = %s", $meta_key, $meta_value ) ); } else { $object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s", $meta_key ) ); } } do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'delete_postmeta', $meta_ids ); } $query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . ' )'; $count = $wpdb->query( $query ); if ( ! $count ) { return false; } if ( $delete_all ) { $data = (array) $object_ids; } else { $data = array( $object_id ); } wp_cache_delete_multiple( $data, $meta_type . '_meta' ); do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'deleted_postmeta', $meta_ids ); } return true; } function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) { $value = get_metadata_raw( $meta_type, $object_id, $meta_key, $single ); if ( ! is_null( $value ) ) { return $value; } return get_metadata_default( $meta_type, $object_id, $meta_key, $single ); } function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = false ) { if ( ! $meta_type || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type ); if ( null !== $check ) { if ( $single && is_array( $check ) ) { return $check[0]; } else { return $check; } } $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); if ( isset( $meta_cache[ $object_id ] ) ) { $meta_cache = $meta_cache[ $object_id ]; } else { $meta_cache = null; } } if ( ! $meta_key ) { return $meta_cache; } if ( isset( $meta_cache[ $meta_key ] ) ) { if ( $single ) { return maybe_unserialize( $meta_cache[ $meta_key ][0] ); } else { return array_map( 'maybe_unserialize', $meta_cache[ $meta_key ] ); } } return null; } function get_metadata_default( $meta_type, $object_id, $meta_key, $single = false ) { if ( $single ) { $value = ''; } else { $value = array(); } $value = apply_filters( "default_{$meta_type}_metadata", $value, $object_id, $meta_key, $single, $meta_type ); if ( ! $single && ! wp_is_numeric_array( $value ) ) { $value = array( $value ); } return $value; } function metadata_exists( $meta_type, $object_id, $meta_key ) { if ( ! $meta_type || ! is_numeric( $object_id ) ) { return false; } $object_id = absint( $object_id ); if ( ! $object_id ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true, $meta_type ); if ( null !== $check ) { return (bool) $check; } $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); $meta_cache = $meta_cache[ $object_id ]; } if ( isset( $meta_cache[ $meta_key ] ) ) { return true; } return false; } function get_metadata_by_mid( $meta_type, $meta_id ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $check = apply_filters( "get_{$meta_type}_metadata_by_mid", null, $meta_id ); if ( null !== $check ) { return $check; } $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) ); if ( empty( $meta ) ) { return false; } if ( isset( $meta->meta_value ) ) { $meta->meta_value = maybe_unserialize( $meta->meta_value ); } return $meta; } function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $check = apply_filters( "update_{$meta_type}_metadata_by_mid", null, $meta_id, $meta_value, $meta_key ); if ( null !== $check ) { return (bool) $check; } $meta = get_metadata_by_mid( $meta_type, $meta_id ); if ( $meta ) { $original_key = $meta->meta_key; $object_id = $meta->{$column}; if ( false === $meta_key ) { $meta_key = $original_key; } elseif ( ! is_string( $meta_key ) ) { return false; } $meta_subtype = get_object_subtype( $meta_type, $object_id ); $_meta_value = $meta_value; $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype ); $meta_value = maybe_serialize( $meta_value ); $data = array( 'meta_key' => $meta_key, 'meta_value' => $meta_value, ); $where = array(); $where[ $id_column ] = $meta_id; do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } $result = $wpdb->update( $table, $data, $where, '%s', '%d' ); if ( ! $result ) { return false; } wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value ); if ( 'post' === $meta_type ) { do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value ); } return true; } return false; } function delete_metadata_by_mid( $meta_type, $meta_id ) { global $wpdb; if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) { return false; } $meta_id = (int) $meta_id; if ( $meta_id <= 0 ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $check = apply_filters( "delete_{$meta_type}_metadata_by_mid", null, $meta_id ); if ( null !== $check ) { return (bool) $check; } $meta = get_metadata_by_mid( $meta_type, $meta_id ); if ( $meta ) { $object_id = (int) $meta->{$column}; do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); if ( 'post' === $meta_type || 'comment' === $meta_type ) { do_action( "delete_{$meta_type}meta", $meta_id ); } $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) ); wp_cache_delete( $object_id, $meta_type . '_meta' ); do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); if ( 'post' === $meta_type || 'comment' === $meta_type ) { do_action( "deleted_{$meta_type}meta", $meta_id ); } return $result; } return false; } function update_meta_cache( $meta_type, $object_ids ) { global $wpdb; if ( ! $meta_type || ! $object_ids ) { return false; } $table = _get_meta_table( $meta_type ); if ( ! $table ) { return false; } $column = sanitize_key( $meta_type . '_id' ); if ( ! is_array( $object_ids ) ) { $object_ids = preg_replace( '|[^0-9,]|', '', $object_ids ); $object_ids = explode( ',', $object_ids ); } $object_ids = array_map( 'intval', $object_ids ); $check = apply_filters( "update_{$meta_type}_metadata_cache", null, $object_ids ); if ( null !== $check ) { return (bool) $check; } $cache_key = $meta_type . '_meta'; $non_cached_ids = array(); $cache = array(); $cache_values = wp_cache_get_multiple( $object_ids, $cache_key ); foreach ( $cache_values as $id => $cached_object ) { if ( false === $cached_object ) { $non_cached_ids[] = $id; } else { $cache[ $id ] = $cached_object; } } if ( empty( $non_cached_ids ) ) { return $cache; } $id_list = implode( ',', $non_cached_ids ); $id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id'; $meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A ); if ( ! empty( $meta_list ) ) { foreach ( $meta_list as $metarow ) { $mpid = (int) $metarow[ $column ]; $mkey = $metarow['meta_key']; $mval = $metarow['meta_value']; if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) { $cache[ $mpid ] = array(); } if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) { $cache[ $mpid ][ $mkey ] = array(); } $cache[ $mpid ][ $mkey ][] = $mval; } } $data = array(); foreach ( $non_cached_ids as $id ) { if ( ! isset( $cache[ $id ] ) ) { $cache[ $id ] = array(); } $data[ $id ] = $cache[ $id ]; } wp_cache_add_multiple( $data, $cache_key ); return $cache; } function wp_metadata_lazyloader() { static $wp_metadata_lazyloader; if ( null === $wp_metadata_lazyloader ) { $wp_metadata_lazyloader = new WP_Metadata_Lazyloader(); } return $wp_metadata_lazyloader; } function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) { $meta_query_obj = new WP_Meta_Query( $meta_query ); return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context ); } function _get_meta_table( $type ) { global $wpdb; $table_name = $type . 'meta'; if ( empty( $wpdb->$table_name ) ) { return false; } return $wpdb->$table_name; } function is_protected_meta( $meta_key, $meta_type = '' ) { $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type ); } function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = '' ) { if ( ! empty( $object_subtype ) && has_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) { return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype ); } return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type ); } function register_meta( $object_type, $meta_key, $args, $deprecated = null ) { global $wp_meta_keys; if ( ! is_array( $wp_meta_keys ) ) { $wp_meta_keys = array(); } $defaults = array( 'object_subtype' => '', 'type' => 'string', 'description' => '', 'default' => '', 'single' => false, 'sanitize_callback' => null, 'auth_callback' => null, 'show_in_rest' => false, ); $has_old_sanitize_cb = false; $has_old_auth_cb = false; if ( is_callable( $args ) ) { $args = array( 'sanitize_callback' => $args, ); $has_old_sanitize_cb = true; } else { $args = (array) $args; } if ( is_callable( $deprecated ) ) { $args['auth_callback'] = $deprecated; $has_old_auth_cb = true; } $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key ); unset( $defaults['default'] ); $args = wp_parse_args( $args, $defaults ); if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) { if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.3.0' ); return false; } } $object_subtype = ! empty( $args['object_subtype'] ) ? $args['object_subtype'] : ''; if ( empty( $args['auth_callback'] ) ) { if ( is_protected_meta( $meta_key, $object_type ) ) { $args['auth_callback'] = '__return_false'; } else { $args['auth_callback'] = '__return_true'; } } if ( is_callable( $args['sanitize_callback'] ) ) { if ( ! empty( $object_subtype ) ) { add_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'], 10, 4 ); } else { add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 ); } } if ( is_callable( $args['auth_callback'] ) ) { if ( ! empty( $object_subtype ) ) { add_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'], 10, 6 ); } else { add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); } } if ( array_key_exists( 'default', $args ) ) { $schema = $args; if ( is_array( $args['show_in_rest'] ) && isset( $args['show_in_rest']['schema'] ) ) { $schema = array_merge( $schema, $args['show_in_rest']['schema'] ); } $check = rest_validate_value_from_schema( $args['default'], $schema ); if ( is_wp_error( $check ) ) { _doing_it_wrong( __FUNCTION__, __( 'When registering a default meta value the data must match the type provided.' ), '5.5.0' ); return false; } if ( ! has_filter( "default_{$object_type}_metadata", 'filter_default_metadata' ) ) { add_filter( "default_{$object_type}_metadata", 'filter_default_metadata', 10, 5 ); } } if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb ) { unset( $args['object_subtype'] ); $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args; return true; } return false; } function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) { global $wp_meta_keys; if ( wp_installing() ) { return $value; } if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $meta_type ] ) ) { return $value; } $defaults = array(); foreach ( $wp_meta_keys[ $meta_type ] as $sub_type => $meta_data ) { foreach ( $meta_data as $_meta_key => $args ) { if ( $_meta_key === $meta_key && array_key_exists( 'default', $args ) ) { $defaults[ $sub_type ] = $args; } } } if ( ! $defaults ) { return $value; } if ( isset( $defaults[''] ) ) { $metadata = $defaults['']; } else { $sub_type = get_object_subtype( $meta_type, $object_id ); if ( ! isset( $defaults[ $sub_type ] ) ) { return $value; } $metadata = $defaults[ $sub_type ]; } if ( $single ) { $value = $metadata['default']; } else { $value = array( $metadata['default'] ); } return $value; } function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = '' ) { $meta_keys = get_registered_meta_keys( $object_type, $object_subtype ); return isset( $meta_keys[ $meta_key ] ); } function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) { global $wp_meta_keys; if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { return false; } $args = $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ]; if ( isset( $args['sanitize_callback'] ) && is_callable( $args['sanitize_callback'] ) ) { if ( ! empty( $object_subtype ) ) { remove_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'] ); } else { remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] ); } } if ( isset( $args['auth_callback'] ) && is_callable( $args['auth_callback'] ) ) { if ( ! empty( $object_subtype ) ) { remove_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'] ); } else { remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] ); } } unset( $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] ); if ( empty( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) { unset( $wp_meta_keys[ $object_type ][ $object_subtype ] ); } if ( empty( $wp_meta_keys[ $object_type ] ) ) { unset( $wp_meta_keys[ $object_type ] ); } return true; } function get_registered_meta_keys( $object_type, $object_subtype = '' ) { global $wp_meta_keys; if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $object_type ] ) || ! isset( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) { return array(); } return $wp_meta_keys[ $object_type ][ $object_subtype ]; } function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) { $object_subtype = get_object_subtype( $object_type, $object_id ); if ( ! empty( $meta_key ) ) { if ( ! empty( $object_subtype ) && ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { $object_subtype = ''; } if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) { return false; } $meta_keys = get_registered_meta_keys( $object_type, $object_subtype ); $meta_key_data = $meta_keys[ $meta_key ]; $data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] ); return $data; } $data = get_metadata( $object_type, $object_id ); if ( ! $data ) { return array(); } $meta_keys = get_registered_meta_keys( $object_type ); if ( ! empty( $object_subtype ) ) { $meta_keys = array_merge( $meta_keys, get_registered_meta_keys( $object_type, $object_subtype ) ); } return array_intersect_key( $data, $meta_keys ); } function _wp_register_meta_args_allowed_list( $args, $default_args ) { return array_intersect_key( $args, $default_args ); } function get_object_subtype( $object_type, $object_id ) { $object_id = (int) $object_id; $object_subtype = ''; switch ( $object_type ) { case 'post': $post_type = get_post_type( $object_id ); if ( ! empty( $post_type ) ) { $object_subtype = $post_type; } break; case 'term': $term = get_term( $object_id ); if ( ! $term instanceof WP_Term ) { break; } $object_subtype = $term->taxonomy; break; case 'comment': $comment = get_comment( $object_id ); if ( ! $comment ) { break; } $object_subtype = 'comment'; break; case 'user': $user = get_user_by( 'id', $object_id ); if ( ! $user ) { break; } $object_subtype = 'user'; break; } return apply_filters( "get_object_subtype_{$object_type}", $object_subtype, $object_id ); } $value ) { if ( 0 === strpos( $constant, 'E_' ) ) { $core_errors[ $value ] = $constant; } } if ( isset( $core_errors[ $error['type'] ] ) ) { $error['type'] = $core_errors[ $error['type'] ]; } $error_message = __( 'An error of type %1$s was caused in line %2$s of the file %3$s. Error message: %4$s' ); return sprintf( $error_message, "{$error['type']}", "{$error['line']}", "{$error['file']}", "{$error['message']}" ); } function wp_register_fatal_error_handler() { if ( ! wp_is_fatal_error_handler_enabled() ) { return; } $handler = null; if ( defined( 'WP_CONTENT_DIR' ) && is_readable( WP_CONTENT_DIR . '/fatal-error-handler.php' ) ) { $handler = include WP_CONTENT_DIR . '/fatal-error-handler.php'; } if ( ! is_object( $handler ) || ! is_callable( array( $handler, 'handle' ) ) ) { $handler = new WP_Fatal_Error_Handler(); } register_shutdown_function( array( $handler, 'handle' ) ); } function wp_is_fatal_error_handler_enabled() { $enabled = ! defined( 'WP_DISABLE_FATAL_ERROR_HANDLER' ) || ! WP_DISABLE_FATAL_ERROR_HANDLER; return apply_filters( 'wp_fatal_error_handler_enabled', $enabled ); } function wp_recovery_mode() { static $wp_recovery_mode; if ( ! $wp_recovery_mode ) { $wp_recovery_mode = new WP_Recovery_Mode(); } return $wp_recovery_mode; } '', 'path' => '/', 'network_id' => get_current_network_id(), 'registered' => $now, 'last_updated' => $now, 'public' => 1, 'archived' => 0, 'mature' => 0, 'spam' => 0, 'deleted' => 0, 'lang_id' => 0, ); $prepared_data = wp_prepare_site_data( $data, $defaults ); if ( is_wp_error( $prepared_data ) ) { return $prepared_data; } if ( false === $wpdb->insert( $wpdb->blogs, $prepared_data ) ) { return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error ); } $site_id = (int) $wpdb->insert_id; clean_blog_cache( $site_id ); $new_site = get_site( $site_id ); if ( ! $new_site ) { return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) ); } do_action( 'wp_insert_site', $new_site ); $args = array_diff_key( $data, $defaults ); if ( isset( $args['site_id'] ) ) { unset( $args['site_id'] ); } do_action( 'wp_initialize_site', $new_site, $args ); if ( has_action( 'wpmu_new_blog' ) ) { $user_id = ! empty( $args['user_id'] ) ? $args['user_id'] : 0; $meta = ! empty( $args['options'] ) ? $args['options'] : array(); if ( ! array_key_exists( 'WPLANG', $meta ) ) { $meta['WPLANG'] = get_network_option( $new_site->network_id, 'WPLANG' ); } $allowed_data_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); $meta = array_merge( array_intersect_key( $data, array_flip( $allowed_data_fields ) ), $meta ); do_action_deprecated( 'wpmu_new_blog', array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ), '5.1.0', 'wp_initialize_site' ); } return (int) $new_site->id; } function wp_update_site( $site_id, array $data ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $old_site = get_site( $site_id ); if ( ! $old_site ) { return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) ); } $defaults = $old_site->to_array(); $defaults['network_id'] = (int) $defaults['site_id']; $defaults['last_updated'] = current_time( 'mysql', true ); unset( $defaults['blog_id'], $defaults['site_id'] ); $data = wp_prepare_site_data( $data, $defaults, $old_site ); if ( is_wp_error( $data ) ) { return $data; } if ( false === $wpdb->update( $wpdb->blogs, $data, array( 'blog_id' => $old_site->id ) ) ) { return new WP_Error( 'db_update_error', __( 'Could not update site in the database.' ), $wpdb->last_error ); } clean_blog_cache( $old_site ); $new_site = get_site( $old_site->id ); do_action( 'wp_update_site', $new_site, $old_site ); return (int) $new_site->id; } function wp_delete_site( $site_id ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $old_site = get_site( $site_id ); if ( ! $old_site ) { return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) ); } $errors = new WP_Error(); do_action( 'wp_validate_site_deletion', $errors, $old_site ); if ( ! empty( $errors->errors ) ) { return $errors; } do_action_deprecated( 'delete_blog', array( $old_site->id, true ), '5.1.0' ); do_action( 'wp_uninitialize_site', $old_site ); if ( is_site_meta_supported() ) { $blog_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->blogmeta WHERE blog_id = %d ", $old_site->id ) ); foreach ( $blog_meta_ids as $mid ) { delete_metadata_by_mid( 'blog', $mid ); } } if ( false === $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $old_site->id ) ) ) { return new WP_Error( 'db_delete_error', __( 'Could not delete site from the database.' ), $wpdb->last_error ); } clean_blog_cache( $old_site ); do_action( 'wp_delete_site', $old_site ); do_action_deprecated( 'deleted_blog', array( $old_site->id, true ), '5.1.0' ); return $old_site; } function get_site( $site = null ) { if ( empty( $site ) ) { $site = get_current_blog_id(); } if ( $site instanceof WP_Site ) { $_site = $site; } elseif ( is_object( $site ) ) { $_site = new WP_Site( $site ); } else { $_site = WP_Site::get_instance( $site ); } if ( ! $_site ) { return null; } $_site = apply_filters( 'get_site', $_site ); return $_site; } function _prime_site_caches( $ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); if ( ! empty( $non_cached_ids ) ) { $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_site_cache( $fresh_sites, $update_meta_cache ); } } function update_site_cache( $sites, $update_meta_cache = true ) { if ( ! $sites ) { return; } $site_ids = array(); $site_data = array(); $blog_details_data = array(); foreach ( $sites as $site ) { $site_ids[] = $site->blog_id; $site_data[ $site->blog_id ] = $site; $blog_details_data[ $site->blog_id . 'short' ] = $site; } wp_cache_add_multiple( $site_data, 'sites' ); wp_cache_add_multiple( $blog_details_data, 'blog-details' ); if ( $update_meta_cache ) { update_sitemeta_cache( $site_ids ); } } function update_sitemeta_cache( $site_ids ) { if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) { add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ); } return update_meta_cache( 'blog', $site_ids ); } function get_sites( $args = array() ) { $query = new WP_Site_Query(); return $query->query( $args ); } function wp_prepare_site_data( $data, $defaults, $old_site = null ) { if ( isset( $data['site_id'] ) ) { if ( ! empty( $data['site_id'] ) && empty( $data['network_id'] ) ) { $data['network_id'] = $data['site_id']; } unset( $data['site_id'] ); } $data = apply_filters( 'wp_normalize_site_data', $data ); $allowed_data_fields = array( 'domain', 'path', 'network_id', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); $data = array_intersect_key( wp_parse_args( $data, $defaults ), array_flip( $allowed_data_fields ) ); $errors = new WP_Error(); do_action( 'wp_validate_site_data', $errors, $data, $old_site ); if ( ! empty( $errors->errors ) ) { return $errors; } $data['site_id'] = $data['network_id']; unset( $data['network_id'] ); return $data; } function wp_normalize_site_data( $data ) { if ( array_key_exists( 'domain', $data ) ) { $data['domain'] = trim( $data['domain'] ); $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) ); if ( is_subdomain_install() ) { $data['domain'] = str_replace( '@', '', $data['domain'] ); } } if ( array_key_exists( 'path', $data ) ) { $data['path'] = trailingslashit( '/' . trim( $data['path'], '/' ) ); } if ( array_key_exists( 'network_id', $data ) ) { $data['network_id'] = (int) $data['network_id']; } $status_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $status_fields as $status_field ) { if ( array_key_exists( $status_field, $data ) ) { $data[ $status_field ] = (int) $data[ $status_field ]; } } $date_fields = array( 'registered', 'last_updated' ); foreach ( $date_fields as $date_field ) { if ( ! array_key_exists( $date_field, $data ) ) { continue; } if ( empty( $data[ $date_field ] ) || '0000-00-00 00:00:00' === $data[ $date_field ] ) { unset( $data[ $date_field ] ); } } return $data; } function wp_validate_site_data( $errors, $data, $old_site = null ) { if ( empty( $data['domain'] ) ) { $errors->add( 'site_empty_domain', __( 'Site domain must not be empty.' ) ); } if ( empty( $data['path'] ) ) { $errors->add( 'site_empty_path', __( 'Site path must not be empty.' ) ); } if ( empty( $data['network_id'] ) ) { $errors->add( 'site_empty_network_id', __( 'Site network ID must be provided.' ) ); } $date_fields = array( 'registered', 'last_updated' ); foreach ( $date_fields as $date_field ) { if ( empty( $data[ $date_field ] ) ) { $errors->add( 'site_empty_' . $date_field, __( 'Both registration and last updated dates must be provided.' ) ); break; } if ( '0000-00-00 00:00:00' !== $data[ $date_field ] ) { $month = substr( $data[ $date_field ], 5, 2 ); $day = substr( $data[ $date_field ], 8, 2 ); $year = substr( $data[ $date_field ], 0, 4 ); $valid_date = wp_checkdate( $month, $day, $year, $data[ $date_field ] ); if ( ! $valid_date ) { $errors->add( 'site_invalid_' . $date_field, __( 'Both registration and last updated dates must be valid dates.' ) ); break; } } } if ( ! empty( $errors->errors ) ) { return; } if ( ! $old_site || $data['domain'] !== $old_site->domain || $data['path'] !== $old_site->path || $data['network_id'] !== $old_site->network_id ) { if ( domain_exists( $data['domain'], $data['path'], $data['network_id'] ) ) { $errors->add( 'site_taken', __( 'Sorry, that site already exists!' ) ); } } } function wp_initialize_site( $site_id, array $args = array() ) { global $wpdb, $wp_roles; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $site = get_site( $site_id ); if ( ! $site ) { return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) ); } if ( wp_is_site_initialized( $site ) ) { return new WP_Error( 'site_already_initialized', __( 'The site appears to be already initialized.' ) ); } $network = get_network( $site->network_id ); if ( ! $network ) { $network = get_network(); } $args = wp_parse_args( $args, array( 'user_id' => 0, 'title' => sprintf( __( 'Site %d' ), $site->id ), 'options' => array(), 'meta' => array(), ) ); $args = apply_filters( 'wp_initialize_site_args', $args, $site, $network ); $orig_installing = wp_installing(); if ( ! $orig_installing ) { wp_installing( true ); } $switch = false; if ( get_current_blog_id() !== $site->id ) { $switch = true; switch_to_blog( $site->id ); } require_once ABSPATH . 'wp-admin/includes/upgrade.php'; make_db_current_silent( 'blog' ); $home_scheme = 'http'; $siteurl_scheme = 'http'; if ( ! is_subdomain_install() ) { if ( 'https' === parse_url( get_home_url( $network->site_id ), PHP_URL_SCHEME ) ) { $home_scheme = 'https'; } if ( 'https' === parse_url( get_network_option( $network->id, 'siteurl' ), PHP_URL_SCHEME ) ) { $siteurl_scheme = 'https'; } } populate_options( array_merge( array( 'home' => untrailingslashit( $home_scheme . '://' . $site->domain . $site->path ), 'siteurl' => untrailingslashit( $siteurl_scheme . '://' . $site->domain . $site->path ), 'blogname' => wp_unslash( $args['title'] ), 'admin_email' => '', 'upload_path' => get_network_option( $network->id, 'ms_files_rewriting' ) ? UPLOADBLOGSDIR . "/{$site->id}/files" : get_blog_option( $network->site_id, 'upload_path' ), 'blog_public' => (int) $site->public, 'WPLANG' => get_network_option( $network->id, 'WPLANG' ), ), $args['options'] ) ); clean_blog_cache( $site ); populate_roles(); $wp_roles = new WP_Roles(); populate_site_meta( $site->id, $args['meta'] ); $table_prefix = $wpdb->get_blog_prefix(); delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); wp_install_defaults( $args['user_id'] ); add_user_to_blog( $site->id, $args['user_id'], 'administrator' ); if ( ! user_can( $args['user_id'], 'manage_network' ) && ! get_user_meta( $args['user_id'], 'primary_blog', true ) ) { update_user_meta( $args['user_id'], 'primary_blog', $site->id ); } if ( $switch ) { restore_current_blog(); } wp_installing( $orig_installing ); return true; } function wp_uninitialize_site( $site_id ) { global $wpdb; if ( empty( $site_id ) ) { return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) ); } $site = get_site( $site_id ); if ( ! $site ) { return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) ); } if ( ! wp_is_site_initialized( $site ) ) { return new WP_Error( 'site_already_uninitialized', __( 'The site appears to be already uninitialized.' ) ); } $users = get_users( array( 'blog_id' => $site->id, 'fields' => 'ids', ) ); if ( ! empty( $users ) ) { foreach ( $users as $user_id ) { remove_user_from_blog( $user_id, $site->id ); } } $switch = false; if ( get_current_blog_id() !== $site->id ) { $switch = true; switch_to_blog( $site->id ); } $uploads = wp_get_upload_dir(); $tables = $wpdb->tables( 'blog' ); $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $site->id ); foreach ( (array) $drop_tables as $table ) { $wpdb->query( "DROP TABLE IF EXISTS `$table`" ); } $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $site->id ); $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); $top_dir = $dir; $stack = array( $dir ); $index = 0; while ( $index < count( $stack ) ) { $dir = $stack[ $index ]; $dh = @opendir( $dir ); if ( $dh ) { $file = @readdir( $dh ); while ( false !== $file ) { if ( '.' === $file || '..' === $file ) { $file = @readdir( $dh ); continue; } if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) { $stack[] = $dir . DIRECTORY_SEPARATOR . $file; } elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) { @unlink( $dir . DIRECTORY_SEPARATOR . $file ); } $file = @readdir( $dh ); } @closedir( $dh ); } $index++; } $stack = array_reverse( $stack ); foreach ( (array) $stack as $dir ) { if ( $dir != $top_dir ) { @rmdir( $dir ); } } if ( $switch ) { restore_current_blog(); } return true; } function wp_is_site_initialized( $site_id ) { global $wpdb; if ( is_object( $site_id ) ) { $site_id = $site_id->blog_id; } $site_id = (int) $site_id; $pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id ); if ( null !== $pre ) { return (bool) $pre; } $switch = false; if ( get_current_blog_id() !== $site_id ) { $switch = true; remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 ); switch_to_blog( $site_id ); } $suppress = $wpdb->suppress_errors(); $result = (bool) $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ); $wpdb->suppress_errors( $suppress ); if ( $switch ) { restore_current_blog(); add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 ); } return $result; } function clean_blog_cache( $blog ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } if ( empty( $blog ) ) { return; } $blog_id = $blog; $blog = get_site( $blog_id ); if ( ! $blog ) { if ( ! is_numeric( $blog_id ) ) { return; } $blog = new WP_Site( (object) array( 'blog_id' => $blog_id, 'domain' => null, 'path' => null, ) ); } $blog_id = $blog->blog_id; $domain_path_key = md5( $blog->domain . $blog->path ); wp_cache_delete( $blog_id, 'sites' ); wp_cache_delete( $blog_id, 'site-details' ); wp_cache_delete( $blog_id, 'blog-details' ); wp_cache_delete( $blog_id . 'short', 'blog-details' ); wp_cache_delete( $domain_path_key, 'blog-lookup' ); wp_cache_delete( $domain_path_key, 'blog-id-cache' ); wp_cache_delete( $blog_id, 'blog_meta' ); do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key ); wp_cache_set( 'last_changed', microtime(), 'sites' ); do_action_deprecated( 'refresh_blog_details', array( $blog_id ), '4.9.0', 'clean_site_cache' ); } function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique ); } function delete_site_meta( $site_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'blog', $site_id, $meta_key, $meta_value ); } function get_site_meta( $site_id, $key = '', $single = false ) { return get_metadata( 'blog', $site_id, $key, $single ); } function update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value ); } function delete_site_meta_by_key( $meta_key ) { return delete_metadata( 'blog', null, $meta_key, '', true ); } function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) { if ( null === $old_site ) { wp_maybe_update_network_site_counts( $new_site->network_id ); return; } if ( $new_site->network_id != $old_site->network_id ) { wp_maybe_update_network_site_counts( $new_site->network_id ); wp_maybe_update_network_site_counts( $old_site->network_id ); } } function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null ) { $site_id = $new_site->id; if ( ! $old_site ) { $old_site = new WP_Site( new stdClass() ); } if ( $new_site->spam != $old_site->spam ) { if ( 1 == $new_site->spam ) { do_action( 'make_spam_blog', $site_id ); } else { do_action( 'make_ham_blog', $site_id ); } } if ( $new_site->mature != $old_site->mature ) { if ( 1 == $new_site->mature ) { do_action( 'mature_blog', $site_id ); } else { do_action( 'unmature_blog', $site_id ); } } if ( $new_site->archived != $old_site->archived ) { if ( 1 == $new_site->archived ) { do_action( 'archive_blog', $site_id ); } else { do_action( 'unarchive_blog', $site_id ); } } if ( $new_site->deleted != $old_site->deleted ) { if ( 1 == $new_site->deleted ) { do_action( 'make_delete_blog', $site_id ); } else { do_action( 'make_undelete_blog', $site_id ); } } if ( $new_site->public != $old_site->public ) { do_action( 'update_blog_public', $site_id, $new_site->public ); } } function wp_maybe_clean_new_site_cache_on_update( $new_site, $old_site ) { if ( $old_site->domain !== $new_site->domain || $old_site->path !== $new_site->path ) { clean_blog_cache( $new_site ); } } function wp_update_blog_public_option_on_site_update( $site_id, $public ) { if ( ! wp_is_site_initialized( $site_id ) ) { return; } update_blog_option( $site_id, 'blog_public', $public ); } function wp_cache_set_sites_last_changed() { wp_cache_set( 'last_changed', microtime(), 'sites' ); } function wp_check_site_meta_support_prefilter( $check ) { if ( ! is_site_meta_supported() ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' ); return false; } return $check; } current_time( 'mysql', true ) ) ); do_action( 'wpmu_blog_updated', $site_id ); } function get_blogaddress_by_id( $blog_id ) { $bloginfo = get_site( (int) $blog_id ); if ( empty( $bloginfo ) ) { return ''; } $scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME ); $scheme = empty( $scheme ) ? 'http' : $scheme; return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path ); } function get_blogaddress_by_name( $blogname ) { if ( is_subdomain_install() ) { if ( 'main' === $blogname ) { $blogname = 'www'; } $url = rtrim( network_home_url(), '/' ); if ( ! empty( $blogname ) ) { $url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url ); } } else { $url = network_home_url( $blogname ); } return esc_url( $url . '/' ); } function get_id_from_blogname( $slug ) { $current_network = get_network(); $slug = trim( $slug, '/' ); if ( is_subdomain_install() ) { $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain ); $path = $current_network->path; } else { $domain = $current_network->domain; $path = $current_network->path . $slug . '/'; } $site_ids = get_sites( array( 'number' => 1, 'fields' => 'ids', 'domain' => $domain, 'path' => $path, 'update_site_meta_cache' => false, ) ); if ( empty( $site_ids ) ) { return null; } return array_shift( $site_ids ); } function get_blog_details( $fields = null, $get_all = true ) { global $wpdb; if ( is_array( $fields ) ) { if ( isset( $fields['blog_id'] ) ) { $blog_id = $fields['blog_id']; } elseif ( isset( $fields['domain'] ) && isset( $fields['path'] ) ) { $key = md5( $fields['domain'] . $fields['path'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } elseif ( isset( $fields['domain'] ) && is_subdomain_install() ) { $key = md5( $fields['domain'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( 'www.' === substr( $fields['domain'], 0, 4 ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } else { return false; } } else { if ( ! $fields ) { $blog_id = get_current_blog_id(); } elseif ( ! is_numeric( $fields ) ) { $blog_id = get_id_from_blogname( $fields ); } else { $blog_id = $fields; } } $blog_id = (int) $blog_id; $all = $get_all ? '' : 'short'; $details = wp_cache_get( $blog_id . $all, 'blog-details' ); if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 == $details ) { return false; } else { wp_cache_delete( $blog_id . $all, 'blog-details' ); unset( $details ); } } else { return $details; } } if ( $get_all ) { $details = wp_cache_get( $blog_id . 'short', 'blog-details' ); } else { $details = wp_cache_get( $blog_id, 'blog-details' ); if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 == $details ) { return false; } else { wp_cache_delete( $blog_id, 'blog-details' ); unset( $details ); } } else { return $details; } } } if ( empty( $details ) ) { $details = WP_Site::get_instance( $blog_id ); if ( ! $details ) { wp_cache_set( $blog_id, -1, 'blog-details' ); return false; } } if ( ! $details instanceof WP_Site ) { $details = new WP_Site( $details ); } if ( ! $get_all ) { wp_cache_set( $blog_id . $all, $details, 'blog-details' ); return $details; } $switched_blog = false; if ( get_current_blog_id() !== $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $details->blogname = get_option( 'blogname' ); $details->siteurl = get_option( 'siteurl' ); $details->post_count = get_option( 'post_count' ); $details->home = get_option( 'home' ); if ( $switched_blog ) { restore_current_blog(); } $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); wp_cache_set( $blog_id . $all, $details, 'blog-details' ); $key = md5( $details->domain . $details->path ); wp_cache_set( $key, $details, 'blog-lookup' ); return $details; } function refresh_blog_details( $blog_id = 0 ) { $blog_id = (int) $blog_id; if ( ! $blog_id ) { $blog_id = get_current_blog_id(); } clean_blog_cache( $blog_id ); } function update_blog_details( $blog_id, $details = array() ) { global $wpdb; if ( empty( $details ) ) { return false; } if ( is_object( $details ) ) { $details = get_object_vars( $details ); } $site = wp_update_site( $blog_id, $details ); if ( is_wp_error( $site ) ) { return false; } return true; } function clean_site_details_cache( $site_id = 0 ) { $site_id = (int) $site_id; if ( ! $site_id ) { $site_id = get_current_blog_id(); } wp_cache_delete( $site_id, 'site-details' ); wp_cache_delete( $site_id, 'blog-details' ); } function get_blog_option( $id, $option, $default = false ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() == $id ) { return get_option( $option, $default ); } switch_to_blog( $id ); $value = get_option( $option, $default ); restore_current_blog(); return apply_filters( "blog_option_{$option}", $value, $id ); } 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; } function delete_blog_option( $id, $option ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() == $id ) { return delete_option( $option ); } switch_to_blog( $id ); $return = delete_option( $option ); restore_current_blog(); return $return; } function update_blog_option( $id, $option, $value, $deprecated = null ) { $id = (int) $id; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } if ( get_current_blog_id() == $id ) { return update_option( $option, $value ); } switch_to_blog( $id ); $return = update_option( $option, $value ); restore_current_blog(); return $return; } function switch_to_blog( $new_blog_id, $deprecated = null ) { global $wpdb; $prev_blog_id = get_current_blog_id(); if ( empty( $new_blog_id ) ) { $new_blog_id = $prev_blog_id; } $GLOBALS['_wp_switched_stack'][] = $prev_blog_id; if ( $new_blog_id == $prev_blog_id ) { do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); $GLOBALS['blog_id'] = $new_blog_id; if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'blog_meta' ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } function restore_current_blog() { global $wpdb; if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { return false; } $new_blog_id = array_pop( $GLOBALS['_wp_switched_stack'] ); $prev_blog_id = get_current_blog_id(); if ( $new_blog_id == $prev_blog_id ) { do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['blog_id'] = $new_blog_id; $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details', 'blog_meta' ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); } } do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } 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 ); } function ms_is_switched() { return ! empty( $GLOBALS['_wp_switched_stack'] ); } function is_archived( $id ) { return get_blog_status( $id, 'archived' ); } function update_archived( $id, $archived ) { update_blog_status( $id, 'archived', $archived ); return $archived; } function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { global $wpdb; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } $allowed_field_names = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); if ( ! in_array( $pref, $allowed_field_names, true ) ) { return $value; } $result = wp_update_site( $blog_id, array( $pref => $value, ) ); if ( is_wp_error( $result ) ) { return false; } return $value; } function get_blog_status( $id, $pref ) { global $wpdb; $details = get_site( $id ); if ( $details ) { return $details->$pref; } return $wpdb->get_var( $wpdb->prepare( "SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id ) ); } function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, 'MU' ); } return $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ), ARRAY_A ); } function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) { $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } wpmu_update_blogs_date(); } function _update_blog_date_on_post_delete( $post_id ) { $post = get_post( $post_id ); $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $post->post_status ) { return; } wpmu_update_blogs_date(); } function _update_posts_count_on_delete( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { return; } update_posts_count(); } function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) { if ( $new_status === $old_status ) { return; } if ( 'post' !== get_post_type( $post ) ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } update_posts_count(); } function wp_count_sites( $network_id = null ) { if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $counts = array(); $args = array( 'network_id' => $network_id, 'number' => 1, 'fields' => 'ids', 'no_found_rows' => false, ); $q = new WP_Site_Query( $args ); $counts['all'] = $q->found_sites; $_args = $args; $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $statuses as $status ) { $_args = $args; $_args[ $status ] = 1; $q = new WP_Site_Query( $_args ); $counts[ $status ] = $q->found_sites; } return $counts; } detect_error(); if ( ! $error ) { return; } if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) { load_default_textdomain(); } $handled = false; if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) { $handled = wp_recovery_mode()->handle_error( $error ); } if ( is_admin() || ! headers_sent() ) { $this->display_error_template( $error, $handled ); } } catch ( Exception $e ) { } } protected function detect_error() { $error = error_get_last(); if ( null === $error ) { return null; } if ( ! $this->should_handle_error( $error ) ) { return null; } return $error; } protected function should_handle_error( $error ) { $error_types_to_handle = array( E_ERROR, E_PARSE, E_USER_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR, ); if ( isset( $error['type'] ) && in_array( $error['type'], $error_types_to_handle, true ) ) { return true; } return (bool) apply_filters( 'wp_should_handle_php_error', false, $error ); } protected function display_error_template( $error, $handled ) { if ( defined( 'WP_CONTENT_DIR' ) ) { $php_error_pluggable = WP_CONTENT_DIR . '/php-error.php'; if ( is_readable( $php_error_pluggable ) ) { require_once $php_error_pluggable; return; } } $this->display_default_error_template( $error, $handled ); } protected function display_default_error_template( $error, $handled ) { if ( ! function_exists( '__' ) ) { wp_load_translations_early(); } if ( ! function_exists( 'wp_die' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } if ( ! class_exists( 'WP_Error' ) ) { require_once ABSPATH . WPINC . '/class-wp-error.php'; } if ( true === $handled && wp_is_recovery_mode() ) { $message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' ); } elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) { $message = __( 'There has been a critical error on this website. Please check your site admin email inbox for instructions.' ); } else { $message = __( 'There has been a critical error on this website.' ); } $message = sprintf( '

                %s

                %s

                ', $message, __( 'https://wordpress.org/support/article/faq-troubleshooting/' ), __( 'Learn more about troubleshooting WordPress.' ) ); $args = array( 'response' => 500, 'exit' => false, ); $message = apply_filters( 'wp_php_error_message', $message, $error ); $args = apply_filters( 'wp_php_error_args', $args, $error ); $wp_error = new WP_Error( 'internal_server_error', $message, array( 'error' => $error, ) ); wp_die( $wp_error, '', $args ); } } name; } if ( ! is_string( $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must be strings.' ), '5.0.0' ); return false; } if ( preg_match( '/[A-Z]+/', $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must not contain uppercase characters.' ), '5.0.0' ); return false; } $name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/'; if ( ! preg_match( $name_matcher, $name ) ) { _doing_it_wrong( __METHOD__, __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ), '5.0.0' ); return false; } if ( $this->is_registered( $name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block type "%s" is already registered.' ), $name ), '5.0.0' ); return false; } if ( ! $block_type ) { $block_type = new WP_Block_Type( $name, $args ); } $this->registered_block_types[ $name ] = $block_type; return $block_type; } public function unregister( $name ) { if ( $name instanceof WP_Block_Type ) { $name = $name->name; } if ( ! $this->is_registered( $name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block type "%s" is not registered.' ), $name ), '5.0.0' ); return false; } $unregistered_block_type = $this->registered_block_types[ $name ]; unset( $this->registered_block_types[ $name ] ); return $unregistered_block_type; } public function get_registered( $name ) { if ( ! $this->is_registered( $name ) ) { return null; } return $this->registered_block_types[ $name ]; } public function get_all_registered() { return $this->registered_block_types; } public function is_registered( $name ) { return isset( $this->registered_block_types[ $name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } '; do_action( 'rss_tag_pre', 'atom-comments' ); ?> - -> - - <?php - if ( is_singular() ) { printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() ); } elseif ( is_search() ) { printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); } else { printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); } ?> - - - - - - - - - - - - - - - - - - - -comment_post_ID ); $GLOBALS['post'] = $comment_post; ?> - - - <?php - if ( ! is_singular() ) { $title = get_the_title( $comment_post->ID ); $title = apply_filters( 'the_title_rss', $title ); printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); } else { printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); } ?> - - - - - - ' . get_comment_author_url() . '';} ?> - - - - - - - - - ]]> - - ]]> - - - comment_parent ) : ?> - - comment_parent ); ?> - - comment_ID, $comment_post->ID ); ?> - - - -post_type, 'post-formats' ) ) { return false; } $_format = get_the_terms( $post->ID, 'post_format' ); if ( empty( $_format ) ) { return false; } $format = reset( $_format ); return str_replace( 'post-format-', '', $format->slug ); } function has_post_format( $format = array(), $post = null ) { $prefixed = array(); if ( $format ) { foreach ( (array) $format as $single ) { $prefixed[] = 'post-format-' . sanitize_key( $single ); } } return has_term( $prefixed, 'post_format', $post ); } function set_post_format( $post, $format ) { $post = get_post( $post ); if ( ! $post ) { return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); } if ( ! empty( $format ) ) { $format = sanitize_key( $format ); if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs(), true ) ) { $format = ''; } else { $format = 'post-format-' . $format; } } return wp_set_post_terms( $post->ID, $format, 'post_format' ); } function get_post_format_strings() { $strings = array( 'standard' => _x( 'Standard', 'Post format' ), 'aside' => _x( 'Aside', 'Post format' ), 'chat' => _x( 'Chat', 'Post format' ), 'gallery' => _x( 'Gallery', 'Post format' ), 'link' => _x( 'Link', 'Post format' ), 'image' => _x( 'Image', 'Post format' ), 'quote' => _x( 'Quote', 'Post format' ), 'status' => _x( 'Status', 'Post format' ), 'video' => _x( 'Video', 'Post format' ), 'audio' => _x( 'Audio', 'Post format' ), ); return $strings; } function get_post_format_slugs() { $slugs = array_keys( get_post_format_strings() ); return array_combine( $slugs, $slugs ); } function get_post_format_string( $slug ) { $strings = get_post_format_strings(); if ( ! $slug ) { return $strings['standard']; } else { return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : ''; } } function get_post_format_link( $format ) { $term = get_term_by( 'slug', 'post-format-' . $format, 'post_format' ); if ( ! $term || is_wp_error( $term ) ) { return false; } return get_term_link( $term ); } function _post_format_request( $qvs ) { if ( ! isset( $qvs['post_format'] ) ) { return $qvs; } $slugs = get_post_format_slugs(); if ( isset( $slugs[ $qvs['post_format'] ] ) ) { $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; } $tax = get_taxonomy( 'post_format' ); if ( ! is_admin() ) { $qvs['post_type'] = $tax->object_type; } return $qvs; } function _post_format_link( $link, $term, $taxonomy ) { global $wp_rewrite; if ( 'post_format' !== $taxonomy ) { return $link; } if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); } else { $link = remove_query_arg( 'post_format', $link ); return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link ); } } function _post_format_get_term( $term ) { if ( isset( $term->slug ) ) { $term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } return $term; } function _post_format_get_terms( $terms, $taxonomies, $args ) { if ( in_array( 'post_format', (array) $taxonomies, true ) ) { if ( isset( $args['fields'] ) && 'names' === $args['fields'] ) { foreach ( $terms as $order => $name ) { $terms[ $order ] = get_post_format_string( str_replace( 'post-format-', '', $name ) ); } } else { foreach ( (array) $terms as $order => $term ) { if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) { $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } } } } return $terms; } function _post_format_wp_get_object_terms( $terms ) { foreach ( (array) $terms as $order => $term ) { if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) { $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } } return $terms; } -> - - - - - -> - - - - - - - -get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1", $site_id ) ); if ( empty( $_site ) || is_wp_error( $_site ) ) { $_site = -1; } wp_cache_add( $site_id, $_site, 'sites' ); } if ( is_numeric( $_site ) ) { return false; } return new WP_Site( $_site ); } public function __construct( $site ) { foreach ( get_object_vars( $site ) as $key => $value ) { $this->$key = $value; } } public function to_array() { return get_object_vars( $this ); } 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: if ( ! did_action( 'ms_loaded' ) ) { return null; } $details = $this->get_details(); if ( isset( $details->$key ) ) { return $details->$key; } } return null; } public function __isset( $key ) { switch ( $key ) { case 'id': case 'network_id': return true; case 'blogname': case 'siteurl': case 'post_count': case 'home': if ( ! did_action( 'ms_loaded' ) ) { return false; } return true; default: if ( ! did_action( 'ms_loaded' ) ) { return false; } $details = $this->get_details(); if ( isset( $details->$key ) ) { return true; } } return false; } public function __set( $key, $value ) { switch ( $key ) { case 'id': $this->blog_id = (string) $value; break; case 'network_id': $this->site_id = (string) $value; break; default: $this->$key = $value; } } private function get_details() { $details = wp_cache_get( $this->blog_id, 'site-details' ); if ( false === $details ) { switch_to_blog( $this->blog_id ); $details = new stdClass(); foreach ( get_object_vars( $this ) as $key => $value ) { $details->$key = $value; } $details->blogname = get_option( 'blogname' ); $details->siteurl = get_option( 'siteurl' ); $details->post_count = get_option( 'post_count' ); $details->home = get_option( 'home' ); restore_current_blog(); wp_cache_set( $this->blog_id, $details, 'site-details' ); } $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); $details = apply_filters( 'site_details', $details ); return $details; } } site_id ); } function generate_random_password( $len = 8 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' ); return wp_generate_password( $len ); } function is_site_admin( $user_login = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' ); if ( empty( $user_login ) ) { $user_id = get_current_user_id(); if ( !$user_id ) return false; } else { $user = get_user_by( 'login', $user_login ); if ( ! $user->exists() ) return false; $user_id = $user->ID; } return is_super_admin( $user_id ); } if ( !function_exists( 'graceful_fail' ) ) : function graceful_fail( $message ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' ); $message = apply_filters( 'graceful_fail', $message ); $message_template = apply_filters( 'graceful_fail_template', ' - - -Error! - - - -

                %s

                - -' ); die( sprintf( $message_template, $message ) ); } endif; function get_user_details( $username ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' ); return get_user_by('login', $username); } function clear_global_post_cache( $post_id ) { _deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' ); } function is_main_blog() { _deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' ); return is_main_site(); } function validate_email( $email, $check_domain = true) { _deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' ); return is_email( $email, $check_domain ); } function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' ); global $wpdb; $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A ); $blog_list = array(); foreach ( (array) $blogs as $details ) { $blog_list[ $details['blog_id'] ] = $details; $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); } if ( ! $blog_list ) { return array(); } if ( 'all' === $num ) { return array_slice( $blog_list, $start, count( $blog_list ) ); } else { return array_slice( $blog_list, $start, $num ); } } function get_most_active_blogs( $num = 10, $display = true ) { _deprecated_function( __FUNCTION__, '3.0.0' ); $blogs = get_blog_list( 0, 'all', false ); if ( is_array( $blogs ) ) { reset( $blogs ); $most_active = array(); $blog_list = array(); foreach ( (array) $blogs as $key => $details ) { $most_active[ $details['blog_id'] ] = $details['postcount']; $blog_list[ $details['blog_id'] ] = $details; } arsort( $most_active ); reset( $most_active ); $t = array(); foreach ( (array) $most_active as $key => $details ) { $t[ $key ] = $blog_list[ $key ]; } unset( $most_active ); $most_active = $t; } if ( $display ) { if ( is_array( $most_active ) ) { reset( $most_active ); foreach ( (array) $most_active as $key => $details ) { $url = esc_url('http://' . $details['domain'] . $details['path']); echo '
              • ' . $details['postcount'] . " $url
              • "; } } } return array_slice( $most_active, 0, $num ); } function wpmu_admin_do_redirect( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' ); $ref = ''; if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_POST['ref'] ) ) { $ref = $_POST['ref']; } elseif ( isset( $_GET['ref'] ) ) { $ref = $_GET['ref']; } if ( $ref ) { $ref = wpmu_admin_redirect_add_updated_param( $ref ); wp_redirect( $ref ); exit; } if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { wp_redirect( $_SERVER['HTTP_REFERER'] ); exit; } $url = wpmu_admin_redirect_add_updated_param( $url ); if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) { wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); } elseif ( isset( $_GET['redirect'] ) ) { if ( 's_' === substr( $_GET['redirect'], 0, 2 ) ) $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); } elseif ( isset( $_POST['redirect'] ) ) { $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); } wp_redirect( $url ); exit; } function wpmu_admin_redirect_add_updated_param( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' ); if ( strpos( $url, 'updated=true' ) === false ) { if ( strpos( $url, '?' ) === false ) return $url . '?updated=true'; else return $url . '&updated=true'; } return $url; } function get_user_id_from_string( $string ) { _deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' ); if ( is_email( $string ) ) $user = get_user_by( 'email', $string ); elseif ( is_numeric( $string ) ) return $string; else $user = get_user_by( 'login', $string ); if ( $user ) return $user->ID; return 0; } function get_blogaddress_by_domain( $domain, $path ) { _deprecated_function( __FUNCTION__, '3.7.0' ); if ( is_subdomain_install() ) { $url = "http://" . $domain.$path; } else { if ( $domain != $_SERVER['HTTP_HOST'] ) { $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; if ( 'www.' !== $blogname ) $url .= $blogname . '/'; } else { $url = 'http://' . $domain . $path; } } return esc_url_raw( $url ); } function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0' ); if ( empty($path) ) $path = '/'; if ( domain_exists($domain, $path, $site_id) ) return __( 'Error: Site URL you’ve entered is already taken.' ); if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) return __( 'Error: There was a problem creating site entry.' ); switch_to_blog($blog_id); install_blog($blog_id); restore_current_blog(); return $blog_id; } function get_admin_users_for_domain( $domain = '', $path = '' ) { _deprecated_function( __FUNCTION__, '4.4.0' ); global $wpdb; if ( ! $domain ) { $network_id = get_current_network_id(); } else { $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1, 'domain' => $domain, 'path' => $path, ) ); $network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0; } if ( $network_id ) return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A ); return false; } function wp_get_sites( $args = array() ) { _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' ); if ( wp_is_large_network() ) return array(); $defaults = array( 'network_id' => get_current_network_id(), 'public' => null, 'archived' => null, 'mature' => null, 'spam' => null, 'deleted' => null, 'limit' => 100, 'offset' => 0, ); $args = wp_parse_args( $args, $defaults ); if( is_array( $args['network_id'] ) ){ $args['network__in'] = $args['network_id']; $args['network_id'] = null; } if( is_numeric( $args['limit'] ) ){ $args['number'] = $args['limit']; $args['limit'] = null; } elseif ( ! $args['limit'] ) { $args['number'] = 0; $args['limit'] = null; } $args['count'] = false; $_sites = get_sites( $args ); $results = array(); foreach ( $_sites as $_site ) { $_site = get_site( $_site ); $results[] = $_site->to_array(); } return $results; } function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { global $wpdb; _deprecated_function( __FUNCTION__, '4.9.0' ); $current_user = wp_get_current_user(); if ( $blog_id == 0 ) { $blog_id = get_current_blog_id(); } $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; return isset( $current_user->$local_key ); } function insert_blog($domain, $path, $site_id) { _deprecated_function( __FUNCTION__, '5.1.0', 'wp_insert_site()' ); $data = array( 'domain' => $domain, 'path' => $path, 'site_id' => $site_id, ); $site_id = wp_insert_site( $data ); if ( is_wp_error( $site_id ) ) { return false; } clean_blog_cache( $site_id ); return $site_id; } function install_blog( $blog_id, $blog_title = '' ) { global $wpdb, $wp_roles; _deprecated_function( __FUNCTION__, '5.1.0' ); $blog_id = (int) $blog_id; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $suppress = $wpdb->suppress_errors(); if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) { die( '

                ' . __( 'Already Installed' ) . '

                ' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '

                ' ); } $wpdb->suppress_errors( $suppress ); $url = get_blogaddress_by_id( $blog_id ); make_db_current_silent( 'blog' ); populate_options(); populate_roles(); $wp_roles = new WP_Roles(); $siteurl = $home = untrailingslashit( $url ); if ( ! is_subdomain_install() ) { if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) { $siteurl = set_url_scheme( $siteurl, 'https' ); } if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) { $home = set_url_scheme( $home, 'https' ); } } update_option( 'siteurl', $siteurl ); update_option( 'home', $home ); if ( get_site_option( 'ms_files_rewriting' ) ) { update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); } else { update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); } update_option( 'blogname', wp_unslash( $blog_title ) ); update_option( 'admin_email', '' ); $table_prefix = $wpdb->get_blog_prefix(); delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); } function install_blog_defaults( $blog_id, $user_id ) { global $wpdb; _deprecated_function( __FUNCTION__, 'MU' ); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $suppress = $wpdb->suppress_errors(); wp_install_defaults( $user_id ); $wpdb->suppress_errors( $suppress ); } function update_user_status( $id, $pref, $value, $deprecated = null ) { global $wpdb; _deprecated_function( __FUNCTION__, '5.3.0', 'wp_update_user()' ); if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.0.2' ); } $wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) ); $user = new WP_User( $id ); clean_user_cache( $user ); if ( 'spam' === $pref ) { if ( $value == 1 ) { do_action( 'make_spam_user', $id ); } else { do_action( 'make_ham_user', $id ); } } return $value; } wp_enqueue_scripts
                ', 'admin_enqueue_scripts', 'login_enqueue_scripts' ); if ( $handle ) { $message .= ' ' . sprintf( __( 'This notice was triggered by the %s handle.' ), '' . $handle . '' ); } _doing_it_wrong( $function, $message, '3.3.0' ); } function wp_print_scripts( $handles = false ) { global $wp_scripts; do_action( 'wp_print_scripts' ); if ( '' === $handles ) { $handles = false; } _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { if ( ! $handles ) { return array(); } } return wp_scripts()->do_items( $handles ); } function wp_add_inline_script( $handle, $data, $position = 'after' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); if ( false !== stripos( $data, '' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Do not pass %1$s tags to %2$s.' ), '<script>', 'wp_add_inline_script()' ), '4.5.0' ); $data = trim( preg_replace( '#]*>(.*)#is', '$1', $data ) ); } return wp_scripts()->add_inline_script( $handle, $data, $position ); } function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); $registered = $wp_scripts->add( $handle, $src, $deps, $ver ); if ( $in_footer ) { $wp_scripts->add_data( $handle, 'group', 1 ); } return $registered; } function wp_localize_script( $handle, $object_name, $l10n ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return false; } return $wp_scripts->localize( $handle, $object_name, $l10n ); } function wp_set_script_translations( $handle, $domain = 'default', $path = null ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return false; } return $wp_scripts->set_translations( $handle, $domain, $path ); } function wp_deregister_script( $handle ) { global $pagenow; _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $current_filter = current_filter(); if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) || ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter ) ) { $not_allowed = array( 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', 'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone', ); if ( in_array( $handle, $not_allowed, true ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), "$handle", 'wp_enqueue_scripts' ), '3.6.0' ); return; } } wp_scripts()->remove( $handle ); } function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); if ( $src || $in_footer ) { $_handle = explode( '?', $handle ); if ( $src ) { $wp_scripts->add( $_handle[0], $src, $deps, $ver ); } if ( $in_footer ) { $wp_scripts->add_data( $_handle[0], 'group', 1 ); } } $wp_scripts->enqueue( $handle ); } function wp_dequeue_script( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_scripts()->dequeue( $handle ); } function wp_script_is( $handle, $list = 'enqueued' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return (bool) wp_scripts()->query( $handle, $list ); } function wp_script_add_data( $handle, $key, $value ) { return wp_scripts()->add_data( $handle, $key, $value ); } query( $args ); } function clean_network_cache( $ids ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $network_ids = (array) $ids; wp_cache_delete_multiple( $network_ids, 'networks' ); foreach ( $network_ids as $id ) { do_action( 'clean_network_cache', $id ); } wp_cache_set( 'last_changed', microtime(), 'networks' ); } function update_network_cache( $networks ) { $data = array(); foreach ( (array) $networks as $network ) { $data[ $network->id ] = $network; } wp_cache_add_multiple( $data, 'networks' ); } function _prime_network_caches( $network_ids ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); if ( ! empty( $non_cached_ids ) ) { $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_network_cache( $fresh_networks ); } } post_type ) { $caps[] = 'do_not_allow'; break; } if ( ( get_option( 'page_for_posts' ) == $post->ID ) || ( get_option( 'page_on_front' ) == $post->ID ) ) { $caps[] = 'manage_options'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'delete_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } if ( $post->post_author && $user_id == $post->post_author ) { if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } else { $caps[] = $post_type->cap->delete_posts; } } else { $caps[] = $post_type->cap->delete_posts; } } else { $caps[] = $post_type->cap->delete_others_posts; if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->delete_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->delete_private_posts; } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; case 'edit_post': case 'edit_page': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'edit_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } if ( $post->post_author && $user_id == $post->post_author ) { if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'trash' === $post->post_status ) { $status = get_post_meta( $post->ID, '_wp_trash_meta_status', true ); if ( in_array( $status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } else { $caps[] = $post_type->cap->edit_posts; } } else { $caps[] = $post_type->cap->edit_posts; } } else { $caps[] = $post_type->cap->edit_others_posts; if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) { $caps[] = $post_type->cap->edit_published_posts; } elseif ( 'private' === $post->post_status ) { $caps[] = $post_type->cap->edit_private_posts; } } if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); } break; case 'read_post': case 'read_page': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } if ( 'revision' === $post->post_type ) { $post = get_post( $post->post_parent ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; if ( 'read_post' === $cap ) { $cap = $post_type->cap->$cap; } break; } $status_obj = get_post_status_object( get_post_status( $post ) ); if ( ! $status_obj ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post status %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post with that status.' ), get_post_status( $post ), $cap ), '5.4.0' ); $caps[] = 'edit_others_posts'; break; } if ( $status_obj->public ) { $caps[] = $post_type->cap->read; break; } if ( $post->post_author && $user_id == $post->post_author ) { $caps[] = $post_type->cap->read; } elseif ( $status_obj->private ) { $caps[] = $post_type->cap->read_private_posts; } else { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } break; case 'publish_post': $post = get_post( $args[0] ); if ( ! $post ) { $caps[] = 'do_not_allow'; break; } $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'The post type %1$s is not registered, so it may not be reliable to check the capability "%2$s" against a post of that type.' ), $post->post_type, $cap ), '4.4.0' ); $caps[] = 'edit_others_posts'; break; } $caps[] = $post_type->cap->publish_posts; break; case 'edit_post_meta': case 'delete_post_meta': case 'add_post_meta': case 'edit_comment_meta': case 'delete_comment_meta': case 'add_comment_meta': case 'edit_term_meta': case 'delete_term_meta': case 'add_term_meta': case 'edit_user_meta': case 'delete_user_meta': case 'add_user_meta': $object_type = explode( '_', $cap )[1]; $object_id = (int) $args[0]; $object_subtype = get_object_subtype( $object_type, $object_id ); if ( empty( $object_subtype ) ) { $caps[] = 'do_not_allow'; break; } $caps = map_meta_cap( "edit_{$object_type}", $user_id, $object_id ); $meta_key = isset( $args[1] ) ? $args[1] : false; if ( $meta_key ) { $allowed = ! is_protected_meta( $meta_key, $object_type ); if ( ! empty( $object_subtype ) && has_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) { $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } else { $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); } if ( ! empty( $object_subtype ) ) { $allowed = apply_filters_deprecated( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ), '4.9.8', "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ); } if ( ! $allowed ) { $caps[] = $cap; } } break; case 'edit_comment': $comment = get_comment( $args[0] ); if ( ! $comment ) { $caps[] = 'do_not_allow'; break; } $post = get_post( $comment->comment_post_ID ); if ( $post ) { $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); } else { $caps = map_meta_cap( 'edit_posts', $user_id ); } break; case 'unfiltered_upload': if ( defined( 'ALLOW_UNFILTERED_UPLOADS' ) && ALLOW_UNFILTERED_UPLOADS && ( ! is_multisite() || is_super_admin( $user_id ) ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'edit_css': case 'unfiltered_html': if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'unfiltered_html'; } break; case 'edit_files': case 'edit_plugins': case 'edit_themes': if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) { $caps[] = 'do_not_allow'; } elseif ( ! wp_is_file_mod_allowed( 'capability_edit_themes' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = $cap; } break; case 'update_plugins': case 'delete_plugins': case 'install_plugins': case 'upload_plugins': case 'update_themes': case 'delete_themes': case 'install_themes': case 'upload_themes': case 'update_core': if ( ! wp_is_file_mod_allowed( 'capability_update_core' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } elseif ( 'upload_themes' === $cap ) { $caps[] = 'install_themes'; } elseif ( 'upload_plugins' === $cap ) { $caps[] = 'install_plugins'; } else { $caps[] = $cap; } break; case 'install_languages': case 'update_languages': if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'install_languages'; } break; case 'activate_plugins': case 'deactivate_plugins': case 'activate_plugin': case 'deactivate_plugin': $caps[] = 'activate_plugins'; if ( is_multisite() ) { $menu_perms = get_site_option( 'menu_items', array() ); if ( empty( $menu_perms['plugins'] ) ) { $caps[] = 'manage_network_plugins'; } } break; case 'resume_plugin': $caps[] = 'resume_plugins'; break; case 'resume_theme': $caps[] = 'resume_themes'; break; case 'delete_user': case 'delete_users': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'delete_users'; } break; case 'create_users': if ( ! is_multisite() ) { $caps[] = $cap; } elseif ( is_super_admin( $user_id ) || get_site_option( 'add_new_users' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'manage_links': if ( get_option( 'link_manager_enabled' ) ) { $caps[] = $cap; } else { $caps[] = 'do_not_allow'; } break; case 'customize': $caps[] = 'edit_theme_options'; break; case 'delete_site': if ( is_multisite() ) { $caps[] = 'manage_options'; } else { $caps[] = 'do_not_allow'; } break; case 'edit_term': case 'delete_term': case 'assign_term': $term_id = (int) $args[0]; $term = get_term( $term_id ); if ( ! $term || is_wp_error( $term ) ) { $caps[] = 'do_not_allow'; break; } $tax = get_taxonomy( $term->taxonomy ); if ( ! $tax ) { $caps[] = 'do_not_allow'; break; } if ( 'delete_term' === $cap && ( get_option( 'default_' . $term->taxonomy ) == $term->term_id || get_option( 'default_term_' . $term->taxonomy ) == $term->term_id ) ) { $caps[] = 'do_not_allow'; break; } $taxo_cap = $cap . 's'; $caps = map_meta_cap( $tax->cap->$taxo_cap, $user_id, $term_id ); break; case 'manage_post_tags': case 'edit_categories': case 'edit_post_tags': case 'delete_categories': case 'delete_post_tags': $caps[] = 'manage_categories'; break; case 'assign_categories': case 'assign_post_tags': $caps[] = 'edit_posts'; break; case 'create_sites': case 'delete_sites': case 'manage_network': case 'manage_sites': case 'manage_network_users': case 'manage_network_plugins': case 'manage_network_themes': case 'manage_network_options': case 'upgrade_network': $caps[] = $cap; break; case 'setup_network': if ( is_multisite() ) { $caps[] = 'manage_network_options'; } else { $caps[] = 'manage_options'; } break; case 'update_php': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'update_core'; } break; case 'update_https': if ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; } else { $caps[] = 'manage_options'; $caps[] = 'update_core'; } break; case 'export_others_personal_data': case 'erase_others_personal_data': case 'manage_privacy_options': $caps[] = is_multisite() ? 'manage_network' : 'manage_options'; break; case 'create_app_password': case 'list_app_passwords': case 'read_app_password': case 'edit_app_password': case 'delete_app_passwords': case 'delete_app_password': $caps = map_meta_cap( 'edit_user', $user_id, $args[0] ); break; default: global $post_type_meta_caps; if ( isset( $post_type_meta_caps[ $cap ] ) ) { return map_meta_cap( $post_type_meta_caps[ $cap ], $user_id, ...$args ); } $block_caps = array( 'edit_blocks', 'edit_others_blocks', 'publish_blocks', 'read_private_blocks', 'delete_blocks', 'delete_private_blocks', 'delete_published_blocks', 'delete_others_blocks', 'edit_private_blocks', 'edit_published_blocks', ); if ( in_array( $cap, $block_caps, true ) ) { $cap = str_replace( '_blocks', '_posts', $cap ); } $caps[] = $cap; } return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args ); } function current_user_can( $capability, ...$args ) { return user_can( wp_get_current_user(), $capability, ...$args ); } function current_user_can_for_blog( $blog_id, $capability, ...$args ) { $switched = is_multisite() ? switch_to_blog( $blog_id ) : false; $can = current_user_can( $capability, ...$args ); if ( $switched ) { restore_current_blog(); } return $can; } function author_can( $post, $capability, ...$args ) { $post = get_post( $post ); if ( ! $post ) { return false; } $author = get_userdata( $post->post_author ); if ( ! $author ) { return false; } return $author->has_cap( $capability, ...$args ); } function user_can( $user, $capability, ...$args ) { if ( ! is_object( $user ) ) { $user = get_userdata( $user ); } if ( empty( $user ) ) { $user = new WP_User( 0 ); $user->init( new stdClass ); } return $user->has_cap( $capability, ...$args ); } function wp_roles() { global $wp_roles; if ( ! isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); } return $wp_roles; } function get_role( $role ) { return wp_roles()->get_role( $role ); } function add_role( $role, $display_name, $capabilities = array() ) { if ( empty( $role ) ) { return; } return wp_roles()->add_role( $role, $display_name, $capabilities ); } function remove_role( $role ) { wp_roles()->remove_role( $role ); } function get_super_admins() { global $super_admins; if ( isset( $super_admins ) ) { return $super_admins; } else { return get_site_option( 'site_admins', array( 'admin' ) ); } } function is_super_admin( $user_id = false ) { if ( ! $user_id ) { $user = wp_get_current_user(); } else { $user = get_userdata( $user_id ); } if ( ! $user || ! $user->exists() ) { return false; } if ( is_multisite() ) { $super_admins = get_super_admins(); if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins, true ) ) { return true; } } else { if ( $user->has_cap( 'delete_users' ) ) { return true; } } return false; } function grant_super_admin( $user_id ) { if ( isset( $GLOBALS['super_admins'] ) || ! is_multisite() ) { return false; } do_action( 'grant_super_admin', $user_id ); $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); $user = get_userdata( $user_id ); if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) { $super_admins[] = $user->user_login; update_site_option( 'site_admins', $super_admins ); do_action( 'granted_super_admin', $user_id ); return true; } return false; } function revoke_super_admin( $user_id ) { if ( isset( $GLOBALS['super_admins'] ) || ! is_multisite() ) { return false; } do_action( 'revoke_super_admin', $user_id ); $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); $user = get_userdata( $user_id ); if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) { $key = array_search( $user->user_login, $super_admins, true ); if ( false !== $key ) { unset( $super_admins[ $key ] ); update_site_option( 'site_admins', $super_admins ); do_action( 'revoked_super_admin', $user_id ); return true; } } return false; } function wp_maybe_grant_install_languages_cap( $allcaps ) { if ( ! empty( $allcaps['update_core'] ) || ! empty( $allcaps['install_plugins'] ) || ! empty( $allcaps['install_themes'] ) ) { $allcaps['install_languages'] = true; } return $allcaps; } function wp_maybe_grant_resume_extensions_caps( $allcaps ) { if ( ! empty( $allcaps['activate_plugins'] ) ) { $allcaps['resume_plugins'] = true; } if ( ! empty( $allcaps['switch_themes'] ) ) { $allcaps['resume_themes'] = true; } return $allcaps; } function wp_maybe_grant_site_health_caps( $allcaps, $caps, $args, $user ) { if ( ! empty( $allcaps['install_plugins'] ) && ( ! is_multisite() || is_super_admin( $user->ID ) ) ) { $allcaps['view_site_health_checks'] = true; } return $allcaps; } return; _x( 'Administrator', 'User role' ); _x( 'Editor', 'User role' ); _x( 'Author', 'User role' ); _x( 'Contributor', 'User role' ); _x( 'Subscriber', 'User role' ); '; do_action( 'rss_tag_pre', 'rss2-comments' ); ?> - - - -> - - - <?php - if ( is_singular() ) { printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() ); } elseif ( is_search() ) { printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); } else { printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); } ?> - - - - - - - - - - - - comment_post_ID ); $GLOBALS['post'] = $comment_post; ?> - - - <?php - if ( ! is_singular() ) { $title = get_the_title( $comment_post->ID ); $title = apply_filters( 'the_title_rss', $title ); printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); } else { printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); } ?> - - - - ]]> - - - - - - ]]> - - ]]> - ]]> - - - comment_ID, $comment_post->ID ); ?> - - - - -use_trailing_slashes ) { $string = trailingslashit( $string ); } else { $string = untrailingslashit( $string ); } return apply_filters( 'user_trailingslashit', $string, $type_of_url ); } function permalink_anchor( $mode = 'id' ) { $post = get_post(); switch ( strtolower( $mode ) ) { case 'title': $title = sanitize_title( $post->post_title ) . '-' . $post->ID; echo ''; break; case 'id': default: echo ''; break; } } function wp_force_plain_post_permalink( $post = null, $sample = null ) { if ( null === $sample && is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) { $sample = true; } else { $post = get_post( $post ); $sample = null !== $sample ? $sample : false; } if ( ! $post ) { return true; } $post_status_obj = get_post_status_object( get_post_status( $post ) ); $post_type_obj = get_post_type_object( get_post_type( $post ) ); if ( ! $post_status_obj || ! $post_type_obj ) { return true; } if ( is_post_status_viewable( $post_status_obj ) || ( $post_status_obj->private && current_user_can( 'read_post', $post->ID ) ) || ( $post_status_obj->protected && $sample ) ) { return false; } return true; } function get_the_permalink( $post = 0, $leavename = false ) { return get_permalink( $post, $leavename ); } function get_permalink( $post = 0, $leavename = false ) { $rewritecode = array( '%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', $leavename ? '' : '%postname%', '%post_id%', '%category%', '%author%', $leavename ? '' : '%pagename%', ); if ( is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) { $sample = true; } else { $post = get_post( $post ); $sample = false; } if ( empty( $post->ID ) ) { return false; } if ( 'page' === $post->post_type ) { return get_page_link( $post, $leavename, $sample ); } elseif ( 'attachment' === $post->post_type ) { return get_attachment_link( $post, $leavename ); } elseif ( in_array( $post->post_type, get_post_types( array( '_builtin' => false ) ), true ) ) { return get_post_permalink( $post, $leavename, $sample ); } $permalink = get_option( 'permalink_structure' ); $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); if ( $permalink && ! wp_force_plain_post_permalink( $post ) ) { $category = ''; if ( strpos( $permalink, '%category%' ) !== false ) { $cats = get_the_category( $post->ID ); if ( $cats ) { $cats = wp_list_sort( $cats, array( 'term_id' => 'ASC', ) ); $category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post ); $category_object = get_term( $category_object, 'category' ); $category = $category_object->slug; if ( $category_object->parent ) { $category = get_category_parents( $category_object->parent, false, '/', true ) . $category; } } if ( empty( $category ) ) { $default_category = get_term( get_option( 'default_category' ), 'category' ); if ( $default_category && ! is_wp_error( $default_category ) ) { $category = $default_category->slug; } } } $author = ''; if ( strpos( $permalink, '%author%' ) !== false ) { $authordata = get_userdata( $post->post_author ); $author = $authordata->user_nicename; } $date = explode( ' ', str_replace( array( '-', ':' ), ' ', $post->post_date ) ); $rewritereplace = array( $date[0], $date[1], $date[2], $date[3], $date[4], $date[5], $post->post_name, $post->ID, $category, $author, $post->post_name, ); $permalink = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) ); $permalink = user_trailingslashit( $permalink, 'single' ); } else { $permalink = home_url( '?p=' . $post->ID ); } return apply_filters( 'post_link', $permalink, $post, $leavename ); } function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { global $wp_rewrite; $post = get_post( $id ); if ( is_wp_error( $post ) ) { return $post; } $post_link = $wp_rewrite->get_extra_permastruct( $post->post_type ); $slug = $post->post_name; $force_plain_link = wp_force_plain_post_permalink( $post ); $post_type = get_post_type_object( $post->post_type ); if ( $post_type->hierarchical ) { $slug = get_page_uri( $post ); } if ( ! empty( $post_link ) && ( ! $force_plain_link || $sample ) ) { if ( ! $leavename ) { $post_link = str_replace( "%$post->post_type%", $slug, $post_link ); } $post_link = home_url( user_trailingslashit( $post_link ) ); } else { if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_plain_link ) ) { $post_link = add_query_arg( $post_type->query_var, $slug, '' ); } else { $post_link = add_query_arg( array( 'post_type' => $post->post_type, 'p' => $post->ID, ), '' ); } $post_link = home_url( $post_link ); } return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample ); } function get_page_link( $post = false, $leavename = false, $sample = false ) { $post = get_post( $post ); if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { $link = home_url( '/' ); } else { $link = _get_page_link( $post, $leavename, $sample ); } return apply_filters( 'page_link', $link, $post->ID, $sample ); } function _get_page_link( $post = false, $leavename = false, $sample = false ) { global $wp_rewrite; $post = get_post( $post ); $force_plain_link = wp_force_plain_post_permalink( $post ); $link = $wp_rewrite->get_page_permastruct(); if ( ! empty( $link ) && ( ( isset( $post->post_status ) && ! $force_plain_link ) || $sample ) ) { if ( ! $leavename ) { $link = str_replace( '%pagename%', get_page_uri( $post ), $link ); } $link = home_url( $link ); $link = user_trailingslashit( $link, 'page' ); } else { $link = home_url( '?page_id=' . $post->ID ); } return apply_filters( '_get_page_link', $link, $post->ID ); } function get_attachment_link( $post = null, $leavename = false ) { global $wp_rewrite; $link = false; $post = get_post( $post ); $force_plain_link = wp_force_plain_post_permalink( $post ); $parent_id = $post->post_parent; $parent = $parent_id ? get_post( $parent_id ) : false; $parent_valid = true; if ( $parent_id && ( $post->post_parent === $post->ID || ! $parent || ! is_post_type_viewable( get_post_type( $parent ) ) ) ) { $parent_valid = false; } if ( $force_plain_link || ! $parent_valid ) { $link = false; } elseif ( $wp_rewrite->using_permalinks() && $parent ) { if ( 'page' === $parent->post_type ) { $parentlink = _get_page_link( $post->post_parent ); } else { $parentlink = get_permalink( $post->post_parent ); } if ( is_numeric( $post->post_name ) || false !== strpos( get_option( 'permalink_structure' ), '%category%' ) ) { $name = 'attachment/' . $post->post_name; } else { $name = $post->post_name; } if ( strpos( $parentlink, '?' ) === false ) { $link = user_trailingslashit( trailingslashit( $parentlink ) . '%postname%' ); } if ( ! $leavename ) { $link = str_replace( '%postname%', $name, $link ); } } elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) { $link = home_url( user_trailingslashit( $post->post_name ) ); } if ( ! $link ) { $link = home_url( '/?attachment_id=' . $post->ID ); } return apply_filters( 'attachment_link', $link, $post->ID ); } function get_year_link( $year ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } $yearlink = $wp_rewrite->get_year_permastruct(); if ( ! empty( $yearlink ) ) { $yearlink = str_replace( '%year%', $year, $yearlink ); $yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) ); } else { $yearlink = home_url( '?m=' . $year ); } return apply_filters( 'year_link', $yearlink, $year ); } function get_month_link( $year, $month ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } if ( ! $month ) { $month = current_time( 'm' ); } $monthlink = $wp_rewrite->get_month_permastruct(); if ( ! empty( $monthlink ) ) { $monthlink = str_replace( '%year%', $year, $monthlink ); $monthlink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $monthlink ); $monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) ); } else { $monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) ); } return apply_filters( 'month_link', $monthlink, $year, $month ); } function get_day_link( $year, $month, $day ) { global $wp_rewrite; if ( ! $year ) { $year = current_time( 'Y' ); } if ( ! $month ) { $month = current_time( 'm' ); } if ( ! $day ) { $day = current_time( 'j' ); } $daylink = $wp_rewrite->get_day_permastruct(); if ( ! empty( $daylink ) ) { $daylink = str_replace( '%year%', $year, $daylink ); $daylink = str_replace( '%monthnum%', zeroise( (int) $month, 2 ), $daylink ); $daylink = str_replace( '%day%', zeroise( (int) $day, 2 ), $daylink ); $daylink = home_url( user_trailingslashit( $daylink, 'day' ) ); } else { $daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) ); } return apply_filters( 'day_link', $daylink, $year, $month, $day ); } function the_feed_link( $anchor, $feed = '' ) { $link = '' . $anchor . ''; echo apply_filters( 'the_feed_link', $link, $feed ); } function get_feed_link( $feed = '' ) { global $wp_rewrite; $permalink = $wp_rewrite->get_feed_permastruct(); if ( $permalink ) { if ( false !== strpos( $feed, 'comments_' ) ) { $feed = str_replace( 'comments_', '', $feed ); $permalink = $wp_rewrite->get_comment_feed_permastruct(); } if ( get_default_feed() == $feed ) { $feed = ''; } $permalink = str_replace( '%feed%', $feed, $permalink ); $permalink = preg_replace( '#/+#', '/', "/$permalink" ); $output = home_url( user_trailingslashit( $permalink, 'feed' ) ); } else { if ( empty( $feed ) ) { $feed = get_default_feed(); } if ( false !== strpos( $feed, 'comments_' ) ) { $feed = str_replace( 'comments_', 'comments-', $feed ); } $output = home_url( "?feed={$feed}" ); } return apply_filters( 'feed_link', $output, $feed ); } function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { $post_id = absint( $post_id ); if ( ! $post_id ) { $post_id = get_the_ID(); } if ( empty( $feed ) ) { $feed = get_default_feed(); } $post = get_post( $post_id ); if ( ! $post instanceof WP_Post ) { return ''; } $unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent; if ( get_option( 'permalink_structure' ) ) { if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) { $url = _get_page_link( $post_id ); } else { $url = get_permalink( $post_id ); } if ( $unattached ) { $url = home_url( '/feed/' ); if ( get_default_feed() !== $feed ) { $url .= "$feed/"; } $url = add_query_arg( 'attachment_id', $post_id, $url ); } else { $url = trailingslashit( $url ) . 'feed'; if ( get_default_feed() != $feed ) { $url .= "/$feed"; } $url = user_trailingslashit( $url, 'single_feed' ); } } else { if ( $unattached ) { $url = add_query_arg( array( 'feed' => $feed, 'attachment_id' => $post_id, ), home_url( '/' ) ); } elseif ( 'page' === $post->post_type ) { $url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id, ), home_url( '/' ) ); } else { $url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id, ), home_url( '/' ) ); } } return apply_filters( 'post_comments_feed_link', $url ); } function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { $url = get_post_comments_feed_link( $post_id, $feed ); if ( empty( $link_text ) ) { $link_text = __( 'Comments Feed' ); } $link = '' . $link_text . ''; echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed ); } function get_author_feed_link( $author_id, $feed = '' ) { $author_id = (int) $author_id; $permalink_structure = get_option( 'permalink_structure' ); if ( empty( $feed ) ) { $feed = get_default_feed(); } if ( ! $permalink_structure ) { $link = home_url( "?feed=$feed&author=" . $author_id ); } else { $link = get_author_posts_url( $author_id ); if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; } $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); } $link = apply_filters( 'author_feed_link', $link, $feed ); return $link; } function get_category_feed_link( $cat, $feed = '' ) { return get_term_feed_link( $cat, 'category', $feed ); } function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) { if ( ! is_object( $term ) ) { $term = (int) $term; } $term = get_term( $term, $taxonomy ); if ( empty( $term ) || is_wp_error( $term ) ) { return false; } $taxonomy = $term->taxonomy; if ( empty( $feed ) ) { $feed = get_default_feed(); } $permalink_structure = get_option( 'permalink_structure' ); if ( ! $permalink_structure ) { if ( 'category' === $taxonomy ) { $link = home_url( "?feed=$feed&cat=$term->term_id" ); } elseif ( 'post_tag' === $taxonomy ) { $link = home_url( "?feed=$feed&tag=$term->slug" ); } else { $t = get_taxonomy( $taxonomy ); $link = home_url( "?feed=$feed&$t->query_var=$term->slug" ); } } else { $link = get_term_link( $term, $term->taxonomy ); if ( get_default_feed() == $feed ) { $feed_link = 'feed'; } else { $feed_link = "feed/$feed"; } $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); } if ( 'category' === $taxonomy ) { $link = apply_filters( 'category_feed_link', $link, $feed ); } elseif ( 'post_tag' === $taxonomy ) { $link = apply_filters( 'tag_feed_link', $link, $feed ); } else { $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy ); } return $link; } function get_tag_feed_link( $tag, $feed = '' ) { return get_term_feed_link( $tag, 'post_tag', $feed ); } function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) { return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) ); } function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { $link = edit_term_link( $link, '', '', $tag, false ); echo $before . apply_filters( 'edit_tag_link', $link ) . $after; } function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { $term = get_term( $term, $taxonomy ); if ( ! $term || is_wp_error( $term ) ) { return; } $tax = get_taxonomy( $term->taxonomy ); $term_id = $term->term_id; if ( ! $tax || ! current_user_can( 'edit_term', $term_id ) ) { return; } $args = array( 'taxonomy' => $taxonomy, 'tag_ID' => $term_id, ); if ( $object_type ) { $args['post_type'] = $object_type; } elseif ( ! empty( $tax->object_type ) ) { $args['post_type'] = reset( $tax->object_type ); } if ( $tax->show_ui ) { $location = add_query_arg( $args, admin_url( 'term.php' ) ); } else { $location = ''; } return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type ); } function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) { if ( is_null( $term ) ) { $term = get_queried_object(); } else { $term = get_term( $term ); } if ( ! $term ) { return; } $tax = get_taxonomy( $term->taxonomy ); if ( ! current_user_can( 'edit_term', $term->term_id ) ) { return; } if ( empty( $link ) ) { $link = __( 'Edit This' ); } $link = '' . $link . ''; $link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after; if ( $echo ) { echo $link; } else { return $link; } } function get_search_link( $query = '' ) { global $wp_rewrite; if ( empty( $query ) ) { $search = get_search_query( false ); } else { $search = stripslashes( $query ); } $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = home_url( '?s=' . urlencode( $search ) ); } else { $search = urlencode( $search ); $search = str_replace( '%2F', '/', $search ); $link = str_replace( '%search%', $search, $permastruct ); $link = home_url( user_trailingslashit( $link, 'search' ) ); } return apply_filters( 'search_link', $link, $search ); } function get_search_feed_link( $search_query = '', $feed = '' ) { global $wp_rewrite; $link = get_search_link( $search_query ); if ( empty( $feed ) ) { $feed = get_default_feed(); } $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = add_query_arg( 'feed', $feed, $link ); } else { $link = trailingslashit( $link ); $link .= "feed/$feed/"; } return apply_filters( 'search_feed_link', $link, $feed, 'posts' ); } function get_search_comments_feed_link( $search_query = '', $feed = '' ) { global $wp_rewrite; if ( empty( $feed ) ) { $feed = get_default_feed(); } $link = get_search_feed_link( $search_query, $feed ); $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = add_query_arg( 'feed', 'comments-' . $feed, $link ); } else { $link = add_query_arg( 'withcomments', 1, $link ); } return apply_filters( 'search_feed_link', $link, $feed, 'comments' ); } function get_post_type_archive_link( $post_type ) { global $wp_rewrite; $post_type_obj = get_post_type_object( $post_type ); if ( ! $post_type_obj ) { return false; } if ( 'post' === $post_type ) { $show_on_front = get_option( 'show_on_front' ); $page_for_posts = get_option( 'page_for_posts' ); if ( 'page' === $show_on_front && $page_for_posts ) { $link = get_permalink( $page_for_posts ); } else { $link = get_home_url(); } return apply_filters( 'post_type_archive_link', $link, $post_type ); } if ( ! $post_type_obj->has_archive ) { return false; } if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) { $struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive; if ( $post_type_obj->rewrite['with_front'] ) { $struct = $wp_rewrite->front . $struct; } else { $struct = $wp_rewrite->root . $struct; } $link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) ); } else { $link = home_url( '?post_type=' . $post_type ); } return apply_filters( 'post_type_archive_link', $link, $post_type ); } function get_post_type_archive_feed_link( $post_type, $feed = '' ) { $default_feed = get_default_feed(); if ( empty( $feed ) ) { $feed = $default_feed; } $link = get_post_type_archive_link( $post_type ); if ( ! $link ) { return false; } $post_type_obj = get_post_type_object( $post_type ); if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) { $link = trailingslashit( $link ); $link .= 'feed/'; if ( $feed != $default_feed ) { $link .= "$feed/"; } } else { $link = add_query_arg( 'feed', $feed, $link ); } return apply_filters( 'post_type_archive_feed_link', $link, $feed ); } function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) { $post = get_post( $post ); if ( ! $post ) { return; } $post_type_object = get_post_type_object( $post->post_type ); if ( is_post_type_viewable( $post_type_object ) ) { if ( ! $preview_link ) { $preview_link = set_url_scheme( get_permalink( $post ) ); } $query_args['preview'] = 'true'; $preview_link = add_query_arg( $query_args, $preview_link ); } return apply_filters( 'preview_post_link', $preview_link, $post ); } function get_edit_post_link( $id = 0, $context = 'display' ) { $post = get_post( $id ); if ( ! $post ) { return; } if ( 'revision' === $post->post_type ) { $action = ''; } elseif ( 'display' === $context ) { $action = '&action=edit'; } else { $action = '&action=edit'; } $post_type_object = get_post_type_object( $post->post_type ); if ( ! $post_type_object ) { return; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return; } if ( $post_type_object->_edit_link ) { $link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ); } else { $link = ''; } return apply_filters( 'get_edit_post_link', $link, $post->ID, $context ); } function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) { $post = get_post( $id ); if ( ! $post ) { return; } $url = get_edit_post_link( $post->ID ); if ( ! $url ) { return; } if ( null === $text ) { $text = __( 'Edit This' ); } $link = '' . $text . ''; echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after; } function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } $post = get_post( $id ); if ( ! $post ) { return; } $post_type_object = get_post_type_object( $post->post_type ); if ( ! $post_type_object ) { return; } if ( ! current_user_can( 'delete_post', $post->ID ) ) { return; } $action = ( $force_delete || ! EMPTY_TRASH_DAYS ) ? 'delete' : 'trash'; $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) ); return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete ); } function get_edit_comment_link( $comment_id = 0 ) { $comment = get_comment( $comment_id ); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; } $location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID; return apply_filters( 'get_edit_comment_link', $location ); } function edit_comment_link( $text = null, $before = '', $after = '' ) { $comment = get_comment(); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; } if ( null === $text ) { $text = __( 'Edit This' ); } $link = '' . $text . ''; echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after; } function get_edit_bookmark_link( $link = 0 ) { $link = get_bookmark( $link ); if ( ! current_user_can( 'manage_links' ) ) { return; } $location = admin_url( 'link.php?action=edit&link_id=' ) . $link->link_id; return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id ); } function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) { $bookmark = get_bookmark( $bookmark ); if ( ! current_user_can( 'manage_links' ) ) { return; } if ( empty( $link ) ) { $link = __( 'Edit This' ); } $link = '' . $link . ''; echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after; } function get_edit_user_link( $user_id = null ) { if ( ! $user_id ) { $user_id = get_current_user_id(); } if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) { return ''; } $user = get_userdata( $user_id ); if ( ! $user ) { return ''; } if ( get_current_user_id() == $user->ID ) { $link = get_edit_profile_url( $user->ID ); } else { $link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) ); } return apply_filters( 'get_edit_user_link', $link, $user->ID ); } function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy ); } function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy ); } function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { global $wpdb; $post = get_post(); if ( ! $post || ! taxonomy_exists( $taxonomy ) ) { return null; } $current_post_date = $post->post_date; $join = ''; $where = ''; $adjacent = $previous ? 'previous' : 'next'; if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) { if ( false !== strpos( $excluded_terms, ' and ' ) ) { _deprecated_argument( __FUNCTION__, '3.3.0', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) ); $excluded_terms = explode( ' and ', $excluded_terms ); } else { $excluded_terms = explode( ',', $excluded_terms ); } $excluded_terms = array_map( 'intval', $excluded_terms ); } $excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms ); if ( $in_same_term || ! empty( $excluded_terms ) ) { if ( $in_same_term ) { $join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $where .= $wpdb->prepare( 'AND tt.taxonomy = %s', $taxonomy ); if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { return ''; } $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); $term_array = array_diff( $term_array, (array) $excluded_terms ); $term_array = array_map( 'intval', $term_array ); if ( ! $term_array || is_wp_error( $term_array ) ) { return ''; } $where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')'; } if ( ! empty( $excluded_terms ) ) { $where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )'; } } if ( is_user_logged_in() ) { $user_id = get_current_user_id(); $post_type_object = get_post_type_object( $post->post_type ); if ( empty( $post_type_object ) ) { $post_type_cap = $post->post_type; $read_private_cap = 'read_private_' . $post_type_cap . 's'; } else { $read_private_cap = $post_type_object->cap->read_private_posts; } $private_states = get_post_stati( array( 'private' => true ) ); $where .= " AND ( p.post_status = 'publish'"; foreach ( $private_states as $state ) { if ( current_user_can( $read_private_cap ) ) { $where .= $wpdb->prepare( ' OR p.post_status = %s', $state ); } else { $where .= $wpdb->prepare( ' OR (p.post_author = %d AND p.post_status = %s)', $user_id, $state ); } } $where .= ' )'; } else { $where .= " AND p.post_status = 'publish'"; } $op = $previous ? '<' : '>'; $order = $previous ? 'DESC' : 'ASC'; $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post ); $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post ); $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order ); $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; $query_key = 'adjacent_post_' . md5( $query ); $result = wp_cache_get( $query_key, 'counts' ); if ( false !== $result ) { if ( $result ) { $result = get_post( $result ); } return $result; } $result = $wpdb->get_var( $query ); if ( null === $result ) { $result = ''; } wp_cache_set( $query_key, $result, 'counts' ); if ( $result ) { $result = get_post( $result ); } return $result; } function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { $post = get_post(); if ( $previous && is_attachment() && $post ) { $post = get_post( $post->post_parent ); } else { $post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( empty( $post ) ) { return; } $post_title = the_title_attribute( array( 'echo' => false, 'post' => $post, ) ); if ( empty( $post_title ) ) { $post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); } $date = mysql2date( get_option( 'date_format' ), $post->post_date ); $title = str_replace( '%title', $post_title, $title ); $title = str_replace( '%date', $date, $title ); $link = $previous ? "\n"; $adjacent = $previous ? 'previous' : 'next'; return apply_filters( "{$adjacent}_post_rel_link", $link ); } function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy ); echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy ); } function adjacent_posts_rel_link_wp_head() { if ( ! is_single() || is_attachment() ) { return; } adjacent_posts_rel_link(); } function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy ); } function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy ); } function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) { $post = get_post(); if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) { return null; } $query_args = array( 'posts_per_page' => 1, 'order' => $start ? 'ASC' : 'DESC', 'update_post_term_cache' => false, 'update_post_meta_cache' => false, ); $term_array = array(); if ( ! is_array( $excluded_terms ) ) { if ( ! empty( $excluded_terms ) ) { $excluded_terms = explode( ',', $excluded_terms ); } else { $excluded_terms = array(); } } if ( $in_same_term || ! empty( $excluded_terms ) ) { if ( $in_same_term ) { $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); } if ( ! empty( $excluded_terms ) ) { $excluded_terms = array_map( 'intval', $excluded_terms ); $excluded_terms = array_diff( $excluded_terms, $term_array ); $inverse_terms = array(); foreach ( $excluded_terms as $excluded_term ) { $inverse_terms[] = $excluded_term * -1; } $excluded_terms = $inverse_terms; } $query_args['tax_query'] = array( array( 'taxonomy' => $taxonomy, 'terms' => array_merge( $term_array, $excluded_terms ), ), ); } return get_posts( $query_args ); } function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy ); } function previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); } function get_next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy ); } function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); } function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { if ( $previous && is_attachment() ) { $post = get_post( get_post()->post_parent ); } else { $post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy ); } if ( ! $post ) { $output = ''; } else { $title = $post->post_title; if ( empty( $post->post_title ) ) { $title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); } $title = apply_filters( 'the_title', $title, $post->ID ); $date = mysql2date( get_option( 'date_format' ), $post->post_date ); $rel = $previous ? 'prev' : 'next'; $string = ''; $inlink = str_replace( '%title', $title, $link ); $inlink = str_replace( '%date', $date, $inlink ); $inlink = $string . $inlink . ''; $output = str_replace( '%link', $inlink, $format ); } $adjacent = $previous ? 'previous' : 'next'; return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent ); } function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy ); } function get_pagenum_link( $pagenum = 1, $escape = true ) { global $wp_rewrite; $pagenum = (int) $pagenum; $request = remove_query_arg( 'paged' ); $home_root = parse_url( home_url() ); $home_root = ( isset( $home_root['path'] ) ) ? $home_root['path'] : ''; $home_root = preg_quote( $home_root, '|' ); $request = preg_replace( '|^' . $home_root . '|i', '', $request ); $request = preg_replace( '|^/+|', '', $request ); if ( ! $wp_rewrite->using_permalinks() || is_admin() ) { $base = trailingslashit( get_bloginfo( 'url' ) ); if ( $pagenum > 1 ) { $result = add_query_arg( 'paged', $pagenum, $base . $request ); } else { $result = $base . $request; } } else { $qs_regex = '|\?.*?$|'; preg_match( $qs_regex, $request, $qs_match ); if ( ! empty( $qs_match[0] ) ) { $query_string = $qs_match[0]; $request = preg_replace( $qs_regex, '', $request ); } else { $query_string = ''; } $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request ); $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request ); $request = ltrim( $request, '/' ); $base = trailingslashit( get_bloginfo( 'url' ) ); if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) { $base .= $wp_rewrite->index . '/'; } if ( $pagenum > 1 ) { $request = ( ( ! empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $pagenum, 'paged' ); } $result = $base . $request . $query_string; } $result = apply_filters( 'get_pagenum_link', $result, $pagenum ); if ( $escape ) { return esc_url( $result ); } else { return esc_url_raw( $result ); } } function get_next_posts_page_link( $max_page = 0 ) { global $paged; if ( ! is_single() ) { if ( ! $paged ) { $paged = 1; } $nextpage = (int) $paged + 1; if ( ! $max_page || $max_page >= $nextpage ) { return get_pagenum_link( $nextpage ); } } } function next_posts( $max_page = 0, $echo = true ) { $output = esc_url( get_next_posts_page_link( $max_page ) ); if ( $echo ) { echo $output; } else { return $output; } } function get_next_posts_link( $label = null, $max_page = 0 ) { global $paged, $wp_query; if ( ! $max_page ) { $max_page = $wp_query->max_num_pages; } if ( ! $paged ) { $paged = 1; } $nextpage = (int) $paged + 1; if ( null === $label ) { $label = __( 'Next Page »' ); } if ( ! is_single() && ( $nextpage <= $max_page ) ) { $attr = apply_filters( 'next_posts_link_attributes', '' ); return '" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } } function next_posts_link( $label = null, $max_page = 0 ) { echo get_next_posts_link( $label, $max_page ); } function get_previous_posts_page_link() { global $paged; if ( ! is_single() ) { $nextpage = (int) $paged - 1; if ( $nextpage < 1 ) { $nextpage = 1; } return get_pagenum_link( $nextpage ); } } function previous_posts( $echo = true ) { $output = esc_url( get_previous_posts_page_link() ); if ( $echo ) { echo $output; } else { return $output; } } function get_previous_posts_link( $label = null ) { global $paged; if ( null === $label ) { $label = __( '« Previous Page' ); } if ( ! is_single() && $paged > 1 ) { $attr = apply_filters( 'previous_posts_link_attributes', '' ); return '" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } } function previous_posts_link( $label = null ) { echo get_previous_posts_link( $label ); } function get_posts_nav_link( $args = array() ) { global $wp_query; $return = ''; if ( ! is_singular() ) { $defaults = array( 'sep' => ' — ', 'prelabel' => __( '« Previous Page' ), 'nxtlabel' => __( 'Next Page »' ), ); $args = wp_parse_args( $args, $defaults ); $max_num_pages = $wp_query->max_num_pages; $paged = get_query_var( 'paged' ); if ( $paged < 2 || $paged >= $max_num_pages ) { $args['sep'] = ''; } if ( $max_num_pages > 1 ) { $return = get_previous_posts_link( $args['prelabel'] ); $return .= preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $args['sep'] ); $return .= get_next_posts_link( $args['nxtlabel'] ); } } return $return; } function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) { $args = array_filter( compact( 'sep', 'prelabel', 'nxtlabel' ) ); echo get_posts_nav_link( $args ); } function get_the_post_navigation( $args = array() ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => '%title', 'next_text' => '%title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __( 'Post navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'post-navigation', ) ); $navigation = ''; $previous = get_previous_post_link( '', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); $next = get_next_post_link( '', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); if ( $previous || $next ) { $navigation = _navigation_markup( $previous . $next, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_post_navigation( $args = array() ) { echo get_the_post_navigation( $args ); } function get_the_posts_navigation( $args = array() ) { $navigation = ''; if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => __( 'Older posts' ), 'next_text' => __( 'Newer posts' ), 'screen_reader_text' => __( 'Posts navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'posts-navigation', ) ); $next_link = get_previous_posts_link( $args['next_text'] ); $prev_link = get_next_posts_link( $args['prev_text'] ); if ( $prev_link ) { $navigation .= ''; } if ( $next_link ) { $navigation .= ''; } $navigation = _navigation_markup( $navigation, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_posts_navigation( $args = array() ) { echo get_the_posts_navigation( $args ); } function get_the_posts_pagination( $args = array() ) { $navigation = ''; if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'mid_size' => 1, 'prev_text' => _x( 'Previous', 'previous set of posts' ), 'next_text' => _x( 'Next', 'next set of posts' ), 'screen_reader_text' => __( 'Posts navigation' ), 'aria_label' => __( 'Posts' ), 'class' => 'pagination', ) ); if ( isset( $args['type'] ) && 'array' === $args['type'] ) { $args['type'] = 'plain'; } $links = paginate_links( $args ); if ( $links ) { $navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } } return $navigation; } function the_posts_pagination( $args = array() ) { echo get_the_posts_pagination( $args ); } function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '', $aria_label = '' ) { if ( empty( $screen_reader_text ) ) { $screen_reader_text = __( 'Posts navigation' ); } if ( empty( $aria_label ) ) { $aria_label = $screen_reader_text; } $template = ' - '; $template = apply_filters( 'navigation_markup_template', $template, $class ); return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links, esc_html( $aria_label ) ); } function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { global $wp_rewrite; $pagenum = (int) $pagenum; $result = get_permalink(); if ( 'newest' === get_option( 'default_comments_page' ) ) { if ( $pagenum != $max_page ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } } elseif ( $pagenum > 1 ) { if ( $wp_rewrite->using_permalinks() ) { $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' ); } else { $result = add_query_arg( 'cpage', $pagenum, $result ); } } $result .= '#comments'; return apply_filters( 'get_comments_pagenum_link', $result ); } function get_next_comments_link( $label = '', $max_page = 0 ) { global $wp_query; if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( ! $page ) { $page = 1; } $nextpage = (int) $page + 1; if ( empty( $max_page ) ) { $max_page = $wp_query->max_num_comment_pages; } if ( empty( $max_page ) ) { $max_page = get_comment_pages_count(); } if ( $nextpage > $max_page ) { return; } if ( empty( $label ) ) { $label = __( 'Newer Comments »' ); } return '' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } function next_comments_link( $label = '', $max_page = 0 ) { echo get_next_comments_link( $label, $max_page ); } function get_previous_comments_link( $label = '' ) { if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( (int) $page <= 1 ) { return; } $prevpage = (int) $page - 1; if ( empty( $label ) ) { $label = __( '« Older Comments' ); } return '' . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . ''; } function previous_comments_link( $label = '' ) { echo get_previous_comments_link( $label ); } function paginate_comments_links( $args = array() ) { global $wp_rewrite; if ( ! is_singular() ) { return; } $page = get_query_var( 'cpage' ); if ( ! $page ) { $page = 1; } $max_page = get_comment_pages_count(); $defaults = array( 'base' => add_query_arg( 'cpage', '%#%' ), 'format' => '', 'total' => $max_page, 'current' => $page, 'echo' => true, 'type' => 'plain', 'add_fragment' => '#comments', ); if ( $wp_rewrite->using_permalinks() ) { $defaults['base'] = user_trailingslashit( trailingslashit( get_permalink() ) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged' ); } $args = wp_parse_args( $args, $defaults ); $page_links = paginate_links( $args ); if ( $args['echo'] && 'array' !== $args['type'] ) { echo $page_links; } else { return $page_links; } } function get_the_comments_navigation( $args = array() ) { $navigation = ''; if ( get_comment_pages_count() > 1 ) { if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'prev_text' => __( 'Older comments' ), 'next_text' => __( 'Newer comments' ), 'screen_reader_text' => __( 'Comments navigation' ), 'aria_label' => __( 'Comments' ), 'class' => 'comment-navigation', ) ); $prev_link = get_previous_comments_link( $args['prev_text'] ); $next_link = get_next_comments_link( $args['next_text'] ); if ( $prev_link ) { $navigation .= ''; } if ( $next_link ) { $navigation .= ''; } $navigation = _navigation_markup( $navigation, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_comments_navigation( $args = array() ) { echo get_the_comments_navigation( $args ); } function get_the_comments_pagination( $args = array() ) { $navigation = ''; if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) { $args['aria_label'] = $args['screen_reader_text']; } $args = wp_parse_args( $args, array( 'screen_reader_text' => __( 'Comments navigation' ), 'aria_label' => __( 'Comments' ), 'class' => 'comments-pagination', ) ); $args['echo'] = false; if ( isset( $args['type'] ) && 'array' === $args['type'] ) { $args['type'] = 'plain'; } $links = paginate_comments_links( $args ); if ( $links ) { $navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] ); } return $navigation; } function the_comments_pagination( $args = array() ) { echo get_the_comments_pagination( $args ); } function home_url( $path = '', $scheme = null ) { return get_home_url( null, $path, $scheme ); } function get_home_url( $blog_id = null, $path = '', $scheme = null ) { $orig_scheme = $scheme; if ( empty( $blog_id ) || ! is_multisite() ) { $url = get_option( 'home' ); } else { switch_to_blog( $blog_id ); $url = get_option( 'home' ); restore_current_blog(); } if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) { if ( is_ssl() ) { $scheme = 'https'; } else { $scheme = parse_url( $url, PHP_URL_SCHEME ); } } $url = set_url_scheme( $url, $scheme ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); } function site_url( $path = '', $scheme = null ) { return get_site_url( null, $path, $scheme ); } function get_site_url( $blog_id = null, $path = '', $scheme = null ) { if ( empty( $blog_id ) || ! is_multisite() ) { $url = get_option( 'siteurl' ); } else { switch_to_blog( $blog_id ); $url = get_option( 'siteurl' ); restore_current_blog(); } $url = set_url_scheme( $url, $scheme ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'site_url', $url, $path, $scheme, $blog_id ); } function admin_url( $path = '', $scheme = 'admin' ) { return get_admin_url( null, $path, $scheme ); } function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) { $url = get_site_url( $blog_id, 'wp-admin/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'admin_url', $url, $path, $blog_id, $scheme ); } function includes_url( $path = '', $scheme = null ) { $url = site_url( '/' . WPINC . '/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'includes_url', $url, $path, $scheme ); } function content_url( $path = '' ) { $url = set_url_scheme( WP_CONTENT_URL ); if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'content_url', $url, $path ); } function plugins_url( $path = '', $plugin = '' ) { $path = wp_normalize_path( $path ); $plugin = wp_normalize_path( $plugin ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); if ( ! empty( $plugin ) && 0 === strpos( $plugin, $mu_plugin_dir ) ) { $url = WPMU_PLUGIN_URL; } else { $url = WP_PLUGIN_URL; } $url = set_url_scheme( $url ); if ( ! empty( $plugin ) && is_string( $plugin ) ) { $folder = dirname( plugin_basename( $plugin ) ); if ( '.' !== $folder ) { $url .= '/' . ltrim( $folder, '/' ); } } if ( $path && is_string( $path ) ) { $url .= '/' . ltrim( $path, '/' ); } return apply_filters( 'plugins_url', $url, $path, $plugin ); } function network_site_url( $path = '', $scheme = null ) { if ( ! is_multisite() ) { return site_url( $path, $scheme ); } $current_network = get_network(); if ( 'relative' === $scheme ) { $url = $current_network->path; } else { $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme ); } if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_site_url', $url, $path, $scheme ); } function network_home_url( $path = '', $scheme = null ) { if ( ! is_multisite() ) { return home_url( $path, $scheme ); } $current_network = get_network(); $orig_scheme = $scheme; if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) { $scheme = is_ssl() ? 'https' : 'http'; } if ( 'relative' === $scheme ) { $url = $current_network->path; } else { $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme ); } if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_home_url', $url, $path, $orig_scheme ); } function network_admin_url( $path = '', $scheme = 'admin' ) { if ( ! is_multisite() ) { return admin_url( $path, $scheme ); } $url = network_site_url( 'wp-admin/network/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'network_admin_url', $url, $path, $scheme ); } function user_admin_url( $path = '', $scheme = 'admin' ) { $url = network_site_url( 'wp-admin/user/', $scheme ); if ( $path && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return apply_filters( 'user_admin_url', $url, $path, $scheme ); } function self_admin_url( $path = '', $scheme = 'admin' ) { if ( is_network_admin() ) { $url = network_admin_url( $path, $scheme ); } elseif ( is_user_admin() ) { $url = user_admin_url( $path, $scheme ); } else { $url = admin_url( $path, $scheme ); } return apply_filters( 'self_admin_url', $url, $path, $scheme ); } function set_url_scheme( $url, $scheme = null ) { $orig_scheme = $scheme; if ( ! $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; } elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) { $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http'; } elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) { $scheme = is_ssl() ? 'https' : 'http'; } $url = trim( $url ); if ( substr( $url, 0, 2 ) === '//' ) { $url = 'http:' . $url; } if ( 'relative' === $scheme ) { $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) ); if ( '' !== $url && '/' === $url[0] ) { $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" ); } } else { $url = preg_replace( '#^\w+://#', $scheme . '://', $url ); } return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme ); } function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) { $user_id = $user_id ? (int) $user_id : get_current_user_id(); $blogs = get_blogs_of_user( $user_id ); if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs ) ) { $url = user_admin_url( $path, $scheme ); } elseif ( ! is_multisite() ) { $url = admin_url( $path, $scheme ); } else { $current_blog = get_current_blog_id(); if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ), true ) ) ) { $url = admin_url( $path, $scheme ); } else { $active = get_active_blog_for_user( $user_id ); if ( $active ) { $url = get_admin_url( $active->blog_id, $path, $scheme ); } else { $url = user_admin_url( $path, $scheme ); } } } return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme ); } function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) { $user_id = $user_id ? (int) $user_id : get_current_user_id(); if ( is_user_admin() ) { $url = user_admin_url( 'profile.php', $scheme ); } elseif ( is_network_admin() ) { $url = network_admin_url( 'profile.php', $scheme ); } else { $url = get_dashboard_url( $user_id, 'profile.php', $scheme ); } return apply_filters( 'edit_profile_url', $url, $user_id, $scheme ); } function wp_get_canonical_url( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } if ( 'publish' !== $post->post_status ) { return false; } $canonical_url = get_permalink( $post ); if ( get_queried_object_id() === $post->ID ) { $page = get_query_var( 'page', 0 ); if ( $page >= 2 ) { if ( ! get_option( 'permalink_structure' ) ) { $canonical_url = add_query_arg( 'page', $page, $canonical_url ); } else { $canonical_url = trailingslashit( $canonical_url ) . user_trailingslashit( $page, 'single_paged' ); } } $cpage = get_query_var( 'cpage', 0 ); if ( $cpage ) { $canonical_url = get_comments_pagenum_link( $cpage ); } } return apply_filters( 'get_canonical_url', $canonical_url, $post ); } function rel_canonical() { if ( ! is_singular() ) { return; } $id = get_queried_object_id(); if ( 0 === $id ) { return; } $url = wp_get_canonical_url( $id ); if ( ! empty( $url ) ) { echo '' . "\n"; } } function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { $shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs ); if ( false !== $shortlink ) { return $shortlink; } $post_id = 0; if ( 'query' === $context && is_singular() ) { $post_id = get_queried_object_id(); $post = get_post( $post_id ); } elseif ( 'post' === $context ) { $post = get_post( $id ); if ( ! empty( $post->ID ) ) { $post_id = $post->ID; } } $shortlink = ''; if ( ! empty( $post_id ) ) { $post_type = get_post_type_object( $post->post_type ); if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { $shortlink = home_url( '/' ); } elseif ( $post_type && $post_type->public ) { $shortlink = home_url( '?p=' . $post_id ); } } return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs ); } function wp_shortlink_wp_head() { $shortlink = wp_get_shortlink( 0, 'query' ); if ( empty( $shortlink ) ) { return; } echo "\n"; } function wp_shortlink_header() { if ( headers_sent() ) { return; } $shortlink = wp_get_shortlink( 0, 'query' ); if ( empty( $shortlink ) ) { return; } header( 'Link: <' . $shortlink . '>; rel=shortlink', false ); } function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) { $post = get_post(); if ( empty( $text ) ) { $text = __( 'This is the short link.' ); } if ( empty( $title ) ) { $title = the_title_attribute( array( 'echo' => false ) ); } $shortlink = wp_get_shortlink( $post->ID ); if ( ! empty( $shortlink ) ) { $link = '' . $text . ''; $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title ); echo $before, $link, $after; } } function get_avatar_url( $id_or_email, $args = null ) { $args = get_avatar_data( $id_or_email, $args ); return $args['url']; } function is_avatar_comment_type( $comment_type ) { $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); return in_array( $comment_type, (array) $allowed_comment_types, true ); } function get_avatar_data( $id_or_email, $args = null ) { $args = wp_parse_args( $args, array( 'size' => 96, 'height' => null, 'width' => null, 'default' => get_option( 'avatar_default', 'mystery' ), 'force_default' => false, 'rating' => get_option( 'avatar_rating' ), 'scheme' => null, 'processed_args' => null, 'extra_attr' => '', ) ); if ( is_numeric( $args['size'] ) ) { $args['size'] = absint( $args['size'] ); if ( ! $args['size'] ) { $args['size'] = 96; } } else { $args['size'] = 96; } if ( is_numeric( $args['height'] ) ) { $args['height'] = absint( $args['height'] ); if ( ! $args['height'] ) { $args['height'] = $args['size']; } } else { $args['height'] = $args['size']; } if ( is_numeric( $args['width'] ) ) { $args['width'] = absint( $args['width'] ); if ( ! $args['width'] ) { $args['width'] = $args['size']; } } else { $args['width'] = $args['size']; } if ( empty( $args['default'] ) ) { $args['default'] = get_option( 'avatar_default', 'mystery' ); } switch ( $args['default'] ) { case 'mm': case 'mystery': case 'mysteryman': $args['default'] = 'mm'; break; case 'gravatar_default': $args['default'] = false; break; } $args['force_default'] = (bool) $args['force_default']; $args['rating'] = strtolower( $args['rating'] ); $args['found_avatar'] = false; $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); if ( isset( $args['url'] ) ) { return apply_filters( 'get_avatar_data', $args, $id_or_email ); } $email_hash = ''; $user = false; $email = false; if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { $id_or_email = get_comment( $id_or_email ); } if ( is_numeric( $id_or_email ) ) { $user = get_user_by( 'id', absint( $id_or_email ) ); } elseif ( is_string( $id_or_email ) ) { if ( strpos( $id_or_email, '@md5.gravatar.com' ) ) { list( $email_hash ) = explode( '@', $id_or_email ); } else { $email = $id_or_email; } } elseif ( $id_or_email instanceof WP_User ) { $user = $id_or_email; } elseif ( $id_or_email instanceof WP_Post ) { $user = get_user_by( 'id', (int) $id_or_email->post_author ); } elseif ( $id_or_email instanceof WP_Comment ) { if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { $args['url'] = false; return apply_filters( 'get_avatar_data', $args, $id_or_email ); } if ( ! empty( $id_or_email->user_id ) ) { $user = get_user_by( 'id', (int) $id_or_email->user_id ); } if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { $email = $id_or_email->comment_author_email; } } if ( ! $email_hash ) { if ( $user ) { $email = $user->user_email; } if ( $email ) { $email_hash = md5( strtolower( trim( $email ) ) ); } } if ( $email_hash ) { $args['found_avatar'] = true; $gravatar_server = hexdec( $email_hash[0] ) % 3; } else { $gravatar_server = rand( 0, 2 ); } $url_args = array( 's' => $args['size'], 'd' => $args['default'], 'f' => $args['force_default'] ? 'y' : false, 'r' => $args['rating'], ); if ( is_ssl() ) { $url = 'https://secure.gravatar.com/avatar/' . $email_hash; } else { $url = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash ); } $url = add_query_arg( rawurlencode_deep( array_filter( $url_args ) ), set_url_scheme( $url, $args['scheme'] ) ); $args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args ); return apply_filters( 'get_avatar_data', $args, $id_or_email ); } function get_theme_file_uri( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $url = get_stylesheet_directory_uri(); } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $url = get_stylesheet_directory_uri() . '/' . $file; } else { $url = get_template_directory_uri() . '/' . $file; } return apply_filters( 'theme_file_uri', $url, $file ); } function get_parent_theme_file_uri( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $url = get_template_directory_uri(); } else { $url = get_template_directory_uri() . '/' . $file; } return apply_filters( 'parent_theme_file_uri', $url, $file ); } function get_theme_file_path( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $path = get_stylesheet_directory(); } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $path = get_stylesheet_directory() . '/' . $file; } else { $path = get_template_directory() . '/' . $file; } return apply_filters( 'theme_file_path', $path, $file ); } function get_parent_theme_file_path( $file = '' ) { $file = ltrim( $file, '/' ); if ( empty( $file ) ) { $path = get_template_directory(); } else { $path = get_template_directory() . '/' . $file; } return apply_filters( 'parent_theme_file_path', $path, $file ); } function get_privacy_policy_url() { $url = ''; $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { $url = (string) get_permalink( $policy_page_id ); } return apply_filters( 'privacy_policy_url', $url, $policy_page_id ); } function the_privacy_policy_link( $before = '', $after = '' ) { echo get_the_privacy_policy_link( $before, $after ); } function get_the_privacy_policy_link( $before = '', $after = '' ) { $link = ''; $privacy_policy_url = get_privacy_policy_url(); $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); $page_title = ( $policy_page_id ) ? get_the_title( $policy_page_id ) : ''; if ( $privacy_policy_url && $page_title ) { $link = sprintf( '%s', esc_url( $privacy_policy_url ), esc_html( $page_title ) ); } $link = apply_filters( 'the_privacy_policy_link', $link, $privacy_policy_url ); if ( $link ) { return $before . $link . $after; } return ''; } registered_block_styles[ $block_name ] ) ) { $this->registered_block_styles[ $block_name ] = array(); } $this->registered_block_styles[ $block_name ][ $block_style_name ] = $style_properties; return true; } public function unregister( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ), '5.3.0' ); return false; } unset( $this->registered_block_styles[ $block_name ][ $block_style_name ] ); return true; } public function get_registered( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { return null; } return $this->registered_block_styles[ $block_name ][ $block_style_name ]; } public function get_all_registered() { return $this->registered_block_styles; } public function get_registered_styles_for_block( $block_name ) { if ( isset( $this->registered_block_styles[ $block_name ] ) ) { return $this->registered_block_styles[ $block_name ]; } return array(); } public function is_registered( $block_name, $block_style_name ) { return isset( $this->registered_block_styles[ $block_name ][ $block_style_name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } _subject = $subject; $this->_matches = $matches; $this->output = $this->_map(); } public static function apply( $subject, $matches ) { $oSelf = new WP_MatchesMapRegex( $subject, $matches ); return $oSelf->output; } private function _map() { $callback = array( $this, 'callback' ); return preg_replace_callback( $this->_pattern, $callback, $this->_subject ); } public function callback( $matches ) { $index = (int) substr( $matches[0], 9, -1 ); return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' ); } } errors ); return; } $support_errors = new WP_Error(); $response = wp_remote_request( home_url( '/', 'https' ), array( 'headers' => array( 'Cache-Control' => 'no-cache', ), 'sslverify' => true, ) ); if ( is_wp_error( $response ) ) { $unverified_response = wp_remote_request( home_url( '/', 'https' ), array( 'headers' => array( 'Cache-Control' => 'no-cache', ), 'sslverify' => false, ) ); if ( is_wp_error( $unverified_response ) ) { $support_errors->add( 'https_request_failed', __( 'HTTPS request failed.' ) ); } else { $support_errors->add( 'ssl_verification_failed', __( 'SSL verification failed.' ) ); } $response = $unverified_response; } if ( ! is_wp_error( $response ) ) { if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { $support_errors->add( 'bad_response_code', wp_remote_retrieve_response_message( $response ) ); } elseif ( false === wp_is_local_html_output( wp_remote_retrieve_body( $response ) ) ) { $support_errors->add( 'bad_response_source', __( 'It looks like the response did not come from this site.' ) ); } } update_option( 'https_detection_errors', $support_errors->errors ); } function wp_schedule_https_detection() { if ( wp_installing() ) { return; } if ( ! wp_next_scheduled( 'wp_https_detection' ) ) { wp_schedule_event( time(), 'twicedaily', 'wp_https_detection' ); } } function wp_cron_conditionally_prevent_sslverify( $request ) { if ( 'https' === wp_parse_url( $request['url'], PHP_URL_SCHEME ) ) { $request['args']['sslverify'] = false; } return $request; } function wp_is_local_html_output( $html ) { if ( has_action( 'wp_head', 'rsd_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); return false !== strpos( $html, $pattern ); } if ( has_action( 'wp_head', 'wlwmanifest_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', includes_url( 'wlwmanifest.xml' ) ); return false !== strpos( $html, $pattern ); } if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); return false !== strpos( $html, $pattern ); } return null; } deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { return WP_CONTENT_DIR . '/blog-deleted.php'; } else { wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) ); } } if ( '2' == $blog->deleted ) { if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) { return WP_CONTENT_DIR . '/blog-inactive.php'; } else { $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) ); wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ), sprintf( '%1$s', $admin_email ) ) ); } } if ( '1' == $blog->archived || '1' == $blog->spam ) { if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { return WP_CONTENT_DIR . '/blog-suspended.php'; } else { wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) ); } } return true; } function get_network_by_path( $domain, $path, $segments = null ) { return WP_Network::get_by_path( $domain, $path, $segments ); } function get_site_by_path( $domain, $path, $segments = null ) { $path_segments = array_filter( explode( '/', trim( $path, '/' ) ) ); $segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path ); if ( null !== $segments && count( $path_segments ) > $segments ) { $path_segments = array_slice( $path_segments, 0, $segments ); } $paths = array(); while ( count( $path_segments ) ) { $paths[] = '/' . implode( '/', $path_segments ) . '/'; array_pop( $path_segments ); } $paths[] = '/'; $pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths ); if ( null !== $pre ) { if ( false !== $pre && ! $pre instanceof WP_Site ) { $pre = new WP_Site( $pre ); } return $pre; } $domains = array( $domain ); if ( 'www.' === substr( $domain, 0, 4 ) ) { $domains[] = substr( $domain, 4 ); } $args = array( 'number' => 1, 'update_site_meta_cache' => false, ); if ( count( $domains ) > 1 ) { $args['domain__in'] = $domains; $args['orderby']['domain_length'] = 'DESC'; } else { $args['domain'] = array_shift( $domains ); } if ( count( $paths ) > 1 ) { $args['path__in'] = $paths; $args['orderby']['path_length'] = 'DESC'; } else { $args['path'] = array_shift( $paths ); } $result = get_sites( $args ); $site = array_shift( $result ); if ( $site ) { return $site; } return false; } function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) { global $current_site, $current_blog; if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { $current_site = new stdClass; $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; $current_site->domain = DOMAIN_CURRENT_SITE; $current_site->path = PATH_CURRENT_SITE; if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) { $current_site->blog_id = BLOG_ID_CURRENT_SITE; } elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { $current_site->blog_id = BLOGID_CURRENT_SITE; } if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) { $current_blog = get_site_by_path( $domain, $path ); } elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) { $current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) ); } else { $current_blog = get_site_by_path( $domain, $path, 1 ); } } elseif ( ! $subdomain ) { $current_site = wp_cache_get( 'current_network', 'site-options' ); if ( ! $current_site ) { $networks = get_networks( array( 'number' => 2 ) ); if ( count( $networks ) === 1 ) { $current_site = array_shift( $networks ); wp_cache_add( 'current_network', $current_site, 'site-options' ); } elseif ( empty( $networks ) ) { return false; } } if ( empty( $current_site ) ) { $current_site = WP_Network::get_by_path( $domain, $path, 1 ); } if ( empty( $current_site ) ) { do_action( 'ms_network_not_found', $domain, $path ); return false; } elseif ( $path === $current_site->path ) { $current_blog = get_site_by_path( $domain, $path ); } else { $current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) ); } } else { $current_blog = get_site_by_path( $domain, $path, 1 ); if ( $current_blog ) { $current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 ); } else { $current_site = WP_Network::get_by_path( $domain, $path, 1 ); } } if ( $current_blog && $current_blog->site_id != $current_site->id ) { $current_site = WP_Network::get_instance( $current_blog->site_id ); } if ( empty( $current_site ) ) { do_action( 'ms_network_not_found', $domain, $path ); return false; } if ( empty( $current_blog ) && wp_installing() ) { $current_blog = new stdClass; $current_blog->blog_id = 1; $blog_id = 1; $current_blog->public = 1; } if ( empty( $current_blog ) ) { $scheme = is_ssl() ? 'https' : 'http'; $destination = "$scheme://{$current_site->domain}{$current_site->path}"; do_action( 'ms_site_not_found', $current_site, $domain, $path ); if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) { $destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); } elseif ( $subdomain ) { if ( '%siteurl%' !== NOBLOGREDIRECT ) { $destination = NOBLOGREDIRECT; } } elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) { return false; } return $destination; } if ( empty( $current_site->blog_id ) ) { $current_site->blog_id = get_main_site_id( $current_site->id ); } return true; } function ms_not_installed( $domain, $path ) { global $wpdb; if ( ! is_admin() ) { dead_db(); } wp_load_translations_early(); $title = __( 'Error establishing a database connection' ); $msg = '

                ' . $title . '

                '; $msg .= '

                ' . __( 'If your site does not display, please contact the owner of this network.' ) . ''; $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '

                '; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); if ( ! $wpdb->get_var( $query ) ) { $msg .= '

                ' . sprintf( __( 'Database tables are missing. This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ), '' . $wpdb->site . '' ) . '

                '; } else { $msg .= '

                ' . sprintf( __( 'Could not find site %1$s. Searched for table %2$s in database %3$s. Is that right?' ), '' . rtrim( $domain . $path, '/' ) . '', '' . $wpdb->blogs . '', '' . DB_NAME . '' ) . '

                '; } $msg .= '

                ' . __( 'What do I do now?' ) . ' '; $msg .= sprintf( __( 'Read the Debugging a WordPress Network article. Some of the suggestions there may help you figure out what went wrong.' ), __( 'https://wordpress.org/support/article/debugging-a-wordpress-network/' ) ); $msg .= ' ' . __( 'If you are still stuck with this message, then check that your database contains the following tables:' ) . '

                  '; foreach ( $wpdb->tables( 'global' ) as $t => $table ) { if ( 'sitecategories' === $t ) { continue; } $msg .= '
                • ' . $table . '
                • '; } $msg .= '
                '; wp_die( $msg, $title, array( 'response' => 500 ) ); } function get_current_site_name( $current_site ) { _deprecated_function( __FUNCTION__, '3.9.0', 'get_current_site()' ); return $current_site; } function wpmu_current_site() { global $current_site; _deprecated_function( __FUNCTION__, '3.9.0' ); return $current_site; } function wp_get_network( $network ) { _deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' ); $network = get_network( $network ); if ( null === $network ) { return false; } return $network; } relation = 'OR'; } else { $this->relation = 'AND'; } $this->queries = $this->sanitize_query( $meta_query ); } public function sanitize_query( $queries ) { $clean_queries = array(); if ( ! is_array( $queries ) ) { return $clean_queries; } foreach ( $queries as $key => $query ) { if ( 'relation' === $key ) { $relation = $query; } elseif ( ! is_array( $query ) ) { continue; } elseif ( $this->is_first_order_clause( $query ) ) { if ( isset( $query['value'] ) && array() === $query['value'] ) { unset( $query['value'] ); } $clean_queries[ $key ] = $query; } else { $cleaned_query = $this->sanitize_query( $query ); if ( ! empty( $cleaned_query ) ) { $clean_queries[ $key ] = $cleaned_query; } } } if ( empty( $clean_queries ) ) { return $clean_queries; } if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) { $clean_queries['relation'] = 'OR'; $this->has_or_relation = true; } elseif ( 1 === count( $clean_queries ) ) { $clean_queries['relation'] = 'OR'; } else { $clean_queries['relation'] = 'AND'; } return $clean_queries; } protected function is_first_order_clause( $query ) { return isset( $query['key'] ) || isset( $query['value'] ); } public function parse_query_vars( $qv ) { $meta_query = array(); $primary_meta_query = array(); foreach ( array( 'key', 'compare', 'type', 'compare_key', 'type_key' ) as $key ) { if ( ! empty( $qv[ "meta_$key" ] ) ) { $primary_meta_query[ $key ] = $qv[ "meta_$key" ]; } } if ( isset( $qv['meta_value'] ) && '' !== $qv['meta_value'] && ( ! is_array( $qv['meta_value'] ) || $qv['meta_value'] ) ) { $primary_meta_query['value'] = $qv['meta_value']; } $existing_meta_query = isset( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ? $qv['meta_query'] : array(); if ( ! empty( $primary_meta_query ) && ! empty( $existing_meta_query ) ) { $meta_query = array( 'relation' => 'AND', $primary_meta_query, $existing_meta_query, ); } elseif ( ! empty( $primary_meta_query ) ) { $meta_query = array( $primary_meta_query, ); } elseif ( ! empty( $existing_meta_query ) ) { $meta_query = $existing_meta_query; } $this->__construct( $meta_query ); } public function get_cast_for_type( $type = '' ) { if ( empty( $type ) ) { return 'CHAR'; } $meta_type = strtoupper( $type ); if ( ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) ) { return 'CHAR'; } if ( 'NUMERIC' === $meta_type ) { $meta_type = 'SIGNED'; } return $meta_type; } public function get_sql( $type, $primary_table, $primary_id_column, $context = null ) { $meta_table = _get_meta_table( $type ); if ( ! $meta_table ) { return false; } $this->table_aliases = array(); $this->meta_table = $meta_table; $this->meta_id_column = sanitize_key( $type . '_id' ); $this->primary_table = $primary_table; $this->primary_id_column = $primary_id_column; $sql = $this->get_sql_clauses(); if ( false !== strpos( $sql['join'], 'LEFT JOIN' ) ) { $sql['join'] = str_replace( 'INNER JOIN', 'LEFT JOIN', $sql['join'] ); } return apply_filters_ref_array( 'get_meta_sql', array( $sql, $this->queries, $type, $primary_table, $primary_id_column, $context ) ); } protected function get_sql_clauses() { $queries = $this->queries; $sql = $this->get_sql_for_query( $queries ); if ( ! empty( $sql['where'] ) ) { $sql['where'] = ' AND ' . $sql['where']; } return $sql; } protected function get_sql_for_query( &$query, $depth = 0 ) { $sql_chunks = array( 'join' => array(), 'where' => array(), ); $sql = array( 'join' => '', 'where' => '', ); $indent = ''; for ( $i = 0; $i < $depth; $i++ ) { $indent .= ' '; } foreach ( $query as $key => &$clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; } elseif ( is_array( $clause ) ) { if ( $this->is_first_order_clause( $clause ) ) { $clause_sql = $this->get_sql_for_clause( $clause, $query, $key ); $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; } $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); } else { $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); $sql_chunks['where'][] = $clause_sql['where']; $sql_chunks['join'][] = $clause_sql['join']; } } } $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); if ( empty( $relation ) ) { $relation = 'AND'; } if ( ! empty( $sql_chunks['join'] ) ) { $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); } if ( ! empty( $sql_chunks['where'] ) ) { $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; } return $sql; } public function get_sql_for_clause( &$clause, $parent_query, $clause_key = '' ) { global $wpdb; $sql_chunks = array( 'where' => array(), 'join' => array(), ); if ( isset( $clause['compare'] ) ) { $clause['compare'] = strtoupper( $clause['compare'] ); } else { $clause['compare'] = isset( $clause['value'] ) && is_array( $clause['value'] ) ? 'IN' : '='; } $non_numeric_operators = array( '=', '!=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'EXISTS', 'NOT EXISTS', 'RLIKE', 'REGEXP', 'NOT REGEXP', ); $numeric_operators = array( '>', '>=', '<', '<=', 'BETWEEN', 'NOT BETWEEN', ); if ( ! in_array( $clause['compare'], $non_numeric_operators, true ) && ! in_array( $clause['compare'], $numeric_operators, true ) ) { $clause['compare'] = '='; } if ( isset( $clause['compare_key'] ) ) { $clause['compare_key'] = strtoupper( $clause['compare_key'] ); } else { $clause['compare_key'] = isset( $clause['key'] ) && is_array( $clause['key'] ) ? 'IN' : '='; } if ( ! in_array( $clause['compare_key'], $non_numeric_operators, true ) ) { $clause['compare_key'] = '='; } $meta_compare = $clause['compare']; $meta_compare_key = $clause['compare_key']; $join = ''; $alias = $this->find_compatible_table_alias( $clause, $parent_query ); if ( false === $alias ) { $i = count( $this->table_aliases ); $alias = $i ? 'mt' . $i : $this->meta_table; if ( 'NOT EXISTS' === $meta_compare ) { $join .= " LEFT JOIN $this->meta_table"; $join .= $i ? " AS $alias" : ''; if ( 'LIKE' === $meta_compare_key ) { $join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key LIKE %s )", '%' . $wpdb->esc_like( $clause['key'] ) . '%' ); } else { $join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] ); } } else { $join .= " INNER JOIN $this->meta_table"; $join .= $i ? " AS $alias" : ''; $join .= " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column )"; } $this->table_aliases[] = $alias; $sql_chunks['join'][] = $join; } $clause['alias'] = $alias; $_meta_type = isset( $clause['type'] ) ? $clause['type'] : ''; $meta_type = $this->get_cast_for_type( $_meta_type ); $clause['cast'] = $meta_type; if ( is_int( $clause_key ) || ! $clause_key ) { $clause_key = $clause['alias']; } $iterator = 1; $clause_key_base = $clause_key; while ( isset( $this->clauses[ $clause_key ] ) ) { $clause_key = $clause_key_base . '-' . $iterator; $iterator++; } $this->clauses[ $clause_key ] =& $clause; if ( array_key_exists( 'key', $clause ) ) { if ( 'NOT EXISTS' === $meta_compare ) { $sql_chunks['where'][] = $alias . '.' . $this->meta_id_column . ' IS NULL'; } else { if ( in_array( $meta_compare_key, array( '!=', 'NOT IN', 'NOT LIKE', 'NOT EXISTS', 'NOT REGEXP' ), true ) ) { $i = count( $this->table_aliases ); $subquery_alias = $i ? 'mt' . $i : $this->meta_table; $this->table_aliases[] = $subquery_alias; $meta_compare_string_start = 'NOT EXISTS ('; $meta_compare_string_start .= "SELECT 1 FROM $wpdb->postmeta $subquery_alias "; $meta_compare_string_start .= "WHERE $subquery_alias.post_ID = $alias.post_ID "; $meta_compare_string_end = 'LIMIT 1'; $meta_compare_string_end .= ')'; } switch ( $meta_compare_key ) { case '=': case 'EXISTS': $where = $wpdb->prepare( "$alias.meta_key = %s", trim( $clause['key'] ) ); break; case 'LIKE': $meta_compare_value = '%' . $wpdb->esc_like( trim( $clause['key'] ) ) . '%'; $where = $wpdb->prepare( "$alias.meta_key LIKE %s", $meta_compare_value ); break; case 'IN': $meta_compare_string = "$alias.meta_key IN (" . substr( str_repeat( ',%s', count( $clause['key'] ) ), 1 ) . ')'; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'RLIKE': case 'REGEXP': $operator = $meta_compare_key; if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { $cast = 'BINARY'; } else { $cast = ''; } $where = $wpdb->prepare( "$alias.meta_key $operator $cast %s", trim( $clause['key'] ) ); break; case '!=': case 'NOT EXISTS': $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key = %s " . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'NOT LIKE': $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key LIKE %s " . $meta_compare_string_end; $meta_compare_value = '%' . $wpdb->esc_like( trim( $clause['key'] ) ) . '%'; $where = $wpdb->prepare( $meta_compare_string, $meta_compare_value ); break; case 'NOT IN': $array_subclause = '(' . substr( str_repeat( ',%s', count( $clause['key'] ) ), 1 ) . ') '; $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key IN " . $array_subclause . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; case 'NOT REGEXP': $operator = $meta_compare_key; if ( isset( $clause['type_key'] ) && 'BINARY' === strtoupper( $clause['type_key'] ) ) { $cast = 'BINARY'; } else { $cast = ''; } $meta_compare_string = $meta_compare_string_start . "AND $subquery_alias.meta_key REGEXP $cast %s " . $meta_compare_string_end; $where = $wpdb->prepare( $meta_compare_string, $clause['key'] ); break; } $sql_chunks['where'][] = $where; } } if ( array_key_exists( 'value', $clause ) ) { $meta_value = $clause['value']; if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) { if ( ! is_array( $meta_value ) ) { $meta_value = preg_split( '/[,\s]+/', $meta_value ); } } elseif ( is_string( $meta_value ) ) { $meta_value = trim( $meta_value ); } switch ( $meta_compare ) { case 'IN': case 'NOT IN': $meta_compare_string = '(' . substr( str_repeat( ',%s', count( $meta_value ) ), 1 ) . ')'; $where = $wpdb->prepare( $meta_compare_string, $meta_value ); break; case 'BETWEEN': case 'NOT BETWEEN': $where = $wpdb->prepare( '%s AND %s', $meta_value[0], $meta_value[1] ); break; case 'LIKE': case 'NOT LIKE': $meta_value = '%' . $wpdb->esc_like( $meta_value ) . '%'; $where = $wpdb->prepare( '%s', $meta_value ); break; case 'EXISTS': $meta_compare = '='; $where = $wpdb->prepare( '%s', $meta_value ); break; case 'NOT EXISTS': $where = ''; break; default: $where = $wpdb->prepare( '%s', $meta_value ); break; } if ( $where ) { if ( 'CHAR' === $meta_type ) { $sql_chunks['where'][] = "$alias.meta_value {$meta_compare} {$where}"; } else { $sql_chunks['where'][] = "CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$where}"; } } } if ( 1 < count( $sql_chunks['where'] ) ) { $sql_chunks['where'] = array( '( ' . implode( ' AND ', $sql_chunks['where'] ) . ' )' ); } return $sql_chunks; } public function get_clauses() { return $this->clauses; } protected function find_compatible_table_alias( $clause, $parent_query ) { $alias = false; foreach ( $parent_query as $sibling ) { if ( empty( $sibling['alias'] ) ) { continue; } if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) { continue; } $compatible_compares = array(); if ( 'OR' === $parent_query['relation'] ) { $compatible_compares = array( '=', 'IN', 'BETWEEN', 'LIKE', 'REGEXP', 'RLIKE', '>', '>=', '<', '<=' ); } elseif ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) { $compatible_compares = array( '!=', 'NOT IN', 'NOT LIKE' ); } $clause_compare = strtoupper( $clause['compare'] ); $sibling_compare = strtoupper( $sibling['compare'] ); if ( in_array( $clause_compare, $compatible_compares, true ) && in_array( $sibling_compare, $compatible_compares, true ) ) { $alias = preg_replace( '/\W/', '_', $sibling['alias'] ); break; } } return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this ); } public function has_or_relation() { return $this->has_or_relation; } } parsed_block = $block; $this->name = $block['blockName']; if ( is_null( $registry ) ) { $registry = WP_Block_Type_Registry::get_instance(); } $this->registry = $registry; $this->block_type = $registry->get_registered( $this->name ); $this->available_context = $available_context; if ( ! empty( $this->block_type->uses_context ) ) { foreach ( $this->block_type->uses_context as $context_name ) { if ( array_key_exists( $context_name, $this->available_context ) ) { $this->context[ $context_name ] = $this->available_context[ $context_name ]; } } } if ( ! empty( $block['innerBlocks'] ) ) { $child_context = $this->available_context; if ( ! empty( $this->block_type->provides_context ) ) { foreach ( $this->block_type->provides_context as $context_name => $attribute_name ) { if ( array_key_exists( $attribute_name, $this->attributes ) ) { $child_context[ $context_name ] = $this->attributes[ $attribute_name ]; } } } $this->inner_blocks = new WP_Block_List( $block['innerBlocks'], $child_context, $registry ); } if ( ! empty( $block['innerHTML'] ) ) { $this->inner_html = $block['innerHTML']; } if ( ! empty( $block['innerContent'] ) ) { $this->inner_content = $block['innerContent']; } } public function __get( $name ) { if ( 'attributes' === $name ) { $this->attributes = isset( $this->parsed_block['attrs'] ) ? $this->parsed_block['attrs'] : array(); if ( ! is_null( $this->block_type ) ) { $this->attributes = $this->block_type->prepare_attributes_for_render( $this->attributes ); } return $this->attributes; } return null; } public function render( $options = array() ) { global $post; $options = wp_parse_args( $options, array( 'dynamic' => true, ) ); $is_dynamic = $options['dynamic'] && $this->name && null !== $this->block_type && $this->block_type->is_dynamic(); $block_content = ''; if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) { $index = 0; foreach ( $this->inner_content as $chunk ) { if ( is_string( $chunk ) ) { $block_content .= $chunk; } else { $inner_block = $this->inner_blocks[ $index ]; $parent_block = $this; $pre_render = apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ); if ( ! is_null( $pre_render ) ) { $block_content .= $pre_render; } else { $source_block = $inner_block->parsed_block; $inner_block->parsed_block = apply_filters( 'render_block_data', $inner_block->parsed_block, $source_block, $parent_block ); $inner_block->context = apply_filters( 'render_block_context', $inner_block->context, $inner_block->parsed_block, $parent_block ); $block_content .= $inner_block->render(); } $index++; } } } if ( $is_dynamic ) { $global_post = $post; $parent = WP_Block_Supports::$block_to_render; WP_Block_Supports::$block_to_render = $this->parsed_block; $block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this ); WP_Block_Supports::$block_to_render = $parent; $post = $global_post; } if ( ! empty( $this->block_type->script ) ) { wp_enqueue_script( $this->block_type->script ); } if ( ! empty( $this->block_type->view_script ) && empty( $this->block_type->render_callback ) ) { wp_enqueue_script( $this->block_type->view_script ); } if ( ! empty( $this->block_type->style ) ) { wp_enqueue_style( $this->block_type->style ); } $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this ); $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this ); return $block_content; } } 400 ) ); } if ( self::application_name_exists_for_user( $user_id, $args['name'] ) ) { return new WP_Error( 'application_password_duplicate_name', __( 'Each application name should be unique.' ), array( 'status' => 409 ) ); } $new_password = wp_generate_password( static::PW_LENGTH, false ); $hashed_password = wp_hash_password( $new_password ); $new_item = array( 'uuid' => wp_generate_uuid4(), 'app_id' => empty( $args['app_id'] ) ? '' : $args['app_id'], 'name' => $args['name'], 'password' => $hashed_password, 'created' => time(), 'last_used' => null, 'last_ip' => null, ); $passwords = static::get_user_application_passwords( $user_id ); $passwords[] = $new_item; $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } $network_id = get_main_network_id(); if ( ! get_network_option( $network_id, self::OPTION_KEY_IN_USE ) ) { update_network_option( $network_id, self::OPTION_KEY_IN_USE, true ); } do_action( 'wp_create_application_password', $user_id, $new_item, $new_password, $args ); return array( $new_password, $new_item ); } public static function get_user_application_passwords( $user_id ) { $passwords = get_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, true ); if ( ! is_array( $passwords ) ) { return array(); } $save = false; foreach ( $passwords as $i => $password ) { if ( ! isset( $password['uuid'] ) ) { $passwords[ $i ]['uuid'] = wp_generate_uuid4(); $save = true; } } if ( $save ) { static::set_user_application_passwords( $user_id, $passwords ); } return $passwords; } public static function get_user_application_password( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $password ) { if ( $password['uuid'] === $uuid ) { return $password; } } return null; } public static function application_name_exists_for_user( $user_id, $name ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $password ) { if ( strtolower( $password['name'] ) === strtolower( $name ) ) { return true; } } return false; } public static function update_application_password( $user_id, $uuid, $update = array() ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as &$item ) { if ( $item['uuid'] !== $uuid ) { continue; } if ( ! empty( $update['name'] ) ) { $update['name'] = sanitize_text_field( $update['name'] ); } $save = false; if ( ! empty( $update['name'] ) && $item['name'] !== $update['name'] ) { $item['name'] = $update['name']; $save = true; } if ( $save ) { $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } } do_action( 'wp_update_application_password', $user_id, $item, $update ); return true; } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function record_application_password_usage( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as &$password ) { if ( $password['uuid'] !== $uuid ) { continue; } if ( $password['last_used'] + DAY_IN_SECONDS > time() ) { return true; } $password['last_used'] = time(); $password['last_ip'] = $_SERVER['REMOTE_ADDR']; $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } return true; } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function delete_application_password( $user_id, $uuid ) { $passwords = static::get_user_application_passwords( $user_id ); foreach ( $passwords as $key => $item ) { if ( $item['uuid'] === $uuid ) { unset( $passwords[ $key ] ); $saved = static::set_user_application_passwords( $user_id, $passwords ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not delete application password.' ) ); } do_action( 'wp_delete_application_password', $user_id, $item ); return true; } } return new WP_Error( 'application_password_not_found', __( 'Could not find an application password with that id.' ) ); } public static function delete_all_application_passwords( $user_id ) { $passwords = static::get_user_application_passwords( $user_id ); if ( $passwords ) { $saved = static::set_user_application_passwords( $user_id, array() ); if ( ! $saved ) { return new WP_Error( 'db_error', __( 'Could not delete application passwords.' ) ); } foreach ( $passwords as $item ) { do_action( 'wp_delete_application_password', $user_id, $item ); } return count( $passwords ); } return 0; } protected static function set_user_application_passwords( $user_id, $passwords ) { return update_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, $passwords ); } public static function chunk_password( $raw_password ) { $raw_password = preg_replace( '/[^a-z\d]/i', '', $raw_password ); return trim( chunk_split( $raw_password, 4, ' ' ) ); } } init(); $this->register_globals(); } public function init() { $this->weekday[0] = __( 'Sunday' ); $this->weekday[1] = __( 'Monday' ); $this->weekday[2] = __( 'Tuesday' ); $this->weekday[3] = __( 'Wednesday' ); $this->weekday[4] = __( 'Thursday' ); $this->weekday[5] = __( 'Friday' ); $this->weekday[6] = __( 'Saturday' ); $this->weekday_initial[ $this->weekday[0] ] = _x( 'S', 'Sunday initial' ); $this->weekday_initial[ $this->weekday[1] ] = _x( 'M', 'Monday initial' ); $this->weekday_initial[ $this->weekday[2] ] = _x( 'T', 'Tuesday initial' ); $this->weekday_initial[ $this->weekday[3] ] = _x( 'W', 'Wednesday initial' ); $this->weekday_initial[ $this->weekday[4] ] = _x( 'T', 'Thursday initial' ); $this->weekday_initial[ $this->weekday[5] ] = _x( 'F', 'Friday initial' ); $this->weekday_initial[ $this->weekday[6] ] = _x( 'S', 'Saturday initial' ); $this->weekday_abbrev[ $this->weekday[0] ] = __( 'Sun' ); $this->weekday_abbrev[ $this->weekday[1] ] = __( 'Mon' ); $this->weekday_abbrev[ $this->weekday[2] ] = __( 'Tue' ); $this->weekday_abbrev[ $this->weekday[3] ] = __( 'Wed' ); $this->weekday_abbrev[ $this->weekday[4] ] = __( 'Thu' ); $this->weekday_abbrev[ $this->weekday[5] ] = __( 'Fri' ); $this->weekday_abbrev[ $this->weekday[6] ] = __( 'Sat' ); $this->month['01'] = __( 'January' ); $this->month['02'] = __( 'February' ); $this->month['03'] = __( 'March' ); $this->month['04'] = __( 'April' ); $this->month['05'] = __( 'May' ); $this->month['06'] = __( 'June' ); $this->month['07'] = __( 'July' ); $this->month['08'] = __( 'August' ); $this->month['09'] = __( 'September' ); $this->month['10'] = __( 'October' ); $this->month['11'] = __( 'November' ); $this->month['12'] = __( 'December' ); $this->month_genitive['01'] = _x( 'January', 'genitive' ); $this->month_genitive['02'] = _x( 'February', 'genitive' ); $this->month_genitive['03'] = _x( 'March', 'genitive' ); $this->month_genitive['04'] = _x( 'April', 'genitive' ); $this->month_genitive['05'] = _x( 'May', 'genitive' ); $this->month_genitive['06'] = _x( 'June', 'genitive' ); $this->month_genitive['07'] = _x( 'July', 'genitive' ); $this->month_genitive['08'] = _x( 'August', 'genitive' ); $this->month_genitive['09'] = _x( 'September', 'genitive' ); $this->month_genitive['10'] = _x( 'October', 'genitive' ); $this->month_genitive['11'] = _x( 'November', 'genitive' ); $this->month_genitive['12'] = _x( 'December', 'genitive' ); $this->month_abbrev[ $this->month['01'] ] = _x( 'Jan', 'January abbreviation' ); $this->month_abbrev[ $this->month['02'] ] = _x( 'Feb', 'February abbreviation' ); $this->month_abbrev[ $this->month['03'] ] = _x( 'Mar', 'March abbreviation' ); $this->month_abbrev[ $this->month['04'] ] = _x( 'Apr', 'April abbreviation' ); $this->month_abbrev[ $this->month['05'] ] = _x( 'May', 'May abbreviation' ); $this->month_abbrev[ $this->month['06'] ] = _x( 'Jun', 'June abbreviation' ); $this->month_abbrev[ $this->month['07'] ] = _x( 'Jul', 'July abbreviation' ); $this->month_abbrev[ $this->month['08'] ] = _x( 'Aug', 'August abbreviation' ); $this->month_abbrev[ $this->month['09'] ] = _x( 'Sep', 'September abbreviation' ); $this->month_abbrev[ $this->month['10'] ] = _x( 'Oct', 'October abbreviation' ); $this->month_abbrev[ $this->month['11'] ] = _x( 'Nov', 'November abbreviation' ); $this->month_abbrev[ $this->month['12'] ] = _x( 'Dec', 'December abbreviation' ); $this->meridiem['am'] = __( 'am' ); $this->meridiem['pm'] = __( 'pm' ); $this->meridiem['AM'] = __( 'AM' ); $this->meridiem['PM'] = __( 'PM' ); $thousands_sep = __( 'number_format_thousands_sep' ); $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; $decimal_point = __( 'number_format_decimal_point' ); $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point; $this->list_item_separator = __( ', ' ); if ( isset( $GLOBALS['text_direction'] ) ) { $this->text_direction = $GLOBALS['text_direction']; } elseif ( 'rtl' === _x( 'ltr', 'text direction' ) ) { $this->text_direction = 'rtl'; } } public function get_weekday( $weekday_number ) { return $this->weekday[ $weekday_number ]; } public function get_weekday_initial( $weekday_name ) { return $this->weekday_initial[ $weekday_name ]; } public function get_weekday_abbrev( $weekday_name ) { return $this->weekday_abbrev[ $weekday_name ]; } public function get_month( $month_number ) { return $this->month[ zeroise( $month_number, 2 ) ]; } public function get_month_abbrev( $month_name ) { return $this->month_abbrev[ $month_name ]; } public function get_meridiem( $meridiem ) { return $this->meridiem[ $meridiem ]; } public function register_globals() { $GLOBALS['weekday'] = $this->weekday; $GLOBALS['weekday_initial'] = $this->weekday_initial; $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev; $GLOBALS['month'] = $this->month; $GLOBALS['month_abbrev'] = $this->month_abbrev; } public function is_rtl() { return 'rtl' === $this->text_direction; } public function _strings_for_pot() { __( 'F j, Y' ); __( 'g:i a' ); __( 'F j, Y g:i a' ); } public function get_list_item_separator() { return $this->list_item_separator; } } '; ?> - - - <?php wp_title_rss(); ?> - - - - http://backend.userland.com/rss092 - - - - - - <?php the_title_rss(); ?> - ]]> - - - - - - -menu
                property.' ); return array(); } } public function initialize() { $this->user = new stdClass; if ( is_user_logged_in() ) { $this->user->blogs = get_blogs_of_user( get_current_user_id() ); if ( is_multisite() ) { $this->user->active_blog = get_active_blog_for_user( get_current_user_id() ); $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); $this->user->account_domain = $this->user->domain; } else { $this->user->active_blog = $this->user->blogs[ get_current_blog_id() ]; $this->user->domain = trailingslashit( home_url() ); $this->user->account_domain = $this->user->domain; } } add_action( 'wp_head', 'wp_admin_bar_header' ); add_action( 'admin_head', 'wp_admin_bar_header' ); if ( current_theme_supports( 'admin-bar' ) ) { $admin_bar_args = get_theme_support( 'admin-bar' ); $header_callback = $admin_bar_args[0]['callback']; } if ( empty( $header_callback ) ) { $header_callback = '_admin_bar_bump_cb'; } add_action( 'wp_head', $header_callback ); wp_enqueue_script( 'admin-bar' ); wp_enqueue_style( 'admin-bar' ); do_action( 'admin_bar_init' ); } public function add_menu( $node ) { $this->add_node( $node ); } public function remove_menu( $id ) { $this->remove_node( $id ); } public function add_node( $args ) { if ( func_num_args() >= 3 && is_string( $args ) ) { $args = array_merge( array( 'parent' => $args ), func_get_arg( 2 ) ); } if ( is_object( $args ) ) { $args = get_object_vars( $args ); } if ( empty( $args['id'] ) ) { if ( empty( $args['title'] ) ) { return; } _doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3.0' ); $args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) ); } $defaults = array( 'id' => false, 'title' => false, 'parent' => false, 'href' => false, 'group' => false, 'meta' => array(), ); $maybe_defaults = $this->get_node( $args['id'] ); if ( $maybe_defaults ) { $defaults = get_object_vars( $maybe_defaults ); } if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) ) { $args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] ); } $args = wp_parse_args( $args, $defaults ); $back_compat_parents = array( 'my-account-with-avatar' => array( 'my-account', '3.3' ), 'my-blogs' => array( 'my-sites', '3.3' ), ); if ( isset( $back_compat_parents[ $args['parent'] ] ) ) { list( $new_parent, $version ) = $back_compat_parents[ $args['parent'] ]; _deprecated_argument( __METHOD__, $version, sprintf( 'Use %s as the parent for the %s admin bar node instead of %s.', $new_parent, $args['id'], $args['parent'] ) ); $args['parent'] = $new_parent; } $this->_set_node( $args ); } final protected function _set_node( $args ) { $this->nodes[ $args['id'] ] = (object) $args; } final public function get_node( $id ) { $node = $this->_get_node( $id ); if ( $node ) { return clone $node; } } final protected function _get_node( $id ) { if ( $this->bound ) { return; } if ( empty( $id ) ) { $id = 'root'; } if ( isset( $this->nodes[ $id ] ) ) { return $this->nodes[ $id ]; } } final public function get_nodes() { $nodes = $this->_get_nodes(); if ( ! $nodes ) { return; } foreach ( $nodes as &$node ) { $node = clone $node; } return $nodes; } final protected function _get_nodes() { if ( $this->bound ) { return; } return $this->nodes; } final public function add_group( $args ) { $args['group'] = true; $this->add_node( $args ); } public function remove_node( $id ) { $this->_unset_node( $id ); } final protected function _unset_node( $id ) { unset( $this->nodes[ $id ] ); } public function render() { $root = $this->_bind(); if ( $root ) { $this->_render( $root ); } } final protected function _bind() { if ( $this->bound ) { return; } $this->remove_node( 'root' ); $this->add_node( array( 'id' => 'root', 'group' => false, ) ); foreach ( $this->_get_nodes() as $node ) { $node->children = array(); $node->type = ( $node->group ) ? 'group' : 'item'; unset( $node->group ); if ( ! $node->parent ) { $node->parent = 'root'; } } foreach ( $this->_get_nodes() as $node ) { if ( 'root' === $node->id ) { continue; } $parent = $this->_get_node( $node->parent ); if ( ! $parent ) { continue; } $group_class = ( 'root' === $node->parent ) ? 'ab-top-menu' : 'ab-submenu'; if ( 'group' === $node->type ) { if ( empty( $node->meta['class'] ) ) { $node->meta['class'] = $group_class; } else { $node->meta['class'] .= ' ' . $group_class; } } if ( 'item' === $parent->type && 'item' === $node->type ) { $default_id = $parent->id . '-default'; $default = $this->_get_node( $default_id ); if ( ! $default ) { $this->_set_node( array( 'id' => $default_id, 'parent' => $parent->id, 'type' => 'group', 'children' => array(), 'meta' => array( 'class' => $group_class, ), 'title' => false, 'href' => false, ) ); $default = $this->_get_node( $default_id ); $parent->children[] = $default; } $parent = $default; } elseif ( 'group' === $parent->type && 'group' === $node->type ) { $container_id = $parent->id . '-container'; $container = $this->_get_node( $container_id ); if ( ! $container ) { $this->_set_node( array( 'id' => $container_id, 'type' => 'container', 'children' => array( $parent ), 'parent' => false, 'title' => false, 'href' => false, 'meta' => array(), ) ); $container = $this->_get_node( $container_id ); $grandparent = $this->_get_node( $parent->parent ); if ( $grandparent ) { $container->parent = $grandparent->id; $index = array_search( $parent, $grandparent->children, true ); if ( false === $index ) { $grandparent->children[] = $container; } else { array_splice( $grandparent->children, $index, 1, array( $container ) ); } } $parent->parent = $container->id; } $parent = $container; } $node->parent = $parent->id; $parent->children[] = $node; } $root = $this->_get_node( 'root' ); $this->bound = true; return $root; } final protected function _render( $root ) { $class = 'nojq nojs'; if ( wp_is_mobile() ) { $class .= ' mobile'; } ?> -
                - - - - - - - -
                - - type || empty( $node->children ) ) { return; } echo '
                '; foreach ( $node->children as $group ) { $this->_render_group( $group ); } echo '
                '; } final protected function _render_group( $node ) { if ( 'container' === $node->type ) { $this->_render_container( $node ); return; } if ( 'group' !== $node->type || empty( $node->children ) ) { return; } if ( ! empty( $node->meta['class'] ) ) { $class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"'; } else { $class = ''; } echo "
                  id ) . "'$class>"; foreach ( $node->children as $item ) { $this->_render_item( $item ); } echo '
                '; } final protected function _render_item( $node ) { if ( 'item' !== $node->type ) { return; } $is_parent = ! empty( $node->children ); $has_link = ! empty( $node->href ); $is_root_top_item = 'root-default' === $node->parent; $is_top_secondary_item = 'top-secondary' === $node->parent; $tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : ''; $aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; $menuclass = ''; $arrow = ''; if ( $is_parent ) { $menuclass = 'menupop '; $aria_attributes .= ' aria-haspopup="true"'; } if ( ! empty( $node->meta['class'] ) ) { $menuclass .= $node->meta['class']; } if ( ! $is_root_top_item && ! $is_top_secondary_item && $is_parent ) { $arrow = ''; } if ( $menuclass ) { $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; } echo "
              • id ) . "'$menuclass>"; if ( $has_link ) { $attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' ); echo "meta[ $attribute ] ) ) { continue; } if ( 'onclick' === $attribute ) { echo " $attribute='" . esc_js( $node->meta[ $attribute ] ) . "'"; } else { echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . "'"; } } echo ">{$arrow}{$node->title}"; if ( $has_link ) { echo ''; } else { echo ''; } if ( $is_parent ) { echo '
                '; foreach ( $node->children as $group ) { $this->_render_group( $group ); } echo '
                '; } if ( ! empty( $node->meta['html'] ) ) { echo $node->meta['html']; } echo '
              • '; } public function recursive_render( $id, $node ) { _deprecated_function( __METHOD__, '3.3.0', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' ); $this->_render_item( $node ); } public function add_menus() { add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 ); add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 ); add_action( 'admin_bar_menu', 'wp_admin_bar_recovery_mode_menu', 8 ); add_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 ); add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 ); add_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 ); if ( ! is_network_admin() && ! is_user_admin() ) { add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 ); add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 ); } add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); do_action( 'add_admin_bar_menus' ); } } = 7; function wp_is_mobile() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $is_mobile = false; } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Android' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Silk/' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Kindle' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) !== false ) { $is_mobile = true; } else { $is_mobile = false; } return apply_filters( 'wp_is_mobile', $is_mobile ); } 'get_embed_template', 'is_404' => 'get_404_template', 'is_search' => 'get_search_template', 'is_front_page' => 'get_front_page_template', 'is_home' => 'get_home_template', 'is_privacy_policy' => 'get_privacy_policy_template', 'is_post_type_archive' => 'get_post_type_archive_template', 'is_tax' => 'get_taxonomy_template', 'is_attachment' => 'get_attachment_template', 'is_single' => 'get_single_template', 'is_page' => 'get_page_template', 'is_singular' => 'get_singular_template', 'is_category' => 'get_category_template', 'is_tag' => 'get_tag_template', 'is_author' => 'get_author_template', 'is_date' => 'get_date_template', 'is_archive' => 'get_archive_template', ); $template = false; foreach ( $tag_templates as $tag => $template_getter ) { if ( call_user_func( $tag ) ) { $template = call_user_func( $template_getter ); } if ( $template ) { if ( 'is_attachment' === $tag ) { remove_filter( 'the_content', 'prepend_attachment' ); } break; } } if ( ! $template ) { $template = get_index_template(); } $template = apply_filters( 'template_include', $template ); if ( $template ) { include $template; } elseif ( current_user_can( 'switch_themes' ) ) { $theme = wp_get_theme(); if ( $theme->errors() ) { wp_die( $theme->errors() ); } } return; } HashPassword( $key ); $records = $this->get_keys(); $records[ $token ] = array( 'hashed_key' => $hashed, 'created_at' => time(), ); $this->update_keys( $records ); do_action( 'generate_recovery_mode_key', $token, $key ); return $key; } public function validate_recovery_mode_key( $token, $key, $ttl ) { $records = $this->get_keys(); if ( ! isset( $records[ $token ] ) ) { return new WP_Error( 'token_not_found', __( 'Recovery Mode not initialized.' ) ); } $record = $records[ $token ]; $this->remove_key( $token ); if ( ! is_array( $record ) || ! isset( $record['hashed_key'], $record['created_at'] ) ) { return new WP_Error( 'invalid_recovery_key_format', __( 'Invalid recovery key format.' ) ); } if ( ! wp_check_password( $key, $record['hashed_key'] ) ) { return new WP_Error( 'hash_mismatch', __( 'Invalid recovery key.' ) ); } if ( time() > $record['created_at'] + $ttl ) { return new WP_Error( 'key_expired', __( 'Recovery key expired.' ) ); } return true; } public function clean_expired_keys( $ttl ) { $records = $this->get_keys(); foreach ( $records as $key => $record ) { if ( ! isset( $record['created_at'] ) || time() > $record['created_at'] + $ttl ) { unset( $records[ $key ] ); } } $this->update_keys( $records ); } private function remove_key( $token ) { $records = $this->get_keys(); if ( ! isset( $records[ $token ] ) ) { return; } unset( $records[ $token ] ); $this->update_keys( $records ); } private function get_keys() { return (array) get_option( $this->option_name, array() ); } private function update_keys( array $keys ) { return update_option( $this->option_name, $keys ); } } blockName = $name; $this->attrs = $attrs; $this->innerBlocks = $innerBlocks; $this->innerHTML = $innerHTML; $this->innerContent = $innerContent; } } class WP_Block_Parser_Frame { public $block; public $token_start; public $token_length; public $prev_offset; public $leading_html_start; function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) { $this->block = $block; $this->token_start = $token_start; $this->token_length = $token_length; $this->prev_offset = isset( $prev_offset ) ? $prev_offset : $token_start + $token_length; $this->leading_html_start = $leading_html_start; } } class WP_Block_Parser { public $document; public $offset; public $output; public $stack; public $empty_attrs; function parse( $document ) { $this->document = $document; $this->offset = 0; $this->output = array(); $this->stack = array(); $this->empty_attrs = json_decode( '{}', true ); do { } while ( $this->proceed() ); return $this->output; } function proceed() { $next_token = $this->next_token(); list( $token_type, $block_name, $attrs, $start_offset, $token_length ) = $next_token; $stack_depth = count( $this->stack ); $leading_html_start = $start_offset > $this->offset ? $this->offset : null; switch ( $token_type ) { case 'no-more-tokens': if ( 0 === $stack_depth ) { $this->add_freeform(); return false; } if ( 1 === $stack_depth ) { $this->add_block_from_stack(); return false; } while ( 0 < count( $this->stack ) ) { $this->add_block_from_stack(); } return false; case 'void-block': if ( 0 === $stack_depth ) { if ( isset( $leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $leading_html_start, $start_offset - $leading_html_start ) ); } $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); $this->offset = $start_offset + $token_length; return true; } $this->add_inner_block( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length ); $this->offset = $start_offset + $token_length; return true; case 'block-opener': array_push( $this->stack, new WP_Block_Parser_Frame( new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length, $start_offset + $token_length, $leading_html_start ) ); $this->offset = $start_offset + $token_length; return true; case 'block-closer': if ( 0 === $stack_depth ) { $this->add_freeform(); return false; } if ( 1 === $stack_depth ) { $this->add_block_from_stack( $start_offset ); $this->offset = $start_offset + $token_length; return true; } $stack_top = array_pop( $this->stack ); $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; $stack_top->prev_offset = $start_offset + $token_length; $this->add_inner_block( $stack_top->block, $stack_top->token_start, $stack_top->token_length, $start_offset + $token_length ); $this->offset = $start_offset + $token_length; return true; default: $this->add_freeform(); return false; } } function next_token() { $matches = null; $has_match = preg_match( '/).)*+)?}\s+)?(?P\/)?-->/s', $this->document, $matches, PREG_OFFSET_CAPTURE, $this->offset ); if ( false === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } if ( 0 === $has_match ) { return array( 'no-more-tokens', null, null, null, null ); } list( $match, $started_at ) = $matches[0]; $length = strlen( $match ); $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1]; $is_void = isset( $matches['void'] ) && -1 !== $matches['void'][1]; $namespace = $matches['namespace']; $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/'; $name = $namespace . $matches['name'][0]; $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1]; $attrs = $has_attrs ? json_decode( $matches['attrs'][0], true ) : $this->empty_attrs; if ( $is_closer && ( $is_void || $has_attrs ) ) { } if ( $is_void ) { return array( 'void-block', $name, $attrs, $started_at, $length ); } if ( $is_closer ) { return array( 'block-closer', $name, null, $started_at, $length ); } return array( 'block-opener', $name, $attrs, $started_at, $length ); } function freeform( $innerHTML ) { return new WP_Block_Parser_Block( null, $this->empty_attrs, array(), $innerHTML, array( $innerHTML ) ); } function add_freeform( $length = null ) { $length = $length ? $length : strlen( $this->document ) - $this->offset; if ( 0 === $length ) { return; } $this->output[] = (array) $this->freeform( substr( $this->document, $this->offset, $length ) ); } function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { $parent = $this->stack[ count( $this->stack ) - 1 ]; $parent->block->innerBlocks[] = (array) $block; $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); if ( ! empty( $html ) ) { $parent->block->innerHTML .= $html; $parent->block->innerContent[] = $html; } $parent->block->innerContent[] = null; $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; } function add_block_from_stack( $end_offset = null ) { $stack_top = array_pop( $this->stack ); $prev_offset = $stack_top->prev_offset; $html = isset( $end_offset ) ? substr( $this->document, $prev_offset, $end_offset - $prev_offset ) : substr( $this->document, $prev_offset ); if ( ! empty( $html ) ) { $stack_top->block->innerHTML .= $html; $stack_top->block->innerContent[] = $html; } if ( isset( $stack_top->leading_html_start ) ) { $this->output[] = (array) $this->freeform( substr( $this->document, $stack_top->leading_html_start, $stack_top->token_start - $stack_top->leading_html_start ) ); } $this->output[] = (array) $stack_top->block; } } register_handler( $id, $regex, $callback, $priority ); } function wp_embed_unregister_handler( $id, $priority = 10 ) { global $wp_embed; $wp_embed->unregister_handler( $id, $priority ); } function wp_embed_defaults( $url = '' ) { if ( ! empty( $GLOBALS['content_width'] ) ) { $width = (int) $GLOBALS['content_width']; } if ( empty( $width ) ) { $width = 500; } $height = min( ceil( $width * 1.5 ), 1000 ); return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url ); } function wp_oembed_get( $url, $args = '' ) { $oembed = _wp_oembed_get_object(); return $oembed->get_html( $url, $args ); } function _wp_oembed_get_object() { static $wp_oembed = null; if ( is_null( $wp_oembed ) ) { $wp_oembed = new WP_oEmbed(); } return $wp_oembed; } function wp_oembed_add_provider( $format, $provider, $regex = false ) { if ( did_action( 'plugins_loaded' ) ) { $oembed = _wp_oembed_get_object(); $oembed->providers[ $format ] = array( $provider, $regex ); } else { WP_oEmbed::_add_provider_early( $format, $provider, $regex ); } } function wp_oembed_remove_provider( $format ) { if ( did_action( 'plugins_loaded' ) ) { $oembed = _wp_oembed_get_object(); if ( isset( $oembed->providers[ $format ] ) ) { unset( $oembed->providers[ $format ] ); return true; } } else { WP_oEmbed::_remove_provider_early( $format ); } return false; } function wp_maybe_load_embeds() { if ( ! apply_filters( 'load_default_embeds', true ) ) { return; } wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' ); wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . implode( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 ); wp_embed_register_handler( 'video', '#^https?://.+?\.(' . implode( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 ); } function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { global $wp_embed; $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) ); return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr ); } function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) ); return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); } function wp_embed_handler_video( $matches, $attr, $url, $rawattr ) { $dimensions = ''; if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) { $dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] ); $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] ); } $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) ); return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr ); } function wp_oembed_register_route() { $controller = new WP_oEmbed_Controller(); $controller->register_routes(); } function wp_oembed_add_discovery_links() { $output = ''; if ( is_singular() ) { $output .= '' . "\n"; if ( class_exists( 'SimpleXMLElement' ) ) { $output .= '' . "\n"; } } echo apply_filters( 'oembed_discovery_links', $output ); } function wp_oembed_add_host_js() {} function wp_maybe_enqueue_oembed_host_js( $html ) { if ( has_action( 'wp_head', 'wp_oembed_add_host_js' ) && preg_match( '/]*?wp-embedded-content/', $html ) ) { wp_enqueue_script( 'wp-embed' ); } return $html; } function get_post_embed_url( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' ); $path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) ); if ( ! get_option( 'permalink_structure' ) || $path_conflict ) { $embed_url = add_query_arg( array( 'embed' => 'true' ), get_permalink( $post ) ); } return esc_url_raw( apply_filters( 'post_embed_url', $embed_url, $post ) ); } function get_oembed_endpoint_url( $permalink = '', $format = 'json' ) { $url = rest_url( 'oembed/1.0/embed' ); if ( '' !== $permalink ) { $url = add_query_arg( array( 'url' => urlencode( $permalink ), 'format' => ( 'json' !== $format ) ? $format : false, ), $url ); } return apply_filters( 'oembed_endpoint_url', $url, $permalink, $format ); } function get_post_embed_html( $width, $height, $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $embed_url = get_post_embed_url( $post ); $secret = wp_generate_password( 10, false ); $embed_url .= "#?secret={$secret}"; $output = sprintf( '
                %3$s
                ', esc_attr( $secret ), esc_url( get_permalink( $post ) ), get_the_title( $post ) ); $output .= sprintf( '', esc_url( $embed_url ), absint( $width ), absint( $height ), esc_attr( sprintf( __( '“%1$s” — %2$s' ), get_the_title( $post ), get_bloginfo( 'name' ) ) ), esc_attr( $secret ) ); $output .= wp_get_inline_script_tag( file_get_contents( ABSPATH . WPINC . '/js/wp-embed' . wp_scripts_get_suffix() . '.js' ) ); return apply_filters( 'embed_html', $output, $post, $width, $height ); } function get_oembed_response_data( $post, $width ) { $post = get_post( $post ); $width = absint( $width ); if ( ! $post ) { return false; } if ( ! is_post_publicly_viewable( $post ) ) { return false; } $min_max_width = apply_filters( 'oembed_min_max_width', array( 'min' => 200, 'max' => 600, ) ); $width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] ); $height = max( ceil( $width / 16 * 9 ), 200 ); $data = array( 'version' => '1.0', 'provider_name' => get_bloginfo( 'name' ), 'provider_url' => get_home_url(), 'author_name' => get_bloginfo( 'name' ), 'author_url' => get_home_url(), 'title' => get_the_title( $post ), 'type' => 'link', ); $author = get_userdata( $post->post_author ); if ( $author ) { $data['author_name'] = $author->display_name; $data['author_url'] = get_author_posts_url( $author->ID ); } return apply_filters( 'oembed_response_data', $data, $post, $width, $height ); } function get_oembed_response_data_for_url( $url, $args ) { $switched_blog = false; if ( is_multisite() ) { $url_parts = wp_parse_args( wp_parse_url( $url ), array( 'host' => '', 'path' => '/', ) ); $qv = array( 'domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false, ); if ( ! is_subdomain_install() ) { $path = explode( '/', ltrim( $url_parts['path'], '/' ) ); $path = reset( $path ); if ( $path ) { $qv['path'] = get_network()->path . $path . '/'; } } $sites = get_sites( $qv ); $site = reset( $sites ); if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) { return false; } if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { switch_to_blog( $site->blog_id ); $switched_blog = true; } } $post_id = url_to_postid( $url ); $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); if ( ! $post_id ) { if ( $switched_blog ) { restore_current_blog(); } return false; } $width = isset( $args['width'] ) ? $args['width'] : 0; $data = get_oembed_response_data( $post_id, $width ); if ( $switched_blog ) { restore_current_blog(); } return $data ? (object) $data : false; } function get_oembed_response_data_rich( $data, $post, $width, $height ) { $data['width'] = absint( $width ); $data['height'] = absint( $height ); $data['type'] = 'rich'; $data['html'] = get_post_embed_html( $width, $height, $post ); $thumbnail_id = false; if ( has_post_thumbnail( $post->ID ) ) { $thumbnail_id = get_post_thumbnail_id( $post->ID ); } if ( 'attachment' === get_post_type( $post ) ) { if ( wp_attachment_is_image( $post ) ) { $thumbnail_id = $post->ID; } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_id = get_post_thumbnail_id( $post ); $data['type'] = 'video'; } } if ( $thumbnail_id ) { list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) ); $data['thumbnail_url'] = $thumbnail_url; $data['thumbnail_width'] = $thumbnail_width; $data['thumbnail_height'] = $thumbnail_height; } return $data; } function wp_oembed_ensure_format( $format ) { if ( ! in_array( $format, array( 'json', 'xml' ), true ) ) { return 'json'; } return $format; } function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) { $params = $request->get_params(); if ( '/oembed/1.0/embed' !== $request->get_route() || 'GET' !== $request->get_method() ) { return $served; } if ( ! isset( $params['format'] ) || 'xml' !== $params['format'] ) { return $served; } $data = $server->response_to_data( $result, false ); if ( ! class_exists( 'SimpleXMLElement' ) ) { status_header( 501 ); die( get_status_header_desc( 501 ) ); } $result = _oembed_create_xml( $data ); if ( ! $result ) { status_header( 501 ); return get_status_header_desc( 501 ); } if ( ! headers_sent() ) { $server->send_header( 'Content-Type', 'text/xml; charset=' . get_option( 'blog_charset' ) ); } echo $result; return true; } function _oembed_create_xml( $data, $node = null ) { if ( ! is_array( $data ) || empty( $data ) ) { return false; } if ( null === $node ) { $node = new SimpleXMLElement( '' ); } foreach ( $data as $key => $value ) { if ( is_numeric( $key ) ) { $key = 'oembed'; } if ( is_array( $value ) ) { $item = $node->addChild( $key ); _oembed_create_xml( $value, $item ); } else { $node->addChild( $key, esc_html( $value ) ); } } return $node->asXML(); } function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) { if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) { return $result; } $title = ! empty( $data->title ) ? $data->title : ''; $pattern = '`]*)>`i'; if ( preg_match( $pattern, $result, $matches ) ) { $attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() ); foreach ( $attrs as $attr => $item ) { $lower_attr = strtolower( $attr ); if ( $lower_attr === $attr ) { continue; } if ( ! isset( $attrs[ $lower_attr ] ) ) { $attrs[ $lower_attr ] = $item; unset( $attrs[ $attr ] ); } } } if ( ! empty( $attrs['title']['value'] ) ) { $title = $attrs['title']['value']; } $title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url ); if ( '' === $title ) { return $result; } if ( isset( $attrs['title'] ) ) { unset( $attrs['title'] ); $attr_string = implode( ' ', wp_list_pluck( $attrs, 'whole' ) ); $result = str_replace( $matches[0], ')|ms', $html, $content ); if ( empty( $content[2] ) ) { return false; } $html = $content[1] . $content[2]; preg_match( '/ src=([\'"])(.*?)\1/', $html, $results ); if ( ! empty( $results ) ) { $secret = wp_generate_password( 10, false ); $url = esc_url( "{$results[2]}#?secret=$secret" ); $q = $results[1]; $html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html ); $html = str_replace( '%2$s', esc_url( get_permalink() ), sprintf( __( 'Continue reading %s' ), '' . get_the_title() . '' ) ); return ' … ' . $link; } function the_excerpt_embed() { $output = get_the_excerpt(); echo apply_filters( 'the_excerpt_embed', $output ); } function wp_embed_excerpt_attachment( $content ) { if ( is_attachment() ) { return prepend_attachment( '' ); } return $content; } function enqueue_embed_scripts() { wp_enqueue_style( 'wp-embed-template-ie' ); do_action( 'enqueue_embed_scripts' ); } function print_embed_styles() { $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; $suffix = SCRIPT_DEBUG ? '' : '.min'; ?> - > - - - - - -
                - -
                - - - %s', esc_url( home_url() ), esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ), esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ), esc_html( get_bloginfo( 'name' ) ) ); $site_title = '
                ' . $site_title . '
                '; echo apply_filters( 'embed_site_title_html', $site_title ); } function wp_filter_pre_oembed_result( $result, $url, $args ) { $data = get_oembed_response_data_for_url( $url, $args ); if ( $data ) { return _wp_oembed_get_object()->data2html( $data, $url ); } return $result; } $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args, ); $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_schedule_event_false', __( 'A plugin prevented the event from being scheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { $crons = array(); } $key = md5( serialize( $event->args ) ); $duplicate = false; if ( $event->timestamp < time() + 10 * MINUTE_IN_SECONDS ) { $min_timestamp = 0; } else { $min_timestamp = $event->timestamp - 10 * MINUTE_IN_SECONDS; } if ( $event->timestamp < time() ) { $max_timestamp = time() + 10 * MINUTE_IN_SECONDS; } else { $max_timestamp = $event->timestamp + 10 * MINUTE_IN_SECONDS; } foreach ( $crons as $event_timestamp => $cron ) { if ( $event_timestamp < $min_timestamp ) { continue; } if ( $event_timestamp > $max_timestamp ) { break; } if ( isset( $cron[ $event->hook ][ $key ] ) ) { $duplicate = true; break; } } if ( $duplicate ) { if ( $wp_error ) { return new WP_Error( 'duplicate_event', __( 'A duplicate event already exists.' ) ); } return false; } $event = apply_filters( 'schedule_event', $event ); if ( ! $event ) { if ( $wp_error ) { return new WP_Error( 'schedule_event_false', __( 'A plugin disallowed this event.' ) ); } return false; } $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 'schedule' => $event->schedule, 'args' => $event->args, ); uksort( $crons, 'strnatcasecmp' ); return _set_cron_array( $crons, $wp_error ); } function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $schedules = wp_get_schedules(); if ( ! isset( $schedules[ $recurrence ] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_schedule', __( 'Event schedule does not exist.' ) ); } return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[ $recurrence ]['interval'], ); $pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_schedule_event_false', __( 'A plugin prevented the event from being scheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $event = apply_filters( 'schedule_event', $event ); if ( ! $event ) { if ( $wp_error ) { return new WP_Error( 'schedule_event_false', __( 'A plugin disallowed this event.' ) ); } return false; } $key = md5( serialize( $event->args ) ); $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { $crons = array(); } $crons[ $event->timestamp ][ $event->hook ][ $key ] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval, ); uksort( $crons, 'strnatcasecmp' ); return _set_cron_array( $crons, $wp_error ); } function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $schedules = wp_get_schedules(); $interval = 0; if ( isset( $schedules[ $recurrence ] ) ) { $interval = $schedules[ $recurrence ]['interval']; } if ( 0 === $interval ) { $scheduled_event = wp_get_scheduled_event( $hook, $args, $timestamp ); if ( $scheduled_event && isset( $scheduled_event->interval ) ) { $interval = $scheduled_event->interval; } } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $interval, ); $pre = apply_filters( 'pre_reschedule_event', null, $event, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_reschedule_event_false', __( 'A plugin prevented the event from being rescheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } if ( 0 == $interval ) { if ( $wp_error ) { return new WP_Error( 'invalid_schedule', __( 'Event schedule does not exist.' ) ); } return false; } $now = time(); if ( $timestamp >= $now ) { $timestamp = $now + $interval; } else { $timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) ); } return wp_schedule_event( $timestamp, $recurrence, $hook, $args, $wp_error ); } function wp_unschedule_event( $timestamp, $hook, $args = array(), $wp_error = false ) { if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) { if ( $wp_error ) { return new WP_Error( 'invalid_timestamp', __( 'Event timestamp must be a valid Unix timestamp.' ) ); } return false; } $pre = apply_filters( 'pre_unschedule_event', null, $timestamp, $hook, $args, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_unschedule_event_false', __( 'A plugin prevented the event from being unscheduled.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); $key = md5( serialize( $args ) ); unset( $crons[ $timestamp ][ $hook ][ $key ] ); if ( empty( $crons[ $timestamp ][ $hook ] ) ) { unset( $crons[ $timestamp ][ $hook ] ); } if ( empty( $crons[ $timestamp ] ) ) { unset( $crons[ $timestamp ] ); } return _set_cron_array( $crons, $wp_error ); } function wp_clear_scheduled_hook( $hook, $args = array(), $wp_error = false ) { if ( ! is_array( $args ) ) { _deprecated_argument( __FUNCTION__, '3.0.0', __( 'This argument has changed to an array to match the behavior of the other cron functions.' ) ); $args = array_slice( func_get_args(), 1 ); $wp_error = false; } $pre = apply_filters( 'pre_clear_scheduled_hook', null, $hook, $args, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_clear_scheduled_hook_false', __( 'A plugin prevented the hook from being cleared.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return 0; } $results = array(); $key = md5( serialize( $args ) ); foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ][ $key ] ) ) { $results[] = wp_unschedule_event( $timestamp, $hook, $args, true ); } } $errors = array_filter( $results, 'is_wp_error' ); $error = new WP_Error(); if ( $errors ) { if ( $wp_error ) { array_walk( $errors, array( $error, 'merge_from' ) ); return $error; } return false; } return count( $results ); } function wp_unschedule_hook( $hook, $wp_error = false ) { $pre = apply_filters( 'pre_unschedule_hook', null, $hook, $wp_error ); if ( null !== $pre ) { if ( $wp_error && false === $pre ) { return new WP_Error( 'pre_unschedule_hook_false', __( 'A plugin prevented the hook from being cleared.' ) ); } if ( ! $wp_error && is_wp_error( $pre ) ) { return false; } return $pre; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return 0; } $results = array(); foreach ( $crons as $timestamp => $args ) { if ( ! empty( $crons[ $timestamp ][ $hook ] ) ) { $results[] = count( $crons[ $timestamp ][ $hook ] ); } unset( $crons[ $timestamp ][ $hook ] ); if ( empty( $crons[ $timestamp ] ) ) { unset( $crons[ $timestamp ] ); } } if ( empty( $results ) ) { return 0; } $set = _set_cron_array( $crons, $wp_error ); if ( true === $set ) { return array_sum( $results ); } return $set; } function wp_get_scheduled_event( $hook, $args = array(), $timestamp = null ) { $pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp ); if ( null !== $pre ) { return $pre; } if ( null !== $timestamp && ! is_numeric( $timestamp ) ) { return false; } $crons = _get_cron_array(); if ( empty( $crons ) ) { return false; } $key = md5( serialize( $args ) ); if ( ! $timestamp ) { $next = false; foreach ( $crons as $timestamp => $cron ) { if ( isset( $cron[ $hook ][ $key ] ) ) { $next = $timestamp; break; } } if ( ! $next ) { return false; } $timestamp = $next; } elseif ( ! isset( $crons[ $timestamp ][ $hook ][ $key ] ) ) { return false; } $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $crons[ $timestamp ][ $hook ][ $key ]['schedule'], 'args' => $args, ); if ( isset( $crons[ $timestamp ][ $hook ][ $key ]['interval'] ) ) { $event->interval = $crons[ $timestamp ][ $hook ][ $key ]['interval']; } return $event; } function wp_next_scheduled( $hook, $args = array() ) { $next_event = wp_get_scheduled_event( $hook, $args ); if ( ! $next_event ) { return false; } return $next_event->timestamp; } function spawn_cron( $gmt_time = 0 ) { if ( ! $gmt_time ) { $gmt_time = microtime( true ); } if ( defined( 'DOING_CRON' ) || isset( $_GET['doing_wp_cron'] ) ) { return false; } $lock = get_transient( 'doing_cron' ); if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS ) { $lock = 0; } if ( $lock + WP_CRON_LOCK_TIMEOUT > $gmt_time ) { return false; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return false; } $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return false; } if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { if ( 'GET' !== $_SERVER['REQUEST_METHOD'] || defined( 'DOING_AJAX' ) || defined( 'XMLRPC_REQUEST' ) ) { return false; } $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); ob_start(); wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); echo ' '; wp_ob_end_flush_all(); flush(); include_once ABSPATH . 'wp-cron.php'; return true; } $doing_wp_cron = sprintf( '%.22F', $gmt_time ); set_transient( 'doing_cron', $doing_wp_cron ); $cron_request = apply_filters( 'cron_request', array( 'url' => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ), 'key' => $doing_wp_cron, 'args' => array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), ), ), $doing_wp_cron ); $result = wp_remote_post( $cron_request['url'], $cron_request['args'] ); return ! is_wp_error( $result ); } function wp_cron() { if ( did_action( 'wp_loaded' ) ) { return _wp_cron(); } add_action( 'wp_loaded', '_wp_cron', 20 ); } function _wp_cron() { if ( strpos( $_SERVER['REQUEST_URI'], '/wp-cron.php' ) !== false || ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ) { return 0; } $crons = wp_get_ready_cron_jobs(); if ( empty( $crons ) ) { return 0; } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return 0; } $schedules = wp_get_schedules(); $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } foreach ( (array) $cronhooks as $hook => $args ) { if ( isset( $schedules[ $hook ]['callback'] ) && ! call_user_func( $schedules[ $hook ]['callback'] ) ) { continue; } $results[] = spawn_cron( $gmt_time ); break 2; } } if ( in_array( false, $results, true ) ) { return false; } return count( $results ); } function wp_get_schedules() { $schedules = array( 'hourly' => array( 'interval' => HOUR_IN_SECONDS, 'display' => __( 'Once Hourly' ), ), 'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ), ), 'daily' => array( 'interval' => DAY_IN_SECONDS, 'display' => __( 'Once Daily' ), ), 'weekly' => array( 'interval' => WEEK_IN_SECONDS, 'display' => __( 'Once Weekly' ), ), ); return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); } function wp_get_schedule( $hook, $args = array() ) { $schedule = false; $event = wp_get_scheduled_event( $hook, $args ); if ( $event ) { $schedule = $event->schedule; } return apply_filters( 'get_schedule', $schedule, $hook, $args ); } function wp_get_ready_cron_jobs() { $pre = apply_filters( 'pre_get_ready_cron_jobs', null ); if ( null !== $pre ) { return $pre; } $crons = _get_cron_array(); if ( ! is_array( $crons ) ) { return array(); } $gmt_time = microtime( true ); $keys = array_keys( $crons ); if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { return array(); } $results = array(); foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $gmt_time ) { break; } $results[ $timestamp ] = $cronhooks; } return $results; } function _get_cron_array() { $cron = get_option( 'cron' ); if ( ! is_array( $cron ) ) { return false; } if ( ! isset( $cron['version'] ) ) { $cron = _upgrade_cron_array( $cron ); } unset( $cron['version'] ); return $cron; } function _set_cron_array( $cron, $wp_error = false ) { if ( ! is_array( $cron ) ) { $cron = array(); } $cron['version'] = 2; $result = update_option( 'cron', $cron ); if ( $wp_error && ! $result ) { return new WP_Error( 'could_not_set', __( 'The cron event list could not be saved.' ) ); } return $result; } function _upgrade_cron_array( $cron ) { if ( isset( $cron['version'] ) && 2 == $cron['version'] ) { return $cron; } $new_cron = array(); foreach ( (array) $cron as $timestamp => $hooks ) { foreach ( (array) $hooks as $hook => $args ) { $key = md5( serialize( $args['args'] ) ); $new_cron[ $timestamp ][ $hook ][ $key ] = $args; } } $new_cron['version'] = 2; update_option( 'cron', $new_cron ); return $new_cron; } - - handlers[ $priority ][ $id ] = array( 'regex' => $regex, 'callback' => $callback, ); } public function unregister_handler( $id, $priority = 10 ) { unset( $this->handlers[ $priority ][ $id ] ); } public function get_embed_handler_html( $attr, $url ) { $rawattr = $attr; $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) ); ksort( $this->handlers ); foreach ( $this->handlers as $priority => $handlers ) { foreach ( $handlers as $id => $handler ) { if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ); if ( false !== $return ) { return apply_filters( 'embed_handler_html', $return, $url, $attr ); } } } } return false; } public function shortcode( $attr, $url = '' ) { $post = get_post(); if ( empty( $url ) && ! empty( $attr['src'] ) ) { $url = $attr['src']; } $this->last_url = $url; if ( empty( $url ) ) { $this->last_attr = $attr; return ''; } $rawattr = $attr; $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) ); $this->last_attr = $attr; $url = str_replace( '&', '&', $url ); $embed_handler_html = $this->get_embed_handler_html( $rawattr, $url ); if ( false !== $embed_handler_html ) { return $embed_handler_html; } $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null; if ( ! empty( $this->post_ID ) ) { $post_ID = $this->post_ID; } $key_suffix = md5( $url . serialize( $attr ) ); $cachekey = '_oembed_' . $key_suffix; $cachekey_time = '_oembed_time_' . $key_suffix; $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID ); $cache = ''; $cache_time = 0; $cached_post_id = $this->find_oembed_post_id( $key_suffix ); if ( $post_ID ) { $cache = get_post_meta( $post_ID, $cachekey, true ); $cache_time = get_post_meta( $post_ID, $cachekey_time, true ); if ( ! $cache_time ) { $cache_time = 0; } } elseif ( $cached_post_id ) { $cached_post = get_post( $cached_post_id ); $cache = $cached_post->post_content; $cache_time = strtotime( $cached_post->post_modified_gmt ); } $cached_recently = ( time() - $cache_time ) < $ttl; if ( $this->usecache || $cached_recently ) { if ( '{{unknown}}' === $cache ) { return $this->maybe_make_link( $url ); } if ( ! empty( $cache ) ) { return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); } } $attr['discover'] = apply_filters( 'embed_oembed_discover', true ); $html = wp_oembed_get( $url, $attr ); if ( $post_ID ) { if ( $html ) { update_post_meta( $post_ID, $cachekey, $html ); update_post_meta( $post_ID, $cachekey_time, time() ); } elseif ( ! $cache ) { update_post_meta( $post_ID, $cachekey, '{{unknown}}' ); } } else { $has_kses = false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ); if ( $has_kses ) { kses_remove_filters(); } $insert_post_args = array( 'post_name' => $key_suffix, 'post_status' => 'publish', 'post_type' => 'oembed_cache', ); if ( $html ) { if ( $cached_post_id ) { wp_update_post( wp_slash( array( 'ID' => $cached_post_id, 'post_content' => $html, ) ) ); } else { wp_insert_post( wp_slash( array_merge( $insert_post_args, array( 'post_content' => $html, ) ) ) ); } } elseif ( ! $cache ) { wp_insert_post( wp_slash( array_merge( $insert_post_args, array( 'post_content' => '{{unknown}}', ) ) ) ); } if ( $has_kses ) { kses_init_filters(); } } if ( $html ) { return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); } return $this->maybe_make_link( $url ); } public function delete_oembed_caches( $post_ID ) { $post_metas = get_post_custom_keys( $post_ID ); if ( empty( $post_metas ) ) { return; } foreach ( $post_metas as $post_meta_key ) { if ( '_oembed_' === substr( $post_meta_key, 0, 8 ) ) { delete_post_meta( $post_ID, $post_meta_key ); } } } public function cache_oembed( $post_ID ) { $post = get_post( $post_ID ); $post_types = get_post_types( array( 'show_ui' => true ) ); $cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types ); if ( empty( $post->ID ) || ! in_array( $post->post_type, $cache_oembed_types, true ) ) { return; } if ( ! empty( $post->post_content ) ) { $this->post_ID = $post->ID; $this->usecache = false; $content = $this->run_shortcode( $post->post_content ); $this->autoembed( $content ); $this->usecache = true; } } public function autoembed( $content ) { $content = wp_replace_in_html_tags( $content, array( "\n" => '' ) ); if ( preg_match( '#(^|\s|>)https?://#i', $content ) ) { $content = preg_replace_callback( '|^(\s*)(https?://[^\s<>"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); $content = preg_replace_callback( '|(]*)?>\s*)(https?://[^\s<>"]+)(\s*<\/p>)|i', array( $this, 'autoembed_callback' ), $content ); } return str_replace( '', "\n", $content ); } public function autoembed_callback( $matches ) { $oldval = $this->linkifunknown; $this->linkifunknown = false; $return = $this->shortcode( array(), $matches[2] ); $this->linkifunknown = $oldval; return $matches[1] . $return . $matches[3]; } public function maybe_make_link( $url ) { if ( $this->return_false_on_fail ) { return false; } $output = ( $this->linkifunknown ) ? '' . esc_html( $url ) . '' : $url; return apply_filters( 'embed_maybe_make_link', $output, $url ); } public function find_oembed_post_id( $cache_key ) { $cache_group = 'oembed_cache_post'; $oembed_post_id = wp_cache_get( $cache_key, $cache_group ); if ( $oembed_post_id && 'oembed_cache' === get_post_type( $oembed_post_id ) ) { return $oembed_post_id; } $oembed_post_query = new WP_Query( array( 'post_type' => 'oembed_cache', 'post_status' => 'publish', 'name' => $cache_key, 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ) ); if ( ! empty( $oembed_post_query->posts ) ) { $oembed_post_id = $oembed_post_query->posts[0]->ID; wp_cache_set( $cache_key, $oembed_post_id, $cache_group ); return $oembed_post_id; } return null; } } queue : (array) $handles; $this->all_deps( $handles ); foreach ( $this->to_do as $key => $handle ) { if ( ! in_array( $handle, $this->done, true ) && isset( $this->registered[ $handle ] ) ) { if ( $this->do_item( $handle, $group ) ) { $this->done[] = $handle; } unset( $this->to_do[ $key ] ); } } return $this->done; } public function do_item( $handle, $group = false ) { return isset( $this->registered[ $handle ] ); } public function all_deps( $handles, $recursion = false, $group = false ) { $handles = (array) $handles; if ( ! $handles ) { return false; } foreach ( $handles as $handle ) { $handle_parts = explode( '?', $handle ); $handle = $handle_parts[0]; $queued = in_array( $handle, $this->to_do, true ); if ( in_array( $handle, $this->done, true ) ) { continue; } $moved = $this->set_group( $handle, $recursion, $group ); $new_group = $this->groups[ $handle ]; if ( $queued && ! $moved ) { continue; } $keep_going = true; if ( ! isset( $this->registered[ $handle ] ) ) { $keep_going = false; } elseif ( $this->registered[ $handle ]->deps && array_diff( $this->registered[ $handle ]->deps, array_keys( $this->registered ) ) ) { $keep_going = false; } elseif ( $this->registered[ $handle ]->deps && ! $this->all_deps( $this->registered[ $handle ]->deps, true, $new_group ) ) { $keep_going = false; } if ( ! $keep_going ) { if ( $recursion ) { return false; } else { continue; } } if ( $queued ) { continue; } if ( isset( $handle_parts[1] ) ) { $this->args[ $handle ] = $handle_parts[1]; } $this->to_do[] = $handle; } return true; } public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { if ( isset( $this->registered[ $handle ] ) ) { return false; } $this->registered[ $handle ] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); if ( array_key_exists( $handle, $this->queued_before_register ) ) { if ( ! is_null( $this->queued_before_register[ $handle ] ) ) { $this->enqueue( $handle . '?' . $this->queued_before_register[ $handle ] ); } else { $this->enqueue( $handle ); } unset( $this->queued_before_register[ $handle ] ); } return true; } public function add_data( $handle, $key, $value ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } return $this->registered[ $handle ]->add_data( $key, $value ); } public function get_data( $handle, $key ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } if ( ! isset( $this->registered[ $handle ]->extra[ $key ] ) ) { return false; } return $this->registered[ $handle ]->extra[ $key ]; } public function remove( $handles ) { foreach ( (array) $handles as $handle ) { unset( $this->registered[ $handle ] ); } } public function enqueue( $handles ) { foreach ( (array) $handles as $handle ) { $handle = explode( '?', $handle ); if ( ! in_array( $handle[0], $this->queue, true ) && isset( $this->registered[ $handle[0] ] ) ) { $this->queue[] = $handle[0]; $this->all_queued_deps = null; if ( isset( $handle[1] ) ) { $this->args[ $handle[0] ] = $handle[1]; } } elseif ( ! isset( $this->registered[ $handle[0] ] ) ) { $this->queued_before_register[ $handle[0] ] = null; if ( isset( $handle[1] ) ) { $this->queued_before_register[ $handle[0] ] = $handle[1]; } } } } public function dequeue( $handles ) { foreach ( (array) $handles as $handle ) { $handle = explode( '?', $handle ); $key = array_search( $handle[0], $this->queue, true ); if ( false !== $key ) { $this->all_queued_deps = null; unset( $this->queue[ $key ] ); unset( $this->args[ $handle[0] ] ); } elseif ( array_key_exists( $handle[0], $this->queued_before_register ) ) { unset( $this->queued_before_register[ $handle[0] ] ); } } } protected function recurse_deps( $queue, $handle ) { if ( isset( $this->all_queued_deps ) ) { return isset( $this->all_queued_deps[ $handle ] ); } $all_deps = array_fill_keys( $queue, true ); $queues = array(); $done = array(); while ( $queue ) { foreach ( $queue as $queued ) { if ( ! isset( $done[ $queued ] ) && isset( $this->registered[ $queued ] ) ) { $deps = $this->registered[ $queued ]->deps; if ( $deps ) { $all_deps += array_fill_keys( $deps, true ); array_push( $queues, $deps ); } $done[ $queued ] = true; } } $queue = array_pop( $queues ); } $this->all_queued_deps = $all_deps; return isset( $this->all_queued_deps[ $handle ] ); } public function query( $handle, $status = 'registered' ) { switch ( $status ) { case 'registered': case 'scripts': if ( isset( $this->registered[ $handle ] ) ) { return $this->registered[ $handle ]; } return false; case 'enqueued': case 'queue': if ( in_array( $handle, $this->queue, true ) ) { return true; } return $this->recurse_deps( $this->queue, $handle ); case 'to_do': case 'to_print': return in_array( $handle, $this->to_do, true ); case 'done': case 'printed': return in_array( $handle, $this->done, true ); } return false; } public function set_group( $handle, $recursion, $group ) { $group = (int) $group; if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) { return false; } $this->groups[ $handle ] = $group; return true; } } true ) ); if ( is_array( $decoded_file ) ) { $config = $decoded_file; } } return $config; } public static function get_fields_to_translate() { _deprecated_function( __METHOD__, '5.9.0' ); return array(); } protected static function translate( $theme_json, $domain = 'default' ) { if ( null === static::$i18n_schema ) { $i18n_schema = wp_json_file_decode( __DIR__ . '/theme-i18n.json' ); static::$i18n_schema = null === $i18n_schema ? array() : $i18n_schema; } return translate_settings_using_i18n_schema( static::$i18n_schema, $theme_json, $domain ); } public static function get_core_data() { if ( null !== static::$core ) { return static::$core; } $config = static::read_json_file( __DIR__ . '/theme.json' ); $config = static::translate( $config ); static::$core = new WP_Theme_JSON( $config, 'default' ); return static::$core; } public static function get_theme_data( $deprecated = array(), $options = array() ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __METHOD__, '5.9.0' ); } $options = wp_parse_args( $options, array( 'with_supports' => true ) ); if ( null === static::$theme ) { $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); static::$theme = new WP_Theme_JSON( $theme_json_data ); if ( wp_get_theme()->parent() ) { $parent_theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json', true ) ); $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) ); $parent_theme = new WP_Theme_JSON( $parent_theme_json_data ); $parent_theme->merge( static::$theme ); static::$theme = $parent_theme; } } if ( ! $options['with_supports'] ) { return static::$theme; } $theme_support_data = WP_Theme_JSON::get_from_editor_settings( get_default_block_editor_settings() ); if ( ! static::theme_has_support() ) { if ( ! isset( $theme_support_data['settings']['color'] ) ) { $theme_support_data['settings']['color'] = array(); } $default_palette = false; if ( current_theme_supports( 'default-color-palette' ) ) { $default_palette = true; } if ( ! isset( $theme_support_data['settings']['color']['palette'] ) ) { $default_palette = true; } $theme_support_data['settings']['color']['defaultPalette'] = $default_palette; $default_gradients = false; if ( current_theme_supports( 'default-gradient-presets' ) ) { $default_gradients = true; } if ( ! isset( $theme_support_data['settings']['color']['gradients'] ) ) { $default_gradients = true; } $theme_support_data['settings']['color']['defaultGradients'] = $default_gradients; $theme_support_data['settings']['color']['defaultDuotone'] = false; } $with_theme_supports = new WP_Theme_JSON( $theme_support_data ); $with_theme_supports->merge( static::$theme ); return $with_theme_supports; } public static function get_user_data_from_wp_global_styles( $theme, $create_post = false, $post_status_filter = array( 'publish' ) ) { if ( ! $theme instanceof WP_Theme ) { $theme = wp_get_theme(); } $user_cpt = array(); $post_type_filter = 'wp_global_styles'; $args = array( 'numberposts' => 1, 'orderby' => 'date', 'order' => 'desc', 'post_type' => $post_type_filter, 'post_status' => $post_status_filter, 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => $theme->get_stylesheet(), ), ), ); $cache_key = sprintf( 'wp_global_styles_%s', md5( serialize( $args ) ) ); $post_id = wp_cache_get( $cache_key ); if ( (int) $post_id > 0 ) { return get_post( $post_id, ARRAY_A ); } if ( -1 === $post_id && ! $create_post ) { return $user_cpt; } $recent_posts = wp_get_recent_posts( $args ); if ( is_array( $recent_posts ) && ( count( $recent_posts ) === 1 ) ) { $user_cpt = $recent_posts[0]; } elseif ( $create_post ) { $cpt_post_id = wp_insert_post( array( 'post_content' => '{"version": ' . WP_Theme_JSON::LATEST_SCHEMA . ', "isGlobalStylesUserThemeJSON": true }', 'post_status' => 'publish', 'post_title' => 'Custom Styles', 'post_type' => $post_type_filter, 'post_name' => 'wp-global-styles-' . urlencode( wp_get_theme()->get_stylesheet() ), 'tax_input' => array( 'wp_theme' => array( wp_get_theme()->get_stylesheet() ), ), ), true ); $user_cpt = get_post( $cpt_post_id, ARRAY_A ); } $cache_expiration = $user_cpt ? DAY_IN_SECONDS : HOUR_IN_SECONDS; wp_cache_set( $cache_key, $user_cpt ? $user_cpt['ID'] : -1, '', $cache_expiration ); return $user_cpt; } public static function get_user_data() { if ( null !== static::$user ) { return static::$user; } $config = array(); $user_cpt = static::get_user_data_from_wp_global_styles( wp_get_theme() ); if ( array_key_exists( 'post_content', $user_cpt ) ) { $decoded_data = json_decode( $user_cpt['post_content'], true ); $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() ); return new WP_Theme_JSON( $config, 'custom' ); } if ( is_array( $decoded_data ) && isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) && $decoded_data['isGlobalStylesUserThemeJSON'] ) { unset( $decoded_data['isGlobalStylesUserThemeJSON'] ); $config = $decoded_data; } } static::$user = new WP_Theme_JSON( $config, 'custom' ); return static::$user; } public static function get_merged_data( $origin = 'custom' ) { if ( is_array( $origin ) ) { _deprecated_argument( __FUNCTION__, '5.9.0' ); } $result = new WP_Theme_JSON(); $result->merge( static::get_core_data() ); $result->merge( static::get_theme_data() ); if ( 'custom' === $origin ) { $result->merge( static::get_user_data() ); } return $result; } public static function get_user_global_styles_post_id() { if ( null !== static::$user_custom_post_type_id ) { return static::$user_custom_post_type_id; } $user_cpt = static::get_user_data_from_wp_global_styles( wp_get_theme(), true ); if ( array_key_exists( 'ID', $user_cpt ) ) { static::$user_custom_post_type_id = $user_cpt['ID']; } return static::$user_custom_post_type_id; } public static function theme_has_support() { if ( ! isset( static::$theme_has_support ) ) { static::$theme_has_support = ( is_readable( static::get_file_path_from_theme( 'theme.json' ) ) || is_readable( static::get_file_path_from_theme( 'theme.json', true ) ) ); } return static::$theme_has_support; } protected static function get_file_path_from_theme( $file_name, $template = false ) { $path = $template ? get_template_directory() : get_stylesheet_directory(); $candidate = $path . '/' . $file_name; return is_readable( $candidate ) ? $candidate : ''; } public static function clean_cached_data() { static::$core = null; static::$theme = null; static::$user = null; static::$user_custom_post_type_id = null; static::$theme_has_support = null; static::$i18n_schema = null; } public static function get_style_variations() { $variations = array(); $base_directory = get_stylesheet_directory() . '/styles'; if ( is_dir( $base_directory ) ) { $nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = iterator_to_array( new RegexIterator( $nested_files, '/^.+\.json$/i', RecursiveRegexIterator::GET_MATCH ) ); ksort( $nested_html_files ); foreach ( $nested_html_files as $path => $file ) { $decoded_file = wp_json_file_decode( $path, array( 'associative' => true ) ); if ( is_array( $decoded_file ) ) { $translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) ); $variation = ( new WP_Theme_JSON( $translated ) )->get_raw_data(); if ( empty( $variation['title'] ) ) { $variation['title'] = basename( $path, '.json' ); } $variations[] = $variation; } } } return $variations; } } add( $code, $message, $data ); } public function get_error_codes() { if ( ! $this->has_errors() ) { return array(); } return array_keys( $this->errors ); } public function get_error_code() { $codes = $this->get_error_codes(); if ( empty( $codes ) ) { return ''; } return $codes[0]; } public function get_error_messages( $code = '' ) { if ( empty( $code ) ) { $all_messages = array(); foreach ( (array) $this->errors as $code => $messages ) { $all_messages = array_merge( $all_messages, $messages ); } return $all_messages; } if ( isset( $this->errors[ $code ] ) ) { return $this->errors[ $code ]; } else { return array(); } } public function get_error_message( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $messages = $this->get_error_messages( $code ); if ( empty( $messages ) ) { return ''; } return $messages[0]; } public function get_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { return $this->error_data[ $code ]; } } public function has_errors() { if ( ! empty( $this->errors ) ) { return true; } return false; } public function add( $code, $message, $data = '' ) { $this->errors[ $code ][] = $message; if ( ! empty( $data ) ) { $this->add_data( $data, $code ); } do_action( 'wp_error_added', $code, $message, $data, $this ); } public function add_data( $data, $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { $this->additional_data[ $code ][] = $this->error_data[ $code ]; } $this->error_data[ $code ] = $data; } public function get_all_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $data = array(); if ( isset( $this->additional_data[ $code ] ) ) { $data = $this->additional_data[ $code ]; } if ( isset( $this->error_data[ $code ] ) ) { $data[] = $this->error_data[ $code ]; } return $data; } public function remove( $code ) { unset( $this->errors[ $code ] ); unset( $this->error_data[ $code ] ); unset( $this->additional_data[ $code ] ); } public function merge_from( WP_Error $error ) { static::copy_errors( $error, $this ); } public function export_to( WP_Error $error ) { static::copy_errors( $this, $error ); } protected static function copy_errors( WP_Error $from, WP_Error $to ) { foreach ( $from->get_error_codes() as $code ) { foreach ( $from->get_error_messages( $code ) as $error_message ) { $to->add( $code, $error_message ); } foreach ( $from->get_all_error_data( $code ) as $data ) { $to->add_data( $data, $code ); } } } } $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->controls = array(); } final public function active() { $section = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_section_active', $active, $section ); return $active; } public function active_callback() { return true; } public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden' ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; if ( $this->panel ) { $array['customizeAction'] = sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); } else { $array['customizeAction'] = __( 'Customizing' ); } return $array; } final public function check_capabilities() { if ( $this->capability && ! current_user_can( $this->capability ) ) { return false; } if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_section', $this ); do_action( "customize_render_section_{$this->id}" ); $this->render(); } protected function render() {} public function print_template() { ?> - - -
              • -

                - {{ data.title }} - -

                -
                  - -
                -
              • - link_id, $bookmark, 'bookmark' ); $_bookmark = $bookmark; } else { if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) { $_bookmark = & $GLOBALS['link']; } else { $_bookmark = wp_cache_get( $bookmark, 'bookmark' ); if ( ! $_bookmark ) { $_bookmark = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark ) ); if ( $_bookmark ) { $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); } } } } if ( ! $_bookmark ) { return $_bookmark; } $_bookmark = sanitize_bookmark( $_bookmark, $filter ); if ( OBJECT === $output ) { return $_bookmark; } elseif ( ARRAY_A === $output ) { return get_object_vars( $_bookmark ); } elseif ( ARRAY_N === $output ) { return array_values( get_object_vars( $_bookmark ) ); } else { return $_bookmark; } } function get_bookmark_field( $field, $bookmark, $context = 'display' ) { $bookmark = (int) $bookmark; $bookmark = get_bookmark( $bookmark ); if ( is_wp_error( $bookmark ) ) { return $bookmark; } if ( ! is_object( $bookmark ) ) { return ''; } if ( ! isset( $bookmark->$field ) ) { return ''; } return sanitize_bookmark_field( $field, $bookmark->$field, $bookmark->link_id, $context ); } function get_bookmarks( $args = '' ) { global $wpdb; $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => '', 'search' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $key = md5( serialize( $parsed_args ) ); $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ); if ( 'rand' !== $parsed_args['orderby'] && $cache ) { if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { $bookmarks = $cache[ $key ]; return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args ); } } if ( ! is_array( $cache ) ) { $cache = array(); } $inclusions = ''; if ( ! empty( $parsed_args['include'] ) ) { $parsed_args['exclude'] = ''; $parsed_args['category'] = ''; $parsed_args['category_name'] = ''; $inclinks = wp_parse_id_list( $parsed_args['include'] ); if ( count( $inclinks ) ) { foreach ( $inclinks as $inclink ) { if ( empty( $inclusions ) ) { $inclusions = ' AND ( link_id = ' . $inclink . ' '; } else { $inclusions .= ' OR link_id = ' . $inclink . ' '; } } } } if ( ! empty( $inclusions ) ) { $inclusions .= ')'; } $exclusions = ''; if ( ! empty( $parsed_args['exclude'] ) ) { $exlinks = wp_parse_id_list( $parsed_args['exclude'] ); if ( count( $exlinks ) ) { foreach ( $exlinks as $exlink ) { if ( empty( $exclusions ) ) { $exclusions = ' AND ( link_id <> ' . $exlink . ' '; } else { $exclusions .= ' AND link_id <> ' . $exlink . ' '; } } } } if ( ! empty( $exclusions ) ) { $exclusions .= ')'; } if ( ! empty( $parsed_args['category_name'] ) ) { $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' ); if ( $parsed_args['category'] ) { $parsed_args['category'] = $parsed_args['category']->term_id; } else { $cache[ $key ] = array(); wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); return apply_filters( 'get_bookmarks', array(), $parsed_args ); } } $search = ''; if ( ! empty( $parsed_args['search'] ) ) { $like = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%'; $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like ); } $category_query = ''; $join = ''; if ( ! empty( $parsed_args['category'] ) ) { $incategories = wp_parse_id_list( $parsed_args['category'] ); if ( count( $incategories ) ) { foreach ( $incategories as $incat ) { if ( empty( $category_query ) ) { $category_query = ' AND ( tt.term_id = ' . $incat . ' '; } else { $category_query .= ' OR tt.term_id = ' . $incat . ' '; } } } } if ( ! empty( $category_query ) ) { $category_query .= ") AND taxonomy = 'link_category'"; $join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; } if ( $parsed_args['show_updated'] ) { $recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated '; } else { $recently_updated_test = ''; } $get_updated = ( $parsed_args['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; $orderby = strtolower( $parsed_args['orderby'] ); $length = ''; switch ( $orderby ) { case 'length': $length = ', CHAR_LENGTH(link_name) AS length'; break; case 'rand': $orderby = 'rand()'; break; case 'link_id': $orderby = "$wpdb->links.link_id"; break; default: $orderparams = array(); $keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' ); foreach ( explode( ',', $orderby ) as $ordparam ) { $ordparam = trim( $ordparam ); if ( in_array( 'link_' . $ordparam, $keys, true ) ) { $orderparams[] = 'link_' . $ordparam; } elseif ( in_array( $ordparam, $keys, true ) ) { $orderparams[] = $ordparam; } } $orderby = implode( ',', $orderparams ); } if ( empty( $orderby ) ) { $orderby = 'link_name'; } $order = strtoupper( $parsed_args['order'] ); if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) { $order = 'ASC'; } $visible = ''; if ( $parsed_args['hide_invisible'] ) { $visible = "AND link_visible = 'Y'"; } $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; $query .= " $exclusions $inclusions $search"; $query .= " ORDER BY $orderby $order"; if ( -1 != $parsed_args['limit'] ) { $query .= ' LIMIT ' . $parsed_args['limit']; } $results = $wpdb->get_results( $query ); if ( 'rand()' !== $orderby ) { $cache[ $key ] = $results; wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); } return apply_filters( 'get_bookmarks', $results, $parsed_args ); } function sanitize_bookmark( $bookmark, $context = 'display' ) { $fields = array( 'link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated', 'link_rel', 'link_notes', 'link_rss', ); if ( is_object( $bookmark ) ) { $do_object = true; $link_id = $bookmark->link_id; } else { $do_object = false; $link_id = $bookmark['link_id']; } foreach ( $fields as $field ) { if ( $do_object ) { if ( isset( $bookmark->$field ) ) { $bookmark->$field = sanitize_bookmark_field( $field, $bookmark->$field, $link_id, $context ); } } else { if ( isset( $bookmark[ $field ] ) ) { $bookmark[ $field ] = sanitize_bookmark_field( $field, $bookmark[ $field ], $link_id, $context ); } } } return $bookmark; } function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { $int_fields = array( 'link_id', 'link_rating' ); if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } switch ( $field ) { case 'link_category': $value = array_map( 'absint', (array) $value ); return $value; case 'link_visible': $value = preg_replace( '/[^YNyn]/', '', $value ); break; case 'link_target': $targets = array( '_top', '_blank' ); if ( ! in_array( $value, $targets, true ) ) { $value = ''; } break; } if ( 'raw' === $context ) { return $value; } if ( 'edit' === $context ) { $value = apply_filters( "edit_{$field}", $value, $bookmark_id ); if ( 'link_notes' === $field ) { $value = esc_html( $value ); } else { $value = esc_attr( $value ); } } elseif ( 'db' === $context ) { $value = apply_filters( "pre_{$field}", $value ); } else { $value = apply_filters( "{$field}", $value, $bookmark_id, $context ); if ( 'attribute' === $context ) { $value = esc_attr( $value ); } elseif ( 'js' === $context ) { $value = esc_js( $value ); } } if ( in_array( $field, $int_fields, true ) ) { $value = (int) $value; } return $value; } function clean_bookmark_cache( $bookmark_id ) { wp_cache_delete( $bookmark_id, 'bookmark' ); wp_cache_delete( 'get_bookmarks', 'bookmark' ); clean_object_term_cache( $bookmark_id, 'link' ); } path ); } if ( ! defined( 'SITECOOKIEPATH' ) ) { define( 'SITECOOKIEPATH', $current_network->path ); } if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) { $site_path = parse_url( get_option( 'siteurl' ), PHP_URL_PATH ); if ( ! is_subdomain_install() || is_string( $site_path ) && trim( $site_path, '/' ) ) { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); } else { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); } } if ( ! defined( 'COOKIE_DOMAIN' ) && is_subdomain_install() ) { if ( ! empty( $current_network->cookie_domain ) ) { define( 'COOKIE_DOMAIN', '.' . $current_network->cookie_domain ); } else { define( 'COOKIE_DOMAIN', '.' . $current_network->domain ); } } } function ms_file_constants() { if ( ! defined( 'WPMU_SENDFILE' ) ) { define( 'WPMU_SENDFILE', false ); } if ( ! defined( 'WPMU_ACCEL_REDIRECT' ) ) { define( 'WPMU_ACCEL_REDIRECT', false ); } } function ms_subdomain_constants() { static $subdomain_error = null; static $subdomain_error_warn = null; if ( false === $subdomain_error ) { return; } if ( $subdomain_error ) { $vhost_deprecated = sprintf( __( 'The constant %1$s is deprecated. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ), 'VHOST', 'SUBDOMAIN_INSTALL', 'wp-config.php', 'is_subdomain_install()' ); if ( $subdomain_error_warn ) { trigger_error( __( 'Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL. The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); } else { _deprecated_argument( 'define()', '3.0.0', $vhost_deprecated ); } return; } if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { $subdomain_error = true; if ( SUBDOMAIN_INSTALL !== ( 'yes' === VHOST ) ) { $subdomain_error_warn = true; } } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { $subdomain_error = false; define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); } elseif ( defined( 'VHOST' ) ) { $subdomain_error = true; define( 'SUBDOMAIN_INSTALL', 'yes' === VHOST ); } else { $subdomain_error = false; define( 'SUBDOMAIN_INSTALL', false ); define( 'VHOST', 'no' ); } } content ) && is_user_logged_in() ) { $_wp_current_template_content = sprintf( __( 'Empty template: %s' ), $block_template->title ); } elseif ( ! empty( $block_template->content ) ) { $_wp_current_template_content = $block_template->content; } if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_success( $block_template ); } } else { if ( $template ) { return $template; } if ( 'index' === $type ) { if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_error( array( 'message' => __( 'No matching template found.' ) ) ); } } else { return ''; } } add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 ); remove_action( 'wp_head', '_wp_render_title_tag', 1 ); add_action( 'wp_head', '_block_template_render_title_tag', 1 ); return ABSPATH . WPINC . '/template-canvas.php'; } function resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) { if ( ! $template_type ) { return null; } if ( empty( $template_hierarchy ) ) { $template_hierarchy = array( $template_type ); } $slugs = array_map( '_strip_template_file_suffix', $template_hierarchy ); $query = array( 'theme' => wp_get_theme()->get_stylesheet(), 'slug__in' => $slugs, ); $templates = get_block_templates( $query ); $slug_priorities = array_flip( $slugs ); usort( $templates, static function ( $template_a, $template_b ) use ( $slug_priorities ) { return $slug_priorities[ $template_a->slug ] - $slug_priorities[ $template_b->slug ]; } ); $theme_base_path = get_stylesheet_directory() . DIRECTORY_SEPARATOR; $parent_theme_base_path = get_template_directory() . DIRECTORY_SEPARATOR; if ( strpos( $fallback_template, $theme_base_path ) === 0 && strpos( $fallback_template, $parent_theme_base_path ) === false ) { $fallback_template_slug = substr( $fallback_template, strpos( $fallback_template, $theme_base_path ) + strlen( $theme_base_path ), -4 ); if ( count( $templates ) && $fallback_template_slug === $templates[0]->slug && 'theme' === $templates[0]->source ) { $template_file = _get_block_template_file( 'wp_template', $fallback_template_slug ); if ( $template_file && get_template() === $template_file['theme'] ) { array_shift( $templates ); } } } return count( $templates ) ? $templates[0] : null; } function _block_template_render_title_tag() { echo '' . wp_get_document_title() . '' . "\n"; } function get_the_block_template_html() { global $_wp_current_template_content; global $wp_embed; if ( ! $_wp_current_template_content ) { if ( is_user_logged_in() ) { return '

                ' . esc_html__( 'No matching template found' ) . '

                '; } return; } $content = $wp_embed->run_shortcode( $_wp_current_template_content ); $content = $wp_embed->autoembed( $content ); $content = do_blocks( $content ); $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = shortcode_unautop( $content ); $content = wp_filter_content_tags( $content ); $content = do_shortcode( $content ); $content = str_replace( ']]>', ']]>', $content ); return '
                ' . $content . '
                '; } function _block_template_viewport_meta_tag() { echo '' . "\n"; } function _strip_template_file_suffix( $template_file ) { return preg_replace( '/\.(php|html)$/', '', $template_file ); } function _block_template_render_without_post_block_context( $context ) { if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) { unset( $context['postId'] ); unset( $context['postType'] ); } return $context; } function _resolve_template_for_new_post( $wp_query ) { if ( ! $wp_query->is_main_query() ) { return; } remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' ); $page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null; $p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null; $post_id = $page_id ? $page_id : $p; $post = get_post( $post_id ); if ( $post && 'auto-draft' === $post->post_status && current_user_can( 'edit_post', $post->ID ) ) { $wp_query->set( 'post_status', 'auto-draft' ); } } function _resolve_home_block_template() { $show_on_front = get_option( 'show_on_front' ); $front_page_id = get_option( 'page_on_front' ); if ( 'page' === $show_on_front && $front_page_id ) { return array( 'postType' => 'page', 'postId' => $front_page_id, ); } $hierarchy = array( 'front-page', 'home', 'index' ); $template = resolve_block_template( 'home', $hierarchy, '' ); if ( ! $template ) { return null; } return array( 'postType' => 'wp_template', 'postId' => $template->id, ); } $value ) { if ( is_string( $value ) ) { $robots_strings[] = "{$directive}:{$value}"; } elseif ( $value ) { $robots_strings[] = $directive; } } if ( empty( $robots_strings ) ) { return; } echo "\n"; } function wp_robots_noindex( array $robots ) { if ( ! get_option( 'blog_public' ) ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_noindex_embeds( array $robots ) { if ( is_embed() ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_noindex_search( array $robots ) { if ( is_search() ) { return wp_robots_no_robots( $robots ); } return $robots; } function wp_robots_no_robots( array $robots ) { $robots['noindex'] = true; if ( get_option( 'blog_public' ) ) { $robots['follow'] = true; } else { $robots['nofollow'] = true; } return $robots; } function wp_robots_sensitive_page( array $robots ) { $robots['noindex'] = true; $robots['noarchive'] = true; return $robots; } function wp_robots_max_image_preview_large( array $robots ) { if ( get_option( 'blog_public' ) ) { $robots['max-image-preview'] = 'large'; } return $robots; } itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) $iteration_count_log2 = 8; $this->iteration_count_log2 = $iteration_count_log2; $this->portable_hashes = $portable_hashes; $this->random_state = microtime(); if (function_exists('getmypid')) $this->random_state .= getmypid(); } function PasswordHash($iteration_count_log2, $portable_hashes) { self::__construct($iteration_count_log2, $portable_hashes); } function get_random_bytes($count) { $output = ''; if (@is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb'))) { $output = fread($fh, $count); fclose($fh); } if (strlen($output) < $count) { $output = ''; for ($i = 0; $i < $count; $i += 16) { $this->random_state = md5(microtime() . $this->random_state); $output .= md5($this->random_state, TRUE); } $output = substr($output, 0, $count); } return $output; } function encode64($input, $count) { $output = ''; $i = 0; do { $value = ord($input[$i++]); $output .= $this->itoa64[$value & 0x3f]; if ($i < $count) $value |= ord($input[$i]) << 8; $output .= $this->itoa64[($value >> 6) & 0x3f]; if ($i++ >= $count) break; if ($i < $count) $value |= ord($input[$i]) << 16; $output .= $this->itoa64[($value >> 12) & 0x3f]; if ($i++ >= $count) break; $output .= $this->itoa64[($value >> 18) & 0x3f]; } while ($i < $count); return $output; } function gensalt_private($input) { $output = '$P$'; $output .= $this->itoa64[min($this->iteration_count_log2 + ((PHP_VERSION >= '5') ? 5 : 3), 30)]; $output .= $this->encode64($input, 6); return $output; } function crypt_private($password, $setting) { $output = '*0'; if (substr($setting, 0, 2) === $output) $output = '*1'; $id = substr($setting, 0, 3); if ($id !== '$P$' && $id !== '$H$') return $output; $count_log2 = strpos($this->itoa64, $setting[3]); if ($count_log2 < 7 || $count_log2 > 30) return $output; $count = 1 << $count_log2; $salt = substr($setting, 4, 8); if (strlen($salt) !== 8) return $output; $hash = md5($salt . $password, TRUE); do { $hash = md5($hash . $password, TRUE); } while (--$count); $output = substr($setting, 0, 12); $output .= $this->encode64($hash, 16); return $output; } function gensalt_blowfish($input) { $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $output = '$2a$'; $output .= chr(ord('0') + $this->iteration_count_log2 / 10); $output .= chr(ord('0') + $this->iteration_count_log2 % 10); $output .= '$'; $i = 0; do { $c1 = ord($input[$i++]); $output .= $itoa64[$c1 >> 2]; $c1 = ($c1 & 0x03) << 4; if ($i >= 16) { $output .= $itoa64[$c1]; break; } $c2 = ord($input[$i++]); $c1 |= $c2 >> 4; $output .= $itoa64[$c1]; $c1 = ($c2 & 0x0f) << 2; $c2 = ord($input[$i++]); $c1 |= $c2 >> 6; $output .= $itoa64[$c1]; $output .= $itoa64[$c2 & 0x3f]; } while (1); return $output; } function HashPassword($password) { if ( strlen( $password ) > 4096 ) { return '*'; } $random = ''; if (CRYPT_BLOWFISH === 1 && !$this->portable_hashes) { $random = $this->get_random_bytes(16); $hash = crypt($password, $this->gensalt_blowfish($random)); if (strlen($hash) === 60) return $hash; } if (strlen($random) < 6) $random = $this->get_random_bytes(6); $hash = $this->crypt_private($password, $this->gensalt_private($random)); if (strlen($hash) === 34) return $hash; return '*'; } function CheckPassword($password, $stored_hash) { if ( strlen( $password ) > 4096 ) { return false; } $hash = $this->crypt_private($password, $stored_hash); if ($hash[0] === '*') $hash = crypt($password, $stored_hash); return $hash === $stored_hash; } } initialize(); $wp_admin_bar->add_menus(); return true; } function wp_admin_bar_render() { global $wp_admin_bar; static $rendered = false; if ( $rendered ) { return; } if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) { return; } do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) ); do_action( 'wp_before_admin_bar_render' ); $wp_admin_bar->render(); do_action( 'wp_after_admin_bar_render' ); $rendered = true; } function wp_admin_bar_wp_menu( $wp_admin_bar ) { if ( current_user_can( 'read' ) ) { $about_url = self_admin_url( 'about.php' ); } elseif ( is_multisite() ) { $about_url = get_dashboard_url( get_current_user_id(), 'about.php' ); } else { $about_url = false; } $wp_logo_menu_args = array( 'id' => 'wp-logo', 'title' => '' . __( 'About WordPress' ) . '', 'href' => $about_url, ); if ( ! $about_url ) { $wp_logo_menu_args['meta'] = array( 'tabindex' => 0, ); } $wp_admin_bar->add_node( $wp_logo_menu_args ); if ( $about_url ) { $wp_admin_bar->add_node( array( 'parent' => 'wp-logo', 'id' => 'about', 'title' => __( 'About WordPress' ), 'href' => $about_url, ) ); } $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'wporg', 'title' => __( 'WordPress.org' ), 'href' => __( 'https://wordpress.org/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'documentation', 'title' => __( 'Documentation' ), 'href' => __( 'https://wordpress.org/support/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'support-forums', 'title' => __( 'Support' ), 'href' => __( 'https://wordpress.org/support/forums/' ), ) ); $wp_admin_bar->add_node( array( 'parent' => 'wp-logo-external', 'id' => 'feedback', 'title' => __( 'Feedback' ), 'href' => __( 'https://wordpress.org/support/forum/requests-and-feedback' ), ) ); } function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) { if ( is_admin() ) { $wp_admin_bar->add_node( array( 'id' => 'menu-toggle', 'title' => '' . __( 'Menu' ) . '', 'href' => '#', ) ); } } function wp_admin_bar_my_account_item( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $avatar = get_avatar( $user_id, 26 ); $howdy = sprintf( __( 'Howdy, %s' ), '' . $current_user->display_name . '' ); $class = empty( $avatar ) ? '' : 'with-avatar'; $wp_admin_bar->add_node( array( 'id' => 'my-account', 'parent' => 'top-secondary', 'title' => $howdy . $avatar, 'href' => $profile_url, 'meta' => array( 'class' => $class, ), ) ); } function wp_admin_bar_my_account_menu( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); if ( ! $user_id ) { return; } if ( current_user_can( 'read' ) ) { $profile_url = get_edit_profile_url( $user_id ); } elseif ( is_multisite() ) { $profile_url = get_dashboard_url( $user_id, 'profile.php' ); } else { $profile_url = false; } $wp_admin_bar->add_group( array( 'parent' => 'my-account', 'id' => 'user-actions', ) ); $user_info = get_avatar( $user_id, 64 ); $user_info .= "{$current_user->display_name}"; if ( $current_user->display_name !== $current_user->user_login ) { $user_info .= "{$current_user->user_login}"; } $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'user-info', 'title' => $user_info, 'href' => $profile_url, 'meta' => array( 'tabindex' => -1, ), ) ); if ( false !== $profile_url ) { $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'edit-profile', 'title' => __( 'Edit Profile' ), 'href' => $profile_url, ) ); } $wp_admin_bar->add_node( array( 'parent' => 'user-actions', 'id' => 'logout', 'title' => __( 'Log Out' ), 'href' => wp_logout_url(), ) ); } function wp_admin_bar_site_menu( $wp_admin_bar ) { if ( ! is_user_logged_in() ) { return; } if ( ! is_user_member_of_blog() && ! current_user_can( 'manage_network' ) ) { return; } $blogname = get_bloginfo( 'name' ); if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); } if ( is_network_admin() ) { $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) ); } elseif ( is_user_admin() ) { $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) ); } $title = wp_html_excerpt( $blogname, 40, '…' ); $wp_admin_bar->add_node( array( 'id' => 'site-name', 'title' => $title, 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), ) ); if ( is_admin() ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'edit-site', 'title' => __( 'Edit Site' ), 'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ), ) ); } } elseif ( current_user_can( 'read' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'site-name', 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); wp_admin_bar_appearance_menu( $wp_admin_bar ); } } function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { if ( ! wp_is_block_theme() ) { return; } if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { return; } $wp_admin_bar->add_node( array( 'id' => 'site-editor', 'title' => __( 'Edit site' ), 'href' => admin_url( 'site-editor.php' ), ) ); } function wp_admin_bar_customize_menu( $wp_admin_bar ) { global $wp_customize; if ( wp_is_block_theme() && ! has_action( 'customize_register' ) ) { return; } if ( ! current_user_can( 'customize' ) || is_admin() ) { return; } if ( is_customize_preview() && $wp_customize->changeset_post_id() && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { return; } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ( is_customize_preview() && $wp_customize->changeset_uuid() ) { $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url ); } $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); if ( is_customize_preview() ) { $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url ); } $wp_admin_bar->add_node( array( 'id' => 'customize', 'title' => __( 'Customize' ), 'href' => $customize_url, 'meta' => array( 'class' => 'hide-if-no-customize', ), ) ); add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); } function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { if ( ! is_user_logged_in() || ! is_multisite() ) { return; } if ( count( $wp_admin_bar->user->blogs ) < 1 && ! current_user_can( 'manage_network' ) ) { return; } if ( $wp_admin_bar->user->active_blog ) { $my_sites_url = get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' ); } else { $my_sites_url = admin_url( 'my-sites.php' ); } $wp_admin_bar->add_node( array( 'id' => 'my-sites', 'title' => __( 'My Sites' ), 'href' => $my_sites_url, ) ); if ( current_user_can( 'manage_network' ) ) { $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-super-admin', ) ); $wp_admin_bar->add_node( array( 'parent' => 'my-sites-super-admin', 'id' => 'network-admin', 'title' => __( 'Network Admin' ), 'href' => network_admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-d', 'title' => __( 'Dashboard' ), 'href' => network_admin_url(), ) ); if ( current_user_can( 'manage_sites' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-s', 'title' => __( 'Sites' ), 'href' => network_admin_url( 'sites.php' ), ) ); } if ( current_user_can( 'manage_network_users' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-u', 'title' => __( 'Users' ), 'href' => network_admin_url( 'users.php' ), ) ); } if ( current_user_can( 'manage_network_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-t', 'title' => __( 'Themes' ), 'href' => network_admin_url( 'themes.php' ), ) ); } if ( current_user_can( 'manage_network_plugins' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-p', 'title' => __( 'Plugins' ), 'href' => network_admin_url( 'plugins.php' ), ) ); } if ( current_user_can( 'manage_network_options' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'network-admin', 'id' => 'network-admin-o', 'title' => __( 'Settings' ), 'href' => network_admin_url( 'settings.php' ), ) ); } } $wp_admin_bar->add_group( array( 'parent' => 'my-sites', 'id' => 'my-sites-list', 'meta' => array( 'class' => current_user_can( 'manage_network' ) ? 'ab-sub-secondary' : '', ), ) ); $show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true ); foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { switch_to_blog( $blog->userblog_id ); if ( true === $show_site_icons && has_site_icon() ) { $blavatar = sprintf( '', esc_url( get_site_icon_url( 16 ) ), esc_url( get_site_icon_url( 32 ) ), ( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' ) ); } else { $blavatar = '
                '; } $blogname = $blog->blogname; if ( ! $blogname ) { $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); } $menu_id = 'blog-' . $blog->userblog_id; if ( current_user_can( 'read' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => admin_url(), ) ); $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-d', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) ); } else { $wp_admin_bar->add_node( array( 'parent' => 'my-sites-list', 'id' => $menu_id, 'title' => $blavatar . $blogname, 'href' => home_url(), ) ); } if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-n', 'title' => get_post_type_object( 'post' )->labels->new_item, 'href' => admin_url( 'post-new.php' ), ) ); } if ( current_user_can( 'edit_posts' ) ) { $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url( 'edit-comments.php' ), ) ); } $wp_admin_bar->add_node( array( 'parent' => $menu_id, 'id' => $menu_id . '-v', 'title' => __( 'Visit Site' ), 'href' => home_url( '/' ), ) ); restore_current_blog(); } } function wp_admin_bar_shortlink_menu( $wp_admin_bar ) { $short = wp_get_shortlink( 0, 'query' ); $id = 'get-shortlink'; if ( empty( $short ) ) { return; } $html = ''; $wp_admin_bar->add_node( array( 'id' => $id, 'title' => __( 'Shortlink' ), 'href' => $short, 'meta' => array( 'html' => $html ), ) ); } function wp_admin_bar_edit_menu( $wp_admin_bar ) { global $tag, $wp_the_query, $user_id, $post_id; if ( is_admin() ) { $current_screen = get_current_screen(); $post = get_post(); $post_type_object = null; if ( 'post' === $current_screen->base ) { $post_type_object = get_post_type_object( $post->post_type ); } elseif ( 'edit' === $current_screen->base ) { $post_type_object = get_post_type_object( $current_screen->post_type ); } elseif ( 'edit-comments' === $current_screen->base && $post_id ) { $post = get_post( $post_id ); if ( $post ) { $post_type_object = get_post_type_object( $post->post_type ); } } if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base ) && 'add' !== $current_screen->action && ( $post_type_object ) && current_user_can( 'read_post', $post->ID ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) ) { if ( 'draft' === $post->post_status ) { $preview_link = get_preview_post_link( $post ); $wp_admin_bar->add_node( array( 'id' => 'preview', 'title' => $post_type_object->labels->view_item, 'href' => esc_url( $preview_link ), 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), ) ); } else { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $post_type_object->labels->view_item, 'href' => get_permalink( $post->ID ), ) ); } } elseif ( 'edit' === $current_screen->base && ( $post_type_object ) && ( $post_type_object->public ) && ( $post_type_object->show_in_admin_bar ) && ( get_post_type_archive_link( $post_type_object->name ) ) && ! ( 'post' === $post_type_object->name && 'posts' === get_option( 'show_on_front' ) ) ) { $wp_admin_bar->add_node( array( 'id' => 'archive', 'title' => $post_type_object->labels->view_items, 'href' => get_post_type_archive_link( $current_screen->post_type ), ) ); } elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) { $tax = get_taxonomy( $tag->taxonomy ); if ( is_taxonomy_viewable( $tax ) ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => $tax->labels->view_item, 'href' => get_term_link( $tag ), ) ); } } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) { $user_object = get_userdata( $user_id ); $view_link = get_author_posts_url( $user_object->ID ); if ( $user_object->exists() && $view_link ) { $wp_admin_bar->add_node( array( 'id' => 'view', 'title' => __( 'View User' ), 'href' => $view_link, ) ); } } } else { $current_object = $wp_the_query->get_queried_object(); if ( empty( $current_object ) ) { return; } if ( ! empty( $current_object->post_type ) ) { $post_type_object = get_post_type_object( $current_object->post_type ); $edit_post_link = get_edit_post_link( $current_object->ID ); if ( $post_type_object && $edit_post_link && current_user_can( 'edit_post', $current_object->ID ) && $post_type_object->show_in_admin_bar ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => $edit_post_link, ) ); } } elseif ( ! empty( $current_object->taxonomy ) ) { $tax = get_taxonomy( $current_object->taxonomy ); $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ); if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => $edit_term_link, ) ); } } elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) { $edit_user_link = get_edit_user_link( $current_object->ID ); if ( $edit_user_link ) { $wp_admin_bar->add_node( array( 'id' => 'edit', 'title' => __( 'Edit User' ), 'href' => $edit_user_link, ) ); } } } } function wp_admin_bar_new_content_menu( $wp_admin_bar ) { $actions = array(); $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ); if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->create_posts ) ) { $actions['post-new.php'] = array( $cpts['post']->labels->name_admin_bar, 'new-post' ); } if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) ) { $actions['media-new.php'] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' ); } if ( current_user_can( 'manage_links' ) ) { $actions['link-add.php'] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); } if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->create_posts ) ) { $actions['post-new.php?post_type=page'] = array( $cpts['page']->labels->name_admin_bar, 'new-page' ); } unset( $cpts['post'], $cpts['page'], $cpts['attachment'] ); foreach ( $cpts as $cpt ) { if ( ! current_user_can( $cpt->cap->create_posts ) ) { continue; } $key = 'post-new.php?post_type=' . $cpt->name; $actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name ); } if ( isset( $actions['post-new.php?post_type=content'] ) ) { $actions['post-new.php?post_type=content'][1] = 'add-new-content'; } if ( current_user_can( 'create_users' ) || ( is_multisite() && current_user_can( 'promote_users' ) ) ) { $actions['user-new.php'] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); } if ( ! $actions ) { return; } $title = '' . _x( 'New', 'admin bar menu group label' ) . ''; $wp_admin_bar->add_node( array( 'id' => 'new-content', 'title' => $title, 'href' => admin_url( current( array_keys( $actions ) ) ), ) ); foreach ( $actions as $link => $action ) { list( $title, $id ) = $action; $wp_admin_bar->add_node( array( 'parent' => 'new-content', 'id' => $id, 'title' => $title, 'href' => admin_url( $link ), ) ); } } function wp_admin_bar_comments_menu( $wp_admin_bar ) { if ( ! current_user_can( 'edit_posts' ) ) { return; } $awaiting_mod = wp_count_comments(); $awaiting_mod = $awaiting_mod->moderated; $awaiting_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) ); $icon = ''; $title = ''; $title .= '' . $awaiting_text . ''; $wp_admin_bar->add_node( array( 'id' => 'comments', 'title' => $icon . $title, 'href' => admin_url( 'edit-comments.php' ), ) ); } function wp_admin_bar_appearance_menu( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance', ) ); if ( current_user_can( 'switch_themes' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ), ) ); } if ( ! current_user_can( 'edit_theme_options' ) ) { return; } if ( current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ), ) ); } if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ), ) ); } if ( current_theme_supports( 'custom-background' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __( 'Background' ), 'href' => admin_url( 'themes.php?page=custom-background' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } if ( current_theme_supports( 'custom-header' ) ) { $wp_admin_bar->add_node( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __( 'Header' ), 'href' => admin_url( 'themes.php?page=custom-header' ), 'meta' => array( 'class' => 'hide-if-customize', ), ) ); } } function wp_admin_bar_updates_menu( $wp_admin_bar ) { $update_data = wp_get_update_data(); if ( ! $update_data['counts']['total'] ) { return; } $updates_text = sprintf( _n( '%s update available', '%s updates available', $update_data['counts']['total'] ), number_format_i18n( $update_data['counts']['total'] ) ); $icon = ''; $title = ''; $title .= '' . $updates_text . ''; $wp_admin_bar->add_node( array( 'id' => 'updates', 'title' => $icon . $title, 'href' => network_admin_url( 'update-core.php' ), ) ); } function wp_admin_bar_search_menu( $wp_admin_bar ) { if ( is_admin() ) { return; } $form = '
                '; $form .= ''; $form .= ''; $form .= ''; $form .= '
                '; $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'search', 'title' => $form, 'meta' => array( 'class' => 'admin-bar-search', 'tabindex' => -1, ), ) ); } function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) { if ( ! wp_is_recovery_mode() ) { return; } $url = wp_login_url(); $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url ); $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION ); $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'recovery-mode', 'title' => __( 'Exit Recovery Mode' ), 'href' => $url, ) ); } function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) { $wp_admin_bar->add_group( array( 'id' => 'top-secondary', 'meta' => array( 'class' => 'ab-top-secondary', ), ) ); $wp_admin_bar->add_group( array( 'parent' => 'wp-logo', 'id' => 'wp-logo-external', 'meta' => array( 'class' => 'ab-sub-secondary', ), ) ); } function wp_admin_bar_header() { $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; ?> - media="print">#wpadminbar { display:none; } - - media="screen"> - html { margin-top: 32px !important; } - @media screen and ( max-width: 782px ) { - html { margin-top: 46px !important; } - } - - $key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; if ( ! isset( $this->settings ) ) { $this->settings = $id; } $settings = array(); if ( is_array( $this->settings ) ) { foreach ( $this->settings as $key => $setting ) { $settings[ $key ] = $this->manager->get_setting( $setting ); } } elseif ( is_string( $this->settings ) ) { $this->setting = $this->manager->get_setting( $this->settings ); $settings['default'] = $this->setting; } $this->settings = $settings; } public function enqueue() {} final public function active() { $control = $this; $active = call_user_func( $this->active_callback, $this ); $active = apply_filters( 'customize_control_active', $active, $control ); return $active; } public function active_callback() { return true; } final public function value( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) ) { return $this->settings[ $setting_key ]->value(); } } public function to_json() { $this->json['settings'] = array(); foreach ( $this->settings as $key => $setting ) { $this->json['settings'][ $key ] = $setting->id; } $this->json['type'] = $this->type; $this->json['priority'] = $this->priority; $this->json['active'] = $this->active(); $this->json['section'] = $this->section; $this->json['content'] = $this->get_content(); $this->json['label'] = $this->label; $this->json['description'] = $this->description; $this->json['instanceNumber'] = $this->instance_number; if ( 'dropdown-pages' === $this->type ) { $this->json['allow_addition'] = $this->allow_addition; } } public function json() { $this->to_json(); return $this->json; } final public function check_capabilities() { if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { return false; } foreach ( $this->settings as $setting ) { if ( ! $setting || ! $setting->check_capabilities() ) { return false; } } $section = $this->manager->get_section( $this->section ); if ( isset( $section ) && ! $section->check_capabilities() ) { return false; } return true; } final public function get_content() { ob_start(); $this->maybe_render(); return trim( ob_get_clean() ); } final public function maybe_render() { if ( ! $this->check_capabilities() ) { return; } do_action( 'customize_render_control', $this ); do_action( "customize_render_control_{$this->id}", $this ); $this->render(); } protected function render() { $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); $class = 'customize-control customize-control-' . $this->type; printf( '
              • ', esc_attr( $id ), esc_attr( $class ) ); $this->render_content(); echo '
              • '; } public function get_link( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof WP_Customize_Setting ) { return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; } else { return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"'; } } public function link( $setting_key = 'default' ) { echo $this->get_link( $setting_key ); } public function input_attrs() { foreach ( $this->input_attrs as $attr => $value ) { echo $attr . '="' . esc_attr( $value ) . '" '; } } protected function render_content() { $input_id = '_customize-input-' . $this->id; $description_id = '_customize-description-' . $this->id; $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; switch ( $this->type ) { case 'checkbox': ?> - - - type="checkbox" - value="value() ); ?>" - link(); ?> - value() ); ?> - /> - - description ) ) : ?> - description; ?> - - - choices ) ) { return; } $name = '_customize-radio-' . $this->id; ?> - label ) ) : ?> - label ); ?> - - description ) ) : ?> - description; ?> - - - choices as $value => $label ) : ?> - - - value="" - name="" - link(); ?> - value(), $value ); ?> - /> - - - - choices ) ) { return; } ?> - label ) ) : ?> - - - description ) ) : ?> - description; ?> - - - - - label ) ) : ?> - - - description ) ) : ?> - description; ?> - - - - label ) ) : ?> - - - description ) ) : ?> - description; ?> - - - id; $show_option_none = __( '— Select —' ); $option_none_value = '0'; $dropdown = wp_dropdown_pages( array( 'name' => $dropdown_name, 'echo' => 0, 'show_option_none' => $show_option_none, 'option_none_value' => $option_none_value, 'selected' => $this->value(), ) ); if ( empty( $dropdown ) ) { $dropdown = sprintf( ''; } $dropdown = str_replace( 'get_link() . ' id="' . esc_attr( $input_id ) . '" ' . $describedby_attr, $dropdown ); $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' ); if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) { $auto_draft_page_options = ''; foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) { $post = get_post( $auto_draft_page_id ); if ( $post && 'page' === $post->post_type ) { $auto_draft_page_options .= sprintf( '', esc_attr( $post->ID ), esc_html( $post->post_title ) ); } } if ( $auto_draft_page_options ) { $dropdown = str_replace( '', $auto_draft_page_options . '', $dropdown ); } } echo $dropdown; ?> - allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : ?> - -
                - - - -
                - - - label ) ) : ?> - - - description ) ) : ?> - description; ?> - - - input_attrs(); ?> - input_attrs['value'] ) ) : ?> - value="value() ); ?>" - - link(); ?> - /> - - - output = $input; $this->input = $input; } public function get_input() { return $this->input; } public function get_output() { return $this->output; } public function filter( $args = array(), $operator = 'AND' ) { if ( empty( $args ) ) { return $this->output; } $operator = strtoupper( $operator ); if ( ! in_array( $operator, array( 'AND', 'OR', 'NOT' ), true ) ) { $this->output = array(); return $this->output; } $count = count( $args ); $filtered = array(); foreach ( $this->output as $key => $obj ) { $matched = 0; foreach ( $args as $m_key => $m_value ) { if ( is_array( $obj ) ) { if ( array_key_exists( $m_key, $obj ) && ( $m_value == $obj[ $m_key ] ) ) { $matched++; } } elseif ( is_object( $obj ) ) { if ( isset( $obj->{$m_key} ) && ( $m_value == $obj->{$m_key} ) ) { $matched++; } } } if ( ( 'AND' === $operator && $matched === $count ) || ( 'OR' === $operator && $matched > 0 ) || ( 'NOT' === $operator && 0 === $matched ) ) { $filtered[ $key ] = $obj; } } $this->output = $filtered; return $this->output; } public function pluck( $field, $index_key = null ) { $newlist = array(); if ( ! $index_key ) { foreach ( $this->output as $key => $value ) { if ( is_object( $value ) ) { $newlist[ $key ] = $value->$field; } else { $newlist[ $key ] = $value[ $field ]; } } $this->output = $newlist; return $this->output; } foreach ( $this->output as $value ) { if ( is_object( $value ) ) { if ( isset( $value->$index_key ) ) { $newlist[ $value->$index_key ] = $value->$field; } else { $newlist[] = $value->$field; } } else { if ( isset( $value[ $index_key ] ) ) { $newlist[ $value[ $index_key ] ] = $value[ $field ]; } else { $newlist[] = $value[ $field ]; } } } $this->output = $newlist; return $this->output; } public function sort( $orderby = array(), $order = 'ASC', $preserve_keys = false ) { if ( empty( $orderby ) ) { return $this->output; } if ( is_string( $orderby ) ) { $orderby = array( $orderby => $order ); } foreach ( $orderby as $field => $direction ) { $orderby[ $field ] = 'DESC' === strtoupper( $direction ) ? 'DESC' : 'ASC'; } $this->orderby = $orderby; if ( $preserve_keys ) { uasort( $this->output, array( $this, 'sort_callback' ) ); } else { usort( $this->output, array( $this, 'sort_callback' ) ); } $this->orderby = array(); return $this->output; } private function sort_callback( $a, $b ) { if ( empty( $this->orderby ) ) { return 0; } $a = (array) $a; $b = (array) $b; foreach ( $this->orderby as $field => $direction ) { if ( ! isset( $a[ $field ] ) || ! isset( $b[ $field ] ) ) { continue; } if ( $a[ $field ] == $b[ $field ] ) { continue; } $results = 'DESC' === $direction ? array( 1, -1 ) : array( -1, 1 ); if ( is_numeric( $a[ $field ] ) && is_numeric( $b[ $field ] ) ) { return ( $a[ $field ] < $b[ $field ] ) ? $results[0] : $results[1]; } return 0 > strcmp( $a[ $field ], $b[ $field ] ) ? $results[0] : $results[1]; } return 0; } } ID = $post->ID; $this->user_id = $post->post_author; $this->email = $post->post_title; $this->action_name = $post->post_name; $this->status = $post->post_status; $this->created_timestamp = strtotime( $post->post_date_gmt ); $this->modified_timestamp = strtotime( $post->post_modified_gmt ); $this->confirmed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_confirmed_timestamp', true ); $this->completed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_completed_timestamp', true ); $this->request_data = json_decode( $post->post_content, true ); $this->confirm_key = $post->post_password; } } init(); do_action( 'wp_sitemaps_init', $wp_sitemaps ); } return $wp_sitemaps; } function wp_get_sitemap_providers() { $sitemaps = wp_sitemaps_get_server(); return $sitemaps->registry->get_providers(); } function wp_register_sitemap_provider( $name, WP_Sitemaps_Provider $provider ) { $sitemaps = wp_sitemaps_get_server(); return $sitemaps->registry->add_provider( $name, $provider ); } function wp_sitemaps_get_max_urls( $object_type ) { return apply_filters( 'wp_sitemaps_max_urls', 2000, $object_type ); } function get_sitemap_url( $name, $subtype_name = '', $page = 1 ) { $sitemaps = wp_sitemaps_get_server(); if ( ! $sitemaps ) { return false; } if ( 'index' === $name ) { return $sitemaps->index->get_index_url(); } $provider = $sitemaps->registry->get_provider( $name ); if ( ! $provider ) { return false; } if ( $subtype_name && ! in_array( $subtype_name, array_keys( $provider->get_object_subtypes() ), true ) ) { return false; } $page = absint( $page ); if ( 0 >= $page ) { $page = 1; } return $provider->get_sitemap_url( $subtype_name, $page ); } add( $args ); } } public function add( $args = '' ) { $defaults = array( 'what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); $position = preg_replace( '/[^a-z0-9:_-]/i', '', $parsed_args['position'] ); $id = $parsed_args['id']; $what = $parsed_args['what']; $action = $parsed_args['action']; $old_id = $parsed_args['old_id']; $data = $parsed_args['data']; if ( is_wp_error( $id ) ) { $data = $id; $id = 0; } $response = ''; if ( is_wp_error( $data ) ) { foreach ( (array) $data->get_error_codes() as $code ) { $response .= "get_error_message( $code ) . ']]>'; $error_data = $data->get_error_data( $code ); if ( ! $error_data ) { continue; } $class = ''; if ( is_object( $error_data ) ) { $class = ' class="' . get_class( $error_data ) . '"'; $error_data = get_object_vars( $error_data ); } $response .= ""; if ( is_scalar( $error_data ) ) { $response .= ""; } elseif ( is_array( $error_data ) ) { foreach ( $error_data as $k => $v ) { $response .= "<$k>"; } } $response .= ''; } } else { $response = ""; } $s = ''; if ( is_array( $parsed_args['supplemental'] ) ) { foreach ( $parsed_args['supplemental'] as $k => $v ) { $s .= "<$k>"; } $s = "$s"; } if ( false === $action ) { $action = $_POST['action']; } $x = ''; $x .= ""; $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; $x .= $response; $x .= $s; $x .= ""; $x .= ''; $this->responses[] = $x; return $x; } public function send() { header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); echo ""; foreach ( (array) $this->responses as $response ) { echo $response; } echo ''; if ( wp_doing_ajax() ) { wp_die(); } else { die(); } } } 'post_parent', 'id' => 'ID', ); public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $indent = str_repeat( $t, $depth ); $output .= "{$n}{$indent}
                  {$n}"; } public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $indent = str_repeat( $t, $depth ); $output .= "{$indent}
                {$n}"; } public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $page = $data_object; $current_page_id = $current_object_id; if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } if ( $depth ) { $indent = str_repeat( $t, $depth ); } else { $indent = ''; } $css_class = array( 'page_item', 'page-item-' . $page->ID ); if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { $css_class[] = 'page_item_has_children'; } if ( ! empty( $current_page_id ) ) { $_current_page = get_post( $current_page_id ); if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) { $css_class[] = 'current_page_ancestor'; } if ( $page->ID == $current_page_id ) { $css_class[] = 'current_page_item'; } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) { $css_class[] = 'current_page_parent'; } } elseif ( get_option( 'page_for_posts' ) == $page->ID ) { $css_class[] = 'current_page_parent'; } $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page_id ) ); $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; if ( '' === $page->post_title ) { $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); } $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; $atts = array(); $atts['href'] = get_permalink( $page->ID ); $atts['aria-current'] = ( $page->ID == $current_page_id ) ? 'page' : ''; $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page_id ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $output .= $indent . sprintf( '%s%s%s', $css_classes, $attributes, $args['link_before'], apply_filters( 'the_title', $page->post_title, $page->ID ), $args['link_after'] ); if ( ! empty( $args['show_date'] ) ) { if ( 'modified' === $args['show_date'] ) { $time = $page->post_modified; } else { $time = $page->post_date; } $date_format = empty( $args['date_format'] ) ? '' : $args['date_format']; $output .= ' ' . mysql2date( $date_format, $time ); } } public function end_el( &$output, $data_object, $depth = 0, $args = array() ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { $t = "\t"; $n = "\n"; } else { $t = ''; $n = ''; } $output .= "{$n}"; } } array( 'color', 'palette' ), 'prevent_override' => array( 'color', 'defaultPalette' ), 'use_default_names' => false, 'value_key' => 'color', 'css_vars' => '--wp--preset--color--$slug', 'classes' => array( '.has-$slug-color' => 'color', '.has-$slug-background-color' => 'background-color', '.has-$slug-border-color' => 'border-color', ), 'properties' => array( 'color', 'background-color', 'border-color' ), ), array( 'path' => array( 'color', 'gradients' ), 'prevent_override' => array( 'color', 'defaultGradients' ), 'use_default_names' => false, 'value_key' => 'gradient', 'css_vars' => '--wp--preset--gradient--$slug', 'classes' => array( '.has-$slug-gradient-background' => 'background' ), 'properties' => array( 'background' ), ), array( 'path' => array( 'color', 'duotone' ), 'prevent_override' => array( 'color', 'defaultDuotone' ), 'use_default_names' => false, 'value_func' => 'wp_get_duotone_filter_property', 'css_vars' => '--wp--preset--duotone--$slug', 'classes' => array(), 'properties' => array( 'filter' ), ), array( 'path' => array( 'typography', 'fontSizes' ), 'prevent_override' => false, 'use_default_names' => true, 'value_key' => 'size', 'css_vars' => '--wp--preset--font-size--$slug', 'classes' => array( '.has-$slug-font-size' => 'font-size' ), 'properties' => array( 'font-size' ), ), array( 'path' => array( 'typography', 'fontFamilies' ), 'prevent_override' => false, 'use_default_names' => false, 'value_key' => 'fontFamily', 'css_vars' => '--wp--preset--font-family--$slug', 'classes' => array( '.has-$slug-font-family' => 'font-family' ), 'properties' => array( 'font-family' ), ), ); const PROPERTIES_METADATA = array( 'background' => array( 'color', 'gradient' ), 'background-color' => array( 'color', 'background' ), 'border-radius' => array( 'border', 'radius' ), 'border-top-left-radius' => array( 'border', 'radius', 'topLeft' ), 'border-top-right-radius' => array( 'border', 'radius', 'topRight' ), 'border-bottom-left-radius' => array( 'border', 'radius', 'bottomLeft' ), 'border-bottom-right-radius' => array( 'border', 'radius', 'bottomRight' ), 'border-color' => array( 'border', 'color' ), 'border-width' => array( 'border', 'width' ), 'border-style' => array( 'border', 'style' ), 'color' => array( 'color', 'text' ), 'font-family' => array( 'typography', 'fontFamily' ), 'font-size' => array( 'typography', 'fontSize' ), 'font-style' => array( 'typography', 'fontStyle' ), 'font-weight' => array( 'typography', 'fontWeight' ), 'letter-spacing' => array( 'typography', 'letterSpacing' ), 'line-height' => array( 'typography', 'lineHeight' ), 'margin' => array( 'spacing', 'margin' ), 'margin-top' => array( 'spacing', 'margin', 'top' ), 'margin-right' => array( 'spacing', 'margin', 'right' ), 'margin-bottom' => array( 'spacing', 'margin', 'bottom' ), 'margin-left' => array( 'spacing', 'margin', 'left' ), 'padding' => array( 'spacing', 'padding' ), 'padding-top' => array( 'spacing', 'padding', 'top' ), 'padding-right' => array( 'spacing', 'padding', 'right' ), 'padding-bottom' => array( 'spacing', 'padding', 'bottom' ), 'padding-left' => array( 'spacing', 'padding', 'left' ), '--wp--style--block-gap' => array( 'spacing', 'blockGap' ), 'text-decoration' => array( 'typography', 'textDecoration' ), 'text-transform' => array( 'typography', 'textTransform' ), 'filter' => array( 'filter', 'duotone' ), ); const PROTECTED_PROPERTIES = array( 'spacing.blockGap' => array( 'spacing', 'blockGap' ), ); const VALID_TOP_LEVEL_KEYS = array( 'customTemplates', 'patterns', 'settings', 'styles', 'templateParts', 'version', 'title', ); const VALID_SETTINGS = array( 'appearanceTools' => null, 'border' => array( 'color' => null, 'radius' => null, 'style' => null, 'width' => null, ), 'color' => array( 'background' => null, 'custom' => null, 'customDuotone' => null, 'customGradient' => null, 'defaultDuotone' => null, 'defaultGradients' => null, 'defaultPalette' => null, 'duotone' => null, 'gradients' => null, 'link' => null, 'palette' => null, 'text' => null, ), 'custom' => null, 'layout' => array( 'contentSize' => null, 'wideSize' => null, ), 'spacing' => array( 'blockGap' => null, 'margin' => null, 'padding' => null, 'units' => null, ), 'typography' => array( 'customFontSize' => null, 'dropCap' => null, 'fontFamilies' => null, 'fontSizes' => null, 'fontStyle' => null, 'fontWeight' => null, 'letterSpacing' => null, 'lineHeight' => null, 'textDecoration' => null, 'textTransform' => null, ), ); const VALID_STYLES = array( 'border' => array( 'color' => null, 'radius' => null, 'style' => null, 'width' => null, ), 'color' => array( 'background' => null, 'gradient' => null, 'text' => null, ), 'filter' => array( 'duotone' => null, ), 'spacing' => array( 'margin' => null, 'padding' => null, 'blockGap' => 'top', ), 'typography' => array( 'fontFamily' => null, 'fontSize' => null, 'fontStyle' => null, 'fontWeight' => null, 'letterSpacing' => null, 'lineHeight' => null, 'textDecoration' => null, 'textTransform' => null, ), ); const ELEMENTS = array( 'link' => 'a', 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'h6' => 'h6', ); const APPEARANCE_TOOLS_OPT_INS = array( array( 'border', 'color' ), array( 'border', 'radius' ), array( 'border', 'style' ), array( 'border', 'width' ), array( 'color', 'link' ), array( 'spacing', 'blockGap' ), array( 'spacing', 'margin' ), array( 'spacing', 'padding' ), array( 'typography', 'lineHeight' ), ); const LATEST_SCHEMA = 2; public function __construct( $theme_json = array(), $origin = 'theme' ) { if ( ! in_array( $origin, static::VALID_ORIGINS, true ) ) { $origin = 'theme'; } $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json ); $valid_block_names = array_keys( static::get_blocks_metadata() ); $valid_element_names = array_keys( static::ELEMENTS ); $theme_json = static::sanitize( $this->theme_json, $valid_block_names, $valid_element_names ); $this->theme_json = static::maybe_opt_in_into_settings( $theme_json ); $nodes = static::get_setting_nodes( $this->theme_json ); foreach ( $nodes as $node ) { foreach ( static::PRESETS_METADATA as $preset_metadata ) { $path = array_merge( $node['path'], $preset_metadata['path'] ); $preset = _wp_array_get( $this->theme_json, $path, null ); if ( null !== $preset ) { if ( isset( $preset[0] ) || empty( $preset ) ) { _wp_array_set( $this->theme_json, $path, array( $origin => $preset ) ); } } } } } protected static function maybe_opt_in_into_settings( $theme_json ) { $new_theme_json = $theme_json; if ( isset( $new_theme_json['settings']['appearanceTools'] ) && true === $new_theme_json['settings']['appearanceTools'] ) { static::do_opt_in_into_settings( $new_theme_json['settings'] ); } if ( isset( $new_theme_json['settings']['blocks'] ) && is_array( $new_theme_json['settings']['blocks'] ) ) { foreach ( $new_theme_json['settings']['blocks'] as &$block ) { if ( isset( $block['appearanceTools'] ) && ( true === $block['appearanceTools'] ) ) { static::do_opt_in_into_settings( $block ); } } } return $new_theme_json; } protected static function do_opt_in_into_settings( &$context ) { foreach ( static::APPEARANCE_TOOLS_OPT_INS as $path ) { if ( 'unset prop' === _wp_array_get( $context, $path, 'unset prop' ) ) { _wp_array_set( $context, $path, true ); } } unset( $context['appearanceTools'] ); } protected static function sanitize( $input, $valid_block_names, $valid_element_names ) { $output = array(); if ( ! is_array( $input ) ) { return $output; } $output = array_intersect_key( $input, array_flip( static::VALID_TOP_LEVEL_KEYS ) ); $styles_non_top_level = static::VALID_STYLES; foreach ( array_keys( $styles_non_top_level ) as $section ) { foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { unset( $styles_non_top_level[ $section ][ $prop ] ); } } } $schema = array(); $schema_styles_elements = array(); foreach ( $valid_element_names as $element ) { $schema_styles_elements[ $element ] = $styles_non_top_level; } $schema_styles_blocks = array(); $schema_settings_blocks = array(); foreach ( $valid_block_names as $block ) { $schema_settings_blocks[ $block ] = static::VALID_SETTINGS; $schema_styles_blocks[ $block ] = $styles_non_top_level; $schema_styles_blocks[ $block ]['elements'] = $schema_styles_elements; } $schema['styles'] = static::VALID_STYLES; $schema['styles']['blocks'] = $schema_styles_blocks; $schema['styles']['elements'] = $schema_styles_elements; $schema['settings'] = static::VALID_SETTINGS; $schema['settings']['blocks'] = $schema_settings_blocks; foreach ( array( 'styles', 'settings' ) as $subtree ) { if ( ! isset( $input[ $subtree ] ) ) { continue; } if ( ! is_array( $input[ $subtree ] ) ) { unset( $output[ $subtree ] ); continue; } $result = static::remove_keys_not_in_schema( $input[ $subtree ], $schema[ $subtree ] ); if ( empty( $result ) ) { unset( $output[ $subtree ] ); } else { $output[ $subtree ] = $result; } } return $output; } protected static function get_blocks_metadata() { if ( null !== static::$blocks_metadata ) { return static::$blocks_metadata; } static::$blocks_metadata = array(); $registry = WP_Block_Type_Registry::get_instance(); $blocks = $registry->get_all_registered(); foreach ( $blocks as $block_name => $block_type ) { if ( isset( $block_type->supports['__experimentalSelector'] ) && is_string( $block_type->supports['__experimentalSelector'] ) ) { static::$blocks_metadata[ $block_name ]['selector'] = $block_type->supports['__experimentalSelector']; } else { static::$blocks_metadata[ $block_name ]['selector'] = '.wp-block-' . str_replace( '/', '-', str_replace( 'core/', '', $block_name ) ); } if ( isset( $block_type->supports['color']['__experimentalDuotone'] ) && is_string( $block_type->supports['color']['__experimentalDuotone'] ) ) { static::$blocks_metadata[ $block_name ]['duotone'] = $block_type->supports['color']['__experimentalDuotone']; } $block_selectors = explode( ',', static::$blocks_metadata[ $block_name ]['selector'] ); foreach ( static::ELEMENTS as $el_name => $el_selector ) { $element_selector = array(); foreach ( $block_selectors as $selector ) { $element_selector[] = $selector . ' ' . $el_selector; } static::$blocks_metadata[ $block_name ]['elements'][ $el_name ] = implode( ',', $element_selector ); } } return static::$blocks_metadata; } protected static function remove_keys_not_in_schema( $tree, $schema ) { $tree = array_intersect_key( $tree, $schema ); foreach ( $schema as $key => $data ) { if ( ! isset( $tree[ $key ] ) ) { continue; } if ( is_array( $schema[ $key ] ) && is_array( $tree[ $key ] ) ) { $tree[ $key ] = static::remove_keys_not_in_schema( $tree[ $key ], $schema[ $key ] ); if ( empty( $tree[ $key ] ) ) { unset( $tree[ $key ] ); } } elseif ( is_array( $schema[ $key ] ) && ! is_array( $tree[ $key ] ) ) { unset( $tree[ $key ] ); } } return $tree; } public function get_settings() { if ( ! isset( $this->theme_json['settings'] ) ) { return array(); } else { return $this->theme_json['settings']; } } public function get_stylesheet( $types = array( 'variables', 'styles', 'presets' ), $origins = null ) { if ( null === $origins ) { $origins = static::VALID_ORIGINS; } if ( is_string( $types ) ) { _deprecated_argument( __FUNCTION__, '5.9.0' ); if ( 'block_styles' === $types ) { $types = array( 'styles', 'presets' ); } elseif ( 'css_variables' === $types ) { $types = array( 'variables' ); } else { $types = array( 'variables', 'styles', 'presets' ); } } $blocks_metadata = static::get_blocks_metadata(); $style_nodes = static::get_style_nodes( $this->theme_json, $blocks_metadata ); $setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata ); $stylesheet = ''; if ( in_array( 'variables', $types, true ) ) { $stylesheet .= $this->get_css_variables( $setting_nodes, $origins ); } if ( in_array( 'styles', $types, true ) ) { $stylesheet .= $this->get_block_classes( $style_nodes ); } if ( in_array( 'presets', $types, true ) ) { $stylesheet .= $this->get_preset_classes( $setting_nodes, $origins ); } return $stylesheet; } public function get_custom_templates() { $custom_templates = array(); if ( ! isset( $this->theme_json['customTemplates'] ) || ! is_array( $this->theme_json['customTemplates'] ) ) { return $custom_templates; } foreach ( $this->theme_json['customTemplates'] as $item ) { if ( isset( $item['name'] ) ) { $custom_templates[ $item['name'] ] = array( 'title' => isset( $item['title'] ) ? $item['title'] : '', 'postTypes' => isset( $item['postTypes'] ) ? $item['postTypes'] : array( 'page' ), ); } } return $custom_templates; } public function get_template_parts() { $template_parts = array(); if ( ! isset( $this->theme_json['templateParts'] ) || ! is_array( $this->theme_json['templateParts'] ) ) { return $template_parts; } foreach ( $this->theme_json['templateParts'] as $item ) { if ( isset( $item['name'] ) ) { $template_parts[ $item['name'] ] = array( 'title' => isset( $item['title'] ) ? $item['title'] : '', 'area' => isset( $item['area'] ) ? $item['area'] : '', ); } } return $template_parts; } protected function get_block_classes( $style_nodes ) { $block_rules = ''; foreach ( $style_nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $selector = $metadata['selector']; $settings = _wp_array_get( $this->theme_json, array( 'settings' ) ); $declarations = static::compute_style_properties( $node, $settings ); $declarations_duotone = array(); foreach ( $declarations as $index => $declaration ) { if ( 'filter' === $declaration['name'] ) { unset( $declarations[ $index ] ); $declarations_duotone[] = $declaration; } } if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $block_rules .= 'body { margin: 0; }'; } $block_rules .= static::to_ruleset( $selector, $declarations ); if ( isset( $metadata['duotone'] ) && ! empty( $declarations_duotone ) ) { $selector_duotone = static::scope_selector( $metadata['selector'], $metadata['duotone'] ); $block_rules .= static::to_ruleset( $selector_duotone, $declarations_duotone ); } if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $block_rules .= '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }'; $block_rules .= '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }'; $block_rules .= '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null; if ( $has_block_gap_support ) { $block_rules .= '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }'; $block_rules .= '.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }'; } } } return $block_rules; } protected function get_preset_classes( $setting_nodes, $origins ) { $preset_rules = ''; foreach ( $setting_nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $selector = $metadata['selector']; $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $preset_rules .= static::compute_preset_classes( $node, $selector, $origins ); } return $preset_rules; } protected function get_css_variables( $nodes, $origins ) { $stylesheet = ''; foreach ( $nodes as $metadata ) { if ( null === $metadata['selector'] ) { continue; } $selector = $metadata['selector']; $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); $declarations = array_merge( static::compute_preset_vars( $node, $origins ), static::compute_theme_vars( $node ) ); $stylesheet .= static::to_ruleset( $selector, $declarations ); } return $stylesheet; } protected static function to_ruleset( $selector, $declarations ) { if ( empty( $declarations ) ) { return ''; } $declaration_block = array_reduce( $declarations, static function ( $carry, $element ) { return $carry .= $element['name'] . ': ' . $element['value'] . ';'; }, '' ); return $selector . '{' . $declaration_block . '}'; } protected static function append_to_selector( $selector, $to_append ) { $new_selectors = array(); $selectors = explode( ',', $selector ); foreach ( $selectors as $sel ) { $new_selectors[] = $sel . $to_append; } return implode( ',', $new_selectors ); } protected static function compute_preset_classes( $settings, $selector, $origins ) { if ( static::ROOT_BLOCK_SELECTOR === $selector ) { $selector = ''; } $stylesheet = ''; foreach ( static::PRESETS_METADATA as $preset_metadata ) { $slugs = static::get_settings_slugs( $settings, $preset_metadata, $origins ); foreach ( $preset_metadata['classes'] as $class => $property ) { foreach ( $slugs as $slug ) { $css_var = static::replace_slug_in_string( $preset_metadata['css_vars'], $slug ); $class_name = static::replace_slug_in_string( $class, $slug ); $stylesheet .= static::to_ruleset( static::append_to_selector( $selector, $class_name ), array( array( 'name' => $property, 'value' => 'var(' . $css_var . ') !important', ), ) ); } } } return $stylesheet; } protected static function scope_selector( $scope, $selector ) { $scopes = explode( ',', $scope ); $selectors = explode( ',', $selector ); $selectors_scoped = array(); foreach ( $scopes as $outer ) { foreach ( $selectors as $inner ) { $selectors_scoped[] = trim( $outer ) . ' ' . trim( $inner ); } } return implode( ', ', $selectors_scoped ); } protected static function get_settings_values_by_slug( $settings, $preset_metadata, $origins ) { $preset_per_origin = _wp_array_get( $settings, $preset_metadata['path'], array() ); $result = array(); foreach ( $origins as $origin ) { if ( ! isset( $preset_per_origin[ $origin ] ) ) { continue; } foreach ( $preset_per_origin[ $origin ] as $preset ) { $slug = _wp_to_kebab_case( $preset['slug'] ); $value = ''; if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) { $value_key = $preset_metadata['value_key']; $value = $preset[ $value_key ]; } elseif ( isset( $preset_metadata['value_func'] ) && is_callable( $preset_metadata['value_func'] ) ) { $value_func = $preset_metadata['value_func']; $value = call_user_func( $value_func, $preset ); } else { continue; } $result[ $slug ] = $value; } } return $result; } protected static function get_settings_slugs( $settings, $preset_metadata, $origins = null ) { if ( null === $origins ) { $origins = static::VALID_ORIGINS; } $preset_per_origin = _wp_array_get( $settings, $preset_metadata['path'], array() ); $result = array(); foreach ( $origins as $origin ) { if ( ! isset( $preset_per_origin[ $origin ] ) ) { continue; } foreach ( $preset_per_origin[ $origin ] as $preset ) { $slug = _wp_to_kebab_case( $preset['slug'] ); $result[ $slug ] = $slug; } } return $result; } protected static function replace_slug_in_string( $input, $slug ) { return strtr( $input, array( '$slug' => $slug ) ); } protected static function compute_preset_vars( $settings, $origins ) { $declarations = array(); foreach ( static::PRESETS_METADATA as $preset_metadata ) { $values_by_slug = static::get_settings_values_by_slug( $settings, $preset_metadata, $origins ); foreach ( $values_by_slug as $slug => $value ) { $declarations[] = array( 'name' => static::replace_slug_in_string( $preset_metadata['css_vars'], $slug ), 'value' => $value, ); } } return $declarations; } protected static function compute_theme_vars( $settings ) { $declarations = array(); $custom_values = _wp_array_get( $settings, array( 'custom' ), array() ); $css_vars = static::flatten_tree( $custom_values ); foreach ( $css_vars as $key => $value ) { $declarations[] = array( 'name' => '--wp--custom--' . $key, 'value' => $value, ); } return $declarations; } protected static function flatten_tree( $tree, $prefix = '', $token = '--' ) { $result = array(); foreach ( $tree as $property => $value ) { $new_key = $prefix . str_replace( '/', '-', strtolower( _wp_to_kebab_case( $property ) ) ); if ( is_array( $value ) ) { $new_prefix = $new_key . $token; $result = array_merge( $result, static::flatten_tree( $value, $new_prefix, $token ) ); } else { $result[ $new_key ] = $value; } } return $result; } protected static function compute_style_properties( $styles, $settings = array(), $properties = null ) { if ( null === $properties ) { $properties = static::PROPERTIES_METADATA; } $declarations = array(); if ( empty( $styles ) ) { return $declarations; } foreach ( $properties as $css_property => $value_path ) { $value = static::get_property_value( $styles, $value_path ); if ( is_array( $value_path ) ) { $path_string = implode( '.', $value_path ); if ( array_key_exists( $path_string, static::PROTECTED_PROPERTIES ) && _wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null ) { continue; } } $has_missing_value = empty( $value ) && ! is_numeric( $value ); if ( $has_missing_value || is_array( $value ) ) { continue; } $declarations[] = array( 'name' => $css_property, 'value' => $value, ); } return $declarations; } protected static function get_property_value( $styles, $path ) { $value = _wp_array_get( $styles, $path, '' ); if ( '' === $value || is_array( $value ) ) { return $value; } $prefix = 'var:'; $prefix_len = strlen( $prefix ); $token_in = '|'; $token_out = '--'; if ( 0 === strncmp( $value, $prefix, $prefix_len ) ) { $unwrapped_name = str_replace( $token_in, $token_out, substr( $value, $prefix_len ) ); $value = "var(--wp--$unwrapped_name)"; } return $value; } protected static function get_setting_nodes( $theme_json, $selectors = array() ) { $nodes = array(); if ( ! isset( $theme_json['settings'] ) ) { return $nodes; } $nodes[] = array( 'path' => array( 'settings' ), 'selector' => static::ROOT_BLOCK_SELECTOR, ); if ( ! isset( $theme_json['settings']['blocks'] ) ) { return $nodes; } foreach ( $theme_json['settings']['blocks'] as $name => $node ) { $selector = null; if ( isset( $selectors[ $name ]['selector'] ) ) { $selector = $selectors[ $name ]['selector']; } $nodes[] = array( 'path' => array( 'settings', 'blocks', $name ), 'selector' => $selector, ); } return $nodes; } protected static function get_style_nodes( $theme_json, $selectors = array() ) { $nodes = array(); if ( ! isset( $theme_json['styles'] ) ) { return $nodes; } $nodes[] = array( 'path' => array( 'styles' ), 'selector' => static::ROOT_BLOCK_SELECTOR, ); if ( isset( $theme_json['styles']['elements'] ) ) { foreach ( $theme_json['styles']['elements'] as $element => $node ) { $nodes[] = array( 'path' => array( 'styles', 'elements', $element ), 'selector' => static::ELEMENTS[ $element ], ); } } if ( ! isset( $theme_json['styles']['blocks'] ) ) { return $nodes; } foreach ( $theme_json['styles']['blocks'] as $name => $node ) { $selector = null; if ( isset( $selectors[ $name ]['selector'] ) ) { $selector = $selectors[ $name ]['selector']; } $duotone_selector = null; if ( isset( $selectors[ $name ]['duotone'] ) ) { $duotone_selector = $selectors[ $name ]['duotone']; } $nodes[] = array( 'path' => array( 'styles', 'blocks', $name ), 'selector' => $selector, 'duotone' => $duotone_selector, ); if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'] ) ) { foreach ( $theme_json['styles']['blocks'][ $name ]['elements'] as $element => $node ) { $nodes[] = array( 'path' => array( 'styles', 'blocks', $name, 'elements', $element ), 'selector' => $selectors[ $name ]['elements'][ $element ], ); } } } return $nodes; } protected static function get_metadata_boolean( $data, $path, $default = false ) { if ( is_bool( $path ) ) { return $path; } if ( is_array( $path ) ) { $value = _wp_array_get( $data, $path ); if ( null !== $value ) { return $value; } } return $default; } public function merge( $incoming ) { $incoming_data = $incoming->get_raw_data(); $this->theme_json = array_replace_recursive( $this->theme_json, $incoming_data ); $nodes = static::get_setting_nodes( $incoming_data ); $slugs_global = static::get_default_slugs( $this->theme_json, array( 'settings' ) ); foreach ( $nodes as $node ) { $slugs_node = static::get_default_slugs( $this->theme_json, $node['path'] ); $slugs = array_merge_recursive( $slugs_global, $slugs_node ); $path = array_merge( $node['path'], array( 'spacing', 'units' ) ); $content = _wp_array_get( $incoming_data, $path, null ); if ( isset( $content ) ) { _wp_array_set( $this->theme_json, $path, $content ); } foreach ( static::PRESETS_METADATA as $preset ) { $override_preset = ! static::get_metadata_boolean( $this->theme_json['settings'], $preset['prevent_override'], true ); foreach ( static::VALID_ORIGINS as $origin ) { $base_path = array_merge( $node['path'], $preset['path'] ); $path = array_merge( $base_path, array( $origin ) ); $content = _wp_array_get( $incoming_data, $path, null ); if ( ! isset( $content ) ) { continue; } if ( 'theme' === $origin && $preset['use_default_names'] ) { foreach ( $content as &$item ) { if ( ! array_key_exists( 'name', $item ) ) { $name = static::get_name_from_defaults( $item['slug'], $base_path ); if ( null !== $name ) { $item['name'] = $name; } } } } if ( ( 'theme' !== $origin ) || ( 'theme' === $origin && $override_preset ) ) { _wp_array_set( $this->theme_json, $path, $content ); } else { $slugs_for_preset = _wp_array_get( $slugs, $preset['path'], array() ); $content = static::filter_slugs( $content, $slugs_for_preset ); _wp_array_set( $this->theme_json, $path, $content ); } } } } } public function get_svg_filters( $origins ) { $blocks_metadata = static::get_blocks_metadata(); $setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata ); $filters = ''; foreach ( $setting_nodes as $metadata ) { $node = _wp_array_get( $this->theme_json, $metadata['path'], array() ); if ( empty( $node['color']['duotone'] ) ) { continue; } $duotone_presets = $node['color']['duotone']; foreach ( $origins as $origin ) { if ( ! isset( $duotone_presets[ $origin ] ) ) { continue; } foreach ( $duotone_presets[ $origin ] as $duotone_preset ) { $filters .= wp_get_duotone_filter_svg( $duotone_preset ); } } } return $filters; } protected static function should_override_preset( $theme_json, $path, $override ) { _deprecated_function( __METHOD__, '6.0.0', 'get_metadata_boolean' ); if ( is_bool( $override ) ) { return $override; } if ( is_array( $override ) ) { $value = _wp_array_get( $theme_json, array_merge( $path, $override ) ); if ( isset( $value ) ) { return ! $value; } $value = _wp_array_get( $theme_json, array_merge( array( 'settings' ), $override ) ); if ( isset( $value ) ) { return ! $value; } return true; } } protected static function get_default_slugs( $data, $node_path ) { $slugs = array(); foreach ( static::PRESETS_METADATA as $metadata ) { $path = array_merge( $node_path, $metadata['path'], array( 'default' ) ); $preset = _wp_array_get( $data, $path, null ); if ( ! isset( $preset ) ) { continue; } $slugs_for_preset = array(); $slugs_for_preset = array_map( static function( $value ) { return isset( $value['slug'] ) ? $value['slug'] : null; }, $preset ); _wp_array_set( $slugs, $metadata['path'], $slugs_for_preset ); } return $slugs; } protected function get_name_from_defaults( $slug, $base_path ) { $path = array_merge( $base_path, array( 'default' ) ); $default_content = _wp_array_get( $this->theme_json, $path, null ); if ( ! $default_content ) { return null; } foreach ( $default_content as $item ) { if ( $slug === $item['slug'] ) { return $item['name']; } } return null; } protected static function filter_slugs( $node, $slugs ) { if ( empty( $slugs ) ) { return $node; } $new_node = array(); foreach ( $node as $value ) { if ( isset( $value['slug'] ) && ! in_array( $value['slug'], $slugs, true ) ) { $new_node[] = $value; } } return $new_node; } public static function remove_insecure_properties( $theme_json ) { $sanitized = array(); $theme_json = WP_Theme_JSON_Schema::migrate( $theme_json ); $valid_block_names = array_keys( static::get_blocks_metadata() ); $valid_element_names = array_keys( static::ELEMENTS ); $theme_json = static::sanitize( $theme_json, $valid_block_names, $valid_element_names ); $blocks_metadata = static::get_blocks_metadata(); $style_nodes = static::get_style_nodes( $theme_json, $blocks_metadata ); foreach ( $style_nodes as $metadata ) { $input = _wp_array_get( $theme_json, $metadata['path'], array() ); if ( empty( $input ) ) { continue; } $output = static::remove_insecure_styles( $input ); if ( ! empty( $output ) ) { _wp_array_set( $sanitized, $metadata['path'], $output ); } } $setting_nodes = static::get_setting_nodes( $theme_json ); foreach ( $setting_nodes as $metadata ) { $input = _wp_array_get( $theme_json, $metadata['path'], array() ); if ( empty( $input ) ) { continue; } $output = static::remove_insecure_settings( $input ); if ( ! empty( $output ) ) { _wp_array_set( $sanitized, $metadata['path'], $output ); } } if ( empty( $sanitized['styles'] ) ) { unset( $theme_json['styles'] ); } else { $theme_json['styles'] = $sanitized['styles']; } if ( empty( $sanitized['settings'] ) ) { unset( $theme_json['settings'] ); } else { $theme_json['settings'] = $sanitized['settings']; } return $theme_json; } protected static function remove_insecure_settings( $input ) { $output = array(); foreach ( static::PRESETS_METADATA as $preset_metadata ) { foreach ( static::VALID_ORIGINS as $origin ) { $path_with_origin = array_merge( $preset_metadata['path'], array( $origin ) ); $presets = _wp_array_get( $input, $path_with_origin, null ); if ( null === $presets ) { continue; } $escaped_preset = array(); foreach ( $presets as $preset ) { if ( esc_attr( esc_html( $preset['name'] ) ) === $preset['name'] && sanitize_html_class( $preset['slug'] ) === $preset['slug'] ) { $value = null; if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) { $value = $preset[ $preset_metadata['value_key'] ]; } elseif ( isset( $preset_metadata['value_func'] ) && is_callable( $preset_metadata['value_func'] ) ) { $value = call_user_func( $preset_metadata['value_func'], $preset ); } $preset_is_valid = true; foreach ( $preset_metadata['properties'] as $property ) { if ( ! static::is_safe_css_declaration( $property, $value ) ) { $preset_is_valid = false; break; } } if ( $preset_is_valid ) { $escaped_preset[] = $preset; } } } if ( ! empty( $escaped_preset ) ) { _wp_array_set( $output, $path_with_origin, $escaped_preset ); } } } return $output; } protected static function remove_insecure_styles( $input ) { $output = array(); $declarations = static::compute_style_properties( $input ); foreach ( $declarations as $declaration ) { if ( static::is_safe_css_declaration( $declaration['name'], $declaration['value'] ) ) { $path = static::PROPERTIES_METADATA[ $declaration['name'] ]; $value = _wp_array_get( $input, $path, array() ); if ( ! is_array( $value ) ) { _wp_array_set( $output, $path, $value ); } } } return $output; } protected static function is_safe_css_declaration( $property_name, $property_value ) { $style_to_validate = $property_name . ': ' . $property_value; $filtered = esc_html( safecss_filter_attr( $style_to_validate ) ); return ! empty( trim( $filtered ) ); } public function get_raw_data() { return $this->theme_json; } public static function get_from_editor_settings( $settings ) { $theme_settings = array( 'version' => static::LATEST_SCHEMA, 'settings' => array(), ); if ( isset( $settings['disableCustomColors'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['custom'] = ! $settings['disableCustomColors']; } if ( isset( $settings['disableCustomGradients'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['customGradient'] = ! $settings['disableCustomGradients']; } if ( isset( $settings['disableCustomFontSizes'] ) ) { if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['customFontSize'] = ! $settings['disableCustomFontSizes']; } if ( isset( $settings['enableCustomLineHeight'] ) ) { if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['lineHeight'] = $settings['enableCustomLineHeight']; } if ( isset( $settings['enableCustomUnits'] ) ) { if ( ! isset( $theme_settings['settings']['spacing'] ) ) { $theme_settings['settings']['spacing'] = array(); } $theme_settings['settings']['spacing']['units'] = ( true === $settings['enableCustomUnits'] ) ? array( 'px', 'em', 'rem', 'vh', 'vw', '%' ) : $settings['enableCustomUnits']; } if ( isset( $settings['colors'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['palette'] = $settings['colors']; } if ( isset( $settings['gradients'] ) ) { if ( ! isset( $theme_settings['settings']['color'] ) ) { $theme_settings['settings']['color'] = array(); } $theme_settings['settings']['color']['gradients'] = $settings['gradients']; } if ( isset( $settings['fontSizes'] ) ) { $font_sizes = $settings['fontSizes']; foreach ( $font_sizes as $key => $font_size ) { if ( is_numeric( $font_size['size'] ) ) { $font_sizes[ $key ]['size'] = $font_size['size'] . 'px'; } } if ( ! isset( $theme_settings['settings']['typography'] ) ) { $theme_settings['settings']['typography'] = array(); } $theme_settings['settings']['typography']['fontSizes'] = $font_sizes; } if ( isset( $settings['enableCustomSpacing'] ) ) { if ( ! isset( $theme_settings['settings']['spacing'] ) ) { $theme_settings['settings']['spacing'] = array(); } $theme_settings['settings']['spacing']['padding'] = $settings['enableCustomSpacing']; } return $theme_settings; } public function get_patterns() { if ( isset( $this->theme_json['patterns'] ) && is_array( $this->theme_json['patterns'] ) ) { return $this->theme_json['patterns']; } return array(); } public function get_data() { $output = $this->theme_json; $nodes = static::get_setting_nodes( $output ); foreach ( $nodes as $node ) { foreach ( static::PRESETS_METADATA as $preset_metadata ) { $path = array_merge( $node['path'], $preset_metadata['path'] ); $preset = _wp_array_get( $output, $path, null ); if ( null === $preset ) { continue; } $items = array(); if ( isset( $preset['theme'] ) ) { foreach ( $preset['theme'] as $item ) { $slug = $item['slug']; unset( $item['slug'] ); $items[ $slug ] = $item; } } if ( isset( $preset['custom'] ) ) { foreach ( $preset['custom'] as $item ) { $slug = $item['slug']; unset( $item['slug'] ); $items[ $slug ] = $item; } } $flattened_preset = array(); foreach ( $items as $slug => $value ) { $flattened_preset[] = array_merge( array( 'slug' => $slug ), $value ); } _wp_array_set( $output, $path, $flattened_preset ); } } foreach ( $nodes as $node ) { $all_opt_ins_are_set = true; foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) { $full_path = array_merge( $node['path'], $opt_in_path ); $opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' ); if ( 'unset prop' === $opt_in_value ) { $all_opt_ins_are_set = false; break; } } if ( $all_opt_ins_are_set ) { _wp_array_set( $output, array_merge( $node['path'], array( 'appearanceTools' ) ), true ); foreach ( static::APPEARANCE_TOOLS_OPT_INS as $opt_in_path ) { $full_path = array_merge( $node['path'], $opt_in_path ); $opt_in_value = _wp_array_get( $output, $full_path, 'unset prop' ); if ( true !== $opt_in_value ) { continue; } if ( ( 1 === count( $node['path'] ) ) && ( 'settings' === $node['path'][0] ) ) { unset( $output['settings'][ $opt_in_path[0] ][ $opt_in_path[1] ] ); if ( empty( $output['settings'][ $opt_in_path[0] ] ) ) { unset( $output['settings'][ $opt_in_path[0] ] ); } } elseif ( ( 3 === count( $node['path'] ) ) && ( 'settings' === $node['path'][0] ) && ( 'blocks' === $node['path'][1] ) ) { $block_name = $node['path'][2]; unset( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ][ $opt_in_path[1] ] ); if ( empty( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ] ) ) { unset( $output['settings']['blocks'][ $block_name ][ $opt_in_path[0] ] ); } } } } } wp_recursive_ksort( $output ); return $output; } } 'text', 'title' => _x( 'Text', 'block category' ), 'icon' => null, ), array( 'slug' => 'media', 'title' => _x( 'Media', 'block category' ), 'icon' => null, ), array( 'slug' => 'design', 'title' => _x( 'Design', 'block category' ), 'icon' => null, ), array( 'slug' => 'widgets', 'title' => _x( 'Widgets', 'block category' ), 'icon' => null, ), array( 'slug' => 'theme', 'title' => _x( 'Theme', 'block category' ), 'icon' => null, ), array( 'slug' => 'embed', 'title' => _x( 'Embeds', 'block category' ), 'icon' => null, ), array( 'slug' => 'reusable', 'title' => _x( 'Reusable Blocks', 'block category' ), 'icon' => null, ), ); } function get_block_categories( $post_or_block_editor_context ) { $block_categories = get_default_block_categories(); $block_editor_context = $post_or_block_editor_context instanceof WP_Post ? new WP_Block_Editor_Context( array( 'post' => $post_or_block_editor_context, ) ) : $post_or_block_editor_context; $block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $block_categories = apply_filters_deprecated( 'block_categories', array( $block_categories, $post ), '5.8.0', 'block_categories_all' ); } return $block_categories; } function get_allowed_block_types( $block_editor_context ) { $allowed_block_types = true; $allowed_block_types = apply_filters( 'allowed_block_types_all', $allowed_block_types, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $allowed_block_types = apply_filters_deprecated( 'allowed_block_types', array( $allowed_block_types, $post ), '5.8.0', 'allowed_block_types_all' ); } return $allowed_block_types; } function get_default_block_editor_settings() { $max_upload_size = wp_max_upload_size(); if ( ! $max_upload_size ) { $max_upload_size = 0; } $image_size_names = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); $available_image_sizes = array(); foreach ( $image_size_names as $image_size_slug => $image_size_name ) { $available_image_sizes[] = array( 'slug' => $image_size_slug, 'name' => $image_size_name, ); } $default_size = get_option( 'image_default_size', 'large' ); $image_default_size = in_array( $default_size, array_keys( $image_size_names ), true ) ? $default_size : 'large'; $image_dimensions = array(); $all_sizes = wp_get_registered_image_subsizes(); foreach ( $available_image_sizes as $size ) { $key = $size['slug']; if ( isset( $all_sizes[ $key ] ) ) { $image_dimensions[ $key ] = $all_sizes[ $key ]; } } $default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css'; if ( file_exists( $default_editor_styles_file ) ) { $default_editor_styles = array( array( 'css' => file_get_contents( $default_editor_styles_file ) ), ); } else { $default_editor_styles = array(); } $editor_settings = array( 'alignWide' => get_theme_support( 'align-wide' ), 'allowedBlockTypes' => true, 'allowedMimeTypes' => get_allowed_mime_types(), 'defaultEditorStyles' => $default_editor_styles, 'blockCategories' => get_default_block_categories(), 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), 'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ), 'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ), 'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ), 'enableCustomSpacing' => get_theme_support( 'custom-spacing' ), 'enableCustomUnits' => get_theme_support( 'custom-units' ), 'isRTL' => is_rtl(), 'imageDefaultSize' => $image_default_size, 'imageDimensions' => $image_dimensions, 'imageEditing' => true, 'imageSizes' => $available_image_sizes, 'maxUploadFileSize' => $max_upload_size, '__unstableGalleryWithImageBlocks' => true, ); $color_palette = current( (array) get_theme_support( 'editor-color-palette' ) ); if ( false !== $color_palette ) { $editor_settings['colors'] = $color_palette; } $font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) ); if ( false !== $font_sizes ) { $editor_settings['fontSizes'] = $font_sizes; } $gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) ); if ( false !== $gradient_presets ) { $editor_settings['gradients'] = $gradient_presets; } return $editor_settings; } function get_legacy_widget_block_editor_settings() { $editor_settings = array(); $editor_settings['widgetTypesToHideFromLegacyWidgetBlock'] = apply_filters( 'widget_types_to_hide_from_legacy_widget_block', array( 'pages', 'calendar', 'archives', 'media_audio', 'media_image', 'media_gallery', 'media_video', 'search', 'text', 'categories', 'recent-posts', 'recent-comments', 'rss', 'tag_cloud', 'custom_html', 'block', ) ); return $editor_settings; } function _wp_get_iframed_editor_assets() { global $pagenow; $script_handles = array(); $style_handles = array( 'wp-block-editor', 'wp-block-library', 'wp-edit-blocks', ); if ( current_theme_supports( 'wp-block-styles' ) ) { $style_handles[] = 'wp-block-library-theme'; } if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) { $style_handles[] = 'wp-widgets'; $style_handles[] = 'wp-edit-widgets'; } $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_type ) { if ( ! empty( $block_type->style ) ) { $style_handles[] = $block_type->style; } if ( ! empty( $block_type->editor_style ) ) { $style_handles[] = $block_type->editor_style; } if ( ! empty( $block_type->script ) ) { $script_handles[] = $block_type->script; } } $style_handles = array_unique( $style_handles ); $done = wp_styles()->done; ob_start(); wp_styles()->done = array( 'wp-reset-editor-styles' ); wp_styles()->do_items( $style_handles ); wp_styles()->done = $done; $styles = ob_get_clean(); $script_handles = array_unique( $script_handles ); $done = wp_scripts()->done; ob_start(); wp_scripts()->done = array(); wp_scripts()->do_items( $script_handles ); wp_scripts()->done = $done; $scripts = ob_get_clean(); return array( 'styles' => $styles, 'scripts' => $scripts, ); } function get_block_editor_settings( array $custom_settings, $block_editor_context ) { $editor_settings = array_merge( get_default_block_editor_settings(), array( 'allowedBlockTypes' => get_allowed_block_types( $block_editor_context ), 'blockCategories' => get_block_categories( $block_editor_context ), ), $custom_settings ); $global_styles = array(); $presets = array( array( 'css' => 'variables', '__unstableType' => 'presets', 'isGlobalStyles' => true, ), array( 'css' => 'presets', '__unstableType' => 'presets', 'isGlobalStyles' => true, ), ); foreach ( $presets as $preset_style ) { $actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) ); if ( '' !== $actual_css ) { $preset_style['css'] = $actual_css; $global_styles[] = $preset_style; } } if ( WP_Theme_JSON_Resolver::theme_has_support() ) { $block_classes = array( 'css' => 'styles', '__unstableType' => 'theme', 'isGlobalStyles' => true, ); $actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) ); if ( '' !== $actual_css ) { $block_classes['css'] = $actual_css; $global_styles[] = $block_classes; } } $editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() ); $editor_settings['__experimentalFeatures'] = wp_get_global_settings(); if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) { $colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette']; $editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ? $colors_by_origin['custom'] : ( isset( $colors_by_origin['theme'] ) ? $colors_by_origin['theme'] : $colors_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) { $gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients']; $editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ? $gradients_by_origin['custom'] : ( isset( $gradients_by_origin['theme'] ) ? $gradients_by_origin['theme'] : $gradients_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) { $font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes']; $editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ? $font_sizes_by_origin['custom'] : ( isset( $font_sizes_by_origin['theme'] ) ? $font_sizes_by_origin['theme'] : $font_sizes_by_origin['default'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) { $editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom']; unset( $editor_settings['__experimentalFeatures']['color']['custom'] ); } if ( isset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ) ) { $editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient']; unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) { $editor_settings['disableCustomFontSizes'] = ! $editor_settings['__experimentalFeatures']['typography']['customFontSize']; unset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ); } if ( isset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ) ) { $editor_settings['enableCustomLineHeight'] = $editor_settings['__experimentalFeatures']['typography']['lineHeight']; unset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ); } if ( isset( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) { $editor_settings['enableCustomUnits'] = $editor_settings['__experimentalFeatures']['spacing']['units']; unset( $editor_settings['__experimentalFeatures']['spacing']['units'] ); } if ( isset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ) ) { $editor_settings['enableCustomSpacing'] = $editor_settings['__experimentalFeatures']['spacing']['padding']; unset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ); } $editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets(); $editor_settings['localAutosaveInterval'] = 15; $editor_settings['__experimentalDiscussionSettings'] = array( 'commentOrder' => get_option( 'comment_order' ), 'commentsPerPage' => get_option( 'comments_per_page' ), 'defaultCommentsPage' => get_option( 'default_comments_page' ), 'pageComments' => get_option( 'page_comments' ), 'threadComments' => get_option( 'thread_comments' ), 'threadCommentsDepth' => get_option( 'thread_comments_depth' ), 'defaultCommentStatus' => get_option( 'default_comment_status' ), 'avatarURL' => get_avatar_url( '', array( 'size' => 96, 'force_default' => true, 'default' => get_option( 'avatar_default' ), ) ), ); $editor_settings = apply_filters( 'block_editor_settings_all', $editor_settings, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $post = $block_editor_context->post; $editor_settings = apply_filters_deprecated( 'block_editor_settings', array( $editor_settings, $post ), '5.8.0', 'block_editor_settings_all' ); } return $editor_settings; } function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) { global $post, $wp_scripts, $wp_styles; $preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context ); if ( ! empty( $block_editor_context->post ) ) { $selected_post = $block_editor_context->post; $preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' ); } if ( empty( $preload_paths ) ) { return; } $backup_global_post = ! empty( $post ) ? clone $post : $post; $backup_wp_scripts = ! empty( $wp_scripts ) ? clone $wp_scripts : $wp_scripts; $backup_wp_styles = ! empty( $wp_styles ) ? clone $wp_styles : $wp_styles; foreach ( $preload_paths as &$path ) { if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) { $path = '/' . $path; continue; } if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) { $path[0] = '/' . $path[0]; } } unset( $path ); $preload_data = array_reduce( $preload_paths, 'rest_preload_api_request', array() ); $post = $backup_global_post; $wp_scripts = $backup_wp_scripts; $wp_styles = $backup_wp_styles; wp_add_inline_script( 'wp-api-fetch', sprintf( 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', wp_json_encode( $preload_data ) ), 'after' ); } function get_block_editor_theme_styles() { global $editor_styles; $styles = array(); if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) { foreach ( $editor_styles as $style ) { if ( preg_match( '~^(https?:)?//~', $style ) ) { $response = wp_remote_get( $style ); if ( ! is_wp_error( $response ) ) { $styles[] = array( 'css' => wp_remote_retrieve_body( $response ), '__unstableType' => 'theme', 'isGlobalStyles' => false, ); } } else { $file = get_theme_file_path( $style ); if ( is_file( $file ) ) { $styles[] = array( 'css' => file_get_contents( $file ), 'baseURL' => get_theme_file_uri( $style ), '__unstableType' => 'theme', 'isGlobalStyles' => false, ); } } } } return $styles; } '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'container_aria_label' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '
                  %3$s
                ', 'item_spacing' => 'preserve', 'depth' => 0, 'walker' => '', 'theme_location' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) { $args['item_spacing'] = $defaults['item_spacing']; } $args = apply_filters( 'wp_nav_menu_args', $args ); $args = (object) $args; $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args ); if ( null !== $nav_menu ) { if ( $args->echo ) { echo $nav_menu; return; } return $nav_menu; } $menu = wp_get_nav_menu_object( $args->menu ); $locations = get_nav_menu_locations(); if ( ! $menu && $args->theme_location && $locations && isset( $locations[ $args->theme_location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); } if ( ! $menu && ! $args->theme_location ) { $menus = wp_get_nav_menus(); foreach ( $menus as $menu_maybe ) { $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ); if ( $menu_items ) { $menu = $menu_maybe; break; } } } if ( empty( $args->menu ) ) { $args->menu = $menu; } if ( $menu && ! is_wp_error( $menu ) && ! isset( $menu_items ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); } if ( ( ! $menu || is_wp_error( $menu ) || ( isset( $menu_items ) && empty( $menu_items ) && ! $args->theme_location ) ) && isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) { return call_user_func( $args->fallback_cb, (array) $args ); } if ( ! $menu || is_wp_error( $menu ) ) { return false; } $nav_menu = ''; $items = ''; $show_container = false; if ( $args->container ) { $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags, true ) ) { $show_container = true; $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-' . $menu->slug . '-container"'; $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : ''; $aria_label = ( 'nav' === $args->container && $args->container_aria_label ) ? ' aria-label="' . esc_attr( $args->container_aria_label ) . '"' : ''; $nav_menu .= '<' . $args->container . $id . $class . $aria_label . '>'; } } _wp_menu_item_classes_by_context( $menu_items ); $sorted_menu_items = array(); $menu_items_with_children = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; if ( $menu_item->menu_item_parent ) { $menu_items_with_children[ $menu_item->menu_item_parent ] = true; } } if ( $menu_items_with_children ) { foreach ( $sorted_menu_items as &$menu_item ) { if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) { $menu_item->classes[] = 'menu-item-has-children'; } } } unset( $menu_items, $menu_item ); $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args ); unset( $sorted_menu_items ); if ( ! empty( $args->menu_id ) ) { $wrap_id = $args->menu_id; } else { $wrap_id = 'menu-' . $menu->slug; while ( in_array( $wrap_id, $menu_id_slugs, true ) ) { if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) { $wrap_id = preg_replace( '#-(\d+)$#', '-' . ++$matches[1], $wrap_id ); } else { $wrap_id = $wrap_id . '-1'; } } } $menu_id_slugs[] = $wrap_id; $wrap_class = $args->menu_class ? $args->menu_class : ''; $items = apply_filters( 'wp_nav_menu_items', $items, $args ); $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); if ( empty( $items ) ) { return false; } $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items ); unset( $items ); if ( $show_container ) { $nav_menu .= 'container . '>'; } $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); if ( $args->echo ) { echo $nav_menu; } else { return $nav_menu; } } function _wp_menu_item_classes_by_context( &$menu_items ) { global $wp_query, $wp_rewrite; $queried_object = $wp_query->get_queried_object(); $queried_object_id = (int) $wp_query->queried_object_id; $active_object = ''; $active_ancestor_item_ids = array(); $active_parent_item_ids = array(); $active_parent_object_ids = array(); $possible_taxonomy_ancestors = array(); $possible_object_parents = array(); $home_page_id = (int) get_option( 'page_for_posts' ); if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) { foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) { if ( is_taxonomy_hierarchical( $taxonomy ) ) { $term_hierarchy = _get_term_hierarchy( $taxonomy ); $terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) ); if ( is_array( $terms ) ) { $possible_object_parents = array_merge( $possible_object_parents, $terms ); $term_to_ancestor = array(); foreach ( (array) $term_hierarchy as $anc => $descs ) { foreach ( (array) $descs as $desc ) { $term_to_ancestor[ $desc ] = $anc; } } foreach ( $terms as $desc ) { do { $possible_taxonomy_ancestors[ $taxonomy ][] = $desc; if ( isset( $term_to_ancestor[ $desc ] ) ) { $_desc = $term_to_ancestor[ $desc ]; unset( $term_to_ancestor[ $desc ] ); $desc = $_desc; } else { $desc = 0; } } while ( ! empty( $desc ) ); } } } } } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) { $term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy ); $term_to_ancestor = array(); foreach ( (array) $term_hierarchy as $anc => $descs ) { foreach ( (array) $descs as $desc ) { $term_to_ancestor[ $desc ] = $anc; } } $desc = $queried_object->term_id; do { $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc; if ( isset( $term_to_ancestor[ $desc ] ) ) { $_desc = $term_to_ancestor[ $desc ]; unset( $term_to_ancestor[ $desc ] ); $desc = $_desc; } else { $desc = 0; } } while ( ! empty( $desc ) ); } $possible_object_parents = array_filter( $possible_object_parents ); $front_page_url = home_url(); $front_page_id = (int) get_option( 'page_on_front' ); $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); foreach ( (array) $menu_items as $key => $menu_item ) { $menu_items[ $key ]->current = false; $classes = (array) $menu_item->classes; $classes[] = 'menu-item'; $classes[] = 'menu-item-type-' . $menu_item->type; $classes[] = 'menu-item-object-' . $menu_item->object; if ( 'post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id ) { $classes[] = 'menu-item-home'; } if ( 'post_type' === $menu_item->type && $privacy_policy_page_id === (int) $menu_item->object_id ) { $classes[] = 'menu-item-privacy-policy'; } if ( $wp_query->is_singular && 'taxonomy' === $menu_item->type && in_array( (int) $menu_item->object_id, $possible_object_parents, true ) ) { $active_parent_object_ids[] = (int) $menu_item->object_id; $active_parent_item_ids[] = (int) $menu_item->db_id; $active_object = $queried_object->post_type; } elseif ( $menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && 'post_type' === $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || ( 'post_type' === $menu_item->type && $wp_query->is_singular ) || ( 'taxonomy' === $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object ) ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } if ( 'post_type' === $menu_item->type && 'page' === $menu_item->object ) { $classes[] = 'page_item'; $classes[] = 'page-item-' . $menu_item->object_id; $classes[] = 'current_page_item'; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; $active_parent_object_ids[] = (int) $menu_item->post_parent; $active_object = $menu_item->object; } elseif ( 'post_type_archive' === $menu_item->type && is_post_type_archive( array( $menu_item->object ) ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; } elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) { $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); if ( is_customize_preview() ) { $_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' ); } $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current ); $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; $item_url = set_url_scheme( untrailingslashit( $raw_item_url ) ); $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) ); $matches = array( $current_url, urldecode( $current_url ), $_indexless_current, urldecode( $_indexless_current ), $_root_relative_current, urldecode( $_root_relative_current ), ); if ( $raw_item_url && in_array( $item_url, $matches, true ) ) { $classes[] = 'current-menu-item'; $menu_items[ $key ]->current = true; $_anc_id = (int) $menu_item->db_id; while ( ( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && ! in_array( $_anc_id, $active_ancestor_item_ids, true ) ) { $active_ancestor_item_ids[] = $_anc_id; } if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ), true ) ) { $classes[] = 'current_page_item'; } $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; $active_parent_object_ids[] = (int) $menu_item->post_parent; $active_object = $menu_item->object; } elseif ( $item_url == $front_page_url && is_front_page() ) { $classes[] = 'current-menu-item'; } if ( untrailingslashit( $item_url ) == home_url() ) { $classes[] = 'menu-item-home'; } } if ( ! empty( $home_page_id ) && 'post_type' === $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) { $classes[] = 'current_page_parent'; } $menu_items[ $key ]->classes = array_unique( $classes ); } $active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) ); $active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) ); $active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) ); foreach ( (array) $menu_items as $key => $parent_item ) { $classes = (array) $parent_item->classes; $menu_items[ $key ]->current_item_ancestor = false; $menu_items[ $key ]->current_item_parent = false; if ( isset( $parent_item->type ) && ( ( 'post_type' === $parent_item->type && ! empty( $queried_object->post_type ) && is_post_type_hierarchical( $queried_object->post_type ) && in_array( (int) $parent_item->object_id, $queried_object->ancestors, true ) && $parent_item->object != $queried_object->ID ) || ( 'taxonomy' === $parent_item->type && isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) && in_array( (int) $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ], true ) && ( ! isset( $queried_object->term_id ) || $parent_item->object_id != $queried_object->term_id ) ) ) ) { if ( ! empty( $queried_object->taxonomy ) ) { $classes[] = 'current-' . $queried_object->taxonomy . '-ancestor'; } else { $classes[] = 'current-' . $queried_object->post_type . '-ancestor'; } } if ( in_array( (int) $parent_item->db_id, $active_ancestor_item_ids, true ) ) { $classes[] = 'current-menu-ancestor'; $menu_items[ $key ]->current_item_ancestor = true; } if ( in_array( (int) $parent_item->db_id, $active_parent_item_ids, true ) ) { $classes[] = 'current-menu-parent'; $menu_items[ $key ]->current_item_parent = true; } if ( in_array( (int) $parent_item->object_id, $active_parent_object_ids, true ) ) { $classes[] = 'current-' . $active_object . '-parent'; } if ( 'post_type' === $parent_item->type && 'page' === $parent_item->object ) { if ( in_array( 'current-menu-parent', $classes, true ) ) { $classes[] = 'current_page_parent'; } if ( in_array( 'current-menu-ancestor', $classes, true ) ) { $classes[] = 'current_page_ancestor'; } } $menu_items[ $key ]->classes = array_unique( $classes ); } } function walk_nav_menu_tree( $items, $depth, $args ) { $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker; return $walker->walk( $items, $depth, $args ); } function _nav_menu_item_id_use_once( $id, $item ) { static $_used_ids = array(); if ( in_array( $item->ID, $_used_ids, true ) ) { return ''; } $_used_ids[] = $item->ID; return $id; } cookie_service = new WP_Recovery_Mode_Cookie_Service(); $this->key_service = new WP_Recovery_Mode_Key_Service(); $this->link_service = new WP_Recovery_Mode_Link_Service( $this->cookie_service, $this->key_service ); $this->email_service = new WP_Recovery_Mode_Email_Service( $this->link_service ); } public function initialize() { $this->is_initialized = true; add_action( 'wp_logout', array( $this, 'exit_recovery_mode' ) ); add_action( 'login_form_' . self::EXIT_ACTION, array( $this, 'handle_exit_recovery_mode' ) ); add_action( 'recovery_mode_clean_expired_keys', array( $this, 'clean_expired_keys' ) ); if ( ! wp_next_scheduled( 'recovery_mode_clean_expired_keys' ) && ! wp_installing() ) { wp_schedule_event( time(), 'daily', 'recovery_mode_clean_expired_keys' ); } if ( defined( 'WP_RECOVERY_MODE_SESSION_ID' ) ) { $this->is_active = true; $this->session_id = WP_RECOVERY_MODE_SESSION_ID; return; } if ( $this->cookie_service->is_cookie_set() ) { $this->handle_cookie(); return; } $this->link_service->handle_begin_link( $this->get_link_ttl() ); } public function is_active() { return $this->is_active; } public function get_session_id() { return $this->session_id; } public function is_initialized() { return $this->is_initialized; } public function handle_error( array $error ) { $extension = $this->get_extension_for_error( $error ); if ( ! $extension || $this->is_network_plugin( $extension ) ) { return new WP_Error( 'invalid_source', __( 'Error not caused by a plugin or theme.' ) ); } if ( ! $this->is_active() ) { if ( ! is_protected_endpoint() ) { return new WP_Error( 'non_protected_endpoint', __( 'Error occurred on a non-protected endpoint.' ) ); } if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } return $this->email_service->maybe_send_recovery_mode_email( $this->get_email_rate_limit(), $error, $extension ); } if ( ! $this->store_error( $error ) ) { return new WP_Error( 'storage_error', __( 'Failed to store the error.' ) ); } if ( headers_sent() ) { return true; } $this->redirect_protected(); } public function exit_recovery_mode() { if ( ! $this->is_active() ) { return false; } $this->email_service->clear_rate_limit(); $this->cookie_service->clear_cookie(); wp_paused_plugins()->delete_all(); wp_paused_themes()->delete_all(); return true; } public function handle_exit_recovery_mode() { $redirect_to = wp_get_referer(); if ( ! $redirect_to ) { $redirect_to = is_user_logged_in() ? admin_url() : home_url(); } if ( ! $this->is_active() ) { wp_safe_redirect( $redirect_to ); die; } if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) { return; } if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], self::EXIT_ACTION ) ) { wp_die( __( 'Exit recovery mode link expired.' ), 403 ); } if ( ! $this->exit_recovery_mode() ) { wp_die( __( 'Failed to exit recovery mode. Please try again later.' ) ); } wp_safe_redirect( $redirect_to ); die; } public function clean_expired_keys() { $this->key_service->clean_expired_keys( $this->get_link_ttl() ); } protected function handle_cookie() { $validated = $this->cookie_service->validate_cookie(); if ( is_wp_error( $validated ) ) { $this->cookie_service->clear_cookie(); $validated->add_data( array( 'status' => 403 ) ); wp_die( $validated ); } $session_id = $this->cookie_service->get_session_id_from_cookie(); if ( is_wp_error( $session_id ) ) { $this->cookie_service->clear_cookie(); $session_id->add_data( array( 'status' => 403 ) ); wp_die( $session_id ); } $this->is_active = true; $this->session_id = $session_id; } protected function get_email_rate_limit() { return apply_filters( 'recovery_mode_email_rate_limit', DAY_IN_SECONDS ); } protected function get_link_ttl() { $rate_limit = $this->get_email_rate_limit(); $valid_for = $rate_limit; $valid_for = apply_filters( 'recovery_mode_email_link_ttl', $valid_for ); return max( $valid_for, $rate_limit ); } protected function get_extension_for_error( $error ) { global $wp_theme_directories; if ( ! isset( $error['file'] ) ) { return false; } if ( ! defined( 'WP_PLUGIN_DIR' ) ) { return false; } $error_file = wp_normalize_path( $error['file'] ); $wp_plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); if ( 0 === strpos( $error_file, $wp_plugin_dir ) ) { $path = str_replace( $wp_plugin_dir . '/', '', $error_file ); $parts = explode( '/', $path ); return array( 'type' => 'plugin', 'slug' => $parts[0], ); } if ( empty( $wp_theme_directories ) ) { return false; } foreach ( $wp_theme_directories as $theme_directory ) { $theme_directory = wp_normalize_path( $theme_directory ); if ( 0 === strpos( $error_file, $theme_directory ) ) { $path = str_replace( $theme_directory . '/', '', $error_file ); $parts = explode( '/', $path ); return array( 'type' => 'theme', 'slug' => $parts[0], ); } } return false; } protected function is_network_plugin( $extension ) { if ( 'plugin' !== $extension['type'] ) { return false; } if ( ! is_multisite() ) { return false; } $network_plugins = wp_get_active_network_plugins(); foreach ( $network_plugins as $plugin ) { if ( 0 === strpos( $plugin, $extension['slug'] . '/' ) ) { return true; } } return false; } protected function store_error( $error ) { $extension = $this->get_extension_for_error( $error ); if ( ! $extension ) { return false; } switch ( $extension['type'] ) { case 'plugin': return wp_paused_plugins()->set( $extension['slug'], $error ); case 'theme': return wp_paused_themes()->set( $extension['slug'], $error ); default: return false; } } protected function redirect_protected() { if ( ! function_exists( 'wp_safe_redirect' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $scheme = is_ssl() ? 'https://' : 'http://'; $url = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; wp_safe_redirect( $url ); exit; } } ]*href/i', $comment, $out ); $num_links = apply_filters( 'comment_max_links_url', $num_links, $url, $comment ); if ( $num_links >= $max_links ) { return false; } } $mod_keys = trim( get_option( 'moderation_keys' ) ); if ( ! empty( $mod_keys ) ) { $words = explode( "\n", $mod_keys ); foreach ( (array) $words as $word ) { $word = trim( $word ); if ( empty( $word ) ) { continue; } $word = preg_quote( $word, '#' ); $pattern = "#$word#i"; if ( preg_match( $pattern, $author ) ) { return false; } if ( preg_match( $pattern, $email ) ) { return false; } if ( preg_match( $pattern, $url ) ) { return false; } if ( preg_match( $pattern, $comment ) ) { return false; } if ( preg_match( $pattern, $user_ip ) ) { return false; } if ( preg_match( $pattern, $user_agent ) ) { return false; } } } if ( 1 == get_option( 'comment_previously_approved' ) ) { if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) { $comment_user = get_user_by( 'email', wp_unslash( $email ) ); if ( ! empty( $comment_user->ID ) ) { $ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) ); } else { $ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) ); } if ( ( 1 == $ok_to_comment ) && ( empty( $mod_keys ) || false === strpos( $email, $mod_keys ) ) ) { return true; } else { return false; } } else { return false; } } return true; } function get_approved_comments( $post_id, $args = array() ) { if ( ! $post_id ) { return array(); } $defaults = array( 'status' => 1, 'post_id' => $post_id, 'order' => 'ASC', ); $parsed_args = wp_parse_args( $args, $defaults ); $query = new WP_Comment_Query; return $query->query( $parsed_args ); } function get_comment( $comment = null, $output = OBJECT ) { if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) { $comment = $GLOBALS['comment']; } if ( $comment instanceof WP_Comment ) { $_comment = $comment; } elseif ( is_object( $comment ) ) { $_comment = new WP_Comment( $comment ); } else { $_comment = WP_Comment::get_instance( $comment ); } if ( ! $_comment ) { return null; } $_comment = apply_filters( 'get_comment', $_comment ); if ( OBJECT === $output ) { return $_comment; } elseif ( ARRAY_A === $output ) { return $_comment->to_array(); } elseif ( ARRAY_N === $output ) { return array_values( $_comment->to_array() ); } return $_comment; } function get_comments( $args = '' ) { $query = new WP_Comment_Query; return $query->query( $args ); } function get_comment_statuses() { $status = array( 'hold' => __( 'Unapproved' ), 'approve' => _x( 'Approved', 'comment status' ), 'spam' => _x( 'Spam', 'comment status' ), 'trash' => _x( 'Trash', 'comment status' ), ); return $status; } function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) { switch ( $comment_type ) { case 'pingback': case 'trackback': $supports = 'trackbacks'; $option = 'ping'; break; default: $supports = 'comments'; $option = 'comment'; break; } if ( 'page' === $post_type ) { $status = 'closed'; } elseif ( post_type_supports( $post_type, $supports ) ) { $status = get_option( "default_{$option}_status" ); } else { $status = 'closed'; } return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type ); } function get_lastcommentmodified( $timezone = 'server' ) { global $wpdb; $timezone = strtolower( $timezone ); $key = "lastcommentmodified:$timezone"; $comment_modified_date = wp_cache_get( $key, 'timeinfo' ); if ( false !== $comment_modified_date ) { return $comment_modified_date; } switch ( $timezone ) { case 'gmt': $comment_modified_date = $wpdb->get_var( "SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" ); break; case 'blog': $comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" ); break; case 'server': $add_seconds_server = gmdate( 'Z' ); $comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) ); break; } if ( $comment_modified_date ) { wp_cache_set( $key, $comment_modified_date, 'timeinfo' ); return $comment_modified_date; } return false; } function get_comment_count( $post_id = 0 ) { $post_id = (int) $post_id; $comment_count = array( 'approved' => 0, 'awaiting_moderation' => 0, 'spam' => 0, 'trash' => 0, 'post-trashed' => 0, 'total_comments' => 0, 'all' => 0, ); $args = array( 'count' => true, 'update_comment_meta_cache' => false, ); if ( $post_id > 0 ) { $args['post_id'] = $post_id; } $mapping = array( 'approved' => 'approve', 'awaiting_moderation' => 'hold', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed', ); $comment_count = array(); foreach ( $mapping as $key => $value ) { $comment_count[ $key ] = get_comments( array_merge( $args, array( 'status' => $value ) ) ); } $comment_count['all'] = $comment_count['approved'] + $comment_count['awaiting_moderation']; $comment_count['total_comments'] = $comment_count['all'] + $comment_count['spam']; return array_map( 'intval', $comment_count ); } function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique ); } function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { return delete_metadata( 'comment', $comment_id, $meta_key, $meta_value ); } function get_comment_meta( $comment_id, $key = '', $single = false ) { return get_metadata( 'comment', $comment_id, $key, $single ); } function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) { return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value ); } function wp_queue_comments_for_comment_meta_lazyload( $comments ) { $comment_ids = array(); if ( is_array( $comments ) ) { foreach ( $comments as $comment ) { if ( $comment instanceof WP_Comment ) { $comment_ids[] = $comment->comment_ID; } } } if ( $comment_ids ) { $lazyloader = wp_metadata_lazyloader(); $lazyloader->queue_objects( 'comment', $comment_ids ); } } function wp_set_comment_cookies( $comment, $user, $cookies_consent = true ) { if ( $user->exists() ) { return; } if ( false === $cookies_consent ) { $past = time() - YEAR_IN_SECONDS; setcookie( 'comment_author_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'comment_author_email_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); setcookie( 'comment_author_url_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN ); return; } $comment_cookie_lifetime = time() + apply_filters( 'comment_cookie_lifetime', 30000000 ); $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_url_' . COOKIEHASH, esc_url( $comment->comment_author_url ), $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); } function sanitize_comment_cookies() { if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = apply_filters( 'pre_comment_author_name', $_COOKIE[ 'comment_author_' . COOKIEHASH ] ); $comment_author = wp_unslash( $comment_author ); $comment_author = esc_attr( $comment_author ); $_COOKIE[ 'comment_author_' . COOKIEHASH ] = $comment_author; } if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ); $comment_author_email = wp_unslash( $comment_author_email ); $comment_author_email = esc_attr( $comment_author_email ); $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] = $comment_author_email; } if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ); $comment_author_url = wp_unslash( $comment_author_url ); $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] = $comment_author_url; } } function wp_allow_comment( $commentdata, $wp_error = false ) { global $wpdb; $dupe = $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ", wp_unslash( $commentdata['comment_post_ID'] ), wp_unslash( $commentdata['comment_parent'] ), wp_unslash( $commentdata['comment_author'] ) ); if ( $commentdata['comment_author_email'] ) { $dupe .= $wpdb->prepare( 'AND comment_author_email = %s ', wp_unslash( $commentdata['comment_author_email'] ) ); } $dupe .= $wpdb->prepare( ') AND comment_content = %s LIMIT 1', wp_unslash( $commentdata['comment_content'] ) ); $dupe_id = $wpdb->get_var( $dupe ); $dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata ); if ( $dupe_id ) { do_action( 'comment_duplicate_trigger', $commentdata ); $comment_duplicate_message = apply_filters( 'comment_duplicate_message', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ) ); if ( $wp_error ) { return new WP_Error( 'comment_duplicate', $comment_duplicate_message, 409 ); } else { if ( wp_doing_ajax() ) { die( $comment_duplicate_message ); } wp_die( $comment_duplicate_message, 409 ); } } do_action( 'check_comment_flood', $commentdata['comment_author_IP'], $commentdata['comment_author_email'], $commentdata['comment_date_gmt'], $wp_error ); $is_flood = apply_filters( 'wp_is_comment_flood', false, $commentdata['comment_author_IP'], $commentdata['comment_author_email'], $commentdata['comment_date_gmt'], $wp_error ); if ( $is_flood ) { $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) ); return new WP_Error( 'comment_flood', $comment_flood_message, 429 ); } if ( ! empty( $commentdata['user_id'] ) ) { $user = get_userdata( $commentdata['user_id'] ); $post_author = $wpdb->get_var( $wpdb->prepare( "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $commentdata['comment_post_ID'] ) ); } if ( isset( $user ) && ( $commentdata['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) { $approved = 1; } else { if ( check_comment( $commentdata['comment_author'], $commentdata['comment_author_email'], $commentdata['comment_author_url'], $commentdata['comment_content'], $commentdata['comment_author_IP'], $commentdata['comment_agent'], $commentdata['comment_type'] ) ) { $approved = 1; } else { $approved = 0; } if ( wp_check_comment_disallowed_list( $commentdata['comment_author'], $commentdata['comment_author_email'], $commentdata['comment_author_url'], $commentdata['comment_content'], $commentdata['comment_author_IP'], $commentdata['comment_agent'] ) ) { $approved = EMPTY_TRASH_DAYS ? 'trash' : 'spam'; } } return apply_filters( 'pre_comment_approved', $approved, $commentdata ); } function check_comment_flood_db() { add_filter( 'wp_is_comment_flood', 'wp_check_comment_flood', 10, 5 ); } function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) { global $wpdb; if ( true === $is_flood ) { return $is_flood; } if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) { return false; } $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS ); if ( is_user_logged_in() ) { $user = get_current_user_id(); $check_column = '`user_id`'; } else { $user = $ip; $check_column = '`comment_author_IP`'; } $sql = $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( $check_column = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $user, $email ); $lasttime = $wpdb->get_var( $sql ); if ( $lasttime ) { $time_lastcomment = mysql2date( 'U', $lasttime, false ); $time_newcomment = mysql2date( 'U', $date, false ); $flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment ); if ( $flood_die ) { do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment ); if ( $avoid_die ) { return true; } else { $comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) ); if ( wp_doing_ajax() ) { die( $comment_flood_message ); } wp_die( $comment_flood_message, 429 ); } } } return false; } function separate_comments( &$comments ) { $comments_by_type = array( 'comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array(), ); $count = count( $comments ); for ( $i = 0; $i < $count; $i++ ) { $type = $comments[ $i ]->comment_type; if ( empty( $type ) ) { $type = 'comment'; } $comments_by_type[ $type ][] = &$comments[ $i ]; if ( 'trackback' === $type || 'pingback' === $type ) { $comments_by_type['pings'][] = &$comments[ $i ]; } } return $comments_by_type; } function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { global $wp_query; if ( null === $comments && null === $per_page && null === $threaded && ! empty( $wp_query->max_num_comment_pages ) ) { return $wp_query->max_num_comment_pages; } if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments ) ) { $comments = $wp_query->comments; } if ( empty( $comments ) ) { return 0; } if ( ! get_option( 'page_comments' ) ) { return 1; } if ( ! isset( $per_page ) ) { $per_page = (int) get_query_var( 'comments_per_page' ); } if ( 0 === $per_page ) { $per_page = (int) get_option( 'comments_per_page' ); } if ( 0 === $per_page ) { return 1; } if ( ! isset( $threaded ) ) { $threaded = get_option( 'thread_comments' ); } if ( $threaded ) { $walker = new Walker_Comment; $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page ); } else { $count = ceil( count( $comments ) / $per_page ); } return $count; } function get_page_of_comment( $comment_ID, $args = array() ) { global $wpdb; $page = null; $comment = get_comment( $comment_ID ); if ( ! $comment ) { return; } $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', ); $args = wp_parse_args( $args, $defaults ); $original_args = $args; if ( get_option( 'page_comments' ) ) { if ( '' === $args['per_page'] ) { $args['per_page'] = get_query_var( 'comments_per_page' ); } if ( '' === $args['per_page'] ) { $args['per_page'] = get_option( 'comments_per_page' ); } } if ( empty( $args['per_page'] ) ) { $args['per_page'] = 0; $args['page'] = 0; } if ( $args['per_page'] < 1 ) { $page = 1; } if ( null === $page ) { if ( '' === $args['max_depth'] ) { if ( get_option( 'thread_comments' ) ) { $args['max_depth'] = get_option( 'thread_comments_depth' ); } else { $args['max_depth'] = -1; } } if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) { return get_page_of_comment( $comment->comment_parent, $args ); } $comment_args = array( 'type' => $args['type'], 'post_id' => $comment->comment_post_ID, 'fields' => 'ids', 'count' => true, 'status' => 'approve', 'parent' => 0, 'date_query' => array( array( 'column' => "$wpdb->comments.comment_date_gmt", 'before' => $comment->comment_date_gmt, ), ), ); if ( is_user_logged_in() ) { $comment_args['include_unapproved'] = array( get_current_user_id() ); } else { $unapproved_email = wp_get_unapproved_comment_author_email(); if ( $unapproved_email ) { $comment_args['include_unapproved'] = array( $unapproved_email ); } } $comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args ); $comment_query = new WP_Comment_Query(); $older_comment_count = $comment_query->query( $comment_args ); if ( 0 == $older_comment_count ) { $page = 1; } else { $page = ceil( ( $older_comment_count + 1 ) / $args['per_page'] ); } } return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID ); } function wp_get_comment_fields_max_lengths() { global $wpdb; $lengths = array( 'comment_author' => 245, 'comment_author_email' => 100, 'comment_author_url' => 200, 'comment_content' => 65525, ); if ( $wpdb->is_mysql ) { foreach ( $lengths as $column => $length ) { $col_length = $wpdb->get_col_length( $wpdb->comments, $column ); $max_length = 0; if ( is_wp_error( $col_length ) ) { break; } if ( ! is_array( $col_length ) && (int) $col_length > 0 ) { $max_length = (int) $col_length; } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) { $max_length = (int) $col_length['length']; if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) { $max_length = $max_length - 10; } } if ( $max_length > 0 ) { $lengths[ $column ] = $max_length; } } } return apply_filters( 'wp_get_comment_fields_max_lengths', $lengths ); } function wp_check_comment_data_max_lengths( $comment_data ) { $max_lengths = wp_get_comment_fields_max_lengths(); if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) { return new WP_Error( 'comment_author_column_length', __( 'Error: Your name is too long.' ), 200 ); } if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) { return new WP_Error( 'comment_author_email_column_length', __( 'Error: Your email address is too long.' ), 200 ); } if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) { return new WP_Error( 'comment_author_url_column_length', __( 'Error: Your URL is too long.' ), 200 ); } if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) { return new WP_Error( 'comment_content_column_length', __( 'Error: Your comment is too long.' ), 200 ); } return true; } function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) { do_action_deprecated( 'wp_blacklist_check', array( $author, $email, $url, $comment, $user_ip, $user_agent ), '5.5.0', 'wp_check_comment_disallowed_list', __( 'Please consider writing more inclusive code.' ) ); do_action( 'wp_check_comment_disallowed_list', $author, $email, $url, $comment, $user_ip, $user_agent ); $mod_keys = trim( get_option( 'disallowed_keys' ) ); if ( '' === $mod_keys ) { return false; } $comment_without_html = wp_strip_all_tags( $comment ); $words = explode( "\n", $mod_keys ); foreach ( (array) $words as $word ) { $word = trim( $word ); if ( empty( $word ) ) { continue; } $word = preg_quote( $word, '#' ); $pattern = "#$word#i"; if ( preg_match( $pattern, $author ) || preg_match( $pattern, $email ) || preg_match( $pattern, $url ) || preg_match( $pattern, $comment ) || preg_match( $pattern, $comment_without_html ) || preg_match( $pattern, $user_ip ) || preg_match( $pattern, $user_agent ) ) { return true; } } return false; } function wp_count_comments( $post_id = 0 ) { $post_id = (int) $post_id; $filtered = apply_filters( 'wp_count_comments', array(), $post_id ); if ( ! empty( $filtered ) ) { return $filtered; } $count = wp_cache_get( "comments-{$post_id}", 'counts' ); if ( false !== $count ) { return $count; } $stats = get_comment_count( $post_id ); $stats['moderated'] = $stats['awaiting_moderation']; unset( $stats['awaiting_moderation'] ); $stats_object = (object) $stats; wp_cache_set( "comments-{$post_id}", $stats_object, 'counts' ); return $stats_object; } function wp_delete_comment( $comment_id, $force_delete = false ) { global $wpdb; $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } if ( ! $force_delete && EMPTY_TRASH_DAYS && ! in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ), true ) ) { return wp_trash_comment( $comment_id ); } do_action( 'delete_comment', $comment->comment_ID, $comment ); $children = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID ) ); if ( ! empty( $children ) ) { $wpdb->update( $wpdb->comments, array( 'comment_parent' => $comment->comment_parent ), array( 'comment_parent' => $comment->comment_ID ) ); clean_comment_cache( $children ); } $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) ); foreach ( $meta_ids as $mid ) { delete_metadata_by_mid( 'comment', $mid ); } if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) ) { return false; } do_action( 'deleted_comment', $comment->comment_ID, $comment ); $post_id = $comment->comment_post_ID; if ( $post_id && 1 == $comment->comment_approved ) { wp_update_comment_count( $post_id ); } clean_comment_cache( $comment->comment_ID ); do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' ); wp_transition_comment_status( 'delete', $comment->comment_approved, $comment ); return true; } function wp_trash_comment( $comment_id ) { if ( ! EMPTY_TRASH_DAYS ) { return wp_delete_comment( $comment_id, true ); } $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'trash_comment', $comment->comment_ID, $comment ); if ( wp_set_comment_status( $comment, 'trash' ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() ); do_action( 'trashed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_untrash_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'untrash_comment', $comment->comment_ID, $comment ); $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ); if ( empty( $status ) ) { $status = '0'; } if ( wp_set_comment_status( $comment, $status ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); do_action( 'untrashed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_spam_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'spam_comment', $comment->comment_ID, $comment ); if ( wp_set_comment_status( $comment, 'spam' ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved ); add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() ); do_action( 'spammed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_unspam_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } do_action( 'unspam_comment', $comment->comment_ID, $comment ); $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ); if ( empty( $status ) ) { $status = '0'; } if ( wp_set_comment_status( $comment, $status ) ) { delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' ); delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' ); do_action( 'unspammed_comment', $comment->comment_ID, $comment ); return true; } return false; } function wp_get_comment_status( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment ) { return false; } $approved = $comment->comment_approved; if ( null == $approved ) { return false; } elseif ( '1' == $approved ) { return 'approved'; } elseif ( '0' == $approved ) { return 'unapproved'; } elseif ( 'spam' === $approved ) { return 'spam'; } elseif ( 'trash' === $approved ) { return 'trash'; } else { return false; } } function wp_transition_comment_status( $new_status, $old_status, $comment ) { $comment_statuses = array( 0 => 'unapproved', 'hold' => 'unapproved', 1 => 'approved', 'approve' => 'approved', ); if ( isset( $comment_statuses[ $new_status ] ) ) { $new_status = $comment_statuses[ $new_status ]; } if ( isset( $comment_statuses[ $old_status ] ) ) { $old_status = $comment_statuses[ $old_status ]; } if ( $new_status != $old_status ) { do_action( 'transition_comment_status', $new_status, $old_status, $comment ); do_action( "comment_{$old_status}_to_{$new_status}", $comment ); } do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment ); } function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) { if ( 'approved' === $new_status || 'approved' === $old_status ) { $data = array(); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { $data[] = "lastcommentmodified:$timezone"; } wp_cache_delete_multiple( $data, 'timeinfo' ); } } function wp_get_current_commenter() { $comment_author = ''; if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = $_COOKIE[ 'comment_author_' . COOKIEHASH ]; } $comment_author_email = ''; if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = $_COOKIE[ 'comment_author_email_' . COOKIEHASH ]; } $comment_author_url = ''; if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ]; } return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) ); } function wp_get_unapproved_comment_author_email() { $commenter_email = ''; if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) { $comment_id = (int) $_GET['unapproved']; $comment = get_comment( $comment_id ); if ( $comment && hash_equals( $_GET['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) { $comment_preview_expires = strtotime( $comment->comment_date_gmt . '+10 minutes' ); if ( time() < $comment_preview_expires ) { $commenter_email = $comment->comment_author_email; } } } if ( ! $commenter_email ) { $commenter = wp_get_current_commenter(); $commenter_email = $commenter['comment_author_email']; } return $commenter_email; } function wp_insert_comment( $commentdata ) { global $wpdb; $data = wp_unslash( $commentdata ); $comment_author = ! isset( $data['comment_author'] ) ? '' : $data['comment_author']; $comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email']; $comment_author_url = ! isset( $data['comment_author_url'] ) ? '' : $data['comment_author_url']; $comment_author_IP = ! isset( $data['comment_author_IP'] ) ? '' : $data['comment_author_IP']; $comment_date = ! isset( $data['comment_date'] ) ? current_time( 'mysql' ) : $data['comment_date']; $comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt']; $comment_post_ID = ! isset( $data['comment_post_ID'] ) ? 0 : $data['comment_post_ID']; $comment_content = ! isset( $data['comment_content'] ) ? '' : $data['comment_content']; $comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma']; $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved']; $comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent']; $comment_type = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type']; $comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent']; $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id']; $compacted = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' ); if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) { return false; } $id = (int) $wpdb->insert_id; if ( 1 == $comment_approved ) { wp_update_comment_count( $comment_post_ID ); $data = array(); foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) { $data[] = "lastcommentmodified:$timezone"; } wp_cache_delete_multiple( $data, 'timeinfo' ); } clean_comment_cache( $id ); $comment = get_comment( $id ); if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) { foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) { add_comment_meta( $comment->comment_ID, $meta_key, $meta_value, true ); } } do_action( 'wp_insert_comment', $id, $comment ); return $id; } function wp_filter_comment( $commentdata ) { if ( isset( $commentdata['user_ID'] ) ) { $commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_ID'] ); } elseif ( isset( $commentdata['user_id'] ) ) { $commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_id'] ); } $commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) ); $commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] ); $commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] ); $commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] ); $commentdata['comment_author_url'] = apply_filters( 'pre_comment_author_url', $commentdata['comment_author_url'] ); $commentdata['comment_author_email'] = apply_filters( 'pre_comment_author_email', $commentdata['comment_author_email'] ); $commentdata['filtered'] = true; return $commentdata; } function wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment ) { if ( $block ) { return $block; } if ( ( $time_newcomment - $time_lastcomment ) < 15 ) { return true; } return false; } function wp_new_comment( $commentdata, $wp_error = false ) { global $wpdb; if ( isset( $commentdata['user_ID'] ) ) { $commentdata['user_ID'] = (int) $commentdata['user_ID']; $commentdata['user_id'] = $commentdata['user_ID']; } $prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0; if ( ! isset( $commentdata['comment_author_IP'] ) ) { $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR']; } if ( ! isset( $commentdata['comment_agent'] ) ) { $commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; } $commentdata = apply_filters( 'preprocess_comment', $commentdata ); $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID']; if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) { $commentdata['user_ID'] = (int) $commentdata['user_ID']; $commentdata['user_id'] = $commentdata['user_ID']; } elseif ( isset( $commentdata['user_id'] ) ) { $commentdata['user_id'] = (int) $commentdata['user_id']; } $commentdata['comment_parent'] = isset( $commentdata['comment_parent'] ) ? absint( $commentdata['comment_parent'] ) : 0; $parent_status = ( $commentdata['comment_parent'] > 0 ) ? wp_get_comment_status( $commentdata['comment_parent'] ) : ''; $commentdata['comment_parent'] = ( 'approved' === $parent_status || 'unapproved' === $parent_status ) ? $commentdata['comment_parent'] : 0; $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] ); $commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 ); if ( empty( $commentdata['comment_date'] ) ) { $commentdata['comment_date'] = current_time( 'mysql' ); } if ( empty( $commentdata['comment_date_gmt'] ) ) { $commentdata['comment_date_gmt'] = current_time( 'mysql', 1 ); } if ( empty( $commentdata['comment_type'] ) ) { $commentdata['comment_type'] = 'comment'; } $commentdata = wp_filter_comment( $commentdata ); $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); if ( is_wp_error( $commentdata['comment_approved'] ) ) { return $commentdata['comment_approved']; } $comment_ID = wp_insert_comment( $commentdata ); if ( ! $comment_ID ) { $fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' ); foreach ( $fields as $field ) { if ( isset( $commentdata[ $field ] ) ) { $commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] ); } } $commentdata = wp_filter_comment( $commentdata ); $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); if ( is_wp_error( $commentdata['comment_approved'] ) ) { return $commentdata['comment_approved']; } $comment_ID = wp_insert_comment( $commentdata ); if ( ! $comment_ID ) { return false; } } do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata ); return $comment_ID; } function wp_new_comment_notify_moderator( $comment_ID ) { $comment = get_comment( $comment_ID ); $maybe_notify = ( '0' == $comment->comment_approved ); $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID ); if ( ! $maybe_notify ) { return false; } return wp_notify_moderator( $comment_ID ); } function wp_new_comment_notify_postauthor( $comment_ID ) { $comment = get_comment( $comment_ID ); $maybe_notify = get_option( 'comments_notify' ); $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID ); if ( ! $maybe_notify ) { return false; } if ( ! isset( $comment->comment_approved ) || '1' != $comment->comment_approved ) { return false; } return wp_notify_postauthor( $comment_ID ); } function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false ) { global $wpdb; switch ( $comment_status ) { case 'hold': case '0': $status = '0'; break; case 'approve': case '1': $status = '1'; add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' ); break; case 'spam': $status = 'spam'; break; case 'trash': $status = 'trash'; break; default: return false; } $comment_old = clone get_comment( $comment_id ); if ( ! $wpdb->update( $wpdb->comments, array( 'comment_approved' => $status ), array( 'comment_ID' => $comment_old->comment_ID ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update comment status.' ), $wpdb->last_error ); } else { return false; } } clean_comment_cache( $comment_old->comment_ID ); $comment = get_comment( $comment_old->comment_ID ); do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status ); wp_transition_comment_status( $comment_status, $comment_old->comment_approved, $comment ); wp_update_comment_count( $comment->comment_post_ID ); return true; } function wp_update_comment( $commentarr, $wp_error = false ) { global $wpdb; $comment = get_comment( $commentarr['comment_ID'], ARRAY_A ); if ( empty( $comment ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_comment_id', __( 'Invalid comment ID.' ) ); } else { return false; } } if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { if ( $wp_error ) { return new WP_Error( 'invalid_post_id', __( 'Invalid post ID.' ) ); } else { return false; } } $comment = wp_slash( $comment ); $old_status = $comment['comment_approved']; $commentarr = array_merge( $comment, $commentarr ); $commentarr = wp_filter_comment( $commentarr ); $data = wp_unslash( $commentarr ); $data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] ); $data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] ); if ( ! isset( $data['comment_approved'] ) ) { $data['comment_approved'] = 1; } elseif ( 'hold' === $data['comment_approved'] ) { $data['comment_approved'] = 0; } elseif ( 'approve' === $data['comment_approved'] ) { $data['comment_approved'] = 1; } $comment_ID = $data['comment_ID']; $comment_post_ID = $data['comment_post_ID']; $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr ); if ( is_wp_error( $data ) ) { if ( $wp_error ) { return $data; } else { return false; } } $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' ); $data = wp_array_slice_assoc( $data, $keys ); $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) ); if ( false === $rval ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error ); } else { return false; } } if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) { foreach ( $commentarr['comment_meta'] as $meta_key => $meta_value ) { update_comment_meta( $comment_ID, $meta_key, $meta_value ); } } clean_comment_cache( $comment_ID ); wp_update_comment_count( $comment_post_ID ); do_action( 'edit_comment', $comment_ID, $data ); $comment = get_comment( $comment_ID ); wp_transition_comment_status( $comment->comment_approved, $old_status, $comment ); return $rval; } function wp_defer_comment_counting( $defer = null ) { static $_defer = false; if ( is_bool( $defer ) ) { $_defer = $defer; if ( ! $defer ) { wp_update_comment_count( null, true ); } } return $_defer; } function wp_update_comment_count( $post_id, $do_deferred = false ) { static $_deferred = array(); if ( empty( $post_id ) && ! $do_deferred ) { return false; } if ( $do_deferred ) { $_deferred = array_unique( $_deferred ); foreach ( $_deferred as $i => $_post_id ) { wp_update_comment_count_now( $_post_id ); unset( $_deferred[ $i ] ); } } if ( wp_defer_comment_counting() ) { $_deferred[] = $post_id; return true; } elseif ( $post_id ) { return wp_update_comment_count_now( $post_id ); } } function wp_update_comment_count_now( $post_id ) { global $wpdb; $post_id = (int) $post_id; if ( ! $post_id ) { return false; } wp_cache_delete( 'comments-0', 'counts' ); wp_cache_delete( "comments-{$post_id}", 'counts' ); $post = get_post( $post_id ); if ( ! $post ) { return false; } $old = (int) $post->comment_count; $new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id ); if ( is_null( $new ) ) { $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) ); } else { $new = (int) $new; } $wpdb->update( $wpdb->posts, array( 'comment_count' => $new ), array( 'ID' => $post_id ) ); clean_post_cache( $post ); do_action( 'wp_update_comment_count', $post_id, $new, $old ); do_action( "edit_post_{$post->post_type}", $post_id, $post ); do_action( 'edit_post', $post_id, $post ); return true; } function discover_pingback_server_uri( $url, $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); } $pingback_str_dquote = 'rel="pingback"'; $pingback_str_squote = 'rel=\'pingback\''; $parsed_url = parse_url( $url ); if ( ! isset( $parsed_url['host'] ) ) { return false; } $uploads_dir = wp_get_upload_dir(); if ( 0 === strpos( $url, $uploads_dir['baseurl'] ) ) { return false; } $response = wp_safe_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0', ) ); if ( is_wp_error( $response ) ) { return false; } if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) { return wp_remote_retrieve_header( $response, 'x-pingback' ); } if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) { return false; } $response = wp_safe_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0', ) ); if ( is_wp_error( $response ) ) { return false; } $contents = wp_remote_retrieve_body( $response ); $pingback_link_offset_dquote = strpos( $contents, $pingback_str_dquote ); $pingback_link_offset_squote = strpos( $contents, $pingback_str_squote ); if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { $quote = ( $pingback_link_offset_dquote ) ? '"' : '\''; $pingback_link_offset = ( '"' === $quote ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote; $pingback_href_pos = strpos( $contents, 'href=', $pingback_link_offset ); $pingback_href_start = $pingback_href_pos + 6; $pingback_href_end = strpos( $contents, $quote, $pingback_href_start ); $pingback_server_url_len = $pingback_href_end - $pingback_href_start; $pingback_server_url = substr( $contents, $pingback_href_start, $pingback_server_url_len ); if ( $pingback_server_url_len > 0 ) { return $pingback_server_url; } } return false; } function do_all_pings() { do_action( 'do_all_pings' ); } function do_all_pingbacks() { $pings = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_pingme', 'fields' => 'ids', ) ); foreach ( $pings as $ping ) { delete_post_meta( $ping, '_pingme' ); pingback( null, $ping ); } } function do_all_enclosures() { $enclosures = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_encloseme', 'fields' => 'ids', ) ); foreach ( $enclosures as $enclosure ) { delete_post_meta( $enclosure, '_encloseme' ); do_enclose( null, $enclosure ); } } function do_all_trackbacks() { $trackbacks = get_posts( array( 'post_type' => get_post_types(), 'suppress_filters' => false, 'nopaging' => true, 'meta_key' => '_trackbackme', 'fields' => 'ids', ) ); foreach ( $trackbacks as $trackback ) { delete_post_meta( $trackback, '_trackbackme' ); do_trackbacks( $trackback ); } } function do_trackbacks( $post_id ) { global $wpdb; $post = get_post( $post_id ); if ( ! $post ) { return false; } $to_ping = get_to_ping( $post ); $pinged = get_pung( $post ); if ( empty( $to_ping ) ) { $wpdb->update( $wpdb->posts, array( 'to_ping' => '' ), array( 'ID' => $post->ID ) ); return; } if ( empty( $post->post_excerpt ) ) { $excerpt = apply_filters( 'the_content', $post->post_content, $post->ID ); } else { $excerpt = apply_filters( 'the_excerpt', $post->post_excerpt ); } $excerpt = str_replace( ']]>', ']]>', $excerpt ); $excerpt = wp_html_excerpt( $excerpt, 252, '…' ); $post_title = apply_filters( 'the_title', $post->post_title, $post->ID ); $post_title = strip_tags( $post_title ); if ( $to_ping ) { foreach ( (array) $to_ping as $tb_ping ) { $tb_ping = trim( $tb_ping ); if ( ! in_array( $tb_ping, $pinged, true ) ) { trackback( $tb_ping, $post_title, $excerpt, $post->ID ); $pinged[] = $tb_ping; } else { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, - '')) WHERE ID = %d", $tb_ping, $post->ID ) ); } } } } function generic_ping( $post_id = 0 ) { $services = get_option( 'ping_sites' ); $services = explode( "\n", $services ); foreach ( (array) $services as $service ) { $service = trim( $service ); if ( '' !== $service ) { weblog_ping( $service ); } } return $post_id; } function pingback( $content, $post_id ) { include_once ABSPATH . WPINC . '/class-IXR.php'; include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php'; $post_links = array(); $post = get_post( $post_id ); if ( ! $post ) { return; } $pung = get_pung( $post ); if ( empty( $content ) ) { $content = $post->post_content; } $post_links_temp = wp_extract_urls( $content ); foreach ( (array) $post_links_temp as $link_test ) { if ( ! in_array( $link_test, $pung, true ) && ( url_to_postid( $link_test ) != $post->ID ) && ! is_local_attachment( $link_test ) ) { $test = parse_url( $link_test ); if ( $test ) { if ( isset( $test['query'] ) ) { $post_links[] = $link_test; } elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) { $post_links[] = $link_test; } } } } $post_links = array_unique( $post_links ); do_action_ref_array( 'pre_ping', array( &$post_links, &$pung, $post->ID ) ); foreach ( (array) $post_links as $pagelinkedto ) { $pingback_server_url = discover_pingback_server_uri( $pagelinkedto ); if ( $pingback_server_url ) { set_time_limit( 60 ); $pagelinkedfrom = get_permalink( $post ); $client = new WP_HTTP_IXR_Client( $pingback_server_url ); $client->timeout = 3; $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . get_bloginfo( 'version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom ); $client->debug = false; if ( $client->query( 'pingback.ping', $pagelinkedfrom, $pagelinkedto ) || ( isset( $client->error->code ) && 48 == $client->error->code ) ) { add_ping( $post, $pagelinkedto ); } } } } function privacy_ping_filter( $sites ) { if ( '0' != get_option( 'blog_public' ) ) { return $sites; } else { return ''; } } function trackback( $trackback_url, $title, $excerpt, $ID ) { global $wpdb; if ( empty( $trackback_url ) ) { return; } $options = array(); $options['timeout'] = 10; $options['body'] = array( 'title' => $title, 'url' => get_permalink( $ID ), 'blog_name' => get_option( 'blogname' ), 'excerpt' => $excerpt, ); $response = wp_safe_remote_post( $trackback_url, $options ); if ( is_wp_error( $response ) ) { return; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID ) ); return $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID ) ); } function weblog_ping( $server = '', $path = '' ) { include_once ABSPATH . WPINC . '/class-IXR.php'; include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php'; $client = new WP_HTTP_IXR_Client( $server, ( ( ! strlen( trim( $path ) ) || ( '/' === $path ) ) ? false : $path ) ); $client->timeout = 3; $client->useragent .= ' -- WordPress/' . get_bloginfo( 'version' ); $client->debug = false; $home = trailingslashit( home_url() ); if ( ! $client->query( 'weblogUpdates.extendedPing', get_option( 'blogname' ), $home, get_bloginfo( 'rss2_url' ) ) ) { $client->query( 'weblogUpdates.ping', get_option( 'blogname' ), $home ); } } function pingback_ping_source_uri( $source_uri ) { return (string) wp_http_validate_url( $source_uri ); } function xmlrpc_pingback_error( $ixr_error ) { if ( 48 === $ixr_error->code ) { return $ixr_error; } return new IXR_Error( 0, '' ); } function clean_comment_cache( $ids ) { $comment_ids = (array) $ids; wp_cache_delete_multiple( $comment_ids, 'comment' ); foreach ( $comment_ids as $id ) { do_action( 'clean_comment_cache', $id ); } wp_cache_set( 'last_changed', microtime(), 'comment' ); } function update_comment_cache( $comments, $update_meta_cache = true ) { $data = array(); foreach ( (array) $comments as $comment ) { $data[ $comment->comment_ID ] = $comment; } wp_cache_add_multiple( $data, 'comment' ); if ( $update_meta_cache ) { $comment_ids = array(); foreach ( $comments as $comment ) { $comment_ids[] = $comment->comment_ID; } update_meta_cache( 'comment', $comment_ids ); } } function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) { global $wpdb; $non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' ); if ( ! empty( $non_cached_ids ) ) { $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); update_comment_cache( $fresh_comments, $update_meta_cache ); } } function _close_comments_for_old_posts( $posts, $query ) { if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) ) { return $posts; } $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) { return $posts; } $days_old = (int) get_option( 'close_comments_days_old' ); if ( ! $days_old ) { return $posts; } if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { $posts[0]->comment_status = 'closed'; $posts[0]->ping_status = 'closed'; } return $posts; } function _close_comments_for_old_post( $open, $post_id ) { if ( ! $open ) { return $open; } if ( ! get_option( 'close_comments_for_old_posts' ) ) { return $open; } $days_old = (int) get_option( 'close_comments_days_old' ); if ( ! $days_old ) { return $open; } $post = get_post( $post_id ); $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); if ( ! in_array( $post->post_type, $post_types, true ) ) { return $open; } if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { return $open; } if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { return false; } return $open; } function wp_handle_comment_submission( $comment_data ) { $comment_post_ID = 0; $comment_parent = 0; $user_ID = 0; $comment_author = null; $comment_author_email = null; $comment_author_url = null; $comment_content = null; if ( isset( $comment_data['comment_post_ID'] ) ) { $comment_post_ID = (int) $comment_data['comment_post_ID']; } if ( isset( $comment_data['author'] ) && is_string( $comment_data['author'] ) ) { $comment_author = trim( strip_tags( $comment_data['author'] ) ); } if ( isset( $comment_data['email'] ) && is_string( $comment_data['email'] ) ) { $comment_author_email = trim( $comment_data['email'] ); } if ( isset( $comment_data['url'] ) && is_string( $comment_data['url'] ) ) { $comment_author_url = trim( $comment_data['url'] ); } if ( isset( $comment_data['comment'] ) && is_string( $comment_data['comment'] ) ) { $comment_content = trim( $comment_data['comment'] ); } if ( isset( $comment_data['comment_parent'] ) ) { $comment_parent = absint( $comment_data['comment_parent'] ); } $post = get_post( $comment_post_ID ); if ( empty( $post->comment_status ) ) { do_action( 'comment_id_not_found', $comment_post_ID ); return new WP_Error( 'comment_id_not_found' ); } $status = get_post_status( $post ); if ( ( 'private' === $status ) && ! current_user_can( 'read_post', $comment_post_ID ) ) { return new WP_Error( 'comment_id_not_found' ); } $status_obj = get_post_status_object( $status ); if ( ! comments_open( $comment_post_ID ) ) { do_action( 'comment_closed', $comment_post_ID ); return new WP_Error( 'comment_closed', __( 'Sorry, comments are closed for this item.' ), 403 ); } elseif ( 'trash' === $status ) { do_action( 'comment_on_trash', $comment_post_ID ); return new WP_Error( 'comment_on_trash' ); } elseif ( ! $status_obj->public && ! $status_obj->private ) { do_action( 'comment_on_draft', $comment_post_ID ); if ( current_user_can( 'read_post', $comment_post_ID ) ) { return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); } else { return new WP_Error( 'comment_on_draft' ); } } elseif ( post_password_required( $comment_post_ID ) ) { do_action( 'comment_on_password_protected', $comment_post_ID ); return new WP_Error( 'comment_on_password_protected' ); } else { do_action( 'pre_comment_on_post', $comment_post_ID ); } $user = wp_get_current_user(); if ( $user->exists() ) { if ( empty( $user->display_name ) ) { $user->display_name = $user->user_login; } $comment_author = $user->display_name; $comment_author_email = $user->user_email; $comment_author_url = $user->user_url; $user_ID = $user->ID; if ( current_user_can( 'unfiltered_html' ) ) { if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] ) || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_ID ) ) { kses_remove_filters(); kses_init_filters(); remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); add_filter( 'pre_comment_content', 'wp_filter_kses' ); } } } else { if ( get_option( 'comment_registration' ) ) { return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 ); } } $comment_type = 'comment'; if ( get_option( 'require_name_email' ) && ! $user->exists() ) { if ( '' == $comment_author_email || '' == $comment_author ) { return new WP_Error( 'require_name_email', __( 'Error: Please fill the required fields.' ), 200 ); } elseif ( ! is_email( $comment_author_email ) ) { return new WP_Error( 'require_valid_email', __( 'Error: Please enter a valid email address.' ), 200 ); } } $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); $allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata ); if ( '' === $comment_content && ! $allow_empty_comment ) { return new WP_Error( 'require_valid_comment', __( 'Error: Please type your comment text.' ), 200 ); } $check_max_lengths = wp_check_comment_data_max_lengths( $commentdata ); if ( is_wp_error( $check_max_lengths ) ) { return $check_max_lengths; } $comment_id = wp_new_comment( wp_slash( $commentdata ), true ); if ( is_wp_error( $comment_id ) ) { return $comment_id; } if ( ! $comment_id ) { return new WP_Error( 'comment_save_error', __( 'Error: The comment could not be saved. Please try again later.' ), 500 ); } return get_comment( $comment_id ); } function wp_register_comment_personal_data_exporter( $exporters ) { $exporters['wordpress-comments'] = array( 'exporter_friendly_name' => __( 'WordPress Comments' ), 'callback' => 'wp_comments_personal_data_exporter', ); return $exporters; } function wp_comments_personal_data_exporter( $email_address, $page = 1 ) { $number = 500; $page = (int) $page; $data_to_export = array(); $comments = get_comments( array( 'author_email' => $email_address, 'number' => $number, 'paged' => $page, 'order_by' => 'comment_ID', 'order' => 'ASC', 'update_comment_meta_cache' => false, ) ); $comment_prop_to_export = array( 'comment_author' => __( 'Comment Author' ), 'comment_author_email' => __( 'Comment Author Email' ), 'comment_author_url' => __( 'Comment Author URL' ), 'comment_author_IP' => __( 'Comment Author IP' ), 'comment_agent' => __( 'Comment Author User Agent' ), 'comment_date' => __( 'Comment Date' ), 'comment_content' => __( 'Comment Content' ), 'comment_link' => __( 'Comment URL' ), ); foreach ( (array) $comments as $comment ) { $comment_data_to_export = array(); foreach ( $comment_prop_to_export as $key => $name ) { $value = ''; switch ( $key ) { case 'comment_author': case 'comment_author_email': case 'comment_author_url': case 'comment_author_IP': case 'comment_agent': case 'comment_date': $value = $comment->{$key}; break; case 'comment_content': $value = get_comment_text( $comment->comment_ID ); break; case 'comment_link': $value = get_comment_link( $comment->comment_ID ); $value = sprintf( '%s', esc_url( $value ), esc_html( $value ) ); break; } if ( ! empty( $value ) ) { $comment_data_to_export[] = array( 'name' => $name, 'value' => $value, ); } } $data_to_export[] = array( 'group_id' => 'comments', 'group_label' => __( 'Comments' ), 'group_description' => __( 'User’s comment data.' ), 'item_id' => "comment-{$comment->comment_ID}", 'data' => $comment_data_to_export, ); } $done = count( $comments ) < $number; return array( 'data' => $data_to_export, 'done' => $done, ); } function wp_register_comment_personal_data_eraser( $erasers ) { $erasers['wordpress-comments'] = array( 'eraser_friendly_name' => __( 'WordPress Comments' ), 'callback' => 'wp_comments_personal_data_eraser', ); return $erasers; } function wp_comments_personal_data_eraser( $email_address, $page = 1 ) { global $wpdb; if ( empty( $email_address ) ) { return array( 'items_removed' => false, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } $number = 500; $page = (int) $page; $items_removed = false; $items_retained = false; $comments = get_comments( array( 'author_email' => $email_address, 'number' => $number, 'paged' => $page, 'order_by' => 'comment_ID', 'order' => 'ASC', 'include_unapproved' => true, ) ); $anon_author = __( 'Anonymous' ); $messages = array(); foreach ( (array) $comments as $comment ) { $anonymized_comment = array(); $anonymized_comment['comment_agent'] = ''; $anonymized_comment['comment_author'] = $anon_author; $anonymized_comment['comment_author_email'] = ''; $anonymized_comment['comment_author_IP'] = wp_privacy_anonymize_data( 'ip', $comment->comment_author_IP ); $anonymized_comment['comment_author_url'] = ''; $anonymized_comment['user_id'] = 0; $comment_id = (int) $comment->comment_ID; $anon_message = apply_filters( 'wp_anonymize_comment', true, $comment, $anonymized_comment ); if ( true !== $anon_message ) { if ( $anon_message && is_string( $anon_message ) ) { $messages[] = esc_html( $anon_message ); } else { $messages[] = sprintf( __( 'Comment %d contains personal data but could not be anonymized.' ), $comment_id ); } $items_retained = true; continue; } $args = array( 'comment_ID' => $comment_id, ); $updated = $wpdb->update( $wpdb->comments, $anonymized_comment, $args ); if ( $updated ) { $items_removed = true; clean_comment_cache( $comment_id ); } else { $items_retained = true; } } $done = count( $comments ) < $number; return array( 'items_removed' => $items_removed, 'items_retained' => $items_retained, 'messages' => $messages, 'done' => $done, ); } function wp_cache_set_comments_last_changed() { wp_cache_set( 'last_changed', microtime(), 'comment' ); } function _wp_batch_update_comment_type() { global $wpdb; $lock_name = 'update_comment_type.lock'; $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); if ( ! $lock_result ) { $lock_result = get_option( $lock_name ); if ( ! $lock_result || ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) ) { wp_schedule_single_event( time() + ( 5 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); return; } } update_option( $lock_name, time() ); $empty_comment_type = $wpdb->get_var( "SELECT comment_ID FROM $wpdb->comments - WHERE comment_type = '' - LIMIT 1" ); if ( ! $empty_comment_type ) { update_option( 'finished_updating_comment_type', true ); delete_option( $lock_name ); return; } wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); $comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID - FROM {$wpdb->comments} - WHERE comment_type = '' - ORDER BY comment_ID DESC - LIMIT %d", $comment_batch_size ) ); if ( $comment_ids ) { $comment_id_list = implode( ',', $comment_ids ); $wpdb->query( "UPDATE {$wpdb->comments} - SET comment_type = 'comment' - WHERE comment_type = '' - AND comment_ID IN ({$comment_id_list})" ); clean_comment_cache( $comment_ids ); } delete_option( $lock_name ); } function _wp_check_for_scheduled_update_comment_type() { if ( ! get_option( 'finished_updating_comment_type' ) && ! wp_next_scheduled( 'wp_update_comment_type_batch' ) ) { wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_update_comment_type_batch' ); } } user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httprequest($path, $fp, $URI, $this->_httpmethod); } $this->_disconnect($fp); if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { $this->_httpsrequest($URI,$URI,$this->_httpmethod); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httpsrequest($path, $URI, $this->_httpmethod); } if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; $this->fetch($this->_redirectaddr); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } function submit($URI, $formvars="", $formfiles="") { unset($postdata); $postdata = $this->_prepare_post_body($formvars, $formfiles); $URI_PARTS = parse_url($URI); if (!empty($URI_PARTS["user"])) $this->user = $URI_PARTS["user"]; if (!empty($URI_PARTS["pass"])) $this->pass = $URI_PARTS["pass"]; if (empty($URI_PARTS["query"])) $URI_PARTS["query"] = ''; if (empty($URI_PARTS["path"])) $URI_PARTS["path"] = ''; switch(strtolower($URI_PARTS["scheme"])) { case "http": $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_connect($fp)) { if($this->_isproxy) { $this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); } $this->_disconnect($fp); if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } } else { return false; } return true; break; case "https": if(!$this->curl_path) return false; if(function_exists("is_executable")) if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; if(!empty($URI_PARTS["port"])) $this->port = $URI_PARTS["port"]; if($this->_isproxy) { $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); } else { $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); $this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata); } if($this->_redirectaddr) { if($this->maxredirs > $this->_redirectdepth) { if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) { $this->_redirectdepth++; $this->lastredirectaddr=$this->_redirectaddr; if( strpos( $this->_redirectaddr, "?" ) > 0 ) $this->fetch($this->_redirectaddr); else $this->submit($this->_redirectaddr,$formvars, $formfiles); } } } if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0) { $frameurls = $this->_frameurls; $this->_frameurls = array(); foreach ( $frameurls as $frameurl ) { if($this->_framedepth < $this->maxframes) { $this->fetch($frameurl); $this->_framedepth++; } else break; } } return true; break; default: $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; return false; break; } return true; } function fetchlinks($URI) { if ($this->fetch($URI)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striplinks($this->results[$x]); } else $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results, $URI); return true; } else return false; } function fetchform($URI) { if ($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_stripform($this->results[$x]); } else $this->results = $this->_stripform($this->results); return true; } else return false; } function fetchtext($URI) { if($this->fetch($URI)) { if(is_array($this->results)) { for($x=0;$xresults);$x++) $this->results[$x] = $this->_striptext($this->results[$x]); } else $this->results = $this->_striptext($this->results); return true; } else return false; } function submitlinks($URI, $formvars="", $formfiles="") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striplinks($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striplinks($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } function submittext($URI, $formvars = "", $formfiles = "") { if($this->submit($URI,$formvars, $formfiles)) { if($this->lastredirectaddr) $URI = $this->lastredirectaddr; if(is_array($this->results)) { for($x=0;$xresults);$x++) { $this->results[$x] = $this->_striptext($this->results[$x]); if($this->expandlinks) $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); } } else { $this->results = $this->_striptext($this->results); if($this->expandlinks) $this->results = $this->_expandlinks($this->results,$URI); } return true; } else return false; } function set_submit_multipart() { $this->_submit_type = "multipart/form-data"; } function set_submit_normal() { $this->_submit_type = "application/x-www-form-urlencoded"; } function _striplinks($document) { preg_match_all("'<\s*a\s.*?href\s*=\s* # find ]+)) # if quote found, match up to next matching - # quote, otherwise match up to next space - 'isx",$document,$links); foreach ( $links[2] as $key => $val ) { if(!empty($val)) $match[] = $val; } foreach ( $links[3] as $key => $val ) { if(!empty($val)) $match[] = $val; } return $match; } function _stripform($document) { preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); $match = implode("\r\n",$elements[0]); return $match; } function _striptext($document) { $search = array("']*?>.*?'si", "'<[\/\!]*?[^<>]*?>'si", "'([\r\n])[\s]+'", "'&(quot|#34|#034|#x22);'i", "'&(amp|#38|#038|#x26);'i", "'&(lt|#60|#060|#x3c);'i", "'&(gt|#62|#062|#x3e);'i", "'&(nbsp|#160|#xa0);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&(reg|#174);'i", "'&(deg|#176);'i", "'&(#39|#039|#x27);'", "'&(euro|#8364);'i", "'&a(uml|UML);'", "'&o(uml|UML);'", "'&u(uml|UML);'", "'&A(uml|UML);'", "'&O(uml|UML);'", "'&U(uml|UML);'", "'ß'i", ); $replace = array( "", "", "\\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), chr(174), chr(176), chr(39), chr(128), chr(0xE4), chr(0xF6), chr(0xFC), chr(0xC4), chr(0xD6), chr(0xDC), chr(0xDF), ); $text = preg_replace($search,$replace,$document); return $text; } function _expandlinks($links,$URI) { preg_match("/^[^\?]+/",$URI,$match); $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); $match = preg_replace("|/$|","",$match); $match_part = parse_url($match); $match_root = $match_part["scheme"]."://".$match_part["host"]; $search = array( "|^http://".preg_quote($this->host)."|i", "|^(\/)|i", "|^(?!http://)(?!mailto:)|i", "|/\./|", "|/[^\/]+/\.\./|" ); $replace = array( "", $match_root."/", $match."/", "/", "/" ); $expandedLinks = preg_replace($search,$replace,$links); return $expandedLinks; } function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") { $cookie_headers = ''; if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; if(!empty($this->agent)) $headers .= "User-Agent: ".$this->agent."\r\n"; if(!empty($this->host) && !isset($this->rawheaders['Host'])) { $headers .= "Host: ".$this->host; if(!empty($this->port) && $this->port != 80) $headers .= ":".$this->port; $headers .= "\r\n"; } if(!empty($this->accept)) $headers .= "Accept: ".$this->accept."\r\n"; if(!empty($this->referer)) $headers .= "Referer: ".$this->referer."\r\n"; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_headers .= 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers .= substr($cookie_headers,0,-2) . "\r\n"; } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; foreach ( $this->rawheaders as $headerKey => $headerVal ) $headers .= $headerKey.": ".$headerVal."\r\n"; } if(!empty($content_type)) { $headers .= "Content-type: $content_type"; if ($content_type == "multipart/form-data") $headers .= "; boundary=".$this->_mime_boundary; $headers .= "\r\n"; } if(!empty($body)) $headers .= "Content-length: ".strlen($body)."\r\n"; if(!empty($this->user) || !empty($this->pass)) $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; if(!empty($this->proxy_user)) $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; $headers .= "\r\n"; if ($this->read_timeout > 0) socket_set_timeout($fp, $this->read_timeout); $this->timed_out = false; fwrite($fp,$headers.$body,strlen($headers.$body)); $this->_redirectaddr = false; unset($this->headers); while($currentHeader = fgets($fp,$this->_maxlinelen)) { if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } if($currentHeader == "\r\n") break; if(preg_match("/^(Location:|URI:)/i",$currentHeader)) { preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches); if(!preg_match("|\:\/\/|",$matches[2])) { $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$currentHeader)) { if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) { $this->status= $status[1]; } $this->response_code = $currentHeader; } $this->headers[] = $currentHeader; } $results = ''; do { $_data = fread($fp, $this->maxlength); if (strlen($_data) == 0) { break; } $results .= $_data; } while(true); if ($this->read_timeout > 0 && $this->_check_timeout($fp)) { $this->status=-100; return false; } if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } elseif(is_array($this->results)) $this->results[] = $results; else $this->results = $results; return true; } function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") { if($this->passcookies && $this->_redirectaddr) $this->setcookies(); $headers = array(); $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; if(!empty($this->agent)) $headers[] = "User-Agent: ".$this->agent; if(!empty($this->host)) if(!empty($this->port)) $headers[] = "Host: ".$this->host.":".$this->port; else $headers[] = "Host: ".$this->host; if(!empty($this->accept)) $headers[] = "Accept: ".$this->accept; if(!empty($this->referer)) $headers[] = "Referer: ".$this->referer; if(!empty($this->cookies)) { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_str = 'Cookie: '; foreach ( $this->cookies as $cookieKey => $cookieVal ) { $cookie_str .= $cookieKey."=".urlencode($cookieVal)."; "; } $headers[] = substr($cookie_str,0,-2); } } if(!empty($this->rawheaders)) { if(!is_array($this->rawheaders)) $this->rawheaders = (array)$this->rawheaders; foreach ( $this->rawheaders as $headerKey => $headerVal ) $headers[] = $headerKey.": ".$headerVal; } if(!empty($content_type)) { if ($content_type == "multipart/form-data") $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; else $headers[] = "Content-type: $content_type"; } if(!empty($body)) $headers[] = "Content-length: ".strlen($body); if(!empty($this->user) || !empty($this->pass)) $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); $headerfile = tempnam( $this->temp_dir, "sno" ); $cmdline_params = '-k -D ' . escapeshellarg( $headerfile ); foreach ( $headers as $header ) { $cmdline_params .= ' -H ' . escapeshellarg( $header ); } if ( ! empty( $body ) ) { $cmdline_params .= ' -d ' . escapeshellarg( $body ); } if ( $this->read_timeout > 0 ) { $cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout ); } exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return ); if($return) { $this->error = "Error: cURL could not retrieve the document, error $return."; return false; } $results = implode("\r\n",$results); $result_headers = file("$headerfile"); $this->_redirectaddr = false; unset($this->headers); for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) { if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) { preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches); if(!preg_match("|\:\/\/|",$matches[2])) { $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; else $this->_redirectaddr .= $matches[2]; } else $this->_redirectaddr = $matches[2]; } if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) $this->response_code = $result_headers[$currentHeader]; $this->headers[] = $result_headers[$currentHeader]; } if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) { $this->_redirectaddr = $this->_expandlinks($match[1],$URI); } if(($this->_framedepth < $this->maxframes) && preg_match_all("']+)'i",$results,$match)) { $this->results[] = $results; for($x=0; $x_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); } elseif(is_array($this->results)) $this->results[] = $results; else $this->results = $results; unlink("$headerfile"); return true; } function setcookies() { for($x=0; $xheaders); $x++) { if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) $this->cookies[$match[1]] = urldecode($match[2]); } } function _check_timeout($fp) { if ($this->read_timeout > 0) { $fp_status = socket_get_status($fp); if ($fp_status["timed_out"]) { $this->timed_out = true; return true; } } return false; } function _connect(&$fp) { if(!empty($this->proxy_host) && !empty($this->proxy_port)) { $this->_isproxy = true; $host = $this->proxy_host; $port = $this->proxy_port; } else { $host = $this->host; $port = $this->port; } $this->status = 0; if($fp = fsockopen( $host, $port, $errno, $errstr, $this->_fp_timeout )) { return true; } else { $this->status = $errno; switch($errno) { case -3: $this->error="socket creation failed (-3)"; case -4: $this->error="dns lookup failure (-4)"; case -5: $this->error="connection refused or timed out (-5)"; default: $this->error="connection failed (".$errno.")"; } return false; } } function _disconnect($fp) { return(fclose($fp)); } function _prepare_post_body($formvars, $formfiles) { settype($formvars, "array"); settype($formfiles, "array"); $postdata = ''; if (count($formvars) == 0 && count($formfiles) == 0) return; switch ($this->_submit_type) { case "application/x-www-form-urlencoded": reset($formvars); foreach ( $formvars as $key => $val ) { if (is_array($val) || is_object($val)) { foreach ( $val as $cur_key => $cur_val ) { $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; } } else $postdata .= urlencode($key)."=".urlencode($val)."&"; } break; case "multipart/form-data": $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); reset($formvars); foreach ( $formvars as $key => $val ) { if (is_array($val) || is_object($val)) { foreach ( $val as $cur_key => $cur_val ) { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; $postdata .= "$cur_val\r\n"; } } else { $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; $postdata .= "$val\r\n"; } } reset($formfiles); foreach ( $formfiles as $field_name => $file_names ) { settype($file_names, "array"); foreach ( $file_names as $file_name ) { if (!is_readable($file_name)) continue; $fp = fopen($file_name, "r"); $file_content = fread($fp, filesize($file_name)); fclose($fp); $base_name = basename($file_name); $postdata .= "--".$this->_mime_boundary."\r\n"; $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; $postdata .= "$file_content\r\n"; } } $postdata .= "--".$this->_mime_boundary."--\r\n"; break; } return $postdata; } } endif; ?> -taxonomy ) && 'nav_menu' === $menu_obj->taxonomy ) { return true; } return false; } function register_nav_menus( $locations = array() ) { global $_wp_registered_nav_menus; add_theme_support( 'menus' ); foreach ( $locations as $key => $value ) { if ( is_int( $key ) ) { _doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' ); break; } } $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations ); } function unregister_nav_menu( $location ) { global $_wp_registered_nav_menus; if ( is_array( $_wp_registered_nav_menus ) && isset( $_wp_registered_nav_menus[ $location ] ) ) { unset( $_wp_registered_nav_menus[ $location ] ); if ( empty( $_wp_registered_nav_menus ) ) { _remove_theme_support( 'menus' ); } return true; } return false; } function register_nav_menu( $location, $description ) { register_nav_menus( array( $location => $description ) ); } function get_registered_nav_menus() { global $_wp_registered_nav_menus; if ( isset( $_wp_registered_nav_menus ) ) { return $_wp_registered_nav_menus; } return array(); } function get_nav_menu_locations() { $locations = get_theme_mod( 'nav_menu_locations' ); return ( is_array( $locations ) ) ? $locations : array(); } function has_nav_menu( $location ) { $has_nav_menu = false; $registered_nav_menus = get_registered_nav_menus(); if ( isset( $registered_nav_menus[ $location ] ) ) { $locations = get_nav_menu_locations(); $has_nav_menu = ! empty( $locations[ $location ] ); } return apply_filters( 'has_nav_menu', $has_nav_menu, $location ); } function wp_get_nav_menu_name( $location ) { $menu_name = ''; $locations = get_nav_menu_locations(); if ( isset( $locations[ $location ] ) ) { $menu = wp_get_nav_menu_object( $locations[ $location ] ); if ( $menu && $menu->name ) { $menu_name = $menu->name; } } return apply_filters( 'wp_get_nav_menu_name', $menu_name, $location ); } function is_nav_menu_item( $menu_item_id = 0 ) { return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' === get_post_type( $menu_item_id ) ) ); } function wp_create_nav_menu( $menu_name ) { return wp_update_nav_menu_object( 0, array( 'menu-name' => $menu_name ) ); } function wp_delete_nav_menu( $menu ) { $menu = wp_get_nav_menu_object( $menu ); if ( ! $menu ) { return false; } $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' ); if ( ! empty( $menu_objects ) ) { foreach ( $menu_objects as $item ) { wp_delete_post( $item ); } } $result = wp_delete_term( $menu->term_id, 'nav_menu' ); $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { if ( $menu_id == $menu->term_id ) { $locations[ $location ] = 0; } } set_theme_mod( 'nav_menu_locations', $locations ); if ( $result && ! is_wp_error( $result ) ) { do_action( 'wp_delete_nav_menu', $menu->term_id ); } return $result; } function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) { $menu_id = (int) $menu_id; $_menu = wp_get_nav_menu_object( $menu_id ); $args = array( 'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ), 'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ), 'parent' => ( isset( $menu_data['parent'] ) ? (int) $menu_data['parent'] : 0 ), 'slug' => null, ); $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); if ( $_possible_existing && ! is_wp_error( $_possible_existing ) && isset( $_possible_existing->term_id ) && $_possible_existing->term_id != $menu_id ) { return new WP_Error( 'menu_exists', sprintf( __( 'The menu name %s conflicts with another menu name. Please try another.' ), '' . esc_html( $menu_data['menu-name'] ) . '' ) ); } if ( ! $_menu || is_wp_error( $_menu ) ) { $menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); if ( $menu_exists ) { return new WP_Error( 'menu_exists', sprintf( __( 'The menu name %s conflicts with another menu name. Please try another.' ), '' . esc_html( $menu_data['menu-name'] ) . '' ) ); } $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args ); if ( is_wp_error( $_menu ) ) { return $_menu; } do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data ); return (int) $_menu['term_id']; } if ( ! $_menu || ! isset( $_menu->term_id ) ) { return 0; } $menu_id = (int) $_menu->term_id; $update_response = wp_update_term( $menu_id, 'nav_menu', $args ); if ( is_wp_error( $update_response ) ) { return $update_response; } $menu_id = (int) $update_response['term_id']; do_action( 'wp_update_nav_menu', $menu_id, $menu_data ); return $menu_id; } function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array(), $fire_after_hooks = true ) { $menu_id = (int) $menu_id; $menu_item_db_id = (int) $menu_item_db_id; if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) ) { return new WP_Error( 'update_nav_menu_item_failed', __( 'The given object ID is not that of a menu item.' ) ); } $menu = wp_get_nav_menu_object( $menu_id ); if ( ! $menu && 0 !== $menu_id ) { return new WP_Error( 'invalid_menu_id', __( 'Invalid menu ID.' ) ); } if ( is_wp_error( $menu ) ) { return $menu; } $defaults = array( 'menu-item-db-id' => $menu_item_db_id, 'menu-item-object-id' => 0, 'menu-item-object' => '', 'menu-item-parent-id' => 0, 'menu-item-position' => 0, 'menu-item-type' => 'custom', 'menu-item-title' => '', 'menu-item-url' => '', 'menu-item-description' => '', 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => '', 'menu-item-xfn' => '', 'menu-item-status' => '', 'menu-item-post-date' => '', 'menu-item-post-date-gmt' => '', ); $args = wp_parse_args( $menu_item_data, $defaults ); if ( 0 == $menu_id ) { $args['menu-item-position'] = 1; } elseif ( 0 == (int) $args['menu-item-position'] ) { $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); $last_item = array_pop( $menu_items ); $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items ); } $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0; if ( 'custom' === $args['menu-item-type'] ) { $args['menu-item-url'] = trim( $args['menu-item-url'] ); } else { $args['menu-item-url'] = ''; $original_title = ''; if ( 'taxonomy' === $args['menu-item-type'] ) { $original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); } elseif ( 'post_type' === $args['menu-item-type'] ) { $original_object = get_post( $args['menu-item-object-id'] ); $original_parent = (int) $original_object->post_parent; $original_title = $original_object->post_title; } elseif ( 'post_type_archive' === $args['menu-item-type'] ) { $original_object = get_post_type_object( $args['menu-item-object'] ); if ( $original_object ) { $original_title = $original_object->labels->archives; } } if ( wp_unslash( $args['menu-item-title'] ) === wp_specialchars_decode( $original_title ) ) { $args['menu-item-title'] = ''; } if ( '' === $args['menu-item-title'] && '' === $args['menu-item-description'] ) { $args['menu-item-description'] = ' '; } } $post = array( 'menu_order' => $args['menu-item-position'], 'ping_status' => 0, 'post_content' => $args['menu-item-description'], 'post_excerpt' => $args['menu-item-attr-title'], 'post_parent' => $original_parent, 'post_title' => $args['menu-item-title'], 'post_type' => 'nav_menu_item', ); $post_date = wp_resolve_post_date( $args['menu-item-post-date'], $args['menu-item-post-date-gmt'] ); if ( $post_date ) { $post['post_date'] = $post_date; } $update = 0 != $menu_item_db_id; if ( ! $update ) { $post['ID'] = 0; $post['post_status'] = 'publish' === $args['menu-item-status'] ? 'publish' : 'draft'; $menu_item_db_id = wp_insert_post( $post, true, $fire_after_hooks ); if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) ) { return $menu_item_db_id; } do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args ); } if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) ) { $update_terms = wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' ); if ( is_wp_error( $update_terms ) ) { return $update_terms; } } if ( 'custom' === $args['menu-item-type'] ) { $args['menu-item-object-id'] = $menu_item_db_id; $args['menu-item-object'] = 'custom'; } $menu_item_db_id = (int) $menu_item_db_id; update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ( (int) $args['menu-item-parent-id'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ( (int) $args['menu-item-object-id'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) ); update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) ); $args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) ); $args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) ); update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw( $args['menu-item-url'] ) ); if ( 0 == $menu_id ) { update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() ); } elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) ) { delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' ); } if ( $update ) { $post['ID'] = $menu_item_db_id; $post['post_status'] = ( 'draft' === $args['menu-item-status'] ) ? 'draft' : 'publish'; $update_post = wp_update_post( $post, true ); if ( is_wp_error( $update_post ) ) { return $update_post; } } do_action( 'wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args ); return $menu_item_db_id; } function wp_get_nav_menus( $args = array() ) { $defaults = array( 'taxonomy' => 'nav_menu', 'hide_empty' => false, 'orderby' => 'name', ); $args = wp_parse_args( $args, $defaults ); return apply_filters( 'wp_get_nav_menus', get_terms( $args ), $args ); } function _is_valid_nav_menu_item( $item ) { return empty( $item->_invalid ); } function wp_get_nav_menu_items( $menu, $args = array() ) { $menu = wp_get_nav_menu_object( $menu ); if ( ! $menu ) { return false; } static $fetched = array(); if ( ! taxonomy_exists( 'nav_menu' ) ) { return false; } $defaults = array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true, 'tax_query' => array( array( 'taxonomy' => 'nav_menu', 'field' => 'term_taxonomy_id', 'terms' => $menu->term_taxonomy_id, ), ), ); $args = wp_parse_args( $args, $defaults ); if ( $menu->count > 0 ) { $items = get_posts( $args ); } else { $items = array(); } if ( empty( $fetched[ $menu->term_id ] ) ) { $fetched[ $menu->term_id ] = true; $post_ids = array(); $term_ids = array(); foreach ( $items as $item ) { $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true ); $type = get_post_meta( $item->ID, '_menu_item_type', true ); if ( 'post_type' === $type ) { $post_ids[] = (int) $object_id; } elseif ( 'taxonomy' === $type ) { $term_ids[] = (int) $object_id; } } if ( ! empty( $post_ids ) ) { _prime_post_caches( $post_ids, false ); } unset( $post_ids ); if ( ! empty( $term_ids ) ) { _prime_term_caches( $term_ids ); } unset( $term_ids ); } $items = array_map( 'wp_setup_nav_menu_item', $items ); if ( ! is_admin() ) { $items = array_filter( $items, '_is_valid_nav_menu_item' ); } if ( ARRAY_A === $args['output'] ) { $items = wp_list_sort( $items, array( $args['output_key'] => 'ASC', ) ); $i = 1; foreach ( $items as $k => $item ) { $items[ $k ]->{$args['output_key']} = $i++; } } return apply_filters( 'wp_get_nav_menu_items', $items, $menu, $args ); } function wp_setup_nav_menu_item( $menu_item ) { if ( isset( $menu_item->post_type ) ) { if ( 'nav_menu_item' === $menu_item->post_type ) { $menu_item->db_id = (int) $menu_item->ID; $menu_item->menu_item_parent = ! isset( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent; $menu_item->object_id = ! isset( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id; $menu_item->object = ! isset( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object; $menu_item->type = ! isset( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type; if ( 'post_type' === $menu_item->type ) { $object = get_post_type_object( $menu_item->object ); if ( $object ) { $menu_item->type_label = $object->labels->singular_name; if ( function_exists( 'get_post_states' ) ) { $menu_post = get_post( $menu_item->object_id ); $post_states = get_post_states( $menu_post ); if ( $post_states ) { $menu_item->type_label = wp_strip_all_tags( implode( ', ', $post_states ) ); } } } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } if ( 'trash' === get_post_status( $menu_item->object_id ) ) { $menu_item->_invalid = true; } $original_object = get_post( $menu_item->object_id ); if ( $original_object ) { $menu_item->url = get_permalink( $original_object->ID ); $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID ); } else { $menu_item->url = ''; $original_title = ''; $menu_item->_invalid = true; } if ( '' === $original_title ) { $original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id ); } $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title; } elseif ( 'post_type_archive' === $menu_item->type ) { $object = get_post_type_object( $menu_item->object ); if ( $object ) { $menu_item->title = ( '' === $menu_item->post_title ) ? $object->labels->archives : $menu_item->post_title; $post_type_description = $object->description; } else { $post_type_description = ''; $menu_item->_invalid = true; } $menu_item->type_label = __( 'Post Type Archive' ); $post_content = wp_trim_words( $menu_item->post_content, 200 ); $post_type_description = ( '' === $post_content ) ? $post_type_description : $post_content; $menu_item->url = get_post_type_archive_link( $menu_item->object ); } elseif ( 'taxonomy' === $menu_item->type ) { $object = get_taxonomy( $menu_item->object ); if ( $object ) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); if ( $original_object && ! is_wp_error( $original_object ) ) { $menu_item->url = get_term_link( (int) $menu_item->object_id, $menu_item->object ); $original_title = $original_object->name; } else { $menu_item->url = ''; $original_title = ''; $menu_item->_invalid = true; } if ( '' === $original_title ) { $original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id ); } $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title; } else { $menu_item->type_label = __( 'Custom Link' ); $menu_item->title = $menu_item->post_title; $menu_item->url = ! isset( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url; } $menu_item->target = ! isset( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target; $menu_item->attr_title = ! isset( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title; if ( ! isset( $menu_item->description ) ) { $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) ); } $menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes; $menu_item->xfn = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn; } else { $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->ID; $menu_item->type = 'post_type'; $object = get_post_type_object( $menu_item->post_type ); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; if ( '' === $menu_item->post_title ) { $menu_item->post_title = sprintf( __( '#%d (no title)' ), $menu_item->ID ); } $menu_item->title = $menu_item->post_title; $menu_item->url = get_permalink( $menu_item->ID ); $menu_item->target = ''; $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' ); $menu_item->description = apply_filters( 'nav_menu_description', '' ); $menu_item->classes = array(); $menu_item->xfn = ''; } } elseif ( isset( $menu_item->taxonomy ) ) { $menu_item->ID = $menu_item->term_id; $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->term_id; $menu_item->post_parent = (int) $menu_item->parent; $menu_item->type = 'taxonomy'; $object = get_taxonomy( $menu_item->taxonomy ); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; $menu_item->title = $menu_item->name; $menu_item->url = get_term_link( $menu_item, $menu_item->taxonomy ); $menu_item->target = ''; $menu_item->attr_title = ''; $menu_item->description = get_term_field( 'description', $menu_item->term_id, $menu_item->taxonomy ); $menu_item->classes = array(); $menu_item->xfn = ''; } return apply_filters( 'wp_setup_nav_menu_item', $menu_item ); } function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) { $object_id = (int) $object_id; $menu_item_ids = array(); $query = new WP_Query; $menu_items = $query->query( array( 'meta_key' => '_menu_item_object_id', 'meta_value' => $object_id, 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'posts_per_page' => -1, ) ); foreach ( (array) $menu_items as $menu_item ) { if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) { $menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true ); if ( 'post_type' === $object_type && 'post_type' === $menu_item_type ) { $menu_item_ids[] = (int) $menu_item->ID; } elseif ( 'taxonomy' === $object_type && 'taxonomy' === $menu_item_type && get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy ) { $menu_item_ids[] = (int) $menu_item->ID; } } } return array_unique( $menu_item_ids ); } function _wp_delete_post_menu_item( $object_id ) { $object_id = (int) $object_id; $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' ); foreach ( (array) $menu_item_ids as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function _wp_delete_tax_menu_item( $object_id, $tt_id, $taxonomy ) { $object_id = (int) $object_id; $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); foreach ( (array) $menu_item_ids as $menu_item_id ) { wp_delete_post( $menu_item_id, true ); } } function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) { if ( 'publish' !== $new_status || 'publish' === $old_status || 'page' !== $post->post_type ) { return; } if ( ! empty( $post->post_parent ) ) { return; } $auto_add = get_option( 'nav_menu_options' ); if ( empty( $auto_add ) || ! is_array( $auto_add ) || ! isset( $auto_add['auto_add'] ) ) { return; } $auto_add = $auto_add['auto_add']; if ( empty( $auto_add ) || ! is_array( $auto_add ) ) { return; } $args = array( 'menu-item-object-id' => $post->ID, 'menu-item-object' => $post->post_type, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish', ); foreach ( $auto_add as $menu_id ) { $items = wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); if ( ! is_array( $items ) ) { continue; } foreach ( $items as $item ) { if ( $post->ID == $item->object_id ) { continue 2; } } wp_update_nav_menu_item( $menu_id, 0, $args ); } } function _wp_delete_customize_changeset_dependent_auto_drafts( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'customize_changeset' !== $post->post_type ) { return; } $data = json_decode( $post->post_content, true ); if ( empty( $data['nav_menus_created_posts']['value'] ) ) { return; } remove_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); foreach ( $data['nav_menus_created_posts']['value'] as $stub_post_id ) { if ( empty( $stub_post_id ) ) { continue; } if ( 'auto-draft' === get_post_status( $stub_post_id ) ) { wp_delete_post( $stub_post_id, true ); } elseif ( 'draft' === get_post_status( $stub_post_id ) ) { wp_trash_post( $stub_post_id ); delete_post_meta( $stub_post_id, '_customize_changeset_uuid' ); } } add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); } function _wp_menus_changed() { $old_nav_menu_locations = get_option( 'theme_switch_menu_locations', array() ); $new_nav_menu_locations = get_nav_menu_locations(); $mapped_nav_menu_locations = wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ); set_theme_mod( 'nav_menu_locations', $mapped_nav_menu_locations ); delete_option( 'theme_switch_menu_locations' ); } function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locations ) { $registered_nav_menus = get_registered_nav_menus(); $new_nav_menu_locations = array_intersect_key( $new_nav_menu_locations, $registered_nav_menus ); if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } if ( 1 === count( $old_nav_menu_locations ) && 1 === count( $registered_nav_menus ) ) { $new_nav_menu_locations[ key( $registered_nav_menus ) ] = array_pop( $old_nav_menu_locations ); return $new_nav_menu_locations; } $old_locations = array_keys( $old_nav_menu_locations ); foreach ( $registered_nav_menus as $location => $name ) { if ( in_array( $location, $old_locations, true ) ) { $new_nav_menu_locations[ $location ] = $old_nav_menu_locations[ $location ]; unset( $old_nav_menu_locations[ $location ] ); } } if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } $common_slug_groups = array( array( 'primary', 'menu-1', 'main', 'header', 'navigation', 'top' ), array( 'secondary', 'menu-2', 'footer', 'subsidiary', 'bottom' ), array( 'social' ), ); foreach ( $common_slug_groups as $slug_group ) { foreach ( $slug_group as $slug ) { foreach ( $registered_nav_menus as $new_location => $name ) { if ( is_string( $new_location ) && false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) { continue; } elseif ( is_numeric( $new_location ) && $new_location !== $slug ) { continue; } foreach ( $old_nav_menu_locations as $location => $menu_id ) { foreach ( $slug_group as $slug ) { if ( is_string( $location ) && false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) { continue; } elseif ( is_numeric( $location ) && $location !== $slug ) { continue; } if ( ! empty( $old_nav_menu_locations[ $location ] ) ) { $new_nav_menu_locations[ $new_location ] = $old_nav_menu_locations[ $location ]; unset( $old_nav_menu_locations[ $location ] ); continue 3; } } } } } } return $new_nav_menu_locations; } - - -<# var w_rule = '', classes = [], - w, h, settings = wp.media.view.settings, - isYouTube = isVimeo = false; - - if ( ! _.isEmpty( data.model.src ) ) { - isYouTube = data.model.src.match(/youtube|youtu\.be/); - isVimeo = -1 !== data.model.src.indexOf('vimeo'); - } - - if ( settings.contentWidth && data.model.width >= settings.contentWidth ) { - w = settings.contentWidth; - } else { - w = data.model.width; - } - - if ( w !== data.model.width ) { - h = Math.ceil( ( data.model.height * w ) / data.model.width ); - } else { - h = data.model.height; - } - - if ( w ) { - w_rule = 'width: ' + w + 'px; '; - } - - if ( isYouTube ) { - classes.push( 'youtube-video' ); - } - - if ( isVimeo ) { - classes.push( 'vimeo-video' ); - } - -#> -
                - -
                - Learn how to describe the purpose of the image%3$s
                . Leave empty if the image is purely decorative.' ), esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), 'target="_blank" rel="noopener"', sprintf( ' %s', __( '(opens in a new tab)' ) ) ); ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0, 'show_description' => 0, 'show_images' => 1, 'show_name' => 0, 'before' => '
              • ', 'after' => '
              • ', 'between' => "\n", 'show_rating' => 0, 'link_before' => '', 'link_after' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); $output = ''; foreach ( (array) $bookmarks as $bookmark ) { if ( ! isset( $bookmark->recently_updated ) ) { $bookmark->recently_updated = false; } $output .= $parsed_args['before']; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= ''; } $the_link = '#'; if ( ! empty( $bookmark->link_url ) ) { $the_link = esc_url( $bookmark->link_url ); } $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) ); $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); $title = $desc; if ( $parsed_args['show_updated'] ) { if ( '00' !== substr( $bookmark->link_updated_f, 0, 2 ) ) { $title .= ' ('; $title .= sprintf( __( 'Last updated: %s' ), gmdate( get_option( 'links_updated_date_format' ), $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ); $title .= ')'; } } $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"'; if ( '' !== $title ) { $title = ' title="' . $title . '"'; } $rel = $bookmark->link_rel; $target = $bookmark->link_target; if ( '' !== $target ) { if ( is_string( $rel ) && '' !== $rel ) { if ( ! str_contains( $rel, 'noopener' ) ) { $rel = trim( $rel ) . ' noopener'; } } else { $rel = 'noopener'; } $target = ' target="' . $target . '"'; } if ( '' !== $rel ) { $rel = ' rel="' . esc_attr( $rel ) . '"'; } $output .= ''; $output .= $parsed_args['link_before']; if ( null != $bookmark->link_image && $parsed_args['show_images'] ) { if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { $output .= "link_image\" $alt $title />"; } else { $output .= 'link_image\" $alt $title />"; } if ( $parsed_args['show_name'] ) { $output .= " $name"; } } else { $output .= $name; } $output .= $parsed_args['link_after']; $output .= ''; if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { $output .= ''; } if ( $parsed_args['show_description'] && '' !== $desc ) { $output .= $parsed_args['between'] . $desc; } if ( $parsed_args['show_rating'] ) { $output .= $parsed_args['between'] . sanitize_bookmark_field( 'link_rating', $bookmark->link_rating, $bookmark->link_id, 'display' ); } $output .= $parsed_args['after'] . "\n"; } return $output; } function wp_list_bookmarks( $args = '' ) { $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 'exclude_category' => '', 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 'categorize' => 1, 'title_li' => __( 'Bookmarks' ), 'title_before' => '

                ', 'title_after' => '

                ', 'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat', 'category_before' => '
              • ', 'category_after' => '
              • ', ); $parsed_args = wp_parse_args( $args, $defaults ); $output = ''; if ( ! is_array( $parsed_args['class'] ) ) { $parsed_args['class'] = explode( ' ', $parsed_args['class'] ); } $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] ); $parsed_args['class'] = trim( implode( ' ', $parsed_args['class'] ) ); if ( $parsed_args['categorize'] ) { $cats = get_terms( array( 'taxonomy' => 'link_category', 'name__like' => $parsed_args['category_name'], 'include' => $parsed_args['category'], 'exclude' => $parsed_args['exclude_category'], 'orderby' => $parsed_args['category_orderby'], 'order' => $parsed_args['category_order'], 'hierarchical' => 0, ) ); if ( empty( $cats ) ) { $parsed_args['categorize'] = false; } } if ( $parsed_args['categorize'] ) { foreach ( (array) $cats as $cat ) { $params = array_merge( $parsed_args, array( 'category' => $cat->term_id ) ); $bookmarks = get_bookmarks( $params ); if ( empty( $bookmarks ) ) { continue; } $output .= str_replace( array( '%id', '%class' ), array( "linkcat-$cat->term_id", $parsed_args['class'] ), $parsed_args['category_before'] ); $catname = apply_filters( 'link_category', $cat->name ); $output .= $parsed_args['title_before']; $output .= $catname; $output .= $parsed_args['title_after']; $output .= "\n\t
                  \n"; $output .= _walk_bookmarks( $bookmarks, $parsed_args ); $output .= "\n\t
                \n"; $output .= $parsed_args['category_after'] . "\n"; } } else { $bookmarks = get_bookmarks( $parsed_args ); if ( ! empty( $bookmarks ) ) { if ( ! empty( $parsed_args['title_li'] ) ) { $output .= str_replace( array( '%id', '%class' ), array( 'linkcat-' . $parsed_args['category'], $parsed_args['class'] ), $parsed_args['category_before'] ); $output .= $parsed_args['title_before']; $output .= $parsed_args['title_li']; $output .= $parsed_args['title_after']; $output .= "\n\t
                  \n"; $output .= _walk_bookmarks( $bookmarks, $parsed_args ); $output .= "\n\t
                \n"; $output .= $parsed_args['category_after'] . "\n"; } else { $output .= _walk_bookmarks( $bookmarks, $parsed_args ); } } } $html = apply_filters( 'wp_list_bookmarks', $output ); if ( $parsed_args['echo'] ) { echo $html; } else { return $html; } } 'menu_item_parent', 'id' => 'db_id', ); public function start_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $classes = array( 'sub-menu' ); $class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $output .= "{$n}{$indent}{$n}"; } public function end_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $output .= "$indent{$n}"; } public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { $menu_item = $data_object; if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; $classes = empty( $menu_item->classes ) ? array() : (array) $menu_item->classes; $classes[] = 'menu-item-' . $menu_item->ID; $args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth ); $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $atts = array(); $atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : ''; $atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : ''; if ( '_blank' === $menu_item->target && empty( $menu_item->xfn ) ) { $atts['rel'] = 'noopener'; } else { $atts['rel'] = $menu_item->xfn; } $atts['href'] = ! empty( $menu_item->url ) ? $menu_item->url : ''; $atts['aria-current'] = $menu_item->current ? 'page' : ''; $atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( is_scalar( $value ) && '' !== $value && false !== $value ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID ); $title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth ); $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args ); } public function end_el( &$output, $data_object, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $output .= "{$n}"; } } link_service = $link_service; } public function maybe_send_recovery_mode_email( $rate_limit, $error, $extension ) { $last_sent = get_option( self::RATE_LIMIT_OPTION ); if ( ! $last_sent || time() > $last_sent + $rate_limit ) { if ( ! update_option( self::RATE_LIMIT_OPTION, time() ) ) { return new WP_Error( 'storage_error', __( 'Could not update the email last sent time.' ) ); } $sent = $this->send_recovery_mode_email( $rate_limit, $error, $extension ); if ( $sent ) { return true; } return new WP_Error( 'email_failed', sprintf( __( 'The email could not be sent. Possible reason: your host may have disabled the %s function.' ), 'mail()' ) ); } $err_message = sprintf( __( 'A recovery link was already sent %1$s ago. Please wait another %2$s before requesting a new email.' ), human_time_diff( $last_sent ), human_time_diff( $last_sent + $rate_limit ) ); return new WP_Error( 'email_sent_already', $err_message ); } public function clear_rate_limit() { return delete_option( self::RATE_LIMIT_OPTION ); } private function send_recovery_mode_email( $rate_limit, $error, $extension ) { $url = $this->link_service->generate_url(); $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $switched_locale = false; if ( function_exists( 'switch_to_locale' ) && isset( $GLOBALS['wp_locale_switcher'] ) ) { $switched_locale = switch_to_locale( get_locale() ); } if ( $extension ) { $cause = $this->get_cause( $extension ); $details = wp_strip_all_tags( wp_get_extension_error_description( $error ) ); if ( $details ) { $header = __( 'Error Details' ); $details = "\n\n" . $header . "\n" . str_pad( '', strlen( $header ), '=' ) . "\n" . $details; } } else { $cause = ''; $details = ''; } $support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) ); $debug = apply_filters( 'recovery_email_debug_info', $this->get_debug( $extension ) ); $message = __( 'Howdy! - -Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email. -###CAUSE### -First, visit your website (###SITEURL###) and check for any visible issues. Next, visit the page where the error was caught (###PAGEURL###) and check for any visible issues. - -###SUPPORT### - -If your site appears broken and you can\'t access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further. - -###LINK### - -To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires. - -When seeking help with this issue, you may be asked for some of the following information: -###DEBUG### - -###DETAILS###' ); $message = str_replace( array( '###LINK###', '###EXPIRES###', '###CAUSE###', '###DETAILS###', '###SITEURL###', '###PAGEURL###', '###SUPPORT###', '###DEBUG###', ), array( $url, human_time_diff( time() + $rate_limit ), $cause ? "\n{$cause}\n" : "\n", $details, home_url( '/' ), home_url( $_SERVER['REQUEST_URI'] ), $support, implode( "\r\n", $debug ), ), $message ); $email = array( 'to' => $this->get_recovery_mode_email_address(), 'subject' => __( '[%s] Your Site is Experiencing a Technical Issue' ), 'message' => $message, 'headers' => '', 'attachments' => '', ); $email = apply_filters( 'recovery_mode_email', $email, $url ); $sent = wp_mail( $email['to'], wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ), $email['message'], $email['headers'], $email['attachments'] ); if ( $switched_locale ) { restore_previous_locale(); } return $sent; } private function get_recovery_mode_email_address() { if ( defined( 'RECOVERY_MODE_EMAIL' ) && is_email( RECOVERY_MODE_EMAIL ) ) { return RECOVERY_MODE_EMAIL; } return get_option( 'admin_email' ); } private function get_cause( $extension ) { if ( 'plugin' === $extension['type'] ) { $plugin = $this->get_plugin( $extension ); if ( false === $plugin ) { $name = $extension['slug']; } else { $name = $plugin['Name']; } $cause = sprintf( __( 'In this case, WordPress caught an error with one of your plugins, %s.' ), $name ); } else { $theme = wp_get_theme( $extension['slug'] ); $name = $theme->exists() ? $theme->display( 'Name' ) : $extension['slug']; $cause = sprintf( __( 'In this case, WordPress caught an error with your theme, %s.' ), $name ); } return $cause; } private function get_plugin( $extension ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) { return $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]; } else { foreach ( $plugins as $file => $plugin_data ) { if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) { return $plugin_data; } } } return false; } private function get_debug( $extension ) { $theme = wp_get_theme(); $wp_version = get_bloginfo( 'version' ); if ( $extension ) { $plugin = $this->get_plugin( $extension ); } else { $plugin = null; } $debug = array( 'wp' => sprintf( __( 'WordPress version %s' ), $wp_version ), 'theme' => sprintf( __( 'Active theme: %1$s (version %2$s)' ), $theme->get( 'Name' ), $theme->get( 'Version' ) ), ); if ( null !== $plugin ) { $debug['plugin'] = sprintf( __( 'Current plugin: %1$s (version %2$s)' ), $plugin['Name'], $plugin['Version'] ); } $debug['php'] = sprintf( __( 'PHP version %s' ), PHP_VERSION ); return $debug; } } blocks = $blocks; $this->available_context = $available_context; $this->registry = $registry; } public function offsetExists( $index ) { return isset( $this->blocks[ $index ] ); } public function offsetGet( $index ) { $block = $this->blocks[ $index ]; if ( isset( $block ) && is_array( $block ) ) { $block = new WP_Block( $block, $this->available_context, $this->registry ); $this->blocks[ $index ] = $block; } return $block; } public function offsetSet( $index, $value ) { if ( is_null( $index ) ) { $this->blocks[] = $value; } else { $this->blocks[ $index ] = $value; } } public function offsetUnset( $index ) { unset( $this->blocks[ $index ] ); } public function rewind() { reset( $this->blocks ); } public function current() { return $this->offsetGet( $this->key() ); } public function key() { return key( $this->blocks ); } public function next() { next( $this->blocks ); } public function valid() { return null !== key( $this->blocks ); } public function count() { return count( $this->blocks ); } } get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id ) ); if ( ! $_comment ) { return false; } wp_cache_add( $_comment->comment_ID, $_comment, 'comment' ); } return new WP_Comment( $_comment ); } public function __construct( $comment ) { foreach ( get_object_vars( $comment ) as $key => $value ) { $this->$key = $value; } } public function to_array() { return get_object_vars( $this ); } public function get_children( $args = array() ) { $defaults = array( 'format' => 'tree', 'status' => 'all', 'hierarchical' => 'threaded', 'orderby' => '', ); $_args = wp_parse_args( $args, $defaults ); $_args['parent'] = $this->comment_ID; if ( is_null( $this->children ) ) { if ( $this->populated_children ) { $this->children = array(); } else { $this->children = get_comments( $_args ); } } if ( 'flat' === $_args['format'] ) { $children = array(); foreach ( $this->children as $child ) { $child_args = $_args; $child_args['format'] = 'flat'; unset( $child_args['parent'] ); $children = array_merge( $children, array( $child ), $child->get_children( $child_args ) ); } } else { $children = $this->children; } return $children; } public function add_child( WP_Comment $child ) { $this->children[ $child->comment_ID ] = $child; } public function get_child( $child_id ) { if ( isset( $this->children[ $child_id ] ) ) { return $this->children[ $child_id ]; } return false; } public function populated_children( $set ) { $this->populated_children = (bool) $set; } public function __isset( $name ) { if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) { $post = get_post( $this->comment_post_ID ); return property_exists( $post, $name ); } } public function __get( $name ) { if ( in_array( $name, $this->post_fields, true ) ) { $post = get_post( $this->comment_post_ID ); return $post->$name; } } } '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); public $query_vars; public $query_var_defaults; public $networks; public $found_networks = 0; public $max_num_pages = 0; public function __construct( $query = '' ) { $this->query_var_defaults = array( 'network__in' => '', 'network__not_in' => '', 'count' => false, 'fields' => '', 'number' => '', 'offset' => '', 'no_found_rows' => true, 'orderby' => 'id', 'order' => 'ASC', 'domain' => '', 'domain__in' => '', 'domain__not_in' => '', 'path' => '', 'path__in' => '', 'path__not_in' => '', 'search' => '', 'update_network_cache' => true, ); if ( ! empty( $query ) ) { $this->query( $query ); } } public function parse_query( $query = '' ) { if ( empty( $query ) ) { $query = $this->query_vars; } $this->query_vars = wp_parse_args( $query, $this->query_var_defaults ); do_action_ref_array( 'parse_network_query', array( &$this ) ); } public function query( $query ) { $this->query_vars = wp_parse_args( $query ); return $this->get_networks(); } public function get_networks() { $this->parse_query(); do_action_ref_array( 'pre_get_networks', array( &$this ) ); $network_data = null; $network_data = apply_filters_ref_array( 'networks_pre_query', array( $network_data, &$this ) ); if ( null !== $network_data ) { if ( is_array( $network_data ) && ! $this->query_vars['count'] ) { $this->networks = $network_data; } return $network_data; } $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); unset( $_args['fields'], $_args['update_network_cache'] ); $key = md5( serialize( $_args ) ); $last_changed = wp_cache_get_last_changed( 'networks' ); $cache_key = "get_network_ids:$key:$last_changed"; $cache_value = wp_cache_get( $cache_key, 'networks' ); if ( false === $cache_value ) { $network_ids = $this->get_network_ids(); if ( $network_ids ) { $this->set_found_networks(); } $cache_value = array( 'network_ids' => $network_ids, 'found_networks' => $this->found_networks, ); wp_cache_add( $cache_key, $cache_value, 'networks' ); } else { $network_ids = $cache_value['network_ids']; $this->found_networks = $cache_value['found_networks']; } if ( $this->found_networks && $this->query_vars['number'] ) { $this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] ); } if ( $this->query_vars['count'] ) { return (int) $network_ids; } $network_ids = array_map( 'intval', $network_ids ); if ( 'ids' === $this->query_vars['fields'] ) { $this->networks = $network_ids; return $this->networks; } if ( $this->query_vars['update_network_cache'] ) { _prime_network_caches( $network_ids ); } $_networks = array(); foreach ( $network_ids as $network_id ) { $_network = get_network( $network_id ); if ( $_network ) { $_networks[] = $_network; } } $_networks = apply_filters_ref_array( 'the_networks', array( $_networks, &$this ) ); $this->networks = array_map( 'get_network', $_networks ); return $this->networks; } protected function get_network_ids() { global $wpdb; $order = $this->parse_order( $this->query_vars['order'] ); if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) { $orderby = ''; } elseif ( ! empty( $this->query_vars['orderby'] ) ) { $ordersby = is_array( $this->query_vars['orderby'] ) ? $this->query_vars['orderby'] : preg_split( '/[,\s]/', $this->query_vars['orderby'] ); $orderby_array = array(); foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'network__in' === $_orderby ) { $orderby_array[] = $parsed; continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } $orderby = implode( ', ', $orderby_array ); } else { $orderby = "$wpdb->site.id $order"; } $number = absint( $this->query_vars['number'] ); $offset = absint( $this->query_vars['offset'] ); $limits = ''; if ( ! empty( $number ) ) { if ( $offset ) { $limits = 'LIMIT ' . $offset . ',' . $number; } else { $limits = 'LIMIT ' . $number; } } if ( $this->query_vars['count'] ) { $fields = 'COUNT(*)'; } else { $fields = "$wpdb->site.id"; } if ( ! empty( $this->query_vars['network__in'] ) ) { $this->sql_clauses['where']['network__in'] = "$wpdb->site.id IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['network__in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['network__not_in'] ) ) { $this->sql_clauses['where']['network__not_in'] = "$wpdb->site.id NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['network__not_in'] ) ) . ' )'; } if ( ! empty( $this->query_vars['domain'] ) ) { $this->sql_clauses['where']['domain'] = $wpdb->prepare( "$wpdb->site.domain = %s", $this->query_vars['domain'] ); } if ( is_array( $this->query_vars['domain__in'] ) ) { $this->sql_clauses['where']['domain__in'] = "$wpdb->site.domain IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['domain__not_in'] ) ) { $this->sql_clauses['where']['domain__not_in'] = "$wpdb->site.domain NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['domain__not_in'] ) ) . "' )"; } if ( ! empty( $this->query_vars['path'] ) ) { $this->sql_clauses['where']['path'] = $wpdb->prepare( "$wpdb->site.path = %s", $this->query_vars['path'] ); } if ( is_array( $this->query_vars['path__in'] ) ) { $this->sql_clauses['where']['path__in'] = "$wpdb->site.path IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__in'] ) ) . "' )"; } if ( is_array( $this->query_vars['path__not_in'] ) ) { $this->sql_clauses['where']['path__not_in'] = "$wpdb->site.path NOT IN ( '" . implode( "', '", $wpdb->_escape( $this->query_vars['path__not_in'] ) ) . "' )"; } if ( strlen( $this->query_vars['search'] ) ) { $this->sql_clauses['where']['search'] = $this->get_search_sql( $this->query_vars['search'], array( "$wpdb->site.domain", "$wpdb->site.path" ) ); } $join = ''; $where = implode( ' AND ', $this->sql_clauses['where'] ); $groupby = ''; $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $clauses ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; if ( $where ) { $where = 'WHERE ' . $where; } if ( $groupby ) { $groupby = 'GROUP BY ' . $groupby; } if ( $orderby ) { $orderby = "ORDER BY $orderby"; } $found_rows = ''; if ( ! $this->query_vars['no_found_rows'] ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $this->sql_clauses['select'] = "SELECT $found_rows $fields"; $this->sql_clauses['from'] = "FROM $wpdb->site $join"; $this->sql_clauses['groupby'] = $groupby; $this->sql_clauses['orderby'] = $orderby; $this->sql_clauses['limits'] = $limits; $this->request = " - {$this->sql_clauses['select']} - {$this->sql_clauses['from']} - {$where} - {$this->sql_clauses['groupby']} - {$this->sql_clauses['orderby']} - {$this->sql_clauses['limits']} - "; if ( $this->query_vars['count'] ) { return (int) $wpdb->get_var( $this->request ); } $network_ids = $wpdb->get_col( $this->request ); return array_map( 'intval', $network_ids ); } private function set_found_networks() { global $wpdb; if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) { $found_networks_query = apply_filters( 'found_networks_query', 'SELECT FOUND_ROWS()', $this ); $this->found_networks = (int) $wpdb->get_var( $found_networks_query ); } } protected function get_search_sql( $search, $columns ) { global $wpdb; $like = '%' . $wpdb->esc_like( $search ) . '%'; $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return '(' . implode( ' OR ', $searches ) . ')'; } protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'id', 'domain', 'path', ); $parsed = false; if ( 'network__in' === $orderby ) { $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->site}.id, $network__in )"; } elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) { $field = substr( $orderby, 0, -7 ); $parsed = "CHAR_LENGTH($wpdb->site.$field)"; } elseif ( in_array( $orderby, $allowed_keys, true ) ) { $parsed = "$wpdb->site.$orderby"; } return $parsed; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'ASC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } } array( 'https://www.youtube.com/oembed', true ), '#https?://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://((m|www)\.)?youtube\.com/shorts/*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://youtu\.be/.*#i' => array( 'https://www.youtube.com/oembed', true ), '#https?://(.+\.)?vimeo\.com/.*#i' => array( 'https://vimeo.com/api/oembed.{format}', true ), '#https?://(www\.)?dailymotion\.com/.*#i' => array( 'https://www.dailymotion.com/services/oembed', true ), '#https?://dai\.ly/.*#i' => array( 'https://www.dailymotion.com/services/oembed', true ), '#https?://(www\.)?flickr\.com/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ), '#https?://flic\.kr/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ), '#https?://(.+\.)?smugmug\.com/.*#i' => array( 'https://api.smugmug.com/services/oembed/', true ), '#https?://(www\.)?scribd\.com/(doc|document)/.*#i' => array( 'https://www.scribd.com/services/oembed', true ), '#https?://wordpress\.tv/.*#i' => array( 'https://wordpress.tv/oembed/', true ), '#https?://(.+\.)?polldaddy\.com/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://poll\.fm/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://(.+\.)?survey\.fm/.*#i' => array( 'https://api.crowdsignal.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/status(es)?/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}$#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/likes$#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/lists/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/\w{1,15}/timelines/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?twitter\.com/i/moments/.*#i' => array( 'https://publish.twitter.com/oembed', true ), '#https?://(www\.)?soundcloud\.com/.*#i' => array( 'https://soundcloud.com/oembed', true ), '#https?://(.+?\.)?slideshare\.net/.*#i' => array( 'https://www.slideshare.net/api/oembed/2', true ), '#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ), '#https?://(.+\.)?imgur\.com/.*#i' => array( 'https://api.imgur.com/oembed', true ), '#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'https://issuu.com/oembed_wp', true ), '#https?://(www\.)?mixcloud\.com/.*#i' => array( 'https://www.mixcloud.com/oembed', true ), '#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'https://www.ted.com/services/v1/oembed.{format}', true ), '#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'https://animoto.com/oembeds/create', true ), '#https?://(.+)\.tumblr\.com/post/.*#i' => array( 'https://www.tumblr.com/oembed/1.0', true ), '#https?://(www\.)?kickstarter\.com/projects/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ), '#https?://kck\.st/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ), '#https?://cloudup\.com/.*#i' => array( 'https://cloudup.com/oembed', true ), '#https?://(www\.)?reverbnation\.com/.*#i' => array( 'https://www.reverbnation.com/oembed', true ), '#https?://videopress\.com/v/.*#' => array( 'https://public-api.wordpress.com/oembed/?for=' . $host, true ), '#https?://(www\.)?reddit\.com/r/[^/]+/comments/.*#i' => array( 'https://www.reddit.com/oembed', true ), '#https?://(www\.)?speakerdeck\.com/.*#i' => array( 'https://speakerdeck.com/oembed.{format}', true ), '#https?://(www\.)?screencast\.com/.*#i' => array( 'https://api.screencast.com/external/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(com|com\.mx|com\.br|ca)/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(co\.uk|de|fr|it|es|in|nl|ru)/.*#i' => array( 'https://read.amazon.co.uk/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.(co\.jp|com\.au)/.*#i' => array( 'https://read.amazon.com.au/kp/api/oembed', true ), '#https?://([a-z0-9-]+\.)?amazon\.cn/.*#i' => array( 'https://read.amazon.cn/kp/api/oembed', true ), '#https?://(www\.)?a\.co/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://(www\.)?amzn\.to/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ), '#https?://(www\.)?amzn\.eu/.*#i' => array( 'https://read.amazon.co.uk/kp/api/oembed', true ), '#https?://(www\.)?amzn\.in/.*#i' => array( 'https://read.amazon.in/kp/api/oembed', true ), '#https?://(www\.)?amzn\.asia/.*#i' => array( 'https://read.amazon.com.au/kp/api/oembed', true ), '#https?://(www\.)?z\.cn/.*#i' => array( 'https://read.amazon.cn/kp/api/oembed', true ), '#https?://www\.someecards\.com/.+-cards/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://www\.someecards\.com/usercards/viewcard/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://some\.ly\/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ), '#https?://(www\.)?tiktok\.com/.*/video/.*#i' => array( 'https://www.tiktok.com/oembed', true ), '#https?://([a-z]{2}|www)\.pinterest\.com(\.(au|mx))?/.*#i' => array( 'https://www.pinterest.com/oembed.json', true ), '#https?://(www\.)?wolframcloud\.com/obj/.+#i' => array( 'https://www.wolframcloud.com/oembed', true ), ); if ( ! empty( self::$early_providers['add'] ) ) { foreach ( self::$early_providers['add'] as $format => $data ) { $providers[ $format ] = $data; } } if ( ! empty( self::$early_providers['remove'] ) ) { foreach ( self::$early_providers['remove'] as $format ) { unset( $providers[ $format ] ); } } self::$early_providers = array(); $this->providers = apply_filters( 'oembed_providers', $providers ); add_filter( 'oembed_dataparse', array( $this, '_strip_newlines' ), 10, 3 ); } public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; } public function get_provider( $url, $args = '' ) { $args = wp_parse_args( $args ); $provider = false; if ( ! isset( $args['discover'] ) ) { $args['discover'] = true; } foreach ( $this->providers as $matchmask => $data ) { list( $providerurl, $regex ) = $data; if ( ! $regex ) { $matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; $matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask ); } if ( preg_match( $matchmask, $url ) ) { $provider = str_replace( '{format}', 'json', $providerurl ); break; } } if ( ! $provider && $args['discover'] ) { $provider = $this->discover( $url ); } return $provider; } public static function _add_provider_early( $format, $provider, $regex = false ) { if ( empty( self::$early_providers['add'] ) ) { self::$early_providers['add'] = array(); } self::$early_providers['add'][ $format ] = array( $provider, $regex ); } public static function _remove_provider_early( $format ) { if ( empty( self::$early_providers['remove'] ) ) { self::$early_providers['remove'] = array(); } self::$early_providers['remove'][] = $format; } public function get_data( $url, $args = '' ) { $args = wp_parse_args( $args ); $provider = $this->get_provider( $url, $args ); if ( ! $provider ) { return false; } $data = $this->fetch( $provider, $url, $args ); if ( false === $data ) { return false; } return $data; } public function get_html( $url, $args = '' ) { $pre = apply_filters( 'pre_oembed_result', null, $url, $args ); if ( null !== $pre ) { return $pre; } $data = $this->get_data( $url, $args ); if ( false === $data ) { return false; } return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args ); } public function discover( $url ) { $providers = array(); $args = array( 'limit_response_size' => 153600, ); $args = apply_filters( 'oembed_remote_get_args', $args, $url ); $request = wp_safe_remote_get( $url, $args ); $html = wp_remote_retrieve_body( $request ); if ( $html ) { $linktypes = apply_filters( 'oembed_linktypes', array( 'application/json+oembed' => 'json', 'text/xml+oembed' => 'xml', 'application/xml+oembed' => 'xml', ) ); $html_head_end = stripos( $html, '' ); if ( $html_head_end ) { $html = substr( $html, 0, $html_head_end ); } $tagfound = false; foreach ( $linktypes as $linktype => $format ) { if ( stripos( $html, $linktype ) ) { $tagfound = true; break; } } if ( $tagfound && preg_match_all( '#]+)/?>#iU', $html, $links ) ) { foreach ( $links[1] as $link ) { $atts = shortcode_parse_atts( $link ); if ( ! empty( $atts['type'] ) && ! empty( $linktypes[ $atts['type'] ] ) && ! empty( $atts['href'] ) ) { $providers[ $linktypes[ $atts['type'] ] ] = htmlspecialchars_decode( $atts['href'] ); if ( 'json' === $linktypes[ $atts['type'] ] ) { break; } } } } } if ( ! empty( $providers['json'] ) ) { return $providers['json']; } elseif ( ! empty( $providers['xml'] ) ) { return $providers['xml']; } else { return false; } } public function fetch( $provider, $url, $args = '' ) { $args = wp_parse_args( $args, wp_embed_defaults( $url ) ); $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider ); $provider = add_query_arg( 'maxheight', (int) $args['height'], $provider ); $provider = add_query_arg( 'url', urlencode( $url ), $provider ); $provider = add_query_arg( 'dnt', 1, $provider ); $provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args ); foreach ( array( 'json', 'xml' ) as $format ) { $result = $this->_fetch_with_format( $provider, $format ); if ( is_wp_error( $result ) && 'not-implemented' === $result->get_error_code() ) { continue; } return ( $result && ! is_wp_error( $result ) ) ? $result : false; } return false; } private function _fetch_with_format( $provider_url_with_args, $format ) { $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args ); $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args ); $response = wp_safe_remote_get( $provider_url_with_args, $args ); if ( 501 == wp_remote_retrieve_response_code( $response ) ) { return new WP_Error( 'not-implemented' ); } $body = wp_remote_retrieve_body( $response ); if ( ! $body ) { return false; } $parse_method = "_parse_$format"; return $this->$parse_method( $body ); } private function _parse_json( $response_body ) { $data = json_decode( trim( $response_body ) ); return ( $data && is_object( $data ) ) ? $data : false; } private function _parse_xml( $response_body ) { if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { return false; } if ( PHP_VERSION_ID < 80000 ) { $loader = libxml_disable_entity_loader( true ); } $errors = libxml_use_internal_errors( true ); $return = $this->_parse_xml_body( $response_body ); libxml_use_internal_errors( $errors ); if ( PHP_VERSION_ID < 80000 && isset( $loader ) ) { libxml_disable_entity_loader( $loader ); } return $return; } private function _parse_xml_body( $response_body ) { if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) ) { return false; } $dom = new DOMDocument; $success = $dom->loadXML( $response_body ); if ( ! $success ) { return false; } if ( isset( $dom->doctype ) ) { return false; } foreach ( $dom->childNodes as $child ) { if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType ) { return false; } } $xml = simplexml_import_dom( $dom ); if ( ! $xml ) { return false; } $return = new stdClass; foreach ( $xml as $key => $value ) { $return->$key = (string) $value; } return $return; } public function data2html( $data, $url ) { if ( ! is_object( $data ) || empty( $data->type ) ) { return false; } $return = false; switch ( $data->type ) { case 'photo': if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) ) { break; } if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) ) { break; } $title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : ''; $return = '' . esc_attr( $title ) . ''; break; case 'video': case 'rich': if ( ! empty( $data->html ) && is_string( $data->html ) ) { $return = $data->html; } break; case 'link': if ( ! empty( $data->title ) && is_string( $data->title ) ) { $return = '' . esc_html( $data->title ) . ''; } break; default: $return = false; } return apply_filters( 'oembed_dataparse', $return, $data, $url ); } public function _strip_newlines( $html, $data, $url ) { if ( false === strpos( $html, "\n" ) ) { return $html; } $count = 1; $found = array(); $token = '__PRE__'; $search = array( "\t", "\n", "\r", ' ' ); $replace = array( '__TAB__', '__NL__', '__CR__', '__SPACE__' ); $tokenized = str_replace( $search, $replace, $html ); preg_match_all( '#(]*>.+?)#i', $tokenized, $matches, PREG_SET_ORDER ); foreach ( $matches as $i => $match ) { $tag_html = str_replace( $replace, $search, $match[0] ); $tag_token = $token . $i; $found[ $tag_token ] = $tag_html; $html = str_replace( $tag_html, $tag_token, $html, $count ); } $replaced = str_replace( $replace, $search, $html ); $stripped = str_replace( array( "\r\n", "\n" ), '', $replaced ); $pre = array_values( $found ); $tokens = array_keys( $found ); return str_replace( $tokens, $pre, $stripped ); } } file = $file; } public static function test( $args = array() ) { return false; } public static function supports_mime_type( $mime_type ) { return false; } abstract public function load(); abstract public function save( $destfilename = null, $mime_type = null ); abstract public function resize( $max_w, $max_h, $crop = false ); abstract public function multi_resize( $sizes ); abstract public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ); abstract public function rotate( $angle ); abstract public function flip( $horz, $vert ); abstract public function stream( $mime_type = null ); public function get_size() { return $this->size; } protected function update_size( $width = null, $height = null ) { $this->size = array( 'width' => (int) $width, 'height' => (int) $height, ); return true; } public function get_quality() { if ( ! $this->quality ) { $this->set_quality(); } return $this->quality; } public function set_quality( $quality = null ) { $mime_type = ! empty( $this->output_mime_type ) ? $this->output_mime_type : $this->mime_type; $default_quality = $this->get_default_quality( $mime_type ); if ( null === $quality ) { $quality = apply_filters( 'wp_editor_set_quality', $default_quality, $mime_type ); if ( 'image/jpeg' === $mime_type ) { $quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' ); } if ( $quality < 0 || $quality > 100 ) { $quality = $default_quality; } } if ( 0 === $quality ) { $quality = 1; } if ( ( $quality >= 1 ) && ( $quality <= 100 ) ) { $this->quality = $quality; return true; } else { return new WP_Error( 'invalid_image_quality', __( 'Attempted to set image quality outside of the range [1,100].' ) ); } } protected function get_default_quality( $mime_type ) { switch ( $mime_type ) { case 'image/webp': $quality = 86; break; case 'image/jpeg': default: $quality = $this->default_quality; } return $quality; } protected function get_output_format( $filename = null, $mime_type = null ) { $new_ext = null; if ( $mime_type ) { $new_ext = $this->get_extension( $mime_type ); } if ( $filename ) { $file_ext = strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) ); $file_mime = $this->get_mime_type( $file_ext ); } else { $file_ext = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) ); $file_mime = $this->mime_type; } if ( ! $mime_type || ( $file_mime == $mime_type ) ) { $mime_type = $file_mime; $new_ext = $file_ext; } $output_format = apply_filters( 'image_editor_output_format', array(), $filename, $mime_type ); if ( isset( $output_format[ $mime_type ] ) && $this->supports_mime_type( $output_format[ $mime_type ] ) ) { $mime_type = $output_format[ $mime_type ]; $new_ext = $this->get_extension( $mime_type ); } if ( ! $this->supports_mime_type( $mime_type ) ) { $mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type ); $new_ext = $this->get_extension( $mime_type ); } if ( $filename && $new_ext ) { $dir = pathinfo( $filename, PATHINFO_DIRNAME ); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); $filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}"; } if ( $mime_type && ( $mime_type !== $this->mime_type ) ) { if ( $mime_type !== $this->output_mime_type ) { $this->output_mime_type = $mime_type; $this->set_quality(); } } elseif ( ! empty( $this->output_mime_type ) ) { $this->output_mime_type = null; $this->set_quality(); } return array( $filename, $new_ext, $mime_type ); } public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) { if ( ! $suffix ) { $suffix = $this->get_suffix(); } $dir = pathinfo( $this->file, PATHINFO_DIRNAME ); $ext = pathinfo( $this->file, PATHINFO_EXTENSION ); $name = wp_basename( $this->file, ".$ext" ); $new_ext = strtolower( $extension ? $extension : $ext ); if ( ! is_null( $dest_path ) ) { if ( ! wp_is_stream( $dest_path ) ) { $_dest_path = realpath( $dest_path ); if ( $_dest_path ) { $dir = $_dest_path; } } else { $dir = $dest_path; } } return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}"; } public function get_suffix() { if ( ! $this->get_size() ) { return false; } return "{$this->size['width']}x{$this->size['height']}"; } public function maybe_exif_rotate() { $orientation = null; if ( is_callable( 'exif_read_data' ) && 'image/jpeg' === $this->mime_type ) { $exif_data = @exif_read_data( $this->file ); if ( ! empty( $exif_data['Orientation'] ) ) { $orientation = (int) $exif_data['Orientation']; } } $orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file ); if ( ! $orientation || 1 === $orientation ) { return false; } switch ( $orientation ) { case 2: $result = $this->flip( true, false ); break; case 3: $result = $this->flip( true, true ); break; case 4: $result = $this->flip( false, true ); break; case 5: $result = $this->rotate( 90 ); if ( ! is_wp_error( $result ) ) { $result = $this->flip( false, true ); } break; case 6: $result = $this->rotate( 270 ); break; case 7: $result = $this->rotate( 90 ); if ( ! is_wp_error( $result ) ) { $result = $this->flip( true, false ); } break; case 8: $result = $this->rotate( 90 ); break; } return $result; } protected function make_image( $filename, $callback, $arguments ) { $stream = wp_is_stream( $filename ); if ( $stream ) { ob_start(); } else { wp_mkdir_p( dirname( $filename ) ); } $result = call_user_func_array( $callback, $arguments ); if ( $result && $stream ) { $contents = ob_get_contents(); $fp = fopen( $filename, 'w' ); if ( ! $fp ) { ob_end_clean(); return false; } fwrite( $fp, $contents ); fclose( $fp ); } if ( $stream ) { ob_end_clean(); } return $result; } protected static function get_mime_type( $extension = null ) { if ( ! $extension ) { return false; } $mime_types = wp_get_mime_types(); $extensions = array_keys( $mime_types ); foreach ( $extensions as $_extension ) { if ( preg_match( "/{$extension}/i", $_extension ) ) { return $mime_types[ $_extension ]; } } return false; } protected static function get_extension( $mime_type = null ) { if ( empty( $mime_type ) ) { return false; } return wp_get_default_extension_for_mime_type( $mime_type ); } } get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) ); if ( ! $_post ) { return false; } $_post = sanitize_post( $_post, 'raw' ); wp_cache_add( $_post->ID, $_post, 'posts' ); } elseif ( empty( $_post->filter ) || 'raw' !== $_post->filter ) { $_post = sanitize_post( $_post, 'raw' ); } return new WP_Post( $_post ); } public function __construct( $post ) { foreach ( get_object_vars( $post ) as $key => $value ) { $this->$key = $value; } } public function __isset( $key ) { if ( 'ancestors' === $key ) { return true; } if ( 'page_template' === $key ) { return true; } if ( 'post_category' === $key ) { return true; } if ( 'tags_input' === $key ) { return true; } return metadata_exists( 'post', $this->ID, $key ); } public function __get( $key ) { if ( 'page_template' === $key && $this->__isset( $key ) ) { return get_post_meta( $this->ID, '_wp_page_template', true ); } if ( 'post_category' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) { $terms = get_the_terms( $this, 'category' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'term_id' ); } if ( 'tags_input' === $key ) { if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) { $terms = get_the_terms( $this, 'post_tag' ); } if ( empty( $terms ) ) { return array(); } return wp_list_pluck( $terms, 'name' ); } if ( 'ancestors' === $key ) { $value = get_post_ancestors( $this ); } else { $value = get_post_meta( $this->ID, $key, true ); } if ( $this->filter ) { $value = sanitize_post_field( $key, $value, $this->ID, $this->filter ); } return $value; } public function filter( $filter ) { if ( $this->filter === $filter ) { return $this; } if ( 'raw' === $filter ) { return self::get_instance( $this->ID ); } return sanitize_post( $this, $filter ); } public function to_array() { $post = get_object_vars( $this ); foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) { if ( $this->__isset( $key ) ) { $post[ $key ] = $this->__get( $key ); } } return $post; } } ' . __( 'There are no options for this widget.' ) . '

                '; return 'noform'; } public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { if ( ! empty( $id_base ) ) { $id_base = strtolower( $id_base ); } else { $id_base = preg_replace( '/(wp_)?widget_/', '', strtolower( get_class( $this ) ) ); } $this->id_base = $id_base; $this->name = $name; $this->option_name = 'widget_' . $this->id_base; $this->widget_options = wp_parse_args( $widget_options, array( 'classname' => str_replace( '\\', '_', $this->option_name ), 'customize_selective_refresh' => false, ) ); $this->control_options = wp_parse_args( $control_options, array( 'id_base' => $this->id_base ) ); } public function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) { _deprecated_constructor( 'WP_Widget', '4.3.0', get_class( $this ) ); WP_Widget::__construct( $id_base, $name, $widget_options, $control_options ); } public function get_field_name( $field_name ) { $pos = strpos( $field_name, '[' ); if ( false !== $pos ) { $field_name = '[' . substr_replace( $field_name, '][', $pos, strlen( '[' ) ); } else { $field_name = '[' . $field_name . ']'; } return 'widget-' . $this->id_base . '[' . $this->number . ']' . $field_name; } public function get_field_id( $field_name ) { $field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name ); $field_name = trim( $field_name, '-' ); return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name; } public function _register() { $settings = $this->get_settings(); $empty = true; if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) { $settings = $settings->getArrayCopy(); } if ( is_array( $settings ) ) { foreach ( array_keys( $settings ) as $number ) { if ( is_numeric( $number ) ) { $this->_set( $number ); $this->_register_one( $number ); $empty = false; } } } if ( $empty ) { $this->_set( 1 ); $this->_register_one(); } } public function _set( $number ) { $this->number = $number; $this->id = $this->id_base . '-' . $number; } public function _get_display_callback() { return array( $this, 'display_callback' ); } public function _get_update_callback() { return array( $this, 'update_callback' ); } public function _get_form_callback() { return array( $this, 'form_callback' ); } public function is_preview() { global $wp_customize; return ( isset( $wp_customize ) && $wp_customize->is_preview() ); } public function display_callback( $args, $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $this->_set( $widget_args['number'] ); $instances = $this->get_settings(); if ( isset( $instances[ $this->number ] ) ) { $instance = $instances[ $this->number ]; $instance = apply_filters( 'widget_display_callback', $instance, $this, $args ); if ( false === $instance ) { return; } $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $this->widget( $args, $instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } } } public function update_callback( $deprecated = 1 ) { global $wp_registered_widgets; $all_instances = $this->get_settings(); if ( $this->updated ) { return; } if ( isset( $_POST['delete_widget'] ) && $_POST['delete_widget'] ) { if ( isset( $_POST['the-widget-id'] ) ) { $del_id = $_POST['the-widget-id']; } else { return; } if ( isset( $wp_registered_widgets[ $del_id ]['params'][0]['number'] ) ) { $number = $wp_registered_widgets[ $del_id ]['params'][0]['number']; if ( $this->id_base . '-' . $number == $del_id ) { unset( $all_instances[ $number ] ); } } } else { if ( isset( $_POST[ 'widget-' . $this->id_base ] ) && is_array( $_POST[ 'widget-' . $this->id_base ] ) ) { $settings = $_POST[ 'widget-' . $this->id_base ]; } elseif ( isset( $_POST['id_base'] ) && $_POST['id_base'] == $this->id_base ) { $num = $_POST['multi_number'] ? (int) $_POST['multi_number'] : (int) $_POST['widget_number']; $settings = array( $num => array() ); } else { return; } foreach ( $settings as $number => $new_instance ) { $new_instance = stripslashes_deep( $new_instance ); $this->_set( $number ); $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $instance = $this->update( $new_instance, $old_instance ); if ( $this->is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } $instance = apply_filters( 'widget_update_callback', $instance, $new_instance, $old_instance, $this ); if ( false !== $instance ) { $all_instances[ $number ] = $instance; } break; } } $this->save_settings( $all_instances ); $this->updated = true; } public function form_callback( $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $all_instances = $this->get_settings(); if ( -1 == $widget_args['number'] ) { $this->_set( '__i__' ); $instance = array(); } else { $this->_set( $widget_args['number'] ); $instance = $all_instances[ $widget_args['number'] ]; } $instance = apply_filters( 'widget_form_callback', $instance, $this ); $return = null; if ( false !== $instance ) { $return = $this->form( $instance ); do_action_ref_array( 'in_widget_form', array( &$this, &$return, $instance ) ); } return $return; } public function _register_one( $number = -1 ) { wp_register_sidebar_widget( $this->id, $this->name, $this->_get_display_callback(), $this->widget_options, array( 'number' => $number ) ); _register_widget_update_callback( $this->id_base, $this->_get_update_callback(), $this->control_options, array( 'number' => -1 ) ); _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) ); } public function save_settings( $settings ) { $settings['_multiwidget'] = 1; update_option( $this->option_name, $settings ); } public function get_settings() { $settings = get_option( $this->option_name ); if ( false === $settings ) { if ( isset( $this->alt_option_name ) ) { $settings = get_option( $this->alt_option_name ); } else { $this->save_settings( array() ); } } if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) { $settings = array(); } if ( ! empty( $settings ) && ! isset( $settings['_multiwidget'] ) ) { $settings = wp_convert_widget_settings( $this->id_base, $this->option_name, $settings ); } unset( $settings['_multiwidget'], $settings['__i__'] ); return $settings; } } post_status ) { return; } if ( ! $post->post_name ) { wp_update_post( array( 'ID' => $post_id, 'post_name' => 'custom_slug_' . uniqid(), ) ); } $terms = get_the_terms( $post_id, 'wp_theme' ); if ( ! is_array( $terms ) || ! count( $terms ) ) { wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' ); } } function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) { return $override_slug; } if ( ! $override_slug ) { $override_slug = $slug; } $theme = wp_get_theme()->get_stylesheet(); $terms = get_the_terms( $post_ID, 'wp_theme' ); if ( $terms && ! is_wp_error( $terms ) ) { $theme = $terms[0]->name; } $check_query_args = array( 'post_name__in' => array( $override_slug ), 'post_type' => $post_type, 'posts_per_page' => 1, 'no_found_rows' => true, 'post__not_in' => array( $post_ID ), 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => $theme, ), ), ); $check_query = new WP_Query( $check_query_args ); $posts = $check_query->posts; if ( count( $posts ) > 0 ) { $suffix = 2; do { $query_args = $check_query_args; $alt_post_name = _truncate_post_slug( $override_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $query_args['post_name__in'] = array( $alt_post_name ); $query = new WP_Query( $query_args ); $suffix++; } while ( count( $query->posts ) > 0 ); $override_slug = $alt_post_name; } return $override_slug; } function the_block_template_skip_link() { global $_wp_current_template_content; if ( ! current_theme_supports( 'block-templates' ) ) { return; } if ( ! $_wp_current_template_content ) { return; } ?> - - - - - - callbacks[ $priority ] ); $this->callbacks[ $priority ][ $idx ] = array( 'function' => $callback, 'accepted_args' => $accepted_args, ); if ( ! $priority_existed && count( $this->callbacks ) > 1 ) { ksort( $this->callbacks, SORT_NUMERIC ); } if ( $this->nesting_level > 0 ) { $this->resort_active_iterations( $priority, $priority_existed ); } } private function resort_active_iterations( $new_priority = false, $priority_existed = false ) { $new_priorities = array_keys( $this->callbacks ); if ( ! $new_priorities ) { foreach ( $this->iterations as $index => $iteration ) { $this->iterations[ $index ] = $new_priorities; } return; } $min = min( $new_priorities ); foreach ( $this->iterations as $index => &$iteration ) { $current = current( $iteration ); if ( false === $current ) { continue; } $iteration = $new_priorities; if ( $current < $min ) { array_unshift( $iteration, $current ); continue; } while ( current( $iteration ) < $current ) { if ( false === next( $iteration ) ) { break; } } if ( $new_priority === $this->current_priority[ $index ] && ! $priority_existed ) { if ( false === current( $iteration ) ) { $prev = end( $iteration ); } else { $prev = prev( $iteration ); } if ( false === $prev ) { reset( $iteration ); } elseif ( $new_priority !== $prev ) { next( $iteration ); } } } unset( $iteration ); } public function remove_filter( $hook_name, $callback, $priority ) { $function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority ); $exists = isset( $this->callbacks[ $priority ][ $function_key ] ); if ( $exists ) { unset( $this->callbacks[ $priority ][ $function_key ] ); if ( ! $this->callbacks[ $priority ] ) { unset( $this->callbacks[ $priority ] ); if ( $this->nesting_level > 0 ) { $this->resort_active_iterations(); } } } return $exists; } public function has_filter( $hook_name = '', $callback = false ) { if ( false === $callback ) { return $this->has_filters(); } $function_key = _wp_filter_build_unique_id( $hook_name, $callback, false ); if ( ! $function_key ) { return false; } foreach ( $this->callbacks as $priority => $callbacks ) { if ( isset( $callbacks[ $function_key ] ) ) { return $priority; } } return false; } public function has_filters() { foreach ( $this->callbacks as $callbacks ) { if ( $callbacks ) { return true; } } return false; } public function remove_all_filters( $priority = false ) { if ( ! $this->callbacks ) { return; } if ( false === $priority ) { $this->callbacks = array(); } elseif ( isset( $this->callbacks[ $priority ] ) ) { unset( $this->callbacks[ $priority ] ); } if ( $this->nesting_level > 0 ) { $this->resort_active_iterations(); } } public function apply_filters( $value, $args ) { if ( ! $this->callbacks ) { return $value; } $nesting_level = $this->nesting_level++; $this->iterations[ $nesting_level ] = array_keys( $this->callbacks ); $num_args = count( $args ); do { $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] ); $priority = $this->current_priority[ $nesting_level ]; foreach ( $this->callbacks[ $priority ] as $the_ ) { if ( ! $this->doing_action ) { $args[0] = $value; } if ( 0 == $the_['accepted_args'] ) { $value = call_user_func( $the_['function'] ); } elseif ( $the_['accepted_args'] >= $num_args ) { $value = call_user_func_array( $the_['function'], $args ); } else { $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) ); } } } while ( false !== next( $this->iterations[ $nesting_level ] ) ); unset( $this->iterations[ $nesting_level ] ); unset( $this->current_priority[ $nesting_level ] ); $this->nesting_level--; return $value; } public function do_action( $args ) { $this->doing_action = true; $this->apply_filters( '', $args ); if ( ! $this->nesting_level ) { $this->doing_action = false; } } public function do_all_hook( &$args ) { $nesting_level = $this->nesting_level++; $this->iterations[ $nesting_level ] = array_keys( $this->callbacks ); do { $priority = current( $this->iterations[ $nesting_level ] ); foreach ( $this->callbacks[ $priority ] as $the_ ) { call_user_func_array( $the_['function'], $args ); } } while ( false !== next( $this->iterations[ $nesting_level ] ) ); unset( $this->iterations[ $nesting_level ] ); $this->nesting_level--; } public function current_priority() { if ( false === current( $this->iterations ) ) { return false; } return current( current( $this->iterations ) ); } public static function build_preinitialized_hooks( $filters ) { $normalized = array(); foreach ( $filters as $hook_name => $callback_groups ) { if ( is_object( $callback_groups ) && $callback_groups instanceof WP_Hook ) { $normalized[ $hook_name ] = $callback_groups; continue; } $hook = new WP_Hook(); foreach ( $callback_groups as $priority => $callbacks ) { foreach ( $callbacks as $cb ) { $hook->add_filter( $hook_name, $cb['function'], $priority, $cb['accepted_args'] ); } } $normalized[ $hook_name ] = $hook; } return $normalized; } public function offsetExists( $offset ) { return isset( $this->callbacks[ $offset ] ); } public function offsetGet( $offset ) { return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null; } public function offsetSet( $offset, $value ) { if ( is_null( $offset ) ) { $this->callbacks[] = $value; } else { $this->callbacks[ $offset ] = $value; } } public function offsetUnset( $offset ) { unset( $this->callbacks[ $offset ] ); } public function current() { return current( $this->callbacks ); } public function next() { return next( $this->callbacks ); } public function key() { return key( $this->callbacks ); } public function valid() { return key( $this->callbacks ) !== null; } public function rewind() { reset( $this->callbacks ); } } )/', $data ) ) { $type |= SIMPLEPIE_CONSTRUCT_HTML; } else { $type |= SIMPLEPIE_CONSTRUCT_TEXT; } } if ( $type & SIMPLEPIE_CONSTRUCT_BASE64 ) { $data = base64_decode( $data ); } if ( $type & ( SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) { $data = wp_kses_post( $data ); if ( 'UTF-8' !== $this->output_encoding ) { $data = $this->registry->call( 'Misc', 'change_encoding', array( $data, 'UTF-8', $this->output_encoding ) ); } return $data; } else { return parent::sanitize( $data, $type, $base ); } } } user_id, 'session_tokens', true ); if ( ! is_array( $sessions ) ) { return array(); } $sessions = array_map( array( $this, 'prepare_session' ), $sessions ); return array_filter( $sessions, array( $this, 'is_still_valid' ) ); } protected function prepare_session( $session ) { if ( is_int( $session ) ) { return array( 'expiration' => $session ); } return $session; } protected function get_session( $verifier ) { $sessions = $this->get_sessions(); if ( isset( $sessions[ $verifier ] ) ) { return $sessions[ $verifier ]; } return null; } protected function update_session( $verifier, $session = null ) { $sessions = $this->get_sessions(); if ( $session ) { $sessions[ $verifier ] = $session; } else { unset( $sessions[ $verifier ] ); } $this->update_sessions( $sessions ); } protected function update_sessions( $sessions ) { if ( $sessions ) { update_user_meta( $this->user_id, 'session_tokens', $sessions ); } else { delete_user_meta( $this->user_id, 'session_tokens' ); } } protected function destroy_other_sessions( $verifier ) { $session = $this->get_session( $verifier ); $this->update_sessions( array( $verifier => $session ) ); } protected function destroy_all_sessions() { $this->update_sessions( array() ); } public static function drop_sessions() { delete_metadata( 'user', 0, 'session_tokens', false, true ); } } 'block-templates', 'wp_template_part' => 'block-template-parts', ); } return array( 'wp_template' => 'templates', 'wp_template_part' => 'parts', ); } function get_allowed_block_template_part_areas() { $default_area_definitions = array( array( 'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED, 'label' => __( 'General' ), 'description' => __( 'General templates often perform a specific role like displaying post content, and are not tied to any particular area.' ), 'icon' => 'layout', 'area_tag' => 'div', ), array( 'area' => WP_TEMPLATE_PART_AREA_HEADER, 'label' => __( 'Header' ), 'description' => __( 'The Header template defines a page area that typically contains a title, logo, and main navigation.' ), 'icon' => 'header', 'area_tag' => 'header', ), array( 'area' => WP_TEMPLATE_PART_AREA_FOOTER, 'label' => __( 'Footer' ), 'description' => __( 'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.' ), 'icon' => 'footer', 'area_tag' => 'footer', ), ); return apply_filters( 'default_wp_template_part_areas', $default_area_definitions ); } function get_default_block_template_types() { $default_template_types = array( 'index' => array( 'title' => _x( 'Index', 'Template name' ), 'description' => __( 'Displays posts.' ), ), 'home' => array( 'title' => _x( 'Home', 'Template name' ), 'description' => __( 'Displays posts on the homepage, or on the Posts page if a static homepage is set.' ), ), 'front-page' => array( 'title' => _x( 'Front Page', 'Template name' ), 'description' => __( 'Displays the homepage.' ), ), 'singular' => array( 'title' => _x( 'Singular', 'Template name' ), 'description' => __( 'Displays a single post or page.' ), ), 'single' => array( 'title' => _x( 'Single Post', 'Template name' ), 'description' => __( 'Displays a single post.' ), ), 'page' => array( 'title' => _x( 'Page', 'Template name' ), 'description' => __( 'Displays a single page.' ), ), 'archive' => array( 'title' => _x( 'Archive', 'Template name' ), 'description' => __( 'Displays post categories, tags, and other archives.' ), ), 'author' => array( 'title' => _x( 'Author', 'Template name' ), 'description' => __( 'Displays latest posts written by a single author.' ), ), 'category' => array( 'title' => _x( 'Category', 'Template name' ), 'description' => __( 'Displays latest posts in single post category.' ), ), 'taxonomy' => array( 'title' => _x( 'Taxonomy', 'Template name' ), 'description' => __( 'Displays latest posts from a single post taxonomy.' ), ), 'date' => array( 'title' => _x( 'Date', 'Template name' ), 'description' => __( 'Displays posts from a specific date.' ), ), 'tag' => array( 'title' => _x( 'Tag', 'Template name' ), 'description' => __( 'Displays latest posts with a single post tag.' ), ), 'attachment' => array( 'title' => __( 'Media' ), 'description' => __( 'Displays individual media items or attachments.' ), ), 'search' => array( 'title' => _x( 'Search', 'Template name' ), 'description' => __( 'Displays search results.' ), ), 'privacy-policy' => array( 'title' => __( 'Privacy Policy' ), 'description' => __( 'Displays the privacy policy page.' ), ), '404' => array( 'title' => _x( '404', 'Template name' ), 'description' => __( 'Displays when no content is found.' ), ), ); return apply_filters( 'default_template_types', $default_template_types ); } function _filter_block_template_part_area( $type ) { $allowed_areas = array_map( static function ( $item ) { return $item['area']; }, get_allowed_block_template_part_areas() ); if ( in_array( $type, $allowed_areas, true ) ) { return $type; } $warning_message = sprintf( __( '"%1$s" is not a supported wp_template_part area value and has been added as "%2$s".' ), $type, WP_TEMPLATE_PART_AREA_UNCATEGORIZED ); trigger_error( $warning_message, E_USER_NOTICE ); return WP_TEMPLATE_PART_AREA_UNCATEGORIZED; } function _get_block_templates_paths( $base_directory ) { $path_list = array(); if ( file_exists( $base_directory ) ) { $nested_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH ); foreach ( $nested_html_files as $path => $file ) { $path_list[] = $path; } } return $path_list; } function _get_block_template_file( $template_type, $slug ) { if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) { return null; } $themes = array( get_stylesheet() => get_stylesheet_directory(), get_template() => get_template_directory(), ); foreach ( $themes as $theme_slug => $theme_dir ) { $template_base_paths = get_block_theme_folders( $theme_slug ); $file_path = $theme_dir . '/' . $template_base_paths[ $template_type ] . '/' . $slug . '.html'; if ( file_exists( $file_path ) ) { $new_template_item = array( 'slug' => $slug, 'path' => $file_path, 'theme' => $theme_slug, 'type' => $template_type, ); if ( 'wp_template_part' === $template_type ) { return _add_block_template_part_area_info( $new_template_item ); } if ( 'wp_template' === $template_type ) { return _add_block_template_info( $new_template_item ); } return $new_template_item; } } return null; } function _get_block_templates_files( $template_type ) { if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) { return null; } $themes = array( get_stylesheet() => get_stylesheet_directory(), get_template() => get_template_directory(), ); $template_files = array(); foreach ( $themes as $theme_slug => $theme_dir ) { $template_base_paths = get_block_theme_folders( $theme_slug ); $theme_template_files = _get_block_templates_paths( $theme_dir . '/' . $template_base_paths[ $template_type ] ); foreach ( $theme_template_files as $template_file ) { $template_base_path = $template_base_paths[ $template_type ]; $template_slug = substr( $template_file, strpos( $template_file, $template_base_path . DIRECTORY_SEPARATOR ) + 1 + strlen( $template_base_path ), -5 ); $new_template_item = array( 'slug' => $template_slug, 'path' => $template_file, 'theme' => $theme_slug, 'type' => $template_type, ); if ( 'wp_template_part' === $template_type ) { $template_files[] = _add_block_template_part_area_info( $new_template_item ); } if ( 'wp_template' === $template_type ) { $template_files[] = _add_block_template_info( $new_template_item ); } } } return $template_files; } function _add_block_template_info( $template_item ) { if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { return $template_item; } $theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates(); if ( isset( $theme_data[ $template_item['slug'] ] ) ) { $template_item['title'] = $theme_data[ $template_item['slug'] ]['title']; $template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes']; } return $template_item; } function _add_block_template_part_area_info( $template_info ) { if ( WP_Theme_JSON_Resolver::theme_has_support() ) { $theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts(); } if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) { $template_info['title'] = $theme_data[ $template_info['slug'] ]['title']; $template_info['area'] = _filter_block_template_part_area( $theme_data[ $template_info['slug'] ]['area'] ); } else { $template_info['area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED; } return $template_info; } function _flatten_blocks( &$blocks ) { $all_blocks = array(); $queue = array(); foreach ( $blocks as &$block ) { $queue[] = &$block; } while ( count( $queue ) > 0 ) { $block = &$queue[0]; array_shift( $queue ); $all_blocks[] = &$block; if ( ! empty( $block['innerBlocks'] ) ) { foreach ( $block['innerBlocks'] as &$inner_block ) { $queue[] = &$inner_block; } } } return $all_blocks; } function _inject_theme_attribute_in_block_template_content( $template_content ) { $has_updated_content = false; $new_content = ''; $template_blocks = parse_blocks( $template_content ); $blocks = _flatten_blocks( $template_blocks ); foreach ( $blocks as &$block ) { if ( 'core/template-part' === $block['blockName'] && ! isset( $block['attrs']['theme'] ) ) { $block['attrs']['theme'] = wp_get_theme()->get_stylesheet(); $has_updated_content = true; } } if ( $has_updated_content ) { foreach ( $template_blocks as &$block ) { $new_content .= serialize_block( $block ); } return $new_content; } return $template_content; } function _remove_theme_attribute_in_block_template_content( $template_content ) { $has_updated_content = false; $new_content = ''; $template_blocks = parse_blocks( $template_content ); $blocks = _flatten_blocks( $template_blocks ); foreach ( $blocks as $key => $block ) { if ( 'core/template-part' === $block['blockName'] && isset( $block['attrs']['theme'] ) ) { unset( $blocks[ $key ]['attrs']['theme'] ); $has_updated_content = true; } } if ( ! $has_updated_content ) { return $template_content; } foreach ( $template_blocks as $block ) { $new_content .= serialize_block( $block ); } return $new_content; } function _build_block_template_result_from_file( $template_file, $template_type ) { $default_template_types = get_default_block_template_types(); $template_content = file_get_contents( $template_file['path'] ); $theme = wp_get_theme()->get_stylesheet(); $template = new WP_Block_Template(); $template->id = $theme . '//' . $template_file['slug']; $template->theme = $theme; $template->content = _inject_theme_attribute_in_block_template_content( $template_content ); $template->slug = $template_file['slug']; $template->source = 'theme'; $template->type = $template_type; $template->title = ! empty( $template_file['title'] ) ? $template_file['title'] : $template_file['slug']; $template->status = 'publish'; $template->has_theme_file = true; $template->is_custom = true; if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) { $template->description = $default_template_types[ $template_file['slug'] ]['description']; $template->title = $default_template_types[ $template_file['slug'] ]['title']; $template->is_custom = false; } if ( 'wp_template' === $template_type && isset( $template_file['postTypes'] ) ) { $template->post_types = $template_file['postTypes']; } if ( 'wp_template_part' === $template_type && isset( $template_file['area'] ) ) { $template->area = $template_file['area']; } return $template; } function _build_block_template_result_from_post( $post ) { $default_template_types = get_default_block_template_types(); $terms = get_the_terms( $post, 'wp_theme' ); if ( is_wp_error( $terms ) ) { return $terms; } if ( ! $terms ) { return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) ); } $theme = $terms[0]->name; $has_theme_file = wp_get_theme()->get_stylesheet() === $theme && null !== _get_block_template_file( $post->post_type, $post->post_name ); $origin = get_post_meta( $post->ID, 'origin', true ); $template = new WP_Block_Template(); $template->wp_id = $post->ID; $template->id = $theme . '//' . $post->post_name; $template->theme = $theme; $template->content = $post->post_content; $template->slug = $post->post_name; $template->source = 'custom'; $template->origin = ! empty( $origin ) ? $origin : null; $template->type = $post->post_type; $template->description = $post->post_excerpt; $template->title = $post->post_title; $template->status = $post->post_status; $template->has_theme_file = $has_theme_file; $template->is_custom = true; $template->author = $post->post_author; if ( 'wp_template' === $post->post_type && isset( $default_template_types[ $template->slug ] ) ) { $template->is_custom = false; } if ( 'wp_template_part' === $post->post_type ) { $type_terms = get_the_terms( $post, 'wp_template_part_area' ); if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) { $template->area = $type_terms[0]->name; } } return $template; } function get_block_templates( $query = array(), $template_type = 'wp_template' ) { $templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type ); if ( ! is_null( $templates ) ) { return $templates; } $post_type = isset( $query['post_type'] ) ? $query['post_type'] : ''; $wp_query_args = array( 'post_status' => array( 'auto-draft', 'draft', 'publish' ), 'post_type' => $template_type, 'posts_per_page' => -1, 'no_found_rows' => true, 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => wp_get_theme()->get_stylesheet(), ), ), ); if ( 'wp_template_part' === $template_type && isset( $query['area'] ) ) { $wp_query_args['tax_query'][] = array( 'taxonomy' => 'wp_template_part_area', 'field' => 'name', 'terms' => $query['area'], ); $wp_query_args['tax_query']['relation'] = 'AND'; } if ( isset( $query['slug__in'] ) ) { $wp_query_args['post_name__in'] = $query['slug__in']; } if ( isset( $query['wp_id'] ) ) { $wp_query_args['p'] = $query['wp_id']; } else { $wp_query_args['post_status'] = 'publish'; } $template_query = new WP_Query( $wp_query_args ); $query_result = array(); foreach ( $template_query->posts as $post ) { $template = _build_block_template_result_from_post( $post ); if ( is_wp_error( $template ) ) { continue; } if ( $post_type && ! $template->is_custom ) { continue; } $query_result[] = $template; } if ( ! isset( $query['wp_id'] ) ) { $template_files = _get_block_templates_files( $template_type ); foreach ( $template_files as $template_file ) { $template = _build_block_template_result_from_file( $template_file, $template_type ); if ( $post_type && ! $template->is_custom ) { continue; } if ( $post_type && isset( $template->post_types ) && ! in_array( $post_type, $template->post_types, true ) ) { continue; } $is_not_custom = false === array_search( wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'], array_column( $query_result, 'id' ), true ); $fits_slug_query = ! isset( $query['slug__in'] ) || in_array( $template_file['slug'], $query['slug__in'], true ); $fits_area_query = ! isset( $query['area'] ) || $template_file['area'] === $query['area']; $should_include = $is_not_custom && $fits_slug_query && $fits_area_query; if ( $should_include ) { $query_result[] = $template; } } } return apply_filters( 'get_block_templates', $query_result, $query, $template_type ); } function get_block_template( $id, $template_type = 'wp_template' ) { $block_template = apply_filters( 'pre_get_block_template', null, $id, $template_type ); if ( ! is_null( $block_template ) ) { return $block_template; } $parts = explode( '//', $id, 2 ); if ( count( $parts ) < 2 ) { return null; } list( $theme, $slug ) = $parts; $wp_query_args = array( 'post_name__in' => array( $slug ), 'post_type' => $template_type, 'post_status' => array( 'auto-draft', 'draft', 'publish', 'trash' ), 'posts_per_page' => 1, 'no_found_rows' => true, 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', 'terms' => $theme, ), ), ); $template_query = new WP_Query( $wp_query_args ); $posts = $template_query->posts; if ( count( $posts ) > 0 ) { $template = _build_block_template_result_from_post( $posts[0] ); if ( ! is_wp_error( $template ) ) { return $template; } } $block_template = get_block_file_template( $id, $template_type ); return apply_filters( 'get_block_template', $block_template, $id, $template_type ); } function get_block_file_template( $id, $template_type = 'wp_template' ) { $block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type ); if ( ! is_null( $block_template ) ) { return $block_template; } $parts = explode( '//', $id, 2 ); if ( count( $parts ) < 2 ) { return apply_filters( 'get_block_file_template', null, $id, $template_type ); } list( $theme, $slug ) = $parts; if ( wp_get_theme()->get_stylesheet() !== $theme ) { return apply_filters( 'get_block_file_template', null, $id, $template_type ); } $template_file = _get_block_template_file( $template_type, $slug ); if ( null === $template_file ) { return apply_filters( 'get_block_file_template', null, $id, $template_type ); } $block_template = _build_block_template_result_from_file( $template_file, $template_type ); return apply_filters( 'get_block_file_template', $block_template, $id, $template_type ); } function block_template_part( $part ) { $template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' ); if ( ! $template_part || empty( $template_part->content ) ) { return; } echo do_blocks( $template_part->content ); } function block_header_area() { block_template_part( 'header' ); } function block_footer_area() { block_template_part( 'footer' ); } function wp_is_theme_directory_ignored( $path ) { $directories_to_ignore = array( '.svn', '.git', '.hg', '.bzr', 'node_modules', 'vendor' ); foreach ( $directories_to_ignore as $directory ) { if ( strpos( $path, $directory ) === 0 ) { return true; } } return false; } function wp_generate_block_templates_export_file() { if ( ! class_exists( 'ZipArchive' ) ) { return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) ); } $obscura = wp_generate_password( 12, false, false ); $theme_name = basename( get_stylesheet() ); $filename = get_temp_dir() . $theme_name . $obscura . '.zip'; $zip = new ZipArchive(); if ( true !== $zip->open( $filename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) ) { return new WP_Error( 'unable_to_create_zip', __( 'Unable to open export file (archive) for writing.' ) ); } $zip->addEmptyDir( 'templates' ); $zip->addEmptyDir( 'parts' ); $theme_path = wp_normalize_path( get_stylesheet_directory() ); $theme_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $theme_path ), RecursiveIteratorIterator::LEAVES_ONLY ); foreach ( $theme_files as $file ) { if ( ! $file->isDir() ) { $file_path = wp_normalize_path( $file ); $relative_path = substr( $file_path, strlen( $theme_path ) + 1 ); if ( ! wp_is_theme_directory_ignored( $relative_path ) ) { $zip->addFile( $file_path, $relative_path ); } } } $templates = get_block_templates(); foreach ( $templates as $template ) { $template->content = _remove_theme_attribute_in_block_template_content( $template->content ); $zip->addFromString( 'templates/' . $template->slug . '.html', $template->content ); } $template_parts = get_block_templates( array(), 'wp_template_part' ); foreach ( $template_parts as $template_part ) { $zip->addFromString( 'parts/' . $template_part->slug . '.html', $template_part->content ); } $tree = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) ); $tree->merge( WP_Theme_JSON_Resolver::get_user_data() ); $theme_json_raw = $tree->get_data(); if ( $theme_json_raw['version'] ) { global $wp_version; $theme_json_version = 'wp/' . substr( $wp_version, 0, 3 ); $schema = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' ); $theme_json_raw = array_merge( $schema, $theme_json_raw ); } $theme_json_encoded = wp_json_encode( $theme_json_raw, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $theme_json_tabbed = preg_replace( '~(?:^|\G)\h{4}~m', "\t", $theme_json_encoded ); $zip->addFromString( 'theme.json', $theme_json_tabbed ); $zip->close(); return $filename; } ID ) && ( null !== $id ) ) { return $current_user; } $current_user = new WP_User( $id, $name ); setup_userdata( $current_user->ID ); do_action( 'set_current_user' ); return $current_user; } endif; if ( ! function_exists( 'wp_get_current_user' ) ) : function wp_get_current_user() { return _wp_get_current_user(); } endif; if ( ! function_exists( 'get_userdata' ) ) : function get_userdata( $user_id ) { return get_user_by( 'id', $user_id ); } endif; if ( ! function_exists( 'get_user_by' ) ) : function get_user_by( $field, $value ) { global $current_user; $userdata = WP_User::get_data_by( $field, $value ); if ( ! $userdata ) { return false; } if ( $current_user instanceof WP_User && $current_user->ID === (int) $userdata->ID ) { return $current_user; } $user = new WP_User; $user->init( $userdata ); return $user; } endif; if ( ! function_exists( 'cache_users' ) ) : function cache_users( $user_ids ) { global $wpdb; $clean = _get_non_cached_ids( $user_ids, 'users' ); if ( empty( $clean ) ) { return; } $list = implode( ',', $clean ); $users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" ); $ids = array(); foreach ( $users as $user ) { update_user_caches( $user ); $ids[] = $user->ID; } update_meta_cache( 'user', $ids ); } endif; if ( ! function_exists( 'wp_mail' ) ) : function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ); $pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts ); if ( null !== $pre_wp_mail ) { return $pre_wp_mail; } if ( isset( $atts['to'] ) ) { $to = $atts['to']; } if ( ! is_array( $to ) ) { $to = explode( ',', $to ); } if ( isset( $atts['subject'] ) ) { $subject = $atts['subject']; } if ( isset( $atts['message'] ) ) { $message = $atts['message']; } if ( isset( $atts['headers'] ) ) { $headers = $atts['headers']; } if ( isset( $atts['attachments'] ) ) { $attachments = $atts['attachments']; } if ( ! is_array( $attachments ) ) { $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) ); } global $phpmailer; if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) { require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'; require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php'; require_once ABSPATH . WPINC . '/PHPMailer/Exception.php'; $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true ); $phpmailer::$validator = static function ( $email ) { return (bool) is_email( $email ); }; } $cc = array(); $bcc = array(); $reply_to = array(); if ( empty( $headers ) ) { $headers = array(); } else { if ( ! is_array( $headers ) ) { $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) ); } else { $tempheaders = $headers; } $headers = array(); if ( ! empty( $tempheaders ) ) { foreach ( (array) $tempheaders as $header ) { if ( strpos( $header, ':' ) === false ) { if ( false !== stripos( $header, 'boundary=' ) ) { $parts = preg_split( '/boundary=/i', trim( $header ) ); $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) ); } continue; } list( $name, $content ) = explode( ':', trim( $header ), 2 ); $name = trim( $name ); $content = trim( $content ); switch ( strtolower( $name ) ) { case 'from': $bracket_pos = strpos( $content, '<' ); if ( false !== $bracket_pos ) { if ( $bracket_pos > 0 ) { $from_name = substr( $content, 0, $bracket_pos - 1 ); $from_name = str_replace( '"', '', $from_name ); $from_name = trim( $from_name ); } $from_email = substr( $content, $bracket_pos + 1 ); $from_email = str_replace( '>', '', $from_email ); $from_email = trim( $from_email ); } elseif ( '' !== trim( $content ) ) { $from_email = trim( $content ); } break; case 'content-type': if ( strpos( $content, ';' ) !== false ) { list( $type, $charset_content ) = explode( ';', $content ); $content_type = trim( $type ); if ( false !== stripos( $charset_content, 'charset=' ) ) { $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset_content ) ); } elseif ( false !== stripos( $charset_content, 'boundary=' ) ) { $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) ); $charset = ''; } } elseif ( '' !== trim( $content ) ) { $content_type = trim( $content ); } break; case 'cc': $cc = array_merge( (array) $cc, explode( ',', $content ) ); break; case 'bcc': $bcc = array_merge( (array) $bcc, explode( ',', $content ) ); break; case 'reply-to': $reply_to = array_merge( (array) $reply_to, explode( ',', $content ) ); break; default: $headers[ trim( $name ) ] = trim( $content ); break; } } } } $phpmailer->clearAllRecipients(); $phpmailer->clearAttachments(); $phpmailer->clearCustomHeaders(); $phpmailer->clearReplyTos(); if ( ! isset( $from_name ) ) { $from_name = 'WordPress'; } if ( ! isset( $from_email ) ) { $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); $from_email = 'wordpress@'; if ( null !== $sitename ) { if ( 'www.' === substr( $sitename, 0, 4 ) ) { $sitename = substr( $sitename, 4 ); } $from_email .= $sitename; } } $from_email = apply_filters( 'wp_mail_from', $from_email ); $from_name = apply_filters( 'wp_mail_from_name', $from_name ); try { $phpmailer->setFrom( $from_email, $from_name, false ); } catch ( PHPMailer\PHPMailer\Exception $e ) { $mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); $mail_error_data['phpmailer_exception_code'] = $e->getCode(); do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) ); return false; } $phpmailer->Subject = $subject; $phpmailer->Body = $message; $address_headers = compact( 'to', 'cc', 'bcc', 'reply_to' ); foreach ( $address_headers as $address_header => $addresses ) { if ( empty( $addresses ) ) { continue; } foreach ( (array) $addresses as $address ) { try { $recipient_name = ''; if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) { if ( count( $matches ) == 3 ) { $recipient_name = $matches[1]; $address = $matches[2]; } } switch ( $address_header ) { case 'to': $phpmailer->addAddress( $address, $recipient_name ); break; case 'cc': $phpmailer->addCc( $address, $recipient_name ); break; case 'bcc': $phpmailer->addBcc( $address, $recipient_name ); break; case 'reply_to': $phpmailer->addReplyTo( $address, $recipient_name ); break; } } catch ( PHPMailer\PHPMailer\Exception $e ) { continue; } } } $phpmailer->isMail(); if ( ! isset( $content_type ) ) { $content_type = 'text/plain'; } $content_type = apply_filters( 'wp_mail_content_type', $content_type ); $phpmailer->ContentType = $content_type; if ( 'text/html' === $content_type ) { $phpmailer->isHTML( true ); } if ( ! isset( $charset ) ) { $charset = get_bloginfo( 'charset' ); } $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); if ( ! empty( $headers ) ) { foreach ( (array) $headers as $name => $content ) { if ( ! in_array( $name, array( 'MIME-Version', 'X-Mailer' ), true ) ) { try { $phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); } catch ( PHPMailer\PHPMailer\Exception $e ) { continue; } } } if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) { $phpmailer->addCustomHeader( sprintf( 'Content-Type: %s; boundary="%s"', $content_type, $boundary ) ); } } if ( ! empty( $attachments ) ) { foreach ( $attachments as $attachment ) { try { $phpmailer->addAttachment( $attachment ); } catch ( PHPMailer\PHPMailer\Exception $e ) { continue; } } } do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); $mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' ); try { $send = $phpmailer->send(); do_action( 'wp_mail_succeeded', $mail_data ); return $send; } catch ( PHPMailer\PHPMailer\Exception $e ) { $mail_data['phpmailer_exception_code'] = $e->getCode(); do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) ); return false; } } endif; if ( ! function_exists( 'wp_authenticate' ) ) : function wp_authenticate( $username, $password ) { $username = sanitize_user( $username ); $password = trim( $password ); $user = apply_filters( 'authenticate', null, $username, $password ); if ( null == $user ) { $user = new WP_Error( 'authentication_failed', __( 'Error: Invalid username, email address or incorrect password.' ) ); } $ignore_codes = array( 'empty_username', 'empty_password' ); if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes, true ) ) { $error = $user; do_action( 'wp_login_failed', $username, $error ); } return $user; } endif; if ( ! function_exists( 'wp_logout' ) ) : function wp_logout() { $user_id = get_current_user_id(); wp_destroy_current_session(); wp_clear_auth_cookie(); wp_set_current_user( 0 ); do_action( 'wp_logout', $user_id ); } endif; if ( ! function_exists( 'wp_validate_auth_cookie' ) ) : function wp_validate_auth_cookie( $cookie = '', $scheme = '' ) { $cookie_elements = wp_parse_auth_cookie( $cookie, $scheme ); if ( ! $cookie_elements ) { do_action( 'auth_cookie_malformed', $cookie, $scheme ); return false; } $scheme = $cookie_elements['scheme']; $username = $cookie_elements['username']; $hmac = $cookie_elements['hmac']; $token = $cookie_elements['token']; $expired = $cookie_elements['expiration']; $expiration = $cookie_elements['expiration']; if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) { $expired += HOUR_IN_SECONDS; } if ( $expired < time() ) { do_action( 'auth_cookie_expired', $cookie_elements ); return false; } $user = get_user_by( 'login', $username ); if ( ! $user ) { do_action( 'auth_cookie_bad_username', $cookie_elements ); return false; } $pass_frag = substr( $user->user_pass, 8, 4 ); $key = wp_hash( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme ); $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; $hash = hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key ); if ( ! hash_equals( $hash, $hmac ) ) { do_action( 'auth_cookie_bad_hash', $cookie_elements ); return false; } $manager = WP_Session_Tokens::get_instance( $user->ID ); if ( ! $manager->verify( $token ) ) { do_action( 'auth_cookie_bad_session_token', $cookie_elements ); return false; } if ( $expiration < time() ) { $GLOBALS['login_grace_period'] = 1; } do_action( 'auth_cookie_valid', $cookie_elements, $user ); return $user->ID; } endif; if ( ! function_exists( 'wp_generate_auth_cookie' ) ) : function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) { $user = get_userdata( $user_id ); if ( ! $user ) { return ''; } if ( ! $token ) { $manager = WP_Session_Tokens::get_instance( $user_id ); $token = $manager->create( $expiration ); } $pass_frag = substr( $user->user_pass, 8, 4 ); $key = wp_hash( $user->user_login . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme ); $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; $hash = hash_hmac( $algo, $user->user_login . '|' . $expiration . '|' . $token, $key ); $cookie = $user->user_login . '|' . $expiration . '|' . $token . '|' . $hash; return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token ); } endif; if ( ! function_exists( 'wp_parse_auth_cookie' ) ) : function wp_parse_auth_cookie( $cookie = '', $scheme = '' ) { if ( empty( $cookie ) ) { switch ( $scheme ) { case 'auth': $cookie_name = AUTH_COOKIE; break; case 'secure_auth': $cookie_name = SECURE_AUTH_COOKIE; break; case 'logged_in': $cookie_name = LOGGED_IN_COOKIE; break; default: if ( is_ssl() ) { $cookie_name = SECURE_AUTH_COOKIE; $scheme = 'secure_auth'; } else { $cookie_name = AUTH_COOKIE; $scheme = 'auth'; } } if ( empty( $_COOKIE[ $cookie_name ] ) ) { return false; } $cookie = $_COOKIE[ $cookie_name ]; } $cookie_elements = explode( '|', $cookie ); if ( count( $cookie_elements ) !== 4 ) { return false; } list( $username, $expiration, $token, $hmac ) = $cookie_elements; return compact( 'username', 'expiration', 'token', 'hmac', 'scheme' ); } endif; if ( ! function_exists( 'wp_set_auth_cookie' ) ) : function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) { if ( $remember ) { $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember ); $expire = $expiration + ( 12 * HOUR_IN_SECONDS ); } else { $expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember ); $expire = 0; } if ( '' === $secure ) { $secure = is_ssl(); } $secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME ); $secure = apply_filters( 'secure_auth_cookie', $secure, $user_id ); $secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure ); if ( $secure ) { $auth_cookie_name = SECURE_AUTH_COOKIE; $scheme = 'secure_auth'; } else { $auth_cookie_name = AUTH_COOKIE; $scheme = 'auth'; } if ( '' === $token ) { $manager = WP_Session_Tokens::get_instance( $user_id ); $token = $manager->create( $expiration ); } $auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token ); $logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token ); do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme, $token ); do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in', $token ); if ( ! apply_filters( 'send_auth_cookies', true ) ) { return; } setcookie( $auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true ); setcookie( $auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true ); setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true ); if ( COOKIEPATH != SITECOOKIEPATH ) { setcookie( LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true ); } } endif; if ( ! function_exists( 'wp_clear_auth_cookie' ) ) : function wp_clear_auth_cookie() { do_action( 'clear_auth_cookie' ); if ( ! apply_filters( 'send_auth_cookies', true ) ) { return; } setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN ); setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( 'wp-settings-' . get_current_user_id(), ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); setcookie( 'wp-settings-time-' . get_current_user_id(), ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); setcookie( 'wp-postpass_' . COOKIEHASH, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); } endif; if ( ! function_exists( 'is_user_logged_in' ) ) : function is_user_logged_in() { $user = wp_get_current_user(); return $user->exists(); } endif; if ( ! function_exists( 'auth_redirect' ) ) : function auth_redirect() { $secure = ( is_ssl() || force_ssl_admin() ); $secure = apply_filters( 'secure_auth_redirect', $secure ); if ( $secure && ! is_ssl() && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) { if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) { wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ); exit; } else { wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); exit; } } $scheme = apply_filters( 'auth_redirect_scheme', '' ); $user_id = wp_validate_auth_cookie( '', $scheme ); if ( $user_id ) { do_action( 'auth_redirect', $user_id ); if ( ! $secure && get_user_option( 'use_ssl', $user_id ) && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) { if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) { wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ); exit; } else { wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); exit; } } return; } nocache_headers(); $redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $login_url = wp_login_url( $redirect, true ); wp_redirect( $login_url ); exit; } endif; if ( ! function_exists( 'check_admin_referer' ) ) : function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { if ( -1 === $action ) { _doing_it_wrong( __FUNCTION__, __( 'You should specify an action to be verified by using the first parameter.' ), '3.2.0' ); } $adminurl = strtolower( admin_url() ); $referer = strtolower( wp_get_referer() ); $result = isset( $_REQUEST[ $query_arg ] ) ? wp_verify_nonce( $_REQUEST[ $query_arg ], $action ) : false; do_action( 'check_admin_referer', $action, $result ); if ( ! $result && ! ( -1 === $action && strpos( $referer, $adminurl ) === 0 ) ) { wp_nonce_ays( $action ); die(); } return $result; } endif; if ( ! function_exists( 'check_ajax_referer' ) ) : function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) { if ( -1 == $action ) { _doing_it_wrong( __FUNCTION__, __( 'You should specify an action to be verified by using the first parameter.' ), '4.7.0' ); } $nonce = ''; if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) ) { $nonce = $_REQUEST[ $query_arg ]; } elseif ( isset( $_REQUEST['_ajax_nonce'] ) ) { $nonce = $_REQUEST['_ajax_nonce']; } elseif ( isset( $_REQUEST['_wpnonce'] ) ) { $nonce = $_REQUEST['_wpnonce']; } $result = wp_verify_nonce( $nonce, $action ); do_action( 'check_ajax_referer', $action, $result ); if ( $die && false === $result ) { if ( wp_doing_ajax() ) { wp_die( -1, 403 ); } else { die( '-1' ); } } return $result; } endif; if ( ! function_exists( 'wp_redirect' ) ) : function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { global $is_IIS; $location = apply_filters( 'wp_redirect', $location, $status ); $status = apply_filters( 'wp_redirect_status', $status, $location ); if ( ! $location ) { return false; } if ( $status < 300 || 399 < $status ) { wp_die( __( 'HTTP redirect status code must be a redirection code, 3xx.' ) ); } $location = wp_sanitize_redirect( $location ); if ( ! $is_IIS && 'cgi-fcgi' !== PHP_SAPI ) { status_header( $status ); } $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location ); if ( is_string( $x_redirect_by ) ) { header( "X-Redirect-By: $x_redirect_by" ); } header( "Location: $location", true, $status ); return true; } endif; if ( ! function_exists( 'wp_sanitize_redirect' ) ) : function wp_sanitize_redirect( $location ) { $location = str_replace( ' ', '%20', $location ); $regex = '/ - ( - (?: [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx - | \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2 - | [\xE1-\xEC][\x80-\xBF]{2} - | \xED[\x80-\x9F][\x80-\xBF] - | [\xEE-\xEF][\x80-\xBF]{2} - | \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3 - | [\xF1-\xF3][\x80-\xBF]{3} - | \xF4[\x80-\x8F][\x80-\xBF]{2} - ){1,40} # ...one or more times - )/x'; $location = preg_replace_callback( $regex, '_wp_sanitize_utf8_in_redirect', $location ); $location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '', $location ); $location = wp_kses_no_null( $location ); $strip = array( '%0d', '%0a', '%0D', '%0A' ); return _deep_replace( $strip, $location ); } function _wp_sanitize_utf8_in_redirect( $matches ) { return urlencode( $matches[0] ); } endif; if ( ! function_exists( 'wp_safe_redirect' ) ) : function wp_safe_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { $location = wp_sanitize_redirect( $location ); $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) ); return wp_redirect( $location, $status, $x_redirect_by ); } endif; if ( ! function_exists( 'wp_validate_redirect' ) ) : function wp_validate_redirect( $location, $default = '' ) { $location = wp_sanitize_redirect( trim( $location, " \t\n\r\0\x08\x0B" ) ); if ( '//' === substr( $location, 0, 2 ) ) { $location = 'http:' . $location; } $cut = strpos( $location, '?' ); $test = $cut ? substr( $location, 0, $cut ) : $location; $lp = parse_url( $test ); if ( false === $lp ) { return $default; } if ( isset( $lp['scheme'] ) && ! ( 'http' === $lp['scheme'] || 'https' === $lp['scheme'] ) ) { return $default; } if ( ! isset( $lp['host'] ) && ! empty( $lp['path'] ) && '/' !== $lp['path'][0] ) { $path = ''; if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { $path = dirname( parse_url( 'http://placeholder' . $_SERVER['REQUEST_URI'], PHP_URL_PATH ) . '?' ); $path = wp_normalize_path( $path ); } $location = '/' . ltrim( $path . '/', '/' ) . $location; } if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) { return $default; } foreach ( array( 'user', 'pass', 'host' ) as $component ) { if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) { return $default; } } $wpp = parse_url( home_url() ); $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' ); if ( isset( $lp['host'] ) && ( ! in_array( $lp['host'], $allowed_hosts, true ) && strtolower( $wpp['host'] ) !== $lp['host'] ) ) { $location = $default; } return $location; } endif; if ( ! function_exists( 'wp_notify_postauthor' ) ) : function wp_notify_postauthor( $comment_id, $deprecated = null ) { if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.8.0' ); } $comment = get_comment( $comment_id ); if ( empty( $comment ) || empty( $comment->comment_post_ID ) ) { return false; } $post = get_post( $comment->comment_post_ID ); $author = get_userdata( $post->post_author ); $emails = array(); if ( $author ) { $emails[] = $author->user_email; } $emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID ); $emails = array_filter( $emails ); if ( ! count( $emails ) ) { return false; } $emails = array_flip( $emails ); $notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID ); if ( $author && ! $notify_author && $comment->user_id == $post->post_author ) { unset( $emails[ $author->user_email ] ); } if ( $author && ! $notify_author && get_current_user_id() == $post->post_author ) { unset( $emails[ $author->user_email ] ); } if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) { unset( $emails[ $author->user_email ] ); } if ( ! count( $emails ) ) { return false; } else { $emails = array_flip( $emails ); } $switched_locale = switch_to_locale( get_locale() ); $comment_author_domain = ''; if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) { $comment_author_domain = gethostbyaddr( $comment->comment_author_IP ); } $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $comment_content = wp_specialchars_decode( $comment->comment_content ); switch ( $comment->comment_type ) { case 'trackback': $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; $notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n"; $subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title ); break; case 'pingback': $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; $notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n"; $subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title ); break; default: $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; if ( $comment->comment_parent && user_can( $post->post_author, 'edit_comment', $comment->comment_parent ) ) { $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; } $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; $notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n"; $subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title ); break; } $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n"; $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n"; if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) { if ( EMPTY_TRASH_DAYS ) { $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n"; } else { $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n"; } $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n"; } $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', wp_parse_url( network_home_url(), PHP_URL_HOST ) ); if ( '' === $comment->comment_author ) { $from = "From: \"$blogname\" <$wp_email>"; if ( '' !== $comment->comment_author_email ) { $reply_to = "Reply-To: $comment->comment_author_email"; } } else { $from = "From: \"$comment->comment_author\" <$wp_email>"; if ( '' !== $comment->comment_author_email ) { $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; } } $message_headers = "$from\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n"; if ( isset( $reply_to ) ) { $message_headers .= $reply_to . "\n"; } $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID ); $subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID ); $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID ); foreach ( $emails as $email ) { wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); } if ( $switched_locale ) { restore_previous_locale(); } return true; } endif; if ( ! function_exists( 'wp_notify_moderator' ) ) : function wp_notify_moderator( $comment_id ) { global $wpdb; $maybe_notify = get_option( 'moderation_notify' ); $maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id ); if ( ! $maybe_notify ) { return true; } $comment = get_comment( $comment_id ); $post = get_post( $comment->comment_post_ID ); $user = get_userdata( $post->post_author ); $emails = array( get_option( 'admin_email' ) ); if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) { if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) { $emails[] = $user->user_email; } } $switched_locale = switch_to_locale( get_locale() ); $comment_author_domain = ''; if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) { $comment_author_domain = gethostbyaddr( $comment->comment_author_IP ); } $comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ); $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $comment_content = wp_specialchars_decode( $comment->comment_content ); switch ( $comment->comment_type ) { case 'trackback': $notify_message = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; break; case 'pingback': $notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; break; default: $notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; if ( $comment->comment_parent ) { $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; } $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; break; } $notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n"; if ( EMPTY_TRASH_DAYS ) { $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n"; } else { $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n"; } $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n"; $notify_message .= sprintf( _n( 'Currently %s comment is waiting for approval. Please visit the moderation panel:', 'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting ), number_format_i18n( $comments_waiting ) ) . "\r\n"; $notify_message .= admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ) . "\r\n"; $subject = sprintf( __( '[%1$s] Please moderate: "%2$s"' ), $blogname, $post->post_title ); $message_headers = ''; $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id ); $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id ); $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id ); $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id ); foreach ( $emails as $email ) { wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); } if ( $switched_locale ) { restore_previous_locale(); } return true; } endif; if ( ! function_exists( 'wp_password_change_notification' ) ) : function wp_password_change_notification( $user ) { if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) { $message = sprintf( __( 'Password changed for user: %s' ), $user->user_login ) . "\r\n"; $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); $wp_password_change_notification_email = array( 'to' => get_option( 'admin_email' ), 'subject' => __( '[%s] Password Changed' ), 'message' => $message, 'headers' => '', ); $wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname ); wp_mail( $wp_password_change_notification_email['to'], wp_specialchars_decode( sprintf( $wp_password_change_notification_email['subject'], $blogname ) ), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers'] ); } } endif; if ( ! function_exists( 'wp_new_user_notification' ) ) : function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) { if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '4.3.1' ); } if ( ! in_array( $notify, array( 'user', 'admin', 'both', '' ), true ) ) { return; } $user = get_userdata( $user_id ); $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); if ( 'user' !== $notify ) { $switched_locale = switch_to_locale( get_locale() ); $message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n"; $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n"; $wp_new_user_notification_email_admin = array( 'to' => get_option( 'admin_email' ), 'subject' => __( '[%s] New User Registration' ), 'message' => $message, 'headers' => '', ); $wp_new_user_notification_email_admin = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blogname ); wp_mail( $wp_new_user_notification_email_admin['to'], wp_specialchars_decode( sprintf( $wp_new_user_notification_email_admin['subject'], $blogname ) ), $wp_new_user_notification_email_admin['message'], $wp_new_user_notification_email_admin['headers'] ); if ( $switched_locale ) { restore_previous_locale(); } } if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) { return; } $key = get_password_reset_key( $user ); if ( is_wp_error( $key ) ) { return; } $switched_locale = switch_to_locale( get_user_locale( $user ) ); $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; $message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n"; $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n"; $message .= wp_login_url() . "\r\n"; $wp_new_user_notification_email = array( 'to' => $user->user_email, 'subject' => __( '[%s] Login Details' ), 'message' => $message, 'headers' => '', ); $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname ); wp_mail( $wp_new_user_notification_email['to'], wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'], $blogname ) ), $wp_new_user_notification_email['message'], $wp_new_user_notification_email['headers'] ); if ( $switched_locale ) { restore_previous_locale(); } } endif; if ( ! function_exists( 'wp_nonce_tick' ) ) : function wp_nonce_tick() { $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS ); return ceil( time() / ( $nonce_life / 2 ) ); } endif; if ( ! function_exists( 'wp_verify_nonce' ) ) : function wp_verify_nonce( $nonce, $action = -1 ) { $nonce = (string) $nonce; $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) { $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } if ( empty( $nonce ) ) { return false; } $token = wp_get_session_token(); $i = wp_nonce_tick(); $expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); if ( hash_equals( $expected, $nonce ) ) { return 1; } $expected = substr( wp_hash( ( $i - 1 ) . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); if ( hash_equals( $expected, $nonce ) ) { return 2; } do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token ); return false; } endif; if ( ! function_exists( 'wp_create_nonce' ) ) : function wp_create_nonce( $action = -1 ) { $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) { $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } $token = wp_get_session_token(); $i = wp_nonce_tick(); return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); } endif; if ( ! function_exists( 'wp_salt' ) ) : function wp_salt( $scheme = 'auth' ) { static $cached_salts = array(); if ( isset( $cached_salts[ $scheme ] ) ) { return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme ); } static $duplicated_keys; if ( null === $duplicated_keys ) { $duplicated_keys = array( 'put your unique phrase here' => true ); foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) { foreach ( array( 'KEY', 'SALT' ) as $second ) { if ( ! defined( "{$first}_{$second}" ) ) { continue; } $value = constant( "{$first}_{$second}" ); $duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] ); } } } $values = array( 'key' => '', 'salt' => '', ); if ( defined( 'SECRET_KEY' ) && SECRET_KEY && empty( $duplicated_keys[ SECRET_KEY ] ) ) { $values['key'] = SECRET_KEY; } if ( 'auth' === $scheme && defined( 'SECRET_SALT' ) && SECRET_SALT && empty( $duplicated_keys[ SECRET_SALT ] ) ) { $values['salt'] = SECRET_SALT; } if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ), true ) ) { foreach ( array( 'key', 'salt' ) as $type ) { $const = strtoupper( "{$scheme}_{$type}" ); if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) { $values[ $type ] = constant( $const ); } elseif ( ! $values[ $type ] ) { $values[ $type ] = get_site_option( "{$scheme}_{$type}" ); if ( ! $values[ $type ] ) { $values[ $type ] = wp_generate_password( 64, true, true ); update_site_option( "{$scheme}_{$type}", $values[ $type ] ); } } } } else { if ( ! $values['key'] ) { $values['key'] = get_site_option( 'secret_key' ); if ( ! $values['key'] ) { $values['key'] = wp_generate_password( 64, true, true ); update_site_option( 'secret_key', $values['key'] ); } } $values['salt'] = hash_hmac( 'md5', $scheme, $values['key'] ); } $cached_salts[ $scheme ] = $values['key'] . $values['salt']; return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme ); } endif; if ( ! function_exists( 'wp_hash' ) ) : function wp_hash( $data, $scheme = 'auth' ) { $salt = wp_salt( $scheme ); return hash_hmac( 'md5', $data, $salt ); } endif; if ( ! function_exists( 'wp_hash_password' ) ) : function wp_hash_password( $password ) { global $wp_hasher; if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } return $wp_hasher->HashPassword( trim( $password ) ); } endif; if ( ! function_exists( 'wp_check_password' ) ) : function wp_check_password( $password, $hash, $user_id = '' ) { global $wp_hasher; if ( strlen( $hash ) <= 32 ) { $check = hash_equals( $hash, md5( $password ) ); if ( $check && $user_id ) { wp_set_password( $password, $user_id ); $hash = wp_hash_password( $password ); } return apply_filters( 'check_password', $check, $password, $hash, $user_id ); } if ( empty( $wp_hasher ) ) { require_once ABSPATH . WPINC . '/class-phpass.php'; $wp_hasher = new PasswordHash( 8, true ); } $check = $wp_hasher->CheckPassword( $password, $hash ); return apply_filters( 'check_password', $check, $password, $hash, $user_id ); } endif; if ( ! function_exists( 'wp_generate_password' ) ) : function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; if ( $special_chars ) { $chars .= '!@#$%^&*()'; } if ( $extra_special_chars ) { $chars .= '-_ []{}<>~`+=,.;:/?|'; } $password = ''; for ( $i = 0; $i < $length; $i++ ) { $password .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 ); } return apply_filters( 'random_password', $password, $length, $special_chars, $extra_special_chars ); } endif; if ( ! function_exists( 'wp_rand' ) ) : function wp_rand( $min = 0, $max = 0 ) { global $rnd_value; $max_random_number = 3000000000 === 2147483647 ? (float) '4294967295' : 4294967295; $min = (int) $min; $max = (int) $max; static $use_random_int_functionality = true; if ( $use_random_int_functionality ) { try { $_max = ( 0 != $max ) ? $max : $max_random_number; $_max = max( $min, $_max ); $_min = min( $min, $_max ); $val = random_int( $_min, $_max ); if ( false !== $val ) { return absint( $val ); } else { $use_random_int_functionality = false; } } catch ( Error $e ) { $use_random_int_functionality = false; } catch ( Exception $e ) { $use_random_int_functionality = false; } } if ( strlen( $rnd_value ) < 8 ) { if ( defined( 'WP_SETUP_CONFIG' ) ) { static $seed = ''; } else { $seed = get_transient( 'random_seed' ); } $rnd_value = md5( uniqid( microtime() . mt_rand(), true ) . $seed ); $rnd_value .= sha1( $rnd_value ); $rnd_value .= sha1( $rnd_value . $seed ); $seed = md5( $seed . $rnd_value ); if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) { set_transient( 'random_seed', $seed ); } } $value = substr( $rnd_value, 0, 8 ); $rnd_value = substr( $rnd_value, 8 ); $value = abs( hexdec( $value ) ); if ( 0 != $max ) { $value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 ); } return abs( (int) $value ); } endif; if ( ! function_exists( 'wp_set_password' ) ) : function wp_set_password( $password, $user_id ) { global $wpdb; $hash = wp_hash_password( $password ); $wpdb->update( $wpdb->users, array( 'user_pass' => $hash, 'user_activation_key' => '', ), array( 'ID' => $user_id ) ); clean_user_cache( $user_id ); } endif; if ( ! function_exists( 'get_avatar' ) ) : function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args = null ) { $defaults = array( 'size' => 96, 'height' => null, 'width' => null, 'default' => get_option( 'avatar_default', 'mystery' ), 'force_default' => false, 'rating' => get_option( 'avatar_rating' ), 'scheme' => null, 'alt' => '', 'class' => null, 'force_display' => false, 'loading' => null, 'extra_attr' => '', ); if ( wp_lazy_loading_enabled( 'img', 'get_avatar' ) ) { $defaults['loading'] = wp_get_loading_attr_default( 'get_avatar' ); } if ( empty( $args ) ) { $args = array(); } $args['size'] = (int) $size; $args['default'] = $default; $args['alt'] = $alt; $args = wp_parse_args( $args, $defaults ); if ( empty( $args['height'] ) ) { $args['height'] = $args['size']; } if ( empty( $args['width'] ) ) { $args['width'] = $args['size']; } if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { $id_or_email = get_comment( $id_or_email ); } $avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args ); if ( ! is_null( $avatar ) ) { return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args ); } if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) { return false; } $url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) ); $args = get_avatar_data( $id_or_email, $args ); $url = $args['url']; if ( ! $url || is_wp_error( $url ) ) { return false; } $class = array( 'avatar', 'avatar-' . (int) $args['size'], 'photo' ); if ( ! $args['found_avatar'] || $args['force_default'] ) { $class[] = 'avatar-default'; } if ( $args['class'] ) { if ( is_array( $args['class'] ) ) { $class = array_merge( $class, $args['class'] ); } else { $class[] = $args['class']; } } $extra_attr = $args['extra_attr']; $loading = $args['loading']; if ( in_array( $loading, array( 'lazy', 'eager' ), true ) && ! preg_match( '/\bloading\s*=/', $extra_attr ) ) { if ( ! empty( $extra_attr ) ) { $extra_attr .= ' '; } $extra_attr .= "loading='{$loading}'"; } $avatar = sprintf( "%s", esc_attr( $args['alt'] ), esc_url( $url ), esc_url( $url2x ) . ' 2x', esc_attr( implode( ' ', $class ) ), (int) $args['height'], (int) $args['width'], $extra_attr ); return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args ); } endif; if ( ! function_exists( 'wp_text_diff' ) ) : function wp_text_diff( $left_string, $right_string, $args = null ) { $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '', 'show_split_view' => true, ); $args = wp_parse_args( $args, $defaults ); if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) { require ABSPATH . WPINC . '/wp-diff.php'; } $left_string = normalize_whitespace( $left_string ); $right_string = normalize_whitespace( $right_string ); $left_lines = explode( "\n", $left_string ); $right_lines = explode( "\n", $right_string ); $text_diff = new Text_Diff( $left_lines, $right_lines ); $renderer = new WP_Text_Diff_Renderer_Table( $args ); $diff = $renderer->render( $text_diff ); if ( ! $diff ) { return ''; } $is_split_view = ! empty( $args['show_split_view'] ); $is_split_view_class = $is_split_view ? ' is-split-view' : ''; $r = "\n"; if ( $args['title'] ) { $r .= "\n"; } if ( $args['title_left'] || $args['title_right'] ) { $r .= ''; } if ( $args['title_left'] || $args['title_right'] ) { $th_or_td_left = empty( $args['title_left'] ) ? 'td' : 'th'; $th_or_td_right = empty( $args['title_right'] ) ? 'td' : 'th'; $r .= "\n"; $r .= "\t<$th_or_td_left>$args[title_left]\n"; if ( $is_split_view ) { $r .= "\t<$th_or_td_right>$args[title_right]\n"; } $r .= "\n"; } if ( $args['title_left'] || $args['title_right'] ) { $r .= "\n"; } $r .= "\n$diff\n\n"; $r .= '
                $args[title]
                '; return $r; } endif; 0 ) { if ( $flg & 4 ) { list($xlen) = unpack( 'v', substr( $gz_data, $i, 2 ) ); $i = $i + 2 + $xlen; } if ( $flg & 8 ) { $i = strpos( $gz_data, "\0", $i ) + 1; } if ( $flg & 16 ) { $i = strpos( $gz_data, "\0", $i ) + 1; } if ( $flg & 2 ) { $i = $i + 2; } } $decompressed = @gzinflate( substr( $gz_data, $i, -8 ) ); if ( false !== $decompressed ) { return $decompressed; } } $decompressed = @gzinflate( substr( $gz_data, 2 ) ); if ( false !== $decompressed ) { return $decompressed; } return false; } public static function accept_encoding( $url, $args ) { $type = array(); $compression_enabled = self::is_available(); if ( ! $args['decompress'] ) { $compression_enabled = false; } elseif ( $args['stream'] ) { $compression_enabled = false; } elseif ( isset( $args['limit_response_size'] ) ) { $compression_enabled = false; } if ( $compression_enabled ) { if ( function_exists( 'gzinflate' ) ) { $type[] = 'deflate;q=1.0'; } if ( function_exists( 'gzuncompress' ) ) { $type[] = 'compress;q=0.5'; } if ( function_exists( 'gzdecode' ) ) { $type[] = 'gzip;q=0.5'; } } $type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args ); return implode( ', ', $type ); } public static function content_encoding() { return 'deflate'; } public static function should_decode( $headers ) { if ( is_array( $headers ) ) { if ( array_key_exists( 'content-encoding', $headers ) && ! empty( $headers['content-encoding'] ) ) { return true; } } elseif ( is_string( $headers ) ) { return ( stripos( $headers, 'content-encoding:' ) !== false ); } return false; } public static function is_available() { return ( function_exists( 'gzuncompress' ) || function_exists( 'gzdeflate' ) || function_exists( 'gzinflate' ) ); } } get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->site} WHERE id = %d LIMIT 1", $network_id ) ); if ( empty( $_network ) || is_wp_error( $_network ) ) { $_network = -1; } wp_cache_add( $network_id, $_network, 'networks' ); } if ( is_numeric( $_network ) ) { return false; } return new WP_Network( $_network ); } public function __construct( $network ) { foreach ( get_object_vars( $network ) as $key => $value ) { $this->$key = $value; } $this->_set_site_name(); $this->_set_cookie_domain(); } public function __get( $key ) { switch ( $key ) { case 'id': return (int) $this->id; case 'blog_id': return (string) $this->get_main_site_id(); case 'site_id': return $this->get_main_site_id(); } return null; } public function __isset( $key ) { switch ( $key ) { case 'id': case 'blog_id': case 'site_id': return true; } return false; } public function __set( $key, $value ) { switch ( $key ) { case 'id': $this->id = (int) $value; break; case 'blog_id': case 'site_id': $this->blog_id = (string) $value; break; default: $this->$key = $value; } } private function get_main_site_id() { $main_site_id = (int) apply_filters( 'pre_get_main_site_id', null, $this ); if ( 0 < $main_site_id ) { return $main_site_id; } if ( 0 < (int) $this->blog_id ) { return (int) $this->blog_id; } if ( ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) && DOMAIN_CURRENT_SITE === $this->domain && PATH_CURRENT_SITE === $this->path ) || ( defined( 'SITE_ID_CURRENT_SITE' ) && SITE_ID_CURRENT_SITE == $this->id ) ) { if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) { $this->blog_id = (string) BLOG_ID_CURRENT_SITE; return (int) $this->blog_id; } if ( defined( 'BLOGID_CURRENT_SITE' ) ) { $this->blog_id = (string) BLOGID_CURRENT_SITE; return (int) $this->blog_id; } } $site = get_site(); if ( $site->domain === $this->domain && $site->path === $this->path ) { $main_site_id = (int) $site->id; } else { $cache_key = 'network:' . $this->id . ':main_site'; $main_site_id = wp_cache_get( $cache_key, 'site-options' ); if ( false === $main_site_id ) { $_sites = get_sites( array( 'fields' => 'ids', 'number' => 1, 'domain' => $this->domain, 'path' => $this->path, 'network_id' => $this->id, ) ); $main_site_id = ! empty( $_sites ) ? array_shift( $_sites ) : 0; wp_cache_add( $cache_key, $main_site_id, 'site-options' ); } } $this->blog_id = (string) $main_site_id; return (int) $this->blog_id; } private function _set_site_name() { if ( ! empty( $this->site_name ) ) { return; } $default = ucfirst( $this->domain ); $this->site_name = get_network_option( $this->id, 'site_name', $default ); } private function _set_cookie_domain() { if ( ! empty( $this->cookie_domain ) ) { return; } $this->cookie_domain = $this->domain; if ( 'www.' === substr( $this->cookie_domain, 0, 4 ) ) { $this->cookie_domain = substr( $this->cookie_domain, 4 ); } } public static function get_by_path( $domain = '', $path = '', $segments = null ) { $domains = array( $domain ); $pieces = explode( '.', $domain ); while ( array_shift( $pieces ) ) { if ( ! empty( $pieces ) ) { $domains[] = implode( '.', $pieces ); } } $using_paths = true; if ( wp_using_ext_object_cache() ) { $using_paths = get_networks( array( 'number' => 1, 'count' => true, 'path__not_in' => '/', ) ); } $paths = array(); if ( $using_paths ) { $path_segments = array_filter( explode( '/', trim( $path, '/' ) ) ); $segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path ); if ( ( null !== $segments ) && count( $path_segments ) > $segments ) { $path_segments = array_slice( $path_segments, 0, $segments ); } while ( count( $path_segments ) ) { $paths[] = '/' . implode( '/', $path_segments ) . '/'; array_pop( $path_segments ); } $paths[] = '/'; } $pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths ); if ( null !== $pre ) { return $pre; } if ( ! $using_paths ) { $networks = get_networks( array( 'number' => 1, 'orderby' => array( 'domain_length' => 'DESC', ), 'domain__in' => $domains, ) ); if ( ! empty( $networks ) ) { return array_shift( $networks ); } return false; } $networks = get_networks( array( 'orderby' => array( 'domain_length' => 'DESC', 'path_length' => 'DESC', ), 'domain__in' => $domains, 'path__in' => $paths, ) ); $found = false; foreach ( $networks as $network ) { if ( ( $network->domain === $domain ) || ( "www.{$network->domain}" === $domain ) ) { if ( in_array( $network->path, $paths, true ) ) { $found = true; break; } } if ( '/' === $network->path ) { $found = true; break; } } if ( true === $found ) { return $network; } return false; } } 268435456 ) { define( 'WP_MAX_MEMORY_LIMIT', $current_limit ); } else { define( 'WP_MAX_MEMORY_LIMIT', '256M' ); } } $wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT ); if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) { ini_set( 'memory_limit', WP_MEMORY_LIMIT ); } if ( ! isset( $blog_id ) ) { $blog_id = 1; } if ( ! defined( 'WP_CONTENT_DIR' ) ) { define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); } if ( ! defined( 'WP_DEBUG' ) ) { if ( 'development' === wp_get_environment_type() ) { define( 'WP_DEBUG', true ); } else { define( 'WP_DEBUG', false ); } } if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) { define( 'WP_DEBUG_DISPLAY', true ); } if ( ! defined( 'WP_DEBUG_LOG' ) ) { define( 'WP_DEBUG_LOG', false ); } if ( ! defined( 'WP_CACHE' ) ) { define( 'WP_CACHE', false ); } if ( ! defined( 'SCRIPT_DEBUG' ) ) { if ( ! empty( $wp_version ) ) { $develop_src = false !== strpos( $wp_version, '-src' ); } else { $develop_src = false; } define( 'SCRIPT_DEBUG', $develop_src ); } if ( ! defined( 'MEDIA_TRASH' ) ) { define( 'MEDIA_TRASH', false ); } if ( ! defined( 'SHORTINIT' ) ) { define( 'SHORTINIT', false ); } define( 'WP_FEATURE_BETTER_PASSWORDS', true ); define( 'MINUTE_IN_SECONDS', 60 ); define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS ); define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS ); define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS ); define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS ); define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS ); } function wp_plugin_directory_constants() { if ( ! defined( 'WP_CONTENT_URL' ) ) { define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); } if ( ! defined( 'WP_PLUGIN_DIR' ) ) { define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); } if ( ! defined( 'WP_PLUGIN_URL' ) ) { define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); } if ( ! defined( 'PLUGINDIR' ) ) { define( 'PLUGINDIR', 'wp-content/plugins' ); } if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) { define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); } if ( ! defined( 'WPMU_PLUGIN_URL' ) ) { define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); } if ( ! defined( 'MUPLUGINDIR' ) ) { define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); } } function wp_cookie_constants() { if ( ! defined( 'COOKIEHASH' ) ) { $siteurl = get_site_option( 'siteurl' ); if ( $siteurl ) { define( 'COOKIEHASH', md5( $siteurl ) ); } else { define( 'COOKIEHASH', '' ); } } if ( ! defined( 'USER_COOKIE' ) ) { define( 'USER_COOKIE', 'wordpressuser_' . COOKIEHASH ); } if ( ! defined( 'PASS_COOKIE' ) ) { define( 'PASS_COOKIE', 'wordpresspass_' . COOKIEHASH ); } if ( ! defined( 'AUTH_COOKIE' ) ) { define( 'AUTH_COOKIE', 'wordpress_' . COOKIEHASH ); } if ( ! defined( 'SECURE_AUTH_COOKIE' ) ) { define( 'SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH ); } if ( ! defined( 'LOGGED_IN_COOKIE' ) ) { define( 'LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH ); } if ( ! defined( 'TEST_COOKIE' ) ) { define( 'TEST_COOKIE', 'wordpress_test_cookie' ); } if ( ! defined( 'COOKIEPATH' ) ) { define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) ); } if ( ! defined( 'SITECOOKIEPATH' ) ) { define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) ); } if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); } if ( ! defined( 'PLUGINS_COOKIE_PATH' ) ) { define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) ); } if ( ! defined( 'COOKIE_DOMAIN' ) ) { define( 'COOKIE_DOMAIN', false ); } if ( ! defined( 'RECOVERY_MODE_COOKIE' ) ) { define( 'RECOVERY_MODE_COOKIE', 'wordpress_rec_' . COOKIEHASH ); } } function wp_ssl_constants() { if ( ! defined( 'FORCE_SSL_ADMIN' ) ) { if ( 'https' === parse_url( get_option( 'siteurl' ), PHP_URL_SCHEME ) ) { define( 'FORCE_SSL_ADMIN', true ); } else { define( 'FORCE_SSL_ADMIN', false ); } } force_ssl_admin( FORCE_SSL_ADMIN ); if ( defined( 'FORCE_SSL_LOGIN' ) && FORCE_SSL_LOGIN ) { force_ssl_admin( true ); } } function wp_functionality_constants() { if ( ! defined( 'AUTOSAVE_INTERVAL' ) ) { define( 'AUTOSAVE_INTERVAL', MINUTE_IN_SECONDS ); } if ( ! defined( 'EMPTY_TRASH_DAYS' ) ) { define( 'EMPTY_TRASH_DAYS', 30 ); } if ( ! defined( 'WP_POST_REVISIONS' ) ) { define( 'WP_POST_REVISIONS', true ); } if ( ! defined( 'WP_CRON_LOCK_TIMEOUT' ) ) { define( 'WP_CRON_LOCK_TIMEOUT', MINUTE_IN_SECONDS ); } } function wp_templating_constants() { define( 'TEMPLATEPATH', get_template_directory() ); define( 'STYLESHEETPATH', get_stylesheet_directory() ); if ( ! defined( 'WP_DEFAULT_THEME' ) ) { define( 'WP_DEFAULT_THEME', 'twentytwentytwo' ); } } settings = array( 'term' => array( 'filter' => 'get_term_metadata', 'callback' => array( $this, 'lazyload_term_meta' ), ), 'comment' => array( 'filter' => 'get_comment_metadata', 'callback' => array( $this, 'lazyload_comment_meta' ), ), ); } public function queue_objects( $object_type, $object_ids ) { if ( ! isset( $this->settings[ $object_type ] ) ) { return new WP_Error( 'invalid_object_type', __( 'Invalid object type.' ) ); } $type_settings = $this->settings[ $object_type ]; if ( ! isset( $this->pending_objects[ $object_type ] ) ) { $this->pending_objects[ $object_type ] = array(); } foreach ( $object_ids as $object_id ) { if ( ! isset( $this->pending_objects[ $object_type ][ $object_id ] ) ) { $this->pending_objects[ $object_type ][ $object_id ] = 1; } } add_filter( $type_settings['filter'], $type_settings['callback'] ); do_action( 'metadata_lazyloader_queued_objects', $object_ids, $object_type, $this ); } public function reset_queue( $object_type ) { if ( ! isset( $this->settings[ $object_type ] ) ) { return new WP_Error( 'invalid_object_type', __( 'Invalid object type.' ) ); } $type_settings = $this->settings[ $object_type ]; $this->pending_objects[ $object_type ] = array(); remove_filter( $type_settings['filter'], $type_settings['callback'] ); } public function lazyload_term_meta( $check ) { if ( ! empty( $this->pending_objects['term'] ) ) { update_termmeta_cache( array_keys( $this->pending_objects['term'] ) ); $this->reset_queue( 'term' ); } return $check; } public function lazyload_comment_meta( $check ) { if ( ! empty( $this->pending_objects['comment'] ) ) { update_meta_cache( 'comment', array_keys( $this->pending_objects['comment'] ) ); $this->reset_queue( 'comment' ); } return $check; } } get( $var, $default ); } function get_queried_object() { global $wp_query; return $wp_query->get_queried_object(); } function get_queried_object_id() { global $wp_query; return $wp_query->get_queried_object_id(); } function set_query_var( $var, $value ) { global $wp_query; $wp_query->set( $var, $value ); } function query_posts( $query ) { $GLOBALS['wp_query'] = new WP_Query(); return $GLOBALS['wp_query']->query( $query ); } function wp_reset_query() { $GLOBALS['wp_query'] = $GLOBALS['wp_the_query']; wp_reset_postdata(); } function wp_reset_postdata() { global $wp_query; if ( isset( $wp_query ) ) { $wp_query->reset_postdata(); } } function is_archive() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_archive(); } function is_post_type_archive( $post_types = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_post_type_archive( $post_types ); } function is_attachment( $attachment = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_attachment( $attachment ); } function is_author( $author = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_author( $author ); } function is_category( $category = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_category( $category ); } function is_tag( $tag = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_tag( $tag ); } function is_tax( $taxonomy = '', $term = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_tax( $taxonomy, $term ); } function is_date() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_date(); } function is_day() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_day(); } function is_feed( $feeds = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_feed( $feeds ); } function is_comment_feed() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_comment_feed(); } function is_front_page() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_front_page(); } function is_home() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_home(); } function is_privacy_policy() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_privacy_policy(); } function is_month() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_month(); } function is_page( $page = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_page( $page ); } function is_paged() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_paged(); } function is_preview() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_preview(); } function is_robots() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_robots(); } function is_favicon() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_favicon(); } function is_search() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_search(); } function is_single( $post = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_single( $post ); } function is_singular( $post_types = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_singular( $post_types ); } function is_time() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_time(); } function is_trackback() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_trackback(); } function is_year() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_year(); } function is_404() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_404(); } function is_embed() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_embed(); } function is_main_query() { global $wp_query; if ( 'pre_get_posts' === current_filter() ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ), 'pre_get_posts', 'WP_Query->is_main_query()', 'is_main_query()', __( 'https://developer.wordpress.org/reference/functions/is_main_query/' ) ), '3.7.0' ); } return $wp_query->is_main_query(); } function have_posts() { global $wp_query; return $wp_query->have_posts(); } function in_the_loop() { global $wp_query; return $wp_query->in_the_loop; } function rewind_posts() { global $wp_query; $wp_query->rewind_posts(); } function the_post() { global $wp_query; $wp_query->the_post(); } function have_comments() { global $wp_query; return $wp_query->have_comments(); } function the_comment() { global $wp_query; return $wp_query->the_comment(); } function wp_old_slug_redirect() { if ( is_404() && '' !== get_query_var( 'name' ) ) { if ( get_query_var( 'post_type' ) ) { $post_type = get_query_var( 'post_type' ); } elseif ( get_query_var( 'attachment' ) ) { $post_type = 'attachment'; } elseif ( get_query_var( 'pagename' ) ) { $post_type = 'page'; } else { $post_type = 'post'; } if ( is_array( $post_type ) ) { if ( count( $post_type ) > 1 ) { return; } $post_type = reset( $post_type ); } if ( is_post_type_hierarchical( $post_type ) ) { return; } $id = _find_post_by_old_slug( $post_type ); if ( ! $id ) { $id = _find_post_by_old_date( $post_type ); } $id = apply_filters( 'old_slug_redirect_post_id', $id ); if ( ! $id ) { return; } $link = get_permalink( $id ); if ( get_query_var( 'paged' ) > 1 ) { $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . get_query_var( 'paged' ) ); } elseif ( is_embed() ) { $link = user_trailingslashit( trailingslashit( $link ) . 'embed' ); } $link = apply_filters( 'old_slug_redirect_url', $link ); if ( ! $link ) { return; } wp_redirect( $link, 301 ); exit; } } function _find_post_by_old_slug( $post_type ) { global $wpdb; $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, get_query_var( 'name' ) ); if ( get_query_var( 'year' ) ) { $query .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) ); } if ( get_query_var( 'monthnum' ) ) { $query .= $wpdb->prepare( ' AND MONTH(post_date) = %d', get_query_var( 'monthnum' ) ); } if ( get_query_var( 'day' ) ) { $query .= $wpdb->prepare( ' AND DAYOFMONTH(post_date) = %d', get_query_var( 'day' ) ); } $id = (int) $wpdb->get_var( $query ); return $id; } function _find_post_by_old_date( $post_type ) { global $wpdb; $date_query = ''; if ( get_query_var( 'year' ) ) { $date_query .= $wpdb->prepare( ' AND YEAR(pm_date.meta_value) = %d', get_query_var( 'year' ) ); } if ( get_query_var( 'monthnum' ) ) { $date_query .= $wpdb->prepare( ' AND MONTH(pm_date.meta_value) = %d', get_query_var( 'monthnum' ) ); } if ( get_query_var( 'day' ) ) { $date_query .= $wpdb->prepare( ' AND DAYOFMONTH(pm_date.meta_value) = %d', get_query_var( 'day' ) ); } $id = 0; if ( $date_query ) { $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta AS pm_date, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_date' AND post_name = %s" . $date_query, $post_type, get_query_var( 'name' ) ) ); if ( ! $id ) { $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts, $wpdb->postmeta AS pm_slug, $wpdb->postmeta AS pm_date WHERE ID = pm_slug.post_id AND ID = pm_date.post_id AND post_type = %s AND pm_slug.meta_key = '_wp_old_slug' AND pm_slug.meta_value = %s AND pm_date.meta_key = '_wp_old_date'" . $date_query, $post_type, get_query_var( 'name' ) ) ); } } return $id; } function setup_postdata( $post ) { global $wp_query; if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) { return $wp_query->setup_postdata( $post ); } return false; } function generate_postdata( $post ) { global $wp_query; if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) { return $wp_query->generate_postdata( $post ); } return false; } 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null, 'cookies' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); if ( isset( $parsed_args['headers']['User-Agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent']; unset( $parsed_args['headers']['User-Agent'] ); } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['user-agent']; unset( $parsed_args['headers']['user-agent'] ); } WP_Http::buildCookieHeader( $parsed_args ); $handle = curl_init(); $proxy = new WP_HTTP_Proxy(); if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() ); curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() ); if ( $proxy->use_authentication() ) { curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() ); } } $is_local = isset( $parsed_args['local'] ) && $parsed_args['local']; $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify']; if ( $is_local ) { $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url ); } elseif ( ! $is_local ) { $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url ); } $timeout = (int) ceil( $parsed_args['timeout'] ); curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); curl_setopt( $handle, CURLOPT_URL, $url ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( true === $ssl_verify ) ? 2 : false ); curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); if ( $ssl_verify ) { curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] ); } curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] ); curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false ); curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS ); switch ( $parsed_args['method'] ) { case 'HEAD': curl_setopt( $handle, CURLOPT_NOBODY, true ); break; case 'POST': curl_setopt( $handle, CURLOPT_POST, true ); curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); break; case 'PUT': curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' ); curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); break; default: curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $parsed_args['method'] ); if ( ! is_null( $parsed_args['body'] ) ) { curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); } break; } if ( true === $parsed_args['blocking'] ) { curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) ); curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) ); } curl_setopt( $handle, CURLOPT_HEADER, false ); if ( isset( $parsed_args['limit_response_size'] ) ) { $this->max_body_length = (int) $parsed_args['limit_response_size']; } else { $this->max_body_length = false; } if ( $parsed_args['stream'] ) { if ( ! WP_DEBUG ) { $this->stream_handle = @fopen( $parsed_args['filename'], 'w+' ); } else { $this->stream_handle = fopen( $parsed_args['filename'], 'w+' ); } if ( ! $this->stream_handle ) { return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for %1$s to %2$s.' ), 'fopen()', $parsed_args['filename'] ) ); } } else { $this->stream_handle = false; } if ( ! empty( $parsed_args['headers'] ) ) { $headers = array(); foreach ( $parsed_args['headers'] as $name => $value ) { $headers[] = "{$name}: $value"; } curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); } if ( '1.0' === $parsed_args['httpversion'] ) { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); } else { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); } do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) ); if ( ! $parsed_args['blocking'] ) { curl_exec( $handle ); $curl_error = curl_error( $handle ); if ( $curl_error ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', $curl_error ); } if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } curl_close( $handle ); return array( 'headers' => array(), 'body' => '', 'response' => array( 'code' => false, 'message' => false, ), 'cookies' => array(), ); } curl_exec( $handle ); $processed_headers = WP_Http::processHeaders( $this->headers, $url ); $body = $this->body; $bytes_written_total = $this->bytes_written_total; $this->headers = ''; $this->body = ''; $this->bytes_written_total = 0; $curl_error = curl_errno( $handle ); if ( $curl_error || ( 0 === strlen( $body ) && empty( $processed_headers['headers'] ) ) ) { if ( CURLE_WRITE_ERROR === $curl_error ) { if ( ! $this->max_body_length || $this->max_body_length !== $bytes_written_total ) { if ( $parsed_args['stream'] ) { curl_close( $handle ); fclose( $this->stream_handle ); return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); } else { curl_close( $handle ); return new WP_Error( 'http_request_failed', curl_error( $handle ) ); } } } else { $curl_error = curl_error( $handle ); if ( $curl_error ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', $curl_error ); } } if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } } curl_close( $handle ); if ( $parsed_args['stream'] ) { fclose( $this->stream_handle ); } $response = array( 'headers' => $processed_headers['headers'], 'body' => null, 'response' => $processed_headers['response'], 'cookies' => $processed_headers['cookies'], 'filename' => $parsed_args['filename'], ); $redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response ); if ( false !== $redirect_response ) { return $redirect_response; } if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $processed_headers['headers'] ) ) { $body = WP_Http_Encoding::decompress( $body ); } $response['body'] = $body; return $response; } private function stream_headers( $handle, $headers ) { $this->headers .= $headers; return strlen( $headers ); } private function stream_body( $handle, $data ) { $data_length = strlen( $data ); if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) { $data_length = ( $this->max_body_length - $this->bytes_written_total ); $data = substr( $data, 0, $data_length ); } if ( $this->stream_handle ) { $bytes_written = fwrite( $this->stream_handle, $data ); } else { $this->body .= $data; $bytes_written = $data_length; } $this->bytes_written_total += $bytes_written; return $bytes_written; } public static function test( $args = array() ) { if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) { return false; } $is_ssl = isset( $args['ssl'] ) && $args['ssl']; if ( $is_ssl ) { $curl_version = curl_version(); if ( ! ( CURL_VERSION_SSL & $curl_version['features'] ) ) { return false; } } return apply_filters( 'use_curl_transport', true, $args ); } } array( '' ), 'where' => array( '0 = 1' ), ); protected $table_aliases = array(); public $queried_terms = array(); public $primary_table; public $primary_id_column; public function __construct( $tax_query ) { if ( isset( $tax_query['relation'] ) ) { $this->relation = $this->sanitize_relation( $tax_query['relation'] ); } else { $this->relation = 'AND'; } $this->queries = $this->sanitize_query( $tax_query ); } public function sanitize_query( $queries ) { $cleaned_query = array(); $defaults = array( 'taxonomy' => '', 'terms' => array(), 'field' => 'term_id', 'operator' => 'IN', 'include_children' => true, ); foreach ( $queries as $key => $query ) { if ( 'relation' === $key ) { $cleaned_query['relation'] = $this->sanitize_relation( $query ); } elseif ( self::is_first_order_clause( $query ) ) { $cleaned_clause = array_merge( $defaults, $query ); $cleaned_clause['terms'] = (array) $cleaned_clause['terms']; $cleaned_query[] = $cleaned_clause; if ( ! empty( $cleaned_clause['taxonomy'] ) && 'NOT IN' !== $cleaned_clause['operator'] ) { $taxonomy = $cleaned_clause['taxonomy']; if ( ! isset( $this->queried_terms[ $taxonomy ] ) ) { $this->queried_terms[ $taxonomy ] = array(); } if ( ! empty( $cleaned_clause['terms'] ) && ! isset( $this->queried_terms[ $taxonomy ]['terms'] ) ) { $this->queried_terms[ $taxonomy ]['terms'] = $cleaned_clause['terms']; } if ( ! empty( $cleaned_clause['field'] ) && ! isset( $this->queried_terms[ $taxonomy ]['field'] ) ) { $this->queried_terms[ $taxonomy ]['field'] = $cleaned_clause['field']; } } } elseif ( is_array( $query ) ) { $cleaned_subquery = $this->sanitize_query( $query ); if ( ! empty( $cleaned_subquery ) ) { if ( ! isset( $cleaned_subquery['relation'] ) ) { $cleaned_subquery['relation'] = 'AND'; } $cleaned_query[] = $cleaned_subquery; } } } return $cleaned_query; } public function sanitize_relation( $relation ) { if ( 'OR' === strtoupper( $relation ) ) { return 'OR'; } else { return 'AND'; } } protected static function is_first_order_clause( $query ) { return is_array( $query ) && ( empty( $query ) || array_key_exists( 'terms', $query ) || array_key_exists( 'taxonomy', $query ) || array_key_exists( 'include_children', $query ) || array_key_exists( 'field', $query ) || array_key_exists( 'operator', $query ) ); } public function get_sql( $primary_table, $primary_id_column ) { $this->primary_table = $primary_table; $this->primary_id_column = $primary_id_column; return $this->get_sql_clauses(); } protected function get_sql_clauses() { $queries = $this->queries; $sql = $this->get_sql_for_query( $queries ); if ( ! empty( $sql['where'] ) ) { $sql['where'] = ' AND ' . $sql['where']; } return $sql; } protected function get_sql_for_query( &$query, $depth = 0 ) { $sql_chunks = array( 'join' => array(), 'where' => array(), ); $sql = array( 'join' => '', 'where' => '', ); $indent = ''; for ( $i = 0; $i < $depth; $i++ ) { $indent .= ' '; } foreach ( $query as $key => &$clause ) { if ( 'relation' === $key ) { $relation = $query['relation']; } elseif ( is_array( $clause ) ) { if ( $this->is_first_order_clause( $clause ) ) { $clause_sql = $this->get_sql_for_clause( $clause, $query ); $where_count = count( $clause_sql['where'] ); if ( ! $where_count ) { $sql_chunks['where'][] = ''; } elseif ( 1 === $where_count ) { $sql_chunks['where'][] = $clause_sql['where'][0]; } else { $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; } $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); } else { $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); $sql_chunks['where'][] = $clause_sql['where']; $sql_chunks['join'][] = $clause_sql['join']; } } } $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); if ( empty( $relation ) ) { $relation = 'AND'; } if ( ! empty( $sql_chunks['join'] ) ) { $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); } if ( ! empty( $sql_chunks['where'] ) ) { $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; } return $sql; } public function get_sql_for_clause( &$clause, $parent_query ) { global $wpdb; $sql = array( 'where' => array(), 'join' => array(), ); $join = ''; $where = ''; $this->clean_query( $clause ); if ( is_wp_error( $clause ) ) { return self::$no_results; } $terms = $clause['terms']; $operator = strtoupper( $clause['operator'] ); if ( 'IN' === $operator ) { if ( empty( $terms ) ) { return self::$no_results; } $terms = implode( ',', $terms ); $alias = $this->find_compatible_table_alias( $clause, $parent_query ); if ( false === $alias ) { $i = count( $this->table_aliases ); $alias = $i ? 'tt' . $i : $wpdb->term_relationships; $this->table_aliases[] = $alias; $clause['alias'] = $alias; $join .= " LEFT JOIN $wpdb->term_relationships"; $join .= $i ? " AS $alias" : ''; $join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)"; } $where = "$alias.term_taxonomy_id $operator ($terms)"; } elseif ( 'NOT IN' === $operator ) { if ( empty( $terms ) ) { return $sql; } $terms = implode( ',', $terms ); $where = "$this->primary_table.$this->primary_id_column NOT IN ( - SELECT object_id - FROM $wpdb->term_relationships - WHERE term_taxonomy_id IN ($terms) - )"; } elseif ( 'AND' === $operator ) { if ( empty( $terms ) ) { return $sql; } $num_terms = count( $terms ); $terms = implode( ',', $terms ); $where = "( - SELECT COUNT(1) - FROM $wpdb->term_relationships - WHERE term_taxonomy_id IN ($terms) - AND object_id = $this->primary_table.$this->primary_id_column - ) = $num_terms"; } elseif ( 'NOT EXISTS' === $operator || 'EXISTS' === $operator ) { $where = $wpdb->prepare( "$operator ( - SELECT 1 - FROM $wpdb->term_relationships - INNER JOIN $wpdb->term_taxonomy - ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id - WHERE $wpdb->term_taxonomy.taxonomy = %s - AND $wpdb->term_relationships.object_id = $this->primary_table.$this->primary_id_column - )", $clause['taxonomy'] ); } $sql['join'][] = $join; $sql['where'][] = $where; return $sql; } protected function find_compatible_table_alias( $clause, $parent_query ) { $alias = false; if ( ! isset( $clause['operator'] ) || 'IN' !== $clause['operator'] ) { return $alias; } if ( ! isset( $parent_query['relation'] ) || 'OR' !== $parent_query['relation'] ) { return $alias; } $compatible_operators = array( 'IN' ); foreach ( $parent_query as $sibling ) { if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) { continue; } if ( empty( $sibling['alias'] ) || empty( $sibling['operator'] ) ) { continue; } if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators, true ) ) { $alias = preg_replace( '/\W/', '_', $sibling['alias'] ); break; } } return $alias; } private function clean_query( &$query ) { if ( empty( $query['taxonomy'] ) ) { if ( 'term_taxonomy_id' !== $query['field'] ) { $query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); return; } $query['include_children'] = false; } elseif ( ! taxonomy_exists( $query['taxonomy'] ) ) { $query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); return; } if ( 'slug' === $query['field'] || 'name' === $query['field'] ) { $query['terms'] = array_unique( (array) $query['terms'] ); } else { $query['terms'] = wp_parse_id_list( $query['terms'] ); } if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) { $this->transform_query( $query, 'term_id' ); if ( is_wp_error( $query ) ) { return; } $children = array(); foreach ( $query['terms'] as $term ) { $children = array_merge( $children, get_term_children( $term, $query['taxonomy'] ) ); $children[] = $term; } $query['terms'] = $children; } $this->transform_query( $query, 'term_taxonomy_id' ); } public function transform_query( &$query, $resulting_field ) { if ( empty( $query['terms'] ) ) { return; } if ( $query['field'] == $resulting_field ) { return; } $resulting_field = sanitize_key( $resulting_field ); $terms = array_filter( $query['terms'] ); if ( empty( $terms ) ) { $query['terms'] = array(); $query['field'] = $resulting_field; return; } $args = array( 'get' => 'all', 'number' => 0, 'taxonomy' => $query['taxonomy'], 'update_term_meta_cache' => false, 'orderby' => 'none', ); switch ( $query['field'] ) { case 'slug': $args['slug'] = $terms; break; case 'name': $args['name'] = $terms; break; case 'term_taxonomy_id': $args['term_taxonomy_id'] = $terms; break; default: $args['include'] = wp_parse_id_list( $terms ); break; } if ( ! is_taxonomy_hierarchical( $query['taxonomy'] ) ) { $args['number'] = count( $terms ); } $term_query = new WP_Term_Query(); $term_list = $term_query->query( $args ); if ( is_wp_error( $term_list ) ) { $query = $term_list; return; } if ( 'AND' === $query['operator'] && count( $term_list ) < count( $query['terms'] ) ) { $query = new WP_Error( 'inexistent_terms', __( 'Inexistent terms.' ) ); return; } $query['terms'] = wp_list_pluck( $term_list, $resulting_field ); $query['field'] = $resulting_field; } } 1 && $str = array_pop( $pieces ) ); return implode( '', array_slice( $chars, $start, $length ) ); } if ( ! function_exists( 'mb_strlen' ) ) : function mb_strlen( $str, $encoding = null ) { return _mb_strlen( $str, $encoding ); } endif; function _mb_strlen( $str, $encoding = null ) { if ( null === $encoding ) { $encoding = get_option( 'blog_charset' ); } if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) { return strlen( $str ); } if ( _wp_can_use_pcre_u() ) { preg_match_all( '/./us', $str, $match ); return count( $match[0] ); } $regex = '/(?: - [\x00-\x7F] # single-byte sequences 0xxxxxxx - | [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx - | \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2 - | [\xE1-\xEC][\x80-\xBF]{2} - | \xED[\x80-\x9F][\x80-\xBF] - | [\xEE-\xEF][\x80-\xBF]{2} - | \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3 - | [\xF1-\xF3][\x80-\xBF]{3} - | \xF4[\x80-\x8F][\x80-\xBF]{2} - )/x'; $count = 1; do { $count--; $pieces = preg_split( $regex, $str, 1000 ); $count += count( $pieces ); } while ( $str = array_pop( $pieces ) ); return --$count; } if ( ! function_exists( 'hash_hmac' ) ) : function hash_hmac( $algo, $data, $key, $raw_output = false ) { return _hash_hmac( $algo, $data, $key, $raw_output ); } endif; function _hash_hmac( $algo, $data, $key, $raw_output = false ) { $packs = array( 'md5' => 'H32', 'sha1' => 'H40', ); if ( ! isset( $packs[ $algo ] ) ) { return false; } $pack = $packs[ $algo ]; if ( strlen( $key ) > 64 ) { $key = pack( $pack, $algo( $key ) ); } $key = str_pad( $key, 64, chr( 0 ) ); $ipad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x36 ), 64 ) ); $opad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x5C ), 64 ) ); $hmac = $algo( $opad . pack( $pack, $algo( $ipad . $data ) ) ); if ( $raw_output ) { return pack( $pack, $hmac ); } return $hmac; } if ( ! function_exists( 'hash_equals' ) ) : function hash_equals( $a, $b ) { $a_length = strlen( $a ); if ( strlen( $b ) !== $a_length ) { return false; } $result = 0; for ( $i = 0; $i < $a_length; $i++ ) { $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] ); } return 0 === $result; } endif; if ( ! function_exists( 'random_int' ) ) { require ABSPATH . WPINC . '/random_compat/random.php'; } if ( ! function_exists( 'sodium_crypto_box' ) ) { require ABSPATH . WPINC . '/sodium_compat/autoload.php'; } if ( ! function_exists( 'is_countable' ) ) { function is_countable( $var ) { return ( is_array( $var ) || $var instanceof Countable || $var instanceof SimpleXMLElement || $var instanceof ResourceBundle ); } } if ( ! function_exists( 'is_iterable' ) ) { function is_iterable( $var ) { return ( is_array( $var ) || $var instanceof Traversable ); } } if ( ! function_exists( 'array_key_first' ) ) { function array_key_first( array $arr ) { foreach ( $arr as $key => $value ) { return $key; } } } if ( ! function_exists( 'array_key_last' ) ) { function array_key_last( array $arr ) { if ( empty( $arr ) ) { return null; } end( $arr ); return key( $arr ); } } if ( ! function_exists( 'str_contains' ) ) { function str_contains( $haystack, $needle ) { return ( '' === $needle || false !== strpos( $haystack, $needle ) ); } } if ( ! function_exists( 'str_starts_with' ) ) { function str_starts_with( $haystack, $needle ) { if ( '' === $needle ) { return true; } return 0 === strpos( $haystack, $needle ); } } if ( ! function_exists( 'str_ends_with' ) ) { function str_ends_with( $haystack, $needle ) { if ( '' === $haystack && '' !== $needle ) { return false; } $len = strlen( $needle ); return 0 === substr_compare( $haystack, $needle, -$len, $len ); } } if ( ! defined( 'IMAGETYPE_WEBP' ) ) { define( 'IMAGETYPE_WEBP', 18 ); } if ( ! defined( 'IMG_WEBP' ) ) { define( 'IMG_WEBP', IMAGETYPE_WEBP ); } is_single = false; $this->is_preview = false; $this->is_page = false; $this->is_archive = false; $this->is_date = false; $this->is_year = false; $this->is_month = false; $this->is_day = false; $this->is_time = false; $this->is_author = false; $this->is_category = false; $this->is_tag = false; $this->is_tax = false; $this->is_search = false; $this->is_feed = false; $this->is_comment_feed = false; $this->is_trackback = false; $this->is_home = false; $this->is_privacy_policy = false; $this->is_404 = false; $this->is_paged = false; $this->is_admin = false; $this->is_attachment = false; $this->is_singular = false; $this->is_robots = false; $this->is_favicon = false; $this->is_posts_page = false; $this->is_post_type_archive = false; } public function init() { unset( $this->posts ); unset( $this->query ); $this->query_vars = array(); unset( $this->queried_object ); unset( $this->queried_object_id ); $this->post_count = 0; $this->current_post = -1; $this->in_the_loop = false; unset( $this->request ); unset( $this->post ); unset( $this->comments ); unset( $this->comment ); $this->comment_count = 0; $this->current_comment = -1; $this->found_posts = 0; $this->max_num_pages = 0; $this->max_num_comment_pages = 0; $this->init_query_flags(); } public function parse_query_vars() { $this->parse_query(); } public function fill_query_vars( $query_vars ) { $keys = array( 'error', 'm', 'p', 'post_parent', 'subpost', 'subpost_id', 'attachment', 'attachment_id', 'name', 'pagename', 'page_id', 'second', 'minute', 'hour', 'day', 'monthnum', 'year', 'w', 'category_name', 'tag', 'cat', 'tag_id', 'author', 'author_name', 'feed', 'tb', 'paged', 'meta_key', 'meta_value', 'preview', 's', 'sentence', 'title', 'fields', 'menu_order', 'embed', ); foreach ( $keys as $key ) { if ( ! isset( $query_vars[ $key ] ) ) { $query_vars[ $key ] = ''; } } $array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in', 'author__in', 'author__not_in', ); foreach ( $array_keys as $key ) { if ( ! isset( $query_vars[ $key ] ) ) { $query_vars[ $key ] = array(); } } return $query_vars; } public function parse_query( $query = '' ) { if ( ! empty( $query ) ) { $this->init(); $this->query = wp_parse_args( $query ); $this->query_vars = $this->query; } elseif ( ! isset( $this->query ) ) { $this->query = $this->query_vars; } $this->query_vars = $this->fill_query_vars( $this->query_vars ); $qv = &$this->query_vars; $this->query_vars_changed = true; if ( ! empty( $qv['robots'] ) ) { $this->is_robots = true; } elseif ( ! empty( $qv['favicon'] ) ) { $this->is_favicon = true; } if ( ! is_scalar( $qv['p'] ) || (int) $qv['p'] < 0 ) { $qv['p'] = 0; $qv['error'] = '404'; } else { $qv['p'] = (int) $qv['p']; } $qv['page_id'] = absint( $qv['page_id'] ); $qv['year'] = absint( $qv['year'] ); $qv['monthnum'] = absint( $qv['monthnum'] ); $qv['day'] = absint( $qv['day'] ); $qv['w'] = absint( $qv['w'] ); $qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : ''; $qv['paged'] = absint( $qv['paged'] ); $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); $qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); $qv['pagename'] = trim( $qv['pagename'] ); $qv['name'] = trim( $qv['name'] ); $qv['title'] = trim( $qv['title'] ); if ( '' !== $qv['hour'] ) { $qv['hour'] = absint( $qv['hour'] ); } if ( '' !== $qv['minute'] ) { $qv['minute'] = absint( $qv['minute'] ); } if ( '' !== $qv['second'] ) { $qv['second'] = absint( $qv['second'] ); } if ( '' !== $qv['menu_order'] ) { $qv['menu_order'] = absint( $qv['menu_order'] ); } if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) { $qv['s'] = ''; } if ( '' != $qv['subpost'] ) { $qv['attachment'] = $qv['subpost']; } if ( '' != $qv['subpost_id'] ) { $qv['attachment_id'] = $qv['subpost_id']; } $qv['attachment_id'] = absint( $qv['attachment_id'] ); if ( ( '' !== $qv['attachment'] ) || ! empty( $qv['attachment_id'] ) ) { $this->is_single = true; $this->is_attachment = true; } elseif ( '' !== $qv['name'] ) { $this->is_single = true; } elseif ( $qv['p'] ) { $this->is_single = true; } elseif ( '' !== $qv['pagename'] || ! empty( $qv['page_id'] ) ) { $this->is_page = true; $this->is_single = false; } else { if ( isset( $this->query['s'] ) ) { $this->is_search = true; } if ( '' !== $qv['second'] ) { $this->is_time = true; $this->is_date = true; } if ( '' !== $qv['minute'] ) { $this->is_time = true; $this->is_date = true; } if ( '' !== $qv['hour'] ) { $this->is_time = true; $this->is_date = true; } if ( $qv['day'] ) { if ( ! $this->is_date ) { $date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] ); if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) { $qv['error'] = '404'; } else { $this->is_day = true; $this->is_date = true; } } } if ( $qv['monthnum'] ) { if ( ! $this->is_date ) { if ( 12 < $qv['monthnum'] ) { $qv['error'] = '404'; } else { $this->is_month = true; $this->is_date = true; } } } if ( $qv['year'] ) { if ( ! $this->is_date ) { $this->is_year = true; $this->is_date = true; } } if ( $qv['m'] ) { $this->is_date = true; if ( strlen( $qv['m'] ) > 9 ) { $this->is_time = true; } elseif ( strlen( $qv['m'] ) > 7 ) { $this->is_day = true; } elseif ( strlen( $qv['m'] ) > 5 ) { $this->is_month = true; } else { $this->is_year = true; } } if ( $qv['w'] ) { $this->is_date = true; } $this->query_vars_hash = false; $this->parse_tax_query( $qv ); foreach ( $this->tax_query->queries as $tax_query ) { if ( ! is_array( $tax_query ) ) { continue; } if ( isset( $tax_query['operator'] ) && 'NOT IN' !== $tax_query['operator'] ) { switch ( $tax_query['taxonomy'] ) { case 'category': $this->is_category = true; break; case 'post_tag': $this->is_tag = true; break; default: $this->is_tax = true; } } } unset( $tax_query ); if ( empty( $qv['author'] ) || ( '0' == $qv['author'] ) ) { $this->is_author = false; } else { $this->is_author = true; } if ( '' !== $qv['author_name'] ) { $this->is_author = true; } if ( ! empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) { $post_type_obj = get_post_type_object( $qv['post_type'] ); if ( ! empty( $post_type_obj->has_archive ) ) { $this->is_post_type_archive = true; } } if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) { $this->is_archive = true; } } if ( '' != $qv['feed'] ) { $this->is_feed = true; } if ( '' != $qv['embed'] ) { $this->is_embed = true; } if ( '' != $qv['tb'] ) { $this->is_trackback = true; } if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) { $this->is_paged = true; } if ( '' != $qv['preview'] ) { $this->is_preview = true; } if ( is_admin() ) { $this->is_admin = true; } if ( false !== strpos( $qv['feed'], 'comments-' ) ) { $qv['feed'] = str_replace( 'comments-', '', $qv['feed'] ); $qv['withcomments'] = 1; } $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment; if ( $this->is_feed && ( ! empty( $qv['withcomments'] ) || ( empty( $qv['withoutcomments'] ) && $this->is_singular ) ) ) { $this->is_comment_feed = true; } if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST && $this->is_main_query() ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) { $this->is_home = true; } if ( $this->is_home && 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) ) { $_query = wp_parse_args( $this->query ); if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { unset( $_query['pagename'] ); } unset( $_query['embed'] ); if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage' ) ) ) { $this->is_page = true; $this->is_home = false; $qv['page_id'] = get_option( 'page_on_front' ); if ( ! empty( $qv['paged'] ) ) { $qv['page'] = $qv['paged']; unset( $qv['paged'] ); } } } if ( '' !== $qv['pagename'] ) { $this->queried_object = get_page_by_path( $qv['pagename'] ); if ( $this->queried_object && 'attachment' === $this->queried_object->post_type ) { if ( preg_match( '/^[^%]*%(?:postname)%/', get_option( 'permalink_structure' ) ) ) { $post = get_page_by_path( $qv['pagename'], OBJECT, 'post' ); if ( $post ) { $this->queried_object = $post; $this->is_page = false; $this->is_single = true; } } } if ( ! empty( $this->queried_object ) ) { $this->queried_object_id = (int) $this->queried_object->ID; } else { unset( $this->queried_object ); } if ( 'page' === get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && get_option( 'page_for_posts' ) == $this->queried_object_id ) { $this->is_page = false; $this->is_home = true; $this->is_posts_page = true; } if ( isset( $this->queried_object_id ) && get_option( 'wp_page_for_privacy_policy' ) == $this->queried_object_id ) { $this->is_privacy_policy = true; } } if ( $qv['page_id'] ) { if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == $qv['page_id'] ) { $this->is_page = false; $this->is_home = true; $this->is_posts_page = true; } if ( get_option( 'wp_page_for_privacy_policy' ) == $qv['page_id'] ) { $this->is_privacy_policy = true; } } if ( ! empty( $qv['post_type'] ) ) { if ( is_array( $qv['post_type'] ) ) { $qv['post_type'] = array_map( 'sanitize_key', $qv['post_type'] ); } else { $qv['post_type'] = sanitize_key( $qv['post_type'] ); } } if ( ! empty( $qv['post_status'] ) ) { if ( is_array( $qv['post_status'] ) ) { $qv['post_status'] = array_map( 'sanitize_key', $qv['post_status'] ); } else { $qv['post_status'] = preg_replace( '|[^a-z0-9_,-]|', '', $qv['post_status'] ); } } if ( $this->is_posts_page && ( ! isset( $qv['withcomments'] ) || ! $qv['withcomments'] ) ) { $this->is_comment_feed = false; } $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment; if ( '404' == $qv['error'] ) { $this->set_404(); } $this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 ); $this->query_vars_hash = md5( serialize( $this->query_vars ) ); $this->query_vars_changed = false; do_action_ref_array( 'parse_query', array( &$this ) ); } public function parse_tax_query( &$q ) { if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) { $tax_query = $q['tax_query']; } else { $tax_query = array(); } if ( ! empty( $q['taxonomy'] ) && ! empty( $q['term'] ) ) { $tax_query[] = array( 'taxonomy' => $q['taxonomy'], 'terms' => array( $q['term'] ), 'field' => 'slug', ); } foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) { if ( 'post_tag' === $taxonomy ) { continue; } if ( $t->query_var && ! empty( $q[ $t->query_var ] ) ) { $tax_query_defaults = array( 'taxonomy' => $taxonomy, 'field' => 'slug', ); if ( ! empty( $t->rewrite['hierarchical'] ) ) { $q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] ); } $term = $q[ $t->query_var ]; if ( is_array( $term ) ) { $term = implode( ',', $term ); } if ( strpos( $term, '+' ) !== false ) { $terms = preg_split( '/[+]+/', $term ); foreach ( $terms as $term ) { $tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => array( $term ), ) ); } } else { $tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => preg_split( '/[,]+/', $term ), ) ); } } } if ( is_array( $q['cat'] ) ) { $q['cat'] = implode( ',', $q['cat'] ); } if ( ! empty( $q['cat'] ) && ! $this->is_singular ) { $cat_in = array(); $cat_not_in = array(); $cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) ); $cat_array = array_map( 'intval', $cat_array ); $q['cat'] = implode( ',', $cat_array ); foreach ( $cat_array as $cat ) { if ( $cat > 0 ) { $cat_in[] = $cat; } elseif ( $cat < 0 ) { $cat_not_in[] = abs( $cat ); } } if ( ! empty( $cat_in ) ) { $tax_query[] = array( 'taxonomy' => 'category', 'terms' => $cat_in, 'field' => 'term_id', 'include_children' => true, ); } if ( ! empty( $cat_not_in ) ) { $tax_query[] = array( 'taxonomy' => 'category', 'terms' => $cat_not_in, 'field' => 'term_id', 'operator' => 'NOT IN', 'include_children' => true, ); } unset( $cat_array, $cat_in, $cat_not_in ); } if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) { $q['category__and'] = (array) $q['category__and']; if ( ! isset( $q['category__in'] ) ) { $q['category__in'] = array(); } $q['category__in'][] = absint( reset( $q['category__and'] ) ); unset( $q['category__and'] ); } if ( ! empty( $q['category__in'] ) ) { $q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) ); $tax_query[] = array( 'taxonomy' => 'category', 'terms' => $q['category__in'], 'field' => 'term_id', 'include_children' => false, ); } if ( ! empty( $q['category__not_in'] ) ) { $q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) ); $tax_query[] = array( 'taxonomy' => 'category', 'terms' => $q['category__not_in'], 'operator' => 'NOT IN', 'include_children' => false, ); } if ( ! empty( $q['category__and'] ) ) { $q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) ); $tax_query[] = array( 'taxonomy' => 'category', 'terms' => $q['category__and'], 'field' => 'term_id', 'operator' => 'AND', 'include_children' => false, ); } if ( is_array( $q['tag'] ) ) { $q['tag'] = implode( ',', $q['tag'] ); } if ( '' !== $q['tag'] && ! $this->is_singular && $this->query_vars_changed ) { if ( strpos( $q['tag'], ',' ) !== false ) { $tags = preg_split( '/[,\r\n\t ]+/', $q['tag'] ); foreach ( (array) $tags as $tag ) { $tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' ); $q['tag_slug__in'][] = $tag; } } elseif ( preg_match( '/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) { $tags = preg_split( '/[+\r\n\t ]+/', $q['tag'] ); foreach ( (array) $tags as $tag ) { $tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' ); $q['tag_slug__and'][] = $tag; } } else { $q['tag'] = sanitize_term_field( 'slug', $q['tag'], 0, 'post_tag', 'db' ); $q['tag_slug__in'][] = $q['tag']; } } if ( ! empty( $q['tag_id'] ) ) { $q['tag_id'] = absint( $q['tag_id'] ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag_id'], ); } if ( ! empty( $q['tag__in'] ) ) { $q['tag__in'] = array_map( 'absint', array_unique( (array) $q['tag__in'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag__in'], ); } if ( ! empty( $q['tag__not_in'] ) ) { $q['tag__not_in'] = array_map( 'absint', array_unique( (array) $q['tag__not_in'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag__not_in'], 'operator' => 'NOT IN', ); } if ( ! empty( $q['tag__and'] ) ) { $q['tag__and'] = array_map( 'absint', array_unique( (array) $q['tag__and'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag__and'], 'operator' => 'AND', ); } if ( ! empty( $q['tag_slug__in'] ) ) { $q['tag_slug__in'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag_slug__in'], 'field' => 'slug', ); } if ( ! empty( $q['tag_slug__and'] ) ) { $q['tag_slug__and'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', 'terms' => $q['tag_slug__and'], 'field' => 'slug', 'operator' => 'AND', ); } $this->tax_query = new WP_Tax_Query( $tax_query ); do_action( 'parse_tax_query', $this ); } protected function parse_search( &$q ) { global $wpdb; $search = ''; $q['s'] = stripslashes( $q['s'] ); if ( empty( $_GET['s'] ) && $this->is_main_query() ) { $q['s'] = urldecode( $q['s'] ); } $q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] ); $q['search_terms_count'] = 1; if ( ! empty( $q['sentence'] ) ) { $q['search_terms'] = array( $q['s'] ); } else { if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) { $q['search_terms_count'] = count( $matches[0] ); $q['search_terms'] = $this->parse_search_terms( $matches[0] ); if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) { $q['search_terms'] = array( $q['s'] ); } } else { $q['search_terms'] = array( $q['s'] ); } } $n = ! empty( $q['exact'] ) ? '' : '%'; $searchand = ''; $q['search_orderby_title'] = array(); $exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' ); foreach ( $q['search_terms'] as $term ) { $exclude = $exclusion_prefix && ( substr( $term, 0, 1 ) === $exclusion_prefix ); if ( $exclude ) { $like_op = 'NOT LIKE'; $andor_op = 'AND'; $term = substr( $term, 1 ); } else { $like_op = 'LIKE'; $andor_op = 'OR'; } if ( $n && ! $exclude ) { $like = '%' . $wpdb->esc_like( $term ) . '%'; $q['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like ); } $like = $n . $wpdb->esc_like( $term ) . $n; $search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like ); $searchand = ' AND '; } if ( ! empty( $search ) ) { $search = " AND ({$search}) "; if ( ! is_user_logged_in() ) { $search .= " AND ({$wpdb->posts}.post_password = '') "; } } return $search; } protected function parse_search_terms( $terms ) { $strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower'; $checked = array(); $stopwords = $this->get_search_stopwords(); foreach ( $terms as $term ) { if ( preg_match( '/^".+"$/', $term ) ) { $term = trim( $term, "\"'" ); } else { $term = trim( $term, "\"' " ); } if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) ) { continue; } if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) { continue; } $checked[] = $term; } return $checked; } protected function get_search_stopwords() { if ( isset( $this->stopwords ) ) { return $this->stopwords; } $words = explode( ',', _x( 'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www', 'Comma-separated list of search stopwords in your language' ) ); $stopwords = array(); foreach ( $words as $word ) { $word = trim( $word, "\r\n\t " ); if ( $word ) { $stopwords[] = $word; } } $this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords ); return $this->stopwords; } protected function parse_search_order( &$q ) { global $wpdb; if ( $q['search_terms_count'] > 1 ) { $num_terms = count( $q['search_orderby_title'] ); $like = ''; if ( ! preg_match( '/(?:\s|^)\-/', $q['s'] ) ) { $like = '%' . $wpdb->esc_like( $q['s'] ) . '%'; } $search_orderby = ''; if ( $like ) { $search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 ", $like ); } if ( $num_terms < 7 ) { $search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 '; if ( $num_terms > 1 ) { $search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 '; } } if ( $like ) { $search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_excerpt LIKE %s THEN 4 ", $like ); $search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_content LIKE %s THEN 5 ", $like ); } if ( $search_orderby ) { $search_orderby = '(CASE ' . $search_orderby . 'ELSE 6 END)'; } } else { $search_orderby = reset( $q['search_orderby_title'] ) . ' DESC'; } return $search_orderby; } protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'post_name', 'post_author', 'post_date', 'post_title', 'post_modified', 'post_parent', 'post_type', 'name', 'author', 'date', 'title', 'modified', 'parent', 'type', 'ID', 'menu_order', 'comment_count', 'rand', 'post__in', 'post_parent__in', 'post_name__in', ); $primary_meta_key = ''; $primary_meta_query = false; $meta_clauses = $this->meta_query->get_clauses(); if ( ! empty( $meta_clauses ) ) { $primary_meta_query = reset( $meta_clauses ); if ( ! empty( $primary_meta_query['key'] ) ) { $primary_meta_key = $primary_meta_query['key']; $allowed_keys[] = $primary_meta_key; } $allowed_keys[] = 'meta_value'; $allowed_keys[] = 'meta_value_num'; $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_clauses ) ); } $rand_with_seed = false; if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) { $orderby = sprintf( 'RAND(%s)', (int) $matches[1] ); $allowed_keys[] = $orderby; $rand_with_seed = true; } if ( ! in_array( $orderby, $allowed_keys, true ) ) { return false; } $orderby_clause = ''; switch ( $orderby ) { case 'post_name': case 'post_author': case 'post_date': case 'post_title': case 'post_modified': case 'post_parent': case 'post_type': case 'ID': case 'menu_order': case 'comment_count': $orderby_clause = "{$wpdb->posts}.{$orderby}"; break; case 'rand': $orderby_clause = 'RAND()'; break; case $primary_meta_key: case 'meta_value': if ( ! empty( $primary_meta_query['type'] ) ) { $orderby_clause = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})"; } else { $orderby_clause = "{$primary_meta_query['alias']}.meta_value"; } break; case 'meta_value_num': $orderby_clause = "{$primary_meta_query['alias']}.meta_value+0"; break; case 'post__in': if ( ! empty( $this->query_vars['post__in'] ) ) { $orderby_clause = "FIELD({$wpdb->posts}.ID," . implode( ',', array_map( 'absint', $this->query_vars['post__in'] ) ) . ')'; } break; case 'post_parent__in': if ( ! empty( $this->query_vars['post_parent__in'] ) ) { $orderby_clause = "FIELD( {$wpdb->posts}.post_parent," . implode( ', ', array_map( 'absint', $this->query_vars['post_parent__in'] ) ) . ' )'; } break; case 'post_name__in': if ( ! empty( $this->query_vars['post_name__in'] ) ) { $post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] ); $post_name__in_string = "'" . implode( "','", $post_name__in ) . "'"; $orderby_clause = "FIELD( {$wpdb->posts}.post_name," . $post_name__in_string . ' )'; } break; default: if ( array_key_exists( $orderby, $meta_clauses ) ) { $meta_clause = $meta_clauses[ $orderby ]; $orderby_clause = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})"; } elseif ( $rand_with_seed ) { $orderby_clause = $orderby; } else { $orderby_clause = "{$wpdb->posts}.post_" . sanitize_key( $orderby ); } break; } return $orderby_clause; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } public function set_404() { $is_feed = $this->is_feed; $this->init_query_flags(); $this->is_404 = true; $this->is_feed = $is_feed; do_action_ref_array( 'set_404', array( $this ) ); } public function get( $query_var, $default_value = '' ) { if ( isset( $this->query_vars[ $query_var ] ) ) { return $this->query_vars[ $query_var ]; } return $default_value; } public function set( $query_var, $value ) { $this->query_vars[ $query_var ] = $value; } public function get_posts() { global $wpdb; $this->parse_query(); do_action_ref_array( 'pre_get_posts', array( &$this ) ); $q = &$this->query_vars; $q = $this->fill_query_vars( $q ); $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $q ); $hash = md5( serialize( $this->query_vars ) ); if ( $hash != $this->query_vars_hash ) { $this->query_vars_changed = true; $this->query_vars_hash = $hash; } unset( $hash ); $distinct = ''; $whichauthor = ''; $whichmimetype = ''; $where = ''; $limits = ''; $join = ''; $search = ''; $groupby = ''; $post_status_join = false; $page = 1; if ( isset( $q['caller_get_posts'] ) ) { _deprecated_argument( 'WP_Query', '3.1.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'caller_get_posts', 'ignore_sticky_posts' ) ); if ( ! isset( $q['ignore_sticky_posts'] ) ) { $q['ignore_sticky_posts'] = $q['caller_get_posts']; } } if ( ! isset( $q['ignore_sticky_posts'] ) ) { $q['ignore_sticky_posts'] = false; } if ( ! isset( $q['suppress_filters'] ) ) { $q['suppress_filters'] = false; } if ( ! isset( $q['cache_results'] ) ) { if ( wp_using_ext_object_cache() ) { $q['cache_results'] = false; } else { $q['cache_results'] = true; } } if ( ! isset( $q['update_post_term_cache'] ) ) { $q['update_post_term_cache'] = true; } if ( ! isset( $q['lazy_load_term_meta'] ) ) { $q['lazy_load_term_meta'] = $q['update_post_term_cache']; } if ( ! isset( $q['update_post_meta_cache'] ) ) { $q['update_post_meta_cache'] = true; } if ( ! isset( $q['post_type'] ) ) { if ( $this->is_search ) { $q['post_type'] = 'any'; } else { $q['post_type'] = ''; } } $post_type = $q['post_type']; if ( empty( $q['posts_per_page'] ) ) { $q['posts_per_page'] = get_option( 'posts_per_page' ); } if ( isset( $q['showposts'] ) && $q['showposts'] ) { $q['showposts'] = (int) $q['showposts']; $q['posts_per_page'] = $q['showposts']; } if ( ( isset( $q['posts_per_archive_page'] ) && 0 != $q['posts_per_archive_page'] ) && ( $this->is_archive || $this->is_search ) ) { $q['posts_per_page'] = $q['posts_per_archive_page']; } if ( ! isset( $q['nopaging'] ) ) { if ( -1 == $q['posts_per_page'] ) { $q['nopaging'] = true; } else { $q['nopaging'] = false; } } if ( $this->is_feed ) { if ( ! empty( $q['posts_per_rss'] ) ) { $q['posts_per_page'] = $q['posts_per_rss']; } else { $q['posts_per_page'] = get_option( 'posts_per_rss' ); } $q['nopaging'] = false; } $q['posts_per_page'] = (int) $q['posts_per_page']; if ( $q['posts_per_page'] < -1 ) { $q['posts_per_page'] = abs( $q['posts_per_page'] ); } elseif ( 0 == $q['posts_per_page'] ) { $q['posts_per_page'] = 1; } if ( ! isset( $q['comments_per_page'] ) || 0 == $q['comments_per_page'] ) { $q['comments_per_page'] = get_option( 'comments_per_page' ); } if ( $this->is_home && ( empty( $this->query ) || 'true' === $q['preview'] ) && ( 'page' === get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) { $this->is_page = true; $this->is_home = false; $q['page_id'] = get_option( 'page_on_front' ); } if ( isset( $q['page'] ) ) { $q['page'] = trim( $q['page'], '/' ); $q['page'] = absint( $q['page'] ); } if ( isset( $q['no_found_rows'] ) ) { $q['no_found_rows'] = (bool) $q['no_found_rows']; } else { $q['no_found_rows'] = false; } switch ( $q['fields'] ) { case 'ids': $fields = "{$wpdb->posts}.ID"; break; case 'id=>parent': $fields = "{$wpdb->posts}.ID, {$wpdb->posts}.post_parent"; break; default: $fields = "{$wpdb->posts}.*"; } if ( '' !== $q['menu_order'] ) { $where .= " AND {$wpdb->posts}.menu_order = " . $q['menu_order']; } if ( $q['m'] ) { $where .= " AND YEAR({$wpdb->posts}.post_date)=" . substr( $q['m'], 0, 4 ); if ( strlen( $q['m'] ) > 5 ) { $where .= " AND MONTH({$wpdb->posts}.post_date)=" . substr( $q['m'], 4, 2 ); } if ( strlen( $q['m'] ) > 7 ) { $where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=" . substr( $q['m'], 6, 2 ); } if ( strlen( $q['m'] ) > 9 ) { $where .= " AND HOUR({$wpdb->posts}.post_date)=" . substr( $q['m'], 8, 2 ); } if ( strlen( $q['m'] ) > 11 ) { $where .= " AND MINUTE({$wpdb->posts}.post_date)=" . substr( $q['m'], 10, 2 ); } if ( strlen( $q['m'] ) > 13 ) { $where .= " AND SECOND({$wpdb->posts}.post_date)=" . substr( $q['m'], 12, 2 ); } } $date_parameters = array(); if ( '' !== $q['hour'] ) { $date_parameters['hour'] = $q['hour']; } if ( '' !== $q['minute'] ) { $date_parameters['minute'] = $q['minute']; } if ( '' !== $q['second'] ) { $date_parameters['second'] = $q['second']; } if ( $q['year'] ) { $date_parameters['year'] = $q['year']; } if ( $q['monthnum'] ) { $date_parameters['monthnum'] = $q['monthnum']; } if ( $q['w'] ) { $date_parameters['week'] = $q['w']; } if ( $q['day'] ) { $date_parameters['day'] = $q['day']; } if ( $date_parameters ) { $date_query = new WP_Date_Query( array( $date_parameters ) ); $where .= $date_query->get_sql(); } unset( $date_parameters, $date_query ); if ( ! empty( $q['date_query'] ) ) { $this->date_query = new WP_Date_Query( $q['date_query'] ); $where .= $this->date_query->get_sql(); } if ( ! empty( $q['post_type'] ) && 'any' !== $q['post_type'] ) { foreach ( (array) $q['post_type'] as $_post_type ) { $ptype_obj = get_post_type_object( $_post_type ); if ( ! $ptype_obj || ! $ptype_obj->query_var || empty( $q[ $ptype_obj->query_var ] ) ) { continue; } if ( ! $ptype_obj->hierarchical ) { $q['name'] = $q[ $ptype_obj->query_var ]; } else { $q['pagename'] = $q[ $ptype_obj->query_var ]; $q['name'] = ''; } break; } unset( $ptype_obj ); } if ( '' !== $q['title'] ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title = %s", stripslashes( $q['title'] ) ); } if ( '' !== $q['name'] ) { $q['name'] = sanitize_title_for_query( $q['name'] ); $where .= " AND {$wpdb->posts}.post_name = '" . $q['name'] . "'"; } elseif ( '' !== $q['pagename'] ) { if ( isset( $this->queried_object_id ) ) { $reqpage = $this->queried_object_id; } else { if ( 'page' !== $q['post_type'] ) { foreach ( (array) $q['post_type'] as $_post_type ) { $ptype_obj = get_post_type_object( $_post_type ); if ( ! $ptype_obj || ! $ptype_obj->hierarchical ) { continue; } $reqpage = get_page_by_path( $q['pagename'], OBJECT, $_post_type ); if ( $reqpage ) { break; } } unset( $ptype_obj ); } else { $reqpage = get_page_by_path( $q['pagename'] ); } if ( ! empty( $reqpage ) ) { $reqpage = $reqpage->ID; } else { $reqpage = 0; } } $page_for_posts = get_option( 'page_for_posts' ); if ( ( 'page' !== get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) { $q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) ); $q['name'] = $q['pagename']; $where .= " AND ({$wpdb->posts}.ID = '$reqpage')"; $reqpage_obj = get_post( $reqpage ); if ( is_object( $reqpage_obj ) && 'attachment' === $reqpage_obj->post_type ) { $this->is_attachment = true; $post_type = 'attachment'; $q['post_type'] = 'attachment'; $this->is_page = true; $q['attachment_id'] = $reqpage; } } } elseif ( '' !== $q['attachment'] ) { $q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) ); $q['name'] = $q['attachment']; $where .= " AND {$wpdb->posts}.post_name = '" . $q['attachment'] . "'"; } elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) { $q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] ); $post_name__in = "'" . implode( "','", $q['post_name__in'] ) . "'"; $where .= " AND {$wpdb->posts}.post_name IN ($post_name__in)"; } if ( $q['attachment_id'] ) { $q['p'] = absint( $q['attachment_id'] ); } if ( $q['p'] ) { $where .= " AND {$wpdb->posts}.ID = " . $q['p']; } elseif ( $q['post__in'] ) { $post__in = implode( ',', array_map( 'absint', $q['post__in'] ) ); $where .= " AND {$wpdb->posts}.ID IN ($post__in)"; } elseif ( $q['post__not_in'] ) { $post__not_in = implode( ',', array_map( 'absint', $q['post__not_in'] ) ); $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)"; } if ( is_numeric( $q['post_parent'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_parent = %d ", $q['post_parent'] ); } elseif ( $q['post_parent__in'] ) { $post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) ); $where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)"; } elseif ( $q['post_parent__not_in'] ) { $post_parent__not_in = implode( ',', array_map( 'absint', $q['post_parent__not_in'] ) ); $where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)"; } if ( $q['page_id'] ) { if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $q['page_id'] ) ) { $q['p'] = $q['page_id']; $where = " AND {$wpdb->posts}.ID = " . $q['page_id']; } } if ( strlen( $q['s'] ) ) { $search = $this->parse_search( $q ); } if ( ! $q['suppress_filters'] ) { $search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) ); } if ( ! $this->is_singular ) { $this->parse_tax_query( $q ); $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' ); $join .= $clauses['join']; $where .= $clauses['where']; } if ( $this->is_tax ) { if ( empty( $post_type ) ) { $post_type = array(); $taxonomies = array_keys( $this->tax_query->queried_terms ); foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) { $object_taxonomies = 'attachment' === $pt ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt ); if ( array_intersect( $taxonomies, $object_taxonomies ) ) { $post_type[] = $pt; } } if ( ! $post_type ) { $post_type = 'any'; } elseif ( count( $post_type ) == 1 ) { $post_type = $post_type[0]; } $post_status_join = true; } elseif ( in_array( 'attachment', (array) $post_type, true ) ) { $post_status_join = true; } } if ( ! empty( $this->tax_query->queried_terms ) ) { if ( ! isset( $q['taxonomy'] ) ) { foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) { if ( empty( $queried_items['terms'][0] ) ) { continue; } if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ), true ) ) { $q['taxonomy'] = $queried_taxonomy; if ( 'slug' === $queried_items['field'] ) { $q['term'] = $queried_items['terms'][0]; } else { $q['term_id'] = $queried_items['terms'][0]; } break; } } } foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) { if ( empty( $queried_items['terms'][0] ) ) { continue; } if ( 'category' === $queried_taxonomy ) { $the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' ); if ( $the_cat ) { $this->set( 'cat', $the_cat->term_id ); $this->set( 'category_name', $the_cat->slug ); } unset( $the_cat ); } if ( 'post_tag' === $queried_taxonomy ) { $the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' ); if ( $the_tag ) { $this->set( 'tag_id', $the_tag->term_id ); } unset( $the_tag ); } } } if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) { $groupby = "{$wpdb->posts}.ID"; } if ( ! empty( $q['author'] ) && '0' != $q['author'] ) { $q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) ); $authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) ); foreach ( $authors as $author ) { $key = $author > 0 ? 'author__in' : 'author__not_in'; $q[ $key ][] = abs( $author ); } $q['author'] = implode( ',', $authors ); } if ( ! empty( $q['author__not_in'] ) ) { $author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) ); $where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) "; } elseif ( ! empty( $q['author__in'] ) ) { $author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) ); $where .= " AND {$wpdb->posts}.post_author IN ($author__in) "; } if ( '' !== $q['author_name'] ) { if ( strpos( $q['author_name'], '/' ) !== false ) { $q['author_name'] = explode( '/', $q['author_name'] ); if ( $q['author_name'][ count( $q['author_name'] ) - 1 ] ) { $q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 1 ]; } else { $q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 2 ]; } } $q['author_name'] = sanitize_title_for_query( $q['author_name'] ); $q['author'] = get_user_by( 'slug', $q['author_name'] ); if ( $q['author'] ) { $q['author'] = $q['author']->ID; } $whichauthor .= " AND ({$wpdb->posts}.post_author = " . absint( $q['author'] ) . ')'; } if ( isset( $q['comment_count'] ) ) { if ( is_numeric( $q['comment_count'] ) ) { $q['comment_count'] = array( 'value' => (int) $q['comment_count'], ); } if ( isset( $q['comment_count']['value'] ) ) { $q['comment_count'] = array_merge( array( 'compare' => '=', ), $q['comment_count'] ); $compare_operators = array( '=', '!=', '>', '>=', '<', '<=' ); if ( ! in_array( $q['comment_count']['compare'], $compare_operators, true ) ) { $q['comment_count']['compare'] = '='; } $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_count {$q['comment_count']['compare']} %d", $q['comment_count']['value'] ); } } if ( isset( $q['post_mime_type'] ) && '' !== $q['post_mime_type'] ) { $whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts ); } $where .= $search . $whichauthor . $whichmimetype; if ( ! empty( $this->meta_query->queries ) ) { $clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this ); $join .= $clauses['join']; $where .= $clauses['where']; } $rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] ); if ( ! isset( $q['order'] ) ) { $q['order'] = $rand ? '' : 'DESC'; } else { $q['order'] = $rand ? '' : $this->parse_order( $q['order'] ); } $force_asc = array( 'post__in', 'post_name__in', 'post_parent__in' ); if ( isset( $q['orderby'] ) && in_array( $q['orderby'], $force_asc, true ) ) { $q['order'] = ''; } if ( empty( $q['orderby'] ) ) { if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) { $orderby = ''; } else { $orderby = "{$wpdb->posts}.post_date " . $q['order']; } } elseif ( 'none' === $q['orderby'] ) { $orderby = ''; } else { $orderby_array = array(); if ( is_array( $q['orderby'] ) ) { foreach ( $q['orderby'] as $_orderby => $order ) { $orderby = addslashes_gpc( urldecode( $_orderby ) ); $parsed = $this->parse_orderby( $orderby ); if ( ! $parsed ) { continue; } $orderby_array[] = $parsed . ' ' . $this->parse_order( $order ); } $orderby = implode( ', ', $orderby_array ); } else { $q['orderby'] = urldecode( $q['orderby'] ); $q['orderby'] = addslashes_gpc( $q['orderby'] ); foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) { $parsed = $this->parse_orderby( $orderby ); if ( ! $parsed ) { continue; } $orderby_array[] = $parsed; } $orderby = implode( ' ' . $q['order'] . ', ', $orderby_array ); if ( empty( $orderby ) ) { $orderby = "{$wpdb->posts}.post_date " . $q['order']; } elseif ( ! empty( $q['order'] ) ) { $orderby .= " {$q['order']}"; } } } if ( ! empty( $q['s'] ) ) { $search_orderby = ''; if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) { $search_orderby = $this->parse_search_order( $q ); } if ( ! $q['suppress_filters'] ) { $search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this ); } if ( $search_orderby ) { $orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby; } } if ( is_array( $post_type ) && count( $post_type ) > 1 ) { $post_type_cap = 'multiple_post_type'; } else { if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_object = get_post_type_object( $post_type ); if ( empty( $post_type_object ) ) { $post_type_cap = $post_type; } } if ( isset( $q['post_password'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_password = %s", $q['post_password'] ); if ( empty( $q['perm'] ) ) { $q['perm'] = 'readable'; } } elseif ( isset( $q['has_password'] ) ) { $where .= sprintf( " AND {$wpdb->posts}.post_password %s ''", $q['has_password'] ? '!=' : '=' ); } if ( ! empty( $q['comment_status'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_status = %s ", $q['comment_status'] ); } if ( ! empty( $q['ping_status'] ) ) { $where .= $wpdb->prepare( " AND {$wpdb->posts}.ping_status = %s ", $q['ping_status'] ); } $skip_post_status = false; if ( 'any' === $post_type ) { $in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) ); if ( empty( $in_search_post_types ) ) { $post_type_where = ' AND 1=0 '; $skip_post_status = true; } else { $post_type_where = " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')"; } } elseif ( ! empty( $post_type ) && is_array( $post_type ) ) { $post_type_where = " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", esc_sql( $post_type ) ) . "')"; } elseif ( ! empty( $post_type ) ) { $post_type_where = $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s", $post_type ); $post_type_object = get_post_type_object( $post_type ); } elseif ( $this->is_attachment ) { $post_type_where = " AND {$wpdb->posts}.post_type = 'attachment'"; $post_type_object = get_post_type_object( 'attachment' ); } elseif ( $this->is_page ) { $post_type_where = " AND {$wpdb->posts}.post_type = 'page'"; $post_type_object = get_post_type_object( 'page' ); } else { $post_type_where = " AND {$wpdb->posts}.post_type = 'post'"; $post_type_object = get_post_type_object( 'post' ); } $edit_cap = 'edit_post'; $read_cap = 'read_post'; if ( ! empty( $post_type_object ) ) { $edit_others_cap = $post_type_object->cap->edit_others_posts; $read_private_cap = $post_type_object->cap->read_private_posts; } else { $edit_others_cap = 'edit_others_' . $post_type_cap . 's'; $read_private_cap = 'read_private_' . $post_type_cap . 's'; } $user_id = get_current_user_id(); $q_status = array(); if ( $skip_post_status ) { $where .= $post_type_where; } elseif ( ! empty( $q['post_status'] ) ) { $where .= $post_type_where; $statuswheres = array(); $q_status = $q['post_status']; if ( ! is_array( $q_status ) ) { $q_status = explode( ',', $q_status ); } $r_status = array(); $p_status = array(); $e_status = array(); if ( in_array( 'any', $q_status, true ) ) { foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) { if ( ! in_array( $status, $q_status, true ) ) { $e_status[] = "{$wpdb->posts}.post_status <> '$status'"; } } } else { foreach ( get_post_stati() as $status ) { if ( in_array( $status, $q_status, true ) ) { if ( 'private' === $status ) { $p_status[] = "{$wpdb->posts}.post_status = '$status'"; } else { $r_status[] = "{$wpdb->posts}.post_status = '$status'"; } } } } if ( empty( $q['perm'] ) || 'readable' !== $q['perm'] ) { $r_status = array_merge( $r_status, $p_status ); unset( $p_status ); } if ( ! empty( $e_status ) ) { $statuswheres[] = '(' . implode( ' AND ', $e_status ) . ')'; } if ( ! empty( $r_status ) ) { if ( ! empty( $q['perm'] ) && 'editable' === $q['perm'] && ! current_user_can( $edit_others_cap ) ) { $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $r_status ) . '))'; } else { $statuswheres[] = '(' . implode( ' OR ', $r_status ) . ')'; } } if ( ! empty( $p_status ) ) { if ( ! empty( $q['perm'] ) && 'readable' === $q['perm'] && ! current_user_can( $read_private_cap ) ) { $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $p_status ) . '))'; } else { $statuswheres[] = '(' . implode( ' OR ', $p_status ) . ')'; } } if ( $post_status_join ) { $join .= " LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) "; foreach ( $statuswheres as $index => $statuswhere ) { $statuswheres[ $index ] = "($statuswhere OR ({$wpdb->posts}.post_status = 'inherit' AND " . str_replace( $wpdb->posts, 'p2', $statuswhere ) . '))'; } } $where_status = implode( ' OR ', $statuswheres ); if ( ! empty( $where_status ) ) { $where .= " AND ($where_status)"; } } elseif ( ! $this->is_singular ) { if ( 'any' === $post_type ) { $queried_post_types = get_post_types( array( 'exclude_from_search' => false ) ); } elseif ( is_array( $post_type ) ) { $queried_post_types = $post_type; } elseif ( ! empty( $post_type ) ) { $queried_post_types = array( $post_type ); } else { $queried_post_types = array( 'post' ); } if ( ! empty( $queried_post_types ) ) { $status_type_clauses = array(); foreach ( $queried_post_types as $queried_post_type ) { $queried_post_type_object = get_post_type_object( $queried_post_type ); $type_where = '(' . $wpdb->prepare( "{$wpdb->posts}.post_type = %s AND (", $queried_post_type ); $public_statuses = get_post_stati( array( 'public' => true ) ); $status_clauses = array(); foreach ( $public_statuses as $public_status ) { $status_clauses[] = "{$wpdb->posts}.post_status = '$public_status'"; } $type_where .= implode( ' OR ', $status_clauses ); if ( $this->is_admin ) { $admin_all_statuses = get_post_stati( array( 'protected' => true, 'show_in_admin_all_list' => true, ) ); foreach ( $admin_all_statuses as $admin_all_status ) { $type_where .= " OR {$wpdb->posts}.post_status = '$admin_all_status'"; } } if ( is_user_logged_in() && $queried_post_type_object instanceof WP_Post_Type ) { $read_private_cap = $queried_post_type_object->cap->read_private_posts; $private_statuses = get_post_stati( array( 'private' => true ) ); foreach ( $private_statuses as $private_status ) { $type_where .= current_user_can( $read_private_cap ) ? " \nOR {$wpdb->posts}.post_status = '$private_status'" : " \nOR ({$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$private_status')"; } } $type_where .= '))'; $status_type_clauses[] = $type_where; } if ( ! empty( $status_type_clauses ) ) { $where .= ' AND (' . implode( ' OR ', $status_type_clauses ) . ')'; } } else { $where .= ' AND 1=0 '; } } else { $where .= $post_type_where; } if ( ! $q['suppress_filters'] ) { $where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) ); $join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) ); } if ( empty( $q['nopaging'] ) && ! $this->is_singular ) { $page = absint( $q['paged'] ); if ( ! $page ) { $page = 1; } if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) { $q['offset'] = absint( $q['offset'] ); $pgstrt = $q['offset'] . ', '; } else { $pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', '; } $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; } if ( $this->is_comment_feed && ! $this->is_singular ) { if ( $this->is_archive || $this->is_search ) { $cjoin = "JOIN {$wpdb->posts} ON ( {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID ) $join "; $cwhere = "WHERE comment_approved = '1' $where"; $cgroupby = "{$wpdb->comments}.comment_id"; } else { $cjoin = "JOIN {$wpdb->posts} ON ( {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID )"; $cwhere = "WHERE ( post_status = 'publish' OR ( post_status = 'inherit' AND post_type = 'attachment' ) ) AND comment_approved = '1'"; $cgroupby = ''; } if ( ! $q['suppress_filters'] ) { $cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) ); $cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) ); $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) ); $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) ); } $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; $climits = ( ! empty( $climits ) ) ? $climits : ''; $comments_request = "SELECT $distinct {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; $key = md5( $comments_request ); $last_changed = wp_cache_get_last_changed( 'comment' ) . ':' . wp_cache_get_last_changed( 'posts' ); $cache_key = "comment_feed:$key:$last_changed"; $comment_ids = wp_cache_get( $cache_key, 'comment' ); if ( false === $comment_ids ) { $comment_ids = $wpdb->get_col( $comments_request ); wp_cache_add( $cache_key, $comment_ids, 'comment' ); } _prime_comment_caches( $comment_ids, false ); $this->comments = array_map( 'get_comment', $comment_ids ); $this->comment_count = count( $this->comments ); $post_ids = array(); foreach ( $this->comments as $comment ) { $post_ids[] = (int) $comment->comment_post_ID; } $post_ids = implode( ',', $post_ids ); $join = ''; if ( $post_ids ) { $where = "AND {$wpdb->posts}.ID IN ($post_ids) "; } else { $where = 'AND 0'; } } $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); if ( ! $q['suppress_filters'] ) { $where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) ); $groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) ); $join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) ); $orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) ); $distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) ); $limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) ); $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : ''; $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; } do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join ); if ( ! $q['suppress_filters'] ) { $where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) ); $groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) ); $join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) ); $orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) ); $distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) ); $fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) ); $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : ''; $distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : ''; $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : ''; } if ( ! empty( $groupby ) ) { $groupby = 'GROUP BY ' . $groupby; } if ( ! empty( $orderby ) ) { $orderby = 'ORDER BY ' . $orderby; } $found_rows = ''; if ( ! $q['no_found_rows'] && ! empty( $limits ) ) { $found_rows = 'SQL_CALC_FOUND_ROWS'; } $old_request = " - SELECT $found_rows $distinct $fields - FROM {$wpdb->posts} $join - WHERE 1=1 $where - $groupby - $orderby - $limits - "; $this->request = $old_request; if ( ! $q['suppress_filters'] ) { $this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) ); } $this->posts = apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) ); if ( 'ids' === $q['fields'] ) { if ( null === $this->posts ) { $this->posts = $wpdb->get_col( $this->request ); } $this->posts = array_map( 'intval', $this->posts ); $this->post_count = count( $this->posts ); $this->set_found_posts( $q, $limits ); return $this->posts; } if ( 'id=>parent' === $q['fields'] ) { if ( null === $this->posts ) { $this->posts = $wpdb->get_results( $this->request ); } $this->post_count = count( $this->posts ); $this->set_found_posts( $q, $limits ); $r = array(); foreach ( $this->posts as $key => $post ) { $this->posts[ $key ]->ID = (int) $post->ID; $this->posts[ $key ]->post_parent = (int) $post->post_parent; $r[ (int) $post->ID ] = (int) $post->post_parent; } return $r; } if ( null === $this->posts ) { $split_the_query = ( $old_request == $this->request && "{$wpdb->posts}.*" === $fields && ! empty( $limits ) && $q['posts_per_page'] < 500 ); $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this ); if ( $split_the_query ) { $this->request = " - SELECT $found_rows $distinct {$wpdb->posts}.ID - FROM {$wpdb->posts} $join - WHERE 1=1 $where - $groupby - $orderby - $limits - "; $this->request = apply_filters( 'posts_request_ids', $this->request, $this ); $ids = $wpdb->get_col( $this->request ); if ( $ids ) { $this->posts = $ids; $this->set_found_posts( $q, $limits ); _prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] ); } else { $this->posts = array(); } } else { $this->posts = $wpdb->get_results( $this->request ); $this->set_found_posts( $q, $limits ); } } if ( $this->posts ) { $this->posts = array_map( 'get_post', $this->posts ); } if ( ! $q['suppress_filters'] ) { $this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) ); } if ( ! empty( $this->posts ) && $this->is_comment_feed && $this->is_singular ) { $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) ); $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) ); $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) ); $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) ); $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) ); $comments_request = "SELECT {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; $key = md5( $comments_request ); $last_changed = wp_cache_get_last_changed( 'comment' ); $cache_key = "comment_feed:$key:$last_changed"; $comment_ids = wp_cache_get( $cache_key, 'comment' ); if ( false === $comment_ids ) { $comment_ids = $wpdb->get_col( $comments_request ); wp_cache_add( $cache_key, $comment_ids, 'comment' ); } _prime_comment_caches( $comment_ids, false ); $this->comments = array_map( 'get_comment', $comment_ids ); $this->comment_count = count( $this->comments ); } if ( ! empty( $this->posts ) && ( $this->is_single || $this->is_page ) ) { $status = get_post_status( $this->posts[0] ); if ( 'attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent ) { $this->is_page = false; $this->is_single = true; $this->is_attachment = true; } if ( ! in_array( $status, $q_status, true ) ) { $post_status_obj = get_post_status_object( $status ); if ( $post_status_obj && ! $post_status_obj->public ) { if ( ! is_user_logged_in() ) { $this->posts = array(); } else { if ( $post_status_obj->protected ) { if ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) { $this->posts = array(); } else { $this->is_preview = true; if ( 'future' !== $status ) { $this->posts[0]->post_date = current_time( 'mysql' ); } } } elseif ( $post_status_obj->private ) { if ( ! current_user_can( $read_cap, $this->posts[0]->ID ) ) { $this->posts = array(); } } else { $this->posts = array(); } } } elseif ( ! $post_status_obj ) { if ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) { $this->posts = array(); } } } if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) { $this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) ); } } $sticky_posts = get_option( 'sticky_posts' ); if ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $q['ignore_sticky_posts'] ) { $num_posts = count( $this->posts ); $sticky_offset = 0; for ( $i = 0; $i < $num_posts; $i++ ) { if ( in_array( $this->posts[ $i ]->ID, $sticky_posts, true ) ) { $sticky_post = $this->posts[ $i ]; array_splice( $this->posts, $i, 1 ); array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) ); $sticky_offset++; $offset = array_search( $sticky_post->ID, $sticky_posts, true ); unset( $sticky_posts[ $offset ] ); } } if ( ! empty( $sticky_posts ) && ! empty( $q['post__not_in'] ) ) { $sticky_posts = array_diff( $sticky_posts, $q['post__not_in'] ); } if ( ! empty( $sticky_posts ) ) { $stickies = get_posts( array( 'post__in' => $sticky_posts, 'post_type' => $post_type, 'post_status' => 'publish', 'posts_per_page' => count( $sticky_posts ), 'suppress_filters' => $q['suppress_filters'], 'cache_results' => $q['cache_results'], 'update_post_meta_cache' => $q['update_post_meta_cache'], 'update_post_term_cache' => $q['update_post_term_cache'], 'lazy_load_term_meta' => $q['lazy_load_term_meta'], ) ); foreach ( $stickies as $sticky_post ) { array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) ); $sticky_offset++; } } } if ( ! empty( $this->comments ) ) { wp_queue_comments_for_comment_meta_lazyload( $this->comments ); } if ( ! $q['suppress_filters'] ) { $this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) ); } if ( $this->posts ) { $this->post_count = count( $this->posts ); $this->posts = array_map( 'get_post', $this->posts ); if ( $q['cache_results'] ) { update_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] ); } $this->post = reset( $this->posts ); } else { $this->post_count = 0; $this->posts = array(); } if ( $q['lazy_load_term_meta'] ) { wp_queue_posts_for_term_meta_lazyload( $this->posts ); } return $this->posts; } private function set_found_posts( $q, $limits ) { global $wpdb; if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) { return; } if ( ! empty( $limits ) ) { $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ); $this->found_posts = (int) $wpdb->get_var( $found_posts_query ); } else { if ( is_array( $this->posts ) ) { $this->found_posts = count( $this->posts ); } else { if ( null === $this->posts ) { $this->found_posts = 0; } else { $this->found_posts = 1; } } } $this->found_posts = (int) apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); if ( ! empty( $limits ) ) { $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] ); } } public function next_post() { $this->current_post++; $this->post = $this->posts[ $this->current_post ]; return $this->post; } public function the_post() { global $post; $this->in_the_loop = true; if ( -1 == $this->current_post ) { do_action_ref_array( 'loop_start', array( &$this ) ); } $post = $this->next_post(); $this->setup_postdata( $post ); } public function have_posts() { if ( $this->current_post + 1 < $this->post_count ) { return true; } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) { do_action_ref_array( 'loop_end', array( &$this ) ); $this->rewind_posts(); } elseif ( 0 === $this->post_count ) { do_action( 'loop_no_results', $this ); } $this->in_the_loop = false; return false; } public function rewind_posts() { $this->current_post = -1; if ( $this->post_count > 0 ) { $this->post = $this->posts[0]; } } public function next_comment() { $this->current_comment++; $this->comment = $this->comments[ $this->current_comment ]; return $this->comment; } public function the_comment() { global $comment; $comment = $this->next_comment(); if ( 0 == $this->current_comment ) { do_action( 'comment_loop_start' ); } } public function have_comments() { if ( $this->current_comment + 1 < $this->comment_count ) { return true; } elseif ( $this->current_comment + 1 == $this->comment_count ) { $this->rewind_comments(); } return false; } public function rewind_comments() { $this->current_comment = -1; if ( $this->comment_count > 0 ) { $this->comment = $this->comments[0]; } } public function query( $query ) { $this->init(); $this->query = wp_parse_args( $query ); $this->query_vars = $this->query; return $this->get_posts(); } public function get_queried_object() { if ( isset( $this->queried_object ) ) { return $this->queried_object; } $this->queried_object = null; $this->queried_object_id = null; if ( $this->is_category || $this->is_tag || $this->is_tax ) { if ( $this->is_category ) { $cat = $this->get( 'cat' ); $category_name = $this->get( 'category_name' ); if ( $cat ) { $term = get_term( $cat, 'category' ); } elseif ( $category_name ) { $term = get_term_by( 'slug', $category_name, 'category' ); } } elseif ( $this->is_tag ) { $tag_id = $this->get( 'tag_id' ); $tag = $this->get( 'tag' ); if ( $tag_id ) { $term = get_term( $tag_id, 'post_tag' ); } elseif ( $tag ) { $term = get_term_by( 'slug', $tag, 'post_tag' ); } } else { if ( ! empty( $this->tax_query->queried_terms ) ) { $queried_taxonomies = array_keys( $this->tax_query->queried_terms ); $matched_taxonomy = reset( $queried_taxonomies ); $query = $this->tax_query->queried_terms[ $matched_taxonomy ]; if ( ! empty( $query['terms'] ) ) { if ( 'term_id' === $query['field'] ) { $term = get_term( reset( $query['terms'] ), $matched_taxonomy ); } else { $term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy ); } } } } if ( ! empty( $term ) && ! is_wp_error( $term ) ) { $this->queried_object = $term; $this->queried_object_id = (int) $term->term_id; if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) { _make_cat_compat( $this->queried_object ); } } } elseif ( $this->is_post_type_archive ) { $post_type = $this->get( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $this->queried_object = get_post_type_object( $post_type ); } elseif ( $this->is_posts_page ) { $page_for_posts = get_option( 'page_for_posts' ); $this->queried_object = get_post( $page_for_posts ); $this->queried_object_id = (int) $this->queried_object->ID; } elseif ( $this->is_singular && ! empty( $this->post ) ) { $this->queried_object = $this->post; $this->queried_object_id = (int) $this->post->ID; } elseif ( $this->is_author ) { $author = (int) $this->get( 'author' ); $author_name = $this->get( 'author_name' ); if ( $author ) { $this->queried_object_id = $author; } elseif ( $author_name ) { $user = get_user_by( 'slug', $author_name ); if ( $user ) { $this->queried_object_id = $user->ID; } } $this->queried_object = get_userdata( $this->queried_object_id ); } return $this->queried_object; } public function get_queried_object_id() { $this->get_queried_object(); if ( isset( $this->queried_object_id ) ) { return $this->queried_object_id; } return 0; } public function __construct( $query = '' ) { if ( ! empty( $query ) ) { $this->query( $query ); } } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } } public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; } public function is_archive() { return (bool) $this->is_archive; } public function is_post_type_archive( $post_types = '' ) { if ( empty( $post_types ) || ! $this->is_post_type_archive ) { return (bool) $this->is_post_type_archive; } $post_type = $this->get( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_object = get_post_type_object( $post_type ); return in_array( $post_type_object->name, (array) $post_types, true ); } public function is_attachment( $attachment = '' ) { if ( ! $this->is_attachment ) { return false; } if ( empty( $attachment ) ) { return true; } $attachment = array_map( 'strval', (array) $attachment ); $post_obj = $this->get_queried_object(); if ( in_array( (string) $post_obj->ID, $attachment, true ) ) { return true; } elseif ( in_array( $post_obj->post_title, $attachment, true ) ) { return true; } elseif ( in_array( $post_obj->post_name, $attachment, true ) ) { return true; } return false; } public function is_author( $author = '' ) { if ( ! $this->is_author ) { return false; } if ( empty( $author ) ) { return true; } $author_obj = $this->get_queried_object(); $author = array_map( 'strval', (array) $author ); if ( in_array( (string) $author_obj->ID, $author, true ) ) { return true; } elseif ( in_array( $author_obj->nickname, $author, true ) ) { return true; } elseif ( in_array( $author_obj->user_nicename, $author, true ) ) { return true; } return false; } public function is_category( $category = '' ) { if ( ! $this->is_category ) { return false; } if ( empty( $category ) ) { return true; } $cat_obj = $this->get_queried_object(); $category = array_map( 'strval', (array) $category ); if ( in_array( (string) $cat_obj->term_id, $category, true ) ) { return true; } elseif ( in_array( $cat_obj->name, $category, true ) ) { return true; } elseif ( in_array( $cat_obj->slug, $category, true ) ) { return true; } return false; } public function is_tag( $tag = '' ) { if ( ! $this->is_tag ) { return false; } if ( empty( $tag ) ) { return true; } $tag_obj = $this->get_queried_object(); $tag = array_map( 'strval', (array) $tag ); if ( in_array( (string) $tag_obj->term_id, $tag, true ) ) { return true; } elseif ( in_array( $tag_obj->name, $tag, true ) ) { return true; } elseif ( in_array( $tag_obj->slug, $tag, true ) ) { return true; } return false; } public function is_tax( $taxonomy = '', $term = '' ) { global $wp_taxonomies; if ( ! $this->is_tax ) { return false; } if ( empty( $taxonomy ) ) { return true; } $queried_object = $this->get_queried_object(); $tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy ); $term_array = (array) $term; if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array, true ) ) ) { return false; } if ( empty( $term ) ) { return true; } return isset( $queried_object->term_id ) && count( array_intersect( array( $queried_object->term_id, $queried_object->name, $queried_object->slug ), $term_array ) ); } public function is_comments_popup() { _deprecated_function( __FUNCTION__, '4.5.0' ); return false; } public function is_date() { return (bool) $this->is_date; } public function is_day() { return (bool) $this->is_day; } public function is_feed( $feeds = '' ) { if ( empty( $feeds ) || ! $this->is_feed ) { return (bool) $this->is_feed; } $qv = $this->get( 'feed' ); if ( 'feed' === $qv ) { $qv = get_default_feed(); } return in_array( $qv, (array) $feeds, true ); } public function is_comment_feed() { return (bool) $this->is_comment_feed; } public function is_front_page() { if ( 'posts' === get_option( 'show_on_front' ) && $this->is_home() ) { return true; } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) { return true; } else { return false; } } public function is_home() { return (bool) $this->is_home; } public function is_privacy_policy() { if ( get_option( 'wp_page_for_privacy_policy' ) && $this->is_page( get_option( 'wp_page_for_privacy_policy' ) ) ) { return true; } else { return false; } } public function is_month() { return (bool) $this->is_month; } public function is_page( $page = '' ) { if ( ! $this->is_page ) { return false; } if ( empty( $page ) ) { return true; } $page_obj = $this->get_queried_object(); $page = array_map( 'strval', (array) $page ); if ( in_array( (string) $page_obj->ID, $page, true ) ) { return true; } elseif ( in_array( $page_obj->post_title, $page, true ) ) { return true; } elseif ( in_array( $page_obj->post_name, $page, true ) ) { return true; } else { foreach ( $page as $pagepath ) { if ( ! strpos( $pagepath, '/' ) ) { continue; } $pagepath_obj = get_page_by_path( $pagepath ); if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) { return true; } } } return false; } public function is_paged() { return (bool) $this->is_paged; } public function is_preview() { return (bool) $this->is_preview; } public function is_robots() { return (bool) $this->is_robots; } public function is_favicon() { return (bool) $this->is_favicon; } public function is_search() { return (bool) $this->is_search; } public function is_single( $post = '' ) { if ( ! $this->is_single ) { return false; } if ( empty( $post ) ) { return true; } $post_obj = $this->get_queried_object(); $post = array_map( 'strval', (array) $post ); if ( in_array( (string) $post_obj->ID, $post, true ) ) { return true; } elseif ( in_array( $post_obj->post_title, $post, true ) ) { return true; } elseif ( in_array( $post_obj->post_name, $post, true ) ) { return true; } else { foreach ( $post as $postpath ) { if ( ! strpos( $postpath, '/' ) ) { continue; } $postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type ); if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) { return true; } } } return false; } public function is_singular( $post_types = '' ) { if ( empty( $post_types ) || ! $this->is_singular ) { return (bool) $this->is_singular; } $post_obj = $this->get_queried_object(); return in_array( $post_obj->post_type, (array) $post_types, true ); } public function is_time() { return (bool) $this->is_time; } public function is_trackback() { return (bool) $this->is_trackback; } public function is_year() { return (bool) $this->is_year; } public function is_404() { return (bool) $this->is_404; } public function is_embed() { return (bool) $this->is_embed; } public function is_main_query() { global $wp_the_query; return $wp_the_query === $this; } public function setup_postdata( $post ) { global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; if ( ! ( $post instanceof WP_Post ) ) { $post = get_post( $post ); } if ( ! $post ) { return; } $elements = $this->generate_postdata( $post ); if ( false === $elements ) { return; } $id = $elements['id']; $authordata = $elements['authordata']; $currentday = $elements['currentday']; $currentmonth = $elements['currentmonth']; $page = $elements['page']; $pages = $elements['pages']; $multipage = $elements['multipage']; $more = $elements['more']; $numpages = $elements['numpages']; do_action_ref_array( 'the_post', array( &$post, &$this ) ); return true; } public function generate_postdata( $post ) { if ( ! ( $post instanceof WP_Post ) ) { $post = get_post( $post ); } if ( ! $post ) { return false; } $id = (int) $post->ID; $authordata = get_userdata( $post->post_author ); $currentday = mysql2date( 'd.m.y', $post->post_date, false ); $currentmonth = mysql2date( 'm', $post->post_date, false ); $numpages = 1; $multipage = 0; $page = $this->get( 'page' ); if ( ! $page ) { $page = 1; } if ( get_queried_object_id() === $post->ID && ( $this->is_page() || $this->is_single() ) ) { $more = 1; } elseif ( $this->is_feed() ) { $more = 1; } else { $more = 0; } $content = $post->post_content; if ( false !== strpos( $content, '' ) ) { $content = str_replace( "\n\n", '', $content ); $content = str_replace( "\n", '', $content ); $content = str_replace( "\n", '', $content ); $content = str_replace( '', '', $content ); $content = str_replace( '', '', $content ); if ( 0 === strpos( $content, '' ) ) { $content = substr( $content, 15 ); } $pages = explode( '', $content ); } else { $pages = array( $post->post_content ); } $pages = apply_filters( 'content_pagination', $pages, $post ); $numpages = count( $pages ); if ( $numpages > 1 ) { if ( $page > 1 ) { $more = 1; } $multipage = 1; } else { $multipage = 0; } $elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' ); return $elements; } public function reset_postdata() { if ( ! empty( $this->post ) ) { $GLOBALS['post'] = $this->post; $this->setup_postdata( $this->post ); } } public function lazyload_term_meta( $check, $term_id ) { _deprecated_function( __METHOD__, '4.5.0' ); return $check; } public function lazyload_comment_meta( $check, $comment_id ) { _deprecated_function( __METHOD__, '4.5.0' ); return $check; } } ID, $remember); } else : _deprecated_function( 'wp_setcookie', '2.5.0', 'wp_set_auth_cookie()' ); endif; if ( !function_exists('wp_clearcookie') ) : function wp_clearcookie() { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' ); wp_clear_auth_cookie(); } else : _deprecated_function( 'wp_clearcookie', '2.5.0', 'wp_clear_auth_cookie()' ); endif; if ( !function_exists('wp_get_cookie_login') ): function wp_get_cookie_login() { _deprecated_function( __FUNCTION__, '2.5.0' ); return false; } else : _deprecated_function( 'wp_get_cookie_login', '2.5.0' ); endif; if ( !function_exists('wp_login') ) : function wp_login($username, $password, $deprecated = '') { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' ); global $error; $user = wp_authenticate($username, $password); if ( ! is_wp_error($user) ) return true; $error = $user->get_error_message(); return false; } else : _deprecated_function( 'wp_login', '2.5.0', 'wp_signon()' ); endif; if ( ! class_exists( 'wp_atom_server', false ) ) { class wp_atom_server { public function __call( $name, $arguments ) { _deprecated_function( __CLASS__ . '::' . $name, '3.5.0', 'the Atom Publishing Protocol plugin' ); } public static function __callStatic( $name, $arguments ) { _deprecated_function( __CLASS__ . '::' . $name, '3.5.0', 'the Atom Publishing Protocol plugin' ); } } } $category_name ), $category_properties ); $this->registered_categories[ $category_name ] = $category; if ( current_action() && 'init' !== current_action() ) { $this->registered_categories_outside_init[ $category_name ] = $category; } return true; } public function unregister( $category_name ) { if ( ! $this->is_registered( $category_name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Block pattern category "%s" not found.' ), $category_name ), '5.5.0' ); return false; } unset( $this->registered_categories[ $category_name ] ); unset( $this->registered_categories_outside_init[ $category_name ] ); return true; } public function get_registered( $category_name ) { if ( ! $this->is_registered( $category_name ) ) { return null; } return $this->registered_categories[ $category_name ]; } public function get_all_registered( $outside_init_only = false ) { return array_values( $outside_init_only ? $this->registered_categories_outside_init : $this->registered_categories ); } public function is_registered( $category_name ) { return isset( $this->registered_categories[ $category_name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } function register_block_pattern_category( $category_name, $category_properties ) { return WP_Block_Pattern_Categories_Registry::get_instance()->register( $category_name, $category_properties ); } function unregister_block_pattern_category( $category_name ) { return WP_Block_Pattern_Categories_Registry::get_instance()->unregister( $category_name ); } locale; return $locale ? $locale : get_locale(); } function determine_locale() { $determined_locale = apply_filters( 'pre_determine_locale', null ); if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) { return $determined_locale; } $determined_locale = get_locale(); if ( is_admin() ) { $determined_locale = get_user_locale(); } if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) { $determined_locale = get_user_locale(); } $wp_lang = ''; if ( ! empty( $_GET['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_GET['wp_lang'] ); } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) { $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); } if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { $determined_locale = $wp_lang; } return apply_filters( 'determine_locale', $determined_locale ); } function translate( $text, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); $translation = $translations->translate( $text ); $translation = apply_filters( 'gettext', $translation, $text, $domain ); $translation = apply_filters( "gettext_{$domain}", $translation, $text, $domain ); return $translation; } function before_last_bar( $string ) { $last_bar = strrpos( $string, '|' ); if ( false === $last_bar ) { return $string; } else { return substr( $string, 0, $last_bar ); } } function translate_with_gettext_context( $text, $context, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); $translation = $translations->translate( $text, $context ); $translation = apply_filters( 'gettext_with_context', $translation, $text, $context, $domain ); $translation = apply_filters( "gettext_with_context_{$domain}", $translation, $text, $context, $domain ); return $translation; } function __( $text, $domain = 'default' ) { return translate( $text, $domain ); } function esc_attr__( $text, $domain = 'default' ) { return esc_attr( translate( $text, $domain ) ); } function esc_html__( $text, $domain = 'default' ) { return esc_html( translate( $text, $domain ) ); } function _e( $text, $domain = 'default' ) { echo translate( $text, $domain ); } function esc_attr_e( $text, $domain = 'default' ) { echo esc_attr( translate( $text, $domain ) ); } function esc_html_e( $text, $domain = 'default' ) { echo esc_html( translate( $text, $domain ) ); } function _x( $text, $context, $domain = 'default' ) { return translate_with_gettext_context( $text, $context, $domain ); } function _ex( $text, $context, $domain = 'default' ) { echo _x( $text, $context, $domain ); } function esc_attr_x( $text, $context, $domain = 'default' ) { return esc_attr( translate_with_gettext_context( $text, $context, $domain ) ); } function esc_html_x( $text, $context, $domain = 'default' ) { return esc_html( translate_with_gettext_context( $text, $context, $domain ) ); } function _n( $single, $plural, $number, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); $translation = $translations->translate_plural( $single, $plural, $number ); $translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain ); $translation = apply_filters( "ngettext_{$domain}", $translation, $single, $plural, $number, $domain ); return $translation; } function _nx( $single, $plural, $number, $context, $domain = 'default' ) { $translations = get_translations_for_domain( $domain ); $translation = $translations->translate_plural( $single, $plural, $number, $context ); $translation = apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain ); $translation = apply_filters( "ngettext_with_context_{$domain}", $translation, $single, $plural, $number, $context, $domain ); return $translation; } function _n_noop( $singular, $plural, $domain = null ) { return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null, 'domain' => $domain, ); } function _nx_noop( $singular, $plural, $context, $domain = null ) { return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain, ); } function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { if ( $nooped_plural['domain'] ) { $domain = $nooped_plural['domain']; } if ( $nooped_plural['context'] ) { return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain ); } else { return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain ); } } function load_textdomain( $domain, $mofile ) { global $l10n, $l10n_unloaded; $l10n_unloaded = (array) $l10n_unloaded; $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile ); if ( true === (bool) $plugin_override ) { unset( $l10n_unloaded[ $domain ] ); return true; } do_action( 'load_textdomain', $domain, $mofile ); $mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain ); if ( ! is_readable( $mofile ) ) { return false; } $mo = new MO(); if ( ! $mo->import_from_file( $mofile ) ) { return false; } if ( isset( $l10n[ $domain ] ) ) { $mo->merge_with( $l10n[ $domain ] ); } unset( $l10n_unloaded[ $domain ] ); $l10n[ $domain ] = &$mo; return true; } function unload_textdomain( $domain ) { global $l10n, $l10n_unloaded; $l10n_unloaded = (array) $l10n_unloaded; $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain ); if ( $plugin_override ) { $l10n_unloaded[ $domain ] = true; return true; } do_action( 'unload_textdomain', $domain ); if ( isset( $l10n[ $domain ] ) ) { unset( $l10n[ $domain ] ); $l10n_unloaded[ $domain ] = true; return true; } return false; } function load_default_textdomain( $locale = null ) { if ( null === $locale ) { $locale = determine_locale(); } unload_textdomain( 'default' ); $return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" ); if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists( WP_LANG_DIR . "/admin-$locale.mo" ) ) { load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" ); return $return; } if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) { load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" ); } if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) { load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" ); } return $return; } function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) { $locale = apply_filters( 'plugin_locale', determine_locale(), $domain ); $mofile = $domain . '-' . $locale . '.mo'; if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { return true; } if ( false !== $plugin_rel_path ) { $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' ); } elseif ( false !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); $path = ABSPATH . trim( $deprecated, '/' ); } else { $path = WP_PLUGIN_DIR; } return load_textdomain( $domain, $path . '/' . $mofile ); } function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { $locale = apply_filters( 'plugin_locale', determine_locale(), $domain ); $mofile = $domain . '-' . $locale . '.mo'; if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { return true; } $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ); return load_textdomain( $domain, $path . '/' . $mofile ); } function load_theme_textdomain( $domain, $path = false ) { $locale = apply_filters( 'theme_locale', determine_locale(), $domain ); $mofile = $domain . '-' . $locale . '.mo'; if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) { return true; } if ( ! $path ) { $path = get_template_directory(); } return load_textdomain( $domain, $path . '/' . $locale . '.mo' ); } function load_child_theme_textdomain( $domain, $path = false ) { if ( ! $path ) { $path = get_stylesheet_directory(); } return load_theme_textdomain( $domain, $path ); } function load_script_textdomain( $handle, $domain = 'default', $path = null ) { $wp_scripts = wp_scripts(); if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { return false; } $path = untrailingslashit( $path ); $locale = determine_locale(); $file_base = 'default' === $domain ? $locale : $domain . '-' . $locale; $handle_filename = $file_base . '-' . $handle . '.json'; if ( $path ) { $translations = load_script_translations( $path . '/' . $handle_filename, $handle, $domain ); if ( $translations ) { return $translations; } } $src = $wp_scripts->registered[ $handle ]->src; if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) { $src = $wp_scripts->base_url . $src; } $relative = false; $languages_path = WP_LANG_DIR; $src_url = wp_parse_url( $src ); $content_url = wp_parse_url( content_url() ); $plugins_url = wp_parse_url( plugins_url() ); $site_url = wp_parse_url( site_url() ); if ( ( ! isset( $content_url['path'] ) || strpos( $src_url['path'], $content_url['path'] ) === 0 ) && ( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] ) ) { if ( isset( $content_url['path'] ) ) { $relative = substr( $src_url['path'], strlen( $content_url['path'] ) ); } else { $relative = $src_url['path']; } $relative = trim( $relative, '/' ); $relative = explode( '/', $relative ); $languages_path = WP_LANG_DIR . '/' . $relative[0]; $relative = array_slice( $relative, 2 ); $relative = implode( '/', $relative ); } elseif ( ( ! isset( $plugins_url['path'] ) || strpos( $src_url['path'], $plugins_url['path'] ) === 0 ) && ( ! isset( $src_url['host'] ) || ! isset( $plugins_url['host'] ) || $src_url['host'] === $plugins_url['host'] ) ) { if ( isset( $plugins_url['path'] ) ) { $relative = substr( $src_url['path'], strlen( $plugins_url['path'] ) ); } else { $relative = $src_url['path']; } $relative = trim( $relative, '/' ); $relative = explode( '/', $relative ); $languages_path = WP_LANG_DIR . '/plugins'; $relative = array_slice( $relative, 1 ); $relative = implode( '/', $relative ); } elseif ( ! isset( $src_url['host'] ) || ! isset( $site_url['host'] ) || $src_url['host'] === $site_url['host'] ) { if ( ! isset( $site_url['path'] ) ) { $relative = trim( $src_url['path'], '/' ); } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { $relative = substr( $src_url['path'], strlen( $site_url['path'] ) ); $relative = trim( $relative, '/' ); } } $relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src ); if ( false === $relative ) { return load_script_translations( false, $handle, $domain ); } if ( substr( $relative, -7 ) === '.min.js' ) { $relative = substr( $relative, 0, -7 ) . '.js'; } $md5_filename = $file_base . '-' . md5( $relative ) . '.json'; if ( $path ) { $translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain ); if ( $translations ) { return $translations; } } $translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain ); if ( $translations ) { return $translations; } return load_script_translations( false, $handle, $domain ); } function load_script_translations( $file, $handle, $domain ) { $translations = apply_filters( 'pre_load_script_translations', null, $file, $handle, $domain ); if ( null !== $translations ) { return $translations; } $file = apply_filters( 'load_script_translation_file', $file, $handle, $domain ); if ( ! $file || ! is_readable( $file ) ) { return false; } $translations = file_get_contents( $file ); return apply_filters( 'load_script_translations', $translations, $file, $handle, $domain ); } function _load_textdomain_just_in_time( $domain ) { global $l10n_unloaded; $l10n_unloaded = (array) $l10n_unloaded; if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) { return false; } $translation_path = _get_path_to_translation( $domain ); if ( false === $translation_path ) { return false; } return load_textdomain( $domain, $translation_path ); } function _get_path_to_translation( $domain, $reset = false ) { static $available_translations = array(); if ( true === $reset ) { $available_translations = array(); } if ( ! isset( $available_translations[ $domain ] ) ) { $available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain ); } return $available_translations[ $domain ]; } function _get_path_to_translation_from_lang_dir( $domain ) { static $cached_mofiles = null; if ( null === $cached_mofiles ) { $cached_mofiles = array(); $locations = array( WP_LANG_DIR . '/plugins', WP_LANG_DIR . '/themes', ); foreach ( $locations as $location ) { $mofiles = glob( $location . '/*.mo' ); if ( $mofiles ) { $cached_mofiles = array_merge( $cached_mofiles, $mofiles ); } } } $locale = determine_locale(); $mofile = "{$domain}-{$locale}.mo"; $path = WP_LANG_DIR . '/plugins/' . $mofile; if ( in_array( $path, $cached_mofiles, true ) ) { return $path; } $path = WP_LANG_DIR . '/themes/' . $mofile; if ( in_array( $path, $cached_mofiles, true ) ) { return $path; } return false; } function get_translations_for_domain( $domain ) { global $l10n; if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) { return $l10n[ $domain ]; } static $noop_translations = null; if ( null === $noop_translations ) { $noop_translations = new NOOP_Translations; } return $noop_translations; } function is_textdomain_loaded( $domain ) { global $l10n; return isset( $l10n[ $domain ] ); } function translate_user_role( $name, $domain = 'default' ) { return translate_with_gettext_context( before_last_bar( $name ), 'User role', $domain ); } function get_available_languages( $dir = null ) { $languages = array(); $lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' ); if ( $lang_files ) { foreach ( $lang_files as $lang_file ) { $lang_file = basename( $lang_file, '.mo' ); if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) && 0 !== strpos( $lang_file, 'admin-' ) ) { $languages[] = $lang_file; } } } return apply_filters( 'get_available_languages', $languages, $dir ); } function wp_get_installed_translations( $type ) { if ( 'themes' !== $type && 'plugins' !== $type && 'core' !== $type ) { return array(); } $dir = 'core' === $type ? '' : "/$type"; if ( ! is_dir( WP_LANG_DIR ) ) { return array(); } if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) ) { return array(); } $files = scandir( WP_LANG_DIR . $dir ); if ( ! $files ) { return array(); } $language_data = array(); foreach ( $files as $file ) { if ( '.' === $file[0] || is_dir( WP_LANG_DIR . "$dir/$file" ) ) { continue; } if ( substr( $file, -3 ) !== '.po' ) { continue; } if ( ! preg_match( '/(?:(.+)-)?([a-z]{2,3}(?:_[A-Z]{2})?(?:_[a-z0-9]+)?).po/', $file, $match ) ) { continue; } if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files, true ) ) { continue; } list( , $textdomain, $language ) = $match; if ( '' === $textdomain ) { $textdomain = 'default'; } $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" ); } return $language_data; } function wp_get_pomo_file_data( $po_file ) { $headers = get_file_data( $po_file, array( 'POT-Creation-Date' => '"POT-Creation-Date', 'PO-Revision-Date' => '"PO-Revision-Date', 'Project-Id-Version' => '"Project-Id-Version', 'X-Generator' => '"X-Generator', ) ); foreach ( $headers as $header => $value ) { $headers[ $header ] = preg_replace( '~(\\\n)?"$~', '', $value ); } return $headers; } function wp_dropdown_languages( $args = array() ) { $parsed_args = wp_parse_args( $args, array( 'id' => 'locale', 'name' => 'locale', 'languages' => array(), 'translations' => array(), 'selected' => '', 'echo' => 1, 'show_available_translations' => true, 'show_option_site_default' => false, 'show_option_en_us' => true, 'explicit_option_en_us' => false, ) ); if ( ! $parsed_args['id'] || ! $parsed_args['name'] ) { return; } if ( 'en_US' === $parsed_args['selected'] && ! $parsed_args['explicit_option_en_us'] ) { $parsed_args['selected'] = ''; } $translations = $parsed_args['translations']; if ( empty( $translations ) ) { require_once ABSPATH . 'wp-admin/includes/translation-install.php'; $translations = wp_get_available_translations(); } $languages = array(); foreach ( $parsed_args['languages'] as $locale ) { if ( isset( $translations[ $locale ] ) ) { $translation = $translations[ $locale ]; $languages[] = array( 'language' => $translation['language'], 'native_name' => $translation['native_name'], 'lang' => current( $translation['iso'] ), ); unset( $translations[ $locale ] ); } else { $languages[] = array( 'language' => $locale, 'native_name' => $locale, 'lang' => '', ); } } $translations_available = ( ! empty( $translations ) && $parsed_args['show_available_translations'] ); $structure = array(); if ( $translations_available ) { $structure[] = ''; } if ( $parsed_args['show_option_site_default'] ) { $structure[] = sprintf( '', selected( 'site-default', $parsed_args['selected'], false ), _x( 'Site Default', 'default site language' ) ); } if ( $parsed_args['show_option_en_us'] ) { $value = ( $parsed_args['explicit_option_en_us'] ) ? 'en_US' : ''; $structure[] = sprintf( '', esc_attr( $value ), selected( '', $parsed_args['selected'], false ) ); } foreach ( $languages as $language ) { $structure[] = sprintf( '', esc_attr( $language['language'] ), esc_attr( $language['lang'] ), selected( $language['language'], $parsed_args['selected'], false ), esc_html( $language['native_name'] ) ); } if ( $translations_available ) { $structure[] = ''; } if ( $translations_available ) { $structure[] = ''; foreach ( $translations as $translation ) { $structure[] = sprintf( '', esc_attr( $translation['language'] ), esc_attr( current( $translation['iso'] ) ), selected( $translation['language'], $parsed_args['selected'], false ), esc_html( $translation['native_name'] ) ); } $structure[] = ''; } $output = sprintf( ''; if ( $parsed_args['echo'] ) { echo $output; } return $output; } function is_rtl() { global $wp_locale; if ( ! ( $wp_locale instanceof WP_Locale ) ) { return false; } return $wp_locale->is_rtl(); } function switch_to_locale( $locale ) { global $wp_locale_switcher; return $wp_locale_switcher->switch_to_locale( $locale ); } function restore_previous_locale() { global $wp_locale_switcher; return $wp_locale_switcher->restore_previous_locale(); } function restore_current_locale() { global $wp_locale_switcher; return $wp_locale_switcher->restore_current_locale(); } function is_locale_switched() { global $wp_locale_switcher; return $wp_locale_switcher->is_switched(); } function translate_settings_using_i18n_schema( $i18n_schema, $settings, $textdomain ) { if ( empty( $i18n_schema ) || empty( $settings ) || empty( $textdomain ) ) { return $settings; } if ( is_string( $i18n_schema ) && is_string( $settings ) ) { return translate_with_gettext_context( $settings, $i18n_schema, $textdomain ); } if ( is_array( $i18n_schema ) && is_array( $settings ) ) { $translated_settings = array(); foreach ( $settings as $value ) { $translated_settings[] = translate_settings_using_i18n_schema( $i18n_schema[0], $value, $textdomain ); } return $translated_settings; } if ( is_object( $i18n_schema ) && is_array( $settings ) ) { $group_key = '*'; $translated_settings = array(); foreach ( $settings as $key => $value ) { if ( isset( $i18n_schema->$key ) ) { $translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$key, $value, $textdomain ); } elseif ( isset( $i18n_schema->$group_key ) ) { $translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$group_key, $value, $textdomain ); } else { $translated_settings[ $key ] = $value; } } return $translated_settings; } return $settings; } function wp_get_list_item_separator() { global $wp_locale; return $wp_locale->get_list_item_separator(); } has_archive ) { return ''; } return get_archive_template(); } function get_author_template() { $author = get_queried_object(); $templates = array(); if ( $author instanceof WP_User ) { $templates[] = "author-{$author->user_nicename}.php"; $templates[] = "author-{$author->ID}.php"; } $templates[] = 'author.php'; return get_query_template( 'author', $templates ); } function get_category_template() { $category = get_queried_object(); $templates = array(); if ( ! empty( $category->slug ) ) { $slug_decoded = urldecode( $category->slug ); if ( $slug_decoded !== $category->slug ) { $templates[] = "category-{$slug_decoded}.php"; } $templates[] = "category-{$category->slug}.php"; $templates[] = "category-{$category->term_id}.php"; } $templates[] = 'category.php'; return get_query_template( 'category', $templates ); } function get_tag_template() { $tag = get_queried_object(); $templates = array(); if ( ! empty( $tag->slug ) ) { $slug_decoded = urldecode( $tag->slug ); if ( $slug_decoded !== $tag->slug ) { $templates[] = "tag-{$slug_decoded}.php"; } $templates[] = "tag-{$tag->slug}.php"; $templates[] = "tag-{$tag->term_id}.php"; } $templates[] = 'tag.php'; return get_query_template( 'tag', $templates ); } function get_taxonomy_template() { $term = get_queried_object(); $templates = array(); if ( ! empty( $term->slug ) ) { $taxonomy = $term->taxonomy; $slug_decoded = urldecode( $term->slug ); if ( $slug_decoded !== $term->slug ) { $templates[] = "taxonomy-$taxonomy-{$slug_decoded}.php"; } $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; $templates[] = "taxonomy-$taxonomy.php"; } $templates[] = 'taxonomy.php'; return get_query_template( 'taxonomy', $templates ); } function get_date_template() { return get_query_template( 'date' ); } function get_home_template() { $templates = array( 'home.php', 'index.php' ); return get_query_template( 'home', $templates ); } function get_front_page_template() { $templates = array( 'front-page.php' ); return get_query_template( 'frontpage', $templates ); } function get_privacy_policy_template() { $templates = array( 'privacy-policy.php' ); return get_query_template( 'privacypolicy', $templates ); } function get_page_template() { $id = get_queried_object_id(); $template = get_page_template_slug(); $pagename = get_query_var( 'pagename' ); if ( ! $pagename && $id ) { $post = get_queried_object(); if ( $post ) { $pagename = $post->post_name; } } $templates = array(); if ( $template && 0 === validate_file( $template ) ) { $templates[] = $template; } if ( $pagename ) { $pagename_decoded = urldecode( $pagename ); if ( $pagename_decoded !== $pagename ) { $templates[] = "page-{$pagename_decoded}.php"; } $templates[] = "page-{$pagename}.php"; } if ( $id ) { $templates[] = "page-{$id}.php"; } $templates[] = 'page.php'; return get_query_template( 'page', $templates ); } function get_search_template() { return get_query_template( 'search' ); } function get_single_template() { $object = get_queried_object(); $templates = array(); if ( ! empty( $object->post_type ) ) { $template = get_page_template_slug( $object ); if ( $template && 0 === validate_file( $template ) ) { $templates[] = $template; } $name_decoded = urldecode( $object->post_name ); if ( $name_decoded !== $object->post_name ) { $templates[] = "single-{$object->post_type}-{$name_decoded}.php"; } $templates[] = "single-{$object->post_type}-{$object->post_name}.php"; $templates[] = "single-{$object->post_type}.php"; } $templates[] = 'single.php'; return get_query_template( 'single', $templates ); } function get_embed_template() { $object = get_queried_object(); $templates = array(); if ( ! empty( $object->post_type ) ) { $post_format = get_post_format( $object ); if ( $post_format ) { $templates[] = "embed-{$object->post_type}-{$post_format}.php"; } $templates[] = "embed-{$object->post_type}.php"; } $templates[] = 'embed.php'; return get_query_template( 'embed', $templates ); } function get_singular_template() { return get_query_template( 'singular' ); } function get_attachment_template() { $attachment = get_queried_object(); $templates = array(); if ( $attachment ) { if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); } else { list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); } if ( ! empty( $subtype ) ) { $templates[] = "{$type}-{$subtype}.php"; $templates[] = "{$subtype}.php"; } $templates[] = "{$type}.php"; } $templates[] = 'attachment.php'; return get_query_template( 'attachment', $templates ); } function locate_template( $template_names, $load = false, $require_once = true, $args = array() ) { $located = ''; foreach ( (array) $template_names as $template_name ) { if ( ! $template_name ) { continue; } if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) { $located = STYLESHEETPATH . '/' . $template_name; break; } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) { $located = TEMPLATEPATH . '/' . $template_name; break; } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) { $located = ABSPATH . WPINC . '/theme-compat/' . $template_name; break; } } if ( $load && '' !== $located ) { load_template( $located, $require_once, $args ); } return $located; } function load_template( $_template_file, $require_once = true, $args = array() ) { global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; if ( is_array( $wp_query->query_vars ) ) { extract( $wp_query->query_vars, EXTR_SKIP ); } if ( isset( $s ) ) { $s = esc_attr( $s ); } if ( $require_once ) { require_once $_template_file; } else { require $_template_file; } } archived || '1' == $current_blog->spam || '1' == $current_blog->deleted ) { status_header( 404 ); die( '404 — File not found.' ); } $file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET['file'] ); if ( ! is_file( $file ) ) { status_header( 404 ); die( '404 — File not found.' ); } $mime = wp_check_filetype( $file ); if ( false === $mime['type'] && function_exists( 'mime_content_type' ) ) { $mime['type'] = mime_content_type( $file ); } if ( $mime['type'] ) { $mimetype = $mime['type']; } else { $mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 ); } header( 'Content-Type: ' . $mimetype ); if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) ) { header( 'Content-Length: ' . filesize( $file ) ); } if ( WPMU_ACCEL_REDIRECT ) { header( 'X-Accel-Redirect: ' . str_replace( WP_CONTENT_DIR, '', $file ) ); exit; } elseif ( WPMU_SENDFILE ) { header( 'X-Sendfile: ' . $file ); exit; } $last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) ); $etag = '"' . md5( $last_modified ) . '"'; header( "Last-Modified: $last_modified GMT" ); header( 'ETag: ' . $etag ); header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' ); $client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false; if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $_SERVER['HTTP_IF_MODIFIED_SINCE'] = false; } $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; $modified_timestamp = strtotime( $last_modified ); if ( ( $client_last_modified && $client_etag ) ? ( ( $client_modified_timestamp >= $modified_timestamp ) && ( $client_etag == $etag ) ) : ( ( $client_modified_timestamp >= $modified_timestamp ) || ( $client_etag == $etag ) ) ) { status_header( 304 ); exit; } readfile( $file ); flush(); type_attr = " type='text/css'"; } do_action_ref_array( 'wp_default_styles', array( &$this ) ); } public function do_item( $handle, $group = false ) { if ( ! parent::do_item( $handle ) ) { return false; } $obj = $this->registered[ $handle ]; if ( null === $obj->ver ) { $ver = ''; } else { $ver = $obj->ver ? $obj->ver : $this->default_version; } if ( isset( $this->args[ $handle ] ) ) { $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ]; } $src = $obj->src; $cond_before = ''; $cond_after = ''; $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; if ( $conditional ) { $cond_before = "\n"; } $inline_style = $this->print_inline_style( $handle, false ); if ( $inline_style ) { $inline_style_tag = sprintf( "\n", esc_attr( $handle ), $this->type_attr, $inline_style ); } else { $inline_style_tag = ''; } if ( $this->do_concat ) { if ( $this->in_default_dir( $src ) && ! $conditional && ! isset( $obj->extra['alt'] ) ) { $this->concat .= "$handle,"; $this->concat_version .= "$handle$ver"; $this->print_code .= $inline_style; return true; } } if ( isset( $obj->args ) ) { $media = esc_attr( $obj->args ); } else { $media = 'all'; } if ( ! $src ) { if ( $inline_style_tag ) { if ( $this->do_concat ) { $this->print_html .= $inline_style_tag; } else { echo $inline_style_tag; } } return true; } $href = $this->_css_href( $src, $ver, $handle ); if ( ! $href ) { return true; } $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; $title = isset( $obj->extra['title'] ) ? sprintf( "title='%s'", esc_attr( $obj->extra['title'] ) ) : ''; $tag = sprintf( "\n", $rel, $handle, $title, $href, $this->type_attr, $media ); $tag = apply_filters( 'style_loader_tag', $tag, $handle, $href, $media ); if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) { if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) { $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : ''; $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $src, $ver, "$handle-rtl" ) ); } else { $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" ); } $rtl_tag = sprintf( "\n", $rel, $handle, $title, $rtl_href, $this->type_attr, $media ); $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media ); if ( 'replace' === $obj->extra['rtl'] ) { $tag = $rtl_tag; } else { $tag .= $rtl_tag; } } if ( $this->do_concat ) { $this->print_html .= $cond_before; $this->print_html .= $tag; if ( $inline_style_tag ) { $this->print_html .= $inline_style_tag; } $this->print_html .= $cond_after; } else { echo $cond_before; echo $tag; $this->print_inline_style( $handle ); echo $cond_after; } return true; } public function add_inline_style( $handle, $code ) { if ( ! $code ) { return false; } $after = $this->get_data( $handle, 'after' ); if ( ! $after ) { $after = array(); } $after[] = $code; return $this->add_data( $handle, 'after', $after ); } public function print_inline_style( $handle, $display = true ) { $output = $this->get_data( $handle, 'after' ); if ( empty( $output ) ) { return false; } $output = implode( "\n", $output ); if ( ! $display ) { return $output; } printf( "\n", esc_attr( $handle ), $this->type_attr, $output ); return true; } public function all_deps( $handles, $recursion = false, $group = false ) { $r = parent::all_deps( $handles, $recursion, $group ); if ( ! $recursion ) { $this->to_do = apply_filters( 'print_styles_array', $this->to_do ); } return $r; } public function _css_href( $src, $ver, $handle ) { if ( ! is_bool( $src ) && ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) { $src = $this->base_url . $src; } if ( ! empty( $ver ) ) { $src = add_query_arg( 'ver', $ver, $src ); } $src = apply_filters( 'style_loader_src', $src, $handle ); return esc_url( $src ); } public function in_default_dir( $src ) { if ( ! $this->default_dirs ) { return true; } foreach ( (array) $this->default_dirs as $test ) { if ( 0 === strpos( $src, $test ) ) { return true; } } return false; } public function do_footer_items() { $this->do_items( false, 1 ); return $this->done; } public function reset() { $this->do_concat = false; $this->concat = ''; $this->concat_version = ''; $this->print_html = ''; } } dispatch('requests.before_request', array(&$url, &$headers, &$data, &$type, &$options)); if (!empty($options['transport'])) { $transport = $options['transport']; if (is_string($options['transport'])) { $transport = new $transport(); } } else { $need_ssl = (stripos($url, 'https://') === 0); $capabilities = array('ssl' => $need_ssl); $transport = self::get_transport($capabilities); } $response = $transport->request($url, $headers, $data, $options); $options['hooks']->dispatch('requests.before_parse', array(&$response, $url, $headers, $data, $type, $options)); return self::parse_response($response, $url, $headers, $data, $options); } public static function request_multiple($requests, $options = array()) { $options = array_merge(self::get_default_options(true), $options); if (!empty($options['hooks'])) { $options['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple')); if (!empty($options['complete'])) { $options['hooks']->register('multiple.request.complete', $options['complete']); } } foreach ($requests as $id => &$request) { if (!isset($request['headers'])) { $request['headers'] = array(); } if (!isset($request['data'])) { $request['data'] = array(); } if (!isset($request['type'])) { $request['type'] = self::GET; } if (!isset($request['options'])) { $request['options'] = $options; $request['options']['type'] = $request['type']; } else { if (empty($request['options']['type'])) { $request['options']['type'] = $request['type']; } $request['options'] = array_merge($options, $request['options']); } self::set_defaults($request['url'], $request['headers'], $request['data'], $request['type'], $request['options']); if ($request['options']['hooks'] !== $options['hooks']) { $request['options']['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple')); if (!empty($request['options']['complete'])) { $request['options']['hooks']->register('multiple.request.complete', $request['options']['complete']); } } } unset($request); if (!empty($options['transport'])) { $transport = $options['transport']; if (is_string($options['transport'])) { $transport = new $transport(); } } else { $transport = self::get_transport(); } $responses = $transport->request_multiple($requests, $options); foreach ($responses as $id => &$response) { if (is_string($response)) { $request = $requests[$id]; self::parse_multiple($response, $request); $request['options']['hooks']->dispatch('multiple.request.complete', array(&$response, $id)); } } return $responses; } protected static function get_default_options($multirequest = false) { $defaults = array( 'timeout' => 10, 'connect_timeout' => 10, 'useragent' => 'php-requests/' . self::VERSION, 'protocol_version' => 1.1, 'redirected' => 0, 'redirects' => 10, 'follow_redirects' => true, 'blocking' => true, 'type' => self::GET, 'filename' => false, 'auth' => false, 'proxy' => false, 'cookies' => false, 'max_bytes' => false, 'idn' => true, 'hooks' => null, 'transport' => null, 'verify' => self::get_certificate_path(), 'verifyname' => true, ); if ($multirequest !== false) { $defaults['complete'] = null; } return $defaults; } public static function get_certificate_path() { if (!empty(self::$certificate_path)) { return self::$certificate_path; } return dirname(__FILE__) . '/Requests/Transport/cacert.pem'; } public static function set_certificate_path($path) { self::$certificate_path = $path; } protected static function set_defaults(&$url, &$headers, &$data, &$type, &$options) { if (!preg_match('/^http(s)?:\/\//i', $url, $matches)) { throw new Requests_Exception('Only HTTP(S) requests are handled.', 'nonhttp', $url); } if (empty($options['hooks'])) { $options['hooks'] = new Requests_Hooks(); } if (is_array($options['auth'])) { $options['auth'] = new Requests_Auth_Basic($options['auth']); } if ($options['auth'] !== false) { $options['auth']->register($options['hooks']); } if (is_string($options['proxy']) || is_array($options['proxy'])) { $options['proxy'] = new Requests_Proxy_HTTP($options['proxy']); } if ($options['proxy'] !== false) { $options['proxy']->register($options['hooks']); } if (is_array($options['cookies'])) { $options['cookies'] = new Requests_Cookie_Jar($options['cookies']); } elseif (empty($options['cookies'])) { $options['cookies'] = new Requests_Cookie_Jar(); } if ($options['cookies'] !== false) { $options['cookies']->register($options['hooks']); } if ($options['idn'] !== false) { $iri = new Requests_IRI($url); $iri->host = Requests_IDNAEncoder::encode($iri->ihost); $url = $iri->uri; } $type = strtoupper($type); if (!isset($options['data_format'])) { if (in_array($type, array(self::HEAD, self::GET, self::DELETE), true)) { $options['data_format'] = 'query'; } else { $options['data_format'] = 'body'; } } } protected static function parse_response($headers, $url, $req_headers, $req_data, $options) { $return = new Requests_Response(); if (!$options['blocking']) { return $return; } $return->raw = $headers; $return->url = (string) $url; $return->body = ''; if (!$options['filename']) { $pos = strpos($headers, "\r\n\r\n"); if ($pos === false) { throw new Requests_Exception('Missing header/body separator', 'requests.no_crlf_separator'); } $headers = substr($return->raw, 0, $pos); $body = substr($return->raw, $pos + 4); if (!empty($body)) { $return->body = $body; } } $headers = str_replace("\r\n", "\n", $headers); $headers = preg_replace('/\n[ \t]/', ' ', $headers); $headers = explode("\n", $headers); preg_match('#^HTTP/(1\.\d)[ \t]+(\d+)#i', array_shift($headers), $matches); if (empty($matches)) { throw new Requests_Exception('Response could not be parsed', 'noversion', $headers); } $return->protocol_version = (float) $matches[1]; $return->status_code = (int) $matches[2]; if ($return->status_code >= 200 && $return->status_code < 300) { $return->success = true; } foreach ($headers as $header) { list($key, $value) = explode(':', $header, 2); $value = trim($value); preg_replace('#(\s+)#i', ' ', $value); $return->headers[$key] = $value; } if (isset($return->headers['transfer-encoding'])) { $return->body = self::decode_chunked($return->body); unset($return->headers['transfer-encoding']); } if (isset($return->headers['content-encoding'])) { $return->body = self::decompress($return->body); } if (isset($return->headers['connection'])) { unset($return->headers['connection']); } $options['hooks']->dispatch('requests.before_redirect_check', array(&$return, $req_headers, $req_data, $options)); if ($return->is_redirect() && $options['follow_redirects'] === true) { if (isset($return->headers['location']) && $options['redirected'] < $options['redirects']) { if ($return->status_code === 303) { $options['type'] = self::GET; } $options['redirected']++; $location = $return->headers['location']; if (strpos($location, 'http://') !== 0 && strpos($location, 'https://') !== 0) { $location = Requests_IRI::absolutize($url, $location); $location = $location->uri; } $hook_args = array( &$location, &$req_headers, &$req_data, &$options, $return, ); $options['hooks']->dispatch('requests.before_redirect', $hook_args); $redirected = self::request($location, $req_headers, $req_data, $options['type'], $options); $redirected->history[] = $return; return $redirected; } elseif ($options['redirected'] >= $options['redirects']) { throw new Requests_Exception('Too many redirects', 'toomanyredirects', $return); } } $return->redirects = $options['redirected']; $options['hooks']->dispatch('requests.after_request', array(&$return, $req_headers, $req_data, $options)); return $return; } public static function parse_multiple(&$response, $request) { try { $url = $request['url']; $headers = $request['headers']; $data = $request['data']; $options = $request['options']; $response = self::parse_response($response, $url, $headers, $data, $options); } catch (Requests_Exception $e) { $response = $e; } } protected static function decode_chunked($data) { if (!preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) { return $data; } $decoded = ''; $encoded = $data; while (true) { $is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches); if (!$is_chunked) { return $data; } $length = hexdec(trim($matches[1])); if ($length === 0) { return $decoded; } $chunk_length = strlen($matches[0]); $decoded .= substr($encoded, $chunk_length, $length); $encoded = substr($encoded, $chunk_length + $length + 2); if (trim($encoded) === '0' || empty($encoded)) { return $decoded; } } } public static function flatten($array) { $return = array(); foreach ($array as $key => $value) { $return[] = sprintf('%s: %s', $key, $value); } return $return; } public static function flattern($array) { return self::flatten($array); } public static function decompress($data) { if (substr($data, 0, 2) !== "\x1f\x8b" && substr($data, 0, 2) !== "\x78\x9c") { return $data; } if (function_exists('gzdecode')) { $decoded = @gzdecode($data); if ($decoded !== false) { return $decoded; } } if (function_exists('gzinflate')) { $decoded = @gzinflate($data); if ($decoded !== false) { return $decoded; } } $decoded = self::compatible_gzinflate($data); if ($decoded !== false) { return $decoded; } if (function_exists('gzuncompress')) { $decoded = @gzuncompress($data); if ($decoded !== false) { return $decoded; } } return $data; } public static function compatible_gzinflate($gz_data) { if (substr($gz_data, 0, 3) === "\x1f\x8b\x08") { $i = 10; $flg = ord(substr($gz_data, 3, 1)); if ($flg > 0) { if ($flg & 4) { list($xlen) = unpack('v', substr($gz_data, $i, 2)); $i += 2 + $xlen; } if ($flg & 8) { $i = strpos($gz_data, "\0", $i) + 1; } if ($flg & 16) { $i = strpos($gz_data, "\0", $i) + 1; } if ($flg & 2) { $i += 2; } } $decompressed = self::compatible_gzinflate(substr($gz_data, $i)); if ($decompressed !== false) { return $decompressed; } } $huffman_encoded = false; list(, $first_nibble) = unpack('h', $gz_data); list(, $first_two_bytes) = unpack('n', $gz_data); if ($first_nibble === 0x08 && ($first_two_bytes % 0x1F) === 0) { $huffman_encoded = true; } if ($huffman_encoded) { $decompressed = @gzinflate(substr($gz_data, 2)); if ($decompressed !== false) { return $decompressed; } } if (substr($gz_data, 0, 4) === "\x50\x4b\x03\x04") { list(, $general_purpose_flag) = unpack('v', substr($gz_data, 6, 2)); $zip_compressed_on_the_fly = ((0x08 & $general_purpose_flag) === 0x08); if (!$zip_compressed_on_the_fly) { return $gz_data; } $first_file_start = array_sum(unpack('v2', substr($gz_data, 26, 4))); $decompressed = @gzinflate(substr($gz_data, 30 + $first_file_start)); if ($decompressed !== false) { return $decompressed; } return false; } $decompressed = @gzinflate($gz_data); if ($decompressed !== false) { return $decompressed; } $decompressed = @gzinflate(substr($gz_data, 2)); if ($decompressed !== false) { return $decompressed; } return false; } public static function match_domain($host, $reference) { if ($host === $reference) { return true; } $parts = explode('.', $host); if (ip2long($host) === false && count($parts) >= 3) { $parts[0] = '*'; $wildcard = implode('.', $parts); if ($wildcard === $reference) { return true; } } return false; } } taxonomy ) ) { $_term = false; $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id = %d", $term_id ) ); if ( ! $terms ) { return false; } if ( $taxonomy ) { foreach ( $terms as $match ) { if ( $taxonomy === $match->taxonomy ) { $_term = $match; break; } } } elseif ( 1 === count( $terms ) ) { $_term = reset( $terms ); } else { foreach ( $terms as $t ) { if ( ! taxonomy_exists( $t->taxonomy ) ) { continue; } if ( $_term ) { return new WP_Error( 'ambiguous_term_id', __( 'Term ID is shared between multiple taxonomies' ), $term_id ); } $_term = $t; } } if ( ! $_term ) { return false; } if ( ! taxonomy_exists( $_term->taxonomy ) ) { return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); } $_term = sanitize_term( $_term, $_term->taxonomy, 'raw' ); if ( 1 === count( $terms ) ) { wp_cache_add( $term_id, $_term, 'terms' ); } } $term_obj = new WP_Term( $_term ); $term_obj->filter( $term_obj->filter ); return $term_obj; } public function __construct( $term ) { foreach ( get_object_vars( $term ) as $key => $value ) { $this->$key = $value; } } public function filter( $filter ) { sanitize_term( $this, $this->taxonomy, $filter ); } public function to_array() { return get_object_vars( $this ); } public function __get( $key ) { switch ( $key ) { case 'data': $data = new stdClass(); $columns = array( 'term_id', 'name', 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', 'parent', 'count' ); foreach ( $columns as $column ) { $data->{$column} = isset( $this->{$column} ) ? $this->{$column} : null; } return sanitize_term( $data, $data->taxonomy, 'raw' ); } } } widgets[ spl_object_hash( $widget ) ] = $widget; } else { $this->widgets[ $widget ] = new $widget(); } } public function unregister( $widget ) { if ( $widget instanceof WP_Widget ) { unset( $this->widgets[ spl_object_hash( $widget ) ] ); } else { unset( $this->widgets[ $widget ] ); } } public function _register_widgets() { global $wp_registered_widgets; $keys = array_keys( $this->widgets ); $registered = array_keys( $wp_registered_widgets ); $registered = array_map( '_get_widget_id_base', $registered ); foreach ( $keys as $key ) { if ( in_array( $this->widgets[ $key ]->id_base, $registered, true ) ) { unset( $this->widgets[ $key ] ); continue; } $this->widgets[ $key ]->_register(); } } public function get_widget_object( $id_base ) { $key = $this->get_widget_key( $id_base ); if ( '' === $key ) { return null; } return $this->widgets[ $key ]; } public function get_widget_key( $id_base ) { foreach ( $this->widgets as $key => $widget_object ) { if ( $widget_object->id_base === $id_base ) { return $key; } } return ''; } } 0 ) { $max_width = min( (int) $content_width, $max_width ); } } elseif ( 'large' === $size ) { $max_width = (int) get_option( 'large_size_w' ); $max_height = (int) get_option( 'large_size_h' ); if ( (int) $content_width > 0 ) { $max_width = min( (int) $content_width, $max_width ); } } elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) { $max_width = (int) $_wp_additional_image_sizes[ $size ]['width']; $max_height = (int) $_wp_additional_image_sizes[ $size ]['height']; if ( (int) $content_width > 0 && 'edit' === $context ) { $max_width = min( (int) $content_width, $max_width ); } } else { $max_width = $width; $max_height = $height; } list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context ); return wp_constrain_dimensions( $width, $height, $max_width, $max_height ); } function image_hwstring( $width, $height ) { $out = ''; if ( $width ) { $out .= 'width="' . (int) $width . '" '; } if ( $height ) { $out .= 'height="' . (int) $height . '" '; } return $out; } function image_downsize( $id, $size = 'medium' ) { $is_image = wp_attachment_is_image( $id ); $out = apply_filters( 'image_downsize', false, $id, $size ); if ( $out ) { return $out; } $img_url = wp_get_attachment_url( $id ); $meta = wp_get_attachment_metadata( $id ); $width = 0; $height = 0; $is_intermediate = false; $img_url_basename = wp_basename( $img_url ); if ( ! $is_image ) { if ( ! empty( $meta['sizes']['full'] ) ) { $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); $img_url_basename = $meta['sizes']['full']['file']; $width = $meta['sizes']['full']['width']; $height = $meta['sizes']['full']['height']; } else { return false; } } $intermediate = image_get_intermediate_size( $id, $size ); if ( $intermediate ) { $img_url = str_replace( $img_url_basename, $intermediate['file'], $img_url ); $width = $intermediate['width']; $height = $intermediate['height']; $is_intermediate = true; } elseif ( 'thumbnail' === $size ) { $thumb_file = wp_get_attachment_thumb_file( $id ); $info = null; if ( $thumb_file ) { $info = wp_getimagesize( $thumb_file ); } if ( $thumb_file && $info ) { $img_url = str_replace( $img_url_basename, wp_basename( $thumb_file ), $img_url ); $width = $info[0]; $height = $info[1]; $is_intermediate = true; } } if ( ! $width && ! $height && isset( $meta['width'], $meta['height'] ) ) { $width = $meta['width']; $height = $meta['height']; } if ( $img_url ) { list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); return array( $img_url, $width, $height, $is_intermediate ); } return false; } function add_image_size( $name, $width = 0, $height = 0, $crop = false ) { global $_wp_additional_image_sizes; $_wp_additional_image_sizes[ $name ] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => $crop, ); } function has_image_size( $name ) { $sizes = wp_get_additional_image_sizes(); return isset( $sizes[ $name ] ); } function remove_image_size( $name ) { global $_wp_additional_image_sizes; if ( isset( $_wp_additional_image_sizes[ $name ] ) ) { unset( $_wp_additional_image_sizes[ $name ] ); return true; } return false; } function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) { add_image_size( 'post-thumbnail', $width, $height, $crop ); } function get_image_tag( $id, $alt, $title, $align, $size = 'medium' ) { list( $img_src, $width, $height ) = image_downsize( $id, $size ); $hwstring = image_hwstring( $width, $height ); $title = $title ? 'title="' . esc_attr( $title ) . '" ' : ''; $size_class = is_array( $size ) ? implode( 'x', $size ) : $size; $class = 'align' . esc_attr( $align ) . ' size-' . esc_attr( $size_class ) . ' wp-image-' . $id; $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size ); $html = '' . esc_attr( $alt ) . ''; return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size ); } function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) { if ( ! $max_width && ! $max_height ) { return array( $current_width, $current_height ); } $width_ratio = 1.0; $height_ratio = 1.0; $did_width = false; $did_height = false; if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) { $width_ratio = $max_width / $current_width; $did_width = true; } if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) { $height_ratio = $max_height / $current_height; $did_height = true; } $smaller_ratio = min( $width_ratio, $height_ratio ); $larger_ratio = max( $width_ratio, $height_ratio ); if ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $current_height * $larger_ratio ) > $max_height ) { $ratio = $smaller_ratio; } else { $ratio = $larger_ratio; } $w = max( 1, (int) round( $current_width * $ratio ) ); $h = max( 1, (int) round( $current_height * $ratio ) ); if ( $did_width && $w === $max_width - 1 ) { $w = $max_width; } if ( $did_height && $h === $max_height - 1 ) { $h = $max_height; } return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height ); } function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) { if ( $orig_w <= 0 || $orig_h <= 0 ) { return false; } if ( $dest_w <= 0 && $dest_h <= 0 ) { return false; } $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop ); if ( null !== $output ) { return $output; } if ( empty( $dest_h ) ) { if ( $orig_w < $dest_w ) { return false; } } elseif ( empty( $dest_w ) ) { if ( $orig_h < $dest_h ) { return false; } } else { if ( $orig_w < $dest_w && $orig_h < $dest_h ) { return false; } } if ( $crop ) { $aspect_ratio = $orig_w / $orig_h; $new_w = min( $dest_w, $orig_w ); $new_h = min( $dest_h, $orig_h ); if ( ! $new_w ) { $new_w = (int) round( $new_h * $aspect_ratio ); } if ( ! $new_h ) { $new_h = (int) round( $new_w / $aspect_ratio ); } $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h ); $crop_w = round( $new_w / $size_ratio ); $crop_h = round( $new_h / $size_ratio ); if ( ! is_array( $crop ) || count( $crop ) !== 2 ) { $crop = array( 'center', 'center' ); } list( $x, $y ) = $crop; if ( 'left' === $x ) { $s_x = 0; } elseif ( 'right' === $x ) { $s_x = $orig_w - $crop_w; } else { $s_x = floor( ( $orig_w - $crop_w ) / 2 ); } if ( 'top' === $y ) { $s_y = 0; } elseif ( 'bottom' === $y ) { $s_y = $orig_h - $crop_h; } else { $s_y = floor( ( $orig_h - $crop_h ) / 2 ); } } else { $crop_w = $orig_w; $crop_h = $orig_h; $s_x = 0; $s_y = 0; list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h ); } if ( wp_fuzzy_number_match( $new_w, $orig_w ) && wp_fuzzy_number_match( $new_h, $orig_h ) ) { $proceed = (bool) apply_filters( 'wp_image_resize_identical_dimensions', false, $orig_w, $orig_h ); if ( ! $proceed ) { return false; } } return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h ); } function image_make_intermediate_size( $file, $width, $height, $crop = false ) { if ( $width || $height ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) { return false; } $resized_file = $editor->save(); if ( ! is_wp_error( $resized_file ) && $resized_file ) { unset( $resized_file['path'] ); return $resized_file; } } return false; } function wp_image_matches_ratio( $source_width, $source_height, $target_width, $target_height ) { if ( $source_width > $target_width ) { $constrained_size = wp_constrain_dimensions( $source_width, $source_height, $target_width ); $expected_size = array( $target_width, $target_height ); } else { $constrained_size = wp_constrain_dimensions( $target_width, $target_height, $source_width ); $expected_size = array( $source_width, $source_height ); } $matched = ( wp_fuzzy_number_match( $constrained_size[0], $expected_size[0] ) && wp_fuzzy_number_match( $constrained_size[1], $expected_size[1] ) ); return $matched; } function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { $imagedata = wp_get_attachment_metadata( $post_id ); if ( ! $size || ! is_array( $imagedata ) || empty( $imagedata['sizes'] ) ) { return false; } $data = array(); if ( is_array( $size ) ) { $candidates = array(); if ( ! isset( $imagedata['file'] ) && isset( $imagedata['sizes']['full'] ) ) { $imagedata['height'] = $imagedata['sizes']['full']['height']; $imagedata['width'] = $imagedata['sizes']['full']['width']; } foreach ( $imagedata['sizes'] as $_size => $data ) { if ( (int) $data['width'] === (int) $size[0] && (int) $data['height'] === (int) $size[1] ) { $candidates[ $data['width'] * $data['height'] ] = $data; break; } if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) { if ( 0 === $size[0] || 0 === $size[1] ) { $same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $imagedata['width'], $imagedata['height'] ); } else { $same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $size[0], $size[1] ); } if ( $same_ratio ) { $candidates[ $data['width'] * $data['height'] ] = $data; } } } if ( ! empty( $candidates ) ) { if ( 1 < count( $candidates ) ) { ksort( $candidates ); } $data = array_shift( $candidates ); } elseif ( ! empty( $imagedata['sizes']['thumbnail'] ) && $imagedata['sizes']['thumbnail']['width'] >= $size[0] && $imagedata['sizes']['thumbnail']['width'] >= $size[1] ) { $data = $imagedata['sizes']['thumbnail']; } else { return false; } list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); } elseif ( ! empty( $imagedata['sizes'][ $size ] ) ) { $data = $imagedata['sizes'][ $size ]; } if ( empty( $data ) ) { return false; } if ( empty( $data['path'] ) && ! empty( $data['file'] ) && ! empty( $imagedata['file'] ) ) { $file_url = wp_get_attachment_url( $post_id ); $data['path'] = path_join( dirname( $imagedata['file'] ), $data['file'] ); $data['url'] = path_join( dirname( $file_url ), $data['file'] ); } return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); } function get_intermediate_image_sizes() { $default_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); $additional_sizes = wp_get_additional_image_sizes(); if ( ! empty( $additional_sizes ) ) { $default_sizes = array_merge( $default_sizes, array_keys( $additional_sizes ) ); } return apply_filters( 'intermediate_image_sizes', $default_sizes ); } function wp_get_registered_image_subsizes() { $additional_sizes = wp_get_additional_image_sizes(); $all_sizes = array(); foreach ( get_intermediate_image_sizes() as $size_name ) { $size_data = array( 'width' => 0, 'height' => 0, 'crop' => false, ); if ( isset( $additional_sizes[ $size_name ]['width'] ) ) { $size_data['width'] = (int) $additional_sizes[ $size_name ]['width']; } else { $size_data['width'] = (int) get_option( "{$size_name}_size_w" ); } if ( isset( $additional_sizes[ $size_name ]['height'] ) ) { $size_data['height'] = (int) $additional_sizes[ $size_name ]['height']; } else { $size_data['height'] = (int) get_option( "{$size_name}_size_h" ); } if ( empty( $size_data['width'] ) && empty( $size_data['height'] ) ) { continue; } if ( isset( $additional_sizes[ $size_name ]['crop'] ) ) { $size_data['crop'] = $additional_sizes[ $size_name ]['crop']; } else { $size_data['crop'] = get_option( "{$size_name}_crop" ); } if ( ! is_array( $size_data['crop'] ) || empty( $size_data['crop'] ) ) { $size_data['crop'] = (bool) $size_data['crop']; } $all_sizes[ $size_name ] = $size_data; } return $all_sizes; } function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) { $image = image_downsize( $attachment_id, $size ); if ( ! $image ) { $src = false; if ( $icon ) { $src = wp_mime_type_icon( $attachment_id ); if ( $src ) { $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' ); $src_file = $icon_dir . '/' . wp_basename( $src ); list( $width, $height ) = wp_getimagesize( $src_file ); } } if ( $src && $width && $height ) { $image = array( $src, $width, $height, false ); } } return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon ); } function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = false, $attr = '' ) { $html = ''; $image = wp_get_attachment_image_src( $attachment_id, $size, $icon ); if ( $image ) { list( $src, $width, $height ) = $image; $attachment = get_post( $attachment_id ); $hwstring = image_hwstring( $width, $height ); $size_class = $size; if ( is_array( $size_class ) ) { $size_class = implode( 'x', $size_class ); } $default_attr = array( 'src' => $src, 'class' => "attachment-$size_class size-$size_class", 'alt' => trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ), ); if ( wp_lazy_loading_enabled( 'img', 'wp_get_attachment_image' ) ) { $default_attr['loading'] = wp_get_loading_attr_default( 'wp_get_attachment_image' ); } $attr = wp_parse_args( $attr, $default_attr ); if ( array_key_exists( 'loading', $attr ) && ! $attr['loading'] ) { unset( $attr['loading'] ); } if ( empty( $attr['srcset'] ) ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( is_array( $image_meta ) ) { $size_array = array( absint( $width ), absint( $height ) ); $srcset = wp_calculate_image_srcset( $size_array, $src, $image_meta, $attachment_id ); $sizes = wp_calculate_image_sizes( $size_array, $src, $image_meta, $attachment_id ); if ( $srcset && ( $sizes || ! empty( $attr['sizes'] ) ) ) { $attr['srcset'] = $srcset; if ( empty( $attr['sizes'] ) ) { $attr['sizes'] = $sizes; } } } } $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size ); $attr = array_map( 'esc_attr', $attr ); $html = rtrim( " $value ) { $html .= " $name=" . '"' . $value . '"'; } $html .= ' />'; } return apply_filters( 'wp_get_attachment_image', $html, $attachment_id, $size, $icon, $attr ); } function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) { $image = wp_get_attachment_image_src( $attachment_id, $size, $icon ); return isset( $image[0] ) ? $image[0] : false; } function _wp_get_attachment_relative_path( $file ) { $dirname = dirname( $file ); if ( '.' === $dirname ) { return ''; } if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) { $dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 ); $dirname = ltrim( $dirname, '/' ); } return $dirname; } function _wp_get_image_size_from_meta( $size_name, $image_meta ) { if ( 'full' === $size_name ) { return array( absint( $image_meta['width'] ), absint( $image_meta['height'] ), ); } elseif ( ! empty( $image_meta['sizes'][ $size_name ] ) ) { return array( absint( $image_meta['sizes'][ $size_name ]['width'] ), absint( $image_meta['sizes'][ $size_name ]['height'] ), ); } return false; } function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) { $image = wp_get_attachment_image_src( $attachment_id, $size ); if ( ! $image ) { return false; } if ( ! is_array( $image_meta ) ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); } $image_src = $image[0]; $size_array = array( absint( $image[1] ), absint( $image[2] ), ); return wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id ); } function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) { $image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id ); if ( empty( $image_meta['sizes'] ) || ! isset( $image_meta['file'] ) || strlen( $image_meta['file'] ) < 4 ) { return false; } $image_sizes = $image_meta['sizes']; $image_width = (int) $size_array[0]; $image_height = (int) $size_array[1]; if ( $image_width < 1 ) { return false; } $image_basename = wp_basename( $image_meta['file'] ); if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) { $image_sizes[] = array( 'width' => $image_meta['width'], 'height' => $image_meta['height'], 'file' => $image_basename, ); } elseif ( strpos( $image_src, $image_meta['file'] ) ) { return false; } $dirname = _wp_get_attachment_relative_path( $image_meta['file'] ); if ( $dirname ) { $dirname = trailingslashit( $dirname ); } $upload_dir = wp_get_upload_dir(); $image_baseurl = trailingslashit( $upload_dir['baseurl'] ) . $dirname; if ( is_ssl() && 'https' !== substr( $image_baseurl, 0, 5 ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) { $image_baseurl = set_url_scheme( $image_baseurl, 'https' ); } $image_edited = preg_match( '/-e[0-9]{13}/', wp_basename( $image_src ), $image_edit_hash ); $max_srcset_image_width = apply_filters( 'max_srcset_image_width', 2048, $size_array ); $sources = array(); $src_matched = false; foreach ( $image_sizes as $image ) { $is_src = false; if ( ! is_array( $image ) ) { continue; } if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) { $src_matched = true; $is_src = true; } if ( $image_edited && ! strpos( $image['file'], $image_edit_hash[0] ) ) { continue; } if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width && ! $is_src ) { continue; } if ( wp_image_matches_ratio( $image_width, $image_height, $image['width'], $image['height'] ) ) { $source = array( 'url' => $image_baseurl . $image['file'], 'descriptor' => 'w', 'value' => $image['width'], ); if ( $is_src ) { $sources = array( $image['width'] => $source ) + $sources; } else { $sources[ $image['width'] ] = $source; } } } $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id ); if ( ! $src_matched || ! is_array( $sources ) || count( $sources ) < 2 ) { return false; } $srcset = ''; foreach ( $sources as $source ) { $srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', '; } return rtrim( $srcset, ', ' ); } function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null ) { $image = wp_get_attachment_image_src( $attachment_id, $size ); if ( ! $image ) { return false; } if ( ! is_array( $image_meta ) ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); } $image_src = $image[0]; $size_array = array( absint( $image[1] ), absint( $image[2] ), ); return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id ); } function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) { $width = 0; if ( is_array( $size ) ) { $width = absint( $size[0] ); } elseif ( is_string( $size ) ) { if ( ! $image_meta && $attachment_id ) { $image_meta = wp_get_attachment_metadata( $attachment_id ); } if ( is_array( $image_meta ) ) { $size_array = _wp_get_image_size_from_meta( $size, $image_meta ); if ( $size_array ) { $width = absint( $size_array[0] ); } } } if ( ! $width ) { return false; } $sizes = sprintf( '(max-width: %1$dpx) 100vw, %1$dpx', $width ); return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id ); } function wp_image_file_matches_image_meta( $image_location, $image_meta, $attachment_id = 0 ) { $match = false; if ( isset( $image_meta['file'] ) && strlen( $image_meta['file'] ) > 4 ) { list( $image_location ) = explode( '?', $image_location ); if ( strrpos( $image_location, $image_meta['file'] ) === strlen( $image_location ) - strlen( $image_meta['file'] ) ) { $match = true; } else { $dirname = _wp_get_attachment_relative_path( $image_meta['file'] ); if ( $dirname ) { $dirname = trailingslashit( $dirname ); } if ( ! empty( $image_meta['original_image'] ) ) { $relative_path = $dirname . $image_meta['original_image']; if ( strrpos( $image_location, $relative_path ) === strlen( $image_location ) - strlen( $relative_path ) ) { $match = true; } } if ( ! $match && ! empty( $image_meta['sizes'] ) ) { foreach ( $image_meta['sizes'] as $image_size_data ) { $relative_path = $dirname . $image_size_data['file']; if ( strrpos( $image_location, $relative_path ) === strlen( $image_location ) - strlen( $relative_path ) ) { $match = true; break; } } } } } return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta, $attachment_id ); } function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 ) { $dimensions = false; if ( isset( $image_meta['file'] ) && strpos( $image_src, wp_basename( $image_meta['file'] ) ) !== false ) { $dimensions = array( (int) $image_meta['width'], (int) $image_meta['height'], ); } if ( ! $dimensions && ! empty( $image_meta['sizes'] ) ) { $src_filename = wp_basename( $image_src ); foreach ( $image_meta['sizes'] as $image_size_data ) { if ( $src_filename === $image_size_data['file'] ) { $dimensions = array( (int) $image_size_data['width'], (int) $image_size_data['height'], ); break; } } } return apply_filters( 'wp_image_src_get_dimensions', $dimensions, $image_src, $image_meta, $attachment_id ); } function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) { if ( empty( $image_meta['sizes'] ) ) { return $image; } $image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : ''; list( $image_src ) = explode( '?', $image_src ); if ( ! $image_src ) { return $image; } if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) && strpos( wp_basename( $image_src ), $img_edit_hash[0] ) === false ) { return $image; } $width = preg_match( '/ width="([0-9]+)"/', $image, $match_width ) ? (int) $match_width[1] : 0; $height = preg_match( '/ height="([0-9]+)"/', $image, $match_height ) ? (int) $match_height[1] : 0; if ( $width && $height ) { $size_array = array( $width, $height ); } else { $size_array = wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id ); if ( ! $size_array ) { return $image; } } $srcset = wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id ); if ( $srcset ) { $sizes = strpos( $image, ' sizes=' ); if ( ! $sizes ) { $sizes = wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id ); } } if ( $srcset && $sizes ) { $attr = sprintf( ' srcset="%s"', esc_attr( $srcset ) ); if ( is_string( $sizes ) ) { $attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) ); } return preg_replace( '/]+?)[\/ ]*>/', '', $image ); } return $image; } function wp_lazy_loading_enabled( $tag_name, $context ) { $default = ( 'img' === $tag_name || 'iframe' === $tag_name ); return (bool) apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context ); } function wp_filter_content_tags( $content, $context = null ) { if ( null === $context ) { $context = current_filter(); } $add_img_loading_attr = wp_lazy_loading_enabled( 'img', $context ); $add_iframe_loading_attr = wp_lazy_loading_enabled( 'iframe', $context ); if ( ! preg_match_all( '/<(img|iframe)\s[^>]+>/', $content, $matches, PREG_SET_ORDER ) ) { return $content; } $images = array(); $iframes = array(); foreach ( $matches as $match ) { list( $tag, $tag_name ) = $match; switch ( $tag_name ) { case 'img': if ( preg_match( '/wp-image-([0-9]+)/i', $tag, $class_id ) ) { $attachment_id = absint( $class_id[1] ); if ( $attachment_id ) { $images[ $tag ] = $attachment_id; break; } } $images[ $tag ] = 0; break; case 'iframe': $iframes[ $tag ] = 0; break; } } $attachment_ids = array_unique( array_filter( array_values( $images ) ) ); if ( count( $attachment_ids ) > 1 ) { _prime_post_caches( $attachment_ids, false, true ); } foreach ( $matches as $match ) { if ( isset( $images[ $match[0] ] ) ) { $filtered_image = $match[0]; $attachment_id = $images[ $match[0] ]; if ( $attachment_id > 0 && false === strpos( $filtered_image, ' width=' ) && false === strpos( $filtered_image, ' height=' ) ) { $filtered_image = wp_img_tag_add_width_and_height_attr( $filtered_image, $context, $attachment_id ); } if ( $attachment_id > 0 && false === strpos( $filtered_image, ' srcset=' ) ) { $filtered_image = wp_img_tag_add_srcset_and_sizes_attr( $filtered_image, $context, $attachment_id ); } if ( $add_img_loading_attr && false === strpos( $filtered_image, ' loading=' ) ) { $filtered_image = wp_img_tag_add_loading_attr( $filtered_image, $context ); } $filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id ); if ( $filtered_image !== $match[0] ) { $content = str_replace( $match[0], $filtered_image, $content ); } unset( $images[ $match[0] ] ); } if ( isset( $iframes[ $match[0] ] ) ) { $filtered_iframe = $match[0]; if ( $add_iframe_loading_attr && false === strpos( $filtered_iframe, ' loading=' ) ) { $filtered_iframe = wp_iframe_tag_add_loading_attr( $filtered_iframe, $context ); } if ( $filtered_iframe !== $match[0] ) { $content = str_replace( $match[0], $filtered_iframe, $content ); } unset( $iframes[ $match[0] ] ); } } return $content; } function wp_img_tag_add_loading_attr( $image, $context ) { $value = wp_get_loading_attr_default( $context ); if ( false === strpos( $image, ' src="' ) || false === strpos( $image, ' width="' ) || false === strpos( $image, ' height="' ) ) { return $image; } $value = apply_filters( 'wp_img_tag_add_loading_attr', $value, $image, $context ); if ( $value ) { if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) { $value = 'lazy'; } return str_replace( ']+>\s*)?]+>(?:\s*)?)(.*)#is', $content, $matches ) ) { $content = $matches[1]; $attr['caption'] = trim( $matches[2] ); } } elseif ( strpos( $attr['caption'], '<' ) !== false ) { $attr['caption'] = wp_kses( $attr['caption'], 'post' ); } $output = apply_filters( 'img_caption_shortcode', '', $attr, $content ); if ( ! empty( $output ) ) { return $output; } $atts = shortcode_atts( array( 'id' => '', 'caption_id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '', 'class' => '', ), $attr, 'caption' ); $atts['width'] = (int) $atts['width']; if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) { return $content; } $id = ''; $caption_id = ''; $describedby = ''; if ( $atts['id'] ) { $atts['id'] = sanitize_html_class( $atts['id'] ); $id = 'id="' . esc_attr( $atts['id'] ) . '" '; } if ( $atts['caption_id'] ) { $atts['caption_id'] = sanitize_html_class( $atts['caption_id'] ); } elseif ( $atts['id'] ) { $atts['caption_id'] = 'caption-' . str_replace( '_', '-', $atts['id'] ); } if ( $atts['caption_id'] ) { $caption_id = 'id="' . esc_attr( $atts['caption_id'] ) . '" '; $describedby = 'aria-describedby="' . esc_attr( $atts['caption_id'] ) . '" '; } $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); $html5 = current_theme_supports( 'html5', 'caption' ); $width = $html5 ? $atts['width'] : ( 10 + $atts['width'] ); $caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content ); $style = ''; if ( $caption_width ) { $style = 'style="width: ' . (int) $caption_width . 'px" '; } if ( $html5 ) { $html = sprintf( '
                %s%s
                ', $id, $describedby, $style, esc_attr( $class ), do_shortcode( $content ), sprintf( '
                %s
                ', $caption_id, $atts['caption'] ) ); } else { $html = sprintf( '
                %s%s
                ', $id, $style, esc_attr( $class ), str_replace( '%s

                ', $caption_id, $atts['caption'] ) ); } return $html; } add_shortcode( 'gallery', 'gallery_shortcode' ); function gallery_shortcode( $attr ) { $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr['ids'] ) ) { if ( empty( $attr['orderby'] ) ) { $attr['orderby'] = 'post__in'; } $attr['include'] = $attr['ids']; } $output = apply_filters( 'post_gallery', '', $attr, $instance ); if ( ! empty( $output ) ) { return $output; } $html5 = current_theme_supports( 'html5', 'gallery' ); $atts = shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => $html5 ? 'figure' : 'dl', 'icontag' => $html5 ? 'div' : 'dt', 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => '', ), $attr, 'gallery' ); $id = (int) $atts['id']; if ( ! empty( $atts['include'] ) ) { $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'], ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[ $val->ID ] = $_attachments[ $key ]; } } elseif ( ! empty( $atts['exclude'] ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'], ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'], ) ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { if ( ! empty( $atts['link'] ) ) { if ( 'none' === $atts['link'] ) { $output .= wp_get_attachment_image( $att_id, $atts['size'], false, $attr ); } else { $output .= wp_get_attachment_link( $att_id, $atts['size'], false ); } } else { $output .= wp_get_attachment_link( $att_id, $atts['size'], true ); } $output .= "\n"; } return $output; } $itemtag = tag_escape( $atts['itemtag'] ); $captiontag = tag_escape( $atts['captiontag'] ); $icontag = tag_escape( $atts['icontag'] ); $valid_tags = wp_kses_allowed_html( 'post' ); if ( ! isset( $valid_tags[ $itemtag ] ) ) { $itemtag = 'dl'; } if ( ! isset( $valid_tags[ $captiontag ] ) ) { $captiontag = 'dd'; } if ( ! isset( $valid_tags[ $icontag ] ) ) { $icontag = 'dt'; } $columns = (int) $atts['columns']; $itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $gallery_style = ''; if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) { $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; $gallery_style = " - - #{$selector} { - margin: auto; - } - #{$selector} .gallery-item { - float: {$float}; - margin-top: 10px; - text-align: center; - width: {$itemwidth}%; - } - #{$selector} img { - border: 2px solid #cfcfcf; - } - #{$selector} .gallery-caption { - margin-left: 0; - } - /* see gallery_shortcode() in wp-includes/media.php */ - \n\t\t"; } $size_class = sanitize_html_class( is_array( $atts['size'] ) ? implode( 'x', $atts['size'] ) : $atts['size'] ); $gallery_div = "\n"; return $output; } function wp_underscore_playlist_templates() { ?> - - - - - 'audio', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'include' => '', 'exclude' => '', 'style' => 'light', 'tracklist' => true, 'tracknumbers' => true, 'images' => true, 'artists' => true, ), $attr, 'playlist' ); $id = (int) $atts['id']; if ( 'audio' !== $atts['type'] ) { $atts['type'] = 'video'; } $args = array( 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => $atts['type'], 'order' => $atts['order'], 'orderby' => $atts['orderby'], ); if ( ! empty( $atts['include'] ) ) { $args['include'] = $atts['include']; $_attachments = get_posts( $args ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[ $val->ID ] = $_attachments[ $key ]; } } elseif ( ! empty( $atts['exclude'] ) ) { $args['post_parent'] = $id; $args['exclude'] = $atts['exclude']; $attachments = get_children( $args ); } else { $args['post_parent'] = $id; $attachments = get_children( $args ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { $output .= wp_get_attachment_link( $att_id ) . "\n"; } return $output; } $outer = 22; $default_width = 640; $default_height = 360; $theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer ); $theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width ); $data = array( 'type' => $atts['type'], 'tracklist' => wp_validate_boolean( $atts['tracklist'] ), 'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ), 'images' => wp_validate_boolean( $atts['images'] ), 'artists' => wp_validate_boolean( $atts['artists'] ), ); $tracks = array(); foreach ( $attachments as $attachment ) { $url = wp_get_attachment_url( $attachment->ID ); $ftype = wp_check_filetype( $url, wp_get_mime_types() ); $track = array( 'src' => $url, 'type' => $ftype['type'], 'title' => $attachment->post_title, 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, ); $track['meta'] = array(); $meta = wp_get_attachment_metadata( $attachment->ID ); if ( ! empty( $meta ) ) { foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) { if ( ! empty( $meta[ $key ] ) ) { $track['meta'][ $key ] = $meta[ $key ]; } } if ( 'video' === $atts['type'] ) { if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { $width = $meta['width']; $height = $meta['height']; $theme_height = round( ( $height * $theme_width ) / $width ); } else { $width = $default_width; $height = $default_height; } $track['dimensions'] = array( 'original' => compact( 'width', 'height' ), 'resized' => array( 'width' => $theme_width, 'height' => $theme_height, ), ); } } if ( $atts['images'] ) { $thumb_id = get_post_thumbnail_id( $attachment->ID ); if ( ! empty( $thumb_id ) ) { list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' ); $track['image'] = compact( 'src', 'width', 'height' ); list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } else { $src = wp_mime_type_icon( $attachment->ID ); $width = 48; $height = 64; $track['image'] = compact( 'src', 'width', 'height' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } } $tracks[] = $track; } $data['tracks'] = $tracks; $safe_type = esc_attr( $atts['type'] ); $safe_style = esc_attr( $atts['style'] ); ob_start(); if ( 1 === $instance ) { do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] ); } ?> -
                - -
                - - < controls="controls" preload="none" width="" - - >> -
                -
                - - -
                - %1$s', esc_url( $url ) ), $url ); } function wp_get_audio_extensions() { return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'flac', 'm4a', 'wav' ) ); } function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) { $fields = array( 'artist' => __( 'Artist' ), 'album' => __( 'Album' ), ); if ( 'display' === $context ) { $fields['genre'] = __( 'Genre' ); $fields['year'] = __( 'Year' ); $fields['length_formatted'] = _x( 'Length', 'video or audio' ); } elseif ( 'js' === $context ) { $fields['bitrate'] = __( 'Bitrate' ); $fields['bitrate_mode'] = __( 'Bitrate Mode' ); } return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context ); } function wp_audio_shortcode( $attr, $content = '' ) { $post_id = get_post() ? get_the_ID() : 0; static $instance = 0; $instance++; $override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance ); if ( '' !== $override ) { return $override; } $audio = null; $default_types = wp_get_audio_extensions(); $defaults_atts = array( 'src' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'none', 'class' => 'wp-audio-shortcode', 'style' => 'width: 100%;', ); foreach ( $default_types as $type ) { $defaults_atts[ $type ] = ''; } $atts = shortcode_atts( $defaults_atts, $attr, 'audio' ); $primary = false; if ( ! empty( $atts['src'] ) ) { $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) { return sprintf( '%s', esc_url( $atts['src'] ), esc_html( $atts['src'] ) ); } $primary = true; array_unshift( $default_types, 'src' ); } else { foreach ( $default_types as $ext ) { if ( ! empty( $atts[ $ext ] ) ) { $type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() ); if ( strtolower( $type['ext'] ) === $ext ) { $primary = true; } } } } if ( ! $primary ) { $audios = get_attached_media( 'audio', $post_id ); if ( empty( $audios ) ) { return; } $audio = reset( $audios ); $atts['src'] = wp_get_attachment_url( $audio->ID ); if ( empty( $atts['src'] ) ) { return; } array_unshift( $default_types, 'src' ); } $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ); if ( 'mediaelement' === $library && did_action( 'init' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); } $atts['class'] = apply_filters( 'wp_audio_shortcode_class', $atts['class'], $atts ); $html_atts = array( 'class' => $atts['class'], 'id' => sprintf( 'audio-%d-%d', $post_id, $instance ), 'loop' => wp_validate_boolean( $atts['loop'] ), 'autoplay' => wp_validate_boolean( $atts['autoplay'] ), 'preload' => $atts['preload'], 'style' => $atts['style'], ); foreach ( array( 'loop', 'autoplay', 'preload' ) as $a ) { if ( empty( $html_atts[ $a ] ) ) { unset( $html_atts[ $a ] ); } } $attr_strings = array(); foreach ( $html_atts as $k => $v ) { $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; } $html = ''; if ( 'mediaelement' === $library && 1 === $instance ) { $html .= "\n"; } $html .= sprintf( ''; return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library ); } add_shortcode( 'audio', 'wp_audio_shortcode' ); function wp_get_video_extensions() { return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'flv' ) ); } function wp_video_shortcode( $attr, $content = '' ) { global $content_width; $post_id = get_post() ? get_the_ID() : 0; static $instance = 0; $instance++; $override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instance ); if ( '' !== $override ) { return $override; } $video = null; $default_types = wp_get_video_extensions(); $defaults_atts = array( 'src' => '', 'poster' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata', 'width' => 640, 'height' => 360, 'class' => 'wp-video-shortcode', ); foreach ( $default_types as $type ) { $defaults_atts[ $type ] = ''; } $atts = shortcode_atts( $defaults_atts, $attr, 'video' ); if ( is_admin() ) { if ( $atts['width'] > $defaults_atts['width'] ) { $atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] ); $atts['width'] = $defaults_atts['width']; } } else { if ( ! empty( $content_width ) && $atts['width'] > $content_width ) { $atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] ); $atts['width'] = $content_width; } } $is_vimeo = false; $is_youtube = false; $yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#'; $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#'; $primary = false; if ( ! empty( $atts['src'] ) ) { $is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) ); $is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) ); if ( ! $is_youtube && ! $is_vimeo ) { $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) { return sprintf( '%s', esc_url( $atts['src'] ), esc_html( $atts['src'] ) ); } } if ( $is_vimeo ) { wp_enqueue_script( 'mediaelement-vimeo' ); } $primary = true; array_unshift( $default_types, 'src' ); } else { foreach ( $default_types as $ext ) { if ( ! empty( $atts[ $ext ] ) ) { $type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() ); if ( strtolower( $type['ext'] ) === $ext ) { $primary = true; } } } } if ( ! $primary ) { $videos = get_attached_media( 'video', $post_id ); if ( empty( $videos ) ) { return; } $video = reset( $videos ); $atts['src'] = wp_get_attachment_url( $video->ID ); if ( empty( $atts['src'] ) ) { return; } array_unshift( $default_types, 'src' ); } $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' ); if ( 'mediaelement' === $library && did_action( 'init' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); wp_enqueue_script( 'mediaelement-vimeo' ); } if ( 'mediaelement' === $library ) { if ( $is_youtube ) { $atts['src'] = remove_query_arg( 'feature', $atts['src'] ); $atts['src'] = set_url_scheme( $atts['src'], 'https' ); } elseif ( $is_vimeo ) { $parsed_vimeo_url = wp_parse_url( $atts['src'] ); $vimeo_src = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path']; $loop = $atts['loop'] ? '1' : '0'; $atts['src'] = add_query_arg( 'loop', $loop, $vimeo_src ); } } $atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'], $atts ); $html_atts = array( 'class' => $atts['class'], 'id' => sprintf( 'video-%d-%d', $post_id, $instance ), 'width' => absint( $atts['width'] ), 'height' => absint( $atts['height'] ), 'poster' => esc_url( $atts['poster'] ), 'loop' => wp_validate_boolean( $atts['loop'] ), 'autoplay' => wp_validate_boolean( $atts['autoplay'] ), 'preload' => $atts['preload'], ); foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) { if ( empty( $html_atts[ $a ] ) ) { unset( $html_atts[ $a ] ); } } $attr_strings = array(); foreach ( $html_atts as $k => $v ) { $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; } $html = ''; if ( 'mediaelement' === $library && 1 === $instance ) { $html .= "\n"; } $html .= sprintf( ''; $width_rule = ''; if ( ! empty( $atts['width'] ) ) { $width_rule = sprintf( 'width: %dpx;', $atts['width'] ); } $output = sprintf( '
                %s
                ', $width_rule, $html ); return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library ); } add_shortcode( 'video', 'wp_video_shortcode' ); function get_previous_image_link( $size = 'thumbnail', $text = false ) { return get_adjacent_image_link( true, $size, $text ); } function previous_image_link( $size = 'thumbnail', $text = false ) { echo get_previous_image_link( $size, $text ); } function get_next_image_link( $size = 'thumbnail', $text = false ) { return get_adjacent_image_link( false, $size, $text ); } function next_image_link( $size = 'thumbnail', $text = false ) { echo get_next_image_link( $size, $text ); } function get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { $post = get_post(); $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', ) ) ); foreach ( $attachments as $k => $attachment ) { if ( (int) $attachment->ID === (int) $post->ID ) { break; } } $output = ''; $attachment_id = 0; if ( $attachments ) { $k = $prev ? $k - 1 : $k + 1; if ( isset( $attachments[ $k ] ) ) { $attachment_id = $attachments[ $k ]->ID; $attr = array( 'alt' => get_the_title( $attachment_id ) ); $output = wp_get_attachment_link( $attachment_id, $size, true, false, $text, $attr ); } } $adjacent = $prev ? 'previous' : 'next'; return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); } function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { echo get_adjacent_image_link( $prev, $size, $text ); } function get_attachment_taxonomies( $attachment, $output = 'names' ) { if ( is_int( $attachment ) ) { $attachment = get_post( $attachment ); } elseif ( is_array( $attachment ) ) { $attachment = (object) $attachment; } if ( ! is_object( $attachment ) ) { return array(); } $file = get_attached_file( $attachment->ID ); $filename = wp_basename( $file ); $objects = array( 'attachment' ); if ( false !== strpos( $filename, '.' ) ) { $objects[] = 'attachment:' . substr( $filename, strrpos( $filename, '.' ) + 1 ); } if ( ! empty( $attachment->post_mime_type ) ) { $objects[] = 'attachment:' . $attachment->post_mime_type; if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { foreach ( explode( '/', $attachment->post_mime_type ) as $token ) { if ( ! empty( $token ) ) { $objects[] = "attachment:$token"; } } } } $taxonomies = array(); foreach ( $objects as $object ) { $taxes = get_object_taxonomies( $object, $output ); if ( $taxes ) { $taxonomies = array_merge( $taxonomies, $taxes ); } } if ( 'names' === $output ) { $taxonomies = array_unique( $taxonomies ); } return $taxonomies; } function get_taxonomies_for_attachments( $output = 'names' ) { $taxonomies = array(); foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) { foreach ( $taxonomy->object_type as $object_type ) { if ( 'attachment' === $object_type || 0 === strpos( $object_type, 'attachment:' ) ) { if ( 'names' === $output ) { $taxonomies[] = $taxonomy->name; } else { $taxonomies[ $taxonomy->name ] = $taxonomy; } break; } } } return $taxonomies; } function is_gd_image( $image ) { if ( is_resource( $image ) && 'gd' === get_resource_type( $image ) || is_object( $image ) && $image instanceof GdImage ) { return true; } return false; } function wp_imagecreatetruecolor( $width, $height ) { $img = imagecreatetruecolor( $width, $height ); if ( is_gd_image( $img ) && function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) { imagealphablending( $img, false ); imagesavealpha( $img, true ); } return $img; } function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) { $example_width = (int) $example_width; $example_height = (int) $example_height; $max_width = (int) $max_width; $max_height = (int) $max_height; return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height ); } function wp_max_upload_size() { $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); } function wp_get_image_editor( $path, $args = array() ) { $args['path'] = $path; if ( ! isset( $args['mime_type'] ) ) { $file_info = wp_check_filetype( $args['path'] ); if ( isset( $file_info ) && $file_info['type'] ) { $args['mime_type'] = $file_info['type']; } } $implementation = _wp_image_editor_choose( $args ); if ( $implementation ) { $editor = new $implementation( $path ); $loaded = $editor->load(); if ( is_wp_error( $loaded ) ) { return $loaded; } return $editor; } return new WP_Error( 'image_no_editor', __( 'No editor could be selected.' ) ); } function wp_image_editor_supports( $args = array() ) { return (bool) _wp_image_editor_choose( $args ); } function _wp_image_editor_choose( $args = array() ) { require_once ABSPATH . WPINC . '/class-wp-image-editor.php'; require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); foreach ( $implementations as $implementation ) { if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) { continue; } if ( isset( $args['mime_type'] ) && ! call_user_func( array( $implementation, 'supports_mime_type' ), $args['mime_type'] ) ) { continue; } if ( isset( $args['methods'] ) && array_diff( $args['methods'], get_class_methods( $implementation ) ) ) { continue; } return $implementation; } return false; } function wp_plupload_default_settings() { $wp_scripts = wp_scripts(); $data = $wp_scripts->get_data( 'wp-plupload', 'data' ); if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) ) { return; } $max_upload_size = wp_max_upload_size(); $allowed_extensions = array_keys( get_allowed_mime_types() ); $extensions = array(); foreach ( $allowed_extensions as $extension ) { $extensions = array_merge( $extensions, explode( '|', $extension ) ); } $defaults = array( 'file_data_name' => 'async-upload', 'url' => admin_url( 'async-upload.php', 'relative' ), 'filters' => array( 'max_file_size' => $max_upload_size . 'b', 'mime_types' => array( array( 'extensions' => implode( ',', $extensions ) ) ), ), ); if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) { $defaults['multi_selection'] = false; } if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { $defaults['webp_upload_error'] = true; } $defaults = apply_filters( 'plupload_default_settings', $defaults ); $params = array( 'action' => 'upload-attachment', ); $params = apply_filters( 'plupload_default_params', $params ); $params['_wpnonce'] = wp_create_nonce( 'media-form' ); $defaults['multipart_params'] = $params; $settings = array( 'defaults' => $defaults, 'browser' => array( 'mobile' => wp_is_mobile(), 'supported' => _device_can_upload(), ), 'limitExceeded' => is_multisite() && ! is_upload_space_available(), ); $script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';'; if ( $data ) { $script = "$data\n$script"; } $wp_scripts->add_data( 'wp-plupload', 'data', $script ); } function wp_prepare_attachment_for_js( $attachment ) { $attachment = get_post( $attachment ); if ( ! $attachment ) { return; } if ( 'attachment' !== $attachment->post_type ) { return; } $meta = wp_get_attachment_metadata( $attachment->ID ); if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); } else { list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); } $attachment_url = wp_get_attachment_url( $attachment->ID ); $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); $response = array( 'id' => $attachment->ID, 'title' => $attachment->post_title, 'filename' => wp_basename( get_attached_file( $attachment->ID ) ), 'url' => $attachment_url, 'link' => get_attachment_link( $attachment->ID ), 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'author' => $attachment->post_author, 'description' => $attachment->post_content, 'caption' => $attachment->post_excerpt, 'name' => $attachment->post_name, 'status' => $attachment->post_status, 'uploadedTo' => $attachment->post_parent, 'date' => strtotime( $attachment->post_date_gmt ) * 1000, 'modified' => strtotime( $attachment->post_modified_gmt ) * 1000, 'menuOrder' => $attachment->menu_order, 'mime' => $attachment->post_mime_type, 'type' => $type, 'subtype' => $subtype, 'icon' => wp_mime_type_icon( $attachment->ID ), 'dateFormatted' => mysql2date( __( 'F j, Y' ), $attachment->post_date ), 'nonces' => array( 'update' => false, 'delete' => false, 'edit' => false, ), 'editLink' => false, 'meta' => false, ); $author = new WP_User( $attachment->post_author ); if ( $author->exists() ) { $author_name = $author->display_name ? $author->display_name : $author->nickname; $response['authorName'] = html_entity_decode( $author_name, ENT_QUOTES, get_bloginfo( 'charset' ) ); $response['authorLink'] = get_edit_user_link( $author->ID ); } else { $response['authorName'] = __( '(no author)' ); } if ( $attachment->post_parent ) { $post_parent = get_post( $attachment->post_parent ); if ( $post_parent ) { $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' ); } } $attached_file = get_attached_file( $attachment->ID ); if ( isset( $meta['filesize'] ) ) { $bytes = $meta['filesize']; } elseif ( file_exists( $attached_file ) ) { $bytes = wp_filesize( $attached_file ); } else { $bytes = ''; } if ( $bytes ) { $response['filesizeInBytes'] = $bytes; $response['filesizeHumanReadable'] = size_format( $bytes ); } $context = get_post_meta( $attachment->ID, '_wp_attachment_context', true ); $response['context'] = ( $context ) ? $context : ''; if ( current_user_can( 'edit_post', $attachment->ID ) ) { $response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID ); $response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID ); $response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' ); } if ( current_user_can( 'delete_post', $attachment->ID ) ) { $response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID ); } if ( $meta && ( 'image' === $type || ! empty( $meta['sizes'] ) ) ) { $sizes = array(); $possible_sizes = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); unset( $possible_sizes['full'] ); foreach ( $possible_sizes as $size => $label ) { $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ); if ( $downsize ) { if ( empty( $downsize[3] ) ) { continue; } $sizes[ $size ] = array( 'height' => $downsize[2], 'width' => $downsize[1], 'url' => $downsize[0], 'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape', ); } elseif ( isset( $meta['sizes'][ $size ] ) ) { $size_meta = $meta['sizes'][ $size ]; list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' ); $sizes[ $size ] = array( 'height' => $height, 'width' => $width, 'url' => $base_url . $size_meta['file'], 'orientation' => $height > $width ? 'portrait' : 'landscape', ); } } if ( 'image' === $type ) { if ( ! empty( $meta['original_image'] ) ) { $response['originalImageURL'] = wp_get_original_image_url( $attachment->ID ); $response['originalImageName'] = wp_basename( wp_get_original_image_path( $attachment->ID ) ); } $sizes['full'] = array( 'url' => $attachment_url ); if ( isset( $meta['height'], $meta['width'] ) ) { $sizes['full']['height'] = $meta['height']; $sizes['full']['width'] = $meta['width']; $sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape'; } $response = array_merge( $response, $sizes['full'] ); } elseif ( $meta['sizes']['full']['file'] ) { $sizes['full'] = array( 'url' => $base_url . $meta['sizes']['full']['file'], 'height' => $meta['sizes']['full']['height'], 'width' => $meta['sizes']['full']['width'], 'orientation' => $meta['sizes']['full']['height'] > $meta['sizes']['full']['width'] ? 'portrait' : 'landscape', ); } $response = array_merge( $response, array( 'sizes' => $sizes ) ); } if ( $meta && 'video' === $type ) { if ( isset( $meta['width'] ) ) { $response['width'] = (int) $meta['width']; } if ( isset( $meta['height'] ) ) { $response['height'] = (int) $meta['height']; } } if ( $meta && ( 'audio' === $type || 'video' === $type ) ) { if ( isset( $meta['length_formatted'] ) ) { $response['fileLength'] = $meta['length_formatted']; $response['fileLengthHumanReadable'] = human_readable_duration( $meta['length_formatted'] ); } $response['meta'] = array(); foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) { $response['meta'][ $key ] = false; if ( ! empty( $meta[ $key ] ) ) { $response['meta'][ $key ] = $meta[ $key ]; } } $id = get_post_thumbnail_id( $attachment->ID ); if ( ! empty( $id ) ) { list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' ); $response['image'] = compact( 'src', 'width', 'height' ); list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' ); $response['thumb'] = compact( 'src', 'width', 'height' ); } else { $src = wp_mime_type_icon( $attachment->ID ); $width = 48; $height = 64; $response['image'] = compact( 'src', 'width', 'height' ); $response['thumb'] = compact( 'src', 'width', 'height' ); } } if ( function_exists( 'get_compat_media_markup' ) ) { $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); } if ( function_exists( 'get_media_states' ) ) { $media_states = get_media_states( $attachment ); if ( ! empty( $media_states ) ) { $response['mediaStates'] = implode( ', ', $media_states ); } } return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta ); } function wp_enqueue_media( $args = array() ) { if ( did_action( 'wp_enqueue_media' ) ) { return; } global $content_width, $wpdb, $wp_locale; $defaults = array( 'post' => null, ); $args = wp_parse_args( $args, $defaults ); $tabs = array( 'type' => '', 'type_url' => '', 'gallery' => '', 'library' => '', ); $tabs = apply_filters( 'media_upload_tabs', $tabs ); unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] ); $props = array( 'link' => get_option( 'image_default_link_type' ), 'align' => get_option( 'image_default_align' ), 'size' => get_option( 'image_default_size' ), ); $exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() ); $mimes = get_allowed_mime_types(); $ext_mimes = array(); foreach ( $exts as $ext ) { foreach ( $mimes as $ext_preg => $mime_match ) { if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) { $ext_mimes[ $ext ] = $mime_match; break; } } } $show_audio_playlist = apply_filters( 'media_library_show_audio_playlist', true ); if ( null === $show_audio_playlist ) { $show_audio_playlist = $wpdb->get_var( " - SELECT ID - FROM $wpdb->posts - WHERE post_type = 'attachment' - AND post_mime_type LIKE 'audio%' - LIMIT 1 - " ); } $show_video_playlist = apply_filters( 'media_library_show_video_playlist', true ); if ( null === $show_video_playlist ) { $show_video_playlist = $wpdb->get_var( " - SELECT ID - FROM $wpdb->posts - WHERE post_type = 'attachment' - AND post_mime_type LIKE 'video%' - LIMIT 1 - " ); } $months = apply_filters( 'media_library_months_with_files', null ); if ( ! is_array( $months ) ) { $months = $wpdb->get_results( $wpdb->prepare( " - SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month - FROM $wpdb->posts - WHERE post_type = %s - ORDER BY post_date DESC - ", 'attachment' ) ); } foreach ( $months as $month_year ) { $month_year->text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month_year->month ), $month_year->year ); } $infinite_scrolling = apply_filters( 'media_library_infinite_scrolling', false ); $settings = array( 'tabs' => $tabs, 'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url( 'media-upload.php' ) ), 'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ), 'captions' => ! apply_filters( 'disable_captions', '' ), 'nonce' => array( 'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ), ), 'post' => array( 'id' => 0, ), 'defaultProps' => $props, 'attachmentCounts' => array( 'audio' => ( $show_audio_playlist ) ? 1 : 0, 'video' => ( $show_video_playlist ) ? 1 : 0, ), 'oEmbedProxyUrl' => rest_url( 'oembed/1.0/proxy' ), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width, 'months' => $months, 'mediaTrash' => MEDIA_TRASH ? 1 : 0, 'infiniteScrolling' => ( $infinite_scrolling ) ? 1 : 0, ); $post = null; if ( isset( $args['post'] ) ) { $post = get_post( $args['post'] ); $settings['post'] = array( 'id' => $post->ID, 'nonce' => wp_create_nonce( 'update-post_' . $post->ID ), ); $thumbnail_support = current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ); if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type ) { if ( wp_attachment_is( 'audio', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } if ( $thumbnail_support ) { $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true ); $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1; } } if ( $post ) { $post_type_object = get_post_type_object( $post->post_type ); } else { $post_type_object = get_post_type_object( 'post' ); } $strings = array( 'mediaFrameDefaultTitle' => __( 'Media' ), 'url' => __( 'URL' ), 'addMedia' => __( 'Add media' ), 'search' => __( 'Search' ), 'select' => __( 'Select' ), 'cancel' => __( 'Cancel' ), 'update' => __( 'Update' ), 'replace' => __( 'Replace' ), 'remove' => __( 'Remove' ), 'back' => __( 'Back' ), 'selected' => __( '%d selected' ), 'dragInfo' => __( 'Drag and drop to reorder media files.' ), 'uploadFilesTitle' => __( 'Upload files' ), 'uploadImagesTitle' => __( 'Upload images' ), 'mediaLibraryTitle' => __( 'Media Library' ), 'insertMediaTitle' => __( 'Add media' ), 'createNewGallery' => __( 'Create a new gallery' ), 'createNewPlaylist' => __( 'Create a new playlist' ), 'createNewVideoPlaylist' => __( 'Create a new video playlist' ), 'returnToLibrary' => __( '← Go to library' ), 'allMediaItems' => __( 'All media items' ), 'allDates' => __( 'All dates' ), 'noItemsFound' => __( 'No items found.' ), 'insertIntoPost' => $post_type_object->labels->insert_into_item, 'unattached' => _x( 'Unattached', 'media items' ), 'mine' => _x( 'Mine', 'media items' ), 'trash' => _x( 'Trash', 'noun' ), 'uploadedToThisPost' => $post_type_object->labels->uploaded_to_this_item, 'warnDelete' => __( "You are about to permanently delete this item from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ), 'warnBulkDelete' => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ), 'warnBulkTrash' => __( "You are about to trash these items.\n 'Cancel' to stop, 'OK' to delete." ), 'bulkSelect' => __( 'Bulk select' ), 'trashSelected' => __( 'Move to Trash' ), 'restoreSelected' => __( 'Restore from Trash' ), 'deletePermanently' => __( 'Delete permanently' ), 'errorDeleting' => __( 'Error in deleting the attachment.' ), 'apply' => __( 'Apply' ), 'filterByDate' => __( 'Filter by date' ), 'filterByType' => __( 'Filter by type' ), 'searchLabel' => __( 'Search' ), 'searchMediaLabel' => __( 'Search media' ), 'searchMediaPlaceholder' => __( 'Search media items...' ), 'mediaFound' => __( 'Number of media items found: %d' ), 'noMedia' => __( 'No media items found.' ), 'noMediaTryNewSearch' => __( 'No media items found. Try a different search.' ), 'attachmentDetails' => __( 'Attachment details' ), 'insertFromUrlTitle' => __( 'Insert from URL' ), 'setFeaturedImageTitle' => $post_type_object->labels->featured_image, 'setFeaturedImage' => $post_type_object->labels->set_featured_image, 'createGalleryTitle' => __( 'Create gallery' ), 'editGalleryTitle' => __( 'Edit gallery' ), 'cancelGalleryTitle' => __( '← Cancel gallery' ), 'insertGallery' => __( 'Insert gallery' ), 'updateGallery' => __( 'Update gallery' ), 'addToGallery' => __( 'Add to gallery' ), 'addToGalleryTitle' => __( 'Add to gallery' ), 'reverseOrder' => __( 'Reverse order' ), 'imageDetailsTitle' => __( 'Image details' ), 'imageReplaceTitle' => __( 'Replace image' ), 'imageDetailsCancel' => __( 'Cancel edit' ), 'editImage' => __( 'Edit image' ), 'chooseImage' => __( 'Choose image' ), 'selectAndCrop' => __( 'Select and crop' ), 'skipCropping' => __( 'Skip cropping' ), 'cropImage' => __( 'Crop image' ), 'cropYourImage' => __( 'Crop your image' ), 'cropping' => __( 'Cropping…' ), 'suggestedDimensions' => __( 'Suggested image dimensions: %1$s by %2$s pixels.' ), 'cropError' => __( 'There has been an error cropping your image.' ), 'audioDetailsTitle' => __( 'Audio details' ), 'audioReplaceTitle' => __( 'Replace audio' ), 'audioAddSourceTitle' => __( 'Add audio source' ), 'audioDetailsCancel' => __( 'Cancel edit' ), 'videoDetailsTitle' => __( 'Video details' ), 'videoReplaceTitle' => __( 'Replace video' ), 'videoAddSourceTitle' => __( 'Add video source' ), 'videoDetailsCancel' => __( 'Cancel edit' ), 'videoSelectPosterImageTitle' => __( 'Select poster image' ), 'videoAddTrackTitle' => __( 'Add subtitles' ), 'playlistDragInfo' => __( 'Drag and drop to reorder tracks.' ), 'createPlaylistTitle' => __( 'Create audio playlist' ), 'editPlaylistTitle' => __( 'Edit audio playlist' ), 'cancelPlaylistTitle' => __( '← Cancel audio playlist' ), 'insertPlaylist' => __( 'Insert audio playlist' ), 'updatePlaylist' => __( 'Update audio playlist' ), 'addToPlaylist' => __( 'Add to audio playlist' ), 'addToPlaylistTitle' => __( 'Add to Audio Playlist' ), 'videoPlaylistDragInfo' => __( 'Drag and drop to reorder videos.' ), 'createVideoPlaylistTitle' => __( 'Create video playlist' ), 'editVideoPlaylistTitle' => __( 'Edit video playlist' ), 'cancelVideoPlaylistTitle' => __( '← Cancel video playlist' ), 'insertVideoPlaylist' => __( 'Insert video playlist' ), 'updateVideoPlaylist' => __( 'Update video playlist' ), 'addToVideoPlaylist' => __( 'Add to video playlist' ), 'addToVideoPlaylistTitle' => __( 'Add to video Playlist' ), 'filterAttachments' => __( 'Filter media' ), 'attachmentsList' => __( 'Media list' ), ); $settings = apply_filters( 'media_view_settings', $settings, $post ); $strings = apply_filters( 'media_view_strings', $strings, $post ); $strings['settings'] = $settings; wp_enqueue_script( 'media-editor' ); wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings ); wp_enqueue_script( 'media-audiovideo' ); wp_enqueue_style( 'media-views' ); if ( is_admin() ) { wp_enqueue_script( 'mce-view' ); wp_enqueue_script( 'image-edit' ); } wp_enqueue_style( 'imgareaselect' ); wp_plupload_default_settings(); require_once ABSPATH . WPINC . '/media-template.php'; add_action( 'admin_footer', 'wp_print_media_templates' ); add_action( 'wp_footer', 'wp_print_media_templates' ); add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' ); do_action( 'wp_enqueue_media' ); } function get_attached_media( $type, $post = 0 ) { $post = get_post( $post ); if ( ! $post ) { return array(); } $args = array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => $type, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', ); $args = apply_filters( 'get_attached_media_args', $args, $type, $post ); $children = get_children( $args ); return (array) apply_filters( 'get_attached_media', $children, $type, $post ); } function get_media_embedded_in_content( $content, $types = null ) { $html = array(); $allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' ) ); if ( ! empty( $types ) ) { if ( ! is_array( $types ) ) { $types = array( $types ); } $allowed_media_types = array_intersect( $allowed_media_types, $types ); } $tags = implode( '|', $allowed_media_types ); if ( preg_match_all( '#<(?P' . $tags . ')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches ) ) { foreach ( $matches[0] as $match ) { $html[] = $match; } } return $html; } function get_post_galleries( $post, $html = true ) { $post = get_post( $post ); if ( ! $post ) { return array(); } if ( ! has_shortcode( $post->post_content, 'gallery' ) && ! has_block( 'gallery', $post->post_content ) ) { return array(); } $galleries = array(); if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) { foreach ( $matches as $shortcode ) { if ( 'gallery' === $shortcode[2] ) { $srcs = array(); $shortcode_attrs = shortcode_parse_atts( $shortcode[3] ); if ( ! is_array( $shortcode_attrs ) ) { $shortcode_attrs = array(); } if ( ! isset( $shortcode_attrs['id'] ) ) { $shortcode[3] .= ' id="' . (int) $post->ID . '"'; } $gallery = do_shortcode_tag( $shortcode ); if ( $html ) { $galleries[] = $gallery; } else { preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER ); if ( ! empty( $src ) ) { foreach ( $src as $s ) { $srcs[] = $s[2]; } } $galleries[] = array_merge( $shortcode_attrs, array( 'src' => array_values( array_unique( $srcs ) ), ) ); } } } } if ( has_block( 'gallery', $post->post_content ) ) { $post_blocks = parse_blocks( $post->post_content ); while ( $block = array_shift( $post_blocks ) ) { $has_inner_blocks = ! empty( $block['innerBlocks'] ); if ( ! $block['blockName'] ) { continue; } if ( 'core/gallery' !== $block['blockName'] ) { if ( $has_inner_blocks ) { array_push( $post_blocks, ...$block['innerBlocks'] ); } continue; } if ( $has_inner_blocks && $html ) { $block_html = wp_list_pluck( $block['innerBlocks'], 'innerHTML' ); $galleries[] = '
                ' . implode( ' ', $block_html ) . '
                '; continue; } $srcs = array(); if ( $has_inner_blocks ) { $attrs = wp_list_pluck( $block['innerBlocks'], 'attrs' ); $ids = wp_list_pluck( $attrs, 'id' ); foreach ( $ids as $id ) { $url = wp_get_attachment_url( $id ); if ( is_string( $url ) && ! in_array( $url, $srcs, true ) ) { $srcs[] = $url; } } $galleries[] = array( 'ids' => implode( ',', $ids ), 'src' => $srcs, ); continue; } if ( $html ) { $galleries[] = $block['innerHTML']; continue; } $ids = ! empty( $block['attrs']['ids'] ) ? $block['attrs']['ids'] : array(); if ( ! empty( $ids ) ) { foreach ( $ids as $id ) { $url = wp_get_attachment_url( $id ); if ( is_string( $url ) && ! in_array( $url, $srcs, true ) ) { $srcs[] = $url; } } $galleries[] = array( 'ids' => implode( ',', $ids ), 'src' => $srcs, ); continue; } preg_match_all( '#src=([\'"])(.+?)\1#is', $block['innerHTML'], $found_srcs, PREG_SET_ORDER ); if ( ! empty( $found_srcs[0] ) ) { foreach ( $found_srcs as $src ) { if ( isset( $src[2] ) && ! in_array( $src[2], $srcs, true ) ) { $srcs[] = $src[2]; } } } $galleries[] = array( 'src' => $srcs ); } } return apply_filters( 'get_post_galleries', $galleries, $post ); } function get_post_gallery( $post = 0, $html = true ) { $galleries = get_post_galleries( $post, $html ); $gallery = reset( $galleries ); return apply_filters( 'get_post_gallery', $gallery, $post, $galleries ); } function get_post_galleries_images( $post = 0 ) { $galleries = get_post_galleries( $post, false ); return wp_list_pluck( $galleries, 'src' ); } function get_post_gallery_images( $post = 0 ) { $gallery = get_post_gallery( $post, false ); return empty( $gallery['src'] ) ? array() : $gallery['src']; } function wp_maybe_generate_attachment_metadata( $attachment ) { if ( empty( $attachment ) || empty( $attachment->ID ) ) { return; } $attachment_id = (int) $attachment->ID; $file = get_attached_file( $attachment_id ); $meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $meta ) && file_exists( $file ) ) { $_meta = get_post_meta( $attachment_id ); $_lock = 'wp_generating_att_' . $attachment_id; if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $_lock ) ) { set_transient( $_lock, $file ); wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); delete_transient( $_lock ); } } } function attachment_url_to_postid( $url ) { global $wpdb; $dir = wp_get_upload_dir(); $path = $url; $site_url = parse_url( $dir['url'] ); $image_path = parse_url( $path ); if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) { $path = str_replace( $image_path['scheme'], $site_url['scheme'], $path ); } if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) { $path = substr( $path, strlen( $dir['baseurl'] . '/' ) ); } $sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s", $path ); $results = $wpdb->get_results( $sql ); $post_id = null; if ( $results ) { $post_id = reset( $results )->post_id; if ( count( $results ) > 1 ) { foreach ( $results as $result ) { if ( $path === $result->meta_value ) { $post_id = $result->post_id; break; } } } } return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url ); } function wpview_media_sandbox_styles() { $version = 'ver=' . get_bloginfo( 'version' ); $mediaelement = includes_url( "js/mediaelement/mediaelementplayer-legacy.min.css?$version" ); $wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" ); return array( $mediaelement, $wpmediaelement ); } function wp_register_media_personal_data_exporter( $exporters ) { $exporters['wordpress-media'] = array( 'exporter_friendly_name' => __( 'WordPress Media' ), 'callback' => 'wp_media_personal_data_exporter', ); return $exporters; } function wp_media_personal_data_exporter( $email_address, $page = 1 ) { $number = 50; $page = (int) $page; $data_to_export = array(); $user = get_user_by( 'email', $email_address ); if ( false === $user ) { return array( 'data' => $data_to_export, 'done' => true, ); } $post_query = new WP_Query( array( 'author' => $user->ID, 'posts_per_page' => $number, 'paged' => $page, 'post_type' => 'attachment', 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC', ) ); foreach ( (array) $post_query->posts as $post ) { $attachment_url = wp_get_attachment_url( $post->ID ); if ( $attachment_url ) { $post_data_to_export = array( array( 'name' => __( 'URL' ), 'value' => $attachment_url, ), ); $data_to_export[] = array( 'group_id' => 'media', 'group_label' => __( 'Media' ), 'group_description' => __( 'User’s media data.' ), 'item_id' => "post-{$post->ID}", 'data' => $post_data_to_export, ); } } $done = $post_query->max_num_pages <= $page; return array( 'data' => $data_to_export, 'done' => $done, ); } function _wp_add_additional_image_sizes() { add_image_size( '1536x1536', 1536, 1536 ); add_image_size( '2048x2048', 2048, 2048 ); } function wp_show_heic_upload_error( $plupload_settings ) { $plupload_settings['heic_upload_error'] = true; return $plupload_settings; } function wp_getimagesize( $filename, array &$image_info = null ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! defined( 'WP_RUN_CORE_TESTS' ) ) { if ( 2 === func_num_args() ) { $info = getimagesize( $filename, $image_info ); } else { $info = getimagesize( $filename ); } } else { if ( 2 === func_num_args() ) { $info = @getimagesize( $filename, $image_info ); } else { $info = @getimagesize( $filename ); } } if ( false !== $info ) { return $info; } if ( 'image/webp' === wp_get_image_mime( $filename ) ) { $webp_info = wp_get_webp_info( $filename ); $width = $webp_info['width']; $height = $webp_info['height']; if ( $width && $height ) { return array( $width, $height, IMAGETYPE_WEBP, sprintf( 'width="%d" height="%d"', $width, $height ), 'mime' => 'image/webp', ); } } return false; } function wp_get_webp_info( $filename ) { $width = false; $height = false; $type = false; if ( 'image/webp' !== wp_get_image_mime( $filename ) ) { return compact( 'width', 'height', 'type' ); } $magic = file_get_contents( $filename, false, null, 0, 40 ); if ( false === $magic ) { return compact( 'width', 'height', 'type' ); } if ( strlen( $magic ) < 40 ) { return compact( 'width', 'height', 'type' ); } switch ( substr( $magic, 12, 4 ) ) { case 'VP8 ': $parts = unpack( 'v2', substr( $magic, 26, 4 ) ); $width = (int) ( $parts[1] & 0x3FFF ); $height = (int) ( $parts[2] & 0x3FFF ); $type = 'lossy'; break; case 'VP8L': $parts = unpack( 'C4', substr( $magic, 21, 4 ) ); $width = (int) ( $parts[1] | ( ( $parts[2] & 0x3F ) << 8 ) ) + 1; $height = (int) ( ( ( $parts[2] & 0xC0 ) >> 6 ) | ( $parts[3] << 2 ) | ( ( $parts[4] & 0x03 ) << 10 ) ) + 1; $type = 'lossless'; break; case 'VP8X': $width = unpack( 'V', substr( $magic, 24, 3 ) . "\x00" ); $width = (int) ( $width[1] & 0xFFFFFF ) + 1; $height = unpack( 'V', substr( $magic, 27, 3 ) . "\x00" ); $height = (int) ( $height[1] & 0xFFFFFF ) + 1; $type = 'animated-alpha'; break; } return compact( 'width', 'height', 'type' ); } function wp_get_loading_attr_default( $context ) { if ( 'the_content' !== $context && 'the_post_thumbnail' !== $context ) { return 'lazy'; } if ( is_admin() || ! in_the_loop() || ! is_main_query() ) { return 'lazy'; } $content_media_count = wp_increase_content_media_count(); if ( $content_media_count <= wp_omit_loading_attr_threshold() ) { return false; } return 'lazy'; } function wp_omit_loading_attr_threshold( $force = false ) { static $omit_threshold; if ( ! isset( $omit_threshold ) || $force ) { $omit_threshold = apply_filters( 'wp_omit_loading_attr_threshold', 1 ); } return $omit_threshold; } function wp_increase_content_media_count( $amount = 1 ) { static $content_media_count = 0; $content_media_count += $amount; return $content_media_count; } 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null, 'cookies' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); if ( isset( $parsed_args['headers']['User-Agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent']; unset( $parsed_args['headers']['User-Agent'] ); } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['user-agent']; unset( $parsed_args['headers']['user-agent'] ); } WP_Http::buildCookieHeader( $parsed_args ); $parsed_url = parse_url( $url ); $connect_host = $parsed_url['host']; $secure_transport = ( 'ssl' === $parsed_url['scheme'] || 'https' === $parsed_url['scheme'] ); if ( ! isset( $parsed_url['port'] ) ) { if ( 'ssl' === $parsed_url['scheme'] || 'https' === $parsed_url['scheme'] ) { $parsed_url['port'] = 443; $secure_transport = true; } else { $parsed_url['port'] = 80; } } if ( ! isset( $parsed_url['path'] ) ) { $parsed_url['path'] = '/'; } if ( isset( $parsed_args['headers']['Host'] ) || isset( $parsed_args['headers']['host'] ) ) { if ( isset( $parsed_args['headers']['Host'] ) ) { $parsed_url['host'] = $parsed_args['headers']['Host']; } else { $parsed_url['host'] = $parsed_args['headers']['host']; } unset( $parsed_args['headers']['Host'], $parsed_args['headers']['host'] ); } if ( 'localhost' === strtolower( $connect_host ) ) { $connect_host = '127.0.0.1'; } $connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host; $is_local = isset( $parsed_args['local'] ) && $parsed_args['local']; $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify']; if ( $is_local ) { $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url ); } elseif ( ! $is_local ) { $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url ); } $proxy = new WP_HTTP_Proxy(); $context = stream_context_create( array( 'ssl' => array( 'verify_peer' => $ssl_verify, 'capture_peer_cert' => $ssl_verify, 'SNI_enabled' => true, 'cafile' => $parsed_args['sslcertificates'], 'allow_self_signed' => ! $ssl_verify, ), ) ); $timeout = (int) floor( $parsed_args['timeout'] ); $utimeout = $timeout == $parsed_args['timeout'] ? 0 : 1000000 * $parsed_args['timeout'] % 1000000; $connect_timeout = max( $timeout, 1 ); $connection_error = null; $connection_error_str = null; if ( ! WP_DEBUG ) { if ( $secure_transport ) { $error_reporting = error_reporting( 0 ); } if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { $handle = @stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); } else { $handle = @stream_socket_client( $connect_host . ':' . $parsed_url['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); } if ( $secure_transport ) { error_reporting( $error_reporting ); } } else { if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { $handle = stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); } else { $handle = stream_socket_client( $connect_host . ':' . $parsed_url['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); } } if ( false === $handle ) { if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str ) { return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); } return new WP_Error( 'http_request_failed', $connection_error . ': ' . $connection_error_str ); } if ( $secure_transport && $ssl_verify && ! $proxy->is_enabled() ) { if ( ! self::verify_ssl_certificate( $handle, $parsed_url['host'] ) ) { return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); } } stream_set_timeout( $handle, $timeout, $utimeout ); if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { $request_path = $url; } else { $request_path = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ); } $headers = strtoupper( $parsed_args['method'] ) . ' ' . $request_path . ' HTTP/' . $parsed_args['httpversion'] . "\r\n"; $include_port_in_host_header = ( ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) || ( 'http' === $parsed_url['scheme'] && 80 != $parsed_url['port'] ) || ( 'https' === $parsed_url['scheme'] && 443 != $parsed_url['port'] ) ); if ( $include_port_in_host_header ) { $headers .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n"; } else { $headers .= 'Host: ' . $parsed_url['host'] . "\r\n"; } if ( isset( $parsed_args['user-agent'] ) ) { $headers .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n"; } if ( is_array( $parsed_args['headers'] ) ) { foreach ( (array) $parsed_args['headers'] as $header => $header_value ) { $headers .= $header . ': ' . $header_value . "\r\n"; } } else { $headers .= $parsed_args['headers']; } if ( $proxy->use_authentication() ) { $headers .= $proxy->authentication_header() . "\r\n"; } $headers .= "\r\n"; if ( ! is_null( $parsed_args['body'] ) ) { $headers .= $parsed_args['body']; } fwrite( $handle, $headers ); if ( ! $parsed_args['blocking'] ) { stream_set_blocking( $handle, 0 ); fclose( $handle ); return array( 'headers' => array(), 'body' => '', 'response' => array( 'code' => false, 'message' => false, ), 'cookies' => array(), ); } $response = ''; $body_started = false; $keep_reading = true; $block_size = 4096; if ( isset( $parsed_args['limit_response_size'] ) ) { $block_size = min( $block_size, $parsed_args['limit_response_size'] ); } if ( $parsed_args['stream'] ) { if ( ! WP_DEBUG ) { $stream_handle = @fopen( $parsed_args['filename'], 'w+' ); } else { $stream_handle = fopen( $parsed_args['filename'], 'w+' ); } if ( ! $stream_handle ) { return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for %1$s to %2$s.' ), 'fopen()', $parsed_args['filename'] ) ); } $bytes_written = 0; while ( ! feof( $handle ) && $keep_reading ) { $block = fread( $handle, $block_size ); if ( ! $body_started ) { $response .= $block; if ( strpos( $response, "\r\n\r\n" ) ) { $processed_response = WP_Http::processResponse( $response ); $body_started = true; $block = $processed_response['body']; unset( $response ); $processed_response['body'] = ''; } } $this_block_size = strlen( $block ); if ( isset( $parsed_args['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $parsed_args['limit_response_size'] ) { $this_block_size = ( $parsed_args['limit_response_size'] - $bytes_written ); $block = substr( $block, 0, $this_block_size ); } $bytes_written_to_file = fwrite( $stream_handle, $block ); if ( $bytes_written_to_file != $this_block_size ) { fclose( $handle ); fclose( $stream_handle ); return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); } $bytes_written += $bytes_written_to_file; $keep_reading = ( ! isset( $parsed_args['limit_response_size'] ) || $bytes_written < $parsed_args['limit_response_size'] ); } fclose( $stream_handle ); } else { $header_length = 0; while ( ! feof( $handle ) && $keep_reading ) { $block = fread( $handle, $block_size ); $response .= $block; if ( ! $body_started && strpos( $response, "\r\n\r\n" ) ) { $header_length = strpos( $response, "\r\n\r\n" ) + 4; $body_started = true; } $keep_reading = ( ! $body_started || ! isset( $parsed_args['limit_response_size'] ) || strlen( $response ) < ( $header_length + $parsed_args['limit_response_size'] ) ); } $processed_response = WP_Http::processResponse( $response ); unset( $response ); } fclose( $handle ); $processed_headers = WP_Http::processHeaders( $processed_response['headers'], $url ); $response = array( 'headers' => $processed_headers['headers'], 'body' => null, 'response' => $processed_headers['response'], 'cookies' => $processed_headers['cookies'], 'filename' => $parsed_args['filename'], ); $redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response ); if ( false !== $redirect_response ) { return $redirect_response; } if ( ! empty( $processed_response['body'] ) && isset( $processed_headers['headers']['transfer-encoding'] ) && 'chunked' === $processed_headers['headers']['transfer-encoding'] ) { $processed_response['body'] = WP_Http::chunkTransferDecode( $processed_response['body'] ); } if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $processed_headers['headers'] ) ) { $processed_response['body'] = WP_Http_Encoding::decompress( $processed_response['body'] ); } if ( isset( $parsed_args['limit_response_size'] ) && strlen( $processed_response['body'] ) > $parsed_args['limit_response_size'] ) { $processed_response['body'] = substr( $processed_response['body'], 0, $parsed_args['limit_response_size'] ); } $response['body'] = $processed_response['body']; return $response; } public static function verify_ssl_certificate( $stream, $host ) { $context_options = stream_context_get_options( $stream ); if ( empty( $context_options['ssl']['peer_certificate'] ) ) { return false; } $cert = openssl_x509_parse( $context_options['ssl']['peer_certificate'] ); if ( ! $cert ) { return false; } $host_type = ( WP_Http::is_ip_address( $host ) ? 'ip' : 'dns' ); $certificate_hostnames = array(); if ( ! empty( $cert['extensions']['subjectAltName'] ) ) { $match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] ); foreach ( $match_against as $match ) { list( $match_type, $match_host ) = explode( ':', $match ); if ( strtolower( trim( $match_type ) ) === $host_type ) { $certificate_hostnames[] = strtolower( trim( $match_host ) ); } } } elseif ( ! empty( $cert['subject']['CN'] ) ) { $certificate_hostnames[] = strtolower( $cert['subject']['CN'] ); } if ( in_array( strtolower( $host ), $certificate_hostnames, true ) ) { return true; } if ( 'ip' === $host_type ) { return false; } if ( substr_count( $host, '.' ) < 2 ) { return false; } $wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host ); return in_array( strtolower( $wildcard_host ), $certificate_hostnames, true ); } public static function test( $args = array() ) { if ( ! function_exists( 'stream_socket_client' ) ) { return false; } $is_ssl = isset( $args['ssl'] ) && $args['ssl']; if ( $is_ssl ) { if ( ! extension_loaded( 'openssl' ) ) { return false; } if ( ! function_exists( 'openssl_x509_parse' ) ) { return false; } } return apply_filters( 'use_streams_transport', true, $args ); } } class WP_HTTP_Fsockopen extends WP_Http_Streams { } - - - - - WordPress - Yes - Yes - - - - WordPress - images/wlw/wp-icon.png - images/wlw/wp-watermark.png - View site - Dashboard - - - - - - - - - - - - - - - '/^widget_(?P.+?)(?:\[(?P\d+)\])?$/', 'sidebar_widgets' => '/^sidebars_widgets\[(?P.+?)\]$/', ); public function __construct( $manager ) { $this->manager = $manager; add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_customize_dynamic_setting_args' ), 10, 2 ); add_action( 'widgets_init', array( $this, 'register_settings' ), 95 ); add_action( 'customize_register', array( $this, 'schedule_customize_register' ), 1 ); if ( ! current_user_can( 'edit_theme_options' ) ) { return; } add_action( 'wp_loaded', array( $this, 'override_sidebars_widgets_for_theme_switch' ) ); add_action( 'customize_controls_init', array( $this, 'customize_controls_init' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'customize_controls_print_styles', array( $this, 'print_styles' ) ); add_action( 'customize_controls_print_scripts', array( $this, 'print_scripts' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_widget_control_templates' ) ); add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) ); add_filter( 'customize_refresh_nonces', array( $this, 'refresh_nonces' ) ); add_filter( 'should_load_block_editor_scripts_and_styles', array( $this, 'should_load_block_editor_scripts_and_styles' ) ); add_action( 'dynamic_sidebar', array( $this, 'tally_rendered_widgets' ) ); add_filter( 'is_active_sidebar', array( $this, 'tally_sidebars_via_is_active_sidebar_calls' ), 10, 2 ); add_filter( 'dynamic_sidebar_has_widgets', array( $this, 'tally_sidebars_via_dynamic_sidebar_calls' ), 10, 2 ); add_filter( 'customize_dynamic_partial_args', array( $this, 'customize_dynamic_partial_args' ), 10, 2 ); add_action( 'customize_preview_init', array( $this, 'selective_refresh_init' ) ); } public function get_selective_refreshable_widgets() { global $wp_widget_factory; if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) { return array(); } if ( ! isset( $this->selective_refreshable_widgets ) ) { $this->selective_refreshable_widgets = array(); foreach ( $wp_widget_factory->widgets as $wp_widget ) { $this->selective_refreshable_widgets[ $wp_widget->id_base ] = ! empty( $wp_widget->widget_options['customize_selective_refresh'] ); } } return $this->selective_refreshable_widgets; } public function is_widget_selective_refreshable( $id_base ) { $selective_refreshable_widgets = $this->get_selective_refreshable_widgets(); return ! empty( $selective_refreshable_widgets[ $id_base ] ); } protected function get_setting_type( $setting_id ) { static $cache = array(); if ( isset( $cache[ $setting_id ] ) ) { return $cache[ $setting_id ]; } foreach ( $this->setting_id_patterns as $type => $pattern ) { if ( preg_match( $pattern, $setting_id ) ) { $cache[ $setting_id ] = $type; return $type; } } } public function register_settings() { $widget_setting_ids = array(); $incoming_setting_ids = array_keys( $this->manager->unsanitized_post_values() ); foreach ( $incoming_setting_ids as $setting_id ) { if ( ! is_null( $this->get_setting_type( $setting_id ) ) ) { $widget_setting_ids[] = $setting_id; } } if ( $this->manager->doing_ajax( 'update-widget' ) && isset( $_REQUEST['widget-id'] ) ) { $widget_setting_ids[] = $this->get_setting_id( wp_unslash( $_REQUEST['widget-id'] ) ); } $settings = $this->manager->add_dynamic_settings( array_unique( $widget_setting_ids ) ); if ( $this->manager->settings_previewed() ) { foreach ( $settings as $setting ) { $setting->preview(); } } } public function filter_customize_dynamic_setting_args( $args, $setting_id ) { if ( $this->get_setting_type( $setting_id ) ) { $args = $this->get_setting_args( $setting_id ); } return $args; } protected function get_post_value( $name, $default_value = null ) { if ( ! isset( $_POST[ $name ] ) ) { return $default_value; } return wp_unslash( $_POST[ $name ] ); } public function override_sidebars_widgets_for_theme_switch() { global $sidebars_widgets; if ( $this->manager->doing_ajax() || $this->manager->is_theme_active() ) { return; } $this->old_sidebars_widgets = wp_get_sidebars_widgets(); add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) ); $this->manager->set_post_value( 'old_sidebars_widgets_data', $this->old_sidebars_widgets ); $sidebars_widgets = $this->old_sidebars_widgets; $sidebars_widgets = retrieve_widgets( 'customize' ); add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 ); unset( $GLOBALS['_wp_sidebars_widgets'] ); } public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) { return $this->old_sidebars_widgets; } public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) { $sidebars_widgets = $GLOBALS['sidebars_widgets']; $sidebars_widgets['array_version'] = 3; return $sidebars_widgets; } public function customize_controls_init() { do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); } public function schedule_customize_register() { if ( is_admin() ) { $this->customize_register(); } else { add_action( 'wp', array( $this, 'customize_register' ) ); } } public function customize_register() { global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars; $use_widgets_block_editor = wp_use_widgets_block_editor(); add_filter( 'sidebars_widgets', array( $this, 'preview_sidebars_widgets' ), 1 ); $sidebars_widgets = array_merge( array( 'wp_inactive_widgets' => array() ), array_fill_keys( array_keys( $wp_registered_sidebars ), array() ), wp_get_sidebars_widgets() ); $new_setting_ids = array(); foreach ( array_keys( $wp_registered_widgets ) as $widget_id ) { $setting_id = $this->get_setting_id( $widget_id ); $setting_args = $this->get_setting_args( $setting_id ); if ( ! $this->manager->get_setting( $setting_id ) ) { $this->manager->add_setting( $setting_id, $setting_args ); } $new_setting_ids[] = $setting_id; } if ( ! $this->manager->is_theme_active() ) { $setting_id = 'old_sidebars_widgets_data'; $setting_args = $this->get_setting_args( $setting_id, array( 'type' => 'global_variable', 'dirty' => true, ) ); $this->manager->add_setting( $setting_id, $setting_args ); } $this->manager->add_panel( 'widgets', array( 'type' => 'widgets', 'title' => __( 'Widgets' ), 'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ), 'priority' => 110, 'active_callback' => array( $this, 'is_panel_active' ), 'auto_expand_sole_section' => true, 'theme_supports' => 'widgets', ) ); foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) { if ( empty( $sidebar_widget_ids ) ) { $sidebar_widget_ids = array(); } $is_registered_sidebar = is_registered_sidebar( $sidebar_id ); $is_inactive_widgets = ( 'wp_inactive_widgets' === $sidebar_id ); $is_active_sidebar = ( $is_registered_sidebar && ! $is_inactive_widgets ); if ( $is_registered_sidebar || $is_inactive_widgets ) { $setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id ); $setting_args = $this->get_setting_args( $setting_id ); if ( ! $this->manager->get_setting( $setting_id ) ) { if ( ! $this->manager->is_theme_active() ) { $setting_args['dirty'] = true; } $this->manager->add_setting( $setting_id, $setting_args ); } $new_setting_ids[] = $setting_id; $section_id = sprintf( 'sidebar-widgets-%s', $sidebar_id ); if ( $is_active_sidebar ) { $section_args = array( 'title' => $wp_registered_sidebars[ $sidebar_id ]['name'], 'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ), true ), 'panel' => 'widgets', 'sidebar_id' => $sidebar_id, ); if ( $use_widgets_block_editor ) { $section_args['description'] = ''; } else { $section_args['description'] = $wp_registered_sidebars[ $sidebar_id ]['description']; } $section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id ); $section = new WP_Customize_Sidebar_Section( $this->manager, $section_id, $section_args ); $this->manager->add_section( $section ); if ( $use_widgets_block_editor ) { $control = new WP_Sidebar_Block_Editor_Control( $this->manager, $setting_id, array( 'section' => $section_id, 'sidebar_id' => $sidebar_id, 'label' => $section_args['title'], 'description' => $section_args['description'], ) ); } else { $control = new WP_Widget_Area_Customize_Control( $this->manager, $setting_id, array( 'section' => $section_id, 'sidebar_id' => $sidebar_id, 'priority' => count( $sidebar_widget_ids ), ) ); } $this->manager->add_control( $control ); $new_setting_ids[] = $setting_id; } } if ( ! $use_widgets_block_editor ) { foreach ( $sidebar_widget_ids as $i => $widget_id ) { if ( ! $is_active_sidebar || ! isset( $wp_registered_widgets[ $widget_id ] ) ) { continue; } $registered_widget = $wp_registered_widgets[ $widget_id ]; $setting_id = $this->get_setting_id( $widget_id ); $id_base = $wp_registered_widget_controls[ $widget_id ]['id_base']; $control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array( 'label' => $registered_widget['name'], 'section' => $section_id, 'sidebar_id' => $sidebar_id, 'widget_id' => $widget_id, 'widget_id_base' => $id_base, 'priority' => $i, 'width' => $wp_registered_widget_controls[ $widget_id ]['width'], 'height' => $wp_registered_widget_controls[ $widget_id ]['height'], 'is_wide' => $this->is_wide_widget( $widget_id ), ) ); $this->manager->add_control( $control ); } } } if ( $this->manager->settings_previewed() ) { foreach ( $new_setting_ids as $new_setting_id ) { $this->manager->get_setting( $new_setting_id )->preview(); } } } public function is_panel_active() { global $wp_registered_sidebars; return ! empty( $wp_registered_sidebars ); } public function get_setting_id( $widget_id ) { $parsed_widget_id = $this->parse_widget_id( $widget_id ); $setting_id = sprintf( 'widget_%s', $parsed_widget_id['id_base'] ); if ( ! is_null( $parsed_widget_id['number'] ) ) { $setting_id .= sprintf( '[%d]', $parsed_widget_id['number'] ); } return $setting_id; } public function is_wide_widget( $widget_id ) { global $wp_registered_widget_controls; $parsed_widget_id = $this->parse_widget_id( $widget_id ); $width = $wp_registered_widget_controls[ $widget_id ]['width']; $is_core = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases, true ); $is_wide = ( $width > 250 && ! $is_core ); return apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id ); } public function parse_widget_id( $widget_id ) { $parsed = array( 'number' => null, 'id_base' => null, ); if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) { $parsed['id_base'] = $matches[1]; $parsed['number'] = (int) $matches[2]; } else { $parsed['id_base'] = $widget_id; } return $parsed; } public function parse_widget_setting_id( $setting_id ) { if ( ! preg_match( '/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches ) ) { return new WP_Error( 'widget_setting_invalid_id' ); } $id_base = $matches[2]; $number = isset( $matches[3] ) ? (int) $matches[3] : null; return compact( 'id_base', 'number' ); } public function print_styles() { do_action( 'admin_print_styles-widgets.php' ); do_action( 'admin_print_styles' ); } public function print_scripts() { do_action( 'admin_print_scripts-widgets.php' ); do_action( 'admin_print_scripts' ); } public function enqueue_scripts() { global $wp_scripts, $wp_registered_sidebars, $wp_registered_widgets; wp_enqueue_style( 'customize-widgets' ); wp_enqueue_script( 'customize-widgets' ); do_action( 'admin_enqueue_scripts', 'widgets.php' ); $available_widgets = array(); foreach ( $this->get_available_widgets() as $available_widget ) { unset( $available_widget['control_tpl'] ); $available_widgets[] = $available_widget; } $widget_reorder_nav_tpl = sprintf( '
                %1$s%2$s%3$s
                ', __( 'Move to another area…' ), __( 'Move down' ), __( 'Move up' ) ); $move_widget_area_tpl = str_replace( array( '{description}', '{btn}' ), array( __( 'Select an area to move this widget into:' ), _x( 'Move', 'Move widget' ), ), '
                -

                {description}

                -
                  - <% _.each( sidebars, function ( sidebar ){ %> -
                • <%- sidebar.name %>
                • - <% }); %> -
                -
                - -
                -
                ' ); $some_non_rendered_areas_messages = array(); $some_non_rendered_areas_messages[1] = html_entity_decode( __( 'Your theme has 1 other widget area, but this particular page does not display it.' ), ENT_QUOTES, get_bloginfo( 'charset' ) ); $registered_sidebar_count = count( $wp_registered_sidebars ); for ( $non_rendered_count = 2; $non_rendered_count < $registered_sidebar_count; $non_rendered_count++ ) { $some_non_rendered_areas_messages[ $non_rendered_count ] = html_entity_decode( sprintf( _n( 'Your theme has %s other widget area, but this particular page does not display it.', 'Your theme has %s other widget areas, but this particular page does not display them.', $non_rendered_count ), number_format_i18n( $non_rendered_count ) ), ENT_QUOTES, get_bloginfo( 'charset' ) ); } if ( 1 === $registered_sidebar_count ) { $no_areas_shown_message = html_entity_decode( sprintf( __( 'Your theme has 1 widget area, but this particular page does not display it.' ) ), ENT_QUOTES, get_bloginfo( 'charset' ) ); } else { $no_areas_shown_message = html_entity_decode( sprintf( _n( 'Your theme has %s widget area, but this particular page does not display it.', 'Your theme has %s widget areas, but this particular page does not display them.', $registered_sidebar_count ), number_format_i18n( $registered_sidebar_count ) ), ENT_QUOTES, get_bloginfo( 'charset' ) ); } $settings = array( 'registeredSidebars' => array_values( $wp_registered_sidebars ), 'registeredWidgets' => $wp_registered_widgets, 'availableWidgets' => $available_widgets, 'l10n' => array( 'saveBtnLabel' => __( 'Apply' ), 'saveBtnTooltip' => __( 'Save and preview changes before publishing them.' ), 'removeBtnLabel' => __( 'Remove' ), 'removeBtnTooltip' => __( 'Keep widget settings and move it to the inactive widgets' ), 'error' => __( 'An error has occurred. Please reload the page and try again.' ), 'widgetMovedUp' => __( 'Widget moved up' ), 'widgetMovedDown' => __( 'Widget moved down' ), 'navigatePreview' => __( 'You can navigate to other pages on your site while using the Customizer to view and edit the widgets displayed on those pages.' ), 'someAreasShown' => $some_non_rendered_areas_messages, 'noAreasShown' => $no_areas_shown_message, 'reorderModeOn' => __( 'Reorder mode enabled' ), 'reorderModeOff' => __( 'Reorder mode closed' ), 'reorderLabelOn' => esc_attr__( 'Reorder widgets' ), 'widgetsFound' => __( 'Number of widgets found: %d' ), 'noWidgetsFound' => __( 'No widgets found.' ), ), 'tpl' => array( 'widgetReorderNav' => $widget_reorder_nav_tpl, 'moveWidgetArea' => $move_widget_area_tpl, ), 'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(), ); foreach ( $settings['registeredWidgets'] as &$registered_widget ) { unset( $registered_widget['callback'] ); } $wp_scripts->add_data( 'customize-widgets', 'data', sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) ) ); if ( wp_use_widgets_block_editor() ) { $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/customize-widgets', ) ); $editor_settings = get_block_editor_settings( get_legacy_widget_block_editor_settings(), $block_editor_context ); wp_add_inline_script( 'wp-customize-widgets', sprintf( 'wp.domReady( function() { - wp.customizeWidgets.initialize( "widgets-customizer", %s ); - } );', wp_json_encode( $editor_settings ) ) ); wp_add_inline_script( 'wp-blocks', 'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');' ); wp_add_inline_script( 'wp-blocks', sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ), 'after' ); wp_enqueue_script( 'wp-customize-widgets' ); wp_enqueue_style( 'wp-customize-widgets' ); do_action( 'enqueue_block_editor_assets' ); } } public function output_widget_control_templates() { ?> -
                -
                -
                - -

                - - manager->get_panel( 'widgets' )->title ) ); ?> - - -

                -
                -
                - - - - -

                -
                -
                - get_available_widgets() as $available_widget ) : ?> -
                - -
                - -

                -
                -
                -
                - 'option', 'capability' => 'edit_theme_options', 'default' => array(), ); if ( preg_match( $this->setting_id_patterns['sidebar_widgets'], $id, $matches ) ) { $args['sanitize_callback'] = array( $this, 'sanitize_sidebar_widgets' ); $args['sanitize_js_callback'] = array( $this, 'sanitize_sidebar_widgets_js_instance' ); $args['transport'] = current_theme_supports( 'customize-selective-refresh-widgets' ) ? 'postMessage' : 'refresh'; } elseif ( preg_match( $this->setting_id_patterns['widget_instance'], $id, $matches ) ) { $id_base = $matches['id_base']; $args['sanitize_callback'] = function( $value ) use ( $id_base ) { return $this->sanitize_widget_instance( $value, $id_base ); }; $args['sanitize_js_callback'] = function( $value ) use ( $id_base ) { return $this->sanitize_widget_js_instance( $value, $id_base ); }; $args['transport'] = $this->is_widget_selective_refreshable( $matches['id_base'] ) ? 'postMessage' : 'refresh'; } $args = array_merge( $args, $overrides ); return apply_filters( 'widget_customizer_setting_args', $args, $id ); } public function sanitize_sidebar_widgets( $widget_ids ) { $widget_ids = array_map( 'strval', (array) $widget_ids ); $sanitized_widget_ids = array(); foreach ( $widget_ids as $widget_id ) { $sanitized_widget_ids[] = preg_replace( '/[^a-z0-9_\-]/', '', $widget_id ); } return $sanitized_widget_ids; } public function get_available_widgets() { static $available_widgets = array(); if ( ! empty( $available_widgets ) ) { return $available_widgets; } global $wp_registered_widgets, $wp_registered_widget_controls; require_once ABSPATH . 'wp-admin/includes/widgets.php'; $sort = $wp_registered_widgets; usort( $sort, array( $this, '_sort_name_callback' ) ); $done = array(); foreach ( $sort as $widget ) { if ( in_array( $widget['callback'], $done, true ) ) { continue; } $sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false ); $done[] = $widget['callback']; if ( ! isset( $widget['params'][0] ) ) { $widget['params'][0] = array(); } $available_widget = $widget; unset( $available_widget['callback'] ); $args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', ); $is_disabled = false; $is_multi_widget = ( isset( $wp_registered_widget_controls[ $widget['id'] ]['id_base'] ) && isset( $widget['params'][0]['number'] ) ); if ( $is_multi_widget ) { $id_base = $wp_registered_widget_controls[ $widget['id'] ]['id_base']; $args['_temp_id'] = "$id_base-__i__"; $args['_multi_num'] = next_widget_id_number( $id_base ); $args['_add'] = 'multi'; } else { $args['_add'] = 'single'; if ( $sidebar && 'wp_inactive_widgets' !== $sidebar ) { $is_disabled = true; } $id_base = $widget['id']; } $list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0], ) ); $control_tpl = $this->get_widget_control( $list_widget_controls_args ); $available_widget = array_merge( $available_widget, array( 'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null, 'is_multi' => $is_multi_widget, 'control_tpl' => $control_tpl, 'multi_number' => ( 'multi' === $args['_add'] ) ? $args['_multi_num'] : false, 'is_disabled' => $is_disabled, 'id_base' => $id_base, 'transport' => $this->is_widget_selective_refreshable( $id_base ) ? 'postMessage' : 'refresh', 'width' => $wp_registered_widget_controls[ $widget['id'] ]['width'], 'height' => $wp_registered_widget_controls[ $widget['id'] ]['height'], 'is_wide' => $this->is_wide_widget( $widget['id'] ), ) ); $available_widgets[] = $available_widget; } return $available_widgets; } protected function _sort_name_callback( $widget_a, $widget_b ) { return strnatcasecmp( $widget_a['name'], $widget_b['name'] ); } public function get_widget_control( $args ) { $args[0]['before_form'] = '
                '; $args[0]['after_form'] = '
                '; $args[0]['before_widget_content'] = '
                '; $args[0]['after_widget_content'] = '
                '; ob_start(); wp_widget_control( ...$args ); $control_tpl = ob_get_clean(); return $control_tpl; } public function get_widget_control_parts( $args ) { $args[0]['before_widget_content'] = '
                '; $args[0]['after_widget_content'] = '
                '; $control_markup = $this->get_widget_control( $args ); $content_start_pos = strpos( $control_markup, $args[0]['before_widget_content'] ); $content_end_pos = strrpos( $control_markup, $args[0]['after_widget_content'] ); $control = substr( $control_markup, 0, $content_start_pos + strlen( $args[0]['before_widget_content'] ) ); $control .= substr( $control_markup, $content_end_pos ); $content = trim( substr( $control_markup, $content_start_pos + strlen( $args[0]['before_widget_content'] ), $content_end_pos - $content_start_pos - strlen( $args[0]['before_widget_content'] ) ) ); return compact( 'control', 'content' ); } public function customize_preview_init() { add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue' ) ); add_action( 'wp_print_styles', array( $this, 'print_preview_css' ), 1 ); add_action( 'wp_footer', array( $this, 'export_preview_data' ), 20 ); } public function refresh_nonces( $nonces ) { $nonces['update-widget'] = wp_create_nonce( 'update-widget' ); return $nonces; } public function should_load_block_editor_scripts_and_styles( $is_block_editor_screen ) { if ( wp_use_widgets_block_editor() ) { return true; } return $is_block_editor_screen; } public function preview_sidebars_widgets( $sidebars_widgets ) { $sidebars_widgets = get_option( 'sidebars_widgets', array() ); unset( $sidebars_widgets['array_version'] ); return $sidebars_widgets; } public function customize_preview_enqueue() { wp_enqueue_script( 'customize-preview-widgets' ); } public function print_preview_css() { ?> - - __( 'Shift-click to edit this widget.' ), ); if ( $switched_locale ) { restore_previous_locale(); } $rendered_sidebars = array_filter( $this->rendered_sidebars ); $rendered_widgets = array_filter( $this->rendered_widgets ); $settings = array( 'renderedSidebars' => array_fill_keys( array_keys( $rendered_sidebars ), true ), 'renderedWidgets' => array_fill_keys( array_keys( $rendered_widgets ), true ), 'registeredSidebars' => array_values( $wp_registered_sidebars ), 'registeredWidgets' => $wp_registered_widgets, 'l10n' => $l10n, 'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(), ); foreach ( $settings['registeredWidgets'] as &$registered_widget ) { unset( $registered_widget['callback'] ); } ?> - - rendered_widgets[ $widget['id'] ] = true; } public function is_widget_rendered( $widget_id ) { return ! empty( $this->rendered_widgets[ $widget_id ] ); } public function is_sidebar_rendered( $sidebar_id ) { return ! empty( $this->rendered_sidebars[ $sidebar_id ] ); } public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) { if ( is_registered_sidebar( $sidebar_id ) ) { $this->rendered_sidebars[ $sidebar_id ] = true; } return $is_active; } public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) { if ( is_registered_sidebar( $sidebar_id ) ) { $this->rendered_sidebars[ $sidebar_id ] = true; } return $has_widgets; } protected function get_instance_hash_key( $serialized_instance ) { return wp_hash( $serialized_instance ); } public function sanitize_widget_instance( $value, $id_base = null ) { global $wp_widget_factory; if ( array() === $value ) { return $value; } if ( isset( $value['raw_instance'] ) && $id_base && wp_use_widgets_block_editor() ) { $widget_object = $wp_widget_factory->get_widget_object( $id_base ); if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) { if ( 'block' === $id_base && ! current_user_can( 'unfiltered_html' ) ) { $value['raw_instance']['content'] = wp_kses_post( $value['raw_instance']['content'] ); } return $value['raw_instance']; } } if ( empty( $value['is_widget_customizer_js_value'] ) || empty( $value['instance_hash_key'] ) || empty( $value['encoded_serialized_instance'] ) ) { return; } $decoded = base64_decode( $value['encoded_serialized_instance'], true ); if ( false === $decoded ) { return; } if ( ! hash_equals( $this->get_instance_hash_key( $decoded ), $value['instance_hash_key'] ) ) { return; } $instance = unserialize( $decoded ); if ( false === $instance ) { return; } return $instance; } public function sanitize_widget_js_instance( $value, $id_base = null ) { global $wp_widget_factory; if ( empty( $value['is_widget_customizer_js_value'] ) ) { $serialized = serialize( $value ); $js_value = array( 'encoded_serialized_instance' => base64_encode( $serialized ), 'title' => empty( $value['title'] ) ? '' : $value['title'], 'is_widget_customizer_js_value' => true, 'instance_hash_key' => $this->get_instance_hash_key( $serialized ), ); if ( $id_base && wp_use_widgets_block_editor() ) { $widget_object = $wp_widget_factory->get_widget_object( $id_base ); if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) { $js_value['raw_instance'] = (object) $value; } } return $js_value; } return $value; } public function sanitize_sidebar_widgets_js_instance( $widget_ids ) { global $wp_registered_widgets; $widget_ids = array_values( array_intersect( $widget_ids, array_keys( $wp_registered_widgets ) ) ); return $widget_ids; } public function call_widget_update( $widget_id ) { global $wp_registered_widget_updates, $wp_registered_widget_controls; $setting_id = $this->get_setting_id( $widget_id ); 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']; $added_input_vars = array(); if ( ! empty( $_POST['sanitized_widget_setting'] ) ) { $sanitized_widget_setting = json_decode( $this->get_post_value( 'sanitized_widget_setting' ), true ); if ( false === $sanitized_widget_setting ) { $this->stop_capturing_option_updates(); return new WP_Error( 'widget_setting_malformed' ); } $instance = $this->sanitize_widget_instance( $sanitized_widget_setting, $parsed_id['id_base'] ); if ( is_null( $instance ) ) { $this->stop_capturing_option_updates(); return new WP_Error( 'widget_setting_unsanitized' ); } if ( ! is_null( $parsed_id['number'] ) ) { $value = array(); $value[ $parsed_id['number'] ] = $instance; $key = 'widget-' . $parsed_id['id_base']; $_REQUEST[ $key ] = wp_slash( $value ); $_POST[ $key ] = $_REQUEST[ $key ]; $added_input_vars[] = $key; } else { foreach ( $instance as $key => $value ) { $_REQUEST[ $key ] = wp_slash( $value ); $_POST[ $key ] = $_REQUEST[ $key ]; $added_input_vars[] = $key; } } } foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) { ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } foreach ( $added_input_vars as $key ) { unset( $_POST[ $key ] ); unset( $_REQUEST[ $key ] ); } if ( 0 !== $this->count_captured_options() ) { if ( $this->count_captured_options() > 1 ) { $this->stop_capturing_option_updates(); return new WP_Error( 'widget_setting_too_many_options' ); } $updated_option_name = key( $this->get_captured_options() ); if ( $updated_option_name !== $option_name ) { $this->stop_capturing_option_updates(); return new WP_Error( 'widget_setting_unexpected_option' ); } } $option = $this->get_captured_option( $option_name ); if ( null !== $parsed_id['number'] ) { $instance = $option[ $parsed_id['number'] ]; } else { $instance = $option; } $this->manager->set_post_value( $setting_id, $this->sanitize_widget_js_instance( $instance, $parsed_id['id_base'] ) ); ob_start(); $form = $wp_registered_widget_controls[ $widget_id ]; if ( $form ) { call_user_func_array( $form['callback'], $form['params'] ); } $form = ob_get_clean(); $this->stop_capturing_option_updates(); return compact( 'instance', 'form' ); } public function wp_ajax_update_widget() { if ( ! is_user_logged_in() ) { wp_die( 0 ); } check_ajax_referer( 'update-widget', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } if ( empty( $_POST['widget-id'] ) ) { wp_send_json_error( 'missing_widget-id' ); } do_action( 'load-widgets.php' ); do_action( 'widgets.php' ); do_action( 'sidebar_admin_setup' ); $widget_id = $this->get_post_value( 'widget-id' ); $parsed_id = $this->parse_widget_id( $widget_id ); $id_base = $parsed_id['id_base']; $is_updating_widget_template = ( isset( $_POST[ 'widget-' . $id_base ] ) && is_array( $_POST[ 'widget-' . $id_base ] ) && preg_match( '/__i__|%i%/', key( $_POST[ 'widget-' . $id_base ] ) ) ); if ( $is_updating_widget_template ) { wp_send_json_error( 'template_widget_not_updatable' ); } $updated_widget = $this->call_widget_update( $widget_id ); if ( is_wp_error( $updated_widget ) ) { wp_send_json_error( $updated_widget->get_error_code() ); } $form = $updated_widget['form']; $instance = $this->sanitize_widget_js_instance( $updated_widget['instance'], $id_base ); wp_send_json_success( compact( 'form', 'instance' ) ); } public function customize_dynamic_partial_args( $partial_args, $partial_id ) { if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) { return $partial_args; } if ( preg_match( '/^widget\[(?P.+)\]$/', $partial_id, $matches ) ) { if ( false === $partial_args ) { $partial_args = array(); } $partial_args = array_merge( $partial_args, array( 'type' => 'widget', 'render_callback' => array( $this, 'render_widget_partial' ), 'container_inclusive' => true, 'settings' => array( $this->get_setting_id( $matches['widget_id'] ) ), 'capability' => 'edit_theme_options', ) ); } return $partial_args; } public function selective_refresh_init() { if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) { return; } add_filter( 'dynamic_sidebar_params', array( $this, 'filter_dynamic_sidebar_params' ) ); add_filter( 'wp_kses_allowed_html', array( $this, 'filter_wp_kses_allowed_data_attributes' ) ); add_action( 'dynamic_sidebar_before', array( $this, 'start_dynamic_sidebar' ) ); add_action( 'dynamic_sidebar_after', array( $this, 'end_dynamic_sidebar' ) ); } public function filter_dynamic_sidebar_params( $params ) { $sidebar_args = array_merge( array( 'before_widget' => '', 'after_widget' => '', ), $params[0] ); $matches = array(); $is_valid = ( isset( $sidebar_args['id'] ) && is_registered_sidebar( $sidebar_args['id'] ) && ( isset( $this->current_dynamic_sidebar_id_stack[0] ) && $this->current_dynamic_sidebar_id_stack[0] === $sidebar_args['id'] ) && preg_match( '#^<(?P\w+)#', $sidebar_args['before_widget'], $matches ) ); if ( ! $is_valid ) { return $params; } $this->before_widget_tags_seen[ $matches['tag_name'] ] = true; $context = array( 'sidebar_id' => $sidebar_args['id'], ); if ( isset( $this->context_sidebar_instance_number ) ) { $context['sidebar_instance_number'] = $this->context_sidebar_instance_number; } elseif ( isset( $sidebar_args['id'] ) && isset( $this->sidebar_instance_count[ $sidebar_args['id'] ] ) ) { $context['sidebar_instance_number'] = $this->sidebar_instance_count[ $sidebar_args['id'] ]; } $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'widget[' . $sidebar_args['widget_id'] . ']' ) ); $attributes .= ' data-customize-partial-type="widget"'; $attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $context ) ) ); $attributes .= sprintf( ' data-customize-widget-id="%s"', esc_attr( $sidebar_args['widget_id'] ) ); $sidebar_args['before_widget'] = preg_replace( '#^(<\w+)#', '$1 ' . $attributes, $sidebar_args['before_widget'] ); $params[0] = $sidebar_args; return $params; } protected $before_widget_tags_seen = array(); public function filter_wp_kses_allowed_data_attributes( $allowed_html ) { foreach ( array_keys( $this->before_widget_tags_seen ) as $tag_name ) { if ( ! isset( $allowed_html[ $tag_name ] ) ) { $allowed_html[ $tag_name ] = array(); } $allowed_html[ $tag_name ] = array_merge( $allowed_html[ $tag_name ], array_fill_keys( array( 'data-customize-partial-id', 'data-customize-partial-type', 'data-customize-partial-placement-context', 'data-customize-partial-widget-id', 'data-customize-partial-options', ), true ) ); } return $allowed_html; } protected $sidebar_instance_count = array(); protected $context_sidebar_instance_number; protected $current_dynamic_sidebar_id_stack = array(); public function start_dynamic_sidebar( $index ) { array_unshift( $this->current_dynamic_sidebar_id_stack, $index ); if ( ! isset( $this->sidebar_instance_count[ $index ] ) ) { $this->sidebar_instance_count[ $index ] = 0; } $this->sidebar_instance_count[ $index ] += 1; if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { printf( "\n\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] ); } } public function end_dynamic_sidebar( $index ) { array_shift( $this->current_dynamic_sidebar_id_stack ); if ( ! $this->manager->selective_refresh->is_render_partials_request() ) { printf( "\n\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] ); } } protected $rendering_widget_id; protected $rendering_sidebar_id; public function filter_sidebars_widgets_for_rendering_widget( $sidebars_widgets ) { $sidebars_widgets[ $this->rendering_sidebar_id ] = array( $this->rendering_widget_id ); return $sidebars_widgets; } public function render_widget_partial( $partial, $context ) { $id_data = $partial->id_data(); $widget_id = array_shift( $id_data['keys'] ); if ( ! is_array( $context ) || empty( $context['sidebar_id'] ) || ! is_registered_sidebar( $context['sidebar_id'] ) ) { return false; } $this->rendering_sidebar_id = $context['sidebar_id']; if ( isset( $context['sidebar_instance_number'] ) ) { $this->context_sidebar_instance_number = (int) $context['sidebar_instance_number']; } $this->rendering_widget_id = $widget_id; $filter_callback = array( $this, 'filter_sidebars_widgets_for_rendering_widget' ); add_filter( 'sidebars_widgets', $filter_callback, 1000 ); ob_start(); $this->rendering_sidebar_id = $context['sidebar_id']; dynamic_sidebar( $this->rendering_sidebar_id ); $container = ob_get_clean(); remove_filter( 'sidebars_widgets', $filter_callback, 1000 ); $this->context_sidebar_instance_number = null; $this->rendering_sidebar_id = null; $this->rendering_widget_id = null; return $container; } protected $_captured_options = array(); protected $_is_capturing_option_updates = false; protected function is_option_capture_ignored( $option_name ) { return ( 0 === strpos( $option_name, '_transient_' ) ); } protected function get_captured_options() { return $this->_captured_options; } protected function get_captured_option( $option_name, $default_value = false ) { if ( array_key_exists( $option_name, $this->_captured_options ) ) { $value = $this->_captured_options[ $option_name ]; } else { $value = $default_value; } return $value; } protected function count_captured_options() { return count( $this->_captured_options ); } protected function start_capturing_option_updates() { if ( $this->_is_capturing_option_updates ) { return; } $this->_is_capturing_option_updates = true; add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 ); } public function capture_filter_pre_update_option( $new_value, $option_name, $old_value ) { if ( $this->is_option_capture_ignored( $option_name ) ) { return $new_value; } if ( ! isset( $this->_captured_options[ $option_name ] ) ) { add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) ); } $this->_captured_options[ $option_name ] = $new_value; return $old_value; } public function capture_filter_pre_get_option( $value ) { $option_name = preg_replace( '/^pre_option_/', '', current_filter() ); if ( isset( $this->_captured_options[ $option_name ] ) ) { $value = $this->_captured_options[ $option_name ]; $value = apply_filters( 'option_' . $option_name, $value, $option_name ); } return $value; } protected function stop_capturing_option_updates() { if ( ! $this->_is_capturing_option_updates ) { return; } remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10 ); foreach ( array_keys( $this->_captured_options ) as $option_name ) { remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) ); } $this->_captured_options = array(); $this->_is_capturing_option_updates = false; } public function setup_widget_addition_previews() { _deprecated_function( __METHOD__, '4.2.0', 'customize_dynamic_setting_args' ); } public function prepreview_added_sidebars_widgets() { _deprecated_function( __METHOD__, '4.2.0', 'customize_dynamic_setting_args' ); } public function prepreview_added_widget_instance() { _deprecated_function( __METHOD__, '4.2.0', 'customize_dynamic_setting_args' ); } public function remove_prepreview_filters() { _deprecated_function( __METHOD__, '4.2.0', 'customize_dynamic_setting_args' ); } } BUFFER,"integer"); if( !empty($server) ) { if(empty($this->MAILSERVER)) $this->MAILSERVER = $server; } if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; set_time_limit($timeout); } return true; } public function POP3( $server = '', $timeout = '' ) { self::__construct( $server, $timeout ); } function update_timer () { set_time_limit($this->TIMEOUT); return true; } function connect ($server, $port = 110) { if (!isset($port) || !$port) {$port = 110;} if(!empty($this->MAILSERVER)) $server = $this->MAILSERVER; if(empty($server)){ $this->ERROR = "POP3 connect: " . _("No server specified"); unset($this->FP); return false; } $fp = @fsockopen("$server", $port, $errno, $errstr); if(!$fp) { $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; unset($this->FP); return false; } socket_set_blocking($fp,-1); $this->update_timer(); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) error_log("POP3 SEND [connect: $server] GOT [$reply]",0); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; unset($this->FP); return false; } $this->FP = $fp; $this->BANNER = $this->parse_banner($reply); return true; } function user ($user = "") { if( empty($user) ) { $this->ERROR = "POP3 user: " . _("no login ID submitted"); return false; } elseif(!isset($this->FP)) { $this->ERROR = "POP3 user: " . _("connection not established"); return false; } else { $reply = $this->send_cmd("USER $user"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; return false; } else return true; } } function pass ($pass = "") { if(empty($pass)) { $this->ERROR = "POP3 pass: " . _("No password submitted"); return false; } elseif(!isset($this->FP)) { $this->ERROR = "POP3 pass: " . _("connection not established"); return false; } else { $reply = $this->send_cmd("PASS $pass"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]"; $this->quit(); return false; } else { $count = $this->last("count"); $this->COUNT = $count; return $count; } } } function apop ($login,$pass) { if(!isset($this->FP)) { $this->ERROR = "POP3 apop: " . _("No connection to server"); return false; } elseif(!$this->ALLOWAPOP) { $retVal = $this->login($login,$pass); return $retVal; } elseif(empty($login)) { $this->ERROR = "POP3 apop: " . _("No login ID submitted"); return false; } elseif(empty($pass)) { $this->ERROR = "POP3 apop: " . _("No password submitted"); return false; } else { $banner = $this->BANNER; if( (!$banner) or (empty($banner)) ) { $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { $AuthString = $banner; $AuthString .= $pass; $APOPString = md5($AuthString); $cmd = "APOP $login $APOPString"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { $count = $this->last("count"); $this->COUNT = $count; return $count; } } } } function login ($login = "", $pass = "") { if( !isset($this->FP) ) { $this->ERROR = "POP3 login: " . _("No connection to server"); return false; } else { $fp = $this->FP; if( !$this->user( $login ) ) { return false; } else { $count = $this->pass($pass); if( (!$count) || ($count == -1) ) { return false; } else return $count; } } } function top ($msgNum, $numLines = "0") { if(!isset($this->FP)) { $this->ERROR = "POP3 top: " . _("No connection to server"); return false; } $this->update_timer(); $fp = $this->FP; $buffer = $this->BUFFER; $cmd = "TOP $msgNum $numLines"; fwrite($fp, "TOP $msgNum $numLines\r\n"); $reply = fgets($fp, $buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; return false; } $count = 0; $MsgArray = array(); $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { $MsgArray[$count] = $line; $count++; $line = fgets($fp,$buffer); if(empty($line)) { break; } } return $MsgArray; } function pop_list ($msgNum = "") { if(!isset($this->FP)) { $this->ERROR = "POP3 pop_list: " . _("No connection to server"); return false; } $fp = $this->FP; $Total = $this->COUNT; if( (!$Total) or ($Total == -1) ) { return false; } if($Total == 0) { return array("0","0"); } $this->update_timer(); if(!empty($msgNum)) { $cmd = "LIST $msgNum"; fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } list($junk,$num,$size) = preg_split('/\s+/',$reply); return $size; } $cmd = "LIST"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $reply = $this->strip_clf($reply); $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } $MsgArray = array(); $MsgArray[0] = $Total; for($msgC=1;$msgC <= $Total; $msgC++) { if($msgC > $Total) { break; } $line = fgets($fp,$this->BUFFER); $line = $this->strip_clf($line); if(strpos($line, '.') === 0) { $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); return false; } list($thisMsg,$msgSize) = preg_split('/\s+/',$line); settype($thisMsg,"integer"); if($thisMsg != $msgC) { $MsgArray[$msgC] = "deleted"; } else { $MsgArray[$msgC] = $msgSize; } } return $MsgArray; } function get ($msgNum) { if(!isset($this->FP)) { $this->ERROR = "POP3 get: " . _("No connection to server"); return false; } $this->update_timer(); $fp = $this->FP; $buffer = $this->BUFFER; $cmd = "RETR $msgNum"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; return false; } $count = 0; $MsgArray = array(); $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { if ( $line[0] == '.' ) { $line = substr($line,1); } $MsgArray[$count] = $line; $count++; $line = fgets($fp,$buffer); if(empty($line)) { break; } } return $MsgArray; } function last ( $type = "count" ) { $last = -1; if(!isset($this->FP)) { $this->ERROR = "POP3 last: " . _("No connection to server"); return $last; } $reply = $this->send_cmd("STAT"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; return $last; } $Vars = preg_split('/\s+/',$reply); $count = $Vars[1]; $size = $Vars[2]; settype($count,"integer"); settype($size,"integer"); if($type != "count") { return array($count,$size); } return $count; } function reset () { if(!isset($this->FP)) { $this->ERROR = "POP3 reset: " . _("No connection to server"); return false; } $reply = $this->send_cmd("RSET"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; @error_log("POP3 reset: ERROR [$reply]",0); } $this->quit(); return true; } function send_cmd ( $cmd = "" ) { if(!isset($this->FP)) { $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); return false; } if(empty($cmd)) { $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); return ""; } $fp = $this->FP; $buffer = $this->BUFFER; $this->update_timer(); fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } return $reply; } function quit() { if(!isset($this->FP)) { $this->ERROR = "POP3 quit: " . _("connection does not exist"); return false; } $fp = $this->FP; $cmd = "QUIT"; fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } fclose($fp); unset($this->FP); return true; } function popstat () { $PopArray = $this->last("array"); if($PopArray == -1) { return false; } if( (!$PopArray) or (empty($PopArray)) ) { return false; } return $PopArray; } function uidl ($msgNum = "") { if(!isset($this->FP)) { $this->ERROR = "POP3 uidl: " . _("No connection to server"); return false; } $fp = $this->FP; $buffer = $this->BUFFER; if(!empty($msgNum)) { $cmd = "UIDL $msgNum"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); return $myUidl; } else { $this->update_timer(); $UIDLArray = array(); $Total = $this->COUNT; $UIDLArray[0] = $Total; if ($Total < 1) { return $UIDLArray; } $cmd = "UIDL"; fwrite($fp, "UIDL\r\n"); $reply = fgets($fp, $buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } $line = ""; $count = 1; $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { list ($msg,$msgUidl) = preg_split('/\s+/',$line); $msgUidl = $this->strip_clf($msgUidl); if($count == $msg) { $UIDLArray[$msg] = $msgUidl; } else { $UIDLArray[$count] = 'deleted'; } $count++; $line = fgets($fp,$buffer); } } return $UIDLArray; } function delete ($msgNum = "") { if(!isset($this->FP)) { $this->ERROR = "POP3 delete: " . _("No connection to server"); return false; } if(empty($msgNum)) { $this->ERROR = "POP3 delete: " . _("No msg number submitted"); return false; } $reply = $this->send_cmd("DELE $msgNum"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; return false; } return true; } function is_ok ($cmd = "") { if( empty($cmd) ) return false; else return( stripos($cmd, '+OK') !== false ); } function strip_clf ($text = "") { if(empty($text)) return $text; else { $stripped = str_replace(array("\r","\n"),'',$text); return $stripped; } } function parse_banner ( $server_text ) { $outside = true; $banner = ""; $length = strlen($server_text); for($count =0; $count < $length; $count++) { $digit = substr($server_text,$count,1); if(!empty($digit)) { if( (!$outside) && ($digit != '<') && ($digit != '>') ) { $banner .= $digit; } if ($digit == '<') { $outside = false; } if($digit == '>') { $outside = true; } } } $banner = $this->strip_clf($banner); return "<$banner>"; } } if (!function_exists("stripos")) { function stripos($haystack, $needle){ return strpos($haystack, stristr( $haystack, $needle )); } } 'GET', 'timeout' => apply_filters( 'http_request_timeout', 5, $url ), 'redirection' => apply_filters( 'http_request_redirection_count', 5, $url ), 'httpversion' => apply_filters( 'http_request_version', '1.0', $url ), 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ), 'reject_unsafe_urls' => apply_filters( 'http_request_reject_unsafe_urls', false, $url ), 'blocking' => true, 'headers' => array(), 'cookies' => array(), 'body' => null, 'compress' => false, 'decompress' => true, 'sslverify' => true, 'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt', 'stream' => false, 'filename' => null, 'limit_response_size' => null, ); $args = wp_parse_args( $args ); if ( isset( $args['method'] ) && 'HEAD' === $args['method'] ) { $defaults['redirection'] = 0; } $parsed_args = wp_parse_args( $args, $defaults ); $parsed_args = apply_filters( 'http_request_args', $parsed_args, $url ); if ( ! isset( $parsed_args['_redirection'] ) ) { $parsed_args['_redirection'] = $parsed_args['redirection']; } $pre = apply_filters( 'pre_http_request', false, $parsed_args, $url ); if ( false !== $pre ) { return $pre; } if ( function_exists( 'wp_kses_bad_protocol' ) ) { if ( $parsed_args['reject_unsafe_urls'] ) { $url = wp_http_validate_url( $url ); } if ( $url ) { $url = wp_kses_bad_protocol( $url, array( 'http', 'https', 'ssl' ) ); } } $parsed_url = parse_url( $url ); if ( empty( $url ) || empty( $parsed_url['scheme'] ) ) { $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) ); do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); return $response; } if ( $this->block_request( $url ) ) { $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) ); do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); return $response; } if ( $parsed_args['stream'] ) { if ( empty( $parsed_args['filename'] ) ) { $parsed_args['filename'] = get_temp_dir() . basename( $url ); } $parsed_args['blocking'] = true; if ( ! wp_is_writable( dirname( $parsed_args['filename'] ) ) ) { $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); return $response; } } if ( is_null( $parsed_args['headers'] ) ) { $parsed_args['headers'] = array(); } if ( ! is_array( $parsed_args['headers'] ) ) { $processed_headers = WP_Http::processHeaders( $parsed_args['headers'] ); $parsed_args['headers'] = $processed_headers['headers']; } $headers = $parsed_args['headers']; $data = $parsed_args['body']; $type = $parsed_args['method']; $options = array( 'timeout' => $parsed_args['timeout'], 'useragent' => $parsed_args['user-agent'], 'blocking' => $parsed_args['blocking'], 'hooks' => new WP_HTTP_Requests_Hooks( $url, $parsed_args ), ); $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) ); if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) { $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) ); } if ( $parsed_args['stream'] ) { $options['filename'] = $parsed_args['filename']; } if ( empty( $parsed_args['redirection'] ) ) { $options['follow_redirects'] = false; } else { $options['redirects'] = $parsed_args['redirection']; } if ( isset( $parsed_args['limit_response_size'] ) ) { $options['max_bytes'] = $parsed_args['limit_response_size']; } if ( ! empty( $parsed_args['cookies'] ) ) { $options['cookies'] = WP_Http::normalize_cookies( $parsed_args['cookies'] ); } if ( ! $parsed_args['sslverify'] ) { $options['verify'] = false; $options['verifyname'] = false; } else { $options['verify'] = $parsed_args['sslcertificates']; } if ( 'HEAD' !== $type && 'GET' !== $type ) { $options['data_format'] = 'body'; } $options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'], $url ); $proxy = new WP_HTTP_Proxy(); if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { $options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() ); if ( $proxy->use_authentication() ) { $options['proxy']->use_authentication = true; $options['proxy']->user = $proxy->username(); $options['proxy']->pass = $proxy->password(); } } mbstring_binary_safe_encoding(); try { $requests_response = Requests::request( $url, $headers, $data, $type, $options ); $http_response = new WP_HTTP_Requests_Response( $requests_response, $parsed_args['filename'] ); $response = $http_response->to_array(); $response['http_response'] = $http_response; } catch ( Requests_Exception $e ) { $response = new WP_Error( 'http_request_failed', $e->getMessage() ); } reset_mbstring_encoding(); do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); if ( is_wp_error( $response ) ) { return $response; } if ( ! $parsed_args['blocking'] ) { return array( 'headers' => array(), 'body' => '', 'response' => array( 'code' => false, 'message' => false, ), 'cookies' => array(), 'http_response' => null, ); } return apply_filters( 'http_response', $response, $parsed_args, $url ); } public static function normalize_cookies( $cookies ) { $cookie_jar = new Requests_Cookie_Jar(); foreach ( $cookies as $name => $value ) { if ( $value instanceof WP_Http_Cookie ) { $attributes = array_filter( $value->get_attributes(), static function( $attr ) { return null !== $attr; } ); $cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $attributes, array( 'host-only' => $value->host_only ) ); } elseif ( is_scalar( $value ) ) { $cookie_jar[ $name ] = new Requests_Cookie( $name, $value ); } } return $cookie_jar; } public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) { if ( 302 === $original->status_code ) { $options['type'] = Requests::GET; } } public static function validate_redirects( $location ) { if ( ! wp_http_validate_url( $location ) ) { throw new Requests_Exception( __( 'A valid URL was not provided.' ), 'wp_http.redirect_failed_validation' ); } } public function _get_first_available_transport( $args, $url = null ) { $transports = array( 'curl', 'streams' ); $request_order = apply_filters( 'http_api_transports', $transports, $args, $url ); foreach ( $request_order as $transport ) { if ( in_array( $transport, $transports, true ) ) { $transport = ucfirst( $transport ); } $class = 'WP_Http_' . $transport; if ( ! call_user_func( array( $class, 'test' ), $args, $url ) ) { continue; } return $class; } return false; } private function _dispatch_request( $url, $args ) { static $transports = array(); $class = $this->_get_first_available_transport( $args, $url ); if ( ! $class ) { return new WP_Error( 'http_failure', __( 'There are no HTTP transports available which can complete the requested request.' ) ); } if ( empty( $transports[ $class ] ) ) { $transports[ $class ] = new $class; } $response = $transports[ $class ]->request( $url, $args ); do_action( 'http_api_debug', $response, 'response', $class, $args, $url ); if ( is_wp_error( $response ) ) { return $response; } return apply_filters( 'http_response', $response, $args, $url ); } public function post( $url, $args = array() ) { $defaults = array( 'method' => 'POST' ); $parsed_args = wp_parse_args( $args, $defaults ); return $this->request( $url, $parsed_args ); } public function get( $url, $args = array() ) { $defaults = array( 'method' => 'GET' ); $parsed_args = wp_parse_args( $args, $defaults ); return $this->request( $url, $parsed_args ); } public function head( $url, $args = array() ) { $defaults = array( 'method' => 'HEAD' ); $parsed_args = wp_parse_args( $args, $defaults ); return $this->request( $url, $parsed_args ); } public static function processResponse( $response ) { $response = explode( "\r\n\r\n", $response, 2 ); return array( 'headers' => $response[0], 'body' => isset( $response[1] ) ? $response[1] : '', ); } public static function processHeaders( $headers, $url = '' ) { if ( is_string( $headers ) ) { $headers = str_replace( "\r\n", "\n", $headers ); $headers = preg_replace( '/\n[ \t]/', ' ', $headers ); $headers = explode( "\n", $headers ); } $response = array( 'code' => 0, 'message' => '', ); for ( $i = count( $headers ) - 1; $i >= 0; $i-- ) { if ( ! empty( $headers[ $i ] ) && false === strpos( $headers[ $i ], ':' ) ) { $headers = array_splice( $headers, $i ); break; } } $cookies = array(); $newheaders = array(); foreach ( (array) $headers as $tempheader ) { if ( empty( $tempheader ) ) { continue; } if ( false === strpos( $tempheader, ':' ) ) { $stack = explode( ' ', $tempheader, 3 ); $stack[] = ''; list( , $response['code'], $response['message']) = $stack; continue; } list($key, $value) = explode( ':', $tempheader, 2 ); $key = strtolower( $key ); $value = trim( $value ); if ( isset( $newheaders[ $key ] ) ) { if ( ! is_array( $newheaders[ $key ] ) ) { $newheaders[ $key ] = array( $newheaders[ $key ] ); } $newheaders[ $key ][] = $value; } else { $newheaders[ $key ] = $value; } if ( 'set-cookie' === $key ) { $cookies[] = new WP_Http_Cookie( $value, $url ); } } $response['code'] = (int) $response['code']; return array( 'response' => $response, 'headers' => $newheaders, 'cookies' => $cookies, ); } public static function buildCookieHeader( &$r ) { if ( ! empty( $r['cookies'] ) ) { foreach ( $r['cookies'] as $name => $value ) { if ( ! is_object( $value ) ) { $r['cookies'][ $name ] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value, ) ); } } $cookies_header = ''; foreach ( (array) $r['cookies'] as $cookie ) { $cookies_header .= $cookie->getHeaderValue() . '; '; } $cookies_header = substr( $cookies_header, 0, -2 ); $r['headers']['cookie'] = $cookies_header; } } public static function chunkTransferDecode( $body ) { if ( ! preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', trim( $body ) ) ) { return $body; } $parsed_body = ''; $body_original = $body; while ( true ) { $has_chunk = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $body, $match ); if ( ! $has_chunk || empty( $match[1] ) ) { return $body_original; } $length = hexdec( $match[1] ); $chunk_length = strlen( $match[0] ); $parsed_body .= substr( $body, $chunk_length, $length ); $body = substr( $body, $length + $chunk_length ); if ( '0' === trim( $body ) ) { return $parsed_body; } } } public function block_request( $uri ) { if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL ) { return false; } $check = parse_url( $uri ); if ( ! $check ) { return true; } $home = parse_url( get_option( 'siteurl' ) ); if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] === $check['host'] ) ) { return apply_filters( 'block_local_requests', false ); } if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) ) { return true; } static $accessible_hosts = null; static $wildcard_regex = array(); if ( null === $accessible_hosts ) { $accessible_hosts = preg_split( '|,\s*|', WP_ACCESSIBLE_HOSTS ); if ( false !== strpos( WP_ACCESSIBLE_HOSTS, '*' ) ) { $wildcard_regex = array(); foreach ( $accessible_hosts as $host ) { $wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) ); } $wildcard_regex = '/^(' . implode( '|', $wildcard_regex ) . ')$/i'; } } if ( ! empty( $wildcard_regex ) ) { return ! preg_match( $wildcard_regex, $check['host'] ); } else { return ! in_array( $check['host'], $accessible_hosts, true ); } } protected static function parse_url( $url ) { _deprecated_function( __METHOD__, '4.4.0', 'wp_parse_url()' ); return wp_parse_url( $url ); } public static function make_absolute_url( $maybe_relative_path, $url ) { if ( empty( $url ) ) { return $maybe_relative_path; } $url_parts = wp_parse_url( $url ); if ( ! $url_parts ) { return $maybe_relative_path; } $relative_url_parts = wp_parse_url( $maybe_relative_path ); if ( ! $relative_url_parts ) { return $maybe_relative_path; } if ( ! empty( $relative_url_parts['scheme'] ) ) { return $maybe_relative_path; } $absolute_path = $url_parts['scheme'] . '://'; if ( isset( $relative_url_parts['host'] ) ) { $absolute_path .= $relative_url_parts['host']; if ( isset( $relative_url_parts['port'] ) ) { $absolute_path .= ':' . $relative_url_parts['port']; } } else { $absolute_path .= $url_parts['host']; if ( isset( $url_parts['port'] ) ) { $absolute_path .= ':' . $url_parts['port']; } } $path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/'; if ( ! empty( $relative_url_parts['path'] ) && '/' === $relative_url_parts['path'][0] ) { $path = $relative_url_parts['path']; } elseif ( ! empty( $relative_url_parts['path'] ) ) { $path = substr( $path, 0, strrpos( $path, '/' ) + 1 ); $path .= $relative_url_parts['path']; while ( strpos( $path, '../' ) > 1 ) { $path = preg_replace( '![^/]+/\.\./!', '', $path ); } $path = preg_replace( '!^/(\.\./)+!', '', $path ); } if ( ! empty( $relative_url_parts['query'] ) ) { $path .= '?' . $relative_url_parts['query']; } return $absolute_path . '/' . ltrim( $path, '/' ); } public static function handle_redirects( $url, $args, $response ) { if ( ! isset( $response['headers']['location'] ) || 0 === $args['_redirection'] ) { return false; } if ( $response['response']['code'] > 399 || $response['response']['code'] < 300 ) { return false; } if ( $args['redirection']-- <= 0 ) { return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } $redirect_location = $response['headers']['location']; if ( is_array( $redirect_location ) ) { $redirect_location = array_pop( $redirect_location ); } $redirect_location = WP_Http::make_absolute_url( $redirect_location, $url ); if ( 'POST' === $args['method'] ) { if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) { $args['method'] = 'GET'; } } if ( ! empty( $response['cookies'] ) ) { foreach ( $response['cookies'] as $cookie ) { if ( $cookie->test( $redirect_location ) ) { $args['cookies'][] = $cookie; } } } return wp_remote_request( $redirect_location, $args ); } public static function is_ip_address( $maybe_ip ) { if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $maybe_ip ) ) { return 4; } if ( false !== strpos( $maybe_ip, ':' ) && preg_match( '/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i', trim( $maybe_ip, ' []' ) ) ) { return 6; } return false; } } name = $taxonomy; $this->set_props( $object_type, $args ); } public function set_props( $object_type, $args ) { $args = wp_parse_args( $args ); $args = apply_filters( 'register_taxonomy_args', $args, $this->name, (array) $object_type ); $taxonomy = $this->name; $args = apply_filters( "register_{$taxonomy}_taxonomy_args", $args, $this->name, (array) $object_type ); $defaults = array( 'labels' => array(), 'description' => '', 'public' => true, 'publicly_queryable' => null, 'hierarchical' => false, 'show_ui' => null, 'show_in_menu' => null, 'show_in_nav_menus' => null, 'show_tagcloud' => null, 'show_in_quick_edit' => null, 'show_admin_column' => false, 'meta_box_cb' => null, 'meta_box_sanitize_cb' => null, 'capabilities' => array(), 'rewrite' => true, 'query_var' => $this->name, 'update_count_callback' => '', 'show_in_rest' => false, 'rest_base' => false, 'rest_namespace' => false, 'rest_controller_class' => false, 'default_term' => null, 'sort' => null, 'args' => null, '_builtin' => false, ); $args = array_merge( $defaults, $args ); if ( null === $args['publicly_queryable'] ) { $args['publicly_queryable'] = $args['public']; } if ( false !== $args['query_var'] && ( is_admin() || false !== $args['publicly_queryable'] ) ) { if ( true === $args['query_var'] ) { $args['query_var'] = $this->name; } else { $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); } } else { $args['query_var'] = false; } if ( false !== $args['rewrite'] && ( is_admin() || get_option( 'permalink_structure' ) ) ) { $args['rewrite'] = wp_parse_args( $args['rewrite'], array( 'with_front' => true, 'hierarchical' => false, 'ep_mask' => EP_NONE, ) ); if ( empty( $args['rewrite']['slug'] ) ) { $args['rewrite']['slug'] = sanitize_title_with_dashes( $this->name ); } } if ( null === $args['show_ui'] ) { $args['show_ui'] = $args['public']; } if ( null === $args['show_in_menu'] || ! $args['show_ui'] ) { $args['show_in_menu'] = $args['show_ui']; } if ( null === $args['show_in_nav_menus'] ) { $args['show_in_nav_menus'] = $args['public']; } if ( null === $args['show_tagcloud'] ) { $args['show_tagcloud'] = $args['show_ui']; } if ( null === $args['show_in_quick_edit'] ) { $args['show_in_quick_edit'] = $args['show_ui']; } if ( false === $args['rest_namespace'] && ! empty( $args['show_in_rest'] ) ) { $args['rest_namespace'] = 'wp/v2'; } $default_caps = array( 'manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'edit_posts', ); $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); unset( $args['capabilities'] ); $args['object_type'] = array_unique( (array) $object_type ); if ( null === $args['meta_box_cb'] ) { if ( $args['hierarchical'] ) { $args['meta_box_cb'] = 'post_categories_meta_box'; } else { $args['meta_box_cb'] = 'post_tags_meta_box'; } } $args['name'] = $this->name; if ( null === $args['meta_box_sanitize_cb'] ) { switch ( $args['meta_box_cb'] ) { case 'post_categories_meta_box': $args['meta_box_sanitize_cb'] = 'taxonomy_meta_box_sanitize_cb_checkboxes'; break; case 'post_tags_meta_box': default: $args['meta_box_sanitize_cb'] = 'taxonomy_meta_box_sanitize_cb_input'; break; } } if ( ! empty( $args['default_term'] ) ) { if ( ! is_array( $args['default_term'] ) ) { $args['default_term'] = array( 'name' => $args['default_term'] ); } $args['default_term'] = wp_parse_args( $args['default_term'], array( 'name' => '', 'slug' => '', 'description' => '', ) ); } foreach ( $args as $property_name => $property_value ) { $this->$property_name = $property_value; } $this->labels = get_taxonomy_labels( $this ); $this->label = $this->labels->name; } public function add_rewrite_rules() { global $wp; if ( false !== $this->query_var && $wp ) { $wp->add_query_var( $this->query_var ); } if ( false !== $this->rewrite && ( is_admin() || get_option( 'permalink_structure' ) ) ) { if ( $this->hierarchical && $this->rewrite['hierarchical'] ) { $tag = '(.+?)'; } else { $tag = '([^/]+)'; } add_rewrite_tag( "%$this->name%", $tag, $this->query_var ? "{$this->query_var}=" : "taxonomy=$this->name&term=" ); add_permastruct( $this->name, "{$this->rewrite['slug']}/%$this->name%", $this->rewrite ); } } public function remove_rewrite_rules() { global $wp; if ( false !== $this->query_var ) { $wp->remove_query_var( $this->query_var ); } if ( false !== $this->rewrite ) { remove_rewrite_tag( "%$this->name%" ); remove_permastruct( $this->name ); } } public function add_hooks() { add_filter( 'wp_ajax_add-' . $this->name, '_wp_ajax_add_hierarchical_term' ); } public function remove_hooks() { remove_filter( 'wp_ajax_add-' . $this->name, '_wp_ajax_add_hierarchical_term' ); } public function get_rest_controller() { if ( ! $this->show_in_rest ) { return null; } $class = $this->rest_controller_class ? $this->rest_controller_class : WP_REST_Terms_Controller::class; if ( ! class_exists( $class ) ) { return null; } if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) { return null; } if ( ! $this->rest_controller ) { $this->rest_controller = new $class( $this->name ); } if ( ! ( $this->rest_controller instanceof $class ) ) { return null; } return $this->rest_controller; } public static function get_default_labels() { if ( ! empty( self::$default_labels ) ) { return self::$default_labels; } $name_field_description = __( 'The name is how it appears on your site.' ); $slug_field_description = __( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ); $parent_field_description = __( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); $desc_field_description = __( 'The description is not prominent by default; however, some themes may show it.' ); self::$default_labels = array( 'name' => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ), 'singular_name' => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ), 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), 'popular_items' => array( __( 'Popular Tags' ), null ), 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), 'parent_item' => array( null, __( 'Parent Category' ) ), 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), 'name_field_description' => array( $name_field_description, $name_field_description ), 'slug_field_description' => array( $slug_field_description, $slug_field_description ), 'parent_field_description' => array( null, $parent_field_description ), 'desc_field_description' => array( $desc_field_description, $desc_field_description ), 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ), 'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ), 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ), 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ), 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ), 'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ), 'add_or_remove_items' => array( __( 'Add or remove tags' ), null ), 'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ), 'not_found' => array( __( 'No tags found.' ), __( 'No categories found.' ) ), 'no_terms' => array( __( 'No tags' ), __( 'No categories' ) ), 'filter_by_item' => array( null, __( 'Filter by category' ) ), 'items_list_navigation' => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ), 'items_list' => array( __( 'Tags list' ), __( 'Categories list' ) ), 'most_used' => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ), 'back_to_items' => array( __( '← Go to Tags' ), __( '← Go to Categories' ) ), 'item_link' => array( _x( 'Tag Link', 'navigation link block title' ), _x( 'Category Link', 'navigation link block title' ), ), 'item_link_description' => array( _x( 'A link to a tag.', 'navigation link block description' ), _x( 'A link to a category.', 'navigation link block description' ), ), ); return self::$default_labels; } public static function reset_default_labels() { self::$default_labels = array(); } } '; do_action( 'rss_tag_pre', 'rss2' ); ?> - -> - - - <?php wp_title_rss(); ?> - - - - - - - - - - - - - - <?php the_title_rss(); ?> - - - - - - ]]> - - - - - - ]]> - - ]]> - - 0 ) : ?> - ]]> - - ]]> - - - - - - - - - - - - - - - -name = $post_type; $this->set_props( $args ); } public function set_props( $args ) { $args = wp_parse_args( $args ); $args = apply_filters( 'register_post_type_args', $args, $this->name ); $post_type = $this->name; $args = apply_filters( "register_{$post_type}_post_type_args", $args, $this->name ); $has_edit_link = ! empty( $args['_edit_link'] ); $defaults = array( 'labels' => array(), 'description' => '', 'public' => false, 'hierarchical' => false, 'exclude_from_search' => null, 'publicly_queryable' => null, 'show_ui' => null, 'show_in_menu' => null, 'show_in_nav_menus' => null, 'show_in_admin_bar' => null, 'menu_position' => null, 'menu_icon' => null, 'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'has_archive' => false, 'rewrite' => true, 'query_var' => true, 'can_export' => true, 'delete_with_user' => null, 'show_in_rest' => false, 'rest_base' => false, 'rest_namespace' => false, 'rest_controller_class' => false, 'template' => array(), 'template_lock' => false, '_builtin' => false, '_edit_link' => 'post.php?post=%d', ); $args = array_merge( $defaults, $args ); $args['name'] = $this->name; if ( null === $args['publicly_queryable'] ) { $args['publicly_queryable'] = $args['public']; } if ( null === $args['show_ui'] ) { $args['show_ui'] = $args['public']; } if ( false === $args['rest_namespace'] && ! empty( $args['show_in_rest'] ) ) { $args['rest_namespace'] = 'wp/v2'; } if ( null === $args['show_in_menu'] || ! $args['show_ui'] ) { $args['show_in_menu'] = $args['show_ui']; } if ( null === $args['show_in_admin_bar'] ) { $args['show_in_admin_bar'] = (bool) $args['show_in_menu']; } if ( null === $args['show_in_nav_menus'] ) { $args['show_in_nav_menus'] = $args['public']; } if ( null === $args['exclude_from_search'] ) { $args['exclude_from_search'] = ! $args['public']; } if ( empty( $args['capabilities'] ) && null === $args['map_meta_cap'] && in_array( $args['capability_type'], array( 'post', 'page' ), true ) ) { $args['map_meta_cap'] = true; } if ( null === $args['map_meta_cap'] ) { $args['map_meta_cap'] = false; } if ( ! $args['show_ui'] && ! $has_edit_link ) { $args['_edit_link'] = ''; } $this->cap = get_post_type_capabilities( (object) $args ); unset( $args['capabilities'] ); if ( is_array( $args['capability_type'] ) ) { $args['capability_type'] = $args['capability_type'][0]; } if ( false !== $args['query_var'] ) { if ( true === $args['query_var'] ) { $args['query_var'] = $this->name; } else { $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); } } if ( false !== $args['rewrite'] && ( is_admin() || get_option( 'permalink_structure' ) ) ) { if ( ! is_array( $args['rewrite'] ) ) { $args['rewrite'] = array(); } if ( empty( $args['rewrite']['slug'] ) ) { $args['rewrite']['slug'] = $this->name; } if ( ! isset( $args['rewrite']['with_front'] ) ) { $args['rewrite']['with_front'] = true; } if ( ! isset( $args['rewrite']['pages'] ) ) { $args['rewrite']['pages'] = true; } if ( ! isset( $args['rewrite']['feeds'] ) || ! $args['has_archive'] ) { $args['rewrite']['feeds'] = (bool) $args['has_archive']; } if ( ! isset( $args['rewrite']['ep_mask'] ) ) { if ( isset( $args['permalink_epmask'] ) ) { $args['rewrite']['ep_mask'] = $args['permalink_epmask']; } else { $args['rewrite']['ep_mask'] = EP_PERMALINK; } } } foreach ( $args as $property_name => $property_value ) { $this->$property_name = $property_value; } $this->labels = get_post_type_labels( $this ); $this->label = $this->labels->name; } public function add_supports() { if ( ! empty( $this->supports ) ) { foreach ( $this->supports as $feature => $args ) { if ( is_array( $args ) ) { add_post_type_support( $this->name, $feature, $args ); } else { add_post_type_support( $this->name, $args ); } } unset( $this->supports ); } elseif ( false !== $this->supports ) { add_post_type_support( $this->name, array( 'title', 'editor' ) ); } } public function add_rewrite_rules() { global $wp_rewrite, $wp; if ( false !== $this->query_var && $wp && is_post_type_viewable( $this ) ) { $wp->add_query_var( $this->query_var ); } if ( false !== $this->rewrite && ( is_admin() || get_option( 'permalink_structure' ) ) ) { if ( $this->hierarchical ) { add_rewrite_tag( "%$this->name%", '(.+?)', $this->query_var ? "{$this->query_var}=" : "post_type=$this->name&pagename=" ); } else { add_rewrite_tag( "%$this->name%", '([^/]+)', $this->query_var ? "{$this->query_var}=" : "post_type=$this->name&name=" ); } if ( $this->has_archive ) { $archive_slug = true === $this->has_archive ? $this->rewrite['slug'] : $this->has_archive; if ( $this->rewrite['with_front'] ) { $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; } else { $archive_slug = $wp_rewrite->root . $archive_slug; } add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$this->name", 'top' ); if ( $this->rewrite['feeds'] && $wp_rewrite->feeds ) { $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$this->name" . '&feed=$matches[1]', 'top' ); add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$this->name" . '&feed=$matches[1]', 'top' ); } if ( $this->rewrite['pages'] ) { add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$this->name" . '&paged=$matches[1]', 'top' ); } } $permastruct_args = $this->rewrite; $permastruct_args['feed'] = $permastruct_args['feeds']; add_permastruct( $this->name, "{$this->rewrite['slug']}/%$this->name%", $permastruct_args ); } } public function register_meta_boxes() { if ( $this->register_meta_box_cb ) { add_action( 'add_meta_boxes_' . $this->name, $this->register_meta_box_cb, 10, 1 ); } } public function add_hooks() { add_action( 'future_' . $this->name, '_future_post_hook', 5, 2 ); } public function register_taxonomies() { foreach ( $this->taxonomies as $taxonomy ) { register_taxonomy_for_object_type( $taxonomy, $this->name ); } } public function remove_supports() { global $_wp_post_type_features; unset( $_wp_post_type_features[ $this->name ] ); } public function remove_rewrite_rules() { global $wp, $wp_rewrite, $post_type_meta_caps; if ( false !== $this->query_var ) { $wp->remove_query_var( $this->query_var ); } if ( false !== $this->rewrite ) { remove_rewrite_tag( "%$this->name%" ); remove_permastruct( $this->name ); foreach ( $wp_rewrite->extra_rules_top as $regex => $query ) { if ( false !== strpos( $query, "index.php?post_type=$this->name" ) ) { unset( $wp_rewrite->extra_rules_top[ $regex ] ); } } } foreach ( $this->cap as $cap ) { unset( $post_type_meta_caps[ $cap ] ); } } public function unregister_meta_boxes() { if ( $this->register_meta_box_cb ) { remove_action( 'add_meta_boxes_' . $this->name, $this->register_meta_box_cb, 10 ); } } public function unregister_taxonomies() { foreach ( get_object_taxonomies( $this->name ) as $taxonomy ) { unregister_taxonomy_for_object_type( $taxonomy, $this->name ); } } public function remove_hooks() { remove_action( 'future_' . $this->name, '_future_post_hook', 5 ); } public function get_rest_controller() { if ( ! $this->show_in_rest ) { return null; } $class = $this->rest_controller_class ? $this->rest_controller_class : WP_REST_Posts_Controller::class; if ( ! class_exists( $class ) ) { return null; } if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) { return null; } if ( ! $this->rest_controller ) { $this->rest_controller = new $class( $this->name ); } if ( ! ( $this->rest_controller instanceof $class ) ) { return null; } return $this->rest_controller; } public static function get_default_labels() { if ( ! empty( self::$default_labels ) ) { return self::$default_labels; } self::$default_labels = array( 'name' => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ), 'singular_name' => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ), 'add_new' => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ), 'add_new_item' => array( __( 'Add New Post' ), __( 'Add New Page' ) ), 'edit_item' => array( __( 'Edit Post' ), __( 'Edit Page' ) ), 'new_item' => array( __( 'New Post' ), __( 'New Page' ) ), 'view_item' => array( __( 'View Post' ), __( 'View Page' ) ), 'view_items' => array( __( 'View Posts' ), __( 'View Pages' ) ), 'search_items' => array( __( 'Search Posts' ), __( 'Search Pages' ) ), 'not_found' => array( __( 'No posts found.' ), __( 'No pages found.' ) ), 'not_found_in_trash' => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ), 'parent_item_colon' => array( null, __( 'Parent Page:' ) ), 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), 'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ), 'attributes' => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ), 'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ), 'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ), 'featured_image' => array( _x( 'Featured image', 'post' ), _x( 'Featured image', 'page' ) ), 'set_featured_image' => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ), 'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ), 'use_featured_image' => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ), 'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ), 'filter_by_date' => array( __( 'Filter by date' ), __( 'Filter by date' ) ), 'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ), 'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ), 'item_published' => array( __( 'Post published.' ), __( 'Page published.' ) ), 'item_published_privately' => array( __( 'Post published privately.' ), __( 'Page published privately.' ) ), 'item_reverted_to_draft' => array( __( 'Post reverted to draft.' ), __( 'Page reverted to draft.' ) ), 'item_scheduled' => array( __( 'Post scheduled.' ), __( 'Page scheduled.' ) ), 'item_updated' => array( __( 'Post updated.' ), __( 'Page updated.' ) ), 'item_link' => array( _x( 'Post Link', 'navigation link block title' ), _x( 'Page Link', 'navigation link block title' ), ), 'item_link_description' => array( _x( 'A link to a post.', 'navigation link block description' ), _x( 'A link to a page.', 'navigation link block description' ), ), ); return self::$default_labels; } public static function reset_default_labels() { self::$default_labels = array(); } } prefix; self::$back_compat_keys = array( 'user_firstname' => 'first_name', 'user_lastname' => 'last_name', 'user_description' => 'description', 'user_level' => $prefix . 'user_level', $prefix . 'usersettings' => $prefix . 'user-settings', $prefix . 'usersettingstime' => $prefix . 'user-settings-time', ); } if ( $id instanceof WP_User ) { $this->init( $id->data, $site_id ); return; } elseif ( is_object( $id ) ) { $this->init( $id, $site_id ); return; } if ( ! empty( $id ) && ! is_numeric( $id ) ) { $name = $id; $id = 0; } if ( $id ) { $data = self::get_data_by( 'id', $id ); } else { $data = self::get_data_by( 'login', $name ); } if ( $data ) { $this->init( $data, $site_id ); } else { $this->data = new stdClass; } } public function init( $data, $site_id = '' ) { if ( ! isset( $data->ID ) ) { $data->ID = 0; } $this->data = $data; $this->ID = (int) $data->ID; $this->for_site( $site_id ); } public static function get_data_by( $field, $value ) { global $wpdb; if ( 'ID' === $field ) { $field = 'id'; } if ( 'id' === $field ) { if ( ! is_numeric( $value ) ) { return false; } $value = (int) $value; if ( $value < 1 ) { return false; } } else { $value = trim( $value ); } if ( ! $value ) { return false; } switch ( $field ) { case 'id': $user_id = $value; $db_field = 'ID'; break; case 'slug': $user_id = wp_cache_get( $value, 'userslugs' ); $db_field = 'user_nicename'; break; case 'email': $user_id = wp_cache_get( $value, 'useremail' ); $db_field = 'user_email'; break; case 'login': $value = sanitize_user( $value ); $user_id = wp_cache_get( $value, 'userlogins' ); $db_field = 'user_login'; break; default: return false; } if ( false !== $user_id ) { $user = wp_cache_get( $user_id, 'users' ); if ( $user ) { return $user; } } $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE $db_field = %s LIMIT 1", $value ) ); if ( ! $user ) { return false; } update_user_caches( $user ); return $user; } public function __isset( $key ) { if ( 'id' === $key ) { _deprecated_argument( 'WP_User->id', '2.1.0', sprintf( __( 'Use %s instead.' ), 'WP_User->ID' ) ); $key = 'ID'; } if ( isset( $this->data->$key ) ) { return true; } if ( isset( self::$back_compat_keys[ $key ] ) ) { $key = self::$back_compat_keys[ $key ]; } return metadata_exists( 'user', $this->ID, $key ); } public function __get( $key ) { if ( 'id' === $key ) { _deprecated_argument( 'WP_User->id', '2.1.0', sprintf( __( 'Use %s instead.' ), 'WP_User->ID' ) ); return $this->ID; } if ( isset( $this->data->$key ) ) { $value = $this->data->$key; } else { if ( isset( self::$back_compat_keys[ $key ] ) ) { $key = self::$back_compat_keys[ $key ]; } $value = get_user_meta( $this->ID, $key, true ); } if ( $this->filter ) { $value = sanitize_user_field( $key, $value, $this->ID, $this->filter ); } return $value; } public function __set( $key, $value ) { if ( 'id' === $key ) { _deprecated_argument( 'WP_User->id', '2.1.0', sprintf( __( 'Use %s instead.' ), 'WP_User->ID' ) ); $this->ID = $value; return; } $this->data->$key = $value; } public function __unset( $key ) { if ( 'id' === $key ) { _deprecated_argument( 'WP_User->id', '2.1.0', sprintf( __( 'Use %s instead.' ), 'WP_User->ID' ) ); } if ( isset( $this->data->$key ) ) { unset( $this->data->$key ); } if ( isset( self::$back_compat_keys[ $key ] ) ) { unset( self::$back_compat_keys[ $key ] ); } } public function exists() { return ! empty( $this->ID ); } public function get( $key ) { return $this->__get( $key ); } public function has_prop( $key ) { return $this->__isset( $key ); } public function to_array() { return get_object_vars( $this->data ); } public function __call( $name, $arguments ) { if ( '_init_caps' === $name ) { return $this->_init_caps( ...$arguments ); } return false; } protected function _init_caps( $cap_key = '' ) { global $wpdb; _deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' ); if ( empty( $cap_key ) ) { $this->cap_key = $wpdb->get_blog_prefix( $this->site_id ) . 'capabilities'; } else { $this->cap_key = $cap_key; } $this->caps = $this->get_caps_data(); $this->get_role_caps(); } public function get_role_caps() { $switch_site = false; if ( is_multisite() && get_current_blog_id() != $this->site_id ) { $switch_site = true; switch_to_blog( $this->site_id ); } $wp_roles = wp_roles(); if ( is_array( $this->caps ) ) { $this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) ); } $this->allcaps = array(); foreach ( (array) $this->roles as $role ) { $the_role = $wp_roles->get_role( $role ); $this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities ); } $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps ); if ( $switch_site ) { restore_current_blog(); } return $this->allcaps; } public function add_role( $role ) { if ( empty( $role ) ) { return; } if ( in_array( $role, $this->roles, true ) ) { return; } $this->caps[ $role ] = true; update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); do_action( 'add_user_role', $this->ID, $role ); } public function remove_role( $role ) { if ( ! in_array( $role, $this->roles, true ) ) { return; } unset( $this->caps[ $role ] ); update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); do_action( 'remove_user_role', $this->ID, $role ); } public function set_role( $role ) { if ( 1 === count( $this->roles ) && current( $this->roles ) == $role ) { return; } foreach ( (array) $this->roles as $oldrole ) { unset( $this->caps[ $oldrole ] ); } $old_roles = $this->roles; if ( ! empty( $role ) ) { $this->caps[ $role ] = true; $this->roles = array( $role => true ); } else { $this->roles = array(); } update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); foreach ( $old_roles as $old_role ) { if ( ! $old_role || $old_role === $role ) { continue; } do_action( 'remove_user_role', $this->ID, $old_role ); } if ( $role && ! in_array( $role, $old_roles, true ) ) { do_action( 'add_user_role', $this->ID, $role ); } do_action( 'set_user_role', $this->ID, $role, $old_roles ); } public function level_reduction( $max, $item ) { if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) { $level = (int) $matches[1]; return max( $max, $level ); } else { return $max; } } public function update_user_level_from_caps() { global $wpdb; $this->user_level = array_reduce( array_keys( $this->allcaps ), array( $this, 'level_reduction' ), 0 ); update_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level', $this->user_level ); } public function add_cap( $cap, $grant = true ) { $this->caps[ $cap ] = $grant; update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); } public function remove_cap( $cap ) { if ( ! isset( $this->caps[ $cap ] ) ) { return; } unset( $this->caps[ $cap ] ); update_user_meta( $this->ID, $this->cap_key, $this->caps ); $this->get_role_caps(); $this->update_user_level_from_caps(); } public function remove_all_caps() { global $wpdb; $this->caps = array(); delete_user_meta( $this->ID, $this->cap_key ); delete_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level' ); $this->get_role_caps(); } public function has_cap( $cap, ...$args ) { if ( is_numeric( $cap ) ) { _deprecated_argument( __FUNCTION__, '2.0.0', __( 'Usage of user levels is deprecated. Use capabilities instead.' ) ); $cap = $this->translate_level_to_cap( $cap ); } $caps = map_meta_cap( $cap, $this->ID, ...$args ); if ( is_multisite() && is_super_admin( $this->ID ) ) { if ( in_array( 'do_not_allow', $caps, true ) ) { return false; } return true; } $args = array_merge( array( $cap, $this->ID ), $args ); $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this ); $capabilities['exist'] = true; unset( $capabilities['do_not_allow'] ); foreach ( (array) $caps as $cap ) { if ( empty( $capabilities[ $cap ] ) ) { return false; } } return true; } public function translate_level_to_cap( $level ) { return 'level_' . $level; } public function for_blog( $blog_id = '' ) { _deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' ); $this->for_site( $blog_id ); } public function for_site( $site_id = '' ) { global $wpdb; if ( ! empty( $site_id ) ) { $this->site_id = absint( $site_id ); } else { $this->site_id = get_current_blog_id(); } $this->cap_key = $wpdb->get_blog_prefix( $this->site_id ) . 'capabilities'; $this->caps = $this->get_caps_data(); $this->get_role_caps(); } public function get_site_id() { return $this->site_id; } private function get_caps_data() { $caps = get_user_meta( $this->ID, $this->cap_key, true ); if ( ! is_array( $caps ) ) { return array(); } return $caps; } } set_data( $data ); $this->set_status( $status ); $this->set_headers( $headers ); } public function get_headers() { return $this->headers; } public function set_headers( $headers ) { $this->headers = $headers; } public function header( $key, $value, $replace = true ) { if ( $replace || ! isset( $this->headers[ $key ] ) ) { $this->headers[ $key ] = $value; } else { $this->headers[ $key ] .= ', ' . $value; } } public function get_status() { return $this->status; } public function set_status( $code ) { $this->status = absint( $code ); } public function get_data() { return $this->data; } public function set_data( $data ) { $this->data = $data; } public function jsonSerialize() { return $this->get_data(); } } blog_id; $public = $current_blog->public; if ( empty( $current_blog->site_id ) ) { $current_blog->site_id = 1; } $site_id = $current_blog->site_id; wp_load_core_site_options( $site_id ); } $wpdb->set_prefix( $table_prefix, false ); $wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id ); $table_prefix = $wpdb->get_blog_prefix(); $_wp_switched_stack = array(); $switched = false; wp_start_object_cache(); if ( ! $current_site instanceof WP_Network ) { $current_site = new WP_Network( $current_site ); } if ( ! $current_blog instanceof WP_Site ) { $current_blog = new WP_Site( $current_blog ); } ms_upload_constants(); do_action( 'ms_loaded' ); name = $role; $this->capabilities = $capabilities; } public function add_cap( $cap, $grant = true ) { $this->capabilities[ $cap ] = $grant; wp_roles()->add_cap( $this->name, $cap, $grant ); } public function remove_cap( $cap ) { unset( $this->capabilities[ $cap ] ); wp_roles()->remove_cap( $this->name, $cap ); } public function has_cap( $cap ) { $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name ); if ( ! empty( $capabilities[ $cap ] ) ) { return $capabilities[ $cap ]; } else { return false; } } } type = $extension_type; } public function set( $extension, $error ) { if ( ! $this->is_api_loaded() ) { return false; } $option_name = $this->get_option_name(); if ( ! $option_name ) { return false; } $paused_extensions = (array) get_option( $option_name, array() ); if ( isset( $paused_extensions[ $this->type ][ $extension ] ) && $paused_extensions[ $this->type ][ $extension ] === $error ) { return true; } $paused_extensions[ $this->type ][ $extension ] = $error; return update_option( $option_name, $paused_extensions ); } public function delete( $extension ) { if ( ! $this->is_api_loaded() ) { return false; } $option_name = $this->get_option_name(); if ( ! $option_name ) { return false; } $paused_extensions = (array) get_option( $option_name, array() ); if ( ! isset( $paused_extensions[ $this->type ][ $extension ] ) ) { return true; } unset( $paused_extensions[ $this->type ][ $extension ] ); if ( empty( $paused_extensions[ $this->type ] ) ) { unset( $paused_extensions[ $this->type ] ); } if ( ! $paused_extensions ) { return delete_option( $option_name ); } return update_option( $option_name, $paused_extensions ); } public function get( $extension ) { if ( ! $this->is_api_loaded() ) { return null; } $paused_extensions = $this->get_all(); if ( ! isset( $paused_extensions[ $extension ] ) ) { return null; } return $paused_extensions[ $extension ]; } public function get_all() { if ( ! $this->is_api_loaded() ) { return array(); } $option_name = $this->get_option_name(); if ( ! $option_name ) { return array(); } $paused_extensions = (array) get_option( $option_name, array() ); return isset( $paused_extensions[ $this->type ] ) ? $paused_extensions[ $this->type ] : array(); } public function delete_all() { if ( ! $this->is_api_loaded() ) { return false; } $option_name = $this->get_option_name(); if ( ! $option_name ) { return false; } $paused_extensions = (array) get_option( $option_name, array() ); unset( $paused_extensions[ $this->type ] ); if ( ! $paused_extensions ) { return delete_option( $option_name ); } return update_option( $option_name, $paused_extensions ); } protected function is_api_loaded() { return function_exists( 'get_option' ); } protected function get_option_name() { if ( ! wp_recovery_mode()->is_active() ) { return ''; } $session_id = wp_recovery_mode()->get_session_id(); if ( empty( $session_id ) ) { return ''; } return "{$session_id}_paused_extensions"; } } handle, $this->src, $this->deps, $this->ver, $this->args ) = $args; if ( ! is_array( $this->deps ) ) { $this->deps = array(); } } public function add_data( $name, $data ) { if ( ! is_scalar( $name ) ) { return false; } $this->extra[ $name ] = $data; return true; } public function set_translations( $domain, $path = null ) { if ( ! is_string( $domain ) ) { return false; } $this->textdomain = $domain; $this->translations_path = $path; return true; } } 'post_parent', 'id' => 'ID', ); public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { $page = $data_object; $pad = str_repeat( ' ', $depth * 3 ); if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) { $args['value_field'] = 'ID'; } $output .= "\t\n"; } } _x( 'Buttons', 'Block pattern category' ) ) ); register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category' ) ) ); register_block_pattern_category( 'featured', array( 'label' => _x( 'Featured', 'Block pattern category' ) ) ); register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category' ) ) ); register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category' ) ) ); register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category' ) ) ); register_block_pattern_category( 'query', array( 'label' => _x( 'Query', 'Block pattern category' ) ) ); } function _load_remote_block_patterns( $deprecated = null ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '5.9.0' ); $current_screen = $deprecated; if ( ! $current_screen->is_block_editor ) { return; } } $supports_core_patterns = get_theme_support( 'core-block-patterns' ); $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); if ( $supports_core_patterns && $should_load_remote ) { $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); $core_keyword_id = 11; $request->set_param( 'keyword', $core_keyword_id ); $response = rest_do_request( $request ); if ( $response->is_error() ) { return; } $patterns = $response->get_data(); foreach ( $patterns as $settings ) { $pattern_name = 'core/' . sanitize_title( $settings['title'] ); register_block_pattern( $pattern_name, (array) $settings ); } } } function _load_remote_featured_patterns() { $supports_core_patterns = get_theme_support( 'core-block-patterns' ); $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); if ( ! $should_load_remote || ! $supports_core_patterns ) { return; } $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); $featured_cat_id = 26; $request->set_param( 'category', $featured_cat_id ); $response = rest_do_request( $request ); if ( $response->is_error() ) { return; } $patterns = $response->get_data(); foreach ( $patterns as $pattern ) { $pattern_name = sanitize_title( $pattern['title'] ); $registry = WP_Block_Patterns_Registry::get_instance(); $is_registered = $registry->is_registered( $pattern_name ) || $registry->is_registered( "core/$pattern_name" ); if ( ! $is_registered ) { register_block_pattern( $pattern_name, (array) $pattern ); } } } function _register_remote_theme_patterns() { if ( ! get_theme_support( 'core-block-patterns' ) ) { return; } if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) { return; } if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { return; } $pattern_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_patterns(); if ( empty( $pattern_settings ) ) { return; } $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); $request['slug'] = $pattern_settings; $response = rest_do_request( $request ); if ( $response->is_error() ) { return; } $patterns = $response->get_data(); $patterns_registry = WP_Block_Patterns_Registry::get_instance(); foreach ( $patterns as $pattern ) { $pattern_name = sanitize_title( $pattern['title'] ); $is_registered = $patterns_registry->is_registered( $pattern_name ) || $patterns_registry->is_registered( "core/$pattern_name" ); if ( ! $is_registered ) { register_block_pattern( $pattern_name, (array) $pattern ); } } } function _register_theme_block_patterns() { $default_headers = array( 'title' => 'Title', 'slug' => 'Slug', 'description' => 'Description', 'viewportWidth' => 'Viewport Width', 'categories' => 'Categories', 'keywords' => 'Keywords', 'blockTypes' => 'Block Types', 'inserter' => 'Inserter', ); $themes = array(); $stylesheet = get_stylesheet(); $template = get_template(); if ( $stylesheet !== $template ) { $themes[] = wp_get_theme( $stylesheet ); } $themes[] = wp_get_theme( $template ); foreach ( $themes as $theme ) { $dirpath = $theme->get_stylesheet_directory() . '/patterns/'; if ( ! is_dir( $dirpath ) || ! is_readable( $dirpath ) ) { continue; } if ( file_exists( $dirpath ) ) { $files = glob( $dirpath . '*.php' ); if ( $files ) { foreach ( $files as $file ) { $pattern_data = get_file_data( $file, $default_headers ); if ( empty( $pattern_data['slug'] ) ) { _doing_it_wrong( '_register_theme_block_patterns', sprintf( __( 'Could not register file "%s" as a block pattern ("Slug" field missing)' ), $file ), '6.0.0' ); continue; } if ( ! preg_match( '/^[A-z0-9\/_-]+$/', $pattern_data['slug'] ) ) { _doing_it_wrong( '_register_theme_block_patterns', sprintf( __( 'Could not register file "%1$s" as a block pattern (invalid slug "%2$s")' ), $file, $pattern_data['slug'] ), '6.0.0' ); } if ( WP_Block_Patterns_Registry::get_instance()->is_registered( $pattern_data['slug'] ) ) { continue; } if ( ! $pattern_data['title'] ) { _doing_it_wrong( '_register_theme_block_patterns', sprintf( __( 'Could not register file "%s" as a block pattern ("Title" field missing)' ), $file ), '6.0.0' ); continue; } foreach ( array( 'categories', 'keywords', 'blockTypes' ) as $property ) { if ( ! empty( $pattern_data[ $property ] ) ) { $pattern_data[ $property ] = array_filter( preg_split( '/[\s,]+/', (string) $pattern_data[ $property ] ) ); } else { unset( $pattern_data[ $property ] ); } } foreach ( array( 'viewportWidth' ) as $property ) { if ( ! empty( $pattern_data[ $property ] ) ) { $pattern_data[ $property ] = (int) $pattern_data[ $property ]; } else { unset( $pattern_data[ $property ] ); } } foreach ( array( 'inserter' ) as $property ) { if ( ! empty( $pattern_data[ $property ] ) ) { $pattern_data[ $property ] = in_array( strtolower( $pattern_data[ $property ] ), array( 'yes', 'true' ), true ); } else { unset( $pattern_data[ $property ] ); } } $text_domain = $theme->get( 'TextDomain' ); $pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', $text_domain ); if ( ! empty( $pattern_data['description'] ) ) { $pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', $text_domain ); } ob_start(); include $file; $pattern_data['content'] = ob_get_clean(); if ( ! $pattern_data['content'] ) { continue; } register_block_pattern( $pattern_data['slug'], $pattern_data ); } } } } } add_action( 'init', '_register_theme_block_patterns' ); array( 'type' => 'object' ), ); public function __construct( $block_type, $args = array() ) { $this->name = $block_type; $this->set_props( $args ); } public function render( $attributes = array(), $content = '' ) { if ( ! $this->is_dynamic() ) { return ''; } $attributes = $this->prepare_attributes_for_render( $attributes ); return (string) call_user_func( $this->render_callback, $attributes, $content ); } public function is_dynamic() { return is_callable( $this->render_callback ); } public function prepare_attributes_for_render( $attributes ) { if ( ! isset( $this->attributes ) ) { return $attributes; } foreach ( $attributes as $attribute_name => $value ) { if ( ! isset( $this->attributes[ $attribute_name ] ) ) { continue; } $schema = $this->attributes[ $attribute_name ]; $is_valid = rest_validate_value_from_schema( $value, $schema, $attribute_name ); if ( is_wp_error( $is_valid ) ) { unset( $attributes[ $attribute_name ] ); } } $missing_schema_attributes = array_diff_key( $this->attributes, $attributes ); foreach ( $missing_schema_attributes as $attribute_name => $schema ) { if ( isset( $schema['default'] ) ) { $attributes[ $attribute_name ] = $schema['default']; } } return $attributes; } public function set_props( $args ) { $args = wp_parse_args( $args, array( 'render_callback' => null, ) ); $args['name'] = $this->name; if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) { $args['attributes'] = array(); } foreach ( static::GLOBAL_ATTRIBUTES as $attr_key => $attr_schema ) { if ( ! array_key_exists( $attr_key, $args['attributes'] ) ) { $args['attributes'][ $attr_key ] = $attr_schema; } } $args = apply_filters( 'register_block_type_args', $args, $this->name ); foreach ( $args as $property_name => $property_value ) { $this->$property_name = $property_value; } } public function get_attributes() { return is_array( $this->attributes ) ? $this->attributes : array(); } } image instanceof Imagick ) { $this->image->clear(); $this->image->destroy(); } } public static function test( $args = array() ) { if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) ) { return false; } if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) ) { return false; } $required_methods = array( 'clear', 'destroy', 'valid', 'getimage', 'writeimage', 'getimageblob', 'getimagegeometry', 'getimageformat', 'setimageformat', 'setimagecompression', 'setimagecompressionquality', 'setimagepage', 'setoption', 'scaleimage', 'cropimage', 'rotateimage', 'flipimage', 'flopimage', 'readimage', 'readimageblob', ); if ( ! defined( 'imagick::COMPRESSION_JPEG' ) ) { return false; } $class_methods = array_map( 'strtolower', get_class_methods( 'Imagick' ) ); if ( array_diff( $required_methods, $class_methods ) ) { return false; } return true; } public static function supports_mime_type( $mime_type ) { $imagick_extension = strtoupper( self::get_extension( $mime_type ) ); if ( ! $imagick_extension ) { return false; } if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && 'image/jpeg' !== $mime_type ) { return false; } try { return ( (bool) @Imagick::queryFormats( $imagick_extension ) ); } catch ( Exception $e ) { return false; } } public function load() { if ( $this->image instanceof Imagick ) { return true; } if ( ! is_file( $this->file ) && ! wp_is_stream( $this->file ) ) { return new WP_Error( 'error_loading_image', __( 'File does not exist?' ), $this->file ); } wp_raise_memory_limit( 'image' ); try { $this->image = new Imagick(); $file_extension = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) ); if ( 'pdf' === $file_extension ) { $pdf_loaded = $this->pdf_load_source(); if ( is_wp_error( $pdf_loaded ) ) { return $pdf_loaded; } } else { if ( wp_is_stream( $this->file ) ) { $this->image->readImageBlob( file_get_contents( $this->file ), $this->file ); } else { $this->image->readImage( $this->file ); } } if ( ! $this->image->valid() ) { return new WP_Error( 'invalid_image', __( 'File is not an image.' ), $this->file ); } if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) ) { $this->image->setIteratorIndex( 0 ); } $this->mime_type = $this->get_mime_type( $this->image->getImageFormat() ); } catch ( Exception $e ) { return new WP_Error( 'invalid_image', $e->getMessage(), $this->file ); } $updated_size = $this->update_size(); if ( is_wp_error( $updated_size ) ) { return $updated_size; } return $this->set_quality(); } public function set_quality( $quality = null ) { $quality_result = parent::set_quality( $quality ); if ( is_wp_error( $quality_result ) ) { return $quality_result; } else { $quality = $this->get_quality(); } try { switch ( $this->mime_type ) { case 'image/jpeg': $this->image->setImageCompressionQuality( $quality ); $this->image->setImageCompression( imagick::COMPRESSION_JPEG ); break; case 'image/webp': $webp_info = wp_get_webp_info( $this->file ); if ( 'lossless' === $webp_info['type'] ) { $this->image->setImageCompressionQuality( 100 ); $this->image->setOption( 'webp:lossless', 'true' ); } else { $this->image->setImageCompressionQuality( $quality ); } break; default: $this->image->setImageCompressionQuality( $quality ); } } catch ( Exception $e ) { return new WP_Error( 'image_quality_error', $e->getMessage() ); } return true; } protected function update_size( $width = null, $height = null ) { $size = null; if ( ! $width || ! $height ) { try { $size = $this->image->getImageGeometry(); } catch ( Exception $e ) { return new WP_Error( 'invalid_image', __( 'Could not read image size.' ), $this->file ); } } if ( ! $width ) { $width = $size['width']; } if ( ! $height ) { $height = $size['height']; } return parent::update_size( $width, $height ); } public function resize( $max_w, $max_h, $crop = false ) { if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) ) { return true; } $dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $max_w, $max_h, $crop ); if ( ! $dims ) { return new WP_Error( 'error_getting_dimensions', __( 'Could not calculate resized image dimensions' ) ); } list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims; if ( $crop ) { return $this->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h ); } $thumb_result = $this->thumbnail_image( $dst_w, $dst_h ); if ( is_wp_error( $thumb_result ) ) { return $thumb_result; } return $this->update_size( $dst_w, $dst_h ); } protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) { $allowed_filters = array( 'FILTER_POINT', 'FILTER_BOX', 'FILTER_TRIANGLE', 'FILTER_HERMITE', 'FILTER_HANNING', 'FILTER_HAMMING', 'FILTER_BLACKMAN', 'FILTER_GAUSSIAN', 'FILTER_QUADRATIC', 'FILTER_CUBIC', 'FILTER_CATROM', 'FILTER_MITCHELL', 'FILTER_LANCZOS', 'FILTER_BESSEL', 'FILTER_SINC', ); if ( in_array( $filter_name, $allowed_filters, true ) && defined( 'Imagick::' . $filter_name ) ) { $filter = constant( 'Imagick::' . $filter_name ); } else { $filter = defined( 'Imagick::FILTER_TRIANGLE' ) ? Imagick::FILTER_TRIANGLE : false; } if ( apply_filters( 'image_strip_meta', $strip_meta ) ) { $this->strip_meta(); } try { if ( is_callable( array( $this->image, 'sampleImage' ) ) ) { $resize_ratio = ( $dst_w / $this->size['width'] ) * ( $dst_h / $this->size['height'] ); $sample_factor = 5; if ( $resize_ratio < .111 && ( $dst_w * $sample_factor > 128 && $dst_h * $sample_factor > 128 ) ) { $this->image->sampleImage( $dst_w * $sample_factor, $dst_h * $sample_factor ); } } if ( is_callable( array( $this->image, 'resizeImage' ) ) && $filter ) { $this->image->setOption( 'filter:support', '2.0' ); $this->image->resizeImage( $dst_w, $dst_h, $filter, 1 ); } else { $this->image->scaleImage( $dst_w, $dst_h ); } if ( 'image/jpeg' === $this->mime_type ) { if ( is_callable( array( $this->image, 'unsharpMaskImage' ) ) ) { $this->image->unsharpMaskImage( 0.25, 0.25, 8, 0.065 ); } $this->image->setOption( 'jpeg:fancy-upsampling', 'off' ); } if ( 'image/png' === $this->mime_type ) { $this->image->setOption( 'png:compression-filter', '5' ); $this->image->setOption( 'png:compression-level', '9' ); $this->image->setOption( 'png:compression-strategy', '1' ); $this->image->setOption( 'png:exclude-chunk', 'all' ); } if ( is_callable( array( $this->image, 'getImageAlphaChannel' ) ) && is_callable( array( $this->image, 'setImageAlphaChannel' ) ) && defined( 'Imagick::ALPHACHANNEL_UNDEFINED' ) && defined( 'Imagick::ALPHACHANNEL_OPAQUE' ) ) { if ( $this->image->getImageAlphaChannel() === Imagick::ALPHACHANNEL_UNDEFINED ) { $this->image->setImageAlphaChannel( Imagick::ALPHACHANNEL_OPAQUE ); } } if ( is_callable( array( $this->image, 'getImageDepth' ) ) && is_callable( array( $this->image, 'setImageDepth' ) ) ) { if ( 8 < $this->image->getImageDepth() ) { $this->image->setImageDepth( 8 ); } } if ( is_callable( array( $this->image, 'setInterlaceScheme' ) ) && defined( 'Imagick::INTERLACE_NO' ) ) { $this->image->setInterlaceScheme( Imagick::INTERLACE_NO ); } } catch ( Exception $e ) { return new WP_Error( 'image_resize_error', $e->getMessage() ); } } public function multi_resize( $sizes ) { $metadata = array(); foreach ( $sizes as $size => $size_data ) { $meta = $this->make_subsize( $size_data ); if ( ! is_wp_error( $meta ) ) { $metadata[ $size ] = $meta; } } return $metadata; } public function make_subsize( $size_data ) { if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) { return new WP_Error( 'image_subsize_create_error', __( 'Cannot resize the image. Both width and height are not set.' ) ); } $orig_size = $this->size; $orig_image = $this->image->getImage(); if ( ! isset( $size_data['width'] ) ) { $size_data['width'] = null; } if ( ! isset( $size_data['height'] ) ) { $size_data['height'] = null; } if ( ! isset( $size_data['crop'] ) ) { $size_data['crop'] = false; } $resized = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); if ( is_wp_error( $resized ) ) { $saved = $resized; } else { $saved = $this->_save( $this->image ); $this->image->clear(); $this->image->destroy(); $this->image = null; } $this->size = $orig_size; $this->image = $orig_image; if ( ! is_wp_error( $saved ) ) { unset( $saved['path'] ); } return $saved; } public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) { if ( $src_abs ) { $src_w -= $src_x; $src_h -= $src_y; } try { $this->image->cropImage( $src_w, $src_h, $src_x, $src_y ); $this->image->setImagePage( $src_w, $src_h, 0, 0 ); if ( $dst_w || $dst_h ) { if ( ! $dst_w ) { $dst_w = $src_w; } if ( ! $dst_h ) { $dst_h = $src_h; } $thumb_result = $this->thumbnail_image( $dst_w, $dst_h ); if ( is_wp_error( $thumb_result ) ) { return $thumb_result; } return $this->update_size(); } } catch ( Exception $e ) { return new WP_Error( 'image_crop_error', $e->getMessage() ); } return $this->update_size(); } public function rotate( $angle ) { try { $this->image->rotateImage( new ImagickPixel( 'none' ), 360 - $angle ); if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); } $result = $this->update_size(); if ( is_wp_error( $result ) ) { return $result; } $this->image->setImagePage( $this->size['width'], $this->size['height'], 0, 0 ); } catch ( Exception $e ) { return new WP_Error( 'image_rotate_error', $e->getMessage() ); } return true; } public function flip( $horz, $vert ) { try { if ( $horz ) { $this->image->flipImage(); } if ( $vert ) { $this->image->flopImage(); } if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { $this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT ); } } catch ( Exception $e ) { return new WP_Error( 'image_flip_error', $e->getMessage() ); } return true; } public function maybe_exif_rotate() { if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) { return parent::maybe_exif_rotate(); } else { return new WP_Error( 'write_exif_error', __( 'The image cannot be rotated because the embedded meta data cannot be updated.' ) ); } } public function save( $destfilename = null, $mime_type = null ) { $saved = $this->_save( $this->image, $destfilename, $mime_type ); if ( ! is_wp_error( $saved ) ) { $this->file = $saved['path']; $this->mime_type = $saved['mime-type']; try { $this->image->setImageFormat( strtoupper( $this->get_extension( $this->mime_type ) ) ); } catch ( Exception $e ) { return new WP_Error( 'image_save_error', $e->getMessage(), $this->file ); } } return $saved; } protected function _save( $image, $filename = null, $mime_type = null ) { list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type ); if ( ! $filename ) { $filename = $this->generate_filename( null, null, $extension ); } try { $orig_format = $this->image->getImageFormat(); $this->image->setImageFormat( strtoupper( $this->get_extension( $mime_type ) ) ); } catch ( Exception $e ) { return new WP_Error( 'image_save_error', $e->getMessage(), $filename ); } $write_image_result = $this->write_image( $this->image, $filename ); if ( is_wp_error( $write_image_result ) ) { return $write_image_result; } try { $this->image->setImageFormat( $orig_format ); } catch ( Exception $e ) { return new WP_Error( 'image_save_error', $e->getMessage(), $filename ); } $stat = stat( dirname( $filename ) ); $perms = $stat['mode'] & 0000666; chmod( $filename, $perms ); return array( 'path' => $filename, 'file' => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ), 'width' => $this->size['width'], 'height' => $this->size['height'], 'mime-type' => $mime_type, 'filesize' => wp_filesize( $filename ), ); } private function write_image( $image, $filename ) { if ( wp_is_stream( $filename ) ) { if ( file_put_contents( $filename, $image->getImageBlob() ) === false ) { return new WP_Error( 'image_save_error', sprintf( __( '%s failed while writing image to stream.' ), 'file_put_contents()' ), $filename ); } else { return true; } } else { $dirname = dirname( $filename ); if ( ! wp_mkdir_p( $dirname ) ) { return new WP_Error( 'image_save_error', sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $dirname ) ) ); } try { return $image->writeImage( $filename ); } catch ( Exception $e ) { return new WP_Error( 'image_save_error', $e->getMessage(), $filename ); } } } public function stream( $mime_type = null ) { list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type ); try { $this->image->setImageFormat( strtoupper( $extension ) ); header( "Content-Type: $mime_type" ); print $this->image->getImageBlob(); $this->image->setImageFormat( $this->get_extension( $this->mime_type ) ); } catch ( Exception $e ) { return new WP_Error( 'image_stream_error', $e->getMessage() ); } return true; } protected function strip_meta() { if ( ! is_callable( array( $this->image, 'getImageProfiles' ) ) ) { return new WP_Error( 'image_strip_meta_error', sprintf( __( '%s is required to strip image meta.' ), 'Imagick::getImageProfiles()' ) ); } if ( ! is_callable( array( $this->image, 'removeImageProfile' ) ) ) { return new WP_Error( 'image_strip_meta_error', sprintf( __( '%s is required to strip image meta.' ), 'Imagick::removeImageProfile()' ) ); } $protected_profiles = array( 'icc', 'icm', 'iptc', 'exif', 'xmp', ); try { foreach ( $this->image->getImageProfiles( '*', true ) as $key => $value ) { if ( ! in_array( $key, $protected_profiles, true ) ) { $this->image->removeImageProfile( $key ); } } } catch ( Exception $e ) { return new WP_Error( 'image_strip_meta_error', $e->getMessage() ); } return true; } protected function pdf_setup() { try { $this->image->setResolution( 128, 128 ); return $this->file . '[0]'; } catch ( Exception $e ) { return new WP_Error( 'pdf_setup_failed', $e->getMessage(), $this->file ); } } protected function pdf_load_source() { $filename = $this->pdf_setup(); if ( is_wp_error( $filename ) ) { return $filename; } try { $this->image->setOption( 'pdf:use-cropbox', true ); $this->image->readImage( $filename ); } catch ( Exception $e ) { $this->image->setOption( 'pdf:use-cropbox', false ); $this->image->readImage( $filename ); } return true; } } $pattern_name ) ); $this->registered_patterns[ $pattern_name ] = $pattern; if ( current_action() && 'init' !== current_action() ) { $this->registered_patterns_outside_init[ $pattern_name ] = $pattern; } return true; } public function unregister( $pattern_name ) { if ( ! $this->is_registered( $pattern_name ) ) { _doing_it_wrong( __METHOD__, sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ), '5.5.0' ); return false; } unset( $this->registered_patterns[ $pattern_name ] ); unset( $this->registered_patterns_outside_init[ $pattern_name ] ); return true; } public function get_registered( $pattern_name ) { if ( ! $this->is_registered( $pattern_name ) ) { return null; } return $this->registered_patterns[ $pattern_name ]; } public function get_all_registered( $outside_init_only = false ) { return array_values( $outside_init_only ? $this->registered_patterns_outside_init : $this->registered_patterns ); } public function is_registered( $pattern_name ) { return isset( $this->registered_patterns[ $pattern_name ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } function register_block_pattern( $pattern_name, $pattern_properties ) { return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties ); } function unregister_block_pattern( $pattern_name ) { return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name ); } do_items( $handles ); } function wp_add_inline_style( $handle, $data ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); if ( false !== stripos( $data, '' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( __( 'Do not pass %1$s tags to %2$s.' ), '<style>', 'wp_add_inline_style()' ), '3.7.0' ); $data = trim( preg_replace( '#]*>(.*)#is', '$1', $data ) ); } return wp_styles()->add_inline_style( $handle, $data ); } 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 ); } function wp_deregister_style( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_styles()->remove( $handle ); } 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 ); } function wp_dequeue_style( $handle ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); wp_styles()->dequeue( $handle ); } function wp_style_is( $handle, $list = 'enqueued' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); return (bool) wp_styles()->query( $handle, $list ); } function wp_style_add_data( $handle, $key, $value ) { return wp_styles()->add_data( $handle, $key, $value ); } prepare_query( $query ); $this->query(); } } public static function fill_query_vars( $args ) { $defaults = array( 'blog_id' => get_current_blog_id(), 'role' => '', 'role__in' => array(), 'role__not_in' => array(), 'capability' => '', 'capability__in' => array(), 'capability__not_in' => array(), 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'include' => array(), 'exclude' => array(), 'search' => '', 'search_columns' => array(), 'orderby' => 'login', 'order' => 'ASC', 'offset' => '', 'number' => '', 'paged' => 1, 'count_total' => true, 'fields' => 'all', 'who' => '', 'has_published_posts' => null, 'nicename' => '', 'nicename__in' => array(), 'nicename__not_in' => array(), 'login' => '', 'login__in' => array(), 'login__not_in' => array(), ); return wp_parse_args( $args, $defaults ); } public function prepare_query( $query = array() ) { global $wpdb; if ( empty( $this->query_vars ) || ! empty( $query ) ) { $this->query_limit = null; $this->query_vars = $this->fill_query_vars( $query ); } do_action_ref_array( 'pre_get_users', array( &$this ) ); $qv =& $this->query_vars; $qv = $this->fill_query_vars( $qv ); $allowed_fields = array( 'id', 'user_login', 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'user_status', 'display_name', ); if ( is_multisite() ) { $allowed_fields[] = 'spam'; $allowed_fields[] = 'deleted'; } if ( is_array( $qv['fields'] ) ) { $qv['fields'] = array_map( 'strtolower', $qv['fields'] ); $qv['fields'] = array_intersect( array_unique( $qv['fields'] ), $allowed_fields ); if ( empty( $qv['fields'] ) ) { $qv['fields'] = array( 'id' ); } $this->query_fields = array(); foreach ( $qv['fields'] as $field ) { $field = 'id' === $field ? 'ID' : sanitize_key( $field ); $this->query_fields[] = "$wpdb->users.$field"; } $this->query_fields = implode( ',', $this->query_fields ); } elseif ( 'all' === $qv['fields'] ) { $this->query_fields = "$wpdb->users.*"; } elseif ( ! in_array( $qv['fields'], $allowed_fields, true ) ) { $this->query_fields = "$wpdb->users.ID"; } else { $field = 'id' === strtolower( $qv['fields'] ) ? 'ID' : sanitize_key( $qv['fields'] ); $this->query_fields = "$wpdb->users.$field"; } if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields; } $this->query_from = "FROM $wpdb->users"; $this->query_where = 'WHERE 1=1'; if ( ! empty( $qv['include'] ) ) { $include = wp_parse_id_list( $qv['include'] ); } else { $include = false; } $blog_id = 0; if ( isset( $qv['blog_id'] ) ) { $blog_id = absint( $qv['blog_id'] ); } if ( $qv['has_published_posts'] && $blog_id ) { if ( true === $qv['has_published_posts'] ) { $post_types = get_post_types( array( 'public' => true ) ); } else { $post_types = (array) $qv['has_published_posts']; } foreach ( $post_types as &$post_type ) { $post_type = $wpdb->prepare( '%s', $post_type ); } $posts_table = $wpdb->get_blog_prefix( $blog_id ) . 'posts'; $this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( " . implode( ', ', $post_types ) . ' ) )'; } if ( '' !== $qv['nicename'] ) { $this->query_where .= $wpdb->prepare( ' AND user_nicename = %s', $qv['nicename'] ); } if ( ! empty( $qv['nicename__in'] ) ) { $sanitized_nicename__in = array_map( 'esc_sql', $qv['nicename__in'] ); $nicename__in = implode( "','", $sanitized_nicename__in ); $this->query_where .= " AND user_nicename IN ( '$nicename__in' )"; } if ( ! empty( $qv['nicename__not_in'] ) ) { $sanitized_nicename__not_in = array_map( 'esc_sql', $qv['nicename__not_in'] ); $nicename__not_in = implode( "','", $sanitized_nicename__not_in ); $this->query_where .= " AND user_nicename NOT IN ( '$nicename__not_in' )"; } if ( '' !== $qv['login'] ) { $this->query_where .= $wpdb->prepare( ' AND user_login = %s', $qv['login'] ); } if ( ! empty( $qv['login__in'] ) ) { $sanitized_login__in = array_map( 'esc_sql', $qv['login__in'] ); $login__in = implode( "','", $sanitized_login__in ); $this->query_where .= " AND user_login IN ( '$login__in' )"; } if ( ! empty( $qv['login__not_in'] ) ) { $sanitized_login__not_in = array_map( 'esc_sql', $qv['login__not_in'] ); $login__not_in = implode( "','", $sanitized_login__not_in ); $this->query_where .= " AND user_login NOT IN ( '$login__not_in' )"; } $this->meta_query = new WP_Meta_Query(); $this->meta_query->parse_query_vars( $qv ); if ( isset( $qv['who'] ) && 'authors' === $qv['who'] && $blog_id ) { _deprecated_argument( 'WP_User_Query', '5.9.0', sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), 'who', 'capability' ) ); $who_query = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'user_level', 'value' => 0, 'compare' => '!=', ); $qv['blog_id'] = 0; $blog_id = 0; if ( empty( $this->meta_query->queries ) ) { $this->meta_query->queries = array( $who_query ); } else { $this->meta_query->queries = array( 'relation' => 'AND', array( $this->meta_query->queries, $who_query ), ); } $this->meta_query->parse_query_vars( $this->meta_query->queries ); } $roles = array(); if ( isset( $qv['role'] ) ) { if ( is_array( $qv['role'] ) ) { $roles = $qv['role']; } elseif ( is_string( $qv['role'] ) && ! empty( $qv['role'] ) ) { $roles = array_map( 'trim', explode( ',', $qv['role'] ) ); } } $role__in = array(); if ( isset( $qv['role__in'] ) ) { $role__in = (array) $qv['role__in']; } $role__not_in = array(); if ( isset( $qv['role__not_in'] ) ) { $role__not_in = (array) $qv['role__not_in']; } $available_roles = array(); if ( ! empty( $qv['capability'] ) || ! empty( $qv['capability__in'] ) || ! empty( $qv['capability__not_in'] ) ) { global $wp_roles; $wp_roles->for_site( $blog_id ); $available_roles = $wp_roles->roles; } $capabilities = array(); if ( ! empty( $qv['capability'] ) ) { if ( is_array( $qv['capability'] ) ) { $capabilities = $qv['capability']; } elseif ( is_string( $qv['capability'] ) ) { $capabilities = array_map( 'trim', explode( ',', $qv['capability'] ) ); } } $capability__in = array(); if ( ! empty( $qv['capability__in'] ) ) { $capability__in = (array) $qv['capability__in']; } $capability__not_in = array(); if ( ! empty( $qv['capability__not_in'] ) ) { $capability__not_in = (array) $qv['capability__not_in']; } $caps_with_roles = array(); foreach ( $available_roles as $role => $role_data ) { $role_caps = array_keys( array_filter( $role_data['capabilities'] ) ); foreach ( $capabilities as $cap ) { if ( in_array( $cap, $role_caps, true ) ) { $caps_with_roles[ $cap ][] = $role; break; } } foreach ( $capability__in as $cap ) { if ( in_array( $cap, $role_caps, true ) ) { $role__in[] = $role; break; } } foreach ( $capability__not_in as $cap ) { if ( in_array( $cap, $role_caps, true ) ) { $role__not_in[] = $role; break; } } } $role__in = array_merge( $role__in, $capability__in ); $role__not_in = array_merge( $role__not_in, $capability__not_in ); $roles = array_unique( $roles ); $role__in = array_unique( $role__in ); $role__not_in = array_unique( $role__not_in ); if ( $blog_id && ! empty( $capabilities ) ) { $capabilities_clauses = array( 'relation' => 'AND' ); foreach ( $capabilities as $cap ) { $clause = array( 'relation' => 'OR' ); $clause[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'value' => '"' . $cap . '"', 'compare' => 'LIKE', ); if ( ! empty( $caps_with_roles[ $cap ] ) ) { foreach ( $caps_with_roles[ $cap ] as $role ) { $clause[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'value' => '"' . $role . '"', 'compare' => 'LIKE', ); } } $capabilities_clauses[] = $clause; } $role_queries[] = $capabilities_clauses; if ( empty( $this->meta_query->queries ) ) { $this->meta_query->queries[] = $capabilities_clauses; } else { $this->meta_query->queries = array( 'relation' => 'AND', array( $this->meta_query->queries, array( $capabilities_clauses ) ), ); } $this->meta_query->parse_query_vars( $this->meta_query->queries ); } if ( $blog_id && ( ! empty( $roles ) || ! empty( $role__in ) || ! empty( $role__not_in ) || is_multisite() ) ) { $role_queries = array(); $roles_clauses = array( 'relation' => 'AND' ); if ( ! empty( $roles ) ) { foreach ( $roles as $role ) { $roles_clauses[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'value' => '"' . $role . '"', 'compare' => 'LIKE', ); } $role_queries[] = $roles_clauses; } $role__in_clauses = array( 'relation' => 'OR' ); if ( ! empty( $role__in ) ) { foreach ( $role__in as $role ) { $role__in_clauses[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'value' => '"' . $role . '"', 'compare' => 'LIKE', ); } $role_queries[] = $role__in_clauses; } $role__not_in_clauses = array( 'relation' => 'AND' ); if ( ! empty( $role__not_in ) ) { foreach ( $role__not_in as $role ) { $role__not_in_clauses[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'value' => '"' . $role . '"', 'compare' => 'NOT LIKE', ); } $role_queries[] = $role__not_in_clauses; } if ( empty( $role_queries ) ) { $role_queries[] = array( 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 'compare' => 'EXISTS', ); } $role_queries['relation'] = 'AND'; if ( empty( $this->meta_query->queries ) ) { $this->meta_query->queries = $role_queries; } else { $this->meta_query->queries = array( 'relation' => 'AND', array( $this->meta_query->queries, $role_queries ), ); } $this->meta_query->parse_query_vars( $this->meta_query->queries ); } if ( ! empty( $this->meta_query->queries ) ) { $clauses = $this->meta_query->get_sql( 'user', $wpdb->users, 'ID', $this ); $this->query_from .= $clauses['join']; $this->query_where .= $clauses['where']; if ( $this->meta_query->has_or_relation() ) { $this->query_fields = 'DISTINCT ' . $this->query_fields; } } $qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : ''; $order = $this->parse_order( $qv['order'] ); if ( empty( $qv['orderby'] ) ) { $ordersby = array( 'user_login' => $order ); } elseif ( is_array( $qv['orderby'] ) ) { $ordersby = $qv['orderby']; } else { $ordersby = preg_split( '/[,\s]+/', $qv['orderby'] ); } $orderby_array = array(); foreach ( $ordersby as $_key => $_value ) { if ( ! $_value ) { continue; } if ( is_int( $_key ) ) { $_orderby = $_value; $_order = $order; } else { $_orderby = $_key; $_order = $_value; } $parsed = $this->parse_orderby( $_orderby ); if ( ! $parsed ) { continue; } if ( 'nicename__in' === $_orderby || 'login__in' === $_orderby ) { $orderby_array[] = $parsed; } else { $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); } } if ( empty( $orderby_array ) ) { $orderby_array[] = "user_login $order"; } $this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array ); if ( isset( $qv['number'] ) && $qv['number'] > 0 ) { if ( $qv['offset'] ) { $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] ); } else { $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] ); } } $search = ''; if ( isset( $qv['search'] ) ) { $search = trim( $qv['search'] ); } if ( $search ) { $leading_wild = ( ltrim( $search, '*' ) != $search ); $trailing_wild = ( rtrim( $search, '*' ) != $search ); if ( $leading_wild && $trailing_wild ) { $wild = 'both'; } elseif ( $leading_wild ) { $wild = 'leading'; } elseif ( $trailing_wild ) { $wild = 'trailing'; } else { $wild = false; } if ( $wild ) { $search = trim( $search, '*' ); } $search_columns = array(); if ( $qv['search_columns'] ) { $search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename', 'display_name' ) ); } if ( ! $search_columns ) { if ( false !== strpos( $search, '@' ) ) { $search_columns = array( 'user_email' ); } elseif ( is_numeric( $search ) ) { $search_columns = array( 'user_login', 'ID' ); } elseif ( preg_match( '|^https?://|', $search ) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) ) { $search_columns = array( 'user_url' ); } else { $search_columns = array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ); } } $search_columns = apply_filters( 'user_search_columns', $search_columns, $search, $this ); $this->query_where .= $this->get_search_sql( $search, $search_columns, $wild ); } if ( ! empty( $include ) ) { $ids = implode( ',', $include ); $this->query_where .= " AND $wpdb->users.ID IN ($ids)"; } elseif ( ! empty( $qv['exclude'] ) ) { $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)"; } if ( ! empty( $qv['date_query'] ) && is_array( $qv['date_query'] ) ) { $date_query = new WP_Date_Query( $qv['date_query'], 'user_registered' ); $this->query_where .= $date_query->get_sql(); } do_action_ref_array( 'pre_user_query', array( &$this ) ); } public function query() { global $wpdb; $qv =& $this->query_vars; $this->results = apply_filters_ref_array( 'users_pre_query', array( null, &$this ) ); if ( null === $this->results ) { $this->request = " - SELECT {$this->query_fields} - {$this->query_from} - {$this->query_where} - {$this->query_orderby} - {$this->query_limit} - "; if ( is_array( $qv['fields'] ) || 'all' === $qv['fields'] ) { $this->results = $wpdb->get_results( $this->request ); } else { $this->results = $wpdb->get_col( $this->request ); } if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { $found_users_query = apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()', $this ); $this->total_users = (int) $wpdb->get_var( $found_users_query ); } } if ( ! $this->results ) { return; } if ( is_array( $qv['fields'] ) && isset( $this->results[0]->ID ) ) { foreach ( $this->results as $result ) { $result->id = $result->ID; } } elseif ( 'all_with_meta' === $qv['fields'] ) { cache_users( $this->results ); $r = array(); foreach ( $this->results as $userid ) { $r[ $userid ] = new WP_User( $userid, '', $qv['blog_id'] ); } $this->results = $r; } elseif ( 'all' === $qv['fields'] ) { foreach ( $this->results as $key => $user ) { $this->results[ $key ] = new WP_User( $user, '', $qv['blog_id'] ); } } } public function get( $query_var ) { if ( isset( $this->query_vars[ $query_var ] ) ) { return $this->query_vars[ $query_var ]; } return null; } public function set( $query_var, $value ) { $this->query_vars[ $query_var ] = $value; } protected function get_search_sql( $search, $columns, $wild = false ) { global $wpdb; $searches = array(); $leading_wild = ( 'leading' === $wild || 'both' === $wild ) ? '%' : ''; $trailing_wild = ( 'trailing' === $wild || 'both' === $wild ) ? '%' : ''; $like = $leading_wild . $wpdb->esc_like( $search ) . $trailing_wild; foreach ( $columns as $column ) { if ( 'ID' === $column ) { $searches[] = $wpdb->prepare( "$column = %s", $search ); } else { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } } return ' AND (' . implode( ' OR ', $searches ) . ')'; } public function get_results() { return $this->results; } public function get_total() { return $this->total_users; } protected function parse_orderby( $orderby ) { global $wpdb; $meta_query_clauses = $this->meta_query->get_clauses(); $_orderby = ''; if ( in_array( $orderby, array( 'login', 'nicename', 'email', 'url', 'registered' ), true ) ) { $_orderby = 'user_' . $orderby; } elseif ( in_array( $orderby, array( 'user_login', 'user_nicename', 'user_email', 'user_url', 'user_registered' ), true ) ) { $_orderby = $orderby; } elseif ( 'name' === $orderby || 'display_name' === $orderby ) { $_orderby = 'display_name'; } elseif ( 'post_count' === $orderby ) { $where = get_posts_by_author_sql( 'post' ); $this->query_from .= " LEFT OUTER JOIN ( - SELECT post_author, COUNT(*) as post_count - FROM $wpdb->posts - $where - GROUP BY post_author - ) p ON ({$wpdb->users}.ID = p.post_author) - "; $_orderby = 'post_count'; } elseif ( 'ID' === $orderby || 'id' === $orderby ) { $_orderby = 'ID'; } elseif ( 'meta_value' === $orderby || $this->get( 'meta_key' ) == $orderby ) { $_orderby = "$wpdb->usermeta.meta_value"; } elseif ( 'meta_value_num' === $orderby ) { $_orderby = "$wpdb->usermeta.meta_value+0"; } elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) { $include = wp_parse_id_list( $this->query_vars['include'] ); $include_sql = implode( ',', $include ); $_orderby = "FIELD( $wpdb->users.ID, $include_sql )"; } elseif ( 'nicename__in' === $orderby ) { $sanitized_nicename__in = array_map( 'esc_sql', $this->query_vars['nicename__in'] ); $nicename__in = implode( "','", $sanitized_nicename__in ); $_orderby = "FIELD( user_nicename, '$nicename__in' )"; } elseif ( 'login__in' === $orderby ) { $sanitized_login__in = array_map( 'esc_sql', $this->query_vars['login__in'] ); $login__in = implode( "','", $sanitized_login__in ); $_orderby = "FIELD( user_login, '$login__in' )"; } elseif ( isset( $meta_query_clauses[ $orderby ] ) ) { $meta_clause = $meta_query_clauses[ $orderby ]; $_orderby = sprintf( 'CAST(%s.meta_value AS %s)', esc_sql( $meta_clause['alias'] ), esc_sql( $meta_clause['cast'] ) ); } return $_orderby; } protected function parse_order( $order ) { if ( ! is_string( $order ) || empty( $order ) ) { return 'DESC'; } if ( 'ASC' === strtoupper( $order ) ) { return 'ASC'; } else { return 'DESC'; } } public function __get( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } public function __set( $name, $value ) { if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } public function __isset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } } public function __unset( $name ) { if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } public function __call( $name, $arguments ) { if ( 'get_search_sql' === $name ) { return $this->get_search_sql( ...$arguments ); } return false; } } cookie_service = $cookie_service; $this->key_service = $key_service; } public function generate_url() { $token = $this->key_service->generate_recovery_mode_token(); $key = $this->key_service->generate_and_store_recovery_mode_key( $token ); return $this->get_recovery_mode_begin_url( $token, $key ); } public function handle_begin_link( $ttl ) { if ( ! isset( $GLOBALS['pagenow'] ) || 'wp-login.php' !== $GLOBALS['pagenow'] ) { return; } if ( ! isset( $_GET['action'], $_GET['rm_token'], $_GET['rm_key'] ) || self::LOGIN_ACTION_ENTER !== $_GET['action'] ) { return; } if ( ! function_exists( 'wp_generate_password' ) ) { require_once ABSPATH . WPINC . '/pluggable.php'; } $validated = $this->key_service->validate_recovery_mode_key( $_GET['rm_token'], $_GET['rm_key'], $ttl ); if ( is_wp_error( $validated ) ) { wp_die( $validated, '' ); } $this->cookie_service->set_cookie(); $url = add_query_arg( 'action', self::LOGIN_ACTION_ENTERED, wp_login_url() ); wp_redirect( $url ); die; } private function get_recovery_mode_begin_url( $token, $key ) { $url = add_query_arg( array( 'action' => self::LOGIN_ACTION_ENTER, 'rm_token' => $token, 'rm_key' => $key, ), wp_login_url() ); return apply_filters( 'recovery_mode_begin_url', $url, $token, $key ); } } add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version ); } else { $scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce$dev_suffix.js", array(), $tinymce_version ); $scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin$dev_suffix.js", array( 'wp-tinymce-root' ), $tinymce_version ); } $scripts->add( 'wp-tinymce-lists', includes_url( "js/tinymce/plugins/lists/plugin$suffix.js" ), array( 'wp-tinymce' ), $tinymce_version ); } function wp_default_packages_vendor( $scripts ) { global $wp_locale; $suffix = wp_scripts_get_suffix(); $vendor_scripts = array( 'react' => array( 'wp-polyfill' ), 'react-dom' => array( 'react' ), 'regenerator-runtime', 'moment', 'lodash', 'wp-polyfill-fetch', 'wp-polyfill-formdata', 'wp-polyfill-node-contains', 'wp-polyfill-url', 'wp-polyfill-dom-rect', 'wp-polyfill-element-closest', 'wp-polyfill-object-fit', 'wp-polyfill' => array( 'regenerator-runtime' ), ); $vendor_scripts_versions = array( 'react' => '17.0.1', 'react-dom' => '17.0.1', 'regenerator-runtime' => '0.13.9', 'moment' => '2.29.2', 'lodash' => '4.17.19', 'wp-polyfill-fetch' => '3.6.2', 'wp-polyfill-formdata' => '4.0.10', 'wp-polyfill-node-contains' => '4.0.0', 'wp-polyfill-url' => '3.6.4', 'wp-polyfill-dom-rect' => '4.0.0', 'wp-polyfill-element-closest' => '2.0.2', 'wp-polyfill-object-fit' => '2.3.5', 'wp-polyfill' => '3.15.0', ); foreach ( $vendor_scripts as $handle => $dependencies ) { 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 ), 'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ), 'week' => array( 'dow' => (int) get_option( 'start_of_week', 0 ), ), 'longDateFormat' => array( 'LT' => get_option( 'time_format', __( 'g:i a' ) ), 'LTS' => null, 'L' => null, 'LL' => get_option( 'date_format', __( 'F j, Y' ) ), 'LLL' => __( 'F j, Y g:i a' ), 'LLLL' => null, ), ) ) ), 'after' ); } function wp_get_script_polyfill( $scripts, $tests ) { $polyfill = ''; foreach ( $tests as $test => $handle ) { if ( ! array_key_exists( $handle, $scripts->registered ) ) { continue; } $src = $scripts->registered[ $handle ]->src; $ver = $scripts->registered[ $handle ]->ver; if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $scripts->content_url && 0 === strpos( $src, $scripts->content_url ) ) ) { $src = $scripts->base_url . $src; } if ( ! empty( $ver ) ) { $src = add_query_arg( 'ver', $ver, $src ); } $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); if ( ! $src ) { continue; } $polyfill .= ( '( ' . $test . ' ) || ' . 'document.write( \'\n"; } $concat = str_split( $concat, 128 ); $concatenated = ''; foreach ( $concat as $key => $chunk ) { $concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}"; } $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}" . $concatenated . '&ver=' . $wp_scripts->default_version; echo "\n"; } if ( ! empty( $wp_scripts->print_html ) ) { echo $wp_scripts->print_html; } } function wp_print_head_scripts() { global $wp_scripts; if ( ! did_action( 'wp_print_scripts' ) ) { do_action( 'wp_print_scripts' ); } if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { return array(); } return print_head_scripts(); } function _wp_footer_scripts() { print_late_styles(); print_footer_scripts(); } function wp_print_footer_scripts() { do_action( 'wp_print_footer_scripts' ); } function wp_enqueue_scripts() { do_action( 'wp_enqueue_scripts' ); } function print_admin_styles() { global $concatenate_scripts; $wp_styles = wp_styles(); script_concat_settings(); $wp_styles->do_concat = $concatenate_scripts; $wp_styles->do_items( false ); if ( apply_filters( 'print_admin_styles', true ) ) { _print_styles(); } $wp_styles->reset(); return $wp_styles->done; } function print_late_styles() { global $wp_styles, $concatenate_scripts; if ( ! ( $wp_styles instanceof WP_Styles ) ) { return; } script_concat_settings(); $wp_styles->do_concat = $concatenate_scripts; $wp_styles->do_footer_items(); if ( apply_filters( 'print_late_styles', true ) ) { _print_styles(); } $wp_styles->reset(); return $wp_styles->done; } function _print_styles() { global $compress_css; $wp_styles = wp_styles(); $zip = $compress_css ? 1 : 0; if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) { $zip = 'gzip'; } $concat = trim( $wp_styles->concat, ', ' ); $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; if ( $concat ) { $dir = $wp_styles->text_direction; $ver = $wp_styles->default_version; $concat = str_split( $concat, 128 ); $concatenated = ''; foreach ( $concat as $key => $chunk ) { $concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}"; } $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}" . $concatenated . '&ver=' . $ver; echo "\n"; if ( ! empty( $wp_styles->print_code ) ) { echo "\n"; echo $wp_styles->print_code; echo "\n\n"; } } if ( ! empty( $wp_styles->print_html ) ) { echo $wp_styles->print_html; } } function script_concat_settings() { global $concatenate_scripts, $compress_scripts, $compress_css; $compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ); $can_compress_scripts = ! wp_installing() && get_site_option( 'can_compress_scripts' ); if ( ! isset( $concatenate_scripts ) ) { $concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true; if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) { $concatenate_scripts = false; } } if ( ! isset( $compress_scripts ) ) { $compress_scripts = defined( 'COMPRESS_SCRIPTS' ) ? COMPRESS_SCRIPTS : true; if ( $compress_scripts && ( ! $can_compress_scripts || $compressed_output ) ) { $compress_scripts = false; } } if ( ! isset( $compress_css ) ) { $compress_css = defined( 'COMPRESS_CSS' ) ? COMPRESS_CSS : true; if ( $compress_css && ( ! $can_compress_scripts || $compressed_output ) ) { $compress_css = false; } } } function wp_common_block_scripts_and_styles() { if ( is_admin() && ! wp_should_load_block_editor_scripts_and_styles() ) { return; } wp_enqueue_style( 'wp-block-library' ); if ( current_theme_supports( 'wp-block-styles' ) ) { if ( wp_should_load_separate_core_block_assets() ) { $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? 'css' : 'min.css'; $files = glob( __DIR__ . "/blocks/**/theme.$suffix" ); foreach ( $files as $path ) { $block_name = basename( dirname( $path ) ); if ( is_rtl() && file_exists( __DIR__ . "/blocks/$block_name/theme-rtl.$suffix" ) ) { $path = __DIR__ . "/blocks/$block_name/theme-rtl.$suffix"; } wp_add_inline_style( "wp-block-{$block_name}", file_get_contents( $path ) ); } } else { wp_enqueue_style( 'wp-block-library-theme' ); } } do_action( 'enqueue_block_assets' ); } function wp_enqueue_global_styles() { $separate_assets = wp_should_load_separate_core_block_assets(); $is_block_theme = wp_is_block_theme(); $is_classic_theme = ! $is_block_theme; if ( ( $is_block_theme && doing_action( 'wp_footer' ) ) || ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) || ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets ) ) { return; } $stylesheet = wp_get_global_stylesheet(); if ( empty( $stylesheet ) ) { return; } wp_register_style( 'global-styles', false, array(), true, true ); wp_add_inline_style( 'global-styles', $stylesheet ); wp_enqueue_style( 'global-styles' ); } function wp_global_styles_render_svg_filters() { if ( is_admin() && ! get_current_screen()->is_block_editor() ) { return; } $filters = wp_get_global_styles_svg_filters(); if ( ! empty( $filters ) ) { echo $filters; } } function wp_should_load_block_editor_scripts_and_styles() { global $current_screen; $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor(); return apply_filters( 'should_load_block_editor_scripts_and_styles', $is_block_editor_screen ); } function wp_should_load_separate_core_block_assets() { if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { return false; } return apply_filters( 'should_load_separate_core_block_assets', false ); } function wp_enqueue_registered_block_scripts_and_styles() { global $current_screen; if ( wp_should_load_separate_core_block_assets() ) { return; } $load_editor_scripts = is_admin() && wp_should_load_block_editor_scripts_and_styles(); $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) { if ( ! empty( $block_type->style ) ) { wp_enqueue_style( $block_type->style ); } if ( ! empty( $block_type->script ) ) { wp_enqueue_script( $block_type->script ); } if ( $load_editor_scripts && ! empty( $block_type->editor_style ) ) { wp_enqueue_style( $block_type->editor_style ); } if ( $load_editor_scripts && ! empty( $block_type->editor_script ) ) { wp_enqueue_script( $block_type->editor_script ); } } } function enqueue_block_styles_assets() { global $wp_styles; $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered(); foreach ( $block_styles as $block_name => $styles ) { foreach ( $styles as $style_properties ) { if ( isset( $style_properties['style_handle'] ) ) { if ( wp_should_load_separate_core_block_assets() ) { add_filter( 'render_block', function( $html, $block ) use ( $block_name, $style_properties ) { if ( $block['blockName'] === $block_name ) { wp_enqueue_style( $style_properties['style_handle'] ); } return $html; }, 10, 2 ); } else { wp_enqueue_style( $style_properties['style_handle'] ); } } if ( isset( $style_properties['inline_style'] ) ) { $handle = 'wp-block-library'; if ( wp_should_load_separate_core_block_assets() ) { $block_stylesheet_handle = generate_block_asset_handle( $block_name, 'style' ); if ( isset( $wp_styles->registered[ $block_stylesheet_handle ] ) ) { $handle = $block_stylesheet_handle; } } wp_add_inline_style( $handle, $style_properties['inline_style'] ); } } } } function enqueue_editor_block_styles_assets() { $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered(); $register_script_lines = array( '( function() {' ); foreach ( $block_styles as $block_name => $styles ) { foreach ( $styles as $style_properties ) { $block_style = array( 'name' => $style_properties['name'], 'label' => $style_properties['label'], ); if ( isset( $style_properties['is_default'] ) ) { $block_style['isDefault'] = $style_properties['is_default']; } $register_script_lines[] = sprintf( ' wp.blocks.registerBlockStyle( \'%s\', %s );', $block_name, wp_json_encode( $block_style ) ); } } $register_script_lines[] = '} )();'; $inline_script = implode( "\n", $register_script_lines ); wp_register_script( 'wp-block-styles', false, array( 'wp-blocks' ), true, true ); wp_add_inline_script( 'wp-block-styles', $inline_script ); wp_enqueue_script( 'wp-block-styles' ); } function wp_enqueue_editor_block_directory_assets() { wp_enqueue_script( 'wp-block-directory' ); wp_enqueue_style( 'wp-block-directory' ); } function wp_enqueue_editor_format_library_assets() { wp_enqueue_script( 'wp-format-library' ); wp_enqueue_style( 'wp-format-library' ); } function wp_sanitize_script_attributes( $attributes ) { $html5_script_support = ! is_admin() && ! current_theme_supports( 'html5', 'script' ); $attributes_string = ''; foreach ( $attributes as $attribute_name => $attribute_value ) { if ( is_bool( $attribute_value ) ) { if ( $attribute_value ) { $attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . esc_attr( $attribute_name ); } } else { $attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); } } return $attributes_string; } function wp_get_script_tag( $attributes ) { if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { $attributes['type'] = 'text/javascript'; } $attributes = apply_filters( 'wp_script_attributes', $attributes ); return sprintf( "\n", wp_sanitize_script_attributes( $attributes ) ); } function wp_print_script_tag( $attributes ) { echo wp_get_script_tag( $attributes ); } function wp_get_inline_script_tag( $javascript, $attributes = array() ) { if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { $attributes['type'] = 'text/javascript'; } $attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $javascript ); $javascript = "\n" . trim( $javascript, "\n\r " ) . "\n"; return sprintf( "%s\n", wp_sanitize_script_attributes( $attributes ), $javascript ); } function wp_print_inline_script_tag( $javascript, $attributes = array() ) { echo wp_get_inline_script_tag( $javascript, $attributes ); } function wp_maybe_inline_styles() { global $wp_styles; $total_inline_limit = 20000; $total_inline_limit = apply_filters( 'styles_inline_size_limit', $total_inline_limit ); $styles = array(); foreach ( $wp_styles->queue as $handle ) { if ( wp_styles()->get_data( $handle, 'path' ) && file_exists( $wp_styles->registered[ $handle ]->extra['path'] ) ) { $styles[] = array( 'handle' => $handle, 'src' => $wp_styles->registered[ $handle ]->src, 'path' => $wp_styles->registered[ $handle ]->extra['path'], 'size' => filesize( $wp_styles->registered[ $handle ]->extra['path'] ), ); } } if ( ! empty( $styles ) ) { usort( $styles, static function( $a, $b ) { return ( $a['size'] <= $b['size'] ) ? -1 : 1; } ); $total_inline_size = 0; foreach ( $styles as $style ) { if ( $total_inline_size + $style['size'] > $total_inline_limit ) { break; } $style['css'] = file_get_contents( $style['path'] ); $style['css'] = _wp_normalize_relative_css_links( $style['css'], $style['src'] ); $wp_styles->registered[ $style['handle'] ]->src = false; if ( empty( $wp_styles->registered[ $style['handle'] ]->extra['after'] ) ) { $wp_styles->registered[ $style['handle'] ]->extra['after'] = array(); } array_unshift( $wp_styles->registered[ $style['handle'] ]->extra['after'], $style['css'] ); $total_inline_size += (int) $style['size']; } } } function _wp_normalize_relative_css_links( $css, $stylesheet_url ) { $has_src_results = preg_match_all( '#url\s*\(\s*[\'"]?\s*([^\'"\)]+)#', $css, $src_results ); if ( $has_src_results ) { foreach ( $src_results[1] as $src_index => $src_result ) { if ( 0 === strpos( $src_result, 'http' ) || 0 === strpos( $src_result, '//' ) ) { continue; } if ( str_starts_with( $src_result, '#' ) ) { continue; } if ( str_starts_with( $src_result, 'data:' ) ) { continue; } $absolute_url = dirname( $stylesheet_url ) . '/' . $src_result; $absolute_url = str_replace( '/./', '/', $absolute_url ); $relative_url = wp_make_link_relative( $absolute_url ); $css = str_replace( $src_results[0][ $src_index ], str_replace( $src_result, $relative_url, $src_results[0][ $src_index ] ), $css ); } } return $css; } function wp_enqueue_global_styles_css_custom_properties() { wp_register_style( 'global-styles-css-custom-properties', false, array(), true, true ); wp_add_inline_style( 'global-styles-css-custom-properties', wp_get_global_stylesheet( array( 'variables' ) ) ); wp_enqueue_style( 'global-styles-css-custom-properties' ); } function wp_enqueue_block_support_styles( $style ) { $action_hook_name = 'wp_footer'; if ( wp_is_block_theme() ) { $action_hook_name = 'wp_head'; } add_action( $action_hook_name, static function () use ( $style ) { echo "\n"; } ); } function wp_enqueue_block_style( $block_name, $args ) { $args = wp_parse_args( $args, array( 'handle' => '', 'src' => '', 'deps' => array(), 'ver' => false, 'media' => 'all', ) ); $callback = static function( $content ) use ( $args ) { if ( ! empty( $args['src'] ) ) { wp_register_style( $args['handle'], $args['src'], $args['deps'], $args['ver'], $args['media'] ); } if ( isset( $args['path'] ) ) { wp_style_add_data( $args['handle'], 'path', $args['path'] ); $rtl_file_path = str_replace( '.css', '-rtl.css', $args['path'] ); if ( file_exists( $rtl_file_path ) ) { wp_style_add_data( $args['handle'], 'rtl', 'replace' ); if ( is_rtl() ) { wp_style_add_data( $args['handle'], 'path', $rtl_file_path ); } } } wp_enqueue_style( $args['handle'] ); return $content; }; $hook = did_action( 'wp_enqueue_scripts' ) ? 'wp_footer' : 'wp_enqueue_scripts'; if ( wp_should_load_separate_core_block_assets() ) { $callback_separate = static function( $content, $block ) use ( $block_name, $callback ) { if ( ! empty( $block['blockName'] ) && $block_name === $block['blockName'] ) { return $callback( $content ); } return $content; }; add_filter( 'render_block', $callback_separate, 10, 2 ); return; } add_filter( $hook, $callback ); add_action( 'enqueue_block_assets', $callback ); } function _wp_theme_json_webfonts_handler() { if ( wp_installing() ) { return; } $registered_webfonts = array(); $fn_get_webfonts_from_theme_json = static function() { $settings = WP_Theme_JSON_Resolver::get_merged_data()->get_settings(); if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { $variations = WP_Theme_JSON_Resolver::get_style_variations(); foreach ( $variations as $variation ) { if ( empty( $variation['settings']['typography']['fontFamilies'] ) ) { continue; } if ( empty( $settings['typography'] ) ) { $settings['typography'] = array(); } if ( empty( $settings['typography']['fontFamilies'] ) ) { $settings['typography']['fontFamilies'] = array(); } if ( empty( $settings['typography']['fontFamilies']['theme'] ) ) { $settings['typography']['fontFamilies']['theme'] = array(); } $settings['typography']['fontFamilies']['theme'] = array_merge( $settings['typography']['fontFamilies']['theme'], $variation['settings']['typography']['fontFamilies']['theme'] ); $settings['typography']['fontFamilies'] = array_unique( $settings['typography']['fontFamilies'] ); } } if ( empty( $settings['typography']['fontFamilies'] ) ) { return array(); } $webfonts = array(); foreach ( $settings['typography']['fontFamilies'] as $font_families ) { foreach ( $font_families as $font_family ) { if ( empty( $font_family['fontFace'] ) ) { continue; } if ( ! is_array( $font_family['fontFace'] ) ) { continue; } $webfonts = array_merge( $webfonts, $font_family['fontFace'] ); } } return $webfonts; }; $fn_transform_src_into_uri = static function( array $src ) { foreach ( $src as $key => $url ) { if ( ! str_starts_with( $url, 'file:./' ) ) { continue; } $src[ $key ] = get_theme_file_uri( str_replace( 'file:./', '', $url ) ); } return $src; }; $fn_convert_keys_to_kebab_case = static function( array $font_face ) { foreach ( $font_face as $property => $value ) { $kebab_case = _wp_to_kebab_case( $property ); $font_face[ $kebab_case ] = $value; if ( $kebab_case !== $property ) { unset( $font_face[ $property ] ); } } return $font_face; }; $fn_validate_webfont = static function( $webfont ) { $webfont = wp_parse_args( $webfont, array( 'font-family' => '', 'font-style' => 'normal', 'font-weight' => '400', 'font-display' => 'fallback', 'src' => array(), ) ); if ( empty( $webfont['font-family'] ) || ! is_string( $webfont['font-family'] ) ) { trigger_error( __( 'Webfont font family must be a non-empty string.' ) ); return false; } if ( empty( $webfont['src'] ) || ( ! is_string( $webfont['src'] ) && ! is_array( $webfont['src'] ) ) ) { trigger_error( __( 'Webfont src must be a non-empty string or an array of strings.' ) ); return false; } foreach ( (array) $webfont['src'] as $src ) { if ( ! is_string( $src ) || '' === trim( $src ) ) { trigger_error( __( 'Each webfont src must be a non-empty string.' ) ); return false; } } if ( ! is_string( $webfont['font-weight'] ) && ! is_int( $webfont['font-weight'] ) ) { trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.' ) ); return false; } if ( ! in_array( $webfont['font-display'], array( 'auto', 'block', 'fallback', 'swap' ), true ) ) { $webfont['font-display'] = 'fallback'; } $valid_props = array( 'ascend-override', 'descend-override', 'font-display', 'font-family', 'font-stretch', 'font-style', 'font-weight', 'font-variant', 'font-feature-settings', 'font-variation-settings', 'line-gap-override', 'size-adjust', 'src', 'unicode-range', ); foreach ( $webfont as $prop => $value ) { if ( ! in_array( $prop, $valid_props, true ) ) { unset( $webfont[ $prop ] ); } } return $webfont; }; $fn_register_webfonts = static function() use ( &$registered_webfonts, $fn_get_webfonts_from_theme_json, $fn_convert_keys_to_kebab_case, $fn_validate_webfont, $fn_transform_src_into_uri ) { $registered_webfonts = array(); foreach ( $fn_get_webfonts_from_theme_json() as $webfont ) { if ( ! is_array( $webfont ) ) { continue; } $webfont = $fn_convert_keys_to_kebab_case( $webfont ); $webfont = $fn_validate_webfont( $webfont ); $webfont['src'] = $fn_transform_src_into_uri( (array) $webfont['src'] ); if ( empty( $webfont ) ) { continue; } $registered_webfonts[] = $webfont; } }; $fn_order_src = static function( array $webfont ) { $src = array(); $src_ordered = array(); foreach ( $webfont['src'] as $url ) { if ( str_starts_with( trim( $url ), 'data:' ) ) { $src_ordered[] = array( 'url' => $url, 'format' => 'data', ); continue; } $format = pathinfo( $url, PATHINFO_EXTENSION ); $src[ $format ] = $url; } if ( ! empty( $src['woff2'] ) ) { $src_ordered[] = array( 'url' => sanitize_url( $src['woff2'] ), 'format' => 'woff2', ); } if ( ! empty( $src['woff'] ) ) { $src_ordered[] = array( 'url' => sanitize_url( $src['woff'] ), 'format' => 'woff', ); } if ( ! empty( $src['ttf'] ) ) { $src_ordered[] = array( 'url' => sanitize_url( $src['ttf'] ), 'format' => 'truetype', ); } if ( ! empty( $src['eot'] ) ) { $src_ordered[] = array( 'url' => sanitize_url( $src['eot'] ), 'format' => 'embedded-opentype', ); } if ( ! empty( $src['otf'] ) ) { $src_ordered[] = array( 'url' => sanitize_url( $src['otf'] ), 'format' => 'opentype', ); } $webfont['src'] = $src_ordered; return $webfont; }; $fn_compile_src = static function( $font_family, array $value ) { $src = "local($font_family)"; foreach ( $value as $item ) { if ( str_starts_with( $item['url'], site_url() ) || str_starts_with( $item['url'], home_url() ) ) { $item['url'] = wp_make_link_relative( $item['url'] ); } $src .= ( 'data' === $item['format'] ) ? ", url({$item['url']})" : ", url('{$item['url']}') format('{$item['format']}')"; } return $src; }; $fn_compile_variations = static function( array $font_variation_settings ) { $variations = ''; foreach ( $font_variation_settings as $key => $value ) { $variations .= "$key $value"; } return $variations; }; $fn_build_font_face_css = static function( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) { $css = ''; if ( str_contains( $webfont['font-family'], ' ' ) && ! str_contains( $webfont['font-family'], '"' ) && ! str_contains( $webfont['font-family'], "'" ) ) { $webfont['font-family'] = '"' . $webfont['font-family'] . '"'; } foreach ( $webfont as $key => $value ) { if ( 'provider' === $key ) { continue; } if ( 'src' === $key ) { $value = $fn_compile_src( $webfont['font-family'], $value ); } if ( 'font-variation-settings' === $key && is_array( $value ) ) { $value = $fn_compile_variations( $value ); } if ( ! empty( $value ) ) { $css .= "$key:$value;"; } } return $css; }; $fn_get_css = static function() use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) { $css = ''; foreach ( $registered_webfonts as $webfont ) { $webfont = $fn_order_src( $webfont ); $css .= '@font-face{' . $fn_build_font_face_css( $webfont ) . '}'; } return $css; }; $fn_generate_and_enqueue_styles = static function() use ( $fn_get_css ) { $styles = $fn_get_css(); if ( '' === $styles ) { return; } wp_register_style( 'wp-webfonts', '' ); wp_enqueue_style( 'wp-webfonts' ); wp_add_inline_style( 'wp-webfonts', $styles ); }; $fn_generate_and_enqueue_editor_styles = static function() use ( $fn_get_css ) { $styles = $fn_get_css(); if ( '' === $styles ) { return; } wp_add_inline_style( 'wp-block-library', $styles ); }; add_action( 'wp_loaded', $fn_register_webfonts ); add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles ); add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles ); } { - "title": "Style variation name", - "settings": { - "typography": { - "fontSizes": [ - { - "name": "Font size name" - } - ], - "fontFamilies": [ - { - "name": "Font family name" - } - ] - }, - "color": { - "palette": [ - { - "name": "Color name" - } - ], - "gradients": [ - { - "name": "Gradient name" - } - ], - "duotone": [ - { - "name": "Duotone name" - } - ] - }, - "blocks": { - "*": { - "typography": { - "fontSizes": [ - { - "name": "Font size name" - } - ], - "fontFamilies": [ - { - "name": "Font family name" - } - ] - }, - "color": { - "palette": [ - { - "name": "Color name" - } - ], - "gradients": [ - { - "name": "Gradient name" - } - ] - } - } - } - }, - "customTemplates": [ - { - "title": "Custom template name" - } - ], - "templateParts": [ - { - "title": "Template part name" - } - ] -} -image ) { imagedestroy( $this->image ); } } public static function test( $args = array() ) { if ( ! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) ) { return false; } if ( isset( $args['methods'] ) && in_array( 'rotate', $args['methods'], true ) && ! function_exists( 'imagerotate' ) ) { return false; } return true; } public static function supports_mime_type( $mime_type ) { $image_types = imagetypes(); switch ( $mime_type ) { case 'image/jpeg': return ( $image_types & IMG_JPG ) != 0; case 'image/png': return ( $image_types & IMG_PNG ) != 0; case 'image/gif': return ( $image_types & IMG_GIF ) != 0; case 'image/webp': return ( $image_types & IMG_WEBP ) != 0; } return false; } public function load() { if ( $this->image ) { return true; } if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) ) { return new WP_Error( 'error_loading_image', __( 'File does not exist?' ), $this->file ); } wp_raise_memory_limit( 'image' ); $file_contents = @file_get_contents( $this->file ); if ( ! $file_contents ) { return new WP_Error( 'error_loading_image', __( 'File does not exist?' ), $this->file ); } if ( function_exists( 'imagecreatefromwebp' ) && ( 'image/webp' === wp_get_image_mime( $this->file ) ) ) { $this->image = @imagecreatefromwebp( $this->file ); } else { $this->image = @imagecreatefromstring( $file_contents ); } if ( ! is_gd_image( $this->image ) ) { return new WP_Error( 'invalid_image', __( 'File is not an image.' ), $this->file ); } $size = wp_getimagesize( $this->file ); if ( ! $size ) { return new WP_Error( 'invalid_image', __( 'Could not read image size.' ), $this->file ); } if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) { imagealphablending( $this->image, false ); imagesavealpha( $this->image, true ); } $this->update_size( $size[0], $size[1] ); $this->mime_type = $size['mime']; return $this->set_quality(); } protected function update_size( $width = false, $height = false ) { if ( ! $width ) { $width = imagesx( $this->image ); } if ( ! $height ) { $height = imagesy( $this->image ); } return parent::update_size( $width, $height ); } public function resize( $max_w, $max_h, $crop = false ) { if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) ) { return true; } $resized = $this->_resize( $max_w, $max_h, $crop ); if ( is_gd_image( $resized ) ) { imagedestroy( $this->image ); $this->image = $resized; return true; } elseif ( is_wp_error( $resized ) ) { return $resized; } return new WP_Error( 'image_resize_error', __( 'Image resize failed.' ), $this->file ); } protected function _resize( $max_w, $max_h, $crop = false ) { $dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $max_w, $max_h, $crop ); if ( ! $dims ) { return new WP_Error( 'error_getting_dimensions', __( 'Could not calculate resized image dimensions' ), $this->file ); } list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims; $resized = wp_imagecreatetruecolor( $dst_w, $dst_h ); imagecopyresampled( $resized, $this->image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ); if ( is_gd_image( $resized ) ) { $this->update_size( $dst_w, $dst_h ); return $resized; } return new WP_Error( 'image_resize_error', __( 'Image resize failed.' ), $this->file ); } public function multi_resize( $sizes ) { $metadata = array(); foreach ( $sizes as $size => $size_data ) { $meta = $this->make_subsize( $size_data ); if ( ! is_wp_error( $meta ) ) { $metadata[ $size ] = $meta; } } return $metadata; } public function make_subsize( $size_data ) { if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) { return new WP_Error( 'image_subsize_create_error', __( 'Cannot resize the image. Both width and height are not set.' ) ); } $orig_size = $this->size; if ( ! isset( $size_data['width'] ) ) { $size_data['width'] = null; } if ( ! isset( $size_data['height'] ) ) { $size_data['height'] = null; } if ( ! isset( $size_data['crop'] ) ) { $size_data['crop'] = false; } $resized = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); if ( is_wp_error( $resized ) ) { $saved = $resized; } else { $saved = $this->_save( $resized ); imagedestroy( $resized ); } $this->size = $orig_size; if ( ! is_wp_error( $saved ) ) { unset( $saved['path'] ); } return $saved; } public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) { if ( ! $dst_w ) { $dst_w = $src_w; } if ( ! $dst_h ) { $dst_h = $src_h; } foreach ( array( $src_w, $src_h, $dst_w, $dst_h ) as $value ) { if ( ! is_numeric( $value ) || (int) $value <= 0 ) { return new WP_Error( 'image_crop_error', __( 'Image crop failed.' ), $this->file ); } } $dst = wp_imagecreatetruecolor( (int) $dst_w, (int) $dst_h ); if ( $src_abs ) { $src_w -= $src_x; $src_h -= $src_y; } if ( function_exists( 'imageantialias' ) ) { imageantialias( $dst, true ); } imagecopyresampled( $dst, $this->image, 0, 0, (int) $src_x, (int) $src_y, (int) $dst_w, (int) $dst_h, (int) $src_w, (int) $src_h ); if ( is_gd_image( $dst ) ) { imagedestroy( $this->image ); $this->image = $dst; $this->update_size(); return true; } return new WP_Error( 'image_crop_error', __( 'Image crop failed.' ), $this->file ); } public function rotate( $angle ) { if ( function_exists( 'imagerotate' ) ) { $transparency = imagecolorallocatealpha( $this->image, 255, 255, 255, 127 ); $rotated = imagerotate( $this->image, $angle, $transparency ); if ( is_gd_image( $rotated ) ) { imagealphablending( $rotated, true ); imagesavealpha( $rotated, true ); imagedestroy( $this->image ); $this->image = $rotated; $this->update_size(); return true; } } return new WP_Error( 'image_rotate_error', __( 'Image rotate failed.' ), $this->file ); } public function flip( $horz, $vert ) { $w = $this->size['width']; $h = $this->size['height']; $dst = wp_imagecreatetruecolor( $w, $h ); if ( is_gd_image( $dst ) ) { $sx = $vert ? ( $w - 1 ) : 0; $sy = $horz ? ( $h - 1 ) : 0; $sw = $vert ? -$w : $w; $sh = $horz ? -$h : $h; if ( imagecopyresampled( $dst, $this->image, 0, 0, $sx, $sy, $w, $h, $sw, $sh ) ) { imagedestroy( $this->image ); $this->image = $dst; return true; } } return new WP_Error( 'image_flip_error', __( 'Image flip failed.' ), $this->file ); } public function save( $destfilename = null, $mime_type = null ) { $saved = $this->_save( $this->image, $destfilename, $mime_type ); if ( ! is_wp_error( $saved ) ) { $this->file = $saved['path']; $this->mime_type = $saved['mime-type']; } return $saved; } protected function _save( $image, $filename = null, $mime_type = null ) { list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type ); if ( ! $filename ) { $filename = $this->generate_filename( null, null, $extension ); } if ( 'image/gif' === $mime_type ) { if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) ) { return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) ); } } elseif ( 'image/png' === $mime_type ) { if ( function_exists( 'imageistruecolor' ) && ! imageistruecolor( $image ) ) { imagetruecolortopalette( $image, false, imagecolorstotal( $image ) ); } if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) ) { return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) ); } } elseif ( 'image/jpeg' === $mime_type ) { if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, $this->get_quality() ) ) ) { return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) ); } } elseif ( 'image/webp' == $mime_type ) { if ( ! function_exists( 'imagewebp' ) || ! $this->make_image( $filename, 'imagewebp', array( $image, $filename, $this->get_quality() ) ) ) { return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) ); } } else { return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) ); } $stat = stat( dirname( $filename ) ); $perms = $stat['mode'] & 0000666; chmod( $filename, $perms ); return array( 'path' => $filename, 'file' => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ), 'width' => $this->size['width'], 'height' => $this->size['height'], 'mime-type' => $mime_type, 'filesize' => wp_filesize( $filename ), ); } public function stream( $mime_type = null ) { list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type ); switch ( $mime_type ) { case 'image/png': header( 'Content-Type: image/png' ); return imagepng( $this->image ); case 'image/gif': header( 'Content-Type: image/gif' ); return imagegif( $this->image ); case 'image/webp': if ( function_exists( 'imagewebp' ) ) { header( 'Content-Type: image/webp' ); return imagewebp( $this->image, null, $this->get_quality() ); } default: header( 'Content-Type: image/jpeg' ); return imagejpeg( $this->image, null, $this->get_quality() ); } } protected function make_image( $filename, $callback, $arguments ) { if ( wp_is_stream( $filename ) ) { $arguments[1] = null; } return parent::make_image( $filename, $callback, $arguments ); } } $echo, 'aria_label' => '', ); $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'search_form_args', $args ); $args = array_merge( $defaults, $args ); $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; $format = apply_filters( 'search_form_format', $format, $args ); $search_form_template = locate_template( 'searchform.php' ); if ( '' !== $search_form_template ) { ob_start(); require $search_form_template; $form = ob_get_clean(); } else { if ( $args['aria_label'] ) { $aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" '; } else { $aria_label = ''; } if ( 'html5' === $format ) { $form = ''; } else { $form = ''; } } $result = apply_filters( 'get_search_form', $form, $args ); if ( null === $result ) { $result = $form; } if ( $args['echo'] ) { echo $result; } else { return $result; } } function wp_loginout( $redirect = '', $echo = true ) { if ( ! is_user_logged_in() ) { $link = '' . __( 'Log in' ) . ''; } else { $link = '' . __( 'Log out' ) . ''; } if ( $echo ) { echo apply_filters( 'loginout', $link ); } else { return apply_filters( 'loginout', $link ); } } function wp_logout_url( $redirect = '' ) { $args = array(); if ( ! empty( $redirect ) ) { $args['redirect_to'] = urlencode( $redirect ); } $logout_url = add_query_arg( $args, site_url( 'wp-login.php?action=logout', 'login' ) ); $logout_url = wp_nonce_url( $logout_url, 'log-out' ); return apply_filters( 'logout_url', $logout_url, $redirect ); } function wp_login_url( $redirect = '', $force_reauth = false ) { $login_url = site_url( 'wp-login.php', 'login' ); if ( ! empty( $redirect ) ) { $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url ); } if ( $force_reauth ) { $login_url = add_query_arg( 'reauth', '1', $login_url ); } return apply_filters( 'login_url', $login_url, $redirect, $force_reauth ); } function wp_registration_url() { return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) ); } function wp_login_form( $args = array() ) { $defaults = array( 'echo' => true, 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'form_id' => 'loginform', 'label_username' => __( 'Username or Email Address' ), 'label_password' => __( 'Password' ), 'label_remember' => __( 'Remember Me' ), 'label_log_in' => __( 'Log In' ), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => true, 'value_username' => '', 'value_remember' => false, ); $args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) ); $login_form_top = apply_filters( 'login_form_top', '', $args ); $login_form_middle = apply_filters( 'login_form_middle', '', $args ); $login_form_bottom = apply_filters( 'login_form_bottom', '', $args ); $form = sprintf( '
                ', esc_attr( $args['form_id'] ), esc_url( site_url( 'wp-login.php', 'login_post' ) ) ) . $login_form_top . sprintf( '', esc_attr( $args['id_username'] ), esc_html( $args['label_username'] ), esc_attr( $args['value_username'] ) ) . sprintf( '', esc_attr( $args['id_password'] ), esc_html( $args['label_password'] ) ) . $login_form_middle . ( $args['remember'] ? sprintf( '', esc_attr( $args['id_remember'] ), ( $args['value_remember'] ? ' checked="checked"' : '' ), esc_html( $args['label_remember'] ) ) : '' ) . sprintf( '', esc_attr( $args['id_submit'] ), esc_attr( $args['label_log_in'] ), esc_url( $args['redirect'] ) ) . $login_form_bottom . '
                '; if ( $args['echo'] ) { echo $form; } else { return $form; } } function wp_lostpassword_url( $redirect = '' ) { $args = array( 'action' => 'lostpassword', ); if ( ! empty( $redirect ) ) { $args['redirect_to'] = urlencode( $redirect ); } if ( is_multisite() ) { $blog_details = get_blog_details(); $wp_login_path = $blog_details->path . 'wp-login.php'; } else { $wp_login_path = 'wp-login.php'; } $lostpassword_url = add_query_arg( $args, network_site_url( $wp_login_path, 'login' ) ); return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect ); } function wp_register( $before = '
              • ', $after = '
              • ', $echo = true ) { if ( ! is_user_logged_in() ) { if ( get_option( 'users_can_register' ) ) { $link = $before . '' . __( 'Register' ) . '' . $after; } else { $link = ''; } } elseif ( current_user_can( 'read' ) ) { $link = $before . '' . __( 'Site Admin' ) . '' . $after; } else { $link = ''; } $link = apply_filters( 'register', $link ); if ( $echo ) { echo $link; } else { return $link; } } function wp_meta() { do_action( 'wp_meta' ); } function bloginfo( $show = '' ) { echo get_bloginfo( $show, 'display' ); } function get_bloginfo( $show = '', $filter = 'raw' ) { switch ( $show ) { case 'home': case 'siteurl': _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), '' . $show . '', 'bloginfo()', 'url' ) ); case 'url': $output = home_url(); break; case 'wpurl': $output = site_url(); break; case 'description': $output = get_option( 'blogdescription' ); break; case 'rdf_url': $output = get_feed_link( 'rdf' ); break; case 'rss_url': $output = get_feed_link( 'rss' ); break; case 'rss2_url': $output = get_feed_link( 'rss2' ); break; case 'atom_url': $output = get_feed_link( 'atom' ); break; case 'comments_atom_url': $output = get_feed_link( 'comments_atom' ); break; case 'comments_rss2_url': $output = get_feed_link( 'comments_rss2' ); break; case 'pingback_url': $output = site_url( 'xmlrpc.php' ); break; case 'stylesheet_url': $output = get_stylesheet_uri(); break; case 'stylesheet_directory': $output = get_stylesheet_directory_uri(); break; case 'template_directory': case 'template_url': $output = get_template_directory_uri(); break; case 'admin_email': $output = get_option( 'admin_email' ); break; case 'charset': $output = get_option( 'blog_charset' ); if ( '' === $output ) { $output = 'UTF-8'; } break; case 'html_type': $output = get_option( 'html_type' ); break; case 'version': global $wp_version; $output = $wp_version; break; case 'language': $output = __( 'html_lang_attribute' ); if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) { $output = determine_locale(); $output = str_replace( '_', '-', $output ); } break; case 'text_direction': _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), '' . $show . '', 'bloginfo()', 'is_rtl()' ) ); if ( function_exists( 'is_rtl' ) ) { $output = is_rtl() ? 'rtl' : 'ltr'; } else { $output = 'ltr'; } break; case 'name': default: $output = get_option( 'blogname' ); break; } $url = true; if ( strpos( $show, 'url' ) === false && strpos( $show, 'directory' ) === false && strpos( $show, 'home' ) === false ) { $url = false; } if ( 'display' === $filter ) { if ( $url ) { $output = apply_filters( 'bloginfo_url', $output, $show ); } else { $output = apply_filters( 'bloginfo', $output, $show ); } } return $output; } function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $site_icon_id = get_option( 'site_icon' ); if ( $site_icon_id ) { if ( $size >= 512 ) { $size_data = 'full'; } else { $size_data = array( $size, $size ); } $url = wp_get_attachment_image_url( $site_icon_id, $size_data ); } if ( $switched_blog ) { restore_current_blog(); } return apply_filters( 'get_site_icon_url', $url, $size, $blog_id ); } function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { echo esc_url( get_site_icon_url( $size, $url, $blog_id ) ); } function has_site_icon( $blog_id = 0 ) { return (bool) get_site_icon_url( 512, '', $blog_id ); } function has_custom_logo( $blog_id = 0 ) { $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $switched_blog ) { restore_current_blog(); } return (bool) $custom_logo_id; } function get_custom_logo( $blog_id = 0 ) { $html = ''; $switched_blog = false; if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id ) { $custom_logo_attr = array( 'class' => 'custom-logo', 'loading' => false, ); $unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' ); if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) { $custom_logo_attr['alt'] = ''; } else { $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); if ( empty( $image_alt ) ) { $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); } } $custom_logo_attr = apply_filters( 'get_custom_logo_image_attributes', $custom_logo_attr, $custom_logo_id, $blog_id ); $image = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ); if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) { $html = sprintf( '%1$s', $image ); } else { $aria_current = is_front_page() && ! is_paged() ? ' aria-current="page"' : ''; $html = sprintf( '%3$s', esc_url( home_url( '/' ) ), $aria_current, $image ); } } elseif ( is_customize_preview() ) { $html = sprintf( '', esc_url( home_url( '/' ) ) ); } if ( $switched_blog ) { restore_current_blog(); } return apply_filters( 'get_custom_logo', $html, $blog_id ); } function the_custom_logo( $blog_id = 0 ) { echo get_custom_logo( $blog_id ); } function wp_get_document_title() { $title = apply_filters( 'pre_get_document_title', '' ); if ( ! empty( $title ) ) { return $title; } global $page, $paged; $title = array( 'title' => '', ); if ( is_404() ) { $title['title'] = __( 'Page not found' ); } elseif ( is_search() ) { $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); } elseif ( is_front_page() ) { $title['title'] = get_bloginfo( 'name', 'display' ); } elseif ( is_post_type_archive() ) { $title['title'] = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title['title'] = single_term_title( '', false ); } elseif ( is_home() || is_singular() ) { $title['title'] = single_post_title( '', false ); } elseif ( is_category() || is_tag() ) { $title['title'] = single_term_title( '', false ); } elseif ( is_author() && get_queried_object() ) { $author = get_queried_object(); $title['title'] = $author->display_name; } elseif ( is_year() ) { $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); } elseif ( is_month() ) { $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); } elseif ( is_day() ) { $title['title'] = get_the_date(); } if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) ); } if ( is_front_page() ) { $title['tagline'] = get_bloginfo( 'description', 'display' ); } else { $title['site'] = get_bloginfo( 'name', 'display' ); } $sep = apply_filters( 'document_title_separator', '-' ); $title = apply_filters( 'document_title_parts', $title ); $title = implode( " $sep ", array_filter( $title ) ); $title = apply_filters( 'document_title', $title ); return $title; } function _wp_render_title_tag() { if ( ! current_theme_supports( 'title-tag' ) ) { return; } echo '' . wp_get_document_title() . '' . "\n"; } function wp_title( $sep = '»', $display = true, $seplocation = '' ) { global $wp_locale; $m = get_query_var( 'm' ); $year = get_query_var( 'year' ); $monthnum = get_query_var( 'monthnum' ); $day = get_query_var( 'day' ); $search = get_query_var( 's' ); $title = ''; $t_sep = '%WP_TITLE_SEP%'; if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) { $title = single_post_title( '', false ); } if ( is_post_type_archive() ) { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_object = get_post_type_object( $post_type ); if ( ! $post_type_object->has_archive ) { $title = post_type_archive_title( '', false ); } } if ( is_category() || is_tag() ) { $title = single_term_title( '', false ); } if ( is_tax() ) { $term = get_queried_object(); if ( $term ) { $tax = get_taxonomy( $term->taxonomy ); $title = single_term_title( $tax->labels->name . $t_sep, false ); } } if ( is_author() && ! is_post_type_archive() ) { $author = get_queried_object(); if ( $author ) { $title = $author->display_name; } } if ( is_post_type_archive() && $post_type_object->has_archive ) { $title = post_type_archive_title( '', false ); } if ( is_archive() && ! empty( $m ) ) { $my_year = substr( $m, 0, 4 ); $my_month = substr( $m, 4, 2 ); $my_day = (int) substr( $m, 6, 2 ); $title = $my_year . ( $my_month ? $t_sep . $wp_locale->get_month( $my_month ) : '' ) . ( $my_day ? $t_sep . $my_day : '' ); } if ( is_archive() && ! empty( $year ) ) { $title = $year; if ( ! empty( $monthnum ) ) { $title .= $t_sep . $wp_locale->get_month( $monthnum ); } if ( ! empty( $day ) ) { $title .= $t_sep . zeroise( $day, 2 ); } } if ( is_search() ) { $title = sprintf( __( 'Search Results %1$s %2$s' ), $t_sep, strip_tags( $search ) ); } if ( is_404() ) { $title = __( 'Page not found' ); } $prefix = ''; if ( ! empty( $title ) ) { $prefix = " $sep "; } $title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) ); if ( 'right' === $seplocation ) { $title_array = array_reverse( $title_array ); $title = implode( " $sep ", $title_array ) . $prefix; } else { $title = $prefix . implode( " $sep ", $title_array ); } $title = apply_filters( 'wp_title', $title, $sep, $seplocation ); if ( $display ) { echo $title; } else { return $title; } } function single_post_title( $prefix = '', $display = true ) { $_post = get_queried_object(); if ( ! isset( $_post->post_title ) ) { return; } $title = apply_filters( 'single_post_title', $_post->post_title, $_post ); if ( $display ) { echo $prefix . $title; } else { return $prefix . $title; } } function post_type_archive_title( $prefix = '', $display = true ) { if ( ! is_post_type_archive() ) { return; } $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_obj = get_post_type_object( $post_type ); $title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type ); if ( $display ) { echo $prefix . $title; } else { return $prefix . $title; } } function single_cat_title( $prefix = '', $display = true ) { return single_term_title( $prefix, $display ); } function single_tag_title( $prefix = '', $display = true ) { return single_term_title( $prefix, $display ); } function single_term_title( $prefix = '', $display = true ) { $term = get_queried_object(); if ( ! $term ) { return; } if ( is_category() ) { $term_name = apply_filters( 'single_cat_title', $term->name ); } elseif ( is_tag() ) { $term_name = apply_filters( 'single_tag_title', $term->name ); } elseif ( is_tax() ) { $term_name = apply_filters( 'single_term_title', $term->name ); } else { return; } if ( empty( $term_name ) ) { return; } if ( $display ) { echo $prefix . $term_name; } else { return $prefix . $term_name; } } function single_month_title( $prefix = '', $display = true ) { global $wp_locale; $m = get_query_var( 'm' ); $year = get_query_var( 'year' ); $monthnum = get_query_var( 'monthnum' ); if ( ! empty( $monthnum ) && ! empty( $year ) ) { $my_year = $year; $my_month = $wp_locale->get_month( $monthnum ); } elseif ( ! empty( $m ) ) { $my_year = substr( $m, 0, 4 ); $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); } if ( empty( $my_month ) ) { return false; } $result = $prefix . $my_month . $prefix . $my_year; if ( ! $display ) { return $result; } echo $result; } function the_archive_title( $before = '', $after = '' ) { $title = get_the_archive_title(); if ( ! empty( $title ) ) { echo $before . $title . $after; } } function get_the_archive_title() { $title = __( 'Archives' ); $prefix = ''; if ( is_category() ) { $title = single_cat_title( '', false ); $prefix = _x( 'Category:', 'category archive title prefix' ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); $prefix = _x( 'Tag:', 'tag archive title prefix' ); } elseif ( is_author() ) { $title = get_the_author(); $prefix = _x( 'Author:', 'author archive title prefix' ); } elseif ( is_year() ) { $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); $prefix = _x( 'Year:', 'date archive title prefix' ); } elseif ( is_month() ) { $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); $prefix = _x( 'Month:', 'date archive title prefix' ); } elseif ( is_day() ) { $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); $prefix = _x( 'Day:', 'date archive title prefix' ); } elseif ( is_tax( 'post_format' ) ) { if ( is_tax( 'post_format', 'post-format-aside' ) ) { $title = _x( 'Asides', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { $title = _x( 'Galleries', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { $title = _x( 'Images', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { $title = _x( 'Videos', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { $title = _x( 'Quotes', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { $title = _x( 'Links', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { $title = _x( 'Statuses', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { $title = _x( 'Audio', 'post format archive title' ); } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { $title = _x( 'Chats', 'post format archive title' ); } } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); $prefix = _x( 'Archives:', 'post type archive title prefix' ); } elseif ( is_tax() ) { $queried_object = get_queried_object(); if ( $queried_object ) { $tax = get_taxonomy( $queried_object->taxonomy ); $title = single_term_title( '', false ); $prefix = sprintf( _x( '%s:', 'taxonomy term archive title prefix' ), $tax->labels->singular_name ); } } $original_title = $title; $prefix = apply_filters( 'get_the_archive_title_prefix', $prefix ); if ( $prefix ) { $title = sprintf( _x( '%1$s %2$s', 'archive title' ), $prefix, '' . $title . '' ); } return apply_filters( 'get_the_archive_title', $title, $original_title, $prefix ); } function the_archive_description( $before = '', $after = '' ) { $description = get_the_archive_description(); if ( $description ) { echo $before . $description . $after; } } function get_the_archive_description() { if ( is_author() ) { $description = get_the_author_meta( 'description' ); } elseif ( is_post_type_archive() ) { $description = get_the_post_type_description(); } else { $description = term_description(); } return apply_filters( 'get_the_archive_description', $description ); } function get_the_post_type_description() { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_obj = get_post_type_object( $post_type ); if ( isset( $post_type_obj->description ) ) { $description = $post_type_obj->description; } else { $description = ''; } return apply_filters( 'get_the_post_type_description', $description, $post_type_obj ); } function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) { $text = wptexturize( $text ); $url = esc_url( $url ); $aria_current = $selected ? ' aria-current="page"' : ''; if ( 'link' === $format ) { $link_html = "\t\n"; } elseif ( 'option' === $format ) { $selected_attr = $selected ? " selected='selected'" : ''; $link_html = "\t\n"; } elseif ( 'html' === $format ) { $link_html = "\t
              • $before$text$after
              • \n"; } else { $link_html = "\t$before$text$after\n"; } return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected ); } function wp_get_archives( $args = '' ) { global $wpdb, $wp_locale; $defaults = array( 'type' => 'monthly', 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', 'show_post_count' => false, 'echo' => 1, 'order' => 'DESC', 'post_type' => 'post', 'year' => get_query_var( 'year' ), 'monthnum' => get_query_var( 'monthnum' ), 'day' => get_query_var( 'day' ), 'w' => get_query_var( 'w' ), ); $parsed_args = wp_parse_args( $args, $defaults ); $post_type_object = get_post_type_object( $parsed_args['post_type'] ); if ( ! is_post_type_viewable( $post_type_object ) ) { return; } $parsed_args['post_type'] = $post_type_object->name; if ( '' === $parsed_args['type'] ) { $parsed_args['type'] = 'monthly'; } if ( ! empty( $parsed_args['limit'] ) ) { $parsed_args['limit'] = absint( $parsed_args['limit'] ); $parsed_args['limit'] = ' LIMIT ' . $parsed_args['limit']; } $order = strtoupper( $parsed_args['order'] ); if ( 'ASC' !== $order ) { $order = 'DESC'; } $archive_week_separator = '–'; $sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $parsed_args['post_type'] ); $where = apply_filters( 'getarchives_where', $sql_where, $parsed_args ); $join = apply_filters( 'getarchives_join', '', $parsed_args ); $output = ''; $last_changed = wp_cache_get_last_changed( 'posts' ); $limit = $parsed_args['limit']; if ( 'monthly' === $parsed_args['type'] ) { $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; $key = md5( $query ); $key = "wp_get_archives:$key:$last_changed"; $results = wp_cache_get( $key, 'posts' ); if ( ! $results ) { $results = $wpdb->get_results( $query ); wp_cache_set( $key, $results, 'posts' ); } if ( $results ) { $after = $parsed_args['after']; foreach ( (array) $results as $result ) { $url = get_month_link( $result->year, $result->month ); if ( 'post' !== $parsed_args['post_type'] ) { $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); } $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); if ( $parsed_args['show_post_count'] ) { $parsed_args['after'] = ' (' . $result->posts . ')' . $after; } $selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } elseif ( 'yearly' === $parsed_args['type'] ) { $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; $key = md5( $query ); $key = "wp_get_archives:$key:$last_changed"; $results = wp_cache_get( $key, 'posts' ); if ( ! $results ) { $results = $wpdb->get_results( $query ); wp_cache_set( $key, $results, 'posts' ); } if ( $results ) { $after = $parsed_args['after']; foreach ( (array) $results as $result ) { $url = get_year_link( $result->year ); if ( 'post' !== $parsed_args['post_type'] ) { $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); } $text = sprintf( '%d', $result->year ); if ( $parsed_args['show_post_count'] ) { $parsed_args['after'] = ' (' . $result->posts . ')' . $after; } $selected = is_archive() && (string) $parsed_args['year'] === $result->year; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } elseif ( 'daily' === $parsed_args['type'] ) { $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; $key = md5( $query ); $key = "wp_get_archives:$key:$last_changed"; $results = wp_cache_get( $key, 'posts' ); if ( ! $results ) { $results = $wpdb->get_results( $query ); wp_cache_set( $key, $results, 'posts' ); } if ( $results ) { $after = $parsed_args['after']; foreach ( (array) $results as $result ) { $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); if ( 'post' !== $parsed_args['post_type'] ) { $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); } $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); $text = mysql2date( get_option( 'date_format' ), $date ); if ( $parsed_args['show_post_count'] ) { $parsed_args['after'] = ' (' . $result->posts . ')' . $after; } $selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month && (string) $parsed_args['day'] === $result->dayofmonth; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } elseif ( 'weekly' === $parsed_args['type'] ) { $week = _wp_mysql_week( '`post_date`' ); $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; $key = md5( $query ); $key = "wp_get_archives:$key:$last_changed"; $results = wp_cache_get( $key, 'posts' ); if ( ! $results ) { $results = $wpdb->get_results( $query ); wp_cache_set( $key, $results, 'posts' ); } $arc_w_last = ''; if ( $results ) { $after = $parsed_args['after']; foreach ( (array) $results as $result ) { if ( $result->week != $arc_w_last ) { $arc_year = $result->yr; $arc_w_last = $result->week; $arc_week = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) ); $arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] ); $arc_week_end = date_i18n( get_option( 'date_format' ), $arc_week['end'] ); $url = add_query_arg( array( 'm' => $arc_year, 'w' => $result->week, ), home_url( '/' ) ); if ( 'post' !== $parsed_args['post_type'] ) { $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); } $text = $arc_week_start . $archive_week_separator . $arc_week_end; if ( $parsed_args['show_post_count'] ) { $parsed_args['after'] = ' (' . $result->posts . ')' . $after; } $selected = is_archive() && (string) $parsed_args['year'] === $result->yr && (string) $parsed_args['w'] === $result->week; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } } elseif ( ( 'postbypost' === $parsed_args['type'] ) || ( 'alpha' === $parsed_args['type'] ) ) { $orderby = ( 'alpha' === $parsed_args['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; $key = md5( $query ); $key = "wp_get_archives:$key:$last_changed"; $results = wp_cache_get( $key, 'posts' ); if ( ! $results ) { $results = $wpdb->get_results( $query ); wp_cache_set( $key, $results, 'posts' ); } if ( $results ) { foreach ( (array) $results as $result ) { if ( '0000-00-00 00:00:00' !== $result->post_date ) { $url = get_permalink( $result ); if ( $result->post_title ) { $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) ); } else { $text = $result->ID; } $selected = get_the_ID() === $result->ID; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } } if ( $parsed_args['echo'] ) { echo $output; } else { return $output; } } function calendar_week_mod( $num ) { $base = 7; return ( $num - $base * floor( $num / $base ) ); } function get_calendar( $initial = true, $echo = true ) { global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; $key = md5( $m . $monthnum . $year ); $cache = wp_cache_get( 'get_calendar', 'calendar' ); if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) { $output = apply_filters( 'get_calendar', $cache[ $key ] ); if ( $echo ) { echo $output; return; } return $output; } if ( ! is_array( $cache ) ) { $cache = array(); } if ( ! $posts ) { $gotsome = $wpdb->get_var( "SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" ); if ( ! $gotsome ) { $cache[ $key ] = ''; wp_cache_set( 'get_calendar', $cache, 'calendar' ); return; } } if ( isset( $_GET['w'] ) ) { $w = (int) $_GET['w']; } $week_begins = (int) get_option( 'start_of_week' ); if ( ! empty( $monthnum ) && ! empty( $year ) ) { $thismonth = zeroise( (int) $monthnum, 2 ); $thisyear = (int) $year; } elseif ( ! empty( $w ) ) { $thisyear = (int) substr( $m, 0, 4 ); $d = ( ( $w - 1 ) * 7 ) + 6; $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" ); } elseif ( ! empty( $m ) ) { $thisyear = (int) substr( $m, 0, 4 ); if ( strlen( $m ) < 6 ) { $thismonth = '01'; } else { $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 ); } } else { $thisyear = current_time( 'Y' ); $thismonth = current_time( 'm' ); } $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); $last_day = gmdate( 't', $unixmonth ); $previous = $wpdb->get_row( "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year - FROM $wpdb->posts - WHERE post_date < '$thisyear-$thismonth-01' - AND post_type = 'post' AND post_status = 'publish' - ORDER BY post_date DESC - LIMIT 1" ); $next = $wpdb->get_row( "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year - FROM $wpdb->posts - WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' - AND post_type = 'post' AND post_status = 'publish' - ORDER BY post_date ASC - LIMIT 1" ); $calendar_caption = _x( '%1$s %2$s', 'calendar caption' ); $calendar_output = ' - - - '; $myweek = array(); for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) { $myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 ); } foreach ( $myweek as $wd ) { $day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd ); $wd = esc_attr( $wd ); $calendar_output .= "\n\t\t"; } $calendar_output .= ' - - - - '; $daywithpost = array(); $dayswithposts = $wpdb->get_results( "SELECT DISTINCT DAYOFMONTH(post_date) - FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' - AND post_type = 'post' AND post_status = 'publish' - AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N ); if ( $dayswithposts ) { foreach ( (array) $dayswithposts as $daywith ) { $daywithpost[] = (int) $daywith[0]; } } $pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins ); if ( 0 != $pad ) { $calendar_output .= "\n\t\t" . ''; } $newrow = false; $daysinmonth = (int) gmdate( 't', $unixmonth ); for ( $day = 1; $day <= $daysinmonth; ++$day ) { if ( isset( $newrow ) && $newrow ) { $calendar_output .= "\n\t\n\t\n\t\t"; } $newrow = false; if ( current_time( 'j' ) == $day && current_time( 'm' ) == $thismonth && current_time( 'Y' ) == $thisyear ) { $calendar_output .= ''; if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { $newrow = true; } } $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); if ( 0 != $pad && 7 != $pad ) { $calendar_output .= "\n\t\t" . ''; } $calendar_output .= "\n\t\n\t"; $calendar_output .= "\n\t
                ' . sprintf( $calendar_caption, $wp_locale->get_month( $thismonth ), gmdate( 'Y', $unixmonth ) ) . '
                $day_name
                 
                '; } else { $calendar_output .= ''; } if ( in_array( $day, $daywithpost, true ) ) { $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); $label = sprintf( __( 'Posts published on %s' ), $date_format ); $calendar_output .= sprintf( '%s', get_day_link( $thisyear, $thismonth, $day ), esc_attr( $label ), $day ); } else { $calendar_output .= $day; } $calendar_output .= ' 
                "; $calendar_output .= ''; $cache[ $key ] = $calendar_output; wp_cache_set( 'get_calendar', $cache, 'calendar' ); if ( $echo ) { echo apply_filters( 'get_calendar', $calendar_output ); return; } return apply_filters( 'get_calendar', $calendar_output ); } function delete_get_calendar_cache() { wp_cache_delete( 'get_calendar', 'calendar' ); } function allowed_tags() { global $allowedtags; $allowed = ''; foreach ( (array) $allowedtags as $tag => $attributes ) { $allowed .= '<' . $tag; if ( 0 < count( $attributes ) ) { foreach ( $attributes as $attribute => $limits ) { $allowed .= ' ' . $attribute . '=""'; } } $allowed .= '> '; } return htmlentities( $allowed ); } function the_date_xml() { echo mysql2date( 'Y-m-d', get_post()->post_date, false ); } function the_date( $format = '', $before = '', $after = '', $echo = true ) { global $currentday, $previousday; $the_date = ''; if ( is_new_day() ) { $the_date = $before . get_the_date( $format ) . $after; $previousday = $currentday; } $the_date = apply_filters( 'the_date', $the_date, $format, $before, $after ); if ( $echo ) { echo $the_date; } else { return $the_date; } } function get_the_date( $format = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); $the_date = get_post_time( $_format, false, $post, true ); return apply_filters( 'get_the_date', $the_date, $format, $post ); } function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) { $the_modified_date = $before . get_the_modified_date( $format ) . $after; $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after ); if ( $echo ) { echo $the_modified_date; } else { return $the_modified_date; } } function get_the_modified_date( $format = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { $the_time = false; } else { $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); $the_time = get_post_modified_time( $_format, false, $post, true ); } return apply_filters( 'get_the_modified_date', $the_time, $format, $post ); } function the_time( $format = '' ) { echo apply_filters( 'the_time', get_the_time( $format ), $format ); } function get_the_time( $format = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { return false; } $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); $the_time = get_post_time( $_format, false, $post, true ); return apply_filters( 'get_the_time', $the_time, $format, $post ); } function get_post_time( $format = 'U', $gmt = false, $post = null, $translate = false ) { $post = get_post( $post ); if ( ! $post ) { return false; } $source = ( $gmt ) ? 'gmt' : 'local'; $datetime = get_post_datetime( $post, 'date', $source ); if ( false === $datetime ) { return false; } if ( 'U' === $format || 'G' === $format ) { $time = $datetime->getTimestamp(); if ( ! $gmt ) { $time += $datetime->getOffset(); } } elseif ( $translate ) { $time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null ); } else { if ( $gmt ) { $datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) ); } $time = $datetime->format( $format ); } return apply_filters( 'get_post_time', $time, $format, $gmt ); } function get_post_datetime( $post = null, $field = 'date', $source = 'local' ) { $post = get_post( $post ); if ( ! $post ) { return false; } $wp_timezone = wp_timezone(); if ( 'gmt' === $source ) { $time = ( 'modified' === $field ) ? $post->post_modified_gmt : $post->post_date_gmt; $timezone = new DateTimeZone( 'UTC' ); } else { $time = ( 'modified' === $field ) ? $post->post_modified : $post->post_date; $timezone = $wp_timezone; } if ( empty( $time ) || '0000-00-00 00:00:00' === $time ) { return false; } $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', $time, $timezone ); if ( false === $datetime ) { return false; } return $datetime->setTimezone( $wp_timezone ); } function get_post_timestamp( $post = null, $field = 'date' ) { $datetime = get_post_datetime( $post, $field ); if ( false === $datetime ) { return false; } return $datetime->getTimestamp(); } function the_modified_time( $format = '' ) { echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format ); } function get_the_modified_time( $format = '', $post = null ) { $post = get_post( $post ); if ( ! $post ) { $the_time = false; } else { $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); $the_time = get_post_modified_time( $_format, false, $post, true ); } return apply_filters( 'get_the_modified_time', $the_time, $format, $post ); } function get_post_modified_time( $format = 'U', $gmt = false, $post = null, $translate = false ) { $post = get_post( $post ); if ( ! $post ) { return false; } $source = ( $gmt ) ? 'gmt' : 'local'; $datetime = get_post_datetime( $post, 'modified', $source ); if ( false === $datetime ) { return false; } if ( 'U' === $format || 'G' === $format ) { $time = $datetime->getTimestamp(); if ( ! $gmt ) { $time += $datetime->getOffset(); } } elseif ( $translate ) { $time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null ); } else { if ( $gmt ) { $datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) ); } $time = $datetime->format( $format ); } return apply_filters( 'get_post_modified_time', $time, $format, $gmt ); } function the_weekday() { global $wp_locale; $post = get_post(); if ( ! $post ) { return; } $the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); echo apply_filters( 'the_weekday', $the_weekday ); } function the_weekday_date( $before = '', $after = '' ) { global $wp_locale, $currentday, $previousweekday; $post = get_post(); if ( ! $post ) { return; } $the_weekday_date = ''; if ( $currentday !== $previousweekday ) { $the_weekday_date .= $before; $the_weekday_date .= $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); $the_weekday_date .= $after; $previousweekday = $currentday; } echo apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after ); } function wp_head() { do_action( 'wp_head' ); } function wp_footer() { do_action( 'wp_footer' ); } function wp_body_open() { do_action( 'wp_body_open' ); } function feed_links( $args = array() ) { if ( ! current_theme_supports( 'automatic-feed-links' ) ) { return; } $defaults = array( 'separator' => _x( '»', 'feed link' ), 'feedtitle' => __( '%1$s %2$s Feed' ), 'comstitle' => __( '%1$s %2$s Comments Feed' ), ); $args = wp_parse_args( $args, $defaults ); if ( apply_filters( 'feed_links_show_posts_feed', true ) ) { echo '\n"; } if ( apply_filters( 'feed_links_show_comments_feed', true ) ) { echo '\n"; } } function feed_links_extra( $args = array() ) { $defaults = array( 'separator' => _x( '»', 'feed link' ), 'singletitle' => __( '%1$s %2$s %3$s Comments Feed' ), 'cattitle' => __( '%1$s %2$s %3$s Category Feed' ), 'tagtitle' => __( '%1$s %2$s %3$s Tag Feed' ), 'taxtitle' => __( '%1$s %2$s %3$s %4$s Feed' ), 'authortitle' => __( '%1$s %2$s Posts by %3$s Feed' ), 'searchtitle' => __( '%1$s %2$s Search Results for “%3$s” Feed' ), 'posttypetitle' => __( '%1$s %2$s %3$s Feed' ), ); $args = wp_parse_args( $args, $defaults ); if ( is_singular() ) { $id = 0; $post = get_post( $id ); $show_comments_feed = apply_filters( 'feed_links_show_comments_feed', true ); if ( $show_comments_feed && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) { $title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); $feed_link = get_post_comments_feed_link( $post->ID ); if ( $feed_link ) { $href = $feed_link; } } } elseif ( is_post_type_archive() ) { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_obj = get_post_type_object( $post_type ); $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); $href = get_post_type_archive_feed_link( $post_type_obj->name ); } elseif ( is_category() ) { $term = get_queried_object(); if ( $term ) { $title = sprintf( $args['cattitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); $href = get_category_feed_link( $term->term_id ); } } elseif ( is_tag() ) { $term = get_queried_object(); if ( $term ) { $title = sprintf( $args['tagtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); $href = get_tag_feed_link( $term->term_id ); } } elseif ( is_tax() ) { $term = get_queried_object(); if ( $term ) { $tax = get_taxonomy( $term->taxonomy ); $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); $href = get_term_feed_link( $term->term_id, $term->taxonomy ); } } elseif ( is_author() ) { $author_id = (int) get_query_var( 'author' ); $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); $href = get_author_feed_link( $author_id ); } elseif ( is_search() ) { $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); $href = get_search_feed_link(); } if ( isset( $title ) && isset( $href ) ) { echo '' . "\n"; } } function rsd_link() { echo '' . "\n"; } function wlwmanifest_link() { echo ' ' . "\n"; } function wp_strict_cross_origin_referrer() { ?> - - ', esc_url( $icon_32 ) ); } $icon_192 = get_site_icon_url( 192 ); if ( $icon_192 ) { $meta_tags[] = sprintf( '', esc_url( $icon_192 ) ); } $icon_180 = get_site_icon_url( 180 ); if ( $icon_180 ) { $meta_tags[] = sprintf( '', esc_url( $icon_180 ) ); } $icon_270 = get_site_icon_url( 270 ); if ( $icon_270 ) { $meta_tags[] = sprintf( '', esc_url( $icon_270 ) ); } $meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags ); $meta_tags = array_filter( $meta_tags ); foreach ( $meta_tags as $meta_tag ) { echo "$meta_tag\n"; } } function wp_resource_hints() { $hints = array( 'dns-prefetch' => wp_dependencies_unique_hosts(), 'preconnect' => array(), 'prefetch' => array(), 'prerender' => array(), ); $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/13.0.0/svg/' ); foreach ( $hints as $relation_type => $urls ) { $unique_urls = array(); $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type ); foreach ( $urls as $key => $url ) { $atts = array(); if ( is_array( $url ) ) { if ( isset( $url['href'] ) ) { $atts = $url; $url = $url['href']; } else { continue; } } $url = esc_url( $url, array( 'http', 'https' ) ); if ( ! $url ) { continue; } if ( isset( $unique_urls[ $url ] ) ) { continue; } if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ), true ) ) { $parsed = wp_parse_url( $url ); if ( empty( $parsed['host'] ) ) { continue; } if ( 'preconnect' === $relation_type && ! empty( $parsed['scheme'] ) ) { $url = $parsed['scheme'] . '://' . $parsed['host']; } else { $url = '//' . $parsed['host']; } } $atts['rel'] = $relation_type; $atts['href'] = $url; $unique_urls[ $url ] = $atts; } foreach ( $unique_urls as $atts ) { $html = ''; foreach ( $atts as $attr => $value ) { if ( ! is_scalar( $value ) || ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) ) ) { continue; } $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); if ( ! is_string( $attr ) ) { $html .= " $value"; } else { $html .= " $attr='$value'"; } } $html = trim( $html ); echo "\n"; } } } function wp_dependencies_unique_hosts() { global $wp_scripts, $wp_styles; $unique_hosts = array(); foreach ( array( $wp_scripts, $wp_styles ) as $dependencies ) { if ( $dependencies instanceof WP_Dependencies && ! empty( $dependencies->queue ) ) { foreach ( $dependencies->queue as $handle ) { if ( ! isset( $dependencies->registered[ $handle ] ) ) { continue; } $dependency = $dependencies->registered[ $handle ]; $parsed = wp_parse_url( $dependency->src ); if ( ! empty( $parsed['host'] ) && ! in_array( $parsed['host'], $unique_hosts, true ) && $parsed['host'] !== $_SERVER['SERVER_NAME'] ) { $unique_hosts[] = $parsed['host']; } } } } return $unique_hosts; } function user_can_richedit() { global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge; if ( ! isset( $wp_rich_edit ) ) { $wp_rich_edit = false; if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { if ( $is_safari ) { $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 ); } elseif ( $is_IE ) { $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false ); } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { $wp_rich_edit = true; } } } return apply_filters( 'user_can_richedit', $wp_rich_edit ); } function wp_default_editor() { $r = user_can_richedit() ? 'tinymce' : 'html'; if ( wp_get_current_user() ) { $ed = get_user_setting( 'editor', 'tinymce' ); $r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ), true ) ) ? $ed : $r; } return apply_filters( 'wp_default_editor', $r ); } function wp_editor( $content, $editor_id, $settings = array() ) { if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } _WP_Editors::editor( $content, $editor_id, $settings ); } function wp_enqueue_editor() { if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } _WP_Editors::enqueue_default_editor(); } function wp_enqueue_code_editor( $args ) { if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) { return false; } $settings = wp_get_code_editor_settings( $args ); if ( empty( $settings ) || empty( $settings['codemirror'] ) ) { return false; } wp_enqueue_script( 'code-editor' ); wp_enqueue_style( 'code-editor' ); if ( isset( $settings['codemirror']['mode'] ) ) { $mode = $settings['codemirror']['mode']; if ( is_string( $mode ) ) { $mode = array( 'name' => $mode, ); } if ( ! empty( $settings['codemirror']['lint'] ) ) { switch ( $mode['name'] ) { case 'css': case 'text/css': case 'text/x-scss': case 'text/x-less': wp_enqueue_script( 'csslint' ); break; case 'htmlmixed': case 'text/html': case 'php': case 'application/x-httpd-php': case 'text/x-php': wp_enqueue_script( 'htmlhint' ); wp_enqueue_script( 'csslint' ); wp_enqueue_script( 'jshint' ); if ( ! current_user_can( 'unfiltered_html' ) ) { wp_enqueue_script( 'htmlhint-kses' ); } break; case 'javascript': case 'application/ecmascript': case 'application/json': case 'application/javascript': case 'application/ld+json': case 'text/typescript': case 'application/typescript': wp_enqueue_script( 'jshint' ); wp_enqueue_script( 'jsonlint' ); break; } } } wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) ); do_action( 'wp_enqueue_code_editor', $settings ); return $settings; } function wp_get_code_editor_settings( $args ) { $settings = array( 'codemirror' => array( 'indentUnit' => 4, 'indentWithTabs' => true, 'inputStyle' => 'contenteditable', 'lineNumbers' => true, 'lineWrapping' => true, 'styleActiveLine' => true, 'continueComments' => true, 'extraKeys' => array( 'Ctrl-Space' => 'autocomplete', 'Ctrl-/' => 'toggleComment', 'Cmd-/' => 'toggleComment', 'Alt-F' => 'findPersistent', 'Ctrl-F' => 'findPersistent', 'Cmd-F' => 'findPersistent', ), 'direction' => 'ltr', 'gutters' => array(), ), 'csslint' => array( 'errors' => true, 'box-model' => true, 'display-property-grouping' => true, 'duplicate-properties' => true, 'known-properties' => true, 'outline-none' => true, ), 'jshint' => array( 'boss' => true, 'curly' => true, 'eqeqeq' => true, 'eqnull' => true, 'es3' => true, 'expr' => true, 'immed' => true, 'noarg' => true, 'nonbsp' => true, 'onevar' => true, 'quotmark' => 'single', 'trailing' => true, 'undef' => true, 'unused' => true, 'browser' => true, 'globals' => array( '_' => false, 'Backbone' => false, 'jQuery' => false, 'JSON' => false, 'wp' => false, ), ), 'htmlhint' => array( 'tagname-lowercase' => true, 'attr-lowercase' => true, 'attr-value-double-quotes' => false, 'doctype-first' => false, 'tag-pair' => true, 'spec-char-escape' => true, 'id-unique' => true, 'src-not-empty' => true, 'attr-no-duplication' => true, 'alt-require' => true, 'space-tab-mixed-disabled' => 'tab', 'attr-unsafe-chars' => true, ), ); $type = ''; if ( isset( $args['type'] ) ) { $type = $args['type']; if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) { $type = 'text/x-diff'; } } elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) { $extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) ); foreach ( wp_get_mime_types() as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $type = $mime; break; } } if ( empty( $type ) ) { switch ( $extension ) { case 'conf': $type = 'text/nginx'; break; case 'css': $type = 'text/css'; break; case 'diff': case 'patch': $type = 'text/x-diff'; break; case 'html': case 'htm': $type = 'text/html'; break; case 'http': $type = 'message/http'; break; case 'js': $type = 'text/javascript'; break; case 'json': $type = 'application/json'; break; case 'jsx': $type = 'text/jsx'; break; case 'less': $type = 'text/x-less'; break; case 'md': $type = 'text/x-gfm'; break; case 'php': case 'phtml': case 'php3': case 'php4': case 'php5': case 'php7': case 'phps': $type = 'application/x-httpd-php'; break; case 'scss': $type = 'text/x-scss'; break; case 'sass': $type = 'text/x-sass'; break; case 'sh': case 'bash': $type = 'text/x-sh'; break; case 'sql': $type = 'text/x-sql'; break; case 'svg': $type = 'application/svg+xml'; break; case 'xml': $type = 'text/xml'; break; case 'yml': case 'yaml': $type = 'text/x-yaml'; break; case 'txt': default: $type = 'text/plain'; break; } } } if ( in_array( $type, array( 'text/css', 'text/x-scss', 'text/x-less', 'text/x-sass' ), true ) ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => $type, 'lint' => false, 'autoCloseBrackets' => true, 'matchBrackets' => true, ) ); } elseif ( 'text/x-diff' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'diff', ) ); } elseif ( 'text/html' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'htmlmixed', 'lint' => true, 'autoCloseBrackets' => true, 'autoCloseTags' => true, 'matchTags' => array( 'bothTags' => true, ), ) ); if ( ! current_user_can( 'unfiltered_html' ) ) { $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' ); } } elseif ( 'text/x-gfm' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'gfm', 'highlightFormatting' => true, ) ); } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'javascript', 'lint' => true, 'autoCloseBrackets' => true, 'matchBrackets' => true, ) ); } elseif ( false !== strpos( $type, 'json' ) ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => array( 'name' => 'javascript', ), 'lint' => true, 'autoCloseBrackets' => true, 'matchBrackets' => true, ) ); if ( 'application/ld+json' === $type ) { $settings['codemirror']['mode']['jsonld'] = true; } else { $settings['codemirror']['mode']['json'] = true; } } elseif ( false !== strpos( $type, 'jsx' ) ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'jsx', 'autoCloseBrackets' => true, 'matchBrackets' => true, ) ); } elseif ( 'text/x-markdown' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'markdown', 'highlightFormatting' => true, ) ); } elseif ( 'text/nginx' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'nginx', ) ); } elseif ( 'application/x-httpd-php' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'php', 'autoCloseBrackets' => true, 'autoCloseTags' => true, 'matchBrackets' => true, 'matchTags' => array( 'bothTags' => true, ), ) ); } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'sql', 'autoCloseBrackets' => true, 'matchBrackets' => true, ) ); } elseif ( false !== strpos( $type, 'xml' ) ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'xml', 'autoCloseBrackets' => true, 'autoCloseTags' => true, 'matchTags' => array( 'bothTags' => true, ), ) ); } elseif ( 'text/x-yaml' === $type ) { $settings['codemirror'] = array_merge( $settings['codemirror'], array( 'mode' => 'yaml', ) ); } else { $settings['codemirror']['mode'] = $type; } if ( ! empty( $settings['codemirror']['lint'] ) ) { $settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers'; } foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) { $settings[ $key ] = array_merge( $settings[ $key ], $value ); } return apply_filters( 'wp_code_editor_settings', $settings, $args ); } function get_search_query( $escaped = true ) { $query = apply_filters( 'get_search_query', get_query_var( 's' ) ); if ( $escaped ) { $query = esc_attr( $query ); } return $query; } function the_search_query() { echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) ); } function get_language_attributes( $doctype = 'html' ) { $attributes = array(); if ( function_exists( 'is_rtl' ) && is_rtl() ) { $attributes[] = 'dir="rtl"'; } $lang = get_bloginfo( 'language' ); if ( $lang ) { if ( 'text/html' === get_option( 'html_type' ) || 'html' === $doctype ) { $attributes[] = 'lang="' . esc_attr( $lang ) . '"'; } if ( 'text/html' !== get_option( 'html_type' ) || 'xhtml' === $doctype ) { $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"'; } } $output = implode( ' ', $attributes ); return apply_filters( 'language_attributes', $output, $doctype ); } function language_attributes( $doctype = 'html' ) { echo get_language_attributes( $doctype ); } function paginate_links( $args = '' ) { global $wp_query, $wp_rewrite; $pagenum_link = html_entity_decode( get_pagenum_link() ); $url_parts = explode( '?', $pagenum_link ); $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; $defaults = array( 'base' => $pagenum_link, 'format' => $format, 'total' => $total, 'current' => $current, 'aria_current' => 'page', 'show_all' => false, 'prev_next' => true, 'prev_text' => __( '« Previous' ), 'next_text' => __( 'Next »' ), 'end_size' => 1, 'mid_size' => 2, 'type' => 'plain', 'add_args' => array(), 'add_fragment' => '', 'before_page_number' => '', 'after_page_number' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! is_array( $args['add_args'] ) ) { $args['add_args'] = array(); } if ( isset( $url_parts[1] ) ) { $format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) ); $format_query = isset( $format[1] ) ? $format[1] : ''; wp_parse_str( $format_query, $format_args ); wp_parse_str( $url_parts[1], $url_query_args ); foreach ( $format_args as $format_arg => $format_arg_value ) { unset( $url_query_args[ $format_arg ] ); } $args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) ); } $total = (int) $args['total']; if ( $total < 2 ) { return; } $current = (int) $args['current']; $end_size = (int) $args['end_size']; if ( $end_size < 1 ) { $end_size = 1; } $mid_size = (int) $args['mid_size']; if ( $mid_size < 0 ) { $mid_size = 2; } $add_args = $args['add_args']; $r = ''; $page_links = array(); $dots = false; if ( $args['prev_next'] && $current && 1 < $current ) : $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] ); $link = str_replace( '%#%', $current - 1, $link ); if ( $add_args ) { $link = add_query_arg( $add_args, $link ); } $link .= $args['add_fragment']; $page_links[] = sprintf( '', esc_url( apply_filters( 'paginate_links', $link ) ), $args['prev_text'] ); endif; for ( $n = 1; $n <= $total; $n++ ) : if ( $n == $current ) : $page_links[] = sprintf( '%s', esc_attr( $args['aria_current'] ), $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] ); $dots = true; else : if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); $link = str_replace( '%#%', $n, $link ); if ( $add_args ) { $link = add_query_arg( $add_args, $link ); } $link .= $args['add_fragment']; $page_links[] = sprintf( '%s', esc_url( apply_filters( 'paginate_links', $link ) ), $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] ); $dots = true; elseif ( $dots && ! $args['show_all'] ) : $page_links[] = '' . __( '…' ) . ''; $dots = false; endif; endif; endfor; if ( $args['prev_next'] && $current && $current < $total ) : $link = str_replace( '%_%', $args['format'], $args['base'] ); $link = str_replace( '%#%', $current + 1, $link ); if ( $add_args ) { $link = add_query_arg( $add_args, $link ); } $link .= $args['add_fragment']; $page_links[] = sprintf( '', esc_url( apply_filters( 'paginate_links', $link ) ), $args['next_text'] ); endif; switch ( $args['type'] ) { case 'array': return $page_links; case 'list': $r .= "
                  \n\t
                • "; $r .= implode( "
                • \n\t
                • ", $page_links ); $r .= "
                • \n
                \n"; break; default: $r = implode( "\n", $page_links ); break; } $r = apply_filters( 'paginate_links_output', $r, $args ); return $r; } function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { global $_wp_admin_css_colors; if ( ! isset( $_wp_admin_css_colors ) ) { $_wp_admin_css_colors = array(); } $_wp_admin_css_colors[ $key ] = (object) array( 'name' => $name, 'url' => $url, 'colors' => $colors, 'icon_colors' => $icons, ); } function register_admin_color_schemes() { $suffix = is_rtl() ? '-rtl' : ''; $suffix .= SCRIPT_DEBUG ? '' : '.min'; wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), false, array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ), array( 'base' => '#a7aaad', 'focus' => '#72aee6', 'current' => '#fff', ) ); wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), admin_url( "css/colors/light/colors$suffix.css" ), array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ), array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc', ) ); wp_admin_css_color( 'modern', _x( 'Modern', 'admin color scheme' ), admin_url( "css/colors/modern/colors$suffix.css" ), array( '#1e1e1e', '#3858e9', '#33f078' ), array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ), admin_url( "css/colors/blue/colors$suffix.css" ), array( '#096484', '#4796b3', '#52accc', '#74B6CE' ), array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ), admin_url( "css/colors/midnight/colors$suffix.css" ), array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ), array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ), admin_url( "css/colors/sunrise/colors$suffix.css" ), array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ), array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ), admin_url( "css/colors/ectoplasm/colors$suffix.css" ), array( '#413256', '#523f6d', '#a3b745', '#d46f15' ), array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ), admin_url( "css/colors/ocean/colors$suffix.css" ), array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ), array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff', ) ); wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ), admin_url( "css/colors/coffee/colors$suffix.css" ), array( '#46403c', '#59524c', '#c7a589', '#9ea476' ), array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff', ) ); } function wp_admin_css_uri( $file = 'wp-admin' ) { if ( defined( 'WP_INSTALLING' ) ) { $_file = "./$file.css"; } else { $_file = admin_url( "$file.css" ); } $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file ); return apply_filters( 'wp_admin_css_uri', $_file, $file ); } function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; if ( wp_styles()->query( $handle ) ) { if ( $force_echo || did_action( 'wp_print_styles' ) ) { wp_print_styles( $handle ); } else { wp_enqueue_style( $handle ); } return; } $stylesheet_link = sprintf( "\n", esc_url( wp_admin_css_uri( $file ) ) ); echo apply_filters( 'wp_admin_css', $stylesheet_link, $file ); if ( function_exists( 'is_rtl' ) && is_rtl() ) { $rtl_stylesheet_link = sprintf( "\n", esc_url( wp_admin_css_uri( "$file-rtl" ) ) ); echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" ); } } function add_thickbox() { wp_enqueue_script( 'thickbox' ); wp_enqueue_style( 'thickbox' ); if ( is_network_admin() ) { add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); } } function wp_generator() { the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) ); } function the_generator( $type ) { echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n"; } function get_the_generator( $type = '' ) { if ( empty( $type ) ) { $current_filter = current_filter(); if ( empty( $current_filter ) ) { return; } switch ( $current_filter ) { case 'rss2_head': case 'commentsrss2_head': $type = 'rss2'; break; case 'rss_head': case 'opml_head': $type = 'comment'; break; case 'rdf_header': $type = 'rdf'; break; case 'atom_head': case 'comments_atom_head': case 'app_head': $type = 'atom'; break; } } switch ( $type ) { case 'html': $gen = ''; break; case 'xhtml': $gen = ''; break; case 'atom': $gen = 'WordPress'; break; case 'rss2': $gen = '' . esc_url_raw( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . ''; break; case 'rdf': $gen = ''; break; case 'comment': $gen = ''; break; case 'export': $gen = ''; break; } return apply_filters( "get_the_generator_{$type}", $gen, $type ); } function checked( $checked, $current = true, $echo = true ) { return __checked_selected_helper( $checked, $current, $echo, 'checked' ); } function selected( $selected, $current = true, $echo = true ) { return __checked_selected_helper( $selected, $current, $echo, 'selected' ); } function disabled( $disabled, $current = true, $echo = true ) { return __checked_selected_helper( $disabled, $current, $echo, 'disabled' ); } function wp_readonly( $readonly, $current = true, $echo = true ) { return __checked_selected_helper( $readonly, $current, $echo, 'readonly' ); } if ( PHP_VERSION_ID < 80100 ) { require_once __DIR__ . '/php-compat/readonly.php'; } function __checked_selected_helper( $helper, $current, $echo, $type ) { if ( (string) $helper === (string) $current ) { $result = " $type='$type'"; } else { $result = ''; } if ( $echo ) { echo $result; } return $result; } function wp_heartbeat_settings( $settings ) { if ( ! is_admin() ) { $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); } if ( is_user_logged_in() ) { $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); } return $settings; } $post->ID, 'Author_ID' => $post->post_author, 'Date' => $post->post_date, 'Content' => $post->post_content, 'Excerpt' => $post->post_excerpt, 'Title' => $post->post_title, 'Category' => $post->post_category, 'post_status' => $post->post_status, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'post_password' => $post->post_password, 'to_ping' => $post->to_ping, 'pinged' => $post->pinged, 'post_type' => $post->post_type, 'post_name' => $post->post_name ); return $postdata; } function start_wp() { global $wp_query; _deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') ); $wp_query->next_post(); setup_postdata( get_post() ); } function the_category_ID($display = true) { _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); $categories = get_the_category(); $cat = $categories[0]->term_id; if ( $display ) echo $cat; return $cat; } function the_category_head( $before = '', $after = '' ) { global $currentcat, $previouscat; _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); $categories = get_the_category(); $currentcat = $categories[0]->category_id; if ( $currentcat != $previouscat ) { echo $before; echo get_the_category_by_ID($currentcat); echo $after; $previouscat = $currentcat; } } function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); if ( empty($in_same_cat) || 'no' == $in_same_cat ) $in_same_cat = false; else $in_same_cat = true; $post = get_previous_post($in_same_cat, $excluded_categories); if ( !$post ) return; $string = ''.$previous; if ( 'yes' == $title ) $string .= apply_filters('the_title', $post->post_title, $post->ID); $string .= ''; $format = str_replace('%', $string, $format); echo $format; } function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); if ( empty($in_same_cat) || 'no' == $in_same_cat ) $in_same_cat = false; else $in_same_cat = true; $post = get_next_post($in_same_cat, $excluded_categories); if ( !$post ) return; $string = ''.$next; if ( 'yes' == $title ) $string .= apply_filters('the_title', $post->post_title, $post->ID); $string .= ''; $format = str_replace('%', $string, $format); echo $format; } function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return ($author_data->user_level > 1); } function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return ($author_data->user_level >= 1); } function user_can_edit_post($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); $post = get_post($post_id); $post_author_data = get_userdata($post->post_author); if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) || ($author_data->user_level > $post_author_data->user_level) || ($author_data->user_level >= 10) ) { return true; } else { return false; } } function user_can_delete_post($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); return user_can_edit_post($user_id, $post_id, $blog_id); } function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); } function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $author_data = get_userdata($user_id); return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); } function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); return user_can_edit_post($user_id, $post_id, $blog_id); } function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); return user_can_edit_post_comments($user_id, $post_id, $blog_id); } function user_can_edit_user($user_id, $other_user) { _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); $user = get_userdata($user_id); $other = get_userdata($other_user); if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) return true; else return false; } function get_linksbyname($cat_name = "noname", $before = '', $after = '
                ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $cat_id = -1; $cat = get_term_by('name', $cat_name, 'link_category'); if ( $cat ) $cat_id = $cat->term_id; get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); } function wp_get_linksbyname($category, $args = '') { _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()'); $defaults = array( 'after' => '
                ', 'before' => '', 'categorize' => 0, 'category_after' => '', 'category_before' => '', 'category_name' => $category, 'show_description' => 1, 'title_li' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); return wp_list_bookmarks($parsed_args); } function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $cat_id = -1; $cat = get_term_by('name', $cat_name, 'link_category'); if ( $cat ) $cat_id = $cat->term_id; return get_linkobjects($cat_id, $orderby, $limit); } function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; $links_array = array(); foreach ($links as $link) $links_array[] = $link; return $links_array; } function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '
                ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); } function get_links_withrating($category = -1, $before = '', $after = '
                ', $between = " ", $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); } function get_autotoggle($id = 0) { _deprecated_function( __FUNCTION__, '2.1.0' ); return 0; } function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); return wp_list_cats($query); } function wp_list_cats($args = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); $parsed_args = wp_parse_args( $args ); if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) $parsed_args['show_option_all'] = $parsed_args['all']; if ( isset($parsed_args['sort_column']) ) $parsed_args['orderby'] = $parsed_args['sort_column']; if ( isset($parsed_args['sort_order']) ) $parsed_args['order'] = $parsed_args['sort_order']; if ( isset($parsed_args['optiondates']) ) $parsed_args['show_last_update'] = $parsed_args['optiondates']; if ( isset($parsed_args['optioncount']) ) $parsed_args['show_count'] = $parsed_args['optioncount']; if ( isset($parsed_args['list']) ) $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; $parsed_args['title_li'] = ''; return wp_list_categories($parsed_args); } function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, $selected = 0, $exclude = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); $show_option_all = ''; if ( $optionall ) $show_option_all = $all; $show_option_none = ''; if ( $optionnone ) $show_option_none = __('None'); $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); $query = add_query_arg($vars, ''); return wp_dropdown_categories($query); } function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' ); $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); return wp_list_authors($args); } function wp_get_post_cats($blogid = '1', $post_ID = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); return wp_get_post_categories($post_ID); } function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); return wp_set_post_categories($post_ID, $post_categories); } function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' ); $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); return wp_get_archives($args); } function get_author_link($display, $author_id, $author_nicename = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); $link = get_author_posts_url($author_id, $author_nicename); if ( $display ) echo $link; return $link; } function link_pages($before='
                ', $after='
                ', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); return wp_link_pages($args); } function get_settings($option) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' ); return get_option($option); } function permalink_link() { _deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' ); the_permalink(); } function permalink_single_rss($deprecated = '') { _deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' ); the_permalink_rss(); } function wp_get_links($args = '') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); if ( strpos( $args, '=' ) === false ) { $cat_id = $args; $args = add_query_arg( 'category', $cat_id, $args ); } $defaults = array( 'after' => '
                ', 'before' => '', 'between' => ' ', 'categorize' => 0, 'category' => '', 'echo' => true, 'limit' => -1, 'orderby' => 'name', 'show_description' => true, 'show_images' => true, 'show_rating' => false, 'show_updated' => true, 'title_li' => '', ); $parsed_args = wp_parse_args( $args, $defaults ); return wp_list_bookmarks($parsed_args); } function get_links($category = -1, $before = '', $after = '
                ', $between = ' ', $show_images = true, $orderby = 'name', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); $order = 'ASC'; if ( substr($orderby, 0, 1) == '_' ) { $order = 'DESC'; $orderby = substr($orderby, 1); } if ( $category == -1 ) $category = ''; $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); if ( !$results ) return; $output = ''; foreach ( (array) $results as $row ) { if ( !isset($row->recently_updated) ) $row->recently_updated = false; $output .= $before; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; if ( !empty($row->link_url) ) $the_link = esc_url($row->link_url); $rel = $row->link_rel; if ( '' != $rel ) $rel = ' rel="' . $rel . '"'; $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); $title = $desc; if ( $show_updated ) if (substr($row->link_updated_f, 0, 2) != '00') $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; if ( '' != $title ) $title = ' title="' . $title . '"'; $alt = ' alt="' . $name . '"'; $target = $row->link_target; if ( '' != $target ) $target = ' target="' . $target . '"'; $output .= ''; if ( $row->link_image != null && $show_images ) { if ( strpos($row->link_image, 'http') !== false ) $output .= "link_image\" $alt $title />"; else $output .= "link_image\" $alt $title />"; } else { $output .= $name; } $output .= ''; if ( $show_updated && $row->recently_updated ) $output .= get_option('links_recently_updated_append'); if ( $show_description && '' != $desc ) $output .= $between . $desc; if ($show_rating) { $output .= $between . get_linkrating($row); } $output .= "$after\n"; } if ( !$display ) return $output; echo $output; } function get_links_list($order = 'name') { _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); $order = strtolower($order); $direction = 'ASC'; if ( '_' == substr($order,0,1) ) { $direction = 'DESC'; $order = substr($order,1); } if ( !isset($direction) ) $direction = ''; $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); if ( $cats ) { foreach ( (array) $cats as $cat ) { echo '
              • ' . apply_filters('link_category', $cat->name ) . "

                \n\t
                  \n"; get_links($cat->term_id, '
                • ', "
                • ", "\n", true, 'name', false); echo "\n\t
                \n
              • \n"; } } } function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { _deprecated_function( __FUNCTION__, '2.1.0' ); } function get_linkrating( $link ) { _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); } function get_linkcatname($id = 0) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' ); $id = (int) $id; if ( empty($id) ) return ''; $cats = wp_get_link_cats($id); if ( empty($cats) || ! is_array($cats) ) return ''; $cat_id = (int) $cats[0]; $cat = get_category($cat_id); return $cat->name; } function comments_rss_link($link_text = 'Comments RSS') { _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); post_comments_feed_link($link_text); } function get_category_rss_link($display = false, $cat_ID = 1) { _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); $link = get_category_feed_link($cat_ID, 'rss2'); if ( $display ) echo $link; return $link; } function get_author_rss_link($display = false, $author_id = 1) { _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); $link = get_author_feed_link($author_id); if ( $display ) echo $link; return $link; } function comments_rss() { _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' ); return esc_url( get_post_comments_feed_link() ); } function create_user($username, $password, $email) { _deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' ); return wp_create_user($username, $password, $email); } function gzip_compression() { _deprecated_function( __FUNCTION__, '2.5.0' ); return false; } function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); return get_comment($comment_ID, ARRAY_A); } function get_catname( $cat_ID ) { _deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' ); return get_cat_name( $cat_ID ); } function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); if ( 0 == $id ) return ''; $chain = ''; $cat_ids = get_all_category_ids(); foreach ( (array) $cat_ids as $cat_id ) { if ( $cat_id == $id ) continue; $category = get_category( $cat_id ); if ( is_wp_error( $category ) ) return $category; if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { $visited[] = $category->term_id; $chain .= $before.$category->term_id.$after; $chain .= get_category_children( $category->term_id, $before, $after ); } } return $chain; } function get_all_category_ids() { _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); $cat_ids = get_terms( array( 'taxonomy' => 'category', 'fields' => 'ids', 'get' => 'all', ) ); return $cat_ids; } function get_the_author_description() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); return get_the_author_meta('description'); } function the_author_description() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); the_author_meta('description'); } function get_the_author_login() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' ); return get_the_author_meta('login'); } function the_author_login() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' ); the_author_meta('login'); } function get_the_author_firstname() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' ); return get_the_author_meta('first_name'); } function the_author_firstname() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' ); the_author_meta('first_name'); } function get_the_author_lastname() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' ); return get_the_author_meta('last_name'); } function the_author_lastname() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' ); the_author_meta('last_name'); } function get_the_author_nickname() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' ); return get_the_author_meta('nickname'); } function the_author_nickname() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' ); the_author_meta('nickname'); } function get_the_author_email() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' ); return get_the_author_meta('email'); } function the_author_email() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' ); the_author_meta('email'); } function get_the_author_icq() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' ); return get_the_author_meta('icq'); } function the_author_icq() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' ); the_author_meta('icq'); } function get_the_author_yim() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' ); return get_the_author_meta('yim'); } function the_author_yim() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' ); the_author_meta('yim'); } function get_the_author_msn() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); return get_the_author_meta('msn'); } function the_author_msn() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' ); the_author_meta('msn'); } function get_the_author_aim() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' ); return get_the_author_meta('aim'); } function the_author_aim() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' ); the_author_meta('aim'); } function get_author_name( $auth_id = false ) { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' ); return get_the_author_meta('display_name', $auth_id); } function get_the_author_url() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' ); return get_the_author_meta('url'); } function the_author_url() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' ); the_author_meta('url'); } function get_the_author_ID() { _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); return get_the_author_meta('ID'); } function the_author_ID() { _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' ); the_author_meta('ID'); } function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content_rss', $content); if ( $cut && !$encode_html ) $encode_html = 2; if ( 1== $encode_html ) { $content = esc_html($content); $cut = 0; } elseif ( 0 == $encode_html ) { $content = make_url_footnote($content); } elseif ( 2 == $encode_html ) { $content = strip_tags($content); } if ( $cut ) { $blah = explode(' ', $content); if ( count($blah) > $cut ) { $k = $cut; $use_dotdotdot = 1; } else { $k = count($blah); $use_dotdotdot = 0; } for ( $i=0; $i<$k; $i++ ) $excerpt .= $blah[$i].' '; $excerpt .= ($use_dotdotdot) ? '...' : ''; $content = $excerpt; } $content = str_replace(']]>', ']]>', $content); echo $content; } function make_url_footnote( $content ) { _deprecated_function( __FUNCTION__, '2.9.0', '' ); preg_match_all( '/(.+?)<\/a>/', $content, $matches ); $links_summary = "\n"; for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { $link_match = $matches[0][$i]; $link_number = '['.($i+1).']'; $link_url = $matches[2][$i]; $link_text = $matches[4][$i]; $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; $links_summary .= "\n" . $link_number . ' ' . $link_url; } $content = strip_tags( $content ); $content .= $links_summary; return $content; } function _c( $text, $domain = 'default' ) { _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); return before_last_bar( translate( $text, $domain ) ); } function translate_with_context( $text, $domain = 'default' ) { _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); return before_last_bar( translate( $text, $domain ) ); } function _nc( $single, $plural, $number, $domain = 'default' ) { _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); return before_last_bar( _n( $single, $plural, $number, $domain ) ); } function __ngettext( ...$args ) { _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); return _n( ...$args ); } function __ngettext_noop( ...$args ) { _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); return _n_noop( ...$args ); } function get_alloptions() { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' ); return wp_load_alloptions(); } function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); $id = (int) $id; $_post = get_post($id); if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) return __('Missing Attachment'); if ( $permalink ) $url = get_attachment_link($_post->ID); $post_title = esc_attr($_post->post_title); $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); return "$innerHTML"; } function get_attachment_icon_src( $id = 0, $fullsize = false ) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); $id = (int) $id; if ( !$post = get_post($id) ) return false; $file = get_attached_file( $post->ID ); if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { $src_file = wp_basename($src); } elseif ( wp_attachment_is_image( $post->ID ) ) { $src = wp_get_attachment_url( $post->ID ); $src_file = & $file; } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); $src_file = $icon_dir . '/' . wp_basename($src); } if ( !isset($src) || !$src ) return false; return array($src, $src_file); } function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); $id = (int) $id; if ( !$post = get_post($id) ) return false; if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) return false; list($src, $src_file) = $src; if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { $imagesize = wp_getimagesize($src_file); if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { $actual_aspect = $imagesize[0] / $imagesize[1]; $desired_aspect = $max_dims[0] / $max_dims[1]; if ( $actual_aspect >= $desired_aspect ) { $height = $actual_aspect * $max_dims[0]; $constraint = "width='{$max_dims[0]}' "; $post->iconsize = array($max_dims[0], $height); } else { $width = $max_dims[1] / $actual_aspect; $constraint = "height='{$max_dims[1]}' "; $post->iconsize = array($width, $max_dims[1]); } } else { $post->iconsize = array($imagesize[0], $imagesize[1]); $constraint = ''; } } else { $constraint = ''; } $post_title = esc_attr($post->post_title); $icon = "$post_title"; return apply_filters( 'attachment_icon', $icon, $post->ID ); } function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); $id = (int) $id; if ( !$post = get_post($id) ) return false; if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) return $innerHTML; $innerHTML = esc_attr($post->post_title); return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); } function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) { _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' ); return get_bookmark($bookmark_id, $output, $filter); } function clean_url( $url, $protocols = null, $context = 'display' ) { if ( $context == 'db' ) _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); else _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); return esc_url( $url, $protocols, $context ); } function js_escape( $text ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); return esc_js( $text ); } function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); if ( func_num_args() > 1 ) { return _wp_specialchars( $text, $quote_style, $charset, $double_encode ); } else { return esc_html( $text ); } } function attribute_escape( $text ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); return esc_attr( $text ); } function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) { _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); if ( is_array( $name ) ) { if ( count( $name ) === 3 ) { $name = sprintf( $name[0], $name[2] ); } else { $name = $name[0]; } } $id = sanitize_title( $name ); $options = array(); if ( ! empty( $classname ) && is_string( $classname ) ) { $options['classname'] = $classname; } wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params ); } function unregister_sidebar_widget($id) { _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' ); return wp_unregister_sidebar_widget($id); } function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) { _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); if ( is_array( $name ) ) { if ( count( $name ) === 3 ) { $name = sprintf( $name[0], $name[2] ); } else { $name = $name[0]; } } $id = sanitize_title( $name ); $options = array(); if ( ! empty( $width ) ) { $options['width'] = $width; } if ( ! empty( $height ) ) { $options['height'] = $height; } wp_register_widget_control( $id, $name, $control_callback, $options, ...$params ); } function unregister_widget_control($id) { _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); return wp_unregister_widget_control($id); } function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); global $wpdb; if ( !is_numeric( $user_id ) ) return false; $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); if ( is_array($meta_value) || is_object($meta_value) ) $meta_value = serialize($meta_value); $meta_value = trim( $meta_value ); $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); if ( $cur && $cur->umeta_id ) do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); if ( ! empty($meta_value) ) $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); else $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); clean_user_cache( $user_id ); wp_cache_delete( $user_id, 'user_meta' ); if ( $cur && $cur->umeta_id ) do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); return true; } function get_usermeta( $user_id, $meta_key = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); global $wpdb; $user_id = (int) $user_id; if ( !$user_id ) return false; if ( !empty($meta_key) ) { $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); $user = wp_cache_get($user_id, 'users'); if ( false !== $user && isset($user->$meta_key) ) $metas = array($user->$meta_key); else $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); } else { $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); } if ( empty($metas) ) { if ( empty($meta_key) ) return array(); else return ''; } $metas = array_map('maybe_unserialize', $metas); if ( count($metas) == 1 ) return $metas[0]; else return $metas; } function update_usermeta( $user_id, $meta_key, $meta_value ) { _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); global $wpdb; if ( !is_numeric( $user_id ) ) return false; $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); if ( is_string($meta_value) ) $meta_value = stripslashes($meta_value); $meta_value = maybe_serialize($meta_value); if (empty($meta_value)) { return delete_usermeta($user_id, $meta_key); } $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); if ( $cur ) do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); if ( !$cur ) $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); elseif ( $cur->meta_value != $meta_value ) $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); else return false; clean_user_cache( $user_id ); wp_cache_delete( $user_id, 'user_meta' ); if ( !$cur ) do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); else do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); return true; } function get_users_of_blog( $id = '' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( empty( $id ) ) { $id = get_current_blog_id(); } $blog_prefix = $wpdb->get_blog_prefix($id); $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); return $users; } function automatic_feed_links( $add = true ) { _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); if ( $add ) add_theme_support( 'automatic-feed-links' ); else remove_action( 'wp_head', 'feed_links_extra', 3 ); } function get_profile( $field, $user = false ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); if ( $user ) { $user = get_user_by( 'login', $user ); $user = $user->ID; } return get_the_author_meta( $field, $user ); } function get_usernumposts( $userid ) { _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); return count_user_posts( $userid ); } function funky_javascript_callback($matches) { return "&#".base_convert($matches[1],16,10).";"; } function funky_javascript_fix($text) { _deprecated_function( __FUNCTION__, '3.0.0' ); global $is_macIE, $is_winIE; if ( $is_winIE || $is_macIE ) $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", "funky_javascript_callback", $text); return $text; } function is_taxonomy( $taxonomy ) { _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); return taxonomy_exists( $taxonomy ); } function is_term( $term, $taxonomy = '', $parent = 0 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); return term_exists( $term, $taxonomy, $parent ); } function is_plugin_page() { _deprecated_function( __FUNCTION__, '3.1.0' ); global $plugin_page; if ( isset($plugin_page) ) return true; return false; } function update_category_cache() { _deprecated_function( __FUNCTION__, '3.1.0' ); return true; } function wp_timezone_supported() { _deprecated_function( __FUNCTION__, '3.2.0' ); return true; } function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); } function get_user_metavalues($ids) { _deprecated_function( __FUNCTION__, '3.3.0' ); $objects = array(); $ids = array_map('intval', $ids); foreach ( $ids as $id ) $objects[$id] = array(); $metas = update_meta_cache('user', $ids); foreach ( $metas as $id => $meta ) { foreach ( $meta as $key => $metavalues ) { foreach ( $metavalues as $value ) { $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); } } } return $objects; } function sanitize_user_object($user, $context = 'display') { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( is_object($user) ) { if ( !isset($user->ID) ) $user->ID = 0; if ( ! ( $user instanceof WP_User ) ) { $vars = get_object_vars($user); foreach ( array_keys($vars) as $field ) { if ( is_string($user->$field) || is_numeric($user->$field) ) $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); } } $user->filter = $context; } else { if ( !isset($user['ID']) ) $user['ID'] = 0; foreach ( array_keys($user) as $field ) $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); $user['filter'] = $context; } return $user; } function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { _deprecated_function( __FUNCTION__, '3.3.0' ); $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); if ( empty($posts) ) return; $post = $posts[0]; if ( empty($post->post_title) ) $post->post_title = $start ? __('First Post') : __('Last Post'); $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = $start ? "\n"; $boundary = $start ? 'start' : 'end'; return apply_filters( "{$boundary}_post_rel_link", $link ); } function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); } function get_index_rel_link() { _deprecated_function( __FUNCTION__, '3.3.0' ); $link = "\n"; return apply_filters( "index_rel_link", $link ); } function index_rel_link() { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_index_rel_link(); } function get_parent_post_rel_link( $title = '%title' ) { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) $post = get_post($GLOBALS['post']->post_parent); if ( empty($post) ) return; $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = "\n"; return apply_filters( "parent_post_rel_link", $link ); } function parent_post_rel_link( $title = '%title' ) { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_parent_post_rel_link($title); } function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { _deprecated_function( __FUNCTION__, '3.3.0' ); $user_id = get_current_user_id(); if ( 0 != $user_id ) { if ( is_admin() ) $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); elseif ( is_multisite() ) $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); else $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); } } function is_blog_user( $blog_id = 0 ) { _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); return is_user_member_of_blog( get_current_user_id(), $blog_id ); } function debug_fopen( $filename, $mode ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); return false; } function debug_fwrite( $fp, $message ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); if ( ! empty( $GLOBALS['debug'] ) ) error_log( $message ); } function debug_fclose( $fp ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); } function get_themes() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); global $wp_themes; if ( isset( $wp_themes ) ) return $wp_themes; $themes = wp_get_themes(); $wp_themes = array(); foreach ( $themes as $theme ) { $name = $theme->get('Name'); if ( isset( $wp_themes[ $name ] ) ) $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; else $wp_themes[ $name ] = $theme; } return $wp_themes; } function get_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) return $themes[ $theme ]; return null; } function get_current_theme() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); if ( $theme = get_option( 'current_theme' ) ) return $theme; return wp_get_theme()->get('Name'); } function clean_pre($matches) { _deprecated_function( __FUNCTION__, '3.4.0' ); if ( is_array($matches) ) $text = $matches[1] . $matches[2] . ""; else $text = $matches; $text = str_replace(array('
                ', '
                ', '
                '), array('', '', ''), $text); $text = str_replace('

                ', "\n", $text); $text = str_replace('

                ', '', $text); return $text; } function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); $args = array( 'wp-head-callback' => $wp_head_callback, 'admin-head-callback' => $admin_head_callback, ); if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-header', $args ); } function remove_custom_image_header() { _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); return remove_theme_support( 'custom-header' ); } function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); $args = array(); if ( $wp_head_callback ) $args['wp-head-callback'] = $wp_head_callback; if ( $admin_head_callback ) $args['admin-head-callback'] = $admin_head_callback; if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-background', $args ); } function remove_custom_background() { _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); return remove_theme_support( 'custom-background' ); } function get_theme_data( $theme_file ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); $theme_data = array( 'Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'AuthorURI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'AuthorName' => $theme->get('Author'), ); foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { if ( ! isset( $theme_data[ $extra_header ] ) ) $theme_data[ $extra_header ] = $theme->get( $extra_header ); } return $theme_data; } function update_page_cache( &$pages ) { _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); update_post_cache( $pages ); } function clean_page_cache( $id ) { _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); clean_post_cache( $id ); } function wp_explain_nonce( $action ) { _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); return __( 'Are you sure you want to do this?' ); } function sticky_class( $post_id = null ) { _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); if ( is_sticky( $post_id ) ) echo ' sticky'; } function _get_post_ancestors( &$post ) { _deprecated_function( __FUNCTION__, '3.5.0' ); } function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); if ( is_numeric( $file ) ) $file = get_attached_file( $file ); if ( ! is_file( $file ) ) { return sprintf( __( 'File “%s” does not exist?' ), $file ); } if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); wp_raise_memory_limit( 'image' ); $image = imagecreatefromstring( file_get_contents( $file ) ); if ( ! is_gd_image( $image ) ) { return sprintf( __( 'File “%s” is not an image.' ), $file ); } return $image; } function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) return $editor; $editor->set_quality( $jpeg_quality ); $resized = $editor->resize( $max_w, $max_h, $crop ); if ( is_wp_error( $resized ) ) return $resized; $dest_file = $editor->generate_filename( $suffix, $dest_path ); $saved = $editor->save( $dest_file ); if ( is_wp_error( $saved ) ) return $saved; return $dest_file; } function wp_get_single_post( $postid = 0, $mode = OBJECT ) { _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); return get_post( $postid, $mode ); } function user_pass_ok($user_login, $user_pass) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); $user = wp_authenticate( $user_login, $user_pass ); if ( is_wp_error( $user ) ) return false; return true; } function _save_post_hook() {} function gd_edit_image_support($mime_type) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); if ( function_exists('imagetypes') ) { switch( $mime_type ) { case 'image/jpeg': return (imagetypes() & IMG_JPG) != 0; case 'image/png': return (imagetypes() & IMG_PNG) != 0; case 'image/gif': return (imagetypes() & IMG_GIF) != 0; case 'image/webp': return (imagetypes() & IMG_WEBP) != 0; } } else { switch( $mime_type ) { case 'image/jpeg': return function_exists('imagecreatefromjpeg'); case 'image/png': return function_exists('imagecreatefrompng'); case 'image/gif': return function_exists('imagecreatefromgif'); case 'image/webp': return function_exists('imagecreatefromwebp'); } } return false; } function wp_convert_bytes_to_hr( $bytes ) { _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); $log = log( $bytes, KB_IN_BYTES ); $power = (int) $log; $size = KB_IN_BYTES ** ( $log - $power ); if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { $unit = $units[ $power ]; } else { $size = $bytes; $unit = $units[0]; } return $size . $unit; } function _search_terms_tidy( $t ) { _deprecated_function( __FUNCTION__, '3.7.0' ); return trim( $t, "\"'\n\r " ); } function rich_edit_exists() { global $wp_rich_edit_exists; _deprecated_function( __FUNCTION__, '3.9.0' ); if ( ! isset( $wp_rich_edit_exists ) ) $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); return $wp_rich_edit_exists; } function default_topic_count_text( $count ) { return $count; } function format_to_post( $content ) { _deprecated_function( __FUNCTION__, '3.9.0' ); return $content; } function like_escape($text) { _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); } function url_is_accessable_via_ssl( $url ) { _deprecated_function( __FUNCTION__, '4.0.0' ); $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); if ( !is_wp_error( $response ) ) { $status = wp_remote_retrieve_response_code( $response ); if ( 200 == $status || 401 == $status ) { return true; } } return false; } function preview_theme() { _deprecated_function( __FUNCTION__, '4.3.0' ); } function _preview_theme_template_filter() { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } function _preview_theme_stylesheet_filter() { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } function preview_theme_ob_filter( $content ) { _deprecated_function( __FUNCTION__, '4.3.0' ); return $content; } function preview_theme_ob_filter_callback( $matches ) { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } function wp_richedit_pre($text) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( empty( $text ) ) { return apply_filters( 'richedit_pre', '' ); } $output = convert_chars($text); $output = wpautop($output); $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); return apply_filters( 'richedit_pre', $output ); } function wp_htmledit_pre($output) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( !empty($output) ) $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); return apply_filters( 'htmledit_pre', $output ); } function post_permalink( $post_id = 0 ) { _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); return get_permalink( $post_id ); } function wp_get_http( $url, $file_path = false, $red = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); @set_time_limit( 60 ); if ( $red > 5 ) return false; $options = array(); $options['redirection'] = 5; if ( false == $file_path ) $options['method'] = 'HEAD'; else $options['method'] = 'GET'; $response = wp_safe_remote_request( $url, $options ); if ( is_wp_error( $response ) ) return false; $headers = wp_remote_retrieve_headers( $response ); $headers['response'] = wp_remote_retrieve_response_code( $response ); if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { return wp_get_http( $headers['location'], $file_path, ++$red ); } if ( false == $file_path ) return $headers; $out_fp = fopen($file_path, 'w'); if ( !$out_fp ) return $headers; fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); fclose($out_fp); clearstatcache(); return $headers; } function force_ssl_login( $force = null ) { _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); return force_ssl_admin( $force ); } function get_comments_popup_template() { _deprecated_function( __FUNCTION__, '4.5.0' ); return ''; } function is_comments_popup() { _deprecated_function( __FUNCTION__, '4.5.0' ); return false; } function comments_popup_script() { _deprecated_function( __FUNCTION__, '4.5.0' ); } function popuplinks( $text ) { _deprecated_function( __FUNCTION__, '4.5.0' ); $text = preg_replace('//i', "", $text); return $text; } function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { _deprecated_function( __FUNCTION__, '4.6.0' ); return ''; } function get_paged_template() { _deprecated_function( __FUNCTION__, '4.7.0' ); return get_query_template( 'paged' ); } function wp_kses_js_entities( $content ) { _deprecated_function( __FUNCTION__, '4.7.0' ); return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $content ); } function _usort_terms_by_ID( $a, $b ) { _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); if ( $a->term_id > $b->term_id ) return 1; elseif ( $a->term_id < $b->term_id ) return -1; else return 0; } function _usort_terms_by_name( $a, $b ) { _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); return strcmp( $a->name, $b->name ); } function _sort_nav_menu_items( $a, $b ) { global $_menu_item_sort_prop; _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); if ( empty( $_menu_item_sort_prop ) ) return 0; if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) return 0; $_a = (int) $a->$_menu_item_sort_prop; $_b = (int) $b->$_menu_item_sort_prop; if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) return 0; elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) return $_a < $_b ? -1 : 1; else return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); } function get_shortcut_link() { _deprecated_function( __FUNCTION__, '4.9.0' ); $link = ''; return apply_filters( 'shortcut_link', $link ); } function wp_ajax_press_this_save_post() { _deprecated_function( __FUNCTION__, '4.9.0' ); if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->save_post(); } else { wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); } } function wp_ajax_press_this_add_category() { _deprecated_function( __FUNCTION__, '4.9.0' ); if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->add_category(); } else { wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); } } function wp_get_user_request_data( $request_id ) { _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' ); return wp_get_user_request( $request_id ); } function wp_make_content_images_responsive( $content ) { _deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' ); return wp_filter_content_tags( $content ); } function wp_unregister_GLOBALS() { _deprecated_function( __FUNCTION__, '5.5.0' ); } function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) { _deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' ); return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ); } function _wp_register_meta_args_whitelist( $args, $default_args ) { _deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' ); return _wp_register_meta_args_allowed_list( $args, $default_args ); } function add_option_whitelist( $new_options, $options = '' ) { _deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' ); return add_allowed_options( $new_options, $options ); } function remove_option_whitelist( $del_options, $options = '' ) { _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); return remove_allowed_options( $del_options, $options ); } function wp_slash_strings_only( $value ) { return map_deep( $value, 'addslashes_strings_only' ); } function addslashes_strings_only( $value ) { return is_string( $value ) ? addslashes( $value ) : $value; } function noindex() { _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' ); if ( '0' == get_option( 'blog_public' ) ) { wp_no_robots(); } } function wp_no_robots() { _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' ); if ( get_option( 'blog_public' ) ) { echo "\n"; return; } echo "\n"; } function wp_sensitive_page_meta() { _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' ); ?> - - supports, array( '__experimentalBorder' ), false ); return is_array( $border_support ) && array_key_exists( '__experimentalSkipSerialization', $border_support ) && $border_support['__experimentalSkipSerialization']; } function wp_skip_dimensions_serialization( $block_type ) { _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false ); return is_array( $dimensions_support ) && array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) && $dimensions_support['__experimentalSkipSerialization']; } function wp_skip_spacing_serialization( $block_type ) { _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); $spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false ); return is_array( $spacing_support ) && array_key_exists( '__experimentalSkipSerialization', $spacing_support ) && $spacing_support['__experimentalSkipSerialization']; } function wp_add_iframed_editor_assets_html() { _deprecated_function( __FUNCTION__, '6.0.0' ); } display_name : null ); } function the_author( $deprecated = '', $deprecated_echo = true ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.1.0' ); } if ( true !== $deprecated_echo ) { _deprecated_argument( __FUNCTION__, '1.5.0', sprintf( __( 'Use %s instead if you do not want the value echoed.' ), 'get_the_author()' ) ); } if ( $deprecated_echo ) { echo get_the_author(); } return get_the_author(); } function get_the_modified_author() { $last_id = get_post_meta( get_post()->ID, '_edit_last', true ); if ( $last_id ) { $last_user = get_userdata( $last_id ); return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' ); } } function the_modified_author() { echo get_the_modified_author(); } function get_the_author_meta( $field = '', $user_id = false ) { $original_user_id = $user_id; if ( ! $user_id ) { global $authordata; $user_id = isset( $authordata->ID ) ? $authordata->ID : 0; } else { $authordata = get_userdata( $user_id ); } if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) { $field = 'user_' . $field; } $value = isset( $authordata->$field ) ? $authordata->$field : ''; return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id ); } function the_author_meta( $field = '', $user_id = false ) { $author_meta = get_the_author_meta( $field, $user_id ); echo apply_filters( "the_author_{$field}", $author_meta, $user_id ); } function get_the_author_link() { if ( get_the_author_meta( 'url' ) ) { global $authordata; $author_url = get_the_author_meta( 'url' ); $author_display_name = get_the_author(); $link = sprintf( '%3$s', esc_url( $author_url ), esc_attr( sprintf( __( 'Visit %s’s website' ), $author_display_name ) ), $author_display_name ); return apply_filters( 'the_author_link', $link, $author_url, $authordata ); } else { return get_the_author(); } } function the_author_link() { echo get_the_author_link(); } function get_the_author_posts() { $post = get_post(); if ( ! $post ) { return 0; } return count_user_posts( $post->post_author, $post->post_type ); } function the_author_posts() { echo get_the_author_posts(); } function get_the_author_posts_link() { global $authordata; if ( ! is_object( $authordata ) ) { return ''; } $link = sprintf( '', esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ), esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), get_the_author() ); return apply_filters( 'the_author_posts_link', $link ); } function the_author_posts_link( $deprecated = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.1.0' ); } echo get_the_author_posts_link(); } function get_author_posts_url( $author_id, $author_nicename = '' ) { global $wp_rewrite; $author_id = (int) $author_id; $link = $wp_rewrite->get_author_permastruct(); if ( empty( $link ) ) { $file = home_url( '/' ); $link = $file . '?author=' . $author_id; } else { if ( '' === $author_nicename ) { $user = get_userdata( $author_id ); if ( ! empty( $user->user_nicename ) ) { $author_nicename = $user->user_nicename; } } $link = str_replace( '%author%', $author_nicename, $link ); $link = home_url( user_trailingslashit( $link ) ); } $link = apply_filters( 'author_link', $link, $author_id, $author_nicename ); return $link; } function wp_list_authors( $args = '' ) { global $wpdb; $defaults = array( 'orderby' => 'name', 'order' => 'ASC', 'number' => '', 'optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'exclude' => '', 'include' => '', ); $args = wp_parse_args( $args, $defaults ); $return = ''; $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); $query_args['fields'] = 'ids'; $authors = get_users( $query_args ); $author_count = array(); foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . ' GROUP BY post_author' ) as $row ) { $author_count[ $row->post_author ] = $row->count; } foreach ( $authors as $author_id ) { $posts = isset( $author_count[ $author_id ] ) ? $author_count[ $author_id ] : 0; if ( ! $posts && $args['hide_empty'] ) { continue; } $author = get_userdata( $author_id ); if ( $args['exclude_admin'] && 'admin' === $author->display_name ) { continue; } if ( $args['show_fullname'] && $author->first_name && $author->last_name ) { $name = "$author->first_name $author->last_name"; } else { $name = $author->display_name; } if ( ! $args['html'] ) { $return .= $name . ', '; continue; } if ( 'list' === $args['style'] ) { $return .= '
              • '; } $link = sprintf( '%3$s', esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ), esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ), $name ); if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { $link .= ' '; if ( empty( $args['feed_image'] ) ) { $link .= '('; } $link .= ''; } else { $link .= $name; } $link .= ''; if ( empty( $args['feed_image'] ) ) { $link .= ')'; } } if ( $args['optioncount'] ) { $link .= ' (' . $posts . ')'; } $return .= $link; $return .= ( 'list' === $args['style'] ) ? '
              • ' : ', '; } $return = rtrim( $return, ', ' ); if ( $args['echo'] ) { echo $return; } else { return $return; } } function is_multi_author() { global $wpdb; $is_multi_author = get_transient( 'is_multi_author' ); if ( false === $is_multi_author ) { $rows = (array) $wpdb->get_col( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2" ); $is_multi_author = 1 < count( $rows ) ? 1 : 0; set_transient( 'is_multi_author', $is_multi_author ); } return apply_filters( 'is_multi_author', (bool) $is_multi_author ); } function __clear_multi_author_cache() { delete_transient( 'is_multi_author' ); } scheme = $bits['scheme']; $this->server = $bits['host']; $this->port = isset( $bits['port'] ) ? $bits['port'] : $port; $this->path = ! empty( $bits['path'] ) ? $bits['path'] : '/'; if ( ! $this->path ) { $this->path = '/'; } if ( ! empty( $bits['query'] ) ) { $this->path .= '?' . $bits['query']; } } else { $this->scheme = 'http'; $this->server = $server; $this->path = $path; $this->port = $port; } $this->useragent = 'The Incutio XML-RPC PHP Library'; $this->timeout = $timeout; } public function query( ...$args ) { $method = array_shift( $args ); $request = new IXR_Request( $method, $args ); $xml = $request->getXml(); $port = $this->port ? ":$this->port" : ''; $url = $this->scheme . '://' . $this->server . $port . $this->path; $args = array( 'headers' => array( 'Content-Type' => 'text/xml' ), 'user-agent' => $this->useragent, 'body' => $xml, ); foreach ( $this->headers as $header => $value ) { $args['headers'][ $header ] = $value; } $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] ); if ( false !== $this->timeout ) { $args['timeout'] = $this->timeout; } if ( $this->debug ) { echo '
                ' . htmlspecialchars( $xml ) . "\n
                \n\n"; } $response = wp_remote_post( $url, $args ); if ( is_wp_error( $response ) ) { $errno = $response->get_error_code(); $errorstr = $response->get_error_message(); $this->error = new IXR_Error( -32300, "transport error: $errno $errorstr" ); return false; } if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { $this->error = new IXR_Error( -32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')' ); return false; } if ( $this->debug ) { echo '
                ' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n
                \n\n"; } $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) ); if ( ! $this->message->parse() ) { $this->error = new IXR_Error( -32700, 'parse error. not well formed' ); return false; } if ( 'fault' === $this->message->messageType ) { $this->error = new IXR_Error( $this->message->faultCode, $this->message->faultString ); return false; } return true; } }
                ' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the Latest Posts block, to list posts from the site.' ) . '
                '; } $rss = fetch_feed( $attributes['feedURL'] ); if ( is_wp_error( $rss ) ) { return '
                ' . __( 'RSS Error:' ) . ' ' . $rss->get_error_message() . '
                '; } if ( ! $rss->get_item_quantity() ) { return '
                ' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '
                '; } $rss_items = $rss->get_items( 0, $attributes['itemsToShow'] ); $list_items = ''; foreach ( $rss_items as $item ) { $title = esc_html( trim( strip_tags( $item->get_title() ) ) ); if ( empty( $title ) ) { $title = __( '(no title)' ); } $link = $item->get_link(); $link = esc_url( $link ); if ( $link ) { $title = "{$title}"; } $title = "
                {$title}
                "; $date = ''; if ( $attributes['displayDate'] ) { $date = $item->get_date( 'U' ); if ( $date ) { $date = sprintf( ' ', date_i18n( get_option( 'c' ), $date ), date_i18n( get_option( 'date_format' ), $date ) ); } } $author = ''; if ( $attributes['displayAuthor'] ) { $author = $item->get_author(); if ( is_object( $author ) ) { $author = $author->get_name(); $author = '' . sprintf( __( 'by %s' ), esc_html( strip_tags( $author ) ) ) . ''; } } $excerpt = ''; if ( $attributes['displayExcerpt'] ) { $excerpt = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ); $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' […]' ) ); if ( '[...]' === substr( $excerpt, -5 ) ) { $excerpt = substr( $excerpt, 0, -5 ) . '[…]'; } $excerpt = '
                ' . esc_html( $excerpt ) . '
                '; } $list_items .= "
              • {$title}{$date}{$author}{$excerpt}
              • "; } $classnames = array(); if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) { $classnames[] = 'is-grid'; } if ( isset( $attributes['columns'] ) && 'grid' === $attributes['blockLayout'] ) { $classnames[] = 'columns-' . $attributes['columns']; } if ( $attributes['displayDate'] ) { $classnames[] = 'has-dates'; } if ( $attributes['displayAuthor'] ) { $classnames[] = 'has-authors'; } if ( $attributes['displayExcerpt'] ) { $classnames[] = 'has-excerpts'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); return sprintf( '
                  %s
                ', $wrapper_attributes, $list_items ); } function register_block_core_rss() { register_block_type_from_metadata( __DIR__ . '/rss', array( 'render_callback' => 'render_block_core_rss', ) ); } add_action( 'init', 'register_block_core_rss' ); 'has-text-align-' . $attributes['textAlign'] ) : array(); $wrapper_attributes = get_block_wrapper_attributes( $extra_attributes ); return '
                ' . $term_description . '
                '; } function register_block_core_term_description() { register_block_type_from_metadata( __DIR__ . '/term-description', array( 'render_callback' => 'render_block_core_term_description', ) ); } add_action( 'init', 'register_block_core_term_description' ); parsed_block, array( 'commentId' => $comment->comment_ID, ) ) )->render( array( 'dynamic' => false ) ); $children = $comment->get_children(); $comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false ); if ( ! empty( $children ) ) { $comment_depth += 1; $inner_content = block_core_comment_template_render_comments( $children, $block ); $block_content .= sprintf( '
                  %1$s
                ', $inner_content ); $comment_depth -= 1; } $content .= sprintf( '
              • %3$s
              • ', $comment->comment_ID, $comment_classes, $block_content ); } return $content; } function render_block_core_comment_template( $attributes, $content, $block ) { if ( empty( $block->context['postId'] ) ) { return ''; } if ( post_password_required( $block->context['postId'] ) ) { return; } $comment_query = new WP_Comment_Query( build_comment_query_vars_from_block( $block ) ); $comments = $comment_query->get_comments(); if ( count( $comments ) === 0 ) { return ''; } $comment_order = get_option( 'comment_order' ); if ( 'desc' === $comment_order ) { $comments = array_reverse( $comments ); } $wrapper_attributes = get_block_wrapper_attributes(); return sprintf( '
                  %2$s
                ', $wrapper_attributes, block_core_comment_template_render_comments( $comments, $block ) ); } function register_block_core_comment_template() { register_block_type_from_metadata( __DIR__ . '/comment-template', array( 'render_callback' => 'render_block_core_comment_template', 'skip_inner_blocks' => true, ) ); } add_action( 'init', 'register_block_core_comment_template' ); context['openInNewTab'] ) ? $block->context['openInNewTab'] : false; $service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon'; $url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false; $label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service ); $show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false; if ( ! $url ) { return ''; } $rel_target_attributes = ''; if ( $open_in_new_tab ) { $rel_target_attributes = 'rel="noopener nofollow" target="_blank"'; } $icon = block_core_social_link_get_icon( $service ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'wp-social-link wp-social-link-' . $service, 'style' => block_core_social_link_get_color_styles( $block->context ), ) ); $link = '
              • '; $link .= ''; $link .= $icon; $link .= ''; $link .= esc_html( $label ); $link .= '
              • '; return $link; } function register_block_core_social_link() { register_block_type_from_metadata( __DIR__ . '/social-link', array( 'render_callback' => 'render_block_core_social_link', ) ); } add_action( 'init', 'register_block_core_social_link' ); function block_core_social_link_get_icon( $service ) { $services = block_core_social_link_services(); if ( isset( $services[ $service ] ) && isset( $services[ $service ]['icon'] ) ) { return $services[ $service ]['icon']; } return $services['share']['icon']; } function block_core_social_link_get_name( $service ) { $services = block_core_social_link_services(); if ( isset( $services[ $service ] ) && isset( $services[ $service ]['name'] ) ) { return $services[ $service ]['name']; } return $services['share']['name']; } function block_core_social_link_services( $service = '', $field = '' ) { $services_data = array( 'fivehundredpx' => array( 'name' => '500px', 'icon' => '', ), 'amazon' => array( 'name' => 'Amazon', 'icon' => '', ), 'bandcamp' => array( 'name' => 'Bandcamp', 'icon' => '', ), 'behance' => array( 'name' => 'Behance', 'icon' => '', ), 'chain' => array( 'name' => 'Link', 'icon' => '', ), 'codepen' => array( 'name' => 'CodePen', 'icon' => '', ), 'deviantart' => array( 'name' => 'DeviantArt', 'icon' => '', ), 'dribbble' => array( 'name' => 'Dribbble', 'icon' => '', ), 'dropbox' => array( 'name' => 'Dropbox', 'icon' => '', ), 'etsy' => array( 'name' => 'Etsy', 'icon' => '', ), 'facebook' => array( 'name' => 'Facebook', 'icon' => '', ), 'feed' => array( 'name' => 'RSS Feed', 'icon' => '', ), 'flickr' => array( 'name' => 'Flickr', 'icon' => '', ), 'foursquare' => array( 'name' => 'Foursquare', 'icon' => '', ), 'goodreads' => array( 'name' => 'Goodreads', 'icon' => '', ), 'google' => array( 'name' => 'Google', 'icon' => '', ), 'github' => array( 'name' => 'GitHub', 'icon' => '', ), 'instagram' => array( 'name' => 'Instagram', 'icon' => '', ), 'lastfm' => array( 'name' => 'Last.fm', 'icon' => '', ), 'linkedin' => array( 'name' => 'LinkedIn', 'icon' => '', ), 'mail' => array( 'name' => 'Mail', 'icon' => '', ), 'mastodon' => array( 'name' => 'Mastodon', 'icon' => '', ), 'meetup' => array( 'name' => 'Meetup', 'icon' => '', ), 'medium' => array( 'name' => 'Medium', 'icon' => '', ), 'patreon' => array( 'name' => 'Patreon', 'icon' => '', ), 'pinterest' => array( 'name' => 'Pinterest', 'icon' => '', ), 'pocket' => array( 'name' => 'Pocket', 'icon' => '', ), 'reddit' => array( 'name' => 'Reddit', 'icon' => '', ), 'skype' => array( 'name' => 'Skype', 'icon' => '', ), 'snapchat' => array( 'name' => 'Snapchat', 'icon' => '', ), 'soundcloud' => array( 'name' => 'Soundcloud', 'icon' => '', ), 'spotify' => array( 'name' => 'Spotify', 'icon' => '', ), 'telegram' => array( 'name' => 'Telegram', 'icon' => '', ), 'tiktok' => array( 'name' => 'TikTok', 'icon' => '', ), 'tumblr' => array( 'name' => 'Tumblr', 'icon' => '', ), 'twitch' => array( 'name' => 'Twitch', 'icon' => '', ), 'twitter' => array( 'name' => 'Twitter', 'icon' => '', ), 'vimeo' => array( 'name' => 'Vimeo', 'icon' => '', ), 'vk' => array( 'name' => 'VK', 'icon' => '', ), 'wordpress' => array( 'name' => 'WordPress', 'icon' => '', ), 'yelp' => array( 'name' => 'Yelp', 'icon' => '', ), 'youtube' => array( 'name' => 'YouTube', 'icon' => '', ), 'share' => array( 'name' => 'Share Icon', 'icon' => '', ), ); if ( ! empty( $service ) && ! empty( $field ) && isset( $services_data[ $service ] ) && ( 'icon' === $field || 'name' === $field ) ) { return $services_data[ $service ][ $field ]; } elseif ( ! empty( $service ) && isset( $services_data[ $service ] ) ) { return $services_data[ $service ]; } return $services_data; } function block_core_social_link_get_color_styles( $context ) { $styles = array(); if ( array_key_exists( 'iconColorValue', $context ) ) { $styles[] = 'color: ' . $context['iconColorValue'] . '; '; } if ( array_key_exists( 'iconBackgroundColorValue', $context ) ) { $styles[] = 'background-color: ' . $context['iconBackgroundColorValue'] . '; '; } return implode( '', $styles ); } context['postId'] ) ) { return ''; } $post_ID = $block->context['postId']; $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}"; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) ); $more_text = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' ); return sprintf( '%4s', $wrapper_attributes, get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), $more_text ); } function register_block_core_read_more() { register_block_type_from_metadata( __DIR__ . '/read-more', array( 'render_callback' => 'render_block_core_read_more', ) ); } add_action( 'init', 'register_block_core_read_more' ); $align_class_name ) ); return sprintf( '

                %2$s

                ', $wrapper_attributes, $site_tagline ); } function register_block_core_site_tagline() { register_block_type_from_metadata( __DIR__ . '/site-tagline', array( 'render_callback' => 'render_block_core_site_tagline', ) ); } add_action( 'init', 'register_block_core_site_tagline' ); $type, 'format' => 'option', 'show_post_count' => $show_post_count, ) ); $dropdown_args['echo'] = 0; $archives = wp_get_archives( $dropdown_args ); $classnames = esc_attr( $class ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) ); switch ( $dropdown_args['type'] ) { case 'yearly': $label = __( 'Select Year' ); break; case 'monthly': $label = __( 'Select Month' ); break; case 'daily': $label = __( 'Select Day' ); break; case 'weekly': $label = __( 'Select Week' ); break; default: $label = __( 'Select Post' ); break; } $block_content = ' - '; return sprintf( '
                %2$s
                ', $wrapper_attributes, $block_content ); } $class .= ' wp-block-archives-list'; $archives_args = apply_filters( 'widget_archives_args', array( 'type' => $type, 'show_post_count' => $show_post_count, ) ); $archives_args['echo'] = 0; $archives = wp_get_archives( $archives_args ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) ); if ( empty( $archives ) ) { return sprintf( '
                %2$s
                ', $wrapper_attributes, __( 'No archives to show.' ) ); } return sprintf( '
                  %2$s
                ', $wrapper_attributes, $archives ); } function register_block_core_archives() { register_block_type_from_metadata( __DIR__ . '/archives', array( 'render_callback' => 'render_block_core_archives', ) ); } add_action( 'init', 'register_block_core_archives' ); $inner_block ) { if ( 'core/image' === $inner_block['blockName'] ) { if ( ! isset( $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) && isset( $inner_block['attrs']['id'] ) ) { $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] = esc_attr( $inner_block['attrs']['id'] ); } } } } return $parsed_block; } add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' ); function block_core_gallery_render( $attributes, $content ) { $gap = _wp_array_get( $attributes, array( 'style', 'spacing', 'blockGap' ) ); if ( is_array( $gap ) ) { foreach ( $gap as $key => $value ) { $gap[ $key ] = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value; } } else { $gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap; } $class = wp_unique_id( 'wp-block-gallery-' ); $content = preg_replace( '/' . preg_quote( 'class="', '/' ) . '/', 'class="' . $class . ' ', $content, 1 ); $fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )'; $gap_value = $gap ? $gap : $fallback_gap; $gap_column = $gap_value; if ( is_array( $gap_value ) ) { $gap_row = isset( $gap_value['top'] ) ? $gap_value['top'] : $fallback_gap; $gap_column = isset( $gap_value['left'] ) ? $gap_value['left'] : $fallback_gap; $gap_value = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column; } $style = '.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_column . '; gap: ' . $gap_value . '}'; add_action( 'wp_footer', function () use ( $style ) { echo ''; }, 11 ); return $content; } function register_block_core_gallery() { register_block_type_from_metadata( __DIR__ . '/gallery', array( 'render_callback' => 'block_core_gallery_render', ) ); } add_action( 'init', 'register_block_core_gallery' ); context['postId'] ) ) { return ''; } $post_ID = $block->context['postId']; $title = get_the_title(); if ( ! $title ) { return ''; } $tag_name = 'h2'; $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; if ( isset( $attributes['level'] ) ) { $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level']; } if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $title = sprintf( '%4$s', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), esc_attr( $attributes['rel'] ), $title ); } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); return sprintf( '<%1$s %2$s>%3$s', $tag_name, $wrapper_attributes, $title ); } function register_block_core_post_title() { register_block_type_from_metadata( __DIR__ . '/post-title', array( 'render_callback' => 'render_block_core_post_title', ) ); } add_action( 'init', 'register_block_core_post_title' ); $attributes['postsToShow'], 'post_status' => 'publish', 'order' => $attributes['order'], 'orderby' => $attributes['orderBy'], 'ignore_sticky_posts' => true, 'no_found_rows' => true, ); $block_core_latest_posts_excerpt_length = $attributes['excerptLength']; add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 ); if ( isset( $attributes['categories'] ) ) { $args['category__in'] = array_column( $attributes['categories'], 'id' ); } if ( isset( $attributes['selectedAuthor'] ) ) { $args['author'] = $attributes['selectedAuthor']; } $query = new WP_Query; $recent_posts = $query->query( $args ); if ( isset( $attributes['displayFeaturedImage'] ) && $attributes['displayFeaturedImage'] ) { update_post_thumbnail_cache( $query ); } $list_items_markup = ''; foreach ( $recent_posts as $post ) { $post_link = esc_url( get_permalink( $post ) ); $title = get_the_title( $post ); if ( ! $title ) { $title = __( '(no title)' ); } $list_items_markup .= '
              • '; if ( $attributes['displayFeaturedImage'] && has_post_thumbnail( $post ) ) { $image_style = ''; if ( isset( $attributes['featuredImageSizeWidth'] ) ) { $image_style .= sprintf( 'max-width:%spx;', $attributes['featuredImageSizeWidth'] ); } if ( isset( $attributes['featuredImageSizeHeight'] ) ) { $image_style .= sprintf( 'max-height:%spx;', $attributes['featuredImageSizeHeight'] ); } $image_classes = 'wp-block-latest-posts__featured-image'; if ( isset( $attributes['featuredImageAlign'] ) ) { $image_classes .= ' align' . $attributes['featuredImageAlign']; } $featured_image = get_the_post_thumbnail( $post, $attributes['featuredImageSizeSlug'], array( 'style' => esc_attr( $image_style ), ) ); if ( $attributes['addLinkToFeaturedImage'] ) { $featured_image = sprintf( '%3$s', esc_url( $post_link ), esc_attr( $title ), $featured_image ); } $list_items_markup .= sprintf( '
                %2$s
                ', esc_attr( $image_classes ), $featured_image ); } $list_items_markup .= sprintf( '%2$s', esc_url( $post_link ), $title ); if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) { $author_display_name = get_the_author_meta( 'display_name', $post->post_author ); $byline = sprintf( __( 'by %s' ), $author_display_name ); if ( ! empty( $author_display_name ) ) { $list_items_markup .= sprintf( '', $byline ); } } if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) { $list_items_markup .= sprintf( '', esc_attr( get_the_date( 'c', $post ) ), get_the_date( '', $post ) ); } if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent'] && isset( $attributes['displayPostContentRadio'] ) && 'excerpt' === $attributes['displayPostContentRadio'] ) { $trimmed_excerpt = get_the_excerpt( $post ); if ( post_password_required( $post ) ) { $trimmed_excerpt = __( 'This content is password protected.' ); } $list_items_markup .= sprintf( '
                %1$s
                ', $trimmed_excerpt ); } if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent'] && isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) { $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) ); if ( post_password_required( $post ) ) { $post_content = __( 'This content is password protected.' ); } $list_items_markup .= sprintf( '
                %1$s
                ', wp_kses_post( $post_content ) ); } $list_items_markup .= "
              • \n"; } remove_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 ); $class = 'wp-block-latest-posts__list'; if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) { $class .= ' is-grid'; } if ( isset( $attributes['columns'] ) && 'grid' === $attributes['postLayout'] ) { $class .= ' columns-' . $attributes['columns']; } if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) { $class .= ' has-dates'; } if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) { $class .= ' has-author'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) ); return sprintf( '
                  %2$s
                ', $wrapper_attributes, $list_items_markup ); } function register_block_core_latest_posts() { register_block_type_from_metadata( __DIR__ . '/latest-posts', array( 'render_callback' => 'render_block_core_latest_posts', ) ); } add_action( 'init', 'register_block_core_latest_posts' ); function block_core_latest_posts_migrate_categories( $block ) { if ( 'core/latest-posts' === $block['blockName'] && ! empty( $block['attrs']['categories'] ) && is_string( $block['attrs']['categories'] ) ) { $block['attrs']['categories'] = array( array( 'id' => absint( $block['attrs']['categories'] ) ), ); } return $block; } add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' ); context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; $query_args = build_query_vars_from_query_block( $block, $page ); $use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ); if ( $use_global_query ) { global $wp_query; if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) { $query_args = wp_parse_args( $wp_query->query_vars, $query_args ); } } $query = new WP_Query( $query_args ); if ( $query->have_posts() ) { return ''; } wp_reset_postdata(); return sprintf( '
                %2$s
                ', get_block_wrapper_attributes(), $content ); } function register_block_core_query_no_results() { register_block_type_from_metadata( __DIR__ . '/query-no-results', array( 'render_callback' => 'render_block_core_query_no_results', ) ); } add_action( 'init', 'register_block_core_query_no_results' ); context['commentId'] ) ) { return ''; } $comment = get_comment( $block->context['commentId'] ); $commenter = wp_get_current_commenter(); $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; if ( empty( $comment ) ) { return ''; } $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); $comment_author = get_comment_author( $comment ); $link = get_comment_author_url( $comment ); if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) { $comment_author = sprintf( '%3s', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author ); } if ( '0' === $comment->comment_approved && ! $show_pending_links ) { $comment_author = wp_kses( $comment_author, array() ); } return sprintf( '
                %2$s
                ', $wrapper_attributes, $comment_author ); } function register_block_core_comment_author_name() { register_block_type_from_metadata( __DIR__ . '/comment-author-name', array( 'render_callback' => 'render_block_core_comment_author_name', ) ); } add_action( 'init', 'register_block_core_comment_author_name' ); context['postId'] ) ) { return ''; } $comment_vars = build_comment_query_vars_from_block( $block ); $max_page = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages; $default_label = __( 'Newer Comments' ); $label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label; $pagination_arrow = get_comments_pagination_arrow( $block, 'next' ); $filter_link_attributes = function() { return get_block_wrapper_attributes(); }; add_filter( 'next_comments_link_attributes', $filter_link_attributes ); if ( $pagination_arrow ) { $label .= $pagination_arrow; } $next_comments_link = get_next_comments_link( $label, $max_page ); remove_filter( 'next_posts_link_attributes', $filter_link_attributes ); if ( ! isset( $next_comments_link ) ) { return ''; } return $next_comments_link; } function register_block_core_comments_pagination_next() { register_block_type_from_metadata( __DIR__ . '/comments-pagination-next', array( 'render_callback' => 'render_block_core_comments_pagination_next', ) ); } add_action( 'init', 'register_block_core_comments_pagination_next' ); 'render_block_core_shortcode', ) ); } add_action( 'init', 'register_block_core_shortcode' ); 'render_block_core_comments_pagination_previous', ) ); } add_action( 'init', 'register_block_core_comments_pagination_previous' ); context['postId'] ) || ! isset( $attributes['term'] ) ) { return ''; } if ( ! is_taxonomy_viewable( $attributes['term'] ) ) { return ''; } $post_terms = get_the_terms( $block->context['postId'], $attributes['term'] ); if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) { return ''; } $classes = 'taxonomy-' . $attributes['term']; if ( isset( $attributes['textAlign'] ) ) { $classes .= ' has-text-align-' . $attributes['textAlign']; } $separator = empty( $attributes['separator'] ) ? ' ' : $attributes['separator']; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return get_the_term_list( $block->context['postId'], $attributes['term'], "
                ", '' . esc_html( $separator ) . '', '
                ' ); } function register_block_core_post_terms() { register_block_type_from_metadata( __DIR__ . '/post-terms', array( 'render_callback' => 'render_block_core_post_terms', ) ); } add_action( 'init', 'register_block_core_post_terms' ); context['postId'] ) ) { return ''; } if ( post_password_required( $block->context['postId'] ) ) { return; } $classes = 'comment-respond'; if ( isset( $attributes['textAlign'] ) ) { $classes .= ' has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' ); ob_start(); comment_form( array(), $block->context['postId'] ); $form = ob_get_clean(); remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' ); $form = str_replace( 'class="comment-respond"', $wrapper_attributes, $form ); wp_enqueue_script( 'comment-reply' ); return $form; } function register_block_core_post_comments_form() { register_block_type_from_metadata( __DIR__ . '/post-comments-form', array( 'render_callback' => 'render_block_core_post_comments_form', ) ); } add_action( 'init', 'register_block_core_post_comments_form' ); function post_comments_form_block_form_defaults( $fields ) { if ( wp_is_block_theme() ) { $fields['submit_button'] = ''; $fields['submit_field'] = '

                %1$s %2$s

                '; } return $fields; } 'navigation', 'aria-label' => __( 'Pagination' ), ) ); return sprintf( '', $wrapper_attributes, $content ); } function register_block_core_query_pagination() { register_block_type_from_metadata( __DIR__ . '/query-pagination', array( 'render_callback' => 'render_block_core_query_pagination', ) ); } add_action( 'init', 'register_block_core_query_pagination' ); false ) ); } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return '
                ' . $contents . '
                '; } function register_block_core_loginout() { register_block_type_from_metadata( __DIR__ . '/loginout', array( 'render_callback' => 'render_block_core_loginout', ) ); } add_action( 'init', 'register_block_core_loginout' ); context['postId'] ) ) { return ''; } $post_ID = $block->context['postId']; $size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail'; $post_title = trim( strip_tags( get_the_title( $post_ID ) ) ); $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, array( 'alt' => $post_title ) ); if ( ! $featured_image ) { return ''; } $wrapper_attributes = get_block_wrapper_attributes(); if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $featured_image = sprintf( '%2s', get_the_permalink( $post_ID ), $featured_image ); } $has_width = ! empty( $attributes['width'] ); $has_height = ! empty( $attributes['height'] ); if ( ! $has_height && ! $has_width ) { return "
                $featured_image
                "; } if ( $has_width ) { $wrapper_attributes = get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) ); } if ( $has_height ) { $image_styles = "height:{$attributes['height']};"; if ( ! empty( $attributes['scale'] ) ) { $image_styles .= "object-fit:{$attributes['scale']};"; } $featured_image = str_replace( 'src=', 'style="' . esc_attr( $image_styles ) . '" src=', $featured_image ); } return "
                $featured_image
                "; } function register_block_core_post_featured_image() { register_block_type_from_metadata( __DIR__ . '/post-featured-image', array( 'render_callback' => 'render_block_core_post_featured_image', ) ); } add_action( 'init', 'register_block_core_post_featured_image' ); 'render_block_core_file', ) ); } add_action( 'init', 'register_block_core_file' ); name ) { return true; } if ( 'core/cover' === $block->name && ! empty( $block->attributes['useFeaturedImage'] ) ) { return true; } if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { return true; } } return false; } function render_block_core_post_template( $attributes, $content, $block ) { $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; $query_args = build_query_vars_from_query_block( $block, $page ); $use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ); if ( $use_global_query ) { global $wp_query; if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) { unset( $query_args['offset'] ); $query_args = wp_parse_args( $wp_query->query_vars, $query_args ); if ( empty( $query_args['post_type'] ) && is_singular() ) { $query_args['post_type'] = get_post_type( get_the_ID() ); } } } $query = new WP_Query( $query_args ); if ( ! $query->have_posts() ) { return ''; } if ( block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { update_post_thumbnail_cache( $query ); } $classnames = ''; if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) { if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) { $classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}"; } } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) ); $content = ''; while ( $query->have_posts() ) { $query->the_post(); $block_instance = $block->parsed_block; $block_instance['blockName'] = 'core/null'; $block_content = ( new WP_Block( $block_instance, array( 'postType' => get_post_type(), 'postId' => get_the_ID(), ) ) )->render( array( 'dynamic' => false ) ); $post_classes = implode( ' ', get_post_class( 'wp-block-post' ) ); $content .= '
              • ' . $block_content . '
              • '; } wp_reset_postdata(); return sprintf( '
                  %2$s
                ', $wrapper_attributes, $content ); } function register_block_core_post_template() { register_block_type_from_metadata( __DIR__ . '/post-template', array( 'render_callback' => 'render_block_core_post_template', 'skip_inner_blocks' => true, ) ); } add_action( 'init', 'register_block_core_post_template' ); (.*?)#i', '\1', $custom_logo ); } if ( $attributes['isLink'] && '_blank' === $attributes['linkTarget'] ) { $aria_label = 'aria-label="' . esc_attr__( '(Home link, opens in a new tab)' ) . '"'; $custom_logo = str_replace( 'rel="home"', 'rel="home" target="' . esc_attr( $attributes['linkTarget'] ) . '"' . $aria_label, $custom_logo ); } $classnames = array(); if ( empty( $attributes['width'] ) ) { $classnames[] = 'is-default-size'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); $html = sprintf( '
                %s
                ', $wrapper_attributes, $custom_logo ); return $html; } function register_block_core_site_logo_setting() { register_setting( 'general', 'site_logo', array( 'show_in_rest' => array( 'name' => 'site_logo', ), 'type' => 'integer', 'description' => __( 'Site logo.' ), ) ); } add_action( 'rest_api_init', 'register_block_core_site_logo_setting', 10 ); function register_block_core_site_icon_setting() { register_setting( 'general', 'site_icon', array( 'show_in_rest' => true, 'type' => 'integer', 'description' => __( 'Site icon.' ), ) ); } add_action( 'rest_api_init', 'register_block_core_site_icon_setting', 10 ); function register_block_core_site_logo() { register_block_type_from_metadata( __DIR__ . '/site-logo', array( 'render_callback' => 'render_block_core_site_logo', ) ); } add_action( 'init', 'register_block_core_site_logo' ); function _override_custom_logo_theme_mod( $custom_logo ) { $site_logo = get_option( 'site_logo' ); return false === $site_logo ? $custom_logo : $site_logo; } add_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' ); function _sync_custom_logo_to_site_logo( $value ) { if ( empty( $value ) ) { delete_option( 'site_logo' ); } else { update_option( 'site_logo', $value ); } return $value; } add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' ); function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) { global $_ignore_site_logo_changes; if ( $_ignore_site_logo_changes ) { return; } if ( isset( $old_value['custom_logo'] ) && ! isset( $value['custom_logo'] ) ) { delete_option( 'site_logo' ); } } function _delete_site_logo_on_remove_theme_mods() { global $_ignore_site_logo_changes; if ( $_ignore_site_logo_changes ) { return; } if ( false !== get_theme_support( 'custom-logo' ) ) { delete_option( 'site_logo' ); } } function _delete_site_logo_on_remove_custom_logo_on_setup_theme() { $theme = get_option( 'stylesheet' ); add_action( "update_option_theme_mods_$theme", '_delete_site_logo_on_remove_custom_logo', 10, 2 ); add_action( "delete_option_theme_mods_$theme", '_delete_site_logo_on_remove_theme_mods' ); } add_action( 'setup_theme', '_delete_site_logo_on_remove_custom_logo_on_setup_theme', 11 ); function _delete_custom_logo_on_remove_site_logo() { global $_ignore_site_logo_changes; $_ignore_site_logo_changes = true; remove_theme_mod( 'custom_logo' ); $_ignore_site_logo_changes = false; } add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' ); get_widget_key( $id_base ); $widget_object = $wp_widget_factory->get_widget_object( $id_base ); if ( ! $widget_key || ! $widget_object ) { return ''; } if ( isset( $attributes['instance']['encoded'], $attributes['instance']['hash'] ) ) { $serialized_instance = base64_decode( $attributes['instance']['encoded'] ); if ( wp_hash( $serialized_instance ) !== $attributes['instance']['hash'] ) { return ''; } $instance = unserialize( $serialized_instance ); } else { $instance = array(); } $args = array( 'widget_id' => $widget_object->id, 'widget_name' => $widget_object->name, ); ob_start(); the_widget( $widget_key, $instance, $args ); return ob_get_clean(); } function register_block_core_legacy_widget() { register_block_type_from_metadata( __DIR__ . '/legacy-widget', array( 'render_callback' => 'render_block_core_legacy_widget', ) ); } add_action( 'init', 'register_block_core_legacy_widget' ); function handle_legacy_widget_preview_iframe() { if ( empty( $_GET['legacy-widget-preview'] ) ) { return; } if ( ! current_user_can( 'edit_theme_options' ) ) { return; } define( 'IFRAME_REQUEST', true ); ?> - - > - - - - - - - - > -
                -
                - get_registered( 'core/legacy-widget' ); echo $block->render( $_GET['legacy-widget-preview'] ); ?> -
                -
                - - - - context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; $max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0; $wrapper_attributes = get_block_wrapper_attributes(); $default_label = __( 'Next Page' ); $label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? esc_html( $attributes['label'] ) : $default_label; $pagination_arrow = get_query_pagination_arrow( $block, true ); if ( $pagination_arrow ) { $label .= $pagination_arrow; } $content = ''; if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) { $filter_link_attributes = function() use ( $wrapper_attributes ) { return $wrapper_attributes; }; add_filter( 'next_posts_link_attributes', $filter_link_attributes ); global $wp_query; if ( $max_page > $wp_query->max_num_pages ) { $max_page = $wp_query->max_num_pages; } $content = get_next_posts_link( $label, $max_page ); remove_filter( 'next_posts_link_attributes', $filter_link_attributes ); } elseif ( ! $max_page || $max_page > $page ) { $custom_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) ); $custom_query_max_pages = (int) $custom_query->max_num_pages; if ( $custom_query_max_pages && $custom_query_max_pages !== $page ) { $content = sprintf( '%3$s', esc_url( add_query_arg( $page_key, $page + 1 ) ), $wrapper_attributes, $label ); } wp_reset_postdata(); } return $content; } function register_block_core_query_pagination_next() { register_block_type_from_metadata( __DIR__ . '/query-pagination-next', array( 'render_callback' => 'render_block_core_query_pagination_next', ) ); } add_action( 'init', 'register_block_core_query_pagination_next' ); $align_class_name ) ); $comments_count = get_comments_number(); $post_title = sprintf( __( '“%s”' ), get_the_title() ); $tag_name = 'h2'; if ( isset( $attributes['level'] ) ) { $tag_name = 'h' . $attributes['level']; } if ( '0' === $comments_count ) { return; } if ( $show_comments_count ) { if ( $show_post_title ) { if ( '1' === $comments_count ) { $comments_title = sprintf( __( 'One response to %s' ), $post_title ); } else { $comments_title = sprintf( _n( '%1$s response to %2$s', '%1$s responses to %2$s', $comments_count ), number_format_i18n( $comments_count ), $post_title ); } } elseif ( '1' === $comments_count ) { $comments_title = __( 'One response' ); } else { $comments_title = sprintf( _n( '%s responses', '%s responses', $comments_count ), number_format_i18n( $comments_count ) ); } } elseif ( $show_post_title ) { if ( '1' === $comments_count ) { $comments_title = sprintf( __( 'Response to %s' ), $post_title ); } else { $comments_title = sprintf( __( 'Responses to %s' ), $post_title ); } } elseif ( '1' === $comments_count ) { $comments_title = __( 'Response' ); } else { $comments_title = __( 'Responses' ); } return sprintf( '<%1$s id="comments" %2$s>%3$s', $tag_name, $wrapper_attributes, $comments_title ); } function register_block_core_comments_title() { register_block_type_from_metadata( __DIR__ . '/comments-title', array( 'render_callback' => 'render_block_core_comments_title', ) ); } add_action( 'init', 'register_block_core_comments_title' ); context['postId'] ) ) { return ''; } $post_ID = $block->context['postId']; $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); $formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $formatted_date = sprintf( '%2s', get_the_permalink( $post_ID ), $formatted_date ); } return sprintf( '
                ', $wrapper_attributes, esc_attr( get_the_date( 'c', $post_ID ) ), $formatted_date ); } function register_block_core_post_date() { register_block_type_from_metadata( __DIR__ . '/post-date', array( 'render_callback' => 'render_block_core_post_date', ) ); } add_action( 'init', 'register_block_core_post_date' ); %2$s', implode( ' ', $link_attrs ), esc_html( $site_title ) ); } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); return sprintf( '<%1$s %2$s>%3$s', $tag_name, $wrapper_attributes, $attributes['isLink'] ? $site_title : esc_html( $site_title ) ); } function register_block_core_site_title() { register_block_type_from_metadata( __DIR__ . '/site-title', array( 'render_callback' => 'render_block_core_site_title', ) ); } add_action( 'init', 'register_block_core_site_title' ); 'render_block_core_pattern', ) ); } function render_block_core_pattern( $attributes ) { if ( empty( $attributes['slug'] ) ) { return ''; } $slug = $attributes['slug']; $registry = WP_Block_Patterns_Registry::get_instance(); if ( ! $registry->is_registered( $slug ) ) { return ''; } $pattern = $registry->get_registered( $slug ); return do_blocks( $pattern['content'] ); } add_action( 'init', 'register_block_core_pattern' ); context['commentId'] ) ) { return ''; } $comment = get_comment( $block->context['commentId'] ); $commenter = wp_get_current_commenter(); $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; if ( empty( $comment ) ) { return ''; } $args = array(); $comment_text = get_comment_text( $comment, $args ); if ( ! $comment_text ) { return ''; } $comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args ); $moderation_note = ''; if ( '0' === $comment->comment_approved ) { $commenter = wp_get_current_commenter(); if ( $commenter['comment_author_email'] ) { $moderation_note = __( 'Your comment is awaiting moderation.' ); } else { $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' ); } $moderation_note = '

                ' . $moderation_note . '

                '; if ( ! $show_pending_links ) { $comment_text = wp_kses( $comment_text, array() ); } } $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return sprintf( '
                %2$s%3$s
                ', $wrapper_attributes, $moderation_note, $comment_text ); } function register_block_core_comment_content() { register_block_type_from_metadata( __DIR__ . '/comment-content', array( 'render_callback' => 'render_block_core_comment_content', ) ); } add_action( 'init', 'register_block_core_comment_content' ); __( 'Search' ), 'buttonText' => __( 'Search' ), ) ); $input_id = 'wp-block-search__input-' . ++$instance_id; $classnames = classnames_for_block_core_search( $attributes ); $show_label = ( ! empty( $attributes['showLabel'] ) ) ? true : false; $use_icon_button = ( ! empty( $attributes['buttonUseIcon'] ) ) ? true : false; $show_input = ( ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition'] ) ? false : true; $show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true; $input_markup = ''; $button_markup = ''; $inline_styles = styles_for_block_core_search( $attributes ); $color_classes = get_color_classes_for_block_core_search( $attributes ); $is_button_inside = ! empty( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition']; $border_color_classes = get_border_color_classes_for_block_core_search( $attributes ); $label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] ); $label_markup = sprintf( '', esc_attr( $input_id ), $label_inner_html ); if ( $show_label && ! empty( $attributes['label'] ) ) { $label_markup = sprintf( '', $input_id, $label_inner_html ); } if ( $show_input ) { $input_classes = ! $is_button_inside ? $border_color_classes : ''; $input_markup = sprintf( '', $input_id, esc_attr( $input_classes ), esc_attr( get_search_query() ), esc_attr( $attributes['placeholder'] ), $inline_styles['input'] ); } if ( $show_button ) { $button_internal_markup = ''; $button_classes = $color_classes; $aria_label = ''; if ( ! $is_button_inside ) { $button_classes .= ' ' . $border_color_classes; } if ( ! $use_icon_button ) { if ( ! empty( $attributes['buttonText'] ) ) { $button_internal_markup = wp_kses_post( $attributes['buttonText'] ); } } else { $aria_label = sprintf( 'aria-label="%s"', esc_attr( wp_strip_all_tags( $attributes['buttonText'] ) ) ); $button_classes .= ' has-icon'; $button_internal_markup = ' - - '; } $button_markup = sprintf( '', esc_attr( $button_classes ), $inline_styles['button'], $aria_label, $button_internal_markup ); } $field_markup_classes = $is_button_inside ? $border_color_classes : ''; $field_markup = sprintf( '
                %s
                ', esc_attr( $field_markup_classes ), $inline_styles['wrapper'], $input_markup . $button_markup ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) ); return sprintf( '
                %s
                ', esc_url( home_url( '/' ) ), $wrapper_attributes, $label_markup . $field_markup ); } function register_block_core_search() { register_block_type_from_metadata( __DIR__ . '/search', array( 'render_callback' => 'render_block_core_search', ) ); } add_action( 'init', 'register_block_core_search' ); function classnames_for_block_core_search( $attributes ) { $classnames = array(); if ( ! empty( $attributes['buttonPosition'] ) ) { if ( 'button-inside' === $attributes['buttonPosition'] ) { $classnames[] = 'wp-block-search__button-inside'; } if ( 'button-outside' === $attributes['buttonPosition'] ) { $classnames[] = 'wp-block-search__button-outside'; } if ( 'no-button' === $attributes['buttonPosition'] ) { $classnames[] = 'wp-block-search__no-button'; } if ( 'button-only' === $attributes['buttonPosition'] ) { $classnames[] = 'wp-block-search__button-only'; } } if ( isset( $attributes['buttonUseIcon'] ) ) { if ( ! empty( $attributes['buttonPosition'] ) && 'no-button' !== $attributes['buttonPosition'] ) { if ( $attributes['buttonUseIcon'] ) { $classnames[] = 'wp-block-search__icon-button'; } else { $classnames[] = 'wp-block-search__text-button'; } } } return implode( ' ', $classnames ); } function styles_for_block_core_search( $attributes ) { $wrapper_styles = array(); $button_styles = array(); $input_styles = array(); $is_button_inside = ! empty( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition']; $has_width = ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] ); $button_only = ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition']; if ( $has_width && ! $button_only ) { $wrapper_styles[] = sprintf( 'width: %d%s;', esc_attr( $attributes['width'] ), esc_attr( $attributes['widthUnit'] ) ); } $has_border_width = ! empty( $attributes['style']['border']['width'] ); if ( $has_border_width ) { $border_width = $attributes['style']['border']['width']; if ( $is_button_inside ) { $wrapper_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) ); } else { $button_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) ); $input_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) ); } } $has_border_radius = ! empty( $attributes['style']['border']['radius'] ); if ( $has_border_radius ) { $default_padding = '4px'; $border_radius = $attributes['style']['border']['radius']; if ( is_array( $border_radius ) ) { foreach ( $border_radius as $key => $value ) { if ( null !== $value ) { $name = strtolower( preg_replace( '/(? ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '', 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '', 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '', ); } function get_border_color_classes_for_block_core_search( $attributes ) { $has_custom_border_color = ! empty( $attributes['style']['border']['color'] ); $border_color_classes = ! empty( $attributes['borderColor'] ) ? sprintf( 'has-border-color has-%s-border-color', $attributes['borderColor'] ) : ''; if ( $has_custom_border_color && empty( $attributes['borderColor'] ) ) { $border_color_classes = 'has-border-color'; } return $border_color_classes; } function get_color_classes_for_block_core_search( $attributes ) { $classnames = array(); $has_named_text_color = ! empty( $attributes['textColor'] ); $has_custom_text_color = ! empty( $attributes['style']['color']['text'] ); if ( $has_named_text_color ) { $classnames[] = sprintf( 'has-text-color has-%s-color', $attributes['textColor'] ); } elseif ( $has_custom_text_color ) { $classnames[] = 'has-text-color'; } $has_named_background_color = ! empty( $attributes['backgroundColor'] ); $has_custom_background_color = ! empty( $attributes['style']['color']['background'] ); $has_named_gradient = ! empty( $attributes['gradient'] ); $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] ); if ( $has_named_background_color || $has_custom_background_color || $has_named_gradient || $has_custom_gradient ) { $classnames[] = 'has-background'; } if ( $has_named_background_color ) { $classnames[] = sprintf( 'has-%s-background-color', $attributes['backgroundColor'] ); } if ( $has_named_gradient ) { $classnames[] = sprintf( 'has-%s-gradient-background', $attributes['gradient'] ); } return implode( ' ', $classnames ); } array(), 'inline_styles' => '', ); $is_sub_menu = isset( $attributes['isTopLevelItem'] ) ? ( ! $attributes['isTopLevelItem'] ) : false; $named_text_color = null; $custom_text_color = null; if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) { $custom_text_color = $context['customOverlayTextColor']; } elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) { $named_text_color = $context['overlayTextColor']; } elseif ( array_key_exists( 'customTextColor', $context ) ) { $custom_text_color = $context['customTextColor']; } elseif ( array_key_exists( 'textColor', $context ) ) { $named_text_color = $context['textColor']; } elseif ( isset( $context['style']['color']['text'] ) ) { $custom_text_color = $context['style']['color']['text']; } if ( ! is_null( $named_text_color ) ) { array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) ); } elseif ( ! is_null( $custom_text_color ) ) { $colors['css_classes'][] = 'has-text-color'; $colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color ); } $named_background_color = null; $custom_background_color = null; if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) { $custom_background_color = $context['customOverlayBackgroundColor']; } elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) { $named_background_color = $context['overlayBackgroundColor']; } elseif ( array_key_exists( 'customBackgroundColor', $context ) ) { $custom_background_color = $context['customBackgroundColor']; } elseif ( array_key_exists( 'backgroundColor', $context ) ) { $named_background_color = $context['backgroundColor']; } elseif ( isset( $context['style']['color']['background'] ) ) { $custom_background_color = $context['style']['color']['background']; } if ( ! is_null( $named_background_color ) ) { array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) ); } elseif ( ! is_null( $custom_background_color ) ) { $colors['css_classes'][] = 'has-background'; $colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color ); } return $colors; } function block_core_navigation_submenu_build_css_font_sizes( $context ) { $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $context ); $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); if ( $has_named_font_size ) { $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); } elseif ( $has_custom_font_size ) { $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); } return $font_sizes; } function block_core_navigation_submenu_render_submenu_icon() { return ''; } function render_block_core_navigation_submenu( $attributes, $content, $block ) { $navigation_link_has_id = isset( $attributes['id'] ) && is_numeric( $attributes['id'] ); $is_post_type = isset( $attributes['kind'] ) && 'post-type' === $attributes['kind']; $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); if ( $is_post_type && $navigation_link_has_id && 'publish' !== get_post_status( $attributes['id'] ) ) { return ''; } if ( empty( $attributes['label'] ) ) { return ''; } $colors = block_core_navigation_submenu_build_css_colors( $block->context, $attributes ); $font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'] ); $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] ); $css_classes = trim( implode( ' ', $classes ) ); $has_submenu = count( $block->inner_blocks ) > 0; $is_active = ! empty( $attributes['id'] ) && ( get_the_ID() === $attributes['id'] ); $show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon']; $open_on_click = isset( $block->context['openSubmenusOnClick'] ) && $block->context['openSubmenusOnClick']; $open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] && $show_submenu_indicators; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . ( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) . ( $is_active ? ' current-menu-item' : '' ), 'style' => $style_attribute, ) ); $label = ''; if ( isset( $attributes['label'] ) ) { $label .= wp_kses_post( $attributes['label'] ); } $aria_label = sprintf( __( '%s submenu' ), wp_strip_all_tags( $label ) ); $html = '
              • '; if ( ! $open_on_click ) { $item_url = isset( $attributes['url'] ) ? $attributes['url'] : ''; $html .= '
              • %4$s', get_author_posts_url( $author_id ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '
                %2s
                ', $wrapper_attributes, $avatar_block ); } $comment = get_comment( $block->context['commentId'] ); $alt = sprintf( __( '%s Avatar' ), $comment->comment_author ); if ( ! $comment ) { return ''; } $avatar_block = get_avatar( $comment, $size, '', $alt, array( 'extra_attr' => isset( $image_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $image_styles ) ) ) : '', 'class' => "wp-block-avatar__image $image_classes", ) ); if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) { $label = ''; if ( '_blank' === $attributes['linkTarget'] ) { $label = 'aria-label="' . sprintf( esc_attr__( '(%s website link, opens in a new tab)' ), $comment->comment_author ) . '"'; } $avatar_block = sprintf( '%4$s', $comment->comment_author_url, esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '
                %2s
                ', $wrapper_attributes, $avatar_block ); } function register_block_core_avatar() { register_block_type_from_metadata( __DIR__ . '/avatar', array( 'render_callback' => 'render_block_core_avatar', ) ); } add_action( 'init', 'register_block_core_avatar' ); context['commentId'] ) ) { return ''; } $comment = get_comment( $block->context['commentId'] ); if ( empty( $comment ) ) { return ''; } $classes = ''; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); $formatted_date = get_comment_date( isset( $attributes['format'] ) ? $attributes['format'] : '', $comment ); $link = get_comment_link( $comment ); if ( ! empty( $attributes['isLink'] ) ) { $formatted_date = sprintf( '%2s', esc_url( $link ), $formatted_date ); } return sprintf( '
                ', $wrapper_attributes, esc_attr( get_comment_date( 'c', $comment ) ), $formatted_date ); } function register_block_core_comment_date() { register_block_type_from_metadata( __DIR__ . '/comment-date', array( 'render_callback' => 'render_block_core_comment_date', ) ); } add_action( 'init', 'register_block_core_comment_date' ); context['commentId'] ) ) { return ''; } $thread_comments = get_option( 'thread_comments' ); if ( ! $thread_comments ) { return ''; } $comment = get_comment( $block->context['commentId'] ); if ( empty( $comment ) ) { return ''; } $depth = 1; $max_depth = get_option( 'thread_comments_depth' ); $parent_id = $comment->comment_parent; while ( ! empty( $parent_id ) ) { $depth++; $parent_id = get_comment( $parent_id )->comment_parent; } $comment_reply_link = get_comment_reply_link( array( 'depth' => $depth, 'max_depth' => $max_depth, ), $comment ); if ( empty( $comment_reply_link ) ) { return; } $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return sprintf( '
                %2$s
                ', $wrapper_attributes, $comment_reply_link ); } function register_block_core_comment_reply_link() { register_block_type_from_metadata( __DIR__ . '/comment-reply-link', array( 'render_callback' => 'render_block_core_comment_reply_link', ) ); } add_action( 'init', 'register_block_core_comment_reply_link' ); get_stylesheet() === $attributes['theme'] ) { $template_part_id = $attributes['theme'] . '//' . $attributes['slug']; $template_part_query = new WP_Query( array( 'post_type' => 'wp_template_part', 'post_status' => 'publish', 'post_name__in' => array( $attributes['slug'] ), 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'slug', 'terms' => $attributes['theme'], ), ), 'posts_per_page' => 1, 'no_found_rows' => true, ) ); $template_part_post = $template_part_query->have_posts() ? $template_part_query->next_post() : null; if ( $template_part_post ) { $content = $template_part_post->post_content; $area_terms = get_the_terms( $template_part_post, 'wp_template_part_area' ); if ( ! is_wp_error( $area_terms ) && false !== $area_terms ) { $area = $area_terms[0]->name; } do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content ); } else { $parent_theme_folders = get_block_theme_folders( get_template() ); $child_theme_folders = get_block_theme_folders( get_stylesheet() ); $child_theme_part_file_path = get_theme_file_path( '/' . $child_theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' ); $parent_theme_part_file_path = get_theme_file_path( '/' . $parent_theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' ); $template_part_file_path = 0 === validate_file( $attributes['slug'] ) && file_exists( $child_theme_part_file_path ) ? $child_theme_part_file_path : $parent_theme_part_file_path; if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) { $content = file_get_contents( $template_part_file_path ); $content = is_string( $content ) && '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : ''; } if ( '' !== $content && null !== $content ) { do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content ); } else { do_action( 'render_block_core_template_part_none', $template_part_id, $attributes, $template_part_file_path ); } } } $is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY; if ( is_null( $content ) && $is_debug ) { if ( ! isset( $attributes['slug'] ) ) { return; } return sprintf( __( 'Template part has been deleted or is unavailable: %s' ), $attributes['slug'] ); } if ( isset( $seen_ids[ $template_part_id ] ) ) { return $is_debug ? __( '[block rendering halted]' ) : ''; } $seen_ids[ $template_part_id ] = true; $content = do_blocks( $content ); unset( $seen_ids[ $template_part_id ] ); $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = shortcode_unautop( $content ); $content = wp_filter_content_tags( $content ); $content = do_shortcode( $content ); global $wp_embed; $content = $wp_embed->autoembed( $content ); if ( empty( $attributes['tagName'] ) ) { $defined_areas = get_allowed_block_template_part_areas(); $area_tag = 'div'; foreach ( $defined_areas as $defined_area ) { if ( $defined_area['area'] === $area && isset( $defined_area['area_tag'] ) ) { $area_tag = $defined_area['area_tag']; } } $html_tag = $area_tag; } else { $html_tag = esc_attr( $attributes['tagName'] ); } $wrapper_attributes = get_block_wrapper_attributes(); return "<$html_tag $wrapper_attributes>" . str_replace( ']]>', ']]>', $content ) . ""; } function build_template_part_block_variations() { $variations = array(); $defined_areas = get_allowed_block_template_part_areas(); foreach ( $defined_areas as $area ) { if ( 'uncategorized' !== $area['area'] ) { $variations[] = array( 'name' => $area['area'], 'title' => $area['label'], 'description' => $area['description'], 'attributes' => array( 'area' => $area['area'], ), 'scope' => array( 'inserter' ), 'icon' => $area['icon'], ); } } return $variations; } function register_block_core_template_part() { register_block_type_from_metadata( __DIR__ . '/template-part', array( 'render_callback' => 'render_block_core_template_part', 'variations' => build_template_part_block_variations(), ) ); } add_action( 'init', 'register_block_core_template_part' ); ' . __( 'The calendar block is hidden because there are no published posts.' ) . ''; } return ''; } $previous_monthnum = $monthnum; $previous_year = $year; if ( isset( $attributes['month'] ) && isset( $attributes['year'] ) ) { $permalink_structure = get_option( 'permalink_structure' ); if ( strpos( $permalink_structure, '%monthnum%' ) !== false && strpos( $permalink_structure, '%year%' ) !== false ) { $monthnum = $attributes['month']; $year = $attributes['year']; } } $wrapper_attributes = get_block_wrapper_attributes(); $output = sprintf( '
                %2$s
                ', $wrapper_attributes, get_calendar( true, false ) ); $monthnum = $previous_monthnum; $year = $previous_year; return $output; } function register_block_core_calendar() { register_block_type_from_metadata( __DIR__ . '/calendar', array( 'render_callback' => 'render_block_core_calendar', ) ); } add_action( 'init', 'register_block_core_calendar' ); function block_core_calendar_has_published_posts() { if ( is_multisite() ) { return 0 < (int) get_option( 'post_count' ); } $has_published_posts = get_option( 'wp_calendar_block_has_published_posts', null ); if ( null !== $has_published_posts ) { return (bool) $has_published_posts; } return block_core_calendar_update_has_published_posts(); } function block_core_calendar_update_has_published_posts() { global $wpdb; $has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" ); update_option( 'wp_calendar_block_has_published_posts', $has_published_posts ); return $has_published_posts; } if ( ! is_multisite() ) { function block_core_calendar_update_has_published_post_on_delete( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { return; } block_core_calendar_update_has_published_posts(); } function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) { if ( $new_status === $old_status ) { return; } if ( 'post' !== get_post_type( $post ) ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } block_core_calendar_update_has_published_posts(); } add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' ); add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 ); } $attributes['commentsToShow'], 'status' => 'approve', 'post_status' => 'publish', ), array() ) ); $list_items_markup = ''; if ( ! empty( $comments ) ) { $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); foreach ( $comments as $comment ) { $list_items_markup .= '
              • '; if ( $attributes['displayAvatar'] ) { $avatar = get_avatar( $comment, 48, '', '', array( 'class' => 'wp-block-latest-comments__comment-avatar', ) ); if ( $avatar ) { $list_items_markup .= $avatar; } } $list_items_markup .= '
                '; $list_items_markup .= '
                '; $author_url = get_comment_author_url( $comment ); if ( empty( $author_url ) && ! empty( $comment->user_id ) ) { $author_url = get_author_posts_url( $comment->user_id ); } $author_markup = ''; if ( $author_url ) { $author_markup .= '' . get_comment_author( $comment ) . ''; } else { $author_markup .= '' . get_comment_author( $comment ) . ''; } $post_title = '' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . ''; $list_items_markup .= sprintf( __( '%1$s on %2$s' ), $author_markup, $post_title ); if ( $attributes['displayDate'] ) { $list_items_markup .= sprintf( '', esc_attr( get_comment_date( 'c', $comment ) ), date_i18n( get_option( 'date_format' ), get_comment_date( 'U', $comment ) ) ); } $list_items_markup .= '
                '; if ( $attributes['displayExcerpt'] ) { $list_items_markup .= '
                ' . wpautop( get_comment_excerpt( $comment ) ) . '
                '; } $list_items_markup .= '
              • '; } } $classnames = array(); if ( $attributes['displayAvatar'] ) { $classnames[] = 'has-avatars'; } if ( $attributes['displayDate'] ) { $classnames[] = 'has-dates'; } if ( $attributes['displayExcerpt'] ) { $classnames[] = 'has-excerpts'; } if ( empty( $comments ) ) { $classnames[] = 'no-comments'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); return ! empty( $comments ) ? sprintf( '
                  %2$s
                ', $wrapper_attributes, $list_items_markup ) : sprintf( '
                %2$s
                ', $wrapper_attributes, __( 'No comments to show.' ) ); } function register_block_core_latest_comments() { register_block_type_from_metadata( __DIR__ . '/latest-comments', array( 'render_callback' => 'render_block_core_latest_comments', ) ); } add_action( 'init', 'register_block_core_latest_comments' ); 'wp-block-cover__image-background', 'data-object-fit' => 'cover', ); if ( isset( $attributes['focalPoint'] ) ) { $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' . round( $attributes['focalPoint']['y'] * 100 ) . '%'; $attr['data-object-position'] = $object_position; $attr['style'] = 'object-position: ' . $object_position; } $image = get_the_post_thumbnail( null, 'post-thumbnail', $attr ); $inner_container_start = '/]+wp-block-cover__inner-container[\s|"][^>]*>/U'; if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) { $offset = $matches[0][1]; $content = substr( $content, 0, $offset ) . $image . substr( $content, $offset ); } } else { if ( in_the_loop() ) { update_post_thumbnail_cache(); } $current_featured_image = get_the_post_thumbnail_url(); $content = preg_replace( '/class=\".*?\"/', '${0} style="background-image:url(' . esc_url( $current_featured_image ) . ')"', $content, 1 ); } return $content; } function register_block_core_cover() { register_block_type_from_metadata( __DIR__ . '/cover', array( 'render_callback' => 'render_block_core_cover', ) ); } add_action( 'init', 'register_block_core_cover' ); context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page'; $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; $wrapper_attributes = get_block_wrapper_attributes(); $default_label = __( 'Previous Page' ); $label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? esc_html( $attributes['label'] ) : $default_label; $pagination_arrow = get_query_pagination_arrow( $block, false ); if ( $pagination_arrow ) { $label = $pagination_arrow . $label; } $content = ''; if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) { $filter_link_attributes = function() use ( $wrapper_attributes ) { return $wrapper_attributes; }; add_filter( 'previous_posts_link_attributes', $filter_link_attributes ); $content = get_previous_posts_link( $label ); remove_filter( 'previous_posts_link_attributes', $filter_link_attributes ); } elseif ( 1 !== $page ) { $content = sprintf( '%3$s', esc_url( add_query_arg( $page_key, $page - 1 ) ), $wrapper_attributes, $label ); } return $content; } function register_block_core_query_pagination_previous() { register_block_type_from_metadata( __DIR__ . '/query-pagination-previous', array( 'render_callback' => 'render_block_core_query_pagination_previous', ) ); } add_action( 'init', 'register_block_core_query_pagination_previous' ); context['postId'] ) ) { return ''; } $author_id = get_post_field( 'post_author', $block->context['postId'] ); if ( empty( $author_id ) ) { return ''; } $avatar = ! empty( $attributes['avatarSize'] ) ? get_avatar( $author_id, $attributes['avatarSize'] ) : null; $byline = ! empty( $attributes['byline'] ) ? $attributes['byline'] : false; $classes = array_merge( isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(), isset( $attributes['textAlign'] ) ? array( 'has-text-align-' . $attributes['textAlign'] ) : array() ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) ); return sprintf( '
                ', $wrapper_attributes ) . ( ! empty( $attributes['showAvatar'] ) ? '' : '' ) . '' . '
                '; } function register_block_core_post_author() { register_block_type_from_metadata( __DIR__ . '/post-author', array( 'render_callback' => 'render_block_core_post_author', ) ); } add_action( 'init', 'register_block_core_post_author' ); %2$s', get_block_wrapper_attributes(), $content ); } function register_block_core_comments_pagination() { register_block_type_from_metadata( __DIR__ . '/comments-pagination', array( 'render_callback' => 'render_block_core_comments_pagination', ) ); } add_action( 'init', 'register_block_core_comments_pagination' ); '; $after_title = ''; } $html = ''; if ( ! empty( $attributes['title'] ) ) { $html .= $before_title . $attributes['title'] . $after_title; } $html .= '
                '; foreach ( $block->inner_blocks as $inner_block ) { $html .= $inner_block->render(); } $html .= '
                '; return $html; } function register_block_core_widget_group() { register_block_type_from_metadata( __DIR__ . '/widget-group', array( 'render_callback' => 'render_block_core_widget_group', ) ); } add_action( 'init', 'register_block_core_widget_group' ); function note_sidebar_being_rendered( $index ) { global $_sidebar_being_rendered; $_sidebar_being_rendered = $index; } add_action( 'dynamic_sidebar_before', 'note_sidebar_being_rendered' ); function discard_sidebar_being_rendered() { global $_sidebar_being_rendered; unset( $_sidebar_being_rendered ); } add_action( 'dynamic_sidebar_after', 'discard_sidebar_being_rendered' ); array(), 'inline_styles' => '', 'overlay_css_classes' => array(), 'overlay_inline_styles' => '', ); $has_named_text_color = array_key_exists( 'textColor', $context ); $has_picked_text_color = array_key_exists( 'customTextColor', $context ); $has_custom_text_color = isset( $context['style']['color']['text'] ); if ( $has_custom_text_color || $has_picked_text_color || $has_named_text_color ) { $colors['css_classes'][] = 'has-text-color'; } if ( $has_named_text_color ) { $colors['css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['textColor'] ) ); } elseif ( $has_picked_text_color ) { $colors['inline_styles'] .= sprintf( 'color: %s;', $context['customTextColor'] ); } elseif ( $has_custom_text_color ) { $colors['inline_styles'] .= sprintf( 'color: %s;', $context['style']['color']['text'] ); } $has_named_background_color = array_key_exists( 'backgroundColor', $context ); $has_picked_background_color = array_key_exists( 'customBackgroundColor', $context ); $has_custom_background_color = isset( $context['style']['color']['background'] ); if ( $has_custom_background_color || $has_picked_background_color || $has_named_background_color ) { $colors['css_classes'][] = 'has-background'; } if ( $has_named_background_color ) { $colors['css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['backgroundColor'] ) ); } elseif ( $has_picked_background_color ) { $colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['customBackgroundColor'] ); } elseif ( $has_custom_background_color ) { $colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['style']['color']['background'] ); } $has_named_overlay_text_color = array_key_exists( 'overlayTextColor', $context ); $has_picked_overlay_text_color = array_key_exists( 'customOverlayTextColor', $context ); if ( $has_named_overlay_text_color || $has_picked_overlay_text_color ) { $colors['overlay_css_classes'][] = 'has-text-color'; } if ( $has_named_overlay_text_color ) { $colors['overlay_css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['overlayTextColor'] ) ); } elseif ( $has_picked_overlay_text_color ) { $colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $context['customOverlayTextColor'] ); } $has_named_overlay_background_color = array_key_exists( 'overlayBackgroundColor', $context ); $has_picked_overlay_background_color = array_key_exists( 'customOverlayBackgroundColor', $context ); if ( $has_named_overlay_background_color || $has_picked_overlay_background_color ) { $colors['overlay_css_classes'][] = 'has-background'; } if ( $has_named_overlay_background_color ) { $colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['overlayBackgroundColor'] ) ); } elseif ( $has_picked_overlay_background_color ) { $colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $context['customOverlayBackgroundColor'] ); } return $colors; } function block_core_page_list_build_css_font_sizes( $context ) { $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $context ); $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); if ( $has_named_font_size ) { $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); } elseif ( $has_custom_font_size ) { $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); } return $font_sizes; } function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0 ) { if ( empty( $nested_pages ) ) { return; } $markup = ''; foreach ( (array) $nested_pages as $page ) { $css_class = $page['is_active'] ? ' current-menu-item' : ''; $aria_current = $page['is_active'] ? ' aria-current="page"' : ''; $style_attribute = ''; $css_class .= in_array( $page['page_id'], $active_page_ancestor_ids, true ) ? ' current-menu-ancestor' : ''; if ( isset( $page['children'] ) ) { $css_class .= ' has-child'; } if ( $is_navigation_child ) { $css_class .= ' wp-block-navigation-item'; if ( $open_submenus_on_click ) { $css_class .= ' open-on-click'; } elseif ( $show_submenu_icons ) { $css_class .= ' open-on-hover-click'; } } $navigation_child_content_class = $is_navigation_child ? ' wp-block-navigation-item__content' : ''; if ( 1 === $depth && isset( $colors['overlay_css_classes'], $colors['overlay_inline_styles'] ) ) { $css_class .= ' ' . trim( implode( ' ', $colors['overlay_css_classes'] ) ); if ( '' !== $colors['overlay_inline_styles'] ) { $style_attribute = sprintf( ' style="%s"', esc_attr( $colors['overlay_inline_styles'] ) ); } } $front_page_id = (int) get_option( 'page_on_front' ); if ( (int) $page['page_id'] === $front_page_id ) { $css_class .= ' menu-item-home'; } $title = wp_kses_post( $page['title'] ); $aria_label = sprintf( __( '%s submenu' ), wp_strip_all_tags( $title ) ); $markup .= '
              • '; if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) { $markup .= '' . ''; } else { $markup .= '' . $title . ''; } if ( isset( $page['children'] ) ) { if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) { $markup .= ''; } $markup .= ''; } $markup .= '
              • '; } return $markup; } function block_core_page_list_nest_pages( $current_level, $children ) { if ( empty( $current_level ) ) { return; } foreach ( (array) $current_level as $key => $current ) { if ( isset( $children[ $key ] ) ) { $current_level[ $key ]['children'] = block_core_page_list_nest_pages( $children[ $key ], $children ); } } return $current_level; } function render_block_core_page_list( $attributes, $content, $block ) { static $block_id = 0; $block_id++; $all_pages = get_pages( array( 'sort_column' => 'menu_order,post_title', 'order' => 'asc', ) ); if ( empty( $all_pages ) ) { return; } $top_level_pages = array(); $pages_with_children = array(); $active_page_ancestor_ids = array(); foreach ( (array) $all_pages as $page ) { $is_active = ! empty( $page->ID ) && ( get_the_ID() === $page->ID ); if ( $is_active ) { $active_page_ancestor_ids = get_post_ancestors( $page->ID ); } if ( $page->post_parent ) { $pages_with_children[ $page->post_parent ][ $page->ID ] = array( 'page_id' => $page->ID, 'title' => $page->post_title, 'link' => get_permalink( $page->ID ), 'is_active' => $is_active, ); } else { $top_level_pages[ $page->ID ] = array( 'page_id' => $page->ID, 'title' => $page->post_title, 'link' => get_permalink( $page->ID ), 'is_active' => $is_active, ); } } $colors = block_core_page_list_build_css_colors( $attributes, $block->context ); $font_sizes = block_core_page_list_build_css_font_sizes( $block->context ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'] ); $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] ); $css_classes = trim( implode( ' ', $classes ) ); $nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children ); if ( ! empty( $attributes['__unstableMaxPages'] ) ) { $nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] ); } $is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context ); $open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false; $show_submenu_icons = array_key_exists( 'showSubmenuIcon', $block->context ) ? $block->context['showSubmenuIcon'] : false; $wrapper_markup = '
                  %2$s
                '; $items_markup = block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids, $colors ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $css_classes, 'style' => $style_attribute, ) ); return sprintf( $wrapper_markup, $wrapper_attributes, $items_markup ); } function register_block_core_page_list() { register_block_type_from_metadata( __DIR__ . '/page-list', array( 'render_callback' => 'render_block_core_page_list', ) ); } add_action( 'init', 'register_block_core_page_list' ); context['postId']; if ( ! isset( $post_id ) ) { return ''; } $comment_args = array( 'post_id' => $post_id, 'count' => true, ); if ( ! comments_open( $post_id ) && get_comments( $comment_args ) === 0 ) { return ''; } $post_before = $post; $post = get_post( $post_id ); setup_postdata( $post ); ob_start(); add_filter( 'deprecated_file_trigger_error', '__return_false' ); comments_template(); remove_filter( 'deprecated_file_trigger_error', '__return_false' ); $post = $post_before; $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); $output = ob_get_clean(); return sprintf( '
                %2$s
                ', $wrapper_attributes, $output ); } function register_block_core_post_comments() { register_block_type_from_metadata( __DIR__ . '/post-comments', array( 'render_callback' => 'render_block_core_post_comments', ) ); } add_action( 'init', 'register_block_core_post_comments' ); function post_comments_block_form_defaults( $fields ) { if ( wp_is_block_theme() ) { $fields['submit_button'] = ''; $fields['submit_field'] = '

                %1$s %2$s

                '; } return $fields; } add_filter( 'comment_form_defaults', 'post_comments_block_form_defaults' ); false, 'hierarchical' => ! empty( $attributes['showHierarchy'] ), 'orderby' => 'name', 'show_count' => ! empty( $attributes['showPostCounts'] ), 'title_li' => '', ); if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) { $args['parent'] = 0; } if ( ! empty( $attributes['displayAsDropdown'] ) ) { $id = 'wp-block-categories-' . $block_id; $args['id'] = $id; $args['show_option_none'] = __( 'Select Category' ); $wrapper_markup = '
                %2$s
                '; $items_markup = wp_dropdown_categories( $args ); $type = 'dropdown'; if ( ! is_admin() ) { $items_markup = preg_replace( '#(?<=)#', build_dropdown_script_block_core_categories( $id ), $items_markup, 1 ); } } else { $wrapper_markup = '
                  %2$s
                '; $items_markup = wp_list_categories( $args ); $type = 'list'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => "wp-block-categories-{$type}" ) ); return sprintf( $wrapper_markup, $wrapper_attributes, $items_markup ); } function build_dropdown_script_block_core_categories( $dropdown_id ) { ob_start(); ?> - - 'render_block_core_categories', ) ); } add_action( 'init', 'register_block_core_categories' ); context['commentId'] ) || ! current_user_can( 'edit_comment', $block->context['commentId'] ) ) { return ''; } $edit_comment_link = get_edit_comment_link( $block->context['commentId'] ); $link_atts = ''; if ( ! empty( $attributes['linkTarget'] ) ) { $link_atts .= sprintf( 'target="%s"', esc_attr( $attributes['linkTarget'] ) ); } $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return sprintf( '', $wrapper_attributes, esc_url( $edit_comment_link ), $link_atts, esc_html__( 'Edit' ) ); } function register_block_core_comment_edit_link() { register_block_type_from_metadata( __DIR__ . '/comment-edit-link', array( 'render_callback' => 'render_block_core_comment_edit_link', ) ); } add_action( 'init', 'register_block_core_comment_edit_link' ); context['postId'] ) ) { return ''; } $author_id = get_post_field( 'post_author', $block->context['postId'] ); if ( empty( $author_id ) ) { return ''; } $author_biography = get_the_author_meta( 'description', $author_id ); if ( empty( $author_biography ) ) { return ''; } $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); return sprintf( '
                ', $wrapper_attributes ) . $author_biography . '
                '; } function register_block_core_post_author_biography() { register_block_type_from_metadata( __DIR__ . '/post-author-biography', array( 'render_callback' => 'render_block_core_post_author_biography', ) ); } add_action( 'init', 'register_block_core_post_author_biography' ); context['postId'] ) ) { return ''; } $comment_vars = build_comment_query_vars_from_block( $block ); $total = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages; $current = ! empty( $comment_vars['paged'] ) ? $comment_vars['paged'] : null; $content = paginate_comments_links( array( 'total' => $total, 'current' => $current, 'prev_next' => false, 'echo' => false, ) ); if ( empty( $content ) ) { return ''; } $wrapper_attributes = get_block_wrapper_attributes(); return sprintf( '
                %2$s
                ', $wrapper_attributes, $content ); } function register_block_core_comments_pagination_numbers() { register_block_type_from_metadata( __DIR__ . '/comments-pagination-numbers', array( 'render_callback' => 'render_block_core_comments_pagination_numbers', ) ); } add_action( 'init', 'register_block_core_comments_pagination_numbers' ); array(), 'inline_styles' => '', ); $is_sub_menu = isset( $attributes['isTopLevelLink'] ) ? ( ! $attributes['isTopLevelLink'] ) : false; $named_text_color = null; $custom_text_color = null; if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) { $custom_text_color = $context['customOverlayTextColor']; } elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) { $named_text_color = $context['overlayTextColor']; } elseif ( array_key_exists( 'customTextColor', $context ) ) { $custom_text_color = $context['customTextColor']; } elseif ( array_key_exists( 'textColor', $context ) ) { $named_text_color = $context['textColor']; } elseif ( isset( $context['style']['color']['text'] ) ) { $custom_text_color = $context['style']['color']['text']; } if ( ! is_null( $named_text_color ) ) { array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) ); } elseif ( ! is_null( $custom_text_color ) ) { $colors['css_classes'][] = 'has-text-color'; $colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color ); } $named_background_color = null; $custom_background_color = null; if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) { $custom_background_color = $context['customOverlayBackgroundColor']; } elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) { $named_background_color = $context['overlayBackgroundColor']; } elseif ( array_key_exists( 'customBackgroundColor', $context ) ) { $custom_background_color = $context['customBackgroundColor']; } elseif ( array_key_exists( 'backgroundColor', $context ) ) { $named_background_color = $context['backgroundColor']; } elseif ( isset( $context['style']['color']['background'] ) ) { $custom_background_color = $context['style']['color']['background']; } if ( ! is_null( $named_background_color ) ) { array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) ); } elseif ( ! is_null( $custom_background_color ) ) { $colors['css_classes'][] = 'has-background'; $colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color ); } return $colors; } function block_core_navigation_link_build_css_font_sizes( $context ) { $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $context ); $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); if ( $has_named_font_size ) { $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); } elseif ( $has_custom_font_size ) { $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); } return $font_sizes; } function block_core_navigation_link_render_submenu_icon() { return ''; } function render_block_core_navigation_link( $attributes, $content, $block ) { $navigation_link_has_id = isset( $attributes['id'] ) && is_numeric( $attributes['id'] ); $is_post_type = isset( $attributes['kind'] ) && 'post-type' === $attributes['kind']; $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); if ( $is_post_type && $navigation_link_has_id ) { $post = get_post( $attributes['id'] ); if ( ! $post || 'publish' !== $post->post_status ) { return ''; } } if ( empty( $attributes['label'] ) ) { return ''; } $colors = block_core_navigation_link_build_css_colors( $block->context, $attributes ); $font_sizes = block_core_navigation_link_build_css_font_sizes( $block->context ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'] ); $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] ); $css_classes = trim( implode( ' ', $classes ) ); $has_submenu = count( $block->inner_blocks ) > 0; $is_active = ! empty( $attributes['id'] ) && ( get_the_ID() === $attributes['id'] ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . ( $is_active ? ' current-menu-item' : '' ), 'style' => $style_attribute, ) ); $html = '
              • ' . ''; if ( isset( $attributes['label'] ) ) { $html .= wp_kses_post( $attributes['label'] ); } $html .= ''; if ( ! empty( $attributes['description'] ) ) { $html .= ''; $html .= wp_kses_post( $attributes['description'] ); $html .= ''; } $html .= ''; if ( isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'] && $has_submenu ) { $html .= '' . block_core_navigation_link_render_submenu_icon() . ''; } if ( $has_submenu ) { $inner_blocks_html = ''; foreach ( $block->inner_blocks as $inner_block ) { $inner_blocks_html .= $inner_block->render(); } $html .= sprintf( '
                  %s
                ', $inner_blocks_html ); } $html .= '
              • '; return $html; } function build_variation_for_navigation_link( $entity, $kind ) { $title = ''; $description = ''; if ( property_exists( $entity->labels, 'item_link' ) ) { $title = $entity->labels->item_link; } if ( property_exists( $entity->labels, 'item_link_description' ) ) { $description = $entity->labels->item_link_description; } $variation = array( 'name' => $entity->name, 'title' => $title, 'description' => $description, 'attributes' => array( 'type' => $entity->name, 'kind' => $kind, ), ); $variation_overrides = array( 'post_tag' => array( 'name' => 'tag', 'attributes' => array( 'type' => 'tag', 'kind' => $kind, ), ), 'post_format' => array( 'title' => __( 'Post Format Link' ), 'description' => __( 'A link to a post format' ), 'attributes' => array( 'type' => 'post_format', 'kind' => $kind, ), ), ); if ( array_key_exists( $entity->name, $variation_overrides ) ) { $variation = array_merge( $variation, $variation_overrides[ $entity->name ] ); } return $variation; } function register_block_core_navigation_link() { $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' ); $built_ins = array(); $variations = array(); if ( $post_types ) { foreach ( $post_types as $post_type ) { $variation = build_variation_for_navigation_link( $post_type, 'post-type' ); if ( $post_type->_builtin ) { $built_ins[] = $variation; } else { $variations[] = $variation; } } } if ( $taxonomies ) { foreach ( $taxonomies as $taxonomy ) { $variation = build_variation_for_navigation_link( $taxonomy, 'taxonomy' ); if ( $taxonomy->_builtin ) { $built_ins[] = $variation; } else { $variations[] = $variation; } } } register_block_type_from_metadata( __DIR__ . '/navigation-link', array( 'render_callback' => 'render_block_core_navigation_link', 'variations' => array_merge( $built_ins, $variations ), ) ); } add_action( 'init', 'register_block_core_navigation_link' ); [a-z%]+)$/i', $smallest_font_size, $m ) ? $m['unit'] : 'pt' ); $args = array( 'echo' => false, 'unit' => $unit, 'taxonomy' => $attributes['taxonomy'], 'show_count' => $attributes['showTagCounts'], 'number' => $attributes['numberOfTags'], 'smallest' => floatVal( $attributes['smallestFontSize'] ), 'largest' => floatVal( $attributes['largestFontSize'] ), ); $tag_cloud = wp_tag_cloud( $args ); if ( ! $tag_cloud ) { $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); $tag_cloud = esc_html( sprintf( __( 'Your site doesn’t have any %s, so there’s nothing to display here at the moment.' ), strtolower( $labels->name ) ) ); } $wrapper_attributes = get_block_wrapper_attributes(); return sprintf( '

                %2$s

                ', $wrapper_attributes, $tag_cloud ); } function register_block_core_tag_cloud() { register_block_type_from_metadata( __DIR__ . '/tag-cloud', array( 'render_callback' => 'render_block_core_tag_cloud', ) ); } add_action( 'init', 'register_block_core_tag_cloud' ); context['postId'] ) ) { return ''; } $post_id = $block->context['postId']; if ( isset( $seen_ids[ $post_id ] ) ) { $is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY; return $is_debug ? __( '[block rendering halted]' ) : ''; } $seen_ids[ $post_id ] = true; if ( ! in_the_loop() && have_posts() ) { the_post(); } $content = get_the_content(); if ( has_block( 'core/nextpage' ) ) { $content .= wp_link_pages( array( 'echo' => 0 ) ); } $content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) ); unset( $seen_ids[ $post_id ] ); if ( empty( $content ) ) { return ''; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) ); return ( '
                ' . $content . '
                ' ); } function register_block_core_post_content() { register_block_type_from_metadata( __DIR__ . '/post-content', array( 'render_callback' => 'render_block_core_post_content', ) ); } add_action( 'init', 'register_block_core_post_content' ); 'render_block_core_image', ) ); } add_action( 'init', 'register_block_core_image' ); term_id, array( 'update_post_term_cache' => false ) ); _wp_menu_item_classes_by_context( $menu_items ); return $menu_items; } function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) { $sorted_menu_items = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; } unset( $menu_items, $menu_item ); $menu_items_by_parent_id = array(); foreach ( $sorted_menu_items as $menu_item ) { $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item; } return $menu_items_by_parent_id; } function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) { if ( empty( $menu_items ) ) { return array(); } $blocks = array(); foreach ( $menu_items as $menu_item ) { $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null; $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null; $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target; $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null; $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom'; $block = array( 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link', 'attrs' => array( 'className' => $class_name, 'description' => $menu_item->description, 'id' => $id, 'kind' => $kind, 'label' => $menu_item->title, 'opensInNewTab' => $opens_in_new_tab, 'rel' => $rel, 'title' => $menu_item->attr_title, 'type' => $menu_item->object, 'url' => $menu_item->url, ), ); $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id ) : array(); $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] ); $blocks[] = $block; } return $blocks; } } function block_core_navigation_build_css_colors( $attributes ) { $colors = array( 'css_classes' => array(), 'inline_styles' => '', 'overlay_css_classes' => array(), 'overlay_inline_styles' => '', ); $has_named_text_color = array_key_exists( 'textColor', $attributes ); $has_custom_text_color = array_key_exists( 'customTextColor', $attributes ); if ( $has_custom_text_color || $has_named_text_color ) { $colors['css_classes'][] = 'has-text-color'; } if ( $has_named_text_color ) { $colors['css_classes'][] = sprintf( 'has-%s-color', $attributes['textColor'] ); } elseif ( $has_custom_text_color ) { $colors['inline_styles'] .= sprintf( 'color: %s;', $attributes['customTextColor'] ); } $has_named_background_color = array_key_exists( 'backgroundColor', $attributes ); $has_custom_background_color = array_key_exists( 'customBackgroundColor', $attributes ); if ( $has_custom_background_color || $has_named_background_color ) { $colors['css_classes'][] = 'has-background'; } if ( $has_named_background_color ) { $colors['css_classes'][] = sprintf( 'has-%s-background-color', $attributes['backgroundColor'] ); } elseif ( $has_custom_background_color ) { $colors['inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customBackgroundColor'] ); } $has_named_overlay_text_color = array_key_exists( 'overlayTextColor', $attributes ); $has_custom_overlay_text_color = array_key_exists( 'customOverlayTextColor', $attributes ); if ( $has_custom_overlay_text_color || $has_named_overlay_text_color ) { $colors['overlay_css_classes'][] = 'has-text-color'; } if ( $has_named_overlay_text_color ) { $colors['overlay_css_classes'][] = sprintf( 'has-%s-color', $attributes['overlayTextColor'] ); } elseif ( $has_custom_overlay_text_color ) { $colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $attributes['customOverlayTextColor'] ); } $has_named_overlay_background_color = array_key_exists( 'overlayBackgroundColor', $attributes ); $has_custom_overlay_background_color = array_key_exists( 'customOverlayBackgroundColor', $attributes ); if ( $has_custom_overlay_background_color || $has_named_overlay_background_color ) { $colors['overlay_css_classes'][] = 'has-background'; } if ( $has_named_overlay_background_color ) { $colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', $attributes['overlayBackgroundColor'] ); } elseif ( $has_custom_overlay_background_color ) { $colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customOverlayBackgroundColor'] ); } return $colors; } function block_core_navigation_build_css_font_sizes( $attributes ) { $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $attributes ); $has_custom_font_size = array_key_exists( 'customFontSize', $attributes ); if ( $has_named_font_size ) { $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $attributes['fontSize'] ); } elseif ( $has_custom_font_size ) { $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $attributes['customFontSize'] ); } return $font_sizes; } function block_core_navigation_render_submenu_icon() { return ''; } function block_core_navigation_get_first_non_empty_navigation() { $parsed_args = array( 'post_type' => 'wp_navigation', 'no_found_rows' => true, 'order' => 'ASC', 'orderby' => 'name', 'post_status' => 'publish', 'posts_per_page' => 20, ); $navigation_posts = new WP_Query( $parsed_args ); foreach ( $navigation_posts->posts as $navigation_post ) { if ( has_blocks( $navigation_post ) ) { return $navigation_post; } } return null; } function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) { $filtered = array_filter( $parsed_blocks, function( $block ) { return isset( $block['blockName'] ); } ); return array_values( $filtered ); } function block_core_navigation_get_fallback_blocks() { $page_list_fallback = array( array( 'blockName' => 'core/page-list', 'attrs' => array( '__unstableMaxPages' => 4, ), ), ); $registry = WP_Block_Type_Registry::get_instance(); $fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array(); $navigation_post = block_core_navigation_get_first_non_empty_navigation(); if ( $navigation_post ) { $maybe_fallback = block_core_navigation_filter_out_empty_blocks( parse_blocks( $navigation_post->post_content ) ); $fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks; } return apply_filters( 'block_core_navigation_render_fallback', $fallback_blocks ); } function block_core_navigation_get_post_ids( $inner_blocks ) { $post_ids = array_map( 'block_core_navigation_from_block_get_post_ids', iterator_to_array( $inner_blocks ) ); return array_unique( array_merge( ...$post_ids ) ); } function block_core_navigation_from_block_get_post_ids( $block ) { $post_ids = array(); if ( $block->inner_blocks ) { $post_ids = block_core_navigation_get_post_ids( $block->inner_blocks ); } if ( 'core/navigation-link' === $block->name || 'core/navigation-submenu' === $block->name ) { if ( $block->attributes && isset( $block->attributes['kind'] ) && 'post-type' === $block->attributes['kind'] ) { $post_ids[] = $block->attributes['id']; } } return $post_ids; } function render_block_core_navigation( $attributes, $content, $block ) { static $seen_menu_names = array(); $is_fallback = false; $nav_menu_name = ''; if ( isset( $attributes['rgbTextColor'] ) && empty( $attributes['textColor'] ) ) { $attributes['customTextColor'] = $attributes['rgbTextColor']; } if ( isset( $attributes['rgbBackgroundColor'] ) && empty( $attributes['backgroundColor'] ) ) { $attributes['customBackgroundColor'] = $attributes['rgbBackgroundColor']; } unset( $attributes['rgbTextColor'], $attributes['rgbBackgroundColor'] ); $has_old_responsive_attribute = ! empty( $attributes['isResponsive'] ) && $attributes['isResponsive']; $is_responsive_menu = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'] || $has_old_responsive_attribute; $should_load_view_script = ! wp_script_is( 'wp-block-navigation-view' ) && ( $is_responsive_menu || $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ); if ( $should_load_view_script ) { wp_enqueue_script( 'wp-block-navigation-view' ); } $inner_blocks = $block->inner_blocks; if ( array_key_exists( 'navigationMenuId', $attributes ) ) { $attributes['ref'] = $attributes['navigationMenuId']; } if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && array_key_exists( '__unstableLocation', $attributes ) && ! array_key_exists( 'ref', $attributes ) && ! empty( block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ) ) ) { $menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ); if ( empty( $menu_items ) ) { return ''; } $menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items ); $parsed_blocks = block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id ); $inner_blocks = new WP_Block_List( $parsed_blocks, $attributes ); } if ( array_key_exists( 'ref', $attributes ) ) { $navigation_post = get_post( $attributes['ref'] ); if ( ! isset( $navigation_post ) ) { return ''; } $nav_menu_name = $navigation_post->post_title; if ( isset( $seen_menu_names[ $nav_menu_name ] ) ) { ++$seen_menu_names[ $nav_menu_name ]; } else { $seen_menu_names[ $nav_menu_name ] = 1; } $parsed_blocks = parse_blocks( $navigation_post->post_content ); $compacted_blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); $inner_blocks = new WP_Block_List( $compacted_blocks, $attributes ); } if ( empty( $inner_blocks ) ) { $is_fallback = true; $fallback_blocks = block_core_navigation_get_fallback_blocks(); if ( empty( $fallback_blocks ) || ! is_array( $fallback_blocks ) ) { return ''; } $inner_blocks = new WP_Block_List( $fallback_blocks, $attributes ); } $layout_justification = array( 'left' => 'items-justified-left', 'right' => 'items-justified-right', 'center' => 'items-justified-center', 'space-between' => 'items-justified-space-between', ); $layout_class = ''; if ( isset( $attributes['layout']['justifyContent'] ) ) { $layout_class .= $layout_justification[ $attributes['layout']['justifyContent'] ]; } if ( isset( $attributes['layout']['orientation'] ) && 'vertical' === $attributes['layout']['orientation'] ) { $layout_class .= ' is-vertical'; } if ( isset( $attributes['layout']['flexWrap'] ) && 'nowrap' === $attributes['layout']['flexWrap'] ) { $layout_class .= ' no-wrap'; } $text_decoration = _wp_array_get( $attributes, array( 'style', 'typography', 'textDecoration' ), null ); $text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration ); $colors = block_core_navigation_build_css_colors( $attributes ); $font_sizes = block_core_navigation_build_css_font_sizes( $attributes ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'], $is_responsive_menu ? array( 'is-responsive' ) : array(), $layout_class ? array( $layout_class ) : array(), $is_fallback ? array( 'is-fallback' ) : array(), $text_decoration ? array( $text_decoration_class ) : array() ); $post_ids = block_core_navigation_get_post_ids( $inner_blocks ); if ( $post_ids ) { _prime_post_caches( $post_ids, false, false ); } $inner_blocks_html = ''; $is_list_open = false; foreach ( $inner_blocks as $inner_block ) { if ( ( 'core/navigation-link' === $inner_block->name || 'core/home-link' === $inner_block->name || 'core/site-title' === $inner_block->name || 'core/site-logo' === $inner_block->name || 'core/navigation-submenu' === $inner_block->name ) && ! $is_list_open ) { $is_list_open = true; $inner_blocks_html .= '
                  '; } if ( 'core/navigation-link' !== $inner_block->name && 'core/home-link' !== $inner_block->name && 'core/site-title' !== $inner_block->name && 'core/site-logo' !== $inner_block->name && 'core/navigation-submenu' !== $inner_block->name && $is_list_open ) { $is_list_open = false; $inner_blocks_html .= '
                '; } if ( 'core/site-title' === $inner_block->name || 'core/site-logo' === $inner_block->name ) { $inner_blocks_html .= '
              • ' . $inner_block->render() . '
              • '; } else { $inner_blocks_html .= $inner_block->render(); } } if ( $is_list_open ) { $inner_blocks_html .= ''; } $block_styles = isset( $attributes['styles'] ) ? $attributes['styles'] : ''; if ( isset( $seen_menu_names[ $nav_menu_name ] ) && $seen_menu_names[ $nav_menu_name ] > 1 ) { $count = $seen_menu_names[ $nav_menu_name ]; $nav_menu_name = $nav_menu_name . ' ' . ( $count ); } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ), 'style' => $block_styles . $colors['inline_styles'] . $font_sizes['inline_styles'], 'aria-label' => $nav_menu_name, ) ); $modal_unique_id = wp_unique_id( 'modal-' ); if ( ! $is_responsive_menu ) { return sprintf( '', $wrapper_attributes, $inner_blocks_html ); } $is_hidden_by_default = isset( $attributes['overlayMenu'] ) && 'always' === $attributes['overlayMenu']; $responsive_container_classes = array( 'wp-block-navigation__responsive-container', $is_hidden_by_default ? 'hidden-by-default' : '', implode( ' ', $colors['overlay_css_classes'] ), ); $open_button_classes = array( 'wp-block-navigation__responsive-container-open', $is_hidden_by_default ? 'always-shown' : '', ); $toggle_button_icon = ''; $should_display_icon_label = isset( $attributes['hasIcon'] ) && true === $attributes['hasIcon']; $toggle_button_content = $should_display_icon_label ? $toggle_button_icon : 'Menu'; $responsive_container_markup = sprintf( ' -
                -
                -
                - -
                - %2$s -
                -
                -
                -
                ', esc_attr( $modal_unique_id ), $inner_blocks_html, __( 'Open menu' ), __( 'Close menu' ), esc_attr( implode( ' ', $responsive_container_classes ) ), esc_attr( implode( ' ', $open_button_classes ) ), safecss_filter_attr( $colors['overlay_inline_styles'] ), __( 'Menu' ), $toggle_button_content ); return sprintf( '', $wrapper_attributes, $responsive_container_markup ); } function register_block_core_navigation() { register_block_type_from_metadata( __DIR__ . '/navigation', array( 'render_callback' => 'render_block_core_navigation', ) ); } add_action( 'init', 'register_block_core_navigation' ); function block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) { if ( 'core/navigation' === $parsed_block['blockName'] ) { $attribute_to_prefix_map = array( 'fontStyle' => 'var:preset|font-style|', 'fontWeight' => 'var:preset|font-weight|', 'textDecoration' => 'var:preset|text-decoration|', 'textTransform' => 'var:preset|text-transform|', ); foreach ( $attribute_to_prefix_map as $style_attribute => $prefix ) { if ( ! empty( $parsed_block['attrs']['style']['typography'][ $style_attribute ] ) ) { $prefix_len = strlen( $prefix ); $attribute_value = &$parsed_block['attrs']['style']['typography'][ $style_attribute ]; if ( 0 === strncmp( $attribute_value, $prefix, $prefix_len ) ) { $attribute_value = substr( $attribute_value, $prefix_len ); } if ( 'textDecoration' === $style_attribute && 'strikethrough' === $attribute_value ) { $attribute_value = 'line-through'; } } } } return $parsed_block; } add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' ); context['postId'] ) ) { return ''; } $excerpt = get_the_excerpt(); if ( empty( $excerpt ) ) { return ''; } $more_text = ! empty( $attributes['moreText'] ) ? '' . wp_kses_post( $attributes['moreText'] ) . '' : ''; $filter_excerpt_more = function( $more ) use ( $more_text ) { return empty( $more_text ) ? $more : ''; }; add_filter( 'excerpt_more', $filter_excerpt_more ); $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= "has-text-align-{$attributes['textAlign']}"; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); $content = '

                ' . $excerpt; $show_more_on_new_line = ! isset( $attributes['showMoreOnNewLine'] ) || $attributes['showMoreOnNewLine']; if ( $show_more_on_new_line && ! empty( $more_text ) ) { $content .= '

                ' . $more_text . '

                '; } else { $content .= " $more_text

                "; } remove_filter( 'excerpt_more', $filter_excerpt_more ); return sprintf( '
                %2$s
                ', $wrapper_attributes, $content ); } function register_block_core_post_excerpt() { register_block_type_from_metadata( __DIR__ . '/post-excerpt', array( 'render_callback' => 'render_block_core_post_excerpt', ) ); } add_action( 'init', 'register_block_core_post_excerpt' ); $classes ) ); $format = '%link'; $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' ); $label = ''; if ( isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ) { $label = "{$attributes['label']}"; $link = $label; } if ( isset( $attributes['showTitle'] ) && $attributes['showTitle'] ) { if ( ! $attributes['linkLabel'] ) { if ( $label ) { $format = '' . wp_kses_post( $label ) . ' %link'; } $link = '%title'; } elseif ( isset( $attributes['linkLabel'] ) && $attributes['linkLabel'] ) { if ( $label ) { $link = '' . wp_kses_post( $label ) . ' %title'; } else { $label = 'next' === $navigation_type ? _x( 'Next:', 'label before the title of the next post' ) : _x( 'Previous:', 'label before the title of the previous post' ); $link = sprintf( '%1$s %2$s', wp_kses_post( $label ), '%title' ); } } } $get_link_function = "get_{$navigation_type}_post_link"; $content = $get_link_function( $format, $link ); return sprintf( '
                %2$s
                ', $wrapper_attributes, $content ); } function register_block_core_post_navigation_link() { register_block_type_from_metadata( __DIR__ . '/post-navigation-link', array( 'render_callback' => 'render_block_core_post_navigation_link', ) ); } add_action( 'init', 'register_block_core_post_navigation_link' ); array(), 'inline_styles' => '', ); $has_named_text_color = array_key_exists( 'textColor', $context ); $has_custom_text_color = isset( $context['style']['color']['text'] ); if ( $has_custom_text_color || $has_named_text_color ) { $colors['css_classes'][] = 'has-text-color'; } if ( $has_named_text_color ) { $colors['css_classes'][] = sprintf( 'has-%s-color', $context['textColor'] ); } elseif ( $has_custom_text_color ) { $colors['inline_styles'] .= sprintf( 'color: %s;', $context['style']['color']['text'] ); } $has_named_background_color = array_key_exists( 'backgroundColor', $context ); $has_custom_background_color = isset( $context['style']['color']['background'] ); if ( $has_custom_background_color || $has_named_background_color ) { $colors['css_classes'][] = 'has-background'; } if ( $has_named_background_color ) { $colors['css_classes'][] = sprintf( 'has-%s-background-color', $context['backgroundColor'] ); } elseif ( $has_custom_background_color ) { $colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['style']['color']['background'] ); } return $colors; } function block_core_home_link_build_css_font_sizes( $context ) { $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $context ); $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); if ( $has_named_font_size ) { $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); } elseif ( $has_custom_font_size ) { $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); } return $font_sizes; } function block_core_home_link_build_li_wrapper_attributes( $context ) { $colors = block_core_home_link_build_css_colors( $context ); $font_sizes = block_core_home_link_build_css_font_sizes( $context ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'] ); $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] ); $css_classes = trim( implode( ' ', $classes ) ) . ' wp-block-navigation-item'; $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $css_classes, 'style' => $style_attribute, ) ); return $wrapper_attributes; } function render_block_core_home_link( $attributes, $content, $block ) { if ( empty( $attributes['label'] ) ) { return ''; } $wrapper_attributes = block_core_home_link_build_li_wrapper_attributes( $block->context ); $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : ''; $html = '
              • 'render_block_core_home_link', ) ); } add_action( 'init', 'register_block_core_home_link' ); { - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/read-more", - "title": "Read More", - "category": "theme", - "description": "Displays the link of a post, page, or any other content-type.", - "textdomain": "default", - "attributes": { - "content": { - "type": "string" - }, - "linkTarget": { - "type": "string", - "default": "_self" - } - }, - "usesContext": [ "postId" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "text": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true, - "__experimentalTextDecoration": true, - "__experimentalDefaultControls": { - "fontSize": true, - "textDecoration": true - } - }, - "spacing": { - "margin": [ "top", "bottom" ], - "padding": true, - "__experimentalDefaultControls": { - "padding": true - } - }, - "__experimentalBorder": { - "color": true, - "radius": true, - "width": true, - "__experimentalDefaultControls": { - "width": true - } - } - }, - "style": "wp-block-read-more" -} -.wp-block-read-more{display:block;width:-moz-fit-content;width:fit-content}.wp-block-read-more:not([style*=text-decoration]),.wp-block-read-more:not([style*=text-decoration]):active,.wp-block-read-more:not([style*=text-decoration]):focus{text-decoration:none}.wp-block-read-more{display:block;width:-moz-fit-content;width:fit-content}.wp-block-read-more:not([style*=text-decoration]),.wp-block-read-more:not([style*=text-decoration]):active,.wp-block-read-more:not([style*=text-decoration]):focus{text-decoration:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-read-more { - display: block; - width: -moz-fit-content; - width: fit-content; -} -.wp-block-read-more:not([style*=text-decoration]) { - text-decoration: none; -} -.wp-block-read-more:not([style*=text-decoration]):focus, .wp-block-read-more:not([style*=text-decoration]):active { - text-decoration: none; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-read-more { - display: block; - width: -moz-fit-content; - width: fit-content; -} -.wp-block-read-more:not([style*=text-decoration]) { - text-decoration: none; -} -.wp-block-read-more:not([style*=text-decoration]):focus, .wp-block-read-more:not([style*=text-decoration]):active { - text-decoration: none; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/site-logo", - "title": "Site Logo", - "category": "theme", - "description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.", - "textdomain": "default", - "attributes": { - "width": { - "type": "number" - }, - "isLink": { - "type": "boolean", - "default": true - }, - "linkTarget": { - "type": "string", - "default": "_self" - }, - "shouldSyncIcon": { - "type": "boolean" - } - }, - "example": { - "viewportWidth": 500, - "attributes": { - "width": 350, - "className": "block-editor-block-types-list__site-logo-example" - } - }, - "supports": { - "html": false, - "align": true, - "alignWide": false, - "color": { - "__experimentalDuotone": "img, .components-placeholder__illustration, .components-placeholder::before", - "text": false, - "background": false - } - }, - "styles": [ - { - "name": "default", - "label": "Default", - "isDefault": true - }, - { "name": "rounded", "label": "Rounded" } - ], - "editorStyle": "wp-block-site-logo-editor", - "style": "wp-block-site-logo" -} -.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo.is-style-rounded{border-radius:9999px}.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo.is-style-rounded{border-radius:9999px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-logo { - line-height: 0; -} -.wp-block-site-logo a { - display: inline-block; -} -.wp-block-site-logo.is-default-size img { - width: 120px; - height: auto; -} -.wp-block-site-logo a, -.wp-block-site-logo img { - border-radius: inherit; -} -.wp-block-site-logo.aligncenter { - margin-right: auto; - margin-left: auto; - text-align: center; -} -.wp-block-site-logo.is-style-rounded { - border-radius: 9999px; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-site-logo, -.wp-block-site-logo.aligncenter > div { - display: table; - margin-left: auto; - margin-right: auto; -} - -.wp-block-site-logo a { - pointer-events: none; -} -.wp-block-site-logo .custom-logo-link { - cursor: inherit; -} -.wp-block-site-logo .custom-logo-link:focus { - box-shadow: none; -} -.wp-block-site-logo .custom-logo-link.is-transient img { - opacity: 0.3; -} -.wp-block-site-logo img { - display: block; - height: auto; - max-width: 100%; -} - -.wp-block-site-logo.wp-block-site-logo .components-placeholder, -.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder { - height: 120px; - width: 120px; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder { - display: flex; - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; - color: currentColor; - background: transparent; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - right: 4px; - bottom: 4px; - left: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -}.wp-block-site-logo.aligncenter>div,.wp-block[data-align=center]>.wp-block-site-logo{display:table;margin-left:auto;margin-right:auto}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{display:flex;justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-site-logo, -.wp-block-site-logo.aligncenter > div { - display: table; - margin-right: auto; - margin-left: auto; -} - -.wp-block-site-logo a { - pointer-events: none; -} -.wp-block-site-logo .custom-logo-link { - cursor: inherit; -} -.wp-block-site-logo .custom-logo-link:focus { - box-shadow: none; -} -.wp-block-site-logo .custom-logo-link.is-transient img { - opacity: 0.3; -} -.wp-block-site-logo img { - display: block; - height: auto; - max-width: 100%; -} - -.wp-block-site-logo.wp-block-site-logo .components-placeholder, -.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder { - height: 120px; - width: 120px; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder { - display: flex; - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; - color: currentColor; - background: transparent; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - left: 4px; - bottom: 4px; - right: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -}.wp-block-site-logo.aligncenter>div,.wp-block[data-align=center]>.wp-block-site-logo{display:table;margin-right:auto;margin-left:auto}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{display:flex;justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-logo { - line-height: 0; -} -.wp-block-site-logo a { - display: inline-block; -} -.wp-block-site-logo.is-default-size img { - width: 120px; - height: auto; -} -.wp-block-site-logo a, -.wp-block-site-logo img { - border-radius: inherit; -} -.wp-block-site-logo.aligncenter { - margin-left: auto; - margin-right: auto; - text-align: center; -} -.wp-block-site-logo.is-style-rounded { - border-radius: 9999px; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-author", - "title": "Post Author", - "category": "theme", - "description": "Display post author details such as name, avatar, and bio.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - }, - "avatarSize": { - "type": "number", - "default": 48 - }, - "showAvatar": { - "type": "boolean", - "default": true - }, - "showBio": { - "type": "boolean" - }, - "byline": { - "type": "string" - } - }, - "usesContext": [ "postType", "postId", "queryId" ], - "supports": { - "html": false, - "spacing": { - "margin": true, - "padding": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDuotone": ".wp-block-post-author__avatar img", - "__experimentalDefaultControls": { - "background": true, - "text": true - } - } - }, - "editorStyle": "wp-block-post-author-editor", - "style": "wp-block-post-author" -} -.wp-block-post-author{display:flex;flex-wrap:wrap}.wp-block-post-author__byline{width:100%;margin-top:0;margin-bottom:0;font-size:.5em}.wp-block-post-author__avatar{margin-left:1em}.wp-block-post-author__bio{margin-bottom:.7em;font-size:.7em}.wp-block-post-author__content{flex-grow:1;flex-basis:0}.wp-block-post-author__name{margin:0}.wp-block-post-author{display:flex;flex-wrap:wrap}.wp-block-post-author__byline{width:100%;margin-top:0;margin-bottom:0;font-size:.5em}.wp-block-post-author__avatar{margin-right:1em}.wp-block-post-author__bio{margin-bottom:.7em;font-size:.7em}.wp-block-post-author__content{flex-grow:1;flex-basis:0}.wp-block-post-author__name{margin:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-author { - display: flex; - flex-wrap: wrap; -} -.wp-block-post-author__byline { - width: 100%; - margin-top: 0; - margin-bottom: 0; - font-size: 0.5em; -} -.wp-block-post-author__avatar { - margin-left: 1em; -} -.wp-block-post-author__bio { - margin-bottom: 0.7em; - font-size: 0.7em; -} -.wp-block-post-author__content { - flex-grow: 1; - flex-basis: 0; -} -.wp-block-post-author__name { - margin: 0; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-author { - display: flex; - flex-wrap: wrap; -} -.wp-block-post-author__byline { - width: 100%; - margin-top: 0; - margin-bottom: 0; - font-size: 0.5em; -} -.wp-block-post-author__avatar { - margin-right: 1em; -} -.wp-block-post-author__bio { - margin-bottom: 0.7em; - font-size: 0.7em; -} -.wp-block-post-author__content { - flex-grow: 1; - flex-basis: 0; -} -.wp-block-post-author__name { - margin: 0; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/video", - "title": "Video", - "category": "media", - "description": "Embed a video from your media library or upload a new one.", - "keywords": [ "movie" ], - "textdomain": "default", - "attributes": { - "autoplay": { - "type": "boolean", - "source": "attribute", - "selector": "video", - "attribute": "autoplay" - }, - "caption": { - "type": "string", - "source": "html", - "selector": "figcaption" - }, - "controls": { - "type": "boolean", - "source": "attribute", - "selector": "video", - "attribute": "controls", - "default": true - }, - "id": { - "type": "number" - }, - "loop": { - "type": "boolean", - "source": "attribute", - "selector": "video", - "attribute": "loop" - }, - "muted": { - "type": "boolean", - "source": "attribute", - "selector": "video", - "attribute": "muted" - }, - "poster": { - "type": "string", - "source": "attribute", - "selector": "video", - "attribute": "poster" - }, - "preload": { - "type": "string", - "source": "attribute", - "selector": "video", - "attribute": "preload", - "default": "metadata" - }, - "src": { - "type": "string", - "source": "attribute", - "selector": "video", - "attribute": "src" - }, - "playsInline": { - "type": "boolean", - "source": "attribute", - "selector": "video", - "attribute": "playsinline" - }, - "tracks": { - "type": "array", - "items": { - "type": "object" - }, - "default": [] - } - }, - "supports": { - "anchor": true, - "align": true - }, - "editorStyle": "wp-block-video-editor", - "style": "wp-block-video" -} -.wp-block-video{margin:0 0 1em}.wp-block-video video{width:100%}@supports (position:sticky){.wp-block-video [poster]{-o-object-fit:cover;object-fit:cover}}.wp-block-video.aligncenter{text-align:center}.wp-block-video figcaption{margin-top:.5em;margin-bottom:1em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-video figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-video figcaption { - color: rgba(255, 255, 255, 0.65); -}.wp-block-video{margin:0 0 1em}.wp-block-video video{width:100%}@supports (position:sticky){.wp-block-video [poster]{-o-object-fit:cover;object-fit:cover}}.wp-block-video.aligncenter{text-align:center}.wp-block-video figcaption{margin-top:.5em;margin-bottom:1em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-video figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-video figcaption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-video { - margin: 0 0 1em 0; -} -.wp-block-video video { - width: 100%; -} -@supports (position: sticky) { - .wp-block-video [poster] { - -o-object-fit: cover; - object-fit: cover; - } -} -.wp-block-video.aligncenter { - text-align: center; -} -.wp-block-video figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -}.wp-block-video figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-video figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-video { - text-align: center; -} - -.wp-block-video { - position: relative; -} -.wp-block-video.is-transient video { - opacity: 0.3; -} -.wp-block-video .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -.editor-video-poster-control .components-base-control__label { - display: block; -} -.editor-video-poster-control .components-button { - margin-right: 8px; -} - -.block-library-video-tracks-editor { - z-index: 159990; -} - -.block-library-video-tracks-editor > .components-popover__content { - width: 360px; -} - -.block-library-video-tracks-editor__track-list-track { - display: flex; - place-content: space-between; - align-items: baseline; - padding-left: 12px; -} - -.block-library-video-tracks-editor__single-track-editor-label-language { - display: flex; - margin-top: 12px; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control { - width: 50%; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control:first-child { - margin-right: 16px; -} - -.block-library-video-tracks-editor__single-track-editor-kind-select { - max-width: 240px; -} - -.block-library-video-tracks-editor__single-track-editor-buttons-container { - display: flex; - place-content: space-between; - margin-top: 32px; -} - -.block-library-video-tracks-editor__single-track-editor-edit-track-label { - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - display: block; -} - -.block-library-video-tracks-editor > .components-popover__content > div { - padding: 0; -} - -.block-library-video-tracks-editor__track-list .components-menu-group__label, -.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label { - padding: 0; -} - -.block-library-video-tracks-editor__single-track-editor, -.block-library-video-tracks-editor__track-list, -.block-library-video-tracks-editor__add-tracks-container { - padding: 12px; -} - -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label { - margin-bottom: 4px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field { - margin-bottom: 12px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input { - margin-left: 0; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label { - margin-bottom: 4px; -}.wp-block[data-align=center]>.wp-block-video{text-align:center}.wp-block-video{position:relative}.wp-block-video.is-transient video{opacity:.3}.wp-block-video .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.editor-video-poster-control .components-base-control__label{display:block}.editor-video-poster-control .components-button{margin-right:8px}.block-library-video-tracks-editor{z-index:159990}.block-library-video-tracks-editor>.components-popover__content{width:360px}.block-library-video-tracks-editor__track-list-track{display:flex;place-content:space-between;align-items:baseline;padding-left:12px}.block-library-video-tracks-editor__single-track-editor-label-language{display:flex;margin-top:12px}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control{width:50%}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control:first-child{margin-right:16px}.block-library-video-tracks-editor__single-track-editor-kind-select{max-width:240px}.block-library-video-tracks-editor__single-track-editor-buttons-container{display:flex;place-content:space-between;margin-top:32px}.block-library-video-tracks-editor__single-track-editor-edit-track-label{margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;display:block}.block-library-video-tracks-editor>.components-popover__content>div,.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label,.block-library-video-tracks-editor__track-list .components-menu-group__label{padding:0}.block-library-video-tracks-editor__add-tracks-container,.block-library-video-tracks-editor__single-track-editor,.block-library-video-tracks-editor__track-list{padding:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label{margin-bottom:4px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field{margin-bottom:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input{margin-left:0}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label{margin-bottom:4px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-video { - text-align: center; -} - -.wp-block-video { - position: relative; -} -.wp-block-video.is-transient video { - opacity: 0.3; -} -.wp-block-video .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -.editor-video-poster-control .components-base-control__label { - display: block; -} -.editor-video-poster-control .components-button { - margin-left: 8px; -} - -.block-library-video-tracks-editor { - z-index: 159990; -} - -.block-library-video-tracks-editor > .components-popover__content { - width: 360px; -} - -.block-library-video-tracks-editor__track-list-track { - display: flex; - place-content: space-between; - align-items: baseline; - padding-right: 12px; -} - -.block-library-video-tracks-editor__single-track-editor-label-language { - display: flex; - margin-top: 12px; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control { - width: 50%; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control:first-child { - margin-left: 16px; -} - -.block-library-video-tracks-editor__single-track-editor-kind-select { - max-width: 240px; -} - -.block-library-video-tracks-editor__single-track-editor-buttons-container { - display: flex; - place-content: space-between; - margin-top: 32px; -} - -.block-library-video-tracks-editor__single-track-editor-edit-track-label { - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - display: block; -} - -.block-library-video-tracks-editor > .components-popover__content > div { - padding: 0; -} - -.block-library-video-tracks-editor__track-list .components-menu-group__label, -.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label { - padding: 0; -} - -.block-library-video-tracks-editor__single-track-editor, -.block-library-video-tracks-editor__track-list, -.block-library-video-tracks-editor__add-tracks-container { - padding: 12px; -} - -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label { - margin-bottom: 4px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field { - margin-bottom: 12px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input { - margin-right: 0; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label { - margin-bottom: 4px; -}.wp-block[data-align=center]>.wp-block-video{text-align:center}.wp-block-video{position:relative}.wp-block-video.is-transient video{opacity:.3}.wp-block-video .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.editor-video-poster-control .components-base-control__label{display:block}.editor-video-poster-control .components-button{margin-left:8px}.block-library-video-tracks-editor{z-index:159990}.block-library-video-tracks-editor>.components-popover__content{width:360px}.block-library-video-tracks-editor__track-list-track{display:flex;place-content:space-between;align-items:baseline;padding-right:12px}.block-library-video-tracks-editor__single-track-editor-label-language{display:flex;margin-top:12px}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control{width:50%}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control:first-child{margin-left:16px}.block-library-video-tracks-editor__single-track-editor-kind-select{max-width:240px}.block-library-video-tracks-editor__single-track-editor-buttons-container{display:flex;place-content:space-between;margin-top:32px}.block-library-video-tracks-editor__single-track-editor-edit-track-label{margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;display:block}.block-library-video-tracks-editor>.components-popover__content>div,.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label,.block-library-video-tracks-editor__track-list .components-menu-group__label{padding:0}.block-library-video-tracks-editor__add-tracks-container,.block-library-video-tracks-editor__single-track-editor,.block-library-video-tracks-editor__track-list{padding:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label{margin-bottom:4px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field{margin-bottom:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input{margin-right:0}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label{margin-bottom:4px}.wp-block-video figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-video figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-video { - margin: 0 0 1em 0; -} -.wp-block-video video { - width: 100%; -} -@supports (position: sticky) { - .wp-block-video [poster] { - -o-object-fit: cover; - object-fit: cover; - } -} -.wp-block-video.aligncenter { - text-align: center; -} -.wp-block-video figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/navigation-link", - "title": "Custom Link", - "category": "design", - "parent": [ "core/navigation" ], - "description": "Add a page, link, or another item to your navigation.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - }, - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "rel": { - "type": "string" - }, - "id": { - "type": "number" - }, - "opensInNewTab": { - "type": "boolean", - "default": false - }, - "url": { - "type": "string" - }, - "title": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "isTopLevelLink": { - "type": "boolean" - } - }, - "usesContext": [ - "textColor", - "customTextColor", - "backgroundColor", - "customBackgroundColor", - "overlayTextColor", - "customOverlayTextColor", - "overlayBackgroundColor", - "customOverlayBackgroundColor", - "fontSize", - "customFontSize", - "showSubmenuIcon", - "maxNestingLevel", - "style" - ], - "supports": { - "reusable": false, - "html": false, - "__experimentalSlashInserter": true - }, - "editorStyle": "wp-block-navigation-link-editor", - "style": "wp-block-navigation-link" -} -.wp-block-navigation .wp-block-navigation-item__label{word-break:normal;overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}.wp-block-navigation .wp-block-navigation-item__label{word-break:normal;overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-navigation-item__label { - word-break: normal; - overflow-wrap: break-word; -} -.wp-block-navigation .wp-block-navigation-item__description { - display: none; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Submenus. -*/ -.wp-block-navigation .has-child { - cursor: pointer; -} -.wp-block-navigation .has-child .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container { - z-index: 29; -} -.wp-block-navigation .has-child.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation .has-child.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - overflow: visible !important; -} - -/** - * Navigation Items. - */ -.wp-block-navigation-item .wp-block-navigation-item__content { - cursor: text; -} -.wp-block-navigation-item.is-editing, .wp-block-navigation-item.is-selected { - min-width: 20px; -} -.wp-block-navigation-item .block-list-appender { - margin-top: 16px; - margin-right: auto; - margin-bottom: 16px; - margin-left: 16px; -} - -.wp-block-navigation-link__invalid-item { - color: #000; -} - -.wp-block-navigation-link__missing_text-tooltip { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; -} - -/** - * Menu item setup state. Is shown when a menu item has no URL configured. - */ -.wp-block-navigation-link__placeholder { - position: relative; - text-decoration: none !important; - box-shadow: none !important; - background-image: none !important; -} -.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: var(--wp-admin-theme-color); - background-image: linear-gradient(45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); - background-position: 0 100%; - background-size: 6px 3px; - background-repeat: repeat-x; - padding-bottom: 0.1em; -} -.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: #fff; -} -.wp-block-navigation-link__placeholder.wp-block-navigation-item__content { - cursor: pointer; -} - -/** -* Link Control Transforms -*/ -.link-control-transform { - border-top: 1px solid #ccc; - padding: 0 16px 8px 16px; -} - -.link-control-transform__subheading { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} - -.link-control-transform__items { - display: flex; - justify-content: space-between; -} - -.link-control-transform__item { - flex-basis: 33%; - flex-direction: column; - gap: 8px; - height: auto; -}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;overflow:visible!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px auto 16px 16px}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden}.wp-block-navigation-link__placeholder{position:relative;text-decoration:none!important;box-shadow:none!important;background-image:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:0 100%;background-size:6px 3px;background-repeat:repeat-x;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Submenus. -*/ -.wp-block-navigation .has-child { - cursor: pointer; -} -.wp-block-navigation .has-child .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container { - z-index: 29; -} -.wp-block-navigation .has-child.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation .has-child.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - overflow: visible !important; -} - -/** - * Navigation Items. - */ -.wp-block-navigation-item .wp-block-navigation-item__content { - cursor: text; -} -.wp-block-navigation-item.is-editing, .wp-block-navigation-item.is-selected { - min-width: 20px; -} -.wp-block-navigation-item .block-list-appender { - margin-top: 16px; - margin-left: auto; - margin-bottom: 16px; - margin-right: 16px; -} - -.wp-block-navigation-link__invalid-item { - color: #000; -} - -.wp-block-navigation-link__missing_text-tooltip { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; -} - -/** - * Menu item setup state. Is shown when a menu item has no URL configured. - */ -.wp-block-navigation-link__placeholder { - position: relative; - text-decoration: none !important; - box-shadow: none !important; - background-image: none !important; -} -.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: var(--wp-admin-theme-color); - background-image: linear-gradient(-45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(-135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); - background-position: 100% 100%; - background-size: 6px 3px; - background-repeat: repeat-x; - padding-bottom: 0.1em; -} -.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: #fff; -} -.wp-block-navigation-link__placeholder.wp-block-navigation-item__content { - cursor: pointer; -} - -/** -* Link Control Transforms -*/ -.link-control-transform { - border-top: 1px solid #ccc; - padding: 0 16px 8px 16px; -} - -.link-control-transform__subheading { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} - -.link-control-transform__items { - display: flex; - justify-content: space-between; -} - -.link-control-transform__item { - flex-basis: 33%; - flex-direction: column; - gap: 8px; - height: auto; -}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;overflow:visible!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px 16px 16px auto}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden}.wp-block-navigation-link__placeholder{position:relative;text-decoration:none!important;box-shadow:none!important;background-image:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(-45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(-135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:100% 100%;background-size:6px 3px;background-repeat:repeat-x;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-navigation-item__label { - word-break: normal; - overflow-wrap: break-word; -} -.wp-block-navigation .wp-block-navigation-item__description { - display: none; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-pagination", - "title": "Comments Pagination", - "category": "theme", - "parent": [ "core/comments-query-loop" ], - "description": "Displays a paginated navigation to next/previous set of comments, when applicable.", - "textdomain": "default", - "attributes": { - "paginationArrow": { - "type": "string", - "default": "none" - } - }, - "providesContext": { - "comments/paginationArrow": "paginationArrow" - }, - "supports": { - "align": true, - "reusable": false, - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "default": { - "type": "flex" - } - } - }, - "editorStyle": "wp-block-comments-pagination-editor", - "style": "wp-block-comments-pagination" -} -.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow{margin-left:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow{margin-right:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-comments-pagination.aligncenter{justify-content:center}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow{margin-right:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow{margin-left:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-comments-pagination.aligncenter{justify-content:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - margin-right: 0; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-comments-pagination.aligncenter { - justify-content: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-comments-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-comments-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-left: 0; - margin-top: 0.5em; - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -}.wp-block[data-align=center]>.wp-block-comments-pagination{justify-content:center}.editor-styles-wrapper .wp-block-comments-pagination{max-width:100%}.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout{margin:0}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin:.5em .5em .5em 0}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-comments-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-comments-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-right: 0; - margin-top: 0.5em; - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - margin-right: 0; -}.wp-block[data-align=center]>.wp-block-comments-pagination{justify-content:center}.editor-styles-wrapper .wp-block-comments-pagination{max-width:100%}.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout{margin:0}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-top:.5em;margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-comments-pagination.aligncenter { - justify-content: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/tag-cloud", - "title": "Tag Cloud", - "category": "widgets", - "description": "A cloud of your most used tags.", - "textdomain": "default", - "attributes": { - "numberOfTags": { - "type": "number", - "default": 45, - "minimum": 1, - "maximum": 100 - }, - "taxonomy": { - "type": "string", - "default": "post_tag" - }, - "showTagCounts": { - "type": "boolean", - "default": false - }, - "smallestFontSize": { - "type": "string", - "default": "8pt" - }, - "largestFontSize": { - "type": "string", - "default": "22pt" - } - }, - "styles": [ - { "name": "default", "label": "Default", "isDefault": true }, - { "name": "outline", "label": "Outline" } - ], - "supports": { - "html": false, - "align": true - }, - "editorStyle": "wp-block-tag-cloud-editor" -} -.wp-block-tag-cloud.aligncenter{text-align:center}.wp-block-tag-cloud.alignfull{padding-right:1em;padding-left:1em}.wp-block-tag-cloud a{display:inline-block;margin-left:5px}.wp-block-tag-cloud span{display:inline-block;margin-right:5px;text-decoration:none}.wp-block-tag-cloud.is-style-outline{display:flex;flex-wrap:wrap;gap:1ch}.wp-block-tag-cloud.is-style-outline a{border:1px solid;font-size:unset!important;margin-left:0;padding:1ch 2ch;text-decoration:none!important}.wp-block-tag-cloud.aligncenter{text-align:center}.wp-block-tag-cloud.alignfull{padding-left:1em;padding-right:1em}.wp-block-tag-cloud a{display:inline-block;margin-right:5px}.wp-block-tag-cloud span{display:inline-block;margin-left:5px;text-decoration:none}.wp-block-tag-cloud.is-style-outline{display:flex;flex-wrap:wrap;gap:1ch}.wp-block-tag-cloud.is-style-outline a{border:1px solid;font-size:unset!important;margin-right:0;padding:1ch 2ch;text-decoration:none!important}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-tag-cloud.aligncenter { - text-align: center; -} -.wp-block-tag-cloud.alignfull { - padding-right: 1em; - padding-left: 1em; -} -.wp-block-tag-cloud a { - display: inline-block; - margin-left: 5px; -} -.wp-block-tag-cloud span { - display: inline-block; - margin-right: 5px; - text-decoration: none; -} -.wp-block-tag-cloud.is-style-outline { - display: flex; - flex-wrap: wrap; - gap: 1ch; -} -.wp-block-tag-cloud.is-style-outline a { - border: 1px solid currentColor; - font-size: unset !important; - margin-left: 0; - padding: 1ch 2ch; - text-decoration: none !important; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-tag-cloud.aligncenter { - text-align: center; -} -.wp-block-tag-cloud.alignfull { - padding-left: 1em; - padding-right: 1em; -} -.wp-block-tag-cloud a { - display: inline-block; - margin-right: 5px; -} -.wp-block-tag-cloud span { - display: inline-block; - margin-left: 5px; - text-decoration: none; -} -.wp-block-tag-cloud.is-style-outline { - display: flex; - flex-wrap: wrap; - gap: 1ch; -} -.wp-block-tag-cloud.is-style-outline a { - border: 1px solid currentColor; - font-size: unset !important; - margin-right: 0; - padding: 1ch 2ch; - text-decoration: none !important; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/calendar", - "title": "Calendar", - "category": "widgets", - "description": "A calendar of your site’s posts.", - "keywords": [ "posts", "archive" ], - "textdomain": "default", - "attributes": { - "month": { - "type": "integer" - }, - "year": { - "type": "integer" - } - }, - "supports": { - "align": true - }, - "style": "wp-block-calendar" -} -.wp-block-calendar{text-align:center}.wp-block-calendar tbody td,.wp-block-calendar th{padding:.25em;border:1px solid #ddd}.wp-block-calendar tfoot td{border:none}.wp-block-calendar table{width:100%;border-collapse:collapse}.wp-block-calendar table th{font-weight:400;background:#ddd}.wp-block-calendar a{text-decoration:underline}.wp-block-calendar table caption,.wp-block-calendar table tbody{color:#40464d}.wp-block-calendar{text-align:center}.wp-block-calendar tbody td,.wp-block-calendar th{padding:.25em;border:1px solid #ddd}.wp-block-calendar tfoot td{border:none}.wp-block-calendar table{width:100%;border-collapse:collapse}.wp-block-calendar table th{font-weight:400;background:#ddd}.wp-block-calendar a{text-decoration:underline}.wp-block-calendar table caption,.wp-block-calendar table tbody{color:#40464d}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-calendar { - text-align: center; -} -.wp-block-calendar th, -.wp-block-calendar tbody td { - padding: 0.25em; - border: 1px solid #ddd; -} -.wp-block-calendar tfoot td { - border: none; -} -.wp-block-calendar table { - width: 100%; - border-collapse: collapse; -} -.wp-block-calendar table th { - font-weight: 400; - background: #ddd; -} -.wp-block-calendar a { - text-decoration: underline; -} -.wp-block-calendar table tbody, -.wp-block-calendar table caption { - color: #40464d; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-calendar { - text-align: center; -} -.wp-block-calendar th, -.wp-block-calendar tbody td { - padding: 0.25em; - border: 1px solid #ddd; -} -.wp-block-calendar tfoot td { - border: none; -} -.wp-block-calendar table { - width: 100%; - border-collapse: collapse; -} -.wp-block-calendar table th { - font-weight: 400; - background: #ddd; -} -.wp-block-calendar a { - text-decoration: underline; -} -.wp-block-calendar table tbody, -.wp-block-calendar table caption { - color: #40464d; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/buttons", - "title": "Buttons", - "category": "design", - "description": "Prompt visitors to take action with a group of button-style links.", - "keywords": [ "link" ], - "textdomain": "default", - "supports": { - "anchor": true, - "align": [ "wide", "full" ], - "__experimentalExposeControlsToChildren": true, - "spacing": { - "blockGap": true, - "margin": [ "top", "bottom" ], - "__experimentalDefaultControls": { - "blockGap": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "default": { - "type": "flex" - } - } - }, - "editorStyle": "wp-block-buttons-editor", - "style": "wp-block-buttons" -} -.wp-block-buttons.is-vertical{flex-direction:column}.wp-block-buttons.is-vertical>.wp-block-button:last-child{margin-bottom:0}.wp-block-buttons>.wp-block-button{display:inline-block;margin:0}.wp-block-buttons.is-content-justification-left{justify-content:flex-start}.wp-block-buttons.is-content-justification-left.is-vertical{align-items:flex-start}.wp-block-buttons.is-content-justification-center{justify-content:center}.wp-block-buttons.is-content-justification-center.is-vertical{align-items:center}.wp-block-buttons.is-content-justification-right{justify-content:flex-end}.wp-block-buttons.is-content-justification-right.is-vertical{align-items:flex-end}.wp-block-buttons.is-content-justification-space-between{justify-content:space-between}.wp-block-buttons.aligncenter{text-align:center}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block-button.aligncenter{margin-right:auto;margin-left:auto;width:100%}.wp-block-button.aligncenter{text-align:center}.wp-block-buttons.is-vertical{flex-direction:column}.wp-block-buttons.is-vertical>.wp-block-button:last-child{margin-bottom:0}.wp-block-buttons>.wp-block-button{display:inline-block;margin:0}.wp-block-buttons.is-content-justification-left{justify-content:flex-start}.wp-block-buttons.is-content-justification-left.is-vertical{align-items:flex-start}.wp-block-buttons.is-content-justification-center{justify-content:center}.wp-block-buttons.is-content-justification-center.is-vertical{align-items:center}.wp-block-buttons.is-content-justification-right{justify-content:flex-end}.wp-block-buttons.is-content-justification-right.is-vertical{align-items:flex-end}.wp-block-buttons.is-content-justification-space-between{justify-content:space-between}.wp-block-buttons.aligncenter{text-align:center}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block-button.aligncenter{margin-left:auto;margin-right:auto;width:100%}.wp-block-button.aligncenter{text-align:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons.is-vertical { - flex-direction: column; -} -.wp-block-buttons.is-vertical > .wp-block-button:last-child { - margin-bottom: 0; -} -.wp-block-buttons > .wp-block-button { - display: inline-block; - margin: 0; -} -.wp-block-buttons.is-content-justification-left { - justify-content: flex-start; -} -.wp-block-buttons.is-content-justification-left.is-vertical { - align-items: flex-start; -} -.wp-block-buttons.is-content-justification-center { - justify-content: center; -} -.wp-block-buttons.is-content-justification-center.is-vertical { - align-items: center; -} -.wp-block-buttons.is-content-justification-right { - justify-content: flex-end; -} -.wp-block-buttons.is-content-justification-right.is-vertical { - align-items: flex-end; -} -.wp-block-buttons.is-content-justification-space-between { - justify-content: space-between; -} -.wp-block-buttons.aligncenter { - text-align: center; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block-button.aligncenter { - /* stylelint-enable indentation */ - margin-right: auto; - margin-left: auto; - width: 100%; -} - -.wp-block-button.aligncenter { - text-align: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons > .wp-block { - margin: 0; -} -.wp-block-buttons > .wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button { - margin: 0; -} -.wp-block-buttons > .block-list-appender { - display: inline-flex; - align-items: center; -} -.wp-block-buttons.is-vertical > .block-list-appender .block-list-appender__toggle { - justify-content: flex-start; -} -.wp-block-buttons > .wp-block-button:focus { - box-shadow: none; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] { - /* stylelint-enable indentation */ - margin-left: auto; - margin-right: auto; - margin-top: 0; - width: 100%; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] .wp-block-button { - margin-bottom: 0; -} - -.wp-block[data-align=center] > .wp-block-buttons { - align-items: center; - justify-content: center; -} - -.wp-block[data-align=right] > .wp-block-buttons { - justify-content: flex-end; -}.wp-block-buttons>.wp-block,.wp-block-buttons>.wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button{margin:0}.wp-block-buttons>.block-list-appender{display:inline-flex;align-items:center}.wp-block-buttons.is-vertical>.block-list-appender .block-list-appender__toggle{justify-content:flex-start}.wp-block-buttons>.wp-block-button:focus{box-shadow:none}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center]{margin-left:auto;margin-right:auto;margin-top:0;width:100%}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center] .wp-block-button{margin-bottom:0}.wp-block[data-align=center]>.wp-block-buttons{align-items:center;justify-content:center}.wp-block[data-align=right]>.wp-block-buttons{justify-content:flex-end}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons > .wp-block { - margin: 0; -} -.wp-block-buttons > .wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button { - margin: 0; -} -.wp-block-buttons > .block-list-appender { - display: inline-flex; - align-items: center; -} -.wp-block-buttons.is-vertical > .block-list-appender .block-list-appender__toggle { - justify-content: flex-start; -} -.wp-block-buttons > .wp-block-button:focus { - box-shadow: none; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] { - /* stylelint-enable indentation */ - margin-right: auto; - margin-left: auto; - margin-top: 0; - width: 100%; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] .wp-block-button { - margin-bottom: 0; -} - -.wp-block[data-align=center] > .wp-block-buttons { - align-items: center; - justify-content: center; -} - -.wp-block[data-align=right] > .wp-block-buttons { - justify-content: flex-end; -}.wp-block-buttons>.wp-block,.wp-block-buttons>.wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button{margin:0}.wp-block-buttons>.block-list-appender{display:inline-flex;align-items:center}.wp-block-buttons.is-vertical>.block-list-appender .block-list-appender__toggle{justify-content:flex-start}.wp-block-buttons>.wp-block-button:focus{box-shadow:none}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center]{margin-right:auto;margin-left:auto;margin-top:0;width:100%}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center] .wp-block-button{margin-bottom:0}.wp-block[data-align=center]>.wp-block-buttons{align-items:center;justify-content:center}.wp-block[data-align=right]>.wp-block-buttons{justify-content:flex-end}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons.is-vertical { - flex-direction: column; -} -.wp-block-buttons.is-vertical > .wp-block-button:last-child { - margin-bottom: 0; -} -.wp-block-buttons > .wp-block-button { - display: inline-block; - margin: 0; -} -.wp-block-buttons.is-content-justification-left { - justify-content: flex-start; -} -.wp-block-buttons.is-content-justification-left.is-vertical { - align-items: flex-start; -} -.wp-block-buttons.is-content-justification-center { - justify-content: center; -} -.wp-block-buttons.is-content-justification-center.is-vertical { - align-items: center; -} -.wp-block-buttons.is-content-justification-right { - justify-content: flex-end; -} -.wp-block-buttons.is-content-justification-right.is-vertical { - align-items: flex-end; -} -.wp-block-buttons.is-content-justification-space-between { - justify-content: space-between; -} -.wp-block-buttons.aligncenter { - text-align: center; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block-button.aligncenter { - /* stylelint-enable indentation */ - margin-left: auto; - margin-right: auto; - width: 100%; -} - -.wp-block-button.aligncenter { - text-align: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-date", - "title": "Post Date", - "category": "theme", - "description": "Add the date of this post.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - }, - "format": { - "type": "string" - }, - "isLink": { - "type": "boolean", - "default": false - } - }, - "usesContext": [ "postId", "postType", "queryId" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-query-loop", - "title": "Comments Query Loop", - "category": "theme", - "description": "An advanced block that allows displaying post comments using different visual configurations.", - "textdomain": "default", - "attributes": { - "tagName": { - "type": "string", - "default": "div" - } - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - } - }, - "editorStyle": "wp-block-comments-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-comments-toolbar__popover .components-popover__content { - min-width: 230px; -}.block-library-comments-toolbar__popover .components-popover__content{min-width:230px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-comments-toolbar__popover .components-popover__content { - min-width: 230px; -}.block-library-comments-toolbar__popover .components-popover__content{min-width:230px}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/embed", - "title": "Embed", - "category": "embed", - "description": "Add a block that displays content pulled from other sites, like Twitter or YouTube.", - "textdomain": "default", - "attributes": { - "url": { - "type": "string" - }, - "caption": { - "type": "string", - "source": "html", - "selector": "figcaption" - }, - "type": { - "type": "string" - }, - "providerNameSlug": { - "type": "string" - }, - "allowResponsive": { - "type": "boolean", - "default": true - }, - "responsive": { - "type": "boolean", - "default": false - }, - "previewable": { - "type": "boolean", - "default": true - } - }, - "supports": { - "align": true - }, - "editorStyle": "wp-block-embed-editor", - "style": "wp-block-embed" -} -.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-width:320px;min-height:240px}.wp-block-embed{margin:0 0 1em;overflow-wrap:break-word}.wp-block-embed figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{position:absolute;top:0;left:0;bottom:0;right:0;height:100%;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-embed figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-embed figcaption { - color: rgba(255, 255, 255, 0.65); -}.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-width:320px;min-height:240px}.wp-block-embed{margin:0 0 1em;overflow-wrap:break-word}.wp-block-embed figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{position:absolute;top:0;right:0;bottom:0;left:0;height:100%;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-embed figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-embed figcaption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=left] > [data-type="core/embed"], -.wp-block[data-align=right] > [data-type="core/embed"], -.wp-block-embed.alignleft, -.wp-block-embed.alignright { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block[data-align=right] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block-embed.alignleft .wp-block-embed__wrapper, -.wp-block-embed.alignright .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-cover .wp-block-embed { - min-width: 320px; - min-height: 240px; -} - -.wp-block-embed { - margin: 0 0 1em 0; - overflow-wrap: break-word; -} -.wp-block-embed figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-embed iframe { - max-width: 100%; -} - -.wp-block-embed__wrapper { - position: relative; -} - -.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper::before { - content: ""; - display: block; - padding-top: 50%; -} -.wp-embed-responsive .wp-has-aspect-ratio iframe { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - height: 100%; - width: 100%; -} - -.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { - padding-top: 42.85%; -} -.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { - padding-top: 50%; -} -.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { - padding-top: 56.25%; -} -.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { - padding-top: 75%; -} -.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { - padding-top: 100%; -} -.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper::before { - padding-top: 177.77%; -} -.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { - padding-top: 200%; -}.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-embed { - margin-left: 0; - margin-right: 0; - clear: both; -} -.wp-block-embed.is-loading { - display: flex; - justify-content: center; -} -.wp-block-embed .components-placeholder__error { - word-break: break-word; -} -.wp-block-embed .components-placeholder__learn-more { - margin-top: 1em; -} - -.block-library-embed__interactive-overlay { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; -} - -.wp-block[data-align=left] > .wp-block-embed, -.wp-block[data-align=right] > .wp-block-embed { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > .wp-block-embed .wp-block-embed__wrapper, -.wp-block[data-align=right] > .wp-block-embed .wp-block-embed__wrapper { - min-width: 280px; -}.wp-block-embed{margin-left:0;margin-right:0;clear:both}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed .components-placeholder__learn-more{margin-top:1em}.block-library-embed__interactive-overlay{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-embed { - margin-right: 0; - margin-left: 0; - clear: both; -} -.wp-block-embed.is-loading { - display: flex; - justify-content: center; -} -.wp-block-embed .components-placeholder__error { - word-break: break-word; -} -.wp-block-embed .components-placeholder__learn-more { - margin-top: 1em; -} - -.block-library-embed__interactive-overlay { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - opacity: 0; -} - -.wp-block[data-align=left] > .wp-block-embed, -.wp-block[data-align=right] > .wp-block-embed { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > .wp-block-embed .wp-block-embed__wrapper, -.wp-block[data-align=right] > .wp-block-embed .wp-block-embed__wrapper { - min-width: 280px; -}.wp-block-embed{margin-right:0;margin-left:0;clear:both}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed .components-placeholder__learn-more{margin-top:1em}.block-library-embed__interactive-overlay{position:absolute;top:0;right:0;left:0;bottom:0;opacity:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=left] > [data-type="core/embed"], -.wp-block[data-align=right] > [data-type="core/embed"], -.wp-block-embed.alignleft, -.wp-block-embed.alignright { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block[data-align=right] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block-embed.alignleft .wp-block-embed__wrapper, -.wp-block-embed.alignright .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-cover .wp-block-embed { - min-width: 320px; - min-height: 240px; -} - -.wp-block-embed { - margin: 0 0 1em 0; - overflow-wrap: break-word; -} -.wp-block-embed figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-embed iframe { - max-width: 100%; -} - -.wp-block-embed__wrapper { - position: relative; -} - -.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper::before { - content: ""; - display: block; - padding-top: 50%; -} -.wp-embed-responsive .wp-has-aspect-ratio iframe { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - height: 100%; - width: 100%; -} - -.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { - padding-top: 42.85%; -} -.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { - padding-top: 50%; -} -.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { - padding-top: 56.25%; -} -.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { - padding-top: 75%; -} -.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { - padding-top: 100%; -} -.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper::before { - padding-top: 177.77%; -} -.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { - padding-top: 200%; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-excerpt", - "title": "Post Excerpt", - "category": "theme", - "description": "Display a post's excerpt.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - }, - "moreText": { - "type": "string" - }, - "showMoreOnNewLine": { - "type": "boolean", - "default": true - } - }, - "usesContext": [ "postId", "postType", "queryId" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "spacing": { - "margin": true, - "padding": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "editorStyle": "wp-block-post-excerpt-editor", - "style": "wp-block-post-excerpt" -} -.wp-block-post-excerpt__more-link{display:inline-block}.wp-block-post-excerpt__more-link{display:inline-block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-excerpt__more-link { - display: inline-block; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline { - display: inline-block; -}.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline{display:inline-block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline { - display: inline-block; -}.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline{display:inline-block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-excerpt__more-link { - display: inline-block; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/file", - "title": "File", - "category": "media", - "description": "Add a link to a downloadable file.", - "keywords": [ "document", "pdf", "download" ], - "textdomain": "default", - "attributes": { - "id": { - "type": "number" - }, - "href": { - "type": "string" - }, - "fileId": { - "type": "string", - "source": "attribute", - "selector": "a:not([download])", - "attribute": "id" - }, - "fileName": { - "type": "string", - "source": "html", - "selector": "a:not([download])" - }, - "textLinkHref": { - "type": "string", - "source": "attribute", - "selector": "a:not([download])", - "attribute": "href" - }, - "textLinkTarget": { - "type": "string", - "source": "attribute", - "selector": "a:not([download])", - "attribute": "target" - }, - "showDownloadButton": { - "type": "boolean", - "default": true - }, - "downloadButtonText": { - "type": "string", - "source": "html", - "selector": "a[download]" - }, - "displayPreview": { - "type": "boolean" - }, - "previewHeight": { - "type": "number", - "default": 600 - } - }, - "supports": { - "anchor": true, - "align": true - }, - "viewScript": "file:./view.min.js", - "editorStyle": "wp-block-file-editor", - "style": "wp-block-file" -} -.wp-block-file{margin-bottom:1.5em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file .wp-block-file__embed{margin-bottom:1em}.wp-block-file .wp-block-file__button{background:#32373c;border-radius:2em;color:#fff;font-size:.8em;padding:.5em 1em}.wp-block-file a.wp-block-file__button{text-decoration:none}.wp-block-file a.wp-block-file__button:active,.wp-block-file a.wp-block-file__button:focus,.wp-block-file a.wp-block-file__button:hover,.wp-block-file a.wp-block-file__button:visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}.wp-block-file *+.wp-block-file__button{margin-right:.75em}.wp-block-file{margin-bottom:1.5em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file .wp-block-file__embed{margin-bottom:1em}.wp-block-file .wp-block-file__button{background:#32373c;border-radius:2em;color:#fff;font-size:.8em;padding:.5em 1em}.wp-block-file a.wp-block-file__button{text-decoration:none}.wp-block-file a.wp-block-file__button:active,.wp-block-file a.wp-block-file__button:focus,.wp-block-file a.wp-block-file__button:hover,.wp-block-file a.wp-block-file__button:visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}.wp-block-file *+.wp-block-file__button{margin-left:.75em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-file { - margin-bottom: 1.5em; -} -.wp-block-file.aligncenter { - text-align: center; -} -.wp-block-file.alignright { - text-align: right; -} -.wp-block-file .wp-block-file__embed { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__button { - background: #32373c; - border-radius: 2em; - color: #fff; - font-size: 0.8em; - padding: 0.5em 1em; -} -.wp-block-file a.wp-block-file__button { - text-decoration: none; -} -.wp-block-file a.wp-block-file__button:hover, .wp-block-file a.wp-block-file__button:visited, .wp-block-file a.wp-block-file__button:focus, .wp-block-file a.wp-block-file__button:active { - box-shadow: none; - color: #fff; - opacity: 0.85; - text-decoration: none; -} -.wp-block-file * + .wp-block-file__button { - margin-right: 0.75em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-file { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; - margin-bottom: 0; -} -.wp-block[data-align=left] > .wp-block-file, .wp-block[data-align=right] > .wp-block-file { - height: auto; -} -.wp-block-file .components-resizable-box__container { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__preview { - margin-bottom: 1em; - width: 100%; - height: 100%; -} -.wp-block-file .wp-block-file__preview-overlay { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} -.wp-block-file .wp-block-file__content-wrapper { - flex-grow: 1; -} -.wp-block-file a { - min-width: 1em; -} -.wp-block-file .wp-block-file__button-richtext-wrapper { - display: inline-block; - margin-left: 0.75em; -}!function(){"use strict";const n=n=>{let i;try{i=new window.ActiveXObject(n)}catch(n){i=void 0}return i};(()=>{if(window.navigator.userAgent.indexOf("Mobi")>-1||window.navigator.userAgent.indexOf("Android")>-1||window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2||(window.ActiveXObject||"ActiveXObject"in window)&&!n("AcroPDF.PDF")&&!n("PDF.PdfCtrl")){const n=document.getElementsByClassName("wp-block-file__embed");Array.from(n).forEach((n=>{n.style.display="none"}))}})()}(); array(), 'version' => 'c7ee2db603af4ed37bd6b1d2bb4a51bf');.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;right:0;bottom:0;left:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-file { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; - margin-bottom: 0; -} -.wp-block[data-align=left] > .wp-block-file, .wp-block[data-align=right] > .wp-block-file { - height: auto; -} -.wp-block-file .components-resizable-box__container { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__preview { - margin-bottom: 1em; - width: 100%; - height: 100%; -} -.wp-block-file .wp-block-file__preview-overlay { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; -} -.wp-block-file .wp-block-file__content-wrapper { - flex-grow: 1; -} -.wp-block-file a { - min-width: 1em; -} -.wp-block-file .wp-block-file__button-richtext-wrapper { - display: inline-block; - margin-right: 0.75em; -}.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-file { - margin-bottom: 1.5em; -} -.wp-block-file.aligncenter { - text-align: center; -} -.wp-block-file.alignright { - /*rtl:ignore*/ - text-align: right; -} -.wp-block-file .wp-block-file__embed { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__button { - background: #32373c; - border-radius: 2em; - color: #fff; - font-size: 0.8em; - padding: 0.5em 1em; -} -.wp-block-file a.wp-block-file__button { - text-decoration: none; -} -.wp-block-file a.wp-block-file__button:hover, .wp-block-file a.wp-block-file__button:visited, .wp-block-file a.wp-block-file__button:focus, .wp-block-file a.wp-block-file__button:active { - box-shadow: none; - color: #fff; - opacity: 0.85; - text-decoration: none; -} -.wp-block-file * + .wp-block-file__button { - margin-left: 0.75em; -} array(), 'version' => '395f76892cc61236cc5436776be90499');/******/ (function() { // webpackBootstrap -/******/ "use strict"; -var __webpack_exports__ = {}; - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils.js -/** - * Uses a combination of user agent matching and feature detection to determine whether - * the current browser supports rendering PDFs inline. - * - * @return {boolean} Whether or not the browser supports inline PDFs. - */ -const browserSupportsPdfs = () => { - // Most mobile devices include "Mobi" in their UA. - if (window.navigator.userAgent.indexOf('Mobi') > -1) { - return false; - } // Android tablets are the noteable exception. - - - if (window.navigator.userAgent.indexOf('Android') > -1) { - return false; - } // iPad pretends to be a Mac. - - - if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) { - return false; - } // IE only supports PDFs when there's an ActiveX object available for it. - - - if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) { - return false; - } - - return true; -}; -/** - * Helper function for creating ActiveX objects, catching any errors that are thrown - * when it's generated. - * - * @param {string} type The name of the ActiveX object to create. - * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed. - */ - -const createActiveXObject = type => { - let ax; - - try { - ax = new window.ActiveXObject(type); - } catch (e) { - ax = undefined; - } - - return ax; -}; -/** - * Hides all .wp-block-file__embed elements on the document. This function is only intended - * to be run on the front-end, it may have weird side effects running in the block editor. - */ - - -const hidePdfEmbedsOnUnsupportedBrowsers = () => { - if (!browserSupportsPdfs()) { - const embeds = document.getElementsByClassName('wp-block-file__embed'); - Array.from(embeds).forEach(embed => { - embed.style.display = 'none'; - }); - } -}; - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js -/** - * Internal dependencies - */ - -hidePdfEmbedsOnUnsupportedBrowsers(); - -/******/ })() -;{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/paragraph", - "title": "Paragraph", - "category": "text", - "description": "Start with the basic building block of all narrative.", - "keywords": [ "text" ], - "textdomain": "default", - "attributes": { - "align": { - "type": "string" - }, - "content": { - "type": "string", - "source": "html", - "selector": "p", - "default": "", - "__experimentalRole": "content" - }, - "dropCap": { - "type": "boolean", - "default": false - }, - "placeholder": { - "type": "string" - }, - "direction": { - "type": "string", - "enum": [ "ltr", "rtl" ] - } - }, - "supports": { - "anchor": true, - "className": false, - "color": { - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "__experimentalSelector": "p", - "__unstablePasteTextInline": true - }, - "editorStyle": "wp-block-paragraph-editor", - "style": "wp-block-paragraph" -} -.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:right;font-size:8.4em;line-height:.68;font-weight:100;margin:.05em 0 0 .1em;text-transform:uppercase;font-style:normal}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:left;font-size:8.4em;line-height:.68;font-weight:100;margin:.05em .1em 0 0;text-transform:uppercase;font-style:normal}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.is-small-text { - font-size: 0.875em; -} - -.is-regular-text { - font-size: 1em; -} - -.is-large-text { - font-size: 2.25em; -} - -.is-larger-text { - font-size: 3em; -} - -.has-drop-cap:not(:focus)::first-letter { - float: right; - font-size: 8.4em; - line-height: 0.68; - font-weight: 100; - margin: 0.05em 0 0 0.1em; - text-transform: uppercase; - font-style: normal; -} - -p.has-drop-cap.has-background { - overflow: hidden; -} - -p.has-background { - padding: 1.25em 2.375em; -} - -:where(p.has-text-color:not(.has-link-color)) a { - color: inherit; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus { - min-height: auto !important; -} - -.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 1; -} - -.block-editor-block-list__block[data-empty=true] + .block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 0; -}.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus { - min-height: auto !important; -} - -.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 1; -} - -.block-editor-block-list__block[data-empty=true] + .block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 0; -}.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.is-small-text { - font-size: 0.875em; -} - -.is-regular-text { - font-size: 1em; -} - -.is-large-text { - font-size: 2.25em; -} - -.is-larger-text { - font-size: 3em; -} - -.has-drop-cap:not(:focus)::first-letter { - float: left; - font-size: 8.4em; - line-height: 0.68; - font-weight: 100; - margin: 0.05em 0.1em 0 0; - text-transform: uppercase; - font-style: normal; -} - -p.has-drop-cap.has-background { - overflow: hidden; -} - -p.has-background { - padding: 1.25em 2.375em; -} - -:where(p.has-text-color:not(.has-link-color)) a { - color: inherit; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/quote", - "title": "Quote", - "category": "text", - "description": "Give quoted text visual emphasis. \"In quoting others, we cite ourselves.\" — Julio Cortázar", - "keywords": [ "blockquote", "cite" ], - "textdomain": "default", - "attributes": { - "value": { - "type": "string", - "source": "html", - "selector": "blockquote", - "multiline": "p", - "default": "", - "__experimentalRole": "content" - }, - "citation": { - "type": "string", - "source": "html", - "selector": "cite", - "default": "", - "__experimentalRole": "content" - }, - "align": { - "type": "string" - } - }, - "supports": { - "anchor": true, - "__experimentalSlashInserter": true, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true - } - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - } - }, - "styles": [ - { - "name": "default", - "label": "Default", - "isDefault": true - }, - { "name": "plain", "label": "Plain" } - ], - "editorStyle": "wp-block-quote-editor", - "style": "wp-block-quote" -} -.wp-block-quote{box-sizing:border-box;overflow-wrap:break-word}.wp-block-quote.is-large:not(.is-style-plain),.wp-block-quote.is-style-large:not(.is-style-plain){margin-bottom:1em;padding:0 1em}.wp-block-quote.is-large:not(.is-style-plain) p,.wp-block-quote.is-style-large:not(.is-style-plain) p{font-size:1.5em;font-style:italic;line-height:1.6}.wp-block-quote.is-large:not(.is-style-plain) cite,.wp-block-quote.is-large:not(.is-style-plain) footer,.wp-block-quote.is-style-large:not(.is-style-plain) cite,.wp-block-quote.is-style-large:not(.is-style-plain) footer{font-size:1.125em;text-align:left}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-quote { - border-left: 0.25em solid currentColor; - margin: 0 0 1.75em 0; - padding-left: 1em; -} -.wp-block-quote cite, -.wp-block-quote footer { - color: currentColor; - font-size: 0.8125em; - position: relative; - font-style: normal; -} -.wp-block-quote.has-text-align-right { - border-left: none; - border-right: 0.25em solid currentColor; - padding-left: 0; - padding-right: 1em; -} -.wp-block-quote.has-text-align-center { - border: none; - padding-left: 0; -} -.wp-block-quote.is-style-plain, .wp-block-quote.is-style-large, .wp-block-quote.is-large { - border: none; -}.wp-block-quote{box-sizing:border-box;overflow-wrap:break-word}.wp-block-quote.is-large:not(.is-style-plain),.wp-block-quote.is-style-large:not(.is-style-plain){margin-bottom:1em;padding:0 1em}.wp-block-quote.is-large:not(.is-style-plain) p,.wp-block-quote.is-style-large:not(.is-style-plain) p{font-size:1.5em;font-style:italic;line-height:1.6}.wp-block-quote.is-large:not(.is-style-plain) cite,.wp-block-quote.is-large:not(.is-style-plain) footer,.wp-block-quote.is-style-large:not(.is-style-plain) cite,.wp-block-quote.is-style-large:not(.is-style-plain) footer{font-size:1.125em;text-align:right}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-quote { - border-right: 0.25em solid currentColor; - margin: 0 0 1.75em 0; - padding-right: 1em; -} -.wp-block-quote cite, -.wp-block-quote footer { - color: currentColor; - font-size: 0.8125em; - position: relative; - font-style: normal; -} -.wp-block-quote.has-text-align-right { - border-right: none; - border-left: 0.25em solid currentColor; - padding-right: 0; - padding-left: 1em; -} -.wp-block-quote.has-text-align-center { - border: none; - padding-right: 0; -} -.wp-block-quote.is-style-plain, .wp-block-quote.is-style-large, .wp-block-quote.is-large { - border: none; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-quote { - box-sizing: border-box; - overflow-wrap: break-word; -} -.wp-block-quote.is-style-large:not(.is-style-plain), .wp-block-quote.is-large:not(.is-style-plain) { - margin-bottom: 1em; - padding: 0 1em; -} -.wp-block-quote.is-style-large:not(.is-style-plain) p, .wp-block-quote.is-large:not(.is-style-plain) p { - font-size: 1.5em; - font-style: italic; - line-height: 1.6; -} -.wp-block-quote.is-style-large:not(.is-style-plain) cite, -.wp-block-quote.is-style-large:not(.is-style-plain) footer, .wp-block-quote.is-large:not(.is-style-plain) cite, -.wp-block-quote.is-large:not(.is-style-plain) footer { - font-size: 1.125em; - text-align: left; -}.wp-block-quote{border-left:.25em solid;margin:0 0 1.75em;padding-left:1em}.wp-block-quote cite,.wp-block-quote footer{color:currentColor;font-size:.8125em;position:relative;font-style:normal}.wp-block-quote.has-text-align-right{border-left:none;border-right:.25em solid;padding-left:0;padding-right:1em}.wp-block-quote.has-text-align-center{border:none;padding-left:0}.wp-block-quote.is-large,.wp-block-quote.is-style-large,.wp-block-quote.is-style-plain{border:none}.wp-block-quote{border-right:.25em solid;margin:0 0 1.75em;padding-right:1em}.wp-block-quote cite,.wp-block-quote footer{color:currentColor;font-size:.8125em;position:relative;font-style:normal}.wp-block-quote.has-text-align-right{border-right:none;border-left:.25em solid;padding-right:0;padding-left:1em}.wp-block-quote.has-text-align-center{border:none;padding-right:0}.wp-block-quote.is-large,.wp-block-quote.is-style-large,.wp-block-quote.is-style-plain{border:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-quote { - box-sizing: border-box; - overflow-wrap: break-word; -} -.wp-block-quote.is-style-large:not(.is-style-plain), .wp-block-quote.is-large:not(.is-style-plain) { - margin-bottom: 1em; - padding: 0 1em; -} -.wp-block-quote.is-style-large:not(.is-style-plain) p, .wp-block-quote.is-large:not(.is-style-plain) p { - font-size: 1.5em; - font-style: italic; - line-height: 1.6; -} -.wp-block-quote.is-style-large:not(.is-style-plain) cite, -.wp-block-quote.is-style-large:not(.is-style-plain) footer, .wp-block-quote.is-large:not(.is-style-plain) cite, -.wp-block-quote.is-large:not(.is-style-plain) footer { - font-size: 1.125em; - text-align: right; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/group", - "title": "Group", - "category": "design", - "description": "Gather blocks in a layout container.", - "keywords": [ "container", "wrapper", "row", "section" ], - "textdomain": "default", - "attributes": { - "tagName": { - "type": "string", - "default": "div" - }, - "templateLock": { - "type": [ "string", "boolean" ], - "enum": [ "all", "insert", false ] - } - }, - "supports": { - "align": [ "wide", "full" ], - "anchor": true, - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "margin": [ "top", "bottom" ], - "padding": true, - "blockGap": true, - "__experimentalDefaultControls": { - "padding": true, - "blockGap": true - } - }, - "__experimentalBorder": { - "color": true, - "radius": true, - "style": true, - "width": true, - "__experimentalDefaultControls": { - "color": true, - "radius": true, - "style": true, - "width": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "__experimentalLayout": true - }, - "editorStyle": "wp-block-group-editor", - "style": "wp-block-group" -} -.wp-block-group{box-sizing:border-box}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:where(.wp-block-group.has-background) { - padding: 1.25em 2.375em; -}.wp-block-group{box-sizing:border-box}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:where(.wp-block-group.has-background) { - padding: 1.25em 2.375em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-group { - box-sizing: border-box; -}:where(.wp-block-group.has-background){padding:1.25em 2.375em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Group: All Alignment Settings -*/ -.wp-block-group .block-editor-block-list__insertion-point { - left: 0; - right: 0; -} - -[data-type="core/group"].is-selected .block-list-appender { - margin-left: 0; - margin-right: 0; -} -[data-type="core/group"].is-selected .has-background .block-list-appender { - margin-top: 18px; - margin-bottom: 18px; -} - -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child { - gap: inherit; - pointer-events: none; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - display: inherit; - width: 100%; - flex-direction: inherit; - flex: 1; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child::after { - content: ""; - display: flex; - border: 1px dashed currentColor; - opacity: 0.4; - border-radius: 2px; - flex: 1; - pointer-events: none; - min-height: 48px; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - pointer-events: all; -}.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-top:18px;margin-bottom:18px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child{gap:inherit;pointer-events:none}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{display:inherit;width:100%;flex-direction:inherit;flex:1}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child:after{content:"";display:flex;border:1px dashed;opacity:.4;border-radius:2px;flex:1;pointer-events:none;min-height:48px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{pointer-events:all}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Group: All Alignment Settings -*/ -.wp-block-group .block-editor-block-list__insertion-point { - right: 0; - left: 0; -} - -[data-type="core/group"].is-selected .block-list-appender { - margin-right: 0; - margin-left: 0; -} -[data-type="core/group"].is-selected .has-background .block-list-appender { - margin-top: 18px; - margin-bottom: 18px; -} - -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child { - gap: inherit; - pointer-events: none; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - display: inherit; - width: 100%; - flex-direction: inherit; - flex: 1; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child::after { - content: ""; - display: flex; - border: 1px dashed currentColor; - opacity: 0.4; - border-radius: 2px; - flex: 1; - pointer-events: none; - min-height: 48px; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - pointer-events: all; -}.wp-block-group .block-editor-block-list__insertion-point{right:0;left:0}[data-type="core/group"].is-selected .block-list-appender{margin-right:0;margin-left:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-top:18px;margin-bottom:18px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child{gap:inherit;pointer-events:none}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{display:inherit;width:100%;flex-direction:inherit;flex:1}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child:after{content:"";display:flex;border:1px dashed;opacity:.4;border-radius:2px;flex:1;pointer-events:none;min-height:48px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{pointer-events:all}:where(.wp-block-group.has-background){padding:1.25em 2.375em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-group { - box-sizing: border-box; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/site-tagline", - "title": "Site Tagline", - "category": "theme", - "description": "Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.", - "keywords": [ "description" ], - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - } - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "margin": true, - "padding": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalTextTransform": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "editorStyle": "wp-block-site-tagline-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-tagline__placeholder { - padding: 1em 0; - border: 1px dashed; -}.wp-block-site-tagline__placeholder{padding:1em 0;border:1px dashed}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-tagline__placeholder { - padding: 1em 0; - border: 1px dashed; -}.wp-block-site-tagline__placeholder{padding:1em 0;border:1px dashed}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/shortcode", - "title": "Shortcode", - "category": "widgets", - "description": "Insert additional custom elements with a WordPress shortcode.", - "textdomain": "default", - "attributes": { - "text": { - "type": "string", - "source": "html" - } - }, - "supports": { - "className": false, - "customClassName": false, - "html": false - }, - "editorStyle": "wp-block-shortcode-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -[data-type="core/shortcode"] .block-editor-plain-text { - max-height: 250px; -} -[data-type="core/shortcode"].components-placeholder { - min-height: 0; -} - -.blocks-shortcode__textarea { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .blocks-shortcode__textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .blocks-shortcode__textarea { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.blocks-shortcode__textarea:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.blocks-shortcode__textarea::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -}[data-type="core/shortcode"] .block-editor-plain-text{max-height:250px}[data-type="core/shortcode"].components-placeholder{min-height:0}.blocks-shortcode__textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.blocks-shortcode__textarea{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.blocks-shortcode__textarea{font-size:13px;line-height:normal}}.blocks-shortcode__textarea:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.blocks-shortcode__textarea::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.blocks-shortcode__textarea::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.blocks-shortcode__textarea:-ms-input-placeholder{color:rgba(30,30,30,.62)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -[data-type="core/shortcode"] .block-editor-plain-text { - max-height: 250px; -} -[data-type="core/shortcode"].components-placeholder { - min-height: 0; -} - -.blocks-shortcode__textarea { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .blocks-shortcode__textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .blocks-shortcode__textarea { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.blocks-shortcode__textarea:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.blocks-shortcode__textarea::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -}[data-type="core/shortcode"] .block-editor-plain-text{max-height:250px}[data-type="core/shortcode"].components-placeholder{min-height:0}.blocks-shortcode__textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.blocks-shortcode__textarea{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.blocks-shortcode__textarea{font-size:13px;line-height:normal}}.blocks-shortcode__textarea:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.blocks-shortcode__textarea::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.blocks-shortcode__textarea::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.blocks-shortcode__textarea:-ms-input-placeholder{color:rgba(30,30,30,.62)}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-edit-link", - "title": "Comment Edit Link", - "category": "theme", - "ancestor": [ "core/comment-template" ], - "description": "Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.", - "textdomain": "default", - "usesContext": [ "commentId" ], - "attributes": { - "linkTarget": { - "type": "string", - "default": "_self" - }, - "textAlign": { - "type": "string" - } - }, - "supports": { - "html": false, - "color": { - "link": true, - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true, - "link": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/separator", - "title": "Separator", - "category": "design", - "description": "Create a break between ideas or sections with a horizontal separator.", - "keywords": [ "horizontal-line", "hr", "divider" ], - "textdomain": "default", - "attributes": { - "opacity": { - "type": "string", - "default": "alpha-channel" - } - }, - "supports": { - "anchor": true, - "align": [ "center", "wide", "full" ], - "color": { - "__experimentalSkipSerialization": true, - "gradients": true, - "background": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - } - }, - "styles": [ - { "name": "default", "label": "Default", "isDefault": true }, - { "name": "wide", "label": "Wide Line" }, - { "name": "dots", "label": "Dots" } - ], - "editorStyle": "wp-block-separator-editor", - "style": "wp-block-separator" -} -@charset "UTF-8";.wp-block-separator{border-top:1px solid;border-bottom:1px solid}.wp-block-separator.is-style-dots{background:none!important;border:none;text-align:center;line-height:1;height:auto}.wp-block-separator.is-style-dots:before{content:"···";color:currentColor;font-size:1.5em;letter-spacing:2em;padding-left:2em;font-family:serif}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-separator.has-css-opacity { - opacity: 0.4; -} - -.wp-block-separator { - border: none; - border-bottom: 2px solid currentColor; - margin-left: auto; - margin-right: auto; -} -.wp-block-separator.has-alpha-channel-opacity { - opacity: initial; -} -.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { - width: 100px; -} -.wp-block-separator.has-background:not(.is-style-dots) { - border-bottom: none; - height: 1px; -} -.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots) { - height: 2px; -}@charset "UTF-8";.wp-block-separator{border-top:1px solid;border-bottom:1px solid}.wp-block-separator.is-style-dots{background:none!important;border:none;text-align:center;line-height:1;height:auto}.wp-block-separator.is-style-dots:before{content:"···";color:currentColor;font-size:1.5em;letter-spacing:2em;padding-left:2em;font-family:serif}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-separator.has-css-opacity { - opacity: 0.4; -} - -.wp-block-separator { - border: none; - border-bottom: 2px solid currentColor; - margin-right: auto; - margin-left: auto; -} -.wp-block-separator.has-alpha-channel-opacity { - opacity: initial; -} -.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { - width: 100px; -} -.wp-block-separator.has-background:not(.is-style-dots) { - border-bottom: none; - height: 1px; -} -.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots) { - height: 2px; -}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-separator { - border-top: 1px solid currentColor; - border-bottom: 1px solid currentColor; -} -.wp-block-separator.is-style-dots { - background: none !important; - border: none; - text-align: center; - line-height: 1; - height: auto; -} -.wp-block-separator.is-style-dots::before { - content: "···"; - color: currentColor; - font-size: 1.5em; - letter-spacing: 2em; - padding-left: 2em; - font-family: serif; -}.wp-block-separator.has-css-opacity{opacity:.4}.wp-block-separator{border:none;border-bottom:2px solid;margin-left:auto;margin-right:auto}.wp-block-separator.has-alpha-channel-opacity{opacity:1}.wp-block-separator:not(.is-style-wide):not(.is-style-dots){width:100px}.wp-block-separator.has-background:not(.is-style-dots){border-bottom:none;height:1px}.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots){height:2px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/separator"] { - padding-top: 0.1px; - padding-bottom: 0.1px; -} -.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots { - background: none !important; -}.block-editor-block-list__block[data-type="core/separator"]{padding-top:.1px;padding-bottom:.1px}.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots{background:none!important}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/separator"] { - padding-top: 0.1px; - padding-bottom: 0.1px; -} -.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots { - background: none !important; -}.block-editor-block-list__block[data-type="core/separator"]{padding-top:.1px;padding-bottom:.1px}.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots{background:none!important}.wp-block-separator.has-css-opacity{opacity:.4}.wp-block-separator{border:none;border-bottom:2px solid;margin-right:auto;margin-left:auto}.wp-block-separator.has-alpha-channel-opacity{opacity:1}.wp-block-separator:not(.is-style-wide):not(.is-style-dots){width:100px}.wp-block-separator.has-background:not(.is-style-dots){border-bottom:none;height:1px}.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots){height:2px}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-separator { - border-top: 1px solid currentColor; - border-bottom: 1px solid currentColor; -} -.wp-block-separator.is-style-dots { - background: none !important; - border: none; - text-align: center; - line-height: 1; - height: auto; -} -.wp-block-separator.is-style-dots::before { - content: "···"; - color: currentColor; - font-size: 1.5em; - letter-spacing: 2em; - /*rtl:ignore*/ - padding-left: 2em; - font-family: serif; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/gallery", - "title": "Gallery", - "category": "media", - "description": "Display multiple images in a rich gallery.", - "keywords": [ "images", "photos" ], - "textdomain": "default", - "attributes": { - "images": { - "type": "array", - "default": [], - "source": "query", - "selector": ".blocks-gallery-item", - "query": { - "url": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "src" - }, - "fullUrl": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "data-full-url" - }, - "link": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "data-link" - }, - "alt": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "alt", - "default": "" - }, - "id": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "data-id" - }, - "caption": { - "type": "string", - "source": "html", - "selector": ".blocks-gallery-item__caption" - } - } - }, - "ids": { - "type": "array", - "items": { - "type": "number" - }, - "default": [] - }, - "shortCodeTransforms": { - "type": "array", - "default": [], - "items": { - "type": "object" - } - }, - "columns": { - "type": "number", - "minimum": 1, - "maximum": 8 - }, - "caption": { - "type": "string", - "source": "html", - "selector": ".blocks-gallery-caption" - }, - "imageCrop": { - "type": "boolean", - "default": true - }, - "fixedHeight": { - "type": "boolean", - "default": true - }, - "linkTarget": { - "type": "string" - }, - "linkTo": { - "type": "string" - }, - "sizeSlug": { - "type": "string", - "default": "large" - }, - "allowResize": { - "type": "boolean", - "default": false - } - }, - "providesContext": { - "allowResize": "allowResize", - "imageCrop": "imageCrop", - "fixedHeight": "fixedHeight" - }, - "supports": { - "anchor": true, - "align": true, - "html": false, - "units": [ "px", "em", "rem", "vh", "vw" ], - "spacing": { - "blockGap": true, - "__experimentalSkipSerialization": [ "blockGap" ], - "__experimentalDefaultControls": { - "blockGap": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "allowEditing": false, - "default": { - "type": "flex" - } - } - }, - "editorStyle": "wp-block-gallery-editor", - "style": "wp-block-gallery" -} -.blocks-gallery-grid:not(.has-nested-images),.wp-block-gallery:not(.has-nested-images){display:flex;flex-wrap:wrap;list-style-type:none;padding:0;margin:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item{margin:0 0 1em 1em;display:flex;flex-grow:1;flex-direction:column;justify-content:center;position:relative;width:calc(50% - 1em)}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n){margin-left:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure{margin:0;height:100%;display:flex;align-items:flex-end;justify-content:flex-start}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img{display:block;max-width:100%;height:auto;width:auto}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption{position:absolute;bottom:0;width:100%;max-height:100%;overflow:auto;padding:3em .77em .7em;color:#fff;text-align:center;font-size:.8em;background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);box-sizing:border-box;margin:0;z-index:2}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img{display:inline}.blocks-gallery-grid:not(.has-nested-images) figcaption,.wp-block-gallery:not(.has-nested-images) figcaption{flex-grow:1}.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img{width:100%;height:100%;flex:1;-o-object-fit:cover;object-fit:cover}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item{width:100%;margin-left:0}@media (min-width:600px){.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item{width:calc(33.33333% - .66667em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item{width:calc(25% - .75em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item{width:calc(20% - .8em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item{width:calc(16.66667% - .83333em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item{width:calc(14.28571% - .85714em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item{width:calc(12.5% - .875em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n){margin-left:0}}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child{margin-left:0}.blocks-gallery-grid:not(.has-nested-images).alignleft,.blocks-gallery-grid:not(.has-nested-images).alignright,.wp-block-gallery:not(.has-nested-images).alignleft,.wp-block-gallery:not(.has-nested-images).alignright{max-width:420px;width:100%}.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure{justify-content:center}.wp-block-gallery:not(.is-cropped) .blocks-gallery-item{align-self:flex-start}figure.wp-block-gallery.has-nested-images{align-items:normal}.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)/2);margin:0}.wp-block-gallery.has-nested-images figure.wp-block-image{display:flex;flex-grow:1;justify-content:center;position:relative;flex-direction:column;max-width:100%}.wp-block-gallery.has-nested-images figure.wp-block-image>a,.wp-block-gallery.has-nested-images figure.wp-block-image>div{margin:0;flex-direction:column;flex-grow:1}.wp-block-gallery.has-nested-images figure.wp-block-image img{display:block;height:auto;max-width:100%!important;width:auto}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);bottom:0;color:#fff;font-size:13px;right:0;margin-bottom:0;max-height:60%;overflow:auto;padding:0 8px 8px;position:absolute;text-align:center;width:100%;box-sizing:border-box}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{display:inline}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a{color:inherit}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>a,.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>div{flex:1 1 auto}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption{flex:initial;background:none;color:inherit;margin:0;padding:10px 10px 9px;position:relative}.wp-block-gallery.has-nested-images figcaption{flex-grow:1;flex-basis:100%;text-align:center}.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image){margin-top:0;margin-bottom:auto}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image){align-self:inherit}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>div:not(.components-drop-zone){display:flex}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img{width:100%;flex:1 0 0%;height:100%;-o-object-fit:cover;object-fit:cover}.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image){width:100%}@media (min-width:600px){.wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image){width:calc(33.33333% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image){width:calc(25% - var(--wp--style--unstable-gallery-gap, 16px)*0.75)}.wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image){width:calc(20% - var(--wp--style--unstable-gallery-gap, 16px)*0.8)}.wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image){width:calc(16.66667% - var(--wp--style--unstable-gallery-gap, 16px)*0.83333)}.wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image){width:calc(14.28571% - var(--wp--style--unstable-gallery-gap, 16px)*0.85714)}.wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image){width:calc(12.5% - var(--wp--style--unstable-gallery-gap, 16px)*0.875)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image){width:calc(33.33% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2)~figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)*0.5)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:last-child{width:100%}}.wp-block-gallery.has-nested-images.alignleft,.wp-block-gallery.has-nested-images.alignright{max-width:420px;width:100%}.wp-block-gallery.has-nested-images.aligncenter{justify-content:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.blocks-gallery-caption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .blocks-gallery-caption { - color: rgba(255, 255, 255, 0.65); -}.blocks-gallery-grid:not(.has-nested-images),.wp-block-gallery:not(.has-nested-images){display:flex;flex-wrap:wrap;list-style-type:none;padding:0;margin:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item{margin:0 1em 1em 0;display:flex;flex-grow:1;flex-direction:column;justify-content:center;position:relative;width:calc(50% - 1em)}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n){margin-right:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure{margin:0;height:100%;display:flex;align-items:flex-end;justify-content:flex-start}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img{display:block;max-width:100%;height:auto;width:auto}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption{position:absolute;bottom:0;width:100%;max-height:100%;overflow:auto;padding:3em .77em .7em;color:#fff;text-align:center;font-size:.8em;background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);box-sizing:border-box;margin:0;z-index:2}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img{display:inline}.blocks-gallery-grid:not(.has-nested-images) figcaption,.wp-block-gallery:not(.has-nested-images) figcaption{flex-grow:1}.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img{width:100%;height:100%;flex:1;-o-object-fit:cover;object-fit:cover}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item{width:100%;margin-right:0}@media (min-width:600px){.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item{width:calc(33.33333% - .66667em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item{width:calc(25% - .75em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item{width:calc(20% - .8em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item{width:calc(16.66667% - .83333em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item{width:calc(14.28571% - .85714em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item{width:calc(12.5% - .875em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n){margin-right:0}}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child{margin-right:0}.blocks-gallery-grid:not(.has-nested-images).alignleft,.blocks-gallery-grid:not(.has-nested-images).alignright,.wp-block-gallery:not(.has-nested-images).alignleft,.wp-block-gallery:not(.has-nested-images).alignright{max-width:420px;width:100%}.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure{justify-content:center}.wp-block-gallery:not(.is-cropped) .blocks-gallery-item{align-self:flex-start}figure.wp-block-gallery.has-nested-images{align-items:normal}.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)/2);margin:0}.wp-block-gallery.has-nested-images figure.wp-block-image{display:flex;flex-grow:1;justify-content:center;position:relative;flex-direction:column;max-width:100%}.wp-block-gallery.has-nested-images figure.wp-block-image>a,.wp-block-gallery.has-nested-images figure.wp-block-image>div{margin:0;flex-direction:column;flex-grow:1}.wp-block-gallery.has-nested-images figure.wp-block-image img{display:block;height:auto;max-width:100%!important;width:auto}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);bottom:0;color:#fff;font-size:13px;left:0;margin-bottom:0;max-height:60%;overflow:auto;padding:0 8px 8px;position:absolute;text-align:center;width:100%;box-sizing:border-box}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{display:inline}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a{color:inherit}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>a,.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>div{flex:1 1 auto}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption{flex:initial;background:none;color:inherit;margin:0;padding:10px 10px 9px;position:relative}.wp-block-gallery.has-nested-images figcaption{flex-grow:1;flex-basis:100%;text-align:center}.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image){margin-top:0;margin-bottom:auto}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image){align-self:inherit}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>div:not(.components-drop-zone){display:flex}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img{width:100%;flex:1 0 0%;height:100%;-o-object-fit:cover;object-fit:cover}.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image){width:100%}@media (min-width:600px){.wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image){width:calc(33.33333% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image){width:calc(25% - var(--wp--style--unstable-gallery-gap, 16px)*0.75)}.wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image){width:calc(20% - var(--wp--style--unstable-gallery-gap, 16px)*0.8)}.wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image){width:calc(16.66667% - var(--wp--style--unstable-gallery-gap, 16px)*0.83333)}.wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image){width:calc(14.28571% - var(--wp--style--unstable-gallery-gap, 16px)*0.85714)}.wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image){width:calc(12.5% - var(--wp--style--unstable-gallery-gap, 16px)*0.875)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image){width:calc(33.33% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2)~figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)*0.5)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:last-child{width:100%}}.wp-block-gallery.has-nested-images.alignleft,.wp-block-gallery.has-nested-images.alignright{max-width:420px;width:100%}.wp-block-gallery.has-nested-images.aligncenter{justify-content:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.blocks-gallery-caption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .blocks-gallery-caption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-gallery:not(.has-nested-images), -.blocks-gallery-grid:not(.has-nested-images) { - display: flex; - flex-wrap: wrap; - list-style-type: none; - padding: 0; - margin: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item { - margin: 0 0 1em 1em; - display: flex; - flex-grow: 1; - flex-direction: column; - justify-content: center; - position: relative; - width: calc(50% - 1em); -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even) { - margin-left: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure { - margin: 0; - height: 100%; - display: flex; - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img { - display: block; - max-width: 100%; - height: auto; - width: auto; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption { - position: absolute; - bottom: 0; - width: 100%; - max-height: 100%; - overflow: auto; - padding: 3em 0.77em 0.7em; - color: #fff; - text-align: center; - font-size: 0.8em; - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - box-sizing: border-box; - margin: 0; - z-index: 2; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img { - display: inline; -} -.wp-block-gallery:not(.has-nested-images) figcaption, -.blocks-gallery-grid:not(.has-nested-images) figcaption { - flex-grow: 1; -} -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img, .wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img { - width: 100%; - height: 100%; - flex: 1; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item { - width: 100%; - margin-left: 0; -} -@media (min-width: 600px) { - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item { - width: calc(33.3333333333% - 0.6666666667em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item { - width: calc(25% - 0.75em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item { - width: calc(20% - 0.8em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item { - width: calc(16.6666666667% - 0.8333333333em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item { - width: calc(14.2857142857% - 0.8571428571em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item { - width: calc(12.5% - 0.875em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n) { - margin-left: 0; - } -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child { - margin-left: 0; -} -.wp-block-gallery:not(.has-nested-images).alignleft, .wp-block-gallery:not(.has-nested-images).alignright, -.blocks-gallery-grid:not(.has-nested-images).alignleft, -.blocks-gallery-grid:not(.has-nested-images).alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure { - justify-content: center; -} - -.wp-block-gallery:not(.is-cropped) .blocks-gallery-item { - align-self: flex-start; -} - -figure.wp-block-gallery.has-nested-images { - align-items: normal; -} - -.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) / 2)); - margin: 0; -} -.wp-block-gallery.has-nested-images figure.wp-block-image { - display: flex; - flex-grow: 1; - justify-content: center; - position: relative; - flex-direction: column; - max-width: 100%; -} -.wp-block-gallery.has-nested-images figure.wp-block-image > div, -.wp-block-gallery.has-nested-images figure.wp-block-image > a { - margin: 0; - flex-direction: column; - flex-grow: 1; -} -.wp-block-gallery.has-nested-images figure.wp-block-image img { - display: block; - height: auto; - max-width: 100% !important; - width: auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption { - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - bottom: 0; - color: #fff; - font-size: 13px; - right: 0; - margin-bottom: 0; - max-height: 60%; - overflow: auto; - padding: 0 8px 8px; - position: absolute; - text-align: center; - width: 100%; - box-sizing: border-box; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img { - display: inline; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a { - color: inherit; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > div, -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > a { - flex: 1 1 auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption { - flex: initial; - background: none; - color: inherit; - margin: 0; - padding: 10px 10px 9px; - position: relative; -} -.wp-block-gallery.has-nested-images figcaption { - flex-grow: 1; - flex-basis: 100%; - text-align: center; -} -.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image) { - margin-top: 0; - margin-bottom: auto; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) { - align-self: inherit; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > div:not(.components-drop-zone), -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > a { - display: flex; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a, -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { - width: 100%; - flex: 1 0 0%; - height: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image) { - width: 100%; -} -@media (min-width: 600px) { - .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image) { - width: calc(33.3333333333% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image) { - width: calc(25% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.75)); - } - .wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image) { - width: calc(20% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8)); - } - .wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image) { - width: calc(16.6666666667% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8333333333)); - } - .wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image) { - width: calc(14.2857142857% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8571428571)); - } - .wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image) { - width: calc(12.5% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.875)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image) { - width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2), -.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) { - width: 100%; - } -} -.wp-block-gallery.has-nested-images.alignleft, .wp-block-gallery.has-nested-images.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery.has-nested-images.aligncenter { - justify-content: center; -}.blocks-gallery-caption{color:#555;font-size:13px;text-align:center}.is-dark-theme .blocks-gallery-caption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -figure.wp-block-gallery { - display: block; -} -figure.wp-block-gallery.has-nested-images .components-drop-zone { - display: none; - pointer-events: none; -} -figure.wp-block-gallery > .blocks-gallery-caption { - flex: 0 0 100%; -} -figure.wp-block-gallery > .blocks-gallery-media-placeholder-wrapper { - flex-basis: 100%; -} -figure.wp-block-gallery .wp-block-image .components-notice.is-error { - display: block; -} -figure.wp-block-gallery .wp-block-image .components-notice__content { - margin: 4px 0; -} -figure.wp-block-gallery .wp-block-image .components-notice__dismiss { - position: absolute; - top: 0; - right: 5px; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label { - display: none; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button { - margin-bottom: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder { - margin: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} -figure.wp-block-gallery .block-editor-media-placeholder figcaption { - z-index: 2; -} -figure.wp-block-gallery .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -/** - * Gallery inspector controls settings. - */ -.gallery-settings-buttons .components-button:first-child { - margin-right: 8px; -} - -.gallery-image-sizes .components-base-control__label { - display: block; - margin-bottom: 4px; -} -.gallery-image-sizes .gallery-image-sizes__loading { - display: flex; - align-items: center; - color: #757575; - font-size: 12px; -} -.gallery-image-sizes .components-spinner { - margin: 0 8px 0 4px; -} - -/** - * Deprecated css past this point. This can be removed once all galleries are migrated - * to V2. - */ -.blocks-gallery-item figure:not(.is-selected):focus, -.blocks-gallery-item img:focus { - outline: none; -} -.blocks-gallery-item figure.is-selected::before { - box-shadow: 0 0 0 1px #fff inset, 0 0 0 3px var(--wp-admin-theme-color) inset; - content: ""; - outline: 2px solid transparent; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1; - pointer-events: none; -} -.blocks-gallery-item figure.is-transient img { - opacity: 0.3; -} -.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu { - display: inline-flex; -} -.blocks-gallery-item .block-editor-media-placeholder { - margin: 0; - height: 100%; -} -.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} - -.block-library-gallery-item__inline-menu { - display: none; - position: absolute; - top: -2px; - margin: 8px; - z-index: 20; - transition: box-shadow 0.2s ease-out; - border-radius: 2px; - background: #fff; - border: 1px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .block-library-gallery-item__inline-menu { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-library-gallery-item__inline-menu:hover { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu { - padding: 2px; - } -} -.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus) { - border: none; - box-shadow: none; -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon, .columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon { - padding: 0; - width: inherit; - height: inherit; - } -} -.block-library-gallery-item__inline-menu.is-left { - left: -2px; -} -.block-library-gallery-item__inline-menu.is-right { - right: -2px; -} - -.wp-block-gallery ul.blocks-gallery-grid { - padding: 0; - margin: 0; -} - -@media (min-width: 600px) { - .wp-block-update-gallery-modal { - max-width: 480px; - } -} - -.wp-block-update-gallery-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -}figure.wp-block-gallery{display:block}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{position:absolute;top:0;right:5px}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.gallery-settings-buttons .components-button:first-child{margin-right:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{display:flex;align-items:center;color:#757575;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 8px 0 4px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{padding:0;width:inherit;height:inherit}}.block-library-gallery-item__inline-menu.is-left{left:-2px}.block-library-gallery-item__inline-menu.is-right{right:-2px}.wp-block-gallery ul.blocks-gallery-grid{padding:0;margin:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end;gap:12px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -figure.wp-block-gallery { - display: block; -} -figure.wp-block-gallery.has-nested-images .components-drop-zone { - display: none; - pointer-events: none; -} -figure.wp-block-gallery > .blocks-gallery-caption { - flex: 0 0 100%; -} -figure.wp-block-gallery > .blocks-gallery-media-placeholder-wrapper { - flex-basis: 100%; -} -figure.wp-block-gallery .wp-block-image .components-notice.is-error { - display: block; -} -figure.wp-block-gallery .wp-block-image .components-notice__content { - margin: 4px 0; -} -figure.wp-block-gallery .wp-block-image .components-notice__dismiss { - position: absolute; - top: 0; - left: 5px; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label { - display: none; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button { - margin-bottom: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder { - margin: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} -figure.wp-block-gallery .block-editor-media-placeholder figcaption { - z-index: 2; -} -figure.wp-block-gallery .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -/** - * Gallery inspector controls settings. - */ -.gallery-settings-buttons .components-button:first-child { - margin-left: 8px; -} - -.gallery-image-sizes .components-base-control__label { - display: block; - margin-bottom: 4px; -} -.gallery-image-sizes .gallery-image-sizes__loading { - display: flex; - align-items: center; - color: #757575; - font-size: 12px; -} -.gallery-image-sizes .components-spinner { - margin: 0 4px 0 8px; -} - -/** - * Deprecated css past this point. This can be removed once all galleries are migrated - * to V2. - */ -.blocks-gallery-item figure:not(.is-selected):focus, -.blocks-gallery-item img:focus { - outline: none; -} -.blocks-gallery-item figure.is-selected::before { - box-shadow: 0 0 0 1px #fff inset, 0 0 0 3px var(--wp-admin-theme-color) inset; - content: ""; - outline: 2px solid transparent; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 1; - pointer-events: none; -} -.blocks-gallery-item figure.is-transient img { - opacity: 0.3; -} -.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu { - display: inline-flex; -} -.blocks-gallery-item .block-editor-media-placeholder { - margin: 0; - height: 100%; -} -.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} - -.block-library-gallery-item__inline-menu { - display: none; - position: absolute; - top: -2px; - margin: 8px; - z-index: 20; - transition: box-shadow 0.2s ease-out; - border-radius: 2px; - background: #fff; - border: 1px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .block-library-gallery-item__inline-menu { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-library-gallery-item__inline-menu:hover { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu { - padding: 2px; - } -} -.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus) { - border: none; - box-shadow: none; -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon, .columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon { - padding: 0; - width: inherit; - height: inherit; - } -} -.block-library-gallery-item__inline-menu.is-left { - right: -2px; -} -.block-library-gallery-item__inline-menu.is-right { - left: -2px; -} - -.wp-block-gallery ul.blocks-gallery-grid { - padding: 0; - margin: 0; -} - -@media (min-width: 600px) { - .wp-block-update-gallery-modal { - max-width: 480px; - } -} - -.wp-block-update-gallery-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -}figure.wp-block-gallery{display:block}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{position:absolute;top:0;left:5px}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.gallery-settings-buttons .components-button:first-child{margin-left:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{display:flex;align-items:center;color:#757575;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 4px 0 8px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;pointer-events:none}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{padding:0;width:inherit;height:inherit}}.block-library-gallery-item__inline-menu.is-left{right:-2px}.block-library-gallery-item__inline-menu.is-right{left:-2px}.wp-block-gallery ul.blocks-gallery-grid{padding:0;margin:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.blocks-gallery-caption{color:#555;font-size:13px;text-align:center}.is-dark-theme .blocks-gallery-caption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-gallery:not(.has-nested-images), -.blocks-gallery-grid:not(.has-nested-images) { - display: flex; - flex-wrap: wrap; - list-style-type: none; - padding: 0; - margin: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item { - margin: 0 1em 1em 0; - display: flex; - flex-grow: 1; - flex-direction: column; - justify-content: center; - position: relative; - width: calc(50% - 1em); -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even) { - margin-right: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure { - margin: 0; - height: 100%; - display: flex; - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img { - display: block; - max-width: 100%; - height: auto; - width: auto; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption { - position: absolute; - bottom: 0; - width: 100%; - max-height: 100%; - overflow: auto; - padding: 3em 0.77em 0.7em; - color: #fff; - text-align: center; - font-size: 0.8em; - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - box-sizing: border-box; - margin: 0; - z-index: 2; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img { - display: inline; -} -.wp-block-gallery:not(.has-nested-images) figcaption, -.blocks-gallery-grid:not(.has-nested-images) figcaption { - flex-grow: 1; -} -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img, .wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img { - width: 100%; - height: 100%; - flex: 1; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item { - width: 100%; - margin-right: 0; -} -@media (min-width: 600px) { - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item { - width: calc(33.3333333333% - 0.6666666667em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item { - width: calc(25% - 0.75em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item { - width: calc(20% - 0.8em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item { - width: calc(16.6666666667% - 0.8333333333em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item { - width: calc(14.2857142857% - 0.8571428571em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item { - width: calc(12.5% - 0.875em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n) { - margin-right: 0; - } -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child { - margin-right: 0; -} -.wp-block-gallery:not(.has-nested-images).alignleft, .wp-block-gallery:not(.has-nested-images).alignright, -.blocks-gallery-grid:not(.has-nested-images).alignleft, -.blocks-gallery-grid:not(.has-nested-images).alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure { - justify-content: center; -} - -.wp-block-gallery:not(.is-cropped) .blocks-gallery-item { - align-self: flex-start; -} - -figure.wp-block-gallery.has-nested-images { - align-items: normal; -} - -.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) / 2)); - margin: 0; -} -.wp-block-gallery.has-nested-images figure.wp-block-image { - display: flex; - flex-grow: 1; - justify-content: center; - position: relative; - flex-direction: column; - max-width: 100%; -} -.wp-block-gallery.has-nested-images figure.wp-block-image > div, -.wp-block-gallery.has-nested-images figure.wp-block-image > a { - margin: 0; - flex-direction: column; - flex-grow: 1; -} -.wp-block-gallery.has-nested-images figure.wp-block-image img { - display: block; - height: auto; - max-width: 100% !important; - width: auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption { - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - bottom: 0; - color: #fff; - font-size: 13px; - left: 0; - margin-bottom: 0; - max-height: 60%; - overflow: auto; - padding: 0 8px 8px; - position: absolute; - text-align: center; - width: 100%; - box-sizing: border-box; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img { - display: inline; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a { - color: inherit; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > div, -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > a { - flex: 1 1 auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption { - flex: initial; - background: none; - color: inherit; - margin: 0; - padding: 10px 10px 9px; - position: relative; -} -.wp-block-gallery.has-nested-images figcaption { - flex-grow: 1; - flex-basis: 100%; - text-align: center; -} -.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image) { - margin-top: 0; - margin-bottom: auto; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) { - align-self: inherit; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > div:not(.components-drop-zone), -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > a { - display: flex; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a, -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { - width: 100%; - flex: 1 0 0%; - height: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image) { - width: 100%; -} -@media (min-width: 600px) { - .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image) { - width: calc(33.3333333333% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image) { - width: calc(25% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.75)); - } - .wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image) { - width: calc(20% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8)); - } - .wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image) { - width: calc(16.6666666667% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8333333333)); - } - .wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image) { - width: calc(14.2857142857% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8571428571)); - } - .wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image) { - width: calc(12.5% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.875)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image) { - width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2), -.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) { - width: 100%; - } -} -.wp-block-gallery.has-nested-images.alignleft, .wp-block-gallery.has-nested-images.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery.has-nested-images.aligncenter { - justify-content: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/heading", - "title": "Heading", - "category": "text", - "description": "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.", - "keywords": [ "title", "subtitle" ], - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - }, - "content": { - "type": "string", - "source": "html", - "selector": "h1,h2,h3,h4,h5,h6", - "default": "", - "__experimentalRole": "content" - }, - "level": { - "type": "number", - "default": 2 - }, - "placeholder": { - "type": "string" - } - }, - "supports": { - "align": [ "wide", "full" ], - "anchor": true, - "className": false, - "color": { - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "margin": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true, - "textTransform": true - } - }, - "__experimentalSelector": "h1,h2,h3,h4,h5,h6", - "__unstablePasteTextInline": true, - "__experimentalSlashInserter": true - }, - "editorStyle": "wp-block-heading-editor", - "style": "wp-block-heading" -} -h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -h1.has-background, -h2.has-background, -h3.has-background, -h4.has-background, -h5.has-background, -h6.has-background { - padding: 1.25em 2.375em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -h1.has-background, -h2.has-background, -h3.has-background, -h4.has-background, -h5.has-background, -h6.has-background { - padding: 1.25em 2.375em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-template", - "title": "Comment Template", - "category": "design", - "parent": [ "core/comments-query-loop" ], - "description": "Contains the block elements used to display a comment, like the title, date, author, avatar and more.", - "textdomain": "default", - "usesContext": [ "postId" ], - "supports": { - "reusable": false, - "html": false, - "align": true - }, - "style": "wp-block-comment-template" -} -.wp-block-comment-template{margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-comment-template li{clear:both}.wp-block-comment-template ol{margin-bottom:0;max-width:100%;list-style:none;padding-right:2rem}.wp-block-comment-template{margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-comment-template li{clear:both}.wp-block-comment-template ol{margin-bottom:0;max-width:100%;list-style:none;padding-left:2rem}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comment-template { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-comment-template li { - clear: both; -} -.wp-block-comment-template ol { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding-right: 2rem; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comment-template { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-comment-template li { - clear: both; -} -.wp-block-comment-template ol { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding-left: 2rem; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-content", - "title": "Comment Content", - "category": "theme", - "ancestor": [ "core/comment-template" ], - "description": "Displays the contents of a comment.", - "textdomain": "default", - "usesContext": [ "commentId" ], - "attributes": { - "textAlign": { - "type": "string" - } - }, - "supports": { - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true - }, - "spacing": { - "padding": [ "horizontal", "vertical" ], - "__experimentalDefaultControls": { - "padding": true - } - }, - "html": false - } -} -.comment-awaiting-moderation{display:block;font-size:.875em;line-height:1.5}.comment-awaiting-moderation{display:block;font-size:.875em;line-height:1.5}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.comment-awaiting-moderation { - display: block; - font-size: 0.875em; - line-height: 1.5; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.comment-awaiting-moderation { - display: block; - font-size: 0.875em; - line-height: 1.5; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/term-description", - "title": "Term Description", - "category": "theme", - "description": "Display the description of categories, tags and custom taxonomies when viewing an archive.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - } - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "editorStyle": "wp-block-term-description-editor" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/rss", - "title": "RSS", - "category": "widgets", - "description": "Display entries from any RSS or Atom feed.", - "keywords": [ "atom", "feed" ], - "textdomain": "default", - "attributes": { - "columns": { - "type": "number", - "default": 2 - }, - "blockLayout": { - "type": "string", - "default": "list" - }, - "feedURL": { - "type": "string", - "default": "" - }, - "itemsToShow": { - "type": "number", - "default": 5 - }, - "displayExcerpt": { - "type": "boolean", - "default": false - }, - "displayAuthor": { - "type": "boolean", - "default": false - }, - "displayDate": { - "type": "boolean", - "default": false - }, - "excerptLength": { - "type": "number", - "default": 55 - } - }, - "supports": { - "align": true, - "html": false - }, - "editorStyle": "wp-block-rss-editor", - "style": "wp-block-rss" -} -ul.wp-block-rss{list-style:none;padding:0}ul.wp-block-rss.wp-block-rss{box-sizing:border-box}ul.wp-block-rss.alignleft{margin-right:2em}ul.wp-block-rss.alignright{margin-left:2em}ul.wp-block-rss.is-grid{display:flex;flex-wrap:wrap;padding:0;list-style:none}ul.wp-block-rss.is-grid li{margin:0 0 1em 1em;width:100%}@media (min-width:600px){ul.wp-block-rss.columns-2 li{width:calc(50% - 1em)}ul.wp-block-rss.columns-3 li{width:calc(33.33333% - 1em)}ul.wp-block-rss.columns-4 li{width:calc(25% - 1em)}ul.wp-block-rss.columns-5 li{width:calc(20% - 1em)}ul.wp-block-rss.columns-6 li{width:calc(16.66667% - 1em)}}.wp-block-rss__item-author,.wp-block-rss__item-publish-date{display:block;font-size:.8125em}ul.wp-block-rss{list-style:none;padding:0}ul.wp-block-rss.wp-block-rss{box-sizing:border-box}ul.wp-block-rss.alignleft{margin-right:2em}ul.wp-block-rss.alignright{margin-left:2em}ul.wp-block-rss.is-grid{display:flex;flex-wrap:wrap;padding:0;list-style:none}ul.wp-block-rss.is-grid li{margin:0 1em 1em 0;width:100%}@media (min-width:600px){ul.wp-block-rss.columns-2 li{width:calc(50% - 1em)}ul.wp-block-rss.columns-3 li{width:calc(33.33333% - 1em)}ul.wp-block-rss.columns-4 li{width:calc(25% - 1em)}ul.wp-block-rss.columns-5 li{width:calc(20% - 1em)}ul.wp-block-rss.columns-6 li{width:calc(16.66667% - 1em)}}.wp-block-rss__item-author,.wp-block-rss__item-publish-date{display:block;font-size:.8125em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-rss { - list-style: none; - padding: 0; -} -ul.wp-block-rss.wp-block-rss { - box-sizing: border-box; -} -ul.wp-block-rss.alignleft { - margin-right: 2em; -} -ul.wp-block-rss.alignright { - margin-left: 2em; -} -ul.wp-block-rss.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; - list-style: none; -} -ul.wp-block-rss.is-grid li { - margin: 0 0 1em 1em; - width: 100%; -} -@media (min-width: 600px) { - ul.wp-block-rss.columns-2 li { - width: calc(( 100% / 2 ) - 1em); - } - ul.wp-block-rss.columns-3 li { - width: calc(( 100% / 3 ) - 1em); - } - ul.wp-block-rss.columns-4 li { - width: calc(( 100% / 4 ) - 1em); - } - ul.wp-block-rss.columns-5 li { - width: calc(( 100% / 5 ) - 1em); - } - ul.wp-block-rss.columns-6 li { - width: calc(( 100% / 6 ) - 1em); - } -} - -.wp-block-rss__item-publish-date, -.wp-block-rss__item-author { - display: block; - font-size: 0.8125em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-rss li a > div { - display: inline; -} - -.wp-block-rss__placeholder-form { - display: flex; - align-items: stretch; -} -.wp-block-rss__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .wp-block-rss__placeholder-form > * { - margin-bottom: 0; - } -} - -.wp-block-rss__placeholder-input { - display: flex; - align-items: stretch; - flex-grow: 1; -} -.wp-block-rss__placeholder-input .components-base-control__field { - margin: 0; - display: flex; - align-items: stretch; - flex-grow: 1; - margin-right: 8px; -}.wp-block-rss li a>div{display:inline}.wp-block-rss__placeholder-form{display:flex;align-items:stretch}.wp-block-rss__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.wp-block-rss__placeholder-form>*{margin-bottom:0}}.wp-block-rss__placeholder-input{display:flex;align-items:stretch;flex-grow:1}.wp-block-rss__placeholder-input .components-base-control__field{display:flex;align-items:stretch;flex-grow:1;margin:0 8px 0 0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-rss li a > div { - display: inline; -} - -.wp-block-rss__placeholder-form { - display: flex; - align-items: stretch; -} -.wp-block-rss__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .wp-block-rss__placeholder-form > * { - margin-bottom: 0; - } -} - -.wp-block-rss__placeholder-input { - display: flex; - align-items: stretch; - flex-grow: 1; -} -.wp-block-rss__placeholder-input .components-base-control__field { - margin: 0; - display: flex; - align-items: stretch; - flex-grow: 1; - margin-left: 8px; -}.wp-block-rss li a>div{display:inline}.wp-block-rss__placeholder-form{display:flex;align-items:stretch}.wp-block-rss__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.wp-block-rss__placeholder-form>*{margin-bottom:0}}.wp-block-rss__placeholder-input{display:flex;align-items:stretch;flex-grow:1}.wp-block-rss__placeholder-input .components-base-control__field{display:flex;align-items:stretch;flex-grow:1;margin:0 0 0 8px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-rss { - list-style: none; - padding: 0; -} -ul.wp-block-rss.wp-block-rss { - box-sizing: border-box; -} -ul.wp-block-rss.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -ul.wp-block-rss.alignright { - /*rtl:ignore*/ - margin-left: 2em; -} -ul.wp-block-rss.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; - list-style: none; -} -ul.wp-block-rss.is-grid li { - margin: 0 1em 1em 0; - width: 100%; -} -@media (min-width: 600px) { - ul.wp-block-rss.columns-2 li { - width: calc(( 100% / 2 ) - 1em); - } - ul.wp-block-rss.columns-3 li { - width: calc(( 100% / 3 ) - 1em); - } - ul.wp-block-rss.columns-4 li { - width: calc(( 100% / 4 ) - 1em); - } - ul.wp-block-rss.columns-5 li { - width: calc(( 100% / 5 ) - 1em); - } - ul.wp-block-rss.columns-6 li { - width: calc(( 100% / 6 ) - 1em); - } -} - -.wp-block-rss__item-publish-date, -.wp-block-rss__item-author { - display: block; - font-size: 0.8125em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-pagination-next", - "title": "Next Page", - "category": "theme", - "parent": [ "core/comments-pagination" ], - "description": "Displays the next comment's page link.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - } - }, - "usesContext": [ "postId", "comments/paginationArrow" ], - "supports": { - "reusable": false, - "html": false, - "color": { - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-pagination-numbers", - "title": "Page Numbers", - "category": "theme", - "parent": [ "core/query-pagination" ], - "description": "Displays a list of page numbers for pagination", - "textdomain": "default", - "usesContext": [ "queryId", "query" ], - "supports": { - "reusable": false, - "html": false, - "color": { - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "editorStyle": "query-pagination-numbers-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-query-pagination-numbers a { - text-decoration: underline; -} -.wp-block-query-pagination-numbers .page-numbers { - margin-right: 2px; -} -.wp-block-query-pagination-numbers .page-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -}.wp-block-query-pagination-numbers a{text-decoration:underline}.wp-block-query-pagination-numbers .page-numbers{margin-right:2px}.wp-block-query-pagination-numbers .page-numbers:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-query-pagination-numbers a { - text-decoration: underline; -} -.wp-block-query-pagination-numbers .page-numbers { - margin-left: 2px; -} -.wp-block-query-pagination-numbers .page-numbers:last-child { - margin-right: 0; -}.wp-block-query-pagination-numbers a{text-decoration:underline}.wp-block-query-pagination-numbers .page-numbers{margin-left:2px}.wp-block-query-pagination-numbers .page-numbers:last-child{margin-right:0}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/code", - "title": "Code", - "category": "text", - "description": "Display code snippets that respect your spacing and tabs.", - "textdomain": "default", - "attributes": { - "content": { - "type": "string", - "source": "html", - "selector": "code" - } - }, - "supports": { - "anchor": true, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "spacing": { - "margin": [ "top", "bottom" ], - "padding": true - }, - "__experimentalBorder": { - "radius": true, - "color": true, - "width": true, - "style": true, - "__experimentalDefaultControls": { - "width": true, - "color": true - } - }, - "color": { - "text": true, - "background": true, - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - } - }, - "style": "wp-block-code" -} -.wp-block-code code{display:block;font-family:inherit;overflow-wrap:break-word;white-space:pre-wrap}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-code { - border: 1px solid #ccc; - border-radius: 4px; - font-family: Menlo, Consolas, monaco, monospace; - padding: 0.8em 1em; -}.wp-block-code code{display:block;font-family:inherit;overflow-wrap:break-word;white-space:pre-wrap}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-code { - border: 1px solid #ccc; - border-radius: 4px; - font-family: Menlo, Consolas, monaco, monospace; - padding: 0.8em 1em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-code code { - display: block; - font-family: inherit; - overflow-wrap: break-word; - white-space: pre-wrap; -}.wp-block-code{border:1px solid #ccc;border-radius:4px;font-family:Menlo,Consolas,monaco,monospace;padding:.8em 1em}.wp-block-code{border:1px solid #ccc;border-radius:4px;font-family:Menlo,Consolas,monaco,monospace;padding:.8em 1em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-code code { - display: block; - font-family: inherit; - overflow-wrap: break-word; - white-space: pre-wrap; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/navigation", - "title": "Navigation", - "category": "theme", - "description": "A collection of blocks that allow visitors to get around your site.", - "keywords": [ "menu", "navigation", "links" ], - "textdomain": "default", - "attributes": { - "ref": { - "type": "number" - }, - "textColor": { - "type": "string" - }, - "customTextColor": { - "type": "string" - }, - "rgbTextColor": { - "type": "string" - }, - "backgroundColor": { - "type": "string" - }, - "customBackgroundColor": { - "type": "string" - }, - "rgbBackgroundColor": { - "type": "string" - }, - "showSubmenuIcon": { - "type": "boolean", - "default": true - }, - "openSubmenusOnClick": { - "type": "boolean", - "default": false - }, - "overlayMenu": { - "type": "string", - "default": "mobile" - }, - "hasIcon": { - "type": "boolean", - "default": true - }, - "__unstableLocation": { - "type": "string" - }, - "overlayBackgroundColor": { - "type": "string" - }, - "customOverlayBackgroundColor": { - "type": "string" - }, - "overlayTextColor": { - "type": "string" - }, - "customOverlayTextColor": { - "type": "string" - }, - "maxNestingLevel": { - "type": "number", - "default": 5 - } - }, - "providesContext": { - "textColor": "textColor", - "customTextColor": "customTextColor", - "backgroundColor": "backgroundColor", - "customBackgroundColor": "customBackgroundColor", - "overlayTextColor": "overlayTextColor", - "customOverlayTextColor": "customOverlayTextColor", - "overlayBackgroundColor": "overlayBackgroundColor", - "customOverlayBackgroundColor": "customOverlayBackgroundColor", - "fontSize": "fontSize", - "customFontSize": "customFontSize", - "showSubmenuIcon": "showSubmenuIcon", - "openSubmenusOnClick": "openSubmenusOnClick", - "style": "style", - "orientation": "orientation", - "maxNestingLevel": "maxNestingLevel" - }, - "supports": { - "align": [ "wide", "full" ], - "anchor": true, - "html": false, - "inserter": true, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalTextTransform": true, - "__experimentalFontFamily": true, - "__experimentalTextDecoration": true, - "__experimentalSkipSerialization": [ "textDecoration" ], - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "spacing": { - "blockGap": true, - "units": [ "px", "em", "rem", "vh", "vw" ], - "__experimentalDefaultControls": { - "blockGap": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "allowVerticalAlignment": false, - "default": { - "type": "flex" - } - } - }, - "viewScript": "file:./view.min.js", - "editorStyle": "wp-block-navigation-editor", - "style": "wp-block-navigation" -} -.wp-block-navigation{position:relative;--navigation-layout-justification-setting:flex-start;--navigation-layout-direction:row;--navigation-layout-wrap:wrap;--navigation-layout-justify:flex-start;--navigation-layout-align:center}.wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-right:0;padding-right:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{display:flex;align-items:center;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{color:inherit;display:block;padding:0}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;line-height:0;display:inline-block;font-size:inherit;padding:0;background-color:inherit;color:currentColor;border:none;width:.6em;height:.6em;margin-right:.25em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{display:inline-block;stroke:currentColor;width:inherit;height:inherit;margin-top:.075em}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container){background-color:inherit;color:inherit;position:absolute;z-index:2;display:flex;flex-direction:column;align-items:normal;opacity:0;transition:opacity .1s linear;visibility:hidden;width:0;height:0;overflow:hidden;right:-1px;top:100%}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{margin-left:0;margin-right:auto}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container:before{content:"";position:absolute;left:100%;height:100%;display:block;width:.5em;background:transparent}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon{margin-left:.25em}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg{transform:rotate(90deg)}}.wp-block-navigation .has-child:where(:not(.open-on-click)):hover>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{right:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:0}}.wp-block-navigation-submenu{position:relative;display:flex}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-size:inherit;font-family:inherit;line-height:inherit;font-style:inherit;font-weight:inherit;text-transform:inherit;text-align:right}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-left:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-right:-.6em;pointer-events:none}.wp-block-navigation,.wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background),.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background) .wp-block-navigation__container,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content,.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{right:auto;left:0}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:-1px;left:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:auto;left:100%}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;color:#000;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation__container{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);list-style:none;margin:0;padding-right:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}.wp-block-navigation__responsive-container{display:none;position:fixed;top:0;right:0;left:0;bottom:0}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){color:inherit!important;background-color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{display:flex;flex-direction:column;background-color:inherit;padding:2rem;overflow:auto;z-index:100000}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{padding-top:calc(2rem + 24px);overflow:visible;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:var(--navigation-layout-justification-setting,inherit)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{opacity:1;visibility:visible;height:auto;width:auto;overflow:initial;min-width:200px;position:static;border:none;padding-right:2rem;padding-left:2rem}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{display:flex;flex-direction:column;align-items:var(--navigation-layout-justification-setting,initial)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{color:inherit!important;background:transparent!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:auto;right:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){display:block;width:100%;position:relative;z-index:auto;background-color:inherit}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{right:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff;color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{vertical-align:middle;cursor:pointer;color:currentColor;background:transparent;border:none;margin:0;padding:0}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;pointer-events:none;display:block;width:24px;height:24px}.wp-block-navigation__responsive-container-open{display:flex}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{position:absolute;top:0;left:0;z-index:2}.wp-block-navigation__responsive-close{width:100%}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}html.has-modal-open{overflow:hidden}.wp-block-navigation{position:relative;--navigation-layout-justification-setting:flex-start;--navigation-layout-direction:row;--navigation-layout-wrap:wrap;--navigation-layout-justify:flex-start;--navigation-layout-align:center}.wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-left:0;padding-left:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{display:flex;align-items:center;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{color:inherit;display:block;padding:0}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;line-height:0;display:inline-block;font-size:inherit;padding:0;background-color:inherit;color:currentColor;border:none;width:.6em;height:.6em;margin-left:.25em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{display:inline-block;stroke:currentColor;width:inherit;height:inherit;margin-top:.075em}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container){background-color:inherit;color:inherit;position:absolute;z-index:2;display:flex;flex-direction:column;align-items:normal;opacity:0;transition:opacity .1s linear;visibility:hidden;width:0;height:0;overflow:hidden;left:-1px;top:100%}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{margin-right:0;margin-left:auto}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container:before{content:"";position:absolute;right:100%;height:100%;display:block;width:.5em;background:transparent}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon{margin-right:.25em}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg{transform:rotate(-90deg)}}.wp-block-navigation .has-child:where(:not(.open-on-click)):hover>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{left:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:0}}.wp-block-navigation-submenu{position:relative;display:flex}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-size:inherit;font-family:inherit;line-height:inherit;font-style:inherit;font-weight:inherit;text-transform:inherit;text-align:left}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-right:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-left:-.6em;pointer-events:none}.wp-block-navigation,.wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background),.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background) .wp-block-navigation__container,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content,.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{left:auto;right:0}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:-1px;right:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:auto;right:100%}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;color:#000;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation__container{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);list-style:none;margin:0;padding-left:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}.wp-block-navigation__responsive-container{display:none;position:fixed;top:0;left:0;right:0;bottom:0}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){color:inherit!important;background-color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{display:flex;flex-direction:column;background-color:inherit;padding:2rem;overflow:auto;z-index:100000}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{padding-top:calc(2rem + 24px);overflow:visible;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:var(--navigation-layout-justification-setting,inherit)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{opacity:1;visibility:visible;height:auto;width:auto;overflow:initial;min-width:200px;position:static;border:none;padding-left:2rem;padding-right:2rem}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{display:flex;flex-direction:column;align-items:var(--navigation-layout-justification-setting,initial)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{color:inherit!important;background:transparent!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{right:auto;left:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){display:block;width:100%;position:relative;z-index:auto;background-color:inherit}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff;color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{vertical-align:middle;cursor:pointer;color:currentColor;background:transparent;border:none;margin:0;padding:0}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;pointer-events:none;display:block;width:24px;height:24px}.wp-block-navigation__responsive-container-open{display:flex}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{position:absolute;top:0;right:0;z-index:2}.wp-block-navigation__responsive-close{width:100%}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}html.has-modal-open{overflow:hidden}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation { - position: relative; - --navigation-layout-justification-setting: flex-start; - --navigation-layout-direction: row; - --navigation-layout-wrap: wrap; - --navigation-layout-justify: flex-start; - --navigation-layout-align: center; -} -.wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-right: 0; - padding-right: 0; -} -.wp-block-navigation ul, -.wp-block-navigation ul li { - list-style: none; - padding: 0; -} -.wp-block-navigation .wp-block-navigation-item { - display: flex; - align-items: center; - position: relative; -} -.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty { - display: none; -} -.wp-block-navigation .wp-block-navigation-item__content { - color: inherit; - display: block; - padding: 0; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content { - text-decoration: line-through; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active { - text-decoration: line-through; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a { - text-decoration: none; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a:focus, .wp-block-navigation:where(:not([class*="has-text-decoration"])) a:active { - text-decoration: none; -} -.wp-block-navigation .wp-block-navigation__submenu-icon { - align-self: center; - line-height: 0; - display: inline-block; - font-size: inherit; - padding: 0; - background-color: inherit; - color: currentColor; - border: none; - width: 0.6em; - height: 0.6em; - margin-right: 0.25em; -} -.wp-block-navigation .wp-block-navigation__submenu-icon svg { - display: inline-block; - stroke: currentColor; - width: inherit; - height: inherit; - margin-top: 0.075em; -} -.wp-block-navigation.is-vertical { - --navigation-layout-direction: column; - --navigation-layout-justify: initial; - --navigation-layout-align: flex-start; -} -.wp-block-navigation.no-wrap { - --navigation-layout-wrap: nowrap; -} -.wp-block-navigation.items-justified-center { - --navigation-layout-justification-setting: center; - --navigation-layout-justify: center; -} -.wp-block-navigation.items-justified-center.is-vertical { - --navigation-layout-align: center; -} -.wp-block-navigation.items-justified-right { - --navigation-layout-justification-setting: flex-end; - --navigation-layout-justify: flex-end; -} -.wp-block-navigation.items-justified-right.is-vertical { - --navigation-layout-align: flex-end; -} -.wp-block-navigation.items-justified-space-between { - --navigation-layout-justification-setting: space-between; - --navigation-layout-justify: space-between; -} - -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) { - background-color: inherit; - color: inherit; - position: absolute; - z-index: 2; - display: flex; - flex-direction: column; - align-items: normal; - opacity: 0; - transition: opacity 0.1s linear; - visibility: hidden; - width: 0; - height: 0; - overflow: hidden; - right: -1px; - top: 100%; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content { - display: flex; - flex-grow: 1; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon { - margin-left: 0; - margin-right: auto; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - margin: 0; -} -@media (min-width: 782px) { - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container { - right: 100%; - top: -1px; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - left: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon { - margin-left: 0.25em; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg { - transform: rotate(90deg); - } -} -.wp-block-navigation .has-child:where(:not(.open-on-click)):hover > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true] ~ .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container { - right: 0; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: 100%; - top: 0; - } -} - -.wp-block-navigation-submenu { - position: relative; - display: flex; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg { - stroke: currentColor; -} - -button.wp-block-navigation-item__content { - background-color: transparent; - border: none; - color: currentColor; - font-size: inherit; - font-family: inherit; - line-height: inherit; - font-style: inherit; - font-weight: inherit; - text-transform: inherit; - text-align: right; -} - -.wp-block-navigation-submenu__toggle { - cursor: pointer; -} - -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle { - padding-left: 0.85em; -} -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle + .wp-block-navigation__submenu-icon { - margin-right: -0.6em; - pointer-events: none; -} - -/** - * Margins - */ -.wp-block-navigation__responsive-container, -.wp-block-navigation__responsive-close, -.wp-block-navigation__responsive-dialog, -.wp-block-navigation, -.wp-block-navigation .wp-block-page-list, -.wp-block-navigation__container, -.wp-block-navigation__responsive-container-content { - gap: inherit; -} - -.wp-block-navigation:where(.has-background), -.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list, -.wp-block-navigation:where(.has-background) .wp-block-navigation__container { - gap: inherit; -} - -/** - * Paddings - */ -.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -/** - * Justifications. - */ -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container { - right: auto; - left: 0; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: -1px; - left: -1px; -} -@media (min-width: 782px) { - .wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: auto; - left: 100%; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container { - background-color: #fff; - color: #000; - border: 1px solid rgba(0, 0, 0, 0.15); -} - -.wp-block-navigation__container { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - list-style: none; - margin: 0; - padding-right: 0; -} -.wp-block-navigation__container .is-responsive { - display: none; -} - -.wp-block-navigation__container:only-child, -.wp-block-page-list:only-child { - flex-grow: 1; -} - -/** - * Mobile menu. - */ -.wp-block-navigation__responsive-container { - display: none; - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; -} -.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); -} -.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open) { - color: inherit !important; - background-color: inherit !important; -} -.wp-block-navigation__responsive-container.is-menu-open { - display: flex; - flex-direction: column; - background-color: inherit; - padding: 2rem; - overflow: auto; - z-index: 100000; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { - padding-top: calc(2rem + 24px); - overflow: visible; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-items: var(--navigation-layout-justification-setting, inherit); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - justify-content: flex-start; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon { - display: none; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; - height: auto; - width: auto; - overflow: initial; - min-width: 200px; - position: static; - border: none; - padding-right: 2rem; - padding-left: 2rem; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - gap: inherit; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container { - padding-top: var(--wp--style--block-gap, 2em); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content { - padding: 0; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list { - display: flex; - flex-direction: column; - align-items: var(--navigation-layout-justification-setting, initial); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list { - color: inherit !important; - background: transparent !important; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - left: auto; - right: auto; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { - display: block; - width: 100%; - position: relative; - z-index: auto; - background-color: inherit; - } - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close { - display: none; - } - .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - right: 0; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open { - background-color: #fff; - color: #000; -} - -.wp-block-navigation__toggle_button_label { - font-size: 1rem; - font-weight: bold; -} - -.wp-block-navigation__responsive-container-open, -.wp-block-navigation__responsive-container-close { - vertical-align: middle; - cursor: pointer; - color: currentColor; - background: transparent; - border: none; - margin: 0; - padding: 0; -} -.wp-block-navigation__responsive-container-open svg, -.wp-block-navigation__responsive-container-close svg { - fill: currentColor; - pointer-events: none; - display: block; - width: 24px; - height: 24px; -} - -.wp-block-navigation__responsive-container-open { - display: flex; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container-open:not(.always-shown) { - display: none; - } -} - -.wp-block-navigation__responsive-container-close { - position: absolute; - top: 0; - left: 0; - z-index: 2; -} - -.wp-block-navigation__responsive-close { - width: 100%; -} -.wp-block-navigation__responsive-close:focus { - outline: none; -} - -.is-menu-open .wp-block-navigation__responsive-close, -.is-menu-open .wp-block-navigation__responsive-dialog, -.is-menu-open .wp-block-navigation__responsive-container-content { - box-sizing: border-box; -} - -.wp-block-navigation__responsive-dialog { - position: relative; -} - -html.has-modal-open { - overflow: hidden; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Editor only CSS. -*/ -.editor-styles-wrapper .wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-left: 0; - padding-left: 0; -} -.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block { - margin: revert; -} - -.wp-block-navigation-item__label { - display: inline; -} - -/** - * Submenus. - */ -.wp-block-navigation__container.is-parent-of-selected-block { - visibility: visible; - opacity: 1; - overflow: visible; -} - -.wp-block-navigation__container, -.wp-block-navigation-item { - background-color: inherit; -} - -.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover > .wp-block-navigation__submenu-container { - opacity: 0; - visibility: hidden; -} - -.has-child.is-selected > .wp-block-navigation__submenu-container, .has-child.has-child-selected > .wp-block-navigation__submenu-container { - display: flex; - opacity: 1; - visibility: visible; -} - -.is-dragging-components-draggable .has-child.is-dragging-within > .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; -} - -.is-editing > .wp-block-navigation__container { - visibility: visible; - opacity: 1; - display: flex; - flex-direction: column; -} - -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container { - opacity: 1; - visibility: hidden; -} -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container .block-editor-block-draggable-chip-wrapper { - visibility: visible; -} - -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender { - display: block; - position: static; - width: 100%; -} -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender .block-editor-button-block-appender { - color: #fff; - background: #1e1e1e; - padding: 0; - width: 24px; - border-radius: 2px; - margin-right: 0; - margin-left: auto; -} - -.wp-block-navigation__submenu-container .block-list-appender { - display: none; -} - -/** - * Colors Selector component - */ -.block-library-colors-selector { - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__toggle { - display: block; - margin: 0 auto; - padding: 3px; - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__icon-container { - height: 30px; - position: relative; - margin: 0 auto; - padding: 3px; - display: flex; - align-items: center; - border-radius: 4px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection { - margin-left: auto; - margin-right: auto; - border-radius: 11px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - width: 22px; - min-width: 22px; - height: 22px; - min-height: 22px; - line-height: 20px; - padding: 2px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection > svg { - min-width: auto !important; -} -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg, -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg path { - color: inherit; -} - -.block-library-colors-selector__popover .color-palette-controller-container { - padding: 16px; -} -.block-library-colors-selector__popover .components-base-control__label { - height: 20px; - line-height: 20px; -} -.block-library-colors-selector__popover .component-color-indicator { - float: right; - margin-top: 2px; -} -.block-library-colors-selector__popover .components-panel__body-title { - display: none; -} - -.wp-block-navigation .block-editor-button-block-appender { - background-color: #1e1e1e; - color: #fff; -} -.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender { - padding: 0; -} - -.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender { - background-color: transparent; - color: #1e1e1e; -} - -/** - * Setup state - */ -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.components-placeholder.wp-block-navigation-placeholder { - outline: none; - padding: 0; - box-shadow: none; - background: none; - min-height: 0; - color: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset { - font-size: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button { - margin-bottom: 0; -} -.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder { - color: #1e1e1e; -} - -.wp-block-navigation-placeholder .components-spinner { - margin-top: 0; -} - -.wp-block-navigation-placeholder__preview { - display: flex; - align-items: center; - min-width: 96px; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: currentColor; - background: transparent; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview { - display: none; -} -.wp-block-navigation-placeholder__preview::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-navigation-placeholder__preview > svg { - fill: currentColor; - opacity: 0.4; -} - -.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset, -.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset { - min-height: 90px; -} - -.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset { - min-height: 132px; -} - -.wp-block-navigation-placeholder__preview, -.wp-block-navigation-placeholder__controls { - padding: 6px 8px; - flex-direction: row; - align-items: flex-start; -} - -.wp-block-navigation-placeholder__controls { - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - display: none; - position: relative; - z-index: 1; - float: left; - width: 100%; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls { - display: flex; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr, .is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr { - display: none; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions { - flex-direction: column; - align-items: flex-start; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr { - display: none; -} -.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon { - margin-right: 12px; - height: 36px; -} - -.wp-block-navigation-placeholder__actions__indicator { - display: flex; - padding: 0 6px 0 0; - align-items: center; - justify-content: flex-start; - line-height: 0; - height: 36px; - margin-left: 4px; -} -.wp-block-navigation-placeholder__actions__indicator svg { - margin-right: 4px; - fill: currentColor; -} - -.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset { - flex-direction: row !important; -} - -.wp-block-navigation-placeholder__actions { - display: flex; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - gap: 6px; - align-items: center; - height: 100%; -} -.wp-block-navigation-placeholder__actions .components-dropdown, -.wp-block-navigation-placeholder__actions > .components-button { - margin-right: 0; -} -.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr { - border: 0; - min-height: 1px; - min-width: 1px; - background-color: #1e1e1e; - margin: auto 0; - height: 100%; - max-height: 16px; -} - -/** - * Mobile menu. - */ -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close { - display: none; - } -} - -.wp-block-navigation__responsive-container.is-menu-open { - position: fixed; - top: 155px; -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - top: 93px; - } -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - left: 36px; - } -} -@media (min-width: 960px) { - .wp-block-navigation__responsive-container.is-menu-open { - left: 160px; - } -} - -@media (min-width: 782px) { - .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; - } -} - -.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; -} - -.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open { - right: 280px; -} - -.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - left: 0; - top: 155px; -} -@media (min-width: 782px) { - .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - top: 61px; - } -} -@media (min-width: 782px) { - .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; - } -} -.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; -} - -body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open { - top: 0; - right: 0; - bottom: 0; - left: 0; -} - -@media (min-width: 600px) { - .wp-block-navigation__responsive-close { - pointer-events: none; - } - .wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close, -.wp-block-navigation__responsive-close .block-editor-block-list__layout * { - pointer-events: all; - } -} -.wp-block-navigation__responsive-close .wp-block-pages-list__item__link { - pointer-events: none; -} - -.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open, -.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close { - padding: 0; - height: auto; - color: inherit; -} - -.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender { - margin-top: 16px; -} - -@keyframes fadein { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.wp-block-navigation .components-spinner { - padding: 8px 12px; -} - -.wp-block-navigation__unsaved-changes { - position: relative; -} -.wp-block-navigation__unsaved-changes .components-spinner { - position: absolute; - top: calc(50% - 16px / 2); - left: calc(50% - 16px / 2); - opacity: 0; - animation: 0.5s linear 2s normal forwards fadein; -} - -@keyframes fadeouthalf { - 0% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.wp-block-navigation__unsaved-changes-overlay.is-saving { - opacity: 1; - animation: 0.5s linear 2s normal forwards fadeouthalf; -} - -.wp-block-navigation-delete-menu-button { - width: 100%; - justify-content: center; - margin-bottom: 16px; -} - -.wp-block-navigation__overlay-menu-preview { - display: flex; - align-items: center; - width: 100%; - background-color: #f0f0f0; - padding: 0 24px; - height: 64px; - margin-bottom: 12px; -} -.wp-block-navigation__overlay-menu-preview.open { - box-shadow: inset 0 0 0 1px #e0e0e0; - outline: 1px solid transparent; - background-color: #fff; -} - -.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty { - display: none; -} - -.wp-block-navigation-placeholder__actions hr + hr { - display: none; -}!function(){"use strict";function e(e,t){for(var o=0;oe.length)&&(t=e.length);for(var o=0,n=new Array(t);o0&&this.registerTriggers.apply(this,t(a)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var i,a;return i=o,(a=[{key:"registerTriggers",value:function(){for(var e=this,t=arguments.length,o=new Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var o=function t(){e.modal.removeEventListener("animationend",t,!1),e.setFocusToFirstNode()};this.modal.addEventListener("animationend",o,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,t)}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var o=this.config.openClass;this.modal.addEventListener("animationend",(function e(){t.classList.remove(o),t.removeEventListener("animationend",e,!1)}),!1)}else t.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var t=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:""});break;case"disable":Object.assign(t.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){(e.target.hasAttribute(this.config.closeTrigger)||e.target.parentNode.hasAttribute(this.config.closeTrigger))&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(n);return Array.apply(void 0,t(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var o=t.filter((function(t){return!t.hasAttribute(e.config.closeTrigger)}));o.length>0&&o[0].focus(),0===o.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e){var t=this.getFocusableNodes();if(0!==t.length)if(t=t.filter((function(e){return null!==e.offsetParent})),this.modal.contains(document.activeElement)){var o=t.indexOf(document.activeElement);e.shiftKey&&0===o&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&t.length>0&&o===t.length-1&&(t[0].focus(),e.preventDefault())}else t[0].focus()}}])&&e(i.prototype,a),o}(),a=null,r=function(e){if(!document.getElementById(e))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'')),!1},l=function(e,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",''))}(e),!t)return!0;for(var o in t)r(o);return!0},{init:function(e){var o=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),n=t(document.querySelectorAll("[".concat(o.openTrigger,"]"))),r=function(e,t){var o=[];return e.forEach((function(e){var n=e.attributes[t].value;void 0===o[n]&&(o[n]=[]),o[n].push(e)})),o}(n,o.openTrigger);if(!0!==o.debugMode||!1!==l(n,r))for(var s in r){var c=r[s];o.targetModal=s,o.triggers=t(c),a=new i(o)}},show:function(e,t){var o=t||{};o.targetModal=e,!0===o.debugMode&&!1===r(e)||(a&&a.removeEventListeners(),(a=new i(o)).showModal())},close:function(e){e?a.closeModalById(e):a.closeModal()}});"undefined"!=typeof window&&(window.MicroModal=s);var c=s;function d(e){const t=e.querySelector(".wp-block-navigation__responsive-dialog"),o="true"===e.getAttribute("aria-hidden");e.classList.toggle("has-modal-open",!o),t.toggleAttribute("aria-modal",!o),o?(t.removeAttribute("role"),t.removeAttribute("aria-modal")):(t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"));document.documentElement.classList.toggle("has-modal-open")}function u(e){e.querySelectorAll('[aria-expanded="true"]').forEach((function(e){e.setAttribute("aria-expanded","false")}))}function f(e){const t=e.target.closest("[aria-expanded]");if("true"===t.getAttribute("aria-expanded"))u(t.closest(".wp-block-navigation-item"));else{const e=t.closest(".wp-block-navigation-item");t.closest(".wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list").querySelectorAll(".wp-block-navigation-item").forEach((function(t){t!==e&&u(t)})),t.setAttribute("aria-expanded","true")}}window.addEventListener("load",(()=>{c.init({onShow:d,onClose:d,openClass:"is-menu-open"});document.querySelectorAll(".wp-block-navigation-submenu__toggle").forEach((function(e){e.addEventListener("click",f)})),document.addEventListener("click",(function(e){document.querySelectorAll(".wp-block-navigation").forEach((function(t){t.contains(e.target)||u(t)}))})),document.addEventListener("keyup",(function(e){document.querySelectorAll(".wp-block-navigation-item.has-child").forEach((function(t){t.contains(e.target)||u(t)}))}))}))}(); array(), 'version' => '009e29110e016c14bac4ba0ecc809fcd');.editor-styles-wrapper .wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-left:0;padding-left:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation__container.is-parent-of-selected-block{visibility:visible;opacity:1;overflow:visible}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{visibility:visible;opacity:1;display:flex;flex-direction:column}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{color:#fff;background:#1e1e1e;padding:0;width:24px;border-radius:2px;margin-right:0;margin-left:auto}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{height:30px;position:relative;margin:0 auto;padding:3px;display:flex;align-items:center;border-radius:4px}.block-library-colors-selector .block-library-colors-selector__state-selection{margin-left:auto;margin-right:auto;border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);width:22px;min-width:22px;height:22px;min-height:22px;line-height:20px;padding:2px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:right;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{outline:none;padding:0;box-shadow:none;background:none;min-height:0;color:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder .components-spinner{margin-top:0}.wp-block-navigation-placeholder__preview{display:flex;align-items:center;min-width:96px;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:currentColor;background:transparent}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-navigation-placeholder__preview>svg{fill:currentColor;opacity:.4}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{padding:6px 8px;flex-direction:row;align-items:flex-start}.wp-block-navigation-placeholder__controls{border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;display:none;position:relative;z-index:1;float:left;width:100%}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{display:flex}.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{display:none}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{flex-direction:column;align-items:flex-start}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{margin-right:12px;height:36px}.wp-block-navigation-placeholder__actions__indicator{display:flex;padding:0 6px 0 0;align-items:center;justify-content:flex-start;line-height:0;height:36px;margin-left:4px}.wp-block-navigation-placeholder__actions__indicator svg{margin-right:4px;fill:currentColor}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{display:flex;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;gap:6px;align-items:center;height:100%}.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{margin-right:0}.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{border:0;min-height:1px;min-width:1px;background-color:#1e1e1e;margin:auto 0;height:100%;max-height:16px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{top:93px;left:36px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{left:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{right:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{left:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}}@media (min-width:782px){.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:109px}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{top:0;right:0;bottom:0;left:0}@media (min-width:600px){.wp-block-navigation__responsive-close{pointer-events:none}.wp-block-navigation__responsive-close .block-editor-block-list__layout *,.wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close{pointer-events:all}}.wp-block-navigation__responsive-close .wp-block-pages-list__item__link{pointer-events:none}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{padding:0;height:auto;color:inherit}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation .components-spinner{padding:8px 12px}.wp-block-navigation__unsaved-changes{position:relative}.wp-block-navigation__unsaved-changes .components-spinner{position:absolute;top:calc(50% - 8px);left:calc(50% - 8px);opacity:0;animation:fadein .5s linear 2s normal forwards}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation__unsaved-changes-overlay.is-saving{opacity:1;animation:fadeouthalf .5s linear 2s normal forwards}.wp-block-navigation-delete-menu-button{width:100%;justify-content:center;margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{display:flex;align-items:center;width:100%;background-color:#f0f0f0;padding:0 24px;height:64px;margin-bottom:12px}.wp-block-navigation__overlay-menu-preview.open{box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent;background-color:#fff}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Editor only CSS. -*/ -.editor-styles-wrapper .wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-right: 0; - padding-right: 0; -} -.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block { - margin: revert; -} - -.wp-block-navigation-item__label { - display: inline; -} - -/** - * Submenus. - */ -.wp-block-navigation__container.is-parent-of-selected-block { - visibility: visible; - opacity: 1; - overflow: visible; -} - -.wp-block-navigation__container, -.wp-block-navigation-item { - background-color: inherit; -} - -.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover > .wp-block-navigation__submenu-container { - opacity: 0; - visibility: hidden; -} - -.has-child.is-selected > .wp-block-navigation__submenu-container, .has-child.has-child-selected > .wp-block-navigation__submenu-container { - display: flex; - opacity: 1; - visibility: visible; -} - -.is-dragging-components-draggable .has-child.is-dragging-within > .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; -} - -.is-editing > .wp-block-navigation__container { - visibility: visible; - opacity: 1; - display: flex; - flex-direction: column; -} - -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container { - opacity: 1; - visibility: hidden; -} -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container .block-editor-block-draggable-chip-wrapper { - visibility: visible; -} - -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender { - display: block; - position: static; - width: 100%; -} -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender .block-editor-button-block-appender { - color: #fff; - background: #1e1e1e; - padding: 0; - width: 24px; - border-radius: 2px; - margin-left: 0; - margin-right: auto; -} - -.wp-block-navigation__submenu-container .block-list-appender { - display: none; -} - -/** - * Colors Selector component - */ -.block-library-colors-selector { - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__toggle { - display: block; - margin: 0 auto; - padding: 3px; - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__icon-container { - height: 30px; - position: relative; - margin: 0 auto; - padding: 3px; - display: flex; - align-items: center; - border-radius: 4px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection { - margin-right: auto; - margin-left: auto; - border-radius: 11px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - width: 22px; - min-width: 22px; - height: 22px; - min-height: 22px; - line-height: 20px; - padding: 2px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection > svg { - min-width: auto !important; -} -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg, -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg path { - color: inherit; -} - -.block-library-colors-selector__popover .color-palette-controller-container { - padding: 16px; -} -.block-library-colors-selector__popover .components-base-control__label { - height: 20px; - line-height: 20px; -} -.block-library-colors-selector__popover .component-color-indicator { - float: left; - margin-top: 2px; -} -.block-library-colors-selector__popover .components-panel__body-title { - display: none; -} - -.wp-block-navigation .block-editor-button-block-appender { - background-color: #1e1e1e; - color: #fff; -} -.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender { - padding: 0; -} - -.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender { - background-color: transparent; - color: #1e1e1e; -} - -/** - * Setup state - */ -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.components-placeholder.wp-block-navigation-placeholder { - outline: none; - padding: 0; - box-shadow: none; - background: none; - min-height: 0; - color: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset { - font-size: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button { - margin-bottom: 0; -} -.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder { - color: #1e1e1e; -} - -.wp-block-navigation-placeholder .components-spinner { - margin-top: 0; -} - -.wp-block-navigation-placeholder__preview { - display: flex; - align-items: center; - min-width: 96px; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: currentColor; - background: transparent; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview { - display: none; -} -.wp-block-navigation-placeholder__preview::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-navigation-placeholder__preview > svg { - fill: currentColor; - opacity: 0.4; -} - -.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset, -.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset { - min-height: 90px; -} - -.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset { - min-height: 132px; -} - -.wp-block-navigation-placeholder__preview, -.wp-block-navigation-placeholder__controls { - padding: 6px 8px; - flex-direction: row; - align-items: flex-start; -} - -.wp-block-navigation-placeholder__controls { - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - display: none; - position: relative; - z-index: 1; - float: right; - width: 100%; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls { - display: flex; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr, .is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr { - display: none; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions { - flex-direction: column; - align-items: flex-start; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr { - display: none; -} -.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon { - margin-left: 12px; - height: 36px; -} - -.wp-block-navigation-placeholder__actions__indicator { - display: flex; - padding: 0 0 0 6px; - align-items: center; - justify-content: flex-start; - line-height: 0; - height: 36px; - margin-right: 4px; -} -.wp-block-navigation-placeholder__actions__indicator svg { - margin-left: 4px; - fill: currentColor; -} - -.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset { - flex-direction: row !important; -} - -.wp-block-navigation-placeholder__actions { - display: flex; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - gap: 6px; - align-items: center; - height: 100%; -} -.wp-block-navigation-placeholder__actions .components-dropdown, -.wp-block-navigation-placeholder__actions > .components-button { - margin-left: 0; -} -.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr { - border: 0; - min-height: 1px; - min-width: 1px; - background-color: #1e1e1e; - margin: auto 0; - height: 100%; - max-height: 16px; -} - -/** - * Mobile menu. - */ -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close { - display: none; - } -} - -.wp-block-navigation__responsive-container.is-menu-open { - position: fixed; - top: 155px; -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - top: 93px; - } -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - right: 36px; - } -} -@media (min-width: 960px) { - .wp-block-navigation__responsive-container.is-menu-open { - right: 160px; - } -} - -@media (min-width: 782px) { - .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; - } -} - -.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; -} - -.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open { - left: 280px; -} - -.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - right: 0; - top: 155px; -} -@media (min-width: 782px) { - .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - top: 61px; - } -} -@media (min-width: 782px) { - .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; - } -} -.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; -} - -body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open { - top: 0; - left: 0; - bottom: 0; - right: 0; -} - -@media (min-width: 600px) { - .wp-block-navigation__responsive-close { - pointer-events: none; - } - .wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close, -.wp-block-navigation__responsive-close .block-editor-block-list__layout * { - pointer-events: all; - } -} -.wp-block-navigation__responsive-close .wp-block-pages-list__item__link { - pointer-events: none; -} - -.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open, -.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close { - padding: 0; - height: auto; - color: inherit; -} - -.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender { - margin-top: 16px; -} - -@keyframes fadein { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.wp-block-navigation .components-spinner { - padding: 8px 12px; -} - -.wp-block-navigation__unsaved-changes { - position: relative; -} -.wp-block-navigation__unsaved-changes .components-spinner { - position: absolute; - top: calc(50% - 16px / 2); - right: calc(50% - 16px / 2); - opacity: 0; - animation: 0.5s linear 2s normal forwards fadein; -} - -@keyframes fadeouthalf { - 0% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.wp-block-navigation__unsaved-changes-overlay.is-saving { - opacity: 1; - animation: 0.5s linear 2s normal forwards fadeouthalf; -} - -.wp-block-navigation-delete-menu-button { - width: 100%; - justify-content: center; - margin-bottom: 16px; -} - -.wp-block-navigation__overlay-menu-preview { - display: flex; - align-items: center; - width: 100%; - background-color: #f0f0f0; - padding: 0 24px; - height: 64px; - margin-bottom: 12px; -} -.wp-block-navigation__overlay-menu-preview.open { - box-shadow: inset 0 0 0 1px #e0e0e0; - outline: 1px solid transparent; - background-color: #fff; -} - -.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty { - display: none; -} - -.wp-block-navigation-placeholder__actions hr + hr { - display: none; -}.editor-styles-wrapper .wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-right:0;padding-right:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation__container.is-parent-of-selected-block{visibility:visible;opacity:1;overflow:visible}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{visibility:visible;opacity:1;display:flex;flex-direction:column}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{color:#fff;background:#1e1e1e;padding:0;width:24px;border-radius:2px;margin-left:0;margin-right:auto}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{height:30px;position:relative;margin:0 auto;padding:3px;display:flex;align-items:center;border-radius:4px}.block-library-colors-selector .block-library-colors-selector__state-selection{margin-right:auto;margin-left:auto;border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);width:22px;min-width:22px;height:22px;min-height:22px;line-height:20px;padding:2px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:left;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{outline:none;padding:0;box-shadow:none;background:none;min-height:0;color:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder .components-spinner{margin-top:0}.wp-block-navigation-placeholder__preview{display:flex;align-items:center;min-width:96px;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:currentColor;background:transparent}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-navigation-placeholder__preview>svg{fill:currentColor;opacity:.4}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{padding:6px 8px;flex-direction:row;align-items:flex-start}.wp-block-navigation-placeholder__controls{border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;display:none;position:relative;z-index:1;float:right;width:100%}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{display:flex}.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{display:none}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{flex-direction:column;align-items:flex-start}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{margin-left:12px;height:36px}.wp-block-navigation-placeholder__actions__indicator{display:flex;padding:0 0 0 6px;align-items:center;justify-content:flex-start;line-height:0;height:36px;margin-right:4px}.wp-block-navigation-placeholder__actions__indicator svg{margin-left:4px;fill:currentColor}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{display:flex;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;gap:6px;align-items:center;height:100%}.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{margin-left:0}.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{border:0;min-height:1px;min-width:1px;background-color:#1e1e1e;margin:auto 0;height:100%;max-height:16px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{top:93px;right:36px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{right:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{left:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{right:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}}@media (min-width:782px){.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:109px}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{top:0;left:0;bottom:0;right:0}@media (min-width:600px){.wp-block-navigation__responsive-close{pointer-events:none}.wp-block-navigation__responsive-close .block-editor-block-list__layout *,.wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close{pointer-events:all}}.wp-block-navigation__responsive-close .wp-block-pages-list__item__link{pointer-events:none}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{padding:0;height:auto;color:inherit}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation .components-spinner{padding:8px 12px}.wp-block-navigation__unsaved-changes{position:relative}.wp-block-navigation__unsaved-changes .components-spinner{position:absolute;top:calc(50% - 8px);right:calc(50% - 8px);opacity:0;animation:fadein .5s linear 2s normal forwards}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation__unsaved-changes-overlay.is-saving{opacity:1;animation:fadeouthalf .5s linear 2s normal forwards}.wp-block-navigation-delete-menu-button{width:100%;justify-content:center;margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{display:flex;align-items:center;width:100%;background-color:#f0f0f0;padding:0 24px;height:64px;margin-bottom:12px}.wp-block-navigation__overlay-menu-preview.open{box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent;background-color:#fff}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation { - position: relative; - --navigation-layout-justification-setting: flex-start; - --navigation-layout-direction: row; - --navigation-layout-wrap: wrap; - --navigation-layout-justify: flex-start; - --navigation-layout-align: center; -} -.wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-left: 0; - padding-left: 0; -} -.wp-block-navigation ul, -.wp-block-navigation ul li { - list-style: none; - padding: 0; -} -.wp-block-navigation .wp-block-navigation-item { - display: flex; - align-items: center; - position: relative; -} -.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty { - display: none; -} -.wp-block-navigation .wp-block-navigation-item__content { - color: inherit; - display: block; - padding: 0; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content { - text-decoration: line-through; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active { - text-decoration: line-through; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a { - text-decoration: none; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a:focus, .wp-block-navigation:where(:not([class*="has-text-decoration"])) a:active { - text-decoration: none; -} -.wp-block-navigation .wp-block-navigation__submenu-icon { - align-self: center; - line-height: 0; - display: inline-block; - font-size: inherit; - padding: 0; - background-color: inherit; - color: currentColor; - border: none; - width: 0.6em; - height: 0.6em; - margin-left: 0.25em; -} -.wp-block-navigation .wp-block-navigation__submenu-icon svg { - display: inline-block; - stroke: currentColor; - width: inherit; - height: inherit; - margin-top: 0.075em; -} -.wp-block-navigation.is-vertical { - --navigation-layout-direction: column; - --navigation-layout-justify: initial; - --navigation-layout-align: flex-start; -} -.wp-block-navigation.no-wrap { - --navigation-layout-wrap: nowrap; -} -.wp-block-navigation.items-justified-center { - --navigation-layout-justification-setting: center; - --navigation-layout-justify: center; -} -.wp-block-navigation.items-justified-center.is-vertical { - --navigation-layout-align: center; -} -.wp-block-navigation.items-justified-right { - --navigation-layout-justification-setting: flex-end; - --navigation-layout-justify: flex-end; -} -.wp-block-navigation.items-justified-right.is-vertical { - --navigation-layout-align: flex-end; -} -.wp-block-navigation.items-justified-space-between { - --navigation-layout-justification-setting: space-between; - --navigation-layout-justify: space-between; -} - -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) { - background-color: inherit; - color: inherit; - position: absolute; - z-index: 2; - display: flex; - flex-direction: column; - align-items: normal; - opacity: 0; - transition: opacity 0.1s linear; - visibility: hidden; - width: 0; - height: 0; - overflow: hidden; - left: -1px; - top: 100%; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content { - display: flex; - flex-grow: 1; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon { - margin-right: 0; - margin-left: auto; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - margin: 0; -} -@media (min-width: 782px) { - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container { - left: 100%; - top: -1px; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - right: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon { - margin-right: 0.25em; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg { - transform: rotate(-90deg); - } -} -.wp-block-navigation .has-child:where(:not(.open-on-click)):hover > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true] ~ .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container { - left: 0; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: 100%; - top: 0; - } -} - -.wp-block-navigation-submenu { - position: relative; - display: flex; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg { - stroke: currentColor; -} - -button.wp-block-navigation-item__content { - background-color: transparent; - border: none; - color: currentColor; - font-size: inherit; - font-family: inherit; - line-height: inherit; - font-style: inherit; - font-weight: inherit; - text-transform: inherit; - text-align: left; -} - -.wp-block-navigation-submenu__toggle { - cursor: pointer; -} - -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle { - padding-right: 0.85em; -} -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle + .wp-block-navigation__submenu-icon { - margin-left: -0.6em; - pointer-events: none; -} - -/** - * Margins - */ -.wp-block-navigation__responsive-container, -.wp-block-navigation__responsive-close, -.wp-block-navigation__responsive-dialog, -.wp-block-navigation, -.wp-block-navigation .wp-block-page-list, -.wp-block-navigation__container, -.wp-block-navigation__responsive-container-content { - gap: inherit; -} - -.wp-block-navigation:where(.has-background), -.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list, -.wp-block-navigation:where(.has-background) .wp-block-navigation__container { - gap: inherit; -} - -/** - * Paddings - */ -.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -/** - * Justifications. - */ -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container { - left: auto; - right: 0; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: -1px; - right: -1px; -} -@media (min-width: 782px) { - .wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: auto; - right: 100%; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container { - background-color: #fff; - color: #000; - border: 1px solid rgba(0, 0, 0, 0.15); -} - -.wp-block-navigation__container { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - list-style: none; - margin: 0; - padding-left: 0; -} -.wp-block-navigation__container .is-responsive { - display: none; -} - -.wp-block-navigation__container:only-child, -.wp-block-page-list:only-child { - flex-grow: 1; -} - -/** - * Mobile menu. - */ -.wp-block-navigation__responsive-container { - display: none; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; -} -.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); -} -.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open) { - color: inherit !important; - background-color: inherit !important; -} -.wp-block-navigation__responsive-container.is-menu-open { - display: flex; - flex-direction: column; - background-color: inherit; - padding: 2rem; - overflow: auto; - z-index: 100000; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { - padding-top: calc(2rem + 24px); - overflow: visible; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-items: var(--navigation-layout-justification-setting, inherit); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - justify-content: flex-start; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon { - display: none; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; - height: auto; - width: auto; - overflow: initial; - min-width: 200px; - position: static; - border: none; - padding-left: 2rem; - padding-right: 2rem; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - gap: inherit; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container { - padding-top: var(--wp--style--block-gap, 2em); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content { - padding: 0; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list { - display: flex; - flex-direction: column; - align-items: var(--navigation-layout-justification-setting, initial); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list { - color: inherit !important; - background: transparent !important; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - right: auto; - left: auto; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { - display: block; - width: 100%; - position: relative; - z-index: auto; - background-color: inherit; - } - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close { - display: none; - } - .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - left: 0; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open { - background-color: #fff; - color: #000; -} - -.wp-block-navigation__toggle_button_label { - font-size: 1rem; - font-weight: bold; -} - -.wp-block-navigation__responsive-container-open, -.wp-block-navigation__responsive-container-close { - vertical-align: middle; - cursor: pointer; - color: currentColor; - background: transparent; - border: none; - margin: 0; - padding: 0; -} -.wp-block-navigation__responsive-container-open svg, -.wp-block-navigation__responsive-container-close svg { - fill: currentColor; - pointer-events: none; - display: block; - width: 24px; - height: 24px; -} - -.wp-block-navigation__responsive-container-open { - display: flex; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container-open:not(.always-shown) { - display: none; - } -} - -.wp-block-navigation__responsive-container-close { - position: absolute; - top: 0; - right: 0; - z-index: 2; -} - -.wp-block-navigation__responsive-close { - width: 100%; -} -.wp-block-navigation__responsive-close:focus { - outline: none; -} - -.is-menu-open .wp-block-navigation__responsive-close, -.is-menu-open .wp-block-navigation__responsive-dialog, -.is-menu-open .wp-block-navigation__responsive-container-content { - box-sizing: border-box; -} - -.wp-block-navigation__responsive-dialog { - position: relative; -} - -html.has-modal-open { - overflow: hidden; -} array(), 'version' => '2961774fadf00b77b1ba3f439386c681');/******/ (function() { // webpackBootstrap -/******/ "use strict"; -var __webpack_exports__ = {}; - -;// CONCATENATED MODULE: ./node_modules/micromodal/dist/micromodal.es.js -function e(e,t){for(var o=0;oe.length)&&(t=e.length);for(var o=0,n=new Array(t);o0&&this.registerTriggers.apply(this,t(a)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var i,a,r;return i=o,(a=[{key:"registerTriggers",value:function(){for(var e=this,t=arguments.length,o=new Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var o=function t(){e.modal.removeEventListener("animationend",t,!1),e.setFocusToFirstNode()};this.modal.addEventListener("animationend",o,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,t)}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var o=this.config.openClass;this.modal.addEventListener("animationend",(function e(){t.classList.remove(o),t.removeEventListener("animationend",e,!1)}),!1)}else t.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var t=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:""});break;case"disable":Object.assign(t.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){(e.target.hasAttribute(this.config.closeTrigger)||e.target.parentNode.hasAttribute(this.config.closeTrigger))&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(n);return Array.apply(void 0,t(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var o=t.filter((function(t){return!t.hasAttribute(e.config.closeTrigger)}));o.length>0&&o[0].focus(),0===o.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e){var t=this.getFocusableNodes();if(0!==t.length)if(t=t.filter((function(e){return null!==e.offsetParent})),this.modal.contains(document.activeElement)){var o=t.indexOf(document.activeElement);e.shiftKey&&0===o&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&t.length>0&&o===t.length-1&&(t[0].focus(),e.preventDefault())}else t[0].focus()}}])&&e(i.prototype,a),r&&e(i,r),o}(),a=null,r=function(e){if(!document.getElementById(e))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'')),!1},s=function(e,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",''))}(e),!t)return!0;for(var o in t)r(o);return!0},{init:function(e){var o=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),n=t(document.querySelectorAll("[".concat(o.openTrigger,"]"))),r=function(e,t){var o=[];return e.forEach((function(e){var n=e.attributes[t].value;void 0===o[n]&&(o[n]=[]),o[n].push(e)})),o}(n,o.openTrigger);if(!0!==o.debugMode||!1!==s(n,r))for(var l in r){var c=r[l];o.targetModal=l,o.triggers=t(c),a=new i(o)}},show:function(e,t){var o=t||{};o.targetModal=e,!0===o.debugMode&&!1===r(e)||(a&&a.removeEventListeners(),(a=new i(o)).showModal())},close:function(e){e?a.closeModalById(e):a.closeModal()}});"undefined"!=typeof window&&(window.MicroModal=l);/* harmony default export */ var micromodal_es = (l); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/view.js -/** - * External dependencies - */ - // Responsive navigation toggle. - -function navigationToggleModal(modal) { - const dialogContainer = modal.querySelector(`.wp-block-navigation__responsive-dialog`); - const isHidden = 'true' === modal.getAttribute('aria-hidden'); - modal.classList.toggle('has-modal-open', !isHidden); - dialogContainer.toggleAttribute('aria-modal', !isHidden); - - if (isHidden) { - dialogContainer.removeAttribute('role'); - dialogContainer.removeAttribute('aria-modal'); - } else { - dialogContainer.setAttribute('role', 'dialog'); - dialogContainer.setAttribute('aria-modal', 'true'); - } // Add a class to indicate the modal is open. - - - const htmlElement = document.documentElement; - htmlElement.classList.toggle('has-modal-open'); -} // Open on click functionality. - - -function closeSubmenus(element) { - element.querySelectorAll('[aria-expanded="true"]').forEach(function (toggle) { - toggle.setAttribute('aria-expanded', 'false'); - }); -} - -function toggleSubmenuOnClick(event) { - const buttonToggle = event.target.closest('[aria-expanded]'); - const isSubmenuOpen = buttonToggle.getAttribute('aria-expanded'); - - if (isSubmenuOpen === 'true') { - closeSubmenus(buttonToggle.closest('.wp-block-navigation-item')); - } else { - // Close all sibling submenus. - const parentElement = buttonToggle.closest('.wp-block-navigation-item'); - const navigationParent = buttonToggle.closest('.wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list'); - navigationParent.querySelectorAll('.wp-block-navigation-item').forEach(function (child) { - if (child !== parentElement) { - closeSubmenus(child); - } - }); // Open submenu. - - buttonToggle.setAttribute('aria-expanded', 'true'); - } -} // Necessary for some themes such as TT1 Blocks, where -// scripts could be loaded before the body. - - -window.addEventListener('load', () => { - micromodal_es.init({ - onShow: navigationToggleModal, - onClose: navigationToggleModal, - openClass: 'is-menu-open' - }); - const submenuButtons = document.querySelectorAll('.wp-block-navigation-submenu__toggle'); - submenuButtons.forEach(function (button) { - button.addEventListener('click', toggleSubmenuOnClick); - }); // Close on click outside. - - document.addEventListener('click', function (event) { - const navigationBlocks = document.querySelectorAll('.wp-block-navigation'); - navigationBlocks.forEach(function (block) { - if (!block.contains(event.target)) { - closeSubmenus(block); - } - }); - }); // Close on focus outside. - - document.addEventListener('keyup', function (event) { - const submenuBlocks = document.querySelectorAll('.wp-block-navigation-item.has-child'); - submenuBlocks.forEach(function (block) { - if (!block.contains(event.target)) { - closeSubmenus(block); - } - }); - }); -}); - -/******/ })() -;{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/verse", - "title": "Verse", - "category": "text", - "description": "Insert poetry. Use special spacing formats. Or quote song lyrics.", - "keywords": [ "poetry", "poem" ], - "textdomain": "default", - "attributes": { - "content": { - "type": "string", - "source": "html", - "selector": "pre", - "default": "", - "__unstablePreserveWhiteSpace": true, - "__experimentalRole": "content" - }, - "textAlign": { - "type": "string" - } - }, - "supports": { - "anchor": true, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "__experimentalFontFamily": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true - } - }, - "spacing": { - "padding": true - } - }, - "style": "wp-block-verse", - "editorStyle": "wp-block-verse-editor" -} -pre.wp-block-verse{font-family:inherit;overflow:auto;white-space:pre-wrap}pre.wp-block-verse{font-family:inherit;overflow:auto;white-space:pre-wrap}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -pre.wp-block-verse { - font-family: inherit; - overflow: auto; - white-space: pre-wrap; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -pre.wp-block-verse { - font-family: inherit; - overflow: auto; - white-space: pre-wrap; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/pullquote", - "title": "Pullquote", - "category": "text", - "description": "Give special visual emphasis to a quote from your text.", - "textdomain": "default", - "attributes": { - "value": { - "type": "string", - "source": "html", - "selector": "blockquote", - "multiline": "p", - "__experimentalRole": "content" - }, - "citation": { - "type": "string", - "source": "html", - "selector": "cite", - "default": "", - "__experimentalRole": "content" - }, - "textAlign": { - "type": "string" - } - }, - "supports": { - "anchor": true, - "align": [ "left", "right", "wide", "full" ], - "color": { - "gradients": true, - "background": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true - } - }, - "__experimentalBorder": { - "color": true, - "radius": true, - "style": true, - "width": true, - "__experimentalDefaultControls": { - "color": true, - "radius": true, - "style": true, - "width": true - } - } - }, - "editorStyle": "wp-block-pullquote-editor", - "style": "wp-block-pullquote" -} -.wp-block-pullquote{margin:0 0 1em;padding:3em 0;text-align:center;overflow-wrap:break-word;box-sizing:border-box}.wp-block-pullquote blockquote,.wp-block-pullquote cite,.wp-block-pullquote p{color:inherit}.wp-block-pullquote.alignleft,.wp-block-pullquote.alignright,.wp-block-pullquote.has-text-align-left,.wp-block-pullquote.has-text-align-right{max-width:420px}.wp-block-pullquote.alignleft p,.wp-block-pullquote.alignright p,.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p{font-size:1.25em}.wp-block-pullquote p{font-size:1.75em;line-height:1.6}.wp-block-pullquote cite,.wp-block-pullquote footer{position:relative}.wp-block-pullquote .has-text-color a{color:inherit}.wp-block-pullquote.has-text-align-left blockquote{text-align:right}.wp-block-pullquote.has-text-align-right blockquote{text-align:left}.wp-block-pullquote.is-style-solid-color{border:none}.wp-block-pullquote.is-style-solid-color blockquote{margin-right:auto;margin-left:auto;max-width:60%}.wp-block-pullquote.is-style-solid-color blockquote p{margin-top:0;margin-bottom:0;font-size:2em}.wp-block-pullquote.is-style-solid-color blockquote cite{text-transform:none;font-style:normal}.wp-block-pullquote cite{color:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote { - border-top: 4px solid currentColor; - border-bottom: 4px solid currentColor; - margin-bottom: 1.75em; - color: currentColor; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer, .wp-block-pullquote__citation { - color: currentColor; - text-transform: uppercase; - font-size: 0.8125em; - font-style: normal; -}.wp-block-pullquote{margin:0 0 1em;padding:3em 0;text-align:center;overflow-wrap:break-word;box-sizing:border-box}.wp-block-pullquote blockquote,.wp-block-pullquote cite,.wp-block-pullquote p{color:inherit}.wp-block-pullquote.alignleft,.wp-block-pullquote.alignright,.wp-block-pullquote.has-text-align-left,.wp-block-pullquote.has-text-align-right{max-width:420px}.wp-block-pullquote.alignleft p,.wp-block-pullquote.alignright p,.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p{font-size:1.25em}.wp-block-pullquote p{font-size:1.75em;line-height:1.6}.wp-block-pullquote cite,.wp-block-pullquote footer{position:relative}.wp-block-pullquote .has-text-color a{color:inherit}.wp-block-pullquote.has-text-align-left blockquote{text-align:left}.wp-block-pullquote.has-text-align-right blockquote{text-align:right}.wp-block-pullquote.is-style-solid-color{border:none}.wp-block-pullquote.is-style-solid-color blockquote{margin-left:auto;margin-right:auto;max-width:60%}.wp-block-pullquote.is-style-solid-color blockquote p{margin-top:0;margin-bottom:0;font-size:2em}.wp-block-pullquote.is-style-solid-color blockquote cite{text-transform:none;font-style:normal}.wp-block-pullquote cite{color:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote { - border-top: 4px solid currentColor; - border-bottom: 4px solid currentColor; - margin-bottom: 1.75em; - color: currentColor; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer, .wp-block-pullquote__citation { - color: currentColor; - text-transform: uppercase; - font-size: 0.8125em; - font-style: normal; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote { - margin: 0 0 1em 0; - padding: 3em 0; - text-align: center; - overflow-wrap: break-word; - box-sizing: border-box; -} -.wp-block-pullquote p, -.wp-block-pullquote blockquote, -.wp-block-pullquote cite { - color: inherit; -} -.wp-block-pullquote.has-text-align-left, .wp-block-pullquote.has-text-align-right, .wp-block-pullquote.alignleft, .wp-block-pullquote.alignright { - max-width: 420px; -} -.wp-block-pullquote.has-text-align-left p, .wp-block-pullquote.has-text-align-right p, .wp-block-pullquote.alignleft p, .wp-block-pullquote.alignright p { - font-size: 1.25em; -} -.wp-block-pullquote p { - font-size: 1.75em; - line-height: 1.6; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer { - position: relative; -} -.wp-block-pullquote .has-text-color a { - color: inherit; -} - -.wp-block-pullquote.has-text-align-left blockquote { - text-align: right; -} - -.wp-block-pullquote.has-text-align-right blockquote { - text-align: left; -} - -.wp-block-pullquote.is-style-solid-color { - border: none; -} -.wp-block-pullquote.is-style-solid-color blockquote { - margin-right: auto; - margin-left: auto; - max-width: 60%; -} -.wp-block-pullquote.is-style-solid-color blockquote p { - margin-top: 0; - margin-bottom: 0; - font-size: 2em; -} -.wp-block-pullquote.is-style-solid-color blockquote cite { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote cite { - color: inherit; -}.wp-block-pullquote{border-top:4px solid;border-bottom:4px solid;margin-bottom:1.75em;color:currentColor}.wp-block-pullquote__citation,.wp-block-pullquote cite,.wp-block-pullquote footer{color:currentColor;text-transform:uppercase;font-size:.8125em;font-style:normal}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote.has-text-align-left p, -.wp-block-pullquote.has-text-align-right p, -.wp-block[data-align=left] > .wp-block-pullquote p, -.wp-block[data-align=right] > .wp-block-pullquote p { - font-size: 20px; -} - -.wp-block-pullquote blockquote p { - font-size: 28px; - line-height: 1.6; -} - -.wp-block-pullquote.is-style-solid-color blockquote p { - font-size: 32px; -} -.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote .wp-block-pullquote__citation { - color: inherit; -}.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p,.wp-block[data-align=left]>.wp-block-pullquote p,.wp-block[data-align=right]>.wp-block-pullquote p{font-size:20px}.wp-block-pullquote blockquote p{font-size:28px;line-height:1.6}.wp-block-pullquote.is-style-solid-color blockquote p{font-size:32px}.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation{text-transform:none;font-style:normal}.wp-block-pullquote .wp-block-pullquote__citation{color:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote.has-text-align-left p, -.wp-block-pullquote.has-text-align-right p, -.wp-block[data-align=left] > .wp-block-pullquote p, -.wp-block[data-align=right] > .wp-block-pullquote p { - font-size: 20px; -} - -.wp-block-pullquote blockquote p { - font-size: 28px; - line-height: 1.6; -} - -.wp-block-pullquote.is-style-solid-color blockquote p { - font-size: 32px; -} -.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote .wp-block-pullquote__citation { - color: inherit; -}.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p,.wp-block[data-align=left]>.wp-block-pullquote p,.wp-block[data-align=right]>.wp-block-pullquote p{font-size:20px}.wp-block-pullquote blockquote p{font-size:28px;line-height:1.6}.wp-block-pullquote.is-style-solid-color blockquote p{font-size:32px}.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation{text-transform:none;font-style:normal}.wp-block-pullquote .wp-block-pullquote__citation{color:inherit}.wp-block-pullquote{border-top:4px solid;border-bottom:4px solid;margin-bottom:1.75em;color:currentColor}.wp-block-pullquote__citation,.wp-block-pullquote cite,.wp-block-pullquote footer{color:currentColor;text-transform:uppercase;font-size:.8125em;font-style:normal}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-pullquote { - margin: 0 0 1em 0; - padding: 3em 0; - text-align: center; - overflow-wrap: break-word; - box-sizing: border-box; -} -.wp-block-pullquote p, -.wp-block-pullquote blockquote, -.wp-block-pullquote cite { - color: inherit; -} -.wp-block-pullquote.has-text-align-left, .wp-block-pullquote.has-text-align-right, .wp-block-pullquote.alignleft, .wp-block-pullquote.alignright { - max-width: 420px; -} -.wp-block-pullquote.has-text-align-left p, .wp-block-pullquote.has-text-align-right p, .wp-block-pullquote.alignleft p, .wp-block-pullquote.alignright p { - font-size: 1.25em; -} -.wp-block-pullquote p { - font-size: 1.75em; - line-height: 1.6; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer { - position: relative; -} -.wp-block-pullquote .has-text-color a { - color: inherit; -} - -.wp-block-pullquote.has-text-align-left blockquote { - text-align: left; -} - -.wp-block-pullquote.has-text-align-right blockquote { - text-align: right; -} - -.wp-block-pullquote.is-style-solid-color { - border: none; -} -.wp-block-pullquote.is-style-solid-color blockquote { - margin-left: auto; - margin-right: auto; - max-width: 60%; -} -.wp-block-pullquote.is-style-solid-color blockquote p { - margin-top: 0; - margin-bottom: 0; - font-size: 2em; -} -.wp-block-pullquote.is-style-solid-color blockquote cite { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote cite { - color: inherit; -}{ - "apiVersion": 2, - "name": "core/legacy-widget", - "title": "Legacy Widget", - "category": "widgets", - "description": "Display a legacy widget.", - "textdomain": "default", - "attributes": { - "id": { - "type": "string", - "default": null - }, - "idBase": { - "type": "string", - "default": null - }, - "instance": { - "type": "object", - "default": null - } - }, - "supports": { - "html": false, - "customClassName": false, - "reusable": false - }, - "editorStyle": "wp-block-legacy-widget-editor" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-author-biography", - "title": "Post Author Biography", - "category": "theme", - "description": "The author biography.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - } - }, - "usesContext": [ "postType", "postId" ], - "supports": { - "spacing": { - "margin": true, - "padding": true - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-title", - "title": "Query Title", - "category": "theme", - "description": "Display the query title.", - "textdomain": "default", - "attributes": { - "type": { - "type": "string" - }, - "textAlign": { - "type": "string" - }, - "level": { - "type": "number", - "default": 1 - } - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "margin": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true, - "textTransform": true - } - } - }, - "editorStyle": "wp-block-query-title-editor" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/html", - "title": "Custom HTML", - "category": "widgets", - "description": "Add custom HTML code and preview it as you edit.", - "keywords": [ "embed" ], - "textdomain": "default", - "attributes": { - "content": { - "type": "string", - "source": "html" - } - }, - "supports": { - "customClassName": false, - "className": false, - "html": false - }, - "editorStyle": "wp-block-html-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-html__edit .block-library-html__preview-overlay { - position: absolute; - width: 100%; - height: 100%; - top: 0; - left: 0; -} -.block-library-html__edit .block-editor-plain-text { - font-family: Menlo, Consolas, monaco, monospace !important; - color: #1e1e1e !important; - background: #fff !important; - padding: 12px !important; - border: 1px solid #1e1e1e !important; - box-shadow: none !important; - border-radius: 2px !important; - max-height: 250px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (min-width: 600px) { - .block-library-html__edit .block-editor-plain-text { - font-size: 13px !important; - } -} -.block-library-html__edit .block-editor-plain-text:focus { - border-color: var(--wp-admin-theme-color) !important; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) !important; - outline: 2px solid transparent !important; -}.block-library-html__edit .block-library-html__preview-overlay{position:absolute;width:100%;height:100%;top:0;left:0}.block-library-html__edit .block-editor-plain-text{font-family:Menlo,Consolas,monaco,monospace!important;color:#1e1e1e!important;background:#fff!important;padding:12px!important;border:1px solid #1e1e1e!important;box-shadow:none!important;border-radius:2px!important;max-height:250px;font-size:16px!important}@media (min-width:600px){.block-library-html__edit .block-editor-plain-text{font-size:13px!important}}.block-library-html__edit .block-editor-plain-text:focus{border-color:var(--wp-admin-theme-color)!important;box-shadow:0 0 0 1px var(--wp-admin-theme-color)!important;outline:2px solid transparent!important}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-html__edit .block-library-html__preview-overlay { - position: absolute; - width: 100%; - height: 100%; - top: 0; - right: 0; -} -.block-library-html__edit .block-editor-plain-text { - font-family: Menlo, Consolas, monaco, monospace !important; - color: #1e1e1e !important; - background: #fff !important; - padding: 12px !important; - border: 1px solid #1e1e1e !important; - box-shadow: none !important; - border-radius: 2px !important; - max-height: 250px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (min-width: 600px) { - .block-library-html__edit .block-editor-plain-text { - font-size: 13px !important; - } -} -.block-library-html__edit .block-editor-plain-text:focus { - border-color: var(--wp-admin-theme-color) !important; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) !important; - outline: 2px solid transparent !important; -}.block-library-html__edit .block-library-html__preview-overlay{position:absolute;width:100%;height:100%;top:0;right:0}.block-library-html__edit .block-editor-plain-text{font-family:Menlo,Consolas,monaco,monospace!important;color:#1e1e1e!important;background:#fff!important;padding:12px!important;border:1px solid #1e1e1e!important;box-shadow:none!important;border-radius:2px!important;max-height:250px;font-size:16px!important}@media (min-width:600px){.block-library-html__edit .block-editor-plain-text{font-size:13px!important}}.block-library-html__edit .block-editor-plain-text:focus{border-color:var(--wp-admin-theme-color)!important;box-shadow:0 0 0 1px var(--wp-admin-theme-color)!important;outline:2px solid transparent!important}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/column", - "title": "Column", - "category": "text", - "parent": [ "core/columns" ], - "description": "A single column within a columns block.", - "textdomain": "default", - "attributes": { - "verticalAlignment": { - "type": "string" - }, - "width": { - "type": "string" - }, - "allowedBlocks": { - "type": "array" - }, - "templateLock": { - "type": [ "string", "boolean" ], - "enum": [ "all", "insert", false ] - } - }, - "supports": { - "anchor": true, - "reusable": false, - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "blockGap": true, - "padding": true, - "__experimentalDefaultControls": { - "padding": true - } - }, - "__experimentalLayout": true - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/template-part", - "title": "Template Part", - "category": "theme", - "description": "Edit the different global regions of your site, like the header, footer, sidebar, or create your own.", - "textdomain": "default", - "attributes": { - "slug": { - "type": "string" - }, - "theme": { - "type": "string" - }, - "tagName": { - "type": "string" - }, - "area": { - "type": "string" - } - }, - "supports": { - "align": true, - "html": false, - "reusable": false - }, - "editorStyle": "wp-block-template-part-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-template-part.has-background { - padding: 1.25em 2.375em; - margin-top: 0; - margin-bottom: 0; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-template-part.has-background { - padding: 1.25em 2.375em; - margin-top: 0; - margin-bottom: 0; -}.wp-block-template-part.has-background{padding:1.25em 2.375em;margin-top:0;margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -@media (min-width: 600px) { - .block-editor-template-part__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-template-part__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-template-part__selection-modal { - height: 70%; - } -}@media (min-width:600px){.block-editor-template-part__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-template-part__selection-modal{width:750px}}@media (min-width:960px){.block-editor-template-part__selection-modal{height:70%}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -@media (min-width: 600px) { - .block-editor-template-part__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-template-part__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-template-part__selection-modal { - height: 70%; - } -}@media (min-width:600px){.block-editor-template-part__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-template-part__selection-modal{width:750px}}@media (min-width:960px){.block-editor-template-part__selection-modal{height:70%}}.wp-block-template-part.has-background{padding:1.25em 2.375em;margin-top:0;margin-bottom:0}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/archives", - "title": "Archives", - "category": "widgets", - "description": "Display a date archive of your posts.", - "textdomain": "default", - "attributes": { - "displayAsDropdown": { - "type": "boolean", - "default": false - }, - "showPostCounts": { - "type": "boolean", - "default": false - }, - "type": { - "type": "string", - "default": "monthly" - } - }, - "supports": { - "align": true, - "html": false - }, - "editorStyle": "wp-block-archives-editor" -} -.wp-block-archives-dropdown label{display:block}.wp-block-archives-dropdown label{display:block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-archives-dropdown label { - display: block; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-archives { - padding-left: 2.5em; -}ul.wp-block-archives{padding-left:2.5em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-archives { - padding-right: 2.5em; -}ul.wp-block-archives{padding-right:2.5em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-archives-dropdown label { - display: block; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/social-links", - "title": "Social Icons", - "category": "widgets", - "description": "Display icons linking to your social media profiles or sites.", - "keywords": [ "links" ], - "textdomain": "default", - "attributes": { - "iconColor": { - "type": "string" - }, - "customIconColor": { - "type": "string" - }, - "iconColorValue": { - "type": "string" - }, - "iconBackgroundColor": { - "type": "string" - }, - "customIconBackgroundColor": { - "type": "string" - }, - "iconBackgroundColorValue": { - "type": "string" - }, - "openInNewTab": { - "type": "boolean", - "default": false - }, - "showLabels": { - "type": "boolean", - "default": false - }, - "size": { - "type": "string" - } - }, - "providesContext": { - "openInNewTab": "openInNewTab", - "showLabels": "showLabels", - "iconColorValue": "iconColorValue", - "iconBackgroundColorValue": "iconBackgroundColorValue" - }, - "supports": { - "align": [ "left", "center", "right" ], - "anchor": true, - "__experimentalExposeControlsToChildren": true, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "allowVerticalAlignment": false, - "default": { - "type": "flex" - } - }, - "spacing": { - "blockGap": [ "horizontal", "vertical" ], - "margin": [ "top", "bottom" ], - "units": [ "px", "em", "rem", "vh", "vw" ], - "__experimentalDefaultControls": { - "blockGap": true - } - } - }, - "styles": [ - { "name": "default", "label": "Default", "isDefault": true }, - { "name": "logos-only", "label": "Logos Only" }, - { "name": "pill-shape", "label": "Pill Shape" } - ], - "editorStyle": "wp-block-social-links-editor", - "style": "wp-block-social-links" -} -.wp-block-social-links{padding-right:0;padding-left:0;text-indent:0;margin-right:0;background:none}.wp-block-social-links .wp-social-link a,.wp-block-social-links .wp-social-link a:hover{text-decoration:none;border-bottom:0;box-shadow:none}.wp-block-social-links .wp-social-link a{padding:.25em}.wp-block-social-links .wp-social-link svg{width:1em;height:1em}.wp-block-social-links .wp-social-link span:not(.screen-reader-text){margin-right:.5em;margin-left:.5em;font-size:.65em}.wp-block-social-links.has-small-icon-size{font-size:16px}.wp-block-social-links,.wp-block-social-links.has-normal-icon-size{font-size:24px}.wp-block-social-links.has-large-icon-size{font-size:36px}.wp-block-social-links.has-huge-icon-size{font-size:48px}.wp-block-social-links.aligncenter{justify-content:center;display:flex}.wp-block-social-links.alignright{justify-content:flex-end}.wp-block-social-link{display:block;border-radius:9999px;transition:transform .1s ease;height:auto}@media (prefers-reduced-motion:reduce){.wp-block-social-link{transition-duration:0s;transition-delay:0s}}.wp-block-social-link a{align-items:center;display:flex;line-height:0;transition:transform .1s ease}.wp-block-social-link:hover{transform:scale(1.1)}.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg{color:currentColor;fill:currentColor}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link{background-color:#f0f0f0;color:#444}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon{background-color:#f90;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp{background-color:#1ea0c3;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance{background-color:#0757fe;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen{background-color:#1e1f26;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart{background-color:#02e49b;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble{background-color:#e94c89;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox{background-color:#4280ff;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy{background-color:#f45800;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook{background-color:#1778f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr{background-color:#0461dd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare{background-color:#e65678;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github{background-color:#24292d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads{background-color:#eceadd;color:#382110}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google{background-color:#ea4434;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram{background-color:#f00075;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm{background-color:#e21b24;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin{background-color:#0d66c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon{background-color:#3288d4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium{background-color:#02ab6c;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup{background-color:#f6405f;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon{background-color:#ff424d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest{background-color:#e60122;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket{background-color:#ef4155;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit{background-color:#fe4500;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype{background-color:#0478d7;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat{background-color:#fefc00;color:#fff;stroke:#000}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud{background-color:#ff5600;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify{background-color:#1bd760;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram{background-color:#2aabee;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr{background-color:#011835;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch{background-color:#6440a4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter{background-color:#1da1f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo{background-color:#1eb7ea;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk{background-color:#4680c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress{background-color:#3499cd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp{background-color:#d32422;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube{background-color:red;color:#fff}.wp-block-social-links.is-style-logos-only .wp-social-link{background:none}.wp-block-social-links.is-style-logos-only .wp-social-link a{padding:0}.wp-block-social-links.is-style-logos-only .wp-social-link svg{width:1.25em;height:1.25em}.wp-block-social-links.is-style-logos-only .wp-social-link-amazon{color:#f90}.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp{color:#1ea0c3}.wp-block-social-links.is-style-logos-only .wp-social-link-behance{color:#0757fe}.wp-block-social-links.is-style-logos-only .wp-social-link-codepen{color:#1e1f26}.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart{color:#02e49b}.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble{color:#e94c89}.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox{color:#4280ff}.wp-block-social-links.is-style-logos-only .wp-social-link-etsy{color:#f45800}.wp-block-social-links.is-style-logos-only .wp-social-link-facebook{color:#1778f2}.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-flickr{color:#0461dd}.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare{color:#e65678}.wp-block-social-links.is-style-logos-only .wp-social-link-github{color:#24292d}.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads{color:#382110}.wp-block-social-links.is-style-logos-only .wp-social-link-google{color:#ea4434}.wp-block-social-links.is-style-logos-only .wp-social-link-instagram{color:#f00075}.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm{color:#e21b24}.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin{color:#0d66c2}.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon{color:#3288d4}.wp-block-social-links.is-style-logos-only .wp-social-link-medium{color:#02ab6c}.wp-block-social-links.is-style-logos-only .wp-social-link-meetup{color:#f6405f}.wp-block-social-links.is-style-logos-only .wp-social-link-patreon{color:#ff424d}.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest{color:#e60122}.wp-block-social-links.is-style-logos-only .wp-social-link-pocket{color:#ef4155}.wp-block-social-links.is-style-logos-only .wp-social-link-reddit{color:#fe4500}.wp-block-social-links.is-style-logos-only .wp-social-link-skype{color:#0478d7}.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat{color:#fff;stroke:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud{color:#ff5600}.wp-block-social-links.is-style-logos-only .wp-social-link-spotify{color:#1bd760}.wp-block-social-links.is-style-logos-only .wp-social-link-telegram{color:#2aabee}.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr{color:#011835}.wp-block-social-links.is-style-logos-only .wp-social-link-twitch{color:#6440a4}.wp-block-social-links.is-style-logos-only .wp-social-link-twitter{color:#1da1f2}.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo{color:#1eb7ea}.wp-block-social-links.is-style-logos-only .wp-social-link-vk{color:#4680c2}.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress{color:#3499cd}.wp-block-social-links.is-style-logos-only .wp-social-link-yelp{color:#d32422}.wp-block-social-links.is-style-logos-only .wp-social-link-youtube{color:red}.wp-block-social-links.is-style-pill-shape .wp-social-link{width:auto}.wp-block-social-links.is-style-pill-shape .wp-social-link a{padding-right:.66667em;padding-left:.66667em}.wp-block-social-links{padding-left:0;padding-right:0;text-indent:0;margin-left:0;background:none}.wp-block-social-links .wp-social-link a,.wp-block-social-links .wp-social-link a:hover{text-decoration:none;border-bottom:0;box-shadow:none}.wp-block-social-links .wp-social-link a{padding:.25em}.wp-block-social-links .wp-social-link svg{width:1em;height:1em}.wp-block-social-links .wp-social-link span:not(.screen-reader-text){margin-left:.5em;margin-right:.5em;font-size:.65em}.wp-block-social-links.has-small-icon-size{font-size:16px}.wp-block-social-links,.wp-block-social-links.has-normal-icon-size{font-size:24px}.wp-block-social-links.has-large-icon-size{font-size:36px}.wp-block-social-links.has-huge-icon-size{font-size:48px}.wp-block-social-links.aligncenter{justify-content:center;display:flex}.wp-block-social-links.alignright{justify-content:flex-end}.wp-block-social-link{display:block;border-radius:9999px;transition:transform .1s ease;height:auto}@media (prefers-reduced-motion:reduce){.wp-block-social-link{transition-duration:0s;transition-delay:0s}}.wp-block-social-link a{align-items:center;display:flex;line-height:0;transition:transform .1s ease}.wp-block-social-link:hover{transform:scale(1.1)}.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg{color:currentColor;fill:currentColor}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link{background-color:#f0f0f0;color:#444}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon{background-color:#f90;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp{background-color:#1ea0c3;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance{background-color:#0757fe;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen{background-color:#1e1f26;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart{background-color:#02e49b;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble{background-color:#e94c89;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox{background-color:#4280ff;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy{background-color:#f45800;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook{background-color:#1778f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr{background-color:#0461dd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare{background-color:#e65678;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github{background-color:#24292d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads{background-color:#eceadd;color:#382110}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google{background-color:#ea4434;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram{background-color:#f00075;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm{background-color:#e21b24;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin{background-color:#0d66c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon{background-color:#3288d4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium{background-color:#02ab6c;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup{background-color:#f6405f;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon{background-color:#ff424d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest{background-color:#e60122;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket{background-color:#ef4155;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit{background-color:#fe4500;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype{background-color:#0478d7;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat{background-color:#fefc00;color:#fff;stroke:#000}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud{background-color:#ff5600;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify{background-color:#1bd760;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram{background-color:#2aabee;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr{background-color:#011835;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch{background-color:#6440a4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter{background-color:#1da1f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo{background-color:#1eb7ea;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk{background-color:#4680c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress{background-color:#3499cd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp{background-color:#d32422;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube{background-color:red;color:#fff}.wp-block-social-links.is-style-logos-only .wp-social-link{background:none}.wp-block-social-links.is-style-logos-only .wp-social-link a{padding:0}.wp-block-social-links.is-style-logos-only .wp-social-link svg{width:1.25em;height:1.25em}.wp-block-social-links.is-style-logos-only .wp-social-link-amazon{color:#f90}.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp{color:#1ea0c3}.wp-block-social-links.is-style-logos-only .wp-social-link-behance{color:#0757fe}.wp-block-social-links.is-style-logos-only .wp-social-link-codepen{color:#1e1f26}.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart{color:#02e49b}.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble{color:#e94c89}.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox{color:#4280ff}.wp-block-social-links.is-style-logos-only .wp-social-link-etsy{color:#f45800}.wp-block-social-links.is-style-logos-only .wp-social-link-facebook{color:#1778f2}.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-flickr{color:#0461dd}.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare{color:#e65678}.wp-block-social-links.is-style-logos-only .wp-social-link-github{color:#24292d}.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads{color:#382110}.wp-block-social-links.is-style-logos-only .wp-social-link-google{color:#ea4434}.wp-block-social-links.is-style-logos-only .wp-social-link-instagram{color:#f00075}.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm{color:#e21b24}.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin{color:#0d66c2}.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon{color:#3288d4}.wp-block-social-links.is-style-logos-only .wp-social-link-medium{color:#02ab6c}.wp-block-social-links.is-style-logos-only .wp-social-link-meetup{color:#f6405f}.wp-block-social-links.is-style-logos-only .wp-social-link-patreon{color:#ff424d}.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest{color:#e60122}.wp-block-social-links.is-style-logos-only .wp-social-link-pocket{color:#ef4155}.wp-block-social-links.is-style-logos-only .wp-social-link-reddit{color:#fe4500}.wp-block-social-links.is-style-logos-only .wp-social-link-skype{color:#0478d7}.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat{color:#fff;stroke:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud{color:#ff5600}.wp-block-social-links.is-style-logos-only .wp-social-link-spotify{color:#1bd760}.wp-block-social-links.is-style-logos-only .wp-social-link-telegram{color:#2aabee}.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr{color:#011835}.wp-block-social-links.is-style-logos-only .wp-social-link-twitch{color:#6440a4}.wp-block-social-links.is-style-logos-only .wp-social-link-twitter{color:#1da1f2}.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo{color:#1eb7ea}.wp-block-social-links.is-style-logos-only .wp-social-link-vk{color:#4680c2}.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress{color:#3499cd}.wp-block-social-links.is-style-logos-only .wp-social-link-yelp{color:#d32422}.wp-block-social-links.is-style-logos-only .wp-social-link-youtube{color:red}.wp-block-social-links.is-style-pill-shape .wp-social-link{width:auto}.wp-block-social-links.is-style-pill-shape .wp-social-link a{padding-left:.66667em;padding-right:.66667em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links { - padding-right: 0; - padding-left: 0; - text-indent: 0; - margin-right: 0; - background: none; -} -.wp-block-social-links .wp-social-link a, -.wp-block-social-links .wp-social-link a:hover { - text-decoration: none; - border-bottom: 0; - box-shadow: none; -} -.wp-block-social-links .wp-social-link a { - padding: 0.25em; -} -.wp-block-social-links .wp-social-link svg { - width: 1em; - height: 1em; -} -.wp-block-social-links .wp-social-link span:not(.screen-reader-text) { - margin-right: 0.5em; - margin-left: 0.5em; - font-size: 0.65em; -} -.wp-block-social-links.has-small-icon-size { - font-size: 16px; -} -.wp-block-social-links, .wp-block-social-links.has-normal-icon-size { - font-size: 24px; -} -.wp-block-social-links.has-large-icon-size { - font-size: 36px; -} -.wp-block-social-links.has-huge-icon-size { - font-size: 48px; -} -.wp-block-social-links.aligncenter { - justify-content: center; - display: flex; -} -.wp-block-social-links.alignright { - justify-content: flex-end; -} - -.wp-block-social-link { - display: block; - border-radius: 9999px; - transition: transform 0.1s ease; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-social-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-social-link a { - align-items: center; - display: flex; - line-height: 0; - transition: transform 0.1s ease; -} -.wp-block-social-link:hover { - transform: scale(1.1); -} - -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited, -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg { - color: currentColor; - fill: currentColor; -} - -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link { - background-color: #f0f0f0; - color: #444; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon { - background-color: #f90; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp { - background-color: #1ea0c3; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance { - background-color: #0757fe; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen { - background-color: #1e1f26; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart { - background-color: #02e49b; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble { - background-color: #e94c89; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox { - background-color: #4280ff; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy { - background-color: #f45800; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook { - background-color: #1778f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr { - background-color: #0461dd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare { - background-color: #e65678; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github { - background-color: #24292d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads { - background-color: #eceadd; - color: #382110; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google { - background-color: #ea4434; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram { - background-color: #f00075; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm { - background-color: #e21b24; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin { - background-color: #0d66c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon { - background-color: #3288d4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium { - background-color: #02ab6c; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup { - background-color: #f6405f; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon { - background-color: #ff424d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest { - background-color: #e60122; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket { - background-color: #ef4155; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit { - background-color: #fe4500; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype { - background-color: #0478d7; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat { - background-color: #fefc00; - color: #fff; - stroke: #000; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud { - background-color: #ff5600; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify { - background-color: #1bd760; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram { - background-color: #2aabee; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr { - background-color: #011835; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch { - background-color: #6440a4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter { - background-color: #1da1f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo { - background-color: #1eb7ea; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk { - background-color: #4680c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress { - background-color: #3499cd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp { - background-color: #d32422; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube { - background-color: #f00; - color: #fff; -} - -.wp-block-social-links.is-style-logos-only .wp-social-link { - background: none; -} -.wp-block-social-links.is-style-logos-only .wp-social-link a { - padding: 0; -} -.wp-block-social-links.is-style-logos-only .wp-social-link svg { - width: 1.25em; - height: 1.25em; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-amazon { - color: #f90; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp { - color: #1ea0c3; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-behance { - color: #0757fe; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-codepen { - color: #1e1f26; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart { - color: #02e49b; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble { - color: #e94c89; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox { - color: #4280ff; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-etsy { - color: #f45800; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-facebook { - color: #1778f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-flickr { - color: #0461dd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare { - color: #e65678; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-github { - color: #24292d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads { - color: #382110; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-google { - color: #ea4434; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-instagram { - color: #f00075; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm { - color: #e21b24; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin { - color: #0d66c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon { - color: #3288d4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-medium { - color: #02ab6c; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-meetup { - color: #f6405f; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-patreon { - color: #ff424d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest { - color: #e60122; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pocket { - color: #ef4155; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-reddit { - color: #fe4500; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-skype { - color: #0478d7; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat { - color: #fff; - stroke: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud { - color: #ff5600; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-spotify { - color: #1bd760; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-telegram { - color: #2aabee; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr { - color: #011835; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitch { - color: #6440a4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitter { - color: #1da1f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo { - color: #1eb7ea; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vk { - color: #4680c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress { - color: #3499cd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-yelp { - color: #d32422; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-youtube { - color: #f00; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link { - width: auto; -} -.wp-block-social-links.is-style-pill-shape .wp-social-link a { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links div.block-editor-url-input { - display: inline-block; - margin-left: 8px; -} -.wp-block-social-links.wp-block-social-links { - background: none; -} - -.wp-social-link:hover { - transform: none; -} - -.editor-styles-wrapper .wp-block-social-links { - padding: 0; -} - -.wp-block-social-links__social-placeholder { - display: flex; - opacity: 0.8; - list-style: none; -} -.wp-block-social-links__social-placeholder > .wp-social-link { - padding-left: 0 !important; - margin-left: 0 !important; - padding-right: 0 !important; - margin-right: 0 !important; - width: 0 !important; - visibility: hidden; -} -.wp-block-social-links__social-placeholder > .wp-block-social-links__social-placeholder-icons { - display: flex; -} -.wp-block-social-links__social-placeholder .wp-social-link { - padding: 0.25em; -} -.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link { - padding: 0; -} -.wp-block-social-links__social-placeholder .wp-social-link::before { - content: ""; - display: block; - width: 1em; - height: 1em; - border-radius: 50%; -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link::before { - background: currentColor; -} - -.wp-block-social-links .wp-block-social-links__social-prompt { - min-height: 24px; - list-style: none; - order: 2; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 24px; - margin-top: auto; - margin-bottom: auto; - cursor: default; - padding-right: 8px; -} - -.wp-block[data-align=center] > .wp-block-social-links { - justify-content: center; -} - -.block-editor-block-preview__content .components-button:disabled { - opacity: 1; -} - -.wp-social-link.wp-social-link__is-incomplete { - opacity: 0.5; -} -@media (prefers-reduced-motion: reduce) { - .wp-social-link.wp-social-link__is-incomplete { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.wp-block-social-links .is-selected .wp-social-link__is-incomplete, -.wp-social-link.wp-social-link__is-incomplete:hover, -.wp-social-link.wp-social-link__is-incomplete:focus { - opacity: 1; -}.wp-block-social-links div.block-editor-url-input{display:inline-block;margin-left:8px}.wp-block-social-links.wp-block-social-links{background:none}.wp-social-link:hover{transform:none}.editor-styles-wrapper .wp-block-social-links{padding:0}.wp-block-social-links__social-placeholder{display:flex;opacity:.8;list-style:none}.wp-block-social-links__social-placeholder>.wp-social-link{padding-left:0!important;margin-left:0!important;padding-right:0!important;margin-right:0!important;width:0!important;visibility:hidden}.wp-block-social-links__social-placeholder>.wp-block-social-links__social-placeholder-icons{display:flex}.wp-block-social-links__social-placeholder .wp-social-link{padding:.25em}.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link{padding-left:.66667em;padding-right:.66667em}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link{padding:0}.wp-block-social-links__social-placeholder .wp-social-link:before{content:"";display:block;width:1em;height:1em;border-radius:50%}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link:before{background:currentColor}.wp-block-social-links .wp-block-social-links__social-prompt{min-height:24px;list-style:none;order:2;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:24px;margin-top:auto;margin-bottom:auto;cursor:default;padding-right:8px}.wp-block[data-align=center]>.wp-block-social-links{justify-content:center}.block-editor-block-preview__content .components-button:disabled{opacity:1}.wp-social-link.wp-social-link__is-incomplete{opacity:.5}@media (prefers-reduced-motion:reduce){.wp-social-link.wp-social-link__is-incomplete{transition-duration:0s;transition-delay:0s}}.wp-block-social-links .is-selected .wp-social-link__is-incomplete,.wp-social-link.wp-social-link__is-incomplete:focus,.wp-social-link.wp-social-link__is-incomplete:hover{opacity:1}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links div.block-editor-url-input { - display: inline-block; - margin-right: 8px; -} -.wp-block-social-links.wp-block-social-links { - background: none; -} - -.wp-social-link:hover { - transform: none; -} - -.editor-styles-wrapper .wp-block-social-links { - padding: 0; -} - -.wp-block-social-links__social-placeholder { - display: flex; - opacity: 0.8; - list-style: none; -} -.wp-block-social-links__social-placeholder > .wp-social-link { - padding-right: 0 !important; - margin-right: 0 !important; - padding-left: 0 !important; - margin-left: 0 !important; - width: 0 !important; - visibility: hidden; -} -.wp-block-social-links__social-placeholder > .wp-block-social-links__social-placeholder-icons { - display: flex; -} -.wp-block-social-links__social-placeholder .wp-social-link { - padding: 0.25em; -} -.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link { - padding: 0; -} -.wp-block-social-links__social-placeholder .wp-social-link::before { - content: ""; - display: block; - width: 1em; - height: 1em; - border-radius: 50%; -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link::before { - background: currentColor; -} - -.wp-block-social-links .wp-block-social-links__social-prompt { - min-height: 24px; - list-style: none; - order: 2; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 24px; - margin-top: auto; - margin-bottom: auto; - cursor: default; - padding-left: 8px; -} - -.wp-block[data-align=center] > .wp-block-social-links { - justify-content: center; -} - -.block-editor-block-preview__content .components-button:disabled { - opacity: 1; -} - -.wp-social-link.wp-social-link__is-incomplete { - opacity: 0.5; -} -@media (prefers-reduced-motion: reduce) { - .wp-social-link.wp-social-link__is-incomplete { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.wp-block-social-links .is-selected .wp-social-link__is-incomplete, -.wp-social-link.wp-social-link__is-incomplete:hover, -.wp-social-link.wp-social-link__is-incomplete:focus { - opacity: 1; -}.wp-block-social-links div.block-editor-url-input{display:inline-block;margin-right:8px}.wp-block-social-links.wp-block-social-links{background:none}.wp-social-link:hover{transform:none}.editor-styles-wrapper .wp-block-social-links{padding:0}.wp-block-social-links__social-placeholder{display:flex;opacity:.8;list-style:none}.wp-block-social-links__social-placeholder>.wp-social-link{padding-right:0!important;margin-right:0!important;padding-left:0!important;margin-left:0!important;width:0!important;visibility:hidden}.wp-block-social-links__social-placeholder>.wp-block-social-links__social-placeholder-icons{display:flex}.wp-block-social-links__social-placeholder .wp-social-link{padding:.25em}.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link{padding-right:.66667em;padding-left:.66667em}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link{padding:0}.wp-block-social-links__social-placeholder .wp-social-link:before{content:"";display:block;width:1em;height:1em;border-radius:50%}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link:before{background:currentColor}.wp-block-social-links .wp-block-social-links__social-prompt{min-height:24px;list-style:none;order:2;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:24px;margin-top:auto;margin-bottom:auto;cursor:default;padding-left:8px}.wp-block[data-align=center]>.wp-block-social-links{justify-content:center}.block-editor-block-preview__content .components-button:disabled{opacity:1}.wp-social-link.wp-social-link__is-incomplete{opacity:.5}@media (prefers-reduced-motion:reduce){.wp-social-link.wp-social-link__is-incomplete{transition-duration:0s;transition-delay:0s}}.wp-block-social-links .is-selected .wp-social-link__is-incomplete,.wp-social-link.wp-social-link__is-incomplete:focus,.wp-social-link.wp-social-link__is-incomplete:hover{opacity:1}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links { - padding-left: 0; - padding-right: 0; - text-indent: 0; - margin-left: 0; - background: none; -} -.wp-block-social-links .wp-social-link a, -.wp-block-social-links .wp-social-link a:hover { - text-decoration: none; - border-bottom: 0; - box-shadow: none; -} -.wp-block-social-links .wp-social-link a { - padding: 0.25em; -} -.wp-block-social-links .wp-social-link svg { - width: 1em; - height: 1em; -} -.wp-block-social-links .wp-social-link span:not(.screen-reader-text) { - margin-left: 0.5em; - margin-right: 0.5em; - font-size: 0.65em; -} -.wp-block-social-links.has-small-icon-size { - font-size: 16px; -} -.wp-block-social-links, .wp-block-social-links.has-normal-icon-size { - font-size: 24px; -} -.wp-block-social-links.has-large-icon-size { - font-size: 36px; -} -.wp-block-social-links.has-huge-icon-size { - font-size: 48px; -} -.wp-block-social-links.aligncenter { - justify-content: center; - display: flex; -} -.wp-block-social-links.alignright { - justify-content: flex-end; -} - -.wp-block-social-link { - display: block; - border-radius: 9999px; - transition: transform 0.1s ease; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-social-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-social-link a { - align-items: center; - display: flex; - line-height: 0; - transition: transform 0.1s ease; -} -.wp-block-social-link:hover { - transform: scale(1.1); -} - -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited, -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg { - color: currentColor; - fill: currentColor; -} - -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link { - background-color: #f0f0f0; - color: #444; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon { - background-color: #f90; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp { - background-color: #1ea0c3; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance { - background-color: #0757fe; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen { - background-color: #1e1f26; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart { - background-color: #02e49b; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble { - background-color: #e94c89; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox { - background-color: #4280ff; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy { - background-color: #f45800; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook { - background-color: #1778f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr { - background-color: #0461dd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare { - background-color: #e65678; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github { - background-color: #24292d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads { - background-color: #eceadd; - color: #382110; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google { - background-color: #ea4434; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram { - background-color: #f00075; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm { - background-color: #e21b24; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin { - background-color: #0d66c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon { - background-color: #3288d4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium { - background-color: #02ab6c; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup { - background-color: #f6405f; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon { - background-color: #ff424d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest { - background-color: #e60122; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket { - background-color: #ef4155; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit { - background-color: #fe4500; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype { - background-color: #0478d7; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat { - background-color: #fefc00; - color: #fff; - stroke: #000; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud { - background-color: #ff5600; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify { - background-color: #1bd760; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram { - background-color: #2aabee; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr { - background-color: #011835; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch { - background-color: #6440a4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter { - background-color: #1da1f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo { - background-color: #1eb7ea; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk { - background-color: #4680c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress { - background-color: #3499cd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp { - background-color: #d32422; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube { - background-color: #f00; - color: #fff; -} - -.wp-block-social-links.is-style-logos-only .wp-social-link { - background: none; -} -.wp-block-social-links.is-style-logos-only .wp-social-link a { - padding: 0; -} -.wp-block-social-links.is-style-logos-only .wp-social-link svg { - width: 1.25em; - height: 1.25em; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-amazon { - color: #f90; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp { - color: #1ea0c3; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-behance { - color: #0757fe; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-codepen { - color: #1e1f26; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart { - color: #02e49b; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble { - color: #e94c89; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox { - color: #4280ff; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-etsy { - color: #f45800; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-facebook { - color: #1778f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-flickr { - color: #0461dd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare { - color: #e65678; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-github { - color: #24292d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads { - color: #382110; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-google { - color: #ea4434; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-instagram { - color: #f00075; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm { - color: #e21b24; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin { - color: #0d66c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon { - color: #3288d4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-medium { - color: #02ab6c; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-meetup { - color: #f6405f; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-patreon { - color: #ff424d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest { - color: #e60122; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pocket { - color: #ef4155; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-reddit { - color: #fe4500; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-skype { - color: #0478d7; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat { - color: #fff; - stroke: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud { - color: #ff5600; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-spotify { - color: #1bd760; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-telegram { - color: #2aabee; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr { - color: #011835; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitch { - color: #6440a4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitter { - color: #1da1f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo { - color: #1eb7ea; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vk { - color: #4680c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress { - color: #3499cd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-yelp { - color: #d32422; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-youtube { - color: #f00; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link { - width: auto; -} -.wp-block-social-links.is-style-pill-shape .wp-social-link a { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/missing", - "title": "Unsupported", - "category": "text", - "description": "Your site doesn’t include support for this block.", - "textdomain": "default", - "attributes": { - "originalName": { - "type": "string" - }, - "originalUndelimitedContent": { - "type": "string" - }, - "originalContent": { - "type": "string", - "source": "html" - } - }, - "supports": { - "className": false, - "customClassName": false, - "inserter": false, - "html": false, - "reusable": false - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/spacer", - "title": "Spacer", - "category": "design", - "description": "Add white space between blocks and customize its height.", - "textdomain": "default", - "attributes": { - "height": { - "type": "string", - "default": "100px" - }, - "width": { - "type": "string" - } - }, - "usesContext": [ "orientation" ], - "supports": { - "anchor": true - }, - "editorStyle": "wp-block-spacer-editor", - "style": "wp-block-spacer" -} -.wp-block-spacer{clear:both}.wp-block-spacer{clear:both}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-spacer { - clear: both; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/spacer"]::before { - content: ""; - display: block; - position: absolute; - z-index: 1; - width: 100%; - min-height: 8px; - min-width: 8px; - height: 100%; -} - -.wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.block-library-spacer__resize-container.has-show-handle { - background: rgba(0, 0, 0, 0.1); -} -.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.is-dark-theme .block-library-spacer__resize-container.has-show-handle { - background: rgba(255, 255, 255, 0.15); -} - -.block-library-spacer__resize-container { - clear: both; -} -.block-library-spacer__resize-container:not(.is-resizing) { - height: 100% !important; - width: 100% !important; -} -.block-library-spacer__resize-container .components-resizable-box__handle::before { - content: none; -} -.block-library-spacer__resize-container.resize-horizontal { - margin-bottom: 0; -}.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;position:absolute;z-index:1;width:100%;min-height:8px;min-width:8px;height:100%}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:rgba(0,0,0,.1)}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:hsla(0,0%,100%,.15)}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/spacer"]::before { - content: ""; - display: block; - position: absolute; - z-index: 1; - width: 100%; - min-height: 8px; - min-width: 8px; - height: 100%; -} - -.wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.block-library-spacer__resize-container.has-show-handle { - background: rgba(0, 0, 0, 0.1); -} -.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.is-dark-theme .block-library-spacer__resize-container.has-show-handle { - background: rgba(255, 255, 255, 0.15); -} - -.block-library-spacer__resize-container { - clear: both; -} -.block-library-spacer__resize-container:not(.is-resizing) { - height: 100% !important; - width: 100% !important; -} -.block-library-spacer__resize-container .components-resizable-box__handle::before { - content: none; -} -.block-library-spacer__resize-container.resize-horizontal { - margin-bottom: 0; -}.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;position:absolute;z-index:1;width:100%;min-height:8px;min-width:8px;height:100%}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:rgba(0,0,0,.1)}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:hsla(0,0%,100%,.15)}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-spacer { - clear: both; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/social-link", - "title": "Social Icon", - "category": "widgets", - "parent": [ "core/social-links" ], - "description": "Display an icon linking to a social media profile or site.", - "textdomain": "default", - "attributes": { - "url": { - "type": "string" - }, - "service": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "usesContext": [ - "openInNewTab", - "showLabels", - "iconColorValue", - "iconBackgroundColorValue" - ], - "supports": { - "reusable": false, - "html": false - }, - "editorStyle": "wp-block-social-link-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links .wp-social-link { - line-height: 0; -} -.wp-block-social-links .wp-social-link button { - font-size: inherit; - color: currentColor; - height: auto; - line-height: 0; - padding: 0.25em; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link button { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -} - -.wp-block-social-links.is-style-logos-only .wp-social-link button { - padding: 0; -}.wp-block-social-links .wp-social-link{line-height:0}.wp-block-social-links .wp-social-link button{font-size:inherit;color:currentColor;height:auto;line-height:0;padding:.25em}.wp-block-social-links.is-style-pill-shape .wp-social-link button{padding-left:.66667em;padding-right:.66667em}.wp-block-social-links.is-style-logos-only .wp-social-link button{padding:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-social-links .wp-social-link { - line-height: 0; -} -.wp-block-social-links .wp-social-link button { - font-size: inherit; - color: currentColor; - height: auto; - line-height: 0; - padding: 0.25em; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link button { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -} - -.wp-block-social-links.is-style-logos-only .wp-social-link button { - padding: 0; -}.wp-block-social-links .wp-social-link{line-height:0}.wp-block-social-links .wp-social-link button{font-size:inherit;color:currentColor;height:auto;line-height:0;padding:.25em}.wp-block-social-links.is-style-pill-shape .wp-social-link button{padding-right:.66667em;padding-left:.66667em}.wp-block-social-links.is-style-logos-only .wp-social-link button{padding:0}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-navigation-link", - "title": "Post Navigation Link", - "category": "theme", - "description": "Displays the next or previous post link that is adjacent to the current post.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - }, - "type": { - "type": "string", - "default": "next" - }, - "label": { - "type": "string" - }, - "showTitle": { - "type": "boolean", - "default": false - }, - "linkLabel": { - "type": "boolean", - "default": false - } - }, - "supports": { - "reusable": false, - "html": false, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/image", - "title": "Image", - "category": "media", - "usesContext": [ "allowResize", "imageCrop", "fixedHeight" ], - "description": "Insert an image to make a visual statement.", - "keywords": [ "img", "photo", "picture" ], - "textdomain": "default", - "attributes": { - "align": { - "type": "string" - }, - "url": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "src" - }, - "alt": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "alt", - "default": "" - }, - "caption": { - "type": "string", - "source": "html", - "selector": "figcaption" - }, - "title": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "title" - }, - "href": { - "type": "string", - "source": "attribute", - "selector": "figure > a", - "attribute": "href" - }, - "rel": { - "type": "string", - "source": "attribute", - "selector": "figure > a", - "attribute": "rel" - }, - "linkClass": { - "type": "string", - "source": "attribute", - "selector": "figure > a", - "attribute": "class" - }, - "id": { - "type": "number" - }, - "width": { - "type": "number" - }, - "height": { - "type": "number" - }, - "sizeSlug": { - "type": "string" - }, - "linkDestination": { - "type": "string" - }, - "linkTarget": { - "type": "string", - "source": "attribute", - "selector": "figure > a", - "attribute": "target" - } - }, - "supports": { - "anchor": true, - "color": { - "__experimentalDuotone": "img", - "text": false, - "background": false - }, - "__experimentalBorder": { - "radius": true, - "__experimentalDefaultControls": { - "radius": true - } - } - }, - "styles": [ - { - "name": "default", - "label": "Default", - "isDefault": true - }, - { "name": "rounded", "label": "Rounded" } - ], - "editorStyle": "wp-block-image-editor", - "style": "wp-block-image" -} -.wp-block-image{margin:0 0 1em}.wp-block-image img{height:auto;max-width:100%;vertical-align:bottom}.wp-block-image:not(.is-style-rounded)>a,.wp-block-image:not(.is-style-rounded) img{border-radius:inherit}.wp-block-image.aligncenter{text-align:center}.wp-block-image.alignfull img,.wp-block-image.alignwide img{height:auto;width:100%}.wp-block-image.aligncenter,.wp-block-image .aligncenter,.wp-block-image.alignleft,.wp-block-image .alignleft,.wp-block-image.alignright,.wp-block-image .alignright{display:table}.wp-block-image.aligncenter>figcaption,.wp-block-image .aligncenter>figcaption,.wp-block-image.alignleft>figcaption,.wp-block-image .alignleft>figcaption,.wp-block-image.alignright>figcaption,.wp-block-image .alignright>figcaption{display:table-caption;caption-side:bottom}.wp-block-image .alignleft{float:left;margin-left:1em;margin-top:.5em;margin-bottom:.5em}.wp-block-image .alignright{float:right;margin-right:1em;margin-top:.5em;margin-bottom:.5em}.wp-block-image .aligncenter{margin-right:auto;margin-left:auto}.wp-block-image figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-image.is-style-circle-mask img,.wp-block-image.is-style-rounded img,.wp-block-image .is-style-rounded img{border-radius:9999px}@supports ((-webkit-mask-image:none) or (mask-image:none)) or (-webkit-mask-image:none){.wp-block-image.is-style-circle-mask img{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');mask-mode:alpha;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;border-radius:0}}.wp-block-image figure{margin:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-image figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-image figcaption { - color: rgba(255, 255, 255, 0.65); -}.wp-block-image{margin:0 0 1em}.wp-block-image img{height:auto;max-width:100%;vertical-align:bottom}.wp-block-image:not(.is-style-rounded)>a,.wp-block-image:not(.is-style-rounded) img{border-radius:inherit}.wp-block-image.aligncenter{text-align:center}.wp-block-image.alignfull img,.wp-block-image.alignwide img{height:auto;width:100%}.wp-block-image.aligncenter,.wp-block-image .aligncenter,.wp-block-image.alignleft,.wp-block-image .alignleft,.wp-block-image.alignright,.wp-block-image .alignright{display:table}.wp-block-image.aligncenter>figcaption,.wp-block-image .aligncenter>figcaption,.wp-block-image.alignleft>figcaption,.wp-block-image .alignleft>figcaption,.wp-block-image.alignright>figcaption,.wp-block-image .alignright>figcaption{display:table-caption;caption-side:bottom}.wp-block-image .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-image .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-image .aligncenter{margin-left:auto;margin-right:auto}.wp-block-image figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-image.is-style-circle-mask img,.wp-block-image.is-style-rounded img,.wp-block-image .is-style-rounded img{border-radius:9999px}@supports ((-webkit-mask-image:none) or (mask-image:none)) or (-webkit-mask-image:none){.wp-block-image.is-style-circle-mask img{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');mask-mode:alpha;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;border-radius:0}}.wp-block-image figure{margin:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-image figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-image figcaption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-image { - margin: 0 0 1em 0; -} -.wp-block-image img { - height: auto; - max-width: 100%; - vertical-align: bottom; -} -.wp-block-image:not(.is-style-rounded) > a, -.wp-block-image:not(.is-style-rounded) img { - border-radius: inherit; -} -.wp-block-image.aligncenter { - text-align: center; -} -.wp-block-image.alignfull img, .wp-block-image.alignwide img { - height: auto; - width: 100%; -} -.wp-block-image.alignleft, .wp-block-image.alignright, .wp-block-image.aligncenter, -.wp-block-image .alignleft, -.wp-block-image .alignright, -.wp-block-image .aligncenter { - display: table; -} -.wp-block-image.alignleft > figcaption, .wp-block-image.alignright > figcaption, .wp-block-image.aligncenter > figcaption, -.wp-block-image .alignleft > figcaption, -.wp-block-image .alignright > figcaption, -.wp-block-image .aligncenter > figcaption { - display: table-caption; - caption-side: bottom; -} -.wp-block-image .alignleft { - float: left; - margin-left: 0; - margin-left: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .alignright { - float: right; - margin-right: 0; - margin-right: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .aligncenter { - margin-right: auto; - margin-left: auto; -} -.wp-block-image figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-image.is-style-rounded img, -.wp-block-image .is-style-rounded img { - border-radius: 9999px; -} -.wp-block-image.is-style-circle-mask img { - border-radius: 9999px; -} -@supports ((-webkit-mask-image: none) or (mask-image: none)) or (-webkit-mask-image: none) { - .wp-block-image.is-style-circle-mask img { - /* stylelint-disable */ - -webkit-mask-image: url('data:image/svg+xml;utf8,'); - mask-image: url('data:image/svg+xml;utf8,'); - /* stylelint-enable */ - mask-mode: alpha; - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-size: contain; - mask-size: contain; - -webkit-mask-position: center; - mask-position: center; - border-radius: 0; - } -} - -.wp-block-image figure { - margin: 0; -}.wp-block-image figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-image figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -figure.wp-block-image:not(.wp-block) { - margin: 0; -} - -.wp-block-image { - position: relative; -} -.wp-block-image .is-applying img, .wp-block-image.is-transient img { - opacity: 0.3; -} -.wp-block-image figcaption img { - display: inline; -} -.wp-block-image .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} -.wp-block-image:not(.is-style-rounded) > div:not(.components-placeholder) { - border-radius: inherit; -} - -.wp-block-image .components-resizable-box__container { - display: inline-block; -} -.wp-block-image .components-resizable-box__container img { - display: block; - width: inherit; - height: inherit; -} - -.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - position: absolute; - left: 0; - right: 0; - margin: -1px 0; -} -@media (min-width: 600px) { - .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - margin: -1px; - } -} - -[data-align=wide] > .wp-block-image img, -[data-align=full] > .wp-block-image img { - height: auto; - width: 100%; -} - -.wp-block[data-align=left] > .wp-block-image, -.wp-block[data-align=center] > .wp-block-image, -.wp-block[data-align=right] > .wp-block-image { - display: table; -} -.wp-block[data-align=left] > .wp-block-image > figcaption, -.wp-block[data-align=center] > .wp-block-image > figcaption, -.wp-block[data-align=right] > .wp-block-image > figcaption { - display: table-caption; - caption-side: bottom; -} - -.wp-block[data-align=left] > .wp-block-image { - margin-right: 1em; - margin-left: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=right] > .wp-block-image { - margin-left: 1em; - margin-right: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=center] > .wp-block-image { - margin-left: auto; - margin-right: auto; - text-align: center; -} - -.wp-block-image__crop-area { - position: relative; - max-width: 100%; - width: 100%; -} - -.wp-block-image__crop-icon { - padding: 0 8px; - min-width: 48px; - display: flex; - justify-content: center; - align-items: center; -} -.wp-block-image__crop-icon svg { - fill: currentColor; -} - -.wp-block-image__zoom .components-popover__content { - overflow: visible; - min-width: 260px; -} -.wp-block-image__zoom .components-range-control { - flex: 1; -} -.wp-block-image__zoom .components-base-control__field { - display: flex; - margin-bottom: 0; - flex-direction: column; - align-items: flex-start; -} - -.wp-block-image__aspect-ratio { - height: 46px; - margin-bottom: -8px; - display: flex; - align-items: center; -} -.wp-block-image__aspect-ratio .components-button { - width: 36px; - padding-left: 0; - padding-right: 0; -}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.wp-block-image:not(.is-style-rounded)>div:not(.components-placeholder){border-radius:inherit}.wp-block-image .components-resizable-box__container{display:inline-block}.wp-block-image .components-resizable-box__container img{display:block;width:inherit;height:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{position:absolute;left:0;right:0;margin:-1px 0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{display:table-caption;caption-side:bottom}.wp-block[data-align=left]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=right]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{position:relative;max-width:100%;width:100%}.wp-block-image__crop-icon{padding:0 8px;min-width:48px;display:flex;justify-content:center;align-items:center}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{overflow:visible;min-width:260px}.wp-block-image__zoom .components-range-control{flex:1}.wp-block-image__zoom .components-base-control__field{display:flex;margin-bottom:0;flex-direction:column;align-items:flex-start}.wp-block-image__aspect-ratio{height:46px;margin-bottom:-8px;display:flex;align-items:center}.wp-block-image__aspect-ratio .components-button{width:36px;padding-left:0;padding-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -figure.wp-block-image:not(.wp-block) { - margin: 0; -} - -.wp-block-image { - position: relative; -} -.wp-block-image .is-applying img, .wp-block-image.is-transient img { - opacity: 0.3; -} -.wp-block-image figcaption img { - display: inline; -} -.wp-block-image .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} -.wp-block-image:not(.is-style-rounded) > div:not(.components-placeholder) { - border-radius: inherit; -} - -.wp-block-image .components-resizable-box__container { - display: inline-block; -} -.wp-block-image .components-resizable-box__container img { - display: block; - width: inherit; - height: inherit; -} - -.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - position: absolute; - right: 0; - left: 0; - margin: -1px 0; -} -@media (min-width: 600px) { - .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - margin: -1px; - } -} - -[data-align=wide] > .wp-block-image img, -[data-align=full] > .wp-block-image img { - height: auto; - width: 100%; -} - -.wp-block[data-align=left] > .wp-block-image, -.wp-block[data-align=center] > .wp-block-image, -.wp-block[data-align=right] > .wp-block-image { - display: table; -} -.wp-block[data-align=left] > .wp-block-image > figcaption, -.wp-block[data-align=center] > .wp-block-image > figcaption, -.wp-block[data-align=right] > .wp-block-image > figcaption { - display: table-caption; - caption-side: bottom; -} - -.wp-block[data-align=left] > .wp-block-image { - margin-left: 1em; - margin-right: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=right] > .wp-block-image { - margin-right: 1em; - margin-left: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=center] > .wp-block-image { - margin-right: auto; - margin-left: auto; - text-align: center; -} - -.wp-block-image__crop-area { - position: relative; - max-width: 100%; - width: 100%; -} - -.wp-block-image__crop-icon { - padding: 0 8px; - min-width: 48px; - display: flex; - justify-content: center; - align-items: center; -} -.wp-block-image__crop-icon svg { - fill: currentColor; -} - -.wp-block-image__zoom .components-popover__content { - overflow: visible; - min-width: 260px; -} -.wp-block-image__zoom .components-range-control { - flex: 1; -} -.wp-block-image__zoom .components-base-control__field { - display: flex; - margin-bottom: 0; - flex-direction: column; - align-items: flex-start; -} - -.wp-block-image__aspect-ratio { - height: 46px; - margin-bottom: -8px; - display: flex; - align-items: center; -} -.wp-block-image__aspect-ratio .components-button { - width: 36px; - padding-right: 0; - padding-left: 0; -}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-image:not(.is-style-rounded)>div:not(.components-placeholder){border-radius:inherit}.wp-block-image .components-resizable-box__container{display:inline-block}.wp-block-image .components-resizable-box__container img{display:block;width:inherit;height:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{position:absolute;right:0;left:0;margin:-1px 0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{display:table-caption;caption-side:bottom}.wp-block[data-align=left]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=right]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=center]>.wp-block-image{margin-right:auto;margin-left:auto;text-align:center}.wp-block-image__crop-area{position:relative;max-width:100%;width:100%}.wp-block-image__crop-icon{padding:0 8px;min-width:48px;display:flex;justify-content:center;align-items:center}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{overflow:visible;min-width:260px}.wp-block-image__zoom .components-range-control{flex:1}.wp-block-image__zoom .components-base-control__field{display:flex;margin-bottom:0;flex-direction:column;align-items:flex-start}.wp-block-image__aspect-ratio{height:46px;margin-bottom:-8px;display:flex;align-items:center}.wp-block-image__aspect-ratio .components-button{width:36px;padding-right:0;padding-left:0}.wp-block-image figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-image figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-image { - margin: 0 0 1em 0; -} -.wp-block-image img { - height: auto; - max-width: 100%; - vertical-align: bottom; -} -.wp-block-image:not(.is-style-rounded) > a, -.wp-block-image:not(.is-style-rounded) img { - border-radius: inherit; -} -.wp-block-image.aligncenter { - text-align: center; -} -.wp-block-image.alignfull img, .wp-block-image.alignwide img { - height: auto; - width: 100%; -} -.wp-block-image.alignleft, .wp-block-image.alignright, .wp-block-image.aligncenter, -.wp-block-image .alignleft, -.wp-block-image .alignright, -.wp-block-image .aligncenter { - display: table; -} -.wp-block-image.alignleft > figcaption, .wp-block-image.alignright > figcaption, .wp-block-image.aligncenter > figcaption, -.wp-block-image .alignleft > figcaption, -.wp-block-image .alignright > figcaption, -.wp-block-image .aligncenter > figcaption { - display: table-caption; - caption-side: bottom; -} -.wp-block-image .alignleft { - /*rtl:ignore*/ - float: left; - /*rtl:ignore*/ - margin-left: 0; - margin-right: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .alignright { - /*rtl:ignore*/ - float: right; - /*rtl:ignore*/ - margin-right: 0; - margin-left: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .aligncenter { - margin-left: auto; - margin-right: auto; -} -.wp-block-image figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-image.is-style-rounded img, -.wp-block-image .is-style-rounded img { - border-radius: 9999px; -} -.wp-block-image.is-style-circle-mask img { - border-radius: 9999px; -} -@supports ((-webkit-mask-image: none) or (mask-image: none)) or (-webkit-mask-image: none) { - .wp-block-image.is-style-circle-mask img { - /* stylelint-disable */ - -webkit-mask-image: url('data:image/svg+xml;utf8,'); - mask-image: url('data:image/svg+xml;utf8,'); - /* stylelint-enable */ - mask-mode: alpha; - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-size: contain; - mask-size: contain; - -webkit-mask-position: center; - mask-position: center; - border-radius: 0; - } -} - -.wp-block-image figure { - margin: 0; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/more", - "title": "More", - "category": "design", - "description": "Content before this block will be shown in the excerpt on your archives page.", - "keywords": [ "read more" ], - "textdomain": "default", - "attributes": { - "customText": { - "type": "string" - }, - "noTeaser": { - "type": "boolean", - "default": false - } - }, - "supports": { - "customClassName": false, - "className": false, - "html": false, - "multiple": false - }, - "editorStyle": "wp-block-more-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/more"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-more { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-more input[type=text] { - position: relative; - font-size: 13px; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border: none; - box-shadow: none; - white-space: nowrap; - text-align: center; - margin: 0; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; - max-width: 100%; -} -.wp-block-more input[type=text]:focus { - box-shadow: none; -} -.wp-block-more::before { - content: ""; - position: absolute; - top: calc(50%); - left: 0; - right: 0; - border-top: 3px dashed #ccc; -}.block-editor-block-list__block[data-type="core/more"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-more{display:block;text-align:center;white-space:nowrap}.wp-block-more input[type=text]{position:relative;font-size:13px;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border:none;box-shadow:none;white-space:nowrap;text-align:center;margin:0;border-radius:4px;background:#fff;padding:6px 8px;height:24px;max-width:100%}.wp-block-more input[type=text]:focus{box-shadow:none}.wp-block-more:before{content:"";position:absolute;top:50%;left:0;right:0;border-top:3px dashed #ccc}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/more"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-more { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-more input[type=text] { - position: relative; - font-size: 13px; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border: none; - box-shadow: none; - white-space: nowrap; - text-align: center; - margin: 0; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; - max-width: 100%; -} -.wp-block-more input[type=text]:focus { - box-shadow: none; -} -.wp-block-more::before { - content: ""; - position: absolute; - top: calc(50%); - right: 0; - left: 0; - border-top: 3px dashed #ccc; -}.block-editor-block-list__block[data-type="core/more"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-more{display:block;text-align:center;white-space:nowrap}.wp-block-more input[type=text]{position:relative;font-size:13px;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border:none;box-shadow:none;white-space:nowrap;text-align:center;margin:0;border-radius:4px;background:#fff;padding:6px 8px;height:24px;max-width:100%}.wp-block-more input[type=text]:focus{box-shadow:none}.wp-block-more:before{content:"";position:absolute;top:50%;right:0;left:0;border-top:3px dashed #ccc}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/search", - "title": "Search", - "category": "widgets", - "description": "Help visitors find your content.", - "keywords": [ "find" ], - "textdomain": "default", - "attributes": { - "label": { - "type": "string", - "__experimentalRole": "content" - }, - "showLabel": { - "type": "boolean", - "default": true - }, - "placeholder": { - "type": "string", - "default": "", - "__experimentalRole": "content" - }, - "width": { - "type": "number" - }, - "widthUnit": { - "type": "string" - }, - "buttonText": { - "type": "string", - "__experimentalRole": "content" - }, - "buttonPosition": { - "type": "string", - "default": "button-outside" - }, - "buttonUseIcon": { - "type": "boolean", - "default": false - } - }, - "supports": { - "align": [ "left", "center", "right" ], - "color": { - "gradients": true, - "__experimentalSkipSerialization": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "__experimentalBorder": { - "color": true, - "radius": true, - "width": true, - "__experimentalSkipSerialization": true, - "__experimentalDefaultControls": { - "color": true, - "radius": true, - "width": true - } - }, - "html": false - }, - "editorStyle": "wp-block-search-editor", - "style": "wp-block-search" -} -.wp-block-search__button{background:#f7f7f7;border:1px solid #ccc;padding:.375em .625em;color:#32373c;margin-right:.625em;word-break:normal;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{min-width:1.5em;min-height:1.5em;fill:currentColor}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{padding:8px;flex-grow:1;min-width:3em;border:1px solid #949494;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search.wp-block-search__button-only .wp-block-search__button{margin-right:0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper{padding:4px;border:1px solid #949494}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input{border-radius:0;border:none;padding:0 .25em 0 0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus{outline:none}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button{padding:.125em .5em}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-search .wp-block-search__label { - font-weight: bold; -}.wp-block-search__button{background:#f7f7f7;border:1px solid #ccc;padding:.375em .625em;color:#32373c;margin-left:.625em;word-break:normal;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{min-width:1.5em;min-height:1.5em;fill:currentColor}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{padding:8px;flex-grow:1;min-width:3em;border:1px solid #949494;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search.wp-block-search__button-only .wp-block-search__button{margin-left:0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper{padding:4px;border:1px solid #949494}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input{border-radius:0;border:none;padding:0 0 0 .25em}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus{outline:none}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button{padding:.125em .5em}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-search .wp-block-search__label { - font-weight: bold; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-search__button { - background: #f7f7f7; - border: 1px solid #ccc; - padding: 0.375em 0.625em; - color: #32373c; - margin-right: 0.625em; - word-break: normal; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} -.wp-block-search__button.has-icon { - line-height: 0; -} -.wp-block-search__button svg { - min-width: 1.5em; - min-height: 1.5em; - fill: currentColor; -} - -.wp-block-search__inside-wrapper { - display: flex; - flex: auto; - flex-wrap: nowrap; - max-width: 100%; -} - -.wp-block-search__label { - width: 100%; -} - -.wp-block-search__input { - padding: 8px; - flex-grow: 1; - min-width: 3em; - border: 1px solid #949494; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} - -.wp-block-search.wp-block-search__button-only .wp-block-search__button { - margin-right: 0; -} - -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper { - padding: 4px; - border: 1px solid #949494; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input { - border-radius: 0; - border: none; - padding: 0 0.25em 0 0; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus { - outline: none; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button { - padding: 0.125em 0.5em; -} - -.wp-block-search.aligncenter .wp-block-search__inside-wrapper { - margin: auto; -}.wp-block-search .wp-block-search__label{font-weight:700}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-search .wp-block-search__button { - height: auto; - border-radius: initial; - display: flex; - align-items: center; -} -.wp-block-search__components-button-group { - margin-top: 10px; -}.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{height:auto;border-radius:initial;display:flex;align-items:center}.wp-block-search__components-button-group{margin-top:10px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-search .wp-block-search__button { - height: auto; - border-radius: initial; - display: flex; - align-items: center; -} -.wp-block-search__components-button-group { - margin-top: 10px; -}.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{height:auto;border-radius:initial;display:flex;align-items:center}.wp-block-search__components-button-group{margin-top:10px}.wp-block-search .wp-block-search__label{font-weight:700}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-search__button { - background: #f7f7f7; - border: 1px solid #ccc; - padding: 0.375em 0.625em; - color: #32373c; - margin-left: 0.625em; - word-break: normal; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} -.wp-block-search__button.has-icon { - line-height: 0; -} -.wp-block-search__button svg { - min-width: 1.5em; - min-height: 1.5em; - fill: currentColor; -} - -.wp-block-search__inside-wrapper { - display: flex; - flex: auto; - flex-wrap: nowrap; - max-width: 100%; -} - -.wp-block-search__label { - width: 100%; -} - -.wp-block-search__input { - padding: 8px; - flex-grow: 1; - min-width: 3em; - border: 1px solid #949494; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} - -.wp-block-search.wp-block-search__button-only .wp-block-search__button { - margin-left: 0; -} - -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper { - padding: 4px; - border: 1px solid #949494; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input { - border-radius: 0; - border: none; - padding: 0 0 0 0.25em; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus { - outline: none; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button { - padding: 0.125em 0.5em; -} - -.wp-block-search.aligncenter .wp-block-search__inside-wrapper { - margin: auto; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/nextpage", - "title": "Page Break", - "category": "design", - "description": "Separate your content into a multi-page experience.", - "keywords": [ "next page", "pagination" ], - "parent": [ "core/post-content" ], - "textdomain": "default", - "supports": { - "customClassName": false, - "className": false, - "html": false - }, - "editorStyle": "wp-block-nextpage-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/nextpage"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-nextpage { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-nextpage > span { - font-size: 13px; - position: relative; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; -} -.wp-block-nextpage::before { - content: ""; - position: absolute; - top: calc(50%); - left: 0; - right: 0; - border-top: 3px dashed #ccc; -}.block-editor-block-list__block[data-type="core/nextpage"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-nextpage{display:block;text-align:center;white-space:nowrap}.wp-block-nextpage>span{font-size:13px;position:relative;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border-radius:4px;background:#fff;padding:6px 8px;height:24px}.wp-block-nextpage:before{content:"";position:absolute;top:50%;left:0;right:0;border-top:3px dashed #ccc}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-editor-block-list__block[data-type="core/nextpage"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-nextpage { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-nextpage > span { - font-size: 13px; - position: relative; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; -} -.wp-block-nextpage::before { - content: ""; - position: absolute; - top: calc(50%); - right: 0; - left: 0; - border-top: 3px dashed #ccc; -}.block-editor-block-list__block[data-type="core/nextpage"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-nextpage{display:block;text-align:center;white-space:nowrap}.wp-block-nextpage>span{font-size:13px;position:relative;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border-radius:4px;background:#fff;padding:6px 8px;height:24px}.wp-block-nextpage:before{content:"";position:absolute;top:50%;right:0;left:0;border-top:3px dashed #ccc}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/text-columns", - "title": "Text Columns (deprecated)", - "icon": "columns", - "category": "design", - "description": "This block is deprecated. Please use the Columns block instead.", - "textdomain": "default", - "attributes": { - "content": { - "type": "array", - "source": "query", - "selector": "p", - "query": { - "children": { - "type": "string", - "source": "html" - } - }, - "default": [ {}, {} ] - }, - "columns": { - "type": "number", - "default": 2 - }, - "width": { - "type": "string" - } - }, - "supports": { - "inserter": false - }, - "editorStyle": "wp-block-text-columns-editor", - "style": "wp-block-text-columns" -} -.wp-block-text-columns,.wp-block-text-columns.aligncenter{display:flex}.wp-block-text-columns .wp-block-column{margin:0 1em;padding:0}.wp-block-text-columns .wp-block-column:first-child{margin-right:0}.wp-block-text-columns .wp-block-column:last-child{margin-left:0}.wp-block-text-columns.columns-2 .wp-block-column{width:50%}.wp-block-text-columns.columns-3 .wp-block-column{width:33.33333%}.wp-block-text-columns.columns-4 .wp-block-column{width:25%}.wp-block-text-columns,.wp-block-text-columns.aligncenter{display:flex}.wp-block-text-columns .wp-block-column{margin:0 1em;padding:0}.wp-block-text-columns .wp-block-column:first-child{margin-left:0}.wp-block-text-columns .wp-block-column:last-child{margin-right:0}.wp-block-text-columns.columns-2 .wp-block-column{width:50%}.wp-block-text-columns.columns-3 .wp-block-column{width:33.33333%}.wp-block-text-columns.columns-4 .wp-block-column{width:25%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-text-columns { - display: flex; -} -.wp-block-text-columns.aligncenter { - display: flex; -} -.wp-block-text-columns .wp-block-column { - margin: 0 1em; - padding: 0; -} -.wp-block-text-columns .wp-block-column:first-child { - margin-right: 0; -} -.wp-block-text-columns .wp-block-column:last-child { - margin-left: 0; -} -.wp-block-text-columns.columns-2 .wp-block-column { - width: calc(100% / 2); -} -.wp-block-text-columns.columns-3 .wp-block-column { - width: calc(100% / 3); -} -.wp-block-text-columns.columns-4 .wp-block-column { - width: calc(100% / 4); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-text-columns .block-editor-rich-text__editable:focus { - outline: 1px solid #ddd; -}.wp-block-text-columns .block-editor-rich-text__editable:focus{outline:1px solid #ddd}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-text-columns .block-editor-rich-text__editable:focus { - outline: 1px solid #ddd; -}.wp-block-text-columns .block-editor-rich-text__editable:focus{outline:1px solid #ddd}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-text-columns { - display: flex; -} -.wp-block-text-columns.aligncenter { - display: flex; -} -.wp-block-text-columns .wp-block-column { - margin: 0 1em; - padding: 0; -} -.wp-block-text-columns .wp-block-column:first-child { - margin-left: 0; -} -.wp-block-text-columns .wp-block-column:last-child { - margin-right: 0; -} -.wp-block-text-columns.columns-2 .wp-block-column { - width: calc(100% / 2); -} -.wp-block-text-columns.columns-3 .wp-block-column { - width: calc(100% / 3); -} -.wp-block-text-columns.columns-4 .wp-block-column { - width: calc(100% / 4); -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-no-results", - "title": "No results", - "category": "theme", - "description": "Contains the block elements used to render content when no query results are found.", - "parent": [ "core/query" ], - "textdomain": "default", - "usesContext": [ "queryId", "query" ], - "supports": { - "align": true, - "reusable": false, - "html": false, - "color": { - "gradients": true, - "link": true - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-date", - "title": "Comment Date", - "category": "theme", - "ancestor": [ "core/comment-template" ], - "description": "Displays the date on which the comment was posted.", - "textdomain": "default", - "attributes": { - "format": { - "type": "string" - }, - "isLink": { - "type": "boolean", - "default": true - } - }, - "usesContext": [ "commentId" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/audio", - "title": "Audio", - "category": "media", - "description": "Embed a simple audio player.", - "keywords": [ "music", "sound", "podcast", "recording" ], - "textdomain": "default", - "attributes": { - "src": { - "type": "string", - "source": "attribute", - "selector": "audio", - "attribute": "src" - }, - "caption": { - "type": "string", - "source": "html", - "selector": "figcaption" - }, - "id": { - "type": "number" - }, - "autoplay": { - "type": "boolean", - "source": "attribute", - "selector": "audio", - "attribute": "autoplay" - }, - "loop": { - "type": "boolean", - "source": "attribute", - "selector": "audio", - "attribute": "loop" - }, - "preload": { - "type": "string", - "source": "attribute", - "selector": "audio", - "attribute": "preload" - } - }, - "supports": { - "anchor": true, - "align": true - }, - "editorStyle": "wp-block-audio-editor", - "style": "wp-block-audio" -} -.wp-block-audio{margin:0 0 1em}.wp-block-audio figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-audio audio{width:100%;min-width:300px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-audio figcaption { - color: rgba(255, 255, 255, 0.65); -}.wp-block-audio{margin:0 0 1em}.wp-block-audio figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-audio audio{width:100%;min-width:300px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-audio figcaption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio { - margin: 0 0 1em 0; -} -.wp-block-audio figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-audio audio { - width: 100%; - min-width: 300px; -}.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio { - margin-left: 0; - margin-right: 0; - position: relative; -} -.wp-block-audio.is-transient audio { - opacity: 0.3; -} -.wp-block-audio .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -}.wp-block-audio{margin-left:0;margin-right:0;position:relative}.wp-block-audio.is-transient audio{opacity:.3}.wp-block-audio .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio { - margin-right: 0; - margin-left: 0; - position: relative; -} -.wp-block-audio.is-transient audio { - opacity: 0.3; -} -.wp-block-audio .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -}.wp-block-audio{margin-right:0;margin-left:0;position:relative}.wp-block-audio.is-transient audio{opacity:.3}.wp-block-audio .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio { - margin: 0 0 1em 0; -} -.wp-block-audio figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-audio audio { - width: 100%; - min-width: 300px; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-comments-form", - "title": "Post Comments Form", - "category": "theme", - "description": "Display a post's comments form.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - } - }, - "usesContext": [ "postId", "postType" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "editorStyle": "wp-block-post-comments-form-editor", - "style": [ - "wp-block-post-comments-form", - "wp-block-buttons", - "wp-block-button" - ] -} -.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title){font-weight:inherit}.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title){font-family:inherit}.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title),.wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title){font-size:inherit}.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title){line-height:inherit}.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title){font-style:inherit}.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title){letter-spacing:inherit}.wp-block-post-comments-form input[type=submit]{border:none;box-shadow:none;cursor:pointer;display:inline-block;text-align:center;overflow-wrap:break-word}.wp-block-post-comments-form input:not([type=submit]),.wp-block-post-comments-form textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form textarea{padding:calc(.667em + 2px)}.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments-form .comment-form-author label,.wp-block-post-comments-form .comment-form-email label,.wp-block-post-comments-form .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments-form .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments-form .comment-reply-title{margin-bottom:0}.wp-block-post-comments-form .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-right:.5em}.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title){font-weight:inherit}.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title){font-family:inherit}.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title),.wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title){font-size:inherit}.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title){line-height:inherit}.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title){font-style:inherit}.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title){letter-spacing:inherit}.wp-block-post-comments-form input[type=submit]{border:none;box-shadow:none;cursor:pointer;display:inline-block;text-align:center;overflow-wrap:break-word}.wp-block-post-comments-form input:not([type=submit]),.wp-block-post-comments-form textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form textarea{padding:calc(.667em + 2px)}.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments-form .comment-form-author label,.wp-block-post-comments-form .comment-form-email label,.wp-block-post-comments-form .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments-form .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments-form .comment-reply-title{margin-bottom:0}.wp-block-post-comments-form .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-left:.5em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) { - font-weight: inherit; -} -.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title) { - font-family: inherit; -} -.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title), .wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title) { - font-size: inherit; -} -.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title) { - line-height: inherit; -} -.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title) { - font-style: inherit; -} -.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title) { - letter-spacing: inherit; -} -.wp-block-post-comments-form input[type=submit] { - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - text-align: center; - overflow-wrap: break-word; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments-form .comment-form textarea, -.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments-form .comment-form-author label, -.wp-block-post-comments-form .comment-form-email label, -.wp-block-post-comments-form .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments-form .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments-form .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-right: 0.5em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments-form * { - pointer-events: none; -} -.wp-block-post-comments-form *.block-editor-warning * { - pointer-events: auto; -}.wp-block-post-comments-form *{pointer-events:none}.wp-block-post-comments-form .block-editor-warning *{pointer-events:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments-form * { - pointer-events: none; -} -.wp-block-post-comments-form *.block-editor-warning * { - pointer-events: auto; -}.wp-block-post-comments-form *{pointer-events:none}.wp-block-post-comments-form .block-editor-warning *{pointer-events:auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) { - font-weight: inherit; -} -.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title) { - font-family: inherit; -} -.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title), .wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title) { - font-size: inherit; -} -.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title) { - line-height: inherit; -} -.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title) { - font-style: inherit; -} -.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title) { - letter-spacing: inherit; -} -.wp-block-post-comments-form input[type=submit] { - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - text-align: center; - overflow-wrap: break-word; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments-form .comment-form textarea, -.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments-form .comment-form-author label, -.wp-block-post-comments-form .comment-form-email label, -.wp-block-post-comments-form .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments-form .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments-form .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-left: 0.5em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-pagination-next", - "title": "Next Page", - "category": "theme", - "parent": [ "core/query-pagination" ], - "description": "Displays the next posts page link.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - } - }, - "usesContext": [ "queryId", "query", "paginationArrow" ], - "supports": { - "reusable": false, - "html": false, - "color": { - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/button", - "title": "Button", - "category": "design", - "parent": [ "core/buttons" ], - "description": "Prompt visitors to take action with a button-style link.", - "keywords": [ "link" ], - "textdomain": "default", - "attributes": { - "url": { - "type": "string", - "source": "attribute", - "selector": "a", - "attribute": "href" - }, - "title": { - "type": "string", - "source": "attribute", - "selector": "a", - "attribute": "title" - }, - "text": { - "type": "string", - "source": "html", - "selector": "a" - }, - "linkTarget": { - "type": "string", - "source": "attribute", - "selector": "a", - "attribute": "target" - }, - "rel": { - "type": "string", - "source": "attribute", - "selector": "a", - "attribute": "rel" - }, - "placeholder": { - "type": "string" - }, - "backgroundColor": { - "type": "string" - }, - "textColor": { - "type": "string" - }, - "gradient": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "supports": { - "anchor": true, - "align": true, - "alignWide": false, - "color": { - "__experimentalSkipSerialization": true, - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "__experimentalFontFamily": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "reusable": false, - "spacing": { - "__experimentalSkipSerialization": true, - "padding": [ "horizontal", "vertical" ], - "__experimentalDefaultControls": { - "padding": true - } - }, - "__experimentalBorder": { - "radius": true, - "__experimentalSkipSerialization": true, - "__experimentalDefaultControls": { - "radius": true - } - }, - "__experimentalSelector": ".wp-block-button__link" - }, - "styles": [ - { "name": "fill", "label": "Fill", "isDefault": true }, - { "name": "outline", "label": "Outline" } - ], - "editorStyle": "wp-block-button-editor", - "style": "wp-block-button" -} -.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;cursor:pointer;display:inline-block;font-size:1.125em;padding:calc(.667em + 2px) calc(1.333em + 2px);text-align:center;text-decoration:none;word-break:break-word;box-sizing:border-box}.wp-block-button__link:active,.wp-block-button__link:focus,.wp-block-button__link:hover,.wp-block-button__link:visited{color:#fff}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*0.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*0.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*0.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{width:100%;flex-basis:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.is-style-outline>:where(.wp-block-button__link),:where(.wp-block-button__link).is-style-outline{border:2px solid;padding:.667em 1.333em}.is-style-outline>.wp-block-button__link:not(.has-text-color),.wp-block-button__link.is-style-outline:not(.has-text-color){color:currentColor}.is-style-outline>.wp-block-button__link:not(.has-background),.wp-block-button__link.is-style-outline:not(.has-background){background-color:transparent}.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;cursor:pointer;display:inline-block;font-size:1.125em;padding:calc(.667em + 2px) calc(1.333em + 2px);text-align:center;text-decoration:none;word-break:break-word;box-sizing:border-box}.wp-block-button__link:active,.wp-block-button__link:focus,.wp-block-button__link:hover,.wp-block-button__link:visited{color:#fff}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*0.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*0.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*0.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{width:100%;flex-basis:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.is-style-outline>:where(.wp-block-button__link),:where(.wp-block-button__link).is-style-outline{border:2px solid;padding:.667em 1.333em}.is-style-outline>.wp-block-button__link:not(.has-text-color),.wp-block-button__link.is-style-outline:not(.has-text-color){color:currentColor}.is-style-outline>.wp-block-button__link:not(.has-background),.wp-block-button__link.is-style-outline:not(.has-background){background-color:transparent}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-button__link { - color: #fff; - background-color: #32373c; - border-radius: 9999px; - box-shadow: none; - cursor: pointer; - display: inline-block; - font-size: 1.125em; - padding: calc(0.667em + 2px) calc(1.333em + 2px); - text-align: center; - text-decoration: none; - word-break: break-word; - box-sizing: border-box; -} -.wp-block-button__link:hover, .wp-block-button__link:focus, .wp-block-button__link:active, .wp-block-button__link:visited { - color: #fff; -} -.wp-block-button__link.aligncenter { - text-align: center; -} -.wp-block-button__link.alignright { - text-align: right; -} - -.wp-block-buttons > .wp-block-button.has-custom-width { - max-width: none; -} -.wp-block-buttons > .wp-block-button.has-custom-width .wp-block-button__link { - width: 100%; -} -.wp-block-buttons > .wp-block-button.has-custom-font-size .wp-block-button__link { - font-size: inherit; -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-25 { - width: calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-50 { - width: calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-75 { - width: calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-100 { - width: 100%; - flex-basis: 100%; -} - -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-25 { - width: 25%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-50 { - width: 50%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-75 { - width: 75%; -} - -.wp-block-button.is-style-squared, -.wp-block-button__link.wp-block-button.is-style-squared { - border-radius: 0; -} - -.wp-block-button.no-border-radius, -.wp-block-button__link.no-border-radius { - border-radius: 0 !important; -} - -.is-style-outline > :where(.wp-block-button__link), -:where(.wp-block-button__link).is-style-outline { - border: 2px solid currentColor; - padding: 0.667em 1.333em; -} - -.is-style-outline > .wp-block-button__link:not(.has-text-color), -.wp-block-button__link.is-style-outline:not(.has-text-color) { - color: currentColor; -} - -.is-style-outline > .wp-block-button__link:not(.has-background), -.wp-block-button__link.is-style-outline:not(.has-background) { - background-color: transparent; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-button { - text-align: center; - margin-left: auto; - margin-right: auto; -} - -.wp-block[data-align=right] > .wp-block-button { - /*!rtl:ignore*/ - text-align: right; -} - -.wp-block-button { - position: relative; - cursor: text; -} -.wp-block-button:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: -2px; -} -.wp-block-button[data-rich-text-placeholder]::after { - opacity: 0.8; -} - -.wp-block-button__inline-link { - color: #757575; - height: 0; - overflow: hidden; - max-width: 290px; -} -.wp-block-button__inline-link-input__suggestions { - max-width: 290px; -} -@media (min-width: 782px) { - .wp-block-button__inline-link { - max-width: 260px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 260px; - } -} -@media (min-width: 960px) { - .wp-block-button__inline-link { - max-width: 290px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 290px; - } -} -.is-selected .wp-block-button__inline-link { - height: auto; - overflow: visible; -} - -.wp-button-label__width .components-button-group { - display: block; -} -.wp-button-label__width .components-base-control__field { - margin-bottom: 12px; -} - -div[data-type="core/button"] { - display: table; -}.wp-block[data-align=center]>.wp-block-button{text-align:center;margin-left:auto;margin-right:auto}.wp-block[data-align=right]>.wp-block-button{ - /*!rtl:ignore*/text-align:right}.wp-block-button{position:relative;cursor:text}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;overflow:hidden;max-width:290px}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-button { - text-align: center; - margin-right: auto; - margin-left: auto; -} - -.wp-block[data-align=right] > .wp-block-button { - text-align: right; -} - -.wp-block-button { - position: relative; - cursor: text; -} -.wp-block-button:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: -2px; -} -.wp-block-button[data-rich-text-placeholder]::after { - opacity: 0.8; -} - -.wp-block-button__inline-link { - color: #757575; - height: 0; - overflow: hidden; - max-width: 290px; -} -.wp-block-button__inline-link-input__suggestions { - max-width: 290px; -} -@media (min-width: 782px) { - .wp-block-button__inline-link { - max-width: 260px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 260px; - } -} -@media (min-width: 960px) { - .wp-block-button__inline-link { - max-width: 290px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 290px; - } -} -.is-selected .wp-block-button__inline-link { - height: auto; - overflow: visible; -} - -.wp-button-label__width .components-button-group { - display: block; -} -.wp-button-label__width .components-base-control__field { - margin-bottom: 12px; -} - -div[data-type="core/button"] { - display: table; -}.wp-block[data-align=center]>.wp-block-button{text-align:center;margin-right:auto;margin-left:auto}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{position:relative;cursor:text}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;overflow:hidden;max-width:290px}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-button__link { - color: #fff; - background-color: #32373c; - border-radius: 9999px; - box-shadow: none; - cursor: pointer; - display: inline-block; - font-size: 1.125em; - padding: calc(0.667em + 2px) calc(1.333em + 2px); - text-align: center; - text-decoration: none; - word-break: break-word; - box-sizing: border-box; -} -.wp-block-button__link:hover, .wp-block-button__link:focus, .wp-block-button__link:active, .wp-block-button__link:visited { - color: #fff; -} -.wp-block-button__link.aligncenter { - text-align: center; -} -.wp-block-button__link.alignright { - /*rtl:ignore*/ - text-align: right; -} - -.wp-block-buttons > .wp-block-button.has-custom-width { - max-width: none; -} -.wp-block-buttons > .wp-block-button.has-custom-width .wp-block-button__link { - width: 100%; -} -.wp-block-buttons > .wp-block-button.has-custom-font-size .wp-block-button__link { - font-size: inherit; -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-25 { - width: calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-50 { - width: calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-75 { - width: calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-100 { - width: 100%; - flex-basis: 100%; -} - -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-25 { - width: 25%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-50 { - width: 50%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-75 { - width: 75%; -} - -.wp-block-button.is-style-squared, -.wp-block-button__link.wp-block-button.is-style-squared { - border-radius: 0; -} - -.wp-block-button.no-border-radius, -.wp-block-button__link.no-border-radius { - border-radius: 0 !important; -} - -.is-style-outline > :where(.wp-block-button__link), -:where(.wp-block-button__link).is-style-outline { - border: 2px solid currentColor; - padding: 0.667em 1.333em; -} - -.is-style-outline > .wp-block-button__link:not(.has-text-color), -.wp-block-button__link.is-style-outline:not(.has-text-color) { - color: currentColor; -} - -.is-style-outline > .wp-block-button__link:not(.has-background), -.wp-block-button__link.is-style-outline:not(.has-background) { - background-color: transparent; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/loginout", - "title": "Login/out", - "category": "theme", - "description": "Show login & logout links.", - "keywords": [ "login", "logout", "form" ], - "textdomain": "default", - "attributes": { - "displayLoginAsForm": { - "type": "boolean", - "default": false - }, - "redirectToCurrent": { - "type": "boolean", - "default": true - } - }, - "supports": { - "className": true, - "typography": { - "fontSize": false - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/table", - "title": "Table", - "category": "text", - "description": "Create structured content in rows and columns to display information.", - "textdomain": "default", - "attributes": { - "hasFixedLayout": { - "type": "boolean", - "default": false - }, - "caption": { - "type": "string", - "source": "html", - "selector": "figcaption", - "default": "" - }, - "head": { - "type": "array", - "default": [], - "source": "query", - "selector": "thead tr", - "query": { - "cells": { - "type": "array", - "default": [], - "source": "query", - "selector": "td,th", - "query": { - "content": { - "type": "string", - "source": "html" - }, - "tag": { - "type": "string", - "default": "td", - "source": "tag" - }, - "scope": { - "type": "string", - "source": "attribute", - "attribute": "scope" - }, - "align": { - "type": "string", - "source": "attribute", - "attribute": "data-align" - } - } - } - } - }, - "body": { - "type": "array", - "default": [], - "source": "query", - "selector": "tbody tr", - "query": { - "cells": { - "type": "array", - "default": [], - "source": "query", - "selector": "td,th", - "query": { - "content": { - "type": "string", - "source": "html" - }, - "tag": { - "type": "string", - "default": "td", - "source": "tag" - }, - "scope": { - "type": "string", - "source": "attribute", - "attribute": "scope" - }, - "align": { - "type": "string", - "source": "attribute", - "attribute": "data-align" - } - } - } - } - }, - "foot": { - "type": "array", - "default": [], - "source": "query", - "selector": "tfoot tr", - "query": { - "cells": { - "type": "array", - "default": [], - "source": "query", - "selector": "td,th", - "query": { - "content": { - "type": "string", - "source": "html" - }, - "tag": { - "type": "string", - "default": "td", - "source": "tag" - }, - "scope": { - "type": "string", - "source": "attribute", - "attribute": "scope" - }, - "align": { - "type": "string", - "source": "attribute", - "attribute": "data-align" - } - } - } - } - } - }, - "supports": { - "anchor": true, - "align": true, - "color": { - "__experimentalSkipSerialization": true, - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "__experimentalBorder": { - "__experimentalSkipSerialization": true, - "color": true, - "style": true, - "width": true, - "__experimentalDefaultControls": { - "color": true, - "style": true, - "width": true - } - }, - "__experimentalSelector": ".wp-block-table > table" - }, - "styles": [ - { - "name": "regular", - "label": "Default", - "isDefault": true - }, - { "name": "stripes", "label": "Stripes" } - ], - "editorStyle": "wp-block-table-editor", - "style": "wp-block-table" -} -.wp-block-table{margin:0 0 1em;overflow-x:auto}.wp-block-table table{border-collapse:collapse;width:100%}.wp-block-table .has-fixed-layout{table-layout:fixed;width:100%}.wp-block-table .has-fixed-layout td,.wp-block-table .has-fixed-layout th{word-break:break-word}.wp-block-table.aligncenter,.wp-block-table.alignleft,.wp-block-table.alignright{display:table;width:auto}.wp-block-table.aligncenter td,.wp-block-table.aligncenter th,.wp-block-table.alignleft td,.wp-block-table.alignleft th,.wp-block-table.alignright td,.wp-block-table.alignright th{word-break:break-word}.wp-block-table .has-subtle-light-gray-background-color{background-color:#f3f4f5}.wp-block-table .has-subtle-pale-green-background-color{background-color:#e9fbe5}.wp-block-table .has-subtle-pale-blue-background-color{background-color:#e7f5fe}.wp-block-table .has-subtle-pale-pink-background-color{background-color:#fcf0ef}.wp-block-table.is-style-stripes{border-spacing:0;border-collapse:inherit;background-color:transparent;border-bottom:1px solid #f0f0f0}.wp-block-table.is-style-stripes tbody tr:nth-child(odd){background-color:#f0f0f0}.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd){background-color:#f3f4f5}.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd){background-color:#e9fbe5}.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd){background-color:#e7f5fe}.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd){background-color:#fcf0ef}.wp-block-table.is-style-stripes td,.wp-block-table.is-style-stripes th{border-color:transparent}.wp-block-table .has-border-color>*,.wp-block-table .has-border-color td,.wp-block-table .has-border-color th,.wp-block-table .has-border-color tr{border-color:inherit}.wp-block-table table[style*=border-style]>*,.wp-block-table table[style*=border-style] td,.wp-block-table table[style*=border-style] th,.wp-block-table table[style*=border-style] tr{border-style:inherit}.wp-block-table table[style*=border-width]>*,.wp-block-table table[style*=border-width] td,.wp-block-table table[style*=border-width] th,.wp-block-table table[style*=border-width] tr{border-width:inherit;border-style:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table thead { - border-bottom: 3px solid; -} -.wp-block-table tfoot { - border-top: 3px solid; -} -.wp-block-table td, -.wp-block-table th { - padding: 0.5em; - border: 1px solid; - word-break: normal; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -}.wp-block-table{margin:0 0 1em;overflow-x:auto}.wp-block-table table{border-collapse:collapse;width:100%}.wp-block-table .has-fixed-layout{table-layout:fixed;width:100%}.wp-block-table .has-fixed-layout td,.wp-block-table .has-fixed-layout th{word-break:break-word}.wp-block-table.aligncenter,.wp-block-table.alignleft,.wp-block-table.alignright{display:table;width:auto}.wp-block-table.aligncenter td,.wp-block-table.aligncenter th,.wp-block-table.alignleft td,.wp-block-table.alignleft th,.wp-block-table.alignright td,.wp-block-table.alignright th{word-break:break-word}.wp-block-table .has-subtle-light-gray-background-color{background-color:#f3f4f5}.wp-block-table .has-subtle-pale-green-background-color{background-color:#e9fbe5}.wp-block-table .has-subtle-pale-blue-background-color{background-color:#e7f5fe}.wp-block-table .has-subtle-pale-pink-background-color{background-color:#fcf0ef}.wp-block-table.is-style-stripes{border-spacing:0;border-collapse:inherit;background-color:transparent;border-bottom:1px solid #f0f0f0}.wp-block-table.is-style-stripes tbody tr:nth-child(odd){background-color:#f0f0f0}.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd){background-color:#f3f4f5}.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd){background-color:#e9fbe5}.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd){background-color:#e7f5fe}.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd){background-color:#fcf0ef}.wp-block-table.is-style-stripes td,.wp-block-table.is-style-stripes th{border-color:transparent}.wp-block-table .has-border-color>*,.wp-block-table .has-border-color td,.wp-block-table .has-border-color th,.wp-block-table .has-border-color tr{border-color:inherit}.wp-block-table table[style*=border-style]>*,.wp-block-table table[style*=border-style] td,.wp-block-table table[style*=border-style] th,.wp-block-table table[style*=border-style] tr{border-style:inherit}.wp-block-table table[style*=border-width]>*,.wp-block-table table[style*=border-width] td,.wp-block-table table[style*=border-width] th,.wp-block-table table[style*=border-width] tr{border-width:inherit;border-style:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table thead { - border-bottom: 3px solid; -} -.wp-block-table tfoot { - border-top: 3px solid; -} -.wp-block-table td, -.wp-block-table th { - padding: 0.5em; - border: 1px solid; - word-break: normal; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table { - margin: 0 0 1em 0; - overflow-x: auto; -} -.wp-block-table table { - border-collapse: collapse; - width: 100%; -} -.wp-block-table .has-fixed-layout { - table-layout: fixed; - width: 100%; -} -.wp-block-table .has-fixed-layout td, -.wp-block-table .has-fixed-layout th { - word-break: break-word; -} -.wp-block-table.alignleft, .wp-block-table.aligncenter, .wp-block-table.alignright { - display: table; - width: auto; -} -.wp-block-table.alignleft td, -.wp-block-table.alignleft th, .wp-block-table.aligncenter td, -.wp-block-table.aligncenter th, .wp-block-table.alignright td, -.wp-block-table.alignright th { - word-break: break-word; -} -.wp-block-table .has-subtle-light-gray-background-color { - background-color: #f3f4f5; -} -.wp-block-table .has-subtle-pale-green-background-color { - background-color: #e9fbe5; -} -.wp-block-table .has-subtle-pale-blue-background-color { - background-color: #e7f5fe; -} -.wp-block-table .has-subtle-pale-pink-background-color { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes { - border-spacing: 0; - border-collapse: inherit; - background-color: transparent; - border-bottom: 1px solid #f0f0f0; -} -.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { - background-color: #f0f0f0; -} -.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd) { - background-color: #f3f4f5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd) { - background-color: #e9fbe5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd) { - background-color: #e7f5fe; -} -.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd) { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes th, -.wp-block-table.is-style-stripes td { - border-color: transparent; -} -.wp-block-table .has-border-color > *, -.wp-block-table .has-border-color tr, -.wp-block-table .has-border-color th, -.wp-block-table .has-border-color td { - border-color: inherit; -} -.wp-block-table table[style*=border-style] > *, -.wp-block-table table[style*=border-style] tr, -.wp-block-table table[style*=border-style] th, -.wp-block-table table[style*=border-style] td { - border-style: inherit; -} -.wp-block-table table[style*=border-width] > *, -.wp-block-table table[style*=border-width] tr, -.wp-block-table table[style*=border-width] th, -.wp-block-table table[style*=border-width] td { - border-width: inherit; - border-style: inherit; -}.wp-block-table thead{border-bottom:3px solid}.wp-block-table tfoot{border-top:3px solid}.wp-block-table td,.wp-block-table th{padding:.5em;border:1px solid;word-break:normal}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table { - margin: 0; -} -.wp-block[data-align=left] > .wp-block-table, .wp-block[data-align=right] > .wp-block-table, .wp-block[data-align=center] > .wp-block-table { - height: auto; -} -.wp-block[data-align=left] > .wp-block-table table, .wp-block[data-align=right] > .wp-block-table table, .wp-block[data-align=center] > .wp-block-table table { - width: auto; -} -.wp-block[data-align=left] > .wp-block-table td, -.wp-block[data-align=left] > .wp-block-table th, .wp-block[data-align=right] > .wp-block-table td, -.wp-block[data-align=right] > .wp-block-table th, .wp-block[data-align=center] > .wp-block-table td, -.wp-block[data-align=center] > .wp-block-table th { - word-break: break-word; -} -.wp-block[data-align=center] > .wp-block-table { - text-align: initial; -} -.wp-block[data-align=center] > .wp-block-table table { - margin: 0 auto; -} -.wp-block-table td, -.wp-block-table th { - border: 1px solid; -} -.wp-block-table td.is-selected, -.wp-block-table th.is-selected { - border-color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - border-style: double; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-table__placeholder-form.blocks-table__placeholder-form { - display: flex; - flex-direction: column; - align-items: flex-start; -} -.blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .blocks-table__placeholder-form.blocks-table__placeholder-form { - flex-direction: row; - align-items: flex-end; - } - .blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 0; - } -} - -.blocks-table__placeholder-input { - width: 112px; - margin-right: 8px; - margin-bottom: 0; -} -.blocks-table__placeholder-input input { - height: 36px; -} -.blocks-table__placeholder-input .components-base-control__field { - margin-bottom: 0; -}.wp-block-table{margin:0}.wp-block[data-align=center]>.wp-block-table,.wp-block[data-align=left]>.wp-block-table,.wp-block[data-align=right]>.wp-block-table{height:auto}.wp-block[data-align=center]>.wp-block-table table,.wp-block[data-align=left]>.wp-block-table table,.wp-block[data-align=right]>.wp-block-table table{width:auto}.wp-block[data-align=center]>.wp-block-table td,.wp-block[data-align=center]>.wp-block-table th,.wp-block[data-align=left]>.wp-block-table td,.wp-block[data-align=left]>.wp-block-table th,.wp-block[data-align=right]>.wp-block-table td,.wp-block[data-align=right]>.wp-block-table th{word-break:break-word}.wp-block[data-align=center]>.wp-block-table{text-align:initial}.wp-block[data-align=center]>.wp-block-table table{margin:0 auto}.wp-block-table td,.wp-block-table th{border:1px solid}.wp-block-table td.is-selected,.wp-block-table th.is-selected{border-color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);border-style:double}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.blocks-table__placeholder-form.blocks-table__placeholder-form{display:flex;flex-direction:column;align-items:flex-start}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.blocks-table__placeholder-form.blocks-table__placeholder-form{flex-direction:row;align-items:flex-end}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:0}}.blocks-table__placeholder-input{width:112px;margin-right:8px;margin-bottom:0}.blocks-table__placeholder-input input{height:36px}.blocks-table__placeholder-input .components-base-control__field{margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table { - margin: 0; -} -.wp-block[data-align=left] > .wp-block-table, .wp-block[data-align=right] > .wp-block-table, .wp-block[data-align=center] > .wp-block-table { - height: auto; -} -.wp-block[data-align=left] > .wp-block-table table, .wp-block[data-align=right] > .wp-block-table table, .wp-block[data-align=center] > .wp-block-table table { - width: auto; -} -.wp-block[data-align=left] > .wp-block-table td, -.wp-block[data-align=left] > .wp-block-table th, .wp-block[data-align=right] > .wp-block-table td, -.wp-block[data-align=right] > .wp-block-table th, .wp-block[data-align=center] > .wp-block-table td, -.wp-block[data-align=center] > .wp-block-table th { - word-break: break-word; -} -.wp-block[data-align=center] > .wp-block-table { - text-align: initial; -} -.wp-block[data-align=center] > .wp-block-table table { - margin: 0 auto; -} -.wp-block-table td, -.wp-block-table th { - border: 1px solid; -} -.wp-block-table td.is-selected, -.wp-block-table th.is-selected { - border-color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - border-style: double; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-table__placeholder-form.blocks-table__placeholder-form { - display: flex; - flex-direction: column; - align-items: flex-start; -} -.blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .blocks-table__placeholder-form.blocks-table__placeholder-form { - flex-direction: row; - align-items: flex-end; - } - .blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 0; - } -} - -.blocks-table__placeholder-input { - width: 112px; - margin-left: 8px; - margin-bottom: 0; -} -.blocks-table__placeholder-input input { - height: 36px; -} -.blocks-table__placeholder-input .components-base-control__field { - margin-bottom: 0; -}.wp-block-table{margin:0}.wp-block[data-align=center]>.wp-block-table,.wp-block[data-align=left]>.wp-block-table,.wp-block[data-align=right]>.wp-block-table{height:auto}.wp-block[data-align=center]>.wp-block-table table,.wp-block[data-align=left]>.wp-block-table table,.wp-block[data-align=right]>.wp-block-table table{width:auto}.wp-block[data-align=center]>.wp-block-table td,.wp-block[data-align=center]>.wp-block-table th,.wp-block[data-align=left]>.wp-block-table td,.wp-block[data-align=left]>.wp-block-table th,.wp-block[data-align=right]>.wp-block-table td,.wp-block[data-align=right]>.wp-block-table th{word-break:break-word}.wp-block[data-align=center]>.wp-block-table{text-align:initial}.wp-block[data-align=center]>.wp-block-table table{margin:0 auto}.wp-block-table td,.wp-block-table th{border:1px solid}.wp-block-table td.is-selected,.wp-block-table th.is-selected{border-color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);border-style:double}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.blocks-table__placeholder-form.blocks-table__placeholder-form{display:flex;flex-direction:column;align-items:flex-start}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.blocks-table__placeholder-form.blocks-table__placeholder-form{flex-direction:row;align-items:flex-end}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:0}}.blocks-table__placeholder-input{width:112px;margin-left:8px;margin-bottom:0}.blocks-table__placeholder-input input{height:36px}.blocks-table__placeholder-input .components-base-control__field{margin-bottom:0}.wp-block-table thead{border-bottom:3px solid}.wp-block-table tfoot{border-top:3px solid}.wp-block-table td,.wp-block-table th{padding:.5em;border:1px solid;word-break:normal}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-table { - margin: 0 0 1em 0; - overflow-x: auto; -} -.wp-block-table table { - border-collapse: collapse; - width: 100%; -} -.wp-block-table .has-fixed-layout { - table-layout: fixed; - width: 100%; -} -.wp-block-table .has-fixed-layout td, -.wp-block-table .has-fixed-layout th { - word-break: break-word; -} -.wp-block-table.alignleft, .wp-block-table.aligncenter, .wp-block-table.alignright { - display: table; - width: auto; -} -.wp-block-table.alignleft td, -.wp-block-table.alignleft th, .wp-block-table.aligncenter td, -.wp-block-table.aligncenter th, .wp-block-table.alignright td, -.wp-block-table.alignright th { - word-break: break-word; -} -.wp-block-table .has-subtle-light-gray-background-color { - background-color: #f3f4f5; -} -.wp-block-table .has-subtle-pale-green-background-color { - background-color: #e9fbe5; -} -.wp-block-table .has-subtle-pale-blue-background-color { - background-color: #e7f5fe; -} -.wp-block-table .has-subtle-pale-pink-background-color { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes { - border-spacing: 0; - border-collapse: inherit; - background-color: transparent; - border-bottom: 1px solid #f0f0f0; -} -.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { - background-color: #f0f0f0; -} -.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd) { - background-color: #f3f4f5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd) { - background-color: #e9fbe5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd) { - background-color: #e7f5fe; -} -.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd) { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes th, -.wp-block-table.is-style-stripes td { - border-color: transparent; -} -.wp-block-table .has-border-color > *, -.wp-block-table .has-border-color tr, -.wp-block-table .has-border-color th, -.wp-block-table .has-border-color td { - border-color: inherit; -} -.wp-block-table table[style*=border-style] > *, -.wp-block-table table[style*=border-style] tr, -.wp-block-table table[style*=border-style] th, -.wp-block-table table[style*=border-style] td { - border-style: inherit; -} -.wp-block-table table[style*=border-width] > *, -.wp-block-table table[style*=border-width] tr, -.wp-block-table table[style*=border-width] th, -.wp-block-table table[style*=border-width] td { - border-width: inherit; - border-style: inherit; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-template", - "title": "Post Template", - "category": "theme", - "parent": [ "core/query" ], - "description": "Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.", - "textdomain": "default", - "usesContext": [ - "queryId", - "query", - "queryContext", - "displayLayout", - "templateSlug" - ], - "supports": { - "reusable": false, - "html": false, - "align": true, - "__experimentalLayout": { - "allowEditing": false - } - }, - "style": "wp-block-post-template", - "editorStyle": "wp-block-post-template-editor" -} -.wp-block-post-template,.wp-block-query-loop{margin-top:0;margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-post-template.wp-block-post-template,.wp-block-query-loop.wp-block-post-template{background:none}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap;gap:1.25em}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}}.wp-block-post-template,.wp-block-query-loop{margin-top:0;margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-post-template.wp-block-post-template,.wp-block-query-loop.wp-block-post-template{background:none}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap;gap:1.25em}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-template, -.wp-block-query-loop { - margin-top: 0; - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-post-template.wp-block-post-template, -.wp-block-query-loop.wp-block-post-template { - background: none; -} -.wp-block-post-template.is-flex-container, -.wp-block-query-loop.is-flex-container { - flex-direction: row; - display: flex; - flex-wrap: wrap; - gap: 1.25em; -} -.wp-block-post-template.is-flex-container li, -.wp-block-query-loop.is-flex-container li { - margin: 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.editor-styles-wrapper ul.wp-block-post-template { - padding-left: 0; - margin-left: 0; - list-style: none; -}.editor-styles-wrapper ul.wp-block-post-template{padding-left:0;margin-left:0;list-style:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.editor-styles-wrapper ul.wp-block-post-template { - padding-right: 0; - margin-right: 0; - list-style: none; -}.editor-styles-wrapper ul.wp-block-post-template{padding-right:0;margin-right:0;list-style:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-template, -.wp-block-query-loop { - margin-top: 0; - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-post-template.wp-block-post-template, -.wp-block-query-loop.wp-block-post-template { - background: none; -} -.wp-block-post-template.is-flex-container, -.wp-block-query-loop.is-flex-container { - flex-direction: row; - display: flex; - flex-wrap: wrap; - gap: 1.25em; -} -.wp-block-post-template.is-flex-container li, -.wp-block-query-loop.is-flex-container li { - margin: 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/list", - "title": "List", - "category": "text", - "description": "Create a bulleted or numbered list.", - "keywords": [ "bullet list", "ordered list", "numbered list" ], - "textdomain": "default", - "attributes": { - "ordered": { - "type": "boolean", - "default": false, - "__experimentalRole": "content" - }, - "values": { - "type": "string", - "source": "html", - "selector": "ol,ul", - "multiline": "li", - "__unstableMultilineWrapperTags": [ "ol", "ul" ], - "default": "", - "__experimentalRole": "content" - }, - "type": { - "type": "string" - }, - "start": { - "type": "number" - }, - "reversed": { - "type": "boolean" - }, - "placeholder": { - "type": "string" - } - }, - "supports": { - "anchor": true, - "className": false, - "typography": { - "fontSize": true, - "__experimentalFontFamily": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "__unstablePasteTextInline": true, - "__experimentalSelector": "ol,ul", - "__experimentalSlashInserter": true - }, - "editorStyle": "wp-block-list-editor", - "style": "wp-block-list" -} -ol,ul{box-sizing:border-box}ol.has-background,ul.has-background{padding:1.25em 2.375em}ol,ul{box-sizing:border-box}ol.has-background,ul.has-background{padding:1.25em 2.375em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ol, -ul { - box-sizing: border-box; -} -ol.has-background, -ul.has-background { - padding: 1.25em 2.375em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ol, -ul { - box-sizing: border-box; -} -ol.has-background, -ul.has-background { - padding: 1.25em 2.375em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/preformatted", - "title": "Preformatted", - "category": "text", - "description": "Add text that respects your spacing and tabs, and also allows styling.", - "textdomain": "default", - "attributes": { - "content": { - "type": "string", - "source": "html", - "selector": "pre", - "default": "", - "__unstablePreserveWhiteSpace": true, - "__experimentalRole": "content" - } - }, - "supports": { - "anchor": true, - "color": { - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "style": "wp-block-preformatted" -} -.wp-block-preformatted{white-space:pre-wrap}.wp-block-preformatted.has-background{padding:1.25em 2.375em}.wp-block-preformatted{white-space:pre-wrap}.wp-block-preformatted.has-background{padding:1.25em 2.375em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-preformatted { - white-space: pre-wrap; -} - -.wp-block-preformatted.has-background { - padding: 1.25em 2.375em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-preformatted { - white-space: pre-wrap; -} - -.wp-block-preformatted.has-background { - padding: 1.25em 2.375em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/avatar", - "title": "Avatar", - "category": "theme", - "description": "Add a user's avatar.", - "textdomain": "default", - "attributes": { - "userId": { - "type": "number" - }, - "size": { - "type": "number", - "default": 96 - }, - "isLink": { - "type": "boolean", - "default": false - }, - "linkTarget": { - "type": "string", - "default": "_self" - } - - }, - "usesContext": [ "postType", "postId", "commentId" ], - "supports": { - "html": false, - "align": true, - "alignWide": false, - "spacing": { - "margin": true - }, - "__experimentalBorder": { - "__experimentalSkipSerialization": true, - "radius": true, - "width": true, - "color": true, - "style": true, - "__experimentalDefaultControls": { - "radius": true - } - }, - "color": { - "text": false, - "background": false, - "__experimentalDuotone": "img" - } - }, - "editorStyle": "wp-block-avatar", - "style": "wp-block-avatar" -} -.wp-block-avatar.aligncenter{text-align:center}.wp-block-avatar.aligncenter{text-align:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-avatar.aligncenter { - text-align: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-avatar__image img { - width: 100%; -} - -.wp-block-avatar.aligncenter .components-resizable-box__container { - margin: 0 auto; -}.wp-block-avatar__image img{width:100%}.wp-block-avatar.aligncenter .components-resizable-box__container{margin:0 auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-avatar__image img { - width: 100%; -} - -.wp-block-avatar.aligncenter .components-resizable-box__container { - margin: 0 auto; -}.wp-block-avatar__image img{width:100%}.wp-block-avatar.aligncenter .components-resizable-box__container{margin:0 auto}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-avatar.aligncenter { - text-align: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-pagination", - "title": "Pagination", - "category": "theme", - "parent": [ "core/query" ], - "description": "Displays a paginated navigation to next/previous set of posts, when applicable.", - "textdomain": "default", - "attributes": { - "paginationArrow": { - "type": "string", - "default": "none" - } - }, - "usesContext": [ "queryId", "query" ], - "providesContext": { - "paginationArrow": "paginationArrow" - }, - "supports": { - "align": true, - "reusable": false, - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "default": { - "type": "flex" - } - } - }, - "editorStyle": "wp-block-query-pagination-editor", - "style": "wp-block-query-pagination" -} -.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow{margin-left:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-query-pagination .wp-block-query-pagination-next-arrow{margin-right:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-query-pagination.aligncenter{justify-content:center}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow{margin-right:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-query-pagination .wp-block-query-pagination-next-arrow{margin-left:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-query-pagination.aligncenter{justify-content:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - margin-right: 0; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-query-pagination.aligncenter { - justify-content: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-query-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-query-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-left: 0; - margin-top: 0.5em; - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -}.wp-block[data-align=center]>.wp-block-query-pagination{justify-content:center}.editor-styles-wrapper .wp-block-query-pagination{max-width:100%}.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout{margin:0}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin:.5em .5em .5em 0}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block[data-align=center] > .wp-block-query-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-query-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-right: 0; - margin-top: 0.5em; - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - margin-right: 0; -}.wp-block[data-align=center]>.wp-block-query-pagination{justify-content:center}.editor-styles-wrapper .wp-block-query-pagination{max-width:100%}.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout{margin:0}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-top:.5em;margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-query-pagination.aligncenter { - justify-content: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/freeform", - "title": "Classic", - "category": "text", - "description": "Use the classic WordPress editor.", - "textdomain": "default", - "attributes": { - "content": { - "type": "string", - "source": "html" - } - }, - "supports": { - "className": false, - "customClassName": false, - "reusable": false - }, - "editorStyle": "wp-block-freeform-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-freeform.block-library-rich-text__tinymce { - height: auto; - /* Allow height of embed iframes to be calculated properly */ - /* Remove blue highlighting of selected images in WebKit */ - /* Image captions */ - /* WP Views */ -} -.wp-block-freeform.block-library-rich-text__tinymce p, -.wp-block-freeform.block-library-rich-text__tinymce li { - line-height: 1.8; -} -.wp-block-freeform.block-library-rich-text__tinymce ul, -.wp-block-freeform.block-library-rich-text__tinymce ol { - padding-left: 2.5em; - margin-left: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce blockquote { - margin: 0; - box-shadow: inset 0 0 0 0 #ddd; - border-left: 4px solid #000; - padding-left: 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce pre { - white-space: pre-wrap; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - color: #1e1e1e; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:first-child { - margin-top: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:last-child { - margin-bottom: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce a { - color: var(--wp-admin-theme-color); -} -.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected] { - padding: 0 2px; - margin: 0 -2px; - border-radius: 2px; - box-shadow: 0 0 0 1px #e5f5fa; - background: #e5f5fa; -} -.wp-block-freeform.block-library-rich-text__tinymce code { - padding: 2px; - border-radius: 2px; - color: #1e1e1e; - background: #f0f0f0; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 14px; -} -.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected] { - background: #ddd; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignright { - /*rtl:ignore*/ - float: right; - /*rtl:ignore*/ - margin: 0.5em 0 0.5em 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignleft { - /*rtl:ignore*/ - float: left; - /*rtl:ignore*/ - margin: 0.5em 1em 0.5em 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .aligncenter { - display: block; - margin-left: auto; - margin-right: auto; -} -.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag { - width: 96%; - height: 20px; - display: block; - margin: 15px auto; - outline: 0; - cursor: default; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC); - background-size: 1900px 20px; - background-repeat: no-repeat; - background-position: center; -} -.wp-block-freeform.block-library-rich-text__tinymce img::selection { - background-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp { - -ms-user-select: element; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption { - margin: 0; - /* dl browser reset */ - max-width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a, -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img { - display: block; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption, .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * { - -webkit-user-drag: none; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd { - padding-top: 0.5em; - margin: 0; - /* browser dd reset */ -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview { - width: 99.99%; - /* All IE need hasLayout, incl. 11 (ugh, not again!!) */ - position: relative; - clear: both; - margin-bottom: 16px; - border: 1px solid transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe { - display: block; - max-width: 100%; - background: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim { - display: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder { - border: 1px dashed #ddd; - padding: 10px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error { - border: 1px solid #ddd; - padding: 1em 0; - margin: 0; - word-wrap: break-word; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p { - margin: 0; - text-align: center; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder, .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error { - border-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons { - display: block; - margin: 0 auto; - width: 32px; - height: 32px; - font-size: 32px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery::after { - content: ""; - display: table; - clear: both; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery a { - cursor: default; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery { - margin: auto -6px; - padding: 6px 0; - line-height: 1; - overflow-x: hidden; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item { - float: left; - margin: 0; - text-align: center; - padding: 6px; - box-sizing: border-box; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption, -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon { - margin: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption { - font-size: 13px; - margin: 4px 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item { - width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item { - width: 50%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item { - width: 33.3333333333%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item { - width: 25%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item { - width: 20%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item { - width: 16.6666666667%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item { - width: 14.2857142857%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item { - width: 12.5%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item { - width: 11.1111111111%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img { - max-width: 100%; - height: auto; - border: none; - padding: 0; -} - -div[data-type="core/freeform"]::before { - transition: border-color 0.1s linear, box-shadow 0.1s linear; - border: 1px solid #ddd; - outline: 1px solid transparent; -} -@media (prefers-reduced-motion: reduce) { - div[data-type="core/freeform"]::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -div[data-type="core/freeform"].is-selected::before { - border-color: #1e1e1e; -} -div[data-type="core/freeform"] .block-editor-block-contextual-toolbar + div { - margin-top: 0; - padding-top: 0; -} -div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce::after { - content: ""; - display: table; - clear: both; -} - -.mce-toolbar-grp .mce-btn.mce-active button, -.mce-toolbar-grp .mce-btn.mce-active:hover button, -.mce-toolbar-grp .mce-btn.mce-active i, -.mce-toolbar-grp .mce-btn.mce-active:hover i { - color: #1e1e1e; -} -.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last { - margin-right: 0; - margin-left: 8px; -} -.mce-toolbar-grp .mce-btn i { - font-style: normal; -} - -.block-library-classic__toolbar { - display: none; - width: auto; - margin: 0; - position: sticky; - z-index: 31; - top: 0; - border: 1px solid #ddd; - border-bottom: none; - border-radius: 2px; - margin-bottom: 8px; - padding: 0; -} -div[data-type="core/freeform"].is-selected .block-library-classic__toolbar { - display: block; - border-color: #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce { - box-shadow: none; -} -@media (min-width: 600px) { - .block-library-classic__toolbar { - padding: 0; - } -} -.block-library-classic__toolbar:empty { - display: block; - background: #f5f5f5; - border-bottom: 1px solid #e2e4e7; -} -.block-library-classic__toolbar:empty::before { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - content: attr(data-placeholder); - color: #555d66; - line-height: 37px; - padding: 14px; -} -.block-library-classic__toolbar div.mce-toolbar-grp { - border-bottom: 1px solid #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce-inline, -.block-library-classic__toolbar .mce-tinymce-inline > div, -.block-library-classic__toolbar div.mce-toolbar-grp, -.block-library-classic__toolbar div.mce-toolbar-grp > div, -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar .mce-menubar > div { - height: auto !important; - width: 100% !important; -} -.block-library-classic__toolbar .mce-container-body.mce-abs-layout { - overflow: visible; -} -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar div.mce-toolbar-grp { - position: static; -} -.block-library-classic__toolbar .mce-toolbar-grp > div { - padding: 1px 3px; -} -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -}.wp-block-freeform.block-library-rich-text__tinymce{height:auto}.wp-block-freeform.block-library-rich-text__tinymce li,.wp-block-freeform.block-library-rich-text__tinymce p{line-height:1.8}.wp-block-freeform.block-library-rich-text__tinymce ol,.wp-block-freeform.block-library-rich-text__tinymce ul{padding-left:2.5em;margin-left:0}.wp-block-freeform.block-library-rich-text__tinymce blockquote{margin:0;box-shadow:inset 0 0 0 0 #ddd;border-left:4px solid #000;padding-left:1em}.wp-block-freeform.block-library-rich-text__tinymce pre{white-space:pre-wrap;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;color:#1e1e1e}.wp-block-freeform.block-library-rich-text__tinymce>:first-child{margin-top:0}.wp-block-freeform.block-library-rich-text__tinymce>:last-child{margin-bottom:0}.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce a{color:var(--wp-admin-theme-color)}.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected]{padding:0 2px;margin:0 -2px;border-radius:2px;box-shadow:0 0 0 1px #e5f5fa;background:#e5f5fa}.wp-block-freeform.block-library-rich-text__tinymce code{padding:2px;border-radius:2px;color:#1e1e1e;background:#f0f0f0;font-family:Menlo,Consolas,monaco,monospace;font-size:14px}.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected]{background:#ddd}.wp-block-freeform.block-library-rich-text__tinymce .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-freeform.block-library-rich-text__tinymce .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-freeform.block-library-rich-text__tinymce .aligncenter{display:block;margin-left:auto;margin-right:auto}.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag{width:96%;height:20px;display:block;margin:15px auto;outline:0;cursor:default;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC);background-size:1900px 20px;background-repeat:no-repeat;background-position:50%}.wp-block-freeform.block-library-rich-text__tinymce img::selection{background-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp{-ms-user-select:element}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption{margin:0;max-width:100%}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img{display:block}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption *{-webkit-user-drag:none}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd{padding-top:.5em;margin:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview{width:99.99%;position:relative;clear:both;margin-bottom:16px;border:1px solid transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe{display:block;max-width:100%;background:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim{position:absolute;top:0;right:0;bottom:0;left:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim{display:none}.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder{border:1px dashed #ddd;padding:10px}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error{border:1px solid #ddd;padding:1em 0;margin:0;word-wrap:break-word}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p{margin:0;text-align:center}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder,.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error{border-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons{display:block;margin:0 auto;width:32px;height:32px;font-size:32px}.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery:after{content:"";display:table;clear:both}.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce .gallery a{cursor:default}.wp-block-freeform.block-library-rich-text__tinymce .gallery{margin:auto -6px;padding:6px 0;line-height:1;overflow-x:hidden}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item{float:left;margin:0;text-align:center;padding:6px;box-sizing:border-box}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption,.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon{margin:0}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption{font-size:13px;margin:4px 0}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item{width:100%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item{width:50%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item{width:33.3333333333%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item{width:25%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item{width:20%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item{width:16.6666666667%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item{width:14.2857142857%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item{width:12.5%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item{width:11.1111111111%}.wp-block-freeform.block-library-rich-text__tinymce .gallery img{max-width:100%;height:auto;border:none;padding:0}div[data-type="core/freeform"]:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #ddd;outline:1px solid transparent}@media (prefers-reduced-motion:reduce){div[data-type="core/freeform"]:before{transition-duration:0s;transition-delay:0s}}div[data-type="core/freeform"].is-selected:before{border-color:#1e1e1e}div[data-type="core/freeform"] .block-editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}.mce-toolbar-grp .mce-btn.mce-active:hover button,.mce-toolbar-grp .mce-btn.mce-active:hover i,.mce-toolbar-grp .mce-btn.mce-active button,.mce-toolbar-grp .mce-btn.mce-active i{color:#1e1e1e}.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last{margin-right:0;margin-left:8px}.mce-toolbar-grp .mce-btn i{font-style:normal}.block-library-classic__toolbar{display:none;width:auto;position:sticky;z-index:31;top:0;border:1px solid #ddd;border-bottom:none;border-radius:2px;margin:0 0 8px;padding:0}div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{display:block;border-color:#1e1e1e}.block-library-classic__toolbar .mce-tinymce{box-shadow:none}@media (min-width:600px){.block-library-classic__toolbar{padding:0}}.block-library-classic__toolbar:empty{display:block;background:#f5f5f5;border-bottom:1px solid #e2e4e7}.block-library-classic__toolbar:empty:before{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;content:attr(data-placeholder);color:#555d66;line-height:37px;padding:14px}.block-library-classic__toolbar div.mce-toolbar-grp{border-bottom:1px solid #1e1e1e}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar .mce-menubar>div,.block-library-classic__toolbar .mce-tinymce-inline,.block-library-classic__toolbar .mce-tinymce-inline>div,.block-library-classic__toolbar div.mce-toolbar-grp,.block-library-classic__toolbar div.mce-toolbar-grp>div{height:auto!important;width:100%!important}.block-library-classic__toolbar .mce-container-body.mce-abs-layout{overflow:visible}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar div.mce-toolbar-grp{position:static}.block-library-classic__toolbar .mce-toolbar-grp>div{padding:1px 3px}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar{display:block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-freeform.block-library-rich-text__tinymce { - height: auto; - /* Allow height of embed iframes to be calculated properly */ - /* Remove blue highlighting of selected images in WebKit */ - /* Image captions */ - /* WP Views */ -} -.wp-block-freeform.block-library-rich-text__tinymce p, -.wp-block-freeform.block-library-rich-text__tinymce li { - line-height: 1.8; -} -.wp-block-freeform.block-library-rich-text__tinymce ul, -.wp-block-freeform.block-library-rich-text__tinymce ol { - padding-right: 2.5em; - margin-right: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce blockquote { - margin: 0; - box-shadow: inset 0 0 0 0 #ddd; - border-right: 4px solid #000; - padding-right: 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce pre { - white-space: pre-wrap; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - color: #1e1e1e; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:first-child { - margin-top: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:last-child { - margin-bottom: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce a { - color: var(--wp-admin-theme-color); -} -.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected] { - padding: 0 2px; - margin: 0 -2px; - border-radius: 2px; - box-shadow: 0 0 0 1px #e5f5fa; - background: #e5f5fa; -} -.wp-block-freeform.block-library-rich-text__tinymce code { - padding: 2px; - border-radius: 2px; - color: #1e1e1e; - background: #f0f0f0; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 14px; -} -.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected] { - background: #ddd; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignright { - float: right; - margin: 0.5em 0 0.5em 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignleft { - float: left; - margin: 0.5em 1em 0.5em 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .aligncenter { - display: block; - margin-right: auto; - margin-left: auto; -} -.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag { - width: 96%; - height: 20px; - display: block; - margin: 15px auto; - outline: 0; - cursor: default; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC); - background-size: 1900px 20px; - background-repeat: no-repeat; - background-position: center; -} -.wp-block-freeform.block-library-rich-text__tinymce img::selection { - background-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp { - -ms-user-select: element; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption { - margin: 0; - /* dl browser reset */ - max-width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a, -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img { - display: block; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption, .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * { - -webkit-user-drag: none; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd { - padding-top: 0.5em; - margin: 0; - /* browser dd reset */ -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview { - width: 99.99%; - /* All IE need hasLayout, incl. 11 (ugh, not again!!) */ - position: relative; - clear: both; - margin-bottom: 16px; - border: 1px solid transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe { - display: block; - max-width: 100%; - background: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim { - display: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder { - border: 1px dashed #ddd; - padding: 10px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error { - border: 1px solid #ddd; - padding: 1em 0; - margin: 0; - word-wrap: break-word; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p { - margin: 0; - text-align: center; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder, .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error { - border-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons { - display: block; - margin: 0 auto; - width: 32px; - height: 32px; - font-size: 32px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery::after { - content: ""; - display: table; - clear: both; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery a { - cursor: default; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery { - margin: auto -6px; - padding: 6px 0; - line-height: 1; - overflow-x: hidden; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item { - float: right; - margin: 0; - text-align: center; - padding: 6px; - box-sizing: border-box; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption, -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon { - margin: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption { - font-size: 13px; - margin: 4px 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item { - width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item { - width: 50%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item { - width: 33.3333333333%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item { - width: 25%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item { - width: 20%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item { - width: 16.6666666667%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item { - width: 14.2857142857%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item { - width: 12.5%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item { - width: 11.1111111111%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img { - max-width: 100%; - height: auto; - border: none; - padding: 0; -} - -div[data-type="core/freeform"]::before { - transition: border-color 0.1s linear, box-shadow 0.1s linear; - border: 1px solid #ddd; - outline: 1px solid transparent; -} -@media (prefers-reduced-motion: reduce) { - div[data-type="core/freeform"]::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -div[data-type="core/freeform"].is-selected::before { - border-color: #1e1e1e; -} -div[data-type="core/freeform"] .block-editor-block-contextual-toolbar + div { - margin-top: 0; - padding-top: 0; -} -div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce::after { - content: ""; - display: table; - clear: both; -} - -.mce-toolbar-grp .mce-btn.mce-active button, -.mce-toolbar-grp .mce-btn.mce-active:hover button, -.mce-toolbar-grp .mce-btn.mce-active i, -.mce-toolbar-grp .mce-btn.mce-active:hover i { - color: #1e1e1e; -} -.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last { - margin-left: 0; - margin-right: 8px; -} -.mce-toolbar-grp .mce-btn i { - font-style: normal; -} - -.block-library-classic__toolbar { - display: none; - width: auto; - margin: 0; - position: sticky; - z-index: 31; - top: 0; - border: 1px solid #ddd; - border-bottom: none; - border-radius: 2px; - margin-bottom: 8px; - padding: 0; -} -div[data-type="core/freeform"].is-selected .block-library-classic__toolbar { - display: block; - border-color: #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce { - box-shadow: none; -} -@media (min-width: 600px) { - .block-library-classic__toolbar { - padding: 0; - } -} -.block-library-classic__toolbar:empty { - display: block; - background: #f5f5f5; - border-bottom: 1px solid #e2e4e7; -} -.block-library-classic__toolbar:empty::before { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - content: attr(data-placeholder); - color: #555d66; - line-height: 37px; - padding: 14px; -} -.block-library-classic__toolbar div.mce-toolbar-grp { - border-bottom: 1px solid #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce-inline, -.block-library-classic__toolbar .mce-tinymce-inline > div, -.block-library-classic__toolbar div.mce-toolbar-grp, -.block-library-classic__toolbar div.mce-toolbar-grp > div, -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar .mce-menubar > div { - height: auto !important; - width: 100% !important; -} -.block-library-classic__toolbar .mce-container-body.mce-abs-layout { - overflow: visible; -} -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar div.mce-toolbar-grp { - position: static; -} -.block-library-classic__toolbar .mce-toolbar-grp > div { - padding: 1px 3px; -} -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -}.wp-block-freeform.block-library-rich-text__tinymce{height:auto}.wp-block-freeform.block-library-rich-text__tinymce li,.wp-block-freeform.block-library-rich-text__tinymce p{line-height:1.8}.wp-block-freeform.block-library-rich-text__tinymce ol,.wp-block-freeform.block-library-rich-text__tinymce ul{padding-right:2.5em;margin-right:0}.wp-block-freeform.block-library-rich-text__tinymce blockquote{margin:0;box-shadow:inset 0 0 0 0 #ddd;border-right:4px solid #000;padding-right:1em}.wp-block-freeform.block-library-rich-text__tinymce pre{white-space:pre-wrap;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;color:#1e1e1e}.wp-block-freeform.block-library-rich-text__tinymce>:first-child{margin-top:0}.wp-block-freeform.block-library-rich-text__tinymce>:last-child{margin-bottom:0}.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce a{color:var(--wp-admin-theme-color)}.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected]{padding:0 2px;margin:0 -2px;border-radius:2px;box-shadow:0 0 0 1px #e5f5fa;background:#e5f5fa}.wp-block-freeform.block-library-rich-text__tinymce code{padding:2px;border-radius:2px;color:#1e1e1e;background:#f0f0f0;font-family:Menlo,Consolas,monaco,monospace;font-size:14px}.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected]{background:#ddd}.wp-block-freeform.block-library-rich-text__tinymce .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-freeform.block-library-rich-text__tinymce .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-freeform.block-library-rich-text__tinymce .aligncenter{display:block;margin-right:auto;margin-left:auto}.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag{width:96%;height:20px;display:block;margin:15px auto;outline:0;cursor:default;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC);background-size:1900px 20px;background-repeat:no-repeat;background-position:50%}.wp-block-freeform.block-library-rich-text__tinymce img::selection{background-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp{-ms-user-select:element}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption{margin:0;max-width:100%}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img{display:block}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption *{-webkit-user-drag:none}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd{padding-top:.5em;margin:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview{width:99.99%;position:relative;clear:both;margin-bottom:16px;border:1px solid transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe{display:block;max-width:100%;background:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim{display:none}.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder{border:1px dashed #ddd;padding:10px}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error{border:1px solid #ddd;padding:1em 0;margin:0;word-wrap:break-word}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p{margin:0;text-align:center}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder,.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error{border-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons{display:block;margin:0 auto;width:32px;height:32px;font-size:32px}.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery:after{content:"";display:table;clear:both}.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce .gallery a{cursor:default}.wp-block-freeform.block-library-rich-text__tinymce .gallery{margin:auto -6px;padding:6px 0;line-height:1;overflow-x:hidden}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item{float:right;margin:0;text-align:center;padding:6px;box-sizing:border-box}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption,.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon{margin:0}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption{font-size:13px;margin:4px 0}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item{width:100%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item{width:50%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item{width:33.3333333333%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item{width:25%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item{width:20%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item{width:16.6666666667%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item{width:14.2857142857%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item{width:12.5%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item{width:11.1111111111%}.wp-block-freeform.block-library-rich-text__tinymce .gallery img{max-width:100%;height:auto;border:none;padding:0}div[data-type="core/freeform"]:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #ddd;outline:1px solid transparent}@media (prefers-reduced-motion:reduce){div[data-type="core/freeform"]:before{transition-duration:0s;transition-delay:0s}}div[data-type="core/freeform"].is-selected:before{border-color:#1e1e1e}div[data-type="core/freeform"] .block-editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}.mce-toolbar-grp .mce-btn.mce-active:hover button,.mce-toolbar-grp .mce-btn.mce-active:hover i,.mce-toolbar-grp .mce-btn.mce-active button,.mce-toolbar-grp .mce-btn.mce-active i{color:#1e1e1e}.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last{margin-left:0;margin-right:8px}.mce-toolbar-grp .mce-btn i{font-style:normal}.block-library-classic__toolbar{display:none;width:auto;position:sticky;z-index:31;top:0;border:1px solid #ddd;border-bottom:none;border-radius:2px;margin:0 0 8px;padding:0}div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{display:block;border-color:#1e1e1e}.block-library-classic__toolbar .mce-tinymce{box-shadow:none}@media (min-width:600px){.block-library-classic__toolbar{padding:0}}.block-library-classic__toolbar:empty{display:block;background:#f5f5f5;border-bottom:1px solid #e2e4e7}.block-library-classic__toolbar:empty:before{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;content:attr(data-placeholder);color:#555d66;line-height:37px;padding:14px}.block-library-classic__toolbar div.mce-toolbar-grp{border-bottom:1px solid #1e1e1e}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar .mce-menubar>div,.block-library-classic__toolbar .mce-tinymce-inline,.block-library-classic__toolbar .mce-tinymce-inline>div,.block-library-classic__toolbar div.mce-toolbar-grp,.block-library-classic__toolbar div.mce-toolbar-grp>div{height:auto!important;width:100%!important}.block-library-classic__toolbar .mce-container-body.mce-abs-layout{overflow:visible}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar div.mce-toolbar-grp{position:static}.block-library-classic__toolbar .mce-toolbar-grp>div{padding:1px 3px}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar{display:block}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-terms", - "title": "Post Terms", - "category": "theme", - "description": "Post terms.", - "textdomain": "default", - "attributes": { - "term": { - "type": "string" - }, - "textAlign": { - "type": "string" - }, - "separator": { - "type": "string", - "default": ", " - } - }, - "usesContext": [ "postId", "postType" ], - "supports": { - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "typography": { - "lineHeight": true, - "fontSize": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - }, - "style": "wp-block-post-terms" -} -.wp-block-post-terms__separator{white-space:pre-wrap}.wp-block-post-terms__separator{white-space:pre-wrap}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-terms__separator { - white-space: pre-wrap; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-terms__separator { - white-space: pre-wrap; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query-pagination-previous", - "title": "Previous Page", - "category": "theme", - "parent": [ "core/query-pagination" ], - "description": "Displays the previous posts page link.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - } - }, - "usesContext": [ "queryId", "query", "paginationArrow" ], - "supports": { - "reusable": false, - "html": false, - "color": { - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-title", - "title": "Comments Title", - "category": "theme", - "ancestor": [ "core/comments-query-loop" ], - "description": "Displays a title with the number of comments", - "textdomain": "default", - "usesContext": [ "postId", "postType" ], - "attributes": { - "textAlign": { - "type": "string" - }, - "showPostTitle": { - "type": "boolean", - "default": true - }, - "showCommentsCount": { - "type": "boolean", - "default": true - }, - "level": { - "type": "number", - "default": 2 - } - }, - "supports": { - "anchor": false, - "align": true, - "html": false, - "__experimentalBorder": { - "radius": true, - "color": true, - "width": true, - "style": true - }, - "color": { - "gradients": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "margin": true, - "padding": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalFontFamily": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true, - "__experimentalFontFamily": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true - } - } - } -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-title.has-background { - padding: inherit; -}.wp-block-comments-title.has-background{padding:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-title.has-background { - padding: inherit; -}.wp-block-comments-title.has-background{padding:inherit}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/home-link", - "category": "design", - "parent": [ "core/navigation" ], - "title": "Home Link", - "description": "Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - } - }, - "usesContext": [ - "textColor", - "customTextColor", - "backgroundColor", - "customBackgroundColor", - "fontSize", - "customFontSize", - "style" - ], - "supports": { - "reusable": false, - "html": false - }, - "editorStyle": "wp-block-home-link-editor", - "style": "wp-block-home-link" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-featured-image", - "title": "Post Featured Image", - "category": "theme", - "description": "Display a post's featured image.", - "textdomain": "default", - "attributes": { - "isLink": { - "type": "boolean", - "default": false - }, - "width": { - "type": "string" - }, - "height": { - "type": "string" - }, - "scale": { - "type": "string", - "default": "cover" - }, - "sizeSlug": { - "type": "string" - } - }, - "usesContext": [ "postId", "postType", "queryId" ], - "supports": { - "align": [ "left", "right", "center", "wide", "full" ], - "color": { - "__experimentalDuotone": "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before", - "text": false, - "background": false - }, - "html": false, - "spacing": { - "margin": true, - "padding": true - } - }, - "editorStyle": "wp-block-post-featured-image-editor", - "style": "wp-block-post-featured-image" -} -.wp-block-post-featured-image{margin-right:0;margin-left:0}.wp-block-post-featured-image a{display:block}.wp-block-post-featured-image img{max-width:100%;width:100%;height:auto;vertical-align:bottom}.wp-block-post-featured-image.alignfull img,.wp-block-post-featured-image.alignwide img{width:100%}.wp-block-post-featured-image{margin-left:0;margin-right:0}.wp-block-post-featured-image a{display:block}.wp-block-post-featured-image img{max-width:100%;width:100%;height:auto;vertical-align:bottom}.wp-block-post-featured-image.alignfull img,.wp-block-post-featured-image.alignwide img{width:100%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-featured-image { - margin-right: 0; - margin-left: 0; -} -.wp-block-post-featured-image a { - display: block; -} -.wp-block-post-featured-image img { - max-width: 100%; - width: 100%; - height: auto; - vertical-align: bottom; -} -.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img { - width: 100%; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder { - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - color: currentColor; - background: transparent; - min-height: 200px; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - right: 4px; - bottom: 4px; - left: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder::before, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button > svg, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder { - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; -} -.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -div[data-type="core/post-featured-image"] img { - max-width: 100%; - height: auto; - display: block; -}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder { - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - color: currentColor; - background: transparent; - min-height: 200px; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - left: 4px; - bottom: 4px; - right: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder::before, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button > svg, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder { - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; -} -.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -div[data-type="core/post-featured-image"] img { - max-width: 100%; - height: auto; - display: block; -}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-featured-image { - margin-left: 0; - margin-right: 0; -} -.wp-block-post-featured-image a { - display: block; -} -.wp-block-post-featured-image img { - max-width: 100%; - width: 100%; - height: auto; - vertical-align: bottom; -} -.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img { - width: 100%; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/page-list", - "title": "Page List", - "category": "widgets", - "description": "Display a list of all pages.", - "keywords": [ "menu", "navigation" ], - "textdomain": "default", - "attributes": { - "__unstableMaxPages": { - "type": "number" - } - }, - "usesContext": [ - "textColor", - "customTextColor", - "backgroundColor", - "customBackgroundColor", - "overlayTextColor", - "customOverlayTextColor", - "overlayBackgroundColor", - "customOverlayBackgroundColor", - "fontSize", - "customFontSize", - "showSubmenuIcon", - "style", - "openSubmenusOnClick" - ], - "supports": { - "reusable": false, - "html": false - }, - "editorStyle": "wp-block-page-list-editor", - "style": "wp-block-page-list" -} -.wp-block-navigation .wp-block-page-list{display:flex;flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);flex-wrap:var(--navigation-layout-wrap,wrap);background-color:inherit}.wp-block-navigation .wp-block-navigation-item{background-color:inherit}.wp-block-navigation .wp-block-page-list{display:flex;flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);flex-wrap:var(--navigation-layout-wrap,wrap);background-color:inherit}.wp-block-navigation .wp-block-navigation-item{background-color:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-page-list { - display: flex; - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - flex-wrap: var(--navigation-layout-wrap, wrap); - background-color: inherit; -} -.wp-block-navigation .wp-block-navigation-item { - background-color: inherit; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-page-list > div, -.wp-block-navigation .wp-block-page-list { - background-color: inherit; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > div, -.wp-block-navigation.items-justified-space-between .wp-block-page-list { - display: contents; - flex: 1; -} -.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list { - flex: inherit; -} - -.wp-block-pages-list__item__link { - pointer-events: none; -} - -@media (min-width: 600px) { - .wp-block-page-list-modal { - max-width: 480px; - } -} - -.wp-block-page-list-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -.wp-block-page-list .open-on-click:focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-page-list .components-notice { - margin-left: 0; -}.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{visibility:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-page-list .components-notice{margin-left:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-page-list > div, -.wp-block-navigation .wp-block-page-list { - background-color: inherit; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > div, -.wp-block-navigation.items-justified-space-between .wp-block-page-list { - display: contents; - flex: 1; -} -.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list { - flex: inherit; -} - -.wp-block-pages-list__item__link { - pointer-events: none; -} - -@media (min-width: 600px) { - .wp-block-page-list-modal { - max-width: 480px; - } -} - -.wp-block-page-list-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -.wp-block-page-list .open-on-click:focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-page-list .components-notice { - margin-right: 0; -}.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{visibility:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-page-list .components-notice{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation .wp-block-page-list { - display: flex; - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - flex-wrap: var(--navigation-layout-wrap, wrap); - background-color: inherit; -} -.wp-block-navigation .wp-block-navigation-item { - background-color: inherit; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-pagination-previous", - "title": "Previous Page", - "category": "theme", - "parent": [ "core/comments-pagination" ], - "description": "Displays the previous comment's page link.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - } - }, - "usesContext": [ "postId", "comments/paginationArrow" ], - "supports": { - "reusable": false, - "html": false, - "color": { - "gradients": true, - "text": false, - "__experimentalDefaultControls": { - "background": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-author-name", - "title": "Comment Author Name", - "category": "theme", - "ancestor": [ "core/comment-template" ], - "description": "Displays the name of the author of the comment.", - "textdomain": "default", - "attributes": { - "isLink": { - "type": "boolean", - "default": true - }, - "linkTarget": { - "type": "string", - "default": "_self" - }, - "textAlign": { - "type": "string" - } - }, - "usesContext": [ "commentId" ], - "supports": { - "html": false, - "spacing": { - "margin": true, - "padding": true - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/columns", - "title": "Columns", - "category": "design", - "description": "Display content in multiple columns, with blocks added to each column.", - "textdomain": "default", - "attributes": { - "verticalAlignment": { - "type": "string" - }, - "isStackedOnMobile": { - "type": "boolean", - "default": true - } - }, - "supports": { - "anchor": true, - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "spacing": { - "blockGap": { - "__experimentalDefault": "2em" - }, - "margin": [ "top", "bottom" ], - "padding": true, - "__experimentalDefaultControls": { - "padding": true - } - }, - "__experimentalLayout": { - "allowSwitching": false, - "allowInheriting": false, - "allowEditing": false, - "default": { - "type": "flex", - "flexWrap": "nowrap" - } - }, - "__experimentalBorder": { - "color": true, - "radius": true, - "style": true, - "width": true, - "__experimentalDefaultControls": { - "color": true, - "radius": true, - "style": true, - "width": true - } - } - }, - "editorStyle": "wp-block-columns-editor", - "style": "wp-block-columns" -} -.wp-block-columns{display:flex;margin-bottom:1.75em;box-sizing:border-box;flex-wrap:wrap!important;align-items:normal!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;word-break:break-word;overflow-wrap:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}.wp-block-columns{display:flex;margin-bottom:1.75em;box-sizing:border-box;flex-wrap:wrap!important;align-items:normal!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;word-break:break-word;overflow-wrap:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-columns { - display: flex; - margin-bottom: 1.75em; - box-sizing: border-box; - flex-wrap: wrap !important; - align-items: initial !important; - /** - * All Columns Alignment - */ -} -@media (min-width: 782px) { - .wp-block-columns { - flex-wrap: nowrap !important; - } -} -.wp-block-columns.are-vertically-aligned-top { - align-items: flex-start; -} -.wp-block-columns.are-vertically-aligned-center { - align-items: center; -} -.wp-block-columns.are-vertically-aligned-bottom { - align-items: flex-end; -} -@media (max-width: 781px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 100% !important; - } -} -@media (min-width: 782px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 0; - flex-grow: 1; - } - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column[style*=flex-basis] { - flex-grow: 0; - } -} -.wp-block-columns.is-not-stacked-on-mobile { - flex-wrap: nowrap !important; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column { - flex-basis: 0; - flex-grow: 1; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column[style*=flex-basis] { - flex-grow: 0; -} - -:where(.wp-block-columns.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-column { - flex-grow: 1; - min-width: 0; - word-break: break-word; - overflow-wrap: break-word; - /** - * Individual Column Alignment - */ -} -.wp-block-column.is-vertically-aligned-top { - align-self: flex-start; -} -.wp-block-column.is-vertically-aligned-center { - align-self: center; -} -.wp-block-column.is-vertically-aligned-bottom { - align-self: flex-end; -} -.wp-block-column.is-vertically-aligned-top, .wp-block-column.is-vertically-aligned-center, .wp-block-column.is-vertically-aligned-bottom { - width: 100%; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-columns :where(.wp-block) { - max-width: none; - margin-left: 0; - margin-right: 0; -} - -html :where(.wp-block-column) { - margin-top: 0; - margin-bottom: 0; -}.wp-block-columns :where(.wp-block){max-width:none;margin-left:0;margin-right:0}html :where(.wp-block-column){margin-top:0;margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-columns :where(.wp-block) { - max-width: none; - margin-right: 0; - margin-left: 0; -} - -html :where(.wp-block-column) { - margin-top: 0; - margin-bottom: 0; -}.wp-block-columns :where(.wp-block){max-width:none;margin-right:0;margin-left:0}html :where(.wp-block-column){margin-top:0;margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-columns { - display: flex; - margin-bottom: 1.75em; - box-sizing: border-box; - flex-wrap: wrap !important; - align-items: initial !important; - /** - * All Columns Alignment - */ -} -@media (min-width: 782px) { - .wp-block-columns { - flex-wrap: nowrap !important; - } -} -.wp-block-columns.are-vertically-aligned-top { - align-items: flex-start; -} -.wp-block-columns.are-vertically-aligned-center { - align-items: center; -} -.wp-block-columns.are-vertically-aligned-bottom { - align-items: flex-end; -} -@media (max-width: 781px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 100% !important; - } -} -@media (min-width: 782px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 0; - flex-grow: 1; - } - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column[style*=flex-basis] { - flex-grow: 0; - } -} -.wp-block-columns.is-not-stacked-on-mobile { - flex-wrap: nowrap !important; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column { - flex-basis: 0; - flex-grow: 1; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column[style*=flex-basis] { - flex-grow: 0; -} - -:where(.wp-block-columns.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-column { - flex-grow: 1; - min-width: 0; - word-break: break-word; - overflow-wrap: break-word; - /** - * Individual Column Alignment - */ -} -.wp-block-column.is-vertically-aligned-top { - align-self: flex-start; -} -.wp-block-column.is-vertically-aligned-center { - align-self: center; -} -.wp-block-column.is-vertically-aligned-bottom { - align-self: flex-end; -} -.wp-block-column.is-vertically-aligned-top, .wp-block-column.is-vertically-aligned-center, .wp-block-column.is-vertically-aligned-bottom { - width: 100%; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/latest-comments", - "title": "Latest Comments", - "category": "widgets", - "description": "Display a list of your most recent comments.", - "keywords": [ "recent comments" ], - "textdomain": "default", - "attributes": { - "commentsToShow": { - "type": "number", - "default": 5, - "minimum": 1, - "maximum": 100 - }, - "displayAvatar": { - "type": "boolean", - "default": true - }, - "displayDate": { - "type": "boolean", - "default": true - }, - "displayExcerpt": { - "type": "boolean", - "default": true - } - }, - "supports": { - "align": true, - "html": false - }, - "editorStyle": "wp-block-latest-comments-editor", - "style": "wp-block-latest-comments" -} -ol.wp-block-latest-comments{margin-right:0}.wp-block-latest-comments .wp-block-latest-comments{padding-right:0}.wp-block-latest-comments__comment{line-height:1.1;list-style:none;margin-bottom:1em}.has-avatars .wp-block-latest-comments__comment{min-height:2.25em;list-style:none}.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt,.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta{margin-right:3.25em}.has-dates .wp-block-latest-comments__comment,.has-excerpts .wp-block-latest-comments__comment{line-height:1.5}.wp-block-latest-comments__comment-excerpt p{font-size:.875em;line-height:1.8;margin:.36em 0 1.4em}.wp-block-latest-comments__comment-date{display:block;font-size:.75em}.wp-block-latest-comments .avatar,.wp-block-latest-comments__comment-avatar{border-radius:1.5em;display:block;float:right;height:2.5em;margin-left:.75em;width:2.5em}ol.wp-block-latest-comments{margin-left:0}.wp-block-latest-comments .wp-block-latest-comments{padding-left:0}.wp-block-latest-comments__comment{line-height:1.1;list-style:none;margin-bottom:1em}.has-avatars .wp-block-latest-comments__comment{min-height:2.25em;list-style:none}.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt,.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta{margin-left:3.25em}.has-dates .wp-block-latest-comments__comment,.has-excerpts .wp-block-latest-comments__comment{line-height:1.5}.wp-block-latest-comments__comment-excerpt p{font-size:.875em;line-height:1.8;margin:.36em 0 1.4em}.wp-block-latest-comments__comment-date{display:block;font-size:.75em}.wp-block-latest-comments .avatar,.wp-block-latest-comments__comment-avatar{border-radius:1.5em;display:block;float:left;height:2.5em;margin-right:.75em;width:2.5em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ol.wp-block-latest-comments { - margin-right: 0; -} - -.wp-block-latest-comments .wp-block-latest-comments { - padding-right: 0; -} - -.wp-block-latest-comments__comment { - line-height: 1.1; - list-style: none; - margin-bottom: 1em; -} -.has-avatars .wp-block-latest-comments__comment { - min-height: 2.25em; - list-style: none; -} -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta, -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt { - margin-right: 3.25em; -} -.has-dates .wp-block-latest-comments__comment, .has-excerpts .wp-block-latest-comments__comment { - line-height: 1.5; -} - -.wp-block-latest-comments__comment-excerpt p { - font-size: 0.875em; - line-height: 1.8; - margin: 0.36em 0 1.4em; -} - -.wp-block-latest-comments__comment-date { - display: block; - font-size: 0.75em; -} - -.wp-block-latest-comments .avatar, -.wp-block-latest-comments__comment-avatar { - border-radius: 1.5em; - display: block; - float: right; - height: 2.5em; - margin-left: 0.75em; - width: 2.5em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ol.wp-block-latest-comments { - margin-left: 0; -} - -.wp-block-latest-comments .wp-block-latest-comments { - padding-left: 0; -} - -.wp-block-latest-comments__comment { - line-height: 1.1; - list-style: none; - margin-bottom: 1em; -} -.has-avatars .wp-block-latest-comments__comment { - min-height: 2.25em; - list-style: none; -} -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta, -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt { - margin-left: 3.25em; -} -.has-dates .wp-block-latest-comments__comment, .has-excerpts .wp-block-latest-comments__comment { - line-height: 1.5; -} - -.wp-block-latest-comments__comment-excerpt p { - font-size: 0.875em; - line-height: 1.8; - margin: 0.36em 0 1.4em; -} - -.wp-block-latest-comments__comment-date { - display: block; - font-size: 0.75em; -} - -.wp-block-latest-comments .avatar, -.wp-block-latest-comments__comment-avatar { - border-radius: 1.5em; - display: block; - float: left; - height: 2.5em; - margin-right: 0.75em; - width: 2.5em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/latest-posts", - "title": "Latest Posts", - "category": "widgets", - "description": "Display a list of your most recent posts.", - "keywords": [ "recent posts" ], - "textdomain": "default", - "attributes": { - "categories": { - "type": "array", - "items": { - "type": "object" - } - }, - "selectedAuthor": { - "type": "number" - }, - "postsToShow": { - "type": "number", - "default": 5 - }, - "displayPostContent": { - "type": "boolean", - "default": false - }, - "displayPostContentRadio": { - "type": "string", - "default": "excerpt" - }, - "excerptLength": { - "type": "number", - "default": 55 - }, - "displayAuthor": { - "type": "boolean", - "default": false - }, - "displayPostDate": { - "type": "boolean", - "default": false - }, - "postLayout": { - "type": "string", - "default": "list" - }, - "columns": { - "type": "number", - "default": 3 - }, - "order": { - "type": "string", - "default": "desc" - }, - "orderBy": { - "type": "string", - "default": "date" - }, - "displayFeaturedImage": { - "type": "boolean", - "default": false - }, - "featuredImageAlign": { - "type": "string", - "enum": [ "left", "center", "right" ] - }, - "featuredImageSizeSlug": { - "type": "string", - "default": "thumbnail" - }, - "featuredImageSizeWidth": { - "type": "number", - "default": null - }, - "featuredImageSizeHeight": { - "type": "number", - "default": null - }, - "addLinkToFeaturedImage": { - "type": "boolean", - "default": false - } - }, - "supports": { - "align": true, - "html": false - }, - "editorStyle": "wp-block-latest-posts-editor", - "style": "wp-block-latest-posts" -} -.wp-block-latest-posts.alignleft{margin-right:2em}.wp-block-latest-posts.alignright{margin-left:2em}.wp-block-latest-posts.wp-block-latest-posts__list{list-style:none;padding-right:0}.wp-block-latest-posts.wp-block-latest-posts__list li{clear:both}.wp-block-latest-posts.is-grid{display:flex;flex-wrap:wrap;padding:0}.wp-block-latest-posts.is-grid li{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.wp-block-latest-posts.columns-2 li{width:calc(50% - .625em)}.wp-block-latest-posts.columns-2 li:nth-child(2n){margin-left:0}.wp-block-latest-posts.columns-3 li{width:calc(33.33333% - .83333em)}.wp-block-latest-posts.columns-3 li:nth-child(3n){margin-left:0}.wp-block-latest-posts.columns-4 li{width:calc(25% - .9375em)}.wp-block-latest-posts.columns-4 li:nth-child(4n){margin-left:0}.wp-block-latest-posts.columns-5 li{width:calc(20% - 1em)}.wp-block-latest-posts.columns-5 li:nth-child(5n){margin-left:0}.wp-block-latest-posts.columns-6 li{width:calc(16.66667% - 1.04167em)}.wp-block-latest-posts.columns-6 li:nth-child(6n){margin-left:0}}.wp-block-latest-posts__post-author,.wp-block-latest-posts__post-date{display:block;font-size:.8125em}.wp-block-latest-posts__post-excerpt{margin-top:.5em;margin-bottom:1em}.wp-block-latest-posts__featured-image a{display:inline-block}.wp-block-latest-posts__featured-image img{height:auto;width:auto;max-width:100%}.wp-block-latest-posts__featured-image.alignleft{margin-right:1em;float:left}.wp-block-latest-posts__featured-image.alignright{margin-left:1em;float:right}.wp-block-latest-posts__featured-image.aligncenter{margin-bottom:1em;text-align:center}.wp-block-latest-posts.alignleft{margin-right:2em}.wp-block-latest-posts.alignright{margin-left:2em}.wp-block-latest-posts.wp-block-latest-posts__list{list-style:none;padding-left:0}.wp-block-latest-posts.wp-block-latest-posts__list li{clear:both}.wp-block-latest-posts.is-grid{display:flex;flex-wrap:wrap;padding:0}.wp-block-latest-posts.is-grid li{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.wp-block-latest-posts.columns-2 li{width:calc(50% - .625em)}.wp-block-latest-posts.columns-2 li:nth-child(2n){margin-right:0}.wp-block-latest-posts.columns-3 li{width:calc(33.33333% - .83333em)}.wp-block-latest-posts.columns-3 li:nth-child(3n){margin-right:0}.wp-block-latest-posts.columns-4 li{width:calc(25% - .9375em)}.wp-block-latest-posts.columns-4 li:nth-child(4n){margin-right:0}.wp-block-latest-posts.columns-5 li{width:calc(20% - 1em)}.wp-block-latest-posts.columns-5 li:nth-child(5n){margin-right:0}.wp-block-latest-posts.columns-6 li{width:calc(16.66667% - 1.04167em)}.wp-block-latest-posts.columns-6 li:nth-child(6n){margin-right:0}}.wp-block-latest-posts__post-author,.wp-block-latest-posts__post-date{display:block;font-size:.8125em}.wp-block-latest-posts__post-excerpt{margin-top:.5em;margin-bottom:1em}.wp-block-latest-posts__featured-image a{display:inline-block}.wp-block-latest-posts__featured-image img{height:auto;width:auto;max-width:100%}.wp-block-latest-posts__featured-image.alignleft{margin-right:1em;float:left}.wp-block-latest-posts__featured-image.alignright{margin-left:1em;float:right}.wp-block-latest-posts__featured-image.aligncenter{margin-bottom:1em;text-align:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-latest-posts.alignleft { - margin-right: 2em; -} -.wp-block-latest-posts.alignright { - margin-left: 2em; -} -.wp-block-latest-posts.wp-block-latest-posts__list { - list-style: none; - padding-right: 0; -} -.wp-block-latest-posts.wp-block-latest-posts__list li { - clear: both; -} -.wp-block-latest-posts.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; -} -.wp-block-latest-posts.is-grid li { - margin: 0 0 1.25em 1.25em; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-latest-posts.columns-2 li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-latest-posts.columns-2 li:nth-child(2n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-3 li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-latest-posts.columns-3 li:nth-child(3n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-4 li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-latest-posts.columns-4 li:nth-child(4n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-5 li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-latest-posts.columns-5 li:nth-child(5n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-6 li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } - .wp-block-latest-posts.columns-6 li:nth-child(6n) { - margin-left: 0; - } -} - -.wp-block-latest-posts__post-date, -.wp-block-latest-posts__post-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-latest-posts__post-excerpt { - margin-top: 0.5em; - margin-bottom: 1em; -} - -.wp-block-latest-posts__featured-image a { - display: inline-block; -} -.wp-block-latest-posts__featured-image img { - height: auto; - width: auto; - max-width: 100%; -} -.wp-block-latest-posts__featured-image.alignleft { - margin-right: 1em; - float: left; -} -.wp-block-latest-posts__featured-image.alignright { - margin-left: 1em; - float: right; -} -.wp-block-latest-posts__featured-image.aligncenter { - margin-bottom: 1em; - text-align: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-latest-posts { - padding-left: 2.5em; -} -.wp-block-latest-posts.is-grid { - padding-left: 0; -} - -.wp-block-latest-posts li a > div { - display: inline; -} - -.edit-post-visual-editor .wp-block-latest-posts.is-grid li { - margin-bottom: 20px; -} - -.editor-latest-posts-image-alignment-control .components-base-control__label { - display: block; -} -.editor-latest-posts-image-alignment-control .components-toolbar { - border-radius: 2px; -}.wp-block-latest-posts{padding-left:2.5em}.wp-block-latest-posts.is-grid{padding-left:0}.wp-block-latest-posts li a>div{display:inline}.edit-post-visual-editor .wp-block-latest-posts.is-grid li{margin-bottom:20px}.editor-latest-posts-image-alignment-control .components-base-control__label{display:block}.editor-latest-posts-image-alignment-control .components-toolbar{border-radius:2px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-latest-posts { - padding-right: 2.5em; -} -.wp-block-latest-posts.is-grid { - padding-right: 0; -} - -.wp-block-latest-posts li a > div { - display: inline; -} - -.edit-post-visual-editor .wp-block-latest-posts.is-grid li { - margin-bottom: 20px; -} - -.editor-latest-posts-image-alignment-control .components-base-control__label { - display: block; -} -.editor-latest-posts-image-alignment-control .components-toolbar { - border-radius: 2px; -}.wp-block-latest-posts{padding-right:2.5em}.wp-block-latest-posts.is-grid{padding-right:0}.wp-block-latest-posts li a>div{display:inline}.edit-post-visual-editor .wp-block-latest-posts.is-grid li{margin-bottom:20px}.editor-latest-posts-image-alignment-control .components-base-control__label{display:block}.editor-latest-posts-image-alignment-control .components-toolbar{border-radius:2px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-latest-posts.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -.wp-block-latest-posts.alignright { - /*rtl:ignore*/ - margin-left: 2em; -} -.wp-block-latest-posts.wp-block-latest-posts__list { - list-style: none; - padding-left: 0; -} -.wp-block-latest-posts.wp-block-latest-posts__list li { - clear: both; -} -.wp-block-latest-posts.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; -} -.wp-block-latest-posts.is-grid li { - margin: 0 1.25em 1.25em 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-latest-posts.columns-2 li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-latest-posts.columns-2 li:nth-child(2n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-3 li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-latest-posts.columns-3 li:nth-child(3n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-4 li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-latest-posts.columns-4 li:nth-child(4n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-5 li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-latest-posts.columns-5 li:nth-child(5n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-6 li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } - .wp-block-latest-posts.columns-6 li:nth-child(6n) { - margin-right: 0; - } -} - -.wp-block-latest-posts__post-date, -.wp-block-latest-posts__post-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-latest-posts__post-excerpt { - margin-top: 0.5em; - margin-bottom: 1em; -} - -.wp-block-latest-posts__featured-image a { - display: inline-block; -} -.wp-block-latest-posts__featured-image img { - height: auto; - width: auto; - max-width: 100%; -} -.wp-block-latest-posts__featured-image.alignleft { - /*rtl:ignore*/ - margin-right: 1em; - /*rtl:ignore*/ - float: left; -} -.wp-block-latest-posts__featured-image.alignright { - /*rtl:ignore*/ - margin-left: 1em; - /*rtl:ignore*/ - float: right; -} -.wp-block-latest-posts__featured-image.aligncenter { - margin-bottom: 1em; - text-align: center; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/pattern", - "title": "Pattern", - "category": "theme", - "description": "Show a block pattern.", - "supports": { - "html": false, - "inserter": false - }, - "textdomain": "default", - "attributes": { - "slug": { - "type": "string" - } - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/media-text", - "title": "Media & Text", - "category": "media", - "description": "Set media and words side-by-side for a richer layout.", - "keywords": [ "image", "video" ], - "textdomain": "default", - "attributes": { - "align": { - "type": "string", - "default": "wide" - }, - "mediaAlt": { - "type": "string", - "source": "attribute", - "selector": "figure img", - "attribute": "alt", - "default": "" - }, - "mediaPosition": { - "type": "string", - "default": "left" - }, - "mediaId": { - "type": "number" - }, - "mediaUrl": { - "type": "string", - "source": "attribute", - "selector": "figure video,figure img", - "attribute": "src" - }, - "mediaLink": { - "type": "string" - }, - "linkDestination": { - "type": "string" - }, - "linkTarget": { - "type": "string", - "source": "attribute", - "selector": "figure a", - "attribute": "target" - }, - "href": { - "type": "string", - "source": "attribute", - "selector": "figure a", - "attribute": "href" - }, - "rel": { - "type": "string", - "source": "attribute", - "selector": "figure a", - "attribute": "rel" - }, - "linkClass": { - "type": "string", - "source": "attribute", - "selector": "figure a", - "attribute": "class" - }, - "mediaType": { - "type": "string" - }, - "mediaWidth": { - "type": "number", - "default": 50 - }, - "mediaSizeSlug": { - "type": "string" - }, - "isStackedOnMobile": { - "type": "boolean", - "default": true - }, - "verticalAlignment": { - "type": "string" - }, - "imageFill": { - "type": "boolean" - }, - "focalPoint": { - "type": "object" - } - }, - "supports": { - "anchor": true, - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - } - }, - "editorStyle": "wp-block-media-text-editor", - "style": "wp-block-media-text" -} -.wp-block-media-text{direction:ltr;display:grid;grid-template-columns:50% 1fr;grid-template-rows:auto}.wp-block-media-text.has-media-on-the-right{grid-template-columns:1fr 50%}.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media{align-self:start}.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media,.wp-block-media-text .wp-block-media-text__content,.wp-block-media-text .wp-block-media-text__media{align-self:center}.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media{align-self:end}.wp-block-media-text .wp-block-media-text__media{grid-column:1;grid-row:1;margin:0}.wp-block-media-text .wp-block-media-text__content{direction:rtl;grid-column:2;grid-row:1;padding:0 8%;word-break:break-word}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media{grid-column:2;grid-row:1}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content{grid-column:1;grid-row:1}.wp-block-media-text__media img,.wp-block-media-text__media video{height:auto;max-width:unset;width:100%;vertical-align:middle}.wp-block-media-text.is-image-fill .wp-block-media-text__media{height:100%;min-height:250px;background-size:cover}.wp-block-media-text.is-image-fill .wp-block-media-text__media>a{display:block;height:100%}.wp-block-media-text.is-image-fill .wp-block-media-text__media img{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}@media (max-width:600px){.wp-block-media-text.is-stacked-on-mobile{grid-template-columns:100%!important}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media{grid-column:1;grid-row:1}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content{grid-column:1;grid-row:2}}.wp-block-media-text{ - /*!rtl:begin:ignore*/direction:ltr; - /*!rtl:end:ignore*/display:grid;grid-template-columns:50% 1fr;grid-template-rows:auto}.wp-block-media-text.has-media-on-the-right{grid-template-columns:1fr 50%}.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media{align-self:start}.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media,.wp-block-media-text .wp-block-media-text__content,.wp-block-media-text .wp-block-media-text__media{align-self:center}.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media{align-self:end}.wp-block-media-text .wp-block-media-text__media{ - /*!rtl:begin:ignore*/grid-column:1;grid-row:1; - /*!rtl:end:ignore*/margin:0}.wp-block-media-text .wp-block-media-text__content{direction:ltr; - /*!rtl:begin:ignore*/grid-column:2;grid-row:1; - /*!rtl:end:ignore*/padding:0 8%;word-break:break-word}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media{ - /*!rtl:begin:ignore*/grid-column:2;grid-row:1 - /*!rtl:end:ignore*/}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content{ - /*!rtl:begin:ignore*/grid-column:1;grid-row:1 - /*!rtl:end:ignore*/}.wp-block-media-text__media img,.wp-block-media-text__media video{height:auto;max-width:unset;width:100%;vertical-align:middle}.wp-block-media-text.is-image-fill .wp-block-media-text__media{height:100%;min-height:250px;background-size:cover}.wp-block-media-text.is-image-fill .wp-block-media-text__media>a{display:block;height:100%}.wp-block-media-text.is-image-fill .wp-block-media-text__media img{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}@media (max-width:600px){.wp-block-media-text.is-stacked-on-mobile{grid-template-columns:100%!important}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media{grid-column:1;grid-row:1}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content{grid-column:1;grid-row:2}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-media-text { - direction: ltr; - display: grid; - grid-template-columns: 50% 1fr; - grid-template-rows: auto; -} -.wp-block-media-text.has-media-on-the-right { - grid-template-columns: 1fr 50%; -} - -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media { - align-self: start; -} - -.wp-block-media-text .wp-block-media-text__content, -.wp-block-media-text .wp-block-media-text__media, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media { - align-self: center; -} - -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media { - align-self: end; -} - -.wp-block-media-text .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - margin: 0; -} - -.wp-block-media-text .wp-block-media-text__content { - direction: rtl; - grid-column: 2; - grid-row: 1; - padding: 0 8% 0 8%; - word-break: break-word; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media { - grid-column: 2; - grid-row: 1; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { - grid-column: 1; - grid-row: 1; -} - -.wp-block-media-text__media img, -.wp-block-media-text__media video { - height: auto; - max-width: unset; - width: 100%; - vertical-align: middle; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media { - height: 100%; - min-height: 250px; - background-size: cover; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media > a { - display: block; - height: 100%; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media img { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} - -/* -* Here we here not able to use a mobile first CSS approach. -* Custom widths are set using inline styles, and on mobile, -* we need 100% width, so we use important to overwrite the inline style. -* If the style were set on mobile first, on desktop styles, -* we would have no way of setting the style again to the inline style. -*/ -@media (max-width: 600px) { - .wp-block-media-text.is-stacked-on-mobile { - grid-template-columns: 100% !important; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content { - grid-column: 1; - grid-row: 2; - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-media-text__media { - position: relative; -} -.wp-block-media-text__media.is-transient img { - opacity: 0.3; -} -.wp-block-media-text__media .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -.wp-block-media-text .__resizable_base__ { - grid-column: 1/span 2; - grid-row: 2; -} - -.wp-block-media-text .editor-media-container__resizer { - width: 100% !important; -} - -.wp-block-media-text.is-image-fill .editor-media-container__resizer { - height: 100% !important; -} - -.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block { - max-width: unset; -}.wp-block-media-text__media{position:relative}.wp-block-media-text__media.is-transient img{opacity:.3}.wp-block-media-text__media .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.wp-block-media-text .__resizable_base__{grid-column:1/span 2;grid-row:2}.wp-block-media-text .editor-media-container__resizer{width:100%!important}.wp-block-media-text.is-image-fill .editor-media-container__resizer{height:100%!important}.wp-block-media-text>.block-editor-block-list__layout>.block-editor-block-list__block{max-width:unset}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-media-text__media { - position: relative; -} -.wp-block-media-text__media.is-transient img { - opacity: 0.3; -} -.wp-block-media-text__media .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -.wp-block-media-text .__resizable_base__ { - grid-column: 1/span 2; - grid-row: 2; -} - -.wp-block-media-text .editor-media-container__resizer { - width: 100% !important; -} - -.wp-block-media-text.is-image-fill .editor-media-container__resizer { - height: 100% !important; -} - -.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block { - max-width: unset; -}.wp-block-media-text__media{position:relative}.wp-block-media-text__media.is-transient img{opacity:.3}.wp-block-media-text__media .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-media-text .__resizable_base__{grid-column:1/span 2;grid-row:2}.wp-block-media-text .editor-media-container__resizer{width:100%!important}.wp-block-media-text.is-image-fill .editor-media-container__resizer{height:100%!important}.wp-block-media-text>.block-editor-block-list__layout>.block-editor-block-list__block{max-width:unset}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-media-text { - /*!rtl:begin:ignore*/ - direction: ltr; - /*!rtl:end:ignore*/ - display: grid; - grid-template-columns: 50% 1fr; - grid-template-rows: auto; -} -.wp-block-media-text.has-media-on-the-right { - grid-template-columns: 1fr 50%; -} - -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media { - align-self: start; -} - -.wp-block-media-text .wp-block-media-text__content, -.wp-block-media-text .wp-block-media-text__media, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media { - align-self: center; -} - -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media { - align-self: end; -} - -.wp-block-media-text .wp-block-media-text__media { - /*!rtl:begin:ignore*/ - grid-column: 1; - grid-row: 1; - /*!rtl:end:ignore*/ - margin: 0; -} - -.wp-block-media-text .wp-block-media-text__content { - direction: ltr; - /*!rtl:begin:ignore*/ - grid-column: 2; - grid-row: 1; - /*!rtl:end:ignore*/ - padding: 0 8% 0 8%; - word-break: break-word; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media { - /*!rtl:begin:ignore*/ - grid-column: 2; - grid-row: 1; - /*!rtl:end:ignore*/ -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { - /*!rtl:begin:ignore*/ - grid-column: 1; - grid-row: 1; - /*!rtl:end:ignore*/ -} - -.wp-block-media-text__media img, -.wp-block-media-text__media video { - height: auto; - max-width: unset; - width: 100%; - vertical-align: middle; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media { - height: 100%; - min-height: 250px; - background-size: cover; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media > a { - display: block; - height: 100%; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media img { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} - -/* -* Here we here not able to use a mobile first CSS approach. -* Custom widths are set using inline styles, and on mobile, -* we need 100% width, so we use important to overwrite the inline style. -* If the style were set on mobile first, on desktop styles, -* we would have no way of setting the style again to the inline style. -*/ -@media (max-width: 600px) { - .wp-block-media-text.is-stacked-on-mobile { - grid-template-columns: 100% !important; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content { - grid-column: 1; - grid-row: 2; - } -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-content", - "title": "Post Content", - "category": "theme", - "description": "Displays the contents of a post or page.", - "textdomain": "default", - "usesContext": [ "postId", "postType", "queryId" ], - "supports": { - "align": [ "wide", "full" ], - "html": false, - "__experimentalLayout": true - }, - "editorStyle": "wp-block-post-content-editor" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-title", - "title": "Post Title", - "category": "theme", - "description": "Displays the title of a post, page, or any other content-type.", - "textdomain": "default", - "usesContext": [ "postId", "postType", "queryId" ], - "attributes": { - "textAlign": { - "type": "string" - }, - "level": { - "type": "number", - "default": 2 - }, - "isLink": { - "type": "boolean", - "default": false - }, - "rel": { - "type": "string", - "attribute": "rel", - "default": "" - }, - "linkTarget": { - "type": "string", - "default": "_self" - } - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "spacing": { - "margin": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true, - "fontAppearance": true, - "textTransform": true - } - } - }, - "style": "wp-block-post-title" -} -.wp-block-post-title{word-break:break-word}.wp-block-post-title a{display:inline-block}.wp-block-post-title{word-break:break-word}.wp-block-post-title a{display:inline-block}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-title { - word-break: break-word; -} -.wp-block-post-title a { - display: inline-block; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-title { - word-break: break-word; -} -.wp-block-post-title a { - display: inline-block; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/query", - "title": "Query Loop", - "category": "theme", - "description": "An advanced block that allows displaying post types based on different query parameters and visual configurations.", - "textdomain": "default", - "attributes": { - "queryId": { - "type": "number" - }, - "query": { - "type": "object", - "default": { - "perPage": null, - "pages": 0, - "offset": 0, - "postType": "post", - "order": "desc", - "orderBy": "date", - "author": "", - "search": "", - "exclude": [], - "sticky": "", - "inherit": true, - "taxQuery": null - } - }, - "tagName": { - "type": "string", - "default": "div" - }, - "displayLayout": { - "type": "object", - "default": { - "type": "list" - } - } - }, - "providesContext": { - "queryId": "queryId", - "query": "query", - "displayLayout": "displayLayout" - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "__experimentalLayout": true - }, - "editorStyle": "wp-block-query-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-query-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block-query__create-new-link { - padding: 0 16px 16px 56px; -} - -.block-library-query__pattern-selection-content .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - grid-gap: 8px; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - max-height: 250px; -} - -.block-editor-query-pattern__selection-modal .components-modal__content { - overflow: hidden; - padding: 0; -} -.block-editor-query-pattern__selection-modal .components-modal__content::before { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-query-pattern__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-query-pattern__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-query-pattern__selection-modal { - height: 80%; - width: 80%; - max-height: none; - } -}.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 16px 16px 56px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-editor-query-pattern__selection-modal .components-modal__content{overflow:hidden;padding:0}.block-editor-query-pattern__selection-modal .components-modal__content:before{margin-bottom:0}@media (min-width:600px){.block-editor-query-pattern__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-query-pattern__selection-modal{width:750px}}@media (min-width:960px){.block-editor-query-pattern__selection-modal{height:80%;width:80%;max-height:none}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.block-library-query-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block-query__create-new-link { - padding: 0 56px 16px 16px; -} - -.block-library-query__pattern-selection-content .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - grid-gap: 8px; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - max-height: 250px; -} - -.block-editor-query-pattern__selection-modal .components-modal__content { - overflow: hidden; - padding: 0; -} -.block-editor-query-pattern__selection-modal .components-modal__content::before { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-query-pattern__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-query-pattern__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-query-pattern__selection-modal { - height: 80%; - width: 80%; - max-height: none; - } -}.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 56px 16px 16px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-editor-query-pattern__selection-modal .components-modal__content{overflow:hidden;padding:0}.block-editor-query-pattern__selection-modal .components-modal__content:before{margin-bottom:0}@media (min-width:600px){.block-editor-query-pattern__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-query-pattern__selection-modal{width:750px}}@media (min-width:960px){.block-editor-query-pattern__selection-modal{height:80%;width:80%;max-height:none}}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/site-title", - "title": "Site Title", - "category": "theme", - "description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.", - "textdomain": "default", - "attributes": { - "level": { - "type": "number", - "default": 1 - }, - "textAlign": { - "type": "string" - }, - "isLink": { - "type": "boolean", - "default": true - }, - "linkTarget": { - "type": "string", - "default": "_self" - } - }, - "example": { - "viewportWidth": 500 - }, - "supports": { - "align": [ "wide", "full" ], - "html": false, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true, - "link": true - } - }, - "spacing": { - "padding": true, - "margin": true - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalTextTransform": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalDefaultControls": { - "fontSize": true, - "lineHeight": true, - "fontAppearance": true, - "letterSpacing": true, - "textTransform": true - } - } - }, - "editorStyle": "wp-block-site-title-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-title__placeholder { - padding: 1em 0; - border: 1px dashed; -}.wp-block-site-title__placeholder{padding:1em 0;border:1px dashed}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-site-title__placeholder { - padding: 1em 0; - border: 1px dashed; -}.wp-block-site-title__placeholder{padding:1em 0;border:1px dashed}{ - "apiVersion": 2, - "name": "core/widget-group", - "category": "widgets", - "attributes": { - "title": { - "type": "string" - } - }, - "supports": { - "html": false, - "inserter": true, - "customClassName": true, - "reusable": false - }, - "editorStyle": "wp-block-widget-group-editor", - "style": "wp-block-widget-group" -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comment-reply-link", - "title": "Comment Reply Link", - "category": "theme", - "ancestor": [ "core/comment-template" ], - "description": "Displays a link to reply to a comment.", - "textdomain": "default", - "usesContext": [ "commentId" ], - "attributes": { - "textAlign": { - "type": "string" - } - }, - "supports": { - "color": { - "gradients": true, - "link": true, - "text": false, - "__experimentalDefaultControls": { - "background": true, - "link": true - } - }, - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontFamily": true, - "__experimentalFontWeight": true, - "__experimentalFontStyle": true, - "__experimentalTextTransform": true, - "__experimentalLetterSpacing": true - }, - "html": false - } -} -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/navigation-submenu", - "title": "Submenu", - "category": "design", - "parent": [ "core/navigation" ], - "description": "Add a submenu to your navigation.", - "textdomain": "default", - "attributes": { - "label": { - "type": "string" - }, - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "rel": { - "type": "string" - }, - "id": { - "type": "number" - }, - "opensInNewTab": { - "type": "boolean", - "default": false - }, - "url": { - "type": "string" - }, - "title": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "isTopLevelItem": { - "type": "boolean" - } - }, - "usesContext": [ - "textColor", - "customTextColor", - "backgroundColor", - "customBackgroundColor", - "overlayTextColor", - "customOverlayTextColor", - "overlayBackgroundColor", - "customOverlayBackgroundColor", - "fontSize", - "customFontSize", - "showSubmenuIcon", - "maxNestingLevel", - "openSubmenusOnClick", - "style" - ], - "supports": { - "reusable": false, - "html": false - }, - "editorStyle": "wp-block-navigation-submenu-editor", - "style": "wp-block-navigation-submenu" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation-submenu { - display: block; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - position: absolute; - left: -1px; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: 100%; - top: -1px; - } - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - right: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } -}.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;position:absolute;left:-1px;top:100%}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{content:"";position:absolute;right:100%;height:100%;display:block;width:.5em;background:transparent}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-navigation-submenu { - display: block; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - position: absolute; - right: -1px; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: 100%; - top: -1px; - } - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - left: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } -}.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;position:absolute;right:-1px;top:100%}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{content:"";position:absolute;left:100%;height:100%;display:block;width:.5em;background:transparent}}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/comments-pagination-numbers", - "title": "Page Numbers", - "category": "theme", - "parent": [ "core/comments-pagination" ], - "description": "Displays a list of page numbers for comments pagination.", - "textdomain": "default", - "usesContext": [ "postId" ], - "supports": { - "reusable": false, - "html": false - } -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-pagination-numbers a { - text-decoration: underline; -} -.wp-block-comments-pagination-numbers .page-numbers { - margin-right: 2px; -} -.wp-block-comments-pagination-numbers .page-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -}.wp-block-comments-pagination-numbers a{text-decoration:underline}.wp-block-comments-pagination-numbers .page-numbers{margin-right:2px}.wp-block-comments-pagination-numbers .page-numbers:last-child{margin-right:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-comments-pagination-numbers a { - text-decoration: underline; -} -.wp-block-comments-pagination-numbers .page-numbers { - margin-left: 2px; -} -.wp-block-comments-pagination-numbers .page-numbers:last-child { - margin-right: 0; -}.wp-block-comments-pagination-numbers a{text-decoration:underline}.wp-block-comments-pagination-numbers .page-numbers{margin-left:2px}.wp-block-comments-pagination-numbers .page-numbers:last-child{margin-right:0}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/categories", - "title": "Categories", - "category": "widgets", - "description": "Display a list of all categories.", - "textdomain": "default", - "attributes": { - "displayAsDropdown": { - "type": "boolean", - "default": false - }, - "showHierarchy": { - "type": "boolean", - "default": false - }, - "showPostCounts": { - "type": "boolean", - "default": false - }, - "showOnlyTopLevel": { - "type": "boolean", - "default": false - } - }, - "supports": { - "align": true, - "html": false - }, - "editorStyle": "wp-block-categories-editor", - "style": "wp-block-categories" -} -.wp-block-categories.alignleft{margin-right:2em}.wp-block-categories.alignright{margin-left:2em}.wp-block-categories.alignleft{margin-right:2em}.wp-block-categories.alignright{margin-left:2em}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-categories.alignleft { - margin-right: 2em; -} -.wp-block-categories.alignright { - margin-left: 2em; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-categories ul { - padding-left: 2.5em; -} -.wp-block-categories ul ul { - margin-top: 6px; -}.wp-block-categories ul{padding-left:2.5em}.wp-block-categories ul ul{margin-top:6px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-categories ul { - padding-right: 2.5em; -} -.wp-block-categories ul ul { - margin-top: 6px; -}.wp-block-categories ul{padding-right:2.5em}.wp-block-categories ul ul{margin-top:6px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-categories.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -.wp-block-categories.alignright { - /*rtl:ignore*/ - margin-left: 2em; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/post-comments", - "title": "Post Comments (deprecated)", - "category": "theme", - "description": "This block is deprecated. Please use the Comments Query Loop block instead.", - "textdomain": "default", - "attributes": { - "textAlign": { - "type": "string" - } - }, - "usesContext": [ "postId", "postType" ], - "supports": { - "html": false, - "align": [ "wide", "full" ], - "typography": { - "fontSize": true, - "lineHeight": true, - "__experimentalFontStyle": true, - "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, - "__experimentalTextTransform": true, - "__experimentalDefaultControls": { - "fontSize": true - } - }, - "color": { - "gradients": true, - "link": true, - "__experimentalDefaultControls": { - "background": true, - "text": true - } - }, - "inserter": false - }, - "style": [ - "wp-block-post-comments", - "wp-block-buttons", - "wp-block-button" - ], - "editorStyle": "wp-block-post-comments-editor" -} -.wp-block-post-comments .alignleft{float:right}.wp-block-post-comments .alignright{float:left}.wp-block-post-comments .navigation:after{content:"";display:table;clear:both}.wp-block-post-comments .commentlist{clear:both;list-style:none;margin:0;padding:0}.wp-block-post-comments .commentlist .comment{min-height:2.25em;padding-right:3.25em}.wp-block-post-comments .commentlist .comment p{font-size:1em;line-height:1.8;margin:1em 0}.wp-block-post-comments .commentlist .children{list-style:none;margin:0;padding:0}.wp-block-post-comments .comment-author{line-height:1.5}.wp-block-post-comments .comment-author .avatar{border-radius:1.5em;display:block;float:right;height:2.5em;margin-top:.5em;margin-left:.75em;width:2.5em}.wp-block-post-comments .comment-author cite{font-style:normal}.wp-block-post-comments .comment-meta{font-size:.875em;line-height:1.5}.wp-block-post-comments .comment-meta b{font-weight:400}.wp-block-post-comments .comment-meta .comment-awaiting-moderation{margin-top:1em;margin-bottom:1em;display:block}.wp-block-post-comments .comment-body .commentmetadata{font-size:.875em}.wp-block-post-comments .comment-form-author label,.wp-block-post-comments .comment-form-comment label,.wp-block-post-comments .comment-form-email label,.wp-block-post-comments .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments .comment-reply-title{margin-bottom:0}.wp-block-post-comments .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-right:.5em}.wp-block-post-comments .reply{font-size:.875em;margin-bottom:1.4em}.wp-block-post-comments input:not([type=submit]),.wp-block-post-comments textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments textarea{padding:calc(.667em + 2px)}.wp-block-post-comments input[type=submit]{border:none}.wp-block-post-comments .alignleft{float:left}.wp-block-post-comments .alignright{float:right}.wp-block-post-comments .navigation:after{content:"";display:table;clear:both}.wp-block-post-comments .commentlist{clear:both;list-style:none;margin:0;padding:0}.wp-block-post-comments .commentlist .comment{min-height:2.25em;padding-left:3.25em}.wp-block-post-comments .commentlist .comment p{font-size:1em;line-height:1.8;margin:1em 0}.wp-block-post-comments .commentlist .children{list-style:none;margin:0;padding:0}.wp-block-post-comments .comment-author{line-height:1.5}.wp-block-post-comments .comment-author .avatar{border-radius:1.5em;display:block;float:left;height:2.5em;margin-top:.5em;margin-right:.75em;width:2.5em}.wp-block-post-comments .comment-author cite{font-style:normal}.wp-block-post-comments .comment-meta{font-size:.875em;line-height:1.5}.wp-block-post-comments .comment-meta b{font-weight:400}.wp-block-post-comments .comment-meta .comment-awaiting-moderation{margin-top:1em;margin-bottom:1em;display:block}.wp-block-post-comments .comment-body .commentmetadata{font-size:.875em}.wp-block-post-comments .comment-form-author label,.wp-block-post-comments .comment-form-comment label,.wp-block-post-comments .comment-form-email label,.wp-block-post-comments .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments .comment-reply-title{margin-bottom:0}.wp-block-post-comments .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-left:.5em}.wp-block-post-comments .reply{font-size:.875em;margin-bottom:1.4em}.wp-block-post-comments input:not([type=submit]),.wp-block-post-comments textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments textarea{padding:calc(.667em + 2px)}.wp-block-post-comments input[type=submit]{border:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments { - /* utility classes */ - /* end utility classes */ -} -.wp-block-post-comments .alignleft { - float: right; -} -.wp-block-post-comments .alignright { - float: left; -} -.wp-block-post-comments .navigation::after { - content: ""; - display: table; - clear: both; -} -.wp-block-post-comments .commentlist { - clear: both; - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .commentlist .comment { - min-height: 2.25em; - padding-right: 3.25em; -} -.wp-block-post-comments .commentlist .comment p { - font-size: 1em; - line-height: 1.8; - margin: 1em 0; -} -.wp-block-post-comments .commentlist .children { - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .comment-author { - line-height: 1.5; -} -.wp-block-post-comments .comment-author .avatar { - border-radius: 1.5em; - display: block; - float: right; - height: 2.5em; - margin-top: 0.5em; - margin-left: 0.75em; - width: 2.5em; -} -.wp-block-post-comments .comment-author cite { - font-style: normal; -} -.wp-block-post-comments .comment-meta { - font-size: 0.875em; - line-height: 1.5; -} -.wp-block-post-comments .comment-meta b { - font-weight: normal; -} -.wp-block-post-comments .comment-meta .comment-awaiting-moderation { - margin-top: 1em; - margin-bottom: 1em; - display: block; -} -.wp-block-post-comments .comment-body .commentmetadata { - font-size: 0.875em; -} -.wp-block-post-comments .comment-form-comment label, -.wp-block-post-comments .comment-form-author label, -.wp-block-post-comments .comment-form-email label, -.wp-block-post-comments .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments .comment-form textarea, -.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-right: 0.5em; -} -.wp-block-post-comments .reply { - font-size: 0.875em; - margin-bottom: 1.4em; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments input[type=submit] { - border: none; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments__placeholder * { - pointer-events: none; -}.wp-block-post-comments__placeholder *{pointer-events:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments__placeholder * { - pointer-events: none; -}.wp-block-post-comments__placeholder *{pointer-events:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-post-comments { - /* utility classes */ - /* end utility classes */ -} -.wp-block-post-comments .alignleft { - float: left; -} -.wp-block-post-comments .alignright { - float: right; -} -.wp-block-post-comments .navigation::after { - content: ""; - display: table; - clear: both; -} -.wp-block-post-comments .commentlist { - clear: both; - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .commentlist .comment { - min-height: 2.25em; - padding-left: 3.25em; -} -.wp-block-post-comments .commentlist .comment p { - font-size: 1em; - line-height: 1.8; - margin: 1em 0; -} -.wp-block-post-comments .commentlist .children { - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .comment-author { - line-height: 1.5; -} -.wp-block-post-comments .comment-author .avatar { - border-radius: 1.5em; - display: block; - float: left; - height: 2.5em; - margin-top: 0.5em; - margin-right: 0.75em; - width: 2.5em; -} -.wp-block-post-comments .comment-author cite { - font-style: normal; -} -.wp-block-post-comments .comment-meta { - font-size: 0.875em; - line-height: 1.5; -} -.wp-block-post-comments .comment-meta b { - font-weight: normal; -} -.wp-block-post-comments .comment-meta .comment-awaiting-moderation { - margin-top: 1em; - margin-bottom: 1em; - display: block; -} -.wp-block-post-comments .comment-body .commentmetadata { - font-size: 0.875em; -} -.wp-block-post-comments .comment-form-comment label, -.wp-block-post-comments .comment-form-author label, -.wp-block-post-comments .comment-form-email label, -.wp-block-post-comments .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments .comment-form textarea, -.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-left: 0.5em; -} -.wp-block-post-comments .reply { - font-size: 0.875em; - margin-bottom: 1.4em; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments input[type=submit] { - border: none; -}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/block", - "title": "Reusable block", - "category": "reusable", - "description": "Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used.", - "textdomain": "default", - "attributes": { - "ref": { - "type": "number" - } - }, - "supports": { - "customClassName": false, - "html": false, - "inserter": false - }, - "editorStyle": "wp-block-editor" -} -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container { - padding-left: 0; - padding-right: 0; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow { - display: block; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender { - display: none; -}.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container{padding-left:0;padding-right:0}.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow{display:block}.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender{display:none}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container { - padding-right: 0; - padding-left: 0; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow { - display: block; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender { - display: none; -}.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container{padding-right:0;padding-left:0}.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow{display:block}.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender{display:none}{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "core/cover", - "title": "Cover", - "category": "media", - "description": "Add an image or video with a text overlay — great for headers.", - "textdomain": "default", - "attributes": { - "url": { - "type": "string" - }, - "useFeaturedImage": { - "type": "boolean", - "default": false - }, - "id": { - "type": "number" - }, - "alt": { - "type": "string", - "source": "attribute", - "selector": "img", - "attribute": "alt", - "default": "" - }, - "hasParallax": { - "type": "boolean", - "default": false - }, - "isRepeated": { - "type": "boolean", - "default": false - }, - "dimRatio": { - "type": "number", - "default": 100 - }, - "overlayColor": { - "type": "string" - }, - "customOverlayColor": { - "type": "string" - }, - "backgroundType": { - "type": "string", - "default": "image" - }, - "focalPoint": { - "type": "object" - }, - "minHeight": { - "type": "number" - }, - "minHeightUnit": { - "type": "string" - }, - "gradient": { - "type": "string" - }, - "customGradient": { - "type": "string" - }, - "contentPosition": { - "type": "string" - }, - "isDark": { - "type": "boolean", - "default": true - }, - "allowedBlocks": { - "type": "array" - }, - "templateLock": { - "type": [ "string", "boolean" ], - "enum": [ "all", "insert", false ] - } - }, - "usesContext": [ "postId", "postType" ], - "supports": { - "anchor": true, - "align": true, - "html": false, - "spacing": { - "padding": true, - "__experimentalDefaultControls": { - "padding": true - } - }, - "color": { - "__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background", - "text": false, - "background": false - } - }, - "editorStyle": "wp-block-cover-editor", - "style": "wp-block-cover" -} -.wp-block-cover,.wp-block-cover-image{position:relative;background-size:cover;background-position:50%;min-height:430px;width:100%;display:flex;justify-content:center;align-items:center;padding:1em;box-sizing:border-box}.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:fixed}@supports (-webkit-touch-callout:inherit){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}@media (prefers-reduced-motion:reduce){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}.wp-block-cover-image.is-repeated,.wp-block-cover.is-repeated{background-repeat:repeat;background-size:auto}.wp-block-cover-image.has-background-dim:not([class*=-background-color]),.wp-block-cover-image .has-background-dim:not([class*=-background-color]),.wp-block-cover.has-background-dim:not([class*=-background-color]),.wp-block-cover .has-background-dim:not([class*=-background-color]){background-color:#000}.wp-block-cover-image .has-background-dim.has-background-gradient,.wp-block-cover .has-background-dim.has-background-gradient{background-color:transparent}.wp-block-cover-image.has-background-dim:before,.wp-block-cover.has-background-dim:before{content:"";background-color:inherit}.wp-block-cover-image.has-background-dim:not(.has-background-gradient):before,.wp-block-cover-image .wp-block-cover__background,.wp-block-cover-image .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim:not(.has-background-gradient):before,.wp-block-cover .wp-block-cover__background,.wp-block-cover .wp-block-cover__gradient-background{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient):before{opacity:.1}.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient):before{opacity:.2}.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient):before{opacity:.3}.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient):before{opacity:.4}.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient):before{opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient):before{opacity:.6}.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient):before{opacity:.7}.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient):before{opacity:.8}.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient):before{opacity:.9}.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient):before{opacity:1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0{opacity:0}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10{opacity:.1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20{opacity:.2}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30{opacity:.3}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40{opacity:.4}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50{opacity:.5}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60{opacity:.6}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70{opacity:.7}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80{opacity:.8}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90{opacity:.9}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100{opacity:1}.wp-block-cover-image .block-library-cover__padding-visualizer,.wp-block-cover .block-library-cover__padding-visualizer{z-index:2}.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.alignleft,.wp-block-cover.alignright{max-width:420px;width:100%}.wp-block-cover-image:after,.wp-block-cover:after{display:block;content:"";font-size:0;min-height:inherit}@supports (position:sticky){.wp-block-cover-image:after,.wp-block-cover:after{content:none}}.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{display:flex}.wp-block-cover-image .wp-block-cover__inner-container,.wp-block-cover .wp-block-cover__inner-container{width:100%;z-index:1;color:#fff}.wp-block-cover-image.is-light .wp-block-cover__inner-container,.wp-block-cover.is-light .wp-block-cover__inner-container{color:#000}.wp-block-cover-image h1:not(.has-text-color),.wp-block-cover-image h2:not(.has-text-color),.wp-block-cover-image h3:not(.has-text-color),.wp-block-cover-image h4:not(.has-text-color),.wp-block-cover-image h5:not(.has-text-color),.wp-block-cover-image h6:not(.has-text-color),.wp-block-cover-image p:not(.has-text-color),.wp-block-cover h1:not(.has-text-color),.wp-block-cover h2:not(.has-text-color),.wp-block-cover h3:not(.has-text-color),.wp-block-cover h4:not(.has-text-color),.wp-block-cover h5:not(.has-text-color),.wp-block-cover h6:not(.has-text-color),.wp-block-cover p:not(.has-text-color){color:inherit}.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{align-items:flex-start;justify-content:flex-start}.wp-block-cover-image.is-position-top-center,.wp-block-cover.is-position-top-center{align-items:flex-start;justify-content:center}.wp-block-cover-image.is-position-top-right,.wp-block-cover.is-position-top-right{align-items:flex-start;justify-content:flex-end}.wp-block-cover-image.is-position-center-left,.wp-block-cover.is-position-center-left{align-items:center;justify-content:flex-start}.wp-block-cover-image.is-position-center-center,.wp-block-cover.is-position-center-center{align-items:center;justify-content:center}.wp-block-cover-image.is-position-center-right,.wp-block-cover.is-position-center-right{align-items:center;justify-content:flex-end}.wp-block-cover-image.is-position-bottom-left,.wp-block-cover.is-position-bottom-left{align-items:flex-end;justify-content:flex-start}.wp-block-cover-image.is-position-bottom-center,.wp-block-cover.is-position-bottom-center{align-items:flex-end;justify-content:center}.wp-block-cover-image.is-position-bottom-right,.wp-block-cover.is-position-bottom-right{align-items:flex-end;justify-content:flex-end}.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{margin:0;width:auto}.wp-block-cover-image img.wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background,.wp-block-cover img.wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background{position:absolute;top:0;right:0;left:0;bottom:0;margin:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;-o-object-fit:cover;object-fit:cover;outline:none;border:none;box-shadow:none}.wp-block-cover__image-background,.wp-block-cover__video-background{z-index:0}.wp-block-cover-image-text,.wp-block-cover-image-text a,.wp-block-cover-image-text a:active,.wp-block-cover-image-text a:focus,.wp-block-cover-image-text a:hover,.wp-block-cover-text,.wp-block-cover-text a,.wp-block-cover-text a:active,.wp-block-cover-text a:focus,.wp-block-cover-text a:hover,section.wp-block-cover-image h2,section.wp-block-cover-image h2 a,section.wp-block-cover-image h2 a:active,section.wp-block-cover-image h2 a:focus,section.wp-block-cover-image h2 a:hover{color:#fff}.wp-block-cover-image .wp-block-cover.has-left-content{justify-content:flex-start}.wp-block-cover-image .wp-block-cover.has-right-content{justify-content:flex-end}.wp-block-cover-image.has-left-content .wp-block-cover-image-text,.wp-block-cover.has-left-content .wp-block-cover-text,section.wp-block-cover-image.has-left-content>h2{margin-right:0;text-align:right}.wp-block-cover-image.has-right-content .wp-block-cover-image-text,.wp-block-cover.has-right-content .wp-block-cover-text,section.wp-block-cover-image.has-right-content>h2{margin-left:0;text-align:left}.wp-block-cover-image .wp-block-cover-image-text,.wp-block-cover .wp-block-cover-text,section.wp-block-cover-image>h2{font-size:2em;line-height:1.25;z-index:1;margin-bottom:0;max-width:840px;padding:.44em;text-align:center}.wp-block-cover,.wp-block-cover-image{position:relative;background-size:cover;background-position:50%;min-height:430px;width:100%;display:flex;justify-content:center;align-items:center;padding:1em;box-sizing:border-box}.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:fixed}@supports (-webkit-touch-callout:inherit){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}@media (prefers-reduced-motion:reduce){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}.wp-block-cover-image.is-repeated,.wp-block-cover.is-repeated{background-repeat:repeat;background-size:auto}.wp-block-cover-image.has-background-dim:not([class*=-background-color]),.wp-block-cover-image .has-background-dim:not([class*=-background-color]),.wp-block-cover.has-background-dim:not([class*=-background-color]),.wp-block-cover .has-background-dim:not([class*=-background-color]){background-color:#000}.wp-block-cover-image .has-background-dim.has-background-gradient,.wp-block-cover .has-background-dim.has-background-gradient{background-color:transparent}.wp-block-cover-image.has-background-dim:before,.wp-block-cover.has-background-dim:before{content:"";background-color:inherit}.wp-block-cover-image.has-background-dim:not(.has-background-gradient):before,.wp-block-cover-image .wp-block-cover__background,.wp-block-cover-image .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim:not(.has-background-gradient):before,.wp-block-cover .wp-block-cover__background,.wp-block-cover .wp-block-cover__gradient-background{position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient):before{opacity:.1}.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient):before{opacity:.2}.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient):before{opacity:.3}.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient):before{opacity:.4}.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient):before{opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient):before{opacity:.6}.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient):before{opacity:.7}.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient):before{opacity:.8}.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient):before{opacity:.9}.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient):before{opacity:1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0{opacity:0}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10{opacity:.1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20{opacity:.2}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30{opacity:.3}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40{opacity:.4}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50{opacity:.5}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60{opacity:.6}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70{opacity:.7}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80{opacity:.8}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90{opacity:.9}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100{opacity:1}.wp-block-cover-image .block-library-cover__padding-visualizer,.wp-block-cover .block-library-cover__padding-visualizer{z-index:2}.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.alignleft,.wp-block-cover.alignright{max-width:420px;width:100%}.wp-block-cover-image:after,.wp-block-cover:after{display:block;content:"";font-size:0;min-height:inherit}@supports (position:sticky){.wp-block-cover-image:after,.wp-block-cover:after{content:none}}.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{display:flex}.wp-block-cover-image .wp-block-cover__inner-container,.wp-block-cover .wp-block-cover__inner-container{width:100%;z-index:1;color:#fff}.wp-block-cover-image.is-light .wp-block-cover__inner-container,.wp-block-cover.is-light .wp-block-cover__inner-container{color:#000}.wp-block-cover-image h1:not(.has-text-color),.wp-block-cover-image h2:not(.has-text-color),.wp-block-cover-image h3:not(.has-text-color),.wp-block-cover-image h4:not(.has-text-color),.wp-block-cover-image h5:not(.has-text-color),.wp-block-cover-image h6:not(.has-text-color),.wp-block-cover-image p:not(.has-text-color),.wp-block-cover h1:not(.has-text-color),.wp-block-cover h2:not(.has-text-color),.wp-block-cover h3:not(.has-text-color),.wp-block-cover h4:not(.has-text-color),.wp-block-cover h5:not(.has-text-color),.wp-block-cover h6:not(.has-text-color),.wp-block-cover p:not(.has-text-color){color:inherit}.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{align-items:flex-start;justify-content:flex-start}.wp-block-cover-image.is-position-top-center,.wp-block-cover.is-position-top-center{align-items:flex-start;justify-content:center}.wp-block-cover-image.is-position-top-right,.wp-block-cover.is-position-top-right{align-items:flex-start;justify-content:flex-end}.wp-block-cover-image.is-position-center-left,.wp-block-cover.is-position-center-left{align-items:center;justify-content:flex-start}.wp-block-cover-image.is-position-center-center,.wp-block-cover.is-position-center-center{align-items:center;justify-content:center}.wp-block-cover-image.is-position-center-right,.wp-block-cover.is-position-center-right{align-items:center;justify-content:flex-end}.wp-block-cover-image.is-position-bottom-left,.wp-block-cover.is-position-bottom-left{align-items:flex-end;justify-content:flex-start}.wp-block-cover-image.is-position-bottom-center,.wp-block-cover.is-position-bottom-center{align-items:flex-end;justify-content:center}.wp-block-cover-image.is-position-bottom-right,.wp-block-cover.is-position-bottom-right{align-items:flex-end;justify-content:flex-end}.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{margin:0;width:auto}.wp-block-cover-image img.wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background,.wp-block-cover img.wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background{position:absolute;top:0;left:0;right:0;bottom:0;margin:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;-o-object-fit:cover;object-fit:cover;outline:none;border:none;box-shadow:none}.wp-block-cover__image-background,.wp-block-cover__video-background{z-index:0}.wp-block-cover-image-text,.wp-block-cover-image-text a,.wp-block-cover-image-text a:active,.wp-block-cover-image-text a:focus,.wp-block-cover-image-text a:hover,.wp-block-cover-text,.wp-block-cover-text a,.wp-block-cover-text a:active,.wp-block-cover-text a:focus,.wp-block-cover-text a:hover,section.wp-block-cover-image h2,section.wp-block-cover-image h2 a,section.wp-block-cover-image h2 a:active,section.wp-block-cover-image h2 a:focus,section.wp-block-cover-image h2 a:hover{color:#fff}.wp-block-cover-image .wp-block-cover.has-left-content{justify-content:flex-start}.wp-block-cover-image .wp-block-cover.has-right-content{justify-content:flex-end}.wp-block-cover-image.has-left-content .wp-block-cover-image-text,.wp-block-cover.has-left-content .wp-block-cover-text,section.wp-block-cover-image.has-left-content>h2{margin-left:0;text-align:left}.wp-block-cover-image.has-right-content .wp-block-cover-image-text,.wp-block-cover.has-right-content .wp-block-cover-text,section.wp-block-cover-image.has-right-content>h2{margin-right:0;text-align:right}.wp-block-cover-image .wp-block-cover-image-text,.wp-block-cover .wp-block-cover-text,section.wp-block-cover-image>h2{font-size:2em;line-height:1.25;z-index:1;margin-bottom:0;max-width:840px;padding:.44em;text-align:center}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-cover-image, -.wp-block-cover { - position: relative; - background-size: cover; - background-position: center center; - min-height: 430px; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - padding: 1em; - box-sizing: border-box; - /** - * Set a default background color for has-background-dim _unless_ it includes another - * background-color class (e.g. has-green-background-color). The presence of another - * background-color class implies that another style will provide the background color - * for the overlay. - * - * See: - * - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545 - * - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545 - */ -} -.wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: fixed; -} -@supports (-webkit-touch-callout: inherit) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -@media (prefers-reduced-motion: reduce) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -.wp-block-cover-image.is-repeated, -.wp-block-cover.is-repeated { - background-repeat: repeat; - background-size: auto; -} -.wp-block-cover-image.has-background-dim:not([class*=-background-color]), -.wp-block-cover-image .has-background-dim:not([class*=-background-color]), -.wp-block-cover.has-background-dim:not([class*=-background-color]), -.wp-block-cover .has-background-dim:not([class*=-background-color]) { - background-color: #000; -} -.wp-block-cover-image .has-background-dim.has-background-gradient, -.wp-block-cover .has-background-dim.has-background-gradient { - background-color: transparent; -} -.wp-block-cover-image.has-background-dim::before, -.wp-block-cover.has-background-dim::before { - content: ""; - background-color: inherit; -} -.wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover-image .wp-block-cover__background, -.wp-block-cover-image .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover .wp-block-cover__background, -.wp-block-cover .wp-block-cover__gradient-background { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1; - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background { - opacity: 0.1; -} -.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background { - opacity: 0.2; -} -.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background { - opacity: 0.3; -} -.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background { - opacity: 0.4; -} -.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background { - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background { - opacity: 0.6; -} -.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background { - opacity: 0.7; -} -.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background { - opacity: 0.8; -} -.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background { - opacity: 0.9; -} -.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background { - opacity: 1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0 { - opacity: 0; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10 { - opacity: 0.1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20 { - opacity: 0.2; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30 { - opacity: 0.3; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40 { - opacity: 0.4; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50 { - opacity: 0.5; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60 { - opacity: 0.6; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70 { - opacity: 0.7; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80 { - opacity: 0.8; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90 { - opacity: 0.9; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100 { - opacity: 1; -} -.wp-block-cover-image .block-library-cover__padding-visualizer, -.wp-block-cover .block-library-cover__padding-visualizer { - z-index: 2; -} -.wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-cover-image::after, -.wp-block-cover::after { - display: block; - content: ""; - font-size: 0; - min-height: inherit; -} -@supports (position: sticky) { - .wp-block-cover-image::after, -.wp-block-cover::after { - content: none; - } -} -.wp-block-cover-image.aligncenter, .wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.aligncenter, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - display: flex; -} -.wp-block-cover-image .wp-block-cover__inner-container, -.wp-block-cover .wp-block-cover__inner-container { - width: 100%; - z-index: 1; - color: #fff; -} -.wp-block-cover-image.is-light .wp-block-cover__inner-container, -.wp-block-cover.is-light .wp-block-cover__inner-container { - color: #000; -} -.wp-block-cover-image p:not(.has-text-color), -.wp-block-cover-image h1:not(.has-text-color), -.wp-block-cover-image h2:not(.has-text-color), -.wp-block-cover-image h3:not(.has-text-color), -.wp-block-cover-image h4:not(.has-text-color), -.wp-block-cover-image h5:not(.has-text-color), -.wp-block-cover-image h6:not(.has-text-color), -.wp-block-cover p:not(.has-text-color), -.wp-block-cover h1:not(.has-text-color), -.wp-block-cover h2:not(.has-text-color), -.wp-block-cover h3:not(.has-text-color), -.wp-block-cover h4:not(.has-text-color), -.wp-block-cover h5:not(.has-text-color), -.wp-block-cover h6:not(.has-text-color) { - color: inherit; -} -.wp-block-cover-image.is-position-top-left, -.wp-block-cover.is-position-top-left { - align-items: flex-start; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-top-center, -.wp-block-cover.is-position-top-center { - align-items: flex-start; - justify-content: center; -} -.wp-block-cover-image.is-position-top-right, -.wp-block-cover.is-position-top-right { - align-items: flex-start; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-center-left, -.wp-block-cover.is-position-center-left { - align-items: center; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-center-center, -.wp-block-cover.is-position-center-center { - align-items: center; - justify-content: center; -} -.wp-block-cover-image.is-position-center-right, -.wp-block-cover.is-position-center-right { - align-items: center; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-bottom-left, -.wp-block-cover.is-position-bottom-left { - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-bottom-center, -.wp-block-cover.is-position-bottom-center { - align-items: flex-end; - justify-content: center; -} -.wp-block-cover-image.is-position-bottom-right, -.wp-block-cover.is-position-bottom-right { - align-items: flex-end; - justify-content: flex-end; -} -.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container, -.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container { - margin: 0; - width: auto; -} -.wp-block-cover-image img.wp-block-cover__image-background, -.wp-block-cover-image video.wp-block-cover__video-background, -.wp-block-cover img.wp-block-cover__image-background, -.wp-block-cover video.wp-block-cover__video-background { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - max-width: none; - max-height: none; - -o-object-fit: cover; - object-fit: cover; - outline: none; - border: none; - box-shadow: none; -} - -.wp-block-cover__video-background { - z-index: 0; -} - -.wp-block-cover__image-background { - z-index: 0; -} - -section.wp-block-cover-image h2, -.wp-block-cover-image-text, -.wp-block-cover-text { - color: #fff; -} -section.wp-block-cover-image h2 a, -section.wp-block-cover-image h2 a:hover, -section.wp-block-cover-image h2 a:focus, -section.wp-block-cover-image h2 a:active, -.wp-block-cover-image-text a, -.wp-block-cover-image-text a:hover, -.wp-block-cover-image-text a:focus, -.wp-block-cover-image-text a:active, -.wp-block-cover-text a, -.wp-block-cover-text a:hover, -.wp-block-cover-text a:focus, -.wp-block-cover-text a:active { - color: #fff; -} - -.wp-block-cover-image .wp-block-cover.has-left-content { - justify-content: flex-start; -} -.wp-block-cover-image .wp-block-cover.has-right-content { - justify-content: flex-end; -} - -section.wp-block-cover-image.has-left-content > h2, -.wp-block-cover-image.has-left-content .wp-block-cover-image-text, -.wp-block-cover.has-left-content .wp-block-cover-text { - margin-right: 0; - text-align: right; -} - -section.wp-block-cover-image.has-right-content > h2, -.wp-block-cover-image.has-right-content .wp-block-cover-image-text, -.wp-block-cover.has-right-content .wp-block-cover-text { - margin-left: 0; - text-align: left; -} - -section.wp-block-cover-image > h2, -.wp-block-cover-image .wp-block-cover-image-text, -.wp-block-cover .wp-block-cover-text { - font-size: 2em; - line-height: 1.25; - z-index: 1; - margin-bottom: 0; - max-width: 840px; - padding: 0.44em; - text-align: center; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-cover { - /* Extra specificity needed because the reset.css applied in the editor context is overriding this rule. */ -} -.editor-styles-wrapper .wp-block-cover { - box-sizing: border-box; -} -.wp-block-cover.is-placeholder { - min-height: auto !important; - padding: 0 !important; -} -.wp-block-cover.is-placeholder .block-library-cover__resize-container { - display: none; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large { - min-height: 240px; - justify-content: flex-start; - z-index: 1; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large + .block-library-cover__resize-container { - min-height: 240px; - display: block; -} -.wp-block-cover.components-placeholder h2 { - color: inherit; -} -.wp-block-cover.is-transient::before { - background-color: #fff; - opacity: 0.3; -} -.wp-block-cover .components-spinner { - position: absolute; - z-index: 1; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - margin: 0; -} -.wp-block-cover .block-editor-block-list__layout { - width: 100%; -} -.wp-block-cover .wp-block-cover__inner-container { - text-align: left; - margin-left: 0; - margin-right: 0; -} -.wp-block-cover .wp-block-cover__placeholder-background-options { - width: 100%; -} - -[data-align=left] > .wp-block-cover, -[data-align=right] > .wp-block-cover { - max-width: 420px; - width: 100%; -} - -.block-library-cover__reset-button { - margin-left: auto; -} - -.block-library-cover__resize-container { - position: absolute !important; - top: 0; - left: 0; - right: 0; - bottom: 0; - min-height: 50px; -} - -.block-library-cover__resize-container:not(.is-resizing) { - height: auto !important; -} - -.wp-block-cover > .components-drop-zone .components-drop-zone__content { - opacity: 0.8 !important; -} - -.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover { - background-attachment: scroll; -}.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{min-height:auto!important;padding:0!important}.wp-block-cover.is-placeholder .block-library-cover__resize-container{display:none}.wp-block-cover.is-placeholder .components-placeholder.is-large{min-height:240px;justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder .components-placeholder.is-large+.block-library-cover__resize-container{min-height:240px;display:block}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%,-50%);margin:0}.wp-block-cover .block-editor-block-list__layout{width:100%}.wp-block-cover .wp-block-cover__inner-container{text-align:left;margin-left:0;margin-right:0}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-left:auto}.block-library-cover__resize-container{position:absolute!important;top:0;left:0;right:0;bottom:0;min-height:50px}.block-library-cover__resize-container:not(.is-resizing){height:auto!important}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-cover { - /* Extra specificity needed because the reset.css applied in the editor context is overriding this rule. */ -} -.editor-styles-wrapper .wp-block-cover { - box-sizing: border-box; -} -.wp-block-cover.is-placeholder { - min-height: auto !important; - padding: 0 !important; -} -.wp-block-cover.is-placeholder .block-library-cover__resize-container { - display: none; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large { - min-height: 240px; - justify-content: flex-start; - z-index: 1; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large + .block-library-cover__resize-container { - min-height: 240px; - display: block; -} -.wp-block-cover.components-placeholder h2 { - color: inherit; -} -.wp-block-cover.is-transient::before { - background-color: #fff; - opacity: 0.3; -} -.wp-block-cover .components-spinner { - position: absolute; - z-index: 1; - top: 50%; - right: 50%; - transform: translate(50%, -50%); - margin: 0; -} -.wp-block-cover .block-editor-block-list__layout { - width: 100%; -} -.wp-block-cover .wp-block-cover__inner-container { - text-align: right; - margin-right: 0; - margin-left: 0; -} -.wp-block-cover .wp-block-cover__placeholder-background-options { - width: 100%; -} - -[data-align=left] > .wp-block-cover, -[data-align=right] > .wp-block-cover { - max-width: 420px; - width: 100%; -} - -.block-library-cover__reset-button { - margin-right: auto; -} - -.block-library-cover__resize-container { - position: absolute !important; - top: 0; - right: 0; - left: 0; - bottom: 0; - min-height: 50px; -} - -.block-library-cover__resize-container:not(.is-resizing) { - height: auto !important; -} - -.wp-block-cover > .components-drop-zone .components-drop-zone__content { - opacity: 0.8 !important; -} - -.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover { - background-attachment: scroll; -}.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{min-height:auto!important;padding:0!important}.wp-block-cover.is-placeholder .block-library-cover__resize-container{display:none}.wp-block-cover.is-placeholder .components-placeholder.is-large{min-height:240px;justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder .components-placeholder.is-large+.block-library-cover__resize-container{min-height:240px;display:block}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{position:absolute;z-index:1;top:50%;right:50%;transform:translate(50%,-50%);margin:0}.wp-block-cover .block-editor-block-list__layout{width:100%}.wp-block-cover .wp-block-cover__inner-container{text-align:right;margin-right:0;margin-left:0}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-right:auto}.block-library-cover__resize-container{position:absolute!important;top:0;right:0;left:0;bottom:0;min-height:50px}.block-library-cover__resize-container:not(.is-resizing){height:auto!important}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-cover-image, -.wp-block-cover { - position: relative; - background-size: cover; - background-position: center center; - min-height: 430px; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - padding: 1em; - box-sizing: border-box; - /** - * Set a default background color for has-background-dim _unless_ it includes another - * background-color class (e.g. has-green-background-color). The presence of another - * background-color class implies that another style will provide the background color - * for the overlay. - * - * See: - * - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545 - * - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545 - */ -} -.wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: fixed; -} -@supports (-webkit-touch-callout: inherit) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -@media (prefers-reduced-motion: reduce) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -.wp-block-cover-image.is-repeated, -.wp-block-cover.is-repeated { - background-repeat: repeat; - background-size: auto; -} -.wp-block-cover-image.has-background-dim:not([class*=-background-color]), -.wp-block-cover-image .has-background-dim:not([class*=-background-color]), -.wp-block-cover.has-background-dim:not([class*=-background-color]), -.wp-block-cover .has-background-dim:not([class*=-background-color]) { - background-color: #000; -} -.wp-block-cover-image .has-background-dim.has-background-gradient, -.wp-block-cover .has-background-dim.has-background-gradient { - background-color: transparent; -} -.wp-block-cover-image.has-background-dim::before, -.wp-block-cover.has-background-dim::before { - content: ""; - background-color: inherit; -} -.wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover-image .wp-block-cover__background, -.wp-block-cover-image .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover .wp-block-cover__background, -.wp-block-cover .wp-block-cover__gradient-background { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 1; - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background { - opacity: 0.1; -} -.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background { - opacity: 0.2; -} -.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background { - opacity: 0.3; -} -.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background { - opacity: 0.4; -} -.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background { - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background { - opacity: 0.6; -} -.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background { - opacity: 0.7; -} -.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background { - opacity: 0.8; -} -.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background { - opacity: 0.9; -} -.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background { - opacity: 1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0 { - opacity: 0; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10 { - opacity: 0.1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20 { - opacity: 0.2; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30 { - opacity: 0.3; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40 { - opacity: 0.4; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50 { - opacity: 0.5; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60 { - opacity: 0.6; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70 { - opacity: 0.7; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80 { - opacity: 0.8; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90 { - opacity: 0.9; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100 { - opacity: 1; -} -.wp-block-cover-image .block-library-cover__padding-visualizer, -.wp-block-cover .block-library-cover__padding-visualizer { - z-index: 2; -} -.wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-cover-image::after, -.wp-block-cover::after { - display: block; - content: ""; - font-size: 0; - min-height: inherit; -} -@supports (position: sticky) { - .wp-block-cover-image::after, -.wp-block-cover::after { - content: none; - } -} -.wp-block-cover-image.aligncenter, .wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.aligncenter, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - display: flex; -} -.wp-block-cover-image .wp-block-cover__inner-container, -.wp-block-cover .wp-block-cover__inner-container { - width: 100%; - z-index: 1; - color: #fff; -} -.wp-block-cover-image.is-light .wp-block-cover__inner-container, -.wp-block-cover.is-light .wp-block-cover__inner-container { - color: #000; -} -.wp-block-cover-image p:not(.has-text-color), -.wp-block-cover-image h1:not(.has-text-color), -.wp-block-cover-image h2:not(.has-text-color), -.wp-block-cover-image h3:not(.has-text-color), -.wp-block-cover-image h4:not(.has-text-color), -.wp-block-cover-image h5:not(.has-text-color), -.wp-block-cover-image h6:not(.has-text-color), -.wp-block-cover p:not(.has-text-color), -.wp-block-cover h1:not(.has-text-color), -.wp-block-cover h2:not(.has-text-color), -.wp-block-cover h3:not(.has-text-color), -.wp-block-cover h4:not(.has-text-color), -.wp-block-cover h5:not(.has-text-color), -.wp-block-cover h6:not(.has-text-color) { - color: inherit; -} -.wp-block-cover-image.is-position-top-left, -.wp-block-cover.is-position-top-left { - align-items: flex-start; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-top-center, -.wp-block-cover.is-position-top-center { - align-items: flex-start; - justify-content: center; -} -.wp-block-cover-image.is-position-top-right, -.wp-block-cover.is-position-top-right { - align-items: flex-start; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-center-left, -.wp-block-cover.is-position-center-left { - align-items: center; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-center-center, -.wp-block-cover.is-position-center-center { - align-items: center; - justify-content: center; -} -.wp-block-cover-image.is-position-center-right, -.wp-block-cover.is-position-center-right { - align-items: center; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-bottom-left, -.wp-block-cover.is-position-bottom-left { - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-bottom-center, -.wp-block-cover.is-position-bottom-center { - align-items: flex-end; - justify-content: center; -} -.wp-block-cover-image.is-position-bottom-right, -.wp-block-cover.is-position-bottom-right { - align-items: flex-end; - justify-content: flex-end; -} -.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container, -.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container { - margin: 0; - width: auto; -} -.wp-block-cover-image img.wp-block-cover__image-background, -.wp-block-cover-image video.wp-block-cover__video-background, -.wp-block-cover img.wp-block-cover__image-background, -.wp-block-cover video.wp-block-cover__video-background { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - max-width: none; - max-height: none; - -o-object-fit: cover; - object-fit: cover; - outline: none; - border: none; - box-shadow: none; -} - -.wp-block-cover__video-background { - z-index: 0; -} - -.wp-block-cover__image-background { - z-index: 0; -} - -section.wp-block-cover-image h2, -.wp-block-cover-image-text, -.wp-block-cover-text { - color: #fff; -} -section.wp-block-cover-image h2 a, -section.wp-block-cover-image h2 a:hover, -section.wp-block-cover-image h2 a:focus, -section.wp-block-cover-image h2 a:active, -.wp-block-cover-image-text a, -.wp-block-cover-image-text a:hover, -.wp-block-cover-image-text a:focus, -.wp-block-cover-image-text a:active, -.wp-block-cover-text a, -.wp-block-cover-text a:hover, -.wp-block-cover-text a:focus, -.wp-block-cover-text a:active { - color: #fff; -} - -.wp-block-cover-image .wp-block-cover.has-left-content { - justify-content: flex-start; -} -.wp-block-cover-image .wp-block-cover.has-right-content { - justify-content: flex-end; -} - -section.wp-block-cover-image.has-left-content > h2, -.wp-block-cover-image.has-left-content .wp-block-cover-image-text, -.wp-block-cover.has-left-content .wp-block-cover-text { - margin-left: 0; - text-align: left; -} - -section.wp-block-cover-image.has-right-content > h2, -.wp-block-cover-image.has-right-content .wp-block-cover-image-text, -.wp-block-cover.has-right-content .wp-block-cover-text { - margin-right: 0; - text-align: right; -} - -section.wp-block-cover-image > h2, -.wp-block-cover-image .wp-block-cover-image-text, -.wp-block-cover .wp-block-cover-text { - font-size: 2em; - line-height: 1.25; - z-index: 1; - margin-bottom: 0; - max-width: 840px; - padding: 0.44em; - text-align: center; -}getid3->info; $info['riff'] = array('raw'=>array()); $thisfile_riff = &$info['riff']; $thisfile_riff_raw = &$thisfile_riff['raw']; $thisfile_audio = &$info['audio']; $thisfile_video = &$info['video']; $thisfile_audio_dataformat = &$thisfile_audio['dataformat']; $thisfile_riff_audio = &$thisfile_riff['audio']; $thisfile_riff_video = &$thisfile_riff['video']; $thisfile_riff_WAVE = array(); $Original = array(); $Original['avdataoffset'] = $info['avdataoffset']; $Original['avdataend'] = $info['avdataend']; $this->fseek($info['avdataoffset']); $RIFFheader = $this->fread(12); $offset = $this->ftell(); $RIFFtype = substr($RIFFheader, 0, 4); $RIFFsize = substr($RIFFheader, 4, 4); $RIFFsubtype = substr($RIFFheader, 8, 4); switch ($RIFFtype) { case 'FORM': $this->container = 'aiff'; $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); break; case 'RIFF': case 'SDSS': case 'RMP3': $this->container = 'riff'; $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); if ($RIFFsubtype == 'RMP3') { $RIFFsubtype = 'WAVE'; } if ($RIFFsubtype != 'AMV ') { $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); } if (($info['avdataend'] - $info['filesize']) == 1) { $info['avdataend'] = $info['filesize']; } $nextRIFFoffset = $Original['avdataoffset'] + 8 + $thisfile_riff['header_size']; while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) { try { $this->fseek($nextRIFFoffset); } catch (getid3_exception $e) { if ($e->getCode() == 10) { $this->error('AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime may be wrong'); $this->warning('[avdataend] value may be incorrect, multiple AVIX chunks may be present'); break; } else { throw $e; } } $nextRIFFheader = $this->fread(12); if ($nextRIFFoffset == ($info['avdataend'] - 1)) { if (substr($nextRIFFheader, 0, 1) == "\x00") { break; } } $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4)); $nextRIFFtype = substr($nextRIFFheader, 8, 4); $chunkdata = array(); $chunkdata['offset'] = $nextRIFFoffset + 8; $chunkdata['size'] = $nextRIFFsize; $nextRIFFoffset = $chunkdata['offset'] + $chunkdata['size']; switch ($nextRIFFheaderID) { case 'RIFF': $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset); if (!isset($thisfile_riff[$nextRIFFtype])) { $thisfile_riff[$nextRIFFtype] = array(); } $thisfile_riff[$nextRIFFtype][] = $chunkdata; break; case 'AMV ': unset($info['riff']); $info['amv'] = $this->ParseRIFFAMV($chunkdata['offset'] + 4, $nextRIFFoffset); break; case 'JUNK': $thisfile_riff[$nextRIFFheaderID][] = $chunkdata; break; case 'IDVX': $info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunkdata['size'])); break; default: if ($info['filesize'] == ($chunkdata['offset'] - 8 + 128)) { $DIVXTAG = $nextRIFFheader.$this->fread(128 - 12); if (substr($DIVXTAG, -7) == 'DIVXTAG') { $this->warning('Found wrongly-structured DIVXTAG at offset '.($this->ftell() - 128).', parsing anyway'); $info['divxtag']['comments'] = self::ParseDIVXTAG($DIVXTAG); break 2; } } $this->warning('Expecting "RIFF|JUNK|IDVX" at '.$nextRIFFoffset.', found "'.$nextRIFFheaderID.'" ('.getid3_lib::PrintHexBytes($nextRIFFheaderID).') - skipping rest of file'); break 2; } } if ($RIFFsubtype == 'WAVE') { $thisfile_riff_WAVE = &$thisfile_riff['WAVE']; } break; default: $this->error('Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead'); return false; } $streamindex = 0; switch ($RIFFsubtype) { case 'WAVE': $info['fileformat'] = 'wav'; if (empty($thisfile_audio['bitrate_mode'])) { $thisfile_audio['bitrate_mode'] = 'cbr'; } if (empty($thisfile_audio_dataformat)) { $thisfile_audio_dataformat = 'wav'; } if (isset($thisfile_riff_WAVE['data'][0]['offset'])) { $info['avdataoffset'] = $thisfile_riff_WAVE['data'][0]['offset'] + 8; $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff_WAVE['data'][0]['size']; } if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) { $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { $this->error('Corrupt RIFF file: bitrate_audio == zero'); return false; } $thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw']; unset($thisfile_riff_audio[$streamindex]['raw']); $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; $thisfile_audio = (array) getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') { $this->warning('Audio codec = '.$thisfile_audio['codec']); } $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; if (empty($info['playtime_seconds'])) { $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); } $thisfile_audio['lossless'] = false; if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { case 0x0001: $thisfile_audio['lossless'] = true; break; case 0x2000: $thisfile_audio_dataformat = 'ac3'; break; default: break; } } $thisfile_audio['streams'][$streamindex]['wformattag'] = $thisfile_audio['wformattag']; $thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; $thisfile_audio['streams'][$streamindex]['lossless'] = $thisfile_audio['lossless']; $thisfile_audio['streams'][$streamindex]['dataformat'] = $thisfile_audio_dataformat; } if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) { $rgadData = &$thisfile_riff_WAVE['rgad'][0]['data']; $thisfile_riff_raw['rgad'] = array('track'=>array(), 'album'=>array()); $thisfile_riff_raw_rgad = &$thisfile_riff_raw['rgad']; $thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track']; $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); $thisfile_riff_raw_rgad_track['name'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3)); $thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3)); $thisfile_riff_raw_rgad_track['signbit'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1)); $thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9)); $thisfile_riff_raw_rgad_album['name'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3)); $thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3)); $thisfile_riff_raw_rgad_album['signbit'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1)); $thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9)); $thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude']; if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) { $thisfile_riff['rgad']['track']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']); $thisfile_riff['rgad']['track']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']); $thisfile_riff['rgad']['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']); } if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) { $thisfile_riff['rgad']['album']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']); $thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']); $thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']); } } if (isset($thisfile_riff_WAVE['fact'][0]['data'])) { $thisfile_riff_raw['fact']['NumberOfSamples'] = $this->EitherEndian2Int(substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4)); } if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); } if (isset($thisfile_riff_WAVE['bext'][0]['data'])) { $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; $thisfile_riff_WAVE_bext_0['title'] = substr($thisfile_riff_WAVE_bext_0['data'], 0, 256); $thisfile_riff_WAVE_bext_0['author'] = substr($thisfile_riff_WAVE_bext_0['data'], 256, 32); $thisfile_riff_WAVE_bext_0['reference'] = substr($thisfile_riff_WAVE_bext_0['data'], 288, 32); foreach (array('title','author','reference') as $bext_key) { $null_terminator_offset = strpos($thisfile_riff_WAVE_bext_0[$bext_key], "\x00"); $thisfile_riff_WAVE_bext_0[$bext_key] = substr($thisfile_riff_WAVE_bext_0[$bext_key], 0, $null_terminator_offset); } $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) { if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) { $bext_timestamp = array(); list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time; $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']); } else { $this->warning('RIFF.WAVE.BEXT.origin_time is invalid'); } } else { $this->warning('RIFF.WAVE.BEXT.origin_date is invalid'); } $thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author']; $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_bext_0['title']; } if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) { $thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0]; $thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2)); $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); } $thisfile_riff_WAVE_MEXT_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2)); $thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2)); $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001); $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002); $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004); } if (isset($thisfile_riff_WAVE['cart'][0]['data'])) { $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); for ($i = 0; $i < 8; $i++) { $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); } $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); $thisfile_riff['comments']['tag_text'][] = substr($thisfile_riff_WAVE_cart_0['data'], 1772); $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_cart_0['title']; } if (isset($thisfile_riff_WAVE['SNDM'][0]['data'])) { $thisfile_riff_WAVE_SNDM_0 = &$thisfile_riff_WAVE['SNDM'][0]; $thisfile_riff_WAVE_SNDM_0_data = &$thisfile_riff_WAVE_SNDM_0['data']; $SNDM_startoffset = 0; $SNDM_endoffset = $thisfile_riff_WAVE_SNDM_0['size']; while ($SNDM_startoffset < $SNDM_endoffset) { $SNDM_thisTagOffset = 0; $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4)); $SNDM_thisTagOffset += 4; $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); $SNDM_thisTagOffset += 4; $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); $SNDM_thisTagOffset += 2; $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); $SNDM_thisTagOffset += 2; $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); $SNDM_thisTagOffset += $SNDM_thisTagDataSize; if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) { $this->warning('RIFF.WAVE.SNDM.data contains tag not expected length (expected: '.$SNDM_thisTagSize.', found: '.(4 + 4 + 2 + 2 + $SNDM_thisTagDataSize).') at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); break; } elseif ($SNDM_thisTagSize <= 0) { $this->warning('RIFF.WAVE.SNDM.data contains zero-size tag at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); break; } $SNDM_startoffset += $SNDM_thisTagSize; $thisfile_riff_WAVE_SNDM_0['parsed_raw'][$SNDM_thisTagKey] = $SNDM_thisTagDataText; if ($parsedkey = self::waveSNDMtagLookup($SNDM_thisTagKey)) { $thisfile_riff_WAVE_SNDM_0['parsed'][$parsedkey] = $SNDM_thisTagDataText; } else { $this->warning('RIFF.WAVE.SNDM contains unknown tag "'.$SNDM_thisTagKey.'" at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); } } $tagmapping = array( 'tracktitle'=>'title', 'category' =>'genre', 'cdtitle' =>'album', ); foreach ($tagmapping as $fromkey => $tokey) { if (isset($thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey])) { $thisfile_riff['comments'][$tokey][] = $thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey]; } } } if (isset($thisfile_riff_WAVE['iXML'][0]['data'])) { if ($parsedXML = getid3_lib::XML2array($thisfile_riff_WAVE['iXML'][0]['data'])) { $thisfile_riff_WAVE['iXML'][0]['parsed'] = $parsedXML; if (isset($parsedXML['SPEED']['MASTER_SPEED'])) { @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']); $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000); } if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) { @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000); } if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0')); $timestamp_sample_rate = (is_array($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) ? max($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) : $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']); $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $timestamp_sample_rate; $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); unset($samples_since_midnight, $timestamp_sample_rate, $h, $m, $s, $f); } unset($parsedXML); } } if (isset($thisfile_riff_WAVE['guan'][0]['data'])) { $thisfile_riff_WAVE_guan_0 = &$thisfile_riff_WAVE['guan'][0]; if (!empty($thisfile_riff_WAVE_guan_0['data']) && (substr($thisfile_riff_WAVE_guan_0['data'], 0, 14) == 'GUANO|Version:')) { $thisfile_riff['guano'] = array(); foreach (explode("\n", $thisfile_riff_WAVE_guan_0['data']) as $line) { if ($line) { @list($key, $value) = explode(':', $line, 2); if (substr($value, 0, 3) == '[{"') { if ($decoded = @json_decode($value, true)) { if (!empty($decoded) && (count($decoded) == 1)) { $value = $decoded[0]; } else { $value = $decoded; } } } $thisfile_riff['guano'] = array_merge_recursive($thisfile_riff['guano'], getid3_lib::CreateDeepArray($key, '|', $value)); } } foreach ($thisfile_riff['guano'] as $key => $value) { switch ($key) { case 'Loc Position': if (preg_match('#^([\\+\\-]?[0-9]+\\.[0-9]+) ([\\+\\-]?[0-9]+\\.[0-9]+)$#', $value, $matches)) { list($dummy, $latitude, $longitude) = $matches; $thisfile_riff['comments']['gps_latitude'][0] = floatval($latitude); $thisfile_riff['comments']['gps_longitude'][0] = floatval($longitude); $thisfile_riff['guano'][$key] = floatval($latitude).' '.floatval($longitude); } break; case 'Loc Elevation': $thisfile_riff['comments']['gps_altitude'][0] = floatval($value); $thisfile_riff['guano'][$key] = (float) $value; break; case 'Filter HP': case 'Filter LP': case 'Humidity': case 'Length': case 'Loc Accuracy': case 'Temperature Ext': case 'Temperature Int': $thisfile_riff['guano'][$key] = (float) $value; break; case 'Samplerate': case 'TE': $thisfile_riff['guano'][$key] = (int) $value; break; } } } else { $this->warning('RIFF.guan data not in expected format'); } } if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); } if (!empty($info['wavpack'])) { $thisfile_audio_dataformat = 'wavpack'; $thisfile_audio['bitrate_mode'] = 'vbr'; $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version']; $info['avdataend'] = $Original['avdataend']; $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; $this->fseek($info['avdataoffset'] - 44); $RIFFdata = $this->fread(44); $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { $info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); $this->fseek($info['avdataend']); $RIFFdata .= $this->fread($OrignalRIFFheaderSize - $OrignalRIFFdataSize); } $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); $getid3_riff = new getid3_riff($this->getid3); $getid3_riff->ParseRIFFdata($RIFFdata); unset($getid3_riff); } if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { case 0x0001: if (!empty($info['ac3'])) { $thisfile_audio['wformattag'] = 0x2000; $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); $thisfile_audio['lossless'] = false; $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate']; } if (!empty($info['dts'])) { $thisfile_audio['wformattag'] = 0x2001; $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); $thisfile_audio['lossless'] = false; $thisfile_audio['bitrate'] = $info['dts']['bitrate']; $thisfile_audio['sample_rate'] = $info['dts']['sample_rate']; } break; case 0x08AE: $thisfile_audio['bitrate_mode'] = 'vbr'; $thisfile_audio_dataformat = 'litewave'; $thisfile_riff['litewave']['raw'] = array(); $riff_litewave = &$thisfile_riff['litewave']; $riff_litewave_raw = &$riff_litewave['raw']; $flags = array( 'compression_method' => 1, 'compression_flags' => 1, 'm_dwScale' => 4, 'm_dwBlockSize' => 4, 'm_wQuality' => 2, 'm_wMarkDistance' => 2, 'm_wReserved' => 2, 'm_dwOrgSize' => 4, 'm_bFactExists' => 2, 'm_dwRiffChunkSize' => 4, ); $litewave_offset = 18; foreach ($flags as $flag => $length) { $riff_litewave_raw[$flag] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], $litewave_offset, $length)); $litewave_offset += $length; } $riff_litewave['quality_factor'] = $riff_litewave_raw['m_wQuality']; $riff_litewave['flags']['raw_source'] = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true; $riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true; $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); $thisfile_audio['lossless'] = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false); $thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor']; break; default: break; } } if ($info['avdataend'] > $info['filesize']) { switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { case 'wavpack': case 'lpac': case 'ofr': case 'ofs': break; case 'litewave': if (($info['avdataend'] - $info['filesize']) == 1) { } else { $this->warning('Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); $info['avdataend'] = $info['filesize']; } break; default: if ((($info['avdataend'] - $info['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($info['filesize'] - $info['avdataoffset']) % 2) == 1)) { $this->warning('File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); $info['avdataend'] = $info['filesize']; } else { $this->warning('Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); $info['avdataend'] = $info['filesize']; } break; } } if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) { $info['avdataend']--; $this->warning('Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'); } } if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) { unset($thisfile_audio['bits_per_sample']); if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; } } break; case 'AVI ': $info['fileformat'] = 'avi'; $info['mime_type'] = 'video/avi'; $thisfile_video['bitrate_mode'] = 'vbr'; $thisfile_video['dataformat'] = 'avi'; $thisfile_riff_video_current = array(); if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) { $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8; if (isset($thisfile_riff['AVIX'])) { $info['avdataend'] = $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['offset'] + $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['size']; } else { $info['avdataend'] = $thisfile_riff['AVI ']['movi']['offset'] + $thisfile_riff['AVI ']['movi']['size']; } if ($info['avdataend'] > $info['filesize']) { $this->warning('Probably truncated file - expecting '.($info['avdataend'] - $info['avdataoffset']).' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($info['avdataend'] - $info['filesize']).' bytes)'); $info['avdataend'] = $info['filesize']; } } if (isset($thisfile_riff['AVI ']['hdrl']['strl']['indx'])) { foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { $ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($ahsisd, 12, 4)); unset($ahsisd); } } if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) { $avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data']; $thisfile_riff_raw['avih'] = array(); $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { $this->error('Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'); return false; } $flags = array( 'dwMaxBytesPerSec', 'dwPaddingGranularity', 'dwFlags', 'dwTotalFrames', 'dwInitialFrames', 'dwStreams', 'dwSuggestedBufferSize', 'dwWidth', 'dwHeight', 'dwScale', 'dwRate', 'dwStart', 'dwLength', ); $avih_offset = 4; foreach ($flags as $flag) { $thisfile_riff_raw_avih[$flag] = $this->EitherEndian2Int(substr($avihData, $avih_offset, 4)); $avih_offset += 4; } $flags = array( 'hasindex' => 0x00000010, 'mustuseindex' => 0x00000020, 'interleaved' => 0x00000100, 'trustcktype' => 0x00000800, 'capturedfile' => 0x00010000, 'copyrighted' => 0x00020010, ); foreach ($flags as $flag => $value) { $thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value); } $thisfile_riff_video[$streamindex] = array(); $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex]; if ($thisfile_riff_raw_avih['dwWidth'] > 0) { $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth']; $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width']; } if ($thisfile_riff_raw_avih['dwHeight'] > 0) { $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight']; $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height']; } if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames']; $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames']; } $thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3); $thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate']; } if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) { if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) { $thisfile_riff_raw_strf_strhfccType_streamindex = null; for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; $strhfccType = substr($strhData, 0, 4); if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex]; switch ($strhfccType) { case 'auds': $thisfile_audio['bitrate_mode'] = 'cbr'; $thisfile_audio_dataformat = 'wav'; if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) { $streamindex = count($thisfile_riff_audio); } $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($strfData); $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; $thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex]; if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) { unset($thisfile_audio_streams_currentstream['bits_per_sample']); } $thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag']; unset($thisfile_audio_streams_currentstream['raw']); $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw']; unset($thisfile_riff_audio[$streamindex]['raw']); $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); $thisfile_audio['lossless'] = false; switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) { case 0x0001: $thisfile_audio_dataformat = 'wav'; $thisfile_audio['lossless'] = true; break; case 0x0050: $thisfile_audio_dataformat = 'mp2'; break; case 0x0055: $thisfile_audio_dataformat = 'mp3'; break; case 0x00FF: $thisfile_audio_dataformat = 'aac'; break; case 0x0161: case 0x0162: case 0x0163: $thisfile_audio_dataformat = 'wma'; break; case 0x2000: $thisfile_audio_dataformat = 'ac3'; break; case 0x2001: $thisfile_audio_dataformat = 'dts'; break; default: $thisfile_audio_dataformat = 'wav'; break; } $thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat; $thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless']; $thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode']; break; case 'iavs': case 'vids': $thisfile_riff_raw['strh'][$i] = array(); $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2)); $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2)); $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4)); $thisfile_riff_raw_strh_current['dwScale'] = $this->EitherEndian2Int(substr($strhData, 20, 4)); $thisfile_riff_raw_strh_current['dwRate'] = $this->EitherEndian2Int(substr($strhData, 24, 4)); $thisfile_riff_raw_strh_current['dwStart'] = $this->EitherEndian2Int(substr($strhData, 28, 4)); $thisfile_riff_raw_strh_current['dwLength'] = $this->EitherEndian2Int(substr($strhData, 32, 4)); $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4)); $thisfile_riff_raw_strh_current['dwQuality'] = $this->EitherEndian2Int(substr($strhData, 40, 4)); $thisfile_riff_raw_strh_current['dwSampleSize'] = $this->EitherEndian2Int(substr($strhData, 44, 4)); $thisfile_riff_raw_strh_current['rcFrame'] = $this->EitherEndian2Int(substr($strhData, 48, 4)); $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']); $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; } $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; $thisfile_video['pixel_aspect_ratio'] = (float) 1; switch ($thisfile_riff_raw_strh_current['fccHandler']) { case 'HFYU': case 'IRAW': case 'YUY2': $thisfile_video['lossless'] = true; break; default: $thisfile_video['lossless'] = false; break; } switch ($strhfccType) { case 'vids': $thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($this->container == 'riff')); $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount']; if ($thisfile_riff_video_current['codec'] == 'DV') { $thisfile_riff_video_current['dv_type'] = 2; } break; case 'iavs': $thisfile_riff_video_current['dv_type'] = 1; break; } break; default: $this->warning('Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"'); break; } } } if (isset($thisfile_riff_raw_strf_strhfccType_streamindex) && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; if (self::fourccLookup($thisfile_video['fourcc'])) { $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_video['fourcc']); $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; } switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) { case 'HFYU': case 'IRAW': case 'YUY2': $thisfile_video['lossless'] = true; break; default: $thisfile_video['lossless'] = false; break; } } } } } break; case 'AMV ': $info['fileformat'] = 'amv'; $info['mime_type'] = 'video/amv'; $thisfile_video['bitrate_mode'] = 'vbr'; $thisfile_video['dataformat'] = 'mjpeg'; $thisfile_video['codec'] = 'mjpeg'; $thisfile_video['lossless'] = false; $thisfile_video['bits_per_sample'] = 24; $thisfile_audio['dataformat'] = 'adpcm'; $thisfile_audio['lossless'] = false; break; case 'CDDA': $info['fileformat'] = 'cda'; unset($info['mime_type']); $thisfile_audio_dataformat = 'cda'; $info['avdataoffset'] = 44; if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) { $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75; $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75; $info['comments']['track_number'] = $thisfile_riff_CDDA_fmt_0['track_num']; $info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds']; $thisfile_audio['lossless'] = true; $thisfile_audio['sample_rate'] = 44100; $thisfile_audio['channels'] = 2; $thisfile_audio['bits_per_sample'] = 16; $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample']; $thisfile_audio['bitrate_mode'] = 'cbr'; } break; case 'AIFF': case 'AIFC': $info['fileformat'] = 'aiff'; $info['mime_type'] = 'audio/x-aiff'; $thisfile_audio['bitrate_mode'] = 'cbr'; $thisfile_audio_dataformat = 'aiff'; $thisfile_audio['lossless'] = true; if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) { $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8; $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size']; if ($info['avdataend'] > $info['filesize']) { if (($info['avdataend'] == ($info['filesize'] + 1)) && (($info['filesize'] % 2) == 1)) { } else { $this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found'); } $info['avdataend'] = $info['filesize']; } } if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) { $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); switch ($thisfile_riff_audio['codec_name']) { case 'NONE': $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; $thisfile_audio['lossless'] = true; break; case '': switch ($thisfile_riff_audio['codec_fourcc']) { case 'sowt': $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM'; $thisfile_audio['lossless'] = true; break; case 'twos': $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM'; $thisfile_audio['lossless'] = true; break; default: break; } break; default: $thisfile_audio['codec'] = $thisfile_riff_audio['codec_name']; $thisfile_audio['lossless'] = false; break; } } $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; if ($thisfile_riff_audio['bits_per_sample'] > 0) { $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; } $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; if ($thisfile_audio['sample_rate'] == 0) { $this->error('Corrupted AIFF file: sample_rate == zero'); return false; } $info['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate']; } if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { $offset = 0; $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); $offset += 2; for ($i = 0; $i < $CommentCount; $i++) { $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); $offset += 4; $info['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true); $offset += 2; $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); $offset += 2; $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); $offset += $CommentLength; $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']); $thisfile_riff['comments']['comment'][] = $info['comments_raw'][$i]['comment']; } } $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); foreach ($CommentsChunkNames as $key => $value) { if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; } } break; case '8SVX': $info['fileformat'] = '8svx'; $info['mime_type'] = 'audio/8svx'; $thisfile_audio['bitrate_mode'] = 'cbr'; $thisfile_audio_dataformat = '8svx'; $thisfile_audio['bits_per_sample'] = 8; $thisfile_audio['channels'] = 1; $ActualBitsPerSample = 0; if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) { $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8; $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size']; if ($info['avdataend'] > $info['filesize']) { $this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found'); } } if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) { $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) { case 0: $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; $thisfile_audio['lossless'] = true; $ActualBitsPerSample = 8; break; case 1: $thisfile_audio['codec'] = 'Fibonacci-delta encoding'; $thisfile_audio['lossless'] = false; $ActualBitsPerSample = 4; break; default: $this->warning('Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.$thisfile_riff_RIFFsubtype_VHDR_0['sCompression'].'"'); break; } } if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) { $ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4)); switch ($ChannelsIndex) { case 6: $thisfile_audio['channels'] = 2; break; case 2: case 4: $thisfile_audio['channels'] = 1; break; default: $this->warning('Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"'); break; } } $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); foreach ($CommentsChunkNames as $key => $value) { if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; } } $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; if (!empty($thisfile_audio['bitrate'])) { $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8); } break; case 'CDXA': $info['fileformat'] = 'vcd'; $info['mime_type'] = 'video/mpeg'; if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true); $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_mpeg = new getid3_mpeg($getid3_temp); $getid3_mpeg->Analyze(); if (empty($getid3_temp->info['error'])) { $info['audio'] = $getid3_temp->info['audio']; $info['video'] = $getid3_temp->info['video']; $info['mpeg'] = $getid3_temp->info['mpeg']; $info['warning'] = $getid3_temp->info['warning']; } unset($getid3_temp, $getid3_mpeg); } break; case 'WEBP': $info['fileformat'] = 'webp'; $info['mime_type'] = 'image/webp'; if (!empty($thisfile_riff['WEBP']['VP8 '][0]['size'])) { $old_offset = $this->ftell(); $this->fseek($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8); $WEBP_VP8_header = $this->fread(10); $this->fseek($old_offset); if (substr($WEBP_VP8_header, 3, 3) == "\x9D\x01\x2A") { $thisfile_riff['WEBP']['VP8 '][0]['keyframe'] = !(getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x800000); $thisfile_riff['WEBP']['VP8 '][0]['version'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x700000) >> 20; $thisfile_riff['WEBP']['VP8 '][0]['show_frame'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x080000); $thisfile_riff['WEBP']['VP8 '][0]['data_bytes'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x07FFFF) >> 0; $thisfile_riff['WEBP']['VP8 '][0]['scale_x'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0xC000) >> 14; $thisfile_riff['WEBP']['VP8 '][0]['width'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0x3FFF); $thisfile_riff['WEBP']['VP8 '][0]['scale_y'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0xC000) >> 14; $thisfile_riff['WEBP']['VP8 '][0]['height'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0x3FFF); $info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8 '][0]['width']; $info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8 '][0]['height']; } else { $this->error('Expecting 9D 01 2A at offset '.($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8 + 3).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8_header, 3, 3)).'"'); } } if (!empty($thisfile_riff['WEBP']['VP8L'][0]['size'])) { $old_offset = $this->ftell(); $this->fseek($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8); $WEBP_VP8L_header = $this->fread(10); $this->fseek($old_offset); if (substr($WEBP_VP8L_header, 0, 1) == "\x2F") { $width_height_flags = getid3_lib::LittleEndian2Bin(substr($WEBP_VP8L_header, 1, 4)); $thisfile_riff['WEBP']['VP8L'][0]['width'] = bindec(substr($width_height_flags, 18, 14)) + 1; $thisfile_riff['WEBP']['VP8L'][0]['height'] = bindec(substr($width_height_flags, 4, 14)) + 1; $thisfile_riff['WEBP']['VP8L'][0]['alpha_is_used'] = (bool) bindec(substr($width_height_flags, 3, 1)); $thisfile_riff['WEBP']['VP8L'][0]['version'] = bindec(substr($width_height_flags, 0, 3)); $info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8L'][0]['width']; $info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8L'][0]['height']; } else { $this->error('Expecting 2F at offset '.($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8L_header, 0, 1)).'"'); } } break; default: $this->error('Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA|WEBP), found "'.$RIFFsubtype.'" instead'); } switch ($RIFFsubtype) { case 'WAVE': case 'AIFF': case 'AIFC': $ID3v2_key_good = 'id3 '; $ID3v2_keys_bad = array('ID3 ', 'tag '); foreach ($ID3v2_keys_bad as $ID3v2_key_bad) { if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { $thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]; $this->warning('mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"'); } } if (isset($thisfile_riff[$RIFFsubtype]['id3 '])) { getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_id3v2 = new getid3_id3v2($getid3_temp); $getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['id3 '][0]['offset'] + 8; if ($thisfile_riff[$RIFFsubtype]['id3 '][0]['valid'] = $getid3_id3v2->Analyze()) { $info['id3v2'] = $getid3_temp->info['id3v2']; } unset($getid3_temp, $getid3_id3v2); } break; } if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) { $thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4)); } if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) { self::parseComments($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']); } if (isset($thisfile_riff['AVI ']['INFO']) && is_array($thisfile_riff['AVI ']['INFO'])) { self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']); } if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) { $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version']; } if (!isset($info['playtime_seconds'])) { $info['playtime_seconds'] = 0; } if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { $info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); } elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { $info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); } if ($info['playtime_seconds'] > 0) { if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { if (!isset($info['bitrate'])) { $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); } } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { if (!isset($thisfile_audio['bitrate'])) { $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); } } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { if (!isset($thisfile_video['bitrate'])) { $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); } } } if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($info['playtime_seconds'] > 0)) { $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); $thisfile_audio['bitrate'] = 0; $thisfile_video['bitrate'] = $info['bitrate']; foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) { $thisfile_video['bitrate'] -= $audioinfoarray['bitrate']; $thisfile_audio['bitrate'] += $audioinfoarray['bitrate']; } if ($thisfile_video['bitrate'] <= 0) { unset($thisfile_video['bitrate']); } if ($thisfile_audio['bitrate'] <= 0) { unset($thisfile_audio['bitrate']); } } if (isset($info['mpeg']['audio'])) { $thisfile_audio_dataformat = 'mp'.$info['mpeg']['audio']['layer']; $thisfile_audio['sample_rate'] = $info['mpeg']['audio']['sample_rate']; $thisfile_audio['channels'] = $info['mpeg']['audio']['channels']; $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate']; $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); if (!empty($info['mpeg']['audio']['codec'])) { $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; } if (!empty($thisfile_audio['streams'])) { foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; $thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels']; $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; $thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec']; } } } $getid3_mp3 = new getid3_mp3($this->getid3); $thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions(); unset($getid3_mp3); } if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { switch ($thisfile_audio_dataformat) { case 'ac3': break; default: $thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample']; break; } } if (empty($thisfile_riff_raw)) { unset($thisfile_riff['raw']); } if (empty($thisfile_riff_audio)) { unset($thisfile_riff['audio']); } if (empty($thisfile_riff_video)) { unset($thisfile_riff['video']); } return true; } public function ParseRIFFAMV($startoffset, $maxoffset) { $info = &$this->getid3->info; $RIFFchunk = false; try { $this->fseek($startoffset); $maxoffset = min($maxoffset, $info['avdataend']); $AMVheader = $this->fread(284); if (substr($AMVheader, 0, 8) != 'hdrlamvh') { throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); } if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); } $RIFFchunk = array(); $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame']; $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x']; $info['video']['resolution_y'] = $RIFFchunk['amvh']['resolution_y']; $info['playtime_seconds'] = ($RIFFchunk['amvh']['runtime_hrs'] * 3600) + ($RIFFchunk['amvh']['runtime_min'] * 60) + $RIFFchunk['amvh']['runtime_sec']; if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); } if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); } if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") { throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"'); } if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); } $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); $info['audio']['lossless'] = false; $info['audio']['sample_rate'] = $RIFFchunk['strf']['nsamplespersec']; $info['audio']['channels'] = $RIFFchunk['strf']['nchannels']; $info['audio']['bits_per_sample'] = $RIFFchunk['strf']['wbitspersample']; $info['audio']['bitrate'] = $info['audio']['sample_rate'] * $info['audio']['channels'] * $info['audio']['bits_per_sample']; $info['audio']['bitrate_mode'] = 'cbr'; } catch (getid3_exception $e) { if ($e->getCode() == 10) { $this->warning('RIFFAMV parser: '.$e->getMessage()); } else { throw $e; } } return $RIFFchunk; } public function ParseRIFF($startoffset, $maxoffset) { $info = &$this->getid3->info; $RIFFchunk = false; $FoundAllChunksWeNeed = false; $LISTchunkParent = null; $LISTchunkMaxOffset = null; $AC3syncwordBytes = pack('n', getid3_ac3::syncword); try { $this->fseek($startoffset); $maxoffset = min($maxoffset, $info['avdataend']); while ($this->ftell() < $maxoffset) { $chunknamesize = $this->fread(8); $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); if (strlen($chunkname) < 4) { $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.'); break; } if (($chunksize == 0) && ($chunkname != 'JUNK')) { $this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.'); break; } if (($chunksize % 2) != 0) { $chunksize++; } switch ($chunkname) { case 'LIST': $listname = $this->fread(4); if (preg_match('#^(movi|rec )$#i', $listname)) { $RIFFchunk[$listname]['offset'] = $this->ftell() - 4; $RIFFchunk[$listname]['size'] = $chunksize; if (!$FoundAllChunksWeNeed) { $WhereWeWere = $this->ftell(); $AudioChunkHeader = $this->fread(12); $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); if ($AudioChunkStreamType == 'wb') { $FirstFourBytes = substr($AudioChunkHeader, 8, 4); if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) { if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) { $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $this->ftell() - 4; $getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize; $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__); $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); if (isset($getid3_temp->info['mpeg']['audio'])) { $info['mpeg']['audio'] = $getid3_temp->info['mpeg']['audio']; $info['audio'] = $getid3_temp->info['audio']; $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; $info['audio']['channels'] = $info['mpeg']['audio']['channels']; $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); } unset($getid3_temp, $getid3_mp3); } } elseif (strpos($FirstFourBytes, $AC3syncwordBytes) === 0) { $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $this->ftell() - 4; $getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize; $getid3_ac3 = new getid3_ac3($getid3_temp); $getid3_ac3->Analyze(); if (empty($getid3_temp->info['error'])) { $info['audio'] = $getid3_temp->info['audio']; $info['ac3'] = $getid3_temp->info['ac3']; if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $key => $value) { $this->warning($value); } } } unset($getid3_temp, $getid3_ac3); } } $FoundAllChunksWeNeed = true; $this->fseek($WhereWeWere); } $this->fseek($chunksize - 4, SEEK_CUR); } else { if (!isset($RIFFchunk[$listname])) { $RIFFchunk[$listname] = array(); } $LISTchunkParent = $listname; $LISTchunkMaxOffset = $this->ftell() - 4 + $chunksize; if ($parsedChunk = $this->ParseRIFF($this->ftell(), $LISTchunkMaxOffset)) { $RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk); } } break; default: if (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname)) { $this->fseek($chunksize, SEEK_CUR); break; } $thisindex = 0; if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) { $thisindex = count($RIFFchunk[$chunkname]); } $RIFFchunk[$chunkname][$thisindex]['offset'] = $this->ftell() - 8; $RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize; switch ($chunkname) { case 'data': $info['avdataoffset'] = $this->ftell(); $info['avdataend'] = $info['avdataoffset'] + $chunksize; $testData = $this->fread(36); if ($testData === '') { break; } if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($testData, 0, 4))) { if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($testData, 0, 4))) { $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; $getid3_temp->info['avdataend'] = $info['avdataend']; $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__); $getid3_mp3->getOnlyMPEGaudioInfo($info['avdataoffset'], false); if (empty($getid3_temp->info['error'])) { $info['audio'] = $getid3_temp->info['audio']; $info['mpeg'] = $getid3_temp->info['mpeg']; } unset($getid3_temp, $getid3_mp3); } } elseif (($isRegularAC3 = (substr($testData, 0, 2) == $AC3syncwordBytes)) || substr($testData, 8, 2) == strrev($AC3syncwordBytes)) { $getid3_temp = new getID3(); if ($isRegularAC3) { $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; $getid3_temp->info['avdataend'] = $info['avdataend']; } $getid3_ac3 = new getid3_ac3($getid3_temp); if ($isRegularAC3) { $getid3_ac3->Analyze(); } else { $ac3_data = ''; for ($i = 0; $i < 28; $i += 2) { $ac3_data .= substr($testData, 8 + $i + 1, 1); $ac3_data .= substr($testData, 8 + $i + 0, 1); } $getid3_ac3->getid3->info['avdataoffset'] = 0; $getid3_ac3->getid3->info['avdataend'] = strlen($ac3_data); $getid3_ac3->AnalyzeString($ac3_data); } if (empty($getid3_temp->info['error'])) { $info['audio'] = $getid3_temp->info['audio']; $info['ac3'] = $getid3_temp->info['ac3']; if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $newerror) { $this->warning('getid3_ac3() says: ['.$newerror.']'); } } } unset($getid3_temp, $getid3_ac3); } elseif (preg_match('/^('.implode('|', array_map('preg_quote', getid3_dts::$syncwords)).')/', $testData)) { $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; $getid3_dts = new getid3_dts($getid3_temp); $getid3_dts->Analyze(); if (empty($getid3_temp->info['error'])) { $info['audio'] = $getid3_temp->info['audio']; $info['dts'] = $getid3_temp->info['dts']; $info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $newerror) { $this->warning('getid3_dts() says: ['.$newerror.']'); } } } unset($getid3_temp, $getid3_dts); } elseif (substr($testData, 0, 4) == 'wvpk') { $info['wavpack']['offset'] = $info['avdataoffset']; $info['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($testData, 4, 4)); $this->parseWavPackHeader(substr($testData, 8, 28)); } else { } $nextoffset = $info['avdataend']; $this->fseek($nextoffset); break; case 'iXML': case 'bext': case 'cart': case 'fmt ': case 'strh': case 'strf': case 'indx': case 'MEXT': case 'DISP': case 'wamd': case 'guan': case 'JUNK': if ($chunksize < 1048576) { if ($chunksize > 0) { $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); if ($chunkname == 'JUNK') { if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) { $info['riff']['comments']['junk'][] = trim($matches[1]); } unset($RIFFchunk[$chunkname][$thisindex]['data']); } } } else { $this->warning('Chunk "'.$chunkname.'" at offset '.$this->ftell().' is unexpectedly larger than 1MB (claims to be '.number_format($chunksize).' bytes), skipping data'); $this->fseek($chunksize, SEEK_CUR); } break; case 'scot': $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); $RIFFchunk[$chunkname][$thisindex]['parsed']['alter'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 0, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['attrib'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 1, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['artnum'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 2, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['title'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 4, 43); $RIFFchunk[$chunkname][$thisindex]['parsed']['copy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 47, 4); $RIFFchunk[$chunkname][$thisindex]['parsed']['padd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 51, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['asclen'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 52, 5); $RIFFchunk[$chunkname][$thisindex]['parsed']['startseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 57, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['starthundredths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 59, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['endseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 61, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['endhundreths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 63, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['sdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 65, 6); $RIFFchunk[$chunkname][$thisindex]['parsed']['kdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 71, 6); $RIFFchunk[$chunkname][$thisindex]['parsed']['start_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 77, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['kill_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 78, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['digital'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 79, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 80, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['stereo'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 82, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['compress'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 83, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['eomstrt'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 84, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['eomlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 88, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['attrib2'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 90, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['future1'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 94, 12); $RIFFchunk[$chunkname][$thisindex]['parsed']['catfontcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 106, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['catcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 110, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['segeompos'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 114, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['vt_startsecs'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 118, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['vt_starthunds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 120, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['priorcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 122, 3); $RIFFchunk[$chunkname][$thisindex]['parsed']['priorcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 125, 4); $RIFFchunk[$chunkname][$thisindex]['parsed']['priorpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 129, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['postcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 130, 3); $RIFFchunk[$chunkname][$thisindex]['parsed']['postcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 133, 4); $RIFFchunk[$chunkname][$thisindex]['parsed']['postpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 137, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['hrcanplay'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 138, 21); $RIFFchunk[$chunkname][$thisindex]['parsed']['future2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 159, 108); $RIFFchunk[$chunkname][$thisindex]['parsed']['artist'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 267, 34); $RIFFchunk[$chunkname][$thisindex]['parsed']['comment'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 301, 34); $RIFFchunk[$chunkname][$thisindex]['parsed']['intro'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 335, 2); $RIFFchunk[$chunkname][$thisindex]['parsed']['end'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 337, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['year'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 338, 4); $RIFFchunk[$chunkname][$thisindex]['parsed']['obsolete2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 342, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['rec_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 343, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['rdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 344, 6); $RIFFchunk[$chunkname][$thisindex]['parsed']['mpeg_bitrate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 350, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['pitch'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 352, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['playlevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 354, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['lenvalid'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 356, 1); $RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 357, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['newplaylevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 361, 2)); $RIFFchunk[$chunkname][$thisindex]['parsed']['chopsize'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 363, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['vteomovr'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 367, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['desiredlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 371, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['triggers'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 375, 4)); $RIFFchunk[$chunkname][$thisindex]['parsed']['fillout'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 379, 33); foreach (array('title', 'artist', 'comment') as $key) { if (trim($RIFFchunk[$chunkname][$thisindex]['parsed'][$key])) { $info['riff']['comments'][$key] = array($RIFFchunk[$chunkname][$thisindex]['parsed'][$key]); } } if ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] && !empty($info['filesize']) && ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] != $info['filesize'])) { $this->warning('RIFF.WAVE.scot.filelength ('.$RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'].') different from actual filesize ('.$info['filesize'].')'); } break; default: if (!empty($LISTchunkParent) && isset($LISTchunkMaxOffset) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; unset($RIFFchunk[$chunkname][$thisindex]['offset']); unset($RIFFchunk[$chunkname][$thisindex]['size']); if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) { unset($RIFFchunk[$chunkname][$thisindex]); } if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) { unset($RIFFchunk[$chunkname]); } $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = $this->fread($chunksize); } elseif ($chunksize < 2048) { $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); } else { $this->fseek($chunksize, SEEK_CUR); } break; } break; } } } catch (getid3_exception $e) { if ($e->getCode() == 10) { $this->warning('RIFF parser: '.$e->getMessage()); } else { throw $e; } } return $RIFFchunk; } public function ParseRIFFdata(&$RIFFdata) { $info = &$this->getid3->info; if ($RIFFdata) { $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3'); $fp_temp = fopen($tempfile, 'wb'); $RIFFdataLength = strlen($RIFFdata); $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4); for ($i = 0; $i < 4; $i++) { $RIFFdata[($i + 4)] = $NewLengthString[$i]; } fwrite($fp_temp, $RIFFdata); fclose($fp_temp); $getid3_temp = new getID3(); $getid3_temp->openfile($tempfile); $getid3_temp->info['filesize'] = $RIFFdataLength; $getid3_temp->info['filenamepath'] = $info['filenamepath']; $getid3_temp->info['tags'] = $info['tags']; $getid3_temp->info['warning'] = $info['warning']; $getid3_temp->info['error'] = $info['error']; $getid3_temp->info['comments'] = $info['comments']; $getid3_temp->info['audio'] = (isset($info['audio']) ? $info['audio'] : array()); $getid3_temp->info['video'] = (isset($info['video']) ? $info['video'] : array()); $getid3_riff = new getid3_riff($getid3_temp); $getid3_riff->Analyze(); $info['riff'] = $getid3_temp->info['riff']; $info['warning'] = $getid3_temp->info['warning']; $info['error'] = $getid3_temp->info['error']; $info['tags'] = $getid3_temp->info['tags']; $info['comments'] = $getid3_temp->info['comments']; unset($getid3_riff, $getid3_temp); unlink($tempfile); } return false; } public static function parseComments(&$RIFFinfoArray, &$CommentsTargetArray) { $RIFFinfoKeyLookup = array( 'IARL'=>'archivallocation', 'IART'=>'artist', 'ICDS'=>'costumedesigner', 'ICMS'=>'commissionedby', 'ICMT'=>'comment', 'ICNT'=>'country', 'ICOP'=>'copyright', 'ICRD'=>'creationdate', 'IDIM'=>'dimensions', 'IDIT'=>'digitizationdate', 'IDPI'=>'resolution', 'IDST'=>'distributor', 'IEDT'=>'editor', 'IENG'=>'engineers', 'IFRM'=>'accountofparts', 'IGNR'=>'genre', 'IKEY'=>'keywords', 'ILGT'=>'lightness', 'ILNG'=>'language', 'IMED'=>'orignalmedium', 'IMUS'=>'composer', 'INAM'=>'title', 'IPDS'=>'productiondesigner', 'IPLT'=>'palette', 'IPRD'=>'product', 'IPRO'=>'producer', 'IPRT'=>'part', 'IRTD'=>'rating', 'ISBJ'=>'subject', 'ISFT'=>'software', 'ISGN'=>'secondarygenre', 'ISHP'=>'sharpness', 'ISRC'=>'sourcesupplier', 'ISRF'=>'digitizationsource', 'ISTD'=>'productionstudio', 'ISTR'=>'starring', 'ITCH'=>'encoded_by', 'IWEB'=>'url', 'IWRI'=>'writer', '____'=>'comment', ); foreach ($RIFFinfoKeyLookup as $key => $value) { if (isset($RIFFinfoArray[$key])) { foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { if (trim($commentdata['data']) != '') { if (isset($CommentsTargetArray[$value])) { $CommentsTargetArray[$value][] = trim($commentdata['data']); } else { $CommentsTargetArray[$value] = array(trim($commentdata['data'])); } } } } } return true; } public static function parseWAVEFORMATex($WaveFormatExData) { $WaveFormatEx = array(); $WaveFormatEx['raw'] = array(); $WaveFormatEx_raw = &$WaveFormatEx['raw']; $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); $WaveFormatEx_raw['nBlockAlign'] = substr($WaveFormatExData, 12, 2); $WaveFormatEx_raw['wBitsPerSample'] = substr($WaveFormatExData, 14, 2); if (strlen($WaveFormatExData) > 16) { $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); } $WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw); $WaveFormatEx['codec'] = self::wFormatTagLookup($WaveFormatEx_raw['wFormatTag']); $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels']; $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec']; $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8; $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample']; return $WaveFormatEx; } public function parseWavPackHeader($WavPackChunkData) { $info = &$this->getid3->info; $info['wavpack'] = array(); $thisfile_wavpack = &$info['wavpack']; $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); if ($thisfile_wavpack['version'] >= 2) { $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); } if ($thisfile_wavpack['version'] >= 3) { $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); for ($i = 0; $i <= 2; $i++) { $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); } $thisfile_wavpack['flags'] = array(); $thisfile_wavpack_flags = &$thisfile_wavpack['flags']; $thisfile_wavpack_flags['mono'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001); $thisfile_wavpack_flags['fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002); $thisfile_wavpack_flags['raw_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004); $thisfile_wavpack_flags['calc_noise'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008); $thisfile_wavpack_flags['high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010); $thisfile_wavpack_flags['3_byte_samples'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020); $thisfile_wavpack_flags['over_20_bits'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040); $thisfile_wavpack_flags['use_wvc'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080); $thisfile_wavpack_flags['noiseshaping'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100); $thisfile_wavpack_flags['very_fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200); $thisfile_wavpack_flags['new_high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400); $thisfile_wavpack_flags['cancel_extreme'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800); $thisfile_wavpack_flags['cross_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000); $thisfile_wavpack_flags['new_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000); $thisfile_wavpack_flags['joint_stereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000); $thisfile_wavpack_flags['extra_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000); $thisfile_wavpack_flags['override_noiseshape'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000); $thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000); $thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000); $thisfile_wavpack_flags['create_exe'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000); } return true; } public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { $parsed = array(); $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); $parsed['biPlanes'] = substr($BITMAPINFOHEADER, 12, 2); $parsed['biBitCount'] = substr($BITMAPINFOHEADER, 14, 2); $parsed['biSizeImage'] = substr($BITMAPINFOHEADER, 20, 4); $parsed['biXPelsPerMeter'] = substr($BITMAPINFOHEADER, 24, 4); $parsed['biYPelsPerMeter'] = substr($BITMAPINFOHEADER, 28, 4); $parsed['biClrUsed'] = substr($BITMAPINFOHEADER, 32, 4); $parsed['biClrImportant'] = substr($BITMAPINFOHEADER, 36, 4); $parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed); $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); return $parsed; } public static function ParseDIVXTAG($DIVXTAG, $raw=false) { static $DIVXTAGgenre = array( 0 => 'Action', 1 => 'Action/Adventure', 2 => 'Adventure', 3 => 'Adult', 4 => 'Anime', 5 => 'Cartoon', 6 => 'Claymation', 7 => 'Comedy', 8 => 'Commercial', 9 => 'Documentary', 10 => 'Drama', 11 => 'Home Video', 12 => 'Horror', 13 => 'Infomercial', 14 => 'Interactive', 15 => 'Mystery', 16 => 'Music Video', 17 => 'Other', 18 => 'Religion', 19 => 'Sci Fi', 20 => 'Thriller', 21 => 'Western', ), $DIVXTAGrating = array( 0 => 'Unrated', 1 => 'G', 2 => 'PG', 3 => 'PG-13', 4 => 'R', 5 => 'NC-17', ); $parsed = array(); $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']); if (!$raw) { unset($parsed['genre_id'], $parsed['rating_id']); foreach ($parsed as $key => $value) { if (empty($value)) { unset($parsed[$key]); } } } foreach ($parsed as $tag => $value) { $parsed[$tag] = array($value); } return $parsed; } public static function waveSNDMtagLookup($tagshortname) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm'); } public static function wFormatTagLookup($wFormatTag) { $begin = __LINE__; return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); } public static function fourccLookup($fourcc) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); } private function EitherEndian2Int($byteword, $signed=false) { if ($this->container == 'riff') { return getid3_lib::LittleEndian2Int($byteword, $signed); } return getid3_lib::BigEndian2Int($byteword, false, $signed); } } getid3->info; $this->fseek($info['avdataoffset']); $StreamMarker = $this->fread(4); if ($StreamMarker != self::syncword) { return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"'); } $info['fileformat'] = 'flac'; $info['audio']['dataformat'] = 'flac'; $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['lossless'] = true; return $this->parseMETAdata(); } public function parseMETAdata() { $info = &$this->getid3->info; do { $BlockOffset = $this->ftell(); $BlockHeader = $this->fread(4); $LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1)); $LastBlockFlag = (bool) ($LBFBT & 0x80); $BlockType = ($LBFBT & 0x7F); $BlockLength = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3)); $BlockTypeText = self::metaBlockTypeLookup($BlockType); if (($BlockOffset + 4 + $BlockLength) > $info['avdataend']) { $this->warning('METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockTypeText.') at offset '.$BlockOffset.' extends beyond end of file'); break; } if ($BlockLength < 1) { if ($BlockTypeText != 'reserved') { $this->warning('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockTypeText.') at offset '.$BlockOffset.' is zero bytes'); continue; } $this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid'); break; } $info['flac'][$BlockTypeText]['raw'] = array(); $BlockTypeText_raw = &$info['flac'][$BlockTypeText]['raw']; $BlockTypeText_raw['offset'] = $BlockOffset; $BlockTypeText_raw['last_meta_block'] = $LastBlockFlag; $BlockTypeText_raw['block_type'] = $BlockType; $BlockTypeText_raw['block_type_text'] = $BlockTypeText; $BlockTypeText_raw['block_length'] = $BlockLength; if ($BlockTypeText_raw['block_type'] != 0x06) { $BlockTypeText_raw['block_data'] = $this->fread($BlockLength); } switch ($BlockTypeText) { case 'STREAMINFO': if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) { return false; } break; case 'PADDING': unset($info['flac']['PADDING']); break; case 'APPLICATION': if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) { return false; } break; case 'SEEKTABLE': if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) { return false; } break; case 'VORBIS_COMMENT': if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { return false; } break; case 'CUESHEET': if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) { return false; } break; case 'PICTURE': if (!$this->parsePICTURE()) { return false; } break; default: $this->warning('Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockType.') at offset '.$BlockOffset); } unset($info['flac'][$BlockTypeText]['raw']); $info['avdataoffset'] = $this->ftell(); } while ($LastBlockFlag === false); if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) { $info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments']; } if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) { $info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']); } if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) { foreach ($info['flac']['PICTURE'] as $entry) { if (!empty($entry['data'])) { if (!isset($info['flac']['comments']['picture'])) { $info['flac']['comments']['picture'] = array(); } $comments_picture_data = array(); foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { if (isset($entry[$picture_key])) { $comments_picture_data[$picture_key] = $entry[$picture_key]; } } $info['flac']['comments']['picture'][] = $comments_picture_data; unset($comments_picture_data); } } } if (isset($info['flac']['STREAMINFO'])) { if (!$this->isDependencyFor('matroska')) { $info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset']; } $info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8); if ($info['flac']['uncompressed_audio_bytes'] == 0) { return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero'); } if (!empty($info['flac']['compressed_audio_bytes'])) { $info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes']; } } if (isset($info['flac']['STREAMINFO']['audio_signature'])) { if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); } else { $info['md5_data_source'] = ''; $md5 = $info['flac']['STREAMINFO']['audio_signature']; for ($i = 0; $i < strlen($md5); $i++) { $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); } if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { unset($info['md5_data_source']); } } } if (isset($info['flac']['STREAMINFO']['bits_per_sample'])) { $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; if ($info['audio']['bits_per_sample'] == 8) { $this->warning('FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file'); } } return true; } public static function parseSTREAMINFOdata($BlockData) { $streaminfo = array(); $streaminfo['min_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 0, 2)); $streaminfo['max_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 2, 2)); $streaminfo['min_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 4, 3)); $streaminfo['max_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3)); $SRCSBSS = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8)); $streaminfo['sample_rate'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20)); $streaminfo['channels'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1; $streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1; $streaminfo['samples_stream'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36)); $streaminfo['audio_signature'] = substr($BlockData, 18, 16); return $streaminfo; } private function parseSTREAMINFO($BlockData) { $info = &$this->getid3->info; $info['flac']['STREAMINFO'] = self::parseSTREAMINFOdata($BlockData); if (!empty($info['flac']['STREAMINFO']['sample_rate'])) { $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['sample_rate'] = $info['flac']['STREAMINFO']['sample_rate']; $info['audio']['channels'] = $info['flac']['STREAMINFO']['channels']; $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; $info['playtime_seconds'] = $info['flac']['STREAMINFO']['samples_stream'] / $info['flac']['STREAMINFO']['sample_rate']; if ($info['playtime_seconds'] > 0) { if (!$this->isDependencyFor('matroska')) { $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } else { $this->warning('Cannot determine audio bitrate because total stream size is unknown'); } } } else { return $this->error('Corrupt METAdata block: STREAMINFO'); } return true; } private function parseAPPLICATION($BlockData) { $info = &$this->getid3->info; $ApplicationID = getid3_lib::BigEndian2Int(substr($BlockData, 0, 4)); $info['flac']['APPLICATION'][$ApplicationID]['name'] = self::applicationIDLookup($ApplicationID); $info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($BlockData, 4); return true; } private function parseSEEKTABLE($BlockData) { $info = &$this->getid3->info; $offset = 0; $BlockLength = strlen($BlockData); $placeholderpattern = str_repeat("\xFF", 8); while ($offset < $BlockLength) { $SampleNumberString = substr($BlockData, $offset, 8); $offset += 8; if ($SampleNumberString == $placeholderpattern) { getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1); $offset += 10; } else { $SampleNumber = getid3_lib::BigEndian2Int($SampleNumberString); $info['flac']['SEEKTABLE'][$SampleNumber]['offset'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 2)); $offset += 2; } } return true; } private function parseVORBIS_COMMENT($BlockData) { $info = &$this->getid3->info; $getid3_ogg = new getid3_ogg($this->getid3); if ($this->isDependencyFor('matroska')) { $getid3_ogg->setStringMode($this->data_string); } $getid3_ogg->ParseVorbisComments(); if (isset($info['ogg'])) { unset($info['ogg']['comments_raw']); $info['flac']['VORBIS_COMMENT'] = $info['ogg']; unset($info['ogg']); } unset($getid3_ogg); return true; } private function parseCUESHEET($BlockData) { $info = &$this->getid3->info; $offset = 0; $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0"); $offset += 128; $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $info['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80); $offset += 1; $offset += 258; $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) { $TrackSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $TrackNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($BlockData, $offset, 12); $offset += 12; $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio'] = (bool) ($TrackFlagsRaw & 0x80); $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40); $offset += 13; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) { $IndexSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $IndexNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $offset += 3; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset; } } return true; } public function parsePICTURE() { $info = &$this->getid3->info; $picture = array(); $picture['typeid'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['picturetype'] = self::pictureTypeLookup($picture['typeid']); $picture['image_mime'] = $this->fread(getid3_lib::BigEndian2Int($this->fread(4))); $descr_length = getid3_lib::BigEndian2Int($this->fread(4)); if ($descr_length) { $picture['description'] = $this->fread($descr_length); } $picture['image_width'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['image_height'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['color_depth'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['datalength'] = getid3_lib::BigEndian2Int($this->fread(4)); if ($picture['image_mime'] == '-->') { $picture['data'] = $this->fread($picture['datalength']); } else { $picture['data'] = $this->saveAttachment( str_replace('/', '_', $picture['picturetype']).'_'.$this->ftell(), $this->ftell(), $picture['datalength'], $picture['image_mime']); } $info['flac']['PICTURE'][] = $picture; return true; } public static function metaBlockTypeLookup($blocktype) { static $lookup = array( 0 => 'STREAMINFO', 1 => 'PADDING', 2 => 'APPLICATION', 3 => 'SEEKTABLE', 4 => 'VORBIS_COMMENT', 5 => 'CUESHEET', 6 => 'PICTURE', ); return (isset($lookup[$blocktype]) ? $lookup[$blocktype] : 'reserved'); } public static function applicationIDLookup($applicationid) { static $lookup = array( 0x41544348 => 'FlacFile', 0x42534F4C => 'beSolo', 0x42554753 => 'Bugs Player', 0x43756573 => 'GoldWave cue points (specification)', 0x46696361 => 'CUE Splitter', 0x46746F6C => 'flac-tools', 0x4D4F5442 => 'MOTB MetaCzar', 0x4D505345 => 'MP3 Stream Editor', 0x4D754D4C => 'MusicML: Music Metadata Language', 0x52494646 => 'Sound Devices RIFF chunk storage', 0x5346464C => 'Sound Font FLAC', 0x534F4E59 => 'Sony Creative Software', 0x5351455A => 'flacsqueeze', 0x54745776 => 'TwistedWave', 0x55495453 => 'UITS Embedding tools', 0x61696666 => 'FLAC AIFF chunk storage', 0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', 0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', 0x71667374 => 'QFLAC Studio', 0x72696666 => 'FLAC RIFF chunk storage', 0x74756E65 => 'TagTuner', 0x78626174 => 'XBAT', 0x786D6364 => 'xmcd', ); return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved'); } public static function pictureTypeLookup($type_id) { static $lookup = array ( 0 => 'Other', 1 => '32x32 pixels \'file icon\' (PNG only)', 2 => 'Other file icon', 3 => 'Cover (front)', 4 => 'Cover (back)', 5 => 'Leaflet page', 6 => 'Media (e.g. label side of CD)', 7 => 'Lead artist/lead performer/soloist', 8 => 'Artist/performer', 9 => 'Conductor', 10 => 'Band/Orchestra', 11 => 'Composer', 12 => 'Lyricist/text writer', 13 => 'Recording Location', 14 => 'During recording', 15 => 'During performance', 16 => 'Movie/video screen capture', 17 => 'A bright coloured fish', 18 => 'Illustration', 19 => 'Band/artist logotype', 20 => 'Publisher/Studio logotype', ); return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved'); } } getid3->info; if (!getid3_lib::intValueSupported($info['filesize'])) { $this->warning('Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); return false; } $id3v1tagsize = 128; $apetagheadersize = 32; $lyrics3tagsize = 10; if ($this->overrideendoffset == 0) { $this->fseek(0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END); $APEfooterID3v1 = $this->fread($id3v1tagsize + $apetagheadersize + $lyrics3tagsize); if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') { $info['ape']['tag_offset_end'] = $info['filesize'] - $id3v1tagsize; } elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') { $info['ape']['tag_offset_end'] = $info['filesize']; } } else { $this->fseek($this->overrideendoffset - $apetagheadersize); if ($this->fread(8) == 'APETAGEX') { $info['ape']['tag_offset_end'] = $this->overrideendoffset; } } if (!isset($info['ape']['tag_offset_end'])) { unset($info['ape']); return false; } $thisfile_ape = &$info['ape']; $this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize); $APEfooterData = $this->fread(32); if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { $this->error('Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end']); return false; } if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { $this->fseek($thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize); $thisfile_ape['tag_offset_start'] = $this->ftell(); $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize); } else { $thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize']; $this->fseek($thisfile_ape['tag_offset_start']); $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize']); } $info['avdataend'] = $thisfile_ape['tag_offset_start']; if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) { $this->warning('ID3v1 tag information ignored since it appears to be a false synch in APEtag data'); unset($info['id3v1']); foreach ($info['warning'] as $key => $value) { if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { unset($info['warning'][$key]); sort($info['warning']); break; } } } $offset = 0; if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) { $offset += $apetagheadersize; } else { $this->error('Error parsing APE header at offset '.$thisfile_ape['tag_offset_start']); return false; } } $info['replay_gain'] = array(); $thisfile_replaygain = &$info['replay_gain']; for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) { $value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); $offset += 4; $item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); $offset += 4; if (strstr(substr($APEtagData, $offset), "\x00") === false) { $this->error('Cannot find null-byte (0x00) separator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset)); return false; } $ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset; $item_key = strtolower(substr($APEtagData, $offset, $ItemKeyLength)); $thisfile_ape['items'][$item_key] = array(); $thisfile_ape_items_current = &$thisfile_ape['items'][$item_key]; $thisfile_ape_items_current['offset'] = $thisfile_ape['tag_offset_start'] + $offset; $offset += ($ItemKeyLength + 1); $thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size); $offset += $value_size; $thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags); switch ($thisfile_ape_items_current['flags']['item_contents_raw']) { case 0: case 2: $thisfile_ape_items_current['data'] = explode("\x00", $thisfile_ape_items_current['data']); break; case 1: default: break; } switch (strtolower($item_key)) { case 'replaygain_track_gain': if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) { $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $matches[1]); $thisfile_replaygain['track']['originator'] = 'unspecified'; } else { $this->warning('MP3gainTrackGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'replaygain_track_peak': if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) { $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $matches[1]); $thisfile_replaygain['track']['originator'] = 'unspecified'; if ($thisfile_replaygain['track']['peak'] <= 0) { $this->warning('ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); } } else { $this->warning('MP3gainTrackPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'replaygain_album_gain': if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) { $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $matches[1]); $thisfile_replaygain['album']['originator'] = 'unspecified'; } else { $this->warning('MP3gainAlbumGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'replaygain_album_peak': if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) { $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $matches[1]); $thisfile_replaygain['album']['originator'] = 'unspecified'; if ($thisfile_replaygain['album']['peak'] <= 0) { $this->warning('ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); } } else { $this->warning('MP3gainAlbumPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'mp3gain_undo': if (preg_match('#^[\\-\\+][0-9]{3},[\\-\\+][0-9]{3},[NW]$#', $thisfile_ape_items_current['data'][0])) { list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]); $thisfile_replaygain['mp3gain']['undo_left'] = intval($mp3gain_undo_left); $thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right); $thisfile_replaygain['mp3gain']['undo_wrap'] = (($mp3gain_undo_wrap == 'Y') ? true : false); } else { $this->warning('MP3gainUndo value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'mp3gain_minmax': if (preg_match('#^[0-9]{3},[0-9]{3}$#', $thisfile_ape_items_current['data'][0])) { list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]); $thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min); $thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max); } else { $this->warning('MP3gainMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'mp3gain_album_minmax': if (preg_match('#^[0-9]{3},[0-9]{3}$#', $thisfile_ape_items_current['data'][0])) { list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]); $thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min); $thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max); } else { $this->warning('MP3gainAlbumMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); } break; case 'tracknumber': if (is_array($thisfile_ape_items_current['data'])) { foreach ($thisfile_ape_items_current['data'] as $comment) { $thisfile_ape['comments']['track_number'][] = $comment; } } break; case 'cover art (artist)': case 'cover art (back)': case 'cover art (band logo)': case 'cover art (band)': case 'cover art (colored fish)': case 'cover art (composer)': case 'cover art (conductor)': case 'cover art (front)': case 'cover art (icon)': case 'cover art (illustration)': case 'cover art (lead)': case 'cover art (leaflet)': case 'cover art (lyricist)': case 'cover art (media)': case 'cover art (movie scene)': case 'cover art (other icon)': case 'cover art (other)': case 'cover art (performance)': case 'cover art (publisher logo)': case 'cover art (recording)': case 'cover art (studio)': if (is_array($thisfile_ape_items_current['data'])) { $this->warning('APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8'); $thisfile_ape_items_current['data'] = implode("\x00", $thisfile_ape_items_current['data']); } list($thisfile_ape_items_current['filename'], $thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2); $thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00"); $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']); do { $thisfile_ape_items_current['image_mime'] = ''; $imageinfo = array(); $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo); if (($imagechunkcheck === false) || !isset($imagechunkcheck[2])) { $this->warning('APEtag "'.$item_key.'" contains invalid image data'); break; } $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); if ($this->inline_attachments === false) { unset($thisfile_ape_items_current['data']); break; } if ($this->inline_attachments === true) { } elseif (is_int($this->inline_attachments)) { if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) { $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)'); unset($thisfile_ape_items_current['data']); break; } } elseif (is_string($this->inline_attachments)) { $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR); if (!is_dir($this->inline_attachments) || !getID3::is_writable($this->inline_attachments)) { $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)'); unset($thisfile_ape_items_current['data']); break; } } if (is_string($this->inline_attachments)) { $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset']; if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) { file_put_contents($destination_filename, $thisfile_ape_items_current['data']); } else { $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)'); } $thisfile_ape_items_current['data_filename'] = $destination_filename; unset($thisfile_ape_items_current['data']); } else { if (!isset($info['ape']['comments']['picture'])) { $info['ape']['comments']['picture'] = array(); } $comments_picture_data = array(); foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { if (isset($thisfile_ape_items_current[$picture_key])) { $comments_picture_data[$picture_key] = $thisfile_ape_items_current[$picture_key]; } } $info['ape']['comments']['picture'][] = $comments_picture_data; unset($comments_picture_data); } } while (false); break; default: if (is_array($thisfile_ape_items_current['data'])) { foreach ($thisfile_ape_items_current['data'] as $comment) { $thisfile_ape['comments'][strtolower($item_key)][] = $comment; } } break; } } if (empty($thisfile_replaygain)) { unset($info['replay_gain']); } return true; } public function parseAPEheaderFooter($APEheaderFooterData) { $headerfooterinfo = array(); $headerfooterinfo['raw'] = array(); $headerfooterinfo_raw = &$headerfooterinfo['raw']; $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8); if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') { return false; } $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4)); $headerfooterinfo_raw['tagsize'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4)); $headerfooterinfo_raw['tag_items'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4)); $headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4)); $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8); $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000; if ($headerfooterinfo['tag_version'] >= 2) { $headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']); } return $headerfooterinfo; } public function parseAPEtagFlags($rawflagint) { $flags = array(); $flags['header'] = (bool) ($rawflagint & 0x80000000); $flags['footer'] = (bool) ($rawflagint & 0x40000000); $flags['this_is_header'] = (bool) ($rawflagint & 0x20000000); $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1; $flags['read_only'] = (bool) ($rawflagint & 0x00000001); $flags['item_contents'] = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']); return $flags; } public function APEcontentTypeFlagLookup($contenttypeid) { static $APEcontentTypeFlagLookup = array( 0 => 'utf-8', 1 => 'binary', 2 => 'external', 3 => 'reserved' ); return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid'); } public function APEtagItemIsUTF8Lookup($itemkey) { static $APEtagItemIsUTF8Lookup = array( 'title', 'subtitle', 'artist', 'album', 'debut album', 'publisher', 'conductor', 'track', 'composer', 'comment', 'copyright', 'publicationright', 'file', 'year', 'record date', 'record location', 'genre', 'media', 'related', 'isrc', 'abstract', 'language', 'bibliography' ); return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup); } } getid3->info; $info['id3v2']['header'] = true; $thisfile_id3v2 = &$info['id3v2']; $thisfile_id3v2['flags'] = array(); $thisfile_id3v2_flags = &$thisfile_id3v2['flags']; $this->fseek($this->StartingOffset); $header = $this->fread(10); if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { $thisfile_id3v2['majorversion'] = ord($header[3]); $thisfile_id3v2['minorversion'] = ord($header[4]); $id3v2_majorversion = &$thisfile_id3v2['majorversion']; } else { unset($info['id3v2']); return false; } if ($id3v2_majorversion > 4) { $this->error('this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion']); return false; } $id3_flags = ord($header[5]); switch ($id3v2_majorversion) { case 2: $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); $thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); break; case 3: $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); break; case 4: $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); $thisfile_id3v2_flags['isfooter'] = (bool) ($id3_flags & 0x10); break; } $thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; $thisfile_id3v2['tag_offset_start'] = $this->StartingOffset; $thisfile_id3v2['tag_offset_end'] = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength']; $thisfile_id3v2['encoding'] = 'UTF-8'; $sizeofframes = $thisfile_id3v2['headerlength'] - 10; if (!empty($thisfile_id3v2['exthead']['length'])) { $sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4); } if (!empty($thisfile_id3v2_flags['isfooter'])) { $sizeofframes -= 10; } if ($sizeofframes > 0) { $framedata = $this->fread($sizeofframes); if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) { $framedata = $this->DeUnsynchronise($framedata); } $framedataoffset = 10; if (!empty($thisfile_id3v2_flags['exthead'])) { $extended_header_offset = 0; if ($id3v2_majorversion == 3) { $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0); $extended_header_offset += 4; $thisfile_id3v2['exthead']['flag_bytes'] = 2; $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000); $thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); $extended_header_offset += 4; if ($thisfile_id3v2['exthead']['flags']['crc']) { $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); $extended_header_offset += 4; } $extended_header_offset += $thisfile_id3v2['exthead']['padding_size']; } elseif ($id3v2_majorversion == 4) { $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), true); $extended_header_offset += 4; $thisfile_id3v2['exthead']['flag_bytes'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); $extended_header_offset += 1; $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; $thisfile_id3v2['exthead']['flags']['update'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x40); $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x20); $thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x10); if ($thisfile_id3v2['exthead']['flags']['update']) { $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); $extended_header_offset += 1; } if ($thisfile_id3v2['exthead']['flags']['crc']) { $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); $extended_header_offset += 1; $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $ext_header_chunk_length), true, false); $extended_header_offset += $ext_header_chunk_length; } if ($thisfile_id3v2['exthead']['flags']['restrictions']) { $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); $extended_header_offset += 1; $restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); $extended_header_offset += 1; $thisfile_id3v2['exthead']['flags']['restrictions']['tagsize'] = ($restrictions_raw & 0xC0) >> 6; $thisfile_id3v2['exthead']['flags']['restrictions']['textenc'] = ($restrictions_raw & 0x20) >> 5; $thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw & 0x18) >> 3; $thisfile_id3v2['exthead']['flags']['restrictions']['imgenc'] = ($restrictions_raw & 0x04) >> 2; $thisfile_id3v2['exthead']['flags']['restrictions']['imgsize'] = ($restrictions_raw & 0x03) >> 0; $thisfile_id3v2['exthead']['flags']['restrictions_text']['tagsize'] = $this->LookupExtendedHeaderRestrictionsTagSizeLimits($thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']); $thisfile_id3v2['exthead']['flags']['restrictions_text']['textenc'] = $this->LookupExtendedHeaderRestrictionsTextEncodings($thisfile_id3v2['exthead']['flags']['restrictions']['textenc']); $thisfile_id3v2['exthead']['flags']['restrictions_text']['textsize'] = $this->LookupExtendedHeaderRestrictionsTextFieldSize($thisfile_id3v2['exthead']['flags']['restrictions']['textsize']); $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgenc'] = $this->LookupExtendedHeaderRestrictionsImageEncoding($thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']); $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgsize'] = $this->LookupExtendedHeaderRestrictionsImageSizeSize($thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']); } if ($thisfile_id3v2['exthead']['length'] != $extended_header_offset) { $this->warning('ID3v2.4 extended header length mismatch (expecting '.intval($thisfile_id3v2['exthead']['length']).', found '.intval($extended_header_offset).')'); } } $framedataoffset += $extended_header_offset; $framedata = substr($framedata, $extended_header_offset); } while (isset($framedata) && (strlen($framedata) > 0)) { if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) { $thisfile_id3v2['padding']['start'] = $framedataoffset; $thisfile_id3v2['padding']['length'] = strlen($framedata); $thisfile_id3v2['padding']['valid'] = true; for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { if ($framedata[$i] != "\x00") { $thisfile_id3v2['padding']['valid'] = false; $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); break; } } break; } $frame_header = null; $frame_name = null; $frame_size = null; $frame_flags = null; if ($id3v2_majorversion == 2) { $frame_header = substr($framedata, 0, 6); $framedata = substr($framedata, 6); $frame_name = substr($frame_header, 0, 3); $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0); $frame_flags = 0; } elseif ($id3v2_majorversion > 2) { $frame_header = substr($framedata, 0, 10); $framedata = substr($framedata, 10); $frame_name = substr($frame_header, 0, 4); if ($id3v2_majorversion == 3) { $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); } else { $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); } if ($frame_size < (strlen($framedata) + 4)) { $nextFrameID = substr($framedata, $frame_size, 4); if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) { } elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) { } elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) { $this->warning('ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3'); $id3v2_majorversion = 3; $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); } } $frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2)); } if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) { $thisfile_id3v2['padding']['start'] = $framedataoffset; $thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata); $thisfile_id3v2['padding']['valid'] = true; $len = strlen($framedata); for ($i = 0; $i < $len; $i++) { if ($framedata[$i] != "\x00") { $thisfile_id3v2['padding']['valid'] = false; $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); break; } } break; } if ($iTunesBrokenFrameNameFixed = self::ID3v22iTunesBrokenFrameName($frame_name)) { $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1", "v7.0.0.70" are known-guilty, probably others too)]. Translated frame name from "'.str_replace("\x00", ' ', $frame_name).'" to "'.$iTunesBrokenFrameNameFixed.'" for parsing.'); $frame_name = $iTunesBrokenFrameNameFixed; } if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) { $parsedFrame = array(); $parsedFrame['frame_name'] = $frame_name; $parsedFrame['frame_flags_raw'] = $frame_flags; $parsedFrame['data'] = substr($framedata, 0, $frame_size); $parsedFrame['datalength'] = getid3_lib::CastAsInt($frame_size); $parsedFrame['dataoffset'] = $framedataoffset; $this->ParseID3v2Frame($parsedFrame); $thisfile_id3v2[$frame_name][] = $parsedFrame; $framedata = substr($framedata, $frame_size); } else { if ($frame_size <= strlen($framedata)) { if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) { $framedata = substr($framedata, $frame_size); $this->warning('Next ID3v2 frame is valid, skipping current frame.'); } else { $framedata = null; $this->error('Next ID3v2 frame is also invalid, aborting processing.'); } } elseif ($frame_size == strlen($framedata)) { $this->warning('This was the last ID3v2 frame.'); } else { $framedata = null; $this->warning('Invalid ID3v2 frame size, aborting.'); } if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { switch ($frame_name) { case "\x00\x00".'MP': case "\x00".'MP3': case ' MP3': case 'MP3e': case "\x00".'MP': case ' MP': case 'MP3': $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]'); break; default: $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).'); break; } } elseif (!isset($framedata) || ($frame_size > strlen($framedata))) { $this->error('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).'); } else { $this->error('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).'); } } $framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion)); } } if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) { $footer = $this->fread(10); if (substr($footer, 0, 3) == '3DI') { $thisfile_id3v2['footer'] = true; $thisfile_id3v2['majorversion_footer'] = ord($footer[3]); $thisfile_id3v2['minorversion_footer'] = ord($footer[4]); } if ($thisfile_id3v2['majorversion_footer'] <= 4) { $id3_flags = ord($footer[5]); $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); $thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10); $thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1); } } if (isset($thisfile_id3v2['comments']['genre'])) { $genres = array(); foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) { foreach ($this->ParseID3v2GenreString($value) as $genre) { $genres[] = $genre; } } $thisfile_id3v2['comments']['genre'] = array_unique($genres); unset($key, $value, $genres, $genre); } if (isset($thisfile_id3v2['comments']['track_number'])) { foreach ($thisfile_id3v2['comments']['track_number'] as $key => $value) { if (strstr($value, '/')) { list($thisfile_id3v2['comments']['track_number'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track_number'][$key]); } } } if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) { $thisfile_id3v2['comments']['year'] = array($matches[1]); } if (!empty($thisfile_id3v2['TXXX'])) { foreach ($thisfile_id3v2['TXXX'] as $txxx_array) { switch ($txxx_array['description']) { case 'replaygain_track_gain': if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) { $info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); } break; case 'replaygain_track_peak': if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) { $info['replay_gain']['track']['peak'] = floatval($txxx_array['data']); } break; case 'replaygain_album_gain': if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) { $info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); } break; } } } $info['avdataoffset'] = $thisfile_id3v2['headerlength']; if (isset($thisfile_id3v2['footer'])) { $info['avdataoffset'] += 10; } return true; } public function ParseID3v2GenreString($genrestring) { $clean_genres = array(); if (($this->getid3->info['id3v2']['majorversion'] == 3) && !preg_match('#[\x00]#', $genrestring)) { if (strpos($genrestring, '/') !== false) { $LegitimateSlashedGenreList = array( 'Pop/Funk', 'Cut-up/DJ', 'RnB/Swing', 'Funk / Soul', ); $genrestring = str_replace('/', "\x00", $genrestring); foreach ($LegitimateSlashedGenreList as $SlashedGenre) { $genrestring = str_ireplace(str_replace('/', "\x00", $SlashedGenre), $SlashedGenre, $genrestring); } } if (strpos($genrestring, ';') !== false) { $genrestring = str_replace(';', "\x00", $genrestring); } } if (strpos($genrestring, "\x00") === false) { $genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring); } $genre_elements = explode("\x00", $genrestring); foreach ($genre_elements as $element) { $element = trim($element); if ($element) { if (preg_match('#^[0-9]{1,3}$#', $element)) { $clean_genres[] = getid3_id3v1::LookupGenreName($element); } else { $clean_genres[] = str_replace('((', '(', $element); } } } return $clean_genres; } public function ParseID3v2Frame(&$parsedFrame) { $info = &$this->getid3->info; $id3v2_majorversion = $info['id3v2']['majorversion']; $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); if (empty($parsedFrame['framenamelong'])) { unset($parsedFrame['framenamelong']); } $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']); if (empty($parsedFrame['framenameshort'])) { unset($parsedFrame['framenameshort']); } if ($id3v2_majorversion >= 3) { if ($id3v2_majorversion == 3) { $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); } elseif ($id3v2_majorversion == 4) { $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); if ($parsedFrame['flags']['Unsynchronisation']) { $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']); } if ($parsedFrame['flags']['DataLengthIndicator']) { $parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1); $parsedFrame['data'] = substr($parsedFrame['data'], 4); } } if ($parsedFrame['flags']['compression']) { $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); if (!function_exists('gzuncompress')) { $this->warning('gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'); } else { if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { $parsedFrame['data'] = $decompresseddata; unset($decompresseddata); } else { $this->warning('gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"'); } } } } if (!empty($parsedFrame['flags']['DataLengthIndicator'])) { if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) { $this->warning('ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data'); } } if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) { $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion'; switch ($parsedFrame['frame_name']) { case 'WCOM': $warning .= ' (this is known to happen with files tagged by RioPort)'; break; default: break; } $this->warning($warning); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) { $exploded = explode("\x00", $parsedFrame['data'], 2); $parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : ''); $parsedFrame['data'] = (isset($exploded[1]) ? $exploded[1] : ''); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['description'])); $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); } else { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); } } } elseif ($parsedFrame['frame_name'][0] == 'T') { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); } $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { switch ($parsedFrame['encoding']) { case 'UTF-16': case 'UTF-16BE': case 'UTF-16LE': $wordsize = 2; break; case 'ISO-8859-1': case 'UTF-8': default: $wordsize = 1; break; } $Txxx_elements = array(); $Txxx_elements_start_offset = 0; for ($i = 0; $i < strlen($parsedFrame['data']); $i += $wordsize) { if (substr($parsedFrame['data'], $i, $wordsize) == str_repeat("\x00", $wordsize)) { $Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset); $Txxx_elements_start_offset = $i + $wordsize; } } $Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset); foreach ($Txxx_elements as $Txxx_element) { $string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element); if (!empty($string)) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string; } } unset($string, $wordsize, $i, $Txxx_elements, $Txxx_element, $Txxx_elements_start_offset); } } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['url'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); $parsedFrame['description'] = $this->RemoveStringTerminator($parsedFrame['description'], $frame_textencoding_terminator); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback('ISO-8859-1', $info['id3v2']['encoding'], $parsedFrame['url']); } unset($parsedFrame['data']); } elseif ($parsedFrame['frame_name'][0] == 'W') { $parsedFrame['url'] = trim($parsedFrame['data']); if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback('ISO-8859-1', $info['id3v2']['encoding'], $parsedFrame['url']); } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); } $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($parsedFrame['encodingid']); $parsedFrame['data_raw'] = (string) substr($parsedFrame['data'], $frame_offset); $IPLS_parts = array(); if (strpos($parsedFrame['data_raw'], "\x00") !== false) { $IPLS_parts_unsorted = array(); if (((strlen($parsedFrame['data_raw']) % 2) == 0) && ((substr($parsedFrame['data_raw'], 0, 2) == "\xFF\xFE") || (substr($parsedFrame['data_raw'], 0, 2) == "\xFE\xFF"))) { $thisILPS = ''; for ($i = 0; $i < strlen($parsedFrame['data_raw']); $i += 2) { $twobytes = substr($parsedFrame['data_raw'], $i, 2); if ($twobytes === "\x00\x00") { $IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS); $thisILPS = ''; } else { $thisILPS .= $twobytes; } } if (strlen($thisILPS) > 2) { $IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS); } } else { $IPLS_parts_unsorted = explode("\x00", $parsedFrame['data_raw']); } if (count($IPLS_parts_unsorted) == 1) { foreach ($IPLS_parts_unsorted as $key => $value) { $IPLS_parts_sorted = preg_split('#[;,\\r\\n\\t]#', $value); $position = ''; foreach ($IPLS_parts_sorted as $person) { $IPLS_parts[] = array('position'=>$position, 'person'=>$person); } } } elseif ((count($IPLS_parts_unsorted) % 2) == 0) { $position = ''; $person = ''; foreach ($IPLS_parts_unsorted as $key => $value) { if (($key % 2) == 0) { $position = $value; } else { $person = $value; $IPLS_parts[] = array('position'=>$position, 'person'=>$person); $position = ''; $person = ''; } } } else { foreach ($IPLS_parts_unsorted as $key => $value) { $IPLS_parts[] = array($value); } } } else { $IPLS_parts = preg_split('#[;,\\r\\n\\t]#', $parsedFrame['data_raw']); } $parsedFrame['data'] = $IPLS_parts; if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; } } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) { if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; } } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) { $frame_offset = 0; $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); while ($frame_offset < strlen($parsedFrame['data'])) { $parsedFrame['typeid'] = substr($parsedFrame['data'], $frame_offset++, 1); $parsedFrame['type'] = $this->ETCOEventLookup($parsedFrame['typeid']); $parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) { $frame_offset = 0; $parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2)); $parsedFrame['bytesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3)); $parsedFrame['msbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3)); $parsedFrame['bitsforbytesdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1)); $parsedFrame['bitsformsdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1)); $parsedFrame['data'] = substr($parsedFrame['data'], 10); $deviationbitstream = ''; while ($frame_offset < strlen($parsedFrame['data'])) { $deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); } $reference_counter = 0; while (strlen($deviationbitstream) > 0) { $parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation'])); $parsedFrame[$reference_counter]['msdeviation'] = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation'])); $deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']); $reference_counter++; } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) { $frame_offset = 0; $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $timestamp_counter = 0; while ($frame_offset < strlen($parsedFrame['data'])) { $parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ($parsedFrame[$timestamp_counter]['tempo'] == 255) { $parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1)); } $parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $timestamp_counter++; } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } if (strlen($parsedFrame['data']) >= (4 + strlen($frame_textencoding_terminator))) { $frame_language = substr($parsedFrame['data'], $frame_offset, 3); $frame_offset += 3; $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } } else { $this->warning('Invalid data in frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset']); } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_language = substr($parsedFrame['data'], $frame_offset, 3); $frame_offset += 3; $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['contenttypeid'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['contenttype'] = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); $timestampindex = 0; $frame_remainingdata = substr($parsedFrame['data'], $frame_offset); while (strlen($frame_remainingdata)) { $frame_offset = 0; $frame_terminatorpos = strpos($frame_remainingdata, $frame_textencoding_terminator); if ($frame_terminatorpos === false) { $frame_remainingdata = ''; } else { if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator)); if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) { } else { $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); $frame_remainingdata = substr($frame_remainingdata, 4); } $timestampindex++; } } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) { if (strlen($parsedFrame['data']) < 5) { $this->warning('Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset']); } else { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_language = substr($parsedFrame['data'], $frame_offset, 3); $frame_offset += 3; $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); $frame_text = $this->RemoveStringTerminator($frame_text, $frame_textencoding_terminator); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); $parsedFrame['data'] = $frame_text; if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } else { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } } } } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); if (ord($frame_idstring) === 0) { $frame_idstring = ''; } $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); $parsedFrame['description'] = $frame_idstring; $RVA2channelcounter = 0; while (strlen($frame_remainingdata) >= 5) { $frame_offset = 0; $frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1)); $parsedFrame[$RVA2channelcounter]['channeltypeid'] = $frame_channeltypeid; $parsedFrame[$RVA2channelcounter]['channeltype'] = $this->RVA2ChannelTypeLookup($frame_channeltypeid); $parsedFrame[$RVA2channelcounter]['volumeadjust'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); $frame_offset += 2; $parsedFrame[$RVA2channelcounter]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1)); if (($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] < 1) || ($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] > 4)) { $this->warning('ID3v2::RVA2 frame['.$RVA2channelcounter.'] contains invalid '.$parsedFrame[$RVA2channelcounter]['bitspeakvolume'].'-byte bits-representing-peak value'); break; } $frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8); $parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume); $RVA2channelcounter++; } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) { $frame_offset = 0; $frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1); $parsedFrame['incdec']['left'] = (bool) substr($frame_incrdecrflags, 7, 1); $parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8); $parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['right'] === false) { $parsedFrame['volumechange']['right'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['left'] === false) { $parsedFrame['volumechange']['left'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; if ($id3v2_majorversion == 3) { $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); if (strlen($parsedFrame['data']) > 0) { $parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1); $parsedFrame['incdec']['leftrear'] = (bool) substr($frame_incrdecrflags, 5, 1); $parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['rightrear'] === false) { $parsedFrame['volumechange']['rightrear'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['leftrear'] === false) { $parsedFrame['volumechange']['leftrear'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; } $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); if (strlen($parsedFrame['data']) > 0) { $parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1); $parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['center'] === false) { $parsedFrame['volumechange']['center'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; } $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); if (strlen($parsedFrame['data']) > 0) { $parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1); $parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); if ($parsedFrame['incdec']['bass'] === false) { $parsedFrame['volumechange']['bass'] *= -1; } $frame_offset += $frame_bytesvolume; $parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); $frame_offset += $frame_bytesvolume; } } unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { $frame_offset = 0; $frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_idstring) === 0) { $frame_idstring = ''; } $parsedFrame['description'] = $frame_idstring; $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); while (strlen($frame_remainingdata)) { $frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2; $parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true); $frame_remainingdata = substr($frame_remainingdata, 4); } $parsedFrame['interpolationmethod'] = $frame_interpolationmethod; unset($parsedFrame['data']); } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) { $frame_offset = 0; $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1); $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8); $frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset); while (strlen($frame_remainingdata) > 0) { $frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2)); $frame_incdec = (bool) substr($frame_frequencystr, 0, 1); $frame_frequency = bindec(substr($frame_frequencystr, 1, 15)); $parsedFrame[$frame_frequency]['incdec'] = $frame_incdec; $parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes)); if ($parsedFrame[$frame_frequency]['incdec'] === false) { $parsedFrame[$frame_frequency]['adjustment'] *= -1; } $frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes); } unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) { $frame_offset = 0; $parsedFrame['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['bouncesL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['bouncesR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['feedbackLL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['feedbackLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['feedbackRR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['feedbackRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['premixLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['premixRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_imagetype = null; $frame_mimetype = null; if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) { $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3); if (strtolower($frame_imagetype) == 'ima') { $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_mimetype) === 0) { $frame_mimetype = ''; } $frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype))); if ($frame_imagetype == 'JPEG') { $frame_imagetype = 'JPG'; } $frame_offset = $frame_terminatorpos + strlen("\x00"); } else { $frame_offset += 3; } } if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) { $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_mimetype) === 0) { $frame_mimetype = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); } $frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ($frame_offset >= $parsedFrame['datalength']) { $this->warning('data portion of APIC frame is missing at offset '.($parsedFrame['dataoffset'] + 8 + $frame_offset)); } else { $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); if ($id3v2_majorversion == 2) { $parsedFrame['imagetype'] = isset($frame_imagetype) ? $frame_imagetype : null; } else { $parsedFrame['mime'] = isset($frame_mimetype) ? $frame_mimetype : null; } $parsedFrame['picturetypeid'] = $frame_picturetype; $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); $parsedFrame['datalength'] = strlen($parsedFrame['data']); $parsedFrame['image_mime'] = ''; $imageinfo = array(); if ($imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo)) { if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { $parsedFrame['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); if ($imagechunkcheck[0]) { $parsedFrame['image_width'] = $imagechunkcheck[0]; } if ($imagechunkcheck[1]) { $parsedFrame['image_height'] = $imagechunkcheck[1]; } } } do { if ($this->getid3->option_save_attachments === false) { unset($parsedFrame['data']); break; } $dir = ''; if ($this->getid3->option_save_attachments === true) { } elseif (is_string($this->getid3->option_save_attachments)) { $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); if (!is_dir($dir) || !getID3::is_writable($dir)) { $this->warning('attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)'); unset($parsedFrame['data']); break; } } if (is_string($this->getid3->option_save_attachments)) { $destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset; if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) { file_put_contents($destination_filename, $parsedFrame['data']); } else { $this->warning('attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)'); } $parsedFrame['data_filename'] = $destination_filename; unset($parsedFrame['data']); } else { if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { if (!isset($info['id3v2']['comments']['picture'])) { $info['id3v2']['comments']['picture'] = array(); } $comments_picture_data = array(); foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { if (isset($parsedFrame[$picture_key])) { $comments_picture_data[$picture_key] = $parsedFrame[$picture_key]; } } $info['id3v2']['comments']['picture'][] = $comments_picture_data; unset($comments_picture_data); } } } while (false); } } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_mimetype) === 0) { $frame_mimetype = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_filename) === 0) { $frame_filename = ''; } $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['mime'] = $frame_mimetype; $parsedFrame['filename'] = $frame_filename; unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) { $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_emailaddress) === 0) { $frame_emailaddress = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['counter'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); $parsedFrame['email'] = $frame_emailaddress; $parsedFrame['rating'] = $frame_rating; unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) { $frame_offset = 0; $parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3)); $frame_offset += 3; $frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1); $parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); unset($parsedFrame['data']); } elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_ownerid) === 0) { $frame_ownerid = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset); unset($parsedFrame['data']); } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) { $frame_offset = 0; if ($id3v2_majorversion == 2) { $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3); $frame_offset += 3; } else { $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4); $frame_offset += 4; } $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_url) === 0) { $frame_url = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['url'] = $frame_url; $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset); if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback_iso88591_utf8($parsedFrame['url']); } unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { $frame_offset = 0; $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['position'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); } $frame_language = substr($parsedFrame['data'], $frame_offset, 3); $frame_offset += 3; $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); } $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3); $parsedFrame['pricepaid']['currency'] = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']); $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3); $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8); if ($this->IsValidDateStampString($parsedFrame['purchasedate'])) { $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); } $frame_offset += 8; $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset); $parsedFrame['seller'] = $this->RemoveStringTerminator($parsedFrame['seller'], $this->TextEncodingTerminatorLookup($frame_textencoding)); unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { $frame_offset = 0; $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); $frame_textencoding_terminator = "\x00"; } $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_rawpricearray = explode('/', $frame_pricestring); foreach ($frame_rawpricearray as $key => $val) { $frame_currencyid = substr($val, 0, 3); $parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid); $parsedFrame['price'][$frame_currencyid]['value'] = substr($val, 3); } $frame_datestring = substr($parsedFrame['data'], $frame_offset, 8); $frame_offset += 8; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_sellername) === 0) { $frame_sellername = ''; } $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; } $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_sellerlogo = substr($parsedFrame['data'], $frame_offset); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['pricevaliduntil'] = $frame_datestring; $parsedFrame['contacturl'] = $frame_contacturl; $parsedFrame['receivedasid'] = $frame_receivedasid; $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid); $parsedFrame['sellername'] = $frame_sellername; $parsedFrame['mime'] = $frame_mimetype; $parsedFrame['logo'] = $frame_sellerlogo; unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_ownerid) === 0) { $frame_ownerid = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_ownerid) === 0) { $frame_ownerid = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { $frame_offset = 0; $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_ownerid) === 0) { $frame_ownerid = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { $frame_offset = 0; $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { $frame_offset = 0; $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { $frame_offset = 0; $parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8); for ($i = 0; $i < $parsedFrame['indexpoints']; $i++) { $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint)); $frame_offset += $frame_bytesperpoint; } unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { $frame_offset = 0; $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; foreach (array('track','album') as $rgad_entry_type) { $rg_adjustment_word = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; $parsedFrame['raw'][$rgad_entry_type]['name'] = ($rg_adjustment_word & 0xE000) >> 13; $parsedFrame['raw'][$rgad_entry_type]['originator'] = ($rg_adjustment_word & 0x1C00) >> 10; $parsedFrame['raw'][$rgad_entry_type]['signbit'] = ($rg_adjustment_word & 0x0200) >> 9; $parsedFrame['raw'][$rgad_entry_type]['adjustment'] = ($rg_adjustment_word & 0x0100); } $parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']); $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']); $parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']); $parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']); $parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']); $parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']); $info['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude']; $info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator']; $info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment']; $info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator']; $info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment']; unset($parsedFrame['data']); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'CHAP')) { $frame_offset = 0; @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); $frame_offset += strlen($parsedFrame['element_id']."\x00"); $parsedFrame['time_begin'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $parsedFrame['time_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") { $parsedFrame['offset_begin'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); } $frame_offset += 4; if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") { $parsedFrame['offset_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); } $frame_offset += 4; if ($frame_offset < strlen($parsedFrame['data'])) { $parsedFrame['subframes'] = array(); while ($frame_offset < strlen($parsedFrame['data'])) { $subframe = array(); $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); $frame_offset += 4; $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $subframe['flags_raw'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; if ($subframe['size'] > (strlen($parsedFrame['data']) - $frame_offset)) { $this->warning('CHAP subframe "'.$subframe['name'].'" at frame offset '.$frame_offset.' claims to be "'.$subframe['size'].'" bytes, which is more than the available data ('.(strlen($parsedFrame['data']) - $frame_offset).' bytes)'); break; } $subframe_rawdata = substr($parsedFrame['data'], $frame_offset, $subframe['size']); $frame_offset += $subframe['size']; $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); $subframe['text'] = substr($subframe_rawdata, 1); $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text'])); switch (substr($encoding_converted_text, 0, 2)) { case "\xFF\xFE": case "\xFE\xFF": switch (strtoupper($info['id3v2']['encoding'])) { case 'ISO-8859-1': case 'UTF-8': $encoding_converted_text = substr($encoding_converted_text, 2); break; default: break; } break; default: break; } switch ($subframe['name']) { case 'TIT2': $parsedFrame['chapter_name'] = $encoding_converted_text; $parsedFrame['subframes'][] = $subframe; break; case 'TIT3': $parsedFrame['chapter_description'] = $encoding_converted_text; $parsedFrame['subframes'][] = $subframe; break; case 'WXXX': list($subframe['chapter_url_description'], $subframe['chapter_url']) = explode("\x00", $encoding_converted_text, 2); $parsedFrame['chapter_url'][$subframe['chapter_url_description']] = $subframe['chapter_url']; $parsedFrame['subframes'][] = $subframe; break; case 'APIC': if (preg_match('#^([^\\x00]+)*\\x00(.)([^\\x00]+)*\\x00(.+)$#s', $subframe['text'], $matches)) { list($dummy, $subframe_apic_mime, $subframe_apic_picturetype, $subframe_apic_description, $subframe_apic_picturedata) = $matches; $subframe['image_mime'] = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe_apic_mime)); $subframe['picture_type'] = $this->APICPictureTypeLookup($subframe_apic_picturetype); $subframe['description'] = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe_apic_description)); if (strlen($this->TextEncodingTerminatorLookup($subframe['encoding'])) == 2) { $subframe_apic_picturedata = substr($subframe_apic_picturedata, 1); } $subframe['data'] = $subframe_apic_picturedata; unset($dummy, $subframe_apic_mime, $subframe_apic_picturetype, $subframe_apic_description, $subframe_apic_picturedata); unset($subframe['text'], $parsedFrame['text']); $parsedFrame['subframes'][] = $subframe; $parsedFrame['picture_present'] = true; } else { $this->warning('ID3v2.CHAP subframe #'.(count($parsedFrame['subframes']) + 1).' "'.$subframe['name'].'" not in expected format'); } break; default: $this->warning('ID3v2.CHAP subframe "'.$subframe['name'].'" not handled (supported: TIT2, TIT3, WXXX, APIC)'); break; } } unset($subframe_rawdata, $subframe, $encoding_converted_text); unset($parsedFrame['data']); } $id3v2_chapter_entry = array(); foreach (array('id', 'time_begin', 'time_end', 'offset_begin', 'offset_end', 'chapter_name', 'chapter_description', 'chapter_url', 'picture_present') as $id3v2_chapter_key) { if (isset($parsedFrame[$id3v2_chapter_key])) { $id3v2_chapter_entry[$id3v2_chapter_key] = $parsedFrame[$id3v2_chapter_key]; } } if (!isset($info['id3v2']['chapters'])) { $info['id3v2']['chapters'] = array(); } $info['id3v2']['chapters'][] = $id3v2_chapter_entry; unset($id3v2_chapter_entry, $id3v2_chapter_key); } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'CTOC')) { $frame_offset = 0; @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); $frame_offset += strlen($parsedFrame['element_id']."\x00"); $ctoc_flags_raw = ord(substr($parsedFrame['data'], $frame_offset, 1)); $frame_offset += 1; $parsedFrame['entry_count'] = ord(substr($parsedFrame['data'], $frame_offset, 1)); $frame_offset += 1; $terminator_position = null; for ($i = 0; $i < $parsedFrame['entry_count']; $i++) { $terminator_position = strpos($parsedFrame['data'], "\x00", $frame_offset); $parsedFrame['child_element_ids'][$i] = substr($parsedFrame['data'], $frame_offset, $terminator_position - $frame_offset); $frame_offset = $terminator_position + 1; } $parsedFrame['ctoc_flags']['ordered'] = (bool) ($ctoc_flags_raw & 0x01); $parsedFrame['ctoc_flags']['top_level'] = (bool) ($ctoc_flags_raw & 0x03); unset($ctoc_flags_raw, $terminator_position); if ($frame_offset < strlen($parsedFrame['data'])) { $parsedFrame['subframes'] = array(); while ($frame_offset < strlen($parsedFrame['data'])) { $subframe = array(); $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); $frame_offset += 4; $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); $frame_offset += 4; $subframe['flags_raw'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); $frame_offset += 2; if ($subframe['size'] > (strlen($parsedFrame['data']) - $frame_offset)) { $this->warning('CTOS subframe "'.$subframe['name'].'" at frame offset '.$frame_offset.' claims to be "'.$subframe['size'].'" bytes, which is more than the available data ('.(strlen($parsedFrame['data']) - $frame_offset).' bytes)'); break; } $subframe_rawdata = substr($parsedFrame['data'], $frame_offset, $subframe['size']); $frame_offset += $subframe['size']; $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); $subframe['text'] = substr($subframe_rawdata, 1); $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));; switch (substr($encoding_converted_text, 0, 2)) { case "\xFF\xFE": case "\xFE\xFF": switch (strtoupper($info['id3v2']['encoding'])) { case 'ISO-8859-1': case 'UTF-8': $encoding_converted_text = substr($encoding_converted_text, 2); break; default: break; } break; default: break; } if (($subframe['name'] == 'TIT2') || ($subframe['name'] == 'TIT3')) { if ($subframe['name'] == 'TIT2') { $parsedFrame['toc_name'] = $encoding_converted_text; } elseif ($subframe['name'] == 'TIT3') { $parsedFrame['toc_description'] = $encoding_converted_text; } $parsedFrame['subframes'][] = $subframe; } else { $this->warning('ID3v2.CTOC subframe "'.$subframe['name'].'" not handled (only TIT2 and TIT3)'); } } unset($subframe_rawdata, $subframe, $encoding_converted_text); } } return true; } public function DeUnsynchronise($data) { return str_replace("\xFF\x00", "\xFF", $data); } public function LookupExtendedHeaderRestrictionsTagSizeLimits($index) { static $LookupExtendedHeaderRestrictionsTagSizeLimits = array( 0x00 => 'No more than 128 frames and 1 MB total tag size', 0x01 => 'No more than 64 frames and 128 KB total tag size', 0x02 => 'No more than 32 frames and 40 KB total tag size', 0x03 => 'No more than 32 frames and 4 KB total tag size', ); return (isset($LookupExtendedHeaderRestrictionsTagSizeLimits[$index]) ? $LookupExtendedHeaderRestrictionsTagSizeLimits[$index] : ''); } public function LookupExtendedHeaderRestrictionsTextEncodings($index) { static $LookupExtendedHeaderRestrictionsTextEncodings = array( 0x00 => 'No restrictions', 0x01 => 'Strings are only encoded with ISO-8859-1 or UTF-8', ); return (isset($LookupExtendedHeaderRestrictionsTextEncodings[$index]) ? $LookupExtendedHeaderRestrictionsTextEncodings[$index] : ''); } public function LookupExtendedHeaderRestrictionsTextFieldSize($index) { static $LookupExtendedHeaderRestrictionsTextFieldSize = array( 0x00 => 'No restrictions', 0x01 => 'No string is longer than 1024 characters', 0x02 => 'No string is longer than 128 characters', 0x03 => 'No string is longer than 30 characters', ); return (isset($LookupExtendedHeaderRestrictionsTextFieldSize[$index]) ? $LookupExtendedHeaderRestrictionsTextFieldSize[$index] : ''); } public function LookupExtendedHeaderRestrictionsImageEncoding($index) { static $LookupExtendedHeaderRestrictionsImageEncoding = array( 0x00 => 'No restrictions', 0x01 => 'Images are encoded only with PNG or JPEG', ); return (isset($LookupExtendedHeaderRestrictionsImageEncoding[$index]) ? $LookupExtendedHeaderRestrictionsImageEncoding[$index] : ''); } public function LookupExtendedHeaderRestrictionsImageSizeSize($index) { static $LookupExtendedHeaderRestrictionsImageSizeSize = array( 0x00 => 'No restrictions', 0x01 => 'All images are 256x256 pixels or smaller', 0x02 => 'All images are 64x64 pixels or smaller', 0x03 => 'All images are exactly 64x64 pixels, unless required otherwise', ); return (isset($LookupExtendedHeaderRestrictionsImageSizeSize[$index]) ? $LookupExtendedHeaderRestrictionsImageSizeSize[$index] : ''); } public function LookupCurrencyUnits($currencyid) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units'); } public function LookupCurrencyCountry($currencyid) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country'); } public static function LanguageLookup($languagecode, $casesensitive=false) { if (!$casesensitive) { $languagecode = strtolower($languagecode); } $begin = __LINE__; return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode'); } public static function ETCOEventLookup($index) { if (($index >= 0x17) && ($index <= 0xDF)) { return 'reserved for future use'; } if (($index >= 0xE0) && ($index <= 0xEF)) { return 'not predefined synch 0-F'; } if (($index >= 0xF0) && ($index <= 0xFC)) { return 'reserved for future use'; } static $EventLookup = array( 0x00 => 'padding (has no meaning)', 0x01 => 'end of initial silence', 0x02 => 'intro start', 0x03 => 'main part start', 0x04 => 'outro start', 0x05 => 'outro end', 0x06 => 'verse start', 0x07 => 'refrain start', 0x08 => 'interlude start', 0x09 => 'theme start', 0x0A => 'variation start', 0x0B => 'key change', 0x0C => 'time change', 0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)', 0x0E => 'sustained noise', 0x0F => 'sustained noise end', 0x10 => 'intro end', 0x11 => 'main part end', 0x12 => 'verse end', 0x13 => 'refrain end', 0x14 => 'theme end', 0x15 => 'profanity', 0x16 => 'profanity end', 0xFD => 'audio end (start of silence)', 0xFE => 'audio file ends', 0xFF => 'one more byte of events follows' ); return (isset($EventLookup[$index]) ? $EventLookup[$index] : ''); } public static function SYTLContentTypeLookup($index) { static $SYTLContentTypeLookup = array( 0x00 => 'other', 0x01 => 'lyrics', 0x02 => 'text transcription', 0x03 => 'movement/part name', 0x04 => 'events', 0x05 => 'chord', 0x06 => 'trivia/\'pop up\' information', 0x07 => 'URLs to webpages', 0x08 => 'URLs to images' ); return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); } public static function APICPictureTypeLookup($index, $returnarray=false) { static $APICPictureTypeLookup = array( 0x00 => 'Other', 0x01 => '32x32 pixels \'file icon\' (PNG only)', 0x02 => 'Other file icon', 0x03 => 'Cover (front)', 0x04 => 'Cover (back)', 0x05 => 'Leaflet page', 0x06 => 'Media (e.g. label side of CD)', 0x07 => 'Lead artist/lead performer/soloist', 0x08 => 'Artist/performer', 0x09 => 'Conductor', 0x0A => 'Band/Orchestra', 0x0B => 'Composer', 0x0C => 'Lyricist/text writer', 0x0D => 'Recording Location', 0x0E => 'During recording', 0x0F => 'During performance', 0x10 => 'Movie/video screen capture', 0x11 => 'A bright coloured fish', 0x12 => 'Illustration', 0x13 => 'Band/artist logotype', 0x14 => 'Publisher/Studio logotype' ); if ($returnarray) { return $APICPictureTypeLookup; } return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : ''); } public static function COMRReceivedAsLookup($index) { static $COMRReceivedAsLookup = array( 0x00 => 'Other', 0x01 => 'Standard CD album with other songs', 0x02 => 'Compressed audio on CD', 0x03 => 'File over the Internet', 0x04 => 'Stream over the Internet', 0x05 => 'As note sheets', 0x06 => 'As note sheets in a book with other sheets', 0x07 => 'Music on other media', 0x08 => 'Non-musical merchandise' ); return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : ''); } public static function RVA2ChannelTypeLookup($index) { static $RVA2ChannelTypeLookup = array( 0x00 => 'Other', 0x01 => 'Master volume', 0x02 => 'Front right', 0x03 => 'Front left', 0x04 => 'Back right', 0x05 => 'Back left', 0x06 => 'Front centre', 0x07 => 'Back centre', 0x08 => 'Subwoofer' ); return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : ''); } public static function FrameNameLongLookup($framename) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long'); } public static function FrameNameShortLookup($framename) { $begin = __LINE__; return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); } public static function TextEncodingTerminatorLookup($encoding) { static $TextEncodingTerminatorLookup = array( 0 => "\x00", 1 => "\x00\x00", 2 => "\x00\x00", 3 => "\x00", 255 => "\x00\x00" ); return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : "\x00"); } public static function TextEncodingNameLookup($encoding) { static $TextEncodingNameLookup = array( 0 => 'ISO-8859-1', 1 => 'UTF-16', 2 => 'UTF-16BE', 3 => 'UTF-8', 255 => 'UTF-16BE' ); return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); } public static function RemoveStringTerminator($string, $terminator) { if (substr($string, -strlen($terminator), strlen($terminator)) === $terminator) { $string = substr($string, 0, -strlen($terminator)); } return $string; } public static function MakeUTF16emptyStringEmpty($string) { if (in_array($string, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { $string = ''; } return $string; } public static function IsValidID3v2FrameName($framename, $id3v2majorversion) { switch ($id3v2majorversion) { case 2: return preg_match('#[A-Z][A-Z0-9]{2}#', $framename); case 3: case 4: return preg_match('#[A-Z][A-Z0-9]{3}#', $framename); } return false; } public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { for ($i = 0; $i < strlen($numberstring); $i++) { if ((chr($numberstring[$i]) < chr('0')) || (chr($numberstring[$i]) > chr('9'))) { if (($numberstring[$i] == '.') && $allowdecimal) { } elseif (($numberstring[$i] == '-') && $allownegative && ($i == 0)) { } else { return false; } } } return true; } public static function IsValidDateStampString($datestamp) { if (strlen($datestamp) != 8) { return false; } if (!self::IsANumber($datestamp, false)) { return false; } $year = substr($datestamp, 0, 4); $month = substr($datestamp, 4, 2); $day = substr($datestamp, 6, 2); if (($year == 0) || ($month == 0) || ($day == 0)) { return false; } if ($month > 12) { return false; } if ($day > 31) { return false; } if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) { return false; } if (($day > 29) && ($month == 2)) { return false; } return true; } public static function ID3v2HeaderLength($majorversion) { return (($majorversion == 2) ? 6 : 10); } public static function ID3v22iTunesBrokenFrameName($frame_name) { static $ID3v22_iTunes_BrokenFrames = array( 'BUF' => 'RBUF', 'CNT' => 'PCNT', 'COM' => 'COMM', 'CRA' => 'AENC', 'EQU' => 'EQUA', 'ETC' => 'ETCO', 'GEO' => 'GEOB', 'IPL' => 'IPLS', 'LNK' => 'LINK', 'MCI' => 'MCDI', 'MLL' => 'MLLT', 'PIC' => 'APIC', 'POP' => 'POPM', 'REV' => 'RVRB', 'RVA' => 'RVAD', 'SLT' => 'SYLT', 'STC' => 'SYTC', 'TAL' => 'TALB', 'TBP' => 'TBPM', 'TCM' => 'TCOM', 'TCO' => 'TCON', 'TCP' => 'TCMP', 'TCR' => 'TCOP', 'TDA' => 'TDAT', 'TDY' => 'TDLY', 'TEN' => 'TENC', 'TFT' => 'TFLT', 'TIM' => 'TIME', 'TKE' => 'TKEY', 'TLA' => 'TLAN', 'TLE' => 'TLEN', 'TMT' => 'TMED', 'TOA' => 'TOPE', 'TOF' => 'TOFN', 'TOL' => 'TOLY', 'TOR' => 'TORY', 'TOT' => 'TOAL', 'TP1' => 'TPE1', 'TP2' => 'TPE2', 'TP3' => 'TPE3', 'TP4' => 'TPE4', 'TPA' => 'TPOS', 'TPB' => 'TPUB', 'TRC' => 'TSRC', 'TRD' => 'TRDA', 'TRK' => 'TRCK', 'TS2' => 'TSO2', 'TSA' => 'TSOA', 'TSC' => 'TSOC', 'TSI' => 'TSIZ', 'TSP' => 'TSOP', 'TSS' => 'TSSE', 'TST' => 'TSOT', 'TT1' => 'TIT1', 'TT2' => 'TIT2', 'TT3' => 'TIT3', 'TXT' => 'TEXT', 'TXX' => 'TXXX', 'TYE' => 'TYER', 'UFI' => 'UFID', 'ULT' => 'USLT', 'WAF' => 'WOAF', 'WAR' => 'WOAR', 'WAS' => 'WOAS', 'WCM' => 'WCOM', 'WCP' => 'WCOP', 'WPB' => 'WPUB', 'WXX' => 'WXXX', ); if (strlen($frame_name) == 4) { if ((substr($frame_name, 3, 1) == ' ') || (substr($frame_name, 3, 1) == "\x00")) { if (isset($ID3v22_iTunes_BrokenFrames[substr($frame_name, 0, 3)])) { return $ID3v22_iTunes_BrokenFrames[substr($frame_name, 0, 3)]; } } } return false; } } getid3->info; $info['fileformat'] = 'quicktime'; $info['quicktime']['hinting'] = false; $info['quicktime']['controller'] = 'standard'; $this->fseek($info['avdataoffset']); $offset = 0; $atomcounter = 0; $atom_data_read_buffer_size = $info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : $this->getid3->option_fread_buffer_size * 1024; while ($offset < $info['avdataend']) { if (!getid3_lib::intValueSupported($offset)) { $this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'); break; } $this->fseek($offset); $AtomHeader = $this->fread(8); $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4)); $atomname = substr($AtomHeader, 4, 4); if ($atomsize == 1) { $atomsize = getid3_lib::BigEndian2Int($this->fread(8)); } if (($offset + $atomsize) > $info['avdataend']) { $info['quicktime'][$atomname]['name'] = $atomname; $info['quicktime'][$atomname]['size'] = $atomsize; $info['quicktime'][$atomname]['offset'] = $offset; $this->error('Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)'); return false; } if ($atomsize == 0) { $info['quicktime'][$atomname]['name'] = $atomname; $info['quicktime'][$atomname]['size'] = $atomsize; $info['quicktime'][$atomname]['offset'] = $offset; break; } $atomHierarchy = array(); $parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms); $parsedAtomData['name'] = $atomname; $parsedAtomData['size'] = $atomsize; $parsedAtomData['offset'] = $offset; if (in_array($atomname, array('uuid'))) { @$info['quicktime'][$atomname][] = $parsedAtomData; } else { $info['quicktime'][$atomname] = $parsedAtomData; } $offset += $atomsize; $atomcounter++; } if (!empty($info['avdataend_tmp'])) { $info['avdataend'] = $info['avdataend_tmp']; unset($info['avdataend_tmp']); } if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) { $durations = $this->quicktime_time_to_sample_table($info); for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) { $bookmark = array(); $bookmark['title'] = $info['quicktime']['comments']['chapters'][$i]; if (isset($durations[$i])) { $bookmark['duration_sample'] = $durations[$i]['sample_duration']; if ($i > 0) { $bookmark['start_sample'] = $info['quicktime']['bookmarks'][($i - 1)]['start_sample'] + $info['quicktime']['bookmarks'][($i - 1)]['duration_sample']; } else { $bookmark['start_sample'] = 0; } if ($time_scale = $this->quicktime_bookmark_time_scale($info)) { $bookmark['duration_seconds'] = $bookmark['duration_sample'] / $time_scale; $bookmark['start_seconds'] = $bookmark['start_sample'] / $time_scale; } } $info['quicktime']['bookmarks'][] = $bookmark; } } if (isset($info['quicktime']['temp_meta_key_names'])) { unset($info['quicktime']['temp_meta_key_names']); } if (!empty($info['quicktime']['comments']['location.ISO6709'])) { foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) { $ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false); if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) { @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches; if (strlen($lat_deg) == 2) { $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec); } elseif (strlen($lat_deg) == 4) { $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60); } elseif (strlen($lat_deg) == 6) { $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600); } if (strlen($lon_deg) == 3) { $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim($lon_deg, '0').$lon_deg_dec); } elseif (strlen($lon_deg) == 5) { $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60); } elseif (strlen($lon_deg) == 7) { $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600); } if (strlen($alt_deg) == 3) { $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim($alt_deg, '0').$alt_deg_dec); } elseif (strlen($alt_deg) == 5) { $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60); } elseif (strlen($alt_deg) == 7) { $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600); } foreach (array('latitude', 'longitude', 'altitude') as $key) { if ($ISO6709parsed[$key] !== false) { $value = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]); if (!isset($info['quicktime']['comments']['gps_'.$key]) || !in_array($value, $info['quicktime']['comments']['gps_'.$key])) { @$info['quicktime']['comments']['gps_'.$key][] = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]); } } } } if ($ISO6709parsed['latitude'] === false) { $this->warning('location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug'); } break; } } if (!isset($info['bitrate']) && !empty($info['playtime_seconds'])) { $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) { $info['audio']['bitrate'] = $info['bitrate']; } if (!empty($info['bitrate']) && !empty($info['audio']['bitrate']) && empty($info['video']['bitrate']) && !empty($info['video']['frame_rate']) && !empty($info['video']['resolution_x']) && ($info['bitrate'] > $info['audio']['bitrate'])) { $info['video']['bitrate'] = $info['bitrate'] - $info['audio']['bitrate']; } if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) { foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) { $samples_per_second = $samples_count / $info['playtime_seconds']; if ($samples_per_second > 240) { } else { $info['video']['frame_rate'] = $samples_per_second; break; } } } if ($info['audio']['dataformat'] == 'mp4') { $info['fileformat'] = 'mp4'; if (empty($info['video']['resolution_x'])) { $info['mime_type'] = 'audio/mp4'; unset($info['video']['dataformat']); } else { $info['mime_type'] = 'video/mp4'; } } if (!$this->ReturnAtomData) { unset($info['quicktime']['moov']); } if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) { $info['audio']['dataformat'] = 'quicktime'; } if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) { $info['video']['dataformat'] = 'quicktime'; } if (isset($info['video']) && ($info['mime_type'] == 'audio/mp4') && empty($info['video']['resolution_x']) && empty($info['video']['resolution_y'])) { unset($info['video']); } return true; } public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { $info = &$this->getid3->info; $atom_parent = end($atomHierarchy); array_push($atomHierarchy, $atomname); $atom_structure = array(); $atom_structure['hierarchy'] = implode(' ', $atomHierarchy); $atom_structure['name'] = $atomname; $atom_structure['size'] = $atomsize; $atom_structure['offset'] = $baseoffset; if (substr($atomname, 0, 3) == "\x00\x00\x00") { $atomname = getid3_lib::BigEndian2Int($atomname); $atom_structure['name'] = $atomname; $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); } else { switch ($atomname) { case 'moov': case 'trak': case 'clip': case 'matt': case 'edts': case 'tref': case 'mdia': case 'minf': case 'dinf': case 'nmhd': case 'udta': case 'cmov': case 'rmra': case 'rmda': case 'gmhd': $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); break; case 'ilst': if ($atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms)) { $allnumericnames = true; foreach ($atom_structure['subatoms'] as $subatomarray) { if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { $allnumericnames = false; break; } } if ($allnumericnames) { $newData = array(); foreach ($atom_structure['subatoms'] as $subatomarray) { foreach ($subatomarray['subatoms'] as $newData_subatomarray) { unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']); $newData[$subatomarray['name']] = $newData_subatomarray; break; } } $atom_structure['data'] = $newData; unset($atom_structure['subatoms']); } } break; case 'stbl': $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); $isVideo = false; $framerate = 0; $framecount = 0; foreach ($atom_structure['subatoms'] as $key => $value_array) { if (isset($value_array['sample_description_table'])) { foreach ($value_array['sample_description_table'] as $key2 => $value_array2) { if (isset($value_array2['data_format'])) { switch ($value_array2['data_format']) { case 'avc1': case 'mp4v': $isVideo = true; break; case 'mp4a': break; } } } } elseif (isset($value_array['time_to_sample_table'])) { foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) { if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) { $framerate = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3); $framecount = $value_array2['sample_count']; } } } } if ($isVideo && $framerate) { $info['quicktime']['video']['frame_rate'] = $framerate; $info['video']['frame_rate'] = $info['quicktime']['video']['frame_rate']; } if ($isVideo && $framecount) { $info['quicktime']['video']['frame_count'] = $framecount; } break; case "\xA9".'alb': case "\xA9".'ART': case "\xA9".'art': case "\xA9".'aut': case "\xA9".'cmt': case "\xA9".'com': case "\xA9".'cpy': case "\xA9".'day': case "\xA9".'dir': case "\xA9".'ed1': case "\xA9".'ed2': case "\xA9".'ed3': case "\xA9".'ed4': case "\xA9".'ed5': case "\xA9".'ed6': case "\xA9".'ed7': case "\xA9".'ed8': case "\xA9".'ed9': case "\xA9".'enc': case "\xA9".'fmt': case "\xA9".'gen': case "\xA9".'grp': case "\xA9".'hst': case "\xA9".'inf': case "\xA9".'lyr': case "\xA9".'mak': case "\xA9".'mod': case "\xA9".'nam': case "\xA9".'ope': case "\xA9".'PRD': case "\xA9".'prf': case "\xA9".'req': case "\xA9".'src': case "\xA9".'swr': case "\xA9".'too': case "\xA9".'trk': case "\xA9".'url': case "\xA9".'wrn': case "\xA9".'wrt': case '----': case 'aART': case 'akID': case 'apID': case 'atID': case 'catg': case 'cmID': case 'cnID': case 'covr': case 'cpil': case 'cprt': case 'desc': case 'disk': case 'egid': case 'geID': case 'gnre': case 'hdvd': case 'keyw': case 'ldes': case 'pcst': case 'pgap': case 'plID': case 'purd': case 'purl': case 'rati': case 'rndu': case 'rpdu': case 'rtng': case 'sfID': case 'soaa': case 'soal': case 'soar': case 'soco': case 'sonm': case 'sosn': case 'stik': case 'tmpo': case 'trkn': case 'tven': case 'tves': case 'tvnn': case 'tvsh': case 'tvsn': if ($atom_parent == 'udta') { $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); $atom_structure['data'] = substr($atom_data, 4); $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { $info['comments']['language'][] = $atom_structure['language']; } } else { $atomoffset = 0; if (substr($atom_data, 2, 2) == "\x10\xB5") { while ($atomoffset < strlen($atom_data)) { $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); if ($boxsmallsize <= 1) { $this->warning('Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset)); $atom_structure['data'] = null; $atomoffset = strlen($atom_data); break; } switch ($boxsmalltype) { case "\x10\xB5": $atom_structure['data'] = $boxsmalldata; break; default: $this->warning('Unknown QuickTime smallbox type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxsmalltype).'" ('.trim(getid3_lib::PrintHexBytes($boxsmalltype)).') at offset '.$baseoffset); $atom_structure['data'] = $atom_data; break; } $atomoffset += (4 + $boxsmallsize); } } else { while ($atomoffset < strlen($atom_data)) { $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4)); $boxtype = substr($atom_data, $atomoffset + 4, 4); $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); if ($boxsize <= 1) { $this->warning('Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset)); $atom_structure['data'] = null; $atomoffset = strlen($atom_data); break; } $atomoffset += $boxsize; switch ($boxtype) { case 'mean': case 'name': $atom_structure[$boxtype] = substr($boxdata, 4); break; case 'data': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); switch ($atom_structure['flags_raw']) { case 0: case 21: switch ($atomname) { case 'cpil': case 'hdvd': case 'pcst': case 'pgap': $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); break; case 'tmpo': $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2)); break; case 'disk': case 'trkn': $num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2)); $num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2)); $atom_structure['data'] = empty($num) ? '' : $num; $atom_structure['data'] .= empty($num_total) ? '' : '/'.$num_total; break; case 'gnre': $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); break; case 'rtng': $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); $atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]); break; case 'stik': $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); $atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]); break; case 'sfID': $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); $atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]); break; case 'egid': case 'purl': $atom_structure['data'] = substr($boxdata, 8); break; case 'plID': $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 8)); break; case 'covr': $atom_structure['data'] = substr($boxdata, 8); if (preg_match('#^\\xFF\\xD8\\xFF#', $atom_structure['data'])) { $atom_structure['image_mime'] = 'image/jpeg'; } elseif (preg_match('#^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A#', $atom_structure['data'])) { $atom_structure['image_mime'] = 'image/png'; } elseif (preg_match('#^GIF#', $atom_structure['data'])) { $atom_structure['image_mime'] = 'image/gif'; } $info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_structure['data'], 'description'=>'cover'); break; case 'atID': case 'cnID': case 'geID': case 'tves': case 'tvsn': default: $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); } break; case 1: case 13: default: $atom_structure['data'] = substr($boxdata, 8); if ($atomname == 'covr') { if (!empty($atom_structure['data'])) { $atom_structure['image_mime'] = 'image/unknown'; if (function_exists('getimagesizefromstring') && ($getimagesize = getimagesizefromstring($atom_structure['data'])) && !empty($getimagesize['mime'])) { $atom_structure['image_mime'] = $getimagesize['mime']; } else { $ImageFormatSignatures = array( 'image/jpeg' => "\xFF\xD8\xFF", 'image/png' => "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 'image/gif' => 'GIF', ); foreach ($ImageFormatSignatures as $mime => $image_format_signature) { if (substr($atom_structure['data'], 0, strlen($image_format_signature)) == $image_format_signature) { $atom_structure['image_mime'] = $mime; break; } } } $info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_structure['data'], 'description'=>'cover'); } else { $this->warning('Unknown empty "covr" image at offset '.$baseoffset); } } break; } break; default: $this->warning('Unknown QuickTime box type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxtype).'" ('.trim(getid3_lib::PrintHexBytes($boxtype)).') at offset '.$baseoffset); $atom_structure['data'] = $atom_data; } } } } $this->CopyToAppropriateCommentsSection($atomname, $atom_structure['data'], $atom_structure['name']); break; case 'play': $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $info['quicktime']['autoplay'] = $atom_structure['autoplay']; break; case 'WLOC': $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); break; case 'LOOP': case 'SelO': case 'AllF': $atom_structure['data'] = getid3_lib::BigEndian2Int($atom_data); break; case 'name': case 'MCPS': case '@PRM': case '@PRQ': $atom_structure['data'] = $atom_data; break; case 'cmvd': $atom_structure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); $CompressedFileData = substr($atom_data, 4); if ($UncompressedHeader = @gzuncompress($CompressedFileData)) { $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, 0, $atomHierarchy, $ParseAllPossibleAtoms); } else { $this->warning('Error decompressing compressed MOV atom at offset '.$atom_structure['offset']); } break; case 'dcom': $atom_structure['compression_id'] = $atom_data; $atom_structure['compression_text'] = $this->QuicktimeDCOMLookup($atom_data); break; case 'rdrf': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001); $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); switch ($atom_structure['reference_type_name']) { case 'url ': $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); break; case 'alis': $atom_structure['file_alias'] = substr($atom_data, 12); break; case 'rsrc': $atom_structure['resource_alias'] = substr($atom_data, 12); break; default: $atom_structure['data'] = substr($atom_data, 12); break; } break; case 'rmqu': $atom_structure['movie_quality'] = getid3_lib::BigEndian2Int($atom_data); break; case 'rmcs': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); break; case 'rmvc': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); break; case 'rmcd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['component_type'] = substr($atom_data, 4, 4); $atom_structure['component_subtype'] = substr($atom_data, 8, 4); $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4)); break; case 'rmdr': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10; break; case 'rmla': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { $info['comments']['language'][] = $atom_structure['language']; } break; case 'ptv ': $atom_structure['display_size_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); $atom_structure['reserved_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); $atom_structure['reserved_2'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['slide_show_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 1)); $atom_structure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 7, 1)); $atom_structure['flags']['play_on_open'] = (bool) $atom_structure['play_on_open_flag']; $atom_structure['flags']['slide_show'] = (bool) $atom_structure['slide_show_flag']; $ptv_lookup = array( 0 => 'normal', 1 => 'double', 2 => 'half', 3 => 'full', 4 => 'current' ); if (isset($ptv_lookup[$atom_structure['display_size_raw']])) { $atom_structure['display_size'] = $ptv_lookup[$atom_structure['display_size_raw']]; } else { $this->warning('unknown "ptv " display constant ('.$atom_structure['display_size_raw'].')'); } break; case 'stsd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); if ($atom_structure['number_entries'] > 0x000FFFFF) { if ($atom_structure['number_entries'] > 0x00FFFFFF) { $this->warning('"stsd" atom contains improbably large number_entries (0x'.getid3_lib::PrintHexBytes(substr($atom_data, 4, 4), true, false).' = '.$atom_structure['number_entries'].'), probably in error. Ignoring upper byte and interpreting this as 0x'.getid3_lib::PrintHexBytes(substr($atom_data, 5, 3), true, false).' = '.($atom_structure['number_entries'] & 0x00FFFFFF)); $atom_structure['number_entries'] = ($atom_structure['number_entries'] & 0x00FFFFFF); } else { $this->warning('"stsd" atom contains improbably large number_entries (0x'.getid3_lib::PrintHexBytes(substr($atom_data, 4, 4), true, false).' = '.$atom_structure['number_entries'].'), probably in error. Please report this to info@getid3.org referencing bug report #111'); } } $stsdEntriesDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); $stsdEntriesDataOffset += 4; $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); $stsdEntriesDataOffset += 4; $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6)); $stsdEntriesDataOffset += 6; $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2)); $stsdEntriesDataOffset += 2; $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); if (substr($atom_structure['sample_description_table'][$i]['data'], 1, 54) == 'application/octet-stream;type=com.parrot.videometadata') { $atom_structure['sample_description_table'][$i]['parrot_frame_metadata']['mime_type'] = substr($atom_structure['sample_description_table'][$i]['data'], 1, 55); $atom_structure['sample_description_table'][$i]['parrot_frame_metadata']['metadata_version'] = (int) substr($atom_structure['sample_description_table'][$i]['data'], 55, 1); unset($atom_structure['sample_description_table'][$i]['data']); $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in this version of getID3() ['.$this->getid3->version().']'); continue; } $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) { case "\x00\x00\x00\x00": $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); switch ($atom_structure['sample_description_table'][$i]['data_format']) { case '2vuY': case 'avc1': case 'cvid': case 'dvc ': case 'dvcp': case 'gif ': case 'h263': case 'jpeg': case 'kpcd': case 'mjpa': case 'mjpb': case 'mp4v': case 'png ': case 'raw ': case 'rle ': case 'rpza': case 'smc ': case 'SVQ1': case 'SVQ3': case 'tiff': case 'v210': case 'v216': case 'v308': case 'v408': case 'v410': case 'yuv2': $info['fileformat'] = 'mp4'; $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; if ($this->QuicktimeVideoCodecLookup($info['video']['fourcc'])) { $info['video']['fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($info['video']['fourcc']); } if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) { $info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width']; $info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height']; $info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x']; $info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y']; } break; case 'qtvr': $info['video']['dataformat'] = 'quicktimevr'; break; case 'mp4a': default: $info['quicktime']['audio']['codec'] = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']); $info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate']; $info['quicktime']['audio']['channels'] = $atom_structure['sample_description_table'][$i]['audio_channels']; $info['quicktime']['audio']['bit_depth'] = $atom_structure['sample_description_table'][$i]['audio_bit_depth']; $info['audio']['codec'] = $info['quicktime']['audio']['codec']; $info['audio']['sample_rate'] = $info['quicktime']['audio']['sample_rate']; $info['audio']['channels'] = $info['quicktime']['audio']['channels']; $info['audio']['bits_per_sample'] = $info['quicktime']['audio']['bit_depth']; switch ($atom_structure['sample_description_table'][$i]['data_format']) { case 'raw ': case 'alac': case 'sowt': case 'twos': case 'in24': case 'in32': case 'fl32': case 'fl64': $info['audio']['lossless'] = $info['quicktime']['audio']['lossless'] = true; $info['audio']['bitrate'] = $info['quicktime']['audio']['bitrate'] = $info['audio']['channels'] * $info['audio']['bits_per_sample'] * $info['audio']['sample_rate']; break; default: $info['audio']['lossless'] = false; break; } break; } break; default: switch ($atom_structure['sample_description_table'][$i]['data_format']) { case 'mp4s': $info['fileformat'] = 'mp4'; break; default: $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (((int) $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']); if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') { $info['quicktime']['video']['codec_fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; $info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']); $info['quicktime']['video']['codec'] = (((int) $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']); $info['quicktime']['video']['color_depth'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth']; $info['quicktime']['video']['color_depth_name'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_name']; $info['video']['codec'] = $info['quicktime']['video']['codec']; $info['video']['bits_per_sample'] = $info['quicktime']['video']['color_depth']; } $info['video']['lossless'] = false; $info['video']['pixel_aspect_ratio'] = (float) 1; break; } break; } switch (strtolower($atom_structure['sample_description_table'][$i]['data_format'])) { case 'mp4a': $info['audio']['dataformat'] = 'mp4'; $info['quicktime']['audio']['codec'] = 'mp4'; break; case '3ivx': case '3iv1': case '3iv2': $info['video']['dataformat'] = '3ivx'; break; case 'xvid': $info['video']['dataformat'] = 'xvid'; break; case 'mp4v': $info['video']['dataformat'] = 'mpeg4'; break; case 'divx': case 'div1': case 'div2': case 'div3': case 'div4': case 'div5': case 'div6': $info['video']['dataformat'] = 'divx'; break; default: break; } unset($atom_structure['sample_description_table'][$i]['data']); } break; case 'stts': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $sttsEntriesDataOffset = 8; $frames_count = 0; $max_stts_entries_to_scan = ($info['php_memory_limit'] ? min(floor($this->getid3->memory_limit / 10000), $atom_structure['number_entries']) : $atom_structure['number_entries']); if ($max_stts_entries_to_scan < $atom_structure['number_entries']) { $this->warning('QuickTime atom "stts" has '.$atom_structure['number_entries'].' but only scanning the first '.$max_stts_entries_to_scan.' entries due to limited PHP memory available ('.floor($this->getid3->memory_limit / 1048576).'MB).'); } for ($i = 0; $i < $max_stts_entries_to_scan; $i++) { $atom_structure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4)); $sttsEntriesDataOffset += 4; $atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4)); $sttsEntriesDataOffset += 4; $frames_count += $atom_structure['time_to_sample_table'][$i]['sample_count']; } $info['quicktime']['stts_framecount'][] = $frames_count; break; case 'stss': if ($ParseAllPossibleAtoms) { $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $stssEntriesDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4)); $stssEntriesDataOffset += 4; } } break; case 'stsc': if ($ParseAllPossibleAtoms) { $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $stscEntriesDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; $atom_structure['sample_to_chunk_table'][$i]['samples_per_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; $atom_structure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; } } break; case 'stsz': if ($ParseAllPossibleAtoms) { $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $stszEntriesDataOffset = 12; if ($atom_structure['sample_size'] == 0) { for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4)); $stszEntriesDataOffset += 4; } } } break; case 'stco': if ($ParseAllPossibleAtoms) { $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $stcoEntriesDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4)); $stcoEntriesDataOffset += 4; } } break; case 'co64': if ($ParseAllPossibleAtoms) { $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $stcoEntriesDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8)); $stcoEntriesDataOffset += 8; } } break; case 'dref': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $drefDataOffset = 8; for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); $drefDataOffset += 4; $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); $drefDataOffset += 4; $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); $drefDataOffset += 1; $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); $drefDataOffset += 3; $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); } break; case 'gmin': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2)); $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); break; case 'smhd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); break; case 'vmhd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001); break; case 'hdlr': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['component_type'] = substr($atom_data, 4, 4); $atom_structure['component_subtype'] = substr($atom_data, 8, 4); $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); $atom_structure['component_name'] = $this->MaybePascal2String(substr($atom_data, 24)); if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) { $info['video']['dataformat'] = 'quicktimevr'; } break; case 'mdhd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2)); $atom_structure['quality'] = getid3_lib::BigEndian2Int(substr($atom_data, 22, 2)); if ($atom_structure['time_scale'] == 0) { $this->error('Corrupt Quicktime file: mdhd.time_scale == zero'); return false; } $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { $info['comments']['language'][] = $atom_structure['language']; } $info['quicktime']['timestamps_unix']['create'][$atom_structure['hierarchy']] = $atom_structure['creation_time_unix']; $info['quicktime']['timestamps_unix']['modify'][$atom_structure['hierarchy']] = $atom_structure['modify_time_unix']; break; case 'pnot': $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['atom_type'] = substr($atom_data, 6, 4); $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); $info['quicktime']['timestamps_unix']['modify'][$atom_structure['hierarchy']] = $atom_structure['modification_date_unix']; break; case 'crgn': $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); $atom_structure['clipping_data'] = substr($atom_data, 10); break; case 'load': $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020); $atom_structure['default_hints']['high_quality'] = (bool) ($atom_structure['default_hints_raw'] & 0x0100); break; case 'tmcd': case 'chap': case 'sync': case 'scpt': case 'ssrc': for ($i = 0; $i < strlen($atom_data); $i += 4) { @$atom_structure['track_id'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4)); } break; case 'elst': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) { $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4)); } break; case 'kmat': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['matte_data_raw'] = substr($atom_data, 4); break; case 'ctab': $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) { $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2)); $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2)); $atom_structure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2)); $atom_structure['color_table'][$colortableentry]['blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2)); } break; case 'mvhd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4)); $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); $atom_structure['reserved'] = substr($atom_data, 26, 10); $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4)); $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4)); $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4)); $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); if ($atom_structure['time_scale'] == 0) { $this->error('Corrupt Quicktime file: mvhd.time_scale == zero'); return false; } $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); $info['quicktime']['timestamps_unix']['create'][$atom_structure['hierarchy']] = $atom_structure['creation_time_unix']; $info['quicktime']['timestamps_unix']['modify'][$atom_structure['hierarchy']] = $atom_structure['modify_time_unix']; $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); $info['quicktime']['display_scale'] = $atom_structure['matrix_a']; $info['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; break; case 'tkhd': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4)); $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4)); $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4)); $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4)); $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4)); $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001); $atom_structure['flags']['in_movie'] = (bool) ($atom_structure['flags_raw'] & 0x0002); $atom_structure['flags']['in_preview'] = (bool) ($atom_structure['flags_raw'] & 0x0004); $atom_structure['flags']['in_poster'] = (bool) ($atom_structure['flags_raw'] & 0x0008); $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); $info['quicktime']['timestamps_unix']['create'][$atom_structure['hierarchy']] = $atom_structure['creation_time_unix']; $info['quicktime']['timestamps_unix']['modify'][$atom_structure['hierarchy']] = $atom_structure['modify_time_unix']; $matrixRotation = 0; switch ($atom_structure['matrix_a'].':'.$atom_structure['matrix_b'].':'.$atom_structure['matrix_c'].':'.$atom_structure['matrix_d']) { case '1:0:0:1': $matrixRotation = 0; break; case '0:1:65535:0': $matrixRotation = 90; break; case '65535:0:0:65535': $matrixRotation = 180; break; case '0:65535:1:0': $matrixRotation = 270; break; default: break; } if (!isset($info['video']['rotate']) || (($info['video']['rotate'] == 0) && ($matrixRotation > 0))) { $info['quicktime']['video']['rotate'] = $info['video']['rotate'] = $matrixRotation; } if ($atom_structure['flags']['enabled'] == 1) { if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) { $info['video']['resolution_x'] = $atom_structure['width']; $info['video']['resolution_y'] = $atom_structure['height']; } $info['video']['resolution_x'] = max($info['video']['resolution_x'], $atom_structure['width']); $info['video']['resolution_y'] = max($info['video']['resolution_y'], $atom_structure['height']); $info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x']; $info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y']; } else { } break; case 'iods': $offset = 0; $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); $offset += 3; $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) { $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); $offset += 1; $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; } $atom_structure['audio_profile_name'] = $this->QuicktimeIODSaudioProfileName($atom_structure['audio_profile_id']); $atom_structure['video_profile_name'] = $this->QuicktimeIODSvideoProfileName($atom_structure['video_profile_id']); break; case 'ftyp': $atom_structure['signature'] = substr($atom_data, 0, 4); $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $atom_structure['fourcc'] = substr($atom_data, 8, 4); break; case 'mdat': $mdat_offset = 0; while (true) { if (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x08".'wide') { $mdat_offset += 8; } elseif (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x00".'mdat') { $mdat_offset += 8; } else { break; } } if (substr($atom_data, $mdat_offset, 4) == 'GPRO') { $GOPRO_chunk_length = getid3_lib::LittleEndian2Int(substr($atom_data, $mdat_offset + 4, 4)); $GOPRO_offset = 8; $atom_structure['GPRO']['raw'] = substr($atom_data, $mdat_offset + 8, $GOPRO_chunk_length - 8); $atom_structure['GPRO']['firmware'] = substr($atom_structure['GPRO']['raw'], 0, 15); $atom_structure['GPRO']['unknown1'] = substr($atom_structure['GPRO']['raw'], 15, 16); $atom_structure['GPRO']['unknown2'] = substr($atom_structure['GPRO']['raw'], 31, 32); $atom_structure['GPRO']['unknown3'] = substr($atom_structure['GPRO']['raw'], 63, 16); $atom_structure['GPRO']['camera'] = substr($atom_structure['GPRO']['raw'], 79, 32); $info['quicktime']['camera']['model'] = rtrim($atom_structure['GPRO']['camera'], "\x00"); } while (($mdat_offset < (strlen($atom_data) - 8)) && ($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) && ($chapter_string_length < 1000) && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) && preg_match('#^([\x00-\xFF]{2})([\x20-\xFF]+)$#', substr($atom_data, $mdat_offset, $chapter_string_length + 2), $chapter_matches)) { list($dummy, $chapter_string_length_hex, $chapter_string) = $chapter_matches; $mdat_offset += (2 + $chapter_string_length); @$info['quicktime']['comments']['chapters'][] = $chapter_string; if (substr($atom_data, $mdat_offset, 12) == "\x00\x00\x00\x0C\x65\x6E\x63\x64\x00\x00\x01\x00") { $mdat_offset += 12; } } if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { $info['avdataoffset'] = $atom_structure['offset'] + 8; $OldAVDataEnd = $info['avdataend']; $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; $getid3_temp->info['avdataend'] = $info['avdataend']; $getid3_mp3 = new getid3_mp3($getid3_temp); if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) { $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $value) { $this->warning($value); } } if (!empty($getid3_temp->info['mpeg'])) { $info['mpeg'] = $getid3_temp->info['mpeg']; if (isset($info['mpeg']['audio'])) { $info['audio']['dataformat'] = 'mp3'; $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; $info['audio']['channels'] = $info['mpeg']['audio']['channels']; $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); $info['bitrate'] = $info['audio']['bitrate']; } } } unset($getid3_mp3, $getid3_temp); $info['avdataend'] = $OldAVDataEnd; unset($OldAVDataEnd); } unset($mdat_offset, $chapter_string_length, $chapter_matches); break; case 'free': case 'skip': case 'wide': break; case 'nsav': $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); break; case 'ctyp': $atom_structure['ctyp'] = substr($atom_data, 0, 4); $info['quicktime']['controller'] = $atom_structure['ctyp']; switch ($atom_structure['ctyp']) { case 'qtvr': $info['video']['dataformat'] = 'quicktimevr'; break; } break; case 'pano': $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); break; case 'hint': case 'hinf': case 'hinv': case 'hnti': $info['quicktime']['hinting'] = true; break; case 'imgt': for ($i = 0; $i < ($atom_structure['size'] - 8); $i += 4) { $atom_structure['imgt'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4)); } break; case 'FXTC': case 'PrmA': case 'code': case 'FIEL': case 'tapt': case 'ctts': case 'cslg': case 'sdtp': case 'stps': break; case "\xA9".'xyz': $atom_structure['data'] = $atom_data; if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) { @list($all, $latitude, $longitude, $altitude) = $matches; $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); if (!empty($altitude)) { $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); } } else { $this->warning('QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.'. Please report as getID3() bug.'); } break; case 'NCDT': $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms); break; case 'NCTH': case 'NCVW': case 'NCM1': case 'NCM2': if (preg_match('/^\xFF\xD8\xFF/', $atom_data)) { $descriptions = array( 'NCTH' => 'Nikon Camera Thumbnail Image', 'NCVW' => 'Nikon Camera Preview Image', 'NCM1' => 'Nikon Camera Preview Image 1', 'NCM2' => 'Nikon Camera Preview Image 2', ); $atom_structure['data'] = $atom_data; $atom_structure['image_mime'] = 'image/jpeg'; $atom_structure['description'] = isset($descriptions[$atomname]) ? $descriptions[$atomname] : 'Nikon preview image'; $info['quicktime']['comments']['picture'][] = array( 'image_mime' => $atom_structure['image_mime'], 'data' => $atom_data, 'description' => $atom_structure['description'] ); } break; case 'NCTG': getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.nikon-nctg.php', __FILE__, true); $nikonNCTG = new getid3_tag_nikon_nctg($this->getid3); $atom_structure['data'] = $nikonNCTG->parse($atom_data); break; case 'NCHD': $makerNoteVersion = ''; for ($i = 0, $iMax = strlen($atom_data); $i < $iMax; ++$i) { if (ord($atom_data[$i]) >= 0x00 && ord($atom_data[$i]) <= 0x1F) { $makerNoteVersion .= ' '.ord($atom_data[$i]); } else { $makerNoteVersion .= $atom_data[$i]; } } $makerNoteVersion = rtrim($makerNoteVersion, "\x00"); $atom_structure['data'] = array( 'MakerNoteVersion' => $makerNoteVersion ); break; case 'NCDB': case 'CNCV': $atom_structure['data'] = $atom_data; break; case "\x00\x00\x00\x00": $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); break; case 'meta': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); break; case 'data': static $metaDATAkey = 1; $atom_structure['language'] = substr($atom_data, 4 + 0, 2); $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); $atom_structure['data'] = substr($atom_data, 4 + 4); $atom_structure['key_name'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++]; if ($atom_structure['key_name'] && $atom_structure['data']) { @$info['quicktime']['comments'][str_replace('com.apple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data']; } break; case 'keys': $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); $atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); $keys_atom_offset = 8; for ($i = 1; $i <= $atom_structure['entry_count']; $i++) { $atom_structure['keys'][$i]['key_size'] = getid3_lib::BigEndian2Int(substr($atom_data, $keys_atom_offset + 0, 4)); $atom_structure['keys'][$i]['key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4); $atom_structure['keys'][$i]['key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure['keys'][$i]['key_size'] - 8); $keys_atom_offset += $atom_structure['keys'][$i]['key_size']; $info['quicktime']['temp_meta_key_names'][$i] = $atom_structure['keys'][$i]['key_value']; } break; case 'uuid': $uuid_bytes_read = unpack('H8time_low/H4time_mid/H4time_hi/H4clock_seq_hi/H12clock_seq_low', substr($atom_data, 0, 16)); $atom_structure['uuid_field_id'] = implode('-', $uuid_bytes_read); switch ($atom_structure['uuid_field_id']) { case '0537cdab-9d0c-4431-a72a-fa561f2a113e': case '2c4c0100-8504-40b9-a03e-562148d6dfeb': case '33c7a4d2-b81d-4723-a0ba-f1a3e097ad38': case '8974dbce-7be7-4c51-84f9-7148f9882554': case '96a9f1f1-dc98-402d-a7ae-d68e34451809': case 'a2394f52-5a9b-4f14-a244-6c427c648df4': case 'b14bf8bd-083d-4b43-a5ae-8cd7d5a6ce03': case 'd08a4f18-10f3-4a82-b6c8-32d8aba183d3': $this->warning('Unhandled (but recognized) "uuid" atom identified by "'.$atom_structure['uuid_field_id'].'" at offset '.$atom_structure['offset'].' ('.strlen($atom_data).' bytes)'); break; case 'be7acfcb-97a9-42e8-9c71-999491e3afac': $atom_structure['xml'] = substr($atom_data, 16, strlen($atom_data) - 16 - 8); break; case 'efe1589a-bb77-49ef-8095-27759eb1dc6f': $atom_structure['title'] = '360Fly Sensor Data'; $uuid_bytes_read = unpack('vheader_size/vheader_version/vtimescale/vhardware_version/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/', substr($atom_data, 16, 32)); $atom_structure['uuid_header'] = $uuid_bytes_read; $start_byte = 48; $atom_SENSOR_data = substr($atom_data, $start_byte); $atom_structure['sensor_data']['data_type'] = array( 'fusion_count' => 0, 'fusion_data' => array(), 'accel_count' => 0, 'accel_data' => array(), 'gyro_count' => 0, 'gyro_data' => array(), 'magno_count' => 0, 'magno_data' => array(), 'gps_count' => 0, 'gps_data' => array(), 'rotation_count' => 0, 'rotation_data' => array(), 'unknown_count' => 0, 'unknown_data' => array(), 'debug_list' => '', ); $debug_structure = array(); $debug_structure['debug_items'] = array(); foreach (str_split($atom_SENSOR_data, 32) as $sensor_key => $sensor_data) { $sensor_data_type = substr($sensor_data, 0, 1); $sensor_data_content = substr($sensor_data, 1); $uuid_bytes_read = unpack('C*', $sensor_data_type); $sensor_data_array = array(); switch ($uuid_bytes_read[1]) { case 250: $atom_structure['sensor_data']['data_type']['fusion_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; $sensor_data_array['roll'] = $uuid_bytes_read['roll']; array_push($atom_structure['sensor_data']['data_type']['fusion_data'], $sensor_data_array); break; case 1: $atom_structure['sensor_data']['data_type']['accel_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; $sensor_data_array['roll'] = $uuid_bytes_read['roll']; array_push($atom_structure['sensor_data']['data_type']['accel_data'], $sensor_data_array); break; case 2: $atom_structure['sensor_data']['data_type']['gyro_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; $sensor_data_array['roll'] = $uuid_bytes_read['roll']; array_push($atom_structure['sensor_data']['data_type']['gyro_data'], $sensor_data_array); break; case 3: $atom_structure['sensor_data']['data_type']['magno_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Gmagx/Gmagy/Gmagz/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['magx'] = $uuid_bytes_read['magx']; $sensor_data_array['magy'] = $uuid_bytes_read['magy']; $sensor_data_array['magz'] = $uuid_bytes_read['magz']; array_push($atom_structure['sensor_data']['data_type']['magno_data'], $sensor_data_array); break; case 5: $atom_structure['sensor_data']['data_type']['gps_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Glat/Glon/Galt/Gspeed/nbearing/nacc/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['lat'] = $uuid_bytes_read['lat']; $sensor_data_array['lon'] = $uuid_bytes_read['lon']; $sensor_data_array['alt'] = $uuid_bytes_read['alt']; $sensor_data_array['speed'] = $uuid_bytes_read['speed']; $sensor_data_array['bearing'] = $uuid_bytes_read['bearing']; $sensor_data_array['acc'] = $uuid_bytes_read['acc']; array_push($atom_structure['sensor_data']['data_type']['gps_data'], $sensor_data_array); break; case 6: $atom_structure['sensor_data']['data_type']['rotation_count']++; $uuid_bytes_read = unpack('cmode/Jtimestamp/Grotx/Groty/Grotz/x*', $sensor_data_content); $sensor_data_array['mode'] = $uuid_bytes_read['mode']; $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; $sensor_data_array['rotx'] = $uuid_bytes_read['rotx']; $sensor_data_array['roty'] = $uuid_bytes_read['roty']; $sensor_data_array['rotz'] = $uuid_bytes_read['rotz']; array_push($atom_structure['sensor_data']['data_type']['rotation_data'], $sensor_data_array); break; default: $atom_structure['sensor_data']['data_type']['unknown_count']++; break; } } $atom_structure['sensor_data']['data_type']['debug_list'] = 'No debug items in list!'; break; default: $this->warning('Unhandled "uuid" atom identified by "'.$atom_structure['uuid_field_id'].'" at offset '.$atom_structure['offset'].' ('.strlen($atom_data).' bytes)'); } break; case 'gps ': $GPS_rowsize = 8; if (strlen($atom_data) > 0) { if ((strlen($atom_data) % $GPS_rowsize) == 0) { $atom_structure['gps_toc'] = array(); foreach (str_split($atom_data, $GPS_rowsize) as $counter => $datapair) { $atom_structure['gps_toc'][] = unpack('Noffset/Nsize', substr($atom_data, $counter * $GPS_rowsize, $GPS_rowsize)); } $atom_structure['gps_entries'] = array(); $previous_offset = $this->ftell(); foreach ($atom_structure['gps_toc'] as $key => $gps_pointer) { if ($key == 0) { continue; } $this->fseek($gps_pointer['offset']); $GPS_free_data = $this->fread($gps_pointer['size']); if (preg_match('#\\$GPRMC,([0-9\\.]*),([AV]),([0-9\\.]*),([NS]),([0-9\\.]*),([EW]),([0-9\\.]*),([0-9\\.]*),([0-9]*),([0-9\\.]*),([EW]?)(,[A])?(\\*[0-9A-F]{2})#', $GPS_free_data, $matches)) { $GPS_this_GPRMC = array(); $GPS_this_GPRMC_raw = array(); list( $GPS_this_GPRMC_raw['gprmc'], $GPS_this_GPRMC_raw['timestamp'], $GPS_this_GPRMC_raw['status'], $GPS_this_GPRMC_raw['latitude'], $GPS_this_GPRMC_raw['latitude_direction'], $GPS_this_GPRMC_raw['longitude'], $GPS_this_GPRMC_raw['longitude_direction'], $GPS_this_GPRMC_raw['knots'], $GPS_this_GPRMC_raw['angle'], $GPS_this_GPRMC_raw['datestamp'], $GPS_this_GPRMC_raw['variation'], $GPS_this_GPRMC_raw['variation_direction'], $dummy, $GPS_this_GPRMC_raw['checksum'], ) = $matches; $GPS_this_GPRMC['raw'] = $GPS_this_GPRMC_raw; $hour = substr($GPS_this_GPRMC['raw']['timestamp'], 0, 2); $minute = substr($GPS_this_GPRMC['raw']['timestamp'], 2, 2); $second = substr($GPS_this_GPRMC['raw']['timestamp'], 4, 2); $ms = substr($GPS_this_GPRMC['raw']['timestamp'], 6); $day = substr($GPS_this_GPRMC['raw']['datestamp'], 0, 2); $month = substr($GPS_this_GPRMC['raw']['datestamp'], 2, 2); $year = (int) substr($GPS_this_GPRMC['raw']['datestamp'], 4, 2); $year += (($year > 90) ? 1900 : 2000); $GPS_this_GPRMC['timestamp'] = $year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second.$ms; $GPS_this_GPRMC['active'] = ($GPS_this_GPRMC['raw']['status'] == 'A'); foreach (array('latitude','longitude') as $latlon) { preg_match('#^([0-9]{1,3})([0-9]{2}\\.[0-9]+)$#', $GPS_this_GPRMC['raw'][$latlon], $matches); list($dummy, $deg, $min) = $matches; $GPS_this_GPRMC[$latlon] = $deg + ($min / 60); } $GPS_this_GPRMC['latitude'] *= (($GPS_this_GPRMC['raw']['latitude_direction'] == 'S') ? -1 : 1); $GPS_this_GPRMC['longitude'] *= (($GPS_this_GPRMC['raw']['longitude_direction'] == 'W') ? -1 : 1); $GPS_this_GPRMC['heading'] = $GPS_this_GPRMC['raw']['angle']; $GPS_this_GPRMC['speed_knot'] = $GPS_this_GPRMC['raw']['knots']; $GPS_this_GPRMC['speed_kmh'] = $GPS_this_GPRMC['raw']['knots'] * 1.852; if ($GPS_this_GPRMC['raw']['variation']) { $GPS_this_GPRMC['variation'] = $GPS_this_GPRMC['raw']['variation']; $GPS_this_GPRMC['variation'] *= (($GPS_this_GPRMC['raw']['variation_direction'] == 'W') ? -1 : 1); } $atom_structure['gps_entries'][$key] = $GPS_this_GPRMC; @$info['quicktime']['gps_track'][$GPS_this_GPRMC['timestamp']] = array( 'latitude' => (float) $GPS_this_GPRMC['latitude'], 'longitude' => (float) $GPS_this_GPRMC['longitude'], 'speed_kmh' => (float) $GPS_this_GPRMC['speed_kmh'], 'heading' => (float) $GPS_this_GPRMC['heading'], ); } else { $this->warning('Unhandled GPS format in "free" atom at offset '.$gps_pointer['offset']); } } $this->fseek($previous_offset); } else { $this->warning('QuickTime atom "'.$atomname.'" is not mod-8 bytes long ('.$atomsize.' bytes) at offset '.$baseoffset); } } else { $this->warning('QuickTime atom "'.$atomname.'" is zero bytes long at offset '.$baseoffset); } break; case 'loci': $loffset = 0; $info['quicktime']['comments']['gps_flags'] = array( getid3_lib::BigEndian2Int(substr($atom_data, 0, 4))); $info['quicktime']['comments']['gps_lang'] = array( getid3_lib::BigEndian2Int(substr($atom_data, 4, 2))); $info['quicktime']['comments']['gps_location'] = array( $this->LociString(substr($atom_data, 6), $loffset)); $loci_data = substr($atom_data, 6 + $loffset); $info['quicktime']['comments']['gps_role'] = array( getid3_lib::BigEndian2Int(substr($loci_data, 0, 1))); $info['quicktime']['comments']['gps_longitude'] = array(getid3_lib::FixedPoint16_16(substr($loci_data, 1, 4))); $info['quicktime']['comments']['gps_latitude'] = array(getid3_lib::FixedPoint16_16(substr($loci_data, 5, 4))); $info['quicktime']['comments']['gps_altitude'] = array(getid3_lib::FixedPoint16_16(substr($loci_data, 9, 4))); $info['quicktime']['comments']['gps_body'] = array( $this->LociString(substr($loci_data, 13 ), $loffset)); $info['quicktime']['comments']['gps_notes'] = array( $this->LociString(substr($loci_data, 13 + $loffset), $loffset)); break; case 'chpl': $chpl_version = getid3_lib::BigEndian2Int(substr($atom_data, 4, 1)); $chpl_flags = getid3_lib::BigEndian2Int(substr($atom_data, 5, 3)); $chpl_count = getid3_lib::BigEndian2Int(substr($atom_data, 8, 1)); $chpl_offset = 9; for ($i = 0; $i < $chpl_count; $i++) { if (($chpl_offset + 9) >= strlen($atom_data)) { $this->warning('QuickTime chapter '.$i.' extends beyond end of "chpl" atom'); break; } $info['quicktime']['chapters'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 8)) / 10000000; $chpl_offset += 8; $chpl_title_size = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 1)); $chpl_offset += 1; $info['quicktime']['chapters'][$i]['title'] = substr($atom_data, $chpl_offset, $chpl_title_size); $chpl_offset += $chpl_title_size; } break; case 'FIRM': $info['quicktime']['camera']['firmware'] = $atom_data; break; case 'CAME': $info['quicktime']['camera']['serial_hash'] = unpack('H*', $atom_data); break; case 'dscp': case 'rcif': if (substr($atom_data, 0, 7) == "\x00\x00\x00\x00\x55\xC4".'{') { if ($json_decoded = @json_decode(rtrim(substr($atom_data, 6), "\x00"), true)) { $info['quicktime']['camera'][$atomname] = $json_decoded; if (($atomname == 'rcif') && isset($info['quicktime']['camera']['rcif']['wxcamera']['rotate'])) { $info['video']['rotate'] = $info['quicktime']['video']['rotate'] = $info['quicktime']['camera']['rcif']['wxcamera']['rotate']; } } else { $this->warning('Failed to JSON decode atom "'.$atomname.'"'); $atom_structure['data'] = $atom_data; } unset($json_decoded); } else { $this->warning('Expecting 55 C4 7B at start of atom "'.$atomname.'", found '.getid3_lib::PrintHexBytes(substr($atom_data, 4, 3)).' instead'); $atom_structure['data'] = $atom_data; } break; case 'frea': $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms); break; case 'tima': $atom_structure['data'] = $atom_data; break; case 'ver ': $atom_structure['data'] = $atom_data; break; case 'thma': if (strlen($atom_data) > 0) { $info['quicktime']['comments']['picture'][] = array('data'=>$atom_data, 'image_mime'=>'image/jpeg', 'description'=>'ThumbnailImage'); } break; case 'scra': if (strlen($atom_data) > 0) { $info['quicktime']['comments']['picture'][] = array('data'=>$atom_data, 'image_mime'=>'image/jpeg', 'description'=>'PreviewImage'); } break; case 'cdsc': $atom_structure['track_number'] = getid3_lib::BigEndian2Int($atom_data); break; default: $this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).'), '.$atomsize.' bytes at offset '.$baseoffset); $atom_structure['data'] = $atom_data; break; } } array_pop($atomHierarchy); return $atom_structure; } public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { $atom_structure = array(); $subatomoffset = 0; $subatomcounter = 0; if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) { return false; } while ($subatomoffset < strlen($atom_data)) { $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4)); $subatomname = substr($atom_data, $subatomoffset + 4, 4); $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); if ($subatomsize == 0) { if (strlen($atom_data) > 12) { $subatomoffset += 4; continue; } break; } if (strlen($subatomdata) < ($subatomsize - 8)) { break; } $atom_structure[$subatomcounter++] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms); $subatomoffset += $subatomsize; } if (empty($atom_structure)) { return false; } return $atom_structure; } public function quicktime_read_mp4_descr_length($data, &$offset) { $num_bytes = 0; $length = 0; do { $b = ord(substr($data, $offset++, 1)); $length = ($length << 7) | ($b & 0x7F); } while (($b & 0x80) && ($num_bytes++ < 4)); return $length; } public function QuicktimeLanguageLookup($languageid) { static $QuicktimeLanguageLookup = array(); if (empty($QuicktimeLanguageLookup)) { $QuicktimeLanguageLookup[0] = 'English'; $QuicktimeLanguageLookup[1] = 'French'; $QuicktimeLanguageLookup[2] = 'German'; $QuicktimeLanguageLookup[3] = 'Italian'; $QuicktimeLanguageLookup[4] = 'Dutch'; $QuicktimeLanguageLookup[5] = 'Swedish'; $QuicktimeLanguageLookup[6] = 'Spanish'; $QuicktimeLanguageLookup[7] = 'Danish'; $QuicktimeLanguageLookup[8] = 'Portuguese'; $QuicktimeLanguageLookup[9] = 'Norwegian'; $QuicktimeLanguageLookup[10] = 'Hebrew'; $QuicktimeLanguageLookup[11] = 'Japanese'; $QuicktimeLanguageLookup[12] = 'Arabic'; $QuicktimeLanguageLookup[13] = 'Finnish'; $QuicktimeLanguageLookup[14] = 'Greek'; $QuicktimeLanguageLookup[15] = 'Icelandic'; $QuicktimeLanguageLookup[16] = 'Maltese'; $QuicktimeLanguageLookup[17] = 'Turkish'; $QuicktimeLanguageLookup[18] = 'Croatian'; $QuicktimeLanguageLookup[19] = 'Chinese (Traditional)'; $QuicktimeLanguageLookup[20] = 'Urdu'; $QuicktimeLanguageLookup[21] = 'Hindi'; $QuicktimeLanguageLookup[22] = 'Thai'; $QuicktimeLanguageLookup[23] = 'Korean'; $QuicktimeLanguageLookup[24] = 'Lithuanian'; $QuicktimeLanguageLookup[25] = 'Polish'; $QuicktimeLanguageLookup[26] = 'Hungarian'; $QuicktimeLanguageLookup[27] = 'Estonian'; $QuicktimeLanguageLookup[28] = 'Lettish'; $QuicktimeLanguageLookup[28] = 'Latvian'; $QuicktimeLanguageLookup[29] = 'Saamisk'; $QuicktimeLanguageLookup[29] = 'Lappish'; $QuicktimeLanguageLookup[30] = 'Faeroese'; $QuicktimeLanguageLookup[31] = 'Farsi'; $QuicktimeLanguageLookup[31] = 'Persian'; $QuicktimeLanguageLookup[32] = 'Russian'; $QuicktimeLanguageLookup[33] = 'Chinese (Simplified)'; $QuicktimeLanguageLookup[34] = 'Flemish'; $QuicktimeLanguageLookup[35] = 'Irish'; $QuicktimeLanguageLookup[36] = 'Albanian'; $QuicktimeLanguageLookup[37] = 'Romanian'; $QuicktimeLanguageLookup[38] = 'Czech'; $QuicktimeLanguageLookup[39] = 'Slovak'; $QuicktimeLanguageLookup[40] = 'Slovenian'; $QuicktimeLanguageLookup[41] = 'Yiddish'; $QuicktimeLanguageLookup[42] = 'Serbian'; $QuicktimeLanguageLookup[43] = 'Macedonian'; $QuicktimeLanguageLookup[44] = 'Bulgarian'; $QuicktimeLanguageLookup[45] = 'Ukrainian'; $QuicktimeLanguageLookup[46] = 'Byelorussian'; $QuicktimeLanguageLookup[47] = 'Uzbek'; $QuicktimeLanguageLookup[48] = 'Kazakh'; $QuicktimeLanguageLookup[49] = 'Azerbaijani'; $QuicktimeLanguageLookup[50] = 'AzerbaijanAr'; $QuicktimeLanguageLookup[51] = 'Armenian'; $QuicktimeLanguageLookup[52] = 'Georgian'; $QuicktimeLanguageLookup[53] = 'Moldavian'; $QuicktimeLanguageLookup[54] = 'Kirghiz'; $QuicktimeLanguageLookup[55] = 'Tajiki'; $QuicktimeLanguageLookup[56] = 'Turkmen'; $QuicktimeLanguageLookup[57] = 'Mongolian'; $QuicktimeLanguageLookup[58] = 'MongolianCyr'; $QuicktimeLanguageLookup[59] = 'Pashto'; $QuicktimeLanguageLookup[60] = 'Kurdish'; $QuicktimeLanguageLookup[61] = 'Kashmiri'; $QuicktimeLanguageLookup[62] = 'Sindhi'; $QuicktimeLanguageLookup[63] = 'Tibetan'; $QuicktimeLanguageLookup[64] = 'Nepali'; $QuicktimeLanguageLookup[65] = 'Sanskrit'; $QuicktimeLanguageLookup[66] = 'Marathi'; $QuicktimeLanguageLookup[67] = 'Bengali'; $QuicktimeLanguageLookup[68] = 'Assamese'; $QuicktimeLanguageLookup[69] = 'Gujarati'; $QuicktimeLanguageLookup[70] = 'Punjabi'; $QuicktimeLanguageLookup[71] = 'Oriya'; $QuicktimeLanguageLookup[72] = 'Malayalam'; $QuicktimeLanguageLookup[73] = 'Kannada'; $QuicktimeLanguageLookup[74] = 'Tamil'; $QuicktimeLanguageLookup[75] = 'Telugu'; $QuicktimeLanguageLookup[76] = 'Sinhalese'; $QuicktimeLanguageLookup[77] = 'Burmese'; $QuicktimeLanguageLookup[78] = 'Khmer'; $QuicktimeLanguageLookup[79] = 'Lao'; $QuicktimeLanguageLookup[80] = 'Vietnamese'; $QuicktimeLanguageLookup[81] = 'Indonesian'; $QuicktimeLanguageLookup[82] = 'Tagalog'; $QuicktimeLanguageLookup[83] = 'MalayRoman'; $QuicktimeLanguageLookup[84] = 'MalayArabic'; $QuicktimeLanguageLookup[85] = 'Amharic'; $QuicktimeLanguageLookup[86] = 'Tigrinya'; $QuicktimeLanguageLookup[87] = 'Galla'; $QuicktimeLanguageLookup[87] = 'Oromo'; $QuicktimeLanguageLookup[88] = 'Somali'; $QuicktimeLanguageLookup[89] = 'Swahili'; $QuicktimeLanguageLookup[90] = 'Ruanda'; $QuicktimeLanguageLookup[91] = 'Rundi'; $QuicktimeLanguageLookup[92] = 'Chewa'; $QuicktimeLanguageLookup[93] = 'Malagasy'; $QuicktimeLanguageLookup[94] = 'Esperanto'; $QuicktimeLanguageLookup[128] = 'Welsh'; $QuicktimeLanguageLookup[129] = 'Basque'; $QuicktimeLanguageLookup[130] = 'Catalan'; $QuicktimeLanguageLookup[131] = 'Latin'; $QuicktimeLanguageLookup[132] = 'Quechua'; $QuicktimeLanguageLookup[133] = 'Guarani'; $QuicktimeLanguageLookup[134] = 'Aymara'; $QuicktimeLanguageLookup[135] = 'Tatar'; $QuicktimeLanguageLookup[136] = 'Uighur'; $QuicktimeLanguageLookup[137] = 'Dzongkha'; $QuicktimeLanguageLookup[138] = 'JavaneseRom'; $QuicktimeLanguageLookup[32767] = 'Unspecified'; } if (($languageid > 138) && ($languageid < 32767)) { $iso_language_id = ''; $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60); $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); $QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id); } return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); } public function QuicktimeVideoCodecLookup($codecid) { static $QuicktimeVideoCodecLookup = array(); if (empty($QuicktimeVideoCodecLookup)) { $QuicktimeVideoCodecLookup['.SGI'] = 'SGI'; $QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1'; $QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2'; $QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4'; $QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB'; $QuicktimeVideoCodecLookup['avc1'] = 'H.264/MPEG-4 AVC'; $QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG'; $QuicktimeVideoCodecLookup['b16g'] = '16Gray'; $QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray'; $QuicktimeVideoCodecLookup['b48r'] = '48RGB'; $QuicktimeVideoCodecLookup['b64a'] = '64ARGB'; $QuicktimeVideoCodecLookup['base'] = 'Base'; $QuicktimeVideoCodecLookup['clou'] = 'Cloud'; $QuicktimeVideoCodecLookup['cmyk'] = 'CMYK'; $QuicktimeVideoCodecLookup['cvid'] = 'Cinepak'; $QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG'; $QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC'; $QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL'; $QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC'; $QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL'; $QuicktimeVideoCodecLookup['fire'] = 'Fire'; $QuicktimeVideoCodecLookup['flic'] = 'FLC'; $QuicktimeVideoCodecLookup['gif '] = 'GIF'; $QuicktimeVideoCodecLookup['h261'] = 'H261'; $QuicktimeVideoCodecLookup['h263'] = 'H263'; $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4'; $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG'; $QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD'; $QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A'; $QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B'; $QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1'; $QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420'; $QuicktimeVideoCodecLookup['path'] = 'Vector'; $QuicktimeVideoCodecLookup['png '] = 'PNG'; $QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint'; $QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX'; $QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw'; $QuicktimeVideoCodecLookup['raw '] = 'RAW'; $QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple'; $QuicktimeVideoCodecLookup['rpza'] = 'Video'; $QuicktimeVideoCodecLookup['smc '] = 'Graphics'; $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1'; $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3'; $QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9'; $QuicktimeVideoCodecLookup['tga '] = 'Targa'; $QuicktimeVideoCodecLookup['tiff'] = 'TIFF'; $QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW'; $QuicktimeVideoCodecLookup['WRLE'] = 'BMP'; $QuicktimeVideoCodecLookup['y420'] = 'YUV420'; $QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo'; $QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned'; $QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned'; } return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : ''); } public function QuicktimeAudioCodecLookup($codecid) { static $QuicktimeAudioCodecLookup = array(); if (empty($QuicktimeAudioCodecLookup)) { $QuicktimeAudioCodecLookup['.mp3'] = 'Fraunhofer MPEG Layer-III alias'; $QuicktimeAudioCodecLookup['aac '] = 'ISO/IEC 14496-3 AAC'; $QuicktimeAudioCodecLookup['agsm'] = 'Apple GSM 10:1'; $QuicktimeAudioCodecLookup['alac'] = 'Apple Lossless Audio Codec'; $QuicktimeAudioCodecLookup['alaw'] = 'A-law 2:1'; $QuicktimeAudioCodecLookup['conv'] = 'Sample Format'; $QuicktimeAudioCodecLookup['dvca'] = 'DV'; $QuicktimeAudioCodecLookup['dvi '] = 'DV 4:1'; $QuicktimeAudioCodecLookup['eqal'] = 'Frequency Equalizer'; $QuicktimeAudioCodecLookup['fl32'] = '32-bit Floating Point'; $QuicktimeAudioCodecLookup['fl64'] = '64-bit Floating Point'; $QuicktimeAudioCodecLookup['ima4'] = 'Interactive Multimedia Association 4:1'; $QuicktimeAudioCodecLookup['in24'] = '24-bit Integer'; $QuicktimeAudioCodecLookup['in32'] = '32-bit Integer'; $QuicktimeAudioCodecLookup['lpc '] = 'LPC 23:1'; $QuicktimeAudioCodecLookup['MAC3'] = 'Macintosh Audio Compression/Expansion (MACE) 3:1'; $QuicktimeAudioCodecLookup['MAC6'] = 'Macintosh Audio Compression/Expansion (MACE) 6:1'; $QuicktimeAudioCodecLookup['mixb'] = '8-bit Mixer'; $QuicktimeAudioCodecLookup['mixw'] = '16-bit Mixer'; $QuicktimeAudioCodecLookup['mp4a'] = 'ISO/IEC 14496-3 AAC'; $QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM'; $QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA'; $QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III'; $QuicktimeAudioCodecLookup['NONE'] = 'No Encoding'; $QuicktimeAudioCodecLookup['Qclp'] = 'Qualcomm PureVoice'; $QuicktimeAudioCodecLookup['QDM2'] = 'QDesign Music 2'; $QuicktimeAudioCodecLookup['QDMC'] = 'QDesign Music 1'; $QuicktimeAudioCodecLookup['ratb'] = '8-bit Rate'; $QuicktimeAudioCodecLookup['ratw'] = '16-bit Rate'; $QuicktimeAudioCodecLookup['raw '] = 'raw PCM'; $QuicktimeAudioCodecLookup['sour'] = 'Sound Source'; $QuicktimeAudioCodecLookup['sowt'] = 'signed/two\'s complement (Little Endian)'; $QuicktimeAudioCodecLookup['str1'] = 'Iomega MPEG layer II'; $QuicktimeAudioCodecLookup['str2'] = 'Iomega MPEG *layer II'; $QuicktimeAudioCodecLookup['str3'] = 'Iomega MPEG **layer II'; $QuicktimeAudioCodecLookup['str4'] = 'Iomega MPEG ***layer II'; $QuicktimeAudioCodecLookup['twos'] = 'signed/two\'s complement (Big Endian)'; $QuicktimeAudioCodecLookup['ulaw'] = 'mu-law 2:1'; } return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : ''); } public function QuicktimeDCOMLookup($compressionid) { static $QuicktimeDCOMLookup = array(); if (empty($QuicktimeDCOMLookup)) { $QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate'; $QuicktimeDCOMLookup['adec'] = 'Apple Compression'; } return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : ''); } public function QuicktimeColorNameLookup($colordepthid) { static $QuicktimeColorNameLookup = array(); if (empty($QuicktimeColorNameLookup)) { $QuicktimeColorNameLookup[1] = '2-color (monochrome)'; $QuicktimeColorNameLookup[2] = '4-color'; $QuicktimeColorNameLookup[4] = '16-color'; $QuicktimeColorNameLookup[8] = '256-color'; $QuicktimeColorNameLookup[16] = 'thousands (16-bit color)'; $QuicktimeColorNameLookup[24] = 'millions (24-bit color)'; $QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)'; $QuicktimeColorNameLookup[33] = 'black & white'; $QuicktimeColorNameLookup[34] = '4-gray'; $QuicktimeColorNameLookup[36] = '16-gray'; $QuicktimeColorNameLookup[40] = '256-gray'; } return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid'); } public function QuicktimeSTIKLookup($stik) { static $QuicktimeSTIKLookup = array(); if (empty($QuicktimeSTIKLookup)) { $QuicktimeSTIKLookup[0] = 'Movie'; $QuicktimeSTIKLookup[1] = 'Normal'; $QuicktimeSTIKLookup[2] = 'Audiobook'; $QuicktimeSTIKLookup[5] = 'Whacked Bookmark'; $QuicktimeSTIKLookup[6] = 'Music Video'; $QuicktimeSTIKLookup[9] = 'Short Film'; $QuicktimeSTIKLookup[10] = 'TV Show'; $QuicktimeSTIKLookup[11] = 'Booklet'; $QuicktimeSTIKLookup[14] = 'Ringtone'; $QuicktimeSTIKLookup[21] = 'Podcast'; } return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] : 'invalid'); } public function QuicktimeIODSaudioProfileName($audio_profile_id) { static $QuicktimeIODSaudioProfileNameLookup = array(); if (empty($QuicktimeIODSaudioProfileNameLookup)) { $QuicktimeIODSaudioProfileNameLookup = array( 0x00 => 'ISO Reserved (0x00)', 0x01 => 'Main Audio Profile @ Level 1', 0x02 => 'Main Audio Profile @ Level 2', 0x03 => 'Main Audio Profile @ Level 3', 0x04 => 'Main Audio Profile @ Level 4', 0x05 => 'Scalable Audio Profile @ Level 1', 0x06 => 'Scalable Audio Profile @ Level 2', 0x07 => 'Scalable Audio Profile @ Level 3', 0x08 => 'Scalable Audio Profile @ Level 4', 0x09 => 'Speech Audio Profile @ Level 1', 0x0A => 'Speech Audio Profile @ Level 2', 0x0B => 'Synthetic Audio Profile @ Level 1', 0x0C => 'Synthetic Audio Profile @ Level 2', 0x0D => 'Synthetic Audio Profile @ Level 3', 0x0E => 'High Quality Audio Profile @ Level 1', 0x0F => 'High Quality Audio Profile @ Level 2', 0x10 => 'High Quality Audio Profile @ Level 3', 0x11 => 'High Quality Audio Profile @ Level 4', 0x12 => 'High Quality Audio Profile @ Level 5', 0x13 => 'High Quality Audio Profile @ Level 6', 0x14 => 'High Quality Audio Profile @ Level 7', 0x15 => 'High Quality Audio Profile @ Level 8', 0x16 => 'Low Delay Audio Profile @ Level 1', 0x17 => 'Low Delay Audio Profile @ Level 2', 0x18 => 'Low Delay Audio Profile @ Level 3', 0x19 => 'Low Delay Audio Profile @ Level 4', 0x1A => 'Low Delay Audio Profile @ Level 5', 0x1B => 'Low Delay Audio Profile @ Level 6', 0x1C => 'Low Delay Audio Profile @ Level 7', 0x1D => 'Low Delay Audio Profile @ Level 8', 0x1E => 'Natural Audio Profile @ Level 1', 0x1F => 'Natural Audio Profile @ Level 2', 0x20 => 'Natural Audio Profile @ Level 3', 0x21 => 'Natural Audio Profile @ Level 4', 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', 0x28 => 'AAC Profile @ Level 1', 0x29 => 'AAC Profile @ Level 2', 0x2A => 'AAC Profile @ Level 4', 0x2B => 'AAC Profile @ Level 5', 0x2C => 'High Efficiency AAC Profile @ Level 2', 0x2D => 'High Efficiency AAC Profile @ Level 3', 0x2E => 'High Efficiency AAC Profile @ Level 4', 0x2F => 'High Efficiency AAC Profile @ Level 5', 0xFE => 'Not part of MPEG-4 audio profiles', 0xFF => 'No audio capability required', ); } return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); } public function QuicktimeIODSvideoProfileName($video_profile_id) { static $QuicktimeIODSvideoProfileNameLookup = array(); if (empty($QuicktimeIODSvideoProfileNameLookup)) { $QuicktimeIODSvideoProfileNameLookup = array( 0x00 => 'Reserved (0x00) Profile', 0x01 => 'Simple Profile @ Level 1', 0x02 => 'Simple Profile @ Level 2', 0x03 => 'Simple Profile @ Level 3', 0x08 => 'Simple Profile @ Level 0', 0x10 => 'Simple Scalable Profile @ Level 0', 0x11 => 'Simple Scalable Profile @ Level 1', 0x12 => 'Simple Scalable Profile @ Level 2', 0x15 => 'AVC/H264 Profile', 0x21 => 'Core Profile @ Level 1', 0x22 => 'Core Profile @ Level 2', 0x32 => 'Main Profile @ Level 2', 0x33 => 'Main Profile @ Level 3', 0x34 => 'Main Profile @ Level 4', 0x42 => 'N-bit Profile @ Level 2', 0x51 => 'Scalable Texture Profile @ Level 1', 0x61 => 'Simple Face Animation Profile @ Level 1', 0x62 => 'Simple Face Animation Profile @ Level 2', 0x63 => 'Simple FBA Profile @ Level 1', 0x64 => 'Simple FBA Profile @ Level 2', 0x71 => 'Basic Animated Texture Profile @ Level 1', 0x72 => 'Basic Animated Texture Profile @ Level 2', 0x81 => 'Hybrid Profile @ Level 1', 0x82 => 'Hybrid Profile @ Level 2', 0x91 => 'Advanced Real Time Simple Profile @ Level 1', 0x92 => 'Advanced Real Time Simple Profile @ Level 2', 0x93 => 'Advanced Real Time Simple Profile @ Level 3', 0x94 => 'Advanced Real Time Simple Profile @ Level 4', 0xA1 => 'Core Scalable Profile @ Level1', 0xA2 => 'Core Scalable Profile @ Level2', 0xA3 => 'Core Scalable Profile @ Level3', 0xB1 => 'Advanced Coding Efficiency Profile @ Level 1', 0xB2 => 'Advanced Coding Efficiency Profile @ Level 2', 0xB3 => 'Advanced Coding Efficiency Profile @ Level 3', 0xB4 => 'Advanced Coding Efficiency Profile @ Level 4', 0xC1 => 'Advanced Core Profile @ Level 1', 0xC2 => 'Advanced Core Profile @ Level 2', 0xD1 => 'Advanced Scalable Texture @ Level1', 0xD2 => 'Advanced Scalable Texture @ Level2', 0xE1 => 'Simple Studio Profile @ Level 1', 0xE2 => 'Simple Studio Profile @ Level 2', 0xE3 => 'Simple Studio Profile @ Level 3', 0xE4 => 'Simple Studio Profile @ Level 4', 0xE5 => 'Core Studio Profile @ Level 1', 0xE6 => 'Core Studio Profile @ Level 2', 0xE7 => 'Core Studio Profile @ Level 3', 0xE8 => 'Core Studio Profile @ Level 4', 0xF0 => 'Advanced Simple Profile @ Level 0', 0xF1 => 'Advanced Simple Profile @ Level 1', 0xF2 => 'Advanced Simple Profile @ Level 2', 0xF3 => 'Advanced Simple Profile @ Level 3', 0xF4 => 'Advanced Simple Profile @ Level 4', 0xF5 => 'Advanced Simple Profile @ Level 5', 0xF7 => 'Advanced Simple Profile @ Level 3b', 0xF8 => 'Fine Granularity Scalable Profile @ Level 0', 0xF9 => 'Fine Granularity Scalable Profile @ Level 1', 0xFA => 'Fine Granularity Scalable Profile @ Level 2', 0xFB => 'Fine Granularity Scalable Profile @ Level 3', 0xFC => 'Fine Granularity Scalable Profile @ Level 4', 0xFD => 'Fine Granularity Scalable Profile @ Level 5', 0xFE => 'Not part of MPEG-4 Visual profiles', 0xFF => 'No visual capability required', ); } return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] : 'ISO Reserved Profile'); } public function QuicktimeContentRatingLookup($rtng) { static $QuicktimeContentRatingLookup = array(); if (empty($QuicktimeContentRatingLookup)) { $QuicktimeContentRatingLookup[0] = 'None'; $QuicktimeContentRatingLookup[1] = 'Explicit'; $QuicktimeContentRatingLookup[2] = 'Clean'; $QuicktimeContentRatingLookup[4] = 'Explicit (old)'; } return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] : 'invalid'); } public function QuicktimeStoreAccountTypeLookup($akid) { static $QuicktimeStoreAccountTypeLookup = array(); if (empty($QuicktimeStoreAccountTypeLookup)) { $QuicktimeStoreAccountTypeLookup[0] = 'iTunes'; $QuicktimeStoreAccountTypeLookup[1] = 'AOL'; } return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] : 'invalid'); } public function QuicktimeStoreFrontCodeLookup($sfid) { static $QuicktimeStoreFrontCodeLookup = array(); if (empty($QuicktimeStoreFrontCodeLookup)) { $QuicktimeStoreFrontCodeLookup[143460] = 'Australia'; $QuicktimeStoreFrontCodeLookup[143445] = 'Austria'; $QuicktimeStoreFrontCodeLookup[143446] = 'Belgium'; $QuicktimeStoreFrontCodeLookup[143455] = 'Canada'; $QuicktimeStoreFrontCodeLookup[143458] = 'Denmark'; $QuicktimeStoreFrontCodeLookup[143447] = 'Finland'; $QuicktimeStoreFrontCodeLookup[143442] = 'France'; $QuicktimeStoreFrontCodeLookup[143443] = 'Germany'; $QuicktimeStoreFrontCodeLookup[143448] = 'Greece'; $QuicktimeStoreFrontCodeLookup[143449] = 'Ireland'; $QuicktimeStoreFrontCodeLookup[143450] = 'Italy'; $QuicktimeStoreFrontCodeLookup[143462] = 'Japan'; $QuicktimeStoreFrontCodeLookup[143451] = 'Luxembourg'; $QuicktimeStoreFrontCodeLookup[143452] = 'Netherlands'; $QuicktimeStoreFrontCodeLookup[143461] = 'New Zealand'; $QuicktimeStoreFrontCodeLookup[143457] = 'Norway'; $QuicktimeStoreFrontCodeLookup[143453] = 'Portugal'; $QuicktimeStoreFrontCodeLookup[143454] = 'Spain'; $QuicktimeStoreFrontCodeLookup[143456] = 'Sweden'; $QuicktimeStoreFrontCodeLookup[143459] = 'Switzerland'; $QuicktimeStoreFrontCodeLookup[143444] = 'United Kingdom'; $QuicktimeStoreFrontCodeLookup[143441] = 'United States'; } return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] : 'invalid'); } public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { static $handyatomtranslatorarray = array(); if (empty($handyatomtranslatorarray)) { $handyatomtranslatorarray["\xA9".'alb'] = 'album'; $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; $handyatomtranslatorarray["\xA9".'art'] = 'artist'; $handyatomtranslatorarray["\xA9".'aut'] = 'author'; $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; $handyatomtranslatorarray["\xA9".'com'] = 'comment'; $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; $handyatomtranslatorarray["\xA9".'dir'] = 'director'; $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; $handyatomtranslatorarray["\xA9".'ed3'] = 'edit3'; $handyatomtranslatorarray["\xA9".'ed4'] = 'edit4'; $handyatomtranslatorarray["\xA9".'ed5'] = 'edit5'; $handyatomtranslatorarray["\xA9".'ed6'] = 'edit6'; $handyatomtranslatorarray["\xA9".'ed7'] = 'edit7'; $handyatomtranslatorarray["\xA9".'ed8'] = 'edit8'; $handyatomtranslatorarray["\xA9".'ed9'] = 'edit9'; $handyatomtranslatorarray["\xA9".'enc'] = 'encoded_by'; $handyatomtranslatorarray["\xA9".'fmt'] = 'format'; $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; $handyatomtranslatorarray["\xA9".'inf'] = 'information'; $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; $handyatomtranslatorarray["\xA9".'mak'] = 'make'; $handyatomtranslatorarray["\xA9".'mod'] = 'model'; $handyatomtranslatorarray["\xA9".'nam'] = 'title'; $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; $handyatomtranslatorarray["\xA9".'prd'] = 'producer'; $handyatomtranslatorarray["\xA9".'PRD'] = 'product'; $handyatomtranslatorarray["\xA9".'prf'] = 'performers'; $handyatomtranslatorarray["\xA9".'req'] = 'system_requirements'; $handyatomtranslatorarray["\xA9".'src'] = 'source_credit'; $handyatomtranslatorarray["\xA9".'swr'] = 'software'; $handyatomtranslatorarray["\xA9".'too'] = 'encoding_tool'; $handyatomtranslatorarray["\xA9".'trk'] = 'track_number'; $handyatomtranslatorarray["\xA9".'url'] = 'url'; $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; $handyatomtranslatorarray["\xA9".'wrt'] = 'composer'; $handyatomtranslatorarray['aART'] = 'album_artist'; $handyatomtranslatorarray['apID'] = 'purchase_account'; $handyatomtranslatorarray['catg'] = 'category'; $handyatomtranslatorarray['covr'] = 'picture'; $handyatomtranslatorarray['cpil'] = 'compilation'; $handyatomtranslatorarray['cprt'] = 'copyright'; $handyatomtranslatorarray['desc'] = 'description'; $handyatomtranslatorarray['disk'] = 'disc_number'; $handyatomtranslatorarray['egid'] = 'episode_guid'; $handyatomtranslatorarray['gnre'] = 'genre'; $handyatomtranslatorarray['hdvd'] = 'hd_video'; $handyatomtranslatorarray['ldes'] = 'description_long'; $handyatomtranslatorarray['keyw'] = 'keyword'; $handyatomtranslatorarray['pcst'] = 'podcast'; $handyatomtranslatorarray['pgap'] = 'gapless_playback'; $handyatomtranslatorarray['purd'] = 'purchase_date'; $handyatomtranslatorarray['purl'] = 'podcast_url'; $handyatomtranslatorarray['rtng'] = 'rating'; $handyatomtranslatorarray['soaa'] = 'sort_album_artist'; $handyatomtranslatorarray['soal'] = 'sort_album'; $handyatomtranslatorarray['soar'] = 'sort_artist'; $handyatomtranslatorarray['soco'] = 'sort_composer'; $handyatomtranslatorarray['sonm'] = 'sort_title'; $handyatomtranslatorarray['sosn'] = 'sort_show'; $handyatomtranslatorarray['stik'] = 'stik'; $handyatomtranslatorarray['tmpo'] = 'bpm'; $handyatomtranslatorarray['trkn'] = 'track_number'; $handyatomtranslatorarray['tven'] = 'tv_episode_id'; $handyatomtranslatorarray['tves'] = 'tv_episode'; $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; $handyatomtranslatorarray['tvsn'] = 'tv_season'; } $info = &$this->getid3->info; $comment_key = ''; if ($boxname && ($boxname != $keyname)) { $comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname); } elseif (isset($handyatomtranslatorarray[$keyname])) { $comment_key = $handyatomtranslatorarray[$keyname]; } if ($comment_key) { if ($comment_key == 'picture') { return true; } $gooddata = array($data); if ($comment_key == 'genre') { $gooddata = explode(';', $data); } foreach ($gooddata as $data) { if (!empty($info['quicktime']['comments'][$comment_key]) && in_array($data, $info['quicktime']['comments'][$comment_key], true)) { continue; } $info['quicktime']['comments'][$comment_key][] = $data; } } return true; } public function LociString($lstring, &$count) { $len = strlen($lstring); if ($len == 0) { $count = 0; return ''; } if ($lstring[0] == "\x00") { $count = 1; return ''; } if (($len > 2) && ((($lstring[0] == "\xFE") && ($lstring[1] == "\xFF")) || (($lstring[0] == "\xFF") && ($lstring[1] == "\xFE")))) { if (preg_match('/(.*)\x00/', $lstring, $lmatches)) { $count = strlen($lmatches[1]) * 2 + 2; return getid3_lib::iconv_fallback_utf16_utf8($lmatches[1]); } else { return ''; } } if (preg_match('/(.*)\x00/', $lstring, $lmatches)) { $count = strlen($lmatches[1]) + 1; return $lmatches[1]; } return ''; } public function NoNullString($nullterminatedstring) { if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1); } return $nullterminatedstring; } public function Pascal2String($pascalstring) { return substr($pascalstring, 1); } public function MaybePascal2String($pascalstring) { if (ord(substr($pascalstring, 0, 1)) == (strlen($pascalstring) - 1)) { return substr($pascalstring, 1); } elseif (substr($pascalstring, -1, 1) == "\x00") { return substr($pascalstring, 0, -1); } return $pascalstring; } public function search_tag_by_key($info, $tag, $history, &$result) { foreach ($info as $key => $value) { $key_history = $history.'/'.$key; if ($key === $tag) { $result[] = array($key_history, $info); } else { if (is_array($value)) { $this->search_tag_by_key($value, $tag, $key_history, $result); } } } } public function search_tag_by_pair($info, $k, $v, $history, &$result) { foreach ($info as $key => $value) { $key_history = $history.'/'.$key; if (($key === $k) && ($value === $v)) { $result[] = array($key_history, $info); } else { if (is_array($value)) { $this->search_tag_by_pair($value, $k, $v, $key_history, $result); } } } } public function quicktime_time_to_sample_table($info) { $res = array(); $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); foreach ($res as $value) { $stbl_res = array(); $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); if (count($stbl_res) > 0) { $stts_res = array(); $this->search_tag_by_key($value[1], 'time_to_sample_table', $value[0], $stts_res); if (count($stts_res) > 0) { return $stts_res[0][1]['time_to_sample_table']; } } } return array(); } public function quicktime_bookmark_time_scale($info) { $time_scale = ''; $ts_prefix_len = 0; $res = array(); $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); foreach ($res as $value) { $stbl_res = array(); $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); if (count($stbl_res) > 0) { $ts_res = array(); $this->search_tag_by_key($info['quicktime']['moov'], 'time_scale', 'quicktime/moov', $ts_res); foreach ($ts_res as $sub_value) { $prefix = substr($sub_value[0], 0, -12); if ((substr($stbl_res[0][0], 0, strlen($prefix)) === $prefix) && ($ts_prefix_len < strlen($prefix))) { $time_scale = $sub_value[1]['time_scale']; $ts_prefix_len = strlen($prefix); } } } } return $time_scale; } } getid3->info; if (!getid3_lib::intValueSupported($info['filesize'])) { $this->warning('Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); return false; } if($info['filesize'] < 256) { $this->fseek(-128, SEEK_END); $preid3v1 = ''; $id3v1tag = $this->fread(128); } else { $this->fseek(-256, SEEK_END); $preid3v1 = $this->fread(128); $id3v1tag = $this->fread(128); } if (substr($id3v1tag, 0, 3) == 'TAG') { $info['avdataend'] = $info['filesize'] - 128; $ParsedID3v1 = array(); $ParsedID3v1['title'] = $this->cutfield(substr($id3v1tag, 3, 30)); $ParsedID3v1['artist'] = $this->cutfield(substr($id3v1tag, 33, 30)); $ParsedID3v1['album'] = $this->cutfield(substr($id3v1tag, 63, 30)); $ParsedID3v1['year'] = $this->cutfield(substr($id3v1tag, 93, 4)); $ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); $ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1)); if (($id3v1tag[125] === "\x00") && ($id3v1tag[126] !== "\x00")) { $ParsedID3v1['track_number'] = ord(substr($ParsedID3v1['comment'], 29, 1)); $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); } $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']); $ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']); if (!empty($ParsedID3v1['genre'])) { unset($ParsedID3v1['genreid']); } if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) { unset($ParsedID3v1['genre']); } foreach ($ParsedID3v1 as $key => $value) { $ParsedID3v1['comments'][$key][0] = $value; } $ID3v1encoding = $this->getid3->encoding_id3v1; if ($this->getid3->encoding_id3v1_autodetect) { foreach ($ParsedID3v1['comments'] as $tag_key => $valuearray) { foreach ($valuearray as $key => $value) { if (preg_match('#^[\\x00-\\x40\\x80-\\xFF]+$#', $value) && !ctype_digit((string) $value)) { foreach (array('Windows-1251', 'KOI8-R') as $id3v1_bad_encoding) { if (function_exists('mb_convert_encoding') && @mb_convert_encoding($value, $id3v1_bad_encoding, $id3v1_bad_encoding) === $value) { $ID3v1encoding = $id3v1_bad_encoding; $this->warning('ID3v1 detected as '.$id3v1_bad_encoding.' text encoding in '.$tag_key); break 3; } elseif (function_exists('iconv') && @iconv($id3v1_bad_encoding, $id3v1_bad_encoding, $value) === $value) { $ID3v1encoding = $id3v1_bad_encoding; $this->warning('ID3v1 detected as '.$id3v1_bad_encoding.' text encoding in '.$tag_key); break 3; } } } } } } $GoodFormatID3v1tag = $this->GenerateID3v1Tag( $ParsedID3v1['title'], $ParsedID3v1['artist'], $ParsedID3v1['album'], $ParsedID3v1['year'], (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false), $ParsedID3v1['comment'], (!empty($ParsedID3v1['track_number']) ? $ParsedID3v1['track_number'] : '')); $ParsedID3v1['padding_valid'] = true; if ($id3v1tag !== $GoodFormatID3v1tag) { $ParsedID3v1['padding_valid'] = false; $this->warning('Some ID3v1 fields do not use NULL characters for padding'); } $ParsedID3v1['tag_offset_end'] = $info['filesize']; $ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128; $info['id3v1'] = $ParsedID3v1; $info['id3v1']['encoding'] = $ID3v1encoding; } if (substr($preid3v1, 0, 3) == 'TAG') { if (substr($preid3v1, 96, 8) == 'APETAGEX') { } elseif (substr($preid3v1, 119, 6) == 'LYRICS') { } else { $this->warning('Duplicate ID3v1 tag detected - this has been known to happen with iTunes'); $info['avdataend'] -= 128; } } return true; } public static function cutfield($str) { return trim(substr($str, 0, strcspn($str, "\x00"))); } public static function ArrayOfGenres($allowSCMPXextended=false) { static $GenreLookup = array( 0 => 'Blues', 1 => 'Classic Rock', 2 => 'Country', 3 => 'Dance', 4 => 'Disco', 5 => 'Funk', 6 => 'Grunge', 7 => 'Hip-Hop', 8 => 'Jazz', 9 => 'Metal', 10 => 'New Age', 11 => 'Oldies', 12 => 'Other', 13 => 'Pop', 14 => 'R&B', 15 => 'Rap', 16 => 'Reggae', 17 => 'Rock', 18 => 'Techno', 19 => 'Industrial', 20 => 'Alternative', 21 => 'Ska', 22 => 'Death Metal', 23 => 'Pranks', 24 => 'Soundtrack', 25 => 'Euro-Techno', 26 => 'Ambient', 27 => 'Trip-Hop', 28 => 'Vocal', 29 => 'Jazz+Funk', 30 => 'Fusion', 31 => 'Trance', 32 => 'Classical', 33 => 'Instrumental', 34 => 'Acid', 35 => 'House', 36 => 'Game', 37 => 'Sound Clip', 38 => 'Gospel', 39 => 'Noise', 40 => 'Alt. Rock', 41 => 'Bass', 42 => 'Soul', 43 => 'Punk', 44 => 'Space', 45 => 'Meditative', 46 => 'Instrumental Pop', 47 => 'Instrumental Rock', 48 => 'Ethnic', 49 => 'Gothic', 50 => 'Darkwave', 51 => 'Techno-Industrial', 52 => 'Electronic', 53 => 'Pop-Folk', 54 => 'Eurodance', 55 => 'Dream', 56 => 'Southern Rock', 57 => 'Comedy', 58 => 'Cult', 59 => 'Gangsta Rap', 60 => 'Top 40', 61 => 'Christian Rap', 62 => 'Pop/Funk', 63 => 'Jungle', 64 => 'Native American', 65 => 'Cabaret', 66 => 'New Wave', 67 => 'Psychedelic', 68 => 'Rave', 69 => 'Showtunes', 70 => 'Trailer', 71 => 'Lo-Fi', 72 => 'Tribal', 73 => 'Acid Punk', 74 => 'Acid Jazz', 75 => 'Polka', 76 => 'Retro', 77 => 'Musical', 78 => 'Rock & Roll', 79 => 'Hard Rock', 80 => 'Folk', 81 => 'Folk/Rock', 82 => 'National Folk', 83 => 'Swing', 84 => 'Fast-Fusion', 85 => 'Bebob', 86 => 'Latin', 87 => 'Revival', 88 => 'Celtic', 89 => 'Bluegrass', 90 => 'Avantgarde', 91 => 'Gothic Rock', 92 => 'Progressive Rock', 93 => 'Psychedelic Rock', 94 => 'Symphonic Rock', 95 => 'Slow Rock', 96 => 'Big Band', 97 => 'Chorus', 98 => 'Easy Listening', 99 => 'Acoustic', 100 => 'Humour', 101 => 'Speech', 102 => 'Chanson', 103 => 'Opera', 104 => 'Chamber Music', 105 => 'Sonata', 106 => 'Symphony', 107 => 'Booty Bass', 108 => 'Primus', 109 => 'Porn Groove', 110 => 'Satire', 111 => 'Slow Jam', 112 => 'Club', 113 => 'Tango', 114 => 'Samba', 115 => 'Folklore', 116 => 'Ballad', 117 => 'Power Ballad', 118 => 'Rhythmic Soul', 119 => 'Freestyle', 120 => 'Duet', 121 => 'Punk Rock', 122 => 'Drum Solo', 123 => 'A Cappella', 124 => 'Euro-House', 125 => 'Dance Hall', 126 => 'Goa', 127 => 'Drum & Bass', 128 => 'Club-House', 129 => 'Hardcore', 130 => 'Terror', 131 => 'Indie', 132 => 'BritPop', 133 => 'Negerpunk', 134 => 'Polsk Punk', 135 => 'Beat', 136 => 'Christian Gangsta Rap', 137 => 'Heavy Metal', 138 => 'Black Metal', 139 => 'Crossover', 140 => 'Contemporary Christian', 141 => 'Christian Rock', 142 => 'Merengue', 143 => 'Salsa', 144 => 'Thrash Metal', 145 => 'Anime', 146 => 'JPop', 147 => 'Synthpop', 148 => 'Abstract', 149 => 'Art Rock', 150 => 'Baroque', 151 => 'Bhangra', 152 => 'Big Beat', 153 => 'Breakbeat', 154 => 'Chillout', 155 => 'Downtempo', 156 => 'Dub', 157 => 'EBM', 158 => 'Eclectic', 159 => 'Electro', 160 => 'Electroclash', 161 => 'Emo', 162 => 'Experimental', 163 => 'Garage', 164 => 'Global', 165 => 'IDM', 166 => 'Illbient', 167 => 'Industro-Goth', 168 => 'Jam Band', 169 => 'Krautrock', 170 => 'Leftfield', 171 => 'Lounge', 172 => 'Math Rock', 173 => 'New Romantic', 174 => 'Nu-Breakz', 175 => 'Post-Punk', 176 => 'Post-Rock', 177 => 'Psytrance', 178 => 'Shoegaze', 179 => 'Space Rock', 180 => 'Trop Rock', 181 => 'World Music', 182 => 'Neoclassical', 183 => 'Audiobook', 184 => 'Audio Theatre', 185 => 'Neue Deutsche Welle', 186 => 'Podcast', 187 => 'Indie-Rock', 188 => 'G-Funk', 189 => 'Dubstep', 190 => 'Garage Rock', 191 => 'Psybient', 255 => 'Unknown', 'CR' => 'Cover', 'RX' => 'Remix' ); static $GenreLookupSCMPX = array(); if ($allowSCMPXextended && empty($GenreLookupSCMPX)) { $GenreLookupSCMPX = $GenreLookup; $GenreLookupSCMPX[240] = 'Sacred'; $GenreLookupSCMPX[241] = 'Northern Europe'; $GenreLookupSCMPX[242] = 'Irish & Scottish'; $GenreLookupSCMPX[243] = 'Scotland'; $GenreLookupSCMPX[244] = 'Ethnic Europe'; $GenreLookupSCMPX[245] = 'Enka'; $GenreLookupSCMPX[246] = 'Children\'s Song'; $GenreLookupSCMPX[247] = 'Japanese Sky'; $GenreLookupSCMPX[248] = 'Japanese Heavy Rock'; $GenreLookupSCMPX[249] = 'Japanese Doom Rock'; $GenreLookupSCMPX[250] = 'Japanese J-POP'; $GenreLookupSCMPX[251] = 'Japanese Seiyu'; $GenreLookupSCMPX[252] = 'Japanese Ambient Techno'; $GenreLookupSCMPX[253] = 'Japanese Moemoe'; $GenreLookupSCMPX[254] = 'Japanese Tokusatsu'; } return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup); } public static function LookupGenreName($genreid, $allowSCMPXextended=true) { switch ($genreid) { case 'RX': case 'CR': break; default: if (!is_numeric($genreid)) { return false; } $genreid = intval($genreid); break; } $GenreLookup = self::ArrayOfGenres($allowSCMPXextended); return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false); } public static function LookupGenreID($genre, $allowSCMPXextended=false) { $GenreLookup = self::ArrayOfGenres($allowSCMPXextended); $LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre)); foreach ($GenreLookup as $key => $value) { if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) { return $key; } } return false; } public static function StandardiseID3v1GenreName($OriginalGenre) { if (($GenreID = self::LookupGenreID($OriginalGenre)) !== false) { return self::LookupGenreName($GenreID); } return $OriginalGenre; } public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') { $ID3v1Tag = 'TAG'; $ID3v1Tag .= str_pad(trim(substr($title, 0, 30)), 30, "\x00", STR_PAD_RIGHT); $ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT); $ID3v1Tag .= str_pad(trim(substr($album, 0, 30)), 30, "\x00", STR_PAD_RIGHT); $ID3v1Tag .= str_pad(trim(substr($year, 0, 4)), 4, "\x00", STR_PAD_LEFT); if (!empty($track) && ($track > 0) && ($track <= 255)) { $ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT); $ID3v1Tag .= "\x00"; if (gettype($track) == 'string') { $track = (int) $track; } $ID3v1Tag .= chr($track); } else { $ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT); } if (($genreid < 0) || ($genreid > 147)) { $genreid = 255; } switch (gettype($genreid)) { case 'string': case 'integer': $ID3v1Tag .= chr(intval($genreid)); break; default: $ID3v1Tag .= chr(255); break; } return $ID3v1Tag; } } getid3->info; if (!getid3_lib::intValueSupported($info['filesize'])) { $this->warning('Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); return false; } $this->fseek((0 - 128 - 9 - 6), SEEK_END); $lyrics3offset = null; $lyrics3version = null; $lyrics3size = null; $lyrics3_id3v1 = $this->fread(128 + 9 + 6); $lyrics3lsz = (int) substr($lyrics3_id3v1, 0, 6); $lyrics3end = substr($lyrics3_id3v1, 6, 9); $id3v1tag = substr($lyrics3_id3v1, 15, 128); if ($lyrics3end == 'LYRICSEND') { $lyrics3size = 5100; $lyrics3offset = $info['filesize'] - 128 - $lyrics3size; $lyrics3version = 1; } elseif ($lyrics3end == 'LYRICS200') { $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); $lyrics3offset = $info['filesize'] - 128 - $lyrics3size; $lyrics3version = 2; } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) { $lyrics3size = 5100; $lyrics3offset = $info['filesize'] - $lyrics3size; $lyrics3version = 1; $lyrics3offset = $info['filesize'] - $lyrics3size; } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) { $lyrics3size = (int) strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); $lyrics3offset = $info['filesize'] - $lyrics3size; $lyrics3version = 2; } else { if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) { $this->fseek($info['ape']['tag_offset_start'] - 15); $lyrics3lsz = $this->fread(6); $lyrics3end = $this->fread(9); if ($lyrics3end == 'LYRICSEND') { $lyrics3size = 5100; $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size; $info['avdataend'] = $lyrics3offset; $lyrics3version = 1; $this->warning('APE tag located after Lyrics3, will probably break Lyrics3 compatability'); } elseif ($lyrics3end == 'LYRICS200') { $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size; $lyrics3version = 2; $this->warning('APE tag located after Lyrics3, will probably break Lyrics3 compatability'); } } } if (isset($lyrics3offset) && isset($lyrics3version) && isset($lyrics3size)) { $info['avdataend'] = $lyrics3offset; $this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size); if (!isset($info['ape'])) { if (isset($info['lyrics3']['tag_offset_start'])) { $GETID3_ERRORARRAY = &$info['warning']; getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); $getid3_temp = new getID3(); $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); $getid3_apetag = new getid3_apetag($getid3_temp); $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; $getid3_apetag->Analyze(); if (!empty($getid3_temp->info['ape'])) { $info['ape'] = $getid3_temp->info['ape']; } if (!empty($getid3_temp->info['replay_gain'])) { $info['replay_gain'] = $getid3_temp->info['replay_gain']; } unset($getid3_temp, $getid3_apetag); } else { $this->warning('Lyrics3 and APE tags appear to have become entangled (most likely due to updating the APE tags with a non-Lyrics3-aware tagger)'); } } } return true; } public function getLyrics3Data($endoffset, $version, $length) { $info = &$this->getid3->info; if (!getid3_lib::intValueSupported($endoffset)) { $this->warning('Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); return false; } $this->fseek($endoffset); if ($length <= 0) { return false; } $rawdata = $this->fread($length); $ParsedLyrics3 = array(); $ParsedLyrics3['raw']['lyrics3version'] = $version; $ParsedLyrics3['raw']['lyrics3tagsize'] = $length; $ParsedLyrics3['tag_offset_start'] = $endoffset; $ParsedLyrics3['tag_offset_end'] = $endoffset + $length - 1; if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') { if (strpos($rawdata, 'LYRICSBEGIN') !== false) { $this->warning('"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version); $info['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN'); $rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN')); $length = strlen($rawdata); $ParsedLyrics3['tag_offset_start'] = $info['avdataend']; $ParsedLyrics3['raw']['lyrics3tagsize'] = $length; } else { $this->error('"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead'); return false; } } switch ($version) { case 1: if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') { $ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9)); $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); } else { $this->error('"LYRICSEND" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'); return false; } break; case 2: if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') { $ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); $rawdata = $ParsedLyrics3['raw']['unparsed']; while (strlen($rawdata) > 0) { $fieldname = substr($rawdata, 0, 3); $fieldsize = (int) substr($rawdata, 3, 5); $ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize); $rawdata = substr($rawdata, 3 + 5 + $fieldsize); } if (isset($ParsedLyrics3['raw']['IND'])) { $i = 0; $flagnames = array('lyrics', 'timestamps', 'inhibitrandom'); foreach ($flagnames as $flagname) { if (strlen($ParsedLyrics3['raw']['IND']) > $i++) { $ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1)); } } } $fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author'); foreach ($fieldnametranslation as $key => $value) { if (isset($ParsedLyrics3['raw'][$key])) { $ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]); } } if (isset($ParsedLyrics3['raw']['IMG'])) { $imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']); foreach ($imagestrings as $key => $imagestring) { if (strpos($imagestring, '||') !== false) { $imagearray = explode('||', $imagestring); $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : ''); $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : ''); } } } if (isset($ParsedLyrics3['raw']['LYR'])) { $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); } } else { $this->error('"LYRICS200" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'); return false; } break; default: $this->error('Cannot process Lyrics3 version '.$version.' (only v1 and v2)'); return false; } if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] <= $ParsedLyrics3['tag_offset_end'])) { $this->warning('ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data'); unset($info['id3v1']); foreach ($info['warning'] as $key => $value) { if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { unset($info['warning'][$key]); sort($info['warning']); break; } } } $info['lyrics3'] = $ParsedLyrics3; return true; } public function Lyrics3Timestamp2Seconds($rawtimestamp) { if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) { return (int) (($regs[1] * 60) + $regs[2]); } return false; } public function Lyrics3LyricsTimestampParse(&$Lyrics3data) { $lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']); $notimestamplyricsarray = array(); foreach ($lyricsarray as $key => $lyricline) { $regs = array(); unset($thislinetimestamps); while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) { $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]); $lyricline = str_replace($regs[0], '', $lyricline); } $notimestamplyricsarray[$key] = $lyricline; if (isset($thislinetimestamps) && is_array($thislinetimestamps)) { sort($thislinetimestamps); foreach ($thislinetimestamps as $timestampkey => $timestamp) { if (isset($Lyrics3data['synchedlyrics'][$timestamp])) { $Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline; } else { $Lyrics3data['synchedlyrics'][$timestamp] = $lyricline; } } } } $Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray); if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) { ksort($Lyrics3data['synchedlyrics']); } return true; } public function IntString2Bool($char) { if ($char == '1') { return true; } elseif ($char == '0') { return false; } return null; } } startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION."\n"; return; } $memoryLimit = ini_get('memory_limit'); if (preg_match('#([0-9]+) ?M#i', $memoryLimit, $matches)) { $memoryLimit = $matches[1] * 1048576; } elseif (preg_match('#([0-9]+) ?G#i', $memoryLimit, $matches)) { $memoryLimit = $matches[1] * 1073741824; } $this->memory_limit = $memoryLimit; if ($this->memory_limit <= 0) { } elseif ($this->memory_limit <= 4194304) { $this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini'."\n"; } elseif ($this->memory_limit <= 12582912) { $this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini'."\n"; } if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.'); } if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; } if (version_compare(PHP_VERSION, '7.4.0', '<')) { if (function_exists('get_magic_quotes_runtime')) { if (get_magic_quotes_runtime()) { $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n"; } } if (function_exists('get_magic_quotes_gpc')) { if (get_magic_quotes_gpc()) { $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; } } } if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { $this->startup_error .= 'getid3.lib.php is missing or corrupt'."\n"; } if ($this->option_max_2gb_check === null) { $this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647); } if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) { $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; if (!is_dir($helperappsdir)) { $this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'."\n"; } elseif (strpos(realpath($helperappsdir), ' ') !== false) { $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir)); $path_so_far = array(); foreach ($DirPieces as $key => $value) { if (strpos($value, ' ') !== false) { if (!empty($path_so_far)) { $commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far)); $dir_listing = `$commandline`; $lines = explode("\n", $dir_listing); foreach ($lines as $line) { $line = trim($line); if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) { list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches; if ((strtoupper($filesize) == '') && (strtolower($filename) == strtolower($value))) { $value = $shortname; } } } } else { $this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.'."\n"; } } $path_so_far[] = $value; } $helperappsdir = implode(DIRECTORY_SEPARATOR, $path_so_far); } define('GETID3_HELPERAPPSDIR', $helperappsdir.DIRECTORY_SEPARATOR); } if (!empty($this->startup_error)) { echo $this->startup_error; throw new getid3_exception($this->startup_error); } } public function version() { return self::VERSION; } public function fread_buffer_size() { return $this->option_fread_buffer_size; } public function setOption($optArray) { if (!is_array($optArray) || empty($optArray)) { return false; } foreach ($optArray as $opt => $val) { if (isset($this->$opt) === false) { continue; } $this->$opt = $val; } return true; } public function openfile($filename, $filesize=null, $fp=null) { try { if (!empty($this->startup_error)) { throw new getid3_exception($this->startup_error); } if (!empty($this->startup_warning)) { foreach (explode("\n", $this->startup_warning) as $startup_warning) { $this->warning($startup_warning); } } $this->filename = $filename; $this->info = array(); $this->info['GETID3_VERSION'] = $this->version(); $this->info['php_memory_limit'] = (($this->memory_limit > 0) ? $this->memory_limit : false); if (preg_match('#^(ht|f)tp://#', $filename)) { throw new getid3_exception('Remote files are not supported - please copy the file locally first'); } $filename = str_replace('/', DIRECTORY_SEPARATOR, $filename); if (($fp != null) && ((get_resource_type($fp) == 'file') || (get_resource_type($fp) == 'stream'))) { $this->fp = $fp; } elseif ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { } else { $errormessagelist = array(); if (!is_readable($filename)) { $errormessagelist[] = '!is_readable'; } if (!is_file($filename)) { $errormessagelist[] = '!is_file'; } if (!file_exists($filename)) { $errormessagelist[] = '!file_exists'; } if (empty($errormessagelist)) { $errormessagelist[] = 'fopen failed'; } throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')'); } $this->info['filesize'] = (!is_null($filesize) ? $filesize : filesize($filename)); $filename = str_replace('\\', '/', $filename); $this->info['filepath'] = str_replace('\\', '/', realpath(dirname($filename))); $this->info['filename'] = getid3_lib::mb_basename($filename); $this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename']; $this->info['avdataoffset'] = 0; $this->info['avdataend'] = $this->info['filesize']; $this->info['fileformat'] = ''; $this->info['audio']['dataformat'] = ''; $this->info['video']['dataformat'] = ''; $this->info['tags'] = array(); $this->info['error'] = array(); $this->info['warning'] = array(); $this->info['comments'] = array(); $this->info['encoding'] = $this->encoding; if ($this->option_max_2gb_check) { $fseek = fseek($this->fp, 0, SEEK_END); if (($fseek < 0) || (($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) || ($this->info['filesize'] < 0) || (ftell($this->fp) < 0)) { $real_filesize = getid3_lib::getFileSizeSyscall($this->info['filenamepath']); if ($real_filesize === false) { unset($this->info['filesize']); fclose($this->fp); throw new getid3_exception('Unable to determine actual filesize. File is most likely larger than '.round(PHP_INT_MAX / 1073741824).'GB and is not supported by PHP.'); } elseif (getid3_lib::intValueSupported($real_filesize)) { unset($this->info['filesize']); fclose($this->fp); throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize / 1073741824, 3).'GB, please report to info@getid3.org'); } $this->info['filesize'] = $real_filesize; $this->warning('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize / 1073741824, 3).'GB) and is not properly supported by PHP.'); } } return true; } catch (Exception $e) { $this->error($e->getMessage()); } return false; } public function analyze($filename, $filesize=null, $original_filename='', $fp=null) { try { if (!$this->openfile($filename, $filesize, $fp)) { return $this->info; } foreach (array('id3v2'=>'id3v2', 'id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) { $option_tag = 'option_tag_'.$tag_name; if ($this->$option_tag) { $this->include_module('tag.'.$tag_name); try { $tag_class = 'getid3_'.$tag_name; $tag = new $tag_class($this); $tag->Analyze(); } catch (getid3_exception $e) { throw $e; } } } if (isset($this->info['id3v2']['tag_offset_start'])) { $this->info['avdataoffset'] = max($this->info['avdataoffset'], $this->info['id3v2']['tag_offset_end']); } foreach (array('id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) { if (isset($this->info[$tag_key]['tag_offset_start'])) { $this->info['avdataend'] = min($this->info['avdataend'], $this->info[$tag_key]['tag_offset_start']); } } if (!$this->option_tag_id3v2) { fseek($this->fp, 0); $header = fread($this->fp, 10); if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { $this->info['id3v2']['header'] = true; $this->info['id3v2']['majorversion'] = ord($header[3]); $this->info['id3v2']['minorversion'] = ord($header[4]); $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; } } fseek($this->fp, $this->info['avdataoffset']); $formattest = fread($this->fp, 32774); $determined_format = $this->GetFileFormat($formattest, ($original_filename ? $original_filename : $filename)); if (!$determined_format) { fclose($this->fp); return $this->error('unable to determine file format'); } if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) { if ($determined_format['fail_id3'] === 'ERROR') { fclose($this->fp); return $this->error('ID3 tags not allowed on this file type.'); } elseif ($determined_format['fail_id3'] === 'WARNING') { $this->warning('ID3 tags not allowed on this file type.'); } } if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) { if ($determined_format['fail_ape'] === 'ERROR') { fclose($this->fp); return $this->error('APE tags not allowed on this file type.'); } elseif ($determined_format['fail_ape'] === 'WARNING') { $this->warning('APE tags not allowed on this file type.'); } } $this->info['mime_type'] = $determined_format['mime_type']; if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { fclose($this->fp); return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.'); } if (!empty($determined_format['iconv_req']) && !function_exists('mb_convert_encoding') && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { $errormessage = 'mb_convert_encoding() or iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. '; if (GETID3_OS_ISWINDOWS) { $errormessage .= 'PHP does not have mb_convert_encoding() or iconv() support. Please enable php_mbstring.dll / php_iconv.dll in php.ini, and copy php_mbstring.dll / iconv.dll from c:/php/dlls to c:/windows/system32'; } else { $errormessage .= 'PHP is not compiled with mb_convert_encoding() or iconv() support. Please recompile with the --enable-mbstring / --with-iconv switch'; } return $this->error($errormessage); } include_once(GETID3_INCLUDEPATH.$determined_format['include']); $class_name = 'getid3_'.$determined_format['module']; if (!class_exists($class_name)) { return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.'); } $class = new $class_name($this); foreach (get_object_vars($this) as $getid3_object_vars_key => $getid3_object_vars_value) { if (preg_match('#^options_([^_]+)_([^_]+)_(.+)$#i', $getid3_object_vars_key, $matches)) { list($dummy, $GOVgroup, $GOVmodule, $GOVsetting) = $matches; $GOVgroup = (($GOVgroup == 'audiovideo') ? 'audio-video' : $GOVgroup); if (($GOVgroup == $determined_format['group']) && ($GOVmodule == $determined_format['module'])) { $class->$GOVsetting = $getid3_object_vars_value; } } } $class->Analyze(); unset($class); fclose($this->fp); if ($this->option_tags_process) { $this->HandleAllTags(); } if ($this->option_extra_info) { $this->ChannelsBitratePlaytimeCalculations(); $this->CalculateCompressionRatioVideo(); $this->CalculateCompressionRatioAudio(); $this->CalculateReplayGain(); $this->ProcessAudioStreams(); } if ($this->option_md5_data) { if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) { $this->getHashdata('md5'); } } if ($this->option_sha1_data) { $this->getHashdata('sha1'); } $this->CleanUp(); } catch (Exception $e) { $this->error('Caught exception: '.$e->getMessage()); } return $this->info; } public function error($message) { $this->CleanUp(); if (!isset($this->info['error'])) { $this->info['error'] = array(); } $this->info['error'][] = $message; return $this->info; } public function warning($message) { $this->info['warning'][] = $message; return true; } private function CleanUp() { $AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate'); foreach ($AVpossibleEmptyKeys as $dummy => $key) { if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) { unset($this->info['audio'][$key]); } if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) { unset($this->info['video'][$key]); } } if (!empty($this->info)) { foreach ($this->info as $key => $value) { if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) { unset($this->info[$key]); } } } if (empty($this->info['fileformat'])) { if (isset($this->info['avdataoffset'])) { unset($this->info['avdataoffset']); } if (isset($this->info['avdataend'])) { unset($this->info['avdataend']); } } if (!empty($this->info['error'])) { $this->info['error'] = array_values(array_unique($this->info['error'])); } if (!empty($this->info['warning'])) { $this->info['warning'] = array_values(array_unique($this->info['warning'])); } unset($this->info['php_memory_limit']); return true; } public function GetFileFormatArray() { static $format_info = array(); if (empty($format_info)) { $format_info = array( 'ac3' => array( 'pattern' => '^\\x0B\\x77', 'group' => 'audio', 'module' => 'ac3', 'mime_type' => 'audio/ac3', ), 'adif' => array( 'pattern' => '^ADIF', 'group' => 'audio', 'module' => 'aac', 'mime_type' => 'audio/aac', 'fail_ape' => 'WARNING', ), 'adts' => array( 'pattern' => '^\\xFF[\\xF0-\\xF1\\xF8-\\xF9]', 'group' => 'audio', 'module' => 'aac', 'mime_type' => 'audio/aac', 'fail_ape' => 'WARNING', ), 'au' => array( 'pattern' => '^\\.snd', 'group' => 'audio', 'module' => 'au', 'mime_type' => 'audio/basic', ), 'amr' => array( 'pattern' => '^\\x23\\x21AMR\\x0A', 'group' => 'audio', 'module' => 'amr', 'mime_type' => 'audio/amr', ), 'avr' => array( 'pattern' => '^2BIT', 'group' => 'audio', 'module' => 'avr', 'mime_type' => 'application/octet-stream', ), 'bonk' => array( 'pattern' => '^\\x00(BONK|INFO|META| ID3)', 'group' => 'audio', 'module' => 'bonk', 'mime_type' => 'audio/xmms-bonk', ), 'dsf' => array( 'pattern' => '^DSD ', 'group' => 'audio', 'module' => 'dsf', 'mime_type' => 'audio/dsd', ), 'dss' => array( 'pattern' => '^[\\x02-\\x08]ds[s2]', 'group' => 'audio', 'module' => 'dss', 'mime_type' => 'application/octet-stream', ), 'dsdiff' => array( 'pattern' => '^FRM8', 'group' => 'audio', 'module' => 'dsdiff', 'mime_type' => 'audio/dsd', ), 'dts' => array( 'pattern' => '^\\x7F\\xFE\\x80\\x01', 'group' => 'audio', 'module' => 'dts', 'mime_type' => 'audio/dts', ), 'flac' => array( 'pattern' => '^fLaC', 'group' => 'audio', 'module' => 'flac', 'mime_type' => 'audio/flac', ), 'la' => array( 'pattern' => '^LA0[2-4]', 'group' => 'audio', 'module' => 'la', 'mime_type' => 'application/octet-stream', ), 'lpac' => array( 'pattern' => '^LPAC', 'group' => 'audio', 'module' => 'lpac', 'mime_type' => 'application/octet-stream', ), 'midi' => array( 'pattern' => '^MThd', 'group' => 'audio', 'module' => 'midi', 'mime_type' => 'audio/midi', ), 'mac' => array( 'pattern' => '^MAC ', 'group' => 'audio', 'module' => 'monkey', 'mime_type' => 'audio/x-monkeys-audio', ), 'it' => array( 'pattern' => '^IMPM', 'group' => 'audio', 'module' => 'mod', 'mime_type' => 'audio/it', ), 'xm' => array( 'pattern' => '^Extended Module', 'group' => 'audio', 'module' => 'mod', 'mime_type' => 'audio/xm', ), 's3m' => array( 'pattern' => '^.{44}SCRM', 'group' => 'audio', 'module' => 'mod', 'mime_type' => 'audio/s3m', ), 'mpc' => array( 'pattern' => '^(MPCK|MP\\+|[\\x00\\x01\\x10\\x11\\x40\\x41\\x50\\x51\\x80\\x81\\x90\\x91\\xC0\\xC1\\xD0\\xD1][\\x20-\\x37][\\x00\\x20\\x40\\x60\\x80\\xA0\\xC0\\xE0])', 'group' => 'audio', 'module' => 'mpc', 'mime_type' => 'audio/x-musepack', ), 'mp3' => array( 'pattern' => '^\\xFF[\\xE2-\\xE7\\xF2-\\xF7\\xFA-\\xFF][\\x00-\\x0B\\x10-\\x1B\\x20-\\x2B\\x30-\\x3B\\x40-\\x4B\\x50-\\x5B\\x60-\\x6B\\x70-\\x7B\\x80-\\x8B\\x90-\\x9B\\xA0-\\xAB\\xB0-\\xBB\\xC0-\\xCB\\xD0-\\xDB\\xE0-\\xEB\\xF0-\\xFB]', 'group' => 'audio', 'module' => 'mp3', 'mime_type' => 'audio/mpeg', ), 'ofr' => array( 'pattern' => '^(\\*RIFF|OFR)', 'group' => 'audio', 'module' => 'optimfrog', 'mime_type' => 'application/octet-stream', ), 'rkau' => array( 'pattern' => '^RKA', 'group' => 'audio', 'module' => 'rkau', 'mime_type' => 'application/octet-stream', ), 'shn' => array( 'pattern' => '^ajkg', 'group' => 'audio', 'module' => 'shorten', 'mime_type' => 'audio/xmms-shn', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'tak' => array( 'pattern' => '^tBaK', 'group' => 'audio', 'module' => 'tak', 'mime_type' => 'application/octet-stream', ), 'tta' => array( 'pattern' => '^TTA', 'group' => 'audio', 'module' => 'tta', 'mime_type' => 'application/octet-stream', ), 'voc' => array( 'pattern' => '^Creative Voice File', 'group' => 'audio', 'module' => 'voc', 'mime_type' => 'audio/voc', ), 'vqf' => array( 'pattern' => '^TWIN', 'group' => 'audio', 'module' => 'vqf', 'mime_type' => 'application/octet-stream', ), 'wv' => array( 'pattern' => '^wvpk', 'group' => 'audio', 'module' => 'wavpack', 'mime_type' => 'application/octet-stream', ), 'asf' => array( 'pattern' => '^\\x30\\x26\\xB2\\x75\\x8E\\x66\\xCF\\x11\\xA6\\xD9\\x00\\xAA\\x00\\x62\\xCE\\x6C', 'group' => 'audio-video', 'module' => 'asf', 'mime_type' => 'video/x-ms-asf', 'iconv_req' => false, ), 'bink' => array( 'pattern' => '^(BIK|SMK)', 'group' => 'audio-video', 'module' => 'bink', 'mime_type' => 'application/octet-stream', ), 'flv' => array( 'pattern' => '^FLV[\\x01]', 'group' => 'audio-video', 'module' => 'flv', 'mime_type' => 'video/x-flv', ), 'ivf' => array( 'pattern' => '^DKIF', 'group' => 'audio-video', 'module' => 'ivf', 'mime_type' => 'video/x-ivf', ), 'matroska' => array( 'pattern' => '^\\x1A\\x45\\xDF\\xA3', 'group' => 'audio-video', 'module' => 'matroska', 'mime_type' => 'video/x-matroska', ), 'mpeg' => array( 'pattern' => '^\\x00\\x00\\x01[\\xB3\\xBA]', 'group' => 'audio-video', 'module' => 'mpeg', 'mime_type' => 'video/mpeg', ), 'nsv' => array( 'pattern' => '^NSV[sf]', 'group' => 'audio-video', 'module' => 'nsv', 'mime_type' => 'application/octet-stream', ), 'ogg' => array( 'pattern' => '^OggS', 'group' => 'audio', 'module' => 'ogg', 'mime_type' => 'application/ogg', 'fail_id3' => 'WARNING', 'fail_ape' => 'WARNING', ), 'quicktime' => array( 'pattern' => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)', 'group' => 'audio-video', 'module' => 'quicktime', 'mime_type' => 'video/quicktime', ), 'riff' => array( 'pattern' => '^(RIFF|SDSS|FORM)', 'group' => 'audio-video', 'module' => 'riff', 'mime_type' => 'audio/wav', 'fail_ape' => 'WARNING', ), 'real' => array( 'pattern' => '^\\.(RMF|ra)', 'group' => 'audio-video', 'module' => 'real', 'mime_type' => 'audio/x-realaudio', ), 'swf' => array( 'pattern' => '^(F|C)WS', 'group' => 'audio-video', 'module' => 'swf', 'mime_type' => 'application/x-shockwave-flash', ), 'ts' => array( 'pattern' => '^(\\x47.{187}){10,}', 'group' => 'audio-video', 'module' => 'ts', 'mime_type' => 'video/MP2T', ), 'wtv' => array( 'pattern' => '^\\xB7\\xD8\\x00\\x20\\x37\\x49\\xDA\\x11\\xA6\\x4E\\x00\\x07\\xE9\\x5E\\xAD\\x8D', 'group' => 'audio-video', 'module' => 'wtv', 'mime_type' => 'video/x-ms-wtv', ), 'bmp' => array( 'pattern' => '^BM', 'group' => 'graphic', 'module' => 'bmp', 'mime_type' => 'image/bmp', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'gif' => array( 'pattern' => '^GIF', 'group' => 'graphic', 'module' => 'gif', 'mime_type' => 'image/gif', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'jpg' => array( 'pattern' => '^\\xFF\\xD8\\xFF', 'group' => 'graphic', 'module' => 'jpg', 'mime_type' => 'image/jpeg', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'pcd' => array( 'pattern' => '^.{2048}PCD_IPI\\x00', 'group' => 'graphic', 'module' => 'pcd', 'mime_type' => 'image/x-photo-cd', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'png' => array( 'pattern' => '^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A', 'group' => 'graphic', 'module' => 'png', 'mime_type' => 'image/png', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'svg' => array( 'pattern' => '( 'graphic', 'module' => 'svg', 'mime_type' => 'image/svg+xml', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'tiff' => array( 'pattern' => '^(II\\x2A\\x00|MM\\x00\\x2A)', 'group' => 'graphic', 'module' => 'tiff', 'mime_type' => 'image/tiff', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'efax' => array( 'pattern' => '^\\xDC\\xFE', 'group' => 'graphic', 'module' => 'efax', 'mime_type' => 'image/efax', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'iso' => array( 'pattern' => '^.{32769}CD001', 'group' => 'misc', 'module' => 'iso', 'mime_type' => 'application/octet-stream', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', 'iconv_req' => false, ), 'hpk' => array( 'pattern' => '^BPUL', 'group' => 'archive', 'module' => 'hpk', 'mime_type' => 'application/octet-stream', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'rar' => array( 'pattern' => '^Rar\\!', 'group' => 'archive', 'module' => 'rar', 'mime_type' => 'application/vnd.rar', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'szip' => array( 'pattern' => '^SZ\\x0A\\x04', 'group' => 'archive', 'module' => 'szip', 'mime_type' => 'application/octet-stream', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'tar' => array( 'pattern' => '^.{100}[0-9\\x20]{7}\\x00[0-9\\x20]{7}\\x00[0-9\\x20]{7}\\x00[0-9\\x20\\x00]{12}[0-9\\x20\\x00]{12}', 'group' => 'archive', 'module' => 'tar', 'mime_type' => 'application/x-tar', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'gz' => array( 'pattern' => '^\\x1F\\x8B\\x08', 'group' => 'archive', 'module' => 'gzip', 'mime_type' => 'application/gzip', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'zip' => array( 'pattern' => '^PK\\x03\\x04', 'group' => 'archive', 'module' => 'zip', 'mime_type' => 'application/zip', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'xz' => array( 'pattern' => '^\\xFD7zXZ\\x00', 'group' => 'archive', 'module' => 'xz', 'mime_type' => 'application/x-xz', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'par2' => array ( 'pattern' => '^PAR2\\x00PKT', 'group' => 'misc', 'module' => 'par2', 'mime_type' => 'application/octet-stream', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'pdf' => array( 'pattern' => '^\\x25PDF', 'group' => 'misc', 'module' => 'pdf', 'mime_type' => 'application/pdf', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'msoffice' => array( 'pattern' => '^\\xD0\\xCF\\x11\\xE0\\xA1\\xB1\\x1A\\xE1', 'group' => 'misc', 'module' => 'msoffice', 'mime_type' => 'application/octet-stream', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'torrent' => array( 'pattern' => '^(d8\\:announce|d7\\:comment)', 'group' => 'misc', 'module' => 'torrent', 'mime_type' => 'application/x-bittorrent', 'fail_id3' => 'ERROR', 'fail_ape' => 'ERROR', ), 'cue' => array( 'pattern' => '', 'group' => 'misc', 'module' => 'cue', 'mime_type' => 'application/octet-stream', ), ); } return $format_info; } public function GetFileFormat(&$filedata, $filename='') { foreach ($this->GetFileFormatArray() as $format_name => $info) { if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; return $info; } } if (preg_match('#\\.mp[123a]$#i', $filename)) { $GetFileFormatArray = $this->GetFileFormatArray(); $info = $GetFileFormatArray['mp3']; $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; return $info; } elseif (preg_match('#\\.cue$#i', $filename) && preg_match('#FILE "[^"]+" (BINARY|MOTOROLA|AIFF|WAVE|MP3)#', $filedata)) { $GetFileFormatArray = $this->GetFileFormatArray(); $info = $GetFileFormatArray['cue']; $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; return $info; } return false; } public function CharConvert(&$array, $encoding) { if ($encoding == $this->encoding) { return; } foreach ($array as $key => $value) { if (is_array($value)) { $this->CharConvert($array[$key], $encoding); } elseif (is_string($value)) { $array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value)); } } } public function HandleAllTags() { static $tags; if (empty($tags)) { $tags = array( 'asf' => array('asf' , 'UTF-16LE'), 'midi' => array('midi' , 'ISO-8859-1'), 'nsv' => array('nsv' , 'ISO-8859-1'), 'ogg' => array('vorbiscomment' , 'UTF-8'), 'png' => array('png' , 'UTF-8'), 'tiff' => array('tiff' , 'ISO-8859-1'), 'quicktime' => array('quicktime' , 'UTF-8'), 'real' => array('real' , 'ISO-8859-1'), 'vqf' => array('vqf' , 'ISO-8859-1'), 'zip' => array('zip' , 'ISO-8859-1'), 'riff' => array('riff' , 'ISO-8859-1'), 'lyrics3' => array('lyrics3' , 'ISO-8859-1'), 'id3v1' => array('id3v1' , $this->encoding_id3v1), 'id3v2' => array('id3v2' , 'UTF-8'), 'ape' => array('ape' , 'UTF-8'), 'cue' => array('cue' , 'ISO-8859-1'), 'matroska' => array('matroska' , 'UTF-8'), 'flac' => array('vorbiscomment' , 'UTF-8'), 'divxtag' => array('divx' , 'ISO-8859-1'), 'iptc' => array('iptc' , 'ISO-8859-1'), 'dsdiff' => array('dsdiff' , 'ISO-8859-1'), ); } foreach ($tags as $comment_name => $tagname_encoding_array) { list($tag_name, $encoding) = $tagname_encoding_array; if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) { $this->info[$comment_name]['encoding'] = $encoding; } if (!empty($this->info[$comment_name]['comments'])) { foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) { foreach ($valuearray as $key => $value) { if (is_string($value)) { $value = trim($value, " \r\n\t"); } if (isset($value) && $value !== "") { if (!is_numeric($key)) { $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value; } else { $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value; } } } if ($tag_key == 'picture') { unset($this->info[$comment_name]['comments'][$tag_key]); } } if (!isset($this->info['tags'][$tag_name])) { continue; } $this->CharConvert($this->info['tags'][$tag_name], $this->info[$comment_name]['encoding']); if ($this->option_tags_html) { foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) { if ($tag_key == 'picture') { continue; } $this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $this->info[$comment_name]['encoding']); } } } } if (!empty($this->info['tags'])) { $unset_keys = array('tags', 'tags_html'); foreach ($this->info['tags'] as $tagtype => $tagarray) { foreach ($tagarray as $tagname => $tagdata) { if ($tagname == 'picture') { foreach ($tagdata as $key => $tagarray) { $this->info['comments']['picture'][] = $tagarray; if (isset($tagarray['data']) && isset($tagarray['image_mime'])) { if (isset($this->info['tags'][$tagtype][$tagname][$key])) { unset($this->info['tags'][$tagtype][$tagname][$key]); } if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) { unset($this->info['tags_html'][$tagtype][$tagname][$key]); } } } } } foreach ($unset_keys as $unset_key) { if (empty($this->info[$unset_key][$tagtype]['picture'])) { unset($this->info[$unset_key][$tagtype]['picture']); } if (empty($this->info[$unset_key][$tagtype])) { unset($this->info[$unset_key][$tagtype]); } if (empty($this->info[$unset_key])) { unset($this->info[$unset_key]); } } if (isset($this->info[$tagtype]['comments']['picture'])) { unset($this->info[$tagtype]['comments']['picture']); } if (empty($this->info[$tagtype]['comments'])) { unset($this->info[$tagtype]['comments']); } if (empty($this->info[$tagtype])) { unset($this->info[$tagtype]); } } } return true; } public function CopyTagsToComments(&$ThisFileInfo) { return getid3_lib::CopyTagsToComments($ThisFileInfo, $this->option_tags_html); } public function getHashdata($algorithm) { switch ($algorithm) { case 'md5': case 'sha1': break; default: return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()'); } if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)'); $this->info[$algorithm.'_data'] = false; } else { $old_abort = ignore_user_abort(true); $empty = tempnam(GETID3_TEMP_DIR, 'getID3'); touch($empty); $temp = tempnam(GETID3_TEMP_DIR, 'getID3'); $file = $this->info['filenamepath']; if (GETID3_OS_ISWINDOWS) { if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { $commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"'; $VorbisCommentError = `$commandline`; } else { $VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; } } else { $commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1'; $VorbisCommentError = `$commandline`; } if (!empty($VorbisCommentError)) { $this->warning('Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError); $this->info[$algorithm.'_data'] = false; } else { switch ($algorithm) { case 'md5': $this->info[$algorithm.'_data'] = md5_file($temp); break; case 'sha1': $this->info[$algorithm.'_data'] = sha1_file($temp); break; } } unlink($empty); unlink($temp); ignore_user_abort($old_abort); } } else { if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm); } else { switch ($algorithm) { case 'md5': $this->info[$algorithm.'_data'] = md5_file($this->info['filenamepath']); break; case 'sha1': $this->info[$algorithm.'_data'] = sha1_file($this->info['filenamepath']); break; } } } return true; } public function ChannelsBitratePlaytimeCalculations() { if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) { } elseif ($this->info['audio']['channels'] == 1) { $this->info['audio']['channelmode'] = 'mono'; } elseif ($this->info['audio']['channels'] == 2) { $this->info['audio']['channelmode'] = 'stereo'; } $CombinedBitrate = 0; $CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0); $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0); if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) { $this->info['bitrate'] = $CombinedBitrate; } if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) { if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) { if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) { $this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']); $this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate']; } } } } if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) { $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; } if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) { $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']; } if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) { if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) { $this->info['audio']['bitrate'] = $this->info['bitrate']; } elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) { $this->info['video']['bitrate'] = $this->info['bitrate']; } } if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']); } } public function CalculateCompressionRatioVideo() { if (empty($this->info['video'])) { return false; } if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) { return false; } if (empty($this->info['video']['bits_per_sample'])) { return false; } switch ($this->info['video']['dataformat']) { case 'bmp': case 'gif': case 'jpeg': case 'jpg': case 'png': case 'tiff': $FrameRate = 1; $PlaytimeSeconds = 1; $BitrateCompressed = $this->info['filesize'] * 8; break; default: if (!empty($this->info['video']['frame_rate'])) { $FrameRate = $this->info['video']['frame_rate']; } else { return false; } if (!empty($this->info['playtime_seconds'])) { $PlaytimeSeconds = $this->info['playtime_seconds']; } else { return false; } if (!empty($this->info['video']['bitrate'])) { $BitrateCompressed = $this->info['video']['bitrate']; } else { return false; } break; } $BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate; $this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed; return true; } public function CalculateCompressionRatioAudio() { if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) { return false; } $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); if (!empty($this->info['audio']['streams'])) { foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) { if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) { $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); } } } return true; } public function CalculateReplayGain() { if (isset($this->info['replay_gain'])) { if (!isset($this->info['replay_gain']['reference_volume'])) { $this->info['replay_gain']['reference_volume'] = 89.0; } if (isset($this->info['replay_gain']['track']['adjustment'])) { $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment']; } if (isset($this->info['replay_gain']['album']['adjustment'])) { $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment']; } if (isset($this->info['replay_gain']['track']['peak'])) { $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']); } if (isset($this->info['replay_gain']['album']['peak'])) { $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']); } } return true; } public function ProcessAudioStreams() { if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { if (!isset($this->info['audio']['streams'])) { foreach ($this->info['audio'] as $key => $value) { if ($key != 'streams') { $this->info['audio']['streams'][0][$key] = $value; } } } } return true; } public function getid3_tempnam() { return tempnam($this->tempdir, 'gI3'); } public function include_module($name) { if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { throw new getid3_exception('Required module.'.$name.'.php is missing.'); } include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php'); return true; } public static function is_writable ($filename) { $ret = is_writable($filename); if (!$ret) { $perms = fileperms($filename); $ret = ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002); } return $ret; } } abstract class getid3_handler { protected $getid3; protected $data_string_flag = false; protected $data_string = ''; protected $data_string_position = 0; protected $data_string_length = 0; private $dependency_to; public function __construct(getID3 $getid3, $call_module=null) { $this->getid3 = $getid3; if ($call_module) { $this->dependency_to = str_replace('getid3_', '', $call_module); } } abstract public function Analyze(); public function AnalyzeString($string) { $this->setStringMode($string); $saved_avdataoffset = $this->getid3->info['avdataoffset']; $saved_avdataend = $this->getid3->info['avdataend']; $saved_filesize = (isset($this->getid3->info['filesize']) ? $this->getid3->info['filesize'] : null); $this->getid3->info['avdataoffset'] = 0; $this->getid3->info['avdataend'] = $this->getid3->info['filesize'] = $this->data_string_length; $this->Analyze(); $this->getid3->info['avdataoffset'] = $saved_avdataoffset; $this->getid3->info['avdataend'] = $saved_avdataend; $this->getid3->info['filesize'] = $saved_filesize; $this->data_string_flag = false; } public function setStringMode($string) { $this->data_string_flag = true; $this->data_string = $string; $this->data_string_length = strlen($string); } protected function ftell() { if ($this->data_string_flag) { return $this->data_string_position; } return ftell($this->getid3->fp); } protected function fread($bytes) { if ($this->data_string_flag) { $this->data_string_position += $bytes; return substr($this->data_string, $this->data_string_position - $bytes, $bytes); } $pos = $this->ftell() + $bytes; if (!getid3_lib::intValueSupported($pos)) { throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10); } $contents = ''; do { if (($this->getid3->memory_limit > 0) && (($bytes / $this->getid3->memory_limit) > 0.99)) { throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') that is more than available PHP memory ('.$this->getid3->memory_limit.')', 10); } $part = fread($this->getid3->fp, $bytes); $partLength = strlen($part); $bytes -= $partLength; $contents .= $part; } while (($bytes > 0) && ($partLength > 0)); return $contents; } protected function fseek($bytes, $whence=SEEK_SET) { if ($this->data_string_flag) { switch ($whence) { case SEEK_SET: $this->data_string_position = $bytes; break; case SEEK_CUR: $this->data_string_position += $bytes; break; case SEEK_END: $this->data_string_position = $this->data_string_length + $bytes; break; } return 0; } $pos = $bytes; if ($whence == SEEK_CUR) { $pos = $this->ftell() + $bytes; } elseif ($whence == SEEK_END) { $pos = $this->getid3->info['filesize'] + $bytes; } if (!getid3_lib::intValueSupported($pos)) { throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10); } $result = fseek($this->getid3->fp, $bytes, $whence); if ($result !== 0) { throw new getid3_exception('cannot fseek('.$pos.'). resource/stream does not appear to support seeking', 10); } return $result; } protected function fgets() { $buffer = ''; $prevchar = ''; if ($this->data_string_flag) { while (true) { $thischar = substr($this->data_string, $this->data_string_position++, 1); if (($prevchar == "\r") && ($thischar != "\n")) { $this->data_string_position--; break; } $buffer .= $thischar; if ($thischar == "\n") { break; } if ($this->data_string_position >= $this->data_string_length) { break; } $prevchar = $thischar; } } else { while (true) { $thischar = fgetc($this->getid3->fp); if (($prevchar == "\r") && ($thischar != "\n")) { fseek($this->getid3->fp, -1, SEEK_CUR); break; } $buffer .= $thischar; if ($thischar == "\n") { break; } if (feof($this->getid3->fp)) { break; } $prevchar = $thischar; } } return $buffer; } protected function feof() { if ($this->data_string_flag) { return $this->data_string_position >= $this->data_string_length; } return feof($this->getid3->fp); } final protected function isDependencyFor($module) { return $this->dependency_to == $module; } protected function error($text) { $this->getid3->info['error'][] = $text; return false; } protected function warning($text) { return $this->getid3->warning($text); } protected function notice($text) { } public function saveAttachment($name, $offset, $length, $image_mime=null) { $fp_dest = null; $dest = null; try { if ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_NONE) { $attachment = null; } elseif ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_INLINE) { $this->fseek($offset); $attachment = $this->fread($length); if ($attachment === false || strlen($attachment) != $length) { throw new Exception('failed to read attachment data'); } } else { $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); if (!is_dir($dir) || !getID3::is_writable($dir)) { throw new Exception('supplied path ('.$dir.') does not exist, or is not writable'); } $dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : ''); if (($fp_dest = fopen($dest, 'wb')) == false) { throw new Exception('failed to create file '.$dest); } $this->fseek($offset); $buffersize = ($this->data_string_flag ? $length : $this->getid3->fread_buffer_size()); $bytesleft = $length; while ($bytesleft > 0) { if (($buffer = $this->fread(min($buffersize, $bytesleft))) === false || ($byteswritten = fwrite($fp_dest, $buffer)) === false || ($byteswritten === 0)) { throw new Exception($buffer === false ? 'not enough data to read' : 'failed to write to destination file, may be not enough disk space'); } $bytesleft -= $byteswritten; } fclose($fp_dest); $attachment = $dest; } } catch (Exception $e) { if (isset($fp_dest) && is_resource($fp_dest)) { fclose($fp_dest); } if (isset($dest) && file_exists($dest)) { unlink($dest); } $attachment = null; $this->warning('Failed to extract attachment '.$name.': '.$e->getMessage()); } $this->fseek($offset + $length); return $attachment; } } class getid3_exception extends Exception { public $message; } getid3->info; $initialOffset = $info['avdataoffset']; if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) { if ($this->allow_bruteforce) { $this->error('Rescanning file in BruteForce mode'); $this->getOnlyMPEGaudioInfoBruteForce(); } } if (isset($info['mpeg']['audio']['bitrate_mode'])) { $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); } $CurrentDataLAMEversionString = null; if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) { $synchoffsetwarning = 'Unknown data before synch '; if (isset($info['id3v2']['headerlength'])) { $synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, '; } elseif ($initialOffset > 0) { $synchoffsetwarning .= '(should be at '.$initialOffset.', '; } else { $synchoffsetwarning .= '(should be at beginning of file, '; } $synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')'; if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) { if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) { $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.'; $info['audio']['codec'] = 'LAME'; $CurrentDataLAMEversionString = 'LAME3.'; } elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) { $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.'; $info['audio']['codec'] = 'LAME'; $CurrentDataLAMEversionString = 'LAME3.'; } } $this->warning($synchoffsetwarning); } if (isset($info['mpeg']['audio']['LAME'])) { $info['audio']['codec'] = 'LAME'; if (!empty($info['mpeg']['audio']['LAME']['long_version'])) { $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00"); } elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) { $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00"); } } $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : '')); if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { $PossiblyLongerLAMEversion_FrameLength = 1441; $PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength; $this->fseek($PossibleLAMEversionStringOffset); $PossiblyLongerLAMEversion_Data = $this->fread($PossiblyLongerLAMEversion_FrameLength); switch (substr($CurrentDataLAMEversionString, -1)) { case 'a': case 'b': $CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1); break; } if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) { if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) { $PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); if (empty($info['audio']['encoder']) || (strlen($PossiblyLongerLAMEversion_NewString) > strlen($info['audio']['encoder']))) { if (!empty($info['audio']['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version']) && ($info['audio']['encoder'] == $info['mpeg']['audio']['LAME']['short_version'])) { if (preg_match('#^LAME[0-9\\.]+#', $PossiblyLongerLAMEversion_NewString, $matches)) { $info['mpeg']['audio']['LAME']['short_version'] = $matches[0]; } } $info['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString; } } } } if (!empty($info['audio']['encoder'])) { $info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 "); } switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') { case 1: case 2: $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; break; } if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) { switch ($info['audio']['dataformat']) { case 'mp1': case 'mp2': case 'mp3': $info['fileformat'] = $info['audio']['dataformat']; break; default: $this->warning('Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$info['audio']['dataformat'].'"'); break; } } if (empty($info['fileformat'])) { unset($info['fileformat']); unset($info['audio']['bitrate_mode']); unset($info['avdataoffset']); unset($info['avdataend']); return false; } $info['mime_type'] = 'audio/mpeg'; $info['audio']['lossless'] = false; if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) { $xingVBRheaderFrameLength = ((isset($info['mpeg']['audio']['VBR_frames']) && isset($info['mpeg']['audio']['framelength'])) ? $info['mpeg']['audio']['framelength'] : 0); $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset'] - $xingVBRheaderFrameLength) * 8 / $info['audio']['bitrate']; } $info['audio']['encoder_options'] = $this->GuessEncoderOptions(); return true; } public function GuessEncoderOptions() { $info = &$this->getid3->info; $thisfile_mpeg_audio = array(); $thisfile_mpeg_audio_lame = array(); if (!empty($info['mpeg']['audio'])) { $thisfile_mpeg_audio = &$info['mpeg']['audio']; if (!empty($thisfile_mpeg_audio['LAME'])) { $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; } } $encoder_options = ''; static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256); if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) { $encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality']; } elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && isset($thisfile_mpeg_audio_lame['preset_used_id']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) { $encoder_options = $thisfile_mpeg_audio_lame['preset_used']; } elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) { static $KnownEncoderValues = array(); if (empty($KnownEncoderValues)) { $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; $KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; $KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; $KnownEncoderValues[0x18][58][2][2][0][2][4000] = '--preset phon+/lw/mw-eu/sw'; $KnownEncoderValues[0x18][58][2][2][0][2][3900] = '--preset phon+/lw/mw-eu/sw'; $KnownEncoderValues[0x18][57][2][1][0][4][5900] = '--preset phon+/lw/mw-eu/sw'; $KnownEncoderValues[0x18][57][2][1][0][4][6200] = '--preset phon+/lw/mw-eu/sw'; $KnownEncoderValues[0x18][57][2][1][0][4][3200] = '--preset phon+/lw/mw-eu/sw'; $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; } if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { $encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; } elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { $encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; } elseif ($info['audio']['bitrate_mode'] == 'vbr') { $LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10); $LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10); $encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value; } elseif ($info['audio']['bitrate_mode'] == 'cbr') { $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); } else { $encoder_options = strtoupper($info['audio']['bitrate_mode']); } } elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) { $encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr']; } elseif (!empty($info['audio']['bitrate'])) { if ($info['audio']['bitrate_mode'] == 'cbr') { $encoder_options = strtoupper($info['audio']['bitrate_mode']).round($info['audio']['bitrate'] / 1000); } else { $encoder_options = strtoupper($info['audio']['bitrate_mode']); } } if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) { $encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min']; } if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) { $encoder_options .= ' --nogap'; } if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) { $ExplodedOptions = explode(' ', $encoder_options, 4); if ($ExplodedOptions[0] == '--r3mix') { $ExplodedOptions[1] = 'r3mix'; } switch ($ExplodedOptions[0]) { case '--preset': case '--alt-preset': case '--r3mix': if ($ExplodedOptions[1] == 'fast') { $ExplodedOptions[1] .= ' '.$ExplodedOptions[2]; } switch ($ExplodedOptions[1]) { case 'portable': case 'medium': case 'standard': case 'extreme': case 'insane': case 'fast portable': case 'fast medium': case 'fast standard': case 'fast extreme': case 'fast insane': case 'r3mix': static $ExpectedLowpass = array( 'insane|20500' => 20500, 'insane|20600' => 20600, 'medium|18000' => 18000, 'fast medium|18000' => 18000, 'extreme|19500' => 19500, 'extreme|19600' => 19600, 'fast extreme|19500' => 19500, 'fast extreme|19600' => 19600, 'standard|19000' => 19000, 'fast standard|19000' => 19000, 'r3mix|19500' => 19500, 'r3mix|19600' => 19600, 'r3mix|18000' => 18000, ); if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) { $encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency']; } break; default: break; } break; } } if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) { if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) { $encoder_options .= ' --resample 44100'; } elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) { $encoder_options .= ' --resample 48000'; } elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) { switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) { case 0: break; case 1: case 2: case 3: $ExplodedOptions = explode(' ', $encoder_options, 4); switch ($ExplodedOptions[0]) { case '--preset': case '--alt-preset': switch ($ExplodedOptions[1]) { case 'fast': case 'portable': case 'medium': case 'standard': case 'extreme': case 'insane': $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; break; default: static $ExpectedResampledRate = array( 'phon+/lw/mw-eu/sw|16000' => 16000, 'mw-us|24000' => 24000, 'mw-us|32000' => 32000, 'mw-us|16000' => 16000, 'phone|16000' => 16000, 'phone|11025' => 11025, 'radio|32000' => 32000, 'fm/radio|32000' => 32000, 'fm|32000' => 32000, 'voice|32000' => 32000); if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) { $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; } break; } break; case '--r3mix': default: $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; break; } break; } } } if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) { $encoder_options = strtoupper($info['audio']['bitrate_mode']); } return $encoder_options; } public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) { static $MPEGaudioVersionLookup; static $MPEGaudioLayerLookup; static $MPEGaudioBitrateLookup; static $MPEGaudioFrequencyLookup; static $MPEGaudioChannelModeLookup; static $MPEGaudioModeExtensionLookup; static $MPEGaudioEmphasisLookup; if (empty($MPEGaudioVersionLookup)) { $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); } if ($this->fseek($offset) != 0) { $this->error('decodeMPEGaudioHeader() failed to seek to next offset at '.$offset); return false; } $headerstring = $this->fread(226); $head4 = substr($headerstring, 0, 4); $head4_key = getid3_lib::PrintHexBytes($head4, true, false, false); static $MPEGaudioHeaderDecodeCache = array(); if (isset($MPEGaudioHeaderDecodeCache[$head4_key])) { $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4_key]; } else { $MPEGheaderRawArray = self::MPEGaudioHeaderDecode($head4); $MPEGaudioHeaderDecodeCache[$head4_key] = $MPEGheaderRawArray; } static $MPEGaudioHeaderValidCache = array(); if (!isset($MPEGaudioHeaderValidCache[$head4_key])) { $MPEGaudioHeaderValidCache[$head4_key] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false); } if (!isset($info['mpeg']['audio'])) { $info['mpeg']['audio'] = array(); } $thisfile_mpeg_audio = &$info['mpeg']['audio']; if ($MPEGaudioHeaderValidCache[$head4_key]) { $thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray; } else { $this->warning('Invalid MPEG audio header ('.getid3_lib::PrintHexBytes($head4).') at offset '.$offset); return false; } if (!$FastMPEGheaderScan) { $thisfile_mpeg_audio['version'] = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']]; $thisfile_mpeg_audio['layer'] = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']]; $thisfile_mpeg_audio['channelmode'] = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']]; $thisfile_mpeg_audio['channels'] = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2); $thisfile_mpeg_audio['sample_rate'] = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']]; $thisfile_mpeg_audio['protection'] = !$thisfile_mpeg_audio['raw']['protection']; $thisfile_mpeg_audio['private'] = (bool) $thisfile_mpeg_audio['raw']['private']; $thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']]; $thisfile_mpeg_audio['copyright'] = (bool) $thisfile_mpeg_audio['raw']['copyright']; $thisfile_mpeg_audio['original'] = (bool) $thisfile_mpeg_audio['raw']['original']; $thisfile_mpeg_audio['emphasis'] = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']]; $info['audio']['channels'] = $thisfile_mpeg_audio['channels']; $info['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate']; if ($thisfile_mpeg_audio['protection']) { $thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2)); } } if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) { $this->warning('Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1'); $thisfile_mpeg_audio['raw']['bitrate'] = 0; } $thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding']; $thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']]; if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $info['avdataoffset'])) { $recursivesearch = false; } if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) { $info['audio']['dataformat'] = 'mp2'; switch ($thisfile_mpeg_audio['channelmode']) { case 'mono': if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) { } else { $this->error($thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'); return false; } break; case 'stereo': case 'joint stereo': case 'dual channel': if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) { } else { $this->error(intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'); return false; } break; } } if ($info['audio']['sample_rate'] > 0) { $thisfile_mpeg_audio['framelength'] = self::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $info['audio']['sample_rate']); } $nextframetestoffset = $offset + 1; if ($thisfile_mpeg_audio['bitrate'] != 'free') { $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; if (isset($thisfile_mpeg_audio['framelength'])) { $nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength']; } else { $this->error('Frame at offset('.$offset.') is has an invalid frame length.'); return false; } } $ExpectedNumberOfAudioBytes = 0; if (substr($headerstring, 4 + 32, 4) == 'VBRI') { $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; $thisfile_mpeg_audio['VBR_method'] = 'Fraunhofer'; $info['audio']['codec'] = 'Fraunhofer'; $SideInfoData = substr($headerstring, 4 + 2, 32); $FraunhoferVBROffset = 36; $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); $thisfile_mpeg_audio['VBR_seek_offsets'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); $thisfile_mpeg_audio['VBR_seek_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); $thisfile_mpeg_audio['VBR_entry_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); $thisfile_mpeg_audio['VBR_entry_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); $ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes']; $previousbyteoffset = $offset; for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) { $Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes'])); $FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes']; $thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']); $thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset; $previousbyteoffset += $Fraunhofer_OffsetN; } } else { $VBRidOffset = self::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']); $SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4); if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) { $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; $thisfile_mpeg_audio['VBR_method'] = 'Xing'; $thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4)); $thisfile_mpeg_audio['xing_flags']['frames'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001); $thisfile_mpeg_audio['xing_flags']['bytes'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002); $thisfile_mpeg_audio['xing_flags']['toc'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004); $thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008); if ($thisfile_mpeg_audio['xing_flags']['frames']) { $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4)); } if ($thisfile_mpeg_audio['xing_flags']['bytes']) { $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4)); } if (!empty($thisfile_mpeg_audio['VBR_frames'])) { $used_filesize = 0; if (!empty($thisfile_mpeg_audio['VBR_bytes'])) { $used_filesize = $thisfile_mpeg_audio['VBR_bytes']; } elseif (!empty($info['filesize'])) { $used_filesize = $info['filesize']; $used_filesize -= (isset($info['id3v2']['headerlength']) ? intval($info['id3v2']['headerlength']) : 0); $used_filesize -= (isset($info['id3v1']) ? 128 : 0); $used_filesize -= (isset($info['tag_offset_end']) ? $info['tag_offset_end'] - $info['tag_offset_start'] : 0); $this->warning('MP3.Xing header missing VBR_bytes, assuming MPEG audio portion of file is '.number_format($used_filesize).' bytes'); } $framelengthfloat = $used_filesize / $thisfile_mpeg_audio['VBR_frames']; if ($thisfile_mpeg_audio['layer'] == '1') { $info['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 12; } else { $info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144; } $thisfile_mpeg_audio['framelength'] = floor($framelengthfloat); } if ($thisfile_mpeg_audio['xing_flags']['toc']) { $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); for ($i = 0; $i < 100; $i++) { $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData[$i]); } } if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) { $thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4)); } if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') { $thisfile_mpeg_audio['LAME'] = array(); $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; $thisfile_mpeg_audio_lame['long_version'] = substr($headerstring, $VBRidOffset + 120, 20); $thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9); $thisfile_mpeg_audio_lame['numeric_version'] = ''; if (preg_match('#^LAME([0-9\\.a-z]*)#', $thisfile_mpeg_audio_lame['long_version'], $matches)) { $thisfile_mpeg_audio_lame['short_version'] = $matches[0]; $thisfile_mpeg_audio_lame['numeric_version'] = $matches[1]; } if (strlen($thisfile_mpeg_audio_lame['numeric_version']) > 0) { foreach (explode('.', $thisfile_mpeg_audio_lame['numeric_version']) as $key => $number) { $thisfile_mpeg_audio_lame['integer_version'][$key] = intval($number); } if ((($thisfile_mpeg_audio_lame['integer_version'][0] * 1000) + $thisfile_mpeg_audio_lame['integer_version'][1]) >= 3090) { unset($thisfile_mpeg_audio_lame['long_version']); $LAMEtagOffsetContant = $VBRidOffset - 0x24; $thisfile_mpeg_audio_lame['RGAD'] = array('track'=>array(), 'album'=>array()); $thisfile_mpeg_audio_lame_RGAD = &$thisfile_mpeg_audio_lame['RGAD']; $thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track']; $thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album']; $thisfile_mpeg_audio_lame['raw'] = array(); $thisfile_mpeg_audio_lame_raw = &$thisfile_mpeg_audio_lame['raw']; unset($thisfile_mpeg_audio['VBR_scale']); $thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1)); $thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9); $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1)); $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4; $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F; $thisfile_mpeg_audio_lame['vbr_method'] = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']); $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); $thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100; if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') { $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608); } else { $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4)); } if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) { unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); } else { $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); } $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2)); $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2)); if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) { $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13; $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10; $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9; $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF; $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']); $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']); $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']); if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; } $info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator']; $info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db']; } else { unset($thisfile_mpeg_audio_lame_RGAD['track']); } if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) { $thisfile_mpeg_audio_lame_RGAD_album['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13; $thisfile_mpeg_audio_lame_RGAD_album['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10; $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9; $thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF; $thisfile_mpeg_audio_lame_RGAD_album['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']); $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']); $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']); if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; } $info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator']; $info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db']; } else { unset($thisfile_mpeg_audio_lame_RGAD['album']); } if (empty($thisfile_mpeg_audio_lame_RGAD)) { unset($thisfile_mpeg_audio_lame['RGAD']); } $EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1)); $thisfile_mpeg_audio_lame['encoding_flags']['nspsytune'] = (bool) ($EncodingFlagsATHtype & 0x10); $thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20); $thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'] = (bool) ($EncodingFlagsATHtype & 0x40); $thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] = (bool) ($EncodingFlagsATHtype & 0x80); $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F; $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1)); if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { $thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; } elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { } elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { $thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; } $EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3)); $thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12; $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF; $MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1)); $thisfile_mpeg_audio_lame_raw['noise_shaping'] = ($MiscByte & 0x03); $thisfile_mpeg_audio_lame_raw['stereo_mode'] = ($MiscByte & 0x1C) >> 2; $thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5; $thisfile_mpeg_audio_lame_raw['source_sample_freq'] = ($MiscByte & 0xC0) >> 6; $thisfile_mpeg_audio_lame['noise_shaping'] = $thisfile_mpeg_audio_lame_raw['noise_shaping']; $thisfile_mpeg_audio_lame['stereo_mode'] = self::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']); $thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality']; $thisfile_mpeg_audio_lame['source_sample_freq'] = self::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']); $thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true); $thisfile_mpeg_audio_lame['mp3_gain_db'] = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain']; $thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6)); $PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2)); $thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800); $thisfile_mpeg_audio_lame['surround_info'] = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']); $thisfile_mpeg_audio_lame['preset_used_id'] = ($PresetSurroundBytes & 0x07FF); $thisfile_mpeg_audio_lame['preset_used'] = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame); if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) { $this->warning('Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org'); } if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) { $thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3'; } $thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4)); $ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']); $thisfile_mpeg_audio_lame['music_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2)); $thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2)); if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; $thisfile_mpeg_audio['bitrate'] = self::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']); $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; } } } } } else { $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; if ($recursivesearch) { $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; if ($this->RecursiveFrameScanning($offset, $nextframetestoffset, true)) { $recursivesearch = false; $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; } if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') { $this->warning('VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.'); } } } } if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) { if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) { if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) { } elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) { $this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)'); } else { $this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)'); } } else { if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) { $info['avdataend']--; } else { $this->warning('Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'); } } } if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($info['audio']['bitrate'])) { if (($offset == $info['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) { $framebytelength = $this->FreeFormatFrameLength($offset, true); if ($framebytelength > 0) { $thisfile_mpeg_audio['framelength'] = $framebytelength; if ($thisfile_mpeg_audio['layer'] == '1') { $info['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12; } else { $info['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144; } } else { $this->error('Error calculating frame length of free-format MP3 without Xing/LAME header'); } } } if (isset($thisfile_mpeg_audio['VBR_frames']) ? $thisfile_mpeg_audio['VBR_frames'] : '') { switch ($thisfile_mpeg_audio['bitrate_mode']) { case 'vbr': case 'abr': $bytes_per_frame = 1152; if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) { $bytes_per_frame = 384; } elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) { $bytes_per_frame = 576; } $thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0); if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) { $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; } break; } } if ($recursivesearch) { if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) { return false; } if (!empty($this->getid3->info['mp3_validity_check_bitrates']) && !empty($thisfile_mpeg_audio['bitrate_mode']) && ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') && !empty($thisfile_mpeg_audio['VBR_bitrate'])) { if (count(array_keys($this->getid3->info['mp3_validity_check_bitrates'])) == 1) { list($cbr_bitrate_in_short_scan) = array_keys($this->getid3->info['mp3_validity_check_bitrates']); $deviation_cbr_from_header_bitrate = abs($thisfile_mpeg_audio['VBR_bitrate'] - $cbr_bitrate_in_short_scan) / $cbr_bitrate_in_short_scan; if ($deviation_cbr_from_header_bitrate < 0.01) { $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; } } } if (isset($this->getid3->info['mp3_validity_check_bitrates'])) { unset($this->getid3->info['mp3_validity_check_bitrates']); } } return true; } public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) { $info = &$this->getid3->info; $firstframetestarray = array('error' => array(), 'warning'=> array(), 'avdataend' => $info['avdataend'], 'avdataoffset' => $info['avdataoffset']); $this->decodeMPEGaudioHeader($offset, $firstframetestarray, false); $info['mp3_validity_check_bitrates'] = array(); for ($i = 0; $i < $this->mp3_valid_check_frames; $i++) { if (($nextframetestoffset + 4) >= $info['avdataend']) { return true; } $nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) { getid3_lib::safe_inc($info['mp3_validity_check_bitrates'][$nextframetestarray['mpeg']['audio']['bitrate']]); if ($ScanAsCBR) { if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) { return false; } } if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) { $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength']; } else { $this->error('Frame at offset ('.$offset.') is has an invalid frame length.'); return false; } } elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) { return true; } else { $this->warning('Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.'); return false; } } return true; } public function FreeFormatFrameLength($offset, $deepscan=false) { $info = &$this->getid3->info; $this->fseek($offset); $MPEGaudioData = $this->fread(32768); $SyncPattern1 = substr($MPEGaudioData, 0, 4); $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3]; if ($SyncPattern2 === $SyncPattern1) { $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3]; } $framelength = false; $framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4); $framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4); if ($framelength1 > 4) { $framelength = $framelength1; } if (($framelength2 > 4) && ($framelength2 < $framelength1)) { $framelength = $framelength2; } if (!$framelength) { $framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4); $framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4); if ($framelength1 > 4) { $framelength = $framelength1; } if (($framelength2 > 4) && ($framelength2 < $framelength1)) { $framelength = $framelength2; } if (!$framelength) { $this->error('Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset); return false; } else { $this->warning('ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)'); $info['audio']['codec'] = 'LAME'; $info['audio']['encoder'] = 'LAME3.88'; $SyncPattern1 = substr($SyncPattern1, 0, 3); $SyncPattern2 = substr($SyncPattern2, 0, 3); } } if ($deepscan) { $ActualFrameLengthValues = array(); $nextoffset = $offset + $framelength; while ($nextoffset < ($info['avdataend'] - 6)) { $this->fseek($nextoffset - 1); $NextSyncPattern = $this->fread(6); if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) { $ActualFrameLengthValues[] = $framelength; } elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) { $ActualFrameLengthValues[] = ($framelength - 1); $nextoffset--; } elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) { $ActualFrameLengthValues[] = ($framelength + 1); $nextoffset++; } else { $this->error('Did not find expected free-format sync pattern at offset '.$nextoffset); return false; } $nextoffset += $framelength; } if (count($ActualFrameLengthValues) > 0) { $framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues))); } } return $framelength; } public function getOnlyMPEGaudioInfoBruteForce() { $MPEGaudioHeaderDecodeCache = array(); $MPEGaudioHeaderValidCache = array(); $MPEGaudioHeaderLengthCache = array(); $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); $LongMPEGversionLookup = array(); $LongMPEGlayerLookup = array(); $LongMPEGbitrateLookup = array(); $LongMPEGpaddingLookup = array(); $LongMPEGfrequencyLookup = array(); $Distribution = array(); $Distribution['bitrate'] = array(); $Distribution['frequency'] = array(); $Distribution['layer'] = array(); $Distribution['version'] = array(); $Distribution['padding'] = array(); $info = &$this->getid3->info; $this->fseek($info['avdataoffset']); $max_frames_scan = 5000; $frames_scanned = 0; $previousvalidframe = $info['avdataoffset']; while ($this->ftell() < $info['avdataend']) { set_time_limit(30); $head4 = $this->fread(4); if (strlen($head4) < 4) { break; } if ($head4[0] != "\xFF") { for ($i = 1; $i < 4; $i++) { if ($head4[$i] == "\xFF") { $this->fseek($i - 4, SEEK_CUR); continue 2; } } continue; } if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { $MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4); } if (!isset($MPEGaudioHeaderValidCache[$head4])) { $MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); } if ($MPEGaudioHeaderValidCache[$head4]) { if (!isset($MPEGaudioHeaderLengthCache[$head4])) { $LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']]; $LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']]; $LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']]; $LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding']; $LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']]; $MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength( $LongMPEGbitrateLookup[$head4], $LongMPEGversionLookup[$head4], $LongMPEGlayerLookup[$head4], $LongMPEGpaddingLookup[$head4], $LongMPEGfrequencyLookup[$head4]); } if ($MPEGaudioHeaderLengthCache[$head4] > 4) { $WhereWeWere = $this->ftell(); $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); $next4 = $this->fread(4); if ($next4[0] == "\xFF") { if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4); } if (!isset($MPEGaudioHeaderValidCache[$next4])) { $MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); } if ($MPEGaudioHeaderValidCache[$next4]) { $this->fseek(-4, SEEK_CUR); $Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]] = isset($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]) ? ++$Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]] : 1; $Distribution['layer'][$LongMPEGlayerLookup[$head4]] = isset($Distribution['layer'][$LongMPEGlayerLookup[$head4]]) ? ++$Distribution['layer'][$LongMPEGlayerLookup[$head4]] : 1; $Distribution['version'][$LongMPEGversionLookup[$head4]] = isset($Distribution['version'][$LongMPEGversionLookup[$head4]]) ? ++$Distribution['version'][$LongMPEGversionLookup[$head4]] : 1; $Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])] = isset($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]) ? ++$Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])] : 1; $Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] = isset($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]) ? ++$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] : 1; if (++$frames_scanned >= $max_frames_scan) { $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']); $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); foreach ($Distribution as $key1 => $value1) { foreach ($value1 as $key2 => $value2) { $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned); } } break; } continue; } } unset($next4); $this->fseek($WhereWeWere - 3); } } } foreach ($Distribution as $key => $value) { ksort($Distribution[$key], SORT_NUMERIC); } ksort($Distribution['version'], SORT_STRING); $info['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate']; $info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency']; $info['mpeg']['audio']['layer_distribution'] = $Distribution['layer']; $info['mpeg']['audio']['version_distribution'] = $Distribution['version']; $info['mpeg']['audio']['padding_distribution'] = $Distribution['padding']; if (count($Distribution['version']) > 1) { $this->error('Corrupt file - more than one MPEG version detected'); } if (count($Distribution['layer']) > 1) { $this->error('Corrupt file - more than one MPEG layer detected'); } if (count($Distribution['frequency']) > 1) { $this->error('Corrupt file - more than one MPEG sample rate detected'); } $bittotal = 0; foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) { if ($bitratevalue != 'free') { $bittotal += ($bitratevalue * $bitratecount); } } $info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']); if ($info['mpeg']['audio']['frame_count'] == 0) { $this->error('no MPEG audio frames found'); return false; } $info['mpeg']['audio']['bitrate'] = ($bittotal / $info['mpeg']['audio']['frame_count']); $info['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr'); $info['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true); $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode']; $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; $info['audio']['dataformat'] = 'mp'.getid3_lib::array_max($Distribution['layer'], true); $info['fileformat'] = $info['audio']['dataformat']; return true; } public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) { $info = &$this->getid3->info; static $MPEGaudioVersionLookup; static $MPEGaudioLayerLookup; static $MPEGaudioBitrateLookup; if (empty($MPEGaudioVersionLookup)) { $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); } $this->fseek($avdataoffset); $sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset); if ($sync_seek_buffer_size <= 0) { $this->error('Invalid $sync_seek_buffer_size at offset '.$avdataoffset); return false; } $header = $this->fread($sync_seek_buffer_size); $sync_seek_buffer_size = strlen($header); $SynchSeekOffset = 0; $SyncSeekAttempts = 0; $SyncSeekAttemptsMax = 1000; $FirstFrameThisfileInfo = null; while ($SynchSeekOffset < $sync_seek_buffer_size) { if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && !feof($this->getid3->fp)) { if ($SynchSeekOffset > $sync_seek_buffer_size) { $this->error('Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB'); if (isset($info['audio']['bitrate'])) { unset($info['audio']['bitrate']); } if (isset($info['mpeg']['audio'])) { unset($info['mpeg']['audio']); } if (empty($info['mpeg'])) { unset($info['mpeg']); } return false; } elseif (feof($this->getid3->fp)) { $this->error('Could not find valid MPEG audio synch before end of file'); if (isset($info['audio']['bitrate'])) { unset($info['audio']['bitrate']); } if (isset($info['mpeg']['audio'])) { unset($info['mpeg']['audio']); } if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) { unset($info['mpeg']); } return false; } } if (($SynchSeekOffset + 1) >= strlen($header)) { $this->error('Could not find valid MPEG synch before end of file'); return false; } if (($header[$SynchSeekOffset] == "\xFF") && ($header[($SynchSeekOffset + 1)] > "\xE0")) { if (++$SyncSeekAttempts >= $SyncSeekAttemptsMax) { $this->error('Could not find valid MPEG audio synch after scanning '.$SyncSeekAttempts.' candidate offsets'); if (isset($info['audio']['bitrate'])) { unset($info['audio']['bitrate']); } if (isset($info['mpeg']['audio'])) { unset($info['mpeg']['audio']); } if (empty($info['mpeg'])) { unset($info['mpeg']); } return false; } $FirstFrameAVDataOffset = null; if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) { $FirstFrameThisfileInfo = $info; $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset; if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) { unset($FirstFrameThisfileInfo); } } $dummy = $info; if ($this->decodeMPEGaudioHeader($avdataoffset + $SynchSeekOffset, $dummy, true)) { $info = $dummy; $info['avdataoffset'] = $avdataoffset + $SynchSeekOffset; switch (isset($info['fileformat']) ? $info['fileformat'] : '') { case '': case 'id3': case 'ape': case 'mp3': $info['fileformat'] = 'mp3'; $info['audio']['dataformat'] = 'mp3'; break; } if (isset($FirstFrameThisfileInfo) && isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) { if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) { $info = $FirstFrameThisfileInfo; $info['avdataoffset'] = $FirstFrameAVDataOffset; $info['fileformat'] = 'mp3'; $info['audio']['dataformat'] = 'mp3'; $dummy = $info; unset($dummy['mpeg']['audio']); $GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength']; $GarbageOffsetEnd = $avdataoffset + $SynchSeekOffset; if ($this->decodeMPEGaudioHeader($GarbageOffsetEnd, $dummy, true, true)) { $info = $dummy; $info['avdataoffset'] = $GarbageOffsetEnd; $this->warning('apparently-valid VBR header not used because could not find '.$this->mp3_valid_check_frames.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd); } else { $this->warning('using data from VBR header even though could not find '.$this->mp3_valid_check_frames.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')'); } } } if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) { $BitrateHistogram = true; } if ($BitrateHistogram) { $info['mpeg']['audio']['stereo_distribution'] = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0); $info['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0); if ($info['mpeg']['audio']['version'] == '1') { if ($info['mpeg']['audio']['layer'] == 3) { $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0); } elseif ($info['mpeg']['audio']['layer'] == 2) { $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0); } elseif ($info['mpeg']['audio']['layer'] == 1) { $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0); } } elseif ($info['mpeg']['audio']['layer'] == 1) { $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0); } else { $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0); } $dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); $synchstartoffset = $info['avdataoffset']; $this->fseek($info['avdataoffset']); $max_frames_scan = 50000; $max_scan_segments = 10; $FastMode = false; $SynchErrorsFound = 0; $frames_scanned = 0; $this_scan_segment = 0; $frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments); $pct_data_scanned = 0; for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) { $frames_scanned_this_segment = 0; $scan_start_offset = array(); if ($this->ftell() >= $info['avdataend']) { break; } $scan_start_offset[$current_segment] = max($this->ftell(), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments))); if ($current_segment > 0) { $this->fseek($scan_start_offset[$current_segment]); $buffer_4k = $this->fread(4096); for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) { if (($buffer_4k[$j] == "\xFF") && ($buffer_4k[($j + 1)] > "\xE0")) { if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) { $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength']; if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) { $scan_start_offset[$current_segment] += $j; break; } } } } } $synchstartoffset = $scan_start_offset[$current_segment]; while (($synchstartoffset < $info['avdataend']) && $this->decodeMPEGaudioHeader($synchstartoffset, $dummy, false, false, $FastMode)) { $FastMode = true; $thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']]; if (empty($dummy['mpeg']['audio']['framelength'])) { $SynchErrorsFound++; $synchstartoffset++; } else { getid3_lib::safe_inc($info['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]); getid3_lib::safe_inc($info['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]); getid3_lib::safe_inc($info['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]); $synchstartoffset += $dummy['mpeg']['audio']['framelength']; } $frames_scanned++; if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) { $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']); if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) { $max_scan_segments = 1; $frames_scan_per_segment = $max_frames_scan; } else { $pct_data_scanned += $this_pct_scanned; break; } } } } if ($pct_data_scanned > 0) { $this->warning('too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); foreach ($info['mpeg']['audio'] as $key1 => $value1) { if (!preg_match('#_distribution$#i', $key1)) { continue; } foreach ($value1 as $key2 => $value2) { $info['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned); } } } if ($SynchErrorsFound > 0) { $this->warning('Found '.$SynchErrorsFound.' synch errors in histogram analysis'); } $bittotal = 0; $framecounter = 0; foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) { $framecounter += $bitratecount; if ($bitratevalue != 'free') { $bittotal += ($bitratevalue * $bitratecount); } } if ($framecounter == 0) { $this->error('Corrupt MP3 file: framecounter == zero'); return false; } $info['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter); $info['mpeg']['audio']['bitrate'] = ($bittotal / $framecounter); $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; $distinct_bitrates = 0; foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) { if ($bitrate_count > 0) { $distinct_bitrates++; } } if ($distinct_bitrates > 1) { $info['mpeg']['audio']['bitrate_mode'] = 'vbr'; } else { $info['mpeg']['audio']['bitrate_mode'] = 'cbr'; } $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode']; } break; } } $SynchSeekOffset++; if (($avdataoffset + $SynchSeekOffset) >= $info['avdataend']) { if (empty($info['mpeg']['audio'])) { $this->error('could not find valid MPEG synch before end of file'); if (isset($info['audio']['bitrate'])) { unset($info['audio']['bitrate']); } if (isset($info['mpeg']['audio'])) { unset($info['mpeg']['audio']); } if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) { unset($info['mpeg']); } return false; } break; } } $info['audio']['channels'] = $info['mpeg']['audio']['channels']; $info['audio']['channelmode'] = $info['mpeg']['audio']['channelmode']; $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; return true; } public static function MPEGaudioVersionArray() { static $MPEGaudioVersion = array('2.5', false, '2', '1'); return $MPEGaudioVersion; } public static function MPEGaudioLayerArray() { static $MPEGaudioLayer = array(false, 3, 2, 1); return $MPEGaudioLayer; } public static function MPEGaudioBitrateArray() { static $MPEGaudioBitrate; if (empty($MPEGaudioBitrate)) { $MPEGaudioBitrate = array ( '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) ), '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), ) ); $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2]; $MPEGaudioBitrate['2.5'] = $MPEGaudioBitrate['2']; } return $MPEGaudioBitrate; } public static function MPEGaudioFrequencyArray() { static $MPEGaudioFrequency; if (empty($MPEGaudioFrequency)) { $MPEGaudioFrequency = array ( '1' => array(44100, 48000, 32000), '2' => array(22050, 24000, 16000), '2.5' => array(11025, 12000, 8000) ); } return $MPEGaudioFrequency; } public static function MPEGaudioChannelModeArray() { static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono'); return $MPEGaudioChannelMode; } public static function MPEGaudioModeExtensionArray() { static $MPEGaudioModeExtension; if (empty($MPEGaudioModeExtension)) { $MPEGaudioModeExtension = array ( 1 => array('4-31', '8-31', '12-31', '16-31'), 2 => array('4-31', '8-31', '12-31', '16-31'), 3 => array('', 'IS', 'MS', 'IS+MS') ); } return $MPEGaudioModeExtension; } public static function MPEGaudioEmphasisArray() { static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17'); return $MPEGaudioEmphasis; } public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) { return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15); } public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) { if (!isset($rawarray['synch']) || ($rawarray['synch'] & 0x0FFE) != 0x0FFE) { return false; } static $MPEGaudioVersionLookup; static $MPEGaudioLayerLookup; static $MPEGaudioBitrateLookup; static $MPEGaudioFrequencyLookup; static $MPEGaudioChannelModeLookup; static $MPEGaudioModeExtensionLookup; static $MPEGaudioEmphasisLookup; if (empty($MPEGaudioVersionLookup)) { $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); } if (isset($MPEGaudioVersionLookup[$rawarray['version']])) { $decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']]; } else { echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : ''); return false; } if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) { $decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']]; } else { echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : ''); return false; } if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) { echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : ''); if ($rawarray['bitrate'] == 15) { if (!$allowBitrate15) { return false; } } else { return false; } } if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) { echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : ''); return false; } if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) { echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : ''); return false; } if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) { echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : ''); return false; } if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) { echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : ''); return false; } return true; } public static function MPEGaudioHeaderDecode($Header4Bytes) { if (strlen($Header4Bytes) != 4) { return false; } $MPEGrawHeader = array(); $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; $MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; $MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; $MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); $MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; $MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; $MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); $MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; $MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; $MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; $MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; $MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); return $MPEGrawHeader; } public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { static $AudioFrameLengthCache = array(); if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false; if ($bitrate != 'free') { if ($version == '1') { if ($layer == '1') { $FrameLengthCoefficient = 48; $SlotLength = 4; } else { $FrameLengthCoefficient = 144; $SlotLength = 1; } } else { if ($layer == '1') { $FrameLengthCoefficient = 24; $SlotLength = 4; } elseif ($layer == '2') { $FrameLengthCoefficient = 144; $SlotLength = 1; } else { $FrameLengthCoefficient = 72; $SlotLength = 1; } } if ($samplerate > 0) { $NewFramelength = ($FrameLengthCoefficient * $bitrate) / $samplerate; $NewFramelength = floor($NewFramelength / $SlotLength) * $SlotLength; if ($padding) { $NewFramelength += $SlotLength; } $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength; } } } return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate]; } public static function ClosestStandardMP3Bitrate($bit_rate) { static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000); static $bit_rate_table = array (0=>'-'); $round_bit_rate = intval(round($bit_rate, -3)); if (!isset($bit_rate_table[$round_bit_rate])) { if ($round_bit_rate > max($standard_bit_rates)) { $bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate)); } else { $bit_rate_table[$round_bit_rate] = max($standard_bit_rates); foreach ($standard_bit_rates as $standard_bit_rate) { if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) { break; } $bit_rate_table[$round_bit_rate] = $standard_bit_rate; } } } return $bit_rate_table[$round_bit_rate]; } public static function XingVBRidOffset($version, $channelmode) { static $XingVBRidOffsetCache = array(); if (empty($XingVBRidOffsetCache)) { $XingVBRidOffsetCache = array ( '1' => array ('mono' => 0x15, 'stereo' => 0x24, 'joint stereo' => 0x24, 'dual channel' => 0x24 ), '2' => array ('mono' => 0x0D, 'stereo' => 0x15, 'joint stereo' => 0x15, 'dual channel' => 0x15 ), '2.5' => array ('mono' => 0x15, 'stereo' => 0x15, 'joint stereo' => 0x15, 'dual channel' => 0x15 ) ); } return $XingVBRidOffsetCache[$version][$channelmode]; } public static function LAMEvbrMethodLookup($VBRmethodID) { static $LAMEvbrMethodLookup = array( 0x00 => 'unknown', 0x01 => 'cbr', 0x02 => 'abr', 0x03 => 'vbr-old / vbr-rh', 0x04 => 'vbr-new / vbr-mtrh', 0x05 => 'vbr-mt', 0x06 => 'vbr (full vbr method 4)', 0x08 => 'cbr (constant bitrate 2 pass)', 0x09 => 'abr (2 pass)', 0x0F => 'reserved' ); return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : ''); } public static function LAMEmiscStereoModeLookup($StereoModeID) { static $LAMEmiscStereoModeLookup = array( 0 => 'mono', 1 => 'stereo', 2 => 'dual mono', 3 => 'joint stereo', 4 => 'forced stereo', 5 => 'auto', 6 => 'intensity stereo', 7 => 'other' ); return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : ''); } public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) { static $LAMEmiscSourceSampleFrequencyLookup = array( 0 => '<= 32 kHz', 1 => '44.1 kHz', 2 => '48 kHz', 3 => '> 48kHz' ); return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : ''); } public static function LAMEsurroundInfoLookup($SurroundInfoID) { static $LAMEsurroundInfoLookup = array( 0 => 'no surround info', 1 => 'DPL encoding', 2 => 'DPL2 encoding', 3 => 'Ambisonic encoding' ); return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved'); } public static function LAMEpresetUsedLookup($LAMEtag) { if ($LAMEtag['preset_used_id'] == 0) { return ''; } $LAMEpresetUsedLookup = array(); for ($i = 8; $i <= 320; $i++) { switch ($LAMEtag['vbr_method']) { case 'cbr': $LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i; break; case 'abr': default: $LAMEpresetUsedLookup[$i] = '--alt-preset '.$i; break; } } $LAMEpresetUsedLookup[1000] = '--r3mix'; $LAMEpresetUsedLookup[1001] = '--alt-preset standard'; $LAMEpresetUsedLookup[1002] = '--alt-preset extreme'; $LAMEpresetUsedLookup[1003] = '--alt-preset insane'; $LAMEpresetUsedLookup[1004] = '--alt-preset fast standard'; $LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme'; $LAMEpresetUsedLookup[1006] = '--alt-preset medium'; $LAMEpresetUsedLookup[1007] = '--alt-preset fast medium'; $LAMEpresetUsedLookup[1010] = '--preset portable'; $LAMEpresetUsedLookup[1015] = '--preset radio'; $LAMEpresetUsedLookup[320] = '--preset insane'; $LAMEpresetUsedLookup[410] = '-V9'; $LAMEpresetUsedLookup[420] = '-V8'; $LAMEpresetUsedLookup[440] = '-V6'; $LAMEpresetUsedLookup[430] = '--preset radio'; $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; $LAMEpresetUsedLookup[470] = '--r3mix'; $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; $LAMEpresetUsedLookup[490] = '-V1'; $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org'); } } "\x7F\xFE\x80\x01", 1 => "\xFE\x7F\x01\x80", 2 => "\x1F\xFF\xE8\x00", 3 => "\xFF\x1F\x00\xE8"); public function Analyze() { $info = &$this->getid3->info; $info['fileformat'] = 'dts'; $this->fseek($info['avdataoffset']); $DTSheader = $this->fread(20); $sync = substr($DTSheader, 0, 4); if (($encoding = array_search($sync, self::$syncwords)) !== false) { $info['dts']['raw']['magic'] = $sync; $this->readBinDataOffset = 32; } elseif ($this->isDependencyFor('matroska')) { $encoding = 0; $this->readBinDataOffset = 0; } else { unset($info['fileformat']); return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"'); } $fhBS = ''; for ($word_offset = 0; $word_offset <= strlen($DTSheader); $word_offset += 2) { switch ($encoding) { case 0: $fhBS .= getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ); break; case 1: $fhBS .= getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))); break; case 2: $fhBS .= substr(getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ), 2, 14); break; case 3: $fhBS .= substr(getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))), 2, 14); break; } } $info['dts']['raw']['frame_type'] = $this->readBinData($fhBS, 1); $info['dts']['raw']['deficit_samples'] = $this->readBinData($fhBS, 5); $info['dts']['flags']['crc_present'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['raw']['pcm_sample_blocks'] = $this->readBinData($fhBS, 7); $info['dts']['raw']['frame_byte_size'] = $this->readBinData($fhBS, 14); $info['dts']['raw']['channel_arrangement'] = $this->readBinData($fhBS, 6); $info['dts']['raw']['sample_frequency'] = $this->readBinData($fhBS, 4); $info['dts']['raw']['bitrate'] = $this->readBinData($fhBS, 5); $info['dts']['flags']['embedded_downmix'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['dynamicrange'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['timestamp'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['auxdata'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['hdcd'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['raw']['extension_audio'] = $this->readBinData($fhBS, 3); $info['dts']['flags']['extended_coding'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['raw']['lfe_effects'] = $this->readBinData($fhBS, 2); $info['dts']['flags']['predictor_history'] = (bool) $this->readBinData($fhBS, 1); if ($info['dts']['flags']['crc_present']) { $info['dts']['raw']['crc16'] = $this->readBinData($fhBS, 16); } $info['dts']['flags']['mri_perfect_reconst'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['raw']['encoder_soft_version'] = $this->readBinData($fhBS, 4); $info['dts']['raw']['copy_history'] = $this->readBinData($fhBS, 2); $info['dts']['raw']['bits_per_sample'] = $this->readBinData($fhBS, 2); $info['dts']['flags']['surround_es'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['front_sum_diff'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['flags']['surround_sum_diff'] = (bool) $this->readBinData($fhBS, 1); $info['dts']['raw']['dialog_normalization'] = $this->readBinData($fhBS, 4); $info['dts']['bitrate'] = self::bitrateLookup($info['dts']['raw']['bitrate']); $info['dts']['bits_per_sample'] = self::bitPerSampleLookup($info['dts']['raw']['bits_per_sample']); $info['dts']['sample_rate'] = self::sampleRateLookup($info['dts']['raw']['sample_frequency']); $info['dts']['dialog_normalization'] = self::dialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']); $info['dts']['flags']['lossless'] = (($info['dts']['raw']['bitrate'] == 31) ? true : false); $info['dts']['bitrate_mode'] = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr'); $info['dts']['channels'] = self::numChannelsLookup($info['dts']['raw']['channel_arrangement']); $info['dts']['channel_arrangement'] = self::channelArrangementLookup($info['dts']['raw']['channel_arrangement']); $info['audio']['dataformat'] = 'dts'; $info['audio']['lossless'] = $info['dts']['flags']['lossless']; $info['audio']['bitrate_mode'] = $info['dts']['bitrate_mode']; $info['audio']['bits_per_sample'] = $info['dts']['bits_per_sample']; $info['audio']['sample_rate'] = $info['dts']['sample_rate']; $info['audio']['channels'] = $info['dts']['channels']; $info['audio']['bitrate'] = $info['dts']['bitrate']; if (isset($info['avdataend']) && !empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) { $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8); if (($encoding == 2) || ($encoding == 3)) { $info['playtime_seconds'] *= (14 / 16); } } return true; } private function readBinData($bin, $length) { $data = substr($bin, $this->readBinDataOffset, $length); $this->readBinDataOffset += $length; return bindec($data); } public static function bitrateLookup($index) { static $lookup = array( 0 => 32000, 1 => 56000, 2 => 64000, 3 => 96000, 4 => 112000, 5 => 128000, 6 => 192000, 7 => 224000, 8 => 256000, 9 => 320000, 10 => 384000, 11 => 448000, 12 => 512000, 13 => 576000, 14 => 640000, 15 => 768000, 16 => 960000, 17 => 1024000, 18 => 1152000, 19 => 1280000, 20 => 1344000, 21 => 1408000, 22 => 1411200, 23 => 1472000, 24 => 1536000, 25 => 1920000, 26 => 2048000, 27 => 3072000, 28 => 3840000, 29 => 'open', 30 => 'variable', 31 => 'lossless', ); return (isset($lookup[$index]) ? $lookup[$index] : false); } public static function sampleRateLookup($index) { static $lookup = array( 0 => 'invalid', 1 => 8000, 2 => 16000, 3 => 32000, 4 => 'invalid', 5 => 'invalid', 6 => 11025, 7 => 22050, 8 => 44100, 9 => 'invalid', 10 => 'invalid', 11 => 12000, 12 => 24000, 13 => 48000, 14 => 'invalid', 15 => 'invalid', ); return (isset($lookup[$index]) ? $lookup[$index] : false); } public static function bitPerSampleLookup($index) { static $lookup = array( 0 => 16, 1 => 20, 2 => 24, 3 => 24, ); return (isset($lookup[$index]) ? $lookup[$index] : false); } public static function numChannelsLookup($index) { switch ($index) { case 0: return 1; case 1: case 2: case 3: case 4: return 2; case 5: case 6: return 3; case 7: case 8: return 4; case 9: return 5; case 10: case 11: case 12: return 6; case 13: return 7; case 14: case 15: return 8; } return false; } public static function channelArrangementLookup($index) { static $lookup = array( 0 => 'A', 1 => 'A + B (dual mono)', 2 => 'L + R (stereo)', 3 => '(L+R) + (L-R) (sum-difference)', 4 => 'LT + RT (left and right total)', 5 => 'C + L + R', 6 => 'L + R + S', 7 => 'C + L + R + S', 8 => 'L + R + SL + SR', 9 => 'C + L + R + SL + SR', 10 => 'CL + CR + L + R + SL + SR', 11 => 'C + L + R+ LR + RR + OV', 12 => 'CF + CR + LF + RF + LR + RR', 13 => 'CL + C + CR + L + R + SL + SR', 14 => 'CL + CR + L + R + SL1 + SL2 + SR1 + SR2', 15 => 'CL + C+ CR + L + R + SL + S + SR', ); return (isset($lookup[$index]) ? $lookup[$index] : 'user-defined'); } public static function dialogNormalization($index, $version) { switch ($version) { case 7: return 0 - $index; case 6: return 0 - 16 - $index; } return false; } } getid3->info; $info['fileformat'] = 'ogg'; if (isset($info['id3v2'])) { $this->warning('Illegal ID3v2 tag present.'); } if (isset($info['id3v1'])) { $this->warning('Illegal ID3v1 tag present.'); } if (isset($info['ape'])) { $this->warning('Illegal APE tag present.'); } $this->fseek($info['avdataoffset']); $oggpageinfo = $this->ParseOggPageHeader(); $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; if ($this->ftell() >= $this->getid3->fread_buffer_size()) { $this->error('Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)'); unset($info['fileformat']); unset($info['ogg']); return false; } $filedata = $this->fread($oggpageinfo['page_length']); $filedataoffset = 0; if (substr($filedata, 0, 4) == 'fLaC') { $info['audio']['dataformat'] = 'flac'; $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['lossless'] = true; } elseif (substr($filedata, 1, 6) == 'vorbis') { $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo); } elseif (substr($filedata, 0, 8) == 'OpusHead') { if ($this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) === false) { return false; } } elseif (substr($filedata, 0, 8) == 'Speex ') { $info['audio']['dataformat'] = 'speex'; $info['mime_type'] = 'audio/speex'; $info['audio']['bitrate_mode'] = 'abr'; $info['audio']['lossless'] = false; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); $filedataoffset += 8; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20); $filedataoffset += 20; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['speex']['speex_version'] = trim($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']); $info['speex']['sample_rate'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate']; $info['speex']['channels'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels']; $info['speex']['vbr'] = (bool) $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr']; $info['speex']['band_type'] = $this->SpeexBandModeLookup($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']); $info['audio']['sample_rate'] = $info['speex']['sample_rate']; $info['audio']['channels'] = $info['speex']['channels']; if ($info['speex']['vbr']) { $info['audio']['bitrate_mode'] = 'vbr'; } } elseif (substr($filedata, 0, 7) == "\x80".'theora') { $info['ogg']['pageheader']['theora']['theora_magic'] = substr($filedata, $filedataoffset, 7); $filedataoffset += 7; $info['ogg']['pageheader']['theora']['version_major'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['version_minor'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['version_revision'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['frame_width_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['pageheader']['theora']['resolution_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); $filedataoffset += 3; $info['ogg']['pageheader']['theora']['resolution_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); $filedataoffset += 3; $info['ogg']['pageheader']['theora']['picture_offset_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['picture_offset_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['frame_rate_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader']['theora']['frame_rate_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); $filedataoffset += 3; $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); $filedataoffset += 3; $info['ogg']['pageheader']['theora']['color_space_id'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader']['theora']['nominal_bitrate'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); $filedataoffset += 3; $info['ogg']['pageheader']['theora']['flags'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['pageheader']['theora']['quality'] = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10; $info['ogg']['pageheader']['theora']['kfg_shift'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5; $info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3; $info['ogg']['pageheader']['theora']['reserved'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; $info['ogg']['pageheader']['theora']['color_space'] = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']); $info['ogg']['pageheader']['theora']['pixel_format'] = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']); $info['video']['dataformat'] = 'theora'; $info['mime_type'] = 'video/ogg'; $info['video']['resolution_x'] = $info['ogg']['pageheader']['theora']['resolution_x']; $info['video']['resolution_y'] = $info['ogg']['pageheader']['theora']['resolution_y']; if ($info['ogg']['pageheader']['theora']['frame_rate_denominator'] > 0) { $info['video']['frame_rate'] = (float) $info['ogg']['pageheader']['theora']['frame_rate_numerator'] / $info['ogg']['pageheader']['theora']['frame_rate_denominator']; } if ($info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] > 0) { $info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator']; } $this->warning('Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable'); } elseif (substr($filedata, 0, 8) == "fishead\x00") { $filedataoffset += 8; $info['ogg']['skeleton']['fishead']['raw']['version_major'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['skeleton']['fishead']['raw']['version_minor'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fishead']['raw']['utc'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20)); $filedataoffset += 20; $info['ogg']['skeleton']['fishead']['version'] = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor']; $info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator']; $info['ogg']['skeleton']['fishead']['basetime'] = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']; $info['ogg']['skeleton']['fishead']['utc'] = $info['ogg']['skeleton']['fishead']['raw']['utc']; $counter = 0; do { $oggpageinfo = $this->ParseOggPageHeader(); $info['ogg']['pageheader'][$oggpageinfo['page_seqno'].'.'.$counter++] = $oggpageinfo; $filedata = $this->fread($oggpageinfo['page_length']); $this->fseek($oggpageinfo['page_end_offset']); if (substr($filedata, 0, 8) == "fisbone\x00") { $filedataoffset = 8; $info['ogg']['skeleton']['fisbone']['raw']['message_header_offset'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['skeleton']['fisbone']['raw']['serial_number'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['skeleton']['fisbone']['raw']['number_header_packets'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fisbone']['raw']['basegranule'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $info['ogg']['skeleton']['fisbone']['raw']['preroll'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['skeleton']['fisbone']['raw']['granuleshift'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['skeleton']['fisbone']['raw']['padding'] = substr($filedata, $filedataoffset, 3); $filedataoffset += 3; } elseif (substr($filedata, 1, 6) == 'theora') { $info['video']['dataformat'] = 'theora1'; $this->error('Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']'); } elseif (substr($filedata, 1, 6) == 'vorbis') { $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo); } else { $this->error('unexpected'); } } while (($oggpageinfo['page_seqno'] == 0) && (substr($filedata, 0, 8) != "fisbone\x00")); $this->fseek($oggpageinfo['page_start_offset']); $this->error('Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']'); } elseif (substr($filedata, 0, 5) == "\x7F".'FLAC') { $info['audio']['dataformat'] = 'flac'; $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['lossless'] = true; $info['ogg']['flac']['header']['version_major'] = ord(substr($filedata, 5, 1)); $info['ogg']['flac']['header']['version_minor'] = ord(substr($filedata, 6, 1)); $info['ogg']['flac']['header']['header_packets'] = getid3_lib::BigEndian2Int(substr($filedata, 7, 2)) + 1; $info['ogg']['flac']['header']['magic'] = substr($filedata, 9, 4); if ($info['ogg']['flac']['header']['magic'] != 'fLaC') { $this->error('Ogg-FLAC expecting "fLaC", found "'.$info['ogg']['flac']['header']['magic'].'" ('.trim(getid3_lib::PrintHexBytes($info['ogg']['flac']['header']['magic'])).')'); return false; } $info['ogg']['flac']['header']['STREAMINFO_bytes'] = getid3_lib::BigEndian2Int(substr($filedata, 13, 4)); $info['flac']['STREAMINFO'] = getid3_flac::parseSTREAMINFOdata(substr($filedata, 17, 34)); if (!empty($info['flac']['STREAMINFO']['sample_rate'])) { $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['sample_rate'] = $info['flac']['STREAMINFO']['sample_rate']; $info['audio']['channels'] = $info['flac']['STREAMINFO']['channels']; $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; $info['playtime_seconds'] = $info['flac']['STREAMINFO']['samples_stream'] / $info['flac']['STREAMINFO']['sample_rate']; } } else { $this->error('Expecting one of "vorbis", "Speex", "OpusHead", "vorbis", "fishhead", "theora", "fLaC" identifier strings, found "'.substr($filedata, 0, 8).'"'); unset($info['ogg']); unset($info['mime_type']); return false; } $oggpageinfo = $this->ParseOggPageHeader(); $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; switch ($info['audio']['dataformat']) { case 'vorbis': $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1)); $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); $this->ParseVorbisComments(); break; case 'flac': $flac = new getid3_flac($this->getid3); if (!$flac->parseMETAdata()) { $this->error('Failed to parse FLAC headers'); return false; } unset($flac); break; case 'speex': $this->fseek($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR); $this->ParseVorbisComments(); break; case 'opus': $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 0, 8); if(substr($filedata, 0, 8) != 'OpusTags') { $this->error('Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"'); return false; } $this->ParseVorbisComments(); break; } if (!getid3_lib::intValueSupported($info['avdataend'])) { $this->warning('Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)'); } else { $this->fseek(max($info['avdataend'] - $this->getid3->fread_buffer_size(), 0)); $LastChunkOfOgg = strrev($this->fread($this->getid3->fread_buffer_size())); if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) { $this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO'))); $info['avdataend'] = $this->ftell(); $info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader(); $info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position']; if ($info['ogg']['samples'] == 0) { $this->error('Corrupt Ogg file: eos.number of samples == zero'); return false; } if (!empty($info['audio']['sample_rate'])) { $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']); } } } if (!empty($info['ogg']['bitrate_average'])) { $info['audio']['bitrate'] = $info['ogg']['bitrate_average']; } elseif (!empty($info['ogg']['bitrate_nominal'])) { $info['audio']['bitrate'] = $info['ogg']['bitrate_nominal']; } elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) { $info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2; } if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) { if ($info['audio']['bitrate'] == 0) { $this->error('Corrupt Ogg file: bitrate_audio == zero'); return false; } $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']); } if (isset($info['ogg']['vendor'])) { $info['audio']['encoder'] = preg_replace('/^Encoded with /', '', $info['ogg']['vendor']); if ($info['audio']['dataformat'] == 'vorbis') { if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) { if ($info['audio']['bitrate_mode'] == 'abr') { $info['audio']['encoder_options'] = '-b '.round($info['ogg']['bitrate_nominal'] / 1000); } elseif (($info['audio']['bitrate_mode'] == 'vbr') && ($info['audio']['channels'] == 2) && ($info['audio']['sample_rate'] >= 44100) && ($info['audio']['sample_rate'] <= 48000)) { $info['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($info['ogg']['bitrate_nominal']); } } if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) { $info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps'; } } } return true; } public function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) { $info = &$this->getid3->info; $info['audio']['dataformat'] = 'vorbis'; $info['audio']['lossless'] = false; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); $filedataoffset += 6; $info['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $info['audio']['channels'] = $info['ogg']['numberofchannels']; $info['ogg']['samplerate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; if ($info['ogg']['samplerate'] == 0) { $this->error('Corrupt Ogg file: sample rate == zero'); return false; } $info['audio']['sample_rate'] = $info['ogg']['samplerate']; $info['ogg']['samples'] = 0; $info['ogg']['bitrate_average'] = 0; $info['ogg']['bitrate_max'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['bitrate_nominal'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['bitrate_min'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F); $info['ogg']['blocksize_large'] = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4); $info['ogg']['stop_bit'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $info['audio']['bitrate_mode'] = 'vbr'; if ($info['ogg']['bitrate_max'] == 0xFFFFFFFF) { unset($info['ogg']['bitrate_max']); $info['audio']['bitrate_mode'] = 'abr'; } if ($info['ogg']['bitrate_nominal'] == 0xFFFFFFFF) { unset($info['ogg']['bitrate_nominal']); } if ($info['ogg']['bitrate_min'] == 0xFFFFFFFF) { unset($info['ogg']['bitrate_min']); $info['audio']['bitrate_mode'] = 'abr'; } return true; } public function ParseOpusPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) { $info = &$this->getid3->info; $info['audio']['dataformat'] = 'opus'; $info['mime_type'] = 'audio/ogg; codecs=opus'; $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['lossless'] = false; $info['ogg']['pageheader']['opus']['opus_magic'] = substr($filedata, $filedataoffset, 8); $filedataoffset += 8; $info['ogg']['pageheader']['opus']['version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; if ($info['ogg']['pageheader']['opus']['version'] < 1 || $info['ogg']['pageheader']['opus']['version'] > 15) { $this->error('Unknown opus version number (only accepting 1-15)'); return false; } $info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; if ($info['ogg']['pageheader']['opus']['out_channel_count'] == 0) { $this->error('Invalid channel count in opus header (must not be zero)'); return false; } $info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); $filedataoffset += 2; $info['ogg']['pageheader']['opus']['input_sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $info['opus']['opus_version'] = $info['ogg']['pageheader']['opus']['version']; $info['opus']['sample_rate_input'] = $info['ogg']['pageheader']['opus']['input_sample_rate']; $info['opus']['out_channel_count'] = $info['ogg']['pageheader']['opus']['out_channel_count']; $info['audio']['channels'] = $info['opus']['out_channel_count']; $info['audio']['sample_rate_input'] = $info['opus']['sample_rate_input']; $info['audio']['sample_rate'] = 48000; return true; } public function ParseOggPageHeader() { $oggheader = array(); $oggheader['page_start_offset'] = $this->ftell(); $filedata = $this->fread($this->getid3->fread_buffer_size()); $filedataoffset = 0; while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) { if (($this->ftell() - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) { return false; } if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) { if ($this->feof() || (($filedata .= $this->fread($this->getid3->fread_buffer_size())) === '')) { return false; } } } $filedataoffset += strlen('OggS') - 1; $oggheader['stream_structver'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $oggheader['flags_raw'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $oggheader['flags']['fresh'] = (bool) ($oggheader['flags_raw'] & 0x01); $oggheader['flags']['bos'] = (bool) ($oggheader['flags_raw'] & 0x02); $oggheader['flags']['eos'] = (bool) ($oggheader['flags_raw'] & 0x04); $oggheader['pcm_abs_position'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); $filedataoffset += 8; $oggheader['stream_serialno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $oggheader['page_seqno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $oggheader['page_checksum'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); $filedataoffset += 4; $oggheader['page_segments'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $oggheader['page_length'] = 0; for ($i = 0; $i < $oggheader['page_segments']; $i++) { $oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); $filedataoffset += 1; $oggheader['page_length'] += $oggheader['segment_table'][$i]; } $oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset; $oggheader['page_end_offset'] = $oggheader['header_end_offset'] + $oggheader['page_length']; $this->fseek($oggheader['header_end_offset']); return $oggheader; } public function ParseVorbisComments() { $info = &$this->getid3->info; $OriginalOffset = $this->ftell(); $commentdata = null; $commentdataoffset = 0; $VorbisCommentPage = 1; $CommentStartOffset = 0; switch ($info['audio']['dataformat']) { case 'vorbis': case 'speex': case 'opus': $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; $this->fseek($CommentStartOffset); $commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments']; $commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset); if ($info['audio']['dataformat'] == 'vorbis') { $commentdataoffset += (strlen('vorbis') + 1); } else if ($info['audio']['dataformat'] == 'opus') { $commentdataoffset += strlen('OpusTags'); } break; case 'flac': $CommentStartOffset = $info['flac']['VORBIS_COMMENT']['raw']['offset'] + 4; $this->fseek($CommentStartOffset); $commentdata = $this->fread($info['flac']['VORBIS_COMMENT']['raw']['block_length']); break; default: return false; } $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); $commentdataoffset += 4; $info['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize); $commentdataoffset += $VendorSize; $CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); $commentdataoffset += 4; $info['avdataoffset'] = $CommentStartOffset + $commentdataoffset; $basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT'); $ThisFileInfo_ogg_comments_raw = &$info['ogg']['comments_raw']; for ($i = 0; $i < $CommentsCount; $i++) { if ($i >= 10000) { $this->warning('Unexpectedly large number ('.$CommentsCount.') of Ogg comments - breaking after reading '.$i.' comments'); break; } $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset; if ($this->ftell() < ($ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + 4)) { if ($oggpageinfo = $this->ParseOggPageHeader()) { $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; $VorbisCommentPage++; $AsYetUnusedData = substr($commentdata, $commentdataoffset); $commentdata = substr($commentdata, 0, $commentdataoffset); $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); $commentdata .= $AsYetUnusedData; $commentdata .= $this->fread($this->OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1)); } } $ThisFileInfo_ogg_comments_raw[$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); $info['avdataoffset'] = $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + $ThisFileInfo_ogg_comments_raw[$i]['size'] + 4; $commentdataoffset += 4; while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) { if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) { $this->warning('Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments'); break 2; } $VorbisCommentPage++; if ($oggpageinfo = $this->ParseOggPageHeader()) { $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; $AsYetUnusedData = substr($commentdata, $commentdataoffset); $commentdata = substr($commentdata, 0, $commentdataoffset); $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); $commentdata .= $AsYetUnusedData; if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) { $this->warning('undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell()); break; } $readlength = self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1); if ($readlength <= 0) { $this->warning('invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell()); break; } $commentdata .= $this->fread($readlength); } else { $this->warning('failed to ParseOggPageHeader() at offset '.$this->ftell()); break; } } $ThisFileInfo_ogg_comments_raw[$i]['offset'] = $commentdataoffset; $commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']); $commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size']; if (!$commentstring) { $this->warning('Blank Ogg comment ['.$i.']'); } elseif (strstr($commentstring, '=')) { $commentexploded = explode('=', $commentstring, 2); $ThisFileInfo_ogg_comments_raw[$i]['key'] = strtoupper($commentexploded[0]); $ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : ''); if ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'METADATA_BLOCK_PICTURE') { $flac = new getid3_flac($this->getid3); $flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value'])); $flac->parsePICTURE(); $info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0]; unset($flac); } elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') { $data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']); $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure'); $imageinfo = getid3_lib::GetDataImageSize($data); if ($imageinfo === false || !isset($imageinfo['mime'])) { $this->warning('COVERART vorbiscomment tag contains invalid image'); continue; } $ogg = new self($this->getid3); $ogg->setStringMode($data); $info['ogg']['comments']['picture'][] = array( 'image_mime' => $imageinfo['mime'], 'datalength' => strlen($data), 'picturetype' => 'cover art', 'image_height' => $imageinfo['height'], 'image_width' => $imageinfo['width'], 'data' => $ogg->saveAttachment('coverart', 0, strlen($data), $imageinfo['mime']), ); unset($ogg); } else { $info['ogg']['comments'][strtolower($ThisFileInfo_ogg_comments_raw[$i]['key'])][] = $ThisFileInfo_ogg_comments_raw[$i]['value']; } } else { $this->warning('[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring); } unset($ThisFileInfo_ogg_comments_raw[$i]); } unset($ThisFileInfo_ogg_comments_raw); if (isset($info['ogg']['comments']) && is_array($info['ogg']['comments'])) { foreach ($info['ogg']['comments'] as $index => $commentvalue) { switch ($index) { case 'rg_audiophile': case 'replaygain_album_gain': $info['replay_gain']['album']['adjustment'] = (double) $commentvalue[0]; unset($info['ogg']['comments'][$index]); break; case 'rg_radio': case 'replaygain_track_gain': $info['replay_gain']['track']['adjustment'] = (double) $commentvalue[0]; unset($info['ogg']['comments'][$index]); break; case 'replaygain_album_peak': $info['replay_gain']['album']['peak'] = (double) $commentvalue[0]; unset($info['ogg']['comments'][$index]); break; case 'rg_peak': case 'replaygain_track_peak': $info['replay_gain']['track']['peak'] = (double) $commentvalue[0]; unset($info['ogg']['comments'][$index]); break; case 'replaygain_reference_loudness': $info['replay_gain']['reference_volume'] = (double) $commentvalue[0]; unset($info['ogg']['comments'][$index]); break; default: break; } } } $this->fseek($OriginalOffset); return true; } public static function SpeexBandModeLookup($mode) { static $SpeexBandModeLookup = array(); if (empty($SpeexBandModeLookup)) { $SpeexBandModeLookup[0] = 'narrow'; $SpeexBandModeLookup[1] = 'wide'; $SpeexBandModeLookup[2] = 'ultra-wide'; } return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null); } public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) { $segmentlength = 0; for ($i = 0; $i < $SegmentNumber; $i++) { $segmentlength = 0; foreach ($OggInfoArray['segment_table'] as $key => $value) { $segmentlength += $value; if ($value < 255) { break; } } } return $segmentlength; } public static function get_quality_from_nominal_bitrate($nominal_bitrate) { $nominal_bitrate = $nominal_bitrate / 1000; if ($nominal_bitrate < 128) { $qval = ($nominal_bitrate - 64) / 16; } elseif ($nominal_bitrate < 256) { $qval = $nominal_bitrate / 32; } elseif ($nominal_bitrate < 320) { $qval = ($nominal_bitrate + 256) / 64; } else { $qval = ($nominal_bitrate + 1300) / 180; } return round($qval, 1); } public static function TheoraColorSpace($colorspace_id) { static $TheoraColorSpaceLookup = array(); if (empty($TheoraColorSpaceLookup)) { $TheoraColorSpaceLookup[0] = 'Undefined'; $TheoraColorSpaceLookup[1] = 'Rec. 470M'; $TheoraColorSpaceLookup[2] = 'Rec. 470BG'; $TheoraColorSpaceLookup[3] = 'Reserved'; } return (isset($TheoraColorSpaceLookup[$colorspace_id]) ? $TheoraColorSpaceLookup[$colorspace_id] : null); } public static function TheoraPixelFormat($pixelformat_id) { static $TheoraPixelFormatLookup = array(); if (empty($TheoraPixelFormatLookup)) { $TheoraPixelFormatLookup[0] = '4:2:0'; $TheoraPixelFormatLookup[1] = 'Reserved'; $TheoraPixelFormatLookup[2] = '4:2:2'; $TheoraPixelFormatLookup[3] = '4:4:4'; } return (isset($TheoraPixelFormatLookup[$pixelformat_id]) ? $TheoraPixelFormatLookup[$pixelformat_id] : null); } } getid3->info; try { $this->parseEBML($info); } catch (Exception $e) { $this->error('EBML parser: '.$e->getMessage()); } if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { foreach ($info['matroska']['info'] as $key => $infoarray) { if (isset($infoarray['Duration'])) { $info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000); break; } } } if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) { foreach ($info['matroska']['tags'] as $key => $infoarray) { $this->ExtractCommentsSimpleTag($infoarray); } } if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) { $track_info = array(); $track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']); $track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true); if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; } switch ($trackarray['TrackType']) { case 1: $track_info['resolution_x'] = $trackarray['PixelWidth']; $track_info['resolution_y'] = $trackarray['PixelHeight']; $track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0); $track_info['display_x'] = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']); $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } switch ($trackarray['CodecID']) { case 'V_MS/VFW/FOURCC': getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']); $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']); $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed; break; } $info['video']['streams'][$trackarray['TrackUID']] = $track_info; break; case 2: $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0); $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1); $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng'); if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } switch ($trackarray['CodecID']) { case 'A_PCM/INT/LIT': case 'A_PCM/INT/BIG': $track_info['bitrate'] = $track_info['sample_rate'] * $track_info['channels'] * $trackarray['BitDepth']; break; case 'A_AC3': case 'A_EAC3': case 'A_DTS': case 'A_MPEG/L3': case 'A_MPEG/L2': case 'A_FLAC': $module_dataformat = ($track_info['dataformat'] == 'mp2' ? 'mp3' : ($track_info['dataformat'] == 'eac3' ? 'ac3' : $track_info['dataformat'])); getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.$module_dataformat.'.php', __FILE__, true); if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set'); break; } $getid3_temp = new getID3(); if ($track_info['dataformat'] != 'flac') { $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); } $getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset']; if ($track_info['dataformat'][0] == 'm' || $track_info['dataformat'] == 'flac') { $getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length']; } $class = 'getid3_'.$module_dataformat; $header_data_key = $track_info['dataformat'][0] == 'm' ? 'mpeg' : $track_info['dataformat']; $getid3_audio = new $class($getid3_temp, __CLASS__); if ($track_info['dataformat'] == 'flac') { $getid3_audio->AnalyzeString($trackarray['CodecPrivate']); } else { $getid3_audio->Analyze(); } if (!empty($getid3_temp->info[$header_data_key])) { $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key]; if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { foreach ($getid3_temp->info['audio'] as $sub_key => $value) { $track_info[$sub_key] = $value; } } } else { $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']); } if (!empty($getid3_temp->info['error'])) { foreach ($getid3_temp->info['error'] as $newerror) { $this->warning($class.'() says: ['.$newerror.']'); } } if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $newerror) { $this->warning($class.'() says: ['.$newerror.']'); } } unset($getid3_temp, $getid3_audio); break; case 'A_AAC': case 'A_AAC/MPEG2/LC': case 'A_AAC/MPEG2/LC/SBR': case 'A_AAC/MPEG4/LC': case 'A_AAC/MPEG4/LC/SBR': $this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated'); break; case 'A_VORBIS': if (!isset($trackarray['CodecPrivate'])) { $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set'); break; } $vorbis_offset = strpos($trackarray['CodecPrivate'], 'vorbis', 1); if ($vorbis_offset === false) { $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data does not contain "vorbis" keyword'); break; } $vorbis_offset -= 1; getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true); $getid3_temp = new getID3(); $getid3_ogg = new getid3_ogg($getid3_temp); $oggpageinfo['page_seqno'] = 0; $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo); if (!empty($getid3_temp->info['ogg'])) { $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg']; if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { foreach ($getid3_temp->info['audio'] as $sub_key => $value) { $track_info[$sub_key] = $value; } } } if (!empty($getid3_temp->info['error'])) { foreach ($getid3_temp->info['error'] as $newerror) { $this->warning('getid3_ogg() says: ['.$newerror.']'); } } if (!empty($getid3_temp->info['warning'])) { foreach ($getid3_temp->info['warning'] as $newerror) { $this->warning('getid3_ogg() says: ['.$newerror.']'); } } if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) { $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal']; } unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset); break; case 'A_MS/ACM': getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); $parsed = getid3_riff::parseWAVEFORMATex($trackarray['CodecPrivate']); foreach ($parsed as $sub_key => $value) { if ($sub_key != 'raw') { $track_info[$sub_key] = $value; } } $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed; break; default: $this->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"'); break; } $info['audio']['streams'][$trackarray['TrackUID']] = $track_info; break; } } if (!empty($info['video']['streams'])) { $info['video'] = self::getDefaultStreamInfo($info['video']['streams']); } if (!empty($info['audio']['streams'])) { $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']); } } if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) { foreach ($info['matroska']['attachments'] as $i => $entry) { if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) { $info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']); } } } if (!empty($info['video']['streams'])) { $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska'); } elseif (!empty($info['audio']['streams'])) { $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska'); } elseif (isset($info['mime_type'])) { unset($info['mime_type']); } if (!empty($info['matroska']['tags'])) { $_STATISTICS_byTrackUID = array(); foreach ($info['matroska']['tags'] as $key1 => $value1) { if (!empty($value1['Targets']['TagTrackUID'][0]) && !empty($value1['SimpleTag'])) { foreach ($value1['SimpleTag'] as $key2 => $value2) { if (!empty($value2['TagName']) && isset($value2['TagString'])) { $_STATISTICS_byTrackUID[$value1['Targets']['TagTrackUID'][0]][$value2['TagName']] = $value2['TagString']; } } } } foreach (array('audio','video') as $avtype) { if (!empty($info[$avtype]['streams'])) { foreach ($info[$avtype]['streams'] as $trackUID => $trackdata) { if (!isset($trackdata['bitrate']) && !empty($_STATISTICS_byTrackUID[$trackUID]['BPS'])) { $info[$avtype]['streams'][$trackUID]['bitrate'] = (int) $_STATISTICS_byTrackUID[$trackUID]['BPS']; @$info[$avtype]['bitrate'] += $info[$avtype]['streams'][$trackUID]['bitrate']; } } } } } return true; } private function parseEBML(&$info) { $this->current_offset = $info['avdataoffset']; while ($this->getEBMLelement($top_element, $info['avdataend'])) { switch ($top_element['id']) { case EBML_ID_EBML: $info['matroska']['header']['offset'] = $top_element['offset']; $info['matroska']['header']['length'] = $top_element['length']; while ($this->getEBMLelement($element_data, $top_element['end'], true)) { switch ($element_data['id']) { case EBML_ID_EBMLVERSION: case EBML_ID_EBMLREADVERSION: case EBML_ID_EBMLMAXIDLENGTH: case EBML_ID_EBMLMAXSIZELENGTH: case EBML_ID_DOCTYPEVERSION: case EBML_ID_DOCTYPEREADVERSION: $element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']); break; case EBML_ID_DOCTYPE: $element_data['data'] = getid3_lib::trimNullByte($element_data['data']); $info['matroska']['doctype'] = $element_data['data']; $info['fileformat'] = $element_data['data']; break; default: $this->unhandledElement('header', __LINE__, $element_data); break; } unset($element_data['offset'], $element_data['end']); $info['matroska']['header']['elements'][] = $element_data; } break; case EBML_ID_SEGMENT: $info['matroska']['segment'][0]['offset'] = $top_element['offset']; $info['matroska']['segment'][0]['length'] = $top_element['length']; while ($this->getEBMLelement($element_data, $top_element['end'])) { if ($element_data['id'] != EBML_ID_CLUSTER || !$this->hide_clusters) { $info['matroska']['segments'][] = $element_data; } switch ($element_data['id']) { case EBML_ID_SEEKHEAD: while ($this->getEBMLelement($seek_entry, $element_data['end'])) { switch ($seek_entry['id']) { case EBML_ID_SEEK: while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) { switch ($sub_seek_entry['id']) { case EBML_ID_SEEKID: $seek_entry['target_id'] = self::EBML2Int($sub_seek_entry['data']); $seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']); break; case EBML_ID_SEEKPOSITION: $seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']); break; default: $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } break; } if (!isset($seek_entry['target_id'])) { $this->warning('seek_entry[target_id] unexpectedly not set at '.$seek_entry['offset']); break; } if (($seek_entry['target_id'] != EBML_ID_CLUSTER) || !$this->hide_clusters) { $info['matroska']['seek'][] = $seek_entry; } break; default: $this->unhandledElement('seekhead', __LINE__, $seek_entry); break; } } break; case EBML_ID_TRACKS: $info['matroska']['tracks'] = $element_data; while ($this->getEBMLelement($track_entry, $element_data['end'])) { switch ($track_entry['id']) { case EBML_ID_TRACKENTRY: while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS, EBML_ID_CODECPRIVATE))) { switch ($subelement['id']) { case EBML_ID_TRACKUID: $track_entry[$subelement['id_name']] = getid3_lib::PrintHexBytes($subelement['data'], true, false); break; case EBML_ID_TRACKNUMBER: case EBML_ID_TRACKTYPE: case EBML_ID_MINCACHE: case EBML_ID_MAXCACHE: case EBML_ID_MAXBLOCKADDITIONID: case EBML_ID_DEFAULTDURATION: $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); break; case EBML_ID_TRACKTIMECODESCALE: $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']); break; case EBML_ID_CODECID: case EBML_ID_LANGUAGE: case EBML_ID_NAME: case EBML_ID_CODECNAME: $track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); break; case EBML_ID_CODECPRIVATE: $track_entry[$subelement['id_name']] = $this->readEBMLelementData($subelement['length'], true); break; case EBML_ID_FLAGENABLED: case EBML_ID_FLAGDEFAULT: case EBML_ID_FLAGFORCED: case EBML_ID_FLAGLACING: case EBML_ID_CODECDECODEALL: $track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']); break; case EBML_ID_VIDEO: while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { switch ($sub_subelement['id']) { case EBML_ID_PIXELWIDTH: case EBML_ID_PIXELHEIGHT: case EBML_ID_PIXELCROPBOTTOM: case EBML_ID_PIXELCROPTOP: case EBML_ID_PIXELCROPLEFT: case EBML_ID_PIXELCROPRIGHT: case EBML_ID_DISPLAYWIDTH: case EBML_ID_DISPLAYHEIGHT: case EBML_ID_DISPLAYUNIT: case EBML_ID_ASPECTRATIOTYPE: case EBML_ID_STEREOMODE: case EBML_ID_OLDSTEREOMODE: $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_FLAGINTERLACED: $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_GAMMAVALUE: $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']); break; case EBML_ID_COLOURSPACE: $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); break; default: $this->unhandledElement('track.video', __LINE__, $sub_subelement); break; } } break; case EBML_ID_AUDIO: while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { switch ($sub_subelement['id']) { case EBML_ID_CHANNELS: case EBML_ID_BITDEPTH: $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_SAMPLINGFREQUENCY: case EBML_ID_OUTPUTSAMPLINGFREQUENCY: $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']); break; case EBML_ID_CHANNELPOSITIONS: $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); break; default: $this->unhandledElement('track.audio', __LINE__, $sub_subelement); break; } } break; case EBML_ID_CONTENTENCODINGS: while ($this->getEBMLelement($sub_subelement, $subelement['end'])) { switch ($sub_subelement['id']) { case EBML_ID_CONTENTENCODING: while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) { switch ($sub_sub_subelement['id']) { case EBML_ID_CONTENTENCODINGORDER: case EBML_ID_CONTENTENCODINGSCOPE: case EBML_ID_CONTENTENCODINGTYPE: $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); break; case EBML_ID_CONTENTCOMPRESSION: while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { switch ($sub_sub_sub_subelement['id']) { case EBML_ID_CONTENTCOMPALGO: $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); break; case EBML_ID_CONTENTCOMPSETTINGS: $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; break; default: $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); break; } } break; case EBML_ID_CONTENTENCRYPTION: while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { switch ($sub_sub_sub_subelement['id']) { case EBML_ID_CONTENTENCALGO: case EBML_ID_CONTENTSIGALGO: case EBML_ID_CONTENTSIGHASHALGO: $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); break; case EBML_ID_CONTENTENCKEYID: case EBML_ID_CONTENTSIGNATURE: case EBML_ID_CONTENTSIGKEYID: $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; break; default: $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); break; } } break; default: $this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement); break; } } break; default: $this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement); break; } } break; default: $this->unhandledElement('track', __LINE__, $subelement); break; } } $info['matroska']['tracks']['tracks'][] = $track_entry; break; default: $this->unhandledElement('tracks', __LINE__, $track_entry); break; } } break; case EBML_ID_INFO: $info_entry = array(); while ($this->getEBMLelement($subelement, $element_data['end'], true)) { switch ($subelement['id']) { case EBML_ID_TIMECODESCALE: $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); break; case EBML_ID_DURATION: $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']); break; case EBML_ID_DATEUTC: $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); $info_entry[$subelement['id_name'].'_unix'] = self::EBMLdate2unix($info_entry[$subelement['id_name']]); break; case EBML_ID_SEGMENTUID: case EBML_ID_PREVUID: case EBML_ID_NEXTUID: $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); break; case EBML_ID_SEGMENTFAMILY: $info_entry[$subelement['id_name']][] = getid3_lib::trimNullByte($subelement['data']); break; case EBML_ID_SEGMENTFILENAME: case EBML_ID_PREVFILENAME: case EBML_ID_NEXTFILENAME: case EBML_ID_TITLE: case EBML_ID_MUXINGAPP: case EBML_ID_WRITINGAPP: $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); $info['matroska']['comments'][strtolower($subelement['id_name'])][] = $info_entry[$subelement['id_name']]; break; case EBML_ID_CHAPTERTRANSLATE: $chaptertranslate_entry = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { switch ($sub_subelement['id']) { case EBML_ID_CHAPTERTRANSLATEEDITIONUID: $chaptertranslate_entry[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_CHAPTERTRANSLATECODEC: $chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_CHAPTERTRANSLATEID: $chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); break; default: $this->unhandledElement('info.chaptertranslate', __LINE__, $sub_subelement); break; } } $info_entry[$subelement['id_name']] = $chaptertranslate_entry; break; default: $this->unhandledElement('info', __LINE__, $subelement); break; } } $info['matroska']['info'][] = $info_entry; break; case EBML_ID_CUES: if ($this->hide_clusters) { $this->current_offset = $element_data['end']; break; } $cues_entry = array(); while ($this->getEBMLelement($subelement, $element_data['end'])) { switch ($subelement['id']) { case EBML_ID_CUEPOINT: $cuepoint_entry = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CUETRACKPOSITIONS))) { switch ($sub_subelement['id']) { case EBML_ID_CUETRACKPOSITIONS: $cuetrackpositions_entry = array(); while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) { switch ($sub_sub_subelement['id']) { case EBML_ID_CUETRACK: case EBML_ID_CUECLUSTERPOSITION: case EBML_ID_CUEBLOCKNUMBER: case EBML_ID_CUECODECSTATE: $cuetrackpositions_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); break; default: $this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement); break; } } $cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry; break; case EBML_ID_CUETIME: $cuepoint_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; default: $this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement); break; } } $cues_entry[] = $cuepoint_entry; break; default: $this->unhandledElement('cues', __LINE__, $subelement); break; } } $info['matroska']['cues'] = $cues_entry; break; case EBML_ID_TAGS: $tags_entry = array(); while ($this->getEBMLelement($subelement, $element_data['end'], false)) { switch ($subelement['id']) { case EBML_ID_TAG: $tag_entry = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], false)) { switch ($sub_subelement['id']) { case EBML_ID_TARGETS: $targets_entry = array(); while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) { switch ($sub_sub_subelement['id']) { case EBML_ID_TARGETTYPEVALUE: $targets_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); $targets_entry[strtolower($sub_sub_subelement['id_name']).'_long'] = self::TargetTypeValue($targets_entry[$sub_sub_subelement['id_name']]); break; case EBML_ID_TARGETTYPE: $targets_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data']; break; case EBML_ID_TAGTRACKUID: case EBML_ID_TAGEDITIONUID: case EBML_ID_TAGCHAPTERUID: case EBML_ID_TAGATTACHMENTUID: $targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::PrintHexBytes($sub_sub_subelement['data'], true, false); break; default: $this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement); break; } } $tag_entry[$sub_subelement['id_name']] = $targets_entry; break; case EBML_ID_SIMPLETAG: $tag_entry[$sub_subelement['id_name']][] = $this->HandleEMBLSimpleTag($sub_subelement['end']); break; default: $this->unhandledElement('tags.tag', __LINE__, $sub_subelement); break; } } $tags_entry[] = $tag_entry; break; default: $this->unhandledElement('tags', __LINE__, $subelement); break; } } $info['matroska']['tags'] = $tags_entry; break; case EBML_ID_ATTACHMENTS: while ($this->getEBMLelement($subelement, $element_data['end'])) { switch ($subelement['id']) { case EBML_ID_ATTACHEDFILE: $attachedfile_entry = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_FILEDATA))) { switch ($sub_subelement['id']) { case EBML_ID_FILEDESCRIPTION: case EBML_ID_FILENAME: case EBML_ID_FILEMIMETYPE: $attachedfile_entry[$sub_subelement['id_name']] = $sub_subelement['data']; break; case EBML_ID_FILEDATA: $attachedfile_entry['data_offset'] = $this->current_offset; $attachedfile_entry['data_length'] = $sub_subelement['length']; $attachedfile_entry[$sub_subelement['id_name']] = $this->saveAttachment( $attachedfile_entry['FileName'], $attachedfile_entry['data_offset'], $attachedfile_entry['data_length']); $this->current_offset = $sub_subelement['end']; break; case EBML_ID_FILEUID: $attachedfile_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; default: $this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement); break; } } $info['matroska']['attachments'][] = $attachedfile_entry; break; default: $this->unhandledElement('attachments', __LINE__, $subelement); break; } } break; case EBML_ID_CHAPTERS: while ($this->getEBMLelement($subelement, $element_data['end'])) { switch ($subelement['id']) { case EBML_ID_EDITIONENTRY: $editionentry_entry = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CHAPTERATOM))) { switch ($sub_subelement['id']) { case EBML_ID_EDITIONUID: $editionentry_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_EDITIONFLAGHIDDEN: case EBML_ID_EDITIONFLAGDEFAULT: case EBML_ID_EDITIONFLAGORDERED: $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_CHAPTERATOM: $chapteratom_entry = array(); while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CHAPTERTRACK, EBML_ID_CHAPTERDISPLAY))) { switch ($sub_sub_subelement['id']) { case EBML_ID_CHAPTERSEGMENTUID: case EBML_ID_CHAPTERSEGMENTEDITIONUID: $chapteratom_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data']; break; case EBML_ID_CHAPTERFLAGENABLED: case EBML_ID_CHAPTERFLAGHIDDEN: $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']); break; case EBML_ID_CHAPTERUID: case EBML_ID_CHAPTERTIMESTART: case EBML_ID_CHAPTERTIMEEND: $chapteratom_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); break; case EBML_ID_CHAPTERTRACK: $chaptertrack_entry = array(); while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { switch ($sub_sub_sub_subelement['id']) { case EBML_ID_CHAPTERTRACKNUMBER: $chaptertrack_entry[$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); break; default: $this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement); break; } } $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry; break; case EBML_ID_CHAPTERDISPLAY: $chapterdisplay_entry = array(); while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { switch ($sub_sub_sub_subelement['id']) { case EBML_ID_CHAPSTRING: case EBML_ID_CHAPLANGUAGE: case EBML_ID_CHAPCOUNTRY: $chapterdisplay_entry[$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; break; default: $this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement); break; } } $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry; break; default: $this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement); break; } } $editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry; break; default: $this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement); break; } } $info['matroska']['chapters'][] = $editionentry_entry; break; default: $this->unhandledElement('chapters', __LINE__, $subelement); break; } } break; case EBML_ID_CLUSTER: $cluster_entry = array(); while ($this->getEBMLelement($subelement, $element_data['end'], array(EBML_ID_CLUSTERSILENTTRACKS, EBML_ID_CLUSTERBLOCKGROUP, EBML_ID_CLUSTERSIMPLEBLOCK))) { switch ($subelement['id']) { case EBML_ID_CLUSTERTIMECODE: case EBML_ID_CLUSTERPOSITION: case EBML_ID_CLUSTERPREVSIZE: $cluster_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); break; case EBML_ID_CLUSTERSILENTTRACKS: $cluster_silent_tracks = array(); while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { switch ($sub_subelement['id']) { case EBML_ID_CLUSTERSILENTTRACKNUMBER: $cluster_silent_tracks[] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; default: $this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement); break; } } $cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks; break; case EBML_ID_CLUSTERBLOCKGROUP: $cluster_block_group = array('offset' => $this->current_offset); while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CLUSTERBLOCK))) { switch ($sub_subelement['id']) { case EBML_ID_CLUSTERBLOCK: $cluster_block_group[$sub_subelement['id_name']] = $this->HandleEMBLClusterBlock($sub_subelement, EBML_ID_CLUSTERBLOCK, $info); break; case EBML_ID_CLUSTERREFERENCEPRIORITY: case EBML_ID_CLUSTERBLOCKDURATION: $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); break; case EBML_ID_CLUSTERREFERENCEBLOCK: $cluster_block_group[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data'], false, true); break; case EBML_ID_CLUSTERCODECSTATE: $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); break; default: $this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement); break; } } $cluster_entry[$subelement['id_name']][] = $cluster_block_group; break; case EBML_ID_CLUSTERSIMPLEBLOCK: $cluster_entry[$subelement['id_name']][] = $this->HandleEMBLClusterBlock($subelement, EBML_ID_CLUSTERSIMPLEBLOCK, $info); break; default: $this->unhandledElement('cluster', __LINE__, $subelement); break; } $this->current_offset = $subelement['end']; } if (!$this->hide_clusters) { $info['matroska']['cluster'][] = $cluster_entry; } if (!$this->parse_whole_file) { if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) { return; } } } } break; default: $this->unhandledElement('segment', __LINE__, $element_data); break; } } break; default: $this->unhandledElement('root', __LINE__, $top_element); break; } } } private function EnsureBufferHasEnoughData($min_data=1024) { if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) { $read_bytes = max($min_data, $this->getid3->fread_buffer_size()); try { $this->fseek($this->current_offset); $this->EBMLbuffer_offset = $this->current_offset; $this->EBMLbuffer = $this->fread($read_bytes); $this->EBMLbuffer_length = strlen($this->EBMLbuffer); } catch (getid3_exception $e) { $this->warning('EBML parser: '.$e->getMessage()); return false; } if ($this->EBMLbuffer_length == 0 && $this->feof()) { return $this->error('EBML parser: ran out of file at offset '.$this->current_offset); } } return true; } private function readEBMLint() { $actual_offset = $this->current_offset - $this->EBMLbuffer_offset; $first_byte_int = ord($this->EBMLbuffer[$actual_offset]); if (0x80 & $first_byte_int) { $length = 1; } elseif (0x40 & $first_byte_int) { $length = 2; } elseif (0x20 & $first_byte_int) { $length = 3; } elseif (0x10 & $first_byte_int) { $length = 4; } elseif (0x08 & $first_byte_int) { $length = 5; } elseif (0x04 & $first_byte_int) { $length = 6; } elseif (0x02 & $first_byte_int) { $length = 7; } elseif (0x01 & $first_byte_int) { $length = 8; } else { throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset); } $int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length)); $this->current_offset += $length; return $int_value; } private function readEBMLelementData($length, $check_buffer=false) { if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) { return false; } $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length); $this->current_offset += $length; return $data; } private function getEBMLelement(&$element, $parent_end, $get_data=false) { if ($this->current_offset >= $parent_end) { return false; } if (!$this->EnsureBufferHasEnoughData()) { $this->current_offset = PHP_INT_MAX; return false; } $element = array(); $element['offset'] = $this->current_offset; $element['id'] = $this->readEBMLint(); $element['id_name'] = self::EBMLidName($element['id']); $element['length'] = $this->readEBMLint(); $element['end'] = $this->current_offset + $element['length']; $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id'])); if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) { $element['data'] = $this->readEBMLelementData($element['length'], $element); } return true; } private function unhandledElement($type, $line, $element) { if (!in_array($element['id'], $this->unuseful_elements)) { $this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']); } if (!isset($element['data'])) { $this->current_offset = $element['end']; } } private function ExtractCommentsSimpleTag($SimpleTagArray) { if (!empty($SimpleTagArray['SimpleTag'])) { foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) { if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) { $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString']; } if (!empty($SimpleTagData['SimpleTag'])) { $this->ExtractCommentsSimpleTag($SimpleTagData); } } } return true; } private function HandleEMBLSimpleTag($parent_end) { $simpletag_entry = array(); while ($this->getEBMLelement($element, $parent_end, array(EBML_ID_SIMPLETAG))) { switch ($element['id']) { case EBML_ID_TAGNAME: case EBML_ID_TAGLANGUAGE: case EBML_ID_TAGSTRING: case EBML_ID_TAGBINARY: $simpletag_entry[$element['id_name']] = $element['data']; break; case EBML_ID_SIMPLETAG: $simpletag_entry[$element['id_name']][] = $this->HandleEMBLSimpleTag($element['end']); break; case EBML_ID_TAGDEFAULT: $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']); break; default: $this->unhandledElement('tag.simpletag', __LINE__, $element); break; } } return $simpletag_entry; } private function HandleEMBLClusterBlock($element, $block_type, &$info) { $block_data = array(); $block_data['tracknumber'] = $this->readEBMLint(); $block_data['timecode'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(2), false, true); $block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); } else { } $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); } else { } $block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']); if ($block_data['flags']['lacing'] > 0) { $block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; if ($block_data['flags']['lacing'] != 0x02) { for ($i = 1; $i < $block_data['lace_frames']; $i ++) { if ($block_data['flags']['lacing'] == 0x03) { $block_data['lace_frames_size'][$i] = $this->readEBMLint(); } else { $block_data['lace_frames_size'][$i] = 0; do { $size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); $block_data['lace_frames_size'][$i] += $size; } while ($size == 255); } } if ($block_data['flags']['lacing'] == 0x01) { $block_data['lace_frames_size'][] = $element['end'] - $this->current_offset - array_sum($block_data['lace_frames_size']); } } } if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset; $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset; } $this->current_offset = $element['end']; return $block_data; } private static function EBML2Int($EBMLstring) { $first_byte_int = ord($EBMLstring[0]); if (0x80 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x7F); } elseif (0x40 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x3F); } elseif (0x20 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x1F); } elseif (0x10 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x0F); } elseif (0x08 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x07); } elseif (0x04 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x03); } elseif (0x02 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x01); } elseif (0x01 & $first_byte_int) { $EBMLstring[0] = chr($first_byte_int & 0x00); } return getid3_lib::BigEndian2Int($EBMLstring); } private static function EBMLdate2unix($EBMLdatestamp) { return round(($EBMLdatestamp / 1000000000) + 978307200); } public static function TargetTypeValue($target_type) { static $TargetTypeValue = array(); if (empty($TargetTypeValue)) { $TargetTypeValue[10] = 'A: ~ V:shot'; $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; $TargetTypeValue[70] = 'A:collection ~ V:collection'; } return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type); } public static function BlockLacingType($lacingtype) { static $BlockLacingType = array(); if (empty($BlockLacingType)) { $BlockLacingType[0x00] = 'no lacing'; $BlockLacingType[0x01] = 'Xiph lacing'; $BlockLacingType[0x02] = 'fixed-size lacing'; $BlockLacingType[0x03] = 'EBML lacing'; } return (isset($BlockLacingType[$lacingtype]) ? $BlockLacingType[$lacingtype] : $lacingtype); } public static function CodecIDtoCommonName($codecid) { static $CodecIDlist = array(); if (empty($CodecIDlist)) { $CodecIDlist['A_AAC'] = 'aac'; $CodecIDlist['A_AAC/MPEG2/LC'] = 'aac'; $CodecIDlist['A_AC3'] = 'ac3'; $CodecIDlist['A_EAC3'] = 'eac3'; $CodecIDlist['A_DTS'] = 'dts'; $CodecIDlist['A_FLAC'] = 'flac'; $CodecIDlist['A_MPEG/L1'] = 'mp1'; $CodecIDlist['A_MPEG/L2'] = 'mp2'; $CodecIDlist['A_MPEG/L3'] = 'mp3'; $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; $CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; $CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; $CodecIDlist['A_VORBIS'] = 'vorbis'; $CodecIDlist['V_MPEG1'] = 'mpeg'; $CodecIDlist['V_THEORA'] = 'theora'; $CodecIDlist['V_REAL/RV40'] = 'real'; $CodecIDlist['V_REAL/RV10'] = 'real'; $CodecIDlist['V_REAL/RV20'] = 'real'; $CodecIDlist['V_REAL/RV30'] = 'real'; $CodecIDlist['V_QUICKTIME'] = 'quicktime'; $CodecIDlist['V_MPEG4/ISO/AP'] = 'mpeg4'; $CodecIDlist['V_MPEG4/ISO/ASP'] = 'mpeg4'; $CodecIDlist['V_MPEG4/ISO/AVC'] = 'h264'; $CodecIDlist['V_MPEG4/ISO/SP'] = 'mpeg4'; $CodecIDlist['V_VP8'] = 'vp8'; $CodecIDlist['V_MS/VFW/FOURCC'] = 'vcm'; $CodecIDlist['A_MS/ACM'] = 'acm'; } return (isset($CodecIDlist[$codecid]) ? $CodecIDlist[$codecid] : $codecid); } private static function EBMLidName($value) { static $EBMLidList = array(); if (empty($EBMLidList)) { $EBMLidList[EBML_ID_ASPECTRATIOTYPE] = 'AspectRatioType'; $EBMLidList[EBML_ID_ATTACHEDFILE] = 'AttachedFile'; $EBMLidList[EBML_ID_ATTACHMENTLINK] = 'AttachmentLink'; $EBMLidList[EBML_ID_ATTACHMENTS] = 'Attachments'; $EBMLidList[EBML_ID_AUDIO] = 'Audio'; $EBMLidList[EBML_ID_BITDEPTH] = 'BitDepth'; $EBMLidList[EBML_ID_CHANNELPOSITIONS] = 'ChannelPositions'; $EBMLidList[EBML_ID_CHANNELS] = 'Channels'; $EBMLidList[EBML_ID_CHAPCOUNTRY] = 'ChapCountry'; $EBMLidList[EBML_ID_CHAPLANGUAGE] = 'ChapLanguage'; $EBMLidList[EBML_ID_CHAPPROCESS] = 'ChapProcess'; $EBMLidList[EBML_ID_CHAPPROCESSCODECID] = 'ChapProcessCodecID'; $EBMLidList[EBML_ID_CHAPPROCESSCOMMAND] = 'ChapProcessCommand'; $EBMLidList[EBML_ID_CHAPPROCESSDATA] = 'ChapProcessData'; $EBMLidList[EBML_ID_CHAPPROCESSPRIVATE] = 'ChapProcessPrivate'; $EBMLidList[EBML_ID_CHAPPROCESSTIME] = 'ChapProcessTime'; $EBMLidList[EBML_ID_CHAPSTRING] = 'ChapString'; $EBMLidList[EBML_ID_CHAPTERATOM] = 'ChapterAtom'; $EBMLidList[EBML_ID_CHAPTERDISPLAY] = 'ChapterDisplay'; $EBMLidList[EBML_ID_CHAPTERFLAGENABLED] = 'ChapterFlagEnabled'; $EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN] = 'ChapterFlagHidden'; $EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV] = 'ChapterPhysicalEquiv'; $EBMLidList[EBML_ID_CHAPTERS] = 'Chapters'; $EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID] = 'ChapterSegmentEditionUID'; $EBMLidList[EBML_ID_CHAPTERSEGMENTUID] = 'ChapterSegmentUID'; $EBMLidList[EBML_ID_CHAPTERTIMEEND] = 'ChapterTimeEnd'; $EBMLidList[EBML_ID_CHAPTERTIMESTART] = 'ChapterTimeStart'; $EBMLidList[EBML_ID_CHAPTERTRACK] = 'ChapterTrack'; $EBMLidList[EBML_ID_CHAPTERTRACKNUMBER] = 'ChapterTrackNumber'; $EBMLidList[EBML_ID_CHAPTERTRANSLATE] = 'ChapterTranslate'; $EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC] = 'ChapterTranslateCodec'; $EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID'; $EBMLidList[EBML_ID_CHAPTERTRANSLATEID] = 'ChapterTranslateID'; $EBMLidList[EBML_ID_CHAPTERUID] = 'ChapterUID'; $EBMLidList[EBML_ID_CLUSTER] = 'Cluster'; $EBMLidList[EBML_ID_CLUSTERBLOCK] = 'ClusterBlock'; $EBMLidList[EBML_ID_CLUSTERBLOCKADDID] = 'ClusterBlockAddID'; $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL] = 'ClusterBlockAdditional'; $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID] = 'ClusterBlockAdditionID'; $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS] = 'ClusterBlockAdditions'; $EBMLidList[EBML_ID_CLUSTERBLOCKDURATION] = 'ClusterBlockDuration'; $EBMLidList[EBML_ID_CLUSTERBLOCKGROUP] = 'ClusterBlockGroup'; $EBMLidList[EBML_ID_CLUSTERBLOCKMORE] = 'ClusterBlockMore'; $EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL] = 'ClusterBlockVirtual'; $EBMLidList[EBML_ID_CLUSTERCODECSTATE] = 'ClusterCodecState'; $EBMLidList[EBML_ID_CLUSTERDELAY] = 'ClusterDelay'; $EBMLidList[EBML_ID_CLUSTERDURATION] = 'ClusterDuration'; $EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK] = 'ClusterEncryptedBlock'; $EBMLidList[EBML_ID_CLUSTERFRAMENUMBER] = 'ClusterFrameNumber'; $EBMLidList[EBML_ID_CLUSTERLACENUMBER] = 'ClusterLaceNumber'; $EBMLidList[EBML_ID_CLUSTERPOSITION] = 'ClusterPosition'; $EBMLidList[EBML_ID_CLUSTERPREVSIZE] = 'ClusterPrevSize'; $EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK] = 'ClusterReferenceBlock'; $EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY] = 'ClusterReferencePriority'; $EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL] = 'ClusterReferenceVirtual'; $EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER] = 'ClusterSilentTrackNumber'; $EBMLidList[EBML_ID_CLUSTERSILENTTRACKS] = 'ClusterSilentTracks'; $EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK] = 'ClusterSimpleBlock'; $EBMLidList[EBML_ID_CLUSTERTIMECODE] = 'ClusterTimecode'; $EBMLidList[EBML_ID_CLUSTERTIMESLICE] = 'ClusterTimeSlice'; $EBMLidList[EBML_ID_CODECDECODEALL] = 'CodecDecodeAll'; $EBMLidList[EBML_ID_CODECDOWNLOADURL] = 'CodecDownloadURL'; $EBMLidList[EBML_ID_CODECID] = 'CodecID'; $EBMLidList[EBML_ID_CODECINFOURL] = 'CodecInfoURL'; $EBMLidList[EBML_ID_CODECNAME] = 'CodecName'; $EBMLidList[EBML_ID_CODECPRIVATE] = 'CodecPrivate'; $EBMLidList[EBML_ID_CODECSETTINGS] = 'CodecSettings'; $EBMLidList[EBML_ID_COLOURSPACE] = 'ColourSpace'; $EBMLidList[EBML_ID_CONTENTCOMPALGO] = 'ContentCompAlgo'; $EBMLidList[EBML_ID_CONTENTCOMPRESSION] = 'ContentCompression'; $EBMLidList[EBML_ID_CONTENTCOMPSETTINGS] = 'ContentCompSettings'; $EBMLidList[EBML_ID_CONTENTENCALGO] = 'ContentEncAlgo'; $EBMLidList[EBML_ID_CONTENTENCKEYID] = 'ContentEncKeyID'; $EBMLidList[EBML_ID_CONTENTENCODING] = 'ContentEncoding'; $EBMLidList[EBML_ID_CONTENTENCODINGORDER] = 'ContentEncodingOrder'; $EBMLidList[EBML_ID_CONTENTENCODINGS] = 'ContentEncodings'; $EBMLidList[EBML_ID_CONTENTENCODINGSCOPE] = 'ContentEncodingScope'; $EBMLidList[EBML_ID_CONTENTENCODINGTYPE] = 'ContentEncodingType'; $EBMLidList[EBML_ID_CONTENTENCRYPTION] = 'ContentEncryption'; $EBMLidList[EBML_ID_CONTENTSIGALGO] = 'ContentSigAlgo'; $EBMLidList[EBML_ID_CONTENTSIGHASHALGO] = 'ContentSigHashAlgo'; $EBMLidList[EBML_ID_CONTENTSIGKEYID] = 'ContentSigKeyID'; $EBMLidList[EBML_ID_CONTENTSIGNATURE] = 'ContentSignature'; $EBMLidList[EBML_ID_CRC32] = 'CRC32'; $EBMLidList[EBML_ID_CUEBLOCKNUMBER] = 'CueBlockNumber'; $EBMLidList[EBML_ID_CUECLUSTERPOSITION] = 'CueClusterPosition'; $EBMLidList[EBML_ID_CUECODECSTATE] = 'CueCodecState'; $EBMLidList[EBML_ID_CUEPOINT] = 'CuePoint'; $EBMLidList[EBML_ID_CUEREFCLUSTER] = 'CueRefCluster'; $EBMLidList[EBML_ID_CUEREFCODECSTATE] = 'CueRefCodecState'; $EBMLidList[EBML_ID_CUEREFERENCE] = 'CueReference'; $EBMLidList[EBML_ID_CUEREFNUMBER] = 'CueRefNumber'; $EBMLidList[EBML_ID_CUEREFTIME] = 'CueRefTime'; $EBMLidList[EBML_ID_CUES] = 'Cues'; $EBMLidList[EBML_ID_CUETIME] = 'CueTime'; $EBMLidList[EBML_ID_CUETRACK] = 'CueTrack'; $EBMLidList[EBML_ID_CUETRACKPOSITIONS] = 'CueTrackPositions'; $EBMLidList[EBML_ID_DATEUTC] = 'DateUTC'; $EBMLidList[EBML_ID_DEFAULTDURATION] = 'DefaultDuration'; $EBMLidList[EBML_ID_DISPLAYHEIGHT] = 'DisplayHeight'; $EBMLidList[EBML_ID_DISPLAYUNIT] = 'DisplayUnit'; $EBMLidList[EBML_ID_DISPLAYWIDTH] = 'DisplayWidth'; $EBMLidList[EBML_ID_DOCTYPE] = 'DocType'; $EBMLidList[EBML_ID_DOCTYPEREADVERSION] = 'DocTypeReadVersion'; $EBMLidList[EBML_ID_DOCTYPEVERSION] = 'DocTypeVersion'; $EBMLidList[EBML_ID_DURATION] = 'Duration'; $EBMLidList[EBML_ID_EBML] = 'EBML'; $EBMLidList[EBML_ID_EBMLMAXIDLENGTH] = 'EBMLMaxIDLength'; $EBMLidList[EBML_ID_EBMLMAXSIZELENGTH] = 'EBMLMaxSizeLength'; $EBMLidList[EBML_ID_EBMLREADVERSION] = 'EBMLReadVersion'; $EBMLidList[EBML_ID_EBMLVERSION] = 'EBMLVersion'; $EBMLidList[EBML_ID_EDITIONENTRY] = 'EditionEntry'; $EBMLidList[EBML_ID_EDITIONFLAGDEFAULT] = 'EditionFlagDefault'; $EBMLidList[EBML_ID_EDITIONFLAGHIDDEN] = 'EditionFlagHidden'; $EBMLidList[EBML_ID_EDITIONFLAGORDERED] = 'EditionFlagOrdered'; $EBMLidList[EBML_ID_EDITIONUID] = 'EditionUID'; $EBMLidList[EBML_ID_FILEDATA] = 'FileData'; $EBMLidList[EBML_ID_FILEDESCRIPTION] = 'FileDescription'; $EBMLidList[EBML_ID_FILEMIMETYPE] = 'FileMimeType'; $EBMLidList[EBML_ID_FILENAME] = 'FileName'; $EBMLidList[EBML_ID_FILEREFERRAL] = 'FileReferral'; $EBMLidList[EBML_ID_FILEUID] = 'FileUID'; $EBMLidList[EBML_ID_FLAGDEFAULT] = 'FlagDefault'; $EBMLidList[EBML_ID_FLAGENABLED] = 'FlagEnabled'; $EBMLidList[EBML_ID_FLAGFORCED] = 'FlagForced'; $EBMLidList[EBML_ID_FLAGINTERLACED] = 'FlagInterlaced'; $EBMLidList[EBML_ID_FLAGLACING] = 'FlagLacing'; $EBMLidList[EBML_ID_GAMMAVALUE] = 'GammaValue'; $EBMLidList[EBML_ID_INFO] = 'Info'; $EBMLidList[EBML_ID_LANGUAGE] = 'Language'; $EBMLidList[EBML_ID_MAXBLOCKADDITIONID] = 'MaxBlockAdditionID'; $EBMLidList[EBML_ID_MAXCACHE] = 'MaxCache'; $EBMLidList[EBML_ID_MINCACHE] = 'MinCache'; $EBMLidList[EBML_ID_MUXINGAPP] = 'MuxingApp'; $EBMLidList[EBML_ID_NAME] = 'Name'; $EBMLidList[EBML_ID_NEXTFILENAME] = 'NextFilename'; $EBMLidList[EBML_ID_NEXTUID] = 'NextUID'; $EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY] = 'OutputSamplingFrequency'; $EBMLidList[EBML_ID_PIXELCROPBOTTOM] = 'PixelCropBottom'; $EBMLidList[EBML_ID_PIXELCROPLEFT] = 'PixelCropLeft'; $EBMLidList[EBML_ID_PIXELCROPRIGHT] = 'PixelCropRight'; $EBMLidList[EBML_ID_PIXELCROPTOP] = 'PixelCropTop'; $EBMLidList[EBML_ID_PIXELHEIGHT] = 'PixelHeight'; $EBMLidList[EBML_ID_PIXELWIDTH] = 'PixelWidth'; $EBMLidList[EBML_ID_PREVFILENAME] = 'PrevFilename'; $EBMLidList[EBML_ID_PREVUID] = 'PrevUID'; $EBMLidList[EBML_ID_SAMPLINGFREQUENCY] = 'SamplingFrequency'; $EBMLidList[EBML_ID_SEEK] = 'Seek'; $EBMLidList[EBML_ID_SEEKHEAD] = 'SeekHead'; $EBMLidList[EBML_ID_SEEKID] = 'SeekID'; $EBMLidList[EBML_ID_SEEKPOSITION] = 'SeekPosition'; $EBMLidList[EBML_ID_SEGMENT] = 'Segment'; $EBMLidList[EBML_ID_SEGMENTFAMILY] = 'SegmentFamily'; $EBMLidList[EBML_ID_SEGMENTFILENAME] = 'SegmentFilename'; $EBMLidList[EBML_ID_SEGMENTUID] = 'SegmentUID'; $EBMLidList[EBML_ID_SIMPLETAG] = 'SimpleTag'; $EBMLidList[EBML_ID_CLUSTERSLICES] = 'ClusterSlices'; $EBMLidList[EBML_ID_STEREOMODE] = 'StereoMode'; $EBMLidList[EBML_ID_OLDSTEREOMODE] = 'OldStereoMode'; $EBMLidList[EBML_ID_TAG] = 'Tag'; $EBMLidList[EBML_ID_TAGATTACHMENTUID] = 'TagAttachmentUID'; $EBMLidList[EBML_ID_TAGBINARY] = 'TagBinary'; $EBMLidList[EBML_ID_TAGCHAPTERUID] = 'TagChapterUID'; $EBMLidList[EBML_ID_TAGDEFAULT] = 'TagDefault'; $EBMLidList[EBML_ID_TAGEDITIONUID] = 'TagEditionUID'; $EBMLidList[EBML_ID_TAGLANGUAGE] = 'TagLanguage'; $EBMLidList[EBML_ID_TAGNAME] = 'TagName'; $EBMLidList[EBML_ID_TAGTRACKUID] = 'TagTrackUID'; $EBMLidList[EBML_ID_TAGS] = 'Tags'; $EBMLidList[EBML_ID_TAGSTRING] = 'TagString'; $EBMLidList[EBML_ID_TARGETS] = 'Targets'; $EBMLidList[EBML_ID_TARGETTYPE] = 'TargetType'; $EBMLidList[EBML_ID_TARGETTYPEVALUE] = 'TargetTypeValue'; $EBMLidList[EBML_ID_TIMECODESCALE] = 'TimecodeScale'; $EBMLidList[EBML_ID_TITLE] = 'Title'; $EBMLidList[EBML_ID_TRACKENTRY] = 'TrackEntry'; $EBMLidList[EBML_ID_TRACKNUMBER] = 'TrackNumber'; $EBMLidList[EBML_ID_TRACKOFFSET] = 'TrackOffset'; $EBMLidList[EBML_ID_TRACKOVERLAY] = 'TrackOverlay'; $EBMLidList[EBML_ID_TRACKS] = 'Tracks'; $EBMLidList[EBML_ID_TRACKTIMECODESCALE] = 'TrackTimecodeScale'; $EBMLidList[EBML_ID_TRACKTRANSLATE] = 'TrackTranslate'; $EBMLidList[EBML_ID_TRACKTRANSLATECODEC] = 'TrackTranslateCodec'; $EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID] = 'TrackTranslateEditionUID'; $EBMLidList[EBML_ID_TRACKTRANSLATETRACKID] = 'TrackTranslateTrackID'; $EBMLidList[EBML_ID_TRACKTYPE] = 'TrackType'; $EBMLidList[EBML_ID_TRACKUID] = 'TrackUID'; $EBMLidList[EBML_ID_VIDEO] = 'Video'; $EBMLidList[EBML_ID_VOID] = 'Void'; $EBMLidList[EBML_ID_WRITINGAPP] = 'WritingApp'; } return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value)); } public static function displayUnit($value) { static $units = array( 0 => 'pixels', 1 => 'centimeters', 2 => 'inches', 3 => 'Display Aspect Ratio'); return (isset($units[$value]) ? $units[$value] : 'unknown'); } private static function getDefaultStreamInfo($streams) { $stream = array(); foreach (array_reverse($streams) as $stream) { if ($stream['default']) { break; } } $unset = array('default', 'name'); foreach ($unset as $u) { if (isset($stream[$u])) { unset($stream[$u]); } } $info = $stream; $info['streams'] = $streams; return $info; } } getid3->info; $info['ac3']['raw']['bsi'] = array(); $thisfile_ac3 = &$info['ac3']; $thisfile_ac3_raw = &$thisfile_ac3['raw']; $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw['bsi']; $info['fileformat'] = 'ac3'; $this->fseek($info['avdataoffset']); $tempAC3header = $this->fread(100); $this->AC3header['syncinfo'] = getid3_lib::BigEndian2Int(substr($tempAC3header, 0, 2)); $this->AC3header['bsi'] = getid3_lib::BigEndian2Bin(substr($tempAC3header, 2)); $thisfile_ac3_raw_bsi['bsid'] = (getid3_lib::LittleEndian2Int(substr($tempAC3header, 5, 1)) & 0xF8) >> 3; unset($tempAC3header); if ($this->AC3header['syncinfo'] !== self::syncword) { if (!$this->isDependencyFor('matroska')) { unset($info['fileformat'], $info['ac3']); return $this->error('Expecting "'.dechex(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.dechex($this->AC3header['syncinfo']).'"'); } } $info['audio']['dataformat'] = 'ac3'; $info['audio']['bitrate_mode'] = 'cbr'; $info['audio']['lossless'] = false; if ($thisfile_ac3_raw_bsi['bsid'] <= 8) { $thisfile_ac3_raw_bsi['crc1'] = getid3_lib::Bin2Dec($this->readHeaderBSI(16)); $thisfile_ac3_raw_bsi['fscod'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['frmsizecod'] = $this->readHeaderBSI(6); if ($thisfile_ac3_raw_bsi['frmsizecod'] > 37) { $this->warning('Unexpected ac3.bsi.frmsizecod value: '.$thisfile_ac3_raw_bsi['frmsizecod'].', bitrate not set correctly'); } $thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3); if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) { $thisfile_ac3_raw_bsi['cmixlev'] = $this->readHeaderBSI(2); $thisfile_ac3['center_mix_level'] = self::centerMixLevelLookup($thisfile_ac3_raw_bsi['cmixlev']); } if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) { $thisfile_ac3_raw_bsi['surmixlev'] = $this->readHeaderBSI(2); $thisfile_ac3['surround_mix_level'] = self::surroundMixLevelLookup($thisfile_ac3_raw_bsi['surmixlev']); } if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) { $thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2); $thisfile_ac3['dolby_surround_mode'] = self::dolbySurroundModeLookup($thisfile_ac3_raw_bsi['dsurmod']); } $thisfile_ac3_raw_bsi['flags']['lfeon'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['flags']['compr'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['compr']) { $thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8); $thisfile_ac3['heavy_compression'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr']); } $thisfile_ac3_raw_bsi['flags']['langcod'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['langcod']) { $thisfile_ac3_raw_bsi['langcod'] = $this->readHeaderBSI(8); } $thisfile_ac3_raw_bsi['flags']['audprodinfo'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['audprodinfo']) { $thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['roomtyp'] = $this->readHeaderBSI(2); $thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB'; $thisfile_ac3['room_type'] = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp']); } $thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5); $thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB'; $thisfile_ac3_raw_bsi['flags']['compr2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['compr2']) { $thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8); $thisfile_ac3['heavy_compression2'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr2']); } $thisfile_ac3_raw_bsi['flags']['langcod2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['langcod2']) { $thisfile_ac3_raw_bsi['langcod2'] = $this->readHeaderBSI(8); } $thisfile_ac3_raw_bsi['flags']['audprodinfo2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['audprodinfo2']) { $thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['roomtyp2'] = $this->readHeaderBSI(2); $thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB'; $thisfile_ac3['room_type2'] = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp2']); } $thisfile_ac3_raw_bsi['copyright'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['original'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['flags']['timecod1'] = $this->readHeaderBSI(2); if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x01) { $thisfile_ac3_raw_bsi['timecod1'] = $this->readHeaderBSI(14); $thisfile_ac3['timecode1'] = 0; $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x3E00) >> 9) * 3600; $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x01F8) >> 3) * 60; $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x0003) >> 0) * 8; } if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x02) { $thisfile_ac3_raw_bsi['timecod2'] = $this->readHeaderBSI(14); $thisfile_ac3['timecode2'] = 0; $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x3800) >> 11) * 1; $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x07C0) >> 6) * (1 / 30); $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x003F) >> 0) * ((1 / 30) / 60); } $thisfile_ac3_raw_bsi['flags']['addbsi'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['addbsi']) { $thisfile_ac3_raw_bsi['addbsi_length'] = $this->readHeaderBSI(6) + 1; $this->AC3header['bsi'] .= getid3_lib::BigEndian2Bin($this->fread($thisfile_ac3_raw_bsi['addbsi_length'])); $thisfile_ac3_raw_bsi['addbsi_data'] = substr($this->AC3header['bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8); $this->BSIoffset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8; } } elseif ($thisfile_ac3_raw_bsi['bsid'] <= 16) { $this->error('E-AC3 parsing is incomplete and experimental in this version of getID3 ('.$this->getid3->version().'). Notably the bitrate calculations are wrong -- value might (or not) be correct, but it is not calculated correctly. Email info@getid3.org if you know how to calculate EAC3 bitrate correctly.'); $info['audio']['dataformat'] = 'eac3'; $thisfile_ac3_raw_bsi['strmtyp'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['substreamid'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['frmsiz'] = $this->readHeaderBSI(11); $thisfile_ac3_raw_bsi['fscod'] = $this->readHeaderBSI(2); if ($thisfile_ac3_raw_bsi['fscod'] == 3) { $thisfile_ac3_raw_bsi['fscod2'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['numblkscod'] = 3; } else { $thisfile_ac3_raw_bsi['numblkscod'] = $this->readHeaderBSI(2); } $thisfile_ac3['bsi']['blocks_per_sync_frame'] = self::blocksPerSyncFrame($thisfile_ac3_raw_bsi['numblkscod']); $thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['flags']['lfeon'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['flags']['compr'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['compr']) { $thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8); } if ($thisfile_ac3_raw_bsi['acmod'] == 0) { $thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['flags']['compr2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['compr2']) { $thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8); } } if ($thisfile_ac3_raw_bsi['strmtyp'] == 1) { $thisfile_ac3_raw_bsi['flags']['chanmap'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['chanmap']) { $thisfile_ac3_raw_bsi['chanmap'] = $this->readHeaderBSI(8); } } $thisfile_ac3_raw_bsi['flags']['mixmdat'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['mixmdat']) { if ($thisfile_ac3_raw_bsi['acmod'] > 2) { $thisfile_ac3_raw_bsi['dmixmod'] = $this->readHeaderBSI(2); } if (($thisfile_ac3_raw_bsi['acmod'] & 0x01) && ($thisfile_ac3_raw_bsi['acmod'] > 2)) { $thisfile_ac3_raw_bsi['ltrtcmixlev'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['lorocmixlev'] = $this->readHeaderBSI(3); } if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) { $thisfile_ac3_raw_bsi['ltrtsurmixlev'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['lorosurmixlev'] = $this->readHeaderBSI(3); } if ($thisfile_ac3_raw_bsi['flags']['lfeon']) { $thisfile_ac3_raw_bsi['flags']['lfemixlevcod'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['lfemixlevcod']) { $thisfile_ac3_raw_bsi['lfemixlevcod'] = $this->readHeaderBSI(5); } } if ($thisfile_ac3_raw_bsi['strmtyp'] == 0) { $thisfile_ac3_raw_bsi['flags']['pgmscl'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['pgmscl']) { $thisfile_ac3_raw_bsi['pgmscl'] = $this->readHeaderBSI(6); } if ($thisfile_ac3_raw_bsi['acmod'] == 0) { $thisfile_ac3_raw_bsi['flags']['pgmscl2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['pgmscl2']) { $thisfile_ac3_raw_bsi['pgmscl2'] = $this->readHeaderBSI(6); } } $thisfile_ac3_raw_bsi['flags']['extpgmscl'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['extpgmscl']) { $thisfile_ac3_raw_bsi['extpgmscl'] = $this->readHeaderBSI(6); } $thisfile_ac3_raw_bsi['mixdef'] = $this->readHeaderBSI(2); if ($thisfile_ac3_raw_bsi['mixdef'] == 1) { $thisfile_ac3_raw_bsi['premixcmpsel'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['drcsrc'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['premixcmpscl'] = $this->readHeaderBSI(3); } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 2) { $thisfile_ac3_raw_bsi['mixdata'] = $this->readHeaderBSI(12); } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 3) { $mixdefbitsread = 0; $thisfile_ac3_raw_bsi['mixdeflen'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; $thisfile_ac3_raw_bsi['flags']['mixdata2'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['mixdata2']) { $thisfile_ac3_raw_bsi['premixcmpsel'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; $thisfile_ac3_raw_bsi['drcsrc'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; $thisfile_ac3_raw_bsi['premixcmpscl'] = $this->readHeaderBSI(3); $mixdefbitsread += 3; $thisfile_ac3_raw_bsi['flags']['extpgmlscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmlscl']) { $thisfile_ac3_raw_bsi['extpgmlscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['extpgmcscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmcscl']) { $thisfile_ac3_raw_bsi['extpgmcscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['extpgmrscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmrscl']) { $thisfile_ac3_raw_bsi['extpgmrscl'] = $this->readHeaderBSI(4); } $thisfile_ac3_raw_bsi['flags']['extpgmlsscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmlsscl']) { $thisfile_ac3_raw_bsi['extpgmlsscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['extpgmrsscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmrsscl']) { $thisfile_ac3_raw_bsi['extpgmrsscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['extpgmlfescl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmlfescl']) { $thisfile_ac3_raw_bsi['extpgmlfescl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['dmixscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['dmixscl']) { $thisfile_ac3_raw_bsi['dmixscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['addch'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['addch']) { $thisfile_ac3_raw_bsi['flags']['extpgmaux1scl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmaux1scl']) { $thisfile_ac3_raw_bsi['extpgmaux1scl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } $thisfile_ac3_raw_bsi['flags']['extpgmaux2scl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['extpgmaux2scl']) { $thisfile_ac3_raw_bsi['extpgmaux2scl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; } } } $thisfile_ac3_raw_bsi['flags']['mixdata3'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['mixdata3']) { $thisfile_ac3_raw_bsi['spchdat'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; $thisfile_ac3_raw_bsi['flags']['addspchdat'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['addspchdat']) { $thisfile_ac3_raw_bsi['spchdat1'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; $thisfile_ac3_raw_bsi['spchan1att'] = $this->readHeaderBSI(2); $mixdefbitsread += 2; $thisfile_ac3_raw_bsi['flags']['addspchdat1'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; if ($thisfile_ac3_raw_bsi['flags']['addspchdat1']) { $thisfile_ac3_raw_bsi['spchdat2'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; $thisfile_ac3_raw_bsi['spchan2att'] = $this->readHeaderBSI(3); $mixdefbitsread += 3; } } } $mixdata_bits = (8 * ($thisfile_ac3_raw_bsi['mixdeflen'] + 2)) - $mixdefbitsread; $mixdata_fill = (($mixdata_bits % 8) ? 8 - ($mixdata_bits % 8) : 0); $thisfile_ac3_raw_bsi['mixdata'] = $this->readHeaderBSI($mixdata_bits); $thisfile_ac3_raw_bsi['mixdatafill'] = $this->readHeaderBSI($mixdata_fill); unset($mixdefbitsread, $mixdata_bits, $mixdata_fill); } if ($thisfile_ac3_raw_bsi['acmod'] < 2) { $thisfile_ac3_raw_bsi['flags']['paninfo'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['paninfo']) { $thisfile_ac3_raw_bsi['panmean'] = $this->readHeaderBSI(8); $thisfile_ac3_raw_bsi['paninfo'] = $this->readHeaderBSI(6); } if ($thisfile_ac3_raw_bsi['acmod'] == 0) { $thisfile_ac3_raw_bsi['flags']['paninfo2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['paninfo2']) { $thisfile_ac3_raw_bsi['panmean2'] = $this->readHeaderBSI(8); $thisfile_ac3_raw_bsi['paninfo2'] = $this->readHeaderBSI(6); } } } $thisfile_ac3_raw_bsi['flags']['frmmixcfginfo'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['frmmixcfginfo']) { if ($thisfile_ac3_raw_bsi['numblkscod'] == 0) { $thisfile_ac3_raw_bsi['blkmixcfginfo'][0] = $this->readHeaderBSI(5); } else { for ($blk = 0; $blk < $thisfile_ac3_raw_bsi['numblkscod']; $blk++) { $thisfile_ac3_raw_bsi['flags']['blkmixcfginfo'.$blk] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['blkmixcfginfo'.$blk]) { $thisfile_ac3_raw_bsi['blkmixcfginfo'][$blk] = $this->readHeaderBSI(5); } } } } } } $thisfile_ac3_raw_bsi['flags']['infomdat'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['infomdat']) { $thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3); $thisfile_ac3_raw_bsi['flags']['copyrightb'] = (bool) $this->readHeaderBSI(1); $thisfile_ac3_raw_bsi['flags']['origbs'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['acmod'] == 2) { $thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['dheadphonmod'] = $this->readHeaderBSI(2); } if ($thisfile_ac3_raw_bsi['acmod'] >= 6) { $thisfile_ac3_raw_bsi['dsurexmod'] = $this->readHeaderBSI(2); } $thisfile_ac3_raw_bsi['flags']['audprodi'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['audprodi']) { $thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['roomtyp'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['flags']['adconvtyp'] = (bool) $this->readHeaderBSI(1); } if ($thisfile_ac3_raw_bsi['acmod'] == 0) { $thisfile_ac3_raw_bsi['flags']['audprodi2'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['audprodi2']) { $thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5); $thisfile_ac3_raw_bsi['roomtyp2'] = $this->readHeaderBSI(2); $thisfile_ac3_raw_bsi['flags']['adconvtyp2'] = (bool) $this->readHeaderBSI(1); } } if ($thisfile_ac3_raw_bsi['fscod'] < 3) { $thisfile_ac3_raw_bsi['flags']['sourcefscod'] = (bool) $this->readHeaderBSI(1); } } if (($thisfile_ac3_raw_bsi['strmtyp'] == 0) && ($thisfile_ac3_raw_bsi['numblkscod'] != 3)) { $thisfile_ac3_raw_bsi['flags']['convsync'] = (bool) $this->readHeaderBSI(1); } if ($thisfile_ac3_raw_bsi['strmtyp'] == 2) { if ($thisfile_ac3_raw_bsi['numblkscod'] != 3) { $thisfile_ac3_raw_bsi['flags']['blkid'] = 1; } else { $thisfile_ac3_raw_bsi['flags']['blkid'] = (bool) $this->readHeaderBSI(1); } if ($thisfile_ac3_raw_bsi['flags']['blkid']) { $thisfile_ac3_raw_bsi['frmsizecod'] = $this->readHeaderBSI(6); } } $thisfile_ac3_raw_bsi['flags']['addbsi'] = (bool) $this->readHeaderBSI(1); if ($thisfile_ac3_raw_bsi['flags']['addbsi']) { $thisfile_ac3_raw_bsi['addbsil'] = $this->readHeaderBSI(6); $thisfile_ac3_raw_bsi['addbsi'] = $this->readHeaderBSI(($thisfile_ac3_raw_bsi['addbsil'] + 1) * 8); } } else { $this->error('Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 16. Please submit a support ticket with a sample file.'); unset($info['ac3']); return false; } if (isset($thisfile_ac3_raw_bsi['fscod2'])) { $thisfile_ac3['sample_rate'] = self::sampleRateCodeLookup2($thisfile_ac3_raw_bsi['fscod2']); } else { $thisfile_ac3['sample_rate'] = self::sampleRateCodeLookup($thisfile_ac3_raw_bsi['fscod']); } if ($thisfile_ac3_raw_bsi['fscod'] <= 3) { $info['audio']['sample_rate'] = $thisfile_ac3['sample_rate']; } else { $this->warning('Unexpected ac3.bsi.fscod value: '.$thisfile_ac3_raw_bsi['fscod']); } if (isset($thisfile_ac3_raw_bsi['frmsizecod'])) { $thisfile_ac3['frame_length'] = self::frameSizeLookup($thisfile_ac3_raw_bsi['frmsizecod'], $thisfile_ac3_raw_bsi['fscod']); $thisfile_ac3['bitrate'] = self::bitrateLookup($thisfile_ac3_raw_bsi['frmsizecod']); } elseif (!empty($thisfile_ac3_raw_bsi['frmsiz'])) { $thisfile_ac3['bitrate'] = ($thisfile_ac3_raw_bsi['frmsiz'] + 1) * 16 * 30; $thisfile_ac3['bitrate'] = round(($thisfile_ac3['bitrate'] * 1.05) / 16000) * 16000; } $info['audio']['bitrate'] = $thisfile_ac3['bitrate']; if (isset($thisfile_ac3_raw_bsi['bsmod']) && isset($thisfile_ac3_raw_bsi['acmod'])) { $thisfile_ac3['service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']); } $ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']); foreach($ac3_coding_mode as $key => $value) { $thisfile_ac3[$key] = $value; } switch ($thisfile_ac3_raw_bsi['acmod']) { case 0: case 1: $info['audio']['channelmode'] = 'mono'; break; case 3: case 4: $info['audio']['channelmode'] = 'stereo'; break; default: $info['audio']['channelmode'] = 'surround'; break; } $info['audio']['channels'] = $thisfile_ac3['num_channels']; $thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['flags']['lfeon']; if ($thisfile_ac3_raw_bsi['flags']['lfeon']) { $info['audio']['channels'] .= '.1'; } $thisfile_ac3['channels_enabled'] = self::channelsEnabledLookup($thisfile_ac3_raw_bsi['acmod'], $thisfile_ac3_raw_bsi['flags']['lfeon']); $thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB'; return true; } private function readHeaderBSI($length) { $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length); $this->BSIoffset += $length; return bindec($data); } public static function sampleRateCodeLookup($fscod) { static $sampleRateCodeLookup = array( 0 => 48000, 1 => 44100, 2 => 32000, 3 => 'reserved' ); return (isset($sampleRateCodeLookup[$fscod]) ? $sampleRateCodeLookup[$fscod] : false); } public static function sampleRateCodeLookup2($fscod2) { static $sampleRateCodeLookup2 = array( 0 => 24000, 1 => 22050, 2 => 16000, 3 => 'reserved' ); return (isset($sampleRateCodeLookup2[$fscod2]) ? $sampleRateCodeLookup2[$fscod2] : false); } public static function serviceTypeLookup($bsmod, $acmod) { static $serviceTypeLookup = array(); if (empty($serviceTypeLookup)) { for ($i = 0; $i <= 7; $i++) { $serviceTypeLookup[0][$i] = 'main audio service: complete main (CM)'; $serviceTypeLookup[1][$i] = 'main audio service: music and effects (ME)'; $serviceTypeLookup[2][$i] = 'associated service: visually impaired (VI)'; $serviceTypeLookup[3][$i] = 'associated service: hearing impaired (HI)'; $serviceTypeLookup[4][$i] = 'associated service: dialogue (D)'; $serviceTypeLookup[5][$i] = 'associated service: commentary (C)'; $serviceTypeLookup[6][$i] = 'associated service: emergency (E)'; } $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; for ($i = 2; $i <= 7; $i++) { $serviceTypeLookup[7][$i] = 'main audio service: karaoke'; } } return (isset($serviceTypeLookup[$bsmod][$acmod]) ? $serviceTypeLookup[$bsmod][$acmod] : false); } public static function audioCodingModeLookup($acmod) { static $audioCodingModeLookup = array ( 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'), 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'), 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'), 3 => array('channel_config'=>'3/0', 'num_channels'=>3, 'channel_order'=>'L,C,R'), 4 => array('channel_config'=>'2/1', 'num_channels'=>3, 'channel_order'=>'L,R,S'), 5 => array('channel_config'=>'3/1', 'num_channels'=>4, 'channel_order'=>'L,C,R,S'), 6 => array('channel_config'=>'2/2', 'num_channels'=>4, 'channel_order'=>'L,R,SL,SR'), 7 => array('channel_config'=>'3/2', 'num_channels'=>5, 'channel_order'=>'L,C,R,SL,SR'), ); return (isset($audioCodingModeLookup[$acmod]) ? $audioCodingModeLookup[$acmod] : false); } public static function centerMixLevelLookup($cmixlev) { static $centerMixLevelLookup; if (empty($centerMixLevelLookup)) { $centerMixLevelLookup = array( 0 => pow(2, -3.0 / 6), 1 => pow(2, -4.5 / 6), 2 => pow(2, -6.0 / 6), 3 => 'reserved' ); } return (isset($centerMixLevelLookup[$cmixlev]) ? $centerMixLevelLookup[$cmixlev] : false); } public static function surroundMixLevelLookup($surmixlev) { static $surroundMixLevelLookup; if (empty($surroundMixLevelLookup)) { $surroundMixLevelLookup = array( 0 => pow(2, -3.0 / 6), 1 => pow(2, -6.0 / 6), 2 => 0, 3 => 'reserved' ); } return (isset($surroundMixLevelLookup[$surmixlev]) ? $surroundMixLevelLookup[$surmixlev] : false); } public static function dolbySurroundModeLookup($dsurmod) { static $dolbySurroundModeLookup = array( 0 => 'not indicated', 1 => 'Not Dolby Surround encoded', 2 => 'Dolby Surround encoded', 3 => 'reserved' ); return (isset($dolbySurroundModeLookup[$dsurmod]) ? $dolbySurroundModeLookup[$dsurmod] : false); } public static function channelsEnabledLookup($acmod, $lfeon) { $lookup = array( 'ch1'=>($acmod == 0), 'ch2'=>($acmod == 0), 'left'=>($acmod > 1), 'right'=>($acmod > 1), 'center'=>(bool) ($acmod & 0x01), 'surround_mono'=>false, 'surround_left'=>false, 'surround_right'=>false, 'lfe'=>$lfeon); switch ($acmod) { case 4: case 5: $lookup['surround_mono'] = true; break; case 6: case 7: $lookup['surround_left'] = true; $lookup['surround_right'] = true; break; } return $lookup; } public static function heavyCompression($compre) { $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT); if ($fourbit[0] == '1') { $log_gain = -8 + bindec(substr($fourbit, 1)); } else { $log_gain = bindec(substr($fourbit, 1)); } $log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2); $lin_gain = (16 + ($compre & 0x0F)) / 32; return $log_gain - $lin_gain; } public static function roomTypeLookup($roomtyp) { static $roomTypeLookup = array( 0 => 'not indicated', 1 => 'large room, X curve monitor', 2 => 'small room, flat monitor', 3 => 'reserved' ); return (isset($roomTypeLookup[$roomtyp]) ? $roomTypeLookup[$roomtyp] : false); } public static function frameSizeLookup($frmsizecod, $fscod) { $padding = (bool) ($frmsizecod & 0x01); $framesizeid = ($frmsizecod & 0x3E) >> 1; static $frameSizeLookup = array(); if (empty($frameSizeLookup)) { $frameSizeLookup = array ( 0 => array( 128, 138, 192), 1 => array( 160, 174, 240), 2 => array( 192, 208, 288), 3 => array( 224, 242, 336), 4 => array( 256, 278, 384), 5 => array( 320, 348, 480), 6 => array( 384, 416, 576), 7 => array( 448, 486, 672), 8 => array( 512, 556, 768), 9 => array( 640, 696, 960), 10 => array( 768, 834, 1152), 11 => array( 896, 974, 1344), 12 => array(1024, 1114, 1536), 13 => array(1280, 1392, 1920), 14 => array(1536, 1670, 2304), 15 => array(1792, 1950, 2688), 16 => array(2048, 2228, 3072), 17 => array(2304, 2506, 3456), 18 => array(2560, 2786, 3840) ); } $paddingBytes = 0; if (($fscod == 1) && $padding) { $paddingBytes = 2; } return (isset($frameSizeLookup[$framesizeid][$fscod]) ? $frameSizeLookup[$framesizeid][$fscod] + $paddingBytes : false); } public static function bitrateLookup($frmsizecod) { $padding = (bool) ($frmsizecod & 0x01); $framesizeid = ($frmsizecod & 0x3E) >> 1; static $bitrateLookup = array( 0 => 32000, 1 => 40000, 2 => 48000, 3 => 56000, 4 => 64000, 5 => 80000, 6 => 96000, 7 => 112000, 8 => 128000, 9 => 160000, 10 => 192000, 11 => 224000, 12 => 256000, 13 => 320000, 14 => 384000, 15 => 448000, 16 => 512000, 17 => 576000, 18 => 640000, ); return (isset($bitrateLookup[$framesizeid]) ? $bitrateLookup[$framesizeid] : false); } public static function blocksPerSyncFrame($numblkscod) { static $blocksPerSyncFrameLookup = array( 0 => 1, 1 => 2, 2 => 3, 3 => 6, ); return (isset($blocksPerSyncFrameLookup[$numblkscod]) ? $blocksPerSyncFrameLookup[$numblkscod] : false); } } = 1) { $truncatednumber = floor($floatnumber); } elseif ($floatnumber <= -1) { $truncatednumber = ceil($floatnumber); } else { $truncatednumber = 0; } if (self::intValueSupported($truncatednumber)) { $truncatednumber = (int) $truncatednumber; } return $truncatednumber; } public static function safe_inc(&$variable, $increment=1) { if (isset($variable)) { $variable += $increment; } else { $variable = $increment; } return true; } public static function CastAsInt($floatnum) { $floatnum = (float) $floatnum; if (self::trunc($floatnum) == $floatnum) { if (self::intValueSupported($floatnum)) { $floatnum = (int) $floatnum; } } return $floatnum; } public static function intValueSupported($num) { static $hasINT64 = null; if ($hasINT64 === null) { $hasINT64 = is_int(pow(2, 31)); if (!$hasINT64 && !defined('PHP_INT_MIN')) { define('PHP_INT_MIN', ~PHP_INT_MAX); } } if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) { return true; } return false; } public static function DecimalizeFraction($fraction) { list($numerator, $denominator) = explode('/', $fraction); return $numerator / ($denominator ? $denominator : 1); } public static function DecimalBinary2Float($binarynumerator) { $numerator = self::Bin2Dec($binarynumerator); $denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); return ($numerator / $denominator); } public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { if (strpos($binarypointnumber, '.') === false) { $binarypointnumber = '0.'.$binarypointnumber; } elseif ($binarypointnumber[0] == '.') { $binarypointnumber = '0'.$binarypointnumber; } $exponent = 0; while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) { if (substr($binarypointnumber, 1, 1) == '.') { $exponent--; $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); } else { $pointpos = strpos($binarypointnumber, '.'); $exponent += ($pointpos - 1); $binarypointnumber = str_replace('.', '', $binarypointnumber); $binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1); } } $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent); } public static function Float2BinaryDecimal($floatvalue) { $maxbits = 128; $intpart = self::trunc($floatvalue); $floatpart = abs($floatvalue - $intpart); $pointbitstring = ''; while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) { $floatpart *= 2; $pointbitstring .= (string) self::trunc($floatpart); $floatpart -= self::trunc($floatpart); } $binarypointnumber = decbin($intpart).'.'.$pointbitstring; return $binarypointnumber; } public static function Float2String($floatvalue, $bits) { $exponentbits = 0; $fractionbits = 0; switch ($bits) { case 32: $exponentbits = 8; $fractionbits = 23; break; case 64: $exponentbits = 11; $fractionbits = 52; break; default: return false; } if ($floatvalue >= 0) { $signbit = '0'; } else { $signbit = '1'; } $normalizedbinary = self::NormalizeBinaryPoint(self::Float2BinaryDecimal($floatvalue), $fractionbits); $biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; $exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT); $fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT); return self::BigEndian2String(self::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false); } public static function LittleEndian2Float($byteword) { return self::BigEndian2Float(strrev($byteword)); } public static function BigEndian2Float($byteword) { $bitword = self::BigEndian2Bin($byteword); if (!$bitword) { return 0; } $signbit = $bitword[0]; $floatvalue = 0; $exponentbits = 0; $fractionbits = 0; switch (strlen($byteword) * 8) { case 32: $exponentbits = 8; $fractionbits = 23; break; case 64: $exponentbits = 11; $fractionbits = 52; break; case 80: $exponentstring = substr($bitword, 1, 15); $isnormalized = intval($bitword[16]); $fractionstring = substr($bitword, 17, 63); $exponent = pow(2, self::Bin2Dec($exponentstring) - 16383); $fraction = $isnormalized + self::DecimalBinary2Float($fractionstring); $floatvalue = $exponent * $fraction; if ($signbit == '1') { $floatvalue *= -1; } return $floatvalue; default: return false; } $exponentstring = substr($bitword, 1, $exponentbits); $fractionstring = substr($bitword, $exponentbits + 1, $fractionbits); $exponent = self::Bin2Dec($exponentstring); $fraction = self::Bin2Dec($fractionstring); if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) { $floatvalue = NAN; } elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) { if ($signbit == '1') { $floatvalue = -INF; } else { $floatvalue = INF; } } elseif (($exponent == 0) && ($fraction == 0)) { if ($signbit == '1') { $floatvalue = -0; } else { $floatvalue = 0; } $floatvalue = ($signbit ? 0 : -0); } elseif (($exponent == 0) && ($fraction != 0)) { $floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * self::DecimalBinary2Float($fractionstring); if ($signbit == '1') { $floatvalue *= -1; } } elseif ($exponent != 0) { $floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + self::DecimalBinary2Float($fractionstring)); if ($signbit == '1') { $floatvalue *= -1; } } return (float) $floatvalue; } public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) { $intvalue = 0; $bytewordlen = strlen($byteword); if ($bytewordlen == 0) { return false; } for ($i = 0; $i < $bytewordlen; $i++) { if ($synchsafe) { $intvalue += (ord($byteword[$i]) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); } else { $intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i)); } } if ($signed && !$synchsafe) { if ($bytewordlen <= PHP_INT_SIZE) { $signMaskBit = 0x80 << (8 * ($bytewordlen - 1)); if ($intvalue & $signMaskBit) { $intvalue = 0 - ($intvalue & ($signMaskBit - 1)); } } else { throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()'); } } return self::CastAsInt($intvalue); } public static function LittleEndian2Int($byteword, $signed=false) { return self::BigEndian2Int(strrev($byteword), false, $signed); } public static function LittleEndian2Bin($byteword) { return self::BigEndian2Bin(strrev($byteword)); } public static function BigEndian2Bin($byteword) { $binvalue = ''; $bytewordlen = strlen($byteword); for ($i = 0; $i < $bytewordlen; $i++) { $binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT); } return $binvalue; } public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) { if ($number < 0) { throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers'); } $maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF); $intstring = ''; if ($signed) { if ($minbytes > PHP_INT_SIZE) { throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in self::BigEndian2String()'); } $number = $number & (0x80 << (8 * ($minbytes - 1))); } while ($number != 0) { $quotient = ($number / ($maskbyte + 1)); $intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring; $number = floor($quotient); } return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT); } public static function Dec2Bin($number) { if (!is_numeric($number)) { trigger_error('TypeError: Dec2Bin(): Argument #1 ($number) must be numeric, '.gettype($number).' given', E_USER_WARNING); return ''; } $bytes = array(); while ($number >= 256) { $bytes[] = (int) (($number / 256) - (floor($number / 256))) * 256; $number = floor($number / 256); } $bytes[] = (int) $number; $binstring = ''; foreach ($bytes as $i => $byte) { $binstring = (($i == count($bytes) - 1) ? decbin($byte) : str_pad(decbin($byte), 8, '0', STR_PAD_LEFT)).$binstring; } return $binstring; } public static function Bin2Dec($binstring, $signed=false) { $signmult = 1; if ($signed) { if ($binstring[0] == '1') { $signmult = -1; } $binstring = substr($binstring, 1); } $decvalue = 0; for ($i = 0; $i < strlen($binstring); $i++) { $decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i); } return self::CastAsInt($decvalue * $signmult); } public static function Bin2String($binstring) { $string = ''; $binstringreversed = strrev($binstring); for ($i = 0; $i < strlen($binstringreversed); $i += 8) { $string = chr(self::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string; } return $string; } public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { $intstring = ''; while ($number > 0) { if ($synchsafe) { $intstring = $intstring.chr($number & 127); $number >>= 7; } else { $intstring = $intstring.chr($number & 255); $number >>= 8; } } return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT); } public static function array_merge_clobber($array1, $array2) { if (!is_array($array1) || !is_array($array2)) { return false; } $newarray = $array1; foreach ($array2 as $key => $val) { if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { $newarray[$key] = self::array_merge_clobber($newarray[$key], $val); } else { $newarray[$key] = $val; } } return $newarray; } public static function array_merge_noclobber($array1, $array2) { if (!is_array($array1) || !is_array($array2)) { return false; } $newarray = $array1; foreach ($array2 as $key => $val) { if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { $newarray[$key] = self::array_merge_noclobber($newarray[$key], $val); } elseif (!isset($newarray[$key])) { $newarray[$key] = $val; } } return $newarray; } public static function flipped_array_merge_noclobber($array1, $array2) { if (!is_array($array1) || !is_array($array2)) { return false; } $newarray = array_flip($array1); foreach (array_flip($array2) as $key => $val) { if (!isset($newarray[$key])) { $newarray[$key] = count($newarray); } } return array_flip($newarray); } public static function ksort_recursive(&$theArray) { ksort($theArray); foreach ($theArray as $key => $value) { if (is_array($value)) { self::ksort_recursive($theArray[$key]); } } return true; } public static function fileextension($filename, $numextensions=1) { if (strstr($filename, '.')) { $reversedfilename = strrev($filename); $offset = 0; for ($i = 0; $i < $numextensions; $i++) { $offset = strpos($reversedfilename, '.', $offset + 1); if ($offset === false) { return ''; } } return strrev(substr($reversedfilename, 0, $offset)); } return ''; } public static function PlaytimeString($seconds) { $sign = (($seconds < 0) ? '-' : ''); $seconds = round(abs($seconds)); $H = (int) floor( $seconds / 3600); $M = (int) floor(($seconds - (3600 * $H) ) / 60); $S = (int) round( $seconds - (3600 * $H) - (60 * $M) ); return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT); } public static function DateMac2Unix($macdate) { return self::CastAsInt($macdate - 2082844800); } public static function FixedPoint8_8($rawdata) { return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); } public static function FixedPoint16_16($rawdata) { return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); } public static function FixedPoint2_30($rawdata) { $binarystring = self::BigEndian2Bin($rawdata); return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30)); } public static function CreateDeepArray($ArrayPath, $Separator, $Value) { $ArrayPath = ltrim($ArrayPath, $Separator); $ReturnedArray = array(); if (($pos = strpos($ArrayPath, $Separator)) !== false) { $ReturnedArray[substr($ArrayPath, 0, $pos)] = self::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value); } else { $ReturnedArray[$ArrayPath] = $Value; } return $ReturnedArray; } public static function array_max($arraydata, $returnkey=false) { $maxvalue = false; $maxkey = false; foreach ($arraydata as $key => $value) { if (!is_array($value)) { if (($maxvalue === false) || ($value > $maxvalue)) { $maxvalue = $value; $maxkey = $key; } } } return ($returnkey ? $maxkey : $maxvalue); } public static function array_min($arraydata, $returnkey=false) { $minvalue = false; $minkey = false; foreach ($arraydata as $key => $value) { if (!is_array($value)) { if (($minvalue === false) || ($value < $minvalue)) { $minvalue = $value; $minkey = $key; } } } return ($returnkey ? $minkey : $minvalue); } public static function XML2array($XMLstring) { if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) { $loader = @libxml_disable_entity_loader(true); $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT); $return = self::SimpleXMLelement2array($XMLobject); @libxml_disable_entity_loader($loader); return $return; } return false; } public static function SimpleXMLelement2array($XMLobject) { if (!is_object($XMLobject) && !is_array($XMLobject)) { return $XMLobject; } $XMLarray = $XMLobject instanceof SimpleXMLElement ? get_object_vars($XMLobject) : $XMLobject; foreach ($XMLarray as $key => $value) { $XMLarray[$key] = self::SimpleXMLelement2array($value); } return $XMLarray; } public static function hash_data($file, $offset, $end, $algorithm) { if (!self::intValueSupported($end)) { return false; } if (!in_array($algorithm, array('md5', 'sha1'))) { throw new getid3_exception('Invalid algorithm ('.$algorithm.') in self::hash_data()'); } $size = $end - $offset; $fp = fopen($file, 'rb'); fseek($fp, $offset); $ctx = hash_init($algorithm); while ($size > 0) { $buffer = fread($fp, min($size, getID3::FREAD_BUFFER_SIZE)); hash_update($ctx, $buffer); $size -= getID3::FREAD_BUFFER_SIZE; } $hash = hash_final($ctx); fclose($fp); return $hash; } public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { if (!self::intValueSupported($offset + $length)) { throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); } if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) { if (($fp_dest = fopen($filename_dest, 'wb'))) { if (fseek($fp_src, $offset) == 0) { $byteslefttowrite = $length; while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) { $byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite); $byteslefttowrite -= $byteswritten; } fclose($fp_dest); return true; } else { fclose($fp_src); throw new Exception('failed to seek to offset '.$offset.' in '.$filename_source); } } else { throw new Exception('failed to create file for writing '.$filename_dest); } } else { throw new Exception('failed to open file for reading '.$filename_source); } } public static function iconv_fallback_int_utf8($charval) { if ($charval < 128) { $newcharstring = chr($charval); } elseif ($charval < 2048) { $newcharstring = chr(($charval >> 6) | 0xC0); $newcharstring .= chr(($charval & 0x3F) | 0x80); } elseif ($charval < 65536) { $newcharstring = chr(($charval >> 12) | 0xE0); $newcharstring .= chr(($charval >> 6) | 0xC0); $newcharstring .= chr(($charval & 0x3F) | 0x80); } else { $newcharstring = chr(($charval >> 18) | 0xF0); $newcharstring .= chr(($charval >> 12) | 0xC0); $newcharstring .= chr(($charval >> 6) | 0xC0); $newcharstring .= chr(($charval & 0x3F) | 0x80); } return $newcharstring; } public static function iconv_fallback_iso88591_utf8($string, $bom=false) { if (function_exists('utf8_encode')) { return utf8_encode($string); } $newcharstring = ''; if ($bom) { $newcharstring .= "\xEF\xBB\xBF"; } for ($i = 0; $i < strlen($string); $i++) { $charval = ord($string[$i]); $newcharstring .= self::iconv_fallback_int_utf8($charval); } return $newcharstring; } public static function iconv_fallback_iso88591_utf16be($string, $bom=false) { $newcharstring = ''; if ($bom) { $newcharstring .= "\xFE\xFF"; } for ($i = 0; $i < strlen($string); $i++) { $newcharstring .= "\x00".$string[$i]; } return $newcharstring; } public static function iconv_fallback_iso88591_utf16le($string, $bom=false) { $newcharstring = ''; if ($bom) { $newcharstring .= "\xFF\xFE"; } for ($i = 0; $i < strlen($string); $i++) { $newcharstring .= $string[$i]."\x00"; } return $newcharstring; } public static function iconv_fallback_iso88591_utf16($string) { return self::iconv_fallback_iso88591_utf16le($string, true); } public static function iconv_fallback_utf8_iso88591($string) { if (function_exists('utf8_decode')) { return utf8_decode($string); } $newcharstring = ''; $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { if ((ord($string[$offset]) | 0x07) == 0xF7) { $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & ((ord($string[($offset + 1)]) & 0x3F) << 12) & ((ord($string[($offset + 2)]) & 0x3F) << 6) & (ord($string[($offset + 3)]) & 0x3F); $offset += 4; } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & ((ord($string[($offset + 1)]) & 0x3F) << 6) & (ord($string[($offset + 2)]) & 0x3F); $offset += 3; } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & (ord($string[($offset + 1)]) & 0x3F); $offset += 2; } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { $charval = ord($string[$offset]); $offset += 1; } else { $charval = false; $offset += 1; } if ($charval !== false) { $newcharstring .= (($charval < 256) ? chr($charval) : '?'); } } return $newcharstring; } public static function iconv_fallback_utf8_utf16be($string, $bom=false) { $newcharstring = ''; if ($bom) { $newcharstring .= "\xFE\xFF"; } $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { if ((ord($string[$offset]) | 0x07) == 0xF7) { $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & ((ord($string[($offset + 1)]) & 0x3F) << 12) & ((ord($string[($offset + 2)]) & 0x3F) << 6) & (ord($string[($offset + 3)]) & 0x3F); $offset += 4; } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & ((ord($string[($offset + 1)]) & 0x3F) << 6) & (ord($string[($offset + 2)]) & 0x3F); $offset += 3; } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & (ord($string[($offset + 1)]) & 0x3F); $offset += 2; } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { $charval = ord($string[$offset]); $offset += 1; } else { $charval = false; $offset += 1; } if ($charval !== false) { $newcharstring .= (($charval < 65536) ? self::BigEndian2String($charval, 2) : "\x00".'?'); } } return $newcharstring; } public static function iconv_fallback_utf8_utf16le($string, $bom=false) { $newcharstring = ''; if ($bom) { $newcharstring .= "\xFF\xFE"; } $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { if ((ord($string[$offset]) | 0x07) == 0xF7) { $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & ((ord($string[($offset + 1)]) & 0x3F) << 12) & ((ord($string[($offset + 2)]) & 0x3F) << 6) & (ord($string[($offset + 3)]) & 0x3F); $offset += 4; } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & ((ord($string[($offset + 1)]) & 0x3F) << 6) & (ord($string[($offset + 2)]) & 0x3F); $offset += 3; } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & (ord($string[($offset + 1)]) & 0x3F); $offset += 2; } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { $charval = ord($string[$offset]); $offset += 1; } else { $charval = false; $offset += 1; } if ($charval !== false) { $newcharstring .= (($charval < 65536) ? self::LittleEndian2String($charval, 2) : '?'."\x00"); } } return $newcharstring; } public static function iconv_fallback_utf8_utf16($string) { return self::iconv_fallback_utf8_utf16le($string, true); } public static function iconv_fallback_utf16be_utf8($string) { if (substr($string, 0, 2) == "\xFE\xFF") { $string = substr($string, 2); } $newcharstring = ''; for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::BigEndian2Int(substr($string, $i, 2)); $newcharstring .= self::iconv_fallback_int_utf8($charval); } return $newcharstring; } public static function iconv_fallback_utf16le_utf8($string) { if (substr($string, 0, 2) == "\xFF\xFE") { $string = substr($string, 2); } $newcharstring = ''; for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::LittleEndian2Int(substr($string, $i, 2)); $newcharstring .= self::iconv_fallback_int_utf8($charval); } return $newcharstring; } public static function iconv_fallback_utf16be_iso88591($string) { if (substr($string, 0, 2) == "\xFE\xFF") { $string = substr($string, 2); } $newcharstring = ''; for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::BigEndian2Int(substr($string, $i, 2)); $newcharstring .= (($charval < 256) ? chr($charval) : '?'); } return $newcharstring; } public static function iconv_fallback_utf16le_iso88591($string) { if (substr($string, 0, 2) == "\xFF\xFE") { $string = substr($string, 2); } $newcharstring = ''; for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::LittleEndian2Int(substr($string, $i, 2)); $newcharstring .= (($charval < 256) ? chr($charval) : '?'); } return $newcharstring; } public static function iconv_fallback_utf16_iso88591($string) { $bom = substr($string, 0, 2); if ($bom == "\xFE\xFF") { return self::iconv_fallback_utf16be_iso88591(substr($string, 2)); } elseif ($bom == "\xFF\xFE") { return self::iconv_fallback_utf16le_iso88591(substr($string, 2)); } return $string; } public static function iconv_fallback_utf16_utf8($string) { $bom = substr($string, 0, 2); if ($bom == "\xFE\xFF") { return self::iconv_fallback_utf16be_utf8(substr($string, 2)); } elseif ($bom == "\xFF\xFE") { return self::iconv_fallback_utf16le_utf8(substr($string, 2)); } return $string; } public static function iconv_fallback($in_charset, $out_charset, $string) { if ($in_charset == $out_charset) { return $string; } if (function_exists('mb_convert_encoding')) { if ((strtoupper($in_charset) == 'UTF-16') && (substr($string, 0, 2) != "\xFE\xFF") && (substr($string, 0, 2) != "\xFF\xFE")) { $string = "\xFF\xFE".$string; } if ((strtoupper($in_charset) == 'UTF-16') && (strtoupper($out_charset) == 'UTF-8')) { if (($string == "\xFF\xFE") || ($string == "\xFE\xFF")) { return ''; } } if ($converted_string = @mb_convert_encoding($string, $out_charset, $in_charset)) { switch ($out_charset) { case 'ISO-8859-1': $converted_string = rtrim($converted_string, "\x00"); break; } return $converted_string; } return $string; } elseif (function_exists('iconv')) { if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) { switch ($out_charset) { case 'ISO-8859-1': $converted_string = rtrim($converted_string, "\x00"); break; } return $converted_string; } return $string; } static $ConversionFunctionList = array(); if (empty($ConversionFunctionList)) { $ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8'; $ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16'; $ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be'; $ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le'; $ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591'; $ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16'; $ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be'; $ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le'; $ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591'; $ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8'; $ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591'; $ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8'; $ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591'; $ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8'; } if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) { $ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)]; return self::$ConversionFunction($string); } throw new Exception('PHP does not has mb_convert_encoding() or iconv() support - cannot convert from '.$in_charset.' to '.$out_charset); } public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') { if (is_string($data)) { return self::MultiByteCharString2HTML($data, $charset); } elseif (is_array($data)) { $return_data = array(); foreach ($data as $key => $value) { $return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset); } return $return_data; } return $data; } public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') { $string = (string) $string; $HTMLstring = ''; switch (strtolower($charset)) { case '1251': case '1252': case '866': case '932': case '936': case '950': case 'big5': case 'big5-hkscs': case 'cp1251': case 'cp1252': case 'cp866': case 'euc-jp': case 'eucjp': case 'gb2312': case 'ibm866': case 'iso-8859-1': case 'iso-8859-15': case 'iso8859-1': case 'iso8859-15': case 'koi8-r': case 'koi8-ru': case 'koi8r': case 'shift_jis': case 'sjis': case 'win-1251': case 'windows-1251': case 'windows-1252': $HTMLstring = htmlentities($string, ENT_COMPAT, $charset); break; case 'utf-8': $strlen = strlen($string); for ($i = 0; $i < $strlen; $i++) { $char_ord_val = ord($string[$i]); $charval = 0; if ($char_ord_val < 0x80) { $charval = $char_ord_val; } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { $charval = (($char_ord_val & 0x07) << 18); $charval += ((ord($string[++$i]) & 0x3F) << 12); $charval += ((ord($string[++$i]) & 0x3F) << 6); $charval += (ord($string[++$i]) & 0x3F); } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { $charval = (($char_ord_val & 0x0F) << 12); $charval += ((ord($string[++$i]) & 0x3F) << 6); $charval += (ord($string[++$i]) & 0x3F); } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { $charval = (($char_ord_val & 0x1F) << 6); $charval += (ord($string[++$i]) & 0x3F); } if (($charval >= 32) && ($charval <= 127)) { $HTMLstring .= htmlentities(chr($charval)); } else { $HTMLstring .= '&#'.$charval.';'; } } break; case 'utf-16le': for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::LittleEndian2Int(substr($string, $i, 2)); if (($charval >= 32) && ($charval <= 127)) { $HTMLstring .= chr($charval); } else { $HTMLstring .= '&#'.$charval.';'; } } break; case 'utf-16be': for ($i = 0; $i < strlen($string); $i += 2) { $charval = self::BigEndian2Int(substr($string, $i, 2)); if (($charval >= 32) && ($charval <= 127)) { $HTMLstring .= chr($charval); } else { $HTMLstring .= '&#'.$charval.';'; } } break; default: $HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()'; break; } return $HTMLstring; } public static function RGADnameLookup($namecode) { static $RGADname = array(); if (empty($RGADname)) { $RGADname[0] = 'not set'; $RGADname[1] = 'Track Gain Adjustment'; $RGADname[2] = 'Album Gain Adjustment'; } return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : ''); } public static function RGADoriginatorLookup($originatorcode) { static $RGADoriginator = array(); if (empty($RGADoriginator)) { $RGADoriginator[0] = 'unspecified'; $RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer'; $RGADoriginator[2] = 'set by user'; $RGADoriginator[3] = 'determined automatically'; } return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : ''); } public static function RGADadjustmentLookup($rawadjustment, $signbit) { $adjustment = (float) $rawadjustment / 10; if ($signbit == 1) { $adjustment *= -1; } return $adjustment; } public static function RGADgainString($namecode, $originatorcode, $replaygain) { if ($replaygain < 0) { $signbit = '1'; } else { $signbit = '0'; } $storedreplaygain = intval(round($replaygain * 10)); $gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT); $gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT); $gainstring .= $signbit; $gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT); return $gainstring; } public static function RGADamplitude2dB($amplitude) { return 20 * log10($amplitude); } public static function GetDataImageSize($imgData, &$imageinfo=array()) { if (PHP_VERSION_ID >= 50400) { $GetDataImageSize = @getimagesizefromstring($imgData, $imageinfo); if ($GetDataImageSize === false || !isset($GetDataImageSize[0], $GetDataImageSize[1])) { return false; } $GetDataImageSize['height'] = $GetDataImageSize[0]; $GetDataImageSize['width'] = $GetDataImageSize[1]; return $GetDataImageSize; } static $tempdir = ''; if (empty($tempdir)) { if (function_exists('sys_get_temp_dir')) { $tempdir = sys_get_temp_dir(); } if (include_once(dirname(__FILE__).'/getid3.php')) { $getid3_temp = new getID3(); if ($getid3_temp_tempdir = $getid3_temp->tempdir) { $tempdir = $getid3_temp_tempdir; } unset($getid3_temp, $getid3_temp_tempdir); } } $GetDataImageSize = false; if ($tempfilename = tempnam($tempdir, 'gI3')) { if (is_writable($tempfilename) && is_file($tempfilename) && ($tmp = fopen($tempfilename, 'wb'))) { fwrite($tmp, $imgData); fclose($tmp); $GetDataImageSize = @getimagesize($tempfilename, $imageinfo); if (($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) { return false; } $GetDataImageSize['height'] = $GetDataImageSize[0]; $GetDataImageSize['width'] = $GetDataImageSize[1]; } unlink($tempfilename); } return $GetDataImageSize; } public static function ImageExtFromMime($mime_type) { return str_replace(array('image/', 'x-', 'jpeg'), array('', '', 'jpg'), $mime_type); } public static function CopyTagsToComments(&$ThisFileInfo, $option_tags_html=true) { if (!empty($ThisFileInfo['tags'])) { $processLastTagTypes = array('id3v1','riff'); foreach ($processLastTagTypes as $processLastTagType) { if (isset($ThisFileInfo['tags'][$processLastTagType])) { $temp = $ThisFileInfo['tags'][$processLastTagType]; unset($ThisFileInfo['tags'][$processLastTagType]); $ThisFileInfo['tags'][$processLastTagType] = $temp; unset($temp); } } foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) { foreach ($tagarray as $tagname => $tagdata) { foreach ($tagdata as $key => $value) { if (!empty($value)) { if (empty($ThisFileInfo['comments'][$tagname])) { } elseif ($tagtype == 'id3v1') { $newvaluelength = strlen(trim($value)); foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { $oldvaluelength = strlen(trim($existingvalue)); if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) { break 2; } if (function_exists('mb_convert_encoding')) { if (trim($value) == trim(substr(mb_convert_encoding($existingvalue, $ThisFileInfo['id3v1']['encoding'], $ThisFileInfo['encoding']), 0, 30))) { break 2; } } } } elseif (!is_array($value)) { $newvaluelength = strlen(trim($value)); $newvaluelengthMB = mb_strlen(trim($value)); foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { $oldvaluelength = strlen(trim($existingvalue)); $oldvaluelengthMB = mb_strlen(trim($existingvalue)); if (($newvaluelengthMB == $oldvaluelengthMB) && ($existingvalue == getid3_lib::iconv_fallback('UTF-8', 'ASCII', $value))) { $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); break; } if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) { $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); break; } } } if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { $value = (is_string($value) ? trim($value) : $value); if (!is_int($key) && !ctype_digit($key)) { $ThisFileInfo['comments'][$tagname][$key] = $value; } else { if (!isset($ThisFileInfo['comments'][$tagname])) { $ThisFileInfo['comments'][$tagname] = array($value); } else { $ThisFileInfo['comments'][$tagname][] = $value; } } } } } } } if (!empty($ThisFileInfo['comments'])) { $StandardizeFieldNames = array( 'tracknumber' => 'track_number', 'track' => 'track_number', ); foreach ($StandardizeFieldNames as $badkey => $goodkey) { if (array_key_exists($badkey, $ThisFileInfo['comments']) && !array_key_exists($goodkey, $ThisFileInfo['comments'])) { $ThisFileInfo['comments'][$goodkey] = $ThisFileInfo['comments'][$badkey]; unset($ThisFileInfo['comments'][$badkey]); } } } if ($option_tags_html) { if (!empty($ThisFileInfo['comments'])) { foreach ($ThisFileInfo['comments'] as $field => $values) { if ($field == 'picture') { continue; } foreach ($values as $index => $value) { if (is_array($value)) { $ThisFileInfo['comments_html'][$field][$index] = $value; } else { $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); } } } } } } return true; } public static function EmbeddedLookup($key, $begin, $end, $file, $name) { static $cache; if (isset($cache[$file][$name])) { return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); } $keylength = strlen($key); $line_count = $end - $begin - 7; $fp = fopen($file, 'r'); for ($i = 0; $i < ($begin + 3); $i++) { fgets($fp, 1024); } while (0 < $line_count--) { $line = ltrim(fgets($fp, 1024), "\t "); $explodedLine = explode("\t", $line, 2); $ThisKey = (isset($explodedLine[0]) ? $explodedLine[0] : ''); $ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : ''); $cache[$file][$name][$ThisKey] = trim($ThisValue); } fclose($fp); return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); } public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { global $GETID3_ERRORARRAY; if (file_exists($filename)) { if (include_once($filename)) { return true; } else { $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors'; } } else { $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing'; } if ($DieOnFailure) { throw new Exception($diemessage); } else { $GETID3_ERRORARRAY[] = $diemessage; } return false; } public static function trimNullByte($string) { return trim($string, "\x00"); } public static function getFileSizeSyscall($path) { $commandline = null; $filesize = false; if (GETID3_OS_ISWINDOWS) { if (class_exists('COM')) { $filesystem = new COM('Scripting.FileSystemObject'); $file = $filesystem->GetFile($path); $filesize = $file->Size(); unset($filesystem, $file); } else { $commandline = 'for %I in ('.escapeshellarg($path).') do @echo %~zI'; } } else { $commandline = 'ls -l '.escapeshellarg($path).' | awk \'{print $5}\''; } if (isset($commandline)) { $output = trim(`$commandline`); if (ctype_digit($output)) { $filesize = (float) $output; } } return $filesize; } public static function truepath($filename) { if (preg_match('#^(\\\\\\\\|//)[a-z0-9]#i', $filename, $matches)) { $goodpath = array(); foreach (explode('/', str_replace('\\', '/', $filename)) as $part) { if ($part == '.') { continue; } if ($part == '..') { if (count($goodpath)) { array_pop($goodpath); } else { return false; } } else { $goodpath[] = $part; } } return implode(DIRECTORY_SEPARATOR, $goodpath); } return realpath($filename); } public static function mb_basename($path, $suffix = '') { $splited = preg_split('#/#', rtrim($path, '/ ')); return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1); } } KnownGUIDs(); foreach ($GUIDarray as $GUIDname => $hexstringvalue) { if (!defined($GUIDname)) { define($GUIDname, $this->GUIDtoBytestring($hexstringvalue)); } } } public function Analyze() { $info = &$this->getid3->info; $thisfile_audio = &$info['audio']; $thisfile_video = &$info['video']; $info['asf'] = array(); $thisfile_asf = &$info['asf']; $thisfile_asf['comments'] = array(); $thisfile_asf_comments = &$thisfile_asf['comments']; $thisfile_asf['header_object'] = array(); $thisfile_asf_headerobject = &$thisfile_asf['header_object']; $info['fileformat'] = 'asf'; $this->fseek($info['avdataoffset']); $HeaderObjectData = $this->fread(30); $thisfile_asf_headerobject['objectid'] = substr($HeaderObjectData, 0, 16); $thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']); if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) { unset($info['fileformat'], $info['asf']); return $this->error('ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}'); } $thisfile_asf_headerobject['objectsize'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8)); $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4)); $thisfile_asf_headerobject['reserved1'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1)); $thisfile_asf_headerobject['reserved2'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1)); $NextObjectOffset = $this->ftell(); $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30); $offset = 0; $thisfile_asf_streambitratepropertiesobject = array(); $thisfile_asf_codeclistobject = array(); $StreamPropertiesObjectData = array(); for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) { $NextObjectGUID = substr($ASFHeaderData, $offset, 16); $offset += 16; $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); $NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; switch ($NextObjectGUID) { case GETID3_ASF_File_Properties_Object: $thisfile_asf['file_properties_object'] = array(); $thisfile_asf_filepropertiesobject = &$thisfile_asf['file_properties_object']; $thisfile_asf_filepropertiesobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_filepropertiesobject['objectid'] = $NextObjectGUID; $thisfile_asf_filepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_filepropertiesobject['objectsize'] = $NextObjectSize; $thisfile_asf_filepropertiesobject['fileid'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_filepropertiesobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']); $thisfile_asf_filepropertiesobject['filesize'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_filepropertiesobject['creation_date'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']); $offset += 8; $thisfile_asf_filepropertiesobject['data_packets'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_filepropertiesobject['play_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_filepropertiesobject['send_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_filepropertiesobject['preroll'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_filepropertiesobject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_filepropertiesobject['flags']['broadcast'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0001); $thisfile_asf_filepropertiesobject['flags']['seekable'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0002); $thisfile_asf_filepropertiesobject['min_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_filepropertiesobject['max_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_filepropertiesobject['max_bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; if ($thisfile_asf_filepropertiesobject['flags']['broadcast']) { unset($thisfile_asf_filepropertiesobject['filesize']); unset($thisfile_asf_filepropertiesobject['data_packets']); unset($thisfile_asf_filepropertiesobject['play_duration']); unset($thisfile_asf_filepropertiesobject['send_duration']); unset($thisfile_asf_filepropertiesobject['min_packet_size']); unset($thisfile_asf_filepropertiesobject['max_packet_size']); } else { $info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000); $info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds']; } break; case GETID3_ASF_Stream_Properties_Object: $StreamPropertiesObjectData['offset'] = $NextObjectOffset + $offset; $StreamPropertiesObjectData['objectid'] = $NextObjectGUID; $StreamPropertiesObjectData['objectid_guid'] = $NextObjectGUIDtext; $StreamPropertiesObjectData['objectsize'] = $NextObjectSize; $StreamPropertiesObjectData['stream_type'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $StreamPropertiesObjectData['stream_type_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['stream_type']); $StreamPropertiesObjectData['error_correct_type'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $StreamPropertiesObjectData['error_correct_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['error_correct_type']); $StreamPropertiesObjectData['time_offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $StreamPropertiesObjectData['type_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $StreamPropertiesObjectData['error_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $StreamPropertiesObjectData['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData['flags_raw'] & 0x007F; $StreamPropertiesObjectData['flags']['encrypted'] = (bool) ($StreamPropertiesObjectData['flags_raw'] & 0x8000); $offset += 4; $StreamPropertiesObjectData['type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['type_data_length']); $offset += $StreamPropertiesObjectData['type_data_length']; $StreamPropertiesObjectData['error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['error_data_length']); $offset += $StreamPropertiesObjectData['error_data_length']; switch ($StreamPropertiesObjectData['stream_type']) { case GETID3_ASF_Audio_Media: $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); $audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16)); unset($audiodata['raw']); $thisfile_audio = getid3_lib::array_merge_noclobber($audiodata, $thisfile_audio); break; case GETID3_ASF_Video_Media: $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); break; case GETID3_ASF_Command_Media: default: break; } $thisfile_asf['stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData; unset($StreamPropertiesObjectData); break; case GETID3_ASF_Header_Extension_Object: $thisfile_asf['header_extension_object'] = array(); $thisfile_asf_headerextensionobject = &$thisfile_asf['header_extension_object']; $thisfile_asf_headerextensionobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_headerextensionobject['objectid'] = $NextObjectGUID; $thisfile_asf_headerextensionobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_headerextensionobject['objectsize'] = $NextObjectSize; $thisfile_asf_headerextensionobject['reserved_1'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_headerextensionobject['reserved_1_guid'] = $this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']); if ($thisfile_asf_headerextensionobject['reserved_1'] != GETID3_ASF_Reserved_1) { $this->warning('header_extension_object.reserved_1 GUID ('.$this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']).') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->BytestringToGUID(GETID3_ASF_Reserved_1).')'); break; } $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) { $this->warning('header_extension_object.reserved_2 ('.$thisfile_asf_headerextensionobject['reserved_2'].') does not match expected value of "6"'); break; } $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); $unhandled_sections = 0; $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections); if ($unhandled_sections === 0) { unset($thisfile_asf_headerextensionobject['extension_data']); } $offset += $thisfile_asf_headerextensionobject['extension_data_size']; break; case GETID3_ASF_Codec_List_Object: $thisfile_asf['codec_list_object'] = array(); $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; $thisfile_asf_codeclistobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_codeclistobject['objectid'] = $NextObjectGUID; $thisfile_asf_codeclistobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_codeclistobject['objectsize'] = $NextObjectSize; $thisfile_asf_codeclistobject['reserved'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_codeclistobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']); if ($thisfile_asf_codeclistobject['reserved'] != $this->GUIDtoBytestring('86D15241-311D-11D0-A3A4-00A0C90348F6')) { $this->warning('codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}'); break; } $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) { $thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array(); $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter]; $thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_codeclistobject_codecentries_current['type'] = self::codecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']); $CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; $offset += 2; $thisfile_asf_codeclistobject_codecentries_current['name'] = substr($ASFHeaderData, $offset, $CodecNameLength); $offset += $CodecNameLength; $CodecDescriptionLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; $offset += 2; $thisfile_asf_codeclistobject_codecentries_current['description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength); $offset += $CodecDescriptionLength; $CodecInformationLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_codeclistobject_codecentries_current['information'] = substr($ASFHeaderData, $offset, $CodecInformationLength); $offset += $CodecInformationLength; if ($thisfile_asf_codeclistobject_codecentries_current['type_raw'] == 2) { if (strpos($thisfile_asf_codeclistobject_codecentries_current['description'], ',') === false) { $this->warning('[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.'][description] expected to contain comma-separated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current['description'].'"'); } else { list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description'])); $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { $thisfile_audio['bitrate'] = (int) trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000; } if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) { $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate']; } $AudioCodecFrequency = (int) trim(str_replace('kHz', '', $AudioCodecFrequency)); switch ($AudioCodecFrequency) { case 8: case 8000: $thisfile_audio['sample_rate'] = 8000; break; case 11: case 11025: $thisfile_audio['sample_rate'] = 11025; break; case 12: case 12000: $thisfile_audio['sample_rate'] = 12000; break; case 16: case 16000: $thisfile_audio['sample_rate'] = 16000; break; case 22: case 22050: $thisfile_audio['sample_rate'] = 22050; break; case 24: case 24000: $thisfile_audio['sample_rate'] = 24000; break; case 32: case 32000: $thisfile_audio['sample_rate'] = 32000; break; case 44: case 441000: $thisfile_audio['sample_rate'] = 44100; break; case 48: case 48000: $thisfile_audio['sample_rate'] = 48000; break; default: $this->warning('unknown frequency: "'.$AudioCodecFrequency.'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']).')'); break; } if (!isset($thisfile_audio['channels'])) { if (strstr($AudioCodecChannels, 'stereo')) { $thisfile_audio['channels'] = 2; } elseif (strstr($AudioCodecChannels, 'mono')) { $thisfile_audio['channels'] = 1; } } } } } break; case GETID3_ASF_Script_Command_Object: $thisfile_asf['script_command_object'] = array(); $thisfile_asf_scriptcommandobject = &$thisfile_asf['script_command_object']; $thisfile_asf_scriptcommandobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_scriptcommandobject['objectid'] = $NextObjectGUID; $thisfile_asf_scriptcommandobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_scriptcommandobject['objectsize'] = $NextObjectSize; $thisfile_asf_scriptcommandobject['reserved'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_scriptcommandobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']); if ($thisfile_asf_scriptcommandobject['reserved'] != $this->GUIDtoBytestring('4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) { $this->warning('script_command_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}'); break; } $thisfile_asf_scriptcommandobject['commands_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_scriptcommandobject['command_types_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) { $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; $offset += 2; $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); $offset += $CommandTypeNameLength; } for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) { $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['type_index'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; $offset += 2; $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); $offset += $CommandTypeNameLength; } break; case GETID3_ASF_Marker_Object: $thisfile_asf['marker_object'] = array(); $thisfile_asf_markerobject = &$thisfile_asf['marker_object']; $thisfile_asf_markerobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_markerobject['objectid'] = $NextObjectGUID; $thisfile_asf_markerobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_markerobject['objectsize'] = $NextObjectSize; $thisfile_asf_markerobject['reserved'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_markerobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']); if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) { $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}'); break; } $thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; if ($thisfile_asf_markerobject['reserved_2'] != 0) { $this->warning('marker_object.reserved_2 ('.$thisfile_asf_markerobject['reserved_2'].') does not match expected value of "0"'); break; } $thisfile_asf_markerobject['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); $offset += $thisfile_asf_markerobject['name_length']; for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); $offset += 8; $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_markerobject['markers'][$MarkersCounter]['send_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_markerobject['markers'][$MarkersCounter]['flags'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']); $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; if ($PaddingLength > 0) { $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); $offset += $PaddingLength; } } break; case GETID3_ASF_Bitrate_Mutual_Exclusion_Object: $thisfile_asf['bitrate_mutual_exclusion_object'] = array(); $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf['bitrate_mutual_exclusion_object']; $thisfile_asf_bitratemutualexclusionobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_bitratemutualexclusionobject['objectid'] = $NextObjectGUID; $thisfile_asf_bitratemutualexclusionobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_bitratemutualexclusionobject['objectsize'] = $NextObjectSize; $thisfile_asf_bitratemutualexclusionobject['reserved'] = substr($ASFHeaderData, $offset, 16); $thisfile_asf_bitratemutualexclusionobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']); $offset += 16; if (($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Unknown)) { $this->warning('bitrate_mutual_exclusion_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']).'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Bitrate).'} or "GETID3_ASF_Mutex_Unknown" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Unknown).'}'); break; } $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) { $thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; } break; case GETID3_ASF_Error_Correction_Object: $thisfile_asf['error_correction_object'] = array(); $thisfile_asf_errorcorrectionobject = &$thisfile_asf['error_correction_object']; $thisfile_asf_errorcorrectionobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_errorcorrectionobject['objectid'] = $NextObjectGUID; $thisfile_asf_errorcorrectionobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_errorcorrectionobject['objectsize'] = $NextObjectSize; $thisfile_asf_errorcorrectionobject['error_correction_type'] = substr($ASFHeaderData, $offset, 16); $offset += 16; $thisfile_asf_errorcorrectionobject['error_correction_guid'] = $this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']); $thisfile_asf_errorcorrectionobject['error_correction_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; switch ($thisfile_asf_errorcorrectionobject['error_correction_type']) { case GETID3_ASF_No_Error_Correction: $offset += $thisfile_asf_errorcorrectionobject['error_correction_data_length']; break; case GETID3_ASF_Audio_Spread: $thisfile_asf_errorcorrectionobject['span'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 1)); $offset += 1; $thisfile_asf_errorcorrectionobject['virtual_packet_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_errorcorrectionobject['virtual_chunk_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_errorcorrectionobject['silence_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_errorcorrectionobject['silence_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']); $offset += $thisfile_asf_errorcorrectionobject['silence_data_length']; break; default: $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}'); break; } break; case GETID3_ASF_Content_Description_Object: $thisfile_asf['content_description_object'] = array(); $thisfile_asf_contentdescriptionobject = &$thisfile_asf['content_description_object']; $thisfile_asf_contentdescriptionobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_contentdescriptionobject['objectid'] = $NextObjectGUID; $thisfile_asf_contentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_contentdescriptionobject['objectsize'] = $NextObjectSize; $thisfile_asf_contentdescriptionobject['title_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_contentdescriptionobject['author_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_contentdescriptionobject['copyright_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_contentdescriptionobject['description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_contentdescriptionobject['rating_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_contentdescriptionobject['title'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['title_length']); $offset += $thisfile_asf_contentdescriptionobject['title_length']; $thisfile_asf_contentdescriptionobject['author'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['author_length']); $offset += $thisfile_asf_contentdescriptionobject['author_length']; $thisfile_asf_contentdescriptionobject['copyright'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['copyright_length']); $offset += $thisfile_asf_contentdescriptionobject['copyright_length']; $thisfile_asf_contentdescriptionobject['description'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['description_length']); $offset += $thisfile_asf_contentdescriptionobject['description_length']; $thisfile_asf_contentdescriptionobject['rating'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['rating_length']); $offset += $thisfile_asf_contentdescriptionobject['rating_length']; $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating'); foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) { if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]); } } break; case GETID3_ASF_Extended_Content_Description_Object: $thisfile_asf['extended_content_description_object'] = array(); $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf['extended_content_description_object']; $thisfile_asf_extendedcontentdescriptionobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_extendedcontentdescriptionobject['objectid'] = $NextObjectGUID; $thisfile_asf_extendedcontentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_extendedcontentdescriptionobject['objectsize'] = $NextObjectSize; $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) { $thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array(); $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter]; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['base_offset'] = $offset + 30; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']); $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']); $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']; switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { case 0x0000: break; case 0x0001: break; case 0x0002: $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); break; case 0x0003: case 0x0004: case 0x0005: $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); break; default: $this->warning('extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'].')'); break; } switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) { case 'wm/albumartist': case 'artist': $thisfile_asf_comments['albumartist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'wm/albumtitle': case 'album': $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'wm/genre': case 'genre': $thisfile_asf_comments['genre'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'wm/partofset': $thisfile_asf_comments['partofset'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'wm/tracknumber': case 'tracknumber': $thisfile_asf_comments['track_number'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); foreach ($thisfile_asf_comments['track_number'] as $key => $value) { if (preg_match('/^[0-9\x00]+$/', $value)) { $thisfile_asf_comments['track_number'][$key] = intval(str_replace("\x00", '', $value)); } } break; case 'wm/track': if (empty($thisfile_asf_comments['track_number'])) { $thisfile_asf_comments['track_number'] = array(1 + (int) $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); } break; case 'wm/year': case 'year': case 'date': $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'wm/lyrics': case 'lyrics': $thisfile_asf_comments['lyrics'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); break; case 'isvbr': if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) { $thisfile_audio['bitrate_mode'] = 'vbr'; $thisfile_video['bitrate_mode'] = 'vbr'; } break; case 'id3': $this->getid3->include_module('tag.id3v2'); $getid3_id3v2 = new getid3_id3v2($this->getid3); $getid3_id3v2->AnalyzeString($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); unset($getid3_id3v2); if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] > 1024) { $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = ''; } break; case 'wm/encodingtime': $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); $thisfile_asf_comments['encoding_time_unix'] = array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix']); break; case 'wm/picture': $WMpicture = $this->ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); foreach ($WMpicture as $key => $value) { $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[$key] = $value; } unset($WMpicture); break; default: switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { case 0: if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') { $thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); } break; case 1: break; } break; } } break; case GETID3_ASF_Stream_Bitrate_Properties_Object: $thisfile_asf['stream_bitrate_properties_object'] = array(); $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf['stream_bitrate_properties_object']; $thisfile_asf_streambitratepropertiesobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_streambitratepropertiesobject['objectid'] = $NextObjectGUID; $thisfile_asf_streambitratepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_streambitratepropertiesobject['objectsize'] = $NextObjectSize; $thisfile_asf_streambitratepropertiesobject['bitrate_records_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); $offset += 2; $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags']['stream_number'] = $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] & 0x007F; $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); $offset += 4; } break; case GETID3_ASF_Padding_Object: $thisfile_asf['padding_object'] = array(); $thisfile_asf_paddingobject = &$thisfile_asf['padding_object']; $thisfile_asf_paddingobject['offset'] = $NextObjectOffset + $offset; $thisfile_asf_paddingobject['objectid'] = $NextObjectGUID; $thisfile_asf_paddingobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_paddingobject['objectsize'] = $NextObjectSize; $thisfile_asf_paddingobject['padding_length'] = $thisfile_asf_paddingobject['objectsize'] - 16 - 8; $thisfile_asf_paddingobject['padding'] = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject['padding_length']); $offset += ($NextObjectSize - 16 - 8); break; case GETID3_ASF_Extended_Content_Encryption_Object: case GETID3_ASF_Content_Encryption_Object: $offset += ($NextObjectSize - 16 - 8); break; default: if ($this->GUIDname($NextObjectGUIDtext)) { $this->warning('unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8)); } else { $this->warning('unknown GUID {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8)); } $offset += ($NextObjectSize - 16 - 8); break; } } if (isset($thisfile_asf_streambitratepropertiesobject['bitrate_records_count'])) { $ASFbitrateAudio = 0; $ASFbitrateVideo = 0; for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) { switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) { case 1: $ASFbitrateVideo += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate']; break; case 2: $ASFbitrateAudio += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate']; break; default: break; } } } if ($ASFbitrateAudio > 0) { $thisfile_audio['bitrate'] = $ASFbitrateAudio; } if ($ASFbitrateVideo > 0) { $thisfile_video['bitrate'] = $ASFbitrateVideo; } } if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) { $thisfile_audio['bitrate'] = 0; $thisfile_video['bitrate'] = 0; foreach ($thisfile_asf['stream_properties_object'] as $streamnumber => $streamdata) { switch ($streamdata['stream_type']) { case GETID3_ASF_Audio_Media: $thisfile_asf['audio_media'][$streamnumber] = array(); $thisfile_asf_audiomedia_currentstream = &$thisfile_asf['audio_media'][$streamnumber]; $audiomediaoffset = 0; $thisfile_asf_audiomedia_currentstream = getid3_riff::parseWAVEFORMATex(substr($streamdata['type_specific_data'], $audiomediaoffset, 16)); $audiomediaoffset += 16; $thisfile_audio['lossless'] = false; switch ($thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']) { case 0x0001: case 0x0163: $thisfile_audio['lossless'] = true; break; } if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; $thisfile_audio['bitrate'] += $dataarray['bitrate']; break; } } } else { if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8; } elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate']; } } $thisfile_audio['streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream; $thisfile_audio['streams'][$streamnumber]['wformattag'] = $thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']; $thisfile_audio['streams'][$streamnumber]['lossless'] = $thisfile_audio['lossless']; $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; $thisfile_audio['streams'][$streamnumber]['dataformat'] = 'wma'; unset($thisfile_audio['streams'][$streamnumber]['raw']); $thisfile_asf_audiomedia_currentstream['codec_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $audiomediaoffset, 2)); $audiomediaoffset += 2; $thisfile_asf_audiomedia_currentstream['codec_data'] = substr($streamdata['type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream['codec_data_size']); $audiomediaoffset += $thisfile_asf_audiomedia_currentstream['codec_data_size']; break; case GETID3_ASF_Video_Media: $thisfile_asf['video_media'][$streamnumber] = array(); $thisfile_asf_videomedia_currentstream = &$thisfile_asf['video_media'][$streamnumber]; $videomediaoffset = 0; $thisfile_asf_videomedia_currentstream['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['flags'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1)); $videomediaoffset += 1; $thisfile_asf_videomedia_currentstream['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); $videomediaoffset += 2; $thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['reserved'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); $videomediaoffset += 2; $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); $videomediaoffset += 2; $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'] = substr($streamdata['type_specific_data'], $videomediaoffset, 4); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['image_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['vertical_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['colors_used'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); $videomediaoffset += 4; $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset); if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; $thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate']; $thisfile_video['bitrate'] += $dataarray['bitrate']; break; } } } $thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::fourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']); $thisfile_video['streams'][$streamnumber]['fourcc'] = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']; $thisfile_video['streams'][$streamnumber]['codec'] = $thisfile_asf_videomedia_currentstream['format_data']['codec']; $thisfile_video['streams'][$streamnumber]['resolution_x'] = $thisfile_asf_videomedia_currentstream['image_width']; $thisfile_video['streams'][$streamnumber]['resolution_y'] = $thisfile_asf_videomedia_currentstream['image_height']; $thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel']; break; default: break; } } } while ($this->ftell() < $info['avdataend']) { $NextObjectDataHeader = $this->fread(24); $offset = 0; $NextObjectGUID = substr($NextObjectDataHeader, 0, 16); $offset += 16; $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); $NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8)); $offset += 8; switch ($NextObjectGUID) { case GETID3_ASF_Data_Object: $thisfile_asf['data_object'] = array(); $thisfile_asf_dataobject = &$thisfile_asf['data_object']; $DataObjectData = $NextObjectDataHeader.$this->fread(50 - 24); $offset = 24; $thisfile_asf_dataobject['objectid'] = $NextObjectGUID; $thisfile_asf_dataobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_dataobject['objectsize'] = $NextObjectSize; $thisfile_asf_dataobject['fileid'] = substr($DataObjectData, $offset, 16); $offset += 16; $thisfile_asf_dataobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_dataobject['fileid']); $thisfile_asf_dataobject['total_data_packets'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 8)); $offset += 8; $thisfile_asf_dataobject['reserved'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 2)); $offset += 2; if ($thisfile_asf_dataobject['reserved'] != 0x0101) { $this->warning('data_object.reserved (0x'.sprintf('%04X', $thisfile_asf_dataobject['reserved']).') does not match expected value of "0x0101"'); break; } $info['avdataoffset'] = $this->ftell(); $this->fseek(($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); $info['avdataend'] = $this->ftell(); break; case GETID3_ASF_Simple_Index_Object: $thisfile_asf['simple_index_object'] = array(); $thisfile_asf_simpleindexobject = &$thisfile_asf['simple_index_object']; $SimpleIndexObjectData = $NextObjectDataHeader.$this->fread(56 - 24); $offset = 24; $thisfile_asf_simpleindexobject['objectid'] = $NextObjectGUID; $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize; $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); $offset += 16; $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']); $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8)); $offset += 8; $thisfile_asf_simpleindexobject['maximum_packet_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); $offset += 4; $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); $offset += 4; $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject['index_entries_count']); for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) { $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); $offset += 4; $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_count'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); $offset += 2; } break; case GETID3_ASF_Index_Object: $thisfile_asf['asf_index_object'] = array(); $thisfile_asf_asfindexobject = &$thisfile_asf['asf_index_object']; $ASFIndexObjectData = $NextObjectDataHeader.$this->fread(34 - 24); $offset = 24; $thisfile_asf_asfindexobject['objectid'] = $NextObjectGUID; $thisfile_asf_asfindexobject['objectid_guid'] = $NextObjectGUIDtext; $thisfile_asf_asfindexobject['objectsize'] = $NextObjectSize; $thisfile_asf_asfindexobject['entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); $offset += 4; $thisfile_asf_asfindexobject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); $offset += 2; $thisfile_asf_asfindexobject['index_blocks_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); $offset += 4; $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count']); for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); $offset += 2; $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number'] = $IndexSpecifierStreamNumber; $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); $offset += 2; $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']); } $ASFIndexObjectData .= $this->fread(4); $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); $offset += 4; $ASFIndexObjectData .= $this->fread(8 * $thisfile_asf_asfindexobject['index_specifiers_count']); for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8)); $offset += 8; } $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']); for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) { for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); $offset += 4; } } break; default: if ($this->GUIDname($NextObjectGUIDtext)) { $this->warning('unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8)); } else { $this->warning('unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.($this->ftell() - 16 - 8)); } $this->fseek(($NextObjectSize - 16 - 8), SEEK_CUR); break; } } if (isset($thisfile_asf_codeclistobject['codec_entries']) && is_array($thisfile_asf_codeclistobject['codec_entries'])) { foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { switch ($streamdata['information']) { case 'WMV1': case 'WMV2': case 'WMV3': case 'MSS1': case 'MSS2': case 'WMVA': case 'WVC1': case 'WMVP': case 'WVP2': $thisfile_video['dataformat'] = 'wmv'; $info['mime_type'] = 'video/x-ms-wmv'; break; case 'MP42': case 'MP43': case 'MP4S': case 'mp4s': $thisfile_video['dataformat'] = 'asf'; $info['mime_type'] = 'video/x-ms-asf'; break; default: switch ($streamdata['type_raw']) { case 1: if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { $thisfile_video['dataformat'] = 'wmv'; if ($info['mime_type'] == 'video/x-ms-asf') { $info['mime_type'] = 'video/x-ms-wmv'; } } break; case 2: if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { $thisfile_audio['dataformat'] = 'wma'; if ($info['mime_type'] == 'video/x-ms-asf') { $info['mime_type'] = 'audio/x-ms-wma'; } } break; } break; } } } switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') { case 'MPEG Layer-3': $thisfile_audio['dataformat'] = 'mp3'; break; default: break; } if (isset($thisfile_asf_codeclistobject['codec_entries'])) { foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { switch ($streamdata['type_raw']) { case 1: $thisfile_video['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); break; case 2: $thisfile_audio['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']); $thisfile_audio['codec'] = $thisfile_audio['encoder']; break; default: $this->warning('Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.'][type_raw] == '.$streamdata['type_raw']); break; } } } if (isset($info['audio'])) { $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); } if (!empty($thisfile_video['dataformat'])) { $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1); $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); } if (!empty($thisfile_video['streams'])) { $thisfile_video['resolution_x'] = 0; $thisfile_video['resolution_y'] = 0; foreach ($thisfile_video['streams'] as $key => $valuearray) { if (($valuearray['resolution_x'] > $thisfile_video['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['resolution_y'])) { $thisfile_video['resolution_x'] = $valuearray['resolution_x']; $thisfile_video['resolution_y'] = $valuearray['resolution_y']; } } } $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0); if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { $info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8); } return true; } public static function codecListObjectTypeLookup($CodecListType) { static $lookup = array( 0x0001 => 'Video Codec', 0x0002 => 'Audio Codec', 0xFFFF => 'Unknown Codec' ); return (isset($lookup[$CodecListType]) ? $lookup[$CodecListType] : 'Invalid Codec Type'); } public static function KnownGUIDs() { static $GUIDarray = array( 'GETID3_ASF_Extended_Stream_Properties_Object' => '14E6A5CB-C672-4332-8399-A96952065B5A', 'GETID3_ASF_Padding_Object' => '1806D474-CADF-4509-A4BA-9AABCB96AAE8', 'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' => '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8', 'GETID3_ASF_Script_Command_Object' => '1EFB1A30-0B62-11D0-A39B-00A0C90348F6', 'GETID3_ASF_No_Error_Correction' => '20FB5700-5B55-11CF-A8FD-00805F5C442B', 'GETID3_ASF_Content_Branding_Object' => '2211B3FA-BD23-11D2-B4B7-00A0C955FC6E', 'GETID3_ASF_Content_Encryption_Object' => '2211B3FB-BD23-11D2-B4B7-00A0C955FC6E', 'GETID3_ASF_Digital_Signature_Object' => '2211B3FC-BD23-11D2-B4B7-00A0C955FC6E', 'GETID3_ASF_Extended_Content_Encryption_Object' => '298AE614-2622-4C17-B935-DAE07EE9289C', 'GETID3_ASF_Simple_Index_Object' => '33000890-E5B1-11CF-89F4-00A0C90349CB', 'GETID3_ASF_Degradable_JPEG_Media' => '35907DE0-E415-11CF-A917-00805F5C442B', 'GETID3_ASF_Payload_Extension_System_Timecode' => '399595EC-8667-4E2D-8FDB-98814CE76C1E', 'GETID3_ASF_Binary_Media' => '3AFB65E2-47EF-40F2-AC2C-70A90D71D343', 'GETID3_ASF_Timecode_Index_Object' => '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C', 'GETID3_ASF_Metadata_Library_Object' => '44231C94-9498-49D1-A141-1D134E457054', 'GETID3_ASF_Reserved_3' => '4B1ACBE3-100B-11D0-A39B-00A0C90348F6', 'GETID3_ASF_Reserved_4' => '4CFEDB20-75F6-11CF-9C0F-00A0C90349CB', 'GETID3_ASF_Command_Media' => '59DACFC0-59E6-11D0-A3AC-00A0C90348F6', 'GETID3_ASF_Header_Extension_Object' => '5FBF03B5-A92E-11CF-8EE3-00C00C205365', 'GETID3_ASF_Media_Object_Index_Parameters_Obj' => '6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7', 'GETID3_ASF_Header_Object' => '75B22630-668E-11CF-A6D9-00AA0062CE6C', 'GETID3_ASF_Content_Description_Object' => '75B22633-668E-11CF-A6D9-00AA0062CE6C', 'GETID3_ASF_Error_Correction_Object' => '75B22635-668E-11CF-A6D9-00AA0062CE6C', 'GETID3_ASF_Data_Object' => '75B22636-668E-11CF-A6D9-00AA0062CE6C', 'GETID3_ASF_Web_Stream_Media_Subtype' => '776257D4-C627-41CB-8F81-7AC7FF1C40CC', 'GETID3_ASF_Stream_Bitrate_Properties_Object' => '7BF875CE-468D-11D1-8D82-006097C9A2B2', 'GETID3_ASF_Language_List_Object' => '7C4346A9-EFE0-4BFC-B229-393EDE415C85', 'GETID3_ASF_Codec_List_Object' => '86D15240-311D-11D0-A3A4-00A0C90348F6', 'GETID3_ASF_Reserved_2' => '86D15241-311D-11D0-A3A4-00A0C90348F6', 'GETID3_ASF_File_Properties_Object' => '8CABDCA1-A947-11CF-8EE4-00C00C205365', 'GETID3_ASF_File_Transfer_Media' => '91BD222C-F21C-497A-8B6D-5AA86BFC0185', 'GETID3_ASF_Old_RTP_Extension_Data' => '96800C63-4C94-11D1-837B-0080C7A37F95', 'GETID3_ASF_Advanced_Mutual_Exclusion_Object' => 'A08649CF-4775-4670-8A16-6E35357566CD', 'GETID3_ASF_Bandwidth_Sharing_Object' => 'A69609E6-517B-11D2-B6AF-00C04FD908E9', 'GETID3_ASF_Reserved_1' => 'ABD3D211-A9BA-11cf-8EE6-00C00C205365', 'GETID3_ASF_Bandwidth_Sharing_Exclusive' => 'AF6060AA-5197-11D2-B6AF-00C04FD908E9', 'GETID3_ASF_Bandwidth_Sharing_Partial' => 'AF6060AB-5197-11D2-B6AF-00C04FD908E9', 'GETID3_ASF_JFIF_Media' => 'B61BE100-5B4E-11CF-A8FD-00805F5C442B', 'GETID3_ASF_Stream_Properties_Object' => 'B7DC0791-A9B7-11CF-8EE6-00C00C205365', 'GETID3_ASF_Video_Media' => 'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B', 'GETID3_ASF_Audio_Spread' => 'BFC3CD50-618F-11CF-8BB2-00AA00B4E220', 'GETID3_ASF_Metadata_Object' => 'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA', 'GETID3_ASF_Payload_Ext_Syst_Sample_Duration' => 'C6BD9450-867F-4907-83A3-C77921B733AD', 'GETID3_ASF_Group_Mutual_Exclusion_Object' => 'D1465A40-5A79-4338-B71B-E36B8FD6C249', 'GETID3_ASF_Extended_Content_Description_Object' => 'D2D0A440-E307-11D2-97F0-00A0C95EA850', 'GETID3_ASF_Stream_Prioritization_Object' => 'D4FED15B-88D3-454F-81F0-ED5C45999E24', 'GETID3_ASF_Payload_Ext_System_Content_Type' => 'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC', 'GETID3_ASF_Old_File_Properties_Object' => 'D6E229D0-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_ASF_Header_Object' => 'D6E229D1-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_ASF_Data_Object' => 'D6E229D2-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Index_Object' => 'D6E229D3-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Stream_Properties_Object' => 'D6E229D4-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Content_Description_Object' => 'D6E229D5-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Script_Command_Object' => 'D6E229D6-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Marker_Object' => 'D6E229D7-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Component_Download_Object' => 'D6E229D8-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Stream_Group_Object' => 'D6E229D9-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Scalable_Object' => 'D6E229DA-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Prioritization_Object' => 'D6E229DB-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Bitrate_Mutual_Exclusion_Object' => 'D6E229DC-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Inter_Media_Dependency_Object' => 'D6E229DD-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Rating_Object' => 'D6E229DE-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Index_Parameters_Object' => 'D6E229DF-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Color_Table_Object' => 'D6E229E0-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Language_List_Object' => 'D6E229E1-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Audio_Media' => 'D6E229E2-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Video_Media' => 'D6E229E3-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Image_Media' => 'D6E229E4-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Timecode_Media' => 'D6E229E5-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Text_Media' => 'D6E229E6-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_MIDI_Media' => 'D6E229E7-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Command_Media' => 'D6E229E8-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_No_Error_Concealment' => 'D6E229EA-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Scrambled_Audio' => 'D6E229EB-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_No_Color_Table' => 'D6E229EC-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_SMPTE_Time' => 'D6E229ED-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_ASCII_Text' => 'D6E229EE-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Unicode_Text' => 'D6E229EF-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_HTML_Text' => 'D6E229F0-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_URL_Command' => 'D6E229F1-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Filename_Command' => 'D6E229F2-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_ACM_Codec' => 'D6E229F3-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_VCM_Codec' => 'D6E229F4-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_QuickTime_Codec' => 'D6E229F5-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_DirectShow_Transform_Filter' => 'D6E229F6-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_DirectShow_Rendering_Filter' => 'D6E229F7-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_No_Enhancement' => 'D6E229F8-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Unknown_Enhancement_Type' => 'D6E229F9-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Temporal_Enhancement' => 'D6E229FA-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Spatial_Enhancement' => 'D6E229FB-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Quality_Enhancement' => 'D6E229FC-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Number_of_Channels_Enhancement' => 'D6E229FD-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Frequency_Response_Enhancement' => 'D6E229FE-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Media_Object' => 'D6E229FF-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Mutex_Language' => 'D6E22A00-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Mutex_Bitrate' => 'D6E22A01-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Mutex_Unknown' => 'D6E22A02-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_ASF_Placeholder_Object' => 'D6E22A0E-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Old_Data_Unit_Extension_Object' => 'D6E22A0F-35DA-11D1-9034-00A0C90349BE', 'GETID3_ASF_Web_Stream_Format' => 'DA1E6B13-8359-4050-B398-388E965BF00C', 'GETID3_ASF_Payload_Ext_System_File_Name' => 'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B', 'GETID3_ASF_Marker_Object' => 'F487CD01-A951-11CF-8EE6-00C00C205365', 'GETID3_ASF_Timecode_Index_Parameters_Object' => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24', 'GETID3_ASF_Audio_Media' => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B', 'GETID3_ASF_Media_Object_Index_Object' => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C', 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE', 'GETID3_ASF_Index_Placeholder_Object' => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', 'GETID3_ASF_Compatibility_Object' => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', ); return $GUIDarray; } public static function GUIDname($GUIDstring) { static $GUIDarray = array(); if (empty($GUIDarray)) { $GUIDarray = self::KnownGUIDs(); } return array_search($GUIDstring, $GUIDarray); } public static function ASFIndexObjectIndexTypeLookup($id) { static $ASFIndexObjectIndexTypeLookup = array(); if (empty($ASFIndexObjectIndexTypeLookup)) { $ASFIndexObjectIndexTypeLookup[1] = 'Nearest Past Data Packet'; $ASFIndexObjectIndexTypeLookup[2] = 'Nearest Past Media Object'; $ASFIndexObjectIndexTypeLookup[3] = 'Nearest Past Cleanpoint'; } return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] : 'invalid'); } public static function GUIDtoBytestring($GUIDstring) { $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2))); $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2))); return $hexbytecharstring; } public static function BytestringToGUID($Bytestring) { $GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; $GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; $GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; $GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT); $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT); return strtoupper($GUIDstring); } public static function FILETIMEtoUNIXtime($FILETIME, $round=true) { if ($round) { return intval(round(($FILETIME - 116444736000000000) / 10000000)); } return ($FILETIME - 116444736000000000) / 10000000; } public static function WMpictureTypeLookup($WMpictureType) { static $lookup = null; if ($lookup === null) { $lookup = array( 0x03 => 'Front Cover', 0x04 => 'Back Cover', 0x00 => 'User Defined', 0x05 => 'Leaflet Page', 0x06 => 'Media Label', 0x07 => 'Lead Artist', 0x08 => 'Artist', 0x09 => 'Conductor', 0x0A => 'Band', 0x0B => 'Composer', 0x0C => 'Lyricist', 0x0D => 'Recording Location', 0x0E => 'During Recording', 0x0F => 'During Performance', 0x10 => 'Video Screen Capture', 0x12 => 'Illustration', 0x13 => 'Band Logotype', 0x14 => 'Publisher Logotype' ); $lookup = array_map(function($str) { return getid3_lib::iconv_fallback('UTF-8', 'UTF-16LE', $str); }, $lookup); } return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : ''); } public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { $offset = 0; $objectOffset = 0; $HeaderExtensionObjectParsed = array(); while ($objectOffset < strlen($asf_header_extension_object_data)) { $offset = $objectOffset; $thisObject = array(); $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); $offset += 16; $thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']); $thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']); $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); $offset += 8; if ($thisObject['size'] <= 0) { break; } switch ($thisObject['guid']) { case GETID3_ASF_Extended_Stream_Properties_Object: $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); $offset += 8; $thisObject['start_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['start_time']); $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); $offset += 8; $thisObject['end_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['end_time']); $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['flags']['reliable'] = (bool) $thisObject['flags_raw'] & 0x00000001; $thisObject['flags']['seekable'] = (bool) $thisObject['flags_raw'] & 0x00000002; $thisObject['flags']['no_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000004; $thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008; $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; for ($i = 0; $i < $thisObject['stream_name_count']; $i++) { $streamName = array(); $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); $offset += $streamName['stream_name_length']; $thisObject['stream_names'][$i] = $streamName; } for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) { $payloadExtensionSystem = array(); $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); $offset += 16; $payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']); $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; if ($payloadExtensionSystem['extension_system_size'] <= 0) { break 2; } $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); $offset += $payloadExtensionSystem['extension_system_info_length']; $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem; } break; case GETID3_ASF_Padding_Object: break; case GETID3_ASF_Metadata_Object: $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; for ($i = 0; $i < $thisObject['description_record_counts']; $i++) { $descriptionRecord = array(); $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); $offset += $descriptionRecord['name_length']; $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); $offset += $descriptionRecord['data_length']; switch ($descriptionRecord['data_type']) { case 0x0000: break; case 0x0001: break; case 0x0002: $descriptionRecord['data'] = (bool) getid3_lib::LittleEndian2Int($descriptionRecord['data']); break; case 0x0003: case 0x0004: case 0x0005: $descriptionRecord['data'] = getid3_lib::LittleEndian2Int($descriptionRecord['data']); break; case 0x0006: $descriptionRecord['data_text'] = $this->BytestringToGUID($descriptionRecord['data']); break; } $thisObject['description_record'][$i] = $descriptionRecord; } break; case GETID3_ASF_Language_List_Object: $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) { $languageIDrecord = array(); $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); $offset += 1; $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); $offset += $languageIDrecord['language_id_length']; $thisObject['language_id_record'][$i] = $languageIDrecord; } break; case GETID3_ASF_Metadata_Library_Object: $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; for ($i = 0; $i < $thisObject['description_records_count']; $i++) { $descriptionRecord = array(); $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); $offset += 2; $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); $offset += 4; $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); $offset += $descriptionRecord['name_length']; $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); $offset += $descriptionRecord['data_length']; if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) { $WMpicture = $this->ASF_WMpicture($descriptionRecord['data']); foreach ($WMpicture as $key => $value) { $descriptionRecord['data'] = $WMpicture; } unset($WMpicture); } $thisObject['description_record'][$i] = $descriptionRecord; } break; default: $unhandled_sections++; if ($this->GUIDname($thisObject['guid_text'])) { $this->warning('unhandled Header Extension Object GUID "'.$this->GUIDname($thisObject['guid_text']).'" {'.$thisObject['guid_text'].'} at offset '.($offset - 16 - 8)); } else { $this->warning('unknown Header Extension Object GUID {'.$thisObject['guid_text'].'} in at offset '.($offset - 16 - 8)); } break; } $HeaderExtensionObjectParsed[] = $thisObject; $objectOffset += $thisObject['size']; } return $HeaderExtensionObjectParsed; } public static function metadataLibraryObjectDataTypeLookup($id) { static $lookup = array( 0x0000 => 'Unicode string', 0x0001 => 'BYTE array', 0x0002 => 'BOOL', 0x0003 => 'DWORD', 0x0004 => 'QWORD', 0x0005 => 'WORD', 0x0006 => 'GUID', ); return (isset($lookup[$id]) ? $lookup[$id] : 'invalid'); } public function ASF_WMpicture(&$data) { $WMpicture = array(); $offset = 0; $WMpicture['image_type_id'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 1)); $offset += 1; $WMpicture['image_type'] = self::WMpictureTypeLookup($WMpicture['image_type_id']); $WMpicture['image_size'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 4)); $offset += 4; $WMpicture['image_mime'] = ''; do { $next_byte_pair = substr($data, $offset, 2); $offset += 2; $WMpicture['image_mime'] .= $next_byte_pair; } while ($next_byte_pair !== "\x00\x00"); $WMpicture['image_description'] = ''; do { $next_byte_pair = substr($data, $offset, 2); $offset += 2; $WMpicture['image_description'] .= $next_byte_pair; } while ($next_byte_pair !== "\x00\x00"); $WMpicture['dataoffset'] = $offset; $WMpicture['data'] = substr($data, $offset); $imageinfo = array(); $WMpicture['image_mime'] = ''; $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo); unset($imageinfo); if (!empty($imagechunkcheck)) { $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); } if (!isset($this->getid3->info['asf']['comments']['picture'])) { $this->getid3->info['asf']['comments']['picture'] = array(); } $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']); return $WMpicture; } public static function TrimConvert($string) { return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', self::TrimTerm($string)), ' '); } public static function TrimTerm($string) { if (substr($string, -2) === "\x00\x00") { $string = substr($string, 0, -2); } return $string; } } getid3->info; $this->fseek($info['avdataoffset']); $FLVdataLength = $info['avdataend'] - $info['avdataoffset']; $FLVheader = $this->fread(5); $info['fileformat'] = 'flv'; $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1)); $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); if ($info['flv']['header']['signature'] != self::magic) { $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"'); unset($info['flv'], $info['fileformat']); return false; } $info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04); $info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01); $FrameSizeDataLength = getid3_lib::BigEndian2Int($this->fread(4)); $FLVheaderFrameLength = 9; if ($FrameSizeDataLength > $FLVheaderFrameLength) { $this->fseek($FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR); } $Duration = 0; $found_video = false; $found_audio = false; $found_meta = false; $found_valid_meta_playtime = false; $tagParseCount = 0; $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0); $flv_framecount = &$info['flv']['framecount']; while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) { $ThisTagHeader = $this->fread(16); $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1)); $NextOffset = $this->ftell() - 1 + $DataLength; if ($Timestamp > $Duration) { $Duration = $Timestamp; } $flv_framecount['total']++; switch ($TagType) { case GETID3_FLV_TAG_AUDIO: $flv_framecount['audio']++; if (!$found_audio) { $found_audio = true; $info['flv']['audio']['audioFormat'] = ($LastHeaderByte >> 4) & 0x0F; $info['flv']['audio']['audioRate'] = ($LastHeaderByte >> 2) & 0x03; $info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01; $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; } break; case GETID3_FLV_TAG_VIDEO: $flv_framecount['video']++; if (!$found_video) { $found_video = true; $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07; $FLVvideoHeader = $this->fread(11); $PictureSizeEnc = array(); if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) { $AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1)); if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) { $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); if (($numOfSequenceParameterSets & 0x1F) != 0) { $spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2)); $sps = $this->fread($spsSize); if (strlen($sps) == $spsSize) { $spsReader = new AVCSequenceParameterSetReader($sps); $spsReader->readData(); $info['video']['resolution_x'] = $spsReader->getWidth(); $info['video']['resolution_y'] = $spsReader->getHeight(); } } } } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H263) { $PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7; $PictureSizeType = $PictureSizeType & 0x0007; $info['flv']['header']['videoSizeType'] = $PictureSizeType; switch ($PictureSizeType) { case 0: $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2)) >> 7; $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)) >> 7; $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF; $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF; break; case 1: $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3)) >> 7; $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3)) >> 7; $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF; $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF; break; case 2: $info['video']['resolution_x'] = 352; $info['video']['resolution_y'] = 288; break; case 3: $info['video']['resolution_x'] = 176; $info['video']['resolution_y'] = 144; break; case 4: $info['video']['resolution_x'] = 128; $info['video']['resolution_y'] = 96; break; case 5: $info['video']['resolution_x'] = 320; $info['video']['resolution_y'] = 240; break; case 6: $info['video']['resolution_x'] = 160; $info['video']['resolution_y'] = 120; break; default: $info['video']['resolution_x'] = 0; $info['video']['resolution_y'] = 0; break; } } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { if (!isset($info['video']['resolution_x'])) { $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2)); $info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3; $info['video']['resolution_y'] = ($PictureSizeEnc['y'] & 0xFF) << 3; } } if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) { $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y']; } } break; case GETID3_FLV_TAG_META: if (!$found_meta) { $found_meta = true; $this->fseek(-1, SEEK_CUR); $datachunk = $this->fread($DataLength); $AMFstream = new AMFStream($datachunk); $reader = new AMFReader($AMFstream); $eventName = $reader->readData(); $info['flv']['meta'][$eventName] = $reader->readData(); unset($reader); $copykeys = array('framerate'=>'frame_rate', 'width'=>'resolution_x', 'height'=>'resolution_y', 'audiodatarate'=>'bitrate', 'videodatarate'=>'bitrate'); foreach ($copykeys as $sourcekey => $destkey) { if (isset($info['flv']['meta']['onMetaData'][$sourcekey])) { switch ($sourcekey) { case 'width': case 'height': $info['video'][$destkey] = intval(round($info['flv']['meta']['onMetaData'][$sourcekey])); break; case 'audiodatarate': $info['audio'][$destkey] = getid3_lib::CastAsInt(round($info['flv']['meta']['onMetaData'][$sourcekey] * 1000)); break; case 'videodatarate': case 'frame_rate': default: $info['video'][$destkey] = $info['flv']['meta']['onMetaData'][$sourcekey]; break; } } } if (!empty($info['flv']['meta']['onMetaData']['duration'])) { $found_valid_meta_playtime = true; } } break; default: break; } $this->fseek($NextOffset); } $info['playtime_seconds'] = $Duration / 1000; if ($info['playtime_seconds'] > 0) { $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } if ($info['flv']['header']['hasAudio']) { $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); $info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']); $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); $info['audio']['dataformat'] = 'flv'; } if (!empty($info['flv']['header']['hasVideo'])) { $info['video']['codec'] = self::videoCodecLookup($info['flv']['video']['videoCodec']); $info['video']['dataformat'] = 'flv'; $info['video']['lossless'] = false; } if (!empty($info['flv']['meta']['onMetaData']['duration'])) { $info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration']; $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) { $info['audio']['codec'] = self::audioFormatLookup($info['flv']['meta']['onMetaData']['audiocodecid']); } if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) { $info['video']['codec'] = self::videoCodecLookup($info['flv']['meta']['onMetaData']['videocodecid']); } return true; } public static function audioFormatLookup($id) { static $lookup = array( 0 => 'Linear PCM, platform endian', 1 => 'ADPCM', 2 => 'mp3', 3 => 'Linear PCM, little endian', 4 => 'Nellymoser 16kHz mono', 5 => 'Nellymoser 8kHz mono', 6 => 'Nellymoser', 7 => 'G.711A-law logarithmic PCM', 8 => 'G.711 mu-law logarithmic PCM', 9 => 'reserved', 10 => 'AAC', 11 => 'Speex', 12 => false, 13 => false, 14 => 'mp3 8kHz', 15 => 'Device-specific sound', ); return (isset($lookup[$id]) ? $lookup[$id] : false); } public static function audioRateLookup($id) { static $lookup = array( 0 => 5500, 1 => 11025, 2 => 22050, 3 => 44100, ); return (isset($lookup[$id]) ? $lookup[$id] : false); } public static function audioBitDepthLookup($id) { static $lookup = array( 0 => 8, 1 => 16, ); return (isset($lookup[$id]) ? $lookup[$id] : false); } public static function videoCodecLookup($id) { static $lookup = array( GETID3_FLV_VIDEO_H263 => 'Sorenson H.263', GETID3_FLV_VIDEO_SCREEN => 'Screen video', GETID3_FLV_VIDEO_VP6FLV => 'On2 VP6', GETID3_FLV_VIDEO_VP6FLV_ALPHA => 'On2 VP6 with alpha channel', GETID3_FLV_VIDEO_SCREENV2 => 'Screen video v2', GETID3_FLV_VIDEO_H264 => 'Sorenson H.264', ); return (isset($lookup[$id]) ? $lookup[$id] : false); } } class AMFStream { public $bytes; public $pos; public function __construct(&$bytes) { $this->bytes =& $bytes; $this->pos = 0; } public function readByte() { return ord(substr($this->bytes, $this->pos++, 1)); } public function readInt() { return ($this->readByte() << 8) + $this->readByte(); } public function readLong() { return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); } public function readDouble() { return getid3_lib::BigEndian2Float($this->read(8)); } public function readUTF() { $length = $this->readInt(); return $this->read($length); } public function readLongUTF() { $length = $this->readLong(); return $this->read($length); } public function read($length) { $val = substr($this->bytes, $this->pos, $length); $this->pos += $length; return $val; } public function peekByte() { $pos = $this->pos; $val = $this->readByte(); $this->pos = $pos; return $val; } public function peekInt() { $pos = $this->pos; $val = $this->readInt(); $this->pos = $pos; return $val; } public function peekLong() { $pos = $this->pos; $val = $this->readLong(); $this->pos = $pos; return $val; } public function peekDouble() { $pos = $this->pos; $val = $this->readDouble(); $this->pos = $pos; return $val; } public function peekUTF() { $pos = $this->pos; $val = $this->readUTF(); $this->pos = $pos; return $val; } public function peekLongUTF() { $pos = $this->pos; $val = $this->readLongUTF(); $this->pos = $pos; return $val; } } class AMFReader { public $stream; public function __construct(AMFStream $stream) { $this->stream = $stream; } public function readData() { $value = null; $type = $this->stream->readByte(); switch ($type) { case 0: $value = $this->readDouble(); break; case 1: $value = $this->readBoolean(); break; case 2: $value = $this->readString(); break; case 3: $value = $this->readObject(); break; case 6: return null; case 8: $value = $this->readMixedArray(); break; case 10: $value = $this->readArray(); break; case 11: $value = $this->readDate(); break; case 13: $value = $this->readLongString(); break; case 15: $value = $this->readXML(); break; case 16: $value = $this->readTypedObject(); break; default: $value = '(unknown or unsupported data type)'; break; } return $value; } public function readDouble() { return $this->stream->readDouble(); } public function readBoolean() { return $this->stream->readByte() == 1; } public function readString() { return $this->stream->readUTF(); } public function readObject() { $data = array(); $key = null; while ($key = $this->stream->readUTF()) { $data[$key] = $this->readData(); } if (($key == '') && ($this->stream->peekByte() == 0x09)) { $this->stream->readByte(); } return $data; } public function readMixedArray() { $highestIndex = $this->stream->readLong(); $data = array(); $key = null; while ($key = $this->stream->readUTF()) { if (is_numeric($key)) { $key = (int) $key; } $data[$key] = $this->readData(); } if (($key == '') && ($this->stream->peekByte() == 0x09)) { $this->stream->readByte(); } return $data; } public function readArray() { $length = $this->stream->readLong(); $data = array(); for ($i = 0; $i < $length; $i++) { $data[] = $this->readData(); } return $data; } public function readDate() { $timestamp = $this->stream->readDouble(); $timezone = $this->stream->readInt(); return $timestamp; } public function readLongString() { return $this->stream->readLongUTF(); } public function readXML() { return $this->stream->readLongUTF(); } public function readTypedObject() { $className = $this->stream->readUTF(); return $this->readObject(); } } class AVCSequenceParameterSetReader { public $sps; public $start = 0; public $currentBytes = 0; public $currentBits = 0; public $width; public $height; public function __construct($sps) { $this->sps = $sps; } public function readData() { $this->skipBits(8); $this->skipBits(8); $profile = $this->getBits(8); if ($profile > 0) { $this->skipBits(8); $level_idc = $this->getBits(8); $this->expGolombUe(); $this->expGolombUe(); $picOrderType = $this->expGolombUe(); if ($picOrderType == 0) { $this->expGolombUe(); } elseif ($picOrderType == 1) { $this->skipBits(1); $this->expGolombSe(); $this->expGolombSe(); $num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) { $this->expGolombSe(); } } $this->expGolombUe(); $this->skipBits(1); $pic_width_in_mbs_minus1 = $this->expGolombUe(); $pic_height_in_map_units_minus1 = $this->expGolombUe(); $frame_mbs_only_flag = $this->getBits(1); if ($frame_mbs_only_flag == 0) { $this->skipBits(1); } $this->skipBits(1); $frame_cropping_flag = $this->getBits(1); $frame_crop_left_offset = 0; $frame_crop_right_offset = 0; $frame_crop_top_offset = 0; $frame_crop_bottom_offset = 0; if ($frame_cropping_flag) { $frame_crop_left_offset = $this->expGolombUe(); $frame_crop_right_offset = $this->expGolombUe(); $frame_crop_top_offset = $this->expGolombUe(); $frame_crop_bottom_offset = $this->expGolombUe(); } $this->skipBits(1); $this->width = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2); $this->height = ((2 - $frame_mbs_only_flag) * ($pic_height_in_map_units_minus1 + 1) * 16) - ($frame_crop_top_offset * 2) - ($frame_crop_bottom_offset * 2); } } public function skipBits($bits) { $newBits = $this->currentBits + $bits; $this->currentBytes += (int)floor($newBits / 8); $this->currentBits = $newBits % 8; } public function getBit() { $result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01; $this->skipBits(1); return $result; } public function getBits($bits) { $result = 0; for ($i = 0; $i < $bits; $i++) { $result = ($result << 1) + $this->getBit(); } return $result; } public function expGolombUe() { $significantBits = 0; $bit = $this->getBit(); while ($bit == 0) { $significantBits++; $bit = $this->getBit(); if ($significantBits > 31) { return 0; } } return (1 << $significantBits) + $this->getBits($significantBits) - 1; } public function expGolombSe() { $result = $this->expGolombUe(); if (($result & 0x01) == 0) { return -($result >> 1); } else { return ($result + 1) >> 1; } } public function getWidth() { return $this->width; } public function getHeight() { return $this->height; } } exceptions = (bool) $exceptions; } $this->Debugoutput = (strpos(PHP_SAPI, 'cli') !== false ? 'echo' : 'html'); } public function __destruct() { $this->smtpClose(); } private function mailPassthru($to, $subject, $body, $header, $params) { if (ini_get('mbstring.func_overload') & 1) { $subject = $this->secureHeader($subject); } else { $subject = $this->encodeHeader($this->secureHeader($subject)); } $this->edebug('Sending with mail()'); $this->edebug('Sendmail path: ' . ini_get('sendmail_path')); $this->edebug("Envelope sender: {$this->Sender}"); $this->edebug("To: {$to}"); $this->edebug("Subject: {$subject}"); $this->edebug("Headers: {$header}"); if (!$this->UseSendmailOptions || null === $params) { $result = @mail($to, $subject, $body, $header); } else { $this->edebug("Additional params: {$params}"); $result = @mail($to, $subject, $body, $header, $params); } $this->edebug('Result: ' . ($result ? 'true' : 'false')); return $result; } protected function edebug($str) { if ($this->SMTPDebug <= 0) { return; } if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) { $this->Debugoutput->debug($str); return; } if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, ['error_log', 'html', 'echo'])) { call_user_func($this->Debugoutput, $str, $this->SMTPDebug); return; } switch ($this->Debugoutput) { case 'error_log': error_log($str); break; case 'html': echo htmlentities( preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 'UTF-8' ), "
                \n"; break; case 'echo': default: $str = preg_replace('/\r\n|\r/m', "\n", $str); echo gmdate('Y-m-d H:i:s'), "\t", trim( str_replace( "\n", "\n \t ", trim($str) ) ), "\n"; } } public function isHTML($isHtml = true) { if ($isHtml) { $this->ContentType = static::CONTENT_TYPE_TEXT_HTML; } else { $this->ContentType = static::CONTENT_TYPE_PLAINTEXT; } } public function isSMTP() { $this->Mailer = 'smtp'; } public function isMail() { $this->Mailer = 'mail'; } public function isSendmail() { $ini_sendmail_path = ini_get('sendmail_path'); if (false === stripos($ini_sendmail_path, 'sendmail')) { $this->Sendmail = '/usr/sbin/sendmail'; } else { $this->Sendmail = $ini_sendmail_path; } $this->Mailer = 'sendmail'; } public function isQmail() { $ini_sendmail_path = ini_get('sendmail_path'); if (false === stripos($ini_sendmail_path, 'qmail')) { $this->Sendmail = '/var/qmail/bin/qmail-inject'; } else { $this->Sendmail = $ini_sendmail_path; } $this->Mailer = 'qmail'; } public function addAddress($address, $name = '') { return $this->addOrEnqueueAnAddress('to', $address, $name); } public function addCC($address, $name = '') { return $this->addOrEnqueueAnAddress('cc', $address, $name); } public function addBCC($address, $name = '') { return $this->addOrEnqueueAnAddress('bcc', $address, $name); } public function addReplyTo($address, $name = '') { return $this->addOrEnqueueAnAddress('Reply-To', $address, $name); } protected function addOrEnqueueAnAddress($kind, $address, $name) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); $pos = strrpos($address, '@'); if (false === $pos) { $error_message = sprintf( '%s (%s): %s', $this->lang('invalid_address'), $kind, $address ); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { throw new Exception($error_message); } return false; } $params = [$kind, $address, $name]; if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) { if ('Reply-To' !== $kind) { if (!array_key_exists($address, $this->RecipientsQueue)) { $this->RecipientsQueue[$address] = $params; return true; } } elseif (!array_key_exists($address, $this->ReplyToQueue)) { $this->ReplyToQueue[$address] = $params; return true; } return false; } return call_user_func_array([$this, 'addAnAddress'], $params); } protected function addAnAddress($kind, $address, $name = '') { if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) { $error_message = sprintf( '%s: %s', $this->lang('Invalid recipient kind'), $kind ); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { throw new Exception($error_message); } return false; } if (!static::validateAddress($address)) { $error_message = sprintf( '%s (%s): %s', $this->lang('invalid_address'), $kind, $address ); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { throw new Exception($error_message); } return false; } if ('Reply-To' !== $kind) { if (!array_key_exists(strtolower($address), $this->all_recipients)) { $this->{$kind}[] = [$address, $name]; $this->all_recipients[strtolower($address)] = true; return true; } } elseif (!array_key_exists(strtolower($address), $this->ReplyTo)) { $this->ReplyTo[strtolower($address)] = [$address, $name]; return true; } return false; } public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) { $addresses = []; if ($useimap && function_exists('imap_rfc822_parse_adrlist')) { $list = imap_rfc822_parse_adrlist($addrstr, ''); imap_errors(); foreach ($list as $address) { if ( '.SYNTAX-ERROR.' !== $address->host && static::validateAddress($address->mailbox . '@' . $address->host) ) { if ( property_exists($address, 'personal') && defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $address->personal) ) { $origCharset = mb_internal_encoding(); mb_internal_encoding($charset); $address->personal = str_replace('_', '=20', $address->personal); $address->personal = mb_decode_mimeheader($address->personal); mb_internal_encoding($origCharset); } $addresses[] = [ 'name' => (property_exists($address, 'personal') ? $address->personal : ''), 'address' => $address->mailbox . '@' . $address->host, ]; } } } else { $list = explode(',', $addrstr); foreach ($list as $address) { $address = trim($address); if (strpos($address, '<') === false) { if (static::validateAddress($address)) { $addresses[] = [ 'name' => '', 'address' => $address, ]; } } else { list($name, $email) = explode('<', $address); $email = trim(str_replace('>', '', $email)); $name = trim($name); if (static::validateAddress($email)) { if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) { $origCharset = mb_internal_encoding(); mb_internal_encoding($charset); $name = str_replace('_', '=20', $name); $name = mb_decode_mimeheader($name); mb_internal_encoding($origCharset); } $addresses[] = [ 'name' => trim($name, '\'" '), 'address' => $email, ]; } } } } return $addresses; } public function setFrom($address, $name = '', $auto = true) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); $pos = strrpos($address, '@'); if ( (false === $pos) || ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported()) && !static::validateAddress($address)) ) { $error_message = sprintf( '%s (From): %s', $this->lang('invalid_address'), $address ); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { throw new Exception($error_message); } return false; } $this->From = $address; $this->FromName = $name; if ($auto && empty($this->Sender)) { $this->Sender = $address; } return true; } public function getLastMessageID() { return $this->lastMessageID; } public static function validateAddress($address, $patternselect = null) { if (null === $patternselect) { $patternselect = static::$validator; } if (is_callable($patternselect) && !is_string($patternselect)) { return call_user_func($patternselect, $address); } if (strpos($address, "\n") !== false || strpos($address, "\r") !== false) { return false; } switch ($patternselect) { case 'pcre': case 'pcre8': return (bool) preg_match( '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address ); case 'html5': return (bool) preg_match( '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address ); case 'php': default: return filter_var($address, FILTER_VALIDATE_EMAIL) !== false; } } public static function idnSupported() { return function_exists('idn_to_ascii') && function_exists('mb_convert_encoding'); } public function punyencodeAddress($address) { $pos = strrpos($address, '@'); if ( !empty($this->CharSet) && false !== $pos && static::idnSupported() ) { $domain = substr($address, ++$pos); if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) { $domain = mb_convert_encoding($domain, self::CHARSET_UTF8, $this->CharSet); $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { $punycode = idn_to_ascii( $domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46 ); } elseif (defined('INTL_IDNA_VARIANT_2003')) { $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003); } else { $punycode = idn_to_ascii($domain, $errorcode); } if (false !== $punycode) { return substr($address, 0, $pos) . $punycode; } } } return $address; } public function send() { try { if (!$this->preSend()) { return false; } return $this->postSend(); } catch (Exception $exc) { $this->mailHeader = ''; $this->setError($exc->getMessage()); if ($this->exceptions) { throw $exc; } return false; } } public function preSend() { if ( 'smtp' === $this->Mailer || ('mail' === $this->Mailer && (\PHP_VERSION_ID >= 80000 || stripos(PHP_OS, 'WIN') === 0)) ) { static::setLE(self::CRLF); } else { static::setLE(PHP_EOL); } if ( 'mail' === $this->Mailer && ((\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70017) || (\PHP_VERSION_ID >= 70100 && \PHP_VERSION_ID < 70103)) && ini_get('mail.add_x_header') === '1' && stripos(PHP_OS, 'WIN') === 0 ) { trigger_error($this->lang('buggy_php'), E_USER_WARNING); } try { $this->error_count = 0; $this->mailHeader = ''; foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) { $params[1] = $this->punyencodeAddress($params[1]); call_user_func_array([$this, 'addAnAddress'], $params); } if (count($this->to) + count($this->cc) + count($this->bcc) < 1) { throw new Exception($this->lang('provide_address'), self::STOP_CRITICAL); } foreach (['From', 'Sender', 'ConfirmReadingTo'] as $address_kind) { $this->$address_kind = trim($this->$address_kind); if (empty($this->$address_kind)) { continue; } $this->$address_kind = $this->punyencodeAddress($this->$address_kind); if (!static::validateAddress($this->$address_kind)) { $error_message = sprintf( '%s (%s): %s', $this->lang('invalid_address'), $address_kind, $this->$address_kind ); $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { throw new Exception($error_message); } return false; } } if ($this->alternativeExists()) { $this->ContentType = static::CONTENT_TYPE_MULTIPART_ALTERNATIVE; } $this->setMessageType(); if (!$this->AllowEmpty && empty($this->Body)) { throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL); } $this->Subject = trim($this->Subject); $this->MIMEHeader = ''; $this->MIMEBody = $this->createBody(); $tempheaders = $this->MIMEHeader; $this->MIMEHeader = $this->createHeader(); $this->MIMEHeader .= $tempheaders; if ('mail' === $this->Mailer) { if (count($this->to) > 0) { $this->mailHeader .= $this->addrAppend('To', $this->to); } else { $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;'); } $this->mailHeader .= $this->headerLine( 'Subject', $this->encodeHeader($this->secureHeader($this->Subject)) ); } if ( !empty($this->DKIM_domain) && !empty($this->DKIM_selector) && (!empty($this->DKIM_private_string) || (!empty($this->DKIM_private) && static::isPermittedPath($this->DKIM_private) && file_exists($this->DKIM_private) ) ) ) { $header_dkim = $this->DKIM_Add( $this->MIMEHeader . $this->mailHeader, $this->encodeHeader($this->secureHeader($this->Subject)), $this->MIMEBody ); $this->MIMEHeader = static::stripTrailingWSP($this->MIMEHeader) . static::$LE . static::normalizeBreaks($header_dkim) . static::$LE; } return true; } catch (Exception $exc) { $this->setError($exc->getMessage()); if ($this->exceptions) { throw $exc; } return false; } } public function postSend() { try { switch ($this->Mailer) { case 'sendmail': case 'qmail': return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); case 'smtp': return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); case 'mail': return $this->mailSend($this->MIMEHeader, $this->MIMEBody); default: $sendMethod = $this->Mailer . 'Send'; if (method_exists($this, $sendMethod)) { return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); } return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (Exception $exc) { if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) { $this->smtp->reset(); } $this->setError($exc->getMessage()); $this->edebug($exc->getMessage()); if ($this->exceptions) { throw $exc; } } return false; } protected function sendmailSend($header, $body) { if ($this->Mailer === 'qmail') { $this->edebug('Sending with qmail'); } else { $this->edebug('Sending with sendmail'); } $header = static::stripTrailingWSP($header) . static::$LE . static::$LE; $sendmail_from_value = ini_get('sendmail_from'); if (empty($this->Sender) && !empty($sendmail_from_value)) { $this->Sender = ini_get('sendmail_from'); } if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) { if ($this->Mailer === 'qmail') { $sendmailFmt = '%s -f%s'; } else { $sendmailFmt = '%s -oi -f%s -t'; } } else { $sendmailFmt = '%s -oi -t'; } $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender); $this->edebug('Sendmail path: ' . $this->Sendmail); $this->edebug('Sendmail command: ' . $sendmail); $this->edebug('Envelope sender: ' . $this->Sender); $this->edebug("Headers: {$header}"); if ($this->SingleTo) { foreach ($this->SingleToArray as $toAddr) { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } $this->edebug("To: {$toAddr}"); fwrite($mail, 'To: ' . $toAddr . "\n"); fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); $this->doCallback( ($result === 0), [[$addrinfo['address'], $addrinfo['name']]], $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); $this->edebug("Result: " . ($result === 0 ? 'true' : 'false')); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } } else { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $this->doCallback( ($result === 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); $this->edebug("Result: " . ($result === 0 ? 'true' : 'false')); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } return true; } protected static function isShellSafe($string) { if (!function_exists('escapeshellarg') || !function_exists('escapeshellcmd')) { return false; } if ( escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), ["'$string'", "\"$string\""]) ) { return false; } $length = strlen($string); for ($i = 0; $i < $length; ++$i) { $c = $string[$i]; if (!ctype_alnum($c) && strpos('@_-.', $c) === false) { return false; } } return true; } protected static function isPermittedPath($path) { return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path); } protected static function fileIsAccessible($path) { if (!static::isPermittedPath($path)) { return false; } $readable = file_exists($path); if (strpos($path, '\\\\') !== 0) { $readable = $readable && is_readable($path); } return $readable; } protected function mailSend($header, $body) { $header = static::stripTrailingWSP($header) . static::$LE . static::$LE; $toArr = []; foreach ($this->to as $toaddr) { $toArr[] = $this->addrFormat($toaddr); } $to = implode(', ', $toArr); $params = null; $sendmail_from_value = ini_get('sendmail_from'); if (empty($this->Sender) && !empty($sendmail_from_value)) { $this->Sender = ini_get('sendmail_from'); } if (!empty($this->Sender) && static::validateAddress($this->Sender)) { if (self::isShellSafe($this->Sender)) { $params = sprintf('-f%s', $this->Sender); } $old_from = ini_get('sendmail_from'); ini_set('sendmail_from', $this->Sender); } $result = false; if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); $this->doCallback( $result, [[$addrinfo['address'], $addrinfo['name']]], $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); } } else { $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []); } if (isset($old_from)) { ini_set('sendmail_from', $old_from); } if (!$result) { throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL); } return true; } public function getSMTPInstance() { if (!is_object($this->smtp)) { $this->smtp = new SMTP(); } return $this->smtp; } public function setSMTPInstance(SMTP $smtp) { $this->smtp = $smtp; return $this->smtp; } protected function smtpSend($header, $body) { $header = static::stripTrailingWSP($header) . static::$LE . static::$LE; $bad_rcpt = []; if (!$this->smtpConnect($this->SMTPOptions)) { throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); } if ('' === $this->Sender) { $smtp_from = $this->From; } else { $smtp_from = $this->Sender; } if (!$this->smtp->mail($smtp_from)) { $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); throw new Exception($this->ErrorInfo, self::STOP_CRITICAL); } $callbacks = []; foreach ([$this->to, $this->cc, $this->bcc] as $togroup) { foreach ($togroup as $to) { if (!$this->smtp->recipient($to[0], $this->dsn)) { $error = $this->smtp->getError(); $bad_rcpt[] = ['to' => $to[0], 'error' => $error['detail']]; $isSent = false; } else { $isSent = true; } $callbacks[] = ['issent' => $isSent, 'to' => $to[0], 'name' => $to[1]]; } } if ((count($this->all_recipients) > count($bad_rcpt)) && !$this->smtp->data($header . $body)) { throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL); } $smtp_transaction_id = $this->smtp->getLastTransactionID(); if ($this->SMTPKeepAlive) { $this->smtp->reset(); } else { $this->smtp->quit(); $this->smtp->close(); } foreach ($callbacks as $cb) { $this->doCallback( $cb['issent'], [[$cb['to'], $cb['name']]], [], [], $this->Subject, $body, $this->From, ['smtp_transaction_id' => $smtp_transaction_id] ); } if (count($bad_rcpt) > 0) { $errstr = ''; foreach ($bad_rcpt as $bad) { $errstr .= $bad['to'] . ': ' . $bad['error']; } throw new Exception($this->lang('recipients_failed') . $errstr, self::STOP_CONTINUE); } return true; } public function smtpConnect($options = null) { if (null === $this->smtp) { $this->smtp = $this->getSMTPInstance(); } if (null === $options) { $options = $this->SMTPOptions; } if ($this->smtp->connected()) { return true; } $this->smtp->setTimeout($this->Timeout); $this->smtp->setDebugLevel($this->SMTPDebug); $this->smtp->setDebugOutput($this->Debugoutput); $this->smtp->setVerp($this->do_verp); $hosts = explode(';', $this->Host); $lastexception = null; foreach ($hosts as $hostentry) { $hostinfo = []; if ( !preg_match( '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/', trim($hostentry), $hostinfo ) ) { $this->edebug($this->lang('invalid_hostentry') . ' ' . trim($hostentry)); continue; } if (!static::isValidHost($hostinfo[2])) { $this->edebug($this->lang('invalid_host') . ' ' . $hostinfo[2]); continue; } $prefix = ''; $secure = $this->SMTPSecure; $tls = (static::ENCRYPTION_STARTTLS === $this->SMTPSecure); if ('ssl' === $hostinfo[1] || ('' === $hostinfo[1] && static::ENCRYPTION_SMTPS === $this->SMTPSecure)) { $prefix = 'ssl://'; $tls = false; $secure = static::ENCRYPTION_SMTPS; } elseif ('tls' === $hostinfo[1]) { $tls = true; $secure = static::ENCRYPTION_STARTTLS; } $sslext = defined('OPENSSL_ALGO_SHA256'); if (static::ENCRYPTION_STARTTLS === $secure || static::ENCRYPTION_SMTPS === $secure) { if (!$sslext) { throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL); } } $host = $hostinfo[2]; $port = $this->Port; if ( array_key_exists(3, $hostinfo) && is_numeric($hostinfo[3]) && $hostinfo[3] > 0 && $hostinfo[3] < 65536 ) { $port = (int) $hostinfo[3]; } if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { try { if ($this->Helo) { $hello = $this->Helo; } else { $hello = $this->serverHostname(); } $this->smtp->hello($hello); if ($this->SMTPAutoTLS && $sslext && 'ssl' !== $secure && $this->smtp->getServerExt('STARTTLS')) { $tls = true; } if ($tls) { if (!$this->smtp->startTLS()) { $message = $this->getSmtpErrorMessage('connect_host'); throw new Exception($message); } $this->smtp->hello($hello); } if ( $this->SMTPAuth && !$this->smtp->authenticate( $this->Username, $this->Password, $this->AuthType, $this->oauth ) ) { throw new Exception($this->lang('authenticate')); } return true; } catch (Exception $exc) { $lastexception = $exc; $this->edebug($exc->getMessage()); $this->smtp->quit(); } } } $this->smtp->close(); if ($this->exceptions && null !== $lastexception) { throw $lastexception; } elseif ($this->exceptions) { $message = $this->getSmtpErrorMessage('connect_host'); throw new Exception($message); } return false; } public function smtpClose() { if ((null !== $this->smtp) && $this->smtp->connected()) { $this->smtp->quit(); $this->smtp->close(); } } public function setLanguage($langcode = 'en', $lang_path = '') { $renamed_langcodes = [ 'br' => 'pt_br', 'cz' => 'cs', 'dk' => 'da', 'no' => 'nb', 'se' => 'sv', 'rs' => 'sr', 'tg' => 'tl', 'am' => 'hy', ]; if (array_key_exists($langcode, $renamed_langcodes)) { $langcode = $renamed_langcodes[$langcode]; } $PHPMAILER_LANG = [ 'authenticate' => 'SMTP Error: Could not authenticate.', 'buggy_php' => 'Your version of PHP is affected by a bug that may result in corrupted messages.' . ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' . ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', 'data_not_accepted' => 'SMTP Error: data not accepted.', 'empty_message' => 'Message body empty', 'encoding' => 'Unknown encoding: ', 'execute' => 'Could not execute: ', 'extension_missing' => 'Extension missing: ', 'file_access' => 'Could not access file: ', 'file_open' => 'File Error: Could not open file: ', 'from_failed' => 'The following From address failed: ', 'instantiate' => 'Could not instantiate mail function.', 'invalid_address' => 'Invalid address: ', 'invalid_header' => 'Invalid header name or value', 'invalid_hostentry' => 'Invalid hostentry: ', 'invalid_host' => 'Invalid host: ', 'mailer_not_supported' => ' mailer is not supported.', 'provide_address' => 'You must provide at least one recipient email address.', 'recipients_failed' => 'SMTP Error: The following recipients failed: ', 'signing' => 'Signing Error: ', 'smtp_code' => 'SMTP code: ', 'smtp_code_ex' => 'Additional SMTP info: ', 'smtp_connect_failed' => 'SMTP connect() failed.', 'smtp_detail' => 'Detail: ', 'smtp_error' => 'SMTP server error: ', 'variable_set' => 'Cannot set or reset variable: ', ]; if (empty($lang_path)) { $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR; } $foundlang = true; $langcode = strtolower($langcode); if ( !preg_match('/^(?P[a-z]{2})(?P"; } } elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) { $height += 20; if ($native) { $embed .= "get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\">"; } else { $embed .= ""; } } elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) { $height += 16; if ($native) { if ($placeholder !== '') { $embed .= "get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\">"; } else { $embed .= "get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\">"; } } else { $embed .= ""; } } elseif ($handler === 'wmedia') { $height += 45; if ($native) { $embed .= "get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\">"; } else { $embed .= ""; } } else $embed .= '' . $alt . ''; return $embed; } public function get_real_type($find_handler = false) { $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); if ($this->get_type() !== null) { $type = strtolower($this->type); } else { $type = null; } if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) { $extension = $this->get_extension(); if ($extension === null) { return null; } switch (strtolower($extension)) { case 'aac': case 'adts': $type = 'audio/acc'; break; case 'aif': case 'aifc': case 'aiff': case 'cdda': $type = 'audio/aiff'; break; case 'bwf': $type = 'audio/wav'; break; case 'kar': case 'mid': case 'midi': case 'smf': $type = 'audio/midi'; break; case 'm4a': $type = 'audio/x-m4a'; break; case 'mp3': case 'swa': $type = 'audio/mp3'; break; case 'wav': $type = 'audio/wav'; break; case 'wax': $type = 'audio/x-ms-wax'; break; case 'wma': $type = 'audio/x-ms-wma'; break; case '3gp': case '3gpp': $type = 'video/3gpp'; break; case '3g2': case '3gp2': $type = 'video/3gpp2'; break; case 'asf': $type = 'video/x-ms-asf'; break; case 'flv': $type = 'video/x-flv'; break; case 'm1a': case 'm1s': case 'm1v': case 'm15': case 'm75': case 'mp2': case 'mpa': case 'mpeg': case 'mpg': case 'mpm': case 'mpv': $type = 'video/mpeg'; break; case 'm4v': $type = 'video/x-m4v'; break; case 'mov': case 'qt': $type = 'video/quicktime'; break; case 'mp4': case 'mpg4': $type = 'video/mp4'; break; case 'sdv': $type = 'video/sd-video'; break; case 'wm': $type = 'video/x-ms-wm'; break; case 'wmv': $type = 'video/x-ms-wmv'; break; case 'wvx': $type = 'video/x-ms-wvx'; break; case 'spl': $type = 'application/futuresplash'; break; case 'swf': $type = 'application/x-shockwave-flash'; break; } } if ($find_handler) { if (in_array($type, $types_flash)) { return 'flash'; } elseif (in_array($type, $types_fmedia)) { return 'fmedia'; } elseif (in_array($type, $types_quicktime)) { return 'quicktime'; } elseif (in_array($type, $types_wmedia)) { return 'wmedia'; } elseif (in_array($type, $types_mp3)) { return 'mp3'; } return null; } return $type; } } array( 'port' => 674 ), 'dict' => array( 'port' => 2628 ), 'file' => array( 'ihost' => 'localhost' ), 'http' => array( 'port' => 80, 'ipath' => '/' ), 'https' => array( 'port' => 443, 'ipath' => '/' ), ); public function __toString() { return $this->get_iri(); } public function __set($name, $value) { if (method_exists($this, 'set_' . $name)) { call_user_func(array($this, 'set_' . $name), $value); } elseif ( $name === 'iauthority' || $name === 'iuserinfo' || $name === 'ihost' || $name === 'ipath' || $name === 'iquery' || $name === 'ifragment' ) { call_user_func(array($this, 'set_' . substr($name, 1)), $value); } } public function __get($name) { $props = get_object_vars($this); if ( $name === 'iri' || $name === 'uri' || $name === 'iauthority' || $name === 'authority' ) { $return = $this->{"get_$name"}(); } elseif (array_key_exists($name, $props)) { $return = $this->$name; } elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) { $name = $prop; $return = $this->$prop; } elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) { $name = $prop; $return = $this->$prop; } else { trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE); $return = null; } if ($return === null && isset($this->normalization[$this->scheme][$name])) { return $this->normalization[$this->scheme][$name]; } return $return; } public function __isset($name) { return method_exists($this, 'get_' . $name) || isset($this->$name); } public function __unset($name) { if (method_exists($this, 'set_' . $name)) { call_user_func(array($this, 'set_' . $name), ''); } } public function __construct($iri = null) { $this->set_iri($iri); } public function __destruct() { $this->set_iri(null, true); $this->set_path(null, true); $this->set_authority(null, true); } public static function absolutize($base, $relative) { if (!($relative instanceof SimplePie_IRI)) { $relative = new SimplePie_IRI($relative); } if (!$relative->is_valid()) { return false; } elseif ($relative->scheme !== null) { return clone $relative; } else { if (!($base instanceof SimplePie_IRI)) { $base = new SimplePie_IRI($base); } if ($base->scheme !== null && $base->is_valid()) { if ($relative->get_iri() !== '') { if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) { $target = clone $relative; $target->scheme = $base->scheme; } else { $target = new SimplePie_IRI; $target->scheme = $base->scheme; $target->iuserinfo = $base->iuserinfo; $target->ihost = $base->ihost; $target->port = $base->port; if ($relative->ipath !== '') { if ($relative->ipath[0] === '/') { $target->ipath = $relative->ipath; } elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') { $target->ipath = '/' . $relative->ipath; } elseif (($last_segment = strrpos($base->ipath, '/')) !== false) { $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath; } else { $target->ipath = $relative->ipath; } $target->ipath = $target->remove_dot_segments($target->ipath); $target->iquery = $relative->iquery; } else { $target->ipath = $base->ipath; if ($relative->iquery !== null) { $target->iquery = $relative->iquery; } elseif ($base->iquery !== null) { $target->iquery = $base->iquery; } } $target->ifragment = $relative->ifragment; } } else { $target = clone $base; $target->ifragment = null; } $target->scheme_normalization(); return $target; } return false; } } protected function parse_iri($iri) { $iri = trim($iri, "\x20\x09\x0A\x0C\x0D"); if (preg_match('/^((?P[^:\/?#]+):)?(\/\/(?P[^\/?#]*))?(?P[^?#]*)(\?(?P[^#]*))?(#(?P.*))?$/', $iri, $match)) { if ($match[1] === '') { $match['scheme'] = null; } if (!isset($match[3]) || $match[3] === '') { $match['authority'] = null; } if (!isset($match[5])) { $match['path'] = ''; } if (!isset($match[6]) || $match[6] === '') { $match['query'] = null; } if (!isset($match[8]) || $match[8] === '') { $match['fragment'] = null; } return $match; } return false; } protected function remove_dot_segments($input) { $output = ''; while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') { if (strpos($input, '../') === 0) { $input = substr($input, 3); } elseif (strpos($input, './') === 0) { $input = substr($input, 2); } elseif (strpos($input, '/./') === 0) { $input = substr($input, 2); } elseif ($input === '/.') { $input = '/'; } elseif (strpos($input, '/../') === 0) { $input = substr($input, 3); $output = substr_replace($output, '', strrpos($output, '/')); } elseif ($input === '/..') { $input = '/'; $output = substr_replace($output, '', strrpos($output, '/')); } elseif ($input === '.' || $input === '..') { $input = ''; } elseif (($pos = strpos($input, '/', 1)) !== false) { $output .= substr($input, 0, $pos); $input = substr_replace($input, '', 0, $pos); } else { $output .= $input; $input = ''; } } return $output . $input; } protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false) { $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string); $string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string); $extra_chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%'; $position = 0; $strlen = strlen($string); while (($position += strspn($string, $extra_chars, $position)) < $strlen) { $value = ord($string[$position]); $start = $position; $valid = true; if (($value & 0xE0) === 0xC0) { $character = ($value & 0x1F) << 6; $length = 2; $remaining = 1; } elseif (($value & 0xF0) === 0xE0) { $character = ($value & 0x0F) << 12; $length = 3; $remaining = 2; } elseif (($value & 0xF8) === 0xF0) { $character = ($value & 0x07) << 18; $length = 4; $remaining = 3; } else { $valid = false; $length = 1; $remaining = 0; } if ($remaining) { if ($position + $length <= $strlen) { for ($position++; $remaining; $position++) { $value = ord($string[$position]); if (($value & 0xC0) === 0x80) { $character |= ($value & 0x3F) << (--$remaining * 6); } else { $valid = false; $position--; break; } } } else { $position = $strlen - 1; $valid = false; } } if ( !$valid || $length > 1 && $character <= 0x7F || $length > 2 && $character <= 0x7FF || $length > 3 && $character <= 0xFFFF || ($character & 0xFFFE) === 0xFFFE || $character >= 0xFDD0 && $character <= 0xFDEF || ( $character > 0xD7FF && $character < 0xF900 || $character < 0xA0 || $character > 0xEFFFD ) && ( !$iprivate || $character < 0xE000 || $character > 0x10FFFD ) ) { if ($valid) $position--; for ($j = $start; $j <= $position; $j++) { $string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1); $j += 2; $position += 2; $strlen += 2; } } } return $string; } protected function remove_iunreserved_percent_encoded($match) { $bytes = explode('%', $match[0]); $string = ''; $remaining = 0; for ($i = 1, $len = count($bytes); $i < $len; $i++) { $value = hexdec($bytes[$i]); if (!$remaining) { $start = $i; $valid = true; if ($value <= 0x7F) { $character = $value; $length = 1; } elseif (($value & 0xE0) === 0xC0) { $character = ($value & 0x1F) << 6; $length = 2; $remaining = 1; } elseif (($value & 0xF0) === 0xE0) { $character = ($value & 0x0F) << 12; $length = 3; $remaining = 2; } elseif (($value & 0xF8) === 0xF0) { $character = ($value & 0x07) << 18; $length = 4; $remaining = 3; } else { $valid = false; $remaining = 0; } } else { if (($value & 0xC0) === 0x80) { $remaining--; $character |= ($value & 0x3F) << ($remaining * 6); } else { $valid = false; $remaining = 0; $i--; } } if (!$remaining) { if ( !$valid || $length > 1 && $character <= 0x7F || $length > 2 && $character <= 0x7FF || $length > 3 && $character <= 0xFFFF || $character < 0x2D || $character > 0xEFFFD || ($character & 0xFFFE) === 0xFFFE || $character >= 0xFDD0 && $character <= 0xFDEF || $character === 0x2F || $character > 0x39 && $character < 0x41 || $character > 0x5A && $character < 0x61 || $character > 0x7A && $character < 0x7E || $character > 0x7E && $character < 0xA0 || $character > 0xD7FF && $character < 0xF900 ) { for ($j = $start; $j <= $i; $j++) { $string .= '%' . strtoupper($bytes[$j]); } } else { for ($j = $start; $j <= $i; $j++) { $string .= chr(hexdec($bytes[$j])); } } } } if ($remaining) { for ($j = $start; $j < $len; $j++) { $string .= '%' . strtoupper($bytes[$j]); } } return $string; } protected function scheme_normalization() { if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) { $this->iuserinfo = null; } if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) { $this->ihost = null; } if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) { $this->port = null; } if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) { $this->ipath = ''; } if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) { $this->iquery = null; } if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) { $this->ifragment = null; } } public function is_valid() { if ($this->ipath === '') return true; $isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null; if ($isauthority && $this->ipath[0] === '/') return true; if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) return false; if (!$this->scheme && !$isauthority && strpos($this->ipath, ':') !== false && strpos($this->ipath, '/', 1) !== false && strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; return true; } public function set_iri($iri, $clear_cache = false) { static $cache; if ($clear_cache) { $cache = null; return; } if (!$cache) { $cache = array(); } if ($iri === null) { return true; } elseif (isset($cache[$iri])) { list($this->scheme, $this->iuserinfo, $this->ihost, $this->port, $this->ipath, $this->iquery, $this->ifragment, $return) = $cache[$iri]; return $return; } $parsed = $this->parse_iri((string) $iri); if (!$parsed) { return false; } $return = $this->set_scheme($parsed['scheme']) && $this->set_authority($parsed['authority']) && $this->set_path($parsed['path']) && $this->set_query($parsed['query']) && $this->set_fragment($parsed['fragment']); $cache[$iri] = array($this->scheme, $this->iuserinfo, $this->ihost, $this->port, $this->ipath, $this->iquery, $this->ifragment, $return); return $return; } public function set_scheme($scheme) { if ($scheme === null) { $this->scheme = null; } elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) { $this->scheme = null; return false; } else { $this->scheme = strtolower($scheme); } return true; } public function set_authority($authority, $clear_cache = false) { static $cache; if ($clear_cache) { $cache = null; return; } if (!$cache) $cache = array(); if ($authority === null) { $this->iuserinfo = null; $this->ihost = null; $this->port = null; return true; } elseif (isset($cache[$authority])) { list($this->iuserinfo, $this->ihost, $this->port, $return) = $cache[$authority]; return $return; } $remaining = $authority; if (($iuserinfo_end = strrpos($remaining, '@')) !== false) { $iuserinfo = substr($remaining, 0, $iuserinfo_end); $remaining = substr($remaining, $iuserinfo_end + 1); } else { $iuserinfo = null; } if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) { if (($port = substr($remaining, $port_start + 1)) === false) { $port = null; } $remaining = substr($remaining, 0, $port_start); } else { $port = null; } $return = $this->set_userinfo($iuserinfo) && $this->set_host($remaining) && $this->set_port($port); $cache[$authority] = array($this->iuserinfo, $this->ihost, $this->port, $return); return $return; } public function set_userinfo($iuserinfo) { if ($iuserinfo === null) { $this->iuserinfo = null; } else { $this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:'); $this->scheme_normalization(); } return true; } public function set_host($ihost) { if ($ihost === null) { $this->ihost = null; return true; } elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') { if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1))) { $this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']'; } else { $this->ihost = null; return false; } } else { $ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;='); $position = 0; $strlen = strlen($ihost); while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) { if ($ihost[$position] === '%') { $position += 3; } else { $ihost[$position] = strtolower($ihost[$position]); $position++; } } $this->ihost = $ihost; } $this->scheme_normalization(); return true; } public function set_port($port) { if ($port === null) { $this->port = null; return true; } elseif (strspn($port, '0123456789') === strlen($port)) { $this->port = (int) $port; $this->scheme_normalization(); return true; } $this->port = null; return false; } public function set_path($ipath, $clear_cache = false) { static $cache; if ($clear_cache) { $cache = null; return; } if (!$cache) { $cache = array(); } $ipath = (string) $ipath; if (isset($cache[$ipath])) { $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; } else { $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); $removed = $this->remove_dot_segments($valid); $cache[$ipath] = array($valid, $removed); $this->ipath = ($this->scheme !== null) ? $removed : $valid; } $this->scheme_normalization(); return true; } public function set_query($iquery) { if ($iquery === null) { $this->iquery = null; } else { $this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true); $this->scheme_normalization(); } return true; } public function set_fragment($ifragment) { if ($ifragment === null) { $this->ifragment = null; } else { $this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?'); $this->scheme_normalization(); } return true; } public function to_uri($string) { static $non_ascii; if (!$non_ascii) { $non_ascii = implode('', range("\x80", "\xFF")); } $position = 0; $strlen = strlen($string); while (($position += strcspn($string, $non_ascii, $position)) < $strlen) { $string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1); $position += 3; $strlen += 2; } return $string; } public function get_iri() { if (!$this->is_valid()) { return false; } $iri = ''; if ($this->scheme !== null) { $iri .= $this->scheme . ':'; } if (($iauthority = $this->get_iauthority()) !== null) { $iri .= '//' . $iauthority; } if ($this->ipath !== '') { $iri .= $this->ipath; } elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') { $iri .= $this->normalization[$this->scheme]['ipath']; } if ($this->iquery !== null) { $iri .= '?' . $this->iquery; } if ($this->ifragment !== null) { $iri .= '#' . $this->ifragment; } return $iri; } public function get_uri() { return $this->to_uri($this->get_iri()); } protected function get_iauthority() { if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null) { $iauthority = ''; if ($this->iuserinfo !== null) { $iauthority .= $this->iuserinfo . '@'; } if ($this->ihost !== null) { $iauthority .= $this->ihost; } if ($this->port !== null && $this->port !== 0) { $iauthority .= ':' . $this->port; } return $iauthority; } return null; } protected function get_authority() { $iauthority = $this->get_iauthority(); if (is_string($iauthority)) return $this->to_uri($iauthority); return $iauthority; } } item = $item; $this->data = $data; } public function set_registry(SimplePie_Registry $registry) { $this->registry = $registry; } public function __toString() { return md5(serialize($this->data)); } public function get_source_tags($namespace, $tag) { if (isset($this->data['child'][$namespace][$tag])) { return $this->data['child'][$namespace][$tag]; } return null; } public function get_base($element = array()) { return $this->item->get_base($element); } public function sanitize($data, $type, $base = '') { return $this->item->sanitize($data, $type, $base); } public function get_item() { return $this->item; } public function get_title() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) { return $categories[$key]; } return null; } public function get_categories() { $categories = array(); foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { $term = null; $scheme = null; $label = null; if (isset($category['attribs']['']['term'])) { $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['scheme'])) { $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); if (isset($category['attribs']['']['domain'])) { $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); } else { $scheme = null; } $categories[] = $this->registry->create('Category', array($term, $scheme, null)); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($categories)) { return array_unique($categories); } return null; } public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) { return $authors[$key]; } return null; } public function get_authors() { $authors = array(); foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { $name = null; $uri = null; $email = null; if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $authors[] = $this->registry->create('Author', array($name, $uri, $email)); } } if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { $name = null; $url = null; $email = null; if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $authors[] = $this->registry->create('Author', array($name, $url, $email)); } } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); } if (!empty($authors)) { return array_unique($authors); } return null; } public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) { return $contributors[$key]; } return null; } public function get_contributors() { $contributors = array(); foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { $name = null; $uri = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); } } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { $name = null; $url = null; $email = null; if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); } if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { $contributors[] = $this->registry->create('Author', array($name, $url, $email)); } } if (!empty($contributors)) { return array_unique($contributors); } return null; } public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if (isset($links[$key])) { return $links[$key]; } return null; } public function get_permalink() { return $this->get_link(0); } public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { $this->data['links'] = array(); if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) { foreach ($links as $link) { if (isset($link['attribs']['']['href'])) { $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); } } } if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); } $keys = array_keys($this->data['links']); foreach ($keys as $key) { if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) { if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; } else { $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; } } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; } $this->data['links'][$key] = array_unique($this->data['links'][$key]); } } if (isset($this->data['links'][$rel])) { return $this->data['links'][$rel]; } return null; } public function get_description() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); } return null; } public function get_copyright() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) { return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_language() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } elseif (isset($this->data['xml_lang'])) { return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); } return null; } public function get_latitude() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } return null; } public function get_longitude() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { return (float) $return[0]['data']; } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { return (float) $return[0]['data']; } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } return null; } public function get_image_url() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); } return null; } } name = $name; $this->link = $link; $this->email = $email; } public function __toString() { return md5(serialize($this)); } public function get_name() { if ($this->name !== null) { return $this->name; } return null; } public function get_link() { if ($this->link !== null) { return $this->link; } return null; } public function get_email() { if ($this->email !== null) { return $this->email; } return null; } } type = $type; $this->lang = $lang; $this->startTime = $startTime; $this->endTime = $endTime; $this->text = $text; } public function __toString() { return md5(serialize($this)); } public function get_endtime() { if ($this->endTime !== null) { return $this->endTime; } return null; } public function get_language() { if ($this->lang !== null) { return $this->lang; } return null; } public function get_starttime() { if ($this->startTime !== null) { return $this->startTime; } return null; } public function get_text() { if ($this->text !== null) { return $this->text; } return null; } public function get_type() { if ($this->type !== null) { return $this->type; } return null; } } 0) { $time .= $hours.':'; } $minutes = floor($remainder / 60); $seconds = $remainder % 60; if ($minutes < 10 && $hours > 0) { $minutes = '0' . $minutes; } if ($seconds < 10) { $seconds = '0' . $seconds; } $time .= $minutes.':'; $time .= $seconds; return $time; } public static function absolutize_url($relative, $base) { $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); if ($iri === false) { return false; } return $iri->get_uri(); } public static function get_element($realname, $string) { $return = array(); $name = preg_quote($realname, '/'); if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) { $return[$i]['tag'] = $realname; $return[$i]['full'] = $matches[$i][0][0]; $return[$i]['offset'] = $matches[$i][0][1]; if (strlen($matches[$i][3][0]) <= 2) { $return[$i]['self_closing'] = true; } else { $return[$i]['self_closing'] = false; $return[$i]['content'] = $matches[$i][4][0]; } $return[$i]['attribs'] = array(); if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER)) { for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) { if (count($attribs[$j]) === 2) { $attribs[$j][2] = $attribs[$j][1]; } $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j])); } } } } return $return; } public static function element_implode($element) { $full = "<$element[tag]"; foreach ($element['attribs'] as $key => $value) { $key = strtolower($key); $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; } if ($element['self_closing']) { $full .= ' />'; } else { $full .= ">$element[content]"; } return $full; } public static function error($message, $level, $file, $line) { if ((ini_get('error_reporting') & $level) > 0) { switch ($level) { case E_USER_ERROR: $note = 'PHP Error'; break; case E_USER_WARNING: $note = 'PHP Warning'; break; case E_USER_NOTICE: $note = 'PHP Notice'; break; default: $note = 'Unknown Error'; break; } $log_error = true; if (!function_exists('error_log')) { $log_error = false; } $log_file = @ini_get('error_log'); if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file)) { $log_error = false; } if ($log_error) { @error_log("$note: $message in $file on line $line", 0); } } return $message; } public static function fix_protocol($url, $http = 1) { $url = SimplePie_Misc::normalize_url($url); $parsed = SimplePie_Misc::parse_url($url); if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') { return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); } if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) { return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); } if ($http === 2 && $parsed['scheme'] !== '') { return "feed:$url"; } elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') { return substr_replace($url, 'podcast', 0, 4); } elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') { return substr_replace($url, 'itpc', 0, 4); } return $url; } public static function array_merge_recursive($array1, $array2) { foreach ($array2 as $key => $value) { if (is_array($value)) { $array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value); } else { $array1[$key] = $value; } } return $array1; } public static function parse_url($url) { $iri = new SimplePie_IRI($url); return array( 'scheme' => (string) $iri->scheme, 'authority' => (string) $iri->authority, 'path' => (string) $iri->path, 'query' => (string) $iri->query, 'fragment' => (string) $iri->fragment ); } public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') { $iri = new SimplePie_IRI(''); $iri->scheme = $scheme; $iri->authority = $authority; $iri->path = $path; $iri->query = $query; $iri->fragment = $fragment; return $iri->get_uri(); } public static function normalize_url($url) { $iri = new SimplePie_IRI($url); return $iri->get_uri(); } public static function percent_encoding_normalization($match) { $integer = hexdec($match[1]); if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) { return chr($integer); } return strtoupper($match[0]); } public static function windows_1252_to_utf8($string) { static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"); return strtr($string, $convert_table); } public static function change_encoding($data, $input, $output) { $input = SimplePie_Misc::encoding($input); $output = SimplePie_Misc::encoding($output); if ($input === 'US-ASCII') { static $non_ascii_octects = ''; if (!$non_ascii_octects) { for ($i = 0x80; $i <= 0xFF; $i++) { $non_ascii_octects .= chr($i); } } $data = substr($data, 0, strcspn($data, $non_ascii_octects)); } if ($input === 'windows-1252' && $output === 'UTF-8') { return SimplePie_Misc::windows_1252_to_utf8($data); } elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output))) { return $return; } elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) { return $return; } elseif (class_exists('\UConverter') && ($return = SimplePie_Misc::change_encoding_uconverter($data, $input, $output))) { return $return; } return false; } protected static function change_encoding_mbstring($data, $input, $output) { if ($input === 'windows-949') { $input = 'EUC-KR'; } if ($output === 'windows-949') { $output = 'EUC-KR'; } if ($input === 'Windows-31J') { $input = 'SJIS'; } if ($output === 'Windows-31J') { $output = 'SJIS'; } if (!in_array($input, mb_list_encodings())) { return false; } if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80") { return false; } if ($return = @mb_convert_encoding($data, $output, $input)) { return $return; } return false; } protected static function change_encoding_iconv($data, $input, $output) { return @iconv($input, $output, $data); } protected static function change_encoding_uconverter($data, $input, $output) { return @\UConverter::transcode($data, $output, $input); } public static function encoding($charset) { switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) { case 'adobestandardencoding': case 'csadobestandardencoding': return 'Adobe-Standard-Encoding'; case 'adobesymbolencoding': case 'cshppsmath': return 'Adobe-Symbol-Encoding'; case 'ami1251': case 'amiga1251': return 'Amiga-1251'; case 'ansix31101983': case 'csat5001983': case 'csiso99naplps': case 'isoir99': case 'naplps': return 'ANSI_X3.110-1983'; case 'arabic7': case 'asmo449': case 'csiso89asmo449': case 'iso9036': case 'isoir89': return 'ASMO_449'; case 'big5': case 'csbig5': return 'Big5'; case 'big5hkscs': return 'Big5-HKSCS'; case 'bocu1': case 'csbocu1': return 'BOCU-1'; case 'brf': case 'csbrf': return 'BRF'; case 'bs4730': case 'csiso4unitedkingdom': case 'gb': case 'iso646gb': case 'isoir4': case 'uk': return 'BS_4730'; case 'bsviewdata': case 'csiso47bsviewdata': case 'isoir47': return 'BS_viewdata'; case 'cesu8': case 'cscesu8': return 'CESU-8'; case 'ca': case 'csa71': case 'csaz243419851': case 'csiso121canadian1': case 'iso646ca': case 'isoir121': return 'CSA_Z243.4-1985-1'; case 'csa72': case 'csaz243419852': case 'csiso122canadian2': case 'iso646ca2': case 'isoir122': return 'CSA_Z243.4-1985-2'; case 'csaz24341985gr': case 'csiso123csaz24341985gr': case 'isoir123': return 'CSA_Z243.4-1985-gr'; case 'csiso139csn369103': case 'csn369103': case 'isoir139': return 'CSN_369103'; case 'csdecmcs': case 'dec': case 'decmcs': return 'DEC-MCS'; case 'csiso21german': case 'de': case 'din66003': case 'iso646de': case 'isoir21': return 'DIN_66003'; case 'csdkus': case 'dkus': return 'dk-us'; case 'csiso646danish': case 'dk': case 'ds2089': case 'iso646dk': return 'DS_2089'; case 'csibmebcdicatde': case 'ebcdicatde': return 'EBCDIC-AT-DE'; case 'csebcdicatdea': case 'ebcdicatdea': return 'EBCDIC-AT-DE-A'; case 'csebcdiccafr': case 'ebcdiccafr': return 'EBCDIC-CA-FR'; case 'csebcdicdkno': case 'ebcdicdkno': return 'EBCDIC-DK-NO'; case 'csebcdicdknoa': case 'ebcdicdknoa': return 'EBCDIC-DK-NO-A'; case 'csebcdices': case 'ebcdices': return 'EBCDIC-ES'; case 'csebcdicesa': case 'ebcdicesa': return 'EBCDIC-ES-A'; case 'csebcdicess': case 'ebcdicess': return 'EBCDIC-ES-S'; case 'csebcdicfise': case 'ebcdicfise': return 'EBCDIC-FI-SE'; case 'csebcdicfisea': case 'ebcdicfisea': return 'EBCDIC-FI-SE-A'; case 'csebcdicfr': case 'ebcdicfr': return 'EBCDIC-FR'; case 'csebcdicit': case 'ebcdicit': return 'EBCDIC-IT'; case 'csebcdicpt': case 'ebcdicpt': return 'EBCDIC-PT'; case 'csebcdicuk': case 'ebcdicuk': return 'EBCDIC-UK'; case 'csebcdicus': case 'ebcdicus': return 'EBCDIC-US'; case 'csiso111ecmacyrillic': case 'ecmacyrillic': case 'isoir111': case 'koi8e': return 'ECMA-cyrillic'; case 'csiso17spanish': case 'es': case 'iso646es': case 'isoir17': return 'ES'; case 'csiso85spanish2': case 'es2': case 'iso646es2': case 'isoir85': return 'ES2'; case 'cseucpkdfmtjapanese': case 'eucjp': case 'extendedunixcodepackedformatforjapanese': return 'EUC-JP'; case 'cseucfixwidjapanese': case 'extendedunixcodefixedwidthforjapanese': return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; case 'gb18030': return 'GB18030'; case 'chinese': case 'cp936': case 'csgb2312': case 'csiso58gb231280': case 'gb2312': case 'gb231280': case 'gbk': case 'isoir58': case 'ms936': case 'windows936': return 'GBK'; case 'cn': case 'csiso57gb1988': case 'gb198880': case 'iso646cn': case 'isoir57': return 'GB_1988-80'; case 'csiso153gost1976874': case 'gost1976874': case 'isoir153': case 'stsev35888': return 'GOST_19768-74'; case 'csiso150': case 'csiso150greekccitt': case 'greekccitt': case 'isoir150': return 'greek-ccitt'; case 'csiso88greek7': case 'greek7': case 'isoir88': return 'greek7'; case 'csiso18greek7old': case 'greek7old': case 'isoir18': return 'greek7-old'; case 'cshpdesktop': case 'hpdesktop': return 'HP-DeskTop'; case 'cshplegal': case 'hplegal': return 'HP-Legal'; case 'cshpmath8': case 'hpmath8': return 'HP-Math8'; case 'cshppifont': case 'hppifont': return 'HP-Pi-font'; case 'cshproman8': case 'hproman8': case 'r8': case 'roman8': return 'hp-roman8'; case 'hzgb2312': return 'HZ-GB-2312'; case 'csibmsymbols': case 'ibmsymbols': return 'IBM-Symbols'; case 'csibmthai': case 'ibmthai': return 'IBM-Thai'; case 'cp37': case 'csibm37': case 'ebcdiccpca': case 'ebcdiccpnl': case 'ebcdiccpus': case 'ebcdiccpwt': case 'ibm37': return 'IBM037'; case 'cp38': case 'csibm38': case 'ebcdicint': case 'ibm38': return 'IBM038'; case 'cp273': case 'csibm273': case 'ibm273': return 'IBM273'; case 'cp274': case 'csibm274': case 'ebcdicbe': case 'ibm274': return 'IBM274'; case 'cp275': case 'csibm275': case 'ebcdicbr': case 'ibm275': return 'IBM275'; case 'csibm277': case 'ebcdiccpdk': case 'ebcdiccpno': case 'ibm277': return 'IBM277'; case 'cp278': case 'csibm278': case 'ebcdiccpfi': case 'ebcdiccpse': case 'ibm278': return 'IBM278'; case 'cp280': case 'csibm280': case 'ebcdiccpit': case 'ibm280': return 'IBM280'; case 'cp281': case 'csibm281': case 'ebcdicjpe': case 'ibm281': return 'IBM281'; case 'cp284': case 'csibm284': case 'ebcdiccpes': case 'ibm284': return 'IBM284'; case 'cp285': case 'csibm285': case 'ebcdiccpgb': case 'ibm285': return 'IBM285'; case 'cp290': case 'csibm290': case 'ebcdicjpkana': case 'ibm290': return 'IBM290'; case 'cp297': case 'csibm297': case 'ebcdiccpfr': case 'ibm297': return 'IBM297'; case 'cp420': case 'csibm420': case 'ebcdiccpar1': case 'ibm420': return 'IBM420'; case 'cp423': case 'csibm423': case 'ebcdiccpgr': case 'ibm423': return 'IBM423'; case 'cp424': case 'csibm424': case 'ebcdiccphe': case 'ibm424': return 'IBM424'; case '437': case 'cp437': case 'cspc8codepage437': case 'ibm437': return 'IBM437'; case 'cp500': case 'csibm500': case 'ebcdiccpbe': case 'ebcdiccpch': case 'ibm500': return 'IBM500'; case 'cp775': case 'cspc775baltic': case 'ibm775': return 'IBM775'; case '850': case 'cp850': case 'cspc850multilingual': case 'ibm850': return 'IBM850'; case '851': case 'cp851': case 'csibm851': case 'ibm851': return 'IBM851'; case '852': case 'cp852': case 'cspcp852': case 'ibm852': return 'IBM852'; case '855': case 'cp855': case 'csibm855': case 'ibm855': return 'IBM855'; case '857': case 'cp857': case 'csibm857': case 'ibm857': return 'IBM857'; case 'ccsid858': case 'cp858': case 'ibm858': case 'pcmultilingual850euro': return 'IBM00858'; case '860': case 'cp860': case 'csibm860': case 'ibm860': return 'IBM860'; case '861': case 'cp861': case 'cpis': case 'csibm861': case 'ibm861': return 'IBM861'; case '862': case 'cp862': case 'cspc862latinhebrew': case 'ibm862': return 'IBM862'; case '863': case 'cp863': case 'csibm863': case 'ibm863': return 'IBM863'; case 'cp864': case 'csibm864': case 'ibm864': return 'IBM864'; case '865': case 'cp865': case 'csibm865': case 'ibm865': return 'IBM865'; case '866': case 'cp866': case 'csibm866': case 'ibm866': return 'IBM866'; case 'cp868': case 'cpar': case 'csibm868': case 'ibm868': return 'IBM868'; case '869': case 'cp869': case 'cpgr': case 'csibm869': case 'ibm869': return 'IBM869'; case 'cp870': case 'csibm870': case 'ebcdiccproece': case 'ebcdiccpyu': case 'ibm870': return 'IBM870'; case 'cp871': case 'csibm871': case 'ebcdiccpis': case 'ibm871': return 'IBM871'; case 'cp880': case 'csibm880': case 'ebcdiccyrillic': case 'ibm880': return 'IBM880'; case 'cp891': case 'csibm891': case 'ibm891': return 'IBM891'; case 'cp903': case 'csibm903': case 'ibm903': return 'IBM903'; case '904': case 'cp904': case 'csibbm904': case 'ibm904': return 'IBM904'; case 'cp905': case 'csibm905': case 'ebcdiccptr': case 'ibm905': return 'IBM905'; case 'cp918': case 'csibm918': case 'ebcdiccpar2': case 'ibm918': return 'IBM918'; case 'ccsid924': case 'cp924': case 'ebcdiclatin9euro': case 'ibm924': return 'IBM00924'; case 'cp1026': case 'csibm1026': case 'ibm1026': return 'IBM1026'; case 'ibm1047': return 'IBM1047'; case 'ccsid1140': case 'cp1140': case 'ebcdicus37euro': case 'ibm1140': return 'IBM01140'; case 'ccsid1141': case 'cp1141': case 'ebcdicde273euro': case 'ibm1141': return 'IBM01141'; case 'ccsid1142': case 'cp1142': case 'ebcdicdk277euro': case 'ebcdicno277euro': case 'ibm1142': return 'IBM01142'; case 'ccsid1143': case 'cp1143': case 'ebcdicfi278euro': case 'ebcdicse278euro': case 'ibm1143': return 'IBM01143'; case 'ccsid1144': case 'cp1144': case 'ebcdicit280euro': case 'ibm1144': return 'IBM01144'; case 'ccsid1145': case 'cp1145': case 'ebcdices284euro': case 'ibm1145': return 'IBM01145'; case 'ccsid1146': case 'cp1146': case 'ebcdicgb285euro': case 'ibm1146': return 'IBM01146'; case 'ccsid1147': case 'cp1147': case 'ebcdicfr297euro': case 'ibm1147': return 'IBM01147'; case 'ccsid1148': case 'cp1148': case 'ebcdicinternational500euro': case 'ibm1148': return 'IBM01148'; case 'ccsid1149': case 'cp1149': case 'ebcdicis871euro': case 'ibm1149': return 'IBM01149'; case 'csiso143iecp271': case 'iecp271': case 'isoir143': return 'IEC_P27-1'; case 'csiso49inis': case 'inis': case 'isoir49': return 'INIS'; case 'csiso50inis8': case 'inis8': case 'isoir50': return 'INIS-8'; case 'csiso51iniscyrillic': case 'iniscyrillic': case 'isoir51': return 'INIS-cyrillic'; case 'csinvariant': case 'invariant': return 'INVARIANT'; case 'iso2022cn': return 'ISO-2022-CN'; case 'iso2022cnext': return 'ISO-2022-CN-EXT'; case 'csiso2022jp': case 'iso2022jp': return 'ISO-2022-JP'; case 'csiso2022jp2': case 'iso2022jp2': return 'ISO-2022-JP-2'; case 'csiso2022kr': case 'iso2022kr': return 'ISO-2022-KR'; case 'cswindows30latin1': case 'iso88591windows30latin1': return 'ISO-8859-1-Windows-3.0-Latin-1'; case 'cswindows31latin1': case 'iso88591windows31latin1': return 'ISO-8859-1-Windows-3.1-Latin-1'; case 'csisolatin2': case 'iso88592': case 'iso885921987': case 'isoir101': case 'l2': case 'latin2': return 'ISO-8859-2'; case 'cswindows31latin2': case 'iso88592windowslatin2': return 'ISO-8859-2-Windows-Latin-2'; case 'csisolatin3': case 'iso88593': case 'iso885931988': case 'isoir109': case 'l3': case 'latin3': return 'ISO-8859-3'; case 'csisolatin4': case 'iso88594': case 'iso885941988': case 'isoir110': case 'l4': case 'latin4': return 'ISO-8859-4'; case 'csisolatincyrillic': case 'cyrillic': case 'iso88595': case 'iso885951988': case 'isoir144': return 'ISO-8859-5'; case 'arabic': case 'asmo708': case 'csisolatinarabic': case 'ecma114': case 'iso88596': case 'iso885961987': case 'isoir127': return 'ISO-8859-6'; case 'csiso88596e': case 'iso88596e': return 'ISO-8859-6-E'; case 'csiso88596i': case 'iso88596i': return 'ISO-8859-6-I'; case 'csisolatingreek': case 'ecma118': case 'elot928': case 'greek': case 'greek8': case 'iso88597': case 'iso885971987': case 'isoir126': return 'ISO-8859-7'; case 'csisolatinhebrew': case 'hebrew': case 'iso88598': case 'iso885981988': case 'isoir138': return 'ISO-8859-8'; case 'csiso88598e': case 'iso88598e': return 'ISO-8859-8-E'; case 'csiso88598i': case 'iso88598i': return 'ISO-8859-8-I'; case 'cswindows31latin5': case 'iso88599windowslatin5': return 'ISO-8859-9-Windows-Latin-5'; case 'csisolatin6': case 'iso885910': case 'iso8859101992': case 'isoir157': case 'l6': case 'latin6': return 'ISO-8859-10'; case 'iso885913': return 'ISO-8859-13'; case 'iso885914': case 'iso8859141998': case 'isoceltic': case 'isoir199': case 'l8': case 'latin8': return 'ISO-8859-14'; case 'iso885915': case 'latin9': return 'ISO-8859-15'; case 'iso885916': case 'iso8859162001': case 'isoir226': case 'l10': case 'latin10': return 'ISO-8859-16'; case 'iso10646j1': return 'ISO-10646-J-1'; case 'csunicode': case 'iso10646ucs2': return 'ISO-10646-UCS-2'; case 'csucs4': case 'iso10646ucs4': return 'ISO-10646-UCS-4'; case 'csunicodeascii': case 'iso10646ucsbasic': return 'ISO-10646-UCS-Basic'; case 'csunicodelatin1': case 'iso10646': case 'iso10646unicodelatin1': return 'ISO-10646-Unicode-Latin1'; case 'csiso10646utf1': case 'iso10646utf1': return 'ISO-10646-UTF-1'; case 'csiso115481': case 'iso115481': case 'isotr115481': return 'ISO-11548-1'; case 'csiso90': case 'isoir90': return 'iso-ir-90'; case 'csunicodeibm1261': case 'isounicodeibm1261': return 'ISO-Unicode-IBM-1261'; case 'csunicodeibm1264': case 'isounicodeibm1264': return 'ISO-Unicode-IBM-1264'; case 'csunicodeibm1265': case 'isounicodeibm1265': return 'ISO-Unicode-IBM-1265'; case 'csunicodeibm1268': case 'isounicodeibm1268': return 'ISO-Unicode-IBM-1268'; case 'csunicodeibm1276': case 'isounicodeibm1276': return 'ISO-Unicode-IBM-1276'; case 'csiso646basic1983': case 'iso646basic1983': case 'ref': return 'ISO_646.basic:1983'; case 'csiso2intlrefversion': case 'irv': case 'iso646irv1983': case 'isoir2': return 'ISO_646.irv:1983'; case 'csiso2033': case 'e13b': case 'iso20331983': case 'isoir98': return 'ISO_2033-1983'; case 'csiso5427cyrillic': case 'iso5427': case 'isoir37': return 'ISO_5427'; case 'iso5427cyrillic1981': case 'iso54271981': case 'isoir54': return 'ISO_5427:1981'; case 'csiso5428greek': case 'iso54281980': case 'isoir55': return 'ISO_5428:1980'; case 'csiso6937add': case 'iso6937225': case 'isoir152': return 'ISO_6937-2-25'; case 'csisotextcomm': case 'iso69372add': case 'isoir142': return 'ISO_6937-2-add'; case 'csiso8859supp': case 'iso8859supp': case 'isoir154': case 'latin125': return 'ISO_8859-supp'; case 'csiso10367box': case 'iso10367box': case 'isoir155': return 'ISO_10367-box'; case 'csiso15italian': case 'iso646it': case 'isoir15': case 'it': return 'IT'; case 'csiso13jisc6220jp': case 'isoir13': case 'jisc62201969': case 'jisc62201969jp': case 'katakana': case 'x2017': return 'JIS_C6220-1969-jp'; case 'csiso14jisc6220ro': case 'iso646jp': case 'isoir14': case 'jisc62201969ro': case 'jp': return 'JIS_C6220-1969-ro'; case 'csiso42jisc62261978': case 'isoir42': case 'jisc62261978': return 'JIS_C6226-1978'; case 'csiso87jisx208': case 'isoir87': case 'jisc62261983': case 'jisx2081983': case 'x208': return 'JIS_C6226-1983'; case 'csiso91jisc62291984a': case 'isoir91': case 'jisc62291984a': case 'jpocra': return 'JIS_C6229-1984-a'; case 'csiso92jisc62991984b': case 'iso646jpocrb': case 'isoir92': case 'jisc62291984b': case 'jpocrb': return 'JIS_C6229-1984-b'; case 'csiso93jis62291984badd': case 'isoir93': case 'jisc62291984badd': case 'jpocrbadd': return 'JIS_C6229-1984-b-add'; case 'csiso94jis62291984hand': case 'isoir94': case 'jisc62291984hand': case 'jpocrhand': return 'JIS_C6229-1984-hand'; case 'csiso95jis62291984handadd': case 'isoir95': case 'jisc62291984handadd': case 'jpocrhandadd': return 'JIS_C6229-1984-hand-add'; case 'csiso96jisc62291984kana': case 'isoir96': case 'jisc62291984kana': return 'JIS_C6229-1984-kana'; case 'csjisencoding': case 'jisencoding': return 'JIS_Encoding'; case 'cshalfwidthkatakana': case 'jisx201': case 'x201': return 'JIS_X0201'; case 'csiso159jisx2121990': case 'isoir159': case 'jisx2121990': case 'x212': return 'JIS_X0212-1990'; case 'csiso141jusib1002': case 'iso646yu': case 'isoir141': case 'js': case 'jusib1002': case 'yu': return 'JUS_I.B1.002'; case 'csiso147macedonian': case 'isoir147': case 'jusib1003mac': case 'macedonian': return 'JUS_I.B1.003-mac'; case 'csiso146serbian': case 'isoir146': case 'jusib1003serb': case 'serbian': return 'JUS_I.B1.003-serb'; case 'koi7switched': return 'KOI7-switched'; case 'cskoi8r': case 'koi8r': return 'KOI8-R'; case 'koi8u': return 'KOI8-U'; case 'csksc5636': case 'iso646kr': case 'ksc5636': return 'KSC5636'; case 'cskz1048': case 'kz1048': case 'rk1048': case 'strk10482002': return 'KZ-1048'; case 'csiso19latingreek': case 'isoir19': case 'latingreek': return 'latin-greek'; case 'csiso27latingreek1': case 'isoir27': case 'latingreek1': return 'Latin-greek-1'; case 'csiso158lap': case 'isoir158': case 'lap': case 'latinlap': return 'latin-lap'; case 'csmacintosh': case 'mac': case 'macintosh': return 'macintosh'; case 'csmicrosoftpublishing': case 'microsoftpublishing': return 'Microsoft-Publishing'; case 'csmnem': case 'mnem': return 'MNEM'; case 'csmnemonic': case 'mnemonic': return 'MNEMONIC'; case 'csiso86hungarian': case 'hu': case 'iso646hu': case 'isoir86': case 'msz77953': return 'MSZ_7795.3'; case 'csnatsdano': case 'isoir91': case 'natsdano': return 'NATS-DANO'; case 'csnatsdanoadd': case 'isoir92': case 'natsdanoadd': return 'NATS-DANO-ADD'; case 'csnatssefi': case 'isoir81': case 'natssefi': return 'NATS-SEFI'; case 'csnatssefiadd': case 'isoir82': case 'natssefiadd': return 'NATS-SEFI-ADD'; case 'csiso151cuba': case 'cuba': case 'iso646cu': case 'isoir151': case 'ncnc1081': return 'NC_NC00-10:81'; case 'csiso69french': case 'fr': case 'iso646fr': case 'isoir69': case 'nfz62010': return 'NF_Z_62-010'; case 'csiso25french': case 'iso646fr1': case 'isoir25': case 'nfz620101973': return 'NF_Z_62-010_(1973)'; case 'csiso60danishnorwegian': case 'csiso60norwegian1': case 'iso646no': case 'isoir60': case 'no': case 'ns45511': return 'NS_4551-1'; case 'csiso61norwegian2': case 'iso646no2': case 'isoir61': case 'no2': case 'ns45512': return 'NS_4551-2'; case 'osdebcdicdf3irv': return 'OSD_EBCDIC_DF03_IRV'; case 'osdebcdicdf41': return 'OSD_EBCDIC_DF04_1'; case 'osdebcdicdf415': return 'OSD_EBCDIC_DF04_15'; case 'cspc8danishnorwegian': case 'pc8danishnorwegian': return 'PC8-Danish-Norwegian'; case 'cspc8turkish': case 'pc8turkish': return 'PC8-Turkish'; case 'csiso16portuguese': case 'iso646pt': case 'isoir16': case 'pt': return 'PT'; case 'csiso84portuguese2': case 'iso646pt2': case 'isoir84': case 'pt2': return 'PT2'; case 'cp154': case 'csptcp154': case 'cyrillicasian': case 'pt154': case 'ptcp154': return 'PTCP154'; case 'scsu': return 'SCSU'; case 'csiso10swedish': case 'fi': case 'iso646fi': case 'iso646se': case 'isoir10': case 'se': case 'sen850200b': return 'SEN_850200_B'; case 'csiso11swedishfornames': case 'iso646se2': case 'isoir11': case 'se2': case 'sen850200c': return 'SEN_850200_C'; case 'csiso102t617bit': case 'isoir102': case 't617bit': return 'T.61-7bit'; case 'csiso103t618bit': case 'isoir103': case 't61': case 't618bit': return 'T.61-8bit'; case 'csiso128t101g2': case 'isoir128': case 't101g2': return 'T.101-G2'; case 'cstscii': case 'tscii': return 'TSCII'; case 'csunicode11': case 'unicode11': return 'UNICODE-1-1'; case 'csunicode11utf7': case 'unicode11utf7': return 'UNICODE-1-1-UTF-7'; case 'csunknown8bit': case 'unknown8bit': return 'UNKNOWN-8BIT'; case 'ansix341968': case 'ansix341986': case 'ascii': case 'cp367': case 'csascii': case 'ibm367': case 'iso646irv1991': case 'iso646us': case 'isoir6': case 'us': case 'usascii': return 'US-ASCII'; case 'csusdk': case 'usdk': return 'us-dk'; case 'utf7': return 'UTF-7'; case 'utf8': return 'UTF-8'; case 'utf16': return 'UTF-16'; case 'utf16be': return 'UTF-16BE'; case 'utf16le': return 'UTF-16LE'; case 'utf32': return 'UTF-32'; case 'utf32be': return 'UTF-32BE'; case 'utf32le': return 'UTF-32LE'; case 'csventurainternational': case 'venturainternational': return 'Ventura-International'; case 'csventuramath': case 'venturamath': return 'Ventura-Math'; case 'csventuraus': case 'venturaus': return 'Ventura-US'; case 'csiso70videotexsupp1': case 'isoir70': case 'videotexsuppl': return 'videotex-suppl'; case 'csviqr': case 'viqr': return 'VIQR'; case 'csviscii': case 'viscii': return 'VISCII'; case 'csshiftjis': case 'cswindows31j': case 'mskanji': case 'shiftjis': case 'windows31j': return 'Windows-31J'; case 'iso885911': case 'tis620': return 'windows-874'; case 'cseuckr': case 'csksc56011987': case 'euckr': case 'isoir149': case 'korean': case 'ksc5601': case 'ksc56011987': case 'ksc56011989': case 'windows949': return 'windows-949'; case 'windows1250': return 'windows-1250'; case 'windows1251': return 'windows-1251'; case 'cp819': case 'csisolatin1': case 'ibm819': case 'iso88591': case 'iso885911987': case 'isoir100': case 'l1': case 'latin1': case 'windows1252': return 'windows-1252'; case 'windows1253': return 'windows-1253'; case 'csisolatin5': case 'iso88599': case 'iso885991989': case 'isoir148': case 'l5': case 'latin5': case 'windows1254': return 'windows-1254'; case 'windows1255': return 'windows-1255'; case 'windows1256': return 'windows-1256'; case 'windows1257': return 'windows-1257'; case 'windows1258': return 'windows-1258'; default: return $charset; } } public static function get_curl_version() { if (is_array($curl = curl_version())) { $curl = $curl['version']; } elseif (substr($curl, 0, 5) === 'curl/') { $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); } elseif (substr($curl, 0, 8) === 'libcurl/') { $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); } else { $curl = 0; } return $curl; } public static function strip_comments($data) { $output = ''; while (($start = strpos($data, '', $start)) !== false) { $data = substr_replace($data, '', 0, $end + 3); } else { $data = ''; } } return $output . $data; } public static function parse_date($dt) { $parser = SimplePie_Parse_Date::get(); return $parser->parse($dt); } public static function entities_decode($data) { $decoder = new SimplePie_Decode_HTML_Entities($data); return $decoder->parse(); } public static function uncomment_rfc822($string) { $string = (string) $string; $position = 0; $length = strlen($string); $depth = 0; $output = ''; while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) { $output .= substr($string, $position, $pos - $position); $position = $pos + 1; if ($string[$pos - 1] !== '\\') { $depth++; while ($depth && $position < $length) { $position += strcspn($string, '()', $position); if ($string[$position - 1] === '\\') { $position++; continue; } elseif (isset($string[$position])) { switch ($string[$position]) { case '(': $depth++; break; case ')': $depth--; break; } $position++; } else { break; } } } else { $output .= '('; } } $output .= substr($string, $position); return $output; } public static function parse_mime($mime) { if (($pos = strpos($mime, ';')) === false) { return trim($mime); } return trim(substr($mime, 0, $pos)); } public static function atom_03_construct_type($attribs) { if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) { $mode = SIMPLEPIE_CONSTRUCT_BASE64; } else { $mode = SIMPLEPIE_CONSTRUCT_NONE; } if (isset($attribs['']['type'])) { switch (strtolower(trim($attribs['']['type']))) { case 'text': case 'text/plain': return SIMPLEPIE_CONSTRUCT_TEXT | $mode; case 'html': case 'text/html': return SIMPLEPIE_CONSTRUCT_HTML | $mode; case 'xhtml': case 'application/xhtml+xml': return SIMPLEPIE_CONSTRUCT_XHTML | $mode; default: return SIMPLEPIE_CONSTRUCT_NONE | $mode; } } return SIMPLEPIE_CONSTRUCT_TEXT | $mode; } public static function atom_10_construct_type($attribs) { if (isset($attribs['']['type'])) { switch (strtolower(trim($attribs['']['type']))) { case 'text': return SIMPLEPIE_CONSTRUCT_TEXT; case 'html': return SIMPLEPIE_CONSTRUCT_HTML; case 'xhtml': return SIMPLEPIE_CONSTRUCT_XHTML; default: return SIMPLEPIE_CONSTRUCT_NONE; } } return SIMPLEPIE_CONSTRUCT_TEXT; } public static function atom_10_content_construct_type($attribs) { if (isset($attribs['']['type'])) { $type = strtolower(trim($attribs['']['type'])); switch ($type) { case 'text': return SIMPLEPIE_CONSTRUCT_TEXT; case 'html': return SIMPLEPIE_CONSTRUCT_HTML; case 'xhtml': return SIMPLEPIE_CONSTRUCT_XHTML; } if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') { return SIMPLEPIE_CONSTRUCT_NONE; } else { return SIMPLEPIE_CONSTRUCT_BASE64; } } return SIMPLEPIE_CONSTRUCT_TEXT; } public static function is_isegment_nz_nc($string) { return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); } public static function space_separated_tokens($string) { $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; $string_length = strlen($string); $position = strspn($string, $space_characters); $tokens = array(); while ($position < $string_length) { $len = strcspn($string, $space_characters, $position); $tokens[] = substr($string, $position, $len); $position += $len; $position += strspn($string, $space_characters, $position); } return $tokens; } public static function codepoint_to_utf8($codepoint) { $codepoint = (int) $codepoint; if ($codepoint < 0) { return false; } else if ($codepoint <= 0x7f) { return chr($codepoint); } else if ($codepoint <= 0x7ff) { return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); } else if ($codepoint <= 0xffff) { return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); } else if ($codepoint <= 0x10ffff) { return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); } return "\xEF\xBF\xBD"; } public static function parse_str($str) { $return = array(); $str = explode('&', $str); foreach ($str as $section) { if (strpos($section, '=') !== false) { list($name, $value) = explode('=', $section, 2); $return[urldecode($name)][] = urldecode($value); } else { $return[urldecode($section)][] = null; } } return $return; } public static function xml_encoding($data, $registry) { if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") { $encoding[] = 'UTF-32BE'; } elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") { $encoding[] = 'UTF-32LE'; } elseif (substr($data, 0, 2) === "\xFE\xFF") { $encoding[] = 'UTF-16BE'; } elseif (substr($data, 0, 2) === "\xFF\xFE") { $encoding[] = 'UTF-16LE'; } elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") { $encoding[] = 'UTF-8'; } elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") { if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) { $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'))); if ($parser->parse()) { $encoding[] = $parser->encoding; } } $encoding[] = 'UTF-32BE'; } elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") { if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) { $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'))); if ($parser->parse()) { $encoding[] = $parser->encoding; } } $encoding[] = 'UTF-32LE'; } elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") { if ($pos = strpos($data, "\x00\x3F\x00\x3E")) { $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'))); if ($parser->parse()) { $encoding[] = $parser->encoding; } } $encoding[] = 'UTF-16BE'; } elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") { if ($pos = strpos($data, "\x3F\x00\x3E\x00")) { $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'))); if ($parser->parse()) { $encoding[] = $parser->encoding; } } $encoding[] = 'UTF-16LE'; } elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") { if ($pos = strpos($data, "\x3F\x3E")) { $parser = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); if ($parser->parse()) { $encoding[] = $parser->encoding; } } $encoding[] = 'UTF-8'; } else { $encoding[] = 'UTF-8'; } return $encoding; } public static function output_javascript() { if (function_exists('ob_gzhandler')) { ob_start('ob_gzhandler'); } header('Content-type: text/javascript; charset: UTF-8'); header('Cache-Control: must-revalidate'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); ?> -function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { - if (placeholder != '') { - document.writeln(''); - } - else { - document.writeln(''); - } -} - -function embed_flash(bgcolor, width, height, link, loop, type) { - document.writeln(''); -} - -function embed_flv(width, height, link, placeholder, loop, player) { - document.writeln(''); -} - -function embed_wmedia(width, height, link) { - document.writeln(''); -} - $time) { $time = $mtime; } } return $time; } elseif (file_exists(dirname(__FILE__) . '/Core.php')) { return filemtime(dirname(__FILE__) . '/Core.php'); } return filemtime(__FILE__); } public static function debug(&$sp) { $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n"; $info .= 'PHP ' . PHP_VERSION . "\n"; if ($sp->error() !== null) { $info .= 'Error occurred: ' . $sp->error() . "\n"; } else { $info .= "No error found.\n"; } $info .= "Extensions:\n"; $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml'); foreach ($extensions as $ext) { if (extension_loaded($ext)) { $info .= " $ext loaded\n"; switch ($ext) { case 'pcre': $info .= ' Version ' . PCRE_VERSION . "\n"; break; case 'curl': $version = curl_version(); $info .= ' Version ' . $version['version'] . "\n"; break; case 'mbstring': $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n"; break; case 'iconv': $info .= ' Version ' . ICONV_VERSION . "\n"; break; case 'xml': $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n"; break; } } else { $info .= " $ext not loaded\n"; } } return $info; } public static function silence_errors($num, $str) { } public static function url_remove_credentials($url) { return preg_replace('#^(https?://)[^/:@]+:[^/:@]+@#i', '$1', $url); } } scheme = $scheme; $this->value = $value; } public function __toString() { return md5(serialize($this)); } public function get_scheme() { if ($this->scheme !== null) { return $this->scheme; } return null; } public function get_value() { if ($this->value !== null) { return $this->value; } return null; } } compressed_data = $data; $this->compressed_size = strlen($data); } public function parse() { if ($this->compressed_size >= $this->min_compressed_size) { if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") { return false; } $this->flags = ord($this->compressed_data[3]); if ($this->flags > 0x1F) { return false; } $this->position += 4; $mtime = substr($this->compressed_data, $this->position, 4); if (current(unpack('S', "\x00\x01")) === 1) { $mtime = strrev($mtime); } $this->MTIME = current(unpack('l', $mtime)); $this->position += 4; $this->XFL = ord($this->compressed_data[$this->position++]); $this->OS = ord($this->compressed_data[$this->position++]); if ($this->flags & 4) { $this->SI1 = $this->compressed_data[$this->position++]; $this->SI2 = $this->compressed_data[$this->position++]; if ($this->SI2 === "\x00") { return false; } $len = current(unpack('v', substr($this->compressed_data, $this->position, 2))); $this->position += 2; $this->min_compressed_size += $len + 4; if ($this->compressed_size >= $this->min_compressed_size) { $this->extra_field = substr($this->compressed_data, $this->position, $len); $this->position += $len; } else { return false; } } if ($this->flags & 8) { $len = strcspn($this->compressed_data, "\x00", $this->position); $this->min_compressed_size += $len + 1; if ($this->compressed_size >= $this->min_compressed_size) { $this->filename = substr($this->compressed_data, $this->position, $len); $this->position += $len + 1; } else { return false; } } if ($this->flags & 16) { $len = strcspn($this->compressed_data, "\x00", $this->position); $this->min_compressed_size += $len + 1; if ($this->compressed_size >= $this->min_compressed_size) { $this->comment = substr($this->compressed_data, $this->position, $len); $this->position += $len + 1; } else { return false; } } if ($this->flags & 2) { $this->min_compressed_size += $len + 2; if ($this->compressed_size >= $this->min_compressed_size) { $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2))); if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) { $this->position += 2; } else { return false; } } else { return false; } } if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) { return false; } $this->position = $this->compressed_size - 8; $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4))); $this->position += 4; $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4))); $this->position += 4; if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) { return false; } return true; } return false; } } $max) { $max = strlen($match[0]); $pos = $match[1]; } } $ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max); } if ($ip_parts[1] !== '') { return implode(':', $ip_parts); } return $ip_parts[0]; } private static function split_v6_v4($ip) { if (strpos($ip, '.') !== false) { $pos = strrpos($ip, ':'); $ipv6_part = substr($ip, 0, $pos); $ipv4_part = substr($ip, $pos + 1); return array($ipv6_part, $ipv4_part); } return array($ip, ''); } public static function check_ipv6($ip) { $ip = self::uncompress($ip); list($ipv6, $ipv4) = self::split_v6_v4($ip); $ipv6 = explode(':', $ipv6); $ipv4 = explode('.', $ipv4); if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) { foreach ($ipv6 as $ipv6_part) { if ($ipv6_part === '') return false; if (strlen($ipv6_part) > 4) return false; $ipv6_part = ltrim($ipv6_part, '0'); if ($ipv6_part === '') $ipv6_part = '0'; $value = hexdec($ipv6_part); if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) return false; } if (count($ipv4) === 4) { foreach ($ipv4 as $ipv4_part) { $value = (int) $ipv4_part; if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) return false; } } return true; } return false; } public static function checkIPv6($ip) { return self::check_ipv6($ip); } } options = array( 'host' => '127.0.0.1', 'port' => 11211, 'extras' => array( 'timeout' => 3600, 'prefix' => 'simplepie_', ), ); $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); $this->cache = new Memcache(); $this->cache->addServer($this->options['host'], (int) $this->options['port']); } public function save($data) { if ($data instanceof SimplePie) { $data = $data->data; } return $this->cache->set($this->name, serialize($data), MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']); } public function load() { $data = $this->cache->get($this->name); if ($data !== false) { return unserialize($data); } return false; } public function mtime() { $data = $this->cache->get($this->name); if ($data !== false) { return time(); } return false; } public function touch() { $data = $this->cache->get($this->name); if ($data !== false) { return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']); } return false; } public function unlink() { return $this->cache->delete($this->name, 0); } } location = $location; $this->filename = $name; $this->extension = $type; $this->name = "$this->location/$this->filename.$this->extension"; } public function save($data) { if (file_exists($this->name) && is_writable($this->name) || file_exists($this->location) && is_writable($this->location)) { if ($data instanceof SimplePie) { $data = $data->data; } $data = serialize($data); return (bool) file_put_contents($this->name, $data); } return false; } public function load() { if (file_exists($this->name) && is_readable($this->name)) { return unserialize(file_get_contents($this->name)); } return false; } public function mtime() { return @filemtime($this->name); } public function touch() { return @touch($this->name); } public function unlink() { if (file_exists($this->name)) { return unlink($this->name); } return false; } } get_items(); $items_by_id = array(); if (!empty($items)) { foreach ($items as $item) { $items_by_id[$item->get_id()] = $item; } if (count($items_by_id) !== count($items)) { $items_by_id = array(); foreach ($items as $item) { $items_by_id[$item->get_id(true)] = $item; } } if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) { $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) { $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) { $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) { $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; } else { $channel = null; } if ($channel !== null) { if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) { unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); } if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) { unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); } if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) { unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); } if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) { unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); } if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) { unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); } } if (isset($data->data['items'])) { unset($data->data['items']); } if (isset($data->data['ordered_items'])) { unset($data->data['ordered_items']); } } return array(serialize($data->data), $items_by_id); } } options = array( 'user' => null, 'pass' => null, 'host' => '127.0.0.1', 'port' => '3306', 'path' => '', 'extras' => array( 'prefix' => '', 'cache_purge_time' => 2592000 ), ); $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); $this->options['dbname'] = substr($this->options['path'], 1); try { $this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } catch (PDOException $e) { $this->mysql = null; return; } $this->id = $name . $type; if (!$query = $this->mysql->query('SHOW TABLES')) { $this->mysql = null; return; } $db = array(); while ($row = $query->fetchColumn()) { $db[] = $row; } if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) { $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); if ($query === false) { trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING); $this->mysql = null; return; } } if (!in_array($this->options['extras']['prefix'] . 'items', $db)) { $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); if ($query === false) { trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING); $this->mysql = null; return; } } } public function save($data) { if ($this->mysql === null) { return false; } $query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' . '`' . $this->options['extras']['prefix'] . 'items` i ' . 'WHERE cd.id = i.feed_id ' . 'AND cd.mtime < (unix_timestamp() - :purge_time)'); $query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']); if (!$query->execute()) { return false; } if ($data instanceof SimplePie) { $data = clone $data; $prepared = self::prepare_simplepie_object_for_cache($data); $query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); $query->bindValue(':feed', $this->id); if ($query->execute()) { if ($query->fetchColumn() > 0) { $items = count($prepared[1]); if ($items) { $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; $query = $this->mysql->prepare($sql); $query->bindValue(':items', $items); } else { $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; $query = $this->mysql->prepare($sql); } $query->bindValue(':data', $prepared[0]); $query->bindValue(':time', time()); $query->bindValue(':feed', $this->id); if (!$query->execute()) { return false; } } else { $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); $query->bindValue(':feed', $this->id); $query->bindValue(':count', count($prepared[1])); $query->bindValue(':data', $prepared[0]); $query->bindValue(':time', time()); if (!$query->execute()) { return false; } } $ids = array_keys($prepared[1]); if (!empty($ids)) { foreach ($ids as $id) { $database_ids[] = $this->mysql->quote($id); } $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed'); $query->bindValue(':feed', $this->id); if ($query->execute()) { $existing_ids = array(); while ($row = $query->fetchColumn()) { $existing_ids[] = $row; } $new_ids = array_diff($ids, $existing_ids); foreach ($new_ids as $new_id) { if (!($date = $prepared[1][$new_id]->get_date('U'))) { $date = time(); } $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)'); $query->bindValue(':feed', $this->id); $query->bindValue(':id', $new_id); $query->bindValue(':data', serialize($prepared[1][$new_id]->data)); $query->bindValue(':date', $date); if (!$query->execute()) { return false; } } return true; } } else { return true; } } } else { $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); $query->bindValue(':feed', $this->id); if ($query->execute()) { if ($query->rowCount() > 0) { $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed'); $query->bindValue(':data', serialize($data)); $query->bindValue(':time', time()); $query->bindValue(':feed', $this->id); if ($this->execute()) { return true; } } else { $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); $query->bindValue(':id', $this->id); $query->bindValue(':data', serialize($data)); $query->bindValue(':time', time()); if ($query->execute()) { return true; } } } } return false; } public function load() { if ($this->mysql === null) { return false; } $query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); $query->bindValue(':id', $this->id); if ($query->execute() && ($row = $query->fetch())) { $data = unserialize($row[1]); if (isset($this->options['items'][0])) { $items = (int) $this->options['items'][0]; } else { $items = (int) $row[0]; } if ($items !== 0) { if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) { $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) { $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) { $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) { $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; } else { $feed = null; } if ($feed !== null) { $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC'; if ($items > 0) { $sql .= ' LIMIT ' . $items; } $query = $this->mysql->prepare($sql); $query->bindValue(':feed', $this->id); if ($query->execute()) { while ($row = $query->fetchColumn()) { $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row); } } else { return false; } } } return $data; } return false; } public function mtime() { if ($this->mysql === null) { return false; } $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); $query->bindValue(':id', $this->id); if ($query->execute() && ($time = $query->fetchColumn())) { return $time; } return false; } public function touch() { if ($this->mysql === null) { return false; } $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id'); $query->bindValue(':time', time()); $query->bindValue(':id', $this->id); return $query->execute() && $query->rowCount() > 0; } public function unlink() { if ($this->mysql === null) { return false; } $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); $query->bindValue(':id', $this->id); $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id'); $query2->bindValue(':id', $this->id); return $query->execute() && $query2->execute(); } } connect($parsed['host'], $parsed['port']); if (isset($parsed['pass'])) { $redis->auth($parsed['pass']); } if (isset($parsed['path'])) { $redis->select((int)substr($parsed['path'], 1)); } $this->cache = $redis; if (!is_null($options) && is_array($options)) { $this->options = $options; } else { $this->options = array ( 'prefix' => 'rss:simple_primary:', 'expire' => 0, ); } $this->name = $this->options['prefix'] . $name; } public function setRedisClient(\Redis $cache) { $this->cache = $cache; } public function save($data) { if ($data instanceof SimplePie) { $data = $data->data; } $response = $this->cache->set($this->name, serialize($data)); if ($this->options['expire']) { $this->cache->expire($this->name, $this->options['expire']); } return $response; } public function load() { $data = $this->cache->get($this->name); if ($data !== false) { return unserialize($data); } return false; } public function mtime() { $data = $this->cache->get($this->name); if ($data !== false) { return time(); } return false; } public function touch() { $data = $this->cache->get($this->name); if ($data !== false) { $return = $this->cache->set($this->name, $data); if ($this->options['expire']) { return $this->cache->expire($this->name, $this->options['expire']); } return $return; } return false; } public function unlink() { return $this->cache->set($this->name, null); } } options = array( 'host' => '127.0.0.1', 'port' => 11211, 'extras' => array( 'timeout' => 3600, 'prefix' => 'simplepie_', ), ); $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); $this->cache = new Memcached(); $this->cache->addServer($this->options['host'], (int)$this->options['port']); } public function save($data) { if ($data instanceof SimplePie) { $data = $data->data; } return $this->setData(serialize($data)); } public function load() { $data = $this->cache->get($this->name); if ($data !== false) { return unserialize($data); } return false; } public function mtime() { $data = $this->cache->get($this->name . '_mtime'); return (int) $data; } public function touch() { $data = $this->cache->get($this->name); return $this->setData($data); } public function unlink() { return $this->cache->delete($this->name, 0); } private function setData($data) { if ($data !== false) { $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); } return false; } } 1, 'monday' => 1, 'tue' => 2, 'tuesday' => 2, 'wed' => 3, 'wednesday' => 3, 'thu' => 4, 'thursday' => 4, 'fri' => 5, 'friday' => 5, 'sat' => 6, 'saturday' => 6, 'sun' => 7, 'sunday' => 7, 'maandag' => 1, 'dinsdag' => 2, 'woensdag' => 3, 'donderdag' => 4, 'vrijdag' => 5, 'zaterdag' => 6, 'zondag' => 7, 'lundi' => 1, 'mardi' => 2, 'mercredi' => 3, 'jeudi' => 4, 'vendredi' => 5, 'samedi' => 6, 'dimanche' => 7, 'montag' => 1, 'mo' => 1, 'dienstag' => 2, 'di' => 2, 'mittwoch' => 3, 'mi' => 3, 'donnerstag' => 4, 'do' => 4, 'freitag' => 5, 'fr' => 5, 'samstag' => 6, 'sa' => 6, 'sonnabend' => 6, 'so' => 7, 'sonntag' => 7, 'lunedì' => 1, 'martedì' => 2, 'mercoledì' => 3, 'giovedì' => 4, 'venerdì' => 5, 'sabato' => 6, 'domenica' => 7, 'lunes' => 1, 'martes' => 2, 'miércoles' => 3, 'jueves' => 4, 'viernes' => 5, 'sábado' => 6, 'domingo' => 7, 'maanantai' => 1, 'tiistai' => 2, 'keskiviikko' => 3, 'torstai' => 4, 'perjantai' => 5, 'lauantai' => 6, 'sunnuntai' => 7, 'hétfő' => 1, 'kedd' => 2, 'szerda' => 3, 'csütörtok' => 4, 'péntek' => 5, 'szombat' => 6, 'vasárnap' => 7, 'Δευ' => 1, 'Τρι' => 2, 'Τετ' => 3, 'Πεμ' => 4, 'Παρ' => 5, 'Σαβ' => 6, 'Κυρ' => 7, 'Пн.' => 1, 'Вт.' => 2, 'Ср.' => 3, 'Чт.' => 4, 'Пт.' => 5, 'Сб.' => 6, 'Вс.' => 7, ); var $month = array( 'jan' => 1, 'january' => 1, 'feb' => 2, 'february' => 2, 'mar' => 3, 'march' => 3, 'apr' => 4, 'april' => 4, 'may' => 5, 'jun' => 6, 'june' => 6, 'jul' => 7, 'july' => 7, 'aug' => 8, 'august' => 8, 'sep' => 9, 'september' => 9, 'oct' => 10, 'october' => 10, 'nov' => 11, 'november' => 11, 'dec' => 12, 'december' => 12, 'januari' => 1, 'februari' => 2, 'maart' => 3, 'april' => 4, 'mei' => 5, 'juni' => 6, 'juli' => 7, 'augustus' => 8, 'september' => 9, 'oktober' => 10, 'november' => 11, 'december' => 12, 'janvier' => 1, 'février' => 2, 'mars' => 3, 'avril' => 4, 'mai' => 5, 'juin' => 6, 'juillet' => 7, 'août' => 8, 'septembre' => 9, 'octobre' => 10, 'novembre' => 11, 'décembre' => 12, 'januar' => 1, 'jan' => 1, 'februar' => 2, 'feb' => 2, 'märz' => 3, 'mär' => 3, 'april' => 4, 'apr' => 4, 'mai' => 5, 'juni' => 6, 'jun' => 6, 'juli' => 7, 'jul' => 7, 'august' => 8, 'aug' => 8, 'september' => 9, 'sep' => 9, 'oktober' => 10, 'okt' => 10, 'november' => 11, 'nov' => 11, 'dezember' => 12, 'dez' => 12, 'gennaio' => 1, 'febbraio' => 2, 'marzo' => 3, 'aprile' => 4, 'maggio' => 5, 'giugno' => 6, 'luglio' => 7, 'agosto' => 8, 'settembre' => 9, 'ottobre' => 10, 'novembre' => 11, 'dicembre' => 12, 'enero' => 1, 'febrero' => 2, 'marzo' => 3, 'abril' => 4, 'mayo' => 5, 'junio' => 6, 'julio' => 7, 'agosto' => 8, 'septiembre' => 9, 'setiembre' => 9, 'octubre' => 10, 'noviembre' => 11, 'diciembre' => 12, 'tammikuu' => 1, 'helmikuu' => 2, 'maaliskuu' => 3, 'huhtikuu' => 4, 'toukokuu' => 5, 'kesäkuu' => 6, 'heinäkuu' => 7, 'elokuu' => 8, 'suuskuu' => 9, 'lokakuu' => 10, 'marras' => 11, 'joulukuu' => 12, 'január' => 1, 'február' => 2, 'március' => 3, 'április' => 4, 'május' => 5, 'június' => 6, 'július' => 7, 'augusztus' => 8, 'szeptember' => 9, 'október' => 10, 'november' => 11, 'december' => 12, 'Ιαν' => 1, 'Φεβ' => 2, 'Μάώ' => 3, 'Μαώ' => 3, 'Απρ' => 4, 'Μάι' => 5, 'Μαϊ' => 5, 'Μαι' => 5, 'Ιούν' => 6, 'Ιον' => 6, 'Ιούλ' => 7, 'Ιολ' => 7, 'Αύγ' => 8, 'Αυγ' => 8, 'Σεπ' => 9, 'Οκτ' => 10, 'Νοέ' => 11, 'Δεκ' => 12, 'Янв' => 1, 'января' => 1, 'Фев' => 2, 'февраля' => 2, 'Мар' => 3, 'марта' => 3, 'Апр' => 4, 'апреля' => 4, 'Май' => 5, 'мая' => 5, 'Июн' => 6, 'июня' => 6, 'Июл' => 7, 'июля' => 7, 'Авг' => 8, 'августа' => 8, 'Сен' => 9, 'сентября' => 9, 'Окт' => 10, 'октября' => 10, 'Ноя' => 11, 'ноября' => 11, 'Дек' => 12, 'декабря' => 12, ); var $timezone = array( 'ACDT' => 37800, 'ACIT' => 28800, 'ACST' => 34200, 'ACT' => -18000, 'ACWDT' => 35100, 'ACWST' => 31500, 'AEDT' => 39600, 'AEST' => 36000, 'AFT' => 16200, 'AKDT' => -28800, 'AKST' => -32400, 'AMDT' => 18000, 'AMT' => -14400, 'ANAST' => 46800, 'ANAT' => 43200, 'ART' => -10800, 'AZOST' => -3600, 'AZST' => 18000, 'AZT' => 14400, 'BIOT' => 21600, 'BIT' => -43200, 'BOT' => -14400, 'BRST' => -7200, 'BRT' => -10800, 'BST' => 3600, 'BTT' => 21600, 'CAST' => 18000, 'CAT' => 7200, 'CCT' => 23400, 'CDT' => -18000, 'CEDT' => 7200, 'CEST' => 7200, 'CET' => 3600, 'CGST' => -7200, 'CGT' => -10800, 'CHADT' => 49500, 'CHAST' => 45900, 'CIST' => -28800, 'CKT' => -36000, 'CLDT' => -10800, 'CLST' => -14400, 'COT' => -18000, 'CST' => -21600, 'CVT' => -3600, 'CXT' => 25200, 'DAVT' => 25200, 'DTAT' => 36000, 'EADT' => -18000, 'EAST' => -21600, 'EAT' => 10800, 'ECT' => -18000, 'EDT' => -14400, 'EEST' => 10800, 'EET' => 7200, 'EGT' => -3600, 'EKST' => 21600, 'EST' => -18000, 'FJT' => 43200, 'FKDT' => -10800, 'FKST' => -14400, 'FNT' => -7200, 'GALT' => -21600, 'GEDT' => 14400, 'GEST' => 10800, 'GFT' => -10800, 'GILT' => 43200, 'GIT' => -32400, 'GST' => 14400, 'GST' => -7200, 'GYT' => -14400, 'HAA' => -10800, 'HAC' => -18000, 'HADT' => -32400, 'HAE' => -14400, 'HAP' => -25200, 'HAR' => -21600, 'HAST' => -36000, 'HAT' => -9000, 'HAY' => -28800, 'HKST' => 28800, 'HMT' => 18000, 'HNA' => -14400, 'HNC' => -21600, 'HNE' => -18000, 'HNP' => -28800, 'HNR' => -25200, 'HNT' => -12600, 'HNY' => -32400, 'IRDT' => 16200, 'IRKST' => 32400, 'IRKT' => 28800, 'IRST' => 12600, 'JFDT' => -10800, 'JFST' => -14400, 'JST' => 32400, 'KGST' => 21600, 'KGT' => 18000, 'KOST' => 39600, 'KOVST' => 28800, 'KOVT' => 25200, 'KRAST' => 28800, 'KRAT' => 25200, 'KST' => 32400, 'LHDT' => 39600, 'LHST' => 37800, 'LINT' => 50400, 'LKT' => 21600, 'MAGST' => 43200, 'MAGT' => 39600, 'MAWT' => 21600, 'MDT' => -21600, 'MESZ' => 7200, 'MEZ' => 3600, 'MHT' => 43200, 'MIT' => -34200, 'MNST' => 32400, 'MSDT' => 14400, 'MSST' => 10800, 'MST' => -25200, 'MUT' => 14400, 'MVT' => 18000, 'MYT' => 28800, 'NCT' => 39600, 'NDT' => -9000, 'NFT' => 41400, 'NMIT' => 36000, 'NOVST' => 25200, 'NOVT' => 21600, 'NPT' => 20700, 'NRT' => 43200, 'NST' => -12600, 'NUT' => -39600, 'NZDT' => 46800, 'NZST' => 43200, 'OMSST' => 25200, 'OMST' => 21600, 'PDT' => -25200, 'PET' => -18000, 'PETST' => 46800, 'PETT' => 43200, 'PGT' => 36000, 'PHOT' => 46800, 'PHT' => 28800, 'PKT' => 18000, 'PMDT' => -7200, 'PMST' => -10800, 'PONT' => 39600, 'PST' => -28800, 'PWT' => 32400, 'PYST' => -10800, 'PYT' => -14400, 'RET' => 14400, 'ROTT' => -10800, 'SAMST' => 18000, 'SAMT' => 14400, 'SAST' => 7200, 'SBT' => 39600, 'SCDT' => 46800, 'SCST' => 43200, 'SCT' => 14400, 'SEST' => 3600, 'SGT' => 28800, 'SIT' => 28800, 'SRT' => -10800, 'SST' => -39600, 'SYST' => 10800, 'SYT' => 7200, 'TFT' => 18000, 'THAT' => -36000, 'TJT' => 18000, 'TKT' => -36000, 'TMT' => 18000, 'TOT' => 46800, 'TPT' => 32400, 'TRUT' => 36000, 'TVT' => 43200, 'TWT' => 28800, 'UYST' => -7200, 'UYT' => -10800, 'UZT' => 18000, 'VET' => -14400, 'VLAST' => 39600, 'VLAT' => 36000, 'VOST' => 21600, 'VUT' => 39600, 'WAST' => 7200, 'WAT' => 3600, 'WDT' => 32400, 'WEST' => 3600, 'WFT' => 43200, 'WIB' => 25200, 'WIT' => 32400, 'WITA' => 28800, 'WKST' => 18000, 'WST' => 28800, 'YAKST' => 36000, 'YAKT' => 32400, 'YAPT' => 36000, 'YEKST' => 21600, 'YEKT' => 18000, ); var $day_pcre; var $month_pcre; var $built_in = array(); var $user = array(); public function __construct() { $this->day_pcre = '(' . implode('|', array_keys($this->day)) . ')'; $this->month_pcre = '(' . implode('|', array_keys($this->month)) . ')'; static $cache; if (!isset($cache[get_class($this)])) { $all_methods = get_class_methods($this); foreach ($all_methods as $method) { if (strtolower(substr($method, 0, 5)) === 'date_') { $cache[get_class($this)][] = $method; } } } foreach ($cache[get_class($this)] as $method) { $this->built_in[] = $method; } } public static function get() { static $object; if (!$object) { $object = new SimplePie_Parse_Date; } return $object; } public function parse($date) { foreach ($this->user as $method) { if (($returned = call_user_func($method, $date)) !== false) { return $returned; } } foreach ($this->built_in as $method) { if (($returned = call_user_func(array($this, $method), $date)) !== false) { return $returned; } } return false; } public function add_callback($callback) { if (is_callable($callback)) { $this->user[] = $callback; } else { trigger_error('User-supplied function must be a valid callback', E_USER_WARNING); } } public function date_w3cdtf($date) { static $pcre; if (!$pcre) { $year = '([0-9]{4})'; $month = $day = $hour = $minute = $second = '([0-9]{2})'; $decimal = '([0-9]*)'; $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))'; $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/'; } if (preg_match($pcre, $date, $match)) { for ($i = count($match); $i <= 3; $i++) { $match[$i] = '1'; } for ($i = count($match); $i <= 7; $i++) { $match[$i] = '0'; } if (isset($match[9]) && $match[9] !== '') { $timezone = $match[10] * 3600; $timezone += $match[11] * 60; if ($match[9] === '-') { $timezone = 0 - $timezone; } } else { $timezone = 0; } $second = round((int)$match[6] + (int)$match[7] / (10 ** strlen($match[7]))); return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; } return false; } public function remove_rfc2822_comments($string) { $string = (string) $string; $position = 0; $length = strlen($string); $depth = 0; $output = ''; while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) { $output .= substr($string, $position, $pos - $position); $position = $pos + 1; if ($pos === 0 || $string[$pos - 1] !== '\\') { $depth++; while ($depth && $position < $length) { $position += strcspn($string, '()', $position); if ($string[$position - 1] === '\\') { $position++; continue; } elseif (isset($string[$position])) { switch ($string[$position]) { case '(': $depth++; break; case ')': $depth--; break; } $position++; } else { break; } } } else { $output .= '('; } } $output .= substr($string, $position); return $output; } public function date_rfc2822($date) { static $pcre; if (!$pcre) { $wsp = '[\x09\x20]'; $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; $optional_fws = $fws . '?'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $hour = $minute = $second = '([0-9]{2})'; $year = '([0-9]{2,4})'; $num_zone = '([+\-])([0-9]{2})([0-9]{2})'; $character_zone = '([A-Z]{1,5})'; $zone = '(?:' . $num_zone . '|' . $character_zone . ')'; $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i'; } if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match)) { $month = $this->month[strtolower($match[3])]; if ($match[8] !== '') { $timezone = $match[9] * 3600; $timezone += $match[10] * 60; if ($match[8] === '-') { $timezone = 0 - $timezone; } } elseif (isset($this->timezone[strtoupper($match[11])])) { $timezone = $this->timezone[strtoupper($match[11])]; } else { $timezone = 0; } if ($match[4] < 50) { $match[4] += 2000; } elseif ($match[4] < 1000) { $match[4] += 1900; } if ($match[7] !== '') { $second = $match[7]; } else { $second = 0; } return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone; } return false; } public function date_rfc850($date) { static $pcre; if (!$pcre) { $space = '[\x09\x20]+'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $year = $hour = $minute = $second = '([0-9]{2})'; $zone = '([A-Z]{1,5})'; $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i'; } if (preg_match($pcre, $date, $match)) { $month = $this->month[strtolower($match[3])]; if (isset($this->timezone[strtoupper($match[8])])) { $timezone = $this->timezone[strtoupper($match[8])]; } else { $timezone = 0; } if ($match[4] < 50) { $match[4] += 2000; } else { $match[4] += 1900; } return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone; } return false; } public function date_asctime($date) { static $pcre; if (!$pcre) { $space = '[\x09\x20]+'; $wday_name = $this->day_pcre; $mon_name = $this->month_pcre; $day = '([0-9]{1,2})'; $hour = $sec = $min = '([0-9]{2})'; $year = '([0-9]{4})'; $terminator = '\x0A?\x00?'; $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i'; } if (preg_match($pcre, $date, $match)) { $month = $this->month[strtolower($match[2])]; return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]); } return false; } public function date_strtotime($date) { $strtotime = strtotime($date); if ($strtotime === -1 || $strtotime === false) { return false; } return $strtotime; } } file = $file; } public function get_type() { if (isset($this->file->headers['content-type'])) { if (!isset($this->file->headers['content-encoding']) && ($this->file->headers['content-type'] === 'text/plain' || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1' || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1' || $this->file->headers['content-type'] === 'text/plain; charset=UTF-8')) { return $this->text_or_binary(); } if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) { $official = substr($this->file->headers['content-type'], 0, $pos); } else { $official = $this->file->headers['content-type']; } $official = trim(strtolower($official)); if ($official === 'unknown/unknown' || $official === 'application/unknown') { return $this->unknown(); } elseif (substr($official, -4) === '+xml' || $official === 'text/xml' || $official === 'application/xml') { return $official; } elseif (substr($official, 0, 6) === 'image/') { if ($return = $this->image()) { return $return; } return $official; } elseif ($official === 'text/html') { return $this->feed_or_html(); } return $official; } return $this->unknown(); } public function text_or_binary() { if (substr($this->file->body, 0, 2) === "\xFE\xFF" || substr($this->file->body, 0, 2) === "\xFF\xFE" || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF" || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") { return 'text/plain'; } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) { return 'application/octet-stream'; } return 'text/plain'; } public function unknown() { $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20"); if (strtolower(substr($this->file->body, $ws, 14)) === 'file->body, $ws, 5)) === 'file->body, $ws, 7)) === 'file->body, 0, 5) === '%PDF-') { return 'application/pdf'; } elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') { return 'application/postscript'; } elseif (substr($this->file->body, 0, 6) === 'GIF87a' || substr($this->file->body, 0, 6) === 'GIF89a') { return 'image/gif'; } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { return 'image/png'; } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") { return 'image/jpeg'; } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") { return 'image/bmp'; } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") { return 'image/vnd.microsoft.icon'; } return $this->text_or_binary(); } public function image() { if (substr($this->file->body, 0, 6) === 'GIF87a' || substr($this->file->body, 0, 6) === 'GIF89a') { return 'image/gif'; } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { return 'image/png'; } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") { return 'image/jpeg'; } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") { return 'image/bmp'; } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") { return 'image/vnd.microsoft.icon'; } return false; } public function feed_or_html() { $len = strlen($this->file->body); $pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF"); while ($pos < $len) { switch ($this->file->body[$pos]) { case "\x09": case "\x0A": case "\x0D": case "\x20": $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos); continue 2; case '<': $pos++; break; default: return 'text/html'; } if (substr($this->file->body, $pos, 3) === '!--') { $pos += 3; if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) { $pos += 3; } else { return 'text/html'; } } elseif (substr($this->file->body, $pos, 1) === '!') { if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) { $pos++; } else { return 'text/html'; } } elseif (substr($this->file->body, $pos, 1) === '?') { if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) { $pos += 2; } else { return 'text/html'; } } elseif (substr($this->file->body, $pos, 3) === 'rss' || substr($this->file->body, $pos, 7) === 'rdf:RDF') { return 'application/rss+xml'; } elseif (substr($this->file->body, $pos, 4) === 'feed') { return 'application/atom+xml'; } else { return 'text/html'; } } return 'text/html'; } } data = $data; $this->data_length = strlen($this->data); } public function parse() { while ($this->state && $this->state !== 'emit' && $this->has_data()) { $state = $this->state; $this->$state(); } $this->data = ''; if ($this->state === 'emit') { return true; } $this->version = ''; $this->encoding = ''; $this->standalone = ''; return false; } public function has_data() { return (bool) ($this->position < $this->data_length); } public function skip_whitespace() { $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position); $this->position += $whitespace; return $whitespace; } public function get_value() { $quote = substr($this->data, $this->position, 1); if ($quote === '"' || $quote === "'") { $this->position++; $len = strcspn($this->data, $quote, $this->position); if ($this->has_data()) { $value = substr($this->data, $this->position, $len); $this->position += $len + 1; return $value; } } return false; } public function before_version_name() { if ($this->skip_whitespace()) { $this->state = 'version_name'; } else { $this->state = false; } } public function version_name() { if (substr($this->data, $this->position, 7) === 'version') { $this->position += 7; $this->skip_whitespace(); $this->state = 'version_equals'; } else { $this->state = false; } } public function version_equals() { if (substr($this->data, $this->position, 1) === '=') { $this->position++; $this->skip_whitespace(); $this->state = 'version_value'; } else { $this->state = false; } } public function version_value() { if ($this->version = $this->get_value()) { $this->skip_whitespace(); if ($this->has_data()) { $this->state = 'encoding_name'; } else { $this->state = 'emit'; } } else { $this->state = false; } } public function encoding_name() { if (substr($this->data, $this->position, 8) === 'encoding') { $this->position += 8; $this->skip_whitespace(); $this->state = 'encoding_equals'; } else { $this->state = 'standalone_name'; } } public function encoding_equals() { if (substr($this->data, $this->position, 1) === '=') { $this->position++; $this->skip_whitespace(); $this->state = 'encoding_value'; } else { $this->state = false; } } public function encoding_value() { if ($this->encoding = $this->get_value()) { $this->skip_whitespace(); if ($this->has_data()) { $this->state = 'standalone_name'; } else { $this->state = 'emit'; } } else { $this->state = false; } } public function standalone_name() { if (substr($this->data, $this->position, 10) === 'standalone') { $this->position += 10; $this->skip_whitespace(); $this->state = 'standalone_equals'; } else { $this->state = false; } } public function standalone_equals() { if (substr($this->data, $this->position, 1) === '=') { $this->position++; $this->skip_whitespace(); $this->state = 'standalone_value'; } else { $this->state = false; } } public function standalone_value() { if ($standalone = $this->get_value()) { switch ($standalone) { case 'yes': $this->standalone = true; break; case 'no': $this->standalone = false; break; default: $this->state = false; return; } $this->skip_whitespace(); if ($this->has_data()) { $this->state = false; } else { $this->state = 'emit'; } } else { $this->state = false; } } } data = $data; } public function parse() { while (($this->position = strpos($this->data, '&', $this->position)) !== false) { $this->consume(); $this->entity(); $this->consumed = ''; } return $this->data; } public function consume() { if (isset($this->data[$this->position])) { $this->consumed .= $this->data[$this->position]; return $this->data[$this->position++]; } return false; } public function consume_range($chars) { if ($len = strspn($this->data, $chars, $this->position)) { $data = substr($this->data, $this->position, $len); $this->consumed .= $data; $this->position += $len; return $data; } return false; } public function unconsume() { $this->consumed = substr($this->consumed, 0, -1); $this->position--; } public function entity() { switch ($this->consume()) { case "\x09": case "\x0A": case "\x0B": case "\x0C": case "\x20": case "\x3C": case "\x26": case false: break; case "\x23": switch ($this->consume()) { case "\x78": case "\x58": $range = '0123456789ABCDEFabcdef'; $hex = true; break; default: $range = '0123456789'; $hex = false; $this->unconsume(); break; } if ($codepoint = $this->consume_range($range)) { static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8"); if ($hex) { $codepoint = hexdec($codepoint); } else { $codepoint = intval($codepoint); } if (isset($windows_1252_specials[$codepoint])) { $replacement = $windows_1252_specials[$codepoint]; } else { $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); } if (!in_array($this->consume(), array(';', false), true)) { $this->unconsume(); } $consumed_length = strlen($this->consumed); $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length); $this->position += strlen($replacement) - $consumed_length; } break; default: static $entities = array( 'Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C" ); for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) { $consumed = substr($this->consumed, 1); if (isset($entities[$consumed])) { $match = $consumed; } } if ($match !== null) { $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); $this->position += strlen($entities[$match]) - strlen($consumed) - 1; } break; } } } data = $data; $this->data_length = strlen($this->data); } public function parse() { while ($this->state && $this->state !== 'emit' && $this->has_data()) { $state = $this->state; $this->$state(); } $this->data = ''; if ($this->state === 'emit' || $this->state === 'body') { return true; } $this->http_version = ''; $this->status_code = ''; $this->reason = ''; $this->headers = array(); $this->body = ''; return false; } protected function has_data() { return (bool) ($this->position < $this->data_length); } protected function is_linear_whitespace() { return (bool) ($this->data[$this->position] === "\x09" || $this->data[$this->position] === "\x20" || ($this->data[$this->position] === "\x0A" && isset($this->data[$this->position + 1]) && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20"))); } protected function http_version() { if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') { $len = strspn($this->data, '0123456789.', 5); $this->http_version = substr($this->data, 5, $len); $this->position += 5 + $len; if (substr_count($this->http_version, '.') <= 1) { $this->http_version = (float) $this->http_version; $this->position += strspn($this->data, "\x09\x20", $this->position); $this->state = 'status'; } else { $this->state = false; } } else { $this->state = false; } } protected function status() { if ($len = strspn($this->data, '0123456789', $this->position)) { $this->status_code = (int) substr($this->data, $this->position, $len); $this->position += $len; $this->state = 'reason'; } else { $this->state = false; } } protected function reason() { $len = strcspn($this->data, "\x0A", $this->position); $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20"); $this->position += $len + 1; $this->state = 'new_line'; } protected function new_line() { $this->value = trim($this->value, "\x0D\x20"); if ($this->name !== '' && $this->value !== '') { $this->name = strtolower($this->name); if (isset($this->headers[$this->name]) && $this->name !== 'content-type') { $this->headers[$this->name] .= ', ' . $this->value; } else { $this->headers[$this->name] = $this->value; } } $this->name = ''; $this->value = ''; if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") { $this->position += 2; $this->state = 'body'; } elseif ($this->data[$this->position] === "\x0A") { $this->position++; $this->state = 'body'; } else { $this->state = 'name'; } } protected function name() { $len = strcspn($this->data, "\x0A:", $this->position); if (isset($this->data[$this->position + $len])) { if ($this->data[$this->position + $len] === "\x0A") { $this->position += $len; $this->state = 'new_line'; } else { $this->name = substr($this->data, $this->position, $len); $this->position += $len + 1; $this->state = 'value'; } } else { $this->state = false; } } protected function linear_whitespace() { do { if (substr($this->data, $this->position, 2) === "\x0D\x0A") { $this->position += 2; } elseif ($this->data[$this->position] === "\x0A") { $this->position++; } $this->position += strspn($this->data, "\x09\x20", $this->position); } while ($this->has_data() && $this->is_linear_whitespace()); $this->value .= "\x20"; } protected function value() { if ($this->is_linear_whitespace()) { $this->linear_whitespace(); } else { switch ($this->data[$this->position]) { case '"': if (strtolower($this->name) === 'etag') { $this->value .= '"'; $this->position++; $this->state = 'value_char'; break; } $this->position++; $this->state = 'quote'; break; case "\x0A": $this->position++; $this->state = 'new_line'; break; default: $this->state = 'value_char'; break; } } } protected function value_char() { $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position); $this->value .= substr($this->data, $this->position, $len); $this->position += $len; $this->state = 'value'; } protected function quote() { if ($this->is_linear_whitespace()) { $this->linear_whitespace(); } else { switch ($this->data[$this->position]) { case '"': $this->position++; $this->state = 'value'; break; case "\x0A": $this->position++; $this->state = 'new_line'; break; case '\\': $this->position++; $this->state = 'quote_escaped'; break; default: $this->state = 'quote_char'; break; } } } protected function quote_char() { $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position); $this->value .= substr($this->data, $this->position, $len); $this->position += $len; $this->state = 'value'; } protected function quote_escaped() { $this->value .= $this->data[$this->position]; $this->position++; $this->state = 'quote'; } protected function body() { $this->body = substr($this->data, $this->position); if (!empty($this->headers['transfer-encoding'])) { unset($this->headers['transfer-encoding']); $this->state = 'chunked'; } else { $this->state = 'emit'; } } protected function chunked() { if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) { $this->state = 'emit'; return; } $decoded = ''; $encoded = $this->body; while (true) { $is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches ); if (!$is_chunked) { $this->state = 'emit'; return; } $length = hexdec(trim($matches[1])); if ($length === 0) { $this->state = 'emit'; $this->body = $decoded; return; } $chunk_length = strlen($matches[0]); $decoded .= $part = substr($encoded, $chunk_length, $length); $encoded = substr($encoded, $chunk_length + $length + 2); if (trim($encoded) === '0' || empty($encoded)) { $this->state = 'emit'; $this->body = $decoded; return; } } } static public function prepareHeaders($headers, $count = 1) { $data = explode("\r\n\r\n", $headers, $count); $data = array_pop($data); if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n")) { $exploded = explode("\r\n\r\n", $data, 2); $data = end($exploded); } if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n")) { $exploded = explode("\r\n\r\n", $data, 2); $data = end($exploded); } return $data; } } /*! This file is auto-generated */ -/*! - * jQuery UI CSS Framework 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/theming/ - */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}/*! - * jQuery UI Resizable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-button{display:inline-block;text-decoration:none;font-size:13px;line-height:2;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box;color:#50575e;border-color:#c3c4c7;background:#f6f7f7;box-shadow:0 1px 0 #c3c4c7;vertical-align:top}.ui-button:active,.ui-button:focus{outline:0}.ui-button::-moz-focus-inner{border-width:0;border-style:none;padding:0}.ui-button:focus,.ui-button:hover{background:#f6f7f7;border-color:#8c8f94;color:#1d2327}.ui-button:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.ui-button:active{background:#f0f0f1;border-color:#8c8f94;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.ui-button:disabled,.ui-button[disabled]{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;text-shadow:0 1px 0 #fff!important;cursor:default;transform:none!important}@media screen and (max-width:782px){.ui-button{padding:6px 14px;line-height:normal;font-size:14px;vertical-align:middle;height:auto;margin-bottom:4px}}.ui-dialog{position:absolute;top:0;left:0;z-index:100102;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);overflow:hidden}.ui-dialog-titlebar{background:#fff;border-bottom:1px solid #dcdcde;height:36px;font-size:18px;font-weight:600;line-height:2;padding:0 36px 0 16px}.ui-button.ui-dialog-titlebar-close{background:0 0;border:none;box-shadow:none;color:#646970;cursor:pointer;display:block;padding:0;position:absolute;top:0;right:0;width:36px;height:36px;text-align:center;border-radius:0;overflow:hidden}.ui-dialog-titlebar-close:before{font:normal 20px/1 dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.8;width:36px;height:36px;content:"\f158"}.ui-button.ui-dialog-titlebar-close:focus,.ui-button.ui-dialog-titlebar-close:hover{color:#135e96}.ui-button.ui-dialog-titlebar-close:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:2px solid transparent;outline-offset:-2px}.ui-dialog-content{padding:16px;overflow:auto}.ui-dialog-buttonpane{background:#fff;border-top:1px solid #dcdcde;padding:16px}.ui-dialog-buttonpane .ui-button{margin-left:16px}.ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-widget-overlay{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100101}/*! This file is auto-generated */ -/*! - * jQuery UI CSS Framework 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/theming/ - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { - display: none; -} -.ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} -.ui-helper-reset { - margin: 0; - padding: 0; - border: 0; - outline: 0; - line-height: 1.3; - text-decoration: none; - font-size: 100%; - list-style: none; -} -.ui-helper-clearfix:before, -.ui-helper-clearfix:after { - content: ""; - display: table; - border-collapse: collapse; -} -.ui-helper-clearfix:after { - clear: both; -} -.ui-helper-clearfix { - min-height: 0; /* support: IE7 */ -} -.ui-helper-zfix { - width: 100%; - height: 100%; - top: 0; - right: 0; - position: absolute; - opacity: 0; - filter:Alpha(Opacity=0); /* support: IE8 */ -} - -.ui-front { - z-index: 100; -} - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { - cursor: default !important; -} - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { - display: block; - text-indent: -99999px; - overflow: hidden; - background-repeat: no-repeat; -} - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { - position: fixed; - top: 0; - right: 0; - width: 100%; - height: 100%; -} - -/*! - * jQuery UI Resizable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ -.ui-resizable { - position: relative; -} -.ui-resizable-handle { - position: absolute; - font-size: 0.1px; - display: block; - touch-action: none; -} -.ui-resizable-disabled .ui-resizable-handle, -.ui-resizable-autohide .ui-resizable-handle { - display: none; -} -.ui-resizable-n { - cursor: n-resize; - height: 7px; - width: 100%; - top: -5px; - right: 0; -} -.ui-resizable-s { - cursor: s-resize; - height: 7px; - width: 100%; - bottom: -5px; - right: 0; -} -/* rtl:ignore */ -.ui-resizable-e { - cursor: e-resize; - width: 7px; - right: -5px; - top: 0; - height: 100%; -} -/* rtl:ignore */ -.ui-resizable-w { - cursor: w-resize; - width: 7px; - left: -5px; - top: 0; - height: 100%; -} -/* rtl:ignore */ -.ui-resizable-se { - cursor: se-resize; - width: 12px; - height: 12px; - right: 1px; - bottom: 1px; -} -/* rtl:ignore */ -.ui-resizable-sw { - cursor: sw-resize; - width: 9px; - height: 9px; - left: -5px; - bottom: -5px; -} -/* rtl:ignore */ -.ui-resizable-nw { - cursor: nw-resize; - width: 9px; - height: 9px; - left: -5px; - top: -5px; -} -/* rtl:ignore */ -.ui-resizable-ne { - cursor: ne-resize; - width: 9px; - height: 9px; - right: -5px; - top: -5px; -} - -/* WP buttons: see buttons.css. */ - -.ui-button { - display: inline-block; - text-decoration: none; - font-size: 13px; - line-height: 2; - height: 28px; - margin: 0; - padding: 0 10px 1px; - cursor: pointer; - border-width: 1px; - border-style: solid; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-sizing: border-box; - color: #50575e; - border-color: #c3c4c7; - background: #f6f7f7; - box-shadow: 0 1px 0 #c3c4c7; - vertical-align: top; -} - -.ui-button:active, -.ui-button:focus { - outline: none; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.ui-button::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.ui-button:hover, -.ui-button:focus { - background: #f6f7f7; - border-color: #8c8f94; - color: #1d2327; -} - -.ui-button:focus { - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.ui-button:active { - background: #f0f0f1; - border-color: #8c8f94; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); -} - -.ui-button[disabled], -.ui-button:disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - text-shadow: 0 1px 0 #fff !important; - cursor: default; - transform: none !important; -} - -@media screen and (max-width: 782px) { - - .ui-button { - padding: 6px 14px; - line-height: normal; - font-size: 14px; - vertical-align: middle; - height: auto; - margin-bottom: 4px; - } - -} - -/* WP Theme */ - -.ui-dialog { - position: absolute; - top: 0; - right: 0; - z-index: 100102; - background-color: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - overflow: hidden; -} - -.ui-dialog-titlebar { - background: #fff; - border-bottom: 1px solid #dcdcde; - height: 36px; - font-size: 18px; - font-weight: 600; - line-height: 2; - padding: 0 16px 0 36px; -} - -.ui-button.ui-dialog-titlebar-close { - background: none; - border: none; - box-shadow: none; - color: #646970; - cursor: pointer; - display: block; - padding: 0; - position: absolute; - top: 0; - left: 0; - width: 36px; - height: 36px; - text-align: center; - border-radius: 0; - overflow: hidden; -} - -.ui-dialog-titlebar-close:before { - font: normal 20px/1 dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - line-height: 1.8; - width: 36px; - height: 36px; - content: "\f158"; -} - -.ui-button.ui-dialog-titlebar-close:hover, -.ui-button.ui-dialog-titlebar-close:focus { - color: #135e96; -} - -.ui-button.ui-dialog-titlebar-close:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -.ui-dialog-content { - padding: 16px; - overflow: auto; -} - -.ui-dialog-buttonpane { - background: #fff; - border-top: 1px solid #dcdcde; - padding: 16px; -} - -.ui-dialog-buttonpane .ui-button { - margin-right: 16px; -} - -.ui-dialog-buttonpane .ui-dialog-buttonset { - float: left; -} - -.ui-draggable .ui-dialog-titlebar { - cursor: move; -} - -.ui-widget-overlay { - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 100101; -} -.wp-pointer-content { - padding: 0 0 10px; - position: relative; - font-size: 13px; - background: #fff; - border: 1px solid #c3c4c7; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08); -} - -.wp-pointer-content h3 { - position: relative; - margin: -1px -1px 5px; - padding: 15px 18px 14px 60px; - border: 1px solid #2271b1; - border-bottom: none; - line-height: 1.4; - font-size: 14px; - color: #fff; - background: #2271b1; -} - -.wp-pointer-content h3:before { - background: #fff; - border-radius: 50%; - color: #2271b1; - content: "\f227"; - font: normal 20px/1.6 dashicons; - position: absolute; - top: 8px; - left: 15px; - speak: never; - text-align: center; - width: 32px; - height: 32px; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.wp-pointer-content h4 { - margin: 1.33em 20px 1em; - font-size: 1.15em; -} - -.wp-pointer-content p { - padding: 0 20px; -} - -.wp-pointer-buttons { - margin: 0; - padding: 5px 15px; - overflow: auto; -} - -.wp-pointer-buttons a { - float: right; - display: inline-block; - text-decoration: none; -} - -.wp-pointer-buttons a.close { - padding-left: 3px; - position: relative; -} - -.wp-pointer-buttons a.close:before { - background: none; - color: #787c82; - content: "\f153"; - display: block !important; - font: normal 16px/1 dashicons; - speak: never; - margin: 1px 0; - text-align: center; - -webkit-font-smoothing: antialiased !important; - width: 10px; - height: 100%; - position: absolute; - left: -15px; - top: 1px; -} - -.wp-pointer-buttons a.close:hover:before { - color: #d63638; -} - -/* The arrow base class must take up no space, even with transparent borders. */ -.wp-pointer-arrow, -.wp-pointer-arrow-inner { - position: absolute; - width: 0; - height: 0; -} - -.wp-pointer-arrow { - z-index: 10; - width: 0; - height: 0; - border: 0 solid transparent; -} - -.wp-pointer-arrow-inner { - z-index: 20; -} - -/* Make Room for the Arrow! */ -.wp-pointer-top, -.wp-pointer-undefined { - padding-top: 13px; -} - -.wp-pointer-bottom { - margin-top: -13px; - padding-bottom: 13px; -} - -/* rtl:ignore */ -.wp-pointer-left { - padding-left: 13px; -} -/* rtl:ignore */ -.wp-pointer-right { - margin-left: -13px; - padding-right: 13px; -} - -/* Base Size & Positioning */ -.wp-pointer-top .wp-pointer-arrow, -.wp-pointer-bottom .wp-pointer-arrow, -.wp-pointer-undefined .wp-pointer-arrow { - left: 50px; -} - -.wp-pointer-left .wp-pointer-arrow, -.wp-pointer-right .wp-pointer-arrow { - top: 50%; - margin-top: -15px; -} - -/* Arrow Sprite */ -.wp-pointer-top .wp-pointer-arrow, -.wp-pointer-undefined .wp-pointer-arrow { - top: 0; - border-width: 0 13px 13px; - border-bottom-color: #2271b1; -} - -.wp-pointer-top .wp-pointer-arrow-inner, -.wp-pointer-undefined .wp-pointer-arrow-inner { - top: 1px; - margin-left: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-bottom-color: #2271b1; - display: block; - content: " "; -} - -.wp-pointer-bottom .wp-pointer-arrow { - bottom: 0; - border-width: 13px 13px 0; - border-top-color: #c3c4c7; -} - -.wp-pointer-bottom .wp-pointer-arrow-inner { - bottom: 1px; - margin-left: -13px; - margin-bottom: -13px; - border: 13px solid transparent; - border-top-color: #fff; - display: block; - content: " "; -} - -/* rtl:ignore */ -.wp-pointer-left .wp-pointer-arrow { - left: 0; - border-width: 13px 13px 13px 0; - border-right-color: #c3c4c7; -} - -/* rtl:ignore */ -.wp-pointer-left .wp-pointer-arrow-inner { - left: 1px; - margin-left: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-right-color: #fff; - display: block; - content: " "; -} - -/* rtl:ignore */ -.wp-pointer-right .wp-pointer-arrow { - right: 0; - border-width: 13px 0 13px 13px; - border-left-color: #c3c4c7; -} - -/* rtl:ignore */ -.wp-pointer-right .wp-pointer-arrow-inner { - right: 1px; - margin-right: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-left-color: #fff; - display: block; - content: " "; -} - -.wp-pointer.arrow-bottom .wp-pointer-content { - margin-bottom: -45px; -} - -.wp-pointer.arrow-bottom .wp-pointer-arrow { - top: 100%; - margin-top: -30px; -} - -/* Disable pointers at responsive sizes */ -@media screen and (max-width: 782px) { - .wp-pointer { - display: none; - } -} -/*! This file is auto-generated */ -/* ---------------------------------------------------------------------------- - -NOTE: If you edit this file, you should make sure that the CSS rules for -buttons in the following files are updated. - -* jquery-ui-dialog.css -* editor.css - -WordPress-style Buttons -======================= -Create a button by adding the `.button` class to an element. For backward -compatibility, we support several other classes (such as `.button-secondary`), -but these will *not* work with the stackable classes described below. - -Button Styles -------------- -To display a primary button style, add the `.button-primary` class to a button. - -Button Sizes ------------- -Adjust a button's size by adding the `.button-large` or `.button-small` class. - -Button States -------------- -Lock the state of a button by adding the name of the pseudoclass as -an actual class (e.g. `.hover` for `:hover`). - - -TABLE OF CONTENTS: ------------------- - 1.0 - Button Layouts - 2.0 - Default Button Style - 3.0 - Primary Button Style - 4.0 - Button Groups - 5.0 - Responsive Button Styles - ----------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------------- - 1.0 - Button Layouts ----------------------------------------------------------------------------- */ - -.wp-core-ui .button, -.wp-core-ui .button-primary, -.wp-core-ui .button-secondary { - display: inline-block; - text-decoration: none; - font-size: 13px; - line-height: 2.15384615; /* 28px */ - min-height: 30px; - margin: 0; - padding: 0 10px; - cursor: pointer; - border-width: 1px; - border-style: solid; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-sizing: border-box; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.wp-core-ui button::-moz-focus-inner, -.wp-core-ui input[type="reset"]::-moz-focus-inner, -.wp-core-ui input[type="button"]::-moz-focus-inner, -.wp-core-ui input[type="submit"]::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.wp-core-ui .button.button-large, -.wp-core-ui .button-group.button-large .button { - min-height: 32px; - line-height: 2.30769231; /* 30px */ - padding: 0 12px; -} - -.wp-core-ui .button.button-small, -.wp-core-ui .button-group.button-small .button { - min-height: 26px; - line-height: 2.18181818; /* 24px */ - padding: 0 8px; - font-size: 11px; -} - -.wp-core-ui .button.button-hero, -.wp-core-ui .button-group.button-hero .button { - font-size: 14px; - min-height: 46px; - line-height: 3.14285714; - padding: 0 36px; -} - -.wp-core-ui .button.hidden { - display: none; -} - -/* Style Reset buttons as simple text links */ - -.wp-core-ui input[type="reset"], -.wp-core-ui input[type="reset"]:hover, -.wp-core-ui input[type="reset"]:active, -.wp-core-ui input[type="reset"]:focus { - background: none; - border: none; - box-shadow: none; - padding: 0 2px 1px; - width: auto; -} - -/* ---------------------------------------------------------------------------- - 2.0 - Default Button Style ----------------------------------------------------------------------------- */ - -.wp-core-ui .button, -.wp-core-ui .button-secondary { - color: #2271b1; - border-color: #2271b1; - background: #f6f7f7; - vertical-align: top; -} - -.wp-core-ui p .button { - vertical-align: baseline; -} - -.wp-core-ui .button.hover, -.wp-core-ui .button:hover, -.wp-core-ui .button-secondary:hover{ - background: #f0f0f1; - border-color: #0a4b78; - color: #0a4b78; -} - -.wp-core-ui .button.focus, -.wp-core-ui .button:focus, -.wp-core-ui .button-secondary:focus { - background: #f6f7f7; - border-color: #3582c4; - color: #0a4b78; - box-shadow: 0 0 0 1px #3582c4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - /* Reset inherited offset from Gutenberg */ - outline-offset: 0; -} - -/* :active state */ -.wp-core-ui .button:active, -.wp-core-ui .button-secondary:active { - background: #f6f7f7; - border-color: #8c8f94; - box-shadow: none; -} - -/* pressed state e.g. a selected setting */ -.wp-core-ui .button.active, -.wp-core-ui .button.active:hover { - background-color: #dcdcde; - color: #135e96; - border-color: #0a4b78; - box-shadow: inset 0 2px 5px -3px #0a4b78; -} - -.wp-core-ui .button.active:focus { - border-color: #3582c4; - box-shadow: - inset 0 2px 5px -3px #0a4b78, - 0 0 0 1px #3582c4; -} - -.wp-core-ui .button[disabled], -.wp-core-ui .button:disabled, -.wp-core-ui .button.disabled, -.wp-core-ui .button-secondary[disabled], -.wp-core-ui .button-secondary:disabled, -.wp-core-ui .button-secondary.disabled, -.wp-core-ui .button-disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - cursor: default; - transform: none !important; -} - -/* Buttons that look like links, for a cross of good semantics with the visual */ -.wp-core-ui .button-link { - margin: 0; - padding: 0; - box-shadow: none; - border: 0; - border-radius: 0; - background: none; - cursor: pointer; - text-align: right; - /* Mimics the default link style in common.css */ - color: #2271b1; - text-decoration: underline; - transition-property: border, background, color; - transition-duration: .05s; - transition-timing-function: ease-in-out; -} - -.wp-core-ui .button-link:hover, -.wp-core-ui .button-link:active { - color: #135e96; -} - -.wp-core-ui .button-link:focus { - color: #043959; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.wp-core-ui .button-link-delete { - color: #d63638; -} - -.wp-core-ui .button-link-delete:hover, -.wp-core-ui .button-link-delete:focus { - color: #d63638; - background: transparent; -} - -.wp-core-ui .button-link-delete:disabled { - /* overrides the default buttons disabled background */ - background: transparent !important; -} - - -/* ---------------------------------------------------------------------------- - 3.0 - Primary Button Style ----------------------------------------------------------------------------- */ - -.wp-core-ui .button-primary { - background: #2271b1; - border-color: #2271b1; - color: #fff; - text-decoration: none; - text-shadow: none; -} - -.wp-core-ui .button-primary.hover, -.wp-core-ui .button-primary:hover, -.wp-core-ui .button-primary.focus, -.wp-core-ui .button-primary:focus { - background: #135e96; - border-color: #135e96; - color: #fff; -} - -.wp-core-ui .button-primary.focus, -.wp-core-ui .button-primary:focus { - box-shadow: - 0 0 0 1px #fff, - 0 0 0 3px #2271b1; -} - -.wp-core-ui .button-primary.active, -.wp-core-ui .button-primary.active:hover, -.wp-core-ui .button-primary.active:focus, -.wp-core-ui .button-primary:active { - background: #135e96; - border-color: #135e96; - box-shadow: none; - color: #fff; -} - -.wp-core-ui .button-primary[disabled], -.wp-core-ui .button-primary:disabled, -.wp-core-ui .button-primary-disabled, -.wp-core-ui .button-primary.disabled { - color: #a7aaad !important; - background: #f6f7f7 !important; - border-color: #dcdcde !important; - box-shadow: none !important; - text-shadow: none !important; - cursor: default; -} - -/* ---------------------------------------------------------------------------- - 4.0 - Button Groups ----------------------------------------------------------------------------- */ - -.wp-core-ui .button-group { - position: relative; - display: inline-block; - white-space: nowrap; - font-size: 0; - vertical-align: middle; -} - -.wp-core-ui .button-group > .button { - display: inline-block; - border-radius: 0; - margin-left: -1px; -} - -.wp-core-ui .button-group > .button:first-child { - border-radius: 0 3px 3px 0; -} - -.wp-core-ui .button-group > .button:last-child { - border-radius: 3px 0 0 3px; -} - -.wp-core-ui .button-group > .button-primary + .button { - border-right: 0; -} - -.wp-core-ui .button-group > .button:focus { - position: relative; - z-index: 1; -} - -/* pressed state e.g. a selected setting */ -.wp-core-ui .button-group > .button.active { - background-color: #dcdcde; - color: #135e96; - border-color: #0a4b78; - box-shadow: inset 0 2px 5px -3px #0a4b78; -} - -.wp-core-ui .button-group > .button.active:focus { - border-color: #3582c4; - box-shadow: - inset 0 2px 5px -3px #0a4b78, - 0 0 0 1px #3582c4; -} - -/* ---------------------------------------------------------------------------- - 5.0 - Responsive Button Styles ----------------------------------------------------------------------------- */ - -@media screen and (max-width: 782px) { - - .wp-core-ui .button, - .wp-core-ui .button.button-large, - .wp-core-ui .button.button-small, - input#publish, - input#save-post, - a.preview { - padding: 0 14px; - line-height: 2.71428571; /* 38px */ - font-size: 14px; - vertical-align: middle; - min-height: 40px; - margin-bottom: 4px; - } - - /* Copy attachment URL button in the legacy edit media page. */ - .wp-core-ui .copy-to-clipboard-container .copy-attachment-url { - margin-bottom: 0; - } - - #media-upload.wp-core-ui .button { - padding: 0 10px 1px; - min-height: 24px; - line-height: 22px; - font-size: 13px; - } - - .media-frame.mode-grid .bulk-select .button { - margin-bottom: 0; - } - - /* Publish Metabox Options */ - .wp-core-ui .save-post-status.button { - position: relative; - margin: 0 10px 0 14px; /* 14px right margin to match all other buttons */ - } - - /* Reset responsive styles in Press This, Customizer */ - - .wp-core-ui.wp-customizer .button { - font-size: 13px; - line-height: 2.15384615; /* 28px */ - min-height: 30px; - margin: 0; - vertical-align: inherit; - } - - .media-modal-content .media-toolbar-primary .media-button { - margin-top: 10px; - margin-right: 5px; - } - - /* Reset responsive styles on Log in button on iframed login form */ - - .interim-login .button.button-large { - min-height: 30px; - line-height: 2; - padding: 0 12px 2px; - } - -} -/*! This file is auto-generated */ -.wp-core-ui .button,.wp-core-ui .button-primary,.wp-core-ui .button-secondary{display:inline-block;text-decoration:none;font-size:13px;line-height:2.15384615;min-height:30px;margin:0;padding:0 10px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box}.wp-core-ui button::-moz-focus-inner,.wp-core-ui input[type=button]::-moz-focus-inner,.wp-core-ui input[type=reset]::-moz-focus-inner,.wp-core-ui input[type=submit]::-moz-focus-inner{border-width:0;border-style:none;padding:0}.wp-core-ui .button-group.button-large .button,.wp-core-ui .button.button-large{min-height:32px;line-height:2.30769231;padding:0 12px}.wp-core-ui .button-group.button-small .button,.wp-core-ui .button.button-small{min-height:26px;line-height:2.18181818;padding:0 8px;font-size:11px}.wp-core-ui .button-group.button-hero .button,.wp-core-ui .button.button-hero{font-size:14px;min-height:46px;line-height:3.14285714;padding:0 36px}.wp-core-ui .button.hidden{display:none}.wp-core-ui input[type=reset],.wp-core-ui input[type=reset]:active,.wp-core-ui input[type=reset]:focus,.wp-core-ui input[type=reset]:hover{background:0 0;border:none;box-shadow:none;padding:0 2px 1px;width:auto}.wp-core-ui .button,.wp-core-ui .button-secondary{color:#2271b1;border-color:#2271b1;background:#f6f7f7;vertical-align:top}.wp-core-ui p .button{vertical-align:baseline}.wp-core-ui .button-secondary:hover,.wp-core-ui .button.hover,.wp-core-ui .button:hover{background:#f0f0f1;border-color:#0a4b78;color:#0a4b78}.wp-core-ui .button-secondary:focus,.wp-core-ui .button.focus,.wp-core-ui .button:focus{background:#f6f7f7;border-color:#3582c4;color:#0a4b78;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent;outline-offset:0}.wp-core-ui .button-secondary:active,.wp-core-ui .button:active{background:#f6f7f7;border-color:#8c8f94;box-shadow:none}.wp-core-ui .button.active,.wp-core-ui .button.active:hover{background-color:#dcdcde;color:#135e96;border-color:#0a4b78;box-shadow:inset 0 2px 5px -3px #0a4b78}.wp-core-ui .button.active:focus{border-color:#3582c4;box-shadow:inset 0 2px 5px -3px #0a4b78,0 0 0 1px #3582c4}.wp-core-ui .button-disabled,.wp-core-ui .button-secondary.disabled,.wp-core-ui .button-secondary:disabled,.wp-core-ui .button-secondary[disabled],.wp-core-ui .button.disabled,.wp-core-ui .button:disabled,.wp-core-ui .button[disabled]{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;cursor:default;transform:none!important}.wp-core-ui .button-link{margin:0;padding:0;box-shadow:none;border:0;border-radius:0;background:0 0;cursor:pointer;text-align:left;color:#2271b1;text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}.wp-core-ui .button-link:active,.wp-core-ui .button-link:hover{color:#135e96}.wp-core-ui .button-link:focus{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:1px solid transparent}.wp-core-ui .button-link-delete{color:#d63638}.wp-core-ui .button-link-delete:focus,.wp-core-ui .button-link-delete:hover{color:#d63638;background:0 0}.wp-core-ui .button-link-delete:disabled{background:0 0!important}.wp-core-ui .button-primary{background:#2271b1;border-color:#2271b1;color:#fff;text-decoration:none;text-shadow:none}.wp-core-ui .button-primary.focus,.wp-core-ui .button-primary.hover,.wp-core-ui .button-primary:focus,.wp-core-ui .button-primary:hover{background:#135e96;border-color:#135e96;color:#fff}.wp-core-ui .button-primary.focus,.wp-core-ui .button-primary:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px #2271b1}.wp-core-ui .button-primary.active,.wp-core-ui .button-primary.active:focus,.wp-core-ui .button-primary.active:hover,.wp-core-ui .button-primary:active{background:#135e96;border-color:#135e96;box-shadow:none;color:#fff}.wp-core-ui .button-primary-disabled,.wp-core-ui .button-primary.disabled,.wp-core-ui .button-primary:disabled,.wp-core-ui .button-primary[disabled]{color:#a7aaad!important;background:#f6f7f7!important;border-color:#dcdcde!important;box-shadow:none!important;text-shadow:none!important;cursor:default}.wp-core-ui .button-group{position:relative;display:inline-block;white-space:nowrap;font-size:0;vertical-align:middle}.wp-core-ui .button-group>.button{display:inline-block;border-radius:0;margin-right:-1px}.wp-core-ui .button-group>.button:first-child{border-radius:3px 0 0 3px}.wp-core-ui .button-group>.button:last-child{border-radius:0 3px 3px 0}.wp-core-ui .button-group>.button-primary+.button{border-left:0}.wp-core-ui .button-group>.button:focus{position:relative;z-index:1}.wp-core-ui .button-group>.button.active{background-color:#dcdcde;color:#135e96;border-color:#0a4b78;box-shadow:inset 0 2px 5px -3px #0a4b78}.wp-core-ui .button-group>.button.active:focus{border-color:#3582c4;box-shadow:inset 0 2px 5px -3px #0a4b78,0 0 0 1px #3582c4}@media screen and (max-width:782px){.wp-core-ui .button,.wp-core-ui .button.button-large,.wp-core-ui .button.button-small,a.preview,input#publish,input#save-post{padding:0 14px;line-height:2.71428571;font-size:14px;vertical-align:middle;min-height:40px;margin-bottom:4px}.wp-core-ui .copy-to-clipboard-container .copy-attachment-url{margin-bottom:0}#media-upload.wp-core-ui .button{padding:0 10px 1px;min-height:24px;line-height:22px;font-size:13px}.media-frame.mode-grid .bulk-select .button{margin-bottom:0}.wp-core-ui .save-post-status.button{position:relative;margin:0 14px 0 10px}.wp-core-ui.wp-customizer .button{font-size:13px;line-height:2.15384615;min-height:30px;margin:0;vertical-align:inherit}.media-modal-content .media-toolbar-primary .media-button{margin-top:10px;margin-left:5px}.interim-login .button.button-large{min-height:30px;line-height:2;padding:0 12px 2px}}/*! This file is auto-generated */ -@font-face{font-family:dashicons;src:url("../fonts/dashicons.eot?99ac726223c749443b642ce33df8b800");src:url("../fonts/dashicons.eot?99ac726223c749443b642ce33df8b800#iefix") format("embedded-opentype"),url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAHvwAAsAAAAA3EgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAAQAAAAFZAuk8lY21hcAAAAXwAAAk/AAAU9l+BPsxnbHlmAAAKvAAAYwIAAKlAcWTMRWhlYWQAAG3AAAAALwAAADYXkmaRaGhlYQAAbfAAAAAfAAAAJAQ3A0hobXR4AABuEAAAACUAAAVQpgT/9mxvY2EAAG44AAACqgAAAqps5EEYbWF4cAAAcOQAAAAfAAAAIAJvAKBuYW1lAABxBAAAATAAAAIiwytf8nBvc3QAAHI0AAAJvAAAEhojMlz2eJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/Mc4gYGVgYOBhzGNgYHBHUp/ZZBkaGFgYGJgZWbACgLSXFMYHD4yfHVnAnH1mBgZGIE0CDMAAI/zCGl4nN3Y93/eVRnG8c/9JE2bstLdQIF0N8x0t8w0pSMt0BZKS5ml7F32lrL3hlKmCxEQtzjAhQMRRcEJijhQQWV4vgNBGV4nl3+B/mbTd8+reeVJvuc859znvgL0A5pkO2nW3xcJ8qee02ej7/NNDOz7fHPTw/r/LnTo60ale4ooWov2orOYXXQXPWVr2V52lrPL3qq3WlmtqlZXx1bnVFdVd9TNdWvdXnfWk+tZ9dx6wfvvQ6KgaCraio6iq+/VUbaVHWVX2V0trJb2vXpNtbZaV91YU7fUbXVH3VVPrbvrefnV//WfYJc4M86OS2N9PBCP9n08FS/E6w0agxtDG2P6ProaPY3ljaMaJzVOb1ze2NC4s3Ff46G+VzfRQn8GsBEbM4RN2YQtGMVlMY2v8COGai0Hxm6MjEWxOBZGb+zJArbidjajjUGxJHbgUzwYG/EJPsNDfJLFsYzpXM6Pmcd8Ps1BvB8LGEE7W7KSzdmGA9ifgzmau7ibcUxkB7bnHhZxb+xDgw/yYb7GU/yQp2NgDI9xMZ61sWVsFZtHkxb5+ZgQE2NSdMYmDOM5HmZrfs6H+Cbf4bt8m28xhb2YyjQWciDHxk7RGg2W8DFWxbyYE20cx/GcwImcxKmxWYyIGXr3l7MPp/MAn+PzfIFH+Co/4296Q2v+wdvRHP1iQIyKMTE2ZsZesW8QSzmHi7mFK7iWsziTs7mIG/gAl3Irl3Az13A117GeC7iSdVzIjdzGMXycP/ITfskv+B5PRk/MjT1iCPuyLAbF4Jgds2Jj7uOj7MmX+DI78hfejBa6+Kxmekp0s5TBXM/kiNg29uaNmM5p0c6fmMmMGMbLMZS/8w2+zh78lPFMYFvt9Ul0Moax/IA/s5P2+hy6mcXO7EoPu7F7bM1feSR25wzuZAN3xBasiJGxDSfH9pzLeVzF7NgxtmM0+/FK7MLrvBNTeZSXYlP+wO/5J//SV/2O3/Iiv+EFfs2veDf68xHOj53p5Yt8n72ZG6MZzhoO5wgO4VCO5CgOY3VM4S1epYxdYzKP8QSPx3xu4v7o4Fmdydbo4j1eo+IZbdaW/+Gc/L/82Tj/0zbS/4kVue5YrmzpP3L1Sw3T+SY1mU46qdl05kn9TKef1GL5J6T+popAGmCqDaRWU5UgDTTVC9JGpspB2ti4TOMmpmpC2tRUV0ibmSoMqc1Ua0iDLFfwNNhypU5DTJWINNTQGqRhFos0DrdYrHGExUKNIy16Nbabqhhpc1M9I21hqmykUaYaR9rSyM+7lZGfd2sjP2+HxRKNo01VkTTGVB9JY40HNY6zyGs23lQ9SRNMdZQ00VRRSZNMtZXUaeQ5bmOqt6RtTZWXtJ2pBpO2N1Vj0g6mukza0VShSV2mWk2abKrapClGvtumWuS1mmbkNZ5u5HWdYeQ1m2mq+KRZRl7v2UZ+9p1M9wFpZ9PNQNrFdEeQdjXdFqTdTPcGaXfTDULqNvK6zjHy+vUYed5zjbwee5juHNI8I++f+ca9GheYbiTSQiOfp17TLUVaZLqvSItNNxdpT9MdRtrLdJuR9jae1rjEIu/tpRZ5/y6zyHPZxyLvkX2NtRqXW+R13s8i780VFnmdV1rkc7+/5SKRVhnPazzAIu+7Ay3yuh1kkffdwRZ53x1ikc/0oUY+f6tNNxTpMNOtTFpj5LNyuOmmJh1hurNJR5pub9JRpnucdLTpRicdY7rbSceabnnScUbep8cbeb1PMPKePdHIe/YkI7+fJxt53muN/L1Psch781SLXPNOs8h74HQjv4dnmLoL0plGXuOzLPL+Otsi781zLHINOdfI8zjPyPM438jzuMDI8/iAkedxoZGfcZ1FrlEXWeSzebFFPpeXGLlWXWrkfXSZkffa5Uae3xWmjoh0pak3Il1l6pJIV5v6JdI1ps6JdK2phyJdZ+qmSNeb+irSDaYOi3Sjqdci3WTqukg3G29rvMUi3123WuQ74jaLfEett8j1+3aLXIM3WOQafIdFrk93WuQ9c5dFPmd3W75G0z2mbi8/ah/1fRRh6gDV85t6QYpmU1dI0c/UH1K0mDpFiv6mnpFigKl7pGg19ZEUbaaOkmKQqbekGGzqMimGmPpNiqGmzpNimKkHpRhu6kYpRpj6UoqRpg6Vot3Uq1J0mLpWitGm/pVijKmTpRhr6mkpxpm6W4rxpj6XYoKp46WYaOp9KSaZumCKTlM/TNFl6owpJpt6ZIoppm6ZYqrxpMZpFqrvxXQL1fdihoXqezHTIq/TLFOnTTHbUJ0tui3yGvdYaH3LsNDXlQ0Lvb5sMnXplM2mfp2yn6lzp2wx9fCU/U3dPOUAU19P2Wrq8CnbTL0+5SDjTY2DLXe95RBTEqAcasoElMMs195yuKH6VY4wJQbKkabsQNlu5O/dYcoTlKMNrXs5xiKvwVgL9RblOFPuoBxvvKFxgimLUE40VCvLSRb5Z3aakgpllymzUE429J6VUyzynKYaL2ucZpHnPd2UcihnmPIO5UxT8qGcZcpAlLNNaYiy28jPPsfIz95j5DnOtfybg3IPI89jnpHnMd/I67TAyOu00JSzKHtNiYtqoSl7UfWaUhjVUlMeo1pmSmZU+5gyGtW+prRGtdyU26j2MyU4qhWmLEe10lBvVK0y5Tuq1aakR7XGcq2uDrfIX3+EKQdSHWlKhFRHmbIh1dGGamh1jCkvUh1r5GdZa6E9V51iSpNUpxq6d6vTTAmT6nRT1qQ6w5Qnqc405U+qswy9l9XZFjo71TmmdEq1zpRTqS4y8jpdbLyi8RKLvP6XmvIs1WXGOxovN2VcqitMaZfqSuMljVeZEjDVjaYsTHWTKRVT3WzKx1S3mJIy1a3WN8fbTOmZar0pR1PdbkrUVBtM2ZrqDlPKztdlH+Vt6jAlb+qG8a7GJlMap2425XLqFkN9Rt3flNWpB5hSO3WrKb9Tt5mSPPUgU6anHmzozNRDTDmfeqgp8VMPM2V/6uGG9lw9wtCeq0ca6i/rdkP9Zd1haC/Wow3txXqMoV6zHmtof9fjLFRH6vHGWxonGK9qnGiUGidZ6EzVnRaqR3WX8ZjGycYTGqcaj2ucZqFaUE839N7XM4z7Nc60yPOYZTyrsdvybyfrOUZe7x6L/PPnGu9pnGe8pnG+UWlcYDzzb8iLsxoAeJysvQmcJMdZJ5qRlZmR91F5VWXdZ/bd0511zEzP9PSMPKOrS5JHEpJGI0uyRbUk27KMMMuitVU25lgW+cAyuGt3f17A2Muaw6bHwMIzC5g15jFlMNcaA7vAmp41ZtnfW1h48PbVvC8is46eGZnj97qrIiMjj7i/+H9HfMWwDPyh/wddZTRmnWEaYbfj+cl/F4dYcErIc7BgIAHDv9ftdDtnEASbkL7ZRS98qimf8DXL84pOsbr/qTWMc6Io59OWVFC0WiVfkDTFUbEr5kQX/8mnmgpniLqtmTzGQ7gb0rGH4Q5NKuTLdU0pSJZZUDHOY0yKFpfvV9CvMCpjQGyziBwdVddQaxvZbYyY7uVO5/Jzlzvdy898EP0KjXYuv/mxzvi3Pvt68ih9fohGTJph7GjTKyBHWEa4Xas2T6NWZ3DoFYteNIjcYhGNiu4VtzgY0MMk7y+iX2fKTASxTrsTNsMmruIN2hg4aZJtRFql20GdbvLv+cW4vdBvI4RYLKqYU+or9XVPVZRUyg/8SMnUcjl//ICnYlHgJT29YkoCVvOrC+iHUqwoSIKEkODnc7WMlgm8IMOynpI51lipj39AdxQ/LemylrKkak3J8VxS1hHUM2SOQT/WBOzjUMBurd0McdhthrV21OmGXb/TbUeu53d97PkR3uy0mlXB8dDoONYXOgte0At8OOq42xWMhU7o5XuBB0ddOP6l8urqzurqKOeH8Q30CT/YTZ44flzQQ5LwArltZ5UUKUXL9Qvo5xmJ0UkfICgWlMdvR9h3K22/XXPRMMx99KO5X+i3hsPx1VEfNZPzaGF/f/+lwWD6nq+i/8x4TJU5DnFoYQPpCAYs1MBATRiW28hLkVMyWh2vg7sevWWNpdd8GMzeJvqsaxhu6J7IP2uW18xnsU5OTvz2PxctX/xO0fTVZ0VI8o6fWIb7FtzjhWetyir693AP3KjjZ821svlsnpwYxvhL/1z0TYRpGNFUT9eXZ7dWSLE5WvZr6BpjM3lmielA/7RbzWUU1nCtKsCI9KLKZifc9Byh2mx1/MiKI9EmNA+G7pqcop6hLFf71WXZMGTEKMYw12i0m83RgISBgHv9KI4dXpGNKDJkOBifbLbJXeH4L+nd7LvelXuExqBYUjzJ0G8yPKPADHOZHIz2BrPIQPch2lMGCtswWqCjfHJeilMbPgwtGpArFdKNb37zm+3BINj7+n5/t4XpyX+n4XjQv4r6/auDFmq10H1PPGE///zWQw/bly61lpf3Hn88/fzzaRpGj1y69Ah8dyL4S8b076P/RtuN9jiGDjfYGoznDkw7bzZ8fyJrWdnCPfVjvWYv+6tprZA5dy7UHSfvOOjnsufOZgua+aD4ePQfG68twK3fQi7knckcJ/QhRdqia1UsPnIrVjREzPhwdJ2JBqg3Pggi1EvG4GfRLzMYWqkGcWiITpHF0Dow14GqkG46g9qtbscnFwyE7rv/2P1CxuF+079W0kqFzFNlpewpZSx9FpJtHt+P3gd3YN7xW4VrriaJZcWDW96QLVQvQbKdEe5PaNgfoD9mYDghyKxJhzWZSJTINGOiHHY9Os6Rsv6D6+6G5Vi8trZ9B3ayaU/W5LSB79hedzbSdppHB2s/sK5xEN1wyS1GWtYkP51x8e3bSfp0zo3QFRgXy8ztMGqtVrNWqQquFY/YRkSG7DKi4/M0qpFBugXV72x6rj9/VkDzd7bRyFDGB3QM9xTjOpNVDEPJirI4jQwCcjXACg5IEon0UYukja9C+F2GazQFDFWHyMsk8shNKZN5N2IRrB0R8wBzGVaAqo6cItrcRq015OsIr6Gw021WsQALXgER6t6EZux2Qph7ReRvdrpeClK7HZg/zRDuhgMl8ckS6cGITAG9F3Cne7j97Pb2s28nwTt535RWSrwh2YLEsaInNyqcqAeSXpDa60GR5QwO/x92iuU5JImKUMAqdLaPc4WgYpXltMln3DvfbZQk00McyyRvheCjVh6XI81SBFGxJA1xWgbZnosUxcgG9omKKWrjrzielrUlQ8EplktxUr6TFnguldILS0iqr4Tn0JsESTM4RWFg1s/aaAFWjlPMG29oJRtinS40BtS0RhpICGmjkVUvJO2jo2YXmsrzyaXmOnLXYCKQxvPIdCUDFK7FLUf+BZc0IcS2WeiAuTZTeUlkeV3lUq7Ga6JTNNQ0JxliKFsPWTlWQk7uQmpTcQRsBxBWNZ9nWVZjOY7n0rwoaBiX/BrmIDGFrbKSYhGbUrx7X3/M9eebcPxLWEKiyIoFQ0urCPE4lTJVhDmfFwsZS87ZXAlaS4BLLMe77xQMSYYsDF7UeFbiBMnzcx5b9FRXF6DAdU8xpAa09tqWZTptaE5rrk3TTIYpAK1YYNZgDJ5gdpjzzC5zkXmYeYx5A/PMDW3NR55fa3bbMLIAXvm1dujWyFgjIYZvJPiRW2v6pAlDWELJ9D+N4ABXyHUYpPCGELoJQpKSglO4kzyJ55p6/Ndnkdg1vti0RV6V2Mdqtwui3XyMlZpnOaMrBo9dlB4l1565wEP6ZQTpKfO4yCLpuJFqrqn+sfL/8tXVcnlV9TdKf+lrq+Vj8038f9eqlR+7z2hoeq1aO/8N9xla4w3na9Xz9Ur1wvnqbffqDc249x5I1b8hSa7Wq9VKfa9e8JbPFurL4/9aK3or54q1JW9Kh2h7nmTuuGl84s5kbIUwKEndaSQeeHS0wsgssnS+kqGKJ3fPtUjwNGAuXUqrvMilMvbpNdYo2Xb/LCBRjktrupgXZFHXontdG/NVuRMoJtAkTeXE1JGx9fndlapnq1jGHAFfkrxoq2pu+96Uk81nChYrcDbisF7K6apsqvfV1pqXli1d0hVBlmd49zfQFxgHxg1DAE6yqjRhvmAfIA3vJase+nj2Qvm77E7T/pimbZ4t3XXHXbI+/jD2DMMDBJTV9Y/Zzbb9L8rnN3XlrjvvKu18GhsE/Uzz+RlY9xxY6xlUJQ2yDjO5s+l7CdjHXUDbBTqDq+RiGzB3hBjH0CSBSwmW07MtPgUTQjWcC4VOOVerHrv/WLWaK7ZLyNYVW7e0Zr5czjc1S7cV/dx6tZPfwRIviryEdwrtygSffwHquwXHJmE0CKILm8YU2QHJIFgWlxCBr9toHU0uzI4Avj+j+2njkW2T41Kav6Zxosw5mllWXjl5SbtvLS3sfFAVRN5NYSWluT6HZdYIntR5AX1GEwT99QHQwxQGTKqlZIFzBcxrr2wL6bX7tEsnX1GrmuZwsshpGz45GKcfUhyfFF2gnYbRb1F0WwT0vcXcyzDtShv4AjZcY3G74ls1i9cJAWwDCoXx522jNehZD+gfjM5tBHO9SwhqkRDOW6QhZvtU67zjpHffsHmdObyKHta6gSqaq25g38/JmIUVBF30o4zAszLPLVRsJSVLbErncmdLgsBKAt9ZDdI0zY6w6dkPvKm1cVtGw8F4iPq/EdiaID1hibLW5VNIkgUkKk8akoBkmUdQXM3iWUHm/K6t80iCvJBQtHI8yytceYoTrgBOSAEygkXFrrQrqF1xMRx7qA95RACkaGQAseGwH83G+uQ5QBcVyydPHoyHMMyuMwckgFv5G95vAB6kediAOhsRBPDlJ3kdHqJsD/7G1+Yy3IuG0X70NcpaQNOyQqZHizp5Zjh5pgsd2k3yPdwfAZOyD+hkfPUK5DKXx/T+Btwfwt0ufNHBfmv6wLWoFTGvXj9aL8imFlGIHZevB+HhoNdLyrgfDYd/R91c0qoDWq8oadoj/RDjpF9DP8eYwFvdxzwKJRZqMOXJKh7BEg/TrNuMuX/AcQnPGwJMAoq6eQYR8ttuwVivEaLhRICaYKDDNexWAQH4ruN1XU9nARG2W+jDd97/lsspjl16+vjqgw0eL6dDI4VYw0hjWQC8YhhfcRd0Q4ZJVeU4nWP5XC3dyJR4vAJPuYEmppaW/Ry7cInlJEvWjG8tdRCXaoRBFgkpX+RUJMC6X5M5xGqNFrLSrsyyJU7Scj3ADRmF1dM1zPOsZrCaZfKmGGaUbO2fyWo2rVjmMsOIU16atKMJPFEWaHEFuCI6RslIwW6U8GptwLpd4K3dyZe0+WjcR3vjq6h1rUdY4ZNucbhH/0hahIZwuRf0epSfjqKimw32WnvBXjDpw2uzsYMIk1yxKg3CYR2OW1n6dDBEw1arB3MkCBIaegXKKxIZhwUcAhDKw1Y/OjiI+lCYUT84OAj6zFQecgXtkVFnEylAOBgM4EbUHwyyBwezewaoRWYo8DhosNdH0f7+7BrhCURaNpoVnuWBgiTb6b17cC9P3kNuTXJBcZ7Te3pQHpZKn1APhvPe1x/Np9uuhLRSEYribCaVO5oH4YF8PKRZJDlMrtP3A8CGyYr60/cnbdaoWbQa4bT004xuarMG5X6TCgxvarMeyecM8g/2+gfD4Q3pCEco2BtBHae079MwroDTtr2YlfO9WIBEVgmSoBOWhEJt36OAu0kQ9e9hFokqm0qrvl4IZN8vFng+W1jffMtl11akU43mDm4sSorI1xcUBf1ECnNKWjYV0ZSCjKDywtnOyehksZRqbyxF6/c73idMFKQ9RxcKlj2hR59Evw6UKAPlC2kJfbIA+6SJ12FMYJ+MfsLUhZMItJ/fjRp+F4e1b9D1Vmlrq9TS9ai8tVV+dOnUqQdObS3HEqRzlfbZ+s74z8qdnfoO+mfxfeT+cgT3/+KpB7fg5mwsRMqfUL/3xHee0D54ImmzX4dylZglIg9gdZagO8p9bLNrrE4Hmb/N4ma7u0EkFd0memzzJI4uv3mjvqktSQvFxgMXQn717gcu2Mdekteyl9+8LaJstvcC4tBPwtkbTuIgfbKeK22aNr0Nbm5m7v1gZvOk8EdY4V988WIHsTOaPQLqKQIuNQFHQf/CZOVxFEbJl5AKBOtYfzzid8SI38HwFccjSrtHe9ksjCHyd53IF2MsgT6PPg84YoFpM+cASbyRoKIEruKQoB0ikY3FskB6IblBZbFwreUTmEi6gkoHZidCtZtgSALunG6z1gFcAo8ChiQUXgBSHTkEVaInK2mP01Sd812loe1oWtrQ9ee0hvIRT+fG/zMSTE67y+QcQXiO1yX+OUFbmkQ5/RMQkYXnBD3FvVkWRbG44KQkvZ7VBEtkFcWtB/UsSnNekE2pluundX0HOADHAG7gLZr2MU7XT7R4XrvPFPQXBI17q6Bq3HMCWhLIgcYvvJVX9NRbgHgbb5btpbyIFUkLmpqAjaLipoNcY4Yr/jX0jUAkJg1YjmqwBLVblC1YQ1XBdQBmFaCVSIetIcS4xX7xxaUqAt4x7Zt8dZnNuyjyC0Cb3eJvbNW6MiuximXBlBK7jeN+KO/siM052jAkXB8iazX5EqFeBfKroUGvD6uOjvq6gvot+NOV0UjRp/Laa/Ac4Pxuxa3A6mi1OhHQeiLR6loE4xNJy2aHiqBg6pTJUTGMbWA94NOLVkuoVVodDwHVP4ICgqvHhzwVnKPp+2FCo8hK3r6FrBp5e1RBwyh+5+EhkbCgAGDX3tz7pu1I3nECxiJjAxyB8rnwOSr3EWoTAVByrIaThDYVAfkTMd0oWi/6+cAtFt0A8tA0CKJJJFgtR0PZIBwKOjyIiuue1ysuFUmSfJyjwp9WHHLHyWEvW149OKAMjZHMHbJmS4zP1OnseRuUmXR1t9PuNP1OE2oOk8GLNrudIxxkqhpLdoC9idUL3dm923AVGKFOd9PBG0QgC8QYLpK51N10McFDRC5C2CcBw6vpC18omTkO4ccE3TVyHBYs3TO01e7j3e7jz5Ggu3B7lrO4Uuvhpx9utR5eFXTHDDiZswyn+GjzfMbyMR8UzaKt8Szp6nwG81kvqBRE4XgtYxpcfmV1c/2e9fV70JNL3Ubt7Z4gCx/JlV1rJe2kTbSc5APB+IVCjnf5Ns0IgrfTu2yPrSOpnGM5JH9T2t/2bKyzqRTiX0wvV8sriqyXuML6Pa+7Z500a6KIgeGgAhJqAq06xewyj9+gjfHnmxQfvYKLMFbwNnCQTUzGARkPRP9A5RxRi1A3gw3pCghgdcLOI+bC286ff9t3k+DCuefPnn3+3SQ4t/XU1tZT30SCZ1y7FOpBZeVyaWVle2XlHs0xVMyzbNk1sqrU6XQaviXyLMpxItZVU9FYJnkhBFryQgiyyQshWFHxRjnwhIVcaSUgL91eGRiCqaU1Q+3kHXiZ224j18w5vl0PfJrfhHZfgbki0hm9GNNuuxVCq0B9u5MIbpOpUIgT5+I+UKcbphE8MFHFbVJYsA3tOtE2uXHznkZTdd1hVjZNx9gL6BzaiydGcuhvLPhlL/DK/sKG7S6JtqfaVaJFEpcWDkxHXZIqtmYcu/j6i8d0wy5Ljqc66CCTkwuuacjJ8b2PKIYpHw3M/Lp+xvR9c3eXhGf09eOer6WwxAkCJ+GUtvoWIWWxAD78Xn49l1vP93zFklhRSgkz3oOsoz5TY9aJlHkiR25S4gHw2sGU3vAVEtYqFHbPxxNqBDdCSHiMLn0DunTF9DxzkfXMwPTYRTgZ/+85IXKdKFAM5ToJtymVySe35uEE9aCxME8qxWPSdnFD9uLDruEZk4sQnfAMA6iHDr2/ypxmzjLnmTuZHh0DzXUK59xkJMyfpqgmKB4FUFs6JubPw66LzyDXQPER/6Eqaqqii6q/6g1VUVdUTVS9Vf8VQ45IdSLZGNKQnh9GwBomH/QmM5t2LctNZ82sbWePnI3/dkQeGZFXTGMfCSL6DzglaMF3uq78FNRznWpkiEIG10IhFov7BE/4AvbbaywlpmSF7dJlF2gw+u6qFBiR95rcbV7HCKSaZbP8Yg4bUbCqOCvbq7a8FrRNKb/IszZ6In1XzQvYwSCV82p3WxIyjcoZ05OffJ+49ZqtWg0C8QOvF7PmTsUwETO3Xo0YjeqLAOz4wK/FiNoOuyGGDyBXDGwPYo7dv1Qe991cUC81R48/rpwU/lCNxMcfln/gY2i0Uy6PD1HgZJy86Yy/4+7b5cpz2jdmxNvvVJ5+dkoT0RfRLzH3MA8xTzDPMS8y38F8ANAGUeKtI4d0sJEIvdsT+NUlgxNaCNqDDtFooh1JjvFAjm8g497zw8nS2Z3QTaLFJAMDhhGMEz8eLXESzJPO5Nyfi6Nf8FbP+KIqpSVbIpyApIr+mVXPdNI1lq8EelPiyJoMa00LviTKSaEWVDm2mguuSSYZ9A/FS/N5HtYm+Ka4gHuNxO3CJBd2BfzILtG5kKBEcQgJ/sbfWfW1Zt41RYUXVNF0cw3NX93xZU1eP6nq1ZMuLDuwxGvkWS0O4ZQ1BPdkVVdPrpvWU/F8i+LDBzgVgA+f2hGwCAhzCyuiqOAohkMJLTlEf0TXKTIHATtTxEygMqxDs5NOi5g1kI6aImPPwfz81IQGRYpSVt5PFHLvV9BptaS+T/VJ3HwjSXvjGlHlvZ8E4y8roqpIiiA5hlhFv6Mo71dLPrl2WonvgOD736iUfRWeou/wS+p70jnbteyMHeh+fiq/eRl9gXHpCsKQqUREr2GXcDmeTway3zQQgTCwWgKxCCn2wB7KfmN6uflAczn9gn6ieSbKamo6WN/4pgyAtoWglmnuOIG90/R8M0QXf6Pu2bZX/0Imh+6ub7iKId6lvmOFy6653x14q17AF1zgZyhdZpk5mZTP5IDzqgE/uAyzP2K6zBZzhmEIYvVr7Wjyxf+AOJGYUElWP4r2WsB8R6NXj/SJwAr+WKZHDtGA4OnWII7T8HCfxOZli7/KNJg1qm+Pp2IN+y4O292wGuumCBtAFk8CCrsA9SiAaaIDzcooQdpeNIMgveza2YyMJZF385X1zQvbJfOgHqqNVkMN790pe0Vd5FIrlV4+36uspDhDlUwtY+1g4BV0jNGLJ+85duy+4zP53K8yAZUUE9kKnqAeKMMWonpcWlLCS4fT4lw8HgTH12F9S/mF4nJYDJeLBT8lOO47F+FvUhbE9Or1nuo7DX+bZI7gK2z7DccX0ouL/+ekGNNyjKActzN3Q+uQpqkRAUsVC3F7dD1SlHYLmKcuEUEkIIOQNShTZ9KcIVGdxv8wZXwoNBqaWb2EspcvZ08WskG5ura4uFYtB+O/MhqczYsqLyqGnQHWTeMaJUfLcBxiBfNZU2ARx2U0Z29ra+tQF1KpzusuHw+8E3eIooAR9JUo3tE5rwoZK6jwgoB5nLJM1RRULKT0QFP8ghmGZsFXtEBPCXgleOWV6Ti4hgYwgksQq8zsLU4jAKExiCCWQJDkuUT2TMgf6kPI6+p4qOq6ivqqjgZFl16C4IAkDhRdVxiqtKH2A7GsZImi4/PMa5lLzOvi/CbacuC/mqmbpCYz8cnXuBTjQapXnyZ2iWxhcJ2hBSThoWbZvp3Wjhx6WhoIDJxNDukgnX7O9h04rUCib1vZ67Cqo9F8ZcffBhfgcxluBJj7UHw4uCExk7Gz/vdoaUe5RILjSfpDpEm0ZC3+EtCN0hF6cRsdc/cy98d8qXV0DXRrFBWRvqkK/lzcJis5kIstRMThkYtviE8oC3Dc437PL/l9+B7GK8NBfKBkBpjwPSApyWFICQsajgdokCVwLkvDHbKE7ZD1aBobfwuRm1+jJCdLiU1Aw2iCBW6u6z+sfu2K241VCvQb1wMwaB/A5y3qMWwNSbn30d7fUe5XDg+zV+gfMzcfRolNDWBnGJ90EsTygW6UmhrVDO5WDVMZP6uYhnp3rx9RId4pmOHq+DeUdFpBa6oZjQ9OPXgKPvP2IsSWhtjbkXpYNVxzuxPbpmEPDa5Fg2ul1dUzq6sIyDaMvqB1OEpMxhKbDfRtgKhX6FxiGk6i8OzW1lhCtWsTdEwbNIrDuB0rVMHmT5lMtAMtCA14eRGv7VTD4zhtFx1NbGzWL9Y3G6LmFMb/QzpXcyv4E9B+Jd//KHAJ8MRT1cgTcadZtCu6k200suTr6EW3VKvLQtknAww+Ezz8x+h/EK1fN5HeAl1M7EO2UaxXpclNCgmbVIabcHaYGlRgYi9IFYRHokKUvufC3T1b05S8bsmOKWmeKuCMVlJ9N49QvaaJMse5Ws4GUq+noctLxYqb9pfrHOIlrr6SNhdKHMvLXDFsWOkFs1qK2mWvUijIImfpHAZ4Y2IuhQQ97aTLnKcVlBNphfV0gDKqKRlmRpJUtbyaSUkim8qs5ooLHitjlnXDO7bOMsxMXzECxFWFsc90owln1rYSRo6M/gqu4ckYiKaD4XDCgFF+pacYaLd/qMVd8Fcm6TiPCngUxNBDdLDnQdrkMyfnGhLrLbtC5psPE4hIzPoHrSsB6sH46rUOZ7wmKWuBacIsPU70OVQoUaWrF4YjDjuzczQpKD81zZtE0EglUNXUntXKgdBJERSr7qJ9hYLk8X9SiA7e+P4YM0doS8joZPEwssIPy2k9lCRidqr5+DvRIIa2B0f4y+lcGs3rEOk/mVOjvagf7cWKpGB8OBrN8T5lZgNijoCtCmE3OpSB9qnoipySo1tEKQt7iZghJLo+jEaaMn7Hm3hoVtSAZRVfNjwT0IuibTwoQEcsKjD0LqKPKg43/sSPSjIhNxxvquxH1LTpp1Ip3h7/S1T4PrgCTDebxuy75nEY0c9QCSkwhW7oRlPhEGI2Lh4bXdm4+OT9x47dj5iDYxc3hleOkZMnL27EfDXLoDFgz1Wmw5xktplzzAXmLoKOPaoogVkkEDRPBN3rKBFzA49HzeLaa6gGM6wm+EnHbRoIkBU++kUbNaOUV50sQimOrWP8VdEVfxnjP8Oup7/DAGjCskjVJE9Vc/eLtIt+KP2D6V+efn/A/lz6B230V3WWwJmMq+bKel104QX4l+FVXxXP6S8Zdk5VPUnTUIpNWSLtZwueege84aW571zfEz6mfoOczY4lbLG0DZgC7APLsoEdxBx/Xbf7uudJcHzpwtLShQdIkEml0Au9LNRslFyEYLyfXIXgO1MIdS6++CKvzPPQQ8CGZYbYPLeILBSTgErN3RjMAB8adgkf/SJ/aqmwoRpK0EzVVtp1BFh7/Zcu1teerKPAkJdOl7N8Iyezwma13ulcaH3gtfW119fn5m3lVXLZQu1al8xlSsdvzOZS74UXdh+BrG7OBK70IKN52pCDY+vVq4Lenjq1VNzQZW2uEqsoSFn80mngZ2flvz2a0pFfR78FfXMnc5H5ZrLSUeUCwWik3JR+ABV0CblI6lJt8gQwd6iomTAePiH1XWroFQe+12k3G1N8Rwu8jNzYaN2jGgtPoAnkCpEeVJv/SpRVCTCwkTZYRVUV1kjDoiAi2VnLK36KXauH95cKWSwWyk+t5DVdFRSFNWXTcPzU+K+XycJ9SknBQ1gWJUmRiLxZSxsp8i6k5SWJZWWlgHlN0bEti4Yo29iQDf4Zt1jAjeWF16TTWi57d2OhWDf8vJk2RU1CuiCzrO8ET8bI4EXexrqi8bgAr+NkKS/y8Ir4dbM1hPQTBh4TRl03AcyNmA2HlZ2qRKKQtK4LLdkvekRnMx4V3QM4/H7YbofLGVtR7MyAkNknHRKOogc2Lzu5x4LpuP499HuA0pcSucBUnRZLBKhdEZ/YLPqxgeMZFKLPOW17HeYrdjEeiI6YFkVjzR5/ryMJMi9aaddVV1Tbeddl9DnbXktjnIZ7B6KYxq5ordvta44NN7hu2hJ5WZDgxjm6OIhtX7qRVbPh29sn5iSxrQbDHFnfBBhlDbdrAfFEzHAI38ceG1997LEb7kF8G1t+G42uT25CLbiJTeSTwyQ/K7JIfkQ91aOmKOQ7zY/cR/TlGoqLMiSq7CltuEJl3Izt4nal7eO23+66FTfsuoMIZff2gmh8bW8P9XrNj0a93WiYHGfl3Kd2DaQmoVuzIrdLjAuAyx+h05fHo8uXX3wRRS++OF8vYnNDauW3ocxtPBoOye2foVV78cXxVXL35P4gtgWwI8igFu0NBlAUgpjn8SkP6//5yT0NOvWcmIslmpxONyIrB2FxiRiTMr01eiWWvU8vRERwQHM4L+sZ03XNjC6zKSnFcjyyrbKlOarKcXII8A1WEJIuiaqoKBBIHCfxyNLzcel+l5PTQe11tSAtcwDmZFZK1zohAAaJk2XuPQs5XUQSL6UEUbWWLFUUUpLMs6KeY+b3FxApzXGCme3KBNcLFNcjAEaNVoxOyXaCmOndjBUwcTI98XHFrRxHL2tOWh0/r9g2+nZiEQUcuqSnc7pK2M20qSmiwPNQFNWsmyoU5o/pCDq0lfHvahabVtGiYo9HZOjsyTKVoV4h3PKeqXmmY8LH00wRK6L024SeitN+0RgPOChih0w0jncTvSjBZ3S1A1pgT9DXzVASd+NNEtNNFJXplZiZ2ew8gXbcDF3+Mp+K4dmjMTz7TzFoe+nrAMTtxXG0HV96m0GNKfu5czW6uh6vnUPZOK0VI7X48563EdnAcnc+rRe/ipnTTYqMA/U7BjzwvWRVn4h2gYUltmEA7dq41enW4tr6sN633VildpqqJWEMzieRIRmtEXNBmob6MTm3KFvaymcCQFYPXYaA6nWOXfTXgslJZUW+HDhZ7uyjxy4iJibTsQgtCoptR89oduFPdV/vaRkdTnoQfZOgZ/QenEBSFATaos8WbXJhrn4yrLRrgNFuI/jM/sdXJZo2jU+b5fDvXZnvi9tgiUgIUf8fWpW4IQ56u7ukSvP1Kty6XjdXA99Y1VvXi3Q5Dif1+sjRysxquXFDvaBve7uzer3jSEX6R2s5uLFeQOppxebHoworLtmRdPv8eHSPjsOv3Vc39e1kHP6T/datqzep08asnnNjMLh15eZ6aXC0nrfspzv//+mnkFrI/YO7yVy+K3359D+2n966Ak9vz+tGVVqvM6SP5sD/TS0f/p0JlNuaFPrviqK+nsmRYkJweLTM/Vl94KDvkavwTQ5zmG5ELSfrsxVpAmgr7QQq0/WJJ9KvCPdQn0gEBhHZFQTs/gDO0MPjq8HhIdkzdJ2RgezKQUAPRH177cqVYX+ebyFtlbmRYwrn9X4zLumne71o8jnCHR3OXWDm94hhRidWjxE1zfXJDI7aaC8aX23t9waDHuCk0WjY2h8O52wlfx19nuzIRMTGhAzGyVZaujuhGAvbO/EOrm0YeGRnG6zFnSb6abVQvuvsome7fNrAAPEVwRZ5XledQOSB3xZct1sweMPJp5csQUYve7aTquzUC13XJdt9eDlnqzrPi46gmIIi6K7g2h5b2jElKTOzF/499AcUE9qw2vrddRb7tu8JBkv3sX6k8smqUflk/csPKEj+fz9Z/3NTrXxf5ROQ9ok6Wn5AKcrj+if/pyKlZjj+t9FvA75KA11h7JpVadfIrDIQAL12t9M00Bnk9wHBjtBTFTEjQc/uYXa44791EQ3GBxG6rSKyOBiPhn0p8z3+zlsXJ+/9CXQA8zvZQ0oKCJjdI8w80eqip85LCI/eWxzh3On35t+z9978e9EPn5ey4ucL7/m8iO57X/59PwVp0zk1s7WmVltk/PHJEfWvoiygnmx8AJJElFM0ZL7W8/7k+egwsUPv3/T4qz3vJ/mTIzo4PCRm+TS84fGkLd4JmNiAFi5BG1sxO0j2FhAGF7djARyONqk9xPAb26eDohds3Vaq5YNMEC4eD/KQDG29WmlilgsLK4vvvssK08eXfG8OcxP73ijG9RExFjscDK6h4bXeXr/HzMsJeGppTq17bbJBAx/2+9nhsEdD1O+TXb3XGXqY42euUJ4c4He35nb9ShcazweEj6M2DiuY8DgfOHmy3C8/Me4/AYc4joYQR/c/MYbjXvnECQieQP1JfGqL99FYZkLkXgImwnSK5qlQD2YbEa/HWnmAxcxGlNaX9l/XsOwHP/CAbTYe23dVU7Qi9E3d9kYtl4P1qBquv+be+25bDytwpiuGWdlod0lW/LQuRN4d750FnsKtQaZhF/OkLn7Kx1C5CqlleDAcDvZKx59Ezl7pyeOl6taTpfEIolvE2rhfevLE7f3SiSfR7ZXHT5T6EH183qZfjTWZM/IPND0kBnbAqBLBBg4JGoY+BwbWxYkQoYoOEmIOwfcvqJahGJpXMCuNUsNwdbGJ9ayuZ+eXBUXRXeD2bdmo2MWs5RuKIt0rBCqQ+ilWv5aMXzIbParNrBIZCLByRBsTEaaw1iDR5Bslx95h0O9H8LnOHB7AMA/6ox4Z4kE224suPULgZ6/V2o0ich7N2viGvREomW0TXUk8a8jWiMM+0G6YNjD69qiqprXfn7Ph/hcxL4lgduBaN+rCF31L546O8aMmDWHSRdFhazpPR/Pz1AbWaP4/Fr/Ofw8I7qYqoUR/fm0qv/0a+nNi4U/XP3d+G0H89V/lGtF4VZI42RUAte/3okE0aME36s8njAbZEcpCFAHbPOj3e63p3+DatdHBwX6U/O3GqXM6Irpyo1o83rYQVVeR5Zou5TROkZIPLHzv58vtYrFd1kzbjD+BZJrmAI1K7TPt0r5smjKKSDge0XgPbtm72mdmtnNXoG3uZy4zTzBPMU8TqSCwpDCHHYOsuLVuwpOvI+KBoSoQDwcdv0kn9wakwwwgUu4OoXs4hhk+NTskeLUauqS4rdRml7wL+3w0Gz9okDJYIcUv3rFSYgWWZ/mUgkUeiYhs+dwQZRXWUlW3dZno1JEp8KoIHDyHeJlXeMzLoRdxnJOuyOO/uEb/UImFl/Apll9Mp4speI6XOY4kpFhR5j8mcgKv6ByWDZ7VeJ5Np1iOg7U9xad53VRQTby3n9XCYAj/8+0j0l26K8xF5uuodg37Z4iBFSE5wDtSC8GYPGB/mxJAWCbjy5RC+ARguBMMBotEtQntMls/yObSIVRDFdGdh4flFc1ICRw2LFnFqqCoQiplZGFZqtimo8tY5g1Fw1hXFQXrWEs7nqbJWgXWvV4/0CQsn4+CD6WRCvVUDRWzgqDzgiBAPY3A2AzuVjXF4FOqKFiCiVOcLViGrCHE6lYwoTNXbk1nanStxDAN/HbUoAQg/taS40EfZnJACA2aIzTDbJbqbG9FaGZ+Qip/nxGPBv+h3C6V2mUFWHzTIQZSAYxqMth32qUPUYvqiNhIjqlFHSJqnSlNGQFV02FmrRAkAxO8O7WP7t6kjiUG6sTBAqGh6PRt15nXnIplF98XkhePhyQMddRqXd1toVEvCHqJCimAq6NJQaxTp34Q5vvgpjJs3FQG2yJSZ5pWmxkvECM/+ER+Fz5HCvJFkv/4qk7LQ/A7NGgQtDeAqLeywZEijUdxWU6bSdm+eGUwgA+UK6Y5vwj02SaWMd3YCAawMNGDJtvQbpH2F6bipA1htVbbqi2K/Gajsvz5I0nCRrO8/GN5R4fpV7qQ3sy3tm5b74aVm1LmcP5PMQ6lez6RuydapdMo1isR/yLraCY4Rs/lTfPfGavGCcMgh3d9RBS72MM/hHFXdNF35Q0fUOq/M83jptfx4RZj/NUfwi7cgz8ieriLGeYfTm9LqP2Po7ejPpHxTuwVfo0iyHVYh04z54m0jQoEu82YZwZWpK3Htrg4CmHFhPXSfRWsSYhzaeLjgerUQvS9kiTIkrNateoVPy06kp/Jfil3Incyp291ukHBsDSjUHY8y9DN51Z0PiU+lbUsy8gBzgxGffTv2RTnynY901zEXorLHy9++3C4/Jah75oWh9i05tg7y7KnBAuWEtTVjPbBwSgY9qaY4RfQPcxZ5nbmXqCWl+gukK5LhbhhLbYUBsRZIx5YyO49GNWAUagI1IUujwgl3fTxGtQfMCSQRbjQwNE6EqANKN7CG7Uo1sW00AdlS0n7lbSRyvCFbLeeyRknjVwmU83k/LXVtCJhA7MVVpDKa46EbcnVJPbuu1lJHf8FnxMF7vmirJvWG1euoI3AND/LpVzsWAVRdTI7O8vLO8HOzk4KnnbgMVNN27KbEgzFChzZeFB3PNNcQqIvv2ZZzc5kO1eO4I7ZvsUb7O9mOxXjmRh/kn2wxDqmNYzxTDxG3011NDK8L0rVUtBqYa2L7j/2TKt/LP9G5WJzQLTRvfDtszVrSNcsl1oHNMnO/Yl2iyxKr3rycqz7P3Z4uHOLGDXNhngU7N8UmckC9tCArhpMbE8fxob11JS+7RIlej+qd9JOlCn+01LmEA2+pxHabu0D37taDsPS6k9CreM16Kvoq0wGkFsRZmebOQ6YbZtJvA8JOCSKI6AGbBi7H+J9IJEh9qncKPE85MdGp10+hPEGc8NPXBApVmc5JD6InNOWqBInRON3jYatfjQcjT5t2rXEBVH9lBValVUT8ZOL8DzxMKSK1lJIvBHZZ7qmQtwRnYWLo71+9H7rVB1Ol08c92q2uWCuViw3uUSqZE3Xuq+FS2M7LdJ6sKpaBMFHKEGdeA6B3ur4atfQsAcYfdi7zgSICbLDLDlcnQY3JaBREIwH2SzqZ8nfYBCQv2gaBJBCLkQ0IAlTe5QW1VHBcLATtb/XmNgE1SaRQXGpCB9EfH9B7HPxgSgWybEYX40/UxpN+O7V2H9Tbc6WMCSepoghQpVujiTD7QyRe3Q7RL2CDj1zvE/sItCe6VWEFPf0U5hPSannO93nUxLLC089zbGACP/Nv9FfPiSWFST4G0HhnngaCyn28Y2Nx9mUgJ9+glMEWX3nO9Up//1nUJ4i0foR7TAAiAZVQhPvCWTbaIklXpIcYE6uUqvGFoTC8ONEc8Rx3/+ulKygL78orvn/xXPFbyFH3737z19QMM8idPLjHIul2Xy6RnmnLJXkQVZQe8iIbIci0h1i0+T5bwBacGz8o8e+9CM8p1ji+78Hp+UUj4ZrX1yDzx+8hzMNln/DG3jWMDlmprcibUp8pBCL5xvsM3HNnbnCinzsu8R1WDds+0csNT9HNooVXV3t95vN3d2g2QS0V/SuEiMbCHp7RDlTFJ97GQAEDEDC/vfm91onvPuNuUOX3jq/198ql4/Nv1yYe7cNrVaClX31VvU7WquwDaOnOzXAO1LHg4Np5a6tFVumQsSt+nwJRvsvzJUhu9N01rZjqeyRtl6lnmhuUdupT6nmvD+pkHqcetW2/zNZTAluvoJNB+sKruRd2RexxApuz1X8b71VSw1EMSO5haqgati2hGreEVhJlDKKc5fLp47Nt+N8uX06Sm5uw5Aywt1XHx3RAHjiW3ZZfWOwVt07Miom+CHWp2aYPPWGdpPvq6ltWIUg9PkTdGjI4z71bjWUjfEg0Sg+NL7WmkUjRHcc0fvQd8XweH9/NInM2U0RDwRE5mwBE2ABKxAbLSFA2f3+Z56rf/zj9efQQexfY9R6rv4jP1J/jpm3uxJjz4cuGVrdmk109Ras/+7hKHpv/V8+HUXja6NWHx2MgnvfW/9X15ledICy0Wxv/ltgnXCJhQKgpBpxbbaF2k1qggkF+t27t+U7BMltZspL0Zkz0c/euZYW5bOpaLVz51TWNzoq/4/fc+Q1bqIGuAu9SQYm8um2eFpLl61iY7nd/iUJBvlIk8evyNqHt0PDOM4uh6vbH9ZkcjMzlR9cozbYs9VsTgcevxxROQpdyNp8cjzaDeNhtheMxlchoC7KhhOWZrx/7doIWEVgbAOqEpjKGr9EfXW0EwV6CbnYBbK/jtq9bKWy9sBapZId2F7FVNHLEcY8/URXDlK8qesvMUd9oLiJZ5H2xLmYK8Q29oOol615axvBci1YzrY3/GaEBuPBcCQiRGzjpZHKIowRO6Fpv0/bnOiZAXGRJk42GtamGw4npsfxcuFDF8T8RVXwYYwLc9fDVvOAF7NYga+KfUPP6IaPVwOgKuXVK7kG6zgQdRzURC9L3M6OgCfhA1aWpabyB2zWeoCTtOE+NTAfrODNmr+gf5ycfVxf8Gubc3Nusp+e+kCxcMUmIrCEC/a7tQBd3R+PdmOTleFwNBigw/FoHwE22AOIEAT9wax/rqFDsjrajQ4dCZOFBLsJY0NOWp0DRBRKd7XbDds+5KNqo9Vq2I6OPhmxpjL+xUa7fVdL+v7oT8orcJP0W3TQsdPy2gTXIjqSp15FY5vXqbdRN0zSUeC6tR7BG+6+V9wnR+haIEaoX7fXe72iS82X+nD0iru7RW9A/JDO2iZLLVepZcS85TZ1vRdvHid7GMh+nInRg9+ZGH3U2nPmHhEdrFYtFgah4SYVJnxKMWkE3a2YY6AC42sDArnLfgToQ1Q0M30trco8x6KUIGt2ThfZg6yp/AkamuRheHLTJA+Td30eZRPE/obEBGQ0VGVL1VXNkLWspsH7/0Qxs8yN9it5gq9vmrvAv9jTOk0MWax5Q5aNJJHET6Lv1tNpffyNEKLvGA8PYhTXS+xYYpvjcqAJsRFLuhyoGB0mD+jk4fEe5YFI3ywXi29U1UKmamfoXlHlIAqyUA9LVgNtNhYIP019aR2VU2DhFsKLJPH3bC3j2EJ7cWm51ky72tZyuPl/pbWMm8btxcWVatN2tJOQ9jOVjMnzfOOie9KpNlc333R2Nbw5aUoHr1GOq0g9wZ6IuXqHQlLil3KCLaKbIvgm6xrEvP3EsWMn/pYEcmyV/a0mtb3+1rhrfyVOPD3ZtX9scbh4jAZX5+2048/LyViKzWemcghSXonRAK3HfnbKk96HFbfjE7EDkT0kX7oLBBLpytoy3toKoh7wAoP4m+2Nh4P9/XgBRmhfNqgnKOIM6pDu3tijugB9ui6lKDerQ97OdN1oQh+ukN2tRJND1gu+WwPs6TZCtwuMHZSBOGMCxMHDlIJruBuWUNtAUXRwcO1g/PPN3mgA4SAMd0Kylg6Je48BAmwRhOGl5g4gkBHx+bHTHAwGcEsvbGrhdQZSgMEJw72wCbfuNBlmTlYnQPs4VLtE9EhUywYMZjuFY4UZ0ZeF3YPB2vnwjs+t3RGeX3shPL88WPub82uDtTvQaEDT4CokXmdCmkqun791HvFbqRTHjXiaU60SZ/xQ/Q54+PAOchh/jh5QH95Wh1zopTpNe4WGNH1ajy8AhiO7Y1p0X+YaIltTqf/kif57M1n1yJ4JHFtD0UXan3Bw3UkEfZ+y4A/9BSVv6IJjFKywqGfyvl5sWkXTEXTjMMgG8PkuzdHgs6Hbmmbr6AXbcezl4+2HdMWUSxnJMKRMSbIU/aH28TVyf9CUyY36kkwe02bryK9Su3rCC0fUPRu1BNz0u2sTWR1x/NAOm+gzP/88PruweZ5FpRPVldpWcEez+7rjx1/XPXlpg2VRc3dhg0XnN6tbdVQ8HuSpi4bo0ZO6fSPunOCYmyihn3jbnXjdnUcwPzdE/f2IBEcx6FXicIy6KUtoxK+gnwZezqO+h7aoTRPphk3Cy1UpcUqi/iya6naASpQQ2f0XwhG6Yh016XaCTY+wDtUw3vjyeU5R9WqgiIVq4bmU5BU8GWcL2T/kZIhKOFPIpsv6xrObRpkvheUP5ay8Vs1xOXVpVZY/v7qkQryqF6x8ipPRe6wl3Swu1TKZRb2ezdYLjmNMIuOrz60fP77+nJZOf6HZeVLU1ccW1hFaX3hM1cUnuk2OQ9P++1P0acK5Evam2wwnGwW6jWSfTgmh/1h/pO7p2W/6DuyKJYBS2a2ve+ZMLjACAb2u/lDdrQQ//M0Yl7CHxw1UzihZo4pn42OQ6BVnohIL7Qx24IOG3/7t44Nv+zbUm9z7m+iniFSqETt0IO7EBRxvUiDGIIg5vbESZHmvcTK7Ydsb2ZMNj49WNu4Klhc31h/Mr7GuabrsWv7rHl9cno6ZrwB+JLLcJnOK2WFi6+ZmTUcYcJxHBFFF1EWdFo+hwl0dxTYmJaBJmJiVLyPcKRHXA9Q7jgEx9LOiL28vLd35YpU3iivLIrIyEjovjr9S3Siu35nl3iyzsKrLP+hlsmWv8swpJ1A948xb65zGcdo39JdOoR/BeNtAd52RHbRQWBYzFpLQHVLmv1Tya+cyubuPSzkZ462ymc2UoxMBi9BWJDg8l5b6p2bt+jGYd4T3qlHLeWgwuljVKvGGd0IuCAlJPNpQvczLGmvYx9Yck9WIxen4kIRH01AAYb9TDguFsNKO+eOjZ3M8xRXoV5vKJtaZNvFEVqPMZsw9UP0rifsRkVq2a7hG3PzRG1LUIiKm1f2IiKei+uOVKKilmkHA5s08e3U3G/2vrS3zkUfWaNine5kHgGL3Bg89NLhvZ+e+QR85J7dKlx55Zetk6ZFLTOKvO1m74vWK9PhrmDuYXWgnQH54G51JdShhYl0yX1Ob3UQrhsNqst2ZjLRN4PFZYltb86catEpswEKEwsPrPE5xKUBMlibqIo8QD7yGrH4BVq2HambOEARRti090DXNteH8Cl1nqR050KT3pDAvi5LiG4KsYl6y4Iy7LYA1OrvumTm9TFwtAZCEA8eX9ZyVy2ZbQbBLQ2amoxgm9Tye1JPWkZ+rI3ZcH+rI/z3rF9dtfI0XWS7FskJaEzWoHM8Cw6IibvBdNSOvAypU0lA1Q42rdo2oqMbDPmp9IytysiTCYCfV4mSoFlSu3/d8K9DLQOFT8FIWsTypk9mmcsoomPn1A6iYBpyTgXokBr/JIgejBLgE14/a6LDfG/X7vYNe0OvvEcVln353s70DGBxTO/b/hr4wkXGiCTLmyUwn9NqfuBhFfbJl84FT4//e8JZfe5e3dPHXGq9d9u66uOShZ5eoseJ97sW73KWLd3qfdV2SfufFGSaH8hIZMSkzQ9iFCX1LAZ8KIxwwETq82rp6taUFO/0+YvqxGQbqUysMgqC1S/B3JX4fC2+E9+nJ+1y6grWJNV0jCv2KW8E1n2V68RvGf3Hl0gF5ySNXLqGA5HH1atT/KOTDTMpHfRIpVL5WINgI8G3UBva15jegrGTrrU81pyG8+mAzbYenzq/dhj4MXXk4gjwGdOPzoGY7ndtPPPRpwI6IOYyg3Ye3fD8MpG4NqI8LQKVRARIPhbdJa7SJkhZ9aPPibasXtkLbGr8L3gNvi3q7WZLBQw+duL3j2LcdEhwYXWd6B4dztlCERy1TlF4ku/aoUr4bIwoyeKvE+W3b3wZOf6e9eeLEZnvn1NPlc97ZxuLtS0u3LzbOumv7xypvQIfl4jMvPVMsd9fDQm3p9tfevlQtNltXFpeJK/fpfCIyf6IVyUOei8TrHBAHq0IaCapjQ9tFrSaBFt2IjCkSa0z4A79dpdCn5hL3iK1oPAImda/4K9lRH3irQTARnN+xVHV2nMryoIeYXg+qi6gXNeDUe3DDjw0GWcJSLRf7kQrQVR0cobVE4lakPgcJ919z426MqA3MdDt8mwCfLl+JI4BAI+LXNEK98egwLgM/Pgx61Ifs+BrxbHatFaEgGl27thdzgsPg6uHh/iA7OpzDXfP6EIZwGpXEFw/5lQMojEX3mcM3QFfHwAn/E806JH4ziRM/9OPjd6M9V01bX0e3NDPEX0WrNcfbphLvWUSSVpt6cwmPOiKj9qqx7ephq0VMChzTlM88e/r0s+8gwZmZndZg2I/1vv3kGgTjvZm117wNbqyBu8Ff14RoUGXYnFnsxWR/w7xJbLIt4vfpuJ3ZJSvQW1Q6SqSDber6DvD6vI2yPZ9lqtKuHLaojVQwZ3Fc26pWty6Q4H2EZIyoMdLw2MU3kKsQoFZ16/aT1erJ27eq40E0zf/aLH9Ec3ZpKV69SVNkngZfqwC/g/ooujH/8dVZ/sRajWSfmvYr6dUGxF8917myIeaWfem3dnfhgw5v3ZUoS662ZjxCbLtvUf8dj8/R/+5NrFJYrVVrsEoKxLGHAyslcTOyOfmdmtOIuO2lflH82GqKTHEiqSJiXmo/hc4vnFyAT/30w6fhk48R0rfxSsOu5l2OaIpYyc3X7EaxYdf0nJqk6HrNafyHSrXzb6OGkU4bS2s0gpgCedtCYYW87fQ5GFe+bm6wqqfpVbtRpm+VyCt4NWfU7Dp5K+SDWfTDD0SNSiW9mv232dU0jczJjq7QmevNpAczjokH6h/GprkxTOwRFxeJuwv0CIEsPeKRs2Wq6BXVRAe6MvGqoejR6KB/kCW/SzHf9vN+munOPbdGdvCliB6bWAYOBsPBYH9vbx8iRCUOqOMQBYAhYIkcZPeYmdyX+KWlnmuJ/qJHXENf37t6de/rmek974cxVmY249nr0p9ioro+6uuMCG/XETVmhelFfylmOblEZJGICc+FmgxcsmQofcWQgDeW9PBccygqWFcjVcOKiA6b50K35GUcMafEv8Ch5EQn45VcuHP8rOdppqppqjkb95+lbaASayxS7yk18yk8aAEj4cceL+gPPuz0ek07lwuD4IO7u5axZJg9362UTkUo/45cMwefH14ef/l7CmkTmVbpe35soxAIQmaCdY/qYTaZDtVNM93Eo8pEJ2O/qj7m1U/meefTt1TT3DoaxGx1/CTaT1xURf1JZO+mlCkt/gVKi4Gvb3TnPA9M3WP4XUCxuN0FjrRXNOxmu5E2i7GQ7dQDb//Xg8FzK5/4kFhMB81mkC6Kr4sla99SvdZqRYetxs/M7VUgFhdMvHFusr948ttdbeqhcSrkW7qw5JgFPg8sLa4aeb5gOpBUb7XuaMEiQKLVYpbznZVsdsXxuWyxWofEc9Gdrdads30EQ+rDr0G1nFN9w43aTuAvE5cEAqZaICKvHgQAUANqpMRA+HxLkTW/6CtqnQALFOwunzq1vGvKB+QWCK6c4GzZ8H1DTade3CWqvKP7P25c6Y7smD+yTX5G+I/s/zhIEiEgr535+OGovFCj2gmP0n1ikU2czPlRiKkKMpwL8WZn4lDMm3YxivbGV0e9Xn+ttLbWmwahlWFZJRIExGZMIpRWFDTaGwMHtNfTokALslor0LKBFmUh7GctqZzPFVUjd1qxFPgc6QdSznBWMpsaa0FXJP7gNgnl77rEHwmV/06KFAjcmyVeTOmOUxLNnmoLsmsZzrQc4799Nyc4rPIQ6xQcrOsPmlspXpALjnskb5lqLEnedOcNMMdk8w3NBFZPokXr9bIA1+LXjg+jVra3u9vLEl/47JE6TGswKeG0KDf2i3iTLUvyLNmoQ/oGDu1KgY3oL46F8SnlCumrgyEU62DYv870gXL3h0Qem+RFbNN7wMP1qIQQeNxsNjtlUxPsOilveqJ7nLU8LP0YuLtoHU0NnBIUOalTdBVeF5BsYgrzTb3ecNbk1/b3iVH2bgLKWq0ezdg8UvfY/3SGovo6tRA+xrQSnjkpS8IDT8ye8T8gTgt6hVjutIbQd7cKp+XtxYY5weRADXeyyaFFTXQSu6pb9dut+izZm3PLzor3ydOd7jd1VkRzh0+CESZ9RNH9pH9u9L5JdIOTfsmaco+6pZHN3WiuQ3bJEkkCYxDbm8Vj/0voT6Hl6a9/IM8lkAuo3zLy49W4G1InmWvUp8A2S382rDbdZY4SQXgsjqT7VgSq+YVFAn1BRGbJ4QSW437sBBZ6AkZBCUmu5Boidr6S4kTRWWmWTiJD9bBWMSpGSVMLpXIFi5Ysp0RdMLHBC5hV0dPFUn6zIrDoZXiIexkhUbJP5DPSd7MpjhX0WvRTnB60/FxUNlROWlp4rlD8NJvCtptRZAfuwHrG9SWNme1Lmf0mBvm9CvhaEMT2g/R72LrSQkyrNWunQeLzIHmmTdS709+nSL4D4vRv2Jo8wzIzPzhobkSwzJiZfNGAWJb19nu9adlumc9c2QiLPslnQncIT0E8m8576XXILqLYtjX5TbPpKkY3FRCNRBTzlXt3diMiY6ToIOrcBVMW1jbyczzBfqL1LbknHpTbMTBoyw+eIHeSBU425n1uD+O9hnZEERWgS7qnpj/dX4j6rcmuw6ntOrV+I7tUYocOwbT96Lp4grlAfa6R4daKf2SAuAQC6A/zihhUT2BCvGOCyoY9wrbEG4zCr8GqIsNSeJ7jMId5T/dFQ7WKjmmnTCWPNVUUZcOVVTFQjGw671mSIknp5pw37GOvPXbstU+QAAWcwkqSxPIoxaZLoizW65zlO4Gh6CleFDOqLEtq3lCMapiy5HyQwemfnXN2/a7kPRBMeCUYO4Q3aMLMJL5aGJj3tZkfGFzp6ogKSbdTAI1ifY5PpYaJNDHWeJxh6fJNnUOF2wgnu6uaLGNvVLMLiizbBWH8v38HGBcO8RiqiPkUYWJMDav4eSOjlyt6RlczYtEtitbXFxYXTzgStE3tm4NGAB90MB5VN3Ie51pfxqpgpiSR5wVJ4kSZ/MzY9xe0rEH8S2iFlIBSKcSxiycXbcPSA2z7j6RzuUa8Hk1kSteI1S+iFJxsUq3RbXyJQx0iYuzv0k9yRMzcCTlO5UUx9o5R9x3MffHMOOKfeIJr7NhbzYQvmf9hS/ITJlMWdRLBAEMAoTVRZMixW3fZiJItBUW3l02/Jp3tTawWg/FwP3F6Hx8+1HxHkzt5z0mY9onrMOPhZJPBwQiaOJ3NpqGtIVr88eEwwe5yfHAdxyatha5fT2jLg8SieWKtMTHhIG3390qbbGSeWX5Mtti4aEQZKrqrORjM4tlBMIsX3SNX3OJBvL6QIIpeJe4V58+KM19oL6GXKJ3E8Q+tEh0EeunRR+uPXmo8+mjj0qPoUXICMXKePPN+9H76zOwRH3Ue7V56tPMo/SDmUvfR5KQ7R6M4uks0rMH9qYqNtOhj6dCJUC8C8vSXP59NnNjE938efYZ6xmTs2Mx+YqvRrBIv+kVWmFjbC24tNvAgW5boXeQH3cjJnNDq91XRV2Tdz3sFP68s7VUMO7+ZZg0j1a6kzSXPGZTy6yvrGf/ia/RaaSGzoivloFbIWLvvi80Q0Gc4uRDU7bSbzmxkPC5dWm7Ki2fl7IWdS7ed7iw2TG6znc+kjdA2pEztKzETlrTXf0Z/NLMC1xFg/DUU/8YsoZ9Ev0jdkNFfJ9OpR0JiSknEfcLcD0iiK+RHS69kzuxkORJ7h3XM00TPe4cIK/s7sO7hd5DfRLI075h1xV8pplKSIAJUkDhhA/1s9ty5zKcyluFxmXPnsi9ZoiKI/hn/JWy4+CX6hvQxT00Lsmh9yttZQYjYinnEGT7LTuTB8Z52smO+CphxkzkJa2XicYvs3bYwHcg1ss3D9WPbPfpzR4m7kgiWVeLHInnkFQdWSjwYod4fO6YTrJnOM3mnXrcLj0fArvbGh1f671UURTeGARBFFBHndZ8x3GzfMdN2oZ93fEDB/eCwf9DSfWNeB6TQX8Ob+FaF9bwzdQrTnZDiKU2mJk8b9Ffrmq1pavemyBNoZ5Xyewcxth7Eh2/U72k2GqFurpbfnphjxheGiVuX43fEKv07/igmJ4uEaOn6rrbgWLv3aGZ5NRunKEcOE/nRj9P1qAR88gnqxW4zBoFk6BNOvTZ/LhRRl6ZT/8Tk1xNasfcywrV1af0hsglnpD3Qhm/qkpL2TaB096UV2TD9tCKxWvbXMpaZNn0I/rzqmemaZ1oXsyeaTbMVbBrLzRNoMZ8NPNMuZHKuadummw/yacu1wiDIZ/J2LpfN2fn7cu28HbRzmdWz+YrjVPJnV2e6qK8CN7ZKf5c5bMZChhLC5PfBsDBxtEx6hPiy9r1EDNHthHzYjB0flBBqCxKSexoPy9/eWz3V1mEJ9PDJJ+RA1OzierH0fEkgysazpiYI4vjTvMKyWk9RZR71BVmT79EQq/IvvbVYXCs5mhjI5x4RfQANSlp137oIC7LmnU1rqiF8mVdEXu3JrMTP6ZmJVQpxCk3kMV7shjkhUXQPqQDknSxe1NOxD3BJ2IjlKVNVDeI7C82wkBFSKS7lS8VK1C1kvUzN8K1UpqyoYglLiCtqLMZSOR1uV5fvRCPPOb9QaJssp6T5VP6+fLFSXFkuVVnHlI9V7TTWraxjvhhusmilLgYZzVi6cP9tzdk+n2sJxiW/17wxQ8eEV2pQ59aT7Q7dNjD8SZzKYhKGEIDHgBiTjkbou4e8IJpuobCQZweKnCkUlgrSXw/39sjG5thBd1RAgvC2VGGxkEm/lH+Eh0jB/QQW9ycOCvAN5crRPZvNoyXr3rCGElOjG4qztxc7ByXBww8+COdzpWjNfqPgSivqTX0rXP9bsqij65AzkX516CrY7ayxbeJklRrgEacblPoSQweINRtUMo5jt/BklhGXb5fvXbtX4GxX+aenT2Zydo4XO7nC+XvWz36b7Av02vhXVQmXFL+olp7M5opa8b+it5MLvs29DT9xbFM3RJUXtkvwVHThqzIn3Lt+kfNrWjmfeT0846slLGrOl5O18XfR7yZ+S4pIZ9fYbdZLzRQqLnplMZ9/7Zve9FoaXtjb24XWeGVhkgDh+CdJ2u7MB8KVxB5lakYV/+5gC7iCfRKZYcVYj3PDvQPqzqRHQvrz60k5D9BvQo9ukV9Bi61nyc+UEY0zZZfohshOy16DOnhxnCyMUJnkPuIDF118RobZyeoax4qOya2dW/OfwWmzVn3k4ddkMlUSF5/JWNaxc2czJZwVBMMRKsqHn5EDJ5XK6LLJif9fZVce3MZ13vft9fbGsVgssABxElyKBEGRi0MSKZKSTOowoYOU4viWFQW04qN2bcty3ThIrXQSJemRNrXJmcTNjNI2mTRNQ9e5HWfGaTIxWTfH1E3SNskfISepp+00bqedNlDf9xYAQcpuEhDcA8Du2337ju/4fb8vFMyMlg6Rw/QI4rK2feiWm7MXpGCIHHfwwO5QKJa5rYAjmiCV3w6X7ev/LVInJrn6GkVF5wHLRBE4E4gmUhCxnfedHpyYJ0IrGaHIx76wCzZ3PyFQgYahT1DAaWNBUtFg3BFZQ74cEQKnJZV9uIElXMPKU1oE/YFisMNIwQsKvoto22z4QVFhizza/wBPtHG8T8M8i5qacu38haQiTYZknNd1vfVtU1X+XlYKvIJ5vh+LX7R/KEoC0JxvPYcl8sx8zz/opmAuGOvopLjDlowaw1lH17PDRAFtm6hRI1+TPhw0ZfxNqZYnSmfIl7d79M5NonWCN8sPD3cxEOpOoTZqlA58oCn6/SSKfiM3NpaT5URr4zWulItls7uz4oIcMAVWilt4UUMbu2fH2ETrZ6hZcN+XG83liA60KNsJHoUMaVHs9Uv740UnCo0pgCeR/AOgpkbDxzo6Bxju/TGMy9NO4kcyes2ms7JSr9dpMAT4bzxE1zevkVfZcTbidaceX1taMtSmZjSblMK9tbnaqC/He3yaOvUiwUzWZgH2XMgf5ULxHqllF1t+go4K3qYFQMC97Qv9jGYoopTFAVaXjegsGw6usudOnDjH1g11BcwDEjtYHWQl1UAK2VFZ0HJV4/6Q7rp66Ey9fvpKOn3ldH2dkuaphgvmftdQmS285ia1NfYD43KHZRyC+4EBIUVqCFJ11cZyogCW3zEy2Lr06sto1Wk1nNxEPhGLJfITuda652RGEDOScepOmYhkmyjukc8VhfzG84byI4teZiQ/5N1r5zwv18uhCFbeuK9jYhpBWxE8oj/kBfIBmeSJlrm+1GjWyWNprdf7kgkPrSw1+/qcBmrMe+tgeNlT8p6dh6W3dV/PUZbfObCiFWiyKKKm1+xu4B45f87COUxT10W9LrXVFBK64p/o5lw/jzHwcUd9wnwiqaP1hCmFxMnJyCEzEY4YcoA/LLLOwao+4OiSQD2tmtFaD8fDZjy0OlgYyvM8i1E6m0sJAU0PR2Jh1vx5xGGJHHNXUA+RsyhSWLjfNRIFQ9Jy4CLOaWI0Arz6kfDhBG/zEstaPG8JUtGMmWY83KujQ+5lsPCAZcdHtFl536yy3lxebg7t3z/UbFImX6LlLjXqk2cmvV2HFw/vYnb6n/v+P/8zGLvfwO/81NobuZzXy+UeW0KFPA1S+fmyWxvvAMZhMBjIV3q8WFY7brxa8yi8nfQatBJ3pXu1v+KDXKJQqAyIz1p5O1k8UEzadnJyqK+kXZIGY+kSO7KatOPWF7iBSqGQUAKfC98rufFMsZghx18yRp3hyaRtpUYyqeJWG/wa6asxmuHPTyFGkTlE4vTAfGMRlRJ3A+meOLGndtvZX7ulfmNx5L0njr79qDtb63tPNJMZyWS8++64rVKrF4tH528+8vjherI6W0gXM5liuvusPoEe83OYUrLod3/ySP+930KXyOqebzLXj2FbGBLgiWmz4gCEXKDpYdvoQWCMoTTe15jGNWZpjYzpS8sNSHBCptzmChG7INLodfiizB0I4I1l1CBTOqB+nS2gb3dM/wJ6kWJ9aLYm38QHiTMByQOeY2qUJlM0blfVOKrllYQsa6GgpIdVFIo7CU1WHVEcvDWbMM3qkaOyUzlWLh9DH+x/yy4JS5om6URNCLKqqcmBgiRYejZx9EjVNJ93biyXb+yx/W6ir9I4yAWwkUNu0xJHZDKDx5ZIx5ApDhi9uS5lJx6APMIAWqhN8bVKlQaKGxzpfyUOPSOLTloWiZ6i2rZqhUMa6a4Xb+AUJ5MLu244l3HODJQHyPsHnV+aejSmm+Gg3v1l1nRdM5tx0L1GOiwaOKzJrCCw5PbDCpKUeTHgWAFOkriA5TzuwMkGFjq/lDhB4CQtGJE7vzTArG5YTi9XrkKxbrgCSFWYNbisH4JH7pj08339uwvCrYubyPFazX+fGz6OvMY80sPF2ePC8damt+v3kKO5nXb4FdLGcsBlQEc6MsS7PszDbjO9g4kSR4HuHT1EU61yD9gHR0YOxB7gIL/CAftBjnswSnMtZGR5wiEbzoQs05+SjTD5aJtcCFwo7exynk+Q20n70k5sBUgSxGAciiT7+vOlbNWJSIoSMIimaYQ0Q5RmZjImWud5BcwTT9x2aDgq84KkaEEzGk9lC7tKXrwnhsYvc88vUyqRCqgKWaGfUYIGCuT+RRfT5AXyx+fdvkG1KUdDTjgS/IUXuC6Sx2wn85Ks6Opqvr8vGQnrPXMhpihBpkblkZBne2be9tN9h1bK5aWlZPWO6gLZWFkrt9YgnL28Vka0X3T0uKXtfA01wETCyEHGCpgW3LZ61ERMa9UjR5NRYoW81tbiK/S11Cay6fhY1tt4GDK/dOIufTSMSXOX45U10K5g8fyK02jsCHek1L0bzW6//TZ6nNosimC9A32Y2ifG/HwC2/c5PytVbsDFKbRqpbAWDMZNnPoLsqkHgk4Y99UOP2LnzHOXzpk5+xH0OMRtc6yg0QQJ3c3WRxZvUPfMze1Rb1hktuLt6j5eBmVtL+si5xrTnEdME9UhC/MWD6hG7t0hsuQQ1Yl7GdMKNmlNRFrAFGTZJZ0AUwUuIdut1mxjO1X+qwNx9awxhtSzanwgPfaUDzD8vL/3T+0ve0AF/+h/c9L/Ztn3C0X8vWn/O6Y37kZjksxuyK+6bQY3aZwJzrngqoGomFzeDz2hjkH4KIV8hbaEqDGRqliI2XKrDLIav+uOosYLwvjSqBhFiOV1sfS2iqCznL7vsbLAs7uPHPIkncfSxNHFKlE3VHLnW96U73I8a6u6IsgooDnqqMjxCS3IYsGQw4E0r1eSokB2gwYXEsUsFxSDvXGRMmVqI0o2rtmQMzqNIHqq5pLxor58oW9lpe/Ccn3y0VPRS5eipx5FG8vmox+bn//Yo+bZS4FbL09OXr41sM2fIZP1652j50hme/mB68u/ruzryu2WuYQ2YPyDgGmfW8Emcw8djsA5RpPb+sGzzY1YOh27CZHZABuYTAlvJvvo6gF0UHDjenxAOHhQTqSseNxKJeSDB4UB8qHbnZ8pxjgDyHaTUpO0GUq2rfYjN0vUPNuPOvDHwAimnWzHBnYCpYCzY1FvER2n2WjqWoDHmO8bTfWsEjpiVNXMZMydS8h/nvnvZnOVlRVRDhCVxrK6a8Uga5PtznPALAXcqFkM+b/JI5qGCof8VPX19Y8Ui1L/mG2P9RNBdn39PGxJwyUp2+ufBD4q0GhrgocLOD8NilbErnkBMhdMsW7FRcm/bG14q8h55tjMC+dXB35wZOq5wfHKYhEJiFknL6f0/mK9fvzAxdJv9wfM+tLeOuePCazexrF3cQaFHuuKANw4vkmb/kP8LLr7jjuKd97ZepHVWk8/SV/oSOu7yP3M7aXbyfu30EutCvr4uSz5Q3e3nn6jcswt6GeFI+Vw5NxmT1lXaTF/y2ovwsmvXqYv9IxfSOuP/FJaT6O7aUlMx6epd/Py5WmkYq3i2jXLBVBDIV+hhAi4za1vV/wF1/XsYPtqNns1k3nx56+hVy+LzpMJ8cknw4EnY9LlPzx52l08OXhywV04iVAGZ7OZuey/wFUcdHCiVEpgB909GQ5MTMSk4dbayUV38ZR7cmFw4WR3Lnuduu5UNOC423Vda/8DjyI6d6z/GHm3PuxX9lXyvnyZ3PhL/3PsWO7YsavtuoZXevONyzE7FU1Kg7ouANEfYG5BCidlfdwv5uOklM/RUuh5XyL1fSstp/VZeqOkFCRups91sAedcvJg9doiEoY7cfOu75vP+rYKTARy9NcnT5HacxdOu6dPts6yWkbLjpQyRqvyTObLz2c/hF76PlTvqQH4waknoMir8GzbD3grN19n/n69SGgPN3oS2aL+awyR/HdSFvgggGYvNo6HvGzIs5DbRfUjZ/Uas4rm/UBntA57DR+gD4cp7fH0Web1eCwpd+UWw0+W4pp6GX86fJUwU6O11eYyIOfja2hto0FEmaVVb7WBVsHj3IToIZrdse60Xz0cnB32P1obvuW4G2sP8F4/dsTyGpThxnKaQP6BRgF061B87+YmWqW5QppNuvIcL16OM1v8optML6YXemqe8lRQ+1LFz1JJlHJvjb4o5eZa69m4nx+XeUPeLdQmL+itE6DWo2FINLPG0vIKWllvEJHLN29Tsl/for2lQ1Dew1rOHSsh6kZspzkeo7ZICwL9DES6mfd5Dqsyx9m2VlcNjxcl/NOqdFzkDaRC3kw+oipzVtBQg1dlLG9ID6uSsrzRLueb6G8oVzdEooylECWtAm92hPJVg+uPaC9EciKPE831lhN3egpq/QcA+7olWW863VvSFiZjkwmSeyozpyh+HVcofxAu1KJTRCusQQZ2opzSFOxpSHdadW24JAOBQdknyjajnp2tULtQxcO2P0f72WLsqECd8nYbjcAyTmQgELac1hOO6RrhiIO4vKBpX9FiQp5Xta+IghL69AsS5vJcAL8giWyeVURuVQ+hFhDIWAl8VNFNfV03LaG1oeHoN1RpHWvo9qMIEwUSH3nPESk86OKjrR+fJeecI+c+q8f4OVZdn+MMfBfGHFlLZwXc+rpSnycC4fFIgguqDd009REpFGlI6pExSVUZzccksAy1rk0SufAYqaMLzGPMO5h3Me+HDMOICNrbasuuQqhXClXdqJ0nX9ljUbBY1+xodZQdENMsBnbHUVJrmIi3JXB7TIP67Vo2iDKAcNlWlX5iajKliBGPTOJubXwggPJVXIaDa9TBDZioaSC8qgG1/vX1+5+Bwol6H/n3ckEkqkTU5Fk9wiocy8WiPMdLyKU7feHSWayjsPZgVRM4PlQYQsGArpypCImtur8vMXlm8k8LLKcYkZzKIz4mChGpGEveU+REpRS3kryOLib6AgENXTyCw4MD+OiVw7CWjv5wsJ7sP0n+P6KlWVEPBlUcSl7gkISwjESWHxq/wGEkG3g6bDRN7+whIyDbpczxBVbkpZvNkDV/IxkJj1tunwsgrRkdiWhw8jw5Hkn7zPAldWQ6KAUi2T3OkHZKE/jbT53osdP7/D1EDiUaf0XEFbGQtYjqWq2R0eSOM7ehQGsF8u989p7n7Oqx6k+ei9fqnsUI0AbomGuTUW+IuZHaS3zrJ6aRpltYEwvna/ZOd1pHtEkh0i3y5CkRnYw844FpEBRJLybKj0caCHJcLYrto/uHzSOUd2Q1mnqo7Dy0SrfJ4uWFvlMZLqQH8xKRsYKjlrU7RDbkfEgPsdMRsYpNhOqKNLvqNfwjrMaN4+0tGGyTtVoylA9gmY/JIU0LKXHSrwL9wbFwOh1GW3YhP38qxcWjnuwAYFLHHo1Jz3L+/bnIq2tGazWg1PlCqXCuztux6D3IsYPKZ+UAi1YMzXHUAFyAahhvbv1cNnSlq289T8qR20wTjIlDEHjp1SqkdQN/Lp1CwN8wG14olW78/fzM0p4TqDTT37/U34/WD7W+tWvXu1793oTnvXbo/PnzbT3hQ+ScSZBycvtRO+d2Bzxo0yzclRJC569IH7CyWesD2ZFUKrXvSjTDZp9R6umRdNVOp+1/rmaybNay0+1z/hh9nuYMaDt3wBMDCIASaq/2k+5fQjSVeFsHt6s1EVfRj81kOrNvZuH4QV054KV2y7Kk6dmhSNS09fxb93E1N9KvZxJqKoF+py+izUzOFIaG0CDqTyJOLOeQivRd49FimVUVtxY0cDAX5np4nCLQDinrrg+HtDqub+8XGax77dUWZCjazmO+lawHxqZ2PqYA3aCggTEfPADADtB+0MbUhScuTNHFhs9IslxMjxeL4+liysr1KZqAsVIwg+FIwMJKSFZTOSuFmOn2MVMX/tcnjHwMCzQImRcCMsZCbcrdw/E35PL9g/E8x7+tUibn6eHA+xh6npEoPvRXvWDml7/KL/0ql7aFl++jviDfGJ9vp5z1x4VuhmPb7c12STGrHoRedLJwBtQVRdHIdWqKghwaWUFDLwLqKuW9UQPP1gRTBSJD1RRqW/UCY1WIcm7BzBztEGPgPPBTe5RsCcxB0Fpq3gekqcFkKThszw0W58dx5eZbXrhlQpnc9hlyBrxY1EumB+eGl5a8JXc8Fh3ry5C9bpmvoj/3ywQ3hw0oRz9altyjmSM9BbCOPvUOWHSEkflxsXrLLZPy1GBid3A4PtdXrO/4BH1i8PBwo+GOx63xvkzrz3r3tu51hXKlGDRyFuCUHTP8OjjLl8uoXF4BgG4ZoLq9MWMgEQL7yYHrueRciGmnkm1HNezh++jYwl3KZk7NvtXadlnfoWjmryFN0kBw1qTWa5Kmfd/PJrMUMcJkCgsb7eQqncPimpSZL89nwH4PR6742X0fTYnxIAyfwbjIbOnnKzTGIANZddpBJBQuXwu5eAcglFxZE1STphpYXlqKb0E1UNP3Nj8C7g4PMqWqyzSurjdHt+lza/aesGaHoK12ZxWi6qx2MnGnzjyEmIe2tUOIVr+uhgsVG22krBY9B6pbqdYmZNmDvWuwHF3rxtX/hFwHsCdVGGCpoeZnPzcjRQvUgIii3fntHJBSiF0nZHnABToN9J1d75w9vG84JwR3zUxd2bcrwuu8JP2dnDDNhIknLmRHj8ad0b27+wL60dHsBaTv24vxULaqRvb1JbTBTEqwBFWbkU044At7xw/GUm5yLOmM9nFmvxE7OL53e2xv8PrY3lo+jboOnR7j5Bl5Xt4jh/tNM99r5Py3j370TXI6HE6He2UXwIWADuOLE6EsUYRq21AiXn0DxR0H8mHHEcRdtJqbNC+208MZDOcJv4HuZvco1O3H4dEo8X+dAdZj/43WKY4XNDey+l7n4/jMDNMbH4D99olcM2+6BaFL9wqmXeo6pvBScFd8WfM0MiKD/uW3SPV3k6KujJ2KxU6NKbqYRMx8axP1B5aWHKxKkopX9g6U2N2uu5stDfTmhghQK/Pw6/TocWgJVNraomKjzj/gXO7tu+vDJzKZE2+CxR2+rdgDAoS1FcRAv6GX+Mpgf2FwsNA/OE95TFOfcRzQXfV2m+/lPfRjf/Yy+8k4c4w5/jq8lURV7rAgUibEzkwGiiTIlu62D3b+ghILNenFN4HcEtVbq04dkBWt74oYaqvYaCw3my90d1Z7v2mgOh2DVsFsMbVU92Otm34tO06zLikSeTvA0y8B0Fvq+tL+Af2EtHXIIUw1EIuMmbXqOK65RJD9VL8k3U8eWagkWVeu9F8Jox/1Y0u6/79QsyT96D2FK9Wtdv0yepm0xxnauylOiegwIFURVYrmeWx7mSjR5XgUlKMIpgRHbXoqGAVonAT6ZOqu++4c51JCZF4qVybHR8e4xWCc19Rw3/SQxUckrAtExTBY4O7lOTYQicdkng3zAr8LeHHvJwfsu+u+UVyPCMk0OdkH4xxiOTU1FXfTFiY6dpYXWSwqLOaJKqsIWAjziLUENgA6wrVrRE9EpE4OMHVmkbl5h0wluHBLeSI8uv6kPOADTMm1+4ghdxwUaaLagXg5NiBGvTS7uwKoTJo4AgGgqJam37LM7MUrF2dnH3nvxdnW125KibwoWnEjkH7rRPFkOqAbAi8LRliWj8tYEHlBjMYC0QFR4EU7+3Vwkyb2l1/ZN2d+52Aunybda5ac6+J7HyGLG37KIkNHLBrdk0myimapmhTEMdeuJexXWJZog0QE4lAwyN6kISuUdscnpt+WkpIPHBofeueqJm/ZHeHxAhaiztzE3M68ZUdt7EwINl6FqhlGb1w1/i9yo2QmgpqhiFWX9ISCCRXTrZdH3kduAxbXeqRL7XhCILVgRnWj75aKeyShq7rIyZwWlKRZDD4CnnzpRE2R54Ro3wOHeIE0klit9am7vOmXJ1IZJ4GYufaJZx9BxS1xt/XMt1hdQ2hoPBlHsmIqmhTgonlrLBZ5gWUNA0RGsjz+pU/roXA8Xrz/zp+2fuacnyyd+GNV6vSBT1P8WIGMyRTeFvEA0AqT7TRbpWg4sPnYkIIA7AZf4owJ0n53zXCcwO1ThZlvcBwrwsYBdJqV+QkB8wvoQUUSZu/nRUF5YIXDnPLrD/ErAmkMT22LzTV3IlXyfrRBzxx1JLeYO3g5t80J98WHM1NPx5iOb+bD6Ema69bGcDj6zdwH4Rj0ZOyVhzP7u+X9CUWfQsQTOMpyFIIcafficT+djEDkgq9KyUpipP/USS1CpunOTlKSrjHvQpeSkgBJW/iItv/i/vaOlNw7PfFuyDXwfwVB8YUAAHicY2BkYGAA4lWM4ubx/DZfGbiZGEDgtpnQKRj9/9f//0y8TCCVHAxgaQAQawqVAHicY2BkYGBiAAI9Job/v/5/ZuJlYGRAAYwhAF9SBIQAeJxjYGBgYBrFo3gUD0H8/z8Zen4NvLtpHR7khAt1wh4A/0IMmAAAAAAAAAAAUABwAI4A5AEwAVQBsgIAAk4CgAKWAtIDDgNuBAAEqgVSBcgF/AZABqAHIgc+B1IHeAeSB6oHwgfmCAIIigjICOII+AkKCRgJLglACUwJYAlwCXwJkgmkCbAJvAoKClYKnArGC2oLoAu8C+wMDgxkDRINpA5ADqQPGA9mD5wQZhDGEQwRbBG2EfoScBKgEywTohP4FCYUSBSgFSAVYBV2FcwV5BYwFlAWyhcIFzwXbheaGEIYdBi8GNAY4hj0GQgZFhk2GU4ZZhl2GeIaQhqyGyIbjhv6HGIczh0sHWQdkh2uHf4eJh5SHngemB64HtgfCB8cHzgfZh+eH9AgGCBQIHQgjCCsIQohQiHSIkwihCK2IvgjRCOGI8Ij+iRqJOglFCUsJWoljiX6JmgmlCbcJxInPid+J6wn9ChQKIoozCjsKQ4pLiliKZwpwCnoKkQqbCqcKtIrQiuiK+YsPix6LM4tAC0yLZAtxi34LnAuoC62LuAvTC+ML9gwTDC0MNoxDDE0MVwxjDG+MfQyQjKCMrAy7jMaM1oznDPYNGA0ljS8NM41GDVONbQ16DYiNmQ2kjbmNyQ3SDdeN6A33Dg6OHI4ojkcOTY5UDlqOYQ5yDniOfA6bjroOww7fjvmPAA8GjwyPJg8/D1OPbY+ID6APtw/KD9mP8A/6D/+QBRAckDYQQRBQEGEQdhCGEJEQrpC3EMOQ1pDkEOiQ9BD7kQ0RKxE1EUKRURFnkXARehGEEZURmZGvEcoR1BHaEeKR75IIEhASHBIpEjYSSZJWkmOSchJ8koQSk5KgEqkSs5LAks4S8hMrEzKTUBNdE2eTchOEk40TpRO4E8gT1pPlk+wUBBQQlBkUIZQ3FEKUS5RYFGaUd5SUlJ2UtxTYlP4VDJUWFRqVKAAAHicY2BkYGAMYZjCIMgAAkxAzAWEDAz/wXwGACE9AhEAeJxtkE1OwzAQhV/6h2glVIGExM5iwQaR/iy66AHafRfZp6nTpEriyHEr9QKcgDNwBk7AkjNwFF7CKAuoR7K/efPGIxvAGJ/wUC8P181erw6umP1ylzQW7pEfhPsY4VF4QP1FeIhnLIRHuEPIG7xefdstnHAHN3gV7lJ/E+6R34X7uMeH8ID6l/AQAb6FR3jyFruwStLIFNVG749ZaNu8hUDbKjWFmvnTVlvrQtvQ6Z3anlV12s+di1VsTa5WpnA6y4wqrTnoyPmJc+VyMolF9yOTY8d3VUiQIoJBQd5AY48jMlbshfp/JWCH5Zk2ucIMPqYXfGv6isYb8gc1HQpbnLlXOHHmnKpDzDymxyAnrZre2p0xDJWyqR2oRNR9Tqi7SiwxYcR//H4zPf8B3ldh6nicbVcFdOO4Fu1Vw1Camd2dZeYsdJaZmeEzKbaSaCtbXktum/3MzMzMzMzMzMzMzP9JtpN0zu85je99kp+fpEeaY3P5X3Xu//7hJjDMo4IqaqijgSZaaKODLhawiCUsYwXbsB07sAf2xF7Yib2xD/bFftgfB+BAHISDcQgOxWE4HEfgSByFo3EMjkUPx+F4nIATsYpdOAkn4xScitNwOs7AmTgLZ+McnIvzcD4uwIW4CBfjElyKy3A5rsCVuApX4xpci+twPW7AjWTlzbgdbo874I64E+6Mu+CuuBvujnuAo48AIQQGGGIEiVuwBoUIMTQS3IoUBhYZ1rGBTYxxG+6Je+HeuA/ui/vh/ngAHogH4cF4CB6Kh+HheAQeiUfh0XgMHovH4fF4Ap6IJ+HJeAqeiqfh6XgGnoln4dl4Dp6L5+H5eAFeiBfhxXgJXoqX4eV4BV6JV+HVeA1ei9fh9XgD3og34c14C96Kt+HteAfeiXfh3XgP3ov34f34AD6ID+HD+Ag+io/h4/gEPolP4dP4DD6Lz+Hz+AK+iC/hy/gKvoqv4ev4Br6Jb+Hb+A6+i+/h+/gBfogf4cf4CX6Kn+Hn+AV+iV/h1/gNfovf4ff4A/6IP+HP+Av+ir/h7/gH/ol/4d/4D/7L5hgYY/OswqqsxuqswZqsxdqsw7psgS2yJbbMVtg2tp3tYHuwPdlebCfbm+3D9mX7sf3ZAexAdhA7mB3CDmWHscPZEexIdhQ7mh3DjmU9dhw7np3ATmSrbBc7iZ3MTmGnstPY6ewMdiY7i53NzmHnsvPY+ewCdiG7iF3MLmGXssvY5ewKdiW7il3NrmHXsuvY9ewGdiO7id08t8TDSMY9niSCpzwOxEIuCLRSPDFTGkUitqaYHmTG6kjeJtJuLhiKWKQyaOVspCPRzqGS8ZopcCRCyRcLnCkrjbSiUBALu6HTtUJBwoflQKKyoYxNOaCNLUwywloZD01JSVePK7u4la7uxne1prwwy2qtShMzI1LT4DJNFI9Flat+FnW4kkNaM61fpEs5GWRK9TZkaEetXKDEwBYw1rFYzGHiprmhpRmeyuHItnOBx8V7pE7UeMRv03GTx1yNrQxMnafBSK7TOaSp3uiFeiPOV7mFrramvJjpvjozs6TlTMeLIW+DG1vaja+2ZwSdHGeJG+nOktWVCQuzRMmAW9EoRfM8tTW+wdPQ1Po8WMuSSp/Ha5W+ECn9KNXtKx2s9UIx4OQSjb7Wa05pxYGVfhaGMtCx6fHAynVpx3tMRf1+kgpjekoP9c4ZMaHxdGTbdMQ5cRaTkqWpbKDTLDLLM4JUijg0M1OGqc4S05kKkmhmfipoyWJ2vtUJHdyM7TalhZOrNvqZVCGBdj8zMiYLIx4vlDghz9Nxt6QbmgZr/cxaHbcCroJMcavTDkGyj6dukxoloQmRSLmT1XI4H/CUIJ2CrdDDTbViqNNxKxgR7fFU8GYO++59jyhYRSFMJCElk76mo6sG7oza9JuFPcPXRdjJMR235n44CxcCHYqesdwZRKcd6MFAiA4lEp2SumBNpHUiWRSbLm2LTSnqes4lliaMDsN5ysJEkHAKyOlsCsrx4oTRzgtulyfcrJG5pG/7Fkmhc2UiXHc2CDJueXdR3A70ukh7MqL00wy5GfnVd0JueZ8byh9huDghYjPRqZ1yGW3lqYhIW3fC16XYaJSsHgqzRo5SD6WJpDENF7luL5uh80eK/LUWZUs6Ep6SLR66pFhxaMX9aOcBlDaKtDQrcrG9PCvIM04h6WsVdkpMXrC2oyD+/CYRvDiRxs5/Jwrz1O+cpFtIaCPozEv1I6GSckTGIVm3PGGUXG2kUzEZt2ResFCwW0izHIzL1a1JG4xETNGQbwWJlJ18VFMetao5YaUSnVn3zXI/Eipqw5Qno+WJwFAhsGLTbpVQ8Znsyq2ZtmLPguTHSF4UcV9vSlvo66UGCl2lyFZyvVJiU7km7Igyx3BUqqWTV6I0zFngQ6NcQqbKoYx2LXWh2J0IXBUt1axTmdAN+qJMjDRNEXGpXOC3Jmi16mFbRH0R9ngWSt3NcVGmi5FkpK1uFZgKayH2H+iIzUCkifVuWxGb0jbIYpFSXeoMeCDKPN0oSYOCPXThVxtIRRMrA8WHlYHWYSffvB43pHhCnFXtgpA32YUCD7lSIh2X83wslsQfTLcglGlsZsohb3TVEbPgirMJUiF8bdw2Q906nKw6pCRpakOth0o0h6kM/TpreaqvjTh1O2l9JLjL1lV6UhEbyZA8qznSWTpU3JjKyEaqRm+SPibDlre0F6Q66eQw34cdBaHjor4olVTdyeu3zUgp5VC8c7WcyyhjU/j5Ar2yRZKX4VlR/k3jLGhP4WrLxd1mL3C5S8YD7YLC+VPFkU4ehj0+IOO6Bek7Bxe1nDXpYV3URDVqASlJ0WNMKprOJG9EU7nffqb6DeeZ5JgxiUzuLB2qFdxK7Te/UZKFvMqX2aUW8ZQKQte3hL2ix2kXzLlGK8cuJxWTig5hoWA6yFxHupxT6ZKg7xFEITHUAvDQjISwhS4XcsUnvLc0IzGkzEDdWoM0Zc7cZglWJ2hXxaFWJN3Jusn1SNLeWFGlfjEzzYhEY+9THlVctqjH5F60ha2iqyUnqsXaO0qs2zohTxxQFhZpI+EqsuSazYRT/XcFdz4JB23C3q8pu1cSYU3Vf7mZ+GUKaoFdJfQ77jdrSv3CFoueuedzkggbxL1nNEuwWnGommh6uenKFplD4eiSQBFXTd9B2ZE09ST1n3XPdR6MG0mqwyywpkn3hdDfAmqpoF7HVuiha3nCbDgz6Voh51Njqr5naBiyJ8yU6ObRqBPnGKZmhDv/pqGS4lv01gStVj0kgRTKB1othzSZjHbOUTOKlmxa1Eql1u9SjQqqooMwNGPeaFM3iXZ1pUULo2IVJXbc9pDiUwlS5fCIq0HNl91xleoblSiT0SGMROqPrTlhiz6Lu+tRHkFLU54H0YwgFEpQIc0Frh2efcPxLW/4/t2/UfMCO08e1KB/3121Le2nJBeTXDWdJ+ftgPdpO8qivvHNf7PAWdJ2iyHXcebXC1yxtFdtKuexUT4qq4TNqGY3XK1tuwcZmL+R4woVI72dmmZKUobTmoPANdbusrC7sEZlimK8lSUhz+9atRzWii5x3YVv03uoP+YJWp3CXQSN7EtFXXqd+raYQmdpQyhq3X375Vc9EZS30pVSoMiV6G5Jm7pcilxK8re9HaWE7llDtzEurqevbqTuhkiXkWFjg8qRoRtx1zUF+U3C+cCEVTbJqvo4z7bz9Ky79Jj1xdzc/wARDj0u") format("woff"),url("../fonts/dashicons.ttf?99ac726223c749443b642ce33df8b800") format("truetype");font-weight:400;font-style:normal}.dashicons,.dashicons-before:before{font-family:dashicons;display:inline-block;line-height:1;font-weight:400;font-style:normal;speak:never;text-decoration:inherit;text-transform:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:20px;height:20px;font-size:20px;vertical-align:top;text-align:center;transition:color .1s ease-in}.dashicons-admin-appearance:before{content:"\f100"}.dashicons-admin-collapse:before{content:"\f148"}.dashicons-admin-comments:before{content:"\f101"}.dashicons-admin-customizer:before{content:"\f540"}.dashicons-admin-generic:before{content:"\f111"}.dashicons-admin-home:before{content:"\f102"}.dashicons-admin-links:before{content:"\f103"}.dashicons-admin-media:before{content:"\f104"}.dashicons-admin-multisite:before{content:"\f541"}.dashicons-admin-network:before{content:"\f112"}.dashicons-admin-page:before{content:"\f105"}.dashicons-admin-plugins:before{content:"\f106"}.dashicons-admin-post:before{content:"\f109"}.dashicons-admin-settings:before{content:"\f108"}.dashicons-admin-site-alt:before{content:"\f11d"}.dashicons-admin-site-alt2:before{content:"\f11e"}.dashicons-admin-site-alt3:before{content:"\f11f"}.dashicons-admin-site:before{content:"\f319"}.dashicons-admin-tools:before{content:"\f107"}.dashicons-admin-users:before{content:"\f110"}.dashicons-airplane:before{content:"\f15f"}.dashicons-album:before{content:"\f514"}.dashicons-align-center:before{content:"\f134"}.dashicons-align-full-width:before{content:"\f114"}.dashicons-align-left:before{content:"\f135"}.dashicons-align-none:before{content:"\f138"}.dashicons-align-pull-left:before{content:"\f10a"}.dashicons-align-pull-right:before{content:"\f10b"}.dashicons-align-right:before{content:"\f136"}.dashicons-align-wide:before{content:"\f11b"}.dashicons-amazon:before{content:"\f162"}.dashicons-analytics:before{content:"\f183"}.dashicons-archive:before{content:"\f480"}.dashicons-arrow-down-alt:before{content:"\f346"}.dashicons-arrow-down-alt2:before{content:"\f347"}.dashicons-arrow-down:before{content:"\f140"}.dashicons-arrow-left-alt:before{content:"\f340"}.dashicons-arrow-left-alt2:before{content:"\f341"}.dashicons-arrow-left:before{content:"\f141"}.dashicons-arrow-right-alt:before{content:"\f344"}.dashicons-arrow-right-alt2:before{content:"\f345"}.dashicons-arrow-right:before{content:"\f139"}.dashicons-arrow-up-alt:before{content:"\f342"}.dashicons-arrow-up-alt2:before{content:"\f343"}.dashicons-arrow-up-duplicate:before{content:"\f143"}.dashicons-arrow-up:before{content:"\f142"}.dashicons-art:before{content:"\f309"}.dashicons-awards:before{content:"\f313"}.dashicons-backup:before{content:"\f321"}.dashicons-bank:before{content:"\f16a"}.dashicons-beer:before{content:"\f16c"}.dashicons-bell:before{content:"\f16d"}.dashicons-block-default:before{content:"\f12b"}.dashicons-book-alt:before{content:"\f331"}.dashicons-book:before{content:"\f330"}.dashicons-buddicons-activity:before{content:"\f452"}.dashicons-buddicons-bbpress-logo:before{content:"\f477"}.dashicons-buddicons-buddypress-logo:before{content:"\f448"}.dashicons-buddicons-community:before{content:"\f453"}.dashicons-buddicons-forums:before{content:"\f449"}.dashicons-buddicons-friends:before{content:"\f454"}.dashicons-buddicons-groups:before{content:"\f456"}.dashicons-buddicons-pm:before{content:"\f457"}.dashicons-buddicons-replies:before{content:"\f451"}.dashicons-buddicons-topics:before{content:"\f450"}.dashicons-buddicons-tracking:before{content:"\f455"}.dashicons-building:before{content:"\f512"}.dashicons-businessman:before{content:"\f338"}.dashicons-businessperson:before{content:"\f12e"}.dashicons-businesswoman:before{content:"\f12f"}.dashicons-button:before{content:"\f11a"}.dashicons-calculator:before{content:"\f16e"}.dashicons-calendar-alt:before{content:"\f508"}.dashicons-calendar:before{content:"\f145"}.dashicons-camera-alt:before{content:"\f129"}.dashicons-camera:before{content:"\f306"}.dashicons-car:before{content:"\f16b"}.dashicons-carrot:before{content:"\f511"}.dashicons-cart:before{content:"\f174"}.dashicons-category:before{content:"\f318"}.dashicons-chart-area:before{content:"\f239"}.dashicons-chart-bar:before{content:"\f185"}.dashicons-chart-line:before{content:"\f238"}.dashicons-chart-pie:before{content:"\f184"}.dashicons-clipboard:before{content:"\f481"}.dashicons-clock:before{content:"\f469"}.dashicons-cloud-saved:before{content:"\f137"}.dashicons-cloud-upload:before{content:"\f13b"}.dashicons-cloud:before{content:"\f176"}.dashicons-code-standards:before{content:"\f13a"}.dashicons-coffee:before{content:"\f16f"}.dashicons-color-picker:before{content:"\f131"}.dashicons-columns:before{content:"\f13c"}.dashicons-controls-back:before{content:"\f518"}.dashicons-controls-forward:before{content:"\f519"}.dashicons-controls-pause:before{content:"\f523"}.dashicons-controls-play:before{content:"\f522"}.dashicons-controls-repeat:before{content:"\f515"}.dashicons-controls-skipback:before{content:"\f516"}.dashicons-controls-skipforward:before{content:"\f517"}.dashicons-controls-volumeoff:before{content:"\f520"}.dashicons-controls-volumeon:before{content:"\f521"}.dashicons-cover-image:before{content:"\f13d"}.dashicons-dashboard:before{content:"\f226"}.dashicons-database-add:before{content:"\f170"}.dashicons-database-export:before{content:"\f17a"}.dashicons-database-import:before{content:"\f17b"}.dashicons-database-remove:before{content:"\f17c"}.dashicons-database-view:before{content:"\f17d"}.dashicons-database:before{content:"\f17e"}.dashicons-desktop:before{content:"\f472"}.dashicons-dismiss:before{content:"\f153"}.dashicons-download:before{content:"\f316"}.dashicons-drumstick:before{content:"\f17f"}.dashicons-edit-large:before{content:"\f327"}.dashicons-edit-page:before{content:"\f186"}.dashicons-edit:before{content:"\f464"}.dashicons-editor-aligncenter:before{content:"\f207"}.dashicons-editor-alignleft:before{content:"\f206"}.dashicons-editor-alignright:before{content:"\f208"}.dashicons-editor-bold:before{content:"\f200"}.dashicons-editor-break:before{content:"\f474"}.dashicons-editor-code-duplicate:before{content:"\f494"}.dashicons-editor-code:before{content:"\f475"}.dashicons-editor-contract:before{content:"\f506"}.dashicons-editor-customchar:before{content:"\f220"}.dashicons-editor-expand:before{content:"\f211"}.dashicons-editor-help:before{content:"\f223"}.dashicons-editor-indent:before{content:"\f222"}.dashicons-editor-insertmore:before{content:"\f209"}.dashicons-editor-italic:before{content:"\f201"}.dashicons-editor-justify:before{content:"\f214"}.dashicons-editor-kitchensink:before{content:"\f212"}.dashicons-editor-ltr:before{content:"\f10c"}.dashicons-editor-ol-rtl:before{content:"\f12c"}.dashicons-editor-ol:before{content:"\f204"}.dashicons-editor-outdent:before{content:"\f221"}.dashicons-editor-paragraph:before{content:"\f476"}.dashicons-editor-paste-text:before{content:"\f217"}.dashicons-editor-paste-word:before{content:"\f216"}.dashicons-editor-quote:before{content:"\f205"}.dashicons-editor-removeformatting:before{content:"\f218"}.dashicons-editor-rtl:before{content:"\f320"}.dashicons-editor-spellcheck:before{content:"\f210"}.dashicons-editor-strikethrough:before{content:"\f224"}.dashicons-editor-table:before{content:"\f535"}.dashicons-editor-textcolor:before{content:"\f215"}.dashicons-editor-ul:before{content:"\f203"}.dashicons-editor-underline:before{content:"\f213"}.dashicons-editor-unlink:before{content:"\f225"}.dashicons-editor-video:before{content:"\f219"}.dashicons-ellipsis:before{content:"\f11c"}.dashicons-email-alt:before{content:"\f466"}.dashicons-email-alt2:before{content:"\f467"}.dashicons-email:before{content:"\f465"}.dashicons-embed-audio:before{content:"\f13e"}.dashicons-embed-generic:before{content:"\f13f"}.dashicons-embed-photo:before{content:"\f144"}.dashicons-embed-post:before{content:"\f146"}.dashicons-embed-video:before{content:"\f149"}.dashicons-excerpt-view:before{content:"\f164"}.dashicons-exit:before{content:"\f14a"}.dashicons-external:before{content:"\f504"}.dashicons-facebook-alt:before{content:"\f305"}.dashicons-facebook:before{content:"\f304"}.dashicons-feedback:before{content:"\f175"}.dashicons-filter:before{content:"\f536"}.dashicons-flag:before{content:"\f227"}.dashicons-food:before{content:"\f187"}.dashicons-format-aside:before{content:"\f123"}.dashicons-format-audio:before{content:"\f127"}.dashicons-format-chat:before{content:"\f125"}.dashicons-format-gallery:before{content:"\f161"}.dashicons-format-image:before{content:"\f128"}.dashicons-format-quote:before{content:"\f122"}.dashicons-format-status:before{content:"\f130"}.dashicons-format-video:before{content:"\f126"}.dashicons-forms:before{content:"\f314"}.dashicons-fullscreen-alt:before{content:"\f188"}.dashicons-fullscreen-exit-alt:before{content:"\f189"}.dashicons-games:before{content:"\f18a"}.dashicons-google:before{content:"\f18b"}.dashicons-googleplus:before{content:"\f462"}.dashicons-grid-view:before{content:"\f509"}.dashicons-groups:before{content:"\f307"}.dashicons-hammer:before{content:"\f308"}.dashicons-heading:before{content:"\f10e"}.dashicons-heart:before{content:"\f487"}.dashicons-hidden:before{content:"\f530"}.dashicons-hourglass:before{content:"\f18c"}.dashicons-html:before{content:"\f14b"}.dashicons-id-alt:before{content:"\f337"}.dashicons-id:before{content:"\f336"}.dashicons-image-crop:before{content:"\f165"}.dashicons-image-filter:before{content:"\f533"}.dashicons-image-flip-horizontal:before{content:"\f169"}.dashicons-image-flip-vertical:before{content:"\f168"}.dashicons-image-rotate-left:before{content:"\f166"}.dashicons-image-rotate-right:before{content:"\f167"}.dashicons-image-rotate:before{content:"\f531"}.dashicons-images-alt:before{content:"\f232"}.dashicons-images-alt2:before{content:"\f233"}.dashicons-index-card:before{content:"\f510"}.dashicons-info-outline:before{content:"\f14c"}.dashicons-info:before{content:"\f348"}.dashicons-insert-after:before{content:"\f14d"}.dashicons-insert-before:before{content:"\f14e"}.dashicons-insert:before{content:"\f10f"}.dashicons-instagram:before{content:"\f12d"}.dashicons-laptop:before{content:"\f547"}.dashicons-layout:before{content:"\f538"}.dashicons-leftright:before{content:"\f229"}.dashicons-lightbulb:before{content:"\f339"}.dashicons-linkedin:before{content:"\f18d"}.dashicons-list-view:before{content:"\f163"}.dashicons-location-alt:before{content:"\f231"}.dashicons-location:before{content:"\f230"}.dashicons-lock-duplicate:before{content:"\f315"}.dashicons-lock:before{content:"\f160"}.dashicons-marker:before{content:"\f159"}.dashicons-media-archive:before{content:"\f501"}.dashicons-media-audio:before{content:"\f500"}.dashicons-media-code:before{content:"\f499"}.dashicons-media-default:before{content:"\f498"}.dashicons-media-document:before{content:"\f497"}.dashicons-media-interactive:before{content:"\f496"}.dashicons-media-spreadsheet:before{content:"\f495"}.dashicons-media-text:before{content:"\f491"}.dashicons-media-video:before{content:"\f490"}.dashicons-megaphone:before{content:"\f488"}.dashicons-menu-alt:before{content:"\f228"}.dashicons-menu-alt2:before{content:"\f329"}.dashicons-menu-alt3:before{content:"\f349"}.dashicons-menu:before{content:"\f333"}.dashicons-microphone:before{content:"\f482"}.dashicons-migrate:before{content:"\f310"}.dashicons-minus:before{content:"\f460"}.dashicons-money-alt:before{content:"\f18e"}.dashicons-money:before{content:"\f526"}.dashicons-move:before{content:"\f545"}.dashicons-nametag:before{content:"\f484"}.dashicons-networking:before{content:"\f325"}.dashicons-no-alt:before{content:"\f335"}.dashicons-no:before{content:"\f158"}.dashicons-open-folder:before{content:"\f18f"}.dashicons-palmtree:before{content:"\f527"}.dashicons-paperclip:before{content:"\f546"}.dashicons-pdf:before{content:"\f190"}.dashicons-performance:before{content:"\f311"}.dashicons-pets:before{content:"\f191"}.dashicons-phone:before{content:"\f525"}.dashicons-pinterest:before{content:"\f192"}.dashicons-playlist-audio:before{content:"\f492"}.dashicons-playlist-video:before{content:"\f493"}.dashicons-plugins-checked:before{content:"\f485"}.dashicons-plus-alt:before{content:"\f502"}.dashicons-plus-alt2:before{content:"\f543"}.dashicons-plus:before{content:"\f132"}.dashicons-podio:before{content:"\f19c"}.dashicons-portfolio:before{content:"\f322"}.dashicons-post-status:before{content:"\f173"}.dashicons-pressthis:before{content:"\f157"}.dashicons-printer:before{content:"\f193"}.dashicons-privacy:before{content:"\f194"}.dashicons-products:before{content:"\f312"}.dashicons-randomize:before{content:"\f503"}.dashicons-reddit:before{content:"\f195"}.dashicons-redo:before{content:"\f172"}.dashicons-remove:before{content:"\f14f"}.dashicons-rest-api:before{content:"\f124"}.dashicons-rss:before{content:"\f303"}.dashicons-saved:before{content:"\f15e"}.dashicons-schedule:before{content:"\f489"}.dashicons-screenoptions:before{content:"\f180"}.dashicons-search:before{content:"\f179"}.dashicons-share-alt:before{content:"\f240"}.dashicons-share-alt2:before{content:"\f242"}.dashicons-share:before{content:"\f237"}.dashicons-shield-alt:before{content:"\f334"}.dashicons-shield:before{content:"\f332"}.dashicons-shortcode:before{content:"\f150"}.dashicons-slides:before{content:"\f181"}.dashicons-smartphone:before{content:"\f470"}.dashicons-smiley:before{content:"\f328"}.dashicons-sort:before{content:"\f156"}.dashicons-sos:before{content:"\f468"}.dashicons-spotify:before{content:"\f196"}.dashicons-star-empty:before{content:"\f154"}.dashicons-star-filled:before{content:"\f155"}.dashicons-star-half:before{content:"\f459"}.dashicons-sticky:before{content:"\f537"}.dashicons-store:before{content:"\f513"}.dashicons-superhero-alt:before{content:"\f197"}.dashicons-superhero:before{content:"\f198"}.dashicons-table-col-after:before{content:"\f151"}.dashicons-table-col-before:before{content:"\f152"}.dashicons-table-col-delete:before{content:"\f15a"}.dashicons-table-row-after:before{content:"\f15b"}.dashicons-table-row-before:before{content:"\f15c"}.dashicons-table-row-delete:before{content:"\f15d"}.dashicons-tablet:before{content:"\f471"}.dashicons-tag:before{content:"\f323"}.dashicons-tagcloud:before{content:"\f479"}.dashicons-testimonial:before{content:"\f473"}.dashicons-text-page:before{content:"\f121"}.dashicons-text:before{content:"\f478"}.dashicons-thumbs-down:before{content:"\f542"}.dashicons-thumbs-up:before{content:"\f529"}.dashicons-tickets-alt:before{content:"\f524"}.dashicons-tickets:before{content:"\f486"}.dashicons-tide:before{content:"\f10d"}.dashicons-translation:before{content:"\f326"}.dashicons-trash:before{content:"\f182"}.dashicons-twitch:before{content:"\f199"}.dashicons-twitter-alt:before{content:"\f302"}.dashicons-twitter:before{content:"\f301"}.dashicons-undo:before{content:"\f171"}.dashicons-universal-access-alt:before{content:"\f507"}.dashicons-universal-access:before{content:"\f483"}.dashicons-unlock:before{content:"\f528"}.dashicons-update-alt:before{content:"\f113"}.dashicons-update:before{content:"\f463"}.dashicons-upload:before{content:"\f317"}.dashicons-vault:before{content:"\f178"}.dashicons-video-alt:before{content:"\f234"}.dashicons-video-alt2:before{content:"\f235"}.dashicons-video-alt3:before{content:"\f236"}.dashicons-visibility:before{content:"\f177"}.dashicons-warning:before{content:"\f534"}.dashicons-welcome-add-page:before{content:"\f133"}.dashicons-welcome-comments:before{content:"\f117"}.dashicons-welcome-learn-more:before{content:"\f118"}.dashicons-welcome-view-site:before{content:"\f115"}.dashicons-welcome-widgets-menus:before{content:"\f116"}.dashicons-welcome-write-blog:before{content:"\f119"}.dashicons-whatsapp:before{content:"\f19a"}.dashicons-wordpress-alt:before{content:"\f324"}.dashicons-wordpress:before{content:"\f120"}.dashicons-xing:before{content:"\f19d"}.dashicons-yes-alt:before{content:"\f12a"}.dashicons-yes:before{content:"\f147"}.dashicons-youtube:before{content:"\f19b"}.dashicons-editor-distractionfree:before{content:"\f211"}.dashicons-exerpt-view:before{content:"\f164"}.dashicons-format-links:before{content:"\f103"}.dashicons-format-standard:before{content:"\f109"}.dashicons-post-trash:before{content:"\f182"}.dashicons-share1:before{content:"\f237"}.dashicons-welcome-edit-page:before{content:"\f119"}/*------------------------------------------------------------------------------ - TinyMCE and Quicklinks toolbars -------------------------------------------------------------------------------*/ - -/* TinyMCE widgets/containers */ - -.mce-tinymce { - box-shadow: none; -} - -.mce-container, -.mce-container *, -.mce-widget, -.mce-widget * { - color: inherit; - font-family: inherit; -} - -.mce-container .mce-monospace, -.mce-widget .mce-monospace { - font-family: Consolas, Monaco, monospace; - font-size: 13px; - line-height: 150%; -} - -/* TinyMCE windows */ -#mce-modal-block, -#mce-modal-block.mce-fade { - opacity: 0.7; - filter: alpha(opacity=70); - transition: none; - background: #000; -} - -.mce-window { - border-radius: 0; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - -webkit-font-smoothing: subpixel-antialiased; - transition: none; -} - -.mce-window .mce-container-body.mce-abs-layout { - overflow: visible; -} - -.mce-window .mce-window-head { - background: #fff; - border-bottom: 1px solid #dcdcde; - padding: 0; - min-height: 36px; -} - -.mce-window .mce-window-head .mce-title { - color: #3c434a; - font-size: 18px; - font-weight: 600; - line-height: 36px; - margin: 0; - padding: 0 36px 0 16px; -} - -.mce-window .mce-window-head .mce-close, -.mce-window-head .mce-close .mce-i-remove { - color: transparent; - top: 0; - right: 0; - width: 36px; - height: 36px; - padding: 0; - line-height: 36px; - text-align: center; -} - -.mce-window-head .mce-close .mce-i-remove:before { - font: normal 20px/36px dashicons; - text-align: center; - color: #646970; - width: 36px; - height: 36px; - display: block; -} - -.mce-window-head .mce-close:hover .mce-i-remove:before, -.mce-window-head .mce-close:focus .mce-i-remove:before { - color: #135e96; -} - -.mce-window-head .mce-close:focus .mce-i-remove, -div.mce-tab:focus { - box-shadow: 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -.mce-window .mce-window-head .mce-dragh { - width: calc( 100% - 36px ); -} - -.mce-window .mce-foot { - border-top: 1px solid #dcdcde; -} - -.mce-textbox, -.mce-checkbox i.mce-i-checkbox, -#wp-link .query-results { - border: 1px solid #dcdcde; - border-radius: 0; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07); - transition: .05s all ease-in-out; -} - -.mce-textbox:focus, -.mce-textbox.mce-focus, -.mce-checkbox:focus i.mce-i-checkbox, -#wp-link .query-results:focus { - border-color: #4f94d4; - box-shadow: 0 0 2px rgba(79, 148, 212, 0.8); -} - -.mce-window .mce-wp-help { - height: 360px; - width: 460px; - overflow: auto; -} - -.mce-window .mce-wp-help * { - box-sizing: border-box; -} - -.mce-window .mce-wp-help > .mce-container-body { - width: auto !important; -} - -.mce-window .wp-editor-help { - padding: 10px 10px 0 20px; -} - -.mce-window .wp-editor-help h2, -.mce-window .wp-editor-help p { - margin: 8px 0; - white-space: normal; - font-size: 14px; - font-weight: 400; -} - -.mce-window .wp-editor-help table { - width: 100%; - margin-bottom: 20px; -} - -.mce-window .wp-editor-help table.wp-help-single { - margin: 0 8px 20px; -} - -.mce-window .wp-editor-help table.fixed { - table-layout: fixed; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(odd), -.mce-window .wp-editor-help table.fixed td:nth-child(odd) { - width: 12%; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(even), -.mce-window .wp-editor-help table.fixed td:nth-child(even) { - width: 38%; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(odd) { - padding: 5px 0 0; -} - -.mce-window .wp-editor-help td, -.mce-window .wp-editor-help th { - font-size: 13px; - padding: 5px; - vertical-align: middle; - word-wrap: break-word; - white-space: normal; -} - -.mce-window .wp-editor-help th { - font-weight: 600; - padding-bottom: 0; -} - -.mce-window .wp-editor-help kbd { - font-family: monospace; - padding: 2px 7px 3px; - font-weight: 600; - margin: 0; - background: #f0f0f1; - background: rgba(0, 0, 0, 0.08); -} - -.mce-window .wp-help-th-center td:nth-child(odd), -.mce-window .wp-help-th-center th:nth-child(odd) { - text-align: center; -} - -/* TinyMCE menus */ -.mce-menu, -.mce-floatpanel.mce-popover { - border-color: rgba(0, 0, 0, 0.15); - border-radius: 0; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); -} - -.mce-menu, -.mce-floatpanel.mce-popover.mce-bottom { - margin-top: 2px; -} - -.mce-floatpanel .mce-arrow { - display: none; -} - -.mce-menu .mce-container-body { - min-width: 160px; -} - -.mce-menu-item { - border: none; - margin-bottom: 2px; - padding: 6px 15px 6px 12px; -} - -.mce-menu-has-icons i.mce-ico { - line-height: 20px; -} - -/* TinyMCE panel */ -div.mce-panel { - border: 0; - background: #fff; -} - -.mce-panel.mce-menu { - border: 1px solid #dcdcde; -} - -div.mce-tab { - line-height: 13px; -} - -/* TinyMCE toolbars */ -div.mce-toolbar-grp { - border-bottom: 1px solid #dcdcde; - background: #f6f7f7; - padding: 0; - position: relative; -} - -div.mce-inline-toolbar-grp { - border: 1px solid #a7aaad; - border-radius: 2px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); - box-sizing: border-box; - margin-bottom: 8px; - position: absolute; - -webkit-user-select: none; - user-select: none; - max-width: 98%; - z-index: 100100; /* Same as the other TinyMCE "panels" */ -} - -div.mce-inline-toolbar-grp > div.mce-stack-layout { - padding: 1px; -} - -div.mce-inline-toolbar-grp.mce-arrow-up { - margin-bottom: 0; - margin-top: 8px; -} - -div.mce-inline-toolbar-grp:before, -div.mce-inline-toolbar-grp:after { - position: absolute; - left: 50%; - display: block; - width: 0; - height: 0; - border-style: solid; - border-color: transparent; - content: ""; -} - -div.mce-inline-toolbar-grp.mce-arrow-up:before { - top: -9px; - border-bottom-color: #a7aaad; - border-width: 0 9px 9px; - margin-left: -9px; -} - -div.mce-inline-toolbar-grp.mce-arrow-down:before { - bottom: -9px; - border-top-color: #a7aaad; - border-width: 9px 9px 0; - margin-left: -9px; -} - -div.mce-inline-toolbar-grp.mce-arrow-up:after { - top: -8px; - border-bottom-color: #f6f7f7; - border-width: 0 8px 8px; - margin-left: -8px; -} - -div.mce-inline-toolbar-grp.mce-arrow-down:after { - bottom: -8px; - border-top-color: #f6f7f7; - border-width: 8px 8px 0; - margin-left: -8px; -} - -div.mce-inline-toolbar-grp.mce-arrow-left:before, -div.mce-inline-toolbar-grp.mce-arrow-left:after { - margin: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-left:before { - left: 20px; -} -div.mce-inline-toolbar-grp.mce-arrow-left:after { - left: 21px; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:before, -div.mce-inline-toolbar-grp.mce-arrow-right:after { - left: auto; - margin: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:before { - right: 20px; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:after { - right: 21px; -} - -div.mce-inline-toolbar-grp.mce-arrow-full { - right: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-full > div { - width: 100%; - overflow-x: auto; -} - -div.mce-toolbar-grp > div { - padding: 3px; -} - -.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first { - padding-right: 32px; -} - -.mce-toolbar .mce-btn-group { - margin: 0; -} - -/* Classic block hide/show toolbars */ -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} - -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -} - -div.mce-statusbar { - border-top: 1px solid #dcdcde; -} - -div.mce-path { - padding: 2px 10px; - margin: 0; -} - -.mce-path, -.mce-path-item, -.mce-path .mce-divider { - font-size: 12px; -} - -.mce-toolbar .mce-btn, -.qt-dfw { - border-color: transparent; - background: transparent; - box-shadow: none; - text-shadow: none; - cursor: pointer; -} - -.mce-btn .mce-txt { - direction: inherit; - text-align: inherit; -} - -.mce-toolbar .mce-btn-group .mce-btn, -.qt-dfw { - border: 1px solid transparent; - margin: 2px; - border-radius: 2px; -} - -.mce-toolbar .mce-btn-group .mce-btn:hover, -.mce-toolbar .mce-btn-group .mce-btn:focus, -.qt-dfw:hover, -.qt-dfw:focus { - background: #f6f7f7; - border-color: #50575e; - color: #1d2327; - box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, 0.08); - outline: none; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-active, -.mce-toolbar .mce-btn-group .mce-btn:active, -.qt-dfw.active { - background: #f0f0f1; - border-color: #50575e; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.3); -} - -.mce-btn.mce-active, -.mce-btn.mce-active button, -.mce-btn.mce-active:hover button, -.mce-btn.mce-active i, -.mce-btn.mce-active:hover i { - color: inherit; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-active:focus { - border-color: #1d2327; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus { - color: #a7aaad; - background: none; - border-color: #dcdcde; - text-shadow: 0 1px 0 #fff; - box-shadow: none; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus { - border-color: #50575e; -} - -.mce-toolbar .mce-btn-group .mce-first, -.mce-toolbar .mce-btn-group .mce-last { - border-color: transparent; -} - -.mce-toolbar .mce-btn button, -.qt-dfw { - padding: 2px 3px; - line-height: normal; -} - -.mce-toolbar .mce-listbox button { - font-size: 13px; - line-height: 1.53846153; - padding-left: 6px; - padding-right: 20px; -} - -.mce-toolbar .mce-btn i { - text-shadow: none; -} - -.mce-toolbar .mce-btn-group > div { - white-space: normal; -} - -.mce-toolbar .mce-colorbutton .mce-open { - border-right: 0; -} - -.mce-toolbar .mce-colorbutton .mce-preview { - margin: 0; - padding: 0; - top: auto; - bottom: 2px; - left: 3px; - height: 3px; - width: 20px; - background: #50575e; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary { - min-width: 0; - background: #3582c4; - border-color: #2271b1 #135e96 #135e96; - box-shadow: 0 1px 0 #135e96; - color: #fff; - text-decoration: none; - text-shadow: none; -} - -/* Compensate for the extra box shadow at the bottom of .mce-btn.mce-primary */ -.mce-toolbar .mce-btn-group .mce-btn.mce-primary button { - padding: 2px 3px 1px; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary .mce-ico { - color: #fff; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus { - background: #4f94d4; - border-color: #135e96; - color: #fff; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus { - box-shadow: 0 0 1px 1px #72aee6; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:active { - background: #2271b1; - border-color: #135e96; - box-shadow: inset 0 2px 0 #135e96; -} - -/* mce listbox */ -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox { - border-radius: 0; - direction: ltr; - background: #fff; - border: 1px solid #dcdcde; - box-shadow: inset 0 1px 1px -1px rgba(0, 0, 0, 0.2); -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:focus { - border-color: #c3c4c7; -} - -.mce-panel .mce-btn i.mce-caret { - border-top: 6px solid #50575e; - margin-left: 2px; - margin-right: 2px; -} - -.mce-listbox i.mce-caret { - right: 4px; -} - -.mce-panel .mce-btn:hover i.mce-caret, -.mce-panel .mce-btn:focus i.mce-caret { - border-top-color: #1d2327; -} - -.mce-panel .mce-active i.mce-caret { - border-top: 0; - border-bottom: 6px solid #1d2327; - margin-top: 7px; -} - -.mce-listbox.mce-active i.mce-caret { - margin-top: -3px; -} - -.mce-toolbar .mce-splitbtn:hover .mce-open { - border-right-color: transparent; -} - -.mce-toolbar .mce-splitbtn .mce-open.mce-active { - background: transparent; - outline: none; -} - -.mce-menu .mce-menu-item:hover, -.mce-menu .mce-menu-item.mce-selected, -.mce-menu .mce-menu-item:focus, -.mce-menu .mce-menu-item.mce-active.mce-menu-item-normal, -.mce-menu .mce-menu-item.mce-active.mce-menu-item-preview { - background: #2271b1; /* See color scheme. */ - color: #fff; -} - -.mce-menu .mce-menu-item:hover .mce-caret, -.mce-menu .mce-menu-item:focus .mce-caret, -.mce-menu .mce-menu-item.mce-selected .mce-caret { - border-left-color: #fff; -} - -/* rtl:ignore */ -.rtl .mce-menu .mce-menu-item:hover .mce-caret, -.rtl .mce-menu .mce-menu-item:focus .mce-caret, -.rtl .mce-menu .mce-menu-item.mce-selected .mce-caret { - border-left-color: inherit; - border-right-color: #fff; -} - -.mce-menu .mce-menu-item:hover .mce-text, -.mce-menu .mce-menu-item:focus .mce-text, -.mce-menu .mce-menu-item:hover .mce-ico, -.mce-menu .mce-menu-item:focus .mce-ico, -.mce-menu .mce-menu-item.mce-selected .mce-text, -.mce-menu .mce-menu-item.mce-selected .mce-ico, -.mce-menu .mce-menu-item:hover .mce-menu-shortcut, -.mce-menu .mce-menu-item:focus .mce-menu-shortcut, -.mce-menu .mce-menu-item.mce-active .mce-menu-shortcut, -.mce-menu .mce-menu-item.mce-disabled:hover .mce-text, -.mce-menu .mce-menu-item.mce-disabled:hover .mce-ico { - color: inherit; -} - -.mce-menu .mce-menu-item.mce-disabled { - cursor: default; -} - -.mce-menu .mce-menu-item.mce-disabled:hover { - background: #c3c4c7; -} - -/* Menubar */ -div.mce-menubar { - border-color: #dcdcde; - background: #fff; - border-width: 0 0 1px; -} - -.mce-menubar .mce-menubtn:hover, -.mce-menubar .mce-menubtn.mce-active, -.mce-menubar .mce-menubtn:focus { - border-color: transparent; - background: transparent; -} - -.mce-menubar .mce-menubtn:focus { - color: #043959; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -div.mce-menu .mce-menu-item-sep, -.mce-menu-item-sep:hover { - border-bottom: 1px solid #dcdcde; - height: 0; - margin: 5px 0; -} - -.mce-menubtn span { - margin-right: 0; - padding-left: 3px; -} - -.mce-menu-has-icons i.mce-ico:before { - margin-left: -2px; -} - -/* Keyboard shortcuts position */ -.mce-menu.mce-menu-align .mce-menu-item-normal { - position: relative; -} - -.mce-menu.mce-menu-align .mce-menu-shortcut { - bottom: 0.6em; - font-size: 0.9em; -} - -/* Buttons in modals */ -.mce-primary button, -.mce-primary button i { - text-align: center; - color: #fff; - text-shadow: none; - padding: 0; - line-height: 1.85714285; -} - -.mce-window .mce-btn { - color: #50575e; - background: #f6f7f7; - text-decoration: none; - font-size: 13px; - line-height: 26px; - height: 28px; - margin: 0; - padding: 0; - cursor: pointer; - border: 1px solid #c3c4c7; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-shadow: 0 1px 0 #c3c4c7; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.mce-window .mce-btn::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.mce-window .mce-btn:hover, -.mce-window .mce-btn:focus { - background: #f6f7f7; - border-color: #8c8f94; - color: #1d2327; -} - -.mce-window .mce-btn:focus { - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.mce-window .mce-btn:active { - background: #f0f0f1; - border-color: #8c8f94; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); - transform: translateY(1px); -} - -.mce-window .mce-btn.mce-disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - text-shadow: 0 1px 0 #fff !important; - cursor: default; - transform: none !important; -} - -.mce-window .mce-btn.mce-primary { - background: #3582c4; - border-color: #2271b1 #135e96 #135e96; - box-shadow: 0 1px 0 #135e96; - color: #fff; - text-decoration: none; - text-shadow: 0 -1px 1px #135e96, - 1px 0 1px #135e96, - 0 1px 1px #135e96, - -1px 0 1px #135e96; -} - -.mce-window .mce-btn.mce-primary:hover, -.mce-window .mce-btn.mce-primary:focus { - background: #4f94d4; - border-color: #135e96; - color: #fff; -} - -.mce-window .mce-btn.mce-primary:focus { - box-shadow: 0 1px 0 #2271b1, - 0 0 2px 1px #72aee6; -} - -.mce-window .mce-btn.mce-primary:active { - background: #2271b1; - border-color: #135e96; - box-shadow: inset 0 2px 0 #135e96; - vertical-align: top; -} - -.mce-window .mce-btn.mce-primary.mce-disabled { - color: #9ec2e6 !important; - background: #4f94d4 !important; - border-color: #3582c4 !important; - box-shadow: none !important; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important; - cursor: default; -} - -.mce-menubtn.mce-fixed-width span { - overflow-x: hidden; - text-overflow: ellipsis; - width: 82px; -} - -/* Charmap modal */ -.mce-charmap { - margin: 3px; -} - -.mce-charmap td { - padding: 0; - border-color: #dcdcde; - cursor: pointer; -} - -.mce-charmap td:hover { - background: #f6f7f7; -} - -.mce-charmap td div { - width: 18px; - height: 22px; - line-height: 1.57142857; -} - -/* TinyMCE tooltips */ -.mce-tooltip { - margin-top: 2px; -} - -.mce-tooltip-inner { - border-radius: 3px; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - color: #fff; - font-size: 12px; -} - -/* TinyMCE icons */ -.mce-ico { - font-family: tinymce, Arial; -} - -.mce-btn-small .mce-ico { - font-family: tinymce-small, Arial; -} - -.mce-toolbar .mce-ico { - color: #50575e; - line-height: 1; - width: 20px; - height: 20px; - text-align: center; - text-shadow: none; - margin: 0; - padding: 0; -} - -.qt-dfw { - color: #50575e; - line-height: 1; - width: 28px; - height: 26px; - text-align: center; - text-shadow: none; -} - -.mce-toolbar .mce-btn .mce-open { - line-height: 20px; -} - -.mce-toolbar .mce-btn:hover .mce-open, -.mce-toolbar .mce-btn:focus .mce-open, -.mce-toolbar .mce-btn.mce-active .mce-open { - border-left-color: #1d2327; -} - -div.mce-notification { - left: 10% !important; - right: 10%; -} - -.mce-notification button.mce-close { - right: 6px; - top: 3px; - font-weight: 400; - color: #50575e; -} - -.mce-notification button.mce-close:hover, -.mce-notification button.mce-close:focus { - color: #000; -} - -i.mce-i-bold, -i.mce-i-italic, -i.mce-i-bullist, -i.mce-i-numlist, -i.mce-i-blockquote, -i.mce-i-alignleft, -i.mce-i-aligncenter, -i.mce-i-alignright, -i.mce-i-link, -i.mce-i-unlink, -i.mce-i-wp_more, -i.mce-i-strikethrough, -i.mce-i-spellchecker, -i.mce-i-fullscreen, -i.mce-i-wp_fullscreen, -i.mce-i-dfw, -i.mce-i-wp_adv, -i.mce-i-underline, -i.mce-i-alignjustify, -i.mce-i-forecolor, -i.mce-i-backcolor, -i.mce-i-pastetext, -i.mce-i-pasteword, -i.mce-i-removeformat, -i.mce-i-charmap, -i.mce-i-outdent, -i.mce-i-indent, -i.mce-i-undo, -i.mce-i-redo, -i.mce-i-help, -i.mce-i-wp_help, -i.mce-i-wp-media-library, -i.mce-i-ltr, -i.mce-i-wp_page, -i.mce-i-hr, -i.mce-i-wp_code, -i.mce-i-dashicon, -i.mce-i-remove { - font: normal 20px/1 dashicons; - padding: 0; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - margin-left: -2px; - padding-right: 2px; -} - -.qt-dfw { - font: normal 20px/1 dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -i.mce-i-bold:before { - content: "\f200"; -} - -i.mce-i-italic:before { - content: "\f201"; -} - -i.mce-i-bullist:before { - content: "\f203"; -} - -i.mce-i-numlist:before { - content: "\f204"; -} - -i.mce-i-blockquote:before { - content: "\f205"; -} - -i.mce-i-alignleft:before { - content: "\f206"; -} - -i.mce-i-aligncenter:before { - content: "\f207"; -} - -i.mce-i-alignright:before { - content: "\f208"; -} - -i.mce-i-link:before { - content: "\f103"; -} - -i.mce-i-unlink:before { - content: "\f225"; -} - -i.mce-i-wp_more:before { - content: "\f209"; -} - -i.mce-i-strikethrough:before { - content: "\f224"; -} - -i.mce-i-spellchecker:before { - content: "\f210"; -} - -i.mce-i-fullscreen:before, -i.mce-i-wp_fullscreen:before, -i.mce-i-dfw:before, -.qt-dfw:before { - content: "\f211"; -} - -i.mce-i-wp_adv:before { - content: "\f212"; -} - -i.mce-i-underline:before { - content: "\f213"; -} - -i.mce-i-alignjustify:before { - content: "\f214"; -} - -i.mce-i-forecolor:before, -i.mce-i-backcolor:before { - content: "\f215"; -} - -i.mce-i-pastetext:before { - content: "\f217"; -} - -i.mce-i-removeformat:before { - content: "\f218"; -} - -i.mce-i-charmap:before { - content: "\f220"; -} - -i.mce-i-outdent:before { - content: "\f221"; -} - -i.mce-i-indent:before { - content: "\f222"; -} - -i.mce-i-undo:before { - content: "\f171"; -} - -i.mce-i-redo:before { - content: "\f172"; -} - -i.mce-i-help:before, -i.mce-i-wp_help:before { - content: "\f223"; -} - -i.mce-i-wp-media-library:before { - content: "\f104"; -} - -i.mce-i-ltr:before { - content: "\f320"; -} - -i.mce-i-wp_page:before { - content: "\f105"; -} - -i.mce-i-hr:before { - content: "\f460"; -} - -i.mce-i-remove:before { - content: "\f158"; -} - -i.mce-i-wp_code:before { - content: "\f475"; -} - -/* RTL button icons */ -.rtl i.mce-i-outdent:before { - content: "\f222"; -} - -.rtl i.mce-i-indent:before { - content: "\f221"; -} - -/* Editors */ -.wp-editor-wrap { - position: relative; -} - -.wp-editor-tools { - position: relative; - z-index: 1; -} - -.wp-editor-tools:after { - clear: both; - content: ""; - display: table; -} - -.wp-editor-container { - clear: both; - border: 1px solid #dcdcde; -} - -.wp-editor-area { - font-family: Consolas, Monaco, monospace; - font-size: 13px; - padding: 10px; - margin: 1px 0 0; - line-height: 150%; - border: 0; - outline: none; - display: block; - resize: vertical; - box-sizing: border-box; -} - -.rtl .wp-editor-area { - font-family: Tahoma, Monaco, monospace; -} - -.locale-he-il .wp-editor-area { - font-family: Arial, Monaco, monospace; -} - -.wp-editor-container textarea.wp-editor-area { - width: 100%; - margin: 0; - box-shadow: none; -} - -.wp-editor-tabs { - float: right; -} - -.wp-switch-editor { - float: left; - box-sizing: content-box; - position: relative; - top: 1px; - background: #f0f0f1; - color: #646970; - cursor: pointer; - font-size: 13px; - line-height: 1.46153846; - height: 20px; - margin: 5px 0 0 5px; - padding: 3px 8px 4px; - border: 1px solid #dcdcde; -} - -.wp-switch-editor:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - outline: none; - color: #1d2327; -} - -.wp-switch-editor:active, -.html-active .switch-html:focus, -.tmce-active .switch-tmce:focus { - box-shadow: none; -} - -.wp-switch-editor:active { - background-color: #f6f7f7; - box-shadow: none; -} - -.js .tmce-active .wp-editor-area { - color: #fff; -} - -.tmce-active .quicktags-toolbar { - display: none; -} - -.tmce-active .switch-tmce, -.html-active .switch-html { - background: #f6f7f7; - color: #50575e; - border-bottom-color: #f6f7f7; -} - -.wp-media-buttons { - float: left; -} - -.wp-media-buttons .button { - margin-right: 5px; - margin-bottom: 4px; - padding-left: 7px; - padding-right: 7px; -} - -.wp-media-buttons .button:active { - position: relative; - top: 1px; - margin-top: -1px; - margin-bottom: 1px; -} - -.wp-media-buttons .insert-media { - padding-left: 5px; -} - -.wp-media-buttons a { - text-decoration: none; - color: #3c434a; - font-size: 12px; -} - -.wp-media-buttons img { - padding: 0 4px; - vertical-align: middle; -} - -.wp-media-buttons span.wp-media-buttons-icon { - display: inline-block; - width: 20px; - height: 20px; - line-height: 1; - vertical-align: middle; - margin: 0 2px; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon { - background: none; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon:before { - font: normal 18px/1 dashicons; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon:before { - content: "\f104"; -} - -.mce-content-body dl.wp-caption { - max-width: 100%; -} - -/* Quicktags */ -.quicktags-toolbar { - padding: 3px; - position: relative; - border-bottom: 1px solid #dcdcde; - background: #f6f7f7; - min-height: 30px; -} - -.has-dfw .quicktags-toolbar { - padding-right: 35px; -} - -.wp-core-ui .quicktags-toolbar input.button.button-small { - margin: 2px; -} - -.quicktags-toolbar input[value="link"] { - text-decoration: underline; -} - -.quicktags-toolbar input[value="del"] { - text-decoration: line-through; -} - -.quicktags-toolbar input[value="i"] { - font-style: italic; -} - -.quicktags-toolbar input[value="b"] { - font-weight: 600; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw, -.qt-dfw { - position: absolute; - top: 0; - right: 0; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw { - margin: 7px 7px 0 0; -} - -.qt-dfw { - margin: 5px 5px 0 0; -} - -.qt-fullscreen { - position: static; - margin: 2px; -} - -@media screen and (max-width: 782px) { - .mce-toolbar .mce-btn button, - .qt-dfw { - padding: 6px 7px; - } - - /* Compensate for the extra box shadow at the bottom of .mce-btn.mce-primary */ - .mce-toolbar .mce-btn-group .mce-btn.mce-primary button { - padding: 6px 7px 5px; - } - - .mce-toolbar .mce-btn-group .mce-btn { - margin: 1px; - } - - .qt-dfw { - width: 36px; - height: 34px; - } - - .mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw { - margin: 4px 4px 0 0; - } - - .mce-toolbar .mce-colorbutton .mce-preview { - left: 8px; - bottom: 6px; - } - - .mce-window .mce-btn { - padding: 2px 0; - } - - .has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first, - .has-dfw .quicktags-toolbar { - padding-right: 40px; - } -} - -@media screen and (min-width: 782px) { - .wp-core-ui .quicktags-toolbar input.button.button-small { - /* .button-small is normally 11px, but a bit too small for these buttons. */ - font-size: 12px; - min-height: 26px; - line-height: 2; - } -} - -#wp_editbtns, -#wp_gallerybtns { - padding: 2px; - position: absolute; - display: none; - z-index: 100020; -} - -#wp_editimgbtn, -#wp_delimgbtn, -#wp_editgallery, -#wp_delgallery { - background-color: #f0f0f1; - margin: 2px; - padding: 2px; - border: 1px solid #8c8f94; - border-radius: 3px; -} - -#wp_editimgbtn:hover, -#wp_delimgbtn:hover, -#wp_editgallery:hover, -#wp_delgallery:hover { - border-color: #50575e; - background-color: #c3c4c7; -} - -/*------------------------------------------------------------------------------ - wp-link -------------------------------------------------------------------------------*/ - -#wp-link-wrap { - display: none; - background-color: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - width: 500px; - overflow: hidden; - margin-left: -250px; - margin-top: -125px; - position: fixed; - top: 50%; - left: 50%; - z-index: 100105; - transition: height 0.2s, margin-top 0.2s; -} - -#wp-link-backdrop { - display: none; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 100100; -} - -#wp-link { - position: relative; - height: 100%; -} - -#wp-link-wrap { - height: 500px; - margin-top: -250px; -} - -#wp-link-wrap .wp-link-text-field { - display: none; -} - -#wp-link-wrap.has-text-field .wp-link-text-field { - display: block; -} - -#link-modal-title { - background: #fff; - border-bottom: 1px solid #dcdcde; - height: 36px; - font-size: 18px; - font-weight: 600; - line-height: 2; - margin: 0; - padding: 0 36px 0 16px; -} - -#wp-link-close { - color: #646970; - padding: 0; - position: absolute; - top: 0; - right: 0; - width: 36px; - height: 36px; - text-align: center; - background: none; - border: none; - cursor: pointer; -} - -#wp-link-close:before { - font: normal 20px/36px dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - width: 36px; - height: 36px; - content: "\f158"; -} - -#wp-link-close:hover, -#wp-link-close:focus { - color: #135e96; -} - -#wp-link-close:focus { - outline: none; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -#wp-link-wrap #link-selector { - -webkit-overflow-scrolling: touch; - padding: 0 16px; - position: absolute; - top: 37px; - left: 0; - right: 0; - bottom: 44px; -} - -#wp-link ol, -#wp-link ul { - list-style: none; - margin: 0; - padding: 0; -} - -#wp-link input[type="text"] { - box-sizing: border-box; -} - -#wp-link #link-options { - padding: 8px 0 12px; -} - -#wp-link p.howto { - margin: 3px 0; -} - -#wp-link p.howto a { - text-decoration: none; - color: inherit; -} - -#wp-link label input[type="text"] { - margin-top: 5px; - width: 70%; -} - -#wp-link #link-options label span, -#wp-link #search-panel label span.search-label { - display: inline-block; - width: 80px; - text-align: right; - padding-right: 5px; - max-width: 24%; - vertical-align: middle; - word-wrap: break-word; -} - -#wp-link .link-search-field { - width: 250px; - max-width: 70%; -} - -#wp-link .link-search-wrapper { - margin: 5px 0 9px; - display: block; - overflow: hidden; -} - -#wp-link .link-search-wrapper .spinner { - float: none; - margin: -3px 0 0 4px; -} - -#wp-link .link-target { - padding: 3px 0 0; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#wp-link .link-target label { - max-width: 70%; -} - -#wp-link .query-results { - border: 1px #dcdcde solid; - margin: 0 0 12px; - background: #fff; - overflow: auto; - position: absolute; - left: 16px; - right: 16px; - bottom: 0; - top: 166px; -} - -.has-text-field #wp-link .query-results { - top: 210px; -} - -#wp-link li { - clear: both; - margin-bottom: 0; - border-bottom: 1px solid #f0f0f1; - color: #2c3338; - padding: 4px 6px 4px 10px; - cursor: pointer; - position: relative; -} - -#wp-link .query-notice { - padding: 0; - border-bottom: 1px solid #dcdcde; - background-color: #fff; - color: #000; -} - -#wp-link .query-notice .query-notice-default, -#wp-link .query-notice .query-notice-hint { - display: block; - padding: 6px; - border-left: 4px solid #72aee6; -} - -#wp-link .unselectable.no-matches-found { - padding: 0; - border-bottom: 1px solid #dcdcde; - background-color: #f6f7f7; -} - -#wp-link .no-matches-found .item-title { - display: block; - padding: 6px; - border-left: 4px solid #d63638; -} - -#wp-link .query-results em { - font-style: normal; -} - -#wp-link li:hover { - background: #f0f6fc; - color: #101517; -} - -#wp-link li.unselectable { - border-bottom: 1px solid #dcdcde; -} - -#wp-link li.unselectable:hover { - background: #fff; - cursor: auto; - color: #2c3338; -} - -#wp-link li.selected { - background: #dcdcde; - color: #2c3338; -} - -#wp-link li.selected .item-title { - font-weight: 600; -} - -#wp-link li:last-child { - border: none; -} - -#wp-link .item-title { - display: inline-block; - width: 80%; - width: calc(100% - 68px); - word-wrap: break-word; -} - -#wp-link .item-info { - text-transform: uppercase; - color: #646970; - font-size: 11px; - position: absolute; - right: 5px; - top: 5px; -} - -#wp-link .river-waiting { - display: none; - padding: 10px 0; -} - -#wp-link .submitbox { - padding: 8px 16px; - background: #fff; - border-top: 1px solid #dcdcde; - position: absolute; - bottom: 0; - left: 0; - right: 0; -} - -#wp-link-cancel { - line-height: 1.92307692; - float: left; -} - -#wp-link-update { - line-height: 1.76923076; - float: right; -} - -#wp-link-submit { - float: right; -} - -@media screen and (max-width: 782px) { - #wp-link-wrap { - margin-top: -140px; - } - - #wp-link-wrap .query-results { - top: 195px; - } - - #wp-link-wrap.has-text-field .query-results { - top: 235px; - } - - #link-selector { - padding: 0 16px 60px; - } - - #wp-link-wrap #link-selector { - bottom: 52px; - } - - #wp-link-cancel { - line-height: 2.46153846; - } - - #wp-link .link-target { - padding-top: 10px; - } - - #wp-link .submitbox .button { - margin-bottom: 0; - } -} - -@media screen and (max-width: 520px) { - #wp-link-wrap { - width: auto; - margin-left: 0; - left: 10px; - right: 10px; - max-width: 500px; - } -} - -@media screen and (max-height: 520px) { - #wp-link-wrap { - transition: none; - height: auto; - margin-top: 0; - top: 10px; - bottom: 10px; - } - - #link-selector { - overflow: auto; - } - - #search-panel .query-results { - position: static; - } -} - -@media screen and (max-height: 290px) { - #wp-link-wrap { - height: auto; - margin-top: 0; - top: 10px; - bottom: 10px; - } - - #link-selector { - overflow: auto; - height: calc(100% - 92px); - padding-bottom: 2px; - } - - #search-panel .query-results { - position: static; - } -} - -div.wp-link-preview { - float: left; - margin: 5px; - max-width: 694px; - overflow: hidden; - text-overflow: ellipsis; -} - -div.wp-link-preview a { - color: #2271b1; - text-decoration: underline; - transition-property: border, background, color; - transition-duration: .05s; - transition-timing-function: ease-in-out; - cursor: pointer; -} - -div.wp-link-preview a.wplink-url-error { - color: #d63638; -} - -div.wp-link-input { - float: left; - margin: 2px; - max-width: 694px; -} - -div.wp-link-input input { - width: 300px; - padding: 3px; - box-sizing: border-box; - line-height: 1.28571429; /* 18px */ - /* Override value inherited from default input fields. */ - min-height: 26px; -} - -.mce-toolbar div.wp-link-preview ~ .mce-btn, -.mce-toolbar div.wp-link-input ~ .mce-btn { - margin: 2px 1px; -} - -.mce-inline-toolbar-grp .mce-btn-group .mce-btn:last-child { - margin-right: 2px; -} - -.ui-autocomplete.wplink-autocomplete { - z-index: 100110; - max-height: 200px; - overflow-y: auto; - padding: 0; - margin: 0; - list-style: none; - position: absolute; - border: 1px solid #4f94d4; - box-shadow: 0 1px 2px rgba(79, 148, 212, 0.8); - background-color: #fff; -} - -.ui-autocomplete.wplink-autocomplete li { - margin-bottom: 0; - padding: 4px 10px; - clear: both; - white-space: normal; - text-align: left; -} - -.ui-autocomplete.wplink-autocomplete li .wp-editor-float-right { - float: right; -} - -.ui-autocomplete.wplink-autocomplete li.ui-state-focus { - background-color: #dcdcde; - cursor: pointer; -} - -@media screen and (max-width: 782px) { - div.wp-link-preview, - div.wp-link-input { - max-width: 70%; - max-width: calc(100% - 86px); - } - - div.wp-link-preview { - margin: 8px 0 8px 5px; - } - - div.wp-link-input { - width: 300px; - } - - div.wp-link-input input { - width: 100%; - font-size: 16px; - padding: 5px; - } -} - -/* =Overlay Body --------------------------------------------------------------- */ - -.mce-fullscreen { - z-index: 100010; -} - -/* =Localization --------------------------------------------------------------- */ -.rtl .wp-switch-editor, -.rtl .quicktags-toolbar input { - font-family: Tahoma, sans-serif; -} - -/* rtl:ignore */ -.mce-rtl .mce-flow-layout .mce-flow-layout-item > div { - direction: rtl; -} - -/* rtl:ignore */ -.mce-rtl .mce-listbox i.mce-caret { - left: 6px; -} - -html:lang(he-il) .rtl .wp-switch-editor, -html:lang(he-il) .rtl .quicktags-toolbar input { - font-family: Arial, sans-serif; -} - -/* HiDPI */ -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - .wp-media-buttons .add_media span.wp-media-buttons-icon { - background: none; - } -} -/*! This file is auto-generated */ -body,html{padding:0;margin:0}body{font-family:sans-serif}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.dashicons{display:inline-block;width:20px;height:20px;background-color:transparent;background-repeat:no-repeat;background-size:20px;background-position:center;transition:background .1s ease-in;position:relative;top:5px}.dashicons-no{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M15.55%2013.7l-2.19%202.06-3.42-3.65-3.64%203.43-2.06-2.18%203.64-3.43-3.42-3.64%202.18-2.06%203.43%203.64%203.64-3.42%202.05%202.18-3.64%203.43z%27%20fill%3D%27%23fff%27%2F%3E%3C%2Fsvg%3E")}.dashicons-admin-comments{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E")}.wp-embed-comments a:hover .dashicons-admin-comments{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E")}.dashicons-share{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E");display:none}.js .dashicons-share{display:inline-block}.wp-embed-share-dialog-open:hover .dashicons-share{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E")}.wp-embed{padding:25px;font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.5;color:#8c8f94;background:#fff;border:1px solid #dcdcde;box-shadow:0 1px 1px rgba(0,0,0,.05);overflow:auto;zoom:1}.wp-embed a{color:#8c8f94;text-decoration:none}.wp-embed a:hover{text-decoration:underline}.wp-embed-featured-image{margin-bottom:20px}.wp-embed-featured-image img{width:100%;height:auto;border:none}.wp-embed-featured-image.square{float:left;max-width:160px;margin-right:20px}.wp-embed p{margin:0}p.wp-embed-heading{margin:0 0 15px;font-weight:600;font-size:22px;line-height:1.3}.wp-embed-heading a{color:#2c3338}.wp-embed .wp-embed-more{color:#c3c4c7}.wp-embed-footer{display:table;width:100%;margin-top:30px}.wp-embed-site-icon{position:absolute;top:50%;left:0;transform:translateY(-50%);height:25px;width:25px;border:0}.wp-embed-site-title{font-weight:600;line-height:1.78571428}.wp-embed-site-title a{position:relative;display:inline-block;padding-left:35px}.wp-embed-meta,.wp-embed-site-title{display:table-cell}.wp-embed-meta{text-align:right;white-space:nowrap;vertical-align:middle}.wp-embed-comments,.wp-embed-share{display:inline}.wp-embed-meta a:hover{text-decoration:none;color:#2271b1}.wp-embed-comments a{line-height:1.78571428;display:inline-block}.wp-embed-comments+.wp-embed-share{margin-left:10px}.wp-embed-share-dialog{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#1d2327;background-color:rgba(0,0,0,.9);color:#fff;opacity:1;transition:opacity .25s ease-in-out}.wp-embed-share-dialog.hidden{opacity:0;visibility:hidden}.wp-embed-share-dialog-close,.wp-embed-share-dialog-open{margin:-8px 0 0;padding:0;background:0 0;border:none;cursor:pointer;outline:0}.wp-embed-share-dialog-close .dashicons,.wp-embed-share-dialog-open .dashicons{padding:4px}.wp-embed-share-dialog-open .dashicons{top:8px}.wp-embed-share-dialog-close:focus .dashicons,.wp-embed-share-dialog-open:focus .dashicons{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);border-radius:100%}.wp-embed-share-dialog-close{position:absolute;top:20px;right:20px;font-size:22px}.wp-embed-share-dialog-close:hover{text-decoration:none}.wp-embed-share-dialog-close .dashicons{height:24px;width:24px;background-size:24px}.wp-embed-share-dialog-content{height:100%;transform-style:preserve-3d;overflow:hidden}.wp-embed-share-dialog-text{margin-top:25px;padding:20px}.wp-embed-share-tabs{margin:0 0 20px;padding:0;list-style:none}.wp-embed-share-tab-button{display:inline-block}.wp-embed-share-tab-button button{margin:0;padding:0;border:none;background:0 0;font-size:16px;line-height:1.3;color:#a7aaad;cursor:pointer;transition:color .1s ease-in}.wp-embed-share-tab-button [aria-selected=true]{color:#fff}.wp-embed-share-tab-button button:hover{color:#fff}.wp-embed-share-tab-button+.wp-embed-share-tab-button{margin:0 0 0 10px;padding:0 0 0 11px;border-left:1px solid #a7aaad}.wp-embed-share-tab[aria-hidden=true]{display:none}p.wp-embed-share-description{margin:0;font-size:14px;line-height:1;font-style:italic;color:#a7aaad}.wp-embed-share-input{box-sizing:border-box;width:100%;border:none;height:28px;margin:0 0 10px;padding:0 5px;font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.5;resize:none;cursor:text}textarea.wp-embed-share-input{height:72px}html[dir=rtl] .wp-embed-featured-image.square{float:right;margin-right:0;margin-left:20px}html[dir=rtl] .wp-embed-site-title a{padding-left:0;padding-right:35px}html[dir=rtl] .wp-embed-site-icon{margin-right:0;margin-left:10px;left:auto;right:0}html[dir=rtl] .wp-embed-meta{text-align:left}html[dir=rtl] .wp-embed-share{margin-left:0;margin-right:10px}html[dir=rtl] .wp-embed-share-dialog-close{right:auto;left:20px}html[dir=rtl] .wp-embed-share-tab-button+.wp-embed-share-tab-button{margin:0 10px 0 0;padding:0 11px 0 0;border-left:none;border-right:1px solid #a7aaad}/*! This file is auto-generated */ -.dashicons-no{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAQAAAAngNWGAAAAcElEQVR4AdXRVxmEMBAGwJMQCUhAIhKQECmRsFJwMFfp7HfP/E8pk0173CuKpt/0R+WaBaaZqogLagBMuh+DdoKbyRCwqZ/SnM0R5oQuZ2UHS8Z6k23qPxZCTrV5UlHMi8bsfHVXP7K/GXZHaTO7S54CWLdHlN2YIwAAAABJRU5ErkJggg==)}.dashicons-admin-comments{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATUlEQVR4AWMYWqCpvUcAiA8A8X9iMFStAD4DG0AKScQNVDZw1MBRAwvIMLCA5jmFlCD4AMQGlOTtBgoNwzQQ3TCKDaTcMMxYN2AYVgAAYPKsEBxN0PIAAAAASUVORK5CYII=)}.wp-embed-comments a:hover .dashicons-admin-comments{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATElEQVR4AWMYYqB4lQAQHwDi/8RgqFoBfAY2gBSSiBuobOCogaMGFpBhYAEdcwrhIPgAxAaU5O0GCg3DNBDdMIoNpNwwzFg3YBhWAABG71qAFYcFqgAAAABJRU5ErkJggg==)}.dashicons-share{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYfqCpvccAiBcA8X8gfgDEBZQaeAFkGBoOoMR1/7HgDeQa2ECZgQiDHID4AMwAor0MCmBoQP+HBnwAskFQdgBRkQJViGk7wiAHUr21AYdhDTA1dDOQHl6mPFLokmwoT9j0z3qUFw70L77oDwAiuzCIub1XpQAAAABJRU5ErkJggg==)}.wp-embed-share-dialog-open:hover .dashicons-share{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYhqB4lQEQLwDi/0D8AIgLKDXwAsgwNBxAiev+Y8EbyDWwgTIDEQY5APEBmAFEexkUwNCA/g8N+ABkg6DsAKIiBaoQ03aEQQ6kemsDDsMaYEroZiA9vEx5pNAl2VCesOmf9SgvHOhffNEfAAAMqPR5IEZH5wAAAABJRU5ErkJggg==)}/*! This file is auto-generated */ -#wp-auth-check-wrap.hidden{display:none}#wp-auth-check-wrap #wp-auth-check-bg{position:fixed;top:0;bottom:0;right:0;left:0;background:#000;opacity:.7;z-index:1000010}#wp-auth-check-wrap #wp-auth-check{position:fixed;right:50%;overflow:hidden;top:40px;bottom:20px;max-height:415px;width:380px;margin:0 -190px 0 0;padding:30px 0 0;background-color:#f0f0f1;z-index:1000011;box-shadow:0 3px 6px rgba(0,0,0,.3)}@media screen and (max-width:380px){#wp-auth-check-wrap #wp-auth-check{right:0;width:100%;margin:0}}#wp-auth-check-wrap.fallback #wp-auth-check{max-height:180px;overflow:auto}#wp-auth-check-wrap #wp-auth-check-form{height:100%;position:relative;overflow:auto;-webkit-overflow-scrolling:touch}#wp-auth-check-form.loading:before{content:"";display:block;width:20px;height:20px;position:absolute;right:50%;top:50%;margin:-10px -10px 0 0;background:url(../images/spinner.gif) no-repeat center;background-size:20px 20px;transform:translateZ(0)}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){#wp-auth-check-form.loading:before{background-image:url(../images/spinner-2x.gif)}}#wp-auth-check-wrap #wp-auth-check-form iframe{height:98%;width:100%}#wp-auth-check-wrap .wp-auth-check-close{position:absolute;top:5px;left:5px;height:22px;width:22px;color:#787c82;text-decoration:none;text-align:center}#wp-auth-check-wrap .wp-auth-check-close:before{content:"\f158";font:normal 20px/22px dashicons;speak:never;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale}#wp-auth-check-wrap .wp-auth-check-close:focus,#wp-auth-check-wrap .wp-auth-check-close:hover{color:#2271b1}#wp-auth-check-wrap .wp-auth-fallback-expired{outline:0}#wp-auth-check-wrap .wp-auth-fallback{font-size:14px;line-height:1.5;padding:0 25px;display:none}#wp-auth-check-wrap.fallback .wp-auth-check-close,#wp-auth-check-wrap.fallback .wp-auth-fallback{display:block}.dashicons-no { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAQAAAAngNWGAAAAcElEQVR4AdXRVxmEMBAGwJMQCUhAIhKQECmRsFJwMFfp7HfP/E8pk0173CuKpt/0R+WaBaaZqogLagBMuh+DdoKbyRCwqZ/SnM0R5oQuZ2UHS8Z6k23qPxZCTrV5UlHMi8bsfHVXP7K/GXZHaTO7S54CWLdHlN2YIwAAAABJRU5ErkJggg==); -} - -.dashicons-admin-comments { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATUlEQVR4AWMYWqCpvUcAiA8A8X9iMFStAD4DG0AKScQNVDZw1MBRAwvIMLCA5jmFlCD4AMQGlOTtBgoNwzQQ3TCKDaTcMMxYN2AYVgAAYPKsEBxN0PIAAAAASUVORK5CYII=); -} - -.wp-embed-comments a:hover .dashicons-admin-comments { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAATElEQVR4AWMYYqB4lQAQHwDi/8RgqFoBfAY2gBSSiBuobOCogaMGFpBhYAEdcwrhIPgAxAaU5O0GCg3DNBDdMIoNpNwwzFg3YBhWAABG71qAFYcFqgAAAABJRU5ErkJggg==); -} - -.dashicons-share { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYfqCpvccAiBcA8X8gfgDEBZQaeAFkGBoOoMR1/7HgDeQa2ECZgQiDHID4AMwAor0MCmBoQP+HBnwAskFQdgBRkQJViGk7wiAHUr21AYdhDTA1dDOQHl6mPFLokmwoT9j0z3qUFw70L77oDwAiuzCIub1XpQAAAABJRU5ErkJggg==); -} - -.wp-embed-share-dialog-open:hover .dashicons-share { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAc0lEQVR4AWMYhqB4lQEQLwDi/0D8AIgLKDXwAsgwNBxAiev+Y8EbyDWwgTIDEQY5APEBmAFEexkUwNCA/g8N+ABkg6DsAKIiBaoQ03aEQQ6kemsDDsMaYEroZiA9vEx5pNAl2VCesOmf9SgvHOhffNEfAAAMqPR5IEZH5wAAAABJRU5ErkJggg==); -} -/*! This file is auto-generated */ -#wp-auth-check-wrap.hidden{display:none}#wp-auth-check-wrap #wp-auth-check-bg{position:fixed;top:0;bottom:0;left:0;right:0;background:#000;opacity:.7;z-index:1000010}#wp-auth-check-wrap #wp-auth-check{position:fixed;left:50%;overflow:hidden;top:40px;bottom:20px;max-height:415px;width:380px;margin:0 0 0 -190px;padding:30px 0 0;background-color:#f0f0f1;z-index:1000011;box-shadow:0 3px 6px rgba(0,0,0,.3)}@media screen and (max-width:380px){#wp-auth-check-wrap #wp-auth-check{left:0;width:100%;margin:0}}#wp-auth-check-wrap.fallback #wp-auth-check{max-height:180px;overflow:auto}#wp-auth-check-wrap #wp-auth-check-form{height:100%;position:relative;overflow:auto;-webkit-overflow-scrolling:touch}#wp-auth-check-form.loading:before{content:"";display:block;width:20px;height:20px;position:absolute;left:50%;top:50%;margin:-10px 0 0 -10px;background:url(../images/spinner.gif) no-repeat center;background-size:20px 20px;transform:translateZ(0)}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){#wp-auth-check-form.loading:before{background-image:url(../images/spinner-2x.gif)}}#wp-auth-check-wrap #wp-auth-check-form iframe{height:98%;width:100%}#wp-auth-check-wrap .wp-auth-check-close{position:absolute;top:5px;right:5px;height:22px;width:22px;color:#787c82;text-decoration:none;text-align:center}#wp-auth-check-wrap .wp-auth-check-close:before{content:"\f158";font:normal 20px/22px dashicons;speak:never;-webkit-font-smoothing:antialiased!important;-moz-osx-font-smoothing:grayscale}#wp-auth-check-wrap .wp-auth-check-close:focus,#wp-auth-check-wrap .wp-auth-check-close:hover{color:#2271b1}#wp-auth-check-wrap .wp-auth-fallback-expired{outline:0}#wp-auth-check-wrap .wp-auth-fallback{font-size:14px;line-height:1.5;padding:0 25px;display:none}#wp-auth-check-wrap.fallback .wp-auth-check-close,#wp-auth-check-wrap.fallback .wp-auth-fallback{display:block}/** - * DO NOT EDIT THIS FILE DIRECTLY - * This file is automatically built using a build process - * If you need to fix errors, see https://github.com/WordPress/dashicons - */ - -/* stylelint-disable function-url-quotes, declaration-colon-newline-after */ -@font-face { - font-family: dashicons; - src: url("../fonts/dashicons.eot?99ac726223c749443b642ce33df8b800"); - src: url("../fonts/dashicons.eot?99ac726223c749443b642ce33df8b800#iefix") format("embedded-opentype"), - url("data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAHvwAAsAAAAA3EgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAAQAAAAFZAuk8lY21hcAAAAXwAAAk/AAAU9l+BPsxnbHlmAAAKvAAAYwIAAKlAcWTMRWhlYWQAAG3AAAAALwAAADYXkmaRaGhlYQAAbfAAAAAfAAAAJAQ3A0hobXR4AABuEAAAACUAAAVQpgT/9mxvY2EAAG44AAACqgAAAqps5EEYbWF4cAAAcOQAAAAfAAAAIAJvAKBuYW1lAABxBAAAATAAAAIiwytf8nBvc3QAAHI0AAAJvAAAEhojMlz2eJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/Mc4gYGVgYOBhzGNgYHBHUp/ZZBkaGFgYGJgZWbACgLSXFMYHD4yfHVnAnH1mBgZGIE0CDMAAI/zCGl4nN3Y93/eVRnG8c/9JE2bstLdQIF0N8x0t8w0pSMt0BZKS5ml7F32lrL3hlKmCxEQtzjAhQMRRcEJijhQQWV4vgNBGV4nl3+B/mbTd8+reeVJvuc859znvgL0A5pkO2nW3xcJ8qee02ej7/NNDOz7fHPTw/r/LnTo60ale4ooWov2orOYXXQXPWVr2V52lrPL3qq3WlmtqlZXx1bnVFdVd9TNdWvdXnfWk+tZ9dx6wfvvQ6KgaCraio6iq+/VUbaVHWVX2V0trJb2vXpNtbZaV91YU7fUbXVH3VVPrbvrefnV//WfYJc4M86OS2N9PBCP9n08FS/E6w0agxtDG2P6ProaPY3ljaMaJzVOb1ze2NC4s3Ff46G+VzfRQn8GsBEbM4RN2YQtGMVlMY2v8COGai0Hxm6MjEWxOBZGb+zJArbidjajjUGxJHbgUzwYG/EJPsNDfJLFsYzpXM6Pmcd8Ps1BvB8LGEE7W7KSzdmGA9ifgzmau7ibcUxkB7bnHhZxb+xDgw/yYb7GU/yQp2NgDI9xMZ61sWVsFZtHkxb5+ZgQE2NSdMYmDOM5HmZrfs6H+Cbf4bt8m28xhb2YyjQWciDHxk7RGg2W8DFWxbyYE20cx/GcwImcxKmxWYyIGXr3l7MPp/MAn+PzfIFH+Co/4296Q2v+wdvRHP1iQIyKMTE2ZsZesW8QSzmHi7mFK7iWsziTs7mIG/gAl3Irl3Az13A117GeC7iSdVzIjdzGMXycP/ITfskv+B5PRk/MjT1iCPuyLAbF4Jgds2Jj7uOj7MmX+DI78hfejBa6+Kxmekp0s5TBXM/kiNg29uaNmM5p0c6fmMmMGMbLMZS/8w2+zh78lPFMYFvt9Ul0Moax/IA/s5P2+hy6mcXO7EoPu7F7bM1feSR25wzuZAN3xBasiJGxDSfH9pzLeVzF7NgxtmM0+/FK7MLrvBNTeZSXYlP+wO/5J//SV/2O3/Iiv+EFfs2veDf68xHOj53p5Yt8n72ZG6MZzhoO5wgO4VCO5CgOY3VM4S1epYxdYzKP8QSPx3xu4v7o4Fmdydbo4j1eo+IZbdaW/+Gc/L/82Tj/0zbS/4kVue5YrmzpP3L1Sw3T+SY1mU46qdl05kn9TKef1GL5J6T+popAGmCqDaRWU5UgDTTVC9JGpspB2ti4TOMmpmpC2tRUV0ibmSoMqc1Ua0iDLFfwNNhypU5DTJWINNTQGqRhFos0DrdYrHGExUKNIy16Nbabqhhpc1M9I21hqmykUaYaR9rSyM+7lZGfd2sjP2+HxRKNo01VkTTGVB9JY40HNY6zyGs23lQ9SRNMdZQ00VRRSZNMtZXUaeQ5bmOqt6RtTZWXtJ2pBpO2N1Vj0g6mukza0VShSV2mWk2abKrapClGvtumWuS1mmbkNZ5u5HWdYeQ1m2mq+KRZRl7v2UZ+9p1M9wFpZ9PNQNrFdEeQdjXdFqTdTPcGaXfTDULqNvK6zjHy+vUYed5zjbwee5juHNI8I++f+ca9GheYbiTSQiOfp17TLUVaZLqvSItNNxdpT9MdRtrLdJuR9jae1rjEIu/tpRZ5/y6zyHPZxyLvkX2NtRqXW+R13s8i780VFnmdV1rkc7+/5SKRVhnPazzAIu+7Ay3yuh1kkffdwRZ53x1ikc/0oUY+f6tNNxTpMNOtTFpj5LNyuOmmJh1hurNJR5pub9JRpnucdLTpRicdY7rbSceabnnScUbep8cbeb1PMPKePdHIe/YkI7+fJxt53muN/L1Psch781SLXPNOs8h74HQjv4dnmLoL0plGXuOzLPL+Otsi781zLHINOdfI8zjPyPM438jzuMDI8/iAkedxoZGfcZ1FrlEXWeSzebFFPpeXGLlWXWrkfXSZkffa5Uae3xWmjoh0pak3Il1l6pJIV5v6JdI1ps6JdK2phyJdZ+qmSNeb+irSDaYOi3Sjqdci3WTqukg3G29rvMUi3123WuQ74jaLfEett8j1+3aLXIM3WOQafIdFrk93WuQ9c5dFPmd3W75G0z2mbi8/ah/1fRRh6gDV85t6QYpmU1dI0c/UH1K0mDpFiv6mnpFigKl7pGg19ZEUbaaOkmKQqbekGGzqMimGmPpNiqGmzpNimKkHpRhu6kYpRpj6UoqRpg6Vot3Uq1J0mLpWitGm/pVijKmTpRhr6mkpxpm6W4rxpj6XYoKp46WYaOp9KSaZumCKTlM/TNFl6owpJpt6ZIoppm6ZYqrxpMZpFqrvxXQL1fdihoXqezHTIq/TLFOnTTHbUJ0tui3yGvdYaH3LsNDXlQ0Lvb5sMnXplM2mfp2yn6lzp2wx9fCU/U3dPOUAU19P2Wrq8CnbTL0+5SDjTY2DLXe95RBTEqAcasoElMMs195yuKH6VY4wJQbKkabsQNlu5O/dYcoTlKMNrXs5xiKvwVgL9RblOFPuoBxvvKFxgimLUE40VCvLSRb5Z3aakgpllymzUE429J6VUyzynKYaL2ucZpHnPd2UcihnmPIO5UxT8qGcZcpAlLNNaYiy28jPPsfIz95j5DnOtfybg3IPI89jnpHnMd/I67TAyOu00JSzKHtNiYtqoSl7UfWaUhjVUlMeo1pmSmZU+5gyGtW+prRGtdyU26j2MyU4qhWmLEe10lBvVK0y5Tuq1aakR7XGcq2uDrfIX3+EKQdSHWlKhFRHmbIh1dGGamh1jCkvUh1r5GdZa6E9V51iSpNUpxq6d6vTTAmT6nRT1qQ6w5Qnqc405U+qswy9l9XZFjo71TmmdEq1zpRTqS4y8jpdbLyi8RKLvP6XmvIs1WXGOxovN2VcqitMaZfqSuMljVeZEjDVjaYsTHWTKRVT3WzKx1S3mJIy1a3WN8fbTOmZar0pR1PdbkrUVBtM2ZrqDlPKztdlH+Vt6jAlb+qG8a7GJlMap2425XLqFkN9Rt3flNWpB5hSO3WrKb9Tt5mSPPUgU6anHmzozNRDTDmfeqgp8VMPM2V/6uGG9lw9wtCeq0ca6i/rdkP9Zd1haC/Wow3txXqMoV6zHmtof9fjLFRH6vHGWxonGK9qnGiUGidZ6EzVnRaqR3WX8ZjGycYTGqcaj2ucZqFaUE839N7XM4z7Nc60yPOYZTyrsdvybyfrOUZe7x6L/PPnGu9pnGe8pnG+UWlcYDzzb8iLsxoAeJysvQmcJMdZJ5qRlZmR91F5VWXdZ/bd0511zEzP9PSMPKOrS5JHEpJGI0uyRbUk27KMMMuitVU25lgW+cAyuGt3f17A2Muaw6bHwMIzC5g15jFlMNcaA7vAmp41ZtnfW1h48PbVvC8is46eGZnj97qrIiMjj7i/+H9HfMWwDPyh/wddZTRmnWEaYbfj+cl/F4dYcErIc7BgIAHDv9ftdDtnEASbkL7ZRS98qimf8DXL84pOsbr/qTWMc6Io59OWVFC0WiVfkDTFUbEr5kQX/8mnmgpniLqtmTzGQ7gb0rGH4Q5NKuTLdU0pSJZZUDHOY0yKFpfvV9CvMCpjQGyziBwdVddQaxvZbYyY7uVO5/Jzlzvdy898EP0KjXYuv/mxzvi3Pvt68ih9fohGTJph7GjTKyBHWEa4Xas2T6NWZ3DoFYteNIjcYhGNiu4VtzgY0MMk7y+iX2fKTASxTrsTNsMmruIN2hg4aZJtRFql20GdbvLv+cW4vdBvI4RYLKqYU+or9XVPVZRUyg/8SMnUcjl//ICnYlHgJT29YkoCVvOrC+iHUqwoSIKEkODnc7WMlgm8IMOynpI51lipj39AdxQ/LemylrKkak3J8VxS1hHUM2SOQT/WBOzjUMBurd0McdhthrV21OmGXb/TbUeu53d97PkR3uy0mlXB8dDoONYXOgte0At8OOq42xWMhU7o5XuBB0ddOP6l8urqzurqKOeH8Q30CT/YTZ44flzQQ5LwArltZ5UUKUXL9Qvo5xmJ0UkfICgWlMdvR9h3K22/XXPRMMx99KO5X+i3hsPx1VEfNZPzaGF/f/+lwWD6nq+i/8x4TJU5DnFoYQPpCAYs1MBATRiW28hLkVMyWh2vg7sevWWNpdd8GMzeJvqsaxhu6J7IP2uW18xnsU5OTvz2PxctX/xO0fTVZ0VI8o6fWIb7FtzjhWetyir693AP3KjjZ821svlsnpwYxvhL/1z0TYRpGNFUT9eXZ7dWSLE5WvZr6BpjM3lmielA/7RbzWUU1nCtKsCI9KLKZifc9Byh2mx1/MiKI9EmNA+G7pqcop6hLFf71WXZMGTEKMYw12i0m83RgISBgHv9KI4dXpGNKDJkOBifbLbJXeH4L+nd7LvelXuExqBYUjzJ0G8yPKPADHOZHIz2BrPIQPch2lMGCtswWqCjfHJeilMbPgwtGpArFdKNb37zm+3BINj7+n5/t4XpyX+n4XjQv4r6/auDFmq10H1PPGE///zWQw/bly61lpf3Hn88/fzzaRpGj1y69Ah8dyL4S8b076P/RtuN9jiGDjfYGoznDkw7bzZ8fyJrWdnCPfVjvWYv+6tprZA5dy7UHSfvOOjnsufOZgua+aD4ePQfG68twK3fQi7knckcJ/QhRdqia1UsPnIrVjREzPhwdJ2JBqg3Pggi1EvG4GfRLzMYWqkGcWiITpHF0Dow14GqkG46g9qtbscnFwyE7rv/2P1CxuF+079W0kqFzFNlpewpZSx9FpJtHt+P3gd3YN7xW4VrriaJZcWDW96QLVQvQbKdEe5PaNgfoD9mYDghyKxJhzWZSJTINGOiHHY9Os6Rsv6D6+6G5Vi8trZ9B3ayaU/W5LSB79hedzbSdppHB2s/sK5xEN1wyS1GWtYkP51x8e3bSfp0zo3QFRgXy8ztMGqtVrNWqQquFY/YRkSG7DKi4/M0qpFBugXV72x6rj9/VkDzd7bRyFDGB3QM9xTjOpNVDEPJirI4jQwCcjXACg5IEon0UYukja9C+F2GazQFDFWHyMsk8shNKZN5N2IRrB0R8wBzGVaAqo6cItrcRq015OsIr6Gw021WsQALXgER6t6EZux2Qph7ReRvdrpeClK7HZg/zRDuhgMl8ckS6cGITAG9F3Cne7j97Pb2s28nwTt535RWSrwh2YLEsaInNyqcqAeSXpDa60GR5QwO/x92iuU5JImKUMAqdLaPc4WgYpXltMln3DvfbZQk00McyyRvheCjVh6XI81SBFGxJA1xWgbZnosUxcgG9omKKWrjrzielrUlQ8EplktxUr6TFnguldILS0iqr4Tn0JsESTM4RWFg1s/aaAFWjlPMG29oJRtinS40BtS0RhpICGmjkVUvJO2jo2YXmsrzyaXmOnLXYCKQxvPIdCUDFK7FLUf+BZc0IcS2WeiAuTZTeUlkeV3lUq7Ga6JTNNQ0JxliKFsPWTlWQk7uQmpTcQRsBxBWNZ9nWVZjOY7n0rwoaBiX/BrmIDGFrbKSYhGbUrx7X3/M9eebcPxLWEKiyIoFQ0urCPE4lTJVhDmfFwsZS87ZXAlaS4BLLMe77xQMSYYsDF7UeFbiBMnzcx5b9FRXF6DAdU8xpAa09tqWZTptaE5rrk3TTIYpAK1YYNZgDJ5gdpjzzC5zkXmYeYx5A/PMDW3NR55fa3bbMLIAXvm1dujWyFgjIYZvJPiRW2v6pAlDWELJ9D+N4ABXyHUYpPCGELoJQpKSglO4kzyJ55p6/Ndnkdg1vti0RV6V2Mdqtwui3XyMlZpnOaMrBo9dlB4l1565wEP6ZQTpKfO4yCLpuJFqrqn+sfL/8tXVcnlV9TdKf+lrq+Vj8038f9eqlR+7z2hoeq1aO/8N9xla4w3na9Xz9Ur1wvnqbffqDc249x5I1b8hSa7Wq9VKfa9e8JbPFurL4/9aK3or54q1JW9Kh2h7nmTuuGl84s5kbIUwKEndaSQeeHS0wsgssnS+kqGKJ3fPtUjwNGAuXUqrvMilMvbpNdYo2Xb/LCBRjktrupgXZFHXontdG/NVuRMoJtAkTeXE1JGx9fndlapnq1jGHAFfkrxoq2pu+96Uk81nChYrcDbisF7K6apsqvfV1pqXli1d0hVBlmd49zfQFxgHxg1DAE6yqjRhvmAfIA3vJase+nj2Qvm77E7T/pimbZ4t3XXHXbI+/jD2DMMDBJTV9Y/Zzbb9L8rnN3XlrjvvKu18GhsE/Uzz+RlY9xxY6xlUJQ2yDjO5s+l7CdjHXUDbBTqDq+RiGzB3hBjH0CSBSwmW07MtPgUTQjWcC4VOOVerHrv/WLWaK7ZLyNYVW7e0Zr5czjc1S7cV/dx6tZPfwRIviryEdwrtygSffwHquwXHJmE0CKILm8YU2QHJIFgWlxCBr9toHU0uzI4Avj+j+2njkW2T41Kav6Zxosw5mllWXjl5SbtvLS3sfFAVRN5NYSWluT6HZdYIntR5AX1GEwT99QHQwxQGTKqlZIFzBcxrr2wL6bX7tEsnX1GrmuZwsshpGz45GKcfUhyfFF2gnYbRb1F0WwT0vcXcyzDtShv4AjZcY3G74ls1i9cJAWwDCoXx522jNehZD+gfjM5tBHO9SwhqkRDOW6QhZvtU67zjpHffsHmdObyKHta6gSqaq25g38/JmIUVBF30o4zAszLPLVRsJSVLbErncmdLgsBKAt9ZDdI0zY6w6dkPvKm1cVtGw8F4iPq/EdiaID1hibLW5VNIkgUkKk8akoBkmUdQXM3iWUHm/K6t80iCvJBQtHI8yytceYoTrgBOSAEygkXFrrQrqF1xMRx7qA95RACkaGQAseGwH83G+uQ5QBcVyydPHoyHMMyuMwckgFv5G95vAB6kediAOhsRBPDlJ3kdHqJsD/7G1+Yy3IuG0X70NcpaQNOyQqZHizp5Zjh5pgsd2k3yPdwfAZOyD+hkfPUK5DKXx/T+Btwfwt0ufNHBfmv6wLWoFTGvXj9aL8imFlGIHZevB+HhoNdLyrgfDYd/R91c0qoDWq8oadoj/RDjpF9DP8eYwFvdxzwKJRZqMOXJKh7BEg/TrNuMuX/AcQnPGwJMAoq6eQYR8ttuwVivEaLhRICaYKDDNexWAQH4ruN1XU9nARG2W+jDd97/lsspjl16+vjqgw0eL6dDI4VYw0hjWQC8YhhfcRd0Q4ZJVeU4nWP5XC3dyJR4vAJPuYEmppaW/Ry7cInlJEvWjG8tdRCXaoRBFgkpX+RUJMC6X5M5xGqNFrLSrsyyJU7Scj3ADRmF1dM1zPOsZrCaZfKmGGaUbO2fyWo2rVjmMsOIU16atKMJPFEWaHEFuCI6RslIwW6U8GptwLpd4K3dyZe0+WjcR3vjq6h1rUdY4ZNucbhH/0hahIZwuRf0epSfjqKimw32WnvBXjDpw2uzsYMIk1yxKg3CYR2OW1n6dDBEw1arB3MkCBIaegXKKxIZhwUcAhDKw1Y/OjiI+lCYUT84OAj6zFQecgXtkVFnEylAOBgM4EbUHwyyBwezewaoRWYo8DhosNdH0f7+7BrhCURaNpoVnuWBgiTb6b17cC9P3kNuTXJBcZ7Te3pQHpZKn1APhvPe1x/Np9uuhLRSEYribCaVO5oH4YF8PKRZJDlMrtP3A8CGyYr60/cnbdaoWbQa4bT004xuarMG5X6TCgxvarMeyecM8g/2+gfD4Q3pCEco2BtBHae079MwroDTtr2YlfO9WIBEVgmSoBOWhEJt36OAu0kQ9e9hFokqm0qrvl4IZN8vFng+W1jffMtl11akU43mDm4sSorI1xcUBf1ECnNKWjYV0ZSCjKDywtnOyehksZRqbyxF6/c73idMFKQ9RxcKlj2hR59Evw6UKAPlC2kJfbIA+6SJ12FMYJ+MfsLUhZMItJ/fjRp+F4e1b9D1Vmlrq9TS9ai8tVV+dOnUqQdObS3HEqRzlfbZ+s74z8qdnfoO+mfxfeT+cgT3/+KpB7fg5mwsRMqfUL/3xHee0D54ImmzX4dylZglIg9gdZagO8p9bLNrrE4Hmb/N4ma7u0EkFd0memzzJI4uv3mjvqktSQvFxgMXQn717gcu2Mdekteyl9+8LaJstvcC4tBPwtkbTuIgfbKeK22aNr0Nbm5m7v1gZvOk8EdY4V988WIHsTOaPQLqKQIuNQFHQf/CZOVxFEbJl5AKBOtYfzzid8SI38HwFccjSrtHe9ksjCHyd53IF2MsgT6PPg84YoFpM+cASbyRoKIEruKQoB0ikY3FskB6IblBZbFwreUTmEi6gkoHZidCtZtgSALunG6z1gFcAo8ChiQUXgBSHTkEVaInK2mP01Sd812loe1oWtrQ9ee0hvIRT+fG/zMSTE67y+QcQXiO1yX+OUFbmkQ5/RMQkYXnBD3FvVkWRbG44KQkvZ7VBEtkFcWtB/UsSnNekE2pluundX0HOADHAG7gLZr2MU7XT7R4XrvPFPQXBI17q6Bq3HMCWhLIgcYvvJVX9NRbgHgbb5btpbyIFUkLmpqAjaLipoNcY4Yr/jX0jUAkJg1YjmqwBLVblC1YQ1XBdQBmFaCVSIetIcS4xX7xxaUqAt4x7Zt8dZnNuyjyC0Cb3eJvbNW6MiuximXBlBK7jeN+KO/siM052jAkXB8iazX5EqFeBfKroUGvD6uOjvq6gvot+NOV0UjRp/Laa/Ac4Pxuxa3A6mi1OhHQeiLR6loE4xNJy2aHiqBg6pTJUTGMbWA94NOLVkuoVVodDwHVP4ICgqvHhzwVnKPp+2FCo8hK3r6FrBp5e1RBwyh+5+EhkbCgAGDX3tz7pu1I3nECxiJjAxyB8rnwOSr3EWoTAVByrIaThDYVAfkTMd0oWi/6+cAtFt0A8tA0CKJJJFgtR0PZIBwKOjyIiuue1ysuFUmSfJyjwp9WHHLHyWEvW149OKAMjZHMHbJmS4zP1OnseRuUmXR1t9PuNP1OE2oOk8GLNrudIxxkqhpLdoC9idUL3dm923AVGKFOd9PBG0QgC8QYLpK51N10McFDRC5C2CcBw6vpC18omTkO4ccE3TVyHBYs3TO01e7j3e7jz5Ggu3B7lrO4Uuvhpx9utR5eFXTHDDiZswyn+GjzfMbyMR8UzaKt8Szp6nwG81kvqBRE4XgtYxpcfmV1c/2e9fV70JNL3Ubt7Z4gCx/JlV1rJe2kTbSc5APB+IVCjnf5Ns0IgrfTu2yPrSOpnGM5JH9T2t/2bKyzqRTiX0wvV8sriqyXuML6Pa+7Z500a6KIgeGgAhJqAq06xewyj9+gjfHnmxQfvYKLMFbwNnCQTUzGARkPRP9A5RxRi1A3gw3pCghgdcLOI+bC286ff9t3k+DCuefPnn3+3SQ4t/XU1tZT30SCZ1y7FOpBZeVyaWVle2XlHs0xVMyzbNk1sqrU6XQaviXyLMpxItZVU9FYJnkhBFryQgiyyQshWFHxRjnwhIVcaSUgL91eGRiCqaU1Q+3kHXiZ224j18w5vl0PfJrfhHZfgbki0hm9GNNuuxVCq0B9u5MIbpOpUIgT5+I+UKcbphE8MFHFbVJYsA3tOtE2uXHznkZTdd1hVjZNx9gL6BzaiydGcuhvLPhlL/DK/sKG7S6JtqfaVaJFEpcWDkxHXZIqtmYcu/j6i8d0wy5Ljqc66CCTkwuuacjJ8b2PKIYpHw3M/Lp+xvR9c3eXhGf09eOer6WwxAkCJ+GUtvoWIWWxAD78Xn49l1vP93zFklhRSgkz3oOsoz5TY9aJlHkiR25S4gHw2sGU3vAVEtYqFHbPxxNqBDdCSHiMLn0DunTF9DxzkfXMwPTYRTgZ/+85IXKdKFAM5ToJtymVySe35uEE9aCxME8qxWPSdnFD9uLDruEZk4sQnfAMA6iHDr2/ypxmzjLnmTuZHh0DzXUK59xkJMyfpqgmKB4FUFs6JubPw66LzyDXQPER/6Eqaqqii6q/6g1VUVdUTVS9Vf8VQ45IdSLZGNKQnh9GwBomH/QmM5t2LctNZ82sbWePnI3/dkQeGZFXTGMfCSL6DzglaMF3uq78FNRznWpkiEIG10IhFov7BE/4AvbbaywlpmSF7dJlF2gw+u6qFBiR95rcbV7HCKSaZbP8Yg4bUbCqOCvbq7a8FrRNKb/IszZ6In1XzQvYwSCV82p3WxIyjcoZ05OffJ+49ZqtWg0C8QOvF7PmTsUwETO3Xo0YjeqLAOz4wK/FiNoOuyGGDyBXDGwPYo7dv1Qe991cUC81R48/rpwU/lCNxMcfln/gY2i0Uy6PD1HgZJy86Yy/4+7b5cpz2jdmxNvvVJ5+dkoT0RfRLzH3MA8xTzDPMS8y38F8ANAGUeKtI4d0sJEIvdsT+NUlgxNaCNqDDtFooh1JjvFAjm8g497zw8nS2Z3QTaLFJAMDhhGMEz8eLXESzJPO5Nyfi6Nf8FbP+KIqpSVbIpyApIr+mVXPdNI1lq8EelPiyJoMa00LviTKSaEWVDm2mguuSSYZ9A/FS/N5HtYm+Ka4gHuNxO3CJBd2BfzILtG5kKBEcQgJ/sbfWfW1Zt41RYUXVNF0cw3NX93xZU1eP6nq1ZMuLDuwxGvkWS0O4ZQ1BPdkVVdPrpvWU/F8i+LDBzgVgA+f2hGwCAhzCyuiqOAohkMJLTlEf0TXKTIHATtTxEygMqxDs5NOi5g1kI6aImPPwfz81IQGRYpSVt5PFHLvV9BptaS+T/VJ3HwjSXvjGlHlvZ8E4y8roqpIiiA5hlhFv6Mo71dLPrl2WonvgOD736iUfRWeou/wS+p70jnbteyMHeh+fiq/eRl9gXHpCsKQqUREr2GXcDmeTway3zQQgTCwWgKxCCn2wB7KfmN6uflAczn9gn6ieSbKamo6WN/4pgyAtoWglmnuOIG90/R8M0QXf6Pu2bZX/0Imh+6ub7iKId6lvmOFy6653x14q17AF1zgZyhdZpk5mZTP5IDzqgE/uAyzP2K6zBZzhmEIYvVr7Wjyxf+AOJGYUElWP4r2WsB8R6NXj/SJwAr+WKZHDtGA4OnWII7T8HCfxOZli7/KNJg1qm+Pp2IN+y4O292wGuumCBtAFk8CCrsA9SiAaaIDzcooQdpeNIMgveza2YyMJZF385X1zQvbJfOgHqqNVkMN790pe0Vd5FIrlV4+36uspDhDlUwtY+1g4BV0jNGLJ+85duy+4zP53K8yAZUUE9kKnqAeKMMWonpcWlLCS4fT4lw8HgTH12F9S/mF4nJYDJeLBT8lOO47F+FvUhbE9Or1nuo7DX+bZI7gK2z7DccX0ouL/+ekGNNyjKActzN3Q+uQpqkRAUsVC3F7dD1SlHYLmKcuEUEkIIOQNShTZ9KcIVGdxv8wZXwoNBqaWb2EspcvZ08WskG5ura4uFYtB+O/MhqczYsqLyqGnQHWTeMaJUfLcBxiBfNZU2ARx2U0Z29ra+tQF1KpzusuHw+8E3eIooAR9JUo3tE5rwoZK6jwgoB5nLJM1RRULKT0QFP8ghmGZsFXtEBPCXgleOWV6Ti4hgYwgksQq8zsLU4jAKExiCCWQJDkuUT2TMgf6kPI6+p4qOq6ivqqjgZFl16C4IAkDhRdVxiqtKH2A7GsZImi4/PMa5lLzOvi/CbacuC/mqmbpCYz8cnXuBTjQapXnyZ2iWxhcJ2hBSThoWbZvp3Wjhx6WhoIDJxNDukgnX7O9h04rUCib1vZ67Cqo9F8ZcffBhfgcxluBJj7UHw4uCExk7Gz/vdoaUe5RILjSfpDpEm0ZC3+EtCN0hF6cRsdc/cy98d8qXV0DXRrFBWRvqkK/lzcJis5kIstRMThkYtviE8oC3Dc437PL/l9+B7GK8NBfKBkBpjwPSApyWFICQsajgdokCVwLkvDHbKE7ZD1aBobfwuRm1+jJCdLiU1Aw2iCBW6u6z+sfu2K241VCvQb1wMwaB/A5y3qMWwNSbn30d7fUe5XDg+zV+gfMzcfRolNDWBnGJ90EsTygW6UmhrVDO5WDVMZP6uYhnp3rx9RId4pmOHq+DeUdFpBa6oZjQ9OPXgKPvP2IsSWhtjbkXpYNVxzuxPbpmEPDa5Fg2ul1dUzq6sIyDaMvqB1OEpMxhKbDfRtgKhX6FxiGk6i8OzW1lhCtWsTdEwbNIrDuB0rVMHmT5lMtAMtCA14eRGv7VTD4zhtFx1NbGzWL9Y3G6LmFMb/QzpXcyv4E9B+Jd//KHAJ8MRT1cgTcadZtCu6k200suTr6EW3VKvLQtknAww+Ezz8x+h/EK1fN5HeAl1M7EO2UaxXpclNCgmbVIabcHaYGlRgYi9IFYRHokKUvufC3T1b05S8bsmOKWmeKuCMVlJ9N49QvaaJMse5Ws4GUq+noctLxYqb9pfrHOIlrr6SNhdKHMvLXDFsWOkFs1qK2mWvUijIImfpHAZ4Y2IuhQQ97aTLnKcVlBNphfV0gDKqKRlmRpJUtbyaSUkim8qs5ooLHitjlnXDO7bOMsxMXzECxFWFsc90owln1rYSRo6M/gqu4ckYiKaD4XDCgFF+pacYaLd/qMVd8Fcm6TiPCngUxNBDdLDnQdrkMyfnGhLrLbtC5psPE4hIzPoHrSsB6sH46rUOZ7wmKWuBacIsPU70OVQoUaWrF4YjDjuzczQpKD81zZtE0EglUNXUntXKgdBJERSr7qJ9hYLk8X9SiA7e+P4YM0doS8joZPEwssIPy2k9lCRidqr5+DvRIIa2B0f4y+lcGs3rEOk/mVOjvagf7cWKpGB8OBrN8T5lZgNijoCtCmE3OpSB9qnoipySo1tEKQt7iZghJLo+jEaaMn7Hm3hoVtSAZRVfNjwT0IuibTwoQEcsKjD0LqKPKg43/sSPSjIhNxxvquxH1LTpp1Ip3h7/S1T4PrgCTDebxuy75nEY0c9QCSkwhW7oRlPhEGI2Lh4bXdm4+OT9x47dj5iDYxc3hleOkZMnL27EfDXLoDFgz1Wmw5xktplzzAXmLoKOPaoogVkkEDRPBN3rKBFzA49HzeLaa6gGM6wm+EnHbRoIkBU++kUbNaOUV50sQimOrWP8VdEVfxnjP8Oup7/DAGjCskjVJE9Vc/eLtIt+KP2D6V+efn/A/lz6B230V3WWwJmMq+bKel104QX4l+FVXxXP6S8Zdk5VPUnTUIpNWSLtZwueege84aW571zfEz6mfoOczY4lbLG0DZgC7APLsoEdxBx/Xbf7uudJcHzpwtLShQdIkEml0Au9LNRslFyEYLyfXIXgO1MIdS6++CKvzPPQQ8CGZYbYPLeILBSTgErN3RjMAB8adgkf/SJ/aqmwoRpK0EzVVtp1BFh7/Zcu1teerKPAkJdOl7N8Iyezwma13ulcaH3gtfW119fn5m3lVXLZQu1al8xlSsdvzOZS74UXdh+BrG7OBK70IKN52pCDY+vVq4Lenjq1VNzQZW2uEqsoSFn80mngZ2flvz2a0pFfR78FfXMnc5H5ZrLSUeUCwWik3JR+ABV0CblI6lJt8gQwd6iomTAePiH1XWroFQe+12k3G1N8Rwu8jNzYaN2jGgtPoAnkCpEeVJv/SpRVCTCwkTZYRVUV1kjDoiAi2VnLK36KXauH95cKWSwWyk+t5DVdFRSFNWXTcPzU+K+XycJ9SknBQ1gWJUmRiLxZSxsp8i6k5SWJZWWlgHlN0bEti4Yo29iQDf4Zt1jAjeWF16TTWi57d2OhWDf8vJk2RU1CuiCzrO8ET8bI4EXexrqi8bgAr+NkKS/y8Ir4dbM1hPQTBh4TRl03AcyNmA2HlZ2qRKKQtK4LLdkvekRnMx4V3QM4/H7YbofLGVtR7MyAkNknHRKOogc2Lzu5x4LpuP499HuA0pcSucBUnRZLBKhdEZ/YLPqxgeMZFKLPOW17HeYrdjEeiI6YFkVjzR5/ryMJMi9aaddVV1Tbeddl9DnbXktjnIZ7B6KYxq5ordvta44NN7hu2hJ5WZDgxjm6OIhtX7qRVbPh29sn5iSxrQbDHFnfBBhlDbdrAfFEzHAI38ceG1997LEb7kF8G1t+G42uT25CLbiJTeSTwyQ/K7JIfkQ91aOmKOQ7zY/cR/TlGoqLMiSq7CltuEJl3Izt4nal7eO23+66FTfsuoMIZff2gmh8bW8P9XrNj0a93WiYHGfl3Kd2DaQmoVuzIrdLjAuAyx+h05fHo8uXX3wRRS++OF8vYnNDauW3ocxtPBoOye2foVV78cXxVXL35P4gtgWwI8igFu0NBlAUgpjn8SkP6//5yT0NOvWcmIslmpxONyIrB2FxiRiTMr01eiWWvU8vRERwQHM4L+sZ03XNjC6zKSnFcjyyrbKlOarKcXII8A1WEJIuiaqoKBBIHCfxyNLzcel+l5PTQe11tSAtcwDmZFZK1zohAAaJk2XuPQs5XUQSL6UEUbWWLFUUUpLMs6KeY+b3FxApzXGCme3KBNcLFNcjAEaNVoxOyXaCmOndjBUwcTI98XHFrRxHL2tOWh0/r9g2+nZiEQUcuqSnc7pK2M20qSmiwPNQFNWsmyoU5o/pCDq0lfHvahabVtGiYo9HZOjsyTKVoV4h3PKeqXmmY8LH00wRK6L024SeitN+0RgPOChih0w0jncTvSjBZ3S1A1pgT9DXzVASd+NNEtNNFJXplZiZ2ew8gXbcDF3+Mp+K4dmjMTz7TzFoe+nrAMTtxXG0HV96m0GNKfu5czW6uh6vnUPZOK0VI7X48563EdnAcnc+rRe/ipnTTYqMA/U7BjzwvWRVn4h2gYUltmEA7dq41enW4tr6sN633VildpqqJWEMzieRIRmtEXNBmob6MTm3KFvaymcCQFYPXYaA6nWOXfTXgslJZUW+HDhZ7uyjxy4iJibTsQgtCoptR89oduFPdV/vaRkdTnoQfZOgZ/QenEBSFATaos8WbXJhrn4yrLRrgNFuI/jM/sdXJZo2jU+b5fDvXZnvi9tgiUgIUf8fWpW4IQ56u7ukSvP1Kty6XjdXA99Y1VvXi3Q5Dif1+sjRysxquXFDvaBve7uzer3jSEX6R2s5uLFeQOppxebHoworLtmRdPv8eHSPjsOv3Vc39e1kHP6T/datqzep08asnnNjMLh15eZ6aXC0nrfspzv//+mnkFrI/YO7yVy+K3359D+2n966Ak9vz+tGVVqvM6SP5sD/TS0f/p0JlNuaFPrviqK+nsmRYkJweLTM/Vl94KDvkavwTQ5zmG5ELSfrsxVpAmgr7QQq0/WJJ9KvCPdQn0gEBhHZFQTs/gDO0MPjq8HhIdkzdJ2RgezKQUAPRH177cqVYX+ebyFtlbmRYwrn9X4zLumne71o8jnCHR3OXWDm94hhRidWjxE1zfXJDI7aaC8aX23t9waDHuCk0WjY2h8O52wlfx19nuzIRMTGhAzGyVZaujuhGAvbO/EOrm0YeGRnG6zFnSb6abVQvuvsome7fNrAAPEVwRZ5XledQOSB3xZct1sweMPJp5csQUYve7aTquzUC13XJdt9eDlnqzrPi46gmIIi6K7g2h5b2jElKTOzF/499AcUE9qw2vrddRb7tu8JBkv3sX6k8smqUflk/csPKEj+fz9Z/3NTrXxf5ROQ9ok6Wn5AKcrj+if/pyKlZjj+t9FvA75KA11h7JpVadfIrDIQAL12t9M00Bnk9wHBjtBTFTEjQc/uYXa44791EQ3GBxG6rSKyOBiPhn0p8z3+zlsXJ+/9CXQA8zvZQ0oKCJjdI8w80eqip85LCI/eWxzh3On35t+z9978e9EPn5ey4ucL7/m8iO57X/59PwVp0zk1s7WmVltk/PHJEfWvoiygnmx8AJJElFM0ZL7W8/7k+egwsUPv3/T4qz3vJ/mTIzo4PCRm+TS84fGkLd4JmNiAFi5BG1sxO0j2FhAGF7djARyONqk9xPAb26eDohds3Vaq5YNMEC4eD/KQDG29WmlilgsLK4vvvssK08eXfG8OcxP73ijG9RExFjscDK6h4bXeXr/HzMsJeGppTq17bbJBAx/2+9nhsEdD1O+TXb3XGXqY42euUJ4c4He35nb9ShcazweEj6M2DiuY8DgfOHmy3C8/Me4/AYc4joYQR/c/MYbjXvnECQieQP1JfGqL99FYZkLkXgImwnSK5qlQD2YbEa/HWnmAxcxGlNaX9l/XsOwHP/CAbTYe23dVU7Qi9E3d9kYtl4P1qBquv+be+25bDytwpiuGWdlod0lW/LQuRN4d750FnsKtQaZhF/OkLn7Kx1C5CqlleDAcDvZKx59Ezl7pyeOl6taTpfEIolvE2rhfevLE7f3SiSfR7ZXHT5T6EH183qZfjTWZM/IPND0kBnbAqBLBBg4JGoY+BwbWxYkQoYoOEmIOwfcvqJahGJpXMCuNUsNwdbGJ9ayuZ+eXBUXRXeD2bdmo2MWs5RuKIt0rBCqQ+ilWv5aMXzIbParNrBIZCLByRBsTEaaw1iDR5Bslx95h0O9H8LnOHB7AMA/6ox4Z4kE224suPULgZ6/V2o0ich7N2viGvREomW0TXUk8a8jWiMM+0G6YNjD69qiqprXfn7Ph/hcxL4lgduBaN+rCF31L546O8aMmDWHSRdFhazpPR/Pz1AbWaP4/Fr/Ofw8I7qYqoUR/fm0qv/0a+nNi4U/XP3d+G0H89V/lGtF4VZI42RUAte/3okE0aME36s8njAbZEcpCFAHbPOj3e63p3+DatdHBwX6U/O3GqXM6Irpyo1o83rYQVVeR5Zou5TROkZIPLHzv58vtYrFd1kzbjD+BZJrmAI1K7TPt0r5smjKKSDge0XgPbtm72mdmtnNXoG3uZy4zTzBPMU8TqSCwpDCHHYOsuLVuwpOvI+KBoSoQDwcdv0kn9wakwwwgUu4OoXs4hhk+NTskeLUauqS4rdRml7wL+3w0Gz9okDJYIcUv3rFSYgWWZ/mUgkUeiYhs+dwQZRXWUlW3dZno1JEp8KoIHDyHeJlXeMzLoRdxnJOuyOO/uEb/UImFl/Apll9Mp4speI6XOY4kpFhR5j8mcgKv6ByWDZ7VeJ5Np1iOg7U9xad53VRQTby3n9XCYAj/8+0j0l26K8xF5uuodg37Z4iBFSE5wDtSC8GYPGB/mxJAWCbjy5RC+ARguBMMBotEtQntMls/yObSIVRDFdGdh4flFc1ICRw2LFnFqqCoQiplZGFZqtimo8tY5g1Fw1hXFQXrWEs7nqbJWgXWvV4/0CQsn4+CD6WRCvVUDRWzgqDzgiBAPY3A2AzuVjXF4FOqKFiCiVOcLViGrCHE6lYwoTNXbk1nanStxDAN/HbUoAQg/taS40EfZnJACA2aIzTDbJbqbG9FaGZ+Qip/nxGPBv+h3C6V2mUFWHzTIQZSAYxqMth32qUPUYvqiNhIjqlFHSJqnSlNGQFV02FmrRAkAxO8O7WP7t6kjiUG6sTBAqGh6PRt15nXnIplF98XkhePhyQMddRqXd1toVEvCHqJCimAq6NJQaxTp34Q5vvgpjJs3FQG2yJSZ5pWmxkvECM/+ER+Fz5HCvJFkv/4qk7LQ/A7NGgQtDeAqLeywZEijUdxWU6bSdm+eGUwgA+UK6Y5vwj02SaWMd3YCAawMNGDJtvQbpH2F6bipA1htVbbqi2K/Gajsvz5I0nCRrO8/GN5R4fpV7qQ3sy3tm5b74aVm1LmcP5PMQ6lez6RuydapdMo1isR/yLraCY4Rs/lTfPfGavGCcMgh3d9RBS72MM/hHFXdNF35Q0fUOq/M83jptfx4RZj/NUfwi7cgz8ieriLGeYfTm9LqP2Po7ejPpHxTuwVfo0iyHVYh04z54m0jQoEu82YZwZWpK3Htrg4CmHFhPXSfRWsSYhzaeLjgerUQvS9kiTIkrNateoVPy06kp/Jfil3Incyp291ukHBsDSjUHY8y9DN51Z0PiU+lbUsy8gBzgxGffTv2RTnynY901zEXorLHy9++3C4/Jah75oWh9i05tg7y7KnBAuWEtTVjPbBwSgY9qaY4RfQPcxZ5nbmXqCWl+gukK5LhbhhLbYUBsRZIx5YyO49GNWAUagI1IUujwgl3fTxGtQfMCSQRbjQwNE6EqANKN7CG7Uo1sW00AdlS0n7lbSRyvCFbLeeyRknjVwmU83k/LXVtCJhA7MVVpDKa46EbcnVJPbuu1lJHf8FnxMF7vmirJvWG1euoI3AND/LpVzsWAVRdTI7O8vLO8HOzk4KnnbgMVNN27KbEgzFChzZeFB3PNNcQqIvv2ZZzc5kO1eO4I7ZvsUb7O9mOxXjmRh/kn2wxDqmNYzxTDxG3011NDK8L0rVUtBqYa2L7j/2TKt/LP9G5WJzQLTRvfDtszVrSNcsl1oHNMnO/Yl2iyxKr3rycqz7P3Z4uHOLGDXNhngU7N8UmckC9tCArhpMbE8fxob11JS+7RIlej+qd9JOlCn+01LmEA2+pxHabu0D37taDsPS6k9CreM16Kvoq0wGkFsRZmebOQ6YbZtJvA8JOCSKI6AGbBi7H+J9IJEh9qncKPE85MdGp10+hPEGc8NPXBApVmc5JD6InNOWqBInRON3jYatfjQcjT5t2rXEBVH9lBValVUT8ZOL8DzxMKSK1lJIvBHZZ7qmQtwRnYWLo71+9H7rVB1Ol08c92q2uWCuViw3uUSqZE3Xuq+FS2M7LdJ6sKpaBMFHKEGdeA6B3ur4atfQsAcYfdi7zgSICbLDLDlcnQY3JaBREIwH2SzqZ8nfYBCQv2gaBJBCLkQ0IAlTe5QW1VHBcLATtb/XmNgE1SaRQXGpCB9EfH9B7HPxgSgWybEYX40/UxpN+O7V2H9Tbc6WMCSepoghQpVujiTD7QyRe3Q7RL2CDj1zvE/sItCe6VWEFPf0U5hPSannO93nUxLLC089zbGACP/Nv9FfPiSWFST4G0HhnngaCyn28Y2Nx9mUgJ9+glMEWX3nO9Up//1nUJ4i0foR7TAAiAZVQhPvCWTbaIklXpIcYE6uUqvGFoTC8ONEc8Rx3/+ulKygL78orvn/xXPFbyFH3737z19QMM8idPLjHIul2Xy6RnmnLJXkQVZQe8iIbIci0h1i0+T5bwBacGz8o8e+9CM8p1ji+78Hp+UUj4ZrX1yDzx+8hzMNln/DG3jWMDlmprcibUp8pBCL5xvsM3HNnbnCinzsu8R1WDds+0csNT9HNooVXV3t95vN3d2g2QS0V/SuEiMbCHp7RDlTFJ97GQAEDEDC/vfm91onvPuNuUOX3jq/198ql4/Nv1yYe7cNrVaClX31VvU7WquwDaOnOzXAO1LHg4Np5a6tFVumQsSt+nwJRvsvzJUhu9N01rZjqeyRtl6lnmhuUdupT6nmvD+pkHqcetW2/zNZTAluvoJNB+sKruRd2RexxApuz1X8b71VSw1EMSO5haqgati2hGreEVhJlDKKc5fLp47Nt+N8uX06Sm5uw5Aywt1XHx3RAHjiW3ZZfWOwVt07Miom+CHWp2aYPPWGdpPvq6ltWIUg9PkTdGjI4z71bjWUjfEg0Sg+NL7WmkUjRHcc0fvQd8XweH9/NInM2U0RDwRE5mwBE2ABKxAbLSFA2f3+Z56rf/zj9efQQexfY9R6rv4jP1J/jpm3uxJjz4cuGVrdmk109Ras/+7hKHpv/V8+HUXja6NWHx2MgnvfW/9X15ledICy0Wxv/ltgnXCJhQKgpBpxbbaF2k1qggkF+t27t+U7BMltZspL0Zkz0c/euZYW5bOpaLVz51TWNzoq/4/fc+Q1bqIGuAu9SQYm8um2eFpLl61iY7nd/iUJBvlIk8evyNqHt0PDOM4uh6vbH9ZkcjMzlR9cozbYs9VsTgcevxxROQpdyNp8cjzaDeNhtheMxlchoC7KhhOWZrx/7doIWEVgbAOqEpjKGr9EfXW0EwV6CbnYBbK/jtq9bKWy9sBapZId2F7FVNHLEcY8/URXDlK8qesvMUd9oLiJZ5H2xLmYK8Q29oOol615axvBci1YzrY3/GaEBuPBcCQiRGzjpZHKIowRO6Fpv0/bnOiZAXGRJk42GtamGw4npsfxcuFDF8T8RVXwYYwLc9fDVvOAF7NYga+KfUPP6IaPVwOgKuXVK7kG6zgQdRzURC9L3M6OgCfhA1aWpabyB2zWeoCTtOE+NTAfrODNmr+gf5ycfVxf8Gubc3Nusp+e+kCxcMUmIrCEC/a7tQBd3R+PdmOTleFwNBigw/FoHwE22AOIEAT9wax/rqFDsjrajQ4dCZOFBLsJY0NOWp0DRBRKd7XbDds+5KNqo9Vq2I6OPhmxpjL+xUa7fVdL+v7oT8orcJP0W3TQsdPy2gTXIjqSp15FY5vXqbdRN0zSUeC6tR7BG+6+V9wnR+haIEaoX7fXe72iS82X+nD0iru7RW9A/JDO2iZLLVepZcS85TZ1vRdvHid7GMh+nInRg9+ZGH3U2nPmHhEdrFYtFgah4SYVJnxKMWkE3a2YY6AC42sDArnLfgToQ1Q0M30trco8x6KUIGt2ThfZg6yp/AkamuRheHLTJA+Td30eZRPE/obEBGQ0VGVL1VXNkLWspsH7/0Qxs8yN9it5gq9vmrvAv9jTOk0MWax5Q5aNJJHET6Lv1tNpffyNEKLvGA8PYhTXS+xYYpvjcqAJsRFLuhyoGB0mD+jk4fEe5YFI3ywXi29U1UKmamfoXlHlIAqyUA9LVgNtNhYIP019aR2VU2DhFsKLJPH3bC3j2EJ7cWm51ky72tZyuPl/pbWMm8btxcWVatN2tJOQ9jOVjMnzfOOie9KpNlc333R2Nbw5aUoHr1GOq0g9wZ6IuXqHQlLil3KCLaKbIvgm6xrEvP3EsWMn/pYEcmyV/a0mtb3+1rhrfyVOPD3ZtX9scbh4jAZX5+2048/LyViKzWemcghSXonRAK3HfnbKk96HFbfjE7EDkT0kX7oLBBLpytoy3toKoh7wAoP4m+2Nh4P9/XgBRmhfNqgnKOIM6pDu3tijugB9ui6lKDerQ97OdN1oQh+ukN2tRJND1gu+WwPs6TZCtwuMHZSBOGMCxMHDlIJruBuWUNtAUXRwcO1g/PPN3mgA4SAMd0Kylg6Je48BAmwRhOGl5g4gkBHx+bHTHAwGcEsvbGrhdQZSgMEJw72wCbfuNBlmTlYnQPs4VLtE9EhUywYMZjuFY4UZ0ZeF3YPB2vnwjs+t3RGeX3shPL88WPub82uDtTvQaEDT4CokXmdCmkqun791HvFbqRTHjXiaU60SZ/xQ/Q54+PAOchh/jh5QH95Wh1zopTpNe4WGNH1ajy8AhiO7Y1p0X+YaIltTqf/kif57M1n1yJ4JHFtD0UXan3Bw3UkEfZ+y4A/9BSVv6IJjFKywqGfyvl5sWkXTEXTjMMgG8PkuzdHgs6Hbmmbr6AXbcezl4+2HdMWUSxnJMKRMSbIU/aH28TVyf9CUyY36kkwe02bryK9Su3rCC0fUPRu1BNz0u2sTWR1x/NAOm+gzP/88PruweZ5FpRPVldpWcEez+7rjx1/XPXlpg2VRc3dhg0XnN6tbdVQ8HuSpi4bo0ZO6fSPunOCYmyihn3jbnXjdnUcwPzdE/f2IBEcx6FXicIy6KUtoxK+gnwZezqO+h7aoTRPphk3Cy1UpcUqi/iya6naASpQQ2f0XwhG6Yh016XaCTY+wDtUw3vjyeU5R9WqgiIVq4bmU5BU8GWcL2T/kZIhKOFPIpsv6xrObRpkvheUP5ay8Vs1xOXVpVZY/v7qkQryqF6x8ipPRe6wl3Swu1TKZRb2ezdYLjmNMIuOrz60fP77+nJZOf6HZeVLU1ccW1hFaX3hM1cUnuk2OQ9P++1P0acK5Evam2wwnGwW6jWSfTgmh/1h/pO7p2W/6DuyKJYBS2a2ve+ZMLjACAb2u/lDdrQQ//M0Yl7CHxw1UzihZo4pn42OQ6BVnohIL7Qx24IOG3/7t44Nv+zbUm9z7m+iniFSqETt0IO7EBRxvUiDGIIg5vbESZHmvcTK7Ydsb2ZMNj49WNu4Klhc31h/Mr7GuabrsWv7rHl9cno6ZrwB+JLLcJnOK2WFi6+ZmTUcYcJxHBFFF1EWdFo+hwl0dxTYmJaBJmJiVLyPcKRHXA9Q7jgEx9LOiL28vLd35YpU3iivLIrIyEjovjr9S3Siu35nl3iyzsKrLP+hlsmWv8swpJ1A948xb65zGcdo39JdOoR/BeNtAd52RHbRQWBYzFpLQHVLmv1Tya+cyubuPSzkZ462ymc2UoxMBi9BWJDg8l5b6p2bt+jGYd4T3qlHLeWgwuljVKvGGd0IuCAlJPNpQvczLGmvYx9Yck9WIxen4kIRH01AAYb9TDguFsNKO+eOjZ3M8xRXoV5vKJtaZNvFEVqPMZsw9UP0rifsRkVq2a7hG3PzRG1LUIiKm1f2IiKei+uOVKKilmkHA5s08e3U3G/2vrS3zkUfWaNine5kHgGL3Bg89NLhvZ+e+QR85J7dKlx55Zetk6ZFLTOKvO1m74vWK9PhrmDuYXWgnQH54G51JdShhYl0yX1Ob3UQrhsNqst2ZjLRN4PFZYltb86catEpswEKEwsPrPE5xKUBMlibqIo8QD7yGrH4BVq2HambOEARRti090DXNteH8Cl1nqR050KT3pDAvi5LiG4KsYl6y4Iy7LYA1OrvumTm9TFwtAZCEA8eX9ZyVy2ZbQbBLQ2amoxgm9Tye1JPWkZ+rI3ZcH+rI/z3rF9dtfI0XWS7FskJaEzWoHM8Cw6IibvBdNSOvAypU0lA1Q42rdo2oqMbDPmp9IytysiTCYCfV4mSoFlSu3/d8K9DLQOFT8FIWsTypk9mmcsoomPn1A6iYBpyTgXokBr/JIgejBLgE14/a6LDfG/X7vYNe0OvvEcVln353s70DGBxTO/b/hr4wkXGiCTLmyUwn9NqfuBhFfbJl84FT4//e8JZfe5e3dPHXGq9d9u66uOShZ5eoseJ97sW73KWLd3qfdV2SfufFGSaH8hIZMSkzQ9iFCX1LAZ8KIxwwETq82rp6taUFO/0+YvqxGQbqUysMgqC1S/B3JX4fC2+E9+nJ+1y6grWJNV0jCv2KW8E1n2V68RvGf3Hl0gF5ySNXLqGA5HH1atT/KOTDTMpHfRIpVL5WINgI8G3UBva15jegrGTrrU81pyG8+mAzbYenzq/dhj4MXXk4gjwGdOPzoGY7ndtPPPRpwI6IOYyg3Ye3fD8MpG4NqI8LQKVRARIPhbdJa7SJkhZ9aPPibasXtkLbGr8L3gNvi3q7WZLBQw+duL3j2LcdEhwYXWd6B4dztlCERy1TlF4ku/aoUr4bIwoyeKvE+W3b3wZOf6e9eeLEZnvn1NPlc97ZxuLtS0u3LzbOumv7xypvQIfl4jMvPVMsd9fDQm3p9tfevlQtNltXFpeJK/fpfCIyf6IVyUOei8TrHBAHq0IaCapjQ9tFrSaBFt2IjCkSa0z4A79dpdCn5hL3iK1oPAImda/4K9lRH3irQTARnN+xVHV2nMryoIeYXg+qi6gXNeDUe3DDjw0GWcJSLRf7kQrQVR0cobVE4lakPgcJ919z426MqA3MdDt8mwCfLl+JI4BAI+LXNEK98egwLgM/Pgx61Ifs+BrxbHatFaEgGl27thdzgsPg6uHh/iA7OpzDXfP6EIZwGpXEFw/5lQMojEX3mcM3QFfHwAn/E806JH4ziRM/9OPjd6M9V01bX0e3NDPEX0WrNcfbphLvWUSSVpt6cwmPOiKj9qqx7ephq0VMChzTlM88e/r0s+8gwZmZndZg2I/1vv3kGgTjvZm117wNbqyBu8Ff14RoUGXYnFnsxWR/w7xJbLIt4vfpuJ3ZJSvQW1Q6SqSDber6DvD6vI2yPZ9lqtKuHLaojVQwZ3Fc26pWty6Q4H2EZIyoMdLw2MU3kKsQoFZ16/aT1erJ27eq40E0zf/aLH9Ec3ZpKV69SVNkngZfqwC/g/ooujH/8dVZ/sRajWSfmvYr6dUGxF8917myIeaWfem3dnfhgw5v3ZUoS662ZjxCbLtvUf8dj8/R/+5NrFJYrVVrsEoKxLGHAyslcTOyOfmdmtOIuO2lflH82GqKTHEiqSJiXmo/hc4vnFyAT/30w6fhk48R0rfxSsOu5l2OaIpYyc3X7EaxYdf0nJqk6HrNafyHSrXzb6OGkU4bS2s0gpgCedtCYYW87fQ5GFe+bm6wqqfpVbtRpm+VyCt4NWfU7Dp5K+SDWfTDD0SNSiW9mv232dU0jczJjq7QmevNpAczjokH6h/GprkxTOwRFxeJuwv0CIEsPeKRs2Wq6BXVRAe6MvGqoejR6KB/kCW/SzHf9vN+munOPbdGdvCliB6bWAYOBsPBYH9vbx8iRCUOqOMQBYAhYIkcZPeYmdyX+KWlnmuJ/qJHXENf37t6de/rmek974cxVmY249nr0p9ioro+6uuMCG/XETVmhelFfylmOblEZJGICc+FmgxcsmQofcWQgDeW9PBccygqWFcjVcOKiA6b50K35GUcMafEv8Ch5EQn45VcuHP8rOdppqppqjkb95+lbaASayxS7yk18yk8aAEj4cceL+gPPuz0ek07lwuD4IO7u5axZJg9362UTkUo/45cMwefH14ef/l7CmkTmVbpe35soxAIQmaCdY/qYTaZDtVNM93Eo8pEJ2O/qj7m1U/meefTt1TT3DoaxGx1/CTaT1xURf1JZO+mlCkt/gVKi4Gvb3TnPA9M3WP4XUCxuN0FjrRXNOxmu5E2i7GQ7dQDb//Xg8FzK5/4kFhMB81mkC6Kr4sla99SvdZqRYetxs/M7VUgFhdMvHFusr948ttdbeqhcSrkW7qw5JgFPg8sLa4aeb5gOpBUb7XuaMEiQKLVYpbznZVsdsXxuWyxWofEc9Gdrdads30EQ+rDr0G1nFN9w43aTuAvE5cEAqZaICKvHgQAUANqpMRA+HxLkTW/6CtqnQALFOwunzq1vGvKB+QWCK6c4GzZ8H1DTade3CWqvKP7P25c6Y7smD+yTX5G+I/s/zhIEiEgr535+OGovFCj2gmP0n1ikU2czPlRiKkKMpwL8WZn4lDMm3YxivbGV0e9Xn+ttLbWmwahlWFZJRIExGZMIpRWFDTaGwMHtNfTokALslor0LKBFmUh7GctqZzPFVUjd1qxFPgc6QdSznBWMpsaa0FXJP7gNgnl77rEHwmV/06KFAjcmyVeTOmOUxLNnmoLsmsZzrQc4799Nyc4rPIQ6xQcrOsPmlspXpALjnskb5lqLEnedOcNMMdk8w3NBFZPokXr9bIA1+LXjg+jVra3u9vLEl/47JE6TGswKeG0KDf2i3iTLUvyLNmoQ/oGDu1KgY3oL46F8SnlCumrgyEU62DYv870gXL3h0Qem+RFbNN7wMP1qIQQeNxsNjtlUxPsOilveqJ7nLU8LP0YuLtoHU0NnBIUOalTdBVeF5BsYgrzTb3ecNbk1/b3iVH2bgLKWq0ezdg8UvfY/3SGovo6tRA+xrQSnjkpS8IDT8ye8T8gTgt6hVjutIbQd7cKp+XtxYY5weRADXeyyaFFTXQSu6pb9dut+izZm3PLzor3ydOd7jd1VkRzh0+CESZ9RNH9pH9u9L5JdIOTfsmaco+6pZHN3WiuQ3bJEkkCYxDbm8Vj/0voT6Hl6a9/IM8lkAuo3zLy49W4G1InmWvUp8A2S382rDbdZY4SQXgsjqT7VgSq+YVFAn1BRGbJ4QSW437sBBZ6AkZBCUmu5Boidr6S4kTRWWmWTiJD9bBWMSpGSVMLpXIFi5Ysp0RdMLHBC5hV0dPFUn6zIrDoZXiIexkhUbJP5DPSd7MpjhX0WvRTnB60/FxUNlROWlp4rlD8NJvCtptRZAfuwHrG9SWNme1Lmf0mBvm9CvhaEMT2g/R72LrSQkyrNWunQeLzIHmmTdS709+nSL4D4vRv2Jo8wzIzPzhobkSwzJiZfNGAWJb19nu9adlumc9c2QiLPslnQncIT0E8m8576XXILqLYtjX5TbPpKkY3FRCNRBTzlXt3diMiY6ToIOrcBVMW1jbyczzBfqL1LbknHpTbMTBoyw+eIHeSBU425n1uD+O9hnZEERWgS7qnpj/dX4j6rcmuw6ntOrV+I7tUYocOwbT96Lp4grlAfa6R4daKf2SAuAQC6A/zihhUT2BCvGOCyoY9wrbEG4zCr8GqIsNSeJ7jMId5T/dFQ7WKjmmnTCWPNVUUZcOVVTFQjGw671mSIknp5pw37GOvPXbstU+QAAWcwkqSxPIoxaZLoizW65zlO4Gh6CleFDOqLEtq3lCMapiy5HyQwemfnXN2/a7kPRBMeCUYO4Q3aMLMJL5aGJj3tZkfGFzp6ogKSbdTAI1ifY5PpYaJNDHWeJxh6fJNnUOF2wgnu6uaLGNvVLMLiizbBWH8v38HGBcO8RiqiPkUYWJMDav4eSOjlyt6RlczYtEtitbXFxYXTzgStE3tm4NGAB90MB5VN3Ie51pfxqpgpiSR5wVJ4kSZ/MzY9xe0rEH8S2iFlIBSKcSxiycXbcPSA2z7j6RzuUa8Hk1kSteI1S+iFJxsUq3RbXyJQx0iYuzv0k9yRMzcCTlO5UUx9o5R9x3MffHMOOKfeIJr7NhbzYQvmf9hS/ITJlMWdRLBAEMAoTVRZMixW3fZiJItBUW3l02/Jp3tTawWg/FwP3F6Hx8+1HxHkzt5z0mY9onrMOPhZJPBwQiaOJ3NpqGtIVr88eEwwe5yfHAdxyatha5fT2jLg8SieWKtMTHhIG3390qbbGSeWX5Mtti4aEQZKrqrORjM4tlBMIsX3SNX3OJBvL6QIIpeJe4V58+KM19oL6GXKJ3E8Q+tEh0EeunRR+uPXmo8+mjj0qPoUXICMXKePPN+9H76zOwRH3Ue7V56tPMo/SDmUvfR5KQ7R6M4uks0rMH9qYqNtOhj6dCJUC8C8vSXP59NnNjE938efYZ6xmTs2Mx+YqvRrBIv+kVWmFjbC24tNvAgW5boXeQH3cjJnNDq91XRV2Tdz3sFP68s7VUMO7+ZZg0j1a6kzSXPGZTy6yvrGf/ia/RaaSGzoivloFbIWLvvi80Q0Gc4uRDU7bSbzmxkPC5dWm7Ki2fl7IWdS7ed7iw2TG6znc+kjdA2pEztKzETlrTXf0Z/NLMC1xFg/DUU/8YsoZ9Ev0jdkNFfJ9OpR0JiSknEfcLcD0iiK+RHS69kzuxkORJ7h3XM00TPe4cIK/s7sO7hd5DfRLI075h1xV8pplKSIAJUkDhhA/1s9ty5zKcyluFxmXPnsi9ZoiKI/hn/JWy4+CX6hvQxT00Lsmh9yttZQYjYinnEGT7LTuTB8Z52smO+CphxkzkJa2XicYvs3bYwHcg1ss3D9WPbPfpzR4m7kgiWVeLHInnkFQdWSjwYod4fO6YTrJnOM3mnXrcLj0fArvbGh1f671UURTeGARBFFBHndZ8x3GzfMdN2oZ93fEDB/eCwf9DSfWNeB6TQX8Ob+FaF9bwzdQrTnZDiKU2mJk8b9Ffrmq1pavemyBNoZ5Xyewcxth7Eh2/U72k2GqFurpbfnphjxheGiVuX43fEKv07/igmJ4uEaOn6rrbgWLv3aGZ5NRunKEcOE/nRj9P1qAR88gnqxW4zBoFk6BNOvTZ/LhRRl6ZT/8Tk1xNasfcywrV1af0hsglnpD3Qhm/qkpL2TaB096UV2TD9tCKxWvbXMpaZNn0I/rzqmemaZ1oXsyeaTbMVbBrLzRNoMZ8NPNMuZHKuadummw/yacu1wiDIZ/J2LpfN2fn7cu28HbRzmdWz+YrjVPJnV2e6qK8CN7ZKf5c5bMZChhLC5PfBsDBxtEx6hPiy9r1EDNHthHzYjB0flBBqCxKSexoPy9/eWz3V1mEJ9PDJJ+RA1OzierH0fEkgysazpiYI4vjTvMKyWk9RZR71BVmT79EQq/IvvbVYXCs5mhjI5x4RfQANSlp137oIC7LmnU1rqiF8mVdEXu3JrMTP6ZmJVQpxCk3kMV7shjkhUXQPqQDknSxe1NOxD3BJ2IjlKVNVDeI7C82wkBFSKS7lS8VK1C1kvUzN8K1UpqyoYglLiCtqLMZSOR1uV5fvRCPPOb9QaJssp6T5VP6+fLFSXFkuVVnHlI9V7TTWraxjvhhusmilLgYZzVi6cP9tzdk+n2sJxiW/17wxQ8eEV2pQ59aT7Q7dNjD8SZzKYhKGEIDHgBiTjkbou4e8IJpuobCQZweKnCkUlgrSXw/39sjG5thBd1RAgvC2VGGxkEm/lH+Eh0jB/QQW9ycOCvAN5crRPZvNoyXr3rCGElOjG4qztxc7ByXBww8+COdzpWjNfqPgSivqTX0rXP9bsqij65AzkX516CrY7ayxbeJklRrgEacblPoSQweINRtUMo5jt/BklhGXb5fvXbtX4GxX+aenT2Zydo4XO7nC+XvWz36b7Av02vhXVQmXFL+olp7M5opa8b+it5MLvs29DT9xbFM3RJUXtkvwVHThqzIn3Lt+kfNrWjmfeT0846slLGrOl5O18XfR7yZ+S4pIZ9fYbdZLzRQqLnplMZ9/7Zve9FoaXtjb24XWeGVhkgDh+CdJ2u7MB8KVxB5lakYV/+5gC7iCfRKZYcVYj3PDvQPqzqRHQvrz60k5D9BvQo9ukV9Bi61nyc+UEY0zZZfohshOy16DOnhxnCyMUJnkPuIDF118RobZyeoax4qOya2dW/OfwWmzVn3k4ddkMlUSF5/JWNaxc2czJZwVBMMRKsqHn5EDJ5XK6LLJif9fZVce3MZ13vft9fbGsVgssABxElyKBEGRi0MSKZKSTOowoYOU4viWFQW04qN2bcty3ThIrXQSJemRNrXJmcTNjNI2mTRNQ9e5HWfGaTIxWTfH1E3SNskfISepp+00bqedNlDf9xYAQcpuEhDcA8Du2337ju/4fb8vFMyMlg6Rw/QI4rK2feiWm7MXpGCIHHfwwO5QKJa5rYAjmiCV3w6X7ev/LVInJrn6GkVF5wHLRBE4E4gmUhCxnfedHpyYJ0IrGaHIx76wCzZ3PyFQgYahT1DAaWNBUtFg3BFZQ74cEQKnJZV9uIElXMPKU1oE/YFisMNIwQsKvoto22z4QVFhizza/wBPtHG8T8M8i5qacu38haQiTYZknNd1vfVtU1X+XlYKvIJ5vh+LX7R/KEoC0JxvPYcl8sx8zz/opmAuGOvopLjDlowaw1lH17PDRAFtm6hRI1+TPhw0ZfxNqZYnSmfIl7d79M5NonWCN8sPD3cxEOpOoTZqlA58oCn6/SSKfiM3NpaT5URr4zWulItls7uz4oIcMAVWilt4UUMbu2fH2ETrZ6hZcN+XG83liA60KNsJHoUMaVHs9Uv740UnCo0pgCeR/AOgpkbDxzo6Bxju/TGMy9NO4kcyes2ms7JSr9dpMAT4bzxE1zevkVfZcTbidaceX1taMtSmZjSblMK9tbnaqC/He3yaOvUiwUzWZgH2XMgf5ULxHqllF1t+go4K3qYFQMC97Qv9jGYoopTFAVaXjegsGw6usudOnDjH1g11BcwDEjtYHWQl1UAK2VFZ0HJV4/6Q7rp66Ey9fvpKOn3ldH2dkuaphgvmftdQmS285ia1NfYD43KHZRyC+4EBIUVqCFJ11cZyogCW3zEy2Lr06sto1Wk1nNxEPhGLJfITuda652RGEDOScepOmYhkmyjukc8VhfzG84byI4teZiQ/5N1r5zwv18uhCFbeuK9jYhpBWxE8oj/kBfIBmeSJlrm+1GjWyWNprdf7kgkPrSw1+/qcBmrMe+tgeNlT8p6dh6W3dV/PUZbfObCiFWiyKKKm1+xu4B45f87COUxT10W9LrXVFBK64p/o5lw/jzHwcUd9wnwiqaP1hCmFxMnJyCEzEY4YcoA/LLLOwao+4OiSQD2tmtFaD8fDZjy0OlgYyvM8i1E6m0sJAU0PR2Jh1vx5xGGJHHNXUA+RsyhSWLjfNRIFQ9Jy4CLOaWI0Arz6kfDhBG/zEstaPG8JUtGMmWY83KujQ+5lsPCAZcdHtFl536yy3lxebg7t3z/UbFImX6LlLjXqk2cmvV2HFw/vYnb6n/v+P/8zGLvfwO/81NobuZzXy+UeW0KFPA1S+fmyWxvvAMZhMBjIV3q8WFY7brxa8yi8nfQatBJ3pXu1v+KDXKJQqAyIz1p5O1k8UEzadnJyqK+kXZIGY+kSO7KatOPWF7iBSqGQUAKfC98rufFMsZghx18yRp3hyaRtpUYyqeJWG/wa6asxmuHPTyFGkTlE4vTAfGMRlRJ3A+meOLGndtvZX7ulfmNx5L0njr79qDtb63tPNJMZyWS8++64rVKrF4tH528+8vjherI6W0gXM5liuvusPoEe83OYUrLod3/ySP+930KXyOqebzLXj2FbGBLgiWmz4gCEXKDpYdvoQWCMoTTe15jGNWZpjYzpS8sNSHBCptzmChG7INLodfiizB0I4I1l1CBTOqB+nS2gb3dM/wJ6kWJ9aLYm38QHiTMByQOeY2qUJlM0blfVOKrllYQsa6GgpIdVFIo7CU1WHVEcvDWbMM3qkaOyUzlWLh9DH+x/yy4JS5om6URNCLKqqcmBgiRYejZx9EjVNJ93biyXb+yx/W6ir9I4yAWwkUNu0xJHZDKDx5ZIx5ApDhi9uS5lJx6APMIAWqhN8bVKlQaKGxzpfyUOPSOLTloWiZ6i2rZqhUMa6a4Xb+AUJ5MLu244l3HODJQHyPsHnV+aejSmm+Gg3v1l1nRdM5tx0L1GOiwaOKzJrCCw5PbDCpKUeTHgWAFOkriA5TzuwMkGFjq/lDhB4CQtGJE7vzTArG5YTi9XrkKxbrgCSFWYNbisH4JH7pj08339uwvCrYubyPFazX+fGz6OvMY80sPF2ePC8damt+v3kKO5nXb4FdLGcsBlQEc6MsS7PszDbjO9g4kSR4HuHT1EU61yD9gHR0YOxB7gIL/CAftBjnswSnMtZGR5wiEbzoQs05+SjTD5aJtcCFwo7exynk+Q20n70k5sBUgSxGAciiT7+vOlbNWJSIoSMIimaYQ0Q5RmZjImWud5BcwTT9x2aDgq84KkaEEzGk9lC7tKXrwnhsYvc88vUyqRCqgKWaGfUYIGCuT+RRfT5AXyx+fdvkG1KUdDTjgS/IUXuC6Sx2wn85Ks6Opqvr8vGQnrPXMhpihBpkblkZBne2be9tN9h1bK5aWlZPWO6gLZWFkrt9YgnL28Vka0X3T0uKXtfA01wETCyEHGCpgW3LZ61ERMa9UjR5NRYoW81tbiK/S11Cay6fhY1tt4GDK/dOIufTSMSXOX45U10K5g8fyK02jsCHek1L0bzW6//TZ6nNosimC9A32Y2ifG/HwC2/c5PytVbsDFKbRqpbAWDMZNnPoLsqkHgk4Y99UOP2LnzHOXzpk5+xH0OMRtc6yg0QQJ3c3WRxZvUPfMze1Rb1hktuLt6j5eBmVtL+si5xrTnEdME9UhC/MWD6hG7t0hsuQQ1Yl7GdMKNmlNRFrAFGTZJZ0AUwUuIdut1mxjO1X+qwNx9awxhtSzanwgPfaUDzD8vL/3T+0ve0AF/+h/c9L/Ztn3C0X8vWn/O6Y37kZjksxuyK+6bQY3aZwJzrngqoGomFzeDz2hjkH4KIV8hbaEqDGRqliI2XKrDLIav+uOosYLwvjSqBhFiOV1sfS2iqCznL7vsbLAs7uPHPIkncfSxNHFKlE3VHLnW96U73I8a6u6IsgooDnqqMjxCS3IYsGQw4E0r1eSokB2gwYXEsUsFxSDvXGRMmVqI0o2rtmQMzqNIHqq5pLxor58oW9lpe/Ccn3y0VPRS5eipx5FG8vmox+bn//Yo+bZS4FbL09OXr41sM2fIZP1652j50hme/mB68u/ruzryu2WuYQ2YPyDgGmfW8Emcw8djsA5RpPb+sGzzY1YOh27CZHZABuYTAlvJvvo6gF0UHDjenxAOHhQTqSseNxKJeSDB4UB8qHbnZ8pxjgDyHaTUpO0GUq2rfYjN0vUPNuPOvDHwAimnWzHBnYCpYCzY1FvER2n2WjqWoDHmO8bTfWsEjpiVNXMZMydS8h/nvnvZnOVlRVRDhCVxrK6a8Uga5PtznPALAXcqFkM+b/JI5qGCof8VPX19Y8Ui1L/mG2P9RNBdn39PGxJwyUp2+ufBD4q0GhrgocLOD8NilbErnkBMhdMsW7FRcm/bG14q8h55tjMC+dXB35wZOq5wfHKYhEJiFknL6f0/mK9fvzAxdJv9wfM+tLeOuePCazexrF3cQaFHuuKANw4vkmb/kP8LLr7jjuKd97ZepHVWk8/SV/oSOu7yP3M7aXbyfu30EutCvr4uSz5Q3e3nn6jcswt6GeFI+Vw5NxmT1lXaTF/y2ovwsmvXqYv9IxfSOuP/FJaT6O7aUlMx6epd/Py5WmkYq3i2jXLBVBDIV+hhAi4za1vV/wF1/XsYPtqNns1k3nx56+hVy+LzpMJ8cknw4EnY9LlPzx52l08OXhywV04iVAGZ7OZuey/wFUcdHCiVEpgB909GQ5MTMSk4dbayUV38ZR7cmFw4WR3Lnuduu5UNOC423Vda/8DjyI6d6z/GHm3PuxX9lXyvnyZ3PhL/3PsWO7YsavtuoZXevONyzE7FU1Kg7ouANEfYG5BCidlfdwv5uOklM/RUuh5XyL1fSstp/VZeqOkFCRups91sAedcvJg9doiEoY7cfOu75vP+rYKTARy9NcnT5HacxdOu6dPts6yWkbLjpQyRqvyTObLz2c/hF76PlTvqQH4waknoMir8GzbD3grN19n/n69SGgPN3oS2aL+awyR/HdSFvgggGYvNo6HvGzIs5DbRfUjZ/Uas4rm/UBntA57DR+gD4cp7fH0Web1eCwpd+UWw0+W4pp6GX86fJUwU6O11eYyIOfja2hto0FEmaVVb7WBVsHj3IToIZrdse60Xz0cnB32P1obvuW4G2sP8F4/dsTyGpThxnKaQP6BRgF061B87+YmWqW5QppNuvIcL16OM1v8optML6YXemqe8lRQ+1LFz1JJlHJvjb4o5eZa69m4nx+XeUPeLdQmL+itE6DWo2FINLPG0vIKWllvEJHLN29Tsl/for2lQ1Dew1rOHSsh6kZspzkeo7ZICwL9DES6mfd5Dqsyx9m2VlcNjxcl/NOqdFzkDaRC3kw+oipzVtBQg1dlLG9ID6uSsrzRLueb6G8oVzdEooylECWtAm92hPJVg+uPaC9EciKPE831lhN3egpq/QcA+7olWW863VvSFiZjkwmSeyozpyh+HVcofxAu1KJTRCusQQZ2opzSFOxpSHdadW24JAOBQdknyjajnp2tULtQxcO2P0f72WLsqECd8nYbjcAyTmQgELac1hOO6RrhiIO4vKBpX9FiQp5Xta+IghL69AsS5vJcAL8giWyeVURuVQ+hFhDIWAl8VNFNfV03LaG1oeHoN1RpHWvo9qMIEwUSH3nPESk86OKjrR+fJeecI+c+q8f4OVZdn+MMfBfGHFlLZwXc+rpSnycC4fFIgguqDd009REpFGlI6pExSVUZzccksAy1rk0SufAYqaMLzGPMO5h3Me+HDMOICNrbasuuQqhXClXdqJ0nX9ljUbBY1+xodZQdENMsBnbHUVJrmIi3JXB7TIP67Vo2iDKAcNlWlX5iajKliBGPTOJubXwggPJVXIaDa9TBDZioaSC8qgG1/vX1+5+Bwol6H/n3ckEkqkTU5Fk9wiocy8WiPMdLyKU7feHSWayjsPZgVRM4PlQYQsGArpypCImtur8vMXlm8k8LLKcYkZzKIz4mChGpGEveU+REpRS3kryOLib6AgENXTyCw4MD+OiVw7CWjv5wsJ7sP0n+P6KlWVEPBlUcSl7gkISwjESWHxq/wGEkG3g6bDRN7+whIyDbpczxBVbkpZvNkDV/IxkJj1tunwsgrRkdiWhw8jw5Hkn7zPAldWQ6KAUi2T3OkHZKE/jbT53osdP7/D1EDiUaf0XEFbGQtYjqWq2R0eSOM7ehQGsF8u989p7n7Oqx6k+ei9fqnsUI0AbomGuTUW+IuZHaS3zrJ6aRpltYEwvna/ZOd1pHtEkh0i3y5CkRnYw844FpEBRJLybKj0caCHJcLYrto/uHzSOUd2Q1mnqo7Dy0SrfJ4uWFvlMZLqQH8xKRsYKjlrU7RDbkfEgPsdMRsYpNhOqKNLvqNfwjrMaN4+0tGGyTtVoylA9gmY/JIU0LKXHSrwL9wbFwOh1GW3YhP38qxcWjnuwAYFLHHo1Jz3L+/bnIq2tGazWg1PlCqXCuztux6D3IsYPKZ+UAi1YMzXHUAFyAahhvbv1cNnSlq289T8qR20wTjIlDEHjp1SqkdQN/Lp1CwN8wG14olW78/fzM0p4TqDTT37/U34/WD7W+tWvXu1793oTnvXbo/PnzbT3hQ+ScSZBycvtRO+d2Bzxo0yzclRJC569IH7CyWesD2ZFUKrXvSjTDZp9R6umRdNVOp+1/rmaybNay0+1z/hh9nuYMaDt3wBMDCIASaq/2k+5fQjSVeFsHt6s1EVfRj81kOrNvZuH4QV054KV2y7Kk6dmhSNS09fxb93E1N9KvZxJqKoF+py+izUzOFIaG0CDqTyJOLOeQivRd49FimVUVtxY0cDAX5np4nCLQDinrrg+HtDqub+8XGax77dUWZCjazmO+lawHxqZ2PqYA3aCggTEfPADADtB+0MbUhScuTNHFhs9IslxMjxeL4+liysr1KZqAsVIwg+FIwMJKSFZTOSuFmOn2MVMX/tcnjHwMCzQImRcCMsZCbcrdw/E35PL9g/E8x7+tUibn6eHA+xh6npEoPvRXvWDml7/KL/0ql7aFl++jviDfGJ9vp5z1x4VuhmPb7c12STGrHoRedLJwBtQVRdHIdWqKghwaWUFDLwLqKuW9UQPP1gRTBSJD1RRqW/UCY1WIcm7BzBztEGPgPPBTe5RsCcxB0Fpq3gekqcFkKThszw0W58dx5eZbXrhlQpnc9hlyBrxY1EumB+eGl5a8JXc8Fh3ry5C9bpmvoj/3ywQ3hw0oRz9altyjmSM9BbCOPvUOWHSEkflxsXrLLZPy1GBid3A4PtdXrO/4BH1i8PBwo+GOx63xvkzrz3r3tu51hXKlGDRyFuCUHTP8OjjLl8uoXF4BgG4ZoLq9MWMgEQL7yYHrueRciGmnkm1HNezh++jYwl3KZk7NvtXadlnfoWjmryFN0kBw1qTWa5Kmfd/PJrMUMcJkCgsb7eQqncPimpSZL89nwH4PR6742X0fTYnxIAyfwbjIbOnnKzTGIANZddpBJBQuXwu5eAcglFxZE1STphpYXlqKb0E1UNP3Nj8C7g4PMqWqyzSurjdHt+lza/aesGaHoK12ZxWi6qx2MnGnzjyEmIe2tUOIVr+uhgsVG22krBY9B6pbqdYmZNmDvWuwHF3rxtX/hFwHsCdVGGCpoeZnPzcjRQvUgIii3fntHJBSiF0nZHnABToN9J1d75w9vG84JwR3zUxd2bcrwuu8JP2dnDDNhIknLmRHj8ad0b27+wL60dHsBaTv24vxULaqRvb1JbTBTEqwBFWbkU044At7xw/GUm5yLOmM9nFmvxE7OL53e2xv8PrY3lo+jboOnR7j5Bl5Xt4jh/tNM99r5Py3j370TXI6HE6He2UXwIWADuOLE6EsUYRq21AiXn0DxR0H8mHHEcRdtJqbNC+208MZDOcJv4HuZvco1O3H4dEo8X+dAdZj/43WKY4XNDey+l7n4/jMDNMbH4D99olcM2+6BaFL9wqmXeo6pvBScFd8WfM0MiKD/uW3SPV3k6KujJ2KxU6NKbqYRMx8axP1B5aWHKxKkopX9g6U2N2uu5stDfTmhghQK/Pw6/TocWgJVNraomKjzj/gXO7tu+vDJzKZE2+CxR2+rdgDAoS1FcRAv6GX+Mpgf2FwsNA/OE95TFOfcRzQXfV2m+/lPfRjf/Yy+8k4c4w5/jq8lURV7rAgUibEzkwGiiTIlu62D3b+ghILNenFN4HcEtVbq04dkBWt74oYaqvYaCw3my90d1Z7v2mgOh2DVsFsMbVU92Otm34tO06zLikSeTvA0y8B0Fvq+tL+Af2EtHXIIUw1EIuMmbXqOK65RJD9VL8k3U8eWagkWVeu9F8Jox/1Y0u6/79QsyT96D2FK9Wtdv0yepm0xxnauylOiegwIFURVYrmeWx7mSjR5XgUlKMIpgRHbXoqGAVonAT6ZOqu++4c51JCZF4qVybHR8e4xWCc19Rw3/SQxUckrAtExTBY4O7lOTYQicdkng3zAr8LeHHvJwfsu+u+UVyPCMk0OdkH4xxiOTU1FXfTFiY6dpYXWSwqLOaJKqsIWAjziLUENgA6wrVrRE9EpE4OMHVmkbl5h0wluHBLeSI8uv6kPOADTMm1+4ghdxwUaaLagXg5NiBGvTS7uwKoTJo4AgGgqJam37LM7MUrF2dnH3nvxdnW125KibwoWnEjkH7rRPFkOqAbAi8LRliWj8tYEHlBjMYC0QFR4EU7+3Vwkyb2l1/ZN2d+52Aunybda5ac6+J7HyGLG37KIkNHLBrdk0myimapmhTEMdeuJexXWJZog0QE4lAwyN6kISuUdscnpt+WkpIPHBofeueqJm/ZHeHxAhaiztzE3M68ZUdt7EwINl6FqhlGb1w1/i9yo2QmgpqhiFWX9ISCCRXTrZdH3kduAxbXeqRL7XhCILVgRnWj75aKeyShq7rIyZwWlKRZDD4CnnzpRE2R54Ro3wOHeIE0klit9am7vOmXJ1IZJ4GYufaJZx9BxS1xt/XMt1hdQ2hoPBlHsmIqmhTgonlrLBZ5gWUNA0RGsjz+pU/roXA8Xrz/zp+2fuacnyyd+GNV6vSBT1P8WIGMyRTeFvEA0AqT7TRbpWg4sPnYkIIA7AZf4owJ0n53zXCcwO1ThZlvcBwrwsYBdJqV+QkB8wvoQUUSZu/nRUF5YIXDnPLrD/ErAmkMT22LzTV3IlXyfrRBzxx1JLeYO3g5t80J98WHM1NPx5iOb+bD6Ema69bGcDj6zdwH4Rj0ZOyVhzP7u+X9CUWfQsQTOMpyFIIcafficT+djEDkgq9KyUpipP/USS1CpunOTlKSrjHvQpeSkgBJW/iItv/i/vaOlNw7PfFuyDXwfwVB8YUAAHicY2BkYGAA4lWM4ubx/DZfGbiZGEDgtpnQKRj9/9f//0y8TCCVHAxgaQAQawqVAHicY2BkYGBiAAI9Job/v/5/ZuJlYGRAAYwhAF9SBIQAeJxjYGBgYBrFo3gUD0H8/z8Zen4NvLtpHR7khAt1wh4A/0IMmAAAAAAAAAAAUABwAI4A5AEwAVQBsgIAAk4CgAKWAtIDDgNuBAAEqgVSBcgF/AZABqAHIgc+B1IHeAeSB6oHwgfmCAIIigjICOII+AkKCRgJLglACUwJYAlwCXwJkgmkCbAJvAoKClYKnArGC2oLoAu8C+wMDgxkDRINpA5ADqQPGA9mD5wQZhDGEQwRbBG2EfoScBKgEywTohP4FCYUSBSgFSAVYBV2FcwV5BYwFlAWyhcIFzwXbheaGEIYdBi8GNAY4hj0GQgZFhk2GU4ZZhl2GeIaQhqyGyIbjhv6HGIczh0sHWQdkh2uHf4eJh5SHngemB64HtgfCB8cHzgfZh+eH9AgGCBQIHQgjCCsIQohQiHSIkwihCK2IvgjRCOGI8Ij+iRqJOglFCUsJWoljiX6JmgmlCbcJxInPid+J6wn9ChQKIoozCjsKQ4pLiliKZwpwCnoKkQqbCqcKtIrQiuiK+YsPix6LM4tAC0yLZAtxi34LnAuoC62LuAvTC+ML9gwTDC0MNoxDDE0MVwxjDG+MfQyQjKCMrAy7jMaM1oznDPYNGA0ljS8NM41GDVONbQ16DYiNmQ2kjbmNyQ3SDdeN6A33Dg6OHI4ojkcOTY5UDlqOYQ5yDniOfA6bjroOww7fjvmPAA8GjwyPJg8/D1OPbY+ID6APtw/KD9mP8A/6D/+QBRAckDYQQRBQEGEQdhCGEJEQrpC3EMOQ1pDkEOiQ9BD7kQ0RKxE1EUKRURFnkXARehGEEZURmZGvEcoR1BHaEeKR75IIEhASHBIpEjYSSZJWkmOSchJ8koQSk5KgEqkSs5LAks4S8hMrEzKTUBNdE2eTchOEk40TpRO4E8gT1pPlk+wUBBQQlBkUIZQ3FEKUS5RYFGaUd5SUlJ2UtxTYlP4VDJUWFRqVKAAAHicY2BkYGAMYZjCIMgAAkxAzAWEDAz/wXwGACE9AhEAeJxtkE1OwzAQhV/6h2glVIGExM5iwQaR/iy66AHafRfZp6nTpEriyHEr9QKcgDNwBk7AkjNwFF7CKAuoR7K/efPGIxvAGJ/wUC8P181erw6umP1ylzQW7pEfhPsY4VF4QP1FeIhnLIRHuEPIG7xefdstnHAHN3gV7lJ/E+6R34X7uMeH8ID6l/AQAb6FR3jyFruwStLIFNVG749ZaNu8hUDbKjWFmvnTVlvrQtvQ6Z3anlV12s+di1VsTa5WpnA6y4wqrTnoyPmJc+VyMolF9yOTY8d3VUiQIoJBQd5AY48jMlbshfp/JWCH5Zk2ucIMPqYXfGv6isYb8gc1HQpbnLlXOHHmnKpDzDymxyAnrZre2p0xDJWyqR2oRNR9Tqi7SiwxYcR//H4zPf8B3ldh6nicbVcFdOO4Fu1Vw1Camd2dZeYsdJaZmeEzKbaSaCtbXktum/3MzMzMzMzMzMzMzP9JtpN0zu85je99kp+fpEeaY3P5X3Xu//7hJjDMo4IqaqijgSZaaKODLhawiCUsYwXbsB07sAf2xF7Yib2xD/bFftgfB+BAHISDcQgOxWE4HEfgSByFo3EMjkUPx+F4nIATsYpdOAkn4xScitNwOs7AmTgLZ+McnIvzcD4uwIW4CBfjElyKy3A5rsCVuApX4xpci+twPW7AjWTlzbgdbo874I64E+6Mu+CuuBvujnuAo48AIQQGGGIEiVuwBoUIMTQS3IoUBhYZ1rGBTYxxG+6Je+HeuA/ui/vh/ngAHogH4cF4CB6Kh+HheAQeiUfh0XgMHovH4fF4Ap6IJ+HJeAqeiqfh6XgGnoln4dl4Dp6L5+H5eAFeiBfhxXgJXoqX4eV4BV6JV+HVeA1ei9fh9XgD3og34c14C96Kt+HteAfeiXfh3XgP3ov34f34AD6ID+HD+Ag+io/h4/gEPolP4dP4DD6Lz+Hz+AK+iC/hy/gKvoqv4ev4Br6Jb+Hb+A6+i+/h+/gBfogf4cf4CX6Kn+Hn+AV+iV/h1/gNfovf4ff4A/6IP+HP+Av+ir/h7/gH/ol/4d/4D/7L5hgYY/OswqqsxuqswZqsxdqsw7psgS2yJbbMVtg2tp3tYHuwPdlebCfbm+3D9mX7sf3ZAexAdhA7mB3CDmWHscPZEexIdhQ7mh3DjmU9dhw7np3ATmSrbBc7iZ3MTmGnstPY6ewMdiY7i53NzmHnsvPY+ewCdiG7iF3MLmGXssvY5ewKdiW7il3NrmHXsuvY9ewGdiO7id08t8TDSMY9niSCpzwOxEIuCLRSPDFTGkUitqaYHmTG6kjeJtJuLhiKWKQyaOVspCPRzqGS8ZopcCRCyRcLnCkrjbSiUBALu6HTtUJBwoflQKKyoYxNOaCNLUwywloZD01JSVePK7u4la7uxne1prwwy2qtShMzI1LT4DJNFI9Flat+FnW4kkNaM61fpEs5GWRK9TZkaEetXKDEwBYw1rFYzGHiprmhpRmeyuHItnOBx8V7pE7UeMRv03GTx1yNrQxMnafBSK7TOaSp3uiFeiPOV7mFrramvJjpvjozs6TlTMeLIW+DG1vaja+2ZwSdHGeJG+nOktWVCQuzRMmAW9EoRfM8tTW+wdPQ1Po8WMuSSp/Ha5W+ECn9KNXtKx2s9UIx4OQSjb7Wa05pxYGVfhaGMtCx6fHAynVpx3tMRf1+kgpjekoP9c4ZMaHxdGTbdMQ5cRaTkqWpbKDTLDLLM4JUijg0M1OGqc4S05kKkmhmfipoyWJ2vtUJHdyM7TalhZOrNvqZVCGBdj8zMiYLIx4vlDghz9Nxt6QbmgZr/cxaHbcCroJMcavTDkGyj6dukxoloQmRSLmT1XI4H/CUIJ2CrdDDTbViqNNxKxgR7fFU8GYO++59jyhYRSFMJCElk76mo6sG7oza9JuFPcPXRdjJMR235n44CxcCHYqesdwZRKcd6MFAiA4lEp2SumBNpHUiWRSbLm2LTSnqes4lliaMDsN5ysJEkHAKyOlsCsrx4oTRzgtulyfcrJG5pG/7Fkmhc2UiXHc2CDJueXdR3A70ukh7MqL00wy5GfnVd0JueZ8byh9huDghYjPRqZ1yGW3lqYhIW3fC16XYaJSsHgqzRo5SD6WJpDENF7luL5uh80eK/LUWZUs6Ep6SLR66pFhxaMX9aOcBlDaKtDQrcrG9PCvIM04h6WsVdkpMXrC2oyD+/CYRvDiRxs5/Jwrz1O+cpFtIaCPozEv1I6GSckTGIVm3PGGUXG2kUzEZt2ResFCwW0izHIzL1a1JG4xETNGQbwWJlJ18VFMetao5YaUSnVn3zXI/Eipqw5Qno+WJwFAhsGLTbpVQ8Znsyq2ZtmLPguTHSF4UcV9vSlvo66UGCl2lyFZyvVJiU7km7Igyx3BUqqWTV6I0zFngQ6NcQqbKoYx2LXWh2J0IXBUt1axTmdAN+qJMjDRNEXGpXOC3Jmi16mFbRH0R9ngWSt3NcVGmi5FkpK1uFZgKayH2H+iIzUCkifVuWxGb0jbIYpFSXeoMeCDKPN0oSYOCPXThVxtIRRMrA8WHlYHWYSffvB43pHhCnFXtgpA32YUCD7lSIh2X83wslsQfTLcglGlsZsohb3TVEbPgirMJUiF8bdw2Q906nKw6pCRpakOth0o0h6kM/TpreaqvjTh1O2l9JLjL1lV6UhEbyZA8qznSWTpU3JjKyEaqRm+SPibDlre0F6Q66eQw34cdBaHjor4olVTdyeu3zUgp5VC8c7WcyyhjU/j5Ar2yRZKX4VlR/k3jLGhP4WrLxd1mL3C5S8YD7YLC+VPFkU4ehj0+IOO6Bek7Bxe1nDXpYV3URDVqASlJ0WNMKprOJG9EU7nffqb6DeeZ5JgxiUzuLB2qFdxK7Te/UZKFvMqX2aUW8ZQKQte3hL2ix2kXzLlGK8cuJxWTig5hoWA6yFxHupxT6ZKg7xFEITHUAvDQjISwhS4XcsUnvLc0IzGkzEDdWoM0Zc7cZglWJ2hXxaFWJN3Jusn1SNLeWFGlfjEzzYhEY+9THlVctqjH5F60ha2iqyUnqsXaO0qs2zohTxxQFhZpI+EqsuSazYRT/XcFdz4JB23C3q8pu1cSYU3Vf7mZ+GUKaoFdJfQ77jdrSv3CFoueuedzkggbxL1nNEuwWnGommh6uenKFplD4eiSQBFXTd9B2ZE09ST1n3XPdR6MG0mqwyywpkn3hdDfAmqpoF7HVuiha3nCbDgz6Voh51Njqr5naBiyJ8yU6ObRqBPnGKZmhDv/pqGS4lv01gStVj0kgRTKB1othzSZjHbOUTOKlmxa1Eql1u9SjQqqooMwNGPeaFM3iXZ1pUULo2IVJXbc9pDiUwlS5fCIq0HNl91xleoblSiT0SGMROqPrTlhiz6Lu+tRHkFLU54H0YwgFEpQIc0Frh2efcPxLW/4/t2/UfMCO08e1KB/3121Le2nJBeTXDWdJ+ftgPdpO8qivvHNf7PAWdJ2iyHXcebXC1yxtFdtKuexUT4qq4TNqGY3XK1tuwcZmL+R4woVI72dmmZKUobTmoPANdbusrC7sEZlimK8lSUhz+9atRzWii5x3YVv03uoP+YJWp3CXQSN7EtFXXqd+raYQmdpQyhq3X375Vc9EZS30pVSoMiV6G5Jm7pcilxK8re9HaWE7llDtzEurqevbqTuhkiXkWFjg8qRoRtx1zUF+U3C+cCEVTbJqvo4z7bz9Ky79Jj1xdzc/wARDj0u") format("woff"), - url("../fonts/dashicons.ttf?99ac726223c749443b642ce33df8b800") format("truetype"); - font-weight: 400; - font-style: normal; -} -/* stylelint-enable */ - - -.dashicons, -.dashicons-before:before { - font-family: dashicons; - display: inline-block; - line-height: 1; - font-weight: 400; - font-style: normal; - speak: never; - text-decoration: inherit; - text-transform: none; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - width: 20px; - height: 20px; - font-size: 20px; - vertical-align: top; - text-align: center; - transition: color 0.1s ease-in; -} - -/* Icons */ - -.dashicons-admin-appearance:before { - content: "\f100"; -} - -.dashicons-admin-collapse:before { - content: "\f148"; -} - -.dashicons-admin-comments:before { - content: "\f101"; -} - -.dashicons-admin-customizer:before { - content: "\f540"; -} - -.dashicons-admin-generic:before { - content: "\f111"; -} - -.dashicons-admin-home:before { - content: "\f102"; -} - -.dashicons-admin-links:before { - content: "\f103"; -} - -.dashicons-admin-media:before { - content: "\f104"; -} - -.dashicons-admin-multisite:before { - content: "\f541"; -} - -.dashicons-admin-network:before { - content: "\f112"; -} - -.dashicons-admin-page:before { - content: "\f105"; -} - -.dashicons-admin-plugins:before { - content: "\f106"; -} - -.dashicons-admin-post:before { - content: "\f109"; -} - -.dashicons-admin-settings:before { - content: "\f108"; -} - -.dashicons-admin-site-alt:before { - content: "\f11d"; -} - -.dashicons-admin-site-alt2:before { - content: "\f11e"; -} - -.dashicons-admin-site-alt3:before { - content: "\f11f"; -} - -.dashicons-admin-site:before { - content: "\f319"; -} - -.dashicons-admin-tools:before { - content: "\f107"; -} - -.dashicons-admin-users:before { - content: "\f110"; -} - -.dashicons-airplane:before { - content: "\f15f"; -} - -.dashicons-album:before { - content: "\f514"; -} - -.dashicons-align-center:before { - content: "\f134"; -} - -.dashicons-align-full-width:before { - content: "\f114"; -} - -.dashicons-align-left:before { - content: "\f135"; -} - -.dashicons-align-none:before { - content: "\f138"; -} - -.dashicons-align-pull-left:before { - content: "\f10a"; -} - -.dashicons-align-pull-right:before { - content: "\f10b"; -} - -.dashicons-align-right:before { - content: "\f136"; -} - -.dashicons-align-wide:before { - content: "\f11b"; -} - -.dashicons-amazon:before { - content: "\f162"; -} - -.dashicons-analytics:before { - content: "\f183"; -} - -.dashicons-archive:before { - content: "\f480"; -} - -.dashicons-arrow-down-alt:before { - content: "\f346"; -} - -.dashicons-arrow-down-alt2:before { - content: "\f347"; -} - -.dashicons-arrow-down:before { - content: "\f140"; -} - -.dashicons-arrow-left-alt:before { - content: "\f340"; -} - -.dashicons-arrow-left-alt2:before { - content: "\f341"; -} - -.dashicons-arrow-left:before { - content: "\f141"; -} - -.dashicons-arrow-right-alt:before { - content: "\f344"; -} - -.dashicons-arrow-right-alt2:before { - content: "\f345"; -} - -.dashicons-arrow-right:before { - content: "\f139"; -} - -.dashicons-arrow-up-alt:before { - content: "\f342"; -} - -.dashicons-arrow-up-alt2:before { - content: "\f343"; -} - -.dashicons-arrow-up-duplicate:before { - content: "\f143"; -} - -.dashicons-arrow-up:before { - content: "\f142"; -} - -.dashicons-art:before { - content: "\f309"; -} - -.dashicons-awards:before { - content: "\f313"; -} - -.dashicons-backup:before { - content: "\f321"; -} - -.dashicons-bank:before { - content: "\f16a"; -} - -.dashicons-beer:before { - content: "\f16c"; -} - -.dashicons-bell:before { - content: "\f16d"; -} - -.dashicons-block-default:before { - content: "\f12b"; -} - -.dashicons-book-alt:before { - content: "\f331"; -} - -.dashicons-book:before { - content: "\f330"; -} - -.dashicons-buddicons-activity:before { - content: "\f452"; -} - -.dashicons-buddicons-bbpress-logo:before { - content: "\f477"; -} - -.dashicons-buddicons-buddypress-logo:before { - content: "\f448"; -} - -.dashicons-buddicons-community:before { - content: "\f453"; -} - -.dashicons-buddicons-forums:before { - content: "\f449"; -} - -.dashicons-buddicons-friends:before { - content: "\f454"; -} - -.dashicons-buddicons-groups:before { - content: "\f456"; -} - -.dashicons-buddicons-pm:before { - content: "\f457"; -} - -.dashicons-buddicons-replies:before { - content: "\f451"; -} - -.dashicons-buddicons-topics:before { - content: "\f450"; -} - -.dashicons-buddicons-tracking:before { - content: "\f455"; -} - -.dashicons-building:before { - content: "\f512"; -} - -.dashicons-businessman:before { - content: "\f338"; -} - -.dashicons-businessperson:before { - content: "\f12e"; -} - -.dashicons-businesswoman:before { - content: "\f12f"; -} - -.dashicons-button:before { - content: "\f11a"; -} - -.dashicons-calculator:before { - content: "\f16e"; -} - -.dashicons-calendar-alt:before { - content: "\f508"; -} - -.dashicons-calendar:before { - content: "\f145"; -} - -.dashicons-camera-alt:before { - content: "\f129"; -} - -.dashicons-camera:before { - content: "\f306"; -} - -.dashicons-car:before { - content: "\f16b"; -} - -.dashicons-carrot:before { - content: "\f511"; -} - -.dashicons-cart:before { - content: "\f174"; -} - -.dashicons-category:before { - content: "\f318"; -} - -.dashicons-chart-area:before { - content: "\f239"; -} - -.dashicons-chart-bar:before { - content: "\f185"; -} - -.dashicons-chart-line:before { - content: "\f238"; -} - -.dashicons-chart-pie:before { - content: "\f184"; -} - -.dashicons-clipboard:before { - content: "\f481"; -} - -.dashicons-clock:before { - content: "\f469"; -} - -.dashicons-cloud-saved:before { - content: "\f137"; -} - -.dashicons-cloud-upload:before { - content: "\f13b"; -} - -.dashicons-cloud:before { - content: "\f176"; -} - -.dashicons-code-standards:before { - content: "\f13a"; -} - -.dashicons-coffee:before { - content: "\f16f"; -} - -.dashicons-color-picker:before { - content: "\f131"; -} - -.dashicons-columns:before { - content: "\f13c"; -} - -.dashicons-controls-back:before { - content: "\f518"; -} - -.dashicons-controls-forward:before { - content: "\f519"; -} - -.dashicons-controls-pause:before { - content: "\f523"; -} - -.dashicons-controls-play:before { - content: "\f522"; -} - -.dashicons-controls-repeat:before { - content: "\f515"; -} - -.dashicons-controls-skipback:before { - content: "\f516"; -} - -.dashicons-controls-skipforward:before { - content: "\f517"; -} - -.dashicons-controls-volumeoff:before { - content: "\f520"; -} - -.dashicons-controls-volumeon:before { - content: "\f521"; -} - -.dashicons-cover-image:before { - content: "\f13d"; -} - -.dashicons-dashboard:before { - content: "\f226"; -} - -.dashicons-database-add:before { - content: "\f170"; -} - -.dashicons-database-export:before { - content: "\f17a"; -} - -.dashicons-database-import:before { - content: "\f17b"; -} - -.dashicons-database-remove:before { - content: "\f17c"; -} - -.dashicons-database-view:before { - content: "\f17d"; -} - -.dashicons-database:before { - content: "\f17e"; -} - -.dashicons-desktop:before { - content: "\f472"; -} - -.dashicons-dismiss:before { - content: "\f153"; -} - -.dashicons-download:before { - content: "\f316"; -} - -.dashicons-drumstick:before { - content: "\f17f"; -} - -.dashicons-edit-large:before { - content: "\f327"; -} - -.dashicons-edit-page:before { - content: "\f186"; -} - -.dashicons-edit:before { - content: "\f464"; -} - -.dashicons-editor-aligncenter:before { - content: "\f207"; -} - -.dashicons-editor-alignleft:before { - content: "\f206"; -} - -.dashicons-editor-alignright:before { - content: "\f208"; -} - -.dashicons-editor-bold:before { - content: "\f200"; -} - -.dashicons-editor-break:before { - content: "\f474"; -} - -.dashicons-editor-code-duplicate:before { - content: "\f494"; -} - -.dashicons-editor-code:before { - content: "\f475"; -} - -.dashicons-editor-contract:before { - content: "\f506"; -} - -.dashicons-editor-customchar:before { - content: "\f220"; -} - -.dashicons-editor-expand:before { - content: "\f211"; -} - -.dashicons-editor-help:before { - content: "\f223"; -} - -.dashicons-editor-indent:before { - content: "\f222"; -} - -.dashicons-editor-insertmore:before { - content: "\f209"; -} - -.dashicons-editor-italic:before { - content: "\f201"; -} - -.dashicons-editor-justify:before { - content: "\f214"; -} - -.dashicons-editor-kitchensink:before { - content: "\f212"; -} - -.dashicons-editor-ltr:before { - content: "\f10c"; -} - -.dashicons-editor-ol-rtl:before { - content: "\f12c"; -} - -.dashicons-editor-ol:before { - content: "\f204"; -} - -.dashicons-editor-outdent:before { - content: "\f221"; -} - -.dashicons-editor-paragraph:before { - content: "\f476"; -} - -.dashicons-editor-paste-text:before { - content: "\f217"; -} - -.dashicons-editor-paste-word:before { - content: "\f216"; -} - -.dashicons-editor-quote:before { - content: "\f205"; -} - -.dashicons-editor-removeformatting:before { - content: "\f218"; -} - -.dashicons-editor-rtl:before { - content: "\f320"; -} - -.dashicons-editor-spellcheck:before { - content: "\f210"; -} - -.dashicons-editor-strikethrough:before { - content: "\f224"; -} - -.dashicons-editor-table:before { - content: "\f535"; -} - -.dashicons-editor-textcolor:before { - content: "\f215"; -} - -.dashicons-editor-ul:before { - content: "\f203"; -} - -.dashicons-editor-underline:before { - content: "\f213"; -} - -.dashicons-editor-unlink:before { - content: "\f225"; -} - -.dashicons-editor-video:before { - content: "\f219"; -} - -.dashicons-ellipsis:before { - content: "\f11c"; -} - -.dashicons-email-alt:before { - content: "\f466"; -} - -.dashicons-email-alt2:before { - content: "\f467"; -} - -.dashicons-email:before { - content: "\f465"; -} - -.dashicons-embed-audio:before { - content: "\f13e"; -} - -.dashicons-embed-generic:before { - content: "\f13f"; -} - -.dashicons-embed-photo:before { - content: "\f144"; -} - -.dashicons-embed-post:before { - content: "\f146"; -} - -.dashicons-embed-video:before { - content: "\f149"; -} - -.dashicons-excerpt-view:before { - content: "\f164"; -} - -.dashicons-exit:before { - content: "\f14a"; -} - -.dashicons-external:before { - content: "\f504"; -} - -.dashicons-facebook-alt:before { - content: "\f305"; -} - -.dashicons-facebook:before { - content: "\f304"; -} - -.dashicons-feedback:before { - content: "\f175"; -} - -.dashicons-filter:before { - content: "\f536"; -} - -.dashicons-flag:before { - content: "\f227"; -} - -.dashicons-food:before { - content: "\f187"; -} - -.dashicons-format-aside:before { - content: "\f123"; -} - -.dashicons-format-audio:before { - content: "\f127"; -} - -.dashicons-format-chat:before { - content: "\f125"; -} - -.dashicons-format-gallery:before { - content: "\f161"; -} - -.dashicons-format-image:before { - content: "\f128"; -} - -.dashicons-format-quote:before { - content: "\f122"; -} - -.dashicons-format-status:before { - content: "\f130"; -} - -.dashicons-format-video:before { - content: "\f126"; -} - -.dashicons-forms:before { - content: "\f314"; -} - -.dashicons-fullscreen-alt:before { - content: "\f188"; -} - -.dashicons-fullscreen-exit-alt:before { - content: "\f189"; -} - -.dashicons-games:before { - content: "\f18a"; -} - -.dashicons-google:before { - content: "\f18b"; -} - -.dashicons-googleplus:before { - content: "\f462"; -} - -.dashicons-grid-view:before { - content: "\f509"; -} - -.dashicons-groups:before { - content: "\f307"; -} - -.dashicons-hammer:before { - content: "\f308"; -} - -.dashicons-heading:before { - content: "\f10e"; -} - -.dashicons-heart:before { - content: "\f487"; -} - -.dashicons-hidden:before { - content: "\f530"; -} - -.dashicons-hourglass:before { - content: "\f18c"; -} - -.dashicons-html:before { - content: "\f14b"; -} - -.dashicons-id-alt:before { - content: "\f337"; -} - -.dashicons-id:before { - content: "\f336"; -} - -.dashicons-image-crop:before { - content: "\f165"; -} - -.dashicons-image-filter:before { - content: "\f533"; -} - -.dashicons-image-flip-horizontal:before { - content: "\f169"; -} - -.dashicons-image-flip-vertical:before { - content: "\f168"; -} - -.dashicons-image-rotate-left:before { - content: "\f166"; -} - -.dashicons-image-rotate-right:before { - content: "\f167"; -} - -.dashicons-image-rotate:before { - content: "\f531"; -} - -.dashicons-images-alt:before { - content: "\f232"; -} - -.dashicons-images-alt2:before { - content: "\f233"; -} - -.dashicons-index-card:before { - content: "\f510"; -} - -.dashicons-info-outline:before { - content: "\f14c"; -} - -.dashicons-info:before { - content: "\f348"; -} - -.dashicons-insert-after:before { - content: "\f14d"; -} - -.dashicons-insert-before:before { - content: "\f14e"; -} - -.dashicons-insert:before { - content: "\f10f"; -} - -.dashicons-instagram:before { - content: "\f12d"; -} - -.dashicons-laptop:before { - content: "\f547"; -} - -.dashicons-layout:before { - content: "\f538"; -} - -.dashicons-leftright:before { - content: "\f229"; -} - -.dashicons-lightbulb:before { - content: "\f339"; -} - -.dashicons-linkedin:before { - content: "\f18d"; -} - -.dashicons-list-view:before { - content: "\f163"; -} - -.dashicons-location-alt:before { - content: "\f231"; -} - -.dashicons-location:before { - content: "\f230"; -} - -.dashicons-lock-duplicate:before { - content: "\f315"; -} - -.dashicons-lock:before { - content: "\f160"; -} - -.dashicons-marker:before { - content: "\f159"; -} - -.dashicons-media-archive:before { - content: "\f501"; -} - -.dashicons-media-audio:before { - content: "\f500"; -} - -.dashicons-media-code:before { - content: "\f499"; -} - -.dashicons-media-default:before { - content: "\f498"; -} - -.dashicons-media-document:before { - content: "\f497"; -} - -.dashicons-media-interactive:before { - content: "\f496"; -} - -.dashicons-media-spreadsheet:before { - content: "\f495"; -} - -.dashicons-media-text:before { - content: "\f491"; -} - -.dashicons-media-video:before { - content: "\f490"; -} - -.dashicons-megaphone:before { - content: "\f488"; -} - -.dashicons-menu-alt:before { - content: "\f228"; -} - -.dashicons-menu-alt2:before { - content: "\f329"; -} - -.dashicons-menu-alt3:before { - content: "\f349"; -} - -.dashicons-menu:before { - content: "\f333"; -} - -.dashicons-microphone:before { - content: "\f482"; -} - -.dashicons-migrate:before { - content: "\f310"; -} - -.dashicons-minus:before { - content: "\f460"; -} - -.dashicons-money-alt:before { - content: "\f18e"; -} - -.dashicons-money:before { - content: "\f526"; -} - -.dashicons-move:before { - content: "\f545"; -} - -.dashicons-nametag:before { - content: "\f484"; -} - -.dashicons-networking:before { - content: "\f325"; -} - -.dashicons-no-alt:before { - content: "\f335"; -} - -.dashicons-no:before { - content: "\f158"; -} - -.dashicons-open-folder:before { - content: "\f18f"; -} - -.dashicons-palmtree:before { - content: "\f527"; -} - -.dashicons-paperclip:before { - content: "\f546"; -} - -.dashicons-pdf:before { - content: "\f190"; -} - -.dashicons-performance:before { - content: "\f311"; -} - -.dashicons-pets:before { - content: "\f191"; -} - -.dashicons-phone:before { - content: "\f525"; -} - -.dashicons-pinterest:before { - content: "\f192"; -} - -.dashicons-playlist-audio:before { - content: "\f492"; -} - -.dashicons-playlist-video:before { - content: "\f493"; -} - -.dashicons-plugins-checked:before { - content: "\f485"; -} - -.dashicons-plus-alt:before { - content: "\f502"; -} - -.dashicons-plus-alt2:before { - content: "\f543"; -} - -.dashicons-plus:before { - content: "\f132"; -} - -.dashicons-podio:before { - content: "\f19c"; -} - -.dashicons-portfolio:before { - content: "\f322"; -} - -.dashicons-post-status:before { - content: "\f173"; -} - -.dashicons-pressthis:before { - content: "\f157"; -} - -.dashicons-printer:before { - content: "\f193"; -} - -.dashicons-privacy:before { - content: "\f194"; -} - -.dashicons-products:before { - content: "\f312"; -} - -.dashicons-randomize:before { - content: "\f503"; -} - -.dashicons-reddit:before { - content: "\f195"; -} - -.dashicons-redo:before { - content: "\f172"; -} - -.dashicons-remove:before { - content: "\f14f"; -} - -.dashicons-rest-api:before { - content: "\f124"; -} - -.dashicons-rss:before { - content: "\f303"; -} - -.dashicons-saved:before { - content: "\f15e"; -} - -.dashicons-schedule:before { - content: "\f489"; -} - -.dashicons-screenoptions:before { - content: "\f180"; -} - -.dashicons-search:before { - content: "\f179"; -} - -.dashicons-share-alt:before { - content: "\f240"; -} - -.dashicons-share-alt2:before { - content: "\f242"; -} - -.dashicons-share:before { - content: "\f237"; -} - -.dashicons-shield-alt:before { - content: "\f334"; -} - -.dashicons-shield:before { - content: "\f332"; -} - -.dashicons-shortcode:before { - content: "\f150"; -} - -.dashicons-slides:before { - content: "\f181"; -} - -.dashicons-smartphone:before { - content: "\f470"; -} - -.dashicons-smiley:before { - content: "\f328"; -} - -.dashicons-sort:before { - content: "\f156"; -} - -.dashicons-sos:before { - content: "\f468"; -} - -.dashicons-spotify:before { - content: "\f196"; -} - -.dashicons-star-empty:before { - content: "\f154"; -} - -.dashicons-star-filled:before { - content: "\f155"; -} - -.dashicons-star-half:before { - content: "\f459"; -} - -.dashicons-sticky:before { - content: "\f537"; -} - -.dashicons-store:before { - content: "\f513"; -} - -.dashicons-superhero-alt:before { - content: "\f197"; -} - -.dashicons-superhero:before { - content: "\f198"; -} - -.dashicons-table-col-after:before { - content: "\f151"; -} - -.dashicons-table-col-before:before { - content: "\f152"; -} - -.dashicons-table-col-delete:before { - content: "\f15a"; -} - -.dashicons-table-row-after:before { - content: "\f15b"; -} - -.dashicons-table-row-before:before { - content: "\f15c"; -} - -.dashicons-table-row-delete:before { - content: "\f15d"; -} - -.dashicons-tablet:before { - content: "\f471"; -} - -.dashicons-tag:before { - content: "\f323"; -} - -.dashicons-tagcloud:before { - content: "\f479"; -} - -.dashicons-testimonial:before { - content: "\f473"; -} - -.dashicons-text-page:before { - content: "\f121"; -} - -.dashicons-text:before { - content: "\f478"; -} - -.dashicons-thumbs-down:before { - content: "\f542"; -} - -.dashicons-thumbs-up:before { - content: "\f529"; -} - -.dashicons-tickets-alt:before { - content: "\f524"; -} - -.dashicons-tickets:before { - content: "\f486"; -} - -.dashicons-tide:before { - content: "\f10d"; -} - -.dashicons-translation:before { - content: "\f326"; -} - -.dashicons-trash:before { - content: "\f182"; -} - -.dashicons-twitch:before { - content: "\f199"; -} - -.dashicons-twitter-alt:before { - content: "\f302"; -} - -.dashicons-twitter:before { - content: "\f301"; -} - -.dashicons-undo:before { - content: "\f171"; -} - -.dashicons-universal-access-alt:before { - content: "\f507"; -} - -.dashicons-universal-access:before { - content: "\f483"; -} - -.dashicons-unlock:before { - content: "\f528"; -} - -.dashicons-update-alt:before { - content: "\f113"; -} - -.dashicons-update:before { - content: "\f463"; -} - -.dashicons-upload:before { - content: "\f317"; -} - -.dashicons-vault:before { - content: "\f178"; -} - -.dashicons-video-alt:before { - content: "\f234"; -} - -.dashicons-video-alt2:before { - content: "\f235"; -} - -.dashicons-video-alt3:before { - content: "\f236"; -} - -.dashicons-visibility:before { - content: "\f177"; -} - -.dashicons-warning:before { - content: "\f534"; -} - -.dashicons-welcome-add-page:before { - content: "\f133"; -} - -.dashicons-welcome-comments:before { - content: "\f117"; -} - -.dashicons-welcome-learn-more:before { - content: "\f118"; -} - -.dashicons-welcome-view-site:before { - content: "\f115"; -} - -.dashicons-welcome-widgets-menus:before { - content: "\f116"; -} - -.dashicons-welcome-write-blog:before { - content: "\f119"; -} - -.dashicons-whatsapp:before { - content: "\f19a"; -} - -.dashicons-wordpress-alt:before { - content: "\f324"; -} - -.dashicons-wordpress:before { - content: "\f120"; -} - -.dashicons-xing:before { - content: "\f19d"; -} - -.dashicons-yes-alt:before { - content: "\f12a"; -} - -.dashicons-yes:before { - content: "\f147"; -} - -.dashicons-youtube:before { - content: "\f19b"; -} - -/* Additional CSS classes, manually added to the CSS template file */ - -.dashicons-editor-distractionfree:before { - content: "\f211"; -} - -/* This is a typo, but was previously released. It should remain for backward compatibility. See https://core.trac.wordpress.org/ticket/30832. */ -.dashicons-exerpt-view:before { - content: "\f164"; -} - -.dashicons-format-links:before { - content: "\f103"; -} - -.dashicons-format-standard:before { - content: "\f109"; -} - -.dashicons-post-trash:before { - content: "\f182"; -} - -.dashicons-share1:before { - content: "\f237"; -} - -.dashicons-welcome-edit-page:before { - content: "\f119"; -} -/*! This file is auto-generated */ -/*------------------------------------------------------------------------------ - Interim login dialog -------------------------------------------------------------------------------*/ - -#wp-auth-check-wrap.hidden { - display: none; -} - -#wp-auth-check-wrap #wp-auth-check-bg { - position: fixed; - top: 0; - bottom: 0; - right: 0; - left: 0; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 1000010; /* needs to appear above .notification-dialog */ -} - -#wp-auth-check-wrap #wp-auth-check { - position: fixed; - right: 50%; - overflow: hidden; - top: 40px; - bottom: 20px; - max-height: 415px; - width: 380px; - margin: 0 -190px 0 0; - padding: 30px 0 0; - background-color: #f0f0f1; - z-index: 1000011; /* needs to appear above #wp-auth-check-bg */ - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); -} - -@media screen and (max-width: 380px) { - #wp-auth-check-wrap #wp-auth-check { - right: 0; - width: 100%; - margin: 0; - } -} - -#wp-auth-check-wrap.fallback #wp-auth-check { - max-height: 180px; - overflow: auto; -} - -#wp-auth-check-wrap #wp-auth-check-form { - height: 100%; - position: relative; - overflow: auto; - -webkit-overflow-scrolling: touch; -} - -#wp-auth-check-form.loading:before { - content: ""; - display: block; - width: 20px; - height: 20px; - position: absolute; - right: 50%; - top: 50%; - margin: -10px -10px 0 0; - background: url(../images/spinner.gif) no-repeat center; - background-size: 20px 20px; - transform: translateZ(0); -} - -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - - #wp-auth-check-form.loading:before { - background-image: url(../images/spinner-2x.gif); - } - -} - -#wp-auth-check-wrap #wp-auth-check-form iframe { - height: 98%; /* Scrollbar fix */ - width: 100%; -} - -#wp-auth-check-wrap .wp-auth-check-close { - position: absolute; - top: 5px; - left: 5px; - height: 22px; - width: 22px; - color: #787c82; - text-decoration: none; - text-align: center; -} - -#wp-auth-check-wrap .wp-auth-check-close:before { - content: "\f158"; - font: normal 20px/22px dashicons; - speak: never; - -webkit-font-smoothing: antialiased !important; - -moz-osx-font-smoothing: grayscale; -} - -#wp-auth-check-wrap .wp-auth-check-close:hover, -#wp-auth-check-wrap .wp-auth-check-close:focus { - color: #2271b1; -} - -#wp-auth-check-wrap .wp-auth-fallback-expired { - outline: 0; -} - -#wp-auth-check-wrap .wp-auth-fallback { - font-size: 14px; - line-height: 1.5; - padding: 0 25px; - display: none; -} - -#wp-auth-check-wrap.fallback .wp-auth-fallback, -#wp-auth-check-wrap.fallback .wp-auth-check-close { - display: block; -} -/*! This file is auto-generated */ -.media-modal *{box-sizing:content-box}.media-modal input,.media-modal select,.media-modal textarea{box-sizing:border-box}.media-frame,.media-modal{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:12px;-webkit-overflow-scrolling:touch}.media-modal legend{padding:0;font-size:13px}.media-modal label{font-size:13px}.media-modal .legend-inline{position:absolute;transform:translate(100%,50%);margin-right:-1%;line-height:1.2}.media-frame a{border-bottom:none;color:#2271b1}.media-frame a:active,.media-frame a:hover{color:#135e96}.media-frame a:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-frame a.button{color:#2c3338}.media-frame a.button:hover{color:#1d2327}.media-frame a.button-primary,.media-frame a.button-primary:hover{color:#fff}.media-frame input,.media-frame textarea{padding:6px 8px}.media-frame select,.wp-admin .media-frame select{min-height:30px;vertical-align:middle}.media-frame input[type=color],.media-frame input[type=date],.media-frame input[type=datetime-local],.media-frame input[type=datetime],.media-frame input[type=email],.media-frame input[type=month],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=tel],.media-frame input[type=text],.media-frame input[type=time],.media-frame input[type=url],.media-frame input[type=week],.media-frame select,.media-frame textarea{box-shadow:0 0 0 transparent;border-radius:4px;border:1px solid #8c8f94;background-color:#fff;color:#2c3338;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px}.media-frame input[type=date],.media-frame input[type=datetime-local],.media-frame input[type=datetime],.media-frame input[type=email],.media-frame input[type=month],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=tel],.media-frame input[type=text],.media-frame input[type=time],.media-frame input[type=url],.media-frame input[type=week]{padding:0 8px;line-height:2.15384615}.media-frame.mode-grid .wp-filter input[type=search]{font-size:14px;line-height:2}.media-frame input[type=email]:focus,.media-frame input[type=number]:focus,.media-frame input[type=password]:focus,.media-frame input[type=search]:focus,.media-frame input[type=text]:focus,.media-frame input[type=url]:focus,.media-frame select:focus,.media-frame textarea:focus{border-color:#3582c4;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent}.media-frame input:disabled,.media-frame input[readonly],.media-frame textarea:disabled,.media-frame textarea[readonly]{background-color:#f0f0f1}.media-frame input[type=search]{-webkit-appearance:textfield}.media-frame ::-webkit-input-placeholder{color:#646970}.media-frame ::-moz-placeholder{color:#646970;opacity:1}.media-frame :-ms-input-placeholder{color:#646970}.media-frame .hidden,.media-frame .setting.hidden{display:none}/*! - * jQuery UI Draggable/Sortable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */.ui-draggable-handle,.ui-sortable-handle{touch-action:none}.media-modal{position:fixed;top:30px;right:30px;left:30px;bottom:30px;z-index:160000}.wp-customizer .media-modal{z-index:560000}.media-modal-backdrop{position:fixed;top:0;right:0;left:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:159900}.wp-customizer .media-modal-backdrop{z-index:559900}.media-modal-close{position:absolute;top:0;left:0;width:50px;height:50px;margin:0;padding:0;border:1px solid transparent;background:0 0;color:#646970;z-index:1000;cursor:pointer;outline:0;transition:color .1s ease-in-out,background .1s ease-in-out}.media-modal-close:active,.media-modal-close:hover{color:#135e96}.media-modal-close:focus{color:#135e96;border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8);outline:2px solid transparent}.media-modal-close span.media-modal-icon{background-image:none}.media-modal-close .media-modal-icon:before{content:"\f158";font:normal 20px/1 dashicons;speak:never;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.media-modal-content{position:absolute;top:0;right:0;left:0;bottom:0;overflow:auto;min-height:300px;box-shadow:0 5px 15px rgba(0,0,0,.7);background:#fff;-webkit-font-smoothing:subpixel-antialiased}.media-modal-content .media-frame select.attachment-filters{margin-top:32px;margin-left:2%;width:42%;width:calc(48% - 12px)}.media-modal-content .attachments-browser .search{width:100%}.wp-core-ui .media-modal-icon{background-image:url(../images/uploader-icons.png);background-repeat:no-repeat}.media-toolbar{position:absolute;top:0;right:0;left:0;z-index:100;height:60px;padding:0 16px;border:0 solid #dcdcde;overflow:hidden}.media-frame-toolbar .media-toolbar{top:auto;bottom:-47px;height:auto;overflow:visible;border-top:1px solid #dcdcde}.media-toolbar-primary{float:left;height:100%;position:relative}.media-toolbar-secondary{float:right;height:100%}.media-toolbar-primary>.media-button,.media-toolbar-primary>.media-button-group{margin-right:10px;float:right;margin-top:15px}.media-toolbar-secondary>.media-button,.media-toolbar-secondary>.media-button-group{margin-left:10px;margin-top:15px}.media-sidebar{position:absolute;top:0;left:0;bottom:0;width:267px;padding:0 16px;z-index:75;background:#f6f7f7;border-right:1px solid #dcdcde;overflow:auto;-webkit-overflow-scrolling:touch}.media-sidebar::after{content:"";display:flex;clear:both;height:24px}.hide-toolbar .media-sidebar{bottom:0}.image-details h2:not(.media-attachments-filter-heading),.media-sidebar h2{position:relative;font-weight:600;text-transform:uppercase;font-size:12px;color:#646970;margin:24px 0 8px}.attachment-details .setting,.media-sidebar .setting{display:block;float:right;width:100%;margin:0 0 10px}.media-sidebar .collection-settings .setting{margin:1px 0}.attachment-details .setting.has-description,.media-sidebar .setting.has-description{margin-bottom:5px}.media-sidebar .setting .link-to-custom{margin:3px 2px 0}.attachment-details .setting .name,.attachment-details .setting span,.media-sidebar .setting .name,.media-sidebar .setting .value,.media-sidebar .setting span{min-width:30%;margin-left:4%;font-size:12px;text-align:left;word-wrap:break-word}.media-sidebar .setting .name{max-width:80px}.media-sidebar .setting .value{text-align:right}.media-sidebar .setting select{max-width:65%}.attachment-details .field input[type=checkbox],.attachment-details .field input[type=radio],.attachment-details .setting input[type=checkbox],.attachment-details .setting input[type=radio],.media-sidebar .field input[type=checkbox],.media-sidebar .field input[type=radio],.media-sidebar .setting input[type=checkbox],.media-sidebar .setting input[type=radio]{float:none;margin:8px 3px 0;padding:0}.attachment-details .setting .name,.attachment-details .setting .value,.attachment-details .setting span,.compat-item label span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting .name,.media-sidebar .setting .value,.media-sidebar .setting span{float:right;min-height:22px;padding-top:8px;line-height:1.33333333;font-weight:400;color:#646970}.media-sidebar .checkbox-label-inline{font-size:12px}.attachment-details .copy-to-clipboard-container,.media-sidebar .copy-to-clipboard-container{flex-wrap:wrap;margin-top:10px;margin-right:calc(35% - 1px);padding-top:10px}.attachment-details .attachment-info .copy-to-clipboard-container{float:none}.attachment-details .copy-to-clipboard-container .success,.media-sidebar .copy-to-clipboard-container .success{padding:0;min-height:0;line-height:2.18181818;text-align:right;color:#008a20}.compat-item label span{text-align:left}.attachment-details .setting .value,.attachment-details .setting input[type=email],.attachment-details .setting input[type=number],.attachment-details .setting input[type=password],.attachment-details .setting input[type=search],.attachment-details .setting input[type=tel],.attachment-details .setting input[type=text],.attachment-details .setting input[type=url],.attachment-details .setting textarea,.attachment-details .setting+.description,.media-sidebar .setting .value,.media-sidebar .setting input[type=email],.media-sidebar .setting input[type=number],.media-sidebar .setting input[type=password],.media-sidebar .setting input[type=search],.media-sidebar .setting input[type=tel],.media-sidebar .setting input[type=text],.media-sidebar .setting input[type=url],.media-sidebar .setting textarea{box-sizing:border-box;margin:1px;width:65%;float:left}.attachment-details .setting .value,.attachment-details .setting+.description,.media-sidebar .setting .value{margin:0 1px;text-align:right}.attachment-details .setting+.description{clear:both;font-size:12px;font-style:normal;margin-bottom:10px}.attachment-details .setting textarea,.compat-item .field textarea,.media-sidebar .setting textarea{height:62px;resize:vertical}.compat-item{float:right;width:100%;overflow:hidden}.compat-item table{width:100%;table-layout:fixed;border-spacing:0;border:0}.compat-item tr{padding:2px 0;display:block;overflow:hidden}.compat-item .field,.compat-item .label{display:block;margin:0;padding:0}.compat-item .label{min-width:30%;margin-left:4%;float:right;text-align:left}.compat-item .label span{display:block;width:100%}.compat-item .field{float:left;width:65%;margin:1px}.compat-item .field input[type=email],.compat-item .field input[type=number],.compat-item .field input[type=password],.compat-item .field input[type=search],.compat-item .field input[type=tel],.compat-item .field input[type=text],.compat-item .field input[type=url],.compat-item .field textarea{width:100%;margin:0;box-sizing:border-box}.sidebar-for-errors .attachment-details,.sidebar-for-errors .compat-item,.sidebar-for-errors .media-sidebar .media-progress-bar,.sidebar-for-errors .upload-details{display:none!important}.media-menu{position:absolute;top:0;right:0;left:0;bottom:0;margin:0;padding:50px 0 10px;background:#f6f7f7;border-left-width:1px;border-left-style:solid;border-left-color:#c3c4c7;-webkit-user-select:none;user-select:none}.media-menu .media-menu-item{display:block;box-sizing:border-box;width:100%;position:relative;border:0;margin:0;padding:8px 20px;font-size:14px;line-height:1.28571428;background:0 0;color:#2271b1;text-align:right;text-decoration:none;cursor:pointer}.media-menu .media-menu-item:hover{background:rgba(0,0,0,.04)}.media-menu .media-menu-item:active{color:#2271b1;outline:0}.media-menu .active,.media-menu .active:hover{color:#1d2327;font-weight:600}.media-menu .media-menu-item:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #dcdcde}.media-router{position:relative;padding:0 6px;margin:0;clear:both}.media-router .media-menu-item{position:relative;float:right;border:0;margin:0;padding:8px 10px 9px;height:18px;line-height:1.28571428;font-size:14px;text-decoration:none;background:0 0;cursor:pointer;transition:none}.media-router .media-menu-item:last-child{border-left:0}.media-router .media-menu-item:active,.media-router .media-menu-item:hover{color:#2271b1}.media-router .active,.media-router .active:hover{color:#1d2327}.media-router .media-menu-item:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-router .active,.media-router .media-menu-item.active:last-child{margin:-1px -1px 0;background:#fff;border:1px solid #dcdcde;border-bottom:none}.media-router .active:after{display:none}.media-frame{overflow:hidden;position:absolute;top:0;right:0;left:0;bottom:0}.media-frame-menu{position:absolute;top:0;right:0;bottom:0;width:200px;z-index:150}.media-frame-title{position:absolute;top:0;right:200px;left:0;height:50px;z-index:200}.media-frame-router{position:absolute;top:50px;right:200px;left:0;height:36px;z-index:200}.media-frame-content{position:absolute;top:84px;right:200px;left:0;bottom:61px;height:auto;width:auto;margin:0;overflow:auto;background:#fff;border-top:1px solid #dcdcde}.media-frame-toolbar{position:absolute;right:200px;left:0;z-index:100;bottom:60px;height:auto}.media-frame.hide-menu .media-frame-content,.media-frame.hide-menu .media-frame-router,.media-frame.hide-menu .media-frame-title,.media-frame.hide-menu .media-frame-toolbar{right:0}.media-frame.hide-toolbar .media-frame-content{bottom:0}.media-frame.hide-router .media-frame-content{top:50px}.media-frame.hide-menu .media-frame-menu,.media-frame.hide-menu .media-frame-menu-heading,.media-frame.hide-router .media-frame-router,.media-frame.hide-toolbar .media-frame-toolbar{display:none}.media-frame-title h1{padding:0 16px;font-size:22px;line-height:2.27272727;margin:0}.media-attachments-filter-heading,.media-frame-menu-heading{position:absolute;right:20px;top:22px;margin:0;font-size:13px;line-height:1;z-index:151}.media-attachments-filter-heading{top:10px;right:16px}.mode-grid .media-attachments-filter-heading{top:0;right:-9999px}.mode-grid .media-frame-actions-heading{display:none}.wp-core-ui .button.media-frame-menu-toggle{display:none}.media-frame-title .suggested-dimensions{font-size:14px;float:left;margin-left:20px}.media-frame-content .crop-content{height:100%}.wp-customizer:not(.mobile) .media-frame-content .crop-content.site-icon{margin-left:300px}.media-frame-content .crop-content .crop-image{display:block;margin:auto;max-width:100%;max-height:100%}.media-frame-content .crop-content .upload-errors{position:absolute;width:300px;top:50%;right:50%;margin-right:-150px;margin-left:-150px;z-index:600000}.media-frame .media-iframe{overflow:hidden}.media-frame .media-iframe,.media-frame .media-iframe iframe{height:100%;width:100%;border:0}.media-frame select.attachment-filters{margin-top:11px;margin-left:2%;max-width:42%;max-width:calc(48% - 12px)}.media-frame select.attachment-filters:last-of-type{margin-left:0;width:auto;max-width:100%}.media-frame .search{margin:32px 0 0;padding:4px;font-size:13px;color:#3c434a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;-webkit-appearance:none}.media-toolbar-primary .search{max-width:100%}.media-frame .media-search-input-label{position:absolute;right:0;top:10px;margin:0;line-height:1}.wp-core-ui .attachments{margin:0;-webkit-overflow-scrolling:touch}.wp-core-ui .attachment{position:relative;float:right;padding:8px;margin:0;color:#3c434a;cursor:pointer;list-style:none;text-align:center;-webkit-user-select:none;user-select:none;width:25%;box-sizing:border-box}.wp-core-ui .attachment.details:focus,.wp-core-ui .attachment:focus,.wp-core-ui .selected.attachment:focus{box-shadow:inset 0 0 2px 3px #fff,inset 0 0 0 7px #4f94d4;outline:2px solid transparent;outline-offset:-6px}.wp-core-ui .selected.attachment{box-shadow:inset 0 0 0 5px #fff,inset 0 0 0 7px #c3c4c7}.wp-core-ui .attachment.details{box-shadow:inset 0 0 0 3px #fff,inset 0 0 0 7px #2271b1}.wp-core-ui .attachment-preview{position:relative;box-shadow:inset 0 0 15px rgba(0,0,0,.1),inset 0 0 0 1px rgba(0,0,0,.05);background:#f0f0f1;cursor:pointer}.wp-core-ui .attachment-preview:before{content:"";display:block;padding-top:100%}.wp-core-ui .attachment .icon{margin:0 auto;overflow:hidden}.wp-core-ui .attachment .thumbnail{overflow:hidden;position:absolute;top:0;left:0;bottom:0;right:0;opacity:1;transition:opacity .1s}.wp-core-ui .attachment .portrait img{max-width:100%}.wp-core-ui .attachment .landscape img{max-height:100%}.wp-core-ui .attachment .thumbnail:after{content:"";display:block;position:absolute;top:0;right:0;left:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);overflow:hidden}.wp-core-ui .attachment .thumbnail img{top:0;right:0}.wp-core-ui .attachment .thumbnail .centered{position:absolute;top:0;right:0;width:100%;height:100%;transform:translate(-50%,50%)}.wp-core-ui .attachment .thumbnail .centered img{transform:translate(50%,-50%)}.wp-core-ui .attachments-browser .attachment .thumbnail .centered img.icon{transform:translate(50%,-70%)}.wp-core-ui .attachment .filename{position:absolute;right:0;left:0;bottom:0;overflow:hidden;max-height:100%;word-wrap:break-word;text-align:center;font-weight:600;background:rgba(255,255,255,.8);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.wp-core-ui .attachment .filename div{padding:5px 10px}.wp-core-ui .attachment .thumbnail img{position:absolute}.wp-core-ui .attachment-close{display:block;position:absolute;top:5px;left:5px;height:22px;width:22px;padding:0;background-color:#fff;background-position:-96px 4px;border-radius:3px;box-shadow:0 0 0 1px rgba(0,0,0,.3);transition:none}.wp-core-ui .attachment-close:focus,.wp-core-ui .attachment-close:hover{background-position:-36px 4px}.wp-core-ui .attachment .check{display:none;height:24px;width:24px;padding:0;border:0;position:absolute;z-index:10;top:0;left:0;outline:0;background:#f0f0f1;cursor:pointer;box-shadow:0 0 0 1px #fff,0 0 0 2px rgba(0,0,0,.15)}.wp-core-ui .attachment .check .media-modal-icon{display:block;background-position:-1px 0;height:15px;width:15px;margin:5px}.wp-core-ui .attachment .check:hover .media-modal-icon{background-position:-40px 0}.wp-core-ui .attachment.selected .check{display:block}.wp-core-ui .attachment.details .check,.wp-core-ui .attachment.selected .check:focus,.wp-core-ui .media-frame.mode-grid .attachment.selected .check{background-color:#2271b1;box-shadow:0 0 0 1px #fff,0 0 0 2px #2271b1}.wp-core-ui .attachment.selected .check:focus{outline:2px solid transparent}.wp-core-ui .attachment.details .check .media-modal-icon,.wp-core-ui .media-frame.mode-grid .attachment.selected .check .media-modal-icon{background-position:-21px 0}.wp-core-ui .attachment.details .check:hover .media-modal-icon,.wp-core-ui .attachment.selected .check:focus .media-modal-icon,.wp-core-ui .media-frame.mode-grid .attachment.selected .check:hover .media-modal-icon{background-position:-60px 0}.wp-core-ui .media-frame .attachment .describe{position:relative;display:block;width:100%;margin:0;padding:0 8px;font-size:12px;border-radius:0}.media-frame .attachments-browser{position:relative;width:100%;height:100%;overflow:hidden}.attachments-browser .media-toolbar{left:300px;height:72px;background:#fff}.attachments-browser.hide-sidebar .media-toolbar{left:0}.attachments-browser .media-toolbar-primary>.media-button,.attachments-browser .media-toolbar-primary>.media-button-group,.attachments-browser .media-toolbar-secondary>.media-button,.attachments-browser .media-toolbar-secondary>.media-button-group{margin:10px 0}.attachments-browser .attachments{padding:2px 8px 8px}.attachments-browser .uploader-inline,.attachments-browser.has-load-more .attachments-wrapper,.attachments-browser:not(.has-load-more) .attachments{position:absolute;top:72px;right:0;left:300px;bottom:0;overflow:auto;outline:0}.attachments-browser .uploader-inline.hidden{display:none}.attachments-browser .media-toolbar-primary{max-width:33%}.mode-grid .attachments-browser .media-toolbar-primary{display:flex;align-items:center}.mode-grid .attachments-browser .media-toolbar-mode-select .media-toolbar-primary{display:none}.attachments-browser .media-toolbar-secondary{max-width:66%}.uploader-inline .close{background-color:transparent;border:0;cursor:pointer;height:48px;outline:0;padding:0;position:absolute;left:2px;text-align:center;top:2px;width:48px;z-index:1}.uploader-inline .close:before{font:normal 30px/1 dashicons!important;color:#50575e;display:inline-block;content:"\f335";font-weight:300;margin-top:1px}.uploader-inline .close:focus{outline:1px solid #4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.attachments-browser.hide-sidebar .attachments,.attachments-browser.hide-sidebar .uploader-inline{left:0;margin-left:0}.attachments-browser .instructions{display:inline-block;margin-top:16px;line-height:1.38461538;font-size:13px;color:#646970}.attachments-browser .no-media{padding:2em 2em 0 0}.more-loaded .attachment:not(.found-media){background:#dcdcde}.load-more-wrapper{clear:both;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;padding:1em 0}.load-more-wrapper .load-more-count{min-width:100%;margin:0 0 1em;text-align:center}.load-more-wrapper .load-more{margin:0}.media-frame .load-more-wrapper .load-more+.spinner{float:none;margin:0 10px 0 -30px}.media-frame .load-more-wrapper .load-more.hidden+.spinner{margin:0}.load-more-wrapper::after{content:"";min-width:100%;order:1}.load-more-wrapper .load-more-jump{margin:0 12px 0 0}.attachment.new-media{outline:2px dotted #c3c4c7}.load-more-wrapper{clear:both;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;padding:1em 0}.load-more-wrapper .load-more-count{min-width:100%;margin:0 0 1em;text-align:center}.load-more-wrapper .load-more{margin:0}.media-frame .load-more-wrapper .load-more+.spinner{float:none;margin:0 10px 0 -30px}.media-frame .load-more-wrapper .load-more.hidden+.spinner{margin:0}.load-more-wrapper::after{content:"";min-width:100%;order:1}.load-more-wrapper .load-more-jump{margin:0 12px 0 0}.media-progress-bar{position:relative;height:10px;width:70%;margin:10px auto;border-radius:10px;background:#dcdcde;background:rgba(0,0,0,.1)}.media-progress-bar div{height:10px;min-width:20px;width:0;background:#2271b1;border-radius:10px;transition:width .3s}.media-uploader-status .media-progress-bar{display:none;width:100%}.uploading.media-uploader-status .media-progress-bar{display:block}.attachment-preview .media-progress-bar{position:absolute;top:50%;right:15%;width:70%;margin:-5px 0 0}.media-uploader-status{position:relative;margin:0 auto;padding-bottom:10px;max-width:400px}.uploader-inline .media-uploader-status h2{display:none}.media-uploader-status .upload-details{display:none;font-size:12px;color:#646970}.uploading.media-uploader-status .upload-details{display:block}.media-uploader-status .upload-detail-separator{padding:0 4px}.media-uploader-status .upload-count{color:#3c434a}.media-uploader-status .upload-dismiss-errors,.media-uploader-status .upload-errors{display:none}.errors.media-uploader-status .upload-dismiss-errors,.errors.media-uploader-status .upload-errors{display:block}.media-uploader-status .upload-dismiss-errors{transition:none;text-decoration:none}.upload-errors .upload-error{padding:12px;margin-bottom:12px;background:#fff;border-right:4px solid #d63638;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.uploader-inline .upload-errors .upload-error{padding:12px 30px;background-color:#fcf0f1;box-shadow:none}.upload-errors .upload-error-filename{font-weight:600}.upload-errors .upload-error-message{display:block;padding-top:8px;word-wrap:break-word}.uploader-window,.wp-editor-wrap .uploader-editor{top:0;right:0;left:0;bottom:0;text-align:center;display:none}.uploader-window{position:fixed;z-index:250000;opacity:0;transition:opacity 250ms}.wp-editor-wrap .uploader-editor{position:absolute;z-index:99998;background:rgba(140,143,148,.9)}.uploader-window,.wp-editor-wrap .uploader-editor.droppable{background:rgba(10,75,120,.9)}.uploader-window-content,.wp-editor-wrap .uploader-editor-content{position:absolute;top:10px;right:10px;left:10px;bottom:10px;border:1px dashed #fff}.uploader-window .uploader-editor-title,.uploader-window h1,.wp-editor-wrap .uploader-editor .uploader-editor-title{position:absolute;top:50%;right:0;left:0;transform:translateY(-50%);font-size:3em;line-height:1.3;font-weight:600;color:#fff;margin:0;padding:0 10px}.wp-editor-wrap .uploader-editor .uploader-editor-title{display:none}.wp-editor-wrap .uploader-editor.droppable .uploader-editor-title{display:block}.uploader-window .media-progress-bar{margin-top:20px;max-width:300px;background:0 0;border-color:#fff;display:none}.uploader-window .media-progress-bar div{background:#fff}.uploading .uploader-window .media-progress-bar{display:block}.media-frame .uploader-inline{margin-bottom:20px;padding:0;text-align:center}.uploader-inline-content{position:absolute;top:30%;right:0;left:0}.uploader-inline-content .upload-ui{margin:2em 0}.uploader-inline-content .post-upload-ui{margin-bottom:2em}.uploader-inline .has-upload-message .upload-ui{margin:0 0 4em}.uploader-inline h2{font-size:20px;line-height:1.4;font-weight:400;margin:0}.uploader-inline .has-upload-message .upload-instructions{font-size:14px;color:#3c434a;font-weight:400}.uploader-inline .drop-instructions{display:none}.supports-drag-drop .uploader-inline .drop-instructions{display:block}.uploader-inline p{margin:.5em 0}.uploader-inline .media-progress-bar{display:none}.uploading.uploader-inline .media-progress-bar{display:block}.uploader-inline .browser{display:inline-block!important}.media-selection{position:absolute;top:0;right:0;left:350px;height:60px;padding:0 16px 0 0;overflow:hidden;white-space:nowrap}.media-selection .selection-info{display:inline-block;font-size:12px;height:60px;margin-left:10px;vertical-align:top}.media-selection.editing,.media-selection.empty{display:none}.media-selection.one .edit-selection{display:none}.media-selection .count{display:block;padding-top:12px;font-size:14px;line-height:1.42857142;font-weight:600}.media-selection .button-link{float:right;padding:1px 8px;margin:1px -8px 1px 8px;line-height:1.4;border-left:1px solid #dcdcde;color:#2271b1;text-decoration:none}.media-selection .button-link:focus,.media-selection .button-link:hover{color:#135e96}.media-selection .button-link:last-child{border-left:0;margin-left:0}.selection-info .clear-selection{color:#d63638}.selection-info .clear-selection:focus,.selection-info .clear-selection:hover{color:#d63638}.media-selection .selection-view{display:inline-block;vertical-align:top}.media-selection .attachments{display:inline-block;height:48px;margin:6px;padding:0;overflow:hidden;vertical-align:top}.media-selection .attachment{width:40px;padding:0;margin:4px}.media-selection .attachment .thumbnail{top:0;left:0;bottom:0;right:0}.media-selection .attachment .icon{width:50%}.media-selection .attachment-preview{box-shadow:none;background:0 0}.wp-core-ui .media-selection .attachment.details:focus,.wp-core-ui .media-selection .attachment:focus,.wp-core-ui .media-selection .selected.attachment:focus{box-shadow:0 0 0 1px #fff,0 0 2px 3px #4f94d4;outline:2px solid transparent}.wp-core-ui .media-selection .selected.attachment{box-shadow:none}.wp-core-ui .media-selection .attachment.details{box-shadow:0 0 0 1px #fff,0 0 0 3px #2271b1}.media-selection:after{content:"";display:block;position:absolute;top:0;left:0;bottom:0;width:25px;background-image:linear-gradient(to right,#fff,rgba(255,255,255,0))}.media-selection .attachment .filename{display:none}.media-frame .spinner{background:url(../images/spinner.gif) no-repeat;background-size:20px 20px;float:left;display:inline-block;visibility:hidden;opacity:.7;width:20px;height:20px;margin:0;vertical-align:middle}.media-frame.mode-grid .spinner{margin:0;float:none;vertical-align:middle}.media-modal .media-toolbar .spinner{float:none;vertical-align:bottom;margin:0 5px 5px 0}.media-frame .instructions+.spinner.is-active{vertical-align:middle}.media-frame .spinner.is-active{visibility:visible}.attachment-details{position:relative;overflow:auto}.attachment-details .settings-save-status{float:left;text-transform:none;font-weight:400}.attachment-details .settings-save-status .spinner{float:none;margin-right:5px}.attachment-details .settings-save-status .saved{display:none}.attachment-details.save-waiting .settings-save-status .spinner{visibility:visible}.attachment-details.save-complete .settings-save-status .saved{display:inline-block}.attachment-info{overflow:hidden;min-height:60px;margin-bottom:16px;line-height:1.5;color:#646970;border-bottom:1px solid #dcdcde;padding-bottom:11px}.attachment-info .wp-media-wrapper{margin-bottom:8px}.attachment-info .wp-media-wrapper.wp-audio{margin-top:13px}.attachment-info .filename{font-weight:600;color:#3c434a;word-wrap:break-word}.attachment-info .thumbnail{position:relative;float:right;max-width:120px;max-height:120px;margin-top:5px;margin-left:10px;margin-bottom:5px}.uploading .attachment-info .thumbnail{width:120px;height:80px;box-shadow:inset 0 0 15px rgba(0,0,0,.1)}.uploading .attachment-info .media-progress-bar{margin-top:35px}.attachment-info .thumbnail-image:after{content:"";display:block;position:absolute;top:0;right:0;left:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);overflow:hidden}.attachment-info .thumbnail img{display:block;max-width:120px;max-height:120px;margin:0 auto}.attachment-info .details{float:right;font-size:12px;max-width:100%}.attachment-info .delete-attachment,.attachment-info .edit-attachment,.attachment-info .trash-attachment,.attachment-info .untrash-attachment{display:block;text-decoration:none;white-space:nowrap}.attachment-details.needs-refresh .attachment-info .edit-attachment{display:none}.attachment-info .edit-attachment{display:block}.media-modal .delete-attachment,.media-modal .trash-attachment,.media-modal .untrash-attachment{display:inline;padding:0;color:#d63638}.media-modal .delete-attachment:focus,.media-modal .delete-attachment:hover,.media-modal .trash-attachment:focus,.media-modal .trash-attachment:hover,.media-modal .untrash-attachment:focus,.media-modal .untrash-attachment:hover{color:#d63638}.attachment-display-settings{width:100%;float:right;overflow:hidden}.collection-settings{overflow:hidden}.collection-settings .setting input[type=checkbox]{float:right;margin-left:8px}.collection-settings .setting .name,.collection-settings .setting span{min-width:inherit}.media-modal .imgedit-wrap{position:static}.media-modal .imgedit-wrap .imgedit-panel-content{padding:16px 16px 0;position:absolute;top:0;left:282px;bottom:0;right:0;overflow:auto}.media-modal .imgedit-wrap .imgedit-submit{margin-bottom:16px}.media-modal .imgedit-wrap .imgedit-settings{background:#f6f7f7;border-right:1px solid #dcdcde;padding:20px 16px 0;position:absolute;top:0;left:0;bottom:0;width:250px;overflow:auto}.media-modal .imgedit-wrap .imgedit-save-target{margin:8px 0 24px}.media-modal .imgedit-group{background:0 0;border:none;border-bottom:1px solid #dcdcde;box-shadow:none;margin:0;margin-bottom:16px;padding:0;padding-bottom:16px;position:relative}.media-modal .imgedit-group:last-of-type{border:none;margin:0;padding:0}.media-modal .imgedit-group-top{margin:0}.media-modal .imgedit-group-top h2,.media-modal .imgedit-group-top h2 .button-link{display:inline-block;text-transform:uppercase;font-size:12px;color:#646970;margin:0;margin-top:3px}.media-modal .imgedit-group-top h2 .button-link,.media-modal .imgedit-group-top h2 a{text-decoration:none;color:#646970}.wp-core-ui.media-modal .image-editor .imgedit-help-toggle,.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:active,.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:hover{border:1px solid transparent;margin:0;padding:0;background:0 0;color:#2271b1;font-size:20px;line-height:1;cursor:pointer;box-sizing:content-box;box-shadow:none}.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:focus{color:#2271b1;border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8);outline:2px solid transparent}.wp-core-ui.media-modal .imgedit-group-top .dashicons-arrow-down.imgedit-help-toggle{margin-top:-3px}.wp-core-ui.media-modal .image-editor h3 .imgedit-help-toggle{margin-top:-2px}.media-modal .imgedit-help-toggled span.dashicons:before{content:"\f142"}.media-modal .imgedit-thumbnail-preview{margin:10px 0 0 8px}.imgedit-thumbnail-preview-caption{display:block}.media-modal .imgedit-wrap .notice,.media-modal .imgedit-wrap div.updated{margin:0;margin-bottom:16px}.embed-url{display:block;position:relative;padding:16px;margin:0;z-index:250;background:#fff;font-size:18px}.media-frame .embed-url input{font-size:18px;line-height:1.22222222;padding:12px 14px 12px 40px;width:100%;min-width:200px;box-shadow:inset -2px 2px 4px -2px rgba(0,0,0,.1)}.media-frame .embed-url input::-ms-clear{display:none}.media-frame .embed-url .spinner{position:absolute;top:32px;left:26px}.media-frame .embed-loading .embed-url .spinner{visibility:visible}.embed-link-settings,.embed-media-settings{position:absolute;top:82px;right:0;left:0;bottom:0;padding:0 16px;overflow:auto}.media-embed .embed-link-settings .link-text{margin-top:0}.embed-link-settings::after,.embed-media-settings::after{content:"";display:flex;clear:both;height:24px}.media-embed .embed-link-settings{overflow:visible}.embed-preview embed,.embed-preview iframe,.embed-preview img,.mejs-container video{max-width:100%;vertical-align:middle}.embed-preview a{display:inline-block}.embed-preview img{display:block;height:auto}.mejs-container:focus{outline:1px solid #4f94d4;box-shadow:0 0 2px 1px rgba(79,148,212,.8)}.image-details .media-modal{right:140px;left:140px}.image-details .media-frame-content,.image-details .media-frame-router,.image-details .media-frame-title{right:0}.image-details .embed-media-settings{top:0;overflow:visible;padding:0}.image-details .embed-media-settings::after{content:none}.image-details .embed-media-settings,.image-details .embed-media-settings div{box-sizing:border-box}.image-details .column-settings{background:#f6f7f7;border-left:1px solid #dcdcde;min-height:100%;width:55%;position:absolute;top:0;right:0}.image-details .column-settings h2{margin:20px;padding-top:20px;border-top:1px solid #dcdcde;color:#1d2327}.image-details .column-image{width:45%;position:absolute;right:55%;top:0}.image-details .image{margin:20px}.image-details .image img{max-width:100%;max-height:500px}.image-details .advanced-toggle{padding:0;color:#646970;text-transform:uppercase;text-decoration:none}.image-details .advanced-toggle:active,.image-details .advanced-toggle:hover{color:#646970}.image-details .advanced-toggle:after{font:normal 20px/1 dashicons;speak:never;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f140";display:inline-block;margin-top:-2px}.image-details .advanced-visible .advanced-toggle:after{content:"\f142"}.image-details .custom-size .custom-size-setting,.image-details .custom-size label{display:block;float:right}.image-details .custom-size .custom-size-setting label{float:none}.image-details .custom-size input{width:5em}.image-details .custom-size .sep{float:right;margin:26px 6px 0}.image-details .custom-size .description{margin-right:0}.media-embed .thumbnail{max-width:100%;max-height:200px;position:relative;float:right}.media-embed .thumbnail img{max-height:200px;display:block}.media-embed .thumbnail:after{content:"";display:block;position:absolute;top:0;right:0;left:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);overflow:hidden}.media-embed .setting,.media-embed .setting-group{width:100%;margin:10px 0;float:right;display:block;clear:both}.media-embed .setting-group .setting:not(.checkbox-setting){margin:0}.media-embed .setting.has-description{margin-bottom:5px}.media-embed .description{clear:both;font-style:normal}.media-embed .content-track+.description{line-height:1.4;max-width:none!important}.media-embed .remove-track{margin-bottom:10px}.image-details .embed-media-settings .setting,.image-details .embed-media-settings .setting-group{float:none;width:auto}.image-details .actions{margin:10px 0}.image-details .hidden{display:none}.media-embed .setting input[type=text],.media-embed .setting textarea,.media-embed fieldset{display:block;width:100%;max-width:400px}.image-details .embed-media-settings .setting input[type=text],.image-details .embed-media-settings .setting textarea{max-width:inherit;width:70%}.image-details .description,.image-details .embed-media-settings .custom-size,.image-details .embed-media-settings .link-target,.image-details .embed-media-settings .setting input.link-to-custom,.image-details .embed-media-settings .setting-group{margin-right:27%;width:70%}.image-details .description{font-style:normal;margin-top:0}.image-details .embed-media-settings .link-target{margin-top:16px}.audio-details .checkbox-label,.image-details .checkbox-label,.video-details .checkbox-label{vertical-align:baseline}.media-embed .setting input.hidden,.media-embed .setting textarea.hidden{display:none}.media-embed .setting .name,.media-embed .setting span,.media-embed .setting-group .name{display:inline-block;font-size:13px;line-height:1.84615384;color:#646970}.media-embed .setting span{display:block;width:200px}.image-details .embed-media-settings .setting .name,.image-details .embed-media-settings .setting span{float:right;width:25%;text-align:left;margin:8px 1% 0;line-height:1.1}.image-details .embed-media-settings .setting .button-group,.media-frame .setting-group .button-group{width:auto}.media-embed-sidebar{position:absolute;top:0;right:440px}.advanced-section,.link-settings{margin-top:10px}.media-frame .setting .button-group{display:flex;margin:0!important;max-width:none!important}.rtl .media-frame,.rtl .media-frame .search,.rtl .media-frame input[type=email],.rtl .media-frame input[type=number],.rtl .media-frame input[type=password],.rtl .media-frame input[type=search],.rtl .media-frame input[type=tel],.rtl .media-frame input[type=text],.rtl .media-frame input[type=url],.rtl .media-frame select,.rtl .media-frame textarea,.rtl .media-modal{font-family:Tahoma,sans-serif}:lang(he-il) .rtl .media-frame,:lang(he-il) .rtl .media-frame .search,:lang(he-il) .rtl .media-frame input[type=email],:lang(he-il) .rtl .media-frame input[type=number],:lang(he-il) .rtl .media-frame input[type=password],:lang(he-il) .rtl .media-frame input[type=search],:lang(he-il) .rtl .media-frame input[type=text],:lang(he-il) .rtl .media-frame input[type=url],:lang(he-il) .rtl .media-frame select,:lang(he-il) .rtl .media-frame textarea,:lang(he-il) .rtl .media-modal{font-family:Arial,sans-serif}@media only screen and (max-width:900px){.media-modal .media-frame-title{height:40px}.media-modal .media-frame-title h1{line-height:2.22222222;font-size:18px}.media-modal-close{width:42px;height:42px}.media-frame .media-frame-title{position:static;padding:0 44px;text-align:center}.media-frame:not(.hide-menu) .media-frame-content,.media-frame:not(.hide-menu) .media-frame-router,.media-frame:not(.hide-menu) .media-frame-toolbar{right:0}.media-frame:not(.hide-menu) .media-frame-router{top:80px}.media-frame:not(.hide-menu) .media-frame-content{top:114px}.media-frame.hide-router .media-frame-content{top:80px}.media-frame:not(.hide-menu) .media-frame-menu{position:static;width:0}.media-frame:not(.hide-menu) .media-menu{display:none;width:auto;max-width:80%;overflow:auto;z-index:2000;top:75px;right:50%;transform:translateX(50%);left:auto;bottom:auto;padding:5px 0;border:1px solid #c3c4c7}.media-frame:not(.hide-menu) .media-menu.visible{display:block}.media-frame:not(.hide-menu) .media-menu>a{padding:12px 16px;font-size:16px}.media-frame:not(.hide-menu) .media-menu .separator{margin:5px 10px}.media-frame-menu-heading{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;padding:0;width:1px;word-wrap:normal!important}.wp-core-ui .media-frame:not(.hide-menu) .button.media-frame-menu-toggle{display:inline-flex;align-items:center;position:absolute;right:50%;transform:translateX(50%);margin:-6px 0 0;padding:0 12px 0 2px;font-size:.875rem;font-weight:600;text-decoration:none;background:0 0;height:.1%;min-height:40px}.wp-core-ui .button.media-frame-menu-toggle:active,.wp-core-ui .button.media-frame-menu-toggle:hover{background:0 0;transform:none}.wp-core-ui .button.media-frame-menu-toggle:focus{outline:1px solid transparent}.media-sidebar{width:230px}.attachments-browser .attachments,.attachments-browser .attachments-wrapper,.attachments-browser .media-toolbar,.attachments-browser .uploader-inline,.attachments-browser.has-load-more .attachments-wrapper{left:262px}.attachment-details .setting,.media-sidebar .setting{margin:6px 0}.attachment-details .setting .name,.attachment-details .setting input,.attachment-details .setting textarea,.compat-item label span,.media-sidebar .setting .name,.media-sidebar .setting input,.media-sidebar .setting textarea{float:none;display:inline-block}.attachment-details .setting span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting span{float:none}.media-sidebar .setting .select-label-inline{display:inline}.attachment-details .setting .name,.compat-item label span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting .name{text-align:inherit;min-height:16px;margin:0;padding:8px 2px 2px}.attachment-details .attachment-info .copy-to-clipboard-container,.media-sidebar .setting .copy-to-clipboard-container{margin-right:0;padding-top:0}.attachment-details .attachment-info .copy-attachment-url,.media-sidebar .setting .copy-attachment-url{margin:0 1px}.attachment-details .setting .value,.media-sidebar .setting .value{float:none;width:auto}.attachment-details .setting input[type=email],.attachment-details .setting input[type=number],.attachment-details .setting input[type=password],.attachment-details .setting input[type=search],.attachment-details .setting input[type=tel],.attachment-details .setting input[type=text],.attachment-details .setting input[type=url],.attachment-details .setting select,.attachment-details .setting textarea,.attachment-details .setting+.description,.media-sidebar .setting input[type=email],.media-sidebar .setting input[type=number],.media-sidebar .setting input[type=password],.media-sidebar .setting input[type=search],.media-sidebar .setting input[type=tel],.media-sidebar .setting input[type=text],.media-sidebar .setting input[type=url],.media-sidebar .setting select,.media-sidebar .setting textarea{float:none;width:98%;max-width:none;height:auto}.media-frame .media-toolbar input[type=search]{line-height:2.25}.attachment-details .setting select.columns,.media-sidebar .setting select.columns{width:auto}.media-frame .search,.media-frame input,.media-frame textarea{padding:3px 6px}.wp-admin .media-frame select{min-height:40px;font-size:16px;line-height:1.625;padding:5px 8px 5px 24px}.image-details .column-image{width:30%;right:70%}.image-details .column-settings{width:70%}.image-details .media-modal{right:30px;left:30px}.image-details .embed-media-settings .setting,.image-details .embed-media-settings .setting-group{margin:20px}.image-details .embed-media-settings .setting .name,.image-details .embed-media-settings .setting span{float:none;text-align:right;width:100%;margin-bottom:4px;margin-right:0}.media-modal .legend-inline{position:static;transform:none;margin-right:0;margin-bottom:6px}.image-details .embed-media-settings .setting-group .setting{margin-bottom:0}.image-details .embed-media-settings .setting input.link-to-custom,.image-details .embed-media-settings .setting input[type=text],.image-details .embed-media-settings .setting textarea{width:100%;margin-right:0}.image-details .embed-media-settings .setting.has-description{margin-bottom:5px}.image-details .description{width:auto;margin:0 20px}.image-details .embed-media-settings .custom-size{margin-right:20px}.collection-settings .setting input[type=checkbox]{float:none;margin-top:0}.media-selection{min-width:120px}.media-selection:after{background:0 0}.media-selection .attachments{display:none}.media-modal .attachments-browser .media-toolbar .search{max-width:100%;height:auto;float:left}.media-modal .attachments-browser .media-toolbar .attachment-filters{height:auto}.media-frame input[type=email],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=text],.media-frame input[type=url],.media-frame select,.media-frame textarea{font-size:16px}.media-frame .media-toolbar input[type=search]{line-height:2.3755}.media-modal .media-toolbar .spinner{margin-bottom:10px}}@media screen and (max-width:782px){.attachments-browser .media-toolbar{height:82px}.attachments-browser .attachments,.attachments-browser .uploader-inline{top:82px}.media-frame-toolbar .media-toolbar{bottom:-54px}.mode-grid .attachments-browser .media-toolbar-primary{display:block}.attachment-details .copy-to-clipboard-container .success,.media-sidebar .copy-to-clipboard-container .success{font-size:14px;line-height:2.71428571}}@media only screen and (max-width:640px),screen and (max-height:400px){.image-details .media-modal,.media-modal{position:fixed;top:0;right:0;left:0;bottom:0}.media-modal-backdrop{position:fixed}.media-sidebar{z-index:1900;max-width:70%;bottom:120%;box-sizing:border-box;padding-bottom:0}.media-sidebar.visible{bottom:0}.attachments-browser .attachments,.attachments-browser .media-toolbar,.attachments-browser .uploader-inline,.media-frame-content .attachments-browser .attachments-wrapper{left:0}.attachments-browser .attachments-wrapper{padding-top:12px}.image-details .media-frame-title{display:block;top:0;font-size:14px}.image-details .column-image,.image-details .column-settings{width:100%;position:relative;right:0}.image-details .column-settings{padding:4px 0}.media-frame-content .media-toolbar .instructions{display:none}.load-more-wrapper .load-more-jump{margin:12px 0 0}}@media only screen and (min-width:901px) and (max-height:400px){.media-frame:not(.hide-menu) .media-menu,.media-menu{top:0;padding-top:44px}.load-more-wrapper .load-more-jump{margin:12px 0 0}}@media only screen and (max-width:480px){.wp-core-ui.wp-customizer .media-button{margin-top:13px}}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.wp-core-ui .media-modal-icon{background-image:url(../images/uploader-icons-2x.png);background-size:134px 15px}.media-frame .spinner{background-image:url(../images/spinner-2x.gif)}}.media-frame-content[data-columns="1"] .attachment{width:100%}.media-frame-content[data-columns="2"] .attachment{width:50%}.media-frame-content[data-columns="3"] .attachment{width:33.33%}.media-frame-content[data-columns="4"] .attachment{width:25%}.media-frame-content[data-columns="5"] .attachment{width:20%}.media-frame-content[data-columns="6"] .attachment{width:16.66%}.media-frame-content[data-columns="7"] .attachment{width:14.28%}.media-frame-content[data-columns="8"] .attachment{width:12.5%}.media-frame-content[data-columns="9"] .attachment{width:11.11%}.media-frame-content[data-columns="10"] .attachment{width:10%}.media-frame-content[data-columns="11"] .attachment{width:9.09%}.media-frame-content[data-columns="12"] .attachment{width:8.33%}/*! This file is auto-generated */ -.customize-partial-refreshing{opacity:.25;transition:opacity .25s;cursor:progress}.customize-partial-refreshing.widget-customizer-highlighted-widget{box-shadow:none}.customize-partial-edit-shortcut,.widget .customize-partial-edit-shortcut{position:absolute;float:right;width:1px;height:1px;padding:0;margin:-1px -1px 0 0;border:0;background:0 0;color:transparent;box-shadow:none;outline:0;z-index:5}.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{position:absolute;right:-30px;top:2px;color:#fff;width:30px;height:30px;min-width:30px;min-height:30px;line-height:1!important;font-size:18px;z-index:5;background:#3582c4!important;border-radius:50%;border:2px solid #fff;box-shadow:0 2px 1px rgba(60,67,74,.15);text-align:center;cursor:pointer;box-sizing:border-box;padding:3px;animation-fill-mode:both;animation-duration:.4s;opacity:0;pointer-events:none;text-shadow:0 -1px 1px #135e96,-1px 0 1px #135e96,0 1px 1px #135e96,1px 0 1px #135e96}.wp-custom-header .customize-partial-edit-shortcut button{right:2px}.customize-partial-edit-shortcut button svg{fill:#fff;min-width:20px;min-height:20px;width:20px;height:20px;margin:auto}.customize-partial-edit-shortcut button:hover{background:#4f94d4!important}.customize-partial-edit-shortcut button:focus{box-shadow:0 0 0 2px #4f94d4}body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button{animation-name:customize-partial-edit-shortcut-bounce-appear;pointer-events:auto}body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button{animation-name:customize-partial-edit-shortcut-bounce-disappear;pointer-events:none}.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button,.page-sidebar-collapsed .customize-partial-edit-shortcut button{visibility:hidden}@keyframes customize-partial-edit-shortcut-bounce-appear{20%,40%,60%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.610,0.355,1.000)}0%{opacity:0;transform:scale3d(.3,.3,.3)}20%{transform:scale3d(1.1,1.1,1.1)}40%{transform:scale3d(.9,.9,.9)}60%{opacity:1;transform:scale3d(1.03,1.03,1.03)}80%{transform:scale3d(.97,.97,.97)}to{opacity:1;transform:scale3d(1,1,1)}}@keyframes customize-partial-edit-shortcut-bounce-disappear{20%,40%,60%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.610,0.355,1.000)}0%{opacity:1;transform:scale3d(1,1,1)}20%{transform:scale3d(.97,.97,.97)}40%{opacity:1;transform:scale3d(1.03,1.03,1.03)}60%{transform:scale3d(.9,.9,.9)}80%{transform:scale3d(1.1,1.1,1.1)}to{opacity:0;transform:scale3d(.3,.3,.3)}}@media screen and (max-width:800px){.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{right:-32px}}@media screen and (max-width:320px){.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{right:-30px}}/*! This file is auto-generated */ -.mce-tinymce{box-shadow:none}.mce-container,.mce-container *,.mce-widget,.mce-widget *{color:inherit;font-family:inherit}.mce-container .mce-monospace,.mce-widget .mce-monospace{font-family:Consolas,Monaco,monospace;font-size:13px;line-height:150%}#mce-modal-block,#mce-modal-block.mce-fade{opacity:.7;transition:none;background:#000}.mce-window{border-radius:0;box-shadow:0 3px 6px rgba(0,0,0,.3);-webkit-font-smoothing:subpixel-antialiased;transition:none}.mce-window .mce-container-body.mce-abs-layout{overflow:visible}.mce-window .mce-window-head{background:#fff;border-bottom:1px solid #dcdcde;padding:0;min-height:36px}.mce-window .mce-window-head .mce-title{color:#3c434a;font-size:18px;font-weight:600;line-height:36px;margin:0;padding:0 36px 0 16px}.mce-window .mce-window-head .mce-close,.mce-window-head .mce-close .mce-i-remove{color:transparent;top:0;right:0;width:36px;height:36px;padding:0;line-height:36px;text-align:center}.mce-window-head .mce-close .mce-i-remove:before{font:normal 20px/36px dashicons;text-align:center;color:#646970;width:36px;height:36px;display:block}.mce-window-head .mce-close:focus .mce-i-remove:before,.mce-window-head .mce-close:hover .mce-i-remove:before{color:#135e96}.mce-window-head .mce-close:focus .mce-i-remove,div.mce-tab:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.mce-window .mce-window-head .mce-dragh{width:calc(100% - 36px)}.mce-window .mce-foot{border-top:1px solid #dcdcde}#wp-link .query-results,.mce-checkbox i.mce-i-checkbox,.mce-textbox{border:1px solid #dcdcde;border-radius:0;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);transition:.05s all ease-in-out}#wp-link .query-results:focus,.mce-checkbox:focus i.mce-i-checkbox,.mce-textbox.mce-focus,.mce-textbox:focus{border-color:#4f94d4;box-shadow:0 0 2px rgba(79,148,212,.8)}.mce-window .mce-wp-help{height:360px;width:460px;overflow:auto}.mce-window .mce-wp-help *{box-sizing:border-box}.mce-window .mce-wp-help>.mce-container-body{width:auto!important}.mce-window .wp-editor-help{padding:10px 10px 0 20px}.mce-window .wp-editor-help h2,.mce-window .wp-editor-help p{margin:8px 0;white-space:normal;font-size:14px;font-weight:400}.mce-window .wp-editor-help table{width:100%;margin-bottom:20px}.mce-window .wp-editor-help table.wp-help-single{margin:0 8px 20px}.mce-window .wp-editor-help table.fixed{table-layout:fixed}.mce-window .wp-editor-help table.fixed td:nth-child(odd),.mce-window .wp-editor-help table.fixed th:nth-child(odd){width:12%}.mce-window .wp-editor-help table.fixed td:nth-child(even),.mce-window .wp-editor-help table.fixed th:nth-child(even){width:38%}.mce-window .wp-editor-help table.fixed th:nth-child(odd){padding:5px 0 0}.mce-window .wp-editor-help td,.mce-window .wp-editor-help th{font-size:13px;padding:5px;vertical-align:middle;word-wrap:break-word;white-space:normal}.mce-window .wp-editor-help th{font-weight:600;padding-bottom:0}.mce-window .wp-editor-help kbd{font-family:monospace;padding:2px 7px 3px;font-weight:600;margin:0;background:#f0f0f1;background:rgba(0,0,0,.08)}.mce-window .wp-help-th-center td:nth-child(odd),.mce-window .wp-help-th-center th:nth-child(odd){text-align:center}.mce-floatpanel.mce-popover,.mce-menu{border-color:rgba(0,0,0,.15);border-radius:0;box-shadow:0 3px 5px rgba(0,0,0,.2)}.mce-floatpanel.mce-popover.mce-bottom,.mce-menu{margin-top:2px}.mce-floatpanel .mce-arrow{display:none}.mce-menu .mce-container-body{min-width:160px}.mce-menu-item{border:none;margin-bottom:2px;padding:6px 15px 6px 12px}.mce-menu-has-icons i.mce-ico{line-height:20px}div.mce-panel{border:0;background:#fff}.mce-panel.mce-menu{border:1px solid #dcdcde}div.mce-tab{line-height:13px}div.mce-toolbar-grp{border-bottom:1px solid #dcdcde;background:#f6f7f7;padding:0;position:relative}div.mce-inline-toolbar-grp{border:1px solid #a7aaad;border-radius:2px;box-shadow:0 1px 3px rgba(0,0,0,.15);box-sizing:border-box;margin-bottom:8px;position:absolute;-webkit-user-select:none;user-select:none;max-width:98%;z-index:100100}div.mce-inline-toolbar-grp>div.mce-stack-layout{padding:1px}div.mce-inline-toolbar-grp.mce-arrow-up{margin-bottom:0;margin-top:8px}div.mce-inline-toolbar-grp:after,div.mce-inline-toolbar-grp:before{position:absolute;left:50%;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}div.mce-inline-toolbar-grp.mce-arrow-up:before{top:-9px;border-bottom-color:#a7aaad;border-width:0 9px 9px;margin-left:-9px}div.mce-inline-toolbar-grp.mce-arrow-down:before{bottom:-9px;border-top-color:#a7aaad;border-width:9px 9px 0;margin-left:-9px}div.mce-inline-toolbar-grp.mce-arrow-up:after{top:-8px;border-bottom-color:#f6f7f7;border-width:0 8px 8px;margin-left:-8px}div.mce-inline-toolbar-grp.mce-arrow-down:after{bottom:-8px;border-top-color:#f6f7f7;border-width:8px 8px 0;margin-left:-8px}div.mce-inline-toolbar-grp.mce-arrow-left:after,div.mce-inline-toolbar-grp.mce-arrow-left:before{margin:0}div.mce-inline-toolbar-grp.mce-arrow-left:before{left:20px}div.mce-inline-toolbar-grp.mce-arrow-left:after{left:21px}div.mce-inline-toolbar-grp.mce-arrow-right:after,div.mce-inline-toolbar-grp.mce-arrow-right:before{left:auto;margin:0}div.mce-inline-toolbar-grp.mce-arrow-right:before{right:20px}div.mce-inline-toolbar-grp.mce-arrow-right:after{right:21px}div.mce-inline-toolbar-grp.mce-arrow-full{right:0}div.mce-inline-toolbar-grp.mce-arrow-full>div{width:100%;overflow-x:auto}div.mce-toolbar-grp>div{padding:3px}.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first{padding-right:32px}.mce-toolbar .mce-btn-group{margin:0}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar{display:block}div.mce-statusbar{border-top:1px solid #dcdcde}div.mce-path{padding:2px 10px;margin:0}.mce-path,.mce-path .mce-divider,.mce-path-item{font-size:12px}.mce-toolbar .mce-btn,.qt-dfw{border-color:transparent;background:0 0;box-shadow:none;text-shadow:none;cursor:pointer}.mce-btn .mce-txt{direction:inherit;text-align:inherit}.mce-toolbar .mce-btn-group .mce-btn,.qt-dfw{border:1px solid transparent;margin:2px;border-radius:2px}.mce-toolbar .mce-btn-group .mce-btn:focus,.mce-toolbar .mce-btn-group .mce-btn:hover,.qt-dfw:focus,.qt-dfw:hover{background:#f6f7f7;border-color:#50575e;color:#1d2327;box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);outline:0}.mce-toolbar .mce-btn-group .mce-btn.mce-active,.mce-toolbar .mce-btn-group .mce-btn:active,.qt-dfw.active{background:#f0f0f1;border-color:#50575e;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.3)}.mce-btn.mce-active,.mce-btn.mce-active button,.mce-btn.mce-active i,.mce-btn.mce-active:hover button,.mce-btn.mce-active:hover i{color:inherit}.mce-toolbar .mce-btn-group .mce-btn.mce-active:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover{border-color:#1d2327}.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover{color:#a7aaad;background:0 0;border-color:#dcdcde;text-shadow:0 1px 0 #fff;box-shadow:none}.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus{border-color:#50575e}.mce-toolbar .mce-btn-group .mce-first,.mce-toolbar .mce-btn-group .mce-last{border-color:transparent}.mce-toolbar .mce-btn button,.qt-dfw{padding:2px 3px;line-height:normal}.mce-toolbar .mce-listbox button{font-size:13px;line-height:1.53846153;padding-left:6px;padding-right:20px}.mce-toolbar .mce-btn i{text-shadow:none}.mce-toolbar .mce-btn-group>div{white-space:normal}.mce-toolbar .mce-colorbutton .mce-open{border-right:0}.mce-toolbar .mce-colorbutton .mce-preview{margin:0;padding:0;top:auto;bottom:2px;left:3px;height:3px;width:20px;background:#50575e}.mce-toolbar .mce-btn-group .mce-btn.mce-primary{min-width:0;background:#3582c4;border-color:#2271b1 #135e96 #135e96;box-shadow:0 1px 0 #135e96;color:#fff;text-decoration:none;text-shadow:none}.mce-toolbar .mce-btn-group .mce-btn.mce-primary button{padding:2px 3px 1px}.mce-toolbar .mce-btn-group .mce-btn.mce-primary .mce-ico{color:#fff}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-primary:hover{background:#4f94d4;border-color:#135e96;color:#fff}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus{box-shadow:0 0 1px 1px #72aee6}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:active{background:#2271b1;border-color:#135e96;box-shadow:inset 0 2px 0 #135e96}.mce-toolbar .mce-btn-group .mce-btn.mce-listbox{border-radius:0;direction:ltr;background:#fff;border:1px solid #dcdcde;box-shadow:inset 0 1px 1px -1px rgba(0,0,0,.2)}.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover{border-color:#c3c4c7}.mce-panel .mce-btn i.mce-caret{border-top:6px solid #50575e;margin-left:2px;margin-right:2px}.mce-listbox i.mce-caret{right:4px}.mce-panel .mce-btn:focus i.mce-caret,.mce-panel .mce-btn:hover i.mce-caret{border-top-color:#1d2327}.mce-panel .mce-active i.mce-caret{border-top:0;border-bottom:6px solid #1d2327;margin-top:7px}.mce-listbox.mce-active i.mce-caret{margin-top:-3px}.mce-toolbar .mce-splitbtn:hover .mce-open{border-right-color:transparent}.mce-toolbar .mce-splitbtn .mce-open.mce-active{background:0 0;outline:0}.mce-menu .mce-menu-item.mce-active.mce-menu-item-normal,.mce-menu .mce-menu-item.mce-active.mce-menu-item-preview,.mce-menu .mce-menu-item.mce-selected,.mce-menu .mce-menu-item:focus,.mce-menu .mce-menu-item:hover{background:#2271b1;color:#fff}.mce-menu .mce-menu-item.mce-selected .mce-caret,.mce-menu .mce-menu-item:focus .mce-caret,.mce-menu .mce-menu-item:hover .mce-caret{border-left-color:#fff}.rtl .mce-menu .mce-menu-item.mce-selected .mce-caret,.rtl .mce-menu .mce-menu-item:focus .mce-caret,.rtl .mce-menu .mce-menu-item:hover .mce-caret{border-left-color:inherit;border-right-color:#fff}.mce-menu .mce-menu-item.mce-active .mce-menu-shortcut,.mce-menu .mce-menu-item.mce-disabled:hover .mce-ico,.mce-menu .mce-menu-item.mce-disabled:hover .mce-text,.mce-menu .mce-menu-item.mce-selected .mce-ico,.mce-menu .mce-menu-item.mce-selected .mce-text,.mce-menu .mce-menu-item:focus .mce-ico,.mce-menu .mce-menu-item:focus .mce-menu-shortcut,.mce-menu .mce-menu-item:focus .mce-text,.mce-menu .mce-menu-item:hover .mce-ico,.mce-menu .mce-menu-item:hover .mce-menu-shortcut,.mce-menu .mce-menu-item:hover .mce-text{color:inherit}.mce-menu .mce-menu-item.mce-disabled{cursor:default}.mce-menu .mce-menu-item.mce-disabled:hover{background:#c3c4c7}div.mce-menubar{border-color:#dcdcde;background:#fff;border-width:0 0 1px}.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus,.mce-menubar .mce-menubtn:hover{border-color:transparent;background:0 0}.mce-menubar .mce-menubtn:focus{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.mce-menu-item-sep:hover,div.mce-menu .mce-menu-item-sep{border-bottom:1px solid #dcdcde;height:0;margin:5px 0}.mce-menubtn span{margin-right:0;padding-left:3px}.mce-menu-has-icons i.mce-ico:before{margin-left:-2px}.mce-menu.mce-menu-align .mce-menu-item-normal{position:relative}.mce-menu.mce-menu-align .mce-menu-shortcut{bottom:.6em;font-size:.9em}.mce-primary button,.mce-primary button i{text-align:center;color:#fff;text-shadow:none;padding:0;line-height:1.85714285}.mce-window .mce-btn{color:#50575e;background:#f6f7f7;text-decoration:none;font-size:13px;line-height:26px;height:28px;margin:0;padding:0;cursor:pointer;border:1px solid #c3c4c7;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-shadow:0 1px 0 #c3c4c7}.mce-window .mce-btn::-moz-focus-inner{border-width:0;border-style:none;padding:0}.mce-window .mce-btn:focus,.mce-window .mce-btn:hover{background:#f6f7f7;border-color:#8c8f94;color:#1d2327}.mce-window .mce-btn:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.mce-window .mce-btn:active{background:#f0f0f1;border-color:#8c8f94;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);transform:translateY(1px)}.mce-window .mce-btn.mce-disabled{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;text-shadow:0 1px 0 #fff!important;cursor:default;transform:none!important}.mce-window .mce-btn.mce-primary{background:#3582c4;border-color:#2271b1 #135e96 #135e96;box-shadow:0 1px 0 #135e96;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #135e96,1px 0 1px #135e96,0 1px 1px #135e96,-1px 0 1px #135e96}.mce-window .mce-btn.mce-primary:focus,.mce-window .mce-btn.mce-primary:hover{background:#4f94d4;border-color:#135e96;color:#fff}.mce-window .mce-btn.mce-primary:focus{box-shadow:0 1px 0 #2271b1,0 0 2px 1px #72aee6}.mce-window .mce-btn.mce-primary:active{background:#2271b1;border-color:#135e96;box-shadow:inset 0 2px 0 #135e96;vertical-align:top}.mce-window .mce-btn.mce-primary.mce-disabled{color:#9ec2e6!important;background:#4f94d4!important;border-color:#3582c4!important;box-shadow:none!important;text-shadow:0 -1px 0 rgba(0,0,0,.1)!important;cursor:default}.mce-menubtn.mce-fixed-width span{overflow-x:hidden;text-overflow:ellipsis;width:82px}.mce-charmap{margin:3px}.mce-charmap td{padding:0;border-color:#dcdcde;cursor:pointer}.mce-charmap td:hover{background:#f6f7f7}.mce-charmap td div{width:18px;height:22px;line-height:1.57142857}.mce-tooltip{margin-top:2px}.mce-tooltip-inner{border-radius:3px;box-shadow:0 3px 5px rgba(0,0,0,.2);color:#fff;font-size:12px}.mce-ico{font-family:tinymce,Arial}.mce-btn-small .mce-ico{font-family:tinymce-small,Arial}.mce-toolbar .mce-ico{color:#50575e;line-height:1;width:20px;height:20px;text-align:center;text-shadow:none;margin:0;padding:0}.qt-dfw{color:#50575e;line-height:1;width:28px;height:26px;text-align:center;text-shadow:none}.mce-toolbar .mce-btn .mce-open{line-height:20px}.mce-toolbar .mce-btn.mce-active .mce-open,.mce-toolbar .mce-btn:focus .mce-open,.mce-toolbar .mce-btn:hover .mce-open{border-left-color:#1d2327}div.mce-notification{left:10%!important;right:10%}.mce-notification button.mce-close{right:6px;top:3px;font-weight:400;color:#50575e}.mce-notification button.mce-close:focus,.mce-notification button.mce-close:hover{color:#000}i.mce-i-aligncenter,i.mce-i-alignjustify,i.mce-i-alignleft,i.mce-i-alignright,i.mce-i-backcolor,i.mce-i-blockquote,i.mce-i-bold,i.mce-i-bullist,i.mce-i-charmap,i.mce-i-dashicon,i.mce-i-dfw,i.mce-i-forecolor,i.mce-i-fullscreen,i.mce-i-help,i.mce-i-hr,i.mce-i-indent,i.mce-i-italic,i.mce-i-link,i.mce-i-ltr,i.mce-i-numlist,i.mce-i-outdent,i.mce-i-pastetext,i.mce-i-pasteword,i.mce-i-redo,i.mce-i-remove,i.mce-i-removeformat,i.mce-i-spellchecker,i.mce-i-strikethrough,i.mce-i-underline,i.mce-i-undo,i.mce-i-unlink,i.mce-i-wp-media-library,i.mce-i-wp_adv,i.mce-i-wp_code,i.mce-i-wp_fullscreen,i.mce-i-wp_help,i.mce-i-wp_more,i.mce-i-wp_page{font:normal 20px/1 dashicons;padding:0;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-left:-2px;padding-right:2px}.qt-dfw{font:normal 20px/1 dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i.mce-i-bold:before{content:"\f200"}i.mce-i-italic:before{content:"\f201"}i.mce-i-bullist:before{content:"\f203"}i.mce-i-numlist:before{content:"\f204"}i.mce-i-blockquote:before{content:"\f205"}i.mce-i-alignleft:before{content:"\f206"}i.mce-i-aligncenter:before{content:"\f207"}i.mce-i-alignright:before{content:"\f208"}i.mce-i-link:before{content:"\f103"}i.mce-i-unlink:before{content:"\f225"}i.mce-i-wp_more:before{content:"\f209"}i.mce-i-strikethrough:before{content:"\f224"}i.mce-i-spellchecker:before{content:"\f210"}.qt-dfw:before,i.mce-i-dfw:before,i.mce-i-fullscreen:before,i.mce-i-wp_fullscreen:before{content:"\f211"}i.mce-i-wp_adv:before{content:"\f212"}i.mce-i-underline:before{content:"\f213"}i.mce-i-alignjustify:before{content:"\f214"}i.mce-i-backcolor:before,i.mce-i-forecolor:before{content:"\f215"}i.mce-i-pastetext:before{content:"\f217"}i.mce-i-removeformat:before{content:"\f218"}i.mce-i-charmap:before{content:"\f220"}i.mce-i-outdent:before{content:"\f221"}i.mce-i-indent:before{content:"\f222"}i.mce-i-undo:before{content:"\f171"}i.mce-i-redo:before{content:"\f172"}i.mce-i-help:before,i.mce-i-wp_help:before{content:"\f223"}i.mce-i-wp-media-library:before{content:"\f104"}i.mce-i-ltr:before{content:"\f320"}i.mce-i-wp_page:before{content:"\f105"}i.mce-i-hr:before{content:"\f460"}i.mce-i-remove:before{content:"\f158"}i.mce-i-wp_code:before{content:"\f475"}.rtl i.mce-i-outdent:before{content:"\f222"}.rtl i.mce-i-indent:before{content:"\f221"}.wp-editor-wrap{position:relative}.wp-editor-tools{position:relative;z-index:1}.wp-editor-tools:after{clear:both;content:"";display:table}.wp-editor-container{clear:both;border:1px solid #dcdcde}.wp-editor-area{font-family:Consolas,Monaco,monospace;font-size:13px;padding:10px;margin:1px 0 0;line-height:150%;border:0;outline:0;display:block;resize:vertical;box-sizing:border-box}.rtl .wp-editor-area{font-family:Tahoma,Monaco,monospace}.locale-he-il .wp-editor-area{font-family:Arial,Monaco,monospace}.wp-editor-container textarea.wp-editor-area{width:100%;margin:0;box-shadow:none}.wp-editor-tabs{float:right}.wp-switch-editor{float:left;box-sizing:content-box;position:relative;top:1px;background:#f0f0f1;color:#646970;cursor:pointer;font-size:13px;line-height:1.46153846;height:20px;margin:5px 0 0 5px;padding:3px 8px 4px;border:1px solid #dcdcde}.wp-switch-editor:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:0;color:#1d2327}.html-active .switch-html:focus,.tmce-active .switch-tmce:focus,.wp-switch-editor:active{box-shadow:none}.wp-switch-editor:active{background-color:#f6f7f7;box-shadow:none}.js .tmce-active .wp-editor-area{color:#fff}.tmce-active .quicktags-toolbar{display:none}.html-active .switch-html,.tmce-active .switch-tmce{background:#f6f7f7;color:#50575e;border-bottom-color:#f6f7f7}.wp-media-buttons{float:left}.wp-media-buttons .button{margin-right:5px;margin-bottom:4px;padding-left:7px;padding-right:7px}.wp-media-buttons .button:active{position:relative;top:1px;margin-top:-1px;margin-bottom:1px}.wp-media-buttons .insert-media{padding-left:5px}.wp-media-buttons a{text-decoration:none;color:#3c434a;font-size:12px}.wp-media-buttons img{padding:0 4px;vertical-align:middle}.wp-media-buttons span.wp-media-buttons-icon{display:inline-block;width:20px;height:20px;line-height:1;vertical-align:middle;margin:0 2px}.wp-media-buttons .add_media span.wp-media-buttons-icon{background:0 0}.wp-media-buttons .add_media span.wp-media-buttons-icon:before{font:normal 18px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-media-buttons .add_media span.wp-media-buttons-icon:before{content:"\f104"}.mce-content-body dl.wp-caption{max-width:100%}.quicktags-toolbar{padding:3px;position:relative;border-bottom:1px solid #dcdcde;background:#f6f7f7;min-height:30px}.has-dfw .quicktags-toolbar{padding-right:35px}.wp-core-ui .quicktags-toolbar input.button.button-small{margin:2px}.quicktags-toolbar input[value=link]{text-decoration:underline}.quicktags-toolbar input[value=del]{text-decoration:line-through}.quicktags-toolbar input[value="i"]{font-style:italic}.quicktags-toolbar input[value="b"]{font-weight:600}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw,.qt-dfw{position:absolute;top:0;right:0}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw{margin:7px 7px 0 0}.qt-dfw{margin:5px 5px 0 0}.qt-fullscreen{position:static;margin:2px}@media screen and (max-width:782px){.mce-toolbar .mce-btn button,.qt-dfw{padding:6px 7px}.mce-toolbar .mce-btn-group .mce-btn.mce-primary button{padding:6px 7px 5px}.mce-toolbar .mce-btn-group .mce-btn{margin:1px}.qt-dfw{width:36px;height:34px}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw{margin:4px 4px 0 0}.mce-toolbar .mce-colorbutton .mce-preview{left:8px;bottom:6px}.mce-window .mce-btn{padding:2px 0}.has-dfw .quicktags-toolbar,.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first{padding-right:40px}}@media screen and (min-width:782px){.wp-core-ui .quicktags-toolbar input.button.button-small{font-size:12px;min-height:26px;line-height:2}}#wp_editbtns,#wp_gallerybtns{padding:2px;position:absolute;display:none;z-index:100020}#wp_delgallery,#wp_delimgbtn,#wp_editgallery,#wp_editimgbtn{background-color:#f0f0f1;margin:2px;padding:2px;border:1px solid #8c8f94;border-radius:3px}#wp_delgallery:hover,#wp_delimgbtn:hover,#wp_editgallery:hover,#wp_editimgbtn:hover{border-color:#50575e;background-color:#c3c4c7}#wp-link-wrap{display:none;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);width:500px;overflow:hidden;margin-left:-250px;margin-top:-125px;position:fixed;top:50%;left:50%;z-index:100105;transition:height .2s,margin-top .2s}#wp-link-backdrop{display:none;position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100100}#wp-link{position:relative;height:100%}#wp-link-wrap{height:500px;margin-top:-250px}#wp-link-wrap .wp-link-text-field{display:none}#wp-link-wrap.has-text-field .wp-link-text-field{display:block}#link-modal-title{background:#fff;border-bottom:1px solid #dcdcde;height:36px;font-size:18px;font-weight:600;line-height:2;margin:0;padding:0 36px 0 16px}#wp-link-close{color:#646970;padding:0;position:absolute;top:0;right:0;width:36px;height:36px;text-align:center;background:0 0;border:none;cursor:pointer}#wp-link-close:before{font:normal 20px/36px dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:36px;height:36px;content:"\f158"}#wp-link-close:focus,#wp-link-close:hover{color:#135e96}#wp-link-close:focus{outline:0;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:2px solid transparent;outline-offset:-2px}#wp-link-wrap #link-selector{-webkit-overflow-scrolling:touch;padding:0 16px;position:absolute;top:37px;left:0;right:0;bottom:44px}#wp-link ol,#wp-link ul{list-style:none;margin:0;padding:0}#wp-link input[type=text]{box-sizing:border-box}#wp-link #link-options{padding:8px 0 12px}#wp-link p.howto{margin:3px 0}#wp-link p.howto a{text-decoration:none;color:inherit}#wp-link label input[type=text]{margin-top:5px;width:70%}#wp-link #link-options label span,#wp-link #search-panel label span.search-label{display:inline-block;width:80px;text-align:right;padding-right:5px;max-width:24%;vertical-align:middle;word-wrap:break-word}#wp-link .link-search-field{width:250px;max-width:70%}#wp-link .link-search-wrapper{margin:5px 0 9px;display:block;overflow:hidden}#wp-link .link-search-wrapper .spinner{float:none;margin:-3px 0 0 4px}#wp-link .link-target{padding:3px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#wp-link .link-target label{max-width:70%}#wp-link .query-results{border:1px #dcdcde solid;margin:0 0 12px;background:#fff;overflow:auto;position:absolute;left:16px;right:16px;bottom:0;top:166px}.has-text-field #wp-link .query-results{top:210px}#wp-link li{clear:both;margin-bottom:0;border-bottom:1px solid #f0f0f1;color:#2c3338;padding:4px 6px 4px 10px;cursor:pointer;position:relative}#wp-link .query-notice{padding:0;border-bottom:1px solid #dcdcde;background-color:#fff;color:#000}#wp-link .query-notice .query-notice-default,#wp-link .query-notice .query-notice-hint{display:block;padding:6px;border-left:4px solid #72aee6}#wp-link .unselectable.no-matches-found{padding:0;border-bottom:1px solid #dcdcde;background-color:#f6f7f7}#wp-link .no-matches-found .item-title{display:block;padding:6px;border-left:4px solid #d63638}#wp-link .query-results em{font-style:normal}#wp-link li:hover{background:#f0f6fc;color:#101517}#wp-link li.unselectable{border-bottom:1px solid #dcdcde}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#2c3338}#wp-link li.selected{background:#dcdcde;color:#2c3338}#wp-link li.selected .item-title{font-weight:600}#wp-link li:last-child{border:none}#wp-link .item-title{display:inline-block;width:80%;width:calc(100% - 68px);word-wrap:break-word}#wp-link .item-info{text-transform:uppercase;color:#646970;font-size:11px;position:absolute;right:5px;top:5px}#wp-link .river-waiting{display:none;padding:10px 0}#wp-link .submitbox{padding:8px 16px;background:#fff;border-top:1px solid #dcdcde;position:absolute;bottom:0;left:0;right:0}#wp-link-cancel{line-height:1.92307692;float:left}#wp-link-update{line-height:1.76923076;float:right}#wp-link-submit{float:right}@media screen and (max-width:782px){#wp-link-wrap{margin-top:-140px}#wp-link-wrap .query-results{top:195px}#wp-link-wrap.has-text-field .query-results{top:235px}#link-selector{padding:0 16px 60px}#wp-link-wrap #link-selector{bottom:52px}#wp-link-cancel{line-height:2.46153846}#wp-link .link-target{padding-top:10px}#wp-link .submitbox .button{margin-bottom:0}}@media screen and (max-width:520px){#wp-link-wrap{width:auto;margin-left:0;left:10px;right:10px;max-width:500px}}@media screen and (max-height:520px){#wp-link-wrap{transition:none;height:auto;margin-top:0;top:10px;bottom:10px}#link-selector{overflow:auto}#search-panel .query-results{position:static}}@media screen and (max-height:290px){#wp-link-wrap{height:auto;margin-top:0;top:10px;bottom:10px}#link-selector{overflow:auto;height:calc(100% - 92px);padding-bottom:2px}#search-panel .query-results{position:static}}div.wp-link-preview{float:left;margin:5px;max-width:694px;overflow:hidden;text-overflow:ellipsis}div.wp-link-preview a{color:#2271b1;text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out;cursor:pointer}div.wp-link-preview a.wplink-url-error{color:#d63638}div.wp-link-input{float:left;margin:2px;max-width:694px}div.wp-link-input input{width:300px;padding:3px;box-sizing:border-box;line-height:1.28571429;min-height:26px}.mce-toolbar div.wp-link-input~.mce-btn,.mce-toolbar div.wp-link-preview~.mce-btn{margin:2px 1px}.mce-inline-toolbar-grp .mce-btn-group .mce-btn:last-child{margin-right:2px}.ui-autocomplete.wplink-autocomplete{z-index:100110;max-height:200px;overflow-y:auto;padding:0;margin:0;list-style:none;position:absolute;border:1px solid #4f94d4;box-shadow:0 1px 2px rgba(79,148,212,.8);background-color:#fff}.ui-autocomplete.wplink-autocomplete li{margin-bottom:0;padding:4px 10px;clear:both;white-space:normal;text-align:left}.ui-autocomplete.wplink-autocomplete li .wp-editor-float-right{float:right}.ui-autocomplete.wplink-autocomplete li.ui-state-focus{background-color:#dcdcde;cursor:pointer}@media screen and (max-width:782px){div.wp-link-input,div.wp-link-preview{max-width:70%;max-width:calc(100% - 86px)}div.wp-link-preview{margin:8px 0 8px 5px}div.wp-link-input{width:300px}div.wp-link-input input{width:100%;font-size:16px;padding:5px}}.mce-fullscreen{z-index:100010}.rtl .quicktags-toolbar input,.rtl .wp-switch-editor{font-family:Tahoma,sans-serif}.mce-rtl .mce-flow-layout .mce-flow-layout-item>div{direction:rtl}.mce-rtl .mce-listbox i.mce-caret{left:6px}html:lang(he-il) .rtl .quicktags-toolbar input,html:lang(he-il) .rtl .wp-switch-editor{font-family:Arial,sans-serif}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.wp-media-buttons .add_media span.wp-media-buttons-icon{background:0 0}}/*! - * jQuery UI CSS Framework 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/theming/ - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { - display: none; -} -.ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} -.ui-helper-reset { - margin: 0; - padding: 0; - border: 0; - outline: 0; - line-height: 1.3; - text-decoration: none; - font-size: 100%; - list-style: none; -} -.ui-helper-clearfix:before, -.ui-helper-clearfix:after { - content: ""; - display: table; - border-collapse: collapse; -} -.ui-helper-clearfix:after { - clear: both; -} -.ui-helper-clearfix { - min-height: 0; /* support: IE7 */ -} -.ui-helper-zfix { - width: 100%; - height: 100%; - top: 0; - left: 0; - position: absolute; - opacity: 0; - filter:Alpha(Opacity=0); /* support: IE8 */ -} - -.ui-front { - z-index: 100; -} - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { - cursor: default !important; -} - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { - display: block; - text-indent: -99999px; - overflow: hidden; - background-repeat: no-repeat; -} - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -/*! - * jQuery UI Resizable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ -.ui-resizable { - position: relative; -} -.ui-resizable-handle { - position: absolute; - font-size: 0.1px; - display: block; - touch-action: none; -} -.ui-resizable-disabled .ui-resizable-handle, -.ui-resizable-autohide .ui-resizable-handle { - display: none; -} -.ui-resizable-n { - cursor: n-resize; - height: 7px; - width: 100%; - top: -5px; - left: 0; -} -.ui-resizable-s { - cursor: s-resize; - height: 7px; - width: 100%; - bottom: -5px; - left: 0; -} -/* rtl:ignore */ -.ui-resizable-e { - cursor: e-resize; - width: 7px; - right: -5px; - top: 0; - height: 100%; -} -/* rtl:ignore */ -.ui-resizable-w { - cursor: w-resize; - width: 7px; - left: -5px; - top: 0; - height: 100%; -} -/* rtl:ignore */ -.ui-resizable-se { - cursor: se-resize; - width: 12px; - height: 12px; - right: 1px; - bottom: 1px; -} -/* rtl:ignore */ -.ui-resizable-sw { - cursor: sw-resize; - width: 9px; - height: 9px; - left: -5px; - bottom: -5px; -} -/* rtl:ignore */ -.ui-resizable-nw { - cursor: nw-resize; - width: 9px; - height: 9px; - left: -5px; - top: -5px; -} -/* rtl:ignore */ -.ui-resizable-ne { - cursor: ne-resize; - width: 9px; - height: 9px; - right: -5px; - top: -5px; -} - -/* WP buttons: see buttons.css. */ - -.ui-button { - display: inline-block; - text-decoration: none; - font-size: 13px; - line-height: 2; - height: 28px; - margin: 0; - padding: 0 10px 1px; - cursor: pointer; - border-width: 1px; - border-style: solid; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-sizing: border-box; - color: #50575e; - border-color: #c3c4c7; - background: #f6f7f7; - box-shadow: 0 1px 0 #c3c4c7; - vertical-align: top; -} - -.ui-button:active, -.ui-button:focus { - outline: none; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.ui-button::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.ui-button:hover, -.ui-button:focus { - background: #f6f7f7; - border-color: #8c8f94; - color: #1d2327; -} - -.ui-button:focus { - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.ui-button:active { - background: #f0f0f1; - border-color: #8c8f94; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); -} - -.ui-button[disabled], -.ui-button:disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - text-shadow: 0 1px 0 #fff !important; - cursor: default; - transform: none !important; -} - -@media screen and (max-width: 782px) { - - .ui-button { - padding: 6px 14px; - line-height: normal; - font-size: 14px; - vertical-align: middle; - height: auto; - margin-bottom: 4px; - } - -} - -/* WP Theme */ - -.ui-dialog { - position: absolute; - top: 0; - left: 0; - z-index: 100102; - background-color: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - overflow: hidden; -} - -.ui-dialog-titlebar { - background: #fff; - border-bottom: 1px solid #dcdcde; - height: 36px; - font-size: 18px; - font-weight: 600; - line-height: 2; - padding: 0 36px 0 16px; -} - -.ui-button.ui-dialog-titlebar-close { - background: none; - border: none; - box-shadow: none; - color: #646970; - cursor: pointer; - display: block; - padding: 0; - position: absolute; - top: 0; - right: 0; - width: 36px; - height: 36px; - text-align: center; - border-radius: 0; - overflow: hidden; -} - -.ui-dialog-titlebar-close:before { - font: normal 20px/1 dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - line-height: 1.8; - width: 36px; - height: 36px; - content: "\f158"; -} - -.ui-button.ui-dialog-titlebar-close:hover, -.ui-button.ui-dialog-titlebar-close:focus { - color: #135e96; -} - -.ui-button.ui-dialog-titlebar-close:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -.ui-dialog-content { - padding: 16px; - overflow: auto; -} - -.ui-dialog-buttonpane { - background: #fff; - border-top: 1px solid #dcdcde; - padding: 16px; -} - -.ui-dialog-buttonpane .ui-button { - margin-left: 16px; -} - -.ui-dialog-buttonpane .ui-dialog-buttonset { - float: right; -} - -.ui-draggable .ui-dialog-titlebar { - cursor: move; -} - -.ui-widget-overlay { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 100101; -} -/*! This file is auto-generated */ -/*------------------------------------------------------------------------------ - TinyMCE and Quicklinks toolbars -------------------------------------------------------------------------------*/ - -/* TinyMCE widgets/containers */ - -.mce-tinymce { - box-shadow: none; -} - -.mce-container, -.mce-container *, -.mce-widget, -.mce-widget * { - color: inherit; - font-family: inherit; -} - -.mce-container .mce-monospace, -.mce-widget .mce-monospace { - font-family: Consolas, Monaco, monospace; - font-size: 13px; - line-height: 150%; -} - -/* TinyMCE windows */ -#mce-modal-block, -#mce-modal-block.mce-fade { - opacity: 0.7; - filter: alpha(opacity=70); - transition: none; - background: #000; -} - -.mce-window { - border-radius: 0; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - -webkit-font-smoothing: subpixel-antialiased; - transition: none; -} - -.mce-window .mce-container-body.mce-abs-layout { - overflow: visible; -} - -.mce-window .mce-window-head { - background: #fff; - border-bottom: 1px solid #dcdcde; - padding: 0; - min-height: 36px; -} - -.mce-window .mce-window-head .mce-title { - color: #3c434a; - font-size: 18px; - font-weight: 600; - line-height: 36px; - margin: 0; - padding: 0 16px 0 36px; -} - -.mce-window .mce-window-head .mce-close, -.mce-window-head .mce-close .mce-i-remove { - color: transparent; - top: 0; - left: 0; - width: 36px; - height: 36px; - padding: 0; - line-height: 36px; - text-align: center; -} - -.mce-window-head .mce-close .mce-i-remove:before { - font: normal 20px/36px dashicons; - text-align: center; - color: #646970; - width: 36px; - height: 36px; - display: block; -} - -.mce-window-head .mce-close:hover .mce-i-remove:before, -.mce-window-head .mce-close:focus .mce-i-remove:before { - color: #135e96; -} - -.mce-window-head .mce-close:focus .mce-i-remove, -div.mce-tab:focus { - box-shadow: 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -.mce-window .mce-window-head .mce-dragh { - width: calc( 100% - 36px ); -} - -.mce-window .mce-foot { - border-top: 1px solid #dcdcde; -} - -.mce-textbox, -.mce-checkbox i.mce-i-checkbox, -#wp-link .query-results { - border: 1px solid #dcdcde; - border-radius: 0; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07); - transition: .05s all ease-in-out; -} - -.mce-textbox:focus, -.mce-textbox.mce-focus, -.mce-checkbox:focus i.mce-i-checkbox, -#wp-link .query-results:focus { - border-color: #4f94d4; - box-shadow: 0 0 2px rgba(79, 148, 212, 0.8); -} - -.mce-window .mce-wp-help { - height: 360px; - width: 460px; - overflow: auto; -} - -.mce-window .mce-wp-help * { - box-sizing: border-box; -} - -.mce-window .mce-wp-help > .mce-container-body { - width: auto !important; -} - -.mce-window .wp-editor-help { - padding: 10px 20px 0 10px; -} - -.mce-window .wp-editor-help h2, -.mce-window .wp-editor-help p { - margin: 8px 0; - white-space: normal; - font-size: 14px; - font-weight: 400; -} - -.mce-window .wp-editor-help table { - width: 100%; - margin-bottom: 20px; -} - -.mce-window .wp-editor-help table.wp-help-single { - margin: 0 8px 20px; -} - -.mce-window .wp-editor-help table.fixed { - table-layout: fixed; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(odd), -.mce-window .wp-editor-help table.fixed td:nth-child(odd) { - width: 12%; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(even), -.mce-window .wp-editor-help table.fixed td:nth-child(even) { - width: 38%; -} - -.mce-window .wp-editor-help table.fixed th:nth-child(odd) { - padding: 5px 0 0; -} - -.mce-window .wp-editor-help td, -.mce-window .wp-editor-help th { - font-size: 13px; - padding: 5px; - vertical-align: middle; - word-wrap: break-word; - white-space: normal; -} - -.mce-window .wp-editor-help th { - font-weight: 600; - padding-bottom: 0; -} - -.mce-window .wp-editor-help kbd { - font-family: monospace; - padding: 2px 7px 3px; - font-weight: 600; - margin: 0; - background: #f0f0f1; - background: rgba(0, 0, 0, 0.08); -} - -.mce-window .wp-help-th-center td:nth-child(odd), -.mce-window .wp-help-th-center th:nth-child(odd) { - text-align: center; -} - -/* TinyMCE menus */ -.mce-menu, -.mce-floatpanel.mce-popover { - border-color: rgba(0, 0, 0, 0.15); - border-radius: 0; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); -} - -.mce-menu, -.mce-floatpanel.mce-popover.mce-bottom { - margin-top: 2px; -} - -.mce-floatpanel .mce-arrow { - display: none; -} - -.mce-menu .mce-container-body { - min-width: 160px; -} - -.mce-menu-item { - border: none; - margin-bottom: 2px; - padding: 6px 12px 6px 15px; -} - -.mce-menu-has-icons i.mce-ico { - line-height: 20px; -} - -/* TinyMCE panel */ -div.mce-panel { - border: 0; - background: #fff; -} - -.mce-panel.mce-menu { - border: 1px solid #dcdcde; -} - -div.mce-tab { - line-height: 13px; -} - -/* TinyMCE toolbars */ -div.mce-toolbar-grp { - border-bottom: 1px solid #dcdcde; - background: #f6f7f7; - padding: 0; - position: relative; -} - -div.mce-inline-toolbar-grp { - border: 1px solid #a7aaad; - border-radius: 2px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); - box-sizing: border-box; - margin-bottom: 8px; - position: absolute; - -webkit-user-select: none; - user-select: none; - max-width: 98%; - z-index: 100100; /* Same as the other TinyMCE "panels" */ -} - -div.mce-inline-toolbar-grp > div.mce-stack-layout { - padding: 1px; -} - -div.mce-inline-toolbar-grp.mce-arrow-up { - margin-bottom: 0; - margin-top: 8px; -} - -div.mce-inline-toolbar-grp:before, -div.mce-inline-toolbar-grp:after { - position: absolute; - right: 50%; - display: block; - width: 0; - height: 0; - border-style: solid; - border-color: transparent; - content: ""; -} - -div.mce-inline-toolbar-grp.mce-arrow-up:before { - top: -9px; - border-bottom-color: #a7aaad; - border-width: 0 9px 9px; - margin-right: -9px; -} - -div.mce-inline-toolbar-grp.mce-arrow-down:before { - bottom: -9px; - border-top-color: #a7aaad; - border-width: 9px 9px 0; - margin-right: -9px; -} - -div.mce-inline-toolbar-grp.mce-arrow-up:after { - top: -8px; - border-bottom-color: #f6f7f7; - border-width: 0 8px 8px; - margin-right: -8px; -} - -div.mce-inline-toolbar-grp.mce-arrow-down:after { - bottom: -8px; - border-top-color: #f6f7f7; - border-width: 8px 8px 0; - margin-right: -8px; -} - -div.mce-inline-toolbar-grp.mce-arrow-left:before, -div.mce-inline-toolbar-grp.mce-arrow-left:after { - margin: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-left:before { - right: 20px; -} -div.mce-inline-toolbar-grp.mce-arrow-left:after { - right: 21px; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:before, -div.mce-inline-toolbar-grp.mce-arrow-right:after { - right: auto; - margin: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:before { - left: 20px; -} - -div.mce-inline-toolbar-grp.mce-arrow-right:after { - left: 21px; -} - -div.mce-inline-toolbar-grp.mce-arrow-full { - left: 0; -} - -div.mce-inline-toolbar-grp.mce-arrow-full > div { - width: 100%; - overflow-x: auto; -} - -div.mce-toolbar-grp > div { - padding: 3px; -} - -.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first { - padding-left: 32px; -} - -.mce-toolbar .mce-btn-group { - margin: 0; -} - -/* Classic block hide/show toolbars */ -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} - -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -} - -div.mce-statusbar { - border-top: 1px solid #dcdcde; -} - -div.mce-path { - padding: 2px 10px; - margin: 0; -} - -.mce-path, -.mce-path-item, -.mce-path .mce-divider { - font-size: 12px; -} - -.mce-toolbar .mce-btn, -.qt-dfw { - border-color: transparent; - background: transparent; - box-shadow: none; - text-shadow: none; - cursor: pointer; -} - -.mce-btn .mce-txt { - direction: inherit; - text-align: inherit; -} - -.mce-toolbar .mce-btn-group .mce-btn, -.qt-dfw { - border: 1px solid transparent; - margin: 2px; - border-radius: 2px; -} - -.mce-toolbar .mce-btn-group .mce-btn:hover, -.mce-toolbar .mce-btn-group .mce-btn:focus, -.qt-dfw:hover, -.qt-dfw:focus { - background: #f6f7f7; - border-color: #50575e; - color: #1d2327; - box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, 0.08); - outline: none; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-active, -.mce-toolbar .mce-btn-group .mce-btn:active, -.qt-dfw.active { - background: #f0f0f1; - border-color: #50575e; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.3); -} - -.mce-btn.mce-active, -.mce-btn.mce-active button, -.mce-btn.mce-active:hover button, -.mce-btn.mce-active i, -.mce-btn.mce-active:hover i { - color: inherit; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-active:focus { - border-color: #1d2327; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus { - color: #a7aaad; - background: none; - border-color: #dcdcde; - text-shadow: 0 1px 0 #fff; - box-shadow: none; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus { - border-color: #50575e; -} - -.mce-toolbar .mce-btn-group .mce-first, -.mce-toolbar .mce-btn-group .mce-last { - border-color: transparent; -} - -.mce-toolbar .mce-btn button, -.qt-dfw { - padding: 2px 3px; - line-height: normal; -} - -.mce-toolbar .mce-listbox button { - font-size: 13px; - line-height: 1.53846153; - padding-right: 6px; - padding-left: 20px; -} - -.mce-toolbar .mce-btn i { - text-shadow: none; -} - -.mce-toolbar .mce-btn-group > div { - white-space: normal; -} - -.mce-toolbar .mce-colorbutton .mce-open { - border-left: 0; -} - -.mce-toolbar .mce-colorbutton .mce-preview { - margin: 0; - padding: 0; - top: auto; - bottom: 2px; - right: 3px; - height: 3px; - width: 20px; - background: #50575e; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary { - min-width: 0; - background: #3582c4; - border-color: #2271b1 #135e96 #135e96; - box-shadow: 0 1px 0 #135e96; - color: #fff; - text-decoration: none; - text-shadow: none; -} - -/* Compensate for the extra box shadow at the bottom of .mce-btn.mce-primary */ -.mce-toolbar .mce-btn-group .mce-btn.mce-primary button { - padding: 2px 3px 1px; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary .mce-ico { - color: #fff; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus { - background: #4f94d4; - border-color: #135e96; - color: #fff; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus { - box-shadow: 0 0 1px 1px #72aee6; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-primary:active { - background: #2271b1; - border-color: #135e96; - box-shadow: inset 0 2px 0 #135e96; -} - -/* mce listbox */ -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox { - border-radius: 0; - direction: rtl; - background: #fff; - border: 1px solid #dcdcde; - box-shadow: inset 0 1px 1px -1px rgba(0, 0, 0, 0.2); -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover, -.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:focus { - border-color: #c3c4c7; -} - -.mce-panel .mce-btn i.mce-caret { - border-top: 6px solid #50575e; - margin-right: 2px; - margin-left: 2px; -} - -.mce-listbox i.mce-caret { - left: 4px; -} - -.mce-panel .mce-btn:hover i.mce-caret, -.mce-panel .mce-btn:focus i.mce-caret { - border-top-color: #1d2327; -} - -.mce-panel .mce-active i.mce-caret { - border-top: 0; - border-bottom: 6px solid #1d2327; - margin-top: 7px; -} - -.mce-listbox.mce-active i.mce-caret { - margin-top: -3px; -} - -.mce-toolbar .mce-splitbtn:hover .mce-open { - border-left-color: transparent; -} - -.mce-toolbar .mce-splitbtn .mce-open.mce-active { - background: transparent; - outline: none; -} - -.mce-menu .mce-menu-item:hover, -.mce-menu .mce-menu-item.mce-selected, -.mce-menu .mce-menu-item:focus, -.mce-menu .mce-menu-item.mce-active.mce-menu-item-normal, -.mce-menu .mce-menu-item.mce-active.mce-menu-item-preview { - background: #2271b1; /* See color scheme. */ - color: #fff; -} - -.mce-menu .mce-menu-item:hover .mce-caret, -.mce-menu .mce-menu-item:focus .mce-caret, -.mce-menu .mce-menu-item.mce-selected .mce-caret { - border-right-color: #fff; -} - -/* rtl:ignore */ -.rtl .mce-menu .mce-menu-item:hover .mce-caret, -.rtl .mce-menu .mce-menu-item:focus .mce-caret, -.rtl .mce-menu .mce-menu-item.mce-selected .mce-caret { - border-left-color: inherit; - border-right-color: #fff; -} - -.mce-menu .mce-menu-item:hover .mce-text, -.mce-menu .mce-menu-item:focus .mce-text, -.mce-menu .mce-menu-item:hover .mce-ico, -.mce-menu .mce-menu-item:focus .mce-ico, -.mce-menu .mce-menu-item.mce-selected .mce-text, -.mce-menu .mce-menu-item.mce-selected .mce-ico, -.mce-menu .mce-menu-item:hover .mce-menu-shortcut, -.mce-menu .mce-menu-item:focus .mce-menu-shortcut, -.mce-menu .mce-menu-item.mce-active .mce-menu-shortcut, -.mce-menu .mce-menu-item.mce-disabled:hover .mce-text, -.mce-menu .mce-menu-item.mce-disabled:hover .mce-ico { - color: inherit; -} - -.mce-menu .mce-menu-item.mce-disabled { - cursor: default; -} - -.mce-menu .mce-menu-item.mce-disabled:hover { - background: #c3c4c7; -} - -/* Menubar */ -div.mce-menubar { - border-color: #dcdcde; - background: #fff; - border-width: 0 0 1px; -} - -.mce-menubar .mce-menubtn:hover, -.mce-menubar .mce-menubtn.mce-active, -.mce-menubar .mce-menubtn:focus { - border-color: transparent; - background: transparent; -} - -.mce-menubar .mce-menubtn:focus { - color: #043959; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -div.mce-menu .mce-menu-item-sep, -.mce-menu-item-sep:hover { - border-bottom: 1px solid #dcdcde; - height: 0; - margin: 5px 0; -} - -.mce-menubtn span { - margin-left: 0; - padding-right: 3px; -} - -.mce-menu-has-icons i.mce-ico:before { - margin-right: -2px; -} - -/* Keyboard shortcuts position */ -.mce-menu.mce-menu-align .mce-menu-item-normal { - position: relative; -} - -.mce-menu.mce-menu-align .mce-menu-shortcut { - bottom: 0.6em; - font-size: 0.9em; -} - -/* Buttons in modals */ -.mce-primary button, -.mce-primary button i { - text-align: center; - color: #fff; - text-shadow: none; - padding: 0; - line-height: 1.85714285; -} - -.mce-window .mce-btn { - color: #50575e; - background: #f6f7f7; - text-decoration: none; - font-size: 13px; - line-height: 26px; - height: 28px; - margin: 0; - padding: 0; - cursor: pointer; - border: 1px solid #c3c4c7; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-shadow: 0 1px 0 #c3c4c7; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.mce-window .mce-btn::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.mce-window .mce-btn:hover, -.mce-window .mce-btn:focus { - background: #f6f7f7; - border-color: #8c8f94; - color: #1d2327; -} - -.mce-window .mce-btn:focus { - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.mce-window .mce-btn:active { - background: #f0f0f1; - border-color: #8c8f94; - box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5); - transform: translateY(1px); -} - -.mce-window .mce-btn.mce-disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - text-shadow: 0 1px 0 #fff !important; - cursor: default; - transform: none !important; -} - -.mce-window .mce-btn.mce-primary { - background: #3582c4; - border-color: #2271b1 #135e96 #135e96; - box-shadow: 0 1px 0 #135e96; - color: #fff; - text-decoration: none; - text-shadow: 0 -1px 1px #135e96, - -1px 0 1px #135e96, - 0 1px 1px #135e96, - 1px 0 1px #135e96; -} - -.mce-window .mce-btn.mce-primary:hover, -.mce-window .mce-btn.mce-primary:focus { - background: #4f94d4; - border-color: #135e96; - color: #fff; -} - -.mce-window .mce-btn.mce-primary:focus { - box-shadow: 0 1px 0 #2271b1, - 0 0 2px 1px #72aee6; -} - -.mce-window .mce-btn.mce-primary:active { - background: #2271b1; - border-color: #135e96; - box-shadow: inset 0 2px 0 #135e96; - vertical-align: top; -} - -.mce-window .mce-btn.mce-primary.mce-disabled { - color: #9ec2e6 !important; - background: #4f94d4 !important; - border-color: #3582c4 !important; - box-shadow: none !important; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important; - cursor: default; -} - -.mce-menubtn.mce-fixed-width span { - overflow-x: hidden; - text-overflow: ellipsis; - width: 82px; -} - -/* Charmap modal */ -.mce-charmap { - margin: 3px; -} - -.mce-charmap td { - padding: 0; - border-color: #dcdcde; - cursor: pointer; -} - -.mce-charmap td:hover { - background: #f6f7f7; -} - -.mce-charmap td div { - width: 18px; - height: 22px; - line-height: 1.57142857; -} - -/* TinyMCE tooltips */ -.mce-tooltip { - margin-top: 2px; -} - -.mce-tooltip-inner { - border-radius: 3px; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - color: #fff; - font-size: 12px; -} - -/* TinyMCE icons */ -.mce-ico { - font-family: tinymce, Arial; -} - -.mce-btn-small .mce-ico { - font-family: tinymce-small, Arial; -} - -.mce-toolbar .mce-ico { - color: #50575e; - line-height: 1; - width: 20px; - height: 20px; - text-align: center; - text-shadow: none; - margin: 0; - padding: 0; -} - -.qt-dfw { - color: #50575e; - line-height: 1; - width: 28px; - height: 26px; - text-align: center; - text-shadow: none; -} - -.mce-toolbar .mce-btn .mce-open { - line-height: 20px; -} - -.mce-toolbar .mce-btn:hover .mce-open, -.mce-toolbar .mce-btn:focus .mce-open, -.mce-toolbar .mce-btn.mce-active .mce-open { - border-right-color: #1d2327; -} - -div.mce-notification { - right: 10% !important; - left: 10%; -} - -.mce-notification button.mce-close { - left: 6px; - top: 3px; - font-weight: 400; - color: #50575e; -} - -.mce-notification button.mce-close:hover, -.mce-notification button.mce-close:focus { - color: #000; -} - -i.mce-i-bold, -i.mce-i-italic, -i.mce-i-bullist, -i.mce-i-numlist, -i.mce-i-blockquote, -i.mce-i-alignleft, -i.mce-i-aligncenter, -i.mce-i-alignright, -i.mce-i-link, -i.mce-i-unlink, -i.mce-i-wp_more, -i.mce-i-strikethrough, -i.mce-i-spellchecker, -i.mce-i-fullscreen, -i.mce-i-wp_fullscreen, -i.mce-i-dfw, -i.mce-i-wp_adv, -i.mce-i-underline, -i.mce-i-alignjustify, -i.mce-i-forecolor, -i.mce-i-backcolor, -i.mce-i-pastetext, -i.mce-i-pasteword, -i.mce-i-removeformat, -i.mce-i-charmap, -i.mce-i-outdent, -i.mce-i-indent, -i.mce-i-undo, -i.mce-i-redo, -i.mce-i-help, -i.mce-i-wp_help, -i.mce-i-wp-media-library, -i.mce-i-ltr, -i.mce-i-wp_page, -i.mce-i-hr, -i.mce-i-wp_code, -i.mce-i-dashicon, -i.mce-i-remove { - font: normal 20px/1 dashicons; - padding: 0; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - margin-right: -2px; - padding-left: 2px; -} - -.qt-dfw { - font: normal 20px/1 dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -i.mce-i-bold:before { - content: "\f200"; -} - -i.mce-i-italic:before { - content: "\f201"; -} - -i.mce-i-bullist:before { - content: "\f203"; -} - -i.mce-i-numlist:before { - content: "\f204"; -} - -i.mce-i-blockquote:before { - content: "\f205"; -} - -i.mce-i-alignleft:before { - content: "\f206"; -} - -i.mce-i-aligncenter:before { - content: "\f207"; -} - -i.mce-i-alignright:before { - content: "\f208"; -} - -i.mce-i-link:before { - content: "\f103"; -} - -i.mce-i-unlink:before { - content: "\f225"; -} - -i.mce-i-wp_more:before { - content: "\f209"; -} - -i.mce-i-strikethrough:before { - content: "\f224"; -} - -i.mce-i-spellchecker:before { - content: "\f210"; -} - -i.mce-i-fullscreen:before, -i.mce-i-wp_fullscreen:before, -i.mce-i-dfw:before, -.qt-dfw:before { - content: "\f211"; -} - -i.mce-i-wp_adv:before { - content: "\f212"; -} - -i.mce-i-underline:before { - content: "\f213"; -} - -i.mce-i-alignjustify:before { - content: "\f214"; -} - -i.mce-i-forecolor:before, -i.mce-i-backcolor:before { - content: "\f215"; -} - -i.mce-i-pastetext:before { - content: "\f217"; -} - -i.mce-i-removeformat:before { - content: "\f218"; -} - -i.mce-i-charmap:before { - content: "\f220"; -} - -i.mce-i-outdent:before { - content: "\f221"; -} - -i.mce-i-indent:before { - content: "\f222"; -} - -i.mce-i-undo:before { - content: "\f171"; -} - -i.mce-i-redo:before { - content: "\f172"; -} - -i.mce-i-help:before, -i.mce-i-wp_help:before { - content: "\f223"; -} - -i.mce-i-wp-media-library:before { - content: "\f104"; -} - -i.mce-i-ltr:before { - content: "\f320"; -} - -i.mce-i-wp_page:before { - content: "\f105"; -} - -i.mce-i-hr:before { - content: "\f460"; -} - -i.mce-i-remove:before { - content: "\f158"; -} - -i.mce-i-wp_code:before { - content: "\f475"; -} - -/* RTL button icons */ -.rtl i.mce-i-outdent:before { - content: "\f222"; -} - -.rtl i.mce-i-indent:before { - content: "\f221"; -} - -/* Editors */ -.wp-editor-wrap { - position: relative; -} - -.wp-editor-tools { - position: relative; - z-index: 1; -} - -.wp-editor-tools:after { - clear: both; - content: ""; - display: table; -} - -.wp-editor-container { - clear: both; - border: 1px solid #dcdcde; -} - -.wp-editor-area { - font-family: Consolas, Monaco, monospace; - font-size: 13px; - padding: 10px; - margin: 1px 0 0; - line-height: 150%; - border: 0; - outline: none; - display: block; - resize: vertical; - box-sizing: border-box; -} - -.rtl .wp-editor-area { - font-family: Tahoma, Monaco, monospace; -} - -.locale-he-il .wp-editor-area { - font-family: Arial, Monaco, monospace; -} - -.wp-editor-container textarea.wp-editor-area { - width: 100%; - margin: 0; - box-shadow: none; -} - -.wp-editor-tabs { - float: left; -} - -.wp-switch-editor { - float: right; - box-sizing: content-box; - position: relative; - top: 1px; - background: #f0f0f1; - color: #646970; - cursor: pointer; - font-size: 13px; - line-height: 1.46153846; - height: 20px; - margin: 5px 5px 0 0; - padding: 3px 8px 4px; - border: 1px solid #dcdcde; -} - -.wp-switch-editor:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - outline: none; - color: #1d2327; -} - -.wp-switch-editor:active, -.html-active .switch-html:focus, -.tmce-active .switch-tmce:focus { - box-shadow: none; -} - -.wp-switch-editor:active { - background-color: #f6f7f7; - box-shadow: none; -} - -.js .tmce-active .wp-editor-area { - color: #fff; -} - -.tmce-active .quicktags-toolbar { - display: none; -} - -.tmce-active .switch-tmce, -.html-active .switch-html { - background: #f6f7f7; - color: #50575e; - border-bottom-color: #f6f7f7; -} - -.wp-media-buttons { - float: right; -} - -.wp-media-buttons .button { - margin-left: 5px; - margin-bottom: 4px; - padding-right: 7px; - padding-left: 7px; -} - -.wp-media-buttons .button:active { - position: relative; - top: 1px; - margin-top: -1px; - margin-bottom: 1px; -} - -.wp-media-buttons .insert-media { - padding-right: 5px; -} - -.wp-media-buttons a { - text-decoration: none; - color: #3c434a; - font-size: 12px; -} - -.wp-media-buttons img { - padding: 0 4px; - vertical-align: middle; -} - -.wp-media-buttons span.wp-media-buttons-icon { - display: inline-block; - width: 20px; - height: 20px; - line-height: 1; - vertical-align: middle; - margin: 0 2px; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon { - background: none; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon:before { - font: normal 18px/1 dashicons; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.wp-media-buttons .add_media span.wp-media-buttons-icon:before { - content: "\f104"; -} - -.mce-content-body dl.wp-caption { - max-width: 100%; -} - -/* Quicktags */ -.quicktags-toolbar { - padding: 3px; - position: relative; - border-bottom: 1px solid #dcdcde; - background: #f6f7f7; - min-height: 30px; -} - -.has-dfw .quicktags-toolbar { - padding-left: 35px; -} - -.wp-core-ui .quicktags-toolbar input.button.button-small { - margin: 2px; -} - -.quicktags-toolbar input[value="link"] { - text-decoration: underline; -} - -.quicktags-toolbar input[value="del"] { - text-decoration: line-through; -} - -.quicktags-toolbar input[value="i"] { - font-style: italic; -} - -.quicktags-toolbar input[value="b"] { - font-weight: 600; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw, -.qt-dfw { - position: absolute; - top: 0; - left: 0; -} - -.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw { - margin: 7px 0 0 7px; -} - -.qt-dfw { - margin: 5px 0 0 5px; -} - -.qt-fullscreen { - position: static; - margin: 2px; -} - -@media screen and (max-width: 782px) { - .mce-toolbar .mce-btn button, - .qt-dfw { - padding: 6px 7px; - } - - /* Compensate for the extra box shadow at the bottom of .mce-btn.mce-primary */ - .mce-toolbar .mce-btn-group .mce-btn.mce-primary button { - padding: 6px 7px 5px; - } - - .mce-toolbar .mce-btn-group .mce-btn { - margin: 1px; - } - - .qt-dfw { - width: 36px; - height: 34px; - } - - .mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw { - margin: 4px 0 0 4px; - } - - .mce-toolbar .mce-colorbutton .mce-preview { - right: 8px; - bottom: 6px; - } - - .mce-window .mce-btn { - padding: 2px 0; - } - - .has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first, - .has-dfw .quicktags-toolbar { - padding-left: 40px; - } -} - -@media screen and (min-width: 782px) { - .wp-core-ui .quicktags-toolbar input.button.button-small { - /* .button-small is normally 11px, but a bit too small for these buttons. */ - font-size: 12px; - min-height: 26px; - line-height: 2; - } -} - -#wp_editbtns, -#wp_gallerybtns { - padding: 2px; - position: absolute; - display: none; - z-index: 100020; -} - -#wp_editimgbtn, -#wp_delimgbtn, -#wp_editgallery, -#wp_delgallery { - background-color: #f0f0f1; - margin: 2px; - padding: 2px; - border: 1px solid #8c8f94; - border-radius: 3px; -} - -#wp_editimgbtn:hover, -#wp_delimgbtn:hover, -#wp_editgallery:hover, -#wp_delgallery:hover { - border-color: #50575e; - background-color: #c3c4c7; -} - -/*------------------------------------------------------------------------------ - wp-link -------------------------------------------------------------------------------*/ - -#wp-link-wrap { - display: none; - background-color: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); - width: 500px; - overflow: hidden; - margin-right: -250px; - margin-top: -125px; - position: fixed; - top: 50%; - right: 50%; - z-index: 100105; - transition: height 0.2s, margin-top 0.2s; -} - -#wp-link-backdrop { - display: none; - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 100100; -} - -#wp-link { - position: relative; - height: 100%; -} - -#wp-link-wrap { - height: 500px; - margin-top: -250px; -} - -#wp-link-wrap .wp-link-text-field { - display: none; -} - -#wp-link-wrap.has-text-field .wp-link-text-field { - display: block; -} - -#link-modal-title { - background: #fff; - border-bottom: 1px solid #dcdcde; - height: 36px; - font-size: 18px; - font-weight: 600; - line-height: 2; - margin: 0; - padding: 0 16px 0 36px; -} - -#wp-link-close { - color: #646970; - padding: 0; - position: absolute; - top: 0; - left: 0; - width: 36px; - height: 36px; - text-align: center; - background: none; - border: none; - cursor: pointer; -} - -#wp-link-close:before { - font: normal 20px/36px dashicons; - vertical-align: top; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - width: 36px; - height: 36px; - content: "\f158"; -} - -#wp-link-close:hover, -#wp-link-close:focus { - color: #135e96; -} - -#wp-link-close:focus { - outline: none; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -2px; -} - -#wp-link-wrap #link-selector { - -webkit-overflow-scrolling: touch; - padding: 0 16px; - position: absolute; - top: 37px; - right: 0; - left: 0; - bottom: 44px; -} - -#wp-link ol, -#wp-link ul { - list-style: none; - margin: 0; - padding: 0; -} - -#wp-link input[type="text"] { - box-sizing: border-box; -} - -#wp-link #link-options { - padding: 8px 0 12px; -} - -#wp-link p.howto { - margin: 3px 0; -} - -#wp-link p.howto a { - text-decoration: none; - color: inherit; -} - -#wp-link label input[type="text"] { - margin-top: 5px; - width: 70%; -} - -#wp-link #link-options label span, -#wp-link #search-panel label span.search-label { - display: inline-block; - width: 80px; - text-align: left; - padding-left: 5px; - max-width: 24%; - vertical-align: middle; - word-wrap: break-word; -} - -#wp-link .link-search-field { - width: 250px; - max-width: 70%; -} - -#wp-link .link-search-wrapper { - margin: 5px 0 9px; - display: block; - overflow: hidden; -} - -#wp-link .link-search-wrapper .spinner { - float: none; - margin: -3px 4px 0 0; -} - -#wp-link .link-target { - padding: 3px 0 0; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#wp-link .link-target label { - max-width: 70%; -} - -#wp-link .query-results { - border: 1px #dcdcde solid; - margin: 0 0 12px; - background: #fff; - overflow: auto; - position: absolute; - right: 16px; - left: 16px; - bottom: 0; - top: 166px; -} - -.has-text-field #wp-link .query-results { - top: 210px; -} - -#wp-link li { - clear: both; - margin-bottom: 0; - border-bottom: 1px solid #f0f0f1; - color: #2c3338; - padding: 4px 10px 4px 6px; - cursor: pointer; - position: relative; -} - -#wp-link .query-notice { - padding: 0; - border-bottom: 1px solid #dcdcde; - background-color: #fff; - color: #000; -} - -#wp-link .query-notice .query-notice-default, -#wp-link .query-notice .query-notice-hint { - display: block; - padding: 6px; - border-right: 4px solid #72aee6; -} - -#wp-link .unselectable.no-matches-found { - padding: 0; - border-bottom: 1px solid #dcdcde; - background-color: #f6f7f7; -} - -#wp-link .no-matches-found .item-title { - display: block; - padding: 6px; - border-right: 4px solid #d63638; -} - -#wp-link .query-results em { - font-style: normal; -} - -#wp-link li:hover { - background: #f0f6fc; - color: #101517; -} - -#wp-link li.unselectable { - border-bottom: 1px solid #dcdcde; -} - -#wp-link li.unselectable:hover { - background: #fff; - cursor: auto; - color: #2c3338; -} - -#wp-link li.selected { - background: #dcdcde; - color: #2c3338; -} - -#wp-link li.selected .item-title { - font-weight: 600; -} - -#wp-link li:last-child { - border: none; -} - -#wp-link .item-title { - display: inline-block; - width: 80%; - width: calc(100% - 68px); - word-wrap: break-word; -} - -#wp-link .item-info { - text-transform: uppercase; - color: #646970; - font-size: 11px; - position: absolute; - left: 5px; - top: 5px; -} - -#wp-link .river-waiting { - display: none; - padding: 10px 0; -} - -#wp-link .submitbox { - padding: 8px 16px; - background: #fff; - border-top: 1px solid #dcdcde; - position: absolute; - bottom: 0; - right: 0; - left: 0; -} - -#wp-link-cancel { - line-height: 1.92307692; - float: right; -} - -#wp-link-update { - line-height: 1.76923076; - float: left; -} - -#wp-link-submit { - float: left; -} - -@media screen and (max-width: 782px) { - #wp-link-wrap { - margin-top: -140px; - } - - #wp-link-wrap .query-results { - top: 195px; - } - - #wp-link-wrap.has-text-field .query-results { - top: 235px; - } - - #link-selector { - padding: 0 16px 60px; - } - - #wp-link-wrap #link-selector { - bottom: 52px; - } - - #wp-link-cancel { - line-height: 2.46153846; - } - - #wp-link .link-target { - padding-top: 10px; - } - - #wp-link .submitbox .button { - margin-bottom: 0; - } -} - -@media screen and (max-width: 520px) { - #wp-link-wrap { - width: auto; - margin-right: 0; - right: 10px; - left: 10px; - max-width: 500px; - } -} - -@media screen and (max-height: 520px) { - #wp-link-wrap { - transition: none; - height: auto; - margin-top: 0; - top: 10px; - bottom: 10px; - } - - #link-selector { - overflow: auto; - } - - #search-panel .query-results { - position: static; - } -} - -@media screen and (max-height: 290px) { - #wp-link-wrap { - height: auto; - margin-top: 0; - top: 10px; - bottom: 10px; - } - - #link-selector { - overflow: auto; - height: calc(100% - 92px); - padding-bottom: 2px; - } - - #search-panel .query-results { - position: static; - } -} - -div.wp-link-preview { - float: right; - margin: 5px; - max-width: 694px; - overflow: hidden; - text-overflow: ellipsis; -} - -div.wp-link-preview a { - color: #2271b1; - text-decoration: underline; - transition-property: border, background, color; - transition-duration: .05s; - transition-timing-function: ease-in-out; - cursor: pointer; -} - -div.wp-link-preview a.wplink-url-error { - color: #d63638; -} - -div.wp-link-input { - float: right; - margin: 2px; - max-width: 694px; -} - -div.wp-link-input input { - width: 300px; - padding: 3px; - box-sizing: border-box; - line-height: 1.28571429; /* 18px */ - /* Override value inherited from default input fields. */ - min-height: 26px; -} - -.mce-toolbar div.wp-link-preview ~ .mce-btn, -.mce-toolbar div.wp-link-input ~ .mce-btn { - margin: 2px 1px; -} - -.mce-inline-toolbar-grp .mce-btn-group .mce-btn:last-child { - margin-left: 2px; -} - -.ui-autocomplete.wplink-autocomplete { - z-index: 100110; - max-height: 200px; - overflow-y: auto; - padding: 0; - margin: 0; - list-style: none; - position: absolute; - border: 1px solid #4f94d4; - box-shadow: 0 1px 2px rgba(79, 148, 212, 0.8); - background-color: #fff; -} - -.ui-autocomplete.wplink-autocomplete li { - margin-bottom: 0; - padding: 4px 10px; - clear: both; - white-space: normal; - text-align: right; -} - -.ui-autocomplete.wplink-autocomplete li .wp-editor-float-right { - float: left; -} - -.ui-autocomplete.wplink-autocomplete li.ui-state-focus { - background-color: #dcdcde; - cursor: pointer; -} - -@media screen and (max-width: 782px) { - div.wp-link-preview, - div.wp-link-input { - max-width: 70%; - max-width: calc(100% - 86px); - } - - div.wp-link-preview { - margin: 8px 5px 8px 0; - } - - div.wp-link-input { - width: 300px; - } - - div.wp-link-input input { - width: 100%; - font-size: 16px; - padding: 5px; - } -} - -/* =Overlay Body --------------------------------------------------------------- */ - -.mce-fullscreen { - z-index: 100010; -} - -/* =Localization --------------------------------------------------------------- */ -.rtl .wp-switch-editor, -.rtl .quicktags-toolbar input { - font-family: Tahoma, sans-serif; -} - -/* rtl:ignore */ -.mce-rtl .mce-flow-layout .mce-flow-layout-item > div { - direction: rtl; -} - -/* rtl:ignore */ -.mce-rtl .mce-listbox i.mce-caret { - left: 6px; -} - -html:lang(he-il) .rtl .wp-switch-editor, -html:lang(he-il) .rtl .quicktags-toolbar input { - font-family: Arial, sans-serif; -} - -/* HiDPI */ -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - .wp-media-buttons .add_media span.wp-media-buttons-icon { - background: none; - } -} -/*! This file is auto-generated */ -.customize-partial-refreshing { - opacity: 0.25; - transition: opacity 0.25s; - cursor: progress; -} - -/* Override highlight when refreshing */ -.customize-partial-refreshing.widget-customizer-highlighted-widget { - box-shadow: none; -} - -/* Make shortcut buttons essentially invisible */ -.widget .customize-partial-edit-shortcut, -.customize-partial-edit-shortcut { - position: absolute; - float: right; - width: 1px; /* required to have a size to be focusable in Safari */ - height: 1px; - padding: 0; - margin: -1px -1px 0 0; - border: 0; - background: transparent; - color: transparent; - box-shadow: none; - outline: none; - z-index: 5; -} - -/** - * Styles for the actual shortcut - * - * Note that some properties are overly verbose to prevent theme interference. - */ -.widget .customize-partial-edit-shortcut button, -.customize-partial-edit-shortcut button { - position: absolute; - right: -30px; - top: 2px; - color: #fff; - width: 30px; - height: 30px; - min-width: 30px; - min-height: 30px; - line-height: 1 !important; - font-size: 18px; - z-index: 5; - background: #3582c4 !important; - border-radius: 50%; - border: 2px solid #fff; - box-shadow: 0 2px 1px rgba(60, 67, 74, 0.15); - text-align: center; - cursor: pointer; - box-sizing: border-box; - padding: 3px; - animation-fill-mode: both; - animation-duration: .4s; - opacity: 0; - pointer-events: none; - text-shadow: - 0 -1px 1px #135e96, - -1px 0 1px #135e96, - 0 1px 1px #135e96, - 1px 0 1px #135e96; -} -.wp-custom-header .customize-partial-edit-shortcut button { - right: 2px -} - -.customize-partial-edit-shortcut button svg { - fill: #fff; - min-width: 20px; - min-height: 20px; - width: 20px; - height: 20px; - margin: auto; -} - -.customize-partial-edit-shortcut button:hover { - background: #4f94d4 !important; /* matches primary buttons */ -} - -.customize-partial-edit-shortcut button:focus { - box-shadow: 0 0 0 2px #4f94d4; -} - -body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button { - animation-name: customize-partial-edit-shortcut-bounce-appear; - pointer-events: auto; -} -body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button { - animation-name: customize-partial-edit-shortcut-bounce-disappear; - pointer-events: none; -} - -.page-sidebar-collapsed .customize-partial-edit-shortcut button, -.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button { - visibility: hidden; -} - -@keyframes customize-partial-edit-shortcut-bounce-appear { - from, 20%, 40%, 60%, 80%, to { - animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); - } - 0% { - opacity: 0; - transform: scale3d(.3, .3, .3); - } - 20% { - transform: scale3d(1.1, 1.1, 1.1); - } - 40% { - transform: scale3d(.9, .9, .9); - } - 60% { - opacity: 1; - transform: scale3d(1.03, 1.03, 1.03); - } - 80% { - transform: scale3d(.97, .97, .97); - } - to { - opacity: 1; - transform: scale3d(1, 1, 1); - } -} - -@keyframes customize-partial-edit-shortcut-bounce-disappear { - from, 20%, 40%, 60%, 80%, to { - animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); - } - 0% { - opacity: 1; - transform: scale3d(1, 1, 1); - } - 20% { - transform: scale3d(.97, .97, .97); - } - 40% { - opacity: 1; - transform: scale3d(1.03, 1.03, 1.03); - } - 60% { - transform: scale3d(.9, .9, .9); - } - 80% { - transform: scale3d(1.1, 1.1, 1.1); - } - to { - opacity: 0; - transform: scale3d(.3, .3, .3); - } -} - -@media screen and (max-width: 800px) { - .widget .customize-partial-edit-shortcut button, - .customize-partial-edit-shortcut button { - right: -32px; - } -} - -@media screen and (max-width: 320px) { - .widget .customize-partial-edit-shortcut button, - .customize-partial-edit-shortcut button { - right: -30px; - } -} -/*! This file is auto-generated */ -html{--wp-admin--admin-bar--height:32px;scroll-padding-top:var(--wp-admin--admin-bar--height)}#wpadminbar *{height:auto;width:auto;margin:0;padding:0;position:static;text-shadow:none;text-transform:none;letter-spacing:normal;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.46153846;border-radius:0;box-sizing:content-box;transition:none;-webkit-font-smoothing:subpixel-antialiased;-moz-osx-font-smoothing:auto}.rtl #wpadminbar *{font-family:Tahoma,sans-serif}html:lang(he-il) .rtl #wpadminbar *{font-family:Arial,sans-serif}#wpadminbar .ab-empty-item{cursor:default}#wpadminbar .ab-empty-item,#wpadminbar a.ab-item,#wpadminbar>#wp-toolbar span.ab-label,#wpadminbar>#wp-toolbar span.noticon{color:#f0f0f1}#wpadminbar #wp-admin-bar-my-sites a.ab-item,#wpadminbar #wp-admin-bar-site-name a.ab-item{white-space:nowrap}#wpadminbar ul li:after,#wpadminbar ul li:before{content:normal}#wpadminbar a,#wpadminbar a img,#wpadminbar a img:hover,#wpadminbar a:hover{border:none;text-decoration:none;background:0 0;box-shadow:none}#wpadminbar a:active,#wpadminbar a:focus,#wpadminbar div,#wpadminbar input[type=email],#wpadminbar input[type=number],#wpadminbar input[type=password],#wpadminbar input[type=search],#wpadminbar input[type=text],#wpadminbar input[type=url],#wpadminbar select,#wpadminbar textarea{box-shadow:none}#wpadminbar a:focus{outline-offset:-1px}#wpadminbar{direction:rtl;color:#c3c4c7;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.46153846;height:32px;position:fixed;top:0;right:0;width:100%;min-width:600px;z-index:99999;background:#1d2327}#wpadminbar .ab-sub-wrapper,#wpadminbar ul,#wpadminbar ul li{background:0 0;clear:none;list-style:none;margin:0;padding:0;position:relative;text-indent:0;z-index:99999}#wpadminbar ul#wp-admin-bar-root-default>li{margin-left:0}#wpadminbar .quicklinks ul{text-align:right}#wpadminbar li{float:right}#wpadminbar .ab-empty-item{outline:0}#wpadminbar .quicklinks .ab-top-secondary>li{float:left}#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .quicklinks a,#wpadminbar .shortlink-input{height:32px;display:block;padding:0 10px;margin:0}#wpadminbar .quicklinks>ul>li>a{padding:0 7px 0 8px}#wpadminbar .menupop .ab-sub-wrapper,#wpadminbar .shortlink-input{margin:0;padding:0;box-shadow:0 3px 5px rgba(0,0,0,.2);background:#2c3338;display:none;position:absolute;float:none}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{min-width:100%}#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper{left:0;right:auto}#wpadminbar .ab-submenu{padding:6px 0}#wpadminbar .selected .shortlink-input{display:block}#wpadminbar .quicklinks .menupop ul li{float:none}#wpadminbar .quicklinks .menupop ul li a strong{font-weight:600}#wpadminbar .quicklinks .menupop ul li .ab-item,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li .ab-item,#wpadminbar .shortlink-input,#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item{line-height:2;height:26px;white-space:nowrap;min-width:140px}#wpadminbar .shortlink-input{width:200px}#wpadminbar li.hover>.ab-sub-wrapper,#wpadminbar.nojs li:hover>.ab-sub-wrapper{display:block}#wpadminbar .menupop li.hover>.ab-sub-wrapper,#wpadminbar .menupop li:hover>.ab-sub-wrapper{margin-right:100%;margin-top:-32px}#wpadminbar .ab-top-secondary .menupop li.hover>.ab-sub-wrapper,#wpadminbar .ab-top-secondary .menupop li:hover>.ab-sub-wrapper{margin-right:0;right:inherit;left:100%}#wpadminbar .ab-top-menu>li.hover>.ab-item,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item,#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus{background:#2c3338;color:#72aee6}#wpadminbar:not(.mobile)>#wp-toolbar a:focus span.ab-label,#wpadminbar:not(.mobile)>#wp-toolbar li:hover span.ab-label,#wpadminbar>#wp-toolbar li.hover span.ab-label{color:#72aee6}#wpadminbar .ab-icon,#wpadminbar .ab-item:before,#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,.wp-admin-bar-arrow{position:relative;float:right;font:normal 20px/1 dashicons;speak:never;padding:4px 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important;margin-left:6px}#wpadminbar #adminbarsearch:before,#wpadminbar .ab-icon:before,#wpadminbar .ab-item:before{color:#a7aaad;color:rgba(240,246,252,.6)}#wpadminbar #adminbarsearch:before,#wpadminbar .ab-icon:before,#wpadminbar .ab-item:before{position:relative;transition:color .1s ease-in-out}#wpadminbar .ab-label{display:inline-block;height:32px}#wpadminbar .ab-submenu .ab-item{color:#c3c4c7;color:rgba(240,246,252,.7)}#wpadminbar .quicklinks .menupop ul li a,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li a,#wpadminbar.nojs .quicklinks .menupop:hover ul li a{color:#c3c4c7;color:rgba(240,246,252,.7)}#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover>a,#wpadminbar .quicklinks .menupop ul li a:focus,#wpadminbar .quicklinks .menupop ul li a:focus strong,#wpadminbar .quicklinks .menupop ul li a:hover,#wpadminbar .quicklinks .menupop ul li a:hover strong,#wpadminbar .quicklinks .menupop.hover ul li a:focus,#wpadminbar .quicklinks .menupop.hover ul li a:hover,#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus,#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover,#wpadminbar li #adminbarsearch.adminbar-focused:before,#wpadminbar li .ab-item:focus .ab-icon:before,#wpadminbar li .ab-item:focus:before,#wpadminbar li a:focus .ab-icon:before,#wpadminbar li.hover .ab-icon:before,#wpadminbar li.hover .ab-item:before,#wpadminbar li:hover #adminbarsearch:before,#wpadminbar li:hover .ab-icon:before,#wpadminbar li:hover .ab-item:before,#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover{color:#72aee6}#wpadminbar.mobile .quicklinks .ab-icon:before,#wpadminbar.mobile .quicklinks .ab-item:before{color:#c3c4c7}#wpadminbar.mobile .quicklinks .hover .ab-icon:before,#wpadminbar.mobile .quicklinks .hover .ab-item:before{color:#72aee6}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item:before,#wpadminbar .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{position:absolute;font:normal 17px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar .menupop .menupop>.ab-item{display:block;padding-left:2em}#wpadminbar .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{top:1px;left:10px;padding:4px 0;content:"\f141";color:inherit}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item{padding-right:2em;padding-left:1em}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{top:1px;right:6px;content:"\f139"}#wpadminbar .quicklinks .menupop ul.ab-sub-secondary{display:block;position:relative;left:auto;margin:0;box-shadow:none}#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu{background:#3c434a}#wpadminbar .quicklinks .menupop .ab-sub-secondary>li .ab-item:focus a,#wpadminbar .quicklinks .menupop .ab-sub-secondary>li>a:hover{color:#72aee6}#wpadminbar .quicklinks a span#ab-updates{background:#f0f0f1;color:#2c3338;display:inline;padding:2px 5px;font-size:10px;font-weight:600;border-radius:10px}#wpadminbar .quicklinks a:hover span#ab-updates{background:#fff;color:#000}#wpadminbar .ab-top-secondary{float:left}#wpadminbar ul li:last-child,#wpadminbar ul li:last-child .ab-item{box-shadow:none}#wpadminbar #wp-admin-bar-recovery-mode{color:#fff;background-color:#d63638}#wpadminbar .ab-top-menu>#wp-admin-bar-recovery-mode.hover>.ab-item,#wpadminbar.nojq .quicklinks .ab-top-menu>#wp-admin-bar-recovery-mode>.ab-item:focus,#wpadminbar:not(.mobile) .ab-top-menu>#wp-admin-bar-recovery-mode:hover>.ab-item,#wpadminbar:not(.mobile) .ab-top-menu>#wp-admin-bar-recovery-mode>.ab-item:focus{color:#fff;background-color:#d63638}#wp-admin-bar-my-account>ul{min-width:198px}#wp-admin-bar-my-account:not(.with-avatar)>.ab-item{display:inline-block}#wp-admin-bar-my-account>.ab-item:before{content:"\f110";top:2px;float:left;margin-right:6px;margin-left:0}#wp-admin-bar-my-account.with-avatar>.ab-item:before{display:none;content:none}#wp-admin-bar-my-account.with-avatar>ul{min-width:270px}#wpadminbar #wp-admin-bar-user-actions>li{margin-right:16px;margin-left:16px}#wpadminbar #wp-admin-bar-user-actions.ab-submenu{padding:6px 0 12px}#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions>li{margin-right:88px}#wpadminbar #wp-admin-bar-user-info{margin-top:6px;margin-bottom:15px;height:auto;background:0 0}#wp-admin-bar-user-info .avatar{position:absolute;right:-72px;top:4px;width:64px;height:64px}#wpadminbar #wp-admin-bar-user-info a{background:0 0;height:auto}#wpadminbar #wp-admin-bar-user-info span{background:0 0;padding:0;height:18px}#wpadminbar #wp-admin-bar-user-info .display-name,#wpadminbar #wp-admin-bar-user-info .username{display:block}#wpadminbar #wp-admin-bar-user-info .username{color:#a7aaad;font-size:11px}#wpadminbar #wp-admin-bar-my-account.with-avatar>.ab-empty-item img,#wpadminbar #wp-admin-bar-my-account.with-avatar>a img{width:auto;height:16px;padding:0;border:1px solid #8c8f94;background:#f0f0f1;line-height:1.84615384;vertical-align:middle;margin:-4px 6px 0 0;float:none;display:inline}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon{width:15px;height:20px;margin-left:0;padding:6px 0 5px}#wpadminbar #wp-admin-bar-wp-logo>.ab-item{padding:0 7px}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before{content:"\f120";top:2px}#wpadminbar .quicklinks li .blavatar{display:inline-block;vertical-align:middle;font:normal 16px/1 dashicons!important;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#f0f0f1}#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover>a .blavatar,#wpadminbar .quicklinks li a:focus .blavatar,#wpadminbar .quicklinks li a:hover .blavatar{color:#72aee6}#wpadminbar .quicklinks li div.blavatar:before,#wpadminbar .quicklinks li img.blavatar{height:16px;width:16px;margin:0 -2px 2px 8px}#wpadminbar .quicklinks li div.blavatar:before{content:"\f120";display:inline-block}#wpadminbar #wp-admin-bar-appearance{margin-top:-12px}#wpadminbar #wp-admin-bar-my-sites>.ab-item:before,#wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f541";top:2px}#wpadminbar #wp-admin-bar-site-editor>.ab-item:before{content:"\f100";top:2px}#wpadminbar #wp-admin-bar-customize>.ab-item:before{content:"\f540";top:2px}#wpadminbar #wp-admin-bar-edit>.ab-item:before{content:"\f464";top:2px}#wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f226"}.wp-admin #wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f102"}#wpadminbar #wp-admin-bar-comments .ab-icon{margin-left:6px}#wpadminbar #wp-admin-bar-comments .ab-icon:before{content:"\f101";top:3px}#wpadminbar #wp-admin-bar-comments .count-0{opacity:.5}#wpadminbar #wp-admin-bar-new-content .ab-icon:before{content:"\f132";top:4px}#wpadminbar #wp-admin-bar-updates .ab-icon:before{content:"\f463";top:2px}#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before{display:inline-block;animation:rotation 2s infinite linear}@media (prefers-reduced-motion:reduce){#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before{animation:none}}#wpadminbar #wp-admin-bar-search .ab-item{padding:0;background:0 0}#wpadminbar #adminbarsearch{position:relative;height:32px;padding:0 2px;z-index:1}#wpadminbar #adminbarsearch:before{position:absolute;top:6px;right:5px;z-index:20;font:normal 20px/1 dashicons!important;content:"\f179";speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar>#wp-toolbar>#wp-admin-bar-top-secondary>#wp-admin-bar-search #adminbarsearch input.adminbar-input{display:inline-block;float:none;position:relative;z-index:30;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.84615384;text-indent:0;height:24px;width:24px;max-width:none;padding:0 24px 0 3px;margin:0;color:#c3c4c7;background-color:rgba(255,255,255,0);border:none;outline:0;cursor:pointer;box-shadow:none;box-sizing:border-box;transition-duration:.4s;transition-property:width,background;transition-timing-function:ease}#wpadminbar>#wp-toolbar>#wp-admin-bar-top-secondary>#wp-admin-bar-search #adminbarsearch input.adminbar-input:focus{z-index:10;color:#000;width:200px;background-color:rgba(255,255,255,.9);cursor:text;border:0}#wpadminbar #adminbarsearch .adminbar-button{display:none}.customize-support #wpadminbar .hide-if-customize,.customize-support .hide-if-customize,.customize-support .wp-core-ui .hide-if-customize,.customize-support.wp-core-ui .hide-if-customize,.no-customize-support #wpadminbar .hide-if-no-customize,.no-customize-support .hide-if-no-customize,.no-customize-support .wp-core-ui .hide-if-no-customize,.no-customize-support.wp-core-ui .hide-if-no-customize{display:none}#wpadminbar .screen-reader-text,#wpadminbar .screen-reader-text span{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}#wpadminbar .screen-reader-shortcut{position:absolute;top:-1000em}#wpadminbar .screen-reader-shortcut:focus{right:6px;top:7px;height:auto;width:auto;display:block;font-size:14px;font-weight:600;padding:15px 23px 14px;background:#f0f0f1;color:#2271b1;z-index:100000;line-height:normal;text-decoration:none;box-shadow:0 0 2px 2px rgba(0,0,0,.6)}@media screen and (max-width:782px){html{--wp-admin--admin-bar--height:46px}html #wpadminbar{height:46px;min-width:240px}#wpadminbar *{font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.28571428}#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .quicklinks>ul>li>a{padding:0;height:46px;line-height:3.28571428;width:auto}#wpadminbar .ab-icon{font:40px/1 dashicons!important;margin:0;padding:0;width:52px;height:46px;text-align:center}#wpadminbar .ab-icon:before{text-align:center}#wpadminbar .ab-submenu{padding:0}#wpadminbar #wp-admin-bar-my-account a.ab-item,#wpadminbar #wp-admin-bar-my-sites a.ab-item,#wpadminbar #wp-admin-bar-site-name a.ab-item{text-overflow:clip}#wpadminbar .quicklinks .menupop ul li .ab-item,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li .ab-item,#wpadminbar .shortlink-input,#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item{line-height:1.6}#wpadminbar .ab-label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}#wpadminbar .menupop li.hover>.ab-sub-wrapper,#wpadminbar .menupop li:hover>.ab-sub-wrapper{margin-top:-46px}#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .menupop>.ab-item{padding-left:30px}#wpadminbar .menupop .menupop>.ab-item:before{top:10px;left:6px}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper .ab-item{font-size:16px;padding:8px 16px}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper a:empty{display:none}#wpadminbar #wp-admin-bar-wp-logo>.ab-item{padding:0}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon{padding:0;width:52px;height:46px;text-align:center;vertical-align:top}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before{font:28px/1 dashicons!important;top:-3px}#wpadminbar .ab-icon,#wpadminbar .ab-item:before{padding:0}#wpadminbar #wp-admin-bar-customize>.ab-item,#wpadminbar #wp-admin-bar-edit>.ab-item,#wpadminbar #wp-admin-bar-my-account>.ab-item,#wpadminbar #wp-admin-bar-my-sites>.ab-item,#wpadminbar #wp-admin-bar-site-editor>.ab-item,#wpadminbar #wp-admin-bar-site-name>.ab-item{text-indent:100%;white-space:nowrap;overflow:hidden;width:52px;padding:0;color:#a7aaad;position:relative}#wpadminbar .ab-icon,#wpadminbar .ab-item:before,#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon{padding:0;margin-left:0}#wpadminbar #wp-admin-bar-customize>.ab-item:before,#wpadminbar #wp-admin-bar-edit>.ab-item:before,#wpadminbar #wp-admin-bar-my-account>.ab-item:before,#wpadminbar #wp-admin-bar-my-sites>.ab-item:before,#wpadminbar #wp-admin-bar-site-editor>.ab-item:before,#wpadminbar #wp-admin-bar-site-name>.ab-item:before{display:block;text-indent:0;font:normal 32px/1 dashicons;speak:never;top:7px;width:52px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar #wp-admin-bar-appearance{margin-top:0}#wpadminbar .quicklinks li .blavatar:before{display:none}#wpadminbar #wp-admin-bar-search{display:none}#wpadminbar #wp-admin-bar-new-content .ab-icon:before{top:0;line-height:1.33333333;height:46px!important;text-align:center;width:52px;display:block}#wpadminbar #wp-admin-bar-updates{text-align:center}#wpadminbar #wp-admin-bar-updates .ab-icon:before{top:3px}#wpadminbar #wp-admin-bar-comments .ab-icon{margin:0}#wpadminbar #wp-admin-bar-comments .ab-icon:before{display:block;font-size:34px;height:46px;line-height:1.38235294;top:0}#wpadminbar #wp-admin-bar-my-account>a{position:relative;white-space:nowrap;text-indent:150%;width:28px;padding:0 10px;overflow:hidden}#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar>a img{position:absolute;top:13px;left:10px;width:26px;height:26px}#wpadminbar #wp-admin-bar-user-actions.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-user-actions.ab-submenu img.avatar{display:none}#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions>li{margin:0}#wpadminbar #wp-admin-bar-user-info .display-name{height:auto;font-size:16px;line-height:1.5;color:#f0f0f1}#wpadminbar #wp-admin-bar-user-info a{padding-top:4px}#wpadminbar #wp-admin-bar-user-info .username{line-height:.8!important;margin-bottom:-2px}#wp-toolbar>ul>li{display:none}#wpadminbar li#wp-admin-bar-comments,#wpadminbar li#wp-admin-bar-customize,#wpadminbar li#wp-admin-bar-edit,#wpadminbar li#wp-admin-bar-menu-toggle,#wpadminbar li#wp-admin-bar-my-account,#wpadminbar li#wp-admin-bar-my-sites,#wpadminbar li#wp-admin-bar-new-content,#wpadminbar li#wp-admin-bar-site-editor,#wpadminbar li#wp-admin-bar-site-name,#wpadminbar li#wp-admin-bar-updates,#wpadminbar li#wp-admin-bar-wp-logo{display:block}#wpadminbar li.hover ul li,#wpadminbar li:hover ul li,#wpadminbar li:hover ul li:hover ul li{display:list-item}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{min-width:-moz-fit-content;min-width:fit-content}#wpadminbar ul#wp-admin-bar-root-default>li{margin-left:0}#wpadminbar #wp-admin-bar-comments,#wpadminbar #wp-admin-bar-edit,#wpadminbar #wp-admin-bar-my-account,#wpadminbar #wp-admin-bar-my-sites,#wpadminbar #wp-admin-bar-new-content,#wpadminbar #wp-admin-bar-site-name,#wpadminbar #wp-admin-bar-updates,#wpadminbar #wp-admin-bar-wp-logo,#wpadminbar .ab-top-menu,#wpadminbar .ab-top-secondary{position:static}#wpadminbar #wp-admin-bar-my-account{float:left}.network-admin #wpadminbar ul#wp-admin-bar-top-secondary>li#wp-admin-bar-my-account{margin-left:0}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item:before{top:10px;right:0}}@media screen and (max-width:600px){#wpadminbar{position:absolute}#wp-responsive-overlay{position:fixed;top:0;right:0;width:100%;height:100%;z-index:400}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{width:100%;right:0}#wpadminbar .menupop .menupop>.ab-item:before{display:none}#wpadminbar #wp-admin-bar-wp-logo.menupop .ab-sub-wrapper{margin-right:0}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper{margin:0;width:100%;top:auto;right:auto;position:relative}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper .ab-item{font-size:16px;padding:6px 30px 19px 15px}#wpadminbar li:hover ul li ul li{display:list-item}#wpadminbar li#wp-admin-bar-updates,#wpadminbar li#wp-admin-bar-wp-logo{display:none}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper{position:static;box-shadow:none}}@media screen and (max-width:400px){#wpadminbar li#wp-admin-bar-comments{display:none}}/*! This file is auto-generated */ -.mce-tinymce{box-shadow:none}.mce-container,.mce-container *,.mce-widget,.mce-widget *{color:inherit;font-family:inherit}.mce-container .mce-monospace,.mce-widget .mce-monospace{font-family:Consolas,Monaco,monospace;font-size:13px;line-height:150%}#mce-modal-block,#mce-modal-block.mce-fade{opacity:.7;transition:none;background:#000}.mce-window{border-radius:0;box-shadow:0 3px 6px rgba(0,0,0,.3);-webkit-font-smoothing:subpixel-antialiased;transition:none}.mce-window .mce-container-body.mce-abs-layout{overflow:visible}.mce-window .mce-window-head{background:#fff;border-bottom:1px solid #dcdcde;padding:0;min-height:36px}.mce-window .mce-window-head .mce-title{color:#3c434a;font-size:18px;font-weight:600;line-height:36px;margin:0;padding:0 16px 0 36px}.mce-window .mce-window-head .mce-close,.mce-window-head .mce-close .mce-i-remove{color:transparent;top:0;left:0;width:36px;height:36px;padding:0;line-height:36px;text-align:center}.mce-window-head .mce-close .mce-i-remove:before{font:normal 20px/36px dashicons;text-align:center;color:#646970;width:36px;height:36px;display:block}.mce-window-head .mce-close:focus .mce-i-remove:before,.mce-window-head .mce-close:hover .mce-i-remove:before{color:#135e96}.mce-window-head .mce-close:focus .mce-i-remove,div.mce-tab:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.mce-window .mce-window-head .mce-dragh{width:calc(100% - 36px)}.mce-window .mce-foot{border-top:1px solid #dcdcde}#wp-link .query-results,.mce-checkbox i.mce-i-checkbox,.mce-textbox{border:1px solid #dcdcde;border-radius:0;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);transition:.05s all ease-in-out}#wp-link .query-results:focus,.mce-checkbox:focus i.mce-i-checkbox,.mce-textbox.mce-focus,.mce-textbox:focus{border-color:#4f94d4;box-shadow:0 0 2px rgba(79,148,212,.8)}.mce-window .mce-wp-help{height:360px;width:460px;overflow:auto}.mce-window .mce-wp-help *{box-sizing:border-box}.mce-window .mce-wp-help>.mce-container-body{width:auto!important}.mce-window .wp-editor-help{padding:10px 20px 0 10px}.mce-window .wp-editor-help h2,.mce-window .wp-editor-help p{margin:8px 0;white-space:normal;font-size:14px;font-weight:400}.mce-window .wp-editor-help table{width:100%;margin-bottom:20px}.mce-window .wp-editor-help table.wp-help-single{margin:0 8px 20px}.mce-window .wp-editor-help table.fixed{table-layout:fixed}.mce-window .wp-editor-help table.fixed td:nth-child(odd),.mce-window .wp-editor-help table.fixed th:nth-child(odd){width:12%}.mce-window .wp-editor-help table.fixed td:nth-child(even),.mce-window .wp-editor-help table.fixed th:nth-child(even){width:38%}.mce-window .wp-editor-help table.fixed th:nth-child(odd){padding:5px 0 0}.mce-window .wp-editor-help td,.mce-window .wp-editor-help th{font-size:13px;padding:5px;vertical-align:middle;word-wrap:break-word;white-space:normal}.mce-window .wp-editor-help th{font-weight:600;padding-bottom:0}.mce-window .wp-editor-help kbd{font-family:monospace;padding:2px 7px 3px;font-weight:600;margin:0;background:#f0f0f1;background:rgba(0,0,0,.08)}.mce-window .wp-help-th-center td:nth-child(odd),.mce-window .wp-help-th-center th:nth-child(odd){text-align:center}.mce-floatpanel.mce-popover,.mce-menu{border-color:rgba(0,0,0,.15);border-radius:0;box-shadow:0 3px 5px rgba(0,0,0,.2)}.mce-floatpanel.mce-popover.mce-bottom,.mce-menu{margin-top:2px}.mce-floatpanel .mce-arrow{display:none}.mce-menu .mce-container-body{min-width:160px}.mce-menu-item{border:none;margin-bottom:2px;padding:6px 12px 6px 15px}.mce-menu-has-icons i.mce-ico{line-height:20px}div.mce-panel{border:0;background:#fff}.mce-panel.mce-menu{border:1px solid #dcdcde}div.mce-tab{line-height:13px}div.mce-toolbar-grp{border-bottom:1px solid #dcdcde;background:#f6f7f7;padding:0;position:relative}div.mce-inline-toolbar-grp{border:1px solid #a7aaad;border-radius:2px;box-shadow:0 1px 3px rgba(0,0,0,.15);box-sizing:border-box;margin-bottom:8px;position:absolute;-webkit-user-select:none;user-select:none;max-width:98%;z-index:100100}div.mce-inline-toolbar-grp>div.mce-stack-layout{padding:1px}div.mce-inline-toolbar-grp.mce-arrow-up{margin-bottom:0;margin-top:8px}div.mce-inline-toolbar-grp:after,div.mce-inline-toolbar-grp:before{position:absolute;right:50%;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}div.mce-inline-toolbar-grp.mce-arrow-up:before{top:-9px;border-bottom-color:#a7aaad;border-width:0 9px 9px;margin-right:-9px}div.mce-inline-toolbar-grp.mce-arrow-down:before{bottom:-9px;border-top-color:#a7aaad;border-width:9px 9px 0;margin-right:-9px}div.mce-inline-toolbar-grp.mce-arrow-up:after{top:-8px;border-bottom-color:#f6f7f7;border-width:0 8px 8px;margin-right:-8px}div.mce-inline-toolbar-grp.mce-arrow-down:after{bottom:-8px;border-top-color:#f6f7f7;border-width:8px 8px 0;margin-right:-8px}div.mce-inline-toolbar-grp.mce-arrow-left:after,div.mce-inline-toolbar-grp.mce-arrow-left:before{margin:0}div.mce-inline-toolbar-grp.mce-arrow-left:before{right:20px}div.mce-inline-toolbar-grp.mce-arrow-left:after{right:21px}div.mce-inline-toolbar-grp.mce-arrow-right:after,div.mce-inline-toolbar-grp.mce-arrow-right:before{right:auto;margin:0}div.mce-inline-toolbar-grp.mce-arrow-right:before{left:20px}div.mce-inline-toolbar-grp.mce-arrow-right:after{left:21px}div.mce-inline-toolbar-grp.mce-arrow-full{left:0}div.mce-inline-toolbar-grp.mce-arrow-full>div{width:100%;overflow-x:auto}div.mce-toolbar-grp>div{padding:3px}.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first{padding-left:32px}.mce-toolbar .mce-btn-group{margin:0}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar{display:block}div.mce-statusbar{border-top:1px solid #dcdcde}div.mce-path{padding:2px 10px;margin:0}.mce-path,.mce-path .mce-divider,.mce-path-item{font-size:12px}.mce-toolbar .mce-btn,.qt-dfw{border-color:transparent;background:0 0;box-shadow:none;text-shadow:none;cursor:pointer}.mce-btn .mce-txt{direction:inherit;text-align:inherit}.mce-toolbar .mce-btn-group .mce-btn,.qt-dfw{border:1px solid transparent;margin:2px;border-radius:2px}.mce-toolbar .mce-btn-group .mce-btn:focus,.mce-toolbar .mce-btn-group .mce-btn:hover,.qt-dfw:focus,.qt-dfw:hover{background:#f6f7f7;border-color:#50575e;color:#1d2327;box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);outline:0}.mce-toolbar .mce-btn-group .mce-btn.mce-active,.mce-toolbar .mce-btn-group .mce-btn:active,.qt-dfw.active{background:#f0f0f1;border-color:#50575e;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.3)}.mce-btn.mce-active,.mce-btn.mce-active button,.mce-btn.mce-active i,.mce-btn.mce-active:hover button,.mce-btn.mce-active:hover i{color:inherit}.mce-toolbar .mce-btn-group .mce-btn.mce-active:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover{border-color:#1d2327}.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover{color:#a7aaad;background:0 0;border-color:#dcdcde;text-shadow:0 1px 0 #fff;box-shadow:none}.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus{border-color:#50575e}.mce-toolbar .mce-btn-group .mce-first,.mce-toolbar .mce-btn-group .mce-last{border-color:transparent}.mce-toolbar .mce-btn button,.qt-dfw{padding:2px 3px;line-height:normal}.mce-toolbar .mce-listbox button{font-size:13px;line-height:1.53846153;padding-right:6px;padding-left:20px}.mce-toolbar .mce-btn i{text-shadow:none}.mce-toolbar .mce-btn-group>div{white-space:normal}.mce-toolbar .mce-colorbutton .mce-open{border-left:0}.mce-toolbar .mce-colorbutton .mce-preview{margin:0;padding:0;top:auto;bottom:2px;right:3px;height:3px;width:20px;background:#50575e}.mce-toolbar .mce-btn-group .mce-btn.mce-primary{min-width:0;background:#3582c4;border-color:#2271b1 #135e96 #135e96;box-shadow:0 1px 0 #135e96;color:#fff;text-decoration:none;text-shadow:none}.mce-toolbar .mce-btn-group .mce-btn.mce-primary button{padding:2px 3px 1px}.mce-toolbar .mce-btn-group .mce-btn.mce-primary .mce-ico{color:#fff}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-primary:hover{background:#4f94d4;border-color:#135e96;color:#fff}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:focus{box-shadow:0 0 1px 1px #72aee6}.mce-toolbar .mce-btn-group .mce-btn.mce-primary:active{background:#2271b1;border-color:#135e96;box-shadow:inset 0 2px 0 #135e96}.mce-toolbar .mce-btn-group .mce-btn.mce-listbox{border-radius:0;direction:rtl;background:#fff;border:1px solid #dcdcde;box-shadow:inset 0 1px 1px -1px rgba(0,0,0,.2)}.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:focus,.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover{border-color:#c3c4c7}.mce-panel .mce-btn i.mce-caret{border-top:6px solid #50575e;margin-right:2px;margin-left:2px}.mce-listbox i.mce-caret{left:4px}.mce-panel .mce-btn:focus i.mce-caret,.mce-panel .mce-btn:hover i.mce-caret{border-top-color:#1d2327}.mce-panel .mce-active i.mce-caret{border-top:0;border-bottom:6px solid #1d2327;margin-top:7px}.mce-listbox.mce-active i.mce-caret{margin-top:-3px}.mce-toolbar .mce-splitbtn:hover .mce-open{border-left-color:transparent}.mce-toolbar .mce-splitbtn .mce-open.mce-active{background:0 0;outline:0}.mce-menu .mce-menu-item.mce-active.mce-menu-item-normal,.mce-menu .mce-menu-item.mce-active.mce-menu-item-preview,.mce-menu .mce-menu-item.mce-selected,.mce-menu .mce-menu-item:focus,.mce-menu .mce-menu-item:hover{background:#2271b1;color:#fff}.mce-menu .mce-menu-item.mce-selected .mce-caret,.mce-menu .mce-menu-item:focus .mce-caret,.mce-menu .mce-menu-item:hover .mce-caret{border-right-color:#fff}.rtl .mce-menu .mce-menu-item.mce-selected .mce-caret,.rtl .mce-menu .mce-menu-item:focus .mce-caret,.rtl .mce-menu .mce-menu-item:hover .mce-caret{border-left-color:inherit;border-right-color:#fff}.mce-menu .mce-menu-item.mce-active .mce-menu-shortcut,.mce-menu .mce-menu-item.mce-disabled:hover .mce-ico,.mce-menu .mce-menu-item.mce-disabled:hover .mce-text,.mce-menu .mce-menu-item.mce-selected .mce-ico,.mce-menu .mce-menu-item.mce-selected .mce-text,.mce-menu .mce-menu-item:focus .mce-ico,.mce-menu .mce-menu-item:focus .mce-menu-shortcut,.mce-menu .mce-menu-item:focus .mce-text,.mce-menu .mce-menu-item:hover .mce-ico,.mce-menu .mce-menu-item:hover .mce-menu-shortcut,.mce-menu .mce-menu-item:hover .mce-text{color:inherit}.mce-menu .mce-menu-item.mce-disabled{cursor:default}.mce-menu .mce-menu-item.mce-disabled:hover{background:#c3c4c7}div.mce-menubar{border-color:#dcdcde;background:#fff;border-width:0 0 1px}.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus,.mce-menubar .mce-menubtn:hover{border-color:transparent;background:0 0}.mce-menubar .mce-menubtn:focus{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8)}.mce-menu-item-sep:hover,div.mce-menu .mce-menu-item-sep{border-bottom:1px solid #dcdcde;height:0;margin:5px 0}.mce-menubtn span{margin-left:0;padding-right:3px}.mce-menu-has-icons i.mce-ico:before{margin-right:-2px}.mce-menu.mce-menu-align .mce-menu-item-normal{position:relative}.mce-menu.mce-menu-align .mce-menu-shortcut{bottom:.6em;font-size:.9em}.mce-primary button,.mce-primary button i{text-align:center;color:#fff;text-shadow:none;padding:0;line-height:1.85714285}.mce-window .mce-btn{color:#50575e;background:#f6f7f7;text-decoration:none;font-size:13px;line-height:26px;height:28px;margin:0;padding:0;cursor:pointer;border:1px solid #c3c4c7;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-shadow:0 1px 0 #c3c4c7}.mce-window .mce-btn::-moz-focus-inner{border-width:0;border-style:none;padding:0}.mce-window .mce-btn:focus,.mce-window .mce-btn:hover{background:#f6f7f7;border-color:#8c8f94;color:#1d2327}.mce-window .mce-btn:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.mce-window .mce-btn:active{background:#f0f0f1;border-color:#8c8f94;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);transform:translateY(1px)}.mce-window .mce-btn.mce-disabled{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;text-shadow:0 1px 0 #fff!important;cursor:default;transform:none!important}.mce-window .mce-btn.mce-primary{background:#3582c4;border-color:#2271b1 #135e96 #135e96;box-shadow:0 1px 0 #135e96;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #135e96,-1px 0 1px #135e96,0 1px 1px #135e96,1px 0 1px #135e96}.mce-window .mce-btn.mce-primary:focus,.mce-window .mce-btn.mce-primary:hover{background:#4f94d4;border-color:#135e96;color:#fff}.mce-window .mce-btn.mce-primary:focus{box-shadow:0 1px 0 #2271b1,0 0 2px 1px #72aee6}.mce-window .mce-btn.mce-primary:active{background:#2271b1;border-color:#135e96;box-shadow:inset 0 2px 0 #135e96;vertical-align:top}.mce-window .mce-btn.mce-primary.mce-disabled{color:#9ec2e6!important;background:#4f94d4!important;border-color:#3582c4!important;box-shadow:none!important;text-shadow:0 -1px 0 rgba(0,0,0,.1)!important;cursor:default}.mce-menubtn.mce-fixed-width span{overflow-x:hidden;text-overflow:ellipsis;width:82px}.mce-charmap{margin:3px}.mce-charmap td{padding:0;border-color:#dcdcde;cursor:pointer}.mce-charmap td:hover{background:#f6f7f7}.mce-charmap td div{width:18px;height:22px;line-height:1.57142857}.mce-tooltip{margin-top:2px}.mce-tooltip-inner{border-radius:3px;box-shadow:0 3px 5px rgba(0,0,0,.2);color:#fff;font-size:12px}.mce-ico{font-family:tinymce,Arial}.mce-btn-small .mce-ico{font-family:tinymce-small,Arial}.mce-toolbar .mce-ico{color:#50575e;line-height:1;width:20px;height:20px;text-align:center;text-shadow:none;margin:0;padding:0}.qt-dfw{color:#50575e;line-height:1;width:28px;height:26px;text-align:center;text-shadow:none}.mce-toolbar .mce-btn .mce-open{line-height:20px}.mce-toolbar .mce-btn.mce-active .mce-open,.mce-toolbar .mce-btn:focus .mce-open,.mce-toolbar .mce-btn:hover .mce-open{border-right-color:#1d2327}div.mce-notification{right:10%!important;left:10%}.mce-notification button.mce-close{left:6px;top:3px;font-weight:400;color:#50575e}.mce-notification button.mce-close:focus,.mce-notification button.mce-close:hover{color:#000}i.mce-i-aligncenter,i.mce-i-alignjustify,i.mce-i-alignleft,i.mce-i-alignright,i.mce-i-backcolor,i.mce-i-blockquote,i.mce-i-bold,i.mce-i-bullist,i.mce-i-charmap,i.mce-i-dashicon,i.mce-i-dfw,i.mce-i-forecolor,i.mce-i-fullscreen,i.mce-i-help,i.mce-i-hr,i.mce-i-indent,i.mce-i-italic,i.mce-i-link,i.mce-i-ltr,i.mce-i-numlist,i.mce-i-outdent,i.mce-i-pastetext,i.mce-i-pasteword,i.mce-i-redo,i.mce-i-remove,i.mce-i-removeformat,i.mce-i-spellchecker,i.mce-i-strikethrough,i.mce-i-underline,i.mce-i-undo,i.mce-i-unlink,i.mce-i-wp-media-library,i.mce-i-wp_adv,i.mce-i-wp_code,i.mce-i-wp_fullscreen,i.mce-i-wp_help,i.mce-i-wp_more,i.mce-i-wp_page{font:normal 20px/1 dashicons;padding:0;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-right:-2px;padding-left:2px}.qt-dfw{font:normal 20px/1 dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i.mce-i-bold:before{content:"\f200"}i.mce-i-italic:before{content:"\f201"}i.mce-i-bullist:before{content:"\f203"}i.mce-i-numlist:before{content:"\f204"}i.mce-i-blockquote:before{content:"\f205"}i.mce-i-alignleft:before{content:"\f206"}i.mce-i-aligncenter:before{content:"\f207"}i.mce-i-alignright:before{content:"\f208"}i.mce-i-link:before{content:"\f103"}i.mce-i-unlink:before{content:"\f225"}i.mce-i-wp_more:before{content:"\f209"}i.mce-i-strikethrough:before{content:"\f224"}i.mce-i-spellchecker:before{content:"\f210"}.qt-dfw:before,i.mce-i-dfw:before,i.mce-i-fullscreen:before,i.mce-i-wp_fullscreen:before{content:"\f211"}i.mce-i-wp_adv:before{content:"\f212"}i.mce-i-underline:before{content:"\f213"}i.mce-i-alignjustify:before{content:"\f214"}i.mce-i-backcolor:before,i.mce-i-forecolor:before{content:"\f215"}i.mce-i-pastetext:before{content:"\f217"}i.mce-i-removeformat:before{content:"\f218"}i.mce-i-charmap:before{content:"\f220"}i.mce-i-outdent:before{content:"\f221"}i.mce-i-indent:before{content:"\f222"}i.mce-i-undo:before{content:"\f171"}i.mce-i-redo:before{content:"\f172"}i.mce-i-help:before,i.mce-i-wp_help:before{content:"\f223"}i.mce-i-wp-media-library:before{content:"\f104"}i.mce-i-ltr:before{content:"\f320"}i.mce-i-wp_page:before{content:"\f105"}i.mce-i-hr:before{content:"\f460"}i.mce-i-remove:before{content:"\f158"}i.mce-i-wp_code:before{content:"\f475"}.rtl i.mce-i-outdent:before{content:"\f222"}.rtl i.mce-i-indent:before{content:"\f221"}.wp-editor-wrap{position:relative}.wp-editor-tools{position:relative;z-index:1}.wp-editor-tools:after{clear:both;content:"";display:table}.wp-editor-container{clear:both;border:1px solid #dcdcde}.wp-editor-area{font-family:Consolas,Monaco,monospace;font-size:13px;padding:10px;margin:1px 0 0;line-height:150%;border:0;outline:0;display:block;resize:vertical;box-sizing:border-box}.rtl .wp-editor-area{font-family:Tahoma,Monaco,monospace}.locale-he-il .wp-editor-area{font-family:Arial,Monaco,monospace}.wp-editor-container textarea.wp-editor-area{width:100%;margin:0;box-shadow:none}.wp-editor-tabs{float:left}.wp-switch-editor{float:right;box-sizing:content-box;position:relative;top:1px;background:#f0f0f1;color:#646970;cursor:pointer;font-size:13px;line-height:1.46153846;height:20px;margin:5px 5px 0 0;padding:3px 8px 4px;border:1px solid #dcdcde}.wp-switch-editor:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:0;color:#1d2327}.html-active .switch-html:focus,.tmce-active .switch-tmce:focus,.wp-switch-editor:active{box-shadow:none}.wp-switch-editor:active{background-color:#f6f7f7;box-shadow:none}.js .tmce-active .wp-editor-area{color:#fff}.tmce-active .quicktags-toolbar{display:none}.html-active .switch-html,.tmce-active .switch-tmce{background:#f6f7f7;color:#50575e;border-bottom-color:#f6f7f7}.wp-media-buttons{float:right}.wp-media-buttons .button{margin-left:5px;margin-bottom:4px;padding-right:7px;padding-left:7px}.wp-media-buttons .button:active{position:relative;top:1px;margin-top:-1px;margin-bottom:1px}.wp-media-buttons .insert-media{padding-right:5px}.wp-media-buttons a{text-decoration:none;color:#3c434a;font-size:12px}.wp-media-buttons img{padding:0 4px;vertical-align:middle}.wp-media-buttons span.wp-media-buttons-icon{display:inline-block;width:20px;height:20px;line-height:1;vertical-align:middle;margin:0 2px}.wp-media-buttons .add_media span.wp-media-buttons-icon{background:0 0}.wp-media-buttons .add_media span.wp-media-buttons-icon:before{font:normal 18px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-media-buttons .add_media span.wp-media-buttons-icon:before{content:"\f104"}.mce-content-body dl.wp-caption{max-width:100%}.quicktags-toolbar{padding:3px;position:relative;border-bottom:1px solid #dcdcde;background:#f6f7f7;min-height:30px}.has-dfw .quicktags-toolbar{padding-left:35px}.wp-core-ui .quicktags-toolbar input.button.button-small{margin:2px}.quicktags-toolbar input[value=link]{text-decoration:underline}.quicktags-toolbar input[value=del]{text-decoration:line-through}.quicktags-toolbar input[value="i"]{font-style:italic}.quicktags-toolbar input[value="b"]{font-weight:600}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw,.qt-dfw{position:absolute;top:0;left:0}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw{margin:7px 0 0 7px}.qt-dfw{margin:5px 0 0 5px}.qt-fullscreen{position:static;margin:2px}@media screen and (max-width:782px){.mce-toolbar .mce-btn button,.qt-dfw{padding:6px 7px}.mce-toolbar .mce-btn-group .mce-btn.mce-primary button{padding:6px 7px 5px}.mce-toolbar .mce-btn-group .mce-btn{margin:1px}.qt-dfw{width:36px;height:34px}.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw{margin:4px 0 0 4px}.mce-toolbar .mce-colorbutton .mce-preview{right:8px;bottom:6px}.mce-window .mce-btn{padding:2px 0}.has-dfw .quicktags-toolbar,.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first{padding-left:40px}}@media screen and (min-width:782px){.wp-core-ui .quicktags-toolbar input.button.button-small{font-size:12px;min-height:26px;line-height:2}}#wp_editbtns,#wp_gallerybtns{padding:2px;position:absolute;display:none;z-index:100020}#wp_delgallery,#wp_delimgbtn,#wp_editgallery,#wp_editimgbtn{background-color:#f0f0f1;margin:2px;padding:2px;border:1px solid #8c8f94;border-radius:3px}#wp_delgallery:hover,#wp_delimgbtn:hover,#wp_editgallery:hover,#wp_editimgbtn:hover{border-color:#50575e;background-color:#c3c4c7}#wp-link-wrap{display:none;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);width:500px;overflow:hidden;margin-right:-250px;margin-top:-125px;position:fixed;top:50%;right:50%;z-index:100105;transition:height .2s,margin-top .2s}#wp-link-backdrop{display:none;position:fixed;top:0;right:0;left:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100100}#wp-link{position:relative;height:100%}#wp-link-wrap{height:500px;margin-top:-250px}#wp-link-wrap .wp-link-text-field{display:none}#wp-link-wrap.has-text-field .wp-link-text-field{display:block}#link-modal-title{background:#fff;border-bottom:1px solid #dcdcde;height:36px;font-size:18px;font-weight:600;line-height:2;margin:0;padding:0 16px 0 36px}#wp-link-close{color:#646970;padding:0;position:absolute;top:0;left:0;width:36px;height:36px;text-align:center;background:0 0;border:none;cursor:pointer}#wp-link-close:before{font:normal 20px/36px dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:36px;height:36px;content:"\f158"}#wp-link-close:focus,#wp-link-close:hover{color:#135e96}#wp-link-close:focus{outline:0;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:2px solid transparent;outline-offset:-2px}#wp-link-wrap #link-selector{-webkit-overflow-scrolling:touch;padding:0 16px;position:absolute;top:37px;right:0;left:0;bottom:44px}#wp-link ol,#wp-link ul{list-style:none;margin:0;padding:0}#wp-link input[type=text]{box-sizing:border-box}#wp-link #link-options{padding:8px 0 12px}#wp-link p.howto{margin:3px 0}#wp-link p.howto a{text-decoration:none;color:inherit}#wp-link label input[type=text]{margin-top:5px;width:70%}#wp-link #link-options label span,#wp-link #search-panel label span.search-label{display:inline-block;width:80px;text-align:left;padding-left:5px;max-width:24%;vertical-align:middle;word-wrap:break-word}#wp-link .link-search-field{width:250px;max-width:70%}#wp-link .link-search-wrapper{margin:5px 0 9px;display:block;overflow:hidden}#wp-link .link-search-wrapper .spinner{float:none;margin:-3px 4px 0 0}#wp-link .link-target{padding:3px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#wp-link .link-target label{max-width:70%}#wp-link .query-results{border:1px #dcdcde solid;margin:0 0 12px;background:#fff;overflow:auto;position:absolute;right:16px;left:16px;bottom:0;top:166px}.has-text-field #wp-link .query-results{top:210px}#wp-link li{clear:both;margin-bottom:0;border-bottom:1px solid #f0f0f1;color:#2c3338;padding:4px 10px 4px 6px;cursor:pointer;position:relative}#wp-link .query-notice{padding:0;border-bottom:1px solid #dcdcde;background-color:#fff;color:#000}#wp-link .query-notice .query-notice-default,#wp-link .query-notice .query-notice-hint{display:block;padding:6px;border-right:4px solid #72aee6}#wp-link .unselectable.no-matches-found{padding:0;border-bottom:1px solid #dcdcde;background-color:#f6f7f7}#wp-link .no-matches-found .item-title{display:block;padding:6px;border-right:4px solid #d63638}#wp-link .query-results em{font-style:normal}#wp-link li:hover{background:#f0f6fc;color:#101517}#wp-link li.unselectable{border-bottom:1px solid #dcdcde}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#2c3338}#wp-link li.selected{background:#dcdcde;color:#2c3338}#wp-link li.selected .item-title{font-weight:600}#wp-link li:last-child{border:none}#wp-link .item-title{display:inline-block;width:80%;width:calc(100% - 68px);word-wrap:break-word}#wp-link .item-info{text-transform:uppercase;color:#646970;font-size:11px;position:absolute;left:5px;top:5px}#wp-link .river-waiting{display:none;padding:10px 0}#wp-link .submitbox{padding:8px 16px;background:#fff;border-top:1px solid #dcdcde;position:absolute;bottom:0;right:0;left:0}#wp-link-cancel{line-height:1.92307692;float:right}#wp-link-update{line-height:1.76923076;float:left}#wp-link-submit{float:left}@media screen and (max-width:782px){#wp-link-wrap{margin-top:-140px}#wp-link-wrap .query-results{top:195px}#wp-link-wrap.has-text-field .query-results{top:235px}#link-selector{padding:0 16px 60px}#wp-link-wrap #link-selector{bottom:52px}#wp-link-cancel{line-height:2.46153846}#wp-link .link-target{padding-top:10px}#wp-link .submitbox .button{margin-bottom:0}}@media screen and (max-width:520px){#wp-link-wrap{width:auto;margin-right:0;right:10px;left:10px;max-width:500px}}@media screen and (max-height:520px){#wp-link-wrap{transition:none;height:auto;margin-top:0;top:10px;bottom:10px}#link-selector{overflow:auto}#search-panel .query-results{position:static}}@media screen and (max-height:290px){#wp-link-wrap{height:auto;margin-top:0;top:10px;bottom:10px}#link-selector{overflow:auto;height:calc(100% - 92px);padding-bottom:2px}#search-panel .query-results{position:static}}div.wp-link-preview{float:right;margin:5px;max-width:694px;overflow:hidden;text-overflow:ellipsis}div.wp-link-preview a{color:#2271b1;text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out;cursor:pointer}div.wp-link-preview a.wplink-url-error{color:#d63638}div.wp-link-input{float:right;margin:2px;max-width:694px}div.wp-link-input input{width:300px;padding:3px;box-sizing:border-box;line-height:1.28571429;min-height:26px}.mce-toolbar div.wp-link-input~.mce-btn,.mce-toolbar div.wp-link-preview~.mce-btn{margin:2px 1px}.mce-inline-toolbar-grp .mce-btn-group .mce-btn:last-child{margin-left:2px}.ui-autocomplete.wplink-autocomplete{z-index:100110;max-height:200px;overflow-y:auto;padding:0;margin:0;list-style:none;position:absolute;border:1px solid #4f94d4;box-shadow:0 1px 2px rgba(79,148,212,.8);background-color:#fff}.ui-autocomplete.wplink-autocomplete li{margin-bottom:0;padding:4px 10px;clear:both;white-space:normal;text-align:right}.ui-autocomplete.wplink-autocomplete li .wp-editor-float-right{float:left}.ui-autocomplete.wplink-autocomplete li.ui-state-focus{background-color:#dcdcde;cursor:pointer}@media screen and (max-width:782px){div.wp-link-input,div.wp-link-preview{max-width:70%;max-width:calc(100% - 86px)}div.wp-link-preview{margin:8px 5px 8px 0}div.wp-link-input{width:300px}div.wp-link-input input{width:100%;font-size:16px;padding:5px}}.mce-fullscreen{z-index:100010}.rtl .quicktags-toolbar input,.rtl .wp-switch-editor{font-family:Tahoma,sans-serif}.mce-rtl .mce-flow-layout .mce-flow-layout-item>div{direction:rtl}.mce-rtl .mce-listbox i.mce-caret{left:6px}html:lang(he-il) .rtl .quicktags-toolbar input,html:lang(he-il) .rtl .wp-switch-editor{font-family:Arial,sans-serif}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.wp-media-buttons .add_media span.wp-media-buttons-icon{background:0 0}}/*! This file is auto-generated */ -.customize-partial-refreshing{opacity:.25;transition:opacity .25s;cursor:progress}.customize-partial-refreshing.widget-customizer-highlighted-widget{box-shadow:none}.customize-partial-edit-shortcut,.widget .customize-partial-edit-shortcut{position:absolute;float:left;width:1px;height:1px;padding:0;margin:-1px 0 0 -1px;border:0;background:0 0;color:transparent;box-shadow:none;outline:0;z-index:5}.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{position:absolute;left:-30px;top:2px;color:#fff;width:30px;height:30px;min-width:30px;min-height:30px;line-height:1!important;font-size:18px;z-index:5;background:#3582c4!important;border-radius:50%;border:2px solid #fff;box-shadow:0 2px 1px rgba(60,67,74,.15);text-align:center;cursor:pointer;box-sizing:border-box;padding:3px;animation-fill-mode:both;animation-duration:.4s;opacity:0;pointer-events:none;text-shadow:0 -1px 1px #135e96,1px 0 1px #135e96,0 1px 1px #135e96,-1px 0 1px #135e96}.wp-custom-header .customize-partial-edit-shortcut button{left:2px}.customize-partial-edit-shortcut button svg{fill:#fff;min-width:20px;min-height:20px;width:20px;height:20px;margin:auto}.customize-partial-edit-shortcut button:hover{background:#4f94d4!important}.customize-partial-edit-shortcut button:focus{box-shadow:0 0 0 2px #4f94d4}body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button{animation-name:customize-partial-edit-shortcut-bounce-appear;pointer-events:auto}body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button{animation-name:customize-partial-edit-shortcut-bounce-disappear;pointer-events:none}.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button,.page-sidebar-collapsed .customize-partial-edit-shortcut button{visibility:hidden}@keyframes customize-partial-edit-shortcut-bounce-appear{20%,40%,60%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.610,0.355,1.000)}0%{opacity:0;transform:scale3d(.3,.3,.3)}20%{transform:scale3d(1.1,1.1,1.1)}40%{transform:scale3d(.9,.9,.9)}60%{opacity:1;transform:scale3d(1.03,1.03,1.03)}80%{transform:scale3d(.97,.97,.97)}to{opacity:1;transform:scale3d(1,1,1)}}@keyframes customize-partial-edit-shortcut-bounce-disappear{20%,40%,60%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.610,0.355,1.000)}0%{opacity:1;transform:scale3d(1,1,1)}20%{transform:scale3d(.97,.97,.97)}40%{opacity:1;transform:scale3d(1.03,1.03,1.03)}60%{transform:scale3d(.9,.9,.9)}80%{transform:scale3d(1.1,1.1,1.1)}to{opacity:0;transform:scale3d(.3,.3,.3)}}@media screen and (max-width:800px){.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{left:-32px}}@media screen and (max-width:320px){.customize-partial-edit-shortcut button,.widget .customize-partial-edit-shortcut button{left:-30px}}.customize-partial-refreshing { - opacity: 0.25; - transition: opacity 0.25s; - cursor: progress; -} - -/* Override highlight when refreshing */ -.customize-partial-refreshing.widget-customizer-highlighted-widget { - box-shadow: none; -} - -/* Make shortcut buttons essentially invisible */ -.widget .customize-partial-edit-shortcut, -.customize-partial-edit-shortcut { - position: absolute; - float: left; - width: 1px; /* required to have a size to be focusable in Safari */ - height: 1px; - padding: 0; - margin: -1px 0 0 -1px; - border: 0; - background: transparent; - color: transparent; - box-shadow: none; - outline: none; - z-index: 5; -} - -/** - * Styles for the actual shortcut - * - * Note that some properties are overly verbose to prevent theme interference. - */ -.widget .customize-partial-edit-shortcut button, -.customize-partial-edit-shortcut button { - position: absolute; - left: -30px; - top: 2px; - color: #fff; - width: 30px; - height: 30px; - min-width: 30px; - min-height: 30px; - line-height: 1 !important; - font-size: 18px; - z-index: 5; - background: #3582c4 !important; - border-radius: 50%; - border: 2px solid #fff; - box-shadow: 0 2px 1px rgba(60, 67, 74, 0.15); - text-align: center; - cursor: pointer; - box-sizing: border-box; - padding: 3px; - animation-fill-mode: both; - animation-duration: .4s; - opacity: 0; - pointer-events: none; - text-shadow: - 0 -1px 1px #135e96, - 1px 0 1px #135e96, - 0 1px 1px #135e96, - -1px 0 1px #135e96; -} -.wp-custom-header .customize-partial-edit-shortcut button { - left: 2px -} - -.customize-partial-edit-shortcut button svg { - fill: #fff; - min-width: 20px; - min-height: 20px; - width: 20px; - height: 20px; - margin: auto; -} - -.customize-partial-edit-shortcut button:hover { - background: #4f94d4 !important; /* matches primary buttons */ -} - -.customize-partial-edit-shortcut button:focus { - box-shadow: 0 0 0 2px #4f94d4; -} - -body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button { - animation-name: customize-partial-edit-shortcut-bounce-appear; - pointer-events: auto; -} -body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button { - animation-name: customize-partial-edit-shortcut-bounce-disappear; - pointer-events: none; -} - -.page-sidebar-collapsed .customize-partial-edit-shortcut button, -.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button { - visibility: hidden; -} - -@keyframes customize-partial-edit-shortcut-bounce-appear { - from, 20%, 40%, 60%, 80%, to { - animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); - } - 0% { - opacity: 0; - transform: scale3d(.3, .3, .3); - } - 20% { - transform: scale3d(1.1, 1.1, 1.1); - } - 40% { - transform: scale3d(.9, .9, .9); - } - 60% { - opacity: 1; - transform: scale3d(1.03, 1.03, 1.03); - } - 80% { - transform: scale3d(.97, .97, .97); - } - to { - opacity: 1; - transform: scale3d(1, 1, 1); - } -} - -@keyframes customize-partial-edit-shortcut-bounce-disappear { - from, 20%, 40%, 60%, 80%, to { - animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); - } - 0% { - opacity: 1; - transform: scale3d(1, 1, 1); - } - 20% { - transform: scale3d(.97, .97, .97); - } - 40% { - opacity: 1; - transform: scale3d(1.03, 1.03, 1.03); - } - 60% { - transform: scale3d(.9, .9, .9); - } - 80% { - transform: scale3d(1.1, 1.1, 1.1); - } - to { - opacity: 0; - transform: scale3d(.3, .3, .3); - } -} - -@media screen and (max-width: 800px) { - .widget .customize-partial-edit-shortcut button, - .customize-partial-edit-shortcut button { - left: -32px; - } -} - -@media screen and (max-width: 320px) { - .widget .customize-partial-edit-shortcut button, - .customize-partial-edit-shortcut button { - left: -30px; - } -} -/*! This file is auto-generated */ -.media-modal *{box-sizing:content-box}.media-modal input,.media-modal select,.media-modal textarea{box-sizing:border-box}.media-frame,.media-modal{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:12px;-webkit-overflow-scrolling:touch}.media-modal legend{padding:0;font-size:13px}.media-modal label{font-size:13px}.media-modal .legend-inline{position:absolute;transform:translate(-100%,50%);margin-left:-1%;line-height:1.2}.media-frame a{border-bottom:none;color:#2271b1}.media-frame a:active,.media-frame a:hover{color:#135e96}.media-frame a:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-frame a.button{color:#2c3338}.media-frame a.button:hover{color:#1d2327}.media-frame a.button-primary,.media-frame a.button-primary:hover{color:#fff}.media-frame input,.media-frame textarea{padding:6px 8px}.media-frame select,.wp-admin .media-frame select{min-height:30px;vertical-align:middle}.media-frame input[type=color],.media-frame input[type=date],.media-frame input[type=datetime-local],.media-frame input[type=datetime],.media-frame input[type=email],.media-frame input[type=month],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=tel],.media-frame input[type=text],.media-frame input[type=time],.media-frame input[type=url],.media-frame input[type=week],.media-frame select,.media-frame textarea{box-shadow:0 0 0 transparent;border-radius:4px;border:1px solid #8c8f94;background-color:#fff;color:#2c3338;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px}.media-frame input[type=date],.media-frame input[type=datetime-local],.media-frame input[type=datetime],.media-frame input[type=email],.media-frame input[type=month],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=tel],.media-frame input[type=text],.media-frame input[type=time],.media-frame input[type=url],.media-frame input[type=week]{padding:0 8px;line-height:2.15384615}.media-frame.mode-grid .wp-filter input[type=search]{font-size:14px;line-height:2}.media-frame input[type=email]:focus,.media-frame input[type=number]:focus,.media-frame input[type=password]:focus,.media-frame input[type=search]:focus,.media-frame input[type=text]:focus,.media-frame input[type=url]:focus,.media-frame select:focus,.media-frame textarea:focus{border-color:#3582c4;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent}.media-frame input:disabled,.media-frame input[readonly],.media-frame textarea:disabled,.media-frame textarea[readonly]{background-color:#f0f0f1}.media-frame input[type=search]{-webkit-appearance:textfield}.media-frame ::-webkit-input-placeholder{color:#646970}.media-frame ::-moz-placeholder{color:#646970;opacity:1}.media-frame :-ms-input-placeholder{color:#646970}.media-frame .hidden,.media-frame .setting.hidden{display:none}/*! - * jQuery UI Draggable/Sortable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */.ui-draggable-handle,.ui-sortable-handle{touch-action:none}.media-modal{position:fixed;top:30px;left:30px;right:30px;bottom:30px;z-index:160000}.wp-customizer .media-modal{z-index:560000}.media-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:159900}.wp-customizer .media-modal-backdrop{z-index:559900}.media-modal-close{position:absolute;top:0;right:0;width:50px;height:50px;margin:0;padding:0;border:1px solid transparent;background:0 0;color:#646970;z-index:1000;cursor:pointer;outline:0;transition:color .1s ease-in-out,background .1s ease-in-out}.media-modal-close:active,.media-modal-close:hover{color:#135e96}.media-modal-close:focus{color:#135e96;border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8);outline:2px solid transparent}.media-modal-close span.media-modal-icon{background-image:none}.media-modal-close .media-modal-icon:before{content:"\f158";font:normal 20px/1 dashicons;speak:never;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.media-modal-content{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto;min-height:300px;box-shadow:0 5px 15px rgba(0,0,0,.7);background:#fff;-webkit-font-smoothing:subpixel-antialiased}.media-modal-content .media-frame select.attachment-filters{margin-top:32px;margin-right:2%;width:42%;width:calc(48% - 12px)}.media-modal-content .attachments-browser .search{width:100%}.wp-core-ui .media-modal-icon{background-image:url(../images/uploader-icons.png);background-repeat:no-repeat}.media-toolbar{position:absolute;top:0;left:0;right:0;z-index:100;height:60px;padding:0 16px;border:0 solid #dcdcde;overflow:hidden}.media-frame-toolbar .media-toolbar{top:auto;bottom:-47px;height:auto;overflow:visible;border-top:1px solid #dcdcde}.media-toolbar-primary{float:right;height:100%;position:relative}.media-toolbar-secondary{float:left;height:100%}.media-toolbar-primary>.media-button,.media-toolbar-primary>.media-button-group{margin-left:10px;float:left;margin-top:15px}.media-toolbar-secondary>.media-button,.media-toolbar-secondary>.media-button-group{margin-right:10px;margin-top:15px}.media-sidebar{position:absolute;top:0;right:0;bottom:0;width:267px;padding:0 16px;z-index:75;background:#f6f7f7;border-left:1px solid #dcdcde;overflow:auto;-webkit-overflow-scrolling:touch}.media-sidebar::after{content:"";display:flex;clear:both;height:24px}.hide-toolbar .media-sidebar{bottom:0}.image-details h2:not(.media-attachments-filter-heading),.media-sidebar h2{position:relative;font-weight:600;text-transform:uppercase;font-size:12px;color:#646970;margin:24px 0 8px}.attachment-details .setting,.media-sidebar .setting{display:block;float:left;width:100%;margin:0 0 10px}.media-sidebar .collection-settings .setting{margin:1px 0}.attachment-details .setting.has-description,.media-sidebar .setting.has-description{margin-bottom:5px}.media-sidebar .setting .link-to-custom{margin:3px 2px 0}.attachment-details .setting .name,.attachment-details .setting span,.media-sidebar .setting .name,.media-sidebar .setting .value,.media-sidebar .setting span{min-width:30%;margin-right:4%;font-size:12px;text-align:right;word-wrap:break-word}.media-sidebar .setting .name{max-width:80px}.media-sidebar .setting .value{text-align:left}.media-sidebar .setting select{max-width:65%}.attachment-details .field input[type=checkbox],.attachment-details .field input[type=radio],.attachment-details .setting input[type=checkbox],.attachment-details .setting input[type=radio],.media-sidebar .field input[type=checkbox],.media-sidebar .field input[type=radio],.media-sidebar .setting input[type=checkbox],.media-sidebar .setting input[type=radio]{float:none;margin:8px 3px 0;padding:0}.attachment-details .setting .name,.attachment-details .setting .value,.attachment-details .setting span,.compat-item label span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting .name,.media-sidebar .setting .value,.media-sidebar .setting span{float:left;min-height:22px;padding-top:8px;line-height:1.33333333;font-weight:400;color:#646970}.media-sidebar .checkbox-label-inline{font-size:12px}.attachment-details .copy-to-clipboard-container,.media-sidebar .copy-to-clipboard-container{flex-wrap:wrap;margin-top:10px;margin-left:calc(35% - 1px);padding-top:10px}.attachment-details .attachment-info .copy-to-clipboard-container{float:none}.attachment-details .copy-to-clipboard-container .success,.media-sidebar .copy-to-clipboard-container .success{padding:0;min-height:0;line-height:2.18181818;text-align:left;color:#008a20}.compat-item label span{text-align:right}.attachment-details .setting .value,.attachment-details .setting input[type=email],.attachment-details .setting input[type=number],.attachment-details .setting input[type=password],.attachment-details .setting input[type=search],.attachment-details .setting input[type=tel],.attachment-details .setting input[type=text],.attachment-details .setting input[type=url],.attachment-details .setting textarea,.attachment-details .setting+.description,.media-sidebar .setting .value,.media-sidebar .setting input[type=email],.media-sidebar .setting input[type=number],.media-sidebar .setting input[type=password],.media-sidebar .setting input[type=search],.media-sidebar .setting input[type=tel],.media-sidebar .setting input[type=text],.media-sidebar .setting input[type=url],.media-sidebar .setting textarea{box-sizing:border-box;margin:1px;width:65%;float:right}.attachment-details .setting .value,.attachment-details .setting+.description,.media-sidebar .setting .value{margin:0 1px;text-align:left}.attachment-details .setting+.description{clear:both;font-size:12px;font-style:normal;margin-bottom:10px}.attachment-details .setting textarea,.compat-item .field textarea,.media-sidebar .setting textarea{height:62px;resize:vertical}.compat-item{float:left;width:100%;overflow:hidden}.compat-item table{width:100%;table-layout:fixed;border-spacing:0;border:0}.compat-item tr{padding:2px 0;display:block;overflow:hidden}.compat-item .field,.compat-item .label{display:block;margin:0;padding:0}.compat-item .label{min-width:30%;margin-right:4%;float:left;text-align:right}.compat-item .label span{display:block;width:100%}.compat-item .field{float:right;width:65%;margin:1px}.compat-item .field input[type=email],.compat-item .field input[type=number],.compat-item .field input[type=password],.compat-item .field input[type=search],.compat-item .field input[type=tel],.compat-item .field input[type=text],.compat-item .field input[type=url],.compat-item .field textarea{width:100%;margin:0;box-sizing:border-box}.sidebar-for-errors .attachment-details,.sidebar-for-errors .compat-item,.sidebar-for-errors .media-sidebar .media-progress-bar,.sidebar-for-errors .upload-details{display:none!important}.media-menu{position:absolute;top:0;left:0;right:0;bottom:0;margin:0;padding:50px 0 10px;background:#f6f7f7;border-right-width:1px;border-right-style:solid;border-right-color:#c3c4c7;-webkit-user-select:none;user-select:none}.media-menu .media-menu-item{display:block;box-sizing:border-box;width:100%;position:relative;border:0;margin:0;padding:8px 20px;font-size:14px;line-height:1.28571428;background:0 0;color:#2271b1;text-align:left;text-decoration:none;cursor:pointer}.media-menu .media-menu-item:hover{background:rgba(0,0,0,.04)}.media-menu .media-menu-item:active{color:#2271b1;outline:0}.media-menu .active,.media-menu .active:hover{color:#1d2327;font-weight:600}.media-menu .media-menu-item:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #dcdcde}.media-router{position:relative;padding:0 6px;margin:0;clear:both}.media-router .media-menu-item{position:relative;float:left;border:0;margin:0;padding:8px 10px 9px;height:18px;line-height:1.28571428;font-size:14px;text-decoration:none;background:0 0;cursor:pointer;transition:none}.media-router .media-menu-item:last-child{border-right:0}.media-router .media-menu-item:active,.media-router .media-menu-item:hover{color:#2271b1}.media-router .active,.media-router .active:hover{color:#1d2327}.media-router .media-menu-item:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);color:#043959;outline:1px solid transparent}.media-router .active,.media-router .media-menu-item.active:last-child{margin:-1px -1px 0;background:#fff;border:1px solid #dcdcde;border-bottom:none}.media-router .active:after{display:none}.media-frame{overflow:hidden;position:absolute;top:0;left:0;right:0;bottom:0}.media-frame-menu{position:absolute;top:0;left:0;bottom:0;width:200px;z-index:150}.media-frame-title{position:absolute;top:0;left:200px;right:0;height:50px;z-index:200}.media-frame-router{position:absolute;top:50px;left:200px;right:0;height:36px;z-index:200}.media-frame-content{position:absolute;top:84px;left:200px;right:0;bottom:61px;height:auto;width:auto;margin:0;overflow:auto;background:#fff;border-top:1px solid #dcdcde}.media-frame-toolbar{position:absolute;left:200px;right:0;z-index:100;bottom:60px;height:auto}.media-frame.hide-menu .media-frame-content,.media-frame.hide-menu .media-frame-router,.media-frame.hide-menu .media-frame-title,.media-frame.hide-menu .media-frame-toolbar{left:0}.media-frame.hide-toolbar .media-frame-content{bottom:0}.media-frame.hide-router .media-frame-content{top:50px}.media-frame.hide-menu .media-frame-menu,.media-frame.hide-menu .media-frame-menu-heading,.media-frame.hide-router .media-frame-router,.media-frame.hide-toolbar .media-frame-toolbar{display:none}.media-frame-title h1{padding:0 16px;font-size:22px;line-height:2.27272727;margin:0}.media-attachments-filter-heading,.media-frame-menu-heading{position:absolute;left:20px;top:22px;margin:0;font-size:13px;line-height:1;z-index:151}.media-attachments-filter-heading{top:10px;left:16px}.mode-grid .media-attachments-filter-heading{top:0;left:-9999px}.mode-grid .media-frame-actions-heading{display:none}.wp-core-ui .button.media-frame-menu-toggle{display:none}.media-frame-title .suggested-dimensions{font-size:14px;float:right;margin-right:20px}.media-frame-content .crop-content{height:100%}.wp-customizer:not(.mobile) .media-frame-content .crop-content.site-icon{margin-right:300px}.media-frame-content .crop-content .crop-image{display:block;margin:auto;max-width:100%;max-height:100%}.media-frame-content .crop-content .upload-errors{position:absolute;width:300px;top:50%;left:50%;margin-left:-150px;margin-right:-150px;z-index:600000}.media-frame .media-iframe{overflow:hidden}.media-frame .media-iframe,.media-frame .media-iframe iframe{height:100%;width:100%;border:0}.media-frame select.attachment-filters{margin-top:11px;margin-right:2%;max-width:42%;max-width:calc(48% - 12px)}.media-frame select.attachment-filters:last-of-type{margin-right:0;width:auto;max-width:100%}.media-frame .search{margin:32px 0 0;padding:4px;font-size:13px;color:#3c434a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;-webkit-appearance:none}.media-toolbar-primary .search{max-width:100%}.media-frame .media-search-input-label{position:absolute;left:0;top:10px;margin:0;line-height:1}.wp-core-ui .attachments{margin:0;-webkit-overflow-scrolling:touch}.wp-core-ui .attachment{position:relative;float:left;padding:8px;margin:0;color:#3c434a;cursor:pointer;list-style:none;text-align:center;-webkit-user-select:none;user-select:none;width:25%;box-sizing:border-box}.wp-core-ui .attachment.details:focus,.wp-core-ui .attachment:focus,.wp-core-ui .selected.attachment:focus{box-shadow:inset 0 0 2px 3px #fff,inset 0 0 0 7px #4f94d4;outline:2px solid transparent;outline-offset:-6px}.wp-core-ui .selected.attachment{box-shadow:inset 0 0 0 5px #fff,inset 0 0 0 7px #c3c4c7}.wp-core-ui .attachment.details{box-shadow:inset 0 0 0 3px #fff,inset 0 0 0 7px #2271b1}.wp-core-ui .attachment-preview{position:relative;box-shadow:inset 0 0 15px rgba(0,0,0,.1),inset 0 0 0 1px rgba(0,0,0,.05);background:#f0f0f1;cursor:pointer}.wp-core-ui .attachment-preview:before{content:"";display:block;padding-top:100%}.wp-core-ui .attachment .icon{margin:0 auto;overflow:hidden}.wp-core-ui .attachment .thumbnail{overflow:hidden;position:absolute;top:0;right:0;bottom:0;left:0;opacity:1;transition:opacity .1s}.wp-core-ui .attachment .portrait img{max-width:100%}.wp-core-ui .attachment .landscape img{max-height:100%}.wp-core-ui .attachment .thumbnail:after{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);overflow:hidden}.wp-core-ui .attachment .thumbnail img{top:0;left:0}.wp-core-ui .attachment .thumbnail .centered{position:absolute;top:0;left:0;width:100%;height:100%;transform:translate(50%,50%)}.wp-core-ui .attachment .thumbnail .centered img{transform:translate(-50%,-50%)}.wp-core-ui .attachments-browser .attachment .thumbnail .centered img.icon{transform:translate(-50%,-70%)}.wp-core-ui .attachment .filename{position:absolute;left:0;right:0;bottom:0;overflow:hidden;max-height:100%;word-wrap:break-word;text-align:center;font-weight:600;background:rgba(255,255,255,.8);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.wp-core-ui .attachment .filename div{padding:5px 10px}.wp-core-ui .attachment .thumbnail img{position:absolute}.wp-core-ui .attachment-close{display:block;position:absolute;top:5px;right:5px;height:22px;width:22px;padding:0;background-color:#fff;background-position:-96px 4px;border-radius:3px;box-shadow:0 0 0 1px rgba(0,0,0,.3);transition:none}.wp-core-ui .attachment-close:focus,.wp-core-ui .attachment-close:hover{background-position:-36px 4px}.wp-core-ui .attachment .check{display:none;height:24px;width:24px;padding:0;border:0;position:absolute;z-index:10;top:0;right:0;outline:0;background:#f0f0f1;cursor:pointer;box-shadow:0 0 0 1px #fff,0 0 0 2px rgba(0,0,0,.15)}.wp-core-ui .attachment .check .media-modal-icon{display:block;background-position:-1px 0;height:15px;width:15px;margin:5px}.wp-core-ui .attachment .check:hover .media-modal-icon{background-position:-40px 0}.wp-core-ui .attachment.selected .check{display:block}.wp-core-ui .attachment.details .check,.wp-core-ui .attachment.selected .check:focus,.wp-core-ui .media-frame.mode-grid .attachment.selected .check{background-color:#2271b1;box-shadow:0 0 0 1px #fff,0 0 0 2px #2271b1}.wp-core-ui .attachment.selected .check:focus{outline:2px solid transparent}.wp-core-ui .attachment.details .check .media-modal-icon,.wp-core-ui .media-frame.mode-grid .attachment.selected .check .media-modal-icon{background-position:-21px 0}.wp-core-ui .attachment.details .check:hover .media-modal-icon,.wp-core-ui .attachment.selected .check:focus .media-modal-icon,.wp-core-ui .media-frame.mode-grid .attachment.selected .check:hover .media-modal-icon{background-position:-60px 0}.wp-core-ui .media-frame .attachment .describe{position:relative;display:block;width:100%;margin:0;padding:0 8px;font-size:12px;border-radius:0}.media-frame .attachments-browser{position:relative;width:100%;height:100%;overflow:hidden}.attachments-browser .media-toolbar{right:300px;height:72px;background:#fff}.attachments-browser.hide-sidebar .media-toolbar{right:0}.attachments-browser .media-toolbar-primary>.media-button,.attachments-browser .media-toolbar-primary>.media-button-group,.attachments-browser .media-toolbar-secondary>.media-button,.attachments-browser .media-toolbar-secondary>.media-button-group{margin:10px 0}.attachments-browser .attachments{padding:2px 8px 8px}.attachments-browser .uploader-inline,.attachments-browser.has-load-more .attachments-wrapper,.attachments-browser:not(.has-load-more) .attachments{position:absolute;top:72px;left:0;right:300px;bottom:0;overflow:auto;outline:0}.attachments-browser .uploader-inline.hidden{display:none}.attachments-browser .media-toolbar-primary{max-width:33%}.mode-grid .attachments-browser .media-toolbar-primary{display:flex;align-items:center}.mode-grid .attachments-browser .media-toolbar-mode-select .media-toolbar-primary{display:none}.attachments-browser .media-toolbar-secondary{max-width:66%}.uploader-inline .close{background-color:transparent;border:0;cursor:pointer;height:48px;outline:0;padding:0;position:absolute;right:2px;text-align:center;top:2px;width:48px;z-index:1}.uploader-inline .close:before{font:normal 30px/1 dashicons!important;color:#50575e;display:inline-block;content:"\f335";font-weight:300;margin-top:1px}.uploader-inline .close:focus{outline:1px solid #4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.attachments-browser.hide-sidebar .attachments,.attachments-browser.hide-sidebar .uploader-inline{right:0;margin-right:0}.attachments-browser .instructions{display:inline-block;margin-top:16px;line-height:1.38461538;font-size:13px;color:#646970}.attachments-browser .no-media{padding:2em 0 0 2em}.more-loaded .attachment:not(.found-media){background:#dcdcde}.load-more-wrapper{clear:both;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;padding:1em 0}.load-more-wrapper .load-more-count{min-width:100%;margin:0 0 1em;text-align:center}.load-more-wrapper .load-more{margin:0}.media-frame .load-more-wrapper .load-more+.spinner{float:none;margin:0 -30px 0 10px}.media-frame .load-more-wrapper .load-more.hidden+.spinner{margin:0}.load-more-wrapper::after{content:"";min-width:100%;order:1}.load-more-wrapper .load-more-jump{margin:0 0 0 12px}.attachment.new-media{outline:2px dotted #c3c4c7}.load-more-wrapper{clear:both;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;padding:1em 0}.load-more-wrapper .load-more-count{min-width:100%;margin:0 0 1em;text-align:center}.load-more-wrapper .load-more{margin:0}.media-frame .load-more-wrapper .load-more+.spinner{float:none;margin:0 -30px 0 10px}.media-frame .load-more-wrapper .load-more.hidden+.spinner{margin:0}.load-more-wrapper::after{content:"";min-width:100%;order:1}.load-more-wrapper .load-more-jump{margin:0 0 0 12px}.media-progress-bar{position:relative;height:10px;width:70%;margin:10px auto;border-radius:10px;background:#dcdcde;background:rgba(0,0,0,.1)}.media-progress-bar div{height:10px;min-width:20px;width:0;background:#2271b1;border-radius:10px;transition:width .3s}.media-uploader-status .media-progress-bar{display:none;width:100%}.uploading.media-uploader-status .media-progress-bar{display:block}.attachment-preview .media-progress-bar{position:absolute;top:50%;left:15%;width:70%;margin:-5px 0 0}.media-uploader-status{position:relative;margin:0 auto;padding-bottom:10px;max-width:400px}.uploader-inline .media-uploader-status h2{display:none}.media-uploader-status .upload-details{display:none;font-size:12px;color:#646970}.uploading.media-uploader-status .upload-details{display:block}.media-uploader-status .upload-detail-separator{padding:0 4px}.media-uploader-status .upload-count{color:#3c434a}.media-uploader-status .upload-dismiss-errors,.media-uploader-status .upload-errors{display:none}.errors.media-uploader-status .upload-dismiss-errors,.errors.media-uploader-status .upload-errors{display:block}.media-uploader-status .upload-dismiss-errors{transition:none;text-decoration:none}.upload-errors .upload-error{padding:12px;margin-bottom:12px;background:#fff;border-left:4px solid #d63638;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.uploader-inline .upload-errors .upload-error{padding:12px 30px;background-color:#fcf0f1;box-shadow:none}.upload-errors .upload-error-filename{font-weight:600}.upload-errors .upload-error-message{display:block;padding-top:8px;word-wrap:break-word}.uploader-window,.wp-editor-wrap .uploader-editor{top:0;left:0;right:0;bottom:0;text-align:center;display:none}.uploader-window{position:fixed;z-index:250000;opacity:0;transition:opacity 250ms}.wp-editor-wrap .uploader-editor{position:absolute;z-index:99998;background:rgba(140,143,148,.9)}.uploader-window,.wp-editor-wrap .uploader-editor.droppable{background:rgba(10,75,120,.9)}.uploader-window-content,.wp-editor-wrap .uploader-editor-content{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed #fff}.uploader-window .uploader-editor-title,.uploader-window h1,.wp-editor-wrap .uploader-editor .uploader-editor-title{position:absolute;top:50%;left:0;right:0;transform:translateY(-50%);font-size:3em;line-height:1.3;font-weight:600;color:#fff;margin:0;padding:0 10px}.wp-editor-wrap .uploader-editor .uploader-editor-title{display:none}.wp-editor-wrap .uploader-editor.droppable .uploader-editor-title{display:block}.uploader-window .media-progress-bar{margin-top:20px;max-width:300px;background:0 0;border-color:#fff;display:none}.uploader-window .media-progress-bar div{background:#fff}.uploading .uploader-window .media-progress-bar{display:block}.media-frame .uploader-inline{margin-bottom:20px;padding:0;text-align:center}.uploader-inline-content{position:absolute;top:30%;left:0;right:0}.uploader-inline-content .upload-ui{margin:2em 0}.uploader-inline-content .post-upload-ui{margin-bottom:2em}.uploader-inline .has-upload-message .upload-ui{margin:0 0 4em}.uploader-inline h2{font-size:20px;line-height:1.4;font-weight:400;margin:0}.uploader-inline .has-upload-message .upload-instructions{font-size:14px;color:#3c434a;font-weight:400}.uploader-inline .drop-instructions{display:none}.supports-drag-drop .uploader-inline .drop-instructions{display:block}.uploader-inline p{margin:.5em 0}.uploader-inline .media-progress-bar{display:none}.uploading.uploader-inline .media-progress-bar{display:block}.uploader-inline .browser{display:inline-block!important}.media-selection{position:absolute;top:0;left:0;right:350px;height:60px;padding:0 0 0 16px;overflow:hidden;white-space:nowrap}.media-selection .selection-info{display:inline-block;font-size:12px;height:60px;margin-right:10px;vertical-align:top}.media-selection.editing,.media-selection.empty{display:none}.media-selection.one .edit-selection{display:none}.media-selection .count{display:block;padding-top:12px;font-size:14px;line-height:1.42857142;font-weight:600}.media-selection .button-link{float:left;padding:1px 8px;margin:1px 8px 1px -8px;line-height:1.4;border-right:1px solid #dcdcde;color:#2271b1;text-decoration:none}.media-selection .button-link:focus,.media-selection .button-link:hover{color:#135e96}.media-selection .button-link:last-child{border-right:0;margin-right:0}.selection-info .clear-selection{color:#d63638}.selection-info .clear-selection:focus,.selection-info .clear-selection:hover{color:#d63638}.media-selection .selection-view{display:inline-block;vertical-align:top}.media-selection .attachments{display:inline-block;height:48px;margin:6px;padding:0;overflow:hidden;vertical-align:top}.media-selection .attachment{width:40px;padding:0;margin:4px}.media-selection .attachment .thumbnail{top:0;right:0;bottom:0;left:0}.media-selection .attachment .icon{width:50%}.media-selection .attachment-preview{box-shadow:none;background:0 0}.wp-core-ui .media-selection .attachment.details:focus,.wp-core-ui .media-selection .attachment:focus,.wp-core-ui .media-selection .selected.attachment:focus{box-shadow:0 0 0 1px #fff,0 0 2px 3px #4f94d4;outline:2px solid transparent}.wp-core-ui .media-selection .selected.attachment{box-shadow:none}.wp-core-ui .media-selection .attachment.details{box-shadow:0 0 0 1px #fff,0 0 0 3px #2271b1}.media-selection:after{content:"";display:block;position:absolute;top:0;right:0;bottom:0;width:25px;background-image:linear-gradient(to left,#fff,rgba(255,255,255,0))}.media-selection .attachment .filename{display:none}.media-frame .spinner{background:url(../images/spinner.gif) no-repeat;background-size:20px 20px;float:right;display:inline-block;visibility:hidden;opacity:.7;width:20px;height:20px;margin:0;vertical-align:middle}.media-frame.mode-grid .spinner{margin:0;float:none;vertical-align:middle}.media-modal .media-toolbar .spinner{float:none;vertical-align:bottom;margin:0 0 5px 5px}.media-frame .instructions+.spinner.is-active{vertical-align:middle}.media-frame .spinner.is-active{visibility:visible}.attachment-details{position:relative;overflow:auto}.attachment-details .settings-save-status{float:right;text-transform:none;font-weight:400}.attachment-details .settings-save-status .spinner{float:none;margin-left:5px}.attachment-details .settings-save-status .saved{display:none}.attachment-details.save-waiting .settings-save-status .spinner{visibility:visible}.attachment-details.save-complete .settings-save-status .saved{display:inline-block}.attachment-info{overflow:hidden;min-height:60px;margin-bottom:16px;line-height:1.5;color:#646970;border-bottom:1px solid #dcdcde;padding-bottom:11px}.attachment-info .wp-media-wrapper{margin-bottom:8px}.attachment-info .wp-media-wrapper.wp-audio{margin-top:13px}.attachment-info .filename{font-weight:600;color:#3c434a;word-wrap:break-word}.attachment-info .thumbnail{position:relative;float:left;max-width:120px;max-height:120px;margin-top:5px;margin-right:10px;margin-bottom:5px}.uploading .attachment-info .thumbnail{width:120px;height:80px;box-shadow:inset 0 0 15px rgba(0,0,0,.1)}.uploading .attachment-info .media-progress-bar{margin-top:35px}.attachment-info .thumbnail-image:after{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);overflow:hidden}.attachment-info .thumbnail img{display:block;max-width:120px;max-height:120px;margin:0 auto}.attachment-info .details{float:left;font-size:12px;max-width:100%}.attachment-info .delete-attachment,.attachment-info .edit-attachment,.attachment-info .trash-attachment,.attachment-info .untrash-attachment{display:block;text-decoration:none;white-space:nowrap}.attachment-details.needs-refresh .attachment-info .edit-attachment{display:none}.attachment-info .edit-attachment{display:block}.media-modal .delete-attachment,.media-modal .trash-attachment,.media-modal .untrash-attachment{display:inline;padding:0;color:#d63638}.media-modal .delete-attachment:focus,.media-modal .delete-attachment:hover,.media-modal .trash-attachment:focus,.media-modal .trash-attachment:hover,.media-modal .untrash-attachment:focus,.media-modal .untrash-attachment:hover{color:#d63638}.attachment-display-settings{width:100%;float:left;overflow:hidden}.collection-settings{overflow:hidden}.collection-settings .setting input[type=checkbox]{float:left;margin-right:8px}.collection-settings .setting .name,.collection-settings .setting span{min-width:inherit}.media-modal .imgedit-wrap{position:static}.media-modal .imgedit-wrap .imgedit-panel-content{padding:16px 16px 0;position:absolute;top:0;right:282px;bottom:0;left:0;overflow:auto}.media-modal .imgedit-wrap .imgedit-submit{margin-bottom:16px}.media-modal .imgedit-wrap .imgedit-settings{background:#f6f7f7;border-left:1px solid #dcdcde;padding:20px 16px 0;position:absolute;top:0;right:0;bottom:0;width:250px;overflow:auto}.media-modal .imgedit-wrap .imgedit-save-target{margin:8px 0 24px}.media-modal .imgedit-group{background:0 0;border:none;border-bottom:1px solid #dcdcde;box-shadow:none;margin:0;margin-bottom:16px;padding:0;padding-bottom:16px;position:relative}.media-modal .imgedit-group:last-of-type{border:none;margin:0;padding:0}.media-modal .imgedit-group-top{margin:0}.media-modal .imgedit-group-top h2,.media-modal .imgedit-group-top h2 .button-link{display:inline-block;text-transform:uppercase;font-size:12px;color:#646970;margin:0;margin-top:3px}.media-modal .imgedit-group-top h2 .button-link,.media-modal .imgedit-group-top h2 a{text-decoration:none;color:#646970}.wp-core-ui.media-modal .image-editor .imgedit-help-toggle,.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:active,.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:hover{border:1px solid transparent;margin:0;padding:0;background:0 0;color:#2271b1;font-size:20px;line-height:1;cursor:pointer;box-sizing:content-box;box-shadow:none}.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:focus{color:#2271b1;border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8);outline:2px solid transparent}.wp-core-ui.media-modal .imgedit-group-top .dashicons-arrow-down.imgedit-help-toggle{margin-top:-3px}.wp-core-ui.media-modal .image-editor h3 .imgedit-help-toggle{margin-top:-2px}.media-modal .imgedit-help-toggled span.dashicons:before{content:"\f142"}.media-modal .imgedit-thumbnail-preview{margin:10px 8px 0 0}.imgedit-thumbnail-preview-caption{display:block}.media-modal .imgedit-wrap .notice,.media-modal .imgedit-wrap div.updated{margin:0;margin-bottom:16px}.embed-url{display:block;position:relative;padding:16px;margin:0;z-index:250;background:#fff;font-size:18px}.media-frame .embed-url input{font-size:18px;line-height:1.22222222;padding:12px 40px 12px 14px;width:100%;min-width:200px;box-shadow:inset 2px 2px 4px -2px rgba(0,0,0,.1)}.media-frame .embed-url input::-ms-clear{display:none}.media-frame .embed-url .spinner{position:absolute;top:32px;right:26px}.media-frame .embed-loading .embed-url .spinner{visibility:visible}.embed-link-settings,.embed-media-settings{position:absolute;top:82px;left:0;right:0;bottom:0;padding:0 16px;overflow:auto}.media-embed .embed-link-settings .link-text{margin-top:0}.embed-link-settings::after,.embed-media-settings::after{content:"";display:flex;clear:both;height:24px}.media-embed .embed-link-settings{overflow:visible}.embed-preview embed,.embed-preview iframe,.embed-preview img,.mejs-container video{max-width:100%;vertical-align:middle}.embed-preview a{display:inline-block}.embed-preview img{display:block;height:auto}.mejs-container:focus{outline:1px solid #4f94d4;box-shadow:0 0 2px 1px rgba(79,148,212,.8)}.image-details .media-modal{left:140px;right:140px}.image-details .media-frame-content,.image-details .media-frame-router,.image-details .media-frame-title{left:0}.image-details .embed-media-settings{top:0;overflow:visible;padding:0}.image-details .embed-media-settings::after{content:none}.image-details .embed-media-settings,.image-details .embed-media-settings div{box-sizing:border-box}.image-details .column-settings{background:#f6f7f7;border-right:1px solid #dcdcde;min-height:100%;width:55%;position:absolute;top:0;left:0}.image-details .column-settings h2{margin:20px;padding-top:20px;border-top:1px solid #dcdcde;color:#1d2327}.image-details .column-image{width:45%;position:absolute;left:55%;top:0}.image-details .image{margin:20px}.image-details .image img{max-width:100%;max-height:500px}.image-details .advanced-toggle{padding:0;color:#646970;text-transform:uppercase;text-decoration:none}.image-details .advanced-toggle:active,.image-details .advanced-toggle:hover{color:#646970}.image-details .advanced-toggle:after{font:normal 20px/1 dashicons;speak:never;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f140";display:inline-block;margin-top:-2px}.image-details .advanced-visible .advanced-toggle:after{content:"\f142"}.image-details .custom-size .custom-size-setting,.image-details .custom-size label{display:block;float:left}.image-details .custom-size .custom-size-setting label{float:none}.image-details .custom-size input{width:5em}.image-details .custom-size .sep{float:left;margin:26px 6px 0}.image-details .custom-size .description{margin-left:0}.media-embed .thumbnail{max-width:100%;max-height:200px;position:relative;float:left}.media-embed .thumbnail img{max-height:200px;display:block}.media-embed .thumbnail:after{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);overflow:hidden}.media-embed .setting,.media-embed .setting-group{width:100%;margin:10px 0;float:left;display:block;clear:both}.media-embed .setting-group .setting:not(.checkbox-setting){margin:0}.media-embed .setting.has-description{margin-bottom:5px}.media-embed .description{clear:both;font-style:normal}.media-embed .content-track+.description{line-height:1.4;max-width:none!important}.media-embed .remove-track{margin-bottom:10px}.image-details .embed-media-settings .setting,.image-details .embed-media-settings .setting-group{float:none;width:auto}.image-details .actions{margin:10px 0}.image-details .hidden{display:none}.media-embed .setting input[type=text],.media-embed .setting textarea,.media-embed fieldset{display:block;width:100%;max-width:400px}.image-details .embed-media-settings .setting input[type=text],.image-details .embed-media-settings .setting textarea{max-width:inherit;width:70%}.image-details .description,.image-details .embed-media-settings .custom-size,.image-details .embed-media-settings .link-target,.image-details .embed-media-settings .setting input.link-to-custom,.image-details .embed-media-settings .setting-group{margin-left:27%;width:70%}.image-details .description{font-style:normal;margin-top:0}.image-details .embed-media-settings .link-target{margin-top:16px}.audio-details .checkbox-label,.image-details .checkbox-label,.video-details .checkbox-label{vertical-align:baseline}.media-embed .setting input.hidden,.media-embed .setting textarea.hidden{display:none}.media-embed .setting .name,.media-embed .setting span,.media-embed .setting-group .name{display:inline-block;font-size:13px;line-height:1.84615384;color:#646970}.media-embed .setting span{display:block;width:200px}.image-details .embed-media-settings .setting .name,.image-details .embed-media-settings .setting span{float:left;width:25%;text-align:right;margin:8px 1% 0;line-height:1.1}.image-details .embed-media-settings .setting .button-group,.media-frame .setting-group .button-group{width:auto}.media-embed-sidebar{position:absolute;top:0;left:440px}.advanced-section,.link-settings{margin-top:10px}.media-frame .setting .button-group{display:flex;margin:0!important;max-width:none!important}.rtl .media-frame,.rtl .media-frame .search,.rtl .media-frame input[type=email],.rtl .media-frame input[type=number],.rtl .media-frame input[type=password],.rtl .media-frame input[type=search],.rtl .media-frame input[type=tel],.rtl .media-frame input[type=text],.rtl .media-frame input[type=url],.rtl .media-frame select,.rtl .media-frame textarea,.rtl .media-modal{font-family:Tahoma,sans-serif}:lang(he-il) .rtl .media-frame,:lang(he-il) .rtl .media-frame .search,:lang(he-il) .rtl .media-frame input[type=email],:lang(he-il) .rtl .media-frame input[type=number],:lang(he-il) .rtl .media-frame input[type=password],:lang(he-il) .rtl .media-frame input[type=search],:lang(he-il) .rtl .media-frame input[type=text],:lang(he-il) .rtl .media-frame input[type=url],:lang(he-il) .rtl .media-frame select,:lang(he-il) .rtl .media-frame textarea,:lang(he-il) .rtl .media-modal{font-family:Arial,sans-serif}@media only screen and (max-width:900px){.media-modal .media-frame-title{height:40px}.media-modal .media-frame-title h1{line-height:2.22222222;font-size:18px}.media-modal-close{width:42px;height:42px}.media-frame .media-frame-title{position:static;padding:0 44px;text-align:center}.media-frame:not(.hide-menu) .media-frame-content,.media-frame:not(.hide-menu) .media-frame-router,.media-frame:not(.hide-menu) .media-frame-toolbar{left:0}.media-frame:not(.hide-menu) .media-frame-router{top:80px}.media-frame:not(.hide-menu) .media-frame-content{top:114px}.media-frame.hide-router .media-frame-content{top:80px}.media-frame:not(.hide-menu) .media-frame-menu{position:static;width:0}.media-frame:not(.hide-menu) .media-menu{display:none;width:auto;max-width:80%;overflow:auto;z-index:2000;top:75px;left:50%;transform:translateX(-50%);right:auto;bottom:auto;padding:5px 0;border:1px solid #c3c4c7}.media-frame:not(.hide-menu) .media-menu.visible{display:block}.media-frame:not(.hide-menu) .media-menu>a{padding:12px 16px;font-size:16px}.media-frame:not(.hide-menu) .media-menu .separator{margin:5px 10px}.media-frame-menu-heading{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;padding:0;width:1px;word-wrap:normal!important}.wp-core-ui .media-frame:not(.hide-menu) .button.media-frame-menu-toggle{display:inline-flex;align-items:center;position:absolute;left:50%;transform:translateX(-50%);margin:-6px 0 0;padding:0 2px 0 12px;font-size:.875rem;font-weight:600;text-decoration:none;background:0 0;height:.1%;min-height:40px}.wp-core-ui .button.media-frame-menu-toggle:active,.wp-core-ui .button.media-frame-menu-toggle:hover{background:0 0;transform:none}.wp-core-ui .button.media-frame-menu-toggle:focus{outline:1px solid transparent}.media-sidebar{width:230px}.attachments-browser .attachments,.attachments-browser .attachments-wrapper,.attachments-browser .media-toolbar,.attachments-browser .uploader-inline,.attachments-browser.has-load-more .attachments-wrapper{right:262px}.attachment-details .setting,.media-sidebar .setting{margin:6px 0}.attachment-details .setting .name,.attachment-details .setting input,.attachment-details .setting textarea,.compat-item label span,.media-sidebar .setting .name,.media-sidebar .setting input,.media-sidebar .setting textarea{float:none;display:inline-block}.attachment-details .setting span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting span{float:none}.media-sidebar .setting .select-label-inline{display:inline}.attachment-details .setting .name,.compat-item label span,.media-sidebar .checkbox-label-inline,.media-sidebar .setting .name{text-align:inherit;min-height:16px;margin:0;padding:8px 2px 2px}.attachment-details .attachment-info .copy-to-clipboard-container,.media-sidebar .setting .copy-to-clipboard-container{margin-left:0;padding-top:0}.attachment-details .attachment-info .copy-attachment-url,.media-sidebar .setting .copy-attachment-url{margin:0 1px}.attachment-details .setting .value,.media-sidebar .setting .value{float:none;width:auto}.attachment-details .setting input[type=email],.attachment-details .setting input[type=number],.attachment-details .setting input[type=password],.attachment-details .setting input[type=search],.attachment-details .setting input[type=tel],.attachment-details .setting input[type=text],.attachment-details .setting input[type=url],.attachment-details .setting select,.attachment-details .setting textarea,.attachment-details .setting+.description,.media-sidebar .setting input[type=email],.media-sidebar .setting input[type=number],.media-sidebar .setting input[type=password],.media-sidebar .setting input[type=search],.media-sidebar .setting input[type=tel],.media-sidebar .setting input[type=text],.media-sidebar .setting input[type=url],.media-sidebar .setting select,.media-sidebar .setting textarea{float:none;width:98%;max-width:none;height:auto}.media-frame .media-toolbar input[type=search]{line-height:2.25}.attachment-details .setting select.columns,.media-sidebar .setting select.columns{width:auto}.media-frame .search,.media-frame input,.media-frame textarea{padding:3px 6px}.wp-admin .media-frame select{min-height:40px;font-size:16px;line-height:1.625;padding:5px 24px 5px 8px}.image-details .column-image{width:30%;left:70%}.image-details .column-settings{width:70%}.image-details .media-modal{left:30px;right:30px}.image-details .embed-media-settings .setting,.image-details .embed-media-settings .setting-group{margin:20px}.image-details .embed-media-settings .setting .name,.image-details .embed-media-settings .setting span{float:none;text-align:left;width:100%;margin-bottom:4px;margin-left:0}.media-modal .legend-inline{position:static;transform:none;margin-left:0;margin-bottom:6px}.image-details .embed-media-settings .setting-group .setting{margin-bottom:0}.image-details .embed-media-settings .setting input.link-to-custom,.image-details .embed-media-settings .setting input[type=text],.image-details .embed-media-settings .setting textarea{width:100%;margin-left:0}.image-details .embed-media-settings .setting.has-description{margin-bottom:5px}.image-details .description{width:auto;margin:0 20px}.image-details .embed-media-settings .custom-size{margin-left:20px}.collection-settings .setting input[type=checkbox]{float:none;margin-top:0}.media-selection{min-width:120px}.media-selection:after{background:0 0}.media-selection .attachments{display:none}.media-modal .attachments-browser .media-toolbar .search{max-width:100%;height:auto;float:right}.media-modal .attachments-browser .media-toolbar .attachment-filters{height:auto}.media-frame input[type=email],.media-frame input[type=number],.media-frame input[type=password],.media-frame input[type=search],.media-frame input[type=text],.media-frame input[type=url],.media-frame select,.media-frame textarea{font-size:16px}.media-frame .media-toolbar input[type=search]{line-height:2.3755}.media-modal .media-toolbar .spinner{margin-bottom:10px}}@media screen and (max-width:782px){.attachments-browser .media-toolbar{height:82px}.attachments-browser .attachments,.attachments-browser .uploader-inline{top:82px}.media-frame-toolbar .media-toolbar{bottom:-54px}.mode-grid .attachments-browser .media-toolbar-primary{display:block}.attachment-details .copy-to-clipboard-container .success,.media-sidebar .copy-to-clipboard-container .success{font-size:14px;line-height:2.71428571}}@media only screen and (max-width:640px),screen and (max-height:400px){.image-details .media-modal,.media-modal{position:fixed;top:0;left:0;right:0;bottom:0}.media-modal-backdrop{position:fixed}.media-sidebar{z-index:1900;max-width:70%;bottom:120%;box-sizing:border-box;padding-bottom:0}.media-sidebar.visible{bottom:0}.attachments-browser .attachments,.attachments-browser .media-toolbar,.attachments-browser .uploader-inline,.media-frame-content .attachments-browser .attachments-wrapper{right:0}.attachments-browser .attachments-wrapper{padding-top:12px}.image-details .media-frame-title{display:block;top:0;font-size:14px}.image-details .column-image,.image-details .column-settings{width:100%;position:relative;left:0}.image-details .column-settings{padding:4px 0}.media-frame-content .media-toolbar .instructions{display:none}.load-more-wrapper .load-more-jump{margin:12px 0 0}}@media only screen and (min-width:901px) and (max-height:400px){.media-frame:not(.hide-menu) .media-menu,.media-menu{top:0;padding-top:44px}.load-more-wrapper .load-more-jump{margin:12px 0 0}}@media only screen and (max-width:480px){.wp-core-ui.wp-customizer .media-button{margin-top:13px}}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.wp-core-ui .media-modal-icon{background-image:url(../images/uploader-icons-2x.png);background-size:134px 15px}.media-frame .spinner{background-image:url(../images/spinner-2x.gif)}}.media-frame-content[data-columns="1"] .attachment{width:100%}.media-frame-content[data-columns="2"] .attachment{width:50%}.media-frame-content[data-columns="3"] .attachment{width:33.33%}.media-frame-content[data-columns="4"] .attachment{width:25%}.media-frame-content[data-columns="5"] .attachment{width:20%}.media-frame-content[data-columns="6"] .attachment{width:16.66%}.media-frame-content[data-columns="7"] .attachment{width:14.28%}.media-frame-content[data-columns="8"] .attachment{width:12.5%}.media-frame-content[data-columns="9"] .attachment{width:11.11%}.media-frame-content[data-columns="10"] .attachment{width:10%}.media-frame-content[data-columns="11"] .attachment{width:9.09%}.media-frame-content[data-columns="12"] .attachment{width:8.33%}/* ---------------------------------------------------------------------------- - -NOTE: If you edit this file, you should make sure that the CSS rules for -buttons in the following files are updated. - -* jquery-ui-dialog.css -* editor.css - -WordPress-style Buttons -======================= -Create a button by adding the `.button` class to an element. For backward -compatibility, we support several other classes (such as `.button-secondary`), -but these will *not* work with the stackable classes described below. - -Button Styles -------------- -To display a primary button style, add the `.button-primary` class to a button. - -Button Sizes ------------- -Adjust a button's size by adding the `.button-large` or `.button-small` class. - -Button States -------------- -Lock the state of a button by adding the name of the pseudoclass as -an actual class (e.g. `.hover` for `:hover`). - - -TABLE OF CONTENTS: ------------------- - 1.0 - Button Layouts - 2.0 - Default Button Style - 3.0 - Primary Button Style - 4.0 - Button Groups - 5.0 - Responsive Button Styles - ----------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------------- - 1.0 - Button Layouts ----------------------------------------------------------------------------- */ - -.wp-core-ui .button, -.wp-core-ui .button-primary, -.wp-core-ui .button-secondary { - display: inline-block; - text-decoration: none; - font-size: 13px; - line-height: 2.15384615; /* 28px */ - min-height: 30px; - margin: 0; - padding: 0 10px; - cursor: pointer; - border-width: 1px; - border-style: solid; - -webkit-appearance: none; - border-radius: 3px; - white-space: nowrap; - box-sizing: border-box; -} - -/* Remove the dotted border on :focus and the extra padding in Firefox */ -.wp-core-ui button::-moz-focus-inner, -.wp-core-ui input[type="reset"]::-moz-focus-inner, -.wp-core-ui input[type="button"]::-moz-focus-inner, -.wp-core-ui input[type="submit"]::-moz-focus-inner { - border-width: 0; - border-style: none; - padding: 0; -} - -.wp-core-ui .button.button-large, -.wp-core-ui .button-group.button-large .button { - min-height: 32px; - line-height: 2.30769231; /* 30px */ - padding: 0 12px; -} - -.wp-core-ui .button.button-small, -.wp-core-ui .button-group.button-small .button { - min-height: 26px; - line-height: 2.18181818; /* 24px */ - padding: 0 8px; - font-size: 11px; -} - -.wp-core-ui .button.button-hero, -.wp-core-ui .button-group.button-hero .button { - font-size: 14px; - min-height: 46px; - line-height: 3.14285714; - padding: 0 36px; -} - -.wp-core-ui .button.hidden { - display: none; -} - -/* Style Reset buttons as simple text links */ - -.wp-core-ui input[type="reset"], -.wp-core-ui input[type="reset"]:hover, -.wp-core-ui input[type="reset"]:active, -.wp-core-ui input[type="reset"]:focus { - background: none; - border: none; - box-shadow: none; - padding: 0 2px 1px; - width: auto; -} - -/* ---------------------------------------------------------------------------- - 2.0 - Default Button Style ----------------------------------------------------------------------------- */ - -.wp-core-ui .button, -.wp-core-ui .button-secondary { - color: #2271b1; - border-color: #2271b1; - background: #f6f7f7; - vertical-align: top; -} - -.wp-core-ui p .button { - vertical-align: baseline; -} - -.wp-core-ui .button.hover, -.wp-core-ui .button:hover, -.wp-core-ui .button-secondary:hover{ - background: #f0f0f1; - border-color: #0a4b78; - color: #0a4b78; -} - -.wp-core-ui .button.focus, -.wp-core-ui .button:focus, -.wp-core-ui .button-secondary:focus { - background: #f6f7f7; - border-color: #3582c4; - color: #0a4b78; - box-shadow: 0 0 0 1px #3582c4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - /* Reset inherited offset from Gutenberg */ - outline-offset: 0; -} - -/* :active state */ -.wp-core-ui .button:active, -.wp-core-ui .button-secondary:active { - background: #f6f7f7; - border-color: #8c8f94; - box-shadow: none; -} - -/* pressed state e.g. a selected setting */ -.wp-core-ui .button.active, -.wp-core-ui .button.active:hover { - background-color: #dcdcde; - color: #135e96; - border-color: #0a4b78; - box-shadow: inset 0 2px 5px -3px #0a4b78; -} - -.wp-core-ui .button.active:focus { - border-color: #3582c4; - box-shadow: - inset 0 2px 5px -3px #0a4b78, - 0 0 0 1px #3582c4; -} - -.wp-core-ui .button[disabled], -.wp-core-ui .button:disabled, -.wp-core-ui .button.disabled, -.wp-core-ui .button-secondary[disabled], -.wp-core-ui .button-secondary:disabled, -.wp-core-ui .button-secondary.disabled, -.wp-core-ui .button-disabled { - color: #a7aaad !important; - border-color: #dcdcde !important; - background: #f6f7f7 !important; - box-shadow: none !important; - cursor: default; - transform: none !important; -} - -/* Buttons that look like links, for a cross of good semantics with the visual */ -.wp-core-ui .button-link { - margin: 0; - padding: 0; - box-shadow: none; - border: 0; - border-radius: 0; - background: none; - cursor: pointer; - text-align: left; - /* Mimics the default link style in common.css */ - color: #2271b1; - text-decoration: underline; - transition-property: border, background, color; - transition-duration: .05s; - transition-timing-function: ease-in-out; -} - -.wp-core-ui .button-link:hover, -.wp-core-ui .button-link:active { - color: #135e96; -} - -.wp-core-ui .button-link:focus { - color: #043959; - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.wp-core-ui .button-link-delete { - color: #d63638; -} - -.wp-core-ui .button-link-delete:hover, -.wp-core-ui .button-link-delete:focus { - color: #d63638; - background: transparent; -} - -.wp-core-ui .button-link-delete:disabled { - /* overrides the default buttons disabled background */ - background: transparent !important; -} - - -/* ---------------------------------------------------------------------------- - 3.0 - Primary Button Style ----------------------------------------------------------------------------- */ - -.wp-core-ui .button-primary { - background: #2271b1; - border-color: #2271b1; - color: #fff; - text-decoration: none; - text-shadow: none; -} - -.wp-core-ui .button-primary.hover, -.wp-core-ui .button-primary:hover, -.wp-core-ui .button-primary.focus, -.wp-core-ui .button-primary:focus { - background: #135e96; - border-color: #135e96; - color: #fff; -} - -.wp-core-ui .button-primary.focus, -.wp-core-ui .button-primary:focus { - box-shadow: - 0 0 0 1px #fff, - 0 0 0 3px #2271b1; -} - -.wp-core-ui .button-primary.active, -.wp-core-ui .button-primary.active:hover, -.wp-core-ui .button-primary.active:focus, -.wp-core-ui .button-primary:active { - background: #135e96; - border-color: #135e96; - box-shadow: none; - color: #fff; -} - -.wp-core-ui .button-primary[disabled], -.wp-core-ui .button-primary:disabled, -.wp-core-ui .button-primary-disabled, -.wp-core-ui .button-primary.disabled { - color: #a7aaad !important; - background: #f6f7f7 !important; - border-color: #dcdcde !important; - box-shadow: none !important; - text-shadow: none !important; - cursor: default; -} - -/* ---------------------------------------------------------------------------- - 4.0 - Button Groups ----------------------------------------------------------------------------- */ - -.wp-core-ui .button-group { - position: relative; - display: inline-block; - white-space: nowrap; - font-size: 0; - vertical-align: middle; -} - -.wp-core-ui .button-group > .button { - display: inline-block; - border-radius: 0; - margin-right: -1px; -} - -.wp-core-ui .button-group > .button:first-child { - border-radius: 3px 0 0 3px; -} - -.wp-core-ui .button-group > .button:last-child { - border-radius: 0 3px 3px 0; -} - -.wp-core-ui .button-group > .button-primary + .button { - border-left: 0; -} - -.wp-core-ui .button-group > .button:focus { - position: relative; - z-index: 1; -} - -/* pressed state e.g. a selected setting */ -.wp-core-ui .button-group > .button.active { - background-color: #dcdcde; - color: #135e96; - border-color: #0a4b78; - box-shadow: inset 0 2px 5px -3px #0a4b78; -} - -.wp-core-ui .button-group > .button.active:focus { - border-color: #3582c4; - box-shadow: - inset 0 2px 5px -3px #0a4b78, - 0 0 0 1px #3582c4; -} - -/* ---------------------------------------------------------------------------- - 5.0 - Responsive Button Styles ----------------------------------------------------------------------------- */ - -@media screen and (max-width: 782px) { - - .wp-core-ui .button, - .wp-core-ui .button.button-large, - .wp-core-ui .button.button-small, - input#publish, - input#save-post, - a.preview { - padding: 0 14px; - line-height: 2.71428571; /* 38px */ - font-size: 14px; - vertical-align: middle; - min-height: 40px; - margin-bottom: 4px; - } - - /* Copy attachment URL button in the legacy edit media page. */ - .wp-core-ui .copy-to-clipboard-container .copy-attachment-url { - margin-bottom: 0; - } - - #media-upload.wp-core-ui .button { - padding: 0 10px 1px; - min-height: 24px; - line-height: 22px; - font-size: 13px; - } - - .media-frame.mode-grid .bulk-select .button { - margin-bottom: 0; - } - - /* Publish Metabox Options */ - .wp-core-ui .save-post-status.button { - position: relative; - margin: 0 14px 0 10px; /* 14px right margin to match all other buttons */ - } - - /* Reset responsive styles in Press This, Customizer */ - - .wp-core-ui.wp-customizer .button { - font-size: 13px; - line-height: 2.15384615; /* 28px */ - min-height: 30px; - margin: 0; - vertical-align: inherit; - } - - .media-modal-content .media-toolbar-primary .media-button { - margin-top: 10px; - margin-left: 5px; - } - - /* Reset responsive styles on Log in button on iframed login form */ - - .interim-login .button.button-large { - min-height: 30px; - line-height: 2; - padding: 0 12px 2px; - } - -} -/*------------------------------------------------------------------------------ - Interim login dialog -------------------------------------------------------------------------------*/ - -#wp-auth-check-wrap.hidden { - display: none; -} - -#wp-auth-check-wrap #wp-auth-check-bg { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - background: #000; - opacity: 0.7; - filter: alpha(opacity=70); - z-index: 1000010; /* needs to appear above .notification-dialog */ -} - -#wp-auth-check-wrap #wp-auth-check { - position: fixed; - left: 50%; - overflow: hidden; - top: 40px; - bottom: 20px; - max-height: 415px; - width: 380px; - margin: 0 0 0 -190px; - padding: 30px 0 0; - background-color: #f0f0f1; - z-index: 1000011; /* needs to appear above #wp-auth-check-bg */ - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); -} - -@media screen and (max-width: 380px) { - #wp-auth-check-wrap #wp-auth-check { - left: 0; - width: 100%; - margin: 0; - } -} - -#wp-auth-check-wrap.fallback #wp-auth-check { - max-height: 180px; - overflow: auto; -} - -#wp-auth-check-wrap #wp-auth-check-form { - height: 100%; - position: relative; - overflow: auto; - -webkit-overflow-scrolling: touch; -} - -#wp-auth-check-form.loading:before { - content: ""; - display: block; - width: 20px; - height: 20px; - position: absolute; - left: 50%; - top: 50%; - margin: -10px 0 0 -10px; - background: url(../images/spinner.gif) no-repeat center; - background-size: 20px 20px; - transform: translateZ(0); -} - -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - - #wp-auth-check-form.loading:before { - background-image: url(../images/spinner-2x.gif); - } - -} - -#wp-auth-check-wrap #wp-auth-check-form iframe { - height: 98%; /* Scrollbar fix */ - width: 100%; -} - -#wp-auth-check-wrap .wp-auth-check-close { - position: absolute; - top: 5px; - right: 5px; - height: 22px; - width: 22px; - color: #787c82; - text-decoration: none; - text-align: center; -} - -#wp-auth-check-wrap .wp-auth-check-close:before { - content: "\f158"; - font: normal 20px/22px dashicons; - speak: never; - -webkit-font-smoothing: antialiased !important; - -moz-osx-font-smoothing: grayscale; -} - -#wp-auth-check-wrap .wp-auth-check-close:hover, -#wp-auth-check-wrap .wp-auth-check-close:focus { - color: #2271b1; -} - -#wp-auth-check-wrap .wp-auth-fallback-expired { - outline: 0; -} - -#wp-auth-check-wrap .wp-auth-fallback { - font-size: 14px; - line-height: 1.5; - padding: 0 25px; - display: none; -} - -#wp-auth-check-wrap.fallback .wp-auth-fallback, -#wp-auth-check-wrap.fallback .wp-auth-check-close { - display: block; -} -/*! This file is auto-generated */ -/** - * Base Styles - */ -.media-modal * { - box-sizing: content-box; -} - -.media-modal input, -.media-modal select, -.media-modal textarea { - box-sizing: border-box; -} - -.media-modal, -.media-frame { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 12px; - -webkit-overflow-scrolling: touch; -} - -.media-modal legend { - padding: 0; - font-size: 13px; -} - -.media-modal label { - font-size: 13px; -} - -.media-modal .legend-inline { - position: absolute; - transform: translate(100%, 50%); - margin-right: -1%; - line-height: 1.2; -} - -.media-frame a { - border-bottom: none; - color: #2271b1; -} - -.media-frame a:hover, -.media-frame a:active { - color: #135e96; -} - -.media-frame a:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-frame a.button { - color: #2c3338; -} - -.media-frame a.button:hover { - color: #1d2327; -} - -.media-frame a.button-primary, -.media-frame a.button-primary:hover { - color: #fff; -} - -.media-frame input, -.media-frame textarea { - padding: 6px 8px; -} - -.media-frame select, -.wp-admin .media-frame select { - min-height: 30px; - vertical-align: middle; -} - -.media-frame input[type="text"], -.media-frame input[type="password"], -.media-frame input[type="color"], -.media-frame input[type="date"], -.media-frame input[type="datetime"], -.media-frame input[type="datetime-local"], -.media-frame input[type="email"], -.media-frame input[type="month"], -.media-frame input[type="number"], -.media-frame input[type="search"], -.media-frame input[type="tel"], -.media-frame input[type="time"], -.media-frame input[type="url"], -.media-frame input[type="week"], -.media-frame textarea, -.media-frame select { - box-shadow: 0 0 0 transparent; - border-radius: 4px; - border: 1px solid #8c8f94; - background-color: #fff; - color: #2c3338; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.media-frame input[type="text"], -.media-frame input[type="password"], -.media-frame input[type="date"], -.media-frame input[type="datetime"], -.media-frame input[type="datetime-local"], -.media-frame input[type="email"], -.media-frame input[type="month"], -.media-frame input[type="number"], -.media-frame input[type="search"], -.media-frame input[type="tel"], -.media-frame input[type="time"], -.media-frame input[type="url"], -.media-frame input[type="week"] { - padding: 0 8px; - /* inherits font size 13px */ - line-height: 2.15384615; /* 28px */ -} - -/* Search field in the Media Library toolbar */ -.media-frame.mode-grid .wp-filter input[type="search"] { - font-size: 14px; - line-height: 2; -} - -.media-frame input[type="text"]:focus, -.media-frame input[type="password"]:focus, -.media-frame input[type="number"]:focus, -.media-frame input[type="search"]:focus, -.media-frame input[type="email"]:focus, -.media-frame input[type="url"]:focus, -.media-frame textarea:focus, -.media-frame select:focus { - border-color: #3582c4; - box-shadow: 0 0 0 1px #3582c4; - outline: 2px solid transparent; -} - -.media-frame input:disabled, -.media-frame textarea:disabled, -.media-frame input[readonly], -.media-frame textarea[readonly] { - background-color: #f0f0f1; -} - -.media-frame input[type="search"] { - -webkit-appearance: textfield; -} - -.media-frame ::-webkit-input-placeholder { - color: #646970; -} - -.media-frame ::-moz-placeholder { - color: #646970; - opacity: 1; -} - -.media-frame :-ms-input-placeholder { - color: #646970; -} - -/* - * In some cases there's the need of higher specificity, - * for example higher than `.media-embed .setting`. - */ -.media-frame .hidden, -.media-frame .setting.hidden { - display: none; -} - -/*! - * jQuery UI Draggable/Sortable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ -.ui-draggable-handle, -.ui-sortable-handle { - touch-action: none; -} - -/** - * Modal - */ -.media-modal { - position: fixed; - top: 30px; - right: 30px; - left: 30px; - bottom: 30px; - z-index: 160000; -} - -.wp-customizer .media-modal { - z-index: 560000; -} - -.media-modal-backdrop { - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - z-index: 159900; -} - -.wp-customizer .media-modal-backdrop { - z-index: 559900; -} - -.media-modal-close { - position: absolute; - top: 0; - left: 0; - width: 50px; - height: 50px; - margin: 0; - padding: 0; - border: 1px solid transparent; - background: none; - color: #646970; - z-index: 1000; - cursor: pointer; - outline: none; - transition: color .1s ease-in-out, background .1s ease-in-out; -} - -.media-modal-close:hover, -.media-modal-close:active { - color: #135e96; -} - -.media-modal-close:focus { - color: #135e96; - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.media-modal-close span.media-modal-icon { - background-image: none; -} - -.media-modal-close .media-modal-icon:before { - content: "\f158"; - font: normal 20px/1 dashicons; - speak: never; - vertical-align: middle; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.media-modal-content { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - overflow: auto; - min-height: 300px; - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7); - background: #fff; - -webkit-font-smoothing: subpixel-antialiased; -} - -.media-modal-content .media-frame select.attachment-filters { - margin-top: 32px; - margin-left: 2%; - width: 42%; - width: calc(48% - 12px); -} - -.media-modal-content .attachments-browser .search { - width: 100%; -} - -/* higher specificity */ -.wp-core-ui .media-modal-icon { - background-image: url(../images/uploader-icons.png); - background-repeat: no-repeat; -} - -/** - * Toolbar - */ -.media-toolbar { - position: absolute; - top: 0; - right: 0; - left: 0; - z-index: 100; - height: 60px; - padding: 0 16px; - border: 0 solid #dcdcde; - overflow: hidden; -} - -.media-frame-toolbar .media-toolbar { - top: auto; - bottom: -47px; - height: auto; - overflow: visible; - border-top: 1px solid #dcdcde; -} - -.media-toolbar-primary { - float: left; - height: 100%; - position: relative; -} - -.media-toolbar-secondary { - float: right; - height: 100%; -} - -.media-toolbar-primary > .media-button, -.media-toolbar-primary > .media-button-group { - margin-right: 10px; - float: right; - margin-top: 15px; -} - -.media-toolbar-secondary > .media-button, -.media-toolbar-secondary > .media-button-group { - margin-left: 10px; - margin-top: 15px; -} - -/** - * Sidebar - */ -.media-sidebar { - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 267px; - padding: 0 16px; - z-index: 75; - background: #f6f7f7; - border-right: 1px solid #dcdcde; - overflow: auto; - -webkit-overflow-scrolling: touch; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-sidebar::after { - content: ""; - display: flex; - clear: both; - height: 24px; -} - -.hide-toolbar .media-sidebar { - bottom: 0; -} - -.media-sidebar h2, -.image-details h2:not(.media-attachments-filter-heading) { - position: relative; - font-weight: 600; - text-transform: uppercase; - font-size: 12px; - color: #646970; - margin: 24px 0 8px; -} - -.media-sidebar .setting, -.attachment-details .setting { - display: block; - float: right; - width: 100%; - margin: 0 0 10px; -} - -.media-sidebar .collection-settings .setting { - margin: 1px 0; -} - -.media-sidebar .setting.has-description, -.attachment-details .setting.has-description { - margin-bottom: 5px; -} - -.media-sidebar .setting .link-to-custom { - margin: 3px 2px 0; -} - -.media-sidebar .setting span, /* Back-compat for pre-5.3 */ -.attachment-details .setting span, /* Back-compat for pre-5.3 */ -.media-sidebar .setting .name, -.media-sidebar .setting .value, -.attachment-details .setting .name { - min-width: 30%; - margin-left: 4%; - font-size: 12px; - text-align: left; - word-wrap: break-word; -} - -.media-sidebar .setting .name { - max-width: 80px; -} - -.media-sidebar .setting .value { - text-align: right; -} - -.media-sidebar .setting select { - max-width: 65%; -} - -.media-sidebar .setting input[type="checkbox"], -.media-sidebar .field input[type="checkbox"], -.media-sidebar .setting input[type="radio"], -.media-sidebar .field input[type="radio"], -.attachment-details .setting input[type="checkbox"], -.attachment-details .field input[type="checkbox"], -.attachment-details .setting input[type="radio"], -.attachment-details .field input[type="radio"] { - float: none; - margin: 8px 3px 0; - padding: 0; -} - -.media-sidebar .setting span, /* Back-compat for pre-5.3 */ -.attachment-details .setting span, /* Back-compat for pre-5.3 */ -.media-sidebar .setting .name, -.media-sidebar .setting .value, -.media-sidebar .checkbox-label-inline, -.attachment-details .setting .name, -.attachment-details .setting .value, -.compat-item label span { - float: right; - min-height: 22px; - padding-top: 8px; - line-height: 1.33333333; - font-weight: 400; - color: #646970; -} - -.media-sidebar .checkbox-label-inline { - font-size: 12px; -} - -.media-sidebar .copy-to-clipboard-container, -.attachment-details .copy-to-clipboard-container { - flex-wrap: wrap; - margin-top: 10px; - margin-right: calc( 35% - 1px ); - padding-top: 10px; -} - -/* Needs high specificity. */ -.attachment-details .attachment-info .copy-to-clipboard-container { - float: none; -} - -.media-sidebar .copy-to-clipboard-container .success, -.attachment-details .copy-to-clipboard-container .success { - padding: 0; - min-height: 0; - line-height: 2.18181818; - text-align: right; - color: #008a20; -} - -.compat-item label span { - text-align: left; -} - -.media-sidebar .setting input[type="text"], -.media-sidebar .setting input[type="password"], -.media-sidebar .setting input[type="email"], -.media-sidebar .setting input[type="number"], -.media-sidebar .setting input[type="search"], -.media-sidebar .setting input[type="tel"], -.media-sidebar .setting input[type="url"], -.media-sidebar .setting textarea, -.media-sidebar .setting .value, -.attachment-details .setting input[type="text"], -.attachment-details .setting input[type="password"], -.attachment-details .setting input[type="email"], -.attachment-details .setting input[type="number"], -.attachment-details .setting input[type="search"], -.attachment-details .setting input[type="tel"], -.attachment-details .setting input[type="url"], -.attachment-details .setting textarea, -.attachment-details .setting .value, -.attachment-details .setting + .description { - box-sizing: border-box; - margin: 1px; - width: 65%; - float: left; -} - -.media-sidebar .setting .value, -.attachment-details .setting .value, -.attachment-details .setting + .description { - margin: 0 1px; - text-align: right; -} - -.attachment-details .setting + .description { - clear: both; - font-size: 12px; - font-style: normal; - margin-bottom: 10px; -} - -.media-sidebar .setting textarea, -.attachment-details .setting textarea, -.compat-item .field textarea { - height: 62px; - resize: vertical; -} - -.compat-item { - float: right; - width: 100%; - overflow: hidden; -} - -.compat-item table { - width: 100%; - table-layout: fixed; - border-spacing: 0; - border: 0; -} - -.compat-item tr { - padding: 2px 0; - display: block; - overflow: hidden; -} - -.compat-item .label, -.compat-item .field { - display: block; - margin: 0; - padding: 0; -} - -.compat-item .label { - min-width: 30%; - margin-left: 4%; - float: right; - text-align: left; -} - -.compat-item .label span { - display: block; - width: 100%; -} - -.compat-item .field { - float: left; - width: 65%; - margin: 1px; -} - -.compat-item .field input[type="text"], -.compat-item .field input[type="password"], -.compat-item .field input[type="email"], -.compat-item .field input[type="number"], -.compat-item .field input[type="search"], -.compat-item .field input[type="tel"], -.compat-item .field input[type="url"], -.compat-item .field textarea { - width: 100%; - margin: 0; - box-sizing: border-box; -} - -.sidebar-for-errors .attachment-details, -.sidebar-for-errors .compat-item, -.sidebar-for-errors .media-sidebar .media-progress-bar, -.sidebar-for-errors .upload-details { - display: none !important; -} - -/** - * Menu - */ -.media-menu { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - margin: 0; - padding: 50px 0 10px; - background: #f6f7f7; - border-left-width: 1px; - border-left-style: solid; - border-left-color: #c3c4c7; - -webkit-user-select: none; - user-select: none; -} - -.media-menu .media-menu-item { - display: block; - box-sizing: border-box; - width: 100%; - position: relative; - border: 0; - margin: 0; - padding: 8px 20px; - font-size: 14px; - line-height: 1.28571428; - background: transparent; - color: #2271b1; - text-align: right; - text-decoration: none; - cursor: pointer; -} - -.media-menu .media-menu-item:hover { - background: rgba(0, 0, 0, 0.04); -} - -.media-menu .media-menu-item:active { - color: #2271b1; - outline: none; -} - -.media-menu .active, -.media-menu .active:hover { - color: #1d2327; - font-weight: 600; -} - -.media-menu .media-menu-item:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-menu .separator { - height: 0; - margin: 12px 20px; - padding: 0; - border-top: 1px solid #dcdcde; -} - -/** - * Menu - */ -.media-router { - position: relative; - padding: 0 6px; - margin: 0; - clear: both; -} - -.media-router .media-menu-item { - position: relative; - float: right; - border: 0; - margin: 0; - padding: 8px 10px 9px; - height: 18px; - line-height: 1.28571428; - font-size: 14px; - text-decoration: none; - background: transparent; - cursor: pointer; - transition: none; -} - -.media-router .media-menu-item:last-child { - border-left: 0; -} - -.media-router .media-menu-item:hover, -.media-router .media-menu-item:active { - color: #2271b1; -} - -.media-router .active, -.media-router .active:hover { - color: #1d2327; -} - -.media-router .media-menu-item:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-router .active, -.media-router .media-menu-item.active:last-child { - margin: -1px -1px 0; - background: #fff; - border: 1px solid #dcdcde; - border-bottom: none; -} - -.media-router .active:after { - display: none; -} - -/** - * Frame - */ -.media-frame { - overflow: hidden; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; -} - -.media-frame-menu { - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 200px; - z-index: 150; -} - -.media-frame-title { - position: absolute; - top: 0; - right: 200px; - left: 0; - height: 50px; - z-index: 200; -} - -.media-frame-router { - position: absolute; - top: 50px; - right: 200px; - left: 0; - height: 36px; - z-index: 200; -} - -.media-frame-content { - position: absolute; - top: 84px; - right: 200px; - left: 0; - bottom: 61px; - height: auto; - width: auto; - margin: 0; - overflow: auto; - background: #fff; - border-top: 1px solid #dcdcde; -} - -.media-frame-toolbar { - position: absolute; - right: 200px; - left: 0; - z-index: 100; - bottom: 60px; - height: auto; -} - -.media-frame.hide-menu .media-frame-title, -.media-frame.hide-menu .media-frame-router, -.media-frame.hide-menu .media-frame-toolbar, -.media-frame.hide-menu .media-frame-content { - right: 0; -} - -.media-frame.hide-toolbar .media-frame-content { - bottom: 0; -} - -.media-frame.hide-router .media-frame-content { - top: 50px; -} - -.media-frame.hide-menu .media-frame-menu, -.media-frame.hide-menu .media-frame-menu-heading, -.media-frame.hide-router .media-frame-router, -.media-frame.hide-toolbar .media-frame-toolbar { - display: none; -} - -.media-frame-title h1 { - padding: 0 16px; - font-size: 22px; - line-height: 2.27272727; - margin: 0; -} - -.media-frame-menu-heading, -.media-attachments-filter-heading { - position: absolute; - right: 20px; - top: 22px; - margin: 0; - font-size: 13px; - line-height: 1; - /* Above the media-frame-menu. */ - z-index: 151; -} - -.media-attachments-filter-heading { - top: 10px; - right: 16px; -} - -.mode-grid .media-attachments-filter-heading { - top: 0; - right: -9999px; -} - -.mode-grid .media-frame-actions-heading { - display: none; -} - -.wp-core-ui .button.media-frame-menu-toggle { - display: none; -} - -.media-frame-title .suggested-dimensions { - font-size: 14px; - float: left; - margin-left: 20px; -} - -.media-frame-content .crop-content { - height: 100%; -} - -.wp-customizer:not(.mobile) .media-frame-content .crop-content.site-icon { - margin-left: 300px; -} - -.media-frame-content .crop-content .crop-image { - display: block; - margin: auto; - max-width: 100%; - max-height: 100%; -} - -.media-frame-content .crop-content .upload-errors { - position: absolute; - width: 300px; - top: 50%; - right: 50%; - margin-right: -150px; - margin-left: -150px; - z-index: 600000; -} - -/** - * Iframes - */ -.media-frame .media-iframe { - overflow: hidden; -} - -.media-frame .media-iframe, -.media-frame .media-iframe iframe { - height: 100%; - width: 100%; - border: 0; -} - -/** - * Attachment Browser Filters - */ -.media-frame select.attachment-filters { - margin-top: 11px; - margin-left: 2%; - max-width: 42%; - max-width: calc(48% - 12px); -} - -.media-frame select.attachment-filters:last-of-type { - margin-left: 0; - width: auto; - max-width: 100%; -} - -/** - * Search - */ -.media-frame .search { - margin: 32px 0 0; - padding: 4px; - font-size: 13px; - color: #3c434a; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - -webkit-appearance: none; -} - -.media-toolbar-primary .search { - max-width: 100%; -} - -.media-frame .media-search-input-label { - position: absolute; - right: 0; - top: 10px; - margin: 0; - line-height: 1; -} - -/** - * Attachments - */ -.wp-core-ui .attachments { - margin: 0; - -webkit-overflow-scrolling: touch; -} - -/** - * Attachment - */ -.wp-core-ui .attachment { - position: relative; - float: right; - padding: 8px; - margin: 0; - color: #3c434a; - cursor: pointer; - list-style: none; - text-align: center; - -webkit-user-select: none; - user-select: none; - width: 25%; - box-sizing: border-box; -} - -.wp-core-ui .attachment:focus, -.wp-core-ui .selected.attachment:focus, -.wp-core-ui .attachment.details:focus { - box-shadow: - inset 0 0 2px 3px #fff, - inset 0 0 0 7px #4f94d4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -6px; -} - -.wp-core-ui .selected.attachment { - box-shadow: - inset 0 0 0 5px #fff, - inset 0 0 0 7px #c3c4c7; -} - -.wp-core-ui .attachment.details { - box-shadow: - inset 0 0 0 3px #fff, - inset 0 0 0 7px #2271b1; -} - -.wp-core-ui .attachment-preview { - position: relative; - box-shadow: - inset 0 0 15px rgba(0, 0, 0, 0.1), - inset 0 0 0 1px rgba(0, 0, 0, 0.05); - background: #f0f0f1; - cursor: pointer; -} - -.wp-core-ui .attachment-preview:before { - content: ""; - display: block; - padding-top: 100%; -} - -.wp-core-ui .attachment .icon { - margin: 0 auto; - overflow: hidden; -} - -.wp-core-ui .attachment .thumbnail { - overflow: hidden; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - opacity: 1; - transition: opacity .1s; -} - -.wp-core-ui .attachment .portrait img { - max-width: 100%; -} - -.wp-core-ui .attachment .landscape img { - max-height: 100%; -} - -.wp-core-ui .attachment .thumbnail:after { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); - overflow: hidden; -} - -.wp-core-ui .attachment .thumbnail img { - top: 0; - right: 0; -} - -.wp-core-ui .attachment .thumbnail .centered { - position: absolute; - top: 0; - right: 0; - width: 100%; - height: 100%; - transform: translate( -50%, 50% ); -} - -.wp-core-ui .attachment .thumbnail .centered img { - transform: translate( 50%, -50% ); -} - -.wp-core-ui .attachments-browser .attachment .thumbnail .centered img.icon { - transform: translate( 50%, -70% ); -} - -.wp-core-ui .attachment .filename { - position: absolute; - right: 0; - left: 0; - bottom: 0; - overflow: hidden; - max-height: 100%; - word-wrap: break-word; - text-align: center; - font-weight: 600; - background: rgba(255, 255, 255, 0.8); - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); -} - -.wp-core-ui .attachment .filename div { - padding: 5px 10px; -} - -.wp-core-ui .attachment .thumbnail img { - position: absolute; -} - -.wp-core-ui .attachment-close { - display: block; - position: absolute; - top: 5px; - left: 5px; - height: 22px; - width: 22px; - padding: 0; - background-color: #fff; - background-position: -96px 4px; - border-radius: 3px; - box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); - transition: none; -} - -.wp-core-ui .attachment-close:hover, -.wp-core-ui .attachment-close:focus { - background-position: -36px 4px; -} - -.wp-core-ui .attachment .check { - display: none; - height: 24px; - width: 24px; - padding: 0; - border: 0; - position: absolute; - z-index: 10; - top: 0; - left: 0; - outline: none; - background: #f0f0f1; - cursor: pointer; - box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 0, 0, 0.15); -} - -.wp-core-ui .attachment .check .media-modal-icon { - display: block; - background-position: -1px 0; - height: 15px; - width: 15px; - margin: 5px; -} - -.wp-core-ui .attachment .check:hover .media-modal-icon { - background-position: -40px 0; -} - -.wp-core-ui .attachment.selected .check { - display: block; -} - -.wp-core-ui .attachment.details .check, -.wp-core-ui .attachment.selected .check:focus, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check { - background-color: #2271b1; - box-shadow: - 0 0 0 1px #fff, - 0 0 0 2px #2271b1; -} - -.wp-core-ui .attachment.selected .check:focus { - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui .attachment.details .check .media-modal-icon, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check .media-modal-icon { - background-position: -21px 0; -} - -.wp-core-ui .attachment.details .check:hover .media-modal-icon, -.wp-core-ui .attachment.selected .check:focus .media-modal-icon, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check:hover .media-modal-icon { - background-position: -60px 0; -} - -.wp-core-ui .media-frame .attachment .describe { - position: relative; - display: block; - width: 100%; - margin: 0; - padding: 0 8px; - font-size: 12px; - border-radius: 0; -} - -/** - * Attachments Browser - */ -.media-frame .attachments-browser { - position: relative; - width: 100%; - height: 100%; - overflow: hidden; -} - -.attachments-browser .media-toolbar { - left: 300px; - height: 72px; - background: #fff; -} - -.attachments-browser.hide-sidebar .media-toolbar { - left: 0; -} - -.attachments-browser .media-toolbar-primary > .media-button, -.attachments-browser .media-toolbar-primary > .media-button-group, -.attachments-browser .media-toolbar-secondary > .media-button, -.attachments-browser .media-toolbar-secondary > .media-button-group { - margin: 10px 0; -} - -.attachments-browser .attachments { - padding: 2px 8px 8px; -} - -.attachments-browser:not(.has-load-more) .attachments, -.attachments-browser.has-load-more .attachments-wrapper, -.attachments-browser .uploader-inline { - position: absolute; - top: 72px; - right: 0; - left: 300px; - bottom: 0; - overflow: auto; - outline: none; -} - -.attachments-browser .uploader-inline.hidden { - display: none; -} - -.attachments-browser .media-toolbar-primary { - max-width: 33%; -} - -.mode-grid .attachments-browser .media-toolbar-primary { - display: flex; - align-items: center; -} - -.mode-grid .attachments-browser .media-toolbar-mode-select .media-toolbar-primary { - display: none; -} - -.attachments-browser .media-toolbar-secondary { - max-width: 66%; -} - -.uploader-inline .close { - background-color: transparent; - border: 0; - cursor: pointer; - height: 48px; - outline: none; - padding: 0; - position: absolute; - left: 2px; - text-align: center; - top: 2px; - width: 48px; - z-index: 1; -} - -.uploader-inline .close:before { - font: normal 30px/1 dashicons !important; - color: #50575e; - display: inline-block; - content: "\f335"; - font-weight: 300; - margin-top: 1px; -} - -.uploader-inline .close:focus { - outline: 1px solid #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.attachments-browser.hide-sidebar .attachments, -.attachments-browser.hide-sidebar .uploader-inline { - left: 0; - margin-left: 0; -} - -.attachments-browser .instructions { - display: inline-block; - margin-top: 16px; - line-height: 1.38461538; - font-size: 13px; - color: #646970; -} - -.attachments-browser .no-media { - padding: 2em 2em 0 0; -} - -.more-loaded .attachment:not(.found-media) { - background: #dcdcde; -} - -.load-more-wrapper { - clear: both; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - padding: 1em 0; -} - -.load-more-wrapper .load-more-count { - min-width: 100%; - margin: 0 0 1em; - text-align: center; -} - -.load-more-wrapper .load-more { - margin: 0; -} - -/* Needs high specificity. */ -.media-frame .load-more-wrapper .load-more + .spinner { - float: none; - margin: 0 10px 0 -30px; -} - -/* Reset spinner margin when the button is hidden to avoid horizontal scrollbar. */ -.media-frame .load-more-wrapper .load-more.hidden + .spinner { - margin: 0; -} - -/* Force a new row within the flex container. */ -.load-more-wrapper::after { - content: ""; - min-width: 100%; - order: 1; -} - -.load-more-wrapper .load-more-jump { - margin: 0 12px 0 0; -} - -.attachment.new-media { - outline: 2px dotted #c3c4c7; -} - -.load-more-wrapper { - clear: both; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - padding: 1em 0; -} - -.load-more-wrapper .load-more-count { - min-width: 100%; - margin: 0 0 1em; - text-align: center; -} - -.load-more-wrapper .load-more { - margin: 0; -} - -/* Needs high specificity. */ -.media-frame .load-more-wrapper .load-more + .spinner { - float: none; - margin: 0 10px 0 -30px; -} - -/* Reset spinner margin when the button is hidden to avoid horizontal scrollbar. */ -.media-frame .load-more-wrapper .load-more.hidden + .spinner { - margin: 0; -} - -/* Force a new row within the flex container. */ -.load-more-wrapper::after { - content: ""; - min-width: 100%; - order: 1; -} - -.load-more-wrapper .load-more-jump { - margin: 0 12px 0 0; -} - -/** - * Progress Bar - */ -.media-progress-bar { - position: relative; - height: 10px; - width: 70%; - margin: 10px auto; - border-radius: 10px; - background: #dcdcde; - background: rgba(0, 0, 0, 0.1); -} - -.media-progress-bar div { - height: 10px; - min-width: 20px; - width: 0; - background: #2271b1; - border-radius: 10px; - transition: width 300ms; -} - -.media-uploader-status .media-progress-bar { - display: none; - width: 100%; -} - -.uploading.media-uploader-status .media-progress-bar { - display: block; -} - -.attachment-preview .media-progress-bar { - position: absolute; - top: 50%; - right: 15%; - width: 70%; - margin: -5px 0 0; -} - -.media-uploader-status { - position: relative; - margin: 0 auto; - padding-bottom: 10px; - max-width: 400px; -} - -.uploader-inline .media-uploader-status h2 { - display: none; -} - -.media-uploader-status .upload-details { - display: none; - font-size: 12px; - color: #646970; -} - -.uploading.media-uploader-status .upload-details { - display: block; -} - -.media-uploader-status .upload-detail-separator { - padding: 0 4px; -} - -.media-uploader-status .upload-count { - color: #3c434a; -} - -.media-uploader-status .upload-dismiss-errors, -.media-uploader-status .upload-errors { - display: none; -} - -.errors.media-uploader-status .upload-dismiss-errors, -.errors.media-uploader-status .upload-errors { - display: block; -} - -.media-uploader-status .upload-dismiss-errors { - transition: none; - text-decoration: none; -} - -.upload-errors .upload-error { - padding: 12px; - margin-bottom: 12px; - background: #fff; - border-right: 4px solid #d63638; - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); -} - -.uploader-inline .upload-errors .upload-error { - padding: 12px 30px; - background-color: #fcf0f1; - box-shadow: none; -} - -.upload-errors .upload-error-filename { - font-weight: 600; -} - -.upload-errors .upload-error-message { - display: block; - padding-top: 8px; - word-wrap: break-word; -} - -/** - * Window and Editor uploaders used to display "drop zones" - */ -.uploader-window, -.wp-editor-wrap .uploader-editor { - top: 0; - right: 0; - left: 0; - bottom: 0; - text-align: center; - display: none; -} - -.uploader-window { - position: fixed; - z-index: 250000; - opacity: 0; /* Only the inline uploader is animated with JS, the editor one isn't */ - transition: opacity 250ms; -} - -.wp-editor-wrap .uploader-editor { - position: absolute; - z-index: 99998; /* under the toolbar */ - background: rgba(140, 143, 148, 0.9); -} - -.uploader-window, -.wp-editor-wrap .uploader-editor.droppable { - background: rgba(10, 75, 120, 0.9); -} - -.uploader-window-content, -.wp-editor-wrap .uploader-editor-content { - position: absolute; - top: 10px; - right: 10px; - left: 10px; - bottom: 10px; - border: 1px dashed #fff; -} - -/* uploader drop-zone title */ -.uploader-window h1, /* Back-compat for pre-5.3 */ -.uploader-window .uploader-editor-title, -.wp-editor-wrap .uploader-editor .uploader-editor-title { - position: absolute; - top: 50%; - right: 0; - left: 0; - transform: translateY(-50%); - font-size: 3em; - line-height: 1.3; - font-weight: 600; - color: #fff; - margin: 0; - padding: 0 10px; -} - -.wp-editor-wrap .uploader-editor .uploader-editor-title { - display: none; -} - -.wp-editor-wrap .uploader-editor.droppable .uploader-editor-title { - display: block; -} - -.uploader-window .media-progress-bar { - margin-top: 20px; - max-width: 300px; - background: transparent; - border-color: #fff; - display: none; -} - -.uploader-window .media-progress-bar div { - background: #fff; -} - -.uploading .uploader-window .media-progress-bar { - display: block; -} - -.media-frame .uploader-inline { - margin-bottom: 20px; - padding: 0; - text-align: center; -} - -.uploader-inline-content { - position: absolute; - top: 30%; - right: 0; - left: 0; -} - -.uploader-inline-content .upload-ui { - margin: 2em 0; -} - -.uploader-inline-content .post-upload-ui { - margin-bottom: 2em; -} - -.uploader-inline .has-upload-message .upload-ui { - margin: 0 0 4em; -} - -.uploader-inline h2 { - font-size: 20px; - line-height: 1.4; - font-weight: 400; - margin: 0; -} - -.uploader-inline .has-upload-message .upload-instructions { - font-size: 14px; - color: #3c434a; - font-weight: 400; -} - -.uploader-inline .drop-instructions { - display: none; -} - -.supports-drag-drop .uploader-inline .drop-instructions { - display: block; -} - -.uploader-inline p { - margin: 0.5em 0; -} - -.uploader-inline .media-progress-bar { - display: none; -} - -.uploading.uploader-inline .media-progress-bar { - display: block; -} - -.uploader-inline .browser { - display: inline-block !important; -} - -/** - * Selection - */ -.media-selection { - position: absolute; - top: 0; - right: 0; - left: 350px; - height: 60px; - padding: 0 16px 0 0; - overflow: hidden; - white-space: nowrap; -} - -.media-selection .selection-info { - display: inline-block; - font-size: 12px; - height: 60px; - margin-left: 10px; - vertical-align: top; -} - -.media-selection.empty, -.media-selection.editing { - display: none; -} - -.media-selection.one .edit-selection { - display: none; -} - -.media-selection .count { - display: block; - padding-top: 12px; - font-size: 14px; - line-height: 1.42857142; - font-weight: 600; -} - -.media-selection .button-link { - float: right; - padding: 1px 8px; - margin: 1px -8px 1px 8px; - line-height: 1.4; - border-left: 1px solid #dcdcde; - color: #2271b1; - text-decoration: none; -} - -.media-selection .button-link:hover, -.media-selection .button-link:focus { - color: #135e96; -} - -.media-selection .button-link:last-child { - border-left: 0; - margin-left: 0; -} - -.selection-info .clear-selection { - color: #d63638; -} - -.selection-info .clear-selection:hover, -.selection-info .clear-selection:focus { - color: #d63638; -} - -.media-selection .selection-view { - display: inline-block; - vertical-align: top; -} - -.media-selection .attachments { - display: inline-block; - height: 48px; - margin: 6px; - padding: 0; - overflow: hidden; - vertical-align: top; -} - -.media-selection .attachment { - width: 40px; - padding: 0; - margin: 4px; -} - -.media-selection .attachment .thumbnail { - top: 0; - left: 0; - bottom: 0; - right: 0; -} - -.media-selection .attachment .icon { - width: 50%; -} - -.media-selection .attachment-preview { - box-shadow: none; - background: none; -} - -.wp-core-ui .media-selection .attachment:focus, -.wp-core-ui .media-selection .selected.attachment:focus, -.wp-core-ui .media-selection .attachment.details:focus { - box-shadow: - 0 0 0 1px #fff, - 0 0 2px 3px #4f94d4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui .media-selection .selected.attachment { - box-shadow: none; -} - -.wp-core-ui .media-selection .attachment.details { - box-shadow: - 0 0 0 1px #fff, - 0 0 0 3px #2271b1; -} - -.media-selection:after { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 25px; - background-image: linear-gradient(to right,#fff,rgba(255, 255, 255, 0)); -} - -.media-selection .attachment .filename { - display: none; -} - -/** - * Spinner - */ -.media-frame .spinner { - background: url(../images/spinner.gif) no-repeat; - background-size: 20px 20px; - float: left; - display: inline-block; - visibility: hidden; - opacity: 0.7; - filter: alpha(opacity=70); - width: 20px; - height: 20px; - margin: 0; - vertical-align: middle; -} - -.media-frame.mode-grid .spinner { - margin: 0; - float: none; - vertical-align: middle; -} - -.media-modal .media-toolbar .spinner { - float: none; - vertical-align: bottom; - margin: 0 5px 5px 0; -} - -.media-frame .instructions + .spinner.is-active { - vertical-align: middle; -} - -.media-frame .spinner.is-active { - visibility: visible; -} - -/** - * Attachment Details - */ -.attachment-details { - position: relative; - overflow: auto; -} - -.attachment-details .settings-save-status { - float: left; - text-transform: none; - font-weight: 400; -} - -.attachment-details .settings-save-status .spinner { - float: none; - margin-right: 5px; -} - -.attachment-details .settings-save-status .saved { - display: none; -} - -.attachment-details.save-waiting .settings-save-status .spinner { - visibility: visible; -} - -.attachment-details.save-complete .settings-save-status .saved { - display: inline-block; -} - -.attachment-info { - overflow: hidden; - min-height: 60px; - margin-bottom: 16px; - line-height: 1.5; - color: #646970; - border-bottom: 1px solid #dcdcde; - padding-bottom: 11px; -} - -.attachment-info .wp-media-wrapper { - margin-bottom: 8px; -} - -.attachment-info .wp-media-wrapper.wp-audio { - margin-top: 13px; -} - -.attachment-info .filename { - font-weight: 600; - color: #3c434a; - word-wrap: break-word; -} - -.attachment-info .thumbnail { - position: relative; - float: right; - max-width: 120px; - max-height: 120px; - margin-top: 5px; - margin-left: 10px; - margin-bottom: 5px; -} - -.uploading .attachment-info .thumbnail { - width: 120px; - height: 80px; - box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1); -} - -.uploading .attachment-info .media-progress-bar { - margin-top: 35px; -} - -.attachment-info .thumbnail-image:after { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); - overflow: hidden; -} - -.attachment-info .thumbnail img { - display: block; - max-width: 120px; - max-height: 120px; - margin: 0 auto; -} - -.attachment-info .details { - float: right; - font-size: 12px; - max-width: 100%; -} - -.attachment-info .edit-attachment, -.attachment-info .delete-attachment, -.attachment-info .trash-attachment, -.attachment-info .untrash-attachment { - display: block; - text-decoration: none; - white-space: nowrap; -} - -.attachment-details.needs-refresh .attachment-info .edit-attachment { - display: none; -} - -.attachment-info .edit-attachment { - display: block; -} - -.media-modal .delete-attachment, -.media-modal .trash-attachment, -.media-modal .untrash-attachment { - display: inline; - padding: 0; - color: #d63638; -} - -.media-modal .delete-attachment:hover, -.media-modal .delete-attachment:focus, -.media-modal .trash-attachment:hover, -.media-modal .trash-attachment:focus, -.media-modal .untrash-attachment:hover, -.media-modal .untrash-attachment:focus { - color: #d63638; -} - -/** - * Attachment Display Settings - */ -.attachment-display-settings { - width: 100%; - float: right; - overflow: hidden; -} - -.collection-settings { - overflow: hidden; -} - -.collection-settings .setting input[type="checkbox"] { - float: right; - margin-left: 8px; -} - -.collection-settings .setting span, /* Back-compat for pre-5.3 */ -.collection-settings .setting .name { - min-width: inherit; -} - -/** - * Image Editor - */ -.media-modal .imgedit-wrap { - position: static; -} - -.media-modal .imgedit-wrap .imgedit-panel-content { - padding: 16px 16px 0; - position: absolute; - top: 0; - left: 282px; - bottom: 0; - right: 0; - overflow: auto; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-modal .imgedit-wrap .imgedit-submit { - margin-bottom: 16px; -} - -.media-modal .imgedit-wrap .imgedit-settings { - background: #f6f7f7; - border-right: 1px solid #dcdcde; - padding: 20px 16px 0; - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 250px; - overflow: auto; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-modal .imgedit-wrap .imgedit-save-target { - margin: 8px 0 24px; -} - -.media-modal .imgedit-group { - background: none; - border: none; - border-bottom: 1px solid #dcdcde; - box-shadow: none; - margin: 0; - margin-bottom: 16px; - padding: 0; - padding-bottom: 16px; - position: relative; /* RTL fix, #WP29352 */ -} - -.media-modal .imgedit-group:last-of-type { - border: none; - margin: 0; - padding: 0; -} - -.media-modal .imgedit-group-top { - margin: 0; -} - -.media-modal .imgedit-group-top h2, -.media-modal .imgedit-group-top h2 .button-link { - display: inline-block; - text-transform: uppercase; - font-size: 12px; - color: #646970; - margin: 0; - margin-top: 3px; -} - -.media-modal .imgedit-group-top h2 a, -.media-modal .imgedit-group-top h2 .button-link { - text-decoration: none; - color: #646970; -} - -/* higher specificity than media.css */ -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle, -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:hover, -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:active { - border: 1px solid transparent; - margin: 0; - padding: 0; - background: transparent; - color: #2271b1; - font-size: 20px; - line-height: 1; - cursor: pointer; - box-sizing: content-box; - box-shadow: none; -} - -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:focus { - color: #2271b1; - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui.media-modal .imgedit-group-top .dashicons-arrow-down.imgedit-help-toggle { - margin-top: -3px; -} - -.wp-core-ui.media-modal .image-editor h3 .imgedit-help-toggle { - margin-top: -2px; -} - -.media-modal .imgedit-help-toggled span.dashicons:before { - content: "\f142"; -} - -.media-modal .imgedit-thumbnail-preview { - margin: 10px 0 0 8px; -} - -.imgedit-thumbnail-preview-caption { - display: block; -} - -.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */ -.media-modal .imgedit-wrap .notice { - margin: 0; - margin-bottom: 16px; -} - -/** - * Embed from URL and Image Details - */ -.embed-url { - display: block; - position: relative; - padding: 16px; - margin: 0; - z-index: 250; - background: #fff; - font-size: 18px; -} - -.media-frame .embed-url input { - font-size: 18px; - line-height: 1.22222222; /* 22px */ - padding: 12px 14px 12px 40px; /* right padding to leave room for the spinner */ - width: 100%; - min-width: 200px; - box-shadow: inset -2px 2px 4px -2px rgba(0, 0, 0, 0.1); -} - -.media-frame .embed-url input::-ms-clear { - display: none; /* the "x" in IE 11 conflicts with the spinner */ -} - -.media-frame .embed-url .spinner { - position: absolute; - top: 32px; - left: 26px; -} - -.media-frame .embed-loading .embed-url .spinner { - visibility: visible; -} - -.embed-link-settings, -.embed-media-settings { - position: absolute; - top: 82px; - right: 0; - left: 0; - bottom: 0; - padding: 0 16px; - overflow: auto; -} - -.media-embed .embed-link-settings .link-text { - margin-top: 0; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.embed-link-settings::after, -.embed-media-settings::after { - content: ""; - display: flex; - clear: both; - height: 24px; -} - -.media-embed .embed-link-settings { - /* avoid Firefox to give focus to the embed preview container parent */ - overflow: visible; -} - -.embed-preview img, -.embed-preview iframe, -.embed-preview embed, -.mejs-container video { - max-width: 100%; - vertical-align: middle; -} - -.embed-preview a { - display: inline-block; -} - -.embed-preview img { - display: block; - height: auto; -} - -.mejs-container:focus { - outline: 1px solid #4f94d4; - box-shadow: 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -.image-details .media-modal { - right: 140px; - left: 140px; -} - -.image-details .media-frame-title, -.image-details .media-frame-content, -.image-details .media-frame-router { - right: 0; -} - -.image-details .embed-media-settings { - top: 0; - overflow: visible; - padding: 0; -} - -.image-details .embed-media-settings::after { - content: none; -} - -.image-details .embed-media-settings, -.image-details .embed-media-settings div { - box-sizing: border-box; -} - -.image-details .column-settings { - background: #f6f7f7; - border-left: 1px solid #dcdcde; - min-height: 100%; - width: 55%; - position: absolute; - top: 0; - right: 0; -} - -.image-details .column-settings h2 { - margin: 20px; - padding-top: 20px; - border-top: 1px solid #dcdcde; - color: #1d2327; -} - -.image-details .column-image { - width: 45%; - position: absolute; - right: 55%; - top: 0; -} - -.image-details .image { - margin: 20px; -} - -.image-details .image img { - max-width: 100%; - max-height: 500px; -} - -.image-details .advanced-toggle { - padding: 0; - color: #646970; - text-transform: uppercase; - text-decoration: none; -} - -.image-details .advanced-toggle:hover, -.image-details .advanced-toggle:active { - color: #646970; -} - -.image-details .advanced-toggle:after { - font: normal 20px/1 dashicons; - speak: never; - vertical-align: top; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - content: "\f140"; - display: inline-block; - margin-top: -2px; -} - -.image-details .advanced-visible .advanced-toggle:after { - content: "\f142"; -} - -.image-details .custom-size label, /* Back-compat for pre-5.3 */ -.image-details .custom-size .custom-size-setting { - display: block; - float: right; -} - -.image-details .custom-size .custom-size-setting label { - float: none; -} - -.image-details .custom-size input { - width: 5em; -} - -.image-details .custom-size .sep { - float: right; - margin: 26px 6px 0; -} - -.image-details .custom-size .description { - margin-right: 0; -} - -.media-embed .thumbnail { - max-width: 100%; - max-height: 200px; - position: relative; - float: right; -} - -.media-embed .thumbnail img { - max-height: 200px; - display: block; -} - -.media-embed .thumbnail:after { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); - overflow: hidden; -} - -.media-embed .setting, -.media-embed .setting-group { - width: 100%; - margin: 10px 0; - float: right; - display: block; - clear: both; -} - -.media-embed .setting-group .setting:not(.checkbox-setting) { - margin: 0; -} - -.media-embed .setting.has-description { - margin-bottom: 5px; -} - -.media-embed .description { - clear: both; - font-style: normal; -} - -.media-embed .content-track + .description { - line-height: 1.4; - /* The !important needs to override a high specificity selector from wp-medialement.css */ - max-width: none !important; -} - -.media-embed .remove-track { - margin-bottom: 10px; -} - -.image-details .embed-media-settings .setting, -.image-details .embed-media-settings .setting-group { - float: none; - width: auto; -} - -.image-details .actions { - margin: 10px 0; -} - -.image-details .hidden { - display: none; -} - -.media-embed .setting input[type="text"], -.media-embed .setting textarea, -.media-embed fieldset { - display: block; - width: 100%; - max-width: 400px; -} - -.image-details .embed-media-settings .setting input[type="text"], -.image-details .embed-media-settings .setting textarea { - max-width: inherit; - width: 70%; -} - -.image-details .embed-media-settings .setting input.link-to-custom, -.image-details .embed-media-settings .link-target, -.image-details .embed-media-settings .custom-size, -.image-details .embed-media-settings .setting-group, -.image-details .description { - margin-right: 27%; - width: 70%; -} - -.image-details .description { - font-style: normal; - margin-top: 0; -} - -.image-details .embed-media-settings .link-target { - margin-top: 16px; -} - -.image-details .checkbox-label, -.audio-details .checkbox-label, -.video-details .checkbox-label { - vertical-align: baseline; -} - -.media-embed .setting input.hidden, -.media-embed .setting textarea.hidden { - display: none; -} - -.media-embed .setting span, /* Back-compat for pre-5.3 */ -.media-embed .setting .name, -.media-embed .setting-group .name { - display: inline-block; - font-size: 13px; - line-height: 1.84615384; - color: #646970; -} - -.media-embed .setting span { - display: block; /* Back-compat for pre-5.3 */ - width: 200px; /* Back-compat for pre-5.3 */ -} - -.image-details .embed-media-settings .setting span, /* Back-compat for pre-5.3 */ -.image-details .embed-media-settings .setting .name { - float: right; - width: 25%; - text-align: left; - margin: 8px 1% 0; - line-height: 1.1; -} - -/* Buttons group in IE 11. */ -.media-frame .setting-group .button-group, -.image-details .embed-media-settings .setting .button-group { - width: auto; -} - -.media-embed-sidebar { - position: absolute; - top: 0; - right: 440px; -} - -.advanced-section, -.link-settings { - margin-top: 10px; -} - -/** - * Button groups fix: can be removed together with the Back-compat for pre-5.3 - */ - .media-frame .setting .button-group { - display: flex; - margin: 0 !important; - max-width: none !important; - } - -/** - * Localization - */ -.rtl .media-modal, -.rtl .media-frame, -.rtl .media-frame .search, -.rtl .media-frame input[type="text"], -.rtl .media-frame input[type="password"], -.rtl .media-frame input[type="number"], -.rtl .media-frame input[type="search"], -.rtl .media-frame input[type="email"], -.rtl .media-frame input[type="url"], -.rtl .media-frame input[type="tel"], -.rtl .media-frame textarea, -.rtl .media-frame select { - font-family: Tahoma, sans-serif; -} - -:lang(he-il) .rtl .media-modal, -:lang(he-il) .rtl .media-frame, -:lang(he-il) .rtl .media-frame .search, -:lang(he-il) .rtl .media-frame input[type="text"], -:lang(he-il) .rtl .media-frame input[type="password"], -:lang(he-il) .rtl .media-frame input[type="number"], -:lang(he-il) .rtl .media-frame input[type="search"], -:lang(he-il) .rtl .media-frame input[type="email"], -:lang(he-il) .rtl .media-frame input[type="url"], -:lang(he-il) .rtl .media-frame textarea, -:lang(he-il) .rtl .media-frame select { - font-family: Arial, sans-serif; -} - -/** - * Responsive layout - */ -@media only screen and (max-width: 900px) { - .media-modal .media-frame-title { - height: 40px; - } - - .media-modal .media-frame-title h1 { - line-height: 2.22222222; - font-size: 18px; - } - - .media-modal-close { - width: 42px; - height: 42px; - } - - /* Drop-down menu */ - .media-frame .media-frame-title { - position: static; - padding: 0 44px; - text-align: center; - } - - .media-frame:not(.hide-menu) .media-frame-router, - .media-frame:not(.hide-menu) .media-frame-content, - .media-frame:not(.hide-menu) .media-frame-toolbar { - right: 0; - } - - .media-frame:not(.hide-menu) .media-frame-router { - /* 40 title + (40 - 6) menu toggle button + 6 spacing */ - top: 80px; - } - - .media-frame:not(.hide-menu) .media-frame-content { - /* 80 + room for the tabs */ - top: 114px; - } - - .media-frame.hide-router .media-frame-content { - top: 80px; - } - - .media-frame:not(.hide-menu) .media-frame-menu { - position: static; - width: 0; - } - - .media-frame:not(.hide-menu) .media-menu { - display: none; - width: auto; - max-width: 80%; - overflow: auto; - z-index: 2000; - top: 75px; - right: 50%; - transform: translateX(50%); - left: auto; - bottom: auto; - padding: 5px 0; - border: 1px solid #c3c4c7; - } - - .media-frame:not(.hide-menu) .media-menu.visible { - display: block; - } - - .media-frame:not(.hide-menu) .media-menu > a { - padding: 12px 16px; - font-size: 16px; - } - - .media-frame:not(.hide-menu) .media-menu .separator { - margin: 5px 10px; - } - - /* Visually hide the menu heading keeping it available to assistive technologies. */ - .media-frame-menu-heading { - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - overflow: hidden; - padding: 0; - width: 1px; - word-wrap: normal !important; - } - - /* Reveal the menu toggle button. */ - .wp-core-ui .media-frame:not(.hide-menu) .button.media-frame-menu-toggle { - display: inline-flex; - align-items: center; - position: absolute; - right: 50%; - transform: translateX(50%); - margin: -6px 0 0; - padding: 0 12px 0 2px; - font-size: 0.875rem; - font-weight: 600; - text-decoration: none; - background: transparent; - /* Only for IE11 to vertically align text within the inline-flex button */ - height: 0.1%; - /* Modern browsers */ - min-height: 40px; - } - - .wp-core-ui .button.media-frame-menu-toggle:hover, - .wp-core-ui .button.media-frame-menu-toggle:active { - background: transparent; - transform: none; - } - - .wp-core-ui .button.media-frame-menu-toggle:focus { - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; - } - /* End drop-down menu */ - - .media-sidebar { - width: 230px; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline, - .attachments-browser .media-toolbar, - .attachments-browser .attachments-wrapper, - .attachments-browser.has-load-more .attachments-wrapper { - left: 262px; - } - - .media-sidebar .setting, - .attachment-details .setting { - margin: 6px 0; - } - - .media-sidebar .setting input, - .media-sidebar .setting textarea, - .media-sidebar .setting .name, - .attachment-details .setting input, - .attachment-details .setting textarea, - .attachment-details .setting .name, - .compat-item label span { - float: none; - display: inline-block; - } - - .media-sidebar .setting span, /* Back-compat for pre-5.3 */ - .attachment-details .setting span, /* Back-compat for pre-5.3 */ - .media-sidebar .checkbox-label-inline { - float: none; - } - - .media-sidebar .setting .select-label-inline { - display: inline; - } - - .media-sidebar .setting .name, - .media-sidebar .checkbox-label-inline, - .attachment-details .setting .name, - .compat-item label span { - text-align: inherit; - min-height: 16px; - margin: 0; - padding: 8px 2px 2px; - } - - /* Needs high specificity. */ - .media-sidebar .setting .copy-to-clipboard-container, - .attachment-details .attachment-info .copy-to-clipboard-container { - margin-right: 0; - padding-top: 0; - } - - .media-sidebar .setting .copy-attachment-url, - .attachment-details .attachment-info .copy-attachment-url { - margin: 0 1px; - } - - .media-sidebar .setting .value, - .attachment-details .setting .value { - float: none; - width: auto; - } - - .media-sidebar .setting input[type="text"], - .media-sidebar .setting input[type="password"], - .media-sidebar .setting input[type="email"], - .media-sidebar .setting input[type="number"], - .media-sidebar .setting input[type="search"], - .media-sidebar .setting input[type="tel"], - .media-sidebar .setting input[type="url"], - .media-sidebar .setting textarea, - .media-sidebar .setting select, - .attachment-details .setting input[type="text"], - .attachment-details .setting input[type="password"], - .attachment-details .setting input[type="email"], - .attachment-details .setting input[type="number"], - .attachment-details .setting input[type="search"], - .attachment-details .setting input[type="tel"], - .attachment-details .setting input[type="url"], - .attachment-details .setting textarea, - .attachment-details .setting select, - .attachment-details .setting + .description { - float: none; - width: 98%; - max-width: none; - height: auto; - } - - .media-frame .media-toolbar input[type="search"] { - line-height: 2.25; /* 36px */ - } - - .media-sidebar .setting select.columns, - .attachment-details .setting select.columns { - width: auto; - } - - .media-frame input, - .media-frame textarea, - .media-frame .search { - padding: 3px 6px; - } - - .wp-admin .media-frame select { - min-height: 40px; - font-size: 16px; - line-height: 1.625; - padding: 5px 8px 5px 24px; - } - - .image-details .column-image { - width: 30%; - right: 70%; - } - - .image-details .column-settings { - width: 70%; - } - - .image-details .media-modal { - right: 30px; - left: 30px; - } - - .image-details .embed-media-settings .setting, - .image-details .embed-media-settings .setting-group { - margin: 20px; - } - - .image-details .embed-media-settings .setting span, /* Back-compat for pre-5.3 */ - .image-details .embed-media-settings .setting .name { - float: none; - text-align: right; - width: 100%; - margin-bottom: 4px; - margin-right: 0; - } - - .media-modal .legend-inline { - position: static; - transform: none; - margin-right: 0; - margin-bottom: 6px; - } - - .image-details .embed-media-settings .setting-group .setting { - margin-bottom: 0; - } - - .image-details .embed-media-settings .setting input.link-to-custom, - .image-details .embed-media-settings .setting input[type="text"], - .image-details .embed-media-settings .setting textarea { - width: 100%; - margin-right: 0; - } - - .image-details .embed-media-settings .setting.has-description { - margin-bottom: 5px; - } - - .image-details .description { - width: auto; - margin: 0 20px; - } - - .image-details .embed-media-settings .custom-size { - margin-right: 20px; - } - - .collection-settings .setting input[type="checkbox"] { - float: none; - margin-top: 0; - } - - .media-selection { - min-width: 120px; - } - - .media-selection:after { - background: none; - } - - .media-selection .attachments { - display: none; - } - - .media-modal .attachments-browser .media-toolbar .search { - max-width: 100%; - height: auto; - float: left; - } - - .media-modal .attachments-browser .media-toolbar .attachment-filters { - height: auto; - } - - /* Text inputs need to be 16px, or they force zooming on iOS */ - .media-frame input[type="text"], - .media-frame input[type="password"], - .media-frame input[type="number"], - .media-frame input[type="search"], - .media-frame input[type="email"], - .media-frame input[type="url"], - .media-frame textarea, - .media-frame select { - font-size: 16px; - } - - .media-frame .media-toolbar input[type="search"] { - line-height: 2.3755; /* 38px */ - } - - .media-modal .media-toolbar .spinner { - margin-bottom: 10px; - } -} - -@media screen and (max-width: 782px) { - .attachments-browser .media-toolbar { - height: 82px; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline { - top: 82px; - } - - .media-frame-toolbar .media-toolbar { - bottom: -54px; - } - - .mode-grid .attachments-browser .media-toolbar-primary { - display: block; - } - - .media-sidebar .copy-to-clipboard-container .success, - .attachment-details .copy-to-clipboard-container .success { - font-size: 14px; - line-height: 2.71428571; - } -} - -/* Responsive on portrait and landscape */ -@media only screen and (max-width: 640px), screen and (max-height: 400px) { - /* Full-bleed modal */ - .media-modal, - .image-details .media-modal { - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - } - - .media-modal-backdrop { - position: fixed; - } - - .media-sidebar { - z-index: 1900; - max-width: 70%; - bottom: 120%; - box-sizing: border-box; - padding-bottom: 0; - } - - .media-sidebar.visible { - bottom: 0; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline, - .attachments-browser .media-toolbar, - .media-frame-content .attachments-browser .attachments-wrapper { - left: 0; - } - - .attachments-browser .attachments-wrapper { - padding-top: 12px; - } - - .image-details .media-frame-title { - display: block; - top: 0; - font-size: 14px; - } - - .image-details .column-image, - .image-details .column-settings { - width: 100%; - position: relative; - right: 0; - } - - .image-details .column-settings { - padding: 4px 0; - } - - /* Media tabs on the top */ - .media-frame-content .media-toolbar .instructions { - display: none; - } - - /* Change margin direction on load more button in responsive views. */ - .load-more-wrapper .load-more-jump { - margin: 12px 0 0; - } - -} - -@media only screen and (min-width: 901px) and (max-height: 400px) { - .media-menu, - .media-frame:not(.hide-menu) .media-menu { - top: 0; - padding-top: 44px; - } - - /* Change margin direction on load more button in responsive views. */ - .load-more-wrapper .load-more-jump { - margin: 12px 0 0; - } - -} - -@media only screen and (max-width: 480px) { - .wp-core-ui.wp-customizer .media-button { - margin-top: 13px; - } -} - -/** - * HiDPI Displays - */ -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - - .wp-core-ui .media-modal-icon { - background-image: url(../images/uploader-icons-2x.png); - background-size: 134px 15px; - } - - .media-frame .spinner { - background-image: url(../images/spinner-2x.gif); - } -} - -.media-frame-content[data-columns="1"] .attachment { - width: 100%; -} - -.media-frame-content[data-columns="2"] .attachment { - width: 50%; -} - -.media-frame-content[data-columns="3"] .attachment { - width: 33.33%; -} - -.media-frame-content[data-columns="4"] .attachment { - width: 25%; -} - -.media-frame-content[data-columns="5"] .attachment { - width: 20%; -} - -.media-frame-content[data-columns="6"] .attachment { - width: 16.66%; -} - -.media-frame-content[data-columns="7"] .attachment { - width: 14.28%; -} - -.media-frame-content[data-columns="8"] .attachment { - width: 12.5%; -} - -.media-frame-content[data-columns="9"] .attachment { - width: 11.11%; -} - -.media-frame-content[data-columns="10"] .attachment { - width: 10%; -} - -.media-frame-content[data-columns="11"] .attachment { - width: 9.09%; -} - -.media-frame-content[data-columns="12"] .attachment { - width: 8.33%; -} -html, body { - padding: 0; - margin: 0; -} - -body { - font-family: sans-serif; -} - -/* Text meant only for screen readers */ -.screen-reader-text { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -/* Dashicons */ -.dashicons { - display: inline-block; - width: 20px; - height: 20px; - background-color: transparent; - background-repeat: no-repeat; - background-size: 20px; - background-position: center; - transition: background .1s ease-in; - position: relative; - top: 5px; -} - -.dashicons-no { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M15.55%2013.7l-2.19%202.06-3.42-3.65-3.64%203.43-2.06-2.18%203.64-3.43-3.42-3.64%202.18-2.06%203.43%203.64%203.64-3.42%202.05%202.18-3.64%203.43z%27%20fill%3D%27%23fff%27%2F%3E%3C%2Fsvg%3E"); -} - -.dashicons-admin-comments { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E"); -} - -.wp-embed-comments a:hover .dashicons-admin-comments { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E"); -} - -.dashicons-share { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E"); - display: none; -} - -.js .dashicons-share { - display: inline-block; -} - -.wp-embed-share-dialog-open:hover .dashicons-share { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E"); -} - -.wp-embed { - padding: 25px; - font-size: 14px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 1.5; - color: #8c8f94; - background: #fff; - border: 1px solid #dcdcde; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); - /* Clearfix */ - overflow: auto; - zoom: 1; -} - -.wp-embed a { - color: #8c8f94; - text-decoration: none; -} - -.wp-embed a:hover { - text-decoration: underline; -} - -.wp-embed-featured-image { - margin-bottom: 20px; -} - -.wp-embed-featured-image img { - width: 100%; - height: auto; - border: none; -} - -.wp-embed-featured-image.square { - float: left; - max-width: 160px; - margin-right: 20px; -} - -.wp-embed p { - margin: 0; -} - -p.wp-embed-heading { - margin: 0 0 15px; - font-weight: 600; - font-size: 22px; - line-height: 1.3; -} - -.wp-embed-heading a { - color: #2c3338; -} - -.wp-embed .wp-embed-more { - color: #c3c4c7; -} - -.wp-embed-footer { - display: table; - width: 100%; - margin-top: 30px; -} - -.wp-embed-site-icon { - position: absolute; - top: 50%; - left: 0; - transform: translateY(-50%); - height: 25px; - width: 25px; - border: 0; -} - -.wp-embed-site-title { - font-weight: 600; - line-height: 1.78571428; -} - -.wp-embed-site-title a { - position: relative; - display: inline-block; - padding-left: 35px; -} - -.wp-embed-site-title, -.wp-embed-meta { - display: table-cell; -} - -.wp-embed-meta { - text-align: right; - white-space: nowrap; - vertical-align: middle; -} - -.wp-embed-comments, -.wp-embed-share { - display: inline; -} - -.wp-embed-meta a:hover { - text-decoration: none; - color: #2271b1; -} - -.wp-embed-comments a { - line-height: 1.78571428; - display: inline-block; -} - -.wp-embed-comments + .wp-embed-share { - margin-left: 10px; -} - -.wp-embed-share-dialog { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #1d2327; - background-color: rgba(0, 0, 0, 0.9); - color: #fff; - opacity: 1; - transition: opacity .25s ease-in-out; -} - -.wp-embed-share-dialog.hidden { - opacity: 0; - visibility: hidden; -} - -.wp-embed-share-dialog-open, -.wp-embed-share-dialog-close { - margin: -8px 0 0; - padding: 0; - background: transparent; - border: none; - cursor: pointer; - outline: none; -} - -.wp-embed-share-dialog-open .dashicons, -.wp-embed-share-dialog-close .dashicons { - padding: 4px; -} - -.wp-embed-share-dialog-open .dashicons { - top: 8px; -} - -.wp-embed-share-dialog-open:focus .dashicons, -.wp-embed-share-dialog-close:focus .dashicons { - box-shadow: 0 0 0 1px #4f94d4, 0 0 2px 1px rgba(79, 148, 212, 0.8); - border-radius: 100%; -} - -.wp-embed-share-dialog-close { - position: absolute; - top: 20px; - right: 20px; - font-size: 22px; -} - -.wp-embed-share-dialog-close:hover { - text-decoration: none; -} - -.wp-embed-share-dialog-close .dashicons { - height: 24px; - width: 24px; - background-size: 24px; -} - -.wp-embed-share-dialog-content { - height: 100%; - transform-style: preserve-3d; - overflow: hidden; -} - -.wp-embed-share-dialog-text { - margin-top: 25px; - padding: 20px; -} - -.wp-embed-share-tabs { - margin: 0 0 20px; - padding: 0; - list-style: none; -} - -.wp-embed-share-tab-button { - display: inline-block; -} - -.wp-embed-share-tab-button button { - margin: 0; - padding: 0; - border: none; - background: transparent; - font-size: 16px; - line-height: 1.3; - color: #a7aaad; - cursor: pointer; - transition: color .1s ease-in; -} - -.wp-embed-share-tab-button [aria-selected="true"] { - color: #fff; -} - -.wp-embed-share-tab-button button:hover { - color: #fff; -} - -.wp-embed-share-tab-button + .wp-embed-share-tab-button { - margin: 0 0 0 10px; - padding: 0 0 0 11px; - border-left: 1px solid #a7aaad; -} - -.wp-embed-share-tab[aria-hidden="true"] { - display: none; -} - -p.wp-embed-share-description { - margin: 0; - font-size: 14px; - line-height: 1; - font-style: italic; - color: #a7aaad; -} - -.wp-embed-share-input { - box-sizing: border-box; - width: 100%; - border: none; - height: 28px; - margin: 0 0 10px; - padding: 0 5px; - font-size: 14px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 1.5; - resize: none; - cursor: text; -} - -textarea.wp-embed-share-input { - height: 72px; -} - -html[dir="rtl"] .wp-embed-featured-image.square { - float: right; - margin-right: 0; - - margin-left: 20px; -} - -html[dir="rtl"] .wp-embed-site-title a { - padding-left: 0; - padding-right: 35px; -} - -html[dir="rtl"] .wp-embed-site-icon { - margin-right: 0; - margin-left: 10px; - left: auto; - right: 0; -} - -html[dir="rtl"] .wp-embed-meta { - text-align: left; -} - -html[dir="rtl"] .wp-embed-footer { -} - -html[dir="rtl"] .wp-embed-share { - margin-left: 0; - margin-right: 10px; -} - -html[dir="rtl"] .wp-embed-share-dialog-close { - right: auto; - left: 20px; -} - -html[dir="rtl"] .wp-embed-share-tab-button + .wp-embed-share-tab-button { - margin: 0 10px 0 0; - padding: 0 11px 0 0; - border-left: none; - border-right: 1px solid #a7aaad; -} -/*! This file is auto-generated */ -.wp-core-ui .button,.wp-core-ui .button-primary,.wp-core-ui .button-secondary{display:inline-block;text-decoration:none;font-size:13px;line-height:2.15384615;min-height:30px;margin:0;padding:0 10px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box}.wp-core-ui button::-moz-focus-inner,.wp-core-ui input[type=button]::-moz-focus-inner,.wp-core-ui input[type=reset]::-moz-focus-inner,.wp-core-ui input[type=submit]::-moz-focus-inner{border-width:0;border-style:none;padding:0}.wp-core-ui .button-group.button-large .button,.wp-core-ui .button.button-large{min-height:32px;line-height:2.30769231;padding:0 12px}.wp-core-ui .button-group.button-small .button,.wp-core-ui .button.button-small{min-height:26px;line-height:2.18181818;padding:0 8px;font-size:11px}.wp-core-ui .button-group.button-hero .button,.wp-core-ui .button.button-hero{font-size:14px;min-height:46px;line-height:3.14285714;padding:0 36px}.wp-core-ui .button.hidden{display:none}.wp-core-ui input[type=reset],.wp-core-ui input[type=reset]:active,.wp-core-ui input[type=reset]:focus,.wp-core-ui input[type=reset]:hover{background:0 0;border:none;box-shadow:none;padding:0 2px 1px;width:auto}.wp-core-ui .button,.wp-core-ui .button-secondary{color:#2271b1;border-color:#2271b1;background:#f6f7f7;vertical-align:top}.wp-core-ui p .button{vertical-align:baseline}.wp-core-ui .button-secondary:hover,.wp-core-ui .button.hover,.wp-core-ui .button:hover{background:#f0f0f1;border-color:#0a4b78;color:#0a4b78}.wp-core-ui .button-secondary:focus,.wp-core-ui .button.focus,.wp-core-ui .button:focus{background:#f6f7f7;border-color:#3582c4;color:#0a4b78;box-shadow:0 0 0 1px #3582c4;outline:2px solid transparent;outline-offset:0}.wp-core-ui .button-secondary:active,.wp-core-ui .button:active{background:#f6f7f7;border-color:#8c8f94;box-shadow:none}.wp-core-ui .button.active,.wp-core-ui .button.active:hover{background-color:#dcdcde;color:#135e96;border-color:#0a4b78;box-shadow:inset 0 2px 5px -3px #0a4b78}.wp-core-ui .button.active:focus{border-color:#3582c4;box-shadow:inset 0 2px 5px -3px #0a4b78,0 0 0 1px #3582c4}.wp-core-ui .button-disabled,.wp-core-ui .button-secondary.disabled,.wp-core-ui .button-secondary:disabled,.wp-core-ui .button-secondary[disabled],.wp-core-ui .button.disabled,.wp-core-ui .button:disabled,.wp-core-ui .button[disabled]{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;cursor:default;transform:none!important}.wp-core-ui .button-link{margin:0;padding:0;box-shadow:none;border:0;border-radius:0;background:0 0;cursor:pointer;text-align:right;color:#2271b1;text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out}.wp-core-ui .button-link:active,.wp-core-ui .button-link:hover{color:#135e96}.wp-core-ui .button-link:focus{color:#043959;box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:1px solid transparent}.wp-core-ui .button-link-delete{color:#d63638}.wp-core-ui .button-link-delete:focus,.wp-core-ui .button-link-delete:hover{color:#d63638;background:0 0}.wp-core-ui .button-link-delete:disabled{background:0 0!important}.wp-core-ui .button-primary{background:#2271b1;border-color:#2271b1;color:#fff;text-decoration:none;text-shadow:none}.wp-core-ui .button-primary.focus,.wp-core-ui .button-primary.hover,.wp-core-ui .button-primary:focus,.wp-core-ui .button-primary:hover{background:#135e96;border-color:#135e96;color:#fff}.wp-core-ui .button-primary.focus,.wp-core-ui .button-primary:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px #2271b1}.wp-core-ui .button-primary.active,.wp-core-ui .button-primary.active:focus,.wp-core-ui .button-primary.active:hover,.wp-core-ui .button-primary:active{background:#135e96;border-color:#135e96;box-shadow:none;color:#fff}.wp-core-ui .button-primary-disabled,.wp-core-ui .button-primary.disabled,.wp-core-ui .button-primary:disabled,.wp-core-ui .button-primary[disabled]{color:#a7aaad!important;background:#f6f7f7!important;border-color:#dcdcde!important;box-shadow:none!important;text-shadow:none!important;cursor:default}.wp-core-ui .button-group{position:relative;display:inline-block;white-space:nowrap;font-size:0;vertical-align:middle}.wp-core-ui .button-group>.button{display:inline-block;border-radius:0;margin-left:-1px}.wp-core-ui .button-group>.button:first-child{border-radius:0 3px 3px 0}.wp-core-ui .button-group>.button:last-child{border-radius:3px 0 0 3px}.wp-core-ui .button-group>.button-primary+.button{border-right:0}.wp-core-ui .button-group>.button:focus{position:relative;z-index:1}.wp-core-ui .button-group>.button.active{background-color:#dcdcde;color:#135e96;border-color:#0a4b78;box-shadow:inset 0 2px 5px -3px #0a4b78}.wp-core-ui .button-group>.button.active:focus{border-color:#3582c4;box-shadow:inset 0 2px 5px -3px #0a4b78,0 0 0 1px #3582c4}@media screen and (max-width:782px){.wp-core-ui .button,.wp-core-ui .button.button-large,.wp-core-ui .button.button-small,a.preview,input#publish,input#save-post{padding:0 14px;line-height:2.71428571;font-size:14px;vertical-align:middle;min-height:40px;margin-bottom:4px}.wp-core-ui .copy-to-clipboard-container .copy-attachment-url{margin-bottom:0}#media-upload.wp-core-ui .button{padding:0 10px 1px;min-height:24px;line-height:22px;font-size:13px}.media-frame.mode-grid .bulk-select .button{margin-bottom:0}.wp-core-ui .save-post-status.button{position:relative;margin:0 10px 0 14px}.wp-core-ui.wp-customizer .button{font-size:13px;line-height:2.15384615;min-height:30px;margin:0;vertical-align:inherit}.media-modal-content .media-toolbar-primary .media-button{margin-top:10px;margin-right:5px}.interim-login .button.button-large{min-height:30px;line-height:2;padding:0 12px 2px}}/** - * Base Styles - */ -.media-modal * { - box-sizing: content-box; -} - -.media-modal input, -.media-modal select, -.media-modal textarea { - box-sizing: border-box; -} - -.media-modal, -.media-frame { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 12px; - -webkit-overflow-scrolling: touch; -} - -.media-modal legend { - padding: 0; - font-size: 13px; -} - -.media-modal label { - font-size: 13px; -} - -.media-modal .legend-inline { - position: absolute; - transform: translate(-100%, 50%); - margin-left: -1%; - line-height: 1.2; -} - -.media-frame a { - border-bottom: none; - color: #2271b1; -} - -.media-frame a:hover, -.media-frame a:active { - color: #135e96; -} - -.media-frame a:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-frame a.button { - color: #2c3338; -} - -.media-frame a.button:hover { - color: #1d2327; -} - -.media-frame a.button-primary, -.media-frame a.button-primary:hover { - color: #fff; -} - -.media-frame input, -.media-frame textarea { - padding: 6px 8px; -} - -.media-frame select, -.wp-admin .media-frame select { - min-height: 30px; - vertical-align: middle; -} - -.media-frame input[type="text"], -.media-frame input[type="password"], -.media-frame input[type="color"], -.media-frame input[type="date"], -.media-frame input[type="datetime"], -.media-frame input[type="datetime-local"], -.media-frame input[type="email"], -.media-frame input[type="month"], -.media-frame input[type="number"], -.media-frame input[type="search"], -.media-frame input[type="tel"], -.media-frame input[type="time"], -.media-frame input[type="url"], -.media-frame input[type="week"], -.media-frame textarea, -.media-frame select { - box-shadow: 0 0 0 transparent; - border-radius: 4px; - border: 1px solid #8c8f94; - background-color: #fff; - color: #2c3338; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.media-frame input[type="text"], -.media-frame input[type="password"], -.media-frame input[type="date"], -.media-frame input[type="datetime"], -.media-frame input[type="datetime-local"], -.media-frame input[type="email"], -.media-frame input[type="month"], -.media-frame input[type="number"], -.media-frame input[type="search"], -.media-frame input[type="tel"], -.media-frame input[type="time"], -.media-frame input[type="url"], -.media-frame input[type="week"] { - padding: 0 8px; - /* inherits font size 13px */ - line-height: 2.15384615; /* 28px */ -} - -/* Search field in the Media Library toolbar */ -.media-frame.mode-grid .wp-filter input[type="search"] { - font-size: 14px; - line-height: 2; -} - -.media-frame input[type="text"]:focus, -.media-frame input[type="password"]:focus, -.media-frame input[type="number"]:focus, -.media-frame input[type="search"]:focus, -.media-frame input[type="email"]:focus, -.media-frame input[type="url"]:focus, -.media-frame textarea:focus, -.media-frame select:focus { - border-color: #3582c4; - box-shadow: 0 0 0 1px #3582c4; - outline: 2px solid transparent; -} - -.media-frame input:disabled, -.media-frame textarea:disabled, -.media-frame input[readonly], -.media-frame textarea[readonly] { - background-color: #f0f0f1; -} - -.media-frame input[type="search"] { - -webkit-appearance: textfield; -} - -.media-frame ::-webkit-input-placeholder { - color: #646970; -} - -.media-frame ::-moz-placeholder { - color: #646970; - opacity: 1; -} - -.media-frame :-ms-input-placeholder { - color: #646970; -} - -/* - * In some cases there's the need of higher specificity, - * for example higher than `.media-embed .setting`. - */ -.media-frame .hidden, -.media-frame .setting.hidden { - display: none; -} - -/*! - * jQuery UI Draggable/Sortable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ -.ui-draggable-handle, -.ui-sortable-handle { - touch-action: none; -} - -/** - * Modal - */ -.media-modal { - position: fixed; - top: 30px; - left: 30px; - right: 30px; - bottom: 30px; - z-index: 160000; -} - -.wp-customizer .media-modal { - z-index: 560000; -} - -.media-modal-backdrop { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - min-height: 360px; - background: #000; - opacity: 0.7; - z-index: 159900; -} - -.wp-customizer .media-modal-backdrop { - z-index: 559900; -} - -.media-modal-close { - position: absolute; - top: 0; - right: 0; - width: 50px; - height: 50px; - margin: 0; - padding: 0; - border: 1px solid transparent; - background: none; - color: #646970; - z-index: 1000; - cursor: pointer; - outline: none; - transition: color .1s ease-in-out, background .1s ease-in-out; -} - -.media-modal-close:hover, -.media-modal-close:active { - color: #135e96; -} - -.media-modal-close:focus { - color: #135e96; - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.media-modal-close span.media-modal-icon { - background-image: none; -} - -.media-modal-close .media-modal-icon:before { - content: "\f158"; - font: normal 20px/1 dashicons; - speak: never; - vertical-align: middle; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.media-modal-content { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - overflow: auto; - min-height: 300px; - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7); - background: #fff; - -webkit-font-smoothing: subpixel-antialiased; -} - -.media-modal-content .media-frame select.attachment-filters { - margin-top: 32px; - margin-right: 2%; - width: 42%; - width: calc(48% - 12px); -} - -.media-modal-content .attachments-browser .search { - width: 100%; -} - -/* higher specificity */ -.wp-core-ui .media-modal-icon { - background-image: url(../images/uploader-icons.png); - background-repeat: no-repeat; -} - -/** - * Toolbar - */ -.media-toolbar { - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 100; - height: 60px; - padding: 0 16px; - border: 0 solid #dcdcde; - overflow: hidden; -} - -.media-frame-toolbar .media-toolbar { - top: auto; - bottom: -47px; - height: auto; - overflow: visible; - border-top: 1px solid #dcdcde; -} - -.media-toolbar-primary { - float: right; - height: 100%; - position: relative; -} - -.media-toolbar-secondary { - float: left; - height: 100%; -} - -.media-toolbar-primary > .media-button, -.media-toolbar-primary > .media-button-group { - margin-left: 10px; - float: left; - margin-top: 15px; -} - -.media-toolbar-secondary > .media-button, -.media-toolbar-secondary > .media-button-group { - margin-right: 10px; - margin-top: 15px; -} - -/** - * Sidebar - */ -.media-sidebar { - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 267px; - padding: 0 16px; - z-index: 75; - background: #f6f7f7; - border-left: 1px solid #dcdcde; - overflow: auto; - -webkit-overflow-scrolling: touch; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-sidebar::after { - content: ""; - display: flex; - clear: both; - height: 24px; -} - -.hide-toolbar .media-sidebar { - bottom: 0; -} - -.media-sidebar h2, -.image-details h2:not(.media-attachments-filter-heading) { - position: relative; - font-weight: 600; - text-transform: uppercase; - font-size: 12px; - color: #646970; - margin: 24px 0 8px; -} - -.media-sidebar .setting, -.attachment-details .setting { - display: block; - float: left; - width: 100%; - margin: 0 0 10px; -} - -.media-sidebar .collection-settings .setting { - margin: 1px 0; -} - -.media-sidebar .setting.has-description, -.attachment-details .setting.has-description { - margin-bottom: 5px; -} - -.media-sidebar .setting .link-to-custom { - margin: 3px 2px 0; -} - -.media-sidebar .setting span, /* Back-compat for pre-5.3 */ -.attachment-details .setting span, /* Back-compat for pre-5.3 */ -.media-sidebar .setting .name, -.media-sidebar .setting .value, -.attachment-details .setting .name { - min-width: 30%; - margin-right: 4%; - font-size: 12px; - text-align: right; - word-wrap: break-word; -} - -.media-sidebar .setting .name { - max-width: 80px; -} - -.media-sidebar .setting .value { - text-align: left; -} - -.media-sidebar .setting select { - max-width: 65%; -} - -.media-sidebar .setting input[type="checkbox"], -.media-sidebar .field input[type="checkbox"], -.media-sidebar .setting input[type="radio"], -.media-sidebar .field input[type="radio"], -.attachment-details .setting input[type="checkbox"], -.attachment-details .field input[type="checkbox"], -.attachment-details .setting input[type="radio"], -.attachment-details .field input[type="radio"] { - float: none; - margin: 8px 3px 0; - padding: 0; -} - -.media-sidebar .setting span, /* Back-compat for pre-5.3 */ -.attachment-details .setting span, /* Back-compat for pre-5.3 */ -.media-sidebar .setting .name, -.media-sidebar .setting .value, -.media-sidebar .checkbox-label-inline, -.attachment-details .setting .name, -.attachment-details .setting .value, -.compat-item label span { - float: left; - min-height: 22px; - padding-top: 8px; - line-height: 1.33333333; - font-weight: 400; - color: #646970; -} - -.media-sidebar .checkbox-label-inline { - font-size: 12px; -} - -.media-sidebar .copy-to-clipboard-container, -.attachment-details .copy-to-clipboard-container { - flex-wrap: wrap; - margin-top: 10px; - margin-left: calc( 35% - 1px ); - padding-top: 10px; -} - -/* Needs high specificity. */ -.attachment-details .attachment-info .copy-to-clipboard-container { - float: none; -} - -.media-sidebar .copy-to-clipboard-container .success, -.attachment-details .copy-to-clipboard-container .success { - padding: 0; - min-height: 0; - line-height: 2.18181818; - text-align: left; - color: #008a20; -} - -.compat-item label span { - text-align: right; -} - -.media-sidebar .setting input[type="text"], -.media-sidebar .setting input[type="password"], -.media-sidebar .setting input[type="email"], -.media-sidebar .setting input[type="number"], -.media-sidebar .setting input[type="search"], -.media-sidebar .setting input[type="tel"], -.media-sidebar .setting input[type="url"], -.media-sidebar .setting textarea, -.media-sidebar .setting .value, -.attachment-details .setting input[type="text"], -.attachment-details .setting input[type="password"], -.attachment-details .setting input[type="email"], -.attachment-details .setting input[type="number"], -.attachment-details .setting input[type="search"], -.attachment-details .setting input[type="tel"], -.attachment-details .setting input[type="url"], -.attachment-details .setting textarea, -.attachment-details .setting .value, -.attachment-details .setting + .description { - box-sizing: border-box; - margin: 1px; - width: 65%; - float: right; -} - -.media-sidebar .setting .value, -.attachment-details .setting .value, -.attachment-details .setting + .description { - margin: 0 1px; - text-align: left; -} - -.attachment-details .setting + .description { - clear: both; - font-size: 12px; - font-style: normal; - margin-bottom: 10px; -} - -.media-sidebar .setting textarea, -.attachment-details .setting textarea, -.compat-item .field textarea { - height: 62px; - resize: vertical; -} - -.compat-item { - float: left; - width: 100%; - overflow: hidden; -} - -.compat-item table { - width: 100%; - table-layout: fixed; - border-spacing: 0; - border: 0; -} - -.compat-item tr { - padding: 2px 0; - display: block; - overflow: hidden; -} - -.compat-item .label, -.compat-item .field { - display: block; - margin: 0; - padding: 0; -} - -.compat-item .label { - min-width: 30%; - margin-right: 4%; - float: left; - text-align: right; -} - -.compat-item .label span { - display: block; - width: 100%; -} - -.compat-item .field { - float: right; - width: 65%; - margin: 1px; -} - -.compat-item .field input[type="text"], -.compat-item .field input[type="password"], -.compat-item .field input[type="email"], -.compat-item .field input[type="number"], -.compat-item .field input[type="search"], -.compat-item .field input[type="tel"], -.compat-item .field input[type="url"], -.compat-item .field textarea { - width: 100%; - margin: 0; - box-sizing: border-box; -} - -.sidebar-for-errors .attachment-details, -.sidebar-for-errors .compat-item, -.sidebar-for-errors .media-sidebar .media-progress-bar, -.sidebar-for-errors .upload-details { - display: none !important; -} - -/** - * Menu - */ -.media-menu { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - margin: 0; - padding: 50px 0 10px; - background: #f6f7f7; - border-right-width: 1px; - border-right-style: solid; - border-right-color: #c3c4c7; - -webkit-user-select: none; - user-select: none; -} - -.media-menu .media-menu-item { - display: block; - box-sizing: border-box; - width: 100%; - position: relative; - border: 0; - margin: 0; - padding: 8px 20px; - font-size: 14px; - line-height: 1.28571428; - background: transparent; - color: #2271b1; - text-align: left; - text-decoration: none; - cursor: pointer; -} - -.media-menu .media-menu-item:hover { - background: rgba(0, 0, 0, 0.04); -} - -.media-menu .media-menu-item:active { - color: #2271b1; - outline: none; -} - -.media-menu .active, -.media-menu .active:hover { - color: #1d2327; - font-weight: 600; -} - -.media-menu .media-menu-item:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-menu .separator { - height: 0; - margin: 12px 20px; - padding: 0; - border-top: 1px solid #dcdcde; -} - -/** - * Menu - */ -.media-router { - position: relative; - padding: 0 6px; - margin: 0; - clear: both; -} - -.media-router .media-menu-item { - position: relative; - float: left; - border: 0; - margin: 0; - padding: 8px 10px 9px; - height: 18px; - line-height: 1.28571428; - font-size: 14px; - text-decoration: none; - background: transparent; - cursor: pointer; - transition: none; -} - -.media-router .media-menu-item:last-child { - border-right: 0; -} - -.media-router .media-menu-item:hover, -.media-router .media-menu-item:active { - color: #2271b1; -} - -.media-router .active, -.media-router .active:hover { - color: #1d2327; -} - -.media-router .media-menu-item:focus { - box-shadow: - 0 0 0 1px #4f94d4, - 0 0 2px 1px rgba(79, 148, 212, 0.8); - color: #043959; - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; -} - -.media-router .active, -.media-router .media-menu-item.active:last-child { - margin: -1px -1px 0; - background: #fff; - border: 1px solid #dcdcde; - border-bottom: none; -} - -.media-router .active:after { - display: none; -} - -/** - * Frame - */ -.media-frame { - overflow: hidden; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.media-frame-menu { - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 200px; - z-index: 150; -} - -.media-frame-title { - position: absolute; - top: 0; - left: 200px; - right: 0; - height: 50px; - z-index: 200; -} - -.media-frame-router { - position: absolute; - top: 50px; - left: 200px; - right: 0; - height: 36px; - z-index: 200; -} - -.media-frame-content { - position: absolute; - top: 84px; - left: 200px; - right: 0; - bottom: 61px; - height: auto; - width: auto; - margin: 0; - overflow: auto; - background: #fff; - border-top: 1px solid #dcdcde; -} - -.media-frame-toolbar { - position: absolute; - left: 200px; - right: 0; - z-index: 100; - bottom: 60px; - height: auto; -} - -.media-frame.hide-menu .media-frame-title, -.media-frame.hide-menu .media-frame-router, -.media-frame.hide-menu .media-frame-toolbar, -.media-frame.hide-menu .media-frame-content { - left: 0; -} - -.media-frame.hide-toolbar .media-frame-content { - bottom: 0; -} - -.media-frame.hide-router .media-frame-content { - top: 50px; -} - -.media-frame.hide-menu .media-frame-menu, -.media-frame.hide-menu .media-frame-menu-heading, -.media-frame.hide-router .media-frame-router, -.media-frame.hide-toolbar .media-frame-toolbar { - display: none; -} - -.media-frame-title h1 { - padding: 0 16px; - font-size: 22px; - line-height: 2.27272727; - margin: 0; -} - -.media-frame-menu-heading, -.media-attachments-filter-heading { - position: absolute; - left: 20px; - top: 22px; - margin: 0; - font-size: 13px; - line-height: 1; - /* Above the media-frame-menu. */ - z-index: 151; -} - -.media-attachments-filter-heading { - top: 10px; - left: 16px; -} - -.mode-grid .media-attachments-filter-heading { - top: 0; - left: -9999px; -} - -.mode-grid .media-frame-actions-heading { - display: none; -} - -.wp-core-ui .button.media-frame-menu-toggle { - display: none; -} - -.media-frame-title .suggested-dimensions { - font-size: 14px; - float: right; - margin-right: 20px; -} - -.media-frame-content .crop-content { - height: 100%; -} - -.wp-customizer:not(.mobile) .media-frame-content .crop-content.site-icon { - margin-right: 300px; -} - -.media-frame-content .crop-content .crop-image { - display: block; - margin: auto; - max-width: 100%; - max-height: 100%; -} - -.media-frame-content .crop-content .upload-errors { - position: absolute; - width: 300px; - top: 50%; - left: 50%; - margin-left: -150px; - margin-right: -150px; - z-index: 600000; -} - -/** - * Iframes - */ -.media-frame .media-iframe { - overflow: hidden; -} - -.media-frame .media-iframe, -.media-frame .media-iframe iframe { - height: 100%; - width: 100%; - border: 0; -} - -/** - * Attachment Browser Filters - */ -.media-frame select.attachment-filters { - margin-top: 11px; - margin-right: 2%; - max-width: 42%; - max-width: calc(48% - 12px); -} - -.media-frame select.attachment-filters:last-of-type { - margin-right: 0; - width: auto; - max-width: 100%; -} - -/** - * Search - */ -.media-frame .search { - margin: 32px 0 0; - padding: 4px; - font-size: 13px; - color: #3c434a; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - -webkit-appearance: none; -} - -.media-toolbar-primary .search { - max-width: 100%; -} - -.media-frame .media-search-input-label { - position: absolute; - left: 0; - top: 10px; - margin: 0; - line-height: 1; -} - -/** - * Attachments - */ -.wp-core-ui .attachments { - margin: 0; - -webkit-overflow-scrolling: touch; -} - -/** - * Attachment - */ -.wp-core-ui .attachment { - position: relative; - float: left; - padding: 8px; - margin: 0; - color: #3c434a; - cursor: pointer; - list-style: none; - text-align: center; - -webkit-user-select: none; - user-select: none; - width: 25%; - box-sizing: border-box; -} - -.wp-core-ui .attachment:focus, -.wp-core-ui .selected.attachment:focus, -.wp-core-ui .attachment.details:focus { - box-shadow: - inset 0 0 2px 3px #fff, - inset 0 0 0 7px #4f94d4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; - outline-offset: -6px; -} - -.wp-core-ui .selected.attachment { - box-shadow: - inset 0 0 0 5px #fff, - inset 0 0 0 7px #c3c4c7; -} - -.wp-core-ui .attachment.details { - box-shadow: - inset 0 0 0 3px #fff, - inset 0 0 0 7px #2271b1; -} - -.wp-core-ui .attachment-preview { - position: relative; - box-shadow: - inset 0 0 15px rgba(0, 0, 0, 0.1), - inset 0 0 0 1px rgba(0, 0, 0, 0.05); - background: #f0f0f1; - cursor: pointer; -} - -.wp-core-ui .attachment-preview:before { - content: ""; - display: block; - padding-top: 100%; -} - -.wp-core-ui .attachment .icon { - margin: 0 auto; - overflow: hidden; -} - -.wp-core-ui .attachment .thumbnail { - overflow: hidden; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - opacity: 1; - transition: opacity .1s; -} - -.wp-core-ui .attachment .portrait img { - max-width: 100%; -} - -.wp-core-ui .attachment .landscape img { - max-height: 100%; -} - -.wp-core-ui .attachment .thumbnail:after { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); - overflow: hidden; -} - -.wp-core-ui .attachment .thumbnail img { - top: 0; - left: 0; -} - -.wp-core-ui .attachment .thumbnail .centered { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - transform: translate( 50%, 50% ); -} - -.wp-core-ui .attachment .thumbnail .centered img { - transform: translate( -50%, -50% ); -} - -.wp-core-ui .attachments-browser .attachment .thumbnail .centered img.icon { - transform: translate( -50%, -70% ); -} - -.wp-core-ui .attachment .filename { - position: absolute; - left: 0; - right: 0; - bottom: 0; - overflow: hidden; - max-height: 100%; - word-wrap: break-word; - text-align: center; - font-weight: 600; - background: rgba(255, 255, 255, 0.8); - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); -} - -.wp-core-ui .attachment .filename div { - padding: 5px 10px; -} - -.wp-core-ui .attachment .thumbnail img { - position: absolute; -} - -.wp-core-ui .attachment-close { - display: block; - position: absolute; - top: 5px; - right: 5px; - height: 22px; - width: 22px; - padding: 0; - background-color: #fff; - background-position: -96px 4px; - border-radius: 3px; - box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); - transition: none; -} - -.wp-core-ui .attachment-close:hover, -.wp-core-ui .attachment-close:focus { - background-position: -36px 4px; -} - -.wp-core-ui .attachment .check { - display: none; - height: 24px; - width: 24px; - padding: 0; - border: 0; - position: absolute; - z-index: 10; - top: 0; - right: 0; - outline: none; - background: #f0f0f1; - cursor: pointer; - box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 0, 0, 0.15); -} - -.wp-core-ui .attachment .check .media-modal-icon { - display: block; - background-position: -1px 0; - height: 15px; - width: 15px; - margin: 5px; -} - -.wp-core-ui .attachment .check:hover .media-modal-icon { - background-position: -40px 0; -} - -.wp-core-ui .attachment.selected .check { - display: block; -} - -.wp-core-ui .attachment.details .check, -.wp-core-ui .attachment.selected .check:focus, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check { - background-color: #2271b1; - box-shadow: - 0 0 0 1px #fff, - 0 0 0 2px #2271b1; -} - -.wp-core-ui .attachment.selected .check:focus { - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui .attachment.details .check .media-modal-icon, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check .media-modal-icon { - background-position: -21px 0; -} - -.wp-core-ui .attachment.details .check:hover .media-modal-icon, -.wp-core-ui .attachment.selected .check:focus .media-modal-icon, -.wp-core-ui .media-frame.mode-grid .attachment.selected .check:hover .media-modal-icon { - background-position: -60px 0; -} - -.wp-core-ui .media-frame .attachment .describe { - position: relative; - display: block; - width: 100%; - margin: 0; - padding: 0 8px; - font-size: 12px; - border-radius: 0; -} - -/** - * Attachments Browser - */ -.media-frame .attachments-browser { - position: relative; - width: 100%; - height: 100%; - overflow: hidden; -} - -.attachments-browser .media-toolbar { - right: 300px; - height: 72px; - background: #fff; -} - -.attachments-browser.hide-sidebar .media-toolbar { - right: 0; -} - -.attachments-browser .media-toolbar-primary > .media-button, -.attachments-browser .media-toolbar-primary > .media-button-group, -.attachments-browser .media-toolbar-secondary > .media-button, -.attachments-browser .media-toolbar-secondary > .media-button-group { - margin: 10px 0; -} - -.attachments-browser .attachments { - padding: 2px 8px 8px; -} - -.attachments-browser:not(.has-load-more) .attachments, -.attachments-browser.has-load-more .attachments-wrapper, -.attachments-browser .uploader-inline { - position: absolute; - top: 72px; - left: 0; - right: 300px; - bottom: 0; - overflow: auto; - outline: none; -} - -.attachments-browser .uploader-inline.hidden { - display: none; -} - -.attachments-browser .media-toolbar-primary { - max-width: 33%; -} - -.mode-grid .attachments-browser .media-toolbar-primary { - display: flex; - align-items: center; -} - -.mode-grid .attachments-browser .media-toolbar-mode-select .media-toolbar-primary { - display: none; -} - -.attachments-browser .media-toolbar-secondary { - max-width: 66%; -} - -.uploader-inline .close { - background-color: transparent; - border: 0; - cursor: pointer; - height: 48px; - outline: none; - padding: 0; - position: absolute; - right: 2px; - text-align: center; - top: 2px; - width: 48px; - z-index: 1; -} - -.uploader-inline .close:before { - font: normal 30px/1 dashicons !important; - color: #50575e; - display: inline-block; - content: "\f335"; - font-weight: 300; - margin-top: 1px; -} - -.uploader-inline .close:focus { - outline: 1px solid #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); -} - -.attachments-browser.hide-sidebar .attachments, -.attachments-browser.hide-sidebar .uploader-inline { - right: 0; - margin-right: 0; -} - -.attachments-browser .instructions { - display: inline-block; - margin-top: 16px; - line-height: 1.38461538; - font-size: 13px; - color: #646970; -} - -.attachments-browser .no-media { - padding: 2em 0 0 2em; -} - -.more-loaded .attachment:not(.found-media) { - background: #dcdcde; -} - -.load-more-wrapper { - clear: both; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - padding: 1em 0; -} - -.load-more-wrapper .load-more-count { - min-width: 100%; - margin: 0 0 1em; - text-align: center; -} - -.load-more-wrapper .load-more { - margin: 0; -} - -/* Needs high specificity. */ -.media-frame .load-more-wrapper .load-more + .spinner { - float: none; - margin: 0 -30px 0 10px; -} - -/* Reset spinner margin when the button is hidden to avoid horizontal scrollbar. */ -.media-frame .load-more-wrapper .load-more.hidden + .spinner { - margin: 0; -} - -/* Force a new row within the flex container. */ -.load-more-wrapper::after { - content: ""; - min-width: 100%; - order: 1; -} - -.load-more-wrapper .load-more-jump { - margin: 0 0 0 12px; -} - -.attachment.new-media { - outline: 2px dotted #c3c4c7; -} - -.load-more-wrapper { - clear: both; - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - padding: 1em 0; -} - -.load-more-wrapper .load-more-count { - min-width: 100%; - margin: 0 0 1em; - text-align: center; -} - -.load-more-wrapper .load-more { - margin: 0; -} - -/* Needs high specificity. */ -.media-frame .load-more-wrapper .load-more + .spinner { - float: none; - margin: 0 -30px 0 10px; -} - -/* Reset spinner margin when the button is hidden to avoid horizontal scrollbar. */ -.media-frame .load-more-wrapper .load-more.hidden + .spinner { - margin: 0; -} - -/* Force a new row within the flex container. */ -.load-more-wrapper::after { - content: ""; - min-width: 100%; - order: 1; -} - -.load-more-wrapper .load-more-jump { - margin: 0 0 0 12px; -} - -/** - * Progress Bar - */ -.media-progress-bar { - position: relative; - height: 10px; - width: 70%; - margin: 10px auto; - border-radius: 10px; - background: #dcdcde; - background: rgba(0, 0, 0, 0.1); -} - -.media-progress-bar div { - height: 10px; - min-width: 20px; - width: 0; - background: #2271b1; - border-radius: 10px; - transition: width 300ms; -} - -.media-uploader-status .media-progress-bar { - display: none; - width: 100%; -} - -.uploading.media-uploader-status .media-progress-bar { - display: block; -} - -.attachment-preview .media-progress-bar { - position: absolute; - top: 50%; - left: 15%; - width: 70%; - margin: -5px 0 0; -} - -.media-uploader-status { - position: relative; - margin: 0 auto; - padding-bottom: 10px; - max-width: 400px; -} - -.uploader-inline .media-uploader-status h2 { - display: none; -} - -.media-uploader-status .upload-details { - display: none; - font-size: 12px; - color: #646970; -} - -.uploading.media-uploader-status .upload-details { - display: block; -} - -.media-uploader-status .upload-detail-separator { - padding: 0 4px; -} - -.media-uploader-status .upload-count { - color: #3c434a; -} - -.media-uploader-status .upload-dismiss-errors, -.media-uploader-status .upload-errors { - display: none; -} - -.errors.media-uploader-status .upload-dismiss-errors, -.errors.media-uploader-status .upload-errors { - display: block; -} - -.media-uploader-status .upload-dismiss-errors { - transition: none; - text-decoration: none; -} - -.upload-errors .upload-error { - padding: 12px; - margin-bottom: 12px; - background: #fff; - border-left: 4px solid #d63638; - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); -} - -.uploader-inline .upload-errors .upload-error { - padding: 12px 30px; - background-color: #fcf0f1; - box-shadow: none; -} - -.upload-errors .upload-error-filename { - font-weight: 600; -} - -.upload-errors .upload-error-message { - display: block; - padding-top: 8px; - word-wrap: break-word; -} - -/** - * Window and Editor uploaders used to display "drop zones" - */ -.uploader-window, -.wp-editor-wrap .uploader-editor { - top: 0; - left: 0; - right: 0; - bottom: 0; - text-align: center; - display: none; -} - -.uploader-window { - position: fixed; - z-index: 250000; - opacity: 0; /* Only the inline uploader is animated with JS, the editor one isn't */ - transition: opacity 250ms; -} - -.wp-editor-wrap .uploader-editor { - position: absolute; - z-index: 99998; /* under the toolbar */ - background: rgba(140, 143, 148, 0.9); -} - -.uploader-window, -.wp-editor-wrap .uploader-editor.droppable { - background: rgba(10, 75, 120, 0.9); -} - -.uploader-window-content, -.wp-editor-wrap .uploader-editor-content { - position: absolute; - top: 10px; - left: 10px; - right: 10px; - bottom: 10px; - border: 1px dashed #fff; -} - -/* uploader drop-zone title */ -.uploader-window h1, /* Back-compat for pre-5.3 */ -.uploader-window .uploader-editor-title, -.wp-editor-wrap .uploader-editor .uploader-editor-title { - position: absolute; - top: 50%; - left: 0; - right: 0; - transform: translateY(-50%); - font-size: 3em; - line-height: 1.3; - font-weight: 600; - color: #fff; - margin: 0; - padding: 0 10px; -} - -.wp-editor-wrap .uploader-editor .uploader-editor-title { - display: none; -} - -.wp-editor-wrap .uploader-editor.droppable .uploader-editor-title { - display: block; -} - -.uploader-window .media-progress-bar { - margin-top: 20px; - max-width: 300px; - background: transparent; - border-color: #fff; - display: none; -} - -.uploader-window .media-progress-bar div { - background: #fff; -} - -.uploading .uploader-window .media-progress-bar { - display: block; -} - -.media-frame .uploader-inline { - margin-bottom: 20px; - padding: 0; - text-align: center; -} - -.uploader-inline-content { - position: absolute; - top: 30%; - left: 0; - right: 0; -} - -.uploader-inline-content .upload-ui { - margin: 2em 0; -} - -.uploader-inline-content .post-upload-ui { - margin-bottom: 2em; -} - -.uploader-inline .has-upload-message .upload-ui { - margin: 0 0 4em; -} - -.uploader-inline h2 { - font-size: 20px; - line-height: 1.4; - font-weight: 400; - margin: 0; -} - -.uploader-inline .has-upload-message .upload-instructions { - font-size: 14px; - color: #3c434a; - font-weight: 400; -} - -.uploader-inline .drop-instructions { - display: none; -} - -.supports-drag-drop .uploader-inline .drop-instructions { - display: block; -} - -.uploader-inline p { - margin: 0.5em 0; -} - -.uploader-inline .media-progress-bar { - display: none; -} - -.uploading.uploader-inline .media-progress-bar { - display: block; -} - -.uploader-inline .browser { - display: inline-block !important; -} - -/** - * Selection - */ -.media-selection { - position: absolute; - top: 0; - left: 0; - right: 350px; - height: 60px; - padding: 0 0 0 16px; - overflow: hidden; - white-space: nowrap; -} - -.media-selection .selection-info { - display: inline-block; - font-size: 12px; - height: 60px; - margin-right: 10px; - vertical-align: top; -} - -.media-selection.empty, -.media-selection.editing { - display: none; -} - -.media-selection.one .edit-selection { - display: none; -} - -.media-selection .count { - display: block; - padding-top: 12px; - font-size: 14px; - line-height: 1.42857142; - font-weight: 600; -} - -.media-selection .button-link { - float: left; - padding: 1px 8px; - margin: 1px 8px 1px -8px; - line-height: 1.4; - border-right: 1px solid #dcdcde; - color: #2271b1; - text-decoration: none; -} - -.media-selection .button-link:hover, -.media-selection .button-link:focus { - color: #135e96; -} - -.media-selection .button-link:last-child { - border-right: 0; - margin-right: 0; -} - -.selection-info .clear-selection { - color: #d63638; -} - -.selection-info .clear-selection:hover, -.selection-info .clear-selection:focus { - color: #d63638; -} - -.media-selection .selection-view { - display: inline-block; - vertical-align: top; -} - -.media-selection .attachments { - display: inline-block; - height: 48px; - margin: 6px; - padding: 0; - overflow: hidden; - vertical-align: top; -} - -.media-selection .attachment { - width: 40px; - padding: 0; - margin: 4px; -} - -.media-selection .attachment .thumbnail { - top: 0; - right: 0; - bottom: 0; - left: 0; -} - -.media-selection .attachment .icon { - width: 50%; -} - -.media-selection .attachment-preview { - box-shadow: none; - background: none; -} - -.wp-core-ui .media-selection .attachment:focus, -.wp-core-ui .media-selection .selected.attachment:focus, -.wp-core-ui .media-selection .attachment.details:focus { - box-shadow: - 0 0 0 1px #fff, - 0 0 2px 3px #4f94d4; - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui .media-selection .selected.attachment { - box-shadow: none; -} - -.wp-core-ui .media-selection .attachment.details { - box-shadow: - 0 0 0 1px #fff, - 0 0 0 3px #2271b1; -} - -.media-selection:after { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 25px; - background-image: linear-gradient(to left,#fff,rgba(255, 255, 255, 0)); -} - -.media-selection .attachment .filename { - display: none; -} - -/** - * Spinner - */ -.media-frame .spinner { - background: url(../images/spinner.gif) no-repeat; - background-size: 20px 20px; - float: right; - display: inline-block; - visibility: hidden; - opacity: 0.7; - filter: alpha(opacity=70); - width: 20px; - height: 20px; - margin: 0; - vertical-align: middle; -} - -.media-frame.mode-grid .spinner { - margin: 0; - float: none; - vertical-align: middle; -} - -.media-modal .media-toolbar .spinner { - float: none; - vertical-align: bottom; - margin: 0 0 5px 5px; -} - -.media-frame .instructions + .spinner.is-active { - vertical-align: middle; -} - -.media-frame .spinner.is-active { - visibility: visible; -} - -/** - * Attachment Details - */ -.attachment-details { - position: relative; - overflow: auto; -} - -.attachment-details .settings-save-status { - float: right; - text-transform: none; - font-weight: 400; -} - -.attachment-details .settings-save-status .spinner { - float: none; - margin-left: 5px; -} - -.attachment-details .settings-save-status .saved { - display: none; -} - -.attachment-details.save-waiting .settings-save-status .spinner { - visibility: visible; -} - -.attachment-details.save-complete .settings-save-status .saved { - display: inline-block; -} - -.attachment-info { - overflow: hidden; - min-height: 60px; - margin-bottom: 16px; - line-height: 1.5; - color: #646970; - border-bottom: 1px solid #dcdcde; - padding-bottom: 11px; -} - -.attachment-info .wp-media-wrapper { - margin-bottom: 8px; -} - -.attachment-info .wp-media-wrapper.wp-audio { - margin-top: 13px; -} - -.attachment-info .filename { - font-weight: 600; - color: #3c434a; - word-wrap: break-word; -} - -.attachment-info .thumbnail { - position: relative; - float: left; - max-width: 120px; - max-height: 120px; - margin-top: 5px; - margin-right: 10px; - margin-bottom: 5px; -} - -.uploading .attachment-info .thumbnail { - width: 120px; - height: 80px; - box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1); -} - -.uploading .attachment-info .media-progress-bar { - margin-top: 35px; -} - -.attachment-info .thumbnail-image:after { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); - overflow: hidden; -} - -.attachment-info .thumbnail img { - display: block; - max-width: 120px; - max-height: 120px; - margin: 0 auto; -} - -.attachment-info .details { - float: left; - font-size: 12px; - max-width: 100%; -} - -.attachment-info .edit-attachment, -.attachment-info .delete-attachment, -.attachment-info .trash-attachment, -.attachment-info .untrash-attachment { - display: block; - text-decoration: none; - white-space: nowrap; -} - -.attachment-details.needs-refresh .attachment-info .edit-attachment { - display: none; -} - -.attachment-info .edit-attachment { - display: block; -} - -.media-modal .delete-attachment, -.media-modal .trash-attachment, -.media-modal .untrash-attachment { - display: inline; - padding: 0; - color: #d63638; -} - -.media-modal .delete-attachment:hover, -.media-modal .delete-attachment:focus, -.media-modal .trash-attachment:hover, -.media-modal .trash-attachment:focus, -.media-modal .untrash-attachment:hover, -.media-modal .untrash-attachment:focus { - color: #d63638; -} - -/** - * Attachment Display Settings - */ -.attachment-display-settings { - width: 100%; - float: left; - overflow: hidden; -} - -.collection-settings { - overflow: hidden; -} - -.collection-settings .setting input[type="checkbox"] { - float: left; - margin-right: 8px; -} - -.collection-settings .setting span, /* Back-compat for pre-5.3 */ -.collection-settings .setting .name { - min-width: inherit; -} - -/** - * Image Editor - */ -.media-modal .imgedit-wrap { - position: static; -} - -.media-modal .imgedit-wrap .imgedit-panel-content { - padding: 16px 16px 0; - position: absolute; - top: 0; - right: 282px; - bottom: 0; - left: 0; - overflow: auto; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-modal .imgedit-wrap .imgedit-submit { - margin-bottom: 16px; -} - -.media-modal .imgedit-wrap .imgedit-settings { - background: #f6f7f7; - border-left: 1px solid #dcdcde; - padding: 20px 16px 0; - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 250px; - overflow: auto; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.media-modal .imgedit-wrap .imgedit-save-target { - margin: 8px 0 24px; -} - -.media-modal .imgedit-group { - background: none; - border: none; - border-bottom: 1px solid #dcdcde; - box-shadow: none; - margin: 0; - margin-bottom: 16px; - padding: 0; - padding-bottom: 16px; - position: relative; /* RTL fix, #WP29352 */ -} - -.media-modal .imgedit-group:last-of-type { - border: none; - margin: 0; - padding: 0; -} - -.media-modal .imgedit-group-top { - margin: 0; -} - -.media-modal .imgedit-group-top h2, -.media-modal .imgedit-group-top h2 .button-link { - display: inline-block; - text-transform: uppercase; - font-size: 12px; - color: #646970; - margin: 0; - margin-top: 3px; -} - -.media-modal .imgedit-group-top h2 a, -.media-modal .imgedit-group-top h2 .button-link { - text-decoration: none; - color: #646970; -} - -/* higher specificity than media.css */ -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle, -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:hover, -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:active { - border: 1px solid transparent; - margin: 0; - padding: 0; - background: transparent; - color: #2271b1; - font-size: 20px; - line-height: 1; - cursor: pointer; - box-sizing: content-box; - box-shadow: none; -} - -.wp-core-ui.media-modal .image-editor .imgedit-help-toggle:focus { - color: #2271b1; - border-color: #4f94d4; - box-shadow: 0 0 3px rgba(34, 113, 177, 0.8); - /* Only visible in Windows High Contrast mode */ - outline: 2px solid transparent; -} - -.wp-core-ui.media-modal .imgedit-group-top .dashicons-arrow-down.imgedit-help-toggle { - margin-top: -3px; -} - -.wp-core-ui.media-modal .image-editor h3 .imgedit-help-toggle { - margin-top: -2px; -} - -.media-modal .imgedit-help-toggled span.dashicons:before { - content: "\f142"; -} - -.media-modal .imgedit-thumbnail-preview { - margin: 10px 8px 0 0; -} - -.imgedit-thumbnail-preview-caption { - display: block; -} - -.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */ -.media-modal .imgedit-wrap .notice { - margin: 0; - margin-bottom: 16px; -} - -/** - * Embed from URL and Image Details - */ -.embed-url { - display: block; - position: relative; - padding: 16px; - margin: 0; - z-index: 250; - background: #fff; - font-size: 18px; -} - -.media-frame .embed-url input { - font-size: 18px; - line-height: 1.22222222; /* 22px */ - padding: 12px 40px 12px 14px; /* right padding to leave room for the spinner */ - width: 100%; - min-width: 200px; - box-shadow: inset 2px 2px 4px -2px rgba(0, 0, 0, 0.1); -} - -.media-frame .embed-url input::-ms-clear { - display: none; /* the "x" in IE 11 conflicts with the spinner */ -} - -.media-frame .embed-url .spinner { - position: absolute; - top: 32px; - right: 26px; -} - -.media-frame .embed-loading .embed-url .spinner { - visibility: visible; -} - -.embed-link-settings, -.embed-media-settings { - position: absolute; - top: 82px; - left: 0; - right: 0; - bottom: 0; - padding: 0 16px; - overflow: auto; -} - -.media-embed .embed-link-settings .link-text { - margin-top: 0; -} - -/* - * Implementation of bottom padding in overflow content differs across browsers. - * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 - */ -.embed-link-settings::after, -.embed-media-settings::after { - content: ""; - display: flex; - clear: both; - height: 24px; -} - -.media-embed .embed-link-settings { - /* avoid Firefox to give focus to the embed preview container parent */ - overflow: visible; -} - -.embed-preview img, -.embed-preview iframe, -.embed-preview embed, -.mejs-container video { - max-width: 100%; - vertical-align: middle; -} - -.embed-preview a { - display: inline-block; -} - -.embed-preview img { - display: block; - height: auto; -} - -.mejs-container:focus { - outline: 1px solid #4f94d4; - box-shadow: 0 0 2px 1px rgba(79, 148, 212, 0.8); -} - -.image-details .media-modal { - left: 140px; - right: 140px; -} - -.image-details .media-frame-title, -.image-details .media-frame-content, -.image-details .media-frame-router { - left: 0; -} - -.image-details .embed-media-settings { - top: 0; - overflow: visible; - padding: 0; -} - -.image-details .embed-media-settings::after { - content: none; -} - -.image-details .embed-media-settings, -.image-details .embed-media-settings div { - box-sizing: border-box; -} - -.image-details .column-settings { - background: #f6f7f7; - border-right: 1px solid #dcdcde; - min-height: 100%; - width: 55%; - position: absolute; - top: 0; - left: 0; -} - -.image-details .column-settings h2 { - margin: 20px; - padding-top: 20px; - border-top: 1px solid #dcdcde; - color: #1d2327; -} - -.image-details .column-image { - width: 45%; - position: absolute; - left: 55%; - top: 0; -} - -.image-details .image { - margin: 20px; -} - -.image-details .image img { - max-width: 100%; - max-height: 500px; -} - -.image-details .advanced-toggle { - padding: 0; - color: #646970; - text-transform: uppercase; - text-decoration: none; -} - -.image-details .advanced-toggle:hover, -.image-details .advanced-toggle:active { - color: #646970; -} - -.image-details .advanced-toggle:after { - font: normal 20px/1 dashicons; - speak: never; - vertical-align: top; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - content: "\f140"; - display: inline-block; - margin-top: -2px; -} - -.image-details .advanced-visible .advanced-toggle:after { - content: "\f142"; -} - -.image-details .custom-size label, /* Back-compat for pre-5.3 */ -.image-details .custom-size .custom-size-setting { - display: block; - float: left; -} - -.image-details .custom-size .custom-size-setting label { - float: none; -} - -.image-details .custom-size input { - width: 5em; -} - -.image-details .custom-size .sep { - float: left; - margin: 26px 6px 0; -} - -.image-details .custom-size .description { - margin-left: 0; -} - -.media-embed .thumbnail { - max-width: 100%; - max-height: 200px; - position: relative; - float: left; -} - -.media-embed .thumbnail img { - max-height: 200px; - display: block; -} - -.media-embed .thumbnail:after { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); - overflow: hidden; -} - -.media-embed .setting, -.media-embed .setting-group { - width: 100%; - margin: 10px 0; - float: left; - display: block; - clear: both; -} - -.media-embed .setting-group .setting:not(.checkbox-setting) { - margin: 0; -} - -.media-embed .setting.has-description { - margin-bottom: 5px; -} - -.media-embed .description { - clear: both; - font-style: normal; -} - -.media-embed .content-track + .description { - line-height: 1.4; - /* The !important needs to override a high specificity selector from wp-medialement.css */ - max-width: none !important; -} - -.media-embed .remove-track { - margin-bottom: 10px; -} - -.image-details .embed-media-settings .setting, -.image-details .embed-media-settings .setting-group { - float: none; - width: auto; -} - -.image-details .actions { - margin: 10px 0; -} - -.image-details .hidden { - display: none; -} - -.media-embed .setting input[type="text"], -.media-embed .setting textarea, -.media-embed fieldset { - display: block; - width: 100%; - max-width: 400px; -} - -.image-details .embed-media-settings .setting input[type="text"], -.image-details .embed-media-settings .setting textarea { - max-width: inherit; - width: 70%; -} - -.image-details .embed-media-settings .setting input.link-to-custom, -.image-details .embed-media-settings .link-target, -.image-details .embed-media-settings .custom-size, -.image-details .embed-media-settings .setting-group, -.image-details .description { - margin-left: 27%; - width: 70%; -} - -.image-details .description { - font-style: normal; - margin-top: 0; -} - -.image-details .embed-media-settings .link-target { - margin-top: 16px; -} - -.image-details .checkbox-label, -.audio-details .checkbox-label, -.video-details .checkbox-label { - vertical-align: baseline; -} - -.media-embed .setting input.hidden, -.media-embed .setting textarea.hidden { - display: none; -} - -.media-embed .setting span, /* Back-compat for pre-5.3 */ -.media-embed .setting .name, -.media-embed .setting-group .name { - display: inline-block; - font-size: 13px; - line-height: 1.84615384; - color: #646970; -} - -.media-embed .setting span { - display: block; /* Back-compat for pre-5.3 */ - width: 200px; /* Back-compat for pre-5.3 */ -} - -.image-details .embed-media-settings .setting span, /* Back-compat for pre-5.3 */ -.image-details .embed-media-settings .setting .name { - float: left; - width: 25%; - text-align: right; - margin: 8px 1% 0; - line-height: 1.1; -} - -/* Buttons group in IE 11. */ -.media-frame .setting-group .button-group, -.image-details .embed-media-settings .setting .button-group { - width: auto; -} - -.media-embed-sidebar { - position: absolute; - top: 0; - left: 440px; -} - -.advanced-section, -.link-settings { - margin-top: 10px; -} - -/** - * Button groups fix: can be removed together with the Back-compat for pre-5.3 - */ - .media-frame .setting .button-group { - display: flex; - margin: 0 !important; - max-width: none !important; - } - -/** - * Localization - */ -.rtl .media-modal, -.rtl .media-frame, -.rtl .media-frame .search, -.rtl .media-frame input[type="text"], -.rtl .media-frame input[type="password"], -.rtl .media-frame input[type="number"], -.rtl .media-frame input[type="search"], -.rtl .media-frame input[type="email"], -.rtl .media-frame input[type="url"], -.rtl .media-frame input[type="tel"], -.rtl .media-frame textarea, -.rtl .media-frame select { - font-family: Tahoma, sans-serif; -} - -:lang(he-il) .rtl .media-modal, -:lang(he-il) .rtl .media-frame, -:lang(he-il) .rtl .media-frame .search, -:lang(he-il) .rtl .media-frame input[type="text"], -:lang(he-il) .rtl .media-frame input[type="password"], -:lang(he-il) .rtl .media-frame input[type="number"], -:lang(he-il) .rtl .media-frame input[type="search"], -:lang(he-il) .rtl .media-frame input[type="email"], -:lang(he-il) .rtl .media-frame input[type="url"], -:lang(he-il) .rtl .media-frame textarea, -:lang(he-il) .rtl .media-frame select { - font-family: Arial, sans-serif; -} - -/** - * Responsive layout - */ -@media only screen and (max-width: 900px) { - .media-modal .media-frame-title { - height: 40px; - } - - .media-modal .media-frame-title h1 { - line-height: 2.22222222; - font-size: 18px; - } - - .media-modal-close { - width: 42px; - height: 42px; - } - - /* Drop-down menu */ - .media-frame .media-frame-title { - position: static; - padding: 0 44px; - text-align: center; - } - - .media-frame:not(.hide-menu) .media-frame-router, - .media-frame:not(.hide-menu) .media-frame-content, - .media-frame:not(.hide-menu) .media-frame-toolbar { - left: 0; - } - - .media-frame:not(.hide-menu) .media-frame-router { - /* 40 title + (40 - 6) menu toggle button + 6 spacing */ - top: 80px; - } - - .media-frame:not(.hide-menu) .media-frame-content { - /* 80 + room for the tabs */ - top: 114px; - } - - .media-frame.hide-router .media-frame-content { - top: 80px; - } - - .media-frame:not(.hide-menu) .media-frame-menu { - position: static; - width: 0; - } - - .media-frame:not(.hide-menu) .media-menu { - display: none; - width: auto; - max-width: 80%; - overflow: auto; - z-index: 2000; - top: 75px; - left: 50%; - transform: translateX(-50%); - right: auto; - bottom: auto; - padding: 5px 0; - border: 1px solid #c3c4c7; - } - - .media-frame:not(.hide-menu) .media-menu.visible { - display: block; - } - - .media-frame:not(.hide-menu) .media-menu > a { - padding: 12px 16px; - font-size: 16px; - } - - .media-frame:not(.hide-menu) .media-menu .separator { - margin: 5px 10px; - } - - /* Visually hide the menu heading keeping it available to assistive technologies. */ - .media-frame-menu-heading { - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - overflow: hidden; - padding: 0; - width: 1px; - word-wrap: normal !important; - } - - /* Reveal the menu toggle button. */ - .wp-core-ui .media-frame:not(.hide-menu) .button.media-frame-menu-toggle { - display: inline-flex; - align-items: center; - position: absolute; - left: 50%; - transform: translateX(-50%); - margin: -6px 0 0; - padding: 0 2px 0 12px; - font-size: 0.875rem; - font-weight: 600; - text-decoration: none; - background: transparent; - /* Only for IE11 to vertically align text within the inline-flex button */ - height: 0.1%; - /* Modern browsers */ - min-height: 40px; - } - - .wp-core-ui .button.media-frame-menu-toggle:hover, - .wp-core-ui .button.media-frame-menu-toggle:active { - background: transparent; - transform: none; - } - - .wp-core-ui .button.media-frame-menu-toggle:focus { - /* Only visible in Windows High Contrast mode */ - outline: 1px solid transparent; - } - /* End drop-down menu */ - - .media-sidebar { - width: 230px; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline, - .attachments-browser .media-toolbar, - .attachments-browser .attachments-wrapper, - .attachments-browser.has-load-more .attachments-wrapper { - right: 262px; - } - - .media-sidebar .setting, - .attachment-details .setting { - margin: 6px 0; - } - - .media-sidebar .setting input, - .media-sidebar .setting textarea, - .media-sidebar .setting .name, - .attachment-details .setting input, - .attachment-details .setting textarea, - .attachment-details .setting .name, - .compat-item label span { - float: none; - display: inline-block; - } - - .media-sidebar .setting span, /* Back-compat for pre-5.3 */ - .attachment-details .setting span, /* Back-compat for pre-5.3 */ - .media-sidebar .checkbox-label-inline { - float: none; - } - - .media-sidebar .setting .select-label-inline { - display: inline; - } - - .media-sidebar .setting .name, - .media-sidebar .checkbox-label-inline, - .attachment-details .setting .name, - .compat-item label span { - text-align: inherit; - min-height: 16px; - margin: 0; - padding: 8px 2px 2px; - } - - /* Needs high specificity. */ - .media-sidebar .setting .copy-to-clipboard-container, - .attachment-details .attachment-info .copy-to-clipboard-container { - margin-left: 0; - padding-top: 0; - } - - .media-sidebar .setting .copy-attachment-url, - .attachment-details .attachment-info .copy-attachment-url { - margin: 0 1px; - } - - .media-sidebar .setting .value, - .attachment-details .setting .value { - float: none; - width: auto; - } - - .media-sidebar .setting input[type="text"], - .media-sidebar .setting input[type="password"], - .media-sidebar .setting input[type="email"], - .media-sidebar .setting input[type="number"], - .media-sidebar .setting input[type="search"], - .media-sidebar .setting input[type="tel"], - .media-sidebar .setting input[type="url"], - .media-sidebar .setting textarea, - .media-sidebar .setting select, - .attachment-details .setting input[type="text"], - .attachment-details .setting input[type="password"], - .attachment-details .setting input[type="email"], - .attachment-details .setting input[type="number"], - .attachment-details .setting input[type="search"], - .attachment-details .setting input[type="tel"], - .attachment-details .setting input[type="url"], - .attachment-details .setting textarea, - .attachment-details .setting select, - .attachment-details .setting + .description { - float: none; - width: 98%; - max-width: none; - height: auto; - } - - .media-frame .media-toolbar input[type="search"] { - line-height: 2.25; /* 36px */ - } - - .media-sidebar .setting select.columns, - .attachment-details .setting select.columns { - width: auto; - } - - .media-frame input, - .media-frame textarea, - .media-frame .search { - padding: 3px 6px; - } - - .wp-admin .media-frame select { - min-height: 40px; - font-size: 16px; - line-height: 1.625; - padding: 5px 24px 5px 8px; - } - - .image-details .column-image { - width: 30%; - left: 70%; - } - - .image-details .column-settings { - width: 70%; - } - - .image-details .media-modal { - left: 30px; - right: 30px; - } - - .image-details .embed-media-settings .setting, - .image-details .embed-media-settings .setting-group { - margin: 20px; - } - - .image-details .embed-media-settings .setting span, /* Back-compat for pre-5.3 */ - .image-details .embed-media-settings .setting .name { - float: none; - text-align: left; - width: 100%; - margin-bottom: 4px; - margin-left: 0; - } - - .media-modal .legend-inline { - position: static; - transform: none; - margin-left: 0; - margin-bottom: 6px; - } - - .image-details .embed-media-settings .setting-group .setting { - margin-bottom: 0; - } - - .image-details .embed-media-settings .setting input.link-to-custom, - .image-details .embed-media-settings .setting input[type="text"], - .image-details .embed-media-settings .setting textarea { - width: 100%; - margin-left: 0; - } - - .image-details .embed-media-settings .setting.has-description { - margin-bottom: 5px; - } - - .image-details .description { - width: auto; - margin: 0 20px; - } - - .image-details .embed-media-settings .custom-size { - margin-left: 20px; - } - - .collection-settings .setting input[type="checkbox"] { - float: none; - margin-top: 0; - } - - .media-selection { - min-width: 120px; - } - - .media-selection:after { - background: none; - } - - .media-selection .attachments { - display: none; - } - - .media-modal .attachments-browser .media-toolbar .search { - max-width: 100%; - height: auto; - float: right; - } - - .media-modal .attachments-browser .media-toolbar .attachment-filters { - height: auto; - } - - /* Text inputs need to be 16px, or they force zooming on iOS */ - .media-frame input[type="text"], - .media-frame input[type="password"], - .media-frame input[type="number"], - .media-frame input[type="search"], - .media-frame input[type="email"], - .media-frame input[type="url"], - .media-frame textarea, - .media-frame select { - font-size: 16px; - } - - .media-frame .media-toolbar input[type="search"] { - line-height: 2.3755; /* 38px */ - } - - .media-modal .media-toolbar .spinner { - margin-bottom: 10px; - } -} - -@media screen and (max-width: 782px) { - .attachments-browser .media-toolbar { - height: 82px; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline { - top: 82px; - } - - .media-frame-toolbar .media-toolbar { - bottom: -54px; - } - - .mode-grid .attachments-browser .media-toolbar-primary { - display: block; - } - - .media-sidebar .copy-to-clipboard-container .success, - .attachment-details .copy-to-clipboard-container .success { - font-size: 14px; - line-height: 2.71428571; - } -} - -/* Responsive on portrait and landscape */ -@media only screen and (max-width: 640px), screen and (max-height: 400px) { - /* Full-bleed modal */ - .media-modal, - .image-details .media-modal { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - } - - .media-modal-backdrop { - position: fixed; - } - - .media-sidebar { - z-index: 1900; - max-width: 70%; - bottom: 120%; - box-sizing: border-box; - padding-bottom: 0; - } - - .media-sidebar.visible { - bottom: 0; - } - - .attachments-browser .attachments, - .attachments-browser .uploader-inline, - .attachments-browser .media-toolbar, - .media-frame-content .attachments-browser .attachments-wrapper { - right: 0; - } - - .attachments-browser .attachments-wrapper { - padding-top: 12px; - } - - .image-details .media-frame-title { - display: block; - top: 0; - font-size: 14px; - } - - .image-details .column-image, - .image-details .column-settings { - width: 100%; - position: relative; - left: 0; - } - - .image-details .column-settings { - padding: 4px 0; - } - - /* Media tabs on the top */ - .media-frame-content .media-toolbar .instructions { - display: none; - } - - /* Change margin direction on load more button in responsive views. */ - .load-more-wrapper .load-more-jump { - margin: 12px 0 0; - } - -} - -@media only screen and (min-width: 901px) and (max-height: 400px) { - .media-menu, - .media-frame:not(.hide-menu) .media-menu { - top: 0; - padding-top: 44px; - } - - /* Change margin direction on load more button in responsive views. */ - .load-more-wrapper .load-more-jump { - margin: 12px 0 0; - } - -} - -@media only screen and (max-width: 480px) { - .wp-core-ui.wp-customizer .media-button { - margin-top: 13px; - } -} - -/** - * HiDPI Displays - */ -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - - .wp-core-ui .media-modal-icon { - background-image: url(../images/uploader-icons-2x.png); - background-size: 134px 15px; - } - - .media-frame .spinner { - background-image: url(../images/spinner-2x.gif); - } -} - -.media-frame-content[data-columns="1"] .attachment { - width: 100%; -} - -.media-frame-content[data-columns="2"] .attachment { - width: 50%; -} - -.media-frame-content[data-columns="3"] .attachment { - width: 33.33%; -} - -.media-frame-content[data-columns="4"] .attachment { - width: 25%; -} - -.media-frame-content[data-columns="5"] .attachment { - width: 20%; -} - -.media-frame-content[data-columns="6"] .attachment { - width: 16.66%; -} - -.media-frame-content[data-columns="7"] .attachment { - width: 14.28%; -} - -.media-frame-content[data-columns="8"] .attachment { - width: 12.5%; -} - -.media-frame-content[data-columns="9"] .attachment { - width: 11.11%; -} - -.media-frame-content[data-columns="10"] .attachment { - width: 10%; -} - -.media-frame-content[data-columns="11"] .attachment { - width: 9.09%; -} - -.media-frame-content[data-columns="12"] .attachment { - width: 8.33%; -} -/*! This file is auto-generated */ -.wp-pointer-content{padding:0 0 10px;position:relative;font-size:13px;background:#fff;border:1px solid #c3c4c7;box-shadow:0 3px 6px rgba(0,0,0,.08)}.wp-pointer-content h3{position:relative;margin:-1px -1px 5px;padding:15px 60px 14px 18px;border:1px solid #2271b1;border-bottom:none;line-height:1.4;font-size:14px;color:#fff;background:#2271b1}.wp-pointer-content h3:before{background:#fff;border-radius:50%;color:#2271b1;content:"\f227";font:normal 20px/1.6 dashicons;position:absolute;top:8px;right:15px;speak:never;text-align:center;width:32px;height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-pointer-content h4{margin:1.33em 20px 1em;font-size:1.15em}.wp-pointer-content p{padding:0 20px}.wp-pointer-buttons{margin:0;padding:5px 15px;overflow:auto}.wp-pointer-buttons a{float:left;display:inline-block;text-decoration:none}.wp-pointer-buttons a.close{padding-right:3px;position:relative}.wp-pointer-buttons a.close:before{background:0 0;color:#787c82;content:"\f153";display:block!important;font:normal 16px/1 dashicons;speak:never;margin:1px 0;text-align:center;-webkit-font-smoothing:antialiased!important;width:10px;height:100%;position:absolute;right:-15px;top:1px}.wp-pointer-buttons a.close:hover:before{color:#d63638}.wp-pointer-arrow,.wp-pointer-arrow-inner{position:absolute;width:0;height:0}.wp-pointer-arrow{z-index:10;width:0;height:0;border:0 solid transparent}.wp-pointer-arrow-inner{z-index:20}.wp-pointer-top,.wp-pointer-undefined{padding-top:13px}.wp-pointer-bottom{margin-top:-13px;padding-bottom:13px}.wp-pointer-left{padding-left:13px}.wp-pointer-right{margin-left:-13px;padding-right:13px}.wp-pointer-bottom .wp-pointer-arrow,.wp-pointer-top .wp-pointer-arrow,.wp-pointer-undefined .wp-pointer-arrow{right:50px}.wp-pointer-left .wp-pointer-arrow,.wp-pointer-right .wp-pointer-arrow{top:50%;margin-top:-15px}.wp-pointer-top .wp-pointer-arrow,.wp-pointer-undefined .wp-pointer-arrow{top:0;border-width:0 13px 13px;border-bottom-color:#2271b1}.wp-pointer-top .wp-pointer-arrow-inner,.wp-pointer-undefined .wp-pointer-arrow-inner{top:1px;margin-right:-13px;margin-top:-13px;border:13px solid transparent;border-bottom-color:#2271b1;display:block;content:" "}.wp-pointer-bottom .wp-pointer-arrow{bottom:0;border-width:13px 13px 0;border-top-color:#c3c4c7}.wp-pointer-bottom .wp-pointer-arrow-inner{bottom:1px;margin-right:-13px;margin-bottom:-13px;border:13px solid transparent;border-top-color:#fff;display:block;content:" "}.wp-pointer-left .wp-pointer-arrow{left:0;border-width:13px 13px 13px 0;border-right-color:#c3c4c7}.wp-pointer-left .wp-pointer-arrow-inner{left:1px;margin-left:-13px;margin-top:-13px;border:13px solid transparent;border-right-color:#fff;display:block;content:" "}.wp-pointer-right .wp-pointer-arrow{right:0;border-width:13px 0 13px 13px;border-left-color:#c3c4c7}.wp-pointer-right .wp-pointer-arrow-inner{right:1px;margin-right:-13px;margin-top:-13px;border:13px solid transparent;border-left-color:#fff;display:block;content:" "}.wp-pointer.arrow-bottom .wp-pointer-content{margin-bottom:-45px}.wp-pointer.arrow-bottom .wp-pointer-arrow{top:100%;margin-top:-30px}@media screen and (max-width:782px){.wp-pointer{display:none}}/*! This file is auto-generated */ -/*! - * jQuery UI CSS Framework 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/theming/ - */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;right:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;right:0;width:100%;height:100%}/*! - * jQuery UI Resizable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;right:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;right:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-button{display:inline-block;text-decoration:none;font-size:13px;line-height:2;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;border-radius:3px;white-space:nowrap;box-sizing:border-box;color:#50575e;border-color:#c3c4c7;background:#f6f7f7;box-shadow:0 1px 0 #c3c4c7;vertical-align:top}.ui-button:active,.ui-button:focus{outline:0}.ui-button::-moz-focus-inner{border-width:0;border-style:none;padding:0}.ui-button:focus,.ui-button:hover{background:#f6f7f7;border-color:#8c8f94;color:#1d2327}.ui-button:focus{border-color:#4f94d4;box-shadow:0 0 3px rgba(34,113,177,.8)}.ui-button:active{background:#f0f0f1;border-color:#8c8f94;box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.ui-button:disabled,.ui-button[disabled]{color:#a7aaad!important;border-color:#dcdcde!important;background:#f6f7f7!important;box-shadow:none!important;text-shadow:0 1px 0 #fff!important;cursor:default;transform:none!important}@media screen and (max-width:782px){.ui-button{padding:6px 14px;line-height:normal;font-size:14px;vertical-align:middle;height:auto;margin-bottom:4px}}.ui-dialog{position:absolute;top:0;right:0;z-index:100102;background-color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.3);overflow:hidden}.ui-dialog-titlebar{background:#fff;border-bottom:1px solid #dcdcde;height:36px;font-size:18px;font-weight:600;line-height:2;padding:0 16px 0 36px}.ui-button.ui-dialog-titlebar-close{background:0 0;border:none;box-shadow:none;color:#646970;cursor:pointer;display:block;padding:0;position:absolute;top:0;left:0;width:36px;height:36px;text-align:center;border-radius:0;overflow:hidden}.ui-dialog-titlebar-close:before{font:normal 20px/1 dashicons;vertical-align:top;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.8;width:36px;height:36px;content:"\f158"}.ui-button.ui-dialog-titlebar-close:focus,.ui-button.ui-dialog-titlebar-close:hover{color:#135e96}.ui-button.ui-dialog-titlebar-close:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);outline:2px solid transparent;outline-offset:-2px}.ui-dialog-content{padding:16px;overflow:auto}.ui-dialog-buttonpane{background:#fff;border-top:1px solid #dcdcde;padding:16px}.ui-dialog-buttonpane .ui-button{margin-right:16px}.ui-dialog-buttonpane .ui-dialog-buttonset{float:left}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-widget-overlay{position:fixed;top:0;right:0;left:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100101}html { - --wp-admin--admin-bar--height: 32px; - scroll-padding-top: var(--wp-admin--admin-bar--height); -} - -#wpadminbar * { - height: auto; - width: auto; - margin: 0; - padding: 0; - position: static; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - font-size: 13px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.46153846; - border-radius: 0; - box-sizing: content-box; - transition: none; - -webkit-font-smoothing: subpixel-antialiased; /* Prevent Safari from switching to standard antialiasing on hover */ - -moz-osx-font-smoothing: auto; /* Prevent Firefox from inheriting from themes that use other values */ -} - -.rtl #wpadminbar * { - font-family: Tahoma, sans-serif; -} - -html:lang(he-il) .rtl #wpadminbar * { - font-family: Arial, sans-serif; -} - -#wpadminbar .ab-empty-item { - cursor: default; -} - -#wpadminbar .ab-empty-item, -#wpadminbar a.ab-item, -#wpadminbar > #wp-toolbar span.ab-label, -#wpadminbar > #wp-toolbar span.noticon { - color: #f0f0f1; -} - -#wpadminbar #wp-admin-bar-site-name a.ab-item, -#wpadminbar #wp-admin-bar-my-sites a.ab-item { - white-space: nowrap; -} - -#wpadminbar ul li:before, -#wpadminbar ul li:after { - content: normal; -} - -#wpadminbar a, -#wpadminbar a:hover, -#wpadminbar a img, -#wpadminbar a img:hover { - border: none; - text-decoration: none; - background: none; - box-shadow: none; -} - -#wpadminbar a:focus, -#wpadminbar a:active, -#wpadminbar input[type="text"], -#wpadminbar input[type="password"], -#wpadminbar input[type="number"], -#wpadminbar input[type="search"], -#wpadminbar input[type="email"], -#wpadminbar input[type="url"], -#wpadminbar select, -#wpadminbar textarea, -#wpadminbar div { - box-shadow: none; -} - -#wpadminbar a:focus { - /* Inherits transparent outline only visible in Windows High Contrast mode */ - outline-offset: -1px; -} - -#wpadminbar { - direction: ltr; - color: #c3c4c7; - font-size: 13px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.46153846; - height: 32px; - position: fixed; - top: 0; - left: 0; - width: 100%; - min-width: 600px; /* match the min-width of the body in wp-admin/css/common.css */ - z-index: 99999; - background: #1d2327; -} - -#wpadminbar .ab-sub-wrapper, -#wpadminbar ul, -#wpadminbar ul li { - background: none; - clear: none; - list-style: none; - margin: 0; - padding: 0; - position: relative; - text-indent: 0; - z-index: 99999; -} - -#wpadminbar ul#wp-admin-bar-root-default>li { - margin-right: 0; -} - -#wpadminbar .quicklinks ul { - text-align: left; -} - -#wpadminbar li { - float: left; -} - -#wpadminbar .ab-empty-item { - outline: none; -} - -#wpadminbar .quicklinks .ab-top-secondary > li { - float: right; -} - -#wpadminbar .quicklinks a, -#wpadminbar .quicklinks .ab-empty-item, -#wpadminbar .shortlink-input { - height: 32px; - display: block; - padding: 0 10px; - margin: 0; -} - -#wpadminbar .quicklinks > ul > li > a { - padding: 0 8px 0 7px; -} - -#wpadminbar .menupop .ab-sub-wrapper, -#wpadminbar .shortlink-input { - margin: 0; - padding: 0; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - background: #2c3338; - display: none; - position: absolute; - float: none; -} - -#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - min-width: 100%; -} - -#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper { - right: 0; - left: auto; -} - -#wpadminbar .ab-submenu { - padding: 6px 0; -} - -#wpadminbar .selected .shortlink-input { - display: block; -} - -#wpadminbar .quicklinks .menupop ul li { - float: none; -} - -#wpadminbar .quicklinks .menupop ul li a strong { - font-weight: 600; -} - -#wpadminbar .quicklinks .menupop ul li .ab-item, -#wpadminbar .quicklinks .menupop ul li a strong, -#wpadminbar .quicklinks .menupop.hover ul li .ab-item, -#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, -#wpadminbar .shortlink-input { - line-height: 2; - height: 26px; - white-space: nowrap; - min-width: 140px; -} - -#wpadminbar .shortlink-input { - width: 200px; -} - -#wpadminbar.nojs li:hover > .ab-sub-wrapper, -#wpadminbar li.hover > .ab-sub-wrapper { - display: block; -} - -#wpadminbar .menupop li:hover > .ab-sub-wrapper, -#wpadminbar .menupop li.hover > .ab-sub-wrapper { - margin-left: 100%; - margin-top: -32px; -} - -#wpadminbar .ab-top-secondary .menupop li:hover > .ab-sub-wrapper, -#wpadminbar .ab-top-secondary .menupop li.hover > .ab-sub-wrapper { - margin-left: 0; - left: inherit; - right: 100%; -} - -#wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus, -#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, -#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item, -#wpadminbar .ab-top-menu > li.hover > .ab-item { - background: #2c3338; - color: #72aee6; -} - -#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label, -#wpadminbar > #wp-toolbar li.hover span.ab-label, -#wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label { - color: #72aee6; -} - -#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon, -#wpadminbar .ab-icon, -#wpadminbar .ab-item:before, -.wp-admin-bar-arrow { - position: relative; - float: left; - font: normal 20px/1 dashicons; - speak: never; - padding: 4px 0; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - background-image: none !important; - margin-right: 6px; -} - -#wpadminbar .ab-icon:before, -#wpadminbar .ab-item:before, -#wpadminbar #adminbarsearch:before { - color: #a7aaad; - color: rgba(240, 246, 252, 0.6); -} - -#wpadminbar .ab-icon:before, -#wpadminbar .ab-item:before, -#wpadminbar #adminbarsearch:before { - position: relative; - transition: color .1s ease-in-out; -} - -#wpadminbar .ab-label { - display: inline-block; - height: 32px; -} - -#wpadminbar .ab-submenu .ab-item { - color: #c3c4c7; - color: rgba(240, 246, 252, 0.7); -} - -#wpadminbar .quicklinks .menupop ul li a, -#wpadminbar .quicklinks .menupop ul li a strong, -#wpadminbar .quicklinks .menupop.hover ul li a, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a { - color: #c3c4c7; - color: rgba(240, 246, 252, 0.7); -} - -#wpadminbar .quicklinks .menupop ul li a:hover, -#wpadminbar .quicklinks .menupop ul li a:focus, -#wpadminbar .quicklinks .menupop ul li a:hover strong, -#wpadminbar .quicklinks .menupop ul li a:focus strong, -#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a, -#wpadminbar .quicklinks .menupop.hover ul li a:hover, -#wpadminbar .quicklinks .menupop.hover ul li a:focus, -#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover, -#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus, -#wpadminbar li:hover .ab-icon:before, -#wpadminbar li:hover .ab-item:before, -#wpadminbar li a:focus .ab-icon:before, -#wpadminbar li .ab-item:focus:before, -#wpadminbar li .ab-item:focus .ab-icon:before, -#wpadminbar li.hover .ab-icon:before, -#wpadminbar li.hover .ab-item:before, -#wpadminbar li:hover #adminbarsearch:before, -#wpadminbar li #adminbarsearch.adminbar-focused:before { - color: #72aee6; -} - -#wpadminbar.mobile .quicklinks .ab-icon:before, -#wpadminbar.mobile .quicklinks .ab-item:before { - color: #c3c4c7; -} - -#wpadminbar.mobile .quicklinks .hover .ab-icon:before, -#wpadminbar.mobile .quicklinks .hover .ab-item:before { - color: #72aee6; -} - -#wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow:before, -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before { - position: absolute; - font: normal 17px/1 dashicons; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -#wpadminbar .menupop .menupop > .ab-item { - display: block; - padding-right: 2em; -} - -#wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow:before { - top: 1px; - right: 10px; - padding: 4px 0; - content: "\f139"; - color: inherit; -} - -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item { - padding-left: 2em; - padding-right: 1em; -} - -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item .wp-admin-bar-arrow:before { - top: 1px; - left: 6px; - content: "\f141"; -} - -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary { - display: block; - position: relative; - right: auto; - margin: 0; - box-shadow: none; -} - -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary, -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu { - background: #3c434a; -} - -#wpadminbar .quicklinks .menupop .ab-sub-secondary > li > a:hover, -#wpadminbar .quicklinks .menupop .ab-sub-secondary > li .ab-item:focus a { - color: #72aee6; -} - -#wpadminbar .quicklinks a span#ab-updates { - background: #f0f0f1; - color: #2c3338; - display: inline; - padding: 2px 5px; - font-size: 10px; - font-weight: 600; - border-radius: 10px; -} - -#wpadminbar .quicklinks a:hover span#ab-updates { - background: #fff; - color: #000; -} - -#wpadminbar .ab-top-secondary { - float: right; -} - -#wpadminbar ul li:last-child, -#wpadminbar ul li:last-child .ab-item { - box-shadow: none; -} - -/** - * Recovery Mode - */ -#wpadminbar #wp-admin-bar-recovery-mode { - color: #fff; - background-color: #d63638; -} - -#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover >.ab-item, -#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus, -#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item, -#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus { - color: #fff; - background-color: #d63638; -} - -/** - * My Account - */ -#wp-admin-bar-my-account > ul { - min-width: 198px; -} - -#wp-admin-bar-my-account:not(.with-avatar) > .ab-item { - display: inline-block; -} - -#wp-admin-bar-my-account > .ab-item:before { - content: "\f110"; - top: 2px; - float: right; - margin-left: 6px; - margin-right: 0; -} - -#wp-admin-bar-my-account.with-avatar > .ab-item:before { - display: none; - content: none; -} - -#wp-admin-bar-my-account.with-avatar > ul { - min-width: 270px; -} - -#wpadminbar #wp-admin-bar-user-actions > li { - margin-left: 16px; - margin-right: 16px; -} - -#wpadminbar #wp-admin-bar-user-actions.ab-submenu { - padding: 6px 0 12px; -} - -#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { - margin-left: 88px; -} - -#wpadminbar #wp-admin-bar-user-info { - margin-top: 6px; - margin-bottom: 15px; - height: auto; - background: none; -} - -#wp-admin-bar-user-info .avatar { - position: absolute; - left: -72px; - top: 4px; - width: 64px; - height: 64px; -} - -#wpadminbar #wp-admin-bar-user-info a { - background: none; - height: auto; -} - -#wpadminbar #wp-admin-bar-user-info span { - background: none; - padding: 0; - height: 18px; -} - -#wpadminbar #wp-admin-bar-user-info .display-name, -#wpadminbar #wp-admin-bar-user-info .username { - display: block; -} - -#wpadminbar #wp-admin-bar-user-info .username { - color: #a7aaad; - font-size: 11px; -} - -#wpadminbar #wp-admin-bar-my-account.with-avatar > .ab-empty-item img, -#wpadminbar #wp-admin-bar-my-account.with-avatar > a img { - width: auto; - height: 16px; - padding: 0; - border: 1px solid #8c8f94; - background: #f0f0f1; - line-height: 1.84615384; - vertical-align: middle; - margin: -4px 0 0 6px; - float: none; - display: inline; -} - -/** - * WP Logo - */ -#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon { - width: 15px; - height: 20px; - margin-right: 0; - padding: 6px 0 5px; -} - -#wpadminbar #wp-admin-bar-wp-logo > .ab-item { - padding: 0 7px; -} - -#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before { - content: "\f120"; - top: 2px; -} - -/* - * My Sites & Site Title - */ -#wpadminbar .quicklinks li .blavatar { - display: inline-block; - vertical-align: middle; - font: normal 16px/1 dashicons !important; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: #f0f0f1; -} - -#wpadminbar .quicklinks li a:hover .blavatar, -#wpadminbar .quicklinks li a:focus .blavatar, -#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a .blavatar { - color: #72aee6; -} - -#wpadminbar .quicklinks li img.blavatar, -#wpadminbar .quicklinks li div.blavatar:before { - height: 16px; - width: 16px; - margin: 0 8px 2px -2px; -} - -#wpadminbar .quicklinks li div.blavatar:before { - content: "\f120"; - display: inline-block; -} - -#wpadminbar #wp-admin-bar-appearance { - margin-top: -12px; -} - -#wpadminbar #wp-admin-bar-my-sites > .ab-item:before, -#wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f541"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-site-editor > .ab-item:before { - content: "\f100"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-customize > .ab-item:before { - content: "\f540"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-edit > .ab-item:before { - content: "\f464"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f226"; -} - -.wp-admin #wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f102"; -} - - - -/** - * Comments - */ -#wpadminbar #wp-admin-bar-comments .ab-icon { - margin-right: 6px; -} - -#wpadminbar #wp-admin-bar-comments .ab-icon:before { - content: "\f101"; - top: 3px; -} - -#wpadminbar #wp-admin-bar-comments .count-0 { - opacity: .5; -} - -/** - * New Content - */ -#wpadminbar #wp-admin-bar-new-content .ab-icon:before { - content: "\f132"; - top: 4px; -} - -/** - * Updates - */ -#wpadminbar #wp-admin-bar-updates .ab-icon:before { - content: "\f463"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before { - display: inline-block; - animation: rotation 2s infinite linear; -} - -@media (prefers-reduced-motion: reduce) { - #wpadminbar #wp-admin-bar-updates.spin .ab-icon:before { - animation: none; - } -} - -/** - * Search - */ - -#wpadminbar #wp-admin-bar-search .ab-item { - padding: 0; - background: transparent; -} - -#wpadminbar #adminbarsearch { - position: relative; - height: 32px; - padding: 0 2px; - z-index: 1; -} - -#wpadminbar #adminbarsearch:before { - position: absolute; - top: 6px; - left: 5px; - z-index: 20; - font: normal 20px/1 dashicons !important; - content: "\f179"; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -/* The admin bar search field needs to reset many styles that might be inherited from the active Theme CSS. See ticket #40313. */ -#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input { - display: inline-block; - float: none; - position: relative; - z-index: 30; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 1.84615384; - text-indent: 0; - height: 24px; - width: 24px; - max-width: none; - padding: 0 3px 0 24px; - margin: 0; - color: #c3c4c7; - background-color: rgba(255, 255, 255, 0); - border: none; - outline: none; - cursor: pointer; - box-shadow: none; - box-sizing: border-box; - transition-duration: 400ms; - transition-property: width, background; - transition-timing-function: ease; -} - -#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus { - z-index: 10; - color: #000; - width: 200px; - background-color: rgba(255, 255, 255, 0.9); - cursor: text; - border: 0; -} - -#wpadminbar #adminbarsearch .adminbar-button { - display: none; -} - -/** - * Customize support classes - */ -.no-customize-support .hide-if-no-customize, -.customize-support .hide-if-customize, -.no-customize-support #wpadminbar .hide-if-no-customize, -.no-customize-support.wp-core-ui .hide-if-no-customize, -.no-customize-support .wp-core-ui .hide-if-no-customize, -.customize-support #wpadminbar .hide-if-customize, -.customize-support.wp-core-ui .hide-if-customize, -.customize-support .wp-core-ui .hide-if-customize { - display: none; -} - -/* Skip link */ -#wpadminbar .screen-reader-text, -#wpadminbar .screen-reader-text span { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -#wpadminbar .screen-reader-shortcut { - position: absolute; - top: -1000em; -} - -#wpadminbar .screen-reader-shortcut:focus { - left: 6px; - top: 7px; - height: auto; - width: auto; - display: block; - font-size: 14px; - font-weight: 600; - padding: 15px 23px 14px; - background: #f0f0f1; - color: #2271b1; - z-index: 100000; - line-height: normal; - text-decoration: none; - box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); -} - -@media screen and (max-width: 782px) { - html { - --wp-admin--admin-bar--height: 46px; - } - - /* Toolbar Touchification*/ - html #wpadminbar { - height: 46px; - min-width: 240px; /* match the min-width of the body in wp-admin/css/common.css */ - } - - #wpadminbar * { - font-size: 14px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.28571428; - } - - #wpadminbar .quicklinks > ul > li > a, - #wpadminbar .quicklinks .ab-empty-item { - padding: 0; - height: 46px; - line-height: 3.28571428; - width: auto; - } - - #wpadminbar .ab-icon { - font: 40px/1 dashicons !important; - margin: 0; - padding: 0; - width: 52px; - height: 46px; - text-align: center; - } - - #wpadminbar .ab-icon:before { - text-align: center; - } - - #wpadminbar .ab-submenu { - padding: 0; - } - - #wpadminbar #wp-admin-bar-site-name a.ab-item, - #wpadminbar #wp-admin-bar-my-sites a.ab-item, - #wpadminbar #wp-admin-bar-my-account a.ab-item { - text-overflow: clip; - } - - #wpadminbar .quicklinks .menupop ul li .ab-item, - #wpadminbar .quicklinks .menupop ul li a strong, - #wpadminbar .quicklinks .menupop.hover ul li .ab-item, - #wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, - #wpadminbar .shortlink-input { - line-height: 1.6; - } - - #wpadminbar .ab-label { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; - } - - #wpadminbar .menupop li:hover > .ab-sub-wrapper, - #wpadminbar .menupop li.hover > .ab-sub-wrapper { - margin-top: -46px; - } - - #wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .menupop > .ab-item { - padding-right: 30px; - } - - #wpadminbar .menupop .menupop > .ab-item:before { - top: 10px; - right: 6px; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper .ab-item { - font-size: 16px; - padding: 8px 16px; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper a:empty { - display: none; - } - - /* WP logo */ - #wpadminbar #wp-admin-bar-wp-logo > .ab-item { - padding: 0; - } - - #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon { - padding: 0; - width: 52px; - height: 46px; - text-align: center; - vertical-align: top; - } - - #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before { - font: 28px/1 dashicons !important; - top: -3px; - } - - #wpadminbar .ab-icon, - #wpadminbar .ab-item:before { - padding: 0; - } - - /* My Sites and "Site Title" menu */ - #wpadminbar #wp-admin-bar-my-sites > .ab-item, - #wpadminbar #wp-admin-bar-site-name > .ab-item, - #wpadminbar #wp-admin-bar-site-editor > .ab-item, - #wpadminbar #wp-admin-bar-customize > .ab-item, - #wpadminbar #wp-admin-bar-edit > .ab-item, - #wpadminbar #wp-admin-bar-my-account > .ab-item { - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - width: 52px; - padding: 0; - color: #a7aaad; /* @todo not needed? this text is hidden */ - position: relative; - } - - #wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon, - #wpadminbar .ab-icon, - #wpadminbar .ab-item:before { - padding: 0; - margin-right: 0; - } - - #wpadminbar #wp-admin-bar-edit > .ab-item:before, - #wpadminbar #wp-admin-bar-my-sites > .ab-item:before, - #wpadminbar #wp-admin-bar-site-name > .ab-item:before, - #wpadminbar #wp-admin-bar-site-editor > .ab-item:before, - #wpadminbar #wp-admin-bar-customize > .ab-item:before, - #wpadminbar #wp-admin-bar-my-account > .ab-item:before { - display: block; - text-indent: 0; - font: normal 32px/1 dashicons; - speak: never; - top: 7px; - width: 52px; - text-align: center; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } - - #wpadminbar #wp-admin-bar-appearance { - margin-top: 0; - } - - #wpadminbar .quicklinks li .blavatar:before { - display: none; - } - - /* Search */ - #wpadminbar #wp-admin-bar-search { - display: none; - } - - /* New Content */ - #wpadminbar #wp-admin-bar-new-content .ab-icon:before { - top: 0; - line-height: 1.33333333; - height: 46px !important; - text-align: center; - width: 52px; - display: block; - } - - /* Updates */ - #wpadminbar #wp-admin-bar-updates { - text-align: center; - } - - #wpadminbar #wp-admin-bar-updates .ab-icon:before { - top: 3px; - } - - /* Comments */ - #wpadminbar #wp-admin-bar-comments .ab-icon { - margin: 0; - } - - #wpadminbar #wp-admin-bar-comments .ab-icon:before { - display: block; - font-size: 34px; - height: 46px; - line-height: 1.38235294; - top: 0; - } - - /* My Account */ - #wpadminbar #wp-admin-bar-my-account > a { - position: relative; - white-space: nowrap; - text-indent: 150%; /* More than 100% indention is needed since this element has padding */ - width: 28px; - padding: 0 10px; - overflow: hidden; /* Prevent link text from forcing horizontal scrolling on mobile */ - } - - #wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img { - position: absolute; - top: 13px; - right: 10px; - width: 26px; - height: 26px; - } - - #wpadminbar #wp-admin-bar-user-actions.ab-submenu { - padding: 0; - } - - #wpadminbar #wp-admin-bar-user-actions.ab-submenu img.avatar { - display: none; - } - - #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { - margin: 0; - } - - #wpadminbar #wp-admin-bar-user-info .display-name { - height: auto; - font-size: 16px; - line-height: 1.5; - color: #f0f0f1; - } - - #wpadminbar #wp-admin-bar-user-info a { - padding-top: 4px; - } - - #wpadminbar #wp-admin-bar-user-info .username { - line-height: 0.8 !important; - margin-bottom: -2px; - } - - /* Show only default top level items */ - #wp-toolbar > ul > li { - display: none; - } - - #wpadminbar li#wp-admin-bar-menu-toggle, - #wpadminbar li#wp-admin-bar-wp-logo, - #wpadminbar li#wp-admin-bar-my-sites, - #wpadminbar li#wp-admin-bar-updates, - #wpadminbar li#wp-admin-bar-site-name, - #wpadminbar li#wp-admin-bar-site-editor, - #wpadminbar li#wp-admin-bar-customize, - #wpadminbar li#wp-admin-bar-new-content, - #wpadminbar li#wp-admin-bar-edit, - #wpadminbar li#wp-admin-bar-comments, - #wpadminbar li#wp-admin-bar-my-account { - display: block; - } - - /* Allow dropdown list items to appear normally */ - #wpadminbar li:hover ul li, - #wpadminbar li.hover ul li, - #wpadminbar li:hover ul li:hover ul li { - display: list-item; - } - - /* Override default min-width so dropdown lists aren't stretched - to 100% viewport width at responsive sizes. */ - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - min-width: -moz-fit-content; - min-width: fit-content; - } - - #wpadminbar ul#wp-admin-bar-root-default > li { - margin-right: 0; - } - - /* Experimental fix for touch toolbar dropdown positioning */ - #wpadminbar .ab-top-menu, - #wpadminbar .ab-top-secondary, - #wpadminbar #wp-admin-bar-wp-logo, - #wpadminbar #wp-admin-bar-my-sites, - #wpadminbar #wp-admin-bar-site-name, - #wpadminbar #wp-admin-bar-updates, - #wpadminbar #wp-admin-bar-comments, - #wpadminbar #wp-admin-bar-new-content, - #wpadminbar #wp-admin-bar-edit, - #wpadminbar #wp-admin-bar-my-account { - position: static; - } - - #wpadminbar #wp-admin-bar-my-account { - float: right; - } - - .network-admin #wpadminbar ul#wp-admin-bar-top-secondary > li#wp-admin-bar-my-account { - margin-right: 0; - } - - /* Realign arrows on taller responsive submenus */ - - #wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before { - top: 10px; - left: 0; - } -} - -/* Smartphone */ -@media screen and (max-width: 600px) { - #wpadminbar { - position: absolute; - } - - #wp-responsive-overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 400; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - width: 100%; - left: 0; - } - - #wpadminbar .menupop .menupop > .ab-item:before { - display: none; - } - - #wpadminbar #wp-admin-bar-wp-logo.menupop .ab-sub-wrapper { - margin-left: 0; - } - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper { - margin: 0; - width: 100%; - top: auto; - left: auto; - position: relative; - } - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper .ab-item { - font-size: 16px; - padding: 6px 15px 19px 30px; - } - - #wpadminbar li:hover ul li ul li { - display: list-item; - } - - #wpadminbar li#wp-admin-bar-wp-logo, - #wpadminbar li#wp-admin-bar-updates { - display: none; - } - - /* Make submenus full-width at this size */ - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper { - position: static; - box-shadow: none; - } -} - -/* Very narrow screens */ -@media screen and (max-width: 400px) { - #wpadminbar li#wp-admin-bar-comments { - display: none; - } -} -/*! This file is auto-generated */ -html { - --wp-admin--admin-bar--height: 32px; - scroll-padding-top: var(--wp-admin--admin-bar--height); -} - -#wpadminbar * { - height: auto; - width: auto; - margin: 0; - padding: 0; - position: static; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - font-size: 13px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.46153846; - border-radius: 0; - box-sizing: content-box; - transition: none; - -webkit-font-smoothing: subpixel-antialiased; /* Prevent Safari from switching to standard antialiasing on hover */ - -moz-osx-font-smoothing: auto; /* Prevent Firefox from inheriting from themes that use other values */ -} - -.rtl #wpadminbar * { - font-family: Tahoma, sans-serif; -} - -html:lang(he-il) .rtl #wpadminbar * { - font-family: Arial, sans-serif; -} - -#wpadminbar .ab-empty-item { - cursor: default; -} - -#wpadminbar .ab-empty-item, -#wpadminbar a.ab-item, -#wpadminbar > #wp-toolbar span.ab-label, -#wpadminbar > #wp-toolbar span.noticon { - color: #f0f0f1; -} - -#wpadminbar #wp-admin-bar-site-name a.ab-item, -#wpadminbar #wp-admin-bar-my-sites a.ab-item { - white-space: nowrap; -} - -#wpadminbar ul li:before, -#wpadminbar ul li:after { - content: normal; -} - -#wpadminbar a, -#wpadminbar a:hover, -#wpadminbar a img, -#wpadminbar a img:hover { - border: none; - text-decoration: none; - background: none; - box-shadow: none; -} - -#wpadminbar a:focus, -#wpadminbar a:active, -#wpadminbar input[type="text"], -#wpadminbar input[type="password"], -#wpadminbar input[type="number"], -#wpadminbar input[type="search"], -#wpadminbar input[type="email"], -#wpadminbar input[type="url"], -#wpadminbar select, -#wpadminbar textarea, -#wpadminbar div { - box-shadow: none; -} - -#wpadminbar a:focus { - /* Inherits transparent outline only visible in Windows High Contrast mode */ - outline-offset: -1px; -} - -#wpadminbar { - direction: rtl; - color: #c3c4c7; - font-size: 13px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.46153846; - height: 32px; - position: fixed; - top: 0; - right: 0; - width: 100%; - min-width: 600px; /* match the min-width of the body in wp-admin/css/common.css */ - z-index: 99999; - background: #1d2327; -} - -#wpadminbar .ab-sub-wrapper, -#wpadminbar ul, -#wpadminbar ul li { - background: none; - clear: none; - list-style: none; - margin: 0; - padding: 0; - position: relative; - text-indent: 0; - z-index: 99999; -} - -#wpadminbar ul#wp-admin-bar-root-default>li { - margin-left: 0; -} - -#wpadminbar .quicklinks ul { - text-align: right; -} - -#wpadminbar li { - float: right; -} - -#wpadminbar .ab-empty-item { - outline: none; -} - -#wpadminbar .quicklinks .ab-top-secondary > li { - float: left; -} - -#wpadminbar .quicklinks a, -#wpadminbar .quicklinks .ab-empty-item, -#wpadminbar .shortlink-input { - height: 32px; - display: block; - padding: 0 10px; - margin: 0; -} - -#wpadminbar .quicklinks > ul > li > a { - padding: 0 7px 0 8px; -} - -#wpadminbar .menupop .ab-sub-wrapper, -#wpadminbar .shortlink-input { - margin: 0; - padding: 0; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - background: #2c3338; - display: none; - position: absolute; - float: none; -} - -#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - min-width: 100%; -} - -#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper { - left: 0; - right: auto; -} - -#wpadminbar .ab-submenu { - padding: 6px 0; -} - -#wpadminbar .selected .shortlink-input { - display: block; -} - -#wpadminbar .quicklinks .menupop ul li { - float: none; -} - -#wpadminbar .quicklinks .menupop ul li a strong { - font-weight: 600; -} - -#wpadminbar .quicklinks .menupop ul li .ab-item, -#wpadminbar .quicklinks .menupop ul li a strong, -#wpadminbar .quicklinks .menupop.hover ul li .ab-item, -#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, -#wpadminbar .shortlink-input { - line-height: 2; - height: 26px; - white-space: nowrap; - min-width: 140px; -} - -#wpadminbar .shortlink-input { - width: 200px; -} - -#wpadminbar.nojs li:hover > .ab-sub-wrapper, -#wpadminbar li.hover > .ab-sub-wrapper { - display: block; -} - -#wpadminbar .menupop li:hover > .ab-sub-wrapper, -#wpadminbar .menupop li.hover > .ab-sub-wrapper { - margin-right: 100%; - margin-top: -32px; -} - -#wpadminbar .ab-top-secondary .menupop li:hover > .ab-sub-wrapper, -#wpadminbar .ab-top-secondary .menupop li.hover > .ab-sub-wrapper { - margin-right: 0; - right: inherit; - left: 100%; -} - -#wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus, -#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, -#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item, -#wpadminbar .ab-top-menu > li.hover > .ab-item { - background: #2c3338; - color: #72aee6; -} - -#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label, -#wpadminbar > #wp-toolbar li.hover span.ab-label, -#wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label { - color: #72aee6; -} - -#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon, -#wpadminbar .ab-icon, -#wpadminbar .ab-item:before, -.wp-admin-bar-arrow { - position: relative; - float: right; - font: normal 20px/1 dashicons; - speak: never; - padding: 4px 0; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - background-image: none !important; - margin-left: 6px; -} - -#wpadminbar .ab-icon:before, -#wpadminbar .ab-item:before, -#wpadminbar #adminbarsearch:before { - color: #a7aaad; - color: rgba(240, 246, 252, 0.6); -} - -#wpadminbar .ab-icon:before, -#wpadminbar .ab-item:before, -#wpadminbar #adminbarsearch:before { - position: relative; - transition: color .1s ease-in-out; -} - -#wpadminbar .ab-label { - display: inline-block; - height: 32px; -} - -#wpadminbar .ab-submenu .ab-item { - color: #c3c4c7; - color: rgba(240, 246, 252, 0.7); -} - -#wpadminbar .quicklinks .menupop ul li a, -#wpadminbar .quicklinks .menupop ul li a strong, -#wpadminbar .quicklinks .menupop.hover ul li a, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a { - color: #c3c4c7; - color: rgba(240, 246, 252, 0.7); -} - -#wpadminbar .quicklinks .menupop ul li a:hover, -#wpadminbar .quicklinks .menupop ul li a:focus, -#wpadminbar .quicklinks .menupop ul li a:hover strong, -#wpadminbar .quicklinks .menupop ul li a:focus strong, -#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a, -#wpadminbar .quicklinks .menupop.hover ul li a:hover, -#wpadminbar .quicklinks .menupop.hover ul li a:focus, -#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover, -#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover, -#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus, -#wpadminbar li:hover .ab-icon:before, -#wpadminbar li:hover .ab-item:before, -#wpadminbar li a:focus .ab-icon:before, -#wpadminbar li .ab-item:focus:before, -#wpadminbar li .ab-item:focus .ab-icon:before, -#wpadminbar li.hover .ab-icon:before, -#wpadminbar li.hover .ab-item:before, -#wpadminbar li:hover #adminbarsearch:before, -#wpadminbar li #adminbarsearch.adminbar-focused:before { - color: #72aee6; -} - -#wpadminbar.mobile .quicklinks .ab-icon:before, -#wpadminbar.mobile .quicklinks .ab-item:before { - color: #c3c4c7; -} - -#wpadminbar.mobile .quicklinks .hover .ab-icon:before, -#wpadminbar.mobile .quicklinks .hover .ab-item:before { - color: #72aee6; -} - -#wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow:before, -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before { - position: absolute; - font: normal 17px/1 dashicons; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -#wpadminbar .menupop .menupop > .ab-item { - display: block; - padding-left: 2em; -} - -#wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow:before { - top: 1px; - left: 10px; - padding: 4px 0; - content: "\f141"; - color: inherit; -} - -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item { - padding-right: 2em; - padding-left: 1em; -} - -#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item .wp-admin-bar-arrow:before { - top: 1px; - right: 6px; - content: "\f139"; -} - -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary { - display: block; - position: relative; - left: auto; - margin: 0; - box-shadow: none; -} - -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary, -#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu { - background: #3c434a; -} - -#wpadminbar .quicklinks .menupop .ab-sub-secondary > li > a:hover, -#wpadminbar .quicklinks .menupop .ab-sub-secondary > li .ab-item:focus a { - color: #72aee6; -} - -#wpadminbar .quicklinks a span#ab-updates { - background: #f0f0f1; - color: #2c3338; - display: inline; - padding: 2px 5px; - font-size: 10px; - font-weight: 600; - border-radius: 10px; -} - -#wpadminbar .quicklinks a:hover span#ab-updates { - background: #fff; - color: #000; -} - -#wpadminbar .ab-top-secondary { - float: left; -} - -#wpadminbar ul li:last-child, -#wpadminbar ul li:last-child .ab-item { - box-shadow: none; -} - -/** - * Recovery Mode - */ -#wpadminbar #wp-admin-bar-recovery-mode { - color: #fff; - background-color: #d63638; -} - -#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover >.ab-item, -#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus, -#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item, -#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus { - color: #fff; - background-color: #d63638; -} - -/** - * My Account - */ -#wp-admin-bar-my-account > ul { - min-width: 198px; -} - -#wp-admin-bar-my-account:not(.with-avatar) > .ab-item { - display: inline-block; -} - -#wp-admin-bar-my-account > .ab-item:before { - content: "\f110"; - top: 2px; - float: left; - margin-right: 6px; - margin-left: 0; -} - -#wp-admin-bar-my-account.with-avatar > .ab-item:before { - display: none; - content: none; -} - -#wp-admin-bar-my-account.with-avatar > ul { - min-width: 270px; -} - -#wpadminbar #wp-admin-bar-user-actions > li { - margin-right: 16px; - margin-left: 16px; -} - -#wpadminbar #wp-admin-bar-user-actions.ab-submenu { - padding: 6px 0 12px; -} - -#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { - margin-right: 88px; -} - -#wpadminbar #wp-admin-bar-user-info { - margin-top: 6px; - margin-bottom: 15px; - height: auto; - background: none; -} - -#wp-admin-bar-user-info .avatar { - position: absolute; - right: -72px; - top: 4px; - width: 64px; - height: 64px; -} - -#wpadminbar #wp-admin-bar-user-info a { - background: none; - height: auto; -} - -#wpadminbar #wp-admin-bar-user-info span { - background: none; - padding: 0; - height: 18px; -} - -#wpadminbar #wp-admin-bar-user-info .display-name, -#wpadminbar #wp-admin-bar-user-info .username { - display: block; -} - -#wpadminbar #wp-admin-bar-user-info .username { - color: #a7aaad; - font-size: 11px; -} - -#wpadminbar #wp-admin-bar-my-account.with-avatar > .ab-empty-item img, -#wpadminbar #wp-admin-bar-my-account.with-avatar > a img { - width: auto; - height: 16px; - padding: 0; - border: 1px solid #8c8f94; - background: #f0f0f1; - line-height: 1.84615384; - vertical-align: middle; - margin: -4px 6px 0 0; - float: none; - display: inline; -} - -/** - * WP Logo - */ -#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon { - width: 15px; - height: 20px; - margin-left: 0; - padding: 6px 0 5px; -} - -#wpadminbar #wp-admin-bar-wp-logo > .ab-item { - padding: 0 7px; -} - -#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before { - content: "\f120"; - top: 2px; -} - -/* - * My Sites & Site Title - */ -#wpadminbar .quicklinks li .blavatar { - display: inline-block; - vertical-align: middle; - font: normal 16px/1 dashicons !important; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: #f0f0f1; -} - -#wpadminbar .quicklinks li a:hover .blavatar, -#wpadminbar .quicklinks li a:focus .blavatar, -#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a .blavatar { - color: #72aee6; -} - -#wpadminbar .quicklinks li img.blavatar, -#wpadminbar .quicklinks li div.blavatar:before { - height: 16px; - width: 16px; - margin: 0 -2px 2px 8px; -} - -#wpadminbar .quicklinks li div.blavatar:before { - content: "\f120"; - display: inline-block; -} - -#wpadminbar #wp-admin-bar-appearance { - margin-top: -12px; -} - -#wpadminbar #wp-admin-bar-my-sites > .ab-item:before, -#wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f541"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-site-editor > .ab-item:before { - content: "\f100"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-customize > .ab-item:before { - content: "\f540"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-edit > .ab-item:before { - content: "\f464"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f226"; -} - -.wp-admin #wpadminbar #wp-admin-bar-site-name > .ab-item:before { - content: "\f102"; -} - - - -/** - * Comments - */ -#wpadminbar #wp-admin-bar-comments .ab-icon { - margin-left: 6px; -} - -#wpadminbar #wp-admin-bar-comments .ab-icon:before { - content: "\f101"; - top: 3px; -} - -#wpadminbar #wp-admin-bar-comments .count-0 { - opacity: .5; -} - -/** - * New Content - */ -#wpadminbar #wp-admin-bar-new-content .ab-icon:before { - content: "\f132"; - top: 4px; -} - -/** - * Updates - */ -#wpadminbar #wp-admin-bar-updates .ab-icon:before { - content: "\f463"; - top: 2px; -} - -#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before { - display: inline-block; - animation: rotation 2s infinite linear; -} - -@media (prefers-reduced-motion: reduce) { - #wpadminbar #wp-admin-bar-updates.spin .ab-icon:before { - animation: none; - } -} - -/** - * Search - */ - -#wpadminbar #wp-admin-bar-search .ab-item { - padding: 0; - background: transparent; -} - -#wpadminbar #adminbarsearch { - position: relative; - height: 32px; - padding: 0 2px; - z-index: 1; -} - -#wpadminbar #adminbarsearch:before { - position: absolute; - top: 6px; - right: 5px; - z-index: 20; - font: normal 20px/1 dashicons !important; - content: "\f179"; - speak: never; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -/* The admin bar search field needs to reset many styles that might be inherited from the active Theme CSS. See ticket #40313. */ -#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input { - display: inline-block; - float: none; - position: relative; - z-index: 30; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 1.84615384; - text-indent: 0; - height: 24px; - width: 24px; - max-width: none; - padding: 0 24px 0 3px; - margin: 0; - color: #c3c4c7; - background-color: rgba(255, 255, 255, 0); - border: none; - outline: none; - cursor: pointer; - box-shadow: none; - box-sizing: border-box; - transition-duration: 400ms; - transition-property: width, background; - transition-timing-function: ease; -} - -#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus { - z-index: 10; - color: #000; - width: 200px; - background-color: rgba(255, 255, 255, 0.9); - cursor: text; - border: 0; -} - -#wpadminbar #adminbarsearch .adminbar-button { - display: none; -} - -/** - * Customize support classes - */ -.no-customize-support .hide-if-no-customize, -.customize-support .hide-if-customize, -.no-customize-support #wpadminbar .hide-if-no-customize, -.no-customize-support.wp-core-ui .hide-if-no-customize, -.no-customize-support .wp-core-ui .hide-if-no-customize, -.customize-support #wpadminbar .hide-if-customize, -.customize-support.wp-core-ui .hide-if-customize, -.customize-support .wp-core-ui .hide-if-customize { - display: none; -} - -/* Skip link */ -#wpadminbar .screen-reader-text, -#wpadminbar .screen-reader-text span { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -#wpadminbar .screen-reader-shortcut { - position: absolute; - top: -1000em; -} - -#wpadminbar .screen-reader-shortcut:focus { - right: 6px; - top: 7px; - height: auto; - width: auto; - display: block; - font-size: 14px; - font-weight: 600; - padding: 15px 23px 14px; - background: #f0f0f1; - color: #2271b1; - z-index: 100000; - line-height: normal; - text-decoration: none; - box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); -} - -@media screen and (max-width: 782px) { - html { - --wp-admin--admin-bar--height: 46px; - } - - /* Toolbar Touchification*/ - html #wpadminbar { - height: 46px; - min-width: 240px; /* match the min-width of the body in wp-admin/css/common.css */ - } - - #wpadminbar * { - font-size: 14px; - font-weight: 400; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - line-height: 2.28571428; - } - - #wpadminbar .quicklinks > ul > li > a, - #wpadminbar .quicklinks .ab-empty-item { - padding: 0; - height: 46px; - line-height: 3.28571428; - width: auto; - } - - #wpadminbar .ab-icon { - font: 40px/1 dashicons !important; - margin: 0; - padding: 0; - width: 52px; - height: 46px; - text-align: center; - } - - #wpadminbar .ab-icon:before { - text-align: center; - } - - #wpadminbar .ab-submenu { - padding: 0; - } - - #wpadminbar #wp-admin-bar-site-name a.ab-item, - #wpadminbar #wp-admin-bar-my-sites a.ab-item, - #wpadminbar #wp-admin-bar-my-account a.ab-item { - text-overflow: clip; - } - - #wpadminbar .quicklinks .menupop ul li .ab-item, - #wpadminbar .quicklinks .menupop ul li a strong, - #wpadminbar .quicklinks .menupop.hover ul li .ab-item, - #wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, - #wpadminbar .shortlink-input { - line-height: 1.6; - } - - #wpadminbar .ab-label { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; - } - - #wpadminbar .menupop li:hover > .ab-sub-wrapper, - #wpadminbar .menupop li.hover > .ab-sub-wrapper { - margin-top: -46px; - } - - #wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .menupop > .ab-item { - padding-left: 30px; - } - - #wpadminbar .menupop .menupop > .ab-item:before { - top: 10px; - left: 6px; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper .ab-item { - font-size: 16px; - padding: 8px 16px; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper a:empty { - display: none; - } - - /* WP logo */ - #wpadminbar #wp-admin-bar-wp-logo > .ab-item { - padding: 0; - } - - #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon { - padding: 0; - width: 52px; - height: 46px; - text-align: center; - vertical-align: top; - } - - #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before { - font: 28px/1 dashicons !important; - top: -3px; - } - - #wpadminbar .ab-icon, - #wpadminbar .ab-item:before { - padding: 0; - } - - /* My Sites and "Site Title" menu */ - #wpadminbar #wp-admin-bar-my-sites > .ab-item, - #wpadminbar #wp-admin-bar-site-name > .ab-item, - #wpadminbar #wp-admin-bar-site-editor > .ab-item, - #wpadminbar #wp-admin-bar-customize > .ab-item, - #wpadminbar #wp-admin-bar-edit > .ab-item, - #wpadminbar #wp-admin-bar-my-account > .ab-item { - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - width: 52px; - padding: 0; - color: #a7aaad; /* @todo not needed? this text is hidden */ - position: relative; - } - - #wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon, - #wpadminbar .ab-icon, - #wpadminbar .ab-item:before { - padding: 0; - margin-left: 0; - } - - #wpadminbar #wp-admin-bar-edit > .ab-item:before, - #wpadminbar #wp-admin-bar-my-sites > .ab-item:before, - #wpadminbar #wp-admin-bar-site-name > .ab-item:before, - #wpadminbar #wp-admin-bar-site-editor > .ab-item:before, - #wpadminbar #wp-admin-bar-customize > .ab-item:before, - #wpadminbar #wp-admin-bar-my-account > .ab-item:before { - display: block; - text-indent: 0; - font: normal 32px/1 dashicons; - speak: never; - top: 7px; - width: 52px; - text-align: center; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } - - #wpadminbar #wp-admin-bar-appearance { - margin-top: 0; - } - - #wpadminbar .quicklinks li .blavatar:before { - display: none; - } - - /* Search */ - #wpadminbar #wp-admin-bar-search { - display: none; - } - - /* New Content */ - #wpadminbar #wp-admin-bar-new-content .ab-icon:before { - top: 0; - line-height: 1.33333333; - height: 46px !important; - text-align: center; - width: 52px; - display: block; - } - - /* Updates */ - #wpadminbar #wp-admin-bar-updates { - text-align: center; - } - - #wpadminbar #wp-admin-bar-updates .ab-icon:before { - top: 3px; - } - - /* Comments */ - #wpadminbar #wp-admin-bar-comments .ab-icon { - margin: 0; - } - - #wpadminbar #wp-admin-bar-comments .ab-icon:before { - display: block; - font-size: 34px; - height: 46px; - line-height: 1.38235294; - top: 0; - } - - /* My Account */ - #wpadminbar #wp-admin-bar-my-account > a { - position: relative; - white-space: nowrap; - text-indent: 150%; /* More than 100% indention is needed since this element has padding */ - width: 28px; - padding: 0 10px; - overflow: hidden; /* Prevent link text from forcing horizontal scrolling on mobile */ - } - - #wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img { - position: absolute; - top: 13px; - left: 10px; - width: 26px; - height: 26px; - } - - #wpadminbar #wp-admin-bar-user-actions.ab-submenu { - padding: 0; - } - - #wpadminbar #wp-admin-bar-user-actions.ab-submenu img.avatar { - display: none; - } - - #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { - margin: 0; - } - - #wpadminbar #wp-admin-bar-user-info .display-name { - height: auto; - font-size: 16px; - line-height: 1.5; - color: #f0f0f1; - } - - #wpadminbar #wp-admin-bar-user-info a { - padding-top: 4px; - } - - #wpadminbar #wp-admin-bar-user-info .username { - line-height: 0.8 !important; - margin-bottom: -2px; - } - - /* Show only default top level items */ - #wp-toolbar > ul > li { - display: none; - } - - #wpadminbar li#wp-admin-bar-menu-toggle, - #wpadminbar li#wp-admin-bar-wp-logo, - #wpadminbar li#wp-admin-bar-my-sites, - #wpadminbar li#wp-admin-bar-updates, - #wpadminbar li#wp-admin-bar-site-name, - #wpadminbar li#wp-admin-bar-site-editor, - #wpadminbar li#wp-admin-bar-customize, - #wpadminbar li#wp-admin-bar-new-content, - #wpadminbar li#wp-admin-bar-edit, - #wpadminbar li#wp-admin-bar-comments, - #wpadminbar li#wp-admin-bar-my-account { - display: block; - } - - /* Allow dropdown list items to appear normally */ - #wpadminbar li:hover ul li, - #wpadminbar li.hover ul li, - #wpadminbar li:hover ul li:hover ul li { - display: list-item; - } - - /* Override default min-width so dropdown lists aren't stretched - to 100% viewport width at responsive sizes. */ - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - min-width: -moz-fit-content; - min-width: fit-content; - } - - #wpadminbar ul#wp-admin-bar-root-default > li { - margin-left: 0; - } - - /* Experimental fix for touch toolbar dropdown positioning */ - #wpadminbar .ab-top-menu, - #wpadminbar .ab-top-secondary, - #wpadminbar #wp-admin-bar-wp-logo, - #wpadminbar #wp-admin-bar-my-sites, - #wpadminbar #wp-admin-bar-site-name, - #wpadminbar #wp-admin-bar-updates, - #wpadminbar #wp-admin-bar-comments, - #wpadminbar #wp-admin-bar-new-content, - #wpadminbar #wp-admin-bar-edit, - #wpadminbar #wp-admin-bar-my-account { - position: static; - } - - #wpadminbar #wp-admin-bar-my-account { - float: left; - } - - .network-admin #wpadminbar ul#wp-admin-bar-top-secondary > li#wp-admin-bar-my-account { - margin-left: 0; - } - - /* Realign arrows on taller responsive submenus */ - - #wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before { - top: 10px; - right: 0; - } -} - -/* Smartphone */ -@media screen and (max-width: 600px) { - #wpadminbar { - position: absolute; - } - - #wp-responsive-overlay { - position: fixed; - top: 0; - right: 0; - width: 100%; - height: 100%; - z-index: 400; - } - - #wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper { - width: 100%; - right: 0; - } - - #wpadminbar .menupop .menupop > .ab-item:before { - display: none; - } - - #wpadminbar #wp-admin-bar-wp-logo.menupop .ab-sub-wrapper { - margin-right: 0; - } - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper { - margin: 0; - width: 100%; - top: auto; - right: auto; - position: relative; - } - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper .ab-item { - font-size: 16px; - padding: 6px 30px 19px 15px; - } - - #wpadminbar li:hover ul li ul li { - display: list-item; - } - - #wpadminbar li#wp-admin-bar-wp-logo, - #wpadminbar li#wp-admin-bar-updates { - display: none; - } - - /* Make submenus full-width at this size */ - - #wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper { - position: static; - box-shadow: none; - } -} - -/* Very narrow screens */ -@media screen and (max-width: 400px) { - #wpadminbar li#wp-admin-bar-comments { - display: none; - } -} -/*! This file is auto-generated */ -.wp-pointer-content{padding:0 0 10px;position:relative;font-size:13px;background:#fff;border:1px solid #c3c4c7;box-shadow:0 3px 6px rgba(0,0,0,.08)}.wp-pointer-content h3{position:relative;margin:-1px -1px 5px;padding:15px 18px 14px 60px;border:1px solid #2271b1;border-bottom:none;line-height:1.4;font-size:14px;color:#fff;background:#2271b1}.wp-pointer-content h3:before{background:#fff;border-radius:50%;color:#2271b1;content:"\f227";font:normal 20px/1.6 dashicons;position:absolute;top:8px;left:15px;speak:never;text-align:center;width:32px;height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-pointer-content h4{margin:1.33em 20px 1em;font-size:1.15em}.wp-pointer-content p{padding:0 20px}.wp-pointer-buttons{margin:0;padding:5px 15px;overflow:auto}.wp-pointer-buttons a{float:right;display:inline-block;text-decoration:none}.wp-pointer-buttons a.close{padding-left:3px;position:relative}.wp-pointer-buttons a.close:before{background:0 0;color:#787c82;content:"\f153";display:block!important;font:normal 16px/1 dashicons;speak:never;margin:1px 0;text-align:center;-webkit-font-smoothing:antialiased!important;width:10px;height:100%;position:absolute;left:-15px;top:1px}.wp-pointer-buttons a.close:hover:before{color:#d63638}.wp-pointer-arrow,.wp-pointer-arrow-inner{position:absolute;width:0;height:0}.wp-pointer-arrow{z-index:10;width:0;height:0;border:0 solid transparent}.wp-pointer-arrow-inner{z-index:20}.wp-pointer-top,.wp-pointer-undefined{padding-top:13px}.wp-pointer-bottom{margin-top:-13px;padding-bottom:13px}.wp-pointer-left{padding-left:13px}.wp-pointer-right{margin-left:-13px;padding-right:13px}.wp-pointer-bottom .wp-pointer-arrow,.wp-pointer-top .wp-pointer-arrow,.wp-pointer-undefined .wp-pointer-arrow{left:50px}.wp-pointer-left .wp-pointer-arrow,.wp-pointer-right .wp-pointer-arrow{top:50%;margin-top:-15px}.wp-pointer-top .wp-pointer-arrow,.wp-pointer-undefined .wp-pointer-arrow{top:0;border-width:0 13px 13px;border-bottom-color:#2271b1}.wp-pointer-top .wp-pointer-arrow-inner,.wp-pointer-undefined .wp-pointer-arrow-inner{top:1px;margin-left:-13px;margin-top:-13px;border:13px solid transparent;border-bottom-color:#2271b1;display:block;content:" "}.wp-pointer-bottom .wp-pointer-arrow{bottom:0;border-width:13px 13px 0;border-top-color:#c3c4c7}.wp-pointer-bottom .wp-pointer-arrow-inner{bottom:1px;margin-left:-13px;margin-bottom:-13px;border:13px solid transparent;border-top-color:#fff;display:block;content:" "}.wp-pointer-left .wp-pointer-arrow{left:0;border-width:13px 13px 13px 0;border-right-color:#c3c4c7}.wp-pointer-left .wp-pointer-arrow-inner{left:1px;margin-left:-13px;margin-top:-13px;border:13px solid transparent;border-right-color:#fff;display:block;content:" "}.wp-pointer-right .wp-pointer-arrow{right:0;border-width:13px 0 13px 13px;border-left-color:#c3c4c7}.wp-pointer-right .wp-pointer-arrow-inner{right:1px;margin-right:-13px;margin-top:-13px;border:13px solid transparent;border-left-color:#fff;display:block;content:" "}.wp-pointer.arrow-bottom .wp-pointer-content{margin-bottom:-45px}.wp-pointer.arrow-bottom .wp-pointer-arrow{top:100%;margin-top:-30px}@media screen and (max-width:782px){.wp-pointer{display:none}}/*! This file is auto-generated */ -html{--wp-admin--admin-bar--height:32px;scroll-padding-top:var(--wp-admin--admin-bar--height)}#wpadminbar *{height:auto;width:auto;margin:0;padding:0;position:static;text-shadow:none;text-transform:none;letter-spacing:normal;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.46153846;border-radius:0;box-sizing:content-box;transition:none;-webkit-font-smoothing:subpixel-antialiased;-moz-osx-font-smoothing:auto}.rtl #wpadminbar *{font-family:Tahoma,sans-serif}html:lang(he-il) .rtl #wpadminbar *{font-family:Arial,sans-serif}#wpadminbar .ab-empty-item{cursor:default}#wpadminbar .ab-empty-item,#wpadminbar a.ab-item,#wpadminbar>#wp-toolbar span.ab-label,#wpadminbar>#wp-toolbar span.noticon{color:#f0f0f1}#wpadminbar #wp-admin-bar-my-sites a.ab-item,#wpadminbar #wp-admin-bar-site-name a.ab-item{white-space:nowrap}#wpadminbar ul li:after,#wpadminbar ul li:before{content:normal}#wpadminbar a,#wpadminbar a img,#wpadminbar a img:hover,#wpadminbar a:hover{border:none;text-decoration:none;background:0 0;box-shadow:none}#wpadminbar a:active,#wpadminbar a:focus,#wpadminbar div,#wpadminbar input[type=email],#wpadminbar input[type=number],#wpadminbar input[type=password],#wpadminbar input[type=search],#wpadminbar input[type=text],#wpadminbar input[type=url],#wpadminbar select,#wpadminbar textarea{box-shadow:none}#wpadminbar a:focus{outline-offset:-1px}#wpadminbar{direction:ltr;color:#c3c4c7;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.46153846;height:32px;position:fixed;top:0;left:0;width:100%;min-width:600px;z-index:99999;background:#1d2327}#wpadminbar .ab-sub-wrapper,#wpadminbar ul,#wpadminbar ul li{background:0 0;clear:none;list-style:none;margin:0;padding:0;position:relative;text-indent:0;z-index:99999}#wpadminbar ul#wp-admin-bar-root-default>li{margin-right:0}#wpadminbar .quicklinks ul{text-align:left}#wpadminbar li{float:left}#wpadminbar .ab-empty-item{outline:0}#wpadminbar .quicklinks .ab-top-secondary>li{float:right}#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .quicklinks a,#wpadminbar .shortlink-input{height:32px;display:block;padding:0 10px;margin:0}#wpadminbar .quicklinks>ul>li>a{padding:0 8px 0 7px}#wpadminbar .menupop .ab-sub-wrapper,#wpadminbar .shortlink-input{margin:0;padding:0;box-shadow:0 3px 5px rgba(0,0,0,.2);background:#2c3338;display:none;position:absolute;float:none}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{min-width:100%}#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper{right:0;left:auto}#wpadminbar .ab-submenu{padding:6px 0}#wpadminbar .selected .shortlink-input{display:block}#wpadminbar .quicklinks .menupop ul li{float:none}#wpadminbar .quicklinks .menupop ul li a strong{font-weight:600}#wpadminbar .quicklinks .menupop ul li .ab-item,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li .ab-item,#wpadminbar .shortlink-input,#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item{line-height:2;height:26px;white-space:nowrap;min-width:140px}#wpadminbar .shortlink-input{width:200px}#wpadminbar li.hover>.ab-sub-wrapper,#wpadminbar.nojs li:hover>.ab-sub-wrapper{display:block}#wpadminbar .menupop li.hover>.ab-sub-wrapper,#wpadminbar .menupop li:hover>.ab-sub-wrapper{margin-left:100%;margin-top:-32px}#wpadminbar .ab-top-secondary .menupop li.hover>.ab-sub-wrapper,#wpadminbar .ab-top-secondary .menupop li:hover>.ab-sub-wrapper{margin-left:0;left:inherit;right:100%}#wpadminbar .ab-top-menu>li.hover>.ab-item,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item,#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus{background:#2c3338;color:#72aee6}#wpadminbar:not(.mobile)>#wp-toolbar a:focus span.ab-label,#wpadminbar:not(.mobile)>#wp-toolbar li:hover span.ab-label,#wpadminbar>#wp-toolbar li.hover span.ab-label{color:#72aee6}#wpadminbar .ab-icon,#wpadminbar .ab-item:before,#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,.wp-admin-bar-arrow{position:relative;float:left;font:normal 20px/1 dashicons;speak:never;padding:4px 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important;margin-right:6px}#wpadminbar #adminbarsearch:before,#wpadminbar .ab-icon:before,#wpadminbar .ab-item:before{color:#a7aaad;color:rgba(240,246,252,.6)}#wpadminbar #adminbarsearch:before,#wpadminbar .ab-icon:before,#wpadminbar .ab-item:before{position:relative;transition:color .1s ease-in-out}#wpadminbar .ab-label{display:inline-block;height:32px}#wpadminbar .ab-submenu .ab-item{color:#c3c4c7;color:rgba(240,246,252,.7)}#wpadminbar .quicklinks .menupop ul li a,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li a,#wpadminbar.nojs .quicklinks .menupop:hover ul li a{color:#c3c4c7;color:rgba(240,246,252,.7)}#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover>a,#wpadminbar .quicklinks .menupop ul li a:focus,#wpadminbar .quicklinks .menupop ul li a:focus strong,#wpadminbar .quicklinks .menupop ul li a:hover,#wpadminbar .quicklinks .menupop ul li a:hover strong,#wpadminbar .quicklinks .menupop.hover ul li a:focus,#wpadminbar .quicklinks .menupop.hover ul li a:hover,#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:focus,#wpadminbar .quicklinks .menupop.hover ul li div[tabindex]:hover,#wpadminbar li #adminbarsearch.adminbar-focused:before,#wpadminbar li .ab-item:focus .ab-icon:before,#wpadminbar li .ab-item:focus:before,#wpadminbar li a:focus .ab-icon:before,#wpadminbar li.hover .ab-icon:before,#wpadminbar li.hover .ab-item:before,#wpadminbar li:hover #adminbarsearch:before,#wpadminbar li:hover .ab-icon:before,#wpadminbar li:hover .ab-item:before,#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover{color:#72aee6}#wpadminbar.mobile .quicklinks .ab-icon:before,#wpadminbar.mobile .quicklinks .ab-item:before{color:#c3c4c7}#wpadminbar.mobile .quicklinks .hover .ab-icon:before,#wpadminbar.mobile .quicklinks .hover .ab-item:before{color:#72aee6}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item:before,#wpadminbar .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{position:absolute;font:normal 17px/1 dashicons;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar .menupop .menupop>.ab-item{display:block;padding-right:2em}#wpadminbar .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{top:1px;right:10px;padding:4px 0;content:"\f139";color:inherit}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item .wp-admin-bar-arrow:before{top:1px;left:6px;content:"\f141"}#wpadminbar .quicklinks .menupop ul.ab-sub-secondary{display:block;position:relative;right:auto;margin:0;box-shadow:none}#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu{background:#3c434a}#wpadminbar .quicklinks .menupop .ab-sub-secondary>li .ab-item:focus a,#wpadminbar .quicklinks .menupop .ab-sub-secondary>li>a:hover{color:#72aee6}#wpadminbar .quicklinks a span#ab-updates{background:#f0f0f1;color:#2c3338;display:inline;padding:2px 5px;font-size:10px;font-weight:600;border-radius:10px}#wpadminbar .quicklinks a:hover span#ab-updates{background:#fff;color:#000}#wpadminbar .ab-top-secondary{float:right}#wpadminbar ul li:last-child,#wpadminbar ul li:last-child .ab-item{box-shadow:none}#wpadminbar #wp-admin-bar-recovery-mode{color:#fff;background-color:#d63638}#wpadminbar .ab-top-menu>#wp-admin-bar-recovery-mode.hover>.ab-item,#wpadminbar.nojq .quicklinks .ab-top-menu>#wp-admin-bar-recovery-mode>.ab-item:focus,#wpadminbar:not(.mobile) .ab-top-menu>#wp-admin-bar-recovery-mode:hover>.ab-item,#wpadminbar:not(.mobile) .ab-top-menu>#wp-admin-bar-recovery-mode>.ab-item:focus{color:#fff;background-color:#d63638}#wp-admin-bar-my-account>ul{min-width:198px}#wp-admin-bar-my-account:not(.with-avatar)>.ab-item{display:inline-block}#wp-admin-bar-my-account>.ab-item:before{content:"\f110";top:2px;float:right;margin-left:6px;margin-right:0}#wp-admin-bar-my-account.with-avatar>.ab-item:before{display:none;content:none}#wp-admin-bar-my-account.with-avatar>ul{min-width:270px}#wpadminbar #wp-admin-bar-user-actions>li{margin-left:16px;margin-right:16px}#wpadminbar #wp-admin-bar-user-actions.ab-submenu{padding:6px 0 12px}#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions>li{margin-left:88px}#wpadminbar #wp-admin-bar-user-info{margin-top:6px;margin-bottom:15px;height:auto;background:0 0}#wp-admin-bar-user-info .avatar{position:absolute;left:-72px;top:4px;width:64px;height:64px}#wpadminbar #wp-admin-bar-user-info a{background:0 0;height:auto}#wpadminbar #wp-admin-bar-user-info span{background:0 0;padding:0;height:18px}#wpadminbar #wp-admin-bar-user-info .display-name,#wpadminbar #wp-admin-bar-user-info .username{display:block}#wpadminbar #wp-admin-bar-user-info .username{color:#a7aaad;font-size:11px}#wpadminbar #wp-admin-bar-my-account.with-avatar>.ab-empty-item img,#wpadminbar #wp-admin-bar-my-account.with-avatar>a img{width:auto;height:16px;padding:0;border:1px solid #8c8f94;background:#f0f0f1;line-height:1.84615384;vertical-align:middle;margin:-4px 0 0 6px;float:none;display:inline}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon{width:15px;height:20px;margin-right:0;padding:6px 0 5px}#wpadminbar #wp-admin-bar-wp-logo>.ab-item{padding:0 7px}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before{content:"\f120";top:2px}#wpadminbar .quicklinks li .blavatar{display:inline-block;vertical-align:middle;font:normal 16px/1 dashicons!important;speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#f0f0f1}#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover>a .blavatar,#wpadminbar .quicklinks li a:focus .blavatar,#wpadminbar .quicklinks li a:hover .blavatar{color:#72aee6}#wpadminbar .quicklinks li div.blavatar:before,#wpadminbar .quicklinks li img.blavatar{height:16px;width:16px;margin:0 8px 2px -2px}#wpadminbar .quicklinks li div.blavatar:before{content:"\f120";display:inline-block}#wpadminbar #wp-admin-bar-appearance{margin-top:-12px}#wpadminbar #wp-admin-bar-my-sites>.ab-item:before,#wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f541";top:2px}#wpadminbar #wp-admin-bar-site-editor>.ab-item:before{content:"\f100";top:2px}#wpadminbar #wp-admin-bar-customize>.ab-item:before{content:"\f540";top:2px}#wpadminbar #wp-admin-bar-edit>.ab-item:before{content:"\f464";top:2px}#wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f226"}.wp-admin #wpadminbar #wp-admin-bar-site-name>.ab-item:before{content:"\f102"}#wpadminbar #wp-admin-bar-comments .ab-icon{margin-right:6px}#wpadminbar #wp-admin-bar-comments .ab-icon:before{content:"\f101";top:3px}#wpadminbar #wp-admin-bar-comments .count-0{opacity:.5}#wpadminbar #wp-admin-bar-new-content .ab-icon:before{content:"\f132";top:4px}#wpadminbar #wp-admin-bar-updates .ab-icon:before{content:"\f463";top:2px}#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before{display:inline-block;animation:rotation 2s infinite linear}@media (prefers-reduced-motion:reduce){#wpadminbar #wp-admin-bar-updates.spin .ab-icon:before{animation:none}}#wpadminbar #wp-admin-bar-search .ab-item{padding:0;background:0 0}#wpadminbar #adminbarsearch{position:relative;height:32px;padding:0 2px;z-index:1}#wpadminbar #adminbarsearch:before{position:absolute;top:6px;left:5px;z-index:20;font:normal 20px/1 dashicons!important;content:"\f179";speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar>#wp-toolbar>#wp-admin-bar-top-secondary>#wp-admin-bar-search #adminbarsearch input.adminbar-input{display:inline-block;float:none;position:relative;z-index:30;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.84615384;text-indent:0;height:24px;width:24px;max-width:none;padding:0 3px 0 24px;margin:0;color:#c3c4c7;background-color:rgba(255,255,255,0);border:none;outline:0;cursor:pointer;box-shadow:none;box-sizing:border-box;transition-duration:.4s;transition-property:width,background;transition-timing-function:ease}#wpadminbar>#wp-toolbar>#wp-admin-bar-top-secondary>#wp-admin-bar-search #adminbarsearch input.adminbar-input:focus{z-index:10;color:#000;width:200px;background-color:rgba(255,255,255,.9);cursor:text;border:0}#wpadminbar #adminbarsearch .adminbar-button{display:none}.customize-support #wpadminbar .hide-if-customize,.customize-support .hide-if-customize,.customize-support .wp-core-ui .hide-if-customize,.customize-support.wp-core-ui .hide-if-customize,.no-customize-support #wpadminbar .hide-if-no-customize,.no-customize-support .hide-if-no-customize,.no-customize-support .wp-core-ui .hide-if-no-customize,.no-customize-support.wp-core-ui .hide-if-no-customize{display:none}#wpadminbar .screen-reader-text,#wpadminbar .screen-reader-text span{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}#wpadminbar .screen-reader-shortcut{position:absolute;top:-1000em}#wpadminbar .screen-reader-shortcut:focus{left:6px;top:7px;height:auto;width:auto;display:block;font-size:14px;font-weight:600;padding:15px 23px 14px;background:#f0f0f1;color:#2271b1;z-index:100000;line-height:normal;text-decoration:none;box-shadow:0 0 2px 2px rgba(0,0,0,.6)}@media screen and (max-width:782px){html{--wp-admin--admin-bar--height:46px}html #wpadminbar{height:46px;min-width:240px}#wpadminbar *{font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:2.28571428}#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .quicklinks>ul>li>a{padding:0;height:46px;line-height:3.28571428;width:auto}#wpadminbar .ab-icon{font:40px/1 dashicons!important;margin:0;padding:0;width:52px;height:46px;text-align:center}#wpadminbar .ab-icon:before{text-align:center}#wpadminbar .ab-submenu{padding:0}#wpadminbar #wp-admin-bar-my-account a.ab-item,#wpadminbar #wp-admin-bar-my-sites a.ab-item,#wpadminbar #wp-admin-bar-site-name a.ab-item{text-overflow:clip}#wpadminbar .quicklinks .menupop ul li .ab-item,#wpadminbar .quicklinks .menupop ul li a strong,#wpadminbar .quicklinks .menupop.hover ul li .ab-item,#wpadminbar .shortlink-input,#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item{line-height:1.6}#wpadminbar .ab-label{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}#wpadminbar .menupop li.hover>.ab-sub-wrapper,#wpadminbar .menupop li:hover>.ab-sub-wrapper{margin-top:-46px}#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .menupop>.ab-item{padding-right:30px}#wpadminbar .menupop .menupop>.ab-item:before{top:10px;right:6px}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper .ab-item{font-size:16px;padding:8px 16px}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper a:empty{display:none}#wpadminbar #wp-admin-bar-wp-logo>.ab-item{padding:0}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon{padding:0;width:52px;height:46px;text-align:center;vertical-align:top}#wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before{font:28px/1 dashicons!important;top:-3px}#wpadminbar .ab-icon,#wpadminbar .ab-item:before{padding:0}#wpadminbar #wp-admin-bar-customize>.ab-item,#wpadminbar #wp-admin-bar-edit>.ab-item,#wpadminbar #wp-admin-bar-my-account>.ab-item,#wpadminbar #wp-admin-bar-my-sites>.ab-item,#wpadminbar #wp-admin-bar-site-editor>.ab-item,#wpadminbar #wp-admin-bar-site-name>.ab-item{text-indent:100%;white-space:nowrap;overflow:hidden;width:52px;padding:0;color:#a7aaad;position:relative}#wpadminbar .ab-icon,#wpadminbar .ab-item:before,#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon{padding:0;margin-right:0}#wpadminbar #wp-admin-bar-customize>.ab-item:before,#wpadminbar #wp-admin-bar-edit>.ab-item:before,#wpadminbar #wp-admin-bar-my-account>.ab-item:before,#wpadminbar #wp-admin-bar-my-sites>.ab-item:before,#wpadminbar #wp-admin-bar-site-editor>.ab-item:before,#wpadminbar #wp-admin-bar-site-name>.ab-item:before{display:block;text-indent:0;font:normal 32px/1 dashicons;speak:never;top:7px;width:52px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpadminbar #wp-admin-bar-appearance{margin-top:0}#wpadminbar .quicklinks li .blavatar:before{display:none}#wpadminbar #wp-admin-bar-search{display:none}#wpadminbar #wp-admin-bar-new-content .ab-icon:before{top:0;line-height:1.33333333;height:46px!important;text-align:center;width:52px;display:block}#wpadminbar #wp-admin-bar-updates{text-align:center}#wpadminbar #wp-admin-bar-updates .ab-icon:before{top:3px}#wpadminbar #wp-admin-bar-comments .ab-icon{margin:0}#wpadminbar #wp-admin-bar-comments .ab-icon:before{display:block;font-size:34px;height:46px;line-height:1.38235294;top:0}#wpadminbar #wp-admin-bar-my-account>a{position:relative;white-space:nowrap;text-indent:150%;width:28px;padding:0 10px;overflow:hidden}#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar>a img{position:absolute;top:13px;right:10px;width:26px;height:26px}#wpadminbar #wp-admin-bar-user-actions.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-user-actions.ab-submenu img.avatar{display:none}#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions>li{margin:0}#wpadminbar #wp-admin-bar-user-info .display-name{height:auto;font-size:16px;line-height:1.5;color:#f0f0f1}#wpadminbar #wp-admin-bar-user-info a{padding-top:4px}#wpadminbar #wp-admin-bar-user-info .username{line-height:.8!important;margin-bottom:-2px}#wp-toolbar>ul>li{display:none}#wpadminbar li#wp-admin-bar-comments,#wpadminbar li#wp-admin-bar-customize,#wpadminbar li#wp-admin-bar-edit,#wpadminbar li#wp-admin-bar-menu-toggle,#wpadminbar li#wp-admin-bar-my-account,#wpadminbar li#wp-admin-bar-my-sites,#wpadminbar li#wp-admin-bar-new-content,#wpadminbar li#wp-admin-bar-site-editor,#wpadminbar li#wp-admin-bar-site-name,#wpadminbar li#wp-admin-bar-updates,#wpadminbar li#wp-admin-bar-wp-logo{display:block}#wpadminbar li.hover ul li,#wpadminbar li:hover ul li,#wpadminbar li:hover ul li:hover ul li{display:list-item}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{min-width:-moz-fit-content;min-width:fit-content}#wpadminbar ul#wp-admin-bar-root-default>li{margin-right:0}#wpadminbar #wp-admin-bar-comments,#wpadminbar #wp-admin-bar-edit,#wpadminbar #wp-admin-bar-my-account,#wpadminbar #wp-admin-bar-my-sites,#wpadminbar #wp-admin-bar-new-content,#wpadminbar #wp-admin-bar-site-name,#wpadminbar #wp-admin-bar-updates,#wpadminbar #wp-admin-bar-wp-logo,#wpadminbar .ab-top-menu,#wpadminbar .ab-top-secondary{position:static}#wpadminbar #wp-admin-bar-my-account{float:right}.network-admin #wpadminbar ul#wp-admin-bar-top-secondary>li#wp-admin-bar-my-account{margin-right:0}#wpadminbar .ab-top-secondary .menupop .menupop>.ab-item:before{top:10px;left:0}}@media screen and (max-width:600px){#wpadminbar{position:absolute}#wp-responsive-overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:400}#wpadminbar .ab-top-menu>.menupop>.ab-sub-wrapper{width:100%;left:0}#wpadminbar .menupop .menupop>.ab-item:before{display:none}#wpadminbar #wp-admin-bar-wp-logo.menupop .ab-sub-wrapper{margin-left:0}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper{margin:0;width:100%;top:auto;left:auto;position:relative}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper .ab-item{font-size:16px;padding:6px 15px 19px 30px}#wpadminbar li:hover ul li ul li{display:list-item}#wpadminbar li#wp-admin-bar-updates,#wpadminbar li#wp-admin-bar-wp-logo{display:none}#wpadminbar .ab-top-menu>.menupop li>.ab-sub-wrapper{position:static;box-shadow:none}}@media screen and (max-width:400px){#wpadminbar li#wp-admin-bar-comments{display:none}}/*! This file is auto-generated */ -.wp-pointer-content { - padding: 0 0 10px; - position: relative; - font-size: 13px; - background: #fff; - border: 1px solid #c3c4c7; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08); -} - -.wp-pointer-content h3 { - position: relative; - margin: -1px -1px 5px; - padding: 15px 60px 14px 18px; - border: 1px solid #2271b1; - border-bottom: none; - line-height: 1.4; - font-size: 14px; - color: #fff; - background: #2271b1; -} - -.wp-pointer-content h3:before { - background: #fff; - border-radius: 50%; - color: #2271b1; - content: "\f227"; - font: normal 20px/1.6 dashicons; - position: absolute; - top: 8px; - right: 15px; - speak: never; - text-align: center; - width: 32px; - height: 32px; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.wp-pointer-content h4 { - margin: 1.33em 20px 1em; - font-size: 1.15em; -} - -.wp-pointer-content p { - padding: 0 20px; -} - -.wp-pointer-buttons { - margin: 0; - padding: 5px 15px; - overflow: auto; -} - -.wp-pointer-buttons a { - float: left; - display: inline-block; - text-decoration: none; -} - -.wp-pointer-buttons a.close { - padding-right: 3px; - position: relative; -} - -.wp-pointer-buttons a.close:before { - background: none; - color: #787c82; - content: "\f153"; - display: block !important; - font: normal 16px/1 dashicons; - speak: never; - margin: 1px 0; - text-align: center; - -webkit-font-smoothing: antialiased !important; - width: 10px; - height: 100%; - position: absolute; - right: -15px; - top: 1px; -} - -.wp-pointer-buttons a.close:hover:before { - color: #d63638; -} - -/* The arrow base class must take up no space, even with transparent borders. */ -.wp-pointer-arrow, -.wp-pointer-arrow-inner { - position: absolute; - width: 0; - height: 0; -} - -.wp-pointer-arrow { - z-index: 10; - width: 0; - height: 0; - border: 0 solid transparent; -} - -.wp-pointer-arrow-inner { - z-index: 20; -} - -/* Make Room for the Arrow! */ -.wp-pointer-top, -.wp-pointer-undefined { - padding-top: 13px; -} - -.wp-pointer-bottom { - margin-top: -13px; - padding-bottom: 13px; -} - -/* rtl:ignore */ -.wp-pointer-left { - padding-left: 13px; -} -/* rtl:ignore */ -.wp-pointer-right { - margin-left: -13px; - padding-right: 13px; -} - -/* Base Size & Positioning */ -.wp-pointer-top .wp-pointer-arrow, -.wp-pointer-bottom .wp-pointer-arrow, -.wp-pointer-undefined .wp-pointer-arrow { - right: 50px; -} - -.wp-pointer-left .wp-pointer-arrow, -.wp-pointer-right .wp-pointer-arrow { - top: 50%; - margin-top: -15px; -} - -/* Arrow Sprite */ -.wp-pointer-top .wp-pointer-arrow, -.wp-pointer-undefined .wp-pointer-arrow { - top: 0; - border-width: 0 13px 13px; - border-bottom-color: #2271b1; -} - -.wp-pointer-top .wp-pointer-arrow-inner, -.wp-pointer-undefined .wp-pointer-arrow-inner { - top: 1px; - margin-right: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-bottom-color: #2271b1; - display: block; - content: " "; -} - -.wp-pointer-bottom .wp-pointer-arrow { - bottom: 0; - border-width: 13px 13px 0; - border-top-color: #c3c4c7; -} - -.wp-pointer-bottom .wp-pointer-arrow-inner { - bottom: 1px; - margin-right: -13px; - margin-bottom: -13px; - border: 13px solid transparent; - border-top-color: #fff; - display: block; - content: " "; -} - -/* rtl:ignore */ -.wp-pointer-left .wp-pointer-arrow { - left: 0; - border-width: 13px 13px 13px 0; - border-right-color: #c3c4c7; -} - -/* rtl:ignore */ -.wp-pointer-left .wp-pointer-arrow-inner { - left: 1px; - margin-left: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-right-color: #fff; - display: block; - content: " "; -} - -/* rtl:ignore */ -.wp-pointer-right .wp-pointer-arrow { - right: 0; - border-width: 13px 0 13px 13px; - border-left-color: #c3c4c7; -} - -/* rtl:ignore */ -.wp-pointer-right .wp-pointer-arrow-inner { - right: 1px; - margin-right: -13px; - margin-top: -13px; - border: 13px solid transparent; - border-left-color: #fff; - display: block; - content: " "; -} - -.wp-pointer.arrow-bottom .wp-pointer-content { - margin-bottom: -45px; -} - -.wp-pointer.arrow-bottom .wp-pointer-arrow { - top: 100%; - margin-top: -30px; -} - -/* Disable pointers at responsive sizes */ -@media screen and (max-width: 782px) { - .wp-pointer { - display: none; - } -} -:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-editor-format-toolbar__image-popover{z-index:159990}.block-editor-format-toolbar__image-container-content{display:flex}.block-editor-format-toolbar__image-container-content .components-button{align-self:flex-end;height:30px;margin-bottom:8px;margin-left:8px;padding:0 6px}.block-editor-format-toolbar__image-container-value{margin:7px;flex-grow:1;flex-shrink:1;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__field{margin-bottom:0}.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__label{display:block}.block-editor-format-toolbar__link-container-content{display:flex}.block-editor-format-toolbar__link-container-value{margin:7px;flex-grow:1;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-format-toolbar__link-container-value.has-invalid-link{color:#cc1818}.components-inline-color-popover .components-popover__content .components-tab-panel__tab-content{padding:16px}.components-inline-color-popover .components-popover__content .components-color-palette{margin-top:.6rem}.components-inline-color-popover .components-popover__content .components-base-control__title{display:block;margin-bottom:16px;font-weight:600;color:#191e23}.components-inline-color-popover .components-popover__content .component-color-indicator{vertical-align:text-bottom}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-editor-format-toolbar__image-popover{z-index:159990}.block-editor-format-toolbar__image-container-content{display:flex}.block-editor-format-toolbar__image-container-content .components-button{align-self:flex-end;height:30px;margin-bottom:8px;margin-right:8px;padding:0 6px}.block-editor-format-toolbar__image-container-value{margin:7px;flex-grow:1;flex-shrink:1;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__field{margin-bottom:0}.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__label{display:block}.block-editor-format-toolbar__link-container-content{display:flex}.block-editor-format-toolbar__link-container-value{margin:7px;flex-grow:1;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-format-toolbar__link-container-value.has-invalid-link{color:#cc1818}.components-inline-color-popover .components-popover__content .components-tab-panel__tab-content{padding:16px}.components-inline-color-popover .components-popover__content .components-color-palette{margin-top:.6rem}.components-inline-color-popover .components-popover__content .components-base-control__title{display:block;margin-bottom:16px;font-weight:600;color:#191e23}.components-inline-color-popover .components-popover__content .component-color-indicator{vertical-align:text-bottom}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-editor-format-toolbar__image-popover { - z-index: 159990; -} - -.block-editor-format-toolbar__image-container-content { - display: flex; -} -.block-editor-format-toolbar__image-container-content .components-button { - align-self: flex-end; - height: 30px; - margin-bottom: 8px; - margin-left: 8px; - padding: 0 6px; -} - -.block-editor-format-toolbar__image-container-value { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__field { - margin-bottom: 0; -} -.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__label { - display: block; -} - -.block-editor-format-toolbar__link-container-content { - display: flex; -} - -.block-editor-format-toolbar__link-container-value { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-format-toolbar__link-container-value.has-invalid-link { - color: #cc1818; -} - -.components-inline-color-popover .components-popover__content .components-tab-panel__tab-content { - padding: 16px; -} -.components-inline-color-popover .components-popover__content .components-color-palette { - margin-top: 0.6rem; -} -.components-inline-color-popover .components-popover__content .components-base-control__title { - display: block; - margin-bottom: 16px; - font-weight: 600; - color: #191e23; -} -.components-inline-color-popover .components-popover__content .component-color-indicator { - vertical-align: text-bottom; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-editor-format-toolbar__image-popover { - z-index: 159990; -} - -.block-editor-format-toolbar__image-container-content { - display: flex; -} -.block-editor-format-toolbar__image-container-content .components-button { - align-self: flex-end; - height: 30px; - margin-bottom: 8px; - margin-right: 8px; - padding: 0 6px; -} - -.block-editor-format-toolbar__image-container-value { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__field { - margin-bottom: 0; -} -.block-editor-format-toolbar__image-container-value.components-base-control .components-base-control__label { - display: block; -} - -.block-editor-format-toolbar__link-container-content { - display: flex; -} - -.block-editor-format-toolbar__link-container-value { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-format-toolbar__link-container-value.has-invalid-link { - color: #cc1818; -} - -.components-inline-color-popover .components-popover__content .components-tab-panel__tab-content { - padding: 16px; -} -.components-inline-color-popover .components-popover__content .components-color-palette { - margin-top: 0.6rem; -} -.components-inline-color-popover .components-popover__content .components-base-control__title { - display: block; - margin-bottom: 16px; - font-weight: 600; - color: #191e23; -} -.components-inline-color-popover .components-popover__content .component-color-indicator { - vertical-align: text-bottom; -}@charset "UTF-8";.wp-block-archives-dropdown label{display:block}.wp-block-avatar.aligncenter{text-align:center}.wp-block-audio{margin:0 0 1em}.wp-block-audio figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-audio audio{width:100%;min-width:300px}.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;cursor:pointer;display:inline-block;font-size:1.125em;padding:calc(.667em + 2px) calc(1.333em + 2px);text-align:center;text-decoration:none;word-break:break-word;box-sizing:border-box}.wp-block-button__link:active,.wp-block-button__link:focus,.wp-block-button__link:hover,.wp-block-button__link:visited{color:#fff}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*0.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*0.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*0.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{width:100%;flex-basis:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.is-style-outline>:where(.wp-block-button__link),:where(.wp-block-button__link).is-style-outline{border:2px solid;padding:.667em 1.333em}.is-style-outline>.wp-block-button__link:not(.has-text-color),.wp-block-button__link.is-style-outline:not(.has-text-color){color:currentColor}.is-style-outline>.wp-block-button__link:not(.has-background),.wp-block-button__link.is-style-outline:not(.has-background){background-color:transparent}.wp-block-buttons.is-vertical{flex-direction:column}.wp-block-buttons.is-vertical>.wp-block-button:last-child{margin-bottom:0}.wp-block-buttons>.wp-block-button{display:inline-block;margin:0}.wp-block-buttons.is-content-justification-left{justify-content:flex-start}.wp-block-buttons.is-content-justification-left.is-vertical{align-items:flex-start}.wp-block-buttons.is-content-justification-center{justify-content:center}.wp-block-buttons.is-content-justification-center.is-vertical{align-items:center}.wp-block-buttons.is-content-justification-right{justify-content:flex-end}.wp-block-buttons.is-content-justification-right.is-vertical{align-items:flex-end}.wp-block-buttons.is-content-justification-space-between{justify-content:space-between}.wp-block-buttons.aligncenter{text-align:center}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block-button.aligncenter{margin-right:auto;margin-left:auto;width:100%}.wp-block-button.aligncenter,.wp-block-calendar{text-align:center}.wp-block-calendar tbody td,.wp-block-calendar th{padding:.25em;border:1px solid #ddd}.wp-block-calendar tfoot td{border:none}.wp-block-calendar table{width:100%;border-collapse:collapse}.wp-block-calendar table th{font-weight:400;background:#ddd}.wp-block-calendar a{text-decoration:underline}.wp-block-calendar table caption,.wp-block-calendar table tbody{color:#40464d}.wp-block-categories.alignleft{margin-right:2em}.wp-block-categories.alignright{margin-left:2em}.wp-block-code code{display:block;font-family:inherit;overflow-wrap:break-word;white-space:pre-wrap}.wp-block-columns{display:flex;margin-bottom:1.75em;box-sizing:border-box;flex-wrap:wrap!important;align-items:normal!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;word-break:break-word;overflow-wrap:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow{margin-left:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow{margin-right:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-comments-pagination.aligncenter{justify-content:center}.wp-block-comment-template{margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-comment-template li{clear:both}.wp-block-comment-template ol{margin-bottom:0;max-width:100%;list-style:none;padding-right:2rem}.wp-block-cover,.wp-block-cover-image{position:relative;background-size:cover;background-position:50%;min-height:430px;width:100%;display:flex;justify-content:center;align-items:center;padding:1em;box-sizing:border-box}.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:fixed}@supports (-webkit-touch-callout:inherit){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}@media (prefers-reduced-motion:reduce){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}.wp-block-cover-image.is-repeated,.wp-block-cover.is-repeated{background-repeat:repeat;background-size:auto}.wp-block-cover-image.has-background-dim:not([class*=-background-color]),.wp-block-cover-image .has-background-dim:not([class*=-background-color]),.wp-block-cover.has-background-dim:not([class*=-background-color]),.wp-block-cover .has-background-dim:not([class*=-background-color]){background-color:#000}.wp-block-cover-image .has-background-dim.has-background-gradient,.wp-block-cover .has-background-dim.has-background-gradient{background-color:transparent}.wp-block-cover-image.has-background-dim:before,.wp-block-cover.has-background-dim:before{content:"";background-color:inherit}.wp-block-cover-image.has-background-dim:not(.has-background-gradient):before,.wp-block-cover-image .wp-block-cover__background,.wp-block-cover-image .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim:not(.has-background-gradient):before,.wp-block-cover .wp-block-cover__background,.wp-block-cover .wp-block-cover__gradient-background{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient):before{opacity:.1}.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient):before{opacity:.2}.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient):before{opacity:.3}.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient):before{opacity:.4}.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient):before{opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient):before{opacity:.6}.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient):before{opacity:.7}.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient):before{opacity:.8}.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient):before{opacity:.9}.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient):before{opacity:1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0{opacity:0}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10{opacity:.1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20{opacity:.2}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30{opacity:.3}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40{opacity:.4}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50{opacity:.5}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60{opacity:.6}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70{opacity:.7}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80{opacity:.8}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90{opacity:.9}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100{opacity:1}.wp-block-cover-image .block-library-cover__padding-visualizer,.wp-block-cover .block-library-cover__padding-visualizer{z-index:2}.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.alignleft,.wp-block-cover.alignright{max-width:420px;width:100%}.wp-block-cover-image:after,.wp-block-cover:after{display:block;content:"";font-size:0;min-height:inherit}@supports (position:sticky){.wp-block-cover-image:after,.wp-block-cover:after{content:none}}.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{display:flex}.wp-block-cover-image .wp-block-cover__inner-container,.wp-block-cover .wp-block-cover__inner-container{width:100%;z-index:1;color:#fff}.wp-block-cover-image.is-light .wp-block-cover__inner-container,.wp-block-cover.is-light .wp-block-cover__inner-container{color:#000}.wp-block-cover-image h1:not(.has-text-color),.wp-block-cover-image h2:not(.has-text-color),.wp-block-cover-image h3:not(.has-text-color),.wp-block-cover-image h4:not(.has-text-color),.wp-block-cover-image h5:not(.has-text-color),.wp-block-cover-image h6:not(.has-text-color),.wp-block-cover-image p:not(.has-text-color),.wp-block-cover h1:not(.has-text-color),.wp-block-cover h2:not(.has-text-color),.wp-block-cover h3:not(.has-text-color),.wp-block-cover h4:not(.has-text-color),.wp-block-cover h5:not(.has-text-color),.wp-block-cover h6:not(.has-text-color),.wp-block-cover p:not(.has-text-color){color:inherit}.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{align-items:flex-start;justify-content:flex-start}.wp-block-cover-image.is-position-top-center,.wp-block-cover.is-position-top-center{align-items:flex-start;justify-content:center}.wp-block-cover-image.is-position-top-right,.wp-block-cover.is-position-top-right{align-items:flex-start;justify-content:flex-end}.wp-block-cover-image.is-position-center-left,.wp-block-cover.is-position-center-left{align-items:center;justify-content:flex-start}.wp-block-cover-image.is-position-center-center,.wp-block-cover.is-position-center-center{align-items:center;justify-content:center}.wp-block-cover-image.is-position-center-right,.wp-block-cover.is-position-center-right{align-items:center;justify-content:flex-end}.wp-block-cover-image.is-position-bottom-left,.wp-block-cover.is-position-bottom-left{align-items:flex-end;justify-content:flex-start}.wp-block-cover-image.is-position-bottom-center,.wp-block-cover.is-position-bottom-center{align-items:flex-end;justify-content:center}.wp-block-cover-image.is-position-bottom-right,.wp-block-cover.is-position-bottom-right{align-items:flex-end;justify-content:flex-end}.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{margin:0;width:auto}.wp-block-cover-image img.wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background,.wp-block-cover img.wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background{position:absolute;top:0;right:0;left:0;bottom:0;margin:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;-o-object-fit:cover;object-fit:cover;outline:none;border:none;box-shadow:none}.wp-block-cover__image-background,.wp-block-cover__video-background{z-index:0}.wp-block-cover-image-text,.wp-block-cover-image-text a,.wp-block-cover-image-text a:active,.wp-block-cover-image-text a:focus,.wp-block-cover-image-text a:hover,.wp-block-cover-text,.wp-block-cover-text a,.wp-block-cover-text a:active,.wp-block-cover-text a:focus,.wp-block-cover-text a:hover,section.wp-block-cover-image h2,section.wp-block-cover-image h2 a,section.wp-block-cover-image h2 a:active,section.wp-block-cover-image h2 a:focus,section.wp-block-cover-image h2 a:hover{color:#fff}.wp-block-cover-image .wp-block-cover.has-left-content{justify-content:flex-start}.wp-block-cover-image .wp-block-cover.has-right-content{justify-content:flex-end}.wp-block-cover-image.has-left-content .wp-block-cover-image-text,.wp-block-cover.has-left-content .wp-block-cover-text,section.wp-block-cover-image.has-left-content>h2{margin-right:0;text-align:right}.wp-block-cover-image.has-right-content .wp-block-cover-image-text,.wp-block-cover.has-right-content .wp-block-cover-text,section.wp-block-cover-image.has-right-content>h2{margin-left:0;text-align:left}.wp-block-cover-image .wp-block-cover-image-text,.wp-block-cover .wp-block-cover-text,section.wp-block-cover-image>h2{font-size:2em;line-height:1.25;z-index:1;margin-bottom:0;max-width:840px;padding:.44em;text-align:center}.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-width:320px;min-height:240px}.wp-block-embed{margin:0 0 1em;overflow-wrap:break-word}.wp-block-embed figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{position:absolute;top:0;left:0;bottom:0;right:0;height:100%;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}.wp-block-file{margin-bottom:1.5em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file .wp-block-file__embed{margin-bottom:1em}.wp-block-file .wp-block-file__button{background:#32373c;border-radius:2em;color:#fff;font-size:.8em;padding:.5em 1em}.wp-block-file a.wp-block-file__button{text-decoration:none}.wp-block-file a.wp-block-file__button:active,.wp-block-file a.wp-block-file__button:focus,.wp-block-file a.wp-block-file__button:hover,.wp-block-file a.wp-block-file__button:visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}.wp-block-file *+.wp-block-file__button{margin-right:.75em}.blocks-gallery-grid:not(.has-nested-images),.wp-block-gallery:not(.has-nested-images){display:flex;flex-wrap:wrap;list-style-type:none;padding:0;margin:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item{margin:0 0 1em 1em;display:flex;flex-grow:1;flex-direction:column;justify-content:center;position:relative;width:calc(50% - 1em)}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n){margin-left:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure{margin:0;height:100%;display:flex;align-items:flex-end;justify-content:flex-start}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img{display:block;max-width:100%;height:auto;width:auto}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption{position:absolute;bottom:0;width:100%;max-height:100%;overflow:auto;padding:3em .77em .7em;color:#fff;text-align:center;font-size:.8em;background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);box-sizing:border-box;margin:0;z-index:2}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img{display:inline}.blocks-gallery-grid:not(.has-nested-images) figcaption,.wp-block-gallery:not(.has-nested-images) figcaption{flex-grow:1}.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img{width:100%;height:100%;flex:1;-o-object-fit:cover;object-fit:cover}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item{width:100%;margin-left:0}@media (min-width:600px){.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item{width:calc(33.33333% - .66667em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item{width:calc(25% - .75em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item{width:calc(20% - .8em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item{width:calc(16.66667% - .83333em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item{width:calc(14.28571% - .85714em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item{width:calc(12.5% - .875em);margin-left:1em}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n){margin-left:0}}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child{margin-left:0}.blocks-gallery-grid:not(.has-nested-images).alignleft,.blocks-gallery-grid:not(.has-nested-images).alignright,.wp-block-gallery:not(.has-nested-images).alignleft,.wp-block-gallery:not(.has-nested-images).alignright{max-width:420px;width:100%}.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure{justify-content:center}.wp-block-gallery:not(.is-cropped) .blocks-gallery-item{align-self:flex-start}figure.wp-block-gallery.has-nested-images{align-items:normal}.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)/2);margin:0}.wp-block-gallery.has-nested-images figure.wp-block-image{display:flex;flex-grow:1;justify-content:center;position:relative;flex-direction:column;max-width:100%}.wp-block-gallery.has-nested-images figure.wp-block-image>a,.wp-block-gallery.has-nested-images figure.wp-block-image>div{margin:0;flex-direction:column;flex-grow:1}.wp-block-gallery.has-nested-images figure.wp-block-image img{display:block;height:auto;max-width:100%!important;width:auto}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);bottom:0;color:#fff;font-size:13px;right:0;margin-bottom:0;max-height:60%;overflow:auto;padding:0 8px 8px;position:absolute;text-align:center;width:100%;box-sizing:border-box}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{display:inline}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a{color:inherit}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>a,.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>div{flex:1 1 auto}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption{flex:initial;background:none;color:inherit;margin:0;padding:10px 10px 9px;position:relative}.wp-block-gallery.has-nested-images figcaption{flex-grow:1;flex-basis:100%;text-align:center}.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image){margin-top:0;margin-bottom:auto}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image){align-self:inherit}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>div:not(.components-drop-zone){display:flex}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img{width:100%;flex:1 0 0%;height:100%;-o-object-fit:cover;object-fit:cover}.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image){width:100%}@media (min-width:600px){.wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image){width:calc(33.33333% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image){width:calc(25% - var(--wp--style--unstable-gallery-gap, 16px)*0.75)}.wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image){width:calc(20% - var(--wp--style--unstable-gallery-gap, 16px)*0.8)}.wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image){width:calc(16.66667% - var(--wp--style--unstable-gallery-gap, 16px)*0.83333)}.wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image){width:calc(14.28571% - var(--wp--style--unstable-gallery-gap, 16px)*0.85714)}.wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image){width:calc(12.5% - var(--wp--style--unstable-gallery-gap, 16px)*0.875)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image){width:calc(33.33% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2)~figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)*0.5)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:last-child{width:100%}}.wp-block-gallery.has-nested-images.alignleft,.wp-block-gallery.has-nested-images.alignright{max-width:420px;width:100%}.wp-block-gallery.has-nested-images.aligncenter{justify-content:center}.wp-block-group{box-sizing:border-box}h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}.wp-block-image{margin:0 0 1em}.wp-block-image img{height:auto;max-width:100%;vertical-align:bottom}.wp-block-image:not(.is-style-rounded)>a,.wp-block-image:not(.is-style-rounded) img{border-radius:inherit}.wp-block-image.aligncenter{text-align:center}.wp-block-image.alignfull img,.wp-block-image.alignwide img{height:auto;width:100%}.wp-block-image.aligncenter,.wp-block-image .aligncenter,.wp-block-image.alignleft,.wp-block-image .alignleft,.wp-block-image.alignright,.wp-block-image .alignright{display:table}.wp-block-image.aligncenter>figcaption,.wp-block-image .aligncenter>figcaption,.wp-block-image.alignleft>figcaption,.wp-block-image .alignleft>figcaption,.wp-block-image.alignright>figcaption,.wp-block-image .alignright>figcaption{display:table-caption;caption-side:bottom}.wp-block-image .alignleft{float:left;margin-left:1em;margin-top:.5em;margin-bottom:.5em}.wp-block-image .alignright{float:right;margin-right:1em;margin-top:.5em;margin-bottom:.5em}.wp-block-image .aligncenter{margin-right:auto;margin-left:auto}.wp-block-image figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-image.is-style-circle-mask img,.wp-block-image.is-style-rounded img,.wp-block-image .is-style-rounded img{border-radius:9999px}@supports ((-webkit-mask-image:none) or (mask-image:none)) or (-webkit-mask-image:none){.wp-block-image.is-style-circle-mask img{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');mask-mode:alpha;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;border-radius:0}}.wp-block-image figure{margin:0}ol.wp-block-latest-comments{margin-right:0}.wp-block-latest-comments .wp-block-latest-comments{padding-right:0}.wp-block-latest-comments__comment{line-height:1.1;list-style:none;margin-bottom:1em}.has-avatars .wp-block-latest-comments__comment{min-height:2.25em;list-style:none}.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt,.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta{margin-right:3.25em}.has-dates .wp-block-latest-comments__comment,.has-excerpts .wp-block-latest-comments__comment{line-height:1.5}.wp-block-latest-comments__comment-excerpt p{font-size:.875em;line-height:1.8;margin:.36em 0 1.4em}.wp-block-latest-comments__comment-date{display:block;font-size:.75em}.wp-block-latest-comments .avatar,.wp-block-latest-comments__comment-avatar{border-radius:1.5em;display:block;float:right;height:2.5em;margin-left:.75em;width:2.5em}.wp-block-latest-posts.alignleft{margin-right:2em}.wp-block-latest-posts.alignright{margin-left:2em}.wp-block-latest-posts.wp-block-latest-posts__list{list-style:none;padding-right:0}.wp-block-latest-posts.wp-block-latest-posts__list li{clear:both}.wp-block-latest-posts.is-grid{display:flex;flex-wrap:wrap;padding:0}.wp-block-latest-posts.is-grid li{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.wp-block-latest-posts.columns-2 li{width:calc(50% - .625em)}.wp-block-latest-posts.columns-2 li:nth-child(2n){margin-left:0}.wp-block-latest-posts.columns-3 li{width:calc(33.33333% - .83333em)}.wp-block-latest-posts.columns-3 li:nth-child(3n){margin-left:0}.wp-block-latest-posts.columns-4 li{width:calc(25% - .9375em)}.wp-block-latest-posts.columns-4 li:nth-child(4n){margin-left:0}.wp-block-latest-posts.columns-5 li{width:calc(20% - 1em)}.wp-block-latest-posts.columns-5 li:nth-child(5n){margin-left:0}.wp-block-latest-posts.columns-6 li{width:calc(16.66667% - 1.04167em)}.wp-block-latest-posts.columns-6 li:nth-child(6n){margin-left:0}}.wp-block-latest-posts__post-author,.wp-block-latest-posts__post-date{display:block;font-size:.8125em}.wp-block-latest-posts__post-excerpt{margin-top:.5em;margin-bottom:1em}.wp-block-latest-posts__featured-image a{display:inline-block}.wp-block-latest-posts__featured-image img{height:auto;width:auto;max-width:100%}.wp-block-latest-posts__featured-image.alignleft{margin-right:1em;float:left}.wp-block-latest-posts__featured-image.alignright{margin-left:1em;float:right}.wp-block-latest-posts__featured-image.aligncenter{margin-bottom:1em;text-align:center}ol,ul{box-sizing:border-box}ol.has-background,ul.has-background{padding:1.25em 2.375em}.wp-block-media-text{direction:ltr;display:grid;grid-template-columns:50% 1fr;grid-template-rows:auto}.wp-block-media-text.has-media-on-the-right{grid-template-columns:1fr 50%}.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media{align-self:start}.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media,.wp-block-media-text .wp-block-media-text__content,.wp-block-media-text .wp-block-media-text__media{align-self:center}.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media{align-self:end}.wp-block-media-text .wp-block-media-text__media{grid-column:1;grid-row:1;margin:0}.wp-block-media-text .wp-block-media-text__content{direction:rtl;grid-column:2;grid-row:1;padding:0 8%;word-break:break-word}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media{grid-column:2;grid-row:1}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content{grid-column:1;grid-row:1}.wp-block-media-text__media img,.wp-block-media-text__media video{height:auto;max-width:unset;width:100%;vertical-align:middle}.wp-block-media-text.is-image-fill .wp-block-media-text__media{height:100%;min-height:250px;background-size:cover}.wp-block-media-text.is-image-fill .wp-block-media-text__media>a{display:block;height:100%}.wp-block-media-text.is-image-fill .wp-block-media-text__media img{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}@media (max-width:600px){.wp-block-media-text.is-stacked-on-mobile{grid-template-columns:100%!important}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media{grid-column:1;grid-row:1}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content{grid-column:1;grid-row:2}}.wp-block-navigation{position:relative;--navigation-layout-justification-setting:flex-start;--navigation-layout-direction:row;--navigation-layout-wrap:wrap;--navigation-layout-justify:flex-start;--navigation-layout-align:center}.wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-right:0;padding-right:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{display:flex;align-items:center;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{color:inherit;display:block;padding:0}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;line-height:0;display:inline-block;font-size:inherit;padding:0;background-color:inherit;color:currentColor;border:none;width:.6em;height:.6em;margin-right:.25em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{display:inline-block;stroke:currentColor;width:inherit;height:inherit;margin-top:.075em}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container){background-color:inherit;color:inherit;position:absolute;z-index:2;display:flex;flex-direction:column;align-items:normal;opacity:0;transition:opacity .1s linear;visibility:hidden;width:0;height:0;overflow:hidden;right:-1px;top:100%}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{margin-left:0;margin-right:auto}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container:before{content:"";position:absolute;left:100%;height:100%;display:block;width:.5em;background:transparent}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon{margin-left:.25em}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg{transform:rotate(90deg)}}.wp-block-navigation .has-child:where(:not(.open-on-click)):hover>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{right:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:0}}.wp-block-navigation-submenu{position:relative;display:flex}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-size:inherit;font-family:inherit;line-height:inherit;font-style:inherit;font-weight:inherit;text-transform:inherit;text-align:right}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-left:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-right:-.6em;pointer-events:none}.wp-block-navigation,.wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background),.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background) .wp-block-navigation__container,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content,.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{right:auto;left:0}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:-1px;left:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:auto;left:100%}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;color:#000;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation__container{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);list-style:none;margin:0;padding-right:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}.wp-block-navigation__responsive-container{display:none;position:fixed;top:0;right:0;left:0;bottom:0}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){color:inherit!important;background-color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{display:flex;flex-direction:column;background-color:inherit;padding:2rem;overflow:auto;z-index:100000}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{padding-top:calc(2rem + 24px);overflow:visible;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:var(--navigation-layout-justification-setting,inherit)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{opacity:1;visibility:visible;height:auto;width:auto;overflow:initial;min-width:200px;position:static;border:none;padding-right:2rem;padding-left:2rem}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{display:flex;flex-direction:column;align-items:var(--navigation-layout-justification-setting,initial)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{color:inherit!important;background:transparent!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:auto;right:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){display:block;width:100%;position:relative;z-index:auto;background-color:inherit}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{right:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff;color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{vertical-align:middle;cursor:pointer;color:currentColor;background:transparent;border:none;margin:0;padding:0}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;pointer-events:none;display:block;width:24px;height:24px}.wp-block-navigation__responsive-container-open{display:flex}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{position:absolute;top:0;left:0;z-index:2}.wp-block-navigation__responsive-close{width:100%}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}html.has-modal-open{overflow:hidden}.wp-block-navigation .wp-block-navigation-item__label{word-break:normal;overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}.wp-block-navigation .wp-block-page-list{display:flex;flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);flex-wrap:var(--navigation-layout-wrap,wrap);background-color:inherit}.wp-block-navigation .wp-block-navigation-item{background-color:inherit}.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:right;font-size:8.4em;line-height:.68;font-weight:100;margin:.05em 0 0 .1em;text-transform:uppercase;font-style:normal}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}.wp-block-post-author{display:flex;flex-wrap:wrap}.wp-block-post-author__byline{width:100%;margin-top:0;margin-bottom:0;font-size:.5em}.wp-block-post-author__avatar{margin-left:1em}.wp-block-post-author__bio{margin-bottom:.7em;font-size:.7em}.wp-block-post-author__content{flex-grow:1;flex-basis:0}.wp-block-post-author__name{margin:0}.wp-block-post-comments .alignleft{float:right}.wp-block-post-comments .alignright{float:left}.wp-block-post-comments .navigation:after{content:"";display:table;clear:both}.wp-block-post-comments .commentlist{clear:both;list-style:none;margin:0;padding:0}.wp-block-post-comments .commentlist .comment{min-height:2.25em;padding-right:3.25em}.wp-block-post-comments .commentlist .comment p{font-size:1em;line-height:1.8;margin:1em 0}.wp-block-post-comments .commentlist .children{list-style:none;margin:0;padding:0}.wp-block-post-comments .comment-author{line-height:1.5}.wp-block-post-comments .comment-author .avatar{border-radius:1.5em;display:block;float:right;height:2.5em;margin-top:.5em;margin-left:.75em;width:2.5em}.wp-block-post-comments .comment-author cite{font-style:normal}.wp-block-post-comments .comment-meta{font-size:.875em;line-height:1.5}.wp-block-post-comments .comment-meta b{font-weight:400}.wp-block-post-comments .comment-meta .comment-awaiting-moderation{margin-top:1em;margin-bottom:1em;display:block}.wp-block-post-comments .comment-body .commentmetadata{font-size:.875em}.wp-block-post-comments .comment-form-author label,.wp-block-post-comments .comment-form-comment label,.wp-block-post-comments .comment-form-email label,.wp-block-post-comments .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments .comment-reply-title{margin-bottom:0}.wp-block-post-comments .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-right:.5em}.wp-block-post-comments .reply{font-size:.875em;margin-bottom:1.4em}.wp-block-post-comments input:not([type=submit]),.wp-block-post-comments textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments textarea{padding:calc(.667em + 2px)}.wp-block-post-comments input[type=submit]{border:none}.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title){font-weight:inherit}.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title){font-family:inherit}.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title),.wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title){font-size:inherit}.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title){line-height:inherit}.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title){font-style:inherit}.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title){letter-spacing:inherit}.wp-block-post-comments-form input[type=submit]{border:none;box-shadow:none;cursor:pointer;display:inline-block;text-align:center;overflow-wrap:break-word}.wp-block-post-comments-form input:not([type=submit]),.wp-block-post-comments-form textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form textarea{padding:calc(.667em + 2px)}.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments-form .comment-form-author label,.wp-block-post-comments-form .comment-form-email label,.wp-block-post-comments-form .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments-form .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments-form .comment-reply-title{margin-bottom:0}.wp-block-post-comments-form .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-right:.5em}.wp-block-post-excerpt__more-link{display:inline-block}.wp-block-post-featured-image{margin-right:0;margin-left:0}.wp-block-post-featured-image a{display:block}.wp-block-post-featured-image img{max-width:100%;width:100%;height:auto;vertical-align:bottom}.wp-block-post-featured-image.alignfull img,.wp-block-post-featured-image.alignwide img{width:100%}.wp-block-post-terms__separator{white-space:pre-wrap}.wp-block-post-title{word-break:break-word}.wp-block-post-title a{display:inline-block}.wp-block-preformatted{white-space:pre-wrap}.wp-block-preformatted.has-background{padding:1.25em 2.375em}.wp-block-pullquote{margin:0 0 1em;padding:3em 0;text-align:center;overflow-wrap:break-word;box-sizing:border-box}.wp-block-pullquote blockquote,.wp-block-pullquote cite,.wp-block-pullquote p{color:inherit}.wp-block-pullquote.alignleft,.wp-block-pullquote.alignright,.wp-block-pullquote.has-text-align-left,.wp-block-pullquote.has-text-align-right{max-width:420px}.wp-block-pullquote.alignleft p,.wp-block-pullquote.alignright p,.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p{font-size:1.25em}.wp-block-pullquote p{font-size:1.75em;line-height:1.6}.wp-block-pullquote cite,.wp-block-pullquote footer{position:relative}.wp-block-pullquote .has-text-color a{color:inherit}.wp-block-pullquote.has-text-align-left blockquote{text-align:right}.wp-block-pullquote.has-text-align-right blockquote{text-align:left}.wp-block-pullquote.is-style-solid-color{border:none}.wp-block-pullquote.is-style-solid-color blockquote{margin-right:auto;margin-left:auto;max-width:60%}.wp-block-pullquote.is-style-solid-color blockquote p{margin-top:0;margin-bottom:0;font-size:2em}.wp-block-pullquote.is-style-solid-color blockquote cite{text-transform:none;font-style:normal}.wp-block-pullquote cite{color:inherit}.wp-block-post-template,.wp-block-query-loop{margin-top:0;margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-post-template.wp-block-post-template,.wp-block-query-loop.wp-block-post-template{background:none}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap;gap:1.25em}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow{margin-left:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-query-pagination .wp-block-query-pagination-next-arrow{margin-right:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(-1)}.wp-block-query-pagination.aligncenter{justify-content:center}.wp-block-quote{box-sizing:border-box;overflow-wrap:break-word}.wp-block-quote.is-large:not(.is-style-plain),.wp-block-quote.is-style-large:not(.is-style-plain){margin-bottom:1em;padding:0 1em}.wp-block-quote.is-large:not(.is-style-plain) p,.wp-block-quote.is-style-large:not(.is-style-plain) p{font-size:1.5em;font-style:italic;line-height:1.6}.wp-block-quote.is-large:not(.is-style-plain) cite,.wp-block-quote.is-large:not(.is-style-plain) footer,.wp-block-quote.is-style-large:not(.is-style-plain) cite,.wp-block-quote.is-style-large:not(.is-style-plain) footer{font-size:1.125em;text-align:left}.wp-block-read-more{display:block;width:-moz-fit-content;width:fit-content}.wp-block-read-more:not([style*=text-decoration]),.wp-block-read-more:not([style*=text-decoration]):active,.wp-block-read-more:not([style*=text-decoration]):focus{text-decoration:none}ul.wp-block-rss{list-style:none;padding:0}ul.wp-block-rss.wp-block-rss{box-sizing:border-box}ul.wp-block-rss.alignleft{margin-right:2em}ul.wp-block-rss.alignright{margin-left:2em}ul.wp-block-rss.is-grid{display:flex;flex-wrap:wrap;padding:0;list-style:none}ul.wp-block-rss.is-grid li{margin:0 0 1em 1em;width:100%}@media (min-width:600px){ul.wp-block-rss.columns-2 li{width:calc(50% - 1em)}ul.wp-block-rss.columns-3 li{width:calc(33.33333% - 1em)}ul.wp-block-rss.columns-4 li{width:calc(25% - 1em)}ul.wp-block-rss.columns-5 li{width:calc(20% - 1em)}ul.wp-block-rss.columns-6 li{width:calc(16.66667% - 1em)}}.wp-block-rss__item-author,.wp-block-rss__item-publish-date{display:block;font-size:.8125em}.wp-block-search__button{background:#f7f7f7;border:1px solid #ccc;padding:.375em .625em;color:#32373c;margin-right:.625em;word-break:normal;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{min-width:1.5em;min-height:1.5em;fill:currentColor}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{padding:8px;flex-grow:1;min-width:3em;border:1px solid #949494;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search.wp-block-search__button-only .wp-block-search__button{margin-right:0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper{padding:4px;border:1px solid #949494}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input{border-radius:0;border:none;padding:0 .25em 0 0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus{outline:none}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button{padding:.125em .5em}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block-separator{border-top:1px solid;border-bottom:1px solid}.wp-block-separator.is-style-dots{background:none!important;border:none;text-align:center;line-height:1;height:auto}.wp-block-separator.is-style-dots:before{content:"···";color:currentColor;font-size:1.5em;letter-spacing:2em;padding-left:2em;font-family:serif}.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo.is-style-rounded{border-radius:9999px}.wp-block-social-links{padding-right:0;padding-left:0;text-indent:0;margin-right:0;background:none}.wp-block-social-links .wp-social-link a,.wp-block-social-links .wp-social-link a:hover{text-decoration:none;border-bottom:0;box-shadow:none}.wp-block-social-links .wp-social-link a{padding:.25em}.wp-block-social-links .wp-social-link svg{width:1em;height:1em}.wp-block-social-links .wp-social-link span:not(.screen-reader-text){margin-right:.5em;margin-left:.5em;font-size:.65em}.wp-block-social-links.has-small-icon-size{font-size:16px}.wp-block-social-links,.wp-block-social-links.has-normal-icon-size{font-size:24px}.wp-block-social-links.has-large-icon-size{font-size:36px}.wp-block-social-links.has-huge-icon-size{font-size:48px}.wp-block-social-links.aligncenter{justify-content:center;display:flex}.wp-block-social-links.alignright{justify-content:flex-end}.wp-block-social-link{display:block;border-radius:9999px;transition:transform .1s ease;height:auto}@media (prefers-reduced-motion:reduce){.wp-block-social-link{transition-duration:0s;transition-delay:0s}}.wp-block-social-link a{align-items:center;display:flex;line-height:0;transition:transform .1s ease}.wp-block-social-link:hover{transform:scale(1.1)}.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg{color:currentColor;fill:currentColor}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link{background-color:#f0f0f0;color:#444}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon{background-color:#f90;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp{background-color:#1ea0c3;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance{background-color:#0757fe;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen{background-color:#1e1f26;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart{background-color:#02e49b;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble{background-color:#e94c89;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox{background-color:#4280ff;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy{background-color:#f45800;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook{background-color:#1778f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr{background-color:#0461dd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare{background-color:#e65678;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github{background-color:#24292d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads{background-color:#eceadd;color:#382110}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google{background-color:#ea4434;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram{background-color:#f00075;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm{background-color:#e21b24;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin{background-color:#0d66c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon{background-color:#3288d4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium{background-color:#02ab6c;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup{background-color:#f6405f;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon{background-color:#ff424d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest{background-color:#e60122;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket{background-color:#ef4155;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit{background-color:#fe4500;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype{background-color:#0478d7;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat{background-color:#fefc00;color:#fff;stroke:#000}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud{background-color:#ff5600;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify{background-color:#1bd760;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram{background-color:#2aabee;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr{background-color:#011835;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch{background-color:#6440a4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter{background-color:#1da1f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo{background-color:#1eb7ea;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk{background-color:#4680c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress{background-color:#3499cd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp{background-color:#d32422;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube{background-color:red;color:#fff}.wp-block-social-links.is-style-logos-only .wp-social-link{background:none}.wp-block-social-links.is-style-logos-only .wp-social-link a{padding:0}.wp-block-social-links.is-style-logos-only .wp-social-link svg{width:1.25em;height:1.25em}.wp-block-social-links.is-style-logos-only .wp-social-link-amazon{color:#f90}.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp{color:#1ea0c3}.wp-block-social-links.is-style-logos-only .wp-social-link-behance{color:#0757fe}.wp-block-social-links.is-style-logos-only .wp-social-link-codepen{color:#1e1f26}.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart{color:#02e49b}.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble{color:#e94c89}.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox{color:#4280ff}.wp-block-social-links.is-style-logos-only .wp-social-link-etsy{color:#f45800}.wp-block-social-links.is-style-logos-only .wp-social-link-facebook{color:#1778f2}.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-flickr{color:#0461dd}.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare{color:#e65678}.wp-block-social-links.is-style-logos-only .wp-social-link-github{color:#24292d}.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads{color:#382110}.wp-block-social-links.is-style-logos-only .wp-social-link-google{color:#ea4434}.wp-block-social-links.is-style-logos-only .wp-social-link-instagram{color:#f00075}.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm{color:#e21b24}.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin{color:#0d66c2}.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon{color:#3288d4}.wp-block-social-links.is-style-logos-only .wp-social-link-medium{color:#02ab6c}.wp-block-social-links.is-style-logos-only .wp-social-link-meetup{color:#f6405f}.wp-block-social-links.is-style-logos-only .wp-social-link-patreon{color:#ff424d}.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest{color:#e60122}.wp-block-social-links.is-style-logos-only .wp-social-link-pocket{color:#ef4155}.wp-block-social-links.is-style-logos-only .wp-social-link-reddit{color:#fe4500}.wp-block-social-links.is-style-logos-only .wp-social-link-skype{color:#0478d7}.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat{color:#fff;stroke:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud{color:#ff5600}.wp-block-social-links.is-style-logos-only .wp-social-link-spotify{color:#1bd760}.wp-block-social-links.is-style-logos-only .wp-social-link-telegram{color:#2aabee}.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr{color:#011835}.wp-block-social-links.is-style-logos-only .wp-social-link-twitch{color:#6440a4}.wp-block-social-links.is-style-logos-only .wp-social-link-twitter{color:#1da1f2}.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo{color:#1eb7ea}.wp-block-social-links.is-style-logos-only .wp-social-link-vk{color:#4680c2}.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress{color:#3499cd}.wp-block-social-links.is-style-logos-only .wp-social-link-yelp{color:#d32422}.wp-block-social-links.is-style-logos-only .wp-social-link-youtube{color:red}.wp-block-social-links.is-style-pill-shape .wp-social-link{width:auto}.wp-block-social-links.is-style-pill-shape .wp-social-link a{padding-right:.66667em;padding-left:.66667em}.wp-block-spacer{clear:both}.wp-block-tag-cloud.aligncenter{text-align:center}.wp-block-tag-cloud.alignfull{padding-right:1em;padding-left:1em}.wp-block-tag-cloud a{display:inline-block;margin-left:5px}.wp-block-tag-cloud span{display:inline-block;margin-right:5px;text-decoration:none}.wp-block-tag-cloud.is-style-outline{display:flex;flex-wrap:wrap;gap:1ch}.wp-block-tag-cloud.is-style-outline a{border:1px solid;font-size:unset!important;margin-left:0;padding:1ch 2ch;text-decoration:none!important}.wp-block-table{margin:0 0 1em;overflow-x:auto}.wp-block-table table{border-collapse:collapse;width:100%}.wp-block-table .has-fixed-layout{table-layout:fixed;width:100%}.wp-block-table .has-fixed-layout td,.wp-block-table .has-fixed-layout th{word-break:break-word}.wp-block-table.aligncenter,.wp-block-table.alignleft,.wp-block-table.alignright{display:table;width:auto}.wp-block-table.aligncenter td,.wp-block-table.aligncenter th,.wp-block-table.alignleft td,.wp-block-table.alignleft th,.wp-block-table.alignright td,.wp-block-table.alignright th{word-break:break-word}.wp-block-table .has-subtle-light-gray-background-color{background-color:#f3f4f5}.wp-block-table .has-subtle-pale-green-background-color{background-color:#e9fbe5}.wp-block-table .has-subtle-pale-blue-background-color{background-color:#e7f5fe}.wp-block-table .has-subtle-pale-pink-background-color{background-color:#fcf0ef}.wp-block-table.is-style-stripes{border-spacing:0;border-collapse:inherit;background-color:transparent;border-bottom:1px solid #f0f0f0}.wp-block-table.is-style-stripes tbody tr:nth-child(odd){background-color:#f0f0f0}.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd){background-color:#f3f4f5}.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd){background-color:#e9fbe5}.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd){background-color:#e7f5fe}.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd){background-color:#fcf0ef}.wp-block-table.is-style-stripes td,.wp-block-table.is-style-stripes th{border-color:transparent}.wp-block-table .has-border-color>*,.wp-block-table .has-border-color td,.wp-block-table .has-border-color th,.wp-block-table .has-border-color tr{border-color:inherit}.wp-block-table table[style*=border-style]>*,.wp-block-table table[style*=border-style] td,.wp-block-table table[style*=border-style] th,.wp-block-table table[style*=border-style] tr{border-style:inherit}.wp-block-table table[style*=border-width]>*,.wp-block-table table[style*=border-width] td,.wp-block-table table[style*=border-width] th,.wp-block-table table[style*=border-width] tr{border-width:inherit;border-style:inherit}.wp-block-text-columns,.wp-block-text-columns.aligncenter{display:flex}.wp-block-text-columns .wp-block-column{margin:0 1em;padding:0}.wp-block-text-columns .wp-block-column:first-child{margin-right:0}.wp-block-text-columns .wp-block-column:last-child{margin-left:0}.wp-block-text-columns.columns-2 .wp-block-column{width:50%}.wp-block-text-columns.columns-3 .wp-block-column{width:33.33333%}.wp-block-text-columns.columns-4 .wp-block-column{width:25%}pre.wp-block-verse{font-family:inherit;overflow:auto;white-space:pre-wrap}.wp-block-video{margin:0 0 1em}.wp-block-video video{width:100%}@supports (position:sticky){.wp-block-video [poster]{-o-object-fit:cover;object-fit:cover}}.wp-block-video.aligncenter{text-align:center}.wp-block-video figcaption{margin-top:.5em;margin-bottom:1em}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(-135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(-135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(-135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(-135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(-135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(-135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(-135deg,#020381,#2874fc)}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#444;display:block;font-size:1em;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color),html :where([style*=border-width]){border-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(-135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(-135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(-135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(-135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(-135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(-135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(-135deg,#020381,#2874fc)}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#444;display:block;font-size:1em;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color),html :where([style*=border-width]){border-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-audio figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-code { - border: 1px solid #ccc; - border-radius: 4px; - font-family: Menlo, Consolas, monaco, monospace; - padding: 0.8em 1em; -} - -.wp-block-embed figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-embed figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-gallery-caption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .blocks-gallery-caption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-image figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-image figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-pullquote { - border-top: 4px solid currentColor; - border-bottom: 4px solid currentColor; - margin-bottom: 1.75em; - color: currentColor; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer, .wp-block-pullquote__citation { - color: currentColor; - text-transform: uppercase; - font-size: 0.8125em; - font-style: normal; -} - -.wp-block-quote { - border-left: 0.25em solid currentColor; - margin: 0 0 1.75em 0; - padding-left: 1em; -} -.wp-block-quote cite, -.wp-block-quote footer { - color: currentColor; - font-size: 0.8125em; - position: relative; - font-style: normal; -} -.wp-block-quote.has-text-align-right { - border-left: none; - border-right: 0.25em solid currentColor; - padding-left: 0; - padding-right: 1em; -} -.wp-block-quote.has-text-align-center { - border: none; - padding-left: 0; -} -.wp-block-quote.is-style-plain, .wp-block-quote.is-style-large, .wp-block-quote.is-large { - border: none; -} - -.wp-block-search .wp-block-search__label { - font-weight: bold; -} - -:where(.wp-block-group.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-separator.has-css-opacity { - opacity: 0.4; -} - -.wp-block-separator { - border: none; - border-bottom: 2px solid currentColor; - margin-left: auto; - margin-right: auto; -} -.wp-block-separator.has-alpha-channel-opacity { - opacity: initial; -} -.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { - width: 100px; -} -.wp-block-separator.has-background:not(.is-style-dots) { - border-bottom: none; - height: 1px; -} -.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots) { - height: 2px; -} - -.wp-block-table thead { - border-bottom: 3px solid; -} -.wp-block-table tfoot { - border-top: 3px solid; -} -.wp-block-table td, -.wp-block-table th { - padding: 0.5em; - border: 1px solid; - word-break: normal; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-video figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-video figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-template-part.has-background { - padding: 1.25em 2.375em; - margin-top: 0; - margin-bottom: 0; -}@charset "UTF-8";.wp-block-archives-dropdown label{display:block}.wp-block-avatar.aligncenter{text-align:center}.wp-block-audio{margin:0 0 1em}.wp-block-audio figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-audio audio{width:100%;min-width:300px}.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;cursor:pointer;display:inline-block;font-size:1.125em;padding:calc(.667em + 2px) calc(1.333em + 2px);text-align:center;text-decoration:none;word-break:break-word;box-sizing:border-box}.wp-block-button__link:active,.wp-block-button__link:focus,.wp-block-button__link:hover,.wp-block-button__link:visited{color:#fff}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*0.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*0.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*0.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{width:100%;flex-basis:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.is-style-outline>:where(.wp-block-button__link),:where(.wp-block-button__link).is-style-outline{border:2px solid;padding:.667em 1.333em}.is-style-outline>.wp-block-button__link:not(.has-text-color),.wp-block-button__link.is-style-outline:not(.has-text-color){color:currentColor}.is-style-outline>.wp-block-button__link:not(.has-background),.wp-block-button__link.is-style-outline:not(.has-background){background-color:transparent}.wp-block-buttons.is-vertical{flex-direction:column}.wp-block-buttons.is-vertical>.wp-block-button:last-child{margin-bottom:0}.wp-block-buttons>.wp-block-button{display:inline-block;margin:0}.wp-block-buttons.is-content-justification-left{justify-content:flex-start}.wp-block-buttons.is-content-justification-left.is-vertical{align-items:flex-start}.wp-block-buttons.is-content-justification-center{justify-content:center}.wp-block-buttons.is-content-justification-center.is-vertical{align-items:center}.wp-block-buttons.is-content-justification-right{justify-content:flex-end}.wp-block-buttons.is-content-justification-right.is-vertical{align-items:flex-end}.wp-block-buttons.is-content-justification-space-between{justify-content:space-between}.wp-block-buttons.aligncenter{text-align:center}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block-button.aligncenter{margin-left:auto;margin-right:auto;width:100%}.wp-block-button.aligncenter,.wp-block-calendar{text-align:center}.wp-block-calendar tbody td,.wp-block-calendar th{padding:.25em;border:1px solid #ddd}.wp-block-calendar tfoot td{border:none}.wp-block-calendar table{width:100%;border-collapse:collapse}.wp-block-calendar table th{font-weight:400;background:#ddd}.wp-block-calendar a{text-decoration:underline}.wp-block-calendar table caption,.wp-block-calendar table tbody{color:#40464d}.wp-block-categories.alignleft{margin-right:2em}.wp-block-categories.alignright{margin-left:2em}.wp-block-code code{display:block;font-family:inherit;overflow-wrap:break-word;white-space:pre-wrap}.wp-block-columns{display:flex;margin-bottom:1.75em;box-sizing:border-box;flex-wrap:wrap!important;align-items:normal!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;word-break:break-word;overflow-wrap:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow{margin-right:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow{margin-left:1ch;display:inline-block}.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-comments-pagination.aligncenter{justify-content:center}.wp-block-comment-template{margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-comment-template li{clear:both}.wp-block-comment-template ol{margin-bottom:0;max-width:100%;list-style:none;padding-left:2rem}.wp-block-cover,.wp-block-cover-image{position:relative;background-size:cover;background-position:50%;min-height:430px;width:100%;display:flex;justify-content:center;align-items:center;padding:1em;box-sizing:border-box}.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:fixed}@supports (-webkit-touch-callout:inherit){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}@media (prefers-reduced-motion:reduce){.wp-block-cover-image.has-parallax,.wp-block-cover.has-parallax{background-attachment:scroll}}.wp-block-cover-image.is-repeated,.wp-block-cover.is-repeated{background-repeat:repeat;background-size:auto}.wp-block-cover-image.has-background-dim:not([class*=-background-color]),.wp-block-cover-image .has-background-dim:not([class*=-background-color]),.wp-block-cover.has-background-dim:not([class*=-background-color]),.wp-block-cover .has-background-dim:not([class*=-background-color]){background-color:#000}.wp-block-cover-image .has-background-dim.has-background-gradient,.wp-block-cover .has-background-dim.has-background-gradient{background-color:transparent}.wp-block-cover-image.has-background-dim:before,.wp-block-cover.has-background-dim:before{content:"";background-color:inherit}.wp-block-cover-image.has-background-dim:not(.has-background-gradient):before,.wp-block-cover-image .wp-block-cover__background,.wp-block-cover-image .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim:not(.has-background-gradient):before,.wp-block-cover .wp-block-cover__background,.wp-block-cover .wp-block-cover__gradient-background{position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient):before{opacity:.1}.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient):before{opacity:.2}.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient):before{opacity:.3}.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient):before{opacity:.4}.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient):before{opacity:.5}.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient):before{opacity:.6}.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient):before{opacity:.7}.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient):before{opacity:.8}.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient):before{opacity:.9}.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient):before,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background,.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background,.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient):before{opacity:1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0{opacity:0}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10{opacity:.1}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20{opacity:.2}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30{opacity:.3}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40{opacity:.4}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50{opacity:.5}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60{opacity:.6}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70{opacity:.7}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80{opacity:.8}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90{opacity:.9}.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100,.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100{opacity:1}.wp-block-cover-image .block-library-cover__padding-visualizer,.wp-block-cover .block-library-cover__padding-visualizer{z-index:2}.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.alignleft,.wp-block-cover.alignright{max-width:420px;width:100%}.wp-block-cover-image:after,.wp-block-cover:after{display:block;content:"";font-size:0;min-height:inherit}@supports (position:sticky){.wp-block-cover-image:after,.wp-block-cover:after{content:none}}.wp-block-cover-image.aligncenter,.wp-block-cover-image.alignleft,.wp-block-cover-image.alignright,.wp-block-cover.aligncenter,.wp-block-cover.alignleft,.wp-block-cover.alignright{display:flex}.wp-block-cover-image .wp-block-cover__inner-container,.wp-block-cover .wp-block-cover__inner-container{width:100%;z-index:1;color:#fff}.wp-block-cover-image.is-light .wp-block-cover__inner-container,.wp-block-cover.is-light .wp-block-cover__inner-container{color:#000}.wp-block-cover-image h1:not(.has-text-color),.wp-block-cover-image h2:not(.has-text-color),.wp-block-cover-image h3:not(.has-text-color),.wp-block-cover-image h4:not(.has-text-color),.wp-block-cover-image h5:not(.has-text-color),.wp-block-cover-image h6:not(.has-text-color),.wp-block-cover-image p:not(.has-text-color),.wp-block-cover h1:not(.has-text-color),.wp-block-cover h2:not(.has-text-color),.wp-block-cover h3:not(.has-text-color),.wp-block-cover h4:not(.has-text-color),.wp-block-cover h5:not(.has-text-color),.wp-block-cover h6:not(.has-text-color),.wp-block-cover p:not(.has-text-color){color:inherit}.wp-block-cover-image.is-position-top-left,.wp-block-cover.is-position-top-left{align-items:flex-start;justify-content:flex-start}.wp-block-cover-image.is-position-top-center,.wp-block-cover.is-position-top-center{align-items:flex-start;justify-content:center}.wp-block-cover-image.is-position-top-right,.wp-block-cover.is-position-top-right{align-items:flex-start;justify-content:flex-end}.wp-block-cover-image.is-position-center-left,.wp-block-cover.is-position-center-left{align-items:center;justify-content:flex-start}.wp-block-cover-image.is-position-center-center,.wp-block-cover.is-position-center-center{align-items:center;justify-content:center}.wp-block-cover-image.is-position-center-right,.wp-block-cover.is-position-center-right{align-items:center;justify-content:flex-end}.wp-block-cover-image.is-position-bottom-left,.wp-block-cover.is-position-bottom-left{align-items:flex-end;justify-content:flex-start}.wp-block-cover-image.is-position-bottom-center,.wp-block-cover.is-position-bottom-center{align-items:flex-end;justify-content:center}.wp-block-cover-image.is-position-bottom-right,.wp-block-cover.is-position-bottom-right{align-items:flex-end;justify-content:flex-end}.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{margin:0;width:auto}.wp-block-cover-image img.wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background,.wp-block-cover img.wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background{position:absolute;top:0;left:0;right:0;bottom:0;margin:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;-o-object-fit:cover;object-fit:cover;outline:none;border:none;box-shadow:none}.wp-block-cover__image-background,.wp-block-cover__video-background{z-index:0}.wp-block-cover-image-text,.wp-block-cover-image-text a,.wp-block-cover-image-text a:active,.wp-block-cover-image-text a:focus,.wp-block-cover-image-text a:hover,.wp-block-cover-text,.wp-block-cover-text a,.wp-block-cover-text a:active,.wp-block-cover-text a:focus,.wp-block-cover-text a:hover,section.wp-block-cover-image h2,section.wp-block-cover-image h2 a,section.wp-block-cover-image h2 a:active,section.wp-block-cover-image h2 a:focus,section.wp-block-cover-image h2 a:hover{color:#fff}.wp-block-cover-image .wp-block-cover.has-left-content{justify-content:flex-start}.wp-block-cover-image .wp-block-cover.has-right-content{justify-content:flex-end}.wp-block-cover-image.has-left-content .wp-block-cover-image-text,.wp-block-cover.has-left-content .wp-block-cover-text,section.wp-block-cover-image.has-left-content>h2{margin-left:0;text-align:left}.wp-block-cover-image.has-right-content .wp-block-cover-image-text,.wp-block-cover.has-right-content .wp-block-cover-text,section.wp-block-cover-image.has-right-content>h2{margin-right:0;text-align:right}.wp-block-cover-image .wp-block-cover-image-text,.wp-block-cover .wp-block-cover-text,section.wp-block-cover-image>h2{font-size:2em;line-height:1.25;z-index:1;margin-bottom:0;max-width:840px;padding:.44em;text-align:center}.wp-block-embed.alignleft,.wp-block-embed.alignright,.wp-block[data-align=left]>[data-type="core/embed"],.wp-block[data-align=right]>[data-type="core/embed"]{max-width:360px;width:100%}.wp-block-embed.alignleft .wp-block-embed__wrapper,.wp-block-embed.alignright .wp-block-embed__wrapper,.wp-block[data-align=left]>[data-type="core/embed"] .wp-block-embed__wrapper,.wp-block[data-align=right]>[data-type="core/embed"] .wp-block-embed__wrapper{min-width:280px}.wp-block-cover .wp-block-embed{min-width:320px;min-height:240px}.wp-block-embed{margin:0 0 1em;overflow-wrap:break-word}.wp-block-embed figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-embed iframe{max-width:100%}.wp-block-embed__wrapper{position:relative}.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper:before{content:"";display:block;padding-top:50%}.wp-embed-responsive .wp-has-aspect-ratio iframe{position:absolute;top:0;right:0;bottom:0;left:0;height:100%;width:100%}.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before{padding-top:42.85%}.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper:before{padding-top:50%}.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before{padding-top:56.25%}.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before{padding-top:75%}.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper:before{padding-top:100%}.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper:before{padding-top:177.77%}.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper:before{padding-top:200%}.wp-block-file{margin-bottom:1.5em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file .wp-block-file__embed{margin-bottom:1em}.wp-block-file .wp-block-file__button{background:#32373c;border-radius:2em;color:#fff;font-size:.8em;padding:.5em 1em}.wp-block-file a.wp-block-file__button{text-decoration:none}.wp-block-file a.wp-block-file__button:active,.wp-block-file a.wp-block-file__button:focus,.wp-block-file a.wp-block-file__button:hover,.wp-block-file a.wp-block-file__button:visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}.wp-block-file *+.wp-block-file__button{margin-left:.75em}.blocks-gallery-grid:not(.has-nested-images),.wp-block-gallery:not(.has-nested-images){display:flex;flex-wrap:wrap;list-style-type:none;padding:0;margin:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item{margin:0 1em 1em 0;display:flex;flex-grow:1;flex-direction:column;justify-content:center;position:relative;width:calc(50% - 1em)}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(2n){margin-right:0}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure{margin:0;height:100%;display:flex;align-items:flex-end;justify-content:flex-start}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img{display:block;max-width:100%;height:auto;width:auto}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption{position:absolute;bottom:0;width:100%;max-height:100%;overflow:auto;padding:3em .77em .7em;color:#fff;text-align:center;font-size:.8em;background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);box-sizing:border-box;margin:0;z-index:2}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img{display:inline}.blocks-gallery-grid:not(.has-nested-images) figcaption,.wp-block-gallery:not(.has-nested-images) figcaption{flex-grow:1}.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a,.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a,.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img{width:100%;height:100%;flex:1;-o-object-fit:cover;object-fit:cover}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item{width:100%;margin-right:0}@media (min-width:600px){.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item{width:calc(33.33333% - .66667em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item{width:calc(25% - .75em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item{width:calc(20% - .8em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item{width:calc(16.66667% - .83333em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item{width:calc(14.28571% - .85714em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image,.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image,.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item{width:calc(12.5% - .875em);margin-right:1em}.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n),.wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n){margin-right:0}}.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child,.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child,.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child{margin-right:0}.blocks-gallery-grid:not(.has-nested-images).alignleft,.blocks-gallery-grid:not(.has-nested-images).alignright,.wp-block-gallery:not(.has-nested-images).alignleft,.wp-block-gallery:not(.has-nested-images).alignright{max-width:420px;width:100%}.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure,.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure{justify-content:center}.wp-block-gallery:not(.is-cropped) .blocks-gallery-item{align-self:flex-start}figure.wp-block-gallery.has-nested-images{align-items:normal}.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)/2);margin:0}.wp-block-gallery.has-nested-images figure.wp-block-image{display:flex;flex-grow:1;justify-content:center;position:relative;flex-direction:column;max-width:100%}.wp-block-gallery.has-nested-images figure.wp-block-image>a,.wp-block-gallery.has-nested-images figure.wp-block-image>div{margin:0;flex-direction:column;flex-grow:1}.wp-block-gallery.has-nested-images figure.wp-block-image img{display:block;height:auto;max-width:100%!important;width:auto}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{background:linear-gradient(0deg,rgba(0,0,0,.7),rgba(0,0,0,.3) 70%,transparent);bottom:0;color:#fff;font-size:13px;left:0;margin-bottom:0;max-height:60%;overflow:auto;padding:0 8px 8px;position:absolute;text-align:center;width:100%;box-sizing:border-box}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{display:inline}.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a{color:inherit}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>a,.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded>div{flex:1 1 auto}.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption{flex:initial;background:none;color:inherit;margin:0;padding:10px 10px 9px;position:relative}.wp-block-gallery.has-nested-images figcaption{flex-grow:1;flex-basis:100%;text-align:center}.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image){margin-top:0;margin-bottom:auto}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image){align-self:inherit}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image)>div:not(.components-drop-zone){display:flex}.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a,.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img{width:100%;flex:1 0 0%;height:100%;-o-object-fit:cover;object-fit:cover}.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image){width:100%}@media (min-width:600px){.wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image){width:calc(33.33333% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image){width:calc(25% - var(--wp--style--unstable-gallery-gap, 16px)*0.75)}.wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image){width:calc(20% - var(--wp--style--unstable-gallery-gap, 16px)*0.8)}.wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image){width:calc(16.66667% - var(--wp--style--unstable-gallery-gap, 16px)*0.83333)}.wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image){width:calc(14.28571% - var(--wp--style--unstable-gallery-gap, 16px)*0.85714)}.wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image){width:calc(12.5% - var(--wp--style--unstable-gallery-gap, 16px)*0.875)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image){width:calc(33.33% - var(--wp--style--unstable-gallery-gap, 16px)*0.66667)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2)~figure.wp-block-image:not(#individual-image){width:calc(50% - var(--wp--style--unstable-gallery-gap, 16px)*0.5)}.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:last-child{width:100%}}.wp-block-gallery.has-nested-images.alignleft,.wp-block-gallery.has-nested-images.alignright{max-width:420px;width:100%}.wp-block-gallery.has-nested-images.aligncenter{justify-content:center}.wp-block-group{box-sizing:border-box}h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}.wp-block-image{margin:0 0 1em}.wp-block-image img{height:auto;max-width:100%;vertical-align:bottom}.wp-block-image:not(.is-style-rounded)>a,.wp-block-image:not(.is-style-rounded) img{border-radius:inherit}.wp-block-image.aligncenter{text-align:center}.wp-block-image.alignfull img,.wp-block-image.alignwide img{height:auto;width:100%}.wp-block-image.aligncenter,.wp-block-image .aligncenter,.wp-block-image.alignleft,.wp-block-image .alignleft,.wp-block-image.alignright,.wp-block-image .alignright{display:table}.wp-block-image.aligncenter>figcaption,.wp-block-image .aligncenter>figcaption,.wp-block-image.alignleft>figcaption,.wp-block-image .alignleft>figcaption,.wp-block-image.alignright>figcaption,.wp-block-image .alignright>figcaption{display:table-caption;caption-side:bottom}.wp-block-image .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-image .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-image .aligncenter{margin-left:auto;margin-right:auto}.wp-block-image figcaption{margin-top:.5em;margin-bottom:1em}.wp-block-image.is-style-circle-mask img,.wp-block-image.is-style-rounded img,.wp-block-image .is-style-rounded img{border-radius:9999px}@supports ((-webkit-mask-image:none) or (mask-image:none)) or (-webkit-mask-image:none){.wp-block-image.is-style-circle-mask img{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');mask-mode:alpha;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;border-radius:0}}.wp-block-image figure{margin:0}ol.wp-block-latest-comments{margin-left:0}.wp-block-latest-comments .wp-block-latest-comments{padding-left:0}.wp-block-latest-comments__comment{line-height:1.1;list-style:none;margin-bottom:1em}.has-avatars .wp-block-latest-comments__comment{min-height:2.25em;list-style:none}.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt,.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta{margin-left:3.25em}.has-dates .wp-block-latest-comments__comment,.has-excerpts .wp-block-latest-comments__comment{line-height:1.5}.wp-block-latest-comments__comment-excerpt p{font-size:.875em;line-height:1.8;margin:.36em 0 1.4em}.wp-block-latest-comments__comment-date{display:block;font-size:.75em}.wp-block-latest-comments .avatar,.wp-block-latest-comments__comment-avatar{border-radius:1.5em;display:block;float:left;height:2.5em;margin-right:.75em;width:2.5em}.wp-block-latest-posts.alignleft{margin-right:2em}.wp-block-latest-posts.alignright{margin-left:2em}.wp-block-latest-posts.wp-block-latest-posts__list{list-style:none;padding-left:0}.wp-block-latest-posts.wp-block-latest-posts__list li{clear:both}.wp-block-latest-posts.is-grid{display:flex;flex-wrap:wrap;padding:0}.wp-block-latest-posts.is-grid li{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.wp-block-latest-posts.columns-2 li{width:calc(50% - .625em)}.wp-block-latest-posts.columns-2 li:nth-child(2n){margin-right:0}.wp-block-latest-posts.columns-3 li{width:calc(33.33333% - .83333em)}.wp-block-latest-posts.columns-3 li:nth-child(3n){margin-right:0}.wp-block-latest-posts.columns-4 li{width:calc(25% - .9375em)}.wp-block-latest-posts.columns-4 li:nth-child(4n){margin-right:0}.wp-block-latest-posts.columns-5 li{width:calc(20% - 1em)}.wp-block-latest-posts.columns-5 li:nth-child(5n){margin-right:0}.wp-block-latest-posts.columns-6 li{width:calc(16.66667% - 1.04167em)}.wp-block-latest-posts.columns-6 li:nth-child(6n){margin-right:0}}.wp-block-latest-posts__post-author,.wp-block-latest-posts__post-date{display:block;font-size:.8125em}.wp-block-latest-posts__post-excerpt{margin-top:.5em;margin-bottom:1em}.wp-block-latest-posts__featured-image a{display:inline-block}.wp-block-latest-posts__featured-image img{height:auto;width:auto;max-width:100%}.wp-block-latest-posts__featured-image.alignleft{margin-right:1em;float:left}.wp-block-latest-posts__featured-image.alignright{margin-left:1em;float:right}.wp-block-latest-posts__featured-image.aligncenter{margin-bottom:1em;text-align:center}ol,ul{box-sizing:border-box}ol.has-background,ul.has-background{padding:1.25em 2.375em}.wp-block-media-text{ - /*!rtl:begin:ignore*/direction:ltr; - /*!rtl:end:ignore*/display:grid;grid-template-columns:50% 1fr;grid-template-rows:auto}.wp-block-media-text.has-media-on-the-right{grid-template-columns:1fr 50%}.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media{align-self:start}.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media,.wp-block-media-text .wp-block-media-text__content,.wp-block-media-text .wp-block-media-text__media{align-self:center}.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content,.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media{align-self:end}.wp-block-media-text .wp-block-media-text__media{ - /*!rtl:begin:ignore*/grid-column:1;grid-row:1; - /*!rtl:end:ignore*/margin:0}.wp-block-media-text .wp-block-media-text__content{direction:ltr; - /*!rtl:begin:ignore*/grid-column:2;grid-row:1; - /*!rtl:end:ignore*/padding:0 8%;word-break:break-word}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media{ - /*!rtl:begin:ignore*/grid-column:2;grid-row:1 - /*!rtl:end:ignore*/}.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content{ - /*!rtl:begin:ignore*/grid-column:1;grid-row:1 - /*!rtl:end:ignore*/}.wp-block-media-text__media img,.wp-block-media-text__media video{height:auto;max-width:unset;width:100%;vertical-align:middle}.wp-block-media-text.is-image-fill .wp-block-media-text__media{height:100%;min-height:250px;background-size:cover}.wp-block-media-text.is-image-fill .wp-block-media-text__media>a{display:block;height:100%}.wp-block-media-text.is-image-fill .wp-block-media-text__media img{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}@media (max-width:600px){.wp-block-media-text.is-stacked-on-mobile{grid-template-columns:100%!important}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media{grid-column:1;grid-row:1}.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content{grid-column:1;grid-row:2}}.wp-block-navigation{position:relative;--navigation-layout-justification-setting:flex-start;--navigation-layout-direction:row;--navigation-layout-wrap:wrap;--navigation-layout-justify:flex-start;--navigation-layout-align:center}.wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-left:0;padding-left:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{display:flex;align-items:center;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{color:inherit;display:block;padding:0}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;line-height:0;display:inline-block;font-size:inherit;padding:0;background-color:inherit;color:currentColor;border:none;width:.6em;height:.6em;margin-left:.25em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{display:inline-block;stroke:currentColor;width:inherit;height:inherit;margin-top:.075em}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container){background-color:inherit;color:inherit;position:absolute;z-index:2;display:flex;flex-direction:column;align-items:normal;opacity:0;transition:opacity .1s linear;visibility:hidden;width:0;height:0;overflow:hidden;left:-1px;top:100%}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container)>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{margin-right:0;margin-left:auto}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container:before{content:"";position:absolute;right:100%;height:100%;display:block;width:.5em;background:transparent}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon{margin-right:.25em}.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg{transform:rotate(-90deg)}}.wp-block-navigation .has-child:where(:not(.open-on-click)):hover>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within>.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{visibility:visible;overflow:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{left:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:0}}.wp-block-navigation-submenu{position:relative;display:flex}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-size:inherit;font-family:inherit;line-height:inherit;font-style:inherit;font-weight:inherit;text-transform:inherit;text-align:left}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-right:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-left:-.6em;pointer-events:none}.wp-block-navigation,.wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background),.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list,.wp-block-navigation:where(.has-background) .wp-block-navigation__container,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content,.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content{padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{left:auto;right:0}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:-1px;right:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:auto;right:100%}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;color:#000;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation__container{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);list-style:none;margin:0;padding-left:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}.wp-block-navigation__responsive-container{display:none;position:fixed;top:0;left:0;right:0;bottom:0}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{display:flex;flex-wrap:var(--navigation-layout-wrap,wrap);flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){color:inherit!important;background-color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{display:flex;flex-direction:column;background-color:inherit;padding:2rem;overflow:auto;z-index:100000}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{padding-top:calc(2rem + 24px);overflow:visible;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:var(--navigation-layout-justification-setting,inherit)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{opacity:1;visibility:visible;height:auto;width:auto;overflow:initial;min-width:200px;position:static;border:none;padding-left:2rem;padding-right:2rem}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{display:flex;flex-direction:column;align-items:var(--navigation-layout-justification-setting,initial)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{color:inherit!important;background:transparent!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{right:auto;left:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){display:block;width:100%;position:relative;z-index:auto;background-color:inherit}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff;color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{vertical-align:middle;cursor:pointer;color:currentColor;background:transparent;border:none;margin:0;padding:0}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;pointer-events:none;display:block;width:24px;height:24px}.wp-block-navigation__responsive-container-open{display:flex}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{position:absolute;top:0;right:0;z-index:2}.wp-block-navigation__responsive-close{width:100%}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}html.has-modal-open{overflow:hidden}.wp-block-navigation .wp-block-navigation-item__label{word-break:normal;overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}.wp-block-navigation .wp-block-page-list{display:flex;flex-direction:var(--navigation-layout-direction,initial);justify-content:var(--navigation-layout-justify,initial);align-items:var(--navigation-layout-align,initial);flex-wrap:var(--navigation-layout-wrap,wrap);background-color:inherit}.wp-block-navigation .wp-block-navigation-item{background-color:inherit}.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:left;font-size:8.4em;line-height:.68;font-weight:100;margin:.05em .1em 0 0;text-transform:uppercase;font-style:normal}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}.wp-block-post-author{display:flex;flex-wrap:wrap}.wp-block-post-author__byline{width:100%;margin-top:0;margin-bottom:0;font-size:.5em}.wp-block-post-author__avatar{margin-right:1em}.wp-block-post-author__bio{margin-bottom:.7em;font-size:.7em}.wp-block-post-author__content{flex-grow:1;flex-basis:0}.wp-block-post-author__name{margin:0}.wp-block-post-comments .alignleft{float:left}.wp-block-post-comments .alignright{float:right}.wp-block-post-comments .navigation:after{content:"";display:table;clear:both}.wp-block-post-comments .commentlist{clear:both;list-style:none;margin:0;padding:0}.wp-block-post-comments .commentlist .comment{min-height:2.25em;padding-left:3.25em}.wp-block-post-comments .commentlist .comment p{font-size:1em;line-height:1.8;margin:1em 0}.wp-block-post-comments .commentlist .children{list-style:none;margin:0;padding:0}.wp-block-post-comments .comment-author{line-height:1.5}.wp-block-post-comments .comment-author .avatar{border-radius:1.5em;display:block;float:left;height:2.5em;margin-top:.5em;margin-right:.75em;width:2.5em}.wp-block-post-comments .comment-author cite{font-style:normal}.wp-block-post-comments .comment-meta{font-size:.875em;line-height:1.5}.wp-block-post-comments .comment-meta b{font-weight:400}.wp-block-post-comments .comment-meta .comment-awaiting-moderation{margin-top:1em;margin-bottom:1em;display:block}.wp-block-post-comments .comment-body .commentmetadata{font-size:.875em}.wp-block-post-comments .comment-form-author label,.wp-block-post-comments .comment-form-comment label,.wp-block-post-comments .comment-form-email label,.wp-block-post-comments .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments .comment-reply-title{margin-bottom:0}.wp-block-post-comments .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-left:.5em}.wp-block-post-comments .reply{font-size:.875em;margin-bottom:1.4em}.wp-block-post-comments input:not([type=submit]),.wp-block-post-comments textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments textarea{padding:calc(.667em + 2px)}.wp-block-post-comments input[type=submit]{border:none}.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title){font-weight:inherit}.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title){font-family:inherit}.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title),.wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title){font-size:inherit}.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title){line-height:inherit}.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title){font-style:inherit}.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title){letter-spacing:inherit}.wp-block-post-comments-form input[type=submit]{border:none;box-shadow:none;cursor:pointer;display:inline-block;text-align:center;overflow-wrap:break-word}.wp-block-post-comments-form input:not([type=submit]),.wp-block-post-comments-form textarea{border:1px solid #949494;font-size:1em;font-family:inherit}.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form textarea{padding:calc(.667em + 2px)}.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]),.wp-block-post-comments-form .comment-form textarea{display:block;box-sizing:border-box;width:100%}.wp-block-post-comments-form .comment-form-author label,.wp-block-post-comments-form .comment-form-email label,.wp-block-post-comments-form .comment-form-url label{display:block;margin-bottom:.25em}.wp-block-post-comments-form .comment-form-cookies-consent{display:flex;gap:.25em}.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent{margin-top:.35em}.wp-block-post-comments-form .comment-reply-title{margin-bottom:0}.wp-block-post-comments-form .comment-reply-title :where(small){font-size:var(--wp--preset--font-size--medium,smaller);margin-left:.5em}.wp-block-post-excerpt__more-link{display:inline-block}.wp-block-post-featured-image{margin-left:0;margin-right:0}.wp-block-post-featured-image a{display:block}.wp-block-post-featured-image img{max-width:100%;width:100%;height:auto;vertical-align:bottom}.wp-block-post-featured-image.alignfull img,.wp-block-post-featured-image.alignwide img{width:100%}.wp-block-post-terms__separator{white-space:pre-wrap}.wp-block-post-title{word-break:break-word}.wp-block-post-title a{display:inline-block}.wp-block-preformatted{white-space:pre-wrap}.wp-block-preformatted.has-background{padding:1.25em 2.375em}.wp-block-pullquote{margin:0 0 1em;padding:3em 0;text-align:center;overflow-wrap:break-word;box-sizing:border-box}.wp-block-pullquote blockquote,.wp-block-pullquote cite,.wp-block-pullquote p{color:inherit}.wp-block-pullquote.alignleft,.wp-block-pullquote.alignright,.wp-block-pullquote.has-text-align-left,.wp-block-pullquote.has-text-align-right{max-width:420px}.wp-block-pullquote.alignleft p,.wp-block-pullquote.alignright p,.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p{font-size:1.25em}.wp-block-pullquote p{font-size:1.75em;line-height:1.6}.wp-block-pullquote cite,.wp-block-pullquote footer{position:relative}.wp-block-pullquote .has-text-color a{color:inherit}.wp-block-pullquote.has-text-align-left blockquote{text-align:left}.wp-block-pullquote.has-text-align-right blockquote{text-align:right}.wp-block-pullquote.is-style-solid-color{border:none}.wp-block-pullquote.is-style-solid-color blockquote{margin-left:auto;margin-right:auto;max-width:60%}.wp-block-pullquote.is-style-solid-color blockquote p{margin-top:0;margin-bottom:0;font-size:2em}.wp-block-pullquote.is-style-solid-color blockquote cite{text-transform:none;font-style:normal}.wp-block-pullquote cite{color:inherit}.wp-block-post-template,.wp-block-query-loop{margin-top:0;margin-bottom:0;max-width:100%;list-style:none;padding:0}.wp-block-post-template.wp-block-post-template,.wp-block-query-loop.wp-block-post-template{background:none}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap;gap:1.25em}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow{margin-right:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-query-pagination .wp-block-query-pagination-next-arrow{margin-left:1ch;display:inline-block}.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron){transform:scaleX(1)}.wp-block-query-pagination.aligncenter{justify-content:center}.wp-block-quote{box-sizing:border-box;overflow-wrap:break-word}.wp-block-quote.is-large:not(.is-style-plain),.wp-block-quote.is-style-large:not(.is-style-plain){margin-bottom:1em;padding:0 1em}.wp-block-quote.is-large:not(.is-style-plain) p,.wp-block-quote.is-style-large:not(.is-style-plain) p{font-size:1.5em;font-style:italic;line-height:1.6}.wp-block-quote.is-large:not(.is-style-plain) cite,.wp-block-quote.is-large:not(.is-style-plain) footer,.wp-block-quote.is-style-large:not(.is-style-plain) cite,.wp-block-quote.is-style-large:not(.is-style-plain) footer{font-size:1.125em;text-align:right}.wp-block-read-more{display:block;width:-moz-fit-content;width:fit-content}.wp-block-read-more:not([style*=text-decoration]),.wp-block-read-more:not([style*=text-decoration]):active,.wp-block-read-more:not([style*=text-decoration]):focus{text-decoration:none}ul.wp-block-rss{list-style:none;padding:0}ul.wp-block-rss.wp-block-rss{box-sizing:border-box}ul.wp-block-rss.alignleft{margin-right:2em}ul.wp-block-rss.alignright{margin-left:2em}ul.wp-block-rss.is-grid{display:flex;flex-wrap:wrap;padding:0;list-style:none}ul.wp-block-rss.is-grid li{margin:0 1em 1em 0;width:100%}@media (min-width:600px){ul.wp-block-rss.columns-2 li{width:calc(50% - 1em)}ul.wp-block-rss.columns-3 li{width:calc(33.33333% - 1em)}ul.wp-block-rss.columns-4 li{width:calc(25% - 1em)}ul.wp-block-rss.columns-5 li{width:calc(20% - 1em)}ul.wp-block-rss.columns-6 li{width:calc(16.66667% - 1em)}}.wp-block-rss__item-author,.wp-block-rss__item-publish-date{display:block;font-size:.8125em}.wp-block-search__button{background:#f7f7f7;border:1px solid #ccc;padding:.375em .625em;color:#32373c;margin-left:.625em;word-break:normal;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{min-width:1.5em;min-height:1.5em;fill:currentColor}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{padding:8px;flex-grow:1;min-width:3em;border:1px solid #949494;font-size:inherit;font-family:inherit;line-height:inherit}.wp-block-search.wp-block-search__button-only .wp-block-search__button{margin-left:0}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper{padding:4px;border:1px solid #949494}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input{border-radius:0;border:none;padding:0 0 0 .25em}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus{outline:none}.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button{padding:.125em .5em}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block-separator{border-top:1px solid;border-bottom:1px solid}.wp-block-separator.is-style-dots{background:none!important;border:none;text-align:center;line-height:1;height:auto}.wp-block-separator.is-style-dots:before{content:"···";color:currentColor;font-size:1.5em;letter-spacing:2em;padding-left:2em;font-family:serif}.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo.is-style-rounded{border-radius:9999px}.wp-block-social-links{padding-left:0;padding-right:0;text-indent:0;margin-left:0;background:none}.wp-block-social-links .wp-social-link a,.wp-block-social-links .wp-social-link a:hover{text-decoration:none;border-bottom:0;box-shadow:none}.wp-block-social-links .wp-social-link a{padding:.25em}.wp-block-social-links .wp-social-link svg{width:1em;height:1em}.wp-block-social-links .wp-social-link span:not(.screen-reader-text){margin-left:.5em;margin-right:.5em;font-size:.65em}.wp-block-social-links.has-small-icon-size{font-size:16px}.wp-block-social-links,.wp-block-social-links.has-normal-icon-size{font-size:24px}.wp-block-social-links.has-large-icon-size{font-size:36px}.wp-block-social-links.has-huge-icon-size{font-size:48px}.wp-block-social-links.aligncenter{justify-content:center;display:flex}.wp-block-social-links.alignright{justify-content:flex-end}.wp-block-social-link{display:block;border-radius:9999px;transition:transform .1s ease;height:auto}@media (prefers-reduced-motion:reduce){.wp-block-social-link{transition-duration:0s;transition-delay:0s}}.wp-block-social-link a{align-items:center;display:flex;line-height:0;transition:transform .1s ease}.wp-block-social-link:hover{transform:scale(1.1)}.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg{color:currentColor;fill:currentColor}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link{background-color:#f0f0f0;color:#444}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon{background-color:#f90;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp{background-color:#1ea0c3;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance{background-color:#0757fe;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen{background-color:#1e1f26;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart{background-color:#02e49b;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble{background-color:#e94c89;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox{background-color:#4280ff;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy{background-color:#f45800;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook{background-color:#1778f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr{background-color:#0461dd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare{background-color:#e65678;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github{background-color:#24292d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads{background-color:#eceadd;color:#382110}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google{background-color:#ea4434;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram{background-color:#f00075;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm{background-color:#e21b24;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin{background-color:#0d66c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon{background-color:#3288d4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium{background-color:#02ab6c;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup{background-color:#f6405f;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon{background-color:#ff424d;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest{background-color:#e60122;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket{background-color:#ef4155;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit{background-color:#fe4500;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype{background-color:#0478d7;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat{background-color:#fefc00;color:#fff;stroke:#000}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud{background-color:#ff5600;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify{background-color:#1bd760;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram{background-color:#2aabee;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok{background-color:#000;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr{background-color:#011835;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch{background-color:#6440a4;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter{background-color:#1da1f2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo{background-color:#1eb7ea;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk{background-color:#4680c2;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress{background-color:#3499cd;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp{background-color:#d32422;color:#fff}.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube{background-color:red;color:#fff}.wp-block-social-links.is-style-logos-only .wp-social-link{background:none}.wp-block-social-links.is-style-logos-only .wp-social-link a{padding:0}.wp-block-social-links.is-style-logos-only .wp-social-link svg{width:1.25em;height:1.25em}.wp-block-social-links.is-style-logos-only .wp-social-link-amazon{color:#f90}.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp{color:#1ea0c3}.wp-block-social-links.is-style-logos-only .wp-social-link-behance{color:#0757fe}.wp-block-social-links.is-style-logos-only .wp-social-link-codepen{color:#1e1f26}.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart{color:#02e49b}.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble{color:#e94c89}.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox{color:#4280ff}.wp-block-social-links.is-style-logos-only .wp-social-link-etsy{color:#f45800}.wp-block-social-links.is-style-logos-only .wp-social-link-facebook{color:#1778f2}.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-flickr{color:#0461dd}.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare{color:#e65678}.wp-block-social-links.is-style-logos-only .wp-social-link-github{color:#24292d}.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads{color:#382110}.wp-block-social-links.is-style-logos-only .wp-social-link-google{color:#ea4434}.wp-block-social-links.is-style-logos-only .wp-social-link-instagram{color:#f00075}.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm{color:#e21b24}.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin{color:#0d66c2}.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon{color:#3288d4}.wp-block-social-links.is-style-logos-only .wp-social-link-medium{color:#02ab6c}.wp-block-social-links.is-style-logos-only .wp-social-link-meetup{color:#f6405f}.wp-block-social-links.is-style-logos-only .wp-social-link-patreon{color:#ff424d}.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest{color:#e60122}.wp-block-social-links.is-style-logos-only .wp-social-link-pocket{color:#ef4155}.wp-block-social-links.is-style-logos-only .wp-social-link-reddit{color:#fe4500}.wp-block-social-links.is-style-logos-only .wp-social-link-skype{color:#0478d7}.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat{color:#fff;stroke:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud{color:#ff5600}.wp-block-social-links.is-style-logos-only .wp-social-link-spotify{color:#1bd760}.wp-block-social-links.is-style-logos-only .wp-social-link-telegram{color:#2aabee}.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok{color:#000}.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr{color:#011835}.wp-block-social-links.is-style-logos-only .wp-social-link-twitch{color:#6440a4}.wp-block-social-links.is-style-logos-only .wp-social-link-twitter{color:#1da1f2}.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo{color:#1eb7ea}.wp-block-social-links.is-style-logos-only .wp-social-link-vk{color:#4680c2}.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress{color:#3499cd}.wp-block-social-links.is-style-logos-only .wp-social-link-yelp{color:#d32422}.wp-block-social-links.is-style-logos-only .wp-social-link-youtube{color:red}.wp-block-social-links.is-style-pill-shape .wp-social-link{width:auto}.wp-block-social-links.is-style-pill-shape .wp-social-link a{padding-left:.66667em;padding-right:.66667em}.wp-block-spacer{clear:both}.wp-block-tag-cloud.aligncenter{text-align:center}.wp-block-tag-cloud.alignfull{padding-left:1em;padding-right:1em}.wp-block-tag-cloud a{display:inline-block;margin-right:5px}.wp-block-tag-cloud span{display:inline-block;margin-left:5px;text-decoration:none}.wp-block-tag-cloud.is-style-outline{display:flex;flex-wrap:wrap;gap:1ch}.wp-block-tag-cloud.is-style-outline a{border:1px solid;font-size:unset!important;margin-right:0;padding:1ch 2ch;text-decoration:none!important}.wp-block-table{margin:0 0 1em;overflow-x:auto}.wp-block-table table{border-collapse:collapse;width:100%}.wp-block-table .has-fixed-layout{table-layout:fixed;width:100%}.wp-block-table .has-fixed-layout td,.wp-block-table .has-fixed-layout th{word-break:break-word}.wp-block-table.aligncenter,.wp-block-table.alignleft,.wp-block-table.alignright{display:table;width:auto}.wp-block-table.aligncenter td,.wp-block-table.aligncenter th,.wp-block-table.alignleft td,.wp-block-table.alignleft th,.wp-block-table.alignright td,.wp-block-table.alignright th{word-break:break-word}.wp-block-table .has-subtle-light-gray-background-color{background-color:#f3f4f5}.wp-block-table .has-subtle-pale-green-background-color{background-color:#e9fbe5}.wp-block-table .has-subtle-pale-blue-background-color{background-color:#e7f5fe}.wp-block-table .has-subtle-pale-pink-background-color{background-color:#fcf0ef}.wp-block-table.is-style-stripes{border-spacing:0;border-collapse:inherit;background-color:transparent;border-bottom:1px solid #f0f0f0}.wp-block-table.is-style-stripes tbody tr:nth-child(odd){background-color:#f0f0f0}.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd){background-color:#f3f4f5}.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd){background-color:#e9fbe5}.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd){background-color:#e7f5fe}.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd){background-color:#fcf0ef}.wp-block-table.is-style-stripes td,.wp-block-table.is-style-stripes th{border-color:transparent}.wp-block-table .has-border-color>*,.wp-block-table .has-border-color td,.wp-block-table .has-border-color th,.wp-block-table .has-border-color tr{border-color:inherit}.wp-block-table table[style*=border-style]>*,.wp-block-table table[style*=border-style] td,.wp-block-table table[style*=border-style] th,.wp-block-table table[style*=border-style] tr{border-style:inherit}.wp-block-table table[style*=border-width]>*,.wp-block-table table[style*=border-width] td,.wp-block-table table[style*=border-width] th,.wp-block-table table[style*=border-width] tr{border-width:inherit;border-style:inherit}.wp-block-text-columns,.wp-block-text-columns.aligncenter{display:flex}.wp-block-text-columns .wp-block-column{margin:0 1em;padding:0}.wp-block-text-columns .wp-block-column:first-child{margin-left:0}.wp-block-text-columns .wp-block-column:last-child{margin-right:0}.wp-block-text-columns.columns-2 .wp-block-column{width:50%}.wp-block-text-columns.columns-3 .wp-block-column{width:33.33333%}.wp-block-text-columns.columns-4 .wp-block-column{width:25%}pre.wp-block-verse{font-family:inherit;overflow:auto;white-space:pre-wrap}.wp-block-video{margin:0 0 1em}.wp-block-video video{width:100%}@supports (position:sticky){.wp-block-video [poster]{-o-object-fit:cover;object-fit:cover}}.wp-block-video.aligncenter{text-align:center}.wp-block-video figcaption{margin-top:.5em;margin-bottom:1em}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color),html :where([style*=border-width]){border-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-audio figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-audio figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-code { - border: 1px solid #ccc; - border-radius: 4px; - font-family: Menlo, Consolas, monaco, monospace; - padding: 0.8em 1em; -} - -.wp-block-embed figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-embed figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-gallery-caption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .blocks-gallery-caption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-image figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-image figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-pullquote { - border-top: 4px solid currentColor; - border-bottom: 4px solid currentColor; - margin-bottom: 1.75em; - color: currentColor; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer, .wp-block-pullquote__citation { - color: currentColor; - text-transform: uppercase; - font-size: 0.8125em; - font-style: normal; -} - -.wp-block-quote { - border-right: 0.25em solid currentColor; - margin: 0 0 1.75em 0; - padding-right: 1em; -} -.wp-block-quote cite, -.wp-block-quote footer { - color: currentColor; - font-size: 0.8125em; - position: relative; - font-style: normal; -} -.wp-block-quote.has-text-align-right { - border-right: none; - border-left: 0.25em solid currentColor; - padding-right: 0; - padding-left: 1em; -} -.wp-block-quote.has-text-align-center { - border: none; - padding-right: 0; -} -.wp-block-quote.is-style-plain, .wp-block-quote.is-style-large, .wp-block-quote.is-large { - border: none; -} - -.wp-block-search .wp-block-search__label { - font-weight: bold; -} - -:where(.wp-block-group.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-separator.has-css-opacity { - opacity: 0.4; -} - -.wp-block-separator { - border: none; - border-bottom: 2px solid currentColor; - margin-right: auto; - margin-left: auto; -} -.wp-block-separator.has-alpha-channel-opacity { - opacity: initial; -} -.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { - width: 100px; -} -.wp-block-separator.has-background:not(.is-style-dots) { - border-bottom: none; - height: 1px; -} -.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots) { - height: 2px; -} - -.wp-block-table thead { - border-bottom: 3px solid; -} -.wp-block-table tfoot { - border-top: 3px solid; -} -.wp-block-table td, -.wp-block-table th { - padding: 0.5em; - border: 1px solid; - word-break: normal; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-video figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-video figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.wp-block-template-part.has-background { - padding: 1.25em 2.375em; - margin-top: 0; - margin-bottom: 0; -}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-archives-dropdown label { - display: block; -} - -.wp-block-avatar.aligncenter { - text-align: center; -} - -.wp-block-audio { - margin: 0 0 1em 0; -} -.wp-block-audio figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-audio audio { - width: 100%; - min-width: 300px; -} - -.wp-block-button__link { - color: #fff; - background-color: #32373c; - border-radius: 9999px; - box-shadow: none; - cursor: pointer; - display: inline-block; - font-size: 1.125em; - padding: calc(0.667em + 2px) calc(1.333em + 2px); - text-align: center; - text-decoration: none; - word-break: break-word; - box-sizing: border-box; -} -.wp-block-button__link:hover, .wp-block-button__link:focus, .wp-block-button__link:active, .wp-block-button__link:visited { - color: #fff; -} -.wp-block-button__link.aligncenter { - text-align: center; -} -.wp-block-button__link.alignright { - text-align: right; -} - -.wp-block-buttons > .wp-block-button.has-custom-width { - max-width: none; -} -.wp-block-buttons > .wp-block-button.has-custom-width .wp-block-button__link { - width: 100%; -} -.wp-block-buttons > .wp-block-button.has-custom-font-size .wp-block-button__link { - font-size: inherit; -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-25 { - width: calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-50 { - width: calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-75 { - width: calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-100 { - width: 100%; - flex-basis: 100%; -} - -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-25 { - width: 25%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-50 { - width: 50%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-75 { - width: 75%; -} - -.wp-block-button.is-style-squared, -.wp-block-button__link.wp-block-button.is-style-squared { - border-radius: 0; -} - -.wp-block-button.no-border-radius, -.wp-block-button__link.no-border-radius { - border-radius: 0 !important; -} - -.is-style-outline > :where(.wp-block-button__link), -:where(.wp-block-button__link).is-style-outline { - border: 2px solid currentColor; - padding: 0.667em 1.333em; -} - -.is-style-outline > .wp-block-button__link:not(.has-text-color), -.wp-block-button__link.is-style-outline:not(.has-text-color) { - color: currentColor; -} - -.is-style-outline > .wp-block-button__link:not(.has-background), -.wp-block-button__link.is-style-outline:not(.has-background) { - background-color: transparent; -} - -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons.is-vertical { - flex-direction: column; -} -.wp-block-buttons.is-vertical > .wp-block-button:last-child { - margin-bottom: 0; -} -.wp-block-buttons > .wp-block-button { - display: inline-block; - margin: 0; -} -.wp-block-buttons.is-content-justification-left { - justify-content: flex-start; -} -.wp-block-buttons.is-content-justification-left.is-vertical { - align-items: flex-start; -} -.wp-block-buttons.is-content-justification-center { - justify-content: center; -} -.wp-block-buttons.is-content-justification-center.is-vertical { - align-items: center; -} -.wp-block-buttons.is-content-justification-right { - justify-content: flex-end; -} -.wp-block-buttons.is-content-justification-right.is-vertical { - align-items: flex-end; -} -.wp-block-buttons.is-content-justification-space-between { - justify-content: space-between; -} -.wp-block-buttons.aligncenter { - text-align: center; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block-button.aligncenter { - /* stylelint-enable indentation */ - margin-right: auto; - margin-left: auto; - width: 100%; -} - -.wp-block-button.aligncenter { - text-align: center; -} - -.wp-block-calendar { - text-align: center; -} -.wp-block-calendar th, -.wp-block-calendar tbody td { - padding: 0.25em; - border: 1px solid #ddd; -} -.wp-block-calendar tfoot td { - border: none; -} -.wp-block-calendar table { - width: 100%; - border-collapse: collapse; -} -.wp-block-calendar table th { - font-weight: 400; - background: #ddd; -} -.wp-block-calendar a { - text-decoration: underline; -} -.wp-block-calendar table tbody, -.wp-block-calendar table caption { - color: #40464d; -} - -.wp-block-categories.alignleft { - margin-right: 2em; -} -.wp-block-categories.alignright { - margin-left: 2em; -} - -.wp-block-code code { - display: block; - font-family: inherit; - overflow-wrap: break-word; - white-space: pre-wrap; -} - -.wp-block-columns { - display: flex; - margin-bottom: 1.75em; - box-sizing: border-box; - flex-wrap: wrap !important; - align-items: initial !important; - /** - * All Columns Alignment - */ -} -@media (min-width: 782px) { - .wp-block-columns { - flex-wrap: nowrap !important; - } -} -.wp-block-columns.are-vertically-aligned-top { - align-items: flex-start; -} -.wp-block-columns.are-vertically-aligned-center { - align-items: center; -} -.wp-block-columns.are-vertically-aligned-bottom { - align-items: flex-end; -} -@media (max-width: 781px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 100% !important; - } -} -@media (min-width: 782px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 0; - flex-grow: 1; - } - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column[style*=flex-basis] { - flex-grow: 0; - } -} -.wp-block-columns.is-not-stacked-on-mobile { - flex-wrap: nowrap !important; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column { - flex-basis: 0; - flex-grow: 1; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column[style*=flex-basis] { - flex-grow: 0; -} - -:where(.wp-block-columns.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-column { - flex-grow: 1; - min-width: 0; - word-break: break-word; - overflow-wrap: break-word; - /** - * Individual Column Alignment - */ -} -.wp-block-column.is-vertically-aligned-top { - align-self: flex-start; -} -.wp-block-column.is-vertically-aligned-center { - align-self: center; -} -.wp-block-column.is-vertically-aligned-bottom { - align-self: flex-end; -} -.wp-block-column.is-vertically-aligned-top, .wp-block-column.is-vertically-aligned-center, .wp-block-column.is-vertically-aligned-bottom { - width: 100%; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - margin-right: 0; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-comments-pagination.aligncenter { - justify-content: center; -} - -.wp-block-comment-template { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-comment-template li { - clear: both; -} -.wp-block-comment-template ol { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding-right: 2rem; -} - -.wp-block-cover-image, -.wp-block-cover { - position: relative; - background-size: cover; - background-position: center center; - min-height: 430px; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - padding: 1em; - box-sizing: border-box; - /** - * Set a default background color for has-background-dim _unless_ it includes another - * background-color class (e.g. has-green-background-color). The presence of another - * background-color class implies that another style will provide the background color - * for the overlay. - * - * See: - * - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545 - * - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545 - */ -} -.wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: fixed; -} -@supports (-webkit-touch-callout: inherit) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -@media (prefers-reduced-motion: reduce) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -.wp-block-cover-image.is-repeated, -.wp-block-cover.is-repeated { - background-repeat: repeat; - background-size: auto; -} -.wp-block-cover-image.has-background-dim:not([class*=-background-color]), -.wp-block-cover-image .has-background-dim:not([class*=-background-color]), -.wp-block-cover.has-background-dim:not([class*=-background-color]), -.wp-block-cover .has-background-dim:not([class*=-background-color]) { - background-color: #000; -} -.wp-block-cover-image .has-background-dim.has-background-gradient, -.wp-block-cover .has-background-dim.has-background-gradient { - background-color: transparent; -} -.wp-block-cover-image.has-background-dim::before, -.wp-block-cover.has-background-dim::before { - content: ""; - background-color: inherit; -} -.wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover-image .wp-block-cover__background, -.wp-block-cover-image .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover .wp-block-cover__background, -.wp-block-cover .wp-block-cover__gradient-background { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1; - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background { - opacity: 0.1; -} -.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background { - opacity: 0.2; -} -.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background { - opacity: 0.3; -} -.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background { - opacity: 0.4; -} -.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background { - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background { - opacity: 0.6; -} -.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background { - opacity: 0.7; -} -.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background { - opacity: 0.8; -} -.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background { - opacity: 0.9; -} -.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background { - opacity: 1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0 { - opacity: 0; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10 { - opacity: 0.1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20 { - opacity: 0.2; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30 { - opacity: 0.3; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40 { - opacity: 0.4; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50 { - opacity: 0.5; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60 { - opacity: 0.6; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70 { - opacity: 0.7; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80 { - opacity: 0.8; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90 { - opacity: 0.9; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100 { - opacity: 1; -} -.wp-block-cover-image .block-library-cover__padding-visualizer, -.wp-block-cover .block-library-cover__padding-visualizer { - z-index: 2; -} -.wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-cover-image::after, -.wp-block-cover::after { - display: block; - content: ""; - font-size: 0; - min-height: inherit; -} -@supports (position: sticky) { - .wp-block-cover-image::after, -.wp-block-cover::after { - content: none; - } -} -.wp-block-cover-image.aligncenter, .wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.aligncenter, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - display: flex; -} -.wp-block-cover-image .wp-block-cover__inner-container, -.wp-block-cover .wp-block-cover__inner-container { - width: 100%; - z-index: 1; - color: #fff; -} -.wp-block-cover-image.is-light .wp-block-cover__inner-container, -.wp-block-cover.is-light .wp-block-cover__inner-container { - color: #000; -} -.wp-block-cover-image p:not(.has-text-color), -.wp-block-cover-image h1:not(.has-text-color), -.wp-block-cover-image h2:not(.has-text-color), -.wp-block-cover-image h3:not(.has-text-color), -.wp-block-cover-image h4:not(.has-text-color), -.wp-block-cover-image h5:not(.has-text-color), -.wp-block-cover-image h6:not(.has-text-color), -.wp-block-cover p:not(.has-text-color), -.wp-block-cover h1:not(.has-text-color), -.wp-block-cover h2:not(.has-text-color), -.wp-block-cover h3:not(.has-text-color), -.wp-block-cover h4:not(.has-text-color), -.wp-block-cover h5:not(.has-text-color), -.wp-block-cover h6:not(.has-text-color) { - color: inherit; -} -.wp-block-cover-image.is-position-top-left, -.wp-block-cover.is-position-top-left { - align-items: flex-start; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-top-center, -.wp-block-cover.is-position-top-center { - align-items: flex-start; - justify-content: center; -} -.wp-block-cover-image.is-position-top-right, -.wp-block-cover.is-position-top-right { - align-items: flex-start; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-center-left, -.wp-block-cover.is-position-center-left { - align-items: center; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-center-center, -.wp-block-cover.is-position-center-center { - align-items: center; - justify-content: center; -} -.wp-block-cover-image.is-position-center-right, -.wp-block-cover.is-position-center-right { - align-items: center; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-bottom-left, -.wp-block-cover.is-position-bottom-left { - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-bottom-center, -.wp-block-cover.is-position-bottom-center { - align-items: flex-end; - justify-content: center; -} -.wp-block-cover-image.is-position-bottom-right, -.wp-block-cover.is-position-bottom-right { - align-items: flex-end; - justify-content: flex-end; -} -.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container, -.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container { - margin: 0; - width: auto; -} -.wp-block-cover-image img.wp-block-cover__image-background, -.wp-block-cover-image video.wp-block-cover__video-background, -.wp-block-cover img.wp-block-cover__image-background, -.wp-block-cover video.wp-block-cover__video-background { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - max-width: none; - max-height: none; - -o-object-fit: cover; - object-fit: cover; - outline: none; - border: none; - box-shadow: none; -} - -.wp-block-cover__video-background { - z-index: 0; -} - -.wp-block-cover__image-background { - z-index: 0; -} - -section.wp-block-cover-image h2, -.wp-block-cover-image-text, -.wp-block-cover-text { - color: #fff; -} -section.wp-block-cover-image h2 a, -section.wp-block-cover-image h2 a:hover, -section.wp-block-cover-image h2 a:focus, -section.wp-block-cover-image h2 a:active, -.wp-block-cover-image-text a, -.wp-block-cover-image-text a:hover, -.wp-block-cover-image-text a:focus, -.wp-block-cover-image-text a:active, -.wp-block-cover-text a, -.wp-block-cover-text a:hover, -.wp-block-cover-text a:focus, -.wp-block-cover-text a:active { - color: #fff; -} - -.wp-block-cover-image .wp-block-cover.has-left-content { - justify-content: flex-start; -} -.wp-block-cover-image .wp-block-cover.has-right-content { - justify-content: flex-end; -} - -section.wp-block-cover-image.has-left-content > h2, -.wp-block-cover-image.has-left-content .wp-block-cover-image-text, -.wp-block-cover.has-left-content .wp-block-cover-text { - margin-right: 0; - text-align: right; -} - -section.wp-block-cover-image.has-right-content > h2, -.wp-block-cover-image.has-right-content .wp-block-cover-image-text, -.wp-block-cover.has-right-content .wp-block-cover-text { - margin-left: 0; - text-align: left; -} - -section.wp-block-cover-image > h2, -.wp-block-cover-image .wp-block-cover-image-text, -.wp-block-cover .wp-block-cover-text { - font-size: 2em; - line-height: 1.25; - z-index: 1; - margin-bottom: 0; - max-width: 840px; - padding: 0.44em; - text-align: center; -} - -.wp-block[data-align=left] > [data-type="core/embed"], -.wp-block[data-align=right] > [data-type="core/embed"], -.wp-block-embed.alignleft, -.wp-block-embed.alignright { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block[data-align=right] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block-embed.alignleft .wp-block-embed__wrapper, -.wp-block-embed.alignright .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-cover .wp-block-embed { - min-width: 320px; - min-height: 240px; -} - -.wp-block-embed { - margin: 0 0 1em 0; - overflow-wrap: break-word; -} -.wp-block-embed figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-embed iframe { - max-width: 100%; -} - -.wp-block-embed__wrapper { - position: relative; -} - -.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper::before { - content: ""; - display: block; - padding-top: 50%; -} -.wp-embed-responsive .wp-has-aspect-ratio iframe { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - height: 100%; - width: 100%; -} - -.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { - padding-top: 42.85%; -} -.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { - padding-top: 50%; -} -.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { - padding-top: 56.25%; -} -.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { - padding-top: 75%; -} -.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { - padding-top: 100%; -} -.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper::before { - padding-top: 177.77%; -} -.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { - padding-top: 200%; -} - -.wp-block-file { - margin-bottom: 1.5em; -} -.wp-block-file.aligncenter { - text-align: center; -} -.wp-block-file.alignright { - text-align: right; -} -.wp-block-file .wp-block-file__embed { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__button { - background: #32373c; - border-radius: 2em; - color: #fff; - font-size: 0.8em; - padding: 0.5em 1em; -} -.wp-block-file a.wp-block-file__button { - text-decoration: none; -} -.wp-block-file a.wp-block-file__button:hover, .wp-block-file a.wp-block-file__button:visited, .wp-block-file a.wp-block-file__button:focus, .wp-block-file a.wp-block-file__button:active { - box-shadow: none; - color: #fff; - opacity: 0.85; - text-decoration: none; -} -.wp-block-file * + .wp-block-file__button { - margin-right: 0.75em; -} - -.wp-block-gallery:not(.has-nested-images), -.blocks-gallery-grid:not(.has-nested-images) { - display: flex; - flex-wrap: wrap; - list-style-type: none; - padding: 0; - margin: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item { - margin: 0 0 1em 1em; - display: flex; - flex-grow: 1; - flex-direction: column; - justify-content: center; - position: relative; - width: calc(50% - 1em); -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even) { - margin-left: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure { - margin: 0; - height: 100%; - display: flex; - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img { - display: block; - max-width: 100%; - height: auto; - width: auto; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption { - position: absolute; - bottom: 0; - width: 100%; - max-height: 100%; - overflow: auto; - padding: 3em 0.77em 0.7em; - color: #fff; - text-align: center; - font-size: 0.8em; - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - box-sizing: border-box; - margin: 0; - z-index: 2; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img { - display: inline; -} -.wp-block-gallery:not(.has-nested-images) figcaption, -.blocks-gallery-grid:not(.has-nested-images) figcaption { - flex-grow: 1; -} -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img, .wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img { - width: 100%; - height: 100%; - flex: 1; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item { - width: 100%; - margin-left: 0; -} -@media (min-width: 600px) { - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item { - width: calc(33.3333333333% - 0.6666666667em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item { - width: calc(25% - 0.75em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item { - width: calc(20% - 0.8em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item { - width: calc(16.6666666667% - 0.8333333333em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item { - width: calc(14.2857142857% - 0.8571428571em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item { - width: calc(12.5% - 0.875em); - margin-left: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n) { - margin-left: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n) { - margin-left: 0; - } -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child { - margin-left: 0; -} -.wp-block-gallery:not(.has-nested-images).alignleft, .wp-block-gallery:not(.has-nested-images).alignright, -.blocks-gallery-grid:not(.has-nested-images).alignleft, -.blocks-gallery-grid:not(.has-nested-images).alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure { - justify-content: center; -} - -.wp-block-gallery:not(.is-cropped) .blocks-gallery-item { - align-self: flex-start; -} - -figure.wp-block-gallery.has-nested-images { - align-items: normal; -} - -.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) / 2)); - margin: 0; -} -.wp-block-gallery.has-nested-images figure.wp-block-image { - display: flex; - flex-grow: 1; - justify-content: center; - position: relative; - flex-direction: column; - max-width: 100%; -} -.wp-block-gallery.has-nested-images figure.wp-block-image > div, -.wp-block-gallery.has-nested-images figure.wp-block-image > a { - margin: 0; - flex-direction: column; - flex-grow: 1; -} -.wp-block-gallery.has-nested-images figure.wp-block-image img { - display: block; - height: auto; - max-width: 100% !important; - width: auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption { - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - bottom: 0; - color: #fff; - font-size: 13px; - right: 0; - margin-bottom: 0; - max-height: 60%; - overflow: auto; - padding: 0 8px 8px; - position: absolute; - text-align: center; - width: 100%; - box-sizing: border-box; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img { - display: inline; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a { - color: inherit; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > div, -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > a { - flex: 1 1 auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption { - flex: initial; - background: none; - color: inherit; - margin: 0; - padding: 10px 10px 9px; - position: relative; -} -.wp-block-gallery.has-nested-images figcaption { - flex-grow: 1; - flex-basis: 100%; - text-align: center; -} -.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image) { - margin-top: 0; - margin-bottom: auto; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) { - align-self: inherit; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > div:not(.components-drop-zone), -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > a { - display: flex; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a, -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { - width: 100%; - flex: 1 0 0%; - height: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image) { - width: 100%; -} -@media (min-width: 600px) { - .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image) { - width: calc(33.3333333333% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image) { - width: calc(25% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.75)); - } - .wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image) { - width: calc(20% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8)); - } - .wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image) { - width: calc(16.6666666667% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8333333333)); - } - .wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image) { - width: calc(14.2857142857% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8571428571)); - } - .wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image) { - width: calc(12.5% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.875)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image) { - width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2), -.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) { - width: 100%; - } -} -.wp-block-gallery.has-nested-images.alignleft, .wp-block-gallery.has-nested-images.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery.has-nested-images.aligncenter { - justify-content: center; -} - -.wp-block-group { - box-sizing: border-box; -} - -h1.has-background, -h2.has-background, -h3.has-background, -h4.has-background, -h5.has-background, -h6.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-image { - margin: 0 0 1em 0; -} -.wp-block-image img { - height: auto; - max-width: 100%; - vertical-align: bottom; -} -.wp-block-image:not(.is-style-rounded) > a, -.wp-block-image:not(.is-style-rounded) img { - border-radius: inherit; -} -.wp-block-image.aligncenter { - text-align: center; -} -.wp-block-image.alignfull img, .wp-block-image.alignwide img { - height: auto; - width: 100%; -} -.wp-block-image.alignleft, .wp-block-image.alignright, .wp-block-image.aligncenter, -.wp-block-image .alignleft, -.wp-block-image .alignright, -.wp-block-image .aligncenter { - display: table; -} -.wp-block-image.alignleft > figcaption, .wp-block-image.alignright > figcaption, .wp-block-image.aligncenter > figcaption, -.wp-block-image .alignleft > figcaption, -.wp-block-image .alignright > figcaption, -.wp-block-image .aligncenter > figcaption { - display: table-caption; - caption-side: bottom; -} -.wp-block-image .alignleft { - float: left; - margin-left: 0; - margin-left: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .alignright { - float: right; - margin-right: 0; - margin-right: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .aligncenter { - margin-right: auto; - margin-left: auto; -} -.wp-block-image figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-image.is-style-rounded img, -.wp-block-image .is-style-rounded img { - border-radius: 9999px; -} -.wp-block-image.is-style-circle-mask img { - border-radius: 9999px; -} -@supports ((-webkit-mask-image: none) or (mask-image: none)) or (-webkit-mask-image: none) { - .wp-block-image.is-style-circle-mask img { - /* stylelint-disable */ - -webkit-mask-image: url('data:image/svg+xml;utf8,'); - mask-image: url('data:image/svg+xml;utf8,'); - /* stylelint-enable */ - mask-mode: alpha; - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-size: contain; - mask-size: contain; - -webkit-mask-position: center; - mask-position: center; - border-radius: 0; - } -} - -.wp-block-image figure { - margin: 0; -} - -ol.wp-block-latest-comments { - margin-right: 0; -} - -.wp-block-latest-comments .wp-block-latest-comments { - padding-right: 0; -} - -.wp-block-latest-comments__comment { - line-height: 1.1; - list-style: none; - margin-bottom: 1em; -} -.has-avatars .wp-block-latest-comments__comment { - min-height: 2.25em; - list-style: none; -} -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta, -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt { - margin-right: 3.25em; -} -.has-dates .wp-block-latest-comments__comment, .has-excerpts .wp-block-latest-comments__comment { - line-height: 1.5; -} - -.wp-block-latest-comments__comment-excerpt p { - font-size: 0.875em; - line-height: 1.8; - margin: 0.36em 0 1.4em; -} - -.wp-block-latest-comments__comment-date { - display: block; - font-size: 0.75em; -} - -.wp-block-latest-comments .avatar, -.wp-block-latest-comments__comment-avatar { - border-radius: 1.5em; - display: block; - float: right; - height: 2.5em; - margin-left: 0.75em; - width: 2.5em; -} - -.wp-block-latest-posts.alignleft { - margin-right: 2em; -} -.wp-block-latest-posts.alignright { - margin-left: 2em; -} -.wp-block-latest-posts.wp-block-latest-posts__list { - list-style: none; - padding-right: 0; -} -.wp-block-latest-posts.wp-block-latest-posts__list li { - clear: both; -} -.wp-block-latest-posts.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; -} -.wp-block-latest-posts.is-grid li { - margin: 0 0 1.25em 1.25em; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-latest-posts.columns-2 li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-latest-posts.columns-2 li:nth-child(2n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-3 li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-latest-posts.columns-3 li:nth-child(3n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-4 li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-latest-posts.columns-4 li:nth-child(4n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-5 li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-latest-posts.columns-5 li:nth-child(5n) { - margin-left: 0; - } - .wp-block-latest-posts.columns-6 li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } - .wp-block-latest-posts.columns-6 li:nth-child(6n) { - margin-left: 0; - } -} - -.wp-block-latest-posts__post-date, -.wp-block-latest-posts__post-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-latest-posts__post-excerpt { - margin-top: 0.5em; - margin-bottom: 1em; -} - -.wp-block-latest-posts__featured-image a { - display: inline-block; -} -.wp-block-latest-posts__featured-image img { - height: auto; - width: auto; - max-width: 100%; -} -.wp-block-latest-posts__featured-image.alignleft { - margin-right: 1em; - float: left; -} -.wp-block-latest-posts__featured-image.alignright { - margin-left: 1em; - float: right; -} -.wp-block-latest-posts__featured-image.aligncenter { - margin-bottom: 1em; - text-align: center; -} - -ol, -ul { - box-sizing: border-box; -} -ol.has-background, -ul.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-media-text { - direction: ltr; - display: grid; - grid-template-columns: 50% 1fr; - grid-template-rows: auto; -} -.wp-block-media-text.has-media-on-the-right { - grid-template-columns: 1fr 50%; -} - -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media { - align-self: start; -} - -.wp-block-media-text .wp-block-media-text__content, -.wp-block-media-text .wp-block-media-text__media, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media { - align-self: center; -} - -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media { - align-self: end; -} - -.wp-block-media-text .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - margin: 0; -} - -.wp-block-media-text .wp-block-media-text__content { - direction: rtl; - grid-column: 2; - grid-row: 1; - padding: 0 8% 0 8%; - word-break: break-word; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media { - grid-column: 2; - grid-row: 1; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { - grid-column: 1; - grid-row: 1; -} - -.wp-block-media-text__media img, -.wp-block-media-text__media video { - height: auto; - max-width: unset; - width: 100%; - vertical-align: middle; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media { - height: 100%; - min-height: 250px; - background-size: cover; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media > a { - display: block; - height: 100%; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media img { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} - -/* -* Here we here not able to use a mobile first CSS approach. -* Custom widths are set using inline styles, and on mobile, -* we need 100% width, so we use important to overwrite the inline style. -* If the style were set on mobile first, on desktop styles, -* we would have no way of setting the style again to the inline style. -*/ -@media (max-width: 600px) { - .wp-block-media-text.is-stacked-on-mobile { - grid-template-columns: 100% !important; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content { - grid-column: 1; - grid-row: 2; - } -} -.wp-block-navigation { - position: relative; - --navigation-layout-justification-setting: flex-start; - --navigation-layout-direction: row; - --navigation-layout-wrap: wrap; - --navigation-layout-justify: flex-start; - --navigation-layout-align: center; -} -.wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-right: 0; - padding-right: 0; -} -.wp-block-navigation ul, -.wp-block-navigation ul li { - list-style: none; - padding: 0; -} -.wp-block-navigation .wp-block-navigation-item { - display: flex; - align-items: center; - position: relative; -} -.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty { - display: none; -} -.wp-block-navigation .wp-block-navigation-item__content { - color: inherit; - display: block; - padding: 0; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content { - text-decoration: line-through; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active { - text-decoration: line-through; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a { - text-decoration: none; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a:focus, .wp-block-navigation:where(:not([class*="has-text-decoration"])) a:active { - text-decoration: none; -} -.wp-block-navigation .wp-block-navigation__submenu-icon { - align-self: center; - line-height: 0; - display: inline-block; - font-size: inherit; - padding: 0; - background-color: inherit; - color: currentColor; - border: none; - width: 0.6em; - height: 0.6em; - margin-right: 0.25em; -} -.wp-block-navigation .wp-block-navigation__submenu-icon svg { - display: inline-block; - stroke: currentColor; - width: inherit; - height: inherit; - margin-top: 0.075em; -} -.wp-block-navigation.is-vertical { - --navigation-layout-direction: column; - --navigation-layout-justify: initial; - --navigation-layout-align: flex-start; -} -.wp-block-navigation.no-wrap { - --navigation-layout-wrap: nowrap; -} -.wp-block-navigation.items-justified-center { - --navigation-layout-justification-setting: center; - --navigation-layout-justify: center; -} -.wp-block-navigation.items-justified-center.is-vertical { - --navigation-layout-align: center; -} -.wp-block-navigation.items-justified-right { - --navigation-layout-justification-setting: flex-end; - --navigation-layout-justify: flex-end; -} -.wp-block-navigation.items-justified-right.is-vertical { - --navigation-layout-align: flex-end; -} -.wp-block-navigation.items-justified-space-between { - --navigation-layout-justification-setting: space-between; - --navigation-layout-justify: space-between; -} - -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) { - background-color: inherit; - color: inherit; - position: absolute; - z-index: 2; - display: flex; - flex-direction: column; - align-items: normal; - opacity: 0; - transition: opacity 0.1s linear; - visibility: hidden; - width: 0; - height: 0; - overflow: hidden; - right: -1px; - top: 100%; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content { - display: flex; - flex-grow: 1; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon { - margin-left: 0; - margin-right: auto; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - margin: 0; -} -@media (min-width: 782px) { - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container { - right: 100%; - top: -1px; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - left: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon { - margin-left: 0.25em; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg { - transform: rotate(90deg); - } -} -.wp-block-navigation .has-child:where(:not(.open-on-click)):hover > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true] ~ .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container { - right: 0; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: 100%; - top: 0; - } -} - -.wp-block-navigation-submenu { - position: relative; - display: flex; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg { - stroke: currentColor; -} - -button.wp-block-navigation-item__content { - background-color: transparent; - border: none; - color: currentColor; - font-size: inherit; - font-family: inherit; - line-height: inherit; - font-style: inherit; - font-weight: inherit; - text-transform: inherit; - text-align: right; -} - -.wp-block-navigation-submenu__toggle { - cursor: pointer; -} - -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle { - padding-left: 0.85em; -} -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle + .wp-block-navigation__submenu-icon { - margin-right: -0.6em; - pointer-events: none; -} - -/** - * Margins - */ -.wp-block-navigation__responsive-container, -.wp-block-navigation__responsive-close, -.wp-block-navigation__responsive-dialog, -.wp-block-navigation, -.wp-block-navigation .wp-block-page-list, -.wp-block-navigation__container, -.wp-block-navigation__responsive-container-content { - gap: inherit; -} - -.wp-block-navigation:where(.has-background), -.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list, -.wp-block-navigation:where(.has-background) .wp-block-navigation__container { - gap: inherit; -} - -/** - * Paddings - */ -.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -/** - * Justifications. - */ -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container { - right: auto; - left: 0; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: -1px; - left: -1px; -} -@media (min-width: 782px) { - .wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: auto; - left: 100%; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container { - background-color: #fff; - color: #000; - border: 1px solid rgba(0, 0, 0, 0.15); -} - -.wp-block-navigation__container { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - list-style: none; - margin: 0; - padding-right: 0; -} -.wp-block-navigation__container .is-responsive { - display: none; -} - -.wp-block-navigation__container:only-child, -.wp-block-page-list:only-child { - flex-grow: 1; -} - -/** - * Mobile menu. - */ -.wp-block-navigation__responsive-container { - display: none; - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; -} -.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); -} -.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open) { - color: inherit !important; - background-color: inherit !important; -} -.wp-block-navigation__responsive-container.is-menu-open { - display: flex; - flex-direction: column; - background-color: inherit; - padding: 2rem; - overflow: auto; - z-index: 100000; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { - padding-top: calc(2rem + 24px); - overflow: visible; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-items: var(--navigation-layout-justification-setting, inherit); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - justify-content: flex-start; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon { - display: none; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; - height: auto; - width: auto; - overflow: initial; - min-width: 200px; - position: static; - border: none; - padding-right: 2rem; - padding-left: 2rem; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - gap: inherit; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container { - padding-top: var(--wp--style--block-gap, 2em); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content { - padding: 0; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list { - display: flex; - flex-direction: column; - align-items: var(--navigation-layout-justification-setting, initial); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list { - color: inherit !important; - background: transparent !important; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - left: auto; - right: auto; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { - display: block; - width: 100%; - position: relative; - z-index: auto; - background-color: inherit; - } - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close { - display: none; - } - .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - right: 0; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open { - background-color: #fff; - color: #000; -} - -.wp-block-navigation__toggle_button_label { - font-size: 1rem; - font-weight: bold; -} - -.wp-block-navigation__responsive-container-open, -.wp-block-navigation__responsive-container-close { - vertical-align: middle; - cursor: pointer; - color: currentColor; - background: transparent; - border: none; - margin: 0; - padding: 0; -} -.wp-block-navigation__responsive-container-open svg, -.wp-block-navigation__responsive-container-close svg { - fill: currentColor; - pointer-events: none; - display: block; - width: 24px; - height: 24px; -} - -.wp-block-navigation__responsive-container-open { - display: flex; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container-open:not(.always-shown) { - display: none; - } -} - -.wp-block-navigation__responsive-container-close { - position: absolute; - top: 0; - left: 0; - z-index: 2; -} - -.wp-block-navigation__responsive-close { - width: 100%; -} -.wp-block-navigation__responsive-close:focus { - outline: none; -} - -.is-menu-open .wp-block-navigation__responsive-close, -.is-menu-open .wp-block-navigation__responsive-dialog, -.is-menu-open .wp-block-navigation__responsive-container-content { - box-sizing: border-box; -} - -.wp-block-navigation__responsive-dialog { - position: relative; -} - -html.has-modal-open { - overflow: hidden; -} - -.wp-block-navigation .wp-block-navigation-item__label { - word-break: normal; - overflow-wrap: break-word; -} -.wp-block-navigation .wp-block-navigation-item__description { - display: none; -} - -.wp-block-navigation .wp-block-page-list { - display: flex; - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - flex-wrap: var(--navigation-layout-wrap, wrap); - background-color: inherit; -} -.wp-block-navigation .wp-block-navigation-item { - background-color: inherit; -} - -.is-small-text { - font-size: 0.875em; -} - -.is-regular-text { - font-size: 1em; -} - -.is-large-text { - font-size: 2.25em; -} - -.is-larger-text { - font-size: 3em; -} - -.has-drop-cap:not(:focus)::first-letter { - float: right; - font-size: 8.4em; - line-height: 0.68; - font-weight: 100; - margin: 0.05em 0 0 0.1em; - text-transform: uppercase; - font-style: normal; -} - -p.has-drop-cap.has-background { - overflow: hidden; -} - -p.has-background { - padding: 1.25em 2.375em; -} - -:where(p.has-text-color:not(.has-link-color)) a { - color: inherit; -} - -.wp-block-post-author { - display: flex; - flex-wrap: wrap; -} -.wp-block-post-author__byline { - width: 100%; - margin-top: 0; - margin-bottom: 0; - font-size: 0.5em; -} -.wp-block-post-author__avatar { - margin-left: 1em; -} -.wp-block-post-author__bio { - margin-bottom: 0.7em; - font-size: 0.7em; -} -.wp-block-post-author__content { - flex-grow: 1; - flex-basis: 0; -} -.wp-block-post-author__name { - margin: 0; -} - -.wp-block-post-comments { - /* utility classes */ - /* end utility classes */ -} -.wp-block-post-comments .alignleft { - float: right; -} -.wp-block-post-comments .alignright { - float: left; -} -.wp-block-post-comments .navigation::after { - content: ""; - display: table; - clear: both; -} -.wp-block-post-comments .commentlist { - clear: both; - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .commentlist .comment { - min-height: 2.25em; - padding-right: 3.25em; -} -.wp-block-post-comments .commentlist .comment p { - font-size: 1em; - line-height: 1.8; - margin: 1em 0; -} -.wp-block-post-comments .commentlist .children { - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .comment-author { - line-height: 1.5; -} -.wp-block-post-comments .comment-author .avatar { - border-radius: 1.5em; - display: block; - float: right; - height: 2.5em; - margin-top: 0.5em; - margin-left: 0.75em; - width: 2.5em; -} -.wp-block-post-comments .comment-author cite { - font-style: normal; -} -.wp-block-post-comments .comment-meta { - font-size: 0.875em; - line-height: 1.5; -} -.wp-block-post-comments .comment-meta b { - font-weight: normal; -} -.wp-block-post-comments .comment-meta .comment-awaiting-moderation { - margin-top: 1em; - margin-bottom: 1em; - display: block; -} -.wp-block-post-comments .comment-body .commentmetadata { - font-size: 0.875em; -} -.wp-block-post-comments .comment-form-comment label, -.wp-block-post-comments .comment-form-author label, -.wp-block-post-comments .comment-form-email label, -.wp-block-post-comments .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments .comment-form textarea, -.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-right: 0.5em; -} -.wp-block-post-comments .reply { - font-size: 0.875em; - margin-bottom: 1.4em; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments input[type=submit] { - border: none; -} - -.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) { - font-weight: inherit; -} -.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title) { - font-family: inherit; -} -.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title), .wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title) { - font-size: inherit; -} -.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title) { - line-height: inherit; -} -.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title) { - font-style: inherit; -} -.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title) { - letter-spacing: inherit; -} -.wp-block-post-comments-form input[type=submit] { - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - text-align: center; - overflow-wrap: break-word; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments-form .comment-form textarea, -.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments-form .comment-form-author label, -.wp-block-post-comments-form .comment-form-email label, -.wp-block-post-comments-form .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments-form .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments-form .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-right: 0.5em; -} - -.wp-block-post-excerpt__more-link { - display: inline-block; -} - -.wp-block-post-featured-image { - margin-right: 0; - margin-left: 0; -} -.wp-block-post-featured-image a { - display: block; -} -.wp-block-post-featured-image img { - max-width: 100%; - width: 100%; - height: auto; - vertical-align: bottom; -} -.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img { - width: 100%; -} - -.wp-block-post-terms__separator { - white-space: pre-wrap; -} - -.wp-block-post-title { - word-break: break-word; -} -.wp-block-post-title a { - display: inline-block; -} - -.wp-block-preformatted { - white-space: pre-wrap; -} - -.wp-block-preformatted.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-pullquote { - margin: 0 0 1em 0; - padding: 3em 0; - text-align: center; - overflow-wrap: break-word; - box-sizing: border-box; -} -.wp-block-pullquote p, -.wp-block-pullquote blockquote, -.wp-block-pullquote cite { - color: inherit; -} -.wp-block-pullquote.has-text-align-left, .wp-block-pullquote.has-text-align-right, .wp-block-pullquote.alignleft, .wp-block-pullquote.alignright { - max-width: 420px; -} -.wp-block-pullquote.has-text-align-left p, .wp-block-pullquote.has-text-align-right p, .wp-block-pullquote.alignleft p, .wp-block-pullquote.alignright p { - font-size: 1.25em; -} -.wp-block-pullquote p { - font-size: 1.75em; - line-height: 1.6; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer { - position: relative; -} -.wp-block-pullquote .has-text-color a { - color: inherit; -} - -.wp-block-pullquote.has-text-align-left blockquote { - text-align: right; -} - -.wp-block-pullquote.has-text-align-right blockquote { - text-align: left; -} - -.wp-block-pullquote.is-style-solid-color { - border: none; -} -.wp-block-pullquote.is-style-solid-color blockquote { - margin-right: auto; - margin-left: auto; - max-width: 60%; -} -.wp-block-pullquote.is-style-solid-color blockquote p { - margin-top: 0; - margin-bottom: 0; - font-size: 2em; -} -.wp-block-pullquote.is-style-solid-color blockquote cite { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote cite { - color: inherit; -} - -.wp-block-post-template, -.wp-block-query-loop { - margin-top: 0; - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-post-template.wp-block-post-template, -.wp-block-query-loop.wp-block-post-template { - background: none; -} -.wp-block-post-template.is-flex-container, -.wp-block-query-loop.is-flex-container { - flex-direction: row; - display: flex; - flex-wrap: wrap; - gap: 1.25em; -} -.wp-block-post-template.is-flex-container li, -.wp-block-query-loop.is-flex-container li { - margin: 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - margin-right: 0; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(-1);; -} -.wp-block-query-pagination.aligncenter { - justify-content: center; -} - -.wp-block-quote { - box-sizing: border-box; - overflow-wrap: break-word; -} -.wp-block-quote.is-style-large:not(.is-style-plain), .wp-block-quote.is-large:not(.is-style-plain) { - margin-bottom: 1em; - padding: 0 1em; -} -.wp-block-quote.is-style-large:not(.is-style-plain) p, .wp-block-quote.is-large:not(.is-style-plain) p { - font-size: 1.5em; - font-style: italic; - line-height: 1.6; -} -.wp-block-quote.is-style-large:not(.is-style-plain) cite, -.wp-block-quote.is-style-large:not(.is-style-plain) footer, .wp-block-quote.is-large:not(.is-style-plain) cite, -.wp-block-quote.is-large:not(.is-style-plain) footer { - font-size: 1.125em; - text-align: left; -} - -.wp-block-read-more { - display: block; - width: -moz-fit-content; - width: fit-content; -} -.wp-block-read-more:not([style*=text-decoration]) { - text-decoration: none; -} -.wp-block-read-more:not([style*=text-decoration]):focus, .wp-block-read-more:not([style*=text-decoration]):active { - text-decoration: none; -} - -ul.wp-block-rss { - list-style: none; - padding: 0; -} -ul.wp-block-rss.wp-block-rss { - box-sizing: border-box; -} -ul.wp-block-rss.alignleft { - margin-right: 2em; -} -ul.wp-block-rss.alignright { - margin-left: 2em; -} -ul.wp-block-rss.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; - list-style: none; -} -ul.wp-block-rss.is-grid li { - margin: 0 0 1em 1em; - width: 100%; -} -@media (min-width: 600px) { - ul.wp-block-rss.columns-2 li { - width: calc(( 100% / 2 ) - 1em); - } - ul.wp-block-rss.columns-3 li { - width: calc(( 100% / 3 ) - 1em); - } - ul.wp-block-rss.columns-4 li { - width: calc(( 100% / 4 ) - 1em); - } - ul.wp-block-rss.columns-5 li { - width: calc(( 100% / 5 ) - 1em); - } - ul.wp-block-rss.columns-6 li { - width: calc(( 100% / 6 ) - 1em); - } -} - -.wp-block-rss__item-publish-date, -.wp-block-rss__item-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-search__button { - background: #f7f7f7; - border: 1px solid #ccc; - padding: 0.375em 0.625em; - color: #32373c; - margin-right: 0.625em; - word-break: normal; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} -.wp-block-search__button.has-icon { - line-height: 0; -} -.wp-block-search__button svg { - min-width: 1.5em; - min-height: 1.5em; - fill: currentColor; -} - -.wp-block-search__inside-wrapper { - display: flex; - flex: auto; - flex-wrap: nowrap; - max-width: 100%; -} - -.wp-block-search__label { - width: 100%; -} - -.wp-block-search__input { - padding: 8px; - flex-grow: 1; - min-width: 3em; - border: 1px solid #949494; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} - -.wp-block-search.wp-block-search__button-only .wp-block-search__button { - margin-right: 0; -} - -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper { - padding: 4px; - border: 1px solid #949494; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input { - border-radius: 0; - border: none; - padding: 0 0.25em 0 0; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus { - outline: none; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button { - padding: 0.125em 0.5em; -} - -.wp-block-search.aligncenter .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-separator { - border-top: 1px solid currentColor; - border-bottom: 1px solid currentColor; -} -.wp-block-separator.is-style-dots { - background: none !important; - border: none; - text-align: center; - line-height: 1; - height: auto; -} -.wp-block-separator.is-style-dots::before { - content: "···"; - color: currentColor; - font-size: 1.5em; - letter-spacing: 2em; - padding-left: 2em; - font-family: serif; -} - -.wp-block-site-logo { - line-height: 0; -} -.wp-block-site-logo a { - display: inline-block; -} -.wp-block-site-logo.is-default-size img { - width: 120px; - height: auto; -} -.wp-block-site-logo a, -.wp-block-site-logo img { - border-radius: inherit; -} -.wp-block-site-logo.aligncenter { - margin-right: auto; - margin-left: auto; - text-align: center; -} -.wp-block-site-logo.is-style-rounded { - border-radius: 9999px; -} - -.wp-block-social-links { - padding-right: 0; - padding-left: 0; - text-indent: 0; - margin-right: 0; - background: none; -} -.wp-block-social-links .wp-social-link a, -.wp-block-social-links .wp-social-link a:hover { - text-decoration: none; - border-bottom: 0; - box-shadow: none; -} -.wp-block-social-links .wp-social-link a { - padding: 0.25em; -} -.wp-block-social-links .wp-social-link svg { - width: 1em; - height: 1em; -} -.wp-block-social-links .wp-social-link span:not(.screen-reader-text) { - margin-right: 0.5em; - margin-left: 0.5em; - font-size: 0.65em; -} -.wp-block-social-links.has-small-icon-size { - font-size: 16px; -} -.wp-block-social-links, .wp-block-social-links.has-normal-icon-size { - font-size: 24px; -} -.wp-block-social-links.has-large-icon-size { - font-size: 36px; -} -.wp-block-social-links.has-huge-icon-size { - font-size: 48px; -} -.wp-block-social-links.aligncenter { - justify-content: center; - display: flex; -} -.wp-block-social-links.alignright { - justify-content: flex-end; -} - -.wp-block-social-link { - display: block; - border-radius: 9999px; - transition: transform 0.1s ease; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-social-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-social-link a { - align-items: center; - display: flex; - line-height: 0; - transition: transform 0.1s ease; -} -.wp-block-social-link:hover { - transform: scale(1.1); -} - -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited, -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg { - color: currentColor; - fill: currentColor; -} - -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link { - background-color: #f0f0f0; - color: #444; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon { - background-color: #f90; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp { - background-color: #1ea0c3; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance { - background-color: #0757fe; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen { - background-color: #1e1f26; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart { - background-color: #02e49b; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble { - background-color: #e94c89; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox { - background-color: #4280ff; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy { - background-color: #f45800; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook { - background-color: #1778f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr { - background-color: #0461dd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare { - background-color: #e65678; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github { - background-color: #24292d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads { - background-color: #eceadd; - color: #382110; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google { - background-color: #ea4434; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram { - background-color: #f00075; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm { - background-color: #e21b24; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin { - background-color: #0d66c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon { - background-color: #3288d4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium { - background-color: #02ab6c; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup { - background-color: #f6405f; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon { - background-color: #ff424d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest { - background-color: #e60122; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket { - background-color: #ef4155; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit { - background-color: #fe4500; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype { - background-color: #0478d7; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat { - background-color: #fefc00; - color: #fff; - stroke: #000; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud { - background-color: #ff5600; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify { - background-color: #1bd760; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram { - background-color: #2aabee; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr { - background-color: #011835; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch { - background-color: #6440a4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter { - background-color: #1da1f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo { - background-color: #1eb7ea; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk { - background-color: #4680c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress { - background-color: #3499cd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp { - background-color: #d32422; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube { - background-color: #f00; - color: #fff; -} - -.wp-block-social-links.is-style-logos-only .wp-social-link { - background: none; -} -.wp-block-social-links.is-style-logos-only .wp-social-link a { - padding: 0; -} -.wp-block-social-links.is-style-logos-only .wp-social-link svg { - width: 1.25em; - height: 1.25em; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-amazon { - color: #f90; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp { - color: #1ea0c3; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-behance { - color: #0757fe; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-codepen { - color: #1e1f26; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart { - color: #02e49b; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble { - color: #e94c89; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox { - color: #4280ff; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-etsy { - color: #f45800; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-facebook { - color: #1778f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-flickr { - color: #0461dd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare { - color: #e65678; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-github { - color: #24292d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads { - color: #382110; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-google { - color: #ea4434; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-instagram { - color: #f00075; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm { - color: #e21b24; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin { - color: #0d66c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon { - color: #3288d4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-medium { - color: #02ab6c; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-meetup { - color: #f6405f; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-patreon { - color: #ff424d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest { - color: #e60122; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pocket { - color: #ef4155; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-reddit { - color: #fe4500; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-skype { - color: #0478d7; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat { - color: #fff; - stroke: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud { - color: #ff5600; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-spotify { - color: #1bd760; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-telegram { - color: #2aabee; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr { - color: #011835; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitch { - color: #6440a4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitter { - color: #1da1f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo { - color: #1eb7ea; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vk { - color: #4680c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress { - color: #3499cd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-yelp { - color: #d32422; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-youtube { - color: #f00; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link { - width: auto; -} -.wp-block-social-links.is-style-pill-shape .wp-social-link a { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -} - -.wp-block-spacer { - clear: both; -} - -.wp-block-tag-cloud.aligncenter { - text-align: center; -} -.wp-block-tag-cloud.alignfull { - padding-right: 1em; - padding-left: 1em; -} -.wp-block-tag-cloud a { - display: inline-block; - margin-left: 5px; -} -.wp-block-tag-cloud span { - display: inline-block; - margin-right: 5px; - text-decoration: none; -} -.wp-block-tag-cloud.is-style-outline { - display: flex; - flex-wrap: wrap; - gap: 1ch; -} -.wp-block-tag-cloud.is-style-outline a { - border: 1px solid currentColor; - font-size: unset !important; - margin-left: 0; - padding: 1ch 2ch; - text-decoration: none !important; -} - -.wp-block-table { - margin: 0 0 1em 0; - overflow-x: auto; -} -.wp-block-table table { - border-collapse: collapse; - width: 100%; -} -.wp-block-table .has-fixed-layout { - table-layout: fixed; - width: 100%; -} -.wp-block-table .has-fixed-layout td, -.wp-block-table .has-fixed-layout th { - word-break: break-word; -} -.wp-block-table.alignleft, .wp-block-table.aligncenter, .wp-block-table.alignright { - display: table; - width: auto; -} -.wp-block-table.alignleft td, -.wp-block-table.alignleft th, .wp-block-table.aligncenter td, -.wp-block-table.aligncenter th, .wp-block-table.alignright td, -.wp-block-table.alignright th { - word-break: break-word; -} -.wp-block-table .has-subtle-light-gray-background-color { - background-color: #f3f4f5; -} -.wp-block-table .has-subtle-pale-green-background-color { - background-color: #e9fbe5; -} -.wp-block-table .has-subtle-pale-blue-background-color { - background-color: #e7f5fe; -} -.wp-block-table .has-subtle-pale-pink-background-color { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes { - border-spacing: 0; - border-collapse: inherit; - background-color: transparent; - border-bottom: 1px solid #f0f0f0; -} -.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { - background-color: #f0f0f0; -} -.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd) { - background-color: #f3f4f5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd) { - background-color: #e9fbe5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd) { - background-color: #e7f5fe; -} -.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd) { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes th, -.wp-block-table.is-style-stripes td { - border-color: transparent; -} -.wp-block-table .has-border-color > *, -.wp-block-table .has-border-color tr, -.wp-block-table .has-border-color th, -.wp-block-table .has-border-color td { - border-color: inherit; -} -.wp-block-table table[style*=border-style] > *, -.wp-block-table table[style*=border-style] tr, -.wp-block-table table[style*=border-style] th, -.wp-block-table table[style*=border-style] td { - border-style: inherit; -} -.wp-block-table table[style*=border-width] > *, -.wp-block-table table[style*=border-width] tr, -.wp-block-table table[style*=border-width] th, -.wp-block-table table[style*=border-width] td { - border-width: inherit; - border-style: inherit; -} - -.wp-block-text-columns { - display: flex; -} -.wp-block-text-columns.aligncenter { - display: flex; -} -.wp-block-text-columns .wp-block-column { - margin: 0 1em; - padding: 0; -} -.wp-block-text-columns .wp-block-column:first-child { - margin-right: 0; -} -.wp-block-text-columns .wp-block-column:last-child { - margin-left: 0; -} -.wp-block-text-columns.columns-2 .wp-block-column { - width: calc(100% / 2); -} -.wp-block-text-columns.columns-3 .wp-block-column { - width: calc(100% / 3); -} -.wp-block-text-columns.columns-4 .wp-block-column { - width: calc(100% / 4); -} - -pre.wp-block-verse { - font-family: inherit; - overflow: auto; - white-space: pre-wrap; -} - -.wp-block-video { - margin: 0 0 1em 0; -} -.wp-block-video video { - width: 100%; -} -@supports (position: sticky) { - .wp-block-video [poster] { - -o-object-fit: cover; - object-fit: cover; - } -} -.wp-block-video.aligncenter { - text-align: center; -} -.wp-block-video figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} - -:root { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} -:root .has-very-light-gray-background-color { - background-color: #eee; -} -:root .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .has-very-light-gray-color { - color: #eee; -} -:root .has-very-dark-gray-color { - color: #313131; -} -:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(-135deg, #00d084 0%, #0693e3 100%); -} -:root .has-purple-crush-gradient-background { - background: linear-gradient(-135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .has-hazy-dawn-gradient-background { - background: linear-gradient(-135deg, #faaca8 0%, #dad0ec 100%); -} -:root .has-subdued-olive-gradient-background { - background: linear-gradient(-135deg, #fafae1 0%, #67a671 100%); -} -:root .has-atomic-cream-gradient-background { - background: linear-gradient(-135deg, #fdd79a 0%, #004a59 100%); -} -:root .has-nightshade-gradient-background { - background: linear-gradient(-135deg, #330968 0%, #31cdcf 100%); -} -:root .has-midnight-gradient-background { - background: linear-gradient(-135deg, #020381 0%, #2874fc 100%); -} - -.has-regular-font-size { - font-size: 1em; -} - -.has-larger-font-size { - font-size: 2.625em; -} - -.has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -.has-text-align-center { - text-align: center; -} - -.has-text-align-left { - text-align: left; -} - -.has-text-align-right { - text-align: right; -} - -#end-resizable-editor-section { - display: none; -} - -.aligncenter { - clear: both; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -.screen-reader-text { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.screen-reader-text:focus { - background-color: #ddd; - clip: auto !important; - -webkit-clip-path: none; - clip-path: none; - color: #444; - display: block; - font-size: 1em; - height: auto; - right: 5px; - line-height: normal; - padding: 15px 23px 14px; - text-decoration: none; - top: 5px; - width: auto; - z-index: 100000; -} - -/** - * The following provide a simple means of applying a default border style when - * a user first makes a selection in the border block support panel. - * This prevents issues such as where the user could set a border width - * and see no border due there being no border style set. - * - * This is intended to be removed once intelligent defaults can be set while - * making border selections via the block support. - * - * See: https://github.com/WordPress/gutenberg/pull/33743 - */ -html :where(.has-border-color) { - border-style: solid; -} - -html :where([style*="border-width"]) { - border-style: solid; -} - -/** - * Provide baseline responsiveness for images. - */ -html :where(img[class*="wp-image-"]) { - height: auto; - max-width: 100%; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Editor Normalization Styles -* -* These are only output in the editor, but styles here are prefixed .editor-styles-wrapper and affect the theming -* of the editor by themes. -*/ -html :where(.editor-styles-wrapper) { - /** - * The following styles revert to the browser defaults overriding the WPAdmin styles. - * This is only needed while the block editor is not being loaded in an iframe. - */ - font-family: serif; - font-size: initial; - line-height: initial; - color: initial; - background: #fff; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper { - max-width: 840px; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper > .wp-block, html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-full { - max-width: none; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-wide { - max-width: 840px; -} -html :where(.editor-styles-wrapper) a { - transition: none; -} -html :where(.editor-styles-wrapper) code, -html :where(.editor-styles-wrapper) kbd { - padding: 0; - margin: 0; - background: inherit; - font-size: inherit; - font-family: monospace; -} -html :where(.editor-styles-wrapper) p { - font-size: revert; - line-height: revert; - margin: revert; -} -html :where(.editor-styles-wrapper) ul, -html :where(.editor-styles-wrapper) ol { - margin: revert; - padding: revert; - list-style-type: revert; - box-sizing: border-box; -} -html :where(.editor-styles-wrapper) ul ul, -html :where(.editor-styles-wrapper) ul ol, -html :where(.editor-styles-wrapper) ol ul, -html :where(.editor-styles-wrapper) ol ol { - margin: revert; -} -html :where(.editor-styles-wrapper) ul li, -html :where(.editor-styles-wrapper) ol li { - margin: revert; -} -html :where(.editor-styles-wrapper) ul ul, -html :where(.editor-styles-wrapper) ol ul { - list-style-type: revert; -} -html :where(.editor-styles-wrapper) h1, -html :where(.editor-styles-wrapper) h2, -html :where(.editor-styles-wrapper) h3, -html :where(.editor-styles-wrapper) h4, -html :where(.editor-styles-wrapper) h5, -html :where(.editor-styles-wrapper) h6 { - font-size: revert; - margin: revert; - color: revert; - line-height: revert; - font-weight: revert; -} -html :where(.editor-styles-wrapper) select { - font-family: system-ui; - -webkit-appearance: revert; - color: revert; - border: revert; - border-radius: revert; - background: revert; - box-shadow: revert; - text-shadow: revert; - outline: revert; - cursor: revert; - transform: revert; - font-size: revert; - line-height: revert; - padding: revert; - margin: revert; - min-height: revert; - max-width: revert; - vertical-align: revert; - font-weight: revert; -} -html :where(.editor-styles-wrapper) select:disabled, -html :where(.editor-styles-wrapper) select:focus { - color: revert; - border-color: revert; - background-color: revert; - background-image: revert; - box-shadow: revert; - text-shadow: revert; - cursor: revert; - transform: revert; -}.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:hsla(0,0%,100%,.65)}.wp-block-code{border:1px solid #ccc;border-radius:4px;font-family:Menlo,Consolas,monaco,monospace;padding:.8em 1em}.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:hsla(0,0%,100%,.65)}.blocks-gallery-caption{color:#555;font-size:13px;text-align:center}.is-dark-theme .blocks-gallery-caption{color:hsla(0,0%,100%,.65)}.wp-block-image figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-image figcaption{color:hsla(0,0%,100%,.65)}.wp-block-pullquote{border-top:4px solid;border-bottom:4px solid;margin-bottom:1.75em;color:currentColor}.wp-block-pullquote__citation,.wp-block-pullquote cite,.wp-block-pullquote footer{color:currentColor;text-transform:uppercase;font-size:.8125em;font-style:normal}.wp-block-quote{border-left:.25em solid;margin:0 0 1.75em;padding-left:1em}.wp-block-quote cite,.wp-block-quote footer{color:currentColor;font-size:.8125em;position:relative;font-style:normal}.wp-block-quote.has-text-align-right{border-left:none;border-right:.25em solid;padding-left:0;padding-right:1em}.wp-block-quote.has-text-align-center{border:none;padding-left:0}.wp-block-quote.is-large,.wp-block-quote.is-style-large,.wp-block-quote.is-style-plain{border:none}.wp-block-search .wp-block-search__label{font-weight:700}:where(.wp-block-group.has-background){padding:1.25em 2.375em}.wp-block-separator.has-css-opacity{opacity:.4}.wp-block-separator{border:none;border-bottom:2px solid;margin-left:auto;margin-right:auto}.wp-block-separator.has-alpha-channel-opacity{opacity:1}.wp-block-separator:not(.is-style-wide):not(.is-style-dots){width:100px}.wp-block-separator.has-background:not(.is-style-dots){border-bottom:none;height:1px}.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots){height:2px}.wp-block-table thead{border-bottom:3px solid}.wp-block-table tfoot{border-top:3px solid}.wp-block-table td,.wp-block-table th{padding:.5em;border:1px solid;word-break:normal}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.wp-block-video figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-video figcaption{color:hsla(0,0%,100%,.65)}.wp-block-template-part.has-background{padding:1.25em 2.375em;margin-top:0;margin-bottom:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-archives { - padding-left: 2.5em; -} - -.wp-block-audio { - margin-left: 0; - margin-right: 0; - position: relative; -} -.wp-block-audio.is-transient audio { - opacity: 0.3; -} -.wp-block-audio .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -.wp-block-avatar__image img { - width: 100%; -} - -.wp-block-avatar.aligncenter .components-resizable-box__container { - margin: 0 auto; -} - -.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container { - padding-left: 0; - padding-right: 0; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow { - display: block; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender { - display: none; -} - -.wp-block[data-align=center] > .wp-block-button { - text-align: center; - margin-left: auto; - margin-right: auto; -} - -.wp-block[data-align=right] > .wp-block-button { - /*!rtl:ignore*/ - text-align: right; -} - -.wp-block-button { - position: relative; - cursor: text; -} -.wp-block-button:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: -2px; -} -.wp-block-button[data-rich-text-placeholder]::after { - opacity: 0.8; -} - -.wp-block-button__inline-link { - color: #757575; - height: 0; - overflow: hidden; - max-width: 290px; -} -.wp-block-button__inline-link-input__suggestions { - max-width: 290px; -} -@media (min-width: 782px) { - .wp-block-button__inline-link { - max-width: 260px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 260px; - } -} -@media (min-width: 960px) { - .wp-block-button__inline-link { - max-width: 290px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 290px; - } -} -.is-selected .wp-block-button__inline-link { - height: auto; - overflow: visible; -} - -.wp-button-label__width .components-button-group { - display: block; -} -.wp-button-label__width .components-base-control__field { - margin-bottom: 12px; -} - -div[data-type="core/button"] { - display: table; -} - -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons > .wp-block { - margin: 0; -} -.wp-block-buttons > .wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button { - margin: 0; -} -.wp-block-buttons > .block-list-appender { - display: inline-flex; - align-items: center; -} -.wp-block-buttons.is-vertical > .block-list-appender .block-list-appender__toggle { - justify-content: flex-start; -} -.wp-block-buttons > .wp-block-button:focus { - box-shadow: none; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] { - /* stylelint-enable indentation */ - margin-left: auto; - margin-right: auto; - margin-top: 0; - width: 100%; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] .wp-block-button { - margin-bottom: 0; -} - -.wp-block[data-align=center] > .wp-block-buttons { - align-items: center; - justify-content: center; -} - -.wp-block[data-align=right] > .wp-block-buttons { - justify-content: flex-end; -} - -.wp-block-categories ul { - padding-left: 2.5em; -} -.wp-block-categories ul ul { - margin-top: 6px; -} - -.wp-block-columns :where(.wp-block) { - max-width: none; - margin-left: 0; - margin-right: 0; -} - -html :where(.wp-block-column) { - margin-top: 0; - margin-bottom: 0; -} - -.wp-block-comment-author-avatar__placeholder { - border: currentColor 1px dashed; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; -} - -.block-library-comments-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block[data-align=center] > .wp-block-comments-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-comments-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-left: 0; - margin-top: 0.5em; - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} - -.wp-block-comments-pagination-numbers a { - text-decoration: underline; -} -.wp-block-comments-pagination-numbers .page-numbers { - margin-right: 2px; -} -.wp-block-comments-pagination-numbers .page-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} - -.wp-block-comments-title.has-background { - padding: inherit; -} - -.wp-block-cover { - /* Extra specificity needed because the reset.css applied in the editor context is overriding this rule. */ -} -.editor-styles-wrapper .wp-block-cover { - box-sizing: border-box; -} -.wp-block-cover.is-placeholder { - min-height: auto !important; - padding: 0 !important; -} -.wp-block-cover.is-placeholder .block-library-cover__resize-container { - display: none; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large { - min-height: 240px; - justify-content: flex-start; - z-index: 1; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large + .block-library-cover__resize-container { - min-height: 240px; - display: block; -} -.wp-block-cover.components-placeholder h2 { - color: inherit; -} -.wp-block-cover.is-transient::before { - background-color: #fff; - opacity: 0.3; -} -.wp-block-cover .components-spinner { - position: absolute; - z-index: 1; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - margin: 0; -} -.wp-block-cover .block-editor-block-list__layout { - width: 100%; -} -.wp-block-cover .wp-block-cover__inner-container { - text-align: left; - margin-left: 0; - margin-right: 0; -} -.wp-block-cover .wp-block-cover__placeholder-background-options { - width: 100%; -} - -[data-align=left] > .wp-block-cover, -[data-align=right] > .wp-block-cover { - max-width: 420px; - width: 100%; -} - -.block-library-cover__reset-button { - margin-left: auto; -} - -.block-library-cover__resize-container { - position: absolute !important; - top: 0; - left: 0; - right: 0; - bottom: 0; - min-height: 50px; -} - -.block-library-cover__resize-container:not(.is-resizing) { - height: auto !important; -} - -.wp-block-cover > .components-drop-zone .components-drop-zone__content { - opacity: 0.8 !important; -} - -.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover { - background-attachment: scroll; -} - -.wp-block-embed { - margin-left: 0; - margin-right: 0; - clear: both; -} -.wp-block-embed.is-loading { - display: flex; - justify-content: center; -} -.wp-block-embed .components-placeholder__error { - word-break: break-word; -} -.wp-block-embed .components-placeholder__learn-more { - margin-top: 1em; -} - -.block-library-embed__interactive-overlay { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; -} - -.wp-block[data-align=left] > .wp-block-embed, -.wp-block[data-align=right] > .wp-block-embed { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > .wp-block-embed .wp-block-embed__wrapper, -.wp-block[data-align=right] > .wp-block-embed .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-file { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; - margin-bottom: 0; -} -.wp-block[data-align=left] > .wp-block-file, .wp-block[data-align=right] > .wp-block-file { - height: auto; -} -.wp-block-file .components-resizable-box__container { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__preview { - margin-bottom: 1em; - width: 100%; - height: 100%; -} -.wp-block-file .wp-block-file__preview-overlay { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} -.wp-block-file .wp-block-file__content-wrapper { - flex-grow: 1; -} -.wp-block-file a { - min-width: 1em; -} -.wp-block-file .wp-block-file__button-richtext-wrapper { - display: inline-block; - margin-left: 0.75em; -} - -.wp-block-freeform.block-library-rich-text__tinymce { - height: auto; - /* Allow height of embed iframes to be calculated properly */ - /* Remove blue highlighting of selected images in WebKit */ - /* Image captions */ - /* WP Views */ -} -.wp-block-freeform.block-library-rich-text__tinymce p, -.wp-block-freeform.block-library-rich-text__tinymce li { - line-height: 1.8; -} -.wp-block-freeform.block-library-rich-text__tinymce ul, -.wp-block-freeform.block-library-rich-text__tinymce ol { - padding-left: 2.5em; - margin-left: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce blockquote { - margin: 0; - box-shadow: inset 0 0 0 0 #ddd; - border-left: 4px solid #000; - padding-left: 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce pre { - white-space: pre-wrap; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - color: #1e1e1e; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:first-child { - margin-top: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:last-child { - margin-bottom: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce a { - color: var(--wp-admin-theme-color); -} -.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected] { - padding: 0 2px; - margin: 0 -2px; - border-radius: 2px; - box-shadow: 0 0 0 1px #e5f5fa; - background: #e5f5fa; -} -.wp-block-freeform.block-library-rich-text__tinymce code { - padding: 2px; - border-radius: 2px; - color: #1e1e1e; - background: #f0f0f0; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 14px; -} -.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected] { - background: #ddd; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignright { - /*rtl:ignore*/ - float: right; - /*rtl:ignore*/ - margin: 0.5em 0 0.5em 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignleft { - /*rtl:ignore*/ - float: left; - /*rtl:ignore*/ - margin: 0.5em 1em 0.5em 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .aligncenter { - display: block; - margin-left: auto; - margin-right: auto; -} -.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag { - width: 96%; - height: 20px; - display: block; - margin: 15px auto; - outline: 0; - cursor: default; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC); - background-size: 1900px 20px; - background-repeat: no-repeat; - background-position: center; -} -.wp-block-freeform.block-library-rich-text__tinymce img::selection { - background-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp { - -ms-user-select: element; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption { - margin: 0; - /* dl browser reset */ - max-width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a, -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img { - display: block; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption, .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * { - -webkit-user-drag: none; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd { - padding-top: 0.5em; - margin: 0; - /* browser dd reset */ -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview { - width: 99.99%; - /* All IE need hasLayout, incl. 11 (ugh, not again!!) */ - position: relative; - clear: both; - margin-bottom: 16px; - border: 1px solid transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe { - display: block; - max-width: 100%; - background: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim { - display: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder { - border: 1px dashed #ddd; - padding: 10px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error { - border: 1px solid #ddd; - padding: 1em 0; - margin: 0; - word-wrap: break-word; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p { - margin: 0; - text-align: center; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder, .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error { - border-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons { - display: block; - margin: 0 auto; - width: 32px; - height: 32px; - font-size: 32px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery::after { - content: ""; - display: table; - clear: both; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery a { - cursor: default; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery { - margin: auto -6px; - padding: 6px 0; - line-height: 1; - overflow-x: hidden; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item { - float: left; - margin: 0; - text-align: center; - padding: 6px; - box-sizing: border-box; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption, -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon { - margin: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption { - font-size: 13px; - margin: 4px 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item { - width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item { - width: 50%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item { - width: 33.3333333333%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item { - width: 25%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item { - width: 20%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item { - width: 16.6666666667%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item { - width: 14.2857142857%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item { - width: 12.5%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item { - width: 11.1111111111%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img { - max-width: 100%; - height: auto; - border: none; - padding: 0; -} - -div[data-type="core/freeform"]::before { - transition: border-color 0.1s linear, box-shadow 0.1s linear; - border: 1px solid #ddd; - outline: 1px solid transparent; -} -@media (prefers-reduced-motion: reduce) { - div[data-type="core/freeform"]::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -div[data-type="core/freeform"].is-selected::before { - border-color: #1e1e1e; -} -div[data-type="core/freeform"] .block-editor-block-contextual-toolbar + div { - margin-top: 0; - padding-top: 0; -} -div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce::after { - content: ""; - display: table; - clear: both; -} - -.mce-toolbar-grp .mce-btn.mce-active button, -.mce-toolbar-grp .mce-btn.mce-active:hover button, -.mce-toolbar-grp .mce-btn.mce-active i, -.mce-toolbar-grp .mce-btn.mce-active:hover i { - color: #1e1e1e; -} -.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last { - margin-right: 0; - margin-left: 8px; -} -.mce-toolbar-grp .mce-btn i { - font-style: normal; -} - -.block-library-classic__toolbar { - display: none; - width: auto; - margin: 0; - position: sticky; - z-index: 31; - top: 0; - border: 1px solid #ddd; - border-bottom: none; - border-radius: 2px; - margin-bottom: 8px; - padding: 0; -} -div[data-type="core/freeform"].is-selected .block-library-classic__toolbar { - display: block; - border-color: #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce { - box-shadow: none; -} -@media (min-width: 600px) { - .block-library-classic__toolbar { - padding: 0; - } -} -.block-library-classic__toolbar:empty { - display: block; - background: #f5f5f5; - border-bottom: 1px solid #e2e4e7; -} -.block-library-classic__toolbar:empty::before { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - content: attr(data-placeholder); - color: #555d66; - line-height: 37px; - padding: 14px; -} -.block-library-classic__toolbar div.mce-toolbar-grp { - border-bottom: 1px solid #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce-inline, -.block-library-classic__toolbar .mce-tinymce-inline > div, -.block-library-classic__toolbar div.mce-toolbar-grp, -.block-library-classic__toolbar div.mce-toolbar-grp > div, -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar .mce-menubar > div { - height: auto !important; - width: 100% !important; -} -.block-library-classic__toolbar .mce-container-body.mce-abs-layout { - overflow: visible; -} -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar div.mce-toolbar-grp { - position: static; -} -.block-library-classic__toolbar .mce-toolbar-grp > div { - padding: 1px 3px; -} -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -} - -figure.wp-block-gallery { - display: block; -} -figure.wp-block-gallery.has-nested-images .components-drop-zone { - display: none; - pointer-events: none; -} -figure.wp-block-gallery > .blocks-gallery-caption { - flex: 0 0 100%; -} -figure.wp-block-gallery > .blocks-gallery-media-placeholder-wrapper { - flex-basis: 100%; -} -figure.wp-block-gallery .wp-block-image .components-notice.is-error { - display: block; -} -figure.wp-block-gallery .wp-block-image .components-notice__content { - margin: 4px 0; -} -figure.wp-block-gallery .wp-block-image .components-notice__dismiss { - position: absolute; - top: 0; - right: 5px; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label { - display: none; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button { - margin-bottom: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder { - margin: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} -figure.wp-block-gallery .block-editor-media-placeholder figcaption { - z-index: 2; -} -figure.wp-block-gallery .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -/** - * Gallery inspector controls settings. - */ -.gallery-settings-buttons .components-button:first-child { - margin-right: 8px; -} - -.gallery-image-sizes .components-base-control__label { - display: block; - margin-bottom: 4px; -} -.gallery-image-sizes .gallery-image-sizes__loading { - display: flex; - align-items: center; - color: #757575; - font-size: 12px; -} -.gallery-image-sizes .components-spinner { - margin: 0 8px 0 4px; -} - -/** - * Deprecated css past this point. This can be removed once all galleries are migrated - * to V2. - */ -.blocks-gallery-item figure:not(.is-selected):focus, -.blocks-gallery-item img:focus { - outline: none; -} -.blocks-gallery-item figure.is-selected::before { - box-shadow: 0 0 0 1px #fff inset, 0 0 0 3px var(--wp-admin-theme-color) inset; - content: ""; - outline: 2px solid transparent; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1; - pointer-events: none; -} -.blocks-gallery-item figure.is-transient img { - opacity: 0.3; -} -.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu { - display: inline-flex; -} -.blocks-gallery-item .block-editor-media-placeholder { - margin: 0; - height: 100%; -} -.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} - -.block-library-gallery-item__inline-menu { - display: none; - position: absolute; - top: -2px; - margin: 8px; - z-index: 20; - transition: box-shadow 0.2s ease-out; - border-radius: 2px; - background: #fff; - border: 1px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .block-library-gallery-item__inline-menu { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-library-gallery-item__inline-menu:hover { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu { - padding: 2px; - } -} -.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus) { - border: none; - box-shadow: none; -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon, .columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon { - padding: 0; - width: inherit; - height: inherit; - } -} -.block-library-gallery-item__inline-menu.is-left { - left: -2px; -} -.block-library-gallery-item__inline-menu.is-right { - right: -2px; -} - -.wp-block-gallery ul.blocks-gallery-grid { - padding: 0; - margin: 0; -} - -@media (min-width: 600px) { - .wp-block-update-gallery-modal { - max-width: 480px; - } -} - -.wp-block-update-gallery-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -/** - * Group: All Alignment Settings - */ -.wp-block-group .block-editor-block-list__insertion-point { - left: 0; - right: 0; -} - -[data-type="core/group"].is-selected .block-list-appender { - margin-left: 0; - margin-right: 0; -} -[data-type="core/group"].is-selected .has-background .block-list-appender { - margin-top: 18px; - margin-bottom: 18px; -} - -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child { - gap: inherit; - pointer-events: none; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - display: inherit; - width: 100%; - flex-direction: inherit; - flex: 1; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child::after { - content: ""; - display: flex; - border: 1px dashed currentColor; - opacity: 0.4; - border-radius: 2px; - flex: 1; - pointer-events: none; - min-height: 48px; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - pointer-events: all; -} - -.block-library-html__edit .block-library-html__preview-overlay { - position: absolute; - width: 100%; - height: 100%; - top: 0; - left: 0; -} -.block-library-html__edit .block-editor-plain-text { - font-family: Menlo, Consolas, monaco, monospace !important; - color: #1e1e1e !important; - background: #fff !important; - padding: 12px !important; - border: 1px solid #1e1e1e !important; - box-shadow: none !important; - border-radius: 2px !important; - max-height: 250px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (min-width: 600px) { - .block-library-html__edit .block-editor-plain-text { - font-size: 13px !important; - } -} -.block-library-html__edit .block-editor-plain-text:focus { - border-color: var(--wp-admin-theme-color) !important; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) !important; - outline: 2px solid transparent !important; -} - -figure.wp-block-image:not(.wp-block) { - margin: 0; -} - -.wp-block-image { - position: relative; -} -.wp-block-image .is-applying img, .wp-block-image.is-transient img { - opacity: 0.3; -} -.wp-block-image figcaption img { - display: inline; -} -.wp-block-image .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} -.wp-block-image:not(.is-style-rounded) > div:not(.components-placeholder) { - border-radius: inherit; -} - -.wp-block-image .components-resizable-box__container { - display: inline-block; -} -.wp-block-image .components-resizable-box__container img { - display: block; - width: inherit; - height: inherit; -} - -.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - position: absolute; - left: 0; - right: 0; - margin: -1px 0; -} -@media (min-width: 600px) { - .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - margin: -1px; - } -} - -[data-align=wide] > .wp-block-image img, -[data-align=full] > .wp-block-image img { - height: auto; - width: 100%; -} - -.wp-block[data-align=left] > .wp-block-image, -.wp-block[data-align=center] > .wp-block-image, -.wp-block[data-align=right] > .wp-block-image { - display: table; -} -.wp-block[data-align=left] > .wp-block-image > figcaption, -.wp-block[data-align=center] > .wp-block-image > figcaption, -.wp-block[data-align=right] > .wp-block-image > figcaption { - display: table-caption; - caption-side: bottom; -} - -.wp-block[data-align=left] > .wp-block-image { - margin-right: 1em; - margin-left: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=right] > .wp-block-image { - margin-left: 1em; - margin-right: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=center] > .wp-block-image { - margin-left: auto; - margin-right: auto; - text-align: center; -} - -.wp-block-image__crop-area { - position: relative; - max-width: 100%; - width: 100%; -} - -.wp-block-image__crop-icon { - padding: 0 8px; - min-width: 48px; - display: flex; - justify-content: center; - align-items: center; -} -.wp-block-image__crop-icon svg { - fill: currentColor; -} - -.wp-block-image__zoom .components-popover__content { - overflow: visible; - min-width: 260px; -} -.wp-block-image__zoom .components-range-control { - flex: 1; -} -.wp-block-image__zoom .components-base-control__field { - display: flex; - margin-bottom: 0; - flex-direction: column; - align-items: flex-start; -} - -.wp-block-image__aspect-ratio { - height: 46px; - margin-bottom: -8px; - display: flex; - align-items: center; -} -.wp-block-image__aspect-ratio .components-button { - width: 36px; - padding-left: 0; - padding-right: 0; -} - -.wp-block-latest-posts { - padding-left: 2.5em; -} -.wp-block-latest-posts.is-grid { - padding-left: 0; -} - -.wp-block-latest-posts li a > div { - display: inline; -} - -.edit-post-visual-editor .wp-block-latest-posts.is-grid li { - margin-bottom: 20px; -} - -.editor-latest-posts-image-alignment-control .components-base-control__label { - display: block; -} -.editor-latest-posts-image-alignment-control .components-toolbar { - border-radius: 2px; -} - -.wp-block-media-text__media { - position: relative; -} -.wp-block-media-text__media.is-transient img { - opacity: 0.3; -} -.wp-block-media-text__media .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -.wp-block-media-text .__resizable_base__ { - grid-column: 1/span 2; - grid-row: 2; -} - -.wp-block-media-text .editor-media-container__resizer { - width: 100% !important; -} - -.wp-block-media-text.is-image-fill .editor-media-container__resizer { - height: 100% !important; -} - -.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block { - max-width: unset; -} - -.block-editor-block-list__block[data-type="core/more"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-more { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-more input[type=text] { - position: relative; - font-size: 13px; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border: none; - box-shadow: none; - white-space: nowrap; - text-align: center; - margin: 0; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; - max-width: 100%; -} -.wp-block-more input[type=text]:focus { - box-shadow: none; -} -.wp-block-more::before { - content: ""; - position: absolute; - top: calc(50%); - left: 0; - right: 0; - border-top: 3px dashed #ccc; -} - -/** - * Editor only CSS. - */ -.editor-styles-wrapper .wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-left: 0; - padding-left: 0; -} -.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block { - margin: revert; -} - -.wp-block-navigation-item__label { - display: inline; -} - -/** - * Submenus. - */ -.wp-block-navigation__container.is-parent-of-selected-block { - visibility: visible; - opacity: 1; - overflow: visible; -} - -.wp-block-navigation__container, -.wp-block-navigation-item { - background-color: inherit; -} - -.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover > .wp-block-navigation__submenu-container { - opacity: 0; - visibility: hidden; -} - -.has-child.is-selected > .wp-block-navigation__submenu-container, .has-child.has-child-selected > .wp-block-navigation__submenu-container { - display: flex; - opacity: 1; - visibility: visible; -} - -.is-dragging-components-draggable .has-child.is-dragging-within > .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; -} - -.is-editing > .wp-block-navigation__container { - visibility: visible; - opacity: 1; - display: flex; - flex-direction: column; -} - -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container { - opacity: 1; - visibility: hidden; -} -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container .block-editor-block-draggable-chip-wrapper { - visibility: visible; -} - -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender { - display: block; - position: static; - width: 100%; -} -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender .block-editor-button-block-appender { - color: #fff; - background: #1e1e1e; - padding: 0; - width: 24px; - border-radius: 2px; - margin-right: 0; - margin-left: auto; -} - -.wp-block-navigation__submenu-container .block-list-appender { - display: none; -} - -/** - * Colors Selector component - */ -.block-library-colors-selector { - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__toggle { - display: block; - margin: 0 auto; - padding: 3px; - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__icon-container { - height: 30px; - position: relative; - margin: 0 auto; - padding: 3px; - display: flex; - align-items: center; - border-radius: 4px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection { - margin-left: auto; - margin-right: auto; - border-radius: 11px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - width: 22px; - min-width: 22px; - height: 22px; - min-height: 22px; - line-height: 20px; - padding: 2px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection > svg { - min-width: auto !important; -} -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg, -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg path { - color: inherit; -} - -.block-library-colors-selector__popover .color-palette-controller-container { - padding: 16px; -} -.block-library-colors-selector__popover .components-base-control__label { - height: 20px; - line-height: 20px; -} -.block-library-colors-selector__popover .component-color-indicator { - float: right; - margin-top: 2px; -} -.block-library-colors-selector__popover .components-panel__body-title { - display: none; -} - -.wp-block-navigation .block-editor-button-block-appender { - background-color: #1e1e1e; - color: #fff; -} -.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender { - padding: 0; -} - -.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender { - background-color: transparent; - color: #1e1e1e; -} - -/** - * Setup state - */ -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.components-placeholder.wp-block-navigation-placeholder { - outline: none; - padding: 0; - box-shadow: none; - background: none; - min-height: 0; - color: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset { - font-size: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button { - margin-bottom: 0; -} -.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder { - color: #1e1e1e; -} - -.wp-block-navigation-placeholder .components-spinner { - margin-top: 0; -} - -.wp-block-navigation-placeholder__preview { - display: flex; - align-items: center; - min-width: 96px; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: currentColor; - background: transparent; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview { - display: none; -} -.wp-block-navigation-placeholder__preview::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-navigation-placeholder__preview > svg { - fill: currentColor; - opacity: 0.4; -} - -.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset, -.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset { - min-height: 90px; -} - -.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset { - min-height: 132px; -} - -.wp-block-navigation-placeholder__preview, -.wp-block-navigation-placeholder__controls { - padding: 6px 8px; - flex-direction: row; - align-items: flex-start; -} - -.wp-block-navigation-placeholder__controls { - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - display: none; - position: relative; - z-index: 1; - float: left; - width: 100%; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls { - display: flex; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr, .is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr { - display: none; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions { - flex-direction: column; - align-items: flex-start; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr { - display: none; -} -.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon { - margin-right: 12px; - height: 36px; -} - -.wp-block-navigation-placeholder__actions__indicator { - display: flex; - padding: 0 6px 0 0; - align-items: center; - justify-content: flex-start; - line-height: 0; - height: 36px; - margin-left: 4px; -} -.wp-block-navigation-placeholder__actions__indicator svg { - margin-right: 4px; - fill: currentColor; -} - -.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset { - flex-direction: row !important; -} - -.wp-block-navigation-placeholder__actions { - display: flex; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - gap: 6px; - align-items: center; - height: 100%; -} -.wp-block-navigation-placeholder__actions .components-dropdown, -.wp-block-navigation-placeholder__actions > .components-button { - margin-right: 0; -} -.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr { - border: 0; - min-height: 1px; - min-width: 1px; - background-color: #1e1e1e; - margin: auto 0; - height: 100%; - max-height: 16px; -} - -/** - * Mobile menu. - */ -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close { - display: none; - } -} - -.wp-block-navigation__responsive-container.is-menu-open { - position: fixed; - top: 155px; -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - top: 93px; - } -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - left: 36px; - } -} -@media (min-width: 960px) { - .wp-block-navigation__responsive-container.is-menu-open { - left: 160px; - } -} - -@media (min-width: 782px) { - .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; - } -} - -.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; -} - -.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open { - right: 280px; -} - -.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - left: 0; - top: 155px; -} -@media (min-width: 782px) { - .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - top: 61px; - } -} -@media (min-width: 782px) { - .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; - } -} -.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; -} - -body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open { - top: 0; - right: 0; - bottom: 0; - left: 0; -} - -@media (min-width: 600px) { - .wp-block-navigation__responsive-close { - pointer-events: none; - } - .wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close, -.wp-block-navigation__responsive-close .block-editor-block-list__layout * { - pointer-events: all; - } -} -.wp-block-navigation__responsive-close .wp-block-pages-list__item__link { - pointer-events: none; -} - -.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open, -.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close { - padding: 0; - height: auto; - color: inherit; -} - -.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender { - margin-top: 16px; -} - -@keyframes fadein { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.wp-block-navigation .components-spinner { - padding: 8px 12px; -} - -.wp-block-navigation__unsaved-changes { - position: relative; -} -.wp-block-navigation__unsaved-changes .components-spinner { - position: absolute; - top: calc(50% - 16px / 2); - left: calc(50% - 16px / 2); - opacity: 0; - animation: 0.5s linear 2s normal forwards fadein; -} - -@keyframes fadeouthalf { - 0% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.wp-block-navigation__unsaved-changes-overlay.is-saving { - opacity: 1; - animation: 0.5s linear 2s normal forwards fadeouthalf; -} - -.wp-block-navigation-delete-menu-button { - width: 100%; - justify-content: center; - margin-bottom: 16px; -} - -.wp-block-navigation__overlay-menu-preview { - display: flex; - align-items: center; - width: 100%; - background-color: #f0f0f0; - padding: 0 24px; - height: 64px; - margin-bottom: 12px; -} -.wp-block-navigation__overlay-menu-preview.open { - box-shadow: inset 0 0 0 1px #e0e0e0; - outline: 1px solid transparent; - background-color: #fff; -} - -.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty { - display: none; -} - -.wp-block-navigation-placeholder__actions hr + hr { - display: none; -} - -/** - * Submenus. - */ -.wp-block-navigation .has-child { - cursor: pointer; -} -.wp-block-navigation .has-child .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container { - z-index: 29; -} -.wp-block-navigation .has-child.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation .has-child.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - overflow: visible !important; -} - -/** - * Navigation Items. - */ -.wp-block-navigation-item .wp-block-navigation-item__content { - cursor: text; -} -.wp-block-navigation-item.is-editing, .wp-block-navigation-item.is-selected { - min-width: 20px; -} -.wp-block-navigation-item .block-list-appender { - margin-top: 16px; - margin-right: auto; - margin-bottom: 16px; - margin-left: 16px; -} - -.wp-block-navigation-link__invalid-item { - color: #000; -} - -.wp-block-navigation-link__missing_text-tooltip { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; -} - -/** - * Menu item setup state. Is shown when a menu item has no URL configured. - */ -.wp-block-navigation-link__placeholder { - position: relative; - text-decoration: none !important; - box-shadow: none !important; - background-image: none !important; -} -.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: var(--wp-admin-theme-color); - background-image: linear-gradient(45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); - background-position: 0 100%; - background-size: 6px 3px; - background-repeat: repeat-x; - padding-bottom: 0.1em; -} -.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: #fff; -} -.wp-block-navigation-link__placeholder.wp-block-navigation-item__content { - cursor: pointer; -} - -/** -* Link Control Transforms -*/ -.link-control-transform { - border-top: 1px solid #ccc; - padding: 0 16px 8px 16px; -} - -.link-control-transform__subheading { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} - -.link-control-transform__items { - display: flex; - justify-content: space-between; -} - -.link-control-transform__item { - flex-basis: 33%; - flex-direction: column; - gap: 8px; - height: auto; -} - -.wp-block-navigation-submenu { - display: block; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - position: absolute; - left: -1px; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: 100%; - top: -1px; - } - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - right: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } -} - -.block-editor-block-list__block[data-type="core/nextpage"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-nextpage { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-nextpage > span { - font-size: 13px; - position: relative; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; -} -.wp-block-nextpage::before { - content: ""; - position: absolute; - top: calc(50%); - left: 0; - right: 0; - border-top: 3px dashed #ccc; -} - -.wp-block-navigation .wp-block-page-list > div, -.wp-block-navigation .wp-block-page-list { - background-color: inherit; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > div, -.wp-block-navigation.items-justified-space-between .wp-block-page-list { - display: contents; - flex: 1; -} -.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list { - flex: inherit; -} - -.wp-block-pages-list__item__link { - pointer-events: none; -} - -@media (min-width: 600px) { - .wp-block-page-list-modal { - max-width: 480px; - } -} - -.wp-block-page-list-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -.wp-block-page-list .open-on-click:focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-page-list .components-notice { - margin-left: 0; -} - -.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus { - min-height: auto !important; -} - -.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 1; -} - -.block-editor-block-list__block[data-empty=true] + .block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 0; -} - -.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline { - display: inline-block; -} - -.wp-block-pullquote.has-text-align-left p, -.wp-block-pullquote.has-text-align-right p, -.wp-block[data-align=left] > .wp-block-pullquote p, -.wp-block[data-align=right] > .wp-block-pullquote p { - font-size: 20px; -} - -.wp-block-pullquote blockquote p { - font-size: 28px; - line-height: 1.6; -} - -.wp-block-pullquote.is-style-solid-color blockquote p { - font-size: 32px; -} -.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote .wp-block-pullquote__citation { - color: inherit; -} - -.wp-block-rss li a > div { - display: inline; -} - -.wp-block-rss__placeholder-form { - display: flex; - align-items: stretch; -} -.wp-block-rss__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .wp-block-rss__placeholder-form > * { - margin-bottom: 0; - } -} - -.wp-block-rss__placeholder-input { - display: flex; - align-items: stretch; - flex-grow: 1; -} -.wp-block-rss__placeholder-input .components-base-control__field { - margin: 0; - display: flex; - align-items: stretch; - flex-grow: 1; - margin-right: 8px; -} - -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-search .wp-block-search__button { - height: auto; - border-radius: initial; - display: flex; - align-items: center; -} -.wp-block-search__components-button-group { - margin-top: 10px; -} - -.block-editor-block-list__block[data-type="core/separator"] { - padding-top: 0.1px; - padding-bottom: 0.1px; -} -.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots { - background: none !important; -} - -[data-type="core/shortcode"] .block-editor-plain-text { - max-height: 250px; -} -[data-type="core/shortcode"].components-placeholder { - min-height: 0; -} - -.blocks-shortcode__textarea { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .blocks-shortcode__textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .blocks-shortcode__textarea { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.blocks-shortcode__textarea:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.blocks-shortcode__textarea::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.wp-block[data-align=center] > .wp-block-site-logo, -.wp-block-site-logo.aligncenter > div { - display: table; - margin-left: auto; - margin-right: auto; -} - -.wp-block-site-logo a { - pointer-events: none; -} -.wp-block-site-logo .custom-logo-link { - cursor: inherit; -} -.wp-block-site-logo .custom-logo-link:focus { - box-shadow: none; -} -.wp-block-site-logo .custom-logo-link.is-transient img { - opacity: 0.3; -} -.wp-block-site-logo img { - display: block; - height: auto; - max-width: 100%; -} - -.wp-block-site-logo.wp-block-site-logo .components-placeholder, -.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder { - height: 120px; - width: 120px; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder { - display: flex; - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; - color: currentColor; - background: transparent; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - right: 4px; - bottom: 4px; - left: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -.wp-block-site-tagline__placeholder { - padding: 1em 0; - border: 1px dashed; -} - -.wp-block-site-title__placeholder { - padding: 1em 0; - border: 1px dashed; -} - -.wp-block-social-links .wp-social-link { - line-height: 0; -} -.wp-block-social-links .wp-social-link button { - font-size: inherit; - color: currentColor; - height: auto; - line-height: 0; - padding: 0.25em; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link button { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -} - -.wp-block-social-links.is-style-logos-only .wp-social-link button { - padding: 0; -} - -.wp-block-social-links div.block-editor-url-input { - display: inline-block; - margin-left: 8px; -} -.wp-block-social-links.wp-block-social-links { - background: none; -} - -.wp-social-link:hover { - transform: none; -} - -.editor-styles-wrapper .wp-block-social-links { - padding: 0; -} - -.wp-block-social-links__social-placeholder { - display: flex; - opacity: 0.8; - list-style: none; -} -.wp-block-social-links__social-placeholder > .wp-social-link { - padding-left: 0 !important; - margin-left: 0 !important; - padding-right: 0 !important; - margin-right: 0 !important; - width: 0 !important; - visibility: hidden; -} -.wp-block-social-links__social-placeholder > .wp-block-social-links__social-placeholder-icons { - display: flex; -} -.wp-block-social-links__social-placeholder .wp-social-link { - padding: 0.25em; -} -.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link { - padding: 0; -} -.wp-block-social-links__social-placeholder .wp-social-link::before { - content: ""; - display: block; - width: 1em; - height: 1em; - border-radius: 50%; -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link::before { - background: currentColor; -} - -.wp-block-social-links .wp-block-social-links__social-prompt { - min-height: 24px; - list-style: none; - order: 2; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 24px; - margin-top: auto; - margin-bottom: auto; - cursor: default; - padding-right: 8px; -} - -.wp-block[data-align=center] > .wp-block-social-links { - justify-content: center; -} - -.block-editor-block-preview__content .components-button:disabled { - opacity: 1; -} - -.wp-social-link.wp-social-link__is-incomplete { - opacity: 0.5; -} -@media (prefers-reduced-motion: reduce) { - .wp-social-link.wp-social-link__is-incomplete { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.wp-block-social-links .is-selected .wp-social-link__is-incomplete, -.wp-social-link.wp-social-link__is-incomplete:hover, -.wp-social-link.wp-social-link__is-incomplete:focus { - opacity: 1; -} - -.block-editor-block-list__block[data-type="core/spacer"]::before { - content: ""; - display: block; - position: absolute; - z-index: 1; - width: 100%; - min-height: 8px; - min-width: 8px; - height: 100%; -} - -.wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.block-library-spacer__resize-container.has-show-handle { - background: rgba(0, 0, 0, 0.1); -} -.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.is-dark-theme .block-library-spacer__resize-container.has-show-handle { - background: rgba(255, 255, 255, 0.15); -} - -.block-library-spacer__resize-container { - clear: both; -} -.block-library-spacer__resize-container:not(.is-resizing) { - height: 100% !important; - width: 100% !important; -} -.block-library-spacer__resize-container .components-resizable-box__handle::before { - content: none; -} -.block-library-spacer__resize-container.resize-horizontal { - margin-bottom: 0; -} - -.wp-block-table { - margin: 0; -} -.wp-block[data-align=left] > .wp-block-table, .wp-block[data-align=right] > .wp-block-table, .wp-block[data-align=center] > .wp-block-table { - height: auto; -} -.wp-block[data-align=left] > .wp-block-table table, .wp-block[data-align=right] > .wp-block-table table, .wp-block[data-align=center] > .wp-block-table table { - width: auto; -} -.wp-block[data-align=left] > .wp-block-table td, -.wp-block[data-align=left] > .wp-block-table th, .wp-block[data-align=right] > .wp-block-table td, -.wp-block[data-align=right] > .wp-block-table th, .wp-block[data-align=center] > .wp-block-table td, -.wp-block[data-align=center] > .wp-block-table th { - word-break: break-word; -} -.wp-block[data-align=center] > .wp-block-table { - text-align: initial; -} -.wp-block[data-align=center] > .wp-block-table table { - margin: 0 auto; -} -.wp-block-table td, -.wp-block-table th { - border: 1px solid; -} -.wp-block-table td.is-selected, -.wp-block-table th.is-selected { - border-color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - border-style: double; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-table__placeholder-form.blocks-table__placeholder-form { - display: flex; - flex-direction: column; - align-items: flex-start; -} -.blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .blocks-table__placeholder-form.blocks-table__placeholder-form { - flex-direction: row; - align-items: flex-end; - } - .blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 0; - } -} - -.blocks-table__placeholder-input { - width: 112px; - margin-right: 8px; - margin-bottom: 0; -} -.blocks-table__placeholder-input input { - height: 36px; -} -.blocks-table__placeholder-input .components-base-control__field { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-template-part__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-template-part__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-template-part__selection-modal { - height: 70%; - } -} - -.wp-block-text-columns .block-editor-rich-text__editable:focus { - outline: 1px solid #ddd; -} - -.wp-block[data-align=center] > .wp-block-video { - text-align: center; -} - -.wp-block-video { - position: relative; -} -.wp-block-video.is-transient video { - opacity: 0.3; -} -.wp-block-video .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} - -.editor-video-poster-control .components-base-control__label { - display: block; -} -.editor-video-poster-control .components-button { - margin-right: 8px; -} - -.block-library-video-tracks-editor { - z-index: 159990; -} - -.block-library-video-tracks-editor > .components-popover__content { - width: 360px; -} - -.block-library-video-tracks-editor__track-list-track { - display: flex; - place-content: space-between; - align-items: baseline; - padding-left: 12px; -} - -.block-library-video-tracks-editor__single-track-editor-label-language { - display: flex; - margin-top: 12px; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control { - width: 50%; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control:first-child { - margin-right: 16px; -} - -.block-library-video-tracks-editor__single-track-editor-kind-select { - max-width: 240px; -} - -.block-library-video-tracks-editor__single-track-editor-buttons-container { - display: flex; - place-content: space-between; - margin-top: 32px; -} - -.block-library-video-tracks-editor__single-track-editor-edit-track-label { - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - display: block; -} - -.block-library-video-tracks-editor > .components-popover__content > div { - padding: 0; -} - -.block-library-video-tracks-editor__track-list .components-menu-group__label, -.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label { - padding: 0; -} - -.block-library-video-tracks-editor__single-track-editor, -.block-library-video-tracks-editor__track-list, -.block-library-video-tracks-editor__add-tracks-container { - padding: 12px; -} - -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label { - margin-bottom: 4px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field { - margin-bottom: 12px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input { - margin-left: 0; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label { - margin-bottom: 4px; -} - -.editor-styles-wrapper ul.wp-block-post-template { - padding-left: 0; - margin-left: 0; - list-style: none; -} - -.block-library-query-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block-query__create-new-link { - padding: 0 16px 16px 56px; -} - -.block-library-query__pattern-selection-content .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - grid-gap: 8px; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - max-height: 250px; -} - -.block-editor-query-pattern__selection-modal .components-modal__content { - overflow: hidden; - padding: 0; -} -.block-editor-query-pattern__selection-modal .components-modal__content::before { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-query-pattern__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-query-pattern__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-query-pattern__selection-modal { - height: 80%; - width: 80%; - max-height: none; - } -} - -.wp-block[data-align=center] > .wp-block-query-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-query-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-left: 0; - margin-top: 0.5em; - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} - -.wp-block-query-pagination-numbers a { - text-decoration: underline; -} -.wp-block-query-pagination-numbers .page-numbers { - margin-right: 2px; -} -.wp-block-query-pagination-numbers .page-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} - -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder { - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - color: currentColor; - background: transparent; - min-height: 200px; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - right: 4px; - bottom: 4px; - left: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder::before, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button > svg, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder { - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; -} -.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -div[data-type="core/post-featured-image"] img { - max-width: 100%; - height: auto; - display: block; -} - -.wp-block-post-comments__placeholder * { - pointer-events: none; -} - -.wp-block-post-comments-form * { - pointer-events: none; -} -.wp-block-post-comments-form *.block-editor-warning * { - pointer-events: auto; -} - -:root .editor-styles-wrapper { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ -} -:root .editor-styles-wrapper .has-very-light-gray-background-color { - background-color: #eee; -} -:root .editor-styles-wrapper .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .editor-styles-wrapper .has-very-light-gray-color { - color: #eee; -} -:root .editor-styles-wrapper .has-very-dark-gray-color { - color: #313131; -} -:root .editor-styles-wrapper .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(135deg, #00d084 0%, #0693e3 100%); -} -:root .editor-styles-wrapper .has-purple-crush-gradient-background { - background: linear-gradient(135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .editor-styles-wrapper .has-hazy-dawn-gradient-background { - background: linear-gradient(135deg, #faaca8 0%, #dad0ec 100%); -} -:root .editor-styles-wrapper .has-subdued-olive-gradient-background { - background: linear-gradient(135deg, #fafae1 0%, #67a671 100%); -} -:root .editor-styles-wrapper .has-atomic-cream-gradient-background { - background: linear-gradient(135deg, #fdd79a 0%, #004a59 100%); -} -:root .editor-styles-wrapper .has-nightshade-gradient-background { - background: linear-gradient(135deg, #330968 0%, #31cdcf 100%); -} -:root .editor-styles-wrapper .has-midnight-gradient-background { - background: linear-gradient(135deg, #020381 0%, #2874fc 100%); -} - -.editor-styles-wrapper { - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} - -.editor-styles-wrapper .has-regular-font-size { - font-size: 16px; -} - -.editor-styles-wrapper .has-larger-font-size { - font-size: 42px; -} - -.editor-styles-wrapper .has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.editor-styles-wrapper .has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -/** - * Editor Normalization Styles - * - * These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper. - * This allows us to create normalization styles that are easily overridden by editor styles. - *//** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -:root { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} -:root .has-very-light-gray-background-color { - background-color: #eee; -} -:root .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .has-very-light-gray-color { - color: #eee; -} -:root .has-very-dark-gray-color { - color: #313131; -} -:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(135deg, #00d084 0%, #0693e3 100%); -} -:root .has-purple-crush-gradient-background { - background: linear-gradient(135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .has-hazy-dawn-gradient-background { - background: linear-gradient(135deg, #faaca8 0%, #dad0ec 100%); -} -:root .has-subdued-olive-gradient-background { - background: linear-gradient(135deg, #fafae1 0%, #67a671 100%); -} -:root .has-atomic-cream-gradient-background { - background: linear-gradient(135deg, #fdd79a 0%, #004a59 100%); -} -:root .has-nightshade-gradient-background { - background: linear-gradient(135deg, #330968 0%, #31cdcf 100%); -} -:root .has-midnight-gradient-background { - background: linear-gradient(135deg, #020381 0%, #2874fc 100%); -} - -.has-regular-font-size { - font-size: 1em; -} - -.has-larger-font-size { - font-size: 2.625em; -} - -.has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -.has-text-align-center { - text-align: center; -} - -.has-text-align-left { - /*rtl:ignore*/ - text-align: left; -} - -.has-text-align-right { - /*rtl:ignore*/ - text-align: right; -} - -#end-resizable-editor-section { - display: none; -} - -.aligncenter { - clear: both; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -.screen-reader-text { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.screen-reader-text:focus { - background-color: #ddd; - clip: auto !important; - -webkit-clip-path: none; - clip-path: none; - color: #444; - display: block; - font-size: 1em; - height: auto; - left: 5px; - line-height: normal; - padding: 15px 23px 14px; - text-decoration: none; - top: 5px; - width: auto; - z-index: 100000; -} - -/** - * The following provide a simple means of applying a default border style when - * a user first makes a selection in the border block support panel. - * This prevents issues such as where the user could set a border width - * and see no border due there being no border style set. - * - * This is intended to be removed once intelligent defaults can be set while - * making border selections via the block support. - * - * See: https://github.com/WordPress/gutenberg/pull/33743 - */ -html :where(.has-border-color) { - border-style: solid; -} - -html :where([style*="border-width"]) { - border-style: solid; -} - -/** - * Provide baseline responsiveness for images. - */ -html :where(img[class*="wp-image-"]) { - height: auto; - max-width: 100%; -}ul.wp-block-archives{padding-left:2.5em}.wp-block-audio{margin-left:0;margin-right:0;position:relative}.wp-block-audio.is-transient audio{opacity:.3}.wp-block-audio .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.wp-block-avatar__image img{width:100%}.wp-block-avatar.aligncenter .components-resizable-box__container{margin:0 auto}.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container{padding-left:0;padding-right:0}.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow{display:block}.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender{display:none}.wp-block[data-align=center]>.wp-block-button{text-align:center;margin-left:auto;margin-right:auto}.wp-block[data-align=right]>.wp-block-button{ - /*!rtl:ignore*/text-align:right}.wp-block-button{position:relative;cursor:text}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;overflow:hidden;max-width:290px}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}.wp-block-buttons>.wp-block,.wp-block-buttons>.wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button{margin:0}.wp-block-buttons>.block-list-appender{display:inline-flex;align-items:center}.wp-block-buttons.is-vertical>.block-list-appender .block-list-appender__toggle{justify-content:flex-start}.wp-block-buttons>.wp-block-button:focus{box-shadow:none}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center]{margin-left:auto;margin-right:auto;margin-top:0;width:100%}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center] .wp-block-button{margin-bottom:0}.wp-block[data-align=center]>.wp-block-buttons{align-items:center;justify-content:center}.wp-block[data-align=right]>.wp-block-buttons{justify-content:flex-end}.wp-block-categories ul{padding-left:2.5em}.wp-block-categories ul ul{margin-top:6px}.wp-block-columns :where(.wp-block){max-width:none;margin-left:0;margin-right:0}html :where(.wp-block-column){margin-top:0;margin-bottom:0}.wp-block-comment-author-avatar__placeholder{border:1px dashed;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3}.block-library-comments-toolbar__popover .components-popover__content{min-width:230px}.wp-block[data-align=center]>.wp-block-comments-pagination{justify-content:center}.editor-styles-wrapper .wp-block-comments-pagination{max-width:100%}.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout{margin:0}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin:.5em .5em .5em 0}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination-numbers a{text-decoration:underline}.wp-block-comments-pagination-numbers .page-numbers{margin-right:2px}.wp-block-comments-pagination-numbers .page-numbers:last-child{margin-right:0}.wp-block-comments-title.has-background{padding:inherit}.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{min-height:auto!important;padding:0!important}.wp-block-cover.is-placeholder .block-library-cover__resize-container{display:none}.wp-block-cover.is-placeholder .components-placeholder.is-large{min-height:240px;justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder .components-placeholder.is-large+.block-library-cover__resize-container{min-height:240px;display:block}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%,-50%);margin:0}.wp-block-cover .block-editor-block-list__layout{width:100%}.wp-block-cover .wp-block-cover__inner-container{text-align:left;margin-left:0;margin-right:0}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-left:auto}.block-library-cover__resize-container{position:absolute!important;top:0;left:0;right:0;bottom:0;min-height:50px}.block-library-cover__resize-container:not(.is-resizing){height:auto!important}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.wp-block-embed{margin-left:0;margin-right:0;clear:both}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed .components-placeholder__learn-more{margin-top:1em}.block-library-embed__interactive-overlay{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;right:0;bottom:0;left:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em}.wp-block-freeform.block-library-rich-text__tinymce{height:auto}.wp-block-freeform.block-library-rich-text__tinymce li,.wp-block-freeform.block-library-rich-text__tinymce p{line-height:1.8}.wp-block-freeform.block-library-rich-text__tinymce ol,.wp-block-freeform.block-library-rich-text__tinymce ul{padding-left:2.5em;margin-left:0}.wp-block-freeform.block-library-rich-text__tinymce blockquote{margin:0;box-shadow:inset 0 0 0 0 #ddd;border-left:4px solid #000;padding-left:1em}.wp-block-freeform.block-library-rich-text__tinymce pre{white-space:pre-wrap;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;color:#1e1e1e}.wp-block-freeform.block-library-rich-text__tinymce>:first-child{margin-top:0}.wp-block-freeform.block-library-rich-text__tinymce>:last-child{margin-bottom:0}.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce a{color:var(--wp-admin-theme-color)}.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected]{padding:0 2px;margin:0 -2px;border-radius:2px;box-shadow:0 0 0 1px #e5f5fa;background:#e5f5fa}.wp-block-freeform.block-library-rich-text__tinymce code{padding:2px;border-radius:2px;color:#1e1e1e;background:#f0f0f0;font-family:Menlo,Consolas,monaco,monospace;font-size:14px}.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected]{background:#ddd}.wp-block-freeform.block-library-rich-text__tinymce .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-freeform.block-library-rich-text__tinymce .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-freeform.block-library-rich-text__tinymce .aligncenter{display:block;margin-left:auto;margin-right:auto}.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag{width:96%;height:20px;display:block;margin:15px auto;outline:0;cursor:default;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC);background-size:1900px 20px;background-repeat:no-repeat;background-position:50%}.wp-block-freeform.block-library-rich-text__tinymce img::selection{background-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp{-ms-user-select:element}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption{margin:0;max-width:100%}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img{display:block}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption *{-webkit-user-drag:none}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd{padding-top:.5em;margin:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview{width:99.99%;position:relative;clear:both;margin-bottom:16px;border:1px solid transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe{display:block;max-width:100%;background:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim{position:absolute;top:0;right:0;bottom:0;left:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim{display:none}.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder{border:1px dashed #ddd;padding:10px}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error{border:1px solid #ddd;padding:1em 0;margin:0;word-wrap:break-word}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p{margin:0;text-align:center}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder,.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error{border-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons{display:block;margin:0 auto;width:32px;height:32px;font-size:32px}.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery:after{content:"";display:table;clear:both}.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce .gallery a{cursor:default}.wp-block-freeform.block-library-rich-text__tinymce .gallery{margin:auto -6px;padding:6px 0;line-height:1;overflow-x:hidden}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item{float:left;margin:0;text-align:center;padding:6px;box-sizing:border-box}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption,.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon{margin:0}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption{font-size:13px;margin:4px 0}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item{width:100%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item{width:50%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item{width:33.3333333333%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item{width:25%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item{width:20%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item{width:16.6666666667%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item{width:14.2857142857%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item{width:12.5%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item{width:11.1111111111%}.wp-block-freeform.block-library-rich-text__tinymce .gallery img{max-width:100%;height:auto;border:none;padding:0}div[data-type="core/freeform"]:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #ddd;outline:1px solid transparent}@media (prefers-reduced-motion:reduce){div[data-type="core/freeform"]:before{transition-duration:0s;transition-delay:0s}}div[data-type="core/freeform"].is-selected:before{border-color:#1e1e1e}div[data-type="core/freeform"] .block-editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}.mce-toolbar-grp .mce-btn.mce-active:hover button,.mce-toolbar-grp .mce-btn.mce-active:hover i,.mce-toolbar-grp .mce-btn.mce-active button,.mce-toolbar-grp .mce-btn.mce-active i{color:#1e1e1e}.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last{margin-right:0;margin-left:8px}.mce-toolbar-grp .mce-btn i{font-style:normal}.block-library-classic__toolbar{display:none;width:auto;position:sticky;z-index:31;top:0;border:1px solid #ddd;border-bottom:none;border-radius:2px;margin:0 0 8px;padding:0}div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{display:block;border-color:#1e1e1e}.block-library-classic__toolbar .mce-tinymce{box-shadow:none}@media (min-width:600px){.block-library-classic__toolbar{padding:0}}.block-library-classic__toolbar:empty{display:block;background:#f5f5f5;border-bottom:1px solid #e2e4e7}.block-library-classic__toolbar:empty:before{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;content:attr(data-placeholder);color:#555d66;line-height:37px;padding:14px}.block-library-classic__toolbar div.mce-toolbar-grp{border-bottom:1px solid #1e1e1e}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar .mce-menubar>div,.block-library-classic__toolbar .mce-tinymce-inline,.block-library-classic__toolbar .mce-tinymce-inline>div,.block-library-classic__toolbar div.mce-toolbar-grp,.block-library-classic__toolbar div.mce-toolbar-grp>div{height:auto!important;width:100%!important}.block-library-classic__toolbar .mce-container-body.mce-abs-layout{overflow:visible}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar div.mce-toolbar-grp{position:static}.block-library-classic__toolbar .mce-toolbar-grp>div{padding:1px 3px}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar,figure.wp-block-gallery{display:block}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{position:absolute;top:0;right:5px}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.gallery-settings-buttons .components-button:first-child{margin-right:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{display:flex;align-items:center;color:#757575;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 8px 0 4px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{padding:0;width:inherit;height:inherit}}.block-library-gallery-item__inline-menu.is-left{left:-2px}.block-library-gallery-item__inline-menu.is-right{right:-2px}.wp-block-gallery ul.blocks-gallery-grid{padding:0;margin:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-group .block-editor-block-list__insertion-point{left:0;right:0}[data-type="core/group"].is-selected .block-list-appender{margin-left:0;margin-right:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-top:18px;margin-bottom:18px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child{gap:inherit;pointer-events:none}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{display:inherit;width:100%;flex-direction:inherit;flex:1}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child:after{content:"";display:flex;border:1px dashed;opacity:.4;border-radius:2px;flex:1;pointer-events:none;min-height:48px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{pointer-events:all}.block-library-html__edit .block-library-html__preview-overlay{position:absolute;width:100%;height:100%;top:0;left:0}.block-library-html__edit .block-editor-plain-text{font-family:Menlo,Consolas,monaco,monospace!important;color:#1e1e1e!important;background:#fff!important;padding:12px!important;border:1px solid #1e1e1e!important;box-shadow:none!important;border-radius:2px!important;max-height:250px;font-size:16px!important}@media (min-width:600px){.block-library-html__edit .block-editor-plain-text{font-size:13px!important}}.block-library-html__edit .block-editor-plain-text:focus{border-color:var(--wp-admin-theme-color)!important;box-shadow:0 0 0 1px var(--wp-admin-theme-color)!important;outline:2px solid transparent!important}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.wp-block-image:not(.is-style-rounded)>div:not(.components-placeholder){border-radius:inherit}.wp-block-image .components-resizable-box__container{display:inline-block}.wp-block-image .components-resizable-box__container img{display:block;width:inherit;height:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{position:absolute;left:0;right:0;margin:-1px 0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{display:table-caption;caption-side:bottom}.wp-block[data-align=left]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=right]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{position:relative;max-width:100%;width:100%}.wp-block-image__crop-icon{padding:0 8px;min-width:48px;display:flex;justify-content:center;align-items:center}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{overflow:visible;min-width:260px}.wp-block-image__zoom .components-range-control{flex:1}.wp-block-image__zoom .components-base-control__field{display:flex;margin-bottom:0;flex-direction:column;align-items:flex-start}.wp-block-image__aspect-ratio{height:46px;margin-bottom:-8px;display:flex;align-items:center}.wp-block-image__aspect-ratio .components-button{width:36px;padding-left:0;padding-right:0}.wp-block-latest-posts{padding-left:2.5em}.wp-block-latest-posts.is-grid{padding-left:0}.wp-block-latest-posts li a>div{display:inline}.edit-post-visual-editor .wp-block-latest-posts.is-grid li{margin-bottom:20px}.editor-latest-posts-image-alignment-control .components-base-control__label{display:block}.editor-latest-posts-image-alignment-control .components-toolbar{border-radius:2px}.wp-block-media-text__media{position:relative}.wp-block-media-text__media.is-transient img{opacity:.3}.wp-block-media-text__media .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.wp-block-media-text .__resizable_base__{grid-column:1/span 2;grid-row:2}.wp-block-media-text .editor-media-container__resizer{width:100%!important}.wp-block-media-text.is-image-fill .editor-media-container__resizer{height:100%!important}.wp-block-media-text>.block-editor-block-list__layout>.block-editor-block-list__block{max-width:unset}.block-editor-block-list__block[data-type="core/more"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-more{display:block;text-align:center;white-space:nowrap}.wp-block-more input[type=text]{position:relative;font-size:13px;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border:none;box-shadow:none;white-space:nowrap;text-align:center;margin:0;border-radius:4px;background:#fff;padding:6px 8px;height:24px;max-width:100%}.wp-block-more input[type=text]:focus{box-shadow:none}.wp-block-more:before{content:"";position:absolute;top:50%;left:0;right:0;border-top:3px dashed #ccc}.editor-styles-wrapper .wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-left:0;padding-left:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation__container.is-parent-of-selected-block{visibility:visible;opacity:1;overflow:visible}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{visibility:visible;opacity:1;display:flex;flex-direction:column}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{color:#fff;background:#1e1e1e;padding:0;width:24px;border-radius:2px;margin-right:0;margin-left:auto}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{height:30px;position:relative;margin:0 auto;padding:3px;display:flex;align-items:center;border-radius:4px}.block-library-colors-selector .block-library-colors-selector__state-selection{margin-left:auto;margin-right:auto;border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);width:22px;min-width:22px;height:22px;min-height:22px;line-height:20px;padding:2px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:right;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{outline:none;padding:0;box-shadow:none;background:none;min-height:0;color:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder .components-spinner{margin-top:0}.wp-block-navigation-placeholder__preview{display:flex;align-items:center;min-width:96px;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:currentColor;background:transparent}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-navigation-placeholder__preview>svg{fill:currentColor;opacity:.4}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{padding:6px 8px;flex-direction:row;align-items:flex-start}.wp-block-navigation-placeholder__controls{border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;display:none;position:relative;z-index:1;float:left;width:100%}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{display:flex}.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{display:none}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{flex-direction:column;align-items:flex-start}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{margin-right:12px;height:36px}.wp-block-navigation-placeholder__actions__indicator{display:flex;padding:0 6px 0 0;align-items:center;justify-content:flex-start;line-height:0;height:36px;margin-left:4px}.wp-block-navigation-placeholder__actions__indicator svg{margin-right:4px;fill:currentColor}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{display:flex;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;gap:6px;align-items:center;height:100%}.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{margin-right:0}.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{border:0;min-height:1px;min-width:1px;background-color:#1e1e1e;margin:auto 0;height:100%;max-height:16px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{top:93px;left:36px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{left:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{right:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{left:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}}@media (min-width:782px){.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:109px}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{top:0;right:0;bottom:0;left:0}@media (min-width:600px){.wp-block-navigation__responsive-close{pointer-events:none}.wp-block-navigation__responsive-close .block-editor-block-list__layout *,.wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close{pointer-events:all}}.wp-block-navigation__responsive-close .wp-block-pages-list__item__link{pointer-events:none}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{padding:0;height:auto;color:inherit}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation .components-spinner{padding:8px 12px}.wp-block-navigation__unsaved-changes{position:relative}.wp-block-navigation__unsaved-changes .components-spinner{position:absolute;top:calc(50% - 8px);left:calc(50% - 8px);opacity:0;animation:fadein .5s linear 2s normal forwards}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation__unsaved-changes-overlay.is-saving{opacity:1;animation:fadeouthalf .5s linear 2s normal forwards}.wp-block-navigation-delete-menu-button{width:100%;justify-content:center;margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{display:flex;align-items:center;width:100%;background-color:#f0f0f0;padding:0 24px;height:64px;margin-bottom:12px}.wp-block-navigation__overlay-menu-preview.open{box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent;background-color:#fff}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;overflow:visible!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px auto 16px 16px}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden}.wp-block-navigation-link__placeholder{position:relative;text-decoration:none!important;box-shadow:none!important;background-image:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:0 100%;background-size:6px 3px;background-repeat:repeat-x;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;position:absolute;left:-1px;top:100%}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{content:"";position:absolute;right:100%;height:100%;display:block;width:.5em;background:transparent}}.block-editor-block-list__block[data-type="core/nextpage"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-nextpage{display:block;text-align:center;white-space:nowrap}.wp-block-nextpage>span{font-size:13px;position:relative;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border-radius:4px;background:#fff;padding:6px 8px;height:24px}.wp-block-nextpage:before{content:"";position:absolute;top:50%;left:0;right:0;border-top:3px dashed #ccc}.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{visibility:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-page-list .components-notice{margin-left:0}.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:0}.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline{display:inline-block}.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p,.wp-block[data-align=left]>.wp-block-pullquote p,.wp-block[data-align=right]>.wp-block-pullquote p{font-size:20px}.wp-block-pullquote blockquote p{font-size:28px;line-height:1.6}.wp-block-pullquote.is-style-solid-color blockquote p{font-size:32px}.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation{text-transform:none;font-style:normal}.wp-block-pullquote .wp-block-pullquote__citation{color:inherit}.wp-block-rss li a>div{display:inline}.wp-block-rss__placeholder-form{display:flex;align-items:stretch}.wp-block-rss__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.wp-block-rss__placeholder-form>*{margin-bottom:0}}.wp-block-rss__placeholder-input{display:flex;align-items:stretch;flex-grow:1}.wp-block-rss__placeholder-input .components-base-control__field{display:flex;align-items:stretch;flex-grow:1;margin:0 8px 0 0}.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{height:auto;border-radius:initial;display:flex;align-items:center}.wp-block-search__components-button-group{margin-top:10px}.block-editor-block-list__block[data-type="core/separator"]{padding-top:.1px;padding-bottom:.1px}.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots{background:none!important}[data-type="core/shortcode"] .block-editor-plain-text{max-height:250px}[data-type="core/shortcode"].components-placeholder{min-height:0}.blocks-shortcode__textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.blocks-shortcode__textarea{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.blocks-shortcode__textarea{font-size:13px;line-height:normal}}.blocks-shortcode__textarea:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.blocks-shortcode__textarea::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.blocks-shortcode__textarea::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.blocks-shortcode__textarea:-ms-input-placeholder{color:rgba(30,30,30,.62)}.wp-block-site-logo.aligncenter>div,.wp-block[data-align=center]>.wp-block-site-logo{display:table;margin-left:auto;margin-right:auto}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{display:flex;justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}.wp-block-site-tagline__placeholder,.wp-block-site-title__placeholder{padding:1em 0;border:1px dashed}.wp-block-social-links .wp-social-link{line-height:0}.wp-block-social-links .wp-social-link button{font-size:inherit;color:currentColor;height:auto;line-height:0;padding:.25em}.wp-block-social-links.is-style-pill-shape .wp-social-link button{padding-left:.66667em;padding-right:.66667em}.wp-block-social-links.is-style-logos-only .wp-social-link button{padding:0}.wp-block-social-links div.block-editor-url-input{display:inline-block;margin-left:8px}.wp-block-social-links.wp-block-social-links{background:none}.wp-social-link:hover{transform:none}.editor-styles-wrapper .wp-block-social-links{padding:0}.wp-block-social-links__social-placeholder{display:flex;opacity:.8;list-style:none}.wp-block-social-links__social-placeholder>.wp-social-link{padding-left:0!important;margin-left:0!important;padding-right:0!important;margin-right:0!important;width:0!important;visibility:hidden}.wp-block-social-links__social-placeholder>.wp-block-social-links__social-placeholder-icons{display:flex}.wp-block-social-links__social-placeholder .wp-social-link{padding:.25em}.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link{padding-left:.66667em;padding-right:.66667em}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link{padding:0}.wp-block-social-links__social-placeholder .wp-social-link:before{content:"";display:block;width:1em;height:1em;border-radius:50%}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link:before{background:currentColor}.wp-block-social-links .wp-block-social-links__social-prompt{min-height:24px;list-style:none;order:2;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:24px;margin-top:auto;margin-bottom:auto;cursor:default;padding-right:8px}.wp-block[data-align=center]>.wp-block-social-links{justify-content:center}.block-editor-block-preview__content .components-button:disabled{opacity:1}.wp-social-link.wp-social-link__is-incomplete{opacity:.5}@media (prefers-reduced-motion:reduce){.wp-social-link.wp-social-link__is-incomplete{transition-duration:0s;transition-delay:0s}}.wp-block-social-links .is-selected .wp-social-link__is-incomplete,.wp-social-link.wp-social-link__is-incomplete:focus,.wp-social-link.wp-social-link__is-incomplete:hover{opacity:1}.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;position:absolute;z-index:1;width:100%;min-height:8px;min-width:8px;height:100%}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:rgba(0,0,0,.1)}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:hsla(0,0%,100%,.15)}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0}.wp-block-table{margin:0}.wp-block[data-align=center]>.wp-block-table,.wp-block[data-align=left]>.wp-block-table,.wp-block[data-align=right]>.wp-block-table{height:auto}.wp-block[data-align=center]>.wp-block-table table,.wp-block[data-align=left]>.wp-block-table table,.wp-block[data-align=right]>.wp-block-table table{width:auto}.wp-block[data-align=center]>.wp-block-table td,.wp-block[data-align=center]>.wp-block-table th,.wp-block[data-align=left]>.wp-block-table td,.wp-block[data-align=left]>.wp-block-table th,.wp-block[data-align=right]>.wp-block-table td,.wp-block[data-align=right]>.wp-block-table th{word-break:break-word}.wp-block[data-align=center]>.wp-block-table{text-align:initial}.wp-block[data-align=center]>.wp-block-table table{margin:0 auto}.wp-block-table td,.wp-block-table th{border:1px solid}.wp-block-table td.is-selected,.wp-block-table th.is-selected{border-color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);border-style:double}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.blocks-table__placeholder-form.blocks-table__placeholder-form{display:flex;flex-direction:column;align-items:flex-start}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.blocks-table__placeholder-form.blocks-table__placeholder-form{flex-direction:row;align-items:flex-end}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:0}}.blocks-table__placeholder-input{width:112px;margin-right:8px;margin-bottom:0}.blocks-table__placeholder-input input{height:36px}.blocks-table__placeholder-input .components-base-control__field{margin-bottom:0}@media (min-width:600px){.block-editor-template-part__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-template-part__selection-modal{width:750px}}@media (min-width:960px){.block-editor-template-part__selection-modal{height:70%}}.wp-block-text-columns .block-editor-rich-text__editable:focus{outline:1px solid #ddd}.wp-block[data-align=center]>.wp-block-video{text-align:center}.wp-block-video{position:relative}.wp-block-video.is-transient video{opacity:.3}.wp-block-video .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.editor-video-poster-control .components-base-control__label{display:block}.editor-video-poster-control .components-button{margin-right:8px}.block-library-video-tracks-editor{z-index:159990}.block-library-video-tracks-editor>.components-popover__content{width:360px}.block-library-video-tracks-editor__track-list-track{display:flex;place-content:space-between;align-items:baseline;padding-left:12px}.block-library-video-tracks-editor__single-track-editor-label-language{display:flex;margin-top:12px}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control{width:50%}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control:first-child{margin-right:16px}.block-library-video-tracks-editor__single-track-editor-kind-select{max-width:240px}.block-library-video-tracks-editor__single-track-editor-buttons-container{display:flex;place-content:space-between;margin-top:32px}.block-library-video-tracks-editor__single-track-editor-edit-track-label{margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;display:block}.block-library-video-tracks-editor>.components-popover__content>div,.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label,.block-library-video-tracks-editor__track-list .components-menu-group__label{padding:0}.block-library-video-tracks-editor__add-tracks-container,.block-library-video-tracks-editor__single-track-editor,.block-library-video-tracks-editor__track-list{padding:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label{margin-bottom:4px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field{margin-bottom:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input{margin-left:0}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label{margin-bottom:4px}.editor-styles-wrapper ul.wp-block-post-template{padding-left:0;margin-left:0;list-style:none}.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 16px 16px 56px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-editor-query-pattern__selection-modal .components-modal__content{overflow:hidden;padding:0}.block-editor-query-pattern__selection-modal .components-modal__content:before{margin-bottom:0}@media (min-width:600px){.block-editor-query-pattern__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-query-pattern__selection-modal{width:750px}}@media (min-width:960px){.block-editor-query-pattern__selection-modal{height:80%;width:80%;max-height:none}}.wp-block[data-align=center]>.wp-block-query-pagination{justify-content:center}.editor-styles-wrapper .wp-block-query-pagination{max-width:100%}.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout{margin:0}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin:.5em .5em .5em 0}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination-numbers a{text-decoration:underline}.wp-block-query-pagination-numbers .page-numbers{margin-right:2px}.wp-block-query-pagination-numbers .page-numbers:last-child{margin-right:0}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.wp-block-post-comments-form *,.wp-block-post-comments__placeholder *{pointer-events:none}.wp-block-post-comments-form .block-editor-warning *{pointer-events:auto}:root .editor-styles-wrapper .has-very-light-gray-background-color{background-color:#eee}:root .editor-styles-wrapper .has-very-dark-gray-background-color{background-color:#313131}:root .editor-styles-wrapper .has-very-light-gray-color{color:#eee}:root .editor-styles-wrapper .has-very-dark-gray-color{color:#313131}:root .editor-styles-wrapper .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .editor-styles-wrapper .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .editor-styles-wrapper .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .editor-styles-wrapper .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .editor-styles-wrapper .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .editor-styles-wrapper .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .editor-styles-wrapper .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}.editor-styles-wrapper{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}.editor-styles-wrapper .has-regular-font-size{font-size:16px}.editor-styles-wrapper .has-larger-font-size{font-size:42px}.editor-styles-wrapper .has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.editor-styles-wrapper .has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -ul.wp-block-archives { - padding-right: 2.5em; -} - -.wp-block-audio { - margin-right: 0; - margin-left: 0; - position: relative; -} -.wp-block-audio.is-transient audio { - opacity: 0.3; -} -.wp-block-audio .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -.wp-block-avatar__image img { - width: 100%; -} - -.wp-block-avatar.aligncenter .components-resizable-box__container { - margin: 0 auto; -} - -.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container { - padding-right: 0; - padding-left: 0; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow { - display: block; -} -.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender { - display: none; -} - -.wp-block[data-align=center] > .wp-block-button { - text-align: center; - margin-right: auto; - margin-left: auto; -} - -.wp-block[data-align=right] > .wp-block-button { - text-align: right; -} - -.wp-block-button { - position: relative; - cursor: text; -} -.wp-block-button:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: -2px; -} -.wp-block-button[data-rich-text-placeholder]::after { - opacity: 0.8; -} - -.wp-block-button__inline-link { - color: #757575; - height: 0; - overflow: hidden; - max-width: 290px; -} -.wp-block-button__inline-link-input__suggestions { - max-width: 290px; -} -@media (min-width: 782px) { - .wp-block-button__inline-link { - max-width: 260px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 260px; - } -} -@media (min-width: 960px) { - .wp-block-button__inline-link { - max-width: 290px; - } - .wp-block-button__inline-link-input__suggestions { - max-width: 290px; - } -} -.is-selected .wp-block-button__inline-link { - height: auto; - overflow: visible; -} - -.wp-button-label__width .components-button-group { - display: block; -} -.wp-button-label__width .components-base-control__field { - margin-bottom: 12px; -} - -div[data-type="core/button"] { - display: table; -} - -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons > .wp-block { - margin: 0; -} -.wp-block-buttons > .wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button { - margin: 0; -} -.wp-block-buttons > .block-list-appender { - display: inline-flex; - align-items: center; -} -.wp-block-buttons.is-vertical > .block-list-appender .block-list-appender__toggle { - justify-content: flex-start; -} -.wp-block-buttons > .wp-block-button:focus { - box-shadow: none; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] { - /* stylelint-enable indentation */ - margin-right: auto; - margin-left: auto; - margin-top: 0; - width: 100%; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block[data-align=center] .wp-block-button { - margin-bottom: 0; -} - -.wp-block[data-align=center] > .wp-block-buttons { - align-items: center; - justify-content: center; -} - -.wp-block[data-align=right] > .wp-block-buttons { - justify-content: flex-end; -} - -.wp-block-categories ul { - padding-right: 2.5em; -} -.wp-block-categories ul ul { - margin-top: 6px; -} - -.wp-block-columns :where(.wp-block) { - max-width: none; - margin-right: 0; - margin-left: 0; -} - -html :where(.wp-block-column) { - margin-top: 0; - margin-bottom: 0; -} - -.wp-block-comment-author-avatar__placeholder { - border: currentColor 1px dashed; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; -} - -.block-library-comments-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block[data-align=center] > .wp-block-comments-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-comments-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - margin-right: 0; - margin-top: 0.5em; - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - margin-right: 0; -} - -.wp-block-comments-pagination-numbers a { - text-decoration: underline; -} -.wp-block-comments-pagination-numbers .page-numbers { - margin-left: 2px; -} -.wp-block-comments-pagination-numbers .page-numbers:last-child { - margin-right: 0; -} - -.wp-block-comments-title.has-background { - padding: inherit; -} - -.wp-block-cover { - /* Extra specificity needed because the reset.css applied in the editor context is overriding this rule. */ -} -.editor-styles-wrapper .wp-block-cover { - box-sizing: border-box; -} -.wp-block-cover.is-placeholder { - min-height: auto !important; - padding: 0 !important; -} -.wp-block-cover.is-placeholder .block-library-cover__resize-container { - display: none; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large { - min-height: 240px; - justify-content: flex-start; - z-index: 1; -} -.wp-block-cover.is-placeholder .components-placeholder.is-large + .block-library-cover__resize-container { - min-height: 240px; - display: block; -} -.wp-block-cover.components-placeholder h2 { - color: inherit; -} -.wp-block-cover.is-transient::before { - background-color: #fff; - opacity: 0.3; -} -.wp-block-cover .components-spinner { - position: absolute; - z-index: 1; - top: 50%; - right: 50%; - transform: translate(50%, -50%); - margin: 0; -} -.wp-block-cover .block-editor-block-list__layout { - width: 100%; -} -.wp-block-cover .wp-block-cover__inner-container { - text-align: right; - margin-right: 0; - margin-left: 0; -} -.wp-block-cover .wp-block-cover__placeholder-background-options { - width: 100%; -} - -[data-align=left] > .wp-block-cover, -[data-align=right] > .wp-block-cover { - max-width: 420px; - width: 100%; -} - -.block-library-cover__reset-button { - margin-right: auto; -} - -.block-library-cover__resize-container { - position: absolute !important; - top: 0; - right: 0; - left: 0; - bottom: 0; - min-height: 50px; -} - -.block-library-cover__resize-container:not(.is-resizing) { - height: auto !important; -} - -.wp-block-cover > .components-drop-zone .components-drop-zone__content { - opacity: 0.8 !important; -} - -.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover { - background-attachment: scroll; -} - -.wp-block-embed { - margin-right: 0; - margin-left: 0; - clear: both; -} -.wp-block-embed.is-loading { - display: flex; - justify-content: center; -} -.wp-block-embed .components-placeholder__error { - word-break: break-word; -} -.wp-block-embed .components-placeholder__learn-more { - margin-top: 1em; -} - -.block-library-embed__interactive-overlay { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - opacity: 0; -} - -.wp-block[data-align=left] > .wp-block-embed, -.wp-block[data-align=right] > .wp-block-embed { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > .wp-block-embed .wp-block-embed__wrapper, -.wp-block[data-align=right] > .wp-block-embed .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-file { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - align-items: center; - margin-bottom: 0; -} -.wp-block[data-align=left] > .wp-block-file, .wp-block[data-align=right] > .wp-block-file { - height: auto; -} -.wp-block-file .components-resizable-box__container { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__preview { - margin-bottom: 1em; - width: 100%; - height: 100%; -} -.wp-block-file .wp-block-file__preview-overlay { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; -} -.wp-block-file .wp-block-file__content-wrapper { - flex-grow: 1; -} -.wp-block-file a { - min-width: 1em; -} -.wp-block-file .wp-block-file__button-richtext-wrapper { - display: inline-block; - margin-right: 0.75em; -} - -.wp-block-freeform.block-library-rich-text__tinymce { - height: auto; - /* Allow height of embed iframes to be calculated properly */ - /* Remove blue highlighting of selected images in WebKit */ - /* Image captions */ - /* WP Views */ -} -.wp-block-freeform.block-library-rich-text__tinymce p, -.wp-block-freeform.block-library-rich-text__tinymce li { - line-height: 1.8; -} -.wp-block-freeform.block-library-rich-text__tinymce ul, -.wp-block-freeform.block-library-rich-text__tinymce ol { - padding-right: 2.5em; - margin-right: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce blockquote { - margin: 0; - box-shadow: inset 0 0 0 0 #ddd; - border-right: 4px solid #000; - padding-right: 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce pre { - white-space: pre-wrap; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - color: #1e1e1e; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:first-child { - margin-top: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce > *:last-child { - margin-bottom: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce a { - color: var(--wp-admin-theme-color); -} -.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected] { - padding: 0 2px; - margin: 0 -2px; - border-radius: 2px; - box-shadow: 0 0 0 1px #e5f5fa; - background: #e5f5fa; -} -.wp-block-freeform.block-library-rich-text__tinymce code { - padding: 2px; - border-radius: 2px; - color: #1e1e1e; - background: #f0f0f0; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 14px; -} -.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected] { - background: #ddd; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignright { - float: right; - margin: 0.5em 0 0.5em 1em; -} -.wp-block-freeform.block-library-rich-text__tinymce .alignleft { - float: left; - margin: 0.5em 1em 0.5em 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .aligncenter { - display: block; - margin-right: auto; - margin-left: auto; -} -.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag { - width: 96%; - height: 20px; - display: block; - margin: 15px auto; - outline: 0; - cursor: default; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC); - background-size: 1900px 20px; - background-repeat: no-repeat; - background-position: center; -} -.wp-block-freeform.block-library-rich-text__tinymce img::selection { - background-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp { - -ms-user-select: element; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption { - margin: 0; - /* dl browser reset */ - max-width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a, -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img { - display: block; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption, .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * { - -webkit-user-drag: none; -} -.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd { - padding-top: 0.5em; - margin: 0; - /* browser dd reset */ -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview { - width: 99.99%; - /* All IE need hasLayout, incl. 11 (ugh, not again!!) */ - position: relative; - clear: both; - margin-bottom: 16px; - border: 1px solid transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe { - display: block; - max-width: 100%; - background: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim { - display: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder { - border: 1px dashed #ddd; - padding: 10px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error { - border: 1px solid #ddd; - padding: 1em 0; - margin: 0; - word-wrap: break-word; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p { - margin: 0; - text-align: center; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder, .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error { - border-color: transparent; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons { - display: block; - margin: 0 auto; - width: 32px; - height: 32px; - font-size: 32px; -} -.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery::after { - content: ""; - display: table; - clear: both; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus { - outline: none; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery a { - cursor: default; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery { - margin: auto -6px; - padding: 6px 0; - line-height: 1; - overflow-x: hidden; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item { - float: right; - margin: 0; - text-align: center; - padding: 6px; - box-sizing: border-box; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption, -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon { - margin: 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption { - font-size: 13px; - margin: 4px 0; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item { - width: 100%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item { - width: 50%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item { - width: 33.3333333333%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item { - width: 25%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item { - width: 20%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item { - width: 16.6666666667%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item { - width: 14.2857142857%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item { - width: 12.5%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item { - width: 11.1111111111%; -} -.wp-block-freeform.block-library-rich-text__tinymce .gallery img { - max-width: 100%; - height: auto; - border: none; - padding: 0; -} - -div[data-type="core/freeform"]::before { - transition: border-color 0.1s linear, box-shadow 0.1s linear; - border: 1px solid #ddd; - outline: 1px solid transparent; -} -@media (prefers-reduced-motion: reduce) { - div[data-type="core/freeform"]::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -div[data-type="core/freeform"].is-selected::before { - border-color: #1e1e1e; -} -div[data-type="core/freeform"] .block-editor-block-contextual-toolbar + div { - margin-top: 0; - padding-top: 0; -} -div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce::after { - content: ""; - display: table; - clear: both; -} - -.mce-toolbar-grp .mce-btn.mce-active button, -.mce-toolbar-grp .mce-btn.mce-active:hover button, -.mce-toolbar-grp .mce-btn.mce-active i, -.mce-toolbar-grp .mce-btn.mce-active:hover i { - color: #1e1e1e; -} -.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last { - margin-left: 0; - margin-right: 8px; -} -.mce-toolbar-grp .mce-btn i { - font-style: normal; -} - -.block-library-classic__toolbar { - display: none; - width: auto; - margin: 0; - position: sticky; - z-index: 31; - top: 0; - border: 1px solid #ddd; - border-bottom: none; - border-radius: 2px; - margin-bottom: 8px; - padding: 0; -} -div[data-type="core/freeform"].is-selected .block-library-classic__toolbar { - display: block; - border-color: #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce { - box-shadow: none; -} -@media (min-width: 600px) { - .block-library-classic__toolbar { - padding: 0; - } -} -.block-library-classic__toolbar:empty { - display: block; - background: #f5f5f5; - border-bottom: 1px solid #e2e4e7; -} -.block-library-classic__toolbar:empty::before { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - content: attr(data-placeholder); - color: #555d66; - line-height: 37px; - padding: 14px; -} -.block-library-classic__toolbar div.mce-toolbar-grp { - border-bottom: 1px solid #1e1e1e; -} -.block-library-classic__toolbar .mce-tinymce-inline, -.block-library-classic__toolbar .mce-tinymce-inline > div, -.block-library-classic__toolbar div.mce-toolbar-grp, -.block-library-classic__toolbar div.mce-toolbar-grp > div, -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar .mce-menubar > div { - height: auto !important; - width: 100% !important; -} -.block-library-classic__toolbar .mce-container-body.mce-abs-layout { - overflow: visible; -} -.block-library-classic__toolbar .mce-menubar, -.block-library-classic__toolbar div.mce-toolbar-grp { - position: static; -} -.block-library-classic__toolbar .mce-toolbar-grp > div { - padding: 1px 3px; -} -.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { - display: none; -} -.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { - display: block; -} - -figure.wp-block-gallery { - display: block; -} -figure.wp-block-gallery.has-nested-images .components-drop-zone { - display: none; - pointer-events: none; -} -figure.wp-block-gallery > .blocks-gallery-caption { - flex: 0 0 100%; -} -figure.wp-block-gallery > .blocks-gallery-media-placeholder-wrapper { - flex-basis: 100%; -} -figure.wp-block-gallery .wp-block-image .components-notice.is-error { - display: block; -} -figure.wp-block-gallery .wp-block-image .components-notice__content { - margin: 4px 0; -} -figure.wp-block-gallery .wp-block-image .components-notice__dismiss { - position: absolute; - top: 0; - left: 5px; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label { - display: none; -} -figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button { - margin-bottom: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder { - margin: 0; -} -figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} -figure.wp-block-gallery .block-editor-media-placeholder figcaption { - z-index: 2; -} -figure.wp-block-gallery .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -/** - * Gallery inspector controls settings. - */ -.gallery-settings-buttons .components-button:first-child { - margin-left: 8px; -} - -.gallery-image-sizes .components-base-control__label { - display: block; - margin-bottom: 4px; -} -.gallery-image-sizes .gallery-image-sizes__loading { - display: flex; - align-items: center; - color: #757575; - font-size: 12px; -} -.gallery-image-sizes .components-spinner { - margin: 0 4px 0 8px; -} - -/** - * Deprecated css past this point. This can be removed once all galleries are migrated - * to V2. - */ -.blocks-gallery-item figure:not(.is-selected):focus, -.blocks-gallery-item img:focus { - outline: none; -} -.blocks-gallery-item figure.is-selected::before { - box-shadow: 0 0 0 1px #fff inset, 0 0 0 3px var(--wp-admin-theme-color) inset; - content: ""; - outline: 2px solid transparent; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 1; - pointer-events: none; -} -.blocks-gallery-item figure.is-transient img { - opacity: 0.3; -} -.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu { - display: inline-flex; -} -.blocks-gallery-item .block-editor-media-placeholder { - margin: 0; - height: 100%; -} -.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label { - display: flex; -} - -.block-library-gallery-item__inline-menu { - display: none; - position: absolute; - top: -2px; - margin: 8px; - z-index: 20; - transition: box-shadow 0.2s ease-out; - border-radius: 2px; - background: #fff; - border: 1px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .block-library-gallery-item__inline-menu { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-library-gallery-item__inline-menu:hover { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu { - padding: 2px; - } -} -.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus) { - border: none; - box-shadow: none; -} -@media (min-width: 600px) { - .columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon, .columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon { - padding: 0; - width: inherit; - height: inherit; - } -} -.block-library-gallery-item__inline-menu.is-left { - right: -2px; -} -.block-library-gallery-item__inline-menu.is-right { - left: -2px; -} - -.wp-block-gallery ul.blocks-gallery-grid { - padding: 0; - margin: 0; -} - -@media (min-width: 600px) { - .wp-block-update-gallery-modal { - max-width: 480px; - } -} - -.wp-block-update-gallery-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -/** - * Group: All Alignment Settings - */ -.wp-block-group .block-editor-block-list__insertion-point { - right: 0; - left: 0; -} - -[data-type="core/group"].is-selected .block-list-appender { - margin-right: 0; - margin-left: 0; -} -[data-type="core/group"].is-selected .has-background .block-list-appender { - margin-top: 18px; - margin-bottom: 18px; -} - -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child { - gap: inherit; - pointer-events: none; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content, -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - display: inherit; - width: 100%; - flex-direction: inherit; - flex: 1; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child::after { - content: ""; - display: flex; - border: 1px dashed currentColor; - opacity: 0.4; - border-radius: 2px; - flex: 1; - pointer-events: none; - min-height: 48px; -} -.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter { - pointer-events: all; -} - -.block-library-html__edit .block-library-html__preview-overlay { - position: absolute; - width: 100%; - height: 100%; - top: 0; - right: 0; -} -.block-library-html__edit .block-editor-plain-text { - font-family: Menlo, Consolas, monaco, monospace !important; - color: #1e1e1e !important; - background: #fff !important; - padding: 12px !important; - border: 1px solid #1e1e1e !important; - box-shadow: none !important; - border-radius: 2px !important; - max-height: 250px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (min-width: 600px) { - .block-library-html__edit .block-editor-plain-text { - font-size: 13px !important; - } -} -.block-library-html__edit .block-editor-plain-text:focus { - border-color: var(--wp-admin-theme-color) !important; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) !important; - outline: 2px solid transparent !important; -} - -figure.wp-block-image:not(.wp-block) { - margin: 0; -} - -.wp-block-image { - position: relative; -} -.wp-block-image .is-applying img, .wp-block-image.is-transient img { - opacity: 0.3; -} -.wp-block-image figcaption img { - display: inline; -} -.wp-block-image .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} -.wp-block-image:not(.is-style-rounded) > div:not(.components-placeholder) { - border-radius: inherit; -} - -.wp-block-image .components-resizable-box__container { - display: inline-block; -} -.wp-block-image .components-resizable-box__container img { - display: block; - width: inherit; - height: inherit; -} - -.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - position: absolute; - right: 0; - left: 0; - margin: -1px 0; -} -@media (min-width: 600px) { - .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { - margin: -1px; - } -} - -[data-align=wide] > .wp-block-image img, -[data-align=full] > .wp-block-image img { - height: auto; - width: 100%; -} - -.wp-block[data-align=left] > .wp-block-image, -.wp-block[data-align=center] > .wp-block-image, -.wp-block[data-align=right] > .wp-block-image { - display: table; -} -.wp-block[data-align=left] > .wp-block-image > figcaption, -.wp-block[data-align=center] > .wp-block-image > figcaption, -.wp-block[data-align=right] > .wp-block-image > figcaption { - display: table-caption; - caption-side: bottom; -} - -.wp-block[data-align=left] > .wp-block-image { - margin-left: 1em; - margin-right: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=right] > .wp-block-image { - margin-right: 1em; - margin-left: 0; - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -.wp-block[data-align=center] > .wp-block-image { - margin-right: auto; - margin-left: auto; - text-align: center; -} - -.wp-block-image__crop-area { - position: relative; - max-width: 100%; - width: 100%; -} - -.wp-block-image__crop-icon { - padding: 0 8px; - min-width: 48px; - display: flex; - justify-content: center; - align-items: center; -} -.wp-block-image__crop-icon svg { - fill: currentColor; -} - -.wp-block-image__zoom .components-popover__content { - overflow: visible; - min-width: 260px; -} -.wp-block-image__zoom .components-range-control { - flex: 1; -} -.wp-block-image__zoom .components-base-control__field { - display: flex; - margin-bottom: 0; - flex-direction: column; - align-items: flex-start; -} - -.wp-block-image__aspect-ratio { - height: 46px; - margin-bottom: -8px; - display: flex; - align-items: center; -} -.wp-block-image__aspect-ratio .components-button { - width: 36px; - padding-right: 0; - padding-left: 0; -} - -.wp-block-latest-posts { - padding-right: 2.5em; -} -.wp-block-latest-posts.is-grid { - padding-right: 0; -} - -.wp-block-latest-posts li a > div { - display: inline; -} - -.edit-post-visual-editor .wp-block-latest-posts.is-grid li { - margin-bottom: 20px; -} - -.editor-latest-posts-image-alignment-control .components-base-control__label { - display: block; -} -.editor-latest-posts-image-alignment-control .components-toolbar { - border-radius: 2px; -} - -.wp-block-media-text__media { - position: relative; -} -.wp-block-media-text__media.is-transient img { - opacity: 0.3; -} -.wp-block-media-text__media .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -.wp-block-media-text .__resizable_base__ { - grid-column: 1/span 2; - grid-row: 2; -} - -.wp-block-media-text .editor-media-container__resizer { - width: 100% !important; -} - -.wp-block-media-text.is-image-fill .editor-media-container__resizer { - height: 100% !important; -} - -.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block { - max-width: unset; -} - -.block-editor-block-list__block[data-type="core/more"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-more { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-more input[type=text] { - position: relative; - font-size: 13px; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border: none; - box-shadow: none; - white-space: nowrap; - text-align: center; - margin: 0; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; - max-width: 100%; -} -.wp-block-more input[type=text]:focus { - box-shadow: none; -} -.wp-block-more::before { - content: ""; - position: absolute; - top: calc(50%); - right: 0; - left: 0; - border-top: 3px dashed #ccc; -} - -/** - * Editor only CSS. - */ -.editor-styles-wrapper .wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-right: 0; - padding-right: 0; -} -.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block { - margin: revert; -} - -.wp-block-navigation-item__label { - display: inline; -} - -/** - * Submenus. - */ -.wp-block-navigation__container.is-parent-of-selected-block { - visibility: visible; - opacity: 1; - overflow: visible; -} - -.wp-block-navigation__container, -.wp-block-navigation-item { - background-color: inherit; -} - -.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover > .wp-block-navigation__submenu-container { - opacity: 0; - visibility: hidden; -} - -.has-child.is-selected > .wp-block-navigation__submenu-container, .has-child.has-child-selected > .wp-block-navigation__submenu-container { - display: flex; - opacity: 1; - visibility: visible; -} - -.is-dragging-components-draggable .has-child.is-dragging-within > .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; -} - -.is-editing > .wp-block-navigation__container { - visibility: visible; - opacity: 1; - display: flex; - flex-direction: column; -} - -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container { - opacity: 1; - visibility: hidden; -} -.is-dragging-components-draggable .wp-block-navigation-link > .wp-block-navigation__container .block-editor-block-draggable-chip-wrapper { - visibility: visible; -} - -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender { - display: block; - position: static; - width: 100%; -} -.is-editing > .wp-block-navigation__submenu-container > .block-list-appender .block-editor-button-block-appender { - color: #fff; - background: #1e1e1e; - padding: 0; - width: 24px; - border-radius: 2px; - margin-left: 0; - margin-right: auto; -} - -.wp-block-navigation__submenu-container .block-list-appender { - display: none; -} - -/** - * Colors Selector component - */ -.block-library-colors-selector { - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__toggle { - display: block; - margin: 0 auto; - padding: 3px; - width: auto; -} -.block-library-colors-selector .block-library-colors-selector__icon-container { - height: 30px; - position: relative; - margin: 0 auto; - padding: 3px; - display: flex; - align-items: center; - border-radius: 4px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection { - margin-right: auto; - margin-left: auto; - border-radius: 11px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - width: 22px; - min-width: 22px; - height: 22px; - min-height: 22px; - line-height: 20px; - padding: 2px; -} -.block-library-colors-selector .block-library-colors-selector__state-selection > svg { - min-width: auto !important; -} -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg, -.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color > svg path { - color: inherit; -} - -.block-library-colors-selector__popover .color-palette-controller-container { - padding: 16px; -} -.block-library-colors-selector__popover .components-base-control__label { - height: 20px; - line-height: 20px; -} -.block-library-colors-selector__popover .component-color-indicator { - float: left; - margin-top: 2px; -} -.block-library-colors-selector__popover .components-panel__body-title { - display: none; -} - -.wp-block-navigation .block-editor-button-block-appender { - background-color: #1e1e1e; - color: #fff; -} -.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender { - padding: 0; -} - -.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender { - background-color: transparent; - color: #1e1e1e; -} - -/** - * Setup state - */ -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.components-placeholder.wp-block-navigation-placeholder { - outline: none; - padding: 0; - box-shadow: none; - background: none; - min-height: 0; - color: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset { - font-size: inherit; -} -.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button { - margin-bottom: 0; -} -.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder { - color: #1e1e1e; -} - -.wp-block-navigation-placeholder .components-spinner { - margin-top: 0; -} - -.wp-block-navigation-placeholder__preview { - display: flex; - align-items: center; - min-width: 96px; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: currentColor; - background: transparent; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview { - display: none; -} -.wp-block-navigation-placeholder__preview::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-navigation-placeholder__preview > svg { - fill: currentColor; - opacity: 0.4; -} - -.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset, -.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset { - min-height: 90px; -} - -.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset { - min-height: 132px; -} - -.wp-block-navigation-placeholder__preview, -.wp-block-navigation-placeholder__controls { - padding: 6px 8px; - flex-direction: row; - align-items: flex-start; -} - -.wp-block-navigation-placeholder__controls { - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - display: none; - position: relative; - z-index: 1; - float: right; - width: 100%; -} -.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls { - display: flex; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr, .is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator, -.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator + hr { - display: none; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions { - flex-direction: column; - align-items: flex-start; -} -.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr, .wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr { - display: none; -} -.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon { - margin-left: 12px; - height: 36px; -} - -.wp-block-navigation-placeholder__actions__indicator { - display: flex; - padding: 0 0 0 6px; - align-items: center; - justify-content: flex-start; - line-height: 0; - height: 36px; - margin-right: 4px; -} -.wp-block-navigation-placeholder__actions__indicator svg { - margin-left: 4px; - fill: currentColor; -} - -.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset { - flex-direction: row !important; -} - -.wp-block-navigation-placeholder__actions { - display: flex; - font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - gap: 6px; - align-items: center; - height: 100%; -} -.wp-block-navigation-placeholder__actions .components-dropdown, -.wp-block-navigation-placeholder__actions > .components-button { - margin-left: 0; -} -.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr { - border: 0; - min-height: 1px; - min-width: 1px; - background-color: #1e1e1e; - margin: auto 0; - height: 100%; - max-height: 16px; -} - -/** - * Mobile menu. - */ -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close { - display: none; - } -} - -.wp-block-navigation__responsive-container.is-menu-open { - position: fixed; - top: 155px; -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - top: 93px; - } -} -@media (min-width: 782px) { - .wp-block-navigation__responsive-container.is-menu-open { - right: 36px; - } -} -@media (min-width: 960px) { - .wp-block-navigation__responsive-container.is-menu-open { - right: 160px; - } -} - -@media (min-width: 782px) { - .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; - } -} - -.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 141px; -} - -.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open { - left: 280px; -} - -.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - right: 0; - top: 155px; -} -@media (min-width: 782px) { - .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open { - top: 61px; - } -} -@media (min-width: 782px) { - .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; - } -} -.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open, -.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open { - top: 109px; -} - -body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open { - top: 0; - left: 0; - bottom: 0; - right: 0; -} - -@media (min-width: 600px) { - .wp-block-navigation__responsive-close { - pointer-events: none; - } - .wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close, -.wp-block-navigation__responsive-close .block-editor-block-list__layout * { - pointer-events: all; - } -} -.wp-block-navigation__responsive-close .wp-block-pages-list__item__link { - pointer-events: none; -} - -.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open, -.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close { - padding: 0; - height: auto; - color: inherit; -} - -.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender { - margin-top: 16px; -} - -@keyframes fadein { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.wp-block-navigation .components-spinner { - padding: 8px 12px; -} - -.wp-block-navigation__unsaved-changes { - position: relative; -} -.wp-block-navigation__unsaved-changes .components-spinner { - position: absolute; - top: calc(50% - 16px / 2); - right: calc(50% - 16px / 2); - opacity: 0; - animation: 0.5s linear 2s normal forwards fadein; -} - -@keyframes fadeouthalf { - 0% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.wp-block-navigation__unsaved-changes-overlay.is-saving { - opacity: 1; - animation: 0.5s linear 2s normal forwards fadeouthalf; -} - -.wp-block-navigation-delete-menu-button { - width: 100%; - justify-content: center; - margin-bottom: 16px; -} - -.wp-block-navigation__overlay-menu-preview { - display: flex; - align-items: center; - width: 100%; - background-color: #f0f0f0; - padding: 0 24px; - height: 64px; - margin-bottom: 12px; -} -.wp-block-navigation__overlay-menu-preview.open { - box-shadow: inset 0 0 0 1px #e0e0e0; - outline: 1px solid transparent; - background-color: #fff; -} - -.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty { - display: none; -} - -.wp-block-navigation-placeholder__actions hr + hr { - display: none; -} - -/** - * Submenus. - */ -.wp-block-navigation .has-child { - cursor: pointer; -} -.wp-block-navigation .has-child .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container { - z-index: 29; -} -.wp-block-navigation .has-child.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation .has-child.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - overflow: visible !important; -} - -/** - * Navigation Items. - */ -.wp-block-navigation-item .wp-block-navigation-item__content { - cursor: text; -} -.wp-block-navigation-item.is-editing, .wp-block-navigation-item.is-selected { - min-width: 20px; -} -.wp-block-navigation-item .block-list-appender { - margin-top: 16px; - margin-left: auto; - margin-bottom: 16px; - margin-right: 16px; -} - -.wp-block-navigation-link__invalid-item { - color: #000; -} - -.wp-block-navigation-link__missing_text-tooltip { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; -} - -/** - * Menu item setup state. Is shown when a menu item has no URL configured. - */ -.wp-block-navigation-link__placeholder { - position: relative; - text-decoration: none !important; - box-shadow: none !important; - background-image: none !important; -} -.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: var(--wp-admin-theme-color); - background-image: linear-gradient(-45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(-135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); - background-position: 100% 100%; - background-size: 6px 3px; - background-repeat: repeat-x; - padding-bottom: 0.1em; -} -.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span { - --wp-underline-color: #fff; -} -.wp-block-navigation-link__placeholder.wp-block-navigation-item__content { - cursor: pointer; -} - -/** -* Link Control Transforms -*/ -.link-control-transform { - border-top: 1px solid #ccc; - padding: 0 16px 8px 16px; -} - -.link-control-transform__subheading { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} - -.link-control-transform__items { - display: flex; - justify-content: space-between; -} - -.link-control-transform__item { - flex-basis: 33%; - flex-direction: column; - gap: 8px; - height: auto; -} - -.wp-block-navigation-submenu { - display: block; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-container { - z-index: 28; -} -.wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container { - visibility: visible !important; - opacity: 1 !important; - min-width: 200px !important; - height: auto !important; - width: auto !important; - position: absolute; - right: -1px; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - right: 100%; - top: -1px; - } - .wp-block-navigation-submenu.is-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before, .wp-block-navigation-submenu.has-child-selected > .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - left: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } -} - -.block-editor-block-list__block[data-type="core/nextpage"] { - max-width: 100%; - text-align: center; - margin-top: 28px; - margin-bottom: 28px; -} - -.wp-block-nextpage { - display: block; - text-align: center; - white-space: nowrap; -} -.wp-block-nextpage > span { - font-size: 13px; - position: relative; - text-transform: uppercase; - font-weight: 600; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - color: #757575; - border-radius: 4px; - background: #fff; - padding: 6px 8px; - height: 24px; -} -.wp-block-nextpage::before { - content: ""; - position: absolute; - top: calc(50%); - right: 0; - left: 0; - border-top: 3px dashed #ccc; -} - -.wp-block-navigation .wp-block-page-list > div, -.wp-block-navigation .wp-block-page-list { - background-color: inherit; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > div, -.wp-block-navigation.items-justified-space-between .wp-block-page-list { - display: contents; - flex: 1; -} -.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list > div, .wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list { - flex: inherit; -} - -.wp-block-pages-list__item__link { - pointer-events: none; -} - -@media (min-width: 600px) { - .wp-block-page-list-modal { - max-width: 480px; - } -} - -.wp-block-page-list-modal-buttons { - display: flex; - justify-content: flex-end; - gap: 12px; -} - -.wp-block-page-list .open-on-click:focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-page-list .components-notice { - margin-right: 0; -} - -.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus { - min-height: auto !important; -} - -.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 1; -} - -.block-editor-block-list__block[data-empty=true] + .block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] { - opacity: 0; -} - -.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline { - display: inline-block; -} - -.wp-block-pullquote.has-text-align-left p, -.wp-block-pullquote.has-text-align-right p, -.wp-block[data-align=left] > .wp-block-pullquote p, -.wp-block[data-align=right] > .wp-block-pullquote p { - font-size: 20px; -} - -.wp-block-pullquote blockquote p { - font-size: 28px; - line-height: 1.6; -} - -.wp-block-pullquote.is-style-solid-color blockquote p { - font-size: 32px; -} -.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote .wp-block-pullquote__citation { - color: inherit; -} - -.wp-block-rss li a > div { - display: inline; -} - -.wp-block-rss__placeholder-form { - display: flex; - align-items: stretch; -} -.wp-block-rss__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .wp-block-rss__placeholder-form > * { - margin-bottom: 0; - } -} - -.wp-block-rss__placeholder-input { - display: flex; - align-items: stretch; - flex-grow: 1; -} -.wp-block-rss__placeholder-input .components-base-control__field { - margin: 0; - display: flex; - align-items: stretch; - flex-grow: 1; - margin-left: 8px; -} - -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-search .wp-block-search__button { - height: auto; - border-radius: initial; - display: flex; - align-items: center; -} -.wp-block-search__components-button-group { - margin-top: 10px; -} - -.block-editor-block-list__block[data-type="core/separator"] { - padding-top: 0.1px; - padding-bottom: 0.1px; -} -.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots { - background: none !important; -} - -[data-type="core/shortcode"] .block-editor-plain-text { - max-height: 250px; -} -[data-type="core/shortcode"].components-placeholder { - min-height: 0; -} - -.blocks-shortcode__textarea { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .blocks-shortcode__textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .blocks-shortcode__textarea { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.blocks-shortcode__textarea:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.blocks-shortcode__textarea::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.blocks-shortcode__textarea:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.wp-block[data-align=center] > .wp-block-site-logo, -.wp-block-site-logo.aligncenter > div { - display: table; - margin-right: auto; - margin-left: auto; -} - -.wp-block-site-logo a { - pointer-events: none; -} -.wp-block-site-logo .custom-logo-link { - cursor: inherit; -} -.wp-block-site-logo .custom-logo-link:focus { - box-shadow: none; -} -.wp-block-site-logo .custom-logo-link.is-transient img { - opacity: 0.3; -} -.wp-block-site-logo img { - display: block; - height: auto; - max-width: 100%; -} - -.wp-block-site-logo.wp-block-site-logo .components-placeholder, -.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder { - height: 120px; - width: 120px; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder { - display: flex; - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; - color: currentColor; - background: transparent; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - left: 4px; - bottom: 4px; - right: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text { - display: none; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -.wp-block-site-tagline__placeholder { - padding: 1em 0; - border: 1px dashed; -} - -.wp-block-site-title__placeholder { - padding: 1em 0; - border: 1px dashed; -} - -.wp-block-social-links .wp-social-link { - line-height: 0; -} -.wp-block-social-links .wp-social-link button { - font-size: inherit; - color: currentColor; - height: auto; - line-height: 0; - padding: 0.25em; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link button { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -} - -.wp-block-social-links.is-style-logos-only .wp-social-link button { - padding: 0; -} - -.wp-block-social-links div.block-editor-url-input { - display: inline-block; - margin-right: 8px; -} -.wp-block-social-links.wp-block-social-links { - background: none; -} - -.wp-social-link:hover { - transform: none; -} - -.editor-styles-wrapper .wp-block-social-links { - padding: 0; -} - -.wp-block-social-links__social-placeholder { - display: flex; - opacity: 0.8; - list-style: none; -} -.wp-block-social-links__social-placeholder > .wp-social-link { - padding-right: 0 !important; - margin-right: 0 !important; - padding-left: 0 !important; - margin-left: 0 !important; - width: 0 !important; - visibility: hidden; -} -.wp-block-social-links__social-placeholder > .wp-block-social-links__social-placeholder-icons { - display: flex; -} -.wp-block-social-links__social-placeholder .wp-social-link { - padding: 0.25em; -} -.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link { - padding-right: calc((2/3) * 1em); - padding-left: calc((2/3) * 1em); -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link { - padding: 0; -} -.wp-block-social-links__social-placeholder .wp-social-link::before { - content: ""; - display: block; - width: 1em; - height: 1em; - border-radius: 50%; -} -.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link::before { - background: currentColor; -} - -.wp-block-social-links .wp-block-social-links__social-prompt { - min-height: 24px; - list-style: none; - order: 2; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 24px; - margin-top: auto; - margin-bottom: auto; - cursor: default; - padding-left: 8px; -} - -.wp-block[data-align=center] > .wp-block-social-links { - justify-content: center; -} - -.block-editor-block-preview__content .components-button:disabled { - opacity: 1; -} - -.wp-social-link.wp-social-link__is-incomplete { - opacity: 0.5; -} -@media (prefers-reduced-motion: reduce) { - .wp-social-link.wp-social-link__is-incomplete { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.wp-block-social-links .is-selected .wp-social-link__is-incomplete, -.wp-social-link.wp-social-link__is-incomplete:hover, -.wp-social-link.wp-social-link__is-incomplete:focus { - opacity: 1; -} - -.block-editor-block-list__block[data-type="core/spacer"]::before { - content: ""; - display: block; - position: absolute; - z-index: 1; - width: 100%; - min-height: 8px; - min-width: 8px; - height: 100%; -} - -.wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.block-library-spacer__resize-container.has-show-handle { - background: rgba(0, 0, 0, 0.1); -} -.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container, -.is-dark-theme .block-library-spacer__resize-container.has-show-handle { - background: rgba(255, 255, 255, 0.15); -} - -.block-library-spacer__resize-container { - clear: both; -} -.block-library-spacer__resize-container:not(.is-resizing) { - height: 100% !important; - width: 100% !important; -} -.block-library-spacer__resize-container .components-resizable-box__handle::before { - content: none; -} -.block-library-spacer__resize-container.resize-horizontal { - margin-bottom: 0; -} - -.wp-block-table { - margin: 0; -} -.wp-block[data-align=left] > .wp-block-table, .wp-block[data-align=right] > .wp-block-table, .wp-block[data-align=center] > .wp-block-table { - height: auto; -} -.wp-block[data-align=left] > .wp-block-table table, .wp-block[data-align=right] > .wp-block-table table, .wp-block[data-align=center] > .wp-block-table table { - width: auto; -} -.wp-block[data-align=left] > .wp-block-table td, -.wp-block[data-align=left] > .wp-block-table th, .wp-block[data-align=right] > .wp-block-table td, -.wp-block[data-align=right] > .wp-block-table th, .wp-block[data-align=center] > .wp-block-table td, -.wp-block[data-align=center] > .wp-block-table th { - word-break: break-word; -} -.wp-block[data-align=center] > .wp-block-table { - text-align: initial; -} -.wp-block[data-align=center] > .wp-block-table table { - margin: 0 auto; -} -.wp-block-table td, -.wp-block-table th { - border: 1px solid; -} -.wp-block-table td.is-selected, -.wp-block-table th.is-selected { - border-color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - border-style: double; -} -.wp-block-table figcaption { - color: #555; - font-size: 13px; - text-align: center; -} -.is-dark-theme .wp-block-table figcaption { - color: rgba(255, 255, 255, 0.65); -} - -.blocks-table__placeholder-form.blocks-table__placeholder-form { - display: flex; - flex-direction: column; - align-items: flex-start; -} -.blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 8px; -} -@media (min-width: 782px) { - .blocks-table__placeholder-form.blocks-table__placeholder-form { - flex-direction: row; - align-items: flex-end; - } - .blocks-table__placeholder-form.blocks-table__placeholder-form > * { - margin-bottom: 0; - } -} - -.blocks-table__placeholder-input { - width: 112px; - margin-left: 8px; - margin-bottom: 0; -} -.blocks-table__placeholder-input input { - height: 36px; -} -.blocks-table__placeholder-input .components-base-control__field { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-template-part__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-template-part__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-template-part__selection-modal { - height: 70%; - } -} - -.wp-block-text-columns .block-editor-rich-text__editable:focus { - outline: 1px solid #ddd; -} - -.wp-block[data-align=center] > .wp-block-video { - text-align: center; -} - -.wp-block-video { - position: relative; -} -.wp-block-video.is-transient video { - opacity: 0.3; -} -.wp-block-video .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} - -.editor-video-poster-control .components-base-control__label { - display: block; -} -.editor-video-poster-control .components-button { - margin-left: 8px; -} - -.block-library-video-tracks-editor { - z-index: 159990; -} - -.block-library-video-tracks-editor > .components-popover__content { - width: 360px; -} - -.block-library-video-tracks-editor__track-list-track { - display: flex; - place-content: space-between; - align-items: baseline; - padding-right: 12px; -} - -.block-library-video-tracks-editor__single-track-editor-label-language { - display: flex; - margin-top: 12px; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control { - width: 50%; -} -.block-library-video-tracks-editor__single-track-editor-label-language > .components-base-control:first-child { - margin-left: 16px; -} - -.block-library-video-tracks-editor__single-track-editor-kind-select { - max-width: 240px; -} - -.block-library-video-tracks-editor__single-track-editor-buttons-container { - display: flex; - place-content: space-between; - margin-top: 32px; -} - -.block-library-video-tracks-editor__single-track-editor-edit-track-label { - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - display: block; -} - -.block-library-video-tracks-editor > .components-popover__content > div { - padding: 0; -} - -.block-library-video-tracks-editor__track-list .components-menu-group__label, -.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label { - padding: 0; -} - -.block-library-video-tracks-editor__single-track-editor, -.block-library-video-tracks-editor__track-list, -.block-library-video-tracks-editor__add-tracks-container { - padding: 12px; -} - -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label { - margin-bottom: 4px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field { - margin-bottom: 12px; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input { - margin-right: 0; -} -.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label { - margin-bottom: 4px; -} - -.editor-styles-wrapper ul.wp-block-post-template { - padding-right: 0; - margin-right: 0; - list-style: none; -} - -.block-library-query-toolbar__popover .components-popover__content { - min-width: 230px; -} - -.wp-block-query__create-new-link { - padding: 0 56px 16px 16px; -} - -.block-library-query__pattern-selection-content .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - grid-gap: 8px; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - max-height: 250px; -} - -.block-editor-query-pattern__selection-modal .components-modal__content { - overflow: hidden; - padding: 0; -} -.block-editor-query-pattern__selection-modal .components-modal__content::before { - margin-bottom: 0; -} - -@media (min-width: 600px) { - .block-editor-query-pattern__selection-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .block-editor-query-pattern__selection-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .block-editor-query-pattern__selection-modal { - height: 80%; - width: 80%; - max-height: none; - } -} - -.wp-block[data-align=center] > .wp-block-query-pagination { - justify-content: center; -} - -.editor-styles-wrapper .wp-block-query-pagination { - max-width: 100%; -} -.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout { - margin: 0; -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - margin-right: 0; - margin-top: 0.5em; - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - margin-right: 0; -} - -.wp-block-query-pagination-numbers a { - text-decoration: underline; -} -.wp-block-query-pagination-numbers .page-numbers { - margin-left: 2px; -} -.wp-block-query-pagination-numbers .page-numbers:last-child { - margin-right: 0; -} - -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container { - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder { - justify-content: center; - align-items: center; - box-shadow: none; - padding: 0; - color: currentColor; - background: transparent; - min-height: 200px; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload { - display: none; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview { - position: absolute; - top: 4px; - left: 4px; - bottom: 4px; - right: 4px; - background: rgba(255, 255, 255, 0.8); - display: flex; - align-items: center; - justify-content: center; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder::before, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border: 1px dashed currentColor; - opacity: 0.4; - pointer-events: none; - border-radius: inherit; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset { - width: auto; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - color: inherit; - padding: 0; - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - position: relative; - visibility: hidden; - background: transparent; - transition: all 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button > svg, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button > svg { - color: #fff; -} -.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration, -.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - stroke: currentColor; - stroke-dasharray: 3; - opacity: 0.4; -} -.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder { - min-height: 48px; - min-width: 48px; - height: 100%; - width: 100%; -} -.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - border-style: solid; - color: #fff; - opacity: 1; - visibility: visible; -} - -div[data-type="core/post-featured-image"] img { - max-width: 100%; - height: auto; - display: block; -} - -.wp-block-post-comments__placeholder * { - pointer-events: none; -} - -.wp-block-post-comments-form * { - pointer-events: none; -} -.wp-block-post-comments-form *.block-editor-warning * { - pointer-events: auto; -} - -:root .editor-styles-wrapper { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ -} -:root .editor-styles-wrapper .has-very-light-gray-background-color { - background-color: #eee; -} -:root .editor-styles-wrapper .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .editor-styles-wrapper .has-very-light-gray-color { - color: #eee; -} -:root .editor-styles-wrapper .has-very-dark-gray-color { - color: #313131; -} -:root .editor-styles-wrapper .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(-135deg, #00d084 0%, #0693e3 100%); -} -:root .editor-styles-wrapper .has-purple-crush-gradient-background { - background: linear-gradient(-135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .editor-styles-wrapper .has-hazy-dawn-gradient-background { - background: linear-gradient(-135deg, #faaca8 0%, #dad0ec 100%); -} -:root .editor-styles-wrapper .has-subdued-olive-gradient-background { - background: linear-gradient(-135deg, #fafae1 0%, #67a671 100%); -} -:root .editor-styles-wrapper .has-atomic-cream-gradient-background { - background: linear-gradient(-135deg, #fdd79a 0%, #004a59 100%); -} -:root .editor-styles-wrapper .has-nightshade-gradient-background { - background: linear-gradient(-135deg, #330968 0%, #31cdcf 100%); -} -:root .editor-styles-wrapper .has-midnight-gradient-background { - background: linear-gradient(-135deg, #020381 0%, #2874fc 100%); -} - -.editor-styles-wrapper { - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} - -.editor-styles-wrapper .has-regular-font-size { - font-size: 16px; -} - -.editor-styles-wrapper .has-larger-font-size { - font-size: 42px; -} - -.editor-styles-wrapper .has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.editor-styles-wrapper .has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -/** - * Editor Normalization Styles - * - * These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper. - * This allows us to create normalization styles that are easily overridden by editor styles. - */ul.wp-block-archives{padding-right:2.5em}.wp-block-audio{margin-right:0;margin-left:0;position:relative}.wp-block-audio.is-transient audio{opacity:.3}.wp-block-audio .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-avatar__image img{width:100%}.wp-block-avatar.aligncenter .components-resizable-box__container{margin:0 auto}.edit-post-visual-editor .block-library-block__reusable-block-container .is-root-container{padding-right:0;padding-left:0}.edit-post-visual-editor .block-library-block__reusable-block-container .block-editor-writing-flow{display:block}.edit-post-visual-editor .block-library-block__reusable-block-container .components-disabled .block-list-appender{display:none}.wp-block[data-align=center]>.wp-block-button{text-align:center;margin-right:auto;margin-left:auto}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{position:relative;cursor:text}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;overflow:hidden;max-width:290px}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}.wp-block-buttons>.wp-block,.wp-block-buttons>.wp-block-button.wp-block-button.wp-block-button.wp-block-button.wp-block-button{margin:0}.wp-block-buttons>.block-list-appender{display:inline-flex;align-items:center}.wp-block-buttons.is-vertical>.block-list-appender .block-list-appender__toggle{justify-content:flex-start}.wp-block-buttons>.wp-block-button:focus{box-shadow:none}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center]{margin-right:auto;margin-left:auto;margin-top:0;width:100%}.wp-block-buttons:not(.is-content-justification-space-between,.is-content-justification-right,.is-content-justification-left,.is-content-justification-center) .wp-block[data-align=center] .wp-block-button{margin-bottom:0}.wp-block[data-align=center]>.wp-block-buttons{align-items:center;justify-content:center}.wp-block[data-align=right]>.wp-block-buttons{justify-content:flex-end}.wp-block-categories ul{padding-right:2.5em}.wp-block-categories ul ul{margin-top:6px}.wp-block-columns :where(.wp-block){max-width:none;margin-right:0;margin-left:0}html :where(.wp-block-column){margin-top:0;margin-bottom:0}.wp-block-comment-author-avatar__placeholder{border:1px dashed;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3}.block-library-comments-toolbar__popover .components-popover__content{min-width:230px}.wp-block[data-align=center]>.wp-block-comments-pagination{justify-content:center}.editor-styles-wrapper .wp-block-comments-pagination{max-width:100%}.editor-styles-wrapper .wp-block-comments-pagination.block-editor-block-list__layout{margin:0}.wp-block-comments-pagination>.wp-block-comments-pagination-next,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers,.wp-block-comments-pagination>.wp-block-comments-pagination-previous{margin-top:.5em;margin-right:.5em;margin-bottom:.5em}.wp-block-comments-pagination>.wp-block-comments-pagination-next:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-numbers:last-child,.wp-block-comments-pagination>.wp-block-comments-pagination-previous:last-child{margin-right:0}.wp-block-comments-pagination-numbers a{text-decoration:underline}.wp-block-comments-pagination-numbers .page-numbers{margin-left:2px}.wp-block-comments-pagination-numbers .page-numbers:last-child{margin-right:0}.wp-block-comments-title.has-background{padding:inherit}.editor-styles-wrapper .wp-block-cover{box-sizing:border-box}.wp-block-cover.is-placeholder{min-height:auto!important;padding:0!important}.wp-block-cover.is-placeholder .block-library-cover__resize-container{display:none}.wp-block-cover.is-placeholder .components-placeholder.is-large{min-height:240px;justify-content:flex-start;z-index:1}.wp-block-cover.is-placeholder .components-placeholder.is-large+.block-library-cover__resize-container{min-height:240px;display:block}.wp-block-cover.components-placeholder h2{color:inherit}.wp-block-cover.is-transient:before{background-color:#fff;opacity:.3}.wp-block-cover .components-spinner{position:absolute;z-index:1;top:50%;right:50%;transform:translate(50%,-50%);margin:0}.wp-block-cover .block-editor-block-list__layout{width:100%}.wp-block-cover .wp-block-cover__inner-container{text-align:right;margin-right:0;margin-left:0}.wp-block-cover .wp-block-cover__placeholder-background-options{width:100%}[data-align=left]>.wp-block-cover,[data-align=right]>.wp-block-cover{max-width:420px;width:100%}.block-library-cover__reset-button{margin-right:auto}.block-library-cover__resize-container{position:absolute!important;top:0;right:0;left:0;bottom:0;min-height:50px}.block-library-cover__resize-container:not(.is-resizing){height:auto!important}.wp-block-cover>.components-drop-zone .components-drop-zone__content{opacity:.8!important}.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover{background-attachment:scroll}.wp-block-embed{margin-right:0;margin-left:0;clear:both}.wp-block-embed.is-loading{display:flex;justify-content:center}.wp-block-embed .components-placeholder__error{word-break:break-word}.wp-block-embed .components-placeholder__learn-more{margin-top:1em}.block-library-embed__interactive-overlay{position:absolute;top:0;right:0;left:0;bottom:0;opacity:0}.wp-block[data-align=left]>.wp-block-embed,.wp-block[data-align=right]>.wp-block-embed{max-width:360px;width:100%}.wp-block[data-align=left]>.wp-block-embed .wp-block-embed__wrapper,.wp-block[data-align=right]>.wp-block-embed .wp-block-embed__wrapper{min-width:280px}.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em}.wp-block-freeform.block-library-rich-text__tinymce{height:auto}.wp-block-freeform.block-library-rich-text__tinymce li,.wp-block-freeform.block-library-rich-text__tinymce p{line-height:1.8}.wp-block-freeform.block-library-rich-text__tinymce ol,.wp-block-freeform.block-library-rich-text__tinymce ul{padding-right:2.5em;margin-right:0}.wp-block-freeform.block-library-rich-text__tinymce blockquote{margin:0;box-shadow:inset 0 0 0 0 #ddd;border-right:4px solid #000;padding-right:1em}.wp-block-freeform.block-library-rich-text__tinymce pre{white-space:pre-wrap;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;color:#1e1e1e}.wp-block-freeform.block-library-rich-text__tinymce>:first-child{margin-top:0}.wp-block-freeform.block-library-rich-text__tinymce>:last-child{margin-bottom:0}.wp-block-freeform.block-library-rich-text__tinymce.mce-edit-focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce a{color:var(--wp-admin-theme-color)}.wp-block-freeform.block-library-rich-text__tinymce:focus a[data-mce-selected]{padding:0 2px;margin:0 -2px;border-radius:2px;box-shadow:0 0 0 1px #e5f5fa;background:#e5f5fa}.wp-block-freeform.block-library-rich-text__tinymce code{padding:2px;border-radius:2px;color:#1e1e1e;background:#f0f0f0;font-family:Menlo,Consolas,monaco,monospace;font-size:14px}.wp-block-freeform.block-library-rich-text__tinymce:focus code[data-mce-selected]{background:#ddd}.wp-block-freeform.block-library-rich-text__tinymce .alignright{float:right;margin:.5em 0 .5em 1em}.wp-block-freeform.block-library-rich-text__tinymce .alignleft{float:left;margin:.5em 1em .5em 0}.wp-block-freeform.block-library-rich-text__tinymce .aligncenter{display:block;margin-right:auto;margin-left:auto}.wp-block-freeform.block-library-rich-text__tinymce .wp-more-tag{width:96%;height:20px;display:block;margin:15px auto;outline:0;cursor:default;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADtgAAAAoBAMAAAA86gLBAAAAJFBMVEVMaXG7u7vBwcHDw8POzs68vLzGxsbMzMy+vr7AwMDQ0NDGxsYKLGzpAAAADHRSTlMA///zWf+/f///TMxNVGuqAAABwklEQVR4Ae3dMXLaQBTH4bfj8UCpx8hq0vgKvgFNemhT6Qo6gg6R+0ZahM2QLmyBJ99XWP9V5+o3jIUcLQEAAAAAAAAAAAAAAAAAAAAAAABQ8j0WL9lfTtlt18uNXAUA8O/KVtfa1tdcrOdSh9gCQAMlh1hMNbZZ1bsrsQWABsrhLRbz7z5in/32UbfUMUbkMQCAh5RfGYv82UdMdZ6HS2wjT2ILAI8r3XmM2B3WvM59vfO2xXYW2yYAENuPU8S+X/N67mKxzy225yaxBQCxLV392UdcvwV0jPVUj98ntkBWT7C7+9u2/V/vGtvXIWJ6/4rtbottWa6Ri0NUT/u72LYttrb97LHdvUXMxxrb8TO2W2TF1rYbbLG1bbGNjMi4+2Sbi1FsbbvNFlvbFtt5fDnE3d9sP1/XeIyV2Nr2U2/guZUuptNrH/dPI9eLB6SaAEBs6wPJf3/PNk9tYgsAYrv/8TFuzx/fvkFqGtrEFgDEdpcZUb7ejXy6ntrEFgDENvL6gsas4vbdyKt4DACI7TxElJv/Z7udpqFNbAFAbKduy2uU2trttM/x28UWAAAAAAAAAAAAAAAAAAAAAAAAAADgDyPwGmGTCZp7AAAAAElFTkSuQmCC);background-size:1900px 20px;background-repeat:no-repeat;background-position:50%}.wp-block-freeform.block-library-rich-text__tinymce img::selection{background-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp{-ms-user-select:element}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption{margin:0;max-width:100%}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption a,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption img{display:block}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption *{-webkit-user-drag:none}.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption .wp-caption-dd{padding-top:.5em;margin:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview{width:99.99%;position:relative;clear:both;margin-bottom:16px;border:1px solid transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview iframe{display:block;max-width:100%;background:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .mce-shim{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim{display:none}.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder{border:1px dashed #ddd;padding:10px}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error{border:1px solid #ddd;padding:1em 0;margin:0;word-wrap:break-word}.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-error p{margin:0;text-align:center}.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder,.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error{border-color:transparent}.wp-block-freeform.block-library-rich-text__tinymce .wpview .dashicons{display:block;margin:0 auto;width:32px;height:32px;font-size:32px}.wp-block-freeform.block-library-rich-text__tinymce .wpview.wpview-type-gallery:after{content:"";display:table;clear:both}.wp-block-freeform.block-library-rich-text__tinymce .gallery img[data-mce-selected]:focus{outline:none}.wp-block-freeform.block-library-rich-text__tinymce .gallery a{cursor:default}.wp-block-freeform.block-library-rich-text__tinymce .gallery{margin:auto -6px;padding:6px 0;line-height:1;overflow-x:hidden}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-item{float:right;margin:0;text-align:center;padding:6px;box-sizing:border-box}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption,.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-icon{margin:0}.wp-block-freeform.block-library-rich-text__tinymce .gallery .gallery-caption{font-size:13px;margin:4px 0}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-1 .gallery-item{width:100%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-2 .gallery-item{width:50%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-3 .gallery-item{width:33.3333333333%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-4 .gallery-item{width:25%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-5 .gallery-item{width:20%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-6 .gallery-item{width:16.6666666667%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-7 .gallery-item{width:14.2857142857%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-8 .gallery-item{width:12.5%}.wp-block-freeform.block-library-rich-text__tinymce .gallery-columns-9 .gallery-item{width:11.1111111111%}.wp-block-freeform.block-library-rich-text__tinymce .gallery img{max-width:100%;height:auto;border:none;padding:0}div[data-type="core/freeform"]:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #ddd;outline:1px solid transparent}@media (prefers-reduced-motion:reduce){div[data-type="core/freeform"]:before{transition-duration:0s;transition-delay:0s}}div[data-type="core/freeform"].is-selected:before{border-color:#1e1e1e}div[data-type="core/freeform"] .block-editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="core/freeform"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}.mce-toolbar-grp .mce-btn.mce-active:hover button,.mce-toolbar-grp .mce-btn.mce-active:hover i,.mce-toolbar-grp .mce-btn.mce-active button,.mce-toolbar-grp .mce-btn.mce-active i{color:#1e1e1e}.mce-toolbar-grp .mce-rtl .mce-flow-layout-item.mce-last{margin-left:0;margin-right:8px}.mce-toolbar-grp .mce-btn i{font-style:normal}.block-library-classic__toolbar{display:none;width:auto;position:sticky;z-index:31;top:0;border:1px solid #ddd;border-bottom:none;border-radius:2px;margin:0 0 8px;padding:0}div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{display:block;border-color:#1e1e1e}.block-library-classic__toolbar .mce-tinymce{box-shadow:none}@media (min-width:600px){.block-library-classic__toolbar{padding:0}}.block-library-classic__toolbar:empty{display:block;background:#f5f5f5;border-bottom:1px solid #e2e4e7}.block-library-classic__toolbar:empty:before{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;content:attr(data-placeholder);color:#555d66;line-height:37px;padding:14px}.block-library-classic__toolbar div.mce-toolbar-grp{border-bottom:1px solid #1e1e1e}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar .mce-menubar>div,.block-library-classic__toolbar .mce-tinymce-inline,.block-library-classic__toolbar .mce-tinymce-inline>div,.block-library-classic__toolbar div.mce-toolbar-grp,.block-library-classic__toolbar div.mce-toolbar-grp>div{height:auto!important;width:100%!important}.block-library-classic__toolbar .mce-container-body.mce-abs-layout{overflow:visible}.block-library-classic__toolbar .mce-menubar,.block-library-classic__toolbar div.mce-toolbar-grp{position:static}.block-library-classic__toolbar .mce-toolbar-grp>div{padding:1px 3px}.block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child){display:none}.block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar,figure.wp-block-gallery{display:block}figure.wp-block-gallery.has-nested-images .components-drop-zone{display:none;pointer-events:none}figure.wp-block-gallery>.blocks-gallery-caption{flex:0 0 100%}figure.wp-block-gallery>.blocks-gallery-media-placeholder-wrapper{flex-basis:100%}figure.wp-block-gallery .wp-block-image .components-notice.is-error{display:block}figure.wp-block-gallery .wp-block-image .components-notice__content{margin:4px 0}figure.wp-block-gallery .wp-block-image .components-notice__dismiss{position:absolute;top:0;left:5px}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .components-placeholder__label{display:none}figure.wp-block-gallery .block-editor-media-placeholder.is-appender .block-editor-media-placeholder__button{margin-bottom:0}figure.wp-block-gallery .block-editor-media-placeholder{margin:0}figure.wp-block-gallery .block-editor-media-placeholder .components-placeholder__label{display:flex}figure.wp-block-gallery .block-editor-media-placeholder figcaption{z-index:2}figure.wp-block-gallery .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.gallery-settings-buttons .components-button:first-child{margin-left:8px}.gallery-image-sizes .components-base-control__label{display:block;margin-bottom:4px}.gallery-image-sizes .gallery-image-sizes__loading{display:flex;align-items:center;color:#757575;font-size:12px}.gallery-image-sizes .components-spinner{margin:0 4px 0 8px}.blocks-gallery-item figure:not(.is-selected):focus,.blocks-gallery-item img:focus{outline:none}.blocks-gallery-item figure.is-selected:before{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--wp-admin-theme-color) inset;content:"";outline:2px solid transparent;position:absolute;top:0;left:0;bottom:0;right:0;z-index:1;pointer-events:none}.blocks-gallery-item figure.is-transient img{opacity:.3}.blocks-gallery-item .is-selected .block-library-gallery-item__inline-menu{display:inline-flex}.blocks-gallery-item .block-editor-media-placeholder{margin:0;height:100%}.blocks-gallery-item .block-editor-media-placeholder .components-placeholder__label{display:flex}.block-library-gallery-item__inline-menu{display:none;position:absolute;top:-2px;margin:8px;z-index:20;transition:box-shadow .2s ease-out;border-radius:2px;background:#fff;border:1px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.block-library-gallery-item__inline-menu{transition-duration:0s;transition-delay:0s}}.block-library-gallery-item__inline-menu:hover{box-shadow:0 2px 6px rgba(0,0,0,.05)}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu,.columns-8 .block-library-gallery-item__inline-menu{padding:2px}}.block-library-gallery-item__inline-menu .components-button.has-icon:not(:focus){border:none;box-shadow:none}@media (min-width:600px){.columns-7 .block-library-gallery-item__inline-menu .components-button.has-icon,.columns-8 .block-library-gallery-item__inline-menu .components-button.has-icon{padding:0;width:inherit;height:inherit}}.block-library-gallery-item__inline-menu.is-left{right:-2px}.block-library-gallery-item__inline-menu.is-right{left:-2px}.wp-block-gallery ul.blocks-gallery-grid{padding:0;margin:0}@media (min-width:600px){.wp-block-update-gallery-modal{max-width:480px}}.wp-block-update-gallery-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-group .block-editor-block-list__insertion-point{right:0;left:0}[data-type="core/group"].is-selected .block-list-appender{margin-right:0;margin-left:0}[data-type="core/group"].is-selected .has-background .block-list-appender{margin-top:18px;margin-bottom:18px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child{gap:inherit;pointer-events:none}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content,.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{display:inherit;width:100%;flex-direction:inherit;flex:1}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child:after{content:"";display:flex;border:1px dashed;opacity:.4;border-radius:2px;flex:1;pointer-events:none;min-height:48px}.is-layout-flex.block-editor-block-list__block .block-list-appender:only-child .block-editor-inserter{pointer-events:all}.block-library-html__edit .block-library-html__preview-overlay{position:absolute;width:100%;height:100%;top:0;right:0}.block-library-html__edit .block-editor-plain-text{font-family:Menlo,Consolas,monaco,monospace!important;color:#1e1e1e!important;background:#fff!important;padding:12px!important;border:1px solid #1e1e1e!important;box-shadow:none!important;border-radius:2px!important;max-height:250px;font-size:16px!important}@media (min-width:600px){.block-library-html__edit .block-editor-plain-text{font-size:13px!important}}.block-library-html__edit .block-editor-plain-text:focus{border-color:var(--wp-admin-theme-color)!important;box-shadow:0 0 0 1px var(--wp-admin-theme-color)!important;outline:2px solid transparent!important}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-image:not(.is-style-rounded)>div:not(.components-placeholder){border-radius:inherit}.wp-block-image .components-resizable-box__container{display:inline-block}.wp-block-image .components-resizable-box__container img{display:block;width:inherit;height:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{position:absolute;right:0;left:0;margin:-1px 0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{display:table-caption;caption-side:bottom}.wp-block[data-align=left]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=right]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=center]>.wp-block-image{margin-right:auto;margin-left:auto;text-align:center}.wp-block-image__crop-area{position:relative;max-width:100%;width:100%}.wp-block-image__crop-icon{padding:0 8px;min-width:48px;display:flex;justify-content:center;align-items:center}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{overflow:visible;min-width:260px}.wp-block-image__zoom .components-range-control{flex:1}.wp-block-image__zoom .components-base-control__field{display:flex;margin-bottom:0;flex-direction:column;align-items:flex-start}.wp-block-image__aspect-ratio{height:46px;margin-bottom:-8px;display:flex;align-items:center}.wp-block-image__aspect-ratio .components-button{width:36px;padding-right:0;padding-left:0}.wp-block-latest-posts{padding-right:2.5em}.wp-block-latest-posts.is-grid{padding-right:0}.wp-block-latest-posts li a>div{display:inline}.edit-post-visual-editor .wp-block-latest-posts.is-grid li{margin-bottom:20px}.editor-latest-posts-image-alignment-control .components-base-control__label{display:block}.editor-latest-posts-image-alignment-control .components-toolbar{border-radius:2px}.wp-block-media-text__media{position:relative}.wp-block-media-text__media.is-transient img{opacity:.3}.wp-block-media-text__media .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.wp-block-media-text .__resizable_base__{grid-column:1/span 2;grid-row:2}.wp-block-media-text .editor-media-container__resizer{width:100%!important}.wp-block-media-text.is-image-fill .editor-media-container__resizer{height:100%!important}.wp-block-media-text>.block-editor-block-list__layout>.block-editor-block-list__block{max-width:unset}.block-editor-block-list__block[data-type="core/more"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-more{display:block;text-align:center;white-space:nowrap}.wp-block-more input[type=text]{position:relative;font-size:13px;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border:none;box-shadow:none;white-space:nowrap;text-align:center;margin:0;border-radius:4px;background:#fff;padding:6px 8px;height:24px;max-width:100%}.wp-block-more input[type=text]:focus{box-shadow:none}.wp-block-more:before{content:"";position:absolute;top:50%;right:0;left:0;border-top:3px dashed #ccc}.editor-styles-wrapper .wp-block-navigation ul{margin-top:0;margin-bottom:0;margin-right:0;padding-right:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation__container.is-parent-of-selected-block{visibility:visible;opacity:1;overflow:visible}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{visibility:visible;opacity:1;display:flex;flex-direction:column}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{color:#fff;background:#1e1e1e;padding:0;width:24px;border-radius:2px;margin-left:0;margin-right:auto}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{height:30px;position:relative;margin:0 auto;padding:3px;display:flex;align-items:center;border-radius:4px}.block-library-colors-selector .block-library-colors-selector__state-selection{margin-right:auto;margin-left:auto;border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);width:22px;min-width:22px;height:22px;min-height:22px;line-height:20px;padding:2px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:left;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{outline:none;padding:0;box-shadow:none;background:none;min-height:0;color:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder .components-spinner{margin-top:0}.wp-block-navigation-placeholder__preview{display:flex;align-items:center;min-width:96px;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:currentColor;background:transparent}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-navigation-placeholder__preview>svg{fill:currentColor;opacity:.4}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{padding:6px 8px;flex-direction:row;align-items:flex-start}.wp-block-navigation-placeholder__controls{border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;display:none;position:relative;z-index:1;float:right;width:100%}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{display:flex}.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{display:none}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{flex-direction:column;align-items:flex-start}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{margin-left:12px;height:36px}.wp-block-navigation-placeholder__actions__indicator{display:flex;padding:0 0 0 6px;align-items:center;justify-content:flex-start;line-height:0;height:36px;margin-right:4px}.wp-block-navigation-placeholder__actions__indicator svg{margin-left:4px;fill:currentColor}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{display:flex;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;gap:6px;align-items:center;height:100%}.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{margin-left:0}.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{border:0;min-height:1px;min-width:1px;background-color:#1e1e1e;margin:auto 0;height:100%;max-height:16px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{top:93px;right:36px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{right:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{left:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{right:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}}@media (min-width:782px){.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:109px}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{top:0;left:0;bottom:0;right:0}@media (min-width:600px){.wp-block-navigation__responsive-close{pointer-events:none}.wp-block-navigation__responsive-close .block-editor-block-list__layout *,.wp-block-navigation__responsive-close .wp-block-navigation__responsive-container-close{pointer-events:all}}.wp-block-navigation__responsive-close .wp-block-pages-list__item__link{pointer-events:none}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{padding:0;height:auto;color:inherit}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation .components-spinner{padding:8px 12px}.wp-block-navigation__unsaved-changes{position:relative}.wp-block-navigation__unsaved-changes .components-spinner{position:absolute;top:calc(50% - 8px);right:calc(50% - 8px);opacity:0;animation:fadein .5s linear 2s normal forwards}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation__unsaved-changes-overlay.is-saving{opacity:1;animation:fadeouthalf .5s linear 2s normal forwards}.wp-block-navigation-delete-menu-button{width:100%;justify-content:center;margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{display:flex;align-items:center;width:100%;background-color:#f0f0f0;padding:0 24px;height:64px;margin-bottom:12px}.wp-block-navigation__overlay-menu-preview.open{box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent;background-color:#fff}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;overflow:visible!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px 16px 16px auto}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden}.wp-block-navigation-link__placeholder{position:relative;text-decoration:none!important;box-shadow:none!important;background-image:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(-45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(-135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:100% 100%;background-size:6px 3px;background-repeat:repeat-x;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{visibility:visible!important;opacity:1!important;min-width:200px!important;height:auto!important;width:auto!important;position:absolute;right:-1px;top:100%}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{content:"";position:absolute;left:100%;height:100%;display:block;width:.5em;background:transparent}}.block-editor-block-list__block[data-type="core/nextpage"]{max-width:100%;text-align:center;margin-top:28px;margin-bottom:28px}.wp-block-nextpage{display:block;text-align:center;white-space:nowrap}.wp-block-nextpage>span{font-size:13px;position:relative;text-transform:uppercase;font-weight:600;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;color:#757575;border-radius:4px;background:#fff;padding:6px 8px;height:24px}.wp-block-nextpage:before{content:"";position:absolute;top:50%;right:0;left:0;border-top:3px dashed #ccc}.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;justify-content:flex-end;gap:12px}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{visibility:visible;opacity:1;width:auto;height:auto;min-width:200px}.wp-block-page-list .components-notice{margin-right:0}.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:0}.wp-block-post-excerpt .wp-block-post-excerpt__excerpt.is-inline{display:inline-block}.wp-block-pullquote.has-text-align-left p,.wp-block-pullquote.has-text-align-right p,.wp-block[data-align=left]>.wp-block-pullquote p,.wp-block[data-align=right]>.wp-block-pullquote p{font-size:20px}.wp-block-pullquote blockquote p{font-size:28px;line-height:1.6}.wp-block-pullquote.is-style-solid-color blockquote p{font-size:32px}.wp-block-pullquote.is-style-solid-color .wp-block-pullquote__citation{text-transform:none;font-style:normal}.wp-block-pullquote .wp-block-pullquote__citation{color:inherit}.wp-block-rss li a>div{display:inline}.wp-block-rss__placeholder-form{display:flex;align-items:stretch}.wp-block-rss__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.wp-block-rss__placeholder-form>*{margin-bottom:0}}.wp-block-rss__placeholder-input{display:flex;align-items:stretch;flex-grow:1}.wp-block-rss__placeholder-input .components-base-control__field{display:flex;align-items:stretch;flex-grow:1;margin:0 0 0 8px}.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{height:auto;border-radius:initial;display:flex;align-items:center}.wp-block-search__components-button-group{margin-top:10px}.block-editor-block-list__block[data-type="core/separator"]{padding-top:.1px;padding-bottom:.1px}.block-editor-block-list__block[data-type="core/separator"].wp-block-separator.is-style-dots{background:none!important}[data-type="core/shortcode"] .block-editor-plain-text{max-height:250px}[data-type="core/shortcode"].components-placeholder{min-height:0}.blocks-shortcode__textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.blocks-shortcode__textarea{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.blocks-shortcode__textarea{font-size:13px;line-height:normal}}.blocks-shortcode__textarea:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.blocks-shortcode__textarea::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.blocks-shortcode__textarea::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.blocks-shortcode__textarea:-ms-input-placeholder{color:rgba(30,30,30,.62)}.wp-block-site-logo.aligncenter>div,.wp-block[data-align=center]>.wp-block-site-logo{display:table;margin-right:auto;margin-left:auto}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{display:flex;justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}.wp-block-site-tagline__placeholder,.wp-block-site-title__placeholder{padding:1em 0;border:1px dashed}.wp-block-social-links .wp-social-link{line-height:0}.wp-block-social-links .wp-social-link button{font-size:inherit;color:currentColor;height:auto;line-height:0;padding:.25em}.wp-block-social-links.is-style-pill-shape .wp-social-link button{padding-right:.66667em;padding-left:.66667em}.wp-block-social-links.is-style-logos-only .wp-social-link button{padding:0}.wp-block-social-links div.block-editor-url-input{display:inline-block;margin-right:8px}.wp-block-social-links.wp-block-social-links{background:none}.wp-social-link:hover{transform:none}.editor-styles-wrapper .wp-block-social-links{padding:0}.wp-block-social-links__social-placeholder{display:flex;opacity:.8;list-style:none}.wp-block-social-links__social-placeholder>.wp-social-link{padding-right:0!important;margin-right:0!important;padding-left:0!important;margin-left:0!important;width:0!important;visibility:hidden}.wp-block-social-links__social-placeholder>.wp-block-social-links__social-placeholder-icons{display:flex}.wp-block-social-links__social-placeholder .wp-social-link{padding:.25em}.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link{padding-right:.66667em;padding-left:.66667em}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link{padding:0}.wp-block-social-links__social-placeholder .wp-social-link:before{content:"";display:block;width:1em;height:1em;border-radius:50%}.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link:before{background:currentColor}.wp-block-social-links .wp-block-social-links__social-prompt{min-height:24px;list-style:none;order:2;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:24px;margin-top:auto;margin-bottom:auto;cursor:default;padding-left:8px}.wp-block[data-align=center]>.wp-block-social-links{justify-content:center}.block-editor-block-preview__content .components-button:disabled{opacity:1}.wp-social-link.wp-social-link__is-incomplete{opacity:.5}@media (prefers-reduced-motion:reduce){.wp-social-link.wp-social-link__is-incomplete{transition-duration:0s;transition-delay:0s}}.wp-block-social-links .is-selected .wp-social-link__is-incomplete,.wp-social-link.wp-social-link__is-incomplete:focus,.wp-social-link.wp-social-link__is-incomplete:hover{opacity:1}.block-editor-block-list__block[data-type="core/spacer"]:before{content:"";display:block;position:absolute;z-index:1;width:100%;min-height:8px;min-width:8px;height:100%}.block-library-spacer__resize-container.has-show-handle,.wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:rgba(0,0,0,.1)}.is-dark-theme .block-library-spacer__resize-container.has-show-handle,.is-dark-theme .wp-block-spacer.is-hovered .block-library-spacer__resize-container{background:hsla(0,0%,100%,.15)}.block-library-spacer__resize-container{clear:both}.block-library-spacer__resize-container:not(.is-resizing){height:100%!important;width:100%!important}.block-library-spacer__resize-container .components-resizable-box__handle:before{content:none}.block-library-spacer__resize-container.resize-horizontal{margin-bottom:0}.wp-block-table{margin:0}.wp-block[data-align=center]>.wp-block-table,.wp-block[data-align=left]>.wp-block-table,.wp-block[data-align=right]>.wp-block-table{height:auto}.wp-block[data-align=center]>.wp-block-table table,.wp-block[data-align=left]>.wp-block-table table,.wp-block[data-align=right]>.wp-block-table table{width:auto}.wp-block[data-align=center]>.wp-block-table td,.wp-block[data-align=center]>.wp-block-table th,.wp-block[data-align=left]>.wp-block-table td,.wp-block[data-align=left]>.wp-block-table th,.wp-block[data-align=right]>.wp-block-table td,.wp-block[data-align=right]>.wp-block-table th{word-break:break-word}.wp-block[data-align=center]>.wp-block-table{text-align:initial}.wp-block[data-align=center]>.wp-block-table table{margin:0 auto}.wp-block-table td,.wp-block-table th{border:1px solid}.wp-block-table td.is-selected,.wp-block-table th.is-selected{border-color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);border-style:double}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.blocks-table__placeholder-form.blocks-table__placeholder-form{display:flex;flex-direction:column;align-items:flex-start}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:8px}@media (min-width:782px){.blocks-table__placeholder-form.blocks-table__placeholder-form{flex-direction:row;align-items:flex-end}.blocks-table__placeholder-form.blocks-table__placeholder-form>*{margin-bottom:0}}.blocks-table__placeholder-input{width:112px;margin-left:8px;margin-bottom:0}.blocks-table__placeholder-input input{height:36px}.blocks-table__placeholder-input .components-base-control__field{margin-bottom:0}@media (min-width:600px){.block-editor-template-part__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-template-part__selection-modal{width:750px}}@media (min-width:960px){.block-editor-template-part__selection-modal{height:70%}}.wp-block-text-columns .block-editor-rich-text__editable:focus{outline:1px solid #ddd}.wp-block[data-align=center]>.wp-block-video{text-align:center}.wp-block-video{position:relative}.wp-block-video.is-transient video{opacity:.3}.wp-block-video .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.editor-video-poster-control .components-base-control__label{display:block}.editor-video-poster-control .components-button{margin-left:8px}.block-library-video-tracks-editor{z-index:159990}.block-library-video-tracks-editor>.components-popover__content{width:360px}.block-library-video-tracks-editor__track-list-track{display:flex;place-content:space-between;align-items:baseline;padding-right:12px}.block-library-video-tracks-editor__single-track-editor-label-language{display:flex;margin-top:12px}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control{width:50%}.block-library-video-tracks-editor__single-track-editor-label-language>.components-base-control:first-child{margin-left:16px}.block-library-video-tracks-editor__single-track-editor-kind-select{max-width:240px}.block-library-video-tracks-editor__single-track-editor-buttons-container{display:flex;place-content:space-between;margin-top:32px}.block-library-video-tracks-editor__single-track-editor-edit-track-label{margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;display:block}.block-library-video-tracks-editor>.components-popover__content>div,.block-library-video-tracks-editor__add-tracks-container .components-menu-group__label,.block-library-video-tracks-editor__track-list .components-menu-group__label{padding:0}.block-library-video-tracks-editor__add-tracks-container,.block-library-video-tracks-editor__single-track-editor,.block-library-video-tracks-editor__track-list{padding:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__label{margin-bottom:4px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-base-control__field{margin-bottom:12px}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-text-control__input{margin-right:0}.block-library-video-tracks-editor__single-track-editor .components-base-control .components-input-control__label{margin-bottom:4px}.editor-styles-wrapper ul.wp-block-post-template{padding-right:0;margin-right:0;list-style:none}.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 56px 16px 16px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-editor-query-pattern__selection-modal .components-modal__content{overflow:hidden;padding:0}.block-editor-query-pattern__selection-modal .components-modal__content:before{margin-bottom:0}@media (min-width:600px){.block-editor-query-pattern__selection-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.block-editor-query-pattern__selection-modal{width:750px}}@media (min-width:960px){.block-editor-query-pattern__selection-modal{height:80%;width:80%;max-height:none}}.wp-block[data-align=center]>.wp-block-query-pagination{justify-content:center}.editor-styles-wrapper .wp-block-query-pagination{max-width:100%}.editor-styles-wrapper .wp-block-query-pagination.block-editor-block-list__layout{margin:0}.wp-block-query-pagination>.wp-block-query-pagination-next,.wp-block-query-pagination>.wp-block-query-pagination-numbers,.wp-block-query-pagination>.wp-block-query-pagination-previous{margin-top:.5em;margin-right:.5em;margin-bottom:.5em}.wp-block-query-pagination>.wp-block-query-pagination-next:last-child,.wp-block-query-pagination>.wp-block-query-pagination-numbers:last-child,.wp-block-query-pagination>.wp-block-query-pagination-previous:last-child{margin-right:0}.wp-block-query-pagination-numbers a{text-decoration:underline}.wp-block-query-pagination-numbers .page-numbers{margin-left:2px}.wp-block-query-pagination-numbers .page-numbers:last-child{margin-right:0}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container{border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;color:currentColor;background:transparent;min-height:200px}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder:before,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.4;pointer-events:none;border-radius:inherit}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset{width:auto}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button>svg,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button>svg{color:#fff}.wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration,.wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.4}.wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder{min-height:48px;min-width:48px;height:100%;width:100%}.wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}div[data-type="core/post-featured-image"] img{max-width:100%;height:auto;display:block}.wp-block-post-comments-form *,.wp-block-post-comments__placeholder *{pointer-events:none}.wp-block-post-comments-form .block-editor-warning *{pointer-events:auto}:root .editor-styles-wrapper .has-very-light-gray-background-color{background-color:#eee}:root .editor-styles-wrapper .has-very-dark-gray-background-color{background-color:#313131}:root .editor-styles-wrapper .has-very-light-gray-color{color:#eee}:root .editor-styles-wrapper .has-very-dark-gray-color{color:#313131}:root .editor-styles-wrapper .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(-135deg,#00d084,#0693e3)}:root .editor-styles-wrapper .has-purple-crush-gradient-background{background:linear-gradient(-135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .editor-styles-wrapper .has-hazy-dawn-gradient-background{background:linear-gradient(-135deg,#faaca8,#dad0ec)}:root .editor-styles-wrapper .has-subdued-olive-gradient-background{background:linear-gradient(-135deg,#fafae1,#67a671)}:root .editor-styles-wrapper .has-atomic-cream-gradient-background{background:linear-gradient(-135deg,#fdd79a,#004a59)}:root .editor-styles-wrapper .has-nightshade-gradient-background{background:linear-gradient(-135deg,#330968,#31cdcf)}:root .editor-styles-wrapper .has-midnight-gradient-background{background:linear-gradient(-135deg,#020381,#2874fc)}.editor-styles-wrapper{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}.editor-styles-wrapper .has-regular-font-size{font-size:16px}.editor-styles-wrapper .has-larger-font-size{font-size:42px}.editor-styles-wrapper .has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.editor-styles-wrapper .has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.wp-block-audio figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-audio figcaption{color:hsla(0,0%,100%,.65)}.wp-block-code{border:1px solid #ccc;border-radius:4px;font-family:Menlo,Consolas,monaco,monospace;padding:.8em 1em}.wp-block-embed figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-embed figcaption{color:hsla(0,0%,100%,.65)}.blocks-gallery-caption{color:#555;font-size:13px;text-align:center}.is-dark-theme .blocks-gallery-caption{color:hsla(0,0%,100%,.65)}.wp-block-image figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-image figcaption{color:hsla(0,0%,100%,.65)}.wp-block-pullquote{border-top:4px solid;border-bottom:4px solid;margin-bottom:1.75em;color:currentColor}.wp-block-pullquote__citation,.wp-block-pullquote cite,.wp-block-pullquote footer{color:currentColor;text-transform:uppercase;font-size:.8125em;font-style:normal}.wp-block-quote{border-right:.25em solid;margin:0 0 1.75em;padding-right:1em}.wp-block-quote cite,.wp-block-quote footer{color:currentColor;font-size:.8125em;position:relative;font-style:normal}.wp-block-quote.has-text-align-right{border-right:none;border-left:.25em solid;padding-right:0;padding-left:1em}.wp-block-quote.has-text-align-center{border:none;padding-right:0}.wp-block-quote.is-large,.wp-block-quote.is-style-large,.wp-block-quote.is-style-plain{border:none}.wp-block-search .wp-block-search__label{font-weight:700}:where(.wp-block-group.has-background){padding:1.25em 2.375em}.wp-block-separator.has-css-opacity{opacity:.4}.wp-block-separator{border:none;border-bottom:2px solid;margin-right:auto;margin-left:auto}.wp-block-separator.has-alpha-channel-opacity{opacity:1}.wp-block-separator:not(.is-style-wide):not(.is-style-dots){width:100px}.wp-block-separator.has-background:not(.is-style-dots){border-bottom:none;height:1px}.wp-block-separator.has-background:not(.is-style-wide):not(.is-style-dots){height:2px}.wp-block-table thead{border-bottom:3px solid}.wp-block-table tfoot{border-top:3px solid}.wp-block-table td,.wp-block-table th{padding:.5em;border:1px solid;word-break:normal}.wp-block-table figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-table figcaption{color:hsla(0,0%,100%,.65)}.wp-block-video figcaption{color:#555;font-size:13px;text-align:center}.is-dark-theme .wp-block-video figcaption{color:hsla(0,0%,100%,.65)}.wp-block-template-part.has-background{padding:1.25em 2.375em;margin-top:0;margin-bottom:0}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -.wp-block-archives-dropdown label { - display: block; -} - -.wp-block-avatar.aligncenter { - text-align: center; -} - -.wp-block-audio { - margin: 0 0 1em 0; -} -.wp-block-audio figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-audio audio { - width: 100%; - min-width: 300px; -} - -.wp-block-button__link { - color: #fff; - background-color: #32373c; - border-radius: 9999px; - box-shadow: none; - cursor: pointer; - display: inline-block; - font-size: 1.125em; - padding: calc(0.667em + 2px) calc(1.333em + 2px); - text-align: center; - text-decoration: none; - word-break: break-word; - box-sizing: border-box; -} -.wp-block-button__link:hover, .wp-block-button__link:focus, .wp-block-button__link:active, .wp-block-button__link:visited { - color: #fff; -} -.wp-block-button__link.aligncenter { - text-align: center; -} -.wp-block-button__link.alignright { - /*rtl:ignore*/ - text-align: right; -} - -.wp-block-buttons > .wp-block-button.has-custom-width { - max-width: none; -} -.wp-block-buttons > .wp-block-button.has-custom-width .wp-block-button__link { - width: 100%; -} -.wp-block-buttons > .wp-block-button.has-custom-font-size .wp-block-button__link { - font-size: inherit; -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-25 { - width: calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-50 { - width: calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-75 { - width: calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25)); -} -.wp-block-buttons > .wp-block-button.wp-block-button__width-100 { - width: 100%; - flex-basis: 100%; -} - -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-25 { - width: 25%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-50 { - width: 50%; -} -.wp-block-buttons.is-vertical > .wp-block-button.wp-block-button__width-75 { - width: 75%; -} - -.wp-block-button.is-style-squared, -.wp-block-button__link.wp-block-button.is-style-squared { - border-radius: 0; -} - -.wp-block-button.no-border-radius, -.wp-block-button__link.no-border-radius { - border-radius: 0 !important; -} - -.is-style-outline > :where(.wp-block-button__link), -:where(.wp-block-button__link).is-style-outline { - border: 2px solid currentColor; - padding: 0.667em 1.333em; -} - -.is-style-outline > .wp-block-button__link:not(.has-text-color), -.wp-block-button__link.is-style-outline:not(.has-text-color) { - color: currentColor; -} - -.is-style-outline > .wp-block-button__link:not(.has-background), -.wp-block-button__link.is-style-outline:not(.has-background) { - background-color: transparent; -} - -.wp-block-buttons { - /* stylelint-disable indentation */ -} -.wp-block-buttons.is-vertical { - flex-direction: column; -} -.wp-block-buttons.is-vertical > .wp-block-button:last-child { - margin-bottom: 0; -} -.wp-block-buttons > .wp-block-button { - display: inline-block; - margin: 0; -} -.wp-block-buttons.is-content-justification-left { - justify-content: flex-start; -} -.wp-block-buttons.is-content-justification-left.is-vertical { - align-items: flex-start; -} -.wp-block-buttons.is-content-justification-center { - justify-content: center; -} -.wp-block-buttons.is-content-justification-center.is-vertical { - align-items: center; -} -.wp-block-buttons.is-content-justification-right { - justify-content: flex-end; -} -.wp-block-buttons.is-content-justification-right.is-vertical { - align-items: flex-end; -} -.wp-block-buttons.is-content-justification-space-between { - justify-content: space-between; -} -.wp-block-buttons.aligncenter { - text-align: center; -} -.wp-block-buttons:not(.is-content-justification-space-between, -.is-content-justification-right, -.is-content-justification-left, -.is-content-justification-center) .wp-block-button.aligncenter { - /* stylelint-enable indentation */ - margin-left: auto; - margin-right: auto; - width: 100%; -} - -.wp-block-button.aligncenter { - text-align: center; -} - -.wp-block-calendar { - text-align: center; -} -.wp-block-calendar th, -.wp-block-calendar tbody td { - padding: 0.25em; - border: 1px solid #ddd; -} -.wp-block-calendar tfoot td { - border: none; -} -.wp-block-calendar table { - width: 100%; - border-collapse: collapse; -} -.wp-block-calendar table th { - font-weight: 400; - background: #ddd; -} -.wp-block-calendar a { - text-decoration: underline; -} -.wp-block-calendar table tbody, -.wp-block-calendar table caption { - color: #40464d; -} - -.wp-block-categories.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -.wp-block-categories.alignright { - /*rtl:ignore*/ - margin-left: 2em; -} - -.wp-block-code code { - display: block; - font-family: inherit; - overflow-wrap: break-word; - white-space: pre-wrap; -} - -.wp-block-columns { - display: flex; - margin-bottom: 1.75em; - box-sizing: border-box; - flex-wrap: wrap !important; - align-items: initial !important; - /** - * All Columns Alignment - */ -} -@media (min-width: 782px) { - .wp-block-columns { - flex-wrap: nowrap !important; - } -} -.wp-block-columns.are-vertically-aligned-top { - align-items: flex-start; -} -.wp-block-columns.are-vertically-aligned-center { - align-items: center; -} -.wp-block-columns.are-vertically-aligned-bottom { - align-items: flex-end; -} -@media (max-width: 781px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 100% !important; - } -} -@media (min-width: 782px) { - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column { - flex-basis: 0; - flex-grow: 1; - } - .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column[style*=flex-basis] { - flex-grow: 0; - } -} -.wp-block-columns.is-not-stacked-on-mobile { - flex-wrap: nowrap !important; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column { - flex-basis: 0; - flex-grow: 1; -} -.wp-block-columns.is-not-stacked-on-mobile > .wp-block-column[style*=flex-basis] { - flex-grow: 0; -} - -:where(.wp-block-columns.has-background) { - padding: 1.25em 2.375em; -} - -.wp-block-column { - flex-grow: 1; - min-width: 0; - word-break: break-word; - overflow-wrap: break-word; - /** - * Individual Column Alignment - */ -} -.wp-block-column.is-vertically-aligned-top { - align-self: flex-start; -} -.wp-block-column.is-vertically-aligned-center { - align-self: center; -} -.wp-block-column.is-vertically-aligned-bottom { - align-self: flex-end; -} -.wp-block-column.is-vertically-aligned-top, .wp-block-column.is-vertically-aligned-center, .wp-block-column.is-vertically-aligned-bottom { - width: 100%; -} - -.wp-block-comments-pagination > .wp-block-comments-pagination-next, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers { - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-comments-pagination > .wp-block-comments-pagination-next:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-previous:last-child, -.wp-block-comments-pagination > .wp-block-comments-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-comments-pagination .wp-block-comments-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-comments-pagination.aligncenter { - justify-content: center; -} - -.wp-block-comment-template { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-comment-template li { - clear: both; -} -.wp-block-comment-template ol { - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding-left: 2rem; -} - -.wp-block-cover-image, -.wp-block-cover { - position: relative; - background-size: cover; - background-position: center center; - min-height: 430px; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - padding: 1em; - box-sizing: border-box; - /** - * Set a default background color for has-background-dim _unless_ it includes another - * background-color class (e.g. has-green-background-color). The presence of another - * background-color class implies that another style will provide the background color - * for the overlay. - * - * See: - * - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545 - * - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545 - */ -} -.wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: fixed; -} -@supports (-webkit-touch-callout: inherit) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -@media (prefers-reduced-motion: reduce) { - .wp-block-cover-image.has-parallax, -.wp-block-cover.has-parallax { - background-attachment: scroll; - } -} -.wp-block-cover-image.is-repeated, -.wp-block-cover.is-repeated { - background-repeat: repeat; - background-size: auto; -} -.wp-block-cover-image.has-background-dim:not([class*=-background-color]), -.wp-block-cover-image .has-background-dim:not([class*=-background-color]), -.wp-block-cover.has-background-dim:not([class*=-background-color]), -.wp-block-cover .has-background-dim:not([class*=-background-color]) { - background-color: #000; -} -.wp-block-cover-image .has-background-dim.has-background-gradient, -.wp-block-cover .has-background-dim.has-background-gradient { - background-color: transparent; -} -.wp-block-cover-image.has-background-dim::before, -.wp-block-cover.has-background-dim::before { - content: ""; - background-color: inherit; -} -.wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover-image .wp-block-cover__background, -.wp-block-cover-image .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim:not(.has-background-gradient)::before, -.wp-block-cover .wp-block-cover__background, -.wp-block-cover .wp-block-cover__gradient-background { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 1; - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-10 .wp-block-cover__gradient-background { - opacity: 0.1; -} -.wp-block-cover-image.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-20:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-20 .wp-block-cover__gradient-background { - opacity: 0.2; -} -.wp-block-cover-image.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-30:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-30 .wp-block-cover__gradient-background { - opacity: 0.3; -} -.wp-block-cover-image.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-40:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-40 .wp-block-cover__gradient-background { - opacity: 0.4; -} -.wp-block-cover-image.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-50:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-50 .wp-block-cover__gradient-background { - opacity: 0.5; -} -.wp-block-cover-image.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-60:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-60 .wp-block-cover__gradient-background { - opacity: 0.6; -} -.wp-block-cover-image.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-70:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-70 .wp-block-cover__gradient-background { - opacity: 0.7; -} -.wp-block-cover-image.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-80:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-80 .wp-block-cover__gradient-background { - opacity: 0.8; -} -.wp-block-cover-image.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-90:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-90 .wp-block-cover__gradient-background { - opacity: 0.9; -} -.wp-block-cover-image.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover-image.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background, -.wp-block-cover.has-background-dim.has-background-dim-100:not(.has-background-gradient)::before, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__background, -.wp-block-cover.has-background-dim.has-background-dim-100 .wp-block-cover__gradient-background { - opacity: 1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-0, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-0 { - opacity: 0; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-10, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-10 { - opacity: 0.1; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-20, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-20 { - opacity: 0.2; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-30, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-30 { - opacity: 0.3; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-40, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-40 { - opacity: 0.4; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-50, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-50 { - opacity: 0.5; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-60, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-60 { - opacity: 0.6; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-70, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-70 { - opacity: 0.7; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-80, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-80 { - opacity: 0.8; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-90, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-90 { - opacity: 0.9; -} -.wp-block-cover-image .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover-image .wp-block-cover__background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__gradient-background.has-background-dim.has-background-dim-100, -.wp-block-cover .wp-block-cover__background.has-background-dim.has-background-dim-100 { - opacity: 1; -} -.wp-block-cover-image .block-library-cover__padding-visualizer, -.wp-block-cover .block-library-cover__padding-visualizer { - z-index: 2; -} -.wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-cover-image::after, -.wp-block-cover::after { - display: block; - content: ""; - font-size: 0; - min-height: inherit; -} -@supports (position: sticky) { - .wp-block-cover-image::after, -.wp-block-cover::after { - content: none; - } -} -.wp-block-cover-image.aligncenter, .wp-block-cover-image.alignleft, .wp-block-cover-image.alignright, -.wp-block-cover.aligncenter, -.wp-block-cover.alignleft, -.wp-block-cover.alignright { - display: flex; -} -.wp-block-cover-image .wp-block-cover__inner-container, -.wp-block-cover .wp-block-cover__inner-container { - width: 100%; - z-index: 1; - color: #fff; -} -.wp-block-cover-image.is-light .wp-block-cover__inner-container, -.wp-block-cover.is-light .wp-block-cover__inner-container { - color: #000; -} -.wp-block-cover-image p:not(.has-text-color), -.wp-block-cover-image h1:not(.has-text-color), -.wp-block-cover-image h2:not(.has-text-color), -.wp-block-cover-image h3:not(.has-text-color), -.wp-block-cover-image h4:not(.has-text-color), -.wp-block-cover-image h5:not(.has-text-color), -.wp-block-cover-image h6:not(.has-text-color), -.wp-block-cover p:not(.has-text-color), -.wp-block-cover h1:not(.has-text-color), -.wp-block-cover h2:not(.has-text-color), -.wp-block-cover h3:not(.has-text-color), -.wp-block-cover h4:not(.has-text-color), -.wp-block-cover h5:not(.has-text-color), -.wp-block-cover h6:not(.has-text-color) { - color: inherit; -} -.wp-block-cover-image.is-position-top-left, -.wp-block-cover.is-position-top-left { - align-items: flex-start; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-top-center, -.wp-block-cover.is-position-top-center { - align-items: flex-start; - justify-content: center; -} -.wp-block-cover-image.is-position-top-right, -.wp-block-cover.is-position-top-right { - align-items: flex-start; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-center-left, -.wp-block-cover.is-position-center-left { - align-items: center; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-center-center, -.wp-block-cover.is-position-center-center { - align-items: center; - justify-content: center; -} -.wp-block-cover-image.is-position-center-right, -.wp-block-cover.is-position-center-right { - align-items: center; - justify-content: flex-end; -} -.wp-block-cover-image.is-position-bottom-left, -.wp-block-cover.is-position-bottom-left { - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-cover-image.is-position-bottom-center, -.wp-block-cover.is-position-bottom-center { - align-items: flex-end; - justify-content: center; -} -.wp-block-cover-image.is-position-bottom-right, -.wp-block-cover.is-position-bottom-right { - align-items: flex-end; - justify-content: flex-end; -} -.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container, -.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container { - margin: 0; - width: auto; -} -.wp-block-cover-image img.wp-block-cover__image-background, -.wp-block-cover-image video.wp-block-cover__video-background, -.wp-block-cover img.wp-block-cover__image-background, -.wp-block-cover video.wp-block-cover__video-background { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - max-width: none; - max-height: none; - -o-object-fit: cover; - object-fit: cover; - outline: none; - border: none; - box-shadow: none; -} - -.wp-block-cover__video-background { - z-index: 0; -} - -.wp-block-cover__image-background { - z-index: 0; -} - -section.wp-block-cover-image h2, -.wp-block-cover-image-text, -.wp-block-cover-text { - color: #fff; -} -section.wp-block-cover-image h2 a, -section.wp-block-cover-image h2 a:hover, -section.wp-block-cover-image h2 a:focus, -section.wp-block-cover-image h2 a:active, -.wp-block-cover-image-text a, -.wp-block-cover-image-text a:hover, -.wp-block-cover-image-text a:focus, -.wp-block-cover-image-text a:active, -.wp-block-cover-text a, -.wp-block-cover-text a:hover, -.wp-block-cover-text a:focus, -.wp-block-cover-text a:active { - color: #fff; -} - -.wp-block-cover-image .wp-block-cover.has-left-content { - justify-content: flex-start; -} -.wp-block-cover-image .wp-block-cover.has-right-content { - justify-content: flex-end; -} - -section.wp-block-cover-image.has-left-content > h2, -.wp-block-cover-image.has-left-content .wp-block-cover-image-text, -.wp-block-cover.has-left-content .wp-block-cover-text { - margin-left: 0; - text-align: left; -} - -section.wp-block-cover-image.has-right-content > h2, -.wp-block-cover-image.has-right-content .wp-block-cover-image-text, -.wp-block-cover.has-right-content .wp-block-cover-text { - margin-right: 0; - text-align: right; -} - -section.wp-block-cover-image > h2, -.wp-block-cover-image .wp-block-cover-image-text, -.wp-block-cover .wp-block-cover-text { - font-size: 2em; - line-height: 1.25; - z-index: 1; - margin-bottom: 0; - max-width: 840px; - padding: 0.44em; - text-align: center; -} - -.wp-block[data-align=left] > [data-type="core/embed"], -.wp-block[data-align=right] > [data-type="core/embed"], -.wp-block-embed.alignleft, -.wp-block-embed.alignright { - max-width: 360px; - width: 100%; -} -.wp-block[data-align=left] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block[data-align=right] > [data-type="core/embed"] .wp-block-embed__wrapper, -.wp-block-embed.alignleft .wp-block-embed__wrapper, -.wp-block-embed.alignright .wp-block-embed__wrapper { - min-width: 280px; -} - -.wp-block-cover .wp-block-embed { - min-width: 320px; - min-height: 240px; -} - -.wp-block-embed { - margin: 0 0 1em 0; - overflow-wrap: break-word; -} -.wp-block-embed figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-embed iframe { - max-width: 100%; -} - -.wp-block-embed__wrapper { - position: relative; -} - -.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper::before { - content: ""; - display: block; - padding-top: 50%; -} -.wp-embed-responsive .wp-has-aspect-ratio iframe { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - height: 100%; - width: 100%; -} - -.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { - padding-top: 42.85%; -} -.wp-embed-responsive .wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { - padding-top: 50%; -} -.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { - padding-top: 56.25%; -} -.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { - padding-top: 75%; -} -.wp-embed-responsive .wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { - padding-top: 100%; -} -.wp-embed-responsive .wp-embed-aspect-9-16 .wp-block-embed__wrapper::before { - padding-top: 177.77%; -} -.wp-embed-responsive .wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { - padding-top: 200%; -} - -.wp-block-file { - margin-bottom: 1.5em; -} -.wp-block-file.aligncenter { - text-align: center; -} -.wp-block-file.alignright { - /*rtl:ignore*/ - text-align: right; -} -.wp-block-file .wp-block-file__embed { - margin-bottom: 1em; -} -.wp-block-file .wp-block-file__button { - background: #32373c; - border-radius: 2em; - color: #fff; - font-size: 0.8em; - padding: 0.5em 1em; -} -.wp-block-file a.wp-block-file__button { - text-decoration: none; -} -.wp-block-file a.wp-block-file__button:hover, .wp-block-file a.wp-block-file__button:visited, .wp-block-file a.wp-block-file__button:focus, .wp-block-file a.wp-block-file__button:active { - box-shadow: none; - color: #fff; - opacity: 0.85; - text-decoration: none; -} -.wp-block-file * + .wp-block-file__button { - margin-left: 0.75em; -} - -.wp-block-gallery:not(.has-nested-images), -.blocks-gallery-grid:not(.has-nested-images) { - display: flex; - flex-wrap: wrap; - list-style-type: none; - padding: 0; - margin: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item { - margin: 0 1em 1em 0; - display: flex; - flex-grow: 1; - flex-direction: column; - justify-content: center; - position: relative; - width: calc(50% - 1em); -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:nth-of-type(even), -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:nth-of-type(even) { - margin-right: 0; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figure, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figure, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figure { - margin: 0; - height: 100%; - display: flex; - align-items: flex-end; - justify-content: flex-start; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item img { - display: block; - max-width: 100%; - height: auto; - width: auto; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption { - position: absolute; - bottom: 0; - width: 100%; - max-height: 100%; - overflow: auto; - padding: 3em 0.77em 0.7em; - color: #fff; - text-align: center; - font-size: 0.8em; - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - box-sizing: border-box; - margin: 0; - z-index: 2; -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image figcaption img, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image figcaption img, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item figcaption img { - display: inline; -} -.wp-block-gallery:not(.has-nested-images) figcaption, -.blocks-gallery-grid:not(.has-nested-images) figcaption { - flex-grow: 1; -} -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-image img, .wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.wp-block-gallery:not(.has-nested-images).is-cropped .blocks-gallery-item img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-image img, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item a, -.blocks-gallery-grid:not(.has-nested-images).is-cropped .blocks-gallery-item img { - width: 100%; - height: 100%; - flex: 1; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item { - width: 100%; - margin-right: 0; -} -@media (min-width: 600px) { - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item { - width: calc(33.3333333333% - 0.6666666667em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item { - width: calc(25% - 0.75em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item { - width: calc(20% - 0.8em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item { - width: calc(16.6666666667% - 0.8333333333em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item { - width: calc(14.2857142857% - 0.8571428571em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image, .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image, -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item { - width: calc(12.5% - 0.875em); - margin-right: 1em; - } - .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), .wp-block-gallery:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-image:nth-of-type(1n), -.blocks-gallery-grid:not(.has-nested-images).columns-1 .blocks-gallery-item:nth-of-type(1n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), .wp-block-gallery:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-image:nth-of-type(2n), -.blocks-gallery-grid:not(.has-nested-images).columns-2 .blocks-gallery-item:nth-of-type(2n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), .wp-block-gallery:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-image:nth-of-type(3n), -.blocks-gallery-grid:not(.has-nested-images).columns-3 .blocks-gallery-item:nth-of-type(3n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), .wp-block-gallery:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-image:nth-of-type(4n), -.blocks-gallery-grid:not(.has-nested-images).columns-4 .blocks-gallery-item:nth-of-type(4n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), .wp-block-gallery:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-image:nth-of-type(5n), -.blocks-gallery-grid:not(.has-nested-images).columns-5 .blocks-gallery-item:nth-of-type(5n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), .wp-block-gallery:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-image:nth-of-type(6n), -.blocks-gallery-grid:not(.has-nested-images).columns-6 .blocks-gallery-item:nth-of-type(6n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), .wp-block-gallery:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-image:nth-of-type(7n), -.blocks-gallery-grid:not(.has-nested-images).columns-7 .blocks-gallery-item:nth-of-type(7n) { - margin-right: 0; - } - .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), .wp-block-gallery:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-image:nth-of-type(8n), -.blocks-gallery-grid:not(.has-nested-images).columns-8 .blocks-gallery-item:nth-of-type(8n) { - margin-right: 0; - } -} -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-image:last-child, -.wp-block-gallery:not(.has-nested-images) .blocks-gallery-item:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-image:last-child, -.blocks-gallery-grid:not(.has-nested-images) .blocks-gallery-item:last-child { - margin-right: 0; -} -.wp-block-gallery:not(.has-nested-images).alignleft, .wp-block-gallery:not(.has-nested-images).alignright, -.blocks-gallery-grid:not(.has-nested-images).alignleft, -.blocks-gallery-grid:not(.has-nested-images).alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery:not(.has-nested-images).aligncenter .blocks-gallery-item figure, -.blocks-gallery-grid:not(.has-nested-images).aligncenter .blocks-gallery-item figure { - justify-content: center; -} - -.wp-block-gallery:not(.is-cropped) .blocks-gallery-item { - align-self: flex-start; -} - -figure.wp-block-gallery.has-nested-images { - align-items: normal; -} - -.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) / 2)); - margin: 0; -} -.wp-block-gallery.has-nested-images figure.wp-block-image { - display: flex; - flex-grow: 1; - justify-content: center; - position: relative; - flex-direction: column; - max-width: 100%; -} -.wp-block-gallery.has-nested-images figure.wp-block-image > div, -.wp-block-gallery.has-nested-images figure.wp-block-image > a { - margin: 0; - flex-direction: column; - flex-grow: 1; -} -.wp-block-gallery.has-nested-images figure.wp-block-image img { - display: block; - height: auto; - max-width: 100% !important; - width: auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption { - background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.3) 70%, transparent); - bottom: 0; - color: #fff; - font-size: 13px; - left: 0; - margin-bottom: 0; - max-height: 60%; - overflow: auto; - padding: 0 8px 8px; - position: absolute; - text-align: center; - width: 100%; - box-sizing: border-box; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img { - display: inline; -} -.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a { - color: inherit; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > div, -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded > a { - flex: 1 1 auto; -} -.wp-block-gallery.has-nested-images figure.wp-block-image.is-style-rounded figcaption { - flex: initial; - background: none; - color: inherit; - margin: 0; - padding: 10px 10px 9px; - position: relative; -} -.wp-block-gallery.has-nested-images figcaption { - flex-grow: 1; - flex-basis: 100%; - text-align: center; -} -.wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image) { - margin-top: 0; - margin-bottom: auto; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) { - align-self: inherit; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > div:not(.components-drop-zone), -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > a { - display: flex; -} -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) a, -.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { - width: 100%; - flex: 1 0 0%; - height: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.wp-block-gallery.has-nested-images.columns-1 figure.wp-block-image:not(#individual-image) { - width: 100%; -} -@media (min-width: 600px) { - .wp-block-gallery.has-nested-images.columns-3 figure.wp-block-image:not(#individual-image) { - width: calc(33.3333333333% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-4 figure.wp-block-image:not(#individual-image) { - width: calc(25% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.75)); - } - .wp-block-gallery.has-nested-images.columns-5 figure.wp-block-image:not(#individual-image) { - width: calc(20% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8)); - } - .wp-block-gallery.has-nested-images.columns-6 figure.wp-block-image:not(#individual-image) { - width: calc(16.6666666667% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8333333333)); - } - .wp-block-gallery.has-nested-images.columns-7 figure.wp-block-image:not(#individual-image) { - width: calc(14.2857142857% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.8571428571)); - } - .wp-block-gallery.has-nested-images.columns-8 figure.wp-block-image:not(#individual-image) { - width: calc(12.5% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.875)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image) { - width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.6666666667)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2), -.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) { - width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5)); - } - .wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) { - width: 100%; - } -} -.wp-block-gallery.has-nested-images.alignleft, .wp-block-gallery.has-nested-images.alignright { - max-width: 420px; - width: 100%; -} -.wp-block-gallery.has-nested-images.aligncenter { - justify-content: center; -} - -.wp-block-group { - box-sizing: border-box; -} - -h1.has-background, -h2.has-background, -h3.has-background, -h4.has-background, -h5.has-background, -h6.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-image { - margin: 0 0 1em 0; -} -.wp-block-image img { - height: auto; - max-width: 100%; - vertical-align: bottom; -} -.wp-block-image:not(.is-style-rounded) > a, -.wp-block-image:not(.is-style-rounded) img { - border-radius: inherit; -} -.wp-block-image.aligncenter { - text-align: center; -} -.wp-block-image.alignfull img, .wp-block-image.alignwide img { - height: auto; - width: 100%; -} -.wp-block-image.alignleft, .wp-block-image.alignright, .wp-block-image.aligncenter, -.wp-block-image .alignleft, -.wp-block-image .alignright, -.wp-block-image .aligncenter { - display: table; -} -.wp-block-image.alignleft > figcaption, .wp-block-image.alignright > figcaption, .wp-block-image.aligncenter > figcaption, -.wp-block-image .alignleft > figcaption, -.wp-block-image .alignright > figcaption, -.wp-block-image .aligncenter > figcaption { - display: table-caption; - caption-side: bottom; -} -.wp-block-image .alignleft { - /*rtl:ignore*/ - float: left; - /*rtl:ignore*/ - margin-left: 0; - margin-right: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .alignright { - /*rtl:ignore*/ - float: right; - /*rtl:ignore*/ - margin-right: 0; - margin-left: 1em; - margin-top: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-image .aligncenter { - margin-left: auto; - margin-right: auto; -} -.wp-block-image figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} -.wp-block-image.is-style-rounded img, -.wp-block-image .is-style-rounded img { - border-radius: 9999px; -} -.wp-block-image.is-style-circle-mask img { - border-radius: 9999px; -} -@supports ((-webkit-mask-image: none) or (mask-image: none)) or (-webkit-mask-image: none) { - .wp-block-image.is-style-circle-mask img { - /* stylelint-disable */ - -webkit-mask-image: url('data:image/svg+xml;utf8,'); - mask-image: url('data:image/svg+xml;utf8,'); - /* stylelint-enable */ - mask-mode: alpha; - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; - -webkit-mask-size: contain; - mask-size: contain; - -webkit-mask-position: center; - mask-position: center; - border-radius: 0; - } -} - -.wp-block-image figure { - margin: 0; -} - -ol.wp-block-latest-comments { - margin-left: 0; -} - -.wp-block-latest-comments .wp-block-latest-comments { - padding-left: 0; -} - -.wp-block-latest-comments__comment { - line-height: 1.1; - list-style: none; - margin-bottom: 1em; -} -.has-avatars .wp-block-latest-comments__comment { - min-height: 2.25em; - list-style: none; -} -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta, -.has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt { - margin-left: 3.25em; -} -.has-dates .wp-block-latest-comments__comment, .has-excerpts .wp-block-latest-comments__comment { - line-height: 1.5; -} - -.wp-block-latest-comments__comment-excerpt p { - font-size: 0.875em; - line-height: 1.8; - margin: 0.36em 0 1.4em; -} - -.wp-block-latest-comments__comment-date { - display: block; - font-size: 0.75em; -} - -.wp-block-latest-comments .avatar, -.wp-block-latest-comments__comment-avatar { - border-radius: 1.5em; - display: block; - float: left; - height: 2.5em; - margin-right: 0.75em; - width: 2.5em; -} - -.wp-block-latest-posts.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -.wp-block-latest-posts.alignright { - /*rtl:ignore*/ - margin-left: 2em; -} -.wp-block-latest-posts.wp-block-latest-posts__list { - list-style: none; - padding-left: 0; -} -.wp-block-latest-posts.wp-block-latest-posts__list li { - clear: both; -} -.wp-block-latest-posts.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; -} -.wp-block-latest-posts.is-grid li { - margin: 0 1.25em 1.25em 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-latest-posts.columns-2 li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-latest-posts.columns-2 li:nth-child(2n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-3 li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-latest-posts.columns-3 li:nth-child(3n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-4 li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-latest-posts.columns-4 li:nth-child(4n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-5 li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-latest-posts.columns-5 li:nth-child(5n) { - margin-right: 0; - } - .wp-block-latest-posts.columns-6 li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } - .wp-block-latest-posts.columns-6 li:nth-child(6n) { - margin-right: 0; - } -} - -.wp-block-latest-posts__post-date, -.wp-block-latest-posts__post-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-latest-posts__post-excerpt { - margin-top: 0.5em; - margin-bottom: 1em; -} - -.wp-block-latest-posts__featured-image a { - display: inline-block; -} -.wp-block-latest-posts__featured-image img { - height: auto; - width: auto; - max-width: 100%; -} -.wp-block-latest-posts__featured-image.alignleft { - /*rtl:ignore*/ - margin-right: 1em; - /*rtl:ignore*/ - float: left; -} -.wp-block-latest-posts__featured-image.alignright { - /*rtl:ignore*/ - margin-left: 1em; - /*rtl:ignore*/ - float: right; -} -.wp-block-latest-posts__featured-image.aligncenter { - margin-bottom: 1em; - text-align: center; -} - -ol, -ul { - box-sizing: border-box; -} -ol.has-background, -ul.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-media-text { - /*!rtl:begin:ignore*/ - direction: ltr; - /*!rtl:end:ignore*/ - display: grid; - grid-template-columns: 50% 1fr; - grid-template-rows: auto; -} -.wp-block-media-text.has-media-on-the-right { - grid-template-columns: 1fr 50%; -} - -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-top .wp-block-media-text__media { - align-self: start; -} - -.wp-block-media-text .wp-block-media-text__content, -.wp-block-media-text .wp-block-media-text__media, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-center .wp-block-media-text__media { - align-self: center; -} - -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__content, -.wp-block-media-text.is-vertically-aligned-bottom .wp-block-media-text__media { - align-self: end; -} - -.wp-block-media-text .wp-block-media-text__media { - /*!rtl:begin:ignore*/ - grid-column: 1; - grid-row: 1; - /*!rtl:end:ignore*/ - margin: 0; -} - -.wp-block-media-text .wp-block-media-text__content { - direction: ltr; - /*!rtl:begin:ignore*/ - grid-column: 2; - grid-row: 1; - /*!rtl:end:ignore*/ - padding: 0 8% 0 8%; - word-break: break-word; -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media { - /*!rtl:begin:ignore*/ - grid-column: 2; - grid-row: 1; - /*!rtl:end:ignore*/ -} - -.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { - /*!rtl:begin:ignore*/ - grid-column: 1; - grid-row: 1; - /*!rtl:end:ignore*/ -} - -.wp-block-media-text__media img, -.wp-block-media-text__media video { - height: auto; - max-width: unset; - width: 100%; - vertical-align: middle; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media { - height: 100%; - min-height: 250px; - background-size: cover; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media > a { - display: block; - height: 100%; -} - -.wp-block-media-text.is-image-fill .wp-block-media-text__media img { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} - -/* -* Here we here not able to use a mobile first CSS approach. -* Custom widths are set using inline styles, and on mobile, -* we need 100% width, so we use important to overwrite the inline style. -* If the style were set on mobile first, on desktop styles, -* we would have no way of setting the style again to the inline style. -*/ -@media (max-width: 600px) { - .wp-block-media-text.is-stacked-on-mobile { - grid-template-columns: 100% !important; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media { - grid-column: 1; - grid-row: 1; - } - .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content { - grid-column: 1; - grid-row: 2; - } -} -.wp-block-navigation { - position: relative; - --navigation-layout-justification-setting: flex-start; - --navigation-layout-direction: row; - --navigation-layout-wrap: wrap; - --navigation-layout-justify: flex-start; - --navigation-layout-align: center; -} -.wp-block-navigation ul { - margin-top: 0; - margin-bottom: 0; - margin-left: 0; - padding-left: 0; -} -.wp-block-navigation ul, -.wp-block-navigation ul li { - list-style: none; - padding: 0; -} -.wp-block-navigation .wp-block-navigation-item { - display: flex; - align-items: center; - position: relative; -} -.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty { - display: none; -} -.wp-block-navigation .wp-block-navigation-item__content { - color: inherit; - display: block; - padding: 0; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active { - text-decoration: underline; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content { - text-decoration: line-through; -} -.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus, .wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active { - text-decoration: line-through; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a { - text-decoration: none; -} -.wp-block-navigation:where(:not([class*="has-text-decoration"])) a:focus, .wp-block-navigation:where(:not([class*="has-text-decoration"])) a:active { - text-decoration: none; -} -.wp-block-navigation .wp-block-navigation__submenu-icon { - align-self: center; - line-height: 0; - display: inline-block; - font-size: inherit; - padding: 0; - background-color: inherit; - color: currentColor; - border: none; - width: 0.6em; - height: 0.6em; - margin-left: 0.25em; -} -.wp-block-navigation .wp-block-navigation__submenu-icon svg { - display: inline-block; - stroke: currentColor; - width: inherit; - height: inherit; - margin-top: 0.075em; -} -.wp-block-navigation.is-vertical { - --navigation-layout-direction: column; - --navigation-layout-justify: initial; - --navigation-layout-align: flex-start; -} -.wp-block-navigation.no-wrap { - --navigation-layout-wrap: nowrap; -} -.wp-block-navigation.items-justified-center { - --navigation-layout-justification-setting: center; - --navigation-layout-justify: center; -} -.wp-block-navigation.items-justified-center.is-vertical { - --navigation-layout-align: center; -} -.wp-block-navigation.items-justified-right { - --navigation-layout-justification-setting: flex-end; - --navigation-layout-justify: flex-end; -} -.wp-block-navigation.items-justified-right.is-vertical { - --navigation-layout-align: flex-end; -} -.wp-block-navigation.items-justified-space-between { - --navigation-layout-justification-setting: space-between; - --navigation-layout-justify: space-between; -} - -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) { - background-color: inherit; - color: inherit; - position: absolute; - z-index: 2; - display: flex; - flex-direction: column; - align-items: normal; - opacity: 0; - transition: opacity 0.1s linear; - visibility: hidden; - width: 0; - height: 0; - overflow: hidden; - left: -1px; - top: 100%; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content { - display: flex; - flex-grow: 1; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon { - margin-right: 0; - margin-left: auto; -} -.wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - margin: 0; -} -@media (min-width: 782px) { - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container { - left: 100%; - top: -1px; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-container::before { - content: ""; - position: absolute; - right: 100%; - height: 100%; - display: block; - width: 0.5em; - background: transparent; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon { - margin-right: 0.25em; - } - .wp-block-navigation .has-child :where(.wp-block-navigation__submenu-container) .wp-block-navigation__submenu-icon svg { - transform: rotate(-90deg); - } -} -.wp-block-navigation .has-child:where(:not(.open-on-click)):hover > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child:where(:not(.open-on-click):not(.open-on-hover-click)):focus-within > .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} -.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true] ~ .wp-block-navigation__submenu-container { - visibility: visible; - overflow: visible; - opacity: 1; - width: auto; - height: auto; - min-width: 200px; -} - -.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container { - left: 0; - top: 100%; -} -@media (min-width: 782px) { - .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: 100%; - top: 0; - } -} - -.wp-block-navigation-submenu { - position: relative; - display: flex; -} -.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg { - stroke: currentColor; -} - -button.wp-block-navigation-item__content { - background-color: transparent; - border: none; - color: currentColor; - font-size: inherit; - font-family: inherit; - line-height: inherit; - font-style: inherit; - font-weight: inherit; - text-transform: inherit; - text-align: left; -} - -.wp-block-navigation-submenu__toggle { - cursor: pointer; -} - -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle { - padding-right: 0.85em; -} -.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle + .wp-block-navigation__submenu-icon { - margin-left: -0.6em; - pointer-events: none; -} - -/** - * Margins - */ -.wp-block-navigation__responsive-container, -.wp-block-navigation__responsive-close, -.wp-block-navigation__responsive-dialog, -.wp-block-navigation, -.wp-block-navigation .wp-block-page-list, -.wp-block-navigation__container, -.wp-block-navigation__responsive-container-content { - gap: inherit; -} - -.wp-block-navigation:where(.has-background), -.wp-block-navigation:where(.has-background) .wp-block-navigation .wp-block-page-list, -.wp-block-navigation:where(.has-background) .wp-block-navigation__container { - gap: inherit; -} - -/** - * Paddings - */ -.wp-block-navigation:where(.has-background) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -.wp-block-navigation :where(.wp-block-navigation__submenu-container) .wp-block-navigation-item__content { - padding: 0.5em 1em; -} - -/** - * Justifications. - */ -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container { - left: auto; - right: 0; -} -.wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: -1px; - right: -1px; -} -@media (min-width: 782px) { - .wp-block-navigation.items-justified-space-between .wp-block-page-list > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-space-between > .wp-block-navigation__container > .has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-page-list > .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container, -.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { - left: auto; - right: 100%; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container { - background-color: #fff; - color: #000; - border: 1px solid rgba(0, 0, 0, 0.15); -} - -.wp-block-navigation__container { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - list-style: none; - margin: 0; - padding-left: 0; -} -.wp-block-navigation__container .is-responsive { - display: none; -} - -.wp-block-navigation__container:only-child, -.wp-block-page-list:only-child { - flex-grow: 1; -} - -/** - * Mobile menu. - */ -.wp-block-navigation__responsive-container { - display: none; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; -} -.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content { - display: flex; - flex-wrap: var(--navigation-layout-wrap, wrap); - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); -} -.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open) { - color: inherit !important; - background-color: inherit !important; -} -.wp-block-navigation__responsive-container.is-menu-open { - display: flex; - flex-direction: column; - background-color: inherit; - padding: 2rem; - overflow: auto; - z-index: 100000; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { - padding-top: calc(2rem + 24px); - overflow: visible; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - align-items: var(--navigation-layout-justification-setting, inherit); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - justify-content: flex-start; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon { - display: none; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container { - opacity: 1; - visibility: visible; - height: auto; - width: auto; - overflow: initial; - min-width: 200px; - position: static; - border: none; - padding-left: 2rem; - padding-right: 2rem; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container { - gap: inherit; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container { - padding-top: var(--wp--style--block-gap, 2em); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content { - padding: 0; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list { - display: flex; - flex-direction: column; - align-items: var(--navigation-layout-justification-setting, initial); -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item, -.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list { - color: inherit !important; - background: transparent !important; -} -.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - right: auto; - left: auto; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { - display: block; - width: 100%; - position: relative; - z-index: auto; - background-color: inherit; - } - .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close { - display: none; - } - .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container { - left: 0; - } -} - -.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open { - background-color: #fff; - color: #000; -} - -.wp-block-navigation__toggle_button_label { - font-size: 1rem; - font-weight: bold; -} - -.wp-block-navigation__responsive-container-open, -.wp-block-navigation__responsive-container-close { - vertical-align: middle; - cursor: pointer; - color: currentColor; - background: transparent; - border: none; - margin: 0; - padding: 0; -} -.wp-block-navigation__responsive-container-open svg, -.wp-block-navigation__responsive-container-close svg { - fill: currentColor; - pointer-events: none; - display: block; - width: 24px; - height: 24px; -} - -.wp-block-navigation__responsive-container-open { - display: flex; -} -@media (min-width: 600px) { - .wp-block-navigation__responsive-container-open:not(.always-shown) { - display: none; - } -} - -.wp-block-navigation__responsive-container-close { - position: absolute; - top: 0; - right: 0; - z-index: 2; -} - -.wp-block-navigation__responsive-close { - width: 100%; -} -.wp-block-navigation__responsive-close:focus { - outline: none; -} - -.is-menu-open .wp-block-navigation__responsive-close, -.is-menu-open .wp-block-navigation__responsive-dialog, -.is-menu-open .wp-block-navigation__responsive-container-content { - box-sizing: border-box; -} - -.wp-block-navigation__responsive-dialog { - position: relative; -} - -html.has-modal-open { - overflow: hidden; -} - -.wp-block-navigation .wp-block-navigation-item__label { - word-break: normal; - overflow-wrap: break-word; -} -.wp-block-navigation .wp-block-navigation-item__description { - display: none; -} - -.wp-block-navigation .wp-block-page-list { - display: flex; - flex-direction: var(--navigation-layout-direction, initial); - justify-content: var(--navigation-layout-justify, initial); - align-items: var(--navigation-layout-align, initial); - flex-wrap: var(--navigation-layout-wrap, wrap); - background-color: inherit; -} -.wp-block-navigation .wp-block-navigation-item { - background-color: inherit; -} - -.is-small-text { - font-size: 0.875em; -} - -.is-regular-text { - font-size: 1em; -} - -.is-large-text { - font-size: 2.25em; -} - -.is-larger-text { - font-size: 3em; -} - -.has-drop-cap:not(:focus)::first-letter { - float: left; - font-size: 8.4em; - line-height: 0.68; - font-weight: 100; - margin: 0.05em 0.1em 0 0; - text-transform: uppercase; - font-style: normal; -} - -p.has-drop-cap.has-background { - overflow: hidden; -} - -p.has-background { - padding: 1.25em 2.375em; -} - -:where(p.has-text-color:not(.has-link-color)) a { - color: inherit; -} - -.wp-block-post-author { - display: flex; - flex-wrap: wrap; -} -.wp-block-post-author__byline { - width: 100%; - margin-top: 0; - margin-bottom: 0; - font-size: 0.5em; -} -.wp-block-post-author__avatar { - margin-right: 1em; -} -.wp-block-post-author__bio { - margin-bottom: 0.7em; - font-size: 0.7em; -} -.wp-block-post-author__content { - flex-grow: 1; - flex-basis: 0; -} -.wp-block-post-author__name { - margin: 0; -} - -.wp-block-post-comments { - /* utility classes */ - /* end utility classes */ -} -.wp-block-post-comments .alignleft { - float: left; -} -.wp-block-post-comments .alignright { - float: right; -} -.wp-block-post-comments .navigation::after { - content: ""; - display: table; - clear: both; -} -.wp-block-post-comments .commentlist { - clear: both; - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .commentlist .comment { - min-height: 2.25em; - padding-left: 3.25em; -} -.wp-block-post-comments .commentlist .comment p { - font-size: 1em; - line-height: 1.8; - margin: 1em 0; -} -.wp-block-post-comments .commentlist .children { - list-style: none; - margin: 0; - padding: 0; -} -.wp-block-post-comments .comment-author { - line-height: 1.5; -} -.wp-block-post-comments .comment-author .avatar { - border-radius: 1.5em; - display: block; - float: left; - height: 2.5em; - margin-top: 0.5em; - margin-right: 0.75em; - width: 2.5em; -} -.wp-block-post-comments .comment-author cite { - font-style: normal; -} -.wp-block-post-comments .comment-meta { - font-size: 0.875em; - line-height: 1.5; -} -.wp-block-post-comments .comment-meta b { - font-weight: normal; -} -.wp-block-post-comments .comment-meta .comment-awaiting-moderation { - margin-top: 1em; - margin-bottom: 1em; - display: block; -} -.wp-block-post-comments .comment-body .commentmetadata { - font-size: 0.875em; -} -.wp-block-post-comments .comment-form-comment label, -.wp-block-post-comments .comment-form-author label, -.wp-block-post-comments .comment-form-email label, -.wp-block-post-comments .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments .comment-form textarea, -.wp-block-post-comments .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-left: 0.5em; -} -.wp-block-post-comments .reply { - font-size: 0.875em; - margin-bottom: 1.4em; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments textarea, -.wp-block-post-comments input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments input[type=submit] { - border: none; -} - -.wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) { - font-weight: inherit; -} -.wp-block-post-comments-form[style*=font-family] :where(.comment-reply-title) { - font-family: inherit; -} -.wp-block-post-comments-form[class*=-font-size] :where(.comment-reply-title), .wp-block-post-comments-form[style*=font-size] :where(.comment-reply-title) { - font-size: inherit; -} -.wp-block-post-comments-form[style*=line-height] :where(.comment-reply-title) { - line-height: inherit; -} -.wp-block-post-comments-form[style*=font-style] :where(.comment-reply-title) { - font-style: inherit; -} -.wp-block-post-comments-form[style*=letter-spacing] :where(.comment-reply-title) { - letter-spacing: inherit; -} -.wp-block-post-comments-form input[type=submit] { - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - text-align: center; - overflow-wrap: break-word; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]) { - border: 1px solid #949494; - font-size: 1em; - font-family: inherit; -} -.wp-block-post-comments-form textarea, -.wp-block-post-comments-form input:not([type=submit]):not([type=checkbox]) { - padding: calc(0.667em + 2px); -} -.wp-block-post-comments-form .comment-form textarea, -.wp-block-post-comments-form .comment-form input:not([type=submit]):not([type=checkbox]) { - display: block; - box-sizing: border-box; - width: 100%; -} -.wp-block-post-comments-form .comment-form-author label, -.wp-block-post-comments-form .comment-form-email label, -.wp-block-post-comments-form .comment-form-url label { - display: block; - margin-bottom: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent { - display: flex; - gap: 0.25em; -} -.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent { - margin-top: 0.35em; -} -.wp-block-post-comments-form .comment-reply-title { - margin-bottom: 0; -} -.wp-block-post-comments-form .comment-reply-title :where(small) { - font-size: var(--wp--preset--font-size--medium, smaller); - margin-left: 0.5em; -} - -.wp-block-post-excerpt__more-link { - display: inline-block; -} - -.wp-block-post-featured-image { - margin-left: 0; - margin-right: 0; -} -.wp-block-post-featured-image a { - display: block; -} -.wp-block-post-featured-image img { - max-width: 100%; - width: 100%; - height: auto; - vertical-align: bottom; -} -.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img { - width: 100%; -} - -.wp-block-post-terms__separator { - white-space: pre-wrap; -} - -.wp-block-post-title { - word-break: break-word; -} -.wp-block-post-title a { - display: inline-block; -} - -.wp-block-preformatted { - white-space: pre-wrap; -} - -.wp-block-preformatted.has-background { - padding: 1.25em 2.375em; -} - -.wp-block-pullquote { - margin: 0 0 1em 0; - padding: 3em 0; - text-align: center; - overflow-wrap: break-word; - box-sizing: border-box; -} -.wp-block-pullquote p, -.wp-block-pullquote blockquote, -.wp-block-pullquote cite { - color: inherit; -} -.wp-block-pullquote.has-text-align-left, .wp-block-pullquote.has-text-align-right, .wp-block-pullquote.alignleft, .wp-block-pullquote.alignright { - max-width: 420px; -} -.wp-block-pullquote.has-text-align-left p, .wp-block-pullquote.has-text-align-right p, .wp-block-pullquote.alignleft p, .wp-block-pullquote.alignright p { - font-size: 1.25em; -} -.wp-block-pullquote p { - font-size: 1.75em; - line-height: 1.6; -} -.wp-block-pullquote cite, -.wp-block-pullquote footer { - position: relative; -} -.wp-block-pullquote .has-text-color a { - color: inherit; -} - -.wp-block-pullquote.has-text-align-left blockquote { - text-align: left; -} - -.wp-block-pullquote.has-text-align-right blockquote { - text-align: right; -} - -.wp-block-pullquote.is-style-solid-color { - border: none; -} -.wp-block-pullquote.is-style-solid-color blockquote { - margin-left: auto; - margin-right: auto; - max-width: 60%; -} -.wp-block-pullquote.is-style-solid-color blockquote p { - margin-top: 0; - margin-bottom: 0; - font-size: 2em; -} -.wp-block-pullquote.is-style-solid-color blockquote cite { - text-transform: none; - font-style: normal; -} - -.wp-block-pullquote cite { - color: inherit; -} - -.wp-block-post-template, -.wp-block-query-loop { - margin-top: 0; - margin-bottom: 0; - max-width: 100%; - list-style: none; - padding: 0; -} -.wp-block-post-template.wp-block-post-template, -.wp-block-query-loop.wp-block-post-template { - background: none; -} -.wp-block-post-template.is-flex-container, -.wp-block-query-loop.is-flex-container { - flex-direction: row; - display: flex; - flex-wrap: wrap; - gap: 1.25em; -} -.wp-block-post-template.is-flex-container li, -.wp-block-query-loop.is-flex-container li { - margin: 0; - width: 100%; -} -@media (min-width: 600px) { - .wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li { - width: calc((100% / 2) - 1.25em + (1.25em / 2)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li { - width: calc((100% / 3) - 1.25em + (1.25em / 3)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li { - width: calc((100% / 4) - 1.25em + (1.25em / 4)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li { - width: calc((100% / 5) - 1.25em + (1.25em / 5)); - } - .wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li, -.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li { - width: calc((100% / 6) - 1.25em + (1.25em / 6)); - } -} - -.wp-block-query-pagination > .wp-block-query-pagination-next, -.wp-block-query-pagination > .wp-block-query-pagination-previous, -.wp-block-query-pagination > .wp-block-query-pagination-numbers { - /*rtl:ignore*/ - margin-right: 0.5em; - margin-bottom: 0.5em; -} -.wp-block-query-pagination > .wp-block-query-pagination-next:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-previous:last-child, -.wp-block-query-pagination > .wp-block-query-pagination-numbers:last-child { - /*rtl:ignore*/ - margin-right: 0; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow { - margin-right: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-previous-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow { - margin-left: 1ch; - display: inline-block; -} -.wp-block-query-pagination .wp-block-query-pagination-next-arrow:not(.is-arrow-chevron) { - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.wp-block-query-pagination.aligncenter { - justify-content: center; -} - -.wp-block-quote { - box-sizing: border-box; - overflow-wrap: break-word; -} -.wp-block-quote.is-style-large:not(.is-style-plain), .wp-block-quote.is-large:not(.is-style-plain) { - margin-bottom: 1em; - padding: 0 1em; -} -.wp-block-quote.is-style-large:not(.is-style-plain) p, .wp-block-quote.is-large:not(.is-style-plain) p { - font-size: 1.5em; - font-style: italic; - line-height: 1.6; -} -.wp-block-quote.is-style-large:not(.is-style-plain) cite, -.wp-block-quote.is-style-large:not(.is-style-plain) footer, .wp-block-quote.is-large:not(.is-style-plain) cite, -.wp-block-quote.is-large:not(.is-style-plain) footer { - font-size: 1.125em; - text-align: right; -} - -.wp-block-read-more { - display: block; - width: -moz-fit-content; - width: fit-content; -} -.wp-block-read-more:not([style*=text-decoration]) { - text-decoration: none; -} -.wp-block-read-more:not([style*=text-decoration]):focus, .wp-block-read-more:not([style*=text-decoration]):active { - text-decoration: none; -} - -ul.wp-block-rss { - list-style: none; - padding: 0; -} -ul.wp-block-rss.wp-block-rss { - box-sizing: border-box; -} -ul.wp-block-rss.alignleft { - /*rtl:ignore*/ - margin-right: 2em; -} -ul.wp-block-rss.alignright { - /*rtl:ignore*/ - margin-left: 2em; -} -ul.wp-block-rss.is-grid { - display: flex; - flex-wrap: wrap; - padding: 0; - list-style: none; -} -ul.wp-block-rss.is-grid li { - margin: 0 1em 1em 0; - width: 100%; -} -@media (min-width: 600px) { - ul.wp-block-rss.columns-2 li { - width: calc(( 100% / 2 ) - 1em); - } - ul.wp-block-rss.columns-3 li { - width: calc(( 100% / 3 ) - 1em); - } - ul.wp-block-rss.columns-4 li { - width: calc(( 100% / 4 ) - 1em); - } - ul.wp-block-rss.columns-5 li { - width: calc(( 100% / 5 ) - 1em); - } - ul.wp-block-rss.columns-6 li { - width: calc(( 100% / 6 ) - 1em); - } -} - -.wp-block-rss__item-publish-date, -.wp-block-rss__item-author { - display: block; - font-size: 0.8125em; -} - -.wp-block-search__button { - background: #f7f7f7; - border: 1px solid #ccc; - padding: 0.375em 0.625em; - color: #32373c; - margin-left: 0.625em; - word-break: normal; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} -.wp-block-search__button.has-icon { - line-height: 0; -} -.wp-block-search__button svg { - min-width: 1.5em; - min-height: 1.5em; - fill: currentColor; -} - -.wp-block-search__inside-wrapper { - display: flex; - flex: auto; - flex-wrap: nowrap; - max-width: 100%; -} - -.wp-block-search__label { - width: 100%; -} - -.wp-block-search__input { - padding: 8px; - flex-grow: 1; - min-width: 3em; - border: 1px solid #949494; - font-size: inherit; - font-family: inherit; - line-height: inherit; -} - -.wp-block-search.wp-block-search__button-only .wp-block-search__button { - margin-left: 0; -} - -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper { - padding: 4px; - border: 1px solid #949494; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input { - border-radius: 0; - border: none; - padding: 0 0 0 0.25em; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__input:focus { - outline: none; -} -.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button { - padding: 0.125em 0.5em; -} - -.wp-block-search.aligncenter .wp-block-search__inside-wrapper { - margin: auto; -} - -.wp-block-separator { - border-top: 1px solid currentColor; - border-bottom: 1px solid currentColor; -} -.wp-block-separator.is-style-dots { - background: none !important; - border: none; - text-align: center; - line-height: 1; - height: auto; -} -.wp-block-separator.is-style-dots::before { - content: "···"; - color: currentColor; - font-size: 1.5em; - letter-spacing: 2em; - /*rtl:ignore*/ - padding-left: 2em; - font-family: serif; -} - -.wp-block-site-logo { - line-height: 0; -} -.wp-block-site-logo a { - display: inline-block; -} -.wp-block-site-logo.is-default-size img { - width: 120px; - height: auto; -} -.wp-block-site-logo a, -.wp-block-site-logo img { - border-radius: inherit; -} -.wp-block-site-logo.aligncenter { - margin-left: auto; - margin-right: auto; - text-align: center; -} -.wp-block-site-logo.is-style-rounded { - border-radius: 9999px; -} - -.wp-block-social-links { - padding-left: 0; - padding-right: 0; - text-indent: 0; - margin-left: 0; - background: none; -} -.wp-block-social-links .wp-social-link a, -.wp-block-social-links .wp-social-link a:hover { - text-decoration: none; - border-bottom: 0; - box-shadow: none; -} -.wp-block-social-links .wp-social-link a { - padding: 0.25em; -} -.wp-block-social-links .wp-social-link svg { - width: 1em; - height: 1em; -} -.wp-block-social-links .wp-social-link span:not(.screen-reader-text) { - margin-left: 0.5em; - margin-right: 0.5em; - font-size: 0.65em; -} -.wp-block-social-links.has-small-icon-size { - font-size: 16px; -} -.wp-block-social-links, .wp-block-social-links.has-normal-icon-size { - font-size: 24px; -} -.wp-block-social-links.has-large-icon-size { - font-size: 36px; -} -.wp-block-social-links.has-huge-icon-size { - font-size: 48px; -} -.wp-block-social-links.aligncenter { - justify-content: center; - display: flex; -} -.wp-block-social-links.alignright { - justify-content: flex-end; -} - -.wp-block-social-link { - display: block; - border-radius: 9999px; - transition: transform 0.1s ease; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .wp-block-social-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.wp-block-social-link a { - align-items: center; - display: flex; - line-height: 0; - transition: transform 0.1s ease; -} -.wp-block-social-link:hover { - transform: scale(1.1); -} - -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited, -.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg { - color: currentColor; - fill: currentColor; -} - -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link { - background-color: #f0f0f0; - color: #444; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-amazon { - background-color: #f90; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-bandcamp { - background-color: #1ea0c3; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-behance { - background-color: #0757fe; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-codepen { - background-color: #1e1f26; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-deviantart { - background-color: #02e49b; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dribbble { - background-color: #e94c89; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-dropbox { - background-color: #4280ff; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-etsy { - background-color: #f45800; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-facebook { - background-color: #1778f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-fivehundredpx { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-flickr { - background-color: #0461dd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-foursquare { - background-color: #e65678; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-github { - background-color: #24292d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-goodreads { - background-color: #eceadd; - color: #382110; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-google { - background-color: #ea4434; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-instagram { - background-color: #f00075; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-lastfm { - background-color: #e21b24; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-linkedin { - background-color: #0d66c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-mastodon { - background-color: #3288d4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium { - background-color: #02ab6c; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup { - background-color: #f6405f; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-patreon { - background-color: #ff424d; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pinterest { - background-color: #e60122; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-pocket { - background-color: #ef4155; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-reddit { - background-color: #fe4500; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-skype { - background-color: #0478d7; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-snapchat { - background-color: #fefc00; - color: #fff; - stroke: #000; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-soundcloud { - background-color: #ff5600; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-spotify { - background-color: #1bd760; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-telegram { - background-color: #2aabee; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tiktok { - background-color: #000; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-tumblr { - background-color: #011835; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitch { - background-color: #6440a4; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-twitter { - background-color: #1da1f2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vimeo { - background-color: #1eb7ea; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-vk { - background-color: #4680c2; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-wordpress { - background-color: #3499cd; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-yelp { - background-color: #d32422; - color: #fff; -} -.wp-block-social-links:not(.is-style-logos-only) .wp-social-link-youtube { - background-color: #f00; - color: #fff; -} - -.wp-block-social-links.is-style-logos-only .wp-social-link { - background: none; -} -.wp-block-social-links.is-style-logos-only .wp-social-link a { - padding: 0; -} -.wp-block-social-links.is-style-logos-only .wp-social-link svg { - width: 1.25em; - height: 1.25em; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-amazon { - color: #f90; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-bandcamp { - color: #1ea0c3; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-behance { - color: #0757fe; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-codepen { - color: #1e1f26; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-deviantart { - color: #02e49b; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dribbble { - color: #e94c89; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-dropbox { - color: #4280ff; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-etsy { - color: #f45800; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-facebook { - color: #1778f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-fivehundredpx { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-flickr { - color: #0461dd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-foursquare { - color: #e65678; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-github { - color: #24292d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-goodreads { - color: #382110; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-google { - color: #ea4434; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-instagram { - color: #f00075; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-lastfm { - color: #e21b24; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-linkedin { - color: #0d66c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-mastodon { - color: #3288d4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-medium { - color: #02ab6c; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-meetup { - color: #f6405f; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-patreon { - color: #ff424d; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pinterest { - color: #e60122; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-pocket { - color: #ef4155; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-reddit { - color: #fe4500; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-skype { - color: #0478d7; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-snapchat { - color: #fff; - stroke: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-soundcloud { - color: #ff5600; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-spotify { - color: #1bd760; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-telegram { - color: #2aabee; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tiktok { - color: #000; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-tumblr { - color: #011835; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitch { - color: #6440a4; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-twitter { - color: #1da1f2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vimeo { - color: #1eb7ea; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-vk { - color: #4680c2; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-wordpress { - color: #3499cd; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-yelp { - color: #d32422; -} -.wp-block-social-links.is-style-logos-only .wp-social-link-youtube { - color: #f00; -} - -.wp-block-social-links.is-style-pill-shape .wp-social-link { - width: auto; -} -.wp-block-social-links.is-style-pill-shape .wp-social-link a { - padding-left: calc((2/3) * 1em); - padding-right: calc((2/3) * 1em); -} - -.wp-block-spacer { - clear: both; -} - -.wp-block-tag-cloud.aligncenter { - text-align: center; -} -.wp-block-tag-cloud.alignfull { - padding-left: 1em; - padding-right: 1em; -} -.wp-block-tag-cloud a { - display: inline-block; - margin-right: 5px; -} -.wp-block-tag-cloud span { - display: inline-block; - margin-left: 5px; - text-decoration: none; -} -.wp-block-tag-cloud.is-style-outline { - display: flex; - flex-wrap: wrap; - gap: 1ch; -} -.wp-block-tag-cloud.is-style-outline a { - border: 1px solid currentColor; - font-size: unset !important; - margin-right: 0; - padding: 1ch 2ch; - text-decoration: none !important; -} - -.wp-block-table { - margin: 0 0 1em 0; - overflow-x: auto; -} -.wp-block-table table { - border-collapse: collapse; - width: 100%; -} -.wp-block-table .has-fixed-layout { - table-layout: fixed; - width: 100%; -} -.wp-block-table .has-fixed-layout td, -.wp-block-table .has-fixed-layout th { - word-break: break-word; -} -.wp-block-table.alignleft, .wp-block-table.aligncenter, .wp-block-table.alignright { - display: table; - width: auto; -} -.wp-block-table.alignleft td, -.wp-block-table.alignleft th, .wp-block-table.aligncenter td, -.wp-block-table.aligncenter th, .wp-block-table.alignright td, -.wp-block-table.alignright th { - word-break: break-word; -} -.wp-block-table .has-subtle-light-gray-background-color { - background-color: #f3f4f5; -} -.wp-block-table .has-subtle-pale-green-background-color { - background-color: #e9fbe5; -} -.wp-block-table .has-subtle-pale-blue-background-color { - background-color: #e7f5fe; -} -.wp-block-table .has-subtle-pale-pink-background-color { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes { - border-spacing: 0; - border-collapse: inherit; - background-color: transparent; - border-bottom: 1px solid #f0f0f0; -} -.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { - background-color: #f0f0f0; -} -.wp-block-table.is-style-stripes.has-subtle-light-gray-background-color tbody tr:nth-child(odd) { - background-color: #f3f4f5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-green-background-color tbody tr:nth-child(odd) { - background-color: #e9fbe5; -} -.wp-block-table.is-style-stripes.has-subtle-pale-blue-background-color tbody tr:nth-child(odd) { - background-color: #e7f5fe; -} -.wp-block-table.is-style-stripes.has-subtle-pale-pink-background-color tbody tr:nth-child(odd) { - background-color: #fcf0ef; -} -.wp-block-table.is-style-stripes th, -.wp-block-table.is-style-stripes td { - border-color: transparent; -} -.wp-block-table .has-border-color > *, -.wp-block-table .has-border-color tr, -.wp-block-table .has-border-color th, -.wp-block-table .has-border-color td { - border-color: inherit; -} -.wp-block-table table[style*=border-style] > *, -.wp-block-table table[style*=border-style] tr, -.wp-block-table table[style*=border-style] th, -.wp-block-table table[style*=border-style] td { - border-style: inherit; -} -.wp-block-table table[style*=border-width] > *, -.wp-block-table table[style*=border-width] tr, -.wp-block-table table[style*=border-width] th, -.wp-block-table table[style*=border-width] td { - border-width: inherit; - border-style: inherit; -} - -.wp-block-text-columns { - display: flex; -} -.wp-block-text-columns.aligncenter { - display: flex; -} -.wp-block-text-columns .wp-block-column { - margin: 0 1em; - padding: 0; -} -.wp-block-text-columns .wp-block-column:first-child { - margin-left: 0; -} -.wp-block-text-columns .wp-block-column:last-child { - margin-right: 0; -} -.wp-block-text-columns.columns-2 .wp-block-column { - width: calc(100% / 2); -} -.wp-block-text-columns.columns-3 .wp-block-column { - width: calc(100% / 3); -} -.wp-block-text-columns.columns-4 .wp-block-column { - width: calc(100% / 4); -} - -pre.wp-block-verse { - font-family: inherit; - overflow: auto; - white-space: pre-wrap; -} - -.wp-block-video { - margin: 0 0 1em 0; -} -.wp-block-video video { - width: 100%; -} -@supports (position: sticky) { - .wp-block-video [poster] { - -o-object-fit: cover; - object-fit: cover; - } -} -.wp-block-video.aligncenter { - text-align: center; -} -.wp-block-video figcaption { - margin-top: 0.5em; - margin-bottom: 1em; -} - -:root { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} -:root .has-very-light-gray-background-color { - background-color: #eee; -} -:root .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .has-very-light-gray-color { - color: #eee; -} -:root .has-very-dark-gray-color { - color: #313131; -} -:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(135deg, #00d084 0%, #0693e3 100%); -} -:root .has-purple-crush-gradient-background { - background: linear-gradient(135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .has-hazy-dawn-gradient-background { - background: linear-gradient(135deg, #faaca8 0%, #dad0ec 100%); -} -:root .has-subdued-olive-gradient-background { - background: linear-gradient(135deg, #fafae1 0%, #67a671 100%); -} -:root .has-atomic-cream-gradient-background { - background: linear-gradient(135deg, #fdd79a 0%, #004a59 100%); -} -:root .has-nightshade-gradient-background { - background: linear-gradient(135deg, #330968 0%, #31cdcf 100%); -} -:root .has-midnight-gradient-background { - background: linear-gradient(135deg, #020381 0%, #2874fc 100%); -} - -.has-regular-font-size { - font-size: 1em; -} - -.has-larger-font-size { - font-size: 2.625em; -} - -.has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -.has-text-align-center { - text-align: center; -} - -.has-text-align-left { - /*rtl:ignore*/ - text-align: left; -} - -.has-text-align-right { - /*rtl:ignore*/ - text-align: right; -} - -#end-resizable-editor-section { - display: none; -} - -.aligncenter { - clear: both; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -.screen-reader-text { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.screen-reader-text:focus { - background-color: #ddd; - clip: auto !important; - -webkit-clip-path: none; - clip-path: none; - color: #444; - display: block; - font-size: 1em; - height: auto; - left: 5px; - line-height: normal; - padding: 15px 23px 14px; - text-decoration: none; - top: 5px; - width: auto; - z-index: 100000; -} - -/** - * The following provide a simple means of applying a default border style when - * a user first makes a selection in the border block support panel. - * This prevents issues such as where the user could set a border width - * and see no border due there being no border style set. - * - * This is intended to be removed once intelligent defaults can be set while - * making border selections via the block support. - * - * See: https://github.com/WordPress/gutenberg/pull/33743 - */ -html :where(.has-border-color) { - border-style: solid; -} - -html :where([style*="border-width"]) { - border-style: solid; -} - -/** - * Provide baseline responsiveness for images. - */ -html :where(img[class*="wp-image-"]) { - height: auto; - max-width: 100%; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color),html :where([style*=border-width]){border-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -:root { - /* - * Our classes uses the same values we set for gradient value attributes, - * and we can not use spacing because of WP multi site kses rule. - */ - /* stylelint-disable function-comma-space-after */ - /* stylelint-enable function-comma-space-after */ - --wp--preset--font-size--normal: 16px; - --wp--preset--font-size--huge: 42px; -} -:root .has-very-light-gray-background-color { - background-color: #eee; -} -:root .has-very-dark-gray-background-color { - background-color: #313131; -} -:root .has-very-light-gray-color { - color: #eee; -} -:root .has-very-dark-gray-color { - color: #313131; -} -:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background { - background: linear-gradient(-135deg, #00d084 0%, #0693e3 100%); -} -:root .has-purple-crush-gradient-background { - background: linear-gradient(-135deg, #34e2e4 0%, #4721fb 50%, #ab1dfe 100%); -} -:root .has-hazy-dawn-gradient-background { - background: linear-gradient(-135deg, #faaca8 0%, #dad0ec 100%); -} -:root .has-subdued-olive-gradient-background { - background: linear-gradient(-135deg, #fafae1 0%, #67a671 100%); -} -:root .has-atomic-cream-gradient-background { - background: linear-gradient(-135deg, #fdd79a 0%, #004a59 100%); -} -:root .has-nightshade-gradient-background { - background: linear-gradient(-135deg, #330968 0%, #31cdcf 100%); -} -:root .has-midnight-gradient-background { - background: linear-gradient(-135deg, #020381 0%, #2874fc 100%); -} - -.has-regular-font-size { - font-size: 1em; -} - -.has-larger-font-size { - font-size: 2.625em; -} - -.has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); -} - -.has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); -} - -.has-text-align-center { - text-align: center; -} - -.has-text-align-left { - text-align: left; -} - -.has-text-align-right { - text-align: right; -} - -#end-resizable-editor-section { - display: none; -} - -.aligncenter { - clear: both; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -.screen-reader-text { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.screen-reader-text:focus { - background-color: #ddd; - clip: auto !important; - -webkit-clip-path: none; - clip-path: none; - color: #444; - display: block; - font-size: 1em; - height: auto; - right: 5px; - line-height: normal; - padding: 15px 23px 14px; - text-decoration: none; - top: 5px; - width: auto; - z-index: 100000; -} - -/** - * The following provide a simple means of applying a default border style when - * a user first makes a selection in the border block support panel. - * This prevents issues such as where the user could set a border width - * and see no border due there being no border style set. - * - * This is intended to be removed once intelligent defaults can be set while - * making border selections via the block support. - * - * See: https://github.com/WordPress/gutenberg/pull/33743 - */ -html :where(.has-border-color) { - border-style: solid; -} - -html :where([style*="border-width"]) { - border-style: solid; -} - -/** - * Provide baseline responsiveness for images. - */ -html :where(img[class*="wp-image-"]) { - height: auto; - max-width: 100%; -}html :where(.editor-styles-wrapper){font-family:serif;font-size:medium;line-height:normal;color:initial;background:#fff}html :where(.editor-styles-wrapper) .wp-align-wrapper{max-width:840px}html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-full,html :where(.editor-styles-wrapper) .wp-align-wrapper>.wp-block{max-width:none}html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-wide{max-width:840px}html :where(.editor-styles-wrapper) a{transition:none}html :where(.editor-styles-wrapper) code,html :where(.editor-styles-wrapper) kbd{padding:0;margin:0;background:inherit;font-size:inherit;font-family:monospace}html :where(.editor-styles-wrapper) p{font-size:revert;line-height:revert;margin:revert}html :where(.editor-styles-wrapper) ol,html :where(.editor-styles-wrapper) ul{margin:revert;padding:revert;list-style-type:revert;box-sizing:border-box}html :where(.editor-styles-wrapper) ol li,html :where(.editor-styles-wrapper) ol ol,html :where(.editor-styles-wrapper) ol ul,html :where(.editor-styles-wrapper) ul li,html :where(.editor-styles-wrapper) ul ol,html :where(.editor-styles-wrapper) ul ul{margin:revert}html :where(.editor-styles-wrapper) ol ul,html :where(.editor-styles-wrapper) ul ul{list-style-type:revert}html :where(.editor-styles-wrapper) h1,html :where(.editor-styles-wrapper) h2,html :where(.editor-styles-wrapper) h3,html :where(.editor-styles-wrapper) h4,html :where(.editor-styles-wrapper) h5,html :where(.editor-styles-wrapper) h6,html :where(.editor-styles-wrapper) select{font-size:revert;margin:revert;color:revert;line-height:revert;font-weight:revert}html :where(.editor-styles-wrapper) select{font-family:system-ui;-webkit-appearance:revert;border:revert;border-radius:revert;background:revert;box-shadow:revert;text-shadow:revert;outline:revert;cursor:revert;transform:revert;padding:revert;min-height:revert;max-width:revert;vertical-align:revert}html :where(.editor-styles-wrapper) select:disabled,html :where(.editor-styles-wrapper) select:focus{color:revert;border-color:revert;background-color:revert;background-image:revert;box-shadow:revert;text-shadow:revert;cursor:revert;transform:revert}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -/** -* Editor Normalization Styles -* -* These are only output in the editor, but styles here are prefixed .editor-styles-wrapper and affect the theming -* of the editor by themes. -*/ -html :where(.editor-styles-wrapper) { - /** - * The following styles revert to the browser defaults overriding the WPAdmin styles. - * This is only needed while the block editor is not being loaded in an iframe. - */ - font-family: serif; - font-size: initial; - line-height: initial; - color: initial; - background: #fff; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper { - max-width: 840px; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper > .wp-block, html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-full { - max-width: none; -} -html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-wide { - max-width: 840px; -} -html :where(.editor-styles-wrapper) a { - transition: none; -} -html :where(.editor-styles-wrapper) code, -html :where(.editor-styles-wrapper) kbd { - padding: 0; - margin: 0; - background: inherit; - font-size: inherit; - font-family: monospace; -} -html :where(.editor-styles-wrapper) p { - font-size: revert; - line-height: revert; - margin: revert; -} -html :where(.editor-styles-wrapper) ul, -html :where(.editor-styles-wrapper) ol { - margin: revert; - padding: revert; - list-style-type: revert; - box-sizing: border-box; -} -html :where(.editor-styles-wrapper) ul ul, -html :where(.editor-styles-wrapper) ul ol, -html :where(.editor-styles-wrapper) ol ul, -html :where(.editor-styles-wrapper) ol ol { - margin: revert; -} -html :where(.editor-styles-wrapper) ul li, -html :where(.editor-styles-wrapper) ol li { - margin: revert; -} -html :where(.editor-styles-wrapper) ul ul, -html :where(.editor-styles-wrapper) ol ul { - list-style-type: revert; -} -html :where(.editor-styles-wrapper) h1, -html :where(.editor-styles-wrapper) h2, -html :where(.editor-styles-wrapper) h3, -html :where(.editor-styles-wrapper) h4, -html :where(.editor-styles-wrapper) h5, -html :where(.editor-styles-wrapper) h6 { - font-size: revert; - margin: revert; - color: revert; - line-height: revert; - font-weight: revert; -} -html :where(.editor-styles-wrapper) select { - font-family: system-ui; - -webkit-appearance: revert; - color: revert; - border: revert; - border-radius: revert; - background: revert; - box-shadow: revert; - text-shadow: revert; - outline: revert; - cursor: revert; - transform: revert; - font-size: revert; - line-height: revert; - padding: revert; - margin: revert; - min-height: revert; - max-width: revert; - vertical-align: revert; - font-weight: revert; -} -html :where(.editor-styles-wrapper) select:disabled, -html :where(.editor-styles-wrapper) select:focus { - color: revert; - border-color: revert; - background-color: revert; - background-image: revert; - box-shadow: revert; - text-shadow: revert; - cursor: revert; - transform: revert; -}html :where(.editor-styles-wrapper){font-family:serif;font-size:medium;line-height:normal;color:initial;background:#fff}html :where(.editor-styles-wrapper) .wp-align-wrapper{max-width:840px}html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-full,html :where(.editor-styles-wrapper) .wp-align-wrapper>.wp-block{max-width:none}html :where(.editor-styles-wrapper) .wp-align-wrapper.wp-align-wide{max-width:840px}html :where(.editor-styles-wrapper) a{transition:none}html :where(.editor-styles-wrapper) code,html :where(.editor-styles-wrapper) kbd{padding:0;margin:0;background:inherit;font-size:inherit;font-family:monospace}html :where(.editor-styles-wrapper) p{font-size:revert;line-height:revert;margin:revert}html :where(.editor-styles-wrapper) ol,html :where(.editor-styles-wrapper) ul{margin:revert;padding:revert;list-style-type:revert;box-sizing:border-box}html :where(.editor-styles-wrapper) ol li,html :where(.editor-styles-wrapper) ol ol,html :where(.editor-styles-wrapper) ol ul,html :where(.editor-styles-wrapper) ul li,html :where(.editor-styles-wrapper) ul ol,html :where(.editor-styles-wrapper) ul ul{margin:revert}html :where(.editor-styles-wrapper) ol ul,html :where(.editor-styles-wrapper) ul ul{list-style-type:revert}html :where(.editor-styles-wrapper) h1,html :where(.editor-styles-wrapper) h2,html :where(.editor-styles-wrapper) h3,html :where(.editor-styles-wrapper) h4,html :where(.editor-styles-wrapper) h5,html :where(.editor-styles-wrapper) h6,html :where(.editor-styles-wrapper) select{font-size:revert;margin:revert;color:revert;line-height:revert;font-weight:revert}html :where(.editor-styles-wrapper) select{font-family:system-ui;-webkit-appearance:revert;border:revert;border-radius:revert;background:revert;box-shadow:revert;text-shadow:revert;outline:revert;cursor:revert;transform:revert;padding:revert;min-height:revert;max-width:revert;vertical-align:revert}html :where(.editor-styles-wrapper) select:disabled,html :where(.editor-styles-wrapper) select:focus{color:revert;border-color:revert;background-color:revert;background-image:revert;box-shadow:revert;text-shadow:revert;cursor:revert;transform:revert}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-left:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-left:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-right:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-right:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;left:10px;bottom:10px;right:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-right:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;left:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{right:0}@media (min-width:783px){.interface-interface-skeleton{right:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{right:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{right:160px}}.folded .interface-interface-skeleton{right:0}@media (min-width:783px){.folded .interface-interface-skeleton{right:36px}}body.is-fullscreen-mode .interface-interface-skeleton{right:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;left:0;bottom:0;right:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-right:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-left:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;right:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;right:auto;left:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-right:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-right:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-right:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;right:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-right:24px;margin-right:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 10px .6rem 0}.interface-preferences-modal__option .components-base-control__help{margin:-8px 58px 8px 0;font-size:12px;font-style:normal;color:#757575}.wp-block[data-type="core/widget-area"]{max-width:700px;margin-right:auto;margin-left:auto}.wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0;height:48px;position:relative;z-index:1;background:#fff;transform:translateZ(0)}.wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title:hover{background:#fff}.wp-block[data-type="core/widget-area"] .block-list-appender.wp-block{width:auto;position:relative}.wp-block[data-type="core/widget-area"] .editor-styles-wrapper .wp-block.wp-block.wp-block.wp-block.wp-block{max-width:100%}.wp-block[data-type="core/widget-area"] .components-panel__body.is-opened{padding:0}.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper{margin:0;padding:0}.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper>.block-editor-block-list__layout{margin-top:-48px;padding:72px 16px 16px;min-height:32px}.wp-block-widget-area__highlight-drop-zone{outline:var(--wp-admin-border-width-focus) solid var(--wp-admin-theme-color)}body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title,body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title *{pointer-events:none}.edit-widgets-error-boundary{max-width:780px;padding:20px;margin:60px auto auto;box-shadow:0 10px 10px rgba(0,0,0,.25)}.edit-widgets-header{display:flex;align-items:center;justify-content:space-between;height:60px;padding:0 16px;overflow:auto}@media (min-width:600px){.edit-widgets-header{overflow:visible}}.edit-widgets-header__navigable-toolbar-wrapper{display:flex;align-items:center;justify-content:center}.edit-widgets-header__title{font-size:20px;padding:0;margin:0 0 0 20px}.edit-widgets-header__actions{display:flex}.edit-widgets-header__actions .components-button{margin-left:4px}@media (min-width:600px){.edit-widgets-header__actions .components-button{margin-left:12px}}.edit-widgets-header__actions .edit-widgets-more-menu .components-button,.edit-widgets-header__actions .interface-pinned-items .components-button{margin-left:0}.edit-widgets-header-toolbar{border:none}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon{height:36px;min-width:36px;padding:6px}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon.is-pressed,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon.is-pressed{background:#1e1e1e}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon:focus:not(:disabled),.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 1px #fff;outline:1px solid transparent}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon:before,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon:before{display:none}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle{padding-right:8px;padding-left:8px}@media (min-width:600px){.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle{padding-right:12px;padding-left:12px}}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle:after{content:none}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(-45deg)}.edit-widgets-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-widgets-keyboard-shortcut-help-modal__main-shortcuts .edit-widgets-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-widgets-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-widgets-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-widgets-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-widgets-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-widgets-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 1rem 0 0;text-align:left}.edit-widgets-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 .2rem 0 0}.components-panel__header.edit-widgets-sidebar__panel-tabs{justify-content:flex-start;padding-right:0;padding-left:4px;border-top:0;margin-top:0}.components-panel__header.edit-widgets-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-widgets-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon{display:none;margin-right:auto}@media (min-width:782px){.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-button.edit-widgets-sidebar__panel-tab{border-radius:0;height:49px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-right:0;font-weight:400;color:#1e1e1e}.components-button.edit-widgets-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-widgets-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);font-weight:600;position:relative}.components-button.edit-widgets-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;left:0;right:0;border-bottom:4px solid transparent}.components-button.edit-widgets-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.edit-widgets-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}.edit-widgets-widget-areas__top-container{display:flex;padding:16px}.edit-widgets-widget-areas__top-container .block-editor-block-icon{margin-left:16px}.edit-widgets-notices__snackbar{position:fixed;left:0;bottom:20px;padding-right:16px;padding-left:16px;right:0}@media (min-width:783px){.edit-widgets-notices__snackbar{right:160px}}@media (min-width:783px){.auto-fold .edit-widgets-notices__snackbar{right:36px}}@media (min-width:961px){.auto-fold .edit-widgets-notices__snackbar{right:160px}}.folded .edit-widgets-notices__snackbar{right:0}@media (min-width:783px){.folded .edit-widgets-notices__snackbar{right:36px}}body.is-fullscreen-mode .edit-widgets-notices__snackbar{right:0!important}.edit-widgets-notices__dismissible .components-notice,.edit-widgets-notices__pinned .components-notice{box-sizing:border-box;margin:0;border-bottom:1px solid rgba(0,0,0,.2);padding:0 12px;min-height:60px}.edit-widgets-notices__dismissible .components-notice .components-notice__dismiss,.edit-widgets-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}.edit-widgets-layout__inserter-panel{height:100%;display:flex;flex-direction:column}.edit-widgets-layout__inserter-panel .block-editor-inserter__menu{overflow:hidden}.edit-widgets-layout__inserter-panel-header{padding-top:8px;padding-left:8px;display:flex;justify-content:flex-end}.edit-widgets-layout__inserter-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-widgets-layout__inserter-panel-content{height:100%}}.edit-widgets-welcome-guide{width:312px}.edit-widgets-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-widgets-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-widgets-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-widgets-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 24px;padding:0 32px}.edit-widgets-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-widgets-block-editor{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.edit-widgets-block-editor,.edit-widgets-block-editor .block-editor-writing-flow,.edit-widgets-block-editor .block-editor-writing-flow>div,.edit-widgets-block-editor>div:last-of-type{display:flex;flex-direction:column;flex-grow:1}.edit-widgets-block-editor .edit-widgets-main-block-list{height:100%}.edit-widgets-block-editor .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.edit-widgets-block-editor .components-button.has-icon,.edit-widgets-block-editor .components-button.is-tertiary{padding:6px}.edit-widgets-editor__list-view-panel{height:100%;display:flex;flex-direction:column;min-width:350px}.edit-widgets-editor__list-view-panel-content{height:calc(100% - 44px);overflow-y:auto;padding:8px}.edit-widgets-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-right:16px;padding-left:4px}body.appearance_page_gutenberg-widgets,body.widgets-php,html.wp-toolbar{background:#fff}body.appearance_page_gutenberg-widgets #wpcontent,body.widgets-php #wpcontent{padding-right:0}body.appearance_page_gutenberg-widgets #wpbody-content,body.widgets-php #wpbody-content{padding-bottom:0}body.appearance_page_gutenberg-widgets #wpbody-content>div:not(.blocks-widgets-container):not(#screen-meta),body.appearance_page_gutenberg-widgets #wpfooter,body.widgets-php #wpbody-content>div:not(.blocks-widgets-container):not(#screen-meta),body.widgets-php #wpfooter{display:none}body.appearance_page_gutenberg-widgets .a11y-speak-region,body.widgets-php .a11y-speak-region{right:-1px;top:-1px}body.appearance_page_gutenberg-widgets ul#adminmenu>li.current>a.current:after,body.appearance_page_gutenberg-widgets ul#adminmenu a.wp-has-current-submenu:after,body.widgets-php ul#adminmenu>li.current>a.current:after,body.widgets-php ul#adminmenu a.wp-has-current-submenu:after{border-left-color:#fff}body.appearance_page_gutenberg-widgets .media-frame select.attachment-filters:last-of-type,body.widgets-php .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.blocks-widgets-container,.components-modal__frame{box-sizing:border-box}.blocks-widgets-container *,.blocks-widgets-container :after,.blocks-widgets-container :before,.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before{box-sizing:inherit}@media (min-width:600px){.blocks-widgets-container{position:absolute;top:0;left:0;bottom:0;right:0;min-height:calc(100vh - 46px)}}@media (min-width:782px){.blocks-widgets-container{min-height:calc(100vh - 32px)}}.blocks-widgets-container .interface-interface-skeleton__content{background-color:#f0f0f0}.blocks-widgets-container .editor-styles-wrapper{max-width:700px;margin:auto}.edit-widgets-sidebar .components-button.interface-complementary-area__pin-unpin-item{display:none}.widgets-php .notice{display:none!important}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-right:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-right:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-left:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-left:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;right:10px;bottom:10px;left:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-left:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;right:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{left:0}@media (min-width:783px){.interface-interface-skeleton{left:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{left:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{left:160px}}.folded .interface-interface-skeleton{left:0}@media (min-width:783px){.folded .interface-interface-skeleton{left:36px}}body.is-fullscreen-mode .interface-interface-skeleton{left:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;right:0;bottom:0;left:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-left:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-right:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;left:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;left:auto;right:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-left:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-left:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-left:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;left:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-left:24px;margin-left:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 0 .6rem 10px}.interface-preferences-modal__option .components-base-control__help{margin:-8px 0 8px 58px;font-size:12px;font-style:normal;color:#757575}.wp-block[data-type="core/widget-area"]{max-width:700px;margin-left:auto;margin-right:auto}.wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0;height:48px;position:relative;z-index:1;background:#fff;transform:translateZ(0)}.wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title:hover{background:#fff}.wp-block[data-type="core/widget-area"] .block-list-appender.wp-block{width:auto;position:relative}.wp-block[data-type="core/widget-area"] .editor-styles-wrapper .wp-block.wp-block.wp-block.wp-block.wp-block{max-width:100%}.wp-block[data-type="core/widget-area"] .components-panel__body.is-opened{padding:0}.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper{margin:0;padding:0}.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper>.block-editor-block-list__layout{margin-top:-48px;padding:72px 16px 16px;min-height:32px}.wp-block-widget-area__highlight-drop-zone{outline:var(--wp-admin-border-width-focus) solid var(--wp-admin-theme-color)}body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title,body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body>.components-panel__body-title *{pointer-events:none}.edit-widgets-error-boundary{max-width:780px;padding:20px;margin:60px auto auto;box-shadow:0 10px 10px rgba(0,0,0,.25)}.edit-widgets-header{display:flex;align-items:center;justify-content:space-between;height:60px;padding:0 16px;overflow:auto}@media (min-width:600px){.edit-widgets-header{overflow:visible}}.edit-widgets-header__navigable-toolbar-wrapper{display:flex;align-items:center;justify-content:center}.edit-widgets-header__title{font-size:20px;padding:0;margin:0 20px 0 0}.edit-widgets-header__actions{display:flex}.edit-widgets-header__actions .components-button{margin-right:4px}@media (min-width:600px){.edit-widgets-header__actions .components-button{margin-right:12px}}.edit-widgets-header__actions .edit-widgets-more-menu .components-button,.edit-widgets-header__actions .interface-pinned-items .components-button{margin-right:0}.edit-widgets-header-toolbar{border:none}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon{height:36px;min-width:36px;padding:6px}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon.is-pressed,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon.is-pressed{background:#1e1e1e}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon:focus:not(:disabled),.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 1px #fff;outline:1px solid transparent}.edit-widgets-header-toolbar>.components-button.has-icon.has-icon.has-icon:before,.edit-widgets-header-toolbar>.components-dropdown>.components-button.has-icon.has-icon:before{display:none}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle{padding-left:8px;padding-right:8px}@media (min-width:600px){.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle{padding-left:12px;padding-right:12px}}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle:after{content:none}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(45deg)}.edit-widgets-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-widgets-keyboard-shortcut-help-modal__main-shortcuts .edit-widgets-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-widgets-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-widgets-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-widgets-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-widgets-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-widgets-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 0 0 1rem;text-align:right}.edit-widgets-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 0 0 .2rem}.components-panel__header.edit-widgets-sidebar__panel-tabs{justify-content:flex-start;padding-left:0;padding-right:4px;border-top:0;margin-top:0}.components-panel__header.edit-widgets-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-widgets-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon{display:none;margin-left:auto}@media (min-width:782px){.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-button.edit-widgets-sidebar__panel-tab{border-radius:0;height:49px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-left:0;font-weight:400;color:#1e1e1e}.components-button.edit-widgets-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-widgets-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);font-weight:600;position:relative}.components-button.edit-widgets-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;right:0;left:0;border-bottom:4px solid transparent}.components-button.edit-widgets-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.edit-widgets-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}.edit-widgets-widget-areas__top-container{display:flex;padding:16px}.edit-widgets-widget-areas__top-container .block-editor-block-icon{margin-right:16px}.edit-widgets-notices__snackbar{position:fixed;right:0;bottom:20px;padding-left:16px;padding-right:16px;left:0}@media (min-width:783px){.edit-widgets-notices__snackbar{left:160px}}@media (min-width:783px){.auto-fold .edit-widgets-notices__snackbar{left:36px}}@media (min-width:961px){.auto-fold .edit-widgets-notices__snackbar{left:160px}}.folded .edit-widgets-notices__snackbar{left:0}@media (min-width:783px){.folded .edit-widgets-notices__snackbar{left:36px}}body.is-fullscreen-mode .edit-widgets-notices__snackbar{left:0!important}.edit-widgets-notices__dismissible .components-notice,.edit-widgets-notices__pinned .components-notice{box-sizing:border-box;margin:0;border-bottom:1px solid rgba(0,0,0,.2);padding:0 12px;min-height:60px}.edit-widgets-notices__dismissible .components-notice .components-notice__dismiss,.edit-widgets-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}.edit-widgets-layout__inserter-panel{height:100%;display:flex;flex-direction:column}.edit-widgets-layout__inserter-panel .block-editor-inserter__menu{overflow:hidden}.edit-widgets-layout__inserter-panel-header{padding-top:8px;padding-right:8px;display:flex;justify-content:flex-end}.edit-widgets-layout__inserter-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-widgets-layout__inserter-panel-content{height:100%}}.edit-widgets-welcome-guide{width:312px}.edit-widgets-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-widgets-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-widgets-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-widgets-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 24px;padding:0 32px}.edit-widgets-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-widgets-block-editor{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.edit-widgets-block-editor,.edit-widgets-block-editor .block-editor-writing-flow,.edit-widgets-block-editor .block-editor-writing-flow>div,.edit-widgets-block-editor>div:last-of-type{display:flex;flex-direction:column;flex-grow:1}.edit-widgets-block-editor .edit-widgets-main-block-list{height:100%}.edit-widgets-block-editor .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.edit-widgets-block-editor .components-button.has-icon,.edit-widgets-block-editor .components-button.is-tertiary{padding:6px}.edit-widgets-editor__list-view-panel{height:100%;display:flex;flex-direction:column;min-width:350px}.edit-widgets-editor__list-view-panel-content{height:calc(100% - 44px);overflow-y:auto;padding:8px}.edit-widgets-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-left:16px;padding-right:4px}body.appearance_page_gutenberg-widgets,body.widgets-php,html.wp-toolbar{background:#fff}body.appearance_page_gutenberg-widgets #wpcontent,body.widgets-php #wpcontent{padding-left:0}body.appearance_page_gutenberg-widgets #wpbody-content,body.widgets-php #wpbody-content{padding-bottom:0}body.appearance_page_gutenberg-widgets #wpbody-content>div:not(.blocks-widgets-container):not(#screen-meta),body.appearance_page_gutenberg-widgets #wpfooter,body.widgets-php #wpbody-content>div:not(.blocks-widgets-container):not(#screen-meta),body.widgets-php #wpfooter{display:none}body.appearance_page_gutenberg-widgets .a11y-speak-region,body.widgets-php .a11y-speak-region{left:-1px;top:-1px}body.appearance_page_gutenberg-widgets ul#adminmenu>li.current>a.current:after,body.appearance_page_gutenberg-widgets ul#adminmenu a.wp-has-current-submenu:after,body.widgets-php ul#adminmenu>li.current>a.current:after,body.widgets-php ul#adminmenu a.wp-has-current-submenu:after{border-right-color:#fff}body.appearance_page_gutenberg-widgets .media-frame select.attachment-filters:last-of-type,body.widgets-php .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.blocks-widgets-container,.components-modal__frame{box-sizing:border-box}.blocks-widgets-container *,.blocks-widgets-container :after,.blocks-widgets-container :before,.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before{box-sizing:inherit}@media (min-width:600px){.blocks-widgets-container{position:absolute;top:0;right:0;bottom:0;left:0;min-height:calc(100vh - 46px)}}@media (min-width:782px){.blocks-widgets-container{min-height:calc(100vh - 32px)}}.blocks-widgets-container .interface-interface-skeleton__content{background-color:#f0f0f0}.blocks-widgets-container .editor-styles-wrapper{max-width:700px;margin:auto}.edit-widgets-sidebar .components-button.interface-complementary-area__pin-unpin-item{display:none}.widgets-php .notice{display:none!important}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-left: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-left: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-right: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-right: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - left: 10px; - bottom: 10px; - right: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-right: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - right: 0; - left: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - right: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - right: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - right: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - right: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-right: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-left: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - right: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - right: auto; - left: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-right: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-right: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-right: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - right: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-right: 24px; - margin-right: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 10px 0.6rem 0; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 58px 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.wp-block[data-type="core/widget-area"] { - max-width: 700px; - margin-right: auto; - margin-left: auto; -} -.wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - margin: 0; - height: 48px; - position: relative; - z-index: 1; - background: #fff; - transform: translateZ(0); -} -.wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title:hover { - background: #fff; -} -.wp-block[data-type="core/widget-area"] .block-list-appender.wp-block { - width: initial; - position: relative; -} -.wp-block[data-type="core/widget-area"] .editor-styles-wrapper .wp-block.wp-block.wp-block.wp-block.wp-block { - max-width: 100%; -} -.wp-block[data-type="core/widget-area"] .components-panel__body.is-opened { - padding: 0; -} - -.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper { - margin: 0; - padding: 0; -} -.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper > .block-editor-block-list__layout { - margin-top: -48px; - padding: 72px 16px 16px; - min-height: 32px; -} - -.wp-block-widget-area__highlight-drop-zone { - outline: var(--wp-admin-border-width-focus) solid var(--wp-admin-theme-color); -} - -body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title, -body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title * { - pointer-events: none; -} - -.edit-widgets-error-boundary { - margin: auto; - max-width: 780px; - padding: 20px; - margin-top: 60px; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); -} - -.edit-widgets-header { - display: flex; - align-items: center; - justify-content: space-between; - height: 60px; - padding: 0 16px; - overflow: auto; -} -@media (min-width: 600px) { - .edit-widgets-header { - overflow: visible; - } -} - -.edit-widgets-header__navigable-toolbar-wrapper { - display: flex; - align-items: center; - justify-content: center; -} - -.edit-widgets-header__title { - font-size: 20px; - padding: 0; - margin: 0 0 0 20px; -} - -.edit-widgets-header__actions { - display: flex; -} -.edit-widgets-header__actions .components-button { - margin-left: 4px; -} -@media (min-width: 600px) { - .edit-widgets-header__actions .components-button { - margin-left: 12px; - } -} -.edit-widgets-header__actions .edit-widgets-more-menu .components-button, -.edit-widgets-header__actions .interface-pinned-items .components-button { - margin-left: 0; -} - -.edit-widgets-header-toolbar { - border: none; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon { - height: 36px; - min-width: 36px; - padding: 6px; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed { - background: #1e1e1e; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:disabled), -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 1px #fff; - outline: 1px solid transparent; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon::before { - display: none; -} - -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle { - padding-right: 8px; - padding-left: 8px; -} -@media (min-width: 600px) { - .edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle { - padding-right: 12px; - padding-left: 12px; - } -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle::after { - content: none; -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(-45deg); -} - -.edit-widgets-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-widgets-keyboard-shortcut-help-modal__main-shortcuts .edit-widgets-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-widgets-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 1rem 0 0; - text-align: left; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0.2rem 0 0; -} - -.components-panel__header.edit-widgets-sidebar__panel-tabs { - justify-content: flex-start; - padding-right: 0; - padding-left: 4px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin-right: auto; -} -@media (min-width: 782px) { - .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-button.edit-widgets-sidebar__panel-tab { - border-radius: 0; - height: 49px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-right: 0; - font-weight: 400; - color: #1e1e1e; -} -.components-button.edit-widgets-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-widgets-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - font-weight: 600; - position: relative; -} -.components-button.edit-widgets-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - left: 0; - right: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-widgets-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.edit-widgets-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -.edit-widgets-widget-areas__top-container { - display: flex; - padding: 16px; -} -.edit-widgets-widget-areas__top-container .block-editor-block-icon { - margin-left: 16px; -} - -.edit-widgets-notices__snackbar { - position: fixed; - left: 0; - bottom: 20px; - padding-right: 16px; - padding-left: 16px; -} - -.edit-widgets-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .edit-widgets-notices__snackbar { - right: 160px; - } -} - -.auto-fold .edit-widgets-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-widgets-notices__snackbar { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-widgets-notices__snackbar { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-widgets-notices__snackbar { - right: 0; -} -@media (min-width: 783px) { - .folded .edit-widgets-notices__snackbar { - right: 36px; - } -} - -body.is-fullscreen-mode .edit-widgets-notices__snackbar { - right: 0 !important; -} - -.edit-widgets-notices__dismissible .components-notice, -.edit-widgets-notices__pinned .components-notice { - box-sizing: border-box; - margin: 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - padding: 0 12px; - min-height: 60px; -} -.edit-widgets-notices__dismissible .components-notice .components-notice__dismiss, -.edit-widgets-notices__pinned .components-notice .components-notice__dismiss { - margin-top: 12px; -} - -.edit-widgets-layout__inserter-panel { - height: 100%; - display: flex; - flex-direction: column; -} -.edit-widgets-layout__inserter-panel .block-editor-inserter__menu { - overflow: hidden; -} - -.edit-widgets-layout__inserter-panel-header { - padding-top: 8px; - padding-left: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-widgets-layout__inserter-panel-content { - height: calc(100% - 36px - 8px); -} -@media (min-width: 782px) { - .edit-widgets-layout__inserter-panel-content { - height: 100%; - } -} - -.edit-widgets-welcome-guide { - width: 312px; -} -.edit-widgets-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-widgets-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-widgets-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-widgets-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 24px 0; - padding: 0 32px; -} -.edit-widgets-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-widgets-block-editor { - position: relative; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - display: flex; - flex-direction: column; - flex-grow: 1; -} -.edit-widgets-block-editor > div:last-of-type, -.edit-widgets-block-editor .block-editor-writing-flow, -.edit-widgets-block-editor .block-editor-writing-flow > div { - display: flex; - flex-direction: column; - flex-grow: 1; -} -.edit-widgets-block-editor .edit-widgets-main-block-list { - height: 100%; -} -.edit-widgets-block-editor .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} -.edit-widgets-block-editor .components-button.is-tertiary, .edit-widgets-block-editor .components-button.has-icon { - padding: 6px; -} - -.edit-widgets-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; - min-width: 350px; -} - -.edit-widgets-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); - overflow-y: auto; - padding: 8px; -} - -.edit-widgets-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-right: 16px; - padding-left: 4px; -} - -html.wp-toolbar { - background: #fff; -} - -body.appearance_page_gutenberg-widgets, -body.widgets-php { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.appearance_page_gutenberg-widgets #wpcontent, -body.widgets-php #wpcontent { - padding-right: 0; -} -body.appearance_page_gutenberg-widgets #wpbody-content, -body.widgets-php #wpbody-content { - padding-bottom: 0; -} -body.appearance_page_gutenberg-widgets #wpbody-content > div:not(.blocks-widgets-container):not(#screen-meta), -body.widgets-php #wpbody-content > div:not(.blocks-widgets-container):not(#screen-meta) { - display: none; -} -body.appearance_page_gutenberg-widgets #wpfooter, -body.widgets-php #wpfooter { - display: none; -} -body.appearance_page_gutenberg-widgets .a11y-speak-region, -body.widgets-php .a11y-speak-region { - right: -1px; - top: -1px; -} -body.appearance_page_gutenberg-widgets ul#adminmenu a.wp-has-current-submenu::after, -body.appearance_page_gutenberg-widgets ul#adminmenu > li.current > a.current::after, -body.widgets-php ul#adminmenu a.wp-has-current-submenu::after, -body.widgets-php ul#adminmenu > li.current > a.current::after { - border-left-color: #fff; -} -body.appearance_page_gutenberg-widgets .media-frame select.attachment-filters:last-of-type, -body.widgets-php .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.blocks-widgets-container, -.components-modal__frame { - box-sizing: border-box; -} -.blocks-widgets-container *, -.blocks-widgets-container *::before, -.blocks-widgets-container *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .blocks-widgets-container { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - min-height: calc(100vh - 46px); - } -} -@media (min-width: 782px) { - .blocks-widgets-container { - min-height: calc(100vh - 32px); - } -} -.blocks-widgets-container .interface-interface-skeleton__content { - background-color: #f0f0f0; -} - -.blocks-widgets-container .editor-styles-wrapper { - max-width: 700px; - margin: auto; -} - -.edit-widgets-sidebar .components-button.interface-complementary-area__pin-unpin-item { - display: none; -} - -.widgets-php .notice { - display: none !important; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-right: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-right: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-left: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-left: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - right: 10px; - bottom: 10px; - left: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-left: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - left: 0; - right: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - left: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - left: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - left: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - left: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-left: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-right: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - left: auto; - right: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-left: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-left: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-left: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - left: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-left: 24px; - margin-left: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 0 0.6rem 10px; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 0 8px 58px; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.wp-block[data-type="core/widget-area"] { - max-width: 700px; - margin-left: auto; - margin-right: auto; -} -.wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - margin: 0; - height: 48px; - position: relative; - z-index: 1; - background: #fff; - transform: translateZ(0); -} -.wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title:hover { - background: #fff; -} -.wp-block[data-type="core/widget-area"] .block-list-appender.wp-block { - width: initial; - position: relative; -} -.wp-block[data-type="core/widget-area"] .editor-styles-wrapper .wp-block.wp-block.wp-block.wp-block.wp-block { - max-width: 100%; -} -.wp-block[data-type="core/widget-area"] .components-panel__body.is-opened { - padding: 0; -} - -.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper { - margin: 0; - padding: 0; -} -.blocks-widgets-container .wp-block-widget-area__inner-blocks.editor-styles-wrapper > .block-editor-block-list__layout { - margin-top: -48px; - padding: 72px 16px 16px; - min-height: 32px; -} - -.wp-block-widget-area__highlight-drop-zone { - outline: var(--wp-admin-border-width-focus) solid var(--wp-admin-theme-color); -} - -body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title, -body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .components-panel__body > .components-panel__body-title * { - pointer-events: none; -} - -.edit-widgets-error-boundary { - margin: auto; - max-width: 780px; - padding: 20px; - margin-top: 60px; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); -} - -.edit-widgets-header { - display: flex; - align-items: center; - justify-content: space-between; - height: 60px; - padding: 0 16px; - overflow: auto; -} -@media (min-width: 600px) { - .edit-widgets-header { - overflow: visible; - } -} - -.edit-widgets-header__navigable-toolbar-wrapper { - display: flex; - align-items: center; - justify-content: center; -} - -.edit-widgets-header__title { - font-size: 20px; - padding: 0; - margin: 0 20px 0 0; -} - -.edit-widgets-header__actions { - display: flex; -} -.edit-widgets-header__actions .components-button { - margin-right: 4px; -} -@media (min-width: 600px) { - .edit-widgets-header__actions .components-button { - margin-right: 12px; - } -} -.edit-widgets-header__actions .edit-widgets-more-menu .components-button, -.edit-widgets-header__actions .interface-pinned-items .components-button { - margin-right: 0; -} - -.edit-widgets-header-toolbar { - border: none; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon { - height: 36px; - min-width: 36px; - padding: 6px; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed { - background: #1e1e1e; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:disabled), -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 1px #fff; - outline: 1px solid transparent; -} -.edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before, -.edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon::before { - display: none; -} - -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle { - padding-left: 8px; - padding-right: 8px; -} -@media (min-width: 600px) { - .edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle { - padding-left: 12px; - padding-right: 12px; - } -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle::after { - content: none; -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-widgets-header-toolbar__inserter-toggle.edit-widgets-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(45deg); -} - -.edit-widgets-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-widgets-keyboard-shortcut-help-modal__main-shortcuts .edit-widgets-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-widgets-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 0 0 1rem; - text-align: right; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0 0 0.2rem; -} - -.components-panel__header.edit-widgets-sidebar__panel-tabs { - justify-content: flex-start; - padding-left: 0; - padding-right: 4px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin-left: auto; -} -@media (min-width: 782px) { - .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-button.edit-widgets-sidebar__panel-tab { - border-radius: 0; - height: 49px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-left: 0; - font-weight: 400; - color: #1e1e1e; -} -.components-button.edit-widgets-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-widgets-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - font-weight: 600; - position: relative; -} -.components-button.edit-widgets-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - right: 0; - left: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-widgets-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.edit-widgets-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -.edit-widgets-widget-areas__top-container { - display: flex; - padding: 16px; -} -.edit-widgets-widget-areas__top-container .block-editor-block-icon { - margin-right: 16px; -} - -.edit-widgets-notices__snackbar { - position: fixed; - right: 0; - bottom: 20px; - padding-left: 16px; - padding-right: 16px; -} - -.edit-widgets-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .edit-widgets-notices__snackbar { - left: 160px; - } -} - -.auto-fold .edit-widgets-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-widgets-notices__snackbar { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-widgets-notices__snackbar { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-widgets-notices__snackbar { - left: 0; -} -@media (min-width: 783px) { - .folded .edit-widgets-notices__snackbar { - left: 36px; - } -} - -body.is-fullscreen-mode .edit-widgets-notices__snackbar { - left: 0 !important; -} - -.edit-widgets-notices__dismissible .components-notice, -.edit-widgets-notices__pinned .components-notice { - box-sizing: border-box; - margin: 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - padding: 0 12px; - min-height: 60px; -} -.edit-widgets-notices__dismissible .components-notice .components-notice__dismiss, -.edit-widgets-notices__pinned .components-notice .components-notice__dismiss { - margin-top: 12px; -} - -.edit-widgets-layout__inserter-panel { - height: 100%; - display: flex; - flex-direction: column; -} -.edit-widgets-layout__inserter-panel .block-editor-inserter__menu { - overflow: hidden; -} - -.edit-widgets-layout__inserter-panel-header { - padding-top: 8px; - padding-right: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-widgets-layout__inserter-panel-content { - height: calc(100% - 36px - 8px); -} -@media (min-width: 782px) { - .edit-widgets-layout__inserter-panel-content { - height: 100%; - } -} - -.edit-widgets-welcome-guide { - width: 312px; -} -.edit-widgets-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-widgets-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-widgets-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-widgets-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 24px 0; - padding: 0 32px; -} -.edit-widgets-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-widgets-block-editor { - position: relative; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - display: flex; - flex-direction: column; - flex-grow: 1; -} -.edit-widgets-block-editor > div:last-of-type, -.edit-widgets-block-editor .block-editor-writing-flow, -.edit-widgets-block-editor .block-editor-writing-flow > div { - display: flex; - flex-direction: column; - flex-grow: 1; -} -.edit-widgets-block-editor .edit-widgets-main-block-list { - height: 100%; -} -.edit-widgets-block-editor .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} -.edit-widgets-block-editor .components-button.is-tertiary, .edit-widgets-block-editor .components-button.has-icon { - padding: 6px; -} - -.edit-widgets-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; - min-width: 350px; -} - -.edit-widgets-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); - overflow-y: auto; - padding: 8px; -} - -.edit-widgets-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-left: 16px; - padding-right: 4px; -} - -html.wp-toolbar { - background: #fff; -} - -body.appearance_page_gutenberg-widgets, -body.widgets-php { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.appearance_page_gutenberg-widgets #wpcontent, -body.widgets-php #wpcontent { - padding-left: 0; -} -body.appearance_page_gutenberg-widgets #wpbody-content, -body.widgets-php #wpbody-content { - padding-bottom: 0; -} -body.appearance_page_gutenberg-widgets #wpbody-content > div:not(.blocks-widgets-container):not(#screen-meta), -body.widgets-php #wpbody-content > div:not(.blocks-widgets-container):not(#screen-meta) { - display: none; -} -body.appearance_page_gutenberg-widgets #wpfooter, -body.widgets-php #wpfooter { - display: none; -} -body.appearance_page_gutenberg-widgets .a11y-speak-region, -body.widgets-php .a11y-speak-region { - left: -1px; - top: -1px; -} -body.appearance_page_gutenberg-widgets ul#adminmenu a.wp-has-current-submenu::after, -body.appearance_page_gutenberg-widgets ul#adminmenu > li.current > a.current::after, -body.widgets-php ul#adminmenu a.wp-has-current-submenu::after, -body.widgets-php ul#adminmenu > li.current > a.current::after { - border-right-color: #fff; -} -body.appearance_page_gutenberg-widgets .media-frame select.attachment-filters:last-of-type, -body.widgets-php .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.blocks-widgets-container, -.components-modal__frame { - box-sizing: border-box; -} -.blocks-widgets-container *, -.blocks-widgets-container *::before, -.blocks-widgets-container *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .blocks-widgets-container { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - min-height: calc(100vh - 46px); - } -} -@media (min-width: 782px) { - .blocks-widgets-container { - min-height: calc(100vh - 32px); - } -} -.blocks-widgets-container .interface-interface-skeleton__content { - background-color: #f0f0f0; -} - -.blocks-widgets-container .editor-styles-wrapper { - max-width: 700px; - margin: auto; -} - -.edit-widgets-sidebar .components-button.interface-complementary-area__pin-unpin-item { - display: none; -} - -.widgets-php .notice { - display: none !important; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-left:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-left:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-right:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-right:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;left:10px;bottom:10px;right:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-right:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;left:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{right:0}@media (min-width:783px){.interface-interface-skeleton{right:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{right:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{right:160px}}.folded .interface-interface-skeleton{right:0}@media (min-width:783px){.folded .interface-interface-skeleton{right:36px}}body.is-fullscreen-mode .interface-interface-skeleton{right:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;left:0;bottom:0;right:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-right:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-left:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;right:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;right:auto;left:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-right:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-right:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-right:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;right:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-right:24px;margin-right:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 10px .6rem 0}.interface-preferences-modal__option .components-base-control__help{margin:-8px 58px 8px 0;font-size:12px;font-style:normal;color:#757575}.edit-site-block-editor__editor-styles-wrapper .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;padding:6px 12px}.edit-site-block-editor__editor-styles-wrapper .components-button.has-icon,.edit-site-block-editor__editor-styles-wrapper .components-button.is-tertiary{padding:6px}.edit-site-visual-editor{background-color:#2f2f2f;align-items:center}.edit-site-visual-editor.is-focus-mode{padding:48px}.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas{border-radius:2px}.edit-site-visual-editor.is-focus-mode .components-resizable-box__container{overflow:visible}.edit-site-visual-editor .components-resizable-box__container{margin:0 auto;overflow:auto}.edit-site-visual-editor__back-button{position:absolute;top:8px;right:8px;color:#fff}.edit-site-visual-editor__back-button:active:not([aria-disabled=true]),.edit-site-visual-editor__back-button:focus:not([aria-disabled=true]),.edit-site-visual-editor__back-button:hover{color:#f0f0f0}.resizable-editor__drag-handle{position:absolute;top:0;bottom:0;padding:0;margin:auto 0;width:4px;height:100px;-webkit-appearance:none;appearance:none;cursor:ew-resize;outline:none;background:#949494;border-radius:2px;border:0}.resizable-editor__drag-handle.is-left{right:-16px}.resizable-editor__drag-handle.is-right{left:-16px}.resizable-editor__drag-handle:active,.resizable-editor__drag-handle:hover{background:#ccc}.resizable-editor__drag-handle:focus{box-shadow:0 0 0 1px #2f2f2f,0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color)}.edit-site-code-editor{position:relative;width:100%;background-color:#fff;flex-grow:1}.edit-site-code-editor__body{width:100%;padding:0 12px 12px;max-width:1080px;margin-right:auto;margin-left:auto}@media (min-width:960px){.edit-site-code-editor__body{padding:0 24px 24px}}.edit-site-code-editor__toolbar{position:sticky;z-index:1;top:0;right:0;left:0;display:flex;background:hsla(0,0%,100%,.8);padding:4px 12px}@media (min-width:600px){.edit-site-code-editor__toolbar{padding:12px}}@media (min-width:960px){.edit-site-code-editor__toolbar{padding:12px 24px}}.edit-site-code-editor__toolbar h2{line-height:36px;margin:0 0 0 auto;font-size:13px;color:#1e1e1e}.edit-site-code-editor__toolbar .components-button svg{order:1}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{border:1px solid #949494;border-radius:0;display:block;margin:0;width:100%;box-shadow:none;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;line-height:2.4;min-height:200px;transition:border .1s ease-out,box-shadow .1s linear;padding:16px;font-size:16px!important}@media (prefers-reduced-motion:reduce){textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{padding:24px;font-size:15px!important}}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-webkit-input-placeholder{color:rgba(30,30,30,.62)}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-moz-placeholder{color:rgba(30,30,30,.62);opacity:1}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-input-placeholder{color:rgba(30,30,30,.62)}.edit-site-global-styles-preview{display:flex;align-items:center;justify-content:center;line-height:1;cursor:pointer}.edit-site-global-styles-preview__iframe{max-width:100%;display:block}.edit-site-typography-panel__preview{display:flex;align-items:center;justify-content:center;min-height:100px;margin-bottom:16px;background:#f0f0f0;border-radius:2px}.edit-site-global-styles-screen-typography{margin:16px}.edit-site-global-styles-screen-typography__indicator{height:24px;width:24px;font-size:14px;display:flex!important;align-items:center;justify-content:center;border-radius:2px}.edit-site-global-styles-screen-colors{margin:16px}.edit-site-global-styles-screen-colors .component-color-indicator{background:linear-gradient(45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.edit-site-block-types-search,.edit-site-global-styles-header__description{padding:0 16px}.edit-site-global-styles-subtitle{margin-bottom:0!important;text-transform:uppercase;font-weight:500!important;font-size:11px!important}.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle{margin-left:16px;margin-right:16px;width:unset}.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control{min-height:32px}.edit-site-screen-background-color__control,.edit-site-screen-link-color__control,.edit-site-screen-text-color__control{padding:16px}.edit-site-global-styles-variations_item{box-sizing:border-box}.edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview{padding:2px;border-radius:2px;border:1px solid #e0e0e0}.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview{border:1px solid #1e1e1e}.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview,.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview{border:1px solid var(--wp-admin-theme-color)}.edit-site-global-styles-icon-with-current-color{fill:currentColor}.edit-site-global-styles__color-indicator-wrapper{height:24px}.edit-site-header{align-items:center;background-color:#fff;display:flex;height:60px;box-sizing:border-box;width:100%;justify-content:space-between}body.is-fullscreen-mode .edit-site-header{padding-right:60px;transition:padding-right 20ms linear;transition-delay:80ms}@media (prefers-reduced-motion:reduce){body.is-fullscreen-mode .edit-site-header{transition-duration:0s;transition-delay:0s}}.edit-site-header .edit-site-header_end,.edit-site-header .edit-site-header_start{display:flex}.edit-site-header .edit-site-header_center{display:flex;align-items:center;height:100%;flex-grow:1;justify-content:center;min-width:0}.edit-site-header .edit-site-header_end{justify-content:flex-end}body.is-navigation-sidebar-open .edit-site-header{padding-right:0;transition:padding-right 20ms linear;transition-delay:0ms}@media (prefers-reduced-motion:reduce){body.is-navigation-sidebar-open .edit-site-header{transition-duration:0s;transition-delay:0s}}@media (max-width:959px){body.is-navigation-sidebar-open .edit-site-header .edit-site-header-toolbar__inserter-toggle~.components-button,body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .components-button:not(.is-primary){display:none}body.is-navigation-sidebar-open .edit-site-header .edit-site-save-button__button{margin-left:0}}.edit-site-header__toolbar{display:flex;align-items:center;padding-right:8px}@media (min-width:600px){.edit-site-header__toolbar{padding-right:24px}}@media (min-width:1280px){.edit-site-header__toolbar{padding-left:8px}}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle{margin-left:8px;min-width:32px;width:32px;height:32px;padding:0}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(-45deg)}.edit-site-header__toolbar-switchers{align-items:center;display:flex}.edit-site-header__toolbar-switchers-separator{margin:0 -6px}.edit-site-header__actions{display:inline-flex;align-items:center;padding-left:4px}.edit-site-header__actions .interface-pinned-items{display:none}@media (min-width:782px){.edit-site-header__actions .interface-pinned-items{display:inline-flex}}.edit-site-header__actions .components-button.components-button,.edit-site-header__actions .editor-post-saved-state{margin-left:4px}@media (min-width:600px){.edit-site-header__actions .components-button.components-button,.edit-site-header__actions .editor-post-saved-state{margin-left:12px}}.edit-site-header__actions .components-button.is-tertiary,.edit-site-header__actions .editor-post-saved-state{padding:0 6px}.edit-site-header__actions .edit-site-more-menu .components-button,.edit-site-header__actions .interface-pinned-items .components-button{margin-left:0}@media (min-width:600px){.edit-site-header__actions{padding-left:16px}}.edit-site-header__actions-more-menu{margin-right:-4px}.edit-site-header__actions-more-menu .components-icon-button{padding:8px 2px;width:auto}@media (min-width:600px){.edit-site-header__actions-more-menu{margin-right:4px}.edit-site-header__actions-more-menu .components-icon-button{padding:8px 4px}}.show-icon-labels .edit-site-header .components-button.has-icon{width:auto}.show-icon-labels .edit-site-header .components-button.has-icon svg{display:none}.show-icon-labels .edit-site-header .components-button.has-icon:after{content:attr(aria-label)}.show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true]{background-color:transparent}.show-icon-labels .edit-site-header .is-tertiary:active{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color);background-color:transparent}.show-icon-labels .edit-site-header .edit-site-save-button__button{padding-right:6px;padding-left:6px;margin-left:4px}.show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle{margin-left:4px}.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info,.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle{height:36px;padding:0 6px}.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info:after,.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle:after{content:none}.edit-site-document-actions{display:flex;flex-direction:column;justify-content:center;padding:0 8px;height:100%;min-width:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper{display:flex;flex-direction:row;justify-content:center;align-items:center;min-width:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown{display:inline-flex;margin-right:4px}.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown .components-button{min-width:0;padding:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper>h1{margin:0;min-width:0}.edit-site-document-actions .edit-site-document-actions__title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.edit-site-document-actions .edit-site-document-actions__secondary-item{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:0;opacity:0;padding:0;transition:all .2s ease;background:#e0e0e0;border-radius:2px}@media (prefers-reduced-motion:reduce){.edit-site-document-actions .edit-site-document-actions__secondary-item{transition-duration:0s;transition-delay:0s}}.edit-site-document-actions.has-secondary-label .edit-site-document-actions__secondary-item{opacity:1;padding:0 4px;max-width:180px;margin-right:6px}.edit-site-document-actions__info-dropdown>.components-popover__content>div{padding:0;min-width:240px}.edit-site-navigation-toggle{align-items:center;background:#1e1e1e;border-radius:0;display:flex;position:absolute;z-index:31;height:60px;width:60px}.edit-site-navigation-toggle__button.components-button{align-items:center;background:#1e1e1e;border-radius:0;color:#fff;height:61px;width:60px;z-index:1;margin-bottom:-1px;min-width:60px}.edit-site-navigation-toggle__button.components-button:active,.edit-site-navigation-toggle__button.components-button:hover{color:#fff}.edit-site-navigation-toggle__button.components-button:focus{box-shadow:none}.edit-site-navigation-toggle__button.components-button:before{transition:box-shadow .1s ease;content:"";display:block;position:absolute;top:9px;left:9px;bottom:9px;right:9px;border-radius:4px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}@media (prefers-reduced-motion:reduce){.edit-site-navigation-toggle__button.components-button:before{transition-duration:0s;transition-delay:0s}}.edit-site-navigation-toggle__button.components-button:hover:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #757575}.edit-site-navigation-toggle__button.components-button.has-icon:hover:before{box-shadow:none}.edit-site-navigation-toggle__button.components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) hsla(0,0%,100%,.1),inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon{width:36px;height:36px;border-radius:2px;-o-object-fit:cover;object-fit:cover;margin-top:-1px}.edit-site-navigation-panel{height:100%;position:relative;width:0;overflow:hidden;background:#1e1e1e;color:#fff;transition:width .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-navigation-panel{transition-duration:0s;transition-delay:0s}}@media (min-width:782px){.interface-interface-skeleton.has-footer .edit-site-navigation-panel{height:calc(100% - 25px)}}.edit-site-navigation-panel__inner{position:relative;width:300px;height:100%;overflow:hidden;visibility:hidden;transition:visibility .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-navigation-panel__inner{transition-duration:0s;transition-delay:0s}}.edit-site-navigation-panel.is-open{width:300px}.edit-site-navigation-panel.is-open .edit-site-navigation-panel__inner{visibility:visible}.edit-site-navigation-panel__site-title-container{height:60px;padding-right:60px;margin:0 8px 0 16px;display:flex;align-items:center}.edit-site-navigation-panel__site-title{font-style:normal;font-weight:600;font-size:14px;line-height:20px;color:#ddd;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.edit-site-navigation-panel__scroll-container{overflow-x:hidden;overflow-y:auto;height:calc(100% - 60px)}.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary{height:36px;margin-top:24px;padding:8px 8px 8px 16px}.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary:focus:not(:disabled){border-bottom-color:transparent}.edit-site-navigation-panel__preview{display:none;border:1px solid #ccc;width:300px;padding:16px;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.05);border-radius:2px;position:absolute;top:73px;right:312px;color:#1e1e1e;z-index:32}@media (min-width:782px){.edit-site-navigation-panel__preview{display:block}}.edit-site-navigation-panel__template-item{display:block}.edit-site-navigation-panel__template-item .components-button{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;height:auto;min-height:36px;text-align:right;padding-right:16px;padding-left:16px;color:inherit}.edit-site-navigation-panel__template-item-title{font-size:14px;line-height:20px}.edit-site-navigation-panel__template-item-title em{margin-left:1ch}.edit-site-navigation-panel__template-part-item .components-navigation__item-title,.edit-site-navigation-panel__template-parts .components-navigation__menu-title-heading{text-transform:capitalize}.components-navigation__item+.edit-site-navigation-panel__template-item{margin-top:16px}.edit-site-navigation-panel__template-item+.edit-site-navigation-panel__template-item{margin-top:8px}.edit-site-navigation-panel__info-wrapper{padding:4px 0}.edit-site-navigation-panel__template-item-description{padding-top:8px;font-size:12px;line-height:16px}.edit-site-navigation-panel__new-template-dropdown{margin:0 12px 0 0}.edit-site-navigation-panel__new-template-dropdown button{margin:0}@media (min-width:600px){.edit-site-navigation-panel__new-template-popover{min-width:300px}}.edit-site-list-header{position:relative;align-items:center;background-color:#fff;display:flex;height:60px;box-sizing:border-box;width:100%;justify-content:flex-end;padding-left:16px}body.is-fullscreen-mode .edit-site-list-header{padding-right:60px;transition:padding-right 20ms linear;transition-delay:80ms}@media (prefers-reduced-motion:reduce){body.is-fullscreen-mode .edit-site-list-header{transition-duration:0s;transition-delay:0s}}.edit-site-list-header .edit-site-list-header__title{position:absolute;right:0;width:100%;text-align:center;font-size:20px;padding:0;margin:0}.edit-site-list-header__right{position:relative}.edit-site .edit-site-list .interface-interface-skeleton__editor{min-width:100%}@media (min-width:782px){.edit-site .edit-site-list .interface-interface-skeleton__editor{min-width:0}}.edit-site .edit-site-list .interface-interface-skeleton__content{background:#fff;align-items:center;padding:16px}@media (min-width:782px){.edit-site .edit-site-list .interface-interface-skeleton__content{padding:72px}}.edit-site-list-table{width:100%;border:1px solid #ddd;border-radius:2px;margin:0;overflow:hidden;border-spacing:0;max-width:960px}.edit-site-list-table tr{display:flex;align-items:center;padding:16px;box-sizing:border-box;border-top:1px solid #f0f0f0;margin:0}.edit-site-list-table tr:first-child{border-top:0}@media (min-width:782px){.edit-site-list-table tr{padding:24px 32px}}.edit-site-list-table tr .edit-site-list-table-column:first-child{width:calc(60% - 18px);padding-left:24px}.edit-site-list-table tr .edit-site-list-table-column:first-child a{display:inline-block;text-decoration:none;font-weight:500;margin-bottom:4px}.edit-site-list-table tr .edit-site-list-table-column:nth-child(2){width:calc(40% - 18px)}.edit-site-list-table tr .edit-site-list-table-column:nth-child(3){min-width:36px;flex-shrink:0}.edit-site-list-table tr.edit-site-list-table-head{font-size:16px;font-weight:600;text-align:right;color:#1e1e1e;border-top:none;border-bottom:1px solid #ddd}.edit-site-list-table tr.edit-site-list-table-head th{font-weight:inherit}@media (min-width:782px){.edit-site-list.is-navigation-open .components-snackbar-list{margin-right:300px}}@media (min-width:782px){.edit-site-list__rename-modal .components-base-control{width:320px}}.edit-site-list__rename-modal .components-modal__header{border-bottom:none}.edit-site-list__rename-modal .components-modal__content:before{margin-bottom:4px}.edit-site-list__rename-modal-actions{margin-top:12px}.edit-site-template__actions button:not(:last-child){margin-left:8px}.edit-site-list-added-by__icon{display:flex;flex-shrink:0;position:relative;align-items:center;justify-content:center;width:32px;height:32px;background:#2f2f2f;border-radius:100%}.edit-site-list-added-by__icon svg{fill:#fff}.edit-site-list-added-by__icon.is-customized:after{position:absolute;content:"";background:var(--wp-admin-theme-color);height:8px;width:8px;outline:2px solid #fff;border-radius:100%;top:-1px;left:-1px}.edit-site-list-added-by__avatar{flex-shrink:0;overflow:hidden;border-radius:100%;background:#2f2f2f;width:32px;height:32px}.edit-site-list-added-by__avatar img{width:32px;height:32px;-o-object-fit:cover;object-fit:cover;opacity:0;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-list-added-by__avatar img{transition-duration:0s;transition-delay:0s}}.edit-site-list-added-by__avatar.is-loaded img{opacity:1}.edit-site-new-template-dropdown .components-dropdown-menu__toggle{padding:6px 12px}@media (min-width:600px){.edit-site-new-template-dropdown .edit-site-new-template-dropdown__popover{min-width:300px}}.edit-site-sidebar{width:280px}.edit-site-sidebar>.components-panel{border-right:0;border-left:0;margin-bottom:-1px;margin-top:-1px}.edit-site-sidebar>.components-panel>.components-panel__header{background:#f0f0f0}.edit-site-sidebar .block-editor-block-inspector__card{margin:0}.edit-site-global-styles-sidebar{display:flex;flex-direction:column;min-height:100%}.edit-site-global-styles-sidebar__navigator-provider,.edit-site-global-styles-sidebar__panel{display:flex;flex-direction:column;flex:1}.edit-site-global-styles-sidebar__navigator-screen{flex:1}.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon{margin-right:0}.edit-site-global-styles-sidebar__reset-button.components-button{margin-right:auto}.edit-site-global-styles-sidebar .components-navigation__menu-title-heading{font-size:15.6px;font-weight:500}.edit-site-global-styles-sidebar .components-navigation__item>button span{font-weight:500}.edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings,.edit-site-typography-panel{border:0}.edit-site-global-styles-sidebar .components-tools-panel-item.single-column{grid-column:span 1}.edit-site-global-styles-sidebar__blocks-group{padding-top:24px;border-top:1px solid #e0e0e0}.edit-site-global-styles-sidebar__blocks-group-help{padding:0 16px}.edit-site-global-styles-color-palette-panel,.edit-site-global-styles-gradient-palette-panel{padding:16px}.edit-site-global-styles-sidebar__beta{display:inline-flex;margin-right:8px;padding:0 8px;height:24px;border-radius:2px;background-color:#1e1e1e;color:#fff;align-items:center;font-size:12px;line-height:1}.components-panel__header.edit-site-sidebar__panel-tabs{justify-content:flex-start;padding-right:0;padding-left:16px;border-top:0;margin-top:0}.components-panel__header.edit-site-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-site-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon{display:none;margin:0 auto 0 0;padding:0;min-width:24px;height:24px}@media (min-width:782px){.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-button.edit-site-sidebar__panel-tab{border-radius:0;height:48px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-right:0;font-weight:500}.components-button.edit-site-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-site-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-site-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;left:0;right:0;border-bottom:4px solid transparent}.components-button.edit-site-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-site-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.edit-site-navigation-inspector{padding:16px}.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents{align-items:flex-start;white-space:normal}.edit-site-navigation-inspector .block-editor-list-view-block__title{margin-top:3px}.edit-site-navigation-inspector .block-editor-list-view-block__menu-cell{padding-left:0}.edit-site-navigation-inspector__placeholder{padding:8px;margin:8px;background-color:#f0f0f0;animation:loadingpulse 1s linear infinite;animation-delay:.5s}.edit-site-navigation-inspector__placeholder.is-child{margin-right:24px;width:50%}.edit-site-template-card{display:flex;align-items:flex-start}.edit-site-template-card__content{flex-grow:1;margin-bottom:4px}.edit-site-template-card__title{font-weight:500;line-height:24px}.edit-site-template-card__title.edit-site-template-card__title{margin:0 0 4px}.edit-site-template-card__description{font-size:13px;margin:0 0 16px}.edit-site-template-card__icon{flex:0 0 24px;margin-left:12px;width:24px;height:24px}h3.edit-site-template-card__template-areas-title{font-weight:500;margin:0 0 8px}.edit-site-template-card__template-areas-list,.edit-site-template-card__template-areas-list>li{margin:0}.edit-site-template-card__template-areas-item{width:100%}.edit-site-template-card__template-areas-item.components-button.has-icon{padding:0}html #wpadminbar{display:none}html.wp-toolbar{padding-top:0}.edit-site-editor__toggle-save-panel{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;right:auto;left:0;width:280px;background-color:#fff;border:1px dotted #ddd;height:auto!important;padding:24px;display:flex;justify-content:center}.interface-interface-skeleton__actions:focus-within .edit-site-editor__toggle-save-panel,.interface-interface-skeleton__actions:focus .edit-site-editor__toggle-save-panel{top:auto;bottom:0}.edit-site-visual-editor{position:relative;height:100%;display:block}.edit-site-visual-editor iframe{display:block;width:100%;height:100%;background-color:#fff}.edit-site .components-editor-notices__snackbar{position:fixed;left:0;bottom:40px;padding-right:16px;padding-left:16px;right:0}@media (min-width:783px){.edit-site .components-editor-notices__snackbar{right:160px}}@media (min-width:783px){.auto-fold .edit-site .components-editor-notices__snackbar{right:36px}}@media (min-width:961px){.auto-fold .edit-site .components-editor-notices__snackbar{right:160px}}.folded .edit-site .components-editor-notices__snackbar{right:0}@media (min-width:783px){.folded .edit-site .components-editor-notices__snackbar{right:36px}}body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{right:0!important}.edit-site-template-details .edit-site-template-details__group{margin:0;padding:16px}.edit-site-template-details .edit-site-template-details__group+.edit-site-template-details__group{border-top:1px solid #ccc}.edit-site-template-details .edit-site-template-details__title{margin:0}.edit-site-template-details .edit-site-template-details__description{margin:12px 0 0;color:#757575}.edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas{padding:8px}.edit-site-template-details .edit-site-template-details__template-areas-item{position:relative}.edit-site-template-details .edit-site-template-details__template-areas-item .edit-site-template-details__template-areas-item-more{position:absolute;left:0;top:0;bottom:0;margin:auto 0}.edit-site-template-details .edit-site-template-details__revert{padding:12px 8px}.edit-site-template-details .edit-site-template-details__revert-button{height:auto;padding:4px 8px;text-align:right}.edit-site-template-details .edit-site-template-details__revert-button:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff}.edit-site-template-details .edit-site-template-details__show-all-button.components-button{display:flex;justify-content:center;background:#1e1e1e;color:#fff;width:100%;height:44px;border-radius:0}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:hover{color:#fff}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:active{color:#ccc}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff}.edit-site-create-template-part-modal{z-index:1000001}@media (min-width:600px){.edit-site-create-template-part-modal .components-modal__frame{max-width:500px}}.edit-site-create-template-part-modal__modal-actions{padding-top:12px}.edit-site-create-template-part-modal__area-base-control .components-base-control__label{margin:16px 0 8px;cursor:auto}.edit-site-create-template-part-modal__area-radio-group{width:100%;border:1px solid #757575;border-radius:2px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio{display:block;width:100%;height:100%;text-align:right;padding:12px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover{margin:0;background-color:inherit;border-bottom:1px solid #757575;border-radius:0}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:not(:focus),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:not(:focus),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:focus){box-shadow:none}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:focus,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:focus,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:focus{border-bottom:1px solid #fff}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:last-of-type,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:last-of-type,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:last-of-type{border-bottom:none}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true]{color:#1e1e1e;cursor:auto}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover) .edit-site-create-template-part-modal__option-label div,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] .edit-site-create-template-part-modal__option-label div{color:#949494}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label{padding-top:4px;white-space:normal}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label div{padding-top:4px;font-size:12px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__checkbox{margin-right:auto;min-width:24px}.edit-site-editor__inserter-panel,.edit-site-editor__list-view-panel{height:100%;display:flex;flex-direction:column}.edit-site-editor__list-view-panel{min-width:350px}.edit-site-editor__inserter-panel-header{padding-top:8px;padding-left:8px;display:flex;justify-content:flex-end}.edit-site-editor__inserter-panel-content,.edit-site-editor__list-view-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-site-editor__inserter-panel-content{height:100%}}.edit-site-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-right:16px;padding-left:4px}.edit-site-editor__list-view-panel-content{overflow-y:auto;padding:8px}.edit-site-welcome-guide{width:312px}.edit-site-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-site-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-site-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-site-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 16px;padding:0 32px}.edit-site-welcome-guide__text img{vertical-align:bottom}.edit-site-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-site-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-site-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-site-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-site-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-site-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-site-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 1rem 0 0;text-align:left}.edit-site-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-site-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 .2rem 0 0}body.appearance_page_gutenberg-edit-site,body.site-editor-php,html.wp-toolbar{background:#fff}body.appearance_page_gutenberg-edit-site #wpcontent,body.site-editor-php #wpcontent{padding-right:0}body.appearance_page_gutenberg-edit-site #wpbody-content,body.site-editor-php #wpbody-content{padding-bottom:0}body.appearance_page_gutenberg-edit-site #wpbody-content>div:not(.edit-site):not(#screen-meta),body.appearance_page_gutenberg-edit-site #wpfooter,body.site-editor-php #wpbody-content>div:not(.edit-site):not(#screen-meta),body.site-editor-php #wpfooter{display:none}body.appearance_page_gutenberg-edit-site .a11y-speak-region,body.site-editor-php .a11y-speak-region{right:-1px;top:-1px}body.appearance_page_gutenberg-edit-site ul#adminmenu>li.current>a.current:after,body.appearance_page_gutenberg-edit-site ul#adminmenu a.wp-has-current-submenu:after,body.site-editor-php ul#adminmenu>li.current>a.current:after,body.site-editor-php ul#adminmenu a.wp-has-current-submenu:after{border-left-color:#fff}body.appearance_page_gutenberg-edit-site .media-frame select.attachment-filters:last-of-type,body.site-editor-php .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.components-modal__frame,.edit-site{box-sizing:border-box}.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before,.edit-site *,.edit-site :after,.edit-site :before{box-sizing:inherit}@media (min-width:600px){.edit-site{bottom:0;right:0;min-height:100vh;position:absolute;left:0;top:0}}.edit-site .interface-interface-skeleton{top:0}.edit-site .interface-complementary-area__pin-unpin-item.components-button{display:none}.edit-site .interface-interface-skeleton__content{background-color:#2f2f2f}@keyframes edit-post__fade-in-animation{0%{opacity:0}to{opacity:1}}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-right:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-right:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-left:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-left:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;right:10px;bottom:10px;left:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-left:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;right:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{left:0}@media (min-width:783px){.interface-interface-skeleton{left:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{left:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{left:160px}}.folded .interface-interface-skeleton{left:0}@media (min-width:783px){.folded .interface-interface-skeleton{left:36px}}body.is-fullscreen-mode .interface-interface-skeleton{left:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;right:0;bottom:0;left:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-left:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-right:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;left:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;left:auto;right:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-left:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-left:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-left:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;left:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-left:24px;margin-left:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 0 .6rem 10px}.interface-preferences-modal__option .components-base-control__help{margin:-8px 0 8px 58px;font-size:12px;font-style:normal;color:#757575}.edit-site-block-editor__editor-styles-wrapper .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;padding:6px 12px}.edit-site-block-editor__editor-styles-wrapper .components-button.has-icon,.edit-site-block-editor__editor-styles-wrapper .components-button.is-tertiary{padding:6px}.edit-site-visual-editor{background-color:#2f2f2f;align-items:center}.edit-site-visual-editor.is-focus-mode{padding:48px}.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas{border-radius:2px}.edit-site-visual-editor.is-focus-mode .components-resizable-box__container{overflow:visible}.edit-site-visual-editor .components-resizable-box__container{margin:0 auto;overflow:auto}.edit-site-visual-editor__back-button{position:absolute;top:8px;left:8px;color:#fff}.edit-site-visual-editor__back-button:active:not([aria-disabled=true]),.edit-site-visual-editor__back-button:focus:not([aria-disabled=true]),.edit-site-visual-editor__back-button:hover{color:#f0f0f0}.resizable-editor__drag-handle{position:absolute;top:0;bottom:0;padding:0;margin:auto 0;width:4px;height:100px;-webkit-appearance:none;appearance:none;cursor:ew-resize;outline:none;background:#949494;border-radius:2px;border:0}.resizable-editor__drag-handle.is-left{left:-16px}.resizable-editor__drag-handle.is-right{right:-16px}.resizable-editor__drag-handle:active,.resizable-editor__drag-handle:hover{background:#ccc}.resizable-editor__drag-handle:focus{box-shadow:0 0 0 1px #2f2f2f,0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color)}.edit-site-code-editor{position:relative;width:100%;background-color:#fff;flex-grow:1}.edit-site-code-editor__body{width:100%;padding:0 12px 12px;max-width:1080px;margin-left:auto;margin-right:auto}@media (min-width:960px){.edit-site-code-editor__body{padding:0 24px 24px}}.edit-site-code-editor__toolbar{position:sticky;z-index:1;top:0;left:0;right:0;display:flex;background:hsla(0,0%,100%,.8);padding:4px 12px}@media (min-width:600px){.edit-site-code-editor__toolbar{padding:12px}}@media (min-width:960px){.edit-site-code-editor__toolbar{padding:12px 24px}}.edit-site-code-editor__toolbar h2{line-height:36px;margin:0 auto 0 0;font-size:13px;color:#1e1e1e}.edit-site-code-editor__toolbar .components-button svg{order:1}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{border:1px solid #949494;border-radius:0;display:block;margin:0;width:100%;box-shadow:none;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;line-height:2.4;min-height:200px;transition:border .1s ease-out,box-shadow .1s linear;padding:16px;font-size:16px!important}@media (prefers-reduced-motion:reduce){textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area{padding:24px;font-size:15px!important}}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-webkit-input-placeholder{color:rgba(30,30,30,.62)}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-moz-placeholder{color:rgba(30,30,30,.62);opacity:1}textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-input-placeholder{color:rgba(30,30,30,.62)}.edit-site-global-styles-preview{display:flex;align-items:center;justify-content:center;line-height:1;cursor:pointer}.edit-site-global-styles-preview__iframe{max-width:100%;display:block}.edit-site-typography-panel__preview{display:flex;align-items:center;justify-content:center;min-height:100px;margin-bottom:16px;background:#f0f0f0;border-radius:2px}.edit-site-global-styles-screen-typography{margin:16px}.edit-site-global-styles-screen-typography__indicator{height:24px;width:24px;font-size:14px;display:flex!important;align-items:center;justify-content:center;border-radius:2px}.edit-site-global-styles-screen-colors{margin:16px}.edit-site-global-styles-screen-colors .component-color-indicator{background:linear-gradient(-45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.edit-site-block-types-search,.edit-site-global-styles-header__description{padding:0 16px}.edit-site-global-styles-subtitle{margin-bottom:0!important;text-transform:uppercase;font-weight:500!important;font-size:11px!important}.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle{margin-right:16px;margin-left:16px;width:unset}.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control{min-height:32px}.edit-site-screen-background-color__control,.edit-site-screen-link-color__control,.edit-site-screen-text-color__control{padding:16px}.edit-site-global-styles-variations_item{box-sizing:border-box}.edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview{padding:2px;border-radius:2px;border:1px solid #e0e0e0}.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview{border:1px solid #1e1e1e}.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview,.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview{border:1px solid var(--wp-admin-theme-color)}.edit-site-global-styles-icon-with-current-color{fill:currentColor}.edit-site-global-styles__color-indicator-wrapper{height:24px}.edit-site-header{align-items:center;background-color:#fff;display:flex;height:60px;box-sizing:border-box;width:100%;justify-content:space-between}body.is-fullscreen-mode .edit-site-header{padding-left:60px;transition:padding-left 20ms linear;transition-delay:80ms}@media (prefers-reduced-motion:reduce){body.is-fullscreen-mode .edit-site-header{transition-duration:0s;transition-delay:0s}}.edit-site-header .edit-site-header_end,.edit-site-header .edit-site-header_start{display:flex}.edit-site-header .edit-site-header_center{display:flex;align-items:center;height:100%;flex-grow:1;justify-content:center;min-width:0}.edit-site-header .edit-site-header_end{justify-content:flex-end}body.is-navigation-sidebar-open .edit-site-header{padding-left:0;transition:padding-left 20ms linear;transition-delay:0ms}@media (prefers-reduced-motion:reduce){body.is-navigation-sidebar-open .edit-site-header{transition-duration:0s;transition-delay:0s}}@media (max-width:959px){body.is-navigation-sidebar-open .edit-site-header .edit-site-header-toolbar__inserter-toggle~.components-button,body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .components-button:not(.is-primary){display:none}body.is-navigation-sidebar-open .edit-site-header .edit-site-save-button__button{margin-right:0}}.edit-site-header__toolbar{display:flex;align-items:center;padding-left:8px}@media (min-width:600px){.edit-site-header__toolbar{padding-left:24px}}@media (min-width:1280px){.edit-site-header__toolbar{padding-right:8px}}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle{margin-right:8px;min-width:32px;width:32px;height:32px;padding:0}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(45deg)}.edit-site-header__toolbar-switchers{align-items:center;display:flex}.edit-site-header__toolbar-switchers-separator{margin:0 -6px}.edit-site-header__actions{display:inline-flex;align-items:center;padding-right:4px}.edit-site-header__actions .interface-pinned-items{display:none}@media (min-width:782px){.edit-site-header__actions .interface-pinned-items{display:inline-flex}}.edit-site-header__actions .components-button.components-button,.edit-site-header__actions .editor-post-saved-state{margin-right:4px}@media (min-width:600px){.edit-site-header__actions .components-button.components-button,.edit-site-header__actions .editor-post-saved-state{margin-right:12px}}.edit-site-header__actions .components-button.is-tertiary,.edit-site-header__actions .editor-post-saved-state{padding:0 6px}.edit-site-header__actions .edit-site-more-menu .components-button,.edit-site-header__actions .interface-pinned-items .components-button{margin-right:0}@media (min-width:600px){.edit-site-header__actions{padding-right:16px}}.edit-site-header__actions-more-menu{margin-left:-4px}.edit-site-header__actions-more-menu .components-icon-button{padding:8px 2px;width:auto}@media (min-width:600px){.edit-site-header__actions-more-menu{margin-left:4px}.edit-site-header__actions-more-menu .components-icon-button{padding:8px 4px}}.show-icon-labels .edit-site-header .components-button.has-icon{width:auto}.show-icon-labels .edit-site-header .components-button.has-icon svg{display:none}.show-icon-labels .edit-site-header .components-button.has-icon:after{content:attr(aria-label)}.show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true]{background-color:transparent}.show-icon-labels .edit-site-header .is-tertiary:active{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color);background-color:transparent}.show-icon-labels .edit-site-header .edit-site-save-button__button{padding-left:6px;padding-right:6px;margin-right:4px}.show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle{margin-right:4px}.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info,.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle{height:36px;padding:0 6px}.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info:after,.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle:after{content:none}.edit-site-document-actions{display:flex;flex-direction:column;justify-content:center;padding:0 8px;height:100%;min-width:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper{display:flex;flex-direction:row;justify-content:center;align-items:center;min-width:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown{display:inline-flex;margin-left:4px}.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown .components-button{min-width:0;padding:0}.edit-site-document-actions .edit-site-document-actions__title-wrapper>h1{margin:0;min-width:0}.edit-site-document-actions .edit-site-document-actions__title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.edit-site-document-actions .edit-site-document-actions__secondary-item{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:0;opacity:0;padding:0;transition:all .2s ease;background:#e0e0e0;border-radius:2px}@media (prefers-reduced-motion:reduce){.edit-site-document-actions .edit-site-document-actions__secondary-item{transition-duration:0s;transition-delay:0s}}.edit-site-document-actions.has-secondary-label .edit-site-document-actions__secondary-item{opacity:1;padding:0 4px;max-width:180px;margin-left:6px}.edit-site-document-actions__info-dropdown>.components-popover__content>div{padding:0;min-width:240px}.edit-site-navigation-toggle{align-items:center;background:#1e1e1e;border-radius:0;display:flex;position:absolute;z-index:31;height:60px;width:60px}.edit-site-navigation-toggle__button.components-button{align-items:center;background:#1e1e1e;border-radius:0;color:#fff;height:61px;width:60px;z-index:1;margin-bottom:-1px;min-width:60px}.edit-site-navigation-toggle__button.components-button:active,.edit-site-navigation-toggle__button.components-button:hover{color:#fff}.edit-site-navigation-toggle__button.components-button:focus{box-shadow:none}.edit-site-navigation-toggle__button.components-button:before{transition:box-shadow .1s ease;content:"";display:block;position:absolute;top:9px;right:9px;bottom:9px;left:9px;border-radius:4px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}@media (prefers-reduced-motion:reduce){.edit-site-navigation-toggle__button.components-button:before{transition-duration:0s;transition-delay:0s}}.edit-site-navigation-toggle__button.components-button:hover:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #757575}.edit-site-navigation-toggle__button.components-button.has-icon:hover:before{box-shadow:none}.edit-site-navigation-toggle__button.components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) hsla(0,0%,100%,.1),inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon{width:36px;height:36px;border-radius:2px;-o-object-fit:cover;object-fit:cover;margin-top:-1px}.edit-site-navigation-panel{height:100%;position:relative;width:0;overflow:hidden;background:#1e1e1e;color:#fff;transition:width .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-navigation-panel{transition-duration:0s;transition-delay:0s}}@media (min-width:782px){.interface-interface-skeleton.has-footer .edit-site-navigation-panel{height:calc(100% - 25px)}}.edit-site-navigation-panel__inner{position:relative;width:300px;height:100%;overflow:hidden;visibility:hidden;transition:visibility .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-navigation-panel__inner{transition-duration:0s;transition-delay:0s}}.edit-site-navigation-panel.is-open{width:300px}.edit-site-navigation-panel.is-open .edit-site-navigation-panel__inner{visibility:visible}.edit-site-navigation-panel__site-title-container{height:60px;padding-left:60px;margin:0 16px 0 8px;display:flex;align-items:center}.edit-site-navigation-panel__site-title{font-style:normal;font-weight:600;font-size:14px;line-height:20px;color:#ddd;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.edit-site-navigation-panel__scroll-container{overflow-x:hidden;overflow-y:auto;height:calc(100% - 60px)}.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary{height:36px;margin-top:24px;padding:8px 16px 8px 8px}.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary:focus:not(:disabled){border-bottom-color:transparent}.edit-site-navigation-panel__preview{display:none;border:1px solid #ccc;width:300px;padding:16px;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.05);border-radius:2px;position:absolute;top:73px;left:312px;color:#1e1e1e;z-index:32}@media (min-width:782px){.edit-site-navigation-panel__preview{display:block}}.edit-site-navigation-panel__template-item{display:block}.edit-site-navigation-panel__template-item .components-button{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;height:auto;min-height:36px;text-align:left;padding-left:16px;padding-right:16px;color:inherit}.edit-site-navigation-panel__template-item-title{font-size:14px;line-height:20px}.edit-site-navigation-panel__template-item-title em{margin-right:1ch}.edit-site-navigation-panel__template-part-item .components-navigation__item-title,.edit-site-navigation-panel__template-parts .components-navigation__menu-title-heading{text-transform:capitalize}.components-navigation__item+.edit-site-navigation-panel__template-item{margin-top:16px}.edit-site-navigation-panel__template-item+.edit-site-navigation-panel__template-item{margin-top:8px}.edit-site-navigation-panel__info-wrapper{padding:4px 0}.edit-site-navigation-panel__template-item-description{padding-top:8px;font-size:12px;line-height:16px}.edit-site-navigation-panel__new-template-dropdown{margin:0 0 0 12px}.edit-site-navigation-panel__new-template-dropdown button{margin:0}@media (min-width:600px){.edit-site-navigation-panel__new-template-popover{min-width:300px}}.edit-site-list-header{position:relative;align-items:center;background-color:#fff;display:flex;height:60px;box-sizing:border-box;width:100%;justify-content:flex-end;padding-right:16px}body.is-fullscreen-mode .edit-site-list-header{padding-left:60px;transition:padding-left 20ms linear;transition-delay:80ms}@media (prefers-reduced-motion:reduce){body.is-fullscreen-mode .edit-site-list-header{transition-duration:0s;transition-delay:0s}}.edit-site-list-header .edit-site-list-header__title{position:absolute;left:0;width:100%;text-align:center;font-size:20px;padding:0;margin:0}.edit-site-list-header__right{position:relative}.edit-site .edit-site-list .interface-interface-skeleton__editor{min-width:100%}@media (min-width:782px){.edit-site .edit-site-list .interface-interface-skeleton__editor{min-width:0}}.edit-site .edit-site-list .interface-interface-skeleton__content{background:#fff;align-items:center;padding:16px}@media (min-width:782px){.edit-site .edit-site-list .interface-interface-skeleton__content{padding:72px}}.edit-site-list-table{width:100%;border:1px solid #ddd;border-radius:2px;margin:0;overflow:hidden;border-spacing:0;max-width:960px}.edit-site-list-table tr{display:flex;align-items:center;padding:16px;box-sizing:border-box;border-top:1px solid #f0f0f0;margin:0}.edit-site-list-table tr:first-child{border-top:0}@media (min-width:782px){.edit-site-list-table tr{padding:24px 32px}}.edit-site-list-table tr .edit-site-list-table-column:first-child{width:calc(60% - 18px);padding-right:24px}.edit-site-list-table tr .edit-site-list-table-column:first-child a{display:inline-block;text-decoration:none;font-weight:500;margin-bottom:4px}.edit-site-list-table tr .edit-site-list-table-column:nth-child(2){width:calc(40% - 18px)}.edit-site-list-table tr .edit-site-list-table-column:nth-child(3){min-width:36px;flex-shrink:0}.edit-site-list-table tr.edit-site-list-table-head{font-size:16px;font-weight:600;text-align:left;color:#1e1e1e;border-top:none;border-bottom:1px solid #ddd}.edit-site-list-table tr.edit-site-list-table-head th{font-weight:inherit}@media (min-width:782px){.edit-site-list.is-navigation-open .components-snackbar-list{margin-left:300px}}@media (min-width:782px){.edit-site-list__rename-modal .components-base-control{width:320px}}.edit-site-list__rename-modal .components-modal__header{border-bottom:none}.edit-site-list__rename-modal .components-modal__content:before{margin-bottom:4px}.edit-site-list__rename-modal-actions{margin-top:12px}.edit-site-template__actions button:not(:last-child){margin-right:8px}.edit-site-list-added-by__icon{display:flex;flex-shrink:0;position:relative;align-items:center;justify-content:center;width:32px;height:32px;background:#2f2f2f;border-radius:100%}.edit-site-list-added-by__icon svg{fill:#fff}.edit-site-list-added-by__icon.is-customized:after{position:absolute;content:"";background:var(--wp-admin-theme-color);height:8px;width:8px;outline:2px solid #fff;border-radius:100%;top:-1px;right:-1px}.edit-site-list-added-by__avatar{flex-shrink:0;overflow:hidden;border-radius:100%;background:#2f2f2f;width:32px;height:32px}.edit-site-list-added-by__avatar img{width:32px;height:32px;-o-object-fit:cover;object-fit:cover;opacity:0;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.edit-site-list-added-by__avatar img{transition-duration:0s;transition-delay:0s}}.edit-site-list-added-by__avatar.is-loaded img{opacity:1}.edit-site-new-template-dropdown .components-dropdown-menu__toggle{padding:6px 12px}@media (min-width:600px){.edit-site-new-template-dropdown .edit-site-new-template-dropdown__popover{min-width:300px}}.edit-site-sidebar{width:280px}.edit-site-sidebar>.components-panel{border-left:0;border-right:0;margin-bottom:-1px;margin-top:-1px}.edit-site-sidebar>.components-panel>.components-panel__header{background:#f0f0f0}.edit-site-sidebar .block-editor-block-inspector__card{margin:0}.edit-site-global-styles-sidebar{display:flex;flex-direction:column;min-height:100%}.edit-site-global-styles-sidebar__navigator-provider,.edit-site-global-styles-sidebar__panel{display:flex;flex-direction:column;flex:1}.edit-site-global-styles-sidebar__navigator-screen{flex:1}.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon{margin-left:0}.edit-site-global-styles-sidebar__reset-button.components-button{margin-left:auto}.edit-site-global-styles-sidebar .components-navigation__menu-title-heading{font-size:15.6px;font-weight:500}.edit-site-global-styles-sidebar .components-navigation__item>button span{font-weight:500}.edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings,.edit-site-typography-panel{border:0}.edit-site-global-styles-sidebar .components-tools-panel-item.single-column{grid-column:span 1}.edit-site-global-styles-sidebar__blocks-group{padding-top:24px;border-top:1px solid #e0e0e0}.edit-site-global-styles-sidebar__blocks-group-help{padding:0 16px}.edit-site-global-styles-color-palette-panel,.edit-site-global-styles-gradient-palette-panel{padding:16px}.edit-site-global-styles-sidebar__beta{display:inline-flex;margin-left:8px;padding:0 8px;height:24px;border-radius:2px;background-color:#1e1e1e;color:#fff;align-items:center;font-size:12px;line-height:1}.components-panel__header.edit-site-sidebar__panel-tabs{justify-content:flex-start;padding-left:0;padding-right:16px;border-top:0;margin-top:0}.components-panel__header.edit-site-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-site-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon{display:none;margin:0 0 0 auto;padding:0;min-width:24px;height:24px}@media (min-width:782px){.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-button.edit-site-sidebar__panel-tab{border-radius:0;height:48px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-left:0;font-weight:500}.components-button.edit-site-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-site-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-site-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;right:0;left:0;border-bottom:4px solid transparent}.components-button.edit-site-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-site-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.edit-site-navigation-inspector{padding:16px}.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents{align-items:flex-start;white-space:normal}.edit-site-navigation-inspector .block-editor-list-view-block__title{margin-top:3px}.edit-site-navigation-inspector .block-editor-list-view-block__menu-cell{padding-right:0}.edit-site-navigation-inspector__placeholder{padding:8px;margin:8px;background-color:#f0f0f0;animation:loadingpulse 1s linear infinite;animation-delay:.5s}.edit-site-navigation-inspector__placeholder.is-child{margin-left:24px;width:50%}.edit-site-template-card{display:flex;align-items:flex-start}.edit-site-template-card__content{flex-grow:1;margin-bottom:4px}.edit-site-template-card__title{font-weight:500;line-height:24px}.edit-site-template-card__title.edit-site-template-card__title{margin:0 0 4px}.edit-site-template-card__description{font-size:13px;margin:0 0 16px}.edit-site-template-card__icon{flex:0 0 24px;margin-right:12px;width:24px;height:24px}h3.edit-site-template-card__template-areas-title{font-weight:500;margin:0 0 8px}.edit-site-template-card__template-areas-list,.edit-site-template-card__template-areas-list>li{margin:0}.edit-site-template-card__template-areas-item{width:100%}.edit-site-template-card__template-areas-item.components-button.has-icon{padding:0}html #wpadminbar{display:none}html.wp-toolbar{padding-top:0}.edit-site-editor__toggle-save-panel{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;left:auto;right:0;width:280px;background-color:#fff;border:1px dotted #ddd;height:auto!important;padding:24px;display:flex;justify-content:center}.interface-interface-skeleton__actions:focus-within .edit-site-editor__toggle-save-panel,.interface-interface-skeleton__actions:focus .edit-site-editor__toggle-save-panel{top:auto;bottom:0}.edit-site-visual-editor{position:relative;height:100%;display:block}.edit-site-visual-editor iframe{display:block;width:100%;height:100%;background-color:#fff}.edit-site .components-editor-notices__snackbar{position:fixed;right:0;bottom:40px;padding-left:16px;padding-right:16px;left:0}@media (min-width:783px){.edit-site .components-editor-notices__snackbar{left:160px}}@media (min-width:783px){.auto-fold .edit-site .components-editor-notices__snackbar{left:36px}}@media (min-width:961px){.auto-fold .edit-site .components-editor-notices__snackbar{left:160px}}.folded .edit-site .components-editor-notices__snackbar{left:0}@media (min-width:783px){.folded .edit-site .components-editor-notices__snackbar{left:36px}}body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{left:0!important}.edit-site-template-details .edit-site-template-details__group{margin:0;padding:16px}.edit-site-template-details .edit-site-template-details__group+.edit-site-template-details__group{border-top:1px solid #ccc}.edit-site-template-details .edit-site-template-details__title{margin:0}.edit-site-template-details .edit-site-template-details__description{margin:12px 0 0;color:#757575}.edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas{padding:8px}.edit-site-template-details .edit-site-template-details__template-areas-item{position:relative}.edit-site-template-details .edit-site-template-details__template-areas-item .edit-site-template-details__template-areas-item-more{position:absolute;right:0;top:0;bottom:0;margin:auto 0}.edit-site-template-details .edit-site-template-details__revert{padding:12px 8px}.edit-site-template-details .edit-site-template-details__revert-button{height:auto;padding:4px 8px;text-align:left}.edit-site-template-details .edit-site-template-details__revert-button:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff}.edit-site-template-details .edit-site-template-details__show-all-button.components-button{display:flex;justify-content:center;background:#1e1e1e;color:#fff;width:100%;height:44px;border-radius:0}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:hover{color:#fff}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:active{color:#ccc}.edit-site-template-details .edit-site-template-details__show-all-button.components-button:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff}.edit-site-create-template-part-modal{z-index:1000001}@media (min-width:600px){.edit-site-create-template-part-modal .components-modal__frame{max-width:500px}}.edit-site-create-template-part-modal__modal-actions{padding-top:12px}.edit-site-create-template-part-modal__area-base-control .components-base-control__label{margin:16px 0 8px;cursor:auto}.edit-site-create-template-part-modal__area-radio-group{width:100%;border:1px solid #757575;border-radius:2px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio{display:block;width:100%;height:100%;text-align:left;padding:12px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover{margin:0;background-color:inherit;border-bottom:1px solid #757575;border-radius:0}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:not(:focus),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:not(:focus),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:focus){box-shadow:none}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:focus,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:focus,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:focus{border-bottom:1px solid #fff}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:last-of-type,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:last-of-type,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:last-of-type{border-bottom:none}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover),.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true]{color:#1e1e1e;cursor:auto}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover) .edit-site-create-template-part-modal__option-label div,.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] .edit-site-create-template-part-modal__option-label div{color:#949494}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label{padding-top:4px;white-space:normal}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label div{padding-top:4px;font-size:12px}.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__checkbox{margin-left:auto;min-width:24px}.edit-site-editor__inserter-panel,.edit-site-editor__list-view-panel{height:100%;display:flex;flex-direction:column}.edit-site-editor__list-view-panel{min-width:350px}.edit-site-editor__inserter-panel-header{padding-top:8px;padding-right:8px;display:flex;justify-content:flex-end}.edit-site-editor__inserter-panel-content,.edit-site-editor__list-view-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-site-editor__inserter-panel-content{height:100%}}.edit-site-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-left:16px;padding-right:4px}.edit-site-editor__list-view-panel-content{overflow-y:auto;padding:8px}.edit-site-welcome-guide{width:312px}.edit-site-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-site-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-site-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-site-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 16px;padding:0 32px}.edit-site-welcome-guide__text img{vertical-align:bottom}.edit-site-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-site-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-site-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-site-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-site-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-site-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-site-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 0 0 1rem;text-align:right}.edit-site-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-site-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 0 0 .2rem}body.appearance_page_gutenberg-edit-site,body.site-editor-php,html.wp-toolbar{background:#fff}body.appearance_page_gutenberg-edit-site #wpcontent,body.site-editor-php #wpcontent{padding-left:0}body.appearance_page_gutenberg-edit-site #wpbody-content,body.site-editor-php #wpbody-content{padding-bottom:0}body.appearance_page_gutenberg-edit-site #wpbody-content>div:not(.edit-site):not(#screen-meta),body.appearance_page_gutenberg-edit-site #wpfooter,body.site-editor-php #wpbody-content>div:not(.edit-site):not(#screen-meta),body.site-editor-php #wpfooter{display:none}body.appearance_page_gutenberg-edit-site .a11y-speak-region,body.site-editor-php .a11y-speak-region{left:-1px;top:-1px}body.appearance_page_gutenberg-edit-site ul#adminmenu>li.current>a.current:after,body.appearance_page_gutenberg-edit-site ul#adminmenu a.wp-has-current-submenu:after,body.site-editor-php ul#adminmenu>li.current>a.current:after,body.site-editor-php ul#adminmenu a.wp-has-current-submenu:after{border-right-color:#fff}body.appearance_page_gutenberg-edit-site .media-frame select.attachment-filters:last-of-type,body.site-editor-php .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.components-modal__frame,.edit-site{box-sizing:border-box}.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before,.edit-site *,.edit-site :after,.edit-site :before{box-sizing:inherit}@media (min-width:600px){.edit-site{bottom:0;left:0;min-height:100vh;position:absolute;right:0;top:0}}.edit-site .interface-interface-skeleton{top:0}.edit-site .interface-complementary-area__pin-unpin-item.components-button{display:none}.edit-site .interface-interface-skeleton__content{background-color:#2f2f2f}@keyframes edit-post__fade-in-animation{0%{opacity:0}to{opacity:1}}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-left: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-left: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-right: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-right: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - left: 10px; - bottom: 10px; - right: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-right: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - right: 0; - left: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - right: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - right: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - right: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - right: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-right: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-left: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - right: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - right: auto; - left: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-right: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-right: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-right: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - right: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-right: 24px; - margin-right: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 10px 0.6rem 0; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 58px 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.edit-site-block-editor__editor-styles-wrapper .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - padding: 6px 12px; -} -.edit-site-block-editor__editor-styles-wrapper .components-button.is-tertiary, .edit-site-block-editor__editor-styles-wrapper .components-button.has-icon { - padding: 6px; -} - -.edit-site-visual-editor { - position: relative; - background-color: #2f2f2f; - align-items: center; -} -.edit-site-visual-editor.is-focus-mode { - padding: 48px; -} -.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas { - border-radius: 2px; -} -.edit-site-visual-editor.is-focus-mode .components-resizable-box__container { - overflow: visible; -} -.edit-site-visual-editor .components-resizable-box__container { - margin: 0 auto; - overflow: auto; -} - -.edit-site-visual-editor__back-button { - position: absolute; - top: 8px; - right: 8px; - color: #fff; -} -.edit-site-visual-editor__back-button:active:not([aria-disabled=true]), .edit-site-visual-editor__back-button:focus:not([aria-disabled=true]), .edit-site-visual-editor__back-button:hover { - color: #f0f0f0; -} - -.resizable-editor__drag-handle { - position: absolute; - top: 0; - bottom: 0; - padding: 0; - margin: auto 0; - width: 4px; - height: 100px; - -webkit-appearance: none; - appearance: none; - cursor: ew-resize; - outline: none; - background: #949494; - border-radius: 2px; - border: 0; -} -.resizable-editor__drag-handle.is-left { - right: -16px; -} -.resizable-editor__drag-handle.is-right { - left: -16px; -} -.resizable-editor__drag-handle:hover, .resizable-editor__drag-handle:active { - background: #ccc; -} -.resizable-editor__drag-handle:focus { - box-shadow: 0 0 0 1px #2f2f2f, 0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color); -} - -.edit-site-code-editor { - position: relative; - width: 100%; - background-color: #fff; - flex-grow: 1; -} -.edit-site-code-editor__body { - width: 100%; - padding: 0 12px 12px 12px; - max-width: 1080px; - margin-right: auto; - margin-left: auto; -} -@media (min-width: 960px) { - .edit-site-code-editor__body { - padding: 16px 24px 96px 24px; - padding: 0 24px 24px 24px; - } -} -.edit-site-code-editor__toolbar { - position: sticky; - z-index: 1; - top: 0; - right: 0; - left: 0; - display: flex; - background: rgba(255, 255, 255, 0.8); - padding: 4px 12px; -} -@media (min-width: 600px) { - .edit-site-code-editor__toolbar { - padding: 12px; - } -} -@media (min-width: 960px) { - .edit-site-code-editor__toolbar { - padding: 12px 24px; - } -} -.edit-site-code-editor__toolbar h2 { - line-height: 36px; - margin: 0 0 0 auto; - font-size: 13px; - color: #1e1e1e; -} -.edit-site-code-editor__toolbar .components-button svg { - order: 1; -} - -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - border: 1px solid #949494; - border-radius: 0; - display: block; - margin: 0; - width: 100%; - box-shadow: none; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - line-height: 2.4; - min-height: 200px; - transition: border 0.1s ease-out, box-shadow 0.1s linear; - padding: 16px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (prefers-reduced-motion: reduce) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - padding: 24px; - } -} -@media (min-width: 600px) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - font-size: 15px !important; - } -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-moz-placeholder { - color: rgba(30, 30, 30, 0.62); - opacity: 1; -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.edit-site-global-styles-preview { - display: flex; - align-items: center; - justify-content: center; - line-height: 1; - cursor: pointer; -} - -.edit-site-global-styles-preview__iframe { - max-width: 100%; - display: block; -} - -.edit-site-typography-panel__preview { - display: flex; - align-items: center; - justify-content: center; - min-height: 100px; - margin-bottom: 16px; - background: #f0f0f0; - border-radius: 2px; -} - -.edit-site-global-styles-screen-typography { - margin: 16px; -} - -.edit-site-global-styles-screen-typography__indicator { - height: 24px; - width: 24px; - font-size: 14px; - display: flex !important; - align-items: center; - justify-content: center; - border-radius: 2px; -} - -.edit-site-global-styles-screen-colors { - margin: 16px; -} -.edit-site-global-styles-screen-colors .component-color-indicator { - background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} - -.edit-site-global-styles-header__description, -.edit-site-block-types-search { - padding: 0 16px; -} - -.edit-site-global-styles-subtitle { - margin-bottom: 0 !important; - text-transform: uppercase; - font-weight: 500 !important; - font-size: 11px !important; -} - -.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle { - margin-left: 16px; - margin-right: 16px; - width: unset; -} -.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control { - min-height: 32px; -} - -.edit-site-screen-text-color__control, -.edit-site-screen-link-color__control, -.edit-site-screen-background-color__control { - padding: 16px; -} - -.edit-site-global-styles-variations_item { - box-sizing: border-box; -} -.edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview { - padding: 2px; - border-radius: 2px; - border: #e0e0e0 1px solid; -} -.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview { - border: #1e1e1e 1px solid; -} -.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview { - border: var(--wp-admin-theme-color) 1px solid; -} -.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview { - border: var(--wp-admin-theme-color) 1px solid; -} - -.edit-site-global-styles-icon-with-current-color { - fill: currentColor; -} - -.edit-site-global-styles__color-indicator-wrapper { - height: 24px; -} - -.edit-site-header { - align-items: center; - background-color: #fff; - display: flex; - height: 60px; - box-sizing: border-box; - width: 100%; - justify-content: space-between; -} -body.is-fullscreen-mode .edit-site-header { - padding-right: 60px; - transition: padding-right 20ms linear; - transition-delay: 80ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-fullscreen-mode .edit-site-header { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-header .edit-site-header_start, -.edit-site-header .edit-site-header_end { - display: flex; -} -.edit-site-header .edit-site-header_center { - display: flex; - align-items: center; - height: 100%; - flex-grow: 1; - justify-content: center; - min-width: 0; -} -.edit-site-header .edit-site-header_end { - justify-content: flex-end; -} - -body.is-navigation-sidebar-open .edit-site-header { - padding-right: 0; - transition: padding-right 20ms linear; - transition-delay: 0ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-navigation-sidebar-open .edit-site-header { - transition-duration: 0s; - transition-delay: 0s; - } -} - -@media (max-width: 959px) { - body.is-navigation-sidebar-open .edit-site-header .edit-site-header-toolbar__inserter-toggle ~ .components-button, -body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .components-button:not(.is-primary) { - display: none; - } - body.is-navigation-sidebar-open .edit-site-header .edit-site-save-button__button { - margin-left: 0; - } -} -.edit-site-header__toolbar { - display: flex; - align-items: center; - padding-right: 8px; -} -@media (min-width: 600px) { - .edit-site-header__toolbar { - padding-right: 24px; - } -} -@media (min-width: 1280px) { - .edit-site-header__toolbar { - padding-left: 8px; - } -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle { - margin-left: 8px; - min-width: 32px; - width: 32px; - height: 32px; - padding: 0; -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(-45deg); -} - -.edit-site-header__toolbar-switchers { - align-items: center; - display: flex; -} - -.edit-site-header__toolbar-switchers-separator { - margin: 0 -6px 0; -} - -/** - * Buttons in the Toolbar - */ -.edit-site-header__actions { - display: inline-flex; - align-items: center; - padding-left: 4px; -} -.edit-site-header__actions .interface-pinned-items { - display: none; -} -@media (min-width: 782px) { - .edit-site-header__actions .interface-pinned-items { - display: inline-flex; - } -} -.edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.components-button { - margin-left: 4px; -} -@media (min-width: 600px) { - .edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.components-button { - margin-left: 12px; - } -} -.edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.is-tertiary { - padding: 0 6px; -} -.edit-site-header__actions .edit-site-more-menu .components-button, -.edit-site-header__actions .interface-pinned-items .components-button { - margin-left: 0; -} -@media (min-width: 600px) { - .edit-site-header__actions { - padding-left: 16px; - } -} - -.edit-site-header__actions-more-menu { - margin-right: -4px; -} -.edit-site-header__actions-more-menu .components-icon-button { - padding: 8px 2px; - width: auto; -} -@media (min-width: 600px) { - .edit-site-header__actions-more-menu { - margin-right: 4px; - } - .edit-site-header__actions-more-menu .components-icon-button { - padding: 8px 4px; - } -} - -.show-icon-labels .edit-site-header .components-button.has-icon { - width: auto; -} -.show-icon-labels .edit-site-header .components-button.has-icon svg { - display: none; -} -.show-icon-labels .edit-site-header .components-button.has-icon::after { - content: attr(aria-label); -} -.show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true] { - background-color: transparent; -} -.show-icon-labels .edit-site-header .is-tertiary:active { - box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color); - background-color: transparent; -} -.show-icon-labels .edit-site-header .edit-site-save-button__button { - padding-right: 6px; - padding-left: 6px; - margin-left: 4px; -} -.show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle { - margin-left: 4px; -} -.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle, -.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info { - height: 36px; - padding: 0 6px; -} -.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle::after, -.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info::after { - content: none; -} - -.edit-site-document-actions { - display: flex; - flex-direction: column; - justify-content: center; - padding: 0 8px; - height: 100%; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown { - display: inline-flex; - margin-right: 4px; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown .components-button { - min-width: 0; - padding: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper > h1 { - margin: 0; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -.edit-site-document-actions .edit-site-document-actions__secondary-item { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - max-width: 0; - opacity: 0; - padding: 0; - transition: all ease 0.2s; - background: #e0e0e0; - border-radius: 2px; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-document-actions .edit-site-document-actions__secondary-item { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-document-actions.has-secondary-label .edit-site-document-actions__secondary-item { - opacity: 1; - padding: 0 4px; - max-width: 180px; - margin-right: 6px; -} - -.edit-site-document-actions__info-dropdown > .components-popover__content > div { - padding: 0; - min-width: 240px; -} - -.edit-site-navigation-toggle { - align-items: center; - background: #1e1e1e; - border-radius: 0; - display: flex; - position: absolute; - z-index: 31; - height: 60px; - width: 60px; -} - -.edit-site-navigation-toggle__button.components-button { - align-items: center; - background: #1e1e1e; - border-radius: 0; - color: #fff; - height: 61px; - width: 60px; - z-index: 1; - margin-bottom: -1px; - min-width: 60px; -} -.edit-site-navigation-toggle__button.components-button:hover, .edit-site-navigation-toggle__button.components-button:active { - color: #fff; -} -.edit-site-navigation-toggle__button.components-button:focus { - box-shadow: none; -} -.edit-site-navigation-toggle__button.components-button::before { - transition: box-shadow 0.1s ease; - content: ""; - display: block; - position: absolute; - top: 9px; - left: 9px; - bottom: 9px; - right: 9px; - border-radius: 4px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-toggle__button.components-button::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-navigation-toggle__button.components-button:hover::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575; -} -.edit-site-navigation-toggle__button.components-button.has-icon:hover::before { - box-shadow: none; -} -.edit-site-navigation-toggle__button.components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon { - width: 36px; - height: 36px; - border-radius: 2px; - -o-object-fit: cover; - object-fit: cover; - margin-top: -1px; -} - -.edit-site-navigation-panel { - height: 100%; - position: relative; - width: 0; - overflow: hidden; - background: #1e1e1e; - color: #fff; - transition: width 100ms linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-panel { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 782px) { - .interface-interface-skeleton.has-footer .edit-site-navigation-panel { - height: calc(100% - 25px); - } -} - -.edit-site-navigation-panel__inner { - position: relative; - width: 300px; - height: 100%; - overflow: hidden; - visibility: hidden; - transition: visibility 100ms linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-panel__inner { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.edit-site-navigation-panel.is-open { - width: 300px; -} -.edit-site-navigation-panel.is-open .edit-site-navigation-panel__inner { - visibility: visible; -} - -.edit-site-navigation-panel__site-title-container { - height: 60px; - padding-right: 60px; - margin: 0 8px 0 16px; - display: flex; - align-items: center; -} - -.edit-site-navigation-panel__site-title { - font-style: normal; - font-weight: 600; - font-size: 14px; - /* Matches menu items */ - line-height: 20px; - color: #ddd; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.edit-site-navigation-panel__scroll-container { - overflow-x: hidden; - overflow-y: auto; - height: calc(100% - 60px); -} - -.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary { - height: 36px; - margin-top: 24px; - padding: 8px 8px 8px 16px; -} -.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary:focus:not(:disabled) { - border-bottom-color: transparent; -} - -.edit-site-navigation-panel__preview { - display: none; - border: 1px solid #ccc; - width: 300px; - padding: 16px; - background: #fff; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border-radius: 2px; - position: absolute; - top: 73px; - right: 312px; - color: #1e1e1e; - z-index: 32; -} -@media (min-width: 782px) { - .edit-site-navigation-panel__preview { - display: block; - } -} - -.edit-site-navigation-panel__template-item { - display: block; -} -.edit-site-navigation-panel__template-item .components-button { - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: center; - height: auto; - min-height: 36px; - text-align: right; - padding-right: 16px; - padding-left: 16px; - color: inherit; -} - -.edit-site-navigation-panel__template-item-title { - font-size: 14px; - line-height: 20px; -} -.edit-site-navigation-panel__template-item-title em { - margin-left: 1ch; -} - -.edit-site-navigation-panel__template-parts .components-navigation__menu-title-heading { - text-transform: capitalize; -} - -.edit-site-navigation-panel__template-part-item .components-navigation__item-title { - text-transform: capitalize; -} - -.components-navigation__item + .edit-site-navigation-panel__template-item { - margin-top: 16px; -} - -.edit-site-navigation-panel__template-item + .edit-site-navigation-panel__template-item { - margin-top: 8px; -} - -.edit-site-navigation-panel__info-wrapper { - padding: 4px 0; -} - -.edit-site-navigation-panel__template-item-description { - padding-top: 8px; - font-size: 12px; - line-height: 16px; -} - -.edit-site-navigation-panel__new-template-dropdown { - margin: 0 12px 0 0; -} -.edit-site-navigation-panel__new-template-dropdown button { - margin: 0; -} - -@media (min-width: 600px) { - .edit-site-navigation-panel__new-template-popover { - min-width: 300px; - } -} - -.edit-site-list-header { - position: relative; - align-items: center; - background-color: #fff; - display: flex; - height: 60px; - box-sizing: border-box; - width: 100%; - justify-content: flex-end; - padding-left: 16px; -} -body.is-fullscreen-mode .edit-site-list-header { - padding-right: 60px; - transition: padding-right 20ms linear; - transition-delay: 80ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-fullscreen-mode .edit-site-list-header { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-list-header .edit-site-list-header__title { - position: absolute; - right: 0; - width: 100%; - text-align: center; - font-size: 20px; - padding: 0; - margin: 0; -} - -.edit-site-list-header__right { - position: relative; -} - -.edit-site .edit-site-list .interface-interface-skeleton__editor { - min-width: 100%; -} -@media (min-width: 782px) { - .edit-site .edit-site-list .interface-interface-skeleton__editor { - min-width: 0; - } -} -.edit-site .edit-site-list .interface-interface-skeleton__content { - background: #fff; - align-items: center; - padding: 16px; -} -@media (min-width: 782px) { - .edit-site .edit-site-list .interface-interface-skeleton__content { - padding: 72px; - } -} - -.edit-site-list-table { - width: 100%; - border: 1px solid #ddd; - border-radius: 2px; - margin: 0; - overflow: hidden; - border-spacing: 0; - max-width: 960px; -} -.edit-site-list-table tr { - display: flex; - align-items: center; - padding: 16px; - box-sizing: border-box; - border-top: 1px solid #f0f0f0; - margin: 0; -} -.edit-site-list-table tr:first-child { - border-top: 0; -} -@media (min-width: 782px) { - .edit-site-list-table tr { - padding: 24px 32px; - } -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) { - width: calc(60% - 18px); - padding-left: 24px; -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) a { - display: inline-block; - text-decoration: none; - font-weight: 500; - margin-bottom: 4px; -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(2) { - width: calc(40% - 18px); -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(3) { - min-width: 36px; - flex-shrink: 0; -} -.edit-site-list-table tr.edit-site-list-table-head { - font-size: 16px; - font-weight: 600; - text-align: right; - color: #1e1e1e; - border-top: none; - border-bottom: 1px solid #ddd; -} -.edit-site-list-table tr.edit-site-list-table-head th { - font-weight: inherit; -} - -@media (min-width: 782px) { - .edit-site-list.is-navigation-open .components-snackbar-list { - margin-right: 300px; - } -} - -@media (min-width: 782px) { - .edit-site-list__rename-modal .components-base-control { - width: 320px; - } -} -.edit-site-list__rename-modal .components-modal__header { - border-bottom: none; -} -.edit-site-list__rename-modal .components-modal__content::before { - margin-bottom: 4px; -} - -.edit-site-list__rename-modal-actions { - margin-top: 12px; -} - -.edit-site-template__actions button:not(:last-child) { - margin-left: 8px; -} - -.edit-site-list-added-by__icon { - display: flex; - flex-shrink: 0; - position: relative; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - background: #2f2f2f; - border-radius: 100%; -} -.edit-site-list-added-by__icon svg { - fill: #fff; -} -.edit-site-list-added-by__icon.is-customized::after { - position: absolute; - content: ""; - background: var(--wp-admin-theme-color); - height: 8px; - width: 8px; - outline: 2px solid #fff; - border-radius: 100%; - top: -1px; - left: -1px; -} - -.edit-site-list-added-by__avatar { - flex-shrink: 0; - overflow: hidden; - border-radius: 100%; - background: #2f2f2f; - width: 32px; - height: 32px; -} -.edit-site-list-added-by__avatar img { - width: 32px; - height: 32px; - -o-object-fit: cover; - object-fit: cover; - opacity: 0; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-list-added-by__avatar img { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-list-added-by__avatar.is-loaded img { - opacity: 1; -} - -.edit-site-new-template-dropdown .components-dropdown-menu__toggle { - padding: 6px 12px; -} -@media (min-width: 600px) { - .edit-site-new-template-dropdown .edit-site-new-template-dropdown__popover { - min-width: 300px; - } -} - -.edit-site-sidebar { - width: 280px; -} -.edit-site-sidebar > .components-panel { - border-right: 0; - border-left: 0; - margin-bottom: -1px; - margin-top: -1px; -} -.edit-site-sidebar > .components-panel > .components-panel__header { - background: #f0f0f0; -} -.edit-site-sidebar .block-editor-block-inspector__card { - margin: 0; -} - -.edit-site-global-styles-sidebar { - display: flex; - flex-direction: column; - min-height: 100%; -} -.edit-site-global-styles-sidebar__panel, .edit-site-global-styles-sidebar__navigator-provider { - display: flex; - flex-direction: column; - flex: 1; -} -.edit-site-global-styles-sidebar__navigator-screen { - flex: 1; -} - -.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon { - margin-right: 0; -} - -.edit-site-global-styles-sidebar__reset-button.components-button { - margin-right: auto; -} - -.edit-site-global-styles-sidebar .components-navigation__menu-title-heading { - font-size: 15.6px; - font-weight: 500; -} - -.edit-site-global-styles-sidebar .components-navigation__item > button span { - font-weight: 500; -} - -.edit-site-typography-panel, -.edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings { - border: 0; -} - -.edit-site-global-styles-sidebar .components-tools-panel-item.single-column { - grid-column: span 1; -} - -.edit-site-global-styles-sidebar__blocks-group { - padding-top: 24px; - border-top: 1px solid #e0e0e0; -} - -.edit-site-global-styles-sidebar__blocks-group-help { - padding: 0 16px; -} - -.edit-site-global-styles-color-palette-panel, -.edit-site-global-styles-gradient-palette-panel { - padding: 16px; -} - -.edit-site-global-styles-sidebar__beta { - display: inline-flex; - margin-right: 8px; - padding: 0 8px; - height: 24px; - border-radius: 2px; - background-color: #1e1e1e; - color: #fff; - align-items: center; - font-size: 12px; - line-height: 1; -} - -.components-panel__header.edit-site-sidebar__panel-tabs { - justify-content: flex-start; - padding-right: 0; - padding-left: 16px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-site-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-site-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin: 0 auto 0 0; - padding: 0; - min-width: 24px; - height: 24px; -} -@media (min-width: 782px) { - .components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-button.edit-site-sidebar__panel-tab { - border-radius: 0; - height: 48px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-right: 0; - font-weight: 500; -} -.components-button.edit-site-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-site-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-site-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - left: 0; - right: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-site-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-site-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.edit-site-navigation-inspector { - padding: 16px; -} -.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents { - align-items: flex-start; - white-space: normal; -} -.edit-site-navigation-inspector .block-editor-list-view-block__title { - margin-top: 3px; -} -.edit-site-navigation-inspector .block-editor-list-view-block__menu-cell { - padding-left: 0; -} - -.edit-site-navigation-inspector__placeholder { - padding: 8px; - margin: 8px; - background-color: #f0f0f0; - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.edit-site-navigation-inspector__placeholder.is-child { - margin-right: 24px; - width: 50%; -} - -.edit-site-template-card { - display: flex; - align-items: flex-start; -} - -.edit-site-template-card__content { - flex-grow: 1; - margin-bottom: 4px; -} - -.edit-site-template-card__title { - font-weight: 500; - line-height: 24px; -} -.edit-site-template-card__title.edit-site-template-card__title { - margin: 0 0 4px; -} - -.edit-site-template-card__description { - font-size: 13px; - margin: 0 0 16px; -} - -.edit-site-template-card__icon { - flex: 0 0 24px; - margin-left: 12px; - width: 24px; - height: 24px; -} - -h3.edit-site-template-card__template-areas-title { - font-weight: 500; - margin: 0 0 8px; -} - -.edit-site-template-card__template-areas-list { - margin: 0; -} -.edit-site-template-card__template-areas-list > li { - margin: 0; -} - -.edit-site-template-card__template-areas-item { - width: 100%; -} -.edit-site-template-card__template-areas-item.components-button.has-icon { - padding: 0; -} - -html #wpadminbar { - display: none; -} - -html.wp-toolbar { - padding-top: 0; -} - -.edit-site-editor__toggle-save-panel { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - right: auto; - left: 0; - width: 280px; - background-color: #fff; - border: 1px dotted #ddd; - height: auto !important; - padding: 24px; - display: flex; - justify-content: center; -} -.interface-interface-skeleton__actions:focus .edit-site-editor__toggle-save-panel, .interface-interface-skeleton__actions:focus-within .edit-site-editor__toggle-save-panel { - top: auto; - bottom: 0; -} - -.edit-site-visual-editor { - position: relative; - height: 100%; - display: block; -} -.edit-site-visual-editor iframe { - display: block; - width: 100%; - height: 100%; - background-color: #fff; -} - -.edit-site .components-editor-notices__snackbar { - position: fixed; - left: 0; - bottom: 40px; - padding-right: 16px; - padding-left: 16px; -} - -.edit-site .components-editor-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .edit-site .components-editor-notices__snackbar { - right: 160px; - } -} - -.auto-fold .edit-site .components-editor-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-site .components-editor-notices__snackbar { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-site .components-editor-notices__snackbar { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-site .components-editor-notices__snackbar { - right: 0; -} -@media (min-width: 783px) { - .folded .edit-site .components-editor-notices__snackbar { - right: 36px; - } -} - -body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar { - right: 0 !important; -} - -.edit-site-template-details .edit-site-template-details__group { - margin: 0; - padding: 16px; -} -.edit-site-template-details .edit-site-template-details__group + .edit-site-template-details__group { - border-top: 1px solid #ccc; -} -.edit-site-template-details .edit-site-template-details__title { - margin: 0; -} -.edit-site-template-details .edit-site-template-details__description { - margin: 12px 0 0; - color: #757575; -} -.edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas { - padding: 8px; -} -.edit-site-template-details .edit-site-template-details__template-areas-item { - position: relative; -} -.edit-site-template-details .edit-site-template-details__template-areas-item .edit-site-template-details__template-areas-item-more { - position: absolute; - left: 0; - top: 0; - bottom: 0; - margin: auto 0; -} -.edit-site-template-details .edit-site-template-details__revert { - padding: 12px 8px; -} -.edit-site-template-details .edit-site-template-details__revert-button { - height: auto; - padding: 4px 8px; - text-align: right; -} -.edit-site-template-details .edit-site-template-details__revert-button:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button { - display: flex; - justify-content: center; - background: #1e1e1e; - color: #fff; - width: 100%; - height: 44px; - border-radius: 0; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:hover { - color: #fff; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:active { - color: #ccc; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; -} - -.edit-site-create-template-part-modal { - z-index: 1000001; -} -@media (min-width: 600px) { - .edit-site-create-template-part-modal .components-modal__frame { - max-width: 500px; - } -} - -.edit-site-create-template-part-modal__modal-actions { - padding-top: 12px; -} - -.edit-site-create-template-part-modal__area-base-control .components-base-control__label { - margin: 16px 0 8px; - cursor: auto; -} - -.edit-site-create-template-part-modal__area-radio-group { - width: 100%; - border: 1px solid #757575; - border-radius: 2px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio { - display: block; - width: 100%; - height: 100%; - text-align: right; - padding: 12px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover { - margin: 0; - background-color: inherit; - border-bottom: 1px solid #757575; - border-radius: 0; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:focus), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:not(:focus), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:not(:focus) { - box-shadow: none; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:focus, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:focus, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:focus { - border-bottom: 1px solid #fff; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:last-of-type, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:last-of-type, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:last-of-type { - border-bottom: none; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] { - color: #1e1e1e; - cursor: auto; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover) .edit-site-create-template-part-modal__option-label div, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] .edit-site-create-template-part-modal__option-label div { - color: #949494; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label { - padding-top: 4px; - white-space: normal; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label div { - padding-top: 4px; - font-size: 12px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__checkbox { - margin-right: auto; - min-width: 24px; -} - -.edit-site-editor__inserter-panel, -.edit-site-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; -} - -.edit-site-editor__list-view-panel { - min-width: 350px; -} - -.edit-site-editor__inserter-panel-header { - padding-top: 8px; - padding-left: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-site-editor__inserter-panel-content, -.edit-site-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); -} - -@media (min-width: 782px) { - .edit-site-editor__inserter-panel-content { - height: 100%; - } -} - -.edit-site-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-right: 16px; - padding-left: 4px; -} - -.edit-site-editor__list-view-panel-content { - overflow-y: auto; - padding: 8px; -} - -.edit-site-welcome-guide { - width: 312px; -} -.edit-site-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-site-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-site-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-site-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 16px 0; - padding: 0 32px; -} -.edit-site-welcome-guide__text img { - vertical-align: bottom; -} -.edit-site-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-site-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-site-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-site-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-site-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-site-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 1rem 0 0; - text-align: left; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0.2rem 0 0; -} - -html.wp-toolbar { - background: #fff; -} - -body.appearance_page_gutenberg-edit-site, -body.site-editor-php { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.appearance_page_gutenberg-edit-site #wpcontent, -body.site-editor-php #wpcontent { - padding-right: 0; -} -body.appearance_page_gutenberg-edit-site #wpbody-content, -body.site-editor-php #wpbody-content { - padding-bottom: 0; -} -body.appearance_page_gutenberg-edit-site #wpbody-content > div:not(.edit-site):not(#screen-meta), -body.site-editor-php #wpbody-content > div:not(.edit-site):not(#screen-meta) { - display: none; -} -body.appearance_page_gutenberg-edit-site #wpfooter, -body.site-editor-php #wpfooter { - display: none; -} -body.appearance_page_gutenberg-edit-site .a11y-speak-region, -body.site-editor-php .a11y-speak-region { - right: -1px; - top: -1px; -} -body.appearance_page_gutenberg-edit-site ul#adminmenu a.wp-has-current-submenu::after, -body.appearance_page_gutenberg-edit-site ul#adminmenu > li.current > a.current::after, -body.site-editor-php ul#adminmenu a.wp-has-current-submenu::after, -body.site-editor-php ul#adminmenu > li.current > a.current::after { - border-left-color: #fff; -} -body.appearance_page_gutenberg-edit-site .media-frame select.attachment-filters:last-of-type, -body.site-editor-php .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.edit-site, -.components-modal__frame { - box-sizing: border-box; -} -.edit-site *, -.edit-site *::before, -.edit-site *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .edit-site { - bottom: 0; - right: 0; - min-height: 100vh; - position: absolute; - left: 0; - top: 0; - } -} -.edit-site .interface-interface-skeleton { - top: 0; -} -.edit-site .interface-complementary-area__pin-unpin-item.components-button { - display: none; -} -.edit-site .interface-interface-skeleton__content { - background-color: #2f2f2f; -} - -/** - * Animations - */ -@keyframes edit-post__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-right: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-right: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-left: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-left: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - right: 10px; - bottom: 10px; - left: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-left: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - left: 0; - right: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - left: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - left: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - left: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - left: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-left: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-right: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - left: auto; - right: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-left: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-left: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-left: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - left: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-left: 24px; - margin-left: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 0 0.6rem 10px; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 0 8px 58px; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.edit-site-block-editor__editor-styles-wrapper .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - padding: 6px 12px; -} -.edit-site-block-editor__editor-styles-wrapper .components-button.is-tertiary, .edit-site-block-editor__editor-styles-wrapper .components-button.has-icon { - padding: 6px; -} - -.edit-site-visual-editor { - position: relative; - background-color: #2f2f2f; - align-items: center; -} -.edit-site-visual-editor.is-focus-mode { - padding: 48px; -} -.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas { - border-radius: 2px; -} -.edit-site-visual-editor.is-focus-mode .components-resizable-box__container { - overflow: visible; -} -.edit-site-visual-editor .components-resizable-box__container { - margin: 0 auto; - overflow: auto; -} - -.edit-site-visual-editor__back-button { - position: absolute; - top: 8px; - left: 8px; - color: #fff; -} -.edit-site-visual-editor__back-button:active:not([aria-disabled=true]), .edit-site-visual-editor__back-button:focus:not([aria-disabled=true]), .edit-site-visual-editor__back-button:hover { - color: #f0f0f0; -} - -.resizable-editor__drag-handle { - position: absolute; - top: 0; - bottom: 0; - padding: 0; - margin: auto 0; - width: 4px; - height: 100px; - -webkit-appearance: none; - appearance: none; - cursor: ew-resize; - outline: none; - background: #949494; - border-radius: 2px; - border: 0; -} -.resizable-editor__drag-handle.is-left { - left: -16px; -} -.resizable-editor__drag-handle.is-right { - right: -16px; -} -.resizable-editor__drag-handle:hover, .resizable-editor__drag-handle:active { - background: #ccc; -} -.resizable-editor__drag-handle:focus { - box-shadow: 0 0 0 1px #2f2f2f, 0 0 0 calc(var(--wp-admin-border-width-focus) + 1px) var(--wp-admin-theme-color); -} - -.edit-site-code-editor { - position: relative; - width: 100%; - background-color: #fff; - flex-grow: 1; -} -.edit-site-code-editor__body { - width: 100%; - padding: 0 12px 12px 12px; - max-width: 1080px; - margin-left: auto; - margin-right: auto; -} -@media (min-width: 960px) { - .edit-site-code-editor__body { - padding: 16px 24px 96px 24px; - padding: 0 24px 24px 24px; - } -} -.edit-site-code-editor__toolbar { - position: sticky; - z-index: 1; - top: 0; - left: 0; - right: 0; - display: flex; - background: rgba(255, 255, 255, 0.8); - padding: 4px 12px; -} -@media (min-width: 600px) { - .edit-site-code-editor__toolbar { - padding: 12px; - } -} -@media (min-width: 960px) { - .edit-site-code-editor__toolbar { - padding: 12px 24px; - } -} -.edit-site-code-editor__toolbar h2 { - line-height: 36px; - margin: 0 auto 0 0; - font-size: 13px; - color: #1e1e1e; -} -.edit-site-code-editor__toolbar .components-button svg { - order: 1; -} - -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - border: 1px solid #949494; - border-radius: 0; - display: block; - margin: 0; - width: 100%; - box-shadow: none; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - line-height: 2.4; - min-height: 200px; - transition: border 0.1s ease-out, box-shadow 0.1s linear; - padding: 16px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (prefers-reduced-motion: reduce) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - padding: 24px; - } -} -@media (min-width: 600px) { - textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area { - font-size: 15px !important; - } -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area::-moz-placeholder { - color: rgba(30, 30, 30, 0.62); - opacity: 1; -} -textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.edit-site-global-styles-preview { - display: flex; - align-items: center; - justify-content: center; - line-height: 1; - cursor: pointer; -} - -.edit-site-global-styles-preview__iframe { - max-width: 100%; - display: block; -} - -.edit-site-typography-panel__preview { - display: flex; - align-items: center; - justify-content: center; - min-height: 100px; - margin-bottom: 16px; - background: #f0f0f0; - border-radius: 2px; -} - -.edit-site-global-styles-screen-typography { - margin: 16px; -} - -.edit-site-global-styles-screen-typography__indicator { - height: 24px; - width: 24px; - font-size: 14px; - display: flex !important; - align-items: center; - justify-content: center; - border-radius: 2px; -} - -.edit-site-global-styles-screen-colors { - margin: 16px; -} -.edit-site-global-styles-screen-colors .component-color-indicator { - background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} - -.edit-site-global-styles-header__description, -.edit-site-block-types-search { - padding: 0 16px; -} - -.edit-site-global-styles-subtitle { - margin-bottom: 0 !important; - text-transform: uppercase; - font-weight: 500 !important; - font-size: 11px !important; -} - -.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle { - margin-right: 16px; - margin-left: 16px; - width: unset; -} -.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control { - min-height: 32px; -} - -.edit-site-screen-text-color__control, -.edit-site-screen-link-color__control, -.edit-site-screen-background-color__control { - padding: 16px; -} - -.edit-site-global-styles-variations_item { - box-sizing: border-box; -} -.edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview { - padding: 2px; - border-radius: 2px; - border: #e0e0e0 1px solid; -} -.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview { - border: #1e1e1e 1px solid; -} -.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview { - border: var(--wp-admin-theme-color) 1px solid; -} -.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview { - border: var(--wp-admin-theme-color) 1px solid; -} - -.edit-site-global-styles-icon-with-current-color { - fill: currentColor; -} - -.edit-site-global-styles__color-indicator-wrapper { - height: 24px; -} - -.edit-site-header { - align-items: center; - background-color: #fff; - display: flex; - height: 60px; - box-sizing: border-box; - width: 100%; - justify-content: space-between; -} -body.is-fullscreen-mode .edit-site-header { - padding-left: 60px; - transition: padding-left 20ms linear; - transition-delay: 80ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-fullscreen-mode .edit-site-header { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-header .edit-site-header_start, -.edit-site-header .edit-site-header_end { - display: flex; -} -.edit-site-header .edit-site-header_center { - display: flex; - align-items: center; - height: 100%; - flex-grow: 1; - justify-content: center; - min-width: 0; -} -.edit-site-header .edit-site-header_end { - justify-content: flex-end; -} - -body.is-navigation-sidebar-open .edit-site-header { - padding-left: 0; - transition: padding-left 20ms linear; - transition-delay: 0ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-navigation-sidebar-open .edit-site-header { - transition-duration: 0s; - transition-delay: 0s; - } -} - -@media (max-width: 959px) { - body.is-navigation-sidebar-open .edit-site-header .edit-site-header-toolbar__inserter-toggle ~ .components-button, -body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .components-button:not(.is-primary) { - display: none; - } - body.is-navigation-sidebar-open .edit-site-header .edit-site-save-button__button { - margin-right: 0; - } -} -.edit-site-header__toolbar { - display: flex; - align-items: center; - padding-left: 8px; -} -@media (min-width: 600px) { - .edit-site-header__toolbar { - padding-left: 24px; - } -} -@media (min-width: 1280px) { - .edit-site-header__toolbar { - padding-right: 8px; - } -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle { - margin-right: 8px; - min-width: 32px; - width: 32px; - height: 32px; - padding: 0; -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-header__toolbar .edit-site-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(45deg); -} - -.edit-site-header__toolbar-switchers { - align-items: center; - display: flex; -} - -.edit-site-header__toolbar-switchers-separator { - margin: 0 -6px 0; -} - -/** - * Buttons in the Toolbar - */ -.edit-site-header__actions { - display: inline-flex; - align-items: center; - padding-right: 4px; -} -.edit-site-header__actions .interface-pinned-items { - display: none; -} -@media (min-width: 782px) { - .edit-site-header__actions .interface-pinned-items { - display: inline-flex; - } -} -.edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.components-button { - margin-right: 4px; -} -@media (min-width: 600px) { - .edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.components-button { - margin-right: 12px; - } -} -.edit-site-header__actions .editor-post-saved-state, -.edit-site-header__actions .components-button.is-tertiary { - padding: 0 6px; -} -.edit-site-header__actions .edit-site-more-menu .components-button, -.edit-site-header__actions .interface-pinned-items .components-button { - margin-right: 0; -} -@media (min-width: 600px) { - .edit-site-header__actions { - padding-right: 16px; - } -} - -.edit-site-header__actions-more-menu { - margin-left: -4px; -} -.edit-site-header__actions-more-menu .components-icon-button { - padding: 8px 2px; - width: auto; -} -@media (min-width: 600px) { - .edit-site-header__actions-more-menu { - margin-left: 4px; - } - .edit-site-header__actions-more-menu .components-icon-button { - padding: 8px 4px; - } -} - -.show-icon-labels .edit-site-header .components-button.has-icon { - width: auto; -} -.show-icon-labels .edit-site-header .components-button.has-icon svg { - display: none; -} -.show-icon-labels .edit-site-header .components-button.has-icon::after { - content: attr(aria-label); -} -.show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true] { - background-color: transparent; -} -.show-icon-labels .edit-site-header .is-tertiary:active { - box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color); - background-color: transparent; -} -.show-icon-labels .edit-site-header .edit-site-save-button__button { - padding-left: 6px; - padding-right: 6px; - margin-right: 4px; -} -.show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle { - margin-right: 4px; -} -.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle, -.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info { - height: 36px; - padding: 0 6px; -} -.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle::after, -.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info::after { - content: none; -} - -.edit-site-document-actions { - display: flex; - flex-direction: column; - justify-content: center; - padding: 0 8px; - height: 100%; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown { - display: inline-flex; - margin-left: 4px; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper .components-dropdown .components-button { - min-width: 0; - padding: 0; -} -.edit-site-document-actions .edit-site-document-actions__title-wrapper > h1 { - margin: 0; - min-width: 0; -} -.edit-site-document-actions .edit-site-document-actions__title { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -.edit-site-document-actions .edit-site-document-actions__secondary-item { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - max-width: 0; - opacity: 0; - padding: 0; - transition: all ease 0.2s; - background: #e0e0e0; - border-radius: 2px; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-document-actions .edit-site-document-actions__secondary-item { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-document-actions.has-secondary-label .edit-site-document-actions__secondary-item { - opacity: 1; - padding: 0 4px; - max-width: 180px; - margin-left: 6px; -} - -.edit-site-document-actions__info-dropdown > .components-popover__content > div { - padding: 0; - min-width: 240px; -} - -.edit-site-navigation-toggle { - align-items: center; - background: #1e1e1e; - border-radius: 0; - display: flex; - position: absolute; - z-index: 31; - height: 60px; - width: 60px; -} - -.edit-site-navigation-toggle__button.components-button { - align-items: center; - background: #1e1e1e; - border-radius: 0; - color: #fff; - height: 61px; - width: 60px; - z-index: 1; - margin-bottom: -1px; - min-width: 60px; -} -.edit-site-navigation-toggle__button.components-button:hover, .edit-site-navigation-toggle__button.components-button:active { - color: #fff; -} -.edit-site-navigation-toggle__button.components-button:focus { - box-shadow: none; -} -.edit-site-navigation-toggle__button.components-button::before { - transition: box-shadow 0.1s ease; - content: ""; - display: block; - position: absolute; - top: 9px; - right: 9px; - bottom: 9px; - left: 9px; - border-radius: 4px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-toggle__button.components-button::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-navigation-toggle__button.components-button:hover::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575; -} -.edit-site-navigation-toggle__button.components-button.has-icon:hover::before { - box-shadow: none; -} -.edit-site-navigation-toggle__button.components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon { - width: 36px; - height: 36px; - border-radius: 2px; - -o-object-fit: cover; - object-fit: cover; - margin-top: -1px; -} - -.edit-site-navigation-panel { - height: 100%; - position: relative; - width: 0; - overflow: hidden; - background: #1e1e1e; - color: #fff; - transition: width 100ms linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-panel { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 782px) { - .interface-interface-skeleton.has-footer .edit-site-navigation-panel { - height: calc(100% - 25px); - } -} - -.edit-site-navigation-panel__inner { - position: relative; - width: 300px; - height: 100%; - overflow: hidden; - visibility: hidden; - transition: visibility 100ms linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-navigation-panel__inner { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.edit-site-navigation-panel.is-open { - width: 300px; -} -.edit-site-navigation-panel.is-open .edit-site-navigation-panel__inner { - visibility: visible; -} - -.edit-site-navigation-panel__site-title-container { - height: 60px; - padding-left: 60px; - margin: 0 16px 0 8px; - display: flex; - align-items: center; -} - -.edit-site-navigation-panel__site-title { - font-style: normal; - font-weight: 600; - font-size: 14px; - /* Matches menu items */ - line-height: 20px; - color: #ddd; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.edit-site-navigation-panel__scroll-container { - overflow-x: hidden; - overflow-y: auto; - height: calc(100% - 60px); -} - -.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary { - height: 36px; - margin-top: 24px; - padding: 8px 16px 8px 8px; -} -.edit-site-navigation-panel__back-to-dashboard.components-button.is-tertiary:focus:not(:disabled) { - border-bottom-color: transparent; -} - -.edit-site-navigation-panel__preview { - display: none; - border: 1px solid #ccc; - width: 300px; - padding: 16px; - background: #fff; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border-radius: 2px; - position: absolute; - top: 73px; - left: 312px; - color: #1e1e1e; - z-index: 32; -} -@media (min-width: 782px) { - .edit-site-navigation-panel__preview { - display: block; - } -} - -.edit-site-navigation-panel__template-item { - display: block; -} -.edit-site-navigation-panel__template-item .components-button { - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: center; - height: auto; - min-height: 36px; - text-align: left; - padding-left: 16px; - padding-right: 16px; - color: inherit; -} - -.edit-site-navigation-panel__template-item-title { - font-size: 14px; - line-height: 20px; -} -.edit-site-navigation-panel__template-item-title em { - margin-right: 1ch; -} - -.edit-site-navigation-panel__template-parts .components-navigation__menu-title-heading { - text-transform: capitalize; -} - -.edit-site-navigation-panel__template-part-item .components-navigation__item-title { - text-transform: capitalize; -} - -.components-navigation__item + .edit-site-navigation-panel__template-item { - margin-top: 16px; -} - -.edit-site-navigation-panel__template-item + .edit-site-navigation-panel__template-item { - margin-top: 8px; -} - -.edit-site-navigation-panel__info-wrapper { - padding: 4px 0; -} - -.edit-site-navigation-panel__template-item-description { - padding-top: 8px; - font-size: 12px; - line-height: 16px; -} - -.edit-site-navigation-panel__new-template-dropdown { - margin: 0 0 0 12px; -} -.edit-site-navigation-panel__new-template-dropdown button { - margin: 0; -} - -@media (min-width: 600px) { - .edit-site-navigation-panel__new-template-popover { - min-width: 300px; - } -} - -.edit-site-list-header { - position: relative; - align-items: center; - background-color: #fff; - display: flex; - height: 60px; - box-sizing: border-box; - width: 100%; - justify-content: flex-end; - padding-right: 16px; -} -body.is-fullscreen-mode .edit-site-list-header { - padding-left: 60px; - transition: padding-left 20ms linear; - transition-delay: 80ms; -} -@media (prefers-reduced-motion: reduce) { - body.is-fullscreen-mode .edit-site-list-header { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-list-header .edit-site-list-header__title { - position: absolute; - left: 0; - width: 100%; - text-align: center; - font-size: 20px; - padding: 0; - margin: 0; -} - -.edit-site-list-header__right { - position: relative; -} - -.edit-site .edit-site-list .interface-interface-skeleton__editor { - min-width: 100%; -} -@media (min-width: 782px) { - .edit-site .edit-site-list .interface-interface-skeleton__editor { - min-width: 0; - } -} -.edit-site .edit-site-list .interface-interface-skeleton__content { - background: #fff; - align-items: center; - padding: 16px; -} -@media (min-width: 782px) { - .edit-site .edit-site-list .interface-interface-skeleton__content { - padding: 72px; - } -} - -.edit-site-list-table { - width: 100%; - border: 1px solid #ddd; - border-radius: 2px; - margin: 0; - overflow: hidden; - border-spacing: 0; - max-width: 960px; -} -.edit-site-list-table tr { - display: flex; - align-items: center; - padding: 16px; - box-sizing: border-box; - border-top: 1px solid #f0f0f0; - margin: 0; -} -.edit-site-list-table tr:first-child { - border-top: 0; -} -@media (min-width: 782px) { - .edit-site-list-table tr { - padding: 24px 32px; - } -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) { - width: calc(60% - 18px); - padding-right: 24px; -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(1) a { - display: inline-block; - text-decoration: none; - font-weight: 500; - margin-bottom: 4px; -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(2) { - width: calc(40% - 18px); -} -.edit-site-list-table tr .edit-site-list-table-column:nth-child(3) { - min-width: 36px; - flex-shrink: 0; -} -.edit-site-list-table tr.edit-site-list-table-head { - font-size: 16px; - font-weight: 600; - text-align: left; - color: #1e1e1e; - border-top: none; - border-bottom: 1px solid #ddd; -} -.edit-site-list-table tr.edit-site-list-table-head th { - font-weight: inherit; -} - -@media (min-width: 782px) { - .edit-site-list.is-navigation-open .components-snackbar-list { - margin-left: 300px; - } -} - -@media (min-width: 782px) { - .edit-site-list__rename-modal .components-base-control { - width: 320px; - } -} -.edit-site-list__rename-modal .components-modal__header { - border-bottom: none; -} -.edit-site-list__rename-modal .components-modal__content::before { - margin-bottom: 4px; -} - -.edit-site-list__rename-modal-actions { - margin-top: 12px; -} - -.edit-site-template__actions button:not(:last-child) { - margin-right: 8px; -} - -.edit-site-list-added-by__icon { - display: flex; - flex-shrink: 0; - position: relative; - align-items: center; - justify-content: center; - width: 32px; - height: 32px; - background: #2f2f2f; - border-radius: 100%; -} -.edit-site-list-added-by__icon svg { - fill: #fff; -} -.edit-site-list-added-by__icon.is-customized::after { - position: absolute; - content: ""; - background: var(--wp-admin-theme-color); - height: 8px; - width: 8px; - outline: 2px solid #fff; - border-radius: 100%; - top: -1px; - right: -1px; -} - -.edit-site-list-added-by__avatar { - flex-shrink: 0; - overflow: hidden; - border-radius: 100%; - background: #2f2f2f; - width: 32px; - height: 32px; -} -.edit-site-list-added-by__avatar img { - width: 32px; - height: 32px; - -o-object-fit: cover; - object-fit: cover; - opacity: 0; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .edit-site-list-added-by__avatar img { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-site-list-added-by__avatar.is-loaded img { - opacity: 1; -} - -.edit-site-new-template-dropdown .components-dropdown-menu__toggle { - padding: 6px 12px; -} -@media (min-width: 600px) { - .edit-site-new-template-dropdown .edit-site-new-template-dropdown__popover { - min-width: 300px; - } -} - -.edit-site-sidebar { - width: 280px; -} -.edit-site-sidebar > .components-panel { - border-left: 0; - border-right: 0; - margin-bottom: -1px; - margin-top: -1px; -} -.edit-site-sidebar > .components-panel > .components-panel__header { - background: #f0f0f0; -} -.edit-site-sidebar .block-editor-block-inspector__card { - margin: 0; -} - -.edit-site-global-styles-sidebar { - display: flex; - flex-direction: column; - min-height: 100%; -} -.edit-site-global-styles-sidebar__panel, .edit-site-global-styles-sidebar__navigator-provider { - display: flex; - flex-direction: column; - flex: 1; -} -.edit-site-global-styles-sidebar__navigator-screen { - flex: 1; -} - -.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon { - margin-left: 0; -} - -.edit-site-global-styles-sidebar__reset-button.components-button { - margin-left: auto; -} - -.edit-site-global-styles-sidebar .components-navigation__menu-title-heading { - font-size: 15.6px; - font-weight: 500; -} - -.edit-site-global-styles-sidebar .components-navigation__item > button span { - font-weight: 500; -} - -.edit-site-typography-panel, -.edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings { - border: 0; -} - -.edit-site-global-styles-sidebar .components-tools-panel-item.single-column { - grid-column: span 1; -} - -.edit-site-global-styles-sidebar__blocks-group { - padding-top: 24px; - border-top: 1px solid #e0e0e0; -} - -.edit-site-global-styles-sidebar__blocks-group-help { - padding: 0 16px; -} - -.edit-site-global-styles-color-palette-panel, -.edit-site-global-styles-gradient-palette-panel { - padding: 16px; -} - -.edit-site-global-styles-sidebar__beta { - display: inline-flex; - margin-left: 8px; - padding: 0 8px; - height: 24px; - border-radius: 2px; - background-color: #1e1e1e; - color: #fff; - align-items: center; - font-size: 12px; - line-height: 1; -} - -.components-panel__header.edit-site-sidebar__panel-tabs { - justify-content: flex-start; - padding-left: 0; - padding-right: 16px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-site-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-site-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin: 0 0 0 auto; - padding: 0; - min-width: 24px; - height: 24px; -} -@media (min-width: 782px) { - .components-panel__header.edit-site-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-button.edit-site-sidebar__panel-tab { - border-radius: 0; - height: 48px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-left: 0; - font-weight: 500; -} -.components-button.edit-site-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-site-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-site-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - right: 0; - left: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-site-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-site-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0.5; - } - 100% { - opacity: 1; - } -} -.edit-site-navigation-inspector { - padding: 16px; -} -.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents { - align-items: flex-start; - white-space: normal; -} -.edit-site-navigation-inspector .block-editor-list-view-block__title { - margin-top: 3px; -} -.edit-site-navigation-inspector .block-editor-list-view-block__menu-cell { - padding-right: 0; -} - -.edit-site-navigation-inspector__placeholder { - padding: 8px; - margin: 8px; - background-color: #f0f0f0; - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.edit-site-navigation-inspector__placeholder.is-child { - margin-left: 24px; - width: 50%; -} - -.edit-site-template-card { - display: flex; - align-items: flex-start; -} - -.edit-site-template-card__content { - flex-grow: 1; - margin-bottom: 4px; -} - -.edit-site-template-card__title { - font-weight: 500; - line-height: 24px; -} -.edit-site-template-card__title.edit-site-template-card__title { - margin: 0 0 4px; -} - -.edit-site-template-card__description { - font-size: 13px; - margin: 0 0 16px; -} - -.edit-site-template-card__icon { - flex: 0 0 24px; - margin-right: 12px; - width: 24px; - height: 24px; -} - -h3.edit-site-template-card__template-areas-title { - font-weight: 500; - margin: 0 0 8px; -} - -.edit-site-template-card__template-areas-list { - margin: 0; -} -.edit-site-template-card__template-areas-list > li { - margin: 0; -} - -.edit-site-template-card__template-areas-item { - width: 100%; -} -.edit-site-template-card__template-areas-item.components-button.has-icon { - padding: 0; -} - -html #wpadminbar { - display: none; -} - -html.wp-toolbar { - padding-top: 0; -} - -.edit-site-editor__toggle-save-panel { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - left: auto; - right: 0; - width: 280px; - background-color: #fff; - border: 1px dotted #ddd; - height: auto !important; - padding: 24px; - display: flex; - justify-content: center; -} -.interface-interface-skeleton__actions:focus .edit-site-editor__toggle-save-panel, .interface-interface-skeleton__actions:focus-within .edit-site-editor__toggle-save-panel { - top: auto; - bottom: 0; -} - -.edit-site-visual-editor { - position: relative; - height: 100%; - display: block; -} -.edit-site-visual-editor iframe { - display: block; - width: 100%; - height: 100%; - background-color: #fff; -} - -.edit-site .components-editor-notices__snackbar { - position: fixed; - right: 0; - bottom: 40px; - padding-left: 16px; - padding-right: 16px; -} - -.edit-site .components-editor-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .edit-site .components-editor-notices__snackbar { - left: 160px; - } -} - -.auto-fold .edit-site .components-editor-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-site .components-editor-notices__snackbar { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-site .components-editor-notices__snackbar { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-site .components-editor-notices__snackbar { - left: 0; -} -@media (min-width: 783px) { - .folded .edit-site .components-editor-notices__snackbar { - left: 36px; - } -} - -body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar { - left: 0 !important; -} - -.edit-site-template-details .edit-site-template-details__group { - margin: 0; - padding: 16px; -} -.edit-site-template-details .edit-site-template-details__group + .edit-site-template-details__group { - border-top: 1px solid #ccc; -} -.edit-site-template-details .edit-site-template-details__title { - margin: 0; -} -.edit-site-template-details .edit-site-template-details__description { - margin: 12px 0 0; - color: #757575; -} -.edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas { - padding: 8px; -} -.edit-site-template-details .edit-site-template-details__template-areas-item { - position: relative; -} -.edit-site-template-details .edit-site-template-details__template-areas-item .edit-site-template-details__template-areas-item-more { - position: absolute; - right: 0; - top: 0; - bottom: 0; - margin: auto 0; -} -.edit-site-template-details .edit-site-template-details__revert { - padding: 12px 8px; -} -.edit-site-template-details .edit-site-template-details__revert-button { - height: auto; - padding: 4px 8px; - text-align: left; -} -.edit-site-template-details .edit-site-template-details__revert-button:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button { - display: flex; - justify-content: center; - background: #1e1e1e; - color: #fff; - width: 100%; - height: 44px; - border-radius: 0; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:hover { - color: #fff; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:active { - color: #ccc; -} -.edit-site-template-details .edit-site-template-details__show-all-button.components-button:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; -} - -.edit-site-create-template-part-modal { - z-index: 1000001; -} -@media (min-width: 600px) { - .edit-site-create-template-part-modal .components-modal__frame { - max-width: 500px; - } -} - -.edit-site-create-template-part-modal__modal-actions { - padding-top: 12px; -} - -.edit-site-create-template-part-modal__area-base-control .components-base-control__label { - margin: 16px 0 8px; - cursor: auto; -} - -.edit-site-create-template-part-modal__area-radio-group { - width: 100%; - border: 1px solid #757575; - border-radius: 2px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio { - display: block; - width: 100%; - height: 100%; - text-align: left; - padding: 12px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover { - margin: 0; - background-color: inherit; - border-bottom: 1px solid #757575; - border-radius: 0; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:focus), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:not(:focus), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:not(:focus) { - box-shadow: none; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:focus, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:focus, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:focus { - border-bottom: 1px solid #fff; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:last-of-type, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-secondary:hover:last-of-type, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio.is-primary:hover:last-of-type { - border-bottom: none; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover), .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] { - color: #1e1e1e; - cursor: auto; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio:not(:hover) .edit-site-create-template-part-modal__option-label div, .edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio[aria-checked=true] .edit-site-create-template-part-modal__option-label div { - color: #949494; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label { - padding-top: 4px; - white-space: normal; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__option-label div { - padding-top: 4px; - font-size: 12px; -} -.edit-site-create-template-part-modal__area-radio-group .components-button.edit-site-create-template-part-modal__area-radio .edit-site-create-template-part-modal__checkbox { - margin-left: auto; - min-width: 24px; -} - -.edit-site-editor__inserter-panel, -.edit-site-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; -} - -.edit-site-editor__list-view-panel { - min-width: 350px; -} - -.edit-site-editor__inserter-panel-header { - padding-top: 8px; - padding-right: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-site-editor__inserter-panel-content, -.edit-site-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); -} - -@media (min-width: 782px) { - .edit-site-editor__inserter-panel-content { - height: 100%; - } -} - -.edit-site-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-left: 16px; - padding-right: 4px; -} - -.edit-site-editor__list-view-panel-content { - overflow-y: auto; - padding: 8px; -} - -.edit-site-welcome-guide { - width: 312px; -} -.edit-site-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-site-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-site-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-site-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 16px 0; - padding: 0 32px; -} -.edit-site-welcome-guide__text img { - vertical-align: bottom; -} -.edit-site-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-site-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-site-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-site-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-site-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-site-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 0 0 1rem; - text-align: right; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0 0 0.2rem; -} - -html.wp-toolbar { - background: #fff; -} - -body.appearance_page_gutenberg-edit-site, -body.site-editor-php { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.appearance_page_gutenberg-edit-site #wpcontent, -body.site-editor-php #wpcontent { - padding-left: 0; -} -body.appearance_page_gutenberg-edit-site #wpbody-content, -body.site-editor-php #wpbody-content { - padding-bottom: 0; -} -body.appearance_page_gutenberg-edit-site #wpbody-content > div:not(.edit-site):not(#screen-meta), -body.site-editor-php #wpbody-content > div:not(.edit-site):not(#screen-meta) { - display: none; -} -body.appearance_page_gutenberg-edit-site #wpfooter, -body.site-editor-php #wpfooter { - display: none; -} -body.appearance_page_gutenberg-edit-site .a11y-speak-region, -body.site-editor-php .a11y-speak-region { - left: -1px; - top: -1px; -} -body.appearance_page_gutenberg-edit-site ul#adminmenu a.wp-has-current-submenu::after, -body.appearance_page_gutenberg-edit-site ul#adminmenu > li.current > a.current::after, -body.site-editor-php ul#adminmenu a.wp-has-current-submenu::after, -body.site-editor-php ul#adminmenu > li.current > a.current::after { - border-right-color: #fff; -} -body.appearance_page_gutenberg-edit-site .media-frame select.attachment-filters:last-of-type, -body.site-editor-php .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.edit-site, -.components-modal__frame { - box-sizing: border-box; -} -.edit-site *, -.edit-site *::before, -.edit-site *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .edit-site { - bottom: 0; - left: 0; - min-height: 100vh; - position: absolute; - right: 0; - top: 0; - } -} -.edit-site .interface-interface-skeleton { - top: 0; -} -.edit-site .interface-complementary-area__pin-unpin-item.components-button { - display: none; -} -.edit-site .interface-interface-skeleton__content { - background-color: #2f2f2f; -} - -/** - * Animations - */ -@keyframes edit-post__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.nux-dot-tip:after,.nux-dot-tip:before{border-radius:100%;content:" ";pointer-events:none;position:absolute}.nux-dot-tip:before{animation:nux-pulse 1.6s cubic-bezier(.17,.67,.92,.62) infinite;background:rgba(0,115,156,.9);opacity:.9;height:24px;right:-12px;top:-12px;transform:scale(.3333333333);width:24px}.nux-dot-tip:after{background:#00739c;height:8px;right:-4px;top:-4px;width:8px}@keyframes nux-pulse{to{background:rgba(0,115,156,0);transform:scale(1)}}.nux-dot-tip .components-popover__content{width:350px}.nux-dot-tip .components-popover__content>div{padding:20px 18px}@media (min-width:600px){.nux-dot-tip .components-popover__content{width:450px}}.nux-dot-tip .components-popover__content .nux-dot-tip__disable{position:absolute;left:0;top:0}.nux-dot-tip[data-y-axis=top]{margin-top:-4px}.nux-dot-tip[data-y-axis=bottom]{margin-top:4px}.nux-dot-tip[data-y-axis=middle][data-y-axis=left]{margin-right:-4px}.nux-dot-tip[data-y-axis=middle][data-y-axis=right]{margin-right:4px}.nux-dot-tip[data-y-axis=top] .components-popover__content{margin-bottom:20px}.nux-dot-tip[data-y-axis=bottom] .components-popover__content{margin-top:20px}.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content{margin-left:20px}.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content{margin-right:20px}.nux-dot-tip[data-y-axis=center],.nux-dot-tip[data-y-axis=left],.nux-dot-tip[data-y-axis=right]{z-index:1000001}@media (max-width:600px){.nux-dot-tip[data-y-axis=center] .components-popover__content,.nux-dot-tip[data-y-axis=left] .components-popover__content,.nux-dot-tip[data-y-axis=right] .components-popover__content{align-self:end;right:5px;margin:20px 0 0;max-width:none!important;position:fixed;left:5px;width:auto}}.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content{margin-left:0}.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content{margin-right:0}.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content{margin-left:-12px}.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content{margin-right:-12px}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.nux-dot-tip:after,.nux-dot-tip:before{border-radius:100%;content:" ";pointer-events:none;position:absolute}.nux-dot-tip:before{animation:nux-pulse 1.6s cubic-bezier(.17,.67,.92,.62) infinite;background:rgba(0,115,156,.9);opacity:.9;height:24px;left:-12px;top:-12px;transform:scale(.3333333333);width:24px}.nux-dot-tip:after{background:#00739c;height:8px;left:-4px;top:-4px;width:8px}@keyframes nux-pulse{to{background:rgba(0,115,156,0);transform:scale(1)}}.nux-dot-tip .components-popover__content{width:350px}.nux-dot-tip .components-popover__content>div{padding:20px 18px}@media (min-width:600px){.nux-dot-tip .components-popover__content{width:450px}}.nux-dot-tip .components-popover__content .nux-dot-tip__disable{position:absolute;right:0;top:0}.nux-dot-tip[data-y-axis=top]{margin-top:-4px}.nux-dot-tip[data-y-axis=bottom]{margin-top:4px}.nux-dot-tip[data-y-axis=middle][data-y-axis=left]{margin-left:-4px}.nux-dot-tip[data-y-axis=middle][data-y-axis=right]{margin-left:4px}.nux-dot-tip[data-y-axis=top] .components-popover__content{margin-bottom:20px}.nux-dot-tip[data-y-axis=bottom] .components-popover__content{margin-top:20px}.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content{margin-right:20px}.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content{margin-left:20px}.nux-dot-tip[data-y-axis=center],.nux-dot-tip[data-y-axis=left],.nux-dot-tip[data-y-axis=right]{z-index:1000001}@media (max-width:600px){.nux-dot-tip[data-y-axis=center] .components-popover__content,.nux-dot-tip[data-y-axis=left] .components-popover__content,.nux-dot-tip[data-y-axis=right] .components-popover__content{align-self:end;left:5px;margin:20px 0 0;max-width:none!important;position:fixed;right:5px;width:auto}}.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content{ - /*!rtl:ignore*/margin-left:0}.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content{ - /*!rtl:ignore*/margin-right:0}.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content{ - /*!rtl:ignore*/margin-left:-12px}.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content{ - /*!rtl:ignore*/margin-right:-12px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.nux-dot-tip::before, .nux-dot-tip::after { - border-radius: 100%; - content: " "; - pointer-events: none; - position: absolute; -} -.nux-dot-tip::before { - animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62); - background: rgba(0, 115, 156, 0.9); - opacity: 0.9; - height: 24px; - right: -12px; - top: -12px; - transform: scale(0.3333333333); - width: 24px; -} -.nux-dot-tip::after { - background: #00739c; - height: 8px; - right: -4px; - top: -4px; - width: 8px; -} -@keyframes nux-pulse { - 100% { - background: rgba(0, 115, 156, 0); - transform: scale(1); - } -} -.nux-dot-tip .components-popover__content { - width: 350px; -} -.nux-dot-tip .components-popover__content > div { - padding: 20px 18px; -} -@media (min-width: 600px) { - .nux-dot-tip .components-popover__content { - width: 450px; - } -} -.nux-dot-tip .components-popover__content .nux-dot-tip__disable { - position: absolute; - left: 0; - top: 0; -} -.nux-dot-tip[data-y-axis=top] { - margin-top: -4px; -} -.nux-dot-tip[data-y-axis=bottom] { - margin-top: 4px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=left] { - margin-right: -4px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=right] { - margin-right: 4px; -} -.nux-dot-tip[data-y-axis=top] .components-popover__content { - margin-bottom: 20px; -} -.nux-dot-tip[data-y-axis=bottom] .components-popover__content { - margin-top: 20px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content { - margin-left: 20px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content { - margin-right: 20px; -} -.nux-dot-tip[data-y-axis=left], .nux-dot-tip[data-y-axis=center], .nux-dot-tip[data-y-axis=right] { - z-index: 1000001; -} -@media (max-width: 600px) { - .nux-dot-tip[data-y-axis=left] .components-popover__content, .nux-dot-tip[data-y-axis=center] .components-popover__content, .nux-dot-tip[data-y-axis=right] .components-popover__content { - align-self: end; - right: 5px; - margin: 20px 0 0 0; - max-width: none !important; - position: fixed; - left: 5px; - width: auto; - } -} -.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content { - margin-left: 0; -} -.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content { - margin-right: 0; -} -.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content { - margin-left: -12px; -} -.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content { - margin-right: -12px; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.nux-dot-tip::before, .nux-dot-tip::after { - border-radius: 100%; - content: " "; - pointer-events: none; - position: absolute; -} -.nux-dot-tip::before { - animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62); - background: rgba(0, 115, 156, 0.9); - opacity: 0.9; - height: 24px; - left: -12px; - top: -12px; - transform: scale(0.3333333333); - width: 24px; -} -.nux-dot-tip::after { - background: #00739c; - height: 8px; - left: -4px; - top: -4px; - width: 8px; -} -@keyframes nux-pulse { - 100% { - background: rgba(0, 115, 156, 0); - transform: scale(1); - } -} -.nux-dot-tip .components-popover__content { - width: 350px; -} -.nux-dot-tip .components-popover__content > div { - padding: 20px 18px; -} -@media (min-width: 600px) { - .nux-dot-tip .components-popover__content { - width: 450px; - } -} -.nux-dot-tip .components-popover__content .nux-dot-tip__disable { - position: absolute; - right: 0; - top: 0; -} -.nux-dot-tip[data-y-axis=top] { - margin-top: -4px; -} -.nux-dot-tip[data-y-axis=bottom] { - margin-top: 4px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=left] { - margin-left: -4px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=right] { - margin-left: 4px; -} -.nux-dot-tip[data-y-axis=top] .components-popover__content { - margin-bottom: 20px; -} -.nux-dot-tip[data-y-axis=bottom] .components-popover__content { - margin-top: 20px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=left] .components-popover__content { - margin-right: 20px; -} -.nux-dot-tip[data-y-axis=middle][data-y-axis=right] .components-popover__content { - margin-left: 20px; -} -.nux-dot-tip[data-y-axis=left], .nux-dot-tip[data-y-axis=center], .nux-dot-tip[data-y-axis=right] { - z-index: 1000001; -} -@media (max-width: 600px) { - .nux-dot-tip[data-y-axis=left] .components-popover__content, .nux-dot-tip[data-y-axis=center] .components-popover__content, .nux-dot-tip[data-y-axis=right] .components-popover__content { - align-self: end; - left: 5px; - margin: 20px 0 0 0; - max-width: none !important; - position: fixed; - right: 5px; - width: auto; - } -} -.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content { - /*!rtl:ignore*/ - margin-left: 0; -} -.nux-dot-tip.components-popover:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content { - /*!rtl:ignore*/ - margin-right: 0; -} -.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=right] .components-popover__content { - /*!rtl:ignore*/ - margin-left: -12px; -} -.nux-dot-tip.components-popover.interface-more-menu-dropdown__content:not([data-y-axis=middle])[data-y-axis=left] .components-popover__content { - /*!rtl:ignore*/ - margin-right: -12px; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-directory-block-ratings>span{display:flex}.block-directory-block-ratings svg{fill:#1e1e1e;margin-right:-4px}.block-directory-block-ratings .block-directory-block-ratings__star-empty{fill:#ccc}.block-directory-compact-list{margin:0;list-style:none}.block-directory-compact-list__item{display:flex;flex-direction:row;align-items:center;margin-bottom:16px}.block-directory-compact-list__item:last-child{margin-bottom:0}.block-directory-compact-list__item-details{margin-right:8px}.block-directory-compact-list__item-title{font-weight:500}.block-directory-compact-list__item-author{color:#757575;font-size:11px}.block-directory-downloadable-block-icon{min-width:54px;width:54px;height:54px;vertical-align:middle;border:1px solid #ddd}.block-directory-downloadable-block-list-item{padding:12px;width:100%;height:auto;text-align:right;display:grid;grid-template-columns:auto 1fr}.block-directory-downloadable-block-list-item:hover{box-shadow:0 0 0 2px var(--wp-admin-theme-color)}.block-directory-downloadable-block-list-item.is-busy{background:transparent}.block-directory-downloadable-block-list-item.is-busy .block-directory-downloadable-block-list-item__author{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.block-directory-downloadable-block-list-item:disabled,.block-directory-downloadable-block-list-item[aria-disabled]{opacity:1}.block-directory-downloadable-block-list-item__icon{position:relative;margin-left:16px;align-self:flex-start}.block-directory-downloadable-block-list-item__icon .block-directory-downloadable-block-list-item__spinner{position:absolute;top:0;left:0;bottom:0;right:0;background:hsla(0,0%,100%,.75);display:flex;align-items:center;justify-content:center}.block-directory-block-ratings{display:block;margin-top:4px}.block-directory-downloadable-block-list-item__details{color:#1e1e1e}.block-directory-downloadable-block-list-item__title{display:block;font-weight:600}.block-directory-downloadable-block-list-item__author{display:block;margin-top:4px;font-weight:400}.block-directory-downloadable-block-list-item__desc{display:block;margin-top:8px}.block-directory-downloadable-block-notice{margin:8px 0 0;color:#cc1818}.block-directory-downloadable-block-notice__content{padding-left:12px;margin-bottom:8px}.block-directory-downloadable-blocks-panel{padding:16px}.block-directory-downloadable-blocks-panel.has-blocks-loading{font-style:normal;padding:0;margin:112px 0;text-align:center;color:#757575}.block-directory-downloadable-blocks-panel.has-blocks-loading .components-spinner{float:inherit}.block-directory-downloadable-blocks-panel__no-local{margin:48px 0;padding:0 64px;color:#757575;text-align:center}.block-directory-downloadable-blocks-panel__title{margin:0 0 4px;font-size:14px}.block-directory-downloadable-blocks-panel__description{margin-top:0}.block-directory-downloadable-blocks-panel button{margin-top:4px}.installed-blocks-pre-publish-panel__copy{margin-top:0}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-directory-block-ratings>span{display:flex}.block-directory-block-ratings svg{fill:#1e1e1e;margin-left:-4px}.block-directory-block-ratings .block-directory-block-ratings__star-empty{fill:#ccc}.block-directory-compact-list{margin:0;list-style:none}.block-directory-compact-list__item{display:flex;flex-direction:row;align-items:center;margin-bottom:16px}.block-directory-compact-list__item:last-child{margin-bottom:0}.block-directory-compact-list__item-details{margin-left:8px}.block-directory-compact-list__item-title{font-weight:500}.block-directory-compact-list__item-author{color:#757575;font-size:11px}.block-directory-downloadable-block-icon{min-width:54px;width:54px;height:54px;vertical-align:middle;border:1px solid #ddd}.block-directory-downloadable-block-list-item{padding:12px;width:100%;height:auto;text-align:left;display:grid;grid-template-columns:auto 1fr}.block-directory-downloadable-block-list-item:hover{box-shadow:0 0 0 2px var(--wp-admin-theme-color)}.block-directory-downloadable-block-list-item.is-busy{background:transparent}.block-directory-downloadable-block-list-item.is-busy .block-directory-downloadable-block-list-item__author{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.block-directory-downloadable-block-list-item:disabled,.block-directory-downloadable-block-list-item[aria-disabled]{opacity:1}.block-directory-downloadable-block-list-item__icon{position:relative;margin-right:16px;align-self:flex-start}.block-directory-downloadable-block-list-item__icon .block-directory-downloadable-block-list-item__spinner{position:absolute;top:0;right:0;bottom:0;left:0;background:hsla(0,0%,100%,.75);display:flex;align-items:center;justify-content:center}.block-directory-block-ratings{display:block;margin-top:4px}.block-directory-downloadable-block-list-item__details{color:#1e1e1e}.block-directory-downloadable-block-list-item__title{display:block;font-weight:600}.block-directory-downloadable-block-list-item__author{display:block;margin-top:4px;font-weight:400}.block-directory-downloadable-block-list-item__desc{display:block;margin-top:8px}.block-directory-downloadable-block-notice{margin:8px 0 0;color:#cc1818}.block-directory-downloadable-block-notice__content{padding-right:12px;margin-bottom:8px}.block-directory-downloadable-blocks-panel{padding:16px}.block-directory-downloadable-blocks-panel.has-blocks-loading{font-style:normal;padding:0;margin:112px 0;text-align:center;color:#757575}.block-directory-downloadable-blocks-panel.has-blocks-loading .components-spinner{float:inherit}.block-directory-downloadable-blocks-panel__no-local{margin:48px 0;padding:0 64px;color:#757575;text-align:center}.block-directory-downloadable-blocks-panel__title{margin:0 0 4px;font-size:14px}.block-directory-downloadable-blocks-panel__description{margin-top:0}.block-directory-downloadable-blocks-panel button{margin-top:4px}.installed-blocks-pre-publish-panel__copy{margin-top:0}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-directory-block-ratings > span { - display: flex; -} -.block-directory-block-ratings svg { - fill: #1e1e1e; - margin-right: -4px; -} -.block-directory-block-ratings .block-directory-block-ratings__star-empty { - fill: #ccc; -} - -.block-directory-compact-list { - margin: 0; - list-style: none; -} - -.block-directory-compact-list__item { - display: flex; - flex-direction: row; - align-items: center; - margin-bottom: 16px; -} -.block-directory-compact-list__item:last-child { - margin-bottom: 0; -} - -.block-directory-compact-list__item-details { - margin-right: 8px; -} - -.block-directory-compact-list__item-title { - font-weight: 500; -} - -.block-directory-compact-list__item-author { - color: #757575; - font-size: 11px; -} - -.block-directory-downloadable-block-icon { - min-width: 54px; - width: 54px; - height: 54px; - vertical-align: middle; - border: 1px solid #ddd; -} - -.block-directory-downloadable-block-list-item { - padding: 12px; - width: 100%; - height: auto; - text-align: right; - display: grid; - grid-template-columns: auto 1fr; -} -.block-directory-downloadable-block-list-item:hover { - box-shadow: 0 0 0 2px var(--wp-admin-theme-color); -} -.block-directory-downloadable-block-list-item.is-busy { - background: transparent; -} -.block-directory-downloadable-block-list-item.is-busy .block-directory-downloadable-block-list-item__author { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} -.block-directory-downloadable-block-list-item:disabled, .block-directory-downloadable-block-list-item[aria-disabled] { - opacity: 1; -} - -.block-directory-downloadable-block-list-item__icon { - position: relative; - margin-left: 16px; - align-self: flex-start; -} -.block-directory-downloadable-block-list-item__icon .block-directory-downloadable-block-list-item__spinner { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: rgba(255, 255, 255, 0.75); - display: flex; - align-items: center; - justify-content: center; -} - -.block-directory-block-ratings { - display: block; - margin-top: 4px; -} - -.block-directory-downloadable-block-list-item__details { - color: #1e1e1e; -} - -.block-directory-downloadable-block-list-item__title { - display: block; - font-weight: 600; -} - -.block-directory-downloadable-block-list-item__author { - display: block; - margin-top: 4px; - font-weight: normal; -} - -.block-directory-downloadable-block-list-item__desc { - display: block; - margin-top: 8px; -} - -.block-directory-downloadable-block-notice { - margin: 8px 0 0; - color: #cc1818; -} - -.block-directory-downloadable-block-notice__content { - padding-left: 12px; - margin-bottom: 8px; -} - -.block-directory-downloadable-blocks-panel { - padding: 16px; -} -.block-directory-downloadable-blocks-panel.has-blocks-loading { - font-style: normal; - padding: 0; - margin: 112px 0; - text-align: center; - color: #757575; -} -.block-directory-downloadable-blocks-panel.has-blocks-loading .components-spinner { - float: inherit; -} - -.block-directory-downloadable-blocks-panel__no-local { - margin: 48px 0; - padding: 0 64px; - color: #757575; - text-align: center; -} - -.block-directory-downloadable-blocks-panel__title { - margin: 0 0 4px; - font-size: 14px; -} - -.block-directory-downloadable-blocks-panel__description { - margin-top: 0; -} - -.block-directory-downloadable-blocks-panel button { - margin-top: 4px; -} - -.installed-blocks-pre-publish-panel__copy { - margin-top: 0; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-directory-block-ratings > span { - display: flex; -} -.block-directory-block-ratings svg { - fill: #1e1e1e; - margin-left: -4px; -} -.block-directory-block-ratings .block-directory-block-ratings__star-empty { - fill: #ccc; -} - -.block-directory-compact-list { - margin: 0; - list-style: none; -} - -.block-directory-compact-list__item { - display: flex; - flex-direction: row; - align-items: center; - margin-bottom: 16px; -} -.block-directory-compact-list__item:last-child { - margin-bottom: 0; -} - -.block-directory-compact-list__item-details { - margin-left: 8px; -} - -.block-directory-compact-list__item-title { - font-weight: 500; -} - -.block-directory-compact-list__item-author { - color: #757575; - font-size: 11px; -} - -.block-directory-downloadable-block-icon { - min-width: 54px; - width: 54px; - height: 54px; - vertical-align: middle; - border: 1px solid #ddd; -} - -.block-directory-downloadable-block-list-item { - padding: 12px; - width: 100%; - height: auto; - text-align: left; - display: grid; - grid-template-columns: auto 1fr; -} -.block-directory-downloadable-block-list-item:hover { - box-shadow: 0 0 0 2px var(--wp-admin-theme-color); -} -.block-directory-downloadable-block-list-item.is-busy { - background: transparent; -} -.block-directory-downloadable-block-list-item.is-busy .block-directory-downloadable-block-list-item__author { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} -.block-directory-downloadable-block-list-item:disabled, .block-directory-downloadable-block-list-item[aria-disabled] { - opacity: 1; -} - -.block-directory-downloadable-block-list-item__icon { - position: relative; - margin-right: 16px; - align-self: flex-start; -} -.block-directory-downloadable-block-list-item__icon .block-directory-downloadable-block-list-item__spinner { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: rgba(255, 255, 255, 0.75); - display: flex; - align-items: center; - justify-content: center; -} - -.block-directory-block-ratings { - display: block; - margin-top: 4px; -} - -.block-directory-downloadable-block-list-item__details { - color: #1e1e1e; -} - -.block-directory-downloadable-block-list-item__title { - display: block; - font-weight: 600; -} - -.block-directory-downloadable-block-list-item__author { - display: block; - margin-top: 4px; - font-weight: normal; -} - -.block-directory-downloadable-block-list-item__desc { - display: block; - margin-top: 8px; -} - -.block-directory-downloadable-block-notice { - margin: 8px 0 0; - color: #cc1818; -} - -.block-directory-downloadable-block-notice__content { - padding-right: 12px; - margin-bottom: 8px; -} - -.block-directory-downloadable-blocks-panel { - padding: 16px; -} -.block-directory-downloadable-blocks-panel.has-blocks-loading { - font-style: normal; - padding: 0; - margin: 112px 0; - text-align: center; - color: #757575; -} -.block-directory-downloadable-blocks-panel.has-blocks-loading .components-spinner { - float: inherit; -} - -.block-directory-downloadable-blocks-panel__no-local { - margin: 48px 0; - padding: 0 64px; - color: #757575; - text-align: center; -} - -.block-directory-downloadable-blocks-panel__title { - margin: 0 0 4px; - font-size: 14px; -} - -.block-directory-downloadable-blocks-panel__description { - margin-top: 0; -} - -.block-directory-downloadable-blocks-panel button { - margin-top: 4px; -} - -.installed-blocks-pre-publish-panel__copy { - margin-top: 0; -}@charset "UTF-8";:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-animate__appear{animation:components-animate__appear-animation .1s cubic-bezier(0,0,.2,1) 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-animate__appear{animation-duration:1ms;animation-delay:0s}}.components-animate__appear.is-from-top,.components-animate__appear.is-from-top.is-from-left{transform-origin:top right}.components-animate__appear.is-from-top.is-from-right{transform-origin:top left}.components-animate__appear.is-from-bottom,.components-animate__appear.is-from-bottom.is-from-left{transform-origin:bottom right}.components-animate__appear.is-from-bottom.is-from-right{transform-origin:bottom left}@keyframes components-animate__appear-animation{0%{transform:translateY(-2em) scaleY(0) scaleX(0)}to{transform:translateY(0) scaleY(1) scaleX(1)}}.components-animate__slide-in{animation:components-animate__slide-in-animation .1s cubic-bezier(0,0,.2,1);animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-animate__slide-in{animation-duration:1ms;animation-delay:0s}}.components-animate__slide-in.is-from-left{transform:translateX(-100%)}.components-animate__slide-in.is-from-right{transform:translateX(100%)}@keyframes components-animate__slide-in-animation{to{transform:translateX(0)}}.components-animate__loading{animation:components-animate__loading 1.6s ease-in-out infinite}@keyframes components-animate__loading{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.components-autocomplete__popover .components-popover__content>div{padding:16px;min-width:220px}.components-autocomplete__result.components-button{display:flex;height:auto;min-height:36px;text-align:right;width:100%}.components-autocomplete__result.components-button.is-selected{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button-group{display:inline-block}.components-button-group .components-button{border-radius:0;display:inline-flex;color:#1e1e1e;box-shadow:inset 0 0 0 1px #1e1e1e}.components-button-group .components-button+.components-button{margin-right:-1px}.components-button-group .components-button:first-child{border-radius:0 2px 2px 0}.components-button-group .components-button:last-child{border-radius:2px 0 0 2px}.components-button-group .components-button.is-primary,.components-button-group .components-button:focus{position:relative;z-index:1}.components-button-group .components-button.is-primary{box-shadow:inset 0 0 0 1px #1e1e1e}.components-button{display:inline-flex;text-decoration:none;font-family:inherit;font-weight:400;font-size:13px;margin:0;border:0;cursor:pointer;-webkit-appearance:none;background:none;transition:box-shadow .1s linear;height:36px;align-items:center;box-sizing:border-box;padding:6px 12px;border-radius:2px;color:#1e1e1e}@media (prefers-reduced-motion:reduce){.components-button{transition-duration:0s;transition-delay:0s}}.components-button:hover,.components-button[aria-expanded=true]{color:var(--wp-admin-theme-color)}.components-button[aria-disabled=true]:hover{color:initial}.components-button:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:3px solid transparent}.components-button.is-primary{white-space:nowrap;background:var(--wp-admin-theme-color);color:#fff;text-decoration:none;text-shadow:none;outline:1px solid transparent}.components-button.is-primary:hover:not(:disabled){background:var(--wp-admin-theme-color-darker-10);color:#fff}.components-button.is-primary:active:not(:disabled){background:var(--wp-admin-theme-color-darker-20);border-color:var(--wp-admin-theme-color-darker-20);color:#fff}.components-button.is-primary:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.is-primary:disabled,.components-button.is-primary:disabled:active:enabled,.components-button.is-primary[aria-disabled=true],.components-button.is-primary[aria-disabled=true]:active:enabled,.components-button.is-primary[aria-disabled=true]:enabled{color:hsla(0,0%,100%,.4);background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);opacity:1;outline:none}.components-button.is-primary:disabled:active:enabled:focus:enabled,.components-button.is-primary:disabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:active:enabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:enabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:focus:enabled{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color)}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled=true]{color:#fff;background-size:100px 100%;background-image:linear-gradient(45deg,var(--wp-admin-theme-color) 33%,var(--wp-admin-theme-color-darker-20) 0,var(--wp-admin-theme-color-darker-20) 70%,var(--wp-admin-theme-color) 0);border-color:var(--wp-admin-theme-color)}.components-button.is-secondary,.components-button.is-tertiary{outline:1px solid transparent}.components-button.is-secondary:active:not(:disabled),.components-button.is-tertiary:active:not(:disabled){background:#ddd;color:var(--wp-admin-theme-color-darker-10);box-shadow:none}.components-button.is-secondary:hover:not(:disabled),.components-button.is-tertiary:hover:not(:disabled){color:var(--wp-admin-theme-color-darker-10);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color-darker-10)}.components-button.is-secondary:disabled,.components-button.is-secondary[aria-disabled=true],.components-button.is-secondary[aria-disabled=true]:hover,.components-button.is-tertiary:disabled,.components-button.is-tertiary[aria-disabled=true],.components-button.is-tertiary[aria-disabled=true]:hover{color:#828282;background:#eaeaea;transform:none;opacity:1;box-shadow:none;outline:none}.components-button.is-secondary{box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);outline:1px solid transparent}.components-button.is-secondary,.components-button.is-tertiary{white-space:nowrap;color:var(--wp-admin-theme-color);background:transparent}.components-button.is-tertiary{padding:6px}.components-button.is-tertiary .dashicon{display:inline-block;flex:0 0 auto}p+.components-button.is-tertiary{margin-right:-6px}.components-button.is-destructive{color:#cc1818;box-shadow:inset 0 0 0 1px #cc1818}.components-button.is-destructive:hover:not(:disabled){color:#710d0d;box-shadow:inset 0 0 0 1px #710d0d}.components-button.is-destructive:focus:not(:disabled){color:var(--wp-admin-theme-color)}.components-button.is-destructive:active:not(:disabled){background:#ccc}.components-button.is-destructive.is-primary{color:#fff;background:#cc1818;box-shadow:inset 0 0 0 1px #cc1818}.components-button.is-destructive.is-primary:hover:not(:disabled){color:#fff;background:#710d0d;box-shadow:inset 0 0 0 1px #710d0d}.components-button.is-destructive.is-tertiary{box-shadow:none}.components-button.is-destructive.is-tertiary:hover:not(:disabled){box-shadow:inset 0 0 0 1px #cc1818;color:#cc1818}.components-button.is-destructive.is-tertiary:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) #cc1818;color:#cc1818}.components-button.is-link{margin:0;padding:0;box-shadow:none;border:0;border-radius:0;background:none;outline:none;text-align:right;color:var(--wp-admin-theme-color);text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out;height:auto}@media (prefers-reduced-motion:reduce){.components-button.is-link{transition-duration:0s;transition-delay:0s}}.components-button.is-link:focus{border-radius:2px}.components-button.is-link.is-destructive{color:#cc1818}.components-button.is-link.is-destructive:active:not(:disabled),.components-button.is-link.is-destructive:hover:not(:disabled){color:#710d0d;background:none}.components-button.is-link.is-destructive:focus:not(:disabled){color:var(--wp-admin-theme-color)}.components-button:not([aria-disabled=true]):active{color:inherit}.components-button:disabled,.components-button[aria-disabled=true]{cursor:default;opacity:.3}.components-button.is-busy,.components-button.is-secondary.is-busy,.components-button.is-secondary.is-busy:disabled,.components-button.is-secondary.is-busy[aria-disabled=true]{animation:components-button__busy-animation 2.5s linear infinite;opacity:1;background-size:100px 100%;background-image:linear-gradient(45deg,#fafafa 33%,#e0e0e0 0,#e0e0e0 70%,#fafafa 0)}.components-button.is-small{height:24px;line-height:22px;padding:0 8px;font-size:11px}.components-button.is-small.has-icon:not(.has-text){padding:0 8px;width:24px}.components-button.has-icon{padding:6px;min-width:36px;justify-content:center}.components-button.has-icon .dashicon{display:inline-block;flex:0 0 auto;margin-right:2px;margin-left:2px}.components-button.has-icon.has-text{justify-content:left}.components-button.has-icon.has-text svg{margin-left:8px}.components-button.has-icon.has-text .dashicon{margin-left:10px}.components-button.is-pressed{color:#fff;background:#1e1e1e}.components-button.is-pressed:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.components-button.is-pressed:hover:not(:disabled){color:#fff;background:#1e1e1e}.components-button svg{fill:currentColor;outline:none}@media (forced-colors:active){.components-button svg{fill:CanvasText}}.components-button .components-visually-hidden{height:auto}@keyframes components-button__busy-animation{0%{background-position:200px 0}}.components-checkbox-control__input[type=checkbox]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;font-size:16px;line-height:normal;border:1px solid #1e1e1e;transition:none;border-radius:2px;background:#fff;color:#1e1e1e;clear:none;cursor:pointer;display:inline-block;line-height:0;margin:0 0 0 4px;outline:0;padding:0!important;text-align:center;vertical-align:top;width:24px;height:24px;-webkit-appearance:none;appearance:none;transition:border-color .1s ease-in-out}@media (min-width:600px){.components-checkbox-control__input[type=checkbox]{font-size:13px;line-height:normal}}.components-checkbox-control__input[type=checkbox]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]:checked::-ms-check{opacity:0}.components-checkbox-control__input[type=checkbox]:checked:before,.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{margin:-3px -5px;color:#fff}@media (min-width:782px){.components-checkbox-control__input[type=checkbox]:checked:before,.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{margin:-4px -5px 0 0}}.components-checkbox-control__input[type=checkbox][aria-checked=mixed]{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{content:"";float:right;display:inline-block;vertical-align:middle;width:16px;font:normal 30px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:782px){.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{float:none;font-size:21px}}@media (min-width:600px){.components-checkbox-control__input[type=checkbox]{height:20px;width:20px}}@media (prefers-reduced-motion:reduce){.components-checkbox-control__input[type=checkbox]{transition-duration:0s;transition-delay:0s}}.components-checkbox-control__input[type=checkbox]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.components-checkbox-control__input[type=checkbox]:checked,.components-checkbox-control__input[type=checkbox]:indeterminate{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]:checked::-ms-check,.components-checkbox-control__input[type=checkbox]:indeterminate::-ms-check{opacity:0}.components-checkbox-control__input[type=checkbox]:checked:before{content:none}.components-checkbox-control__input-container{position:relative;display:inline-block;margin-left:12px;vertical-align:middle;width:24px;height:24px}@media (min-width:600px){.components-checkbox-control__input-container{width:20px;height:20px}}svg.components-checkbox-control__checked,svg.components-checkbox-control__indeterminate{fill:#fff;cursor:pointer;position:absolute;right:0;top:0;width:24px;height:24px;-webkit-user-select:none;user-select:none;pointer-events:none}@media (min-width:600px){svg.components-checkbox-control__checked,svg.components-checkbox-control__indeterminate{right:-2px;top:-2px}}.components-circular-option-picker{display:inline-block;width:100%;min-width:188px}.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper{display:flex;justify-content:flex-end;margin-top:12px}.components-circular-option-picker .components-circular-option-picker__swatches{display:flex;flex-wrap:wrap;gap:12px}.components-circular-option-picker__option-wrapper{display:inline-block;height:28px;width:28px;vertical-align:top;transform:scale(1);transition:transform .1s ease}@media (prefers-reduced-motion:reduce){.components-circular-option-picker__option-wrapper{transition-duration:0s;transition-delay:0s}}.components-circular-option-picker__option-wrapper:hover{transform:scale(1.2)}.components-circular-option-picker__option-wrapper>div{height:100%;width:100%}.components-circular-option-picker__option-wrapper:before{content:"";position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:50%;z-index:-1;background:url("data:image/svg+xml;charset=utf-8,%3Csvg width='28' height='28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8V6H4v2h2zm2 0V6h2v2H8zm2 8H8v-2h2v2zm2 0v-2h2v2h-2zm0 2v-2h-2v2H8v2h2v-2h2zm2 0v2h-2v-2h2zm2 0h-2v-2h2v2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18 18h2v-2h-2v-2h2v-2h-2v-2h2V8h-2v2h-2V8h-2v2h2v2h-2v2h2v2h2v2zm-2-4v-2h2v2h-2z' fill='%23555D65'/%3E%3Cpath d='M18 18v2h-2v-2h2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8 10V8H6v2H4v2h2v2H4v2h2v2H4v2h2v2H4v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2v2h-2V4h-2v2h-2V4h-2v2h-2V4h-2v2h2v2h-2v2H8zm0 2v-2H6v2h2zm2 0v-2h2v2h-2zm0 2v-2H8v2H6v2h2v2H6v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h-2v2h-2V6h-2v2h-2v2h2v2h-2v2h-2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4 0H2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2H8V0H6v2H4V0zm0 4V2H2v2h2zm2 0V2h2v2H6zm0 2V4H4v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2H8v2H6z' fill='%23555D65'/%3E%3C/svg%3E")}.components-circular-option-picker__option{display:inline-block;vertical-align:top;height:100%;width:100%;border:none;border-radius:50%;background:transparent;box-shadow:inset 0 0 0 14px;transition:box-shadow .1s ease;cursor:pointer}@media (prefers-reduced-motion:reduce){.components-circular-option-picker__option{transition-duration:0s;transition-delay:0s}}.components-circular-option-picker__option:hover{box-shadow:inset 0 0 0 14px!important}.components-circular-option-picker__option.is-pressed{box-shadow:inset 0 0 0 4px;position:relative;z-index:1;overflow:visible}.components-circular-option-picker__option.is-pressed+svg{position:absolute;right:2px;top:2px;border-radius:50%;z-index:2;pointer-events:none}.components-circular-option-picker__option:after{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);border:1px solid transparent}.components-circular-option-picker__option:focus:after{content:"";border:2px solid #757575;width:32px;height:32px;position:absolute;top:-2px;right:-2px;border-radius:50%;box-shadow:inset 0 0 0 2px #fff}.components-circular-option-picker__option.components-button:focus{background-color:transparent;box-shadow:inset 0 0 0 14px;outline:none}.components-circular-option-picker__button-action .components-circular-option-picker__option{color:#fff;background:#fff}.components-circular-option-picker__dropdown-link-action{margin-left:16px}.components-circular-option-picker__dropdown-link-action .components-button{line-height:22px}@media (min-width:782px){.components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content{margin-left:156px;margin-top:-49px}}.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar{margin-top:0}.components-palette-edit__popover .components-custom-gradient-picker__ui-line{margin-bottom:0}.components-palette-edit__popover .components-custom-gradient-picker{width:280px;padding:8px}.components-dropdown-menu__menu .components-palette-edit__menu-button{width:100%}.component-color-indicator{width:20px;height:20px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);border-radius:50%;display:inline-block;padding:0}.components-combobox-control{width:100%}input.components-combobox-control__input[type=text]{width:100%;border:none;box-shadow:none;font-family:inherit;font-size:16px;padding:2px;margin:0;line-height:inherit;min-height:auto}@media (min-width:600px){input.components-combobox-control__input[type=text]{font-size:13px}}input.components-combobox-control__input[type=text]:focus{outline:none;box-shadow:none}.components-combobox-control__suggestions-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:flex;flex-wrap:wrap;align-items:flex-start;width:100%;margin:0 0 8px;padding:4px}@media (prefers-reduced-motion:reduce){.components-combobox-control__suggestions-container{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-combobox-control__suggestions-container{font-size:13px;line-height:normal}}.components-combobox-control__suggestions-container:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-combobox-control__suggestions-container::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container:focus-within{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-combobox-control__reset.components-button{display:flex;height:16px;min-width:16px;padding:0}.components-color-list-picker,.components-color-list-picker__swatch-button{width:100%}.components-color-list-picker__color-picker{margin:8px 0}.components-color-palette__custom-color{position:relative;border:none;background:none;border-radius:2px;height:64px;padding:12px;font-family:inherit;width:100%;background-image:repeating-linear-gradient(-45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0),repeating-linear-gradient(-45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0);background-position:100% 0,25px 25px;background-size:50px 50px;box-sizing:border-box;color:#fff;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);outline:1px solid transparent}.components-color-palette__custom-color:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline-width:2px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content{overflow:visible;box-shadow:0 4px 4px rgba(0,0,0,.05);border:none;border-radius:2px;max-height:-moz-fit-content!important;max-height:fit-content!important}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content>div{padding:0}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation{border-top-left-radius:2px;border-top-right-radius:2px}@media (min-width:782px){.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar .components-popover__content.components-popover__content{margin-left:156px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content{margin-top:-60px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-bottom .components-popover__content{margin-bottom:-60px}}.components-color-palette__custom-color-name{text-align:right}.components-color-palette__custom-color-value{margin-right:16px;text-transform:uppercase}.components-custom-gradient-picker__gradient-bar:not(.has-gradient){opacity:.4}.components-custom-gradient-picker__gradient-bar{border-radius:2px;margin-top:12px;width:100%;height:48px;margin-bottom:20px;padding-right:16px}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__markers-container{position:relative;width:calc(100% - 32px);margin-right:auto;margin-left:auto}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point{border-radius:50%;background:#fff;padding:2px;top:16px;min-width:16px;width:16px;height:16px;position:relative;color:#1e1e1e}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point svg{height:100%;width:100%}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button{border-radius:50%;height:16px;width:16px;padding:0;position:absolute;top:16px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #fff,0 0 2px 0 rgba(0,0,0,.25);outline:2px solid transparent}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button.is-active,.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button:focus{box-shadow:inset 0 0 0 calc(var(--wp-admin-border-width-focus)*2) #fff,0 0 2px 0 rgba(0,0,0,.25);outline:4px solid transparent}.components-custom-gradient-picker__color-picker-popover .components-custom-gradient-picker__remove-control-point{margin-right:auto;margin-left:auto;display:block;margin-bottom:8px}.components-custom-gradient-picker__inserter{direction:ltr;width:100%}.components-custom-gradient-picker__liner-gradient-indicator{display:inline-block;flex:0 auto;width:20px;height:20px}.components-custom-gradient-picker .components-custom-gradient-picker__ui-line{margin-bottom:16px}.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-angle-picker,.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-custom-gradient-picker__type-picker{margin-bottom:0}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar{border:none}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar>div+div{margin-right:1px}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar button.is-pressed>svg{background:#fff;border:1px solid #949494;border-radius:2px}.components-custom-gradient-picker .components-input-control__label{line-height:1}.components-custom-gradient-picker label{text-transform:uppercase;font-size:11px;font-weight:500}.components-custom-select-control{position:relative}.components-custom-select-control__label{display:block;margin-bottom:8px}.components-custom-select-control__button{border:1px solid #757575;border-radius:2px;min-width:130px;position:relative;text-align:right}.components-custom-select-control__button:not(.is-next-36px-default-size){min-height:30px}.components-custom-select-control__button.components-custom-select-control__button{padding-right:16px;padding-left:32px}.components-custom-select-control__button.components-custom-select-control__button:not(.is-next-36px-default-size){padding-right:8px;padding-left:24px}.components-custom-select-control__button:focus:not(:disabled){border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-custom-select-control__button .components-custom-select-control__button-icon{height:100%;padding:0;position:absolute;left:8px;top:0}.components-custom-select-control__button .components-custom-select-control__button-icon:not(.is-next-36px-default-size){left:4px}.components-custom-select-control__menu{border:1px solid #1e1e1e;background-color:#fff;border-radius:2px;outline:none;transition:none;max-height:400px;min-width:100%;overflow:auto;padding:0;position:absolute;z-index:1000000}.components-custom-select-control__menu[aria-hidden=true]{display:none}.components-custom-select-control__item{align-items:center;display:grid;grid-template-columns:auto auto;list-style-type:none;padding:8px 16px;cursor:default;line-height:28px}.components-custom-select-control__item:not(.is-next-36px-default-size){padding:8px}.components-custom-select-control__item.has-hint{grid-template-columns:auto auto 30px}.components-custom-select-control__item.is-highlighted{background:#ddd}.components-custom-select-control__item .components-custom-select-control__item-hint{color:#757575;text-align:left;padding-left:4px}.components-custom-select-control__item .components-custom-select-control__item-icon{margin-right:auto}.components-custom-select-control__item:last-child{margin-bottom:0}.PresetDateRangePicker_panel{padding:0 22px 11px}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;box-sizing:border-box;cursor:pointer}.PresetDateRangePicker_button:active{outline:0}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699}.SingleDatePickerInput{display:inline-block;background-color:#fff}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb}.SingleDatePickerInput__rtl{direction:rtl}.SingleDatePickerInput__disabled{background-color:#f2f2f2}.SingleDatePickerInput__block{display:block}.SingleDatePickerInput__showClearDate{padding-right:30px}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;transform:translateY(-50%)}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%}.SingleDatePickerInput_clearDate__small{padding:6px}.SingleDatePickerInput_clearDate__hide{visibility:hidden}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle}.SingleDatePickerInput_clearDate_svg__small{height:9px}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle}.SingleDatePicker{position:relative;display:inline-block}.SingleDatePicker__block{display:block}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute}.SingleDatePicker_picker__rtl{direction:rtl}.SingleDatePicker_picker__directionLeft{left:0}.SingleDatePicker_picker__directionRight{right:0}.SingleDatePicker_picker__portal{background-color:rgba(0,0,0,.3);position:fixed;top:0;left:0;height:100%;width:100%}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:#b0b3b4;text-decoration:none}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0}.DayPickerKeyboardShortcuts_show{width:22px;position:absolute;z-index:2}.DayPickerKeyboardShortcuts_show__bottomRight{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0}.DayPickerKeyboardShortcuts_show__bottomRight:hover{border-right:33px solid #008489}.DayPickerKeyboardShortcuts_show__topRight{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0}.DayPickerKeyboardShortcuts_show__topRight:hover{border-right:33px solid #008489}.DayPickerKeyboardShortcuts_show__topLeft{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0}.DayPickerKeyboardShortcuts_show__topLeft:hover{border-left:33px solid #008489}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:-28px}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:-28px}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:-28px}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2}.DayPickerKeyboardShortcuts_close:active{outline:0}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a}.CalendarDay{box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center}.CalendarDay:active{outline:0}.CalendarDay__defaultCursor{cursor:default}.CalendarDay__default{border:1px solid #e4e7e7;color:#484848;background:#fff}.CalendarDay__default:hover{background:#e4e7e7;border:1px double #e4e7e7;color:inherit}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit}.CalendarDay__outside{border:0;background:#fff;color:#484848}.CalendarDay__outside:hover{border:0}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:#ffce71;color:#484848}.CalendarDay__selected_span{background:#66e2da;border:1px solid #33dacd;color:#fff}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:#33dacd;border:1px solid #33dacd;color:#fff}.CalendarDay__last_in_range{border-right:#00a699}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:#00a699;border:1px solid #00a699;color:#fff}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:#b2f1ec;border:1px solid #80e8e0;color:#007a87}.CalendarDay__hovered_span:active{background:#80e8e0;border:1px solid #80e8e0;color:#007a87}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd}.CalendarMonth{background:#fff;text-align:center;vertical-align:top;-webkit-user-select:none;user-select:none}.CalendarMonth_table{border-collapse:collapse;border-spacing:0}.CalendarMonth_verticalSpacing{border-collapse:separate}.CalendarMonth_caption{color:#484848;font-size:18px;text-align:center;padding-top:22px;padding-bottom:37px;caption-side:top}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px}.CalendarMonthGrid{background:#fff;text-align:left;z-index:0}.CalendarMonthGrid__animating{z-index:1}.CalendarMonthGrid__horizontal{position:absolute;left:0}.CalendarMonthGrid__vertical{margin:0 auto}.CalendarMonthGrid__vertical_scrollable{margin:0 auto;overflow-y:scroll}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none}.CalendarMonthGrid_month__hidden{visibility:hidden}.DayPickerNavigation{position:relative;z-index:2}.DayPickerNavigation__horizontal{height:0}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0}.DayPickerNavigation__verticalScrollableDefault{position:relative}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;user-select:none;border:0;padding:0;margin:0}.DayPickerNavigation_button__default{border:1px solid #e4e7e7;background-color:#fff;color:#757575}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:1px solid #c4c4c4}.DayPickerNavigation_button__default:active{background:#f2f2f2}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:.78;border-radius:3px;padding:6px 9px}.DayPickerNavigation_leftButton__horizontalDefault{left:22px}.DayPickerNavigation_rightButton__horizontalDefault{right:22px}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0,0,0,.1);position:relative;display:inline-block;height:100%;width:50%}.DayPickerNavigation_nextButton__verticalDefault{border-left:0}.DayPickerNavigation_nextButton__verticalScrollableDefault{width:100%}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:#82888a;display:block}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;display:block}.DayPicker{position:relative;text-align:left}.DayPicker,.DayPicker__horizontal{background:#fff}.DayPicker__verticalScrollable{height:100%}.DayPicker__hidden{visibility:hidden}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0,0,0,.05),0 0 0 1px rgba(0,0,0,.07);border-radius:3px}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%}.DayPicker_portal__vertical{position:static}.DayPicker_focusRegion{outline:0}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top}.DayPicker_weekHeaders{position:relative}.DayPicker_weekHeaders__horizontal{margin-left:13px}.DayPicker_weekHeader{color:#757575;position:absolute;top:62px;z-index:2;text-align:left;padding:0!important}.DayPicker_weekHeader__vertical{left:50%}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px}.DayPicker_weekHeader_li{display:inline-block;text-align:center;margin:0 1px}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px}.DayPicker_transitionContainer__horizontal{transition:height .2s ease-in-out}.DayPicker_transitionContainer__vertical{width:100%}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll}.DateInput{margin:0;padding:0;background:#fff;position:relative;display:inline-block;width:130px;vertical-align:middle}.DateInput__small{width:97px}.DateInput__block{width:100%}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb}.DateInput_input{font-weight:200;font-size:19px;line-height:24px;color:#484848;background-color:#fff;width:100%;padding:11px 11px 9px;border:0;border-bottom:2px solid transparent;border-radius:0}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:.2px;padding:7px 7px 5px}.DateInput_input__regular{font-weight:auto}.DateInput_input__readOnly{-webkit-user-select:none;user-select:none}.DateInput_input__focused{outline:0;background:#fff;border:0;border-bottom:2px solid #008489}.DateInput_input__disabled{background:#f2f2f2;font-style:italic}.DateInput_screenReaderMessage{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2}.DateInput_fangShape{fill:#fff}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent}.DateRangePickerInput{background-color:#fff;display:inline-block}.DateRangePickerInput__disabled{background:#f2f2f2}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb}.DateRangePickerInput__rtl{direction:rtl}.DateRangePickerInput__block{display:block}.DateRangePickerInput__showClearDates{padding-right:30px}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:24px;width:24px}.DateRangePickerInput_clearDates{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;transform:translateY(-50%)}.DateRangePickerInput_clearDates__small{padding:6px}.DateRangePickerInput_clearDates_default:focus,.DateRangePickerInput_clearDates_default:hover{background:#dbdbdb;border-radius:50%}.DateRangePickerInput_clearDates__hide{visibility:hidden}.DateRangePickerInput_clearDates_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle}.DateRangePickerInput_clearDates_svg__small{height:9px}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle}.DateRangePicker{position:relative;display:inline-block}.DateRangePicker__block{display:block}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute}.DateRangePicker_picker__rtl{direction:rtl}.DateRangePicker_picker__directionLeft{left:0}.DateRangePicker_picker__directionRight{right:0}.DateRangePicker_picker__portal{background-color:rgba(0,0,0,.3);position:fixed;top:0;left:0;height:100%;width:100%}.DateRangePicker_picker__fullScreenPortal{background-color:#fff}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:#b0b3b4;text-decoration:none}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd}.components-datetime{padding:16px}.components-panel__body .components-datetime{padding:0}.components-datetime .components-datetime__calendar-help{padding:16px;min-width:260px}.components-datetime .components-datetime__calendar-help h4{margin:0}.components-datetime .components-datetime__buttons{display:flex;justify-content:space-between}.components-datetime .components-datetime__date-help-toggle{display:block;margin-right:auto}.components-datetime fieldset{border:0;padding:0;margin:0}.components-datetime input,.components-datetime select{box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575}@media (prefers-reduced-motion:reduce){.components-datetime input,.components-datetime select{transition-duration:0s;transition-delay:0s}}.components-datetime .components-button,.components-datetime input[type=number],.components-datetime select{height:30px;margin-top:0;margin-bottom:0}.components-datetime .components-button:focus{z-index:1}.components-datetime__date{min-height:236px;border-top:1px solid #ddd}.components-datetime__date .DayPickerNavigation_leftButton__horizontalDefault{left:13px}.components-datetime__date .CalendarMonth_caption{font-size:13px}.components-datetime__date .CalendarMonth_table{border-collapse:separate;border-spacing:2px}.components-datetime__date .CalendarDay{font-size:13px;border:none;border-radius:50%;text-align:center}.components-datetime__date .CalendarDay:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff;outline:2px solid transparent}.components-datetime__date .CalendarDay__selected{background:var(--wp-admin-theme-color);border:2px solid transparent}.components-datetime__date .CalendarDay__selected:hover{background:var(--wp-admin-theme-color-darker-20)}.components-datetime__date .CalendarDay__selected:focus{box-shadow:inset 0 0 0 1px #fff}.components-datetime__date .DayPickerNavigation_button__horizontalDefault{padding:2px 8px;top:20px}.components-datetime__date .DayPickerNavigation_button__horizontalDefault:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-datetime__date .DayPicker_weekHeader{top:50px}.components-datetime__date .DayPicker_weekHeader .DayPicker_weekHeader_ul{margin:1px;padding-right:0;padding-left:0}.components-datetime__date.is-description-visible .DayPicker{visibility:hidden}.components-datetime__date .CalendarDay .components-datetime__date__day{height:100%;display:flex;justify-content:center;align-content:center;flex-direction:column;position:relative}.components-datetime__date .CalendarDay .components-datetime__date__day.has-events:before{content:" ";width:4px;height:4px;border-radius:2px;position:absolute;right:50%;margin-right:-2px;bottom:0;background-color:#fff}.components-datetime__date .CalendarDay:not(.CalendarDay__selected) .components-datetime__date__day.has-events:before{background:var(--wp-admin-theme-color)}.components-datetime__time{padding-bottom:16px}.components-datetime__time fieldset{position:relative;margin-bottom:.5em}.components-datetime__time fieldset+fieldset{margin-bottom:0}.components-datetime__time .components-datetime__time-field-am-pm fieldset{margin-top:0}.components-datetime__time .components-datetime__time-wrapper{display:flex}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-separator{display:inline-block;padding:0 0 0 3px}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field-time{direction:ltr}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select{margin-left:4px}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select:focus{position:relative;z-index:1}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]{padding:2px;margin-left:4px;text-align:center;-moz-appearance:textfield}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]:focus{position:relative;z-index:1}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.components-datetime__time.is-12-hour .components-datetime__time-field-day input{margin:-4px 0 0!important;border-radius:0 2px 2px 0!important}.components-datetime__time.is-12-hour .components-datetime__time-field-year input{border-radius:2px 0 0 2px!important}.components-datetime__timezone{line-height:30px;margin-right:4px;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.components-datetime__time-legend{font-weight:600;margin-top:.5em}.components-datetime__time-legend.invisible{position:absolute;top:-999em;right:-999em}.components-datetime__time-field-integer-field{font-family:inherit}.components-datetime__time-field-day-input,.components-datetime__time-field-hours-input,.components-datetime__time-field-minutes-input{width:35px}.components-datetime__time-field-year-input{width:55px}.components-datetime__time-field-month-select{max-width:145px}.components-popover .components-datetime__date{padding-right:4px}.block-editor-dimension-control .components-base-control__field{display:flex;align-items:center}.block-editor-dimension-control .components-base-control__label{display:flex;align-items:center;margin-left:1em;margin-bottom:0}.block-editor-dimension-control .components-base-control__label .dashicon{margin-left:.5em}.block-editor-dimension-control.is-manual .components-base-control__label{width:10em}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}.components-draggable__invisible-drag-image{position:fixed;right:-1000px;height:50px;width:50px}.components-draggable__clone{position:fixed;padding:0;background:transparent;pointer-events:none;z-index:1000000000}.components-drop-zone{position:absolute;top:0;left:0;bottom:0;right:0;z-index:40;visibility:hidden;opacity:0;border-radius:2px}.components-drop-zone.is-active{opacity:1;visibility:visible}.components-drop-zone__content{position:absolute;top:0;bottom:0;right:0;left:0;height:100%;width:100%;display:flex;background-color:var(--wp-admin-theme-color);align-items:center;justify-content:center;z-index:50;text-align:center;color:#fff}.components-drop-zone__content-icon,.components-drop-zone__content-text{display:block}.components-drop-zone__content-icon{margin:0 auto;line-height:0;fill:currentColor;pointer-events:none}.components-drop-zone__content-text{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-dropdown{display:inline-block}.components-dropdown__content .components-popover__content>div{padding:8px}.components-dropdown__content [role=menuitem]{white-space:nowrap}.components-dropdown-menu__menu{width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:1.4}.components-dropdown-menu__menu .components-dropdown-menu__menu-item,.components-dropdown-menu__menu .components-menu-item{width:100%;padding:6px;outline:none;cursor:pointer;white-space:nowrap}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator,.components-dropdown-menu__menu .components-menu-item.has-separator{margin-top:6px;position:relative;overflow:visible}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator:before,.components-dropdown-menu__menu .components-menu-item.has-separator:before{display:block;content:"";box-sizing:content-box;background-color:#ddd;position:absolute;top:-3px;right:0;left:0;height:1px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg,.components-dropdown-menu__menu .components-menu-item.is-active svg{color:#fff;background:#1e1e1e;box-shadow:0 0 0 1px #1e1e1e;border-radius:1px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item>svg,.components-dropdown-menu__menu .components-menu-item>svg{border-radius:2px;width:24px;height:24px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only,.components-dropdown-menu__menu .components-menu-item.is-icon-only{width:auto}.components-dropdown-menu__menu .components-menu-item__button,.components-dropdown-menu__menu .components-menu-item__button.components-button{min-height:36px;height:auto;text-align:right;padding-right:8px;padding-left:8px}.components-dropdown-menu__menu .components-menu-group{padding:8px;margin:0 -8px}.components-dropdown-menu__menu .components-menu-group:first-child{margin-top:-8px}.components-dropdown-menu__menu .components-menu-group:last-child{margin-bottom:-8px}.components-dropdown-menu__menu .components-menu-group+.components-menu-group{margin-top:0;border-top:1px solid #ccc;padding:8px}.is-alternate .components-dropdown-menu__menu .components-menu-group+.components-menu-group{border-color:#1e1e1e}.components-font-size-picker__header__hint{margin-right:4px;color:#757575}.components-font-size-picker__header .components-button.is-small.has-icon:not(.has-text){min-width:24px;padding:0}.components-font-size-picker__controls{max-width:248px;align-items:center;margin-top:8px;margin-bottom:24px}.components-font-size-picker__controls .components-unit-control-wrapper .components-input-control__label{font-weight:300;padding-bottom:0!important;margin-bottom:8px!important}.components-font-size-picker__controls .components-custom-select-control__button{width:100%}.components-font-size-picker__controls .components-font-size-picker__number{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:inline-block;font-weight:500;height:30px;margin:8px 0 0 8px;width:54px}@media (prefers-reduced-motion:reduce){.components-font-size-picker__controls .components-font-size-picker__number{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-font-size-picker__controls .components-font-size-picker__number{font-size:13px;line-height:normal}}.components-font-size-picker__controls .components-font-size-picker__number:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-font-size-picker__controls .components-font-size-picker__number::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number[value=""]+.components-button{cursor:default;opacity:.3;pointer-events:none}.components-font-size-picker__controls .components-font-size-picker__number-container{display:flex;flex-direction:column}.components-font-size-picker__controls .components-color-palette__clear{height:30px}.components-font-size-picker__custom-input .components-range-control__slider+.dashicon{width:30px;height:30px}.components-font-size-picker{border:0;padding:0;margin:0}.components-form-toggle{position:relative;display:inline-block}.components-form-toggle .components-form-toggle__track{content:"";display:inline-block;box-sizing:border-box;vertical-align:top;background-color:#fff;border:1px solid #1e1e1e;width:36px;height:18px;border-radius:9px;transition:background .2s ease}@media (prefers-reduced-motion:reduce){.components-form-toggle .components-form-toggle__track{transition-duration:0s;transition-delay:0s}}.components-form-toggle .components-form-toggle__thumb{display:block;position:absolute;box-sizing:border-box;top:3px;right:3px;width:12px;height:12px;border-radius:50%;transition:transform .1s ease;background-color:#1e1e1e;border:5px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.components-form-toggle .components-form-toggle__thumb{transition-duration:0s;transition-delay:0s}}.components-form-toggle.is-checked .components-form-toggle__track{background-color:var(--wp-admin-theme-color);border:9px solid transparent}.components-form-toggle .components-form-toggle__input:focus+.components-form-toggle__track{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:2px}.components-form-toggle.is-checked .components-form-toggle__thumb{background-color:#fff;border-width:0;transform:translateX(-18px)}.components-disabled .components-form-toggle,.components-form-toggle.is-disabled{opacity:.3}.components-form-toggle input.components-form-toggle__input[type=checkbox]{position:absolute;top:0;right:0;width:100%;height:100%;opacity:0;margin:0;padding:0;z-index:1;border:none}.components-form-toggle input.components-form-toggle__input[type=checkbox]:checked{background:none}.components-form-toggle input.components-form-toggle__input[type=checkbox]:before{content:""}.components-form-token-field__input-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:flex;flex-wrap:wrap;align-items:center;width:100%;margin:0 0 8px;padding:2px 4px;cursor:text}@media (prefers-reduced-motion:reduce){.components-form-token-field__input-container{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-form-token-field__input-container{font-size:13px;line-height:normal}}.components-form-token-field__input-container:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-form-token-field__input-container::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-form-token-field__input-container::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-form-token-field__input-container:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-form-token-field__input-container.is-disabled{background:#ddd;border-color:#ddd}.components-form-token-field__input-container.is-active{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-form-token-field__input-container input[type=text].components-form-token-field__input{display:inline-block;flex:1;font-family:inherit;font-size:16px;width:100%;max-width:100%;margin-right:4px;padding:0;min-height:24px;min-width:50px;background:inherit;border:0;color:#1e1e1e;box-shadow:none}@media (min-width:600px){.components-form-token-field__input-container input[type=text].components-form-token-field__input{font-size:13px}}.components-form-token-field.is-active .components-form-token-field__input-container input[type=text].components-form-token-field__input,.components-form-token-field__input-container input[type=text].components-form-token-field__input:focus{outline:none;box-shadow:none}.components-form-token-field__input-container .components-form-token-field__token+input[type=text].components-form-token-field__input{width:auto}.components-form-token-field__label{display:inline-block;margin-bottom:8px}.components-form-token-field__help{font-size:12px;font-style:normal;color:#757575}.components-form-token-field__token{font-size:13px;display:flex;margin:2px 0 2px 4px;color:#1e1e1e;max-width:100%}.components-form-token-field__token.is-success .components-form-token-field__remove-token,.components-form-token-field__token.is-success .components-form-token-field__token-text{background:#4ab866}.components-form-token-field__token.is-error .components-form-token-field__remove-token,.components-form-token-field__token.is-error .components-form-token-field__token-text{background:#cc1818}.components-form-token-field__token.is-validating .components-form-token-field__remove-token,.components-form-token-field__token.is-validating .components-form-token-field__token-text{color:#757575}.components-form-token-field__token.is-borderless{position:relative;padding:0 0 0 16px}.components-form-token-field__token.is-borderless .components-form-token-field__token-text{background:transparent;color:var(--wp-admin-theme-color)}.components-form-token-field__token.is-borderless .components-form-token-field__remove-token{background:transparent;color:#757575;position:absolute;top:1px;left:0}.components-form-token-field__token.is-borderless.is-success .components-form-token-field__token-text{color:#4ab866}.components-form-token-field__token.is-borderless.is-error .components-form-token-field__token-text{color:#cc1818;border-radius:0 4px 4px 0;padding:0 6px 0 4px}.components-form-token-field__token.is-borderless.is-validating .components-form-token-field__token-text{color:#1e1e1e}.components-form-token-field__token.is-disabled .components-form-token-field__remove-token{cursor:default}.components-form-token-field__remove-token.components-button,.components-form-token-field__token-text{display:inline-block;line-height:24px;height:auto;background:#ddd;min-width:unset;transition:all .2s cubic-bezier(.4,1,.4,1)}@media (prefers-reduced-motion:reduce){.components-form-token-field__remove-token.components-button,.components-form-token-field__token-text{transition-duration:0s;transition-delay:0s;animation-duration:1ms;animation-delay:0s}}.components-form-token-field__token-text{border-radius:0 2px 2px 0;padding:0 8px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.components-form-token-field__remove-token.components-button{cursor:pointer;border-radius:2px 0 0 2px;padding:0 2px;color:#1e1e1e;line-height:10px;overflow:initial}.components-form-token-field__remove-token.components-button:hover{color:#1e1e1e}.components-form-token-field__suggestions-list{flex:1 0 100%;min-width:100%;max-height:9em;overflow-y:auto;transition:all .15s ease-in-out;list-style:none;border-top:1px solid #757575;margin:4px -4px -4px;padding:0}@media (prefers-reduced-motion:reduce){.components-form-token-field__suggestions-list{transition-duration:0s;transition-delay:0s}}.components-form-token-field__suggestion{color:#757575;display:block;font-size:13px;padding:4px 8px;margin:0;cursor:pointer}.components-form-token-field__suggestion.is-selected{background:var(--wp-admin-theme-color);color:#fff}.components-form-token-field__suggestion-match{text-decoration:underline}@media (min-width:600px){.components-guide{width:600px}}.components-guide .components-modal__content{padding:0;margin-top:0;border-radius:2px}.components-guide .components-modal__content:before{content:none}.components-guide .components-modal__header{border-bottom:none;padding:0;position:sticky}.components-guide .components-modal__header .components-button{align-self:flex-start;margin:8px 0 0 8px;position:static}.components-guide .components-modal__header .components-button:hover svg{fill:#fff}.components-guide__container{display:flex;flex-direction:column;justify-content:space-between;margin-top:-60px;min-height:100%}.components-guide__page{display:flex;flex-direction:column;justify-content:center;position:relative}@media (min-width:600px){.components-guide__page{min-height:300px}}.components-guide__footer{align-content:center;display:flex;height:30px;justify-content:center;margin:0 0 24px;padding:0 32px;position:relative;width:100%}.components-guide__page-control{margin:0;text-align:center}.components-guide__page-control li{display:inline-block;margin:0}.components-guide__page-control .components-button{height:30px;min-width:20px;margin:-6px 0}.components-modal__frame.components-guide{border:none;min-width:312px;height:80vh;max-height:575px}@media (max-width:600px){.components-modal__frame.components-guide{margin:auto;max-width:calc(100vw - 32px)}}.components-button.components-guide__back-button,.components-button.components-guide__finish-button,.components-button.components-guide__forward-button{height:30px;position:absolute}.components-button.components-guide__back-button,.components-button.components-guide__forward-button{font-size:13px;padding:4px 2px}.components-button.components-guide__back-button.has-text svg,.components-button.components-guide__forward-button.has-text svg{margin:0}.components-button.components-guide__back-button:hover,.components-button.components-guide__forward-button:hover{text-decoration:underline}.components-button.components-guide__back-button{right:32px}.components-button.components-guide__forward-button{left:32px;color:#1386bf;font-weight:700}.components-button.components-guide__finish-button{left:32px}[role=region]{position:relative}.is-focusing-regions [role=region]:focus:after{content:"";position:absolute;top:0;bottom:0;right:0;left:0;pointer-events:none;outline:4px solid transparent;box-shadow:inset 0 0 0 4px var(--wp-admin-theme-color)}@supports (outline-offset:1px){.is-focusing-regions [role=region]:focus:after{content:none}.is-focusing-regions [role=region]:focus{outline-style:solid;outline-color:var(--wp-admin-theme-color);outline-width:4px;outline-offset:-4px}}.components-menu-group+.components-menu-group{margin-top:8px;padding-top:8px;border-top:1px solid #1e1e1e}.components-menu-group+.components-menu-group.has-hidden-separator{border-top:none;margin-top:0;padding-top:0}.components-menu-group__label{padding:0 8px;margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;white-space:nowrap}.components-menu-item__button,.components-menu-item__button.components-button{width:100%}.components-menu-item__button.components-button[role=menuitemcheckbox] .components-menu-item__item:only-child,.components-menu-item__button.components-button[role=menuitemradio] .components-menu-item__item:only-child,.components-menu-item__button[role=menuitemcheckbox] .components-menu-item__item:only-child,.components-menu-item__button[role=menuitemradio] .components-menu-item__item:only-child{padding-left:48px}.components-menu-item__button.components-button .components-menu-items__item-icon,.components-menu-item__button .components-menu-items__item-icon{display:inline-block;flex:0 0 auto}.components-menu-item__button.components-button .components-menu-items__item-icon.has-icon-right,.components-menu-item__button .components-menu-items__item-icon.has-icon-right{margin-left:-2px;margin-right:24px}.components-menu-item__button.components-button .components-menu-item__shortcut+.components-menu-items__item-icon.has-icon-right,.components-menu-item__button .components-menu-item__shortcut+.components-menu-items__item-icon.has-icon-right{margin-right:8px}.components-menu-item__button .block-editor-block-icon,.components-menu-item__button.components-button .block-editor-block-icon{margin-right:-2px;margin-left:8px}.components-menu-item__button.components-button.is-primary,.components-menu-item__button.is-primary{justify-content:center}.components-menu-item__button.components-button.is-primary .components-menu-item__item,.components-menu-item__button.is-primary .components-menu-item__item{margin-left:0}.components-menu-item__info-wrapper{display:flex;flex-direction:column;margin-left:auto}.components-menu-item__info{margin-top:4px;font-size:12px;color:#757575;white-space:normal}.components-menu-item__item{white-space:nowrap;min-width:160px;margin-left:auto;display:inline-flex;align-items:center}.components-menu-item__shortcut{align-self:center;margin-left:0;margin-right:auto;padding-right:24px;color:currentColor;display:none}@media (min-width:480px){.components-menu-item__shortcut{display:inline}}.components-menu-items-choice.components-button svg,.components-menu-items-choice svg{margin-left:12px}.components-menu-items-choice.components-button.has-icon,.components-menu-items-choice.has-icon{padding-right:12px}.components-modal__screen-overlay{position:fixed;top:0;left:0;bottom:0;right:0;background-color:rgba(0,0,0,.35);z-index:100000;display:flex;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-modal__screen-overlay{animation-duration:1ms;animation-delay:0s}}.components-modal__frame{margin:0;width:100%;background:#fff;box-shadow:0 10px 10px rgba(0,0,0,.25);border-radius:2px;overflow:hidden;display:flex}@media (min-width:600px){.components-modal__frame{margin:auto;width:auto;min-width:360px;max-width:calc(100% - 32px);max-height:calc(100% - 120px);animation:components-modal__appear-animation .1s ease-out;animation-fill-mode:forwards}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.components-modal__frame{animation-duration:1ms;animation-delay:0s}}@media (min-width:600px){.components-modal__frame.is-full-screen{width:90vw;min-height:90vh}}@media (min-width:960px){.components-modal__frame{max-height:70%}}@keyframes components-modal__appear-animation{0%{transform:translateY(32px)}to{transform:translateY(0)}}.components-modal__header{box-sizing:border-box;border-bottom:1px solid #ddd;padding:0 32px;display:flex;flex-direction:row;justify-content:space-between;align-items:center;height:60px;width:100%;z-index:10;position:absolute;top:0;right:0}.components-modal__header .components-modal__header-heading{font-size:1rem;font-weight:600}.components-modal__header h1{line-height:1;margin:0}.components-modal__header .components-button{position:relative;right:8px}.components-modal__header-heading-container{align-items:center;flex-grow:1;display:flex;flex-direction:row;justify-content:left}.components-modal__header-icon-container{display:inline-block}.components-modal__header-icon-container svg{max-width:36px;max-height:36px;padding:8px}.components-modal__content{flex:1;margin-top:60px;padding:0 32px 24px;overflow:auto}.components-modal__content:before{content:"";display:block;margin-bottom:24px}.components-modal__content.hide-header{margin-top:0;padding-top:24px}.components-modal__content.hide-header:before{content:none}.components-notice{display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;background-color:#fff;border-right:4px solid var(--wp-admin-theme-color);margin:5px 15px 2px;padding:8px 12px;align-items:center}.components-notice.is-dismissible{padding-left:36px;position:relative}.components-notice.is-success{border-right-color:#4ab866;background-color:#eff9f1}.components-notice.is-warning{border-right-color:#f0b849;background-color:#fef8ee}.components-notice.is-error{border-right-color:#cc1818;background-color:#f4a2a2}.components-notice__content{flex-grow:1;margin:4px 0 4px 25px}.components-notice__actions{display:flex;flex-wrap:wrap}.components-notice__action.components-button{margin-left:8px}.components-notice__action.components-button,.components-notice__action.components-button.is-link{margin-right:12px}.components-notice__action.components-button.is-secondary{vertical-align:initial}.components-notice__dismiss{color:#757575;align-self:flex-start;flex-shrink:0}.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus,.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active,.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{color:#1e1e1e;background-color:transparent}.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{box-shadow:none}.components-notice-list{max-width:100vw;box-sizing:border-box}.components-notice-list .components-notice__content{margin-top:12px;margin-bottom:12px;line-height:2}.components-notice-list .components-notice__action.components-button{display:block;margin-right:0;margin-top:8px}.components-panel{background:#fff;border:1px solid #e0e0e0}.components-panel>.components-panel__body:first-child,.components-panel>.components-panel__header:first-child{margin-top:-1px}.components-panel>.components-panel__body:last-child,.components-panel>.components-panel__header:last-child{border-bottom-width:0}.components-panel+.components-panel{margin-top:-1px}.components-panel__body{border-top:1px solid #e0e0e0;border-bottom:1px solid #e0e0e0}.components-panel__body h3{margin:0 0 .5em}.components-panel__body.is-opened{padding:16px}.components-panel__header{display:flex;justify-content:space-between;align-items:center;padding:0 16px;height:48px;border-bottom:1px solid #ddd}.components-panel__header h2{margin:0;font-size:inherit;color:inherit}.components-panel__body+.components-panel__body,.components-panel__body+.components-panel__header,.components-panel__header+.components-panel__body,.components-panel__header+.components-panel__header{margin-top:-1px}.components-panel__body>.components-panel__body-title{display:block;padding:0;font-size:inherit;margin-top:0;margin-bottom:0;transition:background .1s ease-in-out}@media (prefers-reduced-motion:reduce){.components-panel__body>.components-panel__body-title{transition-duration:0s;transition-delay:0s}}.components-panel__body.is-opened>.components-panel__body-title{margin:-16px -16px 5px}.components-panel__body>.components-panel__body-title:hover{background:#f0f0f0;border:none}.components-panel__body-toggle.components-button{position:relative;padding:16px 16px 16px 48px;outline:none;width:100%;font-weight:500;text-align:right;color:#1e1e1e;border:none;box-shadow:none;transition:background .1s ease-in-out;height:auto}@media (prefers-reduced-motion:reduce){.components-panel__body-toggle.components-button{transition-duration:0s;transition-delay:0s}}.components-panel__body-toggle.components-button:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:0}.components-panel__body-toggle.components-button .components-panel__arrow{position:absolute;left:16px;top:50%;transform:translateY(-50%);color:#1e1e1e;fill:currentColor;transition:color .1s ease-in-out}@media (prefers-reduced-motion:reduce){.components-panel__body-toggle.components-button .components-panel__arrow{transition-duration:0s;transition-delay:0s}}body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right{transform:scaleX(-1);-ms-filter:fliph;filter:FlipH;margin-top:-10px}.components-panel__icon{color:#757575;margin:-2px 6px -2px 0}.components-panel__body-toggle-icon{margin-left:-5px}.components-panel__color-title{float:right;height:19px}.components-panel__row{display:flex;justify-content:space-between;align-items:center;margin-top:8px;min-height:36px}.components-panel__row select{min-width:0}.components-panel__row label{margin-left:12px;flex-shrink:0;max-width:75%}.components-panel__row:empty,.components-panel__row:first-of-type{margin-top:0}.components-panel .circle-picker{padding-bottom:20px}.components-placeholder.components-placeholder{box-sizing:border-box;position:relative;padding:1em;min-height:200px;width:100%;text-align:right;margin:0;color:#1e1e1e;-moz-font-smoothing:subpixel-antialiased;-webkit-font-smoothing:subpixel-antialiased;border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;outline:1px solid transparent}@supports (position:sticky){.components-placeholder.components-placeholder{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}}.components-placeholder.components-placeholder .components-base-control__label{font-size:13px}.components-placeholder__error,.components-placeholder__fieldset,.components-placeholder__instructions,.components-placeholder__label{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-placeholder__label{display:flex;font-weight:600;margin-bottom:16px;align-items:center}.components-placeholder__label .block-editor-block-icon,.components-placeholder__label .dashicon,.components-placeholder__label>svg{margin-left:1ch;fill:currentColor}@media (forced-colors:active){.components-placeholder__label .block-editor-block-icon,.components-placeholder__label .dashicon,.components-placeholder__label>svg{fill:CanvasText}}.components-placeholder__label:empty{display:none}.components-placeholder__fieldset,.components-placeholder__fieldset form{display:flex;flex-direction:row;width:100%;flex-wrap:wrap}.components-placeholder__fieldset form p,.components-placeholder__fieldset p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-placeholder__fieldset.components-placeholder__fieldset{border:none;padding:0}.components-placeholder__fieldset.components-placeholder__fieldset .components-placeholder__instructions{padding:0;font-weight:400;font-size:1em}.components-placeholder__fieldset.is-column-layout,.components-placeholder__fieldset.is-column-layout form{flex-direction:column}.components-placeholder__input[type=url]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;margin:0 0 0 8px;flex:1 1 auto}@media (prefers-reduced-motion:reduce){.components-placeholder__input[type=url]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-placeholder__input[type=url]{font-size:13px;line-height:normal}}.components-placeholder__input[type=url]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-placeholder__input[type=url]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-placeholder__input[type=url]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-placeholder__input[type=url]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-placeholder__instructions{margin-bottom:1em}.components-placeholder__error{margin-top:1em;width:100%}.components-placeholder__preview img{margin:3%;width:50%}.components-placeholder__fieldset .components-button{margin-left:12px;margin-bottom:12px}.components-placeholder__fieldset .components-button:last-child{margin-bottom:0;margin-left:0}.components-placeholder__fieldset .components-button:not(.is-link)~.components-button.is-link{margin-right:10px;margin-left:10px}.components-placeholder__fieldset .components-button:not(.is-link)~.components-button.is-link:last-child{margin-left:0}.components-placeholder.is-large .components-placeholder__label{font-size:18pt;font-weight:400}.components-placeholder.is-medium .components-placeholder__instructions,.components-placeholder.is-small .components-placeholder__instructions{display:none}.components-placeholder.is-medium .components-placeholder__fieldset,.components-placeholder.is-medium .components-placeholder__fieldset form,.components-placeholder.is-small .components-placeholder__fieldset,.components-placeholder.is-small .components-placeholder__fieldset form{flex-direction:column}.components-placeholder.is-medium .components-placeholder__fieldset .components-button,.components-placeholder.is-small .components-placeholder__fieldset .components-button{margin-left:auto}.components-placeholder.is-small .components-button{padding:0 8px 2px}.components-popover{position:fixed;z-index:1000000;top:0;left:0;opacity:0}.components-popover.is-expanded,.components-popover[data-x-axis][data-y-axis]{opacity:1}.components-popover.is-expanded{top:0;left:0;right:0;bottom:0;z-index:1000000!important}.components-popover:not(.is-without-arrow){margin-left:2px}.components-popover:not(.is-without-arrow):before{border:8px solid #ccc}.components-popover:not(.is-without-arrow).is-alternate:before{border-color:#1e1e1e}.components-popover:not(.is-without-arrow):after{border:8px solid #fff}.components-popover:not(.is-without-arrow):after,.components-popover:not(.is-without-arrow):before{content:"";position:absolute;height:0;width:0;line-height:0}.components-popover:not(.is-without-arrow)[data-y-axis=top]{margin-top:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:before{bottom:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:after{bottom:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:after,.components-popover:not(.is-without-arrow)[data-y-axis=top]:before{border-bottom:none;border-left-color:transparent;border-right-color:transparent;border-top-style:solid;margin-left:-10px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]{margin-top:8px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:before{top:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:after{top:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:after,.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:before{border-bottom-style:solid;border-left-color:transparent;border-right-color:transparent;border-top:none;margin-left:-10px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]{margin-left:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:before{right:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:after{right:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:after,.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:before{border-bottom-color:transparent;border-left-style:solid;border-right:none;border-top-color:transparent}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]{margin-left:8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:before{left:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:after{left:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:after,.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:before{border-bottom-color:transparent;border-left:none;border-right-style:solid;border-top-color:transparent}.components-popover[data-y-axis=top]{bottom:100%}.components-popover[data-y-axis=bottom]{top:100%}.components-popover[data-y-axis=middle]{align-items:center;display:flex}.components-popover.is-from-top{margin-top:12px}.components-popover.is-from-bottom{margin-top:-12px}.components-popover.is-from-left:not(.is-from-top):not(.is-from-bottom){margin-left:12px}.components-popover.is-from-right:not(.is-from-top):not(.is-from-bottom){margin-right:12px}.components-popover__content{height:100%;background:#fff;border:1px solid #ccc;box-shadow:0 2px 6px rgba(0,0,0,.05);border-radius:2px}.is-alternate .components-popover__content{border:1px solid #1e1e1e;box-shadow:none}.components-popover .components-popover__content{position:absolute;height:auto;overflow-y:auto}.components-popover.is-expanded .components-popover__content{position:static;height:calc(100% - 48px);overflow-y:visible;min-width:auto;border:none;border-top:1px solid #1e1e1e}.components-popover[data-y-axis=top] .components-popover__content{bottom:100%}.components-popover[data-x-axis=center] .components-popover__content{left:50%;transform:translateX(-50%)}.components-popover[data-x-axis=right] .components-popover__content{position:absolute;left:100%}.components-popover:not([data-y-axis=middle])[data-x-axis=right] .components-popover__content{margin-left:-25px}.components-popover[data-x-axis=left] .components-popover__content{position:absolute;right:100%}.components-popover:not([data-y-axis=middle])[data-x-axis=left] .components-popover__content{margin-right:-25px}.components-popover__header{align-items:center;background:#fff;display:flex;height:48px;justify-content:space-between;padding:0 8px 0 16px}.components-popover__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.components-popover__close.components-button{z-index:5}.components-radio-control{display:flex;flex-direction:column}.components-radio-control .components-base-control__help{margin-top:0}.components-radio-control .components-base-control__field{margin-bottom:0}.components-radio-control__option:not(:last-child){margin-bottom:4px}.components-radio-control__input[type=radio]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;font-size:16px;line-height:normal;border:1px solid #1e1e1e;transition:none;border-radius:50%;width:24px;height:24px;margin-top:0;margin-left:6px}@media (prefers-reduced-motion:reduce){.components-radio-control__input[type=radio]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-radio-control__input[type=radio]{font-size:13px;line-height:normal}}.components-radio-control__input[type=radio]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-radio-control__input[type=radio]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-radio-control__input[type=radio]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-radio-control__input[type=radio]:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.components-radio-control__input[type=radio]{height:20px;width:20px}}.components-radio-control__input[type=radio]:checked:before{box-sizing:inherit;width:8px;height:8px;transform:translate(-7px,7px);margin:0;background-color:#fff;border:4px solid #fff}@media (min-width:600px){.components-radio-control__input[type=radio]:checked:before{transform:translate(-5px,5px)}}.components-radio-control__input[type=radio]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.components-radio-control__input[type=radio]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-resizable-box__handle{display:none;width:23px;height:23px;z-index:2}.components-resizable-box__container.has-show-handle .components-resizable-box__handle{display:block}.components-resizable-box__container>img{width:inherit}.components-resizable-box__handle:after{display:block;content:"";width:15px;height:15px;border-radius:50%;background:#fff;cursor:inherit;position:absolute;top:calc(50% - 8px);left:calc(50% - 8px);box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.components-resizable-box__side-handle:before{display:block;border-radius:2px;content:"";width:3px;height:3px;background:var(--wp-admin-theme-color);cursor:inherit;position:absolute;top:calc(50% - 1px);left:calc(50% - 1px);transition:transform .1s ease-in;opacity:0}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle:before{transition-duration:0s;transition-delay:0s}}.components-resizable-box__corner-handle,.components-resizable-box__side-handle{z-index:2}.components-resizable-box__side-handle.components-resizable-box__handle-bottom,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:before,.components-resizable-box__side-handle.components-resizable-box__handle-top,.components-resizable-box__side-handle.components-resizable-box__handle-top:before{width:100%;right:0;border-right:0;border-left:0}.components-resizable-box__side-handle.components-resizable-box__handle-left,.components-resizable-box__side-handle.components-resizable-box__handle-left:before,.components-resizable-box__side-handle.components-resizable-box__handle-right,.components-resizable-box__side-handle.components-resizable-box__handle-right:before{height:100%;top:0;border-top:0;border-bottom:0}.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation:components-resizable-box__top-bottom-animation .1s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation-duration:1ms;animation-delay:0s}}.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before{animation:components-resizable-box__left-right-animation .1s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before{animation-duration:1ms;animation-delay:0s}}@media not all and (-webkit-min-device-pixel-ratio:0),not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none){.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation:none}}}@keyframes components-resizable-box__top-bottom-animation{0%{transform:scaleX(0);opacity:0}to{transform:scaleX(1);opacity:1}}@keyframes components-resizable-box__left-right-animation{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.components-resizable-box__handle-right{right:-11.5px}.components-resizable-box__handle-left{left:-11.5px}.components-resizable-box__handle-top{top:-11.5px}.components-resizable-box__handle-bottom{bottom:-11.5px}.components-responsive-wrapper{position:relative;max-width:100%}.components-responsive-wrapper,.components-responsive-wrapper>span{display:block}.components-responsive-wrapper__content{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;margin:auto}.components-sandbox{overflow:hidden}iframe.components-sandbox{width:100%}body.lockscroll,html.lockscroll{overflow:hidden}.components-search-control{position:relative}.components-search-control input[type=search].components-search-control__input{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;line-height:normal;display:block;padding:16px 16px 16px 48px;background:#f0f0f0;border:none;width:100%;height:48px;font-size:16px}@media (prefers-reduced-motion:reduce){.components-search-control input[type=search].components-search-control__input{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-search-control input[type=search].components-search-control__input{font-size:13px;line-height:normal}}.components-search-control input[type=search].components-search-control__input:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-search-control input[type=search].components-search-control__input::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-search-control input[type=search].components-search-control__input::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-search-control input[type=search].components-search-control__input:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.components-search-control input[type=search].components-search-control__input{font-size:13px}}.components-search-control input[type=search].components-search-control__input:focus{background:#fff;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-search-control input[type=search].components-search-control__input::placeholder{color:#757575}.components-search-control input[type=search].components-search-control__input::-webkit-search-cancel-button,.components-search-control input[type=search].components-search-control__input::-webkit-search-decoration,.components-search-control input[type=search].components-search-control__input::-webkit-search-results-button,.components-search-control input[type=search].components-search-control__input::-webkit-search-results-decoration{-webkit-appearance:none}.components-search-control__icon{position:absolute;top:0;left:12px;bottom:0;display:flex;align-items:center}.components-search-control__icon>svg{margin:8px 0}.components-search-control__input-wrapper{position:relative}.components-select-control__input{background:#fff;height:36px;line-height:36px;margin:1px;outline:0;width:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)!important}@media (min-width:782px){.components-select-control__input{height:28px;line-height:28px}}@media (max-width:782px){.components-base-control .components-base-control__field .components-select-control__input{font-size:16px}}.components-snackbar{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;background-color:#1e1e1e;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.3);color:#fff;padding:16px 24px;width:100%;max-width:600px;box-sizing:border-box;cursor:pointer;pointer-events:auto}@media (min-width:600px){.components-snackbar{width:-moz-fit-content;width:fit-content}}.components-snackbar:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color)}.components-snackbar.components-snackbar-explicit-dismiss{cursor:default}.components-snackbar .components-snackbar__content-with-icon{margin-right:24px}.components-snackbar .components-snackbar__icon{position:absolute;top:24px;right:28px}.components-snackbar .components-snackbar__dismiss-button{margin-right:32px;cursor:pointer}.components-snackbar__action.components-button{margin-right:32px;color:#fff;height:auto;flex-shrink:0;line-height:1.4;padding:0}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary){text-decoration:underline;background-color:transparent}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):focus{color:#fff;box-shadow:none;outline:1px dotted #fff}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{color:var(--wp-admin-theme-color)}.components-snackbar__content{display:flex;align-items:baseline;justify-content:space-between;line-height:1.4}.components-snackbar-list{position:absolute;z-index:100000;width:100%;box-sizing:border-box;pointer-events:none}.components-snackbar-list__notice-container{position:relative;padding-top:8px}.components-swatch{width:18px;height:18px;border-radius:50%;color:transparent;background:transparent}.components-swatch:after{content:"";display:block;width:100%;height:100%;border:1px solid rgba(0,0,0,.2);border-radius:50%}.components-button.has-icon.has-text .components-swatch{margin-left:8px}.components-tab-panel__tabs{display:flex;align-items:stretch;flex-direction:row}.components-tab-panel__tabs[aria-orientation=vertical]{flex-direction:column}.components-tab-panel__tabs-item{background:transparent;border:none;box-shadow:none;border-radius:0;cursor:pointer;height:48px;padding:3px 16px;margin-right:0;font-weight:500;transition:box-shadow .1s linear;box-sizing:border-box}.components-tab-panel__tabs-item:after{content:attr(data-label);display:block;height:0;overflow:hidden;speak:none;visibility:hidden}.components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-tab-panel__tabs-item.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative}.components-tab-panel__tabs-item.is-active:before{content:"";position:absolute;top:0;bottom:1px;left:0;right:0;border-bottom:4px solid transparent}.components-tab-panel__tabs-item:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-tab-panel__tabs-item.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{font-size:13px;line-height:normal}}.components-text-control__input:focus,.components-text-control__input[type=color]:focus,.components-text-control__input[type=date]:focus,.components-text-control__input[type=datetime-local]:focus,.components-text-control__input[type=datetime]:focus,.components-text-control__input[type=email]:focus,.components-text-control__input[type=month]:focus,.components-text-control__input[type=number]:focus,.components-text-control__input[type=password]:focus,.components-text-control__input[type=tel]:focus,.components-text-control__input[type=text]:focus,.components-text-control__input[type=time]:focus,.components-text-control__input[type=url]:focus,.components-text-control__input[type=week]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-text-control__input::-webkit-input-placeholder,.components-text-control__input[type=color]::-webkit-input-placeholder,.components-text-control__input[type=date]::-webkit-input-placeholder,.components-text-control__input[type=datetime-local]::-webkit-input-placeholder,.components-text-control__input[type=datetime]::-webkit-input-placeholder,.components-text-control__input[type=email]::-webkit-input-placeholder,.components-text-control__input[type=month]::-webkit-input-placeholder,.components-text-control__input[type=number]::-webkit-input-placeholder,.components-text-control__input[type=password]::-webkit-input-placeholder,.components-text-control__input[type=tel]::-webkit-input-placeholder,.components-text-control__input[type=text]::-webkit-input-placeholder,.components-text-control__input[type=time]::-webkit-input-placeholder,.components-text-control__input[type=url]::-webkit-input-placeholder,.components-text-control__input[type=week]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-text-control__input::-moz-placeholder,.components-text-control__input[type=color]::-moz-placeholder,.components-text-control__input[type=date]::-moz-placeholder,.components-text-control__input[type=datetime-local]::-moz-placeholder,.components-text-control__input[type=datetime]::-moz-placeholder,.components-text-control__input[type=email]::-moz-placeholder,.components-text-control__input[type=month]::-moz-placeholder,.components-text-control__input[type=number]::-moz-placeholder,.components-text-control__input[type=password]::-moz-placeholder,.components-text-control__input[type=tel]::-moz-placeholder,.components-text-control__input[type=text]::-moz-placeholder,.components-text-control__input[type=time]::-moz-placeholder,.components-text-control__input[type=url]::-moz-placeholder,.components-text-control__input[type=week]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-text-control__input:-ms-input-placeholder,.components-text-control__input[type=color]:-ms-input-placeholder,.components-text-control__input[type=date]:-ms-input-placeholder,.components-text-control__input[type=datetime-local]:-ms-input-placeholder,.components-text-control__input[type=datetime]:-ms-input-placeholder,.components-text-control__input[type=email]:-ms-input-placeholder,.components-text-control__input[type=month]:-ms-input-placeholder,.components-text-control__input[type=number]:-ms-input-placeholder,.components-text-control__input[type=password]:-ms-input-placeholder,.components-text-control__input[type=tel]:-ms-input-placeholder,.components-text-control__input[type=text]:-ms-input-placeholder,.components-text-control__input[type=time]:-ms-input-placeholder,.components-text-control__input[type=url]:-ms-input-placeholder,.components-text-control__input[type=week]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-tip{display:flex;color:#757575}.components-tip svg{align-self:center;fill:#f0b849;flex-shrink:0;margin-left:16px}.components-tip p{margin:0}.components-toggle-control .components-base-control__field{display:flex;margin-bottom:12px;line-height:normal;align-items:center}.components-toggle-control .components-base-control__field .components-form-toggle{margin-left:12px}.components-toggle-control .components-base-control__field .components-toggle-control__label{display:block}.components-accessible-toolbar{display:inline-flex;border:1px solid #1e1e1e;border-radius:2px;flex-shrink:0}.components-accessible-toolbar>.components-toolbar-group:last-child{border-left:none}.components-accessible-toolbar .components-button,.components-toolbar .components-button{position:relative;height:48px;z-index:1;padding-right:16px;padding-left:16px}.components-accessible-toolbar .components-button:focus:enabled,.components-toolbar .components-button:focus:enabled{box-shadow:none;outline:none}.components-accessible-toolbar .components-button:before,.components-toolbar .components-button:before{content:"";position:absolute;display:block;border-radius:2px;height:32px;right:8px;left:8px;z-index:-1;animation:components-button__appear-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-accessible-toolbar .components-button:before,.components-toolbar .components-button:before{animation-duration:1ms;animation-delay:0s}}.components-accessible-toolbar .components-button svg,.components-toolbar .components-button svg{position:relative;margin-right:auto;margin-left:auto}.components-accessible-toolbar .components-button.is-pressed,.components-accessible-toolbar .components-button.is-pressed:hover,.components-toolbar .components-button.is-pressed,.components-toolbar .components-button.is-pressed:hover{background:transparent}.components-accessible-toolbar .components-button.is-pressed:before,.components-toolbar .components-button.is-pressed:before{background:#1e1e1e}.components-accessible-toolbar .components-button:focus:before,.components-toolbar .components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.components-accessible-toolbar .components-button.has-icon.has-icon,.components-toolbar .components-button.has-icon.has-icon{padding-right:12px;padding-left:12px;min-width:48px}.components-accessible-toolbar .components-button.components-tab-button,.components-toolbar .components-button.components-tab-button{font-weight:500}.components-accessible-toolbar .components-button.components-tab-button span,.components-toolbar .components-button.components-tab-button span{display:inline-block;padding-right:0;padding-left:0;position:relative}@keyframes components-button__appear-animation{0%{transform:scaleY(0)}to{transform:scaleY(1)}}.components-toolbar__control.components-button{position:relative}.components-toolbar__control.components-button[data-subscript] svg{padding:5px 0 5px 10px}.components-toolbar__control.components-button[data-subscript]:after{content:attr(data-subscript);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:600;line-height:12px;position:absolute;left:8px;bottom:10px}.components-toolbar__control.components-button:active:before{display:none}.components-toolbar__control.components-button:not(:disabled).is-pressed[data-subscript]:after{color:#fff}.components-toolbar-group{min-height:48px;border-left:1px solid #1e1e1e;background-color:#fff;display:inline-flex;flex-shrink:0;flex-wrap:wrap;line-height:0}.components-toolbar-group .components-toolbar-group.components-toolbar-group{border-width:0;margin:0}.components-toolbar{min-height:48px;margin:0;border:1px solid #1e1e1e;background-color:#fff;display:inline-flex;flex-shrink:0;flex-wrap:wrap}.components-toolbar .components-toolbar.components-toolbar{border-width:0;margin:0}div.components-toolbar>div{display:block;margin:0}@supports (position:sticky){div.components-toolbar>div{display:flex}}div.components-toolbar>div+div.has-left-divider{margin-right:6px;position:relative;overflow:visible}div.components-toolbar>div+div.has-left-divider:before{display:inline-block;content:"";box-sizing:content-box;background-color:#ddd;position:absolute;top:8px;right:-3px;width:1px;height:20px}.components-tooltip.components-popover{z-index:1000002}.components-tooltip.components-popover .components-popover__content{min-width:0}.components-tooltip .components-popover__content{background:#1e1e1e;border-radius:2px;border-width:0;color:#fff;white-space:nowrap;text-align:center;line-height:1.4;font-size:12px;box-shadow:none}.components-tooltip .components-popover__content>div{padding:4px 8px}.components-tooltip__shortcut{display:inline-block;margin-right:8px}.disabled-element-wrapper{position:relative}.disabled-element-wrapper .event-catcher{z-index:100002;position:absolute;width:100%;height:100%;top:0;right:0;bottom:0;left:0}@charset "UTF-8";:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-animate__appear{animation:components-animate__appear-animation .1s cubic-bezier(0,0,.2,1) 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-animate__appear{animation-duration:1ms;animation-delay:0s}}.components-animate__appear.is-from-top,.components-animate__appear.is-from-top.is-from-left{transform-origin:top left}.components-animate__appear.is-from-top.is-from-right{transform-origin:top right}.components-animate__appear.is-from-bottom,.components-animate__appear.is-from-bottom.is-from-left{transform-origin:bottom left}.components-animate__appear.is-from-bottom.is-from-right{transform-origin:bottom right}@keyframes components-animate__appear-animation{0%{transform:translateY(-2em) scaleY(0) scaleX(0)}to{transform:translateY(0) scaleY(1) scaleX(1)}}.components-animate__slide-in{animation:components-animate__slide-in-animation .1s cubic-bezier(0,0,.2,1);animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-animate__slide-in{animation-duration:1ms;animation-delay:0s}}.components-animate__slide-in.is-from-left{transform:translateX(100%)}.components-animate__slide-in.is-from-right{transform:translateX(-100%)}@keyframes components-animate__slide-in-animation{to{transform:translateX(0)}}.components-animate__loading{animation:components-animate__loading 1.6s ease-in-out infinite}@keyframes components-animate__loading{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.components-autocomplete__popover .components-popover__content>div{padding:16px;min-width:220px}.components-autocomplete__result.components-button{display:flex;height:auto;min-height:36px;text-align:left;width:100%}.components-autocomplete__result.components-button.is-selected{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button-group{display:inline-block}.components-button-group .components-button{border-radius:0;display:inline-flex;color:#1e1e1e;box-shadow:inset 0 0 0 1px #1e1e1e}.components-button-group .components-button+.components-button{margin-left:-1px}.components-button-group .components-button:first-child{border-radius:2px 0 0 2px}.components-button-group .components-button:last-child{border-radius:0 2px 2px 0}.components-button-group .components-button.is-primary,.components-button-group .components-button:focus{position:relative;z-index:1}.components-button-group .components-button.is-primary{box-shadow:inset 0 0 0 1px #1e1e1e}.components-button{display:inline-flex;text-decoration:none;font-family:inherit;font-weight:400;font-size:13px;margin:0;border:0;cursor:pointer;-webkit-appearance:none;background:none;transition:box-shadow .1s linear;height:36px;align-items:center;box-sizing:border-box;padding:6px 12px;border-radius:2px;color:#1e1e1e}@media (prefers-reduced-motion:reduce){.components-button{transition-duration:0s;transition-delay:0s}}.components-button:hover,.components-button[aria-expanded=true]{color:var(--wp-admin-theme-color)}.components-button[aria-disabled=true]:hover{color:initial}.components-button:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:3px solid transparent}.components-button.is-primary{white-space:nowrap;background:var(--wp-admin-theme-color);color:#fff;text-decoration:none;text-shadow:none;outline:1px solid transparent}.components-button.is-primary:hover:not(:disabled){background:var(--wp-admin-theme-color-darker-10);color:#fff}.components-button.is-primary:active:not(:disabled){background:var(--wp-admin-theme-color-darker-20);border-color:var(--wp-admin-theme-color-darker-20);color:#fff}.components-button.is-primary:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.is-primary:disabled,.components-button.is-primary:disabled:active:enabled,.components-button.is-primary[aria-disabled=true],.components-button.is-primary[aria-disabled=true]:active:enabled,.components-button.is-primary[aria-disabled=true]:enabled{color:hsla(0,0%,100%,.4);background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);opacity:1;outline:none}.components-button.is-primary:disabled:active:enabled:focus:enabled,.components-button.is-primary:disabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:active:enabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:enabled:focus:enabled,.components-button.is-primary[aria-disabled=true]:focus:enabled{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color)}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled=true]{color:#fff;background-size:100px 100%;background-image:linear-gradient(-45deg,var(--wp-admin-theme-color) 33%,var(--wp-admin-theme-color-darker-20) 0,var(--wp-admin-theme-color-darker-20) 70%,var(--wp-admin-theme-color) 0);border-color:var(--wp-admin-theme-color)}.components-button.is-secondary,.components-button.is-tertiary{outline:1px solid transparent}.components-button.is-secondary:active:not(:disabled),.components-button.is-tertiary:active:not(:disabled){background:#ddd;color:var(--wp-admin-theme-color-darker-10);box-shadow:none}.components-button.is-secondary:hover:not(:disabled),.components-button.is-tertiary:hover:not(:disabled){color:var(--wp-admin-theme-color-darker-10);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color-darker-10)}.components-button.is-secondary:disabled,.components-button.is-secondary[aria-disabled=true],.components-button.is-secondary[aria-disabled=true]:hover,.components-button.is-tertiary:disabled,.components-button.is-tertiary[aria-disabled=true],.components-button.is-tertiary[aria-disabled=true]:hover{color:#828282;background:#eaeaea;transform:none;opacity:1;box-shadow:none;outline:none}.components-button.is-secondary{box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color);outline:1px solid transparent}.components-button.is-secondary,.components-button.is-tertiary{white-space:nowrap;color:var(--wp-admin-theme-color);background:transparent}.components-button.is-tertiary{padding:6px}.components-button.is-tertiary .dashicon{display:inline-block;flex:0 0 auto}p+.components-button.is-tertiary{margin-left:-6px}.components-button.is-destructive{color:#cc1818;box-shadow:inset 0 0 0 1px #cc1818}.components-button.is-destructive:hover:not(:disabled){color:#710d0d;box-shadow:inset 0 0 0 1px #710d0d}.components-button.is-destructive:focus:not(:disabled){color:var(--wp-admin-theme-color)}.components-button.is-destructive:active:not(:disabled){background:#ccc}.components-button.is-destructive.is-primary{color:#fff;background:#cc1818;box-shadow:inset 0 0 0 1px #cc1818}.components-button.is-destructive.is-primary:hover:not(:disabled){color:#fff;background:#710d0d;box-shadow:inset 0 0 0 1px #710d0d}.components-button.is-destructive.is-tertiary{box-shadow:none}.components-button.is-destructive.is-tertiary:hover:not(:disabled){box-shadow:inset 0 0 0 1px #cc1818;color:#cc1818}.components-button.is-destructive.is-tertiary:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) #cc1818;color:#cc1818}.components-button.is-link{margin:0;padding:0;box-shadow:none;border:0;border-radius:0;background:none;outline:none;text-align:left;color:var(--wp-admin-theme-color);text-decoration:underline;transition-property:border,background,color;transition-duration:.05s;transition-timing-function:ease-in-out;height:auto}@media (prefers-reduced-motion:reduce){.components-button.is-link{transition-duration:0s;transition-delay:0s}}.components-button.is-link:focus{border-radius:2px}.components-button.is-link.is-destructive{color:#cc1818}.components-button.is-link.is-destructive:active:not(:disabled),.components-button.is-link.is-destructive:hover:not(:disabled){color:#710d0d;background:none}.components-button.is-link.is-destructive:focus:not(:disabled){color:var(--wp-admin-theme-color)}.components-button:not([aria-disabled=true]):active{color:inherit}.components-button:disabled,.components-button[aria-disabled=true]{cursor:default;opacity:.3}.components-button.is-busy,.components-button.is-secondary.is-busy,.components-button.is-secondary.is-busy:disabled,.components-button.is-secondary.is-busy[aria-disabled=true]{animation:components-button__busy-animation 2.5s linear infinite;opacity:1;background-size:100px 100%;background-image:linear-gradient(-45deg,#fafafa 33%,#e0e0e0 0,#e0e0e0 70%,#fafafa 0)}.components-button.is-small{height:24px;line-height:22px;padding:0 8px;font-size:11px}.components-button.is-small.has-icon:not(.has-text){padding:0 8px;width:24px}.components-button.has-icon{padding:6px;min-width:36px;justify-content:center}.components-button.has-icon .dashicon{display:inline-block;flex:0 0 auto;margin-left:2px;margin-right:2px}.components-button.has-icon.has-text{justify-content:left}.components-button.has-icon.has-text svg{margin-right:8px}.components-button.has-icon.has-text .dashicon{margin-right:10px}.components-button.is-pressed{color:#fff;background:#1e1e1e}.components-button.is-pressed:focus:not(:disabled){box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.components-button.is-pressed:hover:not(:disabled){color:#fff;background:#1e1e1e}.components-button svg{fill:currentColor;outline:none}@media (forced-colors:active){.components-button svg{fill:CanvasText}}.components-button .components-visually-hidden{height:auto}@keyframes components-button__busy-animation{0%{background-position:200px 0}}.components-checkbox-control__input[type=checkbox]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;font-size:16px;line-height:normal;border:1px solid #1e1e1e;transition:none;border-radius:2px;background:#fff;color:#1e1e1e;clear:none;cursor:pointer;display:inline-block;line-height:0;margin:0 4px 0 0;outline:0;padding:0!important;text-align:center;vertical-align:top;width:24px;height:24px;-webkit-appearance:none;appearance:none;transition:border-color .1s ease-in-out}@media (min-width:600px){.components-checkbox-control__input[type=checkbox]{font-size:13px;line-height:normal}}.components-checkbox-control__input[type=checkbox]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-checkbox-control__input[type=checkbox]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]:checked::-ms-check{opacity:0}.components-checkbox-control__input[type=checkbox]:checked:before,.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{margin:-3px -5px;color:#fff}@media (min-width:782px){.components-checkbox-control__input[type=checkbox]:checked:before,.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{margin:-4px 0 0 -5px}}.components-checkbox-control__input[type=checkbox][aria-checked=mixed]{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{content:"";float:left;display:inline-block;vertical-align:middle;width:16px;font:normal 30px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:782px){.components-checkbox-control__input[type=checkbox][aria-checked=mixed]:before{float:none;font-size:21px}}@media (min-width:600px){.components-checkbox-control__input[type=checkbox]{height:20px;width:20px}}@media (prefers-reduced-motion:reduce){.components-checkbox-control__input[type=checkbox]{transition-duration:0s;transition-delay:0s}}.components-checkbox-control__input[type=checkbox]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.components-checkbox-control__input[type=checkbox]:checked,.components-checkbox-control__input[type=checkbox]:indeterminate{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-checkbox-control__input[type=checkbox]:checked::-ms-check,.components-checkbox-control__input[type=checkbox]:indeterminate::-ms-check{opacity:0}.components-checkbox-control__input[type=checkbox]:checked:before{content:none}.components-checkbox-control__input-container{position:relative;display:inline-block;margin-right:12px;vertical-align:middle;width:24px;height:24px}@media (min-width:600px){.components-checkbox-control__input-container{width:20px;height:20px}}svg.components-checkbox-control__checked,svg.components-checkbox-control__indeterminate{fill:#fff;cursor:pointer;position:absolute;left:0;top:0;width:24px;height:24px;-webkit-user-select:none;user-select:none;pointer-events:none}@media (min-width:600px){svg.components-checkbox-control__checked,svg.components-checkbox-control__indeterminate{left:-2px;top:-2px}}.components-circular-option-picker{display:inline-block;width:100%;min-width:188px}.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper{display:flex;justify-content:flex-end;margin-top:12px}.components-circular-option-picker .components-circular-option-picker__swatches{display:flex;flex-wrap:wrap;gap:12px}.components-circular-option-picker__option-wrapper{display:inline-block;height:28px;width:28px;vertical-align:top;transform:scale(1);transition:transform .1s ease}@media (prefers-reduced-motion:reduce){.components-circular-option-picker__option-wrapper{transition-duration:0s;transition-delay:0s}}.components-circular-option-picker__option-wrapper:hover{transform:scale(1.2)}.components-circular-option-picker__option-wrapper>div{height:100%;width:100%}.components-circular-option-picker__option-wrapper:before{content:"";position:absolute;top:1px;left:1px;bottom:1px;right:1px;border-radius:50%;z-index:-1;background:url("data:image/svg+xml;charset=utf-8,%3Csvg width='28' height='28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8V6H4v2h2zm2 0V6h2v2H8zm2 8H8v-2h2v2zm2 0v-2h2v2h-2zm0 2v-2h-2v2H8v2h2v-2h2zm2 0v2h-2v-2h2zm2 0h-2v-2h2v2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18 18h2v-2h-2v-2h2v-2h-2v-2h2V8h-2v2h-2V8h-2v2h2v2h-2v2h2v2h2v2zm-2-4v-2h2v2h-2z' fill='%23555D65'/%3E%3Cpath d='M18 18v2h-2v-2h2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8 10V8H6v2H4v2h2v2H4v2h2v2H4v2h2v2H4v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2v2h-2V4h-2v2h-2V4h-2v2h-2V4h-2v2h2v2h-2v2H8zm0 2v-2H6v2h2zm2 0v-2h2v2h-2zm0 2v-2H8v2H6v2h2v2H6v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h-2v2h-2V6h-2v2h-2v2h2v2h-2v2h-2z' fill='%23555D65'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4 0H2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2H8V0H6v2H4V0zm0 4V2H2v2h2zm2 0V2h2v2H6zm0 2V4H4v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2H8v2H6z' fill='%23555D65'/%3E%3C/svg%3E")}.components-circular-option-picker__option{display:inline-block;vertical-align:top;height:100%;width:100%;border:none;border-radius:50%;background:transparent;box-shadow:inset 0 0 0 14px;transition:box-shadow .1s ease;cursor:pointer}@media (prefers-reduced-motion:reduce){.components-circular-option-picker__option{transition-duration:0s;transition-delay:0s}}.components-circular-option-picker__option:hover{box-shadow:inset 0 0 0 14px!important}.components-circular-option-picker__option.is-pressed{box-shadow:inset 0 0 0 4px;position:relative;z-index:1;overflow:visible}.components-circular-option-picker__option.is-pressed+svg{position:absolute;left:2px;top:2px;border-radius:50%;z-index:2;pointer-events:none}.components-circular-option-picker__option:after{content:"";position:absolute;top:-1px;left:-1px;bottom:-1px;right:-1px;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);border:1px solid transparent}.components-circular-option-picker__option:focus:after{content:"";border:2px solid #757575;width:32px;height:32px;position:absolute;top:-2px;left:-2px;border-radius:50%;box-shadow:inset 0 0 0 2px #fff}.components-circular-option-picker__option.components-button:focus{background-color:transparent;box-shadow:inset 0 0 0 14px;outline:none}.components-circular-option-picker__button-action .components-circular-option-picker__option{color:#fff;background:#fff}.components-circular-option-picker__dropdown-link-action{margin-right:16px}.components-circular-option-picker__dropdown-link-action .components-button{line-height:22px}@media (min-width:782px){.components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content{margin-right:156px;margin-top:-49px}}.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar{margin-top:0}.components-palette-edit__popover .components-custom-gradient-picker__ui-line{margin-bottom:0}.components-palette-edit__popover .components-custom-gradient-picker{width:280px;padding:8px}.components-dropdown-menu__menu .components-palette-edit__menu-button{width:100%}.component-color-indicator{width:20px;height:20px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);border-radius:50%;display:inline-block;padding:0}.components-combobox-control{width:100%}input.components-combobox-control__input[type=text]{width:100%;border:none;box-shadow:none;font-family:inherit;font-size:16px;padding:2px;margin:0;line-height:inherit;min-height:auto}@media (min-width:600px){input.components-combobox-control__input[type=text]{font-size:13px}}input.components-combobox-control__input[type=text]:focus{outline:none;box-shadow:none}.components-combobox-control__suggestions-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:flex;flex-wrap:wrap;align-items:flex-start;width:100%;margin:0 0 8px;padding:4px}@media (prefers-reduced-motion:reduce){.components-combobox-control__suggestions-container{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-combobox-control__suggestions-container{font-size:13px;line-height:normal}}.components-combobox-control__suggestions-container:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-combobox-control__suggestions-container::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-combobox-control__suggestions-container:focus-within{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-combobox-control__reset.components-button{display:flex;height:16px;min-width:16px;padding:0}.components-color-list-picker,.components-color-list-picker__swatch-button{width:100%}.components-color-list-picker__color-picker{margin:8px 0}.components-color-palette__custom-color{position:relative;border:none;background:none;border-radius:2px;height:64px;padding:12px;font-family:inherit;width:100%;background-image:repeating-linear-gradient(45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0),repeating-linear-gradient(45deg,#e0e0e0 25%,transparent 0,transparent 75%,#e0e0e0 0,#e0e0e0);background-position:0 0,25px 25px;background-size:50px 50px;box-sizing:border-box;color:#fff;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);outline:1px solid transparent}.components-color-palette__custom-color:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline-width:2px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content{overflow:visible;box-shadow:0 4px 4px rgba(0,0,0,.05);border:none;border-radius:2px;max-height:-moz-fit-content!important;max-height:fit-content!important}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content>div{padding:0}.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation{border-top-right-radius:2px;border-top-left-radius:2px}@media (min-width:782px){.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar .components-popover__content.components-popover__content{margin-right:156px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content{margin-top:-60px}.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-bottom .components-popover__content{margin-bottom:-60px}}.components-color-palette__custom-color-name{text-align:left}.components-color-palette__custom-color-value{margin-left:16px;text-transform:uppercase}.components-custom-gradient-picker__gradient-bar:not(.has-gradient){opacity:.4}.components-custom-gradient-picker__gradient-bar{border-radius:2px;margin-top:12px;width:100%;height:48px;margin-bottom:20px;padding-right:16px}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__markers-container{position:relative;width:calc(100% - 32px);margin-left:auto;margin-right:auto}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point{border-radius:50%;background:#fff;padding:2px;top:16px;min-width:16px;width:16px;height:16px;position:relative;color:#1e1e1e}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point svg{height:100%;width:100%}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button{border-radius:50%;height:16px;width:16px;padding:0;position:absolute;top:16px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #fff,0 0 2px 0 rgba(0,0,0,.25);outline:2px solid transparent}.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button.is-active,.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button:focus{box-shadow:inset 0 0 0 calc(var(--wp-admin-border-width-focus)*2) #fff,0 0 2px 0 rgba(0,0,0,.25);outline:4px solid transparent}.components-custom-gradient-picker__color-picker-popover .components-custom-gradient-picker__remove-control-point{margin-left:auto;margin-right:auto;display:block;margin-bottom:8px}.components-custom-gradient-picker__inserter{direction:ltr;width:100%}.components-custom-gradient-picker__liner-gradient-indicator{display:inline-block;flex:0 auto;width:20px;height:20px}.components-custom-gradient-picker .components-custom-gradient-picker__ui-line{margin-bottom:16px}.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-angle-picker,.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-custom-gradient-picker__type-picker{margin-bottom:0}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar{border:none}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar>div+div{margin-left:1px}.components-custom-gradient-picker .components-custom-gradient-picker__toolbar button.is-pressed>svg{background:#fff;border:1px solid #949494;border-radius:2px}.components-custom-gradient-picker .components-input-control__label{line-height:1}.components-custom-gradient-picker label{text-transform:uppercase;font-size:11px;font-weight:500}.components-custom-select-control{position:relative}.components-custom-select-control__label{display:block;margin-bottom:8px}.components-custom-select-control__button{border:1px solid #757575;border-radius:2px;min-width:130px;position:relative;text-align:left}.components-custom-select-control__button:not(.is-next-36px-default-size){min-height:30px}.components-custom-select-control__button.components-custom-select-control__button{padding-left:16px;padding-right:32px}.components-custom-select-control__button.components-custom-select-control__button:not(.is-next-36px-default-size){padding-left:8px;padding-right:24px}.components-custom-select-control__button:focus:not(:disabled){border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-custom-select-control__button .components-custom-select-control__button-icon{height:100%;padding:0;position:absolute;right:8px;top:0}.components-custom-select-control__button .components-custom-select-control__button-icon:not(.is-next-36px-default-size){right:4px}.components-custom-select-control__menu{border:1px solid #1e1e1e;background-color:#fff;border-radius:2px;outline:none;transition:none;max-height:400px;min-width:100%;overflow:auto;padding:0;position:absolute;z-index:1000000}.components-custom-select-control__menu[aria-hidden=true]{display:none}.components-custom-select-control__item{align-items:center;display:grid;grid-template-columns:auto auto;list-style-type:none;padding:8px 16px;cursor:default;line-height:28px}.components-custom-select-control__item:not(.is-next-36px-default-size){padding:8px}.components-custom-select-control__item.has-hint{grid-template-columns:auto auto 30px}.components-custom-select-control__item.is-highlighted{background:#ddd}.components-custom-select-control__item .components-custom-select-control__item-hint{color:#757575;text-align:right;padding-right:4px}.components-custom-select-control__item .components-custom-select-control__item-icon{margin-left:auto}.components-custom-select-control__item:last-child{margin-bottom:0}.PresetDateRangePicker_panel{padding:0 22px 11px}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;box-sizing:border-box;cursor:pointer}.PresetDateRangePicker_button:active{outline:0}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699}.SingleDatePickerInput{display:inline-block;background-color:#fff}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb}.SingleDatePickerInput__rtl{direction:rtl}.SingleDatePickerInput__disabled{background-color:#f2f2f2}.SingleDatePickerInput__block{display:block}.SingleDatePickerInput__showClearDate{padding-right:30px}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;transform:translateY(-50%)}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%}.SingleDatePickerInput_clearDate__small{padding:6px}.SingleDatePickerInput_clearDate__hide{visibility:hidden}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle}.SingleDatePickerInput_clearDate_svg__small{height:9px}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle}.SingleDatePicker{position:relative;display:inline-block}.SingleDatePicker__block{display:block}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute}.SingleDatePicker_picker__rtl{direction:rtl}.SingleDatePicker_picker__directionLeft{left:0}.SingleDatePicker_picker__directionRight{right:0}.SingleDatePicker_picker__portal{background-color:rgba(0,0,0,.3);position:fixed;top:0;left:0;height:100%;width:100%}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:#b0b3b4;text-decoration:none}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0}.DayPickerKeyboardShortcuts_show{width:22px;position:absolute;z-index:2}.DayPickerKeyboardShortcuts_show__bottomRight{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0}.DayPickerKeyboardShortcuts_show__bottomRight:hover{border-right:33px solid #008489}.DayPickerKeyboardShortcuts_show__topRight{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0}.DayPickerKeyboardShortcuts_show__topRight:hover{border-right:33px solid #008489}.DayPickerKeyboardShortcuts_show__topLeft{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0}.DayPickerKeyboardShortcuts_show__topLeft:hover{border-left:33px solid #008489}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:-28px}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:-28px}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:-28px}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2}.DayPickerKeyboardShortcuts_close:active{outline:0}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a}.CalendarDay{box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center}.CalendarDay:active{outline:0}.CalendarDay__defaultCursor{cursor:default}.CalendarDay__default{border:1px solid #e4e7e7;color:#484848;background:#fff}.CalendarDay__default:hover{background:#e4e7e7;border:1px double #e4e7e7;color:inherit}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit}.CalendarDay__outside{border:0;background:#fff;color:#484848}.CalendarDay__outside:hover{border:0}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:#ffce71;color:#484848}.CalendarDay__selected_span{background:#66e2da;border:1px solid #33dacd;color:#fff}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:#33dacd;border:1px solid #33dacd;color:#fff}.CalendarDay__last_in_range{border-right:#00a699}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:#00a699;border:1px solid #00a699;color:#fff}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:#b2f1ec;border:1px solid #80e8e0;color:#007a87}.CalendarDay__hovered_span:active{background:#80e8e0;border:1px solid #80e8e0;color:#007a87}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd}.CalendarMonth{background:#fff;text-align:center;vertical-align:top;-webkit-user-select:none;user-select:none}.CalendarMonth_table{border-collapse:collapse;border-spacing:0}.CalendarMonth_verticalSpacing{border-collapse:separate}.CalendarMonth_caption{color:#484848;font-size:18px;text-align:center;padding-top:22px;padding-bottom:37px;caption-side:top}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px}.CalendarMonthGrid{background:#fff;text-align:left;z-index:0}.CalendarMonthGrid__animating{z-index:1}.CalendarMonthGrid__horizontal{position:absolute;left:0}.CalendarMonthGrid__vertical{margin:0 auto}.CalendarMonthGrid__vertical_scrollable{margin:0 auto;overflow-y:scroll}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none}.CalendarMonthGrid_month__hidden{visibility:hidden}.DayPickerNavigation{position:relative;z-index:2}.DayPickerNavigation__horizontal{height:0}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0}.DayPickerNavigation__verticalScrollableDefault{position:relative}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;user-select:none;border:0;padding:0;margin:0}.DayPickerNavigation_button__default{border:1px solid #e4e7e7;background-color:#fff;color:#757575}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:1px solid #c4c4c4}.DayPickerNavigation_button__default:active{background:#f2f2f2}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:.78;border-radius:3px;padding:6px 9px}.DayPickerNavigation_leftButton__horizontalDefault{left:22px}.DayPickerNavigation_rightButton__horizontalDefault{right:22px}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0,0,0,.1);position:relative;display:inline-block;height:100%;width:50%}.DayPickerNavigation_nextButton__verticalDefault{border-left:0}.DayPickerNavigation_nextButton__verticalScrollableDefault{width:100%}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:#82888a;display:block}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;display:block}.DayPicker{position:relative;text-align:left}.DayPicker,.DayPicker__horizontal{background:#fff}.DayPicker__verticalScrollable{height:100%}.DayPicker__hidden{visibility:hidden}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0,0,0,.05),0 0 0 1px rgba(0,0,0,.07);border-radius:3px}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%}.DayPicker_portal__vertical{position:static}.DayPicker_focusRegion{outline:0}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top}.DayPicker_weekHeaders{position:relative}.DayPicker_weekHeaders__horizontal{margin-left:13px}.DayPicker_weekHeader{color:#757575;position:absolute;top:62px;z-index:2;text-align:left;padding:0!important}.DayPicker_weekHeader__vertical{left:50%}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px}.DayPicker_weekHeader_li{display:inline-block;text-align:center;margin:0 1px}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px}.DayPicker_transitionContainer__horizontal{transition:height .2s ease-in-out}.DayPicker_transitionContainer__vertical{width:100%}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll}.DateInput{margin:0;padding:0;background:#fff;position:relative;display:inline-block;width:130px;vertical-align:middle}.DateInput__small{width:97px}.DateInput__block{width:100%}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb}.DateInput_input{font-weight:200;font-size:19px;line-height:24px;color:#484848;background-color:#fff;width:100%;padding:11px 11px 9px;border:0;border-bottom:2px solid transparent;border-radius:0}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:.2px;padding:7px 7px 5px}.DateInput_input__regular{font-weight:auto}.DateInput_input__readOnly{-webkit-user-select:none;user-select:none}.DateInput_input__focused{outline:0;background:#fff;border:0;border-bottom:2px solid #008489}.DateInput_input__disabled{background:#f2f2f2;font-style:italic}.DateInput_screenReaderMessage{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2}.DateInput_fangShape{fill:#fff}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent}.DateRangePickerInput{background-color:#fff;display:inline-block}.DateRangePickerInput__disabled{background:#f2f2f2}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb}.DateRangePickerInput__rtl{direction:rtl}.DateRangePickerInput__block{display:block}.DateRangePickerInput__showClearDates{padding-right:30px}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:24px;width:24px}.DateRangePickerInput_clearDates{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;transform:translateY(-50%)}.DateRangePickerInput_clearDates__small{padding:6px}.DateRangePickerInput_clearDates_default:focus,.DateRangePickerInput_clearDates_default:hover{background:#dbdbdb;border-radius:50%}.DateRangePickerInput_clearDates__hide{visibility:hidden}.DateRangePickerInput_clearDates_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle}.DateRangePickerInput_clearDates_svg__small{height:9px}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle}.DateRangePicker{position:relative;display:inline-block}.DateRangePicker__block{display:block}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute}.DateRangePicker_picker__rtl{direction:rtl}.DateRangePicker_picker__directionLeft{left:0}.DateRangePicker_picker__directionRight{right:0}.DateRangePicker_picker__portal{background-color:rgba(0,0,0,.3);position:fixed;top:0;left:0;height:100%;width:100%}.DateRangePicker_picker__fullScreenPortal{background-color:#fff}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:#b0b3b4;text-decoration:none}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd}.components-datetime{padding:16px}.components-panel__body .components-datetime{padding:0}.components-datetime .components-datetime__calendar-help{padding:16px;min-width:260px}.components-datetime .components-datetime__calendar-help h4{margin:0}.components-datetime .components-datetime__buttons{display:flex;justify-content:space-between}.components-datetime .components-datetime__date-help-toggle{display:block;margin-left:auto}.components-datetime fieldset{border:0;padding:0;margin:0}.components-datetime input,.components-datetime select{box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575}@media (prefers-reduced-motion:reduce){.components-datetime input,.components-datetime select{transition-duration:0s;transition-delay:0s}}.components-datetime .components-button,.components-datetime input[type=number],.components-datetime select{height:30px;margin-top:0;margin-bottom:0}.components-datetime .components-button:focus{z-index:1}.components-datetime__date{min-height:236px;border-top:1px solid #ddd}.components-datetime__date .DayPickerNavigation_leftButton__horizontalDefault{ - /*!rtl:begin:ignore*/left:13px - /*!rtl:end:ignore*/}.components-datetime__date .CalendarMonth_caption{font-size:13px}.components-datetime__date .CalendarMonth_table{border-collapse:separate;border-spacing:2px}.components-datetime__date .CalendarDay{font-size:13px;border:none;border-radius:50%;text-align:center}.components-datetime__date .CalendarDay:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 3px #fff;outline:2px solid transparent}.components-datetime__date .CalendarDay__selected{background:var(--wp-admin-theme-color);border:2px solid transparent}.components-datetime__date .CalendarDay__selected:hover{background:var(--wp-admin-theme-color-darker-20)}.components-datetime__date .CalendarDay__selected:focus{box-shadow:inset 0 0 0 1px #fff}.components-datetime__date .DayPickerNavigation_button__horizontalDefault{padding:2px 8px;top:20px}.components-datetime__date .DayPickerNavigation_button__horizontalDefault:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-datetime__date .DayPicker_weekHeader{top:50px}.components-datetime__date .DayPicker_weekHeader .DayPicker_weekHeader_ul{margin:1px;padding-left:0;padding-right:0}.components-datetime__date.is-description-visible .DayPicker{visibility:hidden}.components-datetime__date .CalendarDay .components-datetime__date__day{height:100%;display:flex;justify-content:center;align-content:center;flex-direction:column;position:relative}.components-datetime__date .CalendarDay .components-datetime__date__day.has-events:before{content:" ";width:4px;height:4px;border-radius:2px;position:absolute;left:50%;margin-left:-2px;bottom:0;background-color:#fff}.components-datetime__date .CalendarDay:not(.CalendarDay__selected) .components-datetime__date__day.has-events:before{background:var(--wp-admin-theme-color)}.components-datetime__time{padding-bottom:16px}.components-datetime__time fieldset{position:relative;margin-bottom:.5em}.components-datetime__time fieldset+fieldset{margin-bottom:0}.components-datetime__time .components-datetime__time-field-am-pm fieldset{margin-top:0}.components-datetime__time .components-datetime__time-wrapper{display:flex}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-separator{display:inline-block;padding:0 3px 0 0}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field-time{direction:ltr}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select{margin-right:4px}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select:focus{position:relative;z-index:1}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]{padding:2px;margin-right:4px;text-align:center;-moz-appearance:textfield}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]:focus{position:relative;z-index:1}.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.components-datetime__time.is-12-hour .components-datetime__time-field-day input{margin:-4px 0 0!important;border-radius:2px 0 0 2px!important}.components-datetime__time.is-12-hour .components-datetime__time-field-year input{border-radius:0 2px 2px 0!important}.components-datetime__timezone{line-height:30px;margin-left:4px;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.components-datetime__time-legend{font-weight:600;margin-top:.5em}.components-datetime__time-legend.invisible{position:absolute;top:-999em;left:-999em}.components-datetime__time-field-integer-field{font-family:inherit}.components-datetime__time-field-day-input,.components-datetime__time-field-hours-input,.components-datetime__time-field-minutes-input{width:35px}.components-datetime__time-field-year-input{width:55px}.components-datetime__time-field-month-select{max-width:145px}.components-popover .components-datetime__date{padding-left:4px}.block-editor-dimension-control .components-base-control__field{display:flex;align-items:center}.block-editor-dimension-control .components-base-control__label{display:flex;align-items:center;margin-right:1em;margin-bottom:0}.block-editor-dimension-control .components-base-control__label .dashicon{margin-right:.5em}.block-editor-dimension-control.is-manual .components-base-control__label{width:10em}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}.components-draggable__invisible-drag-image{position:fixed;left:-1000px;height:50px;width:50px}.components-draggable__clone{position:fixed;padding:0;background:transparent;pointer-events:none;z-index:1000000000}.components-drop-zone{position:absolute;top:0;right:0;bottom:0;left:0;z-index:40;visibility:hidden;opacity:0;border-radius:2px}.components-drop-zone.is-active{opacity:1;visibility:visible}.components-drop-zone__content{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;display:flex;background-color:var(--wp-admin-theme-color);align-items:center;justify-content:center;z-index:50;text-align:center;color:#fff}.components-drop-zone__content-icon,.components-drop-zone__content-text{display:block}.components-drop-zone__content-icon{margin:0 auto;line-height:0;fill:currentColor;pointer-events:none}.components-drop-zone__content-text{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-dropdown{display:inline-block}.components-dropdown__content .components-popover__content>div{padding:8px}.components-dropdown__content [role=menuitem]{white-space:nowrap}.components-dropdown-menu__menu{width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:1.4}.components-dropdown-menu__menu .components-dropdown-menu__menu-item,.components-dropdown-menu__menu .components-menu-item{width:100%;padding:6px;outline:none;cursor:pointer;white-space:nowrap}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator,.components-dropdown-menu__menu .components-menu-item.has-separator{margin-top:6px;position:relative;overflow:visible}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator:before,.components-dropdown-menu__menu .components-menu-item.has-separator:before{display:block;content:"";box-sizing:content-box;background-color:#ddd;position:absolute;top:-3px;left:0;right:0;height:1px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg,.components-dropdown-menu__menu .components-menu-item.is-active svg{color:#fff;background:#1e1e1e;box-shadow:0 0 0 1px #1e1e1e;border-radius:1px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item>svg,.components-dropdown-menu__menu .components-menu-item>svg{border-radius:2px;width:24px;height:24px}.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only,.components-dropdown-menu__menu .components-menu-item.is-icon-only{width:auto}.components-dropdown-menu__menu .components-menu-item__button,.components-dropdown-menu__menu .components-menu-item__button.components-button{min-height:36px;height:auto;text-align:left;padding-left:8px;padding-right:8px}.components-dropdown-menu__menu .components-menu-group{padding:8px;margin:0 -8px}.components-dropdown-menu__menu .components-menu-group:first-child{margin-top:-8px}.components-dropdown-menu__menu .components-menu-group:last-child{margin-bottom:-8px}.components-dropdown-menu__menu .components-menu-group+.components-menu-group{margin-top:0;border-top:1px solid #ccc;padding:8px}.is-alternate .components-dropdown-menu__menu .components-menu-group+.components-menu-group{border-color:#1e1e1e}.components-font-size-picker__header__hint{margin-left:4px;color:#757575}.components-font-size-picker__header .components-button.is-small.has-icon:not(.has-text){min-width:24px;padding:0}.components-font-size-picker__controls{max-width:248px;align-items:center;margin-top:8px;margin-bottom:24px}.components-font-size-picker__controls .components-unit-control-wrapper .components-input-control__label{font-weight:300;padding-bottom:0!important;margin-bottom:8px!important}.components-font-size-picker__controls .components-custom-select-control__button{width:100%}.components-font-size-picker__controls .components-font-size-picker__number{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:inline-block;font-weight:500;height:30px;margin:8px 8px 0 0;width:54px}@media (prefers-reduced-motion:reduce){.components-font-size-picker__controls .components-font-size-picker__number{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-font-size-picker__controls .components-font-size-picker__number{font-size:13px;line-height:normal}}.components-font-size-picker__controls .components-font-size-picker__number:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-font-size-picker__controls .components-font-size-picker__number::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-font-size-picker__controls .components-font-size-picker__number[value=""]+.components-button{cursor:default;opacity:.3;pointer-events:none}.components-font-size-picker__controls .components-font-size-picker__number-container{display:flex;flex-direction:column}.components-font-size-picker__controls .components-color-palette__clear{height:30px}.components-font-size-picker__custom-input .components-range-control__slider+.dashicon{width:30px;height:30px}.components-font-size-picker{border:0;padding:0;margin:0}.components-form-toggle{position:relative;display:inline-block}.components-form-toggle .components-form-toggle__track{content:"";display:inline-block;box-sizing:border-box;vertical-align:top;background-color:#fff;border:1px solid #1e1e1e;width:36px;height:18px;border-radius:9px;transition:background .2s ease}@media (prefers-reduced-motion:reduce){.components-form-toggle .components-form-toggle__track{transition-duration:0s;transition-delay:0s}}.components-form-toggle .components-form-toggle__thumb{display:block;position:absolute;box-sizing:border-box;top:3px;left:3px;width:12px;height:12px;border-radius:50%;transition:transform .1s ease;background-color:#1e1e1e;border:5px solid #1e1e1e}@media (prefers-reduced-motion:reduce){.components-form-toggle .components-form-toggle__thumb{transition-duration:0s;transition-delay:0s}}.components-form-toggle.is-checked .components-form-toggle__track{background-color:var(--wp-admin-theme-color);border:9px solid transparent}.components-form-toggle .components-form-toggle__input:focus+.components-form-toggle__track{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:2px}.components-form-toggle.is-checked .components-form-toggle__thumb{background-color:#fff;border-width:0;transform:translateX(18px)}.components-disabled .components-form-toggle,.components-form-toggle.is-disabled{opacity:.3}.components-form-toggle input.components-form-toggle__input[type=checkbox]{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;margin:0;padding:0;z-index:1;border:none}.components-form-toggle input.components-form-toggle__input[type=checkbox]:checked{background:none}.components-form-toggle input.components-form-toggle__input[type=checkbox]:before{content:""}.components-form-token-field__input-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;display:flex;flex-wrap:wrap;align-items:center;width:100%;margin:0 0 8px;padding:2px 4px;cursor:text}@media (prefers-reduced-motion:reduce){.components-form-token-field__input-container{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-form-token-field__input-container{font-size:13px;line-height:normal}}.components-form-token-field__input-container:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-form-token-field__input-container::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-form-token-field__input-container::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-form-token-field__input-container:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-form-token-field__input-container.is-disabled{background:#ddd;border-color:#ddd}.components-form-token-field__input-container.is-active{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-form-token-field__input-container input[type=text].components-form-token-field__input{display:inline-block;flex:1;font-family:inherit;font-size:16px;width:100%;max-width:100%;margin-left:4px;padding:0;min-height:24px;min-width:50px;background:inherit;border:0;color:#1e1e1e;box-shadow:none}@media (min-width:600px){.components-form-token-field__input-container input[type=text].components-form-token-field__input{font-size:13px}}.components-form-token-field.is-active .components-form-token-field__input-container input[type=text].components-form-token-field__input,.components-form-token-field__input-container input[type=text].components-form-token-field__input:focus{outline:none;box-shadow:none}.components-form-token-field__input-container .components-form-token-field__token+input[type=text].components-form-token-field__input{width:auto}.components-form-token-field__label{display:inline-block;margin-bottom:8px}.components-form-token-field__help{font-size:12px;font-style:normal;color:#757575}.components-form-token-field__token{font-size:13px;display:flex;margin:2px 4px 2px 0;color:#1e1e1e;max-width:100%}.components-form-token-field__token.is-success .components-form-token-field__remove-token,.components-form-token-field__token.is-success .components-form-token-field__token-text{background:#4ab866}.components-form-token-field__token.is-error .components-form-token-field__remove-token,.components-form-token-field__token.is-error .components-form-token-field__token-text{background:#cc1818}.components-form-token-field__token.is-validating .components-form-token-field__remove-token,.components-form-token-field__token.is-validating .components-form-token-field__token-text{color:#757575}.components-form-token-field__token.is-borderless{position:relative;padding:0 16px 0 0}.components-form-token-field__token.is-borderless .components-form-token-field__token-text{background:transparent;color:var(--wp-admin-theme-color)}.components-form-token-field__token.is-borderless .components-form-token-field__remove-token{background:transparent;color:#757575;position:absolute;top:1px;right:0}.components-form-token-field__token.is-borderless.is-success .components-form-token-field__token-text{color:#4ab866}.components-form-token-field__token.is-borderless.is-error .components-form-token-field__token-text{color:#cc1818;border-radius:4px 0 0 4px;padding:0 4px 0 6px}.components-form-token-field__token.is-borderless.is-validating .components-form-token-field__token-text{color:#1e1e1e}.components-form-token-field__token.is-disabled .components-form-token-field__remove-token{cursor:default}.components-form-token-field__remove-token.components-button,.components-form-token-field__token-text{display:inline-block;line-height:24px;height:auto;background:#ddd;min-width:unset;transition:all .2s cubic-bezier(.4,1,.4,1)}@media (prefers-reduced-motion:reduce){.components-form-token-field__remove-token.components-button,.components-form-token-field__token-text{transition-duration:0s;transition-delay:0s;animation-duration:1ms;animation-delay:0s}}.components-form-token-field__token-text{border-radius:2px 0 0 2px;padding:0 0 0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.components-form-token-field__remove-token.components-button{cursor:pointer;border-radius:0 2px 2px 0;padding:0 2px;color:#1e1e1e;line-height:10px;overflow:initial}.components-form-token-field__remove-token.components-button:hover{color:#1e1e1e}.components-form-token-field__suggestions-list{flex:1 0 100%;min-width:100%;max-height:9em;overflow-y:auto;transition:all .15s ease-in-out;list-style:none;border-top:1px solid #757575;margin:4px -4px -4px;padding:0}@media (prefers-reduced-motion:reduce){.components-form-token-field__suggestions-list{transition-duration:0s;transition-delay:0s}}.components-form-token-field__suggestion{color:#757575;display:block;font-size:13px;padding:4px 8px;margin:0;cursor:pointer}.components-form-token-field__suggestion.is-selected{background:var(--wp-admin-theme-color);color:#fff}.components-form-token-field__suggestion-match{text-decoration:underline}@media (min-width:600px){.components-guide{width:600px}}.components-guide .components-modal__content{padding:0;margin-top:0;border-radius:2px}.components-guide .components-modal__content:before{content:none}.components-guide .components-modal__header{border-bottom:none;padding:0;position:sticky}.components-guide .components-modal__header .components-button{align-self:flex-start;margin:8px 8px 0 0;position:static}.components-guide .components-modal__header .components-button:hover svg{fill:#fff}.components-guide__container{display:flex;flex-direction:column;justify-content:space-between;margin-top:-60px;min-height:100%}.components-guide__page{display:flex;flex-direction:column;justify-content:center;position:relative}@media (min-width:600px){.components-guide__page{min-height:300px}}.components-guide__footer{align-content:center;display:flex;height:30px;justify-content:center;margin:0 0 24px;padding:0 32px;position:relative;width:100%}.components-guide__page-control{margin:0;text-align:center}.components-guide__page-control li{display:inline-block;margin:0}.components-guide__page-control .components-button{height:30px;min-width:20px;margin:-6px 0}.components-modal__frame.components-guide{border:none;min-width:312px;height:80vh;max-height:575px}@media (max-width:600px){.components-modal__frame.components-guide{margin:auto;max-width:calc(100vw - 32px)}}.components-button.components-guide__back-button,.components-button.components-guide__finish-button,.components-button.components-guide__forward-button{height:30px;position:absolute}.components-button.components-guide__back-button,.components-button.components-guide__forward-button{font-size:13px;padding:4px 2px}.components-button.components-guide__back-button.has-text svg,.components-button.components-guide__forward-button.has-text svg{margin:0}.components-button.components-guide__back-button:hover,.components-button.components-guide__forward-button:hover{text-decoration:underline}.components-button.components-guide__back-button{left:32px}.components-button.components-guide__forward-button{right:32px;color:#1386bf;font-weight:700}.components-button.components-guide__finish-button{right:32px}[role=region]{position:relative}.is-focusing-regions [role=region]:focus:after{content:"";position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;outline:4px solid transparent;box-shadow:inset 0 0 0 4px var(--wp-admin-theme-color)}@supports (outline-offset:1px){.is-focusing-regions [role=region]:focus:after{content:none}.is-focusing-regions [role=region]:focus{outline-style:solid;outline-color:var(--wp-admin-theme-color);outline-width:4px;outline-offset:-4px}}.components-menu-group+.components-menu-group{margin-top:8px;padding-top:8px;border-top:1px solid #1e1e1e}.components-menu-group+.components-menu-group.has-hidden-separator{border-top:none;margin-top:0;padding-top:0}.components-menu-group__label{padding:0 8px;margin-top:4px;margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500;white-space:nowrap}.components-menu-item__button,.components-menu-item__button.components-button{width:100%}.components-menu-item__button.components-button[role=menuitemcheckbox] .components-menu-item__item:only-child,.components-menu-item__button.components-button[role=menuitemradio] .components-menu-item__item:only-child,.components-menu-item__button[role=menuitemcheckbox] .components-menu-item__item:only-child,.components-menu-item__button[role=menuitemradio] .components-menu-item__item:only-child{padding-right:48px}.components-menu-item__button.components-button .components-menu-items__item-icon,.components-menu-item__button .components-menu-items__item-icon{display:inline-block;flex:0 0 auto}.components-menu-item__button.components-button .components-menu-items__item-icon.has-icon-right,.components-menu-item__button .components-menu-items__item-icon.has-icon-right{margin-right:-2px;margin-left:24px}.components-menu-item__button.components-button .components-menu-item__shortcut+.components-menu-items__item-icon.has-icon-right,.components-menu-item__button .components-menu-item__shortcut+.components-menu-items__item-icon.has-icon-right{margin-left:8px}.components-menu-item__button .block-editor-block-icon,.components-menu-item__button.components-button .block-editor-block-icon{margin-left:-2px;margin-right:8px}.components-menu-item__button.components-button.is-primary,.components-menu-item__button.is-primary{justify-content:center}.components-menu-item__button.components-button.is-primary .components-menu-item__item,.components-menu-item__button.is-primary .components-menu-item__item{margin-right:0}.components-menu-item__info-wrapper{display:flex;flex-direction:column;margin-right:auto}.components-menu-item__info{margin-top:4px;font-size:12px;color:#757575;white-space:normal}.components-menu-item__item{white-space:nowrap;min-width:160px;margin-right:auto;display:inline-flex;align-items:center}.components-menu-item__shortcut{align-self:center;margin-right:0;margin-left:auto;padding-left:24px;color:currentColor;display:none}@media (min-width:480px){.components-menu-item__shortcut{display:inline}}.components-menu-items-choice.components-button svg,.components-menu-items-choice svg{margin-right:12px}.components-menu-items-choice.components-button.has-icon,.components-menu-items-choice.has-icon{padding-left:12px}.components-modal__screen-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.35);z-index:100000;display:flex;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-modal__screen-overlay{animation-duration:1ms;animation-delay:0s}}.components-modal__frame{margin:0;width:100%;background:#fff;box-shadow:0 10px 10px rgba(0,0,0,.25);border-radius:2px;overflow:hidden;display:flex}@media (min-width:600px){.components-modal__frame{margin:auto;width:auto;min-width:360px;max-width:calc(100% - 32px);max-height:calc(100% - 120px);animation:components-modal__appear-animation .1s ease-out;animation-fill-mode:forwards}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.components-modal__frame{animation-duration:1ms;animation-delay:0s}}@media (min-width:600px){.components-modal__frame.is-full-screen{width:90vw;min-height:90vh}}@media (min-width:960px){.components-modal__frame{max-height:70%}}@keyframes components-modal__appear-animation{0%{transform:translateY(32px)}to{transform:translateY(0)}}.components-modal__header{box-sizing:border-box;border-bottom:1px solid #ddd;padding:0 32px;display:flex;flex-direction:row;justify-content:space-between;align-items:center;height:60px;width:100%;z-index:10;position:absolute;top:0;left:0}.components-modal__header .components-modal__header-heading{font-size:1rem;font-weight:600}.components-modal__header h1{line-height:1;margin:0}.components-modal__header .components-button{position:relative;left:8px}.components-modal__header-heading-container{align-items:center;flex-grow:1;display:flex;flex-direction:row;justify-content:left}.components-modal__header-icon-container{display:inline-block}.components-modal__header-icon-container svg{max-width:36px;max-height:36px;padding:8px}.components-modal__content{flex:1;margin-top:60px;padding:0 32px 24px;overflow:auto}.components-modal__content:before{content:"";display:block;margin-bottom:24px}.components-modal__content.hide-header{margin-top:0;padding-top:24px}.components-modal__content.hide-header:before{content:none}.components-notice{display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;background-color:#fff;border-left:4px solid var(--wp-admin-theme-color);margin:5px 15px 2px;padding:8px 12px;align-items:center}.components-notice.is-dismissible{padding-right:36px;position:relative}.components-notice.is-success{border-left-color:#4ab866;background-color:#eff9f1}.components-notice.is-warning{border-left-color:#f0b849;background-color:#fef8ee}.components-notice.is-error{border-left-color:#cc1818;background-color:#f4a2a2}.components-notice__content{flex-grow:1;margin:4px 25px 4px 0}.components-notice__actions{display:flex;flex-wrap:wrap}.components-notice__action.components-button{margin-right:8px}.components-notice__action.components-button,.components-notice__action.components-button.is-link{margin-left:12px}.components-notice__action.components-button.is-secondary{vertical-align:initial}.components-notice__dismiss{color:#757575;align-self:flex-start;flex-shrink:0}.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus,.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active,.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{color:#1e1e1e;background-color:transparent}.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{box-shadow:none}.components-notice-list{max-width:100vw;box-sizing:border-box}.components-notice-list .components-notice__content{margin-top:12px;margin-bottom:12px;line-height:2}.components-notice-list .components-notice__action.components-button{display:block;margin-left:0;margin-top:8px}.components-panel{background:#fff;border:1px solid #e0e0e0}.components-panel>.components-panel__body:first-child,.components-panel>.components-panel__header:first-child{margin-top:-1px}.components-panel>.components-panel__body:last-child,.components-panel>.components-panel__header:last-child{border-bottom-width:0}.components-panel+.components-panel{margin-top:-1px}.components-panel__body{border-top:1px solid #e0e0e0;border-bottom:1px solid #e0e0e0}.components-panel__body h3{margin:0 0 .5em}.components-panel__body.is-opened{padding:16px}.components-panel__header{display:flex;justify-content:space-between;align-items:center;padding:0 16px;height:48px;border-bottom:1px solid #ddd}.components-panel__header h2{margin:0;font-size:inherit;color:inherit}.components-panel__body+.components-panel__body,.components-panel__body+.components-panel__header,.components-panel__header+.components-panel__body,.components-panel__header+.components-panel__header{margin-top:-1px}.components-panel__body>.components-panel__body-title{display:block;padding:0;font-size:inherit;margin-top:0;margin-bottom:0;transition:background .1s ease-in-out}@media (prefers-reduced-motion:reduce){.components-panel__body>.components-panel__body-title{transition-duration:0s;transition-delay:0s}}.components-panel__body.is-opened>.components-panel__body-title{margin:-16px -16px 5px}.components-panel__body>.components-panel__body-title:hover{background:#f0f0f0;border:none}.components-panel__body-toggle.components-button{position:relative;padding:16px 48px 16px 16px;outline:none;width:100%;font-weight:500;text-align:left;color:#1e1e1e;border:none;box-shadow:none;transition:background .1s ease-in-out;height:auto}@media (prefers-reduced-motion:reduce){.components-panel__body-toggle.components-button{transition-duration:0s;transition-delay:0s}}.components-panel__body-toggle.components-button:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:0}.components-panel__body-toggle.components-button .components-panel__arrow{position:absolute;right:16px;top:50%;transform:translateY(-50%);color:#1e1e1e;fill:currentColor;transition:color .1s ease-in-out}@media (prefers-reduced-motion:reduce){.components-panel__body-toggle.components-button .components-panel__arrow{transition-duration:0s;transition-delay:0s}}body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right{transform:scaleX(-1);-ms-filter:fliph;filter:FlipH;margin-top:-10px}.components-panel__icon{color:#757575;margin:-2px 0 -2px 6px}.components-panel__body-toggle-icon{margin-right:-5px}.components-panel__color-title{float:left;height:19px}.components-panel__row{display:flex;justify-content:space-between;align-items:center;margin-top:8px;min-height:36px}.components-panel__row select{min-width:0}.components-panel__row label{margin-right:12px;flex-shrink:0;max-width:75%}.components-panel__row:empty,.components-panel__row:first-of-type{margin-top:0}.components-panel .circle-picker{padding-bottom:20px}.components-placeholder.components-placeholder{box-sizing:border-box;position:relative;padding:1em;min-height:200px;width:100%;text-align:left;margin:0;color:#1e1e1e;-moz-font-smoothing:subpixel-antialiased;-webkit-font-smoothing:subpixel-antialiased;border-radius:2px;background-color:#fff;box-shadow:inset 0 0 0 1px #1e1e1e;outline:1px solid transparent}@supports (position:sticky){.components-placeholder.components-placeholder{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}}.components-placeholder.components-placeholder .components-base-control__label{font-size:13px}.components-placeholder__error,.components-placeholder__fieldset,.components-placeholder__instructions,.components-placeholder__label{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-placeholder__label{display:flex;font-weight:600;margin-bottom:16px;align-items:center}.components-placeholder__label .block-editor-block-icon,.components-placeholder__label .dashicon,.components-placeholder__label>svg{margin-right:1ch;fill:currentColor}@media (forced-colors:active){.components-placeholder__label .block-editor-block-icon,.components-placeholder__label .dashicon,.components-placeholder__label>svg{fill:CanvasText}}.components-placeholder__label:empty{display:none}.components-placeholder__fieldset,.components-placeholder__fieldset form{display:flex;flex-direction:row;width:100%;flex-wrap:wrap}.components-placeholder__fieldset form p,.components-placeholder__fieldset p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.components-placeholder__fieldset.components-placeholder__fieldset{border:none;padding:0}.components-placeholder__fieldset.components-placeholder__fieldset .components-placeholder__instructions{padding:0;font-weight:400;font-size:1em}.components-placeholder__fieldset.is-column-layout,.components-placeholder__fieldset.is-column-layout form{flex-direction:column}.components-placeholder__input[type=url]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;margin:0 8px 0 0;flex:1 1 auto}@media (prefers-reduced-motion:reduce){.components-placeholder__input[type=url]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-placeholder__input[type=url]{font-size:13px;line-height:normal}}.components-placeholder__input[type=url]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-placeholder__input[type=url]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-placeholder__input[type=url]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-placeholder__input[type=url]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-placeholder__instructions{margin-bottom:1em}.components-placeholder__error{margin-top:1em;width:100%}.components-placeholder__preview img{margin:3%;width:50%}.components-placeholder__fieldset .components-button{margin-right:12px;margin-bottom:12px}.components-placeholder__fieldset .components-button:last-child{margin-bottom:0;margin-right:0}.components-placeholder__fieldset .components-button:not(.is-link)~.components-button.is-link{margin-left:10px;margin-right:10px}.components-placeholder__fieldset .components-button:not(.is-link)~.components-button.is-link:last-child{margin-right:0}.components-placeholder.is-large .components-placeholder__label{font-size:18pt;font-weight:400}.components-placeholder.is-medium .components-placeholder__instructions,.components-placeholder.is-small .components-placeholder__instructions{display:none}.components-placeholder.is-medium .components-placeholder__fieldset,.components-placeholder.is-medium .components-placeholder__fieldset form,.components-placeholder.is-small .components-placeholder__fieldset,.components-placeholder.is-small .components-placeholder__fieldset form{flex-direction:column}.components-placeholder.is-medium .components-placeholder__fieldset .components-button,.components-placeholder.is-small .components-placeholder__fieldset .components-button{margin-right:auto}.components-placeholder.is-small .components-button{padding:0 8px 2px} - -/*!rtl:begin:ignore*/.components-popover{position:fixed;z-index:1000000;top:0;left:0;opacity:0}.components-popover.is-expanded,.components-popover[data-x-axis][data-y-axis]{opacity:1}.components-popover.is-expanded{top:0;left:0;right:0;bottom:0;z-index:1000000!important}.components-popover:not(.is-without-arrow){margin-left:2px}.components-popover:not(.is-without-arrow):before{border:8px solid #ccc}.components-popover:not(.is-without-arrow).is-alternate:before{border-color:#1e1e1e}.components-popover:not(.is-without-arrow):after{border:8px solid #fff}.components-popover:not(.is-without-arrow):after,.components-popover:not(.is-without-arrow):before{content:"";position:absolute;height:0;width:0;line-height:0}.components-popover:not(.is-without-arrow)[data-y-axis=top]{margin-top:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:before{bottom:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:after{bottom:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=top]:after,.components-popover:not(.is-without-arrow)[data-y-axis=top]:before{border-bottom:none;border-left-color:transparent;border-right-color:transparent;border-top-style:solid;margin-left:-10px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]{margin-top:8px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:before{top:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:after{top:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:after,.components-popover:not(.is-without-arrow)[data-y-axis=bottom]:before{border-bottom-style:solid;border-left-color:transparent;border-right-color:transparent;border-top:none;margin-left:-10px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]{margin-left:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:before{right:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:after{right:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:after,.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]:before{border-bottom-color:transparent;border-left-style:solid;border-right:none;border-top-color:transparent}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]{margin-left:8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:before{left:-8px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:after{left:-6px}.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:after,.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]:before{border-bottom-color:transparent;border-left:none;border-right-style:solid;border-top-color:transparent}.components-popover[data-y-axis=top]{bottom:100%}.components-popover[data-y-axis=bottom]{top:100%}.components-popover[data-y-axis=middle]{align-items:center;display:flex}.components-popover.is-from-top{margin-top:12px}.components-popover.is-from-bottom{margin-top:-12px}.components-popover.is-from-left:not(.is-from-top):not(.is-from-bottom){margin-left:12px}.components-popover.is-from-right:not(.is-from-top):not(.is-from-bottom){margin-right:12px}.components-popover__content{height:100%;background:#fff;border:1px solid #ccc;box-shadow:0 2px 6px rgba(0,0,0,.05);border-radius:2px}.is-alternate .components-popover__content{border:1px solid #1e1e1e;box-shadow:none}.components-popover .components-popover__content{position:absolute;height:auto;overflow-y:auto}.components-popover.is-expanded .components-popover__content{position:static;height:calc(100% - 48px);overflow-y:visible;min-width:auto;border:none;border-top:1px solid #1e1e1e}.components-popover[data-y-axis=top] .components-popover__content{bottom:100%}.components-popover[data-x-axis=center] .components-popover__content{left:50%;transform:translateX(-50%)}.components-popover[data-x-axis=right] .components-popover__content{position:absolute;left:100%}.components-popover:not([data-y-axis=middle])[data-x-axis=right] .components-popover__content{margin-left:-25px}.components-popover[data-x-axis=left] .components-popover__content{position:absolute;right:100%}.components-popover:not([data-y-axis=middle])[data-x-axis=left] .components-popover__content{margin-right:-25px}.components-popover__header{align-items:center;background:#fff;display:flex;height:48px;justify-content:space-between;padding:0 8px 0 16px}.components-popover__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.components-popover__close.components-button{z-index:5} - -/*!rtl:end:ignore*/.components-radio-control{display:flex;flex-direction:column}.components-radio-control .components-base-control__help{margin-top:0}.components-radio-control .components-base-control__field{margin-bottom:0}.components-radio-control__option:not(:last-child){margin-bottom:4px}.components-radio-control__input[type=radio]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;font-size:16px;line-height:normal;border:1px solid #1e1e1e;transition:none;border-radius:50%;width:24px;height:24px;margin-top:0;margin-right:6px}@media (prefers-reduced-motion:reduce){.components-radio-control__input[type=radio]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-radio-control__input[type=radio]{font-size:13px;line-height:normal}}.components-radio-control__input[type=radio]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.components-radio-control__input[type=radio]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-radio-control__input[type=radio]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-radio-control__input[type=radio]:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.components-radio-control__input[type=radio]{height:20px;width:20px}}.components-radio-control__input[type=radio]:checked:before{box-sizing:inherit;width:8px;height:8px;transform:translate(7px,7px);margin:0;background-color:#fff;border:4px solid #fff}@media (min-width:600px){.components-radio-control__input[type=radio]:checked:before{transform:translate(5px,5px)}}.components-radio-control__input[type=radio]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.components-radio-control__input[type=radio]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.components-resizable-box__handle{display:none;width:23px;height:23px;z-index:2}.components-resizable-box__container.has-show-handle .components-resizable-box__handle{display:block}.components-resizable-box__container>img{width:inherit}.components-resizable-box__handle:after{display:block;content:"";width:15px;height:15px;border-radius:50%;background:#fff;cursor:inherit;position:absolute;top:calc(50% - 8px);right:calc(50% - 8px);box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.components-resizable-box__side-handle:before{display:block;border-radius:2px;content:"";width:3px;height:3px;background:var(--wp-admin-theme-color);cursor:inherit;position:absolute;top:calc(50% - 1px);right:calc(50% - 1px);transition:transform .1s ease-in;opacity:0}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle:before{transition-duration:0s;transition-delay:0s}}.components-resizable-box__corner-handle,.components-resizable-box__side-handle{z-index:2}.components-resizable-box__side-handle.components-resizable-box__handle-bottom,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:before,.components-resizable-box__side-handle.components-resizable-box__handle-top,.components-resizable-box__side-handle.components-resizable-box__handle-top:before{width:100%;left:0;border-left:0;border-right:0}.components-resizable-box__side-handle.components-resizable-box__handle-left,.components-resizable-box__side-handle.components-resizable-box__handle-left:before,.components-resizable-box__side-handle.components-resizable-box__handle-right,.components-resizable-box__side-handle.components-resizable-box__handle-right:before{height:100%;top:0;border-top:0;border-bottom:0}.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation:components-resizable-box__top-bottom-animation .1s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation-duration:1ms;animation-delay:0s}}.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before{animation:components-resizable-box__left-right-animation .1s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before{animation-duration:1ms;animation-delay:0s}}@media not all and (-webkit-min-device-pixel-ratio:0),not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none){.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-left:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-right:hover:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:active:before,.components-resizable-box__side-handle.components-resizable-box__handle-top:hover:before{animation:none}}}@keyframes components-resizable-box__top-bottom-animation{0%{transform:scaleX(0);opacity:0}to{transform:scaleX(1);opacity:1}}@keyframes components-resizable-box__left-right-animation{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}} -/*!rtl:begin:ignore*/.components-resizable-box__handle-right{right:-11.5px}.components-resizable-box__handle-left{left:-11.5px}.components-resizable-box__handle-top{top:-11.5px}.components-resizable-box__handle-bottom{bottom:-11.5px} - -/*!rtl:end:ignore*/.components-responsive-wrapper{position:relative;max-width:100%}.components-responsive-wrapper,.components-responsive-wrapper>span{display:block}.components-responsive-wrapper__content{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;margin:auto}.components-sandbox{overflow:hidden}iframe.components-sandbox{width:100%}body.lockscroll,html.lockscroll{overflow:hidden}.components-search-control{position:relative}.components-search-control input[type=search].components-search-control__input{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;line-height:normal;display:block;padding:16px 48px 16px 16px;background:#f0f0f0;border:none;width:100%;height:48px;font-size:16px}@media (prefers-reduced-motion:reduce){.components-search-control input[type=search].components-search-control__input{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-search-control input[type=search].components-search-control__input{font-size:13px;line-height:normal}}.components-search-control input[type=search].components-search-control__input:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-search-control input[type=search].components-search-control__input::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-search-control input[type=search].components-search-control__input::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-search-control input[type=search].components-search-control__input:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.components-search-control input[type=search].components-search-control__input{font-size:13px}}.components-search-control input[type=search].components-search-control__input:focus{background:#fff;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-search-control input[type=search].components-search-control__input::placeholder{color:#757575}.components-search-control input[type=search].components-search-control__input::-webkit-search-cancel-button,.components-search-control input[type=search].components-search-control__input::-webkit-search-decoration,.components-search-control input[type=search].components-search-control__input::-webkit-search-results-button,.components-search-control input[type=search].components-search-control__input::-webkit-search-results-decoration{-webkit-appearance:none}.components-search-control__icon{position:absolute;top:0;right:12px;bottom:0;display:flex;align-items:center}.components-search-control__icon>svg{margin:8px 0}.components-search-control__input-wrapper{position:relative}.components-select-control__input{background:#fff;height:36px;line-height:36px;margin:1px;outline:0;width:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)!important}@media (min-width:782px){.components-select-control__input{height:28px;line-height:28px}}@media (max-width:782px){.components-base-control .components-base-control__field .components-select-control__input{font-size:16px}}.components-snackbar{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;background-color:#1e1e1e;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.3);color:#fff;padding:16px 24px;width:100%;max-width:600px;box-sizing:border-box;cursor:pointer;pointer-events:auto}@media (min-width:600px){.components-snackbar{width:-moz-fit-content;width:fit-content}}.components-snackbar:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color)}.components-snackbar.components-snackbar-explicit-dismiss{cursor:default}.components-snackbar .components-snackbar__content-with-icon{margin-left:24px}.components-snackbar .components-snackbar__icon{position:absolute;top:24px;left:28px}.components-snackbar .components-snackbar__dismiss-button{margin-left:32px;cursor:pointer}.components-snackbar__action.components-button{margin-left:32px;color:#fff;height:auto;flex-shrink:0;line-height:1.4;padding:0}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary){text-decoration:underline;background-color:transparent}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):focus{color:#fff;box-shadow:none;outline:1px dotted #fff}.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover{color:var(--wp-admin-theme-color)}.components-snackbar__content{display:flex;align-items:baseline;justify-content:space-between;line-height:1.4}.components-snackbar-list{position:absolute;z-index:100000;width:100%;box-sizing:border-box;pointer-events:none}.components-snackbar-list__notice-container{position:relative;padding-top:8px}.components-swatch{width:18px;height:18px;border-radius:50%;color:transparent;background:transparent}.components-swatch:after{content:"";display:block;width:100%;height:100%;border:1px solid rgba(0,0,0,.2);border-radius:50%}.components-button.has-icon.has-text .components-swatch{margin-right:8px}.components-tab-panel__tabs{display:flex;align-items:stretch;flex-direction:row}.components-tab-panel__tabs[aria-orientation=vertical]{flex-direction:column}.components-tab-panel__tabs-item{background:transparent;border:none;box-shadow:none;border-radius:0;cursor:pointer;height:48px;padding:3px 16px;margin-left:0;font-weight:500;transition:box-shadow .1s linear;box-sizing:border-box}.components-tab-panel__tabs-item:after{content:attr(data-label);display:block;height:0;overflow:hidden;speak:none;visibility:hidden}.components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-tab-panel__tabs-item.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative}.components-tab-panel__tabs-item.is-active:before{content:"";position:absolute;top:0;bottom:1px;right:0;left:0;border-bottom:4px solid transparent}.components-tab-panel__tabs-item:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-tab-panel__tabs-item.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.components-text-control__input,.components-text-control__input[type=color],.components-text-control__input[type=date],.components-text-control__input[type=datetime-local],.components-text-control__input[type=datetime],.components-text-control__input[type=email],.components-text-control__input[type=month],.components-text-control__input[type=number],.components-text-control__input[type=password],.components-text-control__input[type=tel],.components-text-control__input[type=text],.components-text-control__input[type=time],.components-text-control__input[type=url],.components-text-control__input[type=week]{font-size:13px;line-height:normal}}.components-text-control__input:focus,.components-text-control__input[type=color]:focus,.components-text-control__input[type=date]:focus,.components-text-control__input[type=datetime-local]:focus,.components-text-control__input[type=datetime]:focus,.components-text-control__input[type=email]:focus,.components-text-control__input[type=month]:focus,.components-text-control__input[type=number]:focus,.components-text-control__input[type=password]:focus,.components-text-control__input[type=tel]:focus,.components-text-control__input[type=text]:focus,.components-text-control__input[type=time]:focus,.components-text-control__input[type=url]:focus,.components-text-control__input[type=week]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.components-text-control__input::-webkit-input-placeholder,.components-text-control__input[type=color]::-webkit-input-placeholder,.components-text-control__input[type=date]::-webkit-input-placeholder,.components-text-control__input[type=datetime-local]::-webkit-input-placeholder,.components-text-control__input[type=datetime]::-webkit-input-placeholder,.components-text-control__input[type=email]::-webkit-input-placeholder,.components-text-control__input[type=month]::-webkit-input-placeholder,.components-text-control__input[type=number]::-webkit-input-placeholder,.components-text-control__input[type=password]::-webkit-input-placeholder,.components-text-control__input[type=tel]::-webkit-input-placeholder,.components-text-control__input[type=text]::-webkit-input-placeholder,.components-text-control__input[type=time]::-webkit-input-placeholder,.components-text-control__input[type=url]::-webkit-input-placeholder,.components-text-control__input[type=week]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.components-text-control__input::-moz-placeholder,.components-text-control__input[type=color]::-moz-placeholder,.components-text-control__input[type=date]::-moz-placeholder,.components-text-control__input[type=datetime-local]::-moz-placeholder,.components-text-control__input[type=datetime]::-moz-placeholder,.components-text-control__input[type=email]::-moz-placeholder,.components-text-control__input[type=month]::-moz-placeholder,.components-text-control__input[type=number]::-moz-placeholder,.components-text-control__input[type=password]::-moz-placeholder,.components-text-control__input[type=tel]::-moz-placeholder,.components-text-control__input[type=text]::-moz-placeholder,.components-text-control__input[type=time]::-moz-placeholder,.components-text-control__input[type=url]::-moz-placeholder,.components-text-control__input[type=week]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.components-text-control__input:-ms-input-placeholder,.components-text-control__input[type=color]:-ms-input-placeholder,.components-text-control__input[type=date]:-ms-input-placeholder,.components-text-control__input[type=datetime-local]:-ms-input-placeholder,.components-text-control__input[type=datetime]:-ms-input-placeholder,.components-text-control__input[type=email]:-ms-input-placeholder,.components-text-control__input[type=month]:-ms-input-placeholder,.components-text-control__input[type=number]:-ms-input-placeholder,.components-text-control__input[type=password]:-ms-input-placeholder,.components-text-control__input[type=tel]:-ms-input-placeholder,.components-text-control__input[type=text]:-ms-input-placeholder,.components-text-control__input[type=time]:-ms-input-placeholder,.components-text-control__input[type=url]:-ms-input-placeholder,.components-text-control__input[type=week]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.components-tip{display:flex;color:#757575}.components-tip svg{align-self:center;fill:#f0b849;flex-shrink:0;margin-right:16px}.components-tip p{margin:0}.components-toggle-control .components-base-control__field{display:flex;margin-bottom:12px;line-height:normal;align-items:center}.components-toggle-control .components-base-control__field .components-form-toggle{margin-right:12px}.components-toggle-control .components-base-control__field .components-toggle-control__label{display:block}.components-accessible-toolbar{display:inline-flex;border:1px solid #1e1e1e;border-radius:2px;flex-shrink:0}.components-accessible-toolbar>.components-toolbar-group:last-child{border-right:none}.components-accessible-toolbar .components-button,.components-toolbar .components-button{position:relative;height:48px;z-index:1;padding-left:16px;padding-right:16px}.components-accessible-toolbar .components-button:focus:enabled,.components-toolbar .components-button:focus:enabled{box-shadow:none;outline:none}.components-accessible-toolbar .components-button:before,.components-toolbar .components-button:before{content:"";position:absolute;display:block;border-radius:2px;height:32px;left:8px;right:8px;z-index:-1;animation:components-button__appear-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.components-accessible-toolbar .components-button:before,.components-toolbar .components-button:before{animation-duration:1ms;animation-delay:0s}}.components-accessible-toolbar .components-button svg,.components-toolbar .components-button svg{position:relative;margin-left:auto;margin-right:auto}.components-accessible-toolbar .components-button.is-pressed,.components-accessible-toolbar .components-button.is-pressed:hover,.components-toolbar .components-button.is-pressed,.components-toolbar .components-button.is-pressed:hover{background:transparent}.components-accessible-toolbar .components-button.is-pressed:before,.components-toolbar .components-button.is-pressed:before{background:#1e1e1e}.components-accessible-toolbar .components-button:focus:before,.components-toolbar .components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.components-accessible-toolbar .components-button.has-icon.has-icon,.components-toolbar .components-button.has-icon.has-icon{padding-left:12px;padding-right:12px;min-width:48px}.components-accessible-toolbar .components-button.components-tab-button,.components-toolbar .components-button.components-tab-button{font-weight:500}.components-accessible-toolbar .components-button.components-tab-button span,.components-toolbar .components-button.components-tab-button span{display:inline-block;padding-left:0;padding-right:0;position:relative}@keyframes components-button__appear-animation{0%{transform:scaleY(0)}to{transform:scaleY(1)}}.components-toolbar__control.components-button{position:relative}.components-toolbar__control.components-button[data-subscript] svg{padding:5px 10px 5px 0}.components-toolbar__control.components-button[data-subscript]:after{content:attr(data-subscript);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:600;line-height:12px;position:absolute;right:8px;bottom:10px}.components-toolbar__control.components-button:active:before{display:none}.components-toolbar__control.components-button:not(:disabled).is-pressed[data-subscript]:after{color:#fff}.components-toolbar-group{min-height:48px;border-right:1px solid #1e1e1e;background-color:#fff;display:inline-flex;flex-shrink:0;flex-wrap:wrap;line-height:0}.components-toolbar-group .components-toolbar-group.components-toolbar-group{border-width:0;margin:0}.components-toolbar{min-height:48px;margin:0;border:1px solid #1e1e1e;background-color:#fff;display:inline-flex;flex-shrink:0;flex-wrap:wrap}.components-toolbar .components-toolbar.components-toolbar{border-width:0;margin:0}div.components-toolbar>div{display:block;margin:0}@supports (position:sticky){div.components-toolbar>div{display:flex}}div.components-toolbar>div+div.has-left-divider{margin-left:6px;position:relative;overflow:visible}div.components-toolbar>div+div.has-left-divider:before{display:inline-block;content:"";box-sizing:content-box;background-color:#ddd;position:absolute;top:8px;left:-3px;width:1px;height:20px}.components-tooltip.components-popover{z-index:1000002}.components-tooltip.components-popover .components-popover__content{min-width:0}.components-tooltip .components-popover__content{background:#1e1e1e;border-radius:2px;border-width:0;color:#fff;white-space:nowrap;text-align:center;line-height:1.4;font-size:12px;box-shadow:none}.components-tooltip .components-popover__content>div{padding:4px 8px}.components-tooltip__shortcut{display:inline-block;margin-left:8px}.disabled-element-wrapper{position:relative}.disabled-element-wrapper .event-catcher{z-index:100002;position:absolute;width:100%;height:100%;top:0;left:0;bottom:0;right:0}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-animate__appear { - animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-animate__appear { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-animate__appear.is-from-top, .components-animate__appear.is-from-top.is-from-left { - transform-origin: top right; -} -.components-animate__appear.is-from-top.is-from-right { - transform-origin: top left; -} -.components-animate__appear.is-from-bottom, .components-animate__appear.is-from-bottom.is-from-left { - transform-origin: bottom right; -} -.components-animate__appear.is-from-bottom.is-from-right { - transform-origin: bottom left; -} - -@keyframes components-animate__appear-animation { - from { - transform: translateY(-2em) scaleY(0) scaleX(0); - } - to { - transform: translateY(0%) scaleY(1) scaleX(1); - } -} -.components-animate__slide-in { - animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1); - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-animate__slide-in { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-animate__slide-in.is-from-left { - transform: translateX(-100%); -} -.components-animate__slide-in.is-from-right { - transform: translateX(100%); -} - -@keyframes components-animate__slide-in-animation { - 100% { - transform: translateX(0%); - } -} -.components-animate__loading { - animation: components-animate__loading 1.6s ease-in-out infinite; -} - -@keyframes components-animate__loading { - 0% { - opacity: 0.5; - } - 50% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.components-autocomplete__popover .components-popover__content > div { - padding: 16px; - min-width: 220px; -} - -.components-autocomplete__result.components-button { - display: flex; - height: auto; - min-height: 36px; - text-align: right; - width: 100%; -} -.components-autocomplete__result.components-button.is-selected { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.components-button-group { - display: inline-block; -} -.components-button-group .components-button { - border-radius: 0; - display: inline-flex; - color: #1e1e1e; - box-shadow: inset 0 0 0 1px #1e1e1e; -} -.components-button-group .components-button + .components-button { - margin-right: -1px; -} -.components-button-group .components-button:first-child { - border-radius: 0 2px 2px 0; -} -.components-button-group .components-button:last-child { - border-radius: 2px 0 0 2px; -} -.components-button-group .components-button:focus, .components-button-group .components-button.is-primary { - position: relative; - z-index: 1; -} -.components-button-group .components-button.is-primary { - box-shadow: inset 0 0 0 1px #1e1e1e; -} - -.components-button { - display: inline-flex; - text-decoration: none; - font-family: inherit; - font-weight: normal; - font-size: 13px; - margin: 0; - border: 0; - cursor: pointer; - -webkit-appearance: none; - background: none; - transition: box-shadow 0.1s linear; - height: 36px; - align-items: center; - box-sizing: border-box; - padding: 6px 12px; - border-radius: 2px; - color: #1e1e1e; - /** - * Primary button style. - */ - /** - * Secondary and tertiary buttons. - */ - /** - * Secondary button style. - */ - /** - * Tertiary buttons. - */ - /** - * Destructive buttons. - */ - /** - * Link buttons. - */ -} -@media (prefers-reduced-motion: reduce) { - .components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button[aria-expanded=true], .components-button:hover { - color: var(--wp-admin-theme-color); -} -.components-button[aria-disabled=true]:hover { - color: initial; -} -.components-button:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 3px solid transparent; -} -.components-button.is-primary { - white-space: nowrap; - background: var(--wp-admin-theme-color); - color: #fff; - text-decoration: none; - text-shadow: none; - outline: 1px solid transparent; -} -.components-button.is-primary:hover:not(:disabled) { - background: var(--wp-admin-theme-color-darker-10); - color: #fff; -} -.components-button.is-primary:active:not(:disabled) { - background: var(--wp-admin-theme-color-darker-20); - border-color: var(--wp-admin-theme-color-darker-20); - color: #fff; -} -.components-button.is-primary:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.is-primary:disabled, .components-button.is-primary:disabled:active:enabled, .components-button.is-primary[aria-disabled=true], .components-button.is-primary[aria-disabled=true]:enabled, .components-button.is-primary[aria-disabled=true]:active:enabled { - color: rgba(255, 255, 255, 0.4); - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - opacity: 1; - outline: none; -} -.components-button.is-primary:disabled:focus:enabled, .components-button.is-primary:disabled:active:enabled:focus:enabled, .components-button.is-primary[aria-disabled=true]:focus:enabled, .components-button.is-primary[aria-disabled=true]:enabled:focus:enabled, .components-button.is-primary[aria-disabled=true]:active:enabled:focus:enabled { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); -} -.components-button.is-primary.is-busy, .components-button.is-primary.is-busy:disabled, .components-button.is-primary.is-busy[aria-disabled=true] { - color: #fff; - background-size: 100px 100%; - /* stylelint-disable */ - background-image: linear-gradient(45deg, var(--wp-admin-theme-color) 33%, var(--wp-admin-theme-color-darker-20) 33%, var(--wp-admin-theme-color-darker-20) 70%, var(--wp-admin-theme-color) 70%); - /* stylelint-enable */ - border-color: var(--wp-admin-theme-color); -} -.components-button.is-secondary, .components-button.is-tertiary { - outline: 1px solid transparent; -} -.components-button.is-secondary:active:not(:disabled), .components-button.is-tertiary:active:not(:disabled) { - background: #ddd; - color: var(--wp-admin-theme-color-darker-10); - box-shadow: none; -} -.components-button.is-secondary:hover:not(:disabled), .components-button.is-tertiary:hover:not(:disabled) { - color: var(--wp-admin-theme-color-darker-10); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color-darker-10); -} -.components-button.is-secondary:disabled, .components-button.is-secondary[aria-disabled=true], .components-button.is-secondary[aria-disabled=true]:hover, .components-button.is-tertiary:disabled, .components-button.is-tertiary[aria-disabled=true], .components-button.is-tertiary[aria-disabled=true]:hover { - color: #828282; - background: #eaeaea; - transform: none; - opacity: 1; - box-shadow: none; - outline: none; -} -.components-button.is-secondary { - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - outline: 1px solid transparent; - white-space: nowrap; - color: var(--wp-admin-theme-color); - background: transparent; -} -.components-button.is-tertiary { - white-space: nowrap; - color: var(--wp-admin-theme-color); - background: transparent; - padding: 6px; -} -.components-button.is-tertiary .dashicon { - display: inline-block; - flex: 0 0 auto; -} -p + .components-button.is-tertiary { - margin-right: -6px; -} -.components-button.is-destructive { - color: #cc1818; - box-shadow: inset 0 0 0 1px #cc1818; -} -.components-button.is-destructive:hover:not(:disabled) { - color: #710d0d; - box-shadow: inset 0 0 0 1px #710d0d; -} -.components-button.is-destructive:focus:not(:disabled) { - color: var(--wp-admin-theme-color); -} -.components-button.is-destructive:active:not(:disabled) { - background: #ccc; -} -.components-button.is-destructive.is-primary { - color: #fff; - background: #cc1818; - box-shadow: inset 0 0 0 1px #cc1818; -} -.components-button.is-destructive.is-primary:hover:not(:disabled) { - color: #fff; - background: #710d0d; - box-shadow: inset 0 0 0 1px #710d0d; -} -.components-button.is-destructive.is-tertiary { - box-shadow: none; -} -.components-button.is-destructive.is-tertiary:hover:not(:disabled) { - box-shadow: inset 0 0 0 1px #cc1818; - color: #cc1818; -} -.components-button.is-destructive.is-tertiary:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) #cc1818; - color: #cc1818; -} -.components-button.is-link { - margin: 0; - padding: 0; - box-shadow: none; - border: 0; - border-radius: 0; - background: none; - outline: none; - text-align: right; - color: var(--wp-admin-theme-color); - text-decoration: underline; - transition-property: border, background, color; - transition-duration: 0.05s; - transition-timing-function: ease-in-out; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .components-button.is-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button.is-link:focus { - border-radius: 2px; -} -.components-button.is-link.is-destructive { - color: #cc1818; -} -.components-button.is-link.is-destructive:active:not(:disabled), .components-button.is-link.is-destructive:hover:not(:disabled) { - color: #710d0d; - background: none; -} -.components-button.is-link.is-destructive:focus:not(:disabled) { - color: var(--wp-admin-theme-color); -} -.components-button:not([aria-disabled=true]):active { - color: inherit; -} -.components-button:disabled, .components-button[aria-disabled=true] { - cursor: default; - opacity: 0.3; -} -.components-button.is-busy, .components-button.is-secondary.is-busy, .components-button.is-secondary.is-busy:disabled, .components-button.is-secondary.is-busy[aria-disabled=true] { - animation: components-button__busy-animation 2500ms infinite linear; - opacity: 1; - background-size: 100px 100%; - /* stylelint-disable */ - background-image: linear-gradient(45deg, #fafafa 33%, #e0e0e0 33%, #e0e0e0 70%, #fafafa 70%); - /* stylelint-enable */ -} -.components-button.is-small { - height: 24px; - line-height: 22px; - padding: 0 8px; - font-size: 11px; -} -.components-button.is-small.has-icon:not(.has-text) { - padding: 0 8px; - width: 24px; -} -.components-button.has-icon { - padding: 6px; - min-width: 36px; - justify-content: center; -} -.components-button.has-icon .dashicon { - display: inline-block; - flex: 0 0 auto; - margin-right: 2px; - margin-left: 2px; -} -.components-button.has-icon.has-text { - justify-content: left; -} -.components-button.has-icon.has-text svg { - margin-left: 8px; -} -.components-button.has-icon.has-text .dashicon { - margin-left: 10px; -} -.components-button.is-pressed { - color: #fff; - background: #1e1e1e; -} -.components-button.is-pressed:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-button.is-pressed:hover:not(:disabled) { - color: #fff; - background: #1e1e1e; -} -.components-button svg { - fill: currentColor; - outline: none; -} -@media (forced-colors: active) { - .components-button svg { - fill: CanvasText; - } -} -.components-button .components-visually-hidden { - height: auto; -} - -@keyframes components-button__busy-animation { - 0% { - background-position: 200px 0; - } -} -.components-checkbox-control__input[type=checkbox] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-left: 12px; - transition: none; - border-radius: 2px; - background: #fff; - color: #1e1e1e; - clear: none; - cursor: pointer; - display: inline-block; - line-height: 0; - margin: 0 0 0 4px; - outline: 0; - padding: 0 !important; - text-align: center; - vertical-align: top; - width: 24px; - height: 24px; - -webkit-appearance: none; - appearance: none; - transition: 0.1s border-color ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-checkbox-control__input[type=checkbox] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-checkbox-control__input[type=checkbox] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-checkbox-control__input[type=checkbox]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox]:checked::-ms-check { - opacity: 0; -} -.components-checkbox-control__input[type=checkbox]:checked::before, .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - margin: -3px -5px; - color: #fff; -} -@media (min-width: 782px) { - .components-checkbox-control__input[type=checkbox]:checked::before, .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - margin: -4px -5px 0 0; - } -} -.components-checkbox-control__input[type=checkbox][aria-checked=mixed] { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - content: ""; - float: right; - display: inline-block; - vertical-align: middle; - width: 16px; - /* stylelint-disable */ - font: normal 30px/1 dashicons; - /* stylelint-enable */ - speak: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -@media (min-width: 782px) { - .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - float: none; - font-size: 21px; - } -} -@media (min-width: 600px) { - .components-checkbox-control__input[type=checkbox] { - height: 20px; - width: 20px; - } -} -@media (prefers-reduced-motion: reduce) { - .components-checkbox-control__input[type=checkbox] { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-checkbox-control__input[type=checkbox]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]:checked, .components-checkbox-control__input[type=checkbox]:indeterminate { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox]:checked::-ms-check, .components-checkbox-control__input[type=checkbox]:indeterminate::-ms-check { - opacity: 0; -} -.components-checkbox-control__input[type=checkbox]:checked::before { - content: none; -} - -.components-checkbox-control__input-container { - position: relative; - display: inline-block; - margin-left: 12px; - vertical-align: middle; - width: 24px; - height: 24px; -} -@media (min-width: 600px) { - .components-checkbox-control__input-container { - width: 20px; - height: 20px; - } -} - -svg.components-checkbox-control__checked, -svg.components-checkbox-control__indeterminate { - fill: #fff; - cursor: pointer; - position: absolute; - right: 0; - top: 0; - width: 24px; - height: 24px; - -webkit-user-select: none; - user-select: none; - pointer-events: none; -} -@media (min-width: 600px) { - svg.components-checkbox-control__checked, -svg.components-checkbox-control__indeterminate { - right: -2px; - top: -2px; - } -} - -.components-circular-option-picker { - display: inline-block; - width: 100%; - min-width: 188px; -} -.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper { - display: flex; - justify-content: flex-end; - margin-top: 12px; -} -.components-circular-option-picker .components-circular-option-picker__swatches { - display: flex; - flex-wrap: wrap; - gap: 12px; -} - -.components-circular-option-picker__option-wrapper { - display: inline-block; - height: 28px; - width: 28px; - vertical-align: top; - transform: scale(1); - transition: 100ms transform ease; -} -@media (prefers-reduced-motion: reduce) { - .components-circular-option-picker__option-wrapper { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-circular-option-picker__option-wrapper:hover { - transform: scale(1.2); -} -.components-circular-option-picker__option-wrapper > div { - height: 100%; - width: 100%; -} - -.components-circular-option-picker__option-wrapper::before { - content: ""; - position: absolute; - top: 1px; - right: 1px; - bottom: 1px; - left: 1px; - border-radius: 50%; - z-index: -1; - /* stylelint-disable-next-line function-url-quotes */ - background: url('data:image/svg+xml,%3Csvg width="28" height="28" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M6 8V6H4v2h2zM8 8V6h2v2H8zM10 16H8v-2h2v2zM12 16v-2h2v2h-2zM12 18v-2h-2v2H8v2h2v-2h2zM14 18v2h-2v-2h2zM16 18h-2v-2h2v2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M18 18h2v-2h-2v-2h2v-2h-2v-2h2V8h-2v2h-2V8h-2v2h2v2h-2v2h2v2h2v2zm-2-4v-2h2v2h-2z" fill="%23555D65"/%3E%3Cpath d="M18 18v2h-2v-2h2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M8 10V8H6v2H4v2h2v2H4v2h2v2H4v2h2v2H4v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2v2h-2V4h-2v2h-2V4h-2v2h-2V4h-2v2h2v2h-2v2H8zm0 2v-2H6v2h2zm2 0v-2h2v2h-2zm0 2v-2H8v2H6v2h2v2H6v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h-2v2h-2V6h-2v2h-2v2h2v2h-2v2h-2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M4 0H2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2H8V0H6v2H4V0zm0 4V2H2v2h2zm2 0V2h2v2H6zm0 2V4H4v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2H8v2H6z" fill="%23555D65"/%3E%3C/svg%3E'); -} - -.components-circular-option-picker__option { - display: inline-block; - vertical-align: top; - height: 100%; - width: 100%; - border: none; - border-radius: 50%; - background: transparent; - box-shadow: inset 0 0 0 14px; - transition: 100ms box-shadow ease; - cursor: pointer; -} -@media (prefers-reduced-motion: reduce) { - .components-circular-option-picker__option { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-circular-option-picker__option:hover { - box-shadow: inset 0 0 0 14px !important; -} -.components-circular-option-picker__option.is-pressed { - box-shadow: inset 0 0 0 4px; - position: relative; - z-index: 1; - overflow: visible; -} -.components-circular-option-picker__option.is-pressed + svg { - position: absolute; - right: 2px; - top: 2px; - border-radius: 50%; - z-index: 2; - pointer-events: none; -} -.components-circular-option-picker__option::after { - content: ""; - position: absolute; - top: -1px; - right: -1px; - bottom: -1px; - left: -1px; - border-radius: 50%; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - border: 1px solid transparent; -} -.components-circular-option-picker__option:focus::after { - content: ""; - border: 2px solid #757575; - width: 32px; - height: 32px; - position: absolute; - top: -2px; - right: -2px; - border-radius: 50%; - box-shadow: inset 0 0 0 2px #fff; -} -.components-circular-option-picker__option.components-button:focus { - background-color: transparent; - box-shadow: inset 0 0 0 14px; - outline: none; -} - -.components-circular-option-picker__button-action .components-circular-option-picker__option { - color: #fff; - background: #fff; -} - -.components-circular-option-picker__dropdown-link-action { - margin-left: 16px; -} -.components-circular-option-picker__dropdown-link-action .components-button { - line-height: 22px; -} - -@media (min-width: 782px) { - .components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content { - margin-left: 156px; - margin-top: -49px; - } -} -.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar { - margin-top: 0; -} -.components-palette-edit__popover .components-custom-gradient-picker__ui-line { - margin-bottom: 0; -} -.components-palette-edit__popover .components-custom-gradient-picker { - width: 280px; - padding: 8px; -} - -.components-dropdown-menu__menu .components-palette-edit__menu-button { - width: 100%; -} - -.component-color-indicator { - width: 20px; - height: 20px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - border-radius: 50%; - display: inline-block; - padding: 0; -} - -.components-combobox-control { - width: 100%; -} - -input.components-combobox-control__input[type=text] { - width: 100%; - border: none; - box-shadow: none; - font-family: inherit; - font-size: 16px; - padding: 2px; - margin: 0; - line-height: inherit; - min-height: auto; -} -@media (min-width: 600px) { - input.components-combobox-control__input[type=text] { - font-size: 13px; - } -} -input.components-combobox-control__input[type=text]:focus { - outline: none; - box-shadow: none; -} - -.components-combobox-control__suggestions-container { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: flex; - flex-wrap: wrap; - align-items: flex-start; - width: 100%; - margin: 0 0 8px 0; - padding: 4px; -} -@media (prefers-reduced-motion: reduce) { - .components-combobox-control__suggestions-container { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-combobox-control__suggestions-container { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-combobox-control__suggestions-container:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-combobox-control__suggestions-container::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container:focus-within { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.components-combobox-control__reset.components-button { - display: flex; - height: 16px; - min-width: 16px; - padding: 0; -} - -.components-color-list-picker, -.components-color-list-picker__swatch-button { - width: 100%; -} - -.components-color-list-picker__color-picker { - margin: 8px 0; -} - -.components-color-palette__custom-color { - position: relative; - border: none; - background: none; - border-radius: 2px; - height: 64px; - padding: 12px; - font-family: inherit; - width: 100%; - background-image: repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0), repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0); - background-position: 100% 0, 25px 25px; - background-size: calc(2 * 25px) calc(2 * 25px); - box-sizing: border-box; - color: #fff; - cursor: pointer; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - outline: 1px solid transparent; -} -.components-color-palette__custom-color:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline-width: 2px; -} - -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content { - overflow: visible; - box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05); - border: none; - border-radius: 2px; - max-height: -moz-fit-content !important; - max-height: fit-content !important; -} -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content > div { - padding: 0; -} -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation { - border-top-left-radius: 2px; - border-top-right-radius: 2px; -} - -@media (min-width: 782px) { - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar .components-popover__content.components-popover__content { - margin-left: 156px; - } - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content { - margin-top: -60px; - } - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-bottom .components-popover__content { - margin-bottom: -60px; - } -} -.components-color-palette__custom-color-name { - text-align: right; -} - -.components-color-palette__custom-color-value { - margin-right: 16px; - text-transform: uppercase; -} - -.components-custom-gradient-picker__gradient-bar:not(.has-gradient) { - opacity: 0.4; -} - -.components-custom-gradient-picker__gradient-bar { - border-radius: 2px; - margin-top: 12px; - width: 100%; - height: 48px; - margin-bottom: 20px; - padding-right: 16px; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__markers-container { - position: relative; - width: calc(100% - 32px); - margin-right: auto; - margin-left: auto; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point { - border-radius: 50%; - background: #fff; - padding: 2px; - top: 16px; - min-width: 16px; - width: 16px; - height: 16px; - position: relative; - color: #1e1e1e; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point svg { - height: 100%; - width: 100%; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button { - border-radius: 50%; - height: 16px; - width: 16px; - padding: 0; - position: absolute; - top: 16px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #fff, 0 0 2px 0 rgba(0, 0, 0, 0.25); - outline: 2px solid transparent; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button:focus, .components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button.is-active { - box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) #fff, 0 0 2px 0 rgba(0, 0, 0, 0.25); - outline: 4px solid transparent; -} - -.components-custom-gradient-picker__color-picker-popover .components-custom-gradient-picker__remove-control-point { - margin-right: auto; - margin-left: auto; - display: block; - margin-bottom: 8px; -} - -.components-custom-gradient-picker__inserter { - direction: ltr; - width: 100%; -} - -.components-custom-gradient-picker__liner-gradient-indicator { - display: inline-block; - flex: 0 auto; - width: 20px; - height: 20px; -} - -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line { - margin-bottom: 16px; -} -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-angle-picker, -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-custom-gradient-picker__type-picker { - margin-bottom: 0; -} - -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar { - border: none; -} -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar > div + div { - margin-right: 1px; -} -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar button.is-pressed > svg { - background: #fff; - border: 1px solid #949494; - border-radius: 2px; -} - -.components-custom-gradient-picker .components-input-control__label { - line-height: 1; -} -.components-custom-gradient-picker label { - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.components-custom-select-control { - position: relative; -} - -.components-custom-select-control__label { - display: block; - margin-bottom: 8px; -} - -.components-custom-select-control__button { - border: 1px solid #757575; - border-radius: 2px; - min-width: 130px; - position: relative; - text-align: right; -} -.components-custom-select-control__button:not(.is-next-36px-default-size) { - min-height: 30px; -} -.components-custom-select-control__button.components-custom-select-control__button { - padding-right: 16px; - padding-left: 32px; -} -.components-custom-select-control__button.components-custom-select-control__button:not(.is-next-36px-default-size) { - padding-right: 8px; - padding-left: 24px; -} -.components-custom-select-control__button:focus:not(:disabled) { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.components-custom-select-control__button .components-custom-select-control__button-icon { - height: 100%; - padding: 0; - position: absolute; - left: 8px; - top: 0; -} -.components-custom-select-control__button .components-custom-select-control__button-icon:not(.is-next-36px-default-size) { - left: 4px; -} - -.components-custom-select-control__menu { - border: 1px solid #1e1e1e; - background-color: #fff; - border-radius: 2px; - outline: none; - transition: none; - max-height: 400px; - min-width: 100%; - overflow: auto; - padding: 0; - position: absolute; - z-index: 1000000; -} -.components-custom-select-control__menu[aria-hidden=true] { - display: none; -} - -.components-custom-select-control__item { - align-items: center; - display: grid; - grid-template-columns: auto auto; - list-style-type: none; - padding: 8px 16px; - cursor: default; - line-height: 28px; -} -.components-custom-select-control__item:not(.is-next-36px-default-size) { - padding: 8px; -} -.components-custom-select-control__item.has-hint { - grid-template-columns: auto auto 30px; -} -.components-custom-select-control__item.is-highlighted { - background: #ddd; -} -.components-custom-select-control__item .components-custom-select-control__item-hint { - color: #757575; - text-align: left; - padding-left: 4px; -} -.components-custom-select-control__item .components-custom-select-control__item-icon { - margin-right: auto; -} -.components-custom-select-control__item:last-child { - margin-bottom: 0; -} - -/** - * Parts of this source were derived and modified from react-dates, - * released under the MIT license. - * - * https://github.com/airbnb/react-dates - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Airbnb - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -.PresetDateRangePicker_panel { - padding: 0 22px 11px; -} - -.PresetDateRangePicker_button { - position: relative; - height: 100%; - text-align: center; - background: 0 0; - border: 2px solid #00a699; - color: #00a699; - padding: 4px 12px; - margin-right: 8px; - font: inherit; - font-weight: 700; - line-height: normal; - overflow: visible; - box-sizing: border-box; - cursor: pointer; -} - -.PresetDateRangePicker_button:active { - outline: 0; -} - -.PresetDateRangePicker_button__selected { - color: #fff; - background: #00a699; -} - -.SingleDatePickerInput { - display: inline-block; - background-color: #fff; -} - -.SingleDatePickerInput__withBorder { - border-radius: 2px; - border: 1px solid #dbdbdb; -} - -.SingleDatePickerInput__rtl { - direction: rtl; -} - -.SingleDatePickerInput__disabled { - background-color: #f2f2f2; -} - -.SingleDatePickerInput__block { - display: block; -} - -.SingleDatePickerInput__showClearDate { - padding-right: 30px; -} - -.SingleDatePickerInput_clearDate { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - padding: 10px; - margin: 0 10px 0 5px; - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} - -.SingleDatePickerInput_clearDate__default:focus, -.SingleDatePickerInput_clearDate__default:hover { - background: #dbdbdb; - border-radius: 50%; -} - -.SingleDatePickerInput_clearDate__small { - padding: 6px; -} - -.SingleDatePickerInput_clearDate__hide { - visibility: hidden; -} - -.SingleDatePickerInput_clearDate_svg { - fill: #82888a; - height: 12px; - width: 15px; - vertical-align: middle; -} - -.SingleDatePickerInput_clearDate_svg__small { - height: 9px; -} - -.SingleDatePickerInput_calendarIcon { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - display: inline-block; - vertical-align: middle; - padding: 10px; - margin: 0 5px 0 10px; -} - -.SingleDatePickerInput_calendarIcon_svg { - fill: #82888a; - height: 15px; - width: 14px; - vertical-align: middle; -} - -.SingleDatePicker { - position: relative; - display: inline-block; -} - -.SingleDatePicker__block { - display: block; -} - -.SingleDatePicker_picker { - z-index: 1; - background-color: #fff; - position: absolute; -} - -.SingleDatePicker_picker__rtl { - direction: rtl; -} - -.SingleDatePicker_picker__directionLeft { - left: 0; -} - -.SingleDatePicker_picker__directionRight { - right: 0; -} - -.SingleDatePicker_picker__portal { - background-color: rgba(0, 0, 0, 0.3); - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; -} - -.SingleDatePicker_picker__fullScreenPortal { - background-color: #fff; -} - -.SingleDatePicker_closeButton { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - position: absolute; - top: 0; - right: 0; - padding: 15px; - z-index: 2; -} - -.SingleDatePicker_closeButton:focus, -.SingleDatePicker_closeButton:hover { - color: #b0b3b4; - text-decoration: none; -} - -.SingleDatePicker_closeButton_svg { - height: 15px; - width: 15px; - fill: #cacccd; -} - -.DayPickerKeyboardShortcuts_buttonReset { - background: 0 0; - border: 0; - border-radius: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - padding: 0; - cursor: pointer; - font-size: 14px; -} - -.DayPickerKeyboardShortcuts_buttonReset:active { - outline: 0; -} - -.DayPickerKeyboardShortcuts_show { - width: 22px; - position: absolute; - z-index: 2; -} - -.DayPickerKeyboardShortcuts_show__bottomRight { - border-top: 26px solid transparent; - border-right: 33px solid #00a699; - bottom: 0; - right: 0; -} - -.DayPickerKeyboardShortcuts_show__bottomRight:hover { - border-right: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_show__topRight { - border-bottom: 26px solid transparent; - border-right: 33px solid #00a699; - top: 0; - right: 0; -} - -.DayPickerKeyboardShortcuts_show__topRight:hover { - border-right: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_show__topLeft { - border-bottom: 26px solid transparent; - border-left: 33px solid #00a699; - top: 0; - left: 0; -} - -.DayPickerKeyboardShortcuts_show__topLeft:hover { - border-left: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_showSpan { - color: #fff; - position: absolute; -} - -.DayPickerKeyboardShortcuts_showSpan__bottomRight { - bottom: 0; - right: -28px; -} - -.DayPickerKeyboardShortcuts_showSpan__topRight { - top: 1px; - right: -28px; -} - -.DayPickerKeyboardShortcuts_showSpan__topLeft { - top: 1px; - left: -28px; -} - -.DayPickerKeyboardShortcuts_panel { - overflow: auto; - background: #fff; - border: 1px solid #dbdbdb; - border-radius: 2px; - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - z-index: 2; - padding: 22px; - margin: 33px; -} - -.DayPickerKeyboardShortcuts_title { - font-size: 16px; - font-weight: 700; - margin: 0; -} - -.DayPickerKeyboardShortcuts_list { - list-style: none; - padding: 0; - font-size: 14px; -} - -.DayPickerKeyboardShortcuts_close { - position: absolute; - right: 22px; - top: 22px; - z-index: 2; -} - -.DayPickerKeyboardShortcuts_close:active { - outline: 0; -} - -.DayPickerKeyboardShortcuts_closeSvg { - height: 15px; - width: 15px; - fill: #cacccd; -} - -.DayPickerKeyboardShortcuts_closeSvg:focus, -.DayPickerKeyboardShortcuts_closeSvg:hover { - fill: #82888a; -} - -.CalendarDay { - box-sizing: border-box; - cursor: pointer; - font-size: 14px; - text-align: center; -} - -.CalendarDay:active { - outline: 0; -} - -.CalendarDay__defaultCursor { - cursor: default; -} - -.CalendarDay__default { - border: 1px solid #e4e7e7; - color: #484848; - background: #fff; -} - -.CalendarDay__default:hover { - background: #e4e7e7; - border: 1px double #e4e7e7; - color: inherit; -} - -.CalendarDay__hovered_offset { - background: #f4f5f5; - border: 1px double #e4e7e7; - color: inherit; -} - -.CalendarDay__outside { - border: 0; - background: #fff; - color: #484848; -} - -.CalendarDay__outside:hover { - border: 0; -} - -.CalendarDay__blocked_minimum_nights { - background: #fff; - border: 1px solid #eceeee; - color: #cacccd; -} - -.CalendarDay__blocked_minimum_nights:active, -.CalendarDay__blocked_minimum_nights:hover { - background: #fff; - color: #cacccd; -} - -.CalendarDay__highlighted_calendar { - background: #ffe8bc; - color: #484848; -} - -.CalendarDay__highlighted_calendar:active, -.CalendarDay__highlighted_calendar:hover { - background: #ffce71; - color: #484848; -} - -.CalendarDay__selected_span { - background: #66e2da; - border: 1px solid #33dacd; - color: #fff; -} - -.CalendarDay__selected_span:active, -.CalendarDay__selected_span:hover { - background: #33dacd; - border: 1px solid #33dacd; - color: #fff; -} - -.CalendarDay__last_in_range { - border-right: #00a699; -} - -.CalendarDay__selected, -.CalendarDay__selected:active, -.CalendarDay__selected:hover { - background: #00a699; - border: 1px solid #00a699; - color: #fff; -} - -.CalendarDay__hovered_span, -.CalendarDay__hovered_span:hover { - background: #b2f1ec; - border: 1px solid #80e8e0; - color: #007a87; -} - -.CalendarDay__hovered_span:active { - background: #80e8e0; - border: 1px solid #80e8e0; - color: #007a87; -} - -.CalendarDay__blocked_calendar, -.CalendarDay__blocked_calendar:active, -.CalendarDay__blocked_calendar:hover { - background: #cacccd; - border: 1px solid #cacccd; - color: #82888a; -} - -.CalendarDay__blocked_out_of_range, -.CalendarDay__blocked_out_of_range:active, -.CalendarDay__blocked_out_of_range:hover { - background: #fff; - border: 1px solid #e4e7e7; - color: #cacccd; -} - -.CalendarMonth { - background: #fff; - text-align: center; - vertical-align: top; - -webkit-user-select: none; - user-select: none; -} - -.CalendarMonth_table { - border-collapse: collapse; - border-spacing: 0; -} - -.CalendarMonth_verticalSpacing { - border-collapse: separate; -} - -.CalendarMonth_caption { - color: #484848; - font-size: 18px; - text-align: center; - padding-top: 22px; - padding-bottom: 37px; - caption-side: initial; -} - -.CalendarMonth_caption__verticalScrollable { - padding-top: 12px; - padding-bottom: 7px; -} - -.CalendarMonthGrid { - background: #fff; - text-align: left; - z-index: 0; -} - -.CalendarMonthGrid__animating { - z-index: 1; -} - -.CalendarMonthGrid__horizontal { - position: absolute; - left: 0; -} - -.CalendarMonthGrid__vertical { - margin: 0 auto; -} - -.CalendarMonthGrid__vertical_scrollable { - margin: 0 auto; - overflow-y: scroll; -} - -.CalendarMonthGrid_month__horizontal { - display: inline-block; - vertical-align: top; - min-height: 100%; -} - -.CalendarMonthGrid_month__hideForAnimation { - position: absolute; - z-index: -1; - opacity: 0; - pointer-events: none; -} - -.CalendarMonthGrid_month__hidden { - visibility: hidden; -} - -.DayPickerNavigation { - position: relative; - z-index: 2; -} - -.DayPickerNavigation__horizontal { - height: 0; -} - -.DayPickerNavigation__verticalDefault { - position: absolute; - width: 100%; - height: 52px; - bottom: 0; - left: 0; -} - -.DayPickerNavigation__verticalScrollableDefault { - position: relative; -} - -.DayPickerNavigation_button { - cursor: pointer; - -webkit-user-select: none; - user-select: none; - border: 0; - padding: 0; - margin: 0; -} - -.DayPickerNavigation_button__default { - border: 1px solid #e4e7e7; - background-color: #fff; - color: #757575; -} - -.DayPickerNavigation_button__default:focus, -.DayPickerNavigation_button__default:hover { - border: 1px solid #c4c4c4; -} - -.DayPickerNavigation_button__default:active { - background: #f2f2f2; -} - -.DayPickerNavigation_button__horizontalDefault { - position: absolute; - top: 18px; - line-height: 0.78; - border-radius: 3px; - padding: 6px 9px; -} - -.DayPickerNavigation_leftButton__horizontalDefault { - left: 22px; -} - -.DayPickerNavigation_rightButton__horizontalDefault { - right: 22px; -} - -.DayPickerNavigation_button__verticalDefault { - padding: 5px; - background: #fff; - box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1); - position: relative; - display: inline-block; - height: 100%; - width: 50%; -} - -.DayPickerNavigation_nextButton__verticalDefault { - border-left: 0; -} - -.DayPickerNavigation_nextButton__verticalScrollableDefault { - width: 100%; -} - -.DayPickerNavigation_svg__horizontal { - height: 19px; - width: 19px; - fill: #82888a; - display: block; -} - -.DayPickerNavigation_svg__vertical { - height: 42px; - width: 42px; - fill: #484848; - display: block; -} - -.DayPicker { - background: #fff; - position: relative; - text-align: left; -} - -.DayPicker__horizontal { - background: #fff; -} - -.DayPicker__verticalScrollable { - height: 100%; -} - -.DayPicker__hidden { - visibility: hidden; -} - -.DayPicker__withBorder { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.07); - border-radius: 3px; -} - -.DayPicker_portal__horizontal { - box-shadow: none; - position: absolute; - left: 50%; - top: 50%; -} - -.DayPicker_portal__vertical { - position: initial; -} - -.DayPicker_focusRegion { - outline: 0; -} - -.DayPicker_calendarInfo__horizontal, -.DayPicker_wrapper__horizontal { - display: inline-block; - vertical-align: top; -} - -.DayPicker_weekHeaders { - position: relative; -} - -.DayPicker_weekHeaders__horizontal { - margin-left: 13px; -} - -.DayPicker_weekHeader { - color: #757575; - position: absolute; - top: 62px; - z-index: 2; - text-align: left; - padding: 0 !important; -} - -.DayPicker_weekHeader__vertical { - left: 50%; -} - -.DayPicker_weekHeader__verticalScrollable { - top: 0; - display: table-row; - border-bottom: 1px solid #dbdbdb; - background: #fff; - margin-left: 0; - left: 0; - width: 100%; - text-align: center; -} - -.DayPicker_weekHeader_ul { - list-style: none; - margin: 1px 0; - padding-left: 0; - padding-right: 0; - font-size: 14px; -} - -.DayPicker_weekHeader_li { - display: inline-block; - text-align: center; - margin: 0 1px; -} - -.DayPicker_transitionContainer { - position: relative; - overflow: hidden; - border-radius: 3px; -} - -.DayPicker_transitionContainer__horizontal { - transition: height 0.2s ease-in-out; -} - -.DayPicker_transitionContainer__vertical { - width: 100%; -} - -.DayPicker_transitionContainer__verticalScrollable { - padding-top: 20px; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - overflow-y: scroll; -} - -.DateInput { - margin: 0; - padding: 0; - background: #fff; - position: relative; - display: inline-block; - width: 130px; - vertical-align: middle; -} - -.DateInput__small { - width: 97px; -} - -.DateInput__block { - width: 100%; -} - -.DateInput__disabled { - background: #f2f2f2; - color: #dbdbdb; -} - -.DateInput_input { - font-weight: 200; - font-size: 19px; - line-height: 24px; - color: #484848; - background-color: #fff; - width: 100%; - padding: 11px 11px 9px; - border: 0; - border-top: 0; - border-right: 0; - border-bottom: 2px solid transparent; - border-left: 0; - border-radius: 0; -} - -.DateInput_input__small { - font-size: 15px; - line-height: 18px; - letter-spacing: 0.2px; - padding: 7px 7px 5px; -} - -.DateInput_input__regular { - font-weight: auto; -} - -.DateInput_input__readOnly { - -webkit-user-select: none; - user-select: none; -} - -.DateInput_input__focused { - outline: 0; - background: #fff; - border: 0; - border-top: 0; - border-right: 0; - border-bottom: 2px solid #008489; - border-left: 0; -} - -.DateInput_input__disabled { - background: #f2f2f2; - font-style: italic; -} - -.DateInput_screenReaderMessage { - border: 0; - clip: rect(0, 0, 0, 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -.DateInput_fang { - position: absolute; - width: 20px; - height: 10px; - left: 22px; - z-index: 2; -} - -.DateInput_fangShape { - fill: #fff; -} - -.DateInput_fangStroke { - stroke: #dbdbdb; - fill: transparent; -} - -.DateRangePickerInput { - background-color: #fff; - display: inline-block; -} - -.DateRangePickerInput__disabled { - background: #f2f2f2; -} - -.DateRangePickerInput__withBorder { - border-radius: 2px; - border: 1px solid #dbdbdb; -} - -.DateRangePickerInput__rtl { - direction: rtl; -} - -.DateRangePickerInput__block { - display: block; -} - -.DateRangePickerInput__showClearDates { - padding-right: 30px; -} - -.DateRangePickerInput_arrow { - display: inline-block; - vertical-align: middle; - color: #484848; -} - -.DateRangePickerInput_arrow_svg { - vertical-align: middle; - fill: #484848; - height: 24px; - width: 24px; -} - -.DateRangePickerInput_clearDates { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - padding: 10px; - margin: 0 10px 0 5px; - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} - -.DateRangePickerInput_clearDates__small { - padding: 6px; -} - -.DateRangePickerInput_clearDates_default:focus, -.DateRangePickerInput_clearDates_default:hover { - background: #dbdbdb; - border-radius: 50%; -} - -.DateRangePickerInput_clearDates__hide { - visibility: hidden; -} - -.DateRangePickerInput_clearDates_svg { - fill: #82888a; - height: 12px; - width: 15px; - vertical-align: middle; -} - -.DateRangePickerInput_clearDates_svg__small { - height: 9px; -} - -.DateRangePickerInput_calendarIcon { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - display: inline-block; - vertical-align: middle; - padding: 10px; - margin: 0 5px 0 10px; -} - -.DateRangePickerInput_calendarIcon_svg { - fill: #82888a; - height: 15px; - width: 14px; - vertical-align: middle; -} - -.DateRangePicker { - position: relative; - display: inline-block; -} - -.DateRangePicker__block { - display: block; -} - -.DateRangePicker_picker { - z-index: 1; - background-color: #fff; - position: absolute; -} - -.DateRangePicker_picker__rtl { - direction: rtl; -} - -.DateRangePicker_picker__directionLeft { - left: 0; -} - -.DateRangePicker_picker__directionRight { - right: 0; -} - -.DateRangePicker_picker__portal { - background-color: rgba(0, 0, 0, 0.3); - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; -} - -.DateRangePicker_picker__fullScreenPortal { - background-color: #fff; -} - -.DateRangePicker_closeButton { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - position: absolute; - top: 0; - right: 0; - padding: 15px; - z-index: 2; -} - -.DateRangePicker_closeButton:focus, -.DateRangePicker_closeButton:hover { - color: #b0b3b4; - text-decoration: none; -} - -.DateRangePicker_closeButton_svg { - height: 15px; - width: 15px; - fill: #cacccd; -} -.components-datetime { - padding: 16px; -} -.components-panel__body .components-datetime { - padding: 0; -} -.components-datetime .components-datetime__calendar-help { - padding: 16px; - min-width: 260px; -} -.components-datetime .components-datetime__calendar-help h4 { - margin: 0; -} -.components-datetime .components-datetime__buttons { - display: flex; - justify-content: space-between; -} -.components-datetime .components-datetime__date-help-toggle { - display: block; - margin-right: auto; -} -.components-datetime fieldset { - border: 0; - padding: 0; - margin: 0; -} -.components-datetime select, -.components-datetime input { - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; -} -@media (prefers-reduced-motion: reduce) { - .components-datetime select, -.components-datetime input { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-datetime select, -.components-datetime input[type=number], -.components-datetime .components-button { - height: 30px; - margin-top: 0; - margin-bottom: 0; -} -.components-datetime .components-button:focus { - z-index: 1; -} - -.components-datetime__date { - min-height: 236px; - border-top: 1px solid #ddd; -} -.components-datetime__date .DayPickerNavigation_leftButton__horizontalDefault { - left: 13px; -} -.components-datetime__date .CalendarMonth_caption { - font-size: 13px; -} -.components-datetime__date .CalendarMonth_table { - border-collapse: separate; - border-spacing: 2px; -} -.components-datetime__date .CalendarDay { - font-size: 13px; - border: none; - border-radius: 50%; - text-align: center; -} -.components-datetime__date .CalendarDay:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; - outline: 2px solid transparent; -} -.components-datetime__date .CalendarDay__selected { - background: var(--wp-admin-theme-color); - border: 2px solid transparent; -} -.components-datetime__date .CalendarDay__selected:hover { - background: var(--wp-admin-theme-color-darker-20); -} -.components-datetime__date .CalendarDay__selected:focus { - box-shadow: inset 0 0 0 1px #fff; -} -.components-datetime__date .DayPickerNavigation_button__horizontalDefault { - padding: 2px 8px; - top: 20px; -} -.components-datetime__date .DayPickerNavigation_button__horizontalDefault:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-datetime__date .DayPicker_weekHeader { - top: 50px; -} -.components-datetime__date .DayPicker_weekHeader .DayPicker_weekHeader_ul { - margin: 1px; - padding-right: 0; - padding-left: 0; -} -.components-datetime__date.is-description-visible .DayPicker { - visibility: hidden; -} - -.components-datetime__date .CalendarDay .components-datetime__date__day { - height: 100%; - display: flex; - justify-content: center; - align-content: center; - flex-direction: column; - position: relative; -} -.components-datetime__date .CalendarDay .components-datetime__date__day.has-events::before { - content: " "; - width: 4px; - height: 4px; - border-radius: 2px; - position: absolute; - right: 50%; - margin-right: -2px; - bottom: 0; - background-color: #fff; -} - -.components-datetime__date .CalendarDay:not(.CalendarDay__selected) .components-datetime__date__day.has-events::before { - background: var(--wp-admin-theme-color); -} - -.components-datetime__time { - padding-bottom: 16px; -} -.components-datetime__time fieldset { - position: relative; - margin-bottom: 0.5em; -} -.components-datetime__time fieldset + fieldset { - margin-bottom: 0; -} -.components-datetime__time .components-datetime__time-field-am-pm fieldset { - margin-top: 0; -} -.components-datetime__time .components-datetime__time-wrapper { - display: flex; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-separator { - display: inline-block; - padding: 0 0 0 3px; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field-time { - direction: ltr; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select { - margin-left: 4px; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select:focus { - position: relative; - z-index: 1; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number] { - padding: 2px; - margin-left: 4px; - text-align: center; - -moz-appearance: textfield; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]:focus { - position: relative; - z-index: 1; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} -.components-datetime__time.is-12-hour .components-datetime__time-field-day input { - margin: -4px 0 0 !important; - border-radius: 0 2px 2px 0 !important; -} -.components-datetime__time.is-12-hour .components-datetime__time-field-year input { - border-radius: 2px 0 0 2px !important; -} - -.components-datetime__timezone { - line-height: 30px; - margin-right: 4px; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -.components-datetime__time-legend { - font-weight: 600; - margin-top: 0.5em; -} -.components-datetime__time-legend.invisible { - position: absolute; - top: -999em; - right: -999em; -} - -.components-datetime__time-field-integer-field { - font-family: inherit; -} - -.components-datetime__time-field-hours-input, -.components-datetime__time-field-minutes-input, -.components-datetime__time-field-day-input { - width: 35px; -} - -.components-datetime__time-field-year-input { - width: 55px; -} - -.components-datetime__time-field-month-select { - max-width: 145px; -} - -.components-popover .components-datetime__date { - padding-right: 4px; -} - -.block-editor-dimension-control .components-base-control__field { - display: flex; - align-items: center; -} -.block-editor-dimension-control .components-base-control__label { - display: flex; - align-items: center; - margin-left: 1em; - margin-bottom: 0; -} -.block-editor-dimension-control .components-base-control__label .dashicon { - margin-left: 0.5em; -} -.block-editor-dimension-control.is-manual .components-base-control__label { - width: 10em; -} - -body.is-dragging-components-draggable { - cursor: move; - /* Fallback for IE/Edge < 14 */ - cursor: grabbing !important; -} - -.components-draggable__invisible-drag-image { - position: fixed; - right: -1000px; - height: 50px; - width: 50px; -} - -.components-draggable__clone { - position: fixed; - padding: 0; - background: transparent; - pointer-events: none; - z-index: 1000000000; -} - -.components-drop-zone { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 40; - visibility: hidden; - opacity: 0; - border-radius: 2px; -} -.components-drop-zone.is-active { - opacity: 1; - visibility: visible; -} - -.components-drop-zone__content { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - height: 100%; - width: 100%; - display: flex; - background-color: var(--wp-admin-theme-color); - align-items: center; - justify-content: center; - z-index: 50; - text-align: center; - color: #fff; -} - -.components-drop-zone__content-icon, -.components-drop-zone__content-text { - display: block; -} - -.components-drop-zone__content-icon { - margin: 0 auto; - line-height: 0; - fill: currentColor; - pointer-events: none; -} - -.components-drop-zone__content-text { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-dropdown { - display: inline-block; -} - -.components-dropdown__content .components-popover__content > div { - padding: 8px; -} -.components-dropdown__content [role=menuitem] { - white-space: nowrap; -} - -.components-dropdown-menu__menu { - width: 100%; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 1.4; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item, -.components-dropdown-menu__menu .components-menu-item { - width: 100%; - padding: 6px; - outline: none; - cursor: pointer; - white-space: nowrap; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator, -.components-dropdown-menu__menu .components-menu-item.has-separator { - margin-top: 6px; - position: relative; - overflow: visible; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator::before, -.components-dropdown-menu__menu .components-menu-item.has-separator::before { - display: block; - content: ""; - box-sizing: content-box; - background-color: #ddd; - position: absolute; - top: -3px; - right: 0; - left: 0; - height: 1px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg, -.components-dropdown-menu__menu .components-menu-item.is-active svg { - color: #fff; - background: #1e1e1e; - box-shadow: 0 0 0 1px #1e1e1e; - border-radius: 1px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item > svg, -.components-dropdown-menu__menu .components-menu-item > svg { - border-radius: 2px; - width: 24px; - height: 24px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only, -.components-dropdown-menu__menu .components-menu-item.is-icon-only { - width: auto; -} -.components-dropdown-menu__menu .components-menu-item__button, -.components-dropdown-menu__menu .components-menu-item__button.components-button { - min-height: 36px; - height: auto; - text-align: right; - padding-right: 8px; - padding-left: 8px; -} -.components-dropdown-menu__menu .components-menu-group { - padding: 8px; - margin-top: 0; - margin-bottom: 0; - margin-right: -8px; - margin-left: -8px; -} -.components-dropdown-menu__menu .components-menu-group:first-child { - margin-top: -8px; -} -.components-dropdown-menu__menu .components-menu-group:last-child { - margin-bottom: -8px; -} -.components-dropdown-menu__menu .components-menu-group + .components-menu-group { - margin-top: 0; - border-top: 1px solid #ccc; - padding: 8px; -} -.is-alternate .components-dropdown-menu__menu .components-menu-group + .components-menu-group { - border-color: #1e1e1e; -} - -.components-font-size-picker__header__hint { - margin-right: 4px; - color: #757575; -} -.components-font-size-picker__header .components-button.is-small.has-icon:not(.has-text) { - min-width: 24px; - padding: 0; -} - -.components-font-size-picker__controls { - max-width: 248px; - align-items: center; - margin-top: 8px; - margin-bottom: 24px; -} -.components-font-size-picker__controls .components-unit-control-wrapper .components-input-control__label { - font-weight: 300; - padding-bottom: 0 !important; - margin-bottom: 8px !important; -} -.components-font-size-picker__controls .components-custom-select-control__button { - width: 100%; -} -.components-font-size-picker__controls .components-font-size-picker__number { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: inline-block; - font-weight: 500; - height: 30px; - margin-bottom: 0; - margin-right: 0; - margin-left: 8px; - margin-top: 8px; - width: 54px; -} -@media (prefers-reduced-motion: reduce) { - .components-font-size-picker__controls .components-font-size-picker__number { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-font-size-picker__controls .components-font-size-picker__number { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-font-size-picker__controls .components-font-size-picker__number:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-font-size-picker__controls .components-font-size-picker__number::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number[value=""] + .components-button { - cursor: default; - opacity: 0.3; - pointer-events: none; -} -.components-font-size-picker__controls .components-font-size-picker__number-container { - display: flex; - flex-direction: column; -} -.components-font-size-picker__controls .components-color-palette__clear { - height: 30px; -} - -.components-font-size-picker__custom-input .components-range-control__slider + .dashicon { - width: 30px; - height: 30px; -} - -.components-font-size-picker { - border: 0; - padding: 0; - margin: 0; -} - -.components-form-toggle { - position: relative; - display: inline-block; -} -.components-form-toggle .components-form-toggle__track { - content: ""; - display: inline-block; - box-sizing: border-box; - vertical-align: top; - background-color: #fff; - border: 1px solid #1e1e1e; - width: 36px; - height: 18px; - border-radius: 9px; - transition: 0.2s background ease; -} -@media (prefers-reduced-motion: reduce) { - .components-form-toggle .components-form-toggle__track { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-form-toggle .components-form-toggle__thumb { - display: block; - position: absolute; - box-sizing: border-box; - top: 3px; - right: 3px; - width: 12px; - height: 12px; - border-radius: 50%; - transition: 0.1s transform ease; - background-color: #1e1e1e; - border: 5px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .components-form-toggle .components-form-toggle__thumb { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-form-toggle.is-checked .components-form-toggle__track { - background-color: var(--wp-admin-theme-color); - border: 1px solid var(--wp-admin-theme-color); - border: 9px solid transparent; -} -.components-form-toggle .components-form-toggle__input:focus + .components-form-toggle__track { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: 2px; -} -.components-form-toggle.is-checked .components-form-toggle__thumb { - background-color: #fff; - border-width: 0; - transform: translateX(-18px); -} -.components-form-toggle.is-disabled, .components-disabled .components-form-toggle { - opacity: 0.3; -} - -.components-form-toggle input.components-form-toggle__input[type=checkbox] { - position: absolute; - top: 0; - right: 0; - width: 100%; - height: 100%; - opacity: 0; - margin: 0; - padding: 0; - z-index: 1; - border: none; -} -.components-form-toggle input.components-form-toggle__input[type=checkbox]:checked { - background: none; -} -.components-form-toggle input.components-form-toggle__input[type=checkbox]::before { - content: ""; -} - -.components-form-token-field__input-container { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: flex; - flex-wrap: wrap; - align-items: center; - width: 100%; - margin: 0 0 8px 0; - padding: 2px 4px; - cursor: text; -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__input-container { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-form-token-field__input-container { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-form-token-field__input-container:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-form-token-field__input-container::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container.is-disabled { - background: #ddd; - border-color: #ddd; -} -.components-form-token-field__input-container.is-active { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-form-token-field__input-container input[type=text].components-form-token-field__input { - display: inline-block; - flex: 1; - font-family: inherit; - font-size: 16px; - width: 100%; - max-width: 100%; - margin-right: 4px; - padding: 0; - min-height: 24px; - min-width: 50px; - background: inherit; - border: 0; - color: #1e1e1e; - box-shadow: none; -} -@media (min-width: 600px) { - .components-form-token-field__input-container input[type=text].components-form-token-field__input { - font-size: 13px; - } -} -.components-form-token-field__input-container input[type=text].components-form-token-field__input:focus, .components-form-token-field.is-active .components-form-token-field__input-container input[type=text].components-form-token-field__input { - outline: none; - box-shadow: none; -} -.components-form-token-field__input-container .components-form-token-field__token + input[type=text].components-form-token-field__input { - width: auto; -} - -.components-form-token-field__label { - display: inline-block; - margin-bottom: 8px; -} - -.components-form-token-field__help { - font-size: 12px; - font-style: normal; - color: #757575; -} - -.components-form-token-field__token { - font-size: 13px; - display: flex; - margin: 2px 0 2px 4px; - color: #1e1e1e; - max-width: 100%; -} -.components-form-token-field__token.is-success .components-form-token-field__token-text, -.components-form-token-field__token.is-success .components-form-token-field__remove-token { - background: #4ab866; -} -.components-form-token-field__token.is-error .components-form-token-field__token-text, -.components-form-token-field__token.is-error .components-form-token-field__remove-token { - background: #cc1818; -} -.components-form-token-field__token.is-validating .components-form-token-field__token-text, -.components-form-token-field__token.is-validating .components-form-token-field__remove-token { - color: #757575; -} -.components-form-token-field__token.is-borderless { - position: relative; - padding: 0 0 0 16px; -} -.components-form-token-field__token.is-borderless .components-form-token-field__token-text { - background: transparent; - color: var(--wp-admin-theme-color); -} -.components-form-token-field__token.is-borderless .components-form-token-field__remove-token { - background: transparent; - color: #757575; - position: absolute; - top: 1px; - left: 0; -} -.components-form-token-field__token.is-borderless.is-success .components-form-token-field__token-text { - color: #4ab866; -} -.components-form-token-field__token.is-borderless.is-error .components-form-token-field__token-text { - color: #cc1818; - border-radius: 0 4px 4px 0; - padding: 0 6px 0 4px; -} -.components-form-token-field__token.is-borderless.is-validating .components-form-token-field__token-text { - color: #1e1e1e; -} -.components-form-token-field__token.is-disabled .components-form-token-field__remove-token { - cursor: default; -} - -.components-form-token-field__token-text, -.components-form-token-field__remove-token.components-button { - display: inline-block; - line-height: 24px; - height: auto; - background: #ddd; - min-width: unset; - transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1); -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__token-text, -.components-form-token-field__remove-token.components-button { - transition-duration: 0s; - transition-delay: 0s; - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-form-token-field__token-text { - border-radius: 0 2px 2px 0; - padding: 0 8px 0 0; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.components-form-token-field__remove-token.components-button { - cursor: pointer; - border-radius: 2px 0 0 2px; - padding: 0 2px; - color: #1e1e1e; - line-height: 10px; - overflow: initial; -} -.components-form-token-field__remove-token.components-button:hover { - color: #1e1e1e; -} - -.components-form-token-field__suggestions-list { - flex: 1 0 100%; - min-width: 100%; - max-height: 9em; - overflow-y: auto; - transition: all 0.15s ease-in-out; - list-style: none; - border-top: 1px solid #757575; - margin: 4px -4px -4px; - padding: 0; -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__suggestions-list { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-form-token-field__suggestion { - color: #757575; - display: block; - font-size: 13px; - padding: 4px 8px; - margin: 0; - cursor: pointer; -} -.components-form-token-field__suggestion.is-selected { - background: var(--wp-admin-theme-color); - color: #fff; -} - -.components-form-token-field__suggestion-match { - text-decoration: underline; -} - -@media (min-width: 600px) { - .components-guide { - width: 600px; - } -} -.components-guide .components-modal__content { - padding: 0; - margin-top: 0; - border-radius: 2px; -} -.components-guide .components-modal__content::before { - content: none; -} -.components-guide .components-modal__header { - border-bottom: none; - padding: 0; - position: sticky; -} -.components-guide .components-modal__header .components-button { - align-self: flex-start; - margin: 8px 0 0 8px; - position: static; -} -.components-guide .components-modal__header .components-button:hover svg { - fill: #fff; -} -.components-guide__container { - display: flex; - flex-direction: column; - justify-content: space-between; - margin-top: -60px; - min-height: 100%; -} -.components-guide__page { - display: flex; - flex-direction: column; - justify-content: center; - position: relative; -} -@media (min-width: 600px) { - .components-guide__page { - min-height: 300px; - } -} -.components-guide__footer { - align-content: center; - display: flex; - height: 30px; - justify-content: center; - margin: 0 0 24px 0; - padding: 0 32px; - position: relative; - width: 100%; -} -.components-guide__page-control { - margin: 0; - text-align: center; -} -.components-guide__page-control li { - display: inline-block; - margin: 0; -} -.components-guide__page-control .components-button { - height: 30px; - min-width: 20px; - margin: -6px 0; -} - -.components-modal__frame.components-guide { - border: none; - min-width: 312px; - height: 80vh; - max-height: 575px; -} -@media (max-width: 600px) { - .components-modal__frame.components-guide { - margin: auto; - max-width: calc(100vw - 16px * 2); - } -} - -.components-button.components-guide__back-button, .components-button.components-guide__forward-button, .components-button.components-guide__finish-button { - height: 30px; - position: absolute; -} -.components-button.components-guide__back-button, .components-button.components-guide__forward-button { - font-size: 13px; - padding: 4px 2px; -} -.components-button.components-guide__back-button.has-text svg, .components-button.components-guide__forward-button.has-text svg { - margin: 0; -} -.components-button.components-guide__back-button:hover, .components-button.components-guide__forward-button:hover { - text-decoration: underline; -} -.components-button.components-guide__back-button { - right: 32px; -} -.components-button.components-guide__forward-button { - left: 32px; - color: #1386bf; - font-weight: bold; -} -.components-button.components-guide__finish-button { - left: 32px; -} - -[role=region] { - position: relative; -} - -.is-focusing-regions [role=region]:focus::after { - content: ""; - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - pointer-events: none; - outline: 4px solid transparent; - box-shadow: inset 0 0 0 4px var(--wp-admin-theme-color); -} -@supports (outline-offset: 1px) { - .is-focusing-regions [role=region]:focus::after { - content: none; - } - .is-focusing-regions [role=region]:focus { - outline-style: solid; - outline-color: var(--wp-admin-theme-color); - outline-width: 4px; - outline-offset: -4px; - } -} - -.components-menu-group + .components-menu-group { - margin-top: 8px; - padding-top: 8px; - border-top: 1px solid #1e1e1e; -} -.components-menu-group + .components-menu-group.has-hidden-separator { - border-top: none; - margin-top: 0; - padding-top: 0; -} - -.components-menu-group__label { - padding: 0 8px; - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - white-space: nowrap; -} - -.components-menu-item__button, -.components-menu-item__button.components-button { - width: 100%; -} -.components-menu-item__button[role=menuitemradio] .components-menu-item__item:only-child, .components-menu-item__button[role=menuitemcheckbox] .components-menu-item__item:only-child, -.components-menu-item__button.components-button[role=menuitemradio] .components-menu-item__item:only-child, -.components-menu-item__button.components-button[role=menuitemcheckbox] .components-menu-item__item:only-child { - padding-left: 48px; -} -.components-menu-item__button .components-menu-items__item-icon, -.components-menu-item__button.components-button .components-menu-items__item-icon { - display: inline-block; - flex: 0 0 auto; -} -.components-menu-item__button .components-menu-items__item-icon.has-icon-right, -.components-menu-item__button.components-button .components-menu-items__item-icon.has-icon-right { - margin-left: -2px; - margin-right: 24px; -} -.components-menu-item__button .components-menu-item__shortcut + .components-menu-items__item-icon.has-icon-right, -.components-menu-item__button.components-button .components-menu-item__shortcut + .components-menu-items__item-icon.has-icon-right { - margin-right: 8px; -} -.components-menu-item__button .block-editor-block-icon, -.components-menu-item__button.components-button .block-editor-block-icon { - margin-right: -2px; - margin-left: 8px; -} -.components-menu-item__button.is-primary, -.components-menu-item__button.components-button.is-primary { - justify-content: center; -} -.components-menu-item__button.is-primary .components-menu-item__item, -.components-menu-item__button.components-button.is-primary .components-menu-item__item { - margin-left: 0; -} - -.components-menu-item__info-wrapper { - display: flex; - flex-direction: column; - margin-left: auto; -} - -.components-menu-item__info { - margin-top: 4px; - font-size: 12px; - color: #757575; - white-space: normal; -} - -.components-menu-item__item { - white-space: nowrap; - min-width: 160px; - margin-left: auto; - display: inline-flex; - align-items: center; -} - -.components-menu-item__shortcut { - align-self: center; - margin-left: 0; - margin-right: auto; - padding-right: 24px; - color: currentColor; - display: none; -} -@media (min-width: 480px) { - .components-menu-item__shortcut { - display: inline; - } -} - -.components-menu-items-choice svg, -.components-menu-items-choice.components-button svg { - margin-left: 12px; -} -.components-menu-items-choice.has-icon, -.components-menu-items-choice.components-button.has-icon { - padding-right: 12px; -} - -.components-modal__screen-overlay { - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - background-color: rgba(0, 0, 0, 0.35); - z-index: 100000; - display: flex; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-modal__screen-overlay { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-modal__frame { - margin: 0; - width: 100%; - background: #fff; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); - border-radius: 2px; - overflow: hidden; - display: flex; -} -@media (min-width: 600px) { - .components-modal__frame { - margin: auto; - width: auto; - min-width: 360px; - max-width: calc(100% - 32px); - max-height: calc(100% - 120px); - animation: components-modal__appear-animation 0.1s ease-out; - animation-fill-mode: forwards; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .components-modal__frame { - animation-duration: 1ms; - animation-delay: 0s; - } -} -@media (min-width: 600px) { - .components-modal__frame.is-full-screen { - width: 90vw; - min-height: 90vh; - } -} -@media (min-width: 960px) { - .components-modal__frame { - max-height: 70%; - } -} - -@keyframes components-modal__appear-animation { - from { - transform: translateY(32px); - } - to { - transform: translateY(0); - } -} -.components-modal__header { - box-sizing: border-box; - border-bottom: 1px solid #ddd; - padding: 0 32px; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - height: 60px; - width: 100%; - z-index: 10; - position: absolute; - top: 0; - right: 0; -} -.components-modal__header .components-modal__header-heading { - font-size: 1rem; - font-weight: 600; -} -.components-modal__header h1 { - line-height: 1; - margin: 0; -} -.components-modal__header .components-button { - position: relative; - right: 8px; -} - -.components-modal__header-heading-container { - align-items: center; - flex-grow: 1; - display: flex; - flex-direction: row; - justify-content: left; -} - -.components-modal__header-icon-container { - display: inline-block; -} -.components-modal__header-icon-container svg { - max-width: 36px; - max-height: 36px; - padding: 8px; -} - -.components-modal__content { - flex: 1; - margin-top: 60px; - padding: 0 32px 24px; - overflow: auto; -} -.components-modal__content::before { - content: ""; - display: block; - margin-bottom: 24px; -} -.components-modal__content.hide-header { - margin-top: 0; - padding-top: 24px; -} -.components-modal__content.hide-header::before { - content: none; -} - -.components-notice { - display: flex; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - background-color: #fff; - border-right: 4px solid var(--wp-admin-theme-color); - margin: 5px 15px 2px; - padding: 8px 12px; - align-items: center; -} -.components-notice.is-dismissible { - padding-left: 36px; - position: relative; -} -.components-notice.is-success { - border-right-color: #4ab866; - background-color: #eff9f1; -} -.components-notice.is-warning { - border-right-color: #f0b849; - background-color: #fef8ee; -} -.components-notice.is-error { - border-right-color: #cc1818; - background-color: #f4a2a2; -} - -.components-notice__content { - flex-grow: 1; - margin: 4px 0 4px 25px; -} - -.components-notice__actions { - display: flex; - flex-wrap: wrap; -} - -.components-notice__action.components-button { - margin-left: 8px; -} -.components-notice__action.components-button, .components-notice__action.components-button.is-link { - margin-right: 12px; -} -.components-notice__action.components-button.is-secondary { - vertical-align: initial; -} - -.components-notice__dismiss { - color: #757575; - align-self: flex-start; - flex-shrink: 0; -} -.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover, .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active, .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus { - color: #1e1e1e; - background-color: transparent; -} -.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover { - box-shadow: none; -} - -.components-notice-list { - max-width: 100vw; - box-sizing: border-box; -} -.components-notice-list .components-notice__content { - margin-top: 12px; - margin-bottom: 12px; - line-height: 2; -} -.components-notice-list .components-notice__action.components-button { - display: block; - margin-right: 0; - margin-top: 8px; -} - -.components-panel { - background: #fff; - border: 1px solid #e0e0e0; -} -.components-panel > .components-panel__header:first-child, -.components-panel > .components-panel__body:first-child { - margin-top: -1px; -} -.components-panel > .components-panel__header:last-child, -.components-panel > .components-panel__body:last-child { - border-bottom-width: 0; -} - -.components-panel + .components-panel { - margin-top: -1px; -} - -.components-panel__body { - border-top: 1px solid #e0e0e0; - border-bottom: 1px solid #e0e0e0; -} -.components-panel__body h3 { - margin: 0 0 0.5em; -} -.components-panel__body.is-opened { - padding: 16px; -} - -.components-panel__header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 16px; - height: 48px; - border-bottom: 1px solid #ddd; -} -.components-panel__header h2 { - margin: 0; - font-size: inherit; - color: inherit; -} - -.components-panel__body + .components-panel__body, -.components-panel__body + .components-panel__header, -.components-panel__header + .components-panel__body, -.components-panel__header + .components-panel__header { - margin-top: -1px; -} - -.components-panel__body > .components-panel__body-title { - display: block; - padding: 0; - font-size: inherit; - margin-top: 0; - margin-bottom: 0; - transition: 0.1s background ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body > .components-panel__body-title { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-panel__body.is-opened > .components-panel__body-title { - margin: -16px; - margin-bottom: 5px; -} - -.components-panel__body > .components-panel__body-title:hover { - background: #f0f0f0; - border: none; -} - -.components-panel__body-toggle.components-button { - position: relative; - padding: 16px 16px 16px 48px; - outline: none; - width: 100%; - font-weight: 500; - text-align: right; - color: #1e1e1e; - border: none; - box-shadow: none; - transition: 0.1s background ease-in-out; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body-toggle.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-panel__body-toggle.components-button:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 0; -} -.components-panel__body-toggle.components-button .components-panel__arrow { - position: absolute; - left: 16px; - top: 50%; - transform: translateY(-50%); - color: #1e1e1e; - fill: currentColor; - transition: 0.1s color ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body-toggle.components-button .components-panel__arrow { - transition-duration: 0s; - transition-delay: 0s; - } -} -body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right { - transform: scaleX(-1); - -ms-filter: fliph; - filter: FlipH; - margin-top: -10px; -} - -.components-panel__icon { - color: #757575; - margin: -2px 6px -2px 0; -} - -.components-panel__body-toggle-icon { - margin-left: -5px; -} - -.components-panel__color-title { - float: right; - height: 19px; -} - -.components-panel__row { - display: flex; - justify-content: space-between; - align-items: center; - margin-top: 8px; - min-height: 36px; -} -.components-panel__row select { - min-width: 0; -} -.components-panel__row label { - margin-left: 12px; - flex-shrink: 0; - max-width: 75%; -} -.components-panel__row:empty, .components-panel__row:first-of-type { - margin-top: 0; -} - -.components-panel .circle-picker { - padding-bottom: 20px; -} - -.components-placeholder.components-placeholder { - box-sizing: border-box; - position: relative; - padding: 1em; - min-height: 200px; - width: 100%; - text-align: right; - margin: 0; - color: #1e1e1e; - -moz-font-smoothing: subpixel-antialiased; - -webkit-font-smoothing: subpixel-antialiased; - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - outline: 1px solid transparent; -} -@supports (position: sticky) { - .components-placeholder.components-placeholder { - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-start; - } -} -.components-placeholder.components-placeholder .components-base-control__label { - font-size: 13px; -} - -.components-placeholder__error, -.components-placeholder__instructions, -.components-placeholder__label, -.components-placeholder__fieldset { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-placeholder__label { - display: flex; - font-weight: 600; - margin-bottom: 16px; - align-items: center; -} -.components-placeholder__label > svg, -.components-placeholder__label .dashicon, -.components-placeholder__label .block-editor-block-icon { - margin-left: 1ch; - fill: currentColor; -} -@media (forced-colors: active) { - .components-placeholder__label > svg, -.components-placeholder__label .dashicon, -.components-placeholder__label .block-editor-block-icon { - fill: CanvasText; - } -} -.components-placeholder__label:empty { - display: none; -} - -.components-placeholder__fieldset, -.components-placeholder__fieldset form { - display: flex; - flex-direction: row; - width: 100%; - flex-wrap: wrap; -} -.components-placeholder__fieldset p, -.components-placeholder__fieldset form p { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-placeholder__fieldset.components-placeholder__fieldset { - border: none; - padding: 0; -} -.components-placeholder__fieldset.components-placeholder__fieldset .components-placeholder__instructions { - padding: 0; - font-weight: normal; - font-size: 1em; -} - -.components-placeholder__fieldset.is-column-layout, -.components-placeholder__fieldset.is-column-layout form { - flex-direction: column; -} - -.components-placeholder__input[type=url] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - margin: 0 0 0 8px; - flex: 1 1 auto; -} -@media (prefers-reduced-motion: reduce) { - .components-placeholder__input[type=url] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-placeholder__input[type=url] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-placeholder__input[type=url]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-placeholder__input[type=url]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-placeholder__input[type=url]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-placeholder__input[type=url]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.components-placeholder__instructions { - margin-bottom: 1em; -} - -.components-placeholder__error { - margin-top: 1em; - width: 100%; -} - -.components-placeholder__preview img { - margin: 3%; - width: 50%; -} - -.components-placeholder__fieldset .components-button { - margin-left: 12px; - margin-bottom: 12px; -} -.components-placeholder__fieldset .components-button:last-child { - margin-bottom: 0; - margin-left: 0; -} - -.components-placeholder__fieldset .components-button:not(.is-link) ~ .components-button.is-link { - margin-right: 10px; - margin-left: 10px; -} -.components-placeholder__fieldset .components-button:not(.is-link) ~ .components-button.is-link:last-child { - margin-left: 0; -} - -.components-placeholder.is-large .components-placeholder__label { - font-size: 18pt; - font-weight: normal; -} -.components-placeholder.is-medium .components-placeholder__instructions, .components-placeholder.is-small .components-placeholder__instructions { - display: none; -} -.components-placeholder.is-medium .components-placeholder__fieldset, -.components-placeholder.is-medium .components-placeholder__fieldset form, .components-placeholder.is-small .components-placeholder__fieldset, -.components-placeholder.is-small .components-placeholder__fieldset form { - flex-direction: column; -} -.components-placeholder.is-medium .components-placeholder__fieldset .components-button, .components-placeholder.is-small .components-placeholder__fieldset .components-button { - margin-left: auto; -} -.components-placeholder.is-small .components-button { - padding: 0 8px 2px; -} -.components-popover { - position: fixed; - z-index: 1000000; - top: 0; - left: 0; - opacity: 0; -} -.components-popover.is-expanded, .components-popover[data-x-axis][data-y-axis] { - opacity: 1; -} -.components-popover.is-expanded { - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 1000000 !important; -} -.components-popover:not(.is-without-arrow) { - margin-left: 2px; -} -.components-popover:not(.is-without-arrow)::before { - border: 8px solid #ccc; -} -.components-popover:not(.is-without-arrow).is-alternate::before { - border-color: #1e1e1e; -} -.components-popover:not(.is-without-arrow)::after { - border: 8px solid #fff; -} -.components-popover:not(.is-without-arrow)::before, .components-popover:not(.is-without-arrow)::after { - content: ""; - position: absolute; - height: 0; - width: 0; - line-height: 0; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top] { - margin-top: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::before { - bottom: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::after { - bottom: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::before, .components-popover:not(.is-without-arrow)[data-y-axis=top]::after { - border-bottom: none; - border-left-color: transparent; - border-right-color: transparent; - border-top-style: solid; - margin-left: -10px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom] { - margin-top: 8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::before { - top: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::after { - top: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::before, .components-popover:not(.is-without-arrow)[data-y-axis=bottom]::after { - border-bottom-style: solid; - border-left-color: transparent; - border-right-color: transparent; - border-top: none; - margin-left: -10px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left] { - margin-left: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::before { - right: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::after { - right: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::before, .components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::after { - border-bottom-color: transparent; - border-left-style: solid; - border-right: none; - border-top-color: transparent; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right] { - margin-left: 8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::before { - left: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::after { - left: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::before, .components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::after { - border-bottom-color: transparent; - border-left: none; - border-right-style: solid; - border-top-color: transparent; -} -.components-popover[data-y-axis=top] { - bottom: 100%; -} -.components-popover[data-y-axis=bottom] { - top: 100%; -} -.components-popover[data-y-axis=middle] { - align-items: center; - display: flex; -} -.components-popover.is-from-top { - margin-top: 12px; -} -.components-popover.is-from-bottom { - margin-top: -12px; -} -.components-popover.is-from-left:not(.is-from-top):not(.is-from-bottom) { - margin-left: 12px; -} -.components-popover.is-from-right:not(.is-from-top):not(.is-from-bottom) { - margin-right: 12px; -} - -.components-popover__content { - height: 100%; - background: #fff; - border: 1px solid #ccc; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border-radius: 2px; -} -.is-alternate .components-popover__content { - border: 1px solid #1e1e1e; - box-shadow: none; -} -.components-popover .components-popover__content { - position: absolute; - height: auto; - overflow-y: auto; -} -.components-popover.is-expanded .components-popover__content { - position: static; - height: calc(100% - 48px); - overflow-y: visible; - min-width: auto; - border: none; - border-top: 1px solid #1e1e1e; -} -.components-popover[data-y-axis=top] .components-popover__content { - bottom: 100%; -} -.components-popover[data-x-axis=center] .components-popover__content { - left: 50%; - transform: translateX(-50%); -} -.components-popover[data-x-axis=right] .components-popover__content { - position: absolute; - left: 100%; -} -.components-popover:not([data-y-axis=middle])[data-x-axis=right] .components-popover__content { - margin-left: -25px; -} -.components-popover[data-x-axis=left] .components-popover__content { - position: absolute; - right: 100%; -} -.components-popover:not([data-y-axis=middle])[data-x-axis=left] .components-popover__content { - margin-right: -25px; -} - -.components-popover__header { - align-items: center; - background: #fff; - display: flex; - height: 48px; - justify-content: space-between; - padding: 0 8px 0 16px; -} - -.components-popover__header-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} - -.components-popover__close.components-button { - z-index: 5; -} -.components-radio-control { - display: flex; - flex-direction: column; -} -.components-radio-control .components-base-control__help { - margin-top: 0; -} -.components-radio-control .components-base-control__field { - margin-bottom: 0; -} - -.components-radio-control__option:not(:last-child) { - margin-bottom: 4px; -} - -.components-radio-control__input[type=radio] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-left: 12px; - transition: none; - border-radius: 50%; - width: 24px; - height: 24px; - margin-top: 0; - margin-left: 6px; -} -@media (prefers-reduced-motion: reduce) { - .components-radio-control__input[type=radio] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-radio-control__input[type=radio]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-radio-control__input[type=radio]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-radio-control__input[type=radio]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-radio-control__input[type=radio]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio] { - height: 20px; - width: 20px; - } -} -.components-radio-control__input[type=radio]:checked::before { - box-sizing: inherit; - width: 8px; - height: 8px; - transform: translate(-7px, 7px); - margin: 0; - background-color: #fff; - border: 4px solid #fff; -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio]:checked::before { - transform: translate(-5px, 5px); - } -} -.components-radio-control__input[type=radio]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-radio-control__input[type=radio]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} - -.components-resizable-box__handle { - display: none; - width: 23px; - height: 23px; - z-index: 2; -} -.components-resizable-box__container.has-show-handle .components-resizable-box__handle { - display: block; -} - -.components-resizable-box__container > img { - width: inherit; -} - -.components-resizable-box__handle::after { - display: block; - content: ""; - width: 15px; - height: 15px; - border-radius: 50%; - background: #fff; - cursor: inherit; - position: absolute; - top: calc(50% - 8px); - left: calc(50% - 8px); - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.components-resizable-box__side-handle::before { - display: block; - border-radius: 2px; - content: ""; - width: 3px; - height: 3px; - background: var(--wp-admin-theme-color); - cursor: inherit; - position: absolute; - top: calc(50% - 1px); - left: calc(50% - 1px); - transition: transform 0.1s ease-in; - opacity: 0; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle::before { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-resizable-box__side-handle { - z-index: 2; -} - -.components-resizable-box__corner-handle { - z-index: 2; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-top, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom, -.components-resizable-box__side-handle.components-resizable-box__handle-top::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom::before { - width: 100%; - right: 0; - border-right: 0; - border-left: 0; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-left, -.components-resizable-box__side-handle.components-resizable-box__handle-right, -.components-resizable-box__side-handle.components-resizable-box__handle-left::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right::before { - height: 100%; - top: 0; - border-top: 0; - border-bottom: 0; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation: components-resizable-box__top-bottom-animation 0.1s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation: components-resizable-box__left-right-animation 0.1s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -/* This CSS is shown only to Safari, which has a bug with table-caption making it jumpy. -See https://bugs.webkit.org/show_bug.cgi?id=187903. */ -@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) { - @supports (-webkit-appearance: none) { - .components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation: none; - } - - .components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation: none; - } - } -} -@keyframes components-resizable-box__top-bottom-animation { - from { - transform: scaleX(0); - opacity: 0; - } - to { - transform: scaleX(1); - opacity: 1; - } -} -@keyframes components-resizable-box__left-right-animation { - from { - transform: scaleY(0); - opacity: 0; - } - to { - transform: scaleY(1); - opacity: 1; - } -} -.components-resizable-box__handle-right { - right: calc(11.5px * -1); -} - -.components-resizable-box__handle-left { - left: calc(11.5px * -1); -} - -.components-resizable-box__handle-top { - top: calc(11.5px * -1); -} - -.components-resizable-box__handle-bottom { - bottom: calc(11.5px * -1); -} -.components-responsive-wrapper { - position: relative; - max-width: 100%; -} -.components-responsive-wrapper, .components-responsive-wrapper > span { - display: block; -} - -.components-responsive-wrapper__content { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - margin: auto; -} - -.components-sandbox { - overflow: hidden; -} - -iframe.components-sandbox { - width: 100%; -} - -html.lockscroll, -body.lockscroll { - overflow: hidden; -} - -.components-search-control { - position: relative; -} -.components-search-control input[type=search].components-search-control__input { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: block; - padding: 16px 16px 16px 48px; - background: #f0f0f0; - border: none; - width: 100%; - height: 48px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; -} -@media (prefers-reduced-motion: reduce) { - .components-search-control input[type=search].components-search-control__input { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-search-control input[type=search].components-search-control__input { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-search-control input[type=search].components-search-control__input:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-search-control input[type=search].components-search-control__input::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-search-control input[type=search].components-search-control__input::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-search-control input[type=search].components-search-control__input:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .components-search-control input[type=search].components-search-control__input { - font-size: 13px; - } -} -.components-search-control input[type=search].components-search-control__input:focus { - background: #fff; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-search-control input[type=search].components-search-control__input::placeholder { - color: #757575; -} -.components-search-control input[type=search].components-search-control__input::-webkit-search-decoration, .components-search-control input[type=search].components-search-control__input::-webkit-search-cancel-button, .components-search-control input[type=search].components-search-control__input::-webkit-search-results-button, .components-search-control input[type=search].components-search-control__input::-webkit-search-results-decoration { - -webkit-appearance: none; -} - -.components-search-control__icon { - position: absolute; - top: 0; - left: 12px; - bottom: 0; - display: flex; - align-items: center; -} -.components-search-control__icon > svg { - margin: 8px 0; -} - -.components-search-control__input-wrapper { - position: relative; -} - -.components-select-control__input { - background: #fff; - height: 36px; - line-height: 36px; - margin: 1px; - outline: 0; - width: 100%; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important; -} -@media (min-width: 782px) { - .components-select-control__input { - height: 28px; - line-height: 28px; - } -} - -@media (max-width: 782px) { - .components-base-control .components-base-control__field .components-select-control__input { - font-size: 16px; - } -} -.components-snackbar { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - background-color: #1e1e1e; - border-radius: 2px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); - color: #fff; - padding: 16px 24px; - width: 100%; - max-width: 600px; - box-sizing: border-box; - cursor: pointer; - pointer-events: auto; -} -@media (min-width: 600px) { - .components-snackbar { - width: -moz-fit-content; - width: fit-content; - } -} -.components-snackbar:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); -} -.components-snackbar.components-snackbar-explicit-dismiss { - cursor: default; -} -.components-snackbar .components-snackbar__content-with-icon { - margin-right: 24px; -} -.components-snackbar .components-snackbar__icon { - position: absolute; - top: 24px; - right: 28px; -} -.components-snackbar .components-snackbar__dismiss-button { - margin-right: 32px; - cursor: pointer; -} - -.components-snackbar__action.components-button { - margin-right: 32px; - color: #fff; - height: auto; - flex-shrink: 0; - line-height: 1.4; - padding: 0; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) { - text-decoration: underline; - background-color: transparent; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):focus { - color: #fff; - box-shadow: none; - outline: 1px dotted #fff; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover { - color: var(--wp-admin-theme-color); -} - -.components-snackbar__content { - display: flex; - align-items: baseline; - justify-content: space-between; - line-height: 1.4; -} - -.components-snackbar-list { - position: absolute; - z-index: 100000; - width: 100%; - box-sizing: border-box; - pointer-events: none; -} - -.components-snackbar-list__notice-container { - position: relative; - padding-top: 8px; -} - -.components-swatch { - width: 18px; - height: 18px; - border-radius: 50%; - color: transparent; - background: transparent; -} -.components-swatch::after { - content: ""; - display: block; - width: 100%; - height: 100%; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 50%; -} - -.components-button.has-icon.has-text .components-swatch { - margin-left: 8px; -} - -.components-tab-panel__tabs { - display: flex; - align-items: stretch; - flex-direction: row; -} -.components-tab-panel__tabs[aria-orientation=vertical] { - flex-direction: column; -} - -.components-tab-panel__tabs-item { - background: transparent; - border: none; - box-shadow: none; - border-radius: 0; - cursor: pointer; - height: 48px; - padding: 3px 16px; - margin-right: 0; - font-weight: 500; - transition: box-shadow 0.1s linear; - box-sizing: border-box; -} -.components-tab-panel__tabs-item::after { - content: attr(data-label); - display: block; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-tab-panel__tabs-item.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; -} -.components-tab-panel__tabs-item.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - left: 0; - right: 0; - border-bottom: 4px solid transparent; -} -.components-tab-panel__tabs-item:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-tab-panel__tabs-item.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -.components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - width: 100%; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-text-control__input:focus, -.components-text-control__input[type=text]:focus, -.components-text-control__input[type=tel]:focus, -.components-text-control__input[type=time]:focus, -.components-text-control__input[type=url]:focus, -.components-text-control__input[type=week]:focus, -.components-text-control__input[type=password]:focus, -.components-text-control__input[type=color]:focus, -.components-text-control__input[type=date]:focus, -.components-text-control__input[type=datetime]:focus, -.components-text-control__input[type=datetime-local]:focus, -.components-text-control__input[type=email]:focus, -.components-text-control__input[type=month]:focus, -.components-text-control__input[type=number]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-text-control__input::-webkit-input-placeholder, -.components-text-control__input[type=text]::-webkit-input-placeholder, -.components-text-control__input[type=tel]::-webkit-input-placeholder, -.components-text-control__input[type=time]::-webkit-input-placeholder, -.components-text-control__input[type=url]::-webkit-input-placeholder, -.components-text-control__input[type=week]::-webkit-input-placeholder, -.components-text-control__input[type=password]::-webkit-input-placeholder, -.components-text-control__input[type=color]::-webkit-input-placeholder, -.components-text-control__input[type=date]::-webkit-input-placeholder, -.components-text-control__input[type=datetime]::-webkit-input-placeholder, -.components-text-control__input[type=datetime-local]::-webkit-input-placeholder, -.components-text-control__input[type=email]::-webkit-input-placeholder, -.components-text-control__input[type=month]::-webkit-input-placeholder, -.components-text-control__input[type=number]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-text-control__input::-moz-placeholder, -.components-text-control__input[type=text]::-moz-placeholder, -.components-text-control__input[type=tel]::-moz-placeholder, -.components-text-control__input[type=time]::-moz-placeholder, -.components-text-control__input[type=url]::-moz-placeholder, -.components-text-control__input[type=week]::-moz-placeholder, -.components-text-control__input[type=password]::-moz-placeholder, -.components-text-control__input[type=color]::-moz-placeholder, -.components-text-control__input[type=date]::-moz-placeholder, -.components-text-control__input[type=datetime]::-moz-placeholder, -.components-text-control__input[type=datetime-local]::-moz-placeholder, -.components-text-control__input[type=email]::-moz-placeholder, -.components-text-control__input[type=month]::-moz-placeholder, -.components-text-control__input[type=number]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-text-control__input:-ms-input-placeholder, -.components-text-control__input[type=text]:-ms-input-placeholder, -.components-text-control__input[type=tel]:-ms-input-placeholder, -.components-text-control__input[type=time]:-ms-input-placeholder, -.components-text-control__input[type=url]:-ms-input-placeholder, -.components-text-control__input[type=week]:-ms-input-placeholder, -.components-text-control__input[type=password]:-ms-input-placeholder, -.components-text-control__input[type=color]:-ms-input-placeholder, -.components-text-control__input[type=date]:-ms-input-placeholder, -.components-text-control__input[type=datetime]:-ms-input-placeholder, -.components-text-control__input[type=datetime-local]:-ms-input-placeholder, -.components-text-control__input[type=email]:-ms-input-placeholder, -.components-text-control__input[type=month]:-ms-input-placeholder, -.components-text-control__input[type=number]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.components-tip { - display: flex; - color: #757575; -} -.components-tip svg { - align-self: center; - fill: #f0b849; - flex-shrink: 0; - margin-left: 16px; -} -.components-tip p { - margin: 0; -} - -.components-toggle-control .components-base-control__field { - display: flex; - margin-bottom: 12px; - line-height: initial; - align-items: center; -} -.components-toggle-control .components-base-control__field .components-form-toggle { - margin-left: 12px; -} -.components-toggle-control .components-base-control__field .components-toggle-control__label { - display: block; -} - -.components-accessible-toolbar { - display: inline-flex; - border: 1px solid #1e1e1e; - border-radius: 2px; - flex-shrink: 0; -} -.components-accessible-toolbar > .components-toolbar-group:last-child { - border-left: none; -} - -.components-accessible-toolbar .components-button, -.components-toolbar .components-button { - position: relative; - height: 48px; - z-index: 1; - padding-right: 16px; - padding-left: 16px; -} -.components-accessible-toolbar .components-button:focus:enabled, -.components-toolbar .components-button:focus:enabled { - box-shadow: none; - outline: none; -} -.components-accessible-toolbar .components-button::before, -.components-toolbar .components-button::before { - content: ""; - position: absolute; - display: block; - border-radius: 2px; - height: 32px; - right: 8px; - left: 8px; - z-index: -1; - animation: components-button__appear-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-accessible-toolbar .components-button::before, -.components-toolbar .components-button::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-accessible-toolbar .components-button svg, -.components-toolbar .components-button svg { - position: relative; - margin-right: auto; - margin-left: auto; -} -.components-accessible-toolbar .components-button.is-pressed, -.components-toolbar .components-button.is-pressed { - background: transparent; -} -.components-accessible-toolbar .components-button.is-pressed:hover, -.components-toolbar .components-button.is-pressed:hover { - background: transparent; -} -.components-accessible-toolbar .components-button.is-pressed::before, -.components-toolbar .components-button.is-pressed::before { - background: #1e1e1e; -} -.components-accessible-toolbar .components-button:focus::before, -.components-toolbar .components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} -.components-accessible-toolbar .components-button.has-icon.has-icon, -.components-toolbar .components-button.has-icon.has-icon { - padding-right: 12px; - padding-left: 12px; - min-width: 48px; -} -.components-accessible-toolbar .components-button.components-tab-button, -.components-toolbar .components-button.components-tab-button { - font-weight: 500; -} -.components-accessible-toolbar .components-button.components-tab-button span, -.components-toolbar .components-button.components-tab-button span { - display: inline-block; - padding-right: 0; - padding-left: 0; - position: relative; -} - -@keyframes components-button__appear-animation { - from { - transform: scaleY(0); - } - to { - transform: scaleY(1); - } -} -.components-toolbar__control.components-button { - position: relative; -} -.components-toolbar__control.components-button[data-subscript] svg { - padding: 5px 0 5px 10px; -} -.components-toolbar__control.components-button[data-subscript]::after { - content: attr(data-subscript); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - font-weight: 600; - line-height: 12px; - position: absolute; - left: 8px; - bottom: 10px; -} -.components-toolbar__control.components-button:active::before { - display: none; -} -.components-toolbar__control.components-button:not(:disabled).is-pressed[data-subscript]::after { - color: #fff; -} - -.components-toolbar-group { - min-height: 48px; - border-left: 1px solid #1e1e1e; - background-color: #fff; - display: inline-flex; - flex-shrink: 0; - flex-wrap: wrap; - line-height: 0; -} -.components-toolbar-group .components-toolbar-group.components-toolbar-group { - border-width: 0; - margin: 0; -} - -.components-toolbar { - min-height: 48px; - margin: 0; - border: 1px solid #1e1e1e; - background-color: #fff; - display: inline-flex; - flex-shrink: 0; - flex-wrap: wrap; -} -.components-toolbar .components-toolbar.components-toolbar { - border-width: 0; - margin: 0; -} - -div.components-toolbar > div { - display: block; - margin: 0; -} -@supports (position: sticky) { - div.components-toolbar > div { - display: flex; - } -} -div.components-toolbar > div + div.has-left-divider { - margin-right: 6px; - position: relative; - overflow: visible; -} -div.components-toolbar > div + div.has-left-divider::before { - display: inline-block; - content: ""; - box-sizing: content-box; - background-color: #ddd; - position: absolute; - top: 8px; - right: -3px; - width: 1px; - height: 20px; -} - -.components-tooltip.components-popover { - z-index: 1000002; -} -.components-tooltip.components-popover .components-popover__content { - min-width: 0; -} - -.components-tooltip .components-popover__content { - background: #1e1e1e; - border-radius: 2px; - border-width: 0; - color: #fff; - white-space: nowrap; - text-align: center; - line-height: 1.4; - font-size: 12px; - box-shadow: none; -} -.components-tooltip .components-popover__content > div { - padding: 4px 8px; -} - -.components-tooltip__shortcut { - display: inline-block; - margin-right: 8px; -} - -.disabled-element-wrapper { - position: relative; -} -.disabled-element-wrapper .event-catcher { - z-index: 100002; - position: absolute; - width: 100%; - height: 100%; - top: 0; - right: 0; - bottom: 0; - left: 0; -}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-animate__appear { - animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-animate__appear { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-animate__appear.is-from-top, .components-animate__appear.is-from-top.is-from-left { - transform-origin: top left; -} -.components-animate__appear.is-from-top.is-from-right { - transform-origin: top right; -} -.components-animate__appear.is-from-bottom, .components-animate__appear.is-from-bottom.is-from-left { - transform-origin: bottom left; -} -.components-animate__appear.is-from-bottom.is-from-right { - transform-origin: bottom right; -} - -@keyframes components-animate__appear-animation { - from { - transform: translateY(-2em) scaleY(0) scaleX(0); - } - to { - transform: translateY(0%) scaleY(1) scaleX(1); - } -} -.components-animate__slide-in { - animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1); - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-animate__slide-in { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-animate__slide-in.is-from-left { - transform: translateX(100%); -} -.components-animate__slide-in.is-from-right { - transform: translateX(-100%); -} - -@keyframes components-animate__slide-in-animation { - 100% { - transform: translateX(0%); - } -} -.components-animate__loading { - animation: components-animate__loading 1.6s ease-in-out infinite; -} - -@keyframes components-animate__loading { - 0% { - opacity: 0.5; - } - 50% { - opacity: 1; - } - 100% { - opacity: 0.5; - } -} -.components-autocomplete__popover .components-popover__content > div { - padding: 16px; - min-width: 220px; -} - -.components-autocomplete__result.components-button { - display: flex; - height: auto; - min-height: 36px; - text-align: left; - width: 100%; -} -.components-autocomplete__result.components-button.is-selected { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.components-button-group { - display: inline-block; -} -.components-button-group .components-button { - border-radius: 0; - display: inline-flex; - color: #1e1e1e; - box-shadow: inset 0 0 0 1px #1e1e1e; -} -.components-button-group .components-button + .components-button { - margin-left: -1px; -} -.components-button-group .components-button:first-child { - border-radius: 2px 0 0 2px; -} -.components-button-group .components-button:last-child { - border-radius: 0 2px 2px 0; -} -.components-button-group .components-button:focus, .components-button-group .components-button.is-primary { - position: relative; - z-index: 1; -} -.components-button-group .components-button.is-primary { - box-shadow: inset 0 0 0 1px #1e1e1e; -} - -.components-button { - display: inline-flex; - text-decoration: none; - font-family: inherit; - font-weight: normal; - font-size: 13px; - margin: 0; - border: 0; - cursor: pointer; - -webkit-appearance: none; - background: none; - transition: box-shadow 0.1s linear; - height: 36px; - align-items: center; - box-sizing: border-box; - padding: 6px 12px; - border-radius: 2px; - color: #1e1e1e; - /** - * Primary button style. - */ - /** - * Secondary and tertiary buttons. - */ - /** - * Secondary button style. - */ - /** - * Tertiary buttons. - */ - /** - * Destructive buttons. - */ - /** - * Link buttons. - */ -} -@media (prefers-reduced-motion: reduce) { - .components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button[aria-expanded=true], .components-button:hover { - color: var(--wp-admin-theme-color); -} -.components-button[aria-disabled=true]:hover { - color: initial; -} -.components-button:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 3px solid transparent; -} -.components-button.is-primary { - white-space: nowrap; - background: var(--wp-admin-theme-color); - color: #fff; - text-decoration: none; - text-shadow: none; - outline: 1px solid transparent; -} -.components-button.is-primary:hover:not(:disabled) { - background: var(--wp-admin-theme-color-darker-10); - color: #fff; -} -.components-button.is-primary:active:not(:disabled) { - background: var(--wp-admin-theme-color-darker-20); - border-color: var(--wp-admin-theme-color-darker-20); - color: #fff; -} -.components-button.is-primary:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.is-primary:disabled, .components-button.is-primary:disabled:active:enabled, .components-button.is-primary[aria-disabled=true], .components-button.is-primary[aria-disabled=true]:enabled, .components-button.is-primary[aria-disabled=true]:active:enabled { - color: rgba(255, 255, 255, 0.4); - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); - opacity: 1; - outline: none; -} -.components-button.is-primary:disabled:focus:enabled, .components-button.is-primary:disabled:active:enabled:focus:enabled, .components-button.is-primary[aria-disabled=true]:focus:enabled, .components-button.is-primary[aria-disabled=true]:enabled:focus:enabled, .components-button.is-primary[aria-disabled=true]:active:enabled:focus:enabled { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); -} -.components-button.is-primary.is-busy, .components-button.is-primary.is-busy:disabled, .components-button.is-primary.is-busy[aria-disabled=true] { - color: #fff; - background-size: 100px 100%; - /* stylelint-disable */ - background-image: linear-gradient(-45deg, var(--wp-admin-theme-color) 33%, var(--wp-admin-theme-color-darker-20) 33%, var(--wp-admin-theme-color-darker-20) 70%, var(--wp-admin-theme-color) 70%); - /* stylelint-enable */ - border-color: var(--wp-admin-theme-color); -} -.components-button.is-secondary, .components-button.is-tertiary { - outline: 1px solid transparent; -} -.components-button.is-secondary:active:not(:disabled), .components-button.is-tertiary:active:not(:disabled) { - background: #ddd; - color: var(--wp-admin-theme-color-darker-10); - box-shadow: none; -} -.components-button.is-secondary:hover:not(:disabled), .components-button.is-tertiary:hover:not(:disabled) { - color: var(--wp-admin-theme-color-darker-10); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color-darker-10); -} -.components-button.is-secondary:disabled, .components-button.is-secondary[aria-disabled=true], .components-button.is-secondary[aria-disabled=true]:hover, .components-button.is-tertiary:disabled, .components-button.is-tertiary[aria-disabled=true], .components-button.is-tertiary[aria-disabled=true]:hover { - color: #828282; - background: #eaeaea; - transform: none; - opacity: 1; - box-shadow: none; - outline: none; -} -.components-button.is-secondary { - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); - outline: 1px solid transparent; - white-space: nowrap; - color: var(--wp-admin-theme-color); - background: transparent; -} -.components-button.is-tertiary { - white-space: nowrap; - color: var(--wp-admin-theme-color); - background: transparent; - padding: 6px; -} -.components-button.is-tertiary .dashicon { - display: inline-block; - flex: 0 0 auto; -} -p + .components-button.is-tertiary { - margin-left: -6px; -} -.components-button.is-destructive { - color: #cc1818; - box-shadow: inset 0 0 0 1px #cc1818; -} -.components-button.is-destructive:hover:not(:disabled) { - color: #710d0d; - box-shadow: inset 0 0 0 1px #710d0d; -} -.components-button.is-destructive:focus:not(:disabled) { - color: var(--wp-admin-theme-color); -} -.components-button.is-destructive:active:not(:disabled) { - background: #ccc; -} -.components-button.is-destructive.is-primary { - color: #fff; - background: #cc1818; - box-shadow: inset 0 0 0 1px #cc1818; -} -.components-button.is-destructive.is-primary:hover:not(:disabled) { - color: #fff; - background: #710d0d; - box-shadow: inset 0 0 0 1px #710d0d; -} -.components-button.is-destructive.is-tertiary { - box-shadow: none; -} -.components-button.is-destructive.is-tertiary:hover:not(:disabled) { - box-shadow: inset 0 0 0 1px #cc1818; - color: #cc1818; -} -.components-button.is-destructive.is-tertiary:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) #cc1818; - color: #cc1818; -} -.components-button.is-link { - margin: 0; - padding: 0; - box-shadow: none; - border: 0; - border-radius: 0; - background: none; - outline: none; - text-align: left; - color: var(--wp-admin-theme-color); - text-decoration: underline; - transition-property: border, background, color; - transition-duration: 0.05s; - transition-timing-function: ease-in-out; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .components-button.is-link { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button.is-link:focus { - border-radius: 2px; -} -.components-button.is-link.is-destructive { - color: #cc1818; -} -.components-button.is-link.is-destructive:active:not(:disabled), .components-button.is-link.is-destructive:hover:not(:disabled) { - color: #710d0d; - background: none; -} -.components-button.is-link.is-destructive:focus:not(:disabled) { - color: var(--wp-admin-theme-color); -} -.components-button:not([aria-disabled=true]):active { - color: inherit; -} -.components-button:disabled, .components-button[aria-disabled=true] { - cursor: default; - opacity: 0.3; -} -.components-button.is-busy, .components-button.is-secondary.is-busy, .components-button.is-secondary.is-busy:disabled, .components-button.is-secondary.is-busy[aria-disabled=true] { - animation: components-button__busy-animation 2500ms infinite linear; - opacity: 1; - background-size: 100px 100%; - /* stylelint-disable */ - background-image: linear-gradient(-45deg, #fafafa 33%, #e0e0e0 33%, #e0e0e0 70%, #fafafa 70%); - /* stylelint-enable */ -} -.components-button.is-small { - height: 24px; - line-height: 22px; - padding: 0 8px; - font-size: 11px; -} -.components-button.is-small.has-icon:not(.has-text) { - padding: 0 8px; - width: 24px; -} -.components-button.has-icon { - padding: 6px; - min-width: 36px; - justify-content: center; -} -.components-button.has-icon .dashicon { - display: inline-block; - flex: 0 0 auto; - margin-left: 2px; - margin-right: 2px; -} -.components-button.has-icon.has-text { - justify-content: left; -} -.components-button.has-icon.has-text svg { - margin-right: 8px; -} -.components-button.has-icon.has-text .dashicon { - margin-right: 10px; -} -.components-button.is-pressed { - color: #fff; - background: #1e1e1e; -} -.components-button.is-pressed:focus:not(:disabled) { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-button.is-pressed:hover:not(:disabled) { - color: #fff; - background: #1e1e1e; -} -.components-button svg { - fill: currentColor; - outline: none; -} -@media (forced-colors: active) { - .components-button svg { - fill: CanvasText; - } -} -.components-button .components-visually-hidden { - height: auto; -} - -@keyframes components-button__busy-animation { - 0% { - background-position: 200px 0; - } -} -.components-checkbox-control__input[type=checkbox] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-right: 12px; - transition: none; - border-radius: 2px; - background: #fff; - color: #1e1e1e; - clear: none; - cursor: pointer; - display: inline-block; - line-height: 0; - margin: 0 4px 0 0; - outline: 0; - padding: 0 !important; - text-align: center; - vertical-align: top; - width: 24px; - height: 24px; - -webkit-appearance: none; - appearance: none; - transition: 0.1s border-color ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-checkbox-control__input[type=checkbox] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-checkbox-control__input[type=checkbox] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-checkbox-control__input[type=checkbox]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-checkbox-control__input[type=checkbox]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox]:checked::-ms-check { - opacity: 0; -} -.components-checkbox-control__input[type=checkbox]:checked::before, .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - margin: -3px -5px; - color: #fff; -} -@media (min-width: 782px) { - .components-checkbox-control__input[type=checkbox]:checked::before, .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - margin: -4px 0 0 -5px; - } -} -.components-checkbox-control__input[type=checkbox][aria-checked=mixed] { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - content: ""; - float: left; - display: inline-block; - vertical-align: middle; - width: 16px; - /* stylelint-disable */ - font: normal 30px/1 dashicons; - /* stylelint-enable */ - speak: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -@media (min-width: 782px) { - .components-checkbox-control__input[type=checkbox][aria-checked=mixed]::before { - float: none; - font-size: 21px; - } -} -@media (min-width: 600px) { - .components-checkbox-control__input[type=checkbox] { - height: 20px; - width: 20px; - } -} -@media (prefers-reduced-motion: reduce) { - .components-checkbox-control__input[type=checkbox] { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-checkbox-control__input[type=checkbox]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-checkbox-control__input[type=checkbox]:checked, .components-checkbox-control__input[type=checkbox]:indeterminate { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.components-checkbox-control__input[type=checkbox]:checked::-ms-check, .components-checkbox-control__input[type=checkbox]:indeterminate::-ms-check { - opacity: 0; -} -.components-checkbox-control__input[type=checkbox]:checked::before { - content: none; -} - -.components-checkbox-control__input-container { - position: relative; - display: inline-block; - margin-right: 12px; - vertical-align: middle; - width: 24px; - height: 24px; -} -@media (min-width: 600px) { - .components-checkbox-control__input-container { - width: 20px; - height: 20px; - } -} - -svg.components-checkbox-control__checked, -svg.components-checkbox-control__indeterminate { - fill: #fff; - cursor: pointer; - position: absolute; - left: 0; - top: 0; - width: 24px; - height: 24px; - -webkit-user-select: none; - user-select: none; - pointer-events: none; -} -@media (min-width: 600px) { - svg.components-checkbox-control__checked, -svg.components-checkbox-control__indeterminate { - left: -2px; - top: -2px; - } -} - -.components-circular-option-picker { - display: inline-block; - width: 100%; - min-width: 188px; -} -.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper { - display: flex; - justify-content: flex-end; - margin-top: 12px; -} -.components-circular-option-picker .components-circular-option-picker__swatches { - display: flex; - flex-wrap: wrap; - gap: 12px; -} - -.components-circular-option-picker__option-wrapper { - display: inline-block; - height: 28px; - width: 28px; - vertical-align: top; - transform: scale(1); - transition: 100ms transform ease; -} -@media (prefers-reduced-motion: reduce) { - .components-circular-option-picker__option-wrapper { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-circular-option-picker__option-wrapper:hover { - transform: scale(1.2); -} -.components-circular-option-picker__option-wrapper > div { - height: 100%; - width: 100%; -} - -.components-circular-option-picker__option-wrapper::before { - content: ""; - position: absolute; - top: 1px; - left: 1px; - bottom: 1px; - right: 1px; - border-radius: 50%; - z-index: -1; - /* stylelint-disable-next-line function-url-quotes */ - background: url('data:image/svg+xml,%3Csvg width="28" height="28" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M6 8V6H4v2h2zM8 8V6h2v2H8zM10 16H8v-2h2v2zM12 16v-2h2v2h-2zM12 18v-2h-2v2H8v2h2v-2h2zM14 18v2h-2v-2h2zM16 18h-2v-2h2v2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M18 18h2v-2h-2v-2h2v-2h-2v-2h2V8h-2v2h-2V8h-2v2h2v2h-2v2h2v2h2v2zm-2-4v-2h2v2h-2z" fill="%23555D65"/%3E%3Cpath d="M18 18v2h-2v-2h2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M8 10V8H6v2H4v2h2v2H4v2h2v2H4v2h2v2H4v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2v2h-2V4h-2v2h-2V4h-2v2h-2V4h-2v2h2v2h-2v2H8zm0 2v-2H6v2h2zm2 0v-2h2v2h-2zm0 2v-2H8v2H6v2h2v2H6v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h-2v2h-2V6h-2v2h-2v2h2v2h-2v2h-2z" fill="%23555D65"/%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M4 0H2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v2H0v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2h-2V0h-2v2H8V0H6v2H4V0zm0 4V2H2v2h2zm2 0V2h2v2H6zm0 2V4H4v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2H2v2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h2v2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2v-2h-2v-2h2V8h-2V6h2V4h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2h-2V2h-2v2H8v2H6z" fill="%23555D65"/%3E%3C/svg%3E'); -} - -.components-circular-option-picker__option { - display: inline-block; - vertical-align: top; - height: 100%; - width: 100%; - border: none; - border-radius: 50%; - background: transparent; - box-shadow: inset 0 0 0 14px; - transition: 100ms box-shadow ease; - cursor: pointer; -} -@media (prefers-reduced-motion: reduce) { - .components-circular-option-picker__option { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-circular-option-picker__option:hover { - box-shadow: inset 0 0 0 14px !important; -} -.components-circular-option-picker__option.is-pressed { - box-shadow: inset 0 0 0 4px; - position: relative; - z-index: 1; - overflow: visible; -} -.components-circular-option-picker__option.is-pressed + svg { - position: absolute; - left: 2px; - top: 2px; - border-radius: 50%; - z-index: 2; - pointer-events: none; -} -.components-circular-option-picker__option::after { - content: ""; - position: absolute; - top: -1px; - left: -1px; - bottom: -1px; - right: -1px; - border-radius: 50%; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - border: 1px solid transparent; -} -.components-circular-option-picker__option:focus::after { - content: ""; - border: 2px solid #757575; - width: 32px; - height: 32px; - position: absolute; - top: -2px; - left: -2px; - border-radius: 50%; - box-shadow: inset 0 0 0 2px #fff; -} -.components-circular-option-picker__option.components-button:focus { - background-color: transparent; - box-shadow: inset 0 0 0 14px; - outline: none; -} - -.components-circular-option-picker__button-action .components-circular-option-picker__option { - color: #fff; - background: #fff; -} - -.components-circular-option-picker__dropdown-link-action { - margin-right: 16px; -} -.components-circular-option-picker__dropdown-link-action .components-button { - line-height: 22px; -} - -@media (min-width: 782px) { - .components-palette-edit__popover.components-popover .components-popover__content.components-popover__content.components-popover__content { - margin-right: 156px; - margin-top: -49px; - } -} -.components-palette-edit__popover .components-custom-gradient-picker__gradient-bar { - margin-top: 0; -} -.components-palette-edit__popover .components-custom-gradient-picker__ui-line { - margin-bottom: 0; -} -.components-palette-edit__popover .components-custom-gradient-picker { - width: 280px; - padding: 8px; -} - -.components-dropdown-menu__menu .components-palette-edit__menu-button { - width: 100%; -} - -.component-color-indicator { - width: 20px; - height: 20px; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - border-radius: 50%; - display: inline-block; - padding: 0; -} - -.components-combobox-control { - width: 100%; -} - -input.components-combobox-control__input[type=text] { - width: 100%; - border: none; - box-shadow: none; - font-family: inherit; - font-size: 16px; - padding: 2px; - margin: 0; - line-height: inherit; - min-height: auto; -} -@media (min-width: 600px) { - input.components-combobox-control__input[type=text] { - font-size: 13px; - } -} -input.components-combobox-control__input[type=text]:focus { - outline: none; - box-shadow: none; -} - -.components-combobox-control__suggestions-container { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: flex; - flex-wrap: wrap; - align-items: flex-start; - width: 100%; - margin: 0 0 8px 0; - padding: 4px; -} -@media (prefers-reduced-motion: reduce) { - .components-combobox-control__suggestions-container { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-combobox-control__suggestions-container { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-combobox-control__suggestions-container:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-combobox-control__suggestions-container::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-combobox-control__suggestions-container:focus-within { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.components-combobox-control__reset.components-button { - display: flex; - height: 16px; - min-width: 16px; - padding: 0; -} - -.components-color-list-picker, -.components-color-list-picker__swatch-button { - width: 100%; -} - -.components-color-list-picker__color-picker { - margin: 8px 0; -} - -.components-color-palette__custom-color { - position: relative; - border: none; - background: none; - border-radius: 2px; - height: 64px; - padding: 12px; - font-family: inherit; - width: 100%; - background-image: repeating-linear-gradient(45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0), repeating-linear-gradient(45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0); - background-position: 0 0, 25px 25px; - background-size: calc(2 * 25px) calc(2 * 25px); - box-sizing: border-box; - color: #fff; - cursor: pointer; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - outline: 1px solid transparent; -} -.components-color-palette__custom-color:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline-width: 2px; -} - -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content { - overflow: visible; - box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05); - border: none; - border-radius: 2px; - max-height: -moz-fit-content !important; - max-height: fit-content !important; -} -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content > div { - padding: 0; -} -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation { - border-top-right-radius: 2px; - border-top-left-radius: 2px; -} - -@media (min-width: 782px) { - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar .components-popover__content.components-popover__content { - margin-right: 156px; - } - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content { - margin-top: -60px; - } - .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-bottom .components-popover__content { - margin-bottom: -60px; - } -} -.components-color-palette__custom-color-name { - text-align: left; -} - -.components-color-palette__custom-color-value { - margin-left: 16px; - text-transform: uppercase; -} - -.components-custom-gradient-picker__gradient-bar:not(.has-gradient) { - opacity: 0.4; -} - -.components-custom-gradient-picker__gradient-bar { - border-radius: 2px; - margin-top: 12px; - width: 100%; - height: 48px; - margin-bottom: 20px; - /*rtl:ignore*/ - padding-right: 16px; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__markers-container { - position: relative; - width: calc(100% - 32px); - margin-left: auto; - margin-right: auto; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point { - border-radius: 50%; - background: #fff; - padding: 2px; - top: 16px; - min-width: 16px; - width: 16px; - height: 16px; - position: relative; - color: #1e1e1e; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__insert-point svg { - height: 100%; - width: 100%; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button { - border-radius: 50%; - height: 16px; - width: 16px; - padding: 0; - position: absolute; - top: 16px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #fff, 0 0 2px 0 rgba(0, 0, 0, 0.25); - outline: 2px solid transparent; -} -.components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button:focus, .components-custom-gradient-picker__gradient-bar .components-custom-gradient-picker__control-point-button.is-active { - box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) #fff, 0 0 2px 0 rgba(0, 0, 0, 0.25); - outline: 4px solid transparent; -} - -.components-custom-gradient-picker__color-picker-popover .components-custom-gradient-picker__remove-control-point { - margin-left: auto; - margin-right: auto; - display: block; - margin-bottom: 8px; -} - -.components-custom-gradient-picker__inserter { - /*rtl:ignore*/ - direction: ltr; - width: 100%; -} - -.components-custom-gradient-picker__liner-gradient-indicator { - display: inline-block; - flex: 0 auto; - width: 20px; - height: 20px; -} - -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line { - margin-bottom: 16px; -} -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-angle-picker, -.components-custom-gradient-picker .components-custom-gradient-picker__ui-line .components-base-control.components-custom-gradient-picker__type-picker { - margin-bottom: 0; -} - -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar { - border: none; -} -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar > div + div { - margin-left: 1px; -} -.components-custom-gradient-picker .components-custom-gradient-picker__toolbar button.is-pressed > svg { - background: #fff; - border: 1px solid #949494; - border-radius: 2px; -} - -.components-custom-gradient-picker .components-input-control__label { - line-height: 1; -} -.components-custom-gradient-picker label { - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.components-custom-select-control { - position: relative; -} - -.components-custom-select-control__label { - display: block; - margin-bottom: 8px; -} - -.components-custom-select-control__button { - border: 1px solid #757575; - border-radius: 2px; - min-width: 130px; - position: relative; - text-align: left; -} -.components-custom-select-control__button:not(.is-next-36px-default-size) { - min-height: 30px; -} -.components-custom-select-control__button.components-custom-select-control__button { - padding-left: 16px; - padding-right: 32px; -} -.components-custom-select-control__button.components-custom-select-control__button:not(.is-next-36px-default-size) { - padding-left: 8px; - padding-right: 24px; -} -.components-custom-select-control__button:focus:not(:disabled) { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.components-custom-select-control__button .components-custom-select-control__button-icon { - height: 100%; - padding: 0; - position: absolute; - right: 8px; - top: 0; -} -.components-custom-select-control__button .components-custom-select-control__button-icon:not(.is-next-36px-default-size) { - right: 4px; -} - -.components-custom-select-control__menu { - border: 1px solid #1e1e1e; - background-color: #fff; - border-radius: 2px; - outline: none; - transition: none; - max-height: 400px; - min-width: 100%; - overflow: auto; - padding: 0; - position: absolute; - z-index: 1000000; -} -.components-custom-select-control__menu[aria-hidden=true] { - display: none; -} - -.components-custom-select-control__item { - align-items: center; - display: grid; - grid-template-columns: auto auto; - list-style-type: none; - padding: 8px 16px; - cursor: default; - line-height: 28px; -} -.components-custom-select-control__item:not(.is-next-36px-default-size) { - padding: 8px; -} -.components-custom-select-control__item.has-hint { - grid-template-columns: auto auto 30px; -} -.components-custom-select-control__item.is-highlighted { - background: #ddd; -} -.components-custom-select-control__item .components-custom-select-control__item-hint { - color: #757575; - text-align: right; - padding-right: 4px; -} -.components-custom-select-control__item .components-custom-select-control__item-icon { - margin-left: auto; -} -.components-custom-select-control__item:last-child { - margin-bottom: 0; -} - -/** - * Parts of this source were derived and modified from react-dates, - * released under the MIT license. - * - * https://github.com/airbnb/react-dates - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Airbnb - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -/*rtl:begin:ignore*/ -.PresetDateRangePicker_panel { - padding: 0 22px 11px; -} - -.PresetDateRangePicker_button { - position: relative; - height: 100%; - text-align: center; - background: 0 0; - border: 2px solid #00a699; - color: #00a699; - padding: 4px 12px; - margin-right: 8px; - font: inherit; - font-weight: 700; - line-height: normal; - overflow: visible; - box-sizing: border-box; - cursor: pointer; -} - -.PresetDateRangePicker_button:active { - outline: 0; -} - -.PresetDateRangePicker_button__selected { - color: #fff; - background: #00a699; -} - -.SingleDatePickerInput { - display: inline-block; - background-color: #fff; -} - -.SingleDatePickerInput__withBorder { - border-radius: 2px; - border: 1px solid #dbdbdb; -} - -.SingleDatePickerInput__rtl { - direction: rtl; -} - -.SingleDatePickerInput__disabled { - background-color: #f2f2f2; -} - -.SingleDatePickerInput__block { - display: block; -} - -.SingleDatePickerInput__showClearDate { - padding-right: 30px; -} - -.SingleDatePickerInput_clearDate { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - padding: 10px; - margin: 0 10px 0 5px; - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} - -.SingleDatePickerInput_clearDate__default:focus, -.SingleDatePickerInput_clearDate__default:hover { - background: #dbdbdb; - border-radius: 50%; -} - -.SingleDatePickerInput_clearDate__small { - padding: 6px; -} - -.SingleDatePickerInput_clearDate__hide { - visibility: hidden; -} - -.SingleDatePickerInput_clearDate_svg { - fill: #82888a; - height: 12px; - width: 15px; - vertical-align: middle; -} - -.SingleDatePickerInput_clearDate_svg__small { - height: 9px; -} - -.SingleDatePickerInput_calendarIcon { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - display: inline-block; - vertical-align: middle; - padding: 10px; - margin: 0 5px 0 10px; -} - -.SingleDatePickerInput_calendarIcon_svg { - fill: #82888a; - height: 15px; - width: 14px; - vertical-align: middle; -} - -.SingleDatePicker { - position: relative; - display: inline-block; -} - -.SingleDatePicker__block { - display: block; -} - -.SingleDatePicker_picker { - z-index: 1; - background-color: #fff; - position: absolute; -} - -.SingleDatePicker_picker__rtl { - direction: rtl; -} - -.SingleDatePicker_picker__directionLeft { - left: 0; -} - -.SingleDatePicker_picker__directionRight { - right: 0; -} - -.SingleDatePicker_picker__portal { - background-color: rgba(0, 0, 0, 0.3); - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; -} - -.SingleDatePicker_picker__fullScreenPortal { - background-color: #fff; -} - -.SingleDatePicker_closeButton { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - position: absolute; - top: 0; - right: 0; - padding: 15px; - z-index: 2; -} - -.SingleDatePicker_closeButton:focus, -.SingleDatePicker_closeButton:hover { - color: #b0b3b4; - text-decoration: none; -} - -.SingleDatePicker_closeButton_svg { - height: 15px; - width: 15px; - fill: #cacccd; -} - -.DayPickerKeyboardShortcuts_buttonReset { - background: 0 0; - border: 0; - border-radius: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - padding: 0; - cursor: pointer; - font-size: 14px; -} - -.DayPickerKeyboardShortcuts_buttonReset:active { - outline: 0; -} - -.DayPickerKeyboardShortcuts_show { - width: 22px; - position: absolute; - z-index: 2; -} - -.DayPickerKeyboardShortcuts_show__bottomRight { - border-top: 26px solid transparent; - border-right: 33px solid #00a699; - bottom: 0; - right: 0; -} - -.DayPickerKeyboardShortcuts_show__bottomRight:hover { - border-right: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_show__topRight { - border-bottom: 26px solid transparent; - border-right: 33px solid #00a699; - top: 0; - right: 0; -} - -.DayPickerKeyboardShortcuts_show__topRight:hover { - border-right: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_show__topLeft { - border-bottom: 26px solid transparent; - border-left: 33px solid #00a699; - top: 0; - left: 0; -} - -.DayPickerKeyboardShortcuts_show__topLeft:hover { - border-left: 33px solid #008489; -} - -.DayPickerKeyboardShortcuts_showSpan { - color: #fff; - position: absolute; -} - -.DayPickerKeyboardShortcuts_showSpan__bottomRight { - bottom: 0; - right: -28px; -} - -.DayPickerKeyboardShortcuts_showSpan__topRight { - top: 1px; - right: -28px; -} - -.DayPickerKeyboardShortcuts_showSpan__topLeft { - top: 1px; - left: -28px; -} - -.DayPickerKeyboardShortcuts_panel { - overflow: auto; - background: #fff; - border: 1px solid #dbdbdb; - border-radius: 2px; - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - z-index: 2; - padding: 22px; - margin: 33px; -} - -.DayPickerKeyboardShortcuts_title { - font-size: 16px; - font-weight: 700; - margin: 0; -} - -.DayPickerKeyboardShortcuts_list { - list-style: none; - padding: 0; - font-size: 14px; -} - -.DayPickerKeyboardShortcuts_close { - position: absolute; - right: 22px; - top: 22px; - z-index: 2; -} - -.DayPickerKeyboardShortcuts_close:active { - outline: 0; -} - -.DayPickerKeyboardShortcuts_closeSvg { - height: 15px; - width: 15px; - fill: #cacccd; -} - -.DayPickerKeyboardShortcuts_closeSvg:focus, -.DayPickerKeyboardShortcuts_closeSvg:hover { - fill: #82888a; -} - -.CalendarDay { - box-sizing: border-box; - cursor: pointer; - font-size: 14px; - text-align: center; -} - -.CalendarDay:active { - outline: 0; -} - -.CalendarDay__defaultCursor { - cursor: default; -} - -.CalendarDay__default { - border: 1px solid #e4e7e7; - color: #484848; - background: #fff; -} - -.CalendarDay__default:hover { - background: #e4e7e7; - border: 1px double #e4e7e7; - color: inherit; -} - -.CalendarDay__hovered_offset { - background: #f4f5f5; - border: 1px double #e4e7e7; - color: inherit; -} - -.CalendarDay__outside { - border: 0; - background: #fff; - color: #484848; -} - -.CalendarDay__outside:hover { - border: 0; -} - -.CalendarDay__blocked_minimum_nights { - background: #fff; - border: 1px solid #eceeee; - color: #cacccd; -} - -.CalendarDay__blocked_minimum_nights:active, -.CalendarDay__blocked_minimum_nights:hover { - background: #fff; - color: #cacccd; -} - -.CalendarDay__highlighted_calendar { - background: #ffe8bc; - color: #484848; -} - -.CalendarDay__highlighted_calendar:active, -.CalendarDay__highlighted_calendar:hover { - background: #ffce71; - color: #484848; -} - -.CalendarDay__selected_span { - background: #66e2da; - border: 1px solid #33dacd; - color: #fff; -} - -.CalendarDay__selected_span:active, -.CalendarDay__selected_span:hover { - background: #33dacd; - border: 1px solid #33dacd; - color: #fff; -} - -.CalendarDay__last_in_range { - border-right: #00a699; -} - -.CalendarDay__selected, -.CalendarDay__selected:active, -.CalendarDay__selected:hover { - background: #00a699; - border: 1px solid #00a699; - color: #fff; -} - -.CalendarDay__hovered_span, -.CalendarDay__hovered_span:hover { - background: #b2f1ec; - border: 1px solid #80e8e0; - color: #007a87; -} - -.CalendarDay__hovered_span:active { - background: #80e8e0; - border: 1px solid #80e8e0; - color: #007a87; -} - -.CalendarDay__blocked_calendar, -.CalendarDay__blocked_calendar:active, -.CalendarDay__blocked_calendar:hover { - background: #cacccd; - border: 1px solid #cacccd; - color: #82888a; -} - -.CalendarDay__blocked_out_of_range, -.CalendarDay__blocked_out_of_range:active, -.CalendarDay__blocked_out_of_range:hover { - background: #fff; - border: 1px solid #e4e7e7; - color: #cacccd; -} - -.CalendarMonth { - background: #fff; - text-align: center; - vertical-align: top; - -webkit-user-select: none; - user-select: none; -} - -.CalendarMonth_table { - border-collapse: collapse; - border-spacing: 0; -} - -.CalendarMonth_verticalSpacing { - border-collapse: separate; -} - -.CalendarMonth_caption { - color: #484848; - font-size: 18px; - text-align: center; - padding-top: 22px; - padding-bottom: 37px; - caption-side: initial; -} - -.CalendarMonth_caption__verticalScrollable { - padding-top: 12px; - padding-bottom: 7px; -} - -.CalendarMonthGrid { - background: #fff; - text-align: left; - z-index: 0; -} - -.CalendarMonthGrid__animating { - z-index: 1; -} - -.CalendarMonthGrid__horizontal { - position: absolute; - left: 0; -} - -.CalendarMonthGrid__vertical { - margin: 0 auto; -} - -.CalendarMonthGrid__vertical_scrollable { - margin: 0 auto; - overflow-y: scroll; -} - -.CalendarMonthGrid_month__horizontal { - display: inline-block; - vertical-align: top; - min-height: 100%; -} - -.CalendarMonthGrid_month__hideForAnimation { - position: absolute; - z-index: -1; - opacity: 0; - pointer-events: none; -} - -.CalendarMonthGrid_month__hidden { - visibility: hidden; -} - -.DayPickerNavigation { - position: relative; - z-index: 2; -} - -.DayPickerNavigation__horizontal { - height: 0; -} - -.DayPickerNavigation__verticalDefault { - position: absolute; - width: 100%; - height: 52px; - bottom: 0; - left: 0; -} - -.DayPickerNavigation__verticalScrollableDefault { - position: relative; -} - -.DayPickerNavigation_button { - cursor: pointer; - -webkit-user-select: none; - user-select: none; - border: 0; - padding: 0; - margin: 0; -} - -.DayPickerNavigation_button__default { - border: 1px solid #e4e7e7; - background-color: #fff; - color: #757575; -} - -.DayPickerNavigation_button__default:focus, -.DayPickerNavigation_button__default:hover { - border: 1px solid #c4c4c4; -} - -.DayPickerNavigation_button__default:active { - background: #f2f2f2; -} - -.DayPickerNavigation_button__horizontalDefault { - position: absolute; - top: 18px; - line-height: 0.78; - border-radius: 3px; - padding: 6px 9px; -} - -.DayPickerNavigation_leftButton__horizontalDefault { - left: 22px; -} - -.DayPickerNavigation_rightButton__horizontalDefault { - right: 22px; -} - -.DayPickerNavigation_button__verticalDefault { - padding: 5px; - background: #fff; - box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1); - position: relative; - display: inline-block; - height: 100%; - width: 50%; -} - -.DayPickerNavigation_nextButton__verticalDefault { - border-left: 0; -} - -.DayPickerNavigation_nextButton__verticalScrollableDefault { - width: 100%; -} - -.DayPickerNavigation_svg__horizontal { - height: 19px; - width: 19px; - fill: #82888a; - display: block; -} - -.DayPickerNavigation_svg__vertical { - height: 42px; - width: 42px; - fill: #484848; - display: block; -} - -.DayPicker { - background: #fff; - position: relative; - text-align: left; -} - -.DayPicker__horizontal { - background: #fff; -} - -.DayPicker__verticalScrollable { - height: 100%; -} - -.DayPicker__hidden { - visibility: hidden; -} - -.DayPicker__withBorder { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.07); - border-radius: 3px; -} - -.DayPicker_portal__horizontal { - box-shadow: none; - position: absolute; - left: 50%; - top: 50%; -} - -.DayPicker_portal__vertical { - position: initial; -} - -.DayPicker_focusRegion { - outline: 0; -} - -.DayPicker_calendarInfo__horizontal, -.DayPicker_wrapper__horizontal { - display: inline-block; - vertical-align: top; -} - -.DayPicker_weekHeaders { - position: relative; -} - -.DayPicker_weekHeaders__horizontal { - margin-left: 13px; -} - -.DayPicker_weekHeader { - color: #757575; - position: absolute; - top: 62px; - z-index: 2; - text-align: left; - padding: 0 !important; -} - -.DayPicker_weekHeader__vertical { - left: 50%; -} - -.DayPicker_weekHeader__verticalScrollable { - top: 0; - display: table-row; - border-bottom: 1px solid #dbdbdb; - background: #fff; - margin-left: 0; - left: 0; - width: 100%; - text-align: center; -} - -.DayPicker_weekHeader_ul { - list-style: none; - margin: 1px 0; - padding-left: 0; - padding-right: 0; - font-size: 14px; -} - -.DayPicker_weekHeader_li { - display: inline-block; - text-align: center; - margin: 0 1px; -} - -.DayPicker_transitionContainer { - position: relative; - overflow: hidden; - border-radius: 3px; -} - -.DayPicker_transitionContainer__horizontal { - transition: height 0.2s ease-in-out; -} - -.DayPicker_transitionContainer__vertical { - width: 100%; -} - -.DayPicker_transitionContainer__verticalScrollable { - padding-top: 20px; - height: 100%; - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - overflow-y: scroll; -} - -.DateInput { - margin: 0; - padding: 0; - background: #fff; - position: relative; - display: inline-block; - width: 130px; - vertical-align: middle; -} - -.DateInput__small { - width: 97px; -} - -.DateInput__block { - width: 100%; -} - -.DateInput__disabled { - background: #f2f2f2; - color: #dbdbdb; -} - -.DateInput_input { - font-weight: 200; - font-size: 19px; - line-height: 24px; - color: #484848; - background-color: #fff; - width: 100%; - padding: 11px 11px 9px; - border: 0; - border-top: 0; - border-right: 0; - border-bottom: 2px solid transparent; - border-left: 0; - border-radius: 0; -} - -.DateInput_input__small { - font-size: 15px; - line-height: 18px; - letter-spacing: 0.2px; - padding: 7px 7px 5px; -} - -.DateInput_input__regular { - font-weight: auto; -} - -.DateInput_input__readOnly { - -webkit-user-select: none; - user-select: none; -} - -.DateInput_input__focused { - outline: 0; - background: #fff; - border: 0; - border-top: 0; - border-right: 0; - border-bottom: 2px solid #008489; - border-left: 0; -} - -.DateInput_input__disabled { - background: #f2f2f2; - font-style: italic; -} - -.DateInput_screenReaderMessage { - border: 0; - clip: rect(0, 0, 0, 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -.DateInput_fang { - position: absolute; - width: 20px; - height: 10px; - left: 22px; - z-index: 2; -} - -.DateInput_fangShape { - fill: #fff; -} - -.DateInput_fangStroke { - stroke: #dbdbdb; - fill: transparent; -} - -.DateRangePickerInput { - background-color: #fff; - display: inline-block; -} - -.DateRangePickerInput__disabled { - background: #f2f2f2; -} - -.DateRangePickerInput__withBorder { - border-radius: 2px; - border: 1px solid #dbdbdb; -} - -.DateRangePickerInput__rtl { - direction: rtl; -} - -.DateRangePickerInput__block { - display: block; -} - -.DateRangePickerInput__showClearDates { - padding-right: 30px; -} - -.DateRangePickerInput_arrow { - display: inline-block; - vertical-align: middle; - color: #484848; -} - -.DateRangePickerInput_arrow_svg { - vertical-align: middle; - fill: #484848; - height: 24px; - width: 24px; -} - -.DateRangePickerInput_clearDates { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - padding: 10px; - margin: 0 10px 0 5px; - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); -} - -.DateRangePickerInput_clearDates__small { - padding: 6px; -} - -.DateRangePickerInput_clearDates_default:focus, -.DateRangePickerInput_clearDates_default:hover { - background: #dbdbdb; - border-radius: 50%; -} - -.DateRangePickerInput_clearDates__hide { - visibility: hidden; -} - -.DateRangePickerInput_clearDates_svg { - fill: #82888a; - height: 12px; - width: 15px; - vertical-align: middle; -} - -.DateRangePickerInput_clearDates_svg__small { - height: 9px; -} - -.DateRangePickerInput_calendarIcon { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - display: inline-block; - vertical-align: middle; - padding: 10px; - margin: 0 5px 0 10px; -} - -.DateRangePickerInput_calendarIcon_svg { - fill: #82888a; - height: 15px; - width: 14px; - vertical-align: middle; -} - -.DateRangePicker { - position: relative; - display: inline-block; -} - -.DateRangePicker__block { - display: block; -} - -.DateRangePicker_picker { - z-index: 1; - background-color: #fff; - position: absolute; -} - -.DateRangePicker_picker__rtl { - direction: rtl; -} - -.DateRangePicker_picker__directionLeft { - left: 0; -} - -.DateRangePicker_picker__directionRight { - right: 0; -} - -.DateRangePicker_picker__portal { - background-color: rgba(0, 0, 0, 0.3); - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; -} - -.DateRangePicker_picker__fullScreenPortal { - background-color: #fff; -} - -.DateRangePicker_closeButton { - background: 0 0; - border: 0; - color: inherit; - font: inherit; - line-height: normal; - overflow: visible; - cursor: pointer; - position: absolute; - top: 0; - right: 0; - padding: 15px; - z-index: 2; -} - -.DateRangePicker_closeButton:focus, -.DateRangePicker_closeButton:hover { - color: #b0b3b4; - text-decoration: none; -} - -.DateRangePicker_closeButton_svg { - height: 15px; - width: 15px; - fill: #cacccd; -} - -/*rtl:end:ignore*/ -.components-datetime { - padding: 16px; -} -.components-panel__body .components-datetime { - padding: 0; -} -.components-datetime .components-datetime__calendar-help { - padding: 16px; - min-width: 260px; -} -.components-datetime .components-datetime__calendar-help h4 { - margin: 0; -} -.components-datetime .components-datetime__buttons { - display: flex; - justify-content: space-between; -} -.components-datetime .components-datetime__date-help-toggle { - display: block; - margin-left: auto; -} -.components-datetime fieldset { - border: 0; - padding: 0; - margin: 0; -} -.components-datetime select, -.components-datetime input { - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; -} -@media (prefers-reduced-motion: reduce) { - .components-datetime select, -.components-datetime input { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-datetime select, -.components-datetime input[type=number], -.components-datetime .components-button { - height: 30px; - margin-top: 0; - margin-bottom: 0; -} -.components-datetime .components-button:focus { - z-index: 1; -} - -.components-datetime__date { - min-height: 236px; - border-top: 1px solid #ddd; -} -.components-datetime__date .DayPickerNavigation_leftButton__horizontalDefault { - /*!rtl:begin:ignore*/ - left: 13px; - /*!rtl:end:ignore*/ -} -.components-datetime__date .CalendarMonth_caption { - font-size: 13px; -} -.components-datetime__date .CalendarMonth_table { - border-collapse: separate; - border-spacing: 2px; -} -.components-datetime__date .CalendarDay { - font-size: 13px; - border: none; - border-radius: 50%; - text-align: center; -} -.components-datetime__date .CalendarDay:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 3px #fff; - outline: 2px solid transparent; -} -.components-datetime__date .CalendarDay__selected { - background: var(--wp-admin-theme-color); - border: 2px solid transparent; -} -.components-datetime__date .CalendarDay__selected:hover { - background: var(--wp-admin-theme-color-darker-20); -} -.components-datetime__date .CalendarDay__selected:focus { - box-shadow: inset 0 0 0 1px #fff; -} -.components-datetime__date .DayPickerNavigation_button__horizontalDefault { - padding: 2px 8px; - top: 20px; -} -.components-datetime__date .DayPickerNavigation_button__horizontalDefault:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-datetime__date .DayPicker_weekHeader { - top: 50px; -} -.components-datetime__date .DayPicker_weekHeader .DayPicker_weekHeader_ul { - margin: 1px; - padding-left: 0; - padding-right: 0; -} -.components-datetime__date.is-description-visible .DayPicker { - visibility: hidden; -} - -.components-datetime__date .CalendarDay .components-datetime__date__day { - height: 100%; - display: flex; - justify-content: center; - align-content: center; - flex-direction: column; - position: relative; -} -.components-datetime__date .CalendarDay .components-datetime__date__day.has-events::before { - content: " "; - width: 4px; - height: 4px; - border-radius: 2px; - position: absolute; - left: 50%; - margin-left: -2px; - bottom: 0; - background-color: #fff; -} - -.components-datetime__date .CalendarDay:not(.CalendarDay__selected) .components-datetime__date__day.has-events::before { - background: var(--wp-admin-theme-color); -} - -.components-datetime__time { - padding-bottom: 16px; -} -.components-datetime__time fieldset { - position: relative; - margin-bottom: 0.5em; -} -.components-datetime__time fieldset + fieldset { - margin-bottom: 0; -} -.components-datetime__time .components-datetime__time-field-am-pm fieldset { - margin-top: 0; -} -.components-datetime__time .components-datetime__time-wrapper { - display: flex; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-separator { - display: inline-block; - padding: 0 3px 0 0; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field-time { - /*rtl:ignore*/ - direction: ltr; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select { - margin-right: 4px; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field select:focus { - position: relative; - z-index: 1; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number] { - padding: 2px; - margin-right: 4px; - text-align: center; - -moz-appearance: textfield; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]:focus { - position: relative; - z-index: 1; -} -.components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number]::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; -} -.components-datetime__time.is-12-hour .components-datetime__time-field-day input { - margin: -4px 0 0 !important; - border-radius: 2px 0 0 2px !important; -} -.components-datetime__time.is-12-hour .components-datetime__time-field-year input { - border-radius: 0 2px 2px 0 !important; -} - -.components-datetime__timezone { - line-height: 30px; - margin-left: 4px; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -.components-datetime__time-legend { - font-weight: 600; - margin-top: 0.5em; -} -.components-datetime__time-legend.invisible { - position: absolute; - top: -999em; - left: -999em; -} - -.components-datetime__time-field-integer-field { - font-family: inherit; -} - -.components-datetime__time-field-hours-input, -.components-datetime__time-field-minutes-input, -.components-datetime__time-field-day-input { - width: 35px; -} - -.components-datetime__time-field-year-input { - width: 55px; -} - -.components-datetime__time-field-month-select { - max-width: 145px; -} - -.components-popover .components-datetime__date { - padding-left: 4px; -} - -.block-editor-dimension-control .components-base-control__field { - display: flex; - align-items: center; -} -.block-editor-dimension-control .components-base-control__label { - display: flex; - align-items: center; - margin-right: 1em; - margin-bottom: 0; -} -.block-editor-dimension-control .components-base-control__label .dashicon { - margin-right: 0.5em; -} -.block-editor-dimension-control.is-manual .components-base-control__label { - width: 10em; -} - -body.is-dragging-components-draggable { - cursor: move; - /* Fallback for IE/Edge < 14 */ - cursor: grabbing !important; -} - -.components-draggable__invisible-drag-image { - position: fixed; - left: -1000px; - height: 50px; - width: 50px; -} - -.components-draggable__clone { - position: fixed; - padding: 0; - background: transparent; - pointer-events: none; - z-index: 1000000000; -} - -.components-drop-zone { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 40; - visibility: hidden; - opacity: 0; - border-radius: 2px; -} -.components-drop-zone.is-active { - opacity: 1; - visibility: visible; -} - -.components-drop-zone__content { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - height: 100%; - width: 100%; - display: flex; - background-color: var(--wp-admin-theme-color); - align-items: center; - justify-content: center; - z-index: 50; - text-align: center; - color: #fff; -} - -.components-drop-zone__content-icon, -.components-drop-zone__content-text { - display: block; -} - -.components-drop-zone__content-icon { - margin: 0 auto; - line-height: 0; - fill: currentColor; - pointer-events: none; -} - -.components-drop-zone__content-text { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-dropdown { - display: inline-block; -} - -.components-dropdown__content .components-popover__content > div { - padding: 8px; -} -.components-dropdown__content [role=menuitem] { - white-space: nowrap; -} - -.components-dropdown-menu__menu { - width: 100%; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 1.4; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item, -.components-dropdown-menu__menu .components-menu-item { - width: 100%; - padding: 6px; - outline: none; - cursor: pointer; - white-space: nowrap; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator, -.components-dropdown-menu__menu .components-menu-item.has-separator { - margin-top: 6px; - position: relative; - overflow: visible; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.has-separator::before, -.components-dropdown-menu__menu .components-menu-item.has-separator::before { - display: block; - content: ""; - box-sizing: content-box; - background-color: #ddd; - position: absolute; - top: -3px; - left: 0; - right: 0; - height: 1px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg, -.components-dropdown-menu__menu .components-menu-item.is-active svg { - color: #fff; - background: #1e1e1e; - box-shadow: 0 0 0 1px #1e1e1e; - border-radius: 1px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item > svg, -.components-dropdown-menu__menu .components-menu-item > svg { - border-radius: 2px; - width: 24px; - height: 24px; -} -.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only, -.components-dropdown-menu__menu .components-menu-item.is-icon-only { - width: auto; -} -.components-dropdown-menu__menu .components-menu-item__button, -.components-dropdown-menu__menu .components-menu-item__button.components-button { - min-height: 36px; - height: auto; - text-align: left; - padding-left: 8px; - padding-right: 8px; -} -.components-dropdown-menu__menu .components-menu-group { - padding: 8px; - margin-top: 0; - margin-bottom: 0; - margin-left: -8px; - margin-right: -8px; -} -.components-dropdown-menu__menu .components-menu-group:first-child { - margin-top: -8px; -} -.components-dropdown-menu__menu .components-menu-group:last-child { - margin-bottom: -8px; -} -.components-dropdown-menu__menu .components-menu-group + .components-menu-group { - margin-top: 0; - border-top: 1px solid #ccc; - padding: 8px; -} -.is-alternate .components-dropdown-menu__menu .components-menu-group + .components-menu-group { - border-color: #1e1e1e; -} - -.components-font-size-picker__header__hint { - margin-left: 4px; - color: #757575; -} -.components-font-size-picker__header .components-button.is-small.has-icon:not(.has-text) { - min-width: 24px; - padding: 0; -} - -.components-font-size-picker__controls { - max-width: 248px; - align-items: center; - margin-top: 8px; - margin-bottom: 24px; -} -.components-font-size-picker__controls .components-unit-control-wrapper .components-input-control__label { - font-weight: 300; - padding-bottom: 0 !important; - margin-bottom: 8px !important; -} -.components-font-size-picker__controls .components-custom-select-control__button { - width: 100%; -} -.components-font-size-picker__controls .components-font-size-picker__number { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: inline-block; - font-weight: 500; - height: 30px; - margin-bottom: 0; - margin-left: 0; - margin-right: 8px; - margin-top: 8px; - width: 54px; -} -@media (prefers-reduced-motion: reduce) { - .components-font-size-picker__controls .components-font-size-picker__number { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-font-size-picker__controls .components-font-size-picker__number { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-font-size-picker__controls .components-font-size-picker__number:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-font-size-picker__controls .components-font-size-picker__number::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-font-size-picker__controls .components-font-size-picker__number[value=""] + .components-button { - cursor: default; - opacity: 0.3; - pointer-events: none; -} -.components-font-size-picker__controls .components-font-size-picker__number-container { - display: flex; - flex-direction: column; -} -.components-font-size-picker__controls .components-color-palette__clear { - height: 30px; -} - -.components-font-size-picker__custom-input .components-range-control__slider + .dashicon { - width: 30px; - height: 30px; -} - -.components-font-size-picker { - border: 0; - padding: 0; - margin: 0; -} - -.components-form-toggle { - position: relative; - display: inline-block; -} -.components-form-toggle .components-form-toggle__track { - content: ""; - display: inline-block; - box-sizing: border-box; - vertical-align: top; - background-color: #fff; - border: 1px solid #1e1e1e; - width: 36px; - height: 18px; - border-radius: 9px; - transition: 0.2s background ease; -} -@media (prefers-reduced-motion: reduce) { - .components-form-toggle .components-form-toggle__track { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-form-toggle .components-form-toggle__thumb { - display: block; - position: absolute; - box-sizing: border-box; - top: 3px; - left: 3px; - width: 12px; - height: 12px; - border-radius: 50%; - transition: 0.1s transform ease; - background-color: #1e1e1e; - border: 5px solid #1e1e1e; -} -@media (prefers-reduced-motion: reduce) { - .components-form-toggle .components-form-toggle__thumb { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-form-toggle.is-checked .components-form-toggle__track { - background-color: var(--wp-admin-theme-color); - border: 1px solid var(--wp-admin-theme-color); - border: 9px solid transparent; -} -.components-form-toggle .components-form-toggle__input:focus + .components-form-toggle__track { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; - outline-offset: 2px; -} -.components-form-toggle.is-checked .components-form-toggle__thumb { - background-color: #fff; - border-width: 0; - transform: translateX(18px); -} -.components-form-toggle.is-disabled, .components-disabled .components-form-toggle { - opacity: 0.3; -} - -.components-form-toggle input.components-form-toggle__input[type=checkbox] { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - opacity: 0; - margin: 0; - padding: 0; - z-index: 1; - border: none; -} -.components-form-toggle input.components-form-toggle__input[type=checkbox]:checked { - background: none; -} -.components-form-toggle input.components-form-toggle__input[type=checkbox]::before { - content: ""; -} - -.components-form-token-field__input-container { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: flex; - flex-wrap: wrap; - align-items: center; - width: 100%; - margin: 0 0 8px 0; - padding: 2px 4px; - cursor: text; -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__input-container { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-form-token-field__input-container { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-form-token-field__input-container:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-form-token-field__input-container::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-form-token-field__input-container.is-disabled { - background: #ddd; - border-color: #ddd; -} -.components-form-token-field__input-container.is-active { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-form-token-field__input-container input[type=text].components-form-token-field__input { - display: inline-block; - flex: 1; - font-family: inherit; - font-size: 16px; - width: 100%; - max-width: 100%; - margin-left: 4px; - padding: 0; - min-height: 24px; - min-width: 50px; - background: inherit; - border: 0; - color: #1e1e1e; - box-shadow: none; -} -@media (min-width: 600px) { - .components-form-token-field__input-container input[type=text].components-form-token-field__input { - font-size: 13px; - } -} -.components-form-token-field__input-container input[type=text].components-form-token-field__input:focus, .components-form-token-field.is-active .components-form-token-field__input-container input[type=text].components-form-token-field__input { - outline: none; - box-shadow: none; -} -.components-form-token-field__input-container .components-form-token-field__token + input[type=text].components-form-token-field__input { - width: auto; -} - -.components-form-token-field__label { - display: inline-block; - margin-bottom: 8px; -} - -.components-form-token-field__help { - font-size: 12px; - font-style: normal; - color: #757575; -} - -.components-form-token-field__token { - font-size: 13px; - display: flex; - margin: 2px 4px 2px 0; - color: #1e1e1e; - max-width: 100%; -} -.components-form-token-field__token.is-success .components-form-token-field__token-text, -.components-form-token-field__token.is-success .components-form-token-field__remove-token { - background: #4ab866; -} -.components-form-token-field__token.is-error .components-form-token-field__token-text, -.components-form-token-field__token.is-error .components-form-token-field__remove-token { - background: #cc1818; -} -.components-form-token-field__token.is-validating .components-form-token-field__token-text, -.components-form-token-field__token.is-validating .components-form-token-field__remove-token { - color: #757575; -} -.components-form-token-field__token.is-borderless { - position: relative; - padding: 0 16px 0 0; -} -.components-form-token-field__token.is-borderless .components-form-token-field__token-text { - background: transparent; - color: var(--wp-admin-theme-color); -} -.components-form-token-field__token.is-borderless .components-form-token-field__remove-token { - background: transparent; - color: #757575; - position: absolute; - top: 1px; - right: 0; -} -.components-form-token-field__token.is-borderless.is-success .components-form-token-field__token-text { - color: #4ab866; -} -.components-form-token-field__token.is-borderless.is-error .components-form-token-field__token-text { - color: #cc1818; - border-radius: 4px 0 0 4px; - padding: 0 4px 0 6px; -} -.components-form-token-field__token.is-borderless.is-validating .components-form-token-field__token-text { - color: #1e1e1e; -} -.components-form-token-field__token.is-disabled .components-form-token-field__remove-token { - cursor: default; -} - -.components-form-token-field__token-text, -.components-form-token-field__remove-token.components-button { - display: inline-block; - line-height: 24px; - height: auto; - background: #ddd; - min-width: unset; - transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1); -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__token-text, -.components-form-token-field__remove-token.components-button { - transition-duration: 0s; - transition-delay: 0s; - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-form-token-field__token-text { - border-radius: 2px 0 0 2px; - padding: 0 0 0 8px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.components-form-token-field__remove-token.components-button { - cursor: pointer; - border-radius: 0 2px 2px 0; - padding: 0 2px; - color: #1e1e1e; - line-height: 10px; - overflow: initial; -} -.components-form-token-field__remove-token.components-button:hover { - color: #1e1e1e; -} - -.components-form-token-field__suggestions-list { - flex: 1 0 100%; - min-width: 100%; - max-height: 9em; - overflow-y: auto; - transition: all 0.15s ease-in-out; - list-style: none; - border-top: 1px solid #757575; - margin: 4px -4px -4px; - padding: 0; -} -@media (prefers-reduced-motion: reduce) { - .components-form-token-field__suggestions-list { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-form-token-field__suggestion { - color: #757575; - display: block; - font-size: 13px; - padding: 4px 8px; - margin: 0; - cursor: pointer; -} -.components-form-token-field__suggestion.is-selected { - background: var(--wp-admin-theme-color); - color: #fff; -} - -.components-form-token-field__suggestion-match { - text-decoration: underline; -} - -@media (min-width: 600px) { - .components-guide { - width: 600px; - } -} -.components-guide .components-modal__content { - padding: 0; - margin-top: 0; - border-radius: 2px; -} -.components-guide .components-modal__content::before { - content: none; -} -.components-guide .components-modal__header { - border-bottom: none; - padding: 0; - position: sticky; -} -.components-guide .components-modal__header .components-button { - align-self: flex-start; - margin: 8px 8px 0 0; - position: static; -} -.components-guide .components-modal__header .components-button:hover svg { - fill: #fff; -} -.components-guide__container { - display: flex; - flex-direction: column; - justify-content: space-between; - margin-top: -60px; - min-height: 100%; -} -.components-guide__page { - display: flex; - flex-direction: column; - justify-content: center; - position: relative; -} -@media (min-width: 600px) { - .components-guide__page { - min-height: 300px; - } -} -.components-guide__footer { - align-content: center; - display: flex; - height: 30px; - justify-content: center; - margin: 0 0 24px 0; - padding: 0 32px; - position: relative; - width: 100%; -} -.components-guide__page-control { - margin: 0; - text-align: center; -} -.components-guide__page-control li { - display: inline-block; - margin: 0; -} -.components-guide__page-control .components-button { - height: 30px; - min-width: 20px; - margin: -6px 0; -} - -.components-modal__frame.components-guide { - border: none; - min-width: 312px; - height: 80vh; - max-height: 575px; -} -@media (max-width: 600px) { - .components-modal__frame.components-guide { - margin: auto; - max-width: calc(100vw - 16px * 2); - } -} - -.components-button.components-guide__back-button, .components-button.components-guide__forward-button, .components-button.components-guide__finish-button { - height: 30px; - position: absolute; -} -.components-button.components-guide__back-button, .components-button.components-guide__forward-button { - font-size: 13px; - padding: 4px 2px; -} -.components-button.components-guide__back-button.has-text svg, .components-button.components-guide__forward-button.has-text svg { - margin: 0; -} -.components-button.components-guide__back-button:hover, .components-button.components-guide__forward-button:hover { - text-decoration: underline; -} -.components-button.components-guide__back-button { - left: 32px; -} -.components-button.components-guide__forward-button { - right: 32px; - color: #1386bf; - font-weight: bold; -} -.components-button.components-guide__finish-button { - right: 32px; -} - -[role=region] { - position: relative; -} - -.is-focusing-regions [role=region]:focus::after { - content: ""; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - pointer-events: none; - outline: 4px solid transparent; - box-shadow: inset 0 0 0 4px var(--wp-admin-theme-color); -} -@supports (outline-offset: 1px) { - .is-focusing-regions [role=region]:focus::after { - content: none; - } - .is-focusing-regions [role=region]:focus { - outline-style: solid; - outline-color: var(--wp-admin-theme-color); - outline-width: 4px; - outline-offset: -4px; - } -} - -.components-menu-group + .components-menu-group { - margin-top: 8px; - padding-top: 8px; - border-top: 1px solid #1e1e1e; -} -.components-menu-group + .components-menu-group.has-hidden-separator { - border-top: none; - margin-top: 0; - padding-top: 0; -} - -.components-menu-group__label { - padding: 0 8px; - margin-top: 4px; - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; - white-space: nowrap; -} - -.components-menu-item__button, -.components-menu-item__button.components-button { - width: 100%; -} -.components-menu-item__button[role=menuitemradio] .components-menu-item__item:only-child, .components-menu-item__button[role=menuitemcheckbox] .components-menu-item__item:only-child, -.components-menu-item__button.components-button[role=menuitemradio] .components-menu-item__item:only-child, -.components-menu-item__button.components-button[role=menuitemcheckbox] .components-menu-item__item:only-child { - padding-right: 48px; -} -.components-menu-item__button .components-menu-items__item-icon, -.components-menu-item__button.components-button .components-menu-items__item-icon { - display: inline-block; - flex: 0 0 auto; -} -.components-menu-item__button .components-menu-items__item-icon.has-icon-right, -.components-menu-item__button.components-button .components-menu-items__item-icon.has-icon-right { - margin-right: -2px; - margin-left: 24px; -} -.components-menu-item__button .components-menu-item__shortcut + .components-menu-items__item-icon.has-icon-right, -.components-menu-item__button.components-button .components-menu-item__shortcut + .components-menu-items__item-icon.has-icon-right { - margin-left: 8px; -} -.components-menu-item__button .block-editor-block-icon, -.components-menu-item__button.components-button .block-editor-block-icon { - margin-left: -2px; - margin-right: 8px; -} -.components-menu-item__button.is-primary, -.components-menu-item__button.components-button.is-primary { - justify-content: center; -} -.components-menu-item__button.is-primary .components-menu-item__item, -.components-menu-item__button.components-button.is-primary .components-menu-item__item { - margin-right: 0; -} - -.components-menu-item__info-wrapper { - display: flex; - flex-direction: column; - margin-right: auto; -} - -.components-menu-item__info { - margin-top: 4px; - font-size: 12px; - color: #757575; - white-space: normal; -} - -.components-menu-item__item { - white-space: nowrap; - min-width: 160px; - margin-right: auto; - display: inline-flex; - align-items: center; -} - -.components-menu-item__shortcut { - align-self: center; - margin-right: 0; - margin-left: auto; - padding-left: 24px; - color: currentColor; - display: none; -} -@media (min-width: 480px) { - .components-menu-item__shortcut { - display: inline; - } -} - -.components-menu-items-choice svg, -.components-menu-items-choice.components-button svg { - margin-right: 12px; -} -.components-menu-items-choice.has-icon, -.components-menu-items-choice.components-button.has-icon { - padding-left: 12px; -} - -.components-modal__screen-overlay { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: rgba(0, 0, 0, 0.35); - z-index: 100000; - display: flex; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-modal__screen-overlay { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-modal__frame { - margin: 0; - width: 100%; - background: #fff; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); - border-radius: 2px; - overflow: hidden; - display: flex; -} -@media (min-width: 600px) { - .components-modal__frame { - margin: auto; - width: auto; - min-width: 360px; - max-width: calc(100% - 32px); - max-height: calc(100% - 120px); - animation: components-modal__appear-animation 0.1s ease-out; - animation-fill-mode: forwards; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .components-modal__frame { - animation-duration: 1ms; - animation-delay: 0s; - } -} -@media (min-width: 600px) { - .components-modal__frame.is-full-screen { - width: 90vw; - min-height: 90vh; - } -} -@media (min-width: 960px) { - .components-modal__frame { - max-height: 70%; - } -} - -@keyframes components-modal__appear-animation { - from { - transform: translateY(32px); - } - to { - transform: translateY(0); - } -} -.components-modal__header { - box-sizing: border-box; - border-bottom: 1px solid #ddd; - padding: 0 32px; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - height: 60px; - width: 100%; - z-index: 10; - position: absolute; - top: 0; - left: 0; -} -.components-modal__header .components-modal__header-heading { - font-size: 1rem; - font-weight: 600; -} -.components-modal__header h1 { - line-height: 1; - margin: 0; -} -.components-modal__header .components-button { - position: relative; - left: 8px; -} - -.components-modal__header-heading-container { - align-items: center; - flex-grow: 1; - display: flex; - flex-direction: row; - justify-content: left; -} - -.components-modal__header-icon-container { - display: inline-block; -} -.components-modal__header-icon-container svg { - max-width: 36px; - max-height: 36px; - padding: 8px; -} - -.components-modal__content { - flex: 1; - margin-top: 60px; - padding: 0 32px 24px; - overflow: auto; -} -.components-modal__content::before { - content: ""; - display: block; - margin-bottom: 24px; -} -.components-modal__content.hide-header { - margin-top: 0; - padding-top: 24px; -} -.components-modal__content.hide-header::before { - content: none; -} - -.components-notice { - display: flex; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - background-color: #fff; - border-left: 4px solid var(--wp-admin-theme-color); - margin: 5px 15px 2px; - padding: 8px 12px; - align-items: center; -} -.components-notice.is-dismissible { - padding-right: 36px; - position: relative; -} -.components-notice.is-success { - border-left-color: #4ab866; - background-color: #eff9f1; -} -.components-notice.is-warning { - border-left-color: #f0b849; - background-color: #fef8ee; -} -.components-notice.is-error { - border-left-color: #cc1818; - background-color: #f4a2a2; -} - -.components-notice__content { - flex-grow: 1; - margin: 4px 25px 4px 0; -} - -.components-notice__actions { - display: flex; - flex-wrap: wrap; -} - -.components-notice__action.components-button { - margin-right: 8px; -} -.components-notice__action.components-button, .components-notice__action.components-button.is-link { - margin-left: 12px; -} -.components-notice__action.components-button.is-secondary { - vertical-align: initial; -} - -.components-notice__dismiss { - color: #757575; - align-self: flex-start; - flex-shrink: 0; -} -.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover, .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):active, .components-notice__dismiss:not(:disabled):not([aria-disabled=true]):focus { - color: #1e1e1e; - background-color: transparent; -} -.components-notice__dismiss:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover { - box-shadow: none; -} - -.components-notice-list { - max-width: 100vw; - box-sizing: border-box; -} -.components-notice-list .components-notice__content { - margin-top: 12px; - margin-bottom: 12px; - line-height: 2; -} -.components-notice-list .components-notice__action.components-button { - display: block; - margin-left: 0; - margin-top: 8px; -} - -.components-panel { - background: #fff; - border: 1px solid #e0e0e0; -} -.components-panel > .components-panel__header:first-child, -.components-panel > .components-panel__body:first-child { - margin-top: -1px; -} -.components-panel > .components-panel__header:last-child, -.components-panel > .components-panel__body:last-child { - border-bottom-width: 0; -} - -.components-panel + .components-panel { - margin-top: -1px; -} - -.components-panel__body { - border-top: 1px solid #e0e0e0; - border-bottom: 1px solid #e0e0e0; -} -.components-panel__body h3 { - margin: 0 0 0.5em; -} -.components-panel__body.is-opened { - padding: 16px; -} - -.components-panel__header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 16px; - height: 48px; - border-bottom: 1px solid #ddd; -} -.components-panel__header h2 { - margin: 0; - font-size: inherit; - color: inherit; -} - -.components-panel__body + .components-panel__body, -.components-panel__body + .components-panel__header, -.components-panel__header + .components-panel__body, -.components-panel__header + .components-panel__header { - margin-top: -1px; -} - -.components-panel__body > .components-panel__body-title { - display: block; - padding: 0; - font-size: inherit; - margin-top: 0; - margin-bottom: 0; - transition: 0.1s background ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body > .components-panel__body-title { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-panel__body.is-opened > .components-panel__body-title { - margin: -16px; - margin-bottom: 5px; -} - -.components-panel__body > .components-panel__body-title:hover { - background: #f0f0f0; - border: none; -} - -.components-panel__body-toggle.components-button { - position: relative; - padding: 16px 48px 16px 16px; - outline: none; - width: 100%; - font-weight: 500; - text-align: left; - color: #1e1e1e; - border: none; - box-shadow: none; - transition: 0.1s background ease-in-out; - height: auto; - /* rtl:begin:ignore */ - /* rtl:end:ignore */ -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body-toggle.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-panel__body-toggle.components-button:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 0; -} -.components-panel__body-toggle.components-button .components-panel__arrow { - position: absolute; - right: 16px; - top: 50%; - transform: translateY(-50%); - color: #1e1e1e; - fill: currentColor; - transition: 0.1s color ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .components-panel__body-toggle.components-button .components-panel__arrow { - transition-duration: 0s; - transition-delay: 0s; - } -} -body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right { - transform: scaleX(-1); - -ms-filter: fliph; - filter: FlipH; - margin-top: -10px; -} - -.components-panel__icon { - color: #757575; - margin: -2px 0 -2px 6px; -} - -.components-panel__body-toggle-icon { - margin-right: -5px; -} - -.components-panel__color-title { - float: left; - height: 19px; -} - -.components-panel__row { - display: flex; - justify-content: space-between; - align-items: center; - margin-top: 8px; - min-height: 36px; -} -.components-panel__row select { - min-width: 0; -} -.components-panel__row label { - margin-right: 12px; - flex-shrink: 0; - max-width: 75%; -} -.components-panel__row:empty, .components-panel__row:first-of-type { - margin-top: 0; -} - -.components-panel .circle-picker { - padding-bottom: 20px; -} - -.components-placeholder.components-placeholder { - box-sizing: border-box; - position: relative; - padding: 1em; - min-height: 200px; - width: 100%; - text-align: left; - margin: 0; - color: #1e1e1e; - -moz-font-smoothing: subpixel-antialiased; - -webkit-font-smoothing: subpixel-antialiased; - border-radius: 2px; - background-color: #fff; - box-shadow: inset 0 0 0 1px #1e1e1e; - outline: 1px solid transparent; -} -@supports (position: sticky) { - .components-placeholder.components-placeholder { - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-start; - } -} -.components-placeholder.components-placeholder .components-base-control__label { - font-size: 13px; -} - -.components-placeholder__error, -.components-placeholder__instructions, -.components-placeholder__label, -.components-placeholder__fieldset { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-placeholder__label { - display: flex; - font-weight: 600; - margin-bottom: 16px; - align-items: center; -} -.components-placeholder__label > svg, -.components-placeholder__label .dashicon, -.components-placeholder__label .block-editor-block-icon { - margin-right: 1ch; - fill: currentColor; -} -@media (forced-colors: active) { - .components-placeholder__label > svg, -.components-placeholder__label .dashicon, -.components-placeholder__label .block-editor-block-icon { - fill: CanvasText; - } -} -.components-placeholder__label:empty { - display: none; -} - -.components-placeholder__fieldset, -.components-placeholder__fieldset form { - display: flex; - flex-direction: row; - width: 100%; - flex-wrap: wrap; -} -.components-placeholder__fieldset p, -.components-placeholder__fieldset form p { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.components-placeholder__fieldset.components-placeholder__fieldset { - border: none; - padding: 0; -} -.components-placeholder__fieldset.components-placeholder__fieldset .components-placeholder__instructions { - padding: 0; - font-weight: normal; - font-size: 1em; -} - -.components-placeholder__fieldset.is-column-layout, -.components-placeholder__fieldset.is-column-layout form { - flex-direction: column; -} - -.components-placeholder__input[type=url] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - margin: 0 8px 0 0; - flex: 1 1 auto; -} -@media (prefers-reduced-motion: reduce) { - .components-placeholder__input[type=url] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-placeholder__input[type=url] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-placeholder__input[type=url]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-placeholder__input[type=url]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-placeholder__input[type=url]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-placeholder__input[type=url]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.components-placeholder__instructions { - margin-bottom: 1em; -} - -.components-placeholder__error { - margin-top: 1em; - width: 100%; -} - -.components-placeholder__preview img { - margin: 3%; - width: 50%; -} - -.components-placeholder__fieldset .components-button { - margin-right: 12px; - margin-bottom: 12px; -} -.components-placeholder__fieldset .components-button:last-child { - margin-bottom: 0; - margin-right: 0; -} - -.components-placeholder__fieldset .components-button:not(.is-link) ~ .components-button.is-link { - margin-left: 10px; - margin-right: 10px; -} -.components-placeholder__fieldset .components-button:not(.is-link) ~ .components-button.is-link:last-child { - margin-right: 0; -} - -.components-placeholder.is-large .components-placeholder__label { - font-size: 18pt; - font-weight: normal; -} -.components-placeholder.is-medium .components-placeholder__instructions, .components-placeholder.is-small .components-placeholder__instructions { - display: none; -} -.components-placeholder.is-medium .components-placeholder__fieldset, -.components-placeholder.is-medium .components-placeholder__fieldset form, .components-placeholder.is-small .components-placeholder__fieldset, -.components-placeholder.is-small .components-placeholder__fieldset form { - flex-direction: column; -} -.components-placeholder.is-medium .components-placeholder__fieldset .components-button, .components-placeholder.is-small .components-placeholder__fieldset .components-button { - margin-right: auto; -} -.components-placeholder.is-small .components-button { - padding: 0 8px 2px; -} - -/*!rtl:begin:ignore*/ -.components-popover { - position: fixed; - z-index: 1000000; - top: 0; - left: 0; - opacity: 0; -} -.components-popover.is-expanded, .components-popover[data-x-axis][data-y-axis] { - opacity: 1; -} -.components-popover.is-expanded { - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 1000000 !important; -} -.components-popover:not(.is-without-arrow) { - margin-left: 2px; -} -.components-popover:not(.is-without-arrow)::before { - border: 8px solid #ccc; -} -.components-popover:not(.is-without-arrow).is-alternate::before { - border-color: #1e1e1e; -} -.components-popover:not(.is-without-arrow)::after { - border: 8px solid #fff; -} -.components-popover:not(.is-without-arrow)::before, .components-popover:not(.is-without-arrow)::after { - content: ""; - position: absolute; - height: 0; - width: 0; - line-height: 0; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top] { - margin-top: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::before { - bottom: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::after { - bottom: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=top]::before, .components-popover:not(.is-without-arrow)[data-y-axis=top]::after { - border-bottom: none; - border-left-color: transparent; - border-right-color: transparent; - border-top-style: solid; - margin-left: -10px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom] { - margin-top: 8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::before { - top: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::after { - top: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=bottom]::before, .components-popover:not(.is-without-arrow)[data-y-axis=bottom]::after { - border-bottom-style: solid; - border-left-color: transparent; - border-right-color: transparent; - border-top: none; - margin-left: -10px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left] { - margin-left: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::before { - right: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::after { - right: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::before, .components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=left]::after { - border-bottom-color: transparent; - border-left-style: solid; - border-right: none; - border-top-color: transparent; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right] { - margin-left: 8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::before { - left: -8px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::after { - left: -6px; -} -.components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::before, .components-popover:not(.is-without-arrow)[data-y-axis=middle][data-x-axis=right]::after { - border-bottom-color: transparent; - border-left: none; - border-right-style: solid; - border-top-color: transparent; -} -.components-popover[data-y-axis=top] { - bottom: 100%; -} -.components-popover[data-y-axis=bottom] { - top: 100%; -} -.components-popover[data-y-axis=middle] { - align-items: center; - display: flex; -} -.components-popover.is-from-top { - margin-top: 12px; -} -.components-popover.is-from-bottom { - margin-top: -12px; -} -.components-popover.is-from-left:not(.is-from-top):not(.is-from-bottom) { - margin-left: 12px; -} -.components-popover.is-from-right:not(.is-from-top):not(.is-from-bottom) { - margin-right: 12px; -} - -.components-popover__content { - height: 100%; - background: #fff; - border: 1px solid #ccc; - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border-radius: 2px; -} -.is-alternate .components-popover__content { - border: 1px solid #1e1e1e; - box-shadow: none; -} -.components-popover .components-popover__content { - position: absolute; - height: auto; - overflow-y: auto; -} -.components-popover.is-expanded .components-popover__content { - position: static; - height: calc(100% - 48px); - overflow-y: visible; - min-width: auto; - border: none; - border-top: 1px solid #1e1e1e; -} -.components-popover[data-y-axis=top] .components-popover__content { - bottom: 100%; -} -.components-popover[data-x-axis=center] .components-popover__content { - left: 50%; - transform: translateX(-50%); -} -.components-popover[data-x-axis=right] .components-popover__content { - position: absolute; - left: 100%; -} -.components-popover:not([data-y-axis=middle])[data-x-axis=right] .components-popover__content { - margin-left: -25px; -} -.components-popover[data-x-axis=left] .components-popover__content { - position: absolute; - right: 100%; -} -.components-popover:not([data-y-axis=middle])[data-x-axis=left] .components-popover__content { - margin-right: -25px; -} - -.components-popover__header { - align-items: center; - background: #fff; - display: flex; - height: 48px; - justify-content: space-between; - padding: 0 8px 0 16px; -} - -.components-popover__header-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} - -.components-popover__close.components-button { - z-index: 5; -} - -/*!rtl:end:ignore*/ -.components-radio-control { - display: flex; - flex-direction: column; -} -.components-radio-control .components-base-control__help { - margin-top: 0; -} -.components-radio-control .components-base-control__field { - margin-bottom: 0; -} - -.components-radio-control__option:not(:last-child) { - margin-bottom: 4px; -} - -.components-radio-control__input[type=radio] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-right: 12px; - transition: none; - border-radius: 50%; - width: 24px; - height: 24px; - margin-top: 0; - margin-right: 6px; -} -@media (prefers-reduced-motion: reduce) { - .components-radio-control__input[type=radio] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-radio-control__input[type=radio]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-radio-control__input[type=radio]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-radio-control__input[type=radio]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-radio-control__input[type=radio]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio] { - height: 20px; - width: 20px; - } -} -.components-radio-control__input[type=radio]:checked::before { - box-sizing: inherit; - width: 8px; - height: 8px; - transform: translate(7px, 7px); - margin: 0; - background-color: #fff; - border: 4px solid #fff; -} -@media (min-width: 600px) { - .components-radio-control__input[type=radio]:checked::before { - transform: translate(5px, 5px); - } -} -.components-radio-control__input[type=radio]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-radio-control__input[type=radio]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} - -.components-resizable-box__handle { - display: none; - width: 23px; - height: 23px; - z-index: 2; -} -.components-resizable-box__container.has-show-handle .components-resizable-box__handle { - display: block; -} - -.components-resizable-box__container > img { - width: inherit; -} - -.components-resizable-box__handle::after { - display: block; - content: ""; - width: 15px; - height: 15px; - border-radius: 50%; - background: #fff; - cursor: inherit; - position: absolute; - top: calc(50% - 8px); - right: calc(50% - 8px); - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.components-resizable-box__side-handle::before { - display: block; - border-radius: 2px; - content: ""; - width: 3px; - height: 3px; - background: var(--wp-admin-theme-color); - cursor: inherit; - position: absolute; - top: calc(50% - 1px); - right: calc(50% - 1px); - transition: transform 0.1s ease-in; - opacity: 0; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle::before { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.components-resizable-box__side-handle { - z-index: 2; -} - -.components-resizable-box__corner-handle { - z-index: 2; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-top, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom, -.components-resizable-box__side-handle.components-resizable-box__handle-top::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom::before { - width: 100%; - left: 0; - border-left: 0; - border-right: 0; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-left, -.components-resizable-box__side-handle.components-resizable-box__handle-right, -.components-resizable-box__side-handle.components-resizable-box__handle-left::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right::before { - height: 100%; - top: 0; - border-top: 0; - border-bottom: 0; -} - -.components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation: components-resizable-box__top-bottom-animation 0.1s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation: components-resizable-box__left-right-animation 0.1s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -/* This CSS is shown only to Safari, which has a bug with table-caption making it jumpy. -See https://bugs.webkit.org/show_bug.cgi?id=187903. */ -@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) { - @supports (-webkit-appearance: none) { - .components-resizable-box__side-handle.components-resizable-box__handle-top:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-top:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before { - animation: none; - } - - .components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before, -.components-resizable-box__side-handle.components-resizable-box__handle-left:active::before, -.components-resizable-box__side-handle.components-resizable-box__handle-right:active::before { - animation: none; - } - } -} -@keyframes components-resizable-box__top-bottom-animation { - from { - transform: scaleX(0); - opacity: 0; - } - to { - transform: scaleX(1); - opacity: 1; - } -} -@keyframes components-resizable-box__left-right-animation { - from { - transform: scaleY(0); - opacity: 0; - } - to { - transform: scaleY(1); - opacity: 1; - } -} -/*!rtl:begin:ignore*/ -.components-resizable-box__handle-right { - right: calc(11.5px * -1); -} - -.components-resizable-box__handle-left { - left: calc(11.5px * -1); -} - -.components-resizable-box__handle-top { - top: calc(11.5px * -1); -} - -.components-resizable-box__handle-bottom { - bottom: calc(11.5px * -1); -} - -/*!rtl:end:ignore*/ -.components-responsive-wrapper { - position: relative; - max-width: 100%; -} -.components-responsive-wrapper, .components-responsive-wrapper > span { - display: block; -} - -.components-responsive-wrapper__content { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - margin: auto; -} - -.components-sandbox { - overflow: hidden; -} - -iframe.components-sandbox { - width: 100%; -} - -html.lockscroll, -body.lockscroll { - overflow: hidden; -} - -.components-search-control { - position: relative; -} -.components-search-control input[type=search].components-search-control__input { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - display: block; - padding: 16px 48px 16px 16px; - background: #f0f0f0; - border: none; - width: 100%; - height: 48px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; -} -@media (prefers-reduced-motion: reduce) { - .components-search-control input[type=search].components-search-control__input { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-search-control input[type=search].components-search-control__input { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-search-control input[type=search].components-search-control__input:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-search-control input[type=search].components-search-control__input::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-search-control input[type=search].components-search-control__input::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-search-control input[type=search].components-search-control__input:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .components-search-control input[type=search].components-search-control__input { - font-size: 13px; - } -} -.components-search-control input[type=search].components-search-control__input:focus { - background: #fff; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-search-control input[type=search].components-search-control__input::placeholder { - color: #757575; -} -.components-search-control input[type=search].components-search-control__input::-webkit-search-decoration, .components-search-control input[type=search].components-search-control__input::-webkit-search-cancel-button, .components-search-control input[type=search].components-search-control__input::-webkit-search-results-button, .components-search-control input[type=search].components-search-control__input::-webkit-search-results-decoration { - -webkit-appearance: none; -} - -.components-search-control__icon { - position: absolute; - top: 0; - right: 12px; - bottom: 0; - display: flex; - align-items: center; -} -.components-search-control__icon > svg { - margin: 8px 0; -} - -.components-search-control__input-wrapper { - position: relative; -} - -.components-select-control__input { - background: #fff; - height: 36px; - line-height: 36px; - margin: 1px; - outline: 0; - width: 100%; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important; -} -@media (min-width: 782px) { - .components-select-control__input { - height: 28px; - line-height: 28px; - } -} - -@media (max-width: 782px) { - .components-base-control .components-base-control__field .components-select-control__input { - font-size: 16px; - } -} -.components-snackbar { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - background-color: #1e1e1e; - border-radius: 2px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); - color: #fff; - padding: 16px 24px; - width: 100%; - max-width: 600px; - box-sizing: border-box; - cursor: pointer; - pointer-events: auto; -} -@media (min-width: 600px) { - .components-snackbar { - width: -moz-fit-content; - width: fit-content; - } -} -.components-snackbar:focus { - box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--wp-admin-theme-color); -} -.components-snackbar.components-snackbar-explicit-dismiss { - cursor: default; -} -.components-snackbar .components-snackbar__content-with-icon { - margin-left: 24px; -} -.components-snackbar .components-snackbar__icon { - position: absolute; - top: 24px; - left: 28px; -} -.components-snackbar .components-snackbar__dismiss-button { - margin-left: 32px; - cursor: pointer; -} - -.components-snackbar__action.components-button { - margin-left: 32px; - color: #fff; - height: auto; - flex-shrink: 0; - line-height: 1.4; - padding: 0; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) { - text-decoration: underline; - background-color: transparent; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):focus { - color: #fff; - box-shadow: none; - outline: 1px dotted #fff; -} -.components-snackbar__action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary):hover { - color: var(--wp-admin-theme-color); -} - -.components-snackbar__content { - display: flex; - align-items: baseline; - justify-content: space-between; - line-height: 1.4; -} - -.components-snackbar-list { - position: absolute; - z-index: 100000; - width: 100%; - box-sizing: border-box; - pointer-events: none; -} - -.components-snackbar-list__notice-container { - position: relative; - padding-top: 8px; -} - -.components-swatch { - width: 18px; - height: 18px; - border-radius: 50%; - color: transparent; - background: transparent; -} -.components-swatch::after { - content: ""; - display: block; - width: 100%; - height: 100%; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 50%; -} - -.components-button.has-icon.has-text .components-swatch { - margin-right: 8px; -} - -.components-tab-panel__tabs { - display: flex; - align-items: stretch; - flex-direction: row; -} -.components-tab-panel__tabs[aria-orientation=vertical] { - flex-direction: column; -} - -.components-tab-panel__tabs-item { - background: transparent; - border: none; - box-shadow: none; - border-radius: 0; - cursor: pointer; - height: 48px; - padding: 3px 16px; - margin-left: 0; - font-weight: 500; - transition: box-shadow 0.1s linear; - box-sizing: border-box; -} -.components-tab-panel__tabs-item::after { - content: attr(data-label); - display: block; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-tab-panel__tabs-item.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; -} -.components-tab-panel__tabs-item.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - right: 0; - left: 0; - border-bottom: 4px solid transparent; -} -.components-tab-panel__tabs-item:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-tab-panel__tabs-item.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -.components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - width: 100%; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .components-text-control__input, -.components-text-control__input[type=text], -.components-text-control__input[type=tel], -.components-text-control__input[type=time], -.components-text-control__input[type=url], -.components-text-control__input[type=week], -.components-text-control__input[type=password], -.components-text-control__input[type=color], -.components-text-control__input[type=date], -.components-text-control__input[type=datetime], -.components-text-control__input[type=datetime-local], -.components-text-control__input[type=email], -.components-text-control__input[type=month], -.components-text-control__input[type=number] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.components-text-control__input:focus, -.components-text-control__input[type=text]:focus, -.components-text-control__input[type=tel]:focus, -.components-text-control__input[type=time]:focus, -.components-text-control__input[type=url]:focus, -.components-text-control__input[type=week]:focus, -.components-text-control__input[type=password]:focus, -.components-text-control__input[type=color]:focus, -.components-text-control__input[type=date]:focus, -.components-text-control__input[type=datetime]:focus, -.components-text-control__input[type=datetime-local]:focus, -.components-text-control__input[type=email]:focus, -.components-text-control__input[type=month]:focus, -.components-text-control__input[type=number]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.components-text-control__input::-webkit-input-placeholder, -.components-text-control__input[type=text]::-webkit-input-placeholder, -.components-text-control__input[type=tel]::-webkit-input-placeholder, -.components-text-control__input[type=time]::-webkit-input-placeholder, -.components-text-control__input[type=url]::-webkit-input-placeholder, -.components-text-control__input[type=week]::-webkit-input-placeholder, -.components-text-control__input[type=password]::-webkit-input-placeholder, -.components-text-control__input[type=color]::-webkit-input-placeholder, -.components-text-control__input[type=date]::-webkit-input-placeholder, -.components-text-control__input[type=datetime]::-webkit-input-placeholder, -.components-text-control__input[type=datetime-local]::-webkit-input-placeholder, -.components-text-control__input[type=email]::-webkit-input-placeholder, -.components-text-control__input[type=month]::-webkit-input-placeholder, -.components-text-control__input[type=number]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.components-text-control__input::-moz-placeholder, -.components-text-control__input[type=text]::-moz-placeholder, -.components-text-control__input[type=tel]::-moz-placeholder, -.components-text-control__input[type=time]::-moz-placeholder, -.components-text-control__input[type=url]::-moz-placeholder, -.components-text-control__input[type=week]::-moz-placeholder, -.components-text-control__input[type=password]::-moz-placeholder, -.components-text-control__input[type=color]::-moz-placeholder, -.components-text-control__input[type=date]::-moz-placeholder, -.components-text-control__input[type=datetime]::-moz-placeholder, -.components-text-control__input[type=datetime-local]::-moz-placeholder, -.components-text-control__input[type=email]::-moz-placeholder, -.components-text-control__input[type=month]::-moz-placeholder, -.components-text-control__input[type=number]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.components-text-control__input:-ms-input-placeholder, -.components-text-control__input[type=text]:-ms-input-placeholder, -.components-text-control__input[type=tel]:-ms-input-placeholder, -.components-text-control__input[type=time]:-ms-input-placeholder, -.components-text-control__input[type=url]:-ms-input-placeholder, -.components-text-control__input[type=week]:-ms-input-placeholder, -.components-text-control__input[type=password]:-ms-input-placeholder, -.components-text-control__input[type=color]:-ms-input-placeholder, -.components-text-control__input[type=date]:-ms-input-placeholder, -.components-text-control__input[type=datetime]:-ms-input-placeholder, -.components-text-control__input[type=datetime-local]:-ms-input-placeholder, -.components-text-control__input[type=email]:-ms-input-placeholder, -.components-text-control__input[type=month]:-ms-input-placeholder, -.components-text-control__input[type=number]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.components-tip { - display: flex; - color: #757575; -} -.components-tip svg { - align-self: center; - fill: #f0b849; - flex-shrink: 0; - margin-right: 16px; -} -.components-tip p { - margin: 0; -} - -.components-toggle-control .components-base-control__field { - display: flex; - margin-bottom: 12px; - line-height: initial; - align-items: center; -} -.components-toggle-control .components-base-control__field .components-form-toggle { - margin-right: 12px; -} -.components-toggle-control .components-base-control__field .components-toggle-control__label { - display: block; -} - -.components-accessible-toolbar { - display: inline-flex; - border: 1px solid #1e1e1e; - border-radius: 2px; - flex-shrink: 0; -} -.components-accessible-toolbar > .components-toolbar-group:last-child { - border-right: none; -} - -.components-accessible-toolbar .components-button, -.components-toolbar .components-button { - position: relative; - height: 48px; - z-index: 1; - padding-left: 16px; - padding-right: 16px; -} -.components-accessible-toolbar .components-button:focus:enabled, -.components-toolbar .components-button:focus:enabled { - box-shadow: none; - outline: none; -} -.components-accessible-toolbar .components-button::before, -.components-toolbar .components-button::before { - content: ""; - position: absolute; - display: block; - border-radius: 2px; - height: 32px; - left: 8px; - right: 8px; - z-index: -1; - animation: components-button__appear-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .components-accessible-toolbar .components-button::before, -.components-toolbar .components-button::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.components-accessible-toolbar .components-button svg, -.components-toolbar .components-button svg { - position: relative; - margin-left: auto; - margin-right: auto; -} -.components-accessible-toolbar .components-button.is-pressed, -.components-toolbar .components-button.is-pressed { - background: transparent; -} -.components-accessible-toolbar .components-button.is-pressed:hover, -.components-toolbar .components-button.is-pressed:hover { - background: transparent; -} -.components-accessible-toolbar .components-button.is-pressed::before, -.components-toolbar .components-button.is-pressed::before { - background: #1e1e1e; -} -.components-accessible-toolbar .components-button:focus::before, -.components-toolbar .components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} -.components-accessible-toolbar .components-button.has-icon.has-icon, -.components-toolbar .components-button.has-icon.has-icon { - padding-left: 12px; - padding-right: 12px; - min-width: 48px; -} -.components-accessible-toolbar .components-button.components-tab-button, -.components-toolbar .components-button.components-tab-button { - font-weight: 500; -} -.components-accessible-toolbar .components-button.components-tab-button span, -.components-toolbar .components-button.components-tab-button span { - display: inline-block; - padding-left: 0; - padding-right: 0; - position: relative; -} - -@keyframes components-button__appear-animation { - from { - transform: scaleY(0); - } - to { - transform: scaleY(1); - } -} -.components-toolbar__control.components-button { - position: relative; -} -.components-toolbar__control.components-button[data-subscript] svg { - padding: 5px 10px 5px 0; -} -.components-toolbar__control.components-button[data-subscript]::after { - content: attr(data-subscript); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - font-weight: 600; - line-height: 12px; - position: absolute; - right: 8px; - bottom: 10px; -} -.components-toolbar__control.components-button:active::before { - display: none; -} -.components-toolbar__control.components-button:not(:disabled).is-pressed[data-subscript]::after { - color: #fff; -} - -.components-toolbar-group { - min-height: 48px; - border-right: 1px solid #1e1e1e; - background-color: #fff; - display: inline-flex; - flex-shrink: 0; - flex-wrap: wrap; - line-height: 0; -} -.components-toolbar-group .components-toolbar-group.components-toolbar-group { - border-width: 0; - margin: 0; -} - -.components-toolbar { - min-height: 48px; - margin: 0; - border: 1px solid #1e1e1e; - background-color: #fff; - display: inline-flex; - flex-shrink: 0; - flex-wrap: wrap; -} -.components-toolbar .components-toolbar.components-toolbar { - border-width: 0; - margin: 0; -} - -div.components-toolbar > div { - display: block; - margin: 0; -} -@supports (position: sticky) { - div.components-toolbar > div { - display: flex; - } -} -div.components-toolbar > div + div.has-left-divider { - margin-left: 6px; - position: relative; - overflow: visible; -} -div.components-toolbar > div + div.has-left-divider::before { - display: inline-block; - content: ""; - box-sizing: content-box; - background-color: #ddd; - position: absolute; - top: 8px; - left: -3px; - width: 1px; - height: 20px; -} - -.components-tooltip.components-popover { - z-index: 1000002; -} -.components-tooltip.components-popover .components-popover__content { - min-width: 0; -} - -.components-tooltip .components-popover__content { - background: #1e1e1e; - border-radius: 2px; - border-width: 0; - color: #fff; - white-space: nowrap; - text-align: center; - line-height: 1.4; - font-size: 12px; - box-shadow: none; -} -.components-tooltip .components-popover__content > div { - padding: 4px 8px; -} - -.components-tooltip__shortcut { - display: inline-block; - margin-left: 8px; -} - -.disabled-element-wrapper { - position: relative; -} -.disabled-element-wrapper .event-catcher { - z-index: 100002; - position: absolute; - width: 100%; - height: 100%; - top: 0; - left: 0; - bottom: 0; - right: 0; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.list-reusable-blocks-import-dropdown__content .components-popover__content>div{padding:10px}.list-reusable-blocks-import-form__label{display:block;margin-bottom:10px}.list-reusable-blocks-import-form__button{margin-top:10px;margin-bottom:10px;float:left}.list-reusable-blocks-import-form .components-notice__content{margin:0}.list-reusable-blocks-import-form .components-notice.is-dismissible{padding-left:0;margin:5px 0}.list-reusable-blocks__container{display:inline-flex;align-items:center;position:relative;top:-3px}.list-reusable-blocks__container .components-button{height:26px}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.list-reusable-blocks-import-dropdown__content .components-popover__content>div{padding:10px}.list-reusable-blocks-import-form__label{display:block;margin-bottom:10px}.list-reusable-blocks-import-form__button{margin-top:10px;margin-bottom:10px;float:right}.list-reusable-blocks-import-form .components-notice__content{margin:0}.list-reusable-blocks-import-form .components-notice.is-dismissible{padding-right:0;margin:5px 0}.list-reusable-blocks__container{display:inline-flex;align-items:center;position:relative;top:-3px}.list-reusable-blocks__container .components-button{height:26px}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.list-reusable-blocks-import-dropdown__content .components-popover__content > div { - padding: 10px; -} - -.list-reusable-blocks-import-form__label { - display: block; - margin-bottom: 10px; -} - -.list-reusable-blocks-import-form__button { - margin-top: 10px; - margin-bottom: 10px; - float: left; -} - -.list-reusable-blocks-import-form .components-notice__content { - margin: 0; -} -.list-reusable-blocks-import-form .components-notice.is-dismissible { - padding-left: 0; - margin: 5px 0; -} - -.list-reusable-blocks__container { - display: inline-flex; - align-items: center; - position: relative; - top: -3px; -} -.list-reusable-blocks__container .components-button { - height: 26px; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.list-reusable-blocks-import-dropdown__content .components-popover__content > div { - padding: 10px; -} - -.list-reusable-blocks-import-form__label { - display: block; - margin-bottom: 10px; -} - -.list-reusable-blocks-import-form__button { - margin-top: 10px; - margin-bottom: 10px; - float: right; -} - -.list-reusable-blocks-import-form .components-notice__content { - margin: 0; -} -.list-reusable-blocks-import-form .components-notice.is-dismissible { - padding-right: 0; - margin: 5px 0; -} - -.list-reusable-blocks__container { - display: inline-flex; - align-items: center; - position: relative; - top: -3px; -} -.list-reusable-blocks__container .components-button { - height: 26px; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-editor-autocompleters__block{white-space:nowrap}.block-editor-autocompleters__block .block-editor-block-icon{margin-left:8px}.block-editor-autocompleters__link{white-space:nowrap}.block-editor-autocompleters__link .block-editor-block-icon{margin-left:8px}.block-editor-block-alignment-control__menu-group .components-menu-item__info{margin-top:0}.block-editor-block-alignment-matrix-control__popover .components-popover__content{min-width:0;width:auto}.block-editor-block-alignment-matrix-control__popover .components-popover__content>div{padding:8px}.block-editor-block-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px}.block-editor-block-icon.has-colors svg{fill:currentColor}@media (forced-colors:active){.block-editor-block-icon.has-colors svg{fill:CanvasText}}.block-editor-block-icon svg{min-width:20px;min-height:20px;max-width:24px;max-height:24px}.block-editor-block-inspector p{margin-top:0}.block-editor-block-inspector h2,.block-editor-block-inspector h3{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.block-editor-block-inspector .components-base-control{margin-bottom:24px}.block-editor-block-inspector .components-base-control:last-child{margin-bottom:8px}.block-editor-block-inspector .components-panel__body{border:none;border-top:1px solid #e0e0e0}.block-editor-block-inspector .block-editor-block-card{padding:16px}.block-editor-block-inspector__no-blocks{display:block;font-size:13px;background:#fff;padding:32px 16px;text-align:center}.block-editor-block-styles .block-editor-block-list__block{margin:0}.block-editor-block-list__layout{position:relative}.block-editor-block-list__layout.is-navigate-mode{cursor:default}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after,.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected:after,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]):after,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:after,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{position:absolute;z-index:1;pointer-events:none;content:"";top:1px;bottom:1px;right:1px;left:1px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:1px;outline:2px solid transparent}.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after,.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected:after,.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]):after,.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:after,.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{box-shadow:0 0 0 1px #fff}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted .components-placeholder ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected .components-placeholder ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]) .components-placeholder ::selection,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered .components-placeholder ::selection,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected .components-placeholder ::selection{background:transparent}.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:not(.is-selected):after{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:1px solid transparent}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.has-child-selected,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected:before{content:"";position:absolute;z-index:0;pointer-events:none;transition:border-color .1s linear,border-style .1s linear,box-shadow .1s linear;left:0;right:0;top:-14px;border-radius:2px;border-top:4px solid #ccc}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected:after{content:none}.block-editor-block-list__layout .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected:before{border-color:var(--wp-admin-theme-color)}.is-block-moving-mode.block-editor-block-list__block-selection-button{opacity:0;font-size:1px;height:1px;padding:0}.block-editor-block-list__layout .block-editor-block-list__block{position:relative;overflow-wrap:break-word}.block-editor-block-list__layout .block-editor-block-list__block .reusable-block-edit-panel *{z-index:1}.block-editor-block-list__layout .block-editor-block-list__block .components-placeholder .components-with-notices-ui{margin:-10px 0 12px}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui{margin:0 0 12px;width:100%}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice{margin-right:0;margin-left:0}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice .components-notice__content{font-size:13px}.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus{outline:none}.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus:after{position:absolute;z-index:1;pointer-events:none;content:"";top:1px;bottom:1px;right:1px;left:1px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:1px;outline:2px solid transparent}.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #fff}.block-editor-block-list__layout .block-editor-block-list__block:after{content:"";pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0;border-radius:2px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) transparent}.block-editor-block-list__layout .block-editor-block-list__block.has-warning{min-height:48px}.block-editor-block-list__layout .block-editor-block-list__block.has-warning>*{pointer-events:none;-webkit-user-select:none;user-select:none}.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning{pointer-events:all}.block-editor-block-list__layout .block-editor-block-list__block.has-warning:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;border-radius:2px;background-color:hsla(0,0%,100%,.4)}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected:after{background-color:transparent}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable>.block-editor-inner-blocks>.block-editor-block-list__layout.has-overlay:after{display:none}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable>.block-editor-inner-blocks>.block-editor-block-list__layout.has-overlay .block-editor-block-list__layout.has-overlay:after{display:block}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable.has-child-selected:after{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true]{float:none}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered{cursor:default}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered:after{top:1px;right:1px;left:1px;bottom:1px;box-shadow:0 0 0 1px var(--wp-admin-theme-color);border-radius:1px}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected{cursor:unset}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);top:1px;right:1px;left:1px;bottom:1px;border-radius:1px}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:focus:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.is-focus-mode .block-editor-block-list__block:not(.has-child-selected){opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.is-focus-mode .block-editor-block-list__block:not(.has-child-selected){transition-duration:0s;transition-delay:0s}}.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) .block-editor-block-list__block,.is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-multi-selected,.is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-selected{opacity:1}.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity{opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity{transition-duration:0s;transition-delay:0s}}.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block{opacity:1}.wp-block.alignleft,.wp-block.alignright,.wp-block[data-align=left]>*,.wp-block[data-align=right]>*{z-index:21}.wp-site-blocks>[data-align=left]{float:right;margin-left:2em}.wp-site-blocks>[data-align=right]{float:left;margin-right:2em}.wp-site-blocks>[data-align=center]{justify-content:center;margin-right:auto;margin-left:auto}.block-editor-block-list .block-editor-inserter{margin:8px;cursor:move;cursor:grab}@keyframes block-editor-inserter__toggle__fade-in-animation{0%{opacity:0}to{opacity:1}}.wp-block .block-list-appender .block-editor-inserter__toggle{animation:block-editor-inserter__toggle__fade-in-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.wp-block .block-list-appender .block-editor-inserter__toggle{animation-duration:1ms;animation-delay:0s}}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender{display:none}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender .block-editor-inserter__toggle{opacity:0;transform:scale(0)}.block-editor-block-list__block .block-editor-block-list__block-html-textarea{display:block;margin:0;padding:12px;width:100%;border:none;outline:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;line-height:1.5;transition:padding .2s linear}@media (prefers-reduced-motion:reduce){.block-editor-block-list__block .block-editor-block-list__block-html-textarea{transition-duration:0s;transition-delay:0s}}.block-editor-block-list__block .block-editor-block-list__block-html-textarea:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-block-list__block .block-editor-warning{z-index:5;position:relative}.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning{margin-bottom:auto}.block-editor-block-list__insertion-point{position:absolute}.block-editor-block-list__insertion-point-indicator{position:absolute;background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point.is-vertical>.block-editor-block-list__insertion-point-indicator{top:50%;height:1px}.block-editor-block-list__insertion-point.is-horizontal>.block-editor-block-list__insertion-point-indicator{top:0;left:0;right:50%;width:1px}.block-editor-block-list__insertion-point-inserter{display:none;position:absolute;justify-content:center;top:calc(50% - 12px);right:calc(50% - 12px)}@media (min-width:480px){.block-editor-block-list__insertion-point-inserter{display:flex}}.block-editor-block-list__block-popover-inserter{position:absolute;top:-9999em;margin-bottom:14px}.block-editor-block-list__block-popover-inserter.is-visible{position:static}.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon{background:#1e1e1e;border-radius:2px;color:#fff;padding:0;min-width:24px;height:24px}.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon:hover{color:#fff;background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon{background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover{background:#1e1e1e}.block-editor-block-contextual-toolbar{display:inline-flex;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar,.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar-group{border-left-color:#1e1e1e}.block-editor-block-contextual-toolbar.is-fixed{position:sticky;top:0;width:100%;z-index:31;min-height:48px;display:block;border:none;border-bottom:1px solid #e0e0e0;border-radius:0}.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar,.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group{border-left-color:#e0e0e0}.block-editor-block-contextual-toolbar .block-editor-block-mover-button{overflow:hidden}.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button{min-width:24px;width:24px}.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button svg{min-width:24px}.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button:focus:before{right:0!important;min-width:0;width:100%}@media (min-width:600px){.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-up-button svg{top:5px}.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-down-button svg{bottom:5px}}.block-editor-block-list__block-selection-button{display:inline-flex;padding:0 12px;z-index:22;border-radius:2px;background-color:#1e1e1e;font-size:13px;height:48px}.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content{margin:auto;display:inline-flex;align-items:center}.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content>.components-flex__item{margin-left:6px}.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle{cursor:grab;padding:0;height:24px;min-width:24px;margin-right:-2px}.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle svg{min-width:18px;min-height:18px}.block-editor-block-list__block-selection-button .block-editor-block-icon{font-size:13px;color:#fff;height:48px}.block-editor-block-list__block-selection-button .components-button{min-width:36px;color:#fff;height:48px;display:flex}.block-editor-block-list__block-selection-button .components-button:focus{box-shadow:none;border:none}.block-editor-block-list__block-selection-button .components-button:active{color:#fff}.block-editor-block-list__block-selection-button .block-selection-button_select-button.components-button{padding:0}.block-editor-block-list__insertion-point-popover.is-without-arrow{z-index:28;position:absolute;pointer-events:none}.block-editor-block-list__insertion-point-popover.is-without-arrow *{pointer-events:none}.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter,.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter *{pointer-events:all}.block-editor-block-list__insertion-point-popover.is-without-arrow .components-popover__content.components-popover__content{background:none;border:none;box-shadow:none;overflow-y:visible;margin-right:0}@keyframes hide-during-dragging{to{position:fixed;transform:translate(-9999px,9999px)}}.components-popover.block-editor-block-list__block-popover{z-index:31;position:absolute}.components-popover.block-editor-block-list__block-popover .components-popover__content{margin:0!important;min-width:auto;width:max-content;background:none;border:none;box-shadow:none;overflow-y:visible;pointer-events:none}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__empty-block-inserter{pointer-events:all}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button{margin-top:12px;margin-bottom:12px}.components-popover.block-editor-block-list__block-popover.is-insertion-point-visible{visibility:hidden}.is-dragging-components-draggable .components-popover.block-editor-block-list__block-popover{opacity:0;animation:hide-during-dragging 1ms linear forwards}.is-dragging-components-draggable .components-tooltip{display:none}.block-editor-block-toolbar .components-toolbar-group,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot{padding-right:6px;padding-left:6px}.block-editor-block-toolbar .components-toolbar-group .components-button,.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon{min-width:36px;padding-right:6px;padding-left:6px}.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon svg,.block-editor-block-toolbar .components-toolbar-group .components-button svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button svg,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button svg{min-width:24px}.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar-group .components-button:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button:before,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button:before{right:2px;left:2px}.is-vertical .block-list-appender{width:24px;margin-left:auto;margin-top:12px;margin-right:12px}.block-list-appender>.block-editor-inserter{display:block}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) .block-editor-block-list__layout>.block-list-appender .block-list-appender__toggle{opacity:0;transform:scale(0)}.block-editor-block-lock-modal{z-index:1000001}@media (min-width:600px){.block-editor-block-lock-modal .components-modal__frame{max-width:480px}}.block-editor-block-lock-modal__checklist{margin:0}.block-editor-block-lock-modal__options-title{padding:12px 0}.block-editor-block-lock-modal__options-title .components-checkbox-control__label{font-weight:600}.block-editor-block-lock-modal__options-title .components-base-control__field{align-items:center;display:flex;margin:0}.block-editor-block-lock-modal__checklist-item{margin-bottom:0;padding:12px 32px 12px 0}.block-editor-block-lock-modal__checklist-item .components-base-control__field{align-items:center;display:flex;margin:0}.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label{display:flex;align-items:center;justify-content:space-between;flex-grow:1}.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label svg{margin-left:12px;fill:#1e1e1e}.block-editor-block-lock-modal__checklist-item:hover{background-color:#f0f0f0;border-radius:2px}.block-editor-block-lock-modal__actions{margin-top:24px}.block-editor-block-lock-toolbar .components-button.has-icon{min-width:36px!important;padding-right:0!important}.block-editor-block-lock-toolbar .components-button.has-icon:focus:before{left:8px!important}.block-editor-block-breadcrumb{list-style:none;padding:0;margin:0}.block-editor-block-breadcrumb li{display:inline-flex;margin:0}.block-editor-block-breadcrumb li .block-editor-block-breadcrumb__separator{fill:currentColor;margin-right:-4px;margin-left:-4px;transform:scaleX(-1)}.block-editor-block-breadcrumb li:last-child .block-editor-block-breadcrumb__separator{display:none}.block-editor-block-breadcrumb__button.components-button{height:24px;line-height:24px;padding:0;position:relative}.block-editor-block-breadcrumb__button.components-button:hover:not(:disabled){text-decoration:underline;box-shadow:none}.block-editor-block-breadcrumb__button.components-button:focus{box-shadow:none}.block-editor-block-breadcrumb__button.components-button:focus:before{content:"";display:block;position:absolute;border-radius:2px;top:1px;left:1px;bottom:1px;right:1px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-block-breadcrumb__current{cursor:default}.block-editor-block-breadcrumb__button.components-button,.block-editor-block-breadcrumb__current{color:#1e1e1e;padding:0 8px;font-size:inherit}.block-editor-block-card{display:flex;align-items:flex-start}.block-editor-block-card__content{flex-grow:1;margin-bottom:4px}.block-editor-block-card__title{font-weight:500}.block-editor-block-card__title.block-editor-block-card__title{line-height:24px;margin:0 0 4px}.block-editor-block-card__description{font-size:13px}.block-editor-block-card .block-editor-block-icon{flex:0 0 24px;margin-right:0;margin-left:12px;width:24px;height:24px}.block-editor-block-compare{height:auto}.block-editor-block-compare__wrapper{display:flex;padding-bottom:16px}.block-editor-block-compare__wrapper>div{display:flex;justify-content:space-between;flex-direction:column;width:50%;padding:0 0 0 16px;min-width:200px;max-width:600px}.block-editor-block-compare__wrapper>div button{float:left}.block-editor-block-compare__wrapper .block-editor-block-compare__converted{border-right:1px solid #ddd;padding-right:15px;padding-left:0}.block-editor-block-compare__wrapper .block-editor-block-compare__html{font-family:Menlo,Consolas,monaco,monospace;font-size:12px;color:#1e1e1e;border-bottom:1px solid #ddd;padding-bottom:15px;line-height:1.7}.block-editor-block-compare__wrapper .block-editor-block-compare__html span{background-color:#e6ffed;padding-top:3px;padding-bottom:3px}.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__added{background-color:#acf2bd}.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__removed{background-color:#cc1818}.block-editor-block-compare__wrapper .block-editor-block-compare__preview{padding:16px 0 0}.block-editor-block-compare__wrapper .block-editor-block-compare__preview p{font-size:12px;margin-top:0}.block-editor-block-compare__wrapper .block-editor-block-compare__action{margin-top:16px}.block-editor-block-compare__wrapper .block-editor-block-compare__heading{font-size:1em;font-weight:400;margin:.67em 0}.block-editor-block-content-overlay.overlay-active:before{content:"";position:absolute;top:0;right:0;width:100%;height:100%;background:transparent;border:none;border-radius:2px;z-index:10}.block-editor-block-content-overlay.parent-highlighted.overlay-active:before,.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active:before{background:rgba(var(--wp-admin-theme-color--rgb),.1);box-shadow:0 0 0 1px var(--wp-admin-theme-color) inset}.block-editor-block-content-overlay.overlay-active:not(.is-dragging-blocks) *{pointer-events:none}.block-editor-block-content-overlay.is-dragging-blocks{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-draggable-chip-wrapper{position:absolute;top:-24px;right:0}.block-editor-block-draggable-chip{background-color:#1e1e1e;border-radius:2px;box-shadow:0 6px 8px rgba(0,0,0,.3);color:#fff;cursor:grabbing;display:inline-flex;height:48px;padding:0 13px;-webkit-user-select:none;user-select:none}.block-editor-block-draggable-chip svg{fill:currentColor}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content{margin:auto;justify-content:flex-start}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content>.components-flex__item{margin-left:6px}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content>.components-flex__item:last-child{margin-left:0}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content .block-editor-block-icon svg{min-width:18px;min-height:18px}.block-editor-block-draggable-chip .components-flex__item{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.block-editor-block-list__layout .is-dragging{background-color:currentColor!important;opacity:.05!important;border-radius:2px!important;pointer-events:none!important}.block-editor-block-list__layout .is-dragging::selection{background:transparent!important}.block-editor-block-list__layout .is-dragging:after{content:none!important}.block-editor-block-mobile-toolbar{display:flex;flex-direction:row;border-left:1px solid #ddd}.block-editor-block-mobile-toolbar .block-editor-block-mover-button{width:36px;height:36px;border-radius:2px;padding:3px;margin:0;justify-content:center;align-items:center}.block-editor-block-mobile-toolbar .block-editor-block-mover-button .dashicon{margin:auto}.block-editor-block-mobile-toolbar .block-editor-block-mover{display:flex;margin-left:auto}.block-editor-block-mobile-toolbar .block-editor-block-mover .block-editor-block-mover-button{float:right}.block-editor-block-mover-button__description{display:none}.block-editor-block-mover-button.has-icon{padding:0}.block-editor-block-mover{display:inline-flex;flex-direction:row}.block-editor-block-mover .block-editor-block-mover__move-button-container,.block-editor-block-mover .components-toolbar{flex:1;flex-direction:row;border-left:none!important;padding:0}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover__move-button-container,.block-editor-block-mover .components-toolbar{flex-direction:column}}.block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container,.block-editor-block-mover.is-horizontal .components-toolbar{flex-direction:row}.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button{padding-left:0;padding-right:0;min-width:36px}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover-button{height:24px;width:42px;padding-left:11px!important;padding-right:6px!important}.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button{min-width:42px}}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover-button:before{right:8px!important;left:8px!important}}.block-editor-block-mover .block-editor-block-mover__drag-handle{width:24px;cursor:grab;min-width:24px!important;padding:0!important}.block-editor-block-mover .block-editor-block-mover__drag-handle:focus:before{right:0!important;left:0!important}@media (min-width:600px){.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button{margin:0 0 0 auto}.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-up-button:before,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-up-button:before{bottom:0;height:calc(100% - 1px)}.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-down-button:before,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-down-button:before{top:0;height:calc(100% - 1px)}}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon{height:48px;width:24px;padding-right:0;padding-left:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon:before{top:1px;bottom:1px;min-width:0;width:auto;height:auto}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon svg{margin-right:0;margin-left:-8px;margin-bottom:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon:before{right:0!important;left:0!important}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon svg{margin-right:-8px;margin-left:0;margin-top:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon:before{right:0!important;left:0!important;width:calc(100% + 1px)}.block-editor-block-navigation__container{min-width:280px}.block-editor-block-navigation__label{margin:0 0 12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-block-parent-selector{background:#fff;border-radius:2px}.block-editor-block-parent-selector .block-editor-block-parent-selector__button{width:48px;height:48px;border:1px solid #1e1e1e;border-radius:2px}.block-editor-block-patterns-list__list-item{cursor:pointer;margin-bottom:24px}.block-editor-block-patterns-list__list-item.is-placeholder{min-height:100px}.block-editor-block-patterns-list__list-item[draggable=true] .block-editor-block-preview__container{cursor:grab}.block-editor-block-patterns-list__item{height:100%}.block-editor-block-patterns-list__item .block-editor-block-preview__container{display:flex;align-items:center;overflow:hidden;border-radius:2px;border:1px solid #f0f0f0}.block-editor-block-patterns-list__item .block-editor-block-patterns-list__item-title{padding-top:8px;font-size:12px;text-align:center}.block-editor-block-patterns-list__item:hover .block-editor-block-preview__container{border:1px solid var(--wp-admin-theme-color)}.block-editor-block-patterns-list__item:focus .block-editor-block-preview__container{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-patterns-list__item:focus .block-editor-block-patterns-list__item-title,.block-editor-block-patterns-list__item:hover .block-editor-block-patterns-list__item-title{color:var(--wp-admin-theme-color)}.block-editor-block-preview__container{position:relative;width:100%;overflow:hidden}.block-editor-block-preview__container .block-editor-block-preview__content{top:0;right:0;transform-origin:top right;text-align:initial;margin:0;overflow:visible;min-height:auto}.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-drop-zone,.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-list__insertion-point,.block-editor-block-preview__container .block-editor-block-preview__content .block-list-appender,.block-editor-block-preview__container .block-editor-block-preview__content .reusable-block-indicator,.block-editor-block-preview__content-iframe .block-list-appender{display:none}.block-editor-block-preview__live-content *{pointer-events:none}.block-editor-block-preview__live-content .block-list-appender{display:none}.block-editor-block-preview__live-content .components-button:disabled{opacity:1}.block-editor-block-preview__live-content .block-editor-block-list__block[data-empty=true],.block-editor-block-preview__live-content .components-placeholder{display:none}.block-editor-block-settings-menu__popover .components-dropdown-menu__menu{padding:0}.block-editor-block-styles+.default-style-picker__default-switcher{margin-top:16px}.block-editor-block-styles__preview-panel{display:none;position:absolute;left:16px;right:auto;z-index:90}@media (min-width:782px){.block-editor-block-styles__preview-panel{display:block}}.block-editor-block-styles__preview-panel .block-editor-inserter__preview-container{right:auto;left:auto;top:auto;position:static}.block-editor-block-styles__preview-panel .block-editor-block-card__title.block-editor-block-card__title{margin:0}.block-editor-block-styles__preview-panel .block-editor-block-icon{display:none}.block-editor-block-styles__variants{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px}.block-editor-block-styles__variants .block-editor-block-styles__item{color:#2f2f2f;box-shadow:inset 0 0 0 1px #ccc;display:inline-block;width:calc(50% - 4px)}.block-editor-block-styles__variants .block-editor-block-styles__item:focus,.block-editor-block-styles__variants .block-editor-block-styles__item:hover{color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 2px var(--wp-admin-theme-color)}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active,.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover{background-color:#2f2f2f;box-shadow:none}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text,.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text{color:#fff}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus{box-shadow:inset 0 0 0 1px #fff,0 0 0 2px var(--wp-admin-theme-color)}.block-editor-block-styles__block-preview-container,.block-editor-block-styles__block-preview-container *{box-sizing:border-box!important}.block-editor-block-switcher{position:relative;padding:0 6px}.block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon{min-width:36px}.block-editor-block-switcher__no-switcher-icon,.block-editor-block-switcher__toggle{position:relative}.components-button.block-editor-block-switcher__no-switcher-icon,.components-button.block-editor-block-switcher__toggle{margin:0;display:block;height:48px}.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,.components-button.block-editor-block-switcher__toggle .block-editor-block-icon{margin:auto}.block-editor-block-switcher__toggle-text{margin-right:8px}.show-icon-labels .block-editor-block-switcher__toggle-text{display:none}.show-icon-labels .block-editor-block-toolbar .block-editor-block-switcher .components-button.has-icon:after{font-size:14px}.block-editor-block-switcher__popover{margin-right:6px}.components-button.block-editor-block-switcher__no-switcher-icon{display:flex;padding:6px 12px!important}.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{margin-left:auto;margin-right:auto;min-width:24px!important}.components-button.block-editor-block-switcher__no-switcher-icon:disabled{opacity:1}.components-button.block-editor-block-switcher__no-switcher-icon:disabled,.components-button.block-editor-block-switcher__no-switcher-icon:disabled .block-editor-block-icon.has-colors{color:#1e1e1e}.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon{height:100%;position:relative;margin:0 auto;display:flex;align-items:center;min-width:100%}.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon:before{top:8px;left:8px;bottom:8px;right:8px}.components-popover.block-editor-block-switcher__popover .components-popover__content{min-width:300px}.components-popover.block-editor-block-switcher__popover .components-popover__content>div{min-width:auto;display:flex;background:#fff;padding:0}.components-popover.block-editor-block-switcher__popover .components-popover__content>div .components-menu-group{margin:0}.block-editor-block-switcher__popover .components-popover__content .block-editor-block-styles{margin:0 -3px}.block-editor-block-switcher__popover .components-popover__content .components-panel__body{border:0;position:relative;z-index:1}.block-editor-block-switcher__popover .components-popover__content .components-panel__body+.components-panel__body{border-top:1px solid #e0e0e0}.block-editor-block-switcher__popover__preview__parent .block-editor-block-switcher__popover__preview__container{position:absolute;top:-12px;right:calc(100% + 32px)}.block-editor-block-switcher__preview__popover{display:none}.block-editor-block-switcher__preview__popover.components-popover{margin-right:4px;margin-top:11px}@media (min-width:782px){.block-editor-block-switcher__preview__popover{display:block}}.block-editor-block-switcher__preview__popover .components-popover__content{box-shadow:none;border:1px solid #1e1e1e;background:#fff;border-radius:2px}.block-editor-block-switcher__preview__popover .block-editor-block-switcher__preview{width:300px;height:auto;max-height:500px;padding:16px}.block-editor-block-switcher__preview-title{margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon{min-width:36px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle{height:48px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform{width:48px;height:48px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform{padding:12px}.block-editor-block-switcher__preview-patterns-container{padding-bottom:16px}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item{margin-top:16px}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-preview__container{cursor:pointer}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item{height:100%;border-radius:2px;transition:all .05s ease-in-out;position:relative;border:1px solid transparent}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:focus,.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item .block-editor-block-switcher__preview-patterns-container-list__item-title{padding:4px;font-size:12px;text-align:center;cursor:pointer}.block-editor-block-types-list>[role=presentation]{overflow:hidden;display:flex;flex-wrap:wrap}.block-editor-block-variation-picker .components-placeholder__instructions{margin-bottom:0}.block-editor-block-variation-picker .components-placeholder__fieldset{flex-direction:column}.block-editor-block-variation-picker.has-many-variations .components-placeholder__fieldset{max-width:90%}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations{display:flex;justify-content:flex-start;flex-direction:row;flex-wrap:wrap;width:100%;margin:16px 0;padding:0;list-style:none}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations>li{list-style:none;margin:8px 0 0 20px;flex-shrink:1;width:75px;text-align:center}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations>li button{display:inline-flex;margin-left:0}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation{padding:8px}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation-label{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:12px;display:block;line-height:1.4}.block-editor-block-variation-picker__variation{width:100%}.block-editor-block-variation-picker__variation.components-button.has-icon{justify-content:center;width:auto}.block-editor-block-variation-picker__variation.components-button.has-icon.is-secondary{background-color:#fff}.block-editor-block-variation-picker__variation.components-button{height:auto;padding:0}.block-editor-block-variation-picker__variation:before{content:"";padding-bottom:100%}.block-editor-block-variation-picker__variation:first-child{margin-right:0}.block-editor-block-variation-picker__variation:last-child{margin-left:0}.block-editor-block-pattern-setup{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;width:100%;border-radius:2px}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar{justify-content:center}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container{column-gap:24px;display:block;width:100%;padding:32px;column-count:2}@media (min-width:1440px){.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container{column-count:3}}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container,.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button]{cursor:pointer}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item{break-inside:avoid-column;margin-bottom:24px}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container{min-height:100px;border-radius:2px;border:1px solid #ddd}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content{width:100%}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar{height:60px;box-sizing:border-box;padding:16px;width:100%;text-align:right;margin:0;color:#1e1e1e;border-radius:2px 2px 0 0;background-color:#fff;display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-top:1px solid #ddd;align-self:flex-end}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls{display:flex}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions,.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__navigation{width:calc(50% - 36px);display:flex}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions{justify-content:flex-end}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container{display:flex;flex-direction:column;width:100%;box-sizing:border-box}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container{overflow:hidden;position:relative;padding:0;margin:0;list-style:none;transform-style:preserve-3d}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container *{box-sizing:border-box}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide{position:absolute;top:0;width:100%;margin:auto;padding:0;transition:transform .5s,z-index .5s;z-index:100}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide{opacity:1;position:relative;z-index:102}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.previous-slide{transform:translateX(100%);z-index:101}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.next-slide{transform:translateX(-100%);z-index:101}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .block-list-appender{display:none}.block-editor-block-pattern-setup__carousel,.block-editor-block-pattern-setup__grid{width:100%;overflow-y:auto}.block-editor-block-variation-transforms{padding:0 52px 16px 16px;width:100%}.block-editor-block-variation-transforms .components-dropdown-menu__toggle{border:1px solid #757575;border-radius:2px;min-height:30px;width:100%;position:relative;text-align:right;justify-content:left;padding:6px 12px}.block-editor-block-variation-transforms .components-dropdown-menu__toggle.components-dropdown-menu__toggle{padding-left:24px}.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled){border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color)}.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg{height:100%;padding:0;position:absolute;left:0;top:0}.block-editor-block-variation-transforms__popover .components-popover__content{min-width:230px}.components-border-radius-control{margin-bottom:12px}.components-border-radius-control legend{margin-bottom:8px}.components-border-radius-control .components-border-radius-control__wrapper{display:flex;justify-content:space-between;align-items:flex-start}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control,.components-border-radius-control .components-border-radius-control__wrapper>.components-unit-control-wrapper{width:calc(50% - 26px);margin-bottom:0}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-base-control__field{margin-bottom:0;height:30px}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-range-control__wrapper{margin-left:10px}.components-border-radius-control .components-border-radius-control__wrapper>span{flex:0 0 auto}.components-border-radius-control .components-border-radius-control__input-controls-wrapper{display:flex;width:70%;flex-wrap:wrap}.components-border-radius-control .components-border-radius-control__input-controls-wrapper .components-unit-control-wrapper{width:calc(50% - 8px);margin-bottom:8px;margin-left:8px}.components-border-radius-control .component-border-radius-control__linked-button.has-icon{display:flex;justify-content:center}.components-border-radius-control .component-border-radius-control__linked-button.has-icon svg{margin-left:0}.components-border-style-control legend{line-height:1.4;margin-bottom:8px;padding:0}.components-border-style-control .components-border-style-control__buttons{display:inline-flex}.components-border-style-control .components-border-style-control__buttons .components-button.has-icon{min-width:30px;height:30px;padding:3px;margin-left:4px}.block-editor-button-block-appender{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:auto;color:#1e1e1e;box-shadow:inset 0 0 0 1px #1e1e1e}.block-editor-button-block-appender.components-button.components-button{padding:12px}.is-dark-theme .block-editor-button-block-appender{color:hsla(0,0%,100%,.65);box-shadow:inset 0 0 0 1px hsla(0,0%,100%,.65)}.block-editor-button-block-appender:hover{color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color)}.block-editor-button-block-appender:focus{box-shadow:inset 0 0 0 2px var(--wp-admin-theme-color)}.block-editor-button-block-appender:active{color:#000}.block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator{margin-bottom:12px}.block-editor-color-gradient-control__fieldset{min-width:0}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title{display:flex;gap:8px}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator{width:12px;height:12px;align-self:center}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child{margin-right:12px}.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator{display:none}@media screen and (min-width:782px){.block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches{display:grid;grid-template-columns:repeat(6,28px);justify-content:space-between}}.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control{margin-bottom:inherit}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown{display:block}.block-editor-panel-color-gradient-settings__dropdown{width:100%}.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content>div{width:280px}@media (min-width:782px){.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content{margin-left:156px!important}.block-editor-panel-color-gradient-settings__dropdown-content.is-from-top .components-popover__content{margin-top:-60px!important}.block-editor-panel-color-gradient-settings__dropdown-content.is-from-bottom .components-popover__content{margin-bottom:-60px!important}}.block-editor-panel-color-gradient-settings__dropdown:last-child>div{border-bottom-width:0}.block-editor-panel-color-gradient-settings__item{padding-top:12px!important;padding-bottom:12px!important}.block-editor-panel-color-gradient-settings__item .block-editor-panel-color-gradient-settings__color-indicator{background:linear-gradient(45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.block-editor-panel-color-gradient-settings__item.is-open{background:#f0f0f0;color:var(--wp-admin-theme-color)}.block-editor-contrast-checker>.components-notice{margin:0}.block-editor-default-block-appender{clear:both;margin-right:auto;margin-left:auto;position:relative}.block-editor-default-block-appender[data-root-client-id=""] .block-editor-default-block-appender__content:hover{outline:1px solid transparent}.block-editor-default-block-appender .block-editor-default-block-appender__content{opacity:.62}.block-editor-default-block-appender .components-drop-zone__content-icon{display:none}.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,.block-editor-default-block-appender .block-editor-inserter{position:absolute;top:0;left:0;line-height:0}.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled,.block-editor-default-block-appender .block-editor-inserter:disabled{display:none}.block-editor-block-list__block .block-list-appender{position:absolute;list-style:none;padding:0;z-index:2;bottom:0;left:0}.block-editor-block-list__block .block-list-appender.block-list-appender{margin:0;line-height:0}.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender{height:24px}.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block .block-list-appender .block-list-appender__toggle{flex-direction:row;box-shadow:none;height:24px;width:24px;display:none;padding:0!important;background:#1e1e1e;color:#fff}.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover{color:#fff;background:var(--wp-admin-theme-color)}.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content{display:none}.block-editor-block-list__block .block-list-appender:only-child{position:relative;left:auto;align-self:center;list-style:none;line-height:inherit}.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content{display:block}.block-editor-block-list__block.is-selected .block-editor-block-list__layout>.block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block.is-selected .block-editor-block-list__layout>.block-list-appender .block-list-appender__toggle,.block-editor-block-list__block.is-selected>.block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block.is-selected>.block-list-appender .block-list-appender__toggle{display:flex}.block-editor-default-block-appender__content{cursor:text}.block-editor-date-format-picker{margin-bottom:16px}.block-editor-date-format-picker__default-format-toggle-control__hint{color:#757575;display:block}.block-editor-date-format-picker__custom-format-select-control.components-base-control{margin-bottom:0}.block-editor-date-format-picker__custom-format-select-control .components-custom-select-control__button{width:100%}.block-editor-date-format-picker__custom-format-select-control__custom-option{border-top:1px solid #ddd}.block-editor-date-format-picker__custom-format-select-control__custom-option.has-hint{grid-template-columns:auto 30px}.block-editor-date-format-picker__custom-format-select-control__custom-option .components-custom-select-control__item-hint{grid-row:2;text-align:right}.block-editor-duotone-control__popover>.components-popover__content>div{padding:16px;width:280px}.block-editor-duotone-control__popover .components-menu-group__label{padding:0}.block-editor-duotone-control__popover .components-custom-gradient-picker__gradient-bar{margin:16px 0 12px}.block-editor-duotone-control__popover .components-circular-option-picker__swatches{display:grid;grid-template-columns:repeat(6,28px);gap:12px;justify-content:space-between}.block-editor-duotone-control__description{margin:16px 0;font-size:12px}.block-editor-duotone-control__popover:not([data-y-axis=middle][data-x-axis=right])>.components-popover__content{margin-right:-14px}.components-font-appearance-control{margin-bottom:24px}.components-font-appearance-control ul li{color:#1e1e1e;text-transform:capitalize}.block-editor-image-size-control{margin-bottom:1em}.block-editor-image-size-control .block-editor-image-size-control__row{display:flex;justify-content:space-between}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height,.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width{margin-bottom:.5em}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height input,.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width input{line-height:1.25}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width{margin-left:5px}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height{margin-right:5px}.block-editor-block-list__layout.has-overlay:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;z-index:60}.block-editor-block-types-list__list-item{display:block;width:33.33%;padding:0;margin:0}.components-button.block-editor-block-types-list__item{display:flex;flex-direction:column;width:100%;font-size:13px;color:#1e1e1e;padding:8px;align-items:stretch;justify-content:center;cursor:pointer;background:transparent;word-break:break-word;border-radius:2px;transition:all .05s ease-in-out;position:relative;height:auto}@media (prefers-reduced-motion:reduce){.components-button.block-editor-block-types-list__item{transition-duration:0s;transition-delay:0s}}.components-button.block-editor-block-types-list__item:disabled{opacity:.6;cursor:default}.components-button.block-editor-block-types-list__item:not(:disabled):hover{color:var(--wp-admin-theme-color)!important}.components-button.block-editor-block-types-list__item:not(:disabled):focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.block-editor-block-types-list__item:not(:disabled).is-active{color:#fff;background:#1e1e1e;outline:2px solid transparent;outline-offset:-2px}.block-editor-block-types-list__item-icon{padding:12px 20px;border-radius:2px;color:#1e1e1e;transition:all .05s ease-in-out}@media (prefers-reduced-motion:reduce){.block-editor-block-types-list__item-icon{transition-duration:0s;transition-delay:0s}}.block-editor-block-types-list__item-icon .block-editor-block-icon{margin-right:auto;margin-left:auto}.block-editor-block-types-list__item-icon svg{transition:all .15s ease-out}@media (prefers-reduced-motion:reduce){.block-editor-block-types-list__item-icon svg{transition-duration:0s;transition-delay:0s}}.block-editor-block-types-list__list-item[draggable=true] .block-editor-block-types-list__item-icon{cursor:grab}.block-editor-block-types-list__item-title{padding:4px 2px 8px;font-size:12px}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}@keyframes loadingpulse{0%{opacity:1}50%{opacity:0}to{opacity:1}}.block-editor-link-control{position:relative;min-width:360px}.components-popover__content .block-editor-link-control{min-width:auto;width:90vw;max-width:360px}.block-editor-link-control__search-input-container,.block-editor-link-control__search-input-wrapper{position:relative}.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input{flex:1}.block-editor-link-control__field{margin:16px}.block-editor-link-control__field>.components-base-control__field{display:flex;align-items:center;margin:0}.block-editor-link-control__field .components-base-control__label{margin-left:16px;margin-bottom:0}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;font-size:16px;line-height:normal;width:calc(100% - 32px);display:block;padding:11px 16px 11px 36px;margin:0;position:relative;border:1px solid #ddd;border-radius:2px}@media (prefers-reduced-motion:reduce){.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{font-size:13px;line-height:normal}}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:focus,.block-editor-link-control__field input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-webkit-input-placeholder,.block-editor-link-control__field input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-moz-placeholder,.block-editor-link-control__field input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:-ms-input-placeholder,.block-editor-link-control__field input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-link-control__search-error{margin:-8px 16px 16px}.block-editor-link-control__search-actions{position:absolute;top:3px;left:19px}.components-button .block-editor-link-control__search-submit .has-icon{margin:-1px}.block-editor-link-control__search-results-wrapper{position:relative;margin-top:-15px}.block-editor-link-control__search-results-wrapper:after,.block-editor-link-control__search-results-wrapper:before{content:"";position:absolute;right:-1px;left:16px;display:block;pointer-events:none;z-index:100}.block-editor-link-control__search-results-wrapper:before{height:8px;top:0;bottom:auto}.block-editor-link-control__search-results-wrapper:after{height:16px;bottom:0;top:auto}.block-editor-link-control__search-results-label{padding:16px 32px 0;display:block;font-weight:600}.block-editor-link-control__search-results{margin:0;padding:8px 16px;max-height:200px;overflow-y:auto}.block-editor-link-control__search-results.is-loading{opacity:.2}.block-editor-link-control__search-item{position:relative;display:flex;align-items:flex-start;font-size:13px;cursor:pointer;background:#fff;width:100%;border:none;text-align:right;padding:12px 16px;border-radius:2px;height:auto}.block-editor-link-control__search-item:focus,.block-editor-link-control__search-item:hover{background-color:#f0f0f0}.block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type,.block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type{background:#fff}.block-editor-link-control__search-item:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset}.block-editor-link-control__search-item.is-selected{background:#f0f0f0}.block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type{background:#fff}.block-editor-link-control__search-item.is-current{flex-direction:column;background:transparent;border:0;width:100%;cursor:default;padding:16px}.block-editor-link-control__search-item .block-editor-link-control__search-item-header{display:block;flex-direction:row;align-items:flex-start;margin-left:8px;white-space:pre-wrap;overflow-wrap:break-word}.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info{word-break:break-all}.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header{display:flex;flex:1}.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-header{align-items:center}.block-editor-link-control__search-item .block-editor-link-control__search-item-icon{position:relative;top:.2em;margin-left:8px;max-height:24px;flex-shrink:0;width:24px;display:flex;justify-content:center}.block-editor-link-control__search-item .block-editor-link-control__search-item-icon img{width:16px}.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-icon{top:0;width:32px;max-height:32px}.block-editor-link-control__search-item .block-editor-link-control__search-item-info,.block-editor-link-control__search-item .block-editor-link-control__search-item-title{overflow:hidden;text-overflow:ellipsis}.block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon,.block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon{position:absolute;left:0;margin-top:0}.block-editor-link-control__search-item .block-editor-link-control__search-item-title{display:block;margin-bottom:.2em;font-weight:500;position:relative}.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark{font-weight:700;color:inherit;background-color:transparent}.block-editor-link-control__search-item .block-editor-link-control__search-item-title span{font-weight:400}.block-editor-link-control__search-item .block-editor-link-control__search-item-title svg{display:none}.block-editor-link-control__search-item .block-editor-link-control__search-item-info{display:block;color:#757575;font-size:.9em;line-height:1.3}.block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice{font-style:italic;font-size:1.1em}.block-editor-link-control__search-item .block-editor-link-control__search-item-type{display:block;padding:3px 6px;margin-right:auto;font-size:.9em;background-color:#f0f0f0;border-radius:2px;white-space:nowrap}.block-editor-link-control__search-item .block-editor-link-control__search-item-description{padding-top:12px;margin:0}.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder{margin-top:12px;padding-top:0;height:28px;display:flex;flex-direction:column;justify-content:space-around}.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder:after,.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder:before{display:block;content:"";height:.7em;width:100%;background-color:#f0f0f0;border-radius:3px}.block-editor-link-control__search-item .block-editor-link-control__search-item-description .components-text{font-size:.9em}.block-editor-link-control__search-item .block-editor-link-control__search-item-image{display:flex;width:100%;background-color:#f0f0f0;justify-content:center;height:140px;max-height:140px;overflow:hidden;border-radius:2px;margin-top:12px}.block-editor-link-control__search-item .block-editor-link-control__search-item-image.is-placeholder{background-color:#f0f0f0;border-radius:3px}.block-editor-link-control__search-item .block-editor-link-control__search-item-image img{display:block;max-width:100%;height:140px;max-height:140px}.block-editor-link-control__search-item-top{display:flex;flex-direction:row;width:100%}.block-editor-link-control__search-item-bottom{transition:opacity 1.5s;width:100%}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description:after,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description:before,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-image{animation:loadingpulse 1s linear infinite;animation-delay:.5s}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon img,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon svg{opacity:0}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon:before{content:"";display:block;background-color:#f0f0f0;position:absolute;top:0;right:0;left:0;bottom:0;border-radius:100%;animation:loadingpulse 1s linear infinite;animation-delay:.5s}.block-editor-link-control__loading{margin:16px;display:flex;align-items:center}.block-editor-link-control__loading .components-spinner{margin-top:0}.components-button+.block-editor-link-control__search-create{overflow:visible;padding:12px 16px}.components-button+.block-editor-link-control__search-create:before{content:"";position:absolute;top:-10px;right:0;display:block;width:100%}.block-editor-link-control__search-create{align-items:center}.block-editor-link-control__search-create .block-editor-link-control__search-item-title{margin-bottom:0}.block-editor-link-control__search-create .block-editor-link-control__search-item-icon{top:0}.block-editor-link-control__search-results div[role=menu]>.block-editor-link-control__search-item.block-editor-link-control__search-item{padding:10px}.block-editor-link-control__tools{display:flex;align-items:center;border-top:1px solid #ddd;margin:0;padding:16px}.block-editor-link-control__unlink{padding-right:16px;padding-left:16px}.block-editor-link-control__settings{flex:1;margin:0}.block-editor-link-control__settings :last-child{margin-bottom:0}.is-alternate .block-editor-link-control__settings{border-top:1px solid #1e1e1e}.block-editor-link-control__setting{margin-bottom:16px}.block-editor-link-control__setting :last-child{margin-bottom:0}.block-editor-link-control .block-editor-link-control__search-input .components-spinner{display:block}.block-editor-link-control .block-editor-link-control__search-input .components-spinner.components-spinner{position:absolute;right:auto;bottom:auto;top:calc(50% - 8px);left:36px}.block-editor-link-control__search-item-action{margin-right:auto;flex-shrink:0}.block-editor-list-view-tree{width:100%;border-collapse:collapse;padding:0;margin:0}.components-modal__content .block-editor-list-view-tree{margin:-12px -6px 0;width:calc(100% + 12px)}.block-editor-list-view-leaf{position:relative}.block-editor-list-view-leaf.is-selected td{background:var(--wp-admin-theme-color)}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents,.block-editor-list-view-leaf.is-selected .components-button.has-icon{color:#fff}.is-dragging-components-draggable .block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents{background:none;color:#1e1e1e}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents:focus:after{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block__menu:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #fff}.block-editor-list-view-leaf.is-dragging{display:none}.block-editor-list-view-leaf.is-first-selected td:first-child{border-top-right-radius:2px}.block-editor-list-view-leaf.is-first-selected td:last-child{border-top-left-radius:2px}.block-editor-list-view-leaf.is-last-selected td:first-child{border-bottom-right-radius:2px}.block-editor-list-view-leaf.is-last-selected td:last-child{border-bottom-left-radius:2px}.block-editor-list-view-leaf.is-branch-selected:not(.is-selected){background:linear-gradient(hsla(0,0%,100%,.9),hsla(0,0%,100%,.9)),linear-gradient(var(--wp-admin-theme-color),var(--wp-admin-theme-color))}.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:first-child{border-top-right-radius:2px}.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:last-child{border-top-left-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:first-child{border-top-right-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:last-child{border-top-left-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:first-child{border-bottom-right-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:last-child{border-bottom-left-radius:2px}.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) td{border-radius:0}.block-editor-list-view-leaf .block-editor-list-view-block-contents{display:flex;align-items:center;width:100%;height:auto;padding:6px 0 6px 12px;text-align:right;color:#1e1e1e;border-radius:2px;position:relative;white-space:nowrap}.block-editor-list-view-leaf .block-editor-list-view-block-contents.is-dropping-before:before{content:"";position:absolute;pointer-events:none;transition:border-color .1s linear,border-style .1s linear,box-shadow .1s linear;top:-2px;left:0;right:0;border-top:4px solid var(--wp-admin-theme-color)}.components-modal__content .block-editor-list-view-leaf .block-editor-list-view-block-contents{padding-right:0;padding-left:0}.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus{box-shadow:none}.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus:after{content:"";position:absolute;top:0;left:-29px;bottom:0;right:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);z-index:2;pointer-events:none}.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block-contents:focus:after{box-shadow:none}.block-editor-list-view-leaf.has-single-cell .block-editor-list-view-block-contents:focus:after{left:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);z-index:1}.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block__menu:focus{box-shadow:none}.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents{opacity:1;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-block-icon{align-self:flex-start;margin-left:8px;width:24px}.block-editor-list-view-leaf .block-editor-list-view-block__contents-cell,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{padding-top:0;padding-bottom:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{line-height:0;width:36px;vertical-align:middle}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell>*{opacity:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover{position:relative;z-index:1}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover>*{opacity:1;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover>*{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell .components-button.has-icon{width:24px;min-width:24px;padding:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell{padding-left:5px}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon{height:24px}.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell-alignment-wrapper{display:flex;height:100%;flex-direction:column;align-items:center}.block-editor-list-view-leaf .block-editor-block-mover-button{position:relative;width:36px;height:24px}.block-editor-list-view-leaf .block-editor-block-mover-button svg{position:relative;height:24px}.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button{margin-top:-6px;align-items:flex-end}.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button svg{bottom:-4px}.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button{margin-bottom:-6px;align-items:flex-start}.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button svg{top:-4px}.block-editor-list-view-leaf .block-editor-block-mover-button:focus,.block-editor-list-view-leaf .block-editor-block-mover-button:focus:enabled{box-shadow:none;outline:none}.block-editor-list-view-leaf .block-editor-block-mover-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.block-editor-list-view-leaf .block-editor-block-mover-button:before{content:"";position:absolute;display:block;border-radius:2px;height:16px;min-width:100%;right:0;left:0;animation:components-button__appear-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-block-mover-button:before{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-inserter__toggle{background:#1e1e1e;color:#fff;height:24px;margin:6px 1px 6px 6px;min-width:24px}.block-editor-list-view-leaf .block-editor-inserter__toggle:active{color:#fff}.block-editor-list-view-leaf .block-editor-list-view-block-select-button__anchor{background:rgba(0,0,0,.1);border-radius:2px;display:inline-block;padding:2px 6px;margin:0 8px;max-width:120px;overflow:hidden;text-overflow:ellipsis}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-select-button__anchor{background:rgba(0,0,0,.3)}.block-editor-list-view-leaf .block-editor-list-view-block-select-button__lock{line-height:0;width:24px;min-width:24px;margin-right:auto;padding:0;vertical-align:middle}.block-editor-list-view-appender__description,.block-editor-list-view-block-select-button__description{display:none}.block-editor-list-view-appender__cell .block-editor-list-view-appender__container,.block-editor-list-view-appender__cell .block-editor-list-view-block__contents-container,.block-editor-list-view-block__contents-cell .block-editor-list-view-appender__container,.block-editor-list-view-block__contents-cell .block-editor-list-view-block__contents-container{display:flex}.block-editor-list-view__expander{height:24px;margin-right:4px;width:24px}.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander{margin-right:220px}.block-editor-list-view-leaf:not([aria-level="1"]) .block-editor-list-view__expander{margin-left:4px}.block-editor-list-view-leaf[aria-level="1"] .block-editor-list-view__expander{margin-right:0}.block-editor-list-view-leaf[aria-level="2"] .block-editor-list-view__expander{margin-right:24px}.block-editor-list-view-leaf[aria-level="3"] .block-editor-list-view__expander{margin-right:52px}.block-editor-list-view-leaf[aria-level="4"] .block-editor-list-view__expander{margin-right:80px}.block-editor-list-view-leaf[aria-level="5"] .block-editor-list-view__expander{margin-right:108px}.block-editor-list-view-leaf[aria-level="6"] .block-editor-list-view__expander{margin-right:136px}.block-editor-list-view-leaf[aria-level="7"] .block-editor-list-view__expander{margin-right:164px}.block-editor-list-view-leaf[aria-level="8"] .block-editor-list-view__expander{margin-right:192px}.block-editor-list-view-leaf .block-editor-list-view__expander{visibility:hidden}.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg{visibility:visible;transition:transform .2s ease;transform:rotate(-90deg)}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg{visibility:visible;transform:rotate(0deg);transition:transform .2s ease}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-drop-indicator{pointer-events:none}.block-editor-list-view-drop-indicator .block-editor-list-view-drop-indicator__line{background:var(--wp-admin-theme-color);height:1px}.block-editor-list-view-drop-indicator:not([data-y-axis=middle][data-x-axis=right])>.components-popover__content{margin-right:0;border:none;box-shadow:none}.block-editor-list-view-placeholder{padding:0;margin:0;height:36px}.modal-open .block-editor-media-replace-flow__options{display:none}.block-editor-media-replace-flow__indicator{margin-right:4px}.block-editor-media-flow__url-input{border-top:1px solid #1e1e1e;margin-top:8px;margin-left:-8px;margin-right:-8px;padding:16px}.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label{display:block;top:16px;margin-bottom:8px}.block-editor-media-flow__url-input .block-editor-link-control{width:220px}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input{padding:0}.block-editor-media-flow__url-input .block-editor-link-control .components-base-control .components-base-control__field{margin-bottom:0}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title{max-width:180px;white-space:nowrap}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info{white-space:nowrap}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current{width:auto;padding:0}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-input.block-editor-link-control__search-input input[type=text]{margin:0;width:100%}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-actions{top:0;left:4px}.block-editor-media-flow__error{padding:0 20px 20px;max-width:255px}.block-editor-media-flow__error .components-with-notices-ui{max-width:255px}.block-editor-media-flow__error .components-with-notices-ui .components-notice__content{overflow:hidden;word-wrap:break-word}.block-editor-media-flow__error .components-with-notices-ui .components-notice__dismiss{position:absolute;left:10px}.block-editor-media-placeholder__url-input-container .block-editor-media-placeholder__button{margin-bottom:0}.block-editor-media-placeholder__url-input-form{display:flex}.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field{width:100%;min-width:200px;flex-grow:1;border:none;border-radius:0;margin:2px}@media (min-width:600px){.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field{width:300px}}.block-editor-media-placeholder__url-input-submit-button{flex-shrink:1}.block-editor-media-placeholder__button{margin-bottom:.5rem}.block-editor-media-placeholder__cancel-button.is-link{margin:1em;display:block}.block-editor-media-placeholder.is-appender{min-height:0}.block-editor-media-placeholder.is-appender:hover{cursor:pointer;box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-multi-selection-inspector__card{display:flex;align-items:flex-start;padding:16px}.block-editor-multi-selection-inspector__card-content{flex-grow:1}.block-editor-multi-selection-inspector__card-title{font-weight:500;margin-bottom:5px}.block-editor-multi-selection-inspector__card-description{font-size:13px}.block-editor-multi-selection-inspector__card .block-editor-block-icon{margin-right:-2px;margin-left:10px;padding:0 3px;width:36px;height:24px}.block-editor-plain-text{box-shadow:none;font-family:inherit;font-size:inherit;color:inherit;line-height:inherit;border:none;padding:0;margin:0;width:100%}.block-editor-responsive-block-control{margin-bottom:28px;border-bottom:1px solid #ccc;padding-bottom:14px}.block-editor-responsive-block-control:last-child{padding-bottom:0;border-bottom:0}.block-editor-responsive-block-control__title{margin:0 -3px .6em 0}.block-editor-responsive-block-control__label{font-weight:600;margin-bottom:.6em;margin-right:-3px}.block-editor-responsive-block-control__inner{margin-right:-1px}.block-editor-responsive-block-control__toggle{margin-right:1px}.block-editor-responsive-block-control .components-base-control__help{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.rich-text [data-rich-text-placeholder]{pointer-events:none}.rich-text [data-rich-text-placeholder]:after{content:attr(data-rich-text-placeholder);opacity:.62}.rich-text:focus{outline:none}.rich-text:focus [data-rich-text-format-boundary]{border-radius:2px}.block-editor-rich-text__editable>p:first-child{margin-top:0}figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]:before{opacity:.8}.components-popover.block-editor-rich-text__inline-format-toolbar{z-index:99998}.components-popover.block-editor-rich-text__inline-format-toolbar .components-popover__content{width:auto;min-width:auto;margin-bottom:8px;box-shadow:none;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar,.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group{border:none}.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle,.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control{min-width:48px;min-height:48px;padding-right:12px;padding-left:12px}.block-editor-rich-text__inline-format-toolbar-group .components-dropdown-menu__toggle{justify-content:center}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon{width:auto}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon svg{display:none}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon:after{content:attr(aria-label)}[data-rich-text-script]{display:inline}[data-rich-text-script]:before{content:"";background:#ff0}.block-editor-skip-to-selected-block{position:absolute;top:-9999em}.block-editor-skip-to-selected-block:focus{height:auto;width:auto;display:block;font-size:14px;font-weight:600;padding:15px 23px 14px;background:#f1f1f1;color:var(--wp-admin-theme-color);line-height:normal;box-shadow:0 0 2px 2px rgba(0,0,0,.6);text-decoration:none;outline:none;z-index:100000}.block-editor-text-transform-control{flex:0 0 50%}.block-editor-text-transform-control legend{margin-bottom:8px}.block-editor-text-transform-control .block-editor-text-transform-control__buttons{display:inline-flex;margin-bottom:24px}.block-editor-text-transform-control .block-editor-text-transform-control__buttons .components-button.has-icon{min-width:24px;padding:0;margin-left:4px}.block-editor-text-decoration-control{flex:0 0 50%}.block-editor-text-decoration-control legend{margin-bottom:8px}.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons{display:inline-flex;margin-bottom:24px}.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons .components-button.has-icon{min-width:24px;padding:0;margin-left:4px}.block-editor-tool-selector__help{margin:8px -8px -8px;padding:16px;border-top:1px solid #ddd;color:#757575;min-width:280px}.block-editor-block-list__block .block-editor-url-input,.block-editor-url-input,.components-popover .block-editor-url-input{flex-grow:1;position:relative;padding:1px}.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{width:100%;padding:8px 12px 8px 8px;border:none;border-radius:0;margin-right:0;margin-left:0;font-size:16px}@media (min-width:600px){.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{width:300px;font-size:13px}}.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{display:none}.block-editor-block-list__block .block-editor-url-input.is-full-width,.block-editor-block-list__block .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.block-editor-block-list__block .block-editor-url-input.is-full-width__suggestions,.block-editor-url-input.is-full-width,.block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.block-editor-url-input.is-full-width__suggestions,.components-popover .block-editor-url-input.is-full-width,.components-popover .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.components-popover .block-editor-url-input.is-full-width__suggestions{width:100%}.block-editor-block-list__block .block-editor-url-input .components-spinner,.block-editor-url-input .components-spinner,.components-popover .block-editor-url-input .components-spinner{position:absolute;left:8px 8px 8px 12px;bottom:8px 8px 8px 12px8px1;margin:0}.block-editor-url-input__input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.block-editor-url-input__input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-url-input__input[type=text]{font-size:13px;line-height:normal}}.block-editor-url-input__input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-url-input__input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-url-input__input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.block-editor-url-input__input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-url-input__suggestions{max-height:200px;transition:all .15s ease-in-out;padding:4px 0;width:302px;overflow-y:auto}@media (prefers-reduced-motion:reduce){.block-editor-url-input__suggestions{transition-duration:0s;transition-delay:0s}}.block-editor-url-input .components-spinner,.block-editor-url-input__suggestions{display:none}@media (min-width:600px){.block-editor-url-input .components-spinner,.block-editor-url-input__suggestions{display:grid}}.block-editor-url-input__suggestion{min-height:36px;height:auto;color:#757575;display:block;font-size:13px;cursor:pointer;background:#fff;width:100%;border:none;text-align:right;box-shadow:none}.block-editor-url-input__suggestion:hover{background:#ddd}.block-editor-url-input__suggestion.is-selected,.block-editor-url-input__suggestion:focus{background:var(--wp-admin-theme-color-darker-20);color:#fff;outline:none}.components-toolbar-group>.block-editor-url-input__button,.components-toolbar>.block-editor-url-input__button{position:inherit}.block-editor-url-input__button .block-editor-url-input__back{margin-left:4px;overflow:visible}.block-editor-url-input__button .block-editor-url-input__back:after{content:"";position:absolute;display:block;width:1px;height:24px;left:-1px;background:#ddd}.block-editor-url-input__button-modal{box-shadow:0 2px 6px rgba(0,0,0,.05);border:1px solid #ddd;background:#fff}.block-editor-url-input__button-modal-line{display:flex;flex-direction:row;flex-grow:1;flex-shrink:1;min-width:0;align-items:flex-start}.block-editor-url-input__button-modal-line .components-button{flex-shrink:0;width:36px;height:36px}.block-editor-url-popover__additional-controls{border-top:1px solid #ddd}.block-editor-url-popover__additional-controls>div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary)>svg{box-shadow:none}.block-editor-url-popover__additional-controls div[role=menu]>.components-button{padding-right:12px}.block-editor-url-popover__row{display:flex}.block-editor-url-popover__row>:not(.block-editor-url-popover__settings-toggle){flex-grow:1}.block-editor-url-popover .components-button.has-icon{padding:3px}.block-editor-url-popover .components-button.has-icon>svg{padding:5px;border-radius:2px;height:30px;width:30px}.block-editor-url-popover .components-button.has-icon:not(:disabled):focus{box-shadow:none}.block-editor-url-popover .components-button.has-icon:not(:disabled):focus>svg{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.block-editor-url-popover__settings-toggle{flex-shrink:0;border-radius:0;border-right:1px solid #ddd;margin-right:1px}.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon{transform:rotate(-180deg)}.block-editor-url-popover__input-container .components-base-control:last-child,.block-editor-url-popover__input-container .components-base-control:last-child .components-base-control__field{margin-bottom:0}.block-editor-url-popover__settings{display:block;padding:16px;border-top:1px solid #ddd}.block-editor-url-popover__link-editor,.block-editor-url-popover__link-viewer{display:flex}.block-editor-url-popover__link-editor .block-editor-url-input .components-base-control__field,.block-editor-url-popover__link-viewer .block-editor-url-input .components-base-control__field{margin-bottom:0}.block-editor-url-popover__link-editor .block-editor-url-input .components-spinner,.block-editor-url-popover__link-viewer .block-editor-url-input .components-spinner{bottom:8px 8px 8px 12px1}.block-editor-url-popover__link-viewer-url{margin:7px;flex-grow:1;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-url-popover__link-viewer-url.has-invalid-link{color:#cc1818}.block-editor-warning{align-items:center;display:flex;flex-wrap:wrap;padding:1em;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.block-editor-warning,.block-editor-warning .block-editor-warning__message{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.block-editor-warning .block-editor-warning__message{line-height:1.4;font-size:13px;color:#1e1e1e;margin:0}.block-editor-warning p.block-editor-warning__message.block-editor-warning__message{min-height:auto}.block-editor-warning .block-editor-warning__contents{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;align-items:baseline;width:100%}.block-editor-warning .block-editor-warning__actions{display:flex;margin-top:1em}.block-editor-warning .block-editor-warning__action{margin:0 0 0 8px}.block-editor-warning__secondary{margin:auto 8px auto 0}.components-popover.block-editor-warning__dropdown{z-index:99998}.html-anchor-control .components-external-link{display:block;margin-top:8px}.block-editor-hooks__layout-controls{display:flex;margin-bottom:16px}.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit{display:flex;margin-left:24px}.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit svg{margin:auto 8px 4px 0}.block-editor-hooks__layout-controls-reset{display:flex;justify-content:flex-end;margin-bottom:24px}.block-editor-hooks__layout-controls-helptext{font-size:12px}.block-editor-hooks__flex-layout-justification-controls,.block-editor-hooks__flex-layout-orientation-controls{margin-bottom:12px}.block-editor-hooks__flex-layout-justification-controls legend,.block-editor-hooks__flex-layout-orientation-controls legend{margin-bottom:8px}.border-block-support-panel .single-column,.dimensions-block-support-panel .single-column{grid-column:span 1}.typography-block-support-panel .block-editor-text-decoration-control__buttons,.typography-block-support-panel .block-editor-text-transform-control__buttons,.typography-block-support-panel .components-font-appearance-control,.typography-block-support-panel .components-font-size-picker__controls{margin-bottom:0}.typography-block-support-panel .single-column{grid-column:span 1}.color-block-support-panel .block-editor-contrast-checker{order:9999;grid-column:span 2;margin-top:16px}.color-block-support-panel .block-editor-contrast-checker .components-notice__content{margin-left:0}.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper{row-gap:0}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item{padding:0;border-right:1px solid rgba(0,0,0,.1);border-left:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(0,0,0,.1)}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first{border-top-right-radius:2px;border-top-left-radius:2px;border-top:1px solid rgba(0,0,0,.1)}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.last{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item>div,.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item>div>button{border-radius:inherit}.color-block-support-panel .block-editor-panel-color-gradient-settings__color-indicator{background:linear-gradient(45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.color-block-support-panel .block-editor-tools-panel-color-dropdown{display:block;padding:0}.color-block-support-panel .block-editor-tools-panel-color-dropdown>button{height:46px}.color-block-support-panel .block-editor-tools-panel-color-dropdown>button.is-open{background:#f0f0f0;color:var(--wp-admin-theme-color)}.color-block-support-panel .color-block-support-panel__item-group>div{grid-column:span 2;border-radius:inherit}.block-editor-block-toolbar{display:flex;flex-grow:1;width:100%;position:relative;overflow-y:hidden;overflow-x:auto;transition:border-color .1s linear,box-shadow .1s linear}@media (prefers-reduced-motion:reduce){.block-editor-block-toolbar{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-block-toolbar{overflow:inherit}}.block-editor-block-toolbar .components-toolbar,.block-editor-block-toolbar .components-toolbar-group{background:none;line-height:0;margin-top:-1px;margin-bottom:-1px;border:0;border-left:1px solid #ddd}.block-editor-block-toolbar>:last-child,.block-editor-block-toolbar>:last-child .components-toolbar,.block-editor-block-toolbar>:last-child .components-toolbar-group{border-left:none}.block-editor-block-contextual-toolbar.has-parent:not(.is-fixed){margin-right:56px}.show-icon-labels .block-editor-block-contextual-toolbar.has-parent:not(.is-fixed){margin-right:0}.block-editor-block-parent-selector{position:absolute;top:-1px;right:-57px}.show-icon-labels .block-editor-block-parent-selector{position:relative;right:auto;top:auto;margin-top:-1px;margin-right:-1px;margin-bottom:-1px}.block-editor-block-toolbar__block-controls{height:auto!important;padding:0!important;margin-right:-1px}.block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,.block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{width:24px!important;margin:0!important}.block-editor-block-toolbar__block-controls .block-editor-block-mover{margin-right:-6px}.block-editor-block-toolbar__block-controls .block-editor-block-lock-toolbar{margin-right:-6px!important}.block-editor-block-toolbar__block-controls .components-toolbar-group{padding:0}.block-editor-block-toolbar .components-toolbar,.block-editor-block-toolbar .components-toolbar-group,.block-editor-rich-text__inline-format-toolbar-group .components-toolbar,.block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group{display:flex;flex-wrap:nowrap}.block-editor-block-toolbar__slot{display:inline-block;line-height:0}@supports (position:sticky){.block-editor-block-toolbar__slot{display:inline-flex}}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon{width:auto}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon svg{display:none}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon:after{content:attr(aria-label);font-size:12px}.show-icon-labels .components-accessible-toolbar .components-toolbar-group>div:first-child:last-child>.components-button.has-icon{padding-right:6px;padding-left:6px}.show-icon-labels .block-editor-block-switcher{border-left:1px solid #1e1e1e}.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle{margin-right:0}.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,.show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{width:0!important;height:0!important}.show-icon-labels .block-editor-block-parent-selector__button .block-editor-block-icon{width:0}.show-icon-labels .block-editor-block-toolbar__block-controls .block-editor-block-mover{margin-right:0;white-space:nowrap}.show-icon-labels .block-editor-block-mover-button{padding-right:8px!important;padding-left:8px!important}.show-icon-labels .block-editor-block-mover__drag-handle.has-icon{padding-right:6px!important;padding-left:6px!important;border-left:1px solid #1e1e1e}@media (min-width:600px){.show-icon-labels .is-up-button.is-up-button.is-up-button{border-bottom:1px solid #1e1e1e;margin-left:0;border-radius:0}}.show-icon-labels .block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button{width:auto}.show-icon-labels .components-toolbar,.show-icon-labels .components-toolbar-group{flex-shrink:1}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button+.components-button{margin-right:6px}.block-editor-inserter{display:inline-block;background:none;border:none;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:0}@media (min-width:782px){.block-editor-inserter{position:relative}}.block-editor-inserter__content{position:relative}.block-editor-inserter__popover.is-quick .components-popover__content{border:none}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>*{border-right:1px solid #ccc;border-left:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>:first-child{border-top:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>:last-child{border-bottom:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>.components-button{border:1px solid #1e1e1e}.block-editor-inserter__popover .block-editor-inserter__menu{margin:-12px}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__tabs .components-tab-panel__tabs{top:60px}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__main-area{overflow:visible;height:auto}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__preview-container{display:none}.block-editor-inserter__toggle.components-button{display:inline-flex;align-items:center;cursor:pointer;border:none;outline:none;padding:0;transition:color .2s ease}@media (prefers-reduced-motion:reduce){.block-editor-inserter__toggle.components-button{transition-duration:0s;transition-delay:0s}}.block-editor-inserter__menu{height:100%;position:relative;overflow:visible}.block-editor-inserter__main-area{width:auto;overflow-y:auto;height:100%}@media (min-width:782px){.block-editor-inserter__main-area{width:350px}}.block-editor-inserter__inline-elements{margin-top:-1px}.block-editor-inserter__menu.is-bottom:after{border-bottom-color:#fff}.components-popover.block-editor-inserter__popover{z-index:99999}.block-editor-inserter__search{background:#fff;padding:16px 16px 0;position:sticky;top:0;z-index:1}.block-editor-inserter__search .components-search-control__icon{left:20px}.block-editor-inserter__search .components-base-control__field{margin-bottom:0}.block-editor-inserter__tabs{display:flex;flex-direction:column}.block-editor-inserter__tabs .components-tab-panel__tabs{position:sticky;top:64px;background:#fff;z-index:1;border-bottom:1px solid #ddd}.block-editor-inserter__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{flex-grow:1;margin-bottom:-1px}.block-editor-inserter__tabs .components-tab-panel__tab-content{display:flex;flex-grow:1;flex-direction:column;position:relative;z-index:0}.block-editor-inserter__panel-header{display:inline-flex;align-items:center;padding:16px 16px 0}.block-editor-inserter__panel-header-patterns{padding:16px 16px 0}.block-editor-inserter__panel-content{padding:16px}.block-editor-inserter__panel-title,.block-editor-inserter__panel-title button{margin:0 0 0 12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input{height:36px;line-height:36px}.block-editor-inserter__panel-dropdown select{border:none}.block-editor-inserter__block-list{flex-grow:1;position:relative}.block-editor-inserter__reusable-blocks-panel{position:relative;text-align:left}.block-editor-inserter__manage-reusable-blocks{display:inline-block;margin:16px}.block-editor-inserter__no-results{padding:32px;text-align:center}.block-editor-inserter__no-results-icon{fill:#949494}.block-editor-inserter__child-blocks{padding:0 16px}.block-editor-inserter__parent-block-header{display:flex;align-items:center}.block-editor-inserter__parent-block-header h2{font-size:13px}.block-editor-inserter__parent-block-header .block-editor-block-icon{margin-left:8px}.block-editor-inserter__preview-container{display:none;width:300px;background:#fff;border-radius:2px;border:1px solid #ddd;position:absolute;top:16px;right:calc(100% + 16px);max-height:calc(100% - 32px);overflow-y:hidden}@media (min-width:782px){.block-editor-inserter__preview-container{display:block}}.block-editor-inserter__preview-container .block-editor-block-card{padding:16px}.block-editor-inserter__preview-container .block-editor-block-card__title{font-size:13px}.block-editor-inserter__preview-content{min-height:144px;background:#f0f0f0;display:grid;flex-grow:1;align-items:center}.block-editor-inserter__preview-content-missing{flex:1;display:flex;justify-content:center;align-items:center;min-height:144px;color:#757575;background:#f0f0f0}.block-editor-inserter__tips{border-top:1px solid #ddd;padding:16px;flex-shrink:0;position:relative}.block-editor-inserter__manage-reusable-blocks-container{padding:16px}.block-editor-inserter__quick-inserter{width:100%;max-width:100%}@media (min-width:782px){.block-editor-inserter__quick-inserter{width:350px}}.block-editor-inserter__quick-inserter-results .block-editor-inserter__panel-header{height:0;padding:0;float:right}.block-editor-inserter__quick-inserter.has-expand .block-editor-inserter__panel-content,.block-editor-inserter__quick-inserter.has-search .block-editor-inserter__panel-content{padding:16px}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr;grid-gap:8px}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-preview__container{min-height:100px}.block-editor-inserter__quick-inserter-separator{border-top:1px solid #ddd}.block-editor-inserter__popover.is-quick>.components-popover__content>div{padding:0}.block-editor-inserter__quick-inserter-expand.components-button{display:block;background:#1e1e1e;color:#fff;width:100%;height:44px;border-radius:0}.block-editor-inserter__quick-inserter-expand.components-button:hover{color:#fff}.block-editor-inserter__quick-inserter-expand.components-button:active{color:#ccc}.block-editor-inserter__quick-inserter-expand.components-button.components-button:focus:not(:disabled){box-shadow:none;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.block-editor-block-patterns-explorer__sidebar{position:absolute;top:60px;right:0;bottom:0;width:280px;padding:24px 32px 32px;overflow-x:visible;overflow-y:scroll}.block-editor-block-patterns-explorer__sidebar__categories-list__item{display:block;width:100%;height:48px;text-align:right}.block-editor-block-patterns-explorer__search{margin-bottom:32px}.block-editor-block-patterns-explorer__search-results-count{padding-bottom:32px}.block-editor-block-patterns-explorer__list{margin-right:248px}.block-editor-block-patterns-explorer .block-editor-block-patterns-list{display:grid;grid-gap:32px;grid-template-columns:repeat(1,1fr)}@media (min-width:1080px){.block-editor-block-patterns-explorer .block-editor-block-patterns-list{grid-template-columns:repeat(2,1fr)}}@media (min-width:1440px){.block-editor-block-patterns-explorer .block-editor-block-patterns-list{grid-template-columns:repeat(3,1fr)}}.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{min-height:240px}.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-preview__container{height:inherit;min-height:100px;max-height:800px}.block-editor-post-preview__dropdown{padding:0}.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize{padding-right:40px}.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize.has-icon{padding-right:8px}.block-editor-post-preview__dropdown-content .components-popover__content{overflow-y:visible}.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:first-child{padding-bottom:8px}.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:last-child{margin-bottom:0}.block-editor-post-preview__dropdown-content .components-menu-group+.components-menu-group{padding:8px}@media (min-width:600px){.edit-post-header__settings .editor-post-preview,.edit-site-header__actions .editor-post-preview{display:none}}@media (min-width:600px){.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state{transition:opacity .1s linear}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-saved-state{opacity:0}.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle.is-opened{opacity:1}}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.block-editor-autocompleters__block{white-space:nowrap}.block-editor-autocompleters__block .block-editor-block-icon{margin-right:8px}.block-editor-autocompleters__link{white-space:nowrap}.block-editor-autocompleters__link .block-editor-block-icon{margin-right:8px}.block-editor-block-alignment-control__menu-group .components-menu-item__info{margin-top:0}.block-editor-block-alignment-matrix-control__popover .components-popover__content{min-width:0;width:auto}.block-editor-block-alignment-matrix-control__popover .components-popover__content>div{padding:8px}.block-editor-block-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px}.block-editor-block-icon.has-colors svg{fill:currentColor}@media (forced-colors:active){.block-editor-block-icon.has-colors svg{fill:CanvasText}}.block-editor-block-icon svg{min-width:20px;min-height:20px;max-width:24px;max-height:24px}.block-editor-block-inspector p{margin-top:0}.block-editor-block-inspector h2,.block-editor-block-inspector h3{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.block-editor-block-inspector .components-base-control{margin-bottom:24px}.block-editor-block-inspector .components-base-control:last-child{margin-bottom:8px}.block-editor-block-inspector .components-panel__body{border:none;border-top:1px solid #e0e0e0}.block-editor-block-inspector .block-editor-block-card{padding:16px}.block-editor-block-inspector__no-blocks{display:block;font-size:13px;background:#fff;padding:32px 16px;text-align:center}.block-editor-block-styles .block-editor-block-list__block{margin:0}.block-editor-block-list__layout{position:relative}.block-editor-block-list__layout.is-navigate-mode{cursor:default}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after,.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected:after,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]):after,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:after,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{position:absolute;z-index:1;pointer-events:none;content:"";top:1px;bottom:1px;left:1px;right:1px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:1px;outline:2px solid transparent}.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after,.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected:after,.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]):after,.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:after,.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{box-shadow:0 0 0 1px #fff}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted .components-placeholder ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted~.is-multi-selected .components-placeholder ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]) .components-placeholder ::selection,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered .components-placeholder ::selection,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected .components-placeholder ::selection{background:transparent}.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:not(.is-selected):after{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:1px solid transparent}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.has-child-selected,.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected:before{content:"";position:absolute;z-index:0;pointer-events:none;transition:border-color .1s linear,border-style .1s linear,box-shadow .1s linear;right:0;left:0;top:-14px;border-radius:2px;border-top:4px solid #ccc}.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected:after{content:none}.block-editor-block-list__layout .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected:before{border-color:var(--wp-admin-theme-color)}.is-block-moving-mode.block-editor-block-list__block-selection-button{opacity:0;font-size:1px;height:1px;padding:0}.block-editor-block-list__layout .block-editor-block-list__block{position:relative;overflow-wrap:break-word}.block-editor-block-list__layout .block-editor-block-list__block .reusable-block-edit-panel *{z-index:1}.block-editor-block-list__layout .block-editor-block-list__block .components-placeholder .components-with-notices-ui{margin:-10px 0 12px}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui{margin:0 0 12px;width:100%}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice{margin-left:0;margin-right:0}.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice .components-notice__content{font-size:13px}.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus{outline:none}.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus:after{position:absolute;z-index:1;pointer-events:none;content:"";top:1px;bottom:1px;left:1px;right:1px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:1px;outline:2px solid transparent}.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #fff}.block-editor-block-list__layout .block-editor-block-list__block:after{content:"";pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:2px;box-shadow:0 0 0 var(--wp-admin-border-width-focus) transparent}.block-editor-block-list__layout .block-editor-block-list__block.has-warning{min-height:48px}.block-editor-block-list__layout .block-editor-block-list__block.has-warning>*{pointer-events:none;-webkit-user-select:none;user-select:none}.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning{pointer-events:all}.block-editor-block-list__layout .block-editor-block-list__block.has-warning:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:2px;background-color:hsla(0,0%,100%,.4)}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected:after{background-color:transparent}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable>.block-editor-inner-blocks>.block-editor-block-list__layout.has-overlay:after{display:none}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable>.block-editor-inner-blocks>.block-editor-block-list__layout.has-overlay .block-editor-block-list__layout.has-overlay:after{display:block}.block-editor-block-list__layout .block-editor-block-list__block.is-reusable.has-child-selected:after{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true]{float:none}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered{cursor:default}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered:after{top:1px;left:1px;right:1px;bottom:1px;box-shadow:0 0 0 1px var(--wp-admin-theme-color);border-radius:1px}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected{cursor:unset}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);top:1px;left:1px;right:1px;bottom:1px;border-radius:1px}.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:focus:after{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.is-focus-mode .block-editor-block-list__block:not(.has-child-selected){opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.is-focus-mode .block-editor-block-list__block:not(.has-child-selected){transition-duration:0s;transition-delay:0s}}.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) .block-editor-block-list__block,.is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-multi-selected,.is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-selected{opacity:1}.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity{opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity{transition-duration:0s;transition-delay:0s}}.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block,.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block{opacity:1}.wp-block.alignleft,.wp-block.alignright,.wp-block[data-align=left]>*,.wp-block[data-align=right]>*{z-index:21}.wp-site-blocks>[data-align=left]{float:left;margin-right:2em}.wp-site-blocks>[data-align=right]{float:right;margin-left:2em}.wp-site-blocks>[data-align=center]{justify-content:center;margin-left:auto;margin-right:auto}.block-editor-block-list .block-editor-inserter{margin:8px;cursor:move;cursor:grab}@keyframes block-editor-inserter__toggle__fade-in-animation{0%{opacity:0}to{opacity:1}}.wp-block .block-list-appender .block-editor-inserter__toggle{animation:block-editor-inserter__toggle__fade-in-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.wp-block .block-list-appender .block-editor-inserter__toggle{animation-duration:1ms;animation-delay:0s}}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender{display:none}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender .block-editor-inserter__toggle{opacity:0;transform:scale(0)}.block-editor-block-list__block .block-editor-block-list__block-html-textarea{display:block;margin:0;padding:12px;width:100%;border:none;outline:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;font-size:15px;line-height:1.5;transition:padding .2s linear}@media (prefers-reduced-motion:reduce){.block-editor-block-list__block .block-editor-block-list__block-html-textarea{transition-duration:0s;transition-delay:0s}}.block-editor-block-list__block .block-editor-block-list__block-html-textarea:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-block-list__block .block-editor-warning{z-index:5;position:relative}.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning{margin-bottom:auto}.block-editor-block-list__insertion-point{position:absolute}.block-editor-block-list__insertion-point-indicator{position:absolute;background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point.is-vertical>.block-editor-block-list__insertion-point-indicator{top:50%;height:1px}.block-editor-block-list__insertion-point.is-horizontal>.block-editor-block-list__insertion-point-indicator{top:0;right:0;left:50%;width:1px}.block-editor-block-list__insertion-point-inserter{display:none;position:absolute;justify-content:center;top:calc(50% - 12px);left:calc(50% - 12px)}@media (min-width:480px){.block-editor-block-list__insertion-point-inserter{display:flex}}.block-editor-block-list__block-popover-inserter{position:absolute;top:-9999em;margin-bottom:14px}.block-editor-block-list__block-popover-inserter.is-visible{position:static}.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon,.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon{background:#1e1e1e;border-radius:2px;color:#fff;padding:0;min-width:24px;height:24px}.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon:hover{color:#fff;background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon{background:var(--wp-admin-theme-color)}.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover{background:#1e1e1e}.block-editor-block-contextual-toolbar{display:inline-flex;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar,.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar-group{border-right-color:#1e1e1e}.block-editor-block-contextual-toolbar.is-fixed{position:sticky;top:0;width:100%;z-index:31;min-height:48px;display:block;border:none;border-bottom:1px solid #e0e0e0;border-radius:0}.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar,.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group{border-right-color:#e0e0e0}.block-editor-block-contextual-toolbar .block-editor-block-mover-button{overflow:hidden}.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button{min-width:24px;width:24px}.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button svg{min-width:24px}.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button:focus:before{left:0!important;min-width:0;width:100%}@media (min-width:600px){.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-up-button svg{top:5px}.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-down-button svg{bottom:5px}}.block-editor-block-list__block-selection-button{display:inline-flex;padding:0 12px;z-index:22;border-radius:2px;background-color:#1e1e1e;font-size:13px;height:48px}.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content{margin:auto;display:inline-flex;align-items:center}.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content>.components-flex__item{margin-right:6px}.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle{cursor:grab;padding:0;height:24px;min-width:24px;margin-left:-2px}.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle svg{min-width:18px;min-height:18px}.block-editor-block-list__block-selection-button .block-editor-block-icon{font-size:13px;color:#fff;height:48px}.block-editor-block-list__block-selection-button .components-button{min-width:36px;color:#fff;height:48px;display:flex}.block-editor-block-list__block-selection-button .components-button:focus{box-shadow:none;border:none}.block-editor-block-list__block-selection-button .components-button:active{color:#fff}.block-editor-block-list__block-selection-button .block-selection-button_select-button.components-button{padding:0}.block-editor-block-list__insertion-point-popover.is-without-arrow{z-index:28;position:absolute;pointer-events:none}.block-editor-block-list__insertion-point-popover.is-without-arrow *{pointer-events:none}.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter,.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter *{pointer-events:all}.block-editor-block-list__insertion-point-popover.is-without-arrow .components-popover__content.components-popover__content{background:none;border:none;box-shadow:none;overflow-y:visible;margin-left:0}@keyframes hide-during-dragging{to{position:fixed;transform:translate(9999px,9999px)}}.components-popover.block-editor-block-list__block-popover{z-index:31;position:absolute}.components-popover.block-editor-block-list__block-popover .components-popover__content{margin:0!important;min-width:auto;width:max-content;background:none;border:none;box-shadow:none;overflow-y:visible;pointer-events:none}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__empty-block-inserter{pointer-events:all}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar,.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button{margin-top:12px;margin-bottom:12px}.components-popover.block-editor-block-list__block-popover.is-insertion-point-visible{visibility:hidden}.is-dragging-components-draggable .components-popover.block-editor-block-list__block-popover{opacity:0;animation:hide-during-dragging 1ms linear forwards}.is-dragging-components-draggable .components-tooltip{display:none}.block-editor-block-toolbar .components-toolbar-group,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot{padding-left:6px;padding-right:6px}.block-editor-block-toolbar .components-toolbar-group .components-button,.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon{min-width:36px;padding-left:6px;padding-right:6px}.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon svg,.block-editor-block-toolbar .components-toolbar-group .components-button svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button svg,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon svg,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button svg{min-width:24px}.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar-group .components-button:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-dropdown .components-button:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.block-editor-block-toolbar__slot>.components-toolbar .components-button:before,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button.has-icon.has-icon:before,.block-editor-block-toolbar>.components-toolbar>.block-editor-block-toolbar__slot .components-button:before{left:2px;right:2px}.is-vertical .block-list-appender{width:24px;margin-right:auto;margin-top:12px;margin-left:12px}.block-list-appender>.block-editor-inserter{display:block}.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) .block-editor-block-list__layout>.block-list-appender .block-list-appender__toggle{opacity:0;transform:scale(0)}.block-editor-block-lock-modal{z-index:1000001}@media (min-width:600px){.block-editor-block-lock-modal .components-modal__frame{max-width:480px}}.block-editor-block-lock-modal__checklist{margin:0}.block-editor-block-lock-modal__options-title{padding:12px 0}.block-editor-block-lock-modal__options-title .components-checkbox-control__label{font-weight:600}.block-editor-block-lock-modal__options-title .components-base-control__field{align-items:center;display:flex;margin:0}.block-editor-block-lock-modal__checklist-item{margin-bottom:0;padding:12px 0 12px 32px}.block-editor-block-lock-modal__checklist-item .components-base-control__field{align-items:center;display:flex;margin:0}.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label{display:flex;align-items:center;justify-content:space-between;flex-grow:1}.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label svg{margin-right:12px;fill:#1e1e1e}.block-editor-block-lock-modal__checklist-item:hover{background-color:#f0f0f0;border-radius:2px}.block-editor-block-lock-modal__actions{margin-top:24px}.block-editor-block-lock-toolbar .components-button.has-icon{min-width:36px!important;padding-left:0!important}.block-editor-block-lock-toolbar .components-button.has-icon:focus:before{right:8px!important}.block-editor-block-breadcrumb{list-style:none;padding:0;margin:0}.block-editor-block-breadcrumb li{display:inline-flex;margin:0}.block-editor-block-breadcrumb li .block-editor-block-breadcrumb__separator{fill:currentColor;margin-left:-4px;margin-right:-4px;transform:scaleX(1)}.block-editor-block-breadcrumb li:last-child .block-editor-block-breadcrumb__separator{display:none}.block-editor-block-breadcrumb__button.components-button{height:24px;line-height:24px;padding:0;position:relative}.block-editor-block-breadcrumb__button.components-button:hover:not(:disabled){text-decoration:underline;box-shadow:none}.block-editor-block-breadcrumb__button.components-button:focus{box-shadow:none}.block-editor-block-breadcrumb__button.components-button:focus:before{content:"";display:block;position:absolute;border-radius:2px;top:1px;right:1px;bottom:1px;left:1px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-block-breadcrumb__current{cursor:default}.block-editor-block-breadcrumb__button.components-button,.block-editor-block-breadcrumb__current{color:#1e1e1e;padding:0 8px;font-size:inherit}.block-editor-block-card{display:flex;align-items:flex-start}.block-editor-block-card__content{flex-grow:1;margin-bottom:4px}.block-editor-block-card__title{font-weight:500}.block-editor-block-card__title.block-editor-block-card__title{line-height:24px;margin:0 0 4px}.block-editor-block-card__description{font-size:13px}.block-editor-block-card .block-editor-block-icon{flex:0 0 24px;margin-left:0;margin-right:12px;width:24px;height:24px}.block-editor-block-compare{height:auto}.block-editor-block-compare__wrapper{display:flex;padding-bottom:16px}.block-editor-block-compare__wrapper>div{display:flex;justify-content:space-between;flex-direction:column;width:50%;padding:0 16px 0 0;min-width:200px;max-width:600px}.block-editor-block-compare__wrapper>div button{float:right}.block-editor-block-compare__wrapper .block-editor-block-compare__converted{border-left:1px solid #ddd;padding-left:15px;padding-right:0}.block-editor-block-compare__wrapper .block-editor-block-compare__html{font-family:Menlo,Consolas,monaco,monospace;font-size:12px;color:#1e1e1e;border-bottom:1px solid #ddd;padding-bottom:15px;line-height:1.7}.block-editor-block-compare__wrapper .block-editor-block-compare__html span{background-color:#e6ffed;padding-top:3px;padding-bottom:3px}.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__added{background-color:#acf2bd}.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__removed{background-color:#cc1818}.block-editor-block-compare__wrapper .block-editor-block-compare__preview{padding:16px 0 0}.block-editor-block-compare__wrapper .block-editor-block-compare__preview p{font-size:12px;margin-top:0}.block-editor-block-compare__wrapper .block-editor-block-compare__action{margin-top:16px}.block-editor-block-compare__wrapper .block-editor-block-compare__heading{font-size:1em;font-weight:400;margin:.67em 0}.block-editor-block-content-overlay.overlay-active:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:transparent;border:none;border-radius:2px;z-index:10}.block-editor-block-content-overlay.parent-highlighted.overlay-active:before,.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active:before{background:rgba(var(--wp-admin-theme-color--rgb),.1);box-shadow:0 0 0 1px var(--wp-admin-theme-color) inset}.block-editor-block-content-overlay.overlay-active:not(.is-dragging-blocks) *{pointer-events:none}.block-editor-block-content-overlay.is-dragging-blocks{box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-block-draggable-chip-wrapper{position:absolute;top:-24px;left:0}.block-editor-block-draggable-chip{background-color:#1e1e1e;border-radius:2px;box-shadow:0 6px 8px rgba(0,0,0,.3);color:#fff;cursor:grabbing;display:inline-flex;height:48px;padding:0 13px;-webkit-user-select:none;user-select:none}.block-editor-block-draggable-chip svg{fill:currentColor}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content{margin:auto;justify-content:flex-start}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content>.components-flex__item{margin-right:6px}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content>.components-flex__item:last-child{margin-right:0}.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content .block-editor-block-icon svg{min-width:18px;min-height:18px}.block-editor-block-draggable-chip .components-flex__item{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.block-editor-block-list__layout .is-dragging{background-color:currentColor!important;opacity:.05!important;border-radius:2px!important;pointer-events:none!important}.block-editor-block-list__layout .is-dragging::selection{background:transparent!important}.block-editor-block-list__layout .is-dragging:after{content:none!important}.block-editor-block-mobile-toolbar{display:flex;flex-direction:row;border-right:1px solid #ddd}.block-editor-block-mobile-toolbar .block-editor-block-mover-button{width:36px;height:36px;border-radius:2px;padding:3px;margin:0;justify-content:center;align-items:center}.block-editor-block-mobile-toolbar .block-editor-block-mover-button .dashicon{margin:auto}.block-editor-block-mobile-toolbar .block-editor-block-mover{display:flex;margin-right:auto}.block-editor-block-mobile-toolbar .block-editor-block-mover .block-editor-block-mover-button{float:left}.block-editor-block-mover-button__description{display:none}.block-editor-block-mover-button.has-icon{padding:0}.block-editor-block-mover{display:inline-flex;flex-direction:row}.block-editor-block-mover .block-editor-block-mover__move-button-container,.block-editor-block-mover .components-toolbar{flex:1;flex-direction:row;border-right:none!important;padding:0}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover__move-button-container,.block-editor-block-mover .components-toolbar{flex-direction:column}}.block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container,.block-editor-block-mover.is-horizontal .components-toolbar{flex-direction:row}.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button{padding-right:0;padding-left:0;min-width:36px}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover-button{height:24px;width:42px;padding-right:11px!important;padding-left:6px!important}.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button{min-width:42px}}@media (min-width:600px){.block-editor-block-mover .block-editor-block-mover-button:before{left:8px!important;right:8px!important}}.block-editor-block-mover .block-editor-block-mover__drag-handle{width:24px;cursor:grab;min-width:24px!important;padding:0!important}.block-editor-block-mover .block-editor-block-mover__drag-handle:focus:before{left:0!important;right:0!important}@media (min-width:600px){.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button{margin:0 auto 0 0}.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-up-button:before,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-up-button:before{bottom:0;height:calc(100% - 1px)}.block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-down-button:before,.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-down-button:before{top:0;height:calc(100% - 1px)}}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon{height:48px;width:24px;padding-left:0;padding-right:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon:before{top:1px;bottom:1px;min-width:0;width:auto;height:auto}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon svg{margin-left:0;margin-right:-8px;margin-bottom:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon:before{left:0!important;right:0!important}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon svg{margin-left:-8px;margin-right:0;margin-top:0}.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon:before{left:0!important;right:0!important;width:calc(100% + 1px)}.block-editor-block-navigation__container{min-width:280px}.block-editor-block-navigation__label{margin:0 0 12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-block-parent-selector{background:#fff;border-radius:2px}.block-editor-block-parent-selector .block-editor-block-parent-selector__button{width:48px;height:48px;border:1px solid #1e1e1e;border-radius:2px}.block-editor-block-patterns-list__list-item{cursor:pointer;margin-bottom:24px}.block-editor-block-patterns-list__list-item.is-placeholder{min-height:100px}.block-editor-block-patterns-list__list-item[draggable=true] .block-editor-block-preview__container{cursor:grab}.block-editor-block-patterns-list__item{height:100%}.block-editor-block-patterns-list__item .block-editor-block-preview__container{display:flex;align-items:center;overflow:hidden;border-radius:2px;border:1px solid #f0f0f0}.block-editor-block-patterns-list__item .block-editor-block-patterns-list__item-title{padding-top:8px;font-size:12px;text-align:center}.block-editor-block-patterns-list__item:hover .block-editor-block-preview__container{border:1px solid var(--wp-admin-theme-color)}.block-editor-block-patterns-list__item:focus .block-editor-block-preview__container{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-patterns-list__item:focus .block-editor-block-patterns-list__item-title,.block-editor-block-patterns-list__item:hover .block-editor-block-patterns-list__item-title{color:var(--wp-admin-theme-color)}.block-editor-block-preview__container{position:relative;width:100%;overflow:hidden}.block-editor-block-preview__container .block-editor-block-preview__content{top:0;left:0;transform-origin:top left;text-align:initial;margin:0;overflow:visible;min-height:auto}.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-drop-zone,.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-list__insertion-point,.block-editor-block-preview__container .block-editor-block-preview__content .block-list-appender,.block-editor-block-preview__container .block-editor-block-preview__content .reusable-block-indicator,.block-editor-block-preview__content-iframe .block-list-appender{display:none}.block-editor-block-preview__live-content *{pointer-events:none}.block-editor-block-preview__live-content .block-list-appender{display:none}.block-editor-block-preview__live-content .components-button:disabled{opacity:1}.block-editor-block-preview__live-content .block-editor-block-list__block[data-empty=true],.block-editor-block-preview__live-content .components-placeholder{display:none}.block-editor-block-settings-menu__popover .components-dropdown-menu__menu{padding:0}.block-editor-block-styles+.default-style-picker__default-switcher{margin-top:16px}.block-editor-block-styles__preview-panel{display:none;position:absolute;right:16px;left:auto;z-index:90}@media (min-width:782px){.block-editor-block-styles__preview-panel{display:block}}.block-editor-block-styles__preview-panel .block-editor-inserter__preview-container{left:auto;right:auto;top:auto;position:static}.block-editor-block-styles__preview-panel .block-editor-block-card__title.block-editor-block-card__title{margin:0}.block-editor-block-styles__preview-panel .block-editor-block-icon{display:none}.block-editor-block-styles__variants{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px}.block-editor-block-styles__variants .block-editor-block-styles__item{color:#2f2f2f;box-shadow:inset 0 0 0 1px #ccc;display:inline-block;width:calc(50% - 4px)}.block-editor-block-styles__variants .block-editor-block-styles__item:focus,.block-editor-block-styles__variants .block-editor-block-styles__item:hover{color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 2px var(--wp-admin-theme-color)}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active,.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover{background-color:#2f2f2f;box-shadow:none}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text,.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text{color:#fff}.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus{box-shadow:inset 0 0 0 1px #fff,0 0 0 2px var(--wp-admin-theme-color)}.block-editor-block-styles__block-preview-container,.block-editor-block-styles__block-preview-container *{box-sizing:border-box!important}.block-editor-block-switcher{position:relative;padding:0 6px}.block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon{min-width:36px}.block-editor-block-switcher__no-switcher-icon,.block-editor-block-switcher__toggle{position:relative}.components-button.block-editor-block-switcher__no-switcher-icon,.components-button.block-editor-block-switcher__toggle{margin:0;display:block;height:48px}.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,.components-button.block-editor-block-switcher__toggle .block-editor-block-icon{margin:auto}.block-editor-block-switcher__toggle-text{margin-left:8px}.show-icon-labels .block-editor-block-switcher__toggle-text{display:none}.show-icon-labels .block-editor-block-toolbar .block-editor-block-switcher .components-button.has-icon:after{font-size:14px}.block-editor-block-switcher__popover{margin-left:6px}.components-button.block-editor-block-switcher__no-switcher-icon{display:flex;padding:6px 12px!important}.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{margin-right:auto;margin-left:auto;min-width:24px!important}.components-button.block-editor-block-switcher__no-switcher-icon:disabled{opacity:1}.components-button.block-editor-block-switcher__no-switcher-icon:disabled,.components-button.block-editor-block-switcher__no-switcher-icon:disabled .block-editor-block-icon.has-colors{color:#1e1e1e}.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon{height:100%;position:relative;margin:0 auto;display:flex;align-items:center;min-width:100%}.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon:before,.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon:before{top:8px;right:8px;bottom:8px;left:8px}.components-popover.block-editor-block-switcher__popover .components-popover__content{min-width:300px}.components-popover.block-editor-block-switcher__popover .components-popover__content>div{min-width:auto;display:flex;background:#fff;padding:0}.components-popover.block-editor-block-switcher__popover .components-popover__content>div .components-menu-group{margin:0}.block-editor-block-switcher__popover .components-popover__content .block-editor-block-styles{margin:0 -3px}.block-editor-block-switcher__popover .components-popover__content .components-panel__body{border:0;position:relative;z-index:1}.block-editor-block-switcher__popover .components-popover__content .components-panel__body+.components-panel__body{border-top:1px solid #e0e0e0}.block-editor-block-switcher__popover__preview__parent .block-editor-block-switcher__popover__preview__container{position:absolute;top:-12px;left:calc(100% + 32px)}.block-editor-block-switcher__preview__popover{display:none}.block-editor-block-switcher__preview__popover.components-popover{margin-left:4px;margin-top:11px}@media (min-width:782px){.block-editor-block-switcher__preview__popover{display:block}}.block-editor-block-switcher__preview__popover .components-popover__content{box-shadow:none;border:1px solid #1e1e1e;background:#fff;border-radius:2px}.block-editor-block-switcher__preview__popover .block-editor-block-switcher__preview{width:300px;height:auto;max-height:500px;padding:16px}.block-editor-block-switcher__preview-title{margin-bottom:12px;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon{min-width:36px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle{height:48px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform{width:48px;height:48px}.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform{padding:12px}.block-editor-block-switcher__preview-patterns-container{padding-bottom:16px}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item{margin-top:16px}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-preview__container{cursor:pointer}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item{height:100%;border-radius:2px;transition:all .05s ease-in-out;position:relative;border:1px solid transparent}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:focus,.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item .block-editor-block-switcher__preview-patterns-container-list__item-title{padding:4px;font-size:12px;text-align:center;cursor:pointer}.block-editor-block-types-list>[role=presentation]{overflow:hidden;display:flex;flex-wrap:wrap}.block-editor-block-variation-picker .components-placeholder__instructions{margin-bottom:0}.block-editor-block-variation-picker .components-placeholder__fieldset{flex-direction:column}.block-editor-block-variation-picker.has-many-variations .components-placeholder__fieldset{max-width:90%}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations{display:flex;justify-content:flex-start;flex-direction:row;flex-wrap:wrap;width:100%;margin:16px 0;padding:0;list-style:none}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations>li{list-style:none;margin:8px 20px 0 0;flex-shrink:1;width:75px;text-align:center}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations>li button{display:inline-flex;margin-right:0}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation{padding:8px}.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation-label{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:12px;display:block;line-height:1.4}.block-editor-block-variation-picker__variation{width:100%}.block-editor-block-variation-picker__variation.components-button.has-icon{justify-content:center;width:auto}.block-editor-block-variation-picker__variation.components-button.has-icon.is-secondary{background-color:#fff}.block-editor-block-variation-picker__variation.components-button{height:auto;padding:0}.block-editor-block-variation-picker__variation:before{content:"";padding-bottom:100%}.block-editor-block-variation-picker__variation:first-child{margin-left:0}.block-editor-block-variation-picker__variation:last-child{margin-right:0}.block-editor-block-pattern-setup{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;width:100%;border-radius:2px}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar{justify-content:center}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container{column-gap:24px;display:block;width:100%;padding:32px;column-count:2}@media (min-width:1440px){.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container{column-count:3}}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container,.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button]{cursor:pointer}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item{break-inside:avoid-column;margin-bottom:24px}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container{min-height:100px;border-radius:2px;border:1px solid #ddd}.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content{width:100%}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar{height:60px;box-sizing:border-box;padding:16px;width:100%;text-align:left;margin:0;color:#1e1e1e;border-radius:2px 2px 0 0;background-color:#fff;display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-top:1px solid #ddd;align-self:flex-end}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls{display:flex}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions,.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__navigation{width:calc(50% - 36px);display:flex}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions{justify-content:flex-end}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container{display:flex;flex-direction:column;width:100%;box-sizing:border-box}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container{overflow:hidden;position:relative;padding:0;margin:0;list-style:none;transform-style:preserve-3d}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container *{box-sizing:border-box}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide{position:absolute;top:0;width:100%;margin:auto;padding:0;transition:transform .5s,z-index .5s;z-index:100}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide{opacity:1;position:relative;z-index:102}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.previous-slide{transform:translateX(-100%);z-index:101}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.next-slide{transform:translateX(100%);z-index:101}.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .block-list-appender{display:none}.block-editor-block-pattern-setup__carousel,.block-editor-block-pattern-setup__grid{width:100%;overflow-y:auto}.block-editor-block-variation-transforms{padding:0 16px 16px 52px;width:100%}.block-editor-block-variation-transforms .components-dropdown-menu__toggle{border:1px solid #757575;border-radius:2px;min-height:30px;width:100%;position:relative;text-align:left;justify-content:left;padding:6px 12px}.block-editor-block-variation-transforms .components-dropdown-menu__toggle.components-dropdown-menu__toggle{padding-right:24px}.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled){border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color)}.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg{height:100%;padding:0;position:absolute;right:0;top:0}.block-editor-block-variation-transforms__popover .components-popover__content{min-width:230px}.components-border-radius-control{margin-bottom:12px}.components-border-radius-control legend{margin-bottom:8px}.components-border-radius-control .components-border-radius-control__wrapper{display:flex;justify-content:space-between;align-items:flex-start}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control,.components-border-radius-control .components-border-radius-control__wrapper>.components-unit-control-wrapper{width:calc(50% - 26px);margin-bottom:0}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-base-control__field{margin-bottom:0;height:30px}.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-range-control__wrapper{margin-right:10px}.components-border-radius-control .components-border-radius-control__wrapper>span{flex:0 0 auto}.components-border-radius-control .components-border-radius-control__input-controls-wrapper{display:flex;width:70%;flex-wrap:wrap}.components-border-radius-control .components-border-radius-control__input-controls-wrapper .components-unit-control-wrapper{width:calc(50% - 8px);margin-bottom:8px;margin-right:8px}.components-border-radius-control .component-border-radius-control__linked-button.has-icon{display:flex;justify-content:center}.components-border-radius-control .component-border-radius-control__linked-button.has-icon svg{margin-right:0}.components-border-style-control legend{line-height:1.4;margin-bottom:8px;padding:0}.components-border-style-control .components-border-style-control__buttons{display:inline-flex}.components-border-style-control .components-border-style-control__buttons .components-button.has-icon{min-width:30px;height:30px;padding:3px;margin-right:4px}.block-editor-button-block-appender{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:auto;color:#1e1e1e;box-shadow:inset 0 0 0 1px #1e1e1e}.block-editor-button-block-appender.components-button.components-button{padding:12px}.is-dark-theme .block-editor-button-block-appender{color:hsla(0,0%,100%,.65);box-shadow:inset 0 0 0 1px hsla(0,0%,100%,.65)}.block-editor-button-block-appender:hover{color:var(--wp-admin-theme-color);box-shadow:inset 0 0 0 1px var(--wp-admin-theme-color)}.block-editor-button-block-appender:focus{box-shadow:inset 0 0 0 2px var(--wp-admin-theme-color)}.block-editor-button-block-appender:active{color:#000}.block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator{margin-bottom:12px}.block-editor-color-gradient-control__fieldset{min-width:0}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title{display:flex;gap:8px}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator{width:12px;height:12px;align-self:center}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child{margin-left:12px}.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator{display:none}@media screen and (min-width:782px){.block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches{display:grid;grid-template-columns:repeat(6,28px);justify-content:space-between}}.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control{margin-bottom:inherit}.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown{display:block}.block-editor-panel-color-gradient-settings__dropdown{width:100%}.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content>div{width:280px}@media (min-width:782px){.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content{margin-right:156px!important}.block-editor-panel-color-gradient-settings__dropdown-content.is-from-top .components-popover__content{margin-top:-60px!important}.block-editor-panel-color-gradient-settings__dropdown-content.is-from-bottom .components-popover__content{margin-bottom:-60px!important}}.block-editor-panel-color-gradient-settings__dropdown:last-child>div{border-bottom-width:0}.block-editor-panel-color-gradient-settings__item{padding-top:12px!important;padding-bottom:12px!important}.block-editor-panel-color-gradient-settings__item .block-editor-panel-color-gradient-settings__color-indicator{background:linear-gradient(-45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.block-editor-panel-color-gradient-settings__item.is-open{background:#f0f0f0;color:var(--wp-admin-theme-color)}.block-editor-contrast-checker>.components-notice{margin:0}.block-editor-default-block-appender{clear:both;margin-left:auto;margin-right:auto;position:relative}.block-editor-default-block-appender[data-root-client-id=""] .block-editor-default-block-appender__content:hover{outline:1px solid transparent}.block-editor-default-block-appender .block-editor-default-block-appender__content{opacity:.62}.block-editor-default-block-appender .components-drop-zone__content-icon{display:none}.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,.block-editor-default-block-appender .block-editor-inserter{position:absolute;top:0;right:0;line-height:0}.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled,.block-editor-default-block-appender .block-editor-inserter:disabled{display:none}.block-editor-block-list__block .block-list-appender{position:absolute;list-style:none;padding:0;z-index:2;bottom:0;right:0}.block-editor-block-list__block .block-list-appender.block-list-appender{margin:0;line-height:0}.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender{height:24px}.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block .block-list-appender .block-list-appender__toggle{flex-direction:row;box-shadow:none;height:24px;width:24px;display:none;padding:0!important;background:#1e1e1e;color:#fff}.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,.block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover{color:#fff;background:var(--wp-admin-theme-color)}.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content{display:none}.block-editor-block-list__block .block-list-appender:only-child{position:relative;right:auto;align-self:center;list-style:none;line-height:inherit}.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content{display:block}.block-editor-block-list__block.is-selected .block-editor-block-list__layout>.block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block.is-selected .block-editor-block-list__layout>.block-list-appender .block-list-appender__toggle,.block-editor-block-list__block.is-selected>.block-list-appender .block-editor-inserter__toggle.components-button.has-icon,.block-editor-block-list__block.is-selected>.block-list-appender .block-list-appender__toggle{display:flex}.block-editor-default-block-appender__content{cursor:text}.block-editor-date-format-picker{margin-bottom:16px}.block-editor-date-format-picker__default-format-toggle-control__hint{color:#757575;display:block}.block-editor-date-format-picker__custom-format-select-control.components-base-control{margin-bottom:0}.block-editor-date-format-picker__custom-format-select-control .components-custom-select-control__button{width:100%}.block-editor-date-format-picker__custom-format-select-control__custom-option{border-top:1px solid #ddd}.block-editor-date-format-picker__custom-format-select-control__custom-option.has-hint{grid-template-columns:auto 30px}.block-editor-date-format-picker__custom-format-select-control__custom-option .components-custom-select-control__item-hint{grid-row:2;text-align:left}.block-editor-duotone-control__popover>.components-popover__content>div{padding:16px;width:280px}.block-editor-duotone-control__popover .components-menu-group__label{padding:0}.block-editor-duotone-control__popover .components-custom-gradient-picker__gradient-bar{margin:16px 0 12px}.block-editor-duotone-control__popover .components-circular-option-picker__swatches{display:grid;grid-template-columns:repeat(6,28px);gap:12px;justify-content:space-between}.block-editor-duotone-control__description{margin:16px 0;font-size:12px}.block-editor-duotone-control__popover:not([data-y-axis=middle][data-x-axis=right])>.components-popover__content{margin-left:-14px}.components-font-appearance-control{margin-bottom:24px}.components-font-appearance-control ul li{color:#1e1e1e;text-transform:capitalize}.block-editor-image-size-control{margin-bottom:1em}.block-editor-image-size-control .block-editor-image-size-control__row{display:flex;justify-content:space-between}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height,.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width{margin-bottom:.5em}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height input,.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width input{line-height:1.25}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width{margin-right:5px}.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height{margin-left:5px}.block-editor-block-list__layout.has-overlay:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:60}.block-editor-block-types-list__list-item{display:block;width:33.33%;padding:0;margin:0}.components-button.block-editor-block-types-list__item{display:flex;flex-direction:column;width:100%;font-size:13px;color:#1e1e1e;padding:8px;align-items:stretch;justify-content:center;cursor:pointer;background:transparent;word-break:break-word;border-radius:2px;transition:all .05s ease-in-out;position:relative;height:auto}@media (prefers-reduced-motion:reduce){.components-button.block-editor-block-types-list__item{transition-duration:0s;transition-delay:0s}}.components-button.block-editor-block-types-list__item:disabled{opacity:.6;cursor:default}.components-button.block-editor-block-types-list__item:not(:disabled):hover{color:var(--wp-admin-theme-color)!important}.components-button.block-editor-block-types-list__item:not(:disabled):focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.components-button.block-editor-block-types-list__item:not(:disabled).is-active{color:#fff;background:#1e1e1e;outline:2px solid transparent;outline-offset:-2px}.block-editor-block-types-list__item-icon{padding:12px 20px;border-radius:2px;color:#1e1e1e;transition:all .05s ease-in-out}@media (prefers-reduced-motion:reduce){.block-editor-block-types-list__item-icon{transition-duration:0s;transition-delay:0s}}.block-editor-block-types-list__item-icon .block-editor-block-icon{margin-left:auto;margin-right:auto}.block-editor-block-types-list__item-icon svg{transition:all .15s ease-out}@media (prefers-reduced-motion:reduce){.block-editor-block-types-list__item-icon svg{transition-duration:0s;transition-delay:0s}}.block-editor-block-types-list__list-item[draggable=true] .block-editor-block-types-list__item-icon{cursor:grab}.block-editor-block-types-list__item-title{padding:4px 2px 8px;font-size:12px}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}@keyframes loadingpulse{0%{opacity:1}50%{opacity:0}to{opacity:1}}.block-editor-link-control{position:relative;min-width:360px}.components-popover__content .block-editor-link-control{min-width:auto;width:90vw;max-width:360px}.block-editor-link-control__search-input-container,.block-editor-link-control__search-input-wrapper{position:relative}.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input{flex:1}.block-editor-link-control__field{margin:16px}.block-editor-link-control__field>.components-base-control__field{display:flex;align-items:center;margin:0}.block-editor-link-control__field .components-base-control__label{margin-right:16px;margin-bottom:0}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;font-size:16px;line-height:normal;width:calc(100% - 32px);display:block;padding:11px 36px 11px 16px;margin:0;position:relative;border:1px solid #ddd;border-radius:2px}@media (prefers-reduced-motion:reduce){.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input,.block-editor-link-control__field input[type=text]{font-size:13px;line-height:normal}}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:focus,.block-editor-link-control__field input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-webkit-input-placeholder,.block-editor-link-control__field input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-moz-placeholder,.block-editor-link-control__field input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:-ms-input-placeholder,.block-editor-link-control__field input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-link-control__search-error{margin:-8px 16px 16px}.block-editor-link-control__search-actions{position:absolute;top:3px;right:19px}.components-button .block-editor-link-control__search-submit .has-icon{margin:-1px}.block-editor-link-control__search-results-wrapper{position:relative;margin-top:-15px}.block-editor-link-control__search-results-wrapper:after,.block-editor-link-control__search-results-wrapper:before{content:"";position:absolute;left:-1px;right:16px;display:block;pointer-events:none;z-index:100}.block-editor-link-control__search-results-wrapper:before{height:8px;top:0;bottom:auto}.block-editor-link-control__search-results-wrapper:after{height:16px;bottom:0;top:auto}.block-editor-link-control__search-results-label{padding:16px 32px 0;display:block;font-weight:600}.block-editor-link-control__search-results{margin:0;padding:8px 16px;max-height:200px;overflow-y:auto}.block-editor-link-control__search-results.is-loading{opacity:.2}.block-editor-link-control__search-item{position:relative;display:flex;align-items:flex-start;font-size:13px;cursor:pointer;background:#fff;width:100%;border:none;text-align:left;padding:12px 16px;border-radius:2px;height:auto}.block-editor-link-control__search-item:focus,.block-editor-link-control__search-item:hover{background-color:#f0f0f0}.block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type,.block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type{background:#fff}.block-editor-link-control__search-item:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset}.block-editor-link-control__search-item.is-selected{background:#f0f0f0}.block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type{background:#fff}.block-editor-link-control__search-item.is-current{flex-direction:column;background:transparent;border:0;width:100%;cursor:default;padding:16px}.block-editor-link-control__search-item .block-editor-link-control__search-item-header{display:block;flex-direction:row;align-items:flex-start;margin-right:8px;white-space:pre-wrap;overflow-wrap:break-word}.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info{word-break:break-all}.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header{display:flex;flex:1}.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-header{align-items:center}.block-editor-link-control__search-item .block-editor-link-control__search-item-icon{position:relative;top:.2em;margin-right:8px;max-height:24px;flex-shrink:0;width:24px;display:flex;justify-content:center}.block-editor-link-control__search-item .block-editor-link-control__search-item-icon img{width:16px}.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-icon{top:0;width:32px;max-height:32px}.block-editor-link-control__search-item .block-editor-link-control__search-item-info,.block-editor-link-control__search-item .block-editor-link-control__search-item-title{overflow:hidden;text-overflow:ellipsis}.block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon,.block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon{position:absolute;right:0;margin-top:0}.block-editor-link-control__search-item .block-editor-link-control__search-item-title{display:block;margin-bottom:.2em;font-weight:500;position:relative}.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark{font-weight:700;color:inherit;background-color:transparent}.block-editor-link-control__search-item .block-editor-link-control__search-item-title span{font-weight:400}.block-editor-link-control__search-item .block-editor-link-control__search-item-title svg{display:none}.block-editor-link-control__search-item .block-editor-link-control__search-item-info{display:block;color:#757575;font-size:.9em;line-height:1.3}.block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice{font-style:italic;font-size:1.1em}.block-editor-link-control__search-item .block-editor-link-control__search-item-type{display:block;padding:3px 6px;margin-left:auto;font-size:.9em;background-color:#f0f0f0;border-radius:2px;white-space:nowrap}.block-editor-link-control__search-item .block-editor-link-control__search-item-description{padding-top:12px;margin:0}.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder{margin-top:12px;padding-top:0;height:28px;display:flex;flex-direction:column;justify-content:space-around}.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder:after,.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder:before{display:block;content:"";height:.7em;width:100%;background-color:#f0f0f0;border-radius:3px}.block-editor-link-control__search-item .block-editor-link-control__search-item-description .components-text{font-size:.9em}.block-editor-link-control__search-item .block-editor-link-control__search-item-image{display:flex;width:100%;background-color:#f0f0f0;justify-content:center;height:140px;max-height:140px;overflow:hidden;border-radius:2px;margin-top:12px}.block-editor-link-control__search-item .block-editor-link-control__search-item-image.is-placeholder{background-color:#f0f0f0;border-radius:3px}.block-editor-link-control__search-item .block-editor-link-control__search-item-image img{display:block;max-width:100%;height:140px;max-height:140px}.block-editor-link-control__search-item-top{display:flex;flex-direction:row;width:100%}.block-editor-link-control__search-item-bottom{transition:opacity 1.5s;width:100%}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description:after,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description:before,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-image{animation:loadingpulse 1s linear infinite;animation-delay:.5s}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon img,.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon svg{opacity:0}.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon:before{content:"";display:block;background-color:#f0f0f0;position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;animation:loadingpulse 1s linear infinite;animation-delay:.5s}.block-editor-link-control__loading{margin:16px;display:flex;align-items:center}.block-editor-link-control__loading .components-spinner{margin-top:0}.components-button+.block-editor-link-control__search-create{overflow:visible;padding:12px 16px}.components-button+.block-editor-link-control__search-create:before{content:"";position:absolute;top:-10px;left:0;display:block;width:100%}.block-editor-link-control__search-create{align-items:center}.block-editor-link-control__search-create .block-editor-link-control__search-item-title{margin-bottom:0}.block-editor-link-control__search-create .block-editor-link-control__search-item-icon{top:0}.block-editor-link-control__search-results div[role=menu]>.block-editor-link-control__search-item.block-editor-link-control__search-item{padding:10px}.block-editor-link-control__tools{display:flex;align-items:center;border-top:1px solid #ddd;margin:0;padding:16px}.block-editor-link-control__unlink{padding-left:16px;padding-right:16px}.block-editor-link-control__settings{flex:1;margin:0}.block-editor-link-control__settings :last-child{margin-bottom:0}.is-alternate .block-editor-link-control__settings{border-top:1px solid #1e1e1e}.block-editor-link-control__setting{margin-bottom:16px}.block-editor-link-control__setting :last-child{margin-bottom:0}.block-editor-link-control .block-editor-link-control__search-input .components-spinner{display:block}.block-editor-link-control .block-editor-link-control__search-input .components-spinner.components-spinner{position:absolute;left:auto;bottom:auto;top:calc(50% - 8px);right:36px}.block-editor-link-control__search-item-action{margin-left:auto;flex-shrink:0}.block-editor-list-view-tree{width:100%;border-collapse:collapse;padding:0;margin:0}.components-modal__content .block-editor-list-view-tree{margin:-12px -6px 0;width:calc(100% + 12px)}.block-editor-list-view-leaf{position:relative}.block-editor-list-view-leaf.is-selected td{background:var(--wp-admin-theme-color)}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents,.block-editor-list-view-leaf.is-selected .components-button.has-icon{color:#fff}.is-dragging-components-draggable .block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents{background:none;color:#1e1e1e}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents:focus:after{box-shadow:inset 0 0 0 1px #fff,0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block__menu:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #fff}.block-editor-list-view-leaf.is-dragging{display:none}.block-editor-list-view-leaf.is-first-selected td:first-child{border-top-left-radius:2px}.block-editor-list-view-leaf.is-first-selected td:last-child{border-top-right-radius:2px}.block-editor-list-view-leaf.is-last-selected td:first-child{border-bottom-left-radius:2px}.block-editor-list-view-leaf.is-last-selected td:last-child{border-bottom-right-radius:2px}.block-editor-list-view-leaf.is-branch-selected:not(.is-selected){background:linear-gradient(hsla(0,0%,100%,.9),hsla(0,0%,100%,.9)),linear-gradient(var(--wp-admin-theme-color),var(--wp-admin-theme-color))}.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:first-child{border-top-left-radius:2px}.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:last-child{border-top-right-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:first-child{border-top-left-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:last-child{border-top-right-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:first-child{border-bottom-left-radius:2px}.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:last-child{border-bottom-right-radius:2px}.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) td{border-radius:0}.block-editor-list-view-leaf .block-editor-list-view-block-contents{display:flex;align-items:center;width:100%;height:auto;padding:6px 12px 6px 0;text-align:left;color:#1e1e1e;border-radius:2px;position:relative;white-space:nowrap}.block-editor-list-view-leaf .block-editor-list-view-block-contents.is-dropping-before:before{content:"";position:absolute;pointer-events:none;transition:border-color .1s linear,border-style .1s linear,box-shadow .1s linear;top:-2px;right:0;left:0;border-top:4px solid var(--wp-admin-theme-color)}.components-modal__content .block-editor-list-view-leaf .block-editor-list-view-block-contents{padding-left:0;padding-right:0}.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus{box-shadow:none}.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus:after{content:"";position:absolute;top:0;right:-29px;bottom:0;left:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);z-index:2;pointer-events:none}.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block-contents:focus:after{box-shadow:none}.block-editor-list-view-leaf.has-single-cell .block-editor-list-view-block-contents:focus:after{right:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);z-index:1}.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block__menu:focus{box-shadow:none}.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents{opacity:1;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-block-icon{align-self:flex-start;margin-right:8px;width:24px}.block-editor-list-view-leaf .block-editor-list-view-block__contents-cell,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{padding-top:0;padding-bottom:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{line-height:0;width:36px;vertical-align:middle}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell>*{opacity:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover{position:relative;z-index:1}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover>*{opacity:1;animation:edit-post__fade-in-animation .2s ease-out 0s;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible>*,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover>*{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell,.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell,.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell .components-button.has-icon{width:24px;min-width:24px;padding:0}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell{padding-right:5px}.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon{height:24px}.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell-alignment-wrapper{display:flex;height:100%;flex-direction:column;align-items:center}.block-editor-list-view-leaf .block-editor-block-mover-button{position:relative;width:36px;height:24px}.block-editor-list-view-leaf .block-editor-block-mover-button svg{position:relative;height:24px}.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button{margin-top:-6px;align-items:flex-end}.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button svg{bottom:-4px}.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button{margin-bottom:-6px;align-items:flex-start}.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button svg{top:-4px}.block-editor-list-view-leaf .block-editor-block-mover-button:focus,.block-editor-list-view-leaf .block-editor-block-mover-button:focus:enabled{box-shadow:none;outline:none}.block-editor-list-view-leaf .block-editor-block-mover-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.block-editor-list-view-leaf .block-editor-block-mover-button:before{content:"";position:absolute;display:block;border-radius:2px;height:16px;min-width:100%;left:0;right:0;animation:components-button__appear-animation .1s ease;animation-fill-mode:forwards}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf .block-editor-block-mover-button:before{animation-duration:1ms;animation-delay:0s}}.block-editor-list-view-leaf .block-editor-inserter__toggle{background:#1e1e1e;color:#fff;height:24px;margin:6px 6px 6px 1px;min-width:24px}.block-editor-list-view-leaf .block-editor-inserter__toggle:active{color:#fff}.block-editor-list-view-leaf .block-editor-list-view-block-select-button__anchor{background:rgba(0,0,0,.1);border-radius:2px;display:inline-block;padding:2px 6px;margin:0 8px;max-width:120px;overflow:hidden;text-overflow:ellipsis}.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-select-button__anchor{background:rgba(0,0,0,.3)}.block-editor-list-view-leaf .block-editor-list-view-block-select-button__lock{line-height:0;width:24px;min-width:24px;margin-left:auto;padding:0;vertical-align:middle}.block-editor-list-view-appender__description,.block-editor-list-view-block-select-button__description{display:none}.block-editor-list-view-appender__cell .block-editor-list-view-appender__container,.block-editor-list-view-appender__cell .block-editor-list-view-block__contents-container,.block-editor-list-view-block__contents-cell .block-editor-list-view-appender__container,.block-editor-list-view-block__contents-cell .block-editor-list-view-block__contents-container{display:flex}.block-editor-list-view__expander{height:24px;margin-left:4px;width:24px}.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander{margin-left:220px}.block-editor-list-view-leaf:not([aria-level="1"]) .block-editor-list-view__expander{margin-right:4px}.block-editor-list-view-leaf[aria-level="1"] .block-editor-list-view__expander{margin-left:0}.block-editor-list-view-leaf[aria-level="2"] .block-editor-list-view__expander{margin-left:24px}.block-editor-list-view-leaf[aria-level="3"] .block-editor-list-view__expander{margin-left:52px}.block-editor-list-view-leaf[aria-level="4"] .block-editor-list-view__expander{margin-left:80px}.block-editor-list-view-leaf[aria-level="5"] .block-editor-list-view__expander{margin-left:108px}.block-editor-list-view-leaf[aria-level="6"] .block-editor-list-view__expander{margin-left:136px}.block-editor-list-view-leaf[aria-level="7"] .block-editor-list-view__expander{margin-left:164px}.block-editor-list-view-leaf[aria-level="8"] .block-editor-list-view__expander{margin-left:192px}.block-editor-list-view-leaf .block-editor-list-view__expander{visibility:hidden}.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg{visibility:visible;transition:transform .2s ease;transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg{visibility:visible;transform:rotate(0deg);transition:transform .2s ease}@media (prefers-reduced-motion:reduce){.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg{transition-duration:0s;transition-delay:0s}}.block-editor-list-view-drop-indicator{pointer-events:none}.block-editor-list-view-drop-indicator .block-editor-list-view-drop-indicator__line{background:var(--wp-admin-theme-color);height:1px}.block-editor-list-view-drop-indicator:not([data-y-axis=middle][data-x-axis=right])>.components-popover__content{margin-left:0;border:none;box-shadow:none}.block-editor-list-view-placeholder{padding:0;margin:0;height:36px}.modal-open .block-editor-media-replace-flow__options{display:none}.block-editor-media-replace-flow__indicator{margin-left:4px}.block-editor-media-flow__url-input{border-top:1px solid #1e1e1e;margin-top:8px;margin-right:-8px;margin-left:-8px;padding:16px}.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label{display:block;top:16px;margin-bottom:8px}.block-editor-media-flow__url-input .block-editor-link-control{width:220px}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input{padding:0}.block-editor-media-flow__url-input .block-editor-link-control .components-base-control .components-base-control__field{margin-bottom:0}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title{max-width:180px;white-space:nowrap}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info{white-space:nowrap}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current{width:auto;padding:0}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-input.block-editor-link-control__search-input input[type=text]{margin:0;width:100%}.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-actions{top:0;right:4px}.block-editor-media-flow__error{padding:0 20px 20px;max-width:255px}.block-editor-media-flow__error .components-with-notices-ui{max-width:255px}.block-editor-media-flow__error .components-with-notices-ui .components-notice__content{overflow:hidden;word-wrap:break-word}.block-editor-media-flow__error .components-with-notices-ui .components-notice__dismiss{position:absolute;right:10px}.block-editor-media-placeholder__url-input-container .block-editor-media-placeholder__button{margin-bottom:0}.block-editor-media-placeholder__url-input-form{display:flex}.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field{width:100%;min-width:200px;flex-grow:1;border:none;border-radius:0;margin:2px}@media (min-width:600px){.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field{width:300px}}.block-editor-media-placeholder__url-input-submit-button{flex-shrink:1}.block-editor-media-placeholder__button{margin-bottom:.5rem}.block-editor-media-placeholder__cancel-button.is-link{margin:1em;display:block}.block-editor-media-placeholder.is-appender{min-height:0}.block-editor-media-placeholder.is-appender:hover{cursor:pointer;box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.block-editor-multi-selection-inspector__card{display:flex;align-items:flex-start;padding:16px}.block-editor-multi-selection-inspector__card-content{flex-grow:1}.block-editor-multi-selection-inspector__card-title{font-weight:500;margin-bottom:5px}.block-editor-multi-selection-inspector__card-description{font-size:13px}.block-editor-multi-selection-inspector__card .block-editor-block-icon{margin-left:-2px;margin-right:10px;padding:0 3px;width:36px;height:24px}.block-editor-plain-text{box-shadow:none;font-family:inherit;font-size:inherit;color:inherit;line-height:inherit;border:none;padding:0;margin:0;width:100%}.block-editor-responsive-block-control{margin-bottom:28px;border-bottom:1px solid #ccc;padding-bottom:14px}.block-editor-responsive-block-control:last-child{padding-bottom:0;border-bottom:0}.block-editor-responsive-block-control__title{margin:0 0 .6em -3px}.block-editor-responsive-block-control__label{font-weight:600;margin-bottom:.6em;margin-left:-3px}.block-editor-responsive-block-control__inner{margin-left:-1px}.block-editor-responsive-block-control__toggle{margin-left:1px}.block-editor-responsive-block-control .components-base-control__help{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.rich-text [data-rich-text-placeholder]{pointer-events:none}.rich-text [data-rich-text-placeholder]:after{content:attr(data-rich-text-placeholder);opacity:.62}.rich-text:focus{outline:none}.rich-text:focus [data-rich-text-format-boundary]{border-radius:2px}.block-editor-rich-text__editable>p:first-child{margin-top:0}figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]:before{opacity:.8}.components-popover.block-editor-rich-text__inline-format-toolbar{z-index:99998}.components-popover.block-editor-rich-text__inline-format-toolbar .components-popover__content{width:auto;min-width:auto;margin-bottom:8px;box-shadow:none;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar,.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group{border:none}.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle,.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control{min-width:48px;min-height:48px;padding-left:12px;padding-right:12px}.block-editor-rich-text__inline-format-toolbar-group .components-dropdown-menu__toggle{justify-content:center}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon{width:auto}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon svg{display:none}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon:after{content:attr(aria-label)}[data-rich-text-script]{display:inline}[data-rich-text-script]:before{content:"";background:#ff0}.block-editor-skip-to-selected-block{position:absolute;top:-9999em}.block-editor-skip-to-selected-block:focus{height:auto;width:auto;display:block;font-size:14px;font-weight:600;padding:15px 23px 14px;background:#f1f1f1;color:var(--wp-admin-theme-color);line-height:normal;box-shadow:0 0 2px 2px rgba(0,0,0,.6);text-decoration:none;outline:none;z-index:100000}.block-editor-text-transform-control{flex:0 0 50%}.block-editor-text-transform-control legend{margin-bottom:8px}.block-editor-text-transform-control .block-editor-text-transform-control__buttons{display:inline-flex;margin-bottom:24px}.block-editor-text-transform-control .block-editor-text-transform-control__buttons .components-button.has-icon{min-width:24px;padding:0;margin-right:4px}.block-editor-text-decoration-control{flex:0 0 50%}.block-editor-text-decoration-control legend{margin-bottom:8px}.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons{display:inline-flex;margin-bottom:24px}.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons .components-button.has-icon{min-width:24px;padding:0;margin-right:4px}.block-editor-tool-selector__help{margin:8px -8px -8px;padding:16px;border-top:1px solid #ddd;color:#757575;min-width:280px}.block-editor-block-list__block .block-editor-url-input,.block-editor-url-input,.components-popover .block-editor-url-input{flex-grow:1;position:relative;padding:1px}.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{width:100%;padding:8px 8px 8px 12px;border:none;border-radius:0;margin-left:0;margin-right:0;font-size:16px}@media (min-width:600px){.block-editor-block-list__block .block-editor-url-input input[type=text],.block-editor-url-input input[type=text],.components-popover .block-editor-url-input input[type=text]{width:300px;font-size:13px}}.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear,.block-editor-url-input input[type=text]::-ms-clear,.components-popover .block-editor-url-input input[type=text]::-ms-clear{display:none}.block-editor-block-list__block .block-editor-url-input.is-full-width,.block-editor-block-list__block .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.block-editor-block-list__block .block-editor-url-input.is-full-width__suggestions,.block-editor-url-input.is-full-width,.block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.block-editor-url-input.is-full-width__suggestions,.components-popover .block-editor-url-input.is-full-width,.components-popover .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text],.components-popover .block-editor-url-input.is-full-width__suggestions{width:100%}.block-editor-block-list__block .block-editor-url-input .components-spinner,.block-editor-url-input .components-spinner,.components-popover .block-editor-url-input .components-spinner{position:absolute;right:8px 8px 8px 12px;bottom:8px 8px 8px 12px8px1;margin:0}.block-editor-url-input__input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal}@media (prefers-reduced-motion:reduce){.block-editor-url-input__input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-url-input__input[type=text]{font-size:13px;line-height:normal}}.block-editor-url-input__input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.block-editor-url-input__input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-url-input__input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.block-editor-url-input__input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.block-editor-url-input__suggestions{max-height:200px;transition:all .15s ease-in-out;padding:4px 0;width:302px;overflow-y:auto}@media (prefers-reduced-motion:reduce){.block-editor-url-input__suggestions{transition-duration:0s;transition-delay:0s}}.block-editor-url-input .components-spinner,.block-editor-url-input__suggestions{display:none}@media (min-width:600px){.block-editor-url-input .components-spinner,.block-editor-url-input__suggestions{display:grid}}.block-editor-url-input__suggestion{min-height:36px;height:auto;color:#757575;display:block;font-size:13px;cursor:pointer;background:#fff;width:100%;border:none;text-align:left;box-shadow:none}.block-editor-url-input__suggestion:hover{background:#ddd}.block-editor-url-input__suggestion.is-selected,.block-editor-url-input__suggestion:focus{background:var(--wp-admin-theme-color-darker-20);color:#fff;outline:none}.components-toolbar-group>.block-editor-url-input__button,.components-toolbar>.block-editor-url-input__button{position:inherit}.block-editor-url-input__button .block-editor-url-input__back{margin-right:4px;overflow:visible}.block-editor-url-input__button .block-editor-url-input__back:after{content:"";position:absolute;display:block;width:1px;height:24px;right:-1px;background:#ddd}.block-editor-url-input__button-modal{box-shadow:0 2px 6px rgba(0,0,0,.05);border:1px solid #ddd;background:#fff}.block-editor-url-input__button-modal-line{display:flex;flex-direction:row;flex-grow:1;flex-shrink:1;min-width:0;align-items:flex-start}.block-editor-url-input__button-modal-line .components-button{flex-shrink:0;width:36px;height:36px}.block-editor-url-popover__additional-controls{border-top:1px solid #ddd}.block-editor-url-popover__additional-controls>div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary)>svg{box-shadow:none}.block-editor-url-popover__additional-controls div[role=menu]>.components-button{padding-left:12px}.block-editor-url-popover__row{display:flex}.block-editor-url-popover__row>:not(.block-editor-url-popover__settings-toggle){flex-grow:1}.block-editor-url-popover .components-button.has-icon{padding:3px}.block-editor-url-popover .components-button.has-icon>svg{padding:5px;border-radius:2px;height:30px;width:30px}.block-editor-url-popover .components-button.has-icon:not(:disabled):focus{box-shadow:none}.block-editor-url-popover .components-button.has-icon:not(:disabled):focus>svg{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 4px #fff;outline:2px solid transparent}.block-editor-url-popover__settings-toggle{flex-shrink:0;border-radius:0;border-left:1px solid #ddd;margin-left:1px}.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon{transform:rotate(180deg)}.block-editor-url-popover__input-container .components-base-control:last-child,.block-editor-url-popover__input-container .components-base-control:last-child .components-base-control__field{margin-bottom:0}.block-editor-url-popover__settings{display:block;padding:16px;border-top:1px solid #ddd}.block-editor-url-popover__link-editor,.block-editor-url-popover__link-viewer{display:flex}.block-editor-url-popover__link-editor .block-editor-url-input .components-base-control__field,.block-editor-url-popover__link-viewer .block-editor-url-input .components-base-control__field{margin-bottom:0}.block-editor-url-popover__link-editor .block-editor-url-input .components-spinner,.block-editor-url-popover__link-viewer .block-editor-url-input .components-spinner{bottom:8px 8px 8px 12px1}.block-editor-url-popover__link-viewer-url{margin:7px;flex-grow:1;flex-shrink:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:150px;max-width:500px}.block-editor-url-popover__link-viewer-url.has-invalid-link{color:#cc1818}.block-editor-warning{align-items:center;display:flex;flex-wrap:wrap;padding:1em;border:1px solid #1e1e1e;border-radius:2px;background-color:#fff}.block-editor-warning,.block-editor-warning .block-editor-warning__message{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.block-editor-warning .block-editor-warning__message{line-height:1.4;font-size:13px;color:#1e1e1e;margin:0}.block-editor-warning p.block-editor-warning__message.block-editor-warning__message{min-height:auto}.block-editor-warning .block-editor-warning__contents{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;align-items:baseline;width:100%}.block-editor-warning .block-editor-warning__actions{display:flex;margin-top:1em}.block-editor-warning .block-editor-warning__action{margin:0 8px 0 0}.block-editor-warning__secondary{margin:auto 0 auto 8px}.components-popover.block-editor-warning__dropdown{z-index:99998}.html-anchor-control .components-external-link{display:block;margin-top:8px}.block-editor-hooks__layout-controls{display:flex;margin-bottom:16px}.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit{display:flex;margin-right:24px}.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit svg{margin:auto 0 4px 8px}.block-editor-hooks__layout-controls-reset{display:flex;justify-content:flex-end;margin-bottom:24px}.block-editor-hooks__layout-controls-helptext{font-size:12px}.block-editor-hooks__flex-layout-justification-controls,.block-editor-hooks__flex-layout-orientation-controls{margin-bottom:12px}.block-editor-hooks__flex-layout-justification-controls legend,.block-editor-hooks__flex-layout-orientation-controls legend{margin-bottom:8px}.border-block-support-panel .single-column,.dimensions-block-support-panel .single-column{grid-column:span 1}.typography-block-support-panel .block-editor-text-decoration-control__buttons,.typography-block-support-panel .block-editor-text-transform-control__buttons,.typography-block-support-panel .components-font-appearance-control,.typography-block-support-panel .components-font-size-picker__controls{margin-bottom:0}.typography-block-support-panel .single-column{grid-column:span 1}.color-block-support-panel .block-editor-contrast-checker{order:9999;grid-column:span 2;margin-top:16px}.color-block-support-panel .block-editor-contrast-checker .components-notice__content{margin-right:0}.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper{row-gap:0}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item{padding:0;border-left:1px solid rgba(0,0,0,.1);border-right:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(0,0,0,.1)}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first{border-top-left-radius:2px;border-top-right-radius:2px;border-top:1px solid rgba(0,0,0,.1)}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.last{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item>div,.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item>div>button{border-radius:inherit}.color-block-support-panel .block-editor-panel-color-gradient-settings__color-indicator{background:linear-gradient(-45deg,transparent 48%,#ddd 0,#ddd 52%,transparent 0)}.color-block-support-panel .block-editor-tools-panel-color-dropdown{display:block;padding:0}.color-block-support-panel .block-editor-tools-panel-color-dropdown>button{height:46px}.color-block-support-panel .block-editor-tools-panel-color-dropdown>button.is-open{background:#f0f0f0;color:var(--wp-admin-theme-color)}.color-block-support-panel .color-block-support-panel__item-group>div{grid-column:span 2;border-radius:inherit}.block-editor-block-toolbar{display:flex;flex-grow:1;width:100%;position:relative;overflow-y:hidden;overflow-x:auto;transition:border-color .1s linear,box-shadow .1s linear}@media (prefers-reduced-motion:reduce){.block-editor-block-toolbar{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.block-editor-block-toolbar{overflow:inherit}}.block-editor-block-toolbar .components-toolbar,.block-editor-block-toolbar .components-toolbar-group{background:none;line-height:0;margin-top:-1px;margin-bottom:-1px;border:0;border-right:1px solid #ddd}.block-editor-block-toolbar>:last-child,.block-editor-block-toolbar>:last-child .components-toolbar,.block-editor-block-toolbar>:last-child .components-toolbar-group{border-right:none}.block-editor-block-contextual-toolbar.has-parent:not(.is-fixed){margin-left:56px}.show-icon-labels .block-editor-block-contextual-toolbar.has-parent:not(.is-fixed){margin-left:0}.block-editor-block-parent-selector{position:absolute;top:-1px;left:-57px}.show-icon-labels .block-editor-block-parent-selector{position:relative;left:auto;top:auto;margin-top:-1px;margin-left:-1px;margin-bottom:-1px}.block-editor-block-toolbar__block-controls{height:auto!important;padding:0!important;margin-left:-1px}.block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,.block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{width:24px!important;margin:0!important}.block-editor-block-toolbar__block-controls .block-editor-block-mover{margin-left:-6px}.block-editor-block-toolbar__block-controls .block-editor-block-lock-toolbar{margin-left:-6px!important}.block-editor-block-toolbar__block-controls .components-toolbar-group{padding:0}.block-editor-block-toolbar .components-toolbar,.block-editor-block-toolbar .components-toolbar-group,.block-editor-rich-text__inline-format-toolbar-group .components-toolbar,.block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group{display:flex;flex-wrap:nowrap}.block-editor-block-toolbar__slot{display:inline-block;line-height:0}@supports (position:sticky){.block-editor-block-toolbar__slot{display:inline-flex}}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon{width:auto}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon svg{display:none}.show-icon-labels .block-editor-block-toolbar .components-button.has-icon:after{content:attr(aria-label);font-size:12px}.show-icon-labels .components-accessible-toolbar .components-toolbar-group>div:first-child:last-child>.components-button.has-icon{padding-left:6px;padding-right:6px}.show-icon-labels .block-editor-block-switcher{border-right:1px solid #1e1e1e}.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle{margin-left:0}.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,.show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon{width:0!important;height:0!important}.show-icon-labels .block-editor-block-parent-selector__button .block-editor-block-icon{width:0}.show-icon-labels .block-editor-block-toolbar__block-controls .block-editor-block-mover{margin-left:0;white-space:nowrap}.show-icon-labels .block-editor-block-mover-button{padding-left:8px!important;padding-right:8px!important}.show-icon-labels .block-editor-block-mover__drag-handle.has-icon{padding-left:6px!important;padding-right:6px!important;border-right:1px solid #1e1e1e}@media (min-width:600px){.show-icon-labels .is-up-button.is-up-button.is-up-button{border-bottom:1px solid #1e1e1e;margin-right:0;border-radius:0}}.show-icon-labels .block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button{width:auto}.show-icon-labels .components-toolbar,.show-icon-labels .components-toolbar-group{flex-shrink:1}.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button+.components-button{margin-left:6px}.block-editor-inserter{display:inline-block;background:none;border:none;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;line-height:0}@media (min-width:782px){.block-editor-inserter{position:relative}}.block-editor-inserter__content{position:relative}.block-editor-inserter__popover.is-quick .components-popover__content{border:none}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>*{border-left:1px solid #ccc;border-right:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>:first-child{border-top:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>:last-child{border-bottom:1px solid #ccc}.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter>.components-button{border:1px solid #1e1e1e}.block-editor-inserter__popover .block-editor-inserter__menu{margin:-12px}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__tabs .components-tab-panel__tabs{top:60px}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__main-area{overflow:visible;height:auto}.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__preview-container{display:none}.block-editor-inserter__toggle.components-button{display:inline-flex;align-items:center;cursor:pointer;border:none;outline:none;padding:0;transition:color .2s ease}@media (prefers-reduced-motion:reduce){.block-editor-inserter__toggle.components-button{transition-duration:0s;transition-delay:0s}}.block-editor-inserter__menu{height:100%;position:relative;overflow:visible}.block-editor-inserter__main-area{width:auto;overflow-y:auto;height:100%}@media (min-width:782px){.block-editor-inserter__main-area{width:350px}}.block-editor-inserter__inline-elements{margin-top:-1px}.block-editor-inserter__menu.is-bottom:after{border-bottom-color:#fff}.components-popover.block-editor-inserter__popover{z-index:99999}.block-editor-inserter__search{background:#fff;padding:16px 16px 0;position:sticky;top:0;z-index:1}.block-editor-inserter__search .components-search-control__icon{right:20px}.block-editor-inserter__search .components-base-control__field{margin-bottom:0}.block-editor-inserter__tabs{display:flex;flex-direction:column}.block-editor-inserter__tabs .components-tab-panel__tabs{position:sticky;top:64px;background:#fff;z-index:1;border-bottom:1px solid #ddd}.block-editor-inserter__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{flex-grow:1;margin-bottom:-1px}.block-editor-inserter__tabs .components-tab-panel__tab-content{display:flex;flex-grow:1;flex-direction:column;position:relative;z-index:0}.block-editor-inserter__panel-header{display:inline-flex;align-items:center;padding:16px 16px 0}.block-editor-inserter__panel-header-patterns{padding:16px 16px 0}.block-editor-inserter__panel-content{padding:16px}.block-editor-inserter__panel-title,.block-editor-inserter__panel-title button{margin:0 12px 0 0;color:#757575;text-transform:uppercase;font-size:11px;font-weight:500}.block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input{height:36px;line-height:36px}.block-editor-inserter__panel-dropdown select{border:none}.block-editor-inserter__block-list{flex-grow:1;position:relative}.block-editor-inserter__reusable-blocks-panel{position:relative;text-align:right}.block-editor-inserter__manage-reusable-blocks{display:inline-block;margin:16px}.block-editor-inserter__no-results{padding:32px;text-align:center}.block-editor-inserter__no-results-icon{fill:#949494}.block-editor-inserter__child-blocks{padding:0 16px}.block-editor-inserter__parent-block-header{display:flex;align-items:center}.block-editor-inserter__parent-block-header h2{font-size:13px}.block-editor-inserter__parent-block-header .block-editor-block-icon{margin-right:8px}.block-editor-inserter__preview-container{display:none;width:300px;background:#fff;border-radius:2px;border:1px solid #ddd;position:absolute;top:16px;left:calc(100% + 16px);max-height:calc(100% - 32px);overflow-y:hidden}@media (min-width:782px){.block-editor-inserter__preview-container{display:block}}.block-editor-inserter__preview-container .block-editor-block-card{padding:16px}.block-editor-inserter__preview-container .block-editor-block-card__title{font-size:13px}.block-editor-inserter__preview-content{min-height:144px;background:#f0f0f0;display:grid;flex-grow:1;align-items:center}.block-editor-inserter__preview-content-missing{flex:1;display:flex;justify-content:center;align-items:center;min-height:144px;color:#757575;background:#f0f0f0}.block-editor-inserter__tips{border-top:1px solid #ddd;padding:16px;flex-shrink:0;position:relative}.block-editor-inserter__manage-reusable-blocks-container{padding:16px}.block-editor-inserter__quick-inserter{width:100%;max-width:100%}@media (min-width:782px){.block-editor-inserter__quick-inserter{width:350px}}.block-editor-inserter__quick-inserter-results .block-editor-inserter__panel-header{height:0;padding:0;float:left}.block-editor-inserter__quick-inserter.has-expand .block-editor-inserter__panel-content,.block-editor-inserter__quick-inserter.has-search .block-editor-inserter__panel-content{padding:16px}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr;grid-gap:8px}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-preview__container{min-height:100px}.block-editor-inserter__quick-inserter-separator{border-top:1px solid #ddd}.block-editor-inserter__popover.is-quick>.components-popover__content>div{padding:0}.block-editor-inserter__quick-inserter-expand.components-button{display:block;background:#1e1e1e;color:#fff;width:100%;height:44px;border-radius:0}.block-editor-inserter__quick-inserter-expand.components-button:hover{color:#fff}.block-editor-inserter__quick-inserter-expand.components-button:active{color:#ccc}.block-editor-inserter__quick-inserter-expand.components-button.components-button:focus:not(:disabled){box-shadow:none;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.block-editor-block-patterns-explorer__sidebar{position:absolute;top:60px;left:0;bottom:0;width:280px;padding:24px 32px 32px;overflow-x:visible;overflow-y:scroll}.block-editor-block-patterns-explorer__sidebar__categories-list__item{display:block;width:100%;height:48px;text-align:left}.block-editor-block-patterns-explorer__search{margin-bottom:32px}.block-editor-block-patterns-explorer__search-results-count{padding-bottom:32px}.block-editor-block-patterns-explorer__list{margin-left:248px}.block-editor-block-patterns-explorer .block-editor-block-patterns-list{display:grid;grid-gap:32px;grid-template-columns:repeat(1,1fr)}@media (min-width:1080px){.block-editor-block-patterns-explorer .block-editor-block-patterns-list{grid-template-columns:repeat(2,1fr)}}@media (min-width:1440px){.block-editor-block-patterns-explorer .block-editor-block-patterns-list{grid-template-columns:repeat(3,1fr)}}.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{min-height:240px}.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-preview__container{height:inherit;min-height:100px;max-height:800px}.block-editor-post-preview__dropdown{padding:0}.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize{padding-left:40px}.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize.has-icon{padding-left:8px}.block-editor-post-preview__dropdown-content .components-popover__content{overflow-y:visible}.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:first-child{padding-bottom:8px}.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:last-child{margin-bottom:0}.block-editor-post-preview__dropdown-content .components-menu-group+.components-menu-group{padding:8px}@media (min-width:600px){.edit-post-header__settings .editor-post-preview,.edit-site-header__actions .editor-post-preview{display:none}}@media (min-width:600px){.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state{transition:opacity .1s linear}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-save-draft,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-saved-state{opacity:0}.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle.is-opened{opacity:1}}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-editor-autocompleters__block { - white-space: nowrap; -} -.block-editor-autocompleters__block .block-editor-block-icon { - margin-left: 8px; -} - -.block-editor-autocompleters__link { - white-space: nowrap; -} -.block-editor-autocompleters__link .block-editor-block-icon { - margin-left: 8px; -} - -.block-editor-block-alignment-control__menu-group .components-menu-item__info { - margin-top: 0; -} - -.block-editor-block-alignment-matrix-control__popover .components-popover__content { - min-width: 0; - width: auto; -} -.block-editor-block-alignment-matrix-control__popover .components-popover__content > div { - padding: 8px; -} - -.block-editor-block-icon { - display: flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; -} -.block-editor-block-icon.has-colors svg { - fill: currentColor; -} -@media (forced-colors: active) { - .block-editor-block-icon.has-colors svg { - fill: CanvasText; - } -} -.block-editor-block-icon svg { - min-width: 20px; - min-height: 20px; - max-width: 24px; - max-height: 24px; -} - -.block-editor-block-inspector p { - margin-top: 0; -} -.block-editor-block-inspector h2, -.block-editor-block-inspector h3 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.block-editor-block-inspector .components-base-control { - margin-bottom: 24px; -} -.block-editor-block-inspector .components-base-control:last-child { - margin-bottom: 8px; -} -.block-editor-block-inspector .components-panel__body { - border: none; - border-top: 1px solid #e0e0e0; -} -.block-editor-block-inspector .block-editor-block-card { - padding: 16px; -} - -.block-editor-block-inspector__no-blocks { - display: block; - font-size: 13px; - background: #fff; - padding: 32px 16px; - text-align: center; -} - -.block-editor-block-styles .block-editor-block-list__block { - margin: 0; -} - -/** - * Notices & Block Selected/Hover Styles. - */ -/** - * Cross-Block Selection - */ -.block-editor-block-list__layout { - position: relative; -} -.block-editor-block-list__layout.is-navigate-mode { - cursor: default; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable])::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected::after { - position: absolute; - z-index: 1; - pointer-events: none; - content: ""; - top: 1px; - bottom: 1px; - right: 1px; - left: 1px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 1px; - outline: 2px solid transparent; -} -.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable])::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected::after { - box-shadow: 0 0 0 1px #fff; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected .components-placeholder ::selection, .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]) .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected .components-placeholder ::selection { - background: transparent; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:not(.is-selected)::after { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 1px solid transparent; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.has-child-selected { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected::before { - content: ""; - position: absolute; - z-index: 0; - pointer-events: none; - transition: border-color 0.1s linear, border-style 0.1s linear, box-shadow 0.1s linear; - left: 0; - right: 0; - top: -14px; - border-radius: 2px; - border-top: 4px solid #ccc; -} -.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected::after { - content: none; -} -.block-editor-block-list__layout .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected::before { - border-color: var(--wp-admin-theme-color); -} - -.is-block-moving-mode.block-editor-block-list__block-selection-button { - opacity: 0; - font-size: 1px; - height: 1px; - padding: 0; -} - -.block-editor-block-list__layout .block-editor-block-list__block { - position: relative; - overflow-wrap: break-word; - /** - * Notices - */ - /** - * Block Layout - */ - /** - * Block styles and alignments - */ -} -.block-editor-block-list__layout .block-editor-block-list__block .reusable-block-edit-panel * { - z-index: 1; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-placeholder .components-with-notices-ui { - margin: -10px 0 12px 0; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui { - margin: 0 0 12px 0; - width: 100%; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice { - margin-right: 0; - margin-left: 0; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice .components-notice__content { - font-size: 13px; -} -.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus { - outline: none; -} -.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus::after { - position: absolute; - z-index: 1; - pointer-events: none; - content: ""; - top: 1px; - bottom: 1px; - right: 1px; - left: 1px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 1px; - outline: 2px solid transparent; -} -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) #fff; -} -.block-editor-block-list__layout .block-editor-block-list__block::after { - content: ""; - pointer-events: none; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border-radius: 2px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) transparent; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning { - min-height: 48px; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning > * { - pointer-events: none; - -webkit-user-select: none; - user-select: none; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning { - pointer-events: all; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning::after { - content: ""; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - border-radius: 2px; - background-color: rgba(255, 255, 255, 0.4); -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected::after { - background-color: transparent; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable > .block-editor-inner-blocks > .block-editor-block-list__layout.has-overlay::after { - display: none; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable > .block-editor-inner-blocks > .block-editor-block-list__layout.has-overlay .block-editor-block-list__layout.has-overlay::after { - display: block; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable.has-child-selected::after { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true] { - float: none; -} - -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered { - cursor: default; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered::after { - top: 1px; - right: 1px; - left: 1px; - bottom: 1px; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - border-radius: 1px; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected { - cursor: unset; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - top: 1px; - right: 1px; - left: 1px; - bottom: 1px; - border-radius: 1px; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:focus::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .is-focus-mode .block-editor-block-list__block:not(.has-child-selected) { - transition-duration: 0s; - transition-delay: 0s; - } -} -.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) .block-editor-block-list__block, .is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-selected, .is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-multi-selected { - opacity: 1; -} - -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity { - transition-duration: 0s; - transition-delay: 0s; - } -} -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block, -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block { - opacity: 1; -} - -.wp-block[data-align=left] > *, -.wp-block[data-align=right] > *, -.wp-block.alignleft, -.wp-block.alignright { - z-index: 21; -} - -.wp-site-blocks > [data-align=left] { - float: right; - margin-left: 2em; -} - -.wp-site-blocks > [data-align=right] { - float: left; - margin-right: 2em; -} - -.wp-site-blocks > [data-align=center] { - justify-content: center; - margin-right: auto; - margin-left: auto; -} - -/** - * In-Canvas Inserter - */ -.block-editor-block-list .block-editor-inserter { - margin: 8px; - cursor: move; - cursor: grab; -} - -@keyframes block-editor-inserter__toggle__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -.wp-block .block-list-appender .block-editor-inserter__toggle { - animation: block-editor-inserter__toggle__fade-in-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .wp-block .block-list-appender .block-editor-inserter__toggle { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender { - display: none; -} -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender .block-editor-inserter__toggle { - opacity: 0; - transform: scale(0); -} - -.block-editor-block-list__block .block-editor-block-list__block-html-textarea { - display: block; - margin: 0; - padding: 12px; - width: 100%; - border: none; - outline: none; - border-radius: 2px; - box-shadow: inset 0 0 0 1px #1e1e1e; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - line-height: 1.5; - transition: padding 0.2s linear; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-list__block .block-editor-block-list__block-html-textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-list__block .block-editor-block-list__block-html-textarea:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -/** - * Warnings. - */ -.block-editor-block-list__block .block-editor-warning { - z-index: 5; - position: relative; -} -.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning { - margin-bottom: auto; -} - -/** - * Insertion Point. - */ -.block-editor-block-list__insertion-point { - position: absolute; -} - -.block-editor-block-list__insertion-point-indicator { - position: absolute; - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__insertion-point.is-vertical > .block-editor-block-list__insertion-point-indicator { - top: 50%; - height: 1px; -} -.block-editor-block-list__insertion-point.is-horizontal > .block-editor-block-list__insertion-point-indicator { - top: 0; - left: 0; - right: 50%; - width: 1px; -} - -.block-editor-block-list__insertion-point-inserter { - display: none; - position: absolute; - justify-content: center; - top: calc(50% - 12px); - right: calc(50% - 12px); -} -@media (min-width: 480px) { - .block-editor-block-list__insertion-point-inserter { - display: flex; - } -} - -.block-editor-block-list__block-popover-inserter { - position: absolute; - top: -9999em; - margin-bottom: 14px; -} -.block-editor-block-list__block-popover-inserter.is-visible { - position: static; -} - -.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon { - background: #1e1e1e; - border-radius: 2px; - color: #fff; - padding: 0; - min-width: 24px; - height: 24px; -} -.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon:hover { - color: #fff; - background: var(--wp-admin-theme-color); -} - -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon { - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover { - background: #1e1e1e; -} - -/** - * Block Toolbar when contextual. - */ -.block-editor-block-contextual-toolbar { - display: inline-flex; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar { - border-left-color: #1e1e1e; -} -.block-editor-block-contextual-toolbar.is-fixed { - position: sticky; - top: 0; - width: 100%; - z-index: 31; - min-height: 48px; - display: block; - border: none; - border-bottom: 1px solid #e0e0e0; - border-radius: 0; -} -.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar { - border-left-color: #e0e0e0; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover-button { - overflow: hidden; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button { - min-width: 24px; - width: 24px; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button svg { - min-width: 24px; -} - -.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button:focus::before { - right: 0 !important; - min-width: 0; - width: 100%; -} -@media (min-width: 600px) { - .block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-up-button svg { - top: 5px; - } - .block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-down-button svg { - bottom: 5px; - } -} - -/** - * Block Label for Navigation/Selection Mode - */ -.block-editor-block-list__block-selection-button { - display: inline-flex; - padding: 0 12px; - z-index: 22; - border-radius: 2px; - background-color: #1e1e1e; - font-size: 13px; - height: 48px; -} -.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content { - margin: auto; - display: inline-flex; - align-items: center; -} -.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content > .components-flex__item { - margin-left: 6px; -} -.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle { - cursor: grab; - padding: 0; - height: 24px; - min-width: 24px; - margin-right: -2px; -} -.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle svg { - min-width: 18px; - min-height: 18px; -} -.block-editor-block-list__block-selection-button .block-editor-block-icon { - font-size: 13px; - color: #fff; - height: 48px; -} -.block-editor-block-list__block-selection-button .components-button { - min-width: 36px; - color: #fff; - height: 48px; - display: flex; -} -.block-editor-block-list__block-selection-button .components-button:focus { - box-shadow: none; - border: none; -} -.block-editor-block-list__block-selection-button .components-button:active { - color: #fff; -} -.block-editor-block-list__block-selection-button .block-selection-button_select-button.components-button { - padding: 0; -} - -/** - * Popovers. - */ -.block-editor-block-list__insertion-point-popover.is-without-arrow { - z-index: 28; - position: absolute; - pointer-events: none; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow * { - pointer-events: none; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter { - pointer-events: all; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter * { - pointer-events: all; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .components-popover__content.components-popover__content { - background: none; - border: none; - box-shadow: none; - overflow-y: visible; - margin-right: 0; -} - -@keyframes hide-during-dragging { - to { - position: fixed; - transform: translate(-9999px, 9999px); - } -} -.components-popover.block-editor-block-list__block-popover { - z-index: 31; - position: absolute; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content { - margin: 0 !important; - min-width: auto; - width: max-content; - background: none; - border: none; - box-shadow: none; - overflow-y: visible; - pointer-events: none; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__empty-block-inserter { - pointer-events: all; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar { - margin-top: 12px; - margin-bottom: 12px; -} -.components-popover.block-editor-block-list__block-popover.is-insertion-point-visible { - visibility: hidden; -} -.is-dragging-components-draggable .components-popover.block-editor-block-list__block-popover { - opacity: 0; - animation: hide-during-dragging 1ms linear forwards; -} - -.is-dragging-components-draggable .components-tooltip { - display: none; -} - -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, -.block-editor-block-toolbar .components-toolbar-group { - padding-right: 6px; - padding-left: 6px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon, -.block-editor-block-toolbar .components-toolbar-group .components-button, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon { - min-width: 36px; - padding-right: 6px; - padding-left: 6px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button svg, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar .components-toolbar-group .components-button svg, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon svg { - min-width: 24px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button::before, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar-group .components-button::before, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon::before { - right: 2px; - left: 2px; -} - -.is-vertical .block-list-appender { - width: 24px; - margin-left: auto; - margin-top: 12px; - margin-right: 12px; -} - -.block-list-appender > .block-editor-inserter { - display: block; -} - -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle { - opacity: 0; - transform: scale(0); -} - -.block-editor-block-lock-modal { - z-index: 1000001; -} -@media (min-width: 600px) { - .block-editor-block-lock-modal .components-modal__frame { - max-width: 480px; - } -} - -.block-editor-block-lock-modal__checklist { - margin: 0; -} - -.block-editor-block-lock-modal__options-title { - padding: 12px 0; -} -.block-editor-block-lock-modal__options-title .components-checkbox-control__label { - font-weight: 600; -} -.block-editor-block-lock-modal__options-title .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} - -.block-editor-block-lock-modal__checklist-item { - margin-bottom: 0; - padding: 12px 32px 12px 0; -} -.block-editor-block-lock-modal__checklist-item .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} -.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label { - display: flex; - align-items: center; - justify-content: space-between; - flex-grow: 1; -} -.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label svg { - margin-left: 12px; - fill: #1e1e1e; -} -.block-editor-block-lock-modal__checklist-item:hover { - background-color: #f0f0f0; - border-radius: 2px; -} - -.block-editor-block-lock-modal__actions { - margin-top: 24px; -} - -.block-editor-block-lock-toolbar .components-button.has-icon { - min-width: 36px !important; - padding-right: 0 !important; -} -.block-editor-block-lock-toolbar .components-button.has-icon:focus::before { - left: 8px !important; -} - -.block-editor-block-breadcrumb { - list-style: none; - padding: 0; - margin: 0; -} -.block-editor-block-breadcrumb li { - display: inline-flex; - margin: 0; -} -.block-editor-block-breadcrumb li .block-editor-block-breadcrumb__separator { - fill: currentColor; - margin-right: -4px; - margin-left: -4px; - transform: scaleX(-1);; -} -.block-editor-block-breadcrumb li:last-child .block-editor-block-breadcrumb__separator { - display: none; -} - -.block-editor-block-breadcrumb__button.components-button { - height: 24px; - line-height: 24px; - padding: 0; - position: relative; -} -.block-editor-block-breadcrumb__button.components-button:hover:not(:disabled) { - text-decoration: underline; - box-shadow: none; -} -.block-editor-block-breadcrumb__button.components-button:focus { - box-shadow: none; -} -.block-editor-block-breadcrumb__button.components-button:focus::before { - content: ""; - display: block; - position: absolute; - border-radius: 2px; - top: 1px; - left: 1px; - bottom: 1px; - right: 1px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.block-editor-block-breadcrumb__current { - cursor: default; -} - -.block-editor-block-breadcrumb__button.components-button, -.block-editor-block-breadcrumb__current { - color: #1e1e1e; - padding: 0 8px; - font-size: inherit; -} - -.block-editor-block-card { - display: flex; - align-items: flex-start; -} - -.block-editor-block-card__content { - flex-grow: 1; - margin-bottom: 4px; -} - -.block-editor-block-card__title { - font-weight: 500; -} -.block-editor-block-card__title.block-editor-block-card__title { - line-height: 24px; - margin: 0 0 4px; -} - -.block-editor-block-card__description { - font-size: 13px; -} - -.block-editor-block-card .block-editor-block-icon { - flex: 0 0 24px; - margin-right: 0; - margin-left: 12px; - width: 24px; - height: 24px; -} - -/** - * Invalid block comparison - */ -.block-editor-block-compare { - height: auto; -} - -.block-editor-block-compare__wrapper { - display: flex; - padding-bottom: 16px; -} -.block-editor-block-compare__wrapper > div { - display: flex; - justify-content: space-between; - flex-direction: column; - width: 50%; - padding: 0 0 0 16px; - min-width: 200px; - max-width: 600px; -} -.block-editor-block-compare__wrapper > div button { - float: left; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__converted { - border-right: 1px solid #ddd; - padding-right: 15px; - padding-left: 0; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html { - font-family: Menlo, Consolas, monaco, monospace; - font-size: 12px; - color: #1e1e1e; - border-bottom: 1px solid #ddd; - padding-bottom: 15px; - line-height: 1.7; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span { - background-color: #e6ffed; - padding-top: 3px; - padding-bottom: 3px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__added { - background-color: #acf2bd; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__removed { - background-color: #cc1818; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__preview { - padding: 0; - padding-top: 16px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__preview p { - font-size: 12px; - margin-top: 0; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__action { - margin-top: 16px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__heading { - font-size: 1em; - font-weight: 400; - margin: 0.67em 0; -} - -.block-editor-block-content-overlay.overlay-active::before { - content: ""; - position: absolute; - top: 0; - right: 0; - width: 100%; - height: 100%; - background: transparent; - border: none; - border-radius: 2px; - z-index: 10; -} -.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before { - background: rgba(var(--wp-admin-theme-color--rgb), 0.1); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) inset; -} -.block-editor-block-content-overlay.overlay-active:not(.is-dragging-blocks) * { - pointer-events: none; -} -.block-editor-block-content-overlay.is-dragging-blocks { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} - -.block-editor-block-draggable-chip-wrapper { - position: absolute; - top: -24px; - right: 0; -} - -.block-editor-block-draggable-chip { - background-color: #1e1e1e; - border-radius: 2px; - box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3); - color: #fff; - cursor: grabbing; - display: inline-flex; - height: 48px; - padding: 0 13px; - -webkit-user-select: none; - user-select: none; -} -.block-editor-block-draggable-chip svg { - fill: currentColor; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content { - margin: auto; - justify-content: flex-start; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content > .components-flex__item { - margin-left: 6px; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content > .components-flex__item:last-child { - margin-left: 0; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content .block-editor-block-icon svg { - min-width: 18px; - min-height: 18px; -} -.block-editor-block-draggable-chip .components-flex__item { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.block-editor-block-list__layout .is-dragging { - background-color: currentColor !important; - opacity: 0.05 !important; - border-radius: 2px !important; - pointer-events: none !important; -} -.block-editor-block-list__layout .is-dragging::selection { - background: transparent !important; -} -.block-editor-block-list__layout .is-dragging::after { - content: none !important; -} - -.block-editor-block-mobile-toolbar { - display: flex; - flex-direction: row; - border-left: 1px solid #ddd; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover-button { - width: 36px; - height: 36px; - border-radius: 2px; - padding: 3px; - margin: 0; - justify-content: center; - align-items: center; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover-button .dashicon { - margin: auto; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover { - display: flex; - margin-left: auto; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover .block-editor-block-mover-button { - float: right; -} - -.block-editor-block-mover-button__description { - display: none; -} - -.block-editor-block-mover-button.has-icon { - padding: 0; -} - -.block-editor-block-mover { - display: inline-flex; - flex-direction: row; -} -.block-editor-block-mover .block-editor-block-mover__move-button-container, -.block-editor-block-mover .components-toolbar { - flex: 1; - flex-direction: row; - border-left: none !important; - padding: 0; -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover__move-button-container, -.block-editor-block-mover .components-toolbar { - flex-direction: column; - } -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container, .block-editor-block-mover.is-horizontal .components-toolbar { - flex-direction: row; -} -.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button { - padding-left: 0; - padding-right: 0; - min-width: 36px; -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover-button { - height: 24px; - width: 42px; - padding-left: 11px !important; - padding-right: 6px !important; - } - .block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button { - min-width: 42px; - } -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover-button::before { - right: 8px !important; - left: 8px !important; - } -} -.block-editor-block-mover .block-editor-block-mover__drag-handle { - width: 24px; - cursor: grab; - min-width: 24px !important; - padding: 0 !important; -} -.block-editor-block-mover .block-editor-block-mover__drag-handle:focus::before { - right: 0 !important; - left: 0 !important; -} -@media (min-width: 600px) { - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button { - margin: 0 0 0 auto; - } - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-up-button::before, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-up-button::before { - bottom: 0; - height: calc(100% - 1px); - } - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-down-button::before, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-down-button::before { - top: 0; - height: calc(100% - 1px); - } -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon { - height: 48px; - width: 24px; - padding-right: 0; - padding-left: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon::before { - top: 1px; - bottom: 1px; - min-width: 0; - width: auto; - height: auto; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon svg { - margin-right: 0; - margin-left: -8px; - margin-bottom: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon::before { - right: 0 !important; - left: 0 !important; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon svg { - margin-right: -8px; - margin-left: 0; - margin-top: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon::before { - right: 0 !important; - left: 0 !important; - width: calc(100% + 1px); -} - -.block-editor-block-navigation__container { - min-width: 280px; -} - -.block-editor-block-navigation__label { - margin: 0 0 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-block-parent-selector { - background: #fff; - border-radius: 2px; -} -.block-editor-block-parent-selector .block-editor-block-parent-selector__button { - width: 48px; - height: 48px; - border: 1px solid #1e1e1e; - border-radius: 2px; -} - -.block-editor-block-patterns-list__list-item { - cursor: pointer; - margin-bottom: 24px; -} -.block-editor-block-patterns-list__list-item.is-placeholder { - min-height: 100px; -} -.block-editor-block-patterns-list__list-item[draggable=true] .block-editor-block-preview__container { - cursor: grab; -} - -.block-editor-block-patterns-list__item { - height: 100%; -} -.block-editor-block-patterns-list__item .block-editor-block-preview__container { - display: flex; - align-items: center; - overflow: hidden; - border-radius: 2px; - border: 1px solid #f0f0f0; -} -.block-editor-block-patterns-list__item .block-editor-block-patterns-list__item-title { - padding-top: 8px; - font-size: 12px; - text-align: center; -} -.block-editor-block-patterns-list__item:hover .block-editor-block-preview__container { - border: 1px solid var(--wp-admin-theme-color); -} -.block-editor-block-patterns-list__item:focus .block-editor-block-preview__container { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-patterns-list__item:hover .block-editor-block-patterns-list__item-title, .block-editor-block-patterns-list__item:focus .block-editor-block-patterns-list__item-title { - color: var(--wp-admin-theme-color); -} - -.block-editor-block-preview__container { - position: relative; - width: 100%; - overflow: hidden; -} -.block-editor-block-preview__container .block-editor-block-preview__content { - top: 0; - right: 0; - transform-origin: top right; - text-align: initial; - margin: 0; - overflow: visible; - min-height: auto; -} -.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-list__insertion-point, -.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-drop-zone, -.block-editor-block-preview__container .block-editor-block-preview__content .reusable-block-indicator, -.block-editor-block-preview__container .block-editor-block-preview__content .block-list-appender { - display: none; -} - -.block-editor-block-preview__content-iframe .block-list-appender { - display: none; -} - -.block-editor-block-preview__live-content * { - pointer-events: none; -} -.block-editor-block-preview__live-content .block-list-appender { - display: none; -} -.block-editor-block-preview__live-content .components-button:disabled { - opacity: initial; -} -.block-editor-block-preview__live-content .components-placeholder, -.block-editor-block-preview__live-content .block-editor-block-list__block[data-empty=true] { - display: none; -} - -.block-editor-block-settings-menu__popover .components-dropdown-menu__menu { - padding: 0; -} - -.block-editor-block-styles + .default-style-picker__default-switcher { - margin-top: 16px; -} - -.block-editor-block-styles__preview-panel { - display: none; - position: absolute; - left: 16px; - right: auto; - z-index: 90; -} -@media (min-width: 782px) { - .block-editor-block-styles__preview-panel { - display: block; - } -} -.block-editor-block-styles__preview-panel .block-editor-inserter__preview-container { - right: auto; - left: auto; - top: auto; - position: static; -} -.block-editor-block-styles__preview-panel .block-editor-block-card__title.block-editor-block-card__title { - margin: 0; -} -.block-editor-block-styles__preview-panel .block-editor-block-icon { - display: none; -} - -.block-editor-block-styles__variants { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - gap: 8px; -} -.block-editor-block-styles__variants .block-editor-block-styles__item { - color: #2f2f2f; - box-shadow: inset 0 0 0 1px #ccc; - display: inline-block; - width: calc(50% - 4px); -} -.block-editor-block-styles__variants .block-editor-block-styles__item:focus, .block-editor-block-styles__variants .block-editor-block-styles__item:hover { - color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color); -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover { - background-color: #2f2f2f; - box-shadow: none; -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text { - color: #fff; -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color); -} - -.block-editor-block-styles__block-preview-container, -.block-editor-block-styles__block-preview-container * { - box-sizing: border-box !important; -} - -.block-editor-block-switcher { - position: relative; - padding: 0 6px; -} -.block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon { - min-width: 36px; -} - -.block-editor-block-switcher__no-switcher-icon, -.block-editor-block-switcher__toggle { - position: relative; -} - -.components-button.block-editor-block-switcher__toggle, -.components-button.block-editor-block-switcher__no-switcher-icon { - margin: 0; - display: block; - height: 48px; -} -.components-button.block-editor-block-switcher__toggle .block-editor-block-icon, -.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - margin: auto; -} - -.block-editor-block-switcher__toggle-text { - margin-right: 8px; -} -.show-icon-labels .block-editor-block-switcher__toggle-text { - display: none; -} - -.show-icon-labels .block-editor-block-toolbar .block-editor-block-switcher .components-button.has-icon::after { - font-size: 14px; -} - -.block-editor-block-switcher__popover { - margin-right: 6px; -} - -.components-button.block-editor-block-switcher__no-switcher-icon { - display: flex; - padding: 6px 12px !important; -} -.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - margin-left: auto; - margin-right: auto; - min-width: 24px !important; -} - -.components-button.block-editor-block-switcher__no-switcher-icon:disabled { - opacity: 1; -} -.components-button.block-editor-block-switcher__no-switcher-icon:disabled, -.components-button.block-editor-block-switcher__no-switcher-icon:disabled .block-editor-block-icon.has-colors { - color: #1e1e1e; -} - -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon { - height: 100%; - position: relative; - margin: 0 auto; - display: flex; - align-items: center; - min-width: 100%; -} -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon::before { - top: 8px; - left: 8px; - bottom: 8px; - right: 8px; -} - -.components-popover.block-editor-block-switcher__popover .components-popover__content { - min-width: 300px; -} - -.components-popover.block-editor-block-switcher__popover .components-popover__content > div { - min-width: auto; - display: flex; - background: #fff; - padding: 0; -} -.components-popover.block-editor-block-switcher__popover .components-popover__content > div .components-menu-group { - margin: 0; -} - -.block-editor-block-switcher__popover .components-popover__content .block-editor-block-styles { - margin: 0 -3px; -} -.block-editor-block-switcher__popover .components-popover__content .components-panel__body { - border: 0; - position: relative; - z-index: 1; -} -.block-editor-block-switcher__popover .components-popover__content .components-panel__body + .components-panel__body { - border-top: 1px solid #e0e0e0; -} - -.block-editor-block-switcher__popover__preview__parent .block-editor-block-switcher__popover__preview__container { - position: absolute; - top: -12px; - right: calc(100% + 32px); -} - -.block-editor-block-switcher__preview__popover { - display: none; -} -.block-editor-block-switcher__preview__popover.components-popover { - margin-right: 4px; - margin-top: 11px; -} -@media (min-width: 782px) { - .block-editor-block-switcher__preview__popover { - display: block; - } -} -.block-editor-block-switcher__preview__popover .components-popover__content { - box-shadow: none; - border: 1px solid #1e1e1e; - background: #fff; - border-radius: 2px; -} -.block-editor-block-switcher__preview__popover .block-editor-block-switcher__preview { - width: 300px; - height: auto; - max-height: 500px; - padding: 16px; -} - -.block-editor-block-switcher__preview-title { - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon { - min-width: 36px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle { - height: 48px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform { - width: 48px; - height: 48px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform { - padding: 12px; -} - -.block-editor-block-switcher__preview-patterns-container { - padding-bottom: 16px; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item { - margin-top: 16px; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-preview__container { - cursor: pointer; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item { - height: 100%; - border-radius: 2px; - transition: all 0.05s ease-in-out; - position: relative; - border: 1px solid transparent; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover, .block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:focus { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item .block-editor-block-switcher__preview-patterns-container-list__item-title { - padding: 4px; - font-size: 12px; - text-align: center; - cursor: pointer; -} - -.block-editor-block-types-list > [role=presentation] { - overflow: hidden; - display: flex; - flex-wrap: wrap; -} - -.block-editor-block-variation-picker .components-placeholder__instructions { - margin-bottom: 0; -} -.block-editor-block-variation-picker .components-placeholder__fieldset { - flex-direction: column; -} -.block-editor-block-variation-picker.has-many-variations .components-placeholder__fieldset { - max-width: 90%; -} - -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations { - display: flex; - justify-content: flex-start; - flex-direction: row; - flex-wrap: wrap; - width: 100%; - margin: 16px 0; - padding: 0; - list-style: none; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations > li { - list-style: none; - margin: 8px 0 0 20px; - flex-shrink: 1; - width: 75px; - text-align: center; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations > li button { - display: inline-flex; - margin-left: 0; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation { - padding: 8px; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation-label { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 12px; - display: block; - line-height: 1.4; -} - -.block-editor-block-variation-picker__variation { - width: 100%; -} -.block-editor-block-variation-picker__variation.components-button.has-icon { - justify-content: center; - width: auto; -} -.block-editor-block-variation-picker__variation.components-button.has-icon.is-secondary { - background-color: #fff; -} -.block-editor-block-variation-picker__variation.components-button { - height: auto; - padding: 0; -} -.block-editor-block-variation-picker__variation::before { - content: ""; - padding-bottom: 100%; -} -.block-editor-block-variation-picker__variation:first-child { - margin-right: 0; -} -.block-editor-block-variation-picker__variation:last-child { - margin-left: 0; -} - -.block-editor-block-pattern-setup { - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-start; - width: 100%; - border-radius: 2px; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar { - justify-content: center; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container { - column-gap: 24px; - display: block; - width: 100%; - padding: 32px; - column-count: 2; -} -@media (min-width: 1440px) { - .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container { - column-count: 3; - } -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container, -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button] { - cursor: pointer; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item { - break-inside: avoid-column; - margin-bottom: 24px; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container { - min-height: 100px; - border-radius: 2px; - border: 1px solid #ddd; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content { - width: 100%; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar { - height: 60px; - box-sizing: border-box; - padding: 16px; - width: 100%; - text-align: right; - margin: 0; - color: #1e1e1e; - border-radius: 2px 2px 0 0; - background-color: #fff; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - border-top: 1px solid #ddd; - align-self: flex-end; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls { - display: flex; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__navigation, -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions { - width: calc(50% - 36px); - display: flex; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions { - justify-content: flex-end; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container { - display: flex; - flex-direction: column; - width: 100%; - box-sizing: border-box; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container { - overflow: hidden; - position: relative; - padding: 0; - margin: 0; - list-style: none; - transform-style: preserve-3d; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container * { - box-sizing: border-box; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide { - position: absolute; - top: 0; - width: 100%; - margin: auto; - padding: 0; - transition: transform 0.5s, z-index 0.5s; - z-index: 100; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide { - opacity: 1; - position: relative; - z-index: 102; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.previous-slide { - transform: translateX(100%); - z-index: 101; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.next-slide { - transform: translateX(-100%); - z-index: 101; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .block-list-appender { - display: none; -} - -.block-editor-block-pattern-setup__carousel, -.block-editor-block-pattern-setup__grid { - width: 100%; - overflow-y: auto; -} - -.block-editor-block-variation-transforms { - padding: 0 52px 16px 16px; - width: 100%; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle { - border: 1px solid #757575; - border-radius: 2px; - min-height: 30px; - width: 100%; - position: relative; - text-align: right; - justify-content: left; - padding: 6px 12px; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle.components-dropdown-menu__toggle { - padding-left: 24px; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled) { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color); -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg { - height: 100%; - padding: 0; - position: absolute; - left: 0; - top: 0; -} - -.block-editor-block-variation-transforms__popover .components-popover__content { - min-width: 230px; -} - -.components-border-radius-control { - margin-bottom: 12px; -} -.components-border-radius-control legend { - margin-bottom: 8px; -} -.components-border-radius-control .components-border-radius-control__wrapper { - display: flex; - justify-content: space-between; - align-items: flex-start; -} -.components-border-radius-control .components-border-radius-control__wrapper > .components-unit-control-wrapper { - width: calc(50% - 26px); - margin-bottom: 0; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control { - width: calc(50% - 26px); - margin-bottom: 0; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-base-control__field { - margin-bottom: 0; - height: 30px; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-range-control__wrapper { - margin-left: 10px; -} -.components-border-radius-control .components-border-radius-control__wrapper > span { - flex: 0 0 auto; -} -.components-border-radius-control .components-border-radius-control__input-controls-wrapper { - display: flex; - width: 70%; - flex-wrap: wrap; -} -.components-border-radius-control .components-border-radius-control__input-controls-wrapper .components-unit-control-wrapper { - width: calc(50% - 8px); - margin-bottom: 8px; - margin-left: 8px; -} -.components-border-radius-control .component-border-radius-control__linked-button.has-icon { - display: flex; - justify-content: center; -} -.components-border-radius-control .component-border-radius-control__linked-button.has-icon svg { - margin-left: 0; -} - -.components-border-style-control legend { - line-height: 1.4; - margin-bottom: 8px; - padding: 0; -} -.components-border-style-control .components-border-style-control__buttons { - display: inline-flex; -} -.components-border-style-control .components-border-style-control__buttons .components-button.has-icon { - min-width: 30px; - height: 30px; - padding: 3px; - margin-left: 4px; -} - -.block-editor-button-block-appender { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: 100%; - height: auto; - color: #1e1e1e; - box-shadow: inset 0 0 0 1px #1e1e1e; -} -.block-editor-button-block-appender.components-button.components-button { - padding: 12px; -} -.is-dark-theme .block-editor-button-block-appender { - color: rgba(255, 255, 255, 0.65); - box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65); -} -.block-editor-button-block-appender:hover { - color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-button-block-appender:focus { - box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color); -} -.block-editor-button-block-appender:active { - color: #000; -} - -.block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator { - margin-bottom: 12px; -} - -.block-editor-color-gradient-control__fieldset { - min-width: 0; -} - -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title { - display: flex; - gap: 8px; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator { - width: 12px; - height: 12px; - align-self: center; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child { - margin-right: 12px; -} -.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator { - display: none; -} -@media screen and (min-width: 782px) { - .block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches { - display: grid; - grid-template-columns: repeat(6, 28px); - justify-content: space-between; - } -} -.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control { - margin-bottom: inherit; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown { - display: block; -} - -.block-editor-panel-color-gradient-settings__dropdown { - width: 100%; -} - -.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content > div { - width: 280px; -} - -@media (min-width: 782px) { - .block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content { - margin-left: 156px !important; - } - .block-editor-panel-color-gradient-settings__dropdown-content.is-from-top .components-popover__content { - margin-top: -60px !important; - } - .block-editor-panel-color-gradient-settings__dropdown-content.is-from-bottom .components-popover__content { - margin-bottom: -60px !important; - } -} -.block-editor-panel-color-gradient-settings__dropdown:last-child > div { - border-bottom-width: 0; -} - -.block-editor-panel-color-gradient-settings__item { - padding-top: 12px !important; - padding-bottom: 12px !important; -} -.block-editor-panel-color-gradient-settings__item .block-editor-panel-color-gradient-settings__color-indicator { - background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} -.block-editor-panel-color-gradient-settings__item.is-open { - background: #f0f0f0; - color: var(--wp-admin-theme-color); -} - -.block-editor-contrast-checker > .components-notice { - margin: 0; -} - -/** - * Default block appender. - * - * This component shows up in 3 places: - * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph - * - on the right, inside empty paragraphs - * - absolute positioned and blue inside nesting containers - */ -.block-editor-default-block-appender { - clear: both; - margin-right: auto; - margin-left: auto; - position: relative; -} -.block-editor-default-block-appender[data-root-client-id=""] .block-editor-default-block-appender__content:hover { - outline: 1px solid transparent; -} -.block-editor-default-block-appender .block-editor-default-block-appender__content { - opacity: 0.62; -} -.block-editor-default-block-appender .components-drop-zone__content-icon { - display: none; -} - -.block-editor-default-block-appender .block-editor-inserter, -.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter { - position: absolute; - top: 0; - left: 0; - line-height: 0; -} -.block-editor-default-block-appender .block-editor-inserter:disabled, -.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled { - display: none; -} - -/** - * Fixed position appender. - * These styles apply to all in-canvas inserters that exist inside nesting containers. - */ -.block-editor-block-list__block .block-list-appender { - position: absolute; - list-style: none; - padding: 0; - z-index: 2; - bottom: 0; - left: 0; -} -.block-editor-block-list__block .block-list-appender.block-list-appender { - margin: 0; - line-height: 0; -} -.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender { - height: 24px; -} -.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block .block-list-appender .block-list-appender__toggle { - flex-direction: row; - box-shadow: none; - height: 24px; - width: 24px; - display: none; - padding: 0 !important; - background: #1e1e1e; - color: #fff; -} -.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover { - color: #fff; - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content { - display: none; -} -.block-editor-block-list__block .block-list-appender:only-child { - position: relative; - left: auto; - align-self: center; - list-style: none; - line-height: inherit; -} -.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content { - display: block; -} - -.block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle, -.block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle { - display: flex; -} - -.block-editor-default-block-appender__content { - cursor: text; -} - -.block-editor-date-format-picker { - margin-bottom: 16px; -} - -.block-editor-date-format-picker__default-format-toggle-control__hint { - color: #757575; - display: block; -} - -.block-editor-date-format-picker__custom-format-select-control.components-base-control { - margin-bottom: 0; -} -.block-editor-date-format-picker__custom-format-select-control .components-custom-select-control__button { - width: 100%; -} - -.block-editor-date-format-picker__custom-format-select-control__custom-option { - border-top: 1px solid #ddd; -} -.block-editor-date-format-picker__custom-format-select-control__custom-option.has-hint { - grid-template-columns: auto 30px; -} -.block-editor-date-format-picker__custom-format-select-control__custom-option .components-custom-select-control__item-hint { - grid-row: 2; - text-align: right; -} - -.block-editor-duotone-control__popover > .components-popover__content > div { - padding: 16px; - width: 280px; -} -.block-editor-duotone-control__popover .components-menu-group__label { - padding: 0; -} -.block-editor-duotone-control__popover .components-custom-gradient-picker__gradient-bar { - margin: 16px 0 12px; -} -.block-editor-duotone-control__popover .components-circular-option-picker__swatches { - display: grid; - grid-template-columns: repeat(6, 28px); - gap: 12px; - justify-content: space-between; -} - -.block-editor-duotone-control__description { - margin: 16px 0; - font-size: 12px; -} - -.block-editor-duotone-control__popover:not([data-y-axis=middle][data-x-axis=right]) > .components-popover__content { - margin-right: -14px; -} - -.components-font-appearance-control { - margin-bottom: 24px; -} -.components-font-appearance-control ul li { - color: #1e1e1e; - text-transform: capitalize; -} - -.block-editor-image-size-control { - margin-bottom: 1em; -} -.block-editor-image-size-control .block-editor-image-size-control__row { - display: flex; - justify-content: space-between; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width, -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height { - margin-bottom: 0.5em; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width input, -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height input { - line-height: 1.25; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width { - margin-left: 5px; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height { - margin-right: 5px; -} - -.block-editor-block-list__layout.has-overlay::after { - content: ""; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 60; -} - -.block-editor-block-types-list__list-item { - display: block; - width: 33.33%; - padding: 0; - margin: 0; -} - -.components-button.block-editor-block-types-list__item { - display: flex; - flex-direction: column; - width: 100%; - font-size: 13px; - color: #1e1e1e; - padding: 8px; - align-items: stretch; - justify-content: center; - cursor: pointer; - background: transparent; - word-break: break-word; - border-radius: 2px; - transition: all 0.05s ease-in-out; - position: relative; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .components-button.block-editor-block-types-list__item { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button.block-editor-block-types-list__item:disabled { - opacity: 0.6; - cursor: default; -} -.components-button.block-editor-block-types-list__item:not(:disabled):hover { - color: var(--wp-admin-theme-color) !important; -} -.components-button.block-editor-block-types-list__item:not(:disabled):focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.block-editor-block-types-list__item:not(:disabled).is-active { - color: #fff; - background: #1e1e1e; - outline: 2px solid transparent; - outline-offset: -2px; -} - -.block-editor-block-types-list__item-icon { - padding: 12px 20px; - border-radius: 2px; - color: #1e1e1e; - transition: all 0.05s ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-types-list__item-icon { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-types-list__item-icon .block-editor-block-icon { - margin-right: auto; - margin-left: auto; -} -.block-editor-block-types-list__item-icon svg { - transition: all 0.15s ease-out; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-types-list__item-icon svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-types-list__list-item[draggable=true] .block-editor-block-types-list__item-icon { - cursor: grab; -} - -.block-editor-block-types-list__item-title { - padding: 4px 2px 8px; - font-size: 12px; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.block-editor-link-control { - position: relative; - min-width: 360px; -} -.components-popover__content .block-editor-link-control { - min-width: auto; - width: 90vw; - max-width: 360px; -} - -.block-editor-link-control__search-input-wrapper { - position: relative; -} - -.block-editor-link-control__search-input-container { - position: relative; -} - -.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input { - flex: 1; -} - -.block-editor-link-control__field { - margin: 16px; -} -.block-editor-link-control__field > .components-base-control__field { - display: flex; - align-items: center; - margin: 0; -} -.block-editor-link-control__field .components-base-control__label { - margin-left: 16px; - margin-bottom: 0; -} -.block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - width: calc(100% - 32px); - display: block; - padding: 11px 16px; - padding-left: 36px; - margin: 0; - position: relative; - border: 1px solid #ddd; - border-radius: 2px; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.block-editor-link-control__field input[type=text]:focus, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-link-control__field input[type=text]::-webkit-input-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.block-editor-link-control__field input[type=text]::-moz-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.block-editor-link-control__field input[type=text]:-ms-input-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.block-editor-link-control__search-error { - margin: -8px 16px 16px; -} - -.block-editor-link-control__search-actions { - position: absolute; - /* - * Actions must be positioned on top of URLInput, since the input will grow - * when suggestions are rendered. - * - * Compensate for: - * - Border (1px) - * - Vertically, for the difference in height between the input (40px) and - * the icon buttons. - * - Horizontally, pad to the minimum of: default input padding, or the - * equivalent of the vertical padding. - */ - top: 3px; - left: 19px; -} - -.components-button .block-editor-link-control__search-submit .has-icon { - margin: -1px; -} - -.block-editor-link-control__search-results-wrapper { - position: relative; - margin-top: -15px; -} -.block-editor-link-control__search-results-wrapper::before, .block-editor-link-control__search-results-wrapper::after { - content: ""; - position: absolute; - right: -1px; - left: 16px; - display: block; - pointer-events: none; - z-index: 100; -} -.block-editor-link-control__search-results-wrapper::before { - height: 8px; - top: 0; - bottom: auto; -} -.block-editor-link-control__search-results-wrapper::after { - height: 16px; - bottom: 0; - top: auto; -} - -.block-editor-link-control__search-results-label { - padding: 16px 32px 0; - display: block; - font-weight: 600; -} - -.block-editor-link-control__search-results { - margin: 0; - padding: 8px 16px 8px; - max-height: 200px; - overflow-y: auto; -} -.block-editor-link-control__search-results.is-loading { - opacity: 0.2; -} - -.block-editor-link-control__search-item { - position: relative; - display: flex; - align-items: flex-start; - font-size: 13px; - cursor: pointer; - background: #fff; - width: 100%; - border: none; - text-align: right; - padding: 12px 16px; - border-radius: 2px; - height: auto; -} -.block-editor-link-control__search-item:hover, .block-editor-link-control__search-item:focus { - background-color: #f0f0f0; -} -.block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type, .block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type { - background: #fff; -} -.block-editor-link-control__search-item:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset; -} -.block-editor-link-control__search-item.is-selected { - background: #f0f0f0; -} -.block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type { - background: #fff; -} -.block-editor-link-control__search-item.is-current { - flex-direction: column; - background: transparent; - border: 0; - width: 100%; - cursor: default; - padding: 16px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-header { - display: block; - flex-direction: row; - align-items: flex-start; - margin-left: 8px; - white-space: pre-wrap; - overflow-wrap: break-word; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info { - word-break: break-all; -} -.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header { - display: flex; - flex: 1; -} -.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-header { - align-items: center; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-icon { - position: relative; - top: 0.2em; - margin-left: 8px; - max-height: 24px; - flex-shrink: 0; - width: 24px; - display: flex; - justify-content: center; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-icon img { - width: 16px; -} -.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-icon { - top: 0; - width: 32px; - max-height: 32px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info, -.block-editor-link-control__search-item .block-editor-link-control__search-item-title { - overflow: hidden; - text-overflow: ellipsis; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon, -.block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon { - position: absolute; - left: 0; - margin-top: 0; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title { - display: block; - margin-bottom: 0.2em; - font-weight: 500; - position: relative; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark { - font-weight: 700; - color: inherit; - background-color: transparent; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title span { - font-weight: normal; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title svg { - display: none; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info { - display: block; - color: #757575; - font-size: 0.9em; - line-height: 1.3; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice { - font-style: italic; - font-size: 1.1em; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-type { - display: block; - padding: 3px 6px; - margin-right: auto; - font-size: 0.9em; - background-color: #f0f0f0; - border-radius: 2px; - white-space: nowrap; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description { - padding-top: 12px; - margin: 0; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder { - margin-top: 12px; - padding-top: 0; - height: 28px; - display: flex; - flex-direction: column; - justify-content: space-around; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder::before, .block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder::after { - display: block; - content: ""; - height: 0.7em; - width: 100%; - background-color: #f0f0f0; - border-radius: 3px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description .components-text { - font-size: 0.9em; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image { - display: flex; - width: 100%; - background-color: #f0f0f0; - justify-content: center; - height: 140px; - max-height: 140px; - overflow: hidden; - border-radius: 2px; - margin-top: 12px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image.is-placeholder { - background-color: #f0f0f0; - border-radius: 3px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image img { - display: block; - max-width: 100%; - height: 140px; - max-height: 140px; -} - -.block-editor-link-control__search-item-top { - display: flex; - flex-direction: row; - width: 100%; -} - -.block-editor-link-control__search-item-bottom { - transition: opacity 1.5s; - width: 100%; -} - -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description::before, .block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description::after { - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-image { - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon svg, -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon img { - opacity: 0; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon::before { - content: ""; - display: block; - background-color: #f0f0f0; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - border-radius: 100%; - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} - -.block-editor-link-control__loading { - margin: 16px; - display: flex; - align-items: center; -} -.block-editor-link-control__loading .components-spinner { - margin-top: 0; -} - -.components-button + .block-editor-link-control__search-create { - overflow: visible; - padding: 12px 16px; -} -.components-button + .block-editor-link-control__search-create::before { - content: ""; - position: absolute; - top: -10px; - right: 0; - display: block; - width: 100%; -} - -.block-editor-link-control__search-create { - align-items: center; -} -.block-editor-link-control__search-create .block-editor-link-control__search-item-title { - margin-bottom: 0; -} -.block-editor-link-control__search-create .block-editor-link-control__search-item-icon { - top: 0; -} - -.block-editor-link-control__search-results div[role=menu] > .block-editor-link-control__search-item.block-editor-link-control__search-item { - padding: 10px; -} - -.block-editor-link-control__tools { - display: flex; - align-items: center; - border-top: 1px solid #ddd; - margin: 0; - padding: 16px; -} - -.block-editor-link-control__unlink { - padding-right: 16px; - padding-left: 16px; -} - -.block-editor-link-control__settings { - flex: 1; - margin: 0; -} -.block-editor-link-control__settings :last-child { - margin-bottom: 0; -} -.is-alternate .block-editor-link-control__settings { - border-top: 1px solid #1e1e1e; -} - -.block-editor-link-control__setting { - margin-bottom: 16px; -} -.block-editor-link-control__setting :last-child { - margin-bottom: 0; -} - -.block-editor-link-control .block-editor-link-control__search-input .components-spinner { - display: block; -} -.block-editor-link-control .block-editor-link-control__search-input .components-spinner.components-spinner { - position: absolute; - right: auto; - bottom: auto; - /* - * Position spinner to the left of the actions. - * - * Compensate for: - * - Input padding right ($button-size) - */ - top: calc(50% - 16px / 2); - left: 36px; -} - -.block-editor-link-control__search-item-action { - margin-right: auto; - flex-shrink: 0; -} - -.block-editor-list-view-tree { - width: 100%; - border-collapse: collapse; - padding: 0; - margin: 0; -} -.components-modal__content .block-editor-list-view-tree { - margin: -12px -6px 0; - width: calc(100% + 12px); -} - -.block-editor-list-view-leaf { - position: relative; -} -.block-editor-list-view-leaf.is-selected td { - background: var(--wp-admin-theme-color); -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents, .block-editor-list-view-leaf.is-selected .components-button.has-icon { - color: #fff; -} -.is-dragging-components-draggable .block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents { - background: none; - color: #1e1e1e; -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents:focus::after { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block__menu:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #fff; -} -.block-editor-list-view-leaf.is-dragging { - display: none; -} -.block-editor-list-view-leaf.is-first-selected td:first-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf.is-first-selected td:last-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf.is-last-selected td:first-child { - border-bottom-right-radius: 2px; -} -.block-editor-list-view-leaf.is-last-selected td:last-child { - border-bottom-left-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) { - background: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), linear-gradient(var(--wp-admin-theme-color), var(--wp-admin-theme-color)); -} -.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:first-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:last-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:first-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:last-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:first-child { - border-bottom-right-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:last-child { - border-bottom-left-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) td { - border-radius: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents { - display: flex; - align-items: center; - width: 100%; - height: auto; - padding: 6px 0 6px 12px; - text-align: right; - color: #1e1e1e; - border-radius: 2px; - position: relative; - white-space: nowrap; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents.is-dropping-before::before { - content: ""; - position: absolute; - pointer-events: none; - transition: border-color 0.1s linear, border-style 0.1s linear, box-shadow 0.1s linear; - top: -2px; - left: 0; - right: 0; - border-top: 4px solid var(--wp-admin-theme-color); -} -.components-modal__content .block-editor-list-view-leaf .block-editor-list-view-block-contents { - padding-right: 0; - padding-left: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus { - box-shadow: none; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus::after { - content: ""; - position: absolute; - top: 0; - left: -29px; - bottom: 0; - right: 0; - border-radius: inherit; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - z-index: 2; - pointer-events: none; -} -.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block-contents:focus::after { - box-shadow: none; -} -.block-editor-list-view-leaf.has-single-cell .block-editor-list-view-block-contents:focus::after { - left: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - z-index: 1; -} -.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block__menu:focus { - box-shadow: none; -} -.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents { - opacity: 1; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-block-icon { - align-self: flex-start; - margin-left: 8px; - width: 24px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__contents-cell { - padding-top: 0; - padding-bottom: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell { - line-height: 0; - width: 36px; - vertical-align: middle; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell > * { - opacity: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible { - position: relative; - z-index: 1; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover > *, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible > * { - opacity: 1; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover > *, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible > * { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell .components-button.has-icon { - width: 24px; - min-width: 24px; - padding: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell { - padding-left: 5px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon { - height: 24px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell-alignment-wrapper { - display: flex; - height: 100%; - flex-direction: column; - align-items: center; -} -.block-editor-list-view-leaf .block-editor-block-mover-button { - position: relative; - width: 36px; - height: 24px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button svg { - position: relative; - height: 24px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button { - margin-top: -6px; - align-items: flex-end; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button svg { - bottom: -4px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button { - margin-bottom: -6px; - align-items: flex-start; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button svg { - top: -4px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus:enabled { - box-shadow: none; - outline: none; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus { - box-shadow: none; - outline: none; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} -.block-editor-list-view-leaf .block-editor-block-mover-button::before { - content: ""; - position: absolute; - display: block; - border-radius: 2px; - height: 16px; - min-width: 100%; - right: 0; - left: 0; - animation: components-button__appear-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-block-mover-button::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-inserter__toggle { - background: #1e1e1e; - color: #fff; - height: 24px; - margin: 6px 1px 6px 6px; - min-width: 24px; -} -.block-editor-list-view-leaf .block-editor-inserter__toggle:active { - color: #fff; -} -.block-editor-list-view-leaf .block-editor-list-view-block-select-button__anchor { - background: rgba(0, 0, 0, 0.1); - border-radius: 2px; - display: inline-block; - padding: 2px 6px; - margin: 0 8px; - max-width: 120px; - overflow: hidden; - text-overflow: ellipsis; -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-select-button__anchor { - background: rgba(0, 0, 0, 0.3); -} -.block-editor-list-view-leaf .block-editor-list-view-block-select-button__lock { - line-height: 0; - width: 24px; - min-width: 24px; - margin-right: auto; - padding: 0; - vertical-align: middle; -} - -.block-editor-list-view-block-select-button__description, -.block-editor-list-view-appender__description { - display: none; -} - -.block-editor-list-view-block__contents-cell .block-editor-list-view-block__contents-container, -.block-editor-list-view-block__contents-cell .block-editor-list-view-appender__container, -.block-editor-list-view-appender__cell .block-editor-list-view-block__contents-container, -.block-editor-list-view-appender__cell .block-editor-list-view-appender__container { - display: flex; -} - -.block-editor-list-view__expander { - height: 24px; - margin-right: 4px; - width: 24px; -} - -.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander { - margin-right: 220px; -} - -.block-editor-list-view-leaf:not([aria-level="1"]) .block-editor-list-view__expander { - margin-left: 4px; -} - -.block-editor-list-view-leaf[aria-level="1"] .block-editor-list-view__expander { - margin-right: 0px; -} - -.block-editor-list-view-leaf[aria-level="2"] .block-editor-list-view__expander { - margin-right: 24px; -} - -.block-editor-list-view-leaf[aria-level="3"] .block-editor-list-view__expander { - margin-right: 52px; -} - -.block-editor-list-view-leaf[aria-level="4"] .block-editor-list-view__expander { - margin-right: 80px; -} - -.block-editor-list-view-leaf[aria-level="5"] .block-editor-list-view__expander { - margin-right: 108px; -} - -.block-editor-list-view-leaf[aria-level="6"] .block-editor-list-view__expander { - margin-right: 136px; -} - -.block-editor-list-view-leaf[aria-level="7"] .block-editor-list-view__expander { - margin-right: 164px; -} - -.block-editor-list-view-leaf[aria-level="8"] .block-editor-list-view__expander { - margin-right: 192px; -} - -.block-editor-list-view-leaf .block-editor-list-view__expander { - visibility: hidden; -} - -.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg { - visibility: visible; - transition: transform 0.2s ease; - transform: rotate(-90deg); -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg { - visibility: visible; - transform: rotate(0deg); - transition: transform 0.2s ease; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-list-view-drop-indicator { - pointer-events: none; -} -.block-editor-list-view-drop-indicator .block-editor-list-view-drop-indicator__line { - background: var(--wp-admin-theme-color); - height: 1px; -} - -.block-editor-list-view-drop-indicator:not([data-y-axis=middle][data-x-axis=right]) > .components-popover__content { - margin-right: 0; - border: none; - box-shadow: none; -} - -.block-editor-list-view-placeholder { - padding: 0; - margin: 0; - height: 36px; -} - -.modal-open .block-editor-media-replace-flow__options { - display: none; -} - -.block-editor-media-replace-flow__indicator { - margin-right: 4px; -} - -.block-editor-media-flow__url-input { - border-top: 1px solid #1e1e1e; - margin-top: 8px; - margin-left: -8px; - margin-right: -8px; - padding: 16px; -} -.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label { - display: block; - top: 16px; - margin-bottom: 8px; -} -.block-editor-media-flow__url-input .block-editor-link-control { - width: 220px; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input { - padding: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .components-base-control .components-base-control__field { - margin-bottom: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title { - max-width: 180px; - white-space: nowrap; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info { - white-space: nowrap; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current { - width: auto; - padding: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-input.block-editor-link-control__search-input input[type=text] { - margin: 0; - width: 100%; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-actions { - top: 0; - left: 4px; -} - -.block-editor-media-flow__error { - padding: 0 20px 20px 20px; - max-width: 255px; -} -.block-editor-media-flow__error .components-with-notices-ui { - max-width: 255px; -} -.block-editor-media-flow__error .components-with-notices-ui .components-notice__content { - overflow: hidden; - word-wrap: break-word; -} -.block-editor-media-flow__error .components-with-notices-ui .components-notice__dismiss { - position: absolute; - left: 10px; -} - -.block-editor-media-placeholder__url-input-container .block-editor-media-placeholder__button { - margin-bottom: 0; -} - -.block-editor-media-placeholder__url-input-form { - display: flex; -} -.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field { - width: 100%; - min-width: 200px; - flex-grow: 1; - border: none; - border-radius: 0; - margin: 2px; -} -@media (min-width: 600px) { - .block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field { - width: 300px; - } -} - -.block-editor-media-placeholder__url-input-submit-button { - flex-shrink: 1; -} - -.block-editor-media-placeholder__button { - margin-bottom: 0.5rem; -} - -.block-editor-media-placeholder__cancel-button.is-link { - margin: 1em; - display: block; -} - -.block-editor-media-placeholder.is-appender { - min-height: 0; -} -.block-editor-media-placeholder.is-appender:hover { - cursor: pointer; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} - -.block-editor-multi-selection-inspector__card { - display: flex; - align-items: flex-start; - padding: 16px; -} - -.block-editor-multi-selection-inspector__card-content { - flex-grow: 1; -} - -.block-editor-multi-selection-inspector__card-title { - font-weight: 500; - margin-bottom: 5px; -} - -.block-editor-multi-selection-inspector__card-description { - font-size: 13px; -} - -.block-editor-multi-selection-inspector__card .block-editor-block-icon { - margin-right: -2px; - margin-left: 10px; - padding: 0 3px; - width: 36px; - height: 24px; -} - -.block-editor-plain-text { - box-shadow: none; - font-family: inherit; - font-size: inherit; - color: inherit; - line-height: inherit; - border: none; - padding: 0; - margin: 0; - width: 100%; -} - -.block-editor-responsive-block-control { - margin-bottom: 28px; - border-bottom: 1px solid #ccc; - padding-bottom: 14px; -} -.block-editor-responsive-block-control:last-child { - padding-bottom: 0; - border-bottom: 0; -} - -.block-editor-responsive-block-control__title { - margin: 0; - margin-bottom: 0.6em; - margin-right: -3px; -} - -.block-editor-responsive-block-control__label { - font-weight: 600; - margin-bottom: 0.6em; - margin-right: -3px; -} - -.block-editor-responsive-block-control__inner { - margin-right: -1px; -} - -.block-editor-responsive-block-control__toggle { - margin-right: 1px; -} - -.block-editor-responsive-block-control .components-base-control__help { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.rich-text [data-rich-text-placeholder] { - pointer-events: none; -} -.rich-text [data-rich-text-placeholder]::after { - content: attr(data-rich-text-placeholder); - opacity: 0.62; -} -.rich-text:focus { - outline: none; -} -.rich-text:focus [data-rich-text-format-boundary] { - border-radius: 2px; -} - -.block-editor-rich-text__editable > p:first-child { - margin-top: 0; -} - -figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before { - opacity: 0.8; -} - -.components-popover.block-editor-rich-text__inline-format-toolbar { - z-index: 99998; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-popover__content { - width: auto; - min-width: auto; - margin-bottom: 8px; - box-shadow: none; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group, -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar { - border: none; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control, -.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle { - min-width: 48px; - min-height: 48px; - padding-right: 12px; - padding-left: 12px; -} - -.block-editor-rich-text__inline-format-toolbar-group .components-dropdown-menu__toggle { - justify-content: center; -} - -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon { - width: auto; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon svg { - display: none; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon::after { - content: attr(aria-label); -} - -[data-rich-text-script] { - display: inline; -} -[data-rich-text-script]::before { - content: ""; - background: yellow; -} - -.block-editor-skip-to-selected-block { - position: absolute; - top: -9999em; -} -.block-editor-skip-to-selected-block:focus { - height: auto; - width: auto; - display: block; - font-size: 14px; - font-weight: 600; - padding: 15px 23px 14px; - background: #f1f1f1; - color: var(--wp-admin-theme-color); - line-height: normal; - box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); - text-decoration: none; - outline: none; - z-index: 100000; -} - -.block-editor-text-transform-control { - flex: 0 0 50%; -} -.block-editor-text-transform-control legend { - margin-bottom: 8px; -} -.block-editor-text-transform-control .block-editor-text-transform-control__buttons { - display: inline-flex; - margin-bottom: 24px; -} -.block-editor-text-transform-control .block-editor-text-transform-control__buttons .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-left: 4px; -} - -.block-editor-text-decoration-control { - flex: 0 0 50%; -} -.block-editor-text-decoration-control legend { - margin-bottom: 8px; -} -.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons { - display: inline-flex; - margin-bottom: 24px; -} -.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-left: 4px; -} - -.block-editor-tool-selector__help { - margin-top: 8px; - margin-right: -8px; - margin-left: -8px; - margin-bottom: -8px; - padding: 16px; - border-top: 1px solid #ddd; - color: #757575; - min-width: 280px; -} - -.block-editor-block-list__block .block-editor-url-input, -.components-popover .block-editor-url-input, -.block-editor-url-input { - flex-grow: 1; - position: relative; - padding: 1px; -} -.block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - width: 100%; - padding: 8px 12px 8px 8px; - border: none; - border-radius: 0; - margin-right: 0; - margin-left: 0; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; -} -@media (min-width: 600px) { - .block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - width: 300px; - } -} -@media (min-width: 600px) { - .block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - font-size: 13px; - } -} -.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear, -.components-popover .block-editor-url-input input[type=text]::-ms-clear, -.block-editor-url-input input[type=text]::-ms-clear { - display: none; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width, -.components-popover .block-editor-url-input.is-full-width, -.block-editor-url-input.is-full-width { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text], -.components-popover .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text], -.block-editor-url-input.is-full-width .block-editor-url-input__input[type=text] { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width__suggestions, -.components-popover .block-editor-url-input.is-full-width__suggestions, -.block-editor-url-input.is-full-width__suggestions { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input .components-spinner, -.components-popover .block-editor-url-input .components-spinner, -.block-editor-url-input .components-spinner { - position: absolute; - left: 8px 8px 8px 12px; - bottom: 8px 8px 8px 12px8px1; - margin: 0; -} - -.block-editor-url-input__input[type=text] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-url-input__input[type=text] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-url-input__input[type=text] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.block-editor-url-input__input[type=text]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-url-input__input[type=text]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.block-editor-url-input__input[type=text]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.block-editor-url-input__input[type=text]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.block-editor-url-input__suggestions { - max-height: 200px; - transition: all 0.15s ease-in-out; - padding: 4px 0; - width: 302px; - overflow-y: auto; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-url-input__suggestions { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-url-input__suggestions, -.block-editor-url-input .components-spinner { - display: none; -} -@media (min-width: 600px) { - .block-editor-url-input__suggestions, -.block-editor-url-input .components-spinner { - display: grid; - } -} - -.block-editor-url-input__suggestion { - min-height: 36px; - height: auto; - color: #757575; - display: block; - font-size: 13px; - cursor: pointer; - background: #fff; - width: 100%; - border: none; - text-align: right; - box-shadow: none; -} -.block-editor-url-input__suggestion:hover { - background: #ddd; -} -.block-editor-url-input__suggestion:focus, .block-editor-url-input__suggestion.is-selected { - background: var(--wp-admin-theme-color-darker-20); - color: #fff; - outline: none; -} - -.components-toolbar-group > .block-editor-url-input__button, -.components-toolbar > .block-editor-url-input__button { - position: inherit; -} - -.block-editor-url-input__button .block-editor-url-input__back { - margin-left: 4px; - overflow: visible; -} -.block-editor-url-input__button .block-editor-url-input__back::after { - content: ""; - position: absolute; - display: block; - width: 1px; - height: 24px; - left: -1px; - background: #ddd; -} - -.block-editor-url-input__button-modal { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border: 1px solid #ddd; - background: #fff; -} - -.block-editor-url-input__button-modal-line { - display: flex; - flex-direction: row; - flex-grow: 1; - flex-shrink: 1; - min-width: 0; - align-items: flex-start; -} -.block-editor-url-input__button-modal-line .components-button { - flex-shrink: 0; - width: 36px; - height: 36px; -} - -.block-editor-url-popover__additional-controls { - border-top: 1px solid #ddd; -} - -.block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg { - box-shadow: none; -} - -.block-editor-url-popover__additional-controls div[role=menu] > .components-button { - padding-right: 12px; -} - -.block-editor-url-popover__row { - display: flex; -} - -.block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) { - flex-grow: 1; -} - -.block-editor-url-popover .components-button.has-icon { - padding: 3px; -} -.block-editor-url-popover .components-button.has-icon > svg { - padding: 5px; - border-radius: 2px; - height: 30px; - width: 30px; -} -.block-editor-url-popover .components-button.has-icon:not(:disabled):focus { - box-shadow: none; -} -.block-editor-url-popover .components-button.has-icon:not(:disabled):focus > svg { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} - -.block-editor-url-popover__settings-toggle { - flex-shrink: 0; - border-radius: 0; - border-right: 1px solid #ddd; - margin-right: 1px; -} -.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon { - transform: rotate(-180deg); -} - -.block-editor-url-popover__input-container .components-base-control:last-child, -.block-editor-url-popover__input-container .components-base-control:last-child .components-base-control__field { - margin-bottom: 0; -} - -.block-editor-url-popover__settings { - display: block; - padding: 16px; - border-top: 1px solid #ddd; -} - -.block-editor-url-popover__link-editor, -.block-editor-url-popover__link-viewer { - display: flex; -} -.block-editor-url-popover__link-editor .block-editor-url-input .components-base-control__field, -.block-editor-url-popover__link-viewer .block-editor-url-input .components-base-control__field { - margin-bottom: 0; -} -.block-editor-url-popover__link-editor .block-editor-url-input .components-spinner, -.block-editor-url-popover__link-viewer .block-editor-url-input .components-spinner { - bottom: 8px 8px 8px 12px1; -} - -.block-editor-url-popover__link-viewer-url { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-url-popover__link-viewer-url.has-invalid-link { - color: #cc1818; -} - -.block-editor-warning { - align-items: center; - display: flex; - flex-wrap: wrap; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 1em; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.block-editor-warning .block-editor-warning__message { - line-height: 1.4; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - color: #1e1e1e; - margin: 0; -} -.block-editor-warning p.block-editor-warning__message.block-editor-warning__message { - min-height: auto; -} -.block-editor-warning .block-editor-warning__contents { - display: flex; - flex-direction: row; - justify-content: space-between; - flex-wrap: wrap; - align-items: baseline; - width: 100%; -} -.block-editor-warning .block-editor-warning__actions { - display: flex; - margin-top: 1em; -} -.block-editor-warning .block-editor-warning__action { - margin: 0 0 0 8px; -} - -.block-editor-warning__secondary { - margin: auto 8px auto 0; -} - -.components-popover.block-editor-warning__dropdown { - z-index: 99998; -} - -.html-anchor-control .components-external-link { - display: block; - margin-top: 8px; -} - -.block-editor-hooks__layout-controls { - display: flex; - margin-bottom: 16px; -} -.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit { - display: flex; - margin-left: 24px; -} -.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit svg { - margin: auto 8px 4px 0; -} - -.block-editor-hooks__layout-controls-reset { - display: flex; - justify-content: flex-end; - margin-bottom: 24px; -} - -.block-editor-hooks__layout-controls-helptext { - font-size: 12px; -} - -.block-editor-hooks__flex-layout-justification-controls, -.block-editor-hooks__flex-layout-orientation-controls { - margin-bottom: 12px; -} -.block-editor-hooks__flex-layout-justification-controls legend, -.block-editor-hooks__flex-layout-orientation-controls legend { - margin-bottom: 8px; -} - -.border-block-support-panel .single-column { - grid-column: span 1; -} - -.dimensions-block-support-panel .single-column { - grid-column: span 1; -} - -.typography-block-support-panel .components-font-appearance-control, -.typography-block-support-panel .components-font-size-picker__controls, -.typography-block-support-panel .block-editor-text-decoration-control__buttons, -.typography-block-support-panel .block-editor-text-transform-control__buttons { - margin-bottom: 0; -} -.typography-block-support-panel .single-column { - grid-column: span 1; -} - -.color-block-support-panel { - /* Increased specificity required to remove the slot wrapper's row gap */ - /** - * The following styles replicate the separated border of the - * `ItemGroup` component but allows for hidden items. This is because - * to maintain the order of `ToolsPanel` controls, each `ToolsPanelItem` - * must at least render a placeholder which would otherwise interfere - * with the `:last-child` styles. - */ - /** - * The following few styles fix the layout and spacing for the due to the - * introduced wrapper element by the `Item` component. - */ -} -.color-block-support-panel .block-editor-contrast-checker { - /** - * Contrast checkers are forced to the bottom of the panel so all - * injected color controls can appear as a single item group without - * the contrast checkers suddenly appearing between items. - */ - order: 9999; - grid-column: span 2; - margin-top: 16px; -} -.color-block-support-panel .block-editor-contrast-checker .components-notice__content { - margin-left: 0; -} -.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper { - row-gap: 0; -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item { - padding: 0; - border-right: 1px solid rgba(0, 0, 0, 0.1); - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-bottom: 1px solid rgba(0, 0, 0, 0.1); -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first { - border-top-right-radius: 2px; - border-top-left-radius: 2px; - border-top: 1px solid rgba(0, 0, 0, 0.1); -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.last { - border-bottom-right-radius: 2px; - border-bottom-left-radius: 2px; -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item > div, -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item > div > button { - border-radius: inherit; -} -.color-block-support-panel .block-editor-panel-color-gradient-settings__color-indicator { - background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown { - display: block; - padding: 0; -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown > button { - height: 46px; -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown > button.is-open { - background: #f0f0f0; - color: var(--wp-admin-theme-color); -} -.color-block-support-panel .color-block-support-panel__item-group > div { - grid-column: span 2; - border-radius: inherit; -} - -/** - * Block Toolbar - */ -.block-editor-block-toolbar { - display: flex; - flex-grow: 1; - width: 100%; - position: relative; - overflow-y: hidden; - overflow-x: auto; - transition: border-color 0.1s linear, box-shadow 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-toolbar { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-block-toolbar { - overflow: inherit; - } -} -.block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-toolbar .components-toolbar { - background: none; - line-height: 0; - margin-top: -1px; - margin-bottom: -1px; - border: 0; - border-left: 1px solid #ddd; -} -.block-editor-block-toolbar > :last-child, -.block-editor-block-toolbar > :last-child .components-toolbar-group, -.block-editor-block-toolbar > :last-child .components-toolbar { - border-left: none; -} - -.block-editor-block-contextual-toolbar.has-parent:not(.is-fixed) { - margin-right: calc(48px + 8px); -} -.show-icon-labels .block-editor-block-contextual-toolbar.has-parent:not(.is-fixed) { - margin-right: 0; -} - -.block-editor-block-parent-selector { - position: absolute; - top: -1px; - right: calc(-48px - 8px - 1px); -} -.show-icon-labels .block-editor-block-parent-selector { - position: relative; - right: auto; - top: auto; - margin-top: -1px; - margin-right: -1px; - margin-bottom: -1px; -} - -.block-editor-block-toolbar__block-controls { - height: auto !important; - padding: 0 !important; - margin-right: -1px; -} -.block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon, -.block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - width: 24px !important; - margin: 0 !important; -} -.block-editor-block-toolbar__block-controls .block-editor-block-mover { - margin-right: -6px; -} -.block-editor-block-toolbar__block-controls .block-editor-block-lock-toolbar { - margin-right: -6px !important; -} -.block-editor-block-toolbar__block-controls .components-toolbar-group { - padding: 0; -} - -.block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-toolbar .components-toolbar, -.block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group, -.block-editor-rich-text__inline-format-toolbar-group .components-toolbar { - display: flex; - flex-wrap: nowrap; -} - -.block-editor-block-toolbar__slot { - display: inline-block; - line-height: 0; -} -@supports (position: sticky) { - .block-editor-block-toolbar__slot { - display: inline-flex; - } -} - -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon { - width: auto; -} -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon svg { - display: none; -} -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon::after { - content: attr(aria-label); - font-size: 12px; -} -.show-icon-labels .components-accessible-toolbar .components-toolbar-group > div:first-child:last-child > .components-button.has-icon { - padding-right: 6px; - padding-left: 6px; -} -.show-icon-labels .block-editor-block-switcher { - border-left: 1px solid #1e1e1e; -} -.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle { - margin-right: 0; -} -.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon, -.show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - width: 0 !important; - height: 0 !important; -} -.show-icon-labels .block-editor-block-parent-selector__button .block-editor-block-icon { - width: 0; -} -.show-icon-labels .block-editor-block-toolbar__block-controls .block-editor-block-mover { - margin-right: 0; - white-space: nowrap; -} -.show-icon-labels .block-editor-block-mover-button { - padding-right: 8px !important; - padding-left: 8px !important; -} -.show-icon-labels .block-editor-block-mover__drag-handle.has-icon { - padding-right: 6px !important; - padding-left: 6px !important; - border-left: 1px solid #1e1e1e; -} -@media (min-width: 600px) { - .show-icon-labels .is-up-button.is-up-button.is-up-button { - border-bottom: 1px solid #1e1e1e; - margin-left: 0; - border-radius: 0; - } -} -.show-icon-labels .block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button { - width: auto; -} -.show-icon-labels .components-toolbar, -.show-icon-labels .components-toolbar-group { - flex-shrink: 1; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button + .components-button { - margin-right: 6px; -} - -.block-editor-inserter { - display: inline-block; - background: none; - border: none; - padding: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 0; -} -@media (min-width: 782px) { - .block-editor-inserter { - position: relative; - } -} - -.block-editor-inserter__content { - position: relative; -} - -.block-editor-inserter__popover.is-quick .components-popover__content { - border: none; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * { - border-right: 1px solid #ccc; - border-left: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child { - border-top: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child { - border-bottom: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button { - border: 1px solid #1e1e1e; -} - -.block-editor-inserter__popover .block-editor-inserter__menu { - margin: -12px; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__tabs .components-tab-panel__tabs { - top: 60px; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__main-area { - overflow: visible; - height: auto; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__preview-container { - display: none; -} - -.block-editor-inserter__toggle.components-button { - display: inline-flex; - align-items: center; - cursor: pointer; - border: none; - outline: none; - padding: 0; - transition: color 0.2s ease; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-inserter__toggle.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-inserter__menu { - height: 100%; - position: relative; - overflow: visible; -} - -.block-editor-inserter__main-area { - width: auto; - overflow-y: auto; - height: 100%; -} -@media (min-width: 782px) { - .block-editor-inserter__main-area { - width: 350px; - } -} - -.block-editor-inserter__inline-elements { - margin-top: -1px; -} - -.block-editor-inserter__menu.is-bottom::after { - border-bottom-color: #fff; -} - -.components-popover.block-editor-inserter__popover { - z-index: 99999; -} - -.block-editor-inserter__search { - background: #fff; - padding: 16px 16px 0 16px; - position: sticky; - top: 0; - z-index: 1; -} -.block-editor-inserter__search .components-search-control__icon { - left: 20px; -} -.block-editor-inserter__search .components-base-control__field { - margin-bottom: 0; -} - -.block-editor-inserter__tabs { - display: flex; - flex-direction: column; -} -.block-editor-inserter__tabs .components-tab-panel__tabs { - position: sticky; - top: 64px; - background: #fff; - z-index: 1; - border-bottom: 1px solid #ddd; -} -.block-editor-inserter__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - flex-grow: 1; - margin-bottom: -1px; -} -.block-editor-inserter__tabs .components-tab-panel__tab-content { - display: flex; - flex-grow: 1; - flex-direction: column; - position: relative; - z-index: 0; -} - -.block-editor-inserter__panel-header { - display: inline-flex; - align-items: center; - padding: 16px 16px 0; -} - -.block-editor-inserter__panel-header-patterns { - padding: 16px 16px 0; -} - -.block-editor-inserter__panel-content { - padding: 16px; -} - -.block-editor-inserter__panel-title, -.block-editor-inserter__panel-title button { - margin: 0 0 0 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input { - height: 36px; - line-height: 36px; -} - -.block-editor-inserter__panel-dropdown select { - border: none; -} - -.block-editor-inserter__block-list { - flex-grow: 1; - position: relative; -} - -.block-editor-inserter__reusable-blocks-panel { - position: relative; - text-align: left; -} - -.block-editor-inserter__manage-reusable-blocks { - display: inline-block; - margin: 16px; -} - -.block-editor-inserter__no-results { - padding: 32px; - text-align: center; -} - -.block-editor-inserter__no-results-icon { - fill: #949494; -} - -.block-editor-inserter__child-blocks { - padding: 0 16px; -} - -.block-editor-inserter__parent-block-header { - display: flex; - align-items: center; -} -.block-editor-inserter__parent-block-header h2 { - font-size: 13px; -} -.block-editor-inserter__parent-block-header .block-editor-block-icon { - margin-left: 8px; -} - -.block-editor-inserter__preview-container { - display: none; - width: 300px; - background: #fff; - border-radius: 2px; - border: 1px solid #ddd; - position: absolute; - top: 16px; - right: calc(100% + 16px); - max-height: calc(100% - 32px); - overflow-y: hidden; -} -@media (min-width: 782px) { - .block-editor-inserter__preview-container { - display: block; - } -} -.block-editor-inserter__preview-container .block-editor-block-card { - padding: 16px; -} -.block-editor-inserter__preview-container .block-editor-block-card__title { - font-size: 13px; -} - -.block-editor-inserter__preview-content { - min-height: 144px; - background: #f0f0f0; - display: grid; - flex-grow: 1; - align-items: center; -} - -.block-editor-inserter__preview-content-missing { - flex: 1; - display: flex; - justify-content: center; - align-items: center; - min-height: 144px; - color: #757575; - background: #f0f0f0; -} - -.block-editor-inserter__tips { - border-top: 1px solid #ddd; - padding: 16px; - flex-shrink: 0; - position: relative; -} - -.block-editor-inserter__manage-reusable-blocks-container { - padding: 16px; -} - -.block-editor-inserter__quick-inserter { - width: 100%; - max-width: 100%; -} -@media (min-width: 782px) { - .block-editor-inserter__quick-inserter { - width: 350px; - } -} - -.block-editor-inserter__quick-inserter-results .block-editor-inserter__panel-header { - height: 0; - padding: 0; - float: right; -} - -.block-editor-inserter__quick-inserter.has-search .block-editor-inserter__panel-content, -.block-editor-inserter__quick-inserter.has-expand .block-editor-inserter__panel-content { - padding: 16px; -} - -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr; - grid-gap: 8px; -} -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-preview__container { - min-height: 100px; -} - -.block-editor-inserter__quick-inserter-separator { - border-top: 1px solid #ddd; -} - -.block-editor-inserter__popover.is-quick > .components-popover__content > div { - padding: 0; -} - -.block-editor-inserter__quick-inserter-expand.components-button { - display: block; - background: #1e1e1e; - color: #fff; - width: 100%; - height: 44px; - border-radius: 0; -} -.block-editor-inserter__quick-inserter-expand.components-button:hover { - color: #fff; -} -.block-editor-inserter__quick-inserter-expand.components-button:active { - color: #ccc; -} -.block-editor-inserter__quick-inserter-expand.components-button.components-button:focus:not(:disabled) { - box-shadow: none; - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} - -.block-editor-block-patterns-explorer__sidebar { - position: absolute; - top: 60px; - right: 0; - bottom: 0; - width: 280px; - padding: 24px 32px 32px; - overflow-x: visible; - overflow-y: scroll; -} -.block-editor-block-patterns-explorer__sidebar__categories-list__item { - display: block; - width: 100%; - height: 48px; - text-align: right; -} -.block-editor-block-patterns-explorer__search { - margin-bottom: 32px; -} -.block-editor-block-patterns-explorer__search-results-count { - padding-bottom: 32px; -} -.block-editor-block-patterns-explorer__list { - margin-right: 248px; -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list { - display: grid; - grid-gap: 32px; - grid-template-columns: repeat(1, 1fr); -} -@media (min-width: 1080px) { - .block-editor-block-patterns-explorer .block-editor-block-patterns-list { - grid-template-columns: repeat(2, 1fr); - } -} -@media (min-width: 1440px) { - .block-editor-block-patterns-explorer .block-editor-block-patterns-list { - grid-template-columns: repeat(3, 1fr); - } -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - min-height: 240px; -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-preview__container { - height: inherit; - min-height: 100px; - max-height: 800px; -} - -.block-editor-post-preview__dropdown { - padding: 0; -} - -.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize { - padding-right: 40px; -} -.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize.has-icon { - padding-right: 8px; -} - -.block-editor-post-preview__dropdown-content .components-popover__content { - overflow-y: visible; -} -.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:first-child { - padding-bottom: 8px; -} -.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:last-child { - margin-bottom: 0; -} -.block-editor-post-preview__dropdown-content .components-menu-group + .components-menu-group { - padding: 8px; -} - -@media (min-width: 600px) { - .edit-post-header__settings .editor-post-preview, -.edit-site-header__actions .editor-post-preview { - display: none; - } -} - -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle { - transition: opacity 0.1s linear; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle { - opacity: 0; - } - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle.is-opened { - opacity: 1; - } -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -/** -* Default editor styles. -* -* These styles are shown if a theme does not register its own editor style, -* a theme.json file, or has toggled off "Use theme styles" in preferences. -*/ -body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 18px; - line-height: 1.5; - --wp--style--block-gap: 2em; -} - -p { - line-height: 1.8; -} - -.editor-post-title__block { - margin-top: 2em; - margin-bottom: 1em; - font-size: 2.5em; - font-weight: 800; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;line-height:1.5;--wp--style--block-gap:2em}p{line-height:1.8}.editor-post-title__block{margin-top:2em;margin-bottom:1em;font-size:2.5em;font-weight:800}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;line-height:1.5;--wp--style--block-gap:2em}p{line-height:1.8}.editor-post-title__block{margin-top:2em;margin-bottom:1em;font-size:2.5em;font-weight:800}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -/** -* Default editor styles. -* -* These styles are shown if a theme does not register its own editor style, -* a theme.json file, or has toggled off "Use theme styles" in preferences. -*/ -body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 18px; - line-height: 1.5; - --wp--style--block-gap: 2em; -} - -p { - line-height: 1.8; -} - -.editor-post-title__block { - margin-top: 2em; - margin-bottom: 1em; - font-size: 2.5em; - font-weight: 800; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.block-editor-autocompleters__block { - white-space: nowrap; -} -.block-editor-autocompleters__block .block-editor-block-icon { - margin-right: 8px; -} - -.block-editor-autocompleters__link { - white-space: nowrap; -} -.block-editor-autocompleters__link .block-editor-block-icon { - margin-right: 8px; -} - -.block-editor-block-alignment-control__menu-group .components-menu-item__info { - margin-top: 0; -} - -.block-editor-block-alignment-matrix-control__popover .components-popover__content { - min-width: 0; - width: auto; -} -.block-editor-block-alignment-matrix-control__popover .components-popover__content > div { - padding: 8px; -} - -.block-editor-block-icon { - display: flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; -} -.block-editor-block-icon.has-colors svg { - fill: currentColor; -} -@media (forced-colors: active) { - .block-editor-block-icon.has-colors svg { - fill: CanvasText; - } -} -.block-editor-block-icon svg { - min-width: 20px; - min-height: 20px; - max-width: 24px; - max-height: 24px; -} - -.block-editor-block-inspector p { - margin-top: 0; -} -.block-editor-block-inspector h2, -.block-editor-block-inspector h3 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.block-editor-block-inspector .components-base-control { - margin-bottom: 24px; -} -.block-editor-block-inspector .components-base-control:last-child { - margin-bottom: 8px; -} -.block-editor-block-inspector .components-panel__body { - border: none; - border-top: 1px solid #e0e0e0; -} -.block-editor-block-inspector .block-editor-block-card { - padding: 16px; -} - -.block-editor-block-inspector__no-blocks { - display: block; - font-size: 13px; - background: #fff; - padding: 32px 16px; - text-align: center; -} - -.block-editor-block-styles .block-editor-block-list__block { - margin: 0; -} - -/** - * Notices & Block Selected/Hover Styles. - */ -/** - * Cross-Block Selection - */ -.block-editor-block-list__layout { - position: relative; -} -.block-editor-block-list__layout.is-navigate-mode { - cursor: default; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable])::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected::after { - position: absolute; - z-index: 1; - pointer-events: none; - content: ""; - top: 1px; - bottom: 1px; - left: 1px; - right: 1px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 1px; - outline: 2px solid transparent; -} -.is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .is-dark-theme .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable])::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after, -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected::after { - box-shadow: 0 0 0 1px #fff; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected .components-placeholder ::selection, .block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected:not([contenteditable]) .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted .components-placeholder ::selection, -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted ~ .is-multi-selected .components-placeholder ::selection { - background: transparent; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-hovered:not(.is-selected)::after { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-block-list__layout .block-editor-block-list__block.is-highlighted::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 1px solid transparent; -} -.block-editor-block-list__layout.is-navigate-mode .block-editor-block-list__block.is-selected::after, .block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.has-child-selected { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected::before { - content: ""; - position: absolute; - z-index: 0; - pointer-events: none; - transition: border-color 0.1s linear, border-style 0.1s linear, box-shadow 0.1s linear; - right: 0; - left: 0; - top: -14px; - border-radius: 2px; - border-top: 4px solid #ccc; -} -.block-editor-block-list__layout .is-block-moving-mode.block-editor-block-list__block.is-selected::after { - content: none; -} -.block-editor-block-list__layout .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected::before { - border-color: var(--wp-admin-theme-color); -} - -.is-block-moving-mode.block-editor-block-list__block-selection-button { - opacity: 0; - font-size: 1px; - height: 1px; - padding: 0; -} - -.block-editor-block-list__layout .block-editor-block-list__block { - position: relative; - overflow-wrap: break-word; - /** - * Notices - */ - /** - * Block Layout - */ - /** - * Block styles and alignments - */ -} -.block-editor-block-list__layout .block-editor-block-list__block .reusable-block-edit-panel * { - z-index: 1; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-placeholder .components-with-notices-ui { - margin: -10px 0 12px 0; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui { - margin: 0 0 12px 0; - width: 100%; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice { - margin-left: 0; - margin-right: 0; -} -.block-editor-block-list__layout .block-editor-block-list__block .components-with-notices-ui .components-notice .components-notice__content { - font-size: 13px; -} -.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus { - outline: none; -} -.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus::after { - position: absolute; - z-index: 1; - pointer-events: none; - content: ""; - top: 1px; - bottom: 1px; - left: 1px; - right: 1px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 1px; - outline: 2px solid transparent; -} -.is-dark-theme .block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable]):focus::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) #fff; -} -.block-editor-block-list__layout .block-editor-block-list__block::after { - content: ""; - pointer-events: none; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border-radius: 2px; - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) transparent; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning { - min-height: 48px; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning > * { - pointer-events: none; - -webkit-user-select: none; - user-select: none; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning { - pointer-events: all; -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning::after { - content: ""; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border-radius: 2px; - background-color: rgba(255, 255, 255, 0.4); -} -.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected::after { - background-color: transparent; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable > .block-editor-inner-blocks > .block-editor-block-list__layout.has-overlay::after { - display: none; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable > .block-editor-inner-blocks > .block-editor-block-list__layout.has-overlay .block-editor-block-list__layout.has-overlay::after { - display: block; -} -.block-editor-block-list__layout .block-editor-block-list__block.is-reusable.has-child-selected::after { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true] { - float: none; -} - -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered { - cursor: default; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-hovered::after { - top: 1px; - left: 1px; - right: 1px; - bottom: 1px; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - border-radius: 1px; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected { - cursor: unset; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - top: 1px; - left: 1px; - right: 1px; - bottom: 1px; - border-radius: 1px; -} -.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected:focus::after { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .is-focus-mode .block-editor-block-list__block:not(.has-child-selected) { - transition-duration: 0s; - transition-delay: 0s; - } -} -.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) .block-editor-block-list__block, .is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-selected, .is-focus-mode .block-editor-block-list__block:not(.has-child-selected).is-multi-selected { - opacity: 1; -} - -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity { - transition-duration: 0s; - transition-delay: 0s; - } -} -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block, -.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block { - opacity: 1; -} - -.wp-block[data-align=left] > *, -.wp-block[data-align=right] > *, -.wp-block.alignleft, -.wp-block.alignright { - z-index: 21; -} - -.wp-site-blocks > [data-align=left] { - float: left; - margin-right: 2em; -} - -.wp-site-blocks > [data-align=right] { - float: right; - margin-left: 2em; -} - -.wp-site-blocks > [data-align=center] { - justify-content: center; - margin-left: auto; - margin-right: auto; -} - -/** - * In-Canvas Inserter - */ -.block-editor-block-list .block-editor-inserter { - margin: 8px; - cursor: move; - cursor: grab; -} - -@keyframes block-editor-inserter__toggle__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -.wp-block .block-list-appender .block-editor-inserter__toggle { - animation: block-editor-inserter__toggle__fade-in-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .wp-block .block-list-appender .block-editor-inserter__toggle { - animation-duration: 1ms; - animation-delay: 0s; - } -} - -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender { - display: none; -} -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender .block-editor-inserter__toggle { - opacity: 0; - transform: scale(0); -} - -.block-editor-block-list__block .block-editor-block-list__block-html-textarea { - display: block; - margin: 0; - padding: 12px; - width: 100%; - border: none; - outline: none; - border-radius: 2px; - box-shadow: inset 0 0 0 1px #1e1e1e; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 15px; - line-height: 1.5; - transition: padding 0.2s linear; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-list__block .block-editor-block-list__block-html-textarea { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-list__block .block-editor-block-list__block-html-textarea:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -/** - * Warnings. - */ -.block-editor-block-list__block .block-editor-warning { - z-index: 5; - position: relative; -} -.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning { - margin-bottom: auto; -} - -/** - * Insertion Point. - */ -.block-editor-block-list__insertion-point { - position: absolute; -} - -.block-editor-block-list__insertion-point-indicator { - position: absolute; - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__insertion-point.is-vertical > .block-editor-block-list__insertion-point-indicator { - top: 50%; - height: 1px; -} -.block-editor-block-list__insertion-point.is-horizontal > .block-editor-block-list__insertion-point-indicator { - top: 0; - right: 0; - left: 50%; - width: 1px; -} - -.block-editor-block-list__insertion-point-inserter { - display: none; - position: absolute; - justify-content: center; - top: calc(50% - 12px); - left: calc(50% - 12px); -} -@media (min-width: 480px) { - .block-editor-block-list__insertion-point-inserter { - display: flex; - } -} - -.block-editor-block-list__block-popover-inserter { - position: absolute; - top: -9999em; - margin-bottom: 14px; -} -.block-editor-block-list__block-popover-inserter.is-visible { - position: static; -} - -.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon { - background: #1e1e1e; - border-radius: 2px; - color: #fff; - padding: 0; - min-width: 24px; - height: 24px; -} -.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-default-block-appender .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__block-popover-inserter .block-editor-inserter__toggle.components-button.has-icon:hover { - color: #fff; - background: var(--wp-admin-theme-color); -} - -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon { - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__insertion-point-inserter .block-editor-inserter__toggle.components-button.has-icon:hover { - background: #1e1e1e; -} - -/** - * Block Toolbar when contextual. - */ -.block-editor-block-contextual-toolbar { - display: inline-flex; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar { - border-right-color: #1e1e1e; -} -.block-editor-block-contextual-toolbar.is-fixed { - position: sticky; - top: 0; - width: 100%; - z-index: 31; - min-height: 48px; - display: block; - border: none; - border-bottom: 1px solid #e0e0e0; - border-radius: 0; -} -.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar { - border-right-color: #e0e0e0; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover-button { - overflow: hidden; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button { - min-width: 24px; - width: 24px; -} -.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button svg { - min-width: 24px; -} - -.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button:focus::before { - left: 0 !important; - min-width: 0; - width: 100%; -} -@media (min-width: 600px) { - .block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-up-button svg { - top: 5px; - } - .block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover-button.is-down-button svg { - bottom: 5px; - } -} - -/** - * Block Label for Navigation/Selection Mode - */ -.block-editor-block-list__block-selection-button { - display: inline-flex; - padding: 0 12px; - z-index: 22; - border-radius: 2px; - background-color: #1e1e1e; - font-size: 13px; - height: 48px; -} -.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content { - margin: auto; - display: inline-flex; - align-items: center; -} -.block-editor-block-list__block-selection-button .block-editor-block-list__block-selection-button__content > .components-flex__item { - margin-right: 6px; -} -.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle { - cursor: grab; - padding: 0; - height: 24px; - min-width: 24px; - margin-left: -2px; -} -.block-editor-block-list__block-selection-button .components-button.has-icon.block-selection-button_drag-handle svg { - min-width: 18px; - min-height: 18px; -} -.block-editor-block-list__block-selection-button .block-editor-block-icon { - font-size: 13px; - color: #fff; - height: 48px; -} -.block-editor-block-list__block-selection-button .components-button { - min-width: 36px; - color: #fff; - height: 48px; - display: flex; -} -.block-editor-block-list__block-selection-button .components-button:focus { - box-shadow: none; - border: none; -} -.block-editor-block-list__block-selection-button .components-button:active { - color: #fff; -} -.block-editor-block-list__block-selection-button .block-selection-button_select-button.components-button { - padding: 0; -} - -/** - * Popovers. - */ -.block-editor-block-list__insertion-point-popover.is-without-arrow { - z-index: 28; - position: absolute; - pointer-events: none; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow * { - pointer-events: none; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter { - pointer-events: all; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .is-with-inserter * { - pointer-events: all; -} -.block-editor-block-list__insertion-point-popover.is-without-arrow .components-popover__content.components-popover__content { - background: none; - border: none; - box-shadow: none; - overflow-y: visible; - margin-left: 0; -} - -@keyframes hide-during-dragging { - to { - position: fixed; - transform: translate(9999px, 9999px); - } -} -.components-popover.block-editor-block-list__block-popover { - z-index: 31; - position: absolute; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content { - margin: 0 !important; - min-width: auto; - width: max-content; - background: none; - border: none; - box-shadow: none; - overflow-y: visible; - pointer-events: none; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__empty-block-inserter { - pointer-events: all; -} -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-list__block-selection-button, -.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar { - margin-top: 12px; - margin-bottom: 12px; -} -.components-popover.block-editor-block-list__block-popover.is-insertion-point-visible { - visibility: hidden; -} -.is-dragging-components-draggable .components-popover.block-editor-block-list__block-popover { - opacity: 0; - animation: hide-during-dragging 1ms linear forwards; -} - -.is-dragging-components-draggable .components-tooltip { - display: none; -} - -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, -.block-editor-block-toolbar .components-toolbar-group { - padding-left: 6px; - padding-right: 6px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon, -.block-editor-block-toolbar .components-toolbar-group .components-button, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon { - min-width: 36px; - padding-left: 6px; - padding-right: 6px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button svg, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button svg, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon svg, -.block-editor-block-toolbar .components-toolbar-group .components-button svg, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon svg { - min-width: 24px; -} -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button::before, -.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button::before, -.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown .components-button.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar-group .components-button::before, -.block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon::before { - left: 2px; - right: 2px; -} - -.is-vertical .block-list-appender { - width: 24px; - margin-right: auto; - margin-top: 12px; - margin-left: 12px; -} - -.block-list-appender > .block-editor-inserter { - display: block; -} - -.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle { - opacity: 0; - transform: scale(0); -} - -.block-editor-block-lock-modal { - z-index: 1000001; -} -@media (min-width: 600px) { - .block-editor-block-lock-modal .components-modal__frame { - max-width: 480px; - } -} - -.block-editor-block-lock-modal__checklist { - margin: 0; -} - -.block-editor-block-lock-modal__options-title { - padding: 12px 0; -} -.block-editor-block-lock-modal__options-title .components-checkbox-control__label { - font-weight: 600; -} -.block-editor-block-lock-modal__options-title .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} - -.block-editor-block-lock-modal__checklist-item { - margin-bottom: 0; - padding: 12px 0 12px 32px; -} -.block-editor-block-lock-modal__checklist-item .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} -.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label { - display: flex; - align-items: center; - justify-content: space-between; - flex-grow: 1; -} -.block-editor-block-lock-modal__checklist-item .components-checkbox-control__label svg { - margin-right: 12px; - fill: #1e1e1e; -} -.block-editor-block-lock-modal__checklist-item:hover { - background-color: #f0f0f0; - border-radius: 2px; -} - -.block-editor-block-lock-modal__actions { - margin-top: 24px; -} - -.block-editor-block-lock-toolbar .components-button.has-icon { - min-width: 36px !important; - padding-left: 0 !important; -} -.block-editor-block-lock-toolbar .components-button.has-icon:focus::before { - right: 8px !important; -} - -.block-editor-block-breadcrumb { - list-style: none; - padding: 0; - margin: 0; -} -.block-editor-block-breadcrumb li { - display: inline-flex; - margin: 0; -} -.block-editor-block-breadcrumb li .block-editor-block-breadcrumb__separator { - fill: currentColor; - margin-left: -4px; - margin-right: -4px; - transform: scaleX(1) /*rtl:scaleX(-1);*/; -} -.block-editor-block-breadcrumb li:last-child .block-editor-block-breadcrumb__separator { - display: none; -} - -.block-editor-block-breadcrumb__button.components-button { - height: 24px; - line-height: 24px; - padding: 0; - position: relative; -} -.block-editor-block-breadcrumb__button.components-button:hover:not(:disabled) { - text-decoration: underline; - box-shadow: none; -} -.block-editor-block-breadcrumb__button.components-button:focus { - box-shadow: none; -} -.block-editor-block-breadcrumb__button.components-button:focus::before { - content: ""; - display: block; - position: absolute; - border-radius: 2px; - top: 1px; - right: 1px; - bottom: 1px; - left: 1px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.block-editor-block-breadcrumb__current { - cursor: default; -} - -.block-editor-block-breadcrumb__button.components-button, -.block-editor-block-breadcrumb__current { - color: #1e1e1e; - padding: 0 8px; - font-size: inherit; -} - -.block-editor-block-card { - display: flex; - align-items: flex-start; -} - -.block-editor-block-card__content { - flex-grow: 1; - margin-bottom: 4px; -} - -.block-editor-block-card__title { - font-weight: 500; -} -.block-editor-block-card__title.block-editor-block-card__title { - line-height: 24px; - margin: 0 0 4px; -} - -.block-editor-block-card__description { - font-size: 13px; -} - -.block-editor-block-card .block-editor-block-icon { - flex: 0 0 24px; - margin-left: 0; - margin-right: 12px; - width: 24px; - height: 24px; -} - -/** - * Invalid block comparison - */ -.block-editor-block-compare { - height: auto; -} - -.block-editor-block-compare__wrapper { - display: flex; - padding-bottom: 16px; -} -.block-editor-block-compare__wrapper > div { - display: flex; - justify-content: space-between; - flex-direction: column; - width: 50%; - padding: 0 16px 0 0; - min-width: 200px; - max-width: 600px; -} -.block-editor-block-compare__wrapper > div button { - float: right; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__converted { - border-left: 1px solid #ddd; - padding-left: 15px; - padding-right: 0; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html { - font-family: Menlo, Consolas, monaco, monospace; - font-size: 12px; - color: #1e1e1e; - border-bottom: 1px solid #ddd; - padding-bottom: 15px; - line-height: 1.7; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span { - background-color: #e6ffed; - padding-top: 3px; - padding-bottom: 3px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__added { - background-color: #acf2bd; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__html span.block-editor-block-compare__removed { - background-color: #cc1818; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__preview { - padding: 0; - padding-top: 16px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__preview p { - font-size: 12px; - margin-top: 0; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__action { - margin-top: 16px; -} -.block-editor-block-compare__wrapper .block-editor-block-compare__heading { - font-size: 1em; - font-weight: 400; - margin: 0.67em 0; -} - -.block-editor-block-content-overlay.overlay-active::before { - content: ""; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: transparent; - border: none; - border-radius: 2px; - z-index: 10; -} -.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before { - background: rgba(var(--wp-admin-theme-color--rgb), 0.1); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color) inset; -} -.block-editor-block-content-overlay.overlay-active:not(.is-dragging-blocks) * { - pointer-events: none; -} -.block-editor-block-content-overlay.is-dragging-blocks { - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} - -.block-editor-block-draggable-chip-wrapper { - position: absolute; - top: -24px; - left: 0; -} - -.block-editor-block-draggable-chip { - background-color: #1e1e1e; - border-radius: 2px; - box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3); - color: #fff; - cursor: grabbing; - display: inline-flex; - height: 48px; - padding: 0 13px; - -webkit-user-select: none; - user-select: none; -} -.block-editor-block-draggable-chip svg { - fill: currentColor; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content { - margin: auto; - justify-content: flex-start; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content > .components-flex__item { - margin-right: 6px; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content > .components-flex__item:last-child { - margin-right: 0; -} -.block-editor-block-draggable-chip .block-editor-block-draggable-chip__content .block-editor-block-icon svg { - min-width: 18px; - min-height: 18px; -} -.block-editor-block-draggable-chip .components-flex__item { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} - -.block-editor-block-list__layout .is-dragging { - background-color: currentColor !important; - opacity: 0.05 !important; - border-radius: 2px !important; - pointer-events: none !important; -} -.block-editor-block-list__layout .is-dragging::selection { - background: transparent !important; -} -.block-editor-block-list__layout .is-dragging::after { - content: none !important; -} - -.block-editor-block-mobile-toolbar { - display: flex; - flex-direction: row; - border-right: 1px solid #ddd; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover-button { - width: 36px; - height: 36px; - border-radius: 2px; - padding: 3px; - margin: 0; - justify-content: center; - align-items: center; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover-button .dashicon { - margin: auto; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover { - display: flex; - margin-right: auto; -} -.block-editor-block-mobile-toolbar .block-editor-block-mover .block-editor-block-mover-button { - float: left; -} - -.block-editor-block-mover-button__description { - display: none; -} - -.block-editor-block-mover-button.has-icon { - padding: 0; -} - -.block-editor-block-mover { - display: inline-flex; - flex-direction: row; -} -.block-editor-block-mover .block-editor-block-mover__move-button-container, -.block-editor-block-mover .components-toolbar { - flex: 1; - flex-direction: row; - border-right: none !important; - padding: 0; -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover__move-button-container, -.block-editor-block-mover .components-toolbar { - flex-direction: column; - } -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container, .block-editor-block-mover.is-horizontal .components-toolbar { - flex-direction: row; -} -.block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button { - padding-right: 0; - padding-left: 0; - min-width: 36px; -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover-button { - height: 24px; - width: 42px; - padding-right: 11px !important; - padding-left: 6px !important; - } - .block-editor-block-mover .block-editor-block-mover-button.block-editor-block-mover-button { - min-width: 42px; - } -} -@media (min-width: 600px) { - .block-editor-block-mover .block-editor-block-mover-button::before { - left: 8px !important; - right: 8px !important; - } -} -.block-editor-block-mover .block-editor-block-mover__drag-handle { - width: 24px; - cursor: grab; - min-width: 24px !important; - padding: 0 !important; -} -.block-editor-block-mover .block-editor-block-mover__drag-handle:focus::before { - left: 0 !important; - right: 0 !important; -} -@media (min-width: 600px) { - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button { - margin: 0 auto 0 0; - } - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-up-button::before, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-up-button::before { - bottom: 0; - height: calc(100% - 1px); - } - .block-editor-block-mover .components-toolbar-group .block-editor-block-mover-button.is-down-button::before, -.block-editor-block-mover .components-toolbar .block-editor-block-mover-button.is-down-button::before { - top: 0; - height: calc(100% - 1px); - } -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon { - height: 48px; - width: 24px; - padding-left: 0; - padding-right: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.has-icon::before { - top: 1px; - bottom: 1px; - min-width: 0; - width: auto; - height: auto; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon svg { - margin-left: 0; - margin-right: -8px; - margin-bottom: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-up-button.has-icon::before { - left: 0 !important; - right: 0 !important; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon svg { - margin-left: -8px; - margin-right: 0; - margin-top: 0; -} -.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.is-down-button.has-icon::before { - left: 0 !important; - right: 0 !important; - width: calc(100% + 1px); -} - -.block-editor-block-navigation__container { - min-width: 280px; -} - -.block-editor-block-navigation__label { - margin: 0 0 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-block-parent-selector { - background: #fff; - border-radius: 2px; -} -.block-editor-block-parent-selector .block-editor-block-parent-selector__button { - width: 48px; - height: 48px; - border: 1px solid #1e1e1e; - border-radius: 2px; -} - -.block-editor-block-patterns-list__list-item { - cursor: pointer; - margin-bottom: 24px; -} -.block-editor-block-patterns-list__list-item.is-placeholder { - min-height: 100px; -} -.block-editor-block-patterns-list__list-item[draggable=true] .block-editor-block-preview__container { - cursor: grab; -} - -.block-editor-block-patterns-list__item { - height: 100%; -} -.block-editor-block-patterns-list__item .block-editor-block-preview__container { - display: flex; - align-items: center; - overflow: hidden; - border-radius: 2px; - border: 1px solid #f0f0f0; -} -.block-editor-block-patterns-list__item .block-editor-block-patterns-list__item-title { - padding-top: 8px; - font-size: 12px; - text-align: center; -} -.block-editor-block-patterns-list__item:hover .block-editor-block-preview__container { - border: 1px solid var(--wp-admin-theme-color); -} -.block-editor-block-patterns-list__item:focus .block-editor-block-preview__container { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-patterns-list__item:hover .block-editor-block-patterns-list__item-title, .block-editor-block-patterns-list__item:focus .block-editor-block-patterns-list__item-title { - color: var(--wp-admin-theme-color); -} - -.block-editor-block-preview__container { - position: relative; - width: 100%; - overflow: hidden; -} -.block-editor-block-preview__container .block-editor-block-preview__content { - top: 0; - left: 0; - transform-origin: top left; - text-align: initial; - margin: 0; - overflow: visible; - min-height: auto; -} -.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-list__insertion-point, -.block-editor-block-preview__container .block-editor-block-preview__content .block-editor-block-drop-zone, -.block-editor-block-preview__container .block-editor-block-preview__content .reusable-block-indicator, -.block-editor-block-preview__container .block-editor-block-preview__content .block-list-appender { - display: none; -} - -.block-editor-block-preview__content-iframe .block-list-appender { - display: none; -} - -.block-editor-block-preview__live-content * { - pointer-events: none; -} -.block-editor-block-preview__live-content .block-list-appender { - display: none; -} -.block-editor-block-preview__live-content .components-button:disabled { - opacity: initial; -} -.block-editor-block-preview__live-content .components-placeholder, -.block-editor-block-preview__live-content .block-editor-block-list__block[data-empty=true] { - display: none; -} - -.block-editor-block-settings-menu__popover .components-dropdown-menu__menu { - padding: 0; -} - -.block-editor-block-styles + .default-style-picker__default-switcher { - margin-top: 16px; -} - -.block-editor-block-styles__preview-panel { - display: none; - position: absolute; - right: 16px; - left: auto; - z-index: 90; -} -@media (min-width: 782px) { - .block-editor-block-styles__preview-panel { - display: block; - } -} -.block-editor-block-styles__preview-panel .block-editor-inserter__preview-container { - left: auto; - right: auto; - top: auto; - position: static; -} -.block-editor-block-styles__preview-panel .block-editor-block-card__title.block-editor-block-card__title { - margin: 0; -} -.block-editor-block-styles__preview-panel .block-editor-block-icon { - display: none; -} - -.block-editor-block-styles__variants { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - gap: 8px; -} -.block-editor-block-styles__variants .block-editor-block-styles__item { - color: #2f2f2f; - box-shadow: inset 0 0 0 1px #ccc; - display: inline-block; - width: calc(50% - 4px); -} -.block-editor-block-styles__variants .block-editor-block-styles__item:focus, .block-editor-block-styles__variants .block-editor-block-styles__item:hover { - color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color); -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover { - background-color: #2f2f2f; - box-shadow: none; -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active .block-editor-block-styles__item-text, .block-editor-block-styles__variants .block-editor-block-styles__item.is-active:hover .block-editor-block-styles__item-text { - color: #fff; -} -.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color); -} - -.block-editor-block-styles__block-preview-container, -.block-editor-block-styles__block-preview-container * { - box-sizing: border-box !important; -} - -.block-editor-block-switcher { - position: relative; - padding: 0 6px; -} -.block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon { - min-width: 36px; -} - -.block-editor-block-switcher__no-switcher-icon, -.block-editor-block-switcher__toggle { - position: relative; -} - -.components-button.block-editor-block-switcher__toggle, -.components-button.block-editor-block-switcher__no-switcher-icon { - margin: 0; - display: block; - height: 48px; -} -.components-button.block-editor-block-switcher__toggle .block-editor-block-icon, -.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - margin: auto; -} - -.block-editor-block-switcher__toggle-text { - margin-left: 8px; -} -.show-icon-labels .block-editor-block-switcher__toggle-text { - display: none; -} - -.show-icon-labels .block-editor-block-toolbar .block-editor-block-switcher .components-button.has-icon::after { - font-size: 14px; -} - -.block-editor-block-switcher__popover { - margin-left: 6px; -} - -.components-button.block-editor-block-switcher__no-switcher-icon { - display: flex; - padding: 6px 12px !important; -} -.components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - margin-right: auto; - margin-left: auto; - min-width: 24px !important; -} - -.components-button.block-editor-block-switcher__no-switcher-icon:disabled { - opacity: 1; -} -.components-button.block-editor-block-switcher__no-switcher-icon:disabled, -.components-button.block-editor-block-switcher__no-switcher-icon:disabled .block-editor-block-icon.has-colors { - color: #1e1e1e; -} - -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon .block-editor-block-icon { - height: 100%; - position: relative; - margin: 0 auto; - display: flex; - align-items: center; - min-width: 100%; -} -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon::before, -.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon::before { - top: 8px; - right: 8px; - bottom: 8px; - left: 8px; -} - -.components-popover.block-editor-block-switcher__popover .components-popover__content { - min-width: 300px; -} - -.components-popover.block-editor-block-switcher__popover .components-popover__content > div { - min-width: auto; - display: flex; - background: #fff; - padding: 0; -} -.components-popover.block-editor-block-switcher__popover .components-popover__content > div .components-menu-group { - margin: 0; -} - -.block-editor-block-switcher__popover .components-popover__content .block-editor-block-styles { - margin: 0 -3px; -} -.block-editor-block-switcher__popover .components-popover__content .components-panel__body { - border: 0; - position: relative; - z-index: 1; -} -.block-editor-block-switcher__popover .components-popover__content .components-panel__body + .components-panel__body { - border-top: 1px solid #e0e0e0; -} - -.block-editor-block-switcher__popover__preview__parent .block-editor-block-switcher__popover__preview__container { - position: absolute; - top: -12px; - left: calc(100% + 32px); -} - -.block-editor-block-switcher__preview__popover { - display: none; -} -.block-editor-block-switcher__preview__popover.components-popover { - margin-left: 4px; - margin-top: 11px; -} -@media (min-width: 782px) { - .block-editor-block-switcher__preview__popover { - display: block; - } -} -.block-editor-block-switcher__preview__popover .components-popover__content { - box-shadow: none; - border: 1px solid #1e1e1e; - background: #fff; - border-radius: 2px; -} -.block-editor-block-switcher__preview__popover .block-editor-block-switcher__preview { - width: 300px; - height: auto; - max-height: 500px; - padding: 16px; -} - -.block-editor-block-switcher__preview-title { - margin-bottom: 12px; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon { - min-width: 36px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle { - height: 48px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform { - width: 48px; - height: 48px; -} -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform, -.block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform { - padding: 12px; -} - -.block-editor-block-switcher__preview-patterns-container { - padding-bottom: 16px; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item { - margin-top: 16px; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-preview__container { - cursor: pointer; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item { - height: 100%; - border-radius: 2px; - transition: all 0.05s ease-in-out; - position: relative; - border: 1px solid transparent; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover, .block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:focus { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item:hover { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; -} -.block-editor-block-switcher__preview-patterns-container .block-editor-block-switcher__preview-patterns-container-list__list-item .block-editor-block-switcher__preview-patterns-container-list__item .block-editor-block-switcher__preview-patterns-container-list__item-title { - padding: 4px; - font-size: 12px; - text-align: center; - cursor: pointer; -} - -.block-editor-block-types-list > [role=presentation] { - overflow: hidden; - display: flex; - flex-wrap: wrap; -} - -.block-editor-block-variation-picker .components-placeholder__instructions { - margin-bottom: 0; -} -.block-editor-block-variation-picker .components-placeholder__fieldset { - flex-direction: column; -} -.block-editor-block-variation-picker.has-many-variations .components-placeholder__fieldset { - max-width: 90%; -} - -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations { - display: flex; - justify-content: flex-start; - flex-direction: row; - flex-wrap: wrap; - width: 100%; - margin: 16px 0; - padding: 0; - list-style: none; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations > li { - list-style: none; - margin: 8px 20px 0 0; - flex-shrink: 1; - width: 75px; - text-align: center; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations > li button { - display: inline-flex; - margin-right: 0; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation { - padding: 8px; -} -.block-editor-block-variation-picker__variations.block-editor-block-variation-picker__variations .block-editor-block-variation-picker__variation-label { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 12px; - display: block; - line-height: 1.4; -} - -.block-editor-block-variation-picker__variation { - width: 100%; -} -.block-editor-block-variation-picker__variation.components-button.has-icon { - justify-content: center; - width: auto; -} -.block-editor-block-variation-picker__variation.components-button.has-icon.is-secondary { - background-color: #fff; -} -.block-editor-block-variation-picker__variation.components-button { - height: auto; - padding: 0; -} -.block-editor-block-variation-picker__variation::before { - content: ""; - padding-bottom: 100%; -} -.block-editor-block-variation-picker__variation:first-child { - margin-left: 0; -} -.block-editor-block-variation-picker__variation:last-child { - margin-right: 0; -} - -.block-editor-block-pattern-setup { - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-start; - width: 100%; - border-radius: 2px; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar { - justify-content: center; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container { - column-gap: 24px; - display: block; - width: 100%; - padding: 32px; - column-count: 2; -} -@media (min-width: 1440px) { - .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container { - column-count: 3; - } -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container, -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button] { - cursor: pointer; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item { - break-inside: avoid-column; - margin-bottom: 24px; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container { - min-height: 100px; - border-radius: 2px; - border: 1px solid #ddd; -} -.block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content { - width: 100%; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar { - height: 60px; - box-sizing: border-box; - padding: 16px; - width: 100%; - text-align: left; - margin: 0; - color: #1e1e1e; - border-radius: 2px 2px 0 0; - background-color: #fff; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - border-top: 1px solid #ddd; - align-self: flex-end; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls { - display: flex; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__navigation, -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions { - width: calc(50% - 36px); - display: flex; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__actions { - justify-content: flex-end; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container { - display: flex; - flex-direction: column; - width: 100%; - box-sizing: border-box; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container { - overflow: hidden; - position: relative; - padding: 0; - margin: 0; - list-style: none; - transform-style: preserve-3d; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container * { - box-sizing: border-box; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide { - position: absolute; - top: 0; - width: 100%; - margin: auto; - padding: 0; - transition: transform 0.5s, z-index 0.5s; - z-index: 100; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide { - opacity: 1; - position: relative; - z-index: 102; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.previous-slide { - transform: translateX(-100%); - z-index: 101; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.next-slide { - transform: translateX(100%); - z-index: 101; -} -.block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .block-list-appender { - display: none; -} - -.block-editor-block-pattern-setup__carousel, -.block-editor-block-pattern-setup__grid { - width: 100%; - overflow-y: auto; -} - -.block-editor-block-variation-transforms { - padding: 0 16px 16px 52px; - width: 100%; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle { - border: 1px solid #757575; - border-radius: 2px; - min-height: 30px; - width: 100%; - position: relative; - text-align: left; - justify-content: left; - padding: 6px 12px; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle.components-dropdown-menu__toggle { - padding-right: 24px; -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled) { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color); -} -.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg { - height: 100%; - padding: 0; - position: absolute; - right: 0; - top: 0; -} - -.block-editor-block-variation-transforms__popover .components-popover__content { - min-width: 230px; -} - -.components-border-radius-control { - margin-bottom: 12px; -} -.components-border-radius-control legend { - margin-bottom: 8px; -} -.components-border-radius-control .components-border-radius-control__wrapper { - display: flex; - justify-content: space-between; - align-items: flex-start; -} -.components-border-radius-control .components-border-radius-control__wrapper > .components-unit-control-wrapper { - width: calc(50% - 26px); - margin-bottom: 0; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control { - width: calc(50% - 26px); - margin-bottom: 0; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-base-control__field { - margin-bottom: 0; - height: 30px; -} -.components-border-radius-control .components-border-radius-control__wrapper .components-range-control .components-range-control__wrapper { - margin-right: 10px; -} -.components-border-radius-control .components-border-radius-control__wrapper > span { - flex: 0 0 auto; -} -.components-border-radius-control .components-border-radius-control__input-controls-wrapper { - display: flex; - width: 70%; - flex-wrap: wrap; -} -.components-border-radius-control .components-border-radius-control__input-controls-wrapper .components-unit-control-wrapper { - width: calc(50% - 8px); - margin-bottom: 8px; - margin-right: 8px; -} -.components-border-radius-control .component-border-radius-control__linked-button.has-icon { - display: flex; - justify-content: center; -} -.components-border-radius-control .component-border-radius-control__linked-button.has-icon svg { - margin-right: 0; -} - -.components-border-style-control legend { - line-height: 1.4; - margin-bottom: 8px; - padding: 0; -} -.components-border-style-control .components-border-style-control__buttons { - display: inline-flex; -} -.components-border-style-control .components-border-style-control__buttons .components-button.has-icon { - min-width: 30px; - height: 30px; - padding: 3px; - margin-right: 4px; -} - -.block-editor-button-block-appender { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: 100%; - height: auto; - color: #1e1e1e; - box-shadow: inset 0 0 0 1px #1e1e1e; -} -.block-editor-button-block-appender.components-button.components-button { - padding: 12px; -} -.is-dark-theme .block-editor-button-block-appender { - color: rgba(255, 255, 255, 0.65); - box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65); -} -.block-editor-button-block-appender:hover { - color: var(--wp-admin-theme-color); - box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color); -} -.block-editor-button-block-appender:focus { - box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color); -} -.block-editor-button-block-appender:active { - color: #000; -} - -.block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator { - margin-bottom: 12px; -} - -.block-editor-color-gradient-control__fieldset { - min-width: 0; -} - -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title { - display: flex; - gap: 8px; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator { - width: 12px; - height: 12px; - align-self: center; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child { - margin-left: 12px; -} -.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator { - display: none; -} -@media screen and (min-width: 782px) { - .block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches { - display: grid; - grid-template-columns: repeat(6, 28px); - justify-content: space-between; - } -} -.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control { - margin-bottom: inherit; -} -.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown { - display: block; -} - -.block-editor-panel-color-gradient-settings__dropdown { - width: 100%; -} - -.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content > div { - width: 280px; -} - -@media (min-width: 782px) { - .block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content { - margin-right: 156px !important; - } - .block-editor-panel-color-gradient-settings__dropdown-content.is-from-top .components-popover__content { - margin-top: -60px !important; - } - .block-editor-panel-color-gradient-settings__dropdown-content.is-from-bottom .components-popover__content { - margin-bottom: -60px !important; - } -} -.block-editor-panel-color-gradient-settings__dropdown:last-child > div { - border-bottom-width: 0; -} - -.block-editor-panel-color-gradient-settings__item { - padding-top: 12px !important; - padding-bottom: 12px !important; -} -.block-editor-panel-color-gradient-settings__item .block-editor-panel-color-gradient-settings__color-indicator { - background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} -.block-editor-panel-color-gradient-settings__item.is-open { - background: #f0f0f0; - color: var(--wp-admin-theme-color); -} - -.block-editor-contrast-checker > .components-notice { - margin: 0; -} - -/** - * Default block appender. - * - * This component shows up in 3 places: - * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph - * - on the right, inside empty paragraphs - * - absolute positioned and blue inside nesting containers - */ -.block-editor-default-block-appender { - clear: both; - margin-left: auto; - margin-right: auto; - position: relative; -} -.block-editor-default-block-appender[data-root-client-id=""] .block-editor-default-block-appender__content:hover { - outline: 1px solid transparent; -} -.block-editor-default-block-appender .block-editor-default-block-appender__content { - opacity: 0.62; -} -.block-editor-default-block-appender .components-drop-zone__content-icon { - display: none; -} - -.block-editor-default-block-appender .block-editor-inserter, -.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter { - position: absolute; - top: 0; - right: 0; - line-height: 0; -} -.block-editor-default-block-appender .block-editor-inserter:disabled, -.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled { - display: none; -} - -/** - * Fixed position appender. - * These styles apply to all in-canvas inserters that exist inside nesting containers. - */ -.block-editor-block-list__block .block-list-appender { - position: absolute; - list-style: none; - padding: 0; - z-index: 2; - bottom: 0; - right: 0; -} -.block-editor-block-list__block .block-list-appender.block-list-appender { - margin: 0; - line-height: 0; -} -.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender { - height: 24px; -} -.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block .block-list-appender .block-list-appender__toggle { - flex-direction: row; - box-shadow: none; - height: 24px; - width: 24px; - display: none; - padding: 0 !important; - background: #1e1e1e; - color: #fff; -} -.block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover, -.block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover { - color: #fff; - background: var(--wp-admin-theme-color); -} -.block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content { - display: none; -} -.block-editor-block-list__block .block-list-appender:only-child { - position: relative; - right: auto; - align-self: center; - list-style: none; - line-height: inherit; -} -.block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content { - display: block; -} - -.block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle, -.block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon, -.block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle { - display: flex; -} - -.block-editor-default-block-appender__content { - cursor: text; -} - -.block-editor-date-format-picker { - margin-bottom: 16px; -} - -.block-editor-date-format-picker__default-format-toggle-control__hint { - color: #757575; - display: block; -} - -.block-editor-date-format-picker__custom-format-select-control.components-base-control { - margin-bottom: 0; -} -.block-editor-date-format-picker__custom-format-select-control .components-custom-select-control__button { - width: 100%; -} - -.block-editor-date-format-picker__custom-format-select-control__custom-option { - border-top: 1px solid #ddd; -} -.block-editor-date-format-picker__custom-format-select-control__custom-option.has-hint { - grid-template-columns: auto 30px; -} -.block-editor-date-format-picker__custom-format-select-control__custom-option .components-custom-select-control__item-hint { - grid-row: 2; - text-align: left; -} - -.block-editor-duotone-control__popover > .components-popover__content > div { - padding: 16px; - width: 280px; -} -.block-editor-duotone-control__popover .components-menu-group__label { - padding: 0; -} -.block-editor-duotone-control__popover .components-custom-gradient-picker__gradient-bar { - margin: 16px 0 12px; -} -.block-editor-duotone-control__popover .components-circular-option-picker__swatches { - display: grid; - grid-template-columns: repeat(6, 28px); - gap: 12px; - justify-content: space-between; -} - -.block-editor-duotone-control__description { - margin: 16px 0; - font-size: 12px; -} - -.block-editor-duotone-control__popover:not([data-y-axis=middle][data-x-axis=right]) > .components-popover__content { - margin-left: -14px; -} - -.components-font-appearance-control { - margin-bottom: 24px; -} -.components-font-appearance-control ul li { - color: #1e1e1e; - text-transform: capitalize; -} - -.block-editor-image-size-control { - margin-bottom: 1em; -} -.block-editor-image-size-control .block-editor-image-size-control__row { - display: flex; - justify-content: space-between; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width, -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height { - margin-bottom: 0.5em; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width input, -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height input { - line-height: 1.25; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__width { - margin-right: 5px; -} -.block-editor-image-size-control .block-editor-image-size-control__row .block-editor-image-size-control__height { - margin-left: 5px; -} - -.block-editor-block-list__layout.has-overlay::after { - content: ""; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 60; -} - -.block-editor-block-types-list__list-item { - display: block; - width: 33.33%; - padding: 0; - margin: 0; -} - -.components-button.block-editor-block-types-list__item { - display: flex; - flex-direction: column; - width: 100%; - font-size: 13px; - color: #1e1e1e; - padding: 8px; - align-items: stretch; - justify-content: center; - cursor: pointer; - background: transparent; - word-break: break-word; - border-radius: 2px; - transition: all 0.05s ease-in-out; - position: relative; - height: auto; -} -@media (prefers-reduced-motion: reduce) { - .components-button.block-editor-block-types-list__item { - transition-duration: 0s; - transition-delay: 0s; - } -} -.components-button.block-editor-block-types-list__item:disabled { - opacity: 0.6; - cursor: default; -} -.components-button.block-editor-block-types-list__item:not(:disabled):hover { - color: var(--wp-admin-theme-color) !important; -} -.components-button.block-editor-block-types-list__item:not(:disabled):focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.components-button.block-editor-block-types-list__item:not(:disabled).is-active { - color: #fff; - background: #1e1e1e; - outline: 2px solid transparent; - outline-offset: -2px; -} - -.block-editor-block-types-list__item-icon { - padding: 12px 20px; - border-radius: 2px; - color: #1e1e1e; - transition: all 0.05s ease-in-out; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-types-list__item-icon { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-types-list__item-icon .block-editor-block-icon { - margin-left: auto; - margin-right: auto; -} -.block-editor-block-types-list__item-icon svg { - transition: all 0.15s ease-out; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-types-list__item-icon svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-block-types-list__list-item[draggable=true] .block-editor-block-types-list__item-icon { - cursor: grab; -} - -.block-editor-block-types-list__item-title { - padding: 4px 2px 8px; - font-size: 12px; -} - -.items-justified-left { - justify-content: flex-start; -} - -.items-justified-center { - justify-content: center; -} - -.items-justified-right { - justify-content: flex-end; -} - -.items-justified-space-between { - justify-content: space-between; -} - -@keyframes loadingpulse { - 0% { - opacity: 1; - } - 50% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -.block-editor-link-control { - position: relative; - min-width: 360px; -} -.components-popover__content .block-editor-link-control { - min-width: auto; - width: 90vw; - max-width: 360px; -} - -.block-editor-link-control__search-input-wrapper { - position: relative; -} - -.block-editor-link-control__search-input-container { - position: relative; -} - -.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input { - flex: 1; -} - -.block-editor-link-control__field { - margin: 16px; -} -.block-editor-link-control__field > .components-base-control__field { - display: flex; - align-items: center; - margin: 0; -} -.block-editor-link-control__field .components-base-control__label { - margin-right: 16px; - margin-bottom: 0; -} -.block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - width: calc(100% - 32px); - display: block; - padding: 11px 16px; - padding-right: 36px; - margin: 0; - position: relative; - border: 1px solid #ddd; - border-radius: 2px; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-link-control__field input[type=text], .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.block-editor-link-control__field input[type=text]:focus, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-link-control__field input[type=text]::-webkit-input-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.block-editor-link-control__field input[type=text]::-moz-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.block-editor-link-control__field input[type=text]:-ms-input-placeholder, .block-editor-link-control__field.block-editor-url-input input[type=text].block-editor-url-input__input:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.block-editor-link-control__search-error { - margin: -8px 16px 16px; -} - -.block-editor-link-control__search-actions { - position: absolute; - /* - * Actions must be positioned on top of URLInput, since the input will grow - * when suggestions are rendered. - * - * Compensate for: - * - Border (1px) - * - Vertically, for the difference in height between the input (40px) and - * the icon buttons. - * - Horizontally, pad to the minimum of: default input padding, or the - * equivalent of the vertical padding. - */ - top: 3px; - right: 19px; -} - -.components-button .block-editor-link-control__search-submit .has-icon { - margin: -1px; -} - -.block-editor-link-control__search-results-wrapper { - position: relative; - margin-top: -15px; -} -.block-editor-link-control__search-results-wrapper::before, .block-editor-link-control__search-results-wrapper::after { - content: ""; - position: absolute; - left: -1px; - right: 16px; - display: block; - pointer-events: none; - z-index: 100; -} -.block-editor-link-control__search-results-wrapper::before { - height: 8px; - top: 0; - bottom: auto; -} -.block-editor-link-control__search-results-wrapper::after { - height: 16px; - bottom: 0; - top: auto; -} - -.block-editor-link-control__search-results-label { - padding: 16px 32px 0; - display: block; - font-weight: 600; -} - -.block-editor-link-control__search-results { - margin: 0; - padding: 8px 16px 8px; - max-height: 200px; - overflow-y: auto; -} -.block-editor-link-control__search-results.is-loading { - opacity: 0.2; -} - -.block-editor-link-control__search-item { - position: relative; - display: flex; - align-items: flex-start; - font-size: 13px; - cursor: pointer; - background: #fff; - width: 100%; - border: none; - text-align: left; - padding: 12px 16px; - border-radius: 2px; - height: auto; -} -.block-editor-link-control__search-item:hover, .block-editor-link-control__search-item:focus { - background-color: #f0f0f0; -} -.block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type, .block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type { - background: #fff; -} -.block-editor-link-control__search-item:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset; -} -.block-editor-link-control__search-item.is-selected { - background: #f0f0f0; -} -.block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type { - background: #fff; -} -.block-editor-link-control__search-item.is-current { - flex-direction: column; - background: transparent; - border: 0; - width: 100%; - cursor: default; - padding: 16px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-header { - display: block; - flex-direction: row; - align-items: flex-start; - margin-right: 8px; - white-space: pre-wrap; - overflow-wrap: break-word; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info { - word-break: break-all; -} -.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header { - display: flex; - flex: 1; -} -.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-header { - align-items: center; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-icon { - position: relative; - top: 0.2em; - margin-right: 8px; - max-height: 24px; - flex-shrink: 0; - width: 24px; - display: flex; - justify-content: center; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-icon img { - width: 16px; -} -.block-editor-link-control__search-item.is-error .block-editor-link-control__search-item-icon { - top: 0; - width: 32px; - max-height: 32px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info, -.block-editor-link-control__search-item .block-editor-link-control__search-item-title { - overflow: hidden; - text-overflow: ellipsis; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon, -.block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon { - position: absolute; - right: 0; - margin-top: 0; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title { - display: block; - margin-bottom: 0.2em; - font-weight: 500; - position: relative; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark { - font-weight: 700; - color: inherit; - background-color: transparent; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title span { - font-weight: normal; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-title svg { - display: none; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-info { - display: block; - color: #757575; - font-size: 0.9em; - line-height: 1.3; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice { - font-style: italic; - font-size: 1.1em; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-type { - display: block; - padding: 3px 6px; - margin-left: auto; - font-size: 0.9em; - background-color: #f0f0f0; - border-radius: 2px; - white-space: nowrap; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description { - padding-top: 12px; - margin: 0; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder { - margin-top: 12px; - padding-top: 0; - height: 28px; - display: flex; - flex-direction: column; - justify-content: space-around; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder::before, .block-editor-link-control__search-item .block-editor-link-control__search-item-description.is-placeholder::after { - display: block; - content: ""; - height: 0.7em; - width: 100%; - background-color: #f0f0f0; - border-radius: 3px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-description .components-text { - font-size: 0.9em; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image { - display: flex; - width: 100%; - background-color: #f0f0f0; - justify-content: center; - height: 140px; - max-height: 140px; - overflow: hidden; - border-radius: 2px; - margin-top: 12px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image.is-placeholder { - background-color: #f0f0f0; - border-radius: 3px; -} -.block-editor-link-control__search-item .block-editor-link-control__search-item-image img { - display: block; - max-width: 100%; - height: 140px; - max-height: 140px; -} - -.block-editor-link-control__search-item-top { - display: flex; - flex-direction: row; - width: 100%; -} - -.block-editor-link-control__search-item-bottom { - transition: opacity 1.5s; - width: 100%; -} - -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description::before, .block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-description::after { - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-image { - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon svg, -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon img { - opacity: 0; -} -.block-editor-link-control__search-item.is-fetching .block-editor-link-control__search-item-icon::before { - content: ""; - display: block; - background-color: #f0f0f0; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - border-radius: 100%; - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; -} - -.block-editor-link-control__loading { - margin: 16px; - display: flex; - align-items: center; -} -.block-editor-link-control__loading .components-spinner { - margin-top: 0; -} - -.components-button + .block-editor-link-control__search-create { - overflow: visible; - padding: 12px 16px; -} -.components-button + .block-editor-link-control__search-create::before { - content: ""; - position: absolute; - top: -10px; - left: 0; - display: block; - width: 100%; -} - -.block-editor-link-control__search-create { - align-items: center; -} -.block-editor-link-control__search-create .block-editor-link-control__search-item-title { - margin-bottom: 0; -} -.block-editor-link-control__search-create .block-editor-link-control__search-item-icon { - top: 0; -} - -.block-editor-link-control__search-results div[role=menu] > .block-editor-link-control__search-item.block-editor-link-control__search-item { - padding: 10px; -} - -.block-editor-link-control__tools { - display: flex; - align-items: center; - border-top: 1px solid #ddd; - margin: 0; - padding: 16px; -} - -.block-editor-link-control__unlink { - padding-left: 16px; - padding-right: 16px; -} - -.block-editor-link-control__settings { - flex: 1; - margin: 0; -} -.block-editor-link-control__settings :last-child { - margin-bottom: 0; -} -.is-alternate .block-editor-link-control__settings { - border-top: 1px solid #1e1e1e; -} - -.block-editor-link-control__setting { - margin-bottom: 16px; -} -.block-editor-link-control__setting :last-child { - margin-bottom: 0; -} - -.block-editor-link-control .block-editor-link-control__search-input .components-spinner { - display: block; -} -.block-editor-link-control .block-editor-link-control__search-input .components-spinner.components-spinner { - position: absolute; - left: auto; - bottom: auto; - /* - * Position spinner to the left of the actions. - * - * Compensate for: - * - Input padding right ($button-size) - */ - top: calc(50% - 16px / 2); - right: 36px; -} - -.block-editor-link-control__search-item-action { - margin-left: auto; - flex-shrink: 0; -} - -.block-editor-list-view-tree { - width: 100%; - border-collapse: collapse; - padding: 0; - margin: 0; -} -.components-modal__content .block-editor-list-view-tree { - margin: -12px -6px 0; - width: calc(100% + 12px); -} - -.block-editor-list-view-leaf { - position: relative; -} -.block-editor-list-view-leaf.is-selected td { - background: var(--wp-admin-theme-color); -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents, .block-editor-list-view-leaf.is-selected .components-button.has-icon { - color: #fff; -} -.is-dragging-components-draggable .block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents { - background: none; - color: #1e1e1e; -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents:focus::after { - box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block__menu:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #fff; -} -.block-editor-list-view-leaf.is-dragging { - display: none; -} -.block-editor-list-view-leaf.is-first-selected td:first-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf.is-first-selected td:last-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf.is-last-selected td:first-child { - border-bottom-left-radius: 2px; -} -.block-editor-list-view-leaf.is-last-selected td:last-child { - border-bottom-right-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) { - background: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), linear-gradient(var(--wp-admin-theme-color), var(--wp-admin-theme-color)); -} -.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:first-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected.is-first-selected td:last-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:first-child { - border-top-left-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-first-selected td:last-child { - border-top-right-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:first-child { - border-bottom-left-radius: 2px; -} -.block-editor-list-view-leaf[aria-expanded=false].is-branch-selected.is-last-selected td:last-child { - border-bottom-right-radius: 2px; -} -.block-editor-list-view-leaf.is-branch-selected:not(.is-selected) td { - border-radius: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents { - display: flex; - align-items: center; - width: 100%; - height: auto; - padding: 6px 12px 6px 0; - text-align: left; - color: #1e1e1e; - border-radius: 2px; - position: relative; - white-space: nowrap; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents.is-dropping-before::before { - content: ""; - position: absolute; - pointer-events: none; - transition: border-color 0.1s linear, border-style 0.1s linear, box-shadow 0.1s linear; - top: -2px; - right: 0; - left: 0; - border-top: 4px solid var(--wp-admin-theme-color); -} -.components-modal__content .block-editor-list-view-leaf .block-editor-list-view-block-contents { - padding-left: 0; - padding-right: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus { - box-shadow: none; -} -.block-editor-list-view-leaf .block-editor-list-view-block-contents:focus::after { - content: ""; - position: absolute; - top: 0; - right: -29px; - bottom: 0; - left: 0; - border-radius: inherit; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - z-index: 2; - pointer-events: none; -} -.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block-contents:focus::after { - box-shadow: none; -} -.block-editor-list-view-leaf.has-single-cell .block-editor-list-view-block-contents:focus::after { - right: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - z-index: 1; -} -.is-dragging-components-draggable .block-editor-list-view-leaf .block-editor-list-view-block__menu:focus { - box-shadow: none; -} -.block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents { - opacity: 1; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf.is-visible .block-editor-list-view-block-contents { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-block-icon { - align-self: flex-start; - margin-right: 8px; - width: 24px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__contents-cell { - padding-top: 0; - padding-bottom: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell { - line-height: 0; - width: 36px; - vertical-align: middle; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell { - transition-duration: 0s; - transition-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell > * { - opacity: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible { - position: relative; - z-index: 1; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover > *, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible > * { - opacity: 1; - animation: edit-post__fade-in-animation 0.2s ease-out 0s; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell:hover > *, .block-editor-list-view-leaf .block-editor-list-view-block__menu-cell.is-visible > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell:hover > *, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell.is-visible > * { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell, -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell .components-button.has-icon { - width: 24px; - min-width: 24px; - padding: 0; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell { - padding-right: 5px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__menu-cell .components-button.has-icon { - height: 24px; -} -.block-editor-list-view-leaf .block-editor-list-view-block__mover-cell-alignment-wrapper { - display: flex; - height: 100%; - flex-direction: column; - align-items: center; -} -.block-editor-list-view-leaf .block-editor-block-mover-button { - position: relative; - width: 36px; - height: 24px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button svg { - position: relative; - height: 24px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button { - margin-top: -6px; - align-items: flex-end; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-up-button svg { - bottom: -4px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button { - margin-bottom: -6px; - align-items: flex-start; -} -.block-editor-list-view-leaf .block-editor-block-mover-button.is-down-button svg { - top: -4px; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus:enabled { - box-shadow: none; - outline: none; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus { - box-shadow: none; - outline: none; -} -.block-editor-list-view-leaf .block-editor-block-mover-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} -.block-editor-list-view-leaf .block-editor-block-mover-button::before { - content: ""; - position: absolute; - display: block; - border-radius: 2px; - height: 16px; - min-width: 100%; - left: 0; - right: 0; - animation: components-button__appear-animation 0.1s ease; - animation-fill-mode: forwards; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf .block-editor-block-mover-button::before { - animation-duration: 1ms; - animation-delay: 0s; - } -} -.block-editor-list-view-leaf .block-editor-inserter__toggle { - background: #1e1e1e; - color: #fff; - height: 24px; - margin: 6px 6px 6px 1px; - min-width: 24px; -} -.block-editor-list-view-leaf .block-editor-inserter__toggle:active { - color: #fff; -} -.block-editor-list-view-leaf .block-editor-list-view-block-select-button__anchor { - background: rgba(0, 0, 0, 0.1); - border-radius: 2px; - display: inline-block; - padding: 2px 6px; - margin: 0 8px; - max-width: 120px; - overflow: hidden; - text-overflow: ellipsis; -} -.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-select-button__anchor { - background: rgba(0, 0, 0, 0.3); -} -.block-editor-list-view-leaf .block-editor-list-view-block-select-button__lock { - line-height: 0; - width: 24px; - min-width: 24px; - margin-left: auto; - padding: 0; - vertical-align: middle; -} - -.block-editor-list-view-block-select-button__description, -.block-editor-list-view-appender__description { - display: none; -} - -.block-editor-list-view-block__contents-cell .block-editor-list-view-block__contents-container, -.block-editor-list-view-block__contents-cell .block-editor-list-view-appender__container, -.block-editor-list-view-appender__cell .block-editor-list-view-block__contents-container, -.block-editor-list-view-appender__cell .block-editor-list-view-appender__container { - display: flex; -} - -.block-editor-list-view__expander { - height: 24px; - margin-left: 4px; - width: 24px; -} - -.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander { - margin-left: 220px; -} - -.block-editor-list-view-leaf:not([aria-level="1"]) .block-editor-list-view__expander { - margin-right: 4px; -} - -.block-editor-list-view-leaf[aria-level="1"] .block-editor-list-view__expander { - margin-left: 0px; -} - -.block-editor-list-view-leaf[aria-level="2"] .block-editor-list-view__expander { - margin-left: 24px; -} - -.block-editor-list-view-leaf[aria-level="3"] .block-editor-list-view__expander { - margin-left: 52px; -} - -.block-editor-list-view-leaf[aria-level="4"] .block-editor-list-view__expander { - margin-left: 80px; -} - -.block-editor-list-view-leaf[aria-level="5"] .block-editor-list-view__expander { - margin-left: 108px; -} - -.block-editor-list-view-leaf[aria-level="6"] .block-editor-list-view__expander { - margin-left: 136px; -} - -.block-editor-list-view-leaf[aria-level="7"] .block-editor-list-view__expander { - margin-left: 164px; -} - -.block-editor-list-view-leaf[aria-level="8"] .block-editor-list-view__expander { - margin-left: 192px; -} - -.block-editor-list-view-leaf .block-editor-list-view__expander { - visibility: hidden; -} - -.block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg { - visibility: visible; - transition: transform 0.2s ease; - transform: rotate(90deg); -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf[aria-expanded=true] .block-editor-list-view__expander svg { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg { - visibility: visible; - transform: rotate(0deg); - transition: transform 0.2s ease; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-list-view-leaf[aria-expanded=false] .block-editor-list-view__expander svg { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-list-view-drop-indicator { - pointer-events: none; -} -.block-editor-list-view-drop-indicator .block-editor-list-view-drop-indicator__line { - background: var(--wp-admin-theme-color); - height: 1px; -} - -.block-editor-list-view-drop-indicator:not([data-y-axis=middle][data-x-axis=right]) > .components-popover__content { - margin-left: 0; - border: none; - box-shadow: none; -} - -.block-editor-list-view-placeholder { - padding: 0; - margin: 0; - height: 36px; -} - -.modal-open .block-editor-media-replace-flow__options { - display: none; -} - -.block-editor-media-replace-flow__indicator { - margin-left: 4px; -} - -.block-editor-media-flow__url-input { - border-top: 1px solid #1e1e1e; - margin-top: 8px; - margin-right: -8px; - margin-left: -8px; - padding: 16px; -} -.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label { - display: block; - top: 16px; - margin-bottom: 8px; -} -.block-editor-media-flow__url-input .block-editor-link-control { - width: 220px; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input { - padding: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .components-base-control .components-base-control__field { - margin-bottom: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title { - max-width: 180px; - white-space: nowrap; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info { - white-space: nowrap; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current { - width: auto; - padding: 0; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-input.block-editor-link-control__search-input input[type=text] { - margin: 0; - width: 100%; -} -.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-actions { - top: 0; - right: 4px; -} - -.block-editor-media-flow__error { - padding: 0 20px 20px 20px; - max-width: 255px; -} -.block-editor-media-flow__error .components-with-notices-ui { - max-width: 255px; -} -.block-editor-media-flow__error .components-with-notices-ui .components-notice__content { - overflow: hidden; - word-wrap: break-word; -} -.block-editor-media-flow__error .components-with-notices-ui .components-notice__dismiss { - position: absolute; - right: 10px; -} - -.block-editor-media-placeholder__url-input-container .block-editor-media-placeholder__button { - margin-bottom: 0; -} - -.block-editor-media-placeholder__url-input-form { - display: flex; -} -.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field { - width: 100%; - min-width: 200px; - flex-grow: 1; - border: none; - border-radius: 0; - margin: 2px; -} -@media (min-width: 600px) { - .block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field { - width: 300px; - } -} - -.block-editor-media-placeholder__url-input-submit-button { - flex-shrink: 1; -} - -.block-editor-media-placeholder__button { - margin-bottom: 0.5rem; -} - -.block-editor-media-placeholder__cancel-button.is-link { - margin: 1em; - display: block; -} - -.block-editor-media-placeholder.is-appender { - min-height: 0; -} -.block-editor-media-placeholder.is-appender:hover { - cursor: pointer; - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); -} - -.block-editor-multi-selection-inspector__card { - display: flex; - align-items: flex-start; - padding: 16px; -} - -.block-editor-multi-selection-inspector__card-content { - flex-grow: 1; -} - -.block-editor-multi-selection-inspector__card-title { - font-weight: 500; - margin-bottom: 5px; -} - -.block-editor-multi-selection-inspector__card-description { - font-size: 13px; -} - -.block-editor-multi-selection-inspector__card .block-editor-block-icon { - margin-left: -2px; - margin-right: 10px; - padding: 0 3px; - width: 36px; - height: 24px; -} - -.block-editor-plain-text { - box-shadow: none; - font-family: inherit; - font-size: inherit; - color: inherit; - line-height: inherit; - border: none; - padding: 0; - margin: 0; - width: 100%; -} - -.block-editor-responsive-block-control { - margin-bottom: 28px; - border-bottom: 1px solid #ccc; - padding-bottom: 14px; -} -.block-editor-responsive-block-control:last-child { - padding-bottom: 0; - border-bottom: 0; -} - -.block-editor-responsive-block-control__title { - margin: 0; - margin-bottom: 0.6em; - margin-left: -3px; -} - -.block-editor-responsive-block-control__label { - font-weight: 600; - margin-bottom: 0.6em; - margin-left: -3px; -} - -.block-editor-responsive-block-control__inner { - margin-left: -1px; -} - -.block-editor-responsive-block-control__toggle { - margin-left: 1px; -} - -.block-editor-responsive-block-control .components-base-control__help { - border: 0; - clip: rect(1px, 1px, 1px, 1px); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - word-wrap: normal !important; -} - -.rich-text [data-rich-text-placeholder] { - pointer-events: none; -} -.rich-text [data-rich-text-placeholder]::after { - content: attr(data-rich-text-placeholder); - opacity: 0.62; -} -.rich-text:focus { - outline: none; -} -.rich-text:focus [data-rich-text-format-boundary] { - border-radius: 2px; -} - -.block-editor-rich-text__editable > p:first-child { - margin-top: 0; -} - -figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before { - opacity: 0.8; -} - -.components-popover.block-editor-rich-text__inline-format-toolbar { - z-index: 99998; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-popover__content { - width: auto; - min-width: auto; - margin-bottom: 8px; - box-shadow: none; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group, -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar { - border: none; -} -.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control, -.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle { - min-width: 48px; - min-height: 48px; - padding-left: 12px; - padding-right: 12px; -} - -.block-editor-rich-text__inline-format-toolbar-group .components-dropdown-menu__toggle { - justify-content: center; -} - -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon { - width: auto; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon svg { - display: none; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button.has-icon::after { - content: attr(aria-label); -} - -[data-rich-text-script] { - display: inline; -} -[data-rich-text-script]::before { - content: ""; - background: yellow; -} - -.block-editor-skip-to-selected-block { - position: absolute; - top: -9999em; -} -.block-editor-skip-to-selected-block:focus { - height: auto; - width: auto; - display: block; - font-size: 14px; - font-weight: 600; - padding: 15px 23px 14px; - background: #f1f1f1; - color: var(--wp-admin-theme-color); - line-height: normal; - box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); - text-decoration: none; - outline: none; - z-index: 100000; -} - -.block-editor-text-transform-control { - flex: 0 0 50%; -} -.block-editor-text-transform-control legend { - margin-bottom: 8px; -} -.block-editor-text-transform-control .block-editor-text-transform-control__buttons { - display: inline-flex; - margin-bottom: 24px; -} -.block-editor-text-transform-control .block-editor-text-transform-control__buttons .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; -} - -.block-editor-text-decoration-control { - flex: 0 0 50%; -} -.block-editor-text-decoration-control legend { - margin-bottom: 8px; -} -.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons { - display: inline-flex; - margin-bottom: 24px; -} -.block-editor-text-decoration-control .block-editor-text-decoration-control__buttons .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; -} - -.block-editor-tool-selector__help { - margin-top: 8px; - margin-left: -8px; - margin-right: -8px; - margin-bottom: -8px; - padding: 16px; - border-top: 1px solid #ddd; - color: #757575; - min-width: 280px; -} - -.block-editor-block-list__block .block-editor-url-input, -.components-popover .block-editor-url-input, -.block-editor-url-input { - flex-grow: 1; - position: relative; - padding: 1px; -} -.block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - width: 100%; - padding: 8px 8px 8px 12px; - border: none; - border-radius: 0; - margin-left: 0; - margin-right: 0; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; -} -@media (min-width: 600px) { - .block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - width: 300px; - } -} -@media (min-width: 600px) { - .block-editor-block-list__block .block-editor-url-input input[type=text], -.components-popover .block-editor-url-input input[type=text], -.block-editor-url-input input[type=text] { - font-size: 13px; - } -} -.block-editor-block-list__block .block-editor-url-input input[type=text]::-ms-clear, -.components-popover .block-editor-url-input input[type=text]::-ms-clear, -.block-editor-url-input input[type=text]::-ms-clear { - display: none; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width, -.components-popover .block-editor-url-input.is-full-width, -.block-editor-url-input.is-full-width { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text], -.components-popover .block-editor-url-input.is-full-width .block-editor-url-input__input[type=text], -.block-editor-url-input.is-full-width .block-editor-url-input__input[type=text] { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input.is-full-width__suggestions, -.components-popover .block-editor-url-input.is-full-width__suggestions, -.block-editor-url-input.is-full-width__suggestions { - width: 100%; -} -.block-editor-block-list__block .block-editor-url-input .components-spinner, -.components-popover .block-editor-url-input .components-spinner, -.block-editor-url-input .components-spinner { - position: absolute; - right: 8px 8px 8px 12px; - bottom: 8px 8px 8px 12px8px1; - margin: 0; -} - -.block-editor-url-input__input[type=text] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-url-input__input[type=text] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-url-input__input[type=text] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.block-editor-url-input__input[type=text]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.block-editor-url-input__input[type=text]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.block-editor-url-input__input[type=text]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.block-editor-url-input__input[type=text]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.block-editor-url-input__suggestions { - max-height: 200px; - transition: all 0.15s ease-in-out; - padding: 4px 0; - width: 302px; - overflow-y: auto; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-url-input__suggestions { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-url-input__suggestions, -.block-editor-url-input .components-spinner { - display: none; -} -@media (min-width: 600px) { - .block-editor-url-input__suggestions, -.block-editor-url-input .components-spinner { - display: grid; - } -} - -.block-editor-url-input__suggestion { - min-height: 36px; - height: auto; - color: #757575; - display: block; - font-size: 13px; - cursor: pointer; - background: #fff; - width: 100%; - border: none; - text-align: left; - box-shadow: none; -} -.block-editor-url-input__suggestion:hover { - background: #ddd; -} -.block-editor-url-input__suggestion:focus, .block-editor-url-input__suggestion.is-selected { - background: var(--wp-admin-theme-color-darker-20); - color: #fff; - outline: none; -} - -.components-toolbar-group > .block-editor-url-input__button, -.components-toolbar > .block-editor-url-input__button { - position: inherit; -} - -.block-editor-url-input__button .block-editor-url-input__back { - margin-right: 4px; - overflow: visible; -} -.block-editor-url-input__button .block-editor-url-input__back::after { - content: ""; - position: absolute; - display: block; - width: 1px; - height: 24px; - right: -1px; - background: #ddd; -} - -.block-editor-url-input__button-modal { - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); - border: 1px solid #ddd; - background: #fff; -} - -.block-editor-url-input__button-modal-line { - display: flex; - flex-direction: row; - flex-grow: 1; - flex-shrink: 1; - min-width: 0; - align-items: flex-start; -} -.block-editor-url-input__button-modal-line .components-button { - flex-shrink: 0; - width: 36px; - height: 36px; -} - -.block-editor-url-popover__additional-controls { - border-top: 1px solid #ddd; -} - -.block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg { - box-shadow: none; -} - -.block-editor-url-popover__additional-controls div[role=menu] > .components-button { - padding-left: 12px; -} - -.block-editor-url-popover__row { - display: flex; -} - -.block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) { - flex-grow: 1; -} - -.block-editor-url-popover .components-button.has-icon { - padding: 3px; -} -.block-editor-url-popover .components-button.has-icon > svg { - padding: 5px; - border-radius: 2px; - height: 30px; - width: 30px; -} -.block-editor-url-popover .components-button.has-icon:not(:disabled):focus { - box-shadow: none; -} -.block-editor-url-popover .components-button.has-icon:not(:disabled):focus > svg { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 4px #fff; - outline: 2px solid transparent; -} - -.block-editor-url-popover__settings-toggle { - flex-shrink: 0; - border-radius: 0; - border-left: 1px solid #ddd; - margin-left: 1px; -} -.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon { - transform: rotate(180deg); -} - -.block-editor-url-popover__input-container .components-base-control:last-child, -.block-editor-url-popover__input-container .components-base-control:last-child .components-base-control__field { - margin-bottom: 0; -} - -.block-editor-url-popover__settings { - display: block; - padding: 16px; - border-top: 1px solid #ddd; -} - -.block-editor-url-popover__link-editor, -.block-editor-url-popover__link-viewer { - display: flex; -} -.block-editor-url-popover__link-editor .block-editor-url-input .components-base-control__field, -.block-editor-url-popover__link-viewer .block-editor-url-input .components-base-control__field { - margin-bottom: 0; -} -.block-editor-url-popover__link-editor .block-editor-url-input .components-spinner, -.block-editor-url-popover__link-viewer .block-editor-url-input .components-spinner { - bottom: 8px 8px 8px 12px1; -} - -.block-editor-url-popover__link-viewer-url { - margin: 7px; - flex-grow: 1; - flex-shrink: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - min-width: 150px; - max-width: 500px; -} -.block-editor-url-popover__link-viewer-url.has-invalid-link { - color: #cc1818; -} - -.block-editor-warning { - align-items: center; - display: flex; - flex-wrap: wrap; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 1em; - border: 1px solid #1e1e1e; - border-radius: 2px; - background-color: #fff; -} -.block-editor-warning .block-editor-warning__message { - line-height: 1.4; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - color: #1e1e1e; - margin: 0; -} -.block-editor-warning p.block-editor-warning__message.block-editor-warning__message { - min-height: auto; -} -.block-editor-warning .block-editor-warning__contents { - display: flex; - flex-direction: row; - justify-content: space-between; - flex-wrap: wrap; - align-items: baseline; - width: 100%; -} -.block-editor-warning .block-editor-warning__actions { - display: flex; - margin-top: 1em; -} -.block-editor-warning .block-editor-warning__action { - margin: 0 8px 0 0; -} - -.block-editor-warning__secondary { - margin: auto 0 auto 8px; -} - -.components-popover.block-editor-warning__dropdown { - z-index: 99998; -} - -.html-anchor-control .components-external-link { - display: block; - margin-top: 8px; -} - -.block-editor-hooks__layout-controls { - display: flex; - margin-bottom: 16px; -} -.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit { - display: flex; - margin-right: 24px; -} -.block-editor-hooks__layout-controls .block-editor-hooks__layout-controls-unit svg { - margin: auto 0 4px 8px; -} - -.block-editor-hooks__layout-controls-reset { - display: flex; - justify-content: flex-end; - margin-bottom: 24px; -} - -.block-editor-hooks__layout-controls-helptext { - font-size: 12px; -} - -.block-editor-hooks__flex-layout-justification-controls, -.block-editor-hooks__flex-layout-orientation-controls { - margin-bottom: 12px; -} -.block-editor-hooks__flex-layout-justification-controls legend, -.block-editor-hooks__flex-layout-orientation-controls legend { - margin-bottom: 8px; -} - -.border-block-support-panel .single-column { - grid-column: span 1; -} - -.dimensions-block-support-panel .single-column { - grid-column: span 1; -} - -.typography-block-support-panel .components-font-appearance-control, -.typography-block-support-panel .components-font-size-picker__controls, -.typography-block-support-panel .block-editor-text-decoration-control__buttons, -.typography-block-support-panel .block-editor-text-transform-control__buttons { - margin-bottom: 0; -} -.typography-block-support-panel .single-column { - grid-column: span 1; -} - -.color-block-support-panel { - /* Increased specificity required to remove the slot wrapper's row gap */ - /** - * The following styles replicate the separated border of the - * `ItemGroup` component but allows for hidden items. This is because - * to maintain the order of `ToolsPanel` controls, each `ToolsPanelItem` - * must at least render a placeholder which would otherwise interfere - * with the `:last-child` styles. - */ - /** - * The following few styles fix the layout and spacing for the due to the - * introduced wrapper element by the `Item` component. - */ -} -.color-block-support-panel .block-editor-contrast-checker { - /** - * Contrast checkers are forced to the bottom of the panel so all - * injected color controls can appear as a single item group without - * the contrast checkers suddenly appearing between items. - */ - order: 9999; - grid-column: span 2; - margin-top: 16px; -} -.color-block-support-panel .block-editor-contrast-checker .components-notice__content { - margin-right: 0; -} -.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper { - row-gap: 0; -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item { - padding: 0; - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-right: 1px solid rgba(0, 0, 0, 0.1); - border-bottom: 1px solid rgba(0, 0, 0, 0.1); -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first { - border-top-left-radius: 2px; - border-top-right-radius: 2px; - border-top: 1px solid rgba(0, 0, 0, 0.1); -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.last { - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; -} -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item > div, -.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item > div > button { - border-radius: inherit; -} -.color-block-support-panel .block-editor-panel-color-gradient-settings__color-indicator { - background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%); -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown { - display: block; - padding: 0; -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown > button { - height: 46px; -} -.color-block-support-panel .block-editor-tools-panel-color-dropdown > button.is-open { - background: #f0f0f0; - color: var(--wp-admin-theme-color); -} -.color-block-support-panel .color-block-support-panel__item-group > div { - grid-column: span 2; - border-radius: inherit; -} - -/** - * Block Toolbar - */ -.block-editor-block-toolbar { - display: flex; - flex-grow: 1; - width: 100%; - position: relative; - overflow-y: hidden; - overflow-x: auto; - transition: border-color 0.1s linear, box-shadow 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-block-toolbar { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .block-editor-block-toolbar { - overflow: inherit; - } -} -.block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-toolbar .components-toolbar { - background: none; - line-height: 0; - margin-top: -1px; - margin-bottom: -1px; - border: 0; - border-right: 1px solid #ddd; -} -.block-editor-block-toolbar > :last-child, -.block-editor-block-toolbar > :last-child .components-toolbar-group, -.block-editor-block-toolbar > :last-child .components-toolbar { - border-right: none; -} - -.block-editor-block-contextual-toolbar.has-parent:not(.is-fixed) { - margin-left: calc(48px + 8px); -} -.show-icon-labels .block-editor-block-contextual-toolbar.has-parent:not(.is-fixed) { - margin-left: 0; -} - -.block-editor-block-parent-selector { - position: absolute; - top: -1px; - left: calc(-48px - 8px - 1px); -} -.show-icon-labels .block-editor-block-parent-selector { - position: relative; - left: auto; - top: auto; - margin-top: -1px; - margin-left: -1px; - margin-bottom: -1px; -} - -.block-editor-block-toolbar__block-controls { - height: auto !important; - padding: 0 !important; - margin-left: -1px; -} -.block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon, -.block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - width: 24px !important; - margin: 0 !important; -} -.block-editor-block-toolbar__block-controls .block-editor-block-mover { - margin-left: -6px; -} -.block-editor-block-toolbar__block-controls .block-editor-block-lock-toolbar { - margin-left: -6px !important; -} -.block-editor-block-toolbar__block-controls .components-toolbar-group { - padding: 0; -} - -.block-editor-block-toolbar .components-toolbar-group, -.block-editor-block-toolbar .components-toolbar, -.block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group, -.block-editor-rich-text__inline-format-toolbar-group .components-toolbar { - display: flex; - flex-wrap: nowrap; -} - -.block-editor-block-toolbar__slot { - display: inline-block; - line-height: 0; -} -@supports (position: sticky) { - .block-editor-block-toolbar__slot { - display: inline-flex; - } -} - -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon { - width: auto; -} -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon svg { - display: none; -} -.show-icon-labels .block-editor-block-toolbar .components-button.has-icon::after { - content: attr(aria-label); - font-size: 12px; -} -.show-icon-labels .components-accessible-toolbar .components-toolbar-group > div:first-child:last-child > .components-button.has-icon { - padding-left: 6px; - padding-right: 6px; -} -.show-icon-labels .block-editor-block-switcher { - border-right: 1px solid #1e1e1e; -} -.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle { - margin-left: 0; -} -.show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon, -.show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon { - width: 0 !important; - height: 0 !important; -} -.show-icon-labels .block-editor-block-parent-selector__button .block-editor-block-icon { - width: 0; -} -.show-icon-labels .block-editor-block-toolbar__block-controls .block-editor-block-mover { - margin-left: 0; - white-space: nowrap; -} -.show-icon-labels .block-editor-block-mover-button { - padding-left: 8px !important; - padding-right: 8px !important; -} -.show-icon-labels .block-editor-block-mover__drag-handle.has-icon { - padding-left: 6px !important; - padding-right: 6px !important; - border-right: 1px solid #1e1e1e; -} -@media (min-width: 600px) { - .show-icon-labels .is-up-button.is-up-button.is-up-button { - border-bottom: 1px solid #1e1e1e; - margin-right: 0; - border-radius: 0; - } -} -.show-icon-labels .block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button { - width: auto; -} -.show-icon-labels .components-toolbar, -.show-icon-labels .components-toolbar-group { - flex-shrink: 1; -} -.show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button + .components-button { - margin-left: 6px; -} - -.block-editor-inserter { - display: inline-block; - background: none; - border: none; - padding: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - line-height: 0; -} -@media (min-width: 782px) { - .block-editor-inserter { - position: relative; - } -} - -.block-editor-inserter__content { - position: relative; -} - -.block-editor-inserter__popover.is-quick .components-popover__content { - border: none; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > * { - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:first-child { - border-top: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *:last-child { - border-bottom: 1px solid #ccc; -} -.block-editor-inserter__popover.is-quick .components-popover__content .block-editor-inserter__quick-inserter > *.components-button { - border: 1px solid #1e1e1e; -} - -.block-editor-inserter__popover .block-editor-inserter__menu { - margin: -12px; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__tabs .components-tab-panel__tabs { - top: 60px; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__main-area { - overflow: visible; - height: auto; -} -.block-editor-inserter__popover .block-editor-inserter__menu .block-editor-inserter__preview-container { - display: none; -} - -.block-editor-inserter__toggle.components-button { - display: inline-flex; - align-items: center; - cursor: pointer; - border: none; - outline: none; - padding: 0; - transition: color 0.2s ease; -} -@media (prefers-reduced-motion: reduce) { - .block-editor-inserter__toggle.components-button { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.block-editor-inserter__menu { - height: 100%; - position: relative; - overflow: visible; -} - -.block-editor-inserter__main-area { - width: auto; - overflow-y: auto; - height: 100%; -} -@media (min-width: 782px) { - .block-editor-inserter__main-area { - width: 350px; - } -} - -.block-editor-inserter__inline-elements { - margin-top: -1px; -} - -.block-editor-inserter__menu.is-bottom::after { - border-bottom-color: #fff; -} - -.components-popover.block-editor-inserter__popover { - z-index: 99999; -} - -.block-editor-inserter__search { - background: #fff; - padding: 16px 16px 0 16px; - position: sticky; - top: 0; - z-index: 1; -} -.block-editor-inserter__search .components-search-control__icon { - right: 20px; -} -.block-editor-inserter__search .components-base-control__field { - margin-bottom: 0; -} - -.block-editor-inserter__tabs { - display: flex; - flex-direction: column; -} -.block-editor-inserter__tabs .components-tab-panel__tabs { - position: sticky; - top: 64px; - background: #fff; - z-index: 1; - border-bottom: 1px solid #ddd; -} -.block-editor-inserter__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - flex-grow: 1; - margin-bottom: -1px; -} -.block-editor-inserter__tabs .components-tab-panel__tab-content { - display: flex; - flex-grow: 1; - flex-direction: column; - position: relative; - z-index: 0; -} - -.block-editor-inserter__panel-header { - display: inline-flex; - align-items: center; - padding: 16px 16px 0; -} - -.block-editor-inserter__panel-header-patterns { - padding: 16px 16px 0; -} - -.block-editor-inserter__panel-content { - padding: 16px; -} - -.block-editor-inserter__panel-title, -.block-editor-inserter__panel-title button { - margin: 0 12px 0 0; - color: #757575; - text-transform: uppercase; - font-size: 11px; - font-weight: 500; -} - -.block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input { - height: 36px; - line-height: 36px; -} - -.block-editor-inserter__panel-dropdown select { - border: none; -} - -.block-editor-inserter__block-list { - flex-grow: 1; - position: relative; -} - -.block-editor-inserter__reusable-blocks-panel { - position: relative; - text-align: right; -} - -.block-editor-inserter__manage-reusable-blocks { - display: inline-block; - margin: 16px; -} - -.block-editor-inserter__no-results { - padding: 32px; - text-align: center; -} - -.block-editor-inserter__no-results-icon { - fill: #949494; -} - -.block-editor-inserter__child-blocks { - padding: 0 16px; -} - -.block-editor-inserter__parent-block-header { - display: flex; - align-items: center; -} -.block-editor-inserter__parent-block-header h2 { - font-size: 13px; -} -.block-editor-inserter__parent-block-header .block-editor-block-icon { - margin-right: 8px; -} - -.block-editor-inserter__preview-container { - display: none; - width: 300px; - background: #fff; - border-radius: 2px; - border: 1px solid #ddd; - position: absolute; - top: 16px; - left: calc(100% + 16px); - max-height: calc(100% - 32px); - overflow-y: hidden; -} -@media (min-width: 782px) { - .block-editor-inserter__preview-container { - display: block; - } -} -.block-editor-inserter__preview-container .block-editor-block-card { - padding: 16px; -} -.block-editor-inserter__preview-container .block-editor-block-card__title { - font-size: 13px; -} - -.block-editor-inserter__preview-content { - min-height: 144px; - background: #f0f0f0; - display: grid; - flex-grow: 1; - align-items: center; -} - -.block-editor-inserter__preview-content-missing { - flex: 1; - display: flex; - justify-content: center; - align-items: center; - min-height: 144px; - color: #757575; - background: #f0f0f0; -} - -.block-editor-inserter__tips { - border-top: 1px solid #ddd; - padding: 16px; - flex-shrink: 0; - position: relative; -} - -.block-editor-inserter__manage-reusable-blocks-container { - padding: 16px; -} - -.block-editor-inserter__quick-inserter { - width: 100%; - max-width: 100%; -} -@media (min-width: 782px) { - .block-editor-inserter__quick-inserter { - width: 350px; - } -} - -.block-editor-inserter__quick-inserter-results .block-editor-inserter__panel-header { - height: 0; - padding: 0; - float: left; -} - -.block-editor-inserter__quick-inserter.has-search .block-editor-inserter__panel-content, -.block-editor-inserter__quick-inserter.has-expand .block-editor-inserter__panel-content { - padding: 16px; -} - -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list { - display: grid; - grid-template-columns: 1fr 1fr; - grid-gap: 8px; -} -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - margin-bottom: 0; -} -.block-editor-inserter__quick-inserter-patterns .block-editor-block-patterns-list .block-editor-block-preview__container { - min-height: 100px; -} - -.block-editor-inserter__quick-inserter-separator { - border-top: 1px solid #ddd; -} - -.block-editor-inserter__popover.is-quick > .components-popover__content > div { - padding: 0; -} - -.block-editor-inserter__quick-inserter-expand.components-button { - display: block; - background: #1e1e1e; - color: #fff; - width: 100%; - height: 44px; - border-radius: 0; -} -.block-editor-inserter__quick-inserter-expand.components-button:hover { - color: #fff; -} -.block-editor-inserter__quick-inserter-expand.components-button:active { - color: #ccc; -} -.block-editor-inserter__quick-inserter-expand.components-button.components-button:focus:not(:disabled) { - box-shadow: none; - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} - -.block-editor-block-patterns-explorer__sidebar { - position: absolute; - top: 60px; - left: 0; - bottom: 0; - width: 280px; - padding: 24px 32px 32px; - overflow-x: visible; - overflow-y: scroll; -} -.block-editor-block-patterns-explorer__sidebar__categories-list__item { - display: block; - width: 100%; - height: 48px; - text-align: left; -} -.block-editor-block-patterns-explorer__search { - margin-bottom: 32px; -} -.block-editor-block-patterns-explorer__search-results-count { - padding-bottom: 32px; -} -.block-editor-block-patterns-explorer__list { - margin-left: 248px; -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list { - display: grid; - grid-gap: 32px; - grid-template-columns: repeat(1, 1fr); -} -@media (min-width: 1080px) { - .block-editor-block-patterns-explorer .block-editor-block-patterns-list { - grid-template-columns: repeat(2, 1fr); - } -} -@media (min-width: 1440px) { - .block-editor-block-patterns-explorer .block-editor-block-patterns-list { - grid-template-columns: repeat(3, 1fr); - } -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - min-height: 240px; -} -.block-editor-block-patterns-explorer .block-editor-block-patterns-list .block-editor-block-preview__container { - height: inherit; - min-height: 100px; - max-height: 800px; -} - -.block-editor-post-preview__dropdown { - padding: 0; -} - -.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize { - padding-left: 40px; -} -.block-editor-post-preview__button-resize.block-editor-post-preview__button-resize.has-icon { - padding-left: 8px; -} - -.block-editor-post-preview__dropdown-content .components-popover__content { - overflow-y: visible; -} -.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:first-child { - padding-bottom: 8px; -} -.block-editor-post-preview__dropdown-content.edit-post-post-preview-dropdown .components-menu-group:last-child { - margin-bottom: 0; -} -.block-editor-post-preview__dropdown-content .components-menu-group + .components-menu-group { - padding: 8px; -} - -@media (min-width: 600px) { - .edit-post-header__settings .editor-post-preview, -.edit-site-header__actions .editor-post-preview { - display: none; - } -} - -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle { - transition: opacity 0.1s linear; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui .edit-post-header__settings .block-editor-post-preview__button-toggle { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-save-draft, -.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .editor-post-saved-state, -.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle { - opacity: 0; - } - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header__settings .block-editor-post-preview__button-toggle.is-opened { - opacity: 1; - } -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector{background:#fff;box-sizing:border-box}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector *{box-sizing:inherit}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector{margin:-12px}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector h3{margin-bottom:0}#customize-theme-controls .customize-pane-child.control-section-sidebar.is-sub-section-open{transform:translateX(100%)}.customize-widgets-header{display:flex;justify-content:flex-end;margin:-15px -12px 0;background:#f0f0f1;border-bottom:1px solid #e0e0e0;z-index:8}@media (min-width:782px){.customize-widgets-header{margin-bottom:44px}}.customize-widgets-header.is-fixed-toolbar-active{margin-bottom:0}.customize-widgets-header-toolbar{display:flex;border:none;width:100%;align-items:center}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon{border-radius:2px;color:#fff;padding:0;min-width:24px;height:24px;margin:12px auto 12px 0}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon:before{content:none}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon.is-pressed{background:#1e1e1e}.customize-widgets-header-toolbar .components-button.has-icon.customize-widgets-editor-history-button.redo-button{margin-right:-12px}#customize-sidebar-outer-content{width:auto;min-width:100%}#customize-outer-theme-controls .widgets-inserter{padding:0}#customize-outer-theme-controls .widgets-inserter .customize-section-description-container{display:none}.customize-widgets-layout__inserter-panel{background:#fff}.customize-widgets-layout__inserter-panel-header{display:flex;justify-content:space-between;align-items:center;padding:16px;height:46px;box-sizing:border-box;border-bottom:1px solid #ddd}.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title{margin:0}.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content{background:#fff}.customize-widgets-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.customize-widgets-keyboard-shortcut-help-modal__main-shortcuts .customize-widgets-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.customize-widgets-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.customize-widgets-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.customize-widgets-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.customize-widgets-keyboard-shortcut-help-modal__shortcut:empty{display:none}.customize-widgets-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 1rem 0 0;text-align:left}.customize-widgets-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination+.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 .2rem 0 0}.block-editor-block-contextual-toolbar.is-fixed{top:0;margin-right:-12px;margin-left:-12px;width:calc(100% + 24px);overflow-y:auto;z-index:7}.customize-control-sidebar_block_editor .block-editor-block-list__block-popover{position:fixed;z-index:7}.customize-widgets-welcome-guide__image__wrapper{background:#00a0d2;text-align:center;margin-bottom:8px}.customize-widgets-welcome-guide__image{height:auto}.wrap .customize-widgets-welcome-guide__heading{font-size:18px;font-weight:600}.customize-widgets-welcome-guide__text{line-height:1.7}.customize-widgets-welcome-guide__button{justify-content:center;margin:1em 0;width:100%}.customize-widgets-welcome-guide__separator{margin:1em 0}.customize-widgets-welcome-guide__more-info{line-height:1.4}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section{min-height:100%;background-color:#fff;padding-top:12px!important}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section.open{overflow:unset}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section .customize-section-title{position:static!important;margin-top:-12px!important;width:unset!important}.components-modal__screen-overlay{z-index:999999}.customize-control-sidebar_block_editor,.customize-widgets-layout__inspector,.customize-widgets-popover{box-sizing:border-box}.customize-control-sidebar_block_editor *,.customize-control-sidebar_block_editor :after,.customize-control-sidebar_block_editor :before,.customize-widgets-layout__inspector *,.customize-widgets-layout__inspector :after,.customize-widgets-layout__inspector :before,.customize-widgets-popover *,.customize-widgets-popover :after,.customize-widgets-popover :before{box-sizing:inherit}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector{background:#fff;box-sizing:border-box}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector *{box-sizing:inherit}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector{margin:-12px}#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector h3{margin-bottom:0}#customize-theme-controls .customize-pane-child.control-section-sidebar.is-sub-section-open{transform:translateX(-100%)}.customize-widgets-header{display:flex;justify-content:flex-end;margin:-15px -12px 0;background:#f0f0f1;border-bottom:1px solid #e0e0e0;z-index:8}@media (min-width:782px){.customize-widgets-header{margin-bottom:44px}}.customize-widgets-header.is-fixed-toolbar-active{margin-bottom:0}.customize-widgets-header-toolbar{display:flex;border:none;width:100%;align-items:center}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon{border-radius:2px;color:#fff;padding:0;min-width:24px;height:24px;margin:12px 0 12px auto}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon:before{content:none}.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon.is-pressed{background:#1e1e1e}.customize-widgets-header-toolbar .components-button.has-icon.customize-widgets-editor-history-button.redo-button{margin-left:-12px}#customize-sidebar-outer-content{width:auto;min-width:100%}#customize-outer-theme-controls .widgets-inserter{padding:0}#customize-outer-theme-controls .widgets-inserter .customize-section-description-container{display:none}.customize-widgets-layout__inserter-panel{background:#fff}.customize-widgets-layout__inserter-panel-header{display:flex;justify-content:space-between;align-items:center;padding:16px;height:46px;box-sizing:border-box;border-bottom:1px solid #ddd}.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title{margin:0}.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content{background:#fff}.customize-widgets-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.customize-widgets-keyboard-shortcut-help-modal__main-shortcuts .customize-widgets-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.customize-widgets-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.customize-widgets-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.customize-widgets-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.customize-widgets-keyboard-shortcut-help-modal__shortcut:empty{display:none}.customize-widgets-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 0 0 1rem;text-align:right}.customize-widgets-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination+.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 0 0 .2rem}.block-editor-block-contextual-toolbar.is-fixed{top:0;margin-left:-12px;margin-right:-12px;width:calc(100% + 24px);overflow-y:auto;z-index:7}.customize-control-sidebar_block_editor .block-editor-block-list__block-popover{position:fixed;z-index:7}.customize-widgets-welcome-guide__image__wrapper{background:#00a0d2;text-align:center;margin-bottom:8px}.customize-widgets-welcome-guide__image{height:auto}.wrap .customize-widgets-welcome-guide__heading{font-size:18px;font-weight:600}.customize-widgets-welcome-guide__text{line-height:1.7}.customize-widgets-welcome-guide__button{justify-content:center;margin:1em 0;width:100%}.customize-widgets-welcome-guide__separator{margin:1em 0}.customize-widgets-welcome-guide__more-info{line-height:1.4}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section{min-height:100%;background-color:#fff;padding-top:12px!important}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section.open{overflow:unset}#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section .customize-section-title{position:static!important;margin-top:-12px!important;width:unset!important}.components-modal__screen-overlay{z-index:999999}.customize-control-sidebar_block_editor,.customize-widgets-layout__inspector,.customize-widgets-popover{box-sizing:border-box}.customize-control-sidebar_block_editor *,.customize-control-sidebar_block_editor :after,.customize-control-sidebar_block_editor :before,.customize-widgets-layout__inspector *,.customize-widgets-layout__inspector :after,.customize-widgets-layout__inspector :before,.customize-widgets-popover *,.customize-widgets-popover :after,.customize-widgets-popover :before{box-sizing:inherit}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector { - background: #fff; - box-sizing: border-box; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector * { - box-sizing: inherit; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector { - margin: -12px; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector h3 { - margin-bottom: 0; -} - -#customize-theme-controls .customize-pane-child.control-section-sidebar.is-sub-section-open { - transform: translateX(100%); -} - -.customize-widgets-header { - display: flex; - justify-content: flex-end; - margin: -15px -12px 0 -12px; - background: #f0f0f1; - border-bottom: 1px solid #e0e0e0; - z-index: 8; -} -@media (min-width: 782px) { - .customize-widgets-header { - margin-bottom: 44px; - } -} -.customize-widgets-header.is-fixed-toolbar-active { - margin-bottom: 0; -} - -.customize-widgets-header-toolbar { - display: flex; - border: none; - width: 100%; - align-items: center; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon { - border-radius: 2px; - color: #fff; - padding: 0; - min-width: 24px; - height: 24px; - margin: 12px auto 12px 0; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon::before { - content: none; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon.is-pressed { - background: #1e1e1e; -} -.customize-widgets-header-toolbar .components-button.has-icon.customize-widgets-editor-history-button.redo-button { - margin-right: -12px; -} - -#customize-sidebar-outer-content { - width: auto; - min-width: 100%; -} - -#customize-outer-theme-controls .widgets-inserter { - padding: 0; -} -#customize-outer-theme-controls .widgets-inserter .customize-section-description-container { - display: none; -} - -.customize-widgets-layout__inserter-panel { - background: #fff; -} - -.customize-widgets-layout__inserter-panel-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 16px; - height: 46px; - box-sizing: border-box; - border-bottom: 1px solid #ddd; -} -.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title { - margin: 0; -} - -.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content { - background: #fff; -} - -.customize-widgets-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.customize-widgets-keyboard-shortcut-help-modal__main-shortcuts .customize-widgets-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.customize-widgets-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 1rem 0 0; - text-align: left; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination + .customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0.2rem 0 0; -} - -.block-editor-block-contextual-toolbar.is-fixed { - top: 0; - margin-right: -12px; - margin-left: -12px; - width: calc(100% + 24px); - overflow-y: auto; - z-index: 7; -} - -.customize-control-sidebar_block_editor .block-editor-block-list__block-popover { - position: fixed; - z-index: 7; -} - -.customize-widgets-welcome-guide__image__wrapper { - background: #00a0d2; - text-align: center; - margin-bottom: 8px; -} -.customize-widgets-welcome-guide__image { - height: auto; -} -.wrap .customize-widgets-welcome-guide__heading { - font-size: 18px; - font-weight: 600; -} -.customize-widgets-welcome-guide__text { - line-height: 1.7; -} -.customize-widgets-welcome-guide__button { - justify-content: center; - margin: 1em 0; - width: 100%; -} -.customize-widgets-welcome-guide__separator { - margin: 1em 0; -} -.customize-widgets-welcome-guide__more-info { - line-height: 1.4; -} - -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section { - min-height: 100%; - background-color: #fff; - padding-top: 12px !important; -} -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section.open { - overflow: unset; -} -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section .customize-section-title { - position: static !important; - margin-top: -12px !important; - width: unset !important; -} - -.components-modal__screen-overlay { - z-index: 999999; -} - -.customize-control-sidebar_block_editor, -.customize-widgets-layout__inspector, -.customize-widgets-popover { - box-sizing: border-box; -} -.customize-control-sidebar_block_editor *, -.customize-control-sidebar_block_editor *::before, -.customize-control-sidebar_block_editor *::after, -.customize-widgets-layout__inspector *, -.customize-widgets-layout__inspector *::before, -.customize-widgets-layout__inspector *::after, -.customize-widgets-popover *, -.customize-widgets-popover *::before, -.customize-widgets-popover *::after { - box-sizing: inherit; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector { - background: #fff; - box-sizing: border-box; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector * { - box-sizing: inherit; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector { - margin: -12px; -} -#customize-theme-controls .customize-pane-child.accordion-section-content.customize-widgets-layout__inspector .block-editor-block-inspector h3 { - margin-bottom: 0; -} - -#customize-theme-controls .customize-pane-child.control-section-sidebar.is-sub-section-open { - transform: translateX(-100%); -} - -.customize-widgets-header { - display: flex; - justify-content: flex-end; - margin: -15px -12px 0 -12px; - background: #f0f0f1; - border-bottom: 1px solid #e0e0e0; - z-index: 8; -} -@media (min-width: 782px) { - .customize-widgets-header { - margin-bottom: 44px; - } -} -.customize-widgets-header.is-fixed-toolbar-active { - margin-bottom: 0; -} - -.customize-widgets-header-toolbar { - display: flex; - border: none; - width: 100%; - align-items: center; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon { - border-radius: 2px; - color: #fff; - padding: 0; - min-width: 24px; - height: 24px; - margin: 12px 0 12px auto; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon::before { - content: none; -} -.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon.is-pressed { - background: #1e1e1e; -} -.customize-widgets-header-toolbar .components-button.has-icon.customize-widgets-editor-history-button.redo-button { - margin-left: -12px; -} - -#customize-sidebar-outer-content { - width: auto; - min-width: 100%; -} - -#customize-outer-theme-controls .widgets-inserter { - padding: 0; -} -#customize-outer-theme-controls .widgets-inserter .customize-section-description-container { - display: none; -} - -.customize-widgets-layout__inserter-panel { - background: #fff; -} - -.customize-widgets-layout__inserter-panel-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 16px; - height: 46px; - box-sizing: border-box; - border-bottom: 1px solid #ddd; -} -.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title { - margin: 0; -} - -.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content { - background: #fff; -} - -.customize-widgets-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.customize-widgets-keyboard-shortcut-help-modal__main-shortcuts .customize-widgets-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.customize-widgets-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 0 0 1rem; - text-align: right; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination + .customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0 0 0.2rem; -} - -.block-editor-block-contextual-toolbar.is-fixed { - top: 0; - margin-left: -12px; - margin-right: -12px; - width: calc(100% + 24px); - overflow-y: auto; - z-index: 7; -} - -.customize-control-sidebar_block_editor .block-editor-block-list__block-popover { - position: fixed; - z-index: 7; -} - -.customize-widgets-welcome-guide__image__wrapper { - background: #00a0d2; - text-align: center; - margin-bottom: 8px; -} -.customize-widgets-welcome-guide__image { - height: auto; -} -.wrap .customize-widgets-welcome-guide__heading { - font-size: 18px; - font-weight: 600; -} -.customize-widgets-welcome-guide__text { - line-height: 1.7; -} -.customize-widgets-welcome-guide__button { - justify-content: center; - margin: 1em 0; - width: 100%; -} -.customize-widgets-welcome-guide__separator { - margin: 1em 0; -} -.customize-widgets-welcome-guide__more-info { - line-height: 1.4; -} - -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section { - min-height: 100%; - background-color: #fff; - padding-top: 12px !important; -} -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section.open { - overflow: unset; -} -#customize-theme-controls .customize-pane-child.customize-widgets__sidebar-section .customize-section-title { - position: static !important; - margin-top: -12px !important; - width: unset !important; -} - -.components-modal__screen-overlay { - z-index: 999999; -} - -.customize-control-sidebar_block_editor, -.customize-widgets-layout__inspector, -.customize-widgets-popover { - box-sizing: border-box; -} -.customize-control-sidebar_block_editor *, -.customize-control-sidebar_block_editor *::before, -.customize-control-sidebar_block_editor *::after, -.customize-widgets-layout__inspector *, -.customize-widgets-layout__inspector *::before, -.customize-widgets-layout__inspector *::after, -.customize-widgets-popover *, -.customize-widgets-popover *::before, -.customize-widgets-popover *::after { - box-sizing: inherit; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-left:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-left:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-right:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-right:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;left:10px;bottom:10px;right:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-right:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;left:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{right:0}@media (min-width:783px){.interface-interface-skeleton{right:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{right:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{right:160px}}.folded .interface-interface-skeleton{right:0}@media (min-width:783px){.folded .interface-interface-skeleton{right:36px}}body.is-fullscreen-mode .interface-interface-skeleton{right:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;left:0;bottom:0;right:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-right:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-left:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;right:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;right:auto;left:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-right:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-right:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-right:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;right:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-right:24px;margin-right:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 10px .6rem 0}.interface-preferences-modal__option .components-base-control__help{margin:-8px 58px 8px 0;font-size:12px;font-style:normal;color:#757575}.edit-post-header{height:60px;background:#fff;display:flex;flex-wrap:wrap;align-items:center;max-width:100vw}@media (min-width:280px){.edit-post-header{flex-wrap:nowrap}}.edit-post-header>.edit-post-header__settings{order:1}@supports (position:sticky){.edit-post-header>.edit-post-header__settings{order:0}}.edit-post-header__toolbar{display:flex;flex-grow:1}.edit-post-header__toolbar .table-of-contents{display:none}@media (min-width:600px){.edit-post-header__toolbar .table-of-contents{display:block}}.edit-post-header__settings{display:inline-flex;align-items:center;flex-wrap:wrap;padding-left:4px}@media (min-width:600px){.edit-post-header__settings{padding-left:16px}}.edit-post-header__settings .components-button.components-button,.edit-post-header__settings .editor-post-saved-state{margin-left:4px}@media (min-width:600px){.edit-post-header__settings .components-button.components-button,.edit-post-header__settings .editor-post-saved-state{margin-left:12px}}.edit-post-header__settings .components-button.is-tertiary,.edit-post-header__settings .editor-post-saved-state{padding:0 6px}.edit-post-header__settings .interface-more-menu-dropdown .components-button,.edit-post-header__settings .interface-pinned-items .components-button{margin-left:0}.edit-post-header-preview__grouping-external{display:flex;position:relative;padding-bottom:0}.edit-post-header-preview__button-external{padding-right:8px;margin-left:auto;width:100%;display:flex;justify-content:flex-start}.edit-post-header-preview__button-external svg{margin-right:auto}.edit-post-post-preview-dropdown .components-popover__content>div{padding-bottom:0}.edit-post-header__dropdown .components-button.has-icon,.show-icon-labels .edit-post-header .components-button.has-icon,.show-icon-labels.interface-pinned-items .components-button.has-icon{width:auto}.edit-post-header__dropdown .components-button.has-icon svg,.show-icon-labels .edit-post-header .components-button.has-icon svg,.show-icon-labels.interface-pinned-items .components-button.has-icon svg{display:none}.edit-post-header__dropdown .components-button.has-icon:after,.show-icon-labels .edit-post-header .components-button.has-icon:after,.show-icon-labels.interface-pinned-items .components-button.has-icon:after{content:attr(aria-label)}.edit-post-header__dropdown .components-button.has-icon[aria-disabled=true],.show-icon-labels .edit-post-header .components-button.has-icon[aria-disabled=true],.show-icon-labels.interface-pinned-items .components-button.has-icon[aria-disabled=true]{background-color:transparent}.edit-post-header__dropdown .is-tertiary:active,.show-icon-labels .edit-post-header .is-tertiary:active,.show-icon-labels.interface-pinned-items .is-tertiary:active{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color);background-color:transparent}.edit-post-header__dropdown .components-button.has-icon.button-toggle svg,.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon svg,.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle svg,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon svg,.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle svg,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon svg{display:block}.edit-post-header__dropdown .components-button.has-icon.button-toggle:after,.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon:after,.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle:after,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon:after,.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle:after,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon:after{content:none}.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon{width:60px}.edit-post-header__dropdown .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon,.show-icon-labels .edit-post-header .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon,.show-icon-labels.interface-pinned-items .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon{display:block}.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.edit-post-header__dropdown .interface-pinned-items .components-button,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels .edit-post-header .interface-pinned-items .components-button,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button{padding-right:8px;padding-left:8px}@media (min-width:600px){.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.edit-post-header__dropdown .interface-pinned-items .components-button,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels .edit-post-header .interface-pinned-items .components-button,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button{padding-right:12px;padding-left:12px}}.edit-post-header__dropdown .components-dropdown-menu__toggle,.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle{margin-right:8px;padding-right:8px;padding-left:8px}@media (min-width:600px){.edit-post-header__dropdown .components-dropdown-menu__toggle,.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle{margin-right:12px;padding-right:12px;padding-left:12px}}.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft:after{content:none}@media (min-width:600px){.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft:after{content:attr(aria-label)}}.edit-post-header__dropdown .components-button.block-editor-list-view,.edit-post-header__dropdown .components-button.editor-history__redo,.edit-post-header__dropdown .components-button.editor-history__undo,.edit-post-header__dropdown .components-menu-item__button.components-menu-item__button,.edit-post-header__dropdown .table-of-contents .components-button{margin:0;padding:6px 40px 6px 6px;width:14.625rem;text-align:right;justify-content:flex-start}.show-icon-labels.interface-pinned-items{padding:6px 12px 12px;margin:0 -12px;border-bottom:1px solid #ccc;display:block}.show-icon-labels.interface-pinned-items>.components-button.has-icon{margin:0;padding:6px 8px 6px 6px;width:14.625rem;justify-content:flex-start}.show-icon-labels.interface-pinned-items>.components-button.has-icon[aria-expanded=true] svg{display:block;max-width:24px}.show-icon-labels.interface-pinned-items>.components-button.has-icon[aria-expanded=false]{padding-right:40px}.show-icon-labels.interface-pinned-items>.components-button.has-icon svg{margin-left:8px}.edit-post-fullscreen-mode-close.components-button{display:none}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button{display:flex;align-items:center;align-self:stretch;border:none;background:#1e1e1e;color:#fff;border-radius:0;height:61px;width:60px;position:relative;margin-bottom:-1px}.edit-post-fullscreen-mode-close.components-button:active{color:#fff}.edit-post-fullscreen-mode-close.components-button:focus{box-shadow:none}.edit-post-fullscreen-mode-close.components-button:before{transition:box-shadow .1s ease;content:"";display:block;position:absolute;top:9px;left:9px;bottom:9px;right:9px;border-radius:4px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}}@media (min-width:782px) and (prefers-reduced-motion:reduce){.edit-post-fullscreen-mode-close.components-button:before{transition-duration:0s;transition-delay:0s}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button:hover:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #757575}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button.has-icon:hover:before{box-shadow:none}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) hsla(0,0%,100%,.1),inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}}.edit-post-fullscreen-mode-close.components-button .edit-post-fullscreen-mode-close_site-icon{width:36px;height:36px;border-radius:2px;-o-object-fit:cover;object-fit:cover;margin-top:-1px}.edit-post-header-toolbar{display:inline-flex;flex-grow:1;align-items:center;border:none}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button{display:none}@media (min-width:600px){.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button{display:inline-flex}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle{display:inline-flex}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(-45deg)}.edit-post-header-toolbar .block-editor-list-view{display:none}@media (min-width:600px){.edit-post-header-toolbar .block-editor-list-view{display:flex}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon{height:36px;min-width:36px;padding:6px}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon.is-pressed,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon.is-pressed{background:#1e1e1e}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon:focus:not(:disabled),.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 1px #fff;outline:1px solid transparent}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon:before,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon:before{display:none}@media (min-width:600px){.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{transition:opacity .1s linear}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{opacity:0}}.edit-post-header-toolbar__left{display:inline-flex;align-items:center;padding-right:8px}@media (min-width:600px){.edit-post-header-toolbar__left{padding-right:24px}}@media (min-width:1280px){.edit-post-header-toolbar__left{padding-left:8px}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-icon{margin-left:8px;min-width:32px;width:32px;height:32px;padding:0}.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-icon{height:36px}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-text.has-icon{width:auto;padding:0 8px}.show-icon-labels .edit-post-header-toolbar__left>*+*{margin-right:8px}.edit-post-template-top-area{display:flex;flex-direction:column;align-content:space-between;width:100%;align-items:center}.edit-post-template-top-area .edit-post-template-post-title,.edit-post-template-top-area .edit-post-template-title{padding:0;text-decoration:none;height:auto}.edit-post-template-top-area .edit-post-template-post-title:before,.edit-post-template-top-area .edit-post-template-title:before{height:100%}.edit-post-template-top-area .edit-post-template-post-title.has-icon svg,.edit-post-template-top-area .edit-post-template-title.has-icon svg{order:1;margin-left:0}.edit-post-template-top-area .edit-post-template-title{color:#1e1e1e}.edit-post-template-top-area .edit-post-template-post-title{margin-top:4px;max-width:160px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.edit-post-template-top-area .edit-post-template-post-title:before{right:0;left:0}@media (min-width:1080px){.edit-post-template-top-area .edit-post-template-post-title{max-width:400px}}.edit-post-template-top-area__popover .components-popover__content{min-width:280px;padding:8px}.edit-post-template-top-area__popover .edit-post-template-details__description{color:#757575}.edit-post-template-top-area__second-menu-group{margin-right:-16px;margin-left:-16px;padding:16px 16px 0;border-top:1px solid #ddd}.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button{display:flex;justify-content:center}.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item{margin-left:0;min-width:0}.edit-post-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-post-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-post-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-post-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-post-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-post-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 1rem 0 0;text-align:left}.edit-post-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-post-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-post-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 .2rem 0 0}.edit-post-layout__metaboxes{flex-shrink:0;clear:both}.edit-post-layout .components-editor-notices__snackbar{position:fixed;left:0;bottom:40px;padding-right:16px;padding-left:16px;right:0}@media (min-width:783px){.edit-post-layout .components-editor-notices__snackbar{right:160px}}@media (min-width:783px){.auto-fold .edit-post-layout .components-editor-notices__snackbar{right:36px}}@media (min-width:961px){.auto-fold .edit-post-layout .components-editor-notices__snackbar{right:160px}}.folded .edit-post-layout .components-editor-notices__snackbar{right:0}@media (min-width:783px){.folded .edit-post-layout .components-editor-notices__snackbar{right:36px}}body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar{right:0!important}.edit-post-layout .editor-post-publish-panel{position:fixed;z-index:100001;top:46px;bottom:0;left:0;right:0;overflow:auto}@media (min-width:782px){.edit-post-layout .editor-post-publish-panel{z-index:99998;top:32px;right:auto;width:281px;border-right:1px solid #ddd;transform:translateX(-100%);animation:edit-post-post-publish-panel__slide-in-animation .1s forwards}}@media (min-width:782px) and (prefers-reduced-motion:reduce){.edit-post-layout .editor-post-publish-panel{animation-duration:1ms;animation-delay:0s}}@media (min-width:782px){body.is-fullscreen-mode .edit-post-layout .editor-post-publish-panel{top:0}}@media (min-width:782px){[role=region]:focus .edit-post-layout .editor-post-publish-panel{transform:translateX(0)}}@keyframes edit-post-post-publish-panel__slide-in-animation{to{transform:translateX(0)}}.edit-post-layout .editor-post-publish-panel__header-publish-button{justify-content:center}.edit-post-layout__toggle-entities-saved-states-panel,.edit-post-layout__toggle-publish-panel,.edit-post-layout__toggle-sidebar-panel{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;right:auto;left:0;width:280px;background-color:#fff;border:1px dotted #ddd;height:auto!important;padding:24px;display:flex;justify-content:center}.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-entities-saved-states-panel,.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-publish-panel,.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-sidebar-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-entities-saved-states-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-publish-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-sidebar-panel{top:auto;bottom:0}.edit-post-block-manager__no-results{font-style:italic;padding:24px 0;text-align:center}.edit-post-block-manager__search{margin:16px 0}.edit-post-block-manager__disabled-blocks-count{border:1px solid #ddd;border-width:1px 0;box-shadow:32px 0 0 0 #fff,-32px 0 0 0 #fff;padding:8px;background-color:#fff;text-align:center;font-style:italic;position:sticky;top:-1px;z-index:2}.edit-post-block-manager__disabled-blocks-count~.edit-post-block-manager__results .edit-post-block-manager__category-title{top:35px}.edit-post-block-manager__category{margin:0 0 24px}.edit-post-block-manager__category-title{position:sticky;top:0;padding:16px 0;background-color:#fff;z-index:1}.edit-post-block-manager__category-title .components-checkbox-control__label{font-weight:600}.edit-post-block-manager__show-all{margin-left:8px}.edit-post-block-manager__checklist{margin-top:0}.edit-post-block-manager__category-title,.edit-post-block-manager__checklist-item{border-bottom:1px solid #ddd}.edit-post-block-manager__category-title .components-base-control__field,.edit-post-block-manager__checklist-item .components-base-control__field{align-items:center;display:flex;margin:0}.edit-post-block-manager__checklist-item{margin-bottom:0;padding-right:16px}.components-modal__content .edit-post-block-manager__checklist-item.components-checkbox-control__input-container{margin:0 8px}.edit-post-block-manager__checklist-item .components-checkbox-control__label{display:flex;align-items:center;justify-content:space-between;flex-grow:1;padding:8px 0}.edit-post-block-manager__checklist-item .block-editor-block-icon{margin-left:10px;fill:#1e1e1e}.edit-post-block-manager__results{border-top:1px solid #ddd}.edit-post-block-manager__disabled-blocks-count+.edit-post-block-manager__results{border-top-width:0}.edit-post-meta-boxes-area{position:relative}.edit-post-meta-boxes-area .inside,.edit-post-meta-boxes-area__container{box-sizing:content-box}.edit-post-meta-boxes-area input,.edit-post-meta-boxes-area textarea{box-sizing:border-box}.edit-post-meta-boxes-area .postbox-header{border-top:1px solid #ddd;border-bottom:0}.edit-post-meta-boxes-area #poststuff{margin:0 auto;padding-top:0;min-width:auto}.edit-post-meta-boxes-area #poststuff .stuffbox>h3,.edit-post-meta-boxes-area #poststuff h2.hndle,.edit-post-meta-boxes-area #poststuff h3.hndle{box-sizing:border-box;color:inherit;font-weight:600;outline:none;padding:0 24px;position:relative;width:100%}.edit-post-meta-boxes-area .postbox{border:0;color:inherit;margin-bottom:0}.edit-post-meta-boxes-area .postbox>.inside{color:inherit;padding:0 24px 24px;margin:0}.edit-post-meta-boxes-area .postbox .handlediv{height:44px;width:44px}.edit-post-meta-boxes-area.is-loading:before{position:absolute;top:0;right:0;left:0;bottom:0;content:"";background:transparent;z-index:1}.edit-post-meta-boxes-area .components-spinner{position:absolute;top:10px;left:20px;z-index:5}.edit-post-meta-boxes-area .is-hidden{display:none}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]{border:1px solid #757575}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:checked{background:#fff;border-color:#757575}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:before{margin:-3px -4px}.edit-post-meta-boxes-area__clear{clear:both}.edit-post-editor__inserter-panel,.edit-post-editor__list-view-panel{height:100%;display:flex;flex-direction:column}.edit-post-editor__list-view-panel{min-width:350px}.edit-post-editor__inserter-panel-header{padding-top:8px;padding-left:8px;display:flex;justify-content:flex-end}.edit-post-editor__inserter-panel-content,.edit-post-editor__list-view-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-post-editor__inserter-panel-content{height:100%}}.edit-post-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-right:16px;padding-left:4px}.edit-post-editor__list-view-panel-content{overflow-y:auto;padding:8px 6px}.components-panel__header.edit-post-sidebar__panel-tabs{justify-content:flex-start;padding-right:0;padding-left:16px;border-top:0;margin-top:0}.components-panel__header.edit-post-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-post-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon{display:none;margin:0 auto 0 0;padding:0;min-width:24px;height:24px}@media (min-width:782px){.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-panel__body.is-opened.edit-post-last-revision__panel{padding:0;height:48px}.editor-post-last-revision__title.components-button{padding:16px}.editor-post-author__select{margin:-5px 0;width:100%}@supports (position:sticky){.editor-post-author__select{width:auto}}.edit-post-post-link__link-post-name{font-weight:600}.edit-post-post-link__preview-label{font-weight:400;margin:0}.edit-post-post-link__link{text-align:right;word-wrap:break-word;display:block}.edit-post-post-link__preview-link-container{direction:ltr}.edit-post-post-schedule{width:100%;position:relative;justify-content:left}.edit-post-post-schedule span{display:block;width:45%}.components-button.edit-post-post-schedule__toggle{text-align:left}.edit-post-post-schedule__dialog .components-popover__content>div{padding:0}.editor-post-slug__input{margin:-5px 0;padding:2px}.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft{margin-top:15px;width:100%;text-align:center}.edit-post-post-visibility{width:100%;justify-content:left}.edit-post-post-visibility span{display:block;width:45%}@media (min-width:782px){.edit-post-post-visibility__dialog .components-popover__content{width:257px}}.edit-post-post-visibility__dialog-legend{font-weight:600}.edit-post-post-visibility__choice{margin:10px 0}.edit-post-post-visibility__dialog-label,.edit-post-post-visibility__dialog-radio{vertical-align:top}.edit-post-post-visibility__dialog-password-input{width:calc(100% - 20px);margin-right:20px}.edit-post-post-visibility__dialog-info{color:#757575;padding-right:20px;font-style:italic;margin:4px 0 0;line-height:1.4}.components-button.edit-post-sidebar__panel-tab{border-radius:0;height:48px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-right:0;font-weight:500}.components-button.edit-post-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-post-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-post-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;left:0;right:0;border-bottom:4px solid transparent}.components-button.edit-post-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-post-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}@media (min-width:782px){.edit-post-template__modal .components-base-control{width:320px}}.edit-post-template__modal .components-modal__header{border-bottom:none}.edit-post-template__modal .components-modal__content:before{margin-bottom:4px}.edit-post-template__modal-actions{margin-top:12px}.edit-post-template-modal__tip{padding:16px 24px;background:#f0f0f0;border-radius:2px}@media (min-width:782px){.edit-post-template-modal__tip{width:240px}}.edit-post-template__notice{margin:0 0 8px}.edit-post-template__notice .components-notice__content{margin:0}.edit-post-template__actions button:not(:last-child){margin-left:8px}h2.edit-post-template-summary__title{line-height:24px;margin:0 0 4px;font-weight:500}.edit-post-text-editor{position:relative;width:100%;background-color:#fff;flex-grow:1}.edit-post-text-editor .editor-post-title{max-width:none;line-height:1.4;font-family:Menlo,Consolas,monaco,monospace;font-size:2.5em;font-weight:400;border:1px solid #949494;padding:16px}@media (min-width:600px){.edit-post-text-editor .editor-post-title{padding:24px}}.edit-post-text-editor .editor-post-title:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.edit-post-text-editor__body{width:100%;padding:0 12px 12px;max-width:1080px;margin-right:auto;margin-left:auto}@media (min-width:960px){.edit-post-text-editor__body{padding:0 24px 24px}}.edit-post-text-editor__toolbar{position:sticky;z-index:1;top:0;right:0;left:0;display:flex;background:hsla(0,0%,100%,.8);padding:4px 12px}@media (min-width:600px){.edit-post-text-editor__toolbar{padding:12px}}@media (min-width:960px){.edit-post-text-editor__toolbar{padding:12px 24px}}.edit-post-text-editor__toolbar h2{line-height:36px;margin:0 0 0 auto;font-size:13px;color:#1e1e1e}.edit-post-text-editor__toolbar .components-button svg{order:1}.edit-post-visual-editor{position:relative;display:flex;flex-flow:column;background-color:#2f2f2f;flex:1 0 auto}.edit-post-visual-editor .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;padding:6px 12px}.edit-post-visual-editor .components-button.has-icon,.edit-post-visual-editor .components-button.is-tertiary{padding:6px}.edit-post-visual-editor__post-title-wrapper{margin-top:4rem;margin-bottom:var(--wp--style--block-gap)}.edit-post-visual-editor__post-title-wrapper .editor-post-title{margin-right:auto;margin-left:auto}.edit-post-visual-editor__exit-template-mode{position:absolute;top:8px;right:8px;color:#fff}.edit-post-visual-editor__exit-template-mode:active:not([aria-disabled=true]),.edit-post-visual-editor__exit-template-mode:focus:not([aria-disabled=true]),.edit-post-visual-editor__exit-template-mode:hover{color:#f0f0f0}.edit-post-visual-editor__content-area{width:100%;height:100%;position:relative;box-sizing:border-box;display:flex;flex-grow:1}.edit-post-welcome-guide,.edit-template-welcome-guide{width:312px}.edit-post-welcome-guide__image,.edit-template-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-post-welcome-guide__image>img,.edit-template-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-post-welcome-guide__heading,.edit-template-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-post-welcome-guide__text,.edit-template-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 24px;padding:0 32px}.edit-post-welcome-guide__inserter-icon,.edit-template-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-template-welcome-guide .components-button svg{fill:#fff}@media (min-width:600px){.edit-post-start-page-options__modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.edit-post-start-page-options__modal{width:750px}}@media (min-width:960px){.edit-post-start-page-options__modal{height:70%}}.edit-post-start-page-options__modal .components-modal__header{border-bottom:none}.edit-post-start-page-options__modal .components-modal__content:before{content:none}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list{column-count:2;column-gap:24px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{break-inside:avoid-column;margin-bottom:24px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{min-height:100px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content{width:100%}@keyframes edit-post__fade-in-animation{0%{opacity:0}to{opacity:1}}body.block-editor-page,html.wp-toolbar{background:#fff}body.block-editor-page #wpcontent{padding-right:0}body.block-editor-page #wpbody-content{padding-bottom:0}body.block-editor-page #wpbody-content>div:not(.block-editor):not(#screen-meta),body.block-editor-page #wpfooter{display:none}body.block-editor-page .a11y-speak-region{right:-1px;top:-1px}body.block-editor-page ul#adminmenu>li.current>a.current:after,body.block-editor-page ul#adminmenu a.wp-has-current-submenu:after{border-left-color:#fff}body.block-editor-page .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.block-editor-page #wpwrap{overflow-y:auto}@media (min-width:782px){.block-editor-page #wpwrap{overflow-y:initial}}.components-modal__frame,.components-popover,.edit-post-editor__inserter-panel,.edit-post-header,.edit-post-sidebar,.edit-post-text-editor,.editor-post-publish-panel{box-sizing:border-box}.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before,.components-popover *,.components-popover :after,.components-popover :before,.edit-post-editor__inserter-panel *,.edit-post-editor__inserter-panel :after,.edit-post-editor__inserter-panel :before,.edit-post-header *,.edit-post-header :after,.edit-post-header :before,.edit-post-sidebar *,.edit-post-sidebar :after,.edit-post-sidebar :before,.edit-post-text-editor *,.edit-post-text-editor :after,.edit-post-text-editor :before,.editor-post-publish-panel *,.editor-post-publish-panel :after,.editor-post-publish-panel :before{box-sizing:inherit}@media (min-width:600px){.block-editor__container{position:absolute;top:0;left:0;bottom:0;right:0;min-height:calc(100vh - 46px)}}@media (min-width:782px){.block-editor__container{min-height:calc(100vh - 32px)}body.is-fullscreen-mode .block-editor__container{min-height:100vh}}.block-editor__container img{max-width:100%;height:auto}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.components-panel__header.interface-complementary-area-header__small{background:#fff;padding-right:4px}.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}@media (min-width:782px){.components-panel__header.interface-complementary-area-header__small{display:none}}.interface-complementary-area-header{background:#fff;padding-right:4px}.interface-complementary-area-header .components-button.has-icon{display:none;margin-left:auto}.interface-complementary-area-header .components-button.has-icon~.components-button{margin-left:0}@media (min-width:782px){.interface-complementary-area-header .components-button.has-icon{display:flex}}@media (min-width:782px){.components-panel__header+.interface-complementary-area-header{margin-top:0}}.interface-complementary-area{background:#fff;color:#1e1e1e}@media (min-width:600px){.interface-complementary-area{-webkit-overflow-scrolling:touch}}@media (min-width:782px){.interface-complementary-area{width:280px}}.interface-complementary-area .components-panel{border:none;position:relative;z-index:0}.interface-complementary-area .components-panel__header{position:sticky;top:0;z-index:1}.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:48px}@media (min-width:782px){.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs{top:0}}.interface-complementary-area p{margin-top:0}.interface-complementary-area h2{font-size:13px;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area h3{font-size:11px;text-transform:uppercase;font-weight:500;color:#1e1e1e;margin-bottom:1.5em}.interface-complementary-area hr{border-top:none;border-bottom:1px solid #f0f0f0;margin:1.5em 0}.interface-complementary-area div.components-toolbar,.interface-complementary-area div.components-toolbar-group{box-shadow:none;margin-bottom:1.5em}.interface-complementary-area div.components-toolbar-group:last-child,.interface-complementary-area div.components-toolbar:last-child{margin-bottom:0}.interface-complementary-area .block-editor-skip-to-selected-block:focus{top:auto;right:10px;bottom:10px;left:auto}@media (min-width:782px){body.js.is-fullscreen-mode{margin-top:-32px;height:calc(100% + 32px)}body.js.is-fullscreen-mode #adminmenumain,body.js.is-fullscreen-mode #wpadminbar{display:none}body.js.is-fullscreen-mode #wpcontent,body.js.is-fullscreen-mode #wpfooter{margin-left:0}}html.interface-interface-skeleton__html-container{position:fixed;width:100%}@media (min-width:782px){html.interface-interface-skeleton__html-container{position:static;width:auto}}.interface-interface-skeleton{display:flex;flex-direction:row;height:auto;max-height:100%;position:fixed;top:46px;right:0;bottom:0}@media (min-width:783px){.interface-interface-skeleton{top:32px}.is-fullscreen-mode .interface-interface-skeleton{top:0}}.interface-interface-skeleton__editor{display:flex;flex-direction:column;flex:0 1 100%;overflow:hidden}.interface-interface-skeleton{left:0}@media (min-width:783px){.interface-interface-skeleton{left:160px}}@media (min-width:783px){.auto-fold .interface-interface-skeleton{left:36px}}@media (min-width:961px){.auto-fold .interface-interface-skeleton{left:160px}}.folded .interface-interface-skeleton{left:0}@media (min-width:783px){.folded .interface-interface-skeleton{left:36px}}body.is-fullscreen-mode .interface-interface-skeleton{left:0!important}.interface-interface-skeleton__body{flex-grow:1;display:flex;overflow:auto;overscroll-behavior-y:none}@media (min-width:782px){.has-footer .interface-interface-skeleton__body{padding-bottom:25px}}.interface-interface-skeleton__content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;z-index:20}.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{display:block;flex-shrink:0;position:absolute;z-index:100000;top:0;right:0;bottom:0;left:0;background:#fff;color:#1e1e1e}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar,.interface-interface-skeleton__sidebar{position:relative!important;z-index:90;width:auto}}.interface-interface-skeleton__sidebar{overflow:auto}@media (min-width:782px){.interface-interface-skeleton__sidebar{border-left:1px solid #e0e0e0}}@media (min-width:782px){.interface-interface-skeleton__secondary-sidebar{border-right:1px solid #e0e0e0}}.interface-interface-skeleton__header{flex-shrink:0;height:auto;border-bottom:1px solid #e0e0e0;z-index:30;color:#1e1e1e}.interface-interface-skeleton__footer{height:auto;flex-shrink:0;border-top:1px solid #e0e0e0;color:#1e1e1e;position:absolute;bottom:0;left:0;width:100%;background-color:#fff;z-index:90;display:none}@media (min-width:782px){.interface-interface-skeleton__footer{display:flex}}.interface-interface-skeleton__footer .block-editor-block-breadcrumb{z-index:30;display:flex;background:#fff;height:24px;align-items:center;font-size:13px;padding:0 18px}.interface-interface-skeleton__actions{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;left:auto;right:0;width:280px;color:#1e1e1e}.interface-interface-skeleton__actions:focus{top:auto;bottom:0}.interface-more-menu-dropdown{margin-left:-4px}.interface-more-menu-dropdown .components-button{width:auto;padding:0 2px}@media (min-width:600px){.interface-more-menu-dropdown{margin-left:0}.interface-more-menu-dropdown .components-button{padding:0 4px}}.interface-more-menu-dropdown__content .components-popover__content{min-width:280px}@media (min-width:480px){.interface-more-menu-dropdown__content .components-popover__content{width:auto;max-width:480px}}.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu{padding:0}.components-popover.interface-more-menu-dropdown__content{z-index:99998}.interface-pinned-items{display:flex}.interface-pinned-items .components-button:not(:first-child){display:none}@media (min-width:600px){.interface-pinned-items .components-button:not(:first-child){display:flex}}.interface-pinned-items .components-button{margin-left:4px}.interface-pinned-items .components-button svg{max-width:24px;max-height:24px}@media (min-width:600px){.interface-preferences-modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.interface-preferences-modal{width:750px}}@media (min-width:960px){.interface-preferences-modal{height:70%}}@media (max-width:781px){.interface-preferences-modal .components-modal__content{padding:0}.interface-preferences-modal .components-modal__content:before{content:none}}.interface-preferences__tabs .components-tab-panel__tabs{position:absolute;top:84px;left:16px;width:160px}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item{border-radius:2px;font-weight:400}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active{background:#f0f0f0;box-shadow:none;font-weight:500}.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.interface-preferences__tabs .components-tab-panel__tab-content{padding-left:24px;margin-left:160px}@media (max-width:781px){.interface-preferences__provider{height:100%}}.interface-preferences-modal__section{margin:0 0 2.5rem}.interface-preferences-modal__section:last-child{margin:0}.interface-preferences-modal__section-title{font-size:.9rem;font-weight:600;margin-top:0}.interface-preferences-modal__section-description{margin:-8px 0 8px;font-size:12px;font-style:normal;color:#757575}.interface-preferences-modal__option .components-base-control .components-base-control__field{align-items:center;display:flex;margin-bottom:0}.interface-preferences-modal__option .components-base-control .components-base-control__field>label{flex-grow:1;padding:.6rem 0 .6rem 10px}.interface-preferences-modal__option .components-base-control__help{margin:-8px 0 8px 58px;font-size:12px;font-style:normal;color:#757575}.edit-post-header{height:60px;background:#fff;display:flex;flex-wrap:wrap;align-items:center;max-width:100vw}@media (min-width:280px){.edit-post-header{flex-wrap:nowrap}}.edit-post-header>.edit-post-header__settings{order:1}@supports (position:sticky){.edit-post-header>.edit-post-header__settings{order:0}}.edit-post-header__toolbar{display:flex;flex-grow:1}.edit-post-header__toolbar .table-of-contents{display:none}@media (min-width:600px){.edit-post-header__toolbar .table-of-contents{display:block}}.edit-post-header__settings{display:inline-flex;align-items:center;flex-wrap:wrap;padding-right:4px}@media (min-width:600px){.edit-post-header__settings{padding-right:16px}}.edit-post-header__settings .components-button.components-button,.edit-post-header__settings .editor-post-saved-state{margin-right:4px}@media (min-width:600px){.edit-post-header__settings .components-button.components-button,.edit-post-header__settings .editor-post-saved-state{margin-right:12px}}.edit-post-header__settings .components-button.is-tertiary,.edit-post-header__settings .editor-post-saved-state{padding:0 6px}.edit-post-header__settings .interface-more-menu-dropdown .components-button,.edit-post-header__settings .interface-pinned-items .components-button{margin-right:0}.edit-post-header-preview__grouping-external{display:flex;position:relative;padding-bottom:0}.edit-post-header-preview__button-external{padding-left:8px;margin-right:auto;width:100%;display:flex;justify-content:flex-start}.edit-post-header-preview__button-external svg{margin-left:auto}.edit-post-post-preview-dropdown .components-popover__content>div{padding-bottom:0}.edit-post-header__dropdown .components-button.has-icon,.show-icon-labels .edit-post-header .components-button.has-icon,.show-icon-labels.interface-pinned-items .components-button.has-icon{width:auto}.edit-post-header__dropdown .components-button.has-icon svg,.show-icon-labels .edit-post-header .components-button.has-icon svg,.show-icon-labels.interface-pinned-items .components-button.has-icon svg{display:none}.edit-post-header__dropdown .components-button.has-icon:after,.show-icon-labels .edit-post-header .components-button.has-icon:after,.show-icon-labels.interface-pinned-items .components-button.has-icon:after{content:attr(aria-label)}.edit-post-header__dropdown .components-button.has-icon[aria-disabled=true],.show-icon-labels .edit-post-header .components-button.has-icon[aria-disabled=true],.show-icon-labels.interface-pinned-items .components-button.has-icon[aria-disabled=true]{background-color:transparent}.edit-post-header__dropdown .is-tertiary:active,.show-icon-labels .edit-post-header .is-tertiary:active,.show-icon-labels.interface-pinned-items .is-tertiary:active{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color);background-color:transparent}.edit-post-header__dropdown .components-button.has-icon.button-toggle svg,.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon svg,.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle svg,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon svg,.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle svg,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon svg{display:block}.edit-post-header__dropdown .components-button.has-icon.button-toggle:after,.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon:after,.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle:after,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon:after,.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle:after,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon:after{content:none}.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon,.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon,.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon{width:60px}.edit-post-header__dropdown .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon,.show-icon-labels .edit-post-header .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon,.show-icon-labels.interface-pinned-items .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon{display:block}.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.edit-post-header__dropdown .interface-pinned-items .components-button,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels .edit-post-header .interface-pinned-items .components-button,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button{padding-left:8px;padding-right:8px}@media (min-width:600px){.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.edit-post-header__dropdown .interface-pinned-items .components-button,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels .edit-post-header .interface-pinned-items .components-button,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle,.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button{padding-left:12px;padding-right:12px}}.edit-post-header__dropdown .components-dropdown-menu__toggle,.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle{margin-left:8px;padding-left:8px;padding-right:8px}@media (min-width:600px){.edit-post-header__dropdown .components-dropdown-menu__toggle,.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle{margin-left:12px;padding-left:12px;padding-right:12px}}.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle:after,.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft:after{content:none}@media (min-width:600px){.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft:after,.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft:after{content:attr(aria-label)}}.edit-post-header__dropdown .components-button.block-editor-list-view,.edit-post-header__dropdown .components-button.editor-history__redo,.edit-post-header__dropdown .components-button.editor-history__undo,.edit-post-header__dropdown .components-menu-item__button.components-menu-item__button,.edit-post-header__dropdown .table-of-contents .components-button{margin:0;padding:6px 6px 6px 40px;width:14.625rem;text-align:left;justify-content:flex-start}.show-icon-labels.interface-pinned-items{padding:6px 12px 12px;margin:0 -12px;border-bottom:1px solid #ccc;display:block}.show-icon-labels.interface-pinned-items>.components-button.has-icon{margin:0;padding:6px 6px 6px 8px;width:14.625rem;justify-content:flex-start}.show-icon-labels.interface-pinned-items>.components-button.has-icon[aria-expanded=true] svg{display:block;max-width:24px}.show-icon-labels.interface-pinned-items>.components-button.has-icon[aria-expanded=false]{padding-left:40px}.show-icon-labels.interface-pinned-items>.components-button.has-icon svg{margin-right:8px}.edit-post-fullscreen-mode-close.components-button{display:none}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button{display:flex;align-items:center;align-self:stretch;border:none;background:#1e1e1e;color:#fff;border-radius:0;height:61px;width:60px;position:relative;margin-bottom:-1px}.edit-post-fullscreen-mode-close.components-button:active{color:#fff}.edit-post-fullscreen-mode-close.components-button:focus{box-shadow:none}.edit-post-fullscreen-mode-close.components-button:before{transition:box-shadow .1s ease;content:"";display:block;position:absolute;top:9px;right:9px;bottom:9px;left:9px;border-radius:4px;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e}}@media (min-width:782px) and (prefers-reduced-motion:reduce){.edit-post-fullscreen-mode-close.components-button:before{transition-duration:0s;transition-delay:0s}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button:hover:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) #757575}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button.has-icon:hover:before{box-shadow:none}}@media (min-width:782px){.edit-post-fullscreen-mode-close.components-button:focus:before{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) hsla(0,0%,100%,.1),inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}}.edit-post-fullscreen-mode-close.components-button .edit-post-fullscreen-mode-close_site-icon{width:36px;height:36px;border-radius:2px;-o-object-fit:cover;object-fit:cover;margin-top:-1px}.edit-post-header-toolbar{display:inline-flex;flex-grow:1;align-items:center;border:none}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button{display:none}@media (min-width:600px){.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button{display:inline-flex}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle{display:inline-flex}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle svg{transition:transform .2s cubic-bezier(.165,.84,.44,1)}@media (prefers-reduced-motion:reduce){.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle svg{transition-duration:0s;transition-delay:0s}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.is-pressed svg{transform:rotate(45deg)}.edit-post-header-toolbar .block-editor-list-view{display:none}@media (min-width:600px){.edit-post-header-toolbar .block-editor-list-view{display:flex}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon{height:36px;min-width:36px;padding:6px}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon.is-pressed,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon.is-pressed{background:#1e1e1e}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon:focus:not(:disabled),.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon:focus:not(:disabled){box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 0 0 1px #fff;outline:1px solid transparent}.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-button.has-icon:before,.edit-post-header-toolbar .edit-post-header-toolbar__left>.components-dropdown>.components-button.has-icon:before{display:none}@media (min-width:600px){.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{transition:opacity .1s linear}}@media (min-width:600px) and (prefers-reduced-motion:reduce){.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left>*+.components-button,.edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left>*+.components-dropdown>[aria-expanded=false]{opacity:0}}.edit-post-header-toolbar__left{display:inline-flex;align-items:center;padding-left:8px}@media (min-width:600px){.edit-post-header-toolbar__left{padding-left:24px}}@media (min-width:1280px){.edit-post-header-toolbar__left{padding-right:8px}}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-icon{margin-right:8px;min-width:32px;width:32px;height:32px;padding:0}.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-icon{height:36px}.edit-post-header-toolbar .edit-post-header-toolbar__left>.edit-post-header-toolbar__inserter-toggle.has-text.has-icon{width:auto;padding:0 8px}.show-icon-labels .edit-post-header-toolbar__left>*+*{margin-left:8px}.edit-post-template-top-area{display:flex;flex-direction:column;align-content:space-between;width:100%;align-items:center}.edit-post-template-top-area .edit-post-template-post-title,.edit-post-template-top-area .edit-post-template-title{padding:0;text-decoration:none;height:auto}.edit-post-template-top-area .edit-post-template-post-title:before,.edit-post-template-top-area .edit-post-template-title:before{height:100%}.edit-post-template-top-area .edit-post-template-post-title.has-icon svg,.edit-post-template-top-area .edit-post-template-title.has-icon svg{order:1;margin-right:0}.edit-post-template-top-area .edit-post-template-title{color:#1e1e1e}.edit-post-template-top-area .edit-post-template-post-title{margin-top:4px;max-width:160px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.edit-post-template-top-area .edit-post-template-post-title:before{left:0;right:0}@media (min-width:1080px){.edit-post-template-top-area .edit-post-template-post-title{max-width:400px}}.edit-post-template-top-area__popover .components-popover__content{min-width:280px;padding:8px}.edit-post-template-top-area__popover .edit-post-template-details__description{color:#757575}.edit-post-template-top-area__second-menu-group{margin-left:-16px;margin-right:-16px;padding:16px 16px 0;border-top:1px solid #ddd}.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button{display:flex;justify-content:center}.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item{margin-right:0;min-width:0}.edit-post-keyboard-shortcut-help-modal__section{margin:0 0 2rem}.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list{margin-top:-25px}.edit-post-keyboard-shortcut-help-modal__section-title{font-size:.9rem;font-weight:600}.edit-post-keyboard-shortcut-help-modal__shortcut{display:flex;align-items:baseline;padding:.6rem 0;border-top:1px solid #ddd;margin-bottom:0}.edit-post-keyboard-shortcut-help-modal__shortcut:last-child{border-bottom:1px solid #ddd}.edit-post-keyboard-shortcut-help-modal__shortcut:empty{display:none}.edit-post-keyboard-shortcut-help-modal__shortcut-term{font-weight:600;margin:0 0 0 1rem;text-align:right}.edit-post-keyboard-shortcut-help-modal__shortcut-description{flex:1;margin:0;flex-basis:auto}.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination{display:block;background:none;margin:0;padding:0}.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination+.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination{margin-top:10px}.edit-post-keyboard-shortcut-help-modal__shortcut-key{padding:.25rem .5rem;border-radius:8%;margin:0 .2rem}.edit-post-keyboard-shortcut-help-modal__shortcut-key:last-child{margin:0 0 0 .2rem}.edit-post-layout__metaboxes{flex-shrink:0;clear:both}.edit-post-layout .components-editor-notices__snackbar{position:fixed;right:0;bottom:40px;padding-left:16px;padding-right:16px;left:0}@media (min-width:783px){.edit-post-layout .components-editor-notices__snackbar{left:160px}}@media (min-width:783px){.auto-fold .edit-post-layout .components-editor-notices__snackbar{left:36px}}@media (min-width:961px){.auto-fold .edit-post-layout .components-editor-notices__snackbar{left:160px}}.folded .edit-post-layout .components-editor-notices__snackbar{left:0}@media (min-width:783px){.folded .edit-post-layout .components-editor-notices__snackbar{left:36px}}body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar{left:0!important}.edit-post-layout .editor-post-publish-panel{position:fixed;z-index:100001;top:46px;bottom:0;right:0;left:0;overflow:auto}@media (min-width:782px){.edit-post-layout .editor-post-publish-panel{z-index:99998;top:32px;left:auto;width:281px;border-left:1px solid #ddd;transform:translateX(100%);animation:edit-post-post-publish-panel__slide-in-animation .1s forwards}}@media (min-width:782px) and (prefers-reduced-motion:reduce){.edit-post-layout .editor-post-publish-panel{animation-duration:1ms;animation-delay:0s}}@media (min-width:782px){body.is-fullscreen-mode .edit-post-layout .editor-post-publish-panel{top:0}}@media (min-width:782px){[role=region]:focus .edit-post-layout .editor-post-publish-panel{transform:translateX(0)}}@keyframes edit-post-post-publish-panel__slide-in-animation{to{transform:translateX(0)}}.edit-post-layout .editor-post-publish-panel__header-publish-button{justify-content:center}.edit-post-layout__toggle-entities-saved-states-panel,.edit-post-layout__toggle-publish-panel,.edit-post-layout__toggle-sidebar-panel{z-index:100000;position:fixed!important;top:-9999em;bottom:auto;left:auto;right:0;width:280px;background-color:#fff;border:1px dotted #ddd;height:auto!important;padding:24px;display:flex;justify-content:center}.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-entities-saved-states-panel,.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-publish-panel,.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-sidebar-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-entities-saved-states-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-publish-panel,.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-sidebar-panel{top:auto;bottom:0}.edit-post-block-manager__no-results{font-style:italic;padding:24px 0;text-align:center}.edit-post-block-manager__search{margin:16px 0}.edit-post-block-manager__disabled-blocks-count{border:1px solid #ddd;border-width:1px 0;box-shadow:-32px 0 0 0 #fff,32px 0 0 0 #fff;padding:8px;background-color:#fff;text-align:center;font-style:italic;position:sticky;top:-1px;z-index:2}.edit-post-block-manager__disabled-blocks-count~.edit-post-block-manager__results .edit-post-block-manager__category-title{top:35px}.edit-post-block-manager__category{margin:0 0 24px}.edit-post-block-manager__category-title{position:sticky;top:0;padding:16px 0;background-color:#fff;z-index:1}.edit-post-block-manager__category-title .components-checkbox-control__label{font-weight:600}.edit-post-block-manager__show-all{margin-right:8px}.edit-post-block-manager__checklist{margin-top:0}.edit-post-block-manager__category-title,.edit-post-block-manager__checklist-item{border-bottom:1px solid #ddd}.edit-post-block-manager__category-title .components-base-control__field,.edit-post-block-manager__checklist-item .components-base-control__field{align-items:center;display:flex;margin:0}.edit-post-block-manager__checklist-item{margin-bottom:0;padding-left:16px}.components-modal__content .edit-post-block-manager__checklist-item.components-checkbox-control__input-container{margin:0 8px}.edit-post-block-manager__checklist-item .components-checkbox-control__label{display:flex;align-items:center;justify-content:space-between;flex-grow:1;padding:8px 0}.edit-post-block-manager__checklist-item .block-editor-block-icon{margin-right:10px;fill:#1e1e1e}.edit-post-block-manager__results{border-top:1px solid #ddd}.edit-post-block-manager__disabled-blocks-count+.edit-post-block-manager__results{border-top-width:0}.edit-post-meta-boxes-area{position:relative}.edit-post-meta-boxes-area .inside,.edit-post-meta-boxes-area__container{box-sizing:content-box}.edit-post-meta-boxes-area input,.edit-post-meta-boxes-area textarea{box-sizing:border-box}.edit-post-meta-boxes-area .postbox-header{border-top:1px solid #ddd;border-bottom:0}.edit-post-meta-boxes-area #poststuff{margin:0 auto;padding-top:0;min-width:auto}.edit-post-meta-boxes-area #poststuff .stuffbox>h3,.edit-post-meta-boxes-area #poststuff h2.hndle,.edit-post-meta-boxes-area #poststuff h3.hndle{box-sizing:border-box;color:inherit;font-weight:600;outline:none;padding:0 24px;position:relative;width:100%}.edit-post-meta-boxes-area .postbox{border:0;color:inherit;margin-bottom:0}.edit-post-meta-boxes-area .postbox>.inside{color:inherit;padding:0 24px 24px;margin:0}.edit-post-meta-boxes-area .postbox .handlediv{height:44px;width:44px}.edit-post-meta-boxes-area.is-loading:before{position:absolute;top:0;left:0;right:0;bottom:0;content:"";background:transparent;z-index:1}.edit-post-meta-boxes-area .components-spinner{position:absolute;top:10px;right:20px;z-index:5}.edit-post-meta-boxes-area .is-hidden{display:none}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]{border:1px solid #757575}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:checked{background:#fff;border-color:#757575}.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:before{margin:-3px -4px}.edit-post-meta-boxes-area__clear{clear:both}.edit-post-editor__inserter-panel,.edit-post-editor__list-view-panel{height:100%;display:flex;flex-direction:column}.edit-post-editor__list-view-panel{min-width:350px}.edit-post-editor__inserter-panel-header{padding-top:8px;padding-right:8px;display:flex;justify-content:flex-end}.edit-post-editor__inserter-panel-content,.edit-post-editor__list-view-panel-content{height:calc(100% - 44px)}@media (min-width:782px){.edit-post-editor__inserter-panel-content{height:100%}}.edit-post-editor__list-view-panel-header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;height:48px;padding-left:16px;padding-right:4px}.edit-post-editor__list-view-panel-content{overflow-y:auto;padding:8px 6px}.components-panel__header.edit-post-sidebar__panel-tabs{justify-content:flex-start;padding-left:0;padding-right:16px;border-top:0;margin-top:0}.components-panel__header.edit-post-sidebar__panel-tabs ul{display:flex}.components-panel__header.edit-post-sidebar__panel-tabs li{margin:0}.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon{display:none;margin:0 0 0 auto;padding:0;min-width:24px;height:24px}@media (min-width:782px){.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon{display:flex}}.components-panel__body.is-opened.edit-post-last-revision__panel{padding:0;height:48px}.editor-post-last-revision__title.components-button{padding:16px}.editor-post-author__select{margin:-5px 0;width:100%}@supports (position:sticky){.editor-post-author__select{width:auto}}.edit-post-post-link__link-post-name{font-weight:600}.edit-post-post-link__preview-label{font-weight:400;margin:0}.edit-post-post-link__link{text-align:left;word-wrap:break-word;display:block}.edit-post-post-link__preview-link-container{direction:ltr}.edit-post-post-schedule{width:100%;position:relative;justify-content:left}.edit-post-post-schedule span{display:block;width:45%}.components-button.edit-post-post-schedule__toggle{text-align:right}.edit-post-post-schedule__dialog .components-popover__content>div{padding:0}.editor-post-slug__input{margin:-5px 0;padding:2px}.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft{margin-top:15px;width:100%;text-align:center}.edit-post-post-visibility{width:100%;justify-content:left}.edit-post-post-visibility span{display:block;width:45%}@media (min-width:782px){.edit-post-post-visibility__dialog .components-popover__content{width:257px}}.edit-post-post-visibility__dialog-legend{font-weight:600}.edit-post-post-visibility__choice{margin:10px 0}.edit-post-post-visibility__dialog-label,.edit-post-post-visibility__dialog-radio{vertical-align:top}.edit-post-post-visibility__dialog-password-input{width:calc(100% - 20px);margin-left:20px}.edit-post-post-visibility__dialog-info{color:#757575;padding-left:20px;font-style:italic;margin:4px 0 0;line-height:1.4}.components-button.edit-post-sidebar__panel-tab{border-radius:0;height:48px;background:transparent;border:none;box-shadow:none;cursor:pointer;display:inline-block;padding:3px 15px;margin-left:0;font-weight:500}.components-button.edit-post-sidebar__panel-tab:after{content:attr(data-label);display:block;font-weight:600;height:0;overflow:hidden;speak:none;visibility:hidden}.components-button.edit-post-sidebar__panel-tab.is-active{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) transparent,inset 0 -4px 0 0 var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-post-sidebar__panel-tab.is-active:before{content:"";position:absolute;top:0;bottom:1px;right:0;left:0;border-bottom:4px solid transparent}.components-button.edit-post-sidebar__panel-tab:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative;z-index:1}.components-button.edit-post-sidebar__panel-tab.is-active:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color),inset 0 -4px 0 0 var(--wp-admin-theme-color)}@media (min-width:782px){.edit-post-template__modal .components-base-control{width:320px}}.edit-post-template__modal .components-modal__header{border-bottom:none}.edit-post-template__modal .components-modal__content:before{margin-bottom:4px}.edit-post-template__modal-actions{margin-top:12px}.edit-post-template-modal__tip{padding:16px 24px;background:#f0f0f0;border-radius:2px}@media (min-width:782px){.edit-post-template-modal__tip{width:240px}}.edit-post-template__notice{margin:0 0 8px}.edit-post-template__notice .components-notice__content{margin:0}.edit-post-template__actions button:not(:last-child){margin-right:8px}h2.edit-post-template-summary__title{line-height:24px;margin:0 0 4px;font-weight:500}.edit-post-text-editor{position:relative;width:100%;background-color:#fff;flex-grow:1}.edit-post-text-editor .editor-post-title{max-width:none;line-height:1.4;font-family:Menlo,Consolas,monaco,monospace;font-size:2.5em;font-weight:400;border:1px solid #949494;padding:16px}@media (min-width:600px){.edit-post-text-editor .editor-post-title{padding:24px}}.edit-post-text-editor .editor-post-title:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color)}.edit-post-text-editor__body{width:100%;padding:0 12px 12px;max-width:1080px;margin-left:auto;margin-right:auto}@media (min-width:960px){.edit-post-text-editor__body{padding:0 24px 24px}}.edit-post-text-editor__toolbar{position:sticky;z-index:1;top:0;left:0;right:0;display:flex;background:hsla(0,0%,100%,.8);padding:4px 12px}@media (min-width:600px){.edit-post-text-editor__toolbar{padding:12px}}@media (min-width:960px){.edit-post-text-editor__toolbar{padding:12px 24px}}.edit-post-text-editor__toolbar h2{line-height:36px;margin:0 auto 0 0;font-size:13px;color:#1e1e1e}.edit-post-text-editor__toolbar .components-button svg{order:1}.edit-post-visual-editor{position:relative;display:flex;flex-flow:column;background-color:#2f2f2f;flex:1 0 auto}.edit-post-visual-editor .components-button{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;padding:6px 12px}.edit-post-visual-editor .components-button.has-icon,.edit-post-visual-editor .components-button.is-tertiary{padding:6px}.edit-post-visual-editor__post-title-wrapper{margin-top:4rem;margin-bottom:var(--wp--style--block-gap)}.edit-post-visual-editor__post-title-wrapper .editor-post-title{margin-left:auto;margin-right:auto}.edit-post-visual-editor__exit-template-mode{position:absolute;top:8px;left:8px;color:#fff}.edit-post-visual-editor__exit-template-mode:active:not([aria-disabled=true]),.edit-post-visual-editor__exit-template-mode:focus:not([aria-disabled=true]),.edit-post-visual-editor__exit-template-mode:hover{color:#f0f0f0}.edit-post-visual-editor__content-area{width:100%;height:100%;position:relative;box-sizing:border-box;display:flex;flex-grow:1}.edit-post-welcome-guide,.edit-template-welcome-guide{width:312px}.edit-post-welcome-guide__image,.edit-template-welcome-guide__image{background:#00a0d2;margin:0 0 16px}.edit-post-welcome-guide__image>img,.edit-template-welcome-guide__image>img{display:block;max-width:100%;-o-object-fit:cover;object-fit:cover}.edit-post-welcome-guide__heading,.edit-template-welcome-guide__heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:24px;line-height:1.4;margin:16px 0;padding:0 32px}.edit-post-welcome-guide__text,.edit-template-welcome-guide__text{font-size:13px;line-height:1.4;margin:0 0 24px;padding:0 32px}.edit-post-welcome-guide__inserter-icon,.edit-template-welcome-guide__inserter-icon{margin:0 4px;vertical-align:text-top}.edit-template-welcome-guide .components-button svg{fill:#fff}@media (min-width:600px){.edit-post-start-page-options__modal{width:calc(100% - 32px);height:calc(100% - 120px)}}@media (min-width:782px){.edit-post-start-page-options__modal{width:750px}}@media (min-width:960px){.edit-post-start-page-options__modal{height:70%}}.edit-post-start-page-options__modal .components-modal__header{border-bottom:none}.edit-post-start-page-options__modal .components-modal__content:before{content:none}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list{column-count:2;column-gap:24px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{break-inside:avoid-column;margin-bottom:24px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{min-height:100px}.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content{width:100%}@keyframes edit-post__fade-in-animation{0%{opacity:0}to{opacity:1}}body.block-editor-page,html.wp-toolbar{background:#fff}body.block-editor-page #wpcontent{padding-left:0}body.block-editor-page #wpbody-content{padding-bottom:0}body.block-editor-page #wpbody-content>div:not(.block-editor):not(#screen-meta),body.block-editor-page #wpfooter{display:none}body.block-editor-page .a11y-speak-region{left:-1px;top:-1px}body.block-editor-page ul#adminmenu>li.current>a.current:after,body.block-editor-page ul#adminmenu a.wp-has-current-submenu:after{border-right-color:#fff}body.block-editor-page .media-frame select.attachment-filters:last-of-type{width:auto;max-width:100%}.block-editor-page #wpwrap{overflow-y:auto}@media (min-width:782px){.block-editor-page #wpwrap{overflow-y:initial}}.components-modal__frame,.components-popover,.edit-post-editor__inserter-panel,.edit-post-header,.edit-post-sidebar,.edit-post-text-editor,.editor-post-publish-panel{box-sizing:border-box}.components-modal__frame *,.components-modal__frame :after,.components-modal__frame :before,.components-popover *,.components-popover :after,.components-popover :before,.edit-post-editor__inserter-panel *,.edit-post-editor__inserter-panel :after,.edit-post-editor__inserter-panel :before,.edit-post-header *,.edit-post-header :after,.edit-post-header :before,.edit-post-sidebar *,.edit-post-sidebar :after,.edit-post-sidebar :before,.edit-post-text-editor *,.edit-post-text-editor :after,.edit-post-text-editor :before,.editor-post-publish-panel *,.editor-post-publish-panel :after,.editor-post-publish-panel :before{box-sizing:inherit}@media (min-width:600px){.block-editor__container{position:absolute;top:0;right:0;bottom:0;left:0;min-height:calc(100vh - 46px)}}@media (min-width:782px){.block-editor__container{min-height:calc(100vh - 32px)}body.is-fullscreen-mode .block-editor__container{min-height:100vh}}.block-editor__container img{max-width:100%;height:auto}body.admin-color-light{--wp-admin-theme-color:#0085ba;--wp-admin-theme-color--rgb:0,133,186;--wp-admin-theme-color-darker-10:#0073a1;--wp-admin-theme-color-darker-10--rgb:0,115,161;--wp-admin-theme-color-darker-20:#006187;--wp-admin-theme-color-darker-20--rgb:0,97,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-light{--wp-admin-border-width-focus:1.5px}}body.admin-color-modern{--wp-admin-theme-color:#3858e9;--wp-admin-theme-color--rgb:56,88,233;--wp-admin-theme-color-darker-10:#2145e6;--wp-admin-theme-color-darker-10--rgb:33,69,230;--wp-admin-theme-color-darker-20:#183ad6;--wp-admin-theme-color-darker-20--rgb:24,58,214;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-modern{--wp-admin-border-width-focus:1.5px}}body.admin-color-blue{--wp-admin-theme-color:#096484;--wp-admin-theme-color--rgb:9,100,132;--wp-admin-theme-color-darker-10:#07526c;--wp-admin-theme-color-darker-10--rgb:7,82,108;--wp-admin-theme-color-darker-20:#064054;--wp-admin-theme-color-darker-20--rgb:6,64,84;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-blue{--wp-admin-border-width-focus:1.5px}}body.admin-color-coffee{--wp-admin-theme-color:#46403c;--wp-admin-theme-color--rgb:70,64,60;--wp-admin-theme-color-darker-10:#383330;--wp-admin-theme-color-darker-10--rgb:56,51,48;--wp-admin-theme-color-darker-20:#2b2724;--wp-admin-theme-color-darker-20--rgb:43,39,36;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-coffee{--wp-admin-border-width-focus:1.5px}}body.admin-color-ectoplasm{--wp-admin-theme-color:#523f6d;--wp-admin-theme-color--rgb:82,63,109;--wp-admin-theme-color-darker-10:#46365d;--wp-admin-theme-color-darker-10--rgb:70,54,93;--wp-admin-theme-color-darker-20:#3a2c4d;--wp-admin-theme-color-darker-20--rgb:58,44,77;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ectoplasm{--wp-admin-border-width-focus:1.5px}}body.admin-color-midnight{--wp-admin-theme-color:#e14d43;--wp-admin-theme-color--rgb:225,77,67;--wp-admin-theme-color-darker-10:#dd382d;--wp-admin-theme-color-darker-10--rgb:221,56,45;--wp-admin-theme-color-darker-20:#d02c21;--wp-admin-theme-color-darker-20--rgb:208,44,33;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-midnight{--wp-admin-border-width-focus:1.5px}}body.admin-color-ocean{--wp-admin-theme-color:#627c83;--wp-admin-theme-color--rgb:98,124,131;--wp-admin-theme-color-darker-10:#576e74;--wp-admin-theme-color-darker-10--rgb:87,110,116;--wp-admin-theme-color-darker-20:#4c6066;--wp-admin-theme-color-darker-20--rgb:76,96,102;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-ocean{--wp-admin-border-width-focus:1.5px}}body.admin-color-sunrise{--wp-admin-theme-color:#dd823b;--wp-admin-theme-color--rgb:221,130,59;--wp-admin-theme-color-darker-10:#d97426;--wp-admin-theme-color-darker-10--rgb:217,116,38;--wp-admin-theme-color-darker-20:#c36922;--wp-admin-theme-color-darker-20--rgb:195,105,34;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){body.admin-color-sunrise{--wp-admin-border-width-focus:1.5px}}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.editor-styles-wrapper .wp-block { - margin-left: auto; - margin-right: auto; -} - -html :where(.editor-styles-wrapper) { - padding: 8px; -} -html :where(.editor-styles-wrapper) .block-editor-block-list__layout.is-root-container > .wp-block[data-align=full] { - margin-left: -8px; - margin-right: -8px; -} - -html :where(.wp-block) { - max-width: 840px; - margin-top: 28px; - margin-bottom: 28px; -} -html :where(.wp-block)[data-align=wide] { - max-width: 1100px; -} -html :where(.wp-block)[data-align=full] { - max-width: none; -} -html :where(.wp-block)[data-align=left], html :where(.wp-block)[data-align=right] { - width: 100%; - height: 0; -} -html :where(.wp-block)[data-align=left]::before, html :where(.wp-block)[data-align=right]::before { - content: none; -} -html :where(.wp-block)[data-align=left] > * { - /*!rtl:begin:ignore*/ - float: left; - margin-right: 2em; - /*!rtl:end:ignore*/ -} -html :where(.wp-block)[data-align=right] > * { - /*!rtl:begin:ignore*/ - float: right; - margin-left: 2em; - /*!rtl:end:ignore*/ -} -html :where(.wp-block)[data-align=full], html :where(.wp-block)[data-align=wide] { - clear: both; -} - -.wp-block-group > [data-align=full] { - margin-left: auto; - margin-right: auto; -} - -.wp-block-group.has-background > [data-align=full] { - margin-left: -30px; - width: calc(100% + 60px); -} - -/** -* Group: Full Width Alignment -*/ -[data-align=full] .wp-block-group > .wp-block { - padding-left: 14px; - padding-right: 14px; -} -@media (min-width: 600px) { - [data-align=full] .wp-block-group > .wp-block { - padding-left: 0; - padding-right: 0; - } -} -[data-align=full] .wp-block-group > [data-align=full] { - padding-right: 0; - padding-left: 0; - left: 0; - width: 100%; - max-width: none; -} -[data-align=full] .wp-block-group.has-background > [data-align=full] { - width: calc(100% + 60px); -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-left: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-left: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-right: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-right: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - left: 10px; - bottom: 10px; - right: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-right: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - right: 0; - left: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - right: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - right: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - right: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - right: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-right: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-left: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - right: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - right: auto; - left: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-right: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-right: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-right: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - right: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-right: 24px; - margin-right: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 10px 0.6rem 0; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 58px 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.edit-post-header { - height: 60px; - background: #fff; - display: flex; - flex-wrap: wrap; - align-items: center; - max-width: 100vw; -} -@media (min-width: 280px) { - .edit-post-header { - flex-wrap: nowrap; - } -} -.edit-post-header > .edit-post-header__settings { - order: 1; -} -@supports (position: sticky) { - .edit-post-header > .edit-post-header__settings { - order: initial; - } -} - -.edit-post-header__toolbar { - display: flex; - flex-grow: 1; -} -.edit-post-header__toolbar .table-of-contents { - display: none; -} -@media (min-width: 600px) { - .edit-post-header__toolbar .table-of-contents { - display: block; - } -} - -.edit-post-header__settings { - display: inline-flex; - align-items: center; - flex-wrap: wrap; - padding-left: 4px; - /** - * Buttons in the Toolbar - */ -} -@media (min-width: 600px) { - .edit-post-header__settings { - padding-left: 16px; - } -} -.edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.components-button { - margin-left: 4px; -} -@media (min-width: 600px) { - .edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.components-button { - margin-left: 12px; - } -} -.edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.is-tertiary { - padding: 0 6px; -} -.edit-post-header__settings .interface-more-menu-dropdown .components-button, -.edit-post-header__settings .interface-pinned-items .components-button { - margin-left: 0; -} - -.edit-post-header-preview__grouping-external { - display: flex; - position: relative; - padding-bottom: 0; -} - -.edit-post-header-preview__button-external { - padding-right: 8px; - margin-left: auto; - width: 100%; - display: flex; - justify-content: flex-start; -} -.edit-post-header-preview__button-external svg { - margin-right: auto; -} - -.edit-post-post-preview-dropdown .components-popover__content > div { - padding-bottom: 0; -} - -.show-icon-labels.interface-pinned-items .components-button.has-icon, -.show-icon-labels .edit-post-header .components-button.has-icon, -.edit-post-header__dropdown .components-button.has-icon { - width: auto; -} -.show-icon-labels.interface-pinned-items .components-button.has-icon svg, -.show-icon-labels .edit-post-header .components-button.has-icon svg, -.edit-post-header__dropdown .components-button.has-icon svg { - display: none; -} -.show-icon-labels.interface-pinned-items .components-button.has-icon::after, -.show-icon-labels .edit-post-header .components-button.has-icon::after, -.edit-post-header__dropdown .components-button.has-icon::after { - content: attr(aria-label); -} -.show-icon-labels.interface-pinned-items .components-button.has-icon[aria-disabled=true], -.show-icon-labels .edit-post-header .components-button.has-icon[aria-disabled=true], -.edit-post-header__dropdown .components-button.has-icon[aria-disabled=true] { - background-color: transparent; -} -.show-icon-labels.interface-pinned-items .is-tertiary:active, -.show-icon-labels .edit-post-header .is-tertiary:active, -.edit-post-header__dropdown .is-tertiary:active { - box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color); - background-color: transparent; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon svg, -.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle svg, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon svg, -.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle svg, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon svg, -.edit-post-header__dropdown .components-button.has-icon.button-toggle svg { - display: block; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon::after, -.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle::after, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon::after, -.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle::after, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon::after, -.edit-post-header__dropdown .components-button.has-icon.button-toggle::after { - content: none; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon { - width: 60px; -} -.show-icon-labels.interface-pinned-items .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon, -.show-icon-labels .edit-post-header .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon, -.edit-post-header__dropdown .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon { - display: block; -} -.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels .edit-post-header .interface-pinned-items .components-button, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.edit-post-header__dropdown .interface-pinned-items .components-button { - padding-right: 8px; - padding-left: 8px; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels .edit-post-header .interface-pinned-items .components-button, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.edit-post-header__dropdown .interface-pinned-items .components-button { - padding-right: 12px; - padding-left: 12px; - } -} -.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle, -.show-icon-labels .edit-post-header .components-dropdown-menu__toggle, -.edit-post-header__dropdown .components-dropdown-menu__toggle { - margin-right: 8px; - padding-right: 8px; - padding-left: 8px; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle, -.show-icon-labels .edit-post-header .components-dropdown-menu__toggle, -.edit-post-header__dropdown .components-dropdown-menu__toggle { - margin-right: 12px; - padding-right: 12px; - padding-left: 12px; - } -} -.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after { - content: none; -} -.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after, -.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after, -.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after { - content: none; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after, -.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after, -.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after { - content: attr(aria-label); - } -} - -.edit-post-header__dropdown .components-menu-item__button.components-menu-item__button, -.edit-post-header__dropdown .components-button.editor-history__undo, -.edit-post-header__dropdown .components-button.editor-history__redo, -.edit-post-header__dropdown .table-of-contents .components-button, -.edit-post-header__dropdown .components-button.block-editor-list-view { - margin: 0; - padding: 6px 40px 6px 6px; - width: 14.625rem; - text-align: right; - justify-content: flex-start; -} - -.show-icon-labels.interface-pinned-items { - padding: 6px 12px 12px; - margin-top: 0; - margin-bottom: 0; - margin-right: -12px; - margin-left: -12px; - border-bottom: 1px solid #ccc; - display: block; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon { - margin: 0; - padding: 6px 8px 6px 6px; - width: 14.625rem; - justify-content: flex-start; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon[aria-expanded=true] svg { - display: block; - max-width: 24px; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon[aria-expanded=false] { - padding-right: 40px; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon svg { - margin-left: 8px; -} - -.edit-post-fullscreen-mode-close.components-button { - display: none; -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button { - display: flex; - align-items: center; - align-self: stretch; - border: none; - background: #1e1e1e; - color: #fff; - border-radius: 0; - height: 61px; - width: 60px; - position: relative; - margin-bottom: -1px; - } - .edit-post-fullscreen-mode-close.components-button:active { - color: #fff; - } - .edit-post-fullscreen-mode-close.components-button:focus { - box-shadow: none; - } - .edit-post-fullscreen-mode-close.components-button::before { - transition: box-shadow 0.1s ease; - content: ""; - display: block; - position: absolute; - top: 9px; - left: 9px; - bottom: 9px; - right: 9px; - border-radius: 4px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; - } -} -@media (min-width: 782px) and (prefers-reduced-motion: reduce) { - .edit-post-fullscreen-mode-close.components-button::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button:hover::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button.has-icon:hover::before { - box-shadow: none; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - } -} -.edit-post-fullscreen-mode-close.components-button .edit-post-fullscreen-mode-close_site-icon { - width: 36px; - height: 36px; - border-radius: 2px; - -o-object-fit: cover; - object-fit: cover; - margin-top: -1px; -} - -.edit-post-header-toolbar { - display: inline-flex; - flex-grow: 1; - align-items: center; - border: none; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button { - display: none; -} -@media (min-width: 600px) { - .edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button { - display: inline-flex; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle { - display: inline-flex; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(-45deg); -} -.edit-post-header-toolbar .block-editor-list-view { - display: none; -} -@media (min-width: 600px) { - .edit-post-header-toolbar .block-editor-list-view { - display: flex; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon { - height: 36px; - min-width: 36px; - padding: 6px; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon.is-pressed, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon.is-pressed { - background: #1e1e1e; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon:focus:not(:disabled), -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 1px #fff; - outline: 1px solid transparent; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon::before, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon::before { - display: none; -} - -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-button, -.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - transition: opacity 0.1s linear; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-button, -.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left > * + .components-button, .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - opacity: 0; - } -} - -.edit-post-header-toolbar__left { - display: inline-flex; - align-items: center; - padding-right: 8px; -} -@media (min-width: 600px) { - .edit-post-header-toolbar__left { - padding-right: 24px; - } -} -@media (min-width: 1280px) { - .edit-post-header-toolbar__left { - padding-left: 8px; - } -} - -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon { - margin-left: 8px; - min-width: 32px; - width: 32px; - height: 32px; - padding: 0; -} -.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon { - height: 36px; -} - -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon { - width: auto; - padding: 0 8px; -} - -.show-icon-labels .edit-post-header-toolbar__left > * + * { - margin-right: 8px; -} - -.edit-post-template-top-area { - display: flex; - flex-direction: column; - align-content: space-between; - width: 100%; - align-items: center; -} -.edit-post-template-top-area .edit-post-template-title, -.edit-post-template-top-area .edit-post-template-post-title { - padding: 0; - text-decoration: none; - height: auto; -} -.edit-post-template-top-area .edit-post-template-title::before, -.edit-post-template-top-area .edit-post-template-post-title::before { - height: 100%; -} -.edit-post-template-top-area .edit-post-template-title.has-icon svg, -.edit-post-template-top-area .edit-post-template-post-title.has-icon svg { - order: 1; - margin-left: 0; -} -.edit-post-template-top-area .edit-post-template-title { - color: #1e1e1e; -} -.edit-post-template-top-area .edit-post-template-post-title { - margin-top: 4px; - max-width: 160px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - display: block; -} -.edit-post-template-top-area .edit-post-template-post-title::before { - right: 0; - left: 0; -} -@media (min-width: 1080px) { - .edit-post-template-top-area .edit-post-template-post-title { - max-width: 400px; - } -} - -.edit-post-template-top-area__popover .components-popover__content { - min-width: 280px; - padding: 8px; -} -.edit-post-template-top-area__popover .edit-post-template-details__description { - color: #757575; -} - -.edit-post-template-top-area__second-menu-group { - margin-right: -16px; - margin-left: -16px; - padding: 16px; - padding-bottom: 0; - border-top: 1px solid #ddd; -} -.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button { - display: flex; - justify-content: center; -} -.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item { - margin-left: 0; - min-width: 0; -} - -.edit-post-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-post-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-post-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-post-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-post-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 1rem 0 0; - text-align: left; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-post-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0.2rem 0 0; -} - -.edit-post-layout__metaboxes { - flex-shrink: 0; - clear: both; -} - -.edit-post-layout .components-editor-notices__snackbar { - position: fixed; - left: 0; - bottom: 40px; - padding-right: 16px; - padding-left: 16px; -} - -.edit-post-layout .components-editor-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - right: 0; -} -@media (min-width: 783px) { - .edit-post-layout .components-editor-notices__snackbar { - right: 160px; - } -} - -.auto-fold .edit-post-layout .components-editor-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-post-layout .components-editor-notices__snackbar { - right: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-post-layout .components-editor-notices__snackbar { - right: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-post-layout .components-editor-notices__snackbar { - right: 0; -} -@media (min-width: 783px) { - .folded .edit-post-layout .components-editor-notices__snackbar { - right: 36px; - } -} - -body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar { - right: 0 !important; -} - -.edit-post-layout .editor-post-publish-panel { - position: fixed; - z-index: 100001; - top: 46px; - bottom: 0; - left: 0; - right: 0; - overflow: auto; -} -@media (min-width: 782px) { - .edit-post-layout .editor-post-publish-panel { - z-index: 99998; - top: 32px; - right: auto; - width: 281px; - border-right: 1px solid #ddd; - transform: translateX(-100%); - animation: edit-post-post-publish-panel__slide-in-animation 0.1s forwards; - } -} -@media (min-width: 782px) and (prefers-reduced-motion: reduce) { - .edit-post-layout .editor-post-publish-panel { - animation-duration: 1ms; - animation-delay: 0s; - } -} -@media (min-width: 782px) { - body.is-fullscreen-mode .edit-post-layout .editor-post-publish-panel { - top: 0; - } -} -@media (min-width: 782px) { - [role=region]:focus .edit-post-layout .editor-post-publish-panel { - transform: translateX(0%); - } -} - -@keyframes edit-post-post-publish-panel__slide-in-animation { - 100% { - transform: translateX(0%); - } -} -.edit-post-layout .editor-post-publish-panel__header-publish-button { - justify-content: center; -} - -.edit-post-layout__toggle-publish-panel, -.edit-post-layout__toggle-sidebar-panel, -.edit-post-layout__toggle-entities-saved-states-panel { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - right: auto; - left: 0; - width: 280px; - background-color: #fff; - border: 1px dotted #ddd; - height: auto !important; - padding: 24px; - display: flex; - justify-content: center; -} -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-publish-panel, .interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-publish-panel, -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-sidebar-panel, -.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-sidebar-panel, -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-entities-saved-states-panel, -.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-entities-saved-states-panel { - top: auto; - bottom: 0; -} - -.edit-post-block-manager__no-results { - font-style: italic; - padding: 24px 0; - text-align: center; -} - -.edit-post-block-manager__search { - margin: 16px 0; -} - -.edit-post-block-manager__disabled-blocks-count { - border: 1px solid #ddd; - border-width: 1px 0; - box-shadow: 32px 0 0 0 #fff, -32px 0 0 0 #fff; - padding: 8px; - background-color: #fff; - text-align: center; - font-style: italic; - position: sticky; - top: -1px; - z-index: 2; -} -.edit-post-block-manager__disabled-blocks-count ~ .edit-post-block-manager__results .edit-post-block-manager__category-title { - top: 35px; -} - -.edit-post-block-manager__category { - margin: 0 0 24px 0; -} - -.edit-post-block-manager__category-title { - position: sticky; - top: 0; - padding: 16px 0; - background-color: #fff; - z-index: 1; -} -.edit-post-block-manager__category-title .components-checkbox-control__label { - font-weight: 600; -} - -.edit-post-block-manager__show-all { - margin-left: 8px; -} - -.edit-post-block-manager__checklist { - margin-top: 0; -} - -.edit-post-block-manager__category-title, -.edit-post-block-manager__checklist-item { - border-bottom: 1px solid #ddd; -} -.edit-post-block-manager__category-title .components-base-control__field, -.edit-post-block-manager__checklist-item .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} - -.edit-post-block-manager__checklist-item { - margin-bottom: 0; - padding-right: 16px; -} -.components-modal__content .edit-post-block-manager__checklist-item.components-checkbox-control__input-container { - margin: 0 8px; -} -.edit-post-block-manager__checklist-item .components-checkbox-control__label { - display: flex; - align-items: center; - justify-content: space-between; - flex-grow: 1; - padding: 8px 0; -} -.edit-post-block-manager__checklist-item .block-editor-block-icon { - margin-left: 10px; - fill: #1e1e1e; -} - -.edit-post-block-manager__results { - border-top: 1px solid #ddd; -} - -.edit-post-block-manager__disabled-blocks-count + .edit-post-block-manager__results { - border-top-width: 0; -} - -.edit-post-meta-boxes-area { - position: relative; - /** - * The wordpress default for most meta-box elements is content-box. Some - * elements such as textarea and input are set to border-box in forms.css. - * These elements therefore specifically set back to border-box here, while - * other elements (such as .button) are unaffected by Gutenberg's style - * because of their higher specificity. - */ - /* Match width and positioning of the meta boxes. Override default styles. */ - /* Override Default meta box stylings */ -} -.edit-post-meta-boxes-area__container, -.edit-post-meta-boxes-area .inside { - box-sizing: content-box; -} -.edit-post-meta-boxes-area textarea, -.edit-post-meta-boxes-area input { - box-sizing: border-box; -} -.edit-post-meta-boxes-area .postbox-header { - border-top: 1px solid #ddd; - border-bottom: 0; -} -.edit-post-meta-boxes-area #poststuff { - margin: 0 auto; - padding-top: 0; - min-width: auto; -} -.edit-post-meta-boxes-area #poststuff h3.hndle, -.edit-post-meta-boxes-area #poststuff .stuffbox > h3, -.edit-post-meta-boxes-area #poststuff h2.hndle { - /* WordPress selectors yolo */ - box-sizing: border-box; - color: inherit; - font-weight: 600; - outline: none; - padding: 0 24px; - position: relative; - width: 100%; -} -.edit-post-meta-boxes-area .postbox { - border: 0; - color: inherit; - margin-bottom: 0; -} -.edit-post-meta-boxes-area .postbox > .inside { - color: inherit; - padding: 0 24px 24px; - margin: 0; -} -.edit-post-meta-boxes-area .postbox .handlediv { - height: 44px; - width: 44px; -} -.edit-post-meta-boxes-area.is-loading::before { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - content: ""; - background: transparent; - z-index: 1; -} -.edit-post-meta-boxes-area .components-spinner { - position: absolute; - top: 10px; - left: 20px; - z-index: 5; -} -.edit-post-meta-boxes-area .is-hidden { - display: none; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox] { - border: 1px solid #757575; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:checked { - background: #fff; - border-color: #757575; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]::before { - margin: -3px -4px; -} - -.edit-post-meta-boxes-area__clear { - clear: both; -} - -.edit-post-editor__inserter-panel, -.edit-post-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; -} - -.edit-post-editor__list-view-panel { - min-width: 350px; -} - -.edit-post-editor__inserter-panel-header { - padding-top: 8px; - padding-left: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-post-editor__inserter-panel-content, -.edit-post-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); -} - -@media (min-width: 782px) { - .edit-post-editor__inserter-panel-content { - height: 100%; - } -} - -.edit-post-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-right: 16px; - padding-left: 4px; -} - -.edit-post-editor__list-view-panel-content { - overflow-y: auto; - padding: 8px 6px; -} - -.components-panel__header.edit-post-sidebar__panel-tabs { - justify-content: flex-start; - padding-right: 0; - padding-left: 16px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-post-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-post-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin: 0 auto 0 0; - padding: 0; - min-width: 24px; - height: 24px; -} -@media (min-width: 782px) { - .components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-panel__body.is-opened.edit-post-last-revision__panel { - padding: 0; - height: 48px; -} - -.editor-post-last-revision__title.components-button { - padding: 16px; -} - -.editor-post-author__select { - margin: -5px 0; - width: 100%; -} -@supports (position: sticky) { - .editor-post-author__select { - width: auto; - } -} - -.edit-post-post-link__link-post-name { - font-weight: 600; -} - -.edit-post-post-link__preview-label { - font-weight: 400; - margin: 0; -} - -.edit-post-post-link__link { - text-align: right; - word-wrap: break-word; - display: block; -} -.edit-post-post-link__preview-link-container { - direction: ltr; -} -.edit-post-post-schedule { - width: 100%; - position: relative; - justify-content: left; -} -.edit-post-post-schedule span { - display: block; - width: 45%; -} - -.components-button.edit-post-post-schedule__toggle { - text-align: left; -} - -.edit-post-post-schedule__dialog .components-popover__content > div { - padding: 0; -} - -.editor-post-slug__input { - margin: -5px 0; - padding: 2px; -} - -.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft { - margin-top: 15px; - width: 100%; - text-align: center; -} - -.edit-post-post-visibility { - width: 100%; - justify-content: left; -} -.edit-post-post-visibility span { - display: block; - width: 45%; -} - -@media (min-width: 782px) { - .edit-post-post-visibility__dialog .components-popover__content { - width: 257px; - } -} - -.edit-post-post-visibility__dialog-legend { - font-weight: 600; -} - -.edit-post-post-visibility__choice { - margin: 10px 0; -} - -.edit-post-post-visibility__dialog-radio, -.edit-post-post-visibility__dialog-label { - vertical-align: top; -} - -.edit-post-post-visibility__dialog-password-input { - width: calc(100% - 20px); - margin-right: 20px; -} - -.edit-post-post-visibility__dialog-info { - color: #757575; - padding-right: 20px; - font-style: italic; - margin: 4px 0 0; - line-height: 1.4; -} - -.components-button.edit-post-sidebar__panel-tab { - border-radius: 0; - height: 48px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-right: 0; - font-weight: 500; -} -.components-button.edit-post-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-post-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-post-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - left: 0; - right: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-post-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-post-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -@media (min-width: 782px) { - .edit-post-template__modal .components-base-control { - width: 320px; - } -} -.edit-post-template__modal .components-modal__header { - border-bottom: none; -} -.edit-post-template__modal .components-modal__content::before { - margin-bottom: 4px; -} - -.edit-post-template__modal-actions { - margin-top: 12px; -} - -.edit-post-template-modal__tip { - padding: 16px 24px; - background: #f0f0f0; - border-radius: 2px; -} -@media (min-width: 782px) { - .edit-post-template-modal__tip { - width: 240px; - } -} - -.edit-post-template__notice { - margin: 0 0 8px 0; -} -.edit-post-template__notice .components-notice__content { - margin: 0; -} - -.edit-post-template__actions button:not(:last-child) { - margin-left: 8px; -} - -h2.edit-post-template-summary__title { - line-height: 24px; - margin: 0 0 4px; - font-weight: 500; -} - -.edit-post-text-editor { - position: relative; - width: 100%; - background-color: #fff; - flex-grow: 1; -} -.edit-post-text-editor .editor-post-title { - max-width: none; - line-height: 1.4; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 2.5em; - font-weight: normal; - border: 1px solid #949494; - padding: 16px; -} -@media (min-width: 600px) { - .edit-post-text-editor .editor-post-title { - padding: 24px; - } -} -.edit-post-text-editor .editor-post-title:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.edit-post-text-editor__body { - width: 100%; - padding: 0 12px 12px 12px; - max-width: 1080px; - margin-right: auto; - margin-left: auto; -} -@media (min-width: 960px) { - .edit-post-text-editor__body { - padding: 16px 24px 96px 24px; - padding: 0 24px 24px 24px; - } -} - -.edit-post-text-editor__toolbar { - position: sticky; - z-index: 1; - top: 0; - right: 0; - left: 0; - display: flex; - background: rgba(255, 255, 255, 0.8); - padding: 4px 12px; -} -@media (min-width: 600px) { - .edit-post-text-editor__toolbar { - padding: 12px; - } -} -@media (min-width: 960px) { - .edit-post-text-editor__toolbar { - padding: 12px 24px; - } -} -.edit-post-text-editor__toolbar h2 { - line-height: 36px; - margin: 0 0 0 auto; - font-size: 13px; - color: #1e1e1e; -} -.edit-post-text-editor__toolbar .components-button svg { - order: 1; -} - -.edit-post-visual-editor { - position: relative; - display: flex; - flex-flow: column; - background-color: #2f2f2f; - flex: 1 0 auto; -} -.edit-post-visual-editor .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - padding: 6px 12px; -} -.edit-post-visual-editor .components-button.is-tertiary, .edit-post-visual-editor .components-button.has-icon { - padding: 6px; -} - -.edit-post-visual-editor__post-title-wrapper { - margin-top: 4rem; - margin-bottom: var(--wp--style--block-gap); -} -.edit-post-visual-editor__post-title-wrapper .editor-post-title { - margin-right: auto; - margin-left: auto; -} - -.edit-post-visual-editor__exit-template-mode { - position: absolute; - top: 8px; - right: 8px; - color: #fff; -} -.edit-post-visual-editor__exit-template-mode:active:not([aria-disabled=true]), .edit-post-visual-editor__exit-template-mode:focus:not([aria-disabled=true]), .edit-post-visual-editor__exit-template-mode:hover { - color: #f0f0f0; -} - -.edit-post-visual-editor__content-area { - width: 100%; - height: 100%; - position: relative; - box-sizing: border-box; - display: flex; - flex-grow: 1; -} - -.edit-post-welcome-guide, -.edit-template-welcome-guide { - width: 312px; -} -.edit-post-welcome-guide__image, -.edit-template-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-post-welcome-guide__image > img, -.edit-template-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-post-welcome-guide__heading, -.edit-template-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-post-welcome-guide__text, -.edit-template-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 24px 0; - padding: 0 32px; -} -.edit-post-welcome-guide__inserter-icon, -.edit-template-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-template-welcome-guide .components-button svg { - fill: #fff; -} - -@media (min-width: 600px) { - .edit-post-start-page-options__modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .edit-post-start-page-options__modal { - width: 750px; - } -} -@media (min-width: 960px) { - .edit-post-start-page-options__modal { - height: 70%; - } -} -.edit-post-start-page-options__modal .components-modal__header { - border-bottom: none; -} -.edit-post-start-page-options__modal .components-modal__content::before { - content: none; -} - -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list { - column-count: 2; - column-gap: 24px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - break-inside: avoid-column; - margin-bottom: 24px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - min-height: 100px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content { - width: 100%; -} - -/** - * Animations - */ -@keyframes edit-post__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -html.wp-toolbar { - background: #fff; -} - -body.block-editor-page { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.block-editor-page #wpcontent { - padding-right: 0; -} -body.block-editor-page #wpbody-content { - padding-bottom: 0; -} -body.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) { - display: none; -} -body.block-editor-page #wpfooter { - display: none; -} -body.block-editor-page .a11y-speak-region { - right: -1px; - top: -1px; -} -body.block-editor-page ul#adminmenu a.wp-has-current-submenu::after, -body.block-editor-page ul#adminmenu > li.current > a.current::after { - border-left-color: #fff; -} -body.block-editor-page .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.block-editor-page #wpwrap { - overflow-y: auto; -} -@media (min-width: 782px) { - .block-editor-page #wpwrap { - overflow-y: initial; - } -} - -.edit-post-header, -.edit-post-text-editor, -.edit-post-sidebar, -.editor-post-publish-panel, -.components-popover, -.components-modal__frame, -.edit-post-editor__inserter-panel { - box-sizing: border-box; -} -.edit-post-header *, -.edit-post-header *::before, -.edit-post-header *::after, -.edit-post-text-editor *, -.edit-post-text-editor *::before, -.edit-post-text-editor *::after, -.edit-post-sidebar *, -.edit-post-sidebar *::before, -.edit-post-sidebar *::after, -.editor-post-publish-panel *, -.editor-post-publish-panel *::before, -.editor-post-publish-panel *::after, -.components-popover *, -.components-popover *::before, -.components-popover *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after, -.edit-post-editor__inserter-panel *, -.edit-post-editor__inserter-panel *::before, -.edit-post-editor__inserter-panel *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .block-editor__container { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - min-height: calc(100vh - 46px); - } -} -@media (min-width: 782px) { - .block-editor__container { - min-height: calc(100vh - 32px); - } - body.is-fullscreen-mode .block-editor__container { - min-height: 100vh; - } -} -.block-editor__container img { - max-width: 100%; - height: auto; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.editor-styles-wrapper .wp-block{margin-right:auto;margin-left:auto}html :where(.editor-styles-wrapper){padding:8px}html :where(.editor-styles-wrapper) .block-editor-block-list__layout.is-root-container>.wp-block[data-align=full]{margin-right:-8px;margin-left:-8px}html :where(.wp-block){max-width:840px;margin-top:28px;margin-bottom:28px}html :where(.wp-block)[data-align=wide]{max-width:1100px}html :where(.wp-block)[data-align=full]{max-width:none}html :where(.wp-block)[data-align=left],html :where(.wp-block)[data-align=right]{width:100%;height:0}html :where(.wp-block)[data-align=left]:before,html :where(.wp-block)[data-align=right]:before{content:none}html :where(.wp-block)[data-align=left]>*{float:left;margin-right:2em}html :where(.wp-block)[data-align=right]>*{float:right;margin-left:2em}html :where(.wp-block)[data-align=full],html :where(.wp-block)[data-align=wide]{clear:both}.wp-block-group>[data-align=full]{margin-right:auto;margin-left:auto}.wp-block-group.has-background>[data-align=full]{margin-right:-30px;width:calc(100% + 60px)}[data-align=full] .wp-block-group>.wp-block{padding-right:14px;padding-left:14px}@media (min-width:600px){[data-align=full] .wp-block-group>.wp-block{padding-right:0;padding-left:0}}[data-align=full] .wp-block-group>[data-align=full]{padding-left:0;padding-right:0;right:0;width:100%;max-width:none}[data-align=full] .wp-block-group.has-background>[data-align=full]{width:calc(100% + 60px)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.components-panel__header.interface-complementary-area-header__small { - background: #fff; - padding-right: 4px; -} -.components-panel__header.interface-complementary-area-header__small .interface-complementary-area-header__small-title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 100%; -} -@media (min-width: 782px) { - .components-panel__header.interface-complementary-area-header__small { - display: none; - } -} - -.interface-complementary-area-header { - background: #fff; - padding-right: 4px; -} -.interface-complementary-area-header .components-button.has-icon { - display: none; - margin-left: auto; -} -.interface-complementary-area-header .components-button.has-icon ~ .components-button { - margin-left: 0; -} -@media (min-width: 782px) { - .interface-complementary-area-header .components-button.has-icon { - display: flex; - } -} - -@media (min-width: 782px) { - .components-panel__header + .interface-complementary-area-header { - margin-top: 0; - } -} - -.interface-complementary-area { - background: #fff; - color: #1e1e1e; -} -@media (min-width: 600px) { - .interface-complementary-area { - -webkit-overflow-scrolling: touch; - } -} -@media (min-width: 782px) { - .interface-complementary-area { - width: 280px; - } -} -.interface-complementary-area .components-panel { - border: none; - position: relative; - z-index: 0; -} -.interface-complementary-area .components-panel__header { - position: sticky; - top: 0; - z-index: 1; -} -.interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 48px; -} -@media (min-width: 782px) { - .interface-complementary-area .components-panel__header.edit-post-sidebar__panel-tabs { - top: 0; - } -} -.interface-complementary-area p { - margin-top: 0; -} -.interface-complementary-area h2 { - font-size: 13px; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area h3 { - font-size: 11px; - text-transform: uppercase; - font-weight: 500; - color: #1e1e1e; - margin-bottom: 1.5em; -} -.interface-complementary-area hr { - border-top: none; - border-bottom: 1px solid #f0f0f0; - margin: 1.5em 0; -} -.interface-complementary-area div.components-toolbar-group, -.interface-complementary-area div.components-toolbar { - box-shadow: none; - margin-bottom: 1.5em; -} -.interface-complementary-area div.components-toolbar-group:last-child, -.interface-complementary-area div.components-toolbar:last-child { - margin-bottom: 0; -} -.interface-complementary-area .block-editor-skip-to-selected-block:focus { - top: auto; - right: 10px; - bottom: 10px; - left: auto; -} - -@media (min-width: 782px) { - body.js.is-fullscreen-mode { - margin-top: -32px; - height: calc(100% + 32px); - } - body.js.is-fullscreen-mode #adminmenumain, -body.js.is-fullscreen-mode #wpadminbar { - display: none; - } - body.js.is-fullscreen-mode #wpcontent, -body.js.is-fullscreen-mode #wpfooter { - margin-left: 0; - } -} - -html.interface-interface-skeleton__html-container { - position: fixed; - width: 100%; -} -@media (min-width: 782px) { - html.interface-interface-skeleton__html-container { - position: initial; - width: initial; - } -} - -.interface-interface-skeleton { - display: flex; - flex-direction: row; - height: auto; - max-height: 100%; - position: fixed; - top: 46px; - left: 0; - right: 0; - bottom: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - top: 32px; - } - .is-fullscreen-mode .interface-interface-skeleton { - top: 0; - } -} - -.interface-interface-skeleton__editor { - display: flex; - flex-direction: column; - flex: 0 1 100%; - overflow: hidden; -} - -.interface-interface-skeleton { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .interface-interface-skeleton { - left: 160px; - } -} - -.auto-fold .interface-interface-skeleton { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .interface-interface-skeleton { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .interface-interface-skeleton { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .interface-interface-skeleton { - left: 0; -} -@media (min-width: 783px) { - .folded .interface-interface-skeleton { - left: 36px; - } -} - -body.is-fullscreen-mode .interface-interface-skeleton { - left: 0 !important; -} - -.interface-interface-skeleton__body { - flex-grow: 1; - display: flex; - overflow: auto; - overscroll-behavior-y: none; -} -@media (min-width: 782px) { - .has-footer .interface-interface-skeleton__body { - padding-bottom: 25px; - } -} - -.interface-interface-skeleton__content { - flex-grow: 1; - display: flex; - flex-direction: column; - overflow: auto; - z-index: 20; -} - -.interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - display: block; - flex-shrink: 0; - position: absolute; - z-index: 100000; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: #fff; - color: #1e1e1e; -} -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar, -.interface-interface-skeleton__sidebar { - position: relative !important; - z-index: 90; - width: auto; - } -} - -.interface-interface-skeleton__sidebar { - overflow: auto; -} -@media (min-width: 782px) { - .interface-interface-skeleton__sidebar { - border-left: 1px solid #e0e0e0; - } -} - -@media (min-width: 782px) { - .interface-interface-skeleton__secondary-sidebar { - border-right: 1px solid #e0e0e0; - } -} - -.interface-interface-skeleton__header { - flex-shrink: 0; - height: auto; - border-bottom: 1px solid #e0e0e0; - z-index: 30; - color: #1e1e1e; -} - -.interface-interface-skeleton__footer { - height: auto; - flex-shrink: 0; - border-top: 1px solid #e0e0e0; - color: #1e1e1e; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - background-color: #fff; - z-index: 90; - display: none; -} -@media (min-width: 782px) { - .interface-interface-skeleton__footer { - display: flex; - } -} -.interface-interface-skeleton__footer .block-editor-block-breadcrumb { - z-index: 30; - display: flex; - background: #fff; - height: 24px; - align-items: center; - font-size: 13px; - padding: 0 18px; -} - -.interface-interface-skeleton__actions { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - left: auto; - right: 0; - width: 280px; - color: #1e1e1e; -} -.interface-interface-skeleton__actions:focus { - top: auto; - bottom: 0; -} - -.interface-more-menu-dropdown { - margin-left: -4px; -} -.interface-more-menu-dropdown .components-button { - width: auto; - padding: 0 2px; -} -@media (min-width: 600px) { - .interface-more-menu-dropdown { - margin-left: 0; - } - .interface-more-menu-dropdown .components-button { - padding: 0 4px; - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 280px; -} -@media (min-width: 480px) { - .interface-more-menu-dropdown__content .components-popover__content { - width: auto; - max-width: 480px; - } -} -.interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu { - padding: 0; -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: 99998; -} - -.interface-pinned-items { - display: flex; -} -.interface-pinned-items .components-button:not(:first-child) { - display: none; -} -@media (min-width: 600px) { - .interface-pinned-items .components-button:not(:first-child) { - display: flex; - } -} -.interface-pinned-items .components-button { - margin-left: 4px; -} -.interface-pinned-items .components-button svg { - max-width: 24px; - max-height: 24px; -} - -@media (min-width: 600px) { - .interface-preferences-modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .interface-preferences-modal { - width: 750px; - } -} -@media (min-width: 960px) { - .interface-preferences-modal { - height: 70%; - } -} -@media (max-width: 781px) { - .interface-preferences-modal .components-modal__content { - padding: 0; - } - .interface-preferences-modal .components-modal__content::before { - content: none; - } -} - -.interface-preferences__tabs .components-tab-panel__tabs { - position: absolute; - top: 84px; - left: 16px; - width: 160px; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item { - border-radius: 2px; - font-weight: 400; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active { - background: #f0f0f0; - box-shadow: none; - font-weight: 500; -} -.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} -.interface-preferences__tabs .components-tab-panel__tab-content { - padding-left: 24px; - margin-left: 160px; -} - -@media (max-width: 781px) { - .interface-preferences__provider { - height: 100%; - } -} -.interface-preferences-modal__section { - margin: 0 0 2.5rem 0; -} -.interface-preferences-modal__section:last-child { - margin: 0; -} - -.interface-preferences-modal__section-title { - font-size: 0.9rem; - font-weight: 600; - margin-top: 0; -} - -.interface-preferences-modal__section-description { - margin: -8px 0 8px 0; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.interface-preferences-modal__option .components-base-control .components-base-control__field { - align-items: center; - display: flex; - margin-bottom: 0; -} -.interface-preferences-modal__option .components-base-control .components-base-control__field > label { - flex-grow: 1; - padding: 0.6rem 0 0.6rem 10px; -} -.interface-preferences-modal__option .components-base-control__help { - margin: -8px 0 8px 58px; - font-size: 12px; - font-style: normal; - color: #757575; -} - -.edit-post-header { - height: 60px; - background: #fff; - display: flex; - flex-wrap: wrap; - align-items: center; - max-width: 100vw; -} -@media (min-width: 280px) { - .edit-post-header { - flex-wrap: nowrap; - } -} -.edit-post-header > .edit-post-header__settings { - order: 1; -} -@supports (position: sticky) { - .edit-post-header > .edit-post-header__settings { - order: initial; - } -} - -.edit-post-header__toolbar { - display: flex; - flex-grow: 1; -} -.edit-post-header__toolbar .table-of-contents { - display: none; -} -@media (min-width: 600px) { - .edit-post-header__toolbar .table-of-contents { - display: block; - } -} - -.edit-post-header__settings { - display: inline-flex; - align-items: center; - flex-wrap: wrap; - padding-right: 4px; - /** - * Buttons in the Toolbar - */ -} -@media (min-width: 600px) { - .edit-post-header__settings { - padding-right: 16px; - } -} -.edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.components-button { - margin-right: 4px; -} -@media (min-width: 600px) { - .edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.components-button { - margin-right: 12px; - } -} -.edit-post-header__settings .editor-post-saved-state, -.edit-post-header__settings .components-button.is-tertiary { - padding: 0 6px; -} -.edit-post-header__settings .interface-more-menu-dropdown .components-button, -.edit-post-header__settings .interface-pinned-items .components-button { - margin-right: 0; -} - -.edit-post-header-preview__grouping-external { - display: flex; - position: relative; - padding-bottom: 0; -} - -.edit-post-header-preview__button-external { - padding-left: 8px; - margin-right: auto; - width: 100%; - display: flex; - justify-content: flex-start; -} -.edit-post-header-preview__button-external svg { - margin-left: auto; -} - -.edit-post-post-preview-dropdown .components-popover__content > div { - padding-bottom: 0; -} - -.show-icon-labels.interface-pinned-items .components-button.has-icon, -.show-icon-labels .edit-post-header .components-button.has-icon, -.edit-post-header__dropdown .components-button.has-icon { - width: auto; -} -.show-icon-labels.interface-pinned-items .components-button.has-icon svg, -.show-icon-labels .edit-post-header .components-button.has-icon svg, -.edit-post-header__dropdown .components-button.has-icon svg { - display: none; -} -.show-icon-labels.interface-pinned-items .components-button.has-icon::after, -.show-icon-labels .edit-post-header .components-button.has-icon::after, -.edit-post-header__dropdown .components-button.has-icon::after { - content: attr(aria-label); -} -.show-icon-labels.interface-pinned-items .components-button.has-icon[aria-disabled=true], -.show-icon-labels .edit-post-header .components-button.has-icon[aria-disabled=true], -.edit-post-header__dropdown .components-button.has-icon[aria-disabled=true] { - background-color: transparent; -} -.show-icon-labels.interface-pinned-items .is-tertiary:active, -.show-icon-labels .edit-post-header .is-tertiary:active, -.edit-post-header__dropdown .is-tertiary:active { - box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color); - background-color: transparent; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon svg, -.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle svg, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon svg, -.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle svg, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon svg, -.edit-post-header__dropdown .components-button.has-icon.button-toggle svg { - display: block; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon::after, -.show-icon-labels.interface-pinned-items .components-button.has-icon.button-toggle::after, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon::after, -.show-icon-labels .edit-post-header .components-button.has-icon.button-toggle::after, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon::after, -.edit-post-header__dropdown .components-button.has-icon.button-toggle::after { - content: none; -} -.show-icon-labels.interface-pinned-items .edit-post-fullscreen-mode-close.has-icon, -.show-icon-labels .edit-post-header .edit-post-fullscreen-mode-close.has-icon, -.edit-post-header__dropdown .edit-post-fullscreen-mode-close.has-icon { - width: 60px; -} -.show-icon-labels.interface-pinned-items .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon, -.show-icon-labels .edit-post-header .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon, -.edit-post-header__dropdown .components-menu-items-choice .components-menu-items__item-icon.components-menu-items__item-icon { - display: block; -} -.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels .edit-post-header .interface-pinned-items .components-button, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.edit-post-header__dropdown .interface-pinned-items .components-button { - padding-left: 8px; - padding-right: 8px; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels.interface-pinned-items .interface-pinned-items .components-button, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.show-icon-labels .edit-post-header .interface-pinned-items .components-button, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle, -.edit-post-header__dropdown .interface-pinned-items .components-button { - padding-left: 12px; - padding-right: 12px; - } -} -.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle, -.show-icon-labels .edit-post-header .components-dropdown-menu__toggle, -.edit-post-header__dropdown .components-dropdown-menu__toggle { - margin-left: 8px; - padding-left: 8px; - padding-right: 8px; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle, -.show-icon-labels .edit-post-header .components-dropdown-menu__toggle, -.edit-post-header__dropdown .components-dropdown-menu__toggle { - margin-left: 12px; - padding-left: 12px; - padding-right: 12px; - } -} -.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after, -.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after, -.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after { - content: none; -} -.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after, -.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after, -.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after { - content: none; -} -@media (min-width: 600px) { - .show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after, -.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after, -.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after { - content: attr(aria-label); - } -} - -.edit-post-header__dropdown .components-menu-item__button.components-menu-item__button, -.edit-post-header__dropdown .components-button.editor-history__undo, -.edit-post-header__dropdown .components-button.editor-history__redo, -.edit-post-header__dropdown .table-of-contents .components-button, -.edit-post-header__dropdown .components-button.block-editor-list-view { - margin: 0; - padding: 6px 6px 6px 40px; - width: 14.625rem; - text-align: left; - justify-content: flex-start; -} - -.show-icon-labels.interface-pinned-items { - padding: 6px 12px 12px; - margin-top: 0; - margin-bottom: 0; - margin-left: -12px; - margin-right: -12px; - border-bottom: 1px solid #ccc; - display: block; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon { - margin: 0; - padding: 6px 6px 6px 8px; - width: 14.625rem; - justify-content: flex-start; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon[aria-expanded=true] svg { - display: block; - max-width: 24px; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon[aria-expanded=false] { - padding-left: 40px; -} -.show-icon-labels.interface-pinned-items > .components-button.has-icon svg { - margin-right: 8px; -} - -.edit-post-fullscreen-mode-close.components-button { - display: none; -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button { - display: flex; - align-items: center; - align-self: stretch; - border: none; - background: #1e1e1e; - color: #fff; - border-radius: 0; - height: 61px; - width: 60px; - position: relative; - margin-bottom: -1px; - } - .edit-post-fullscreen-mode-close.components-button:active { - color: #fff; - } - .edit-post-fullscreen-mode-close.components-button:focus { - box-shadow: none; - } - .edit-post-fullscreen-mode-close.components-button::before { - transition: box-shadow 0.1s ease; - content: ""; - display: block; - position: absolute; - top: 9px; - right: 9px; - bottom: 9px; - left: 9px; - border-radius: 4px; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e; - } -} -@media (min-width: 782px) and (prefers-reduced-motion: reduce) { - .edit-post-fullscreen-mode-close.components-button::before { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button:hover::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button.has-icon:hover::before { - box-shadow: none; - } -} -@media (min-width: 782px) { - .edit-post-fullscreen-mode-close.components-button:focus::before { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - } -} -.edit-post-fullscreen-mode-close.components-button .edit-post-fullscreen-mode-close_site-icon { - width: 36px; - height: 36px; - border-radius: 2px; - -o-object-fit: cover; - object-fit: cover; - margin-top: -1px; -} - -.edit-post-header-toolbar { - display: inline-flex; - flex-grow: 1; - align-items: center; - border: none; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button { - display: none; -} -@media (min-width: 600px) { - .edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button { - display: inline-flex; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle { - display: inline-flex; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle svg { - transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle svg { - transition-duration: 0s; - transition-delay: 0s; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.is-pressed svg { - transform: rotate(45deg); -} -.edit-post-header-toolbar .block-editor-list-view { - display: none; -} -@media (min-width: 600px) { - .edit-post-header-toolbar .block-editor-list-view { - display: flex; - } -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon { - height: 36px; - min-width: 36px; - padding: 6px; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon.is-pressed, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon.is-pressed { - background: #1e1e1e; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon:focus:not(:disabled), -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon:focus:not(:disabled) { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 1px #fff; - outline: 1px solid transparent; -} -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-button.has-icon::before, -.edit-post-header-toolbar .edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon::before { - display: none; -} - -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-button, -.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - transition: opacity 0.1s linear; - } -} -@media (min-width: 600px) and (prefers-reduced-motion: reduce) { - .edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-button, -.edit-post-header.has-reduced-ui .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left > * + .components-button, .edit-post-header.has-reduced-ui:not(:hover) .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded=false] { - opacity: 0; - } -} - -.edit-post-header-toolbar__left { - display: inline-flex; - align-items: center; - padding-left: 8px; -} -@media (min-width: 600px) { - .edit-post-header-toolbar__left { - padding-left: 24px; - } -} -@media (min-width: 1280px) { - .edit-post-header-toolbar__left { - padding-right: 8px; - } -} - -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon { - margin-right: 8px; - min-width: 32px; - width: 32px; - height: 32px; - padding: 0; -} -.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon { - height: 36px; -} - -.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon { - width: auto; - padding: 0 8px; -} - -.show-icon-labels .edit-post-header-toolbar__left > * + * { - margin-left: 8px; -} - -.edit-post-template-top-area { - display: flex; - flex-direction: column; - align-content: space-between; - width: 100%; - align-items: center; -} -.edit-post-template-top-area .edit-post-template-title, -.edit-post-template-top-area .edit-post-template-post-title { - padding: 0; - text-decoration: none; - height: auto; -} -.edit-post-template-top-area .edit-post-template-title::before, -.edit-post-template-top-area .edit-post-template-post-title::before { - height: 100%; -} -.edit-post-template-top-area .edit-post-template-title.has-icon svg, -.edit-post-template-top-area .edit-post-template-post-title.has-icon svg { - order: 1; - margin-right: 0; -} -.edit-post-template-top-area .edit-post-template-title { - color: #1e1e1e; -} -.edit-post-template-top-area .edit-post-template-post-title { - margin-top: 4px; - max-width: 160px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - display: block; -} -.edit-post-template-top-area .edit-post-template-post-title::before { - left: 0; - right: 0; -} -@media (min-width: 1080px) { - .edit-post-template-top-area .edit-post-template-post-title { - max-width: 400px; - } -} - -.edit-post-template-top-area__popover .components-popover__content { - min-width: 280px; - padding: 8px; -} -.edit-post-template-top-area__popover .edit-post-template-details__description { - color: #757575; -} - -.edit-post-template-top-area__second-menu-group { - margin-left: -16px; - margin-right: -16px; - padding: 16px; - padding-bottom: 0; - border-top: 1px solid #ddd; -} -.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button { - display: flex; - justify-content: center; -} -.edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item { - margin-right: 0; - min-width: 0; -} - -.edit-post-keyboard-shortcut-help-modal__section { - margin: 0 0 2rem 0; -} -.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list { - margin-top: -25px; -} -.edit-post-keyboard-shortcut-help-modal__section-title { - font-size: 0.9rem; - font-weight: 600; -} -.edit-post-keyboard-shortcut-help-modal__shortcut { - display: flex; - align-items: baseline; - padding: 0.6rem 0; - border-top: 1px solid #ddd; - margin-bottom: 0; -} -.edit-post-keyboard-shortcut-help-modal__shortcut:last-child { - border-bottom: 1px solid #ddd; -} -.edit-post-keyboard-shortcut-help-modal__shortcut:empty { - display: none; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-term { - font-weight: 600; - margin: 0 0 0 1rem; - text-align: right; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-description { - flex: 1; - margin: 0; - flex-basis: auto; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination { - display: block; - background: none; - margin: 0; - padding: 0; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-post-keyboard-shortcut-help-modal__shortcut-key-combination { - margin-top: 10px; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key { - padding: 0.25rem 0.5rem; - border-radius: 8%; - margin: 0 0.2rem 0 0.2rem; -} -.edit-post-keyboard-shortcut-help-modal__shortcut-key:last-child { - margin: 0 0 0 0.2rem; -} - -.edit-post-layout__metaboxes { - flex-shrink: 0; - clear: both; -} - -.edit-post-layout .components-editor-notices__snackbar { - position: fixed; - right: 0; - bottom: 40px; - padding-left: 16px; - padding-right: 16px; -} - -.edit-post-layout .components-editor-notices__snackbar { - /* Set left position when auto-fold is not on the body element. */ - left: 0; -} -@media (min-width: 783px) { - .edit-post-layout .components-editor-notices__snackbar { - left: 160px; - } -} - -.auto-fold .edit-post-layout .components-editor-notices__snackbar { - /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ -} -@media (min-width: 783px) { - .auto-fold .edit-post-layout .components-editor-notices__snackbar { - left: 36px; - } -} -@media (min-width: 961px) { - .auto-fold .edit-post-layout .components-editor-notices__snackbar { - left: 160px; - } -} - -/* Sidebar manually collapsed. */ -.folded .edit-post-layout .components-editor-notices__snackbar { - left: 0; -} -@media (min-width: 783px) { - .folded .edit-post-layout .components-editor-notices__snackbar { - left: 36px; - } -} - -body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar { - left: 0 !important; -} - -.edit-post-layout .editor-post-publish-panel { - position: fixed; - z-index: 100001; - top: 46px; - bottom: 0; - right: 0; - left: 0; - overflow: auto; -} -@media (min-width: 782px) { - .edit-post-layout .editor-post-publish-panel { - z-index: 99998; - top: 32px; - left: auto; - width: 281px; - border-left: 1px solid #ddd; - transform: translateX(100%); - animation: edit-post-post-publish-panel__slide-in-animation 0.1s forwards; - } -} -@media (min-width: 782px) and (prefers-reduced-motion: reduce) { - .edit-post-layout .editor-post-publish-panel { - animation-duration: 1ms; - animation-delay: 0s; - } -} -@media (min-width: 782px) { - body.is-fullscreen-mode .edit-post-layout .editor-post-publish-panel { - top: 0; - } -} -@media (min-width: 782px) { - [role=region]:focus .edit-post-layout .editor-post-publish-panel { - transform: translateX(0%); - } -} - -@keyframes edit-post-post-publish-panel__slide-in-animation { - 100% { - transform: translateX(0%); - } -} -.edit-post-layout .editor-post-publish-panel__header-publish-button { - justify-content: center; -} - -.edit-post-layout__toggle-publish-panel, -.edit-post-layout__toggle-sidebar-panel, -.edit-post-layout__toggle-entities-saved-states-panel { - z-index: 100000; - position: fixed !important; - top: -9999em; - bottom: auto; - left: auto; - right: 0; - width: 280px; - background-color: #fff; - border: 1px dotted #ddd; - height: auto !important; - padding: 24px; - display: flex; - justify-content: center; -} -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-publish-panel, .interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-publish-panel, -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-sidebar-panel, -.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-sidebar-panel, -.interface-interface-skeleton__actions:focus .edit-post-layout__toggle-entities-saved-states-panel, -.interface-interface-skeleton__actions:focus-within .edit-post-layout__toggle-entities-saved-states-panel { - top: auto; - bottom: 0; -} - -.edit-post-block-manager__no-results { - font-style: italic; - padding: 24px 0; - text-align: center; -} - -.edit-post-block-manager__search { - margin: 16px 0; -} - -.edit-post-block-manager__disabled-blocks-count { - border: 1px solid #ddd; - border-width: 1px 0; - box-shadow: -32px 0 0 0 #fff, 32px 0 0 0 #fff; - padding: 8px; - background-color: #fff; - text-align: center; - font-style: italic; - position: sticky; - top: -1px; - z-index: 2; -} -.edit-post-block-manager__disabled-blocks-count ~ .edit-post-block-manager__results .edit-post-block-manager__category-title { - top: 35px; -} - -.edit-post-block-manager__category { - margin: 0 0 24px 0; -} - -.edit-post-block-manager__category-title { - position: sticky; - top: 0; - padding: 16px 0; - background-color: #fff; - z-index: 1; -} -.edit-post-block-manager__category-title .components-checkbox-control__label { - font-weight: 600; -} - -.edit-post-block-manager__show-all { - margin-right: 8px; -} - -.edit-post-block-manager__checklist { - margin-top: 0; -} - -.edit-post-block-manager__category-title, -.edit-post-block-manager__checklist-item { - border-bottom: 1px solid #ddd; -} -.edit-post-block-manager__category-title .components-base-control__field, -.edit-post-block-manager__checklist-item .components-base-control__field { - align-items: center; - display: flex; - margin: 0; -} - -.edit-post-block-manager__checklist-item { - margin-bottom: 0; - padding-left: 16px; -} -.components-modal__content .edit-post-block-manager__checklist-item.components-checkbox-control__input-container { - margin: 0 8px; -} -.edit-post-block-manager__checklist-item .components-checkbox-control__label { - display: flex; - align-items: center; - justify-content: space-between; - flex-grow: 1; - padding: 8px 0; -} -.edit-post-block-manager__checklist-item .block-editor-block-icon { - margin-right: 10px; - fill: #1e1e1e; -} - -.edit-post-block-manager__results { - border-top: 1px solid #ddd; -} - -.edit-post-block-manager__disabled-blocks-count + .edit-post-block-manager__results { - border-top-width: 0; -} - -.edit-post-meta-boxes-area { - position: relative; - /** - * The wordpress default for most meta-box elements is content-box. Some - * elements such as textarea and input are set to border-box in forms.css. - * These elements therefore specifically set back to border-box here, while - * other elements (such as .button) are unaffected by Gutenberg's style - * because of their higher specificity. - */ - /* Match width and positioning of the meta boxes. Override default styles. */ - /* Override Default meta box stylings */ -} -.edit-post-meta-boxes-area__container, -.edit-post-meta-boxes-area .inside { - box-sizing: content-box; -} -.edit-post-meta-boxes-area textarea, -.edit-post-meta-boxes-area input { - box-sizing: border-box; -} -.edit-post-meta-boxes-area .postbox-header { - border-top: 1px solid #ddd; - border-bottom: 0; -} -.edit-post-meta-boxes-area #poststuff { - margin: 0 auto; - padding-top: 0; - min-width: auto; -} -.edit-post-meta-boxes-area #poststuff h3.hndle, -.edit-post-meta-boxes-area #poststuff .stuffbox > h3, -.edit-post-meta-boxes-area #poststuff h2.hndle { - /* WordPress selectors yolo */ - box-sizing: border-box; - color: inherit; - font-weight: 600; - outline: none; - padding: 0 24px; - position: relative; - width: 100%; -} -.edit-post-meta-boxes-area .postbox { - border: 0; - color: inherit; - margin-bottom: 0; -} -.edit-post-meta-boxes-area .postbox > .inside { - color: inherit; - padding: 0 24px 24px; - margin: 0; -} -.edit-post-meta-boxes-area .postbox .handlediv { - height: 44px; - width: 44px; -} -.edit-post-meta-boxes-area.is-loading::before { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - content: ""; - background: transparent; - z-index: 1; -} -.edit-post-meta-boxes-area .components-spinner { - position: absolute; - top: 10px; - right: 20px; - z-index: 5; -} -.edit-post-meta-boxes-area .is-hidden { - display: none; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox] { - border: 1px solid #757575; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]:checked { - background: #fff; - border-color: #757575; -} -.edit-post-meta-boxes-area .metabox-location-side .postbox input[type=checkbox]::before { - margin: -3px -4px; -} - -.edit-post-meta-boxes-area__clear { - clear: both; -} - -.edit-post-editor__inserter-panel, -.edit-post-editor__list-view-panel { - height: 100%; - display: flex; - flex-direction: column; -} - -.edit-post-editor__list-view-panel { - min-width: 350px; -} - -.edit-post-editor__inserter-panel-header { - padding-top: 8px; - padding-right: 8px; - display: flex; - justify-content: flex-end; -} - -.edit-post-editor__inserter-panel-content, -.edit-post-editor__list-view-panel-content { - height: calc(100% - 36px - 8px); -} - -@media (min-width: 782px) { - .edit-post-editor__inserter-panel-content { - height: 100%; - } -} - -.edit-post-editor__list-view-panel-header { - align-items: center; - border-bottom: 1px solid #ddd; - display: flex; - justify-content: space-between; - height: 48px; - padding-left: 16px; - padding-right: 4px; -} - -.edit-post-editor__list-view-panel-content { - overflow-y: auto; - padding: 8px 6px; -} - -.components-panel__header.edit-post-sidebar__panel-tabs { - justify-content: flex-start; - padding-left: 0; - padding-right: 16px; - border-top: 0; - margin-top: 0; -} -.components-panel__header.edit-post-sidebar__panel-tabs ul { - display: flex; -} -.components-panel__header.edit-post-sidebar__panel-tabs li { - margin: 0; -} -.components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon { - display: none; - margin: 0 0 0 auto; - padding: 0; - min-width: 24px; - height: 24px; -} -@media (min-width: 782px) { - .components-panel__header.edit-post-sidebar__panel-tabs .components-button.has-icon { - display: flex; - } -} - -.components-panel__body.is-opened.edit-post-last-revision__panel { - padding: 0; - height: 48px; -} - -.editor-post-last-revision__title.components-button { - padding: 16px; -} - -.editor-post-author__select { - margin: -5px 0; - width: 100%; -} -@supports (position: sticky) { - .editor-post-author__select { - width: auto; - } -} - -.edit-post-post-link__link-post-name { - font-weight: 600; -} - -.edit-post-post-link__preview-label { - font-weight: 400; - margin: 0; -} - -.edit-post-post-link__link { - text-align: left; - word-wrap: break-word; - display: block; -} - -/* rtl:begin:ignore */ -.edit-post-post-link__preview-link-container { - direction: ltr; -} - -/* rtl:end:ignore */ -.edit-post-post-schedule { - width: 100%; - position: relative; - justify-content: left; -} -.edit-post-post-schedule span { - display: block; - width: 45%; -} - -.components-button.edit-post-post-schedule__toggle { - text-align: right; -} - -.edit-post-post-schedule__dialog .components-popover__content > div { - padding: 0; -} - -.editor-post-slug__input { - margin: -5px 0; - padding: 2px; -} - -.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft { - margin-top: 15px; - width: 100%; - text-align: center; -} - -.edit-post-post-visibility { - width: 100%; - justify-content: left; -} -.edit-post-post-visibility span { - display: block; - width: 45%; -} - -@media (min-width: 782px) { - .edit-post-post-visibility__dialog .components-popover__content { - width: 257px; - } -} - -.edit-post-post-visibility__dialog-legend { - font-weight: 600; -} - -.edit-post-post-visibility__choice { - margin: 10px 0; -} - -.edit-post-post-visibility__dialog-radio, -.edit-post-post-visibility__dialog-label { - vertical-align: top; -} - -.edit-post-post-visibility__dialog-password-input { - width: calc(100% - 20px); - margin-left: 20px; -} - -.edit-post-post-visibility__dialog-info { - color: #757575; - padding-left: 20px; - font-style: italic; - margin: 4px 0 0; - line-height: 1.4; -} - -.components-button.edit-post-sidebar__panel-tab { - border-radius: 0; - height: 48px; - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - display: inline-block; - padding: 3px 15px; - margin-left: 0; - font-weight: 500; -} -.components-button.edit-post-sidebar__panel-tab::after { - content: attr(data-label); - display: block; - font-weight: 600; - height: 0; - overflow: hidden; - speak: none; - visibility: hidden; -} -.components-button.edit-post-sidebar__panel-tab.is-active { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 -4px 0 0 var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-post-sidebar__panel-tab.is-active::before { - content: ""; - position: absolute; - top: 0; - bottom: 1px; - right: 0; - left: 0; - border-bottom: 4px solid transparent; -} -.components-button.edit-post-sidebar__panel-tab:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; - z-index: 1; -} -.components-button.edit-post-sidebar__panel-tab.is-active:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color); -} - -@media (min-width: 782px) { - .edit-post-template__modal .components-base-control { - width: 320px; - } -} -.edit-post-template__modal .components-modal__header { - border-bottom: none; -} -.edit-post-template__modal .components-modal__content::before { - margin-bottom: 4px; -} - -.edit-post-template__modal-actions { - margin-top: 12px; -} - -.edit-post-template-modal__tip { - padding: 16px 24px; - background: #f0f0f0; - border-radius: 2px; -} -@media (min-width: 782px) { - .edit-post-template-modal__tip { - width: 240px; - } -} - -.edit-post-template__notice { - margin: 0 0 8px 0; -} -.edit-post-template__notice .components-notice__content { - margin: 0; -} - -.edit-post-template__actions button:not(:last-child) { - margin-right: 8px; -} - -h2.edit-post-template-summary__title { - line-height: 24px; - margin: 0 0 4px; - font-weight: 500; -} - -.edit-post-text-editor { - position: relative; - width: 100%; - background-color: #fff; - flex-grow: 1; -} -.edit-post-text-editor .editor-post-title { - max-width: none; - line-height: 1.4; - font-family: Menlo, Consolas, monaco, monospace; - font-size: 2.5em; - font-weight: normal; - border: 1px solid #949494; - padding: 16px; -} -@media (min-width: 600px) { - .edit-post-text-editor .editor-post-title { - padding: 24px; - } -} -.edit-post-text-editor .editor-post-title:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); -} - -.edit-post-text-editor__body { - width: 100%; - padding: 0 12px 12px 12px; - max-width: 1080px; - margin-left: auto; - margin-right: auto; -} -@media (min-width: 960px) { - .edit-post-text-editor__body { - padding: 16px 24px 96px 24px; - padding: 0 24px 24px 24px; - } -} - -.edit-post-text-editor__toolbar { - position: sticky; - z-index: 1; - top: 0; - left: 0; - right: 0; - display: flex; - background: rgba(255, 255, 255, 0.8); - padding: 4px 12px; -} -@media (min-width: 600px) { - .edit-post-text-editor__toolbar { - padding: 12px; - } -} -@media (min-width: 960px) { - .edit-post-text-editor__toolbar { - padding: 12px 24px; - } -} -.edit-post-text-editor__toolbar h2 { - line-height: 36px; - margin: 0 auto 0 0; - font-size: 13px; - color: #1e1e1e; -} -.edit-post-text-editor__toolbar .components-button svg { - order: 1; -} - -.edit-post-visual-editor { - position: relative; - display: flex; - flex-flow: column; - background-color: #2f2f2f; - flex: 1 0 auto; -} -.edit-post-visual-editor .components-button { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; - padding: 6px 12px; -} -.edit-post-visual-editor .components-button.is-tertiary, .edit-post-visual-editor .components-button.has-icon { - padding: 6px; -} - -.edit-post-visual-editor__post-title-wrapper { - margin-top: 4rem; - margin-bottom: var(--wp--style--block-gap); -} -.edit-post-visual-editor__post-title-wrapper .editor-post-title { - margin-left: auto; - margin-right: auto; -} - -.edit-post-visual-editor__exit-template-mode { - position: absolute; - top: 8px; - left: 8px; - color: #fff; -} -.edit-post-visual-editor__exit-template-mode:active:not([aria-disabled=true]), .edit-post-visual-editor__exit-template-mode:focus:not([aria-disabled=true]), .edit-post-visual-editor__exit-template-mode:hover { - color: #f0f0f0; -} - -.edit-post-visual-editor__content-area { - width: 100%; - height: 100%; - position: relative; - box-sizing: border-box; - display: flex; - flex-grow: 1; -} - -.edit-post-welcome-guide, -.edit-template-welcome-guide { - width: 312px; -} -.edit-post-welcome-guide__image, -.edit-template-welcome-guide__image { - background: #00a0d2; - margin: 0 0 16px; -} -.edit-post-welcome-guide__image > img, -.edit-template-welcome-guide__image > img { - display: block; - max-width: 100%; - -o-object-fit: cover; - object-fit: cover; -} -.edit-post-welcome-guide__heading, -.edit-template-welcome-guide__heading { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 24px; - line-height: 1.4; - margin: 16px 0 16px 0; - padding: 0 32px; -} -.edit-post-welcome-guide__text, -.edit-template-welcome-guide__text { - font-size: 13px; - line-height: 1.4; - margin: 0 0 24px 0; - padding: 0 32px; -} -.edit-post-welcome-guide__inserter-icon, -.edit-template-welcome-guide__inserter-icon { - margin: 0 4px; - vertical-align: text-top; -} - -.edit-template-welcome-guide .components-button svg { - fill: #fff; -} - -@media (min-width: 600px) { - .edit-post-start-page-options__modal { - width: calc(100% - 32px); - height: calc(100% - 120px); - } -} -@media (min-width: 782px) { - .edit-post-start-page-options__modal { - width: 750px; - } -} -@media (min-width: 960px) { - .edit-post-start-page-options__modal { - height: 70%; - } -} -.edit-post-start-page-options__modal .components-modal__header { - border-bottom: none; -} -.edit-post-start-page-options__modal .components-modal__content::before { - content: none; -} - -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list { - column-count: 2; - column-gap: 24px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item { - break-inside: avoid-column; - margin-bottom: 24px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container { - min-height: 100px; -} -.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content { - width: 100%; -} - -/** - * Animations - */ -@keyframes edit-post__fade-in-animation { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -html.wp-toolbar { - background: #fff; -} - -body.block-editor-page { - background: #fff; - /* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well. - Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */ -} -body.block-editor-page #wpcontent { - padding-left: 0; -} -body.block-editor-page #wpbody-content { - padding-bottom: 0; -} -body.block-editor-page #wpbody-content > div:not(.block-editor):not(#screen-meta) { - display: none; -} -body.block-editor-page #wpfooter { - display: none; -} -body.block-editor-page .a11y-speak-region { - left: -1px; - top: -1px; -} -body.block-editor-page ul#adminmenu a.wp-has-current-submenu::after, -body.block-editor-page ul#adminmenu > li.current > a.current::after { - border-right-color: #fff; -} -body.block-editor-page .media-frame select.attachment-filters:last-of-type { - width: auto; - max-width: 100%; -} - -.block-editor-page #wpwrap { - overflow-y: auto; -} -@media (min-width: 782px) { - .block-editor-page #wpwrap { - overflow-y: initial; - } -} - -.edit-post-header, -.edit-post-text-editor, -.edit-post-sidebar, -.editor-post-publish-panel, -.components-popover, -.components-modal__frame, -.edit-post-editor__inserter-panel { - box-sizing: border-box; -} -.edit-post-header *, -.edit-post-header *::before, -.edit-post-header *::after, -.edit-post-text-editor *, -.edit-post-text-editor *::before, -.edit-post-text-editor *::after, -.edit-post-sidebar *, -.edit-post-sidebar *::before, -.edit-post-sidebar *::after, -.editor-post-publish-panel *, -.editor-post-publish-panel *::before, -.editor-post-publish-panel *::after, -.components-popover *, -.components-popover *::before, -.components-popover *::after, -.components-modal__frame *, -.components-modal__frame *::before, -.components-modal__frame *::after, -.edit-post-editor__inserter-panel *, -.edit-post-editor__inserter-panel *::before, -.edit-post-editor__inserter-panel *::after { - box-sizing: inherit; -} - -@media (min-width: 600px) { - .block-editor__container { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - min-height: calc(100vh - 46px); - } -} -@media (min-width: 782px) { - .block-editor__container { - min-height: calc(100vh - 32px); - } - body.is-fullscreen-mode .block-editor__container { - min-height: 100vh; - } -} -.block-editor__container img { - max-width: 100%; - height: auto; -} - -body.admin-color-light { - --wp-admin-theme-color: #0085ba; - --wp-admin-theme-color--rgb: 0, 133, 186; - --wp-admin-theme-color-darker-10: #0073a1; - --wp-admin-theme-color-darker-10--rgb: 0, 115, 161; - --wp-admin-theme-color-darker-20: #006187; - --wp-admin-theme-color-darker-20--rgb: 0, 97, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-light { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-modern { - --wp-admin-theme-color: #3858e9; - --wp-admin-theme-color--rgb: 56, 88, 233; - --wp-admin-theme-color-darker-10: #2145e6; - --wp-admin-theme-color-darker-10--rgb: 33, 69, 230; - --wp-admin-theme-color-darker-20: #183ad6; - --wp-admin-theme-color-darker-20--rgb: 24, 58, 214; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-modern { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-blue { - --wp-admin-theme-color: #096484; - --wp-admin-theme-color--rgb: 9, 100, 132; - --wp-admin-theme-color-darker-10: #07526c; - --wp-admin-theme-color-darker-10--rgb: 7, 82, 108; - --wp-admin-theme-color-darker-20: #064054; - --wp-admin-theme-color-darker-20--rgb: 6, 64, 84; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-blue { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-coffee { - --wp-admin-theme-color: #46403c; - --wp-admin-theme-color--rgb: 70, 64, 60; - --wp-admin-theme-color-darker-10: #383330; - --wp-admin-theme-color-darker-10--rgb: 56, 51, 48; - --wp-admin-theme-color-darker-20: #2b2724; - --wp-admin-theme-color-darker-20--rgb: 43, 39, 36; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-coffee { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ectoplasm { - --wp-admin-theme-color: #523f6d; - --wp-admin-theme-color--rgb: 82, 63, 109; - --wp-admin-theme-color-darker-10: #46365d; - --wp-admin-theme-color-darker-10--rgb: 70, 54, 93; - --wp-admin-theme-color-darker-20: #3a2c4d; - --wp-admin-theme-color-darker-20--rgb: 58, 44, 77; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ectoplasm { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-midnight { - --wp-admin-theme-color: #e14d43; - --wp-admin-theme-color--rgb: 225, 77, 67; - --wp-admin-theme-color-darker-10: #dd382d; - --wp-admin-theme-color-darker-10--rgb: 221, 56, 45; - --wp-admin-theme-color-darker-20: #d02c21; - --wp-admin-theme-color-darker-20--rgb: 208, 44, 33; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-midnight { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-ocean { - --wp-admin-theme-color: #627c83; - --wp-admin-theme-color--rgb: 98, 124, 131; - --wp-admin-theme-color-darker-10: #576e74; - --wp-admin-theme-color-darker-10--rgb: 87, 110, 116; - --wp-admin-theme-color-darker-20: #4c6066; - --wp-admin-theme-color-darker-20--rgb: 76, 96, 102; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-ocean { - --wp-admin-border-width-focus: 1.5px; - } -} - -body.admin-color-sunrise { - --wp-admin-theme-color: #dd823b; - --wp-admin-theme-color--rgb: 221, 130, 59; - --wp-admin-theme-color-darker-10: #d97426; - --wp-admin-theme-color-darker-10--rgb: 217, 116, 38; - --wp-admin-theme-color-darker-20: #c36922; - --wp-admin-theme-color-darker-20--rgb: 195, 105, 34; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - body.admin-color-sunrise { - --wp-admin-border-width-focus: 1.5px; - } -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.editor-styles-wrapper .wp-block{margin-left:auto;margin-right:auto}html :where(.editor-styles-wrapper){padding:8px}html :where(.editor-styles-wrapper) .block-editor-block-list__layout.is-root-container>.wp-block[data-align=full]{margin-left:-8px;margin-right:-8px}html :where(.wp-block){max-width:840px;margin-top:28px;margin-bottom:28px}html :where(.wp-block)[data-align=wide]{max-width:1100px}html :where(.wp-block)[data-align=full]{max-width:none}html :where(.wp-block)[data-align=left],html :where(.wp-block)[data-align=right]{width:100%;height:0}html :where(.wp-block)[data-align=left]:before,html :where(.wp-block)[data-align=right]:before{content:none}html :where(.wp-block)[data-align=left]>*{ - /*!rtl:begin:ignore*/float:left;margin-right:2em - /*!rtl:end:ignore*/}html :where(.wp-block)[data-align=right]>*{ - /*!rtl:begin:ignore*/float:right;margin-left:2em - /*!rtl:end:ignore*/}html :where(.wp-block)[data-align=full],html :where(.wp-block)[data-align=wide]{clear:both}.wp-block-group>[data-align=full]{margin-left:auto;margin-right:auto}.wp-block-group.has-background>[data-align=full]{margin-left:-30px;width:calc(100% + 60px)}[data-align=full] .wp-block-group>.wp-block{padding-left:14px;padding-right:14px}@media (min-width:600px){[data-align=full] .wp-block-group>.wp-block{padding-left:0;padding-right:0}}[data-align=full] .wp-block-group>[data-align=full]{padding-right:0;padding-left:0;left:0;width:100%;max-width:none}[data-align=full] .wp-block-group.has-background>[data-align=full]{width:calc(100% + 60px)}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.editor-styles-wrapper .wp-block { - margin-right: auto; - margin-left: auto; -} - -html :where(.editor-styles-wrapper) { - padding: 8px; -} -html :where(.editor-styles-wrapper) .block-editor-block-list__layout.is-root-container > .wp-block[data-align=full] { - margin-right: -8px; - margin-left: -8px; -} - -html :where(.wp-block) { - max-width: 840px; - margin-top: 28px; - margin-bottom: 28px; -} -html :where(.wp-block)[data-align=wide] { - max-width: 1100px; -} -html :where(.wp-block)[data-align=full] { - max-width: none; -} -html :where(.wp-block)[data-align=left], html :where(.wp-block)[data-align=right] { - width: 100%; - height: 0; -} -html :where(.wp-block)[data-align=left]::before, html :where(.wp-block)[data-align=right]::before { - content: none; -} -html :where(.wp-block)[data-align=left] > * { - float: left; - margin-right: 2em; -} -html :where(.wp-block)[data-align=right] > * { - float: right; - margin-left: 2em; -} -html :where(.wp-block)[data-align=full], html :where(.wp-block)[data-align=wide] { - clear: both; -} - -.wp-block-group > [data-align=full] { - margin-right: auto; - margin-left: auto; -} - -.wp-block-group.has-background > [data-align=full] { - margin-right: -30px; - width: calc(100% + 60px); -} - -/** -* Group: Full Width Alignment -*/ -[data-align=full] .wp-block-group > .wp-block { - padding-right: 14px; - padding-left: 14px; -} -@media (min-width: 600px) { - [data-align=full] .wp-block-group > .wp-block { - padding-right: 0; - padding-left: 0; - } -} -[data-align=full] .wp-block-group > [data-align=full] { - padding-left: 0; - padding-right: 0; - right: 0; - width: 100%; - max-width: none; -} -[data-align=full] .wp-block-group.has-background > [data-align=full] { - width: calc(100% + 60px); -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.reusable-blocks-menu-items__convert-modal{z-index:1000001}.reusable-blocks-menu-items__convert-modal-actions{padding-top:12px}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.reusable-blocks-menu-items__convert-modal{z-index:1000001}.reusable-blocks-menu-items__convert-modal-actions{padding-top:12px}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.reusable-blocks-menu-items__convert-modal { - z-index: 1000001; -} - -.reusable-blocks-menu-items__convert-modal-actions { - padding-top: 12px; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.reusable-blocks-menu-items__convert-modal { - z-index: 1000001; -} - -.reusable-blocks-menu-items__convert-modal-actions { - padding-top: 12px; -}@charset "UTF-8";:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.editor-autocompleters__user .editor-autocompleters__no-avatar:before{font:normal 20px/1 dashicons;content:"";margin-left:5px;vertical-align:middle}.editor-autocompleters__user .editor-autocompleters__user-avatar{margin-left:8px;flex-grow:0;flex-shrink:0;max-width:none;width:24px;height:24px}.editor-autocompleters__user .editor-autocompleters__user-name{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:200px;flex-shrink:0;flex-grow:1}.editor-autocompleters__user .editor-autocompleters__user-slug{margin-right:8px;color:#757575;white-space:nowrap;text-overflow:ellipsis;overflow:none;max-width:100px;flex-grow:0;flex-shrink:0}.editor-autocompleters__user:hover .editor-autocompleters__user-slug{color:var(--wp-admin-theme-color)}.document-outline{margin:20px 0}.document-outline ul{margin:0;padding:0}.document-outline__item{display:flex;margin:4px 0}.document-outline__item a{text-decoration:none}.document-outline__item .document-outline__emdash:before{color:#ddd;margin-left:4px}.document-outline__item.is-h2 .document-outline__emdash:before{content:"—"}.document-outline__item.is-h3 .document-outline__emdash:before{content:"——"}.document-outline__item.is-h4 .document-outline__emdash:before{content:"———"}.document-outline__item.is-h5 .document-outline__emdash:before{content:"————"}.document-outline__item.is-h6 .document-outline__emdash:before{content:"—————"}.document-outline__button{cursor:pointer;background:none;border:none;display:flex;align-items:flex-start;margin:0 -1px 0 0;padding:2px 1px 2px 5px;color:#1e1e1e;text-align:right;border-radius:2px}.document-outline__button:disabled{cursor:default}.document-outline__button:focus{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.document-outline__level{background:#ddd;color:#1e1e1e;border-radius:3px;font-size:13px;padding:1px 6px;margin-left:4px}.is-invalid .document-outline__level{background:#f0b849}.document-outline__item-content{padding:1px 0}.components-editor-notices__dismissible,.components-editor-notices__pinned{position:relative;right:0;top:0;left:0;color:#1e1e1e}.components-editor-notices__dismissible .components-notice,.components-editor-notices__pinned .components-notice{box-sizing:border-box;margin:0;border-bottom:1px solid rgba(0,0,0,.2);padding:0 12px;min-height:60px}.components-editor-notices__dismissible .components-notice .components-notice__dismiss,.components-editor-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}.entities-saved-states__panel{background:#fff;position:fixed;z-index:100001;top:46px;bottom:0;left:0;right:0;overflow:auto;box-sizing:border-box}.entities-saved-states__panel *,.entities-saved-states__panel :after,.entities-saved-states__panel :before{box-sizing:inherit}.entities-saved-states__panel .entities-saved-states__find-entity{display:none}.entities-saved-states__panel .entities-saved-states__find-entity-small{display:block}@media (min-width:782px){.entities-saved-states__panel{top:32px;right:auto;width:280px;border-right:1px solid #ddd}body.is-fullscreen-mode .entities-saved-states__panel{top:0}.entities-saved-states__panel .entities-saved-states__find-entity{display:block}.entities-saved-states__panel .entities-saved-states__find-entity-small{display:none}}.entities-saved-states__panel .entities-saved-states__panel-header{background:#fff;padding-right:8px;padding-left:8px;height:61px;border-bottom:1px solid #ddd}.entities-saved-states__panel .entities-saved-states__text-prompt{padding:16px 16px 4px}.editor-error-boundary{max-width:780px;padding:20px;margin:60px auto auto;box-shadow:0 10px 10px rgba(0,0,0,.25)}.editor-page-attributes__order{width:100%}.editor-page-attributes__order .components-base-control__field{display:flex;justify-content:space-between;align-items:center}.editor-page-attributes__order input{width:66px}.editor-post-excerpt__textarea{width:100%;margin-bottom:10px}.editor-post-featured-image{padding:0}.editor-post-featured-image__container{margin-bottom:1em;position:relative}.editor-post-featured-image .components-spinner{position:absolute;top:50%;right:50%;margin-top:-9px;margin-right:-9px}.editor-post-featured-image .components-button+.components-button{display:block;margin-top:1em}.editor-post-featured-image .components-responsive-wrapper__content{max-width:100%;width:auto}.editor-post-featured-image__preview,.editor-post-featured-image__toggle{display:block;width:100%;padding:0;transition:all .1s ease-out;box-shadow:0 0 0 0 var(--wp-admin-theme-color)}@media (prefers-reduced-motion:reduce){.editor-post-featured-image__preview,.editor-post-featured-image__toggle{transition-duration:0s;transition-delay:0s}}.editor-post-featured-image__preview{height:auto}.editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus{box-shadow:0 0 0 4px var(--wp-admin-theme-color)}.editor-post-featured-image__toggle{border-radius:2px;background-color:#f0f0f0;min-height:90px;line-height:20px;padding:8px 0;text-align:center}.editor-post-featured-image__toggle:hover{background:#ddd;color:#1e1e1e}.editor-post-format{flex-direction:column;align-items:stretch;width:100%}.editor-post-format__content{display:inline-flex;justify-content:space-between;align-items:center;width:100%}.editor-post-format__suggestion{padding:6px;text-align:left;font-size:13px}.editor-post-last-revision__title{width:100%;font-weight:600}.editor-post-last-revision__title .dashicon{margin-left:5px}.components-button.editor-post-last-revision__title{height:100%}.components-button.editor-post-last-revision__title:active,.components-button.editor-post-last-revision__title:hover{background:#f0f0f0}.components-button.editor-post-last-revision__title:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:0}@media (min-width:600px){.editor-post-locked-modal{max-width:480px}}.editor-post-locked-modal .components-modal__content{display:flex}.editor-post-locked-modal__buttons{margin-top:24px}.editor-post-locked-modal__avatar{border-radius:2px;margin-top:16px;margin-left:24px}.editor-post-publish-button__button.has-changes-dot:before{background:currentcolor;border-radius:4px;content:"";height:8px;margin:auto -3px auto 5px;width:8px}.editor-post-publish-panel{background:#fff}.editor-post-publish-panel__content{min-height:calc(100% - 144px)}.editor-post-publish-panel__content .components-spinner{display:block;margin:100px auto 0}.editor-post-publish-panel__header{background:#fff;padding-right:16px;padding-left:16px;height:61px;border-bottom:1px solid #ddd;display:flex;align-items:center;align-content:space-between}.editor-post-publish-panel__header .components-button{width:100%;justify-content:center}.editor-post-publish-panel__header .has-icon{margin-right:auto;width:auto}.components-site-card{display:flex;align-items:center;margin:16px 0}.components-site-icon{border:none;border-radius:2px;margin-left:12px;height:36px;width:36px}.components-site-name{display:block;font-size:14px}.components-site-home{display:block;color:#757575;font-size:12px}.editor-post-publish-panel__header-cancel-button,.editor-post-publish-panel__header-publish-button{flex-grow:1}@media (min-width:480px){.editor-post-publish-panel__header-cancel-button,.editor-post-publish-panel__header-publish-button{max-width:160px}}.editor-post-publish-panel__header-publish-button{padding-left:4px}.editor-post-publish-panel__header-cancel-button{padding-right:4px}.editor-post-publish-panel__header-published{flex-grow:1}.editor-post-publish-panel__footer{padding:16px}.components-button.editor-post-publish-panel__toggle.is-primary{display:inline-flex;align-items:center}.components-button.editor-post-publish-panel__toggle.is-primary.is-busy .dashicon{display:none}.components-button.editor-post-publish-panel__toggle.is-primary .dashicon{margin-left:-4px}.editor-post-publish-panel__link{font-weight:400;padding-right:4px}.editor-post-publish-panel__prepublish{padding:16px}.editor-post-publish-panel__prepublish strong{color:#1e1e1e}.editor-post-publish-panel__prepublish .components-panel__body{background:#fff;margin-right:-16px;margin-left:-16px}.editor-post-publish-panel__prepublish .editor-post-visibility__dialog-legend{display:none}.post-publish-panel__postpublish .components-panel__body{border-bottom:1px solid #e0e0e0;border-top:none}.post-publish-panel__postpublish-buttons{display:flex;align-content:space-between;flex-wrap:wrap;margin:-5px}.post-publish-panel__postpublish-buttons>*{flex-grow:1;margin:5px}.post-publish-panel__postpublish-buttons .components-button{height:auto;justify-content:center;padding:3px 10px 4px;flex:1;line-height:1.6;text-align:center;white-space:normal}.post-publish-panel__postpublish-buttons .components-clipboard-button{width:100%}.post-publish-panel__postpublish-post-address-container{display:flex;align-items:flex-end;margin-bottom:16px}.post-publish-panel__postpublish-post-address-container .components-base-control__field{margin-bottom:0}.post-publish-panel__postpublish-post-address-container .post-publish-panel__postpublish-post-address{flex:1}.post-publish-panel__postpublish-post-address-container input[readonly]{padding:10px;background:#ddd;overflow:hidden;text-overflow:ellipsis}.post-publish-panel__postpublish-post-address__copy-button-wrap{flex-shrink:0;margin-right:8px}.post-publish-panel__postpublish-post-address__copy-button-wrap .components-button{height:38px}.post-publish-panel__postpublish-header{font-weight:500}.post-publish-panel__postpublish-subheader{margin:0 0 8px}.post-publish-panel__tip{color:#f0b849}@media screen and (max-width:782px){.post-publish-panel__postpublish-post-address__button-wrap .components-button{height:40px}}.editor-post-saved-state{display:flex;align-items:center;width:28px;padding:12px 4px;color:#757575;overflow:hidden;white-space:nowrap}.editor-post-saved-state.is-saved[aria-disabled=true],.editor-post-saved-state.is-saved[aria-disabled=true]:hover,.editor-post-saved-state.is-saving[aria-disabled=true],.editor-post-saved-state.is-saving[aria-disabled=true]:hover{background:transparent;color:#757575}.editor-post-saved-state svg{display:inline-block;flex:0 0 auto;fill:currentColor;margin-left:8px}@media (min-width:600px){.editor-post-saved-state{width:auto;padding:8px 12px;text-indent:inherit}.editor-post-saved-state svg{margin-left:0}}.editor-post-taxonomies__hierarchical-terms-list{max-height:14em;overflow:auto;margin-right:-6px;padding-right:6px;margin-top:-6px;padding-top:6px}.editor-post-taxonomies__hierarchical-terms-choice{margin-bottom:8px}.editor-post-taxonomies__hierarchical-terms-subchoices{margin-top:8px;margin-right:16px}.components-button.editor-post-taxonomies__hierarchical-terms-add,.components-button.editor-post-taxonomies__hierarchical-terms-submit{margin-top:12px}.editor-post-taxonomies__hierarchical-terms-label{display:inline-block;margin-top:12px}.editor-post-taxonomies__hierarchical-terms-input{margin-top:8px}.editor-post-taxonomies__hierarchical-terms-filter{margin-bottom:8px;width:100%}.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label{font-weight:400;margin-bottom:12px}.editor-post-taxonomies__flat-term-most-used-list{margin:0}.editor-post-taxonomies__flat-term-most-used-list li{display:inline-block;margin-left:8px}.editor-post-taxonomies__flat-term-most-used-list .components-button{font-size:12px}.edit-post-text-editor__body textarea.editor-post-text-editor{border:1px solid #949494;border-radius:0;display:block;margin:0;width:100%;box-shadow:none;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;line-height:2.4;min-height:200px;transition:border .1s ease-out,box-shadow .1s linear;padding:16px;font-size:16px!important}@media (prefers-reduced-motion:reduce){.edit-post-text-editor__body textarea.editor-post-text-editor{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-text-editor__body textarea.editor-post-text-editor{padding:24px;font-size:15px!important}}.edit-post-text-editor__body textarea.editor-post-text-editor:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative}.edit-post-text-editor__body textarea.editor-post-text-editor::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-text-editor__body textarea.editor-post-text-editor::-moz-placeholder{color:rgba(30,30,30,.62);opacity:1}.edit-post-text-editor__body textarea.editor-post-text-editor:-ms-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog,.editor-post-visibility__dialog-fieldset{padding:0 4px 4px}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-legend,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-legend{font-weight:600;margin-bottom:1em;margin-top:.5em;padding:0}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;font-size:16px;line-height:normal;border:1px solid #1e1e1e;margin-left:12px;transition:none;border-radius:50%;width:24px;height:24px;margin-top:2px}@media (prefers-reduced-motion:reduce){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{font-size:13px;line-height:normal}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{height:20px;width:20px}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked:before,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked:before{box-sizing:inherit;width:8px;height:8px;transform:translate(-7px,7px);margin:0;background-color:#fff;border:4px solid #fff}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked:before,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked:before{transform:translate(-5px,5px)}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-label,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-label{font-weight:600}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-info,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-info{margin-top:0;margin-right:32px}.edit-post-post-visibility__dialog .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info,.editor-post-visibility__dialog-fieldset .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info{margin-bottom:0}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;margin-right:36px;margin-top:8px}@media (prefers-reduced-motion:reduce){.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{font-size:13px;line-height:normal}}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.editor-post-title{position:relative}.editor-post-title.is-focus-mode{opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.editor-post-title.is-focus-mode{transition-duration:0s;transition-delay:0s}}.editor-post-title.is-focus-mode:focus{opacity:1}.editor-post-trash.components-button{margin-top:4px}.table-of-contents__popover.components-popover .components-popover__content{min-width:380px}.components-popover.table-of-contents__popover{z-index:99998}.table-of-contents__popover .components-popover__content>div{padding:16px}@media (min-width:600px){.table-of-contents__popover .components-popover__content{max-height:calc(100vh - 120px);overflow-y:auto}}.table-of-contents__popover hr{margin:10px -16px 0}.table-of-contents__wrapper:focus:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);pointer-events:none}.table-of-contents__counts{display:flex;flex-wrap:wrap;margin:-8px 0 0}.table-of-contents__count{flex-basis:33%;display:flex;flex-direction:column;font-size:13px;color:#1e1e1e;padding-left:8px;margin-bottom:0;margin-top:8px}.table-of-contents__count:nth-child(4n){padding-left:0}.table-of-contents__number,.table-of-contents__popover .word-count{font-size:21px;font-weight:400;line-height:30px;color:#1e1e1e}.table-of-contents__title{display:block;margin-top:20px;font-size:15px;font-weight:600}.editor-template-validation-notice{display:flex;justify-content:space-between;align-items:center}.editor-template-validation-notice .components-button{margin-right:5px}@charset "UTF-8";:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.editor-autocompleters__user .editor-autocompleters__no-avatar:before{font:normal 20px/1 dashicons;content:"";margin-right:5px;vertical-align:middle}.editor-autocompleters__user .editor-autocompleters__user-avatar{margin-right:8px;flex-grow:0;flex-shrink:0;max-width:none;width:24px;height:24px}.editor-autocompleters__user .editor-autocompleters__user-name{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:200px;flex-shrink:0;flex-grow:1}.editor-autocompleters__user .editor-autocompleters__user-slug{margin-left:8px;color:#757575;white-space:nowrap;text-overflow:ellipsis;overflow:none;max-width:100px;flex-grow:0;flex-shrink:0}.editor-autocompleters__user:hover .editor-autocompleters__user-slug{color:var(--wp-admin-theme-color)}.document-outline{margin:20px 0}.document-outline ul{margin:0;padding:0}.document-outline__item{display:flex;margin:4px 0}.document-outline__item a{text-decoration:none}.document-outline__item .document-outline__emdash:before{color:#ddd;margin-right:4px}.document-outline__item.is-h2 .document-outline__emdash:before{content:"—"}.document-outline__item.is-h3 .document-outline__emdash:before{content:"——"}.document-outline__item.is-h4 .document-outline__emdash:before{content:"———"}.document-outline__item.is-h5 .document-outline__emdash:before{content:"————"}.document-outline__item.is-h6 .document-outline__emdash:before{content:"—————"}.document-outline__button{cursor:pointer;background:none;border:none;display:flex;align-items:flex-start;margin:0 0 0 -1px;padding:2px 5px 2px 1px;color:#1e1e1e;text-align:left;border-radius:2px}.document-outline__button:disabled{cursor:default}.document-outline__button:focus{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}.document-outline__level{background:#ddd;color:#1e1e1e;border-radius:3px;font-size:13px;padding:1px 6px;margin-right:4px}.is-invalid .document-outline__level{background:#f0b849}.document-outline__item-content{padding:1px 0}.components-editor-notices__dismissible,.components-editor-notices__pinned{position:relative;left:0;top:0;right:0;color:#1e1e1e}.components-editor-notices__dismissible .components-notice,.components-editor-notices__pinned .components-notice{box-sizing:border-box;margin:0;border-bottom:1px solid rgba(0,0,0,.2);padding:0 12px;min-height:60px}.components-editor-notices__dismissible .components-notice .components-notice__dismiss,.components-editor-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}.entities-saved-states__panel{background:#fff;position:fixed;z-index:100001;top:46px;bottom:0;right:0;left:0;overflow:auto;box-sizing:border-box}.entities-saved-states__panel *,.entities-saved-states__panel :after,.entities-saved-states__panel :before{box-sizing:inherit}.entities-saved-states__panel .entities-saved-states__find-entity{display:none}.entities-saved-states__panel .entities-saved-states__find-entity-small{display:block}@media (min-width:782px){.entities-saved-states__panel{top:32px;left:auto;width:280px;border-left:1px solid #ddd}body.is-fullscreen-mode .entities-saved-states__panel{top:0}.entities-saved-states__panel .entities-saved-states__find-entity{display:block}.entities-saved-states__panel .entities-saved-states__find-entity-small{display:none}}.entities-saved-states__panel .entities-saved-states__panel-header{background:#fff;padding-left:8px;padding-right:8px;height:61px;border-bottom:1px solid #ddd}.entities-saved-states__panel .entities-saved-states__text-prompt{padding:16px 16px 4px}.editor-error-boundary{max-width:780px;padding:20px;margin:60px auto auto;box-shadow:0 10px 10px rgba(0,0,0,.25)}.editor-page-attributes__order{width:100%}.editor-page-attributes__order .components-base-control__field{display:flex;justify-content:space-between;align-items:center}.editor-page-attributes__order input{width:66px}.editor-post-excerpt__textarea{width:100%;margin-bottom:10px}.editor-post-featured-image{padding:0}.editor-post-featured-image__container{margin-bottom:1em;position:relative}.editor-post-featured-image .components-spinner{position:absolute;top:50%;left:50%;margin-top:-9px;margin-left:-9px}.editor-post-featured-image .components-button+.components-button{display:block;margin-top:1em}.editor-post-featured-image .components-responsive-wrapper__content{max-width:100%;width:auto}.editor-post-featured-image__preview,.editor-post-featured-image__toggle{display:block;width:100%;padding:0;transition:all .1s ease-out;box-shadow:0 0 0 0 var(--wp-admin-theme-color)}@media (prefers-reduced-motion:reduce){.editor-post-featured-image__preview,.editor-post-featured-image__toggle{transition-duration:0s;transition-delay:0s}}.editor-post-featured-image__preview{height:auto}.editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus{box-shadow:0 0 0 4px var(--wp-admin-theme-color)}.editor-post-featured-image__toggle{border-radius:2px;background-color:#f0f0f0;min-height:90px;line-height:20px;padding:8px 0;text-align:center}.editor-post-featured-image__toggle:hover{background:#ddd;color:#1e1e1e}.editor-post-format{flex-direction:column;align-items:stretch;width:100%}.editor-post-format__content{display:inline-flex;justify-content:space-between;align-items:center;width:100%}.editor-post-format__suggestion{padding:6px;text-align:right;font-size:13px}.editor-post-last-revision__title{width:100%;font-weight:600}.editor-post-last-revision__title .dashicon{margin-right:5px}.components-button.editor-post-last-revision__title{height:100%}.components-button.editor-post-last-revision__title:active,.components-button.editor-post-last-revision__title:hover{background:#f0f0f0}.components-button.editor-post-last-revision__title:focus{box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);border-radius:0}@media (min-width:600px){.editor-post-locked-modal{max-width:480px}}.editor-post-locked-modal .components-modal__content{display:flex}.editor-post-locked-modal__buttons{margin-top:24px}.editor-post-locked-modal__avatar{border-radius:2px;margin-top:16px;margin-right:24px}.editor-post-publish-button__button.has-changes-dot:before{background:currentcolor;border-radius:4px;content:"";height:8px;margin:auto 5px auto -3px;width:8px}.editor-post-publish-panel{background:#fff}.editor-post-publish-panel__content{min-height:calc(100% - 144px)}.editor-post-publish-panel__content .components-spinner{display:block;margin:100px auto 0}.editor-post-publish-panel__header{background:#fff;padding-left:16px;padding-right:16px;height:61px;border-bottom:1px solid #ddd;display:flex;align-items:center;align-content:space-between}.editor-post-publish-panel__header .components-button{width:100%;justify-content:center}.editor-post-publish-panel__header .has-icon{margin-left:auto;width:auto}.components-site-card{display:flex;align-items:center;margin:16px 0}.components-site-icon{border:none;border-radius:2px;margin-right:12px;height:36px;width:36px}.components-site-name{display:block;font-size:14px}.components-site-home{display:block;color:#757575;font-size:12px}.editor-post-publish-panel__header-cancel-button,.editor-post-publish-panel__header-publish-button{flex-grow:1}@media (min-width:480px){.editor-post-publish-panel__header-cancel-button,.editor-post-publish-panel__header-publish-button{max-width:160px}}.editor-post-publish-panel__header-publish-button{padding-right:4px}.editor-post-publish-panel__header-cancel-button{padding-left:4px}.editor-post-publish-panel__header-published{flex-grow:1}.editor-post-publish-panel__footer{padding:16px}.components-button.editor-post-publish-panel__toggle.is-primary{display:inline-flex;align-items:center}.components-button.editor-post-publish-panel__toggle.is-primary.is-busy .dashicon{display:none}.components-button.editor-post-publish-panel__toggle.is-primary .dashicon{margin-right:-4px}.editor-post-publish-panel__link{font-weight:400;padding-left:4px}.editor-post-publish-panel__prepublish{padding:16px}.editor-post-publish-panel__prepublish strong{color:#1e1e1e}.editor-post-publish-panel__prepublish .components-panel__body{background:#fff;margin-left:-16px;margin-right:-16px}.editor-post-publish-panel__prepublish .editor-post-visibility__dialog-legend{display:none}.post-publish-panel__postpublish .components-panel__body{border-bottom:1px solid #e0e0e0;border-top:none}.post-publish-panel__postpublish-buttons{display:flex;align-content:space-between;flex-wrap:wrap;margin:-5px}.post-publish-panel__postpublish-buttons>*{flex-grow:1;margin:5px}.post-publish-panel__postpublish-buttons .components-button{height:auto;justify-content:center;padding:3px 10px 4px;flex:1;line-height:1.6;text-align:center;white-space:normal}.post-publish-panel__postpublish-buttons .components-clipboard-button{width:100%}.post-publish-panel__postpublish-post-address-container{display:flex;align-items:flex-end;margin-bottom:16px}.post-publish-panel__postpublish-post-address-container .components-base-control__field{margin-bottom:0}.post-publish-panel__postpublish-post-address-container .post-publish-panel__postpublish-post-address{flex:1}.post-publish-panel__postpublish-post-address-container input[readonly]{padding:10px;background:#ddd;overflow:hidden;text-overflow:ellipsis}.post-publish-panel__postpublish-post-address__copy-button-wrap{flex-shrink:0;margin-left:8px}.post-publish-panel__postpublish-post-address__copy-button-wrap .components-button{height:38px}.post-publish-panel__postpublish-header{font-weight:500}.post-publish-panel__postpublish-subheader{margin:0 0 8px}.post-publish-panel__tip{color:#f0b849}@media screen and (max-width:782px){.post-publish-panel__postpublish-post-address__button-wrap .components-button{height:40px}}.editor-post-saved-state{display:flex;align-items:center;width:28px;padding:12px 4px;color:#757575;overflow:hidden;white-space:nowrap}.editor-post-saved-state.is-saved[aria-disabled=true],.editor-post-saved-state.is-saved[aria-disabled=true]:hover,.editor-post-saved-state.is-saving[aria-disabled=true],.editor-post-saved-state.is-saving[aria-disabled=true]:hover{background:transparent;color:#757575}.editor-post-saved-state svg{display:inline-block;flex:0 0 auto;fill:currentColor;margin-right:8px}@media (min-width:600px){.editor-post-saved-state{width:auto;padding:8px 12px;text-indent:inherit}.editor-post-saved-state svg{margin-right:0}}.editor-post-taxonomies__hierarchical-terms-list{max-height:14em;overflow:auto;margin-left:-6px;padding-left:6px;margin-top:-6px;padding-top:6px}.editor-post-taxonomies__hierarchical-terms-choice{margin-bottom:8px}.editor-post-taxonomies__hierarchical-terms-subchoices{margin-top:8px;margin-left:16px}.components-button.editor-post-taxonomies__hierarchical-terms-add,.components-button.editor-post-taxonomies__hierarchical-terms-submit{margin-top:12px}.editor-post-taxonomies__hierarchical-terms-label{display:inline-block;margin-top:12px}.editor-post-taxonomies__hierarchical-terms-input{margin-top:8px}.editor-post-taxonomies__hierarchical-terms-filter{margin-bottom:8px;width:100%}.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label{font-weight:400;margin-bottom:12px}.editor-post-taxonomies__flat-term-most-used-list{margin:0}.editor-post-taxonomies__flat-term-most-used-list li{display:inline-block;margin-right:8px}.editor-post-taxonomies__flat-term-most-used-list .components-button{font-size:12px}.edit-post-text-editor__body textarea.editor-post-text-editor{border:1px solid #949494;border-radius:0;display:block;margin:0;width:100%;box-shadow:none;resize:none;overflow:hidden;font-family:Menlo,Consolas,monaco,monospace;line-height:2.4;min-height:200px;transition:border .1s ease-out,box-shadow .1s linear;padding:16px;font-size:16px!important}@media (prefers-reduced-motion:reduce){.edit-post-text-editor__body textarea.editor-post-text-editor{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-text-editor__body textarea.editor-post-text-editor{padding:24px;font-size:15px!important}}.edit-post-text-editor__body textarea.editor-post-text-editor:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);position:relative}.edit-post-text-editor__body textarea.editor-post-text-editor::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-text-editor__body textarea.editor-post-text-editor::-moz-placeholder{color:rgba(30,30,30,.62);opacity:1}.edit-post-text-editor__body textarea.editor-post-text-editor:-ms-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog,.editor-post-visibility__dialog-fieldset{padding:0 4px 4px}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-legend,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-legend{font-weight:600;margin-bottom:1em;margin-top:.5em;padding:0}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;font-size:16px;line-height:normal;border:1px solid #1e1e1e;margin-right:12px;transition:none;border-radius:50%;width:24px;height:24px;margin-top:2px}@media (prefers-reduced-motion:reduce){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{font-size:13px;line-height:normal}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder{color:rgba(30,30,30,.62)}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio],.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]{height:20px;width:20px}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked:before,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked:before{box-sizing:inherit;width:8px;height:8px;transform:translate(7px,7px);margin:0;background-color:#fff;border:4px solid #fff}@media (min-width:600px){.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked:before,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked:before{transform:translate(5px,5px)}}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-admin-theme-color);outline:2px solid transparent}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color)}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-label,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-label{font-weight:600}.edit-post-post-visibility__dialog .editor-post-visibility__dialog-info,.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-info{margin-top:0;margin-left:32px}.edit-post-post-visibility__dialog .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info,.editor-post-visibility__dialog-fieldset .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info{margin-bottom:0}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;padding:6px 8px;box-shadow:0 0 0 transparent;transition:box-shadow .1s linear;border-radius:2px;border:1px solid #757575;font-size:16px;line-height:normal;margin-left:36px;margin-top:8px}@media (prefers-reduced-motion:reduce){.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{transition-duration:0s;transition-delay:0s}}@media (min-width:600px){.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]{font-size:13px;line-height:normal}}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:focus{border-color:var(--wp-admin-theme-color);box-shadow:0 0 0 1px var(--wp-admin-theme-color);outline:2px solid transparent}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-webkit-input-placeholder{color:rgba(30,30,30,.62)}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-moz-placeholder{opacity:1;color:rgba(30,30,30,.62)}.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:-ms-input-placeholder{color:rgba(30,30,30,.62)}.editor-post-title{position:relative}.editor-post-title.is-focus-mode{opacity:.5;transition:opacity .1s linear}@media (prefers-reduced-motion:reduce){.editor-post-title.is-focus-mode{transition-duration:0s;transition-delay:0s}}.editor-post-title.is-focus-mode:focus{opacity:1}.editor-post-trash.components-button{margin-top:4px}.table-of-contents__popover.components-popover .components-popover__content{min-width:380px}.components-popover.table-of-contents__popover{z-index:99998}.table-of-contents__popover .components-popover__content>div{padding:16px}@media (min-width:600px){.table-of-contents__popover .components-popover__content{max-height:calc(100vh - 120px);overflow-y:auto}}.table-of-contents__popover hr{margin:10px -16px 0}.table-of-contents__wrapper:focus:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);pointer-events:none}.table-of-contents__counts{display:flex;flex-wrap:wrap;margin:-8px 0 0}.table-of-contents__count{flex-basis:33%;display:flex;flex-direction:column;font-size:13px;color:#1e1e1e;padding-right:8px;margin-bottom:0;margin-top:8px}.table-of-contents__count:nth-child(4n){padding-right:0}.table-of-contents__number,.table-of-contents__popover .word-count{font-size:21px;font-weight:400;line-height:30px;color:#1e1e1e}.table-of-contents__title{display:block;margin-top:20px;font-size:15px;font-weight:600}.editor-template-validation-notice{display:flex;justify-content:space-between;align-items:center}.editor-template-validation-notice .components-button{margin-left:5px}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.editor-autocompleters__user .editor-autocompleters__no-avatar::before { - /* stylelint-disable */ - font: normal 20px/1 dashicons; - /* stylelint-enable */ - content: ""; - margin-left: 5px; - vertical-align: middle; -} -.editor-autocompleters__user .editor-autocompleters__user-avatar { - margin-left: 8px; - flex-grow: 0; - flex-shrink: 0; - max-width: none; - width: 24px; - height: 24px; -} -.editor-autocompleters__user .editor-autocompleters__user-name { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - max-width: 200px; - flex-shrink: 0; - flex-grow: 1; -} -.editor-autocompleters__user .editor-autocompleters__user-slug { - margin-right: 8px; - color: #757575; - white-space: nowrap; - text-overflow: ellipsis; - overflow: none; - max-width: 100px; - flex-grow: 0; - flex-shrink: 0; -} -.editor-autocompleters__user:hover .editor-autocompleters__user-slug { - color: var(--wp-admin-theme-color); -} - -.document-outline { - margin: 20px 0; -} -.document-outline ul { - margin: 0; - padding: 0; -} - -.document-outline__item { - display: flex; - margin: 4px 0; -} -.document-outline__item a { - text-decoration: none; -} -.document-outline__item .document-outline__emdash::before { - color: #ddd; - margin-left: 4px; -} -.document-outline__item.is-h2 .document-outline__emdash::before { - content: "—"; -} -.document-outline__item.is-h3 .document-outline__emdash::before { - content: "——"; -} -.document-outline__item.is-h4 .document-outline__emdash::before { - content: "———"; -} -.document-outline__item.is-h5 .document-outline__emdash::before { - content: "————"; -} -.document-outline__item.is-h6 .document-outline__emdash::before { - content: "—————"; -} - -.document-outline__button { - cursor: pointer; - background: none; - border: none; - display: flex; - align-items: flex-start; - margin: 0 -1px 0 0; - padding: 2px 1px 2px 5px; - color: #1e1e1e; - text-align: right; - border-radius: 2px; -} -.document-outline__button:disabled { - cursor: default; -} -.document-outline__button:focus { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.document-outline__level { - background: #ddd; - color: #1e1e1e; - border-radius: 3px; - font-size: 13px; - padding: 1px 6px; - margin-left: 4px; -} -.is-invalid .document-outline__level { - background: #f0b849; -} - -.document-outline__item-content { - padding: 1px 0; -} - -.components-editor-notices__dismissible, -.components-editor-notices__pinned { - position: relative; - right: 0; - top: 0; - left: 0; - color: #1e1e1e; -} -.components-editor-notices__dismissible .components-notice, -.components-editor-notices__pinned .components-notice { - box-sizing: border-box; - margin: 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - padding: 0 12px; - min-height: 60px; -} -.components-editor-notices__dismissible .components-notice .components-notice__dismiss, -.components-editor-notices__pinned .components-notice .components-notice__dismiss { - margin-top: 12px; -} - -.entities-saved-states__panel { - box-sizing: border-box; - background: #fff; - position: fixed; - z-index: 100001; - top: 46px; - bottom: 0; - left: 0; - right: 0; - overflow: auto; - box-sizing: border-box; -} -.entities-saved-states__panel *, -.entities-saved-states__panel *::before, -.entities-saved-states__panel *::after { - box-sizing: inherit; -} -.entities-saved-states__panel .entities-saved-states__find-entity { - display: none; -} -.entities-saved-states__panel .entities-saved-states__find-entity-small { - display: block; -} -@media (min-width: 782px) { - .entities-saved-states__panel { - top: 32px; - right: auto; - width: 280px; - border-right: 1px solid #ddd; - } - body.is-fullscreen-mode .entities-saved-states__panel { - top: 0; - } - .entities-saved-states__panel .entities-saved-states__find-entity { - display: block; - } - .entities-saved-states__panel .entities-saved-states__find-entity-small { - display: none; - } -} -.entities-saved-states__panel .entities-saved-states__panel-header { - background: #fff; - padding-right: 8px; - padding-left: 8px; - height: 61px; - border-bottom: 1px solid #ddd; -} -.entities-saved-states__panel .entities-saved-states__text-prompt { - padding: 16px; - padding-bottom: 4px; -} - -.editor-error-boundary { - margin: auto; - max-width: 780px; - padding: 20px; - margin-top: 60px; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); -} - -.editor-page-attributes__order { - width: 100%; -} -.editor-page-attributes__order .components-base-control__field { - display: flex; - justify-content: space-between; - align-items: center; -} -.editor-page-attributes__order input { - width: 66px; -} - -.editor-post-excerpt__textarea { - width: 100%; - margin-bottom: 10px; -} - -.editor-post-featured-image { - padding: 0; -} -.editor-post-featured-image__container { - margin-bottom: 1em; - position: relative; -} -.editor-post-featured-image .components-spinner { - position: absolute; - top: 50%; - right: 50%; - margin-top: -9px; - margin-right: -9px; -} -.editor-post-featured-image .components-button + .components-button { - display: block; - margin-top: 1em; -} -.editor-post-featured-image .components-responsive-wrapper__content { - max-width: 100%; - width: auto; -} - -.editor-post-featured-image__toggle, -.editor-post-featured-image__preview { - display: block; - width: 100%; - padding: 0; - transition: all 0.1s ease-out; - box-shadow: 0 0 0 0 var(--wp-admin-theme-color); -} -@media (prefers-reduced-motion: reduce) { - .editor-post-featured-image__toggle, -.editor-post-featured-image__preview { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.editor-post-featured-image__preview { - height: auto; -} - -.editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus { - box-shadow: 0 0 0 4px var(--wp-admin-theme-color); -} - -.editor-post-featured-image__toggle { - border-radius: 2px; - background-color: #f0f0f0; - min-height: 90px; - line-height: 20px; - padding: 8px 0; - text-align: center; -} -.editor-post-featured-image__toggle:hover { - background: #ddd; - color: #1e1e1e; -} - -.editor-post-format { - flex-direction: column; - align-items: stretch; - width: 100%; -} - -.editor-post-format__content { - display: inline-flex; - justify-content: space-between; - align-items: center; - width: 100%; -} - -.editor-post-format__suggestion { - padding: 6px; - text-align: left; - font-size: 13px; -} - -.editor-post-last-revision__title { - width: 100%; - font-weight: 600; -} -.editor-post-last-revision__title .dashicon { - margin-left: 5px; -} - -.components-button.editor-post-last-revision__title { - height: 100%; -} -.components-button.editor-post-last-revision__title:hover, .components-button.editor-post-last-revision__title:active { - background: #f0f0f0; -} -.components-button.editor-post-last-revision__title:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 0; -} - -@media (min-width: 600px) { - .editor-post-locked-modal { - max-width: 480px; - } -} -.editor-post-locked-modal .components-modal__content { - display: flex; -} - -.editor-post-locked-modal__buttons { - margin-top: 24px; -} - -.editor-post-locked-modal__avatar { - border-radius: 2px; - margin-top: 16px; - margin-left: 24px; -} - -.editor-post-publish-button__button.has-changes-dot::before { - background: currentcolor; - border-radius: 4px; - content: ""; - height: 8px; - margin: auto -3px auto 5px; - width: 8px; -} - -.editor-post-publish-panel { - background: #fff; -} - -.editor-post-publish-panel__content { - min-height: calc(100% - 144px); -} -.editor-post-publish-panel__content .components-spinner { - display: block; - margin: 100px auto 0; -} - -.editor-post-publish-panel__header { - background: #fff; - padding-right: 16px; - padding-left: 16px; - height: 61px; - border-bottom: 1px solid #ddd; - display: flex; - align-items: center; - align-content: space-between; -} -.editor-post-publish-panel__header .components-button { - width: 100%; - justify-content: center; -} -.editor-post-publish-panel__header .has-icon { - margin-right: auto; - width: auto; -} - -.components-site-card { - display: flex; - align-items: center; - margin: 16px 0; -} - -.components-site-icon { - border: none; - border-radius: 2px; - margin-left: 12px; - height: 36px; - width: 36px; -} - -.components-site-name { - display: block; - font-size: 14px; -} - -.components-site-home { - display: block; - color: #757575; - font-size: 12px; -} - -.editor-post-publish-panel__header-publish-button, -.editor-post-publish-panel__header-cancel-button { - flex-grow: 1; -} -@media (min-width: 480px) { - .editor-post-publish-panel__header-publish-button, -.editor-post-publish-panel__header-cancel-button { - max-width: 160px; - } -} - -.editor-post-publish-panel__header-publish-button { - padding-left: 4px; -} - -.editor-post-publish-panel__header-cancel-button { - padding-right: 4px; -} - -.editor-post-publish-panel__header-published { - flex-grow: 1; -} - -.editor-post-publish-panel__footer { - padding: 16px; -} - -.components-button.editor-post-publish-panel__toggle.is-primary { - display: inline-flex; - align-items: center; -} -.components-button.editor-post-publish-panel__toggle.is-primary.is-busy .dashicon { - display: none; -} -.components-button.editor-post-publish-panel__toggle.is-primary .dashicon { - margin-left: -4px; -} - -.editor-post-publish-panel__link { - font-weight: 400; - padding-right: 4px; -} - -.editor-post-publish-panel__prepublish { - padding: 16px; -} -.editor-post-publish-panel__prepublish strong { - color: #1e1e1e; -} -.editor-post-publish-panel__prepublish .components-panel__body { - background: #fff; - margin-right: -16px; - margin-left: -16px; -} -.editor-post-publish-panel__prepublish .editor-post-visibility__dialog-legend { - display: none; -} - -.post-publish-panel__postpublish .components-panel__body { - border-bottom: 1px solid #e0e0e0; - border-top: none; -} - -.post-publish-panel__postpublish-buttons { - display: flex; - align-content: space-between; - flex-wrap: wrap; - margin: -5px; -} -.post-publish-panel__postpublish-buttons > * { - flex-grow: 1; - margin: 5px; -} -.post-publish-panel__postpublish-buttons .components-button { - height: auto; - justify-content: center; - padding: 3px 10px 4px; - flex: 1; - line-height: 1.6; - text-align: center; - white-space: normal; -} -.post-publish-panel__postpublish-buttons .components-clipboard-button { - width: 100%; -} - -.post-publish-panel__postpublish-post-address-container { - display: flex; - align-items: flex-end; - margin-bottom: 16px; -} -.post-publish-panel__postpublish-post-address-container .components-base-control__field { - margin-bottom: 0; -} -.post-publish-panel__postpublish-post-address-container .post-publish-panel__postpublish-post-address { - flex: 1; -} -.post-publish-panel__postpublish-post-address-container input[readonly] { - padding: 10px; - background: #ddd; - overflow: hidden; - text-overflow: ellipsis; -} - -.post-publish-panel__postpublish-post-address__copy-button-wrap { - flex-shrink: 0; - margin-right: 8px; -} -.post-publish-panel__postpublish-post-address__copy-button-wrap .components-button { - height: 38px; -} - -.post-publish-panel__postpublish-header { - font-weight: 500; -} - -.post-publish-panel__postpublish-subheader { - margin: 0 0 8px; -} - -.post-publish-panel__tip { - color: #f0b849; -} - -@media screen and (max-width: 782px) { - .post-publish-panel__postpublish-post-address__button-wrap .components-button { - height: 40px; - } -} -.editor-post-saved-state { - display: flex; - align-items: center; - width: 28px; - padding: 12px 4px; - color: #757575; - overflow: hidden; - white-space: nowrap; -} -.editor-post-saved-state.is-saving[aria-disabled=true], .editor-post-saved-state.is-saving[aria-disabled=true]:hover, .editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover { - background: transparent; - color: #757575; -} -.editor-post-saved-state svg { - display: inline-block; - flex: 0 0 auto; - fill: currentColor; - margin-left: 8px; -} -@media (min-width: 600px) { - .editor-post-saved-state { - width: auto; - padding: 8px 12px; - text-indent: inherit; - } - .editor-post-saved-state svg { - margin-left: 0; - } -} - -.editor-post-taxonomies__hierarchical-terms-list { - max-height: 14em; - overflow: auto; - margin-right: -6px; - padding-right: 6px; - margin-top: -6px; - padding-top: 6px; -} - -.editor-post-taxonomies__hierarchical-terms-choice { - margin-bottom: 8px; -} - -.editor-post-taxonomies__hierarchical-terms-subchoices { - margin-top: 8px; - margin-right: 16px; -} - -.components-button.editor-post-taxonomies__hierarchical-terms-submit, -.components-button.editor-post-taxonomies__hierarchical-terms-add { - margin-top: 12px; -} - -.editor-post-taxonomies__hierarchical-terms-label { - display: inline-block; - margin-top: 12px; -} - -.editor-post-taxonomies__hierarchical-terms-input { - margin-top: 8px; -} - -.editor-post-taxonomies__hierarchical-terms-filter { - margin-bottom: 8px; - width: 100%; -} - -.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label { - font-weight: 400; - margin-bottom: 12px; -} - -.editor-post-taxonomies__flat-term-most-used-list { - margin: 0; -} -.editor-post-taxonomies__flat-term-most-used-list li { - display: inline-block; - margin-left: 8px; -} -.editor-post-taxonomies__flat-term-most-used-list .components-button { - font-size: 12px; -} - -.edit-post-text-editor__body textarea.editor-post-text-editor { - border: 1px solid #949494; - border-radius: 0; - display: block; - margin: 0; - width: 100%; - box-shadow: none; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - line-height: 2.4; - min-height: 200px; - transition: border 0.1s ease-out, box-shadow 0.1s linear; - padding: 16px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - padding: 24px; - } -} -@media (min-width: 600px) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - font-size: 15px !important; - } -} -.edit-post-text-editor__body textarea.editor-post-text-editor:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; -} -.edit-post-text-editor__body textarea.editor-post-text-editor::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.edit-post-text-editor__body textarea.editor-post-text-editor::-moz-placeholder { - color: rgba(30, 30, 30, 0.62); - opacity: 1; -} -.edit-post-text-editor__body textarea.editor-post-text-editor:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.edit-post-post-visibility__dialog, -.editor-post-visibility__dialog-fieldset { - padding: 4px; - padding-top: 0; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-legend, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-legend { - font-weight: 600; - margin-bottom: 1em; - margin-top: 0.5em; - padding: 0; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-left: 12px; - transition: none; - border-radius: 50%; - width: 24px; - height: 24px; - margin-top: 2px; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - height: 20px; - width: 20px; - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked::before, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked::before { - box-sizing: inherit; - width: 8px; - height: 8px; - transform: translate(-7px, 7px); - margin: 0; - background-color: #fff; - border: 4px solid #fff; -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked::before, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked::before { - transform: translate(-5px, 5px); - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-label, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-label { - font-weight: 600; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-info, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-info { - margin-top: 0; - margin-right: 32px; -} -.edit-post-post-visibility__dialog .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info { - margin-bottom: 0; -} - -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - margin-right: 36px; - margin-top: 8px; -} -@media (prefers-reduced-motion: reduce) { - .editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.editor-post-title { - position: relative; -} -.editor-post-title.is-focus-mode { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .editor-post-title.is-focus-mode { - transition-duration: 0s; - transition-delay: 0s; - } -} -.editor-post-title.is-focus-mode:focus { - opacity: 1; -} - -.editor-post-trash.components-button { - margin-top: 4px; -} - -.table-of-contents__popover.components-popover .components-popover__content { - min-width: 380px; -} - -.components-popover.table-of-contents__popover { - z-index: 99998; -} - -.table-of-contents__popover .components-popover__content > div { - padding: 16px; -} -@media (min-width: 600px) { - .table-of-contents__popover .components-popover__content { - max-height: calc(100vh - 120px); - overflow-y: auto; - } -} -.table-of-contents__popover hr { - margin: 10px -16px 0; -} - -.table-of-contents__wrapper:focus::before { - content: ""; - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - pointer-events: none; -} - -.table-of-contents__counts { - display: flex; - flex-wrap: wrap; - margin: 0; - margin-top: -8px; -} - -.table-of-contents__count { - flex-basis: 33%; - display: flex; - flex-direction: column; - font-size: 13px; - color: #1e1e1e; - padding-left: 8px; - margin-bottom: 0; - margin-top: 8px; -} -.table-of-contents__count:nth-child(4n) { - padding-left: 0; -} - -.table-of-contents__number, -.table-of-contents__popover .word-count { - font-size: 21px; - font-weight: 400; - line-height: 30px; - color: #1e1e1e; -} - -.table-of-contents__title { - display: block; - margin-top: 20px; - font-size: 15px; - font-weight: 600; -} - -.editor-template-validation-notice { - display: flex; - justify-content: space-between; - align-items: center; -} -.editor-template-validation-notice .components-button { - margin-right: 5px; -}@charset "UTF-8"; -/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.editor-autocompleters__user .editor-autocompleters__no-avatar::before { - /* stylelint-disable */ - font: normal 20px/1 dashicons; - /* stylelint-enable */ - content: ""; - margin-right: 5px; - vertical-align: middle; -} -.editor-autocompleters__user .editor-autocompleters__user-avatar { - margin-right: 8px; - flex-grow: 0; - flex-shrink: 0; - max-width: none; - width: 24px; - height: 24px; -} -.editor-autocompleters__user .editor-autocompleters__user-name { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - max-width: 200px; - flex-shrink: 0; - flex-grow: 1; -} -.editor-autocompleters__user .editor-autocompleters__user-slug { - margin-left: 8px; - color: #757575; - white-space: nowrap; - text-overflow: ellipsis; - overflow: none; - max-width: 100px; - flex-grow: 0; - flex-shrink: 0; -} -.editor-autocompleters__user:hover .editor-autocompleters__user-slug { - color: var(--wp-admin-theme-color); -} - -.document-outline { - margin: 20px 0; -} -.document-outline ul { - margin: 0; - padding: 0; -} - -.document-outline__item { - display: flex; - margin: 4px 0; -} -.document-outline__item a { - text-decoration: none; -} -.document-outline__item .document-outline__emdash::before { - color: #ddd; - margin-right: 4px; -} -.document-outline__item.is-h2 .document-outline__emdash::before { - content: "—"; -} -.document-outline__item.is-h3 .document-outline__emdash::before { - content: "——"; -} -.document-outline__item.is-h4 .document-outline__emdash::before { - content: "———"; -} -.document-outline__item.is-h5 .document-outline__emdash::before { - content: "————"; -} -.document-outline__item.is-h6 .document-outline__emdash::before { - content: "—————"; -} - -.document-outline__button { - cursor: pointer; - background: none; - border: none; - display: flex; - align-items: flex-start; - margin: 0 0 0 -1px; - padding: 2px 5px 2px 1px; - color: #1e1e1e; - text-align: left; - border-radius: 2px; -} -.document-outline__button:disabled { - cursor: default; -} -.document-outline__button:focus { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - outline: 2px solid transparent; -} - -.document-outline__level { - background: #ddd; - color: #1e1e1e; - border-radius: 3px; - font-size: 13px; - padding: 1px 6px; - margin-right: 4px; -} -.is-invalid .document-outline__level { - background: #f0b849; -} - -.document-outline__item-content { - padding: 1px 0; -} - -.components-editor-notices__dismissible, -.components-editor-notices__pinned { - position: relative; - left: 0; - top: 0; - right: 0; - color: #1e1e1e; -} -.components-editor-notices__dismissible .components-notice, -.components-editor-notices__pinned .components-notice { - box-sizing: border-box; - margin: 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - padding: 0 12px; - min-height: 60px; -} -.components-editor-notices__dismissible .components-notice .components-notice__dismiss, -.components-editor-notices__pinned .components-notice .components-notice__dismiss { - margin-top: 12px; -} - -.entities-saved-states__panel { - box-sizing: border-box; - background: #fff; - position: fixed; - z-index: 100001; - top: 46px; - bottom: 0; - right: 0; - left: 0; - overflow: auto; - box-sizing: border-box; -} -.entities-saved-states__panel *, -.entities-saved-states__panel *::before, -.entities-saved-states__panel *::after { - box-sizing: inherit; -} -.entities-saved-states__panel .entities-saved-states__find-entity { - display: none; -} -.entities-saved-states__panel .entities-saved-states__find-entity-small { - display: block; -} -@media (min-width: 782px) { - .entities-saved-states__panel { - top: 32px; - left: auto; - width: 280px; - border-left: 1px solid #ddd; - } - body.is-fullscreen-mode .entities-saved-states__panel { - top: 0; - } - .entities-saved-states__panel .entities-saved-states__find-entity { - display: block; - } - .entities-saved-states__panel .entities-saved-states__find-entity-small { - display: none; - } -} -.entities-saved-states__panel .entities-saved-states__panel-header { - background: #fff; - padding-left: 8px; - padding-right: 8px; - height: 61px; - border-bottom: 1px solid #ddd; -} -.entities-saved-states__panel .entities-saved-states__text-prompt { - padding: 16px; - padding-bottom: 4px; -} - -.editor-error-boundary { - margin: auto; - max-width: 780px; - padding: 20px; - margin-top: 60px; - box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25); -} - -.editor-page-attributes__order { - width: 100%; -} -.editor-page-attributes__order .components-base-control__field { - display: flex; - justify-content: space-between; - align-items: center; -} -.editor-page-attributes__order input { - width: 66px; -} - -.editor-post-excerpt__textarea { - width: 100%; - margin-bottom: 10px; -} - -.editor-post-featured-image { - padding: 0; -} -.editor-post-featured-image__container { - margin-bottom: 1em; - position: relative; -} -.editor-post-featured-image .components-spinner { - position: absolute; - top: 50%; - left: 50%; - margin-top: -9px; - margin-left: -9px; -} -.editor-post-featured-image .components-button + .components-button { - display: block; - margin-top: 1em; -} -.editor-post-featured-image .components-responsive-wrapper__content { - max-width: 100%; - width: auto; -} - -.editor-post-featured-image__toggle, -.editor-post-featured-image__preview { - display: block; - width: 100%; - padding: 0; - transition: all 0.1s ease-out; - box-shadow: 0 0 0 0 var(--wp-admin-theme-color); -} -@media (prefers-reduced-motion: reduce) { - .editor-post-featured-image__toggle, -.editor-post-featured-image__preview { - transition-duration: 0s; - transition-delay: 0s; - } -} - -.editor-post-featured-image__preview { - height: auto; -} - -.editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus { - box-shadow: 0 0 0 4px var(--wp-admin-theme-color); -} - -.editor-post-featured-image__toggle { - border-radius: 2px; - background-color: #f0f0f0; - min-height: 90px; - line-height: 20px; - padding: 8px 0; - text-align: center; -} -.editor-post-featured-image__toggle:hover { - background: #ddd; - color: #1e1e1e; -} - -.editor-post-format { - flex-direction: column; - align-items: stretch; - width: 100%; -} - -.editor-post-format__content { - display: inline-flex; - justify-content: space-between; - align-items: center; - width: 100%; -} - -.editor-post-format__suggestion { - padding: 6px; - text-align: right; - font-size: 13px; -} - -.editor-post-last-revision__title { - width: 100%; - font-weight: 600; -} -.editor-post-last-revision__title .dashicon { - margin-right: 5px; -} - -.components-button.editor-post-last-revision__title { - height: 100%; -} -.components-button.editor-post-last-revision__title:hover, .components-button.editor-post-last-revision__title:active { - background: #f0f0f0; -} -.components-button.editor-post-last-revision__title:focus { - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - border-radius: 0; -} - -@media (min-width: 600px) { - .editor-post-locked-modal { - max-width: 480px; - } -} -.editor-post-locked-modal .components-modal__content { - display: flex; -} - -.editor-post-locked-modal__buttons { - margin-top: 24px; -} - -.editor-post-locked-modal__avatar { - border-radius: 2px; - margin-top: 16px; - margin-right: 24px; -} - -.editor-post-publish-button__button.has-changes-dot::before { - background: currentcolor; - border-radius: 4px; - content: ""; - height: 8px; - margin: auto 5px auto -3px; - width: 8px; -} - -.editor-post-publish-panel { - background: #fff; -} - -.editor-post-publish-panel__content { - min-height: calc(100% - 144px); -} -.editor-post-publish-panel__content .components-spinner { - display: block; - margin: 100px auto 0; -} - -.editor-post-publish-panel__header { - background: #fff; - padding-left: 16px; - padding-right: 16px; - height: 61px; - border-bottom: 1px solid #ddd; - display: flex; - align-items: center; - align-content: space-between; -} -.editor-post-publish-panel__header .components-button { - width: 100%; - justify-content: center; -} -.editor-post-publish-panel__header .has-icon { - margin-left: auto; - width: auto; -} - -.components-site-card { - display: flex; - align-items: center; - margin: 16px 0; -} - -.components-site-icon { - border: none; - border-radius: 2px; - margin-right: 12px; - height: 36px; - width: 36px; -} - -.components-site-name { - display: block; - font-size: 14px; -} - -.components-site-home { - display: block; - color: #757575; - font-size: 12px; -} - -.editor-post-publish-panel__header-publish-button, -.editor-post-publish-panel__header-cancel-button { - flex-grow: 1; -} -@media (min-width: 480px) { - .editor-post-publish-panel__header-publish-button, -.editor-post-publish-panel__header-cancel-button { - max-width: 160px; - } -} - -.editor-post-publish-panel__header-publish-button { - padding-right: 4px; -} - -.editor-post-publish-panel__header-cancel-button { - padding-left: 4px; -} - -.editor-post-publish-panel__header-published { - flex-grow: 1; -} - -.editor-post-publish-panel__footer { - padding: 16px; -} - -.components-button.editor-post-publish-panel__toggle.is-primary { - display: inline-flex; - align-items: center; -} -.components-button.editor-post-publish-panel__toggle.is-primary.is-busy .dashicon { - display: none; -} -.components-button.editor-post-publish-panel__toggle.is-primary .dashicon { - margin-right: -4px; -} - -.editor-post-publish-panel__link { - font-weight: 400; - padding-left: 4px; -} - -.editor-post-publish-panel__prepublish { - padding: 16px; -} -.editor-post-publish-panel__prepublish strong { - color: #1e1e1e; -} -.editor-post-publish-panel__prepublish .components-panel__body { - background: #fff; - margin-left: -16px; - margin-right: -16px; -} -.editor-post-publish-panel__prepublish .editor-post-visibility__dialog-legend { - display: none; -} - -.post-publish-panel__postpublish .components-panel__body { - border-bottom: 1px solid #e0e0e0; - border-top: none; -} - -.post-publish-panel__postpublish-buttons { - display: flex; - align-content: space-between; - flex-wrap: wrap; - margin: -5px; -} -.post-publish-panel__postpublish-buttons > * { - flex-grow: 1; - margin: 5px; -} -.post-publish-panel__postpublish-buttons .components-button { - height: auto; - justify-content: center; - padding: 3px 10px 4px; - flex: 1; - line-height: 1.6; - text-align: center; - white-space: normal; -} -.post-publish-panel__postpublish-buttons .components-clipboard-button { - width: 100%; -} - -.post-publish-panel__postpublish-post-address-container { - display: flex; - align-items: flex-end; - margin-bottom: 16px; -} -.post-publish-panel__postpublish-post-address-container .components-base-control__field { - margin-bottom: 0; -} -.post-publish-panel__postpublish-post-address-container .post-publish-panel__postpublish-post-address { - flex: 1; -} -.post-publish-panel__postpublish-post-address-container input[readonly] { - padding: 10px; - background: #ddd; - overflow: hidden; - text-overflow: ellipsis; -} - -.post-publish-panel__postpublish-post-address__copy-button-wrap { - flex-shrink: 0; - margin-left: 8px; -} -.post-publish-panel__postpublish-post-address__copy-button-wrap .components-button { - height: 38px; -} - -.post-publish-panel__postpublish-header { - font-weight: 500; -} - -.post-publish-panel__postpublish-subheader { - margin: 0 0 8px; -} - -.post-publish-panel__tip { - color: #f0b849; -} - -@media screen and (max-width: 782px) { - .post-publish-panel__postpublish-post-address__button-wrap .components-button { - height: 40px; - } -} -.editor-post-saved-state { - display: flex; - align-items: center; - width: 28px; - padding: 12px 4px; - color: #757575; - overflow: hidden; - white-space: nowrap; -} -.editor-post-saved-state.is-saving[aria-disabled=true], .editor-post-saved-state.is-saving[aria-disabled=true]:hover, .editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover { - background: transparent; - color: #757575; -} -.editor-post-saved-state svg { - display: inline-block; - flex: 0 0 auto; - fill: currentColor; - margin-right: 8px; -} -@media (min-width: 600px) { - .editor-post-saved-state { - width: auto; - padding: 8px 12px; - text-indent: inherit; - } - .editor-post-saved-state svg { - margin-right: 0; - } -} - -.editor-post-taxonomies__hierarchical-terms-list { - max-height: 14em; - overflow: auto; - margin-left: -6px; - padding-left: 6px; - margin-top: -6px; - padding-top: 6px; -} - -.editor-post-taxonomies__hierarchical-terms-choice { - margin-bottom: 8px; -} - -.editor-post-taxonomies__hierarchical-terms-subchoices { - margin-top: 8px; - margin-left: 16px; -} - -.components-button.editor-post-taxonomies__hierarchical-terms-submit, -.components-button.editor-post-taxonomies__hierarchical-terms-add { - margin-top: 12px; -} - -.editor-post-taxonomies__hierarchical-terms-label { - display: inline-block; - margin-top: 12px; -} - -.editor-post-taxonomies__hierarchical-terms-input { - margin-top: 8px; -} - -.editor-post-taxonomies__hierarchical-terms-filter { - margin-bottom: 8px; - width: 100%; -} - -.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label { - font-weight: 400; - margin-bottom: 12px; -} - -.editor-post-taxonomies__flat-term-most-used-list { - margin: 0; -} -.editor-post-taxonomies__flat-term-most-used-list li { - display: inline-block; - margin-right: 8px; -} -.editor-post-taxonomies__flat-term-most-used-list .components-button { - font-size: 12px; -} - -.edit-post-text-editor__body textarea.editor-post-text-editor { - border: 1px solid #949494; - border-radius: 0; - display: block; - margin: 0; - width: 100%; - box-shadow: none; - resize: none; - overflow: hidden; - font-family: Menlo, Consolas, monaco, monospace; - line-height: 2.4; - min-height: 200px; - transition: border 0.1s ease-out, box-shadow 0.1s linear; - padding: 16px; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px !important; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - padding: 24px; - } -} -@media (min-width: 600px) { - .edit-post-text-editor__body textarea.editor-post-text-editor { - font-size: 15px !important; - } -} -.edit-post-text-editor__body textarea.editor-post-text-editor:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - position: relative; -} -.edit-post-text-editor__body textarea.editor-post-text-editor::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.edit-post-text-editor__body textarea.editor-post-text-editor::-moz-placeholder { - color: rgba(30, 30, 30, 0.62); - opacity: 1; -} -.edit-post-text-editor__body textarea.editor-post-text-editor:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.edit-post-post-visibility__dialog, -.editor-post-visibility__dialog-fieldset { - padding: 4px; - padding-top: 0; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-legend, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-legend { - font-weight: 600; - margin-bottom: 1em; - margin-top: 0.5em; - padding: 0; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - border: 1px solid #1e1e1e; - margin-right: 12px; - transition: none; - border-radius: 50%; - width: 24px; - height: 24px; - margin-top: 2px; -} -@media (prefers-reduced-motion: reduce) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio], -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio] { - height: 20px; - width: 20px; - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked::before, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked::before { - box-sizing: inherit; - width: 8px; - height: 8px; - transform: translate(7px, 7px); - margin: 0; - background-color: #fff; - border: 4px solid #fff; -} -@media (min-width: 600px) { - .edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked::before, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked::before { - transform: translate(5px, 5px); - } -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:focus, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:focus { - box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-radio[type=radio]:checked, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-radio[type=radio]:checked { - background: var(--wp-admin-theme-color); - border-color: var(--wp-admin-theme-color); -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-label, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-label { - font-weight: 600; -} -.edit-post-post-visibility__dialog .editor-post-visibility__dialog-info, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__dialog-info { - margin-top: 0; - margin-left: 32px; -} -.edit-post-post-visibility__dialog .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info, -.editor-post-visibility__dialog-fieldset .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info { - margin-bottom: 0; -} - -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - padding: 6px 8px; - box-shadow: 0 0 0 transparent; - transition: box-shadow 0.1s linear; - border-radius: 2px; - border: 1px solid #757575; - /* Fonts smaller than 16px causes mobile safari to zoom. */ - font-size: 16px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - margin-left: 36px; - margin-top: 8px; -} -@media (prefers-reduced-motion: reduce) { - .editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - transition-duration: 0s; - transition-delay: 0s; - } -} -@media (min-width: 600px) { - .editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text] { - font-size: 13px; - /* Override core line-height. To be reviewed. */ - line-height: normal; - } -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:focus { - border-color: var(--wp-admin-theme-color); - box-shadow: 0 0 0 1px var(--wp-admin-theme-color); - outline: 2px solid transparent; -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-webkit-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]::-moz-placeholder { - opacity: 1; - color: rgba(30, 30, 30, 0.62); -} -.editor-post-visibility__dialog-password .editor-post-visibility__dialog-password-input[type=text]:-ms-input-placeholder { - color: rgba(30, 30, 30, 0.62); -} - -.editor-post-title { - position: relative; -} -.editor-post-title.is-focus-mode { - opacity: 0.5; - transition: opacity 0.1s linear; -} -@media (prefers-reduced-motion: reduce) { - .editor-post-title.is-focus-mode { - transition-duration: 0s; - transition-delay: 0s; - } -} -.editor-post-title.is-focus-mode:focus { - opacity: 1; -} - -.editor-post-trash.components-button { - margin-top: 4px; -} - -.table-of-contents__popover.components-popover .components-popover__content { - min-width: 380px; -} - -.components-popover.table-of-contents__popover { - z-index: 99998; -} - -.table-of-contents__popover .components-popover__content > div { - padding: 16px; -} -@media (min-width: 600px) { - .table-of-contents__popover .components-popover__content { - max-height: calc(100vh - 120px); - overflow-y: auto; - } -} -.table-of-contents__popover hr { - margin: 10px -16px 0; -} - -.table-of-contents__wrapper:focus::before { - content: ""; - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - pointer-events: none; -} - -.table-of-contents__counts { - display: flex; - flex-wrap: wrap; - margin: 0; - margin-top: -8px; -} - -.table-of-contents__count { - flex-basis: 33%; - display: flex; - flex-direction: column; - font-size: 13px; - color: #1e1e1e; - padding-right: 8px; - margin-bottom: 0; - margin-top: 8px; -} -.table-of-contents__count:nth-child(4n) { - padding-right: 0; -} - -.table-of-contents__number, -.table-of-contents__popover .word-count { - font-size: 21px; - font-weight: 400; - line-height: 30px; - color: #1e1e1e; -} - -.table-of-contents__title { - display: block; - margin-top: 20px; - font-size: 15px; - font-weight: 600; -} - -.editor-template-validation-notice { - display: flex; - justify-content: space-between; - align-items: center; -} -.editor-template-validation-notice .components-button { - margin-left: 5px; -}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.wp-block-legacy-widget__edit-form{background:#fff;border-radius:2px;border:1px solid #1e1e1e;padding:11px}.wp-block-legacy-widget__edit-form:not([hidden]){display:flow-root}.wp-block-legacy-widget__edit-form .wp-block-legacy-widget__edit-form-title{color:#000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:14px;font-weight:600;margin:0 0 12px}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside{border:none;box-shadow:none;display:block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside p{margin:8px 0}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label{font-size:13px;line-height:2.1}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside a,.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input,.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label{font-family:system-ui;font-weight:400;color:#000}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=date],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime-local],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=email],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=month],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=number],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=password],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=search],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=tel],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=text],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=time],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=url],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=week],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select{font-family:system-ui;background-color:transparent;box-sizing:border-box;border:1px solid #757575;border-radius:3px;box-shadow:none;color:#000;display:block;margin:0;width:100%;font-size:13px;font-weight:400;line-height:1;min-height:30px;padding-right:8px;padding-top:8px;padding-bottom:8px}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select{padding-right:4px}.wp-block-legacy-widget__edit-form .widget.open,.wp-block-legacy-widget__edit-form .widget.open:focus-within{z-index:0}.wp-block-legacy-widget__edit-form.wp-block-legacy-widget__edit-form,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview{color:#000}.wp-block-legacy-widget__edit-no-preview,.wp-block-legacy-widget__edit-preview{cursor:pointer}.wp-block-legacy-widget__edit-no-preview:hover:after,.wp-block-legacy-widget__edit-preview:hover:after{border-radius:2px;border:1px solid #949494;bottom:0;content:"";right:0;position:absolute;left:0;top:0}.wp-block-legacy-widget__edit-preview.is-offscreen{right:-9999px;position:absolute;top:0;width:100%}.wp-block-legacy-widget__edit-preview-iframe{overflow:hidden;width:100%}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview{background:#f0f0f0;padding:8px 12px}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3{font-size:14px;font-weight:600;margin:4px 0}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p{margin:4px 0}.wp-block-legacy-widget-inspector-card{padding:0 52px 16px 16px}.interface-complementary-area .wp-block-legacy-widget-inspector-card__name{margin:0 0 5px;font-weight:500}.is-selected .wp-block-legacy-widget__container{padding:8px 12px;min-height:50px}.components-popover__content .wp-block-legacy-widget__edit-form{min-width:400px}.wp-block-legacy-widget .components-base-control{width:100%}.wp-block-legacy-widget .components-select-control__input{padding:0;font-family:system-ui}.wp-block-widget-group.has-child-selected:after{border-radius:2px;border:1px solid var(--wp-admin-theme-color);bottom:0;content:"";right:0;position:absolute;left:0;top:0}.wp-block-widget-group .widget-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;font-weight:600}.wp-block-widget-group__placeholder .block-editor-inserter{width:100%}.is-dark-theme .wp-block-widget-group__placeholder .block-editor-button-block-appender{box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e}:root{--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,161;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.wp-block-legacy-widget__edit-form{background:#fff;border-radius:2px;border:1px solid #1e1e1e;padding:11px}.wp-block-legacy-widget__edit-form:not([hidden]){display:flow-root}.wp-block-legacy-widget__edit-form .wp-block-legacy-widget__edit-form-title{color:#000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:14px;font-weight:600;margin:0 0 12px}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside{border:none;box-shadow:none;display:block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside p{margin:8px 0}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label{font-size:13px;line-height:2.1}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside a,.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input,.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label{font-family:system-ui;font-weight:400;color:#000}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=date],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime-local],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=email],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=month],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=number],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=password],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=search],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=tel],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=text],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=time],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=url],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=week],.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select{font-family:system-ui;background-color:transparent;box-sizing:border-box;border:1px solid #757575;border-radius:3px;box-shadow:none;color:#000;display:block;margin:0;width:100%;font-size:13px;font-weight:400;line-height:1;min-height:30px;padding-left:8px;padding-top:8px;padding-bottom:8px}.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select{padding-left:4px}.wp-block-legacy-widget__edit-form .widget.open,.wp-block-legacy-widget__edit-form .widget.open:focus-within{z-index:0}.wp-block-legacy-widget__edit-form.wp-block-legacy-widget__edit-form,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview{color:#000}.wp-block-legacy-widget__edit-no-preview,.wp-block-legacy-widget__edit-preview{cursor:pointer}.wp-block-legacy-widget__edit-no-preview:hover:after,.wp-block-legacy-widget__edit-preview:hover:after{border-radius:2px;border:1px solid #949494;bottom:0;content:"";left:0;position:absolute;right:0;top:0}.wp-block-legacy-widget__edit-preview.is-offscreen{left:-9999px;position:absolute;top:0;width:100%}.wp-block-legacy-widget__edit-preview-iframe{overflow:hidden;width:100%}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview{background:#f0f0f0;padding:8px 12px}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3,.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3{font-size:14px;font-weight:600;margin:4px 0}.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p{margin:4px 0}.wp-block-legacy-widget-inspector-card{padding:0 16px 16px 52px}.interface-complementary-area .wp-block-legacy-widget-inspector-card__name{margin:0 0 5px;font-weight:500}.is-selected .wp-block-legacy-widget__container{padding:8px 12px;min-height:50px}.components-popover__content .wp-block-legacy-widget__edit-form{min-width:400px}.wp-block-legacy-widget .components-base-control{width:100%}.wp-block-legacy-widget .components-select-control__input{padding:0;font-family:system-ui}.wp-block-widget-group.has-child-selected:after{border-radius:2px;border:1px solid var(--wp-admin-theme-color);bottom:0;content:"";left:0;position:absolute;right:0;top:0}.wp-block-widget-group .widget-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;font-weight:600}.wp-block-widget-group__placeholder .block-editor-inserter{width:100%}.is-dark-theme .wp-block-widget-group__placeholder .block-editor-button-block-appender{box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.wp-block-legacy-widget__edit-form { - background: #fff; - border-radius: 2px; - border: 1px solid #1e1e1e; - padding: 11px; -} -.wp-block-legacy-widget__edit-form:not([hidden]) { - display: flow-root; -} -.wp-block-legacy-widget__edit-form .wp-block-legacy-widget__edit-form-title { - color: #000; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 14px; - font-weight: 600; - margin: 0 0 12px 0; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside { - border: none; - box-shadow: none; - display: block; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside p { - margin: 8px 0; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label { - font-size: 13px; - line-height: 2.1; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label, -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input, -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside a { - font-family: system-ui; - font-weight: normal; - color: #000; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=text], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=password], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=date], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime-local], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=email], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=month], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=number], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=search], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=tel], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=time], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=url], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=week], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { - font-family: system-ui; - background-color: transparent; - box-sizing: border-box; - border: 1px solid #757575; - border-radius: 3px; - box-shadow: none; - color: #000; - display: block; - margin: 0; - width: 100%; - font-size: 13px; - font-weight: normal; - line-height: 1; - min-height: 30px; - padding-right: 8px; - padding-top: 8px; - padding-bottom: 8px; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { - padding-right: 4px; -} -.wp-block-legacy-widget__edit-form .widget.open, -.wp-block-legacy-widget__edit-form .widget.open:focus-within { - z-index: 0; -} - -.wp-block-legacy-widget__edit-form.wp-block-legacy-widget__edit-form, -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview { - color: #000; -} - -.wp-block-legacy-widget__edit-preview, -.wp-block-legacy-widget__edit-no-preview { - cursor: pointer; -} -.wp-block-legacy-widget__edit-preview:hover::after, -.wp-block-legacy-widget__edit-no-preview:hover::after { - border-radius: 2px; - border: 1px solid #949494; - bottom: 0; - content: ""; - right: 0; - position: absolute; - left: 0; - top: 0; -} - -.wp-block-legacy-widget__edit-preview.is-offscreen { - right: -9999px; - position: absolute; - top: 0; - width: 100%; -} - -.wp-block-legacy-widget__edit-preview-iframe { - overflow: hidden; - width: 100%; -} - -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview { - background: #f0f0f0; - padding: 8px 12px; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview, .wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3, .wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3 { - font-size: 14px; - font-weight: 600; - margin: 4px 0; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p { - margin: 4px 0; -} - -.wp-block-legacy-widget-inspector-card { - padding: 0 52px 16px 16px; -} - -.interface-complementary-area .wp-block-legacy-widget-inspector-card__name { - margin: 0 0 5px; - font-weight: 500; -} - -.is-selected .wp-block-legacy-widget__container { - padding: 8px 12px; - min-height: 50px; -} - -.components-popover__content .wp-block-legacy-widget__edit-form { - min-width: 400px; -} - -.wp-block-legacy-widget .components-base-control { - width: 100%; -} -.wp-block-legacy-widget .components-select-control__input { - padding: 0; - font-family: system-ui; -} - -.wp-block-widget-group.has-child-selected::after { - border-radius: 2px; - border: 1px solid var(--wp-admin-theme-color); - bottom: 0; - content: ""; - right: 0; - position: absolute; - left: 0; - top: 0; -} -.wp-block-widget-group .widget-title { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 18px; - font-weight: 600; -} - -.wp-block-widget-group__placeholder .block-editor-inserter { - width: 100%; -} - -.is-dark-theme .wp-block-widget-group__placeholder .block-editor-button-block-appender { - box-shadow: inset 0 0 0 1px #1e1e1e; - color: #1e1e1e; -}/** - * Colors - */ -/** - * Breakpoints & Media Queries - */ -/** - * SCSS Variables. - * - * Please use variables from this sheet to ensure consistency across the UI. - * Don't add to this sheet unless you're pretty sure the value will be reused in many places. - * For example, don't add rules to this sheet that affect block visuals. It's purely for UI. - */ -/** - * Colors - */ -/** - * Fonts & basic variables. - */ -/** - * Grid System. - * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/ - */ -/** - * Dimensions. - */ -/** - * Shadows. - */ -/** - * Editor widths. - */ -/** - * Block & Editor UI. - */ -/** - * Block paddings. - */ -/** - * React Native specific. - * These variables do not appear to be used anywhere else. - */ -/** -* Converts a hex value into the rgb equivalent. -* -* @param {string} hex - the hexadecimal value to convert -* @return {string} comma separated rgb values -*/ -/** - * Breakpoint mixins - */ -/** - * Long content fade mixin - * - * Creates a fading overlay to signify that the content is longer - * than the space allows. - */ -/** - * Focus styles. - */ -/** - * Applies editor left position to the selector passed as argument - */ -/** - * Styles that are reused verbatim in a few places - */ -/** - * Allows users to opt-out of animations via OS-level preferences. - */ -/** - * Reset default styles for JavaScript UI based pages. - * This is a WP-admin agnostic reset - */ -/** - * Reset the WP Admin page styles for Gutenberg-like pages. - */ -:root { - --wp-admin-theme-color: #007cba; - --wp-admin-theme-color--rgb: 0, 124, 186; - --wp-admin-theme-color-darker-10: #006ba1; - --wp-admin-theme-color-darker-10--rgb: 0, 107, 161; - --wp-admin-theme-color-darker-20: #005a87; - --wp-admin-theme-color-darker-20--rgb: 0, 90, 135; - --wp-admin-border-width-focus: 2px; -} -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - :root { - --wp-admin-border-width-focus: 1.5px; - } -} - -.wp-block-legacy-widget__edit-form { - background: #fff; - border-radius: 2px; - border: 1px solid #1e1e1e; - padding: 11px; -} -.wp-block-legacy-widget__edit-form:not([hidden]) { - display: flow-root; -} -.wp-block-legacy-widget__edit-form .wp-block-legacy-widget__edit-form-title { - color: #000; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 14px; - font-weight: 600; - margin: 0 0 12px 0; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside { - border: none; - box-shadow: none; - display: block; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside p { - margin: 8px 0; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label { - font-size: 13px; - line-height: 2.1; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside label, -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input, -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside a { - font-family: system-ui; - font-weight: normal; - color: #000; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=text], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=password], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=date], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=datetime-local], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=email], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=month], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=number], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=search], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=tel], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=time], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=url], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside input[type=week], -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { - font-family: system-ui; - background-color: transparent; - box-sizing: border-box; - border: 1px solid #757575; - border-radius: 3px; - box-shadow: none; - color: #000; - display: block; - margin: 0; - width: 100%; - font-size: 13px; - font-weight: normal; - line-height: 1; - min-height: 30px; - padding-left: 8px; - padding-top: 8px; - padding-bottom: 8px; -} -.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { - padding-left: 4px; -} -.wp-block-legacy-widget__edit-form .widget.open, -.wp-block-legacy-widget__edit-form .widget.open:focus-within { - z-index: 0; -} - -.wp-block-legacy-widget__edit-form.wp-block-legacy-widget__edit-form, -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview { - color: #000; -} - -.wp-block-legacy-widget__edit-preview, -.wp-block-legacy-widget__edit-no-preview { - cursor: pointer; -} -.wp-block-legacy-widget__edit-preview:hover::after, -.wp-block-legacy-widget__edit-no-preview:hover::after { - border-radius: 2px; - border: 1px solid #949494; - bottom: 0; - content: ""; - left: 0; - position: absolute; - right: 0; - top: 0; -} - -.wp-block-legacy-widget__edit-preview.is-offscreen { - left: -9999px; - position: absolute; - top: 0; - width: 100%; -} - -.wp-block-legacy-widget__edit-preview-iframe { - overflow: hidden; - width: 100%; -} - -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview { - background: #f0f0f0; - padding: 8px 12px; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview, .wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3, .wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 13px; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview h3 { - font-size: 14px; - font-weight: 600; - margin: 4px 0; -} -.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview.wp-block-legacy-widget__edit-no-preview p { - margin: 4px 0; -} - -.wp-block-legacy-widget-inspector-card { - padding: 0 16px 16px 52px; -} - -.interface-complementary-area .wp-block-legacy-widget-inspector-card__name { - margin: 0 0 5px; - font-weight: 500; -} - -.is-selected .wp-block-legacy-widget__container { - padding: 8px 12px; - min-height: 50px; -} - -.components-popover__content .wp-block-legacy-widget__edit-form { - min-width: 400px; -} - -.wp-block-legacy-widget .components-base-control { - width: 100%; -} -.wp-block-legacy-widget .components-select-control__input { - padding: 0; - font-family: system-ui; -} - -.wp-block-widget-group.has-child-selected::after { - border-radius: 2px; - border: 1px solid var(--wp-admin-theme-color); - bottom: 0; - content: ""; - left: 0; - position: absolute; - right: 0; - top: 0; -} -.wp-block-widget-group .widget-title { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - font-size: 18px; - font-weight: 600; -} - -.wp-block-widget-group__placeholder .block-editor-inserter { - width: 100%; -} - -.is-dark-theme .wp-block-widget-group__placeholder .block-editor-button-block-appender { - box-shadow: inset 0 0 0 1px #1e1e1e; - color: #1e1e1e; -}/*jslint indent: 2, browser: true, bitwise: true, plusplus: true */ -var twemoji = (function ( - /*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//* - https://github.com/twitter/twemoji/blob/gh-pages/LICENSE - */ - - // WARNING: this file is generated automatically via - // `node scripts/build.js` - // please update its `createTwemoji` function - // at the bottom of the same file instead. - -) { - 'use strict'; - - /*jshint maxparams:4 */ - - var - // the exported module object - twemoji = { - - - ///////////////////////// - // properties // - ///////////////////////// - - // default assets url, by default will be Twitter Inc. CDN - base: 'https://twemoji.maxcdn.com/v/14.0.2/', - - // default assets file extensions, by default '.png' - ext: '.png', - - // default assets/folder size, by default "72x72" - // available via Twitter CDN: 72 - size: '72x72', - - // default class name, by default 'emoji' - className: 'emoji', - - // basic utilities / helpers to convert code points - // to JavaScript surrogates and vice versa - convert: { - - /** - * Given an HEX codepoint, returns UTF16 surrogate pairs. - * - * @param string generic codepoint, i.e. '1F4A9' - * @return string codepoint transformed into utf16 surrogates pair, - * i.e. \uD83D\uDCA9 - * - * @example - * twemoji.convert.fromCodePoint('1f1e8'); - * // "\ud83c\udde8" - * - * '1f1e8-1f1f3'.split('-').map(twemoji.convert.fromCodePoint).join('') - * // "\ud83c\udde8\ud83c\uddf3" - */ - fromCodePoint: fromCodePoint, - - /** - * Given UTF16 surrogate pairs, returns the equivalent HEX codepoint. - * - * @param string generic utf16 surrogates pair, i.e. \uD83D\uDCA9 - * @param string optional separator for double code points, default='-' - * @return string utf16 transformed into codepoint, i.e. '1F4A9' - * - * @example - * twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3'); - * // "1f1e8-1f1f3" - * - * twemoji.convert.toCodePoint('\ud83c\udde8\ud83c\uddf3', '~'); - * // "1f1e8~1f1f3" - */ - toCodePoint: toCodePoint - }, - - - ///////////////////////// - // methods // - ///////////////////////// - - /** - * User first: used to remove missing images - * preserving the original text intent when - * a fallback for network problems is desired. - * Automatically added to Image nodes via DOM - * It could be recycled for string operations via: - * $('img.emoji').on('error', twemoji.onerror) - */ - onerror: function onerror() { - if (this.parentNode) { - this.parentNode.replaceChild(createText(this.alt, false), this); - } - }, - - /** - * Main method/logic to generate either tags or HTMLImage nodes. - * "emojify" a generic text or DOM Element. - * - * @overloads - * - * String replacement for `innerHTML` or server side operations - * twemoji.parse(string); - * twemoji.parse(string, Function); - * twemoji.parse(string, Object); - * - * HTMLElement tree parsing for safer operations over existing DOM - * twemoji.parse(HTMLElement); - * twemoji.parse(HTMLElement, Function); - * twemoji.parse(HTMLElement, Object); - * - * @param string|HTMLElement the source to parse and enrich with emoji. - * - * string replace emoji matches with tags. - * Mainly used to inject emoji via `innerHTML` - * It does **not** parse the string or validate it, - * it simply replaces found emoji with a tag. - * NOTE: be sure this won't affect security. - * - * HTMLElement walk through the DOM tree and find emoji - * that are inside **text node only** (nodeType === 3) - * Mainly used to put emoji in already generated DOM - * without compromising surrounding nodes and - * **avoiding** the usage of `innerHTML`. - * NOTE: Using DOM elements instead of strings should - * improve security without compromising too much - * performance compared with a less safe `innerHTML`. - * - * @param Function|Object [optional] - * either the callback that will be invoked or an object - * with all properties to use per each found emoji. - * - * Function if specified, this will be invoked per each emoji - * that has been found through the RegExp except - * those follwed by the invariant \uFE0E ("as text"). - * Once invoked, parameters will be: - * - * iconId:string the lower case HEX code point - * i.e. "1f4a9" - * - * options:Object all info for this parsing operation - * - * variant:char the optional \uFE0F ("as image") - * variant, in case this info - * is anyhow meaningful. - * By default this is ignored. - * - * If such callback will return a falsy value instead - * of a valid `src` to use for the image, nothing will - * actually change for that specific emoji. - * - * - * Object if specified, an object containing the following properties - * - * callback Function the callback to invoke per each found emoji. - * base string the base url, by default twemoji.base - * ext string the image extension, by default twemoji.ext - * size string the assets size, by default twemoji.size - * - * @example - * - * twemoji.parse("I \u2764\uFE0F emoji!"); - * // I ❤️ emoji! - * - * - * twemoji.parse("I \u2764\uFE0F emoji!", function(iconId, options) { - * return '/assets/' + iconId + '.gif'; - * }); - * // I ❤️ emoji! - * - * - * twemoji.parse("I \u2764\uFE0F emoji!", { - * size: 72, - * callback: function(iconId, options) { - * return '/assets/' + options.size + '/' + iconId + options.ext; - * } - * }); - * // I ❤️ emoji! - * - */ - parse: parse, - - /** - * Given a string, invokes the callback argument - * per each emoji found in such string. - * This is the most raw version used by - * the .parse(string) method itself. - * - * @param string generic string to parse - * @param Function a generic callback that will be - * invoked to replace the content. - * This callback will receive standard - * String.prototype.replace(str, callback) - * arguments such: - * callback( - * rawText, // the emoji match - * ); - * - * and others commonly received via replace. - */ - replace: replace, - - /** - * Simplify string tests against emoji. - * - * @param string some text that might contain emoji - * @return boolean true if any emoji was found, false otherwise. - * - * @example - * - * if (twemoji.test(someContent)) { - * console.log("emoji All The Things!"); - * } - */ - test: test - }, - - // used to escape HTML special chars in attributes - escaper = { - '&': '&', - '<': '<', - '>': '>', - "'": ''', - '"': '"' - }, - - // RegExp based on emoji's official Unicode standards - // http://www.unicode.org/Public/UNIDATA/EmojiSources.txt - re = /(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef0-\udef6]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedd-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude74\ude78-\ude7c\ude80-\ude86\ude90-\udeac\udeb0-\udeba\udec0-\udec2\uded0-\uded9\udee0-\udee7]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g, - - // avoid runtime RegExp creation for not so smart, - // not JIT based, and old browsers / engines - UFE0Fg = /\uFE0F/g, - - // avoid using a string literal like '\u200D' here because minifiers expand it inline - U200D = String.fromCharCode(0x200D), - - // used to find HTML special chars in attributes - rescaper = /[&<>'"]/g, - - // nodes with type 1 which should **not** be parsed - shouldntBeParsed = /^(?:iframe|noframes|noscript|script|select|style|textarea)$/, - - // just a private shortcut - fromCharCode = String.fromCharCode; - - return twemoji; - - - ///////////////////////// - // private functions // - // declaration // - ///////////////////////// - - /** - * Shortcut to create text nodes - * @param string text used to create DOM text node - * @return Node a DOM node with that text - */ - function createText(text, clean) { - return document.createTextNode(clean ? text.replace(UFE0Fg, '') : text); - } - - /** - * Utility function to escape html attribute text - * @param string text use in HTML attribute - * @return string text encoded to use in HTML attribute - */ - function escapeHTML(s) { - return s.replace(rescaper, replacer); - } - - /** - * Default callback used to generate emoji src - * based on Twitter CDN - * @param string the emoji codepoint string - * @param string the default size to use, i.e. "36x36" - * @return string the image source to use - */ - function defaultImageSrcGenerator(icon, options) { - return ''.concat(options.base, options.size, '/', icon, options.ext); - } - - /** - * Given a generic DOM nodeType 1, walk through all children - * and store every nodeType 3 (#text) found in the tree. - * @param Element a DOM Element with probably some text in it - * @param Array the list of previously discovered text nodes - * @return Array same list with new discovered nodes, if any - */ - function grabAllTextNodes(node, allText) { - var - childNodes = node.childNodes, - length = childNodes.length, - subnode, - nodeType; - while (length--) { - subnode = childNodes[length]; - nodeType = subnode.nodeType; - // parse emoji only in text nodes - if (nodeType === 3) { - // collect them to process emoji later - allText.push(subnode); - } - // ignore all nodes that are not type 1, that are svg, or that - // should not be parsed as script, style, and others - else if (nodeType === 1 && !('ownerSVGElement' in subnode) && - !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) { - grabAllTextNodes(subnode, allText); - } - } - return allText; - } - - /** - * Used to both remove the possible variant - * and to convert utf16 into code points. - * If there is a zero-width-joiner (U+200D), leave the variants in. - * @param string the raw text of the emoji match - * @return string the code point - */ - function grabTheRightIcon(rawText) { - // if variant is present as \uFE0F - return toCodePoint(rawText.indexOf(U200D) < 0 ? - rawText.replace(UFE0Fg, '') : - rawText - ); - } - - /** - * DOM version of the same logic / parser: - * emojify all found sub-text nodes placing images node instead. - * @param Element generic DOM node with some text in some child node - * @param Object options containing info about how to parse - * - * .callback Function the callback to invoke per each found emoji. - * .base string the base url, by default twemoji.base - * .ext string the image extension, by default twemoji.ext - * .size string the assets size, by default twemoji.size - * - * @return Element same generic node with emoji in place, if any. - */ - function parseNode(node, options) { - var - allText = grabAllTextNodes(node, []), - length = allText.length, - attrib, - attrname, - modified, - fragment, - subnode, - text, - match, - i, - index, - img, - rawText, - iconId, - src; - while (length--) { - modified = false; - fragment = document.createDocumentFragment(); - subnode = allText[length]; - text = subnode.nodeValue; - i = 0; - while ((match = re.exec(text))) { - index = match.index; - if (index !== i) { - fragment.appendChild( - createText(text.slice(i, index), true) - ); - } - rawText = match[0]; - iconId = grabTheRightIcon(rawText); - i = index + rawText.length; - src = options.callback(iconId, options); - if (iconId && src) { - img = new Image(); - img.onerror = options.onerror; - img.setAttribute('draggable', 'false'); - attrib = options.attributes(rawText, iconId); - for (attrname in attrib) { - if ( - attrib.hasOwnProperty(attrname) && - // don't allow any handlers to be set + don't allow overrides - attrname.indexOf('on') !== 0 && - !img.hasAttribute(attrname) - ) { - img.setAttribute(attrname, attrib[attrname]); - } - } - img.className = options.className; - img.alt = rawText; - img.src = src; - modified = true; - fragment.appendChild(img); - } - if (!img) fragment.appendChild(createText(rawText, false)); - img = null; - } - // is there actually anything to replace in here ? - if (modified) { - // any text left to be added ? - if (i < text.length) { - fragment.appendChild( - createText(text.slice(i), true) - ); - } - // replace the text node only, leave intact - // anything else surrounding such text - subnode.parentNode.replaceChild(fragment, subnode); - } - } - return node; - } - - /** - * String/HTML version of the same logic / parser: - * emojify a generic text placing images tags instead of surrogates pair. - * @param string generic string with possibly some emoji in it - * @param Object options containing info about how to parse - * - * .callback Function the callback to invoke per each found emoji. - * .base string the base url, by default twemoji.base - * .ext string the image extension, by default twemoji.ext - * .size string the assets size, by default twemoji.size - * - * @return the string with replacing all found and parsed emoji - */ - function parseString(str, options) { - return replace(str, function (rawText) { - var - ret = rawText, - iconId = grabTheRightIcon(rawText), - src = options.callback(iconId, options), - attrib, - attrname; - if (iconId && src) { - // recycle the match string replacing the emoji - // with its image counter part - ret = ''); - } - return ret; - }); - } - - /** - * Function used to actually replace HTML special chars - * @param string HTML special char - * @return string encoded HTML special char - */ - function replacer(m) { - return escaper[m]; - } - - /** - * Default options.attribute callback - * @return null - */ - function returnNull() { - return null; - } - - /** - * Given a generic value, creates its squared counterpart if it's a number. - * As example, number 36 will return '36x36'. - * @param any a generic value. - * @return any a string representing asset size, i.e. "36x36" - * only in case the value was a number. - * Returns initial value otherwise. - */ - function toSizeSquaredAsset(value) { - return typeof value === 'number' ? - value + 'x' + value : - value; - } - - - ///////////////////////// - // exported functions // - // declaration // - ///////////////////////// - - function fromCodePoint(codepoint) { - var code = typeof codepoint === 'string' ? - parseInt(codepoint, 16) : codepoint; - if (code < 0x10000) { - return fromCharCode(code); - } - code -= 0x10000; - return fromCharCode( - 0xD800 + (code >> 10), - 0xDC00 + (code & 0x3FF) - ); - } - - function parse(what, how) { - if (!how || typeof how === 'function') { - how = {callback: how}; - } - // if first argument is string, inject html tags - // otherwise use the DOM tree and parse text nodes only - return (typeof what === 'string' ? parseString : parseNode)(what, { - callback: how.callback || defaultImageSrcGenerator, - attributes: typeof how.attributes === 'function' ? how.attributes : returnNull, - base: typeof how.base === 'string' ? how.base : twemoji.base, - ext: how.ext || twemoji.ext, - size: how.folder || toSizeSquaredAsset(how.size || twemoji.size), - className: how.className || twemoji.className, - onerror: how.onerror || twemoji.onerror - }); - } - - function replace(text, callback) { - return String(text).replace(re, callback); - } - - function test(text) { - // IE6 needs a reset before too - re.lastIndex = 0; - var result = re.test(text); - re.lastIndex = 0; - return result; - } - - function toCodePoint(unicodeSurrogates, sep) { - var - r = [], - c = 0, - p = 0, - i = 0; - while (i < unicodeSurrogates.length) { - c = unicodeSurrogates.charCodeAt(i++); - if (p) { - r.push((0x10000 + ((p - 0xD800) << 10) + (c - 0xDC00)).toString(16)); - p = 0; - } else if (0xD800 <= c && c <= 0xDBFF) { - p = c; - } else { - r.push(c.toString(16)); - } - } - return r.join(sep || '-'); - } - -}());/*! This file is auto-generated */ -window.wp=window.wp||{},function(i){var n,o=wp.customize;i.extend(i.support,{history:!(!window.history||!history.pushState),hashchange:"onhashchange"in window&&(void 0===document.documentMode||7').appendTo(this.body),this.bind("open",this.overlay.show),this.bind("close",this.overlay.hide),i("#wpbody").on("click",".load-customize",function(e){e.preventDefault(),n.link=i(this),n.open(n.link.attr("href"))}),i.support.history&&this.window.on("popstate",n.popstate),i.support.hashchange&&(this.window.on("hashchange",n.hashchange),this.window.triggerHandler("hashchange")))},popstate:function(e){e=e.originalEvent.state;e&&e.customize?n.open(e.customize):n.active&&n.close()},hashchange:function(){var e=window.location.toString().split("#")[1];e&&0===e.indexOf("wp_customize=on")&&n.open(n.settings.url+"?"+e),e||i.support.history||n.close()},beforeunload:function(){if(!n.saved())return n.settings.l10n.saveAlert},open:function(e){if(!this.active){if(n.settings.browser.mobile)return window.location=e;this.originalDocumentTitle=document.title,this.active=!0,this.body.addClass("customize-loading"),this.saved=new o.Value(!0),this.iframe=i("")?Gv(r):Jv(t)},ty=function(e,t,n){"fragmented"===t.type?Xv(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw"}),e.selection.moveToBookmark(n?t.beforeBookmark:t.bookmark)},ny=function(e,t){return!(!e||!t)&&(r=t,Qv(e)===Qv(r)||(n=t,Zv(e)===Zv(n)));var n,r};function ry(u){var s,r,o=this,c=0,l=[],t=0,f=function(){return 0===t},i=function(e){f()&&(o.typing=e)},d=function(e){u.setDirty(e)},a=function(e){i(!1),o.add({},e)},n=function(){o.typing&&(i(!1),o.add())};return u.on("init",function(){o.add()}),u.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&(n(),o.beforeChange())}),u.on("ExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&a(e)}),u.on("ObjectResizeStart Cut",function(){o.beforeChange()}),u.on("SaveContent ObjectResized blur",a),u.on("DragEnd",a),u.on("KeyUp",function(e){var t=e.keyCode;e.isDefaultPrevented()||((33<=t&&t<=36||37<=t&&t<=40||45===t||e.ctrlKey)&&(a(),u.nodeChanged()),46!==t&&8!==t||u.nodeChanged(),r&&o.typing&&!1===ny(ey(u),l[0])&&(!1===u.isDirty()&&(d(!0),u.fire("change",{level:l[0],lastLevel:null})),u.fire("TypingUndo"),r=!1,u.nodeChanged()))}),u.on("KeyDown",function(e){var t=e.keyCode;if(!e.isDefaultPrevented())if(33<=t&&t<=36||37<=t&&t<=40||45===t)o.typing&&a(e);else{var n=e.ctrlKey&&!e.altKey||e.metaKey;!(t<16||20i.custom_undo_redo_levels){for(n=0;n
                ").append(n.childNodes)}))},ay[oy="pre"]||(ay[oy]=[]),ay[oy].push(iy);var cy=function(e,t){sy(ay[e],function(e){e(t)})},ly=/^(src|href|style)$/,fy=Xt.each,dy=wc.isEq,my=function(e,t,n){return e.isChildOf(t,n)&&t!==n&&!e.isBlock(n)},gy=function(e,t,n){var r,o,i;return r=t[n?"startContainer":"endContainer"],o=t[n?"startOffset":"endOffset"],jo.isElement(r)&&(i=r.childNodes.length-1,!n&&o&&o--,r=r.childNodes[i=r.nodeValue.length&&(r=new go(r,e.getBody()).next()||r),jo.isText(r)&&!n&&0===o&&(r=new go(r,e.getBody()).prev()||r),r},py=function(e,t,n,r){var o=e.create(n,r);return t.parentNode.insertBefore(o,t),o.appendChild(t),o},hy=function(e,t,n,r,o){var i=ar.fromDom(t),a=ar.fromDom(e.create(r,o)),u=n?Wr(i):$r(i);return Mi(a,u),n?(Pi(i,a),Li(a,i)):(Ii(i,a),Fi(a,i)),a.dom()},vy=function(e,t,n,r){return!(t=wc.getNonWhiteSpaceSibling(t,n,r))||"BR"===t.nodeName||e.isBlock(t)},yy=function(e,n,r,o,i){var t,a,u,s,c,l,f,d,m,g,p,h,v,y,b=e.dom;if(c=b,!(dy(l=o,(f=n).inline)||dy(l,f.block)||(f.selector?jo.isElement(l)&&c.is(l,f.selector):void 0)||(s=o,n.links&&"A"===s.tagName)))return!1;if("all"!==n.remove)for(fy(n.styles,function(e,t){e=wc.normalizeStyleValue(b,wc.replaceVars(e,r),t),"number"==typeof t&&(t=e,i=0),(n.remove_similar||!i||dy(wc.getStyle(b,i,t),e))&&b.setStyle(o,t,""),u=1}),u&&""===b.getAttrib(o,"style")&&(o.removeAttribute("style"),o.removeAttribute("data-mce-style")),fy(n.attributes,function(e,t){var n;if(e=wc.replaceVars(e,r),"number"==typeof t&&(t=e,i=0),!i||dy(b.getAttrib(i,t),e)){if("class"===t&&(e=b.getAttrib(o,t))&&(n="",fy(e.split(/\s+/),function(e){/mce\-\w+/.test(e)&&(n+=(n?" ":"")+e)}),n))return void b.setAttrib(o,t,n);"class"===t&&o.removeAttribute("className"),ly.test(t)&&o.removeAttribute("data-mce-"+t),o.removeAttribute(t)}}),fy(n.classes,function(e){e=wc.replaceVars(e,r),i&&!b.hasClass(i,e)||b.removeClass(o,e)}),a=b.getAttribs(o),t=0;t)\s*/g,"$1"),Xt.map(e.split(/(?:>|\s+(?![^\[\]]+\]))/),function(e){var t=Xt.map(e.split(/(?:~\+|~|\+)/),$y),n=t.pop();return t.length&&(n.siblings=t),n}).reverse()):[]},Ky=function(n,e){var t,r,o,i,a,u,s="";if(!1===(u=n.settings.preview_styles))return"";"string"!=typeof u&&(u="font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow");var c=function(e){return e.replace(/%(\w+)/g,"")};if("string"==typeof e){if(!(e=n.formatter.get(e)))return;e=e[0]}return"preview"in e&&!1===(u=e.preview)?"":(t=e.block||e.inline||"span",(i=Wy(e.selector)).length?(i[0].name||(i[0].name=t),t=e.selector,r=qy(i,n)):r=qy([t],n),o=Hy.select(t,r)[0]||r.firstChild,Vy(e.styles,function(e,t){(e=c(e))&&Hy.setStyle(o,t,e)}),Vy(e.attributes,function(e,t){(e=c(e))&&Hy.setAttrib(o,t,e)}),Vy(e.classes,function(e){e=c(e),Hy.hasClass(o,e)||Hy.addClass(o,e)}),n.fire("PreviewFormats"),Hy.setStyles(r,{position:"absolute",left:-65535}),n.getBody().appendChild(r),a=Hy.getStyle(n.getBody(),"fontSize",!0),a=/px$/.test(a)?parseInt(a,10):0,Vy(u.split(" "),function(e){var t=Hy.getStyle(o,e,!0);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=Hy.getStyle(n.getBody(),e,!0),"#ffffff"===Hy.toHex(t).toLowerCase())||"color"===e&&"#000000"===Hy.toHex(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===a)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*a+"px"}"border"===e&&t&&(s+="padding:0 2px;"),s+=e+":"+t+";"}}),n.fire("AfterPreviewFormats"),Hy.remove(r),s)},Xy=function(e,t,n,r,o){var i=t.get(n);!Mm.match(e,n,r,o)||"toggle"in i[0]&&!i[0].toggle?My.applyFormat(e,n,r,o):Cy(e,n,r,o)},Yy=function(e){e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(var t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])};function Gy(e){var t,n,r,o=(t=e,n={},(r=function(e,t){e&&("string"!=typeof e?Xt.each(e,function(e,t){r(t,e)}):(t=t.length?t:[t],Xt.each(t,function(e){"undefined"==typeof e.deep&&(e.deep=!e.selector),"undefined"==typeof e.split&&(e.split=!e.selector||e.inline),"undefined"==typeof e.remove&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),n[e]=t))})(jy.get(t.dom)),r(t.settings.formats),{get:function(e){return e?n[e]:n},register:r,unregister:function(e){return e&&n[e]&&delete n[e],n}}),i=Hi(null);return Yy(e),Jm(e),{get:o.get,register:o.register,unregister:o.unregister,apply:d(My.applyFormat,e),remove:d(Cy,e),toggle:d(Xy,e,o),match:d(Mm.match,e),matchAll:d(Mm.matchAll,e),matchNode:d(Mm.matchNode,e),canApply:d(Mm.canApply,e),formatChanged:d(Uy,e,i),getCssText:d(Ky,e)}}var Jy,Qy=Object.prototype.hasOwnProperty,Zy=(Jy=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")};i--;)r=(n=e[i]).firstChild?n.firstChild.value:"","script"===t?((o=n.attr("type"))&&n.attr("type","mce-no/type"===o?null:o.replace(/^mce\-/,"")),"xhtml"===s.element_format&&0")):"xhtml"===s.element_format&&0k(n)?(C=_(b*y),b=_(C/y)):(b=_(C/y),C=_(b*y))),N.setStyles(D(s),{width:b,height:C}),r=0<(r=f.startPos.x+t)?r:0,o=0<(o=f.startPos.y+n)?o:0,N.setStyles(c,{left:r,top:o,display:"block"}),c.innerHTML=b+" × "+C,f[2]<0&&s.clientWidth<=b&&N.setStyle(s,"left",g+(h-b)),f[3]<0&&s.clientHeight<=C&&N.setStyle(s,"top",p+(v-C)),(t=A.scrollWidth-x)+(n=A.scrollHeight-w)!=0&&N.setStyles(c,{left:r-t,top:o-n}),i||(Tp(a,u,h,v),i=!0)},P=function(){i=!1;var e=function(e,t){t&&(u.style[e]||!a.schema.isValid(u.nodeName.toLowerCase(),e)?N.setStyle(D(u),e,t):N.setAttrib(D(u),e,t))};e("width",b),e("height",C),N.unbind(S,"mousemove",B),N.unbind(S,"mouseup",P),T!==S&&(N.unbind(T,"mousemove",B),N.unbind(T,"mouseup",P)),N.remove(s),N.remove(c),o(u),kp(a,u,b,C),N.setAttrib(u,"style",N.getAttrib(u,"style")),a.nodeChanged()},o=function(e){var t,r,o,n,i;I(),M(),t=N.getPos(e,A),g=t.x,p=t.y,i=e.getBoundingClientRect(),r=i.width||i.right-i.left,o=i.height||i.bottom-i.top,u!==e&&(u=e,b=C=0),n=a.fire("ObjectSelected",{target:e}),O(e)&&!n.isDefaultPrevented()?E(l,function(n,e){var t;(t=N.get("mceResizeHandle"+e))&&N.remove(t),t=N.add(A,"div",{id:"mceResizeHandle"+e,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+e+"-resize; margin:0; padding:0"}),11===fe.ie&&(t.contentEditable=!1),N.bind(t,"mousedown",function(e){var t;e.stopImmediatePropagation(),e.preventDefault(),d=(t=e).screenX,m=t.screenY,h=D(u).clientWidth,v=D(u).clientHeight,y=v/h,(f=n).startPos={x:r*n[0]+g,y:o*n[1]+p},x=A.scrollWidth,w=A.scrollHeight,s=u.cloneNode(!0),N.addClass(s,"mce-clonedresizable"),N.setAttrib(s,"data-mce-bogus","all"),s.contentEditable=!1,s.unSelectabe=!0,N.setStyles(s,{left:g,top:p,margin:0}),s.removeAttribute("data-mce-selected"),A.appendChild(s),N.bind(S,"mousemove",B),N.bind(S,"mouseup",P),T!==S&&(N.bind(T,"mousemove",B),N.bind(T,"mouseup",P)),c=N.add(A,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},h+" × "+v)}),n.elm=t,N.setStyles(t,{left:r*n[0]+g-t.offsetWidth/2,top:o*n[1]+p-t.offsetHeight/2})}):I(),u.setAttribute("data-mce-selected","1")},I=function(){var e,t;for(e in M(),u&&u.removeAttribute("data-mce-selected"),l)(t=N.get("mceResizeHandle"+e))&&(N.unbind(t),N.remove(t))},L=function(e){var t,n=function(e,t){if(e)do{if(e===t)return!0}while(e=e.parentNode)};i||a.removed||(E(N.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),t="mousedown"===e.type?e.target:r.getNode(),n(t=N.$(t).closest("table,img,figure.image,hr")[0],A)&&(z(),n(r.getStart(!0),t)&&n(r.getEnd(!0),t))?o(t):I())},F=function(e){return Ab(function(e,t){for(;t&&t!==e;){if(Rb(t)||Ab(t))return t;t=t.parentNode}return null}(a.getBody(),e))},M=function(){for(var e in l){var t=l[e];t.elm&&(N.unbind(t.elm),delete t.elm)}},z=function(){try{a.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}};return a.on("init",function(){z(),fe.ie&&11<=fe.ie&&(a.on("mousedown click",function(e){var t=e.target,n=t.nodeName;i||!/^(TABLE|IMG|HR)$/.test(n)||F(t)||(2!==e.button&&a.selection.select(t,"TABLE"===n),"mousedown"===e.type&&a.nodeChanged())}),a.dom.bind(A,"mscontrolselect",function(e){var t=function(e){he.setEditorTimeout(a,function(){a.selection.select(e)})};if(F(e.target))return e.preventDefault(),void t(e.target);/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"===e.target.tagName&&t(e.target))}));var t=he.throttle(function(e){a.composing||L(e)});a.on("nodechange ResizeEditor ResizeWindow drop FullscreenStateChanged",t),a.on("keyup compositionend",function(e){u&&"TABLE"===u.nodeName&&t(e)}),a.on("hide blur",I),a.on("contextmenu",n)}),a.on("remove",M),{isResizable:O,showResizeRect:o,hideResizeRect:I,updateResizeRect:L,destroy:function(){u=s=null}}},Ob=function(e){return jo.isContentEditableTrue(e)||jo.isContentEditableFalse(e)},Bb=function(e,t,n){var r,o,i,a,u,s=n;if(s.caretPositionFromPoint)(o=s.caretPositionFromPoint(e,t))&&((r=n.createRange()).setStart(o.offsetNode,o.offset),r.collapse(!0));else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(s.body.createTextRange){r=s.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(c){r=function(e,n,t){var r,o,i;if(r=t.elementFromPoint(e,n),o=t.body.createTextRange(),r&&"HTML"!==r.tagName||(r=t.body),o.moveToElementText(r),0<(i=(i=Xt.toArray(o.getClientRects())).sort(function(e,t){return(e=Math.abs(Math.max(e.top-n,e.bottom-n)))-(t=Math.abs(Math.max(t.top-n,t.bottom-n)))})).length){n=(i[0].bottom+i[0].top)/2;try{return o.moveToPoint(e,n),o.collapse(!0),o}catch(a){}}return null}(e,t,n)}return i=r,a=n.body,u=i&&i.parentElement?i.parentElement():null,jo.isContentEditableFalse(function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(u,a,Ob))?null:i}return r},Pb=function(n,e){return W(e,function(e){var t=n.fire("GetSelectionRange",{range:e});return t.range!==e?t.range:e})},Ib=function(e,t){var n=(t||V.document).createDocumentFragment();return z(e,function(e){n.appendChild(e.dom())}),ar.fromDom(n)},Lb=Ar("element","width","rows"),Fb=Ar("element","cells"),Mb=Ar("x","y"),zb=function(e,t){var n=parseInt(Er(e,t),10);return isNaN(n)?1:n},Ub=function(e){return j(e,function(e,t){return t.cells().length>e?t.cells().length:e},0)},jb=function(e,t){for(var n=e.rows(),r=0;r_'+t),e.dom.remove("__mce_tmp")):l.pasteHTML(t)}u.no_events||e.fire("SetContent",u)}else e.fire("SetContent",u)},eC=function(e,t,n,r,o){var i=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return _.from(i).map(ar.fromDom).map(function(e){return r&&t.collapsed?e:Xr(e,o(e,a)).getOr(e)}).bind(function(e){return dr(e)?_.some(e):Vr(e)}).map(function(e){return e.dom()}).getOr(e)},tC=function(e,t,n){return eC(e,t,!0,n,function(e,t){return Math.min(e.dom().childNodes.length,t)})},nC=function(e,t,n){return eC(e,t,!1,n,function(e,t){return 0t.clientHeight){e=t;break}t=t.parentNode}return e},scrollIntoView:function(e,t){return og(c,e,t)},placeCaretAt:function(e,t){return i(Bb(e,t,c.getDoc()))},getBoundingClientRect:function(){var e=m();return e.collapsed?_u.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:function(){s=l=f=null,t.destroy()}};return n=_b(p),t=Db(p,c),p.bookmarkManager=n,p.controlSelection=t,p};(kb=Tb||(Tb={}))[kb.Br=0]="Br",kb[kb.Block=1]="Block",kb[kb.Wrap=2]="Wrap",kb[kb.Eol=3]="Eol";var sC=function(e,t){return e===Tu.Backwards?t.reverse():t},cC=function(e,t,n,r){for(var o,i,a,u,s,c,l=Js(n),f=r,d=[];f&&(s=l,c=f,o=t===Tu.Forwards?s.next(c):s.prev(c));){if(jo.isBr(o.getNode(!1)))return t===Tu.Forwards?{positions:sC(t,d).concat([o]),breakType:Tb.Br,breakAt:_.some(o)}:{positions:sC(t,d),breakType:Tb.Br,breakAt:_.some(o)};if(o.isVisible()){if(e(f,o)){var m=(i=t,a=f,u=o,jo.isBr(u.getNode(i===Tu.Forwards))?Tb.Br:!1===Ts(a,u)?Tb.Block:Tb.Wrap);return{positions:sC(t,d),breakType:m,breakAt:_.some(o)}}d.push(o),f=o}else f=o}return{positions:sC(t,d),breakType:Tb.Eol,breakAt:_.none()}},lC=function(n,r,o,e){return r(o,e).breakAt.map(function(e){var t=r(o,e).positions;return n===Tu.Backwards?t.concat(e):[e].concat(t)}).getOr([])},fC=function(e,i){return j(e,function(e,o){return e.fold(function(){return _.some(o)},function(r){return ru(Z(r.getClientRects()),Z(o.getClientRects()),function(e,t){var n=Math.abs(i-e.left);return Math.abs(i-t.left)<=n?o:r}).or(e)})},_.none())},dC=function(t,e){return Z(e.getClientRects()).bind(function(e){return fC(t,e.left)})},mC=d(cC,Su.isAbove,-1),gC=d(cC,Su.isBelow,1),pC=d(lC,-1,mC),hC=d(lC,1,gC),vC=jo.isContentEditableFalse,yC=Za,bC=function(e,t,n,r){var o=e===Tu.Forwards,i=o?Lf:Ff;if(!r.collapsed){var a=yC(r);if(vC(a))return sg(e,t,a,e===Tu.Backwards,!0)}var u=Sa(r.startContainer),s=Ps(e,t.getBody(),r);if(i(s))return cg(t,s.getNode(!o));var c=Vl.normalizePosition(o,n(s));if(!c)return u?r:null;if(i(c))return sg(e,t,c.getNode(!o),o,!0);var l=n(c);return l&&i(l)&&Fs(c,l)?sg(e,t,l.getNode(!o),o,!0):u?fg(t,c.toRange(),!0):null},CC=function(e,t,n,r){var o,i,a,u,s,c,l,f,d;if(d=yC(r),o=Ps(e,t.getBody(),r),i=n(t.getBody(),sv(1),o),a=U(i,cv(1)),s=Ht.last(o.getClientRects()),(Lf(o)||zf(o))&&(d=o.getNode()),(Ff(o)||Uf(o))&&(d=o.getNode(!0)),!s)return null;if(c=s.left,(u=pv(a,c))&&vC(u.node))return l=Math.abs(c-u.left),f=Math.abs(c-u.right),sg(e,t,u.node,l'),o=a,1===t?e.$(r).after(o):e.$(r).before(o),e.selection.select(o,!0),e.selection.collapse())}},wC=function(l,f){return function(){var e,t,n,r,o,i,a,u,s,c=(t=f,r=Js((e=l).getBody()),o=d(Ls,r.next),i=d(Ls,r.prev),a=t?Tu.Forwards:Tu.Backwards,u=t?o:i,s=e.selection.getRng(),(n=bC(a,e,u,s))?n:(n=xC(e,a,s))||null);return!!c&&(dg(l,c),!0)}},NC=function(u,s){return function(){var e,t,n,r,o,i,a=(r=(t=s)?1:-1,o=t?uv:av,i=(e=u).selection.getRng(),(n=CC(r,e,o,i))?n:(n=xC(e,r,i))||null);return!!a&&(dg(u,a),!0)}},EC=function(r,o){return function(){var t,e=o?_u.fromRangeEnd(r.selection.getRng()):_u.fromRangeStart(r.selection.getRng()),n=o?gC(r.getBody(),e):mC(r.getBody(),e);return(o?ee(n.positions):Z(n.positions)).filter((t=o,function(e){return t?Ff(e):Lf(e)})).fold(q(!1),function(e){return r.selection.setRng(e.toRange()),!0})}},SC=function(e,t,n,r,o){var i,a,u,s,c=Qi(ar.fromDom(n),"td,th,caption").map(function(e){return e.dom()}),l=U((i=e,G(c,function(e){var t,n,r=(t=Ka(e.getBoundingClientRect()),n=-1,{left:t.left-n,top:t.top-n,right:t.right+2*n,bottom:t.bottom+2*n,width:t.width+n,height:t.height+n});return[{x:r.left,y:i(r),cell:e},{x:r.right,y:i(r),cell:e}]})),function(e){return t(e,o)});return(a=l,u=r,s=o,j(a,function(e,r){return e.fold(function(){return _.some(r)},function(e){var t=Math.sqrt(Math.abs(e.x-u)+Math.abs(e.y-s)),n=Math.sqrt(Math.abs(r.x-u)+Math.abs(r.y-s));return _.some(nt}),_C=function(t,n){return Z(n.getClientRects()).bind(function(e){return TC(t,e.left,e.top)}).bind(function(e){return dC((t=e,sc.lastPositionIn(t).map(function(e){return mC(t,e).positions.concat(e)}).getOr([])),n);var t})},AC=function(t,n){return ee(n.getClientRects()).bind(function(e){return kC(t,e.left,e.top)}).bind(function(e){return dC((t=e,sc.firstPositionIn(t).map(function(e){return[e].concat(gC(t,e).positions)}).getOr([])),n);var t})},RC=function(e,t,n){var r,o,i,a,u=e(t,n);return(a=u).breakType===Tb.Wrap&&0===a.positions.length||!jo.isBr(n.getNode())&&(i=u).breakType===Tb.Br&&1===i.positions.length?(r=e,o=t,!u.breakAt.map(function(e){return r(o,e).breakAt.isSome()}).getOr(!1)):u.breakAt.isNone()},DC=d(RC,mC),OC=d(RC,gC),BC=function(e,t,n,r){var o,i,a,u,s=e.selection.getRng(),c=t?1:-1;if(ms()&&(o=t,i=s,a=n,u=_u.fromRangeStart(i),sc.positionIn(!o,a).map(function(e){return e.isEqual(u)}).getOr(!1))){var l=sg(c,e,n,!t,!0);return dg(e,l),!0}return!1},PC=function(e,t){var n=t.getNode(e);return jo.isElement(n)&&"TABLE"===n.nodeName?_.some(n):_.none()},IC=function(u,s,c){var e=PC(!!s,c),t=!1===s;e.fold(function(){return dg(u,c.toRange())},function(a){return sc.positionIn(t,u.getBody()).filter(function(e){return e.isEqual(c)}).fold(function(){return dg(u,c.toRange())},function(e){return n=s,o=a,t=c,void((i=Nl(r=u))?r.undoManager.transact(function(){var e=ar.fromTag(i);Nr(e,El(r)),Fi(e,ar.fromTag("br")),n?Ii(ar.fromDom(o),e):Pi(ar.fromDom(o),e);var t=r.dom.createRng();t.setStart(e.dom(),0),t.setEnd(e.dom(),0),dg(r,t)}):dg(r,t.toRange()));var n,r,o,t,i})})},LC=function(e,t,n,r){var o,i,a,u,s,c,l=e.selection.getRng(),f=_u.fromRangeStart(l),d=e.getBody();if(!t&&DC(r,f)){var m=(u=d,_C(s=n,c=f).orThunk(function(){return Z(c.getClientRects()).bind(function(e){return fC(pC(u,_u.before(s)),e.left)})}).getOr(_u.before(s)));return IC(e,t,m),!0}return!(!t||!OC(r,f))&&(o=d,m=AC(i=n,a=f).orThunk(function(){return Z(a.getClientRects()).bind(function(e){return fC(hC(o,_u.after(i)),e.left)})}).getOr(_u.after(i)),IC(e,t,m),!0)},FC=function(t,n){return function(){return _.from(t.dom.getParent(t.selection.getNode(),"td,th")).bind(function(e){return _.from(t.dom.getParent(e,"table")).map(function(e){return BC(t,n,e)})}).getOr(!1)}},MC=function(n,r){return function(){return _.from(n.dom.getParent(n.selection.getNode(),"td,th")).bind(function(t){return _.from(n.dom.getParent(t,"table")).map(function(e){return LC(n,r,e,t)})}).getOr(!1)}},zC=function(e){return F(["figcaption"],lr(e))},UC=function(e){var t=V.document.createRange();return t.setStartBefore(e.dom()),t.setEndBefore(e.dom()),t},jC=function(e,t,n){n?Fi(e,t):Li(e,t)},VC=function(e,t,n,r){return""===t?(l=e,f=r,d=ar.fromTag("br"),jC(l,d,f),UC(d)):(o=e,i=r,a=t,u=n,s=ar.fromTag(a),c=ar.fromTag("br"),Nr(s,u),Fi(s,c),jC(o,s,i),UC(c));var o,i,a,u,s,c,l,f,d},HC=function(e,t,n){return t?(o=e.dom(),gC(o,n).breakAt.isNone()):(r=e.dom(),mC(r,n).breakAt.isNone());var r,o},qC=function(t,n){var e,r,o,i=ar.fromDom(t.getBody()),a=_u.fromRangeStart(t.selection.getRng()),u=Nl(t),s=El(t);return(e=a,r=i,o=d(Mr,r),na(ar.fromDom(e.container()),Co,o).filter(zC)).exists(function(){if(HC(i,n,a)){var e=VC(i,u,s,n);return t.selection.setRng(e),!0}return!1})},$C=function(e,t){return function(){return!!e.selection.isCollapsed()&&qC(e,t)}},WC=function(e,r){return G(W(e,function(e){return Zy({shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0,action:o},e)}),function(e){return t=e,(n=r).keyCode===t.keyCode&&n.shiftKey===t.shiftKey&&n.altKey===t.altKey&&n.ctrlKey===t.ctrlKey&&n.metaKey===t.metaKey?[e]:[];var t,n})},KC=function(e){for(var t=[],n=1;n'},cx=function(e,t){return e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t},lx=function(e,t){return t&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&"true"!==e.getContentEditable(t)},fx=function(e,t,n){return!1===jo.isText(t)?n:e?1===n&&t.data.charAt(n-1)===xa?0:n:n===t.data.length-1&&t.data.charAt(n)===xa?t.data.length:n},dx=function(e,t){var n,r,o=e.getRoot();for(n=t;n!==o&&"false"!==e.getContentEditable(n);)"true"===e.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==o?r:o},mx=function(o,i,e){_.from(e.style).map(o.dom.parseStyle).each(function(e){var t=function(e){var t={},n=e.dom();if(Cr(n))for(var r=0;rs.childNodes.length-1,s=s.childNodes[Math.min(i,s.childNodes.length-1)]||s,i=g&&jo.isText(s)?s.nodeValue.length:0),(u=dx(x,s))&&((m&&!n||!m&&n)&&(s=function(e,t,n,r,o){var i,a,u,s,c,l,f,d=t||"P",m=e.dom,g=dx(m,r);if(!(a=m.getParent(r,m.isBlock))||!lx(m,a)){if(l=(a=a||g)===e.getBody()||(f=a)&&/^(TD|TH|CAPTION)$/.test(f.nodeName)?a.nodeName.toLowerCase():a.parentNode.nodeName.toLowerCase(),!a.hasChildNodes())return i=m.create(d),gx(e,i),a.appendChild(i),n.setStart(i,0),n.setEnd(i,0),i;for(s=r;s.parentNode!==a;)s=s.parentNode;for(;s&&!m.isBlock(s);)s=(u=s).previousSibling;if(u&&e.schema.isValidChild(l,d.toLowerCase())){for(i=m.create(d),gx(e,i),u.parentNode.insertBefore(i,u),s=u;s&&!m.isBlock(s);)c=s.nextSibling,i.appendChild(s),s=c;n.setStart(r,o),n.setEnd(r,o)}}return r}(a,m,E,s,i)),c=x.getParent(s,x.isBlock),l=c?x.getParent(c.parentNode,x.isBlock):null,f=c?c.nodeName.toUpperCase():"","LI"!==(d=l?l.nodeName.toUpperCase():"")||e.ctrlKey||(l=(c=l).parentNode,f=d),/^(LI|DT|DD)$/.test(f)&&x.isEmpty(c)?ux(a,S,l,c,m):m&&c===a.getBody()||(m=m||"P",Sa(c)?(r=Pa(c),x.isEmpty(c)&&sx(c),gx(a,r),QC(a,r)):T()?k():T(!0)?(r=c.parentNode.insertBefore(S(),c),QC(a,cx(c,"HR")?r:c)):((t=(b=E,C=b.cloneRange(),C.setStart(b.startContainer,fx(!0,b.startContainer,b.startOffset)),C.setEnd(b.endContainer,fx(!1,b.endContainer,b.endOffset)),C).cloneRange()).setEndAfter(c),o=t.extractContents(),y=o,z(Ji(ar.fromDom(y),mr),function(e){var t=e.dom();t.nodeValue=wa(t.nodeValue)}),function(e){for(;jo.isText(e)&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;);}(o),r=o.firstChild,x.insertAfter(o,c),function(e,t,n){var r,o=n,i=[];if(o){for(;o=o.firstChild;){if(e.isBlock(o))return;jo.isElement(o)&&!t[o.nodeName.toLowerCase()]&&i.push(o)}for(r=i.length;r--;)!(o=i[r]).hasChildNodes()||o.firstChild===o.lastChild&&""===o.firstChild.nodeValue?e.remove(o):(a=e,(u=o)&&"A"===u.nodeName&&a.isEmpty(u)&&e.remove(o));var a,u}}(x,N,r),p=x,(h=c).normalize(),(v=h.lastChild)&&!/^(left|right)$/gi.test(p.getStyle(v,"float",!0))||p.add(h,"br"),x.isEmpty(c)&&sx(c),r.normalize(),x.isEmpty(r)?(x.remove(r),k()):(gx(a,r),QC(a,r))),x.setAttrib(r,"id",""),a.fire("NewBlock",{newBlock:r})))},hx=function(e,t){return ex(e).filter(function(e){return 0",yl(f)!==f.documentBaseUrl&&(g+=''),g+='',d=bl(f),m=Cl(f),xl(f)&&(g+=''),g+='
                '),Cw.add(t.iframeContainer,l),p},ww=function(e,t){var n=xw(e,t);t.editorContainer&&(Cw.get(t.editorContainer).style.display=e.orgDisplay,e.hidden=Cw.isHidden(t.editorContainer)),e.getElement().style.display="none",Cw.setAttrib(e.id,"aria-hidden","true"),n||bw(e)},Nw=Si.DOM,Ew=function(t,n,e){var r=_h.get(e),o=_h.urls[e]||t.documentBaseUrl.replace(/\/$/,"");if(e=Xt.trim(e),r&&-1===Xt.inArray(n,e)){if(Xt.each(_h.dependencies(e),function(e){Ew(t,n,e)}),t.plugins[e])return;try{var i=new r(t,o,t.$);(t.plugins[e]=i).init&&(i.init(t,o),n.push(e))}catch(iE){kh.pluginInitError(t,e,iE)}}},Sw=function(e){return e.replace(/^\-/,"")},Tw=function(e){return{editorContainer:e,iframeContainer:e}},kw=function(e){var t,n,r=e.getElement();return e.inline?Tw(null):(t=r,n=Nw.create("div"),Nw.insertAfter(n,t),Tw(n))},_w=function(e){var t,n,r,o,i,a,u,s,c,l,f,d=e.settings,m=e.getElement();return e.orgDisplay=m.style.display,S(d.theme)?(l=(o=e).settings,f=o.getElement(),i=l.width||Nw.getStyle(f,"width")||"100%",a=l.height||Nw.getStyle(f,"height")||f.offsetHeight,u=l.min_height||100,(s=/^[0-9\.]+(|px)$/i).test(""+i)&&(i=Math.max(parseInt(i,10),100)),s.test(""+a)&&(a=Math.max(parseInt(a,10),u)),c=o.theme.renderUI({targetNode:f,width:i,height:a,deltaWidth:l.delta_width,deltaHeight:l.delta_height}),l.content_editable||(a=(c.iframeHeight||a)+("number"==typeof a?c.deltaHeight||0:""))=n.length)for(r=0,o=e.length;r=n.length||e[r]!==n[r]){i=r+1;break}if(e.length=e.length||e[r]!==n[r]){i=r+1;break}if(1===i)return t;for(r=0,o=e.length-(i-1);r]*>( | |\\s|\xa0|
                |)<\\/"+a+">[\r\n]*|
                [\r\n]*)$"),r=i.replace(u,"")}return"text"===t.format||Ao(ar.fromDom(n))?t.content=r:t.content=Xt.trim(r),t.no_events||e.fire("GetContent",t),t.content},jw=function(e,t){t(e),e.firstChild&&jw(e.firstChild,t),e.next&&jw(e.next,t)},Vw=function(e,t,n){var r=function(e,n,t){var r={},o={},i=[];for(var a in t.firstChild&&jw(t.firstChild,function(t){z(e,function(e){e.name===t.name&&(r[e.name]?r[e.name].nodes.push(t):r[e.name]={filter:e,nodes:[t]})}),z(n,function(e){"string"==typeof t.attr(e.name)&&(o[e.name]?o[e.name].nodes.push(t):o[e.name]={filter:e,nodes:[t]})})}),r)r.hasOwnProperty(a)&&i.push(r[a]);for(var a in o)o.hasOwnProperty(a)&&i.push(o[a]);return i}(e,t,n);z(r,function(t){z(t.filter.callbacks,function(e){e(t.nodes,t.filter.name,{})})})},Hw=function(e){return e instanceof sb},qw=function(e,t){var r;e.dom.setHTML(e.getBody(),t),sh(r=e)&&sc.firstPositionIn(r.getBody()).each(function(e){var t=e.getNode(),n=jo.isTable(t)?sc.firstPositionIn(t).getOr(e):e;r.selection.setRng(n.toRange())})},$w=function(u,s,c){return void 0===c&&(c={}),c.format=c.format?c.format:"html",c.set=!0,c.content=Hw(s)?"":s,Hw(s)||c.no_events||(u.fire("BeforeSetContent",c),s=c.content),_.from(u.getBody()).fold(q(s),function(e){return Hw(s)?function(e,t,n,r){Vw(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);var o=al({validate:e.validate},e.schema).serialize(n);return r.content=Ao(ar.fromDom(t))?o:Xt.trim(o),qw(e,r.content),r.no_events||e.fire("SetContent",r),n}(u,e,s,c):(t=u,n=e,o=c,0===(r=s).length||/^\s+$/.test(r)?(a='
                ',"TABLE"===n.nodeName?r=""+a+"":/^(UL|OL)$/.test(n.nodeName)&&(r="
              • "+a+"
              • "),(i=Nl(t))&&t.schema.isValidChild(n.nodeName.toLowerCase(),i.toLowerCase())?(r=a,r=t.dom.createHTML(i,t.settings.forced_root_block_attrs,r)):r||(r='
                '),qw(t,r),t.fire("SetContent",o)):("raw"!==o.format&&(r=al({validate:t.validate},t.schema).serialize(t.parser.parse(r,{isRootContent:!0,insert:!0}))),o.content=Ao(ar.fromDom(n))?r:Xt.trim(r),qw(t,o.content),o.no_events||t.fire("SetContent",o)),o.content);var t,n,r,o,i,a})},Ww=Si.DOM,Kw=function(e){return _.from(e).each(function(e){return e.destroy()})},Xw=function(e){if(!e.removed){var t=e._selectionOverrides,n=e.editorUpload,r=e.getBody(),o=e.getElement();r&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&o&&Ww.remove(o.nextSibling),Np(e),e.editorManager.remove(e),!e.inline&&r&&(i=e,Ww.setStyle(i.id,"display",i.orgDisplay)),Ep(e),Ww.remove(e.getContainer()),Kw(t),Kw(n),e.destroy()}var i},Yw=function(e,t){var n,r,o,i=e.selection,a=e.dom;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),Kw(i),Kw(a)),(r=(n=e).formElement)&&(r._mceOldSubmit&&(r.submit=r._mceOldSubmit,r._mceOldSubmit=null),Ww.unbind(r,"submit reset",n.formEventDelegate)),(o=e).contentAreaContainer=o.formElement=o.container=o.editorContainer=null,o.bodyElement=o.contentDocument=o.contentWindow=null,o.iframeElement=o.targetElm=null,o.selection&&(o.selection=o.selection.win=o.selection.dom=o.selection.dom.doc=null),e.destroyed=!0):e.remove())},Gw=Si.DOM,Jw=Xt.extend,Qw=Xt.each,Zw=Xt.resolve,eN=fe.ie,tN=function(e,t,n){var r,o,i,a,u,s,c,l=this,f=l.documentBaseUrl=n.documentBaseURL,d=n.baseURI;r=l,o=e,i=f,a=n.defaultSettings,u=t,c={id:o,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:i,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:!0,object_resizing:!0,doctype:"",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,render_ui:!0,indentation:"40px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",entity_encoding:"named",url_converter:(s=r).convertURL,url_converter_scope:s,ie7_compat:!0},t=$p(zp,c,a,u),l.settings=t,Bi.language=t.language||"en",Bi.languageLoad=t.language_load,Bi.baseURL=n.baseURL,l.id=e,l.setDirty(!1),l.plugins={},l.documentBaseURI=new zw(t.document_base_url,{base_uri:d}),l.baseURI=d,l.contentCSS=[],l.contentStyles=[],l.shortcuts=new Qp(l),l.loadedCSS={},l.editorCommands=new pp(l),l.suffix=n.suffix,l.editorManager=n,l.inline=t.inline,l.buttons={},l.menuItems={},t.cache_suffix&&(fe.cacheSuffix=t.cache_suffix.replace(/^[\?\&]+/,"")),!1===t.override_viewport&&(fe.overrideViewPort=!1),n.fire("SetupEditor",{editor:l}),l.execCallback("setup",l),l.$=gn.overrideDefaults(function(){return{context:l.inline?l.getBody():l.getDoc(),element:l.getBody()}})};Jw(tN.prototype={render:function(){Bw(this)},focus:function(e){uh(this,e)},hasFocus:function(){return sh(this)},execCallback:function(e){for(var t=[],n=1;n=n.x&&o.x+o.w<=n.w+n.x&&o.y>=n.y&&o.y+o.h<=n.h+n.y)return r[i];return null},intersect:function(e,t){var n,r,o,i;return n=ON(e.x,t.x),r=ON(e.y,t.y),o=DN(e.x+e.w,t.x+t.w),i=DN(e.y+e.h,t.y+t.h),o-n<0||i-r<0?null:IN(n,r,o-n,i-r)},clamp:function(e,t,n){var r,o,i,a,u,s,c,l,f,d;return u=e.x,s=e.y,c=e.x+e.w,l=e.y+e.h,f=t.x+t.w,d=t.y+t.h,r=ON(0,t.x-u),o=ON(0,t.y-s),i=ON(0,c-f),a=ON(0,l-d),u+=r,s+=o,n&&(c+=r,l+=o,u-=i,s-=a),IN(u,s,(c-=i)-u,(l-=a)-s)},create:IN,fromClientRect:function(e){return IN(e.left,e.top,e.width,e.height)}},FN={},MN={add:function(e,t){FN[e.toLowerCase()]=t},has:function(e){return!!FN[e.toLowerCase()]},get:function(e){var t=e.toLowerCase(),n=FN.hasOwnProperty(t)?FN[t]:null;if(null===n)throw new Error("Could not find module for type: "+e);return n},create:function(e,t){var n;if("string"==typeof e?(t=t||{}).type=e:e=(t=e).type,e=e.toLowerCase(),!(n=FN[e]))throw new Error("Could not find control by type: "+e);return(n=new n(t)).type=e,n}},zN=Xt.each,UN=Xt.extend,jN=function(){};jN.extend=_N=function(n){var e,t,r,o=this.prototype,i=function(){var e,t,n;if(!AN&&(this.init&&this.init.apply(this,arguments),t=this.Mixins))for(e=t.length;e--;)(n=t[e]).init&&n.init.apply(this,arguments)},a=function(){return this},u=function(n,r){return function(){var e,t=this._super;return this._super=o[n],e=r.apply(this,arguments),this._super=t,e}};for(t in AN=!0,e=new this,AN=!1,n.Mixins&&(zN(n.Mixins,function(e){for(var t in e)"init"!==t&&(n[t]=e[t])}),o.Mixins&&(n.Mixins=o.Mixins.concat(n.Mixins))),n.Methods&&zN(n.Methods.split(","),function(e){n[e]=a}),n.Properties&&zN(n.Properties.split(","),function(e){var t="_"+e;n[e]=function(e){return e!==undefined?(this[t]=e,this):this[t]}}),n.Statics&&zN(n.Statics,function(e,t){i[t]=e}),n.Defaults&&o.Defaults&&(n.Defaults=UN({},o.Defaults,n.Defaults)),n)"function"==typeof(r=n[t])&&o[t]?e[t]=u(t,r):e[t]=r;return i.prototype=e,(i.constructor=i).extend=_N,i};var VN=Math.min,HN=Math.max,qN=Math.round,$N=function(e,n){var r,o,t,i;if(n=n||'"',null===e)return"null";if("string"==(t=typeof e))return o="\bb\tt\nn\ff\rr\"\"''\\\\",n+e.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(e,t){return'"'===n&&"'"===e?e:(r=o.indexOf(t))+1?"\\"+o.charAt(r+1):(e=t.charCodeAt().toString(16),"\\u"+"0000".substring(e.length)+e)})+n;if("object"===t){if(e.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(e)){for(r=0,o="[";r+~]|"+at+")"+at+"*"),mt=new RegExp("="+at+"*([^\\]'\"]*?)"+at+"*\\]","g"),gt=new RegExp(ct),pt=new RegExp("^"+ut+"$"),ht={ID:new RegExp("^#("+ut+")"),CLASS:new RegExp("^\\.("+ut+")"),TAG:new RegExp("^("+ut+"|[*])"),ATTR:new RegExp("^"+st),PSEUDO:new RegExp("^"+ct),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+at+"*(even|odd|(([+-]|)(\\d*)n|)"+at+"*(?:([+-]|)"+at+"*(\\d+)|))"+at+"*\\)|)","i"),bool:new RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$","i"),needsContext:new RegExp("^"+at+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+at+"*((?:-\\d)?\\d*)"+at+"*\\)|)(?=[^-]|$)","i")},vt=/^(?:input|select|textarea|button)$/i,yt=/^h\d$/i,bt=/^[^{]+\{\s*\[native \w/,Ct=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xt=/[+~]/,wt=/'|\\/g,Nt=new RegExp("\\\\([\\da-f]{1,6}"+at+"?|("+at+")|.)","ig"),Et=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{rt.apply(et=ot.call($e.childNodes),$e.childNodes),et[$e.childNodes.length].nodeType}catch(iE){rt={apply:et.length?function(e,t){nt.apply(e,ot.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}var St=function(e,t,n,r){var o,i,a,u,s,c,l,f,d,m;if((t?t.ownerDocument||t:$e)!==Me&&Fe(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(u=(t=t||Me).nodeType)&&9!==u)return[];if(Ue&&!r){if(o=Ct.exec(e))if(a=o[1]){if(9===u){if(!(i=t.getElementById(a))||!i.parentNode)return n;if(i.id===a)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(a))&&He(t,i)&&i.id===a)return n.push(i),n}else{if(o[2])return rt.apply(n,t.getElementsByTagName(e)),n;if((a=o[3])&&ke.getElementsByClassName)return rt.apply(n,t.getElementsByClassName(a)),n}if(ke.qsa&&(!je||!je.test(e))){if(f=l=qe,d=t,m=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){for(c=De(e),(l=t.getAttribute("id"))?f=l.replace(wt,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",s=c.length;s--;)c[s]=f+Pt(c[s]);d=xt.test(e)&&Ot(t.parentNode)||t,m=c.join(",")}if(m)try{return rt.apply(n,d.querySelectorAll(m)),n}catch(g){}finally{l||t.removeAttribute("id")}}}return Be(e.replace(lt,"$1"),t,n,r)};function Tt(){var r=[];return function e(t,n){return r.push(t+" ")>_e.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function kt(e){return e[qe]=!0,e}function _t(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||1<<31)-(~e.sourceIndex||1<<31);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function At(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function Rt(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function Dt(a){return kt(function(i){return i=+i,kt(function(e,t){for(var n,r=a([],e.length,i),o=r.length;o--;)e[n=r[o]]&&(e[n]=!(t[n]=e[n]))})})}function Ot(e){return e&&typeof e.getElementsByTagName!==Qe&&e}for(Te in ke=St.support={},Re=St.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},Fe=St.setDocument=function(e){var t,s=e?e.ownerDocument||e:$e,n=s.defaultView;return s!==Me&&9===s.nodeType&&s.documentElement?(ze=(Me=s).documentElement,Ue=!Re(s),n&&n!==function(e){try{return e.top}catch(t){}return null}(n)&&(n.addEventListener?n.addEventListener("unload",function(){Fe()},!1):n.attachEvent&&n.attachEvent("onunload",function(){Fe()})),ke.attributes=!0,ke.getElementsByTagName=!0,ke.getElementsByClassName=bt.test(s.getElementsByClassName),ke.getById=!0,_e.find.ID=function(e,t){if(typeof t.getElementById!==Qe&&Ue){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},_e.filter.ID=function(e){var t=e.replace(Nt,Et);return function(e){return e.getAttribute("id")===t}},_e.find.TAG=ke.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==Qe)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},_e.find.CLASS=ke.getElementsByClassName&&function(e,t){if(Ue)return t.getElementsByClassName(e)},Ve=[],je=[],ke.disconnectedMatch=!0,je=je.length&&new RegExp(je.join("|")),Ve=Ve.length&&new RegExp(Ve.join("|")),t=bt.test(ze.compareDocumentPosition),He=t||bt.test(ze.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Je=t?function(e,t){if(e===t)return Le=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!ke.sortDetached&&t.compareDocumentPosition(e)===n?e===s||e.ownerDocument===$e&&He($e,e)?-1:t===s||t.ownerDocument===$e&&He($e,t)?1:Ie?it.call(Ie,e)-it.call(Ie,t):0:4&n?-1:1)}:function(e,t){if(e===t)return Le=!0,0;var n,r=0,o=e.parentNode,i=t.parentNode,a=[e],u=[t];if(!o||!i)return e===s?-1:t===s?1:o?-1:i?1:Ie?it.call(Ie,e)-it.call(Ie,t):0;if(o===i)return _t(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;a[r]===u[r];)r++;return r?_t(a[r],u[r]):a[r]===$e?-1:u[r]===$e?1:0},s):Me},St.matches=function(e,t){return St(e,null,null,t)},St.matchesSelector=function(e,t){if((e.ownerDocument||e)!==Me&&Fe(e),t=t.replace(mt,"='$1']"),ke.matchesSelector&&Ue&&(!Ve||!Ve.test(t))&&(!je||!je.test(t)))try{var n=(void 0).call(e,t);if(n||ke.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(iE){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Nt,Et),e[3]=(e[3]||e[4]||e[5]||"").replace(Nt,Et),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||St.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&St.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return ht.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&>.test(n)&&(t=De(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Nt,Et).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=Xe[e+" "];return t||(t=new RegExp("(^|"+at+")"+e+"("+at+"|$)"))&&Xe(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Qe&&e.getAttribute("class")||"")})},ATTR:function(n,r,o){return function(e){var t=St.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===o:"!="===r?t!==o:"^="===r?o&&0===t.indexOf(o):"*="===r?o&&-1)[^>]*$|#([\w\-]*)$)/,Zt=Se.Event,en=Xt.makeMap("children,contents,next,prev"),tn=function(e){return void 0!==e},nn=function(e){return"string"==typeof e},rn=function(e,t){var n,r,o;for(o=(t=t||Yt).createElement("div"),n=t.createDocumentFragment(),o.innerHTML=e;r=o.firstChild;)n.appendChild(r);return n},on=function(e,t,n,r){var o;if(nn(t))t=rn(t,bn(e[0]));else if(t.length&&!t.nodeType){if(t=gn.makeArray(t),r)for(o=t.length-1;0<=o;o--)on(e,t[o],n,r);else for(o=0;o"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:Qt.exec(e)))return gn(t).find(e);if(n[1])for(r=rn(e,bn(t)).firstChild;r;)Gt.call(o,r),r=r.nextSibling;else{if(!(r=bn(t).getElementById(n[2])))return o;if(r.id!==n[2])return o.find(e);o.length=1,o[0]=r}}else this.add(e,!1);return o},toArray:function(){return Xt.toArray(this)},add:function(e,t){var n,r,o=this;if(nn(e))return o.add(gn(e));if(!1!==t)for(n=gn.unique(o.toArray().concat(gn.makeArray(e))),o.length=n.length,r=0;r=a.length&&r(o)}))})})},co=function(e){return so(e,uo.nu)},lo=function(n){return{is:function(e){return n===e},isValue:C,isError:b,getOr:q(n),getOrThunk:q(n),getOrDie:q(n),or:function(e){return lo(n)},orThunk:function(e){return lo(n)},fold:function(e,t){return t(n)},map:function(e){return lo(e(n))},mapError:function(e){return lo(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return _.some(n)}}},fo=function(n){return{is:b,isValue:b,isError:C,getOr:$,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return fo(n)},mapError:function(e){return fo(e(n))},each:o,bind:function(e){return fo(n)},exists:b,forall:C,toOption:_.none}},mo={value:lo,error:fo,fromOption:function(e,t){return e.fold(function(){return fo(t)},lo)}};function go(e,u){var t=e,n=function(e,t,n,r){var o,i;if(e){if(!r&&e[t])return e[t];if(e!==u){if(o=e[n])return o;for(i=e.parentNode;i&&i!==u;i=i.parentNode)if(o=i[n])return o}}};this.current=function(){return t},this.next=function(e){return t=n(t,"firstChild","nextSibling",e)},this.prev=function(e){return t=n(t,"lastChild","previousSibling",e)},this.prev2=function(e){return t=function(e,t,n,r){var o,i,a;if(e){if(o=e[n],u&&o===u)return;if(o){if(!r)for(a=o[t];a;a=a[t])if(!a[t])return a;return o}if((i=e.parentNode)&&i!==u)return i}}(t,"lastChild","previousSibling",e)}}var po,ho,vo,yo=function(t){var n;return function(e){return(n=n||function(e,t){for(var n={},r=0,o=e.length;r\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ko=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xo=/[<>&\"\']/g,Yo=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,Go={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};ho={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},vo={"<":"<",">":">","&":"&",""":'"',"'":"'"};var Jo=function(e,t){var n,r,o,i={};if(e){for(e=e.split(","),t=t||10,n=0;n>10),56320+(1023&t))):Go[t]||String.fromCharCode(t):vo[e]||po[e]||(n=e,(r=ar.fromTag("div").dom()).innerHTML=n,r.textContent||r.innerText||n);var n,r})}},ni={},ri={},oi=Xt.makeMap,ii=Xt.each,ai=Xt.extend,ui=Xt.explode,si=Xt.inArray,ci=function(e,t){return(e=Xt.trim(e))?e.split(t||" "):[]},li=function(e){var u,t,n,r,o,i,s={},a=function(e,t,n){var r,o,i,a=function(e,t){var n,r,o={};for(n=0,r=e.length;n